From d98adeccbaa1612b4e90adae51727aeb920884d5 Mon Sep 17 00:00:00 2001 From: wangyidong Date: Fri, 12 Oct 2018 09:08:12 +0800 Subject: [PATCH] * finish task #4976. --- framework/base/router.class.php | 18 +++++++++++------- module/common/model.php | 16 ++-------------- module/file/control.php | 11 +++-------- module/testtask/view/view.html.php | 8 ++++---- module/user/js/login.js | 3 --- module/user/view/login.html.php | 1 - 6 files changed, 20 insertions(+), 37 deletions(-) diff --git a/framework/base/router.class.php b/framework/base/router.class.php index 6664b636b9..a749ba6089 100644 --- a/framework/base/router.class.php +++ b/framework/base/router.class.php @@ -311,6 +311,15 @@ class baseRouter */ public $cookie; + /** + * 原始SESSIONID + * SESSIONID + * + * @var int + * @access public + */ + public $sessionID; + /** * 网站代号。 * The code of current site. @@ -815,13 +824,8 @@ class baseRouter session_name($sessionName); session_start(); - $sessionID = session_id(); - if(isset($_GET[$this->config->sessionVar]) and $sessionID != $_GET[$this->config->sessionVar]) - { - helper::restartSession($_GET[$this->config->sessionVar]); - if($this->session->fingerprint and $this->cookie->fingerprint != $this->session->fingerprint) helper::restartSession($sessionID); - } - if($this->session->fingerprint and $this->cookie->fingerprint != $this->session->fingerprint) helper::restartSession(); + $this->sessionID = session_id(); + if(isset($_GET[$this->config->sessionVar]) and $this->sessionID != $_GET[$this->config->sessionVar]) helper::restartSession($_GET[$this->config->sessionVar]); define('SESSION_STARTED', true); } diff --git a/module/common/model.php b/module/common/model.php index 0bc1d7d2b0..cbc5336868 100644 --- a/module/common/model.php +++ b/module/common/model.php @@ -24,7 +24,6 @@ class commonModel extends model { define('FIRST_RUN', true); $this->sendHeader(); - $this->setFingerprint(); $this->setCompany(); $this->setUser(); $this->loadConfigFromDB(); @@ -52,17 +51,6 @@ class commonModel extends model header("Cache-control: private"); } - /** - * Set fingerprint. - * - * @access public - * @return void - */ - public function setFingerprint() - { - if($this->cookie->fingerprint and !$this->session->fingerprint) $this->session->set('fingerprint', $this->cookie->fingerprint); - } - /** * Set the commpany. * @@ -1326,8 +1314,8 @@ EOD; $method = $this->app->getMethodName(); if(isset($this->app->user->modifyPassword) and $this->app->user->modifyPassword and ($module != 'my' or $method != 'changepassword')) die(js::locate(helper::createLink('my', 'changepassword'))); if($this->isOpenMethod($module, $method)) return true; - if(!$this->loadModel('user')->isLogon() and $this->cookie->fingerprint and $this->server->php_auth_user) $this->user->identifyByPhpAuth(); - if(!$this->loadModel('user')->isLogon() and $this->cookie->fingerprint and $this->cookie->za) $this->user->identifyByCookie(); + if(!$this->loadModel('user')->isLogon() and $this->server->php_auth_user) $this->user->identifyByPhpAuth(); + if(!$this->loadModel('user')->isLogon() and $this->cookie->za) $this->user->identifyByCookie(); if(isset($this->app->user)) { diff --git a/module/file/control.php b/module/file/control.php index 6f9c94acd6..f459ac8b62 100644 --- a/module/file/control.php +++ b/module/file/control.php @@ -153,13 +153,7 @@ class file extends control */ public function download($fileID, $mouse = '') { - /* When get sid then change session id. */ - if(isset($_GET[$this->config->sessionVar])) - { - $sessionID = isset($_COOKIE[$this->config->sessionVar]) ? $_COOKIE[$this->config->sessionVar] : sha1(mt_rand()); - helper::restartSession($sessionID); - } - + if(session_id() != $this->app->sessionID) helper::restartSession($this->app->sessionID); $file = $this->file->getById($fileID); /* Judge the mode, down or open. */ @@ -168,7 +162,8 @@ class file extends control if(stripos($fileTypes, $file->extension) !== false && $mouse == 'left') $mode = 'open'; if($file->extension == 'txt') { - $extension = end(explode('.', $file->title)); + $extension = 'txt'; + if(($postion = strrpos($file->title, '.')) !== false)$extension = substr($file->title, $postion + 1); if($extension != 'txt') $mode = 'down'; $file->extension = $extension; } diff --git a/module/testtask/view/view.html.php b/module/testtask/view/view.html.php index 91df4b044f..5abf819114 100644 --- a/module/testtask/view/view.html.php +++ b/module/testtask/view/view.html.php @@ -48,10 +48,10 @@ deleted):?>
id", $task, 'button', '', '', 'iframe', true); - common::printIcon('testtask', 'close', "taskID=$task->id", $task, 'button', '', '', 'iframe', true); - common::printIcon('testtask', 'block', "taskID=$task->id", $task, 'button', 'pause', '', 'iframe', true); - common::printIcon('testtask', 'activate', "taskID=$task->id", $task, 'button', 'magic', '', 'iframe', true); + common::printIcon('testtask', 'start', "taskID=$task->id", $task, 'button', '', '', 'iframe showinonlybody', true); + common::printIcon('testtask', 'close', "taskID=$task->id", $task, 'button', '', '', 'iframe showinonlybody', true); + common::printIcon('testtask', 'block', "taskID=$task->id", $task, 'button', 'pause', '', 'iframe showinonlybody', true); + common::printIcon('testtask', 'activate', "taskID=$task->id", $task, 'button', 'magic', '', 'iframe showinonlybody', true); common::printIcon('testtask', 'cases', "taskID=$task->id", $task, 'button', 'sitemap'); common::printIcon('testtask', 'linkCase', "taskID=$task->id", $task, 'button', 'link'); ?> diff --git a/module/user/js/login.js b/module/user/js/login.js index 98e5ae1aa1..241307566c 100644 --- a/module/user/js/login.js +++ b/module/user/js/login.js @@ -17,9 +17,6 @@ $(document).ready(function() $('#account').focus(); - /* Set fingerprint. */ - $.cookie('fingerprint', getFingerprint(), {expires:config.cookieLife, path:config.webRoot}); - $("#langs li > a").click(function() { selectLang($(this).data('value')); diff --git a/module/user/view/login.html.php b/module/user/view/login.html.php index 9590f6d722..bff9d427cf 100644 --- a/module/user/view/login.html.php +++ b/module/user/view/login.html.php @@ -9,7 +9,6 @@ * @version $Id: login.html.php 5084 2013-07-10 01:31:38Z wyd621@gmail.com $ */ include '../../common/view/header.lite.html.php'; -js::import($jsRoot . 'fingerprint/fingerprint.js'); if(empty($config->notMd5Pwd))js::import($jsRoot . 'md5.js'); ?>