예제 #1
0
파일: login.php 프로젝트: h3len/Project
 public function dologin()
 {
     $username = $this->input['username'];
     $password = $this->input['password'];
     $secret_value = $this->input['secret_value'];
     /*用户输入密保卡的值*/
     $security_zuo = $this->input['security_zuo'];
     /*密保卡坐标*/
     if ($this->settings['App_auth']) {
         //$this->show('授权服务器通信失败(配置文件缺失)!');
         $this->curl = new curl($this->settings['App_auth']['host'], $this->settings['App_auth']['dir']);
         $this->curl->initPostData();
         $this->curl->addRequestData('appid', APPID);
         $this->curl->addRequestData('appkey', APPKEY);
         $this->curl->addRequestData('username', $username);
         $this->curl->addRequestData('password', $password);
         $this->curl->addRequestData('ip', hg_getip());
         //密保卡相关验证参数
         $this->curl->addRequestData('security_zuo', $security_zuo);
         $this->curl->addRequestData('secret_value', $secret_value);
         $ret = $this->curl->request('get_access_token.php');
         if ($ret['ErrorCode']) {
             $this->show($ret['ErrorCode'] . $ret['ErrorText']);
         }
         $ret = $ret[0];
         if ($ret['forced_change_pwd']) {
             //如果开启了强制修改密码,第一次登陆的时候必须修改密码
             $this->tpl->addVar('admin_id', $ret['id']);
             $this->tpl->addVar('user_name', $ret['user_name']);
             $this->tpl->outTemplate('change_pwd');
         }
         if ($ret['domain'] && $ret['domain'] != $_SERVER['HTTP_HOST']) {
             $this->show('用户名或密码错误');
         }
         if (!$ret['token']) {
             $_SESSION['livmcp_userinfo'] = array();
             $this->show('获取令牌错误!');
         }
         //客户端过期检测
         if ($ret['app_expire_time'] && $ret['app_expire_time'] < TIMENOW) {
             $_SESSION['livmcp_userinfo'] = array();
             $this->show('客户端授权到期');
         }
         if ($ret['default_page']) {
             if (substr($ret['default_page'], 0, 7) != 'http://') {
                 $ret['default_page'] = 'http://' . $ret['default_page'];
             }
         }
         if (is_file(CACHE_DIR . 'expire.m2o')) {
             if (!is_writeable(CACHE_DIR . 'expire.m2o')) {
                 $this->ReportError('请将' . CACHE_DIR . 'expire.m2o文件权限设置为可写');
             }
             $filemtime = filemtime(CACHE_DIR . 'expire.m2o');
             if (time() - $filemtime > 86400) {
                 $updateauth = true;
             } else {
                 $content = file_get_contents(CACHE_DIR . 'expire.m2o');
                 $license = hoge_de($content);
                 $updateauth = false;
                 if (!$license) {
                     $updateauth = true;
                 }
             }
         } else {
             $updateauth = true;
         }
         if ($updateauth) {
             $curl = new curl($this->settings['verify_custom_api']['host'], $this->settings['verify_custom_api']['dir']);
             $curl->setClient(CUSTOM_APPID, CUSTOM_APPKEY);
             $curl->setToken('');
             $curl->setErrorReturn('');
             $curl->setCurlTimeOut(10);
             $curl->mAutoInput = false;
             $curl->initPostData();
             $postdata = array('useappkey' => 1);
             foreach ($postdata as $k => $v) {
                 $curl->addRequestData($k, $v);
             }
             $auth = $curl->request('Authorization.php');
             if (is_array($auth)) {
                 if ($auth['ErrorCode'] == 'NO_APP_INFO') {
                     $this->ReportError('授权非法,请联系软件提供商');
                 }
                 if ($auth['ErrorCode'] == 'APP_AUTH_EXPIRED') {
                     $this->ReportError('授权已到期,请联系软件提供商');
                 }
             }
             $license = hoge_de($auth);
             if ($license) {
                 if ($license['appid']) {
                     file_put_contents(CACHE_DIR . 'expire.m2o', $auth);
                 }
             }
         }
         $timedelay = 0;
         if (intval($license['expire_time'])) {
             $license['expire'] = date('Y-m-d', $license['expire_time']);
             $license['leftday'] = intval(($license['expire_time'] - TIMENOW) / 86400);
             if ($license['expire_time'] < time()) {
                 $this->ReportError('授权已到期,请联系软件提供商');
             }
             if ($license['leftday'] <= 30) {
                 $license_alert = '<div style="font-size:14px;">授权将在 <strong style="color:red;">' . $license['leftday'] . '</strong> 天后到期, 为了保证您正常使用系统,请提前联系软件提供商。</div>';
                 $timedelay = 5;
             }
         }
         $_SESSION['livmcp_userinfo'] = $ret;
         $user = $ret;
         /*
         			if($ret['id'])
         			{
         				$this->curl->initPostData();
         				$this->curl->addRequestData('user_id', $user['id']);
         				$this->curl->addRequestData('a', 'get_dynamic_token');
         				$ret = $this->curl->request('admin/set_dynamic_token.php');
         				$ret = $ret[0];
         				if($ret['dynamic_token'] && $this->input['dynamic_token']!=$ret['dynamic_token']);
         				{
         					//$_SESSION['livmcp_userinfo'] = array();
         					//$this->show('该用户已经绑定手机密保,请安装手机客户端密保软件!');
         				}
         			}*/
     } else {
         $username = $this->input['username'];
         $password = $this->input['password'];
         if ($this->settings['admin_user']) {
             $users = $this->settings['admin_user'];
             if (!$users[$username] || md5($password) != $users[$username]) {
                 $this->show('用户名或密码错误');
             }
             $_SESSION['livmcp_userinfo'] = array('id' => -1, 'user_name' => $username, 'group_type' => 1);
         } else {
             //创建临时用户
             $this->show('用户名或密码错误');
         }
     }
     if ($this->input['ajax']) {
         $func = 'hg_dialog_close();';
     }
     if ($this->input['referto'] && strpos($this->input['referto'], '.php') && !strpos($this->input['referto'], 'login.php')) {
         $reffer = '?referto=' . urlencode($this->input['referto']);
     }
     global $gUser;
     $gUser = $user;
     include_once ROOT_PATH . 'lib/class/log.class.php';
     $log = new hglog();
     $log->add_log('登录平台');
     $this->input['goon'] = 1;
     if ($this->input['code'] && $this->channel['id'] && $this->settings['App_interactive']['mid'][$gUser['group_type']]) {
         //$this->input['code'].$this->settings['App_interactive']['host'].
         $reffer = 'run.php?mid=' . $this->settings['App_interactive']['mid'][$gUser['group_type']];
         $this->Redirect('成功登录系统.' . $license_alert, $reffer, $timedelay, 0, $func);
     } elseif ($user['default_page'] && $user['open_way'] == 1) {
         header('Location:' . $user['default_page']);
     } else {
         $this->Redirect('成功登录系统.' . $license_alert, 'index.php' . $reffer, $timedelay, 0, $func);
     }
 }
