Changeset 3317


Ignore:
Timestamp:
11/07/08 09:57:44 (5 years ago)
Author:
bsittler
Message:

allow a filename exactly matching the uploaded filename; give a better
error message when this does not work

File:
1 edited

Legend:

Unmodified
Added
Removed
  • libcaca/trunk/caca-php/examples/www/img2txt.php

    r3315 r3317  
    3131if(isset($_REQUEST['args'])) 
    3232{ 
    33         $args = $_REQUEST['args']; 
     33        $args = trim($_REQUEST['args']); 
    3434        if(strlen($args)) 
    3535        { 
     
    268268function main() 
    269269{ 
     270        global $file, $filename; 
    270271        global $argc, $argv; 
    271272        global $stderr; 
     
    350351        } 
    351352 
    352         global $file, $filename; 
    353  
    354353        if((! $file) && ($argc == 2) && ($argv[1] == 'logo-caca.png')) 
    355354        { 
     
    357356                $argc = 1; 
    358357        } 
    359  
    360         if($argc > 1) 
     358        else if($filename && $file && ($argc == 2) 
     359                        && 
     360                        (strtolower(basename($argv[1])) == strtolower(basename($filename)))) 
     361        { 
     362                $argc = 1; 
     363        } 
     364 
     365        if($argc == 2) 
     366        { 
     367                $stderr .= sprintf("%s: image not found\n", $argv[1]); 
     368                return 1; 
     369        } 
     370 
     371        if($argc > 2) 
    361372        { 
    362373                $stderr .= sprintf("%s: too many arguments\n", $argv[0]); 
Note: See TracChangeset for help on using the changeset viewer.