2 /************************************************************************
3 * Mailer v0.2.1-FINAL Start: 09/17/2011 *
4 * =================== Last change: 09/17/2011 *
6 * -------------------------------------------------------------------- *
8 * -------------------------------------------------------------------- *
9 * Short description : AJAX backend script *
10 * -------------------------------------------------------------------- *
11 * Kurzbeschreibung : AJAX-Abfragescript *
12 * -------------------------------------------------------------------- *
13 * Copyright (c) 2003 - 2009 by Roland Haeder *
14 * Copyright (c) 2009 - 2016 by Mailer Developer Team *
15 * For more information visit: http://mxchange.org *
17 * This program is free software; you can redistribute it and/or modify *
18 * it under the terms of the GNU General Public License as published by *
19 * the Free Software Foundation; either version 2 of the License, or *
20 * (at your option) any later version. *
22 * This program is distributed in the hope that it will be useful, *
23 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
24 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
25 * GNU General Public License for more details. *
27 * You should have received a copy of the GNU General Public License *
28 * along with this program; if not, write to the Free Software *
29 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, *
31 ************************************************************************/
34 //* DEBUG: */ xdebug_start_trace();
36 // Load security system
37 require('inc/libs/security_functions.php');
40 $GLOBALS['__start_time'] = microtime(TRUE);
43 * Set output to "AJAX mode", proper module and prevent HTML headers/footers
46 $GLOBALS['__output_mode'] = -2;
47 $GLOBALS['__module'] = 'ajax';
48 $GLOBALS['__header_sent'] = 2;
49 $GLOBALS['__footer_sent'] = 2;
51 // Initialize application
52 require('inc/init.php');
54 // Load special AJAX library
55 loadIncludeOnce('inc/ajax-functions.php');
57 // Init AJAX request (including HTTP status code)
63 // Process only POST requests and that at least 'level' is set
64 if ((getHttpRequestMethod() == 'POST') && (isPostRequestElementSet('level'))) {
65 // Okay, that is valid, now check that the requested level right is valid
66 if (isValidAjaxRequestLevel()) {
67 // Process the request
70 // Is there an error which is not fine?
71 if (!isAjaxHttpStatusAccepted()) {
72 // The process was handled but didn't work
73 reportBug(__FUNCTION__, __LINE__, 'AJAX request level=' . isPostRequestElementSet('level') . ',status=' . getHttpStatus() . ',callback[' . gettype($GLOBALS['ajax_callback_function']) . ']=' . $GLOBALS['ajax_callback_function'] . ' is valid but does not do anything.');
77 setHttpStatus('403 Forbidden');