From e481a1f63a3cedd08359eb7b4400322f0fb4a872 Mon Sep 17 00:00:00 2001 From: causefx Date: Sat, 28 Oct 2017 16:23:14 -0700 Subject: [PATCH 1/2] Fix chat time outs Fix error path Add timeout to ajax pings Add Github Issue Template --- .github/ISSUE_TEMPLATE.md | 22 ++++++++++++++++++++++ chat/connect.php | 4 ++-- error.php | 2 +- index.php | 18 +++++++++++++++++- 4 files changed, 42 insertions(+), 4 deletions(-) create mode 100644 .github/ISSUE_TEMPLATE.md diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md new file mode 100644 index 000000000..17df6db3a --- /dev/null +++ b/.github/ISSUE_TEMPLATE.md @@ -0,0 +1,22 @@ + +###### Organizr Version: V 1.x +###### Branch: Master/Develop +###### WebSever: Nginx/Apache +###### Operating System: Windows/MacOS/Ubuntu +
+ +##### Problem Description: + + +
+ +##### Reproduction Steps: + + +
+ +#### Errors on screen? If so paste here: + +``` + +``` diff --git a/chat/connect.php b/chat/connect.php index ae828fb25..7f94dad30 100644 --- a/chat/connect.php +++ b/chat/connect.php @@ -1,7 +1,7 @@ busyTimeout(5000); +$db->busyTimeout(60000); $db->exec("PRAGMA journal_mode = wal;"); -?> \ No newline at end of file +?> diff --git a/error.php b/error.php index e96358924..ae27ef833 100755 --- a/error.php +++ b/error.php @@ -39,7 +39,7 @@ $$key = $value; } //error stuff -$requested = (isset($_SERVER['HTTPS']) ? "https" : "http") . "://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]"; +$requested = $_SERVER['REQUEST_URI']; $codes = array( 400 => array('Bad Request', 'The server cannot or will not process the request due to an apparent client error.', 'sowwy'), 401 => array('Unauthorized', 'You do not have access to this page.', 'sowwy'), diff --git a/index.php b/index.php index 618590a01..d995d2ebe 100755 --- a/index.php +++ b/index.php @@ -1733,7 +1733,23 @@ function notify(notifyString, notifyIcon, notifyType, notifyLength, notifyLayout $name = str_replace(array(':', '\\', '/', '*'), 'x', $ping); if(strpos($type, 'image') !== false){ $style = "margin-top:28px"; }else{ $style = ""; }?> var pingTab = function() { - $("ping[class^='ping-']").load("ajax.php?a=get-ping&url=&style="); + //$("ping[class^='ping-']").load("ajax.php?a=get-ping&url=&style="); + $.ajax({ + url: 'ajax.php?a=get-ping&url=&style=', + timeout: 10000, + type: 'GET', + success: function(response) { + var getDiv = response; + if (typeof getDiv !== 'undefined') { + $("ping[class^='ping-']").html($(getDiv).prop('outerHTML')); + }else{ + console.log('ping- data was not sufficent or is offline'); + } + }, + error: function(jqXHR, textStatus, errorThrown) { + console.error('ping- could not be updated'); + } + }); }; // Initial Loads pingTab(); From 77065615fb1b78a9e78598a14182c0e41ae9a13f Mon Sep 17 00:00:00 2001 From: causefx Date: Sun, 29 Oct 2017 09:50:25 -0700 Subject: [PATCH 2/2] Turn Off Multiple Logins for security Add Longer Timeout for chat --- .gitignore | 3 +++ chat/refreshmessages.php | 7 ----- functions.php | 55 ++++++++++++++++++++++------------------ user.php | 3 ++- 4 files changed, 35 insertions(+), 33 deletions(-) diff --git a/.gitignore b/.gitignore index e9888ccba..ede3f8d63 100644 --- a/.gitignore +++ b/.gitignore @@ -76,3 +76,6 @@ backups/* backups/ backups test*.php +tracy/ +logs/ +debug.php diff --git a/chat/refreshmessages.php b/chat/refreshmessages.php index 6b2d732a7..03d6fc808 100644 --- a/chat/refreshmessages.php +++ b/chat/refreshmessages.php @@ -1,11 +1,4 @@ - '.$downloadName.' - '.$downloadStatus.' - '.$downloadCategory.' - '.$child['size'].' - -
-
-

'.round($downloadPercent).'%

- '.$downloadPercent.'% Complete + $gotNZB[] = ' + '.$downloadName.' + '.$downloadStatus.' + '.$downloadCategory.' + '.$child['size'].' + +
+
+

'.round($downloadPercent).'%

+ '.$downloadPercent.'% Complete +
-
- - '; - } + + '; + } - if ($gotNZB) { - return implode('',$gotNZB); - } else { - return '

No Results

'; + if ($gotNZB) { + return implode('',$gotNZB); + } else { + return '

No Results

'; + } + }else{ + writeLog("error", "SABNZBD ERROR: could not connect - check URL and/or check token - if HTTPS, is cert valid"); } } diff --git a/user.php b/user.php index 1d7caecff..422bad076 100755 --- a/user.php +++ b/user.php @@ -491,7 +491,8 @@ function authenticate_user($username, $operation) }else{ setcookie("cookiePassword", COOKIEPASSWORD, time() + (86400 * 7), "/", DOMAIN); - return true; + //return true; + return false; }