Example #1
0
    $pluginlist = plugin_official_list(array(), array(), $page, $pagesize);
    $total = plugin_official_total();
    $pages = pages('admin/plugin-official_list-{page}.htm', $total, $page, $pagesize);
    include "./admin/view/plugin_official_list.htm";
} elseif ($action == 'read') {
    $dir = param(2);
    $plugin = plugin_read($dir);
    empty($plugin) and message(-1, '插件不存在');
    include "./admin/view/plugin_read.htm";
    // 下载官方插件。
} elseif ($action == 'download') {
    $tmppath = ini_get('upload_tmp_dir') . '/';
    $tmppath == '/' and $tmppath = './tmp/';
    $dir = param(2);
    !preg_match('#^\\w+$#', $dir) and message(-1, 'dir 不合法。');
    $official = plugin_official_read($dir);
    empty($official) and message(-1, '插件不存在');
    // 检查版本
    if (version_compare($conf['version'], $official['bbs_version']) == -1) {
        message(-1, "此插件依赖的 Xiuno BBS 最低版本为 {$official['bbs_version']} ,您当前的版本:" . $conf['version']);
    }
    // 下载,解压,校验
    $app_url = http_url_path();
    $siteid = md5($app_url . $conf['auth_key']);
    $app_url = urlencode($app_url);
    $url = "http://plugin.xiuno.com/plugin-down-dir-{$dir}-siteid-{$siteid}-ajax-1.htm?app_url={$app_url}";
    // 服务端开始下载
    $s = http_get($url, 60);
    if (empty($s) || substr($s, 0, 2) != 'PK') {
        $arr = xn_json_decode($s);
        empty($arr['message']) && ($arr['message'] = '');
Example #2
0
function plugin_read($dir)
{
    if (is_dir("./plugin/{$dir}")) {
        $plugin = plugin_local_read($dir);
    } else {
        $plugin = plugin_official_read($dir);
    }
    return $plugin;
}