activate_helper.php
821 Bytes
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
if(!function_exists('activate')) {
function activate($url) {
return uri_string() == $url;
}
}
if(!function_exists('api')) {
function api($url) {
$CI = &get_instance();
$url = $CI->config->item('apiBaseUrl') . $url;
$result = file_get_contents($url);
$json = json_decode($result);
$ret = $json->data;
return $ret;
}
}
if(!function_exists('hasRole')) {
function hasRole($roles = []) {
$CI = &get_instance();
$CI->load->helper('cookie');
$login_user = api('system/user/loginUser');
foreach($login_user->roleKeys as $v){
if(in_array($v, $roles)){
return true;
}
}
return false;
}
}