wiki.techinc.nl/includes/ExternalEdit.php
Alexandre Emsenhuber 087a9f70c5 WARNING: HUGE COMMIT
Doxygen documentation update:
* Changed alls @addtogroup to @ingroup. @addtogroup adds the comment to the group description, but doesn't add the file, class, function, ... to the group like @ingroup does. See for example http://svn.wikimedia.org/doc/group__SpecialPage.html where it's impossible to see related files, classes, ... that should belong to that group.
* Added @file to file description, it seems that it should be explicitely decalred for file descriptions, otherwise doxygen will think that the comment document the first class, variabled, function, ... that is in that file.
* Removed some empty comments
* Removed some ?>

Added following groups:
* ExternalStorage
* JobQueue
* MaintenanceLanguage

One more thing: there are still a lot of warnings when generating the doc.
2008-05-20 17:13:28 +00:00

68 lines
1.9 KiB
PHP

<?php
/**
* License: Public domain
*
* @author Erik Moeller <moeller@scireview.de>
*/
/**
* Support for external editors to modify both text and files
* in external applications. It works as follows: MediaWiki
* sends a meta-file with the MIME type 'application/x-external-editor'
* to the client. The user has to associate that MIME type with
* a helper application (a reference implementation in Perl
* can be found in extensions/ee), which will launch the editor,
* and save the modified data back to the server.
*
*/
class ExternalEdit {
function __construct( $article, $mode ) {
global $wgInputEncoding;
$this->mArticle =& $article;
$this->mTitle =& $article->mTitle;
$this->mCharset = $wgInputEncoding;
$this->mMode = $mode;
}
function edit() {
global $wgOut, $wgScript, $wgScriptPath, $wgServer, $wgLang;
$wgOut->disable();
$name=$this->mTitle->getText();
$pos=strrpos($name,".")+1;
header ( "Content-type: application/x-external-editor; charset=".$this->mCharset );
header( "Cache-control: no-cache" );
# $type can be "Edit text", "Edit file" or "Diff text" at the moment
# See the protocol specifications at [[m:Help:External editors/Tech]] for
# details.
if(!isset($this->mMode)) {
$type="Edit text";
$url=$this->mTitle->getFullURL("action=edit&internaledit=true");
# *.wiki file extension is used by some editors for syntax
# highlighting, so we follow that convention
$extension="wiki";
} elseif($this->mMode=="file") {
$type="Edit file";
$image = wfLocalFile( $this->mTitle );
$url = $image->getFullURL();
$extension=substr($name, $pos);
}
$special=$wgLang->getNsText(NS_SPECIAL);
$control = <<<CONTROL
[Process]
Type=$type
Engine=MediaWiki
Script={$wgServer}{$wgScript}
Server={$wgServer}
Path={$wgScriptPath}
Special namespace=$special
[File]
Extension=$extension
URL=$url
CONTROL;
echo $control;
}
}