コード例 #1
0
ファイル: functions.inc.php プロジェクト: shamblett/janitor
function PMBP_print_header($scriptname)
{
    global $CONF;
    global $_POST;
    global $PMBP_SYS_VAR;
    global $PMBP_MU_CONF;
    if (!isset($CONF['stylesheet'])) {
        $CONF['stylesheet'] = "standard";
    }
    echo "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01\nTransitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">\n<html" . ARABIC_HTML . ">\n<head>\n<title>phpMyBackupPro " . PMBP_VERSION;
    // print mu mode info in browser title
    if ($_SESSION['multi_user_mode']) {
        echo " (Multi User Mode)";
    }
    if (isset($_SESSION['sql_user']) && isset($_SESSION['sql_passwd'])) {
        if ($_SESSION['sql_user'] && $_SESSION['sql_user'] == $PMBP_MU_CONF['sql_user_admin'] && $_SESSION['sql_passwd'] == $PMBP_MU_CONF['sql_passwd_admin']) {
            echo " (Multi User Mode Administration)";
        }
    }
    if (!file_exists(PMBP_STYLESHEET_DIR . $CONF['stylesheet'] . ".css")) {
        if (!file_exists(PMBP_STYLESHEET_DIR . ($CONF['stylesheet'] = "standard") . "css")) {
            echo "STYLESHEET IS MISSING!";
        }
    }
    echo "</title>\n<meta http-equiv=\"Content-Type\" content=\"text/html;charset=" . BD_CHARSET_HTML . "\">\n<meta name=\"robots\" content=\"noindex\">\n<meta name=\"robots\" content=\"nofollow\">\n<link href=\"images/favicon.png\" type=\"image/png\" rel=\"icon\">\n<link rel=\"stylesheet\" href=\"" . PMBP_STYLESHEET_DIR . $CONF['stylesheet'] . ".css\" type=\"text/css\">\n";
    readfile(PMBP_JAVASCRIPTS);
    // define menue
    $menu = array("index.php" => F_START, "config.php" => F_CONFIG, "import.php" => F_IMPORT, "backup.php" => F_BACKUP, "scheduled.php" => F_SCHEDULE, "db_info.php" => F_DB_INFO);
    // disable sql queries in mu mode if allow_sql_queries is false
    if ($_SESSION['multi_user_mode'] && $PMBP_MU_CONF['allow_sql_queries'] || !$_SESSION['multi_user_mode']) {
        $menu = array_merge($menu, array("sql_query.php" => F_SQL_QUERY));
    }
    $accesskeys = array("index.php" => "m", "config.php" => "c", "import.php" => "i", "backup.php" => "b", "scheduled.php" => "s", "db_info.php" => "d", "sql_query.php" => "q", "logout" => "l", "help" => "h");
    $simple_width = 130;
    $width = count($menu) * $simple_width;
    echo "</head>\n\n<body>\n<table width=\"" . $width . "\">\n <colgroup>\n  <col span=\"" . count($menu) . "\" width=\"" . $simple_width . "\">\n </colgroup>\n <tr>\n  <th colspan=\"" . count($menu) . "\" class=\"active\" id=\"menu\">\n";
    // print titel
    echo "<div id=\"logo\">\n";
    echo PMBP_image_tag("logo.png", "phpMyBackupPro", "phpMyBackupPro Homepage", PMBP_WEBSITE);
    echo "&nbsp;&nbsp;" . PMBP_VERSION . "\n";
    echo "</div>\n<div id=\"help\">\n";
    // generate popup link for proper help file
    if (!file_exists("./" . PMBP_LANGUAGE_DIR . $CONF['lang'] . "_help.php")) {
        echo PMBP_pop_up("./" . PMBP_LANGUAGE_DIR . "english_help.php?script=" . $scriptname, PMBP_image_tag("help.gif", "", "help") . F_HELP, "help", "help");
    } else {
        echo PMBP_pop_up("./" . PMBP_LANGUAGE_DIR . $CONF['lang'] . "_help.php?script=" . $scriptname, PMBP_image_tag("help.gif", "", "help") . F_HELP, "help", "help");
    }
    echo "\n</div>\n<div id=\"logout\">\n";
    // print logout link if function is not disabled
    if (!($CONF['no_login'] == "1" && $CONF['login'] == "0")) {
        echo "<a href=\"login.php?logout=TRUE\" accesskey=\"l\" title=\"[access key = l]\">";
        echo PMBP_image_tag("login.gif", "", "[access key = l]");
        echo F_LOGOUT . "</a>\n";
    }
    echo "\n</div>\n";
    echo "  </th>\n";
    // print selection for several sql servers
    if (count($CONF['sql_passwd_s']) && basename($_SERVER['SCRIPT_NAME']) !== "config.php" && !isset($_POST['period'])) {
        echo " </tr>\n <tr>\n  <th colspan=\"" . count($menu) . "\">\n  <form action=\"" . basename($_SERVER['SCRIPT_NAME']) . "\" method=\"POST\">\n  <span class=\"bold_left\">Select working SQL server:</span>\n  <select name=\"mysql_host\" onchange=\"submit()\">\n";
        if ($CONF['sql_host'] == $_SESSION['sql_host_org'] && $CONF['sql_user'] == $_SESSION['sql_user_org']) {
            echo "<option value=\"-1\" selected>" . $_SESSION['sql_host_org'] . " (" . $_SESSION['sql_user_org'] . ")</option>\n";
        } else {
            echo "<option value=\"-1\">" . $_SESSION['sql_host_org'] . " (" . $_SESSION['sql_user_org'] . ")</option>\n";
        }
        for ($i = 0; $i < count($CONF['sql_passwd_s']); $i++) {
            if (isset($CONF['sql_host_s'])) {
                if ($CONF['sql_host'] == $CONF['sql_host_s'][$i] && $CONF['sql_user'] == $CONF['sql_user_s'][$i]) {
                    echo "<option value=\"" . $i . "\" selected>" . $CONF['sql_host_s'][$i] . " (" . $CONF['sql_user_s'][$i] . ")</option>\n";
                } else {
                    echo "<option value=\"" . $i . "\">" . $CONF['sql_host_s'][$i] . " (" . $CONF['sql_user_s'][$i] . ")</option>\n";
                }
            } else {
                echo "<option value=\"" . $i . "\">" . $CONF['sql_host_s'][$i] . " (" . $CONF['sql_user_s'][$i] . ")</option>\n";
            }
        }
        echo "  </select></form>\n  </th>\n";
    }
    echo " </tr>\n <!-- MENU -->\n <tr>\n";
    // generate menu
    foreach ($menu as $filename => $title) {
        // print active link
        if ($filename == $scriptname && $filename != "login.php?logout=TRUE" && $filename != "HELP") {
            echo "  <th class=\"active\">\n   <a href=\"" . $filename . "\" accesskey=\"" . $accesskeys[$filename] . "\" title=\"[access key = " . $accesskeys[$filename] . "]\">" . PMBP_image_tag(substr($filename, 0, strpos($filename, ".")) . ".gif", "", "[accesskey = " . $accesskeys[$filename] . "]") . $title . "</a>\n  </th>\n";
            // print lasting menu
        } elseif ($filename != "login.php?logout=TRUE" && $filename != "HELP") {
            echo "  <th>\n   <a href=\"" . $filename . "\" accesskey=\"" . $accesskeys[$filename] . "\" title=\"[access key = " . $accesskeys[$filename] . "]\">" . PMBP_image_tag(substr($filename, 0, strpos($filename, ".")) . ".gif", "", "[accesskey = " . $accesskeys[$filename] . "]") . $title . "</a>\n  </th>\n";
        }
    }
    echo " </tr>\n</table>\n<table width=\"" . $width . "\">\n <colgroup>\n  <col width=\"20\">\n  <col width=\"*\">\n  <col width=\"20\">\n </colgroup>\n <tr>\n  <td>\n    &nbsp;\n  </td>\n  <td class=\"main\">\n<!-- HEADER END -->\n";
}
コード例 #2
0
ファイル: db_info.php プロジェクト: HadoDokis/knomos-plus
     mysql_select_db($db_name, $con);
     $num_tables = $num_rows = $data_size = 0;
     // get number of rows and size of tables
     $stati = mysql_query("show table status", $con);
     while ($status = @mysql_fetch_array($stati)) {
         $data_size += $status['Data_length'] + $status['Index_length'];
         $num_rows += $status['Rows'];
     }
     $size = PMBP_size_type($data_size);
     // get number of tables
     $num_tables = mysql_affected_rows($con);
     // first field for the db name
     echo "<tr " . PMBP_change_color("#FFFFFF", "#000000") . ">";
     echo "\n<th class=\"active\">\n" . $db_name;
     if ($num_tables > 0) {
         echo "<span class=\"standard\">" . PMBP_pop_up("db_info.php?table=" . $db_name, " [" . DB_TABLES . "]", "view") . "</span>";
     } elseif ($num_tables < 0) {
         $num_tables = "<span class=\"red\">" . C_WRONG_DB . "</span>";
     }
     echo "\n</th>\n";
     echo "<td class=\"list\">" . $num_tables . "</td>\n";
     echo "<td class=\"list\">" . $num_rows . "</td>\n";
     echo "<td class=\"list\">" . $size['value'] . " " . $size['type'] . "</td>\n";
 }
 // show execution duration
 if (function_exists("microtime")) {
     $microtime = explode(" ", microtime());
     $endtime = $microtime[0] + $microtime[1];
 } else {
     $endtime = time();
 }
