Example #1
0
    $con = PMBP_mysql_connect();
    if (!$con) {
        $error = C_WRONG_SQL;
    }
    if (!$error) {
        $db = @mysql_select_db($_GET['dbn']);
    }
    if (!$db) {
        $error = C_WRONG_DB . " (" . $_GET['dbn'] . ")";
    }
}
// open the file
if (!$error && !isset($firstSession)) {
    // gzopen can be used for plain text too!
    // extract zip file
    if (PMBP_file_info("comp", $_GET["fn"]) == "zip") {
        include_once "pclzip.lib.php";
        $pclzip = new PclZip($_GET["fn"]);
        $extracted_file = $pclzip->extractByIndex(0, PMBP_EXPORT_DIR, "");
        if ($pclzip->error_code != 0) {
            $error = "plczip: " . $pclzip->error_string . "<br>" . BI_BROKEN_ZIP . "!";
        }
        $_GET["fn"] = substr($_GET["fn"], 0, strlen($_GET["fn"]) - 4);
        unset($pclzip);
    }
    if (!$error && !($file = @gzopen($_GET["fn"], "r"))) {
        $error = C_OPEN . " " . $_GET["fn"];
    }
}
if (!$error) {
    // get start time to calculate duration
Example #2
0
    $mysql_s = @mysql_get_server_info();
}
if (!function_exists("mysql_get_client_info")) {
    $mysql_c = PMBP_I_NO_RES;
} else {
    $mysql_c = @mysql_get_client_info();
}
// calculate size of all backups and last backup date
$all_files = PMBP_get_backup_files();
if (is_array($all_files)) {
    $last_backup = 0;
    $size_sum = 0;
    foreach ($all_files as $filename) {
        $file = "./" . PMBP_EXPORT_DIR . $filename;
        $size_sum += PMBP_file_info("size", $file);
        if (($time = PMBP_file_info("time", $file)) > $last_backup) {
            $last_backup = $time;
        }
    }
    $size_sum = PMBP_size_type($size_sum);
    $size = $size_sum['value'] . " " . $size_sum['type'];
    $time = strftime($CONF['date'], $last_backup);
} else {
    $size = "0 kb";
    $time = "?";
}
$scheduled_time = $PMBP_SYS_VAR['last_scheduled'];
foreach ($PMBP_SYS_VAR as $key => $value) {
    if (substr($key, 0, 15) == "last_scheduled_" && $value > $scheduled_time) {
        $scheduled_time = $value;
    }
Example #3
0
 | 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 this program; if not, write to the Free Software              |
 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA.|
 +--------------------------------------------------------------------------+
*/
require_once "login.php";
// print html header
echo "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01//EN\"\n   \"http://www.w3.org/TR/html4/loose.dtd\">\n<html" . ARABIC_HTML . ">\n<head>\n<meta http-equiv=\"Content-Type\" content=\"text/html;charset=utf-8\">\n<link rel=\"stylesheet\" href=\"" . PMBP_STYLESHEET_DIR . $CONF['stylesheet'] . ".css\" type=\"text/css\">\n<title>LugrawibeBackup - " . INF_INFO . "</title>\n</head>\n<body>\n<table border=\"0\" cellspacing=\"2\" cellpadding=\"0\" width=\"100%\">\n\n<tr><th colspan=\"2\" class=\"active\">\n";
echo PMBP_image_tag("logo.png", "LugrawibeBackup PMBP_WEBSITE", PMBP_WEBSITE);
echo "\n</th></tr>\n";
// get and print the informations about the $_GET['file'] backup file
if ($_GET['file']) {
    echo "<tr><td><div class=\"bold_left\"><br><br>" . INF_DATE . ":</div></td><td><br><br>" . strftime($CONF['date'], PMBP_file_info("time", PMBP_EXPORT_DIR . $_GET['file'])) . "</td></tr>\n";
    echo "<tr><td><div class=\"bold_left\">" . INF_DB . ":</div></td><td>" . PMBP_file_info("db", PMBP_EXPORT_DIR . $_GET['file']) . "</td></tr>\n";
    $size = PMBP_size_type(PMBP_file_info("size", PMBP_EXPORT_DIR . $_GET['file']));
    echo "<tr><td><div class=\"bold_left\">" . INF_SIZE . ":</div></td><td>" . $size['value'] . " " . $size['type'] . "</td></tr>\n";
    echo "<tr><td><div class=\"bold_left\">" . INF_COMP . ":</div></td><td>" . PMBP_file_info("comp", PMBP_EXPORT_DIR . $_GET['file']) . "</td></tr>\n";
    echo "<tr><td><div class=\"bold_left\">" . INF_DROP . ":</div></td><td>" . PMBP_file_info("drop", PMBP_EXPORT_DIR . $_GET['file']) . "</td></tr>\n";
    echo "<tr><td><div class=\"bold_left\">" . INF_TABLES . ":</div></td><td>" . PMBP_file_info("tables", PMBP_EXPORT_DIR . $_GET['file']) . "</td></tr>\n";
    echo "<tr><td><div class=\"bold_left\">" . INF_DATA . ":</div></td><td>" . PMBP_file_info("data", PMBP_EXPORT_DIR . $_GET['file']) . "</td></tr>\n";
    echo "<tr><td colspan=\"2\"><br><div class=\"bold_left\">" . INF_COMMENT . ":</div></td></tr>\n";
    echo "<tr><td colspan=\"2\">" . PMBP_file_info("comment", PMBP_EXPORT_DIR . $_GET['file']) . "</td></tr>\n";
} else {
    // return error message if no file was selected
    echo "<tr><td><div class=\"bold\">" . INF_NO_FILE . "!</div></td></tr>\n";
}
echo "</table>\n</body>\n</html>";
Example #4
0
function PMBP_getln($path, $close = false, $org_path = false)
{
    if (!isset($GLOBALS['lnFile'])) {
        $GLOBALS['lnFile'] = null;
    }
    if (!$org_path) {
        $org_path = $path;
    } else {
        $org_path = PMBP_EXPORT_DIR . $org_path;
    }
    // gz file
    if (PMBP_file_info("gzip", $org_path) == "gz") {
        if (!$close) {
            if ($GLOBALS['lnFile'] == null) {
                $GLOBALS['lnFile'] = gzopen($path, "r");
            }
            if (!gzeof($GLOBALS['lnFile'])) {
                return gzgets($GLOBALS['lnFile']);
            } else {
                $close = true;
            }
        }
        if ($close) {
            // remove the file handler
            @gzclose($GLOBALS['lnFile']);
            $GLOBALS['lnFile'] = null;
            return null;
        }
        // zip file
    } elseif (PMBP_file_info("zip", $org_path) == "zip") {
        if (!$close) {
            if ($GLOBALS['lnFile'] == null) {
                // try to guess the filename of the packed file
                // known problem: ZIP file xyz.sql.zip contains file abc.sql which already exists with different content!
                if (!file_exists(substr($org_path, 0, strlen($org_path) - 4))) {
                    // extract the file
                    include_once "pclzip.lib.php";
                    $pclzip = new PclZip($path);
                    $extracted_file = $pclzip->extract(PMBP_EXPORT_DIR, "");
                    if ($pclzip->error_code != 0) {
                        // print pclzip error message
                        echo "<div class=\"red\">pclzip: " . $pclzip->error_string . "<br>" . BI_BROKEN_ZIP . "!</div>";
                        return false;
                    } else {
                        unset($pclzip);
                    }
                }
            }
            // read the extracted file
            $line = PMBP_getln(substr($org_path, 0, strlen($org_path) - 4));
            if ($line == null) {
                $close = true;
            } else {
                return $line;
            }
        }
        // remove the temporary file
        if ($close) {
            @fclose($GLOBALS['lnFile']);
            $GLOBALS['lnFile'] = null;
            @unlink(substr($org_path, 0, strlen($org_path) - 4));
            return null;
        }
        // sql file
    } else {
        if (!$close) {
            if ($GLOBALS['lnFile'] == null) {
                $GLOBALS['lnFile'] = fopen($path, "r");
            }
            if (!feof($GLOBALS['lnFile'])) {
                return fgets($GLOBALS['lnFile']);
            } else {
                $close = true;
            }
        }
        if ($close) {
            // remove the file handler
            @fclose($GLOBALS['lnFile']);
            $GLOBALS['lnFile'] = null;
            return null;
        }
    }
}
Example #5
0
 $size_sum = 0;
 // print html table
 foreach ($all_files as $filename) {
     $file = PMBP_EXPORT_DIR . $filename;
     // generate one row for the db name
     if (!isset($printed_title[$db = PMBP_file_info("db", $file)])) {
         $printed_title[$db] = TRUE;
         echo "<tr><th colspan=\"9\" class=\"active\">" . $db . " <span class=\"standard\">" . PMBP_confirm(B_CONF_EMPTY_DB, "import.php?empty_all=" . $db, "[" . B_EMPTY_DB . "]");
         echo "&nbsp;" . PMBP_confirm(B_CONF_DEL_ALL, "import.php?del_all=" . $db, "[" . B_DELETE_ALL . "]") . "</span></th></tr>\n";
     }
     echo "<tr " . PMBP_change_color("#FFFFFF", "#000000") . ">\n<td class=\"list\">\n" . $filename . "</td>\n";
     echo "<td class=\"list\">" . strftime($CONF['date'], $time = PMBP_file_info("time", $file)) . "</td>\n";
     if ($time > $last_backup) {
         $last_backup = $time;
     }
     $size_sum += $size = PMBP_file_info("size", $file);
     $size = PMBP_size_type($size);
     echo "<td class=\"list\">" . $size['value'] . " " . $size['type'] . "</td>\n";
     echo "<td class=\"list\">" . PMBP_pop_up("file_info.php?file=" . $filename, B_INFO, "info") . "</td>\n";
     echo "<td class=\"list\">" . PMBP_pop_up("get_file.php?view=" . $file, B_VIEW, "view") . "</td>\n";
     echo "<td class=\"list\"><a href=\"get_file.php?download=true&amp;view=" . $file . "\">" . B_DOWNLOAD . "</a></td>\n";
     if ($con) {
         echo "<td class=\"list\">" . PMBP_confirm(B_CONF_IMP, "import.php?import=" . $filename, B_IMPORT) . " \n";
     } else {
         echo "<td class=\"list\">" . B_IMPORT . " \n";
     }
     if ($con) {
         echo "(" . PMBP_confirm(B_CONF_IMP, "big_import.php?fn=" . PMBP_EXPORT_DIR . $filename . "&amp;dbn=" . $db, B_IMPORT_FRAG, "info") . ")</td>\n";
     } else {
         echo B_IMPORT_FRAG . "</td>\n";
     }