Final Extract plugin for cpg 1.5.x Final Extract plugin for cpg 1.5.x
 

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Main Menu

Final Extract plugin for cpg 1.5.x

Started by François Keller, November 28, 2009, 06:58:11 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

François Keller

Hi all,

I've ported the Final_Extract plugin for cpg1.5.x

The final_extract plugin removes core blocks from the final HTML produced by Coppermine, just before it is displayed to the user on the web page.  This is probably the best way to remove things like menu buttons and other core items like links & buttons throughout the various pages Coppermine produces.
This plugin version comes with usergroup settings by admin panel: You can define for each usergroup the menu elements to display (or to hide). 
the  settings are done by admin panel.  If a new group is created , it is taken into account and can be also parameterized. 
This plugin is multilangage. currently  "english"  "german" and "french" language files exists.
feel free to share your own lang file with the Coppermine community.

Version 1.1
Two known issues corrected

Known Issues:

They are some little issues in this version, so if someone can have a look  ;D

   *The language detection doesn't work while uninstalling the plugin
   *If you select "keep the table used for the pluging " while uninstalling, the table is still deleted (Fixed in version 1.1)
   *The check all javascript doesn't work (Fixed in version 1.1)
Avez vous lu la DOC ? la FAQ ? et cherché sur le forum avant de poster ?
Did you read the DOC ? the FAQ ? and search the board before posting ?
Mon Blog

Nibbler

Please remove extraneous files when you package plugins. You have included a __MACOX directory, several .svn directories and a .DS_Store file. For the uninstall issue, you are checking whether the 'drop' key exists - you should instead be checking if it is 1.

François Keller

Thank's Nibbler, i'll have a look at this and apologise for the unexpected files
Avez vous lu la DOC ? la FAQ ? et cherché sur le forum avant de poster ?
Did you read the DOC ? the FAQ ? and search the board before posting ?
Mon Blog

François Keller

Version 1.1 Attached to the very first post.
Issues corrected:
Javascript "select all" work's now
Unistall delete database plugin table if option selected.
Only one known issue with the lang detection who doesn't work for unistallation form
Avez vous lu la DOC ? la FAQ ? et cherché sur le forum avant de poster ?
Did you read the DOC ? the FAQ ? and search the board before posting ?
Mon Blog

Joe Carver

Very nice work!

It might be my setup, but I am seeing different output depending on the Theme (standard 1.5.2) being used. It seems only that the difference is with the Sub menu.

You can see here CPG 1.5.2 Gallery

I have hidden last comments, top-rated and login buttons using Final Extract. In the footer I have pasted/hacked in a theme select list to make selection easier. Debug is on for all at the moment.

François Keller

you're right, it seems depending with the theme who use grafical sub mens. i 'll have a look at his ASP
Avez vous lu la DOC ? la FAQ ? et cherché sur le forum avant de poster ?
Did you read the DOC ? the FAQ ? and search the board before posting ?
Mon Blog

homeuser

Hi,

at the moment I play a little around with 1.5x. There is no installation available via internet.
I have found some errors, I like to share with you.
First, I recogonized a new release v2.4 for 1.5x. But the installation never works. I sneak into the source code and detect there is no supercage-code in it.
My guess, v2.4 is for 1.4x not 1.5x as mentioned in the filename of the attachment in the first posting and on sourceforge.

Next, the configuration.php is defective, a wrong CR/LF brokes the plugin display with an error message.
Find:
$author='Donnoman@donovanbray.com from <a href="http://cpg-contrib.org" target="_blank">cpg-contrib.org</a>&nbsp;<b>
Modified by:</b> BMossvari at gmail dot com <a href="http://www.myprj.com" target="blank">Myprj.com</a><br>Modified and ported for CPG 1.5.x by<a href="http://forum.coppermine-gallery.net/index.php?action=profile;u=9980" target="blank">Frantz</a>';

Replace with:
$author='Donnoman@donovanbray.com from <a href="http://cpg-contrib.org" target="_blank">cpg-contrib.org</a><br /><b>Modified by:</b> BMossvari at gmail dot com <a href="http://www.myprj.com" target="blank">Myprj.com</a><br />Modified and ported for CPG 1.5.x by <a href="http://forum.coppermine-gallery.net/index.php?action=profile;u=9980" target="blank">Frantz</a>';


plugin_config.php.
Just a little optical improvement. A space between the version display and the last dash. ;)
Find:
starttable('100%', 'Final Extract for CPG 1.5.x - '.$lang_plugin_final_extract['version'].'- <a href="pluginmgr.php" class="admin_menu">Plugin Manager</a>', 3);

