Ignore:
Timestamp:
Jan 9, 2014, 7:55:29 PM (10 years ago)
Author:
mistic100
Message:

update for 2.6

File:
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/oAuth/maintain.inc.php

    r20293 r26556  
    22defined('PHPWG_ROOT_PATH') or die('Hacking attempt!');
    33
    4 defined('OAUTH_ID') or define('OAUTH_ID', basename(dirname(__FILE__)));
    5 include_once(PHPWG_PLUGINS_PATH . OAUTH_ID . '/include/install.inc.php');
     4class 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    );
    614
     15  function install($plugin_version, &$errors=array())
     16  {
     17    global $conf;
    718
    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    }
    1330
     31    $this->installed = true;
     32  }
    1433
    15 function plugin_activate()
    16 {
    17   if (!defined('oauth_installed'))
     34  function activate($plugin_version, &$errors=array())
    1835  {
    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');
    2053  }
    2154}
    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.