예제 #2
0
파일: install.php 프로젝트: h3len/Project
function step1()
{
    $auth = @file_get_contents(CACHE_DIR . 'auth.tmp');
    if ($auth) {
        $auth = json_decode($auth, 1);
        if ($auth) {
            header('Location:?action=step2');
        }
    }
    global $Cfg;
    $curl = new curl($Cfg['authServer']['host'] . ':' . $Cfg['authServer']['port'], '', $Cfg['authServer']['token']);
    $curl->setSubmitType('get');
    $curl->setReturnFormat('json');
    $curl->initPostData();
    $curl->setErrorReturn('goon');
    $curl->addRequestData('a', 'create');
    $curl->addRequestData('custom_name', $_REQUEST['custom_name']);
    $curl->addRequestData('display_name', $_REQUEST['display_name']);
    $curl->addRequestData('domain', $_REQUEST['domain']);
    $curl->addRequestData('bundle_id', $_REQUEST['bundle_id']);
    $curl->addRequestData('custom_desc', $_REQUEST['custom_desc']);
    $ret = $curl->request('admin/auth_update.php');
    if (!$ret[0]['appid']) {
        $message = $ret['ErrorCode'];
        start($message);
        exit;
    }
    $licenseinfo = json_encode($ret[0]);
    file_put_contents(CACHE_DIR . 'auth.tmp', $licenseinfo);
    header('Location:?action=step2');
}
예제 #3
0
파일: index.php 프로젝트: h3len/Project
    $license = @(include './db/license.php');
    if ($license) {
        header('Location:index.php?action=install6');
    }
    include 'tpl/customer_info.tpl.php';
}
//配置程序
if ($action == 'install6') {
    $license = @(include './db/license.php');
    if (!$license) {
        include_once 'curl.php';
        $curl = new curl($Cfg['authServer']['host'] . ':' . $Cfg['authServer']['port'], '', $Cfg['authServer']['token']);
        $curl->setSubmitType('get');
        $curl->setReturnFormat('json');
        $curl->initPostData();
        $curl->setErrorReturn('goon');
        $curl->addRequestData('a', 'create');
        $curl->addRequestData('custom_name', $_REQUEST['custom_name']);
        $curl->addRequestData('display_name', $_REQUEST['display_name']);
        $curl->addRequestData('domain', $_REQUEST['domain']);
        $curl->addRequestData('bundle_id', $_REQUEST['bundle_id']);
        $curl->addRequestData('custom_desc', $_REQUEST['custom_desc']);
        $ret = $curl->request('auth_update.php');
        if (!$ret[0]['appid']) {
            $message = $ret['ErrorCode'];
            include 'tpl/customer_info.tpl.php';
            exit;
        }
        $licenseinfo = $ret[0];
        file_put_contents('./db/license.php', '<?php $licenseinfo = ' . var_export($licenseinfo, 1) . ' ?>');
    }
예제 #4
0
파일: global.php 프로젝트: h3len/Project
        $needUpAuth = true;
    } else {
        $license = hoge_de($content);
        if (!$license['appid']) {
            $needUpAuth = true;
        } else {
            $needUpAuth = false;
        }
    }
}
if ($needUpAuth) {
    include ROOT_PATH . 'lib/class/curl.class.php';
    $curl = new curl($gGlobalConfig['verify_custom_api']['host'], $gGlobalConfig['verify_custom_api']['dir']);
    $curl->setClient(CUSTOM_APPID, CUSTOM_APPKEY);
    $curl->setToken('');
    $curl->setErrorReturn('');
    $curl->setCurlTimeOut(10);
    $curl->mAutoInput = false;
    $curl->initPostData();
    $postdata = array('useappkey' => 1);
    foreach ($postdata as $k => $v) {
        $curl->addRequestData($k, $v);
    }
    $content = $curl->request('Authorization.php');
    file_put_contents(CACHE_DIR . 'expire.m2o', $content);
    $license = hoge_de($content);
}
if ($license['domain']) {
    $gGlobalConfig['license'] = $license['domain'];
}
$license['expire'] = @date('Y-m-d', $license['expire_time']);
예제 #5
0
파일: datacount.php 프로젝트: h3len/Project
 public function state_info()
 {
     $return = array();
     $runtime = $this->mRuntime['runstate'];
     $setruntime = $this->mSettime['runstate'] ? $this->mSettime['runstate'] : 43200;
     if (time() - $runtime > $setruntime) {
         $curl = new curl($this->settings['App_auth']['host'], $this->settings['App_auth']['dir']);
         $curl->setSubmitType('post');
         $curl->setCurlTimeOut(5);
         $curl->setReturnFormat('json');
         $ret = $curl->request('applications.php');
         $instlled_apps = array();
         $app_stats = array();
         if (is_array($ret)) {
             foreach ($ret as $v) {
                 $start_time = microtime();
                 $result = $this->check_status($v);
                 $v['runtime'] = hg_page_debug($start_time);
                 $v['inited'] = $result[1]['define']['INITED_APP'];
                 $v['debuged'] = $result[1]['debuged'];
                 $v['http_code'] = $result[0]['http_code'];
                 $v['db'] = $result[1]['db'];
                 $v['dbconnected'] = $result[1]['dbconnected'];
                 $v['connect_time'] = $result[1]['connect_time'];
                 $v['ip'] = gethostbyname($v['host']);
                 $v['db']['ip'] = gethostbyname($v['db']['host']);
                 $v['api_dir'] = $result[1]['api_dir'];
                 $v['config_file_purview'] = $result[1]['config_file_purview'];
                 $v['data_file_purview'] = $result[1]['data_file_purview'];
                 $v['cache_file_purview'] = $result[1]['cache_file_purview'];
                 $v['freespace'] = $result[1]['freespace'];
                 $app_stats[$v['bundle']] = $v;
             }
         }
         if ($this->settings['App_livmedia']) {
             $curl = new curl($this->settings['App_livmedia']['host'], $this->settings['App_livmedia']['dir'] . 'admin/');
             $curl->setErrorReturn('');
             $curl->setCurlTimeOut(5);
             $curl->mAutoInput = false;
             $curl->initPostData();
             $curl->addRequestData('a', 'stats');
             $vod_status = $curl->request('vod.php');
             $vod_status = $vod_status[0];
         }
         $return['appstate'] = $app_stats;
         $return['vodstate'] = $vod_status;
         $this->mRuntime['runstate'] = time();
     }
     $runtime = $this->mRuntime['livedata'];
     $setruntime = $this->mSettime['livedata'] ? $this->mSettime['livedata'] : 7200;
     if (time() - $runtime > $setruntime && $this->settings['App_live']) {
         $curl = new curl($this->settings['App_live']['host'], $this->settings['App_live']['dir']);
         $curl->setErrorReturn('');
         $curl->setCurlTimeOut(5);
         $curl->mAutoInput = false;
         $curl->initPostData();
         $curl->addRequestData('a', 'show');
         $channel = $curl->request('channel.php');
         $channels = array();
         if ($channel) {
             foreach ($channel as $c) {
                 $channel_stream = array();
                 if ($c['channel_stream']) {
                     foreach ($c['channel_stream'] as $s) {
                         $channel_stream[] = $s['m3u8'];
                     }
                 }
                 $channels[] = array('name' => $c['name'], 'code' => $c['code'], 'is_audio' => $c['is_audio'], 'time_shift' => $c['time_shift'], 'status' => $c['status'], 'channel_stream' => $channel_stream);
             }
             $return['channel'] = $channels;
         }
         $this->mRuntime['livedata'] = time();
     }
     return $return;
 }
