|
|
|
@ -283,7 +283,6 @@ function get_password_expiration_value ($domain) {
|
|
|
|
|
* @return string empty if it's a valid email address, otherwise string with the errormessage
|
|
|
|
|
*/
|
|
|
|
|
function check_email($email) {
|
|
|
|
|
|
|
|
|
|
$ce_email=$email;
|
|
|
|
|
|
|
|
|
|
//strip the vacation domain out if we are using it
|
|
|
|
@ -373,8 +372,7 @@ function escape_string($string) {
|
|
|
|
|
* @param string $default (optional) - default value if key is not set.
|
|
|
|
|
* @return string
|
|
|
|
|
*/
|
|
|
|
|
function safeget($param, $default = "")
|
|
|
|
|
{
|
|
|
|
|
function safeget($param, $default = "") {
|
|
|
|
|
$retval = $default;
|
|
|
|
|
if (isset($_GET[$param])) {
|
|
|
|
|
$retval = $_GET[$param];
|
|
|
|
@ -389,8 +387,7 @@ function safeget($param, $default = "")
|
|
|
|
|
* @param string $default (optional) default value (defaults to "")
|
|
|
|
|
* @return string|array - value in $_POST[$param] or $default
|
|
|
|
|
*/
|
|
|
|
|
function safepost($param, $default = "")
|
|
|
|
|
{
|
|
|
|
|
function safepost($param, $default = "") {
|
|
|
|
|
$retval = $default;
|
|
|
|
|
if (isset($_POST[$param])) {
|
|
|
|
|
$retval = $_POST[$param];
|
|
|
|
@ -405,8 +402,7 @@ function safepost($param, $default = "")
|
|
|
|
|
* @param string $default (optional)
|
|
|
|
|
* @return string value from $_SERVER[$param] or $default
|
|
|
|
|
*/
|
|
|
|
|
function safeserver($param, $default = "")
|
|
|
|
|
{
|
|
|
|
|
function safeserver($param, $default = "") {
|
|
|
|
|
$retval = $default;
|
|
|
|
|
if (isset($_SERVER[$param])) {
|
|
|
|
|
$retval = $_SERVER[$param];
|
|
|
|
@ -421,8 +417,7 @@ function safeserver($param, $default = "")
|
|
|
|
|
* @param string $default (optional)
|
|
|
|
|
* @return string value from $_COOKIE[$param] or $default
|
|
|
|
|
*/
|
|
|
|
|
function safecookie($param, $default = "")
|
|
|
|
|
{
|
|
|
|
|
function safecookie($param, $default = "") {
|
|
|
|
|
$retval = $default;
|
|
|
|
|
if (isset($_COOKIE[$param])) {
|
|
|
|
|
$retval = $_COOKIE[$param];
|
|
|
|
@ -437,8 +432,7 @@ function safecookie($param, $default = "")
|
|
|
|
|
* @param string $default (optional)
|
|
|
|
|
* @return string value from $_SESSION[$param] or $default
|
|
|
|
|
*/
|
|
|
|
|
function safesession($param, $default = "")
|
|
|
|
|
{
|
|
|
|
|
function safesession($param, $default = "") {
|
|
|
|
|
$retval = $default;
|
|
|
|
|
if (isset($_SESSION[$param])) {
|
|
|
|
|
$retval = $_SESSION[$param];
|
|
|
|
@ -893,7 +887,6 @@ function generate_password($length = 12) {
|
|
|
|
|
* @return array of error messages, or empty array if the password is ok
|
|
|
|
|
*/
|
|
|
|
|
function validate_password($password) {
|
|
|
|
|
|
|
|
|
|
$result = array();
|
|
|
|
|
$val_conf = Config::read_array('password_validation');
|
|
|
|
|
|
|
|
|
@ -1491,7 +1484,6 @@ function db_connect_with_errors() {
|
|
|
|
|
static $link;
|
|
|
|
|
if (isset($link) && $link) {
|
|
|
|
|
return array($link, $error_text);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
$link = 0;
|
|
|
|
|
|
|
|
|
@ -1825,7 +1817,6 @@ function db_assoc($result) {
|
|
|
|
|
}
|
|
|
|
|
if ($CONF['database_type'] == "mysqli" && $result instanceof mysqli_result) {
|
|
|
|
|
$row = mysqli_fetch_assoc($result);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
if (db_sqlite() && $result instanceof SQLite3Result) {
|
|
|
|
|
$row = $result->fetchArray(SQLITE3_ASSOC);
|
|
|
|
@ -1899,8 +1890,7 @@ function db_insert ($table, array $values, $timestamp = array('created', 'modifi
|
|
|
|
|
$password_expiration_value = (int) get_password_expiration_value($domain);
|
|
|
|
|
$values['password_expiry'] = "now() + interval " . $password_expiration_value . " day";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
} else {
|
|
|
|
|
if ($_table == 'mailbox') {
|
|
|
|
|
unset($values['password_expiry']);
|
|
|
|
|
}
|
|
|
|
@ -1958,7 +1948,6 @@ function db_update_q($table, $where, $values, $timestamp = array('modified')) {
|
|
|
|
|
|
|
|
|
|
if (Config::bool('password_expiration')) {
|
|
|
|
|
if ($table == 'mailbox') {
|
|
|
|
|
|
|
|
|
|
error_log("db_update_q : " . json_Encode($where));
|
|
|
|
|
$where_type = explode('=', $where);
|
|
|
|
|
$email = ($where_type[1]);
|
|
|
|
@ -2022,7 +2011,6 @@ function db_log($domain, $action, $data) {
|
|
|
|
|
* @return string
|
|
|
|
|
*/
|
|
|
|
|
function db_in_clause($field, array $values) {
|
|
|
|
|
|
|
|
|
|
$v = array_map('escape_string', array_values($values));
|
|
|
|
|
return " $field IN ('" . implode("','", $v) . "') ";
|
|
|
|
|
}
|
|
|
|
@ -2079,7 +2067,6 @@ function db_where_clause($condition, $struct, $additional_raw_where = '', $searc
|
|
|
|
|
} elseif ($operator == "NOTNULL") {
|
|
|
|
|
$querypart = $field . ' IS NOT NULL';
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
|
|
$querypart = $field . $operator . "'" . escape_string($value) . "'";
|
|
|
|
|
|
|
|
|
|
// might need other types adding here.
|
|
|
|
|