test
This commit is contained in:
17
index.php
17
index.php
@@ -67,9 +67,20 @@ if ($action === 'login') {
|
||||
|
||||
$view_file = 'views/' . basename($action) . '.php';
|
||||
if (file_exists($view_file)) {
|
||||
include 'views/layout_top.php';
|
||||
include $view_file;
|
||||
include 'views/layout_bottom.php';
|
||||
// AJAX-only POST requests must not have the HTML layout wrapped around them,
|
||||
// otherwise the JSON response gets embedded inside the HTML document and
|
||||
// JSON.parse() fails on the client side.
|
||||
$is_ajax_post = isset($_POST['ajax_submit'])
|
||||
|| isset($_POST['delete_attachment_ajax'])
|
||||
|| isset($_POST['upload_attachment_ajax']);
|
||||
|
||||
if ($is_ajax_post) {
|
||||
include $view_file; // view handles its own output + exit
|
||||
} else {
|
||||
include 'views/layout_top.php';
|
||||
include $view_file;
|
||||
include 'views/layout_bottom.php';
|
||||
}
|
||||
} else {
|
||||
echo "404 Not Found";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user