Replace with:
starttable('100%', 'Final Extract for CPG 1.5.x - '.$lang_plugin_final_extract['version'].' - <a href="pluginmgr.php" class="admin_menu">Plugin Manager</a>', 3);


1.5x uses other language variables for "continue".
Find:
        msg_box($lang_plugin_final_extract['display_name'], $lang_plugin_final_extract_delete['nothing_changed'], $lang_continue, 'index.php?file=final_extract/plugin_config');

Replace with:
        msg_box($lang_plugin_final_extract['display_name'], $lang_plugin_final_extract_delete['nothing_changed'], $lang_common['continue'], 'index.php?file=final_extract/plugin_config');


Find:
        msg_box($lang_plugin_final_extract['display_name'], $lang_plugin_final_extract_delete['success'], $lang_continue, 'index.php?file=final_extract/plugin_config');

Replace with:
        msg_box($lang_plugin_final_extract['display_name'], $lang_plugin_final_extract_delete['success'], $lang_common['continue'], 'index.php?file=final_extract/plugin_config');


A simple typo:
Find:
            <td align="center" valign=top class=tableb><input name="lastcom" type="checkbox"  <?php if($row2['lasctom']==1) { echo 'checked="cheked"';$nb++;} ?>/></td>

Replace with:
            <td align="center" valign=top class=tableb><input name="lastcom" type="checkbox"  <?php if($row2['lastcom']==1) { echo 'checked="cheked"';$nb++;} ?>/></td>


Remove the error with the wrong language at uninstall.
codebase.php
Find:
function final_extract_cleanup($action)
{
    global $lang_plugin_final_extract_config;

Replace with:
function final_extract_cleanup($action)
{
    global $CONFIG, $lang_common, $lang_plugin_final_extract_config;


Also use the correct language for the Yes/No selection:
Find:
               <td>Yes</td>

Replace with:
               <td>{$lang_common['yes']}</td>


Find:
               <td>No</td>

Replace with:
               <td>{$lang_common['no']}</td>



Some little improvement. Added an "uncheck all" button as opposite to the "check all" button.

plugin_config.php
Find:
//onload = change;
</script>

Before add:
function uncheck_all(formname) {
i=0;
while(document.getElementById(formname).elements[i]) {
document.getElementById(formname).elements[i].checked="";
i+=1;
}
}


Find:
            <tr>
                <td class=tableb align="<?php echo $align ?>" dir="<?php echo $direction ?>">&nbsp;</td>
                <td align="center" valign=top class=tableb>&nbsp;&nbsp;
                  <input class="button" type="button" value="<?php echo $lang_plugin_final_extract_manage['list_chkall']; ?>" name="restore_config" onclick="return check_all('blocks');"></td>
              </tr>

Replace with:
            <tr>
                <td colspan="2" align="right" valign=top class=tableb>
                  <input class="button" type="button" value="<?php echo $lang_plugin_final_extract_manage['list_chkall']; ?>" name="restore_config" onclick="return check_all('blocks');">&nbsp;
                  <input class="button" type="button" value="<?php echo $lang_plugin_final_extract_manage['list_unchkall']; ?>" name="restore_config" onclick="return uncheck_all('blocks');"></td>
              </tr>


lang/english.php
Find:
'list_chkall' => 'Check All', // CPA 1.2.2

After add:
'list_unchkall' => 'Uncheck All',


lang/french.php
Find:
'list_chkall' => 'Sélectionner tout', // CPA 1.2.2

After add:
'list_unchkall' => 'Sélectionner rien',

Or add a better french translation. :)

At last I reworked the german translation (attached), e.g. the translation for "my_profile_block" was completely missing.
The language variables list_submit, list_restore and list_stat seemes to be ununsed.

There is always a warning in the debug-infos:
Quote/plugins/final_extract/include/init2.inc.php
    * Warning line 24: mysql_free_result(): supplied argument is not a valid MySQL result resource
I have no idea yet, how to deal with it.

Hope this helps.

François Keller

thank's for sharing your improvements.

I'll have a loock at this ASP (I'm working on another poject on this moment...)
Avez vous lu la DOC ? la FAQ ? et cherché sur le forum avant de poster ?
Did you read the DOC ? the FAQ ? and search the board before posting ?
Mon Blog

Joachim Müller

I'm looking into this - please stand by.

François Keller

Avez vous lu la DOC ? la FAQ ? et cherché sur le forum avant de poster ?
Did you read the DOC ? the FAQ ? and search the board before posting ?
Mon Blog

Joachim Müller

The version in the SVN indeed is the one for cpg1.4.x and not for cpg1.5.x. Plugin currently doesn't work as expected. I have partially comitted fixes. Work still in progress.

François Keller

