Line | |
---|
1 | <?php |
---|
2 | defined('PHPWG_ROOT_PATH') or die('Hacking attempt!'); |
---|
3 | |
---|
4 | class oAuth_maintain extends PluginMaintain |
---|
5 | { |
---|
6 | private $installed = false; |
---|
7 | |
---|
8 | private $default_conf = array( |
---|
9 | 'display_menubar' => true, |
---|
10 | 'display_register' => true, |
---|
11 | 'identification_icon' => '38px', |
---|
12 | 'menubar_icon' => '26px', |
---|
13 | ); |
---|
14 | |
---|
15 | function install($plugin_version, &$errors=array()) |
---|
16 | { |
---|
17 | global $conf; |
---|
18 | |
---|
19 | if (empty($conf['oauth'])) |
---|
20 | { |
---|
21 | $conf['oauth'] = serialize($this->default_conf); |
---|
22 | conf_update_param('oauth', $conf['oauth']); |
---|
23 | } |
---|
24 | |
---|
25 | $result = pwg_query('SHOW COLUMNS FROM `' . USERS_TABLE . '` LIKE "oauth_id";'); |
---|
26 | if (!pwg_db_num_rows($result)) |
---|
27 | { |
---|
28 | pwg_query('ALTER TABLE `' . USERS_TABLE . '` ADD `oauth_id` VARCHAR(255) DEFAULT NULL;'); |
---|
29 | } |
---|
30 | |
---|
31 | $this->installed = true; |
---|
32 | } |
---|
33 | |
---|
34 | function activate($plugin_version, &$errors=array()) |
---|
35 | { |
---|
36 | if (!$this->installed) |
---|
37 | { |
---|
38 | $this->install($plugin_version, $errors); |
---|
39 | } |
---|
40 | } |
---|
41 | |
---|
42 | function deactivate() |
---|
43 | { |
---|
44 | } |
---|
45 | |
---|
46 | function uninstall() |
---|
47 | { |
---|
48 | conf_delete_param('oauth'); |
---|
49 | |
---|
50 | pwg_query('ALTER TABLE `'. USERS_TABLE .'` DROP `oauth_id`;'); |
---|
51 | |
---|
52 | @unlink(PHPWG_PLUGINS_PATH . PWG_LOCAL_DIR . 'config/hybridauth.inc.php'); |
---|
53 | } |
---|
54 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.