SourceForge logo
SourceForge logo
Menu

phpwiki-checkins

From: Geoffrey T. D. <da...@us...> - 2001年11月09日 16:23:40
Update of /cvsroot/phpwiki/phpwiki/lib
In directory usw-pr-cvs1:/tmp/cvs-serv15069/lib
Modified Files:
	loadsave.php 
Log Message:
Encode leading '.' in filenames for both zip dumps and dumps to
directories. (See SF bug #478449).
Index: loadsave.php
===================================================================
RCS file: /cvsroot/phpwiki/phpwiki/lib/loadsave.php,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -r1.9 -r1.10
*** loadsave.php	2001年09月19日 02:58:00	1.9
--- loadsave.php	2001年11月09日 16:23:37	1.10
***************
*** 53,56 ****
--- 53,75 ----
 }
 
+ /***
+ * Compute filename to used for storing contents of a wiki page.
+ *
+ * Basically we do a rawurlencode() which encodes everything
+ * except ASCII alphanumerics and '.', '-', and '_'.
+ *
+ * But we also want to encode leading dots to avoid filenames
+ * like '.', and '..'. (Also, there's no point in generating
+ * "hidden" file names, like '.foo'.)
+ *
+ * @param $pagename string Pagename.
+ * @return string Filename for page.
+ */
+ function FilenameForPage ($pagename)
+ {
+ $enc = rawurlencode($pagename);
+ return preg_replace('/^\./', '%2e', $enc);
+ }
+ 
 /**
 * The main() function which generates a zip archive of a PhpWiki.
***************
*** 94,98 ****
 $content = MailifyPage($page);
 		 
! $zip->addRegularFile( rawurlencode($page->getName()),
 $content, $attrib);
 }
--- 113,117 ----
 $content = MailifyPage($page);
 		 
! $zip->addRegularFile( FilenameForPage($page->getName()),
 $content, $attrib);
 }
***************
*** 123,127 ****
 
 $enc_name = htmlspecialchars($page->getName());
! $filename = rawurlencode($page->getName());
 
 echo "<br>$enc_name ... ";
--- 142,146 ----
 
 $enc_name = htmlspecialchars($page->getName());
! $filename = FilenameForPage($page->getName());
 
 echo "<br>$enc_name ... ";
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.
Thanks for helping keep SourceForge clean.
X





Briefly describe the problem (required):
Upload screenshot of ad (required):
Select a file, or drag & drop file here.
Screenshot instructions:

Click URL instructions:
Right-click on the ad, choose "Copy Link", then paste here →
(This may not be possible with some types of ads)

More information about our ad policies

Ad destination/click URL:

AltStyle によって変換されたページ (->オリジナル) /