function thread_new_sitemap() { global $conf; $sitemap = $conf['upload_path'] . 'sitemap.xml'; !is_file($sitemap) and @touch($sitemap); if (!is_writable($sitemap)) { return; } $s = '<?xml version="1.0" encoding="UTF-8"?>' . "\r\n" . '<urlset>'; $threadlist = thread_new_find(); foreach ($threadlist as $thread) { $s .= ' <url> <loc>' . http_url_path() . $thread['url'] . '</loc> <lastmod>' . date('Y-m-d', $thread['last_date']) . '</lastmod> <changefreq>daily</changefreq> <priority>1.0</priority> </url>'; } $s .= "\r\n</urlset>"; file_put_contents($sitemap, $s); }
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'; include './plugin/xn_qq_login/qq_login.func.php'; $grouplist = group_list_cache(); $forumlist = forum_list_cache(); $action = param('action'); $http_url_path = http_url_path(); $return_url = $http_url_path . 'qq_login.php?action=return_url'; if ($action == 'login') { $link = qq_login_link($return_url); header("Location: {$link}"); // return url } elseif ($action == 'return_url') { $qq = kv_get('qq_login'); $appid = $qq['appid']; $appkey = $qq['appkey']; //$state = param('state'); $code = param('code'); // token 保存起来,提高速度 $token = qq_login_get_token($appid, $appkey, $code, $return_url); !$token and message($errno, $errstr); // 获取 openid
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'] = ''); message(-1, '服务端返回数据错误:' . $arr['message']); } $zipfile = $tmppath . $dir . '.zip'; $destpath = "./plugin/{$dir}/"; file_put_contents($zipfile, $s); xn_unzip($zipfile, $destpath); unlink($zipfile);
function get_last_version($stat) { global $conf, $time; $last_version = kv_get('last_version'); if ($time - $last_version > 86400) { kv_set('last_version', $time); $sitename = urlencode($conf['sitename']); $sitedomain = urlencode(http_url_path()); $version = urlencode($conf['version']); return '<script src="http://custom.xiuno.com/version.htm?sitename=' . $sitename . '&sitedomain=' . $sitedomain . '&users=' . $stat['users'] . '&threads=' . $stat['threads'] . '&posts=' . $stat['posts'] . '&version=' . $version . '"></script>'; } else { return ''; } }