source: extensions/oAuth/include/functions.inc.php @ 26556

Last change on this file since 26556 was 26556, checked in by mistic100, 10 years ago

update for 2.6

File size: 1.1 KB
Line 
1<?php
2defined('OAUTH_PATH') or die('Hacking attempt!');
3
4function load_hybridauth_conf()
5{
6  global $hybridauth_conf, $conf;
7 
8  if (file_exists(PHPWG_ROOT_PATH.OAUTH_CONFIG))
9  {
10    $hybridauth_conf = include(PHPWG_ROOT_PATH.OAUTH_CONFIG);
11    $hybridauth_conf['base_url'] = OAUTH_PUBLIC;
12    if (!empty($conf['oauth_debug_file']))
13    {
14      $hybridauth_conf['debug_mode'] = true;
15      $hybridauth_conf['debug_file'] = $conf['oauth_debug_file'];
16    }
17    return true;
18  }
19  else
20  {
21    return false;
22  }
23}
24
25function get_activated_providers()
26{
27  global $hybridauth_conf;
28 
29  return array_filter($hybridauth_conf['providers'], create_function('$p', 'return $p["enabled"];'));
30}
31
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}
Note: See TracBrowser for help on using the repository browser.