Not sure i understand.
The pluging version i attached on the very first post (version 1.1) was working for me on my testbed and was designed for cpg1.5.x
The 2.4 version attached is not the cpg1.5 version (i d'on't know who has attached this here  ;)) maybe is this mistake the fault...
Avez vous lu la DOC ? la FAQ ? et cherché sur le forum avant de poster ?
Did you read the DOC ? the FAQ ? and search the board before posting ?
Mon Blog

gldickens3

I am trying to migrate my 1.4.26 Coppermine installations to version 1.5.6.  I installed the Final Extract plugin file from this thread which is named: "cpg_1.5.x_plugin_final_extract_ver1.1.zip". The plugin will not install and instead I get the following error in my browser:

QuoteCritical error
There was an error while processing a database query

I then implemented the modifications listed by homeuser in Reply #6 to the plugin, however that does not work either and results in the same error message.

Am I doing something wrong or is this plugin broken on cpg 1.5.x?

Thanks,

Gordon

François Keller

Quote from: Joachim Müller on March 08, 2010, 09:32:28 AM
The version in the SVN indeed is the one for cpg1.4.x and not for cpg1.5.x. Plugin currently doesn't work as expected. I have partially comitted fixes. Work still in progress.
please wait the time someone look into this. But you can enable debug mod to have the entire error message that can help to find what's going wrong
Avez vous lu la DOC ? la FAQ ? et cherché sur le forum avant de poster ?
Did you read the DOC ? the FAQ ? and search the board before posting ?
Mon Blog

gldickens3

Hi François

Thanks for the tip to run in debug mode!  I got the plugin working.  Basically, the mysql scripts in the plugin had a couple of typos and the install script does not execute properly.  Attached is a working version of the Final Extract plugin which is based on the "cpg_1.5.x_plugin_final_extract_ver1.1.zip" file in the first post of this tread with the following modifications:

1) Implemented the modifications listed by homeuser in Reply #6 to the plugin.
2) Modified schema.sql to rename the Final Extract table "cp_final_extract_config" instead of "CPG_final_extract_config".
3) Modified basic.sql to rename the Final Extract table "cp_final_extract_config" instead of "CPG_final_extract_config".
4) Modified basic.sql to add a missing single quote for the last field's value in the fourth INSERT command.

Everything now works except for the plugin installation which still does not install and populate the "cp_final_extract_config" table as I think that it should. I am not sure why the install scripts don't execute properly, however, if you run mysql scripts manually as follows then everything works perfectly thereafter:

mysql -u<username> -p<password> -D<database> < schema.sql
mysql -u<username> -p<password> -D<database> < basic.sql

FYI,

Gordon

François Keller

Thank's  for your contribution, bt you have forgotten to attach the file  ;)
Avez vous lu la DOC ? la FAQ ? et cherché sur le forum avant de poster ?
Did you read the DOC ? the FAQ ? and search the board before posting ?
Mon Blog

gldickens3

Hi François

Yes, I forgot to attach the file.  Duh.... Sorry about that!  :o

Attached is a working version of the Final Extract plugin which has been modified as described in my prior post. As I mentioned, everything works except for the plugin installation which still does not install and populate the "cp_final_extract_config" MySQL table. Therefore, you must run the mysql scripts manually and then everything works perfectly thereafter.

Gordon


Αndré

Quote from: gldickens3 on July 04, 2010, 10:53:07 PM
Everything now works except for the plugin installation which still does not install and populate the "cp_final_extract_config" table as I think that it should. I am not sure why the install scripts don't execute properly
Quite obvious:
Quote from: gldickens3 on July 04, 2010, 10:53:07 PM
2) Modified schema.sql to rename the Final Extract table "cp_final_extract_config" instead of "CPG_final_extract_config".
3) Modified basic.sql to rename the Final Extract table "cp_final_extract_config" instead of "CPG_final_extract_config".
You mustn't rename the table prefix, as it gets replaced by the installer:
Code (codebase.php) Select
$sql_query = preg_replace('/CPG_/', $CONFIG['TABLE_PREFIX'], $sql_query);

gldickens3

Quote from: Αndré on July 05, 2010, 02:02:45 PM
Quite obvious:You mustn't rename the table prefix, as it gets replaced by the installer:
Code (codebase.php) Select
$sql_query = preg_replace('/CPG_/', $CONFIG['TABLE_PREFIX'], $sql_query);


Hi Αndré,

Well, that doesn't work either.  You get the following error:

QuotemySQL error: Table '<database_name>.cp_final_extract_config' doesn't exist

With the table prefix set to CPG_ the "CPG_final_extract_config" table is never created by the script and so it never gets the chance to do the /CPG_/cp_/ replacement.

Gordon

Αndré

Please re-install the plugin using version 1.2 I attached to the initial post and everything works fine :)