From: Reini U. <ru...@us...> - 2004-02-27 01:45:28
|
Update of /cvsroot/phpwiki/phpwiki/lib/plugin In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22533/plugin Modified Files: UpLoad.php Log Message: autolink enabled Index: UpLoad.php =================================================================== RCS file: /cvsroot/phpwiki/phpwiki/lib/plugin/UpLoad.php,v retrieving revision 1.5 retrieving revision 1.6 diff -u -2 -b -p -d -r1.5 -r1.6 --- UpLoad.php 27 Feb 2004 01:24:43 -0000 1.5 +++ UpLoad.php 27 Feb 2004 01:36:51 -0000 1.6 @@ -120,9 +120,11 @@ extends WikiPlugin $message->pushContent(_("Sorry but this file is too big"),HTML::br(),HTML::br()); } - elseif (move_uploaded_file($userfile_tmpname, $file_dir . $userfile_name)) { + elseif (move_uploaded_file($userfile_tmpname, $file_dir . $userfile_name) or + (IsWindows() and rename($userfile_tmpname, $file_dir . $userfile_name)) + ) { $interwiki = new PageType_interwikimap(); $link = $interwiki->link("Upload:$userfile_name"); - $message->pushContent(_("File successfully uploaded to location: "), - HTML::br()); + $message->pushContent(_("File successfully uploaded.")); + $message->pushContent(HTML::ul(HTML::li($link))); // the upload was a success and we need to mark this event in the "upload log" @@ -132,22 +134,15 @@ extends WikiPlugin } if ($autolink) { - $pagehandle = $dbi->getPage($page); - } - } - elseif (IsWindows()) { - rename($userfile_tmpname, $file_dir . $userfile_name); - $interwiki = new PageType_interwikimap(); - $link = $interwiki->link("Upload:$userfile_name"); - $message->pushContent(_("File quirkfully uploaded to location: "), - $link,HTML::br()); - // the upload was a success and we need to mark this event in the "upload log" - $upload_log = $file_dir . basename($logfile); - if ($logfile) { - $this->log($userfile, $upload_log, &$message); - } - if ($autolink) { require_once("lib/loadsave.php"); $pagehandle = $dbi->getPage($page); - //todo... append "\n* Upload:$userfile_name" + if ($pagehandle->exists()) {// don't replace default contents + $current = $pagehandle->getCurrentRevision(); + $version = $current->getVersion(); + $text = $current->getPackedContent(); + $newtext = $text . "\n* Upload:$userfile_name"; + $meta = $current->_data; + $meta['summary'] = sprintf(_("uploaded %s"),$userfile_name); + $pagehandle->save($newtext, $version + 1, $meta); + } } } @@ -183,7 +178,8 @@ extends WikiPlugin $file_size = "< 0.1"; } + $userfile_name = $userfile->getName(); fwrite($log_handle, "\n" - . "<tr><td><a href=$userfile_name>$userfile_name</a></td>" + . "<tr><td><a href=\"$userfile_name\">$userfile_name</a></td>" . "<td align=\"right\">$file_size kB</td>" . "<td> " . $Theme->formatDate(time()) . "</td>" @@ -206,4 +202,7 @@ extends WikiPlugin // $Log$ +// Revision 1.6 2004/02/27 01:36:51 rurban +// autolink enabled +// // Revision 1.5 2004/02/27 01:24:43 rurban // use IntwerWiki links for uploaded file. |