/**
  * Renders a form in frontend (or backend maybe later)
  * Usage:
  *	$options			=	array(	$baseClass->_getPagingParamName( 'basket' )			=> $this->id,
  *									$baseClass->_getPagingParamName( 'bck' )			=> $this->checkHashUser()
  *									);
  *
  * @param  string              $actionType
  * @param  string              $action
  * @param  cbpaidTable         $dataModel
  * @param  array               $options
  * @param  int                 $user_id
  * @param  ParamsInterface     $input
  * @return string
  */
 public static function render($actionType, $action, $dataModel, $options = array(), $user_id = null, ParamsInterface $input = null)
 {
     global $_CB_framework;
     if ($options === null) {
         $options = array();
     }
     $di = Application::DI();
     if ($input === null) {
         $input = new Input(array());
     }
     $output = Output::createNew('html', array());
     $getParams = array('option' => 'com_comprofiler', 'view' => 'pluginclass', 'plugin' => 'cbpaidsubscriptions', 'user' => $user_id);
     if ($_CB_framework->getUi() == 1) {
         $itemid = getCBprofileItemid(0);
         if ($itemid) {
             $getParams['Itemid'] = $itemid;
         }
     }
     $route = array('option' => 'com_comprofiler', 'view' => $action, 'action' => $actionType, 'method' => 'edit');
     if ($route['view'] == '') {
         $route['view'] = 'pluginclass';
     }
     /** @var \CBLib\AhaWow\Controller\Controller $ahaWowController */
     $ahaWowController = $di->get('CBLib\\AhaWow\\Controller\\Controller', array('input' => $input, 'output' => $output, 'options' => $options, 'getParams' => $getParams, 'data' => $dataModel));
     self::registerXml($action, $actionType);
     $ahaWowController->dispatchRoute($route);
     return (string) $output;
 }
Exemplo n.º 2
0
	public function getProfileURL($user, $task='', $xhtml = true)
	{
		$user = KunenaFactory::getUser($user);
		if ($user->userid == 0) return false;
		// Get CUser object
		$cbUser = CBuser::getInstance( $user->userid );
		if($cbUser === null) return false;
		return cbSef( 'index.php?option=com_comprofiler&task=userProfile&user=' . $user->userid. getCBprofileItemid(), $xhtml );
	}
Exemplo n.º 3
0
 public function getInboxURL()
 {
     $userid = $this->getCBUserid();
     if ($userid === null) {
         return null;
     }
     $itemid = getCBprofileItemid();
     return cbSef('index.php?option=com_comprofiler&task=userProfile&user=' . $userid . $itemid);
 }
Exemplo n.º 4
0
	public function getInboxLink ($text) {
		if (!$text) $text = JText::_('COM_KUNENA_PMS_INBOX');
		global $_CB_framework;

		$cbpath = JPATH_ADMINISTRATOR . '/components/com_comprofiler/plugin.foundation.php';
		if (file_exists($cbpath)) require_once($cbpath);
		else return;

		$userid = $_CB_framework->myId();

		$cbUser =& CBuser::getInstance( (int) $userid );
		if($cbUser === null) return;

		$itemid = getCBprofileItemid();

		return CKunenaLink::GetHrefLink ( cbSef ('index.php?option=com_comprofiler&task=userProfile&user='******'', 'follow');
	}
Exemplo n.º 5
0
	/**
	* Generates the menu and user status to display on the user profile by calling back $this->addMenu
	* @param  moscomprofilerTab   $tab       the tab database entry
	* @param  moscomprofilerUser  $user      the user being displayed
	* @param  int                 $ui        1 for front-end, 2 for back-end
	* @return boolean                        either true, or false if ErrorMSG generated
	*/
	function getMenuAndStatus( $tab, $user, $ui ) {
		global $_CB_framework, $_CB_database, $ueConfig,$_REQUEST,$_POST;

		$params				=	$this->params;

		$Itemid				=	getCBprofileItemid( 0 );

		// Build basic menu:
		$ue_base_url		 = "index.php?option=com_comprofiler";
		if ( $Itemid ) {
			$ue_base_url	.= "&Itemid=" . $Itemid;	// Base URL string
		}
		$ue_credits_url		 = $ue_base_url."&task=teamCredits";
		$ue_userdetails_url	 = $ue_base_url."&task=userDetails" . $this->_addUid( $user );
		$ue_useravatar_url	 = $ue_base_url."&task=userAvatar" . $this->_addUid( $user );
		$ue_deleteavatar_url = $ue_base_url."&task=userAvatar&do=deleteavatar" . $this->_addUid( $user );
		$ue_unbanrequest_url = $ue_base_url."&task=banProfile&act=2&reportform=1&uid=".$user->id;
		$ue_banhistory_url   = $ue_base_url."&task=moderateBans&act=2&uid=".$user->id;
		$ue_ban_url 		 = $ue_base_url."&task=banProfile&act=1&uid=".$user->id;
		$ue_unban_url 		 = $ue_base_url."&task=banProfile&act=0&reportform=0&uid=".$user->id;
		$ue_reportuser_url	 = $ue_base_url."&task=reportUser&uid=".$user->id;
		$ue_viewuserreports_url = $ue_base_url."&task=viewReports&uid=".$user->id;
		$ue_viewOlduserreports_url = $ue_base_url."&task=viewReports&act=1&uid=".$user->id;
		$ue_approve_image_url= $ue_base_url."&task=approveImage&flag=1&avatars=".$user->id;
		$ue_reject_image_url = $ue_base_url."&task=approveImage&flag=0&avatars=".$user->id;
		$ue_userprofile_url	 = $ue_base_url."";
		$adminimagesdir		=	$_CB_framework->getCfg( 'live_site' ) . '/components/com_comprofiler/images/';

		// $this->menuBar->set("class", "mainlevel");		//BB: hardcoded to check >RC2.

		$firstMenuName		= $params->get('firstMenuName', '_UE_MENU_CB');
		$firstSubMenuName	= $params->get('firstSubMenuName', '_UE_MENU_ABOUT_CB');
		$firstSubMenuHref	= $params->get('firstSubMenuHref', $ue_credits_url);
		$secondSubMenuName	= $params->get('secondSubMenuName', '');
		$secondSubMenuHref	= $params->get('secondSubMenuHref', '');
		if ($firstMenuName != "") {
			$mi = array(); $mi[$firstMenuName]='';
		//	$this->_addMenuItem( $mi,$firstMenuName,"javascript:void(0)" );		// Community
			if ($firstSubMenuName != "") {
				unset($mi);
				if ($firstSubMenuHref == "") $firstSubMenuHref = "javascript:void(0)";
				$mi = array(); $mi[$firstMenuName]["_UE_TEAMCREDITS_CB"]='';
				$this->_addMenuItem( $mi,getLangDefinition($firstSubMenuName),cbSef($firstSubMenuHref) );		// About...
				if ($secondSubMenuName != "") {
					if ($secondSubMenuHref == "") $secondSubMenuHref = "javascript:void(0)";
					$mi = array(); $mi[$firstMenuName]["_UE_SECOND"]='';
					$this->_addMenuItem( $mi,getLangDefinition($secondSubMenuName),cbSef($secondSubMenuHref) );		// Free...
				}
			}
		}
		// ----- VIEW MENU - BEFORE EDIT MENU IF NOT VIEWING A PROFILE -----
		if ( $_CB_framework->myId() > 0 ) {
			// View My Profile:
			if ( $_CB_framework->displayedUser() === null ) {
				$mi = array(); $mi["_UE_MENU_VIEW"]["_UE_MENU_VIEWMYPROFILE"]=null;
				$this->_addMenuItem( $mi, _UE_MENU_VIEWMYPROFILE,cbSef($ue_userprofile_url), "",
				"","", _UE_MENU_VIEWMYPROFILE_DESC,"" );
			}
		}
		// ----- EDIT MENU -----
		if ( ! cbCheckIfUserCanPerformUserTask( $user->id, 'allowModeratorsUserEdit') ) {
			if ( $user->id == $_CB_framework->myId() ) {
				$menuTexts	=	array(	'_UE_UPDATEPROFILE'				=>	_UE_UPDATEPROFILE,
										'_UE_MENU_UPDATEPROFILE_DESC'	=>	_UE_MENU_UPDATEPROFILE_DESC,
										'_UE_UPDATEAVATAR'				=>	_UE_UPDATEAVATAR,
										'_UE_MENU_UPDATEAVATAR_DESC'	=>	_UE_MENU_UPDATEAVATAR_DESC,
										'_UE_DELETE_AVATAR'				=>	_UE_DELETE_AVATAR,
										'_UE_MENU_DELETE_AVATAR_DESC'	=>	_UE_MENU_DELETE_AVATAR_DESC
									);
			} else {
				$menuTexts	=	array(	'_UE_UPDATEPROFILE'				=>	_UE_MOD_MENU_UPDATEPROFILE,
										'_UE_MENU_UPDATEPROFILE_DESC'	=>	_UE_MOD_MENU_UPDATEPROFILE_DESC,
										'_UE_UPDATEAVATAR'				=>	_UE_MOD_MENU_UPDATEAVATAR,
										'_UE_MENU_UPDATEAVATAR_DESC'	=>	_UE_MOD_MENU_UPDATEAVATAR_DESC,
										'_UE_DELETE_AVATAR'				=>	_UE_MOD_MENU_DELETE_AVATAR,
										'_UE_MENU_DELETE_AVATAR_DESC'	=>	_UE_MOD_MENU_DELETE_AVATAR_DESC
									);
			}
			// Update Profile:
			$mi = array(); $mi["_UE_MENU_EDIT"]["_UE_UPDATEPROFILE"]=null;
			$this->_addMenuItem( $mi, $menuTexts['_UE_UPDATEPROFILE'],cbSef($ue_userdetails_url), "",
			"<img src=\"".$adminimagesdir."updateprofile.gif\" alt='' />","", $menuTexts['_UE_MENU_UPDATEPROFILE_DESC'],"" );
			// Update Avatar:
			if($ueConfig['allowAvatar']==1 && ($ueConfig['allowAvatarUpload']==1 || $ueConfig['allowAvatarGallery']==1)) {
				$mi = array(); $mi["_UE_MENU_EDIT"]["_UE_UPDATEAVATAR"]=null;
				$this->_addMenuItem( $mi, $menuTexts['_UE_UPDATEAVATAR'],cbSef($ue_useravatar_url), "",
				"<img src=\"".$adminimagesdir."newavatar.gif\" alt='' />","", $menuTexts['_UE_MENU_UPDATEAVATAR_DESC'],"" );
				// Delete Avatar:
				if($user->avatar!='' && $user->avatar!=null) {
					$mi = array(); $mi["_UE_MENU_EDIT"]["_UE_DELETE_AVATAR"]=null;
					$this->_addMenuItem( $mi, $menuTexts['_UE_DELETE_AVATAR'],cbSef($ue_deleteavatar_url), "",
					"<img src=\"".$adminimagesdir."delavatar.gif\" alt='' />","", $menuTexts['_UE_MENU_DELETE_AVATAR_DESC'],"" );
				}
			}
		}
		// ----- VIEW MENU - AFTER EDIT IF VIEWING A PROFILE -----
		if ( $_CB_framework->myId() > 0 ) {
			// View My Profile:
			if ( ( $_CB_framework->myId() != $user->id ) && ( $_CB_framework->displayedUser() !== null ) ) {
				$mi = array(); $mi["_UE_MENU_VIEW"]["_UE_MENU_VIEWMYPROFILE"]=null;
				$this->_addMenuItem( $mi, _UE_MENU_VIEWMYPROFILE,cbSef($ue_userprofile_url), "",
				"","", _UE_MENU_VIEWMYPROFILE_DESC,"" );
			}
		}
		// ----- MESSAGES MENU -----
		// Send PMS
		if ( $_CB_framework->myId() != $user->id && $_CB_framework->myId() > 0 ) {
			global $_CB_PMS;
			$resultArray = $_CB_PMS->getPMSlinks($user->id, $_CB_framework->myId(), "", "", 1);
			if (count($resultArray) > 0) {
				foreach ($resultArray as $res) {
				 	if (is_array($res)) {
						$mi = array(); $mi["_UE_MENU_MESSAGES"][$res["caption"]]=null;
						$this->_addMenuItem( $mi, getLangDefinition($res["caption"]),cbSef($res["url"]), "",
						"","", getLangDefinition($res["tooltip"]),"" );
				 	}
				}
			}
		}

		// Send Email
		$emailHtml=getFieldValue('primaryemailaddress',$user->email,$user);
		if ($ueConfig['allow_email_display']!=4 && $_CB_framework->myId() != $user->id && $_CB_framework->myId() > 0) {
			switch ($ueConfig['allow_email_display']) {
				case 1:	// Display Email only
					$caption = $emailHtml;
					$url = "javascript:void(0);";
					$desc = _UE_MENU_USEREMAIL_DESC;
					break;
				case 2:	// Display Email with link:
					$caption = null;
					$url = $emailHtml;
					$desc = _UE_MENU_SENDUSEREMAIL_DESC;
					break;
				case 3:	// Display Email-to text with link to web-form:
					$caption = _UE_MENU_SENDUSEREMAIL;
					$url = $emailHtml;
					$desc = _UE_MENU_SENDUSEREMAIL_DESC;
					break;
			}
			$mi = array(); $mi["_UE_MENU_MESSAGES"]["_UE_MENU_SENDUSEREMAIL"]=null;
			$this->_addMenuItem( $mi, $caption, $url, "", "", "", $desc, "" );
		}
		// ----- CONNECTIONS MENU -----
		IF ($ueConfig['allowConnections'] && $_CB_framework->myId() > 0) {
			$ue_addConnection_url = $ue_base_url."&amp;act=connections&amp;task=addConnection&amp;connectionid=".$user->id;
			$ue_removeConnection_url = $ue_base_url."&amp;act=connections&amp;task=removeConnection&amp;connectionid=".$user->id;
			$ue_manageConnection_url = $ue_base_url."&amp;task=manageConnections";
			
			// Manage My Connections
			$mi = array(); $mi["_UE_MENU_CONNECTIONS"]["_UE_MENU_MANAGEMYCONNECTIONS"]=null;
			$this->_addMenuItem( $mi, _UE_MENU_MANAGEMYCONNECTIONS,cbSef($ue_manageConnection_url), "",
			"","", _UE_MENU_MANAGEMYCONNECTIONS_DESC,"" );
			
			if ( $_CB_framework->myId() != $user->id ) {
				$_CB_database->setQuery("SELECT COUNT(*) FROM #__comprofiler_members WHERE referenceid=" . (int) $_CB_framework->myId() . " AND memberid=" . (int) $user->id);
				$isConnection = $_CB_database->loadResult();
				if ($isConnection) {
					$_CB_database->setQuery("SELECT COUNT(*) FROM #__comprofiler_members WHERE referenceid=" . (int) $_CB_framework->myId() . " AND memberid=" . (int) $user->id." AND pending=0");
					$isApproved = $_CB_database->loadResult();
					$_CB_database->setQuery("SELECT COUNT(*) FROM #__comprofiler_members WHERE referenceid=" . (int) $_CB_framework->myId() . " AND memberid=" . (int) $user->id." AND accepted=1");
					$isAccepted = $_CB_database->loadResult();
				}
				if($isConnection==0) {
					$connectionurl=cbSef($ue_addConnection_url);
					if ( $ueConfig['useMutualConnections'] == 1 ) {
						$fmsg	  = "_UE_ADDCONNECTIONREQUEST";
						$fmsgdesc = _UE_ADDCONNECTIONREQUEST_DESC;
					} else {
						$fmsg	  = "_UE_ADDCONNECTION";
						$fmsgdesc = _UE_ADDCONNECTION_DESC;
					}
					if($ueConfig['conNotifyType']!=0) {
						$connectionurl="javascript:void(0)\" onclick=\"return overlib('"
						. str_replace(array("<",">"), array("&lt;","&gt;"),
						_UE_CONNECTIONINVITATIONMSG."<br /><form action=&quot;".$connectionurl
						."&quot; method=&quot;post&quot; id=&quot;connOverForm&quot; name=&quot;connOverForm&quot;>"._UE_MESSAGE
						."<br /><textarea cols=&quot;40&quot; rows=&quot;8&quot; name=&quot;message&quot;></textarea><br />"
						. "<input type=&quot;button&quot; class=&quot;inputbox&quot; onclick=&quot;cbConnSubmReq();&quot; value=&quot;"
						._UE_SENDCONNECTIONREQUEST."&quot; />&nbsp;&nbsp;"
						."<input type=&quot;button&quot; class=&quot;inputbox&quot; onclick=&quot;cClick();&quot;  value=&quot;"
						._UE_CANCELCONNECTIONREQUEST."&quot; /></form>")
						."', STICKY, CAPTION,'"
						.sprintf(_UE_CONNECTTO,htmlspecialchars(str_replace("'","&#039;",getNameFormat($user->name,$user->username,$ueConfig['name_format'])),ENT_QUOTES))
						."', CENTER,CLOSECLICK,CLOSETEXT,'"._UE_CLOSE_OVERLIB."',WIDTH,350, ANCHOR,'cbAddConn',CENTERPOPUP,'LR','UR');";
						// $flink="<a href=\"".$connectionurl."\" id=\"cbAddConn\" name=\"cbAddConn\" title=\"".$fmsgdesc."\">".getLangDefinition($fmsg)."</a>";
						$flink = $connectionurl."\" name=\"cbAddConn";	//BBTRYREMOVED: "\" title=\"".$fmsgdesc."\">".getLangDefinition($fmsg)."</a>";
					} else {
						$flink=$connectionurl;
					}
				} else {
					if ($isAccepted) {
						$connectionurl=cbSef($ue_removeConnection_url);
						if ($isApproved) {
							$fmsg = "_UE_REMOVECONNECTION";
							$fmsgdesc=_UE_REMOVECONNECTION_DESC;
						} else {
							$fmsg = "_UE_REVOKECONNECTIONREQUEST";
							$fmsgdesc=_UE_REVOKECONNECTIONREQUEST_DESC;
						}
						// $flink="<a href=\"".$connectionurl."\" onclick=\"return confirmSubmit();\" title=\"".$fmsgdesc."\">".getLangDefinition($fmsg)."</a>";
						$flink = $connectionurl."\" onclick=\"return confirmSubmit();"; //BBTRYREMOVED: \" title=\"".$fmsgdesc."\">".getLangDefinition($fmsg)."</a>";
					} else {
						/*
						$connectionurl=cbSef($ue_manageConnection_url);
						$fmsg = "_UE_MANAGECONNECTIONS";				//BB this is wrong here, unless non-accepted connections are also displayed there
						$fmsgdesc=_UE_MENU_MANAGEMYCONNECTIONS_DESC;
						$flink=$connectionurl;
						*/
						$fmsg = null;		// manage connections is already above, no need to repeat here !
					}
				}
				// Request/Add/Remove/Revoke Connection
				if ( $fmsg ) {
					$mi = array(); $mi["_UE_MENU_CONNECTIONS"][$fmsg]=null;
					$this->_addMenuItem( $mi, getLangDefinition($fmsg), $flink /*$connectionurl*/, "",
					"","", $fmsgdesc,"" );
				}
			}

		}
		// ----- MODERATE MENU -----
		if ( $_CB_framework->myId() == $user->id ) {
			// Request to unban:
			if($user->banned==1 && $this->cbUserIsModerator==0 && $ueConfig['allowUserBanning']==1) {
				$mi = array(); $mi["_UE_MENU_MODERATE"]["_UE_REQUESTUNBANPROFILE"]=null;
				$this->_addMenuItem( $mi, _UE_REQUESTUNBANPROFILE,cbSef($ue_unbanrequest_url), "",
				"","", _UE_MENU_REQUESTUNBANPROFILE_DESC,"" );
			}
		} else {
			// Report User:
			if($ueConfig['allowUserReports']==1 && $this->cbUserIsModerator==0 && $_CB_framework->myId() > 0) {
				$mi = array(); $mi["_UE_MENU_MODERATE"]["_UE_REPORTUSER"]=null;
				$this->_addMenuItem( $mi, _UE_REPORTUSER,cbSef($ue_reportuser_url), "",
				"","", _UE_MENU_REPORTUSER_DESC,"" );
			}
			// Approve/Reject Avatar & Ban/Unban profile & View User Reports:
			if($this->cbMyIsModerator==1 && $this->cbUserIsModerator==0) {

				$query = "SELECT COUNT(*) FROM #__comprofiler_userreports  WHERE reportedstatus=0 AND reporteduser="******"SELECT COUNT(*) FROM #__comprofiler_userreports  WHERE reporteduser="******"_UE_MENU_MODERATE"]["_UE_APPROVE_IMAGE"]=null;
						$this->_addMenuItem( $mi, _UE_APPROVE_IMAGE,cbSef($ue_approve_image_url), "",
						"","", _UE_MENU_APPROVE_IMAGE_DESC,"" );
					}
					// Reject Image
					$mi = array(); $mi["_UE_MENU_MODERATE"]["_UE_REJECT_IMAGE"]=null;
					$this->_addMenuItem( $mi, _UE_REJECT_IMAGE,cbSef($ue_reject_image_url), "",
					"","", _UE_MENU_REJECT_IMAGE_DESC,"" );
				}
				if($ueConfig['allowUserBanning']==1) {
					if($user->banned!=0 ) {
						// unban profile
						$mi = array(); $mi["_UE_MENU_MODERATE"]["_UE_UNBANPROFILE"]=null;
						$this->_addMenuItem( $mi, _UE_UNBANPROFILE,cbSef($ue_unban_url), "",
						"","", _UE_MENU_UNBANPROFILE_DESC,"" );
					} else {
						// ban profile
						$mi = array(); $mi["_UE_MENU_MODERATE"]["_UE_BANPROFILE"]=null;
						$this->_addMenuItem( $mi, _UE_BANPROFILE,cbSef($ue_ban_url), "",
						"","", _UE_MENU_BANPROFILE_DESC,"" );
					}
					if( $user->bannedby ) {
						// ban history
						$mi = array(); $mi["_UE_MENU_MODERATE"]["_UE_MENU_BANPROFILE_HISTORY"]=null;
						$this->_addMenuItem( $mi, _UE_MENU_BANPROFILE_HISTORY,cbSef($ue_banhistory_url), "",
						"","", _UE_MENU_BANPROFILE_HISTORY_DESC,"" );
					}
				}
				if($ueConfig['allowUserReports']==1 && $userreports>0) {
					// view user reports
					$mi = array(); $mi["_UE_MENU_MODERATE"]["_UE_VIEWUSERREPORTS"]=null;
					$this->_addMenuItem( $mi, _UE_VIEWUSERREPORTS,cbSef($ue_viewuserreports_url), "",
					"","", _UE_MENU_VIEWUSERREPORTS_DESC,"" );
				} elseif($ueConfig['allowUserReports']==1 && $userreportsAllTimes>0) {
					// view user reports
					$mi = array(); $mi["_UE_MENU_MODERATE"]["_UE_VIEWUSERREPORTS"]=null;
					$this->_addMenuItem( $mi, _UE_MOD_MENU_VIEWOLDUSERREPORTS,cbSef($ue_viewOlduserreports_url), "",
					"","", _UE_MOD_MENU_VIEWOLDUSERREPORTS_DESC,"" );
				}
			}
		}
		// Test example:
		/*
		$mi = array(); $mi["_UE_MENU_CONNECTIONS"]["duplique"]=null;
		$this->addMenu( array(	"position"	=> "menuBar" ,		// "menuBar", "menuList"
									"arrayPos"	=> $mi ,
									"caption"	=> _UE_MENU_MANAGEMYCONNECTIONS ,
									"url"		=> cbSef($ue_manageConnection_url) ,		// can also be "<a ....>" or "javascript:void(0)" or ""
									"target"	=> "" ,	// e.g. "_blank"
									"img"		=> null ,	// e.g. "<img src='plugins/user/myplugin/images/icon.gif' width='16' height='16' alt='' />"
									"alt"		=> null ,	// e.g. "text"
									"tooltip"	=> _UE_MENU_MANAGEMYCONNECTIONS_DESC ,
									"keystroke"	=> null ) );	// e.g. "P"
		*/
	}
