Ported Ported
 

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

Ported

Started by cmfa, January 28, 2011, 08:09:46 PM

Previous topic - Next topic

0 Members and 3 Guests are viewing this topic.

cmfa

Hi @ all,

I wanted to ask here whether the specified plug-in in the version 1.5x can be ported, would have great interest in it.

Regards
CMFA :P

Stramm

I'm nearly sure it can be ported but I doubt one of the devs here will do it. And the author didn't came here the past 6 month.


cmfa

Hi,

thanks for the info, this is not good.

Of this Plugin this belongs, perhaps, to the basic equipment of the gallery ode siehts you differently?

CMFA

Αndré

Quote from: cmfa on January 29, 2011, 09:25:44 AM
Of this Plugin this belongs, perhaps, to the basic equipment of the gallery ode siehts you differently?
I'm not really sure what you ask for. Do you want this as a core feature of Coppermine?

Regarding the porting of that plugin, I haven't looked at it. But in the most cases all you have to do is to 'Inspektify' the plugin (means that you have to replace the access to superglobals with some Inspekt code). It's highly recommended to use Inspekt, but a quick & dirty way would be to re-globalize the superglobals, e.g. the external tracker plugin does it that way:
    $_GET=$superCage->get->_source; //these are needed for the 3rd party php files
    $_POST=$superCage->post->_source;
    $_COOKIE=$superCage->cookie->_source;
    $_ENV=$superCage->env->_source;
    $_FILES=$superCage->files->_source;
    //$_SESSION=$superCage->session->_source; $_SESSION isn't yet supported by makeSuperCage
    $_SERVER=$superCage->server->_source;

cmfa

Hi,

Quote from: Αndré on January 29, 2011, 11:08:42 AM
I'm not really sure what you ask for. ?

yes,  core feature of Coppermine!

I have not completely understood the code yet where should I search him and what exactly should I change?

CMFA

Αndré

Just have a look at the plugin. All occurrences of $_ have to be replaced with Inspekt code, or the quick & dirty method I just mentioned.

Please post your feature request in the feature requests board.

cmfa

Hi,

so I get the right start here is my first attempt. Can you please see if the approach is right?

old

function rank_install() {
global $CONFIG;
    // Install
if ($_POST['submit'] == 'submit') {

return true;

    // Loop again
    } else {

        return 1;
    }

}   


new

function rank_install() {
global $CONFIG;
$superCage = Inspekt::makeSuperCage();
    // Install
if ($_Post=$superCage->post->('submit')) {

return true;

    // Loop again
    } else {


        return 1;
    }

}


Error Message
Parse error: syntax error, unexpected '(', expecting T_STRING or T_VARIABLE or '{' or '$' in E:\Server\root\Coppermine\plugins\CopperRank\codebase.php on line 44

CMFA

Αndré


cmfa

hi,

thanks for the link, about that I was already about that.
Now, however, I do not get another mistake I can arrange.


$query= "INSERT INTO ".$CONFIG['TABLE_CONFIG']." (name, value) VALUES (\"rank1\", \"Newbie\"), (\"rank2\", \"Member\"), (\"rank_image1\", \"<img src=\"\"plugins/CopperRank/images/rank1.jpg\"\" />\"), (\"rank_image2\", \"<img src=\"\"plugins/CopperRank/images/rank2.jpg\"\" />\"),(\"rank_image3\", \"<img src=\"\"plugins/CopperRank/images/rank3.jpg\"\" />\"), (\"rank_image4\", \"<img src=\"\"plugins/CopperRank/images/rank4.jpg\"\" />\"), (\"rank_image5\", \"<img src=\"\"plugins/CopperRank/images/rank5.jpg\"\" />\");";
cpg_db_query($query); 

and
Error Message
mySQL error: Duplicate entry 'rank1' for key 'PRIMARY'

VG
CMFA

Stramm

Means you've run that query before and the key already exists (see error message). You'll have to delete that entry from the config table or check if the key exists before running the query.

cmfa

Hi@all,

so true was already there, I deleted them out.
But it remains the problem comes as soon as the submit button is pressed.
Times have attached the function, possibly there are still some other error which I do not see.


