| | |
| | | * |
| | | * @return string Field value or NULL if not available |
| | | */ |
| | | public static function get_input_value($fname, $source, $allow_html=FALSE, $charset=NULL) |
| | | public static function get_input_value($fname, $source, $allow_html = false, $charset = null) |
| | | { |
| | | $value = NULL; |
| | | $value = null; |
| | | |
| | | if ($source == self::INPUT_GET) { |
| | | if (isset($_GET[$fname])) { |
| | |
| | | * |
| | | * @return string Parsed value |
| | | */ |
| | | public static function parse_input_value($value, $allow_html=FALSE, $charset=NULL) |
| | | public static function parse_input_value($value, $allow_html = false, $charset = null) |
| | | { |
| | | global $OUTPUT; |
| | | |
| | |
| | | } |
| | | if (!empty($_SERVER['HTTP_X_FORWARDED_PROTO']) |
| | | && strtolower($_SERVER['HTTP_X_FORWARDED_PROTO']) == 'https' |
| | | && in_array($_SERVER['REMOTE_ADDR'], rcube::get_instance()->config->get('proxy_whitelist', array()))) { |
| | | && in_array($_SERVER['REMOTE_ADDR'], rcube::get_instance()->config->get('proxy_whitelist', array())) |
| | | ) { |
| | | return true; |
| | | } |
| | | if ($port && $_SERVER['SERVER_PORT'] == $port) { |
| | |
| | | $h = $_SESSION['storage_host'] ? $_SESSION['storage_host'] : $host; |
| | | // %z - IMAP domain without first part, e.g. %h=imap.domain.tld, %z=domain.tld |
| | | $z = preg_replace('/^[^\.]+\./', '', $h); |
| | | // %s - domain name after the '@' from e-mail address provided at login screen. Returns FALSE if an invalid email is provided |
| | | // %s - domain name after the '@' from e-mail address provided at login screen. |
| | | // Returns FALSE if an invalid email is provided |
| | | if (strpos($name, '%s') !== false) { |
| | | $user_email = self::get_input_value('_user', self::INPUT_POST); |
| | | $user_email = self::idn_convert($user_email, true); |
| | |
| | | if (!empty($_SERVER['HTTP_X_REAL_IP'])) { |
| | | $remote_ip[] = 'X-Real-IP: ' . $_SERVER['HTTP_X_REAL_IP']; |
| | | } |
| | | |
| | | // append the X-Forwarded-For header, if set |
| | | if (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) { |
| | | $remote_ip[] = 'X-Forwarded-For: ' . $_SERVER['HTTP_X_FORWARDED_FOR']; |
| | |
| | | * Improved equivalent to strtotime() |
| | | * |
| | | * @param string $date Date string |
| | | * @param object DateTimeZone to use for DateTime object |
| | | * @param DateTimeZone $timezone Timezone to use for DateTime object |
| | | * |
| | | * @return int Unix timestamp |
| | | */ |
| | |
| | | * Date parsing function that turns the given value into a DateTime object |
| | | * |
| | | * @param string $date Date string |
| | | * @param object DateTimeZone to use for DateTime object |
| | | * @param DateTimeZone $timezone Timezone to use for DateTime object |
| | | * |
| | | * @return object DateTime instance or false on failure |
| | | * @return DateTime instance or false on failure |
| | | */ |
| | | public static function anytodatetime($date, $timezone = null) |
| | | { |
| | | if (is_object($date) && is_a($date, 'DateTime')) { |
| | | if ($date instanceof DateTime) { |
| | | return $date; |
| | | } |
| | | |
| | |
| | | * |
| | | * @param string Haystack |
| | | * @param string Needle |
| | | * @return boolen True if match, False otherwise |
| | | * |
| | | * @return boolean True if match, False otherwise |
| | | */ |
| | | public static function words_match($haystack, $needle) |
| | | { |