mirror of
https://git.code.sf.net/p/seeddms/code
synced 2025-11-27 10:00:41 +00:00
rename SeedDMS_Session and SeedDMS_SessionMgr into \Seeddms\Seeddms\...
This commit is contained in:
parent
73e266bab7
commit
bf28ffa215
|
|
@ -22,7 +22,7 @@
|
|||
"psr-4": {
|
||||
"SeedDMS\\Console\\": "seeddms/utils"
|
||||
},
|
||||
"classmap": ["seeddms/inc/inc.ClassTranslator.php", "seeddms/inc/inc.ClassSettings.php", "seeddms/inc/inc.Version.php", "seeddms/inc/inc.ClassViewCommon.php", "seeddms/inc/inc.ClassControllerCommon.php", "seeddms/inc/inc.ClassController.php"]
|
||||
"classmap": ["seeddms/inc/inc.ClassTranslator.php", "seeddms/inc/inc.ClassSettings.php", "seeddms/inc/inc.Version.php", "seeddms/inc/inc.ClassViewCommon.php", "seeddms/inc/inc.ClassControllerCommon.php", "seeddms/inc/inc.ClassController.php", "seeddms/inc/inc.ClassSession.php"]
|
||||
},
|
||||
"require": {
|
||||
"pear/http_request2": "^2",
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@
|
|||
"psr-4": {
|
||||
"Seeddms\\Console\\": "utils"
|
||||
},
|
||||
"classmap": ["inc/inc.ClassTranslator.php", "inc/inc.ClassSettings.php", "inc/inc.Version.php", "inc/inc.ClassViewCommon.php", "inc/inc.ClassControllerCommon.php", "inc/inc.ClassController.php"]
|
||||
"classmap": ["inc/inc.ClassTranslator.php", "inc/inc.ClassSettings.php", "inc/inc.Version.php", "inc/inc.ClassViewCommon.php", "inc/inc.ClassControllerCommon.php", "inc/inc.ClassController.php", "inc/inc.ClassSession.php"]
|
||||
},
|
||||
"require": {
|
||||
"php": ">=8.2.0",
|
||||
|
|
|
|||
|
|
@ -12,6 +12,8 @@
|
|||
* @version Release: @package_version@
|
||||
*/
|
||||
|
||||
use Seeddms\Seeddms\Session;
|
||||
|
||||
require_once("inc.ClassSession.php");
|
||||
require_once("inc.ClassAccessOperation.php");
|
||||
|
||||
|
|
@ -23,7 +25,7 @@ if (!strncmp("/op", $refer, 3)) {
|
|||
}
|
||||
if (!isset($_COOKIE["mydms_session"])) {
|
||||
if($settings->_enableGuestLogin && $settings->_enableGuestAutoLogin) {
|
||||
$session = new SeedDMS_Session($db);
|
||||
$session = new Session($db);
|
||||
if(!$dms_session = $session->create(array('userid'=>$settings->_guestID, 'theme'=>$settings->_theme, 'lang'=>$settings->_language))) {
|
||||
header("Location: " . $settings->_httpRoot . "out/out.Login.php?referuri=".$refer);
|
||||
exit;
|
||||
|
|
@ -44,7 +46,7 @@ if (!isset($_COOKIE["mydms_session"])) {
|
|||
$lang = $settings->_language;
|
||||
$user->setLanguage($lang);
|
||||
}
|
||||
$session = new SeedDMS_Session($db);
|
||||
$session = new Session($db);
|
||||
if(!$dms_session = $session->create(array('userid'=>$user->getID(), 'theme'=>$theme, 'lang'=>$lang))) {
|
||||
header("Location: " . $settings->_httpRoot . "out/out.Login.php?referuri=".$refer);
|
||||
exit;
|
||||
|
|
@ -57,7 +59,7 @@ if (!isset($_COOKIE["mydms_session"])) {
|
|||
} else {
|
||||
/* Load session */
|
||||
$dms_session = $_COOKIE["mydms_session"];
|
||||
$session = new SeedDMS_Session($db);
|
||||
$session = new Session($db);
|
||||
if(!$resArr = $session->load($dms_session)) {
|
||||
setcookie("mydms_session", $dms_session, time()-3600, $settings->_httpRoot); //delete cookie
|
||||
header("Location: " . $settings->_httpRoot . "out/out.Login.php?referuri=".$refer);
|
||||
|
|
|
|||
|
|
@ -30,6 +30,8 @@
|
|||
* @link https://www.seeddms.org Main Site
|
||||
*/
|
||||
|
||||
use Seeddms\Seeddms\Session;
|
||||
|
||||
/* Middleware for authentication based on session */
|
||||
class SeedDMS_Auth_Middleware_Session { /* {{{ */
|
||||
|
||||
|
|
@ -67,8 +69,8 @@ class SeedDMS_Auth_Middleware_Session { /* {{{ */
|
|||
}
|
||||
|
||||
$logger->log("Invoke AuthSessionMiddleware for method " . $request->getMethod() . " on '" . $request->getUri()->getPath() . "'", PEAR_LOG_INFO);
|
||||
require_once("inc/inc.ClassSession.php");
|
||||
$session = new SeedDMS_Session($dms->getDb());
|
||||
// require_once("inc/inc.ClassSession.php");
|
||||
$session = new Session($dms->getDb());
|
||||
if (isset($_COOKIE["mydms_session"])) {
|
||||
$dms_session = $_COOKIE["mydms_session"];
|
||||
$logger->log("Session key: " . $dms_session, PEAR_LOG_DEBUG);
|
||||
|
|
|
|||
|
|
@ -15,6 +15,8 @@
|
|||
* @version Release: @package_version@
|
||||
*/
|
||||
|
||||
namespace Seeddms\Seeddms;
|
||||
|
||||
/**
|
||||
* Class to represent a session
|
||||
*
|
||||
|
|
@ -29,7 +31,7 @@
|
|||
* @copyright 2011 Uwe Steinmann
|
||||
* @version Release: @package_version@
|
||||
*/
|
||||
class SeedDMS_Session {
|
||||
class Session {
|
||||
/**
|
||||
* @var object $db reference to database object. This must be an instance
|
||||
* of {@link SeedDMS_Core_DatabaseAccess}.
|
||||
|
|
@ -53,7 +55,7 @@ class SeedDMS_Session {
|
|||
* Create a new instance of the session handler
|
||||
*
|
||||
* @param object $db object to access the underlying database
|
||||
* @return object instance of SeedDMS_Session
|
||||
* @return object instance of Seeddms\Seeddms\Session
|
||||
*/
|
||||
function __construct($db) { /* {{{ */
|
||||
$this->db = $db;
|
||||
|
|
@ -428,7 +430,7 @@ class SeedDMS_Session {
|
|||
* @copyright 2014 Uwe Steinmann
|
||||
* @version Release: @package_version@
|
||||
*/
|
||||
class SeedDMS_SessionMgr {
|
||||
class SessionMgr {
|
||||
/**
|
||||
* @var object $db reference to database object. This must be an instance
|
||||
* of {@link SeedDMS_Core_DatabaseAccess}.
|
||||
|
|
@ -440,7 +442,7 @@ class SeedDMS_SessionMgr {
|
|||
* Create a new instance of the session manager
|
||||
*
|
||||
* @param object $db object to access the underlying database
|
||||
* @return object instance of SeedDMS_SessionMgr
|
||||
* @return object instance of Seeddms\Seeddms\SessionMgr
|
||||
*/
|
||||
function __construct($db) { /* {{{ */
|
||||
$this->db = $db;
|
||||
|
|
@ -478,7 +480,7 @@ class SeedDMS_SessionMgr {
|
|||
return false;
|
||||
$sessions = array();
|
||||
foreach($resArr as $rec) {
|
||||
$session = new SeedDMS_Session($this->db);
|
||||
$session = new Session($this->db);
|
||||
$session->load($rec['id']);
|
||||
$sessions[] = $session;
|
||||
}
|
||||
|
|
@ -501,7 +503,7 @@ class SeedDMS_SessionMgr {
|
|||
return false;
|
||||
$sessions = array();
|
||||
foreach($resArr as $rec) {
|
||||
$session = new SeedDMS_Session($this->db);
|
||||
$session = new Session($this->db);
|
||||
$session->load($rec['id']);
|
||||
$sessions[] = $session;
|
||||
}
|
||||
|
|
@ -523,7 +525,7 @@ class SeedDMS_SessionMgr {
|
|||
return false;
|
||||
$sessions = array();
|
||||
foreach($resArr as $rec) {
|
||||
$session = new SeedDMS_Session($this->db);
|
||||
$session = new Session($this->db);
|
||||
$session->load($rec['id']);
|
||||
$sessions[] = $session;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,6 +29,8 @@ require_once("../inc/inc.ClassUI.php");
|
|||
require_once("../inc/inc.ClassController.php");
|
||||
require_once("../inc/inc.Notification.php");
|
||||
|
||||
use Seeddms\Seeddms\Session;
|
||||
|
||||
require_once("../inc/inc.ClassSession.php");
|
||||
require_once("../inc/inc.ClassPasswordStrength.php");
|
||||
require_once("../inc/inc.ClassPasswordHistoryManager.php");
|
||||
|
|
@ -36,7 +38,7 @@ require_once("../inc/inc.ClassPasswordHistoryManager.php");
|
|||
/* Load session */
|
||||
if (isset($_COOKIE["mydms_session"])) {
|
||||
$dms_session = $_COOKIE["mydms_session"];
|
||||
$session = new SeedDMS_Session($db);
|
||||
$session = new Session($db);
|
||||
if(!$resArr = $session->load($dms_session)) {
|
||||
header('Content-Type: application/json');
|
||||
echo json_encode(array('error'=>1));
|
||||
|
|
|
|||
|
|
@ -18,6 +18,8 @@
|
|||
// along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
|
||||
use Seeddms\Seeddms\Session;
|
||||
|
||||
include("../inc/inc.Settings.php");
|
||||
include("../inc/inc.Utils.php");
|
||||
include("../inc/inc.LogInit.php");
|
||||
|
|
@ -67,7 +69,7 @@ if(isset($_REQUEST["lang"]) && strlen($_REQUEST["lang"])>0 && is_numeric(array_s
|
|||
$lang = (string) $_REQUEST["lang"];
|
||||
}
|
||||
|
||||
$session = new SeedDMS_Session($db);
|
||||
$session = new Session($db);
|
||||
|
||||
// TODO: by the PHP manual: The superglobals $_GET and $_REQUEST are already decoded.
|
||||
// Using urldecode() on an element in $_GET or $_REQUEST could have unexpected and dangerous results.
|
||||
|
|
|
|||
|
|
@ -23,12 +23,14 @@ include("../inc/inc.Utils.php");
|
|||
include("../inc/inc.LogInit.php");
|
||||
include("../inc/inc.Language.php");
|
||||
include("../inc/inc.Init.php");
|
||||
include("../inc/inc.Extension.php");
|
||||
//include("../inc/inc.Extension.php");
|
||||
include("../inc/inc.ClassSession.php");
|
||||
include("../inc/inc.ClassController.php");
|
||||
include("../inc/inc.DBInit.php");
|
||||
include("../inc/inc.Authentication.php");
|
||||
|
||||
use Seeddms\Seeddms\Session;
|
||||
|
||||
$tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME']));
|
||||
$controller = Controller::factory($tmp[1], array('dms'=>$dms, 'user'=>$user));
|
||||
|
||||
|
|
@ -36,7 +38,7 @@ $controller = Controller::factory($tmp[1], array('dms'=>$dms, 'user'=>$user));
|
|||
if(isset($_COOKIE['mydms_session'])) {
|
||||
$dms_session = $_COOKIE["mydms_session"];
|
||||
|
||||
$session = new SeedDMS_Session($db);
|
||||
$session = new Session($db);
|
||||
$session->load($dms_session);
|
||||
|
||||
// If setting the user id to 0 worked, it would be a way to logout a
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@ use Psr\Http\Server\MiddlewareInterface;
|
|||
use DI\ContainerBuilder;
|
||||
use Slim\Factory\AppFactory;
|
||||
use Seeddms\Seeddms\Translator;
|
||||
use Seeddms\Seeddms\Session;
|
||||
|
||||
final class JsonRenderer { /* {{{ */
|
||||
public function json(
|
||||
|
|
@ -264,7 +265,7 @@ final class SeedDMS_RestapiController { /* {{{ */
|
|||
return $this->renderer->json($response, array('success'=>false, 'message'=>'Login failed', 'data'=>''))->withStatus(403);
|
||||
} else {
|
||||
require_once("../inc/inc.ClassSession.php");
|
||||
$session = new SeedDMS_Session($dms->getDb());
|
||||
$session = new Session($dms->getDb());
|
||||
if(!$id = $session->create(array('userid'=>$userobj->getId(), 'theme'=>$userobj->getTheme(), 'lang'=>$userobj->getLanguage()))) {
|
||||
return $this->renderer->json($response, array('success'=>false, 'message'=>'Creating session failed', 'data'=>''))->withStatus(500);
|
||||
}
|
||||
|
|
@ -291,7 +292,7 @@ final class SeedDMS_RestapiController { /* {{{ */
|
|||
$dms_session = $_COOKIE["mydms_session"];
|
||||
$db = $dms->getDb();
|
||||
|
||||
$session = new SeedDMS_Session($db);
|
||||
$session = new Session($db);
|
||||
$session->load($dms_session);
|
||||
|
||||
// If setting the user id to 0 worked, it would be a way to logout a
|
||||
|
|
@ -3175,7 +3176,7 @@ class RestapiAuthMiddleware implements MiddlewareInterface { /* {{{ */
|
|||
} else {
|
||||
$logger->log("Checking for valid session", PEAR_LOG_INFO);
|
||||
require_once("../inc/inc.ClassSession.php");
|
||||
$session = new SeedDMS_Session($dms->getDb());
|
||||
$session = new Session($dms->getDb());
|
||||
if (isset($_COOKIE["mydms_session"])) {
|
||||
$logger->log("Found cookie for session", PEAR_LOG_INFO);
|
||||
$dms_session = $_COOKIE["mydms_session"];
|
||||
|
|
|
|||
|
|
@ -13,10 +13,7 @@
|
|||
* @version Release: @package_version@
|
||||
*/
|
||||
|
||||
/**
|
||||
* Include parent class
|
||||
*/
|
||||
//require_once("class.Bootstrap.php");
|
||||
use Seeddms\Seeddms\SessionMgr;
|
||||
|
||||
/**
|
||||
* Class which outputs the html page for clipboard view
|
||||
|
|
@ -44,7 +41,7 @@ class SeedDMS_View_Session extends SeedDMS_Theme_Style {
|
|||
$dms = $this->params['dms'];
|
||||
$user = $this->params['user'];
|
||||
|
||||
$sessionmgr = new SeedDMS_SessionMgr($dms->getDB());
|
||||
$sessionmgr = new SessionMgr($dms->getDB());
|
||||
$sessions = $sessionmgr->getLastAccessedSessions(date('Y-m-d H:i:s', time()-3600));
|
||||
if(!$sessions)
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -13,10 +13,7 @@
|
|||
* @version Release: @package_version@
|
||||
*/
|
||||
|
||||
/**
|
||||
* Include parent class
|
||||
*/
|
||||
//require_once("class.Bootstrap.php");
|
||||
use Seeddms\Seeddms\SessionMgr;
|
||||
|
||||
/**
|
||||
* Class which outputs the html page for UserList view
|
||||
|
|
@ -59,7 +56,7 @@ class SeedDMS_View_UserList extends SeedDMS_Theme_Style {
|
|||
$this->pageNavigation("", "admin_tools");
|
||||
$this->contentHeading(getMLText("user_list"));
|
||||
|
||||
$sessionmgr = new SeedDMS_SessionMgr($dms->getDB());
|
||||
$sessionmgr = new SessionMgr($dms->getDB());
|
||||
?>
|
||||
|
||||
<input type="text" id="myInput" class="form-control" placeholder="<?= getMLText('type_to_filter'); ?>">
|
||||
|
|
|
|||
|
|
@ -13,6 +13,8 @@
|
|||
* @version Release: @package_version@
|
||||
*/
|
||||
|
||||
use Seeddms\Seeddms\SessionMgr;
|
||||
|
||||
/**
|
||||
* Include parent class
|
||||
*/
|
||||
|
|
@ -99,7 +101,7 @@ $(document).ready( function() {
|
|||
$workflowmode = $this->params['workflowmode'];
|
||||
|
||||
if($seluser) {
|
||||
$sessionmgr = new SeedDMS_SessionMgr($dms->getDB());
|
||||
$sessionmgr = new SessionMgr($dms->getDB());
|
||||
|
||||
$this->contentHeading(getMLText("user_info"));
|
||||
echo "<table class=\"table table-condensed table-sm\">\n";
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user