| | |
| | | */ |
| | | function get_input_value($fname, $source, $allow_html=FALSE, $charset=NULL) |
| | | { |
| | | global $OUTPUT; |
| | | $value = NULL; |
| | | |
| | | if ($source==RCUBE_INPUT_GET && isset($_GET[$fname])) |
| | |
| | | $value = $_COOKIE[$fname]; |
| | | } |
| | | |
| | | return parse_input_value($value, $allow_html, $charset); |
| | | } |
| | | |
| | | /** |
| | | * Parse/validate input value. See get_input_value() |
| | | * Performs stripslashes() and charset conversion if necessary |
| | | * |
| | | * @param string Input value |
| | | * @param boolean Allow HTML tags in field value |
| | | * @param string Charset to convert into |
| | | * @return string Parsed value |
| | | */ |
| | | function parse_input_value($value, $allow_html=FALSE, $charset=NULL) |
| | | { |
| | | global $OUTPUT; |
| | | |
| | | if (empty($value)) |
| | | return $value; |
| | | |
| | | if (is_array($value)) { |
| | | foreach ($value as $idx => $val) |
| | | $value[$idx] = parse_input_value($val, $allow_html, $charset); |
| | | return $value; |
| | | } |
| | | |
| | | // strip single quotes if magic_quotes_sybase is enabled |
| | | if (ini_get('magic_quotes_sybase')) |
| | |
| | | $value = strip_tags($value); |
| | | |
| | | // convert to internal charset |
| | | if (is_object($OUTPUT)) |
| | | if (is_object($OUTPUT) && $charset) |
| | | return rcube_charset_convert($value, $OUTPUT->get_charset(), $charset); |
| | | else |
| | | return $value; |
| | |
| | | return true; |
| | | if ($port && $_SERVER['SERVER_PORT'] == $port) |
| | | return true; |
| | | if ($use_https && $RCMAIL->config->get('use_https')) |
| | | if ($use_https && isset($RCMAIL) && $RCMAIL->config->get('use_https')) |
| | | return true; |
| | | |
| | | return false; |
| | | } |
| | | |
| | | // for backward compatibility |
| | | function rcube_sess_unset($var_name=null) |
| | | { |
| | | global $RCMAIL; |
| | | |
| | | $RCMAIL->session->remove($var_name); |
| | | } |
| | | |
| | | |
| | |
| | | if (preg_match('/[\x00-\x1F\x7F-\xFF]/', $email)) |
| | | return false; |
| | | |
| | | // Check that there's one @ symbol, and that the lengths are right |
| | | if (!preg_match('/^([^@]{1,64})@([^@]{1,255})$/', $email, $email_array)) |
| | | // Check for length limit specified by RFC 5321 (#1486453) |
| | | if (strlen($email) > 254) |
| | | return false; |
| | | |
| | | // Check that there's one @ symbol |
| | | if (!preg_match('/^([^@]+)@([^@]+)$/', $email, $email_array)) |
| | | return false; |
| | | |
| | | // Check local part |