diff --git a/index.php b/index.php
index 5f927fec902..e4dce2d7dbf 100644
--- a/index.php
+++ b/index.php
@@ -6,7 +6,7 @@
# > Author: Jason Cleeland #
# > E-mail: jason@cleeland.org #
# > Mail: Box 99, Trades Hall, 54 Victoria St, #
- # > CARLTON SOUTH 3053, AUSTRALIA
+ # > CARLTON SOUTH 3053, AUSTRALIA #
# > Date: 20 February 2003 #
# #
# This set of scripts allows you to develop, publish and #
@@ -34,1437 +34,169 @@
#############################################################
*/
-session_start();
-
-if ($_GET['sid']) {$_SESSION['sid'] = $_GET['sid'];}
-if ($_POST['sid']) {$_SESSION['sid'] = $_POST['sid'];}
-$sid = $_SESSION['sid'];
-if ($_GET['token']) {$_SESSION['token'] = $_GET['token'];}
-if ($_POST['token']) {$_SESSION['token'] = $_POST['token'];}
-$token = $_SESSION['token'];
-if ($_GET['move']) {$move = $_GET['move'];}
-if ($_POST['move']) {$move = $_POST['move'];}
-if ($_POST['fvalue']) {$fvalue = $_POST['fvalue'];}
-if ($_POST['fvalue1']) {$fvalue1 = $_POST['fvalue1'];}
-if ($_POST['multi']) {$multi = $_POST['multi'];}
-if ($_POST['thisstep']) {$thisstep = $_POST['thisstep'];}
-//$thisstep = $_POST['thisstep']; if (!$thisstep) {$thisstep=$_SESSION['thisstep'];}
-#$totalsteps = $_SESSION['totalsteps'];
-#$fieldarray = $_SESSION['fieldarray'];
-#$insertarray = $_SESSION['insertarray'];
-if ($_POST['lastgroupname']) {$lastgroupname = $_POST['lastgroupname'];}
-if ($_POST['newgroup']) {$newgroup = $_POST['newgroup'];}
-if ($_POST['lastfield']) {$lastfield = $_POST['lastfield'];}
-
-if ($move == "clearall" || $move == "here" || $move == "completed")
- {
- session_unset();
- session_destroy();
- }
-
-if ($fvalue || $fvalue == "0")
- {
- if ($fvalue == " ")
- {
- //$$lastfield = "";
- $_SESSION[$lastfield] = "";
- }
- else
- {
- //$$lastfield = $fvalue;
- $_SESSION[$lastfield] = $fvalue;
- }
- }
-
-if ($multi)
- {
- $myfields = explode("|", $lastfield);
- $multimandatory="N";
- $j=0;
- for ($i=1; $i<=$multi; $i++)
- {
- $mylist = "fvalue$i";
- $arrayno = $i-1;
- $_SESSION[$myfields[$arrayno]] = $_POST[$mylist];
- //echo "$mylist -> " . $_POST[$mylist] ." -> " . $myfields[$arrayno] . " -> {$_SESSION[$myfields[$arrayno]]}
";
- //echo "$mylist: " . $_POST[$mylist] . " (session: " . $myfields[$arrayno] . ")
";
- if ($_POST[$mylist]) {$multimandatory="Y";} //if there are any answers, set this to true
- if ($_POST[$mylist] && ($_POST['lasttype'] == "R" || $_POST['lasttype'] == "A" || $_POST['lasttype'] == "B" || $_POST['lasttype'] == "C"))
- {
- $j++;
- }
- }
- if ($_POST['lasttype'] == "R" || $_POST['lasttype'] == "A" || $_POST['lasttype'] == "B" || $_POST['lasttype'] == "C")
- {
- //echo "$j == $i == $multi";
- if ($j == $multi)
- {
- $multimandatory="Y";
- } else {
- $multimandatory="N";
- }
- }
- $mylist = substr($mylist, 0, strlen($mylist)-1);
- }
-//This section handles the question number that will be answered - moving backwards and forwards as required
-if ($_POST['mandatory'] == "Y" && ($_POST['fvalue'] != "0" && !$_POST['fvalue'] || $_POST['fvalue'] == " ") && !$multimandatory) //if the last question was mandatory but there is no data
- {
- //Repeat last question until an answer is shown
- if ($move == " last ") {$move = " next >> ";} //avoids going to submit if last question isn't answered
- $repeatmandatory="Y"; //avoids repeating group description if this is the first question of a group (see group description section at top of else{})
- }
-elseif ($_POST['mandatory'] == "Y" && $multi && $multimandatory != "Y")
- {
- if ($move == " last ") {$move = " next >> ";}
- $repeatmandatory="Y"; //avoids repeating group description if this is the first question of a group
- }
-else
- {
- if ($move == " << prev " && $newgroup != "yes") {$_SESSION['step'] = $thisstep-1;} else {$_SESSION['step'] = $thisstep;}
- if ($move == " next >> ") {$_SESSION['step'] = $thisstep+1;}
- if ($move == " last ") {$_SESSION['step'] = $thisstep+1;}
- }
+session_start();
include("./admin/config.php");
-//if ($sid != $_GET['sid'] && $sid != $_POST['sid']){$sid = $_GET['sid'];}
-
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past
-header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
- // always modified
+header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); // always modified
header("Cache-Control: no-store, no-cache, must-revalidate"); // HTTP/1.1
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache"); // HTTP/1.0
+//DEFAULT SETTINGS FOR TEMPLATES
+if (!$publicdir) {$publicdir=".";}
+$tpldir="$publicdir/templates";
-echo "\n