|
From: <dav...@us...> - 2010-04-12 16:38:22
|
Revision: 2452
http://qtitools.svn.sourceforge.net/qtitools/?rev=2452&view=rev
Author: davemckain
Date: 2010-04-12 16:38:15 +0000 (Mon, 12 Apr 2010)
Log Message:
-----------
Added links to FETLAR repo for our forks of QTIEngine, qtiplayr and JQTI
Added Paths:
-----------
branches/mathassess/JQTI/README.txt
branches/mathassess/QTIEngine/README.txt
branches/mathassess/qtiplayr/README.txt
Removed Paths:
-------------
branches/mathassess/JQTI/AUTHORS
branches/mathassess/JQTI/COPYING
branches/mathassess/JQTI/README
branches/mathassess/JQTI/docs/
branches/mathassess/JQTI/pom.xml
branches/mathassess/JQTI/src/
branches/mathassess/QTIEngine/.classpath
branches/mathassess/QTIEngine/.project
branches/mathassess/QTIEngine/.settings/
branches/mathassess/QTIEngine/application.properties
branches/mathassess/QTIEngine/grails-app/
branches/mathassess/QTIEngine/plugins/
branches/mathassess/QTIEngine/scripts/
branches/mathassess/QTIEngine/src/
branches/mathassess/QTIEngine/test/
branches/mathassess/QTIEngine/web-app/
branches/mathassess/qtiplayr/AUTHORS
branches/mathassess/qtiplayr/COPYING
branches/mathassess/qtiplayr/MathAssessEngine-support/
branches/mathassess/qtiplayr/README.txt
branches/mathassess/qtiplayr/config.html
branches/mathassess/qtiplayr/db/
branches/mathassess/qtiplayr/detail.inc.php
branches/mathassess/qtiplayr/download.php
branches/mathassess/qtiplayr/http.inc
branches/mathassess/qtiplayr/icon.gif
branches/mathassess/qtiplayr/index.php
branches/mathassess/qtiplayr/lang/
branches/mathassess/qtiplayr/lib.php
branches/mathassess/qtiplayr/media.php
branches/mathassess/qtiplayr/mod_form.php
branches/mathassess/qtiplayr/playr.inc.php
branches/mathassess/qtiplayr/playrlib.inc.php
branches/mathassess/qtiplayr/report.inc.php
branches/mathassess/qtiplayr/reports.inc.php
branches/mathassess/qtiplayr/showattempts.inc.php
branches/mathassess/qtiplayr/testresource.php
branches/mathassess/qtiplayr/version.php
branches/mathassess/qtiplayr/view.php
branches/mathassess/qtiplayr/viewlib.php
branches/mathassess/qtiplayr/xsl/
Deleted: branches/mathassess/JQTI/AUTHORS
===================================================================
--- branches/mathassess/JQTI/AUTHORS 2010-04-12 16:32:58 UTC (rev 2451)
+++ branches/mathassess/JQTI/AUTHORS 2010-04-12 16:38:15 UTC (rev 2452)
@@ -1,6 +0,0 @@
-JQTI authors:
-
-Jiri Kajaba <jk...@ec...>
-Jonathon Hare <js...@ec...>
-
-Funded by JISC -- http://www.jisc.ac.uk
Deleted: branches/mathassess/JQTI/COPYING
===================================================================
--- branches/mathassess/JQTI/COPYING 2010-04-12 16:32:58 UTC (rev 2451)
+++ branches/mathassess/JQTI/COPYING 2010-04-12 16:38:15 UTC (rev 2452)
@@ -1,27 +0,0 @@
-Copyright (c) 2008, University of Southampton
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without modification,
-are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright notice, this
- list of conditions and the following disclaimer.
-
- * Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation
- and/or other materials provided with the distribution.
-
- * Neither the name of the University of Southampton nor the names of its
- contributors may be used to endorse or promote products derived from this
- software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
-ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
-ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Deleted: branches/mathassess/JQTI/README
===================================================================
Added: branches/mathassess/JQTI/README.txt
===================================================================
--- branches/mathassess/JQTI/README.txt (rev 0)
+++ branches/mathassess/JQTI/README.txt 2010-04-12 16:38:15 UTC (rev 2452)
@@ -0,0 +1,3 @@
+This can now be found at:
+
+https://fetlar.svn.sourceforge.net/svnroot/fetlar/JQTI-MathAssess
Deleted: branches/mathassess/JQTI/pom.xml
===================================================================
--- branches/mathassess/JQTI/pom.xml 2010-04-12 16:32:58 UTC (rev 2451)
+++ branches/mathassess/JQTI/pom.xml 2010-04-12 16:38:15 UTC (rev 2452)
@@ -1,142 +0,0 @@
-<!--
-<LICENCE>
-
-Copyright (c) 2008, University of Southampton
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without modification,
-are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright notice, this
- list of conditions and the following disclaimer.
-
- * Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation
- and/or other materials provided with the distribution.
-
- * Neither the name of the University of Southampton nor the names of its
- contributors may be used to endorse or promote products derived from this
- software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
-ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
-ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-</LICENCE>
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
-<!--
- <parent>
- <artifactId>QTItools</artifactId>
- <groupId>org.qtitools</groupId>
- <version>1.0-SNAPSHOT</version>
- </parent>
--->
- <modelVersion>4.0.0</modelVersion>
- <groupId>org.qtitools.qti</groupId>
- <artifactId>JQTI-MathAssess</artifactId>
- <packaging>jar</packaging>
- <version>2.0</version>
- <name>JQTI</name>
- <url>http://qtitools.org</url>
- <description>
- This is a minor fork of the trunk JQTI, which is available at:
- https://qtitools.svn.sourceforge.net/svnroot/qtitools/trunk/projects/JQTI
- This was branched at revision 2241.
- </description>
- <dependencies>
- <!-- (Added by DM to fix problems with decoding XML before parsing) -->
- <dependency>
- <groupId>org.codehaus.plexus</groupId>
- <artifactId>plexus-utils</artifactId>
- <version>2.0.1</version>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- <version>1.5.11</version>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-log4j12</artifactId>
- <version>1.5.11</version>
- <scope>runtime</scope>
- </dependency>
- <dependency>
- <groupId>log4j</groupId>
- <artifactId>log4j</artifactId>
- <version>1.2.14</version>
- <scope>runtime</scope>
- </dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>4.3.1</version>
- <scope>test</scope>
- </dependency>
- </dependencies>
- <distributionManagement>
- <!-- (This is for the MathAssess fork only) -->
- <repository>
- <id>www2.ph.ed.ac.uk</id>
- <url>file:///Disk/lust3/maven2</url>
- </repository>
- <snapshotRepository>
- <id>www2.ph.ed.ac.uk</id>
- <url>file:///Disk/lust3/maven2</url>
- </snapshotRepository>
- </distributionManagement>
- <!-- (This is for trunk deployments only) -->
- <!--
- <distributionManagement>
- <repository>
- <id>qtitools</id>
- <name>QTITools Repository</name>
- <url>http://maven.qtitools.org</url>
- </repository>
- </distributionManagement>
- -->
- <build>
- <plugins>
- <plugin>
- <artifactId>maven-compiler-plugin</artifactId>
- <configuration>
- <source>1.5</source>
- <target>1.5</target>
- </configuration>
- </plugin>
- <plugin>
- <artifactId>maven-surefire-plugin</artifactId>
- <version>2.3</version>
- </plugin>
- </plugins>
- </build>
- <reporting>
- <plugins>
- <!--
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-javadoc-plugin</artifactId>
- <configuration>
- <doclet>com.sun.tools.doclets.doccheck.DocCheck</doclet>
- <docletArtifact>
- <groupId>com.sun.tools.doclets</groupId>
- <artifactId>doccheck</artifactId>
- <version>1.2b2</version>
- </docletArtifact>
- <additionalparam>-d .</additionalparam>
- <destDir>doccheck</destDir>
- </configuration>
- </plugin>
- -->
- </plugins>
- </reporting>
-</project>
Deleted: branches/mathassess/QTIEngine/.classpath
===================================================================
--- branches/mathassess/QTIEngine/.classpath 2010-04-12 16:32:58 UTC (rev 2451)
+++ branches/mathassess/QTIEngine/.classpath 2010-04-12 16:38:15 UTC (rev 2452)
@@ -1,15 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="src" path="src/java"/>
- <classpathentry kind="src" path="src/groovy"/>
- <classpathentry kind="src" path="grails-app/conf"/>
- <classpathentry kind="src" path="grails-app/controllers"/>
- <classpathentry kind="src" path="grails-app/domain"/>
- <classpathentry kind="src" path="grails-app/services"/>
- <classpathentry kind="src" path="grails-app/taglib"/>
- <classpathentry kind="src" path="test/integration"/>
- <classpathentry kind="src" path="test/unit"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
- <classpathentry kind="con" path="com.springsource.sts.grails.core.CLASSPATH_CONTAINER"/>
- <classpathentry kind="output" path="web-app/WEB-INF/classes"/>
-</classpath>
Deleted: branches/mathassess/QTIEngine/.project
===================================================================
--- branches/mathassess/QTIEngine/.project 2010-04-12 16:32:58 UTC (rev 2451)
+++ branches/mathassess/QTIEngine/.project 2010-04-12 16:38:15 UTC (rev 2452)
@@ -1,19 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>MathAssessEngine</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>com.springsource.sts.grails.core.nature</nature>
- <nature>org.eclipse.jdt.groovy.core.groovyNature</nature>
- <nature>org.eclipse.jdt.core.javanature</nature>
- </natures>
-</projectDescription>
Added: branches/mathassess/QTIEngine/README.txt
===================================================================
--- branches/mathassess/QTIEngine/README.txt (rev 0)
+++ branches/mathassess/QTIEngine/README.txt 2010-04-12 16:38:15 UTC (rev 2452)
@@ -0,0 +1,3 @@
+This can now be found at:
+
+https://fetlar.svn.sourceforge.net/svnroot/fetlar/MathAssessEngine
Deleted: branches/mathassess/QTIEngine/application.properties
===================================================================
--- branches/mathassess/QTIEngine/application.properties 2010-04-12 16:32:58 UTC (rev 2451)
+++ branches/mathassess/QTIEngine/application.properties 2010-04-12 16:38:15 UTC (rev 2452)
@@ -1,8 +0,0 @@
-#Grails Metadata file
-#Thu Apr 08 14:51:51 BST 2010
-app.grails.version=1.2.2
-app.name=MathAssessEngine
-app.servlet.version=2.4
-app.version=0.4.0
-plugins.hibernate=1.2.2
-plugins.tomcat=1.2.2
Deleted: branches/mathassess/qtiplayr/AUTHORS
===================================================================
--- branches/mathassess/qtiplayr/AUTHORS 2010-04-12 16:32:58 UTC (rev 2451)
+++ branches/mathassess/qtiplayr/AUTHORS 2010-04-12 16:38:15 UTC (rev 2452)
@@ -1,5 +0,0 @@
-moodle-qtiplayr-plugin authors:
-
-Jonathon Hare <js...@ec...>
-
-Funded by JISC -- http://www.jisc.ac.uk
Deleted: branches/mathassess/qtiplayr/COPYING
===================================================================
--- branches/mathassess/qtiplayr/COPYING 2010-04-12 16:32:58 UTC (rev 2451)
+++ branches/mathassess/qtiplayr/COPYING 2010-04-12 16:38:15 UTC (rev 2452)
@@ -1,27 +0,0 @@
-Copyright (c) 2008, University of Southampton
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without modification,
-are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright notice, this
- list of conditions and the following disclaimer.
-
- * Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation
- and/or other materials provided with the distribution.
-
- * Neither the name of the University of Southampton nor the names of its
- contributors may be used to endorse or promote products derived from this
- software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
-ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
-ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Deleted: branches/mathassess/qtiplayr/README.txt
===================================================================
--- branches/mathassess/qtiplayr/README.txt 2010-04-12 16:32:58 UTC (rev 2451)
+++ branches/mathassess/qtiplayr/README.txt 2010-04-12 16:38:15 UTC (rev 2452)
@@ -1,46 +0,0 @@
-QTIEngine Playr Plugin for Moodle
----------------------------------
-
-Installation:
--------------
-
-Move the "qtiplayr" folder to the "mod" folder of your Moodle installation. In your Web browser, log in as a user with administrator privileges and click "Notifications" in the left-hand menu. The plugin should install automatically, setting up all necessary database tables. Click "Continue" at the bottom of the page to be returned to the Moodle main page.
-
-Configuration:
---------------
-
-While logged in as an administrator, click Modules->Activities->qtiplayr from the left-hand "Site Administration" menu. On the "qtiplayr" configuration page, enter the following details:
- - the hostname and network port used to access your qtiengine playr
- - the hostname of the server containing your minibix installation
- - the server address used to define "deposit" keys in the minibix repository
- - the playr template name (this will typically be left as "moodle")
-
-Once these details have been entered, click "Save Changes" to return to the main page.
-
-Adding QTIPlayr to a Course:
-----------------------------
-
-Navigate to the required course "Weekly Outline" page, and choose "qtiplayr" from the "Add an activity..." drop-down box. The setup page is formed of 4 sections:
-
-- General:
- This section includes the assessment activity name, and some basic scheduling information (when the test first becomes accessible, when it expires, and how many attempts each student can make). In addition, there is the option to give students access to a limited report for each attempt they make.
-- Content Package:
- There are two options for choosing a content package: either by uploading a file from your local machine to moodle, or by choosing one from the minibix repository configured earlier. If a file is uploaded to moodle, it will be used. If the box is left blank, the file from the minibix drop-down list will be used instead.
-- Gradebook Options:
- Typically, the only values that might need to be changed are "Grade Type", "Maximum possible grade" and "Minimum possible grade".
-- Common Module Settings:
- These options are usually the same for all modules, and will probably not need to be changed.
-
-Click "Save and return to course" to go back to the "Weekly Outline" page, or "Save and display" to preview the activity.
-
-Running the Activity:
----------------------
-
-The run the activity, click on its name on the "Weekly Outline" page. As an instructor, the user can preview the assessment (completing an assessment this way does not add anything to the gradebook), and view question-by-question reports for every student who has attempted the activity.
-
-As a student, the user can attempt the test, storing a grade in the Moodle gradebook upon completion. In addition, a grade will be saved after each question, so if the user stops the assessment early, they will receive a grade based on the questions they did answer. If a student attempts to continue an assessment which they previously gave up on, the qtiengine will allow them to do so, providing their session on the server has not timed out. If the session has timed out, the student will be notified, and will have to use another attempt (if available) to start again. Also, if the instructor has allowed it, students can view a limited overall report for any attempts they have already made.
-
-Reviewing Students' Progress:
------------------------------
-
-In addition to the qtiengine reports, instructors can view the students' grades for each activity in the Moodle gradebook in the usual way.
\ No newline at end of file
Added: branches/mathassess/qtiplayr/README.txt
===================================================================
--- branches/mathassess/qtiplayr/README.txt (rev 0)
+++ branches/mathassess/qtiplayr/README.txt 2010-04-12 16:38:15 UTC (rev 2452)
@@ -0,0 +1,3 @@
+This can now be found at:
+
+https://fetlar.svn.sourceforge.net/svnroot/fetlar/qtiplayr
Deleted: branches/mathassess/qtiplayr/config.html
===================================================================
--- branches/mathassess/qtiplayr/config.html 2010-04-12 16:32:58 UTC (rev 2451)
+++ branches/mathassess/qtiplayr/config.html 2010-04-12 16:38:15 UTC (rev 2452)
@@ -1,30 +0,0 @@
-<form method="post" action="module.php" id="form">
-<div style="text-align: center">
-<input type="hidden" name="sesskey" value="<?php echo sesskey(); ?>" />
-
-Please enter the hostname and port number of the playr webservice api below: <br />
-
-http://<input type="text" name="qtiplayr_hostname" value="<?php p($CFG->qtiplayr_hostname ? $CFG->qtiplayr_hostname : 'playr.qtitools.org') ?>" />
-:<input type="text" name="qtiplayr_hostport" size="5" value="<?php p($CFG->qtiplayr_hostport ? $CFG->qtiplayr_hostport : '80') ?>" /><br />
-<br />
-<?php
-//if (!class_exists('DOMDocument') || !class_exists('XSLTProcessor')) {
- echo '<br />';
- echo '<em>The PHP5 DOMDocument and/or XSLTProcessor classes could not be found. Reports will be disabled unless you allow client-side XSLT for reports by checking the following check box. Note: this option is insecure because it could allow candidates to view the raw XML report rather than the transformed version.</em><br />';
- echo '<label for="qtiplayr_allowclientsidexslt">Allow client-side XSLT</label>';
- echo '<input type="checkbox" name="qtiplayr_allowclientsidexslt" size="5" value="false" /><br />';
- echo '</emph><br /><br />';
-//}
-?>
-<br />
-Enter the hostname of the server containing your minibix installation (e.g. qtitools.caret.cam.ac.uk): <br />
-<input type="text" size="50" name="minibix_hostname" value="<?php p($CFG->minibix_hostname ? $CFG->minibix_hostname : '') ?>" /> <br />
-Enter the server address used to define "deposit" keys in the Minibix repository (e.g. www.caret.cam.ac.uk): <br />
-<input type="text" size="50" name="minibix_xpath" value="<?php p($CFG->minibix_xpath ? $CFG->minibix_xpath : '') ?>" />
-<p />
-<label for="qtiplayr_template">playr template name:</label><input type="text" name="qtiplayr_template" value="<?php p($CFG->qtiplayr_template ? $CFG->qtiplayr_template : 'moodle') ?>" />
-<br />
-<br />
-<input type="submit" value="<?php print_string("savechanges") ?>" />
-</div>
-</form>
Deleted: branches/mathassess/qtiplayr/detail.inc.php
===================================================================
--- branches/mathassess/qtiplayr/detail.inc.php 2010-04-12 16:32:58 UTC (rev 2451)
+++ branches/mathassess/qtiplayr/detail.inc.php 2010-04-12 16:38:15 UTC (rev 2452)
@@ -1,77 +0,0 @@
-<?php
-
- //
- require_once("../../config.php");
- require_once("lib.php");
-
- $id = optional_param('id', 0, PARAM_INT); // Course Module ID, or
- $a = optional_param('a', 0, PARAM_INT); // qtiplayr ID
-
- if ($id) {
- if (! $cm = get_record("course_modules", "id", $id)) {
- error("Course Module ID was incorrect");
- }
-
- if (! $course = get_record("course", "id", $cm->course)) {
- error("Course is misconfigured");
- }
-
- if (! $qtiplayr = get_record("qtiplayr", "id", $cm->instance)) {
- error("Course module is incorrect");
- }
-
- } else {
- if (! $qtiplayr = get_record("qtiplayr", "id", $a)) {
- error("Course module is incorrect");
- }
- if (! $course = get_record("course", "id", $qtiplayr->course)) {
- error("Course is misconfigured");
- }
- if (! $cm = get_coursemodule_from_instance("qtiplayr", $qtiplayr->id, $course->id)) {
- error("Course Module ID was incorrect");
- }
- }
-
- require_login($course->id);
- if (!$id) $id = $cm->id;
-
- $context = get_context_instance(CONTEXT_MODULE, $cm->id);
- //
-
-require_capability('mod/qtiplayr:allreports', $context);
-
-$assessment = get_record('qtiplayr_assessment_attempts', 'id', $_REQUEST['detail']);
-$c = get_record('user', 'id', $assessment->userid);
-$xml = $assessment->report;
-
-echo "<a href=\"view.php?showattempts=$assessment->userid&id=$id\">Back to the attempts list</a><br />";
-
-echo "<br />\n";
-echo "Candidate name: $c->firstname $c->lastname <br />\n";
-echo "Attempt number:". (intval($assessment->attempt)+1)." <br />\n";
-
-if (class_exists('DOMDocument') && class_exists('XSLTProcessor')) {
- $xsl_filename = "xsl/full_report.xsl";
-
- $doc = new DOMDocument();
- $xsl = new XSLTProcessor();
-
- $doc->load($xsl_filename);
- $xsl->importStyleSheet($doc);
-
- $doc->loadXML($xml);
- echo $xsl->transformToXML($doc);
-} else {
- //do the xslt client side (perhaps make it optional, as it is a security risk in that the xml doc might contain things that you don't want made public)
-/* if ($CFG->qtiplayr_allowclientsidexslt) {
- echo '<?xml version="1.0" encoding="UTF-8"?>';
- echo '<?xml-stylesheet type="text/xsl" href="xsl/full_report.xsl"?>';
- echo $xml;
- } else {
-*/ ?>
- Configuration error: no php xslt class found and client-side xslt is disabled
- <?php
-// }
-
-}
-?>
\ No newline at end of file
Deleted: branches/mathassess/qtiplayr/download.php
===================================================================
--- branches/mathassess/qtiplayr/download.php 2010-04-12 16:32:58 UTC (rev 2451)
+++ branches/mathassess/qtiplayr/download.php 2010-04-12 16:38:15 UTC (rev 2452)
@@ -1,38 +0,0 @@
-<?php
- require_once("../../config.php");
- require_once("lib.php");
-
- $id = required_param('id', PARAM_INT); // Course Module ID, or
-
- if ($id) {
- if (! $cm = get_record("course_modules", "id", $id)) {
- error("Course Module ID was incorrect");
- }
-
- if (! $course = get_record("course", "id", $cm->course)) {
- error("Course is misconfigured");
- }
-
- if (! $qtiplayr = get_record("qtiplayr", "id", $cm->instance)) {
- error("Course module is incorrect");
- }
-
- }
- require_login($course->id);
-
- if (!$id) $id = $cm->id;
- $context = get_context_instance(CONTEXT_MODULE, $cm->id);
-
- require_capability('mod/qtiplayr:allreports', $context);
-
- $aid = required_param('aid', PARAM_INT); // assessment
-
- if (! $assessment = get_record("qtiplayr_assessment_attempts", "id", $aid)) {
- error("Assessment ID is incorrect");
- }
-
- header("Content-type: application/octet-stream");
- header("Content-Disposition: attachment; filename=\"$assessment->name_$assessment->id.xml\"");
- echo $assessment->report;
-
-?>
\ No newline at end of file
Deleted: branches/mathassess/qtiplayr/http.inc
===================================================================
--- branches/mathassess/qtiplayr/http.inc 2010-04-12 16:32:58 UTC (rev 2451)
+++ branches/mathassess/qtiplayr/http.inc 2010-04-12 16:38:15 UTC (rev 2452)
@@ -1,932 +0,0 @@
-<?php
-/**************************************************************************************************
-* Class: Advanced HTTP Client
-***************************************************************************************************
-* Version : 1.1
-* Released : 06-20-2002
-* Last Modified : 06-10-2003
-* Author : GuinuX <gu...@co...>
-*
-***************************************************************************************************
-* Changes
-***************************************************************************************************
-* 2003-06-10 : GuinuX
-* - Fixed a bug with multiple gets and basic auth
-* - Added support for Basic proxy Authentification
-* 2003-05-25: By Michael Mauch <mic...@gm...>
-* - Fixed two occurences of the former "status" member which is now deprecated
-* 2002-09-23: GuinuX
-* - Fixed a bug to the post method with some HTTP servers
-* - Thanx to l0rd jenci <lor...@bi...> for reporting this bug.
-* 2002-09-07: Dirk Fokken <fo...@cr...>
-* - Deleted trailing characters at the end of the file, right after the php closing tag, in order
-* to fix a bug with binary requests.
-* 2002-20-06: GuinuX, Major changes
-* - Turned to a more OOP style => added class http_header, http_response_header,
-* http_request_message, http_response_message.
-* The members : status, body, response_headers, cookies, _request_headers of the http class
-* are Deprecated.
-* 2002-19-06: GuinuX, fixed some bugs in the http::_get_response() method
-* 2002-18-06: By Mate Jovic <jo...@ma...>
-* - Added support for Basic Authentification
-* usage: $http_client = new http( HTTP_V11, false, Array('user','pass') );
-*
-***************************************************************************************************
-* Description:
-***************************************************************************************************
-* A HTTP client class
-* Supports :
-* - GET, HEAD and POST methods
-* - Http cookies
-* - multipart/form-data AND application/x-www-form-urlencoded
-* - Chunked Transfer-Encoding
-* - HTTP 1.0 and 1.1 protocols
-* - Keep-Alive Connections
-* - Proxy
-* - Basic WWW-Authentification and Proxy-Authentification
-*
-***************************************************************************************************
-* TODO :
-***************************************************************************************************
-* - Read trailing headers for Chunked Transfer-Encoding
-***************************************************************************************************
-* usage
-***************************************************************************************************
-* See example scripts.
-*
-***************************************************************************************************
-* License
-***************************************************************************************************
-* GNU Lesser General Public License (LGPL)
-* http://www.opensource.org/licenses/lgpl-license.html
-*
-* For any suggestions or bug report please contact me : gu...@co...
-***************************************************************************************************/
-
- if ( !defined('HTTP_CRLF') ) define( 'HTTP_CRLF', chr(13) . chr(10));
- define( 'HTTP_V10', '1.0');
- define( 'HTTP_V11', '1.1');
- define( 'HTTP_STATUS_CONTINUE', 100 );
- define( 'HTTP_STATUS_SWITCHING_PROTOCOLS', 101 );
- define( 'HTTP_STATUS_OK', 200 );
- define( 'HTTP_STATUS_CREATED', 201 );
- define( 'HTTP_STATUS_ACCEPTED', 202 );
- define( 'HTTP_STATUS_NON_AUTHORITATIVE', 203 );
- define( 'HTTP_STATUS_NO_CONTENT', 204 );
- define( 'HTTP_STATUS_RESET_CONTENT', 205 );
- define( 'HTTP_STATUS_PARTIAL_CONTENT', 206 );
- define( 'HTTP_STATUS_MULTIPLE_CHOICES', 300 );
- define( 'HTTP_STATUS_MOVED_PERMANENTLY', 301 );
- define( 'HTTP_STATUS_FOUND', 302 );
- define( 'HTTP_STATUS_SEE_OTHER', 303 );
- define( 'HTTP_STATUS_NOT_MODIFIED', 304 );
- define( 'HTTP_STATUS_USE_PROXY', 305 );
- define( 'HTTP_STATUS_TEMPORARY_REDIRECT', 307 );
- define( 'HTTP_STATUS_BAD_REQUEST', 400 );
- define( 'HTTP_STATUS_UNAUTHORIZED', 401 );
- define( 'HTTP_STATUS_FORBIDDEN', 403 );
- define( 'HTTP_STATUS_NOT_FOUND', 404 );
- define( 'HTTP_STATUS_METHOD_NOT_ALLOWED', 405 );
- define( 'HTTP_STATUS_NOT_ACCEPTABLE', 406 );
- define( 'HTTP_STATUS_PROXY_AUTH_REQUIRED', 407 );
- define( 'HTTP_STATUS_REQUEST_TIMEOUT', 408 );
- define( 'HTTP_STATUS_CONFLICT', 409 );
- define( 'HTTP_STATUS_GONE', 410 );
- define( 'HTTP_STATUS_REQUEST_TOO_LARGE', 413 );
- define( 'HTTP_STATUS_URI_TOO_LONG', 414 );
- define( 'HTTP_STATUS_SERVER_ERROR', 500 );
- define( 'HTTP_STATUS_NOT_IMPLEMENTED', 501 );
- define( 'HTTP_STATUS_BAD_GATEWAY', 502 );
- define( 'HTTP_STATUS_SERVICE_UNAVAILABLE', 503 );
- define( 'HTTP_STATUS_VERSION_NOT_SUPPORTED', 505 );
-
-
-/******************************************************************************************
-* class http_header
-******************************************************************************************/
- class http_header {
- var $_headers;
- var $_debug;
-
- function http_header() {
- $this->_headers = Array();
- $this->_debug = '';
- } // End Of function http_header()
-
- function get_header( $header_name ) {
- $header_name = $this->_format_header_name( $header_name );
- if (isset($this->_headers[$header_name]))
- return $this->_headers[$header_name];
- else
- return null;
- } // End of function get()
-
- function set_header( $header_name, $value ) {
- if ($value != '') {
- $header_name = $this->_format_header_name( $header_name );
- $this->_headers[$header_name] = $value;
- }
- } // End of function set()
-
- function reset() {
- if ( count( $this->_headers ) > 0 ) $this->_headers = array();
- $this->_debug .= "\n--------------- RESETED ---------------\n";
- } // End of function clear()
-
- function serialize_headers() {
- $str = '';
- foreach ( $this->_headers as $name=>$value) {
- $str .= "$name: $value" . HTTP_CRLF;
- }
- return $str;
- } // End of function serialize_headers()
-
- function _format_header_name( $header_name ) {
- $formatted = str_replace( '-', ' ', strtolower( $header_name ) );
- $formatted = ucwords( $formatted );
- $formatted = str_replace( ' ', '-', $formatted );
- return $formatted;
- }
-
- function add_debug_info( $data ) {
- $this->_debug .= $data;
- }
-
- function get_debug_info() {
- return $this->_debug;
- }
-
- } // End Of Class http_header
-
-/******************************************************************************************
-* class http_response_header
-******************************************************************************************/
- class http_response_header extends http_header {
- var $cookies_headers;
-
- function http_response_header() {
- $this->cookies_headers = array();
- http_header::http_header();
- } // End of function http_response_header()
-
- function deserialize_headers( $flat_headers ) {
- $flat_headers = preg_replace( "/^" . HTTP_CRLF . "/", '', $flat_headers );
- $tmp_headers = split( HTTP_CRLF, $flat_headers );
- if (preg_match("'HTTP/(\d\.\d)\s+(\d+).*'i", $tmp_headers[0], $matches )) {
- $this->set_header( 'Protocol-Version', $matches[1] );
- $this->set_header( 'Status', $matches[2] );
- }
- array_shift( $tmp_headers );
- foreach( $tmp_headers as $index=>$value ) {
- $pos = strpos( $value, ':' );
- if ( $pos ) {
- $key = substr( $value, 0, $pos );
- $value = trim( substr( $value, $pos +1) );
- if ( strtoupper($key) == 'SET-COOKIE' )
- $this->cookies_headers[] = $value;
- else
- $this->set_header( $key, $value );
- }
- }
- } // End of function deserialize_headers()
-
- function reset() {
- if ( count( $this->cookies_headers ) > 0 ) $this->cookies_headers = array();
- http_header::reset();
- }
-
- } // End of class http_response_header
-
-
-/******************************************************************************************
-* class http_request_message
-******************************************************************************************/
- class http_request_message extends http_header {
- var $body;
-
- function http_request_message() {
- $this->body = '';
- http_header::http_header();
- } // End of function http_message()
-
- function reset() {
- $this->body = '';
- http_header::reset();
- }
- }
-
-/******************************************************************************************
-* class http_response_message
-******************************************************************************************/
- class http_response_message extends http_response_header {
- var $body;
- var $cookies;
-
- function http_response_message() {
- $this->cookies = new http_cookie();
- $this->body = '';
- http_response_header::http_response_header();
- } // End of function http_response_message()
-
- function get_status() {
- if ( $this->get_header( 'Status' ) != null )
- return /*(integer)*/$this->get_header( 'Status' );
- else
- return -1;
- }
-
- function get_protocol_version() {
- if ( $this->get_header( 'Protocol-Version' ) != null )
- return $this->get_header( 'Protocol-Version' );
- else
- return HTTP_V10;
- }
-
- function get_content_type() {
- return $this->get_header( 'Content-Type' );
- }
-
- function get_content_length() {
- return $this->get_header( 'Content-Length' );
- }
-
- function get_body() {
- return $this->body;
- }
-
- function reset() {
- $this->body = '';
- http_response_header::reset();
- }
-
- function parse_cookies( $host ) {
- for ( $i = 0; $i < count( $this->cookies_headers ); $i++ )
- $this->cookies->parse( $this->cookies_headers[$i], $host );
- }
- }
-
-/******************************************************************************************
-* class http_cookie
-******************************************************************************************/
- class http_cookie {
- var $cookies;
-
- function http_cookie() {
- $this->cookies = array();
- } // End of function http_cookies()
-
- function _now() {
- return strtotime( gmdate( "l, d-F-Y H:i:s", time() ) );
- } // End of function _now()
-
- function _timestamp( $date ) {
- if ( $date == '' ) return $this->_now()+3600;
- $time = strtotime( $date );
- return ($time>0?$time:$this->_now()+3600);
- } // End of function _timestamp()
-
- function get( $current_domain, $current_path ) {
- $cookie_str = '';
- $now = $this->_now();
- $new_cookies = array();
-
- foreach( $this->cookies as $cookie_name => $cookie_data ) {
- if ($cookie_data['expires'] > $now) {
- $new_cookies[$cookie_name] = $cookie_data;
- $domain = preg_quote( $cookie_data['domain'] );
- $path = preg_quote( $cookie_data['path'] );
- if ( preg_match( "'.*$domain$'i", $current_domain ) && preg_match( "'^$path.*'i", $current_path ) )
- {
- $cookie_str .= $cookie_name . '=' . $cookie_data['value'];// . '; ';
- }
- }
- }
- $this->cookies = $new_cookies;
- return $cookie_str;
- } // End of function get()
-
- function set( $name, $value, $domain, $path, $expires ) {
- $this->cookies[$name] = array( 'value' => $value,
- 'domain' => $domain,
- 'path' => $path,
- 'expires' => $this->_timestamp( $expires )
- );
- } // End of function set()
-
- function parse( $cookie_str, $host ) {
- $cookie_str = str_replace( '; ', ';', $cookie_str ) . ';';
- $data = split( ';', $cookie_str );
- $value_str = $data[0];
-
- $cookie_param = 'domain=';
- $start = strpos( $cookie_str, $cookie_param );
- if ( $start > 0 ) {
- $domain = substr( $cookie_str, $start + strlen( $cookie_param ) );
- $domain = substr( $domain, 0, strpos( $domain, ';' ) );
- } else
- $domain = $host;
-
- $cookie_param = 'expires=';
- $start = strpos( $cookie_str, $cookie_param );
- if ( $start > 0 ) {
- $expires = substr( $cookie_str, $start + strlen( $cookie_param ) );
- $expires = substr( $expires, 0, strpos( $expires, ';' ) );
- } else
- $expires = '';
-
- $cookie_param = 'path=';
- $start = strpos( $cookie_str, $cookie_param );
- if ( $start > 0 ) {
- $path = substr( $cookie_str, $start + strlen( $cookie_param ) );
- $path = substr( $path, 0, strpos( $path, ';' ) );
- } else
- $path = '/';
-
- $sep_pos = strpos( $value_str, '=');
-
- if ($sep_pos){
- $name = substr( $value_str, 0, $sep_pos );
- $value = substr( $value_str, $sep_pos+1 );
- $this->set( $name, $value, $domain, $path, $expires );
- }
- } // End of function parse()
-
- } // End of class http_cookie
-
-/******************************************************************************************
-* class http
-******************************************************************************************/
- class http {
- var $_socket;
- var $host;
- var $port;
- var $http_version;
- var $user_agent;
- var $errstr;
- var $connected;
- var $uri;
- var $_proxy_host;
- var $_proxy_port;
- var $_proxy_login;
- var $_proxy_pwd;
- var $_use_proxy;
- var $_auth_login;
- var $_auth_pwd;
- var $_response;
- var $_request;
- var $_keep_alive;
-
- function http( $http_version = HTTP_V10, $keep_alive = false, $auth = false ) {
- $this->http_version = $http_version;
- $this->connected = false;
- $this->user_agent = 'CosmoHttp/1.1 (compatible; MSIE 5.5; Linux)';
- $this->host = '';
- $this->port = 80;
- $this->errstr = '';
-
- $this->_keep_alive = $keep_alive;
- $this->_proxy_host = '';
- $this->_proxy_port = -1;
- $this->_proxy_login = '';
- $this->_proxy_pwd = '';
- $this->_auth_login = '';
- $this->_auth_pwd = '';
- $this->_use_proxy = false;
- $this->_response = new http_response_message();
- $this->_request = new http_request_message();
-
- // Basic Authentification added by Mate Jovic, 2002-18-06, jo...@ma...
- if( is_array($auth) && count($auth) == 2 ){
- $this->_auth_login = $auth[0];
- $this->_auth_pwd = $auth[1];
- }
- } // End of Constuctor
-
- function use_proxy( $host, $port, $proxy_login = null, $proxy_pwd = null ) {
- // Proxy auth not yet supported
- $this->http_version = HTTP_V10;
- $this->_keep_alive = false;
- $this->_proxy_host = $host;
- $this->_proxy_port = $port;
- $this->_proxy_login = $proxy_login;
- $this->_proxy_pwd = $proxy_pwd;
- $this->_use_proxy = true;
- }
-
- function set_request_header( $name, $value ) {
- $this->_request->set_header( $name, $value );
- }
-
- function get_response_body() {
- return $this->_response->body;
- }
-
- function get_response() {
- return $this->_response;
- }
-
- function head( $uri ) {
- $this->uri = $uri;
-
- if ( ($this->_keep_alive && !$this->connected) || !$this->_keep_alive ) {
- if ( !$this->_connect() ) {
- $this->errstr = 'Could not connect to ' . $this->host;
- return -1;
- }
- }
- $http_cookie = $this->_response->cookies->get( $this->host, $this->_current_directory( $uri ) );
-
- if ($this->_use_proxy) {
- $this->_request->set_header( 'Host', $this->host . ':' . $this->port );
- $this->_request->set_header( 'Proxy-Connection', ($this->_keep_alive?'Keep-Alive':'Close') );
- if ( $this->_proxy_login != '' ) $this->_request->set_header( 'Proxy-Authorization', "Basic " . base64_encode( $this->_proxy_login . ":" . $this->_proxy_pwd ) );
- $uri = 'http://' . $this->host . ':' . $this->port . $uri;
- } else {
- $this->_request->set_header( 'Host', $this->host );
- $this->_request->set_header( 'Connection', ($this->_keep_alive?'Keep-Alive':'Close') );
- }
-
- if ( $this->_auth_login != '' ) $this->_request->set_header( 'Authorization', "Basic " . base64_encode( $this->_auth_login . ":" . $this->_auth_pwd ) );
- $this->_request->set_header( 'User-Agent', $this->user_agent );
- $this->_request->set_header( 'Accept', '*/*' );
- $this->_request->set_header( 'Cookie', $http_cookie );
-
- $cmd = "HEAD $uri HTTP/" . $this->http_version . HTTP_CRLF .
- $this->_request->serialize_headers() .
- HTTP_CRLF;
- fwrite( $this->_socket, $cmd );
-
- $this->_request->add_debug_info( $cmd );
- $this->_get_response( false );
-
- if ($this->_socket && !$this->_keep_alive) $this->disconnect();
- if ( $this->_response->get_header( 'Connection' ) != null ) {
- if ( $this->_keep_alive && strtolower( $this->_response->get_header( 'Connection' ) ) == 'close' ) {
- $this->_keep_alive = false;
- $this->disconnect();
- }
- }
-
- if ( $this->_response->get_status() == HTTP_STATUS_USE_PROXY ) {
- $location = $this->_parse_location( $this->_response->get_header( 'Location' ) );
- $this->disconnect();
- $this->use_proxy( $location['host'], $location['port'] );
- $this->head( $this->uri );
- }
-
- return $this->_response->get_header( 'Status' );
- } // End of function head()
-
-
- function get( $uri, $follow_redirects = true, $referer = '' ) {
- $this->uri = $uri;
-
- if ( ($this->_keep_alive && !$this->connected) || !$this->_keep_alive ) {
- if ( !$this->_connect() ) {
- $this->errstr = 'Could not connect to ' . $this->host;
- return -1;
- }
- }
-
- if ($this->_use_proxy) {
- $this->_request->set_header( 'Host', $this->host . ':' . $this->port );
- $this->_request->set_header( 'Proxy-Connection', ($this->_keep_alive?'Keep-Alive':'Close') );
- if ( $this->_proxy_login != '' ) $this->_request->set_header( 'Proxy-Authorization', "Basic " . base64_encode( $this->_proxy_login . ":" . $this->_proxy_pwd ) );
- $uri = 'http://' . $this->host . ':' . $this->port . $uri;
- } else {
- $this->_request->set_header( 'Host', $this->host );
- $this->_request->set_header( 'Connection', ($this->_keep_alive?'Keep-Alive':'Close') );
- $this->_request->set_header( 'Pragma', 'no-cache' );
- $this->_request->set_header( 'Cache-Control', 'no-cache' );
- }
-
- if ( $this->_auth_login != '' ) $this->_request->set_header( 'Authorization', "Basic " . base64_encode( $this->_auth_login . ":" . $this->_auth_pwd ) );
- $http_cookie = $this->_response->cookies->get( $this->host, $this->_current_directory( $uri ) );
- $this->_request->set_header( 'User-Agent', $this->user_agent );
- $this->_request->set_header( 'Accept', '*/*' );
- $this->_request->set_header( 'Referer', $referer );
- $this->_request->set_header( 'Cookie', $http_cookie );
-//
- $this->_request->set_header( 'Keep-Alive', '300' );
-//
-
- $cmd = "GET $uri HTTP/" . $this->http_version . HTTP_CRLF .
- $this->_request->serialize_headers() .
- HTTP_CRLF;
- fwrite( $this->_socket, $cmd );
-
- $this->_request->add_debug_info( $cmd );
- $this->_get_response();
-
- if ($this->_socket && !$this->_keep_alive) $this->disconnect();
- if ( $this->_response->get_header( 'Connection' ) != null ) {
- if ( $this->_keep_alive && strtolower( $this->_response->get_header( 'Connection' ) ) == 'close' ) {
- $this->_keep_alive = false;
- $this->disconnect();
- }
- }
- if ( $follow_redirects && ($this->_response->get_status() == HTTP_STATUS_MOVED_PERMANENTLY || $this->_response->get_status() == HTTP_STATUS_FOUND || $this->_response->get_status() == HTTP_STATUS_SEE_OTHER ) ) {
- if ( $this->_response->get_header( 'Location' ) != null ) {
- $this->_redirect( $this->_response->get_header( 'Location' ) );
- }
- }
-
- if ( $this->_response->get_status() == HTTP_STATUS_USE_PROXY ) {
- $location = $this->_parse_location( $this->_response->get_header( 'Location' ) );
- $this->disconnect();
- $this->use_proxy( $location['host'], $location['port'] );
- $this->get( $this->uri, $referer );
- }
-
- return $this->_response->get_status();
- } // End of function get()
-
-
-
- function multipart_post( $uri, &$form_fields, $form_files = null, $follow_redirects = true, $referer = '' ) {
- $this->uri = $uri;
-
- if ( ($this->_keep_alive && !$this->connected) || !$this->_keep_alive ) {
- if ( !$this->_connect() ) {
- $this->errstr = 'Could not connect to ' . $this->host;
- return -1;
- }
- }
- $boundary = uniqid('------------------');
- $http_cookie = $this->_response->cookies->get( $this->host, $this->_current_directory( $uri ) );
- $body = $this->_merge_multipart_form_data( $boundary, $form_fields, $form_files );
- $this->_request->body = $body . HTTP_CRLF;
- $content_length = strlen( $body );
-
-
- if ($this->_use_proxy) {
- $this->_request->set_header( 'Host', $this->host . ':' . $this->port );
- $this->_request->set_header( 'Proxy-Connection', ($this->_keep_alive?'Keep-Alive':'Close') );
- if ( $this->_proxy_login != '' ) $this->_request->set_header( 'Proxy-Authorization', "Basic " . base64_encode( $this->_proxy_login . ":" . $this->_proxy_pwd ) );
- $uri = 'http://' . $this->host . ':' . $this->port . $uri;
- } else {
- $this->_request->set_header( 'Host', $this->host );
- $this->_request->set_header( 'Connection', ($this->_keep_alive?'Keep-Alive':'Close') );
- $this->_request->set_header( 'Pragma', 'no-cache' );
- $this->_request->set_header( 'Cache-Control', 'no-cache' );
- }
-
- if ( $this->_auth_login != '' ) $this->_request->set_header( 'Authorization', "Basic " . base64_encode( $this->_auth_login . ":" . $this->_auth_pwd ) );
- $this->_request->set_header( 'Accept', '*/*' );
- $this->_request->set_header( 'Content-Type', 'multipart/form-data; boundary=' . $boundary );
- $this->_request->set_header( 'User-Agent', $this->user_agent );
- $this->_request->set_header( 'Content-Length', $content_length );
- $this->_request->set_header( 'Cookie', $http_cookie );
- $this->_request->set_header( 'Referer', $referer );
-//
- $this->_request->set_header( 'Keep-Alive', '300' );
-//
- $req_header = "POST $uri HTTP/" . $this->http_version . HTTP_CRLF .
- $this->_request->serialize_headers() .
- HTTP_CRLF;
-
- fwrite( $this->_socket, $req_header );
- usleep(10);
- fwrite( $this->_socket, $this->_request->body );
-
- $this->_request->add_debug_info( $req_header );
- $this->_get_response();
-
- if ($this->_socket && !$this->_keep_alive) $this->disconnect();
- if ( $this->_response->get_header( 'Connection' ) != null ) {
- if ( $this->_keep_alive && strtolower( $this->_response->get_header( 'Connection' ) ) == 'close' ) {
- $this->_keep_alive = false;
- $this->disconnect();
- }
- }
-
- if ( $follow_redirects && ($this->_response->get_status() == HTTP_STATUS_MOVED_PERMANENTLY || $this->_response->get_status() == HTTP_STATUS_FOUND || $this->_response->get_status() == HTTP_STATUS_SEE_OTHER ) ) {
- if ( $this->_response->get_header( 'Location') != null ) {
- $this->_redirect( $this->_response->get_header( 'Location') );
- }
- }
-
- if ( $this->_response->get_status() == HTTP_STATUS_USE_PROXY ) {
- $location = $this->_parse_location( $this->_response->get_header( 'Location') );
- $this->disconnect();
- $this->use_proxy( $location['host'], $location['port'] );
- $this->multipart_post( $this->uri, $form_fields, $form_files, $referer );
- }
-
- return $this->_response->get_status();
- } // End of function multipart_post()
-
-
-
- function post( $uri, &$form_data, $follow_redirects = true, $referer = '' ) {
- $this->uri = $uri;
-
- if ( ($this->_keep_alive && !$this->connected) || !$this->_keep_alive ) {
- if ( !$this->_connect() ) {
- $this->errstr = 'Could not connect to ' . $this->host;
- return -1;
- }
- }
- $http_cookie = $this->_response->cookies->get( $this->host, $this->_current_directory( $uri ) );
- $body = substr( $this->_merge_form_data( $form_data ), 1 );
- $this->_request->body = $body . HTTP_CRLF . HTTP_CRLF;
- $content_length = strlen( $body );
-
- if ($this->_use_proxy) {
- $this->_request->set_header( 'Host', $this->host . ':' . $this->port );
- $this->_request->set_header( 'Proxy-Connection', ($this->_keep_alive?'Keep-Alive':'Close') );
- if ( $this->_proxy_login != '' ) $this->_request->set_header( 'Proxy-Authorization', "Basic " . base64_encode( $this->_proxy_login . ":" . $this->_proxy_pwd ) );
- $uri = 'http://' . $this->host . ':' . $this->port . $uri;
- } else {
- $this->_request->set_header( 'Host', $this->host );
- $this->_request->set_header( 'Connection', ($this->_keep_alive?'Keep-Alive':'Close') );
- $this->_request->set_header( 'Pragma', 'no-cache' );
- $this->_request->set_header( 'Cache-Control', 'no-cache' );
- }
-
- if ( $this->_auth_login != '' ) $this->_request->set_header( 'Authorization', "Basic " . base64_encode( $this->_auth_login . ":" . $this->_auth_pwd ) );
- $this->_request->set_header( 'Accept', '*/*' );
- $this->_request->set_header( 'Content-Type', 'application/x-www-form-urlencoded' );
- $this->_request->set_header( 'User-Agent', $this->user_agent );
- $this->_request->set_header( 'Content-Length', $content_length );
- $this->_request->set_header( 'Cookie', $http_cookie );
- $this->_request->set_header( 'Referer', $referer );
-
- $req_header = "POST $uri HTTP/" . $this->http_version . HTTP_CRLF .
- $this->_request->serialize_headers() .
- HTTP_CRLF;
- fwrite( $this->_socket, $req_header );
- usleep( 10 );
- fwrite( $this->_socket, $this->_request->body );
-
- $this->_request->add_debug_info( $req_header );
- $this->_get_response();
-
- if ($this->_socket && !$this->_keep_alive) $this->disconnect();
- if ( $this->_response->get_header( 'Connection' ) != null ) {
- if ( $this->_keep_alive && strtolower( $this->_response->get_header( 'Connection' ) ) == 'close' ) {
- $this->_keep_alive = false;
- $this->disconnect();
- }
- }
-
- if ( $follow_redirects && ($this->_response->get_status() == HTTP_STATUS_MOVED_PERMANENTLY || $this->_response->get_status() == HTTP_STATUS_FOUND || $this->_response->get_status() == HTTP_STATUS_SEE_OTHER ) ) {
- if ( $this->_response->get_header( 'Location' ) != null ) {
- $this->_redirect( $this->_response->get_header( 'Location' ) );
- }
- }
-
- if ( $this->_response->get_status() == HTTP_STATUS_USE_PROXY ) {
- $location = $this->_parse_location( $this->_response->get_header( 'Location' ) );
- $this->disconnect();
- $this->use_proxy( $location['host'], $location['port'] );
- $this->post( $this->uri, $form_data, $referer );
- }
-
- return $this->_response->get_status();
- } // End of function post()
-
-
-
- function post_xml( $uri, $xml_data, $follow_redirects = true, $referer = '' ) {
- $this->uri = $uri;
-
- if ( ($this->_keep_alive && !$this->connected) || !$this->_keep_alive ) {
- if ( !$this->_connect() ) {
- $this->errstr = 'Could not connect to ' . $this->host;
- return -1;
- }
- }
- $http_cookie = $this->_response->cookies->get( $this->host, $this->_current_directory( $uri ) );
- $body = $xml_data;
- $this->_request->body = $body . HTTP_CRLF . HTTP_CRLF;
- $content_length = strlen( $body );
-
- if ($this->_use_proxy) {
- $this->_request->set_header( 'Host', $this->host . ':' . $this->port );
- $this->_request->set_header( 'Proxy-Connection', ($this->_keep_alive?'Keep-Alive':'Close') );
- if ( $this->_proxy_login != '' ) $this->_request->set_header( 'Proxy-Authorization', "Basic " . base64_encode( $this->_proxy_login . ":" . $this->_proxy_pwd ) );
- $uri = 'http://' . $this->host . ':' . $this->port . $uri;
- } else {
- $this->_request->set_header( 'Host', $this->host );
- $this->_request->set_header( 'Connection', ($this->_keep_alive?'Keep-Alive':'Close') );
- $this->_request->set_header( 'Pragma', 'no-cache' );
- $this->_request->set_header( 'Cache-Control', 'no-cache' );
- }
-
- if ( $this->_auth_login != '' ) $this->_request->set_header( 'Authorization', "Basic " . base64_encode( $this->_auth_login . ":" . $this->_auth_pwd ) );
- $this->_request->set_header( 'Accept', '*/*' );
- $this->_request->set_header( 'Content-Type', 'text/xml; charset=utf-8' );
- $this->_request->set_header( 'User-Agent', $this->user_agent );
- $this->_request->set_header( 'Content-Length', $content_length );
- $this->_request->set_header( 'Cookie', $http_cookie );
- $this->_request->set_header( 'Referer', $referer );
-
- $req_header = "POST $uri HTTP/" . $this->http_version . HTTP_CRLF .
- $this->_request->serialize_headers() .
- HTTP_CRLF;
-
- fwrite( $this->_socket, $req_header );
- usleep( 10 );
- fwrite( $this->_socket, $this->_request->body );
-
- $this->_request->add_debug_info( $req_header );
- $this->_get_response();
-
- if ($this->_socket && !$this->_keep_alive) $this->disconnect();
- if ( $this->_response->get_header( 'Connection' ) != null ) {
- if ( $this->_keep_alive && strtolower( $this->_response->get_header( 'Connection' ) ) == 'close' ) {
- $this->_keep_alive = false;
- $this->disconnect();
- }
- }
-
- if ( $follow_redirects && ($this->_response->get_status() == HTTP_STATUS_MOVED_PERMANENTLY || $this->_response->get_status() == HTTP_STATUS_FOUND || $this->_response->get_status() == HTTP_STATUS_SEE_OTHER ) ) {
- if ( $this->_response->get_header( 'Location' ) != null ) {
- $this->_redirect( $this->_response->get_header( 'Location' ) );
- }
- }
-
- if ( $this->_response->get_status() == HTTP_STATUS_USE_PROXY ) {
- $location = $this->_parse_location( $this->_response->get_header( 'Location' ) );
- $this->disconnect();
- $this->use_proxy( $location['host'], $location['port'] );
- $this->post( $this->uri, $form_data, $referer );
- }
-
- return $this->_response->get_status();
- } // End of function post_xml()
-
-
- function disconnect() {
- if ($this->_socket && $this->connected) {
- fclose($this->_socket);
- $this->connected = false;
- }
- } // End of function disconnect()
-
-
- /********************************************************************************
- * Private functions
- ********************************************************************************/
-
- function _connect( ) {
- if ( $this->host == '' ) user_error( 'Class HTTP->_connect() : host property not set !' , E_ERROR );
- if (!$this->_use_proxy)
- $this->_socket = fsockopen( $this->host, $this->port, $errno, $errstr, 10 );
- else
- $this->_socket = fsockopen( $this->_proxy_host, $this->_proxy_port, $errno, $errstr, 10 );
- $this->errstr = $errstr;
- $this->connected = ($this->_socket == true);
- return $this->connected;
- } // End of function connect()
-
-
- function _merge_multipart_form_data( $boundary, &$form_fields, &$form_files ) {
- $boundary = '--' . $boundary;
- $multipart_body = '';
-
- // 13/03/09, ajf06r - changed to explode array into separate form fields, rather than submitting the array itself
- foreach ( $form_fields as $name => $data) {
- if(!is_array($data)) {
- $multipart_body .= $boundary . HTTP_CRLF;
- $multipart_body .= 'Content-Disposition: form-data; name="' . $name . '"' . HTTP_CRLF;
- $multipart_body .= HTTP_CRLF;
- $multipart_body .= $data . HTTP_CRLF;
- }
- else {
- foreach ( $data as $subname => $subdata) {
- $multipart_body .= $boundary . HTTP_CRLF;
- $multipart_body .= 'Content-Disposition: form-data; name="' . $name . '"' . HTTP_CRLF;
- $multipart_body .= HTTP_CRLF;
- $multipart_body .= stripslashes($subdata) . HTTP_CRLF;
- }
- }
- }
- if ( isset($form_files) ) {
- foreach ( $form_files as $data) {
- $multipart_body .= $boundary . HTTP_CRLF;
- $multipart_body .= 'Content-Disposition: form-data; name="' . $data['name'] . '"; filename="' . $data['filename'] . '"' . HTTP_CRLF;
- if ($data['content-type']!='')
- $multipart_body .= 'Content-Type: ' . $data['content-type'] . HTTP_CRLF;
- else
- $multipart_body .= 'Content-Type: application/octet-stream' . HTTP_CRLF;
- $multipart_body .= HTTP_CRLF;
- $multipart_body .= $data['data'] . HTTP_CRLF;
- }
- }
- $multipart_body .= $boundary . '--' . HTTP_CRLF;
-
- return $multipart_body;
- } // End of function _merge_multipart_form_data()
-
-
- // 13/02/09, ajf06r - changed this function to return arrays in the format 'arrayname[]', rather than 'arrayname[i]'
- function _merge_form_data( &$param_array, $param_name = '' ) {
- $params = '';
- $format = ($param_name !=''?'&'.$param_name.'[]=%2$s':'&%s=%s');
- //$format = ($param_name !=''?'&'.$param_name.'[%s]=%s':'&%s=%s');
- foreach ( $param_array as $key=>$value ) {
- if ( !is_array( $value ) )
- $params .= sprintf( $format, $key, urlencode( $value ) );
- else
- $params .= $this->_merge_form_data( $param_array[$key], $key );
- }
-
- return $params;
-
- } // End of function _merge_form_data()
-
- function _current_directory( $uri ) {
- $tmp = split( '/', $uri );
- array_pop($tmp);
- $current_dir = implode( '/', $tmp ) . '/';
- return ($current_dir!=''?$current_dir:'/');
- } // End of function _current_directory()
-
- function _get_response( $get_body = true ) {
- $this->_response->reset();
- $this->_request->reset();
- $header = '';
- $body = '';
- $continue = true;
-
- while ($continue) {
- $header = '';
-
- // Read the Response Headers
- while ( (($line = fgets( $this->_socket, 4096 )) != HTTP_CRLF || $header == '') && !feof( $this->_socket ) ) {
- if ($line != HTTP_CRLF) $header .= $line;
- }
- $this->_response->deserialize_headers( $header );
- $this->_response->parse_cookies( $this->host );
-
- $this->_response->add_debug_info( $header );
- $continue = ($this->_response->get_status() == HTTP_STATUS_CONTINUE);
- if ($continue) fwrite( $this->_socket, HTTP_CRLF );
- }
-
- if ( !$get_body ) return;
-
- // Read the Response Body
- if ( strtolower( $this->_response->get_header( 'Transfer-Encoding' ) ) != 'chunked' && !$this->_keep_alive ) {
- while ( !feof( $this->_socket ) ) {
- $body .= stream_get_contents( $this->_socket, 4096 );
- }
- } else {
- if ( $this->_...
[truncated message content] |