Example #1
0
	<?php 
            // Check to see if the upload failed for some reason
            if (isset($_FILES['mohfile']['name']) && !is_uploaded_file($_FILES['mohfile']['tmp_name'])) {
                if (strlen($_FILES['mohfile']['name']) == 0) {
                    echo "<h5> PHP " . _("Error Processing") . "! " . _("No file provided") . " " . _("Please select a file to upload") . "</h5>";
                } else {
                    echo "<h5> PHP " . _("Error Processing") . " " . htmlentities($_FILES['mohfile']['name']) . "! " . _("Check") . " upload_max_filesize " . _("in") . " /etc/php.ini</h5>";
                }
            }
            if (isset($_FILES['mohfile']['tmp_name']) && is_uploaded_file($_FILES['mohfile']['tmp_name'])) {
                //echo $_FILES['mohfile']['name']." uploaded OK";
                move_uploaded_file($_FILES['mohfile']['tmp_name'], $path_to_dir . "/orig_" . $_FILES['mohfile']['name']);
                if ($amp_conf['AMPMPG123']) {
                    $process_err = process_mohfile($_FILES['mohfile']['name'], true, $volume);
                } else {
                    $process_err = process_mohfile($_FILES['mohfile']['name'], $_REQUEST['onlywav'] != '');
                }
                if (isset($process_err)) {
                    echo "<h5>" . _("Error Processing") . ": \"{$process_err}\" for " . htmlentities($_FILES['mohfile']['name']) . "!</h5>\n";
                    echo "<h5>" . _("This is not a fatal error, your Music on Hold may still work.") . "</h5>\n";
                } else {
                    echo "<h5>" . _("Completed processing") . " " . htmlentities($_FILES['mohfile']['name']) . "!</h5>";
                }
                needreload();
            }
            //build the array of files
            $file_array = build_list();
            $numf = count($file_array);
        }
        // normal moh dir
        if (isset($_REQUEST['del'])) {
Example #2
0
<br><br>
		<input type="hidden" name="display" value="1">
		<input type="hidden" name="category" value="<?php 
    echo "{$category}";
    ?>
">
		<input type="hidden" name="action" value="addedfile">
		<input type="file" size="28" name="mohfile"><input type="submit" name="Submit" value="Upload">
	</form>
	</td></tr>
	</table>
	
	<?php 
    if (isset($_FILES['mohfile']['tmp_name']) && is_uploaded_file($_FILES['mohfile']['tmp_name'])) {
        move_uploaded_file($_FILES['mohfile']['tmp_name'], $path_to_dir . "/orig_" . $_FILES['mohfile']['name']);
        process_mohfile($_FILES['mohfile']['name']);
        echo "<h5>" . _("Completed processing") . " " . $_FILES['mohfile']['name'] . "!</h5>";
        kill_mpg123();
    }
    //build the array of files
    $file_array = build_list();
    $numf = count($file_array);
    if (isset($_REQUEST['del'])) {
        if ($numf == 1 && $category == "Default") {
            echo "<h5>" . _("You must have at least one file for On Hold Music.  Please upload one before deleting this one.") . "</h5>";
        } else {
            $rmcmd = "rm -f \"" . $path_to_dir . "/" . $_REQUEST['del'] . "\"";
            exec($rmcmd);
            echo "<h5>" . _("Deleted") . " " . $_REQUEST['del'] . "!</h5>";
            kill_mpg123();
        }