-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathajax-internal.php
90 lines (75 loc) · 3.19 KB
/
ajax-internal.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
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
<?php
// There could in theory be a SECURITY RISK for this file in general, because anyone could create a request for it, and start doing various functions.
// the cross domain origin may stop it, but in theory they could change the object in the browser, so you really do need some type of
// security protocol here to make sure the obects arent messed with, or change the approach completely in general.
require_once $_SERVER['DOCUMENT_ROOT'] . '/config.php';
//require_once $_SERVER['DOCUMENT_ROOT'] . "/_classes/standards.class.php"; // this is causing an error when I include it!!!
require_once $_SERVER['DOCUMENT_ROOT'] . '/_functions/ck.functions.php'; // (includes standard.class.php) it would be nice if this could be a universal function we can pass stuff too, but not sure.
//require_once $_SERVER['DOCUMENT_ROOT'] . "/_classes/predictions/prediction-consensus.php"; // causes a failure when you add this in!!!!
include ROOT . "_classes/submitRecurringCoinInfo.class.php"; // used to submit the btc info.
$return = array(
'success' => TRUE,
'errors' => array()
);
switch ($_REQUEST['operation']){
case 'submitPrediction':
$return = $_REQUEST;
$construct = array(
'class' => 'submitPrediction',
'function' => $_REQUEST['function'],
'post' => $_POST);
$return = ckRouter($construct);
break;
// All of these are identical aside from the class it calls, and the function name but we have that.
// Essentially, you could completely 100% modularize this thing so only 1 is necessary.
case 'userLogin':
$customClass = new Custom();
$return = $customClass->customLogin($_REQUEST);
//$return = $_POST; // test
break;
case 'userForgotPassword':
$customClass = new Custom();
$return = $customClass->customForgotPasswordSend($_REQUEST);
break;
case 'userChangedPassword':
$customClass = new Custom();
$return = $customClass->customChangePassword($_POST);
break;
case 'userRegister':
$customClass = new Custom();
$return = $customClass->customRegister($_POST);
//$return = $_POST; // test
break;
// being used from a homepage widget, this will change over time. This is a simple starting example.
case 'getPredictions':
$Predictions = new Predictions();
$return = $Predictions->getPredictions($_REQUEST);
//$return = $_REQUEST; // test
break;
case 'getPredictionConsensus':
$PC = new PredictionConsensus();
$data = $PC->getPredictionConsensus();
$return = $data; // test
break;
case 'submitBTCData':
$return = $_POST; // test
$submitCoinInfo = new submitRecurringCoinInfo();
$return = $submitCoinInfo->submitBTC($_POST);
break;
case 'sendEmailWarning':
$emailClass = new Email();
//$return = $_POST['message'];
$emailClass->sendWarningToAdmin($_POST['message']);
break;
// case 'googleLogin':
// $GoogleLoginClass = new GoogleLogin();
// $return = $GoogleLoginClass->login($_POST);
// break;
}
// old construct the way you did it in AT.
/*'classFunction' => $_REQUEST['operation'],
'apiClassName' => $_REQUEST['apiClassName'],
'userID' => 1, // $_SESSION['userID'] when you get login working
'post' => $_POST*/
//echo json_encode($construct);
echo json_encode($return);