a few issues: block public not blocking mod_cal, typo in sql for one clone file sync operation, fix_system_urls not catching cached contact photos, extend sessionhandler expiration when remember_me is enabled as the stored session is expiring long before the browser session.
This commit is contained in:
parent
c0bdcfedeb
commit
abfbe9c937
@ -13,6 +13,8 @@ namespace Zotlabs\Web;
|
|||||||
|
|
||||||
class Session {
|
class Session {
|
||||||
|
|
||||||
|
private static $handler = null;
|
||||||
|
|
||||||
function init() {
|
function init() {
|
||||||
|
|
||||||
$gc_probability = 50;
|
$gc_probability = 50;
|
||||||
@ -26,6 +28,7 @@ class Session {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
$handler = new \Zotlabs\Web\SessionHandler();
|
$handler = new \Zotlabs\Web\SessionHandler();
|
||||||
|
self::$handler = $handler;
|
||||||
|
|
||||||
$x = session_set_save_handler($handler,true);
|
$x = session_set_save_handler($handler,true);
|
||||||
if(! $x)
|
if(! $x)
|
||||||
@ -67,26 +70,28 @@ class Session {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
function new_cookie($time) {
|
function new_cookie($xtime) {
|
||||||
|
|
||||||
|
$newxtime = (($xtime> 0) ? (time() + $xtime) : 0);
|
||||||
|
|
||||||
$old_sid = session_id();
|
$old_sid = session_id();
|
||||||
|
|
||||||
session_regenerate_id(false);
|
session_regenerate_id(false);
|
||||||
|
|
||||||
q("UPDATE session SET sid = '%s' WHERE sid = '%s'",
|
if(self::$handler) {
|
||||||
|
$v = q("UPDATE session SET sid = '%s' WHERE sid = '%s'",
|
||||||
dbesc(session_id()),
|
dbesc(session_id()),
|
||||||
dbesc($old_sid)
|
dbesc($old_sid)
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
logger('no session handler');
|
||||||
|
|
||||||
if (x($_COOKIE, 'jsAvailable')) {
|
if (x($_COOKIE, 'jsAvailable')) {
|
||||||
if ($time) {
|
setcookie('jsAvailable', $_COOKIE['jsAvailable'], $newxtime);
|
||||||
$expires = time() + $time;
|
|
||||||
} else {
|
|
||||||
$expires = 0;
|
|
||||||
}
|
}
|
||||||
setcookie('jsAvailable', $_COOKIE['jsAvailable'], $expires);
|
setcookie(session_name(),session_id(),$newxtime);
|
||||||
}
|
|
||||||
setcookie(session_name(),session_id(),$expires);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -35,6 +35,11 @@ class SessionHandler implements \SessionHandlerInterface {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Can't just use $data here because we can't be certain of the serialisation algorithm
|
||||||
|
|
||||||
|
if($_SESSION && array_key_exists('remember_me',$_SESSION) && intval($_SESSION['remember_me']))
|
||||||
|
$expire = time() + (60 * 60 * 24 * 365);
|
||||||
|
else
|
||||||
$expire = time() + $this->session_expire;
|
$expire = time() + $this->session_expire;
|
||||||
$default_expire = time() + 300;
|
$default_expire = time() + 300;
|
||||||
|
|
||||||
|
18
boot.php
18
boot.php
@ -1542,6 +1542,24 @@ function fix_system_urls($oldurl, $newurl) {
|
|||||||
proc_run('php', 'include/notifier.php', 'refresh_all', $c[0]['channel_id']);
|
proc_run('php', 'include/notifier.php', 'refresh_all', $c[0]['channel_id']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// now replace any remote xchans whose photos are stored locally (which will be most if not all remote xchans)
|
||||||
|
|
||||||
|
$r = q("select * from xchan where xchan_photo_l like '%s'",
|
||||||
|
dbesc($oldurl . '%')
|
||||||
|
);
|
||||||
|
|
||||||
|
if($r) {
|
||||||
|
foreach($r as $rr) {
|
||||||
|
$x = q("update xchan set xchan_photo_l = '%s', xchan_photo_m = '%s', xchan_photo_s = '%s' where xchan_hash = '%s'",
|
||||||
|
dbesc(str_replace($oldurl,$newurl,$rr['xchan_photo_l'])),
|
||||||
|
dbesc(str_replace($oldurl,$newurl,$rr['xchan_photo_m'])),
|
||||||
|
dbesc(str_replace($oldurl,$newurl,$rr['xchan_photo_s'])),
|
||||||
|
dbesc($rr['xchan_hash'])
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -275,9 +275,11 @@ else {
|
|||||||
// on the cookie
|
// on the cookie
|
||||||
|
|
||||||
if($_POST['remember_me']) {
|
if($_POST['remember_me']) {
|
||||||
|
$_SESSION['remember_me'] = 1;
|
||||||
\Zotlabs\Web\Session::new_cookie(31449600); // one year
|
\Zotlabs\Web\Session::new_cookie(31449600); // one year
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
$_SESSION['remember_me'] = 0;
|
||||||
\Zotlabs\Web\Session::new_cookie(0); // 0 means delete on browser exit
|
\Zotlabs\Web\Session::new_cookie(0); // 0 means delete on browser exit
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -925,7 +925,7 @@ function sync_files($channel,$files) {
|
|||||||
$ext = '';
|
$ext = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
$r = q("select filename from attach where ( filename = '%s' OR filename like '%s' ) and folder == '%s' and hash != '%s' ",
|
$r = q("select filename from attach where ( filename = '%s' OR filename like '%s' ) and folder = '%s' and hash != '%s' ",
|
||||||
dbesc($basename . $ext),
|
dbesc($basename . $ext),
|
||||||
dbesc($basename . '(%)' . $ext),
|
dbesc($basename . '(%)' . $ext),
|
||||||
dbesc($att['folder']),
|
dbesc($att['folder']),
|
||||||
|
@ -45,6 +45,11 @@ function cal_init(&$a) {
|
|||||||
|
|
||||||
function cal_content(&$a) {
|
function cal_content(&$a) {
|
||||||
|
|
||||||
|
if((get_config('system','block_public')) && (! local_channel()) && (! remote_channel())) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
$channel = null;
|
$channel = null;
|
||||||
|
|
||||||
if(argc() > 1) {
|
if(argc() > 1) {
|
||||||
|
@ -1 +1 @@
|
|||||||
2016-04-08.1360H
|
2016-04-10.1362H
|
||||||
|
Reference in New Issue
Block a user