Пример #1
0
	/**
	 * DecryptFetchedArray
	 * Fetching record from sql result, looking through array of fetched values and decrypted all encrypted fields
	 * @param {reference} link to sql result
	 * @return {array} fetched array
	 */
	function DecryptFetchedArray($sqlResult, $table = ""){
		$pSet = $this->pSet;
		if($table == "")
			$table = $this->strTableName;
		else
			if($table != $this->strTableName)
				$pSet = new ProjectSettings($table);
		
		$result = array();
		$fetchedArray = db_fetch_array($sqlResult);
		if($fetchedArray){
			if(!$pSet->hasEncryptedFields() || !isEncryptionByPHPEnabled())
				return $fetchedArray;
			foreach ($fetchedArray as $fieldName => $fieldValue){
				$result[$fieldName] = $this->DecryptField($fieldName, $fieldValue);
			}
		}
		return $result;
	}
Пример #2
0
function GetFullFieldName($field, $table = "", $addAs = true)
{
    if ($table == "") {
        global $strTableName;
        $table = $strTableName;
    }
    $pSet = new ProjectSettings($table);
    $fname = $pSet->getFullNameField($field);
    if ($pSet->hasEncryptedFields() && !isEncryptionByPHPEnabled()) {
        $cipherer = new RunnerCipherer($table);
        return $cipherer->GetFieldName($fname, $field) . ($cipherer->isFieldEncrypted($field) && $addAs ? " as " . AddFieldWrappers($field) : "");
    }
    return $fname;
}