/**
 * Replaces [fieldname] by the content of the user row (except for [password])
 *
 * @param  string         $msg
 * @param  stdClass       $row
 * @param  boolean|array  $htmlspecialchars  on replaced values only: FALSE : no htmlspecialchars, TRUE: do htmlspecialchars, ARRAY: callback method
 * @param  boolean        $menuStats
 * @param  array          $extraStrings
 * @param  boolean        $translateLanguage  on $msg only
 * @return string
 */
function cbReplaceVars($msg, &$row, $htmlspecialchars = true, $menuStats = true, $extraStrings = null, $translateLanguage = true)
{
    if ($extraStrings === null) {
        $extraStrings = array();
    }
    if (isset($row->id) && is_object($row) && strtolower(get_class($row)) == 'moscomprofileruser') {
        $cbUser =& CBuser::getInstance($row->id);
    } else {
        $cbUser = new CBuser();
        $cbUser->loadCbRow($row);
    }
    return $cbUser->replaceUserVars($msg, $htmlspecialchars, $menuStats, $extraStrings, $translateLanguage);
}
 /**
  * Replaces [fieldname] by the content of the user row (except for [password])
  *
  * @param  string               $msg
  * @param  UserTable|\stdClass  $row
  * @param  boolean|array        $htmlspecialchars  on replaced values only: FALSE : no htmlspecialchars, TRUE: do htmlspecialchars, ARRAY: callback method
  * @param  boolean              $menuStats
  * @param  array                $extraStrings
  * @param  boolean              $translateLanguage  on $msg only
  * @return string
  */
 function cbReplaceVars($msg, $row, $htmlspecialchars = true, $menuStats = true, $extraStrings = null, $translateLanguage = true)
 {
     if ($extraStrings === null) {
         $extraStrings = array();
     }
     if (isset($row->id) && is_object($row) && $row instanceof UserTable) {
         $cbUser =& CBuser::getInstance($row->id);
     } else {
         $cbUser = new CBuser();
         $cbUser->loadCbRow($row);
     }
     return $cbUser->replaceUserVars($msg, $htmlspecialchars, $menuStats, $extraStrings, $translateLanguage);
 }
Пример #3
0
	/**
	 * Parses a string using trigger specific substitution information
	 *
	 * @param $string
	 * @param bool $htmlspecialchars
	 * @param array|bool $translate
	 * @return string
	 */
	public function getSubstituteString( $string, $htmlspecialchars = true, $translate = true )
	{
		if ( $this->get( '_password' ) ) {
			$string		=	str_ireplace( '[password]', $this->get( '_password' ), $string );
		}

		if ( $this->get( '_cbuser' ) ) {
			$string		=	$this->_cbuser->replaceUserVars( $string, $htmlspecialchars, false, $this->get( '_extras' ), $translate );
		}

		if ( $this->getParams()->get( 'format', false, GetterInterface::BOOLEAN ) ) {
			$string		=	cbautoactionsClass::formatCondition( $string, $this->get( '_vars' ) );
		}

		return $string;
	}