-
Notifications
You must be signed in to change notification settings - Fork 0
/
Routing.php
executable file
·153 lines (134 loc) · 4.23 KB
/
Routing.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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
<?php
include('RunQuery.php');
include('Cron.php');
Hook('FeedSync Fetch Service Done','SSParser();');
function SSParser(){
include('ParseFetches.php');
SSParseFetches();
include('FillInMissingAvg14AtOpen.php');
FillInMissingAvg14AtOpen();
include('FillInMissingAvg14AtOpen.php');
FillInMissingAvg14AtOpen();
}
Hook('Template Head','SecuritiesScienceTemplateHead();');
function SecuritiesScienceTemplateHead(){
?>
<link rel="stylesheet" href="/plugins/securities.science/style.css">
<?php
}
Hook('User Is Not Logged In - Before Presentation','PublicPageBefore();');
function PublicPageBefore(){
Nav('main-not-logged-in','link','Login','/login');
}
Hook('User Is Not Logged In - Presentation','PublicPage();');
function PublicPage(){
switch(path(0)){
case 'json':
ReadOnlyQueryJSON(path(1));
case 'run-query':
global $ThisQuery;
$ThisQuery = Query("SELECT QueryID,Name,Description,ParserLastOutput,Code FROM Query WHERE QueryID = ".intval(path(1)));
if(isset($ThisQuery[0])){
$Title=$ThisQuery[0]['Name'];
}else{
$ThisQuery='Query Not Found';
}
TemplateBootstrap4($Title,'RunQueryBodyCallback();',true);
break;
case false:
case 'explore':
include('PublicExplore.php');
TemplateBootstrap4('Explore','PublicExploreBodyCallback();');
break;
case 'explore-table':
include('ExploreTable.php');
TemplateBootstrap4('Table Explorer','ExploreTableBodyCallback();');
break;
//default:
case 'login':
PromptForLogin();
break;
}
}
Hook('User Is Logged In - Before Presentation','UserPageBefore();');
function UserPageBefore(){
include_once('ShowSecuritiesScienceScraperStats.php');
//Hook('Architect Homepage','ShowSecuritiesScienceScraperStats();');
Nav('main-logged-in','link','Explore','/explore');
}
Hook('User Is Logged In - Presentation','UserPage();');
function UserPage(){
global $ASTRIA;
switch(path(0)){
case 'fillinmissingmetrics':
include('FillInMissingOpenGaps.php');
FillInMissingOpenGaps();
include('FillInMissingAvg14AtOpen.php');
FillInMissingAvg14AtOpen();
die('ok');
case 'security':
include('Security.php');
$Title='Security';
if(!(path(1)==false)){
$Symbol = mysqli_real_escape_string($ASTRIA['databases']['astria']['resource'],path(1));
$Symbol=strtoupper($Symbol);
$Symbol=Query("SELECT Symbol FROM Security WHERE Symbol LIKE '".$Symbol."'");
if(isset($Symbol[0])){
$Title=$Symbol[0]['Symbol'];
}
}
TemplateBootstrap4($Title,'SecurityBodyCallback();',true);
break;
case 'explore-table':
include('ExploreTable.php');
TemplateBootstrap4('Table Explorer','ExploreTableBodyCallback();');
break;
case 'run-query':
global $ThisQuery;
$ThisQuery = Query("SELECT QueryID,Name,Description,ParserLastOutput,Code FROM Query WHERE QueryID = ".intval(path(1)));
if(isset($ThisQuery[0])){
$Title=$ThisQuery[0]['Name'];
}else{
$ThisQuery='Query Not Found';
}
TemplateBootstrap4($Title,'RunQueryBodyCallback();',true);
break;
case 'create-query':
include('UserCreateQuery.php');
if(isset($_POST['name'])){
UserCreateQueryPostHandler();
}else{
TemplateBootstrap4('Create Query','UserCreateQueryBodyCallback();');
}
break;
case 'edit-query':
include('UserEditQuery.php');
if(isset($_POST['QueryID'])){
UserEditQueryPostHandler();
}else{
TemplateBootstrap4('Edit Query','UserEditQueryBodyCallback();');
}
break;
case 'test':
include('ParseFetches.php');
SSParseFetchesRobinhood();
exit;
case 'delete-query':
include('UserDeleteQuery.php');
UserDeleteQueryHandler();
break;
case 'undelete-query':
include('UserUndeleteQuery.php');
UserUndeleteQueryHandler();
break;
case false:
include('UserHomepage.php');
TemplateBootstrap4('Home','UserHomepageBodyCallback();');
break;
case 'explore':
include('PublicExplore.php');
include('UserExplore.php');
TemplateBootstrap4('Explore','UserExploreBodyCallback();');
break;
}
}