# HG changeset patch # User Reimar Bauer # Date 1256933017 -3600 # Node ID ca71ebe6af6df36ec65f9028f8171565b1e00928 # Parent a94fb46ff1287bd1c59ecb2dc60b89942af1dca8 anywikidraw: Version 0.14 added diff -r a94fb46ff128 -r ca71ebe6af6d MoinMoin/web/static/htdocs/applets/anywikidraw/lib/AnyWikiDrawForMoinMoin.jar Binary file MoinMoin/web/static/htdocs/applets/anywikidraw/lib/AnyWikiDrawForMoinMoin.jar has changed diff -r a94fb46ff128 -r ca71ebe6af6d contrib/AnyWikiDraw/anywikidraw/anywikidraw-0.14-for-twiki-4.1.zip Binary file contrib/AnyWikiDraw/anywikidraw/anywikidraw-0.14-for-twiki-4.1.zip has changed diff -r a94fb46ff128 -r ca71ebe6af6d contrib/AnyWikiDraw/anywikidraw/anywikidraw-0.14-for-twiki-4.3.zip Binary file contrib/AnyWikiDraw/anywikidraw/anywikidraw-0.14-for-twiki-4.3.zip has changed diff -r a94fb46ff128 -r ca71ebe6af6d contrib/AnyWikiDraw/anywikidraw/mediawiki 1.12 to 1.15/extensions/AnyWikiDraw/AnyWikiDraw.body.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/contrib/AnyWikiDraw/anywikidraw/mediawiki 1.12 to 1.15/extensions/AnyWikiDraw/AnyWikiDraw.body.php Fri Oct 30 21:03:37 2009 +0100 @@ -0,0 +1,288 @@ +mUploadDescription = ''; + $this->mLicense = ''; + $this->mUploadCopyStatus = ''; + $this->mUploadSource = ''; + $this->mWatchthis = false; + } + + function execute( $par ) { + global $wgRequest, $wgOut; + + if ($wgRequest->wasPosted()) { + $this->processUpload(); + + } else if (strlen($wgRequest->getVal("image","")) > 0) { + $this->processDownload(); + } else { + $this->setHeaders(); + + # Get request data from, e.g. + # $param = $wgRequest->getText('param'); + $hasErrors = false; + + # Check uploading enabled + global $wgEnableUploads, $wgSitename; + if( !$wgEnableUploads ) { + $hasErrors = true; + $wgOut->addWikiText( + wfMsg('anywikidraw_upload_disabled', $wgSitename) + ); + } + + # Check cookies available to Java + global $wgCookieHttpOnly; + if( $wgCookieHttpOnly ) { + $hasErrors = true; + $wgOut->addWikiText( + wfMsg('anywikidraw_cookie_http_only', $wgSitename) + ); + } + + + # Check file extensions enabled + global $wgFileExtensions; + $requiredExtensions = array("svg",/*"svgz",*/"png","jpg"); + $missingExtensions = array(); + foreach ($requiredExtensions as $ext) { + if (! in_array($ext, $wgFileExtensions)) { + $missingExtensions[] = $ext; + } + } + if (count($missingExtensions) == 1) { + $hasErrors = true; + $wgOut->addWikiText( + wfMsg('anywikidraw_extension_disabled', $wgSitename, ".".implode(", .", $missingExtensions) ) + ); + } else if (count($missingExtensions) > 1) { + $hasErrors = true; + $wgOut->addWikiText( + wfMsg('anywikidraw_extensions_disabled', $wgSitename, ".".implode(", .", $missingExtensions) ) + ); + } + + # Show information about AnyWikiDraw + if (! $hasErrors) { + global $wgAnyWikiDrawVersion; + $wgOut->addWikiText( + wfMsg('anywikidraw_about', AnyWikiDraw::$version) + ); + } + // Output + // $wgOut->addHTML( $output ); + } + } + + function processUpload() { + global $wgRequest, $wgOut; + + // Fill in the form data as needed by the upload form + $wgRequest->data['wpDestFile'] = $wgRequest->data['DrawingName']; + $wgRequest->data['wpIgnoreWarning'] = '1'; + $wgRequest->data['wpDestFileWarningAck'] ='1'; + $wgRequest->data['wpUploadDescription'] = $wgRequest->data['UploadSummary']; + $wgRequest->data['wpUploadFile'] = $wgRequest->data['DrawingData']; + $_FILES['wpUploadFile'] = $_FILES['DrawingData']; + $wgRequest->data['action'] = $wgRequest->data['Action']; + + // Upload the drawing + $form = new UploadForm($wgRequest); + $details = null; + $outcome = $form->internalProcessUpload($details); + + + $drawingTempFile = $wgRequest->getFileTempName('DrawingData'); + $renderedTempFile = $wgRequest->getFileTempName('RenderedImageData'); + $imageMapTempFile = $wgRequest->getFileTempName('ImageMapData'); + + // If we were successful so far, look whether a rendered image of the + // drawing has been uploaded as well. + if ($outcome == UploadForm::SUCCESS && $renderedTempFile != null) { + + $img = $form->mLocalFile; + $thumbDir = $img->getThumbPath(); + $params = array( 'width' => $img->getWidth() ); + $thumbName = $img->thumbName($params); + + if ($thumbName) { + // Look at the contents of the file; if we can recognize the + // type but it's corrupt or data of the wrong type, we should + // probably not accept it. + $veri = $form->verify( $renderedTempFile, 'png' ); + if ($veri) { + // Provide an opportunity for extensions to add further checks + $error = ''; + if( !wfRunHooks( 'UploadVerification', + array( $thumbName, $renderedTempFile, &$error ) ) ) { + + $veri = false; + } + } + + + if ($veri) { + if (!file_exists($thumbDir)) { + $thumbDirExists = wfMkdirParents($thumbDir); + } else { + $thumbDirExists = true; + } + if ($thumbDirExists) { + move_uploaded_file($renderedTempFile, $thumbDir.'/'.$thumbName); + } + } + } + } + + // Get rid of uploaded files + if (file_exists($drawingTempFile)) { unlink($drawingTempFile); } + if (file_exists($renderedTempFile)) { unlink($renderedTempFile); } + if (file_exists($imageMapTempFile)) { unlink($imageMapTempFile); } + + + // Return outcome along with an appropriate error message to the client + switch ($outcome) { + case UploadForm::SUCCESS : + header('HTTP/1.0 200 OK'); + echo('Success.'); + break; + + case UploadForm::BEFORE_PROCESSING : + header('HTTP/1.0 500 Internal Server Error'); + echo('Hook UploadForm:BeforeProcessing broke processing the file.'); + break; + + case UploadForm::LARGE_FILE_SERVER : + header('HTTP/1.0 500 Internal Server Error'); + echo(''.wfMsgHtml( 'largefileserver' ).''); + break; + + case UploadForm::EMPTY_FILE : + header('HTTP/1.0 400 Bad Request'); + echo(''.wfMsgHtml( 'emptyfile' ).''); + break; + + case UploadForm::MIN_LENGTH_PARTNAME : + header('HTTP/1.0 400 Bad Request'); + echo(''.wfMsgHtml( 'minlength1' ).''); + break; + + case UploadForm::ILLEGAL_FILENAME : + header('HTTP/1.0 400 Bad Request'); + echo(''.wfMsgHtml( 'illegalfilename', htmlspecialchars($wgRequest->data('DrawingName'))).''); + break; + + case UploadForm::PROTECTED_PAGE : + header('HTTP/1.0 403 Forbidden'); + echo(''); + echo('

You are not allowed to change this drawing:

'); + $this->echoDetails($details['permissionserrors']); + echo(''); + break; + + case UploadForm::OVERWRITE_EXISTING_FILE : + header('HTTP/1.0 403 Forbidden'); + echo('You may not overwrite the existing drawing.'); + break; + + case UploadForm::FILETYPE_MISSING : + header('HTTP/1.0 400 Bad Request'); + echo('The type of the uploaded file is not explicitly allowed.'); + break; + + case UploadForm::FILETYPE_BADTYPE : + header('HTTP/1.0 400 Bad Request'); + echo('The type of the uploaded file is explicitly disallowed.'); + break; + + case UploadForm::VERIFICATION_ERROR : + header('HTTP/1.0 400 Bad Request'); + echo(''); + echo('

The uploaded file did not pass server verification.

'); + echo(''); + break; + + case UploadForm::UPLOAD_VERIFICATION_ERROR : + header('HTTP/1.0 403 Bad Request'); + echo(''); + echo('

The uploaded file did not pass server verification:

'); + $this->echoDetails($details['error']); + echo(''); + break; + + case UploadForm::UPLOAD_WARNING : + header('HTTP/1.0 400 Bad Request'); + echo(''); + echo('

The server issued a warning for this file:

'); + $this->echoDetails($details['warning']); + echo(''); + break; + + case UploadForm::INTERNAL_ERROR : + header('HTTP/1.0 500 Internal Server Error'); + echo(''); + echo('

Function UploadForm:internalProcessUpload encountered an internal error.

'); + echo('

'.$details['internal'].'

'); + echo(''); + break; + + default : + header('HTTP/1.0 500 Internal Server Error'); + echo('Function UploadForm:internalProcessUpload returned an unknown code: '.$outcome.'.'); + break; + } + exit(); + } + + function echoDetails($msg) { + if (is_array($msg)) { + foreach ($msg as $submsg) { + $this->echoDetails($submsg); + } + } else { + echo('

'.$msg.'

'); + } + } +} +?> \ No newline at end of file diff -r a94fb46ff128 -r ca71ebe6af6d contrib/AnyWikiDraw/anywikidraw/mediawiki 1.12 to 1.15/extensions/AnyWikiDraw/AnyWikiDraw.i18n.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/contrib/AnyWikiDraw/anywikidraw/mediawiki 1.12 to 1.15/extensions/AnyWikiDraw/AnyWikiDraw.i18n.php Fri Oct 30 21:03:37 2009 +0100 @@ -0,0 +1,48 @@ + 'AnyWikiDraw Drawing Extension', + 'anywikidraw_about' => '

On this Wiki the AnyWikiDraw $1 Drawing Extension is installed.

'. + '

With this extension, you can edit drawings directly inside of a Wiki page.

'. + '

