Ignore:
Timestamp:
Jan 22, 2013, 1:43:58 PM (12 years ago)
Author:
mistic100
Message:

fix redirect error, provide 3 sizes of icons, display login info on register page

Location:
extensions/oAuth/include
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • extensions/oAuth/include/install.inc.php

    r20293 r20323  
    1111      'display_menubar' => true,
    1212      'display_register' => true,
     13      'identification_icon' => '38px',
     14      'menubar_icon' => '26px',
    1315      ));
    1416 
  • extensions/oAuth/include/public_events.inc.php

    r20301 r20323  
    77function oauth_begin_identification()
    88{
    9   global $template;
    10  
    11   // template icons
    12   if ($template->get_template_vars('OAUTH_URL') == null)
    13   {
    14     $template->assign(array(
    15       'OAUTH_URL' => get_root_url() . OAUTH_PATH . 'auth.php?provider=',
    16       'OAUTH_PATH' => OAUTH_PATH,
    17       'OAUTH_ABS_PATH' => realpath(OAUTH_PATH) . '/',
    18       'PROVIDERS' => get_activated_providers(),
    19     ));
    20   }
    21  
     9  global $template, $conf;
     10 
     11  oauth_assign_template_vars();
    2212  $template->assign('REDIRECT_TO', !empty($_GET['redirect']) ? urldecode($_GET['redirect']) : get_gallery_home_url());
    2313 
     
    5848function oauth_begin_register()
    5949{
    60   global $conf, $template, $hybridauth_conf;
     50  global $conf, $template, $hybridauth_conf, $page;
    6151 
    6252  // comming from identification page
     
    7161      $adapter = $hybridauth->authenticate($provider);
    7262      $remote_user = $adapter->getUserProfile();
     63   
     64      $template->assign(array(
     65        'OAUTH_PROVIDER' => $provider,
     66        'OAUTH_USERNAME' => $remote_user->displayName,
     67        'OAUTH_PROFILE_URL' => $remote_user->profileURL,
     68        'OAUTH_AVATAR' => $remote_user->photoURL,
     69        'OAUTH_PATH' => OAUTH_PATH,
     70        ));
     71       
     72      array_push($page['infos'], l10n('Your registration is almost done, please complete the registration form.'));
    7373     
    7474      $oauth_id = $provider.'---'.$remote_user->identifier;
     
    119119     
    120120      // template
     121      $template->set_prefilter('register', 'oauth_add_profile_prefilter');
    121122      $template->set_prefilter('register', 'oauth_remove_password_fields_prefilter');
    122123    }
     
    128129  else if ($conf['oauth']['display_register'])
    129130  {
    130     // template icons
    131     if ($template->get_template_vars('OAUTH_URL') == null)
    132     {
    133       $template->assign(array(
    134         'OAUTH_URL' => get_root_url() . OAUTH_PATH . 'auth.php?provider=',
    135         'OAUTH_PATH' => OAUTH_PATH,
    136         'OAUTH_ABS_PATH' => realpath(OAUTH_PATH) . '/',
    137         'PROVIDERS' => get_activated_providers(),
    138         ));
    139     }
    140    
     131    oauth_assign_template_vars();
    141132    $template->assign('REDIRECT_TO', get_gallery_home_url());
    142133   
     
    178169      'OAUTH_PROVIDER' => $provider,
    179170      'OAUTH_USERNAME' => $remote_user->displayName,
    180       'OAUTH_URL' => $remote_user->profileURL,
     171      'OAUTH_PROFILE_URL' => $remote_user->profileURL,
    181172      'OAUTH_AVATAR' => $remote_user->photoURL,
    182173      'OAUTH_PATH' => OAUTH_PATH,
     
    241232  }
    242233 
    243   if ($template->get_template_vars('OAUTH_URL') == null)
    244   {
    245     $template->assign(array(
    246       'OAUTH_URL' => get_root_url() . OAUTH_PATH . 'auth.php?provider=',
    247       'OAUTH_PATH' => OAUTH_PATH,
    248       'OAUTH_ABS_PATH' => realpath(OAUTH_PATH) . '/',
    249       'PROVIDERS' => get_activated_providers(),
    250       ));
    251   }
    252  
     234  oauth_assign_template_vars();
    253235  $template->assign('REDIRECT_TO', get_gallery_home_url());
    254236 
     
    282264function oauth_add_profile_prefilter($content)
    283265{
    284   $search = '<legend>{\'Registration\'|@translate}</legend>';
     266  $search = '#</legend>#';
    285267  $add = file_get_contents(OAUTH_PATH . 'template/profile.tpl');
    286   return str_replace($search, $search.$add, $content);
     268  return preg_replace($search, '</legend> '.$add, $content, 1);
    287269}
    288270
     
    294276}
    295277
     278
     279function 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' => get_gallery_home_url(),
     292      ));
     293  }
     294}
    296295?>
Note: See TracChangeset for help on using the changeset viewer.