Page 1 of 1

How do I change url in codebase.php of coppermine? TY!

Posted: Mon Feb 22, 2010 2:12 pm
by jpandp
Hello everyone!

I have a coppermine (PHP) site that I use to host "myspace" type comments/graphics on. When someone copies a comment from my site and pastes it on a webpage, it leaves a link back to my site.

In the codebase.php file (? -- I think?) I want to redirect/change both: the active url that makes the graphic "clickable" and the "img_src" code to: another url, other than the one for the site.

For example: Current version of a code

<center><a href="http://www.mywebsite.com/displayimage.php?pos=-63996" ><img src="http://www.mywebsite.com/albums/userpic ... h1%7E0.jpg" border="0"><br>

I would like to redirect the original url to another one, like:

<center><a href="http://www.anotherwebsite.com/displayim ... pos=-63996" ><img src="http://www.anotherwebsite.com/albums/us ... h1%7E0.jpg" border="0"><br>

Any help on this is greatly appreciated!


Here is a sample of the codebase.php file:

Code: Select all

<?php
if (!defined('IN_COPPERMINE')) die('Not in Coppermine...');
 
//Places a text box in the file information list that allows you to embed an image on another site.
$thisplugin->add_filter('file_info','html_embed');
 
function html_embed($info)
{
global $information;
global $CONFIG;
global $CURRENT_PIC_DATA;
 
$info['Embed URL'] = '<table cellpadding="0" cellspacing="1" border="0">';
$info['Embed URL'] .= '<tr><td><b><font color=yellow>HTML Code: For PROFILE pages & COMMENT Walls, or "Autographs" in MyYearbook: (Right click) "Copy" the code below and then (right click) "paste" it, where you want this pic to appear. On MyYearbook, the profile page must be set to allow HTML by the page owner.</font><b><font color=red> THANK YOU for using Mywebsite.com! Please help spread the word! </font></b></td></tr><tr><td><textarea name="htmlcode" class="textinputs" style="border:solid 1px orange; overflow:hidden;" rows="4" cols="60" wrap="on" style="overflow:hidden;height:15px;" onfocus="this.select();" onclick="this.select();"><center><a href="' . $CONFIG["ecards_more_pic_target"] . (substr($CONFIG["ecards_more_pic_target"], -1) == '/' ? '' : '/') .basename($_SERVER['PHP_SELF']) . "?pos=-$CURRENT_PIC_DATA[pid]" . '" ><img src="' . $CONFIG["ecards_more_pic_target"] . get_pic_url($CURRENT_PIC_DATA, 'fullsize') . '" border="0"><br><a href="http://www.mywebsite.com">MyWebsite.com</a></center><br></textarea></td></tr>';
 
 
 
 
$info['Embed URL'] .= '<tr><td style="height:15px;"></td></tr><tr><td><font color=orange>BBCode: (for bulletin board systems or sites that use BBCODE)</td></tr><tr><td><textarea name="bbcode" class="textinput" rows="4" cols="60" wrap="on" style="overflow:hidden;height:15px;" onfocus="this.select();" onclick="this.select();">) . "?pos=-$CURRENT_PIC_DATA[pid]" . '][img]'%20.%20$CONFIG["ecards_more_pic_target"]%20.%20get_pic_url($CURRENT_PIC_DATA,%20'fullsize')%20.%20'[/img]</textarea></td></tr>';
 
 
$info['Embed URL'] .= '</table>';
return $info;
}
 
// Add an install action
$thisplugin->add_action('plugin_install','html_embed_install');
 
// Install function
function html_embed_install() {
 
// Install
if ($_POST['test']=='true')
{
return true;
 
// Loop again
} else {
 
return true;
}
}
 
?>

Re: How do I change url in codebase.php of coppermine? TY!

Posted: Mon Feb 22, 2010 9:17 pm
by Benjamin
So what exactly is the problem you are having in accomplishing this?

Re: How do I change url in codebase.php of coppermine? TY!

Posted: Tue Feb 23, 2010 8:19 am
by jpandp
astions wrote:So what exactly is the problem you are having in accomplishing this?
Thank you Astions for responding! :D

