Aleksander Machniak
2015-10-07 a03233cebafc62ec7d88a24856b8a7b37fef4381
program/lib/Roundcube/rcube_utils.php
@@ -260,9 +260,9 @@
     *
     * @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])) {
@@ -299,7 +299,7 @@
     *
     * @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;
@@ -544,7 +544,8 @@
        }
        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) {
@@ -581,7 +582,8 @@
        $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);
@@ -607,6 +609,7 @@
        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'];
@@ -704,7 +707,7 @@
     * 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
     */
@@ -736,13 +739,13 @@
     * 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;
        }
@@ -939,7 +942,8 @@
     *
     * @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)
    {