Browse Source
Delete Sessionx
Delete Sessionx
Create Cookie and move RPC under the Movim namespace Refactorpull/356/head
53 changed files with 249 additions and 312 deletions
-
3app/controllers/AccountController.php
-
5app/controllers/DisconnectController.php
-
8app/widgets/Account/Account.php
-
13app/widgets/AccountNext/AccountNext.php
-
2app/widgets/Ack/Ack.php
-
10app/widgets/AdHoc/AdHoc.php
-
4app/widgets/AdminDB/AdminDB.php
-
3app/widgets/AdminLogin/AdminLogin.php
-
12app/widgets/AdminMain/AdminMain.php
-
3app/widgets/AdminTest/AdminTest.php
-
4app/widgets/Api/Api.php
-
6app/widgets/Avatar/Avatar.php
-
6app/widgets/Caps/Caps.php
-
50app/widgets/Chat/Chat.php
-
24app/widgets/Chats/Chats.php
-
2app/widgets/Chats/_chats_item.tpl
-
2app/widgets/Communities/Communities.php
-
6app/widgets/CommunitiesServer/CommunitiesServer.php
-
2app/widgets/CommunityHeader/CommunityHeader.php
-
14app/widgets/CommunityPosts/CommunityPosts.php
-
4app/widgets/Config/Config.php
-
20app/widgets/Contact/Contact.php
-
2app/widgets/Dialog/Dialog.php
-
2app/widgets/Drawer/Drawer.php
-
14app/widgets/Help/Help.php
-
32app/widgets/Infos/Infos.php
-
2app/widgets/Init/Init.php
-
2app/widgets/Invitations/Invitations.php
-
14app/widgets/Login/Login.php
-
9app/widgets/LoginAnonymous/LoginAnonymous.php
-
2app/widgets/Notification/Notification.php
-
22app/widgets/Post/Post.php
-
18app/widgets/Publish/Publish.php
-
8app/widgets/Rooms/Rooms.php
-
8app/widgets/Roster/Roster.php
-
4app/widgets/Search/Search.php
-
6app/widgets/Share/Share.php
-
2app/widgets/Statistics/Statistics.php
-
7app/widgets/System/System.php
-
1app/widgets/Tabs/Tabs.php
-
58app/widgets/Tabs/tabs.css
-
2app/widgets/Upload/Upload.php
-
4app/widgets/Vcard4/Vcard4.php
-
10app/widgets/Visio/Visio.php
-
2composer.json
-
12composer.lock
-
7linker.php
-
4src/Movim/Bootstrap.php
-
4src/Movim/Controller/Front.php
-
40src/Movim/Cookie.php
-
3src/Movim/RPC.php
-
3src/Movim/Widget/Base.php
-
54system/Sessionx.php
@ -1,6 +1,7 @@ |
|||
<?php |
|||
|
|||
class AdminLogin extends \Movim\Widget\Base { |
|||
class AdminLogin extends \Movim\Widget\Base |
|||
{ |
|||
function load() |
|||
{ |
|||
} |
|||
|
|||
@ -1,58 +0,0 @@ |
|||
#navtabs { |
|||
list-style-type: none; |
|||
margin: 0px; |
|||
padding: 0px; |
|||
text-align: center; |
|||
border-bottom: 1px solid #DCDCDC; |
|||
overflow: hidden; |
|||
background-color: white; |
|||
} |
|||
|
|||
#navtabs li { |
|||
display: inline-block; |
|||
cursor: pointer; |
|||
|
|||
white-space: nowrap; |
|||
font-weight: bold; |
|||
|
|||
padding: 0em 1em; |
|||
|
|||
transition: background 0.5s; |
|||
} |
|||
|
|||
#navtabs li.disabled { |
|||
pointer-events: none; |
|||
opacity: 0.5; |
|||
} |
|||
|
|||
#navtabs li a { |
|||
display: block; |
|||
line-height: 3em; |
|||
padding: 0em 1em; |
|||
width:100%; |
|||
text-decoration: none; |
|||
color: #555; |
|||
border-bottom: 2px solid transparent; |
|||
} |
|||
|
|||
#navtabs li:hover a { |
|||
border-bottom: 2px solid #EEE; |
|||
} |
|||
|
|||
#navtabs li.on a { |
|||
border-bottom: 2px solid #DCDCDC; |
|||
} |
|||
|
|||
.tabelem{ |
|||
position: relative; |
|||
} |
|||
|
|||
.fixed_block{ |
|||
background-color: white; |
|||
width: 880px; |
|||
} |
|||
|
|||
.anchor{ |
|||
display: block; |
|||
position: absolute; |
|||
} |
|||
@ -0,0 +1,40 @@ |
|||
<?php |
|||
|
|||
namespace Movim; |
|||
|
|||
class Cookie |
|||
{ |
|||
public static function set() |
|||
{ |
|||
if(SESSION_ID == false) { |
|||
self::setCookie(generateKey(32)); |
|||
} else { |
|||
self::setCookie(SESSION_ID); |
|||
} |
|||
} |
|||
|
|||
public static function refresh() |
|||
{ |
|||
if(isset($_COOKIE['MOVIM_SESSION_ID'])) { |
|||
self::setCookie($_COOKIE['MOVIM_SESSION_ID']); |
|||
} |
|||
} |
|||
|
|||
public static function renew() |
|||
{ |
|||
self::setCookie(generateKey(32)); |
|||
} |
|||
|
|||
public static function getTime() |
|||
{ |
|||
return time()+604800; |
|||
} |
|||
|
|||
private function setCookie($key) |
|||
{ |
|||
if(!headers_sent()) { |
|||
header_remove('Set-Cookie'); |
|||
setcookie("MOVIM_SESSION_ID", $key, self::getTime(), '/'/*, BASE_HOST, APP_SECURED*/); |
|||
} |
|||
} |
|||
} |
|||
@ -1,4 +1,7 @@ |
|||
<?php |
|||
|
|||
namespace Movim; |
|||
|
|||
use Movim\Widget\Wrapper; |
|||
|
|||
class RPC |
|||
@ -1,54 +0,0 @@ |
|||
<?php |
|||
|
|||
use Modl\SQL; |
|||
|
|||
class Sessionx |
|||
{ |
|||
protected static $_instance; |
|||
private $_max_age = 604800; // 24hour
|
|||
private $_timestamp; |
|||
|
|||
/* |
|||
* Session generation and handling part |
|||
*/ |
|||
protected function __construct() |
|||
{ |
|||
if(SESSION_ID == false) { |
|||
$this->setCookie(generateKey(32)); |
|||
} elseif(!headers_sent()) { |
|||
$this->setCookie(SESSION_ID); |
|||
} |
|||
} |
|||
|
|||
public function refreshCookie() |
|||
{ |
|||
if(isset($_COOKIE['MOVIM_SESSION_ID'])) { |
|||
$this->setCookie($_COOKIE['MOVIM_SESSION_ID']); |
|||
} |
|||
} |
|||
|
|||
public function renewCookie() |
|||
{ |
|||
$this->setCookie(generateKey(32)); |
|||
} |
|||
|
|||
public function getTime() |
|||
{ |
|||
return time()+$this->_max_age; |
|||
} |
|||
|
|||
private function setCookie($key) |
|||
{ |
|||
header_remove('Set-Cookie'); |
|||
setcookie("MOVIM_SESSION_ID", $key, $this->getTime(), '/'/*, BASE_HOST, APP_SECURED*/); |
|||
} |
|||
|
|||
public static function start() |
|||
{ |
|||
if(!isset(self::$_instance)) { |
|||
self::$_instance = new self(); |
|||
} |
|||
|
|||
return self::$_instance; |
|||
} |
|||
} |
|||
Write
Preview
Loading…
Cancel
Save
Reference in new issue