Tous les codes sourcespage 66
C++
2 June, 2014 à 08:11
#209
/*
############
#|---------\
#| |
#| O
#| -|-
#| |
#| / \
#L_____________________
# GRAVEYARD OF BAD IDEAS
*/
PHP
1 June, 2014 à 06:28
#210
if (!function_exists("GetSQLValueString"))
{
function GetSQLValueString($theValue, $theType = null, $theDefinedValue = "", $theNotDefinedValue = "")
{
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}
PHP
1 June, 2014 à 04:52
#175
// . . .
return $this->boolean((bool)$data);
}
/**
* Translates between PHP boolean values and Database (faked) boolean values
*
* @param mixed $data Value to be translated
* @return mixed Converted boolean value
* @access public
*/
function boolean($data) {
if ($data === true || $data === false) {
if ($data === true) {
return "true";
}
return "false";
} else {
return !empty($data);
}
}