How to convert CPG Plugin to a MX-CPG Plugin

Begonnen von Beyond_Doubt, 27 Februar 2006, 00:51:38

⏪ vorheriges - nächstes ⏩

0 Mitglieder und 1 Gast betrachten dieses Thema.


Appologies, but this is an English only post; I know no German.

I have a PragmaMX installation with MX-CPG 1.4.3.
In that installation I have added a few Plugins from the CPG site.
Some of these Plugins required small modifications to the codebase.php before they would work.
Usually this modification was just to change...
require ('plugins/control_fullsize/include/');
require (dirname(__FILE__).'/include/');

However I am very eager to use the 'File Replacer' Plugin that can be found here.

But when I use that Plugin, and then click on the 'Replace File' button I get the following error message...
ZitatSorry, you can't access this file directly, parameter 'name' is required...

So, I am asking for some help here.
Are there any modifications that need to be made to basic CPG code to convert it to MX-CPG that I have missed?
Or, more to the point, can someone get this plugin working in MX-CPG for me?


Thanks in advance!


Hi :)

yes, that's a really great plugin.

There is only few changes necessary in the codebase.php.

In links, the correct and complete filename is required:
#$data['menu'] .= ' <a href="?replacer_pid='.$data['pid'].'"  class="admin_menu">Replace file</a>';
should be$data['menu'] .= ' <a href="displayimage.php?replacer_pid='.$data['pid'].'"  class="admin_menu">Replace file</a>';

on includes, the full path is needed, we can use the bridge-Constant "MXCPG_PATH_INCLUDE" require('include/');
should be:require(MXCPG_PATH_INCLUDE.'');

"header location" doesn't work correctly in the pragmaMx Bridge. We use the bridge-Function mxcpg_redirect()header("Location: {$CONFIG['site_url']}/displayimage.php?pos=-$pid");
should be: mxcpg_redirect(MXCPG_MODLINK."&act=displayimage&pos=-$pid");MXCPG_MODLINK is a bridge-Constant which stores "modules.php?name=Gallery"

in forms, the action attribute is required: echo '<form method="post" enctype="multipart/form-data">';
should be:echo '<form method="post" action="displayimage.php?replacer_pid='.$pid.'" enctype="multipart/form-data">';And here, the "replacer_pid" is required in the URL.

I do not know, whether it is a fundamental problem of the Plugins, but in my testing gallery the link "replace file" was indicated doubly in the menu.
Therefore I built the following additional code into the function  menu():static $check;
if (isset($check))
return $data;

Enclosed the changed file ;)

@ all
Ja, das komplette Plugin stellen wir in die Downloads ;)
schön´s Grüssle, Andi


Thank you Andi for a quick, and informative, reply. :)

I really appreciate your help on this issue. There was no way I was going to catch all those changes!


hello :)
no problem, that happened gladly.
We will also use this Addon....  :thumbup:
schön´s Grüssle, Andi


schön´s Grüssle, Andi


Thank you again :)

I should also like to make a quick reminder to anyone interested in using this plugin that to let the regular site users have the option of replacing their files you will need to enable Allow users to retain control over their pics in public galleries in the User Settings section of the Gallery Config screen.

Of course a site admin can always do this. :)