-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.php
52 lines (41 loc) · 1.89 KB
/
install.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
<?php
require_once("init.php");
//For security purposes, it is MANDATORY that this page be wrapped in the following
//if statement. This prevents remote execution of this code.
if (in_array($user->data()->id, $master_account)){
$db = DB::getInstance();
include "plugin_info.php";
//all actions should be performed here.
$check = $db->query("SELECT * FROM us_plugins WHERE plugin = ?",array($plugin_name))->count();
if($check > 0){
err($plugin_name.' has already been installed!');
}else{
$db->query("ALTER TABLE settings ADD COLUMN plg_sez_sezlogin tinyint(1) DEFAULT 0");
$db->query("ALTER TABLE settings ADD COLUMN plg_sez_sezid varchar(255) NOT NULL");
$db->query("ALTER TABLE settings ADD COLUMN plg_sez_sezsecret varchar(255) NOT NULL");
$db->query("ALTER TABLE settings ADD COLUMN plg_sez_sezcallback varchar(255) NOT NULL");
$db->query("ALTER TABLE settings ADD COLUMN plg_sez_sezfinalredir varchar(255) NOT NULL");
$db->query("ALTER TABLE users ADD COLUMN plg_sez_uid varchar(255) NULL");
$fields = array(
'plugin'=>$plugin_name,
'status'=>'installed',
);
$db->insert('us_plugins',$fields);
if(!$db->error()) {
err($plugin_name.' installed');
logger($user->data()->id,"USPlugins",$plugin_name." installed");
} else {
err($plugin_name.' was not installed');
logger($user->data()->id,"USPlugins","Failed to to install plugin, Error: ".$db->errorString());
}
}
//do you want to inject your plugin in the middle of core UserSpice pages?
$hooks = [];
//The format is $hooks['userspicepage.php']['position'] = path to filename to include
//Note you can include the same filename on multiple pages if that makes sense;
//postion options are post,body,form,bottom
//See documentation for more information
$hooks['login.php']['body'] = 'hooks/loginbody.php';
$hooks['join.php']['body'] = 'hooks/loginbody.php';
registerHooks($hooks,$plugin_name);
} //do not perform actions outside of this statement