To include a drawing in a page, use a tag of the form '. + '{{#drawing:File.svg|width|height}}.

'. + '

For example '. + '{{#drawing:HappyFace.svg|400|300}}.

'. + '

The following filename extensions are supported: .svg, .png, .jpg.

'. + '

If the file doesn\'t exist, it will be created the first time a drawing has been edited.

'. + '

All files that have been created using this extension are listed on the [[Special:Imagelist|file list]] special page.', + 'anywikidraw_license_terms_new_work' => 'By saving your work you agree to the license terms of this Wiki. '. + '
For more information see $1. ', + 'anywikidraw_license_terms_derived_work' => 'By saving your changes you agree to the terms given by the copyright holder of the original work. '. + '
For more information see $2. ', + 'anywikidraw_upload_disabled' => '

You can not edit drawings using AnyWikiDraw, because you have not enabled file uploading using $wgEnableUploads=true; in LocalSettings.php.

', + 'anywikidraw_cookie_http_only' => '

You can not edit drawings using AnyWikiDraw, because you have not made cookies accessible to Java applets using $wgCookieHttpOnly=false; in LocalSettings.php.

', + 'anywikidraw_extension_disabled' => '

You can not edit drawings with extension $2 using AnyWikiDraw, because you have not enabled this extension using $wgFileExtensions[] = \'$2\'; in LocalSettings.php.

', + 'anywikidraw_extensions_blacklisted' => '

You can not edit drawings with extensions $2 using AnyWikiDraw, because you have explicitly blocked this extension using $wgFileBlacklist = \'$2\'; in LocalSettings.php.

', +); +?> \ No newline at end of file diff -r a94fb46ff128 -r ca71ebe6af6d contrib/AnyWikiDraw/anywikidraw/mediawiki 1.12 to 1.15/extensions/AnyWikiDraw/AnyWikiDraw.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/contrib/AnyWikiDraw/anywikidraw/mediawiki 1.12 to 1.15/extensions/AnyWikiDraw/AnyWikiDraw.php Fri Oct 30 21:03:37 2009 +0100 @@ -0,0 +1,291 @@ + $langMessages ) { + $wgMessageCache->addMessages( $langMessages, $lang ); + } + + # Setup extension credits + $wgExtensionCredits['parserhook'][] = array( + 'name' => 'AnyWikiDraw', + 'version' => $wgAnyWikiDrawVersion, + 'author' =>'Werner Randelshofer', + 'url' => 'http://sourceforge.net/projects/anywikidraw', + 'description' => 'The AnyWikiDraw extensions adds a {{#drawing:}} tag to the MediaWiki parser which allows to edit SVG, PNG and JPEG images directly in a page using a Java applet.' + ); + + # Setup function hook associating the "drawing" magic word with our function + global $wgParser; + $wgParser->setFunctionHook( 'drawing', 'efAnyWikiDrawParserFunction_Render' ); + +} + +function efAnyWikiDrawParserFunction_Magic( &$magicWords, $langCode ) { + # Add the magic word + # The first array element is case sensitive, in this case it is not case sensitive + # All remaining elements are synonyms for our parser function + $magicWords['drawing'] = array( 0, 'drawing' ); + # unless we return true, other parser functions extensions won't get loaded. + return true; +} + +function efAnyWikiDrawParserFunction_Render( &$parser, $name = null, $width = null, $height = null ) { + global $wgUser, $wgLang, $wgTitle, $wgRightsText, $wgOut, $wgArticlePath, $wgScriptPath, $wgEnableUploads; + $skin = $wgUser->getSkin(); + + // Don't cache pages with drawings on it + $parser->disableCache(); + + # Validate parameters + $error = ''; + if ($name == null || strlen($name) == 0) { + $error .= '
Please specify a name for your drawing.'; + } + if ($width != null && + (! is_numeric($width) || $width < 1 || $width > 2000)) { + $error .= '
Please specify the width as a number between 1 and 2000 or leave it away.'; + } + if ($height != null && + (! is_numeric($height) || $height < 1 || $height > 2000)) { + $error .= '
Please specify the height as a number between 1 and 2000 or leave it away.'; + } + if (strlen($error) > 0) { + $error = 'Sorry.'.$error.'
'. + 'Usage: {{#drawing:image.svg|width||height}}
'. + 'Example: {{#drawing:HappyDrawing.svg|400|300}}
'; + return array($error, 'isHTML'=>true, 'noparse'=>true); + } + + # The parser function itself + # The input parameters are wikitext with templates expanded + # The output should be wikitext too, but in this case, it is HTML + #return array("param1 is $param1 and param2 is $param2", 'isHTML'); + + # Generate the image HTML as if viewed by a web request + $image = wfFindFile($name); + + + $isProtected = $parser->getTitle()->isProtected(); + + if ($width == null && $image != null && $image->getWidth() != -1) { + $width = $image->getWidth(); + } + if ($height == null && $image != null && $image->getHeight() != -1) { + $height = $image->getHeight(); + } + + // render a header + $output = '
'; + if ($wgEnableUploads && ! $isProtected && + key_exists('drawingtitle', $_POST) && + $_POST['drawingtitle'] == $name) { + + // edit the drawing using the applet + $uploadURL = str_replace('$1', 'Special:AnyWikiDraw', $wgArticlePath); + $output .= + ''. + ''. + + // The following parameters are used to tell AnyWikiDraw how to communicate with MediaWiki: + + //''. + ''. + ''. + ''. + (($image !== false) ? '' : ''). + ''. + ''. + + // The following parameters are used to configure the drawing applet: + + ''. + + // The following parameters are used to configure Sun's Java Plug-In: + + ''. + ''. + ''. + ''. + ''. + ''. + + ''. + '' + ; + + $output .= '
'. + wfMsg(($image === false) ? 'anywikidraw_license_terms_new_work' : 'anywikidraw_license_terms_derived_work', + ''.wfMsg('copyrightpage').'', 'Image:'.$name.''). + '
'; + } else { + // Retrieve the page object of the image to determine, whether the user may edit it + $filtered = preg_replace ( "/[^".Title::legalChars()."]|:/", '-', $name ); + $nt = Title::newFromText( $filtered ); + if(! is_null( $nt ) ) { + $nt =& Title::makeTitle( NS_IMAGE, $nt->getDBkey() ); + } + + // Determine if the user has permission to edit the image + $userCanEdit = $wgEnableUploads && + !$isProtected && + (is_null($nt) || $nt->userCanEdit()) && + (is_null($image) || $wgUser->isAllowed( 'reupload' )); + /*$output .= 'enableUploads='.$wgEnableUploads.','. + 'isProtected='.$isProtected.','. + 'page.userCanEdit='.(is_null($nt) ? 'null' : $nt->userCanEdit()).','. + 'image.exists='.$image->exists().','. + 'user.reupload allowed='.$wgUser->isAllowed( 'reupload' ); + */ + + // Determine if the user may edit images using the specified + // filename extension. + if ($userCanEdit) { + $extension = array_pop(explode( '.', $filtered )); + global $wgFileExtensions; + $userCanEdit = in_array($extension, $wgFileExtensions); + } + + + // If the user can edit the image, display an edit link. + // We do not display the edit link, if the user is already + // editing a drawing. + if ($userCanEdit && ! key_exists('drawingtitle', $_POST)) { + $formId = 'Form'.rand(); + global $wgUsePathInfo; + if ($wgUsePathInfo) { + $action = $wgTitle->getLocalURL().'#anywikidraw'; + } else { + //$action = str_replace('?','#anywikidraw?',$wgTitle->getLocalURL()); + $action = $wgTitle->getLocalURL(); + } + $output .= '
'. + ''. + '

'. + '['.wfMsg('edit').']'. + ''. + '

' + ; + } + // render the drawing + if ($image === false) { + // the drawing does not exist yet, render an empty rectangle + $output .= '
'.htmlspecialchars($name).'
'; + } else { + // Render an img tag + // Render the image map, if it exists + $thumbnail = $image->getThumbnail($width); + $isImageMap = $thumbnail != null && file_exists($thumbnail->path.'.map'); + $mapId = 'Map_'.$name.'_'.rand(); + if ($isImageMap) { + $output .= ''. + file_get_contents($thumbnail->path.'.map'). + ''; + } + // Render the image + if (! $isImageMap) { + $output .= ''; + } + // Note: We append the timestamp of the image to the + // view URL as a query string. This way, we ensure, + // that the browser always displays the last edited version + // of the image + $output .= ''; + if (! $isImageMap) { + $output .= ''; + } + } + // If the user can edit the image, display an edit link. + // We do not display the edit link, if the user is already + // editing a drawing. + if ($userCanEdit && ! key_exists('drawingtitle', $_POST)) { + $output .= '
'; + } + } + + // render a footer + $output .= '
'; + + return array($output, 'isHTML'=>true, 'noparse'=>true); +} +?> \ No newline at end of file diff -r a94fb46ff128 -r ca71ebe6af6d contrib/AnyWikiDraw/anywikidraw/mediawiki 1.12 to 1.15/extensions/AnyWikiDraw/AnyWikiDrawForMediaWiki.jar Binary file contrib/AnyWikiDraw/anywikidraw/mediawiki 1.12 to 1.15/extensions/AnyWikiDraw/AnyWikiDrawForMediaWiki.jar has changed diff -r a94fb46ff128 -r ca71ebe6af6d contrib/AnyWikiDraw/anywikidraw/mediawiki 1.12 to 1.15/extensions/AnyWikiDraw/AnyWikiDrawForMediaWiki.jar.pack.gz Binary file contrib/AnyWikiDraw/anywikidraw/mediawiki 1.12 to 1.15/extensions/AnyWikiDraw/AnyWikiDrawForMediaWiki.jar.pack.gz has changed diff -r a94fb46ff128 -r ca71ebe6af6d contrib/AnyWikiDraw/anywikidraw/mediawiki 1.7 to 1.10/extensions/AnyWikiDraw/AnyWikiDraw.i18n.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/contrib/AnyWikiDraw/anywikidraw/mediawiki 1.7 to 1.10/extensions/AnyWikiDraw/AnyWikiDraw.i18n.php Fri Oct 30 21:03:37 2009 +0100 @@ -0,0 +1,47 @@ + 'AnyWikiDraw Drawing Extension', + 'anywikidraw_about' => '

On this Wiki the AnyWikiDraw Drawing Extension $1 is installed.

'. + '

With this extension, you can edit drawings directly inside of a Wiki page.

'. + '

To include a drawing in a page, use a tag of the form '. + '{{#drawing:File.svg|width|height}}.

'. + '

For example '. + '{{#drawing:HappyFace.svg|400|300}}.

'. + '

The following filename extensions are supported: .svg, .png, .jpg.

'. + '

If the file doesn\'t exist, it will be created the first time a drawing has been edited.

'. + '

All files that have been created using this extension are listed on the [[Special:Imagelist|file list]] special page.', + 'anywikidraw_license_terms_new_work' => 'By saving your work you agree to the license terms of this Wiki. '. + '
For more information see $1. ', + 'anywikidraw_license_terms_derived_work' => 'By saving your changes you agree to the terms given by the copyright holder of the original work. '. + '
For more information see $2. ', + 'anywikidraw_upload_disabled' => '

You can not edit drawings using AnyWikiDraw, because File uploads are disabled on $1.

', + 'anywikidraw_extension_disabled' => '

You can not edit drawings with extension $2 using AnyWikiDraw, because this extension is disabled on $1.

', + 'anywikidraw_extensions_disabled' => '

You can not edit drawings with extensions $2 using AnyWikiDraw, because these extensions are disabled on $1.

', +); +?> \ No newline at end of file diff -r a94fb46ff128 -r ca71ebe6af6d contrib/AnyWikiDraw/anywikidraw/mediawiki 1.7 to 1.10/extensions/AnyWikiDraw/AnyWikiDraw.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/contrib/AnyWikiDraw/anywikidraw/mediawiki 1.7 to 1.10/extensions/AnyWikiDraw/AnyWikiDraw.php Fri Oct 30 21:03:37 2009 +0100 @@ -0,0 +1,294 @@ +setFunctionHook( 'drawing', 'wfAnyWikiDrawParserFunction_Render' ); +} + +function wfAnyWikiDrawParserFunction_Magic( &$magicWords, $langCode ) { + # Add the magic word + # The first array element is case sensitive, in this case it is not case sensitive + # All remaining elements are synonyms for our parser function + $magicWords['drawing'] = array( 0, 'drawing' ); + # unless we return true, other parser functions extensions won't get loaded. + return true; +} + +function wfAnyWikiDrawParserFunction_Render( &$parser, $name = null, $width = null, $height = null ) { + global $wgUser, $wgLang, $wgTitle, $wgRightsText, $wgOut, $wgArticlePath, $wgScriptPath, $wgEnableUploads; + $skin = $wgUser->getSkin(); + wfAnyWikiDrawLoadMessages(); + + // Don't cache pages with drawings on it + $parser->disableCache(); + + # Validate parameters + $error = ''; + if ($name == null || strlen($name) == 0) { + $error .= '
Please specify a name for your drawing.'; + } + if ($width != null && + (! is_numeric($width) || $width < 1 || $width > 2000)) { + $error .= '
Please specify the width as a number between 1 and 2000 or leave it away.'; + } + if ($height != null && + (! is_numeric($height) || $height < 1 || $height > 2000)) { + $error .= '
Please specify the height as a number between 1 and 2000 or leave it away.'; + } + if (strlen($error) > 0) { + $error = 'Sorry.'.$error.'
'. + 'Usage: {{#drawing:image.svg|width||height}}
'. + 'Example: {{#drawing:HappyDrawing.svg|400|300}}
'; + return array($error, 'isHTML'=>true, 'noparse'=>true); + } + + # The parser function itself + # The input parameters are wikitext with templates expanded + # The output should be wikitext too, but in this case, it is HTML + #return array("param1 is $param1 and param2 is $param2", 'isHTML'); + + # Generate the image HTML as if viewed by a web request + $image = Image::newFromName($name); + + + $isProtected = $parser->getTitle()->isProtected(); + + if ($width == null && $image->getWidth() != -1) { + $width = $image->getWidth(); + } + if ($height == null && $image->getHeight() != -1) { + $height = $image->getHeight(); + } + + // render a header + $output = '
'; + if ($wgEnableUploads && ! $isProtected && + key_exists('drawingtitle', $_POST) && + $_POST['drawingtitle'] == $name) { + + // edit the drawing using the applet + global $wgUsePathInfo; + if ($wgUsePathInfo) { + $downloadURL = str_replace('$1', 'Special:AnyWikiDraw?image='.htmlspecialchars($image->getName()), $wgArticlePath); + } else { + $downloadURL = str_replace('$1', 'Special:AnyWikiDraw&image='.htmlspecialchars($image->getName()), $wgArticlePath); + } + $uploadURL = str_replace('$1', 'Special:AnyWikiDraw', $wgArticlePath); + $output .= + ''. + ''. + + // The following parameters are used to tell AnyWikiDraw how to communicate with MediaWiki: + + ''. + ''. + ''. + (($image->getURL() !== '') ? '' : ''). + ''. + ''. + + // The following parameters are used to configure the drawing applet: + + ''. + + // The following parameters are used to configure Sun's Java Plug-In: + + ''. + ''. + ''. + ''. + ''. + ''. + + ''. + ''; + + $output .= '
'. + wfMsg(($image->getURL() == '') ? 'anywikidraw_license_terms_new_work' : 'anywikidraw_license_terms_derived_work', + ''.wfMsg('copyrightpage').'', 'Image:'.$name.''). + '
'; + } else { + // Retrieve the page object of the image to determine, whether the user may edit it + $filtered = preg_replace ( "/[^".Title::legalChars()."]|:/", '-', $name ); + $nt = Title::newFromText( $filtered ); + if(! is_null( $nt ) ) { + $nt =& Title::makeTitle( NS_IMAGE, $nt->getDBkey() ); + } + + // Determine if the user has permission to edit the image + $userCanEdit = $wgEnableUploads && + !$isProtected && + (is_null($nt) || $nt->userCanEdit()) && + ($image->getURL() == null || $wgUser->isAllowed( 'reupload' )); + + // Determine if the user may edit images using the specified + // filename extension. + if ($userCanEdit) { + $extension = array_pop(explode( '.', $filtered )); + global $wgFileExtensions; + $userCanEdit = in_array($extension, $wgFileExtensions); + } + + // If the user can edit the image, display an edit link. + // We do not display the edit link, if the user is already + // editing a drawing. + if ($userCanEdit && ! key_exists('drawingtitle', $_POST)) { + $formId = 'Form'.rand(); + global $wgUsePathInfo; + if ($wgUsePathInfo) { + $action = $wgTitle->getLocalURL().'#anywikidraw'; + } else { + //$action = str_replace('?','#anywikidraw?',$wgTitle->getLocalURL()); + $action = $wgTitle->getLocalURL(); + } + $output .= '
'. + ''. + '

'. + '['.wfMsg('edit').']'. + ''. + '

' + ; + } + // render the drawing + $image->width = $width; // FIXME This is an ugly hack to get a view URL + $viewURL = $image->getViewURL(); + + if ($image->getURL() == '') { + // the drawing does not exist yet, render an empty rectangle + $output .= '
'.htmlspecialchars($name).'
'; + } else if (substr($name,-4) == '.svg' && $viewURL == null) { + // SVG images need an object tag + $output .= ''; + } else { + // All other image types need an img tag + // Render the image map, if it exists + $thumbnail = $image->getThumbnail($width); + $isImageMap = $thumbnail != null && file_exists($thumbnail->path.'.map'); + $mapId = 'Map'.rand(); + if ($isImageMap) { + $output .= ''. + file_get_contents($thumbnail->path.'.map'). + ''; + } + // Render the image + if (! $isImageMap) { + $output .= ''; + } + // Note: We append the timestamp of the image to the + // view URL as a query string. This way, we ensure, + // that the browser always displays the last edited version + // of the image + $output .= ''; + if (! $isImageMap) { + $output .= ''; + } + } + // If the user can edit the image, display an edit link. + // We do not display the edit link, if the user is already + // editing a drawing. + if ($userCanEdit && ! key_exists('drawingtitle', $_POST)) { + $output .= '
'; + } + } + + // render a footer + $output .= '
'; + + return array($output, 'isHTML'=>true, 'noparse'=>true); +} + +function wfAnyWikiDrawLoadMessages() { + global $wgAnyWikiDrawMessagesLoaded; + global $wgMessageCache; + if ( $wgAnyWikiDrawMessagesLoaded ) return; + $wgAnyWikiDrawMessagesLoaded = true; + + require( dirname( __FILE__ ) . '/AnyWikiDraw.i18n.php' ); + foreach ( $messages as $lang => $msgs ) { + $wgMessageCache->addMessages( $msgs, $lang ); + } +} +?> \ No newline at end of file diff -r a94fb46ff128 -r ca71ebe6af6d contrib/AnyWikiDraw/anywikidraw/mediawiki 1.7 to 1.10/extensions/AnyWikiDraw/AnyWikiDrawForMediaWiki.jar Binary file contrib/AnyWikiDraw/anywikidraw/mediawiki 1.7 to 1.10/extensions/AnyWikiDraw/AnyWikiDrawForMediaWiki.jar has changed diff -r a94fb46ff128 -r ca71ebe6af6d contrib/AnyWikiDraw/anywikidraw/mediawiki 1.7 to 1.10/extensions/AnyWikiDraw/AnyWikiDrawForMediaWiki.jar.pack.gz Binary file contrib/AnyWikiDraw/anywikidraw/mediawiki 1.7 to 1.10/extensions/AnyWikiDraw/AnyWikiDrawForMediaWiki.jar.pack.gz has changed diff -r a94fb46ff128 -r ca71ebe6af6d contrib/AnyWikiDraw/anywikidraw/mediawiki 1.7 to 1.10/extensions/AnyWikiDraw/AnyWikiDraw_body.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/contrib/AnyWikiDraw/anywikidraw/mediawiki 1.7 to 1.10/extensions/AnyWikiDraw/AnyWikiDraw_body.php Fri Oct 30 21:03:37 2009 +0100 @@ -0,0 +1,593 @@ +mUploadDescription = ''; + $this->mLicense = ''; + $this->mUploadCopyStatus = ''; + $this->mUploadSource = ''; + $this->mWatchthis = false; + } + + function execute( $par ) { + global $wgRequest, $wgOut; + + if ($wgRequest->wasPosted()) { + $this->processUpload(); + } else if (strlen($wgRequest->getVal("image","")) > 0) { + $this->processDownload(); + } else { + $this->setHeaders(); + + # Get request data from, e.g. + # $param = $wgRequest->getText('param'); + + # Show information about AnyWikiDraw + global $wgAnyWikiDrawVersion; + $wgOut->addWikiText( + wfMsg('anywikidraw_about', $wgAnyWikiDrawVersion) + ); + + # Check uploading enabled + global $wgEnableUploads, $wgSitename; + if( !$wgEnableUploads ) { + $wgOut->addWikiText( + wfMsg('anywikidraw_upload_disabled', $wgSitename) + ); + } + + # Check file extensions enabled + global $wgFileExtensions; + $requiredExtensions = array("svg","png","jpg"); + $missingExtensions = array(); + foreach ($requiredExtensions as $ext) { + if (! in_array($ext, $wgFileExtensions)) { + $missingExtensions[] = $ext; + } + } + if (count($missingExtensions) == 1) { + $wgOut->addWikiText( + wfMsg('anywikidraw_extension_disabled', $wgSitename, ".".implode(", .", $missingExtensions) ) + ); + } else if (count($missingExtensions) > 1) { + $wgOut->addWikiText( + wfMsg('anywikidraw_extensions_disabled', $wgSitename, ".".implode(", .", $missingExtensions) ) + ); + } + + + + // Output + // $wgOut->addHTML( $output ); + } + } + + /** I BORROWED THIS FUNCTION FROM SpecialUpload.php!! CHECK FOR EACH VERSION OF MEDIAWIKI, IF + * THIS FUNCTION STILL MAKES SENSE! + * + */ + function processUpload() { + global $wgUser, $wgUploadDirectory, $wgRequest; + + $fname= "AnyWikiDraw_body::processUpload"; + + // Retrieve form fields + $drawingName = $wgRequest->getText('DrawingName'); + $drawingWidth = $wgRequest->getText('DrawingWidth'); + $drawingHeight = $wgRequest->getText('DrawingHeight'); + $drawingTempFile = $wgRequest->getFileTempName('DrawingData'); + $drawingFileSize = $wgRequest->getFileSize( 'DrawingData' ); + $drawingUploadError = $wgRequest->getUploadError('DrawingData'); + $renderedTempFile = $wgRequest->getFileTempName('RenderedImageData'); + $renderedFileSize = $wgRequest->getFileSize( 'RenderedImageData' ); + $renderedUploadError = $wgRequest->getUploadError('RenderedImageData'); + $imageMapTempFile = $wgRequest->getFileTempName('ImageMapData'); + $imageMapFileSize = $wgRequest->getFileSize( 'ImageMapData' ); + $imageMapUploadError = $wgRequest->getUploadError('ImageMapData'); + $uploadSummary = $wgRequest->getText('UploadSummary'); + + // validate image dimension + if (! is_numeric($drawingWidth) || $drawingWidth < 1) { + $drawingWidth = null; + } + if (! is_numeric($drawingHeight) || $drawingHeight < 1) { + $drawingHeight = null; + } + + # If there was no filename or no image data, give up quickly. + if (strlen($drawingName) == 0 || $drawingFileSize == 0) { + wfDebug('[client '.$_SERVER["REMOTE_ADDR"].']'. + '[user '.$wgUser->getName().'] '. + $fname.' received bad request [DrawingName='.$drawingName.']'. + '[fileSize(DrawingData)='.$drawingFileSize.']' + ); + header('HTTP/1.0 400 Bad Request'); + exit("\n\n"+'DrawingName and DrawingData must be supplied.'); + } + + // Verify filename + # Chop off any directories in the given filename. + $drawingName = wfBaseName($drawingName); + $imageExtension = substr(strrchr($drawingName, '.'), 1); + + # Only allow filenames with known extensions + $allowedExtensions = array('svg', 'svgz', 'png', 'jpg'); + if (! in_array($imageExtension, $allowedExtensions)) { + wfDebug('[client '.$_SERVER["REMOTE_ADDR"].']'. + '[user '.$wgUser->getName().'] '. + $fname.' Received bad image extension [DrawingName='.$drawingName.']'); + header('HTTP/1.0 400 Bad Request'); + exit("\n\n"+'DrawingName must have one of the following extensions: '. + implode(',', $allowedExtensions). + '.'); + } + + /** + * Filter out illegal characters, and try to make a legible name + * out of it. We'll strip some silently that Title would die on. + */ + $filtered = preg_replace ( "/[^".Title::legalChars()."]|:/", '-', $drawingName ); + $nt = Title::newFromText( $filtered ); + if( is_null( $nt ) ) { + wfDebug('[client '.$_SERVER["REMOTE_ADDR"].']'. + '[user '.$wgUser->getName().'] '. + $fname.' Received bad image name [DrawingName='.$drawingName.']'); + header('HTTP/1.0 400 Bad Request'); + exit("\n\n"+'DrawingName must contain legible characters only.'); + } + $nt =& Title::makeTitle( NS_IMAGE, $nt->getDBkey() ); + $uploadSaveName = $nt->getDBkey(); + + + /** + * If the image is protected, non-sysop users won't be able + * to modify it by uploading a new revision. + */ + if( !$nt->userCanEdit() ) { + wfDebug('[client '.$_SERVER["REMOTE_ADDR"].']'. + '[user '.$wgUser->getName().'] '. + $fname.' image is protected [DrawingName='.$drawingName.']'); + header('HTTP/1.0 403 Forbidden'); + exit("\n\n"+'You are not allowed to edit this image.'); + } + + /** + * In some cases we may forbid overwriting of existing files. + */ + if( !$this->userCanOverwrite($uploadSaveName) ) { + wfDebug('[client '.$_SERVER["REMOTE_ADDR"].']'. + '[user '.$wgUser->getName().'] '. + $fname.' image may not be overwritten [DrawingName='.$drawingName.']'); + header('HTTP/1.0 403 Forbidden'); + exit("\n\n"+'You are not allowed to overwrite this image.'); + } + + /** Check if the image directory is writeable, this is a common mistake */ + if( !is_writeable( $wgUploadDirectory ) ) { + header('HTTP/1.0 403 Forbidden'); + exit("\n\n"+'The upload directory on the server is read only.'); + } + + /** + * Upload the file into the temp directory, so that we can scrutinize its content + */ + $archive = wfImageArchiveDir( $uploadSaveName, 'temp' ); + + /** + * Look at the contents of the file; if we can recognize the + * type but it's corrupt or data of the wrong type, we should + * probably not accept it. + */ + $veri = $this->verify( $drawingTempFile, $imageExtension ); + if( $veri !== true ) { + wfDebug('[client '.$_SERVER["REMOTE_ADDR"].']'. + '[user '.$wgUser->getName().'] '. + $fname.' image failed verification [DrawingName='.$drawingName.'][DrawingTempFile='.$drawingTempFile.']'); + unlink($drawingTempFile); + header('HTTP/1.0 400 Bad Request'); + exit("\n\n"+'The image data is corrupt.'); + } + + /** + * Provide an opportunity for extensions to add further checks + */ + $error = ''; + if( !wfRunHooks( 'UploadVerification', + array( $uploadSaveName, $drawingTempFile, &$error ) ) ) { + wfDebug('[client '.$_SERVER["REMOTE_ADDR"].']'. + '[user '.$wgUser->getName().'] '. + $fname.' image failed extended verification [DrawingName='.$drawingName.']'); + unlink($drawingTempFile); + header('HTTP/1.0 400 Bad Request'); + exit("\n\n"+'The image data does not match the image name extension.'); + } + + + /** + * Try actually saving the thing... + * It will show an error form on failure. + */ + if( $this->saveUploadedFile( $uploadSaveName, + $drawingTempFile, + true ) ) { + /** + * Update the upload log and create the description page + * if it's a new file. + */ + $img = Image::newFromName( $uploadSaveName ); + if ($drawingWidth != null) { + $img->width = $drawingWidth; + } + if ($drawingHeight != null) { + $img->height = $drawingHeight; + } + $this->mUploadDescription = $uploadSummary; + + $success = $img->recordUpload( $this->mUploadOldVersion, + $this->mUploadDescription, + $this->mLicense, + $this->mUploadCopyStatus, + $this->mUploadSource, + $this->mWatchthis ); + + /** + * Save the rendered image, if one was provided + */ + if ($renderedTempFile != null && $drawingWidth != null) + { + $thumbName = $img->thumbName($drawingWidth, $img->fromSharedDirectory ); + $thumbDir = wfImageThumbDir( $img->name, $img->fromSharedDirectory ); + $thumbPath = $thumbDir.'/'.$thumbName; + wfDebug("we have a rendered image: ".$renderedTempFile.' width='.$drawingWidth.' height='.$drawingHeight.' thumbName='.$thumbPath ); + if (!file_exists(dirname($thumbPath))) { + mkdir(dirname($thumbPath), 0777, true); + } + // Look at the contents of the file; if we can recognize the + // type but it's corrupt or data of the wrong type, we should + // probably not accept it. + $veri = $this->verify( $renderedTempFile, 'png' ); + if( $veri !== true ) { + wfDebug('[client '.$_SERVER["REMOTE_ADDR"].']'. + '[user '.$wgUser->getName().'] '. + $fname.' rendered image failed verification [DrawingName='.$drawingName.'][RenderedTempFile='.$renderedTempFile.']'); + unlink($renderedTempFile); + } else { + move_uploaded_file($renderedTempFile, $thumbPath); + } + } else { + if ($renderedTempFile!= null) { + unlink($renderedTempFile); + } + } + + /** + * Save the image map, if one was provided + */ + if ($imageMapTempFile != null && $drawingWidth != null) + { + $thumbName = $img->thumbName($drawingWidth, $img->fromSharedDirectory ); + $thumbDir = wfImageThumbDir( $img->name, $img->fromSharedDirectory ); + $imageMapPath = $thumbDir.'/'.$thumbName.'.map'; + wfDebug("we have an image map: ".$imageMapTempFile); + if (!file_exists(dirname($imageMapPath))) { + mkdir(dirname($imageMapPath), 0777, true); + } + // Look at the contents of the file; if we can recognize the + // type but it's corrupt or data of the wrong type, we should + // probably not accept it. + $hasScript = $this->detectScript( $imageMapTempFile, 'text/html', 'html' ); + if( $hasScript !== false ) { + wfDebug('[client '.$_SERVER["REMOTE_ADDR"].']'. + '[user '.$wgUser->getName().'] '. + $fname.' image map failed verification [DrawingName='.$drawingName.'][ImageMapTempFile='.$imageMapTempFile.']'); + unlink($imageMapTempFile); + } else { + move_uploaded_file($imageMapTempFile, $imageMapPath); + } + } else { + if ($imageMapTempFile!= null) { + unlink($imageMapTempFile); + } + } + + + if ( $success ) { + $this->showSuccess(); + wfRunHooks( 'UploadComplete', array( &$img ) ); + } else { + // Image::recordUpload() fails if the image went missing, which is + // unlikely, hence the lack of a specialised message + $wgOut->showFileNotFoundError( $this->mUploadSaveName ); + } + } + if ($renderedTempFile!= null) { + unlink($renderedTempFile); + } + if ($imageMapTempFile!= null) { + unlink($imageMapTempFile); + } + } + + /** Downloads the specified image to the applet, and disallows caching by the browser. + * We need this function, because if we retrieve an image using the MediaWiki + * image URL, the image gets cached by the browser. This is very bad for editing, + * because we wan't to edit the newest version of the image only. + */ + function processDownload() { + global $wgRequest; + + $name = $wgRequest->getVal("image",""); + $image = Image::newFromName($name); + $imagePath = $image->getImagePath(); + if ($imagePath != null && file_exists($imagePath) && $filehandle=fopen($imagePath,'r')) { + header('Last-Modified: '.date(DATE_RFC822, filectime($imagePath))); + header('Cache-Control: no-cache'); + if ($image->getMimeType() == 'image/svg') { + header('Content-Type: image/svg+xml'); + } else { + header('Content-Type: '.$image->getMimeType()); + } + header('Content-Length: '.filesize($imagePath)); + fpassthru($filehandle); + fclose($filehandle); + exit; + } else { + header('HTTP/1.0 404 Not Found'); + echo 'image '.$name.' not found'; // do we need to i18n this? It's never displayed to a user. + exit; + } + } + /** + * Show some text and linkage on successful upload. + * @access private + */ + function showSuccess() { + header('HTTP/1.0 200 OK'); + exit; + } + + /** I BORROWED THIS FUNCTION FROM SpecialUpload.php!! CHECK FOR EACH VERSION OF MEDIAWIKI, IF + * THIS FUNCTION STILL MAKES SENSE! + * + * Move the uploaded file from its temporary location to the final + * destination. If a previous version of the file exists, move + * it into the archive subdirectory. + * + * @todo If the later save fails, we may have disappeared the original file. + * + * @param string $saveName + * @param string $tempName full path to the temporary file + * @param bool $useRename if true, doesn't check that the source file + * is a PHP-managed upload temporary + */ + function saveUploadedFile( $saveName, $tempName, $useRename = false ) { + global $wgOut, $wgAllowCopyUploads; + + $fname= "SpecialUpload::saveUploadedFile"; + + if ( !$useRename && $wgAllowCopyUploads && $this->mSourceType == 'web' ) { + $useRename = true; + } + + $dest = wfImageDir( $saveName ); + $archive = wfImageArchiveDir( $saveName ); + if ( !is_dir( $dest ) ) wfMkdirParents( $dest ); + if ( !is_dir( $archive ) ) wfMkdirParents( $archive ); + + $this->mSavedFile = "{$dest}/{$saveName}"; + + if( is_file( $this->mSavedFile ) ) { + $this->mUploadOldVersion = gmdate( 'YmdHis' ) . "!{$saveName}"; + wfSuppressWarnings(); + $success = rename( $this->mSavedFile, "${archive}/{$this->mUploadOldVersion}" ); + wfRestoreWarnings(); + + if( ! $success ) { + $wgOut->showFileRenameError( $this->mSavedFile, + "${archive}/{$this->mUploadOldVersion}" ); + return false; + } + else wfDebug("$fname: moved file ".$this->mSavedFile." to ${archive}/{$this->mUploadOldVersion}\n"); + } + else { + $this->mUploadOldVersion = ''; + } + + wfSuppressWarnings(); + $success = $useRename + ? rename( $tempName, $this->mSavedFile ) + : move_uploaded_file( $tempName, $this->mSavedFile ); + wfRestoreWarnings(); + + if( ! $success ) { + $wgOut->showFileCopyError( $tempName, $this->mSavedFile ); + return false; + } else { + wfDebug("$fname: wrote tempfile $tempName to ".$this->mSavedFile."\n"); + } + + chmod( $this->mSavedFile, 0644 ); + return true; + } + + function loadMessages() { + static $messagesLoaded = false; + global $wgMessageCache; + if ( $messagesLoaded ) return; + $messagesLoaded = true; + + require( dirname( __FILE__ ) . '/AnyWikiDraw.i18n.php' ); + foreach ( $messages as $lang => $msgs ) { + $wgMessageCache->addMessages( $msgs, $lang ); + } + return true; + } + + /** I BORROWED THIS FUNCTION FROM SpecialUpload.php!! CHECK FOR EACH VERSION OF MEDIAWIKI, IF + * THIS FUNCTION STILL MAKES SENSE! + * + * Check if there's an overwrite conflict and, if so, if restrictions + * forbid this user from performing the upload. + * + * @return true on success, false on failure + * @access private + */ + function userCanOverwrite( $name ) { + $img = Image::newFromName( $name ); + if( is_null( $img ) ) { + // Uh... this shouldn't happen ;) + // But if it does, fall through to previous behavior + return false; + } + + if( $img->exists() ) { + global $wgUser, $wgOut; + if( $img->isLocal() ) { + if( !$wgUser->isAllowed( 'reupload' ) ) { + return false; + } + } else { + if( !$wgUser->isAllowed( 'reupload' ) || + !$wgUser->isAllowed( 'reupload-shared' ) ) { + return false; + } + } + } + + // Rockin', go ahead and upload + return true; + } + + /** + * Verifies that it's ok to include the uploaded file + * + * @param string $tmpfile the full path of the temporary file to verify + * @param string $extension The filename extension that the file is to be served with + * @return mixed true of the file is verified, a WikiError object otherwise. + */ + function verify( $tmpfile, $extension ) { + $fname= "AnyWikiDraw_body::verify"; + + #magically determine mime type + // BEGIN PATCH MediaWiki 1.7.1 + //$magic=& MimeMagic::singleton(); + //$mime= $magic->guessMimeType($tmpfile,false); + $magic=& wfGetMimeMagic(); + $mime= $magic->guessMimeType($tmpfile,false); + // END PATCH MediaWiki 1.7.1 + + #check mime type, if desired + global $wgVerifyMimeType; + if ($wgVerifyMimeType) { + + #check mime type against file extension + if( !$this->verifyExtension( $mime, $extension ) ) { + //return new WikiErrorMsg( 'uploadcorrupt' ); + return false; + } + /* + #check mime type blacklist + global $wgMimeTypeBlacklist; + if( isset($wgMimeTypeBlacklist) && !is_null($wgMimeTypeBlacklist) + && $this->checkFileExtension( $mime, $wgMimeTypeBlacklist ) ) { + //return new WikiErrorMsg( 'badfiletype', htmlspecialchars( $mime ) ); + wfDebug($fname.' badfiletype'); + return false; + }*/ + } + + #check for htmlish code and javascript + if( $this->detectScript ( $tmpfile, $mime, $extension ) ) { + //return new WikiErrorMsg( 'uploadscripted' ); + wfDebug($fname.' uploadscripted'); + return false; + } + + /** + * Scan the uploaded file for viruses + */ + $virus= $this->detectVirus($tmpfile); + if ( $virus ) { + //return new WikiErrorMsg( 'uploadvirus', htmlspecialchars($virus) ); + wfDebug($fname.' uploadvirus'); + return false; + } + + //wfDebug( "$fname: all clear; passing.\n" ); + return true; + } + /** + * Checks if the mime type of the uploaded file matches the file extension. + * + * @param string $mime the mime type of the uploaded file + * @param string $extension The filename extension that the file is to be served with + * @return bool + */ + function verifyExtension( $mime, $extension ) { + return UploadForm::verifyExtension($mime, $extension); + } + /** Heuristig for detecting files that *could* contain JavaScript instructions or + * things that may look like HTML to a browser and are thus + * potentially harmful. The present implementation will produce false positives in some situations. + * + * @param string $file Pathname to the temporary upload file + * @param string $mime The mime type of the file + * @param string $extension The extension of the file + * @return bool true if the file contains something looking like embedded scripts + */ + function detectScript($file, $mime, $extension) { + return UploadForm::detectScript($file, $mime, $extension); + } + /** Generic wrapper function for a virus scanner program. + * This relies on the $wgAntivirus and $wgAntivirusSetup variables. + * $wgAntivirusRequired may be used to deny upload if the scan fails. + * + * @param string $file Pathname to the temporary upload file + * @return mixed false if not virus is found, NULL if the scan fails or is disabled, + * or a string containing feedback from the virus scanner if a virus was found. + * If textual feedback is missing but a virus was found, this function returns true. + */ + function detectVirus($file) { + return UploadForm::detectVirus($file); + } +} +?> \ No newline at end of file diff -r a94fb46ff128 -r ca71ebe6af6d contrib/AnyWikiDraw/anywikidraw/moinmoin/AnyWikiDrawForMoinMoin.jar Binary file contrib/AnyWikiDraw/anywikidraw/moinmoin/AnyWikiDrawForMoinMoin.jar has changed diff -r a94fb46ff128 -r ca71ebe6af6d contrib/AnyWikiDraw/anywikidraw/moinmoin/AnyWikiDrawForMoinMoin.jar.pack.gz Binary file contrib/AnyWikiDraw/anywikidraw/moinmoin/AnyWikiDrawForMoinMoin.jar.pack.gz has changed diff -r a94fb46ff128 -r ca71ebe6af6d contrib/AnyWikiDraw/anywikidraw/pmwiki/cookbook/AnyWikiDraw/AnyWikiDraw.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/contrib/AnyWikiDraw/anywikidraw/pmwiki/cookbook/AnyWikiDraw/AnyWikiDraw.php Fri Oct 30 21:03:37 2009 +0100 @@ -0,0 +1,744 @@ +"); +SDV($displayDrawingEditFmt, ""); + +// css style for drawing caption +#$HTMLStylesFmt[] = ".pmwikidraweditlink { font-size:70%; font-weight:bold; }\n"; + +// Add extra colors to the fill/color menus. +#$drawingExtraColors = "Aquamarine=#70DB93,New Tan=EBC79E,Sea Green=238E68,Motorola Blue=#3ff"; +// ----------------------------------------------------------------------------------------------------------------- + +//-------------------- Globally executed code -------------------- + +// Work out which version of PmWiki we're looking at :) +preg_match('/.*-(\\d+)/',$Version,$match); +$pmwikiver = $match[1]; +if($pmwikiver <= 1) { + echo "PmWikiDraw no longer supports PmWiki1, please upgrade to PmWiki2. Thanks."; + exit(); +} + +// Add in our required file extensions and associate the new markup. +SDVA($UploadExts, array( + 'gif' => 'image/gif', + 'draw' => 'text/plain', + 'map' => 'text/plain', + 'png' => 'image/png', + 'jpg' => 'image/jpeg', + 'jpeg' => 'image/jpeg', + 'svg' => 'image/svg+xml' +)); +Markup('drawing','inline', "/\\(:drawing\\s*(\\w[-.\\w]*\\w)\\s*(?:|\\s*(\\d+))*\\s*:\\)/e", "drawing('$1')"); +SDV($HandleActions['imagehistory'],'HandleImageHistory'); +SDV($HandleActions['postDrawing'], 'HandlePostDrawing'); + +// Modify global variables based on the current action type. +if ($action=='editimage') + { $editImage = true; } +else + { $editImage = false; } + +if($action=='print' || $action=='publish' || $action=='editimage' || $action=='edit') { + // Hide the edit & history links when printing/publishing/editing + $displayDrawingEditFmt = ""; + $displayDrawingHistoryFmt = ""; +} + +if (!$EnableDrawingVersioning) + { $displayDrawingHistoryFmt = ""; } + +// ------------------- Handle the drawing markup -------------------------------- +function drawing($str) { + global $EnableUpload; + + $output = ""; + + if($EnableUpload != 1) { // Helpful hint to make sure people turn on uploads! + $output.= "Please note your administrator *NEEDS* to enable uploads before you can save your drawings.
"; + } + + + $drawing = $str; + $pos = strrpos($drawing, '.'); + $filenameExtension = ($pos == false) ? '' : strtolower(substr($drawing, $pos + 1)); + if (in_array($filenameExtension, array('','draw'))) { + $output .= drawing_draw($str); + } else { + $output .= drawing_any($str); + } + return Keep($output); +} + +// ------------------- Handle the drawing markup for all file formats except .draw -------------------------------- +function drawing_any($str) { + global $action, $group, $pagename, $ScriptUrl, $UploadPrefixFmt; + global $UploadUrlFmt, $UploadDir, $editImage, $displayDrawingEditFmt, $EnableDrawingDebug; + global $drawing, $editImageUrl, $drawingExtraColors, $EnableDrawingVersioning; + global $pubdirurl, $PmWikiDrawPubUrl, $showHistoryUrl, $displayDrawingHistoryFmt; + global $FmtV, $GCount, $drawingCompatibilityMode, $scripturl; + global $Now; + + $CookbookDirURL = 'http://'.$_SERVER['HTTP_HOST'].$_SERVER['SCRIPT_NAME'].'/../cookbook'; + + + + $drawing = $str; + + $output = ""; + + // expand to full URL (incl http://) if url is relative: + if (!preg_match('/^http:/',$ScriptUrl)) + { $scripturl = "http://".$_SERVER['HTTP_HOST'] . $ScriptUrl; } + else + { $scripturl = $ScriptUrl; } + + + // expand to full URL (incl http://) if url is relative: + if (!preg_match('/^http:/',$PmWikiDrawPubUrl)) + { $pubdirurl = "http://".$_SERVER['HTTP_HOST'] . $PmWikiDrawPubUrl; } + else + { $pubdirurl = $PmWikiDrawPubUrl; } + + // Work out the uploads path, both as a url and as an absolute path on the disk. + $uploadsUrl = FmtPageName("$UploadUrlFmt$UploadPrefixFmt", $pagename)."/"; + + // expand to full URL (incl http://) if url is relative: + if (!preg_match('/^http:/',$uploadsUrl)) + { $uploadsUrl = "http://".$_SERVER['HTTP_HOST'] . $uploadsUrl; } + + $uploadsPath = FmtPageName("$UploadDir$UploadPrefixFmt",$pagename)."/"; //Change for tegan, different urls used for direct-downloads... + if( $EnableDirectDownload != 1 ) + { + $uploadsUrl= "$scripturl?n=$pagename&action=download&upname="; + } + + if ( isset($_GET['image']) ) + { $imageToEdit = $_GET['image']; } + + $pos = strrpos($drawing, '.'); + $filenameExtension = ($pos == false) ? '' : strtolower(substr($drawing, $pos + 1)); + $renderedDrawing = in_array($filenameExtension, array('png','jpg','jpeg')) ? + $drawing : $drawing.".png"; + + $currentlyExists = file_exists($uploadsPath.$drawing); + $renderedCurrentlyExists = file_exists($uploadsPath.$renderedDrawing); + $mapCurrentlyExists = file_exists($uploadsPath.$drawing.".map"); + + + $editImageUrl = $scripturl.'?pagename='.$pagename.'&action=editimage&image='.$drawing; + $showHistoryUrl = $scripturl.'?pagename='.$pagename.'&action=imagehistory&image='.$drawing; + + + if ($editImage == false || !isset($imageToEdit) || $imageToEdit != $drawing) { + if ($mapCurrentlyExists) { + $filename = $uploadsPath.$drawing.".map"; + $fp = fopen($filename, "r"); + $contents = fread($fp, filesize($filename)); + fclose($fp); + $GCount = 0; + + // Translate all global pmwiki $variables included in map + $contents = FmtPageName($contents,$pagename); + + // Write the MAP into the outgoing HTML code. + $output .= "\n".$contents."\n"; + } + + if ($currentlyExists) { + $output .= ''; + + // Mechanism to ensure that our urls get properly added into the variables that + // FmtPagename references. +####CJ: I still can't get this to work, any ideas Knut? +// if($pmwikiver >1) { +// $FmtV['$editImageUrl'] = $editImageUrl; +// $FmtV['$showHistoryUrl'] = $showHistoryUrl; +// $FmtV['$pubdirurl'] = $pubdirurl; +// $FmtV['$scripturl'] = $scripturl; +// } +// else { + $GCount = 0; +// } + + $output .= FmtPagename($displayDrawingEditFmt,$pagename); + $output .= FmtPagename($displayDrawingHistoryFmt, $pagename); + } + else + { $output .= FmtPageName('$[Create Image]('.$drawing.')'."\n",$pagename); } + } + + if ($editImage == true && isset($imageToEdit) && $imageToEdit == $drawing) { + + #### CJ: Hmm this might be an issue, as we can't determine whether a user + #### is *allowed* to edit a picture until the point they save it we might end up + #### creating version files when there's no need to, or more to the point, shouldn't + #### do as we'll be creating new files taking up space when its impossible for the user + #### to modify the drawing anyway? + #### Possible work arounds: + #### 1) Always modify a 'tmp' drawing file and have the applet return to this page with + #### a particular action 'postDrawingEdit' for example. And at this point check if the + #### tmp file was modified i.e. diff between the 'original' and the 'tmp' if so then do + #### versioning and redirect to 'browse' on the current page. + #### 2) Too tired.. there must be others..ideas ? + + + // copy of drawing file(s) for versioning + if($EnableDrawingVersioning == true) { + $drawfileprefix = $uploadsPath.$drawing; + + if (file_exists("$drawfileprefix.draw")) { + + $drawfilelastchanged = filemtime("$drawfileprefix.draw"); + $drawbackupfileprefix = "$drawfileprefix,$drawfilelastchanged"; + + if (!file_exists("$drawbackupfileprefix.draw")) { + // backupfile does not exist + + // Copy drawing source file + if (!@copy("$drawfileprefix.draw", "$drawbackupfileprefix.draw")) + { $output .= "
failed to create backup $drawfileprefix.draw to $drawbackupfileprefix.draw
\n"; } + else + { $output .= "
backuped ".basename("$drawfileprefix.draw")." to ".basename("$drawbackupfileprefix.draw")."
\n"; } + + ### KAL: TODO: if copy-ok-messages not wanted, possibly en/disable display of msg by variable ? + ### copy messages will only be displayed under then image when in image-edit-mode + ### KAL: TODO: check if needed to copy all files of drawing + + // Copy the map-file + if (!@copy("$drawfileprefix.map", "$drawbackupfileprefix.map")) + { $output .= "
failed to backup $drawfileprefix.map  to $drawbackupfileprefix.map
\n"; } + else + { $output .= "
backuped ".basename("$drawfileprefix.map")."  to ".basename("$drawbackupfileprefix.map")."
\n"; } + + // Copy the gif file (better for displaying old versions) + if (!@copy("$drawfileprefix.gif", "$drawbackupfileprefix.gif")) + { $output .= "
failed to backup $drawfileprefix.gif  to $drawbackupfileprefix.gif
\n"; } + else + { $output .= "
backuped ".basename("$drawfileprefix.gif")."  to ".basename("$drawbackupfileprefix.gif")."
\n"; } + + ### versioning the draw-file and gif-file could be enough, versions could be displayed via (:attachlist:) or via an own + ### directive that allows display (then possibly better version map and gif too) and / or editing / recovery of older versions + } + } + } + // Build the applet string. + // create applet tag for image formats supported by the new applet + $output .= ''."\n"; + } + $output .= ''."\n"; + $output .= ''."\n"; + $output .= ''."\n"; + $output .= ''."\n"; + $output .= ''."\n"; + $output .= ''."\n"; + $output .= ''."\n"; + $output .= ''."\n"; + + // The following parameters are used to configure the drawing applet: + // TODO : get the language of the user and set it here + //$output .= ''."\n"; + + // The following parameters are used to configure Sun's Java Plug-In: + + $output .= ''."\n"; + $output .= ''."\n"; + $output .= ''."\n"; + $output .= ''."\n"; + $output .= ''."\n"; + $output .= ''."\n"; + + $output .= ''."\n"; + } + + return $output; +} +// ------------------- Handle the drawing markup for the .draw file format -------------------------------- +function drawing_draw($str) { + global $action, $group, $pagename, $ScriptUrl, $UploadPrefixFmt; + global $UploadUrlFmt, $UploadDir, $editImage, $displayDrawingEditFmt, $EnableDrawingDebug; + global $drawing, $editImageUrl, $drawingExtraColors, $EnableDrawingVersioning; + global $pubdirurl, $PmWikiDrawPubUrl, $showHistoryUrl, $displayDrawingHistoryFmt; + global $FmtV, $GCount, $drawingCompatibilityMode, $scripturl; + global $Now; + + $drawing = $str; + + $output = ""; + + // expand to full URL (incl http://) if url is relative: + if (!preg_match('/^http:/',$ScriptUrl)) + { $scripturl = "http://".$_SERVER['HTTP_HOST'] . $ScriptUrl; } + else + { $scripturl = $ScriptUrl; } + + + // expand to full URL (incl http://) if url is relative: + if (!preg_match('/^http:/',$PmWikiDrawPubUrl)) + { $pubdirurl = "http://".$_SERVER['HTTP_HOST'] . $PmWikiDrawPubUrl; } + else + { $pubdirurl = $PmWikiDrawPubUrl; } + + // Work out the uploads path, both as a url and as an absolute path on the disk. + $uploadsUrl = FmtPageName("$UploadUrlFmt$UploadPrefixFmt", $pagename)."/"; + + // expand to full URL (incl http://) if url is relative: + if (!preg_match('/^http:/',$uploadsUrl)) + { $uploadsUrl = "http://".$_SERVER['HTTP_HOST'] . $uploadsUrl; } + + $uploadsPath = FmtPageName("$UploadDir$UploadPrefixFmt",$pagename)."/"; + + //Change for tegan, different urls used for direct-downloads... + if( $EnableDirectDownload != 1 ) + { + $uploadsUrl= "$scripturl?n=$pagename&action=download&upname="; + } + + if ( isset($_GET['image']) ) + { $imageToEdit = $_GET['image']; } + + $currentlyExists = file_exists($uploadsPath.$drawing.".gif"); + $mapCurrentlyExists = file_exists($uploadsPath.$drawing.".map"); + + + $editImageUrl = $scripturl.'?pagename='.$pagename.'&action=editimage&image='.$drawing; + $showHistoryUrl = $scripturl.'?pagename='.$pagename.'&action=imagehistory&image='.$drawing; + + if ($mapCurrentlyExists && $editImage == false) { + // Add the map :) + $filename = $uploadsPath.$drawing.".map"; + $fp = fopen($filename, "r"); + $contents = fread($fp, filesize($filename)); + fclose($fp); +// $contents = str_replace("%BUILDEDITLINK%", $editImageUrl, $contents); + +####CJ: I still can't get this to work, any ideas Knut? +// if($pmwikiver >1) { +// $FmtV['$scripturl'] = $scripturl; +// $FmtV['$editImageUrl'] = $editImageUrl; +// } +// else { + $GCount = 0; +// } + + // Translate all global pmwiki $variables included in map + $contents = FmtPageName($contents,$pagename); + + // Write the MAP into the outgoing HTML code. + $output .= "\n".$contents."\n"; + } + + if ($currentlyExists ) { + $output .= ''; + + // Mechanism to ensure that our urls get properly added into the variables that + // FmtPagename references. +####CJ: I still can't get this to work, any ideas Knut? +// if($pmwikiver >1) { +// $FmtV['$editImageUrl'] = $editImageUrl; +// $FmtV['$showHistoryUrl'] = $showHistoryUrl; +// $FmtV['$pubdirurl'] = $pubdirurl; +// $FmtV['$scripturl'] = $scripturl; +// } +// else { + $GCount = 0; +// } + + $output .= FmtPagename($displayDrawingEditFmt,$pagename); + $output .= FmtPagename($displayDrawingHistoryFmt, $pagename); + + /* KAL: debugging only: + DEBUG(htmlentities($editImageUrl),1); + DEBUG(htmlentities($displayDrawingEditFmt),1); + DEBUG(htmlentities(FmtPagename($displayDrawingEditFmt,$pagename)),1); + DEBUG(htmlentities($displayDrawingHistoryFmt),1); + DEBUG(htmlentities(FmtPagename($displayDrawingHistoryFmt, $pagename)),1); + /* */ + } + else + { $output .= FmtPageName('$[Create Image]('.$drawing.')'."\n",$pagename); } + + if ($editImage == true && isset($imageToEdit) && $imageToEdit == $drawing) { + + #### CJ: Hmm this might be an issue, as we can't determine whether a user + #### is *allowed* to edit a picture until the point they save it we might end up + #### creating version files when there's no need to, or more to the point, shouldn't + #### do as we'll be creating new files taking up space when its impossible for the user + #### to modify the drawing anyway? + #### Possible work arounds: + #### 1) Always modify a 'tmp' drawing file and have the applet return to this page with + #### a particular action 'postDrawingEdit' for example. And at this point check if the + #### tmp file was modified i.e. diff between the 'original' and the 'tmp' if so then do + #### versioning and redirect to 'browse' on the current page. + #### 2) Too tired.. there must be others..ideas ? + + + // copy of drawing file(s) for versioning + if($EnableDrawingVersioning == true) { + $drawfileprefix = $uploadsPath.$drawing; + + if (file_exists("$drawfileprefix.draw")) { + + $drawfilelastchanged = filemtime("$drawfileprefix.draw"); + $drawbackupfileprefix = "$drawfileprefix,$drawfilelastchanged"; + + if (!file_exists("$drawbackupfileprefix.draw")) { + // backupfile does not exist + + // Copy drawing source file + if (!@copy("$drawfileprefix.draw", "$drawbackupfileprefix.draw")) + { $output .= "
failed to create backup $drawfileprefix.draw to $drawbackupfileprefix.draw
\n"; } + else + { $output .= "
backuped ".basename("$drawfileprefix.draw")." to ".basename("$drawbackupfileprefix.draw")."
\n"; } + + ### KAL: TODO: if copy-ok-messages not wanted, possibly en/disable display of msg by variable ? + ### copy messages will only be displayed under then image when in image-edit-mode + ### KAL: TODO: check if needed to copy all files of drawing + + // Copy the map-file + if (!@copy("$drawfileprefix.map", "$drawbackupfileprefix.map")) + { $output .= "
failed to backup $drawfileprefix.map  to $drawbackupfileprefix.map
\n"; } + else + { $output .= "
backuped ".basename("$drawfileprefix.map")."  to ".basename("$drawbackupfileprefix.map")."
\n"; } + + // Copy the gif file (better for displaying old versions) + if (!@copy("$drawfileprefix.gif", "$drawbackupfileprefix.gif")) + { $output .= "
failed to backup $drawfileprefix.gif  to $drawbackupfileprefix.gif
\n"; } + else + { $output .= "
backuped ".basename("$drawfileprefix.gif")."  to ".basename("$drawbackupfileprefix.gif")."
\n"; } + + ### versioning the draw-file and gif-file could be enough, versions could be displayed via (:attachlist:) or via an own + ### directive that allows display (then possibly better version map and gif too) and / or editing / recovery of older versions + } + + /* for debugging only: (add # in front of this statement to activate ! + $output .= "
";
+        $output .= "drawfileprefix=$drawfileprefix\n";
+        $output .= "drawbackupfileprefix=$drawbackupfileprefix\n";
+        $output .= "drawfilelastchanged=$drawfilelastchanged\n";
+        $output .= "
"; + /* */ + } + } + // Build the applet string. + $CookbookDirURL = 'http://'.$_SERVER['HTTP_HOST'].$_SERVER['SCRIPT_NAME'].'/../cookbook'; +// if( $drawingCompatibilityMode == false) { + $output .= ''."\n"; + $output .= ''."\n"; + $output .= ''."\n"; + $output .= ''."\n"; + $output .= ''."\n"; + $output .= ''."\n"; + $output .= ''."\n"; + + // Configurable parameters. + if( $EnableDrawingDebug == true) + { $output .= ''."\n"; } + + if ( $drawingExtraColors != "") + { $output .= ''."\n"; } + $output .= ''."\n"; + // } +// else { // Compatibility mode...painful... +// // In theory, IE should see the OBJECt and run that, but Mozilla should see the comment and run the embed... in theory.... +// $output .= ''."\n"; +// $output .= ' '."\n"; +// $output .= ' '."\n"; +// $output .= ' '."\n"; +// $output .= ' '."\n"; +// $output .= ' '."\n"; +// $output .= ' '."\n"; +// $output .= ' '."\n"; +// $output .= ' '."\n"; +// $output .= ' '."\n"; // This fella should be picked up by mozilla/netscape et al. +// $output .= ' + '* [[$Group/$Name]] Drawing - '.$imageModified.' modified . . . $CurrentTime', + '$Group.RecentChanges' => + '* [[$Group/$Name]] Drawing - '.$imageModified.' modified . . . $CurrentTime'); + $IsPagePosted = true; + $x = ""; + $y=""; + PostRecentChanges($pagename, $x,$y); + $IsPagePosted = false; + } + HandlePostEditImage($pagename); +} + + +function HandlePostDrawing($pagename) { + global $UploadVerifyFunction,$UploadFileFmt,$LastModFile, $Now; + global $RecentChangesFmt, $IsPagePosted, $EnableDrawingRecentChanges; + + if ($_POST['drawingbasetime']) { + HandlePostDrawing_draw($pagename); + } else { + HandlePostDrawing_any($pagename); + } +} + +/** + * Handle all file formats except the .draw format + */ +function HandlePostDrawing_any($pagename) { + global $UploadVerifyFunction,$UploadFileFmt,$LastModFile, $Now; + global $RecentChangesFmt, $IsPagePosted, $EnableDrawingRecentChanges; + + $page = RetrieveAuthPage($pagename,'upload'); + if (!$page) Abort("?cannot upload to $pagename"); + $uploadImage = $_FILES['RenderedImageData']; + $uploadDrawing = $_FILES['DrawingData']; + $uploadMap = $_FILES['ImageMapData']; + + $drawingBaseTime = $_POST['DrawingRevision']; // The time the user began editing this drawing. + $imageupname=$uploadImage['name']; + $drawingupname=$uploadDrawing['name']; + $mapupname=$uploadMap['name']; + + $imageupname = MakeUploadName($pagename,$imageupname); + $drawingupname = MakeUploadName($pagename,$drawingupname); + $mapupname = MakeUploadName($pagename,$mapupname); + $imageFilePath = FmtPageName("$UploadFileFmt/$imageupname",$pagename); + $drawingFilePath = FmtPageName("$UploadFileFmt/$drawingupname",$pagename); + $mapFilePath = FmtPageName("$UploadFileFmt/$mapupname",$pagename); + + if( file_exists($drawingFilePath) ) { + // Only worth checking timestamps if a drawing actually currently exists! + if ( filemtime( $drawingFilePath ) > $drawingBaseTime ) { + // Assign a new timestamp to the client... hopefully this time they'll be ok... + header("PmWikiDraw-DrawingChanged: $Now"); + exit; + } + } + + // If we've got to here then we can assume its safe to overwrite the current file + // Note: we should do the history archival/recent changes stuff here. + if ( $EnableDrawingRecentChanges == true && isset($_POST['drawingname']) ){ + $imageModified = $_POST['drawingname']; + $RecentChangesFmt = array( + 'Main.AllRecentChanges' => + '* [[$Group/$Name]] Drawing - '.$imageModified.' modified . . . $CurrentTime', + '$Group.RecentChanges' => + '* [[$Group/$Name]] Drawing - '.$imageModified.' modified . . . $CurrentTime'); + $IsPagePosted = true; + $x = ""; + $y=""; + PostRecentChanges($pagename, $x,$y); + $IsPagePosted = false; + } + + error_log('HandlePostDrawing we got here:'.$uploadDrawing); + $filedir = preg_replace('#/[^/]*$#','',$imageFilePath); + mkdirp($filedir); + if (!move_uploaded_file($uploadImage['tmp_name'],$imageFilePath)) { + // Rendered image is optional, we don't need to abort here + //Abort("?cannot move uploaded image to $imageFilePath"); return; + } + fixperms($imageFilePath,0444); + if ($LastModFile) { touch($LastModFile); fixperms($LastModFile); } + + $filedir = preg_replace('#/[^/]*$#','',$drawingFilePath); + if (!move_uploaded_file($uploadDrawing['tmp_name'],$drawingFilePath)) + { Abort("?cannot move uploaded drawing to $drawingFilePath"); return; } + fixperms($drawingFilePath,0444); + if ($LastModFile) { touch($LastModFile); fixperms($LastModFile); } + + $filedir = preg_replace('#/[^/]*$#','',$mapFilePath); + mkdirp($filedir); + if (!move_uploaded_file($uploadMap['tmp_name'],$mapFilePath)) { + // Image map is optional, we don't need to abort here + //Abort("?cannot move uploaded map to $mapFilePath"); return; + } + fixperms($mapFilePath,0444); + if ($LastModFile) { touch($LastModFile); fixperms($LastModFile); } + + // Sets the drawingBaseTime header for incremental save support. + header( "PmWikiDraw-DrawingBaseTime: ".filemtime( $drawingFilePath ) ); +} +/** + * Handle the .draw file format + */ +function HandlePostDrawing_draw($pagename) { + global $UploadVerifyFunction,$UploadFileFmt,$LastModFile, $Now; + global $RecentChangesFmt, $IsPagePosted, $EnableDrawingRecentChanges; + + $page = RetrieveAuthPage($pagename,'upload'); + if (!$page) Abort("?cannot upload to $pagename"); + $uploadImage = $_FILES['uploadImage']; + $uploadDrawing = $_FILES['uploadDrawing']; + $uploadMap = $_FILES['uploadMap']; + + $drawingBaseTime = $_POST['drawingbasetime']; // The time the user began editing this drawing. + $imageupname=$uploadImage['name']; + $drawingupname=$uploadDrawing['name']; + $mapupname=$uploadMap['name']; + + $imageupname = MakeUploadName($pagename,$imageupname); + $drawingupname = MakeUploadName($pagename,$drawingupname); + $mapupname = MakeUploadName($pagename,$mapupname); + $imageFilePath = FmtPageName("$UploadFileFmt/$imageupname",$pagename); + $drawingFilePath = FmtPageName("$UploadFileFmt/$drawingupname",$pagename); + $mapFilePath = FmtPageName("$UploadFileFmt/$mapupname",$pagename); + + if( file_exists($drawingFilePath) ) { + // Only worth checking timestamps if a drawing actually currently exists! + if ( filemtime( $drawingFilePath ) > $drawingBaseTime ) { + // Assign a new timestamp to the client... hopefully this time they'll be ok... + header("PmWikiDraw-DrawingChanged: $Now"); + exit; + } + } + + // If we've got to here then we can assume its safe to overwrite the current file + // Note: we should do the history archival/recent changes stuff here. + if ( $EnableDrawingRecentChanges == true && isset($_POST['drawingname']) ){ + $imageModified = $_POST['drawingname']; + $RecentChangesFmt = array( + 'Main.AllRecentChanges' => + '* [[$Group/$Name]] Drawing - '.$imageModified.' modified . . . $CurrentTime', + '$Group.RecentChanges' => + '* [[$Group/$Name]] Drawing - '.$imageModified.' modified . . . $CurrentTime'); + $IsPagePosted = true; + $x = ""; + $y=""; + PostRecentChanges($pagename, $x,$y); + $IsPagePosted = false; + } + + $filedir = preg_replace('#/[^/]*$#','',$imageFilePath); + mkdirp($filedir); + if (!move_uploaded_file($uploadImage['tmp_name'],$imageFilePath)) + { Abort("?cannot move uploaded image to $imageFilePath"); return; } + fixperms($imageFilePath,0444); + if ($LastModFile) { touch($LastModFile); fixperms($LastModFile); } + + $filedir = preg_replace('#/[^/]*$#','',$drawingFilePath); + mkdirp($filedir); + if (!move_uploaded_file($uploadDrawing['tmp_name'],$drawingFilePath)) + { Abort("?cannot move uploaded drawing to $drawingFilePath"); return; } + fixperms($drawingFilePath,0444); + if ($LastModFile) { touch($LastModFile); fixperms($LastModFile); } + + $filedir = preg_replace('#/[^/]*$#','',$mapFilePath); + mkdirp($filedir); + if (!move_uploaded_file($uploadMap['tmp_name'],$mapFilePath)) + { Abort("?cannot move uploaded map to $mapFilePath"); return; } + fixperms($mapFilePath,0444); + if ($LastModFile) { touch($LastModFile); fixperms($LastModFile); } + + // Sets the drawingBaseTime header for incremental save support. + header( "PmWikiDraw-DrawingBaseTime: ".filemtime( $drawingFilePath ) ); + + exit(); +} +?> diff -r a94fb46ff128 -r ca71ebe6af6d contrib/AnyWikiDraw/anywikidraw/pmwiki/cookbook/AnyWikiDraw/AnyWikiDrawForPmWiki.jar Binary file contrib/AnyWikiDraw/anywikidraw/pmwiki/cookbook/AnyWikiDraw/AnyWikiDrawForPmWiki.jar has changed diff -r a94fb46ff128 -r ca71ebe6af6d contrib/AnyWikiDraw/anywikidraw/pmwiki/cookbook/AnyWikiDraw/AnyWikiDrawForPmWiki.jar.pack.gz Binary file contrib/AnyWikiDraw/anywikidraw/pmwiki/cookbook/AnyWikiDraw/AnyWikiDrawForPmWiki.jar.pack.gz has changed diff -r a94fb46ff128 -r ca71ebe6af6d contrib/AnyWikiDraw/anywikidraw/pmwiki/cookbook/AnyWikiDraw/Splash.gif Binary file contrib/AnyWikiDraw/anywikidraw/pmwiki/cookbook/AnyWikiDraw/Splash.gif has changed diff -r a94fb46ff128 -r ca71ebe6af6d contrib/AnyWikiDraw/anywikidraw/pmwiki/cookbook/AnyWikiDraw/draw/PmWikiDraw.jar Binary file contrib/AnyWikiDraw/anywikidraw/pmwiki/cookbook/AnyWikiDraw/draw/PmWikiDraw.jar has changed diff -r a94fb46ff128 -r ca71ebe6af6d contrib/AnyWikiDraw/anywikidraw/pmwiki/cookbook/AnyWikiDraw/draw/edit.gif Binary file contrib/AnyWikiDraw/anywikidraw/pmwiki/cookbook/AnyWikiDraw/draw/edit.gif has changed diff -r a94fb46ff128 -r ca71ebe6af6d contrib/AnyWikiDraw/anywikidraw/pmwiki/cookbook/AnyWikiDraw/draw/images/images --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/contrib/AnyWikiDraw/anywikidraw/pmwiki/cookbook/AnyWikiDraw/draw/images/images Fri Oct 30 21:03:37 2009 +0100 @@ -0,0 +1,24 @@ +# Image file Please +# enter any images you would like your users to see in here, if the filename +# is not in here then the user will not be able to use that image in their +# drawings. +# +# Note that any subdirectories in here will appear as submenus/groups in the +# image selection utilities in PmWikiDraw +# To get a space in your group name please use the alternate chracter '_' in both +# the physical directory name and the reference below, the plugin +# will automatically convert '_' to ' ' for display but use it for fetching the image. +# This is to work around a strange bug in the latest (1.5.0 Java Applet VM) + +#Samples showing example grouping. +samples/Backgrounds/backgrnd.gif +samples/Backgrounds/bg1.gif +samples/Backgrounds/rain.gif +samples/Java_Related/javacentral.gif +samples/Java_Related/Juggler0.gif +samples/Java_Related/beans.gif +samples/Java_Related/DUKE.gif +samples/Java_Related/joe.surf.yellow.small.gif + +#Test to show that top level images work too. +rain.gif \ No newline at end of file diff -r a94fb46ff128 -r ca71ebe6af6d contrib/AnyWikiDraw/anywikidraw/pmwiki/cookbook/AnyWikiDraw/draw/images/rain.gif Binary file contrib/AnyWikiDraw/anywikidraw/pmwiki/cookbook/AnyWikiDraw/draw/images/rain.gif has changed diff -r a94fb46ff128 -r ca71ebe6af6d contrib/AnyWikiDraw/anywikidraw/pmwiki/cookbook/AnyWikiDraw/draw/images/samples/Backgrounds/backgrnd.gif Binary file contrib/AnyWikiDraw/anywikidraw/pmwiki/cookbook/AnyWikiDraw/draw/images/samples/Backgrounds/backgrnd.gif has changed diff -r a94fb46ff128 -r ca71ebe6af6d contrib/AnyWikiDraw/anywikidraw/pmwiki/cookbook/AnyWikiDraw/draw/images/samples/Backgrounds/bg1.gif Binary file contrib/AnyWikiDraw/anywikidraw/pmwiki/cookbook/AnyWikiDraw/draw/images/samples/Backgrounds/bg1.gif has changed diff -r a94fb46ff128 -r ca71ebe6af6d contrib/AnyWikiDraw/anywikidraw/pmwiki/cookbook/AnyWikiDraw/draw/images/samples/Backgrounds/rain.gif Binary file contrib/AnyWikiDraw/anywikidraw/pmwiki/cookbook/AnyWikiDraw/draw/images/samples/Backgrounds/rain.gif has changed diff -r a94fb46ff128 -r ca71ebe6af6d contrib/AnyWikiDraw/anywikidraw/pmwiki/cookbook/AnyWikiDraw/draw/images/samples/Java_Related/DUKE.gif Binary file contrib/AnyWikiDraw/anywikidraw/pmwiki/cookbook/AnyWikiDraw/draw/images/samples/Java_Related/DUKE.gif has changed diff -r a94fb46ff128 -r ca71ebe6af6d contrib/AnyWikiDraw/anywikidraw/pmwiki/cookbook/AnyWikiDraw/draw/images/samples/Java_Related/Juggler0.gif Binary file contrib/AnyWikiDraw/anywikidraw/pmwiki/cookbook/AnyWikiDraw/draw/images/samples/Java_Related/Juggler0.gif has changed diff -r a94fb46ff128 -r ca71ebe6af6d contrib/AnyWikiDraw/anywikidraw/pmwiki/cookbook/AnyWikiDraw/draw/images/samples/Java_Related/beans.gif Binary file contrib/AnyWikiDraw/anywikidraw/pmwiki/cookbook/AnyWikiDraw/draw/images/samples/Java_Related/beans.gif has changed diff -r a94fb46ff128 -r ca71ebe6af6d contrib/AnyWikiDraw/anywikidraw/pmwiki/cookbook/AnyWikiDraw/draw/images/samples/Java_Related/javacentral.gif Binary file contrib/AnyWikiDraw/anywikidraw/pmwiki/cookbook/AnyWikiDraw/draw/images/samples/Java_Related/javacentral.gif has changed diff -r a94fb46ff128 -r ca71ebe6af6d contrib/AnyWikiDraw/anywikidraw/pmwiki/cookbook/AnyWikiDraw/draw/images/samples/Java_Related/joe.surf.yellow.small.gif Binary file contrib/AnyWikiDraw/anywikidraw/pmwiki/cookbook/AnyWikiDraw/draw/images/samples/Java_Related/joe.surf.yellow.small.gif has changed diff -r a94fb46ff128 -r ca71ebe6af6d contrib/AnyWikiDraw/anywikidraw/pmwiki/cookbook/AnyWikiDraw/draw/news.gif Binary file contrib/AnyWikiDraw/anywikidraw/pmwiki/cookbook/AnyWikiDraw/draw/news.gif has changed diff -r a94fb46ff128 -r ca71ebe6af6d contrib/AnyWikiDraw/anywikidraw/pmwiki/cookbook/AnyWikiDraw/draw/symbols/flags.jar Binary file contrib/AnyWikiDraw/anywikidraw/pmwiki/cookbook/AnyWikiDraw/draw/symbols/flags.jar has changed diff -r a94fb46ff128 -r ca71ebe6af6d contrib/AnyWikiDraw/anywikidraw/pmwiki/cookbook/AnyWikiDraw/draw/symbols/sample.jar Binary file contrib/AnyWikiDraw/anywikidraw/pmwiki/cookbook/AnyWikiDraw/draw/symbols/sample.jar has changed diff -r a94fb46ff128 -r ca71ebe6af6d contrib/AnyWikiDraw/anywikidraw/pmwiki/cookbook/AnyWikiDraw/draw/symbols/symbols --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/contrib/AnyWikiDraw/anywikidraw/pmwiki/cookbook/AnyWikiDraw/draw/symbols/symbols Fri Oct 30 21:03:37 2009 +0100 @@ -0,0 +1,7 @@ +# Image file Please enter any symbol packs you would like your users to +# be able to usein here, if the filename is not in here then the +# user will not be able to use that symbol in their drawings. +# + +sample +flags \ No newline at end of file diff -r a94fb46ff128 -r ca71ebe6af6d contrib/AnyWikiDraw/anywikidraw/pmwiki/cookbook/AnyWikiDraw/edit.gif Binary file contrib/AnyWikiDraw/anywikidraw/pmwiki/cookbook/AnyWikiDraw/edit.gif has changed diff -r a94fb46ff128 -r ca71ebe6af6d contrib/AnyWikiDraw/demo/anywikidraw_for_twiki_demo.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/contrib/AnyWikiDraw/demo/anywikidraw_for_twiki_demo.html Fri Oct 30 21:03:37 2009 +0100 @@ -0,0 +1,45 @@ + + + + + + AnyWikiDraw for TWiki Demonstration + + +

+ This is a demonstration of the AnyWikiDraw drawing applet for TWiki.
+ This demo is running without TWiki, thus you can only edit the drawing, but you can not save it.
+

+ + + + + + + + + + + + + + + + + + + + + + + diff -r a94fb46ff128 -r ca71ebe6af6d contrib/AnyWikiDraw/demo/data/lion.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/contrib/AnyWikiDraw/demo/data/lion.svg Fri Oct 30 21:03:37 2009 +0100 @@ -0,0 +1,2 @@ + + \ No newline at end of file diff -r a94fb46ff128 -r ca71ebe6af6d contrib/AnyWikiDraw/demo/lib/Splash.gif Binary file contrib/AnyWikiDraw/demo/lib/Splash.gif has changed diff -r a94fb46ff128 -r ca71ebe6af6d contrib/AnyWikiDraw/guide/contents/changes.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/contrib/AnyWikiDraw/guide/contents/changes.html Fri Oct 30 21:03:37 2009 +0100 @@ -0,0 +1,126 @@ + + + AnyWikiDraw Changes + + + +

AnyWikiDraw Changes

+

0.14 2009-10-18

+

Enhancements

+
    +
  • Added support for MoinMoin Wiki.
  • +
  • Upgraded to JHotDraw 7.3.1.
  • +
+

+

0.13.3 2009-07-08

+

Fixes

+
    +
  • MediaWiki:
    + - Thumbnail image was not stored when no SVG converter was installed.
    + - A PHP error occured when the width or height was not specified in the drawing tag.
  • +
+

+

0.13.2 2009-07-07

+

Enhancements

+
    +
  • Added distinct plugins for TWiki version 4.1 and 4.3.
  • +
+

Fixes

+
    +
  • The first time the text of a figure was edited, the text field filled the whole drawing view.
  • +
+

0.13.1 2009-06-30

+

Fixes

+
    +
  • Switched off debug mode, because the applet did not work when used with the Sun J2SE 6 JVM.
  • +
+

0.13 2009-06-28

+

Enhancements

+
    +
  • Added support for MediaWiki 1.8, 1.10, 1.11, 1.13, 1.14, 1.15.
  • +
  • Upgraded to JHotDraw 7 revision 538.
  • +
+

Fixes

+
    +
  • The scribble tool does not create anymore control points which are far away.
  • +
  • The size of the drawing is now stored in SVG images.
  • +
+

0.12.11 2009-03-13

+

Enhancements

+
    +
  • Upgraded to JHotDraw 7 revision 476.
  • +
+

0.11 2008-05-28

+

Enhancements

+
    +
  • Redesigned toolbars of the drawing applet (work in progress).
  • +
  • MediaWiki: AnyWikiDraw works now also with MediaWiki 1.9.3 and 1.12.0.
  • +
+

Fixes

+
    +
  • Loading and Saving: The applet edits now always the current image, and not old versions of an image.
  • +
+

0.10 2007-06-03

+

Enhancements

+
    +
  • TWiki: Introducing support for TWiki.
  • +
+

Fixes

+
    +
  • Applet: Grid Toggle button was not always selected when the grid was turned on.
  • +
+

0.9

+

Enhancements

+
    +
  • PmWiki: Introducing support for PmWiki.
  • +
+

Fixes

+
    +
  • Applet: Entry fields for opacity and line width did not work.
  • +
  • MediaWiki: Image maps did not always work.
  • +
+

0.8 2007-05-27

+

Enhancements

+
    +
  • Applet: Implemented all new user interface for the drawing editor.
  • +
+

Fixes

+
    +
  • Applet: Fixed bugs with SVG files containing gradients.
  • +
  • MediaWiki: The server side code now properly stores the rendered PNG and HTML map files for the first revision of a drawing.
  • +
  • MediaWiki: When a drawing is sent to the applet, HTTP caching is now disabled, to prevent that an old version of a drawing is shown in the editor.
  • +
+

0.7 2007-04-24

+

Enhancements

+
    +
  • Applet: A change summary can now be entered.
  • +
  • Applet: Links can now be added to figures.
  • +
+

Fixes

+
    +
  • Applet: Fixes bugs with reading and writing SVG text areas and SVG path attributes.
  • +
  • MediaWiki: The server side code uses now variables from MediaWiki to determine the location of the applet files.
  • +
+

0.6 2007-04-16

+

Enhancements

+
    +
  • Applet: User preferences, such as whether the grid is on or off, are now rememberd.
  • +
+

Fixes

+
    +
  • Applet: The position of SVG Text figures was lost sometimes.
  • +
+

0.5 2007-04-15

+

Fixes

+
    +
  • Applet: Fixed several SVG issues.
  • +
+

0.4 2007-04-10

+

Enhancements

+
    +
  • MediaWiki: Introducing support for MediaWiki.
  • +
+ + + + diff -r a94fb46ff128 -r ca71ebe6af6d contrib/AnyWikiDraw/guide/contents/copyright.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/contrib/AnyWikiDraw/guide/contents/copyright.html Fri Oct 30 21:03:37 2009 +0100 @@ -0,0 +1,25 @@ + + + AnyWikiDraw Copyright + + + +

AnyWikiDraw Copyright

+

AnyWikiDraw is copyright by + AnyWikiDraw.org + and its contributors.

+

Project owners

+
    +
  • Werner Randelshofer, werner.randelshofer@bluewin.ch
  • +
  • Cjaran Jessup, ciaranj@gmail.com
  • +
+

Parts of the code are copyright by

+ + + + + diff -r a94fb46ff128 -r ca71ebe6af6d contrib/AnyWikiDraw/guide/contents/license.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/contrib/AnyWikiDraw/guide/contents/license.html Fri Oct 30 21:03:37 2009 +0100 @@ -0,0 +1,22 @@ + + + AnyWikiDraw License + + + +

AnyWikiDraw License

+

You can license most parts of AnyWikiDraw under the

+

Lesser GNU Public License (LGPL)
+
http://www.gnu.org/licenses/lgpl.html +

+

or under the

+

Creative Commons Attribution 3.0 License
+ http://creativecommons.org/licenses/by/3.0 +

+

Some server side code of AnyWikiDraw links with GNU licensed code.

+ You can license this code under the

+

GNU General Public License (GPL)
+ http://www.gnu.org/copyleft/gpl.html +

+ + diff -r a94fb46ff128 -r ca71ebe6af6d contrib/AnyWikiDraw/guide/contents/mediawiki.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/contrib/AnyWikiDraw/guide/contents/mediawiki.html Fri Oct 30 21:03:37 2009 +0100 @@ -0,0 +1,88 @@ + + + AnyWikiDraw for MediaWiki + + + + +

AnyWikiDraw for MediaWiki

+

Usage

+

To include a drawing in a MediaWiki page, write the following tag in the + page:

+

{{#drawing:drawing.svg|width|height}}

+
    +
  • The tag needs to be put into double curly braces.
  • +
  • The name of the tag is #drawing:
  • +
  • The parameter drawing.svg specifies the name of the drawing file.
  • +
  • The drawing file can have one of the following extensions + .svg, .png, + .jpg.
  • +
  • If you specify an drawing file that does not yet exist in your Wiki, + the drawing is created the first time you save a drawing.
  • +
  • The parameter width specifies the width of the drawing.
  • +
  • The parameter height specifies the height of the drawing.
  • +
+

Security considerations

+
    +
  • This is an experimental extension. Data loss may occur.
    + Install + it only on a Wiki system that does not contain critical data.
    +
    +
  • +
  • You need to grant access to session cookies to JavaScript and Java.
    + You may not want to do this if your wiki embeds JavaScript code from untrusted sources.
    + F + or example if your wiki embeds banners and advertisements from a third party system.

    +
    +
  • +
  • You need to allow file upload to your users.
    + You may not want to do this if your wiki allows user account creation by people not known to you.
  • +
+

Installation instructions

+
    +
  1. Enable Cookie access by JavaScript and Java Applets in the LocalSettings.php script:
    +
    + $wgCookieHttpOnly = false;
    +
    +
  2. +
  3. Enable file uploading in LocalSettings.php script:
    +
    + $wgEnableUploads = true;
    +
  4. +
  5. If you want to use AnyWikiDraw as SVG editor, make sure that you have properly installed and enabled SVG support on your MediaWiki server. For example, if you have installed ImageMagick on your server, you can activate SVG support using the following lines in the LocalSettings.php script:
    +
    + $wgUseImageMagick = true;
    +$wgImageMagickConvertCommand='/opt/local/bin/convert';
    +$wgSVGConverterPath='/opt/local/bin';
    +$wgFileExtensions[] = 'svg';
    +

    +
  6. +
  7. Place the AnyWikiDraw folder into + the extensions folder of your MediaWiki server.
    + Please note, that different versions of this extension exist for different versions of MediaWiki.
    +
    +
  8. +
  9. To activate this extension add the + following lines to your LocalSettings.php script:
    +
    + require_once("extensions/AnyWikiDraw/AnyWikiDraw.php");
  10. +
+

Summary of changes to LocalSettings.php

+

// Enable cookie access by JavaScript and Java Applets
+ $wgCookieHttpOnly = false;
+
+
// Enable file upload
+ $wgEnableUploads = true;

+
+ // Enable an SVG converter, for example ImageMagick
+ $wgUseImageMagick = true;
+ $wgImageMagickConvertCommand='/opt/local/bin/convert';
+ $wgSVGConverterPath='/opt/local/bin';

+ $wgFileExtensions[] = 'svg';
+

+
// Enable AnyWikiDraw
+ require_once("$IP/extensions/AnyWikiDraw/AnyWikiDraw.php");

+ + + + diff -r a94fb46ff128 -r ca71ebe6af6d contrib/AnyWikiDraw/guide/contents/moinmoin.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/contrib/AnyWikiDraw/guide/contents/moinmoin.html Fri Oct 30 21:03:37 2009 +0100 @@ -0,0 +1,15 @@ + + + AnyWikiDraw for TWiki + + + +

AnyWikiDraw for MoinMoin

+

Usage

+

To do

+

Installation instructions

+

To do

+ + + + diff -r a94fb46ff128 -r ca71ebe6af6d contrib/AnyWikiDraw/guide/contents/pmwiki.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/contrib/AnyWikiDraw/guide/contents/pmwiki.html Fri Oct 30 21:03:37 2009 +0100 @@ -0,0 +1,42 @@ + + + AnyWikiDraw for PmWiki + + + +

AnyWikiDraw for PmWiki

+

Usage

+

To include a drawing in a PmWiki page, write the following tag in the + page:

+

(:drawing drawing.svg|width|height:)

+
    +
  • The tag needs to be put into smileys.
  • +
  • The name of the tag is drawing
  • +
  • The parameter drawing.svg specifies the name of the drawing file.
  • +
  • The drawing file can have one of the following extensions + .draw, .svg, .svgz, .png, + .jpg.
  • +
  • If you specify a drawing file that does not yet exist in your Wiki, + the drawing is created the first time you save a drawing.
  • +
  • The parameter width specifies the width of the drawing.
  • +
  • The parameter height specifies the height of the drawing.
  • +
+

Installation instructions

+
    +
  1. This is an experimental cookbook. Data loss may occur. Install + it only on a Wiki system that does not contain critical data.
  2. +
  3. This extension adds inline drawing editing support to your Wiki. + Make sure, that you have proper licenses for all drawings on your + Wiki.
  4. +
  5. Deinstall the PmWikiDraw cookbook. AnyWikiDraw includes the + PmWikiDraw cookbook. Having them installed both will result into + conflicts between the two cookbooks.
  6. +
  7. To activate this cookbook, place the AnyWikiDraw folder into + the cookbooks folder of your PmWiki server, and add the + following line to your config.php script:
     
    + include_once("cookbook/AnyWikiDraw/AnyWikiDraw.php");
  8. +
+ + + + diff -r a94fb46ff128 -r ca71ebe6af6d contrib/AnyWikiDraw/guide/contents/readme.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/contrib/AnyWikiDraw/guide/contents/readme.html Fri Oct 30 21:03:37 2009 +0100 @@ -0,0 +1,26 @@ + + + AnyWikiDraw Read Me + + + +

AnyWikiDraw Read Me

+

AnyWikiDraw adds support for drawing directly into a Wiki page. +

The following file formats are supported:

+
    +
  • Scaleable Vector Graphics (.svg, .svgz)
  • +
  • Portable Network Graphics (.png)
  • +
  • Joint Photographics Expert Group (.jpg, .jpeg)
  • +
  • PmWikiDraw (.draw) only supported on PmWiki
  • +
+

The following Wikis are supported:

+ + + + + diff -r a94fb46ff128 -r ca71ebe6af6d contrib/AnyWikiDraw/guide/contents/style.css --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/contrib/AnyWikiDraw/guide/contents/style.css Fri Oct 30 21:03:37 2009 +0100 @@ -0,0 +1,156 @@ +@charset "UTF-8"; +/* CSS Document */ + +* { + font-family: Verdana, Helvetica, Arial, sans-serif; + font-size: 12px; + line-height: 125%; /* = 15 pixel for 12 px fonts */ + text-align: left; + margin: 0px; + padding: 0px; +} +body { + margin: 10px; + padding: 0px; +} +code { + font-family: Courier, monospace; +} +h1, h2, h3, h4 { + font-family: Tahoma, Helvetica, Arial, sans-serif; +} +h1 { + font-size: 28px; + margin: 0px 0 18px 0; + font-weight: bold; + line-height: 100%; +} +h2 { + font-size: 20px; + font-weight: bold; + margin: 18px 0 18px 0; + line-height: 120%; +} +h3 { + font-size: 18px; + font-weight: normal; + line-height: 120%; + margin: 18px 0 18px 0; +} +h4 { + font-weight: bold; +} +p { + margin-bottom: 9px; +} +p+h2, ul+h2 { + margin-top: 36px; +} +ul { + margin-bottom: 9px; + margin-left: 16px; +} +ol { + margin-bottom: 9px; + margin-left: 16px; +} + + +table { + margin-bottom: 18px; +} +th { + padding: 2px; + font-weight: bold; +} +td { + padding: 2px; +} +b, strong, i { + font-size:inherit; +} + +#header { +} +#footer { +} +#nav1 { + background-color: #F0F0F0; +} +#nav2 { + background-color: #F0F0F0; +} + + + +#notationBody, #noteBody, #cubeBody, #scriptBody { + width: 600px; +} +#notationBody table { + +} +#notationBody td { + background-color: #F0F0F0; +} +#notationBody th { + background-color: #CCCCCC; +} +#notationBody td.rowspacer { + background-color: #fff; +} + +.listing { + font-family: Courier, monospace; + background-color: #f0f0f0; + padding: 6px 8px 6px 8px; + margin-bottom: 16px; + border: solid 1px #CCCCCC; +} + +.listingTopFragment { + font-family: Courier, monospace; + background-color: #f0f0f0; + padding: 6px 8px 6px 8px; + margin-bottom: 16px; + border-top: solid 1px #CCCCCC; + border-right: solid 1px #CCCCCC; + border-left: solid 1px #CCCCCC; + border-bottom: dotted 1px #CCCCCC; +} +.listingMiddleFragment { + font-family: Courier, monospace; + background-color: #f0f0f0; + padding: 6px 8px 6px 8px; + margin-bottom: 16px; + border-top: dotted 1px #CCCCCC; + border-right: solid 1px #CCCCCC; + border-left: solid 1px #CCCCCC; + border-bottom: dotted 1px #CCCCCC; +} +.listingBottomFragment { + font-family: Courier, monospace; + background-color: #f0f0f0; + padding: 6px 8px 6px 8px; + margin-bottom: 16px; + border-top: dotted 1px #CCCCCC; + border-bottom: solid 1px #CCCCCC; + border-right: solid 1px #CCCCCC; + border-left: solid 1px #CCCCCC; +} + + +.tip { + color: #333; + font-size: 10px; +} +.description { + font-size: 10px; +} +.marginalia { + font-size: 10px; + text-align: right; + padding-right: 10px; +} +.paddingdouble { + padding-top: 16px; +} diff -r a94fb46ff128 -r ca71ebe6af6d contrib/AnyWikiDraw/guide/contents/twiki.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/contrib/AnyWikiDraw/guide/contents/twiki.html Fri Oct 30 21:03:37 2009 +0100 @@ -0,0 +1,41 @@ + + + AnyWikiDraw for TWiki + + + +

AnyWikiDraw for TWiki

+

Usage

+

To include a drawing in a TWiki page, write the following tag in the + page:

+

%ANYWIKIDRAW{ "drawing.svg" width="240" height="320"}%
+ %AWDRAW{ "drawing.svg" width="240" height="320"}%

+
    +
  • The parameter drawing.svg specifies the name of the drawing file.
    +
  • +
  • The drawing file can have one of the following extensions .draw, .svg, .svgz, .png, .jpg.
    +
  • +
  • If you specify a drawing file that does not yet exist in your Wiki, the drawing is created the first time you save a drawing.
    +
  • +
  • The parameter width specifies the width of the drawing.
    +
  • +
  • The parameter height specifies the height of the drawing.
  • +
+

Installation instructions

+
    +
  1. This is an experimental plugin. Data loss may occur. Install + it only on a Wiki system that does not contain critical data.
    +
    +
  2. +
  3. Copy the AnyWikiDraw files over + the TWiki server files.
    + Please note, that different versions of this plugin exist for different versions of TWiki.
    +
    +
  4. +
  5. Enable the AnyWikDrawPlugin on the + configuration page of TWiki.
  6. +
+ + + + diff -r a94fb46ff128 -r ca71ebe6af6d contrib/AnyWikiDraw/guide/index.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/contrib/AnyWikiDraw/guide/index.html Fri Oct 30 21:03:37 2009 +0100 @@ -0,0 +1,14 @@ + + + + +PocketPlayer + + + + + + +<body> +</body> + diff -r a94fb46ff128 -r ca71ebe6af6d contrib/AnyWikiDraw/guide/nav.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/contrib/AnyWikiDraw/guide/nav.html Fri Oct 30 21:03:37 2009 +0100 @@ -0,0 +1,25 @@ + + + + +Navigation + + + + +
AnyWikiDraw
+ +
Usage and Installation
+ +

 

+ + diff -r a94fb46ff128 -r ca71ebe6af6d contrib/AnyWikiDraw/src.tar.bz Binary file contrib/AnyWikiDraw/src.tar.bz has changed