Skip to content

Commit

Permalink
Changes to use a new configuration variable: CFG->slasharguments
Browse files Browse the repository at this point in the history
If true, then display of user pictures or filenames will use the
method of providing arguments as "slash" arguments - this is much
better for caching, proxies, search engines etc.  Unfortunately
it doesn't seem to work on some PHP installations.

If false (the default), then a more compatible method is used
(ie usual way of passing parameters to scripts)
  • Loading branch information
martin committed Aug 26, 2002
1 parent ef4743b commit 3f8247c
Show file tree
Hide file tree
Showing 7 changed files with 168 additions and 8 deletions.
135 changes: 135 additions & 0 deletions CHANGES
Original file line number Diff line number Diff line change
@@ -1,3 +1,138 @@
2002-08-22 Thursday 16:31 martin

* lib/weblib.php:

New space-removal works better if done before adding link tags :-)

2002-08-22 Thursday 16:01 martin

* mod/forum/lib.php:

If a post is updated that is also a discussion definition, then the
discussion name is updated with the post subject.

2002-08-22 Thursday 15:53 martin

* lib/weblib.php:

Experimental filters to remove returns from before and after tags,
which should mean neater formatting of lists and so on. Needs
testing.

2002-08-22 Thursday 14:41 martin

* admin/: index.php, user.php:

Tweaks to creation of user account while searching for the login
problem some people are having ...

2002-08-22 Thursday 14:40 martin

* lib/db/mysql.sql:

Added recent upgrades (course->guest, and user->maildisplay)

2002-08-22 Thursday 10:24 martin

* doc/install.html, lang/en/moodle.php, login/index_form.html:

Notes about the necessity of cookies being allowed

2002-08-22 Thursday 10:23 martin

* course/teacher.php:

Handy link to course page, after assigning teachers

2002-08-22 Thursday 09:24 martin

* index.php:

Whoops! comment out of place

2002-08-21 Wednesday 22:08 martin

* index.php, lib/moodlelib.php:

Just some comments about not removing the Moodle logo from the
front page.

2002-08-21 Wednesday 21:55 martin

* lib/moodlelib.php:

Fixed dates when no-one is logged in (uses server time now, not
GMT)

2002-08-21 Wednesday 21:29 martin

* version.php, lang/en/moodle.php, user/edit.html, user/lib.php,
user/view.php:

Users can now choose to hide their email address. In this initial
version there are three options:

0) Hide the email address from everyone (except the teacher of
their course) 1) Allow everyone to see the email address, all the
time. 2) Allow only participants in the same course to see the
email address

Note, new field maildisplay in 'user'

2002-08-21 Wednesday 20:54 martin

* version.php, course/edit.html, lang/en/moodle.php,
lang/en/help/enrolmentkey.html, lang/en/help/guestaccess.html,
lib/moodlelib.php:

Fixed up guest access PROPERLY - it's now more obvious and simple
for teachers to set it how they want. Guest access now has THREE
states (off, on, on with key).

2002-08-21 Wednesday 19:11 martin

* lang/en/help/: enrolmentkey.html, guestaccess.html:

Improved explanations

2002-08-21 Wednesday 18:56 martin

* lang/en/help/: enrolmentkey.html, guestaccess.html:

Clarified the documentation here

2002-08-21 Wednesday 10:05 martin

* doc/install.html:

Anchor name fix

2002-08-21 Wednesday 09:57 martin

* doc/install.html:

Improvements to install documentation

2002-08-20 Tuesday 17:39 martin

* admin/cron.php:

Bugfix for unenrolling old users

2002-08-20 Tuesday 10:15 martin

* doc/developer.html:

Slight formatting fix on list

2002-08-19 Monday 22:53 martin

* CHANGES:



Moodle 1.0 is released! :-)

2002-08-19 Monday 21:25 martin

* doc/: contents.html, developer.html, licence.html:
Expand Down
10 changes: 10 additions & 0 deletions config-dist.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,16 @@
$CFG->unzip = "/usr/bin/unzip";


// Files (images, uploads etc) are provided via a script which
// is called like this example: file.php/1/myfiles/mymusic.mp3
// Using this form of argument allows files to be more easily
// cached in web browsers, proxy servers etc, but they don't
// work in all PHP servers. If you have trouble viewing
// uploaded files or images, then set the following to false

