Skip to content
This repository was archived by the owner on May 9, 2019. It is now read-only.

Commit 4bd69e5

Browse files
committed
针对自定义admin目录与rewrite判断问题修正
1 parent ec88608 commit 4bd69e5

3 files changed

Lines changed: 10 additions & 7 deletions

File tree

Plugin.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
*
55
* @package AppStore
66
* @author chekun
7-
* @version 1.0.1
7+
* @version 1.0.0
88
* @link http://typecho.dilicms.com
99
*/
1010
class AppStore_Plugin implements Typecho_Plugin_Interface
@@ -37,8 +37,8 @@ public static function activate()
3737

3838
//创建菜单和路由
3939
Helper::addPanel(3, 'AppStore/market.php', '应用商店', '应用商店', 'administrator');
40-
Helper::addRoute('app.store.market', '/admin/app-store/market', 'AppStore_Action', 'market');
41-
Helper::addRoute('app.store.install', '/admin/app-store/install', 'AppStore_Action', 'install');
40+
Helper::addRoute('app.store.market', __TYPECHO_ADMIN_DIR__.'app-store/market', 'AppStore_Action', 'market');
41+
Helper::addRoute('app.store.install', __TYPECHO_ADMIN_DIR__.'app-store/install', 'AppStore_Action', 'install');
4242
}
4343

4444
/**
@@ -88,4 +88,4 @@ public static function config(Typecho_Widget_Helper_Form $form)
8888
*/
8989
public static function personalConfig(Typecho_Widget_Helper_Form $form){}
9090

91-
}
91+
}

market.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
<?php !defined('__TYPECHO_ROOT_DIR__') and exit();
2-
3-
Typecho_Response::getInstance()->redirect('/index.php/admin/app-store/market');
2+
$options = Helper::options();
3+
$siteUrl = $options->siteUrl;
4+
$isRewrite = $options->rewrite;
5+
$absUrl = ($isRewrite ? rtrim($siteUrl, '/') : $siteUrl."index.php");
6+
Typecho_Response::getInstance()->redirect($absUrl.__TYPECHO_ADMIN_DIR__.'app-store/market');

views/js.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ function init()
3434
}
3535

3636
$.ajax({
37-
url: '<?php echo str_replace('/market', '/install', Typecho_Request::getInstance()->getRequestUrl()); ?>',
37+
url: '<?php echo $options->adminUrl('app-store/install'); ?>',
3838
dataType: 'json',
3939
data: {
4040
version: $version.val(),

0 commit comments

Comments
 (0)