// Configure function
function rank_configure() {
global $CONFIG, $lang_plugin_CopperRank_how, $lang_plugin_CopperRank , $lang_plugin_CopperRank_table;
  $superCage = Inspekt::makeSuperCage();
  $request_uri = $superCage->server->getEscaped('REQUEST_URI');

$query= "INSERT INTO ".$CONFIG['TABLE_CONFIG']." (name, value) VALUES (\"rank1\", \"Newbie\"), (\"rank2\", \"Member\"), (\"rank_image1\", \"<img src=\"\"plugins/CopperRank/images/rank1.jpg\"\" />\"), (\"rank_image2\", \"<img src=\"\"plugins/CopperRank/images/rank2.jpg\"\" />\"),(\"rank_image3\", \"<img src=\"\"plugins/CopperRank/images/rank3.jpg\"\" />\"), (\"rank_image4\", \"<img src=\"\"plugins/CopperRank/images/rank4.jpg\"\" />\"), (\"rank_image5\", \"<img src=\"\"plugins/CopperRank/images/rank5.jpg\"\" />\");";
cpg_db_query($query);
$query= "INSERT INTO ".$CONFIG['TABLE_CONFIG']." (name, value) VALUES (\"rank3\", \"Extreme Member\"), (\"rank4\", \"Power Member\");";
cpg_db_query($query);
$query= "INSERT INTO ".$CONFIG['TABLE_CONFIG']." (name, value) VALUES (\"rank_value3\", \"35\"), (\"rank_value4\", \"45\");";
cpg_db_query($query);
$query= "INSERT INTO ".$CONFIG['TABLE_CONFIG']." (name, value) VALUES (\"rank_value1\", \"10\"), (\"rank_value2\", \"25\");";
cpg_db_query($query);
$query= "INSERT INTO ".$CONFIG['TABLE_CONFIG']." (name, value) VALUES (\"rank5\", \"Addict\"), (\"rank_value5\", \"50\");";
cpg_db_query($query);

echo <<< EOT
{$lang_plugin_CopperRank_table['start']} </br>
<form name="submit" id="submit" action="$request_uri" method="post">
<input id="submit" name="submit" type="submit" value="submit" />
</form>
EOT;
}


VG

CMFA

Αndré

Attach the whole plugin or post the complete error message if you need help.

cmfa

hi,

In the Plugin Manager will call the:

mySQL error: Duplicate entry 'rank1' for key 'PRIMARY'

When commenting on the $ query I get the press of not more submit.

Vg


<?php
/*************************
  Coppermine Photo Gallery
  ************************
  Copyright (c) 2003-2007 Coppermine Dev Team
  v1.1 originally written by Gregory DEMAR
  This program is free software; you can redistribute it and/or modify
  it under the terms of the GNU General Public License version 3
  as published by the Free Software Foundation.
  ********************************************
  Coppermine version: 1.4.13
  $Source$
  $Revision: 3912 $
  $Author: gaugau $
  $Date: 2007-08-24 16:48:44 +0200 (Fr, 24 Aug 2007) $
**********************************************/
/************************************************
 CopperRank plugin
*************************************************
by just_some_guy - www.mysimtractor.com
*************************************************/
if (!defined('IN_COPPERMINE')) die('Not in Coppermine...');
global 
$CONFIG$lang_plugin_CopperRank_table$lang_plugin_CopperRank;
require (
'plugins/CopperRank/include/init.inc.php');
// Add an install action
$thisplugin->add_action('plugin_install','rank_install');

$thisplugin->add_action('plugin_configure','rank_configure');

$thisplugin->add_action('page_start','rank_page_start');
// Install function
// Checks if uid is 'foo' and pwd is 'bar'; If so, then install the plugin
function rank_install() {
global 
$CONFIG;
$superCage Inspekt::makeSuperCage();
    
// Install
 
if ($superCage->post->getInt('submit')) {
 return 
true;
    
// Loop again
    
} else {
        return 
1;
    }
}   
// add config button
function rank_config_button($href,$title,$target,$link)
{
global 
$CONFIG$lang_plugin_CopperRank_how$lang_plugin_CopperRank $lang_plugin_CopperRank_table;
  global 
$template_gallery_admin_menu;
  
$new_template $template_gallery_admin_menu;
  
$button template_extract_block($new_template,'documentation');
  
$params = array(
      
'{DOCUMENTATION_HREF}' => $href,
      
'{DOCUMENTATION_TITLE}' => $title,
      
'target="cpg_documentation"' => $target,
      
'{DOCUMENTATION_LNK}' => $link,
   );
   
$new_button="<!-- BEGIN $link -->".template_eval($button,$params)."<!-- END $link -->
"
;
   
template_extract_block($template_gallery_admin_menu,'documentation',"<!-- BEGIN documentation -->" $button "<!-- END documentation -->
$new_button);
}
// add admin button to start of each page
function rank_page_start()
{
global $CONFIG$lang_plugin_CopperRank_how$lang_plugin_CopperRank $lang_plugin_CopperRank_table;


if (GALLERY_ADMIN_MODE) {
rank_config_button('index.php?file=CopperRank/config',$lang_plugin_CopperRank_table['ranks'],'',$lang_plugin_CopperRank_table['ranks']);
}
}
// Configure function
function rank_configure() {
global 
$CONFIG$lang_plugin_CopperRank_how$lang_plugin_CopperRank $lang_plugin_CopperRank_table;
  
$superCage Inspekt::makeSuperCage();
 
$request_uri $superCage->server->getEscaped('REQUEST_URI');
/*
$query= "INSERT INTO ".$CONFIG['TABLE_CONFIG']." (name, value) VALUES (\"rank1\", \"Newbie\"), (\"rank2\", \"Member\"), (\"rank_image1\", \"<img src=\"\"plugins/CopperRank/images/rank1.jpg\"\" />\"), (\"rank_image2\", \"<img src=\"\"plugins/CopperRank/images/rank2.jpg\"\" />\"),(\"rank_image3\", \"<img src=\"\"plugins/CopperRank/images/rank3.jpg\"\" />\"), (\"rank_image4\", \"<img src=\"\"plugins/CopperRank/images/rank4.jpg\"\" />\"), (\"rank_image5\", \"<img src=\"\"plugins/CopperRank/images/rank5.jpg\"\" />\");";
cpg_db_query($query);
$query= "INSERT INTO ".$CONFIG['TABLE_CONFIG']." (name, value) VALUES (\"rank3\", \"Extreme Member\"), (\"rank4\", \"Power Member\");";
cpg_db_query($query);
$query= "INSERT INTO ".$CONFIG['TABLE_CONFIG']." (name, value) VALUES (\"rank_value3\", \"35\"), (\"rank_value4\", \"45\");";
cpg_db_query($query);
$query= "INSERT INTO ".$CONFIG['TABLE_CONFIG']." (name, value) VALUES (\"rank_value1\", \"10\"), (\"rank_value2\", \"25\");";
cpg_db_query($query);
$query= "INSERT INTO ".$CONFIG['TABLE_CONFIG']." (name, value) VALUES (\"rank5\", \"Addict\"), (\"rank_value5\", \"50\");";
cpg_db_query($query);
 */
echo <<< EOT
{
$lang_plugin_CopperRank_table['start']} </br>
<form name="submit" id="submit" action="
$request_uri" method="post">
<input id="submit" name="submit" type="submit" value="submit" />
</form>
EOT;
}
// Displays the form
?>


