Răsfoiți Sursa

Merge pull request #700 from causefx/develop

Develop
causefx 8 ani în urmă
părinte
comite
ab098419ee
8 a modificat fișierele cu 77 adăugiri și 37 ștergeri
  1. 22 0
      .github/ISSUE_TEMPLATE.md
  2. 3 0
      .gitignore
  3. 2 2
      chat/connect.php
  4. 0 7
      chat/refreshmessages.php
  5. 1 1
      error.php
  6. 30 25
      functions.php
  7. 17 1
      index.php
  8. 2 1
      user.php

+ 22 - 0
.github/ISSUE_TEMPLATE.md

@@ -0,0 +1,22 @@
+<!-- Please Fill out as much information as possible, Thanks! -->
+###### Organizr Version: V 1.x
+###### Branch: Master/Develop
+###### WebSever: Nginx/Apache
+###### Operating System: Windows/MacOS/Ubuntu
+<hr>
+
+##### Problem Description:
+<!---TYPE HERE--->
+
+<hr>
+
+##### Reproduction Steps:
+<!---TYPE HERE--->
+
+<hr>
+
+#### Errors on screen?  If so paste here:
+<!-- (Errors go below the first ``` . Don't remove the ' tags) -->
+```
+
+```

+ 3 - 0
.gitignore

@@ -76,3 +76,6 @@ backups/*
 backups/
 backups
 test*.php
+tracy/
+logs/
+debug.php

+ 2 - 2
chat/connect.php

@@ -1,7 +1,7 @@
 <?php
 
 $db = new SQLite3("../chatpack.db");
-$db->busyTimeout(5000);
+$db->busyTimeout(60000);
 $db->exec("PRAGMA journal_mode = wal;");
 
-?>
+?>

+ 0 - 7
chat/refreshmessages.php

@@ -1,11 +1,4 @@
 <?php
-// Load USER
-//require_once("../user.php");
-//$USER = new User("registration_callback");
-
-// Some PHP config stuff
-ini_set("display_errors", 1);
-ini_set("error_reporting", E_ALL | E_STRICT);
 
 $currentuser = $_POST["user"];
 

+ 1 - 1
error.php

@@ -39,7 +39,7 @@ foreach(loadAppearance() as $key => $value) {
 	$$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'),

+ 30 - 25
functions.php

@@ -2,8 +2,10 @@
 
 // ===================================
 // Define Version
- define('INSTALLEDVERSION', '1.6');
+ define('INSTALLEDVERSION', '1.601');
 // ===================================
+$debugOrganizr = true;
+if($debugOrganizr == true && file_exists('debug.php')){ require_once('debug.php'); }
 use Kryptonit3\Sonarr\Sonarr;
 use Kryptonit3\SickRage\SickRage;
 //homepage order
@@ -2607,36 +2609,39 @@ function nzbgetConnect($list = 'listgroups') {
 function sabnzbdConnect($list = 'queue') {
     $url = qualifyURL(SABNZBDURL);
 
-    $api = file_get_contents($url.'/api?mode='.$list.'&output=json&apikey='.SABNZBDKEY);
+    $api = @file_get_contents($url.'/api?mode='.$list.'&output=json&apikey='.SABNZBDKEY);
     $api = json_decode($api, true);
 
     $gotNZB = array();
+	if (is_array($api) || is_object($api)){
+	    foreach ($api[$list]['slots'] AS $child) {
+	        if($list == "queue"){ $downloadName = $child['filename']; $downloadCategory = $child['cat']; $downloadPercent = (($child['mb'] - $child['mbleft']) / $child['mb']) * 100; $progressBar = "progress-bar-striped active"; }
+	        if($list == "history"){ $downloadName = $child['name']; $downloadCategory = $child['category']; $downloadPercent = "100"; $progressBar = ""; }
+	        $downloadStatus = $child['status'];
 
-    foreach ($api[$list]['slots'] AS $child) {
-        if($list == "queue"){ $downloadName = $child['filename']; $downloadCategory = $child['cat']; $downloadPercent = (($child['mb'] - $child['mbleft']) / $child['mb']) * 100; $progressBar = "progress-bar-striped active"; }
-        if($list == "history"){ $downloadName = $child['name']; $downloadCategory = $child['category']; $downloadPercent = "100"; $progressBar = ""; }
-        $downloadStatus = $child['status'];
-
-        $gotNZB[] = '<tr>
-						<td class="col-xs-6 nzbtable-file-row">'.$downloadName.'</td>
-						<td class="col-xs-2 nzbtable nzbtable-row">'.$downloadStatus.'</td>
-						<td class="col-xs-1 nzbtable nzbtable-row">'.$downloadCategory.'</td>
-						<td class="col-xs-1 nzbtable nzbtable-row">'.$child['size'].'</td>
-						<td class="col-xs-2 nzbtable nzbtable-row">
-							<div class="progress">
-								<div class="progress-bar progress-bar-success '.$progressBar.'" role="progressbar" aria-valuenow="'.$downloadPercent.'" aria-valuemin="0" aria-valuemax="100" style="width: '.$downloadPercent.'%">
-									<p class="text-center">'.round($downloadPercent).'%</p>
-									<span class="sr-only">'.$downloadPercent.'% Complete</span>
+	        $gotNZB[] = '<tr>
+							<td class="col-xs-6 nzbtable-file-row">'.$downloadName.'</td>
+							<td class="col-xs-2 nzbtable nzbtable-row">'.$downloadStatus.'</td>
+							<td class="col-xs-1 nzbtable nzbtable-row">'.$downloadCategory.'</td>
+							<td class="col-xs-1 nzbtable nzbtable-row">'.$child['size'].'</td>
+							<td class="col-xs-2 nzbtable nzbtable-row">
+								<div class="progress">
+									<div class="progress-bar progress-bar-success '.$progressBar.'" role="progressbar" aria-valuenow="'.$downloadPercent.'" aria-valuemin="0" aria-valuemax="100" style="width: '.$downloadPercent.'%">
+										<p class="text-center">'.round($downloadPercent).'%</p>
+										<span class="sr-only">'.$downloadPercent.'% Complete</span>
+									</div>
 								</div>
-							</div>
-						</td>
-					</tr>';
-    }
+							</td>
+						</tr>';
+	    }
 
-	if ($gotNZB) {
-		return implode('',$gotNZB);
-	} else {
-		return '<tr><td colspan="5"><p class="text-center">No Results</p></td></tr>';
+		if ($gotNZB) {
+			return implode('',$gotNZB);
+		} else {
+			return '<tr><td colspan="5"><p class="text-center">No Results</p></td></tr>';
+		}
+	}else{
+		writeLog("error", "SABNZBD ERROR: could not connect - check URL and/or check token - if HTTPS, is cert valid");
 	}
 }
 

+ 17 - 1
index.php

@@ -1733,7 +1733,23 @@ $group = (isset($group) ? $group : "guest");
 					$name = str_replace(array(':', '\\', '/', '*'), 'x', $ping);
 					if(strpos($type, 'image') !== false){ $style = "margin-top:28px"; }else{ $style = ""; }?>
 					var  pingTab<?php echo $pingCount;?> = function() {
-						$("ping[class^='ping-<?php echo $name;?>']").load("ajax.php?a=get-ping&url=<?php echo $ping;?>&style=<?php echo $style;?>");
+						//$("ping[class^='ping-<?php echo $name;?>']").load("ajax.php?a=get-ping&url=<?php echo $ping;?>&style=<?php echo $style;?>");
+						$.ajax({
+							url: 'ajax.php?a=get-ping&url=<?php echo $ping;?>&style=<?php echo $style;?>',
+							timeout: 10000,
+							type: 'GET',
+							success: function(response) {
+								var getDiv = response;
+								if (typeof getDiv !== 'undefined') {
+									$("ping[class^='ping-<?php echo $name;?>']").html($(getDiv).prop('outerHTML'));
+								}else{
+									console.log('ping-<?php echo $name;?> data was not sufficent or is offline');
+								}
+							},
+							error: function(jqXHR, textStatus, errorThrown) {
+								console.error('ping-<?php echo $name;?> could not be updated');
+							}
+						});
 					};
 					// Initial Loads
 					pingTab<?php echo $pingCount;?>();

+ 2 - 1
user.php

@@ -491,7 +491,8 @@
             }else{
 
                 setcookie("cookiePassword", COOKIEPASSWORD, time() + (86400 * 7), "/", DOMAIN);
-                return true;
+                //return true;
+				return false;
 
             }