Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/tbar0970/jethro-pmm
Browse files Browse the repository at this point in the history
  • Loading branch information
tbar0970 committed Oct 15, 2018
2 parents 8baa801 + 00b6e27 commit 5bc467d
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 17 deletions.
3 changes: 2 additions & 1 deletion db_objects/abstract_note.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,8 @@ protected static function _getFields()
'editable' => false,
'references' => 'person',
'visible' => false,
'default' => 0,
'default' => NULL,
'allow_empty' => TRUE,
),
'edited' => Array(
'type' => 'datetime',
Expand Down
16 changes: 8 additions & 8 deletions include/init.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,6 @@
error_reporting($error_level);
@ini_set('display_errors', 1);

// If max length is set, set the cookie timeout - this will allow sessions to outlast browser invocations
$expiryTime = defined('SESSION_MAXLENGTH_MINS') ? SESSION_MAXLENGTH_MINS * 60 : NULL;
session_set_cookie_params($expiryTime, parse_url(BASE_URL, PHP_URL_PATH));

if (session_id() == '') {
session_name('JethroSession');
session_start();
}
require_once JETHRO_ROOT.'/include/general.php';
strip_all_slashes();

Expand Down Expand Up @@ -56,6 +48,14 @@

Config_Manager::init();

// If max length is set, set the cookie timeout - this will allow sessions to outlast browser invocations
$expiryTime = defined('SESSION_MAXLENGTH_MINS') ? SESSION_MAXLENGTH_MINS * 60 : NULL;
session_set_cookie_params($expiryTime, parse_url(BASE_URL, PHP_URL_PATH));
if (session_id() == '') {
session_name('JethroSession');
session_start();
}

if (defined('TIMEZONE') && constant('TIMEZONE')) {
date_default_timezone_set(constant('TIMEZONE'));
$res = $GLOBALS['db']->query('SET time_zone = "'.date('P').'"');
Expand Down
18 changes: 18 additions & 0 deletions resources/js/jethro.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,22 @@ $(document).ready(function() {

// Make standalone safari stay standalone
if (("standalone" in window.navigator) && window.navigator.standalone) {
// http://www.andymercer.net/blog/2016/02/full-screen-web-apps-on-ios/
var insideApp = sessionStorage.getItem('insideApp'), location = window.location, stop = /^(a|html)$/i;
if (insideApp) {
localStorage.setItem('returnToPage', location);
} else {
var returnToPage = localStorage.getItem('returnToPage');
if (returnToPage) {
window.location = returnToPage;
}
sessionStorage.setItem('insideApp', true);
}

// add a back button
$('a.brand').parent().prepend('<i class="icon-white icon-chevron-left" onclick="history.go(-1); "></i>')

// stay inside the app, avoid linking out to mobile safari
$("a").click(function (event) {
if ((!$(this).attr('target'))
&& (!$(this).attr('data-toggle'))
Expand All @@ -19,6 +34,9 @@ $(document).ready(function() {
}
});
}
if (("standalone" in window.navigator) && !window.navigator.standalone) {
// Opportunity to tell them to save to home screen
}

// This needs to be first!
// https://github.com/twitter/bootstrap/issues/3217
Expand Down
13 changes: 5 additions & 8 deletions templates/main.template.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@
<div class="user-detail pull-right">
<div>
<input type="hidden" name="logout" value="1" />
<?php echo _('Logged in as')?>
<?php echo _('Logged in as')?>
<span class="dropdown">
<a class="dropdown-toggle" id="user-menu" data-toggle="dropdown" href="#">
<?php echo $GLOBALS['user_system']->getCurrentUser('first_name').' '.$GLOBALS['user_system']->getCurrentUser('last_name'); ?>
<i class="caret"></i>
<i class="caret"></i>
</a>
<ul class="dropdown-menu pull-right" role="menu" aria-labelledby="user-menu">
<li><a href="?view=_edit_me"><?php echo _('Edit me')?></a></li>
Expand Down Expand Up @@ -65,10 +65,7 @@
<ul class="dropdown-menu">
<li><a href="?view=_edit_me"><?php echo _('Edit me')?></a></li>
<li>
<a class="log-out" href="#"><form class="min" method="post" action="<?php echo BASE_URL; ?>">
<input type="hidden" name="logout" value="1" />
<button class="btn-link" type="submit"><?php echo _('Log ou')?>t</button>
</form></a>
<a href="./?logout=1" data-method="post"><?php echo _('Log out')?></a>
</li>
</ul>
</li>
Expand All @@ -79,8 +76,8 @@

</div>
<div id="body">
<?php
<?php

dump_messages();

if ($title = $GLOBALS['system']->getTitle()) {
Expand Down
7 changes: 7 additions & 0 deletions upgrades/2018-upgrade-to-2.25.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/* Issue #481 - fix FK so that I don't get notified about notes I created for myself */
ALTER TABLE abstract_note
MODIFY COLUMN editor int(11) default null;
update abstract_note
set editor = NULL where editor = 0;
ALTER TABLE abstract_note
ADD CONSTRAINT abstract_note_editor FOREIGN KEY (`editor`) REFERENCES _person(`id`);

0 comments on commit 5bc467d

Please sign in to comment.