Exemplo n.º 6
0
function processConnectionActions($connectionids) {
	global $_CB_framework, $ueConfig, $_POST;

	// simple spoof check security
	cbSpoofCheck( 'manageConnections' );

	if(!$ueConfig['allowConnections']) {
		echo _UE_FUNCTIONALITY_DISABLED;
		return;
	}
	if ( ! ( $_CB_framework->myId() > 0 ) ) {
		cbNotAuth();
		return;
	}
	$cbCon	=	new cbConnection( $_CB_framework->myId() );

	if (is_array($connectionids)) {
		foreach($connectionids AS $cid) {
			$action		=	cbGetParam( $_POST, $cid . 'action' );
			if ( $action== 'd' ) {
				$cbCon->denyConnection( $_CB_framework->myId(), $cid );
			} elseif ( $action == 'a' ) {
				$cbCon->acceptConnection( $_CB_framework->myId(), $cid );
			}
		}
	}
	$error				=	$cbCon->getErrorMSG();
	if ( $error ) {
		cbRedirect( cbSef( 'index.php?option=com_comprofiler&amp;task=manageConnections' . getCBprofileItemid(), false ), $error, 'error' );
	} else {
		cbRedirect( cbSef( 'index.php?option=com_comprofiler&amp;task=manageConnections' . getCBprofileItemid(), false ),
							( is_array($connectionids) ) ? _UE_CONNECTIONACTIONSSUCCESSFULL : null );
	}
	return;
}
	/**
	 * Returns a protected user-specific invoice display address URL
	 *
	 * @param  UserTable  $user
	 * @return string
	 */
	protected function getInvoicesListUrl( &$user ) {
		$basegetarray			=	array( 'user' => $user->id, 'Itemid' => getCBprofileItemid( 0 ), 'act' => 'showinvoiceslist' );
		return $this->base->getHttpsAbsURLwithParam( $basegetarray, 'pluginclass', true );
	}
Exemplo n.º 8
0
 function getProfileURL($userid)
 {
     $cbUser =& CBuser::getInstance((int) $userid);
     if ($cbUser === null) {
         return;
     }
     return cbSef('index.php?option=com_comprofiler&task=userProfile&user=' . $userid . getCBprofileItemid());
 }
Exemplo n.º 9
0
 public static function getUserProfileLink($user_id, $source = '')
 {
     if ($source == 'easysocial') {
         if (JFile::exists(JPATH_ADMINISTRATOR . '/components/com_easysocial/includes/foundry.php')) {
             require_once JPATH_ADMINISTRATOR . '/components/com_easysocial/includes/foundry.php';
             $suser = Foundry::user($user_id);
             $sconfig = Foundry::config();
             $link = '';
             $name = $sconfig->get('users.aliasName') == 'realname' ? $suser->name : $suser->username;
             $name = $user_id . ':' . $name;
             // Check if the permalink is set
             if ($suser->permalink && !empty($suser->permalink)) {
                 $name = $suser->permalink;
             }
             // If alias exists and permalink doesn't we use the alias
             if ($suser->alias && !empty($suser->alias) && !$suser->permalink) {
                 $name = $suser->alias;
             }
             // Ensure that the name is a safe url.
             $name = JFilterOutput::stringURLSafe($name);
             $options = array('id' => $name);
             $link = FRoute::profile($options);
         }
     } else {
         if ($source == 'joomsocial') {
             if (JFile::exists(JPATH_ROOT . '/components/com_community/libraries/core.php')) {
                 include_once JPATH_ROOT . '/components/com_community/libraries/core.php';
                 $link = CRoute::_('index.php?option=com_community&view=profile&userid=' . $user_id);
             }
         } else {
             if ($source == 'cb') {
                 global $_CB_framework, $mainframe;
                 if (defined('JPATH_ADMINISTRATOR')) {
                     if (!file_exists(JPATH_ADMINISTRATOR . '/components/com_comprofiler/plugin.foundation.php')) {
                         echo 'CB not installed!';
                         return;
                     }
                     include_once JPATH_ADMINISTRATOR . '/components/com_comprofiler/plugin.foundation.php';
                 } else {
                     if (!file_exists($mainframe->getCfg('absolute_path') . '/administrator/components/com_comprofiler/plugin.foundation.php')) {
                         echo 'CB not installed!';
                         return;
                     }
                     include_once $mainframe->getCfg('absolute_path') . '/administrator/components/com_comprofiler/plugin.foundation.php';
                 }
                 $cbUser =& CBuser::getInstance($user_id);
                 if ($cbUser) {
                     $xhtml = '';
                     $link = cbSef('index.php?option=com_comprofiler&amp;task=userProfile&amp;user=' . $user_id . getCBprofileItemid(), $xhtml);
                 }
             }
         }
     }
     return $link;
 }
Exemplo n.º 10
0
 public function getUserProfileUrl($system, $userId, $urlOnly = true, $name = 'Guest', $attribs = array())
 {
     $url = '#';
     if ($userId) {
         switch ($system) {
             case 'cjforum':
                 $api = JPATH_ROOT . '/components/com_cjforum/lib/api.php';
                 if (file_exists($api)) {
                     require_once $api;
                     $profileApi = CjForumApi::getProfileApi();
                     $url = $profileApi->getUserProfileLink($userId, 'name', true);
                 }
                 break;
             case 'cjblog':
                 $api = JPATH_ROOT . '/components/com_cjblog/api.php';
                 if (file_exists($api)) {
                     require_once $api;
                     $url = CjBlogApi::get_user_profile_url($userId, 'name', true, $attribs);
                 }
                 break;
             case 'easyprofile':
                 $api = JPATH_ROOT . '/components/com_jsn/helpers/helper.php';
                 if (file_exists($api)) {
                     require_once $api;
                     $user = new JsnUser($userId);
                     $url = $user->getLink();
                 }
                 break;
             case 'jomsocial':
                 $jspath = JPATH_BASE . '/components/com_community/libraries/core.php';
                 if (file_exists($jspath)) {
                     include_once $jspath;
                     $url = CRoute::_('index.php? option=com_community&view=profile&userid=' . $userId);
                 }
                 break;
             case 'cb':
                 global $_CB_framework, $_CB_database, $ueConfig, $mainframe;
                 $api = JPATH_ADMINISTRATOR . '/components/com_comprofiler/plugin.foundation.php';
                 if (!is_file($api)) {
                     return;
                 }
                 require_once $api;
                 cbimport('cb.database');
                 cbimport('cb.tables');
                 cbimport('language.front');
                 cbimport('cb.field');
                 $url = cbSef('index.php?option=com_comprofiler&amp;task=userProfile&amp;user='******'kunena':
                 if ($this->_initialize_kunena() && $userId > 0) {
                     $user = KunenaFactory::getUser($userId);
                     if ($user === false) {
                         break;
                     }
                     $url = KunenaRoute::_('index.php?option=com_kunena&func=profile&userid=' . $user->userid, true);
                 }
                 break;
             case 'aup':
                 $api_AUP = JPATH_SITE . '/components/com_alphauserpoints/helper.php';
                 if (file_exists($api_AUP)) {
                     require_once $api_AUP;
                     $url = AlphaUserPointsHelper::getAupLinkToProfil($userId);
                 }
                 break;
             case 'easysocial':
                 $api = JPATH_ADMINISTRATOR . '/components/com_easysocial/includes/foundry.php';
                 if (file_exists($api)) {
                     require_once $api;
                     $my = Foundry::user($userId);
                     $url = FRoute::profile(array('id' => $my->getAlias()));
                     $name = $my->getName();
                 }
                 break;
         }
     }
     if ($url && !$urlOnly) {
         $url = JHtml::link($url, $name, $attribs);
     }
     return null == $url ? $name : $url;
 }
 /**
  * Gives the URL of a link with plugin parameters.
  *
  * @param  array    $paramArray        array of string with key name of parameters
  * @param  string   $task              cb task to link to (default: userProfile)
  * @param  boolean  $sefed             TRUE to call cbSef (default), FALSE to leave URL unsefed
  * @param  array    $excludeParamList  of string with keys of parameters to not include
  * @param  string   $format            'html', 'raw'		(added in CB 1.2.3)
  * @return string                      value of the parameter (htmlspecialchared)
  */
 function _getAbsURLwithParam($paramArray, $task = 'userProfile', $sefed = true, $excludeParamList = null, $format = 'html')
 {
     global $_POST, $_GET;
     if ($excludeParamList === null) {
         $excludeParamList = array();
     }
     $prefix = $this->_getPrefix();
     if ($task == 'userProfile') {
         $Itemid = (int) getCBprofileItemid(0);
         unset($paramArray['Itemid']);
     } elseif (isset($paramArray['Itemid'])) {
         $Itemid = (int) $paramArray['Itemid'];
         unset($paramArray['Itemid']);
     } elseif (isset($_POST['Itemid'])) {
         $Itemid = (int) cbGetParam($_POST, 'Itemid', 0);
     } elseif (isset($_GET['Itemid'])) {
         $Itemid = (int) cbGetParam($_GET, 'Itemid', 0);
     } else {
         $Itemid = (int) getCBprofileItemid(0);
     }
     if ($task == 'userProfile' && !isset($paramArray['user'])) {
         if (isset($_POST['user'])) {
             $paramArray['user'] = urldecode(cbGetParam($_POST, 'user', null));
         } else {
             $paramArray['user'] = urldecode(cbGetParam($_GET, 'user', null));
         }
     }
     if ($task == 'pluginclass') {
         $plugin = $this->getPluginObject();
         $unsecureChars = array('/', '\\', ':', ';', '{', '}', '(', ')', "\"", "'", '.', ',', "", ' ', "\t", "\n", "\r", "\v");
         $paramArray['plugin'] = substr(str_replace($unsecureChars, '', $plugin->element), 0, 32);
         $paramArray['tab'] = null;
     } elseif (strtolower($task) == 'manageconnections') {
         $paramArray['plugin'] = null;
         $paramArray['tab'] = null;
     } else {
         $paramArray['plugin'] = null;
         if (!isset($paramArray['tab'])) {
             $paramArray['tab'] = strtolower(get_class($this));
         }
     }
     $uri = 'index.php?option=com_comprofiler&amp;task=' . $task . (isset($paramArray['user']) && $paramArray['user'] ? '&amp;user='******'user'])) : '') . ($Itemid ? '&amp;Itemid=' . $Itemid : '') . ($paramArray['tab'] ? '&amp;tab=' . htmlspecialchars(stripslashes($paramArray['tab'])) : '') . ($paramArray['plugin'] ? '&amp;plugin=' . htmlspecialchars(stripslashes($paramArray['plugin'])) : '');
     reset($paramArray);
     while (list($key, $val) = each($paramArray)) {
         if (!in_array($key, array('Itemid', 'user', 'tab', 'plugin')) && !in_array($key, $excludeParamList)) {
             if ($val) {
                 $uri .= '&amp;' . htmlspecialchars($prefix . $key) . '=' . htmlspecialchars(stripslashes($val));
             }
         }
     }
     if ($sefed) {
         return cbSef($uri, true, $format);
     } else {
         return $uri;
     }
 }