$CFG->slasharguments = true;


// You should not need to change anything else. To continue setting up
// Moodle, use your web browser to go to the moodle/admin web page.
///////////////////////////////////////////////////////////////////////////
Expand Down
6 changes: 5 additions & 1 deletion file.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,12 @@

$lifetime = 86400;

if (isset($file)) { // workaround for situations where / syntax doesn't work
$PATH_INFO = $file;
}

if (!$PATH_INFO) {
error("This script DEPENDS on $PATH_INFO being available. Read the README.");
error("This script DEPENDS on PATH_INFO being available. Read the README.");
}

$args = get_slash_arguments();
Expand Down
9 changes: 7 additions & 2 deletions files/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -573,11 +573,16 @@ function displaydir ($wdir) {

print_cell("center", "<INPUT TYPE=checkbox NAME=\"file$count\" VALUE=\"$fileurl\">");
echo "<TD ALIGN=left NOWRAP>";
link_to_popup_window ("/file.php/$id$fileurl", "display",
if ($CFG->slasharguments) {
$ffurl = "/file.php/$id$fileurl";
} else {
$ffurl = "/file.php?file=/$id$fileurl";
}
link_to_popup_window ($ffurl, "display",
"<IMG SRC=\"pix/$icon\" HEIGHT=16 WIDTH=16 BORDER=0 ALT=\"File\">",
480, 640);
echo "<FONT SIZE=\"-1\" FACE=\"Arial, Helvetica\">";
link_to_popup_window ("/file.php/$id$fileurl", "display",
link_to_popup_window ($ffurl, "display",
htmlspecialchars($file),
480, 640);
echo "</FONT></TD>";
Expand Down
2 changes: 1 addition & 1 deletion index.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
true, $headerbutton);


$side = 190;
$side = 180;


?>
Expand Down
6 changes: 3 additions & 3 deletions lib/moodlelib.php
Original file line number Diff line number Diff line change
Expand Up @@ -161,10 +161,10 @@ function print_user_picture($userid, $courseid, $picture, $large=false, $returns
$size = 35;
}
if ($picture) {
if (iswindows()) { // Workaround for a PATH_INFO problem on Windows PHP
$output .= "<IMG SRC=\"$CFG->wwwroot/user/pix.php?file=/$userid/$file\" BORDER=0 WIDTH=$size HEIGHT=$size ALT=\"\">";
} else { // Use this method if possible for better caching
if ($CFG->slasharguments) { // Use this method if possible for better caching
$output .= "<IMG SRC=\"$CFG->wwwroot/user/pix.php/$userid/$file\" BORDER=0 WIDTH=$size HEIGHT=$size ALT=\"\">";
} else {
$output .= "<IMG SRC=\"$CFG->wwwroot/user/pix.php?file=/$userid/$file\" BORDER=0 WIDTH=$size HEIGHT=$size ALT=\"\">";
}
} else {
$output .= "<IMG SRC=\"$CFG->wwwroot/user/default/$file\" BORDER=0 WIDTH=$size HEIGHT=$size ALT=\"\">";
Expand Down
8 changes: 7 additions & 1 deletion mod/assignment/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -318,8 +318,14 @@ function assignment_print_user_files($assignment, $user) {
if ($files = get_directory_list($basedir)) {
foreach ($files as $file) {
$icon = mimeinfo("icon", $file);
if ($CFG->slasharguments) {
$ffurl = "file.php/$filearea/$file";
} else {
$ffurl = "file.php?file=/$filearea/$file";
}

echo "<IMG SRC=\"$CFG->wwwroot/files/pix/$icon\" HEIGHT=16 WIDTH=16 BORDER=0 ALT=\"File\">";
echo "&nbsp;<A TARGET=\"uploadedfile\" HREF=\"$CFG->wwwroot/file.php/$filearea/$file\">$file</A>";
echo "&nbsp;<A TARGET=\"uploadedfile\" HREF=\"$CFG->wwwroot/$ffurl\">$file</A>";
echo "<BR>";
}
}
Expand Down

0 comments on commit 3f8247c

Please sign in to comment.