mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-06-01 20:29:29 +00:00
d04b0450da
- Removed all the NOT usefull loads of helpers and libraries - Fixed undefined index in controllers/system/UDF and model system/UDF_model - APIv1_Controller now loads helper fhcauth - FHC_Controller now loads ithe fhc and session helpers too - Added/Fixed comments - PermissionLib does NOT use anymore the getAuthUID function from the fhcauth helper, now relies on AuthLib directly - REST_Controller loads directly the AuthLib when is needed
68 lines
1.3 KiB
PHP
68 lines
1.3 KiB
PHP
<?php
|
|
/**
|
|
* FH-Complete
|
|
*
|
|
* @package FHC-Helper
|
|
* @author FHC-Team
|
|
* @copyright Copyright (c) 2016 fhcomplete.org
|
|
* @license GPLv3
|
|
* @link https://fhcomplete.org
|
|
* @since Version 1.0.0
|
|
* @filesource
|
|
*/
|
|
if (! defined('BASEPATH')) exit('No direct script access allowed');
|
|
|
|
require_once FHCPATH.'include/authentication.class.php';
|
|
|
|
/**
|
|
* FHC-Auth Helpers
|
|
*
|
|
* @package FH-Complete
|
|
* @subpackage Helpers
|
|
* @category Helpers
|
|
* @author FHC-Team
|
|
* @link http://fhcomplete.org/user_guide/helpers/fhcauth_helper.html
|
|
*/
|
|
|
|
// ------------------------------------------------------------------------
|
|
|
|
if ( ! function_exists('auth'))
|
|
{
|
|
/**
|
|
* Auth Username, Password over FH-Complete
|
|
*
|
|
* @param string $username
|
|
* @param string $password
|
|
* @return bool
|
|
*/
|
|
function auth($username, $password)
|
|
{
|
|
$auth = new authentication();
|
|
if ($auth->checkpassword($username, $password))
|
|
{
|
|
echo 'Auth-Method-False';
|
|
return true;
|
|
}
|
|
else
|
|
{
|
|
echo 'Auth-Method-False';
|
|
return false;
|
|
}
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Look if User is logged in and return uid
|
|
* it tries to work always with CI session
|
|
* Otherwise return false
|
|
*
|
|
* @return string or (bool)false
|
|
*/
|
|
function getAuthUID()
|
|
{
|
|
$ci =& get_instance(); // get CI instance
|
|
$ci->load->library('AuthLib'); // load authentication library
|
|
|
|
return $ci->authlib->getUser();
|
|
}
|