Exemplo n.º 1
0
    header('Location:' . ROOT_DIR . 'appstore.php?app=auth');
}
register_shutdown_function('hg_done');
function hg_done()
{
    global $gDB;
    if ($gDB) {
        $gDB->close();
    }
}
//hg_add_head_element('js', RESOURCE_DIR . 'scripts/' .  'global.js');
hg_add_head_element('js-c', "\r\nvar ROOT_PATH = '" . ROOT_DIR . "';\r\nvar RESOURCE_DIR = '" . RESOURCE_DIR . "';\r\nvar cookie_id = '" . $gGlobalConfig['cookie_prefix'] . "';\r\nvar cookie_path = '" . $gGlobalConfig['cookie_path'] . "';\r\nvar cookie_domain = '" . $gGlobalConfig['cookie_domain'] . "';\r\nvar TIME_OUT = '" . $gGlobalConfig['time_out'] . "';\r\nvar ACCESS_TOKEN = '" . $gUser['token'] . "';\r\nvar DEBUG_MODE = " . intval(DEBUG_MODE) . ";\r\nvar ISIOS = " . intval(ISIOS) . ";\r\nvar ISANDROID = " . intval(ISANDROID) . ";\r\nvar gAdmin = {group_type : '" . $gUser['group_type'] . "',admin_id : '" . $gUser['id'] . "', admin_user : '******'user_name'] . "', admin_pass : '******'password'] . "'};\r\nwindow.onbeforeunload = function(){hg_window_destruct();};\r\n");
$gTpl->addHeaderCode(hg_add_head_element('echo'));
$gGlobalConfig['liv_client_info'] = hg_get_cookie('client_info');
if (!is_writeable(CACHE_DIR)) {
    $uiview = new uiview();
    $uiview->ReportError('请将缓存目录' . realpath(CACHE_DIR) . '设置为可写!');
}
if (!is_file(CACHE_DIR . 'expire.m2o')) {
    $needUpAuth = true;
} else {
    $content = file_get_contents(CACHE_DIR . 'expire.m2o');
    if (!$content) {
        $needUpAuth = true;
    } else {
        $license = hoge_de($content);
        if (!$license['appid']) {
            $needUpAuth = true;
        } else {
            $needUpAuth = false;
        }
Exemplo n.º 2
0
 private function jsonToArray($json)
 {
     $ret = json_decode($json, true);
     if (is_array($ret)) {
         unset($ret['Debug']);
         if (in_array($ret['ErrorCode'], array(USER_NOT_LOGIN, NO_ACCESS_TOKEN))) {
             $_SESSION['livmcp_userinfo'] = array();
             if (!$this->input['ajax']) {
                 header('Location:' . ROOT_DIR . 'login.php');
             } else {
                 $data = array('msg' => '请先登录', 'callback' => "hg_ajax_post({href: 'login.php'}, '登录');");
                 echo json_encode($data);
                 exit;
             }
         } elseif ($this->mNotInitedNeedExit && in_array($ret['ErrorCode'], array(NOT_INITED)) && $this->input['mid']) {
             header('Location:' . ROOT_DIR . 'settings.php?mid=' . $this->input['mid'] . '&a=configuare');
         } elseif (substr($ret['ErrorCode'], 0, 8) == 'REDIRECT') {
             $to = explode(' TO ', $ret['ErrorCode']);
             $to = explode(' ', $to[1]);
             $url = 'run.php?a=relate_module_show&app_uniq=' . trim($to[0]) . '&mod_uniq=' . trim($to[1]);
             header('Location:' . $url . '&infrm=1');
         }
         if ($ret['ErrorCode'] && $this->mErrorReturn == 'exit') {
             $uiview = new uiview();
             $uiview->ReportError($ret['ErrorCode'] . $ret['ErrorText']);
         }
         return $ret;
     } else {
         return $json;
     }
 }