Пример #1
0
//
//This program 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 2
//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.
?>

<?php 
include_once "schedule_functions.php";
$action = isset($_REQUEST['action']) ? $_REQUEST['action'] : '';
$serialpn = file_parser_serialpn("/etc/voiper_pn");
$display = 1;
function uploader($num_of_uploads = 1, $file_types_array = array("gz"), $max_file_size = 100000000, $upload_dir = "/var/lib/asterisk/backups/Voiper-BAK/")
{
    if (!is_numeric($max_file_size)) {
        $max_file_size = 100000000;
    }
    if (!isset($_POST["submitted"])) {
        $form = "<form name='upload' action='" . $PHP_SELF . "' method='post' enctype='multipart/form-data'>Backup: <input type='hidden' name='submitted' value='TRUE' id='" . time() . "'><input type='hidden' name='MAX_FILE_SIZE' value='" . $max_file_size . "'>";
        for ($x = 0; $x < $num_of_uploads; $x++) {
            $form .= "<input type='file' name='file[]'>";
        }
        $form .= "<input type='submit' value='Send'><br>";
        $form .= "</form>";
        echo $form;
    } else {
Пример #2
0
function Get_Tar_Files($dir = "", $display = "", $file = "")
{
    if (is_dir($dir)) {
        if ($file != "." && $file != ".." && $file != "") {
            echo "";
        }
        if ($dh = opendir($dir)) {
            while (($file = readdir($dh)) !== false) {
                if ($file != "." && $file != ".." && $dir == "/var/lib/asterisk/backups/") {
                    echo "<li><a href=\"config.php?mode=tools&display={$display}&action=restore&dir={$dir}/{$file}\">{$file}</a><br></li>";
                } else {
                    if ($file != "." && $file != "..") {
                        echo "<li><a href=\"config.php?mode=tools&display={$display}&action=restore&dir={$dir}/{$file}&file={$file}\">{$file}</a><br></li>";
                    }
                }
            }
            closedir($dh);
        }
    } else {
        if (substr($dir, -6) == "tar.gz") {
            $tar_string = "tar tfz \"{$dir}\" | cut -d'/' -f4";
            exec($tar_string, $restore_files, $error);
            $serialpn = file_parser_serialpn("/etc/voiper_pn");
            $confparser = parse_amportal_conf("/etc/ver_voiper");
            $voiperversion = $confparser['version'];
            if (array_search('.voiperpn-' . $serialpn, $restore_files) && array_search('.voiperver-' . $voiperversion, $restore_files)) {
                echo "<li><a class=\"info\" href=\"javascript:decision('Are you sure you want to delete this File Set?','config.php?mode=tools&display={$display}&action=deletefileset&dir={$dir}&file={$file}')\">";
                echo _("Delete File Set");
                echo "<span>";
                echo _("Delete this backup set.");
                echo "</span></a><br></li>";
                echo "<br>";
                echo "<li><a class=\"info\" href=\"javascript:decision('Are you sure you want to Restore this Complete File Set\nDoing so will Permanently Over-Write all AMP and Asterisk Files\n You will Loose all Your CAll DETAIL RECORDS and YOUR VoiceMail that was recorded between the BACKUP DATE and NOW?','config.php?mode=tools&display={$display}&action=restored&dir={$dir}&filetype=ALL&file={$file}')\">";
                echo _("Restore Entire Backup Set");
                echo "<span>";
                echo _("Restore your Complete Backup set overwriting all files.");
                echo "</span></a><br></li>";
                echo "<br>";
                if (array_search('voicemail.tar.gz', $restore_files)) {
                    echo "<li><a class=\"info\" href=\"javascript:decision('Are you sure you want to Restore  this File Set\nDoing so will permently delete any new voicemail you have in your mailbox\n ansince this backup on {$file} ?','config.php?mode=tools&display={$display}&action=restored&dir={$dir}&filetype=VoiceMail&file={$file}')\">";
                    echo _("Restore VoiceMail Files");
                    echo "<span>";
                    echo _("Restore your Voicemail files from this backup set.  NOTE! This will delete any voicemail currently in the voicemail boxes.");
                    echo "</span></a><br></li>";
                    echo "<br>";
                }
                if (array_search('recordings.tar.gz', $restore_files)) {
                    echo "<li><a class=\"info\" href=\"config.php?mode=tools&display={$display}&action=restored&dir={$dir}&filetype=Recordings&file={$file}\">";
                    echo _("Restore System Recordings Files");
                    echo "<span>";
                    echo _("Restore your system Voice Recordings including AutoAttendent files from this backup set.  NOTE! This will OVERWRITE any voicerecordings  currently on the system. It will NOT delete new files not currently in the backup set");
                    echo "</span></a><br></li>";
                    echo "<br>";
                }
                if (array_search('configurations.tar.gz', $restore_files)) {
                    echo "<li><a class=\"info\" href=\"javascript:decision('Are you sure you want to Restore this File Set\nDoing so will Permanently Over-Write all AMP and Asterisk Files?','config.php?mode=tools&display={$display}&action=restored&dir={$dir}&filetype=Configurations&file={$file}')\">";
                    echo _("Restore System Configuration");
                    echo "<span>";
                    echo _("Restore your system configuration from this backup set.  NOTE! This will OVERWRITE any System changes you have made since this backup... ALL Itemes will be reset to what they were at the time of this backup set..");
                    echo "</span></a><br></li>";
                    echo "<br>";
                }
                if (array_search('fop.tar.gz', $restore_files)) {
                    echo "<li><a class=\"info\" href=\"javascript:decision('Are you sure you want to Restore the Operator Panel Files\nDoing so will Permanently Over-Write all Operator Panel Files?','config.php?mode=tools&display={$display}&action=restored&dir={$dir}&filetype=FOP&file={$file}')\">";
                    echo _("Restore Operator Panel");
                    echo "<span>";
                    echo _("Restore the Operator Panel from this backup set.  NOTE! This will OVERWRITE any Operator Panel Changes you have made since this backup... ALL Itemes will be reset to what they were at the time of this backup set..");
                    echo "</span></a><br></li>";
                    echo "<br>";
                }
                if (array_search('cdr.tar.gz', $restore_files)) {
                    echo "<li><a class=\"info\" href=\"javascript:decision('Are you sure you want to Restore the CALL DETAIL FILES \nDoing so will Permanently DELETE  all CALL RECORDS.?','config.php?mode=tools&display={$display}&action=restored&dir={$dir}&filetype=CDR&file={$file}')\">";
                    echo _("Restore Call Detail Report");
                    echo "<span>";
                    echo _("Restore the Call Detail Records from this backup set.  NOTE! This will DELETE ALL CALL RECORDS that have been saved since this backup set..");
                    echo "</span></a><br></li>";
                    echo "<br>";
                }
            } else {
                echo "<li><a class=\"info\" href=\"javascript:decision('Are you sure you want to delete this File Set?','config.php?mode=tools&display={$display}&action=deletefileset&dir={$dir}&file={$file}')\">";
                echo _("Delete File Set");
                echo "<span>";
                echo _("Delete this backup set.");
                echo "</span></a><br></li>";
                echo "<h5>";
                echo _("You have an Error: ");
                echo "</h5><h7>";
                echo _("This version of Backup is Not compatible with the current version of Voiper.");
                echo "<br>";
                echo _("Files restore works only with the same Software version and Pbx Model (partNumber).");
                echo "<br><br>";
                echo _("For further information please read the Voiper manual.");
                echo "</h7>";
            }
        } else {
            echo "<h3>";
            echo _("ERROR: its not a BACKUP SET file.");
            echo "</h3>";
        }
    }
}