-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
43 lines (27 loc) · 1005 Bytes
/
index.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<?php
header('Content-Type: text/html; charset=utf-8');
require_once ('./includes/initialize.php');
function __autoload($class_name) {
if ($class_name != 'DbSimple_Mysqli' && $class_name != 'Smarty') {
require_once CLASS_PATH . '/' . $class_name . '.php';
}
}
//AJAX. With ajax queries there is no display with smarty
//controller role - isPost isGet
if (request_is_post()) {
//submitting unchecked checkboxes
if (!isset($_POST['allow_mails'])) {
$_POST['allow_mails'] = "";
} else {
$_POST['allow_mails'] = 1;
}
$ajax_result = Ad::handlePostQuery(AdsStorage::sanitizeHTTPQueriesData($_POST));
echo json_encode($ajax_result, JSON_NUMERIC_CHECK);
} elseif (isset($_GET['id']) && isset($_GET['mode'])) {
$ajax_result = Ad::handleGetQuery(AdsStorage::sanitizeHTTPQueriesData($_GET));
echo json_encode($ajax_result, JSON_NUMERIC_CHECK);
} else {
/*@var $storage AdsStorage*/
$storage = AdsStorage::getInstance($smarty);
$storage->fillStorage()->display();
}