コード例 #1
0
ファイル: app_pack.php プロジェクト: kevin2010/zblogphp
$zbp->Load();

$action='root';
if (!$zbp->CheckRights($action)) {$zbp->ShowError(6);die();}

if (!$zbp->CheckPlugin('AppCentre')) {$zbp->ShowError(48);die();}

$type = $_GET['type'];

$id = $_GET['id'];

$app=new App;

if (!$app->LoadInfoByXml($type,$id)) exit;

ob_clean();

header('Content-Type: application/octet-stream');

if
	(function_exists('gzencode') && 
	method_exists('App','PackGZip') && 
	$zbp->Config('AppCentre')->enablegzipapp &&
	$app->adapted > 140614 // 1.3和之前版本不打包为gzba
){
	header('Content-Disposition:attachment;filename='. $id .'.gzba');
	echo $app->PackGZip();
} else{
	header('Content-Disposition:attachment;filename='. $id .'.zba');
	echo $app->Pack();
}
コード例 #2
0
ファイル: function.php プロジェクト: kevin2010/zblogphp
function Server_Open($method)
{
    global $zbp, $blogversion;
    switch ($method) {
        case 'down':
            Add_Filter_Plugin('Filter_Plugin_Zbp_ShowError', 'ScriptError', PLUGIN_EXITSIGNAL_RETURN);
            header('Content-type: application/x-javascript; Charset=utf-8');
            ob_clean();
            $s = Server_SendRequest(APPCENTRE_URL . '?down=' . GetVars('id', 'GET'));
            if (App::UnPack($s)) {
                $zbp->SetHint('good', '下载APP并解压安装成功!');
            }
            die;
            break;
        case 'search':
            if (trim(GetVars('q', 'GET')) == '') {
                continue;
            }
            $s = Server_SendRequest(APPCENTRE_URL . '?search=' . urlencode(GetVars('q', 'GET')));
            echo str_replace('%bloghost%', $zbp->host . 'zb_users/plugin/AppCentre/main.php', $s);
            break;
        case 'view':
            $s = Server_SendRequest(APPCENTRE_URL . '?' . GetVars('QUERY_STRING', 'SERVER'));
            if (strpos($s, '<!--developer-nologin-->') !== false) {
                if ($zbp->Config('AppCentre')->username || $zbp->Config('AppCentre')->password) {
                    $zbp->Config('AppCentre')->username = '';
                    $zbp->Config('AppCentre')->password = '';
                    $zbp->SaveConfig('AppCentre');
                }
            }
            if (strpos($s, '<!--shop-nologin-->') !== false) {
                if ($zbp->Config('AppCentre')->shop_username || $zbp->Config('AppCentre')->shop_password) {
                    $zbp->Config('AppCentre')->shop_username = '';
                    $zbp->Config('AppCentre')->shop_password = '';
                    $zbp->SaveConfig('AppCentre');
                }
            }
            if (strpos($s, 'app.zblogcn.com') === false) {
                $zbp->ShowHint('bad', '后台访问应用中心故障,不能登录和下载应用,请检查主机空间是否能远程访问app.zblogcn.com。');
            }
            echo str_replace('%bloghost%', $zbp->host . 'zb_users/plugin/AppCentre/main.php', $s);
            break;
        case 'check':
            $s = Server_SendRequest(APPCENTRE_URL . '?check=' . urlencode(AppCentre_GetCheckQueryString())) . '';
            echo str_replace('%bloghost%', $zbp->host . 'zb_users/plugin/AppCentre/main.php', $s);
            break;
        case 'checksilent':
            header('Content-type: application/x-javascript; Charset=utf-8');
            ob_clean();
            $s = Server_SendRequest(APPCENTRE_URL . '?blogsilent=1' . ($zbp->Config('AppCentre')->checkbeta ? '&betablog=1' : '') . '&check=' . urlencode(AppCentre_GetCheckQueryString())) . '';
            if (strpos($s, ';') !== false) {
                $newversion = substr($s, 0, 6);
                $s = str_replace($newversion . ';', '', $s);
                if ((int) $newversion > (int) $blogversion) {
                    echo '$(".main").prepend("<div class=\'hint\'><p class=\'hint hint_tips\'>提示:Z-BlogPHP有新版本,请用APP应用中心插件的<a href=\'../../zb_users/plugin/AppCentre/update.php\'>“系统更新与校验”</a>升级' . $newversion . '版(' . ($zbp->Config('AppCentre')->checkbeta ? 'Beta' : '') . ').</p></div>");';
                }
            }
            if ($s != 0) {
                echo '$(".main").prepend("<div class=\'hint\'><p class=\'hint hint_tips\'>提示:有' . $s . '个应用需要更新,请在应用中心的<a href=\'../../zb_users/plugin/AppCentre/main.php?method=check\'>“检查应用更新”</a>页升级.</p></div>");';
            }
            die;
            break;
        case 'vaild':
            $data = array();
            $data["username"] = GetVars("app_username");
            $data["password"] = md5(GetVars("app_password"));
            $s = Server_SendRequest(APPCENTRE_URL . '?vaild', $data);
            return $s;
            break;
        case 'submitpre':
            $s = Server_SendRequest(APPCENTRE_URL . '?submitpre=' . urlencode(GetVars('id')));
            return $s;
        case 'submit':
            $app = new App();
            $app->LoadInfoByXml($_GET['type'], $_GET['id']);
            $data["zba"] = $app->Pack();
            $s = Server_SendRequest(APPCENTRE_URL . '?submit=' . urlencode(GetVars('id')), $data);
            return $s;
        case 'shopvaild':
            $data = array();
            $data["shop_username"] = GetVars("shop_username");
            $data["shop_password"] = md5(GetVars("shop_password"));
            $s = Server_SendRequest(APPCENTRE_URL . '?shopvaild', $data);
            return $s;
            break;
        case 'shoplist':
            $s = Server_SendRequest(APPCENTRE_URL . '?shoplist');
            echo str_replace('%bloghost%', $zbp->host . 'zb_users/plugin/AppCentre/main.php', $s);
            break;
        case 'apptype':
            $zbp->Config('AppCentre')->apptype = GetVars("type");
            $zbp->SaveConfig('AppCentre');
            Redirect('main.php');
            break;
        default:
            # code...
            break;
    }
}