2 // Copyright (C) 2012 by following Brady Miller <brady@sparmy.com>
4 // This program is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU General Public License
6 // as published by the Free Software Foundation; either version 2
7 // of the License, or (at your option) any later version.
9 // Function to check and/or sanitize things for security such as
10 // directories names, file names, etc.
13 // If the label contains any illegal characters, then the script will die.
14 function check_file_dir_name($label) {
15 if (empty($label) ||
preg_match('/[^A-Za-z0-9_.-]/', $label))
16 die(xlt("ERROR: The following variable contains invalid characters").": ".$label);