phpapachepluginsdokuwiki

Plugin in dokuwiki causes wiki to block images


I have written an own plugin. Everything works fine except for the mediamanager.

If i open the mediamanager i cannot see any of the thumbnails. If i try to upload some new pictures, apache crashs.

After some experimenting around, i figured out that this code snippet causes the error:

If you place this under

/lib/plugins/lfs/action.php

And open the mediamanager and upload a new picture to wiki:

Could someone please test this? And does someone see my mistake? Thanks

<?php
/**
 * Example Action Plugin: Inserts a button into the toolbar
 *
 */
if (!defined('DOKU_INC')) die();

class action_plugin_lfs extends DokuWiki_Action_Plugin {
    // Register the eventhandlers
    function register(Doku_Event_Handler $controller) {
        $controller->register_hook('TOOLBAR_DEFINE', 'AFTER', $this, 'insert_button', array ());
    }

    public function insert_button(Doku_Event $event, $param) {

        $event->data[] = array (
            'type'   => 'mediapopup',
            'title'  => 'Link zu Dateien auf dem Netzlaufwerk',
            'icon'   => '../../plugins/lfs/buttonlink.png',
            'url'    => '../lib/plugins/lfs/browser.php?useless=',
            'name'   => 'winsharelink',
            'options'=> 'width=750,height=500,left=20,top=20,scrollbars=yes,resizable=yes',
            'block'  => false,
        );

    }
} 
?>

UPDATE 1:

Used Server: xampp 3.2.2 under Win10 (local) PHP: 7.1.10 Apache: 2.4.28.0 WIN32

Today apache did not crash after i tried to load the thumbnail of the uploaded picture or the picture itself.

But it is still not working.

Here a picture WITH action.php in place under lib/plugins/lfs/ Media Manager with action.php in place

Direct Link to the image with action.php in place

And then, just moved action.php out of the lfs folder and deleted and reuploaded logo3.png:

Works without action.php

UPDATE 2:

No i tested it with EasyPHP. Still the same result.

UPDATE 3:

Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/dokuwiki/lib/plugins/lfs/action.php:1) in /var/www/html/dokuwiki/inc/actions.php on line 210

Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/dokuwiki/lib/plugins/lfs/action.php:1) in /var/www/html/dokuwiki/lib/tpl/dokuwiki/main.php on line 12

Solution

  • Problem Solved!!!

    You should never!!!! Have idents in your code-file:

    |
    |  <?php....
    |
    

    is not the same than

    |
    |<?php...
    |
    

    is!!!

    There are some spaces which are sent to the browser. Therefore the "header already sent error appears!"

    Damn! such a stupid error delays the developemnt many days and weeks...