Exemplo n.º 12
0
 public function getEditProfileURL($userid, $xhtml = true)
 {
     return cbSef('index.php?option=com_comprofiler&task=userDetails' . getCBprofileItemid(), $xhtml);
 }
Exemplo n.º 13
0
 /**
  * Returns a field in specified format
  *
  * @param  moscomprofilerFields  $field
  * @param  moscomprofilerUser    $user
  * @param  string                $output  'html', 'xml', 'json', 'php', 'csvheader', 'csv', 'rss', 'fieldslist', 'htmledit'
  * @param  string                $reason  'profile' for user profile view, 'edit' for profile edit, 'register' for registration, 'list' for user-lists
  * @param  int                   $list_compare_types   IF reason == 'search' : 0 : simple 'is' search, 1 : advanced search with modes, 2 : simple 'any' search
  * @return mixed                
  */
 function getField(&$field, &$user, $output, $reason, $list_compare_types)
 {
     global $_CB_framework, $ueConfig;
     $value = $user->get($field->name);
     switch ($output) {
         case 'html':
         case 'rss':
             if ($field->type == 'primaryemailaddress') {
                 $imgMode = 0;
                 if ($ueConfig['allow_email_display'] == 3 || $imgMode != 0) {
                     $oValueText = _UE_SENDEMAIL;
                 } else {
                     $oValueText = htmlspecialchars($value);
                 }
                 $emailIMG = '<img src="' . $_CB_framework->getCfg('live_site') . '/components/com_comprofiler/images/email.gif" border="0" alt="' . _UE_SENDEMAIL . '" title="' . _UE_SENDEMAIL . '" />';
                 switch ($imgMode) {
                     case 0:
                         $linkItemImg = null;
                         $linkItemSep = null;
                         $linkItemTxt = $oValueText;
                         break;
                     case 1:
                         $linkItemImg = $emailIMG;
                         $linkItemSep = null;
                         $linkItemTxt = null;
                         break;
                     case 2:
                         $linkItemImg = $emailIMG;
                         $linkItemSep = ' ';
                         $linkItemTxt = $oValueText;
                         break;
                 }
                 $oReturn = '';
                 //if no email or 4 (do not display email) then return empty string
                 if ($value == null || $ueConfig['allow_email_display'] == 4 || $imgMode != 0 && $ueConfig['allow_email_display'] == 1) {
                     // $oReturn				=	'';
                 } else {
                     switch ($ueConfig['allow_email_display']) {
                         case 1:
                             //display email only
                             $oReturn = moscomprofilerHTML::emailCloaking(htmlspecialchars($value), 0);
                             break;
                         case 2:
                             //mailTo link
                             // cloacking doesn't cloack the text of the hyperlink, if that text does contain email addresses		//TODO: fix it.
                             if (!$linkItemImg && $linkItemTxt == htmlspecialchars($value)) {
                                 $oReturn = moscomprofilerHTML::emailCloaking(htmlspecialchars($value), 1, '', 0);
                             } elseif ($linkItemImg && $linkItemTxt != htmlspecialchars($value)) {
                                 $oReturn = moscomprofilerHTML::emailCloaking(htmlspecialchars($value), 1, $linkItemImg . $linkItemSep . $linkItemTxt, 0);
                             } elseif ($linkItemImg && $linkItemTxt == htmlspecialchars($value)) {
                                 $oReturn = moscomprofilerHTML::emailCloaking(htmlspecialchars($value), 1, $linkItemImg, 0) . $linkItemSep;
                                 $oReturn .= moscomprofilerHTML::emailCloaking(htmlspecialchars($value), 1, '', 0);
                             } elseif (!$linkItemImg && $linkItemTxt != htmlspecialchars($value)) {
                                 $oReturn = moscomprofilerHTML::emailCloaking(htmlspecialchars($value), 1, $linkItemTxt, 0);
                             }
                             break;
                         case 3:
                             //email Form (with cloacked email address if visible)
                             $oReturn = "<a href=\"" . cbSef("index.php?option=com_comprofiler&amp;task=emailUser&amp;uid=" . $user->id . getCBprofileItemid(true)) . "\" title=\"" . _UE_MENU_SENDUSEREMAIL_DESC . "\">" . $linkItemImg . $linkItemSep;
                             if ($linkItemTxt && $linkItemTxt != _UE_SENDEMAIL) {
                                 $oReturn .= moscomprofilerHTML::emailCloaking($linkItemTxt, 0);
                             } else {
                                 $oReturn .= $linkItemTxt;
                             }
                             $oReturn .= "</a>";
                             break;
                     }
                 }
             } else {
                 // emailaddress:
                 if ($value == null) {
                     $oReturn = '';
                 } else {
                     if ($ueConfig['allow_email'] == 1) {
                         $oReturn = moscomprofilerHTML::emailCloaking(htmlspecialchars($value), 1, "", 0);
                     } else {
                         $oReturn = moscomprofilerHTML::emailCloaking(htmlspecialchars($value), 0);
                     }
                 }
             }
             break;
         case 'htmledit':
             $ajaxCheck = ($field->type == 'primaryemailaddress' && (isset($ueConfig['reg_email_checker']) && $ueConfig['reg_email_checker'] > 0) || $field->params->get('field_check_email', 0) || $_CB_framework->getUi() == 2) && $reason != 'search';
             if (defined('_CB_VALIDATE_NEW')) {
                 if ($ajaxCheck && $reason != 'search') {
                     $oReturn = $this->_fieldEditToHtml($field, $user, $reason, 'input', 'text', $value, '', null, true, array('email', $this->ajaxCheckField($field, $user, $reason, array('email:true'))));
                     // $this->ajaxCheckField( $field, $user, $reason );
                 } else {
                     $oReturn = $this->_fieldEditToHtml($field, $user, $reason, 'input', 'text', $value, '', null, true, $reason != 'search' ? array('email') : array());
                     if ($reason == 'search') {
                         $oReturn = $this->_fieldSearchModeHtml($field, $user, $oReturn, 'text', $list_compare_types);
                     }
                 }
             } else {
                 $oReturn = $this->_fieldEditToHtml($field, $user, $reason, 'input', 'text', $value, '', null, true, $reason != 'search' ? array('email') : array());
                 if ($reason == 'search') {
                     $oReturn = $this->_fieldSearchModeHtml($field, $user, $oReturn, 'text', $list_compare_types);
                 } elseif ($ajaxCheck) {
                     $this->ajaxCheckField($field, $user, $reason);
                 }
             }
             break;
         case 'json':
         case 'php':
         case 'xml':
         case 'csvheader':
         case 'fieldslist':
         case 'csv':
         default:
             $oReturn = parent::getField($field, $user, $output, $reason, $list_compare_types);
             break;
     }
     return $oReturn;
 }
    static function manageConnections($connections, $actions, $total, &$connMgmtTabs, &$pagingParams, $perpage, $connecteds = null)
    {
        global $_CB_framework, $ueConfig, $_REQUEST;
        $Itemid = $_CB_framework->itemid();
        $ui = 1;
        outputCbTemplate($ui);
        initToolTip(1);
        ob_start();
        ?>
var tabPanemyCon;
function showCBTabPaneMy( sName ) {
	if (typeof tabPanemyCon != "undefined" ) {
		switch ( sName.toLowerCase() ) {
			case "<?php 
        echo strtolower(_UE_MANAGEACTIONS);
        ?>
":
			case "manageactions":
			case "0":
				tabPanemyCon.setSelectedIndex( 0 );
				break;
			case "<?php 
        echo strtolower(_UE_MANAGECONNECTIONS);
        ?>
":
			case "manageconnections":
			case "1":
				tabPanemyCon.setSelectedIndex( 1 );
				break;
			case "<?php 
        echo strtolower(_UE_CONNECTEDWITH);
        ?>
":
			case "connectedfrom":
			case "2":
				tabPanemyCon.setSelectedIndex( 2 );
				break;
		}
	}
}
<?php 
        $cbjavascript = ob_get_contents();
        ob_end_clean();
        $_CB_framework->outputCbJQuery($cbjavascript);
        ob_start();
        ?>
function confirmSubmit() {
	if (confirm("<?php 
        echo _UE_CONFIRMREMOVECONNECTION;
        ?>
"))
		return true ;
	else
		return false ;
}
<?php 
        $cbjavascript = ob_get_contents();
        ob_end_clean();
        $_CB_framework->document->addHeadScriptDeclaration($cbjavascript);
        $tabs = new cbTabs(0, $ui);
        $cTypes = explode("\n", $ueConfig['connection_categories']);
        $connectionTypes = array();
        foreach ($cTypes as $cType) {
            if (trim($cType) != null && trim($cType) != "") {
                $connectionTypes[] = moscomprofilerHTML::makeOption(trim($cType), getLangDefinition(trim($cType)));
            }
        }
        ?>
<div class="contentheading"><?php 
        echo _UE_MANAGECONNECTIONS;
        ?>
</div><br />
<br />
<?php 
        echo $tabs->startPane("myCon");
        // Tab 0: Manange Actions:
        echo $tabs->startTab("myCon", _UE_MANAGEACTIONS . " (" . count($actions) . ")", "action");
        if (!count($actions) > 0) {
            echo "\t\t<div class=\"tab_Description\">" . _UE_NOACTIONREQUIRED . "</div>\n";
        } else {
            echo '<form method="post" action="' . cbSef('index.php?option=com_comprofiler&amp;task=processConnectionActions' . ($Itemid ? "&amp;Itemid=" . (int) $Itemid : "")) . '">';
            echo "\t\t<div class=\"tab_Description\">" . _UE_CONNECT_ACTIONREQUIRED . "</div>\n";
            // echo "<div style=\"width:100%;text-align:right;\"><input type=\"submit\" class=\"inputbox\"  value=\""._UE_UPDATE."\" /></div>";
            echo "<table cellpadding=\"5\" cellspacing=\"0\" border=\"0\" width=\"95%\">";
            echo "<tr>";
            echo "<td>";
            foreach ($actions as $action) {
                $conAvatar = null;
                $conAvatar = getFieldValue('image', $action->avatar, $action);
                $onlineIMG = $ueConfig['allow_onlinestatus'] == 1 ? getFieldValue('status', $action->isOnline, $action, null, 1) : "";
                $tipField = "<b>" . _UE_CONNECTIONREQUIREDON . "</b> : " . dateConverter($action->membersince, 'Y-m-d', $ueConfig['date_format']);
                if ($action->reason != null) {
                    $tipField .= "<br /><b>" . _UE_CONNECTIONMESSAGE . "</b> :<br />" . htmlspecialchars($action->reason, ENT_QUOTES);
                }
                $tipTitle = _UE_CONNECTIONREQUESTDETAIL;
                $htmltext = $conAvatar;
                $style = "style=\"padding:5px;\"";
                $tooltip = cbFieldTip($ui, $tipField, $tipTitle, '250', '', $htmltext, '', $style, '', false);
                echo "<div class=\"connectionBox\">";
                echo $onlineIMG . ' ' . getNameFormat($action->name, $action->username, $ueConfig['name_format']) . "<br />" . $tooltip . "<br /><img src=\"components/com_comprofiler/images/tick.png\" border=\"0\" alt=\"" . _UE_ACCEPTCONNECTION . "\" title=\"" . _UE_ACCEPTCONNECTION . "\" /><input type=\"radio\"  value=\"a\" checked=\"checked\" name=\"" . $action->id . "action\"/> <img src=\"components/com_comprofiler/images/publish_x.png\" border=\"0\" alt=\"" . _UE_DECLINECONNECTION . "\" title=\"" . _UE_DECLINECONNECTION . "\" /><input type=\"radio\" value=\"d\" name=\"" . $action->id . "action\"/><input type=\"hidden\" name=\"uid[]\" value=\"" . $action->id . "\" />";
                echo " </div>\n";
            }
            echo "</td>";
            echo "</tr>";
            echo "</table>";
            echo "<div style=\"width:100%;text-align:right;\"><input type=\"submit\" class=\"button\"  value=\"" . _UE_UPDATE . "\" /></div>";
            echo cbGetSpoofInputTag('manageConnections');
            echo "</form>";
        }
        echo $tabs->endTab();
        // Tab 1: Manange Connections:
        echo $tabs->startTab("myCon", _UE_MANAGECONNECTIONS, "connections");
        if (!count($connections) > 0) {
            echo "\t\t<div class=\"tab_Description\">" . _UE_NOCONNECTIONS . "</div>\n";
        } else {
            ?>
	<form action='<?php 
            echo cbSef('index.php?option=com_comprofiler&amp;task=saveConnections' . ($Itemid ? "&amp;Itemid=" . (int) $Itemid : ""));
            ?>
' method='post' name='userAdmin'>
	<div class="tab_Description"><?php 
            echo _UE_CONNECT_MANAGECONNECTIONS;
            ?>
</div>
	<table cellpadding="5" cellspacing="0" border="0" width="95%">
	  <thead><tr>
		<th style='text-align:center;'><?php 
            echo _UE_CONNECTION;
            ?>
</th>
		<th style='text-align:center;'><?php 
            echo _UE_CONNECTIONTYPE;
            ?>
</th>
		<th style='text-align:center;'><?php 
            echo _UE_CONNECTIONCOMMENT;
            ?>
</th>
	  </tr></thead>
	  <tbody>
<?php 
            $i = 1;
            foreach ($connections as $connection) {
                $k = explode('|*|', trim($connection->type));
                $list = array();
                $list['connectionType'] = moscomprofilerHTML::selectList($connectionTypes, $connection->id . 'connectiontype[]', 'class="inputbox" multiple="multiple" size="5"', 'value', 'text', $k, 0);
                $conAvatar = null;
                $conAvatar = getFieldValue('image', $connection->avatar, $connection);
                $emailIMG = getFieldValue('primaryemailaddress', $connection->email, $connection, null, 1);
                $pmIMG = getFieldValue('pm', $connection->username, $connection, null, 1);
                $onlineIMG = $ueConfig['allow_onlinestatus'] == 1 ? getFieldValue('status', $connection->isOnline, $connection, null, 1) : "";
                if ($connection->accepted == 1 && $connection->pending == 1) {
                    $actionIMG = "<img src=\"components/com_comprofiler/images/pending.png\" border=\"0\" alt=\"" . _UE_CONNECTIONPENDING . "\" title=\"" . _UE_CONNECTIONPENDING . "\" /> <a href=\"" . cbSef("index.php?option=com_comprofiler&amp;act=connections&amp;task=removeConnection&amp;connectionid=" . $connection->memberid . ($Itemid ? "&amp;Itemid=" . (int) $Itemid : "")) . "\" onclick=\"return confirmSubmit();\" ><img src=\"components/com_comprofiler/images/publish_x.png\" border=\"0\" alt=\"" . _UE_REMOVECONNECTION . "\" title=\"" . _UE_REMOVECONNECTION . "\" /></a>";
                } elseif ($connection->accepted == 1 && $connection->pending == 0) {
                    $actionIMG = "<a href=\"" . cbSef("index.php?option=com_comprofiler&amp;act=connections&amp;task=removeConnection&amp;connectionid=" . $connection->memberid . ($Itemid ? "&amp;Itemid=" . (int) $Itemid : "")) . "\" onclick=\"return confirmSubmit();\" ><img src=\"components/com_comprofiler/images/publish_x.png\" border=\"0\" alt=\"" . _UE_REMOVECONNECTION . "\" title=\"" . _UE_REMOVECONNECTION . "\" /></a>";
                } elseif ($connection->accepted == 0) {
                    $actionIMG = "<a href=\"" . cbSef("index.php?option=com_comprofiler&amp;act=connections&amp;task=acceptConnection&amp;connectionid=" . $connection->memberid . ($Itemid ? "&amp;Itemid=" . (int) $Itemid : "")) . "\"><img src=\"components/com_comprofiler/images/tick.png\" border=\"0\" alt=\"" . _UE_ACCEPTCONNECTION . "\" title=\"" . _UE_ACCEPTCONNECTION . "\" /></a> <a href=\"" . cbSef("index.php?option=com_comprofiler&amp;act=connections&amp;task=removeConnection&amp;connectionid=" . $connection->memberid . ($Itemid ? "&amp;Itemid=" . (int) $Itemid : "")) . "\"><img src=\"components/com_comprofiler/images/publish_x.png\" border=\"0\" alt=\"" . _UE_REMOVECONNECTION . "\" title=\"" . _UE_DECLINECONNECTION . "\" /></a>";
                }
                $tipField = "<b>" . _UE_CONNECTEDSINCE . "</b> : " . dateConverter($connection->membersince, 'Y-m-d', $ueConfig['date_format']);
                if ($connection->type != null) {
                    $tipField .= "<br /><b>" . _UE_CONNECTIONTYPE . "</b> : " . getConnectionTypes($connection->type);
                }
                if ($connection->description != null) {
                    $tipField .= "<br /><b>" . _UE_CONNECTEDCOMMENT . "</b> : " . htmlspecialchars($connection->description);
                }
                $tipTitle = _UE_CONNECTEDDETAIL;
                $htmltext = $conAvatar;
                $style = "style=\"padding:5px;\"";
                $tooltip = cbFieldTip($ui, $tipField, $tipTitle, '200', '', $htmltext, '', $style, '', false);
                echo "\n<tr style='vertical-align:top;' class='sectiontableentry" . $i . "'>";
                echo "\n\t<td style='text-align:center;'>" . $onlineIMG . ' ' . getNameFormat($connection->name, $connection->username, $ueConfig['name_format']) . "<br />" . $tooltip . "<br />" . $actionIMG . " <a href=\"" . cbSef("index.php?option=com_comprofiler&amp;task=userProfile&amp;user="******"&amp;Itemid=" . (int) $Itemid : "")) . "\"><img src=\"components/com_comprofiler/images/profiles.gif\" border=\"0\" alt=\"" . _UE_VIEWPROFILE . "\" title=\"" . _UE_VIEWPROFILE . "\" /></a> " . $emailIMG . " " . $pmIMG . "</td>";
                echo "\n\t<td style='text-align:center;'>" . $list['connectionType'] . "</td>";
                echo "\n\t<td style='text-align:center;'><textarea cols=\"25\" class=\"inputbox\"  rows=\"5\" name=\"" . $connection->id . "description\">" . htmlspecialchars($connection->description) . "</textarea><input type=\"hidden\" name=\"uid[]\" value=\"" . $connection->id . "\" /></td>";
                echo "\n</tr>";
                $i = $i == 1 ? 2 : 1;
            }
            echo "</tbody>";
            echo "</table><br />";
            if ($perpage < $total) {
                echo "<div style='width:95%;text-align:center;'>" . $connMgmtTabs->_writePaging($pagingParams, 'connections_', $perpage, $total, 'manageConnections') . "</div>";
            }
            echo "<div style=\"width:100%;text-align:right;\"><input type=\"submit\" class=\"button\"  value=\"" . _UE_UPDATE . "\" /></div>";
            echo cbGetSpoofInputTag('manageConnections');
            echo "</form>";
        }
        echo $tabs->endTab();
        // Tab 2: Users connected with me:
        if ($ueConfig['autoAddConnections'] == 0) {
            echo $tabs->startTab('myCon', _UE_CONNECTEDWITH, 'connected');
            if (!count($connecteds) > 0) {
                echo _UE_NOCONNECTEDWITH;
            } else {
                // tooltip params:
                $width = '200';
                $icon = '';
                $href = '';
                echo '<table cellpadding="5" cellspacing="0" border="0" width="95%">';
                echo '<tr>';
                echo '<td>';
                foreach ($connecteds as $connected) {
                    $conAvatar = null;
                    $conAvatar = getFieldValue('image', $connected->avatar, $connected);
                    $emailIMG = getFieldValue('primaryemailaddress', $connected->email, $connected, null, 1);
                    $pmIMG = getFieldValue('pm', $connected->username, $connected, null, 1);
                    $onlineIMG = $ueConfig['allow_onlinestatus'] == 1 ? getFieldValue('status', $connected->isOnline, $connected, null, 1) : '';
                    if ($connected->accepted == 1 && $connected->pending == 1) {
                        $actionIMG = '<img src="components/com_comprofiler/images/pending.png" border="0" alt="' . _UE_CONNECTIONPENDING . '" title="' . _UE_CONNECTIONPENDING . '" /> ' . '<a href="' . cbSef('index.php?option=com_comprofiler&amp;act=connections&amp;task=denyConnection&amp;connectionid=' . $connected->memberid . ($Itemid ? '&amp;Itemid=' . (int) $Itemid : '')) . '" onclick="return confirmSubmit();">' . '<img src="components/com_comprofiler/images/publish_x.png" border="0" alt="' . _UE_REMOVECONNECTION . '" title="' . _UE_REMOVECONNECTION . '" /></a>';
                    } elseif ($connected->accepted == 1 && $connected->pending == 0) {
                        $actionIMG = '<a href="' . cbSef('index.php?option=com_comprofiler&amp;act=connections&amp;task=denyConnection&amp;connectionid=' . $connected->referenceid . ($Itemid ? '&amp;Itemid=' . (int) $Itemid : '')) . '" onclick="return confirmSubmit();">' . '<img src="components/com_comprofiler/images/publish_x.png" border="0" alt="' . _UE_REMOVECONNECTION . '" title="' . _UE_REMOVECONNECTION . '" /></a>';
                    } elseif ($connected->accepted == 0) {
                        $actionIMG = '<a href="' . cbSef('index.php?option=com_comprofiler&amp;act=connections&amp;task=acceptConnection&amp;connectionid=' . $connected->referenceid . ($Itemid ? '&amp;Itemid=' . (int) $Itemid : '')) . '">' . '<img src="components/com_comprofiler/images/tick.png" border="0" alt="' . _UE_ACCEPTCONNECTION . '" title="' . _UE_ACCEPTCONNECTION . '" /></a> ' . '<a href="' . cbSef('index.php?option=com_comprofiler&amp;act=connections&amp;task=denyConnection&amp;connectionid=' . $connected->referenceid . ($Itemid ? '&amp;Itemid=' . (int) $Itemid : '')) . '" onclick="return confirmSubmit();">' . '<img src="components/com_comprofiler/images/publish_x.png" border="0" alt="' . _UE_REMOVECONNECTION . '" title="' . _UE_DECLINECONNECTION . '" /></a>';
                    }
                    $tipField = '<b>' . _UE_CONNECTEDSINCE . '</b> : ' . dateConverter($connected->membersince, 'Y-m-d', $ueConfig['date_format']);
                    if (getLangDefinition($connected->type) != null) {
                        $tipField .= '<br /><b>' . _UE_CONNECTIONTYPE . '</b> : ' . getLangDefinition($connected->type);
                    }
                    if ($connected->description != null) {
                        $tipField .= '<br /><b>' . _UE_CONNECTEDCOMMENT . '</b> : ' . htmlspecialchars($connected->description);
                    }
                    $tipTitle = _UE_CONNECTEDDETAIL;
                    $htmltext = $conAvatar;
                    $style = 'style="padding:5px;"';
                    $tooltip = cbFieldTip($ui, $tipField, $tipTitle, $width, $icon, $htmltext, $href, $style, '', false);
                    echo '<div class="connectionBox">';
                    echo $actionIMG . '<br />';
                    echo $tooltip . '<br />';
                    echo $onlineIMG . ' ' . getNameFormat($connected->name, $connected->username, $ueConfig['name_format']);
                    echo '<br /><a href="' . cbSef('index.php?option=com_comprofiler&amp;task=userProfile&amp;user='******'&amp;Itemid=' . (int) $Itemid : '')) . '"><img src="components/com_comprofiler/images/profiles.gif" border="0" alt="' . _UE_VIEWPROFILE . '" title="' . _UE_VIEWPROFILE . '" /></a> ' . $emailIMG . ' ' . $pmIMG . "\n";
                    echo " </div>\n";
                }
                echo '</td>';
                echo '</tr>';
                echo '</table>';
            }
            echo $tabs->endTab();
        }
        echo $tabs->endPane();
        if (isset($_REQUEST['tab'])) {
            $_CB_framework->outputCbJQuery("showCBTabPaneMy( '" . addslashes(urldecode(stripslashes(cbGetParam($_REQUEST, 'tab')))) . "' );");
        } elseif (!(count($actions) > 0)) {
            $_CB_framework->outputCbJQuery("tabPanemyCon.setSelectedIndex( 1 );");
        }
        echo '<div style="clear:both;padding:5px"><a href="' . cbSef('index.php?option=com_comprofiler' . getCBprofileItemid(true)) . '">' . _UE_BACK_TO_YOUR_PROFILE . '</a></div>';
    }
