Changeset 23808


Ignore:
Timestamp:
Jul 6, 2013, 4:32:05 PM (11 years ago)
Author:
mistic100
Message:

add Steam provider (OpenID based)

Location:
extensions/oAuth
Files:
13 edited

Legend:

Unmodified
Added
Removed
  • extensions/oAuth/admin/providers.php

    r21584 r23808  
    2323    }
    2424   
    25     if ( ($id=='Wordpress' or $id=='Flickr') and $data['enabled'] and !@$providers['OpenID']['enabled'] ) // in the template, OpenID must be before other OpenID based providers
     25    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    {
    2727      array_push($page['errors'], sprintf(l10n('OpenID must be enabled in order to use %s authentication'), $id));
  • extensions/oAuth/admin/template/style.css

    r20620 r23808  
    99}
    1010
    11 h4 {
    12   text-align:left !important;
     11.content h4 {
     12  text-align:left;
     13  margin:5px 0 0 0;
    1314}
    1415
     
    3536  background:rgba(256,0,0,0.1);
    3637}
    37   .provider table tr td:first-child {
     38  .provider table tr td {
    3839    vertical-align:top;
     40  }
     41  .provider table tr td:nth-child(2) {
     42    padding-top:8px;
    3943  }
    4044  .provider table tr td.keys {
     
    5458    margin:5px;
    5559  }
    56 .Wordpress, .OpenID, .Flickr {
     60.Wordpress, .OpenID, .Flickr, .Steam {
    5761  display:inline-block;
    5862}
  • extensions/oAuth/auth.php

    r21296 r23808  
    1919    or !$hybridauth_conf['providers'][$provider]['enabled']
    2020  ) {
    21     throw new Exception('Hacking attempt!', 1002);
     21    throw new Exception('Invalid provider!', 1002);
    2222  }
    2323 
  • extensions/oAuth/include/functions.inc.php

    r20368 r23808  
    2727  global $hybridauth_conf;
    2828 
    29   $out = array();
    30  
    31   foreach ($hybridauth_conf['providers'] as $id => $data)
    32   {
    33     if ($data['enabled'])
    34     {
    35       $out[$id] = $data;
    36     }
    37   }
    38  
    39   return $out;
     29  return array_filter($hybridauth_conf['providers'], create_function('$p', 'return $p["enabled"];'));
    4030}
    4131
     32function oauth_assign_template_vars()
     33{
     34  global $template, $conf;
     35 
     36  if ($template->get_template_vars('OAUTH_URL') == null)
     37  {
     38    $template->assign(array(
     39      'oauth' => $conf['oauth'],
     40      'OAUTH_URL' => get_root_url() . OAUTH_PATH . 'auth.php?provider=',
     41      'OAUTH_PATH' => OAUTH_PATH,
     42      'OAUTH_ABS_PATH' => realpath(OAUTH_PATH) . '/',
     43      'PROVIDERS' => get_activated_providers(),
     44      'ABS_ROOT_URL' => rtrim(get_gallery_home_url(), '/') . '/',
     45      ));
     46  }
     47}
    4248
    4349?>
  • extensions/oAuth/include/providers_stats.inc.php

    r21584 r23808  
    6161    'new_app_link'      => null,
    6262  ),
     63  'Steam' => array(
     64    'label'             => 'Steam',
     65    'provider_name'     => 'Steam',
     66    'new_app_link'      => null,
     67  ),
    6368  'Wordpress' => array(
    6469    'label'             => 'Wordpress',
  • extensions/oAuth/include/public_events.inc.php

    r21584 r23808  
    3535    $_SESSION['page_errors'][] = sprintf(l10n('You registered with a %s account, please sign in with the same account.'), $provider);
    3636   
    37     $redirect_to = get_root_url().'identification.php';
     37    $redirect_to = get_root_url().'identification.php'; // variable used by identification.php
    3838    return true;
    3939  }
     
    5050  global $conf, $template, $hybridauth_conf, $page;
    5151 
    52   // comming from identification page
     52  // coming from identification page
    5353  if (pwg_get_session_var('oauth_new_user') != null)
    5454  {
     
    6666      {
    6767        pwg_unset_session_var('oauth_new_user');
    68         throw new Exception('Hacking attempt!');
     68        throw new Exception('Hacking attempt!', 403);
    6969      }
    7070   
     
    142142function oauth_begin_profile()
    143143{
    144   global $template, $user, $conf, $hybridauth_conf;
     144  global $template, $user, $conf, $hybridauth_conf, $page;
    145145 
    146146  $query = '
     
    254254  $add = 'disabled="disabled" ';
    255255  $script = '
    256 {footer_script}
    257 jQuery("input[type=\'password\'], input[name=\'send_password_by_mail\']").parent("li").css("display", "none");
     256{footer_script require="jquery"}
     257jQuery("input[type=\'password\'], input[name=\'send_password_by_mail\']").parent().css("display", "none");
    258258{/footer_script}';
    259259
     
    276276}
    277277
    278 
    279 function oauth_assign_template_vars()
    280 {
    281   global $template, $conf;
    282  
    283   if ($template->get_template_vars('OAUTH_URL') == null)
    284   {
    285     $template->assign(array(
    286       'oauth' => $conf['oauth'],
    287       'OAUTH_URL' => get_root_url() . OAUTH_PATH . 'auth.php?provider=',
    288       'OAUTH_PATH' => OAUTH_PATH,
    289       'OAUTH_ABS_PATH' => realpath(OAUTH_PATH) . '/',
    290       'PROVIDERS' => get_activated_providers(),
    291       'ABS_ROOT_URL' => rtrim(get_gallery_home_url(), '/') . '/',
    292       ));
    293   }
    294 }
    295278?>
  • extensions/oAuth/main.inc.php

    r21303 r23808  
    108108    if ( empty($hybridauth_conf) and strpos(@$_GET['page'],'plugin-'.OAUTH_ID)===false )
    109109    {
    110       array_push($page['warnings'], l10n('OAuth: You need to configure the credentials'));
     110      array_push($page['warnings'], '<a href="'.OAUTH_ADMIN.'">'.l10n('OAuth: You need to configure the credentials').'</a>');
    111111    }
    112112    if (!function_exists('curl_init'))
  • extensions/oAuth/template/auth.tpl

    r20301 r23808  
    2525 
    2626  <script type="text/javascript">
    27     setTimeout('window.location.href = "{$SELF_URL}{$LOADING}";', 200);
     27    setTimeout('window.location.href = "{$SELF_URL}{$LOADING}";', 500);
    2828  </script>
    2929 
  • extensions/oAuth/template/identification_common.tpl

    r21584 r23808  
    4545 
    4646  switch(idp) {
    47     case 'OpenID': case 'Wordpress': case 'Flickr':
     47    case 'OpenID': case 'Wordpress': case 'Flickr': case 'Steam':
    4848      switch(idp) {
    4949{/literal}
    5050        case 'OpenID':
    5151          jQuery("#openid_label").html('{'Please enter your OpenID URL'|@translate|escape:javascript}'); break;
    52         case 'Wordpress': case 'Flickr':
     52        case 'Wordpress': case 'Flickr': case 'Steam':
    5353          jQuery("#openid_label").html('{'Please enter your username'|@translate|escape:javascript}'); break;
    5454      }
     
    9191    case 'Wordpress': oi = "http://" + oi + ".wordpress.com"; break;
    9292    case 'Flickr': oi = "http://www.flickr.com/photos/" + oi + "/"; break;
     93    case 'Steam': oi = "http://steamcommunity.com/openid/" + oi; break;
    9394  }
    9495{/literal} 
  • extensions/oAuth/template/oauth_sprites.css

    r20620 r23808  
    1616.oauth_16px.wordpress { background-position: -144px 0px; }
    1717.oauth_16px.yahoo { background-position: -160px 0px; }
     18.oauth_16px.steam { background-position: -176px 0px; }
    1819
    1920.oauth_26px {
     
    3435.oauth_26px.wordpress { background-position: -234px 0px; }
    3536.oauth_26px.yahoo { background-position: -260px 0px; }
     37.oauth_26px.steam { background-position: -286px 0px; }
    3638
    3739.oauth_38px {
     
    5254.oauth_38px.wordpress { background-position: -342px 0px; }
    5355.oauth_38px.yahoo { background-position: -380px 0px; }
     56.oauth_38px.steam { background-position: -418px 0px; }
Note: See TracChangeset for help on using the changeset viewer.