01447: Feedback on new installation and suggestions

Summary: Feedback on new installation and suggestions
Created: 2019-12-04 18:58
Status: Open
Category: Feature
From: Ben
Priority: 2
Version: 2.2.120
OS: Windows, PHP 7.3.11

Description: I love pmwiki, it is awesome, I can write long stories about it. I do have a couple of suggestions please:

1. File upload / image drag and drop should be enabled by default or made easier. I had a hard time getting it to work, for months, tried various recipes, assumed it never works, you name it, no luck or useful error, despite these:

$DDMUEnableDropzone = 1;
include_once ("$FarmD/cookbook/ddmu.php");
$EnableUpload = 1;
$UploadPrefixFmt = '';
$UploadMaxSize = 500000;
$DefaultPasswords['upload'] = '';

I finally accidentally discovered that you need this:

  $UploadDir = "C:/xampp/htdocs/pmwiki/pub/images";          (under Windows)


  $UploadDir = "/home/compcom/public_html/php/pmwiki/pub/images";   (under linux)

And the suddenly it all works...! Otherwise no go with no explanation... This is not clearly covered by the docs or recipes.

Now I can upload or drag and drop an image. Very nice. I still have to change the "Attach:xx.png" to "{$Imagedir}xx.png" (would be nice if that can be fixed) but it beats having to copy the files physically to the machine.

2. The editing buttons should be enabled by default and more added, even if you make them a drop down or define one variable that adds more or something. Add some default buttons for foreground and background colours etc. Otherwise you can spend a while figuring out need a quote to disable a wiki word or [@ @] to show code.

I think pmwiki is awesome and these tweaks will make it so much nicer by default.

Ben December 04, 2019, at 06:58 PM

Welcome, and thank you for your feedback. Sorry you had difficulties for months, next time please quickly notify us either on the talk pages in the documentation (where you would have expected to find the missing information), or via the mailing lists (people would have quickly responded), or indeed here.

Editing is enabled password-free in the default PmWiki installation (see PasswordsAdmin on how to restrict this). Uploads are disabled by default because allowing anyone to upload any file on your server may have critical security implications. In addition, depending on the website nature, uploads can be attached per-group, per-page or per-wiki, and the admins should be informed of that before they make the decision (once the decision is made and there are files uploaded to the wiki and with links from the pages, it is complex and a lot of work to change this setting). That's why we have the page UploadsAdmin to explain how to enable them and it is a required read for wiki admins. Note that many hosting environments will run a file named like "file.php.txt" or "file.php.jpg" in the PHP processor and may open the server for takeover. This requires competence and additional server and PmWiki configuration.

I assure you that in the very large majority of cases you don't need to define the $UploadDir variable -- it will point to the "uploads" directory (relative to either index.php or pmwiki.php, see below). On some servers you may need to create this directory and set the correct permissions but almost everywhere else this is not needed.

Also, should you set this variable to change the directory, you'd better use a relative path, not an absolute path starting with "C:/" or with "/", for example:

  $UploadDir = "pub/images"; # on both Windows and Unix

This is relative to the directory where your index.php is, or if you don't have a script which includes pmwiki.php, then it is relative to the directory where pmwiki.php is.

This will also make the Attach: links to work fine without replacing the prefix with a page variable. At any rate, if PmWiki is really unable to set the upload URLs correctly (could happen in highly customized cases or some WikiFarms), there is the variable $UploadUrlFmt that can be set so point to the browser-reachable base URL under which your files are uploaded. This way the Attach: prefix will work fine:

  $UploadUrlFmt = "$UrlScheme://{$_SERVER['SERVER_NAME']}/php/pmwiki/pub/images";

(You could do this in a conditional for the local and online wikis. Again, this should be not necessary for 99.99% of the installations if you leave $UploadDir alone or define it as a relative path.)

In addition, if you do need to have an easy to use prefix other than Attach: see the documentation for InterMap.

I agree that the editing buttons may be enabled by default -- I always enable them. I'll see how the other wiki administrators feel about it -- one of the points in the PmWiki philosophy is that it is easy to maintain and upgrade, and the upgrade should not surprise or break existing installations.

I also agree about the drag-and-drop uploads, a feature similar to the DDMU recipe will be included in the core in the future but will be disabled by default so that only people who need the feature can enable it. Petko December 05, 2019, at 08:06 AM

Thank you! I can confirm that your line works under Windows and Unix. I have modified my comments in UploadsAdmin to reflect that. And the UploadUrlFmt also works.... oooooo!!!!!!! Sweet..... Thank you. As for the editing buttons, maybe define a line in config.php that people can uncomment if they want all the buttons? If if they added their own, then they can decide how to handle it.

These lines are already in docs/sample-config.php, both the $EnableGUIButtons and a number of buttons are commented out near the end of that file. --Petko December 05, 2019, at 03:39 PM