Exemplo n.º 15
0
 /**
  * Returns a raw CB task specific url (without SEF)
  *
  * @param string $task 'manageconnections', 'registers', 'lostpassword', 'login', 'logout', 'moderateimages', 'moderatereports', 'moderatebans', 'viewreports', 'processreports', 'pendingapprovaluser'
  * @param bool $htmlspecialchars
  * @param array $variables array of variables to append to the url
  * @param string $format 'html', 'component', 'raw', 'rawrel'
  * @param int $ssl '1' force HTTPS, '0' leave as is, '-1' force HTTP
  * @param string $additional additional string to append to itemid url check (note: this is unchecked)
  * @return string
  */
 function rawViewUrl($task, $htmlspecialchars = true, $variables = array(), $format = 'html', $ssl = 0, $additional = null)
 {
     $extra = null;
     if ($variables && is_array($variables)) {
         foreach ($variables as $name => $value) {
             if ($name && $value !== null) {
                 if (is_array($value)) {
                     $value = implode('|*|', $value);
                 }
                 $extra .= '&' . urlencode($name) . '=' . urlencode($value);
             }
         }
     }
     if (!$task) {
         $task = 'userprofile';
     }
     return $this->cbSef('index.php?option=com_comprofiler&view=' . urlencode($task) . $extra . getCBprofileItemid(false, $task, $additional), $htmlspecialchars, $format, $ssl, false);
 }
 /**
  * @param ListTable     $row
  * @param UserTable[]   $users
  * @param array         $columns
  * @param FieldTable[]  $fields
  * @param array         $input
  * @param string|null   $search
  * @param int           $searchmode
  * @param cbPageNav     $pageNav
  * @param UserTable     $myUser
  * @param FieldTable[]  $searchableFields
  * @param stdClass      $searchValues
  * @param cbTabs        $tabs
  * @param string|null   $errorMsg
  * @param bool          $listAll
  * @param int           $random
  */
 static function usersList(&$row, &$users, &$columns, &$fields, &$input, $search, $searchmode, $pageNav, &$myUser, &$searchableFields, &$searchValues, &$tabs, $errorMsg, $listAll = true, $random = 0)
 {
     global $_CB_framework, $_PLUGINS, $_POST, $_GET, $_REQUEST;
     $params = new Registry($row->params);
     // The Itemid for this userlist; kept for trigger B/C:
     $Itemid = getCBprofileItemid(null, 'userslist', '&listid=' . (int) $row->listid);
     $results = $_PLUGINS->trigger('onBeforeDisplayUsersList', array(&$row, &$users, &$columns, &$fields, &$input, $row->listid, &$search, &$Itemid, 1));
     // $uid = 1
     // Plugin content divided by location:
     $pluginAdditions = array('search', 'header', 'footer');
     $pluginAdditions['search'] = array();
     $pluginAdditions['header'] = array();
     $pluginAdditions['footer'] = array();
     if (is_array($results) && count($results) > 0) {
         foreach ($results as $res) {
             if (is_array($res)) {
                 foreach ($res as $k => $v) {
                     $pluginAdditions[$k][] = $v;
                 }
             }
         }
     }
     outputCbTemplate(1);
     outputCbJs();
     cbValidator::loadValidation();
     $cbTemplate = HTML_comprofiler::_cbTemplateLoad();
     if ($errorMsg) {
         $_CB_framework->enqueueMessage($errorMsg, 'error');
     }
     // Page title and pathway:
     $listTitleHtml = cbReplaceVars($row->title, $myUser);
     $listTitleNoHtml = strip_tags(cbReplaceVars($row->title, $myUser, false, false));
     $listDescription = cbReplaceVars($row->description, $myUser);
     $_CB_framework->setPageTitle($listTitleNoHtml);
     $_CB_framework->appendPathWay($listTitleHtml);
     // Add row click JS:
     if ($params->get('allow_profilelink', 1)) {
         $allowProfileLink = true;
     } else {
         $allowProfileLink = false;
     }
     $js = "var cbUserURLs = [];";
     if (is_array($users) && $allowProfileLink) {
         // Ensures the jQuery array index matches the same as HTML ID index (e.g. cbU0, cbU1):
         $index = 0;
         foreach ($users as $user) {
             $js .= "cbUserURLs[{$index}] = '" . addslashes($_CB_framework->userProfileUrl((int) $user->id, false)) . "';";
             $index++;
         }
     }
     $js .= "\$( '.cbUserListRow' ).click( function( e ) {" . "if ( ! ( \$( e.target ).is( 'a' ) || ( \$( e.target ).is( 'img' ) && \$( e.target ).parent().is( 'a' ) ) || \$( e.target ).hasClass( 'cbClicksInside' ) || ( \$( e.target ).parents( '.cbClicksInside' ).length > 0 ) || ( \$( this ).attr( 'id' ) == '' ) ) ) {" . "var index = \$( this ).prop( 'id' ).substr( 3 );";
     if ($allowProfileLink) {
         $js .= "window.location = cbUserURLs[index];";
     }
     $js .= "return false;" . "}" . "});";
     $_CB_framework->outputCbJQuery($js);
     // Search JS:
     $isSearching = $search !== null;
     if ($isSearching && $params->get('list_search_collapse', 0) && !in_array($searchmode, array(1, 2))) {
         $isCollapsed = true;
     } else {
         $isCollapsed = false;
     }
     if (count($searchableFields) > 0) {
         cbUsersList::outputAdvancedSearchJs($isCollapsed ? null : $search);
     }
     // Base form URL:
     $baseUrl = $_CB_framework->rawViewUrl('userslist', true, array('listid' => (int) $row->listid, 'searchmode' => 0), 'html', 0, '&listid=' . (int) $row->listid);
     // Searching attributes:
     $showAll = $search === null;
     $criteriaTitle = cbReplaceVars(CBTxt::Th('UE_SEARCH_CRITERIA', 'Search criteria'), $myUser);
     if ($searchmode == 0 || $searchmode == 1 && count(get_object_vars($searchValues)) || $searchmode == 2) {
         $resultsTitle = cbReplaceVars(CBTxt::Th('UE_SEARCH_RESULTS', 'Search results'), $myUser);
     } else {
         $resultsTitle = null;
     }
     // Search content:
     $searchTabContent = $tabs->getSearchableContents($searchableFields, $myUser, $searchValues, $params->get('list_compare_types', 0));
     if (count($pluginAdditions['search'])) {
         $searchTabContent .= '<div class="cbUserListSearchPlugins">' . '<div>' . implode('</div><div>', $pluginAdditions['search']) . '</div>' . '</div>';
     }
     // User row content:
     $tableContent =& HTML_comprofiler::_getListTableContent($users, $columns, $fields);
     if ($params->get('list_grid_layout', 0)) {
         $layout = 'grid';
     } else {
         $layout = 'list';
     }
     $gridHeight = (int) $params->get('list_grid_height', 200);
     $gridWidth = (int) $params->get('list_grid_width', 200);
     if ($params->get('list_show_selector', 1)) {
         $listSelector = true;
     } else {
         $listSelector = false;
     }
     $pageClass = $_CB_framework->getMenuPageClass();
     $return = '<div class="cbUsersList cb_template cb_template_' . selectTemplate('dir') . ($pageClass ? ' ' . htmlspecialchars($pageClass) : null) . '">' . '<form action="' . $_CB_framework->rawViewUrl('userslist', true, array('listid' => (int) $row->listid), 'html', 0, '&listid=' . (int) $row->listid) . '" method="get" id="adminForm" name="adminForm" class="cb_form form-auto cbValidation">' . '<input type="hidden" name="option" value="com_comprofiler" />' . '<input type="hidden" name="view" value="userslist" />' . (!$listSelector ? '<input type="hidden" name="listid" value="' . (int) $row->listid . '" />' : null) . '<input type="hidden" name="Itemid" value="' . (int) $Itemid . '" />' . '<input type="hidden" name="limitstart" value="0" />' . '<input type="hidden" name="searchmode" value="' . (int) $searchmode . '" />' . '<input type="hidden" name="search" value="" />' . ($random ? '<input type="hidden" name="rand" value="' . (int) $random . '" />' : null) . cbGetSpoofInputTag('userslist') . $_PLUGINS->callTemplate($cbTemplate, 'List', 'drawListHead', array(&$input, $row->listid, $pageNav->total, $showAll, $searchTabContent, $isSearching, $baseUrl, $listTitleHtml, $listDescription, $criteriaTitle, $resultsTitle, $listAll, $listSelector, $isCollapsed, $searchmode), 'html');
     if ($searchmode == 0 || $searchmode == 1 && count(get_object_vars($searchValues)) || $searchmode == 2) {
         $canPage = $params->get('list_paging', 1) && ($pageNav->limitstart != 0 || $pageNav->limit <= $pageNav->total);
         if (count($pluginAdditions['header'])) {
             $return .= '<div class="cbUserListHeader">' . '<div>' . implode('</div><div>', $pluginAdditions['header']) . '</div>' . '</div>';
         }
         $return .= $_PLUGINS->callTemplate($cbTemplate, 'List', 'drawListBody', array(&$users, &$columns, &$tableContent, $row->listid, $allowProfileLink, $layout, $gridHeight, $gridWidth, $searchmode), 'html');
         if ($canPage) {
             $return .= '<div class="cbUserListPagination cbUserListPaginationBottom text-center">' . $pageNav->getListLinks() . '</div>';
         }
         if (count($pluginAdditions['footer'])) {
             $return .= '<div class="cbUserListFooter">' . '<div>' . implode('</div><div>', $pluginAdditions['footer']) . '</div>' . '</div>';
         }
     }
     $return .= '</form>' . '</div>' . cbPoweredBy();
     echo $return;
     $_CB_framework->setMenuMeta();
 }
