function qq_login_get_openid_by_token($token)
{
    $get_openid_url = "https://graph.qq.com/oauth2.0/me?access_token={$token}";
    $s = https_get($get_openid_url);
    if (strpos($s, "callback") !== false) {
        $lpos = strpos($s, "(");
        $rpos = strrpos($s, ")");
        $s = substr($s, $lpos + 1, $rpos - $lpos - 1);
    }
    $arr = xn_json_decode($s);
    if (isset($arr['error'])) {
        $error = $arr['error'] . '<br />' . $arr['error_description'];
        return xn_error(-1, $error);
    }
    return $arr['openid'];
}
Example #2
0
    message(0, '删除成功');
    // 接受 base64 文件上传
} elseif ($action == 'upload') {
    // 允许的文件后缀名
    $types = (include './conf/attach.conf.php');
    $allowtypes = $types['all'];
    empty($uid) and message(-1, '游客不允许上传文件');
    empty($group['allowattach']) and $gid != 1 and message(-1, '您无权上传');
    $conf['ipaccess_on'] and !ipaccess_check($longip, 'attachs') and message(-1, '您的 IP 今日上传附件数达到上限,请明天再来。');
    $conf['ipaccess_on'] and !ipaccess_check($longip, 'attachsizes') and message(-1, '您的 IP 今日上传附件尺寸达到上限,请明天再来。');
    $isimage = param(2, 0);
    $tid = 0;
    $fid = 0;
    $upfile = param('upfile', '', FALSE);
    empty($upfile) and message(-1, 'upfile 数据为空');
    $json = xn_json_decode($upfile);
    empty($json) and message(-1, '数据有问题: json 为空');
    $name = $json['name'];
    $width = $json['width'];
    $height = $json['height'];
    $data = base64_decode($json['data']);
    $size = strlen($data);
    $type = attach_type($name, $types);
    empty($data) and message(-1, '数据有问题, data 为空');
    if ($isimage && $conf['tietuku_on']) {
        include './plugin/xn_tietuku/tietuku.func.php';
        $tmpfile = tempnam($conf['tmp_path'], 'tmp_');
        file_put_contents($tmpfile, $data);
        $r = tietuku_upload_file($tmpfile);
        $r === FALSE and message($errno, $errstr);
        unlink($tmpfile);
Example #3
0
<?php

/*
	Xiuno BBS 3.0 插件实例
	广告插件卸载程序
*/
define('DEBUG', 1);
// 发布的时候改为 0
define('APP_NAME', 'bbs');
// 应用的名称
define('APP_PATH', '../../');
// 应用的路径
chdir(APP_PATH);
$conf = (include './conf/conf.php');
include './xiunophp/xiunophp.php';
include './model.inc.php';
$pconf = xn_json_decode(file_get_contents('./plugin/xn_ad/conf.json'));
$pconf['installed'] == 0 and message(-1, '插件已经卸载。');
$user = user_token_get('', 'bbs');
$user['gid'] != 1 and message(-1, jump('需要管理员权限才能完成卸载。', 'user-login.htm'));
// 第一处卸载
plugin_unstall_before('./pc/view/thread.htm', '<?php echo $first[\'message\']; ?>', file_get_contents('./plugin/xn_ad/ad_1.htm'));
// 第二处卸载
plugin_install_remove('./pc/view/footer_debug.inc.htm', file_get_contents('./plugin/xn_ad/ad_2.htm'));
json_conf_set('installed', 0, './plugin/xn_ad/conf.json');
message(0, '卸载完成!');
Example #4
0
function online_get($k)
{
    global $g_online_data, $sid;
    if (empty($g_online_data)) {
        $online = online_read($sid);
        if (empty($online)) {
            $online = online_save(TRUE);
        }
        $g_online_data = $online['data'] ? xn_json_decode($online['data']) : array();
    }
    return array_value($g_online_data, $k, NULL);
}
Example #5
0
function kv_get($k)
{
    $k = addslashes($k);
    $arr = db_find_one("SELECT k,v FROM bbs_kv WHERE k='{$k}'");
    return $arr ? xn_json_decode($arr['v']) : NULL;
}
Example #6
0
    $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'] = '');
        message(-1, '服务端返回数据错误:' . $arr['message']);
    }
    $zipfile = $tmppath . $dir . '.zip';
    $destpath = "./plugin/{$dir}/";
    file_put_contents($zipfile, $s);
    xn_unzip($zipfile, $destpath);
    unlink($zipfile);
    if (!is_dir("./plugin/{$dir}")) {
        message(-1, "插件可能下载失败,目录不存在: plugin/{$dir}");
    } else {
        message(0, '插件下载解压成功:' . $destpath);
    }
}
Example #7
0
<?php

/*
	Xiuno BBS 3.0 插件实例
	代码高亮插件安装程序
*/
define('DEBUG', 0);
// 发布的时候改为 0
define('APP_NAME', 'bbs');
// 应用的名称
define('APP_PATH', '../../');
// 应用的名称
chdir(APP_PATH);
$conf = (include './conf/conf.php');
include './xiunophp/xiunophp.php';
include './model.inc.php';
$pconf = xn_json_decode(file_get_contents('./plugin/xn_syntax_highlighter/conf.json'));
$pconf['installed'] == 1 and message(-1, '插件已经安装,请不要重复安装。');
$user = user_token_get('', 'bbs');
$user['gid'] != 1 and message(-1, jump('需要管理员权限才能完成安装。', 'user-login.htm'));
//---------------> 第一处插入,末尾追加
plugin_install_append('./pc/view/thread.htm', file_get_contents('./plugin/xn_syntax_highlighter/thread_end.htm'));
json_conf_set('installed', 1, './plugin/xn_syntax_highlighter/conf.json');
message(0, '安装完成!');
 public function get($k)
 {
     if (!$this->link && !$this->connect()) {
         return FALSE;
     }
     $time = time();
     $arr = $this->db->find_one("SELECT * FROM `{$this->table}` WHERE k='{$k}'");
     if (!$arr) {
         return NULL;
     }
     if ($arr['expiry'] && $time > $arr['expiry']) {
         $this->db->exec("DELETE FROM `{$this->table}` WHERE k='{$k}'", $this->link);
         return NULL;
     }
     return xn_json_decode($arr['v'], 1);
 }
Example #9
0
function plugin_local_read($dir)
{
    $empty = array('name' => '', 'version' => '1.0', 'bbs_version' => '3.0', 'brief' => '无', 'installed' => 0, 'dir' => $dir, 'icon_url' => 'static/plugin_icon.png', 'is_official' => 0);
    if (!is_file("./plugin/{$dir}/conf.json")) {
        return $empty;
    }
    $plugin = xn_json_decode(file_get_contents("./plugin/{$dir}/conf.json"));
    $plugin and $r['dir'] = $dir;
    empty($plugin['installed']) and $plugin['installed'] = 0;
    $plugin['icon_url'] = "plugin/{$dir}/icon.png";
    $plugin['setting_url'] = is_file("./plugin/{$dir}/setting.php") ? "plugin/{$dir}/setting.php" : '';
    $plugin['dir'] = $dir;
    $plugin['is_official'] = 0;
    return $plugin ? $plugin : $empty;
}