Changeset 26556 for extensions/oAuth/maintain.inc.php
- Timestamp:
- Jan 9, 2014, 7:55:29 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/oAuth/maintain.inc.php
r20293 r26556 2 2 defined('PHPWG_ROOT_PATH') or die('Hacking attempt!'); 3 3 4 defined('OAUTH_ID') or define('OAUTH_ID', basename(dirname(__FILE__))); 5 include_once(PHPWG_PLUGINS_PATH . OAUTH_ID . '/include/install.inc.php'); 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 ); 6 14 15 function install($plugin_version, &$errors=array()) 16 { 17 global $conf; 7 18 8 function plugin_install() 9 { 10 oauth_install(); 11 define('oauth_installed', true); 12 } 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 } 13 30 31 $this->installed = true; 32 } 14 33 15 function plugin_activate() 16 { 17 if (!defined('oauth_installed')) 34 function activate($plugin_version, &$errors=array()) 18 35 { 19 oauth_install(); 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'); 20 53 } 21 54 } 22 23 function plugin_uninstall()24 {25 pwg_query('DELETE FROM `'. CONFIG_TABLE .'` WHERE param = "oauth" LIMIT 1;');26 pwg_query('ALTER TABLE `'. USERS_TABLE .'` DROP `oauth_id`;');27 @unlink(PHPWG_PLUGINS_PATH . PWG_LOCAL_DIR . 'config/hybridauth.inc.php');28 }29 30 ?>
Note: See TracChangeset
for help on using the changeset viewer.