Skip to content

Commit

Permalink
v4.0
Browse files Browse the repository at this point in the history
# v4.0

* ginkgo 升级至 0.2.4
* 做了兼容 PHP 7 的调整
* 优化界面代码
* 修复部分 bug
  • Loading branch information
fonering committed Jun 4, 2022
1 parent 8e06735 commit 598d8bb
Show file tree
Hide file tree
Showing 330 changed files with 5,265 additions and 4,763 deletions.
Binary file modified .DS_Store
Binary file not shown.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ http://server/index.php/console/

# 在线帮助

<http://doc.baigo.net/sso/>
https://doc.baigo.net/sso/
2 changes: 1 addition & 1 deletion app/classes/api/ctrl.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ protected function notify($str_src, $str_act) {
'status' => 'enable',
'has_notify' => true,
);
$_arr_appRows = $this->mdl_app->lists(100, 0, $_arr_search);
$_arr_appRows = $this->mdl_app->lists(array(100, 'limit'), $_arr_search);

//通知
foreach ($_arr_appRows as $_key=>$_value) {
Expand Down
76 changes: 52 additions & 24 deletions app/classes/console/ctrl.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ abstract class Ctrl extends Ctrl_Base {

protected $adminAllow = array();

protected $adminLogged = array(
protected $_arr_adminLogged = array(
'admin_status' => '',
);

Expand All @@ -44,9 +44,15 @@ protected function c_init($param = array()) { //构造函数
$this->obj_auth = Auth::instance(array(), 'admin');
$this->mdl_login = Loader::model('Login', '', 'console');

$this->hrefBase = $this->url['route_console'];

$_arr_adminLogged = $this->sessionRead();

//print_r($_arr_adminLogged);
if (isset($_arr_adminLogged['admin_shortcut']) && Func::notEmpty($_arr_adminLogged['admin_shortcut'])) {
foreach ($_arr_adminLogged['admin_shortcut'] as $_key=>&$_value) {
$_value['href'] = $this->url['route_console'] . $_value['ctrl'] . '/' . $_value['act']. '/';
}
}

if (isset($_arr_adminLogged['admin_type']) && $_arr_adminLogged['admin_type'] == 'super') {
$this->isSuper = true;
Expand All @@ -56,8 +62,12 @@ protected function c_init($param = array()) { //构造函数
$this->adminAllow = $_arr_adminLogged['admin_allow'];
}

$this->generalData['adminLogged'] = $_arr_adminLogged;
$this->adminLogged = $_arr_adminLogged;
$this->generalData['hrefRow'] = array(
'logout' => $this->url['route_console'] . 'login/logout/',
);

$this->generalData['adminLogged'] = $_arr_adminLogged;
$this->adminLogged = $_arr_adminLogged;
}


Expand Down Expand Up @@ -187,35 +197,53 @@ private function chkInstall() {
}


protected function pathProcess() {
parent::pathProcess();
protected function configProcess() {
parent::configProcess();

$_str_pathTplConsole = GK_PATH_TPL;
$_arr_configOptExtra = Config::get('opt_extra', 'console');

if (Func::notEmpty($this->tplPath)) {
$_str_pathTplConsole = GK_APP_TPL . 'console' . DS . $this->tplPath . DS;
}
$_str_configOpt = BG_PATH_CONFIG . 'console' . DS . 'opt' . GK_EXT_INC;
$_arr_configOpt = Config::load($_str_configOpt, 'opt', 'console');

$_arr_url = array(
'path_tpl_console' => $_str_pathTplConsole,
);
$_str_configConsoleMod = BG_PATH_CONFIG . 'console' . DS . 'console_mod' . GK_EXT_INC;
$_arr_configConsoleMod = Config::load($_str_configConsoleMod, 'console_mod', 'console');

$this->url = array_replace_recursive($this->url, $_arr_url);
$_str_configProfile = BG_PATH_CONFIG . 'console' . DS . 'profile_mod' . GK_EXT_INC;
$_arr_configProfile = Config::load($_str_configProfile, 'profile_mod', 'console');

$this->generalData = array_replace_recursive($this->generalData, $_arr_url);
}
if (is_array($_arr_configOptExtra) && Func::notEmpty($_arr_configOptExtra)) {
foreach ($_arr_configOptExtra as $_key_m=>&$_value_m) {
$_value_m['href'] = $this->url['route_console'] . $_value_m['ctrl'] . '/' . $_value_m['act'] . '/';
}
}

if (is_array($_arr_configOpt) && Func::notEmpty($_arr_configOpt)) {
foreach ($_arr_configOpt as $_key_m=>&$_value_m) {
$_value_m['href'] = $this->url['route_console'] . 'opt/' . $_key_m . '/';
}
}

protected function configProcess() {
parent::configProcess();
if (is_array($_arr_configConsoleMod) && Func::notEmpty($_arr_configConsoleMod)) {
foreach ($_arr_configConsoleMod as $_key_m=>&$_value_m) {
$_value_m['main']['href'] = $this->url['route_console'] . $_value_m['main']['ctrl'] . '/';

$_str_configOpt = BG_PATH_CONFIG . 'console' . DS . 'opt' . GK_EXT_INC;
Config::load($_str_configOpt, 'opt', 'console');
if (isset($_value_m['lists']) && Func::notEmpty($_value_m['lists'])) {
foreach ($_value_m['lists'] as $_key_s=>&$_value_s) {
$_value_s['href'] = $this->url['route_console'] . $_value_s['ctrl'] . '/' . $_value_s['act'] . '/';
}
}
}
}

$_str_configConsoleMod = BG_PATH_CONFIG . 'console' . DS . 'console_mod' . GK_EXT_INC;
Config::load($_str_configConsoleMod, 'console_mod', 'console');
if (is_array($_arr_configProfile) && Func::notEmpty($_arr_configProfile)) {
foreach ($_arr_configProfile as $_key_m=>&$_value_m) {
$_value_m['href'] = $this->url['route_console'] . 'profile/' . $_key_m . '/';
}
}

$_str_configProfile = BG_PATH_CONFIG . 'console' . DS . 'profile_mod' . GK_EXT_INC;
Config::load($_str_configProfile, 'profile_mod', 'console');
Config::set('opt_extra', $_arr_configOptExtra, 'console');
Config::set('opt', $_arr_configOpt, 'console');
Config::set('console_mod', $_arr_configConsoleMod, 'console');
Config::set('profile_mod', $_arr_configProfile, 'console');
}
}
46 changes: 33 additions & 13 deletions app/classes/ctrl.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,34 +22,50 @@
abstract class Ctrl extends Gk_Ctrl {

protected $isAjaxPost = false;
protected $isAjax = false;
protected $isPost = false;
protected $isGet = false;
protected $generalData = array();
protected $url = array();
protected $config;
protected $tplPath;
protected $hrefBase;

protected function c_init($param = array()) { //构造函数
$this->configProcess();
$this->pathProcess();
$this->configProcess();
$this->configAdd();

if ($this->obj_request->isAjax() && $this->obj_request->isPost()) {
$this->isAjaxPost = true;
$this->isPost = true;
$this->isAjaxPost = true;
$this->isAjax = true;
$this->isPost = true;
}

if ($this->obj_request->isAjax()) {
$this->isAjax = true;
}

if ($this->obj_request->isPost()) {
$this->isPost = true;
}

if ($this->obj_request->isGet()) {
$this->isGet = true;
}

App::setTimezone($this->configBase['site_timezone']);

$_arr_data = array(
'ui_ctrl' => $this->configUi,
'config' => $this->config,
'route' => $this->route,
'route_orig' => $this->routeOrig,
'param' => $this->param,
'ui_ctrl' => $this->configUi,
'config' => $this->config,
'route' => $this->route,
'route_orig' => $this->routeOrig,
'param' => $this->param,
'is_ajax_post' => $this->isAjaxPost,
'is_ajax' => $this->isAjax,
'is_post' => $this->isPost,
'is_get' => $this->isGet,
);

$this->generalData = array_replace_recursive($this->generalData, $_arr_data);
Expand Down Expand Up @@ -82,6 +98,7 @@ protected function fetchJsonp($msg, $rcode = '', $status = 200, $langReplace = '
private function dataProcess($msg, $rcode = '', $langReplace = '') {
$_arr_data = array(
'msg' => $this->obj_lang->get($msg, '', $langReplace),
'detail' => $this->obj_lang->get($rcode, '', $langReplace, false),
'rcode' => $rcode,
'rstatus' => substr($rcode, 0, 1),
);
Expand All @@ -90,10 +107,9 @@ private function dataProcess($msg, $rcode = '', $langReplace = '') {
}

private function configAdd() {
$_arr_config = Config::get();
$_arr_configUi = Config::get('ui_ctrl');

$_arr_convention = Loader::load(BG_PATH_CONFIG . 'convention' . GK_EXT_INC);
$_arr_config = Config::get();
$_arr_configUi = Config::get('ui_ctrl');
$_arr_convention = Loader::load(BG_PATH_CONFIG . 'convention' . GK_EXT_INC);

$_arr_config = array_replace_recursive($_arr_convention, $_arr_config);

Expand Down Expand Up @@ -168,7 +184,11 @@ protected function pathProcess() {
'route_console' => $_str_routeRoot . 'console/',
'route_misc' => $_str_routeRoot . 'misc/',
'route_personal' => $_str_routeRoot . 'personal/',
'path_tpl_common' => $_str_pathTplCommon,
'path_tpl' => $this->pathTpl,
'tpl_include' => $this->pathTpl . 'include' . DS,
'tpl_ctrl' => $this->pathTpl . $this->routeOrig['ctrl'] . DS . 'include' . DS,
'tpl_common' => $_str_pathTplCommon,
'tpl_icon' => $_str_pathTplCommon . 'icon' . DS,
);

$this->url = array_replace_recursive($this->url, $_arr_url);
Expand Down
47 changes: 38 additions & 9 deletions app/classes/install/ctrl.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,18 @@ protected function c_init($param = array()) {
Plugin::listen('action_install_init'); //管理后台初始化时触发

$this->mdl_opt = Loader::model('Opt');

$this->generalData['hrefRow'] = array(
'admin' => $this->hrefBase . 'admin/',
'admin-submit' => $this->hrefBase . 'admin-submit/',
'admin-check' => $this->hrefBase . 'admin-check/',
'auth' => $this->hrefBase . 'auth/',
'auth-submit' => $this->hrefBase . 'auth-submit/',
'auth-check' => $this->hrefBase . 'auth-check/',
'dbconfig-submit' => $this->hrefBase . 'dbconfig-submit/',
'data-submit' => $this->hrefBase . 'data-submit/',
'over-submit' => $this->hrefBase . 'over-submit/',
);
}


Expand Down Expand Up @@ -172,48 +184,65 @@ protected function pathProcess() {
}

$_arr_url = array(
'path_tpl_console' => $_str_pathTplConsole,
'tpl_console' => $_str_pathTplConsole . 'include' . DS,
);

$this->url = array_replace_recursive($this->url, $_arr_url);

$this->generalData = array_replace_recursive($this->generalData, $_arr_url);
$this->generalData = array_replace_recursive($this->generalData, $_arr_url);
}


protected function configProcess() {
parent::configProcess();

$_str_hrefBase = $this->url['route_install'] . $this->route['ctrl'] . '/';

$this->hrefBase = $_str_hrefBase;

$_arr_configInstall = Config::get($this->route['ctrl'], 'install');

$_str_configPhplib = BG_PATH_CONFIG . 'install' . DS . 'phplib' . GK_EXT_INC;
$this->phplib = Config::load($_str_configPhplib, 'phplib');

foreach ($_arr_configInstall as $_key_m=>&$_value_m) {
$_value_m['href'] = $_str_hrefBase . $_key_m . '/';
}

Config::set($this->route['ctrl'], $_arr_configInstall, 'install');
}

private function stepProcess() {
$_arr_install = $this->config['install'][$this->route['ctrl']];

$_arr_installKeys = array_keys($_arr_install);

$_index = array_search($this->route['act'], $_arr_installKeys);
$_str_act = str_ireplace('auth', 'admin', $this->route['act']);
$_index = array_search($_str_act, $_arr_installKeys);

//print_r($_arr_install);

$_arr_prev = array_slice($_arr_install, $_index - 1, -1);
$_arr_prev = array_slice($_arr_install, $_index - 1, -1);
if (Func::isEmpty($_arr_prev)) {
$_key_prev = 'index';
} else {
$_key_prev = key($_arr_prev);
}

$_arr_next = array_slice($_arr_install, $_index + 1, 1);
$_arr_next = array_slice($_arr_install, $_index + 1, 1);
if (Func::isEmpty($_arr_next)) {
$_key_next = 'over';
} else {
$_key_next = key($_arr_next);
}

return array(
'prev' => $_key_prev,
'next' => $_key_next,
'prev' => array(
'act' => $_key_prev,
'href' => $this->hrefBase . $_key_prev . '/',
),
'next' => array(
'act' => $_key_next,
'href' => $this->hrefBase . $_key_next . '/',
),
);
}

Expand Down
Loading

0 comments on commit 598d8bb

Please sign in to comment.