X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fmedia%2FXMPValidate.php;h=e2ae535548023afaf319489386ae72b96b64d1b9;hb=82f2fcfb125a091cf97ead05bb0e7c485c559ec5;hp=5ce3c00bde8cd0802c81a8c91a5b875878463707;hpb=4fc7b7aa7697b5abf6335bc8f54db4c4883ecf0a;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/media/XMPValidate.php b/includes/media/XMPValidate.php index 5ce3c00bde..e2ae535548 100644 --- a/includes/media/XMPValidate.php +++ b/includes/media/XMPValidate.php @@ -95,8 +95,8 @@ class XMPValidate { return; } if ( !preg_match( '/^[-+]?\d*(?:\.?\d*)$/D', $val ) - || !is_numeric($val) - ) { + || !is_numeric( $val ) + ) { wfDebugLog( 'XMP', __METHOD__ . " Expected rating but got $val" ); $val = null; return; @@ -106,12 +106,12 @@ class XMPValidate { // We do < 0 here instead of < -1 here, since // the values between 0 and -1 are also illegal // as -1 is meant as a special reject rating. - wfDebugLog( 'XMP', __METHOD__ . " Rating too low, setting to -1 (Rejected)"); + wfDebugLog( 'XMP', __METHOD__ . " Rating too low, setting to -1 (Rejected)" ); $val = '-1'; return; } if ( $nVal > 5 ) { - wfDebugLog( 'XMP', __METHOD__ . " Rating too high, setting to 5"); + wfDebugLog( 'XMP', __METHOD__ . " Rating too high, setting to 5" ); $val = '5'; return; } @@ -153,7 +153,7 @@ class XMPValidate { //check if its in a numeric range $inRange = false; - if ( isset( $info['rangeLow'] ) + if ( isset( $info['rangeLow'] ) && isset( $info['rangeHigh'] ) && is_numeric( $val ) && ( intval( $val ) <= $info['rangeHigh'] ) @@ -247,8 +247,8 @@ class XMPValidate { $res = array(); if ( !preg_match( /* ahh! scary regex... */ - '/^([0-3]\d{3})(?:-([01]\d)(?:-([0-3]\d)(?:T([0-2]\d):([0-6]\d)(?::([0-6]\d)(?:\.\d+)?)?([-+]\d{2}:\d{2}|Z)?)?)?)?$/D' - , $val, $res) + '/^([0-3]\d{3})(?:-([01]\d)(?:-([0-3]\d)(?:T([0-2]\d):([0-6]\d)(?::([0-6]\d)(?:\.\d+)?)?([-+]\d{2}:\d{2}|Z)?)?)?)?$/D', + $val, $res ) ) { wfDebugLog( 'XMP', __METHOD__ . " Expected date but got $val" ); $val = null; @@ -342,7 +342,7 @@ class XMPValidate { } $m = array(); - if ( preg_match( + if ( preg_match( '/(\d{1,3}),(\d{1,2}),(\d{1,2})([NWSE])/D', $val, $m ) ) { @@ -354,7 +354,7 @@ class XMPValidate { } $val = $coord; return; - } elseif ( preg_match( + } elseif ( preg_match( '/(\d{1,3}),(\d{1,2}(?:.\d*)?)([NWSE])/D', $val, $m ) ) { @@ -367,7 +367,7 @@ class XMPValidate { return; } else { - wfDebugLog( 'XMP', __METHOD__ + wfDebugLog( 'XMP', __METHOD__ . " Expected GPSCoordinate, but got $val." ); $val = null; return;