예제 #1
0
 function getUserProfile($userid = 0)
 {
     $cbinclude = JPATH_ADMINISTRATOR . DS . "components" . DS . "com_comprofiler" . DS . "plugin.foundation.php";
     if (!file_exists($cbinclude)) {
         JError::raiseNotice(1, JText::_('FACTORY_CB_NOT_INSTALLED'));
         return;
     }
     require_once $cbinclude;
     cbimport('cb.database');
     cbimport('cb.tables');
     $cbUser = CBUser::getInstance($userid);
     $userdata = $cbUser->getUserData();
     $userdata->userid = $userid;
     return get_object_vars($userdata);
 }
예제 #2
0
파일: helper.php 프로젝트: joomux/jTips
 /**
  * Return the HTML img tag with the user's profile avatar
  * 
  * @param $userid
  * @param $app
  * @return unknown_type
  */
 function getProfileImage($userid, $app)
 {
     if ($app == 'JomSocial') {
         $jspath = JPATH_BASE . DS . 'components' . DS . 'com_community';
         $jscore = $jspath . DS . 'libraries' . DS . 'core.php';
         jimport('joomla.filesystem.file');
         if (JFile::exists($jscore)) {
             include_once $jscore;
             $user =& CFactory::getUser($userid);
             $avatarUrl = $user->getThumbAvatar();
             return "<img src='{$avatarUrl}' />";
         }
     } else {
         if ($app == 'CommunityBuilder') {
             // check CB is installed
             jimport('joomla.filesystem.folder');
             $cbpath = JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_comprofiler';
             if (JFolder::exists($cbpath)) {
                 global $ueConfig;
                 // get CB version
                 include $cbpath . DS . 'ue_config.php';
                 if (preg_match('/\\b1\\.1/', $ueConfig['version'])) {
                     // version 1.1
                     require_once $cbpath . DS . 'plugin.class.php';
                     require_once $cbpath . DS . 'comprofiler.class.php';
                     // get the user data
                     $query = "SELECT * FROM #__comprofiler WHERE id = {$userid}";
                     $db =& JFactory::getDBO();
                     $db->setQuery($query, 0, 1);
                     $user = $database->loadObject();
                     $path = getFieldValue('image', $user->avatar, $user);
                     return $path;
                 } else {
                     if (preg_match('/\\b1\\.2/', $ueConfig['version'])) {
                         // version 1.2
                         include_once $cbpath . DS . 'ue_config.php';
                         include_once $cbpath . DS . 'plugin.foundation.php';
                         cbimport('cb.database');
                         cbimport('language.front');
                         $cbUser =& CBUser::getInstance($userid);
                         $path = $cbUser->avatarFilePath(2);
                         return "<img src='{$path}' />";
                     }
                 }
             }
         }
     }
     return "&nbsp;";
 }
예제 #3
0
	function awUserActivated($user, $success) {
		global $_CB_framework, $ueConfig;
		
		if (!$success) return false;
		
        // get CBUser so we can use replaceUserVars() from CBAPI
        $awCBuser =&  CBUser::getInstance((int) $user->id);
        
		$res_wpms = true;
		$res_wemail = true;		
		$res_wconnect = true;
		
		$plugparams=$this->_awGetPlugParameters();
		
		$testNotifications = new cbNotification();
	
		if ($plugparams["awautomessageenable"]) {
			switch ($plugparams["awmessagemethod"]) {
				case 0: // PMS
					$cbawNotification = new cbNotification();
					$res_wpms = $cbawNotification->sendUserPMSmsg((int) $user->id,
						$plugparams["awpmsfromuserid"],
                        $awCBuser->replaceUserVars( $plugparams["awpmsmessagesubject"] ),
						$awCBuser->replaceUserVars( $plugparams["awpmsmessagebody"] ), 
						true);
					if (!$res_wpms) {
						$this->_setErrorMSG("Auto-Welcome plugin failed to send PMS welcome message");
					}
					break;
				case 1: // Email
					$cbawNotification = new cbNotification();
					$res_wemail=$cbawNotification->sendUserEmail((int) $user->id,
						$plugparams["awemailfromuserid"],
						$awCBuser->replaceUserVars( $plugparams["awemailmessagesubject"] ),
						$awCBuser->replaceUserVars( $plugparams["awemailmessagebody"] ),
						$plugparams["awemailfromuserid"]);	//reveal email
					if (!$res_wemail) {
						$this->_setErrorMSG("Auto-Welcome plugin failed to send Email welcome message");
					}			
					break;
				case 2: // Email and PMS
					$cbawNotification = new cbNotification();
					$res_wpms = $cbawNotification->sendUserPMSmsg((int) $user->id,
						$plugparams["awpmsfromuserid"],
						$awCBuser->replaceUserVars( $plugparams["awpmsmessagesubject"] ),
						$awCBuser->replaceUserVars( $plugparams["awpmsmessagebody"] ), 
						true);
					if (!$res_wpms) {
						$this->_setErrorMSG("Auto-Welcome plugin failed to send PMS welcome message");
					}
					$res_wemail=$cbawNotification->sendUserEmail((int) $user->id,
						$plugparams["awemailfromuserid"],
						$awCBuser->replaceUserVars( $plugparams["awemailmessagesubject"] ),
						$awCBuser->replaceUserVars( $plugparams["awemailmessagebody"] ),
						$plugparams["awpmsfromuserid"]);	//reveal email				
					if (!$res_wemail) {
						$this->_setErrorMSG("Auto-Welcome plugin failed to send Email welcome message");
					}			
					break;
				default:
					break;
			}		
		}
	
		if ($plugparams["awautoconnectenable"] && $ueConfig['allowConnections']) {
		
			$awkeyuserid_count = substr_count($plugparams["awkeyuserid"],',');
			$res_wconnect = true;
			$awkeyuserid_item = explode(",",$plugparams["awkeyuserid"]);
			
			if ($plugparams["awautoconnectdirection"]==0) { // connect new user to key users
				$cbawCon=new cbConnection( (int) $user->id);
				for ($aw_i=0;$aw_i<=$awkeyuserid_count;$aw_i++) {
					$res_wconnect = $res_wconnect && $cbawCon->addConnection((int) $awkeyuserid_item[$aw_i],
						$awCBuser->replaceUserVars( $plugparams["awautoconnectmessage"] ));
				}
				if (!$res_wconnect) {
					$this->_setErrorMSG("Auto-Welcome plugin failed to initiate auto-connection");
				}
				unset($cbawCon); // cleanup			
			} else { // connect key users to new user
				for ($aw_i=0;$aw_i<=$awkeyuserid_count;$aw_i++) {
					$cbawCon=new cbConnection((int) $awkeyuserid_item[$aw_i]);
					$res_wconnect = $res_wconnect && $cbawCon->addConnection((int) $user->id,
						$awCBuser->replaceUserVars( $plugparams["awautoconnectmessage"] ));
					unset($cbawCon); // cleanup
				}
				if (!$res_wconnect) {
					$this->_setErrorMSG("Auto-Welcome plugin failed to initiate auto-connection");
				}
			}
		}
		
		if (!($res_wemail && $res_wpms && $res_wconnect)) {
			$this->raiseError(0);
		}
		
		return $res_wemail && $res_wpms && $res_wconnect;
	}