コード例 #3
0
ファイル: scheduled.php プロジェクト: wilderguzman/lugrawibe
        if (PMBP_save_to_file($_POST['path'] . $_POST['filename'], "", $result, "w")) {
            echo PMBP_addOutput(EX_SAVED . " " . $_POST['path'] . $_POST['filename'], "green_left");
            @chmod($_POST['path'] . $_POST['filename'], 0644);
            // save specific settings for scheduled backups
            if ($PMBP_SYS_VAR['EXS_scheduled_file'] != $_POST['filename']) {
                $PMBP_SYS_VAR['EXS_scheduled_file'] = $_POST['filename'];
            }
        } else {
            echo PMBP_addOutput(C_WRITE . " " . $_POST['path'] . $_POST['filename'], "red_left");
        }
    }
    echo PMBP_EXS_SAVE . ":<br>\n";
    echo $_POST['path'] . "<input type=\"text\" name=\"filename\" value=\"" . $PMBP_SYS_VAR['EXS_scheduled_file'] . "\">&nbsp;";
    echo "<input type=\"submit\" value=\"" . C_SAVE . "\">";
    if ($PMBP_SYS_VAR['EXS_scheduled_file'] != "???.php") {
        echo " (<a href=\"\">" . PMBP_pop_up("get_file.php?view=" . $_POST['path'] . $PMBP_SYS_VAR['EXS_scheduled_file'], B_VIEW, "view") . "</a>)";
    }
    echo "</form>";
    echo "\n<a href=\"scheduled.php\"> <- " . EXS_BACK . "</a>\n";
    // update specific settings for scheduled backups
    if ($_POST['path'] != $PMBP_SYS_VAR['EXS_scheduled_dir'] or $_POST['period'] != $PMBP_SYS_VAR['EXS_period']) {
        $PMBP_SYS_VAR['EXS_scheduled_dir'] = $_POST['path'];
        $PMBP_SYS_VAR['EXS_period'] = $_POST['period'];
    }
    // save PMBP_SYS_VARS
    PMBP_save_export_settings();
    // print instructions and export form
} else {
    if (isset($selection_ok) && isset($_POST['period'])) {
        echo PMBP_addOutput(EX_NO_DB . "!", "red");
    }
コード例 #4
0
ファイル: import.php プロジェクト: wilderguzman/lugrawibe
     // 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";
     }
     echo "<td class=\"list\">" . PMBP_confirm(B_CONF_DEL, "import.php?del=" . $filename, B_DELETE) . "</td>\n</tr>\n";
 }
 // print delete ALL backups and empty ALL dbs links if backup files are available
 $size_sum = PMBP_size_type($size_sum);