예제 #6
0
파일: settings.php 프로젝트: h3len/Project
    public function show()
    {
        $app = $this->app;
        $curl = new curl($app['host'], $app['dir']);
        $curl->setSubmitType('post');
        $curl->setReturnFormat('json');
        $curl->initPostData();
        $curl->addRequestData('a', 'setting_group');
        $setting_groups = $curl->request('configuare.php');
        $setting_groups = $setting_groups[0];
        $curl->initPostData();
        $curl->addRequestData('a', 'settings');
        $settings = $curl->request('configuare.php');
        $sql = 'SELECT * FROM ' . DB_PREFIX . "crontab WHERE app_uniqueid='{$this->app['softvar']}'";
        $q = $this->db->query($sql);
        $crontabs = array();
        $exist_crontabs = array();
        while ($r = $this->db->fetch_array($q)) {
            $r['run_time'] = date('Y-m-d H:i:s', $r['run_time']);
            if ($r['is_use']) {
                $r['is_use'] = '是';
                $r['op'] = '停止';
            } else {
                $r['is_use'] = '否';
                $r['op'] = '启用';
            }
            $exist_crontabs[$r['mod_uniqueid']] = $r['id'];
            $crontabs[$r['id']] = $r;
        }
        $curl->initPostData();
        $curl->addRequestData('a', 'get_cron_file');
        $init_crontabs = $curl->request('configuare.php');
        $used_crontables = array();
        if ($init_crontabs) {
            $testcurl = new curl($app['host'], $app['dir'] . 'cron/');
            $testcurl->mNotInitedNeedExit = false;
            $testcurl->setErrorReturn(false);
            foreach ($init_crontabs as $cron) {
                $testcurl->initPostData();
                $testcurl->addRequestData('a', 'initcron');
                $crondata = $testcurl->request($cron);
                if (!is_array($crondata)) {
                    continue;
                }
                $crondata = $crondata[0];
                if (!$crondata['mod_uniqueid']) {
                    continue;
                }
                if ($exist_crontabs[$crondata['mod_uniqueid']]) {
                    //计划任务数据有变动
                    $data = array('name' => $crondata['name'], 'brief' => $crondata['brief'], 'file_name' => $cron);
                    hg_fetch_query_sql($data, 'crontab', 'id=' . $exist_crontabs[$crondata['mod_uniqueid']]);
                    $crontabs[$exist_crontabs[$crondata['mod_uniqueid']]]['file_name'] = $cron;
                    $crontabs[$exist_crontabs[$crondata['mod_uniqueid']]]['name'] = $data['name'];
                    $crontabs[$exist_crontabs[$crondata['mod_uniqueid']]]['brief'] = $data['brief'];
                    unset($exist_crontabs[$crondata['mod_uniqueid']]);
                } else {
                    //新增计划任务
                    $data = array('app_uniqueid' => $this->app['softvar'], 'mod_uniqueid' => $crondata['mod_uniqueid'], 'name' => $crondata['name'], 'brief' => $crondata['brief'], 'space' => $crondata['space'], 'file_name' => $cron, 'is_use' => $crondata['is_use'], 'host' => $this->app['host'], 'dir' => $this->app['dir'] . 'cron/', 'port' => 80, 'run_time' => TIMENOW, 'create_time' => TIMENOW);
                    hg_fetch_query_sql($data, 'crontab');
                    $data['id'] = $this->db->insert_id();
                    $data['run_time'] = date('Y-m-d H:i:s', $data['run_time']);
                    if ($data['is_use']) {
                        $data['is_use'] = '是';
                        $data['op'] = '停止';
                    } else {
                        $data['is_use'] = '否';
                        $data['op'] = '启用';
                    }
                    $crontabs[$data['id']] = $data;
                }
            }
            //清除已经取消的计划任务
            if ($exist_crontabs) {
                $sql = 'DELETE FROM ' . DB_PREFIX . 'crontab WHERE id IN(' . implode(',', $exist_crontabs) . ')';
                $this->db->query($sql);
                foreach ($exist_crontabs as $id) {
                    unset($crontabs[$id]);
                }
            }
        } else {
            //该应用无计划任务
            $sql = 'DELETE FROM ' . DB_PREFIX . "crontab WHERE app_uniqueid='{$this->app['softvar']}'";
            $this->db->query($sql);
            $crontabs = array();
        }
        if ($crontabs) {
            $setting_groups['cron'] = '计划任务';
        }
        /**************获取水印设置***************/
        if ($app['app_uniqueid'] != 'material' && !empty($this->settings['App_material'])) {
            $curl = new curl($this->settings['App_material']['host'], $this->settings['App_material']['dir']);
            $curl->setSubmitType('post');
            $curl->setReturnFormat('json');
            $curl->initPostData();
            $curl->setErrorReturn('');
            $curl->addRequestData('app_uniqueid', $app['app_uniqueid']);
            $curl->addRequestData('a', 'fetchWatermarkSet');
            $watermark = $curl->request('admin/material_update.php');
            isset($watermark[0]) && ($watermark = $watermark[0]);
        }
        /**************获取水印设置***************/
        if (DEVELOP_MODE) {
            $s = '<ul class="form_ul">
					<li class="i">
						<div class="form_ul_div">
							<span  class="title">&nbsp;&nbsp;&nbsp;测试配置1:</span>
							<input type="text" value="{$settings[\'define\'][\'DB_PREFIX\']}" name=\'define[DB_PREFIX]\' style="width:200px;">
							<font class="important" style="color:red"></font>
						</div>
					</li>
					<li class="i">
						<div class="form_ul_div">
							<span  class="title">&nbsp;&nbsp;&nbsp;测试配置2:</span>
							<input type="text" value="{$settings[\'base\'][\'testset\'][\'host\']}" name=\'base[testset][host]\' style="width:200px;">
							
							<font class="important" style="color:red"></font>
						</div>
					</li>
					<li class="i">
						<div class="form_ul_div">
							<span  class="title">&nbsp;&nbsp;&nbsp;测试配置21:</span>			
							{template:form/radio,base[testset][open],$settings[\'base\'][\'testset\'][\'open\'],$option}
							<font class="important" style="color:red"></font>
						</div>
					</li>
					<li class="i">
						<div class="form_ul_div">
							<span  class="title">&nbsp;&nbsp;&nbsp;测试配置3:</span>
							<input type="text" value="{$settings[\'base\'][\'testsetad\']}" name=\'base[testsetad]\' style="width:200px;">
							
							<font class="important" style="color:red"></font>
						</div>
					</li>
					<li class="i">
						<div class="form_ul_div">
							<span  class="title">&nbsp;&nbsp;&nbsp;测试配置4:</span>
							<input type="text" value="{$settings[\'base\'][\'article_status\'][1]}" name=\'base[article_status][1]\' style="width:200px;">
							<input type="text" value="{$settings[\'base\'][\'article_status\'][2]}" name=\'base[article_status][2]\' style="width:200px;">
							<input type="text" value="{$settings[\'base\'][\'article_status\'][3]}" name=\'base[article_status][3]\' style="width:200px;">
							<input type="text" value="{$settings[\'base\'][\'article_status\'][4]}" name=\'base[article_status][4]\' style="width:200px;">
							
							<font class="important" style="color:red"></font>
						</div>
					</li>
				</ul>';
            $example = nl2br(htmlspecialchars($s));
            $this->tpl->addVar('example', $example);
            $this->tpl->setScriptDir();
            $this->tpl->setTemplateVersion();
        } else {
            $this->tpl->setScriptDir('app_' . $app['softvar'] . '/');
            $this->tpl->setTemplateVersion($app['softvar'] . '/' . $app['version']);
        }
        $this->tpl->setSoftVar($app['softvar']);
        //设置软件界面
        $this->tpl->addVar('setting_groups', $setting_groups);
        $this->tpl->addVar('crontabs', $crontabs);
        $this->tpl->addVar('settings', $settings);
        $this->tpl->addVar('firstvisit', $this->input['mid']);
        $this->tpl->addVar('app_uniqueid', $this->app['softvar']);
        $this->tpl->addVar('watermark', $watermark);
        $this->tpl->outTemplate('settings');
    }
예제 #7
0
         $r['is_use'] = '是';
         $r['op'] = '停止';
     } else {
         $r['is_use'] = '否';
         $r['op'] = '启用';
     }
     $exist_crontabs[$r['mod_uniqueid']] = $r['id'];
     $crontabs[$r['id']] = $r;
 }
 $curl->initPostData();
 $curl->addRequestData('a', 'get_cron_file');
 $init_crontabs = $curl->request('configuare.php');
 $used_crontables = array();
 if ($init_crontabs) {
     $curl->mNotInitedNeedExit = false;
     $curl->setErrorReturn(false);
     foreach ($init_crontabs as $cron) {
         $curl->initPostData();
         $curl->addRequestData('a', 'initcron');
         $crondata = $curl->request('cron/' . $cron);
         if (!is_array($crondata)) {
             continue;
         }
         $crondata = $crondata[0];
         if (!$crondata['mod_uniqueid']) {
             continue;
         }
         if ($exist_crontabs[$crondata['mod_uniqueid']]) {
             //计划任务数据有变动
             $data = array('name' => $crondata['name'], 'brief' => $crondata['brief'], 'file_name' => $cron);
             hg_fetch_query_sql($data, 'crontab', 'id=' . $exist_crontabs[$crondata['mod_uniqueid']]);
예제 #8
0
파일: stats.php 프로젝트: h3len/Project
 public function show()
 {
     include ROOT_DIR . 'lib/class/cron.class.php';
     $crond = new crond();
     if ($this->settings['croncmd']) {
         $crond->setCronCmd($this->settings['croncmd']);
     }
     $cron_status = $crond->isRun();
     $curl = new curl($this->settings['verify_custom_api']['host'], $this->settings['verify_custom_api']['dir']);
     $curl->setClient(CUSTOM_APPID, CUSTOM_APPKEY);
     $curl->setToken('');
     $curl->setCurlTimeOut(5);
     $curl->setErrorReturn('');
     $curl->mAutoInput = false;
     $curl->initPostData();
     $postdata = array('a' => 'get_user_info');
     foreach ($postdata as $k => $v) {
         $curl->addRequestData($k, $v);
     }
     $license = $curl->request('get_access_token.php');
     if (!$license) {
         $this->ReportError('未获取到授权信息,请确认服务器网络正常或联系软件提供商');
     }
     if ($license['ErrorCode'] == 'APP_AUTH_EXPIRED') {
         $this->ReportError('授权已到期,请联系软件提供商');
     }
     $license = $license[0];
     if ($license['appid']) {
         $license['expire'] = date('Y-m-d', $license['expire_time']);
         $license['leftday'] = intval(($license['expire_time'] - TIMENOW) / 86400);
         $this->tpl->addVar('license', $license);
     }
     $curl = new curl($this->settings['App_auth']['host'], $this->settings['App_auth']['dir']);
     $curl->setSubmitType('post');
     $curl->setCurlTimeOut(5);
     $curl->setReturnFormat('json');
     $ret = $curl->request('applications.php');
     $instlled_apps = array();
     $app_stats = array();
     if (is_array($ret)) {
         foreach ($ret as $v) {
             $start_time = microtime();
             $result = $this->check_status($v);
             $v['runtime'] = hg_page_debug($start_time);
             $v['inited'] = $result[1]['define']['INITED_APP'];
             $v['debuged'] = $result[1]['debuged'];
             $v['http_code'] = $result[0]['http_code'];
             $v['db'] = $result[1]['db'];
             $v['dbconnected'] = $result[1]['dbconnected'];
             $v['connect_time'] = $result[1]['connect_time'];
             $v['ip'] = gethostbyname($v['host']);
             $v['db']['ip'] = gethostbyname($v['db']['host']);
             $v['api_dir'] = $result[1]['api_dir'];
             $v['config_file_purview'] = $result[1]['config_file_purview'];
             $v['data_file_purview'] = $result[1]['data_file_purview'];
             $v['cache_file_purview'] = $result[1]['cache_file_purview'];
             $v['freespace'] = $result[1]['freespace'];
             if ($v['bundle'] == $_GET['b']) {
                 print_r($v);
                 exit;
             }
             $app_stats[$v['bundle']] = $v;
         }
     }
     if ($this->settings['App_livmedia']) {
         $curl = new curl($this->settings['App_livmedia']['host'], $this->settings['App_livmedia']['dir'] . 'admin/');
         $curl->setErrorReturn('');
         $curl->setCurlTimeOut(30);
         $curl->mAutoInput = false;
         $curl->initPostData();
         $curl->addRequestData('a', 'stats');
         $vod_status = $curl->request('vod.php');
         $vod_status = $vod_status[0];
     }
     $this->tpl->addVar('app_stats', $app_stats);
     $this->tpl->addVar('vod_status', $vod_status);
     $this->tpl->addVar('cron_status', $cron_status);
     $this->tpl->outTemplate('stats');
 }