reasonableframework/helper/hybridauth.lnk.php

69 lines
1.4 KiB
PHP
Raw Normal View History

2018-09-26 12:50:37 +00:00
<?php
/**
* @file hybridauth.lnk.php
* @date 2018-09-26
* @author Go Namhyeon <gnh1201@gmail.com>
* @brief HybridAuth library RSF Linker
***/
2018-09-26 19:48:56 +00:00
if(!function_exists("hybridauth_load")) {
function hybridauth_load($provider="") {
2018-09-26 13:04:25 +00:00
$result = false;
2018-09-26 17:03:50 +00:00
$configfile = "./vendor/hybridauth/hybridauth/config.php";
2018-09-26 12:50:37 +00:00
$required_files = array(
2018-09-26 17:03:50 +00:00
"hybridauth/hybridauth/Hybrid/Auth",
"hybridauth/hybridauth/Hybrid/Endpoint"
2018-09-26 12:50:37 +00:00
);
2018-09-26 14:23:53 +00:00
// support facebook (php graph api v5)
2018-09-26 18:32:27 +00:00
$provider = strtolower($provider);
2018-09-26 14:23:53 +00:00
switch($provider) {
case "facebook":
$required_files[] = "facebook-sdk-v5/src/Facebook/autoload";
break;
}
// load required files
2018-09-26 12:50:37 +00:00
foreach($required_files as $file) {
2018-09-26 12:52:36 +00:00
$inc_file = "./vendor/" . $file . ".php";
if(!file_exists($inc_file)) {
set_error("File not exists. " . $inc_file);
2018-09-26 13:04:25 +00:00
show_errors();
2018-09-26 12:52:36 +00:00
} else {
include("./vendor/" . $file . ".php");
}
2018-09-26 12:50:37 +00:00
}
2018-09-26 13:04:25 +00:00
if(file_exists($configfile)) {
$result = $configfile;
}
return $result;
2018-09-26 12:50:37 +00:00
}
}
2018-09-26 17:03:50 +00:00
2018-09-26 19:48:56 +00:00
if(!function_exists("hybridauth_check_redirect")) {
function hybridauth_check_redirect() {
2018-09-26 17:03:50 +00:00
$flag = false;
$requests = get_requests();
2018-09-26 19:48:56 +00:00
2018-09-26 17:04:38 +00:00
if(loadHelper("string.utl")) {
foreach($requests['_ALL'] as $k=>$v) {
2018-09-26 19:48:56 +00:00
if(startsWith($k, "hauth")) {
2018-09-26 17:04:38 +00:00
$flag = true;
break;
}
2018-09-26 17:03:50 +00:00
}
}
return $flag;
}
}
2018-09-26 19:48:56 +00:00
if(!function_exists("hybridauth_process")) {
function hybridauth_process() {
Hybrid_Endpoint::process();
}
}