* * This file is part of Gombe-MI. * * Gombe-MI is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Gombe-MI. If not, see . * * Library of php functions for Gombe-MI. * * Karl O. Pinc */ // Constants // // Functions. // ///////////////////////////////////////////////////////////////////// function move_and_fix_eol($from_path, $to_path) { /* Move a file, converting Windoze and mac eol sequences to Unix eol. * * Input: * $from_path Pathname to move * $to_path Place to move to. * * Returns: system return code of exec() which copies. * (0 on success, something else on failure) * * Side Effects: moves file * * Bugs: */ exec("sed -e '" . 's/\r$//' . "' $from_path" . ' | tr "\\r" "\\n"' . " > $to_path" , $dummy , $result); unlink($from_path); return $result; } ///////////////////////////////////////////////////////////////////// function explain_error($f, $e) { /* * Explain an error code returned by $_FILE[]['error'] * * Input: * $f The description of the file to show to the user. * $e The error code * * Returns: String containing html which explains the error. * * Side Effects: none */ $e = "

$f: "; switch ($e) { case UPLOAD_ERR_OK: $e .= "There is no error, the file uploaded with success."; break; case UPLOAD_ERR_INI_SIZE: $e .= "The uploaded file exceeds the upload_max_filesize directive in php.ini."; break; case UPLOAD_ERR_FORM_SIZE: $e .= "The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form."; break; case UPLOAD_ERR_PARTIAL: $e .= "The uploaded file was only partially uploaded."; break; case UPLOAD_ERR_NO_FILE: $e .= "No file was uploaded."; break; } $e .= "

"; return $e; }