diff --git a/application/admin/common.php b/application/admin/common.php
index ccd9c49a..5a73c6b1 100644
--- a/application/admin/common.php
+++ b/application/admin/common.php
@@ -89,7 +89,7 @@ function build_category_select($name, $type, $selected = null, $attr = [], $head
function build_toolbar($btns = NULL, $attr = [])
{
$auth = \app\admin\library\Auth::instance();
- $controller = str_replace('.','/',strtolower(think\Request::instance()->controller()));
+ $controller = str_replace('.', '/', strtolower(think\Request::instance()->controller()));
$btns = $btns ? $btns : ['refresh', 'add', 'edit', 'del'];
$btns = is_array($btns) ? $btns : explode(',', $btns);
$index = array_search('delete', $btns);
@@ -125,12 +125,16 @@ function build_toolbar($btns = NULL, $attr = [])
* @param string $content
* @return string
*/
-function build_heading($title = NULL, $content = NULL)
+function build_heading($title = NULL, $content = NULL, $path = NULL)
{
if (is_null($title) && is_null($content))
{
- $path = request()->pathinfo();
- $path = $path[0] == '/' ? $path : '/' . $path;
+ if (is_null($path))
+ {
+ $action = request()->action();
+ $controller = str_replace('.', '/', request()->controller());
+ $path = strtolower($controller . ($action && $action != 'index' ? '/' . $action : ''));
+ }
// 根据当前的URI自动匹配父节点的标题和备注
$data = Db::name('auth_rule')->where('name', $path)->field('title,remark')->find();
if ($data)
diff --git a/application/admin/controller/Addon.php b/application/admin/controller/Addon.php
index de368e0e..2fdd3453 100644
--- a/application/admin/controller/Addon.php
+++ b/application/admin/controller/Addon.php
@@ -121,10 +121,12 @@ class Addon extends Backend
}
try
{
- Service::install($name, $force);
+ $uid = $this->request->post("uid");
+ $token = $this->request->post("token");
+ Service::install($name, $force, ['uid' => $uid, 'token' => $token]);
$info = get_addon_info($name);
$info['config'] = get_addon_config($name) ? 1 : 0;
- $this->success("安装成功", null, ['addon' => $info]);
+ $this->success(__('Install successful'), null, ['addon' => $info]);
}
catch (AddonException $e)
{
@@ -150,7 +152,7 @@ class Addon extends Backend
try
{
Service::uninstall($name, $force);
- $this->success("卸载成功");
+ $this->success(__('Uninstall successful'));
}
catch (AddonException $e)
{
@@ -179,7 +181,7 @@ class Addon extends Backend
$action = $action == 'enable' ? $action : 'disable';
//调用启用、禁用的方法
Service::$action($name, $force);
- $this->success("操作成功");
+ $this->success(__('Operate successful'));
}
catch (AddonException $e)
{
@@ -197,7 +199,7 @@ class Addon extends Backend
public function local()
{
Config::set('default_return_type', 'json');
-
+
$file = $this->request->file('file');
$addonTmpDir = RUNTIME_PATH . 'addons' . DS;
if (!is_dir($addonTmpDir))
@@ -217,20 +219,20 @@ class Addon extends Backend
$infoFile = $tmpAddonDir . 'info.ini';
if (!is_file($infoFile))
{
- throw new Exception("插件配置文件未找到");
+ throw new Exception(__('Addon info file was not found'));
}
$config = Config::parse($infoFile, '', $tmpName);
$name = isset($config['name']) ? $config['name'] : '';
if (!$name)
{
- throw new Exception("插件配置信息不正确");
+ throw new Exception(__('Addon info file data incorrect'));
}
$newAddonDir = ADDON_PATH . $name . DS;
if (is_dir($newAddonDir))
{
- throw new Exception("上传的插件已经存在");
+ throw new Exception(__('Addon already exists'));
}
//重命名插件文件夹
@@ -255,9 +257,9 @@ class Addon extends Backend
//导入SQL
Service::importsql($name);
-
+
$info['config'] = get_addon_config($name) ? 1 : 0;
- $this->success("插件安装成功,你需要手动启用该插件,使之生效", null, ['addon' => $info]);
+ $this->success(__('Installed tips'), null, ['addon' => $info]);
}
catch (Exception $e)
{
@@ -287,7 +289,7 @@ class Addon extends Backend
try
{
Service::refresh();
- $this->success("操作成功");
+ $this->success(__('Operate successful'));
}
catch (Exception $e)
{
@@ -295,4 +297,53 @@ class Addon extends Backend
}
}
+ /**
+ * 已装插件
+ */
+ public function downloaded()
+ {
+ $offset = (int) $this->request->get("offset");
+ $limit = (int) $this->request->get("limit");
+ $filter = $this->request->get("filter");
+ $filter = (array) json_decode($filter, true);
+ foreach ($filter as $k => &$v)
+ {
+ $v = htmlspecialchars(strip_tags($v));
+ }
+ unset($v);
+ $where = ['status' => 'normal'];
+ if (isset($filter['id']))
+ {
+ $where['id'] = (int) $filter['id'];
+ }
+ if (isset($filter['name']))
+ {
+ $where['name'] = ['like', "%{$filter['name']}%"];
+ }
+ if (isset($filter['title']))
+ {
+ $where['title'] = ['like', "%{$filter['title']}%"];
+ }
+
+ $addons = get_addon_list();
+ $list = [];
+ foreach ($addons as $k => $v)
+ {
+ $v['flag'] = '';
+ $v['banner'] = '';
+ $v['image'] = '';
+ $v['donateimage'] = '';
+ $v['demourl'] = '';
+ $v['price'] = '0.00';
+ $v['url'] = '/addons/' . $v['name'];
+ $v['createtime'] = 0;
+ $list[] = $v;
+ }
+ $list = array_slice($list, $offset, $limit);
+ $result = array("total" => count($addons), "rows" => $list);
+
+ $callback = $this->request->get('callback') ? "jsonp" : "json";
+ return $callback($result);
+ }
+
}
diff --git a/application/admin/lang/zh-cn/addon.php b/application/admin/lang/zh-cn/addon.php
index 8a438075..be91ce44 100644
--- a/application/admin/lang/zh-cn/addon.php
+++ b/application/admin/lang/zh-cn/addon.php
@@ -1,9 +1,59 @@
'ID',
- 'Title' => '标题',
- 'Value' => '配置值',
- 'Array key' => '键',
- 'Array value' => '值',
+ 'Id' => 'ID',
+ 'Title' => '标题',
+ 'Value' => '配置值',
+ 'Array key' => '键',
+ 'Array value' => '值',
+ 'File' => '文件',
+ 'Warmtips' => '温馨提示',
+ 'Offline install' => '离线安装',
+ 'Refresh addon cache' => '刷新插件缓存',
+ 'Userinfo' => '会员信息',
+ 'Online store' => '在线商店',
+ 'Local addon' => '本地插件',
+ 'Https tips' => '当前你无法在插件管理中在线安装FastAdmin市场中的插件,请前往 FastAdmin插件市场 中下载后进行离线安装。',
+ 'Conflict tips' => '此插件中发现和现有系统中部分文件发现冲突!以下文件将会被影响,请备份好相关文件后再继续操作',
+ 'Login tips' => '此处登录账号为FastAdmin官网账号',
+ 'Logined tips' => '你好!%s
当前你已经登录,将同步保存你的购买记录',
+ 'Pay tips' => '支付完成后请稍等1~5分钟后再尝试安装,请不要重复支付,如果仍然无法安装,请加QQ群:636393962向管理员反馈',
+ 'Pay click tips' => '请点击这里在新窗口中进行支付!',
+ 'Pay new window tips' => '请在新弹出的窗口中进行支付,支付完成后再重新点击安装按钮进行安装!',
+ 'Uninstall tips' => '确认卸载插件?
卸载将会删除所有插件文件且不可找回!!! 插件如果有创建数据库表请手动删除!!!
如有重要数据请备份后再操作!', + 'Installed tips' => '插件安装成功,你需要手动启用该插件,使之生效', + 'Recommend' => '推荐', + 'Hot' => '热门', + 'New' => '新', + 'Free' => '免费', + 'Sale' => '折扣', + 'No image' => '暂无缩略图', + 'Author' => '作者', + 'Intro' => '介绍', + 'Version' => '版本', + 'Createtime' => '添加时间', + 'Demo' => '在线演示', + 'Install' => '安装', + 'Uninstall' => '卸载', + 'Setting' => '配置', + 'Disable' => '禁用', + 'Enable' => '启用', + 'Your username or email' => '你的用户名或邮箱', + 'Your password' => '你的密码', + 'Login FastAdmin' => '登录FastAdmin', + 'Login' => '登录', + 'Logout' => '退出登录', + 'Register' => '注册账号', + 'You\'re not login' => '当前未登录', + 'Pay now' => '立即支付', + 'Continue install' => '继续安装', + 'Continue uninstall' => '继续安装', + 'Continue operate' => '继续操作', + 'Install successful' => '安装成功', + 'Uninstall successful' => '卸载成功', + 'Operate successful' => '操作成功', + 'Addon info file was not found' => '插件配置文件未找到', + 'Addon info file data incorrect' => '插件配置文件未找到', + 'Addon info file data incorrect' => '插件配置信息不正确', + 'Addon already exists' => '上传的插件已经存在', ]; diff --git a/application/admin/view/addon/index.html b/application/admin/view/addon/index.html index a4712ea7..12234e4e 100644 --- a/application/admin/view/addon/index.html +++ b/application/admin/view/addon/index.html @@ -1,6 +1,9 @@ +