I am not a programmer or coder at all. A really nice person trying to help offered that I make a few changes in line 14 of the bbcode in the codebase.php file:

OLD code snippet:

Code: Select all

<center><a href="' . $CONFIG["ecards_more_pic_target"] . (substr($CONFIG["ecards_more_pic_target"], -1) == '/' ? '' : '/') .basename($_SERVER['PHP_SELF']) . "?pos=-$CURRENT_PIC_DATA[pid]" . '" ><img src="' . $CONFIG["ecards_more_pic_target"] . get_pic_url($CURRENT_PIC_DATA, 'fullsize') . '" border="0"></a></center><br></textarea></td></tr>';
 
 
When I go to copy a comment, this code produces this html code: (which works)

OLD html code:

<center><a href="http://www.myoldwebsite.com/displayimage.php?pos=-64009" ><img src="http://www.myoldwebsite.com/albums/user ... 29%7E0.gif" border="0"><br><a href="http://www.myoldwebsite.com"></a></center><br>

This works, and it produces the comment and upon clicking the comment, it goes back to the site where the comment is filed

When I altered the bbcode, I did this:

NEW code snippet:

Code: Select all

<center><a href="http://www.my NEWurl.com/displayimage.php?pos=-$CURRENT_PIC_DATA[pid]"><img src="http://www.myNEWurl.com/'. get_pic_url($CURRENT_PIC_DATA, 'fullsize') . '" border="0"><br><a href="http://www.myNEWurl.com"></a></center><br></textarea></td></tr>';
 
 
This change produced the new html code:

NEW html code:

<center><a href="http://www.myNEWurl.com/displayimage.php?pos=-$CURRENT_PIC_DATA[pid]"><img src="http://www.myNEWurl.com/albums/userpics ... 29%7E0.gif" border="0"><br><a href="http://www.myNEWurl.com"></a></center><br>

This does not work properly - it still produces the comment on the page, however, upon clicking, it goes back to the site and shows this error:

"The selected album/file does not exist !"

It seems to be unable to find the location of the original file?

I am not sure, but does the problem arise in the changes made in this line of code? (as shown before changes)

Code: Select all

' . $CONFIG["ecards_more_pic_target"] . (substr($CONFIG["ecards_more_pic_target"], -1) == '/' ? '' : '/') .basename($_SERVER['PHP_SELF']) . "?pos=-$CURRENT_PIC_DATA[pid]" . '" >
 
 
Again, thank you and I truly appreciate your time, as this is quite important to me!

Re: How do I change url in codebase.php of coppermine? TY!

Posted: Tue Feb 23, 2010 9:00 pm
by John Cartwright
Since you didn't post the entire line, I can't be certain, but what you want is probably..

Code: Select all

<center><a href="http://www.my NEWurl.com/displayimage.php?pos=-'. $CURRENT_PIC_DATA['pid'] .'"><img src="http://www.myNEWurl.com/'. get_pic_url($CURRENT_PIC_DATA, 'fullsize') . '" border="0"><br><a href="http://www.myNEWurl.com"></a></center><br></textarea></td></tr>';
When you have variables inside single quotes, you need to escape them (as shown above).

Re: How do I change url in codebase.php of coppermine? TY!

Posted: Tue Feb 23, 2010 9:41 pm
by jpandp
OMG, John, you fixed it!!!

After 3 days of asking over 15 people for help, you nailed it!

Your solution works flawlessly!

Thank YOU x 100!!

PM sent to you.

What a friend you are!

Thanks to all who took the time to read this! :D

Best, Jim

John Cartwright wrote:Since you didn't post the entire line, I can't be certain, but what you want is probably..

Code: Select all

<center><a href="http://www.my NEWurl.com/displayimage.php?pos=-'. $CURRENT_PIC_DATA['pid'] .'"><img src="http://www.myNEWurl.com/'. get_pic_url($CURRENT_PIC_DATA, 'fullsize') . '" border="0"><br><a href="http://www.myNEWurl.com"></a></center><br></textarea></td></tr>';
 
 
When you have variables inside single quotes, you need to escape them (as shown above).