Skip to content

Commit

Permalink
支持非根目录安装,修复rss输出页面的BUG
Browse files Browse the repository at this point in the history
  • Loading branch information
bg5sbk committed Dec 20, 2013
1 parent 61b9a75 commit 8abaa28
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 7 deletions.
9 changes: 7 additions & 2 deletions build.php
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,11 @@ function vMiddle(inner){
<?php if (!is_file('mc-files/mc-conf.php')) { ?>
<label>网站标题</label>
<div class="textbox"><input type="text" name="sitename" value="我的网站"/></div>
<label>网站地址</label>
<div class="textbox"><input type="text" name="sitelink" id="sitelink" value=""/></div>
<script type="text/javascript">
document.getElementById('sitelink').value = location.href.substring(0, location.href.lastIndexOf('/'));
</script>
<label>您的昵称</label>
<div class="textbox"><input type="text" name="nickname" value="神秘人"/></div>
<label>后台账号</label>
Expand Down Expand Up @@ -201,7 +206,7 @@ function install(\$file, \$content) {
if (!@file_put_contents('mc-files/mc-conf.php',
"<?php \\\$mc_config = array(".
"'version' => '\$version',".
"'site_link' => '',".
"'site_link' => '{\$_POST['sitelink']}',".
"'site_name' => '{\$_POST['sitename']}',".
"'site_desc' => '又一个MiniCMS网站',".
"'user_name' => '{\$_POST['username']}',".
Expand Down Expand Up @@ -271,7 +276,7 @@ function install(\$file, \$content) {
<div style=\"text-align:center;padding-top:20px;color:red;\">安装文件无法删除,请手工删除。</div>
<?php } ?>
<div style="text-align:center;padding:20px 0 0;">
<form method="get" action="/mc-admin">
<form method="get" action="mc-admin/">
<input type="submit" value="开始体验" class="btn btn-primary"/>
</form>
</div>
Expand Down
4 changes: 2 additions & 2 deletions mc-admin/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@
$token = $_COOKIE['mc_token'];

if ($token == md5($mc_config['user_name'].'_'.$mc_config['user_pass'])) {
Header("Location:/mc-admin/post.php");
Header("Location:{$mc_config['site_link']}/mc-admin/post.php");
}
}

if (isset($_POST['login'])) {
if ($_POST['user'] == $mc_config['user_name']
&& $_POST['pass'] == $mc_config['user_pass']) {
setcookie('mc_token', md5($mc_config['user_name'].'_'.$mc_config['user_pass']));
Header("Location:/mc-admin/post.php");
Header("Location:{$mc_config['site_link']}/mc-admin/post.php");
}
}
?>
Expand Down
2 changes: 1 addition & 1 deletion mc-admin/page-edit.php
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ function empty_textbox_blur(target) {
<input type="hidden" name="_IS_POST_BACK_" value=""/>
<?php if ($succeed) { ?>
<?php if ($page_state == 'publish') { ?>
<div class="updated">页面已发布。 <a href="/?<?php echo $page_path; ?>/" target="_blank">查看页面</a></div>
<div class="updated">页面已发布。 <a href="<?php echo $mc_config['site_link']; ?>/?<?php echo $page_path; ?>/" target="_blank">查看页面</a></div>
<?php } else { ?>
<div class="updated">页面已保存到“草稿箱”。 <a href="page.php?state=draft">打开草稿箱</a></div>
<?php } ?>
Expand Down
2 changes: 1 addition & 1 deletion mc-admin/post-edit.php
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ function empty_textbox_blur(target) {
<input type="hidden" name="_IS_POST_BACK_" value=""/>
<?php if ($succeed) { ?>
<?php if ($post_state == 'publish') { ?>
<div class="updated">文章已发布。 <a href="/?post/<?php echo $post_id; ?>" target="_blank">查看文章</a></div>
<div class="updated">文章已发布。 <a href="<?php echo $mc_config['site_link']; ?>/?post/<?php echo $post_id; ?>" target="_blank">查看文章</a></div>
<?php } else { ?>
<div class="updated">文章已保存到“草稿箱”。 <a href="post.php?state=draft">打开草稿箱</a></div>
<?php } ?>
Expand Down
2 changes: 1 addition & 1 deletion mc-files/mc-rss.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php header("Content-Type: application/rss+xml"); ?>
<?xml version="1.0" encoding="UTF-8"?>
<?php echo '<?xml version="1.0" encoding="UTF-8"?>'; ?>
<rss version="2.0"
xmlns:content="http://purl.org/rss/1.0/modules/content/"
xmlns:wfw="http://wellformedweb.org/CommentAPI/"
Expand Down

0 comments on commit 8abaa28

Please sign in to comment.