Changeset 26556


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

update for 2.6

Location:
extensions/oAuth
Files:
1 deleted
16 edited

Legend:

Unmodified
Added
Removed
  • extensions/oAuth/admin.php

    r21303 r26556  
    66if (!$conf['allow_user_registration'])
    77{
    8   array_push($page['warnings'], l10n('Users are not allowed to register on your gallery. OAuth will not work correctly.'));
     8  $page['warnings'][] = l10n('Users are not allowed to register on your gallery. OAuth will not work correctly.');
    99}
    1010
     
    3131// send page content
    3232$template->assign_var_from_handle('ADMIN_CONTENT', 'oauth_content');
    33 
    34 ?>
  • extensions/oAuth/admin/config.php

    r20323 r26556  
    11<?php
    22defined('OAUTH_PATH') or die('Hacking attempt!');
    3 
    43
    54if (isset($_POST['save_config']))
     
    1413   
    1514  conf_update_param('oauth', serialize($conf['oauth']));
    16   array_push($page['infos'], l10n('Information data registered in database'));
     15  $page['infos'][] = l10n('Information data registered in database');
    1716}
    1817
     
    2120// define template file
    2221$template->set_filename('oauth_content', realpath(OAUTH_PATH . 'admin/template/config.tpl'));
    23 
    24 ?>
  • extensions/oAuth/admin/providers.php

    r23808 r26556  
    1919        (!@$PROVIDERS_CONFIG[$id]['require_client_id'] and empty($data['keys']['key']))
    2020      ) {
    21         array_push($page['errors'], sprintf(l10n('%s: invalid keys'), $PROVIDERS_CONFIG[$id]['provider_name']));
     21        $page['errors'][] = l10n('%s: invalid keys', $PROVIDERS_CONFIG[$id]['provider_name']);
    2222      }
    2323    }
     
    2525    if ( ($id=='Wordpress' or $id=='Flickr' or $id=='Steam') and $data['enabled'] and !@$providers['OpenID']['enabled'] ) // in the template, OpenID must be before other OpenID based providers
    2626    {
    27       array_push($page['errors'], sprintf(l10n('OpenID must be enabled in order to use %s authentication'), $id));
     27      $page['errors'][] = l10n('OpenID must be enabled in order to use %s authentication', $id);
    2828    }
    2929   
     
    5252   
    5353    file_put_contents(OAUTH_CONFIG, $content);
    54     array_push($page['infos'], l10n('Information data registered in database'));
     54    $page['infos'][] = l10n('Information data registered in database');
    5555  }
    5656}
     
    6666// define template file
    6767$template->set_filename('oauth_content', realpath(OAUTH_PATH . 'admin/template/providers.tpl'));
    68 
    69 ?>
  • extensions/oAuth/admin/template/config.tpl

    r20620 r26556  
    1 {combine_css path=$OAUTH_PATH|cat:"admin/template/style.css"}
     1{combine_css path=$OAUTH_PATH|cat:'admin/template/style.css'}
    22{combine_css path=$OAUTH_PATH|cat:'template/oauth_sprites.css'}
    33
     
    1212      <label>
    1313        <input type="checkbox" name="display_menubar" {if $display_menubar}checked="checked"{/if}>
    14         <b>{'Display sign in buttons in the menubar'|@translate}</b>
     14        <b>{'Display sign in buttons in the menubar'|translate}</b>
    1515      </label>
    1616    </li>
     
    1919      <label>
    2020        <input type="checkbox" name="display_register" {if $display_register}checked="checked"{/if}>
    21         <b>{'Display sign in buttons on the register page'|@translate}</b>
     21        <b>{'Display sign in buttons on the register page'|translate}</b>
    2222      </label>
    2323    </li>
     
    2828  <ul>
    2929    <li>
    30       <b>{'Icon size on the identification page'|@translate} :</b><br>
     30      <b>{'Icon size on the identification page'|translate} :</b><br>
    3131      <label>
    3232        <input type="radio" name="identification_icon" value="16px" {if $identification_icon=='16px'}checked="checked"{/if}>
     
    5353   
    5454    <li>
    55       <b>{'Icon size in the menubar'|@translate} :</b><br>
     55      <b>{'Icon size in the menubar'|translate} :</b><br>
    5656      <label>
    5757        <input type="radio" name="menubar_icon" value="16px" {if $menubar_icon=='16px'}checked="checked"{/if}>
     
    7979</fieldset>
    8080
    81 <p style="text-align:left;"><input type="submit" name="save_config" value="{'Save Settings'|@translate}"></p>
     81<p style="text-align:left;"><input type="submit" name="save_config" value="{'Save Settings'|translate}"></p>
    8282</form>
    8383
  • extensions/oAuth/admin/template/providers.tpl

    r26555 r26556  
    1 {combine_css path=$OAUTH_PATH|cat:"admin/template/style.css"}
     1{combine_css path=$OAUTH_PATH|cat:'admin/template/style.css'}
    22{combine_css path=$OAUTH_PATH|cat:'template/oauth_sprites.css'}
    33
    4 {footer_script}{literal}
     4{footer_script}
    55jQuery("select.enable").change(function() {
    66  var $top = $(this).closest("div.provider");
     
    2020
    2121jQuery("#close_help").click(function() {
    22   jQuery("#help_container").animate({"margin-right": "-550px"}, 'fast');
     22  jQuery("#help_container").animate({ "margin-right": "-550px" }, 'fast');
    2323  return false;
    2424});
     
    3030  $("#help_container h5").html($top.find("h4").html());
    3131  $("#help_container div").html($top.find("div.help").html());
    32   $("#help_container").animate({"margin-right": "0px"}, 'fast');
     32  $("#help_container").animate({ "margin-right": "0px" }, 'fast');
    3333  return false;
    3434});
    35 {/literal}{/footer_script}
     35{/footer_script}
    3636
    3737
     
    4141
    4242<div id="help_container">
    43   <a href="#" id="close_help" title="{'Close'|@translate}">&times;</a>
     43  <a href="#" id="close_help" title="{'Close'|translate}">&times;</a>
    4444  <h5></h5>
    4545  <div></div>
     
    6060      <td>
    6161        <select name="providers[{$p}][enabled]" class="enable">
    62           <option value="true" {if $CONFIG[$p].enabled}selected="selected"{/if}>{'Enabled'|@translate}</option>
    63           <option value="false" {if not $CONFIG[$p].enabled}selected="selected"{/if}>{'Disabled'|@translate}</option>
     62          <option value="true" {if $CONFIG[$p].enabled}selected="selected"{/if}>{'Enabled'|translate}</option>
     63          <option value="false" {if not $CONFIG[$p].enabled}selected="selected"{/if}>{'Disabled'|translate}</option>
    6464        </select>
    65         <br><a href="#" class="open-help">{'Help'|@translate}</a>
     65        <br><a href="#" class="open-help">{'Help'|translate}</a>
    6666      </td>
    6767     
     
    8585    {if $provider.new_app_link}
    8686      <ol>
    87         <li>{'Go to <a href="%s" target="_blank">%s</a> and create a new application'|@translate|sprintf:$provider.new_app_link:$provider.new_app_link}</li>
     87        <li>{'Go to <a href="%s" target="_blank">%s</a> and create a new application'|translate|sprintf:$provider.new_app_link:$provider.new_app_link}</li>
    8888       
    8989      {if $p=='Google'}
    90         <li>{'On the <b>APIs & auth -> Credentials</b> tab, <b>Create new client ID</b>'|@translate}</li>
     90        <li>{'On the <b>APIs & auth -> Credentials</b> tab, <b>Create new client ID</b>'|translate}</li>
    9191      {else}
    92         <li>{'Fill out any required fields such as the application name and description'|@translate}</li>
     92        <li>{'Fill out any required fields such as the application name and description'|translate}</li>
    9393      {/if}
    9494       
     
    9696        <li>
    9797          {assign var=callback value=$OAUTH_CALLBACK|cat:$p}
    98           {'Provide this URL as the Callback/Redirect URL for your application: <em>%s</em>'|@translate|sprintf:$callback}
     98          {'Provide this URL as the Callback/Redirect URL for your application: <em>%s</em>'|translate|sprintf:$callback}
    9999        </li>
    100100      {/if}
    101101     
    102102      {if $p=='Live'}
    103         <li>{'Put your website domain in the %s fields. It should match with the current hostname: <em>%s</em>'|@translate|sprintf:'<b>Redirect Domain</b>':$SERVERNAME}</li>
     103        <li>{'Put your website domain in the %s fields. It should match with the current hostname: <em>%s</em>'|translate|sprintf:'<b>Redirect Domain</b>':$SERVERNAME}</li>
    104104      {elseif $p=='Facebook'}
    105105        <li>{'Go to <b>Settings->Advanced</b> and activate <em>Client OAuth Login</em>.'|translate}</li>
    106         <li>{'Put your website domain in the %s fields. It should match with the current hostname: <em>%s</em>'|@translate|sprintf:'<b>Valid OAuth redirect URIs</b>':$SERVERNAME}</li>
     106        <li>{'Put your website domain in the %s fields. It should match with the current hostname: <em>%s</em>'|translate|sprintf:'<b>Valid OAuth redirect URIs</b>':$SERVERNAME}</li>
    107107      {elseif $p=='LinkedIn'}
    108         <li>{'Put your website domain in the %s fields. It should match with the current hostname: <em>%s</em>'|@translate|sprintf:'<b>Website URL</b>':$SERVERNAME}</li>
    109         <li>{'Set <b>%s</b> to <em>%s</em>'|@translate|sprintf:'Application Type':'Web Application'}</li>
    110         <li>{'Set <b>%s</b> to <em>%s</em>'|@translate|sprintf:'Default Scope':'r_basicprofile & r_emailaddress'}</li>
     108        <li>{'Put your website domain in the %s fields. It should match with the current hostname: <em>%s</em>'|translate|sprintf:'<b>Website URL</b>':$SERVERNAME}</li>
     109        <li>{'Set <b>%s</b> to <em>%s</em>'|translate|sprintf:'Application Type':'Web Application'}</li>
     110        <li>{'Set <b>%s</b> to <em>%s</em>'|translate|sprintf:'Default Scope':'r_basicprofile & r_emailaddress'}</li>
    111111      {elseif $p=='Yahoo'}
    112         <li>{'Put your website domain in the %s fields. It should match with the current hostname: <em>%s</em>'|@translate|sprintf:'<b>Application URL</b>, <b>Application Domain</b>':$SERVERNAME}</li>
    113         <li>{'Set <b>%s</b> to <em>%s</em>'|@translate|sprintf:'Kind of Application':'Web-based'}</li>
    114         <li>{'Set <b>%s</b> to <em>%s</em>'|@translate|sprintf:'Access Scopes':'This app will only access public...'}</li>
    115         <li>{'Once the application is registered update the permissions : set <b>Contacts</b> as <em>Read</em> and <b>Social Directory</b> as <em>Read Public</em>'|@translate}</li>
     112        <li>{'Put your website domain in the %s fields. It should match with the current hostname: <em>%s</em>'|translate|sprintf:'<b>Application URL</b>, <b>Application Domain</b>':$SERVERNAME}</li>
     113        <li>{'Set <b>%s</b> to <em>%s</em>'|translate|sprintf:'Kind of Application':'Web-based'}</li>
     114        <li>{'Set <b>%s</b> to <em>%s</em>'|translate|sprintf:'Access Scopes':'This app will only access public...'}</li>
     115        <li>{'Once the application is registered update the permissions : set <b>Contacts</b> as <em>Read</em> and <b>Social Directory</b> as <em>Read Public</em>'|translate}</li>
    116116      {elseif $p=='Twitter'}
    117         <li>{'Put your website domain in the %s fields. It should match with the current hostname: <em>%s</em>'|@translate|sprintf:'<b>Website</b>, <b>Callback URL</b>':$SERVERNAME}</li>
     117        <li>{'Put your website domain in the %s fields. It should match with the current hostname: <em>%s</em>'|translate|sprintf:'<b>Website</b>, <b>Callback URL</b>':$SERVERNAME}</li>
    118118      {elseif $p=='Tumblr'}
    119         <li>{'Put your website domain in the %s fields. It should match with the current hostname: <em>%s</em>'|@translate|sprintf:'<b>Application Website</b>, <b>Default Callback URL</b>':$SERVERNAME}</li>
     119        <li>{'Put your website domain in the %s fields. It should match with the current hostname: <em>%s</em>'|translate|sprintf:'<b>Application Website</b>, <b>Default Callback URL</b>':$SERVERNAME}</li>
    120120      {elseif $p=='Instagram'}
    121         <li>{'Put your website domain in the %s fields. It should match with the current hostname: <em>%s</em>'|@translate|sprintf:'<b>Website</b>':$SERVERNAME}</li>
     121        <li>{'Put your website domain in the %s fields. It should match with the current hostname: <em>%s</em>'|translate|sprintf:'<b>Website</b>':$SERVERNAME}</li>
    122122      {elseif $p=='Google'}
    123         <li>{'Set <b>%s</b> to <em>%s</em>'|@translate|sprintf:'Application Type':'Web Application'}</li>
    124         <li>{'Put your website domain in the %s fields. It should match with the current hostname: <em>%s</em>'|@translate|sprintf:'<b>Authorized Javascript origins </b>':$SERVERNAME}</li>
     123        <li>{'Set <b>%s</b> to <em>%s</em>'|translate|sprintf:'Application Type':'Web Application'}</li>
     124        <li>{'Put your website domain in the %s fields. It should match with the current hostname: <em>%s</em>'|translate|sprintf:'<b>Authorized Javascript origins </b>':$SERVERNAME}</li>
    125125      {/if}
    126126     
    127         <li>{'Once you have registered, copy and past the created application credentials into this setup page'|@translate}</li>
     127        <li>{'Once you have registered, copy and past the created application credentials into this setup page'|translate}</li>
    128128      </ol>
    129129    {else}
    130       <p>{'No registration required for OpenID based providers'|@translate}</p>
     130      <p>{'No registration required for OpenID based providers'|translate}</p>
    131131    {/if}
    132132    </div>
     
    136136</fieldset>
    137137
    138 <p style="text-align:left;"><input type="submit" name="save_config" value="{'Save Settings'|@translate}"></p>
     138<p style="text-align:left;"><input type="submit" name="save_config" value="{'Save Settings'|translate}"></p>
    139139 
    140140</form>
  • extensions/oAuth/admin/template/style.css

    r23808 r26556  
    1 .showInfo {
    2   position:static;
    3   display:inline-block;
    4   padding:1px 6px;
    5   width:4px;
    6   height:14px;
    7   line-height:14px;
    8   font-size:0.8em;
    9 }
    10 
    111.content h4 {
    122  text-align:left;
  • extensions/oAuth/auth.php

    r23808 r26556  
    100100      $template->assign('ERROR', l10n('User not found')); break;
    101101    default:
    102       $template->assign('ERROR', sprintf(l10n('An error occured, please contact the gallery owner. <i>Error code : %s</i>'), '<span title="'.$e->getMessage().'">'.$e->getCode().'</span>'));
     102      $template->assign('ERROR', l10n('An error occured, please contact the gallery owner. <i>Error code : %s</i>', '<span title="'.$e->getMessage().'">'.$e->getCode().'</span>'));
    103103  }
    104104}
     
    117117$template->set_filename('index', realpath(OAUTH_PATH . 'template/auth.tpl'));
    118118$template->pparse('index');
    119 ?>
  • extensions/oAuth/include/functions.inc.php

    r23808 r26556  
    4646  }
    4747}
    48 
    49 ?>
  • extensions/oAuth/include/public_events.inc.php

    r24142 r26556  
    11<?php
    22defined('OAUTH_PATH') or die('Hacking attempt!');
    3 
    4 function oauth_anti_lightbox($tpl_thumbnails_var)
    5 {
    6   global $template, $page;
    7  
    8   if ($page['section'] == 'collections' && !empty($template->css_by_priority[0]))
    9   {
    10     foreach ($template->css_by_priority[0] as $file)
    11     {
    12       if (strpos($file[0], 'colorbox.css') !== false)
    13       {
    14         $template->assign('OAUTH_NO_LIGHTBOX', true);
    15         break;
    16       }
    17     }
    18   }
    19  
    20   return $tpl_thumbnails_var;
    21 }
    223
    234/**
     
    5233    list($oauth_id) = pwg_db_fetch_row($result);
    5334    list($provider) = explode('---', $oauth_id);
    54     $_SESSION['page_errors'][] = sprintf(l10n('You registered with a %s account, please sign in with the same account.'), $provider);
     35    $_SESSION['page_errors'][] = l10n('You registered with a %s account, please sign in with the same account.', $provider);
    5536   
    5637    $redirect_to = get_root_url().'identification.php'; // variable used by identification.php
     
    9677        ));
    9778       
    98       array_push($page['infos'], l10n('Your registration is almost done, please complete the registration form.'));
     79      $page['infos'][] = l10n('Your registration is almost done, please complete the registration form.');
    9980     
    10081      $oauth_id = $provider.'---'.$remote_user->identifier;
     
    141122    }
    142123    catch (Exception $e) {
    143       array_push($page['errors'], sprintf(l10n('An error occured, please contact the gallery owner. <i>Error code : %s</i>'), $e->getCode()));
     124      $page['errors'][] = l10n('An error occured, please contact the gallery owner. <i>Error code : %s</i>', $e->getCode());
    144125    }
    145126  }
     
    196177  }
    197178  catch (Exception $e) {
    198     array_push($page['errors'], sprintf(l10n('An error occured, please contact the gallery owner. <i>Error code : %s</i>'), $e->getCode()));
     179    $page['errors'][] = l10n('An error occured, please contact the gallery owner. <i>Error code : %s</i>', $e->getCode());
    199180  }
    200181}
     
    231212  }
    232213  catch (Exception $e) {
    233     $_SESSION['page_errors'][] = sprintf(l10n('An error occured, please contact the gallery owner. <i>Error code : %s</i>'), $e->getCode());
     214    $_SESSION['page_errors'][] = l10n('An error occured, please contact the gallery owner. <i>Error code : %s</i>', $e->getCode());
    234215  }
    235216}
     
    245226  $menu = &$menu_ref_arr[0]; 
    246227 
    247   if ( !$conf['oauth']['display_menubar'] or $menu->get_block('mbIdentification') == null )
     228  if (!$conf['oauth']['display_menubar'] or $menu->get_block('mbIdentification') == null)
    248229  {
    249230    return;
     
    293274  return str_replace($search, $search.$add, $content);
    294275}
    295 
    296 ?>
  • extensions/oAuth/main.inc.php

    r24142 r26556  
    1111defined('PHPWG_ROOT_PATH') or die('Hacking attempt!');
    1212
    13 // +-----------------------------------------------------------------------+
    14 // | Define plugin constants                                               |
    15 // +-----------------------------------------------------------------------+
    16 defined('OAUTH_ID') or define('OAUTH_ID', basename(dirname(__FILE__)));
     13
     14define('OAUTH_ID',      basename(dirname(__FILE__)));
    1715define('OAUTH_PATH' ,   PHPWG_PLUGINS_PATH . OAUTH_ID . '/');
    1816define('OAUTH_ADMIN',   get_root_url() . 'admin.php?page=plugin-' . OAUTH_ID);
     
    2220
    2321
    24 // +-----------------------------------------------------------------------+
    25 // | Event handlers                                                        |
    26 // +-----------------------------------------------------------------------+
    27 global $conf, $hybridauth_conf;
    28 
    29 add_event_handler('init', 'oauth_init');
     22// try to load hybridauth config
     23global $hybridauth_conf;
    3024
    3125include_once(OAUTH_PATH . 'include/functions.inc.php');
    3226
    33 // try to load hybridauth config
    3427if (file_exists(PHPWG_ROOT_PATH.OAUTH_CONFIG))
    3528{
     
    3730}
    3831
     32
     33add_event_handler('init', 'oauth_init');
     34
    3935if (defined('IN_ADMIN'))
    4036{
    4137  add_event_handler('get_admin_plugin_menu_links', 'oauth_admin_plugin_menu_links');
    42  
    43   function oauth_admin_plugin_menu_links($menu)
    44   {
    45     array_push($menu, array(
    46       'NAME' => l10n('OAuth'),
    47       'URL' => OAUTH_ADMIN,
    48     ));
    49     return $menu;
    50   }
    5138}
    5239else if (!empty($hybridauth_conf) and function_exists('curl_init'))
     
    6148  add_event_handler('blockmanager_apply', 'oauth_blockmanager');
    6249 
    63   add_event_handler('loc_end_index_thumbnails', 'oauth_anti_lightbox', 41);
    64  
    6550  include_once(OAUTH_PATH . 'include/public_events.inc.php');
    6651}
     
    7257function oauth_init()
    7358{
    74   global $conf, $pwg_loaded_plugins, $page, $hybridauth_conf;
     59  global $conf, $page, $hybridauth_conf;
    7560 
    76   // apply upgrade if needed
    77   if (
    78     OAUTH_VERSION == 'auto' or
    79     $pwg_loaded_plugins[OAUTH_ID]['version'] == 'auto' or
    80     version_compare($pwg_loaded_plugins[OAUTH_ID]['version'], OAUTH_VERSION, '<')
    81   )
    82   {
    83     include_once(OAUTH_PATH . 'include/install.inc.php');
    84     oauth_install();
    85    
    86     if ( $pwg_loaded_plugins[OAUTH_ID]['version'] != 'auto' and OAUTH_VERSION != 'auto' )
    87     {
    88       $query = '
    89 UPDATE '. PLUGINS_TABLE .'
    90 SET version = "'. OAUTH_VERSION .'"
    91 WHERE id = "'. OAUTH_ID .'"';
    92       pwg_query($query);
    93      
    94       $pwg_loaded_plugins[OAUTH_ID]['version'] = OAUTH_VERSION;
    95      
    96       if (defined('IN_ADMIN'))
    97       {
    98         $_SESSION['page_infos'][] = 'OAuth updated to version '. OAUTH_VERSION;
    99       }
    100     }
    101   }
     61  include_once(OAUTH_PATH . 'maintain.inc.php');
     62  $maintain = new oAuth_maintain(OAUTH_ID);
     63  $maintain->autoUpdate(OAUTH_VERSION, 'install');
    10264 
    10365  load_language('plugin.lang', OAUTH_PATH);
     
    10870  if (defined('IN_ADMIN'))
    10971  {
    110     if ( empty($hybridauth_conf) and strpos(@$_GET['page'],'plugin-'.OAUTH_ID)===false )
     72    if (empty($hybridauth_conf) and strpos(@$_GET['page'],'plugin-'.OAUTH_ID)===false)
    11173    {
    112       array_push($page['warnings'], '<a href="'.OAUTH_ADMIN.'">'.l10n('OAuth: You need to configure the credentials').'</a>');
     74      $page['warnings'][] = '<a href="'.OAUTH_ADMIN.'">'.l10n('OAuth: You need to configure the credentials').'</a>';
    11375    }
    11476    if (!function_exists('curl_init'))
    11577    {
    116       array_push($page['warnings'], l10n('OAuth: PHP Curl extension is needed'));
     78      $page['warnings'][] = l10n('OAuth: PHP Curl extension is needed');
    11779    }
    11880  }
     
    13698}
    13799
    138 ?>
     100function oauth_admin_plugin_menu_links($menu)
     101{
     102  $menu[] = array(
     103    'NAME' => l10n('OAuth'),
     104    'URL' => OAUTH_ADMIN,
     105    );
     106  return $menu;
     107}
  • 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 ?>
  • extensions/oAuth/template/auth.tpl

    r23808 r26556  
    22<html lang="{$lang_info.code}" dir="{$lang_info.direction}">
    33<head>
    4   <meta http-equiv="Content-Type" content="text/html; charset={$CONTENT_ENCODING}">
    5   <title>{'Sign in with %s'|@translate|sprintf:$PROVIDER} | {$GALLERY_TITLE}</title>
     4  <meta charset="{$CONTENT_ENCODING}">
     5  <title>{'Sign in with %s'|translate:$PROVIDER} | {$GALLERY_TITLE}</title>
    66</head>
    77
     
    1111{if $ERROR}
    1212  <img id="loader" src="{$OAUTH_PATH}template/images/alert.png">
    13   <h3>{'Error...'|@translate}</h3>
     13  <h3>{'Error...'|translate}</h3>
    1414  {$ERROR}<br>
    15   <a href="#" id="close">{'Close'|@translate}</a>
     15  <a href="#" id="close">{'Close'|translate}</a>
    1616 
    1717  <script type="text/javascript">
    18     document.getElementById('close').onclick = function() {ldelim} window.self.close(); };
     18    document.getElementById('close').onclick = function() { window.self.close(); };
    1919  </script>
    2020 
    2121{elseif $LOADING}
    2222  <img id="loader" src="{$OAUTH_PATH}template/images/ajax-loader-big.gif">
    23   <h3>{'Loading...'|@translate}</h3>
    24   {'Contacting <b>%s</b>. Please wait.'|@translate|sprintf:$PROVIDER}
     23  <h3>{'Loading...'|translate}</h3>
     24  {'Contacting <b>%s</b>. Please wait.'|translate:$PROVIDER}
    2525 
    2626  <script type="text/javascript">
  • extensions/oAuth/template/identification_common.tpl

    r24142 r26556  
    11{combine_css path=$OAUTH_PATH|cat:'template/oauth_sprites.css'}
    22
    3 {html_style}{literal}
    4   #openid_form {
    5     padding:20px;
    6   }
    7   #openid_form h3, #openid_form .oauth_38px {
    8     display:inline-block;
    9     vertical-align:middle;
    10     margin:0;
    11   }
    12   #openid_label.error {
    13     color:red;
    14     font-weight:bold;
    15   }
    16 {/literal}{/html_style}
     3{combine_script id='jquery.colorbox' load='footer' require='jquery' path='themes/default/js/plugins/jquery.colorbox.min.js'}
     4{combine_css id='colorbox' path="themes/default/js/plugins/colorbox/style2/colorbox.css"}
    175
    18 {if not isset($OAUTH_NO_LIGHTBOX)}
    19 {combine_script id='jquery.colorbox' load='footer' require='jquery' path='themes/default/js/plugins/jquery.colorbox.min.js'}
    20 {combine_css path="themes/default/js/plugins/colorbox/style2/colorbox.css"}
    21 {/if}
     6{html_style}
     7#openid_form { padding:20px; }
     8#openid_form h3, #openid_form .oauth_38px { display:inline-block; vertical-align:middle; margin:0; }
     9#openid_label.error { color:red; font-weight:bold; }
     10{/html_style}
    2211
    23 {footer_script}{literal}
     12{footer_script}
    2413// redirect, called from the popup
    2514function redirect(type) {
    26 {/literal}
    27   url = "{$REDIRECT_TO}";
    28   if (typeof type != 'undefined' && type != 'default') {ldelim}
     15  var url = "{$REDIRECT_TO}";
     16  if (typeof type != 'undefined' && type != 'default') {
    2917    url = "{$ABS_ROOT_URL}"+ type +".php";
    3018  }
    31 {literal}
     19
    3220  window.location.href = url;
    3321}
     
    4937    case 'OpenID': case 'Wordpress': case 'Flickr': case 'Steam':
    5038      switch(idp) {
    51 {/literal}
    5239        case 'OpenID':
    53           jQuery("#openid_label").html('{'Please enter your OpenID URL'|@translate|escape:javascript}'); break;
     40          jQuery("#openid_label").html('{'Please enter your OpenID URL'|translate|escape:javascript}'); break;
    5441        case 'Wordpress': case 'Flickr': case 'Steam':
    55           jQuery("#openid_label").html('{'Please enter your username'|@translate|escape:javascript}'); break;
     42          jQuery("#openid_label").html('{'Please enter your username'|translate|escape:javascript}'); break;
    5643      }
    5744     
    58       jQuery("#openid_form").css('background-color', $("#the_page #content").css('background-color'));
     45      var bg_color = $('#the_page #content').css('background-color');
     46      if (!bg_color || bg_color=='transparent') {
     47        bg_color = $('body').css('background-color');
     48      }
     49      jQuery("#openid_form").css('background-color', bg_color);
     50
    5951      jQuery("#openid_form .oauth_38px").removeClass().addClass("oauth_38px " + idp.toLowerCase());
    6052      jQuery("#openid_form h3").html(idp);
    6153      jQuery("#openid_form").data('idp', idp);
    62 {literal} 
     54
    6355      jQuery.colorbox({
    6456        inline:true,
     
    6658        initialWidth:0,
    6759        initialHeight:0,
    68         onComplete:function(){ jQuery.colorbox.resize({speed:0}) } // prevent misalignement when icon not loaded
     60        onComplete: function(){ jQuery.colorbox.resize({ speed:0 }) } // prevent misalignement when icon not loaded
    6961      })
    7062      break;
    7163     
    7264    default:
    73 {/literal}
    7465      open_auth("{$OAUTH_URL}"+ idp);
    75 {literal}
    7666  }
    7767 
     
    9585    case 'Steam': oi = "http://steamcommunity.com/openid/" + oi; break;
    9686  }
    97 {/literal} 
     87
    9888  open_auth("{$OAUTH_URL}OpenID&openid_identifier="+ encodeURI(oi));
    99 {literal}
     89
    10090  jQuery.colorbox.close();
    10191  return false;
     
    10797  return false;
    10898});
    109 {/literal}{/footer_script}
     99{/footer_script}
    110100
    111101<div style="display:none;">
     
    123113    <div>
    124114      <br>
    125       <input type="submit" name="{'Submit'|@translate}">
    126       <a href="#" id="openid_cancel">{'Cancel'|@translate}</a>
     115      <input type="submit" name="{'Submit'|translate}">
     116      <a href="#" id="openid_cancel">{'Cancel'|translate}</a>
    127117    </div>
    128118  </form>
  • extensions/oAuth/template/identification_menubar.tpl

    r21584 r26556  
    44    {include file=$OAUTH_ABS_PATH|cat:'template/identification_common.tpl'}
    55  {/if}
    6   {html_style}{literal}
    7     dl#mbIdentification dd:first-of-type {
    8       padding-bottom:0 !important;
    9     }
    10     #mbIdentification .oauth {
    11       margin:0 1px;
    12     }
    13   {/literal}{/html_style}
     6  {html_style}
     7    dl#mbIdentification dd:first-of-type { padding-bottom:0 !important;
     8    #mbIdentification .oauth { margin:0 1px; }
     9  {/html_style}
    1410 
    1511  <dd>
    1612    <form id="quickconnect">
    1713    <fieldset style="text-align:center;">
    18       <legend>{'Or sign in with'|@translate}</legend>
     14      <legend>{'Or sign in with'|translate}</legend>
    1915     
    2016    {foreach from=$PROVIDERS item=provider key=p}{strip}
  • extensions/oAuth/template/identification_page.tpl

    r21584 r26556  
    44    {include file=$OAUTH_ABS_PATH|cat:'template/identification_common.tpl'}
    55  {/if}
    6   {html_style}{literal}
    7     #oauth_wrap .oauth {
    8       margin:0 2px;
    9     }
    10   {/literal}{/html_style}
     6  {html_style}
     7    #oauth_wrap .oauth { margin:0 2px; }
     8  {/html_style}
    119   
    1210  <fieldset style="text-align:center;" id="oauth_wrap">
    13     <legend>{'Or sign in with'|@translate}</legend>
     11    <legend>{'Or sign in with'|translate}</legend>
    1412   
    1513  {foreach from=$PROVIDERS item=provider key=p}{strip}
  • extensions/oAuth/template/profile.tpl

    r20368 r26556  
    1 {html_head}{literal}
    2 <style type="text/css">
    3   #oauth {
    4     width:400px;
    5     height:48px;
    6     overflow:hidden;
    7     margin:0 auto 15px auto;
    8     padding:5px;
    9     background:rgba(128,128,128,0.2);
    10     border:1px solid #7e7e7e;
    11     border-radius:5px;
    12   }
    13   #oauth .avatar {
    14     width:48px;
    15     border-radius:5px;
    16     margin-right:5px;
    17     float:left;
    18   }
    19 </style>
    20 {/literal}{/html_head}
     1{html_style}
     2#oauth {
     3  width:400px;
     4  height:48px;
     5  overflow:hidden;
     6  margin:0 auto 15px auto;
     7  padding:5px;
     8  background:rgba(128,128,128,0.2);
     9  border:1px solid #7e7e7e;
     10  border-radius:5px;
     11}
     12#oauth .avatar {
     13  width:48px;
     14  border-radius:5px;
     15  margin-right:5px;
     16  float:left;
     17}
     18{/html_style}
    2119
    2220<div id="oauth">
     
    2725{/if}
    2826
    29   {'Logged with'|@translate} : <b>{$OAUTH_PROVIDER}</b><br>
    30   <b>{'Username'|@translate}</b> : {$OAUTH_USERNAME}<br>
    31   {if $OAUTH_PROFILE_URL}<b>{'Profile URL'|@translate}</b> : <a href="{$OAUTH_PROFILE_URL}">{$OAUTH_PROFILE_URL|truncate:40:' ... ':true:true}</a>{/if}
     27  {'Logged with'|translate} : <b>{$OAUTH_PROVIDER}</b><br>
     28  <b>{'Username'|translate}</b> : {$OAUTH_USERNAME}<br>
     29  {if $OAUTH_PROFILE_URL}<b>{'Profile URL'|translate}</b> : <a href="{$OAUTH_PROFILE_URL}">{$OAUTH_PROFILE_URL|truncate:40:' ... ':true:true}</a>{/if}
    3230</div>
Note: See TracChangeset for help on using the changeset viewer.