Exemplo n.º 17
0
 /**
  * Gets the user profile url of selected <code>system</code>. Currently supported systems are <br><br> 
  * 
  * JomSocial - jomsocial, Community Builder - cb, Touch - touch, Kunena - kunena, Alpha User Points - aup
  * 
  * @param string $system User profile system
  * @param int $userid user id
  * @param string $username User name to be used to display with link
  * @param array $links array of links for mighty touch
  * @param path_only boolean want to retrive just the url or the full html hyperlink markup?
  * 
  * @return string user profile url
  */
 public static function get_user_profile_url($system, $userid = 0, $username = '******', $path_only = true, $attribs = array())
 {
     $link = null;
     switch ($system) {
         case 'cjforum':
             $api = JPATH_ROOT . '/components/com_cjforum/helpers/api.php';
             if (file_exists($api)) {
                 require_once $api;
                 $link = CjForumApi::get_user_profile_url($userid, $path_only, $attribs);
             }
             break;
         case 'cjblog':
             $api = JPATH_ROOT . DS . 'components' . DS . 'com_cjblog' . DS . 'api.php';
             if (file_exists($api)) {
                 require_once $api;
                 $link = CjBlogApi::get_user_profile_url($userid, 'name', $path_only, $attribs);
             }
             break;
         case 'jomsocial':
             $jspath = JPATH_BASE . DS . 'components' . DS . 'com_community' . DS . 'libraries' . DS . 'core.php';
             if (file_exists($jspath)) {
                 include_once $jspath;
                 if ($path_only) {
                     $link = CRoute::_('index.php? option=com_community&view=profile&userid=' . $userid);
                 } else {
                     $link = JHtml::link(CRoute::_('index.php? option=com_community&view=profile&userid=' . $userid), $username, $attribs);
                 }
             }
             break;
         case 'cb':
             global $_CB_framework, $_CB_database, $ueConfig, $mainframe;
             $api = JPATH_ADMINISTRATOR . '/components/com_comprofiler/plugin.foundation.php';
             if (!is_file($api)) {
                 return;
             }
             require_once $api;
             cbimport('cb.database');
             cbimport('cb.tables');
             cbimport('language.front');
             cbimport('cb.field');
             $url = cbSef('index.php?option=com_comprofiler&amp;task=userProfile&amp;user='******'kunena':
             if (CJFunctions::_initialize_kunena() && $userid > 0) {
                 $user = KunenaFactory::getUser($userid);
                 if ($user === false) {
                     break;
                 }
                 if ($path_only) {
                     $link = KunenaRoute::_('index.php?option=com_kunena&func=profile&userid=' . $user->userid, true);
                 } else {
                     $link = JHtml::link(KunenaRoute::_('index.php?option=com_kunena&func=profile&userid=' . $user->userid, true), $user->name, $attribs);
                 }
             }
             break;
         case 'aup':
             $api_AUP = JPATH_SITE . DS . 'components' . DS . 'com_alphauserpoints' . DS . 'helper.php';
             if (file_exists($api_AUP)) {
                 require_once $api_AUP;
                 if ($path_only) {
                     $link = AlphaUserPointsHelper::getAupLinkToProfil($userid);
                 } else {
                     $link = JHtml::link(AlphaUserPointsHelper::getAupLinkToProfil($userid), $username, $attribs);
                 }
             }
             break;
         case 'easysocial':
             $api = JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_easysocial' . DS . 'includes' . DS . 'foundry.php';
             if (file_exists($api)) {
                 require_once $api;
                 $my = Foundry::user($userid);
                 $link = FRoute::profile(array('id' => $my->getAlias()));
                 if (!$path_only) {
                     $username = $my->getName();
                     $link = JHtml::link($link, $username, $attribs);
                 }
             }
             break;
     }
     return null == $link ? $username : $link;
 }
Exemplo n.º 18
0
 /**
  * Returns a field in specified format
  *
  * @param  FieldTable  $field
  * @param  UserTable   $user
  * @param  string      $output  'html', 'xml', 'json', 'php', 'csvheader', 'csv', 'rss', 'fieldslist', 'htmledit'
  * @param  string      $reason  'profile' for user profile view, 'edit' for profile edit, 'register' for registration, 'list' for user-lists
  * @param  int         $list_compare_types   IF reason == 'search' : 0 : simple 'is' search, 1 : advanced search with modes, 2 : simple 'any' search
  * @return mixed
  */
 public function getField(&$field, &$user, $output, $reason, $list_compare_types)
 {
     global $ueConfig;
     $value = $user->get($field->name);
     switch ($output) {
         case 'html':
         case 'rss':
             $useLayout = true;
             if ($field->type == 'primaryemailaddress') {
                 if (isset($field->_imgMode)) {
                     $imgMode = (int) $field->get('_imgMode');
                     $useLayout = false;
                     // When using override we want to avoid layout usage
                 } else {
                     $imgMode = (int) $field->params->get($reason == 'list' ? 'displayModeList' : 'displayMode', 0);
                 }
                 if ($ueConfig['allow_email_display'] == 3 || $imgMode != 0) {
                     $oValueText = CBTxt::T('UE_SENDEMAIL', 'Send Email');
                 } else {
                     $oValueText = htmlspecialchars($value);
                 }
                 $emailIMG = '<span class="fa fa-envelope" title="' . htmlspecialchars(CBTxt::T('UE_SENDEMAIL', 'Send Email')) . '"></span>';
                 switch ($imgMode) {
                     case 1:
                         $useLayout = false;
                         // We don't want to use layout for icon only display as we use it externally
                         $linkItemImg = $emailIMG;
                         $linkItemSep = null;
                         $linkItemTxt = null;
                         break;
                     case 2:
                         $linkItemImg = $emailIMG;
                         $linkItemSep = ' ';
                         $linkItemTxt = $oValueText;
                         break;
                     case 0:
                     default:
                         $linkItemImg = null;
                         $linkItemSep = null;
                         $linkItemTxt = $oValueText;
                         break;
                 }
                 $oReturn = '';
                 //if no email or 4 (do not display email) then return empty string
                 if ($value == null || $ueConfig['allow_email_display'] == 4 || $imgMode != 0 && $ueConfig['allow_email_display'] == 1) {
                     // $oReturn				=	'';
                 } else {
                     switch ($ueConfig['allow_email_display']) {
                         case 1:
                             //display email only
                             $oReturn = moscomprofilerHTML::emailCloaking(htmlspecialchars($value), 0);
                             break;
                         case 2:
                             //mailTo link
                             // cloacking doesn't cloack the text of the hyperlink, if that text does contain email addresses		//TODO: fix it.
                             if (!$linkItemImg && $linkItemTxt == htmlspecialchars($value)) {
                                 $oReturn = moscomprofilerHTML::emailCloaking(htmlspecialchars($value), 1, '', 0);
                             } elseif ($linkItemImg && $linkItemTxt != htmlspecialchars($value)) {
                                 $oReturn = moscomprofilerHTML::emailCloaking(htmlspecialchars($value), 1, $linkItemImg . $linkItemSep . $linkItemTxt, 0);
                             } elseif ($linkItemImg && $linkItemTxt == htmlspecialchars($value)) {
                                 $oReturn = moscomprofilerHTML::emailCloaking(htmlspecialchars($value), 1, $linkItemImg, 0) . $linkItemSep;
                                 $oReturn .= moscomprofilerHTML::emailCloaking(htmlspecialchars($value), 1, '', 0);
                             } elseif (!$linkItemImg && $linkItemTxt != htmlspecialchars($value)) {
                                 $oReturn = moscomprofilerHTML::emailCloaking(htmlspecialchars($value), 1, $linkItemTxt, 0);
                             }
                             break;
                         case 3:
                             //email Form (with cloacked email address if visible)
                             $oReturn = "<a href=\"" . cbSef("index.php?option=com_comprofiler&amp;view=emailuser&amp;uid=" . $user->id . getCBprofileItemid(true)) . "\" title=\"" . CBTxt::T('UE_MENU_SENDUSEREMAIL_DESC', 'Send an Email to this user') . "\">" . $linkItemImg . $linkItemSep;
                             if ($linkItemTxt && $linkItemTxt != CBTxt::T('UE_SENDEMAIL', 'Send Email')) {
                                 $oReturn .= moscomprofilerHTML::emailCloaking($linkItemTxt, 0);
                             } else {
                                 $oReturn .= $linkItemTxt;
                             }
                             $oReturn .= "</a>";
                             break;
                     }
                 }
             } else {
                 // emailaddress:
                 if ($value == null) {
                     $oReturn = '';
                 } else {
                     if ($ueConfig['allow_email'] == 1) {
                         $oReturn = moscomprofilerHTML::emailCloaking(htmlspecialchars($value), 1, "", 0);
                     } else {
                         $oReturn = moscomprofilerHTML::emailCloaking(htmlspecialchars($value), 0);
                     }
                 }
             }
             if ($useLayout) {
                 $oReturn = $this->formatFieldValueLayout($oReturn, $reason, $field, $user);
             }
             break;
         case 'htmledit':
             $oReturn = $this->_fieldEditToHtml($field, $user, $reason, 'input', 'text', $value, $reason != 'search' ? $this->getDataAttributes($field, $user, $output, $reason) : null);
             if ($reason == 'search') {
                 $oReturn = $this->_fieldSearchModeHtml($field, $user, $oReturn, 'text', $list_compare_types);
             }
             break;
         case 'json':
         case 'php':
         case 'xml':
         case 'csvheader':
         case 'fieldslist':
         case 'csv':
         default:
             $oReturn = parent::getField($field, $user, $output, $reason, $list_compare_types);
             break;
     }
     return $oReturn;
 }
Exemplo n.º 19
0
	/**
	 * Notifies connection changes
	 *
	 * @param  int      $userId
	 * @param  int      $connectionId
	 * @param  string   $msg
	 * @param  string   $subject
	 * @param  string   $messageHTML
	 * @param  string   $messageText
	 * @param  string   $userMessage
	 * @return boolean
	 */
	protected function _notifyConnectionChange( $userId, $connectionId, $msg, $subject, $messageHTML, $messageText, $userMessage = null )
	{
		global $_CB_framework, $ueConfig;

		$rowFrom				=	new UserTable();
		$rowFrom->load( (int) $userId );

		$fromName				=	getNameFormat( $rowFrom->name, $rowFrom->username, $ueConfig['name_format'] );
		$fromURL				=	'index.php?option=com_comprofiler&amp;view=userprofile&amp;user='******'&amp;tab=1' . getCBprofileItemid(true);
		$fromURL				=	cbSef( $fromURL );

		if ( strncasecmp( 'http', $fromURL, 4 ) != 0 ) {
			$fromURL			=	$_CB_framework->getCfg( 'live_site' ) . '/' . $fromURL;
		}

		$subject				=	sprintf( $subject, $fromName );

		if ( $userMessage != null ) {
			$messageHTML		.=	sprintf( str_replace( "\n", "\n<br />", CBTxt::T( 'UE_CONNECTIONMSGPREFIX', "  %s included the following personal message:\n\n%s" ) ),
											 htmlspecialchars( $fromName ),
											 '<strong>' . htmlspecialchars( $userMessage ) . '</strong>' );
			$messageText		.=	sprintf( str_replace( "\n", "\r\n", CBTxt::T( 'UE_CONNECTIONMSGPREFIX', "  %s included the following personal message:\n\n%s" ) ),
											 $fromName,
											 $userMessage );
		}

		$notificationMsgHTML	=	sprintf( $messageHTML, '<strong><a href="' . $fromURL . '">' . htmlspecialchars( $fromName ) . '</a></strong>' );
		$notificationMsgText	=	sprintf( $messageText, $fromName );

		$manageURL				=	'index.php?option=com_comprofiler&amp;view=manageconnections' . getCBprofileItemid( true );
		$manageURL				=	cbSef( $manageURL );

		if ( strncasecmp( 'http', $manageURL, 4 ) != 0 ) {
			$manageURL			=	$_CB_framework->getCfg( 'live_site' ) . '/' . $manageURL;
		}

		$notificationMsgHTML	=	$notificationMsgHTML
								.	"\n<br /><br /><a href=\"" . $manageURL . '">'
								.	CBTxt::T( 'UE_MANAGECONNECTIONS_LINK UE_MANAGECONNECTIONS', 'Manage Connections' )
								.	"</a>\n";

		$notificationMsgText	=	$notificationMsgText
								.	"\r\n\r\n\r\n" . $fromName . ' '
								.	CBTxt::T( 'CONNECTION_PROFILE UE_PROFILE', 'Profile' )
								.	': '
								.	cbUnHtmlspecialchars( $fromURL );

		$notificationMsgText	=	$notificationMsgText
								.	"\r\n\r\n"
								.	CBTxt::T( 'UE_MANAGECONNECTIONS_URL_LABEL UE_MANAGECONNECTIONS', 'Manage Connections' )
								.	': '
								.	cbUnHtmlspecialchars( $manageURL )
								.	"\r\n";

		$notificationMsgHTML	=	'<div style="padding: 4px; margin: 4px 3px 6px 0px; background: #C44; font-weight: bold;" class="cbNotice">'
			. CBTxt::T( 'UE_SENDPMSNOTICE', 'NOTE: This is a message generated automatically by the Connections system. It has the connecting user\'s address, so you can conveniently reply if you wish to.' )
			. "</div>\n\n"
			. $notificationMsgHTML;

		$cbNotification			=	new cbNotification();
		$cbNotification->sendFromUser( $connectionId, $userId, $subject, $notificationMsgHTML, $notificationMsgText );

		$this->_setUserMSG( $msg );

		return true;
	}
Exemplo n.º 20
0
	/**
	 * Generates icon for profile link
	 *
	 * @param moscomprofilerUser $user
	 * @param string             $mode
	 * @return mixed
	 */
	function getProfileIcon( $user, $mode = 'kunena' ) {
		$icon												=	$this->getFieldIcon( $user->username, CBTxt::T( 'View Profile: ' ), 'profile.gif', null, $mode );
		$url												=	cbSef( 'index.php?option=com_comprofiler&amp;task=userProfile&amp;user='******'<a href="' . $url . '">' . $icon . '</a>';
		
		return $format;
	}
    /**
     * Gives credits display for frontend and backend
     */
    function teamCredits()
    {
        global $_CB_framework, $ueConfig;
        $ui = $_CB_framework->getUi();
        outputCbTemplate($ui);
        outputCbJs($ui);
        ?>
		<div class="cbTeamCredits cb_template cb_template_<?php 
        echo selectTemplate('dir');
        ?>
">
			<div class="container-fluid">
				<div class="row text-center">
					<p>
						<?php 
        if ($ui == 2) {
            ?>
							<a href="http://www.joomlapolis.com/?pk_campaign=in-cb&amp;pk_kwd=credits" target="_blank">
								<img src="<?php 
            echo $_CB_framework->getCfg('live_site');
            ?>
/components/com_comprofiler/images/smcblogo.gif" class="img-responsive-inline" />
							</a>
							<?php 
            echo cbUpdateChecker();
            ?>
						<?php 
        } else {
            ?>
							<strong><?php 
            echo CBTxt::Th('UE_SITE_POWEREDBY TEAM_CREDITS_SITE_POWEREDBY', 'This site\'s community features are powered by Community Builder');
            ?>
</strong>
							<br />
							<a href="http://www.joomlapolis.com/?pk_campaign=in-cb&amp;pk_kwd=credits" target="_blank">
								<img src="<?php 
            echo $_CB_framework->getCfg('live_site');
            ?>
/components/com_comprofiler/images/smcblogo.gif" class="img-responsive-inline" />
							</a>
						<?php 
        }
        ?>
					</p>
				</div>
				<br />
				<div class="row">
					<?php 
        $w = "<p><strong>Community Builder</strong>&trade; (CB) is the complete <strong>Social Networking software</strong> solution for <strong>Joomla</strong>&trade; that is used by this website to support its <strong>membership management</strong>.</p>\n\t\t\t\t\t\t\t\t<p>This <strong>Joomla extension</strong> is the <strong>most popular Joomla social network component on the Joomla Extensions Directory</strong>.</p>\n\t\t\t\t\t\t\t\t<p>It comes with a built-in CB template, but more cool and fast <strong>Joomla and CB templates</strong> are available.</p>\n\t\t\t\t\t\t\t\t<p>Community Builder has <strong>many CB add-ons</strong>, both free and commercial that can extend the functionality of any Joomla website. One of these is the <strong>paid memberships software</strong> solution, CBSubs&trade;, that can manage <strong>paid subscriptions</strong> to access your website content. Many more exciting CB plugins are in our <strong>CB incubator</strong>.</p>\n\t\t\t\t\t\t\t\t<p>Finally, for those wanting a turnkey <strong>Online Social Network</strong>, Joomlapolis.com offers business-class <strong>Joomla hosting</strong>, including a one-click social networking website installer.</p>";
        echo str_replace('</strong>', '</a>', preg_replace_callback('/<strong>/', 'teamCreditsReplacer', $w));
        ?>
					<p><strong>Software: Copyright 2004-2016 joomlapolis.com. This component is released under the GNU/GPL version 2 License. All copyright statements must be kept. Derivate work must prominently duly acknowledge original work and include visible online links. Official site:</strong></p>
					<p class="text-center"><strong><a href="http://www.joomlapolis.com/?pk_campaign=in-cb&amp;pk_kwd=credits">www.joomlapolis.com</a></strong></p>
					<?php 
        if ($ui == 1) {
            ?>
						<p><strong>Please note that the authors and distributors of this software are not affiliated nor related in any way with the site owners using this free software here, and declines any warranty regarding the content and functions of this site.</strong></p>
					<?php 
        }
        ?>
				</div>
				<br />
				<div class="row text-center">
					<strong>Credits:</strong>
					<script type="text/javascript">//<!--
						/*
						 Fading Scroller- By DynamicDrive.com
						 For full source code, and usage terms, visit http://www.dynamicdrive.com
						 This notice MUST stay intact for use
						 fcontent[4]="<h3>damian caynes<br />inspired digital<br /></h3>Logo Design";
						 */
						var delay=1000; //set delay between message change (in miliseconds)
						var fcontent=[];
						begintag=''; //set opening tag, such as font declarations
						fcontent[0]="<h3>CBJoe/JoomlaJoe/MamboJoe<br /></h3>Founder &amp; First Developer";
						fcontent[1]="<h3>DJTrail<br /></h3>Co-Founder";
						fcontent[2]="<h3>Nick A.<br /></h3>Documentation and Public Relations";
						fcontent[3]="<h3>Beat B.<br /></h3>Lead Developer";
						fcontent[4]="<h3>Kyle L.<br /></h3>Developer and Support";
						fcontent[5]="<h3>Lou Griffith<br /></h3>Logo Design";
						closetag='';

						var fwidth='100%';	//'250px' //set scroller width
						var fheight='80px'; //set scroller height

						var fadescheme=0<?php 
        echo $ui == 2 || $ueConfig['templatedir'] != 'dark' ? 0 : 1;
        ?>
; //set 0 to fade text color from (white to black), 1 for (black to white)
						var fadelinks=1; //should links inside scroller content also fade like text? 0 for no, 1 for yes.

						///No need to edit below this line/////////////////

						var hex=(fadescheme==0)? 255 : 0;
						var startcolor=(fadescheme==0)? "rgb(255,255,255)" : "rgb(0,0,0)";
						var endcolor=(fadescheme==0)? "rgb(0,0,0)" : "rgb(255,255,255)";

						var ie4=document.all&&!document.getElementById;
						var ns4=document.layers;
						var DOM2=document.getElementById;
						var faderdelay=0;
						var index=0;
						var linksobj=null;

						if (DOM2)
							faderdelay=2000;

						//function to change content
						function changecontent(){
							if (index>=fcontent.length)
								index=0;
							if (DOM2){
								document.getElementById("fscroller").style.color=startcolor;
								document.getElementById("fscroller").innerHTML=begintag+fcontent[index]+closetag;
								linksobj=document.getElementById("fscroller").getElementsByTagName("A");
								if (fadelinks)
									linkcolorchange(linksobj);
								colorfade();
							}
							index++;
							setTimeout("changecontent()",delay+faderdelay);
						}

						// colorfade() partially by Marcio Galli for Netscape Communications.  ////////////
						// Modified by Dynamicdrive.com

						var frame=20, i;

						function linkcolorchange(obj){
							if (obj.length>0){
								for (i=0;i<obj.length;i++)
									obj[i].style.color="rgb("+hex+","+hex+","+hex+")";
							}
						}

						function colorfade() {
							// 20 frames fading process
							if(frame>0) {
								hex=(fadescheme==0)? hex-12 : hex+12; // increase or decrease color value depd on fadescheme
								document.getElementById("fscroller").style.color="rgb("+hex+","+hex+","+hex+")"; // Set color value.
								if (fadelinks)
									linkcolorchange(linksobj);
								frame--;
								setTimeout("colorfade()",20);
							} else {
								document.getElementById("fscroller").style.color=endcolor;
								frame=20;
								hex=(fadescheme==0)? 255 : 0;
							}
						}

						if (ie4||DOM2)
							document.write('<div id="fscroller" style="border:0 solid black;width:'+fwidth+';height:'+fheight+';padding:2px"></div>');
						window.onload=changecontent;
						//-->
					</script>
				</div>
				<?php 
        if ($ui == 2) {
            ?>
					<br />
					<div class="row text-center">
						<p><strong>Please note there is a free installation document, as well as a full documentation subscription for this free component available at <a href="http://www.joomlapolis.com/?pk_campaign=in-cb&amp;pk_kwd=credits">www.joomlapolis.com</a></strong></p>
					</div>
					<br />
					<div class="row text-center">
						<p>If you like the services provided by this free component, <a href="http://www.joomlapolis.com/?pk_campaign=in-cb&amp;pk_kwd=credits">please consider making a small donation to support the team behind it</a></p>
					</div>
				<?php 
        } elseif ($_CB_framework->myId()) {
            ?>
					<br />
					<div class="row text-center">
						<p><a href="<?php 
            echo cbSef('index.php?option=com_comprofiler' . getCBprofileItemid(true));
            ?>
"><?php 
            echo CBTxt::Th('TEAM_CREDITS_BACK_TO_YOUR_PROFILE UE_BACK_TO_YOUR_PROFILE', 'Back to your profile');
            ?>
</a></p>
					</div>
				<?php 
        }
        ?>
				<br />
				<table class="table table-bordered table-responsive">
					<tr>
						<th colspan="<?php 
        echo $ui == 2 ? 3 : 2;
        ?>
">Community Builder includes following components</th>
					</tr>
					<tr>
						<th>Application</th>
						<?php 
        if ($ui == 2) {
            ?>
							<th>Version</th>
						<?php 
        }
        ?>
						<th>License</th>
					</tr>
					<tr>
						<td>
							<a href="http://www.foood.net" target="_blank">Icons (old icons)</a>
						</td>
						<?php 
        if ($ui == 2) {
            ?>
							<td>N/A</td>
						<?php 
        }
        ?>
						<td>
							<a href="http://www.foood.net/agreement.htm" target="_blank">License</a>
						</td>
					</tr>
					<tr>
						<td>
							<a href="http://nuovext.pwsp.net/" target="_blank">Icons</a>
						</td>
						<?php 
        if ($ui == 2) {
            ?>
							<td>2.2</td>
						<?php 
        }
        ?>
						<td>
							<a href="http://www.gnu.org/licenses/lgpl.html" target="_blank">GNU Lesser General Public License</a>
						</td>
					</tr>
					<tr>
						<td>
							<a href="http://webfx.eae.net" target="_blank">Tabs</a>
						</td>
						<?php 
        if ($ui == 2) {
            ?>
							<td>1.02</td>
						<?php 
        }
        ?>
						<td>
							<a href="http://www.apache.org/licenses/LICENSE-2.0" target="_blank">Apache License, Version 2.0</a>
						</td>
					</tr>
					<tr>
						<td>
							<a href="http://www.dynarch.com/projects/calendar" target="_blank">Calendar</a>
						</td>
						<?php 
        if ($ui == 2) {
            ?>
							<td>1.1</td>
						<?php 
        }
        ?>
						<td>
							<a href="http://www.gnu.org/licenses/lgpl.html" target="_blank">GNU Lesser General Public License</a>
						</td>
					</tr>
					<tr>
						<td>
							<a href="http://www.dynamicdrive.com/dynamicindex7/jasoncalendar.htm" target="_blank">Jason&#039;s Calendar</a>
						</td>
						<?php 
        if ($ui == 2) {
            ?>
							<td>2005-09-05</td>
						<?php 
        }
        ?>
						<td>
							<a href="http://dynamicdrive.com/notice.htm" target="_blank">Dynamic Drive terms of use License</a>
						</td>
					</tr>
					<tr>
						<td>
							<a href="http://docs.guzzlephp.org/en/guzzle4/index.html" target="_blank">Guzzle</a>
						</td>
						<?php 
        if ($ui == 2) {
            ?>
							<td>4.1.3</td>
						<?php 
        }
        ?>
						<td>
							<a href="http://opensource.org/licenses/MIT" target="_blank">MIT</a>
						</td>
					</tr>
					<tr>
						<td>
							<a href="https://github.com/php-fig/log" target="_blank">Psr/Log</a>
						</td>
						<?php 
        if ($ui == 2) {
            ?>
							<td>1.0.0</td>
						<?php 
        }
        ?>
						<td>
							<a href="https://github.com/php-fig/log/blob/master/LICENSE" target="_blank">MIT</a>
						</td>
					</tr>
					<tr>
						<td>
							<a href="https://github.com/avalanche123/Imagine" target="_blank">Imagine</a>
						</td>
						<?php 
        if ($ui == 2) {
            ?>
							<td>0.6.1</td>
						<?php 
        }
        ?>
						<td>
							<a href="https://github.com/avalanche123/Imagine/blob/develop/LICENSE" target="_blank">MIT and third-party licenses</a>
						</td>
					</tr>
					<tr>
						<td>
							<a href="http://snoopy.sourceforge.net/" target="_blank">Snoopy</a>
						</td>
						<?php 
        if ($ui == 2) {
            ?>
							<td>1.2.3</td>
						<?php 
        }
        ?>
						<td>
							<a href="http://www.gnu.org/licenses/lgpl.html" target="_blank">GNU Lesser General Public License</a>
						</td>
					</tr>
					<tr>
						<td>
							<a href="http://www.phpclasses.org/browse/package/2189.html" target="_blank">PHPMailer</a>
						</td>
						<?php 
        if ($ui == 2) {
            ?>
							<td>5.2.8</td>
						<?php 
        }
        ?>
						<td>
							<a href="http://www.gnu.org/licenses/lgpl.html" target="_blank">GNU Lesser General Public License</a>
						</td>
					</tr>
					<tr>
						<td>
							<a href="http://www.phpclasses.org/browse/package/2189.html" target="_blank">PHP Input Filter</a>
							<a href="http://freshmeat.net/projects/inputfilter/" target="_blank">(forge)</a>
						</td>
						<?php 
        if ($ui == 2) {
            ?>
							<td>1.2.2+</td>
						<?php 
        }
        ?>
						<td>
							<a href="http://www.gnu.org/licenses/old-licenses/gpl-2.0.html" target="_blank">GNU General Public License</a>
						</td>
					</tr>
					<tr>
						<td>
							<a href="http://www.joomlapolis.com/?pk_campaign=in-cb&amp;pk_kwd=credits" target="_blank">BestMenus</a>
						</td>
						<?php 
        if ($ui == 2) {
            ?>
							<td>1.0</td>
						<?php 
        }
        ?>
						<td>
							<a href="http://www.joomlapolis.com/?pk_campaign=in-cb&amp;pk_kwd=credits" target="_blank">Open Source GPL (GNU General Public License) v2</a>
						</td>
					</tr>
					<tr>
						<td>
							<a href="http://jquery.com/" target="_blank">jQuery</a>
						</td>
						<?php 
        if ($ui == 2) {
            ?>
							<td><?php 
            echo _CB_JQUERY_VERSION;
            ?>
</td>
						<?php 
        }
        ?>
						<td>
							<a href="http://docs.jquery.com/" target="_blank">MIT license</a>
						</td>
					</tr>
				</table>
			</div>
		</div>
	<?php 
    }
Exemplo n.º 22
0
	/**
	 * gets URL to render a CB view
	 * @static
	 * @since CB 1.2.3
	 *
	 * @param  string  $task          task/view  e.g. 'manageconnections', 'registers', 'lostpassword', 'login', 'logout', 'moderateimages', 'moderatereports', 'moderatebans', 'viewreports', 'processreports', 'pendingapprovaluser'
	 * @param  string  $htmlSpecials  TRUE (default): apply htmlspecialchars to sefed URL, FALSE: don't.
	 * @param  string  $formId        Reserved for future use: If applicable: form id
	 * @param  string  $format        'html', 'component', 'raw', 'rawrel'
	 * @return string                 The absolute URL (relative if rawrel)
	 */
	function viewUrl( $task, $htmlSpecials = true, $formId = null, $format = 'html' ) {
		return $this->cbSef( 'index.php?option=com_comprofiler&task=' . urlencode( $task ) . ( $formId ? '&formid=' . urlencode( $formId ) : '' ) . getCBprofileItemid( false, 'registers' ), $htmlSpecials, $format );
	}
Exemplo n.º 23
0
	/**
	 * prepares and sends notification (email or PM)
	 *
	 * @param mixed  $to
	 * @param int    $from
	 * @param mixed  $subject
	 * @param mixed  $message
	 * @param int    $replace
	 * @param object $category
	 * @param object $group
     * @param boolean $type
	 */
    static public function getNotification( $to, $from, $subject, $message, $replace = null, $category = null, $group = null, $type = false ) {
		global $_CB_framework, $_CB_database, $ueConfig, $_CB_PMS, $_PLUGINS;

		$plugin					=	cbgjClass::getPlugin();
		$user					=&	CBuser::getUserDataInstance( $_CB_framework->myId() );
		$notifyBy				=	$plugin->params->get( 'general_notifyby', 1 );
		$generalTitle			=	CBTxt::T( $plugin->params->get( 'general_title', null ) );
		$msgSiteName			=	$_CB_framework->getCfg( 'sitename' );
		$msgOverviewName		=	( $generalTitle ? $generalTitle : $plugin->name );

		if ( isset( $from->id ) || preg_match( '!^\d+$!', $from ) ) {
			if ( is_object( $from ) ) {
				$fromId			=	$from->id;
			} else {
				$fromId			=	$from;
			}

			$cbUserFrom			=&	CBuser::getInstance( $fromId );

			if ( ! $cbUserFrom ) {
				$cbUserFrom		=&	CBuser::getInstance( null );
			}

			$userFrom			=&	$cbUserFrom->getUserData();
		}

		if ( isset( $userFrom->id ) ) {
			$fromName			=	$cbUserFrom->getField( 'formatname', null, 'html', 'none', 'profile', 0, true );
			$fromEmail			=	$userFrom->email;

			if ( $replace == 1 ) {
				$msgUserUrl		=	cbSef( 'index.php?option=com_comprofiler&task=userprofile&user='******'<a href="' . $msgUserUrl . '">' . $msgUserName . '</a>';
				$subject		=	$cbUserFrom->replaceUserVars( $subject, false );
				$message		=	$cbUserFrom->replaceUserVars( $message, false );
			}
		} else {
			$fromId				=	0;
			$fromName			=	$_CB_framework->getCfg( 'fromname' );
			$fromEmail			=	$_CB_framework->getCfg( 'mailfrom' );
		}

		if ( isset( $to->id ) || preg_match( '!^\d+$!', $to ) ) {
			if ( is_object( $to ) ) {
				$toId			=	$to->id;
			} else {
				$toId			=	$to;
			}

			$cbUserTo			=&	CBuser::getInstance( $toId );

			if ( ! $cbUserTo ) {
				$cbUserTo		=&	CBuser::getInstance( null );
			}

			$userTo				=&	$cbUserTo->getUserData();
		}

		if ( isset( $userTo->id ) ) {
			$toEmail			=	$userTo->email;

			if ( $replace == 2 ) {
				$msgUserUrl	=	cbSef( 'index.php?option=com_comprofiler&task=userprofile&user='******'formatname', null, 'html', 'none', 'profile', 0, true );
				$msgUser		=	'******' . $msgUserUrl . '">' . $msgUserName . '</a>';
				$subject		=	$cbUserTo->replaceUserVars( $subject, false );
				$message		=	$cbUserTo->replaceUserVars( $message, false );
			}
		} else {
			$toId				=	0;

			if ( cbIsValidEmail( $to ) ) {
				$toEmail		=	$to;
			} else {
				$toEmail		=	null;
			}
		}

		if ( $plugin->params->get( 'notifications_from_name' ) ) {
			$fromName			=	$plugin->params->get( 'notifications_from_name' );
		}

		if ( $plugin->params->get( 'notifications_from_address' ) ) {
			$fromEmail			=	$plugin->params->get( 'notifications_from_address' );
		}

		$msgStrings				=	array(	'[site_name]',
											'[site]',
											'[admin_override]',
											'[admins_override]',
											'[moderator_override]',
											'[moderators_override]',
											'[owner_override]',
											'[panel_override]',
											'[overview_override]',
											'[overview_name]',
											'[overview]',
											'[categories_override]',
											'[category_override]',
											'[category_id]',
											'[category_name]',
											'[category]',
											'[groups_override]',
											'[group_override]',
											'[group_id]',
											'[group_name]',
											'[group]',
											'[users_override]',
											'[user_override]',
											'[user_name]',
											'[user]'
										);

		$msgValues				=	array(	$msgSiteName,
											'<a href="' . $_CB_framework->getCfg( 'live_site' ) . '">' . $msgSiteName . '</a>',
											cbgjClass::getOverride( 'admin' ),
											cbgjClass::getOverride( 'admin', true ),
											cbgjClass::getOverride( 'moderator' ),
											cbgjClass::getOverride( 'moderator', true ),
											cbgjClass::getOverride( 'owner' ),
											cbgjClass::getOverride( 'panel' ),
											cbgjClass::getOverride( 'overview' ),
											$msgOverviewName,
											'<a href="' . cbgjClass::getPluginURL( array( 'overview' ) ) . '">' . $msgOverviewName . '</a>',
											cbgjClass::getOverride( 'category', true ),
											cbgjClass::getOverride( 'category' ),
											( isset( $category->id ) ? $category->get( 'id' ) : null ),
											( isset( $category->id ) ? $category->getName() : null ),
											( isset( $category->id ) ? $category->getName( 0, true ) : null ),
											cbgjClass::getOverride( 'group', true ),
											cbgjClass::getOverride( 'group' ),
											( isset( $group->id ) ? $group->get( 'id' ) : null ),
											( isset( $group->id ) ? $group->getName() : null ),
											( isset( $group->id ) ? $group->getName( 0, true ) : null ),
											cbgjClass::getOverride( 'user', true ),
											cbgjClass::getOverride( 'user' ),
											( isset( $msgUserName ) ? $msgUserName : null ),
											( isset( $msgUser ) ? $msgUser : null )
										);

		$_PLUGINS->trigger( 'gj_onBeforeNotification', array( array( $fromId, $fromName, $fromEmail, $toId, $toEmail, $subject, $message ), $group, $category, $user, $plugin ) );

		$subject				=	trim( strip_tags( str_replace( $msgStrings, $msgValues, $subject ) ) );
		$message				=	cbgjClass::getFilteredText( str_replace( $msgStrings, $msgValues, $message ) );

		if ( $toId ) {
			if ( ( $notifyBy == 4 ) || ( $type == 4 ) ) {
				comprofilerMail( $fromEmail, $fromName, $toEmail, $subject, $message, 1 );
			} elseif ( ( $notifyBy == 3 ) || ( $type == 3 ) ) {
				$_CB_PMS->sendPMSMSG( $toId, $fromId, $subject, $message, true );
			} elseif ( ( $notifyBy == 2 ) || ( $type == 2 ) ) {
				$_CB_PMS->sendPMSMSG( $toId, $fromId, $subject, $message, true );

				comprofilerMail( $fromEmail, $fromName, $toEmail, $subject, $message, 1 );
			} elseif ( ( $notifyBy == 1 ) || ( $type == 1 ) ) {
				if ( ! $_CB_PMS->sendPMSMSG( $toId, $fromId, $subject, $message, true ) ) {
					comprofilerMail( $fromEmail, $fromName, $toEmail, $subject, $message, 1 );
				}
			}
		} elseif ( $toEmail ) {
			comprofilerMail( $fromEmail, $fromName, $toEmail, $subject, $message, 1 );
		} else {
			$moderators			=	implode( ',', $_CB_framework->acl->get_group_parent_ids( $ueConfig['imageApproverGid'] ) );

			if ( $moderators ) {
				$query			=	'SELECT ' . $_CB_database->NameQuote( 'email' )
								.	"\n FROM " . $_CB_database->NameQuote( '#__users' ) . " AS a"
								.	"\n INNER JOIN " . $_CB_database->NameQuote( '#__comprofiler' ) . " AS b"
								.	' ON b.' . $_CB_database->NameQuote( 'user_id' ) . ' = a.' . $_CB_database->NameQuote( 'id' );

				if ( checkJversion() == 2 ) {
					$query		.=	"\n INNER JOIN " . $_CB_database->NameQuote( '#__user_usergroup_map' ) . " AS c"
								.	' ON b.' . $_CB_database->NameQuote( 'id' ) . ' = c.' . $_CB_database->NameQuote( 'user_id' )
								.	"\n WHERE c." . $_CB_database->NameQuote( 'group_id' ) . " IN ( " . $moderators . " )";
				} else {
					$query		.=	"\n WHERE a." . $_CB_database->NameQuote( 'gid' ) . " IN ( " . $moderators . " )";
				}

				$query			.=	"\n AND a." . $_CB_database->NameQuote( 'block' ) . " = 0"
								.	"\n AND a." . $_CB_database->NameQuote( 'sendEmail' ) . " = 1"
								.	"\n AND b." . $_CB_database->NameQuote( 'confirmed' ) . " = 1"
								.	"\n AND b." . $_CB_database->NameQuote( 'approved' ) . " = 1"
								.	"\n AND b." . $_CB_database->NameQuote( 'banned' ) . " = 0";
				$_CB_database->setQuery( $query );
				$mods			=	$_CB_database->loadResultArray();

				foreach ( $mods AS $mod ) {
					comprofilerMail( $fromEmail, $fromName, $mod, $subject, $message, 1 );
				}
			}
		}

		$_PLUGINS->trigger( 'gj_onAfterNotification', array( array( $fromId, $fromName, $fromEmail, $toId, $toEmail, $subject, $message ), $group, $category, $user, $plugin ) );
	}
Exemplo n.º 24
0
 public function getEditURL()
 {
     return cbSef('index.php?option=com_comprofiler&task=userAvatar' . getCBprofileItemid());
 }
 function _replaceVariables($msg, $row, $mode = 0, $extraStrings = null)
 {
     global $_CB_framework, $ueConfig;
     if ($extraStrings === null) {
         $extraStrings = array();
     }
     if ($ueConfig['reg_confirmation'] == 1) {
         if ($row->confirmed) {
             $confirmLink = "\n" . _UE_USER_EMAIL_CONFIRMED . ".\n";
         } else {
             if ($row->cbactivation) {
                 $confirmCode = $row->cbactivation;
             } else {
                 $confirmCode = '';
             }
             // no sef here !  space added after link for dumb emailers (Ms Entourage)
             $confirmLink = " \n" . $_CB_framework->getCfg('live_site') . "/index.php?option=com_comprofiler&task=confirm&confirmcode=" . $confirmCode . getCBprofileItemid(false, 'confirm') . " \n";
             // not implemented in viewUrl yet: $confirmLink = " \n". $_CB_framework->viewUrl( 'confirm', array( 'confirmcode' => $confirmCode ) ) ." \n";
         }
     } else {
         $confirmLink = ' ';
     }
     $msg = str_replace(array('\\n'), array("\n"), $msg);
     // was eval ("\$msg = \"$msg\";"); // compensate for wrong language definitions (using '\n' instaed of "\n")
     $msg = cbstr_ireplace("[EMAILADDRESS]", $row->email, $msg);
     $msg = cbstr_ireplace("[SITEURL]", $_CB_framework->getCfg('live_site'), $msg);
     $msg = cbstr_ireplace("[DETAILS]", $this->_getUserDetails($row, isset($ueConfig['emailpass']) ? $ueConfig['emailpass'] : 0), $msg);
     $msg = cbstr_ireplace("[CONFIRM]", $confirmLink, $msg);
     $msg = cbReplaceVars($msg, $row, $mode, true, $extraStrings);
     // this is for plaintext emails, no htmlspecialchars needed here.
     return $msg;
 }
Exemplo n.º 26
0
 /**
  * Evaluates CB Tags
  *
  * @access private  (public because of recursive preg_replace_callback use at end)
  *
  * @param  string|array  $input
  * @return string
  */
 public function _evaluateCbTags($input)
 {
     global $_CB_framework;
     $regex = '#\\[cb:(userdata +field|userfield +field|usertab +tab|userposition +position|date +format|url +location|config +param)="((?:[^"]|\\\\")+)"(?: +user="******"/\\] ]+)")?(?: +default="((?:[^"]|\\\\")+)")?(?: +output="([a-zA-Z]+)")?(?: +formatting="([a-zA-Z]+)")?(?: +reason="([a-zA-Z]+)")?(?: +list="([0-9]+)")? */\\]#';
     if (is_array($input)) {
         if (isset($input[3])) {
             $user = $this->_evaluateUserAttrib($input[3]);
         } else {
             $user = $this;
         }
         $keywords = explode(' ', $input[1]);
         $type = $keywords[0];
         switch ($type) {
             case 'userdata':
                 $field = $input[2];
                 $default = isset($input[4]) ? CBTxt::T(str_replace('\\"', '"', $input[4])) : null;
                 $reason = isset($input[7]) ? $input[7] !== '' ? $input[7] : 'profile' : 'profile';
                 $var = $user->getField($field, $default, 'php', 'none', $reason, 0, true);
                 // allow accessing all fields in the data
                 if (is_array($var)) {
                     $var = array_shift($var);
                     if (is_array($var)) {
                         $var = implode('|*|', $var);
                     }
                 } elseif (isset($user->_cbuser->{$field})) {
                     // fall-back to the record if it exists:
                     $var = $user->_cbuser->get($field);
                     if (is_array($var)) {
                         $var = implode('|*|', $var);
                     }
                 } else {
                     $fieldLower = strtolower($field);
                     if (isset($user->_cbuser->{$fieldLower})) {
                         // second fall-back to the record if it exists:
                         $var = $user->_cbuser->get($fieldLower);
                         if (is_array($var)) {
                             $var = implode('|*|', $var);
                         }
                     } else {
                         $var = null;
                     }
                 }
                 // Ensure user id is always an integer:
                 if (in_array($field, array('id', 'user_id'))) {
                     $var = (int) $var;
                 }
                 return $var;
                 break;
             case 'userfield':
             case 'usertab':
                 $default = isset($input[4]) ? CBTxt::T(str_replace('\\"', '"', $input[4])) : null;
                 $output = isset($input[5]) ? $input[5] !== '' ? $input[5] : 'html' : 'html';
                 $formatting = isset($input[6]) ? $input[6] !== '' ? $input[6] : 'none' : 'none';
                 $reason = isset($input[7]) ? $input[7] !== '' ? $input[7] : 'profile' : 'profile';
                 if ($type == 'userfield') {
                     $field = $user->getField($input[2], $default, $output, $formatting, $reason, 0, false);
                     // do not allow accessing all fields in the fields
                     if ($output == 'php' && is_array($field)) {
                         $field = array_shift($field);
                         if (is_array($field)) {
                             $field = implode('|*|', $field);
                         }
                     }
                     // Ensure user id is always an integer:
                     if (in_array($input[2], array('id', 'user_id'))) {
                         $field = (int) $field;
                     }
                     return $field;
                 } else {
                     return $user->getTab($input[2], $default, $output == 'none' ? null : $output, $formatting, $reason);
                 }
                 break;
             case 'userposition':
                 return $user->getPosition($input[2]);
                 break;
             case 'date':
                 return date($input[2], $_CB_framework->now());
                 break;
             case 'url':
                 switch ($input[2]) {
                     case 'login':
                     case 'logout':
                     case 'registers':
                     case 'lostpassword':
                     case 'manageconnections':
                         return $_CB_framework->viewUrl($input[2], false);
                         break;
                     case 'profile_view':
                         return $_CB_framework->userProfileUrl($user->_cbuser->id, false);
                         break;
                     case 'profile_edit':
                         return $_CB_framework->userProfileEditUrl($user->_cbuser->id, false);
                         break;
                     case 'list':
                         $list = isset($input[8]) ? $input[8] !== '' ? $input[8] : null : null;
                         return $_CB_framework->userProfilesListUrl($list, false);
                         break;
                     case 'itemid':
                         return getCBprofileItemid(false);
                         break;
                     default:
                         return '';
                 }
                 break;
             case 'config':
                 switch ($input[2]) {
                     case 'live_site':
                     case 'sitename':
                     case 'lang':
                     case 'lang_name':
                     case 'lang_tag':
                         return $_CB_framework->getCfg($input[2]);
                         break;
                     default:
                         return '';
                 }
                 break;
             default:
                 return '';
         }
     }
     return preg_replace_callback($regex, array($this, '_evaluateCbTags'), $input);
 }
Exemplo n.º 27
0
	function drawUsersList( $uid, $listid, $searchFormValuesRAW ) {
		global $_CB_database, $_CB_framework, $ueConfig, $Itemid, $_PLUGINS;
	
		$search					=	null;
		$searchGET				=	cbGetParam( $searchFormValuesRAW, 'search' );
		$limitstart				=	(int) cbGetParam( $searchFormValuesRAW, 'limitstart', 0 );
		$searchmode				=	(int) cbGetParam( $searchFormValuesRAW, 'searchmode', 0 );
		$randomParam			=	(int) cbGetParam( $searchFormValuesRAW, 'rand', 0 );
	
		// old search on formated name:
	
	/*	if ( $searchPOST || count( $_POST ) ) {
			// simple spoof check security
			cbSpoofCheck( 'usersList' );
			if ( cbGetParam( $searchFormValuesRAW, "action" ) == "search" ) {
				$search			=	$searchPOST;
			}
		} else
			if ( isset( $searchFormValuesRAW['limitstart'] ) ) {
				$search				=	stripslashes( $searchGET );
			}
	*/
		// get my user and gets the list of user lists he is allowed to see (ACL):
	
		$myCbUser				=&	CBuser::getInstance( $uid );
		if ( $myCbUser === null ) {
			$myCbUser			=&	CBuser::getInstance( null );
		}
		$myUser					=&	$myCbUser->getUserData();
	/*
		$myUser					=	new moscomprofilerUser( $_CB_database );
		if ( $uid ) {
			$myUser->load( (int) $uid );
		}
	*/
		$useraccessgroupSQL		=	" AND useraccessgroupid IN (".implode(',',getChildGIDS(userGID($uid))).")";
		$_CB_database->setQuery( "SELECT listid, title FROM #__comprofiler_lists WHERE published=1" . $useraccessgroupSQL . " ORDER BY ordering" );
		$plists					=	$_CB_database->loadObjectList();
		$lists					=	array();
		$publishedlists			=	array();
	
		for ( $i=0, $n=count( $plists ); $i < $n; $i++ ) {
			$plist				=&	$plists[$i];
			$listTitleNoHtml	=	strip_tags( cbReplaceVars( getLangDefinition( $plist->title ), $myUser, false, false ) );
		   	$publishedlists[]	=	moscomprofilerHTML::makeOption( $plist->listid, $listTitleNoHtml );
		}
	
		// select either list selected or default list to which he has access (ACL):
	
		if ( $listid == 0 ) {
			$_CB_database->setQuery( "SELECT listid FROM #__comprofiler_lists "
			. "\n WHERE `default`=1 AND published=1" . $useraccessgroupSQL );
			$listid				=	(int) $_CB_database->loadresult();
			if ( $listid == 0 && ( count( $plists ) > 0 ) ) {
				$listid			=	(int) $plists[0]->listid;
			}
		}
		if ( ! ( $listid > 0 ) ) {
			echo _UE_NOLISTFOUND;
			return;
		}
	
		// generates the drop-down list of lists:
	
		if ( count( $plists ) > 1 ) {
			$lists['plists']	=	moscomprofilerHTML::selectList( $publishedlists, 'listid', 'class="inputbox" size="1" onchange="this.form.submit();"', 'value', 'text', $listid, 1 );
		}
	
		// loads the list record:
	
		$row					=	new moscomprofilerLists( $_CB_database );
		if ( ( ! $row->load( (int) $listid ) ) || ( $row->published != 1 ) ) {
			echo _UE_LIST_DOES_NOT_EXIST;
			return;
		}
		if ( ! allowAccess( $row->useraccessgroupid,'RECURSE', userGID($uid) ) ) {
			echo _UE_NOT_AUTHORIZED;
			return;
		}
	
		$params					=	new cbParamsBase( $row->params );
	
		$hotlink_protection		=	$params->get( 'hotlink_protection', 0 );
		if ( $hotlink_protection == 1 ) {
			if ( ( $searchGET !== null ) || $limitstart ) {
				cbSpoofCheck( 'usersList', 'GET' );
			}
		}
	
		$limit					=	(int) $params->get( 'list_limit' );
		if ( $limit == 0 ) {
			$limit				=	(int) $ueConfig['num_per_page'];
		}
	
		$showPaging				=	$params->get( 'list_paging', 1 );
		if ( $showPaging != 1 ) {
			$limitstart			=	0;
		}
	
		$isModerator			=	isModerator( $_CB_framework->myId() );
	
		$_PLUGINS->loadPluginGroup( 'user' );
		// $plugSearchFieldsArray	=	$_PLUGINS->trigger( 'onStartUsersList', array( &$listid, &$row, &$search, &$limitstart, &$limit ) );
		$_PLUGINS->trigger( 'onStartUsersList', array( &$listid, &$row, &$search, &$limitstart, &$limit ) );
	
		// handles the users allowed to be listed in the list by ACL:
	
		$allusergids			=	array();
		$usergids				=	explode( ',', $row->usergroupids );
	/*	This was a bug tending to list admins when "public backend" was checked, and all frontend users when "public backend was checked. Now just ignore them:
		foreach( $usergids AS $usergid ) {
			$allusergids[]		=	$usergid;
			if ($usergid==29 || $usergid==30) {
				$groupchildren	=	array();
				$groupchildren	=	$_CB_framework->acl->get_group_children( $usergid, 'ARO','RECURSE' );
				$allusergids	=	array_merge($allusergids,$groupchildren);
			}
		}
	*/
		$allusergids			=	array_diff( $usergids, array( 29, 30 ) );
		$usergids				=	implode( ",", $allusergids );
	
		// build SQL Select query:
	
		$random					=	0;
		if( $row->sortfields != '' ) {
			$matches			=	null;
			if ( preg_match( '/^RAND\(\)\s(ASC|DESC)$/', $row->sortfields, $matches ) ) {
				// random sorting needs to have same seed on pages > 1 to not have probability to show same users:
				if ( $limitstart ) {
					$random		=	(int) $randomParam;
				}
				if ( ! $random ) {
					$random		=	rand( 0, 32767 );
				}
				$row->sortfields =	'RAND(' . (int) $random . ') ' . $matches[1];
			}
			$orderby			=	"\n ORDER BY " . $row->sortfields;
		}
		$filterby				=	'';
		if ( $row->filterfields != '' ) {
			$filterRules		=	utf8RawUrlDecode( substr( $row->filterfields, 1 ) );
	
			if ( $_CB_framework->myId() ) {
				$user			=	new moscomprofilerUser( $_CB_database );
				if ( $user->load( (int) $_CB_framework->myId() ) ) {
					$filterRules	=	cbReplaceVars( $filterRules, $user, array( $_CB_database, 'getEscaped' ), false, array() );
				}
			}
			$filterby			=	" AND ". $filterRules;
		}
	
		// Prepare part after SELECT .... " and before "FROM" :
	
		$tableReferences		=	array( '#__comprofiler' => 'ue', '#__users' => 'u' );
	
		// Fetch all fields:
	
		$tabs					=	$myCbUser->_getCbTabs();		//	new cbTabs( 0, 1 );		//TBD: later: this private method should not be called here, but the whole users-list should go into there and be called here.
	
		$allFields				=	$tabs->_getTabFieldsDb( null, $myUser, 'list' );
		// $_CB_database->setQuery( "SELECT * FROM #__comprofiler_fields WHERE published = 1" );
		// $allFields				=	$_CB_database->loadObjectList( 'fieldid', 'moscomprofilerFields', array( &$_CB_database ) );
	
	
		//Make columns array. This array will later be constructed from the tabs table:
	
		$columns				=	array();
	
		for ( $i = 1; $i < 50; ++$i ) {
			$enabledVar			=	"col".$i."enabled";
	
			if ( ! isset( $row->$enabledVar ) ) {
				break;
			}
			$titleVar			=	"col".$i."title";
			$fieldsVar			=	"col".$i."fields";
			$captionsVar		=	"col".$i."captions";
	
			if ( $row->$enabledVar == 1 ) {
				$col			=	new stdClass();
				$col->fields	=	( $row->$fieldsVar ? explode( '|*|', $row->$fieldsVar ) : array() );
				$col->title		=	$row->$titleVar;
				$col->titleRendered		=	$myCbUser->replaceUserVars( $col->title );
				$col->captions	=	$row->$captionsVar;
				// $col->sort	=	1; //All columns can be sorted
				$columns[$i]	=	$col;
			}
		}
	
		// build fields and tables accesses, also check for searchable fields:
	
		$searchableFields		=	array();
		$fieldsSQL				=	cbUsersList::getFieldsSQL( $columns, $allFields, $tableReferences, $searchableFields, $params );
	
		$_PLUGINS->trigger( 'onAfterUsersListFieldsSql', array( &$columns, &$allFields, &$tableReferences ) );
	
		$tablesSQL				=	array();
		$joinsSQL				=	array();
		$tablesWhereSQL			=	array(	'block'		=>	'u.block = 0',
											'approved'	=>	'ue.approved = 1',
											'confirmed'	=>	'ue.confirmed = 1'
										 );
	
		if ( checkJversion() == 2 ) {
			$joinsSQL[]				=	'JOIN #__user_usergroup_map g ON g.`user_id` = u.`id`';
		}
	
		if ( ! $isModerator ) {
			$tablesWhereSQL['banned']	=	'ue.banned = 0';
		}
		if ( $usergids ) {
			if ( checkJversion() == 2 ) {
				$tablesWhereSQL['gid']	=	'g.group_id IN (' . $usergids . ')';
			} else {
				$tablesWhereSQL['gid']	=	'u.gid IN (' . $usergids . ')';
			}
		}
	
		foreach ( $tableReferences as $table => $name ) {
			$tablesSQL[]				=	$table . ' ' . $name;
			if ( $name != 'u' ) {
				$tablesWhereSQL[]		=	"u.`id` = " . $name . ".`id`";
			}
		}
	
		// handles search criterias:
	
		$list_compare_types		=	$params->get( 'list_compare_types', 0 );
		$searchVals				=	new stdClass();
		$searchesFromFields		=	$tabs->applySearchableContents( $searchableFields, $searchVals, $searchFormValuesRAW, $list_compare_types );
		$whereFields			=	$searchesFromFields->reduceSqlFormula( $tableReferences, $joinsSQL, TRUE );
		if ( $whereFields ) {
			$tablesWhereSQL[]	=	'(' . $whereFields . ')';
	/*
			if ( $search === null ) {
				$search			=	'';
			}
	*/
		}
	
		$_PLUGINS->trigger( 'onBeforeUsersListBuildQuery', array( &$tablesSQL, &$joinsSQL, &$tablesWhereSQL ) );
	
		$queryFrom				=	"FROM " . implode( ', ', $tablesSQL )
								.	( count( $joinsSQL ) ? "\n " . implode( "\n ", $joinsSQL ) : '' )
								.	"\n WHERE " . implode( "\n AND ", $tablesWhereSQL );
	
		// handles old formatted names search:
	/*
		if ( $search != '' ) {
			$searchSQL			=	cbEscapeSQLsearch( strtolower( $_CB_database->getEscaped( $search ) ) );
			$queryFrom 			.=	" AND (";
	
			$searchFields		=	array();
			if ( $ueConfig['name_format']!='3' ) {
				$searchFields[]	=	"u.name LIKE '%%s%'";
			}
			if ( $ueConfig['name_format']!='1' ) {
				$searchFields[]	=	"u.username LIKE '%%s%'";
			}
			if ( is_array( $plugSearchFieldsArray ) ) {
				foreach ( $plugSearchFieldsArray as $v ) {
					if ( is_array( $v ) ) {
						$searchFields	=	array_merge( $searchFields, $v );
					}
				}
			}
			$queryFrom			.=	str_replace( '%s', $searchSQL, implode( " OR ", $searchFields ) );
			$queryFrom			.=	")";
		}
	*/
		$queryFrom				.=	" " . $filterby;
	
		$_PLUGINS->trigger( 'onBeforeUsersListQuery', array( &$queryFrom, 1, $listid ) );	// $uid = 1
	
		$errorMsg		=	null;
	
		// counts number of users and loads the listed fields of the users if not in search-form-only mode:
	
		if ( $searchmode == 0 ) {
			if ( checkJversion() == 2 ) {
				$_CB_database->setQuery( "SELECT COUNT(DISTINCT u.id) " . $queryFrom );
			} else {
			$_CB_database->setQuery( "SELECT COUNT(*) " . $queryFrom );
			}
			$total					=	$_CB_database->loadResult();
	
			if ( ( $limit > $total ) || ( $limitstart >= $total ) ) {
				$limitstart			=	0;
			}
	
			// $query					=	"SELECT u.id, ue.banned, '' AS 'NA' " . ( $fieldsSQL ? ", " . $fieldsSQL . " " : '' ) . $queryFrom . " " . $orderby
			if ( checkJversion() == 2 ) {
				$query				=	"SELECT DISTINCT ue.*, u.*, '' AS 'NA' " . ( $fieldsSQL ? ", " . $fieldsSQL . " " : '' ) . $queryFrom . " " . $orderby;
			} else {
				$query				=	"SELECT ue.*, u.*, '' AS 'NA' " . ( $fieldsSQL ? ", " . $fieldsSQL . " " : '' ) . $queryFrom . " " . $orderby;
			}
			$_CB_database->setQuery( $query, (int) $limitstart, (int) $limit );
			$users				=	$_CB_database->loadObjectList( null, 'moscomprofilerUser', array( &$_CB_database ) );
	
			if ( ! $_CB_database->getErrorNum() ) {
				// creates the CBUsers in cache corresponding to the $users:
				foreach ( array_keys( $users ) as $k) {
					CBuser::setUserGetCBUserInstance( $users[$k] );
				}
			} else {
				$users			=	array();
				$errorMsg		=	_UE_ERROR_IN_QUERY_TURN_SITE_DEBUG_ON_TO_VIEW;
			}
	
			if ( count( get_object_vars( $searchVals ) ) > 0 ) {
				$search			=	'';
			} else {
				$search			=	null;
			}
	
		} else {
			$total				=	null;
			$users				=	array();
			if ( $search === null ) {
				$search			=	'';
			}
		}
	
		// Compute itemId of users in users-list:
	
		if ( $Itemid ) {
			$option_itemid		=	(int) $Itemid;
		} else {
			$option_itemid		=	getCBprofileItemid( 0 );
		}
		HTML_comprofiler::usersList( $row, $users, $columns, $allFields, $lists, $listid, $search, $searchmode, $option_itemid, $limitstart, $limit, $total, $myUser, $searchableFields, $searchVals, $tabs, $list_compare_types, $showPaging, $hotlink_protection, $errorMsg, $random );
	}
Exemplo n.º 28
0
	/**
	 * Returns a protected user-specific edit invoicing address URL
	 * e.g.
	 * http://site/component/option,com_comprofiler/task,tabclass/user,37612/tab,getcbpaidsubscriptionstab/cbpaidsubscriptionsact,editinvoiceaddress/cbpaidsubscriptionsbasket,425/cbpaidsubscriptionsbck,cbm_07e2fc60_448eb84d_7ef5ad8dee839e51b4c6dfd802ad470f/
	 *
	 * @param  cbpaidPaymentBasket        $paymentBasket
	 * @return string
	 */
	public function getInvoicingAddressEditUrl( $paymentBasket ) {
		$checkHash				=	$paymentBasket->checkHashUser();
		$basegetarray			=	array( 'user' => $paymentBasket->user_id, 'Itemid' => getCBprofileItemid( 0 ), 'act' => 'editinvoiceaddress', 'basket' => $paymentBasket->id, 'bck' => $checkHash );
		return $this->getHttpsAbsURLwithParam( $basegetarray, 'pluginclass', true );
	}
	/**
	 * Event handler as soon as system started
	 *
	 * @return void
	 */
	public function onAlittleMoreAfterStart( ) {
		global $_CB_framework, $_GET, $_POST;

		if ( $this->paidsubsManager === null ) {
			return;
		}
		// already done in SysPlug: $this->_checkExpireMe();
		$userId							=	$_CB_framework->myId();

		$getPostArray					=	new cbpaidBotInput( $_GET, $_POST, $_REQUEST, JFactory::getApplication()->input );


		// redirection trick for joomla "Register to read more link":
		if ( ( ( $this->option == 'com_user' ) && ( ( $this->task == 'register' ) || ( $this->view == 'login' ) ) )		// 1.5
			|| ( ( $this->option == 'com_registration' ) && ( $this->task == 'register' ) ) )							// mambo & 1.0
		{
			cbRedirect( cbSef( 'index.php?option=com_comprofiler&task=registers', false ) );
		}

		$message						=	null;
		$allowAccess					=	$this->checkAccess( $userId, $this->option, 'cpaycontent_components' );
		if ( $allowAccess === false ) {
			$message					=	"Access to this component not allowed without %s";
			$redirectVars				=	array( 'accesstype' => 'components', 'accessvalue' => $this->option );
		} elseif ( isset( $getPostArray['Itemid'] ) ) {
			if ( ( $this->option == 'com_comprofiler' ) && ( in_array( strtolower( $this->task ), array( 'fieldclass', 'tabclass', 'lostpassword', 'sendnewpass', 'registers', 'saveregisters', 'login', 'logout', 'confirm', 'teamcredits', 'done', 'performcheckusername', 'performcheckemail' ) ) || ( ( $this->task == 'pluginclass' ) && ( $this->taskPlugin == 'cbpaidsubscriptions' ) ) ) ) {
				// legit CB or CBSubs access that should not be protected by menu !
			} else {
				$allowAccess			=	$this->checkAccess( $userId, (int) $getPostArray['Itemid'], 'cpaycontent_menus' );
				if ( $allowAccess === false ) {
					$message			=	"Access to this menu item not allowed without %s";
					$redirectVars		=	array( 'accesstype' => 'menus', 'accessvalue' => (int) $getPostArray['Itemid'] );
				}
			}
		}
		$postsMissingInGetToFindPlans =	array();
		if ( $allowAccess !== false ) {
			$allowAccess			=	$this->checkAccessUrl( $userId, $getPostArray, $_GET, $postsMissingInGetToFindPlans, 'cpaycontent_urls' );
			if ( $allowAccess === false ) {
				$message			=	"Access to this location not allowed without %s";
				$redirectVars		=	array( 'accesstype' => 'urls' );	// , 'accessvalue' => cbpaidsubsbot_encodeArrayUrl( $_GET ) );
			} else {
				$redirectVars		=	array();
				$allowAccess		=	$this->checkContentUrl( $userId, $getPostArray, 'cpaycontent_sections', 'cpaycontent_categories', 'cpaycontent_sections_list', 'cpaycontent_categories_list', $redirectVars );
				if ( $allowAccess === false ) {
					$message		=	"Access to this content list not allowed without %s";
					// done below $redirectVars['accessurl']	=	cbpaidsubsbot_encodeArrayUrl( $_GET );
				}
			}
		}
		// if ( ( $allowAccess === false ) && ( ! ( ( $this->option == 'com_comprofiler' ) && ( $this->task == 'pluginclass' ) && ( $this->taskPlugin == 'cbpaidsubscriptions' ) ) ) ) {
		if ( $allowAccess === false ) {
			$allowedComprofilerTasks	=	array( 'fieldclass', 'tabclass', 'lostpassword', 'sendnewpass', 'registers', 'saveregisters', 'login', 'logout', 'confirm', 'teamcredits', 'done', 'performcheckusername', 'performcheckemail' );
			if ( ( $this->option != 'com_comprofiler' ) || ( ! in_array( strtolower( $this->task ), $allowedComprofilerTasks ) ) || ! ( ( $this->task == 'pluginclass' ) && ( $this->taskPlugin == 'cbpaidsubscriptions' ) ) ) {
				$params							=&	cbpaidApp::settingsParams();

				// allow access to someone who is unrestricted:
				if ( ! $this->hasAccessAnyway( $userId ) ) {
					// not someone who is unrestricted:
					$redirectVars['accessurl']	=	cbpaidsubsbot_encodeArrayUrl( array_merge( $_GET, $postsMissingInGetToFindPlans ) );
					$redirectUrl				=	'index.php?option=com_comprofiler&task=pluginclass&plugin=cbpaidsubscriptions&do=accessdenied' . getCBprofileItemid( false);		// &Itemid= ???
					if ( is_array( $redirectVars ) ) {
						foreach ( $redirectVars as $k => $v ) {
							$redirectUrl		.=	'&' . urlencode( $k ) . '=' . urlencode( $v );
						}
					}
// if ( strlen( $redirectUrl ) > 1000 ) { echo $redirectUrl . '<br />'; var_dump( $this );exit; }
					// translate message:
					cbpaidApp::loadLang();
					$subscriptionText			=	CBPTXT::T( $params->get( 'subscription_name', 'subscription' ) );
					$message					=	sprintf( CBPTXT::T( $message ), $subscriptionText );
					$_CB_framework->redirect( cbSef( $redirectUrl, false ), $message, 'warning' );
				}
			}
		}
	}