-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplugin.php
More file actions
executable file
·47 lines (41 loc) · 1.12 KB
/
plugin.php
File metadata and controls
executable file
·47 lines (41 loc) · 1.12 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
<?php
session_start();
require_once 'core/lib/ajs.lib.php';
require_once 'core/lib/jdb.lib.php';
require_once 'core/lib/pu.lib.php';
$echo = new AJS;
$db = new JDB;
$_POST = json_decode(file_get_contents('php://input'),true);
if(isset($_SESSION['admin'])) {
//Admin features
if(isset($_GET['admin']) AND file_exists("plugins/".str_replace(['/', '.', ':', '$'], "", $_GET['admin'])."/admin.php")) {
$admin = 1;
include("plugins/".str_replace(['/', '.', ':', '$'], "", $_GET['admin'])."/admin.php");
exit;
}
if(isset($_GET['list'])) {
$plugs = glob("plugins/*",GLOB_ONLYDIR);
$r = [];
foreach($plugs as $dir) {
if(file_exists($dir."/plugin.json")) {
$g = file_get_contents($dir."/plugin.json");
if($g) {
$r[] = json_decode($g);
if(!file_exists($dir."/installed")) {
include($dir."/install.php");
}
}
}
}
$echo->data($r);
exit;
}
}
else
{
//User features
if(isset($_GET['module']) AND file_exists("plugins/".str_replace(['/', '.', ':', '$'], "", $_GET['module'])."/module.php")) {
include("plugins/".str_replace(['/', '.', ':', '$'], "", $_GET['module'])."/module.php");
exit;
}
}