-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathajax.php
More file actions
69 lines (54 loc) · 1.75 KB
/
ajax.php
File metadata and controls
69 lines (54 loc) · 1.75 KB
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
<?php
/*
* Version: 1.0, 31.05.2012
* by Adam Wysocki, goldpaid777@gmail.com
*
* Copyright (c) 2012 Adam Wysocki
*
* This is simply JS -> PHP connector
*
*/
// Report simple running errors except notices
error_reporting(E_ERROR | E_WARNING | E_PARSE);
// Set headers if u need more functionality CORS
header("Access-Control-Allow-Origin: *");
header('Access-Control-Allow-Credentials: true');
header('Access-Control-Allow-Methods: GET, POST, PUT, DELETE, OPTIONS');
//header('Access-Control-Max-Age: 604800');
header('Access-Control-Allow-Headers: x-requested-with');
// Some xampp fixing :/
$_GET['o'] = isset($_GET['o']) ? $_GET['o'] : '';
$_GET['c'] = isset($_GET['c']) ? $_GET['c'] : '';
// Is it required??
if(!preg_match("/^[a-zA-Z0-9_.]+$/i",$_GET['c'])) exit;
// Secure var
$home=true;
// Lets start session handling
session_start();
// Configuration varibles & langs
require_once('config.php');
// Require core class functions
require_once('class/core.class.php');
// Require connector class but not core again...
if($_GET['c']!='core') require_once('class/'.$_GET['c'].'.class.php');
// Require connector ajax and let it works with connector class
require_once('ajax/'.$_GET['c'].'.php');
/*
1. Switcher which define incall function by parametr o
Example:
once.php?c=once.explorer&o=get_project&id=1
once.php?
c => connector file class
o => connector ajax command
id => other parms can be send same way $_GET or $_POST
2. Setting data is defined in core.class
Example:
$once->set_data(array(
"project_name" => $once->filter_string($_GET['name'])
));
3. After initializing, we can call functions
Example:
$once->new_project();
Varibles: data['project_id'], data['project_name'] data['project_path'] are defined in core constructor
*/
?>