Changeset 1556

Show
Ignore:
Timestamp:
04/14/06 16:01:14 (7 years ago)
Author:
mheydon1973
Message:

Added isFilename form validation check

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • freepbx/trunk/amp_conf/htdocs/admin/common/script.js.php

    r1554 r1556  
    476476 
    477477// *************************************************** 
     478// ** Valid filename                                ** 
     479// *************************************************** 
     480 
     481function isFilename(s) 
     482{ 
     483    var i; 
     484 
     485    if (isEmpty(s))  
     486       if (isFilename.arguments.length == 1) return defaultEmptyOK; 
     487       else return (isFilename.arguments[1] == true); 
     488 
     489    for (i = 0; i < s.length; i++) 
     490    {    
     491        var c = s.charAt(i); 
     492 
     493        if (!isFilenameChar(c)) return false; 
     494    } 
     495 
     496    return true; 
     497} 
     498 
     499// *************************************************** 
    478500// ** HELPER FUNCTIONS FOR ABOVE VALIDATIONS        ** 
    479501// *************************************************** 
     
    502524{   return ( ((c >= "0") && (c <= "9")) || (c == "*") || (c == "#" ) ) 
    503525} 
     526 
     527function isFilenameChar (c) 
     528{   return ( ((c >= "0") && (c <= "9")) || ((c >= "a") && (c <= "z")) || ((c >= "A") && (c <= "Z")) || (c == "_") || (c == "-") ) 
     529}