--- index.php.old 2007-04-23 13:36:53.000000000 -0700 +++ index.php 2007-04-23 13:01:36.000000000 -0700 @@ -20,8 +20,9 @@ You should have received a copy of the GNU General Public License along with TorrentFlux; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ + Modified by Cameron Dale for Ajax, v3 +*/ include_once("config.php"); include_once("functions.php"); @@ -34,17 +35,38 @@ if(getRequestVar("pagerefresh") == "false") { $_SESSION['prefresh'] = false; - header("location: index.php"); + header("location: ".$_SERVER['PHP_SELF']); exit(); } if(getRequestVar("pagerefresh") == "true") { $_SESSION["prefresh"] = true; - header("location: index.php"); + header("location: ".$_SERVER['PHP_SELF']); exit(); } } +// set ajax refresh option into the session cookie +if(array_key_exists("ajaxrefresh", $_GET)) +{ + if(getRequestVar("ajaxrefresh") == "false") + { + $_SESSION['use_ajax'] = false; + header("location: ".$_SERVER['PHP_SELF']); + exit(); + } + + if(getRequestVar("ajaxrefresh") == "true") + { + $_SESSION["use_ajax"] = true; + header("location: ".$_SERVER['PHP_SELF']); + exit(); + } +} + +include_once("Sajax.php"); +include_once("functionsAjax.php"); + // Check to see if QManager is running if not Start it. if (checkQManager() == 0 ) { @@ -325,7 +347,7 @@ } else { - header("location: index.php"); + header("location: ".$_SERVER['PHP_SELF']); exit(); } } @@ -415,7 +437,7 @@ if ($messages == "") { AuditAction($cfg["constants"]["url_upload"], $file_name); - header("location: index.php"); + header("location: ".$_SERVER['PHP_SELF']); exit(); } else @@ -453,7 +475,7 @@ AuditAction($cfg["constants"]["file_upload"], $file_name); - header("location: index.php"); + header("location: ".$_SERVER['PHP_SELF']); } else { @@ -497,7 +519,7 @@ AuditAction($cfg["constants"]["delete_torrent"], $delfile); - header("location: index.php"); + header("location: ".$_SERVER['PHP_SELF']); exit(); } else @@ -566,7 +588,7 @@ } else { - header("location: index.php"); + header("location: ".$_SERVER['PHP_SELF']); exit(); } } @@ -621,16 +643,20 @@ { // torrent has been started... try and kill it. AuditAction($cfg["constants"]["unqueued_torrent"], $QEntry . "has been started -- TRY TO KILL IT"); - header("location: index.php?alias_file=".$alias_file."&kill=true&kill_torrent=".urlencode($QEntry)); + header("location: ".$_SERVER['PHP_SELF']."?alias_file=".$alias_file."&kill=true&kill_torrent=".urlencode($QEntry)); exit(); } - header("location: index.php"); + header("location: ".$_SERVER['PHP_SELF']); exit(); } $drivespace = getDriveSpace($cfg["path"]); +sajax_init(); +// $sajax_debug_mode = 1; +sajax_export("ajaxUpdate"); +sajax_handle_client_request(); /************************************************************ @@ -646,7 +672,10 @@ "; + if (!isset($cfg['use_ajax'])) $cfg['use_ajax'] = 0; + if (((isset($_SESSION['use_ajax'])) && ($_SESSION['use_ajax'] == false)) || + ((!isset($_SESSION['use_ajax'])) && ($cfg['use_ajax'] == false))) { + echo ""; ?> "; + + echo " + +
@@ -686,7 +791,13 @@ + "> + +"> +" colspan="2"> + | " colspan="2">
- |
+
" colspan="2"> @@ -851,7 +963,7 @@ |
: | -kB/s | +kB/s |
: | -kB/s | +kB/s |
: | -+ | |
: | @@ -966,7 +1087,7 @@ { $loadavg_array = explode(" ", exec("cat ".escapeshellarg($cfg["loadavg_path"]))); $loadavg = $loadavg_array[2]; - echo "".$loadavg.""; + echo "".$loadavg.""; } else {