From: Simon H. <sim...@us...> - 2010-11-09 16:52:16
|
Update of /cvsroot/stack/stack-dev/install In directory sfp-cvsdas-3.v30.ch3.sourceforge.com:/tmp/cvs-serv25193/install Modified Files: Tag: item_state_separation installStyles.css healthcheck.php answer_test_testsuite.php p2.php p3.php p4.php installTranslator.php adodbinit.php installFunctions.php Log Message: Brought back up to date with big HEAD merge. Index: installTranslator.php =================================================================== RCS file: /cvsroot/stack/stack-dev/install/installTranslator.php,v retrieving revision 1.1 retrieving revision 1.1.18.1 diff -C2 -d -r1.1 -r1.1.18.1 *** installTranslator.php 5 Apr 2007 14:02:29 -0000 1.1 --- installTranslator.php 9 Nov 2010 16:51:37 -0000 1.1.18.1 *************** *** 1,14 **** <?php ! /* ! Usual translator is no good for us, as config.php not been wrote yet. Instead pull language straight from session. */ ! session_start(); ! ! function get_string($identifier, $module='', $a=NULL) { ! //global $config; //return '['. $identifier .']'; --- 1,14 ---- <?php ! /* ! Usual translator is no good for us, as config.php not been wrote yet. Instead pull language straight from session. */ ! if(session_id() == '') session_start(); ! ! function get_string($identifier, $module='', $a=NULL) { ! //global $config; //return '['. $identifier .']'; *************** *** 20,24 **** // Get the current language if(!empty($_SESSION['Slang'])) ! { $lang = $_SESSION['Slang']; } --- 20,24 ---- // Get the current language if(!empty($_SESSION['Slang'])) ! { $lang = $_SESSION['Slang']; } *************** *** 27,32 **** $lang = 'en'; } ! ! /*if (is_array($options)) { if (array_key_exists('Language',$options)) { --- 27,32 ---- $lang = 'en'; } ! ! /*if (is_array($options)) { if (array_key_exists('Language',$options)) { Index: p3.php =================================================================== RCS file: /cvsroot/stack/stack-dev/install/p3.php,v retrieving revision 1.24 retrieving revision 1.24.8.1 diff -C2 -d -r1.24 -r1.24.8.1 *** p3.php 1 Sep 2009 08:45:50 -0000 1.24 --- p3.php 9 Nov 2010 16:51:37 -0000 1.24.8.1 *************** *** 17,33 **** */ //check we have the required settings to be here, else bounce to start ! session_start(); ! $configFile = '../config.php'; ! if(file_exists($configFile)) ! { ! require($configFile); ! $config = new stackConfig(); ! global $config; ! $root = $config->get('docroot'); ! // Ensure admin is logged in. ! require $root.'/lib/ui/AdminInterface.php'; ! } --- 17,33 ---- */ //check we have the required settings to be here, else bounce to start ! if(session_id() == '') session_start(); ! $configFile = '../config.php'; ! if(file_exists($configFile)) ! { ! require($configFile); ! $config = new stackConfig(); ! global $config; ! $root = $config->get('docroot'); ! // Ensure admin is logged in. ! require $root.'/lib/ui/AdminInterface.php'; ! } *************** *** 104,108 **** require_once($_SESSION['Sdocroot'].'/maxima/initMaxima.php'); ! $errorMessgage = ''; //form has been sent, check all complete foreach($_SESSION as $label => $val) --- 104,108 ---- require_once($_SESSION['Sdocroot'].'/maxima/initMaxima.php'); ! $errorMessage = ''; //form has been sent, check all complete foreach($_SESSION as $label => $val) *************** *** 215,219 **** <div class="content"> <?php ! if ($errorMessage != '') echo '<div class="box"> <p>'.$errorMessage.'</p> --- 215,219 ---- <div class="content"> <?php ! if (!empty($errorMessage)) echo '<div class="box"> <p>'.$errorMessage.'</p> *************** *** 265,269 **** <?php ! $maximaVersions = array('5.19.2','5.18.1','5.17.0','5.16.3','5.15.0','5.13.0','5.12.0','5.11.0'); foreach($maximaVersions as $mVer) { --- 265,269 ---- <?php ! $maximaVersions = array('5.22.1','5.21.1','5.20.1','5.19.2','5.18.1','5.17.0','5.16.3','5.15.0'); foreach($maximaVersions as $mVer) { *************** *** 284,290 **** <div class="row"> <span class="label">Platform:</span><span class="formw"> <input type="radio" name="platform" value="win" <?php if($_SESSION['Splatform'] == 'win'){echo 'checked';} ?> onclick="containerHeight.hide();" /> <?php echo get_string('stackInstall_win','stack'); ?><br /> ! <input type="radio" name="platform" value="unix" <?php if($_SESSION['Splatform'] == 'unix'){echo 'checked';} ?> onclick="containerHeight.hide();" /> <?php echo get_string('stackInstall_unix','stack'); ?><br /> ! <input type="radio" name="platform" value="server" <?php if($_SESSION['Splatform'] == 'server'){echo 'checked';} ?> onclick="containerHeight.toggle();" /> <?php echo get_string('stackInstall_serverMode','stack'); ?><br /> </span> </div> --- 284,291 ---- <div class="row"> <span class="label">Platform:</span><span class="formw"> + <?php if(!isset($_SESSION['Splatform'])) $_SESSION['Splatform'] = 'win'; ?> <input type="radio" name="platform" value="win" <?php if($_SESSION['Splatform'] == 'win'){echo 'checked';} ?> onclick="containerHeight.hide();" /> <?php echo get_string('stackInstall_win','stack'); ?><br /> ! <input type="radio" name="platform" value="unix" <?php if($_SESSION['Splatform'] == 'unix'){echo 'checked';} ?> onclick="containerHeight.hide();" /> <?php echo get_string('stackInstall_unix','stack'); ?><br /> ! <input type="radio" name="platform" value="server" <?php if($_SESSION['Splatform'] == 'server'){echo 'checked';} ?> onclick="containerHeight.toggle();" /> <?php echo get_string('stackInstall_serverMode','stack'); ?><br /> </span> </div> *************** *** 363,371 **** <?php echo get_string('stackInstall_externalProgInfo','stack'); ?> </div> ! <div class="box"> ! <div class="row"> ! <span class="label"><?php echo get_string('stackInstall_submit','stack'); ?></span><span class="formw"><input type="submit" value="<?php echo get_string('stackInstall_submit','stack'); ?>" /></span> ! </div> ! </div> <input type="hidden" name="sent" value="sent" /> --- 364,368 ---- <?php echo get_string('stackInstall_externalProgInfo','stack'); ?> </div> ! <span class="formw"><span class="formw"><input type="submit" value="<?php echo get_string('stackInstall_contButton','stack'); ?>" /></span> <input type="hidden" name="sent" value="sent" /> Index: p2.php =================================================================== RCS file: /cvsroot/stack/stack-dev/install/p2.php,v retrieving revision 1.23 retrieving revision 1.23.10.1 diff -C2 -d -r1.23 -r1.23.10.1 *** p2.php 26 Jun 2009 18:08:21 -0000 1.23 --- p2.php 9 Nov 2010 16:51:37 -0000 1.23.10.1 *************** *** 19,24 **** if(!isset($_POST['submitted'])) { ! session_start(); ! $configFile = '../config.php'; if(file_exists($configFile)) --- 19,24 ---- if(!isset($_POST['submitted'])) { ! if(session_id() == '') session_start(); ! $configFile = '../config.php'; if(file_exists($configFile)) *************** *** 28,43 **** global $config; $root = $config->get('docroot'); ! // Ensure admin is logged in. require $root.'/lib/ui/AdminInterface.php'; } ! $_SESSION['Senv'] = $_POST['env']; ! if ($_SESSION['Senv'] != 'ok') { header('Location: index.php'); } ! $server = 'localhost'; $db = 'stack'; --- 28,43 ---- global $config; $root = $config->get('docroot'); ! // Ensure admin is logged in. require $root.'/lib/ui/AdminInterface.php'; } ! $_SESSION['Senv'] = $_POST['env']; ! if ($_SESSION['Senv'] != 'ok') { header('Location: index.php'); } ! $server = 'localhost'; $db = 'stack'; *************** *** 49,53 **** $moodlepassword = ''; $moodleprefix = 'mdl_'; ! } --- 49,53 ---- $moodlepassword = ''; $moodleprefix = 'mdl_'; ! } *************** *** 55,65 **** { //attempt to load variables from the session ! session_start(); ! $server = $_SESSION['Sdbserver']; $db = $_SESSION['Sdb']; $username = $_SESSION['Sdbusername']; $password = $_SESSION['Sdbpassword']; $driver = $_SESSION['Sdriver']; ! $moodleserver = $_SESSION['SmoodleDBhost']; $moodleusername = $_SESSION['SmoodleDBuser']; --- 55,65 ---- { //attempt to load variables from the session ! //session_start(); ! $server = $_SESSION['Sdbserver']; $db = $_SESSION['Sdb']; $username = $_SESSION['Sdbusername']; $password = $_SESSION['Sdbpassword']; $driver = $_SESSION['Sdriver']; ! $moodleserver = $_SESSION['SmoodleDBhost']; $moodleusername = $_SESSION['SmoodleDBuser']; *************** *** 84,88 **** $password = addslashes($_POST['password']); $driver = addslashes($_POST['driver']); ! $moodleserver = addslashes($_POST['moodleserver']); $moodledb = addslashes($_POST['moodledb']); --- 84,88 ---- $password = addslashes($_POST['password']); $driver = addslashes($_POST['driver']); ! $moodleserver = addslashes($_POST['moodleserver']); $moodledb = addslashes($_POST['moodledb']); *************** *** 91,100 **** $moodleprefix = addslashes($_POST['moodleprefix']); $moodleDriver = addslashes($_POST['moodleDriver']); ! //check can access db with supplied details //@$link = mysql_connect($server, $username, $password); require_once('adodbinit.php'); $link = testConnection($server, $username, $password, $db, $driver); ! if (!$link) { --- 91,100 ---- $moodleprefix = addslashes($_POST['moodleprefix']); $moodleDriver = addslashes($_POST['moodleDriver']); ! //check can access db with supplied details //@$link = mysql_connect($server, $username, $password); require_once('adodbinit.php'); $link = testConnection($server, $username, $password, $db, $driver); ! if (!$link) { *************** *** 108,112 **** else { ! //add to session session_start(); --- 108,112 ---- else { ! //add to session session_start(); *************** *** 118,122 **** $result = buildTables($server, $username, $password, $db, $driver); ! if($result != true) { --- 118,122 ---- $result = buildTables($server, $username, $password, $db, $driver); ! if($result != true) { *************** *** 145,153 **** //try to connect to moodle database. //@$link = mysql_connect($moodleserver, $moodleusername, $moodlepassword); ! //@$selectedDB = mysql_select_db($moodledb, $link); ! $moodleConn = testConnection($moodleserver, $moodleusername, $moodlepassword, $moodledb, $moodleDriver); ! if ($moodleConn == false) { --- 145,153 ---- //try to connect to moodle database. //@$link = mysql_connect($moodleserver, $moodleusername, $moodlepassword); ! //@$selectedDB = mysql_select_db($moodledb, $link); ! $moodleConn = testConnection($moodleserver, $moodleusername, $moodlepassword, $moodledb, $moodleDriver); ! if ($moodleConn == false) { *************** *** 177,184 **** $_SESSION['SmoodleDriver'] = $moodleDriver; $_SESSION['SmoodleSetup'] = 'true'; ! header('Location: p3.php'); } ! } else --- 177,184 ---- $_SESSION['SmoodleDriver'] = $moodleDriver; $_SESSION['SmoodleSetup'] = 'true'; ! header('Location: p3.php'); } ! } else *************** *** 187,196 **** header('Location: p3.php'); } ! ! } } } ! } --- 187,196 ---- header('Location: p3.php'); } ! ! } } } ! } Index: installFunctions.php =================================================================== RCS file: /cvsroot/stack/stack-dev/install/installFunctions.php,v retrieving revision 1.35 retrieving revision 1.35.8.1 diff -C2 -d -r1.35 -r1.35.8.1 *** installFunctions.php 1 Sep 2009 08:45:50 -0000 1.35 --- installFunctions.php 9 Nov 2010 16:51:37 -0000 1.35.8.1 *************** *** 28,32 **** * @return bool true if write succeeded. */ ! session_start(); function createTmpDir($root, $tmp) --- 28,32 ---- * @return bool true if write succeeded. */ ! if(session_id() == '') session_start(); function createTmpDir($root, $tmp) *************** *** 146,150 **** $config .= ' ! $this->configArray["version"] = "STACK 2.0 beta"; $this->configArray["platform"] = '."'".$_SESSION['Splatform']."'".'; //server os / server mode $this->configArray["host"] = '."'".$_SESSION['Shost']."'".'; //server hostname --- 146,150 ---- $config .= ' ! $this->configArray["version"] = "STACK 2.2"; $this->configArray["platform"] = '."'".$_SESSION['Splatform']."'".'; //server os / server mode $this->configArray["host"] = '."'".$_SESSION['Shost']."'".'; //server hostname *************** *** 199,214 **** switch($this->casArray["version"]) { - case "5.11.0": - $this->casArray["command"] = $this->configArray["docroot"]."/maxima/stackmaxima_5.11.0.bat"; - break; - - case "5.12.0": - $this->casArray["command"] = $this->configArray["docroot"]."/maxima/stackmaxima_5.12.0.bat"; - break; - - case "5.13.0": - $this->casArray["command"] = $this->configArray["docroot"]."/maxima/stackmaxima_5.13.0.bat"; - break; - case "5.15.0": $this->casArray["command"] = $this->configArray["docroot"]."/maxima/stackmaxima_5.15.0.bat"; --- 199,202 ---- *************** *** 230,233 **** --- 218,233 ---- $this->casArray["command"] = $this->configArray["docroot"]."/maxima/stackmaxima_5.19.2.bat"; break; + + case "5.20.1": + $this->casArray["command"] = $this->configArray["docroot"]."/maxima/stackmaxima_5.20.1.bat"; + break; + + case "5.21.1": + $this->casArray["command"] = $this->configArray["docroot"]."/maxima/stackmaxima_5.20.1.bat"; + break; + + case "5.21.2": + $this->casArray["command"] = $this->configArray["docroot"]."/maxima/stackmaxima_5.20.1.bat"; + break; } *************** *** 279,283 **** } } ! ?>'; $config = trim($config); return $config; --- 279,283 ---- } } ! '; // deliberately omitting PHP close tag to avoid trailing whitespace issues $config = trim($config); return $config; *************** *** 285,291 **** /** ! * Checks the config.php wrote to disk is valid. * - * Checks last characters are ?> * @return bool */ --- 285,290 ---- /** ! * Checks the config.php wrote to disk is valid and secure. * * @return bool */ *************** *** 295,309 **** if($conf == false){ return false; ! }else{ ! if(substr($conf, -2) != '?>'){ ! return false; ! } ! else{ ! return true; ! } } } /** * Called at end of installation process, writes out the a server specific WSDL file required for Opaque server to function * --- 294,322 ---- if($conf == false){ return false; ! } else { ! return true; } } /** + * Checks various potential security loopholes. + * + * @return bool + */ + function checkSecurity(){ + + $issues = ''; + + if(file_exists('../config.php~')) { + $issues .= '<li>Your configuration settings are public as <tt>config.php~</tt>. You should remove this file.'; + } + if(!empty($issues)) { + $issues = '<ul>'.$issues.'</ul>'; + } + + return $issues; + } + + /** * Called at end of installation process, writes out the a server specific WSDL file required for Opaque server to function * *************** *** 500,504 **** $send .= "Referer: $r\r\n"; }else{ ! if ($_SERVER['HTTP_REFERER']){ $send .= "Referer: {$_SERVER['HTTP_REFERER']}\r\n"; } --- 513,517 ---- $send .= "Referer: $r\r\n"; }else{ ! if (isset($_SERVER['HTTP_REFERER'])){ $send .= "Referer: {$_SERVER['HTTP_REFERER']}\r\n"; } *************** *** 529,534 **** } fputs($open, $send); while (!feof($open)) { ! $return .= fgets($open, 4096); } fclose($open); --- 542,548 ---- } fputs($open, $send); + $return = ''; while (!feof($open)) { ! $return .= fgets($open, 4096); } fclose($open); Index: answer_test_testsuite.php =================================================================== RCS file: /cvsroot/stack/stack-dev/install/answer_test_testsuite.php,v retrieving revision 1.42.2.2 retrieving revision 1.42.2.2.2.1 diff -C2 -d -r1.42.2.2 -r1.42.2.2.2.1 *** answer_test_testsuite.php 3 Nov 2009 13:35:43 -0000 1.42.2.2 --- answer_test_testsuite.php 9 Nov 2010 16:51:37 -0000 1.42.2.2.2.1 *************** *** 45,49 **** // AlgEquiv Answer tests. ! $testsuite[] = stack_testsuite_construct('AlgEquiv','1/0','x^2-2*x+1',0,'',''); $testsuite[] = stack_testsuite_construct('AlgEquiv','integerp(3)','true',1,'','Predicates'); $testsuite[] = stack_testsuite_construct('AlgEquiv','integerp(3.1)','true',0,'',''); --- 45,50 ---- // AlgEquiv Answer tests. ! $testsuite[] = stack_testsuite_construct('AlgEquiv','1/0','1',0,'',''); ! $testsuite[] = stack_testsuite_construct('AlgEquiv','1','1/0',0,'',''); $testsuite[] = stack_testsuite_construct('AlgEquiv','integerp(3)','true',1,'','Predicates'); $testsuite[] = stack_testsuite_construct('AlgEquiv','integerp(3.1)','true',0,'',''); *************** *** 62,65 **** --- 63,69 ---- $testsuite[] = stack_testsuite_construct('AlgEquiv','abs(x)','sqrt(x^2)',1,'',''); $testsuite[] = stack_testsuite_construct('AlgEquiv','x-1','(x^2-1)/(x+1)',1,'',''); + $testsuite[] = stack_testsuite_construct('AlgEquiv','a^b*a^c','a^(b+c)',1,'',''); + $testsuite[] = stack_testsuite_construct('AlgEquiv','(4*sqrt(3)*%i+4)^(1/5)','6^(1/5)*cos(%pi/15)-6^(1/5)*%i*sin(%pi/15)',0,'',''); + $testsuite[] = stack_testsuite_construct('AlgEquiv','(x-1)^2','x^2-2*x+1',1,'','Polynomials and rational function'); $testsuite[] = stack_testsuite_construct('AlgEquiv','(x-1)*(x^2+x+1)','x^3-1',1,'',''); *************** *** 70,75 **** --- 74,81 ---- $testsuite[] = stack_testsuite_construct('AlgEquiv','2*cos(x)^2-1','cos(2*x)',1,'',''); $testsuite[] = stack_testsuite_construct('AlgEquiv','exp(%i*%pi)','-1',1,'',''); + $testsuite[] = stack_testsuite_construct('AlgEquiv','2*cos(2*x)+x+1','-sin(x)^2+3*cos(x)^2+x',1,'',''); $testsuite[] = stack_testsuite_construct('AlgEquiv','(2*sec(2*t)^2-2)/2','-(sin(4*t)^2-2*sin(4*t)+cos(4*t)^2-1)*(sin(4*t)^2+2*sin(4*t)+cos(4*t)^2-1)/(sin(4*t)^2+cos(4*t)^2+2*cos(4*t)+1)^2',1,'',''); $testsuite[] = stack_testsuite_construct('AlgEquiv','log(a^2*b)','2*log(a)+log(b)',1,'','Logarithms'); + $testsuite[] = stack_testsuite_construct('AlgEquiv','lg(10^x)','x',1,'',''); $testsuite[] = stack_testsuite_construct('AlgEquiv','x','[1,2,3]',0,'','Lists'); $testsuite[] = stack_testsuite_construct('AlgEquiv','[1,2]','[1,2,3]',0,'',''); *************** *** 77,80 **** --- 83,87 ---- $testsuite[] = stack_testsuite_construct('AlgEquiv','[1,x>2]','[1,2<x]',1,'',''); $testsuite[] = stack_testsuite_construct('AlgEquiv','[1,2,[2-x<0,{1,2,2,2,1,3}]]','[1,2,[2-x<0,{1,2}]]',0,'',''); + $testsuite[] = stack_testsuite_construct('AlgEquiv','x','{1,2,3}',0,'','Sets'); $testsuite[] = stack_testsuite_construct('AlgEquiv','{1,2}','{1,2,3}',0,'',''); *************** *** 82,85 **** --- 89,93 ---- $testsuite[] = stack_testsuite_construct('AlgEquiv','{1,2,4}','{1,2,3}',0,'',''); $testsuite[] = stack_testsuite_construct('AlgEquiv','{1,x>4}','{4<x,1}',1,'',''); + $testsuite[] = stack_testsuite_construct('AlgEquiv','matrix([1,2],[2,3])','matrix([1,2],[2,3])',1,'','Matrices'); $testsuite[] = stack_testsuite_construct('AlgEquiv','matrix([1,2],[2,3])','matrix([1,2,3],[2,3,3])',0,'',''); *************** *** 127,134 **** --- 135,144 ---- $testsuite[] = stack_testsuite_construct('AlgEquiv','n/n!','1/(n-1)!',1,'',''); $testsuite[] = stack_testsuite_construct('AlgEquiv','2/%i*ln(sqrt((1+z)/2)+%i*sqrt((1-z)/2))','-%i*ln(z+i*sqrt(1-z^2))',1,'','These currently fail'); + $testsuite[] = stack_testsuite_construct('AlgEquiv','-%i/sqrt(x)','sqrt(-1/x)',1,'',''); // SubstEquiv Answer tests. $testsuite[] = stack_testsuite_construct('SubstEquiv','1/0','x^2-2*x+1',0,'',''); $testsuite[] = stack_testsuite_construct('SubstEquiv','x^2+1','x^2+1',1,'',''); + $testsuite[] = stack_testsuite_construct('SubstEquiv','x^2+1','x^3+1',0,'',''); $testsuite[] = stack_testsuite_construct('SubstEquiv','X^2+1','x^2+1',1,'',''); $testsuite[] = stack_testsuite_construct('SubstEquiv','x^2+y','a^2+b',1,'',''); *************** *** 139,154 **** $testsuite[] = stack_testsuite_construct('Equal_Com_Ass','1/0','0',0,'',''); $testsuite[] = stack_testsuite_construct('Equal_Com_Ass','1+2*x','x*2+1',1,'','Simple polynomials'); $testsuite[] = stack_testsuite_construct('Equal_Com_Ass','1+x','2*x+1',0,'',''); $testsuite[] = stack_testsuite_construct('Equal_Com_Ass','1+x+x','2*x+1',0,'',''); $testsuite[] = stack_testsuite_construct('Equal_Com_Ass','(x+y)+z','z+x+y',1,'',''); ! $testsuite[] = stack_testsuite_construct('Equal_Com_Ass','-1+2','2-1',1,'',''); $testsuite[] = stack_testsuite_construct('Equal_Com_Ass','-1*2+3*4','3*4-1*2',1,'',''); $testsuite[] = stack_testsuite_construct('Equal_Com_Ass','(-1*2)+3*4','3*4+(-1*2)',1,'',''); $testsuite[] = stack_testsuite_construct('Equal_Com_Ass','1/2','3/6',0,'','Rational expressions'); $testsuite[] = stack_testsuite_construct('Equal_Com_Ass','1/(1+2*x)','1/(2*x+1)',1,'',''); $testsuite[] = stack_testsuite_construct('Equal_Com_Ass','2/(4+2*x)','1/(x+2)',0,'',''); $testsuite[] = stack_testsuite_construct('Equal_Com_Ass','-1/(1-x)','1/(x-1)',0,'',''); $testsuite[] = stack_testsuite_construct('Equal_Com_Ass','1/2*1/x','1/(2*x)',0,'',''); $testsuite[] = stack_testsuite_construct('Equal_Com_Ass','y=x','x=y',0,'','Equality is not included as commutative....'); $testsuite[] = stack_testsuite_construct('Equal_Com_Ass','x+1','y=2*x+1',0,'','Equations'); --- 149,177 ---- $testsuite[] = stack_testsuite_construct('Equal_Com_Ass','1/0','0',0,'',''); + $testsuite[] = stack_testsuite_construct('Equal_Com_Ass','0','1/0',0,'',''); $testsuite[] = stack_testsuite_construct('Equal_Com_Ass','1+2*x','x*2+1',1,'','Simple polynomials'); $testsuite[] = stack_testsuite_construct('Equal_Com_Ass','1+x','2*x+1',0,'',''); $testsuite[] = stack_testsuite_construct('Equal_Com_Ass','1+x+x','2*x+1',0,'',''); $testsuite[] = stack_testsuite_construct('Equal_Com_Ass','(x+y)+z','z+x+y',1,'',''); ! $testsuite[] = stack_testsuite_construct('Equal_Com_Ass','x*x','x^2',0,'',''); ! $testsuite[] = stack_testsuite_construct('Equal_Com_Ass','(1-x)^2','(x-1)^2',0,'',''); ! $testsuite[] = stack_testsuite_construct('Equal_Com_Ass','-1+2','2-1',1,'','Unary minus'); $testsuite[] = stack_testsuite_construct('Equal_Com_Ass','-1*2+3*4','3*4-1*2',1,'',''); $testsuite[] = stack_testsuite_construct('Equal_Com_Ass','(-1*2)+3*4','3*4+(-1*2)',1,'',''); + $testsuite[] = stack_testsuite_construct('Equal_Com_Ass','x*(-y)','-x*y',1,'',''); + $testsuite[] = stack_testsuite_construct('Equal_Com_Ass','x*(-y)','-(x*y)',1,'',''); + $testsuite[] = stack_testsuite_construct('Equal_Com_Ass','(-x)*(-x)','x*x',0,'',''); + $testsuite[] = stack_testsuite_construct('Equal_Com_Ass','(-x)*(-x)','x^2',0,'',''); $testsuite[] = stack_testsuite_construct('Equal_Com_Ass','1/2','3/6',0,'','Rational expressions'); $testsuite[] = stack_testsuite_construct('Equal_Com_Ass','1/(1+2*x)','1/(2*x+1)',1,'',''); $testsuite[] = stack_testsuite_construct('Equal_Com_Ass','2/(4+2*x)','1/(x+2)',0,'',''); + $testsuite[] = stack_testsuite_construct('Equal_Com_Ass','(a*b)/c','a*(b/c)',1,'',''); + $testsuite[] = stack_testsuite_construct('Equal_Com_Ass','(-x)/y','-(x/y)',1,'',''); + $testsuite[] = stack_testsuite_construct('Equal_Com_Ass','x/(-y)','-(x/y)',0,'',''); $testsuite[] = stack_testsuite_construct('Equal_Com_Ass','-1/(1-x)','1/(x-1)',0,'',''); $testsuite[] = stack_testsuite_construct('Equal_Com_Ass','1/2*1/x','1/(2*x)',0,'',''); + $testsuite[] = stack_testsuite_construct('Equal_Com_Ass','%i','e^(pi/2)',0,'','Complex numbers'); + $testsuite[] = stack_testsuite_construct('Equal_Com_Ass','(4*sqrt(3)*%i+4)^(1/5)','rectform((4*sqrt(3)*%i+4)^(1/5))',0,'',''); + $testsuite[] = stack_testsuite_construct('Equal_Com_Ass','y=x','x=y',0,'','Equality is not included as commutative....'); $testsuite[] = stack_testsuite_construct('Equal_Com_Ass','x+1','y=2*x+1',0,'','Equations'); *************** *** 183,186 **** --- 206,211 ---- + $testsuite[] = stack_testsuite_construct('SameType','1/0','1',0,'',''); + $testsuite[] = stack_testsuite_construct('SameType','1','1/0',0,'',''); $testsuite[] = stack_testsuite_construct('SameType','4^(-1/2)','1/2',1,'','Numbers'); $testsuite[] = stack_testsuite_construct('SameType','x','[1,2,3]',0,'','Lists'); *************** *** 207,215 **** $testsuite[] = stack_testsuite_construct('Expanded','2*(x-1)','0',0,'',''); $testsuite[] = stack_testsuite_construct('Expanded','(x-1)*(x+1)','0',0,'',''); $testsuite[] = stack_testsuite_construct('Expanded','cos(2*x)','0',1,'',''); // Factored form ! $testsuite[] = stack_testsuite_construct('FacForm','1/0','x^2-2*x+1',0,'',''); ! $testsuite[] = stack_testsuite_construct('FacForm','1/0','x^2-2*x+1',0,'x',''); $testsuite[] = stack_testsuite_construct('FacForm','2','2',1,'x','Trivial cases'); $testsuite[] = stack_testsuite_construct('FacForm','1/3','1/3',1,'x',''); --- 232,244 ---- $testsuite[] = stack_testsuite_construct('Expanded','2*(x-1)','0',0,'',''); $testsuite[] = stack_testsuite_construct('Expanded','(x-1)*(x+1)','0',0,'',''); + $testsuite[] = stack_testsuite_construct('Expanded','(x-a)*(x-b)','0',0,'',''); + $testsuite[] = stack_testsuite_construct('Expanded','x^2-(a+b)*x+a*b','0',0,'',''); + $testsuite[] = stack_testsuite_construct('Expanded','x^2-a*x-b*x+a*b','0',1,'',''); $testsuite[] = stack_testsuite_construct('Expanded','cos(2*x)','0',1,'',''); // Factored form ! $testsuite[] = stack_testsuite_construct('FacForm','1/0','0',0,'x',''); ! $testsuite[] = stack_testsuite_construct('FacForm','0','1/0',0,'x',''); ! $testsuite[] = stack_testsuite_construct('FacForm','0','0',0,'1/0',''); $testsuite[] = stack_testsuite_construct('FacForm','2','2',1,'x','Trivial cases'); $testsuite[] = stack_testsuite_construct('FacForm','1/3','1/3',1,'x',''); *************** *** 251,254 **** --- 280,287 ---- $testsuite[] = stack_testsuite_construct('FacForm','(x-1)*(x+(1+sqrt(3)*%i)/2)*(x+(1-sqrt(3)*%i)/2)','x^3-1',1,'x',''); + + $testsuite[] = stack_testsuite_construct('CompSquare','1/0','0',0,'',''); + $testsuite[] = stack_testsuite_construct('CompSquare','1/0','0',0,'x',''); + $testsuite[] = stack_testsuite_construct('CompSquare','0','1/0',0,'x',''); $testsuite[] = stack_testsuite_construct('CompSquare','sin(x-1)+a-1','(x-1)^2+1',0,'x',''); $testsuite[] = stack_testsuite_construct('CompSquare','x^2-1','(x-1)*(x+1)',1,'x','Trivial cases'); *************** *** 268,272 **** //Single Fraction Test ! //$testsuite[] = stack_testsuite_construct('SingleFrac','1/0','1/n',0,'','Basic tests'); $testsuite[] = stack_testsuite_construct('SingleFrac','x=3','2',0,'',''); $testsuite[] = stack_testsuite_construct('SingleFrac','3','3',1,'',''); --- 301,306 ---- //Single Fraction Test ! $testsuite[] = stack_testsuite_construct('SingleFrac','1/0','1/n',0,'',''); ! $testsuite[] = stack_testsuite_construct('SingleFrac','0','1/0',0,'',''); $testsuite[] = stack_testsuite_construct('SingleFrac','x=3','2',0,'',''); $testsuite[] = stack_testsuite_construct('SingleFrac','3','3',1,'',''); *************** *** 283,288 **** --- 317,327 ---- $testsuite[] = stack_testsuite_construct('SingleFrac','(x-1)/(x^2-1)','1/(x+1)',1,'',''); $testsuite[] = stack_testsuite_construct('SingleFrac','(1/2)/(3/4)','2/3',0,'','Fractions within fractions'); + $testsuite[] = stack_testsuite_construct('SingleFrac','(x-2)/4/(2/x^2)','(x-2)*x^2/8',0,'',''); $testsuite[] = stack_testsuite_construct('SingleFrac','1/(1-1/x)','x/(x-1)',0,'',''); + $testsuite[] = stack_testsuite_construct('PartFrac','1/0','3*x^2',0,'',''); + $testsuite[] = stack_testsuite_construct('PartFrac','1/0','3*x^2',0,'x',''); + $testsuite[] = stack_testsuite_construct('PartFrac','0','0',0,'1/0',''); + $testsuite[] = stack_testsuite_construct('PartFrac','0','1/0',0,'x',''); $testsuite[] = stack_testsuite_construct('PartFrac','1/m','1/n',0,'n','Basic tests'); $testsuite[] = stack_testsuite_construct('PartFrac','1/n','1/n',0,'n',''); *************** *** 300,303 **** --- 339,343 ---- $testsuite[] = stack_testsuite_construct('PartFrac','n/(2*n-1)-(n+1)/(2*n+1)','1/(4*n-2)-1/(4*n+2)',0,'n',''); $testsuite[] = stack_testsuite_construct('PartFrac','10/(x+3) - 2/(x+2) + x -2','(x^3 + 3*x^2 + 4*x +2)/((x+2)*(x+3))',1,'x','Correct Answer, Numerator > Denominator'); + $testsuite[] = stack_testsuite_construct('PartFrac','2*x+1/(x+1)+1/(x-1)','2*x^3/(x^2-1)',1,'x',''); $testsuite[] = stack_testsuite_construct('PartFrac','1/(n*(n-1))','1/(n*(n-1))',0,'n','Simple mistakes'); $testsuite[] = stack_testsuite_construct('PartFrac','1/(n-1)-1/n^2','1/((n+1)*n)',0,'n',''); *************** *** 317,327 **** $testsuite[] = stack_testsuite_construct('Diff','1/0','3*x^2',0,'',''); $testsuite[] = stack_testsuite_construct('Diff','1/0','3*x^2',0,'x',''); ! $testsuite[] = stack_testsuite_construct('Diff','3*x^2','3*x^2',1,'x',''); $testsuite[] = stack_testsuite_construct('Diff','3*X^2','3*x^2',0,'x',''); $testsuite[] = stack_testsuite_construct('Diff','x^4/4','3*x^2',0,'x',''); $testsuite[] = stack_testsuite_construct('Diff','x^4/4+1','3*x^2',0,'x',''); $testsuite[] = stack_testsuite_construct('Diff','x^4/4+c','3*x^2',0,'x',''); - $testsuite[] = stack_testsuite_construct('Diff','','3*x^2',0,'','Additional tests'); - $testsuite[] = stack_testsuite_construct('Diff','x^4/4+c','',0,'x',''); $testsuite[] = stack_testsuite_construct('Diff','y=x^4/4','x^4/4',0,'x',''); $testsuite[] = stack_testsuite_construct('Diff','x^4/4','y=x^4/4',0,'x',''); --- 357,368 ---- $testsuite[] = stack_testsuite_construct('Diff','1/0','3*x^2',0,'',''); $testsuite[] = stack_testsuite_construct('Diff','1/0','3*x^2',0,'x',''); ! $testsuite[] = stack_testsuite_construct('Diff','0','1/0',0,'x',''); ! $testsuite[] = stack_testsuite_construct('Diff','0','0',0,'1/0',''); ! $testsuite[] = stack_testsuite_construct('Diff','x^4/4+c','',0,'x',''); ! $testsuite[] = stack_testsuite_construct('Diff','3*x^2','3*x^2',1,'x','Basic tests'); $testsuite[] = stack_testsuite_construct('Diff','3*X^2','3*x^2',0,'x',''); $testsuite[] = stack_testsuite_construct('Diff','x^4/4','3*x^2',0,'x',''); $testsuite[] = stack_testsuite_construct('Diff','x^4/4+1','3*x^2',0,'x',''); $testsuite[] = stack_testsuite_construct('Diff','x^4/4+c','3*x^2',0,'x',''); $testsuite[] = stack_testsuite_construct('Diff','y=x^4/4','x^4/4',0,'x',''); $testsuite[] = stack_testsuite_construct('Diff','x^4/4','y=x^4/4',0,'x',''); *************** *** 334,339 **** // Integration test ! $testsuite[] = stack_testsuite_construct('Int','1/0','x^2-2*x+1',0,'x','Variable mismatch tests'); ! $testsuite[] = stack_testsuite_construct('Int','x^3/3','x^3/3',0,'x',''); $testsuite[] = stack_testsuite_construct('Int','x^3/3+1','x^3/3',0,'x',''); $testsuite[] = stack_testsuite_construct('Int','x^3/3+c','x^3/3',1,'x',''); --- 375,383 ---- // Integration test ! $testsuite[] = stack_testsuite_construct('Int','1/0','1',0,'',''); ! $testsuite[] = stack_testsuite_construct('Int','1/0','1',0,'x',''); ! $testsuite[] = stack_testsuite_construct('Int','1','1/0',0,'x',''); ! $testsuite[] = stack_testsuite_construct('Int','0','0',0,'1/0',''); ! $testsuite[] = stack_testsuite_construct('Int','x^3/3','x^3/3',0,'x','Basic tests'); $testsuite[] = stack_testsuite_construct('Int','x^3/3+1','x^3/3',0,'x',''); $testsuite[] = stack_testsuite_construct('Int','x^3/3+c','x^3/3',1,'x',''); *************** *** 344,351 **** $testsuite[] = stack_testsuite_construct('Int','X^3/3+c','x^3/3',0,'x',''); $testsuite[] = stack_testsuite_construct('Int','sin(2*x)','x^3/3',0,'x',''); $testsuite[] = stack_testsuite_construct('Int','(t-1)^5/5+c','(t-1)^5/5',1,'t',''); $testsuite[] = stack_testsuite_construct('Int','2*x','x^3/3',0,'x','Student differentiates by mistake'); $testsuite[] = stack_testsuite_construct('Int','2*x+c','x^3/3',0,'x',''); - $testsuite[] = stack_testsuite_construct('Int','e^x+c','e^x',1,'x',''); $testsuite[] = stack_testsuite_construct('Int','ln(x)','ln(x)',0,'x','Sloppy logs (teacher ignores abs(x) )'); $testsuite[] = stack_testsuite_construct('Int','ln(x)+c','ln(x)+c',1,'x',''); --- 388,398 ---- $testsuite[] = stack_testsuite_construct('Int','X^3/3+c','x^3/3',0,'x',''); $testsuite[] = stack_testsuite_construct('Int','sin(2*x)','x^3/3',0,'x',''); + $testsuite[] = stack_testsuite_construct('Int','x^2/2-2*x+2+c','(x-2)^2/2',1,'x',''); $testsuite[] = stack_testsuite_construct('Int','(t-1)^5/5+c','(t-1)^5/5',1,'t',''); + $testsuite[] = stack_testsuite_construct('Int','x^3/3+c','x^3/3+c',1,'x','The teacher adds a constant'); + $testsuite[] = stack_testsuite_construct('Int','x^2/2-2*x+2+c','(x-2)^2/2+k',1,'x',''); + $testsuite[] = stack_testsuite_construct('Int','exp(x)+c','exp(x)',1,'x','Special case'); $testsuite[] = stack_testsuite_construct('Int','2*x','x^3/3',0,'x','Student differentiates by mistake'); $testsuite[] = stack_testsuite_construct('Int','2*x+c','x^3/3',0,'x',''); $testsuite[] = stack_testsuite_construct('Int','ln(x)','ln(x)',0,'x','Sloppy logs (teacher ignores abs(x) )'); $testsuite[] = stack_testsuite_construct('Int','ln(x)+c','ln(x)+c',1,'x',''); *************** *** 365,368 **** --- 412,417 ---- $testsuite[] = stack_testsuite_construct('Int','ln(k*abs(x))','ln(k*abs(x))',1,'x',''); $testsuite[] = stack_testsuite_construct('Int','ln(x)+ln(a)','ln(k*abs(x+a))',0,'x','Other logs'); + $testsuite[] = stack_testsuite_construct('Int','log(x)^2-2*log(c)*log(x)+k','ln(c/x)^2',0,'x',''); + $testsuite[] = stack_testsuite_construct('Int','log(x)^2-2*log(c)*log(x)+k','ln(abs(c/x))^2',0,'x',''); $testsuite[] = stack_testsuite_construct('Int','2*sin(x)*cos(x)','sin(2*x)+c',0,'x','Trig'); $testsuite[] = stack_testsuite_construct('Int','2*sin(x)*cos(x)+k','sin(2*x)+c',1,'x',''); *************** *** 375,379 **** $testsuite[] = stack_testsuite_construct('Int','tan(x)-x+c','tan(x)-x',1,'x',''); ! $testsuite[] = stack_testsuite_construct('GT','1','1',0,'',''); $testsuite[] = stack_testsuite_construct('GT','2','1',1,'',''); --- 424,429 ---- $testsuite[] = stack_testsuite_construct('Int','tan(x)-x+c','tan(x)-x',1,'x',''); ! $testsuite[] = stack_testsuite_construct('GT','1/0','1',0,'',''); ! $testsuite[] = stack_testsuite_construct('GT','1','1/0',0,'',''); $testsuite[] = stack_testsuite_construct('GT','1','1',0,'',''); $testsuite[] = stack_testsuite_construct('GT','2','1',1,'',''); *************** *** 383,386 **** --- 433,438 ---- + $testsuite[] = stack_testsuite_construct('GTE','1/0','1',0,'',''); + $testsuite[] = stack_testsuite_construct('GTE','1','1/0',0,'',''); $testsuite[] = stack_testsuite_construct('GTE','1','1',1,'',''); $testsuite[] = stack_testsuite_construct('GTE','2','1',1,'',''); *************** *** 390,393 **** --- 442,448 ---- + $testsuite[] = stack_testsuite_construct('NumRelative','1/0','0',0,'','Basic tests'); + $testsuite[] = stack_testsuite_construct('NumRelative','0','1/0',0,'',''); + $testsuite[] = stack_testsuite_construct('NumRelative','0','0',0,'1/0',''); $testsuite[] = stack_testsuite_construct('NumRelative','1.1','1',0,'','No option, so 5%'); $testsuite[] = stack_testsuite_construct('NumRelative','1.05','1',1,'',''); *************** *** 404,411 **** $testsuite[] = stack_testsuite_construct('NumSigFigs','1/0','3',0,'0','Basic tests'); ! $testsuite[] = stack_testsuite_construct('NumSigFigs','1','3',0,'',''); $testsuite[] = stack_testsuite_construct('NumSigFigs','1','3',0,'pi',''); - $testsuite[] = stack_testsuite_construct('NumSigFigs','1','3',0,'[1,2,3]',''); $testsuite[] = stack_testsuite_construct('NumSigFigs','1','3',0,'[3,x]',''); $testsuite[] = stack_testsuite_construct('NumSigFigs','1.234','4',0,'1','Option is a number'); $testsuite[] = stack_testsuite_construct('NumSigFigs','3.141','3.1415927',0,'3',''); --- 459,468 ---- $testsuite[] = stack_testsuite_construct('NumSigFigs','1/0','3',0,'0','Basic tests'); ! $testsuite[] = stack_testsuite_construct('NumSigFigs','0','1/0',0,'0',''); ! $testsuite[] = stack_testsuite_construct('NumSigFigs','0','0',0,'1/0',''); $testsuite[] = stack_testsuite_construct('NumSigFigs','1','3',0,'pi',''); $testsuite[] = stack_testsuite_construct('NumSigFigs','1','3',0,'[3,x]',''); + $testsuite[] = stack_testsuite_construct('NumSigFigs','1','3',0,'[1,2,3]',''); + $testsuite[] = stack_testsuite_construct('NumSigFigs','1','3',0,'',''); $testsuite[] = stack_testsuite_construct('NumSigFigs','1.234','4',0,'1','Option is a number'); $testsuite[] = stack_testsuite_construct('NumSigFigs','3.141','3.1415927',0,'3',''); *************** *** 439,464 **** $testsuite[] = stack_testsuite_construct('RegExp','cxcxcz','3.1415927',0,'[0-9]*\.[0-9]*',''); ! $testsuite[] = stack_testsuite_construct('LowestTerms','1/0','x^2-2*x+1',0,'',''); ! $testsuite[] = stack_testsuite_construct('LowestTerms','X','x',0,'','Case sensitivity'); ! $testsuite[] = stack_testsuite_construct('LowestTerms','0.5','1/2',1,'','Mix of floats and rational numbers'); ! $testsuite[] = stack_testsuite_construct('LowestTerms','0.33','1/3',0,'',''); ! $testsuite[] = stack_testsuite_construct('LowestTerms','2/4','1/2',0,'',''); ! $testsuite[] = stack_testsuite_construct('LowestTerms','-1/3','-1/3',1,'','Negative numbers'); ! $testsuite[] = stack_testsuite_construct('LowestTerms','1/-3','-1/3',1,'',''); ! $testsuite[] = stack_testsuite_construct('LowestTerms','-2/4','-1/2',0,'',''); ! $testsuite[] = stack_testsuite_construct('LowestTerms','2/-4','-1/2',0,'',''); ! $testsuite[] = stack_testsuite_construct('LowestTerms','x+1/3','x+1/3',1,'','Polynomials'); ! $testsuite[] = stack_testsuite_construct('LowestTerms','x+2/6','x+1/3',0,'',''); ! $testsuite[] = stack_testsuite_construct('LowestTerms','cos(x)','cos(-x)',1,'','Trig functions'); ! $testsuite[] = stack_testsuite_construct('LowestTerms','[1,2]','[1,2,3]',0,'',''); ! $testsuite[] = stack_testsuite_construct('LowestTerms','[1,2,4]','[1,2,3]',0,'',''); ! $testsuite[] = stack_testsuite_construct('LowestTerms','{1,2}','{1,2,3}',0,'',''); ! $testsuite[] = stack_testsuite_construct('LowestTerms','{1,2,4}','{1,2,3}',0,'',''); ! $testsuite[] = stack_testsuite_construct('LowestTerms','matrix([1,2],[2,3])','matrix([1,2],[2,3])',1,'','Matrices'); - $testsuite[] = stack_testsuite_construct('LowestTerms','x=1','x=1',1,'',''); - $testsuite[] = stack_testsuite_construct('LowestTerms','1=x','x=1',1,'',''); - $testsuite[] = stack_testsuite_construct('LowestTerms','1','x>1',0,'','Inequalities'); - $testsuite[] = stack_testsuite_construct('LowestTerms','x>1','x>1',1,'',''); /* ********************************************************** */ --- 496,525 ---- $testsuite[] = stack_testsuite_construct('RegExp','cxcxcz','3.1415927',0,'[0-9]*\.[0-9]*',''); ! $testsuite[] = stack_testsuite_construct('LowestTerms','1/0','0',0,'',''); ! $testsuite[] = stack_testsuite_construct('LowestTerms','0.5','0',1,'','Mix of floats and rational numbers'); ! $testsuite[] = stack_testsuite_construct('LowestTerms','0.33','0',1,'',''); ! $testsuite[] = stack_testsuite_construct('LowestTerms','2/4','0',0,'',''); ! $testsuite[] = stack_testsuite_construct('LowestTerms','-1/3','0',1,'','Negative numbers'); ! $testsuite[] = stack_testsuite_construct('LowestTerms','1/-3','0',1,'',''); ! $testsuite[] = stack_testsuite_construct('LowestTerms','-2/4','0',0,'',''); ! $testsuite[] = stack_testsuite_construct('LowestTerms','2/-4','0',0,'',''); ! $testsuite[] = stack_testsuite_construct('LowestTerms','x+1/3','0',1,'','Polynomials'); ! $testsuite[] = stack_testsuite_construct('LowestTerms','x+2/6','0',0,'',''); ! $testsuite[] = stack_testsuite_construct('LowestTerms','2*x/4+2/6','0',0,'',''); ! $testsuite[] = stack_testsuite_construct('LowestTerms','2/4*x+2/6','0',0,'',''); ! $testsuite[] = stack_testsuite_construct('LowestTerms','cos(x)','0',1,'','Trig functions'); ! $testsuite[] = stack_testsuite_construct('LowestTerms','cos(3/6*x)','0',0,'',''); ! $testsuite[] = stack_testsuite_construct('LowestTerms','matrix([1,2/4],[2,3])','0',0,'','Matrices'); ! ! $testsuite[] = stack_testsuite_construct('LowestTerms','x=1/2','0',1,'','Equations'); ! $testsuite[] = stack_testsuite_construct('LowestTerms','3/9=x','0',0,'',''); ! ! ! /* Create an array with all available tests on it */ ! foreach ($testsuite as $ts) { ! $AvailableTests[$ts['AnswerTest']]=true; ! } ! $AvailableTests = array_keys($AvailableTests); /* ********************************************************** */ *************** *** 468,471 **** --- 529,534 ---- + + // Now perform the tests, and display the results. *************** *** 475,478 **** --- 538,556 ---- } + if (array_key_exists('ALL',$_GET)) { + $AnsTest = 'ALL'; + } + + // Normally turned off on production servers. + if ('ALL'==$AnsTest) {die();} + //$AnsTest='ALL'; + + + /* Tests in Windows. + C: + cd \xampp\htdocs\stack-dev\install\ + \xampp\php\php.exe answer_test_testsuite.php > c:\tmp\test.html + */ + /* Output the text for a batch file test. */ /* *************** *** 494,533 **** echo ' </div>'; ! echo '<h2>'.get_string('stackInstall_testsuite_choose','stack','')."</h2>\n"; ! echo "<form name=\"ChooseAnsTest\" action=\"\" method=\"POST\">\n"; ! $prefs = new maximaPreferences(); ! $anst = new AnsTestController($AnsTest,0,0,$prefs); ! echo $anst->ansTestWidget("AnsTest",$AnsTest); ! echo '<input type="submit" value="Submit" />'; ! echo "</form>"; ! if ('' == $AnsTest OR 'default' == $AnsTest) { ! die(); } - $a = $AnsTest; - echo '<hr /><h1>'.get_string('stackInstall_testsuite_for','stack',$a)."</h2>\n"; ! echo $stackAnswerTest[$AnsTest]['doc']; ! $all_passed = TRUE; ! echo "<p><table border='1' cellpadding='2'>\n\n"; ! // (4) Sort out and display the output ! echo "<tr bgcolor='#DDDDDD'>\n <th> pass? </th> ! <th> SAns </th> ! <th> TAns </th> ! <th> Opt </th> ! <th> Errors </th> ! <th> RawMark </th> ! <th> Expected </th> ! <th> FeedBack </th> ! <th> AnswerNote </th>\n</tr>\n"; ! foreach ($testsuite as $ts) { // (0) Check this is the required AnswerTest. --- 572,627 ---- echo ' </div>'; ! if ('ALL'!==$AnsTest) { ! echo '<h2>'.get_string('stackInstall_testsuite_choose','stack','')."</h2>\n"; ! echo "<form name=\"ChooseAnsTest\" action=\"\" method=\"POST\">\n"; ! $prefs = new maximaPreferences(); ! $anst = new AnsTestController($AnsTest,0,0,$prefs); ! echo $anst->ansTestWidget("AnsTest",$AnsTest); ! echo '<input type="submit" value="Submit" />'; ! echo "</form>"; ! } ! if ('' == $AnsTest OR 'default' == $AnsTest) { ! die(); ! } ! // Decide how many answer tests to choose! ! if ('ALL'===$AnsTest) { ! $TestList = $AvailableTests; ! //$TestList = array('String','StringSloppy'); ! foreach($TestList as $AnsTest) { ! echo '<a href="#'.$AnsTest.'">'.$AnsTest.'</a><br />'; ! } ! echo '<hr />'; ! } else { ! $TestList = array($AnsTest); ! echo '<hr />'; } ! // Loop over the required tests ! foreach($TestList as $AnsTest) { ! $a = $AnsTest; ! echo '<h1><a name="'.$a.'">'.get_string('stackInstall_testsuite_for','stack',$a)."</a></h2>\n"; ! $all_passed = TRUE; ! ! echo "<p><table border='1' cellpadding='2' width='100%'>\n\n"; ! // (4) Sort out and display the output ! echo "<tr bgcolor='#DDDDDD'>\n <th> pass? </th> ! <th> SAns </th> ! <th> TAns </th> ! <th> Opt </th> ! <th> Err </th> ! <th> M </th> ! <th> Ex </th> ! <th> FeedBack </th> ! <th> AnswerNote </th>\n</tr>\n"; ! foreach ($testsuite as $ts) { // (0) Check this is the required AnswerTest. *************** *** 537,541 **** //$maxima_str .= 'AT'.$ts['AnswerTest'].'('.$ts['SAns'].',['.$ts['TAns'].','.$ts['AnsTestOpt']."]);\n"; - $err = ''; --- 631,634 ---- *************** *** 564,571 **** } - if ('false' === $valid) { - $errors .= ' <font color="red">[invalid]</font>'; - } - if (''===$rawmark) { $rawmark='<font color="red">[ ]</font>'; --- 657,660 ---- *************** *** 589,594 **** echo "<tr>\n"; echo " <td> $outcome </td>\n"; ! echo " <td nowrap=\"nowrap\">".htmlspecialchars($ts['SAns'])." </td>\n "; ! echo " <td nowrap=\"nowrap\">".htmlspecialchars($ts['TAns'])." </td>\n "; echo " <td> {$ts['AnsTestOpt']} </td>\n "; echo " <td> $errors </td>\n "; --- 678,683 ---- echo "<tr>\n"; echo " <td> $outcome </td>\n"; ! echo " <td>".htmlspecialchars($ts['SAns'])." </td>\n "; ! echo " <td>".htmlspecialchars($ts['TAns'])." </td>\n "; echo " <td> {$ts['AnsTestOpt']} </td>\n "; echo " <td> $errors </td>\n "; *************** *** 617,620 **** --- 706,711 ---- //echo "<pre>".$maxima_str."</pre>"; + } + ?> Index: p4.php =================================================================== RCS file: /cvsroot/stack/stack-dev/install/p4.php,v retrieving revision 1.7 retrieving revision 1.7.18.1 diff -C2 -d -r1.7 -r1.7.18.1 *** p4.php 12 Dec 2007 14:37:41 -0000 1.7 --- p4.php 9 Nov 2010 16:51:37 -0000 1.7.18.1 *************** *** 37,45 **** } ! if(isset($_POST['sent'])) { - //check all complete - $errorMessage = ''; - if ($_POST['adminname'] == '') { --- 37,43 ---- } ! $errorMessage = ''; ! if(isset($_POST['sent'])) //check all complete { if ($_POST['adminname'] == '') { *************** *** 110,117 **** <form action="p4.php" method="POST"> <div class="row"> ! <span class="label"><?php echo get_string('stackInstall_firstName','stack'); ?></span><span class="formw"><input type="text" name="adminname" size="40" value="<?php echo $_SESSION['Sadminname']; ?>" /></span> </div> <div class="row"> ! <span class="label"><?php echo get_string('stackInstall_surname','stack'); ?></span><span class="formw"><input type="text" name="adminsurname" size="40" value="<?php echo $_SESSION['Sadminsurname']; ?>" /></span> </div> <br /> --- 108,115 ---- <form action="p4.php" method="POST"> <div class="row"> ! <span class="label"><?php echo get_string('stackInstall_firstName','stack'); ?></span><span class="formw"><input type="text" name="adminname" size="40" value="<?php echo isset($_SESSION['Sadminname'])? $_SESSION['Sadminname']:''; ?>" /></span> </div> <div class="row"> ! <span class="label"><?php echo get_string('stackInstall_surname','stack'); ?></span><span class="formw"><input type="text" name="adminsurname" size="40" value="<?php echo isset($_SESSION['Sadminsurname'])?$_SESSION['Sadminsurname']:''; ?>" /></span> </div> <br /> *************** *** 122,132 **** <span class="label"><?php echo get_string('stackInstall_password2','stack'); ?></span><span class="formw"><input type="password" name="pword2" size="40" /></span> </div> ! ! <?php if($_SESSION['SmoodleSetup'] == 'true') { echo '<br /> <div class="row"> ! <span class="label">Your Moodle Username</span><span class="formw">'; $result = moodleUsers($_SESSION['SmoodleDBhost'],$_SESSION['SmoodleDBuser'],$_SESSION['SmoodleDBpassword'],$_SESSION['SmoodleDB'],$_SESSION['SmoodleDriver'], $_SESSION['SmoodlePrefix']); echo $result; --- 120,130 ---- <span class="label"><?php echo get_string('stackInstall_password2','stack'); ?></span><span class="formw"><input type="password" name="pword2" size="40" /></span> </div> ! ! <?php if($_SESSION['SmoodleSetup'] == 'true') { echo '<br /> <div class="row"> ! <span class="label">'.get_string('stackInstall_yourMoodleUsername','stack').'</span><span class="formw">'; $result = moodleUsers($_SESSION['SmoodleDBhost'],$_SESSION['SmoodleDBuser'],$_SESSION['SmoodleDBpassword'],$_SESSION['SmoodleDB'],$_SESSION['SmoodleDriver'], $_SESSION['SmoodlePrefix']); echo $result; *************** *** 139,150 **** } ?> ! <br /> <div class="row"> ! <span class="label"><?php echo get_string('stackInstall_email','stack'); ?></span><span class="formw"><input type="text" name="adminemail" size="40" value="<?php echo $_SESSION['Sadminemail']; ?>" /></span> </div> <div class="row"> <span class="label"><?php echo get_string('stackInstall_smtp','stack'); ?></span><span class="formw"><input type="text" name="smtp" size="40" value="<?php ! if ($_SESSION['Ssmtp'] != '') { echo $_SESSION['Ssmtp']; } else { --- 137,148 ---- } ?> ! <br /> <div class="row"> ! <span class="label"><?php echo get_string('stackInstall_email','stack'); ?></span><span class="formw"><input type="text" name="adminemail" size="40" value="<?php echo isset($_SESSION['Sadminemail'])?$_SESSION['Sadminemail']:''; ?>" /></span> </div> <div class="row"> <span class="label"><?php echo get_string('stackInstall_smtp','stack'); ?></span><span class="formw"><input type="text" name="smtp" size="40" value="<?php ! if (isset($_SESSION['Ssmtp'])) { echo $_SESSION['Ssmtp']; } else { *************** *** 162,166 **** <div class="row"> <input type="hidden" name="sent" value="sent" /> ! <span class="label"></span><span class="formw"><input type="submit" value="Submit" /></span> </div> </form> --- 160,164 ---- <div class="row"> <input type="hidden" name="sent" value="sent" /> ! <span class="label"><input type="submit" value="Submit" /></span> </div> </form> Index: healthcheck.php =================================================================== RCS file: /cvsroot/stack/stack-dev/install/healthcheck.php,v retrieving revision 1.11.6.1.2.1 retrieving revision 1.11.6.1.2.2 diff -C2 -d -r1.11.6.1.2.1 -r1.11.6.1.2.2 *** healthcheck.php 7 Dec 2009 14:41:23 -0000 1.11.6.1.2.1 --- healthcheck.php 9 Nov 2010 16:51:37 -0000 1.11.6.1.2.2 *************** *** 63,67 **** $maximaOptions = new maximaPreferences(); ! $seed = mktime(); --- 63,67 ---- $maximaOptions = new maximaPreferences(); ! $seed = time(); // encouraged over calling mktime() *************** *** 98,102 **** $display = 'LaTeX'; ! $displayTestString = '\[ \sum_{n=1}^\infty \left( \frac{1}{n^2}\right) = \frac{\pi^2}{6}. \]'; require_once $root.'/lib/ui/frontend.php'; --- 98,102 ---- $display = 'LaTeX'; ! $displayTestString = '\[ \sum_{n=1}^\infty \left( \frac{1}{n^2}\right) = \frac{\pi^2}{6}. \]'; require_once $root.'/lib/ui/frontend.php'; *************** *** 150,159 **** <?php // Check the configuration of JSMath if it has been set - $jsmathroot = trim($config->get('jsmath')); - if ('' != $jsmathroot) { echo '<div class="box"><h3>'.get_string('stackInstall_jsmathcheck','stack','').'</h3>'; ! $f = 1; $c = 1;//1 for header, 2 for body, 3 for both $r = NULL; --- 150,166 ---- <?php // Check the configuration of JSMath if it has been set + // incremental checks to avoid confusing contradictory failures + + $jsmathroot = trim($config->get('jsmath')); + + if ('' != $jsmathroot) { echo '<div class="box"><h3>'.get_string('stackInstall_jsmathcheck','stack','').'</h3>'; + // firstly, is it on the same server? + if(false !== strpos($jsmathroot, $_SERVER['HTTP_HOST'])) { + echo '<p><span class="valid">'.get_string('stackInstall_success', 'stack','').'</span> '.get_string('stackInstall_jsmathsamehost', 'stack','').' <img src="'.$wroot.'/pix/'.get_string('stackIcon_success','stack').'" width="16" height="16" alt="'.get_string('stackIcon_success_alt','stack').'" /></p>'; ! // secondly, can load file be found? ! $f = 1; $c = 1;//1 for header, 2 for body, 3 for both $r = NULL; *************** *** 169,182 **** } else { echo '<p><span class="valid">'.get_string('stackInstall_success', 'stack','').'</span> '.get_string('stackInstall_jsmathok', 'stack','').' <img src="'.$wroot.'/pix/'.get_string('stackIcon_success','stack').'" width="16" height="16" alt="'.get_string('stackIcon_success_alt','stack').'" /></p>'; - } ! // is it on the same server? ! if(false !== strpos($jsmathroot, $_SERVER['HTTP_HOST'])) { ! echo '<p><span class="valid">'.get_string('stackInstall_success', 'stack','').'</span> '.get_string('stackInstall_jsmathsamehost', 'stack','').' <img src="'.$wroot.'/pix/'.get_string('stackIcon_success','stack').'" width="16" height="16" alt="'.get_string('stackIcon_success_alt','stack').'" /></p>'; ! } else { ! echo '<p><span class="failed">'.get_string('stackInstall_failed', 'stack','').'</span> '.get_string('stackInstall_jsmathdifferenthost', 'stack','').$_SERVER['HTTP_HOST'].' <img src="'.$wroot.'/pix/'.get_string('stackIcon_fail','stack').'" width="16" height="16" alt="'.get_string('stackIcon_fail_alt','stack').'" /></p>'; ! }; ! ! // is jsMath loaded? echo '<script type="text/javascript">' . 'if (!window.jsMath) document.write(\'<p><span class="failed">'.get_string('stackInstall_failed', 'stack','').'</span> '.get_string('stackInstall_jsmathnotfound', 'stack','').' <tt>'.$jsmathroot.'</tt> <img src="'.$wroot.'/pix/'.get_string('stackIcon_fail','stack').'" width="16" height="16" alt="'.get_string('stackIcon_fail_alt','stack').'" /></p>\');' . --- 176,181 ---- } else { echo '<p><span class="valid">'.get_string('stackInstall_success', 'stack','').'</span> '.get_string('stackInstall_jsmathok', 'stack','').' <img src="'.$wroot.'/pix/'.get_string('stackIcon_success','stack').'" width="16" height="16" alt="'.get_string('stackIcon_success_alt','stack').'" /></p>'; ! // finally, try to load and render with jsMath? echo '<script type="text/javascript">' . 'if (!window.jsMath) document.write(\'<p><span class="failed">'.get_string('stackInstall_failed', 'stack','').'</span> '.get_string('stackInstall_jsmathnotfound', 'stack','').' <tt>'.$jsmathroot.'</tt> <img src="'.$wroot.'/pix/'.get_string('stackIcon_fail','stack').'" width="16" height="16" alt="'.get_string('stackIcon_fail_alt','stack').'" /></p>\');' . *************** *** 187,190 **** --- 186,196 ---- '</script>'; + + } + + } else { // not same server + echo '<p><span class="failed">'.get_string('stackInstall_failed', 'stack','').'</span> '.get_string('stackInstall_jsmathdifferenthost', 'stack','').$jsmathroot.' <img src="'.$wroot.'/pix/'.get_string('stackIcon_fail','stack').'" width="16" height="16" alt="'.get_string('stackIcon_fail_alt','stack').'" /></p>'; + }; + echo '</div>'; } *************** *** 448,452 **** else { ! echo '<p><span class="error">'.get_string('stackInstall_failed', 'stack','').'</span> '.get_string('stackInstall_confEndSpaces','stack').' <img src="'.$wroot.'/pix/'.get_string('stackIcon_fail','stack').'" width="16" height="16" alt="'.get_string('stackIcon_fail_alt','stack').'" /></p>'; $problems = true; } --- 454,458 ---- else { ! echo '<p><span class="error">'.get_string('stackInstall_failed', 'stack','').'</span> '.get_string('stackInstall_failopenconfig','stack').' <img src="'.$wroot.'/pix/'.get_string('stackIcon_fail','stack').'" width="16" height="16" alt="'.get_string('stackIcon_fail_alt','stack').'" /></p>'; $problems = true; } *************** *** 457,460 **** --- 463,482 ---- </div> + <div class="box"> + <h3><?php echo get_string('stackInstall_securityHeader','stack'); ?></h3> + + <?php + $securityIssues = checkSecurity(); + if('' == $securityIssues){ + echo '<p><span class="valid">'.get_string('stackInstall_success', 'stack','').'</span> '.get_string('stackHealth_securityPass','stack').' <img src="'.$wroot.'/pix/'.get_string('stackIcon_success','stack').'" width="16" height="16" alt="'.get_string('stackIcon_success_alt','stack').'" /></p>'; + } + else + { + echo '<p><span class="error">'.get_string('stackInstall_failed', 'stack','').'</span> '.get_string('stackHealth_securityFail','stack').' <img src="'.$wroot.'/pix/'.get_string('stackIcon_fail','stack').'" width="16" height="16" alt="'.get_string('stackIcon_fail_alt','stack').'" />'.$securityIssues.'</p>'; + $problems = true; + } + ?> + </div> + Index: adodbinit.php =================================================================== RCS file: /cvsroot/stack/stack-dev/install/adodbinit.php,v retrieving revision 1.8 retrieving revision 1.8.8.1 diff -C2 -d -r1.8 -r1.8.8.1 *** adodbinit.php 24 Aug 2009 10:20:49 -0000 1.8 --- adodbinit.php 9 Nov 2010 16:51:37 -0000 1.8.8.1 *************** *** 31,36 **** require_once("../other/adodb5/adodb.inc.php"); ! define("NUM_TABLES", 10); ! define("EXPECTED_TABLE_NAMES", "'attempt_meta_PRT', 'attempt_meta_answer', 'display_cache', 'display_cache_sequence', 'keywords', 'opaque_sessions', 'question_keyword', 'question_attempts', 'response_trees', 'stackquestion'");; /** --- 31,36 ---- re... [truncated message content] |