2 /* Copyright (C) 2012 The Meme Factory, Inc. http://www.meme.com/
3 * Copyright (C) 2006, 2008, Karl O. Pinc <kop@meme.com>
5 * This file is part of Gombe-MI.
7 * Gombe-MI is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 3 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with Gombe-MI. If not, see <http://www.gnu.org/licenses/>.
20 * Library of php functions for Gombe-MI.
22 * Karl O. Pinc <kop@meme.com>
31 /////////////////////////////////////////////////////////////////////
32 function move_and_fix_eol($from_path, $to_path) {
33 /* Move a file, converting Windoze and mac eol sequences to Unix eol.
36 * $from_path Pathname to move
37 * $to_path Place to move to.
39 * Returns: system return code of exec() which copies.
40 * (0 on success, something else on failure)
42 * Side Effects: moves file
47 exec("sed -e '" . 's/\r$//' . "' $from_path"
58 /////////////////////////////////////////////////////////////////////
59 function explain_error($f, $e) {
61 * Explain an error code returned by $_FILE[]['error']
64 * $f The description of the file to show to the user.
67 * Returns: String containing html which explains the error.
76 $e .= "There is no error, the file uploaded with success.";
79 case UPLOAD_ERR_INI_SIZE:
81 $e .= "<em class=\"error\">The uploaded file exceeds the upload_max_filesize directive in php.ini.</em>";
84 case UPLOAD_ERR_FORM_SIZE:
85 $e .= "<em class=\"error\">The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form.</em>";
88 case UPLOAD_ERR_PARTIAL:
89 $e .= "<em class=\"error\">The uploaded file was only partially uploaded.</em>";
92 case UPLOAD_ERR_NO_FILE:
93 $e .= "<em class=\"error\">No file was uploaded.</em>";