Example #1
0
/** Print HTML header
* @param string used in title, breadcrumb and heading, should be HTML escaped
* @param string
* @param mixed array("key" => "link", "key2" => array("link", "desc")), null for nothing, false for driver only, true for driver and server
* @param string used after colon in title and heading, should be HTML escaped
* @return null
*/
function page_header($title, $error = "", $breadcrumb = array(), $title2 = "")
{
    global $LANG, $VERSION, $adminer, $drivers, $jush;
    page_headers();
    if (is_ajax() && $error) {
        page_messages($error);
        exit;
    }
    $title_all = $title . ($title2 != "" ? ": {$title2}" : "");
    $title_page = strip_tags($title_all . (SERVER != "" && SERVER != "localhost" ? h(" - " . SERVER) : "") . " - " . $adminer->name());
    ?>
<!DOCTYPE html>
<html lang="<?php 
    echo $LANG;
    ?>
" dir="<?php 
    echo lang('ltr');
    ?>
">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta http-equiv="Content-Script-Type" content="text/javascript">
<meta name="robots" content="noindex">
<meta name="referrer" content="origin-when-crossorigin">
<title><?php 
    echo $title_page;
    ?>
</title>

	<!-- Latest compiled and minified CSS -->
	<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" integrity="sha512-dTfge/zgoMYpP7QbHy4gWMEGsbsdZeCXz7irItjcC3sPUFtf0kuFbDz/ixG7ArTxmDjLXDmezHubeNikyKGVyQ==" crossorigin="anonymous">

	<!-- Optional theme -->
	<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap-theme.min.css" integrity="sha384-aUGj/X2zp5rLCbBxumKTCw2Z50WgIr1vs/PFN4praOTvYXWlVyh2UtNUU0KAUhAX" crossorigin="anonymous">

    <!-- Custom Fonts -->
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css">

<link rel="stylesheet" type="text/css" href="../adminer/static/default.css">
<script type="text/javascript" src="../adminer/static/functions.js"></script>
<script type="text/javascript" src="static/editing.js"></script>
<?php 
    if ($adminer->head()) {
        ?>
<link rel="shortcut icon" type="image/x-icon" href="../adminer/static/favicon.ico">
<link rel="apple-touch-icon" href="../adminer/static/favicon.ico">
<?php 
        if (file_exists("adminer.css")) {
            ?>
<link rel="stylesheet" type="text/css" href="adminer.cssBORRAME">
<?php 
        }
    }
    ?>

<body class="<?php 
    echo lang('ltr');
    ?>
 nojs" onkeydown="bodyKeydown(event);" onclick="bodyClick(event);"<?php 
    echo isset($_COOKIE["adminer_version"]) ? "" : " onload=\"verifyVersion('{$VERSION}');\"";
    ?>
>




<script type="text/javascript">
document.body.className = document.body.className.replace(/ nojs/, ' js');
var offlineMessage = '<?php 
    echo js_escape(lang('You are offline.'));
    ?>
';
</script>

<div id="help" class="jush-<?php 
    echo $jush;
    ?>
 jsonly hidden" onmouseover="helpOpen = 1;" onmouseout="helpMouseout(this, event);"></div>

<div id="content">
<?php 
    if ($breadcrumb !== null) {
        $link = substr(preg_replace('~\\b(username|db|ns)=[^&]*&~', '', ME), 0, -1);
        echo '<p id="breadcrumb"><a href="' . h($link ? $link : ".") . '">' . $drivers[DRIVER] . '</a> &raquo; ';
        $link = substr(preg_replace('~\\b(db|ns)=[^&]*&~', '', ME), 0, -1);
        $server = SERVER != "" ? h(SERVER) : lang('Server');
        if ($breadcrumb === false) {
            echo "{$server}\n";
        } else {
            echo "<a href='" . ($link ? h($link) : ".") . "' accesskey='1' title='Alt+Shift+1'>{$server}</a> &raquo; ";
            if ($_GET["ns"] != "" || DB != "" && is_array($breadcrumb)) {
                echo '<a href="' . h($link . "&db=" . urlencode(DB) . (support("scheme") ? "&ns=" : "")) . '">' . h(DB) . '</a> &raquo; ';
            }
            if (is_array($breadcrumb)) {
                if ($_GET["ns"] != "") {
                    echo '<a href="' . h(substr(ME, 0, -1)) . '">' . h($_GET["ns"]) . '</a> &raquo; ';
                }
                foreach ($breadcrumb as $key => $val) {
                    $desc = is_array($val) ? $val[1] : h($val);
                    if ($desc != "") {
                        echo "<a href='" . h(ME . "{$key}=") . urlencode(is_array($val) ? $val[0] : $val) . "'>{$desc}</a> &raquo; ";
                    }
                }
            }
            echo "{$title}\n";
        }
    }
    echo "\n\t\t<div class='well well-sm'>\n\t\t\t{$title_all}\n\t\t</div>\n";
    echo "<div id='ajaxstatus' class='jsonly hidden'></div>\n";
    restart_session();
    page_messages($error);
    $databases =& get_session("dbs");
    if (DB != "" && $databases && !in_array(DB, $databases, true)) {
        $databases = null;
    }
    stop_session();
    define("PAGE_HEADER", 1);
}
Example #2
0
        queries_adminer_redirect($location, lang('Item has been deleted.'), $driver->delete($TABLE, $query_where, !$unique_array));
    } else {
        $set = array();
        foreach ($fields as $name => $field) {
            $val = process_input($field);
            if ($val !== false && $val !== null) {
                $set[idf_escape($name)] = $val;
            }
        }
        if ($update) {
            if (!$set) {
                adminer_redirect($location);
            }
            queries_adminer_redirect($location, lang('Item has been updated.'), $driver->update($TABLE, $set, $query_where, !$unique_array));
            if (is_adminer_ajax()) {
                page_headers();
                page_messages($error);
                exit;
            }
        } else {
            $result = $driver->insert($TABLE, $set);
            $last_id = $result ? last_id() : 0;
            queries_adminer_redirect($location, lang('Item%s has been inserted.', $last_id ? " {$last_id}" : ""), $result);
            //! link
        }
    }
}
$row = null;
if ($_POST["save"]) {
    $row = (array) $_POST["fields"];
} elseif ($where) {
Example #3
0
/** Print HTML header
* @param string used in title, breadcrumb and heading, should be HTML escaped
* @param string
* @param mixed array("key" => "link", "key2" => array("link", "desc")), null for nothing, false for driver only, true for driver and server
* @param string used after colon in title and heading, should be HTML escaped
* @return null
*/
function page_header($title, $error = "", $breadcrumb = array(), $title2 = "")
{
    global $LANG, $VERSION, $adminer, $drivers, $jush;
    page_headers();
    $title_all = $title . ($title2 != "" ? ": {$title2}" : "");
    $title_page = strip_tags($title_all . (SERVER != "" && SERVER != "localhost" ? h(" - " . SERVER) : "") . " - " . $adminer->name());
    ?>
<!DOCTYPE html>
<html lang="<?php 
    echo $LANG;
    ?>
" dir="<?php 
    echo lang('ltr');
    ?>
">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta http-equiv="Content-Script-Type" content="text/javascript">
<meta name="robots" content="noindex">
<title><?php 
    echo $title_page;
    ?>
</title>
<link rel="stylesheet" type="text/css" href="../adminer/static/default.css">
<script type="text/javascript" src="../adminer/static/functions.js"></script>
<script type="text/javascript" src="static/editing.js"></script>
<?php 
    if ($adminer->head()) {
        ?>
<link rel="shortcut icon" type="image/x-icon" href="../adminer/static/favicon.ico">
<link rel="apple-touch-icon" href="../adminer/static/favicon.ico">
<?php 
        if (file_exists("adminer.css")) {
            ?>
<link rel="stylesheet" type="text/css" href="adminer.css">
<?php 
        }
    }
    ?>

<body class="<?php 
    echo lang('ltr');
    ?>
 nojs" onkeydown="bodyKeydown(event);" onclick="bodyClick(event);">
<script type="text/javascript">
document.body.className = document.body.className.replace(/ nojs/, ' js');
</script>

<div id="help" class="jush-<?php 
    echo $jush;
    ?>
 jsonly hidden" onmouseover="helpOpen = 1;" onmouseout="helpMouseout(this, event);"></div>

<div id="content">
<?php 
    if ($breadcrumb !== null) {
        $link = substr(preg_replace('~\\b(username|db|ns)=[^&]*&~', '', ME), 0, -1);
        echo '<p id="breadcrumb"><a href="' . h($link ? $link : ".") . '">' . $drivers[DRIVER] . '</a> &raquo; ';
        $link = substr(preg_replace('~\\b(db|ns)=[^&]*&~', '', ME), 0, -1);
        $server = SERVER != "" ? h(SERVER) : lang('Server');
        if ($breadcrumb === false) {
            echo "{$server}\n";
        } else {
            echo "<a href='" . ($link ? h($link) : ".") . "' accesskey='1' title='Alt+Shift+1'>{$server}</a> &raquo; ";
            if ($_GET["ns"] != "" || DB != "" && is_array($breadcrumb)) {
                echo '<a href="' . h($link . "&db=" . urlencode(DB) . (support("scheme") ? "&ns=" : "")) . '">' . h(DB) . '</a> &raquo; ';
            }
            if (is_array($breadcrumb)) {
                if ($_GET["ns"] != "") {
                    echo '<a href="' . h(substr(ME, 0, -1)) . '">' . h($_GET["ns"]) . '</a> &raquo; ';
                }
                foreach ($breadcrumb as $key => $val) {
                    $desc = is_array($val) ? $val[1] : h($val);
                    if ($desc != "") {
                        echo "<a href='" . h(ME . "{$key}=") . urlencode(is_array($val) ? $val[0] : $val) . "'>{$desc}</a> &raquo; ";
                    }
                }
            }
            echo "{$title}\n";
        }
    }
    echo "<h2>{$title_all}</h2>\n";
    restart_session();
    page_messages($error);
    $databases =& get_session("dbs");
    if (DB != "" && $databases && !in_array(DB, $databases, true)) {
        $databases = null;
    }
    stop_session();
    define("PAGE_HEADER", 1);
}
Example #4
0
function page_out()
{
    global $page_title, $GUI;
    ob_start();
    $GUI->HTML();
    $text = ob_get_contents();
    ob_end_clean();
    print '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html><head>' . "\n";
    page_headers();
    print "<title>" . $page_title . "</title>\n</head>\n<body>\n" . $text . "</body>\n</html>";
}