fixed errors, code style and a little more

pull/159/head^2
ShindaKioku 2017-06-18 18:32:21 +03:00
parent 961890db9b
commit cbed717cd0
11 changed files with 41 additions and 47 deletions

View File

@ -19,7 +19,7 @@ class app extends Controller{
$this->display(TEMPLATE.'app/index.php'); $this->display(TEMPLATE.'app/index.php');
} }
public function init_app($user_info){ public function init_app(){
$list = $this->sql->get(); $list = $this->sql->get();
$new_user_app = $this->config['setting_system']['new_user_app']; $new_user_app = $this->config['setting_system']['new_user_app'];
$default = explode(',',$new_user_app); $default = explode(',',$new_user_app);

View File

@ -33,7 +33,7 @@ class fav extends Controller{
} }
$name = $name.'('.$index.')'; $name = $name.'('.$index.')';
} }
$res=$this->sql->set( $this->sql->set(
$name, $name,
array( array(
'name' => $name, 'name' => $name,
@ -49,9 +49,6 @@ class fav extends Controller{
* 编辑 * 编辑
*/ */
public function edit() { public function edit() {
$this->in['name'] = $this->in['name'];
$this->in['path'] = $this->in['path'];
$this->in['name_to'] = $this->in['name_to'];
$new_fav = $this->sql->get($this->in['name']); $new_fav = $this->sql->get($this->in['name']);
if(!isset($new_fav['type'])){ if(!isset($new_fav['type'])){
$new_fav['type'] = 'folder'; $new_fav['type'] = 'folder';

View File

@ -7,7 +7,6 @@
*/ */
class setting extends Controller{ class setting extends Controller{
private $sql;
function __construct(){ function __construct(){
parent::__construct(); parent::__construct();
} }

View File

@ -14,7 +14,7 @@ class share extends Controller{
function __construct(){ function __construct(){
parent::__construct(); parent::__construct();
$this->tpl = TEMPLATE.'share/'; $this->tpl = TEMPLATE.'share/';
$auth = system_role::get_info(1);//经过role检测 system_role::get_info(1);//经过role检测
//不需要检查的action //不需要检查的action
$arr_not_check = array('common_js'); $arr_not_check = array('common_js');
if (!in_array(ACT,$arr_not_check)){ if (!in_array(ACT,$arr_not_check)){
@ -192,7 +192,7 @@ class share extends Controller{
$this->sql->set($this->in['sid'],$this->share_info); $this->sql->set($this->in['sid'],$this->share_info);
} }
public function common_js(){ public function common_js(){
$out = ob_get_clean(); ob_get_clean();
$the_config = array( $the_config = array(
'lang' => LANGUAGE_TYPE, 'lang' => LANGUAGE_TYPE,
'system_os' => $this->config['system_os'], 'system_os' => $this->config['system_os'],
@ -614,7 +614,7 @@ class share extends Controller{
if (in_array($val['name'],$ex_name)) continue; if (in_array($val['name'],$ex_name)) continue;
$list_new['folderlist'][] = $val; $list_new['folderlist'][] = $val;
} }
$s = _DIR_OUT($list_new); _DIR_OUT($list_new);
return _DIR_OUT($list_new); return _DIR_OUT($list_new);
} }
} }

View File

@ -34,7 +34,7 @@ class system_group extends Controller{
* @param [type] $the_id [user_id or group_id] * @param [type] $the_id [user_id or group_id]
* @param [type] $use_size_add [变更的大小 size_max G为单位 size_use Byte为单位] * @param [type] $use_size_add [变更的大小 size_max G为单位 size_use Byte为单位]
*/ */
public static function space_change($the_id,$use_size_add=false){ public function space_change($the_id,$use_size_add=false){
$sql = self::load_data(); $sql = self::load_data();
$info = $sql->get($the_id); $info = $sql->get($the_id);
if(!is_array($info)){ if(!is_array($info)){
@ -58,7 +58,7 @@ class system_group extends Controller{
* 空间剩余检测 * 空间剩余检测
* 1073741824 —— 1G * 1073741824 —— 1G
*/ */
public static function space_check($the_id){ public function space_check($the_id){
$sql = self::load_data(); $sql = self::load_data();
$info = $sql->get($the_id); $info = $sql->get($the_id);
if(!is_array($info)){ if(!is_array($info)){

View File

@ -33,7 +33,7 @@ class system_member extends Controller{
* @param [type] $the_id [user_id or group_id] * @param [type] $the_id [user_id or group_id]
* @param [type] $use_size_add [变更的大小 size_max G为单位 size_use Byte为单位] * @param [type] $use_size_add [变更的大小 size_max G为单位 size_use Byte为单位]
*/ */
public static function space_change($the_id,$use_size_add=false){ public function space_change($the_id,$use_size_add=false){
$sql = self::load_data(); $sql = self::load_data();
$info = $sql->get($the_id); $info = $sql->get($the_id);
if(!is_array($info)){ if(!is_array($info)){
@ -56,7 +56,7 @@ class system_member extends Controller{
* 空间剩余检测 * 空间剩余检测
* 1073741824 —— 1G * 1073741824 —— 1G
*/ */
public static function space_check($the_id){ public function space_check($the_id){
$sql = self::load_data(); $sql = self::load_data();
$info = $sql->get($the_id); $info = $sql->get($the_id);
if(!is_array($info)){ if(!is_array($info)){

View File

@ -8,7 +8,6 @@
class user extends Controller{ class user extends Controller{
private $user; //用户相关信息 private $user; //用户相关信息
private $auth; //用户所属组权限
private $notCheck; private $notCheck;
function __construct(){ function __construct(){
parent::__construct(); parent::__construct();
@ -42,8 +41,7 @@ class user extends Controller{
$this->_setCsrfToken(); $this->_setCsrfToken();
} }
if(in_array(ST,$this->notCheckApp)) return;//不需要判断的控制器 if(in_array(ST,$this->notCheckApp) && in_array(ACT,$this->notCheck)) return;//不需要判断的控制器 | 不需要判断的action
if(in_array(ACT,$this->notCheck)) return;//不需要判断的action
if(isset($_SESSION['kod_login']) && $_SESSION['kod_login']===true){ if(isset($_SESSION['kod_login']) && $_SESSION['kod_login']===true){
$user = system_member::get_info($this->user['user_id']); $user = system_member::get_info($this->user['user_id']);
$this->login_success($user); $this->login_success($user);
@ -538,4 +536,3 @@ class user extends Controller{
QRcode::png(rawurldecode($this->in['url'])); QRcode::png(rawurldecode($this->in['url']));
} }
} }

View File

@ -70,7 +70,7 @@ class Application {
*/ */
private function autorun(){ private function autorun(){
global $config; global $config;
if (count($config['autorun']) > 0) { if (count($config['autorun'])) {
foreach ($config['autorun'] as $key => $var) { foreach ($config['autorun'] as $key => $var) {
$this->appRun($var['controller'],$var['function']); $this->appRun($var['controller'],$var['function']);
} }

View File

@ -37,6 +37,9 @@ abstract class Controller {
*/ */
public function loadModel($class){ public function loadModel($class){
$args = func_get_args(); $args = func_get_args();
if ( !$this->$class ) {
show_tips($class.' model not exists');
}
$this -> $class = call_user_func_array('init_model', $args); $this -> $class = call_user_func_array('init_model', $args);
return $this -> $class; return $this -> $class;
} }

View File

@ -12,24 +12,22 @@
*/ */
abstract class Model { abstract class Model {
var $db = null; protected $db = null;
var $in; public $in;
var $config;
/** /**
* 构造函数 * 构造函数
* @return Null * @return Null
*/ */
function __construct(){ public function __construct(){
global $g_config, $in; global $g_config, $in;
$this -> in = $in; $this -> in = $in;
$this -> config = $config;
} }
/** /**
* TODO db * TODO db
*/ */
function db(){ public function db(){
if ($this ->db != NULL) { if ($this ->db != NULL) {
return $this ->db; return $this ->db;
}else{ }else{

View File

@ -206,7 +206,7 @@ class updateToV330{
$group_path = THE_DATA_PATH.'Group/'; $group_path = THE_DATA_PATH.'Group/';
mk_dir($group_path); mk_dir($group_path);
touch($group_path.'index.html'); touch($group_path.'index.htmzl');
$public = THE_DATA_PATH.'public'; $public = THE_DATA_PATH.'public';
$item_path = iconv_system($group_path.$arr['path'].'/'); $item_path = iconv_system($group_path.$arr['path'].'/');