Αndré

Quote from: cmfa on January 31, 2011, 01:26:16 PM
mySQL error: Duplicate entry 'rank1' for key 'PRIMARY'
That's not the whole error message. It lacks of a lot of information. So again,
Quote from: Αndré on January 31, 2011, 12:33:49 PM
Attach the whole plugin or post the complete error message

cmfa

Hi,

Entries in the Config table have been deleted in the Plugin Manager has been pressed install. It appears the submit button and then comes the appended error message.

Vg

Αndré

Well, that's still not what I asked for, but enough information. Your script dies at line 79, which uses the query string of line 78:
$query= "INSERT INTO ".$CONFIG['TABLE_CONFIG']." (name, value) VALUES (\"rank1\", \"Newbie\"), (\"rank2\", \"Member\"), (\"rank_image1\", \"<img src=\"\"plugins/CopperRank/images/rank1.jpg\"\" />\"), (\"rank_image2\", \"<img src=\"\"plugins/CopperRank/images/rank2.jpg\"\" />\"),(\"rank_image3\", \"<img src=\"\"plugins/CopperRank/images/rank3.jpg\"\" />\"), (\"rank_image4\", \"<img src=\"\"plugins/CopperRank/images/rank4.jpg\"\" />\"), (\"rank_image5\", \"<img src=\"\"plugins/CopperRank/images/rank5.jpg\"\" />\");";

Try to replace that line with the following line
$query= "INSERT INTO {$CONFIG['TABLE_CONFIG']} (name, value) VALUES ('rank1', 'Newbie'), ('rank2', 'Member'), ('rank_image1', '<img src=\"plugins/CopperRank/images/rank1.jpg\" />'), ('rank_image2', '<img src=\"plugins/CopperRank/images/rank2.jpg\" />'),('rank_image3', '<img src=\"plugins/CopperRank/images/rank3.jpg\" />'), ('rank_image4', '<img src=\"plugins/CopperRank/images/rank4.jpg\" />'), ('rank_image5', '<img src=\"plugins/CopperRank/images/rank5.jpg\" />');";


If you still get an error, copy everything that's in the white error box to your reply. Not just the last line, as it's mostly useless without the context.

cmfa

Hi,
sorry that I had misunderstood the error message. What I have now seen the entries are already created when calling from the plugin manager. It looks like there is a problem with the submit button. When this is pressed, the error message.


While executing query 'INSERT INTO cpg15x_config (name, value) VALUES ('rank1', 'Newbie'), ('rank2', 'Member'), ('rank_image1', '<img src="plugins/CopperRank/images/rank1.jpg" />'), ('rank_image2', '<img src="plugins/CopperRank/images/rank2.jpg" />'),('rank_image3', '<img src="plugins/CopperRank/images/rank3.jpg" />'), ('rank_image4', '<img src="plugins/CopperRank/images/rank4.jpg" />'), ('rank_image5', '<img src="plugins/CopperRank/images/rank5.jpg" />');' in plugins\CopperRank\codebase.php on line 82

mySQL error: Duplicate entry 'rank1' for key 'PRIMARY'


VG

Αndré

Please attach the plugin as zip file.

cmfa

hi,

yes

VG

cmfa

hi,
in the porting I've come a long way advanced. Creating tables is now error free. The delete function of the tables I have taken purely. Only when I try to access the Configuration is the error message below. The configuration is index.php?file=CopperRank/config eye call

Fatal error: Cannot redeclare cpgGetMicroTime() (previously declared in E:\Web_portable\www\coppermine\include\init.inc.php:27) in E:\Web_portable\www\coppermine\include\init.inc.php on line 29

Now where is the problem?

LG

CMFA