Changeset 20337 for extensions/oAuth


Ignore:
Timestamp:
Jan 22, 2013, 9:01:03 PM (11 years ago)
Author:
mistic100
Message:

fixed: cannot create initial config, update Tumblr adapter

Location:
extensions/oAuth
Files:
6 edited

Legend:

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

    r20324 r20337  
    88if (isset($_POST['save_config']))
    99{
    10   array_walk_recursive($_POST, 'trim');
    11  
    1210  $providers = array();
    1311  foreach ($_POST['providers'] as $id => $data)
     
    4240    }
    4341   
    44     if (!$error)
     42    if (is_array(@$data['keys']))
    4543    {
    46       $providers[$id] = $data;
     44      $data['keys'] = array_map('trim', $data['keys']);
    4745    }
     46   
     47    $providers[$id] = $data;
    4848  }
     49 
     50  $hybridauth_conf['providers'] = $providers;
    4951 
    5052  if (!count($page['errors']))
    5153  {
    5254    // generate config file
    53     $hybridauth_conf['providers'] = $providers;
    5455    $content = "<?php\ndefined('PHPWG_ROOT_PATH') or die('Hacking attempt!');\n\nreturn ";
    5556    $content.= var_export(array('providers'=>$providers), true);
    5657    $content.= ";\n?>";
     58   
    5759    file_put_contents(OAUTH_CONFIG, $content);
     60    array_push($page['infos'], l10n('Information data registered in database'));
    5861  }
    5962}
  • extensions/oAuth/auth.php

    r20323 r20337  
    9797    case 5:
    9898      $template->assign('ERROR', l10n('Authentication canceled')); break;
     99    case 404:
     100      $template->assign('ERROR', l10n('User not found')); break;
    99101    default:
    100102      $template->assign('ERROR', sprintf(l10n('An error occured, please contact the gallery owner. <i>Error code : %s</i>'), $e->getCode()));
  • extensions/oAuth/include/hybridauth/Hybrid/Providers/Tumblr.php

    r20293 r20337  
    3232        */
    3333        function getUserProfile()
    34         {
    35                 $response = $this->api->get( 'http://www.tumblr.com/api/authenticate' );
    36 
    37                 // check the last HTTP status code returned
    38                 if ( $this->api->http_code != 200 )
    39                 {
    40                         throw new Exception( "User profile request failed! {$this->providerId} returned an error: " . $this->errorMessageByStatus( $this->api->http_code ), 6 );
    41                 }
    42 
     34        {
    4335                try{ 
    4436                        $profile = $this->api->get( 'user/info' );
    4537
    46                         foreach ( $profile->response->user->blogs as $blog ) {
     38                        foreach ( $profile->response->user->blogs as $blog ){
    4739                                if( $blog->primary ){
    4840                                        $bloghostname = explode( '://', $blog->url );
     
    5648                                        $this->user->profile->profileURL        = $blog->url;
    5749                                        $this->user->profile->webSiteURL        = $blog->url;
     50                                        $this->user->profile->description       = strip_tags( $blog->description );
    5851
    5952                                        $avatar = $this->api->get( 'blog/'. $this->token( "primary_blog" ) .'/avatar' );
  • extensions/oAuth/include/providers_stats.inc.php

    r20301 r20337  
    5454    'label'             => 'Yahoo',
    5555    'provider_name'     => 'Yahoo!',
    56     'new_app_link'      => 'https://developer.apps.yahoo.com/dashboard/createKey.html',
     56    'new_app_link'      => 'https://developer.apps.yahoo.com/projects/',
    5757    'userguide_section' => 'http://hybridauth.sourceforge.net/userguide/IDProvider_info_Yahoo.html',
    5858  ),
  • extensions/oAuth/main.inc.php

    r20324 r20337  
    106106  if (defined('IN_ADMIN'))
    107107  {
    108     if (empty($hybridauth_conf))
     108    if ( empty($hybridauth_conf) and @$_GET['page'] != 'plugin-'.OAUTH_ID )
    109109    {
    110110      array_push($page['errors'], l10n('OAuth: You need to configure the credentials'));
  • extensions/oAuth/template/identification_common.tpl

    r20324 r20337  
    7474  var idp = $(this).data('idp');
    7575  var oi = $("#openid_form input[name='openid_identifier']").val();
     76  $("#openid_form input[name='openid_identifier']").val('');
    7677 
    7778  $("#openid_label").removeClass('error');
     
    8687  }
    8788 
    88   open_auth("{$OAUTH_URL}OpenID&openid_identifier="+ encode(oi));
     89  open_auth("{$OAUTH_URL}OpenID&openid_identifier="+ encodeURI(oi));
    8990  $.colorbox.close();
    9091  return false;
Note: See TracChangeset for help on using the changeset viewer.