[How To] Coppermine within SMF [How To] Coppermine within SMF
 

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Main Menu

[How To] Coppermine within SMF

Started by snork13, January 02, 2006, 07:07:48 PM

Previous topic - Next topic

0 Members and 3 Guests are viewing this topic.

snork13

I shared this over at smf with kegobeer, and thought others might find it interesting here. This hack will allow you to have your forum wrapped around coppermine, assuming you have already bridged the 2 ;)

example:

http://www.snork13.net/forum/index.php?action=gallery


You will need to create the 2 new files: Gallery.php & Gallery.template.php
edit 2 other files: index.php & index.template.php

**3/15/06*** edited Gallery.php to provide a linktree, and uploaded a copy, just remove the .txt ;)

sources/Gallery.php
<?php
if (!defined('SMF'))
die(
'Hacking attempt...');

Function 
Gallery()
{

global  $txt$scripturl,  $db_prefix$context;
LoadTemplate('Gallery');
$context['page_title'] = "Gallery";
$context['linktree'][] = array(
'url' => $scripturl '?action=gallery',
'name' => $txt['gallery']
);

}

?>



themes/???/Gallery.template.php
<?php
// Version: 1.1 RC2; Gallery

function template_main()
{
global $context$settings$options$txt$scripturl;

echo '
<script language="JavaScript" type="text/javascript"><!--
function checkAll(onOff)
{
for (var i = 0; i < document.searchform.elements.length; i++)
{
if (document.searchform.elements[i].name.substr(0, 3) == "brd")
document.searchform.elements[i].checked = onOff;
}
}
// --></script>
<form action="'
$scripturl'?action=search2" method="post" name="searchform" id="searchform">

 <script type="text/javascript"><!--

/***********************************************
* IFrame SSI script II- © Dynamic Drive DHTML code library (http://www.dynamicdrive.com)
* Visit DynamicDrive.com for hundreds of original DHTML scripts
* This notice must stay intact for legal use
***********************************************/

//Input the IDs of the IFRAMES you wish to dynamically resize to match its content height:
//Separate each ID with a comma. Examples: ["myframe1", "myframe2"] or ["myframe"] or [] for none:
var iframeids=["myframe"]

//Should script hide iframe from browsers that don\'t support this script (non IE5+/NS6+ browsers. Recommended):
var iframehide="yes"

var getFFVersion=navigator.userAgent.substring(navigator.userAgent.indexOf("Firefox")).split("/")[1]
var FFextraHeight=parseFloat(getFFVersion)>=0.1? 16 : 0 //extra height in px to add to iframe in FireFox 1.0+ browsers

function resizeCaller() {
var dyniframe=new Array()
for (i=0; i<iframeids.length; i++){
if (document.getElementById)
resizeIframe(iframeids[i])
//reveal iframe for lower end browsers? (see var above):
if ((document.all || document.getElementById) && iframehide=="no"){
var tempobj=document.all? document.all[iframeids[i]] : document.getElementById(iframeids[i])
tempobj.style.display="block"
}
}
}

function resizeIframe(frameid){
var currentfr=document.getElementById(frameid)
if (currentfr && !window.opera){
currentfr.style.display="block"
if (currentfr.contentDocument && currentfr.contentDocument.body.offsetHeight) //ns6 syntax
currentfr.height = currentfr.contentDocument.body.offsetHeight+FFextraHeight; 
else if (currentfr.Document && currentfr.Document.body.scrollHeight) //ie5+ syntax
currentfr.height = currentfr.Document.body.scrollHeight;
if (currentfr.addEventListener)
currentfr.addEventListener("load", readjustIframe, false)
else if (currentfr.attachEvent){
currentfr.detachEvent("onload", readjustIframe) // Bug fix line
currentfr.attachEvent("onload", readjustIframe)
}
}
}

function readjustIframe(loadevt) {
var crossevt=(window.event)? event : loadevt
var iframeroot=(crossevt.currentTarget)? crossevt.currentTarget : crossevt.srcElement
if (iframeroot)
resizeIframe(iframeroot.id);
}

function loadintoIframe(iframeid, url){
if (document.getElementById)
document.getElementById(iframeid).src=url
}

if (window.addEventListener)
window.addEventListener("load", resizeCaller, false)
else if (window.attachEvent)
window.attachEvent("onload", resizeCaller)
else
window.onload=resizeCaller

// --></script>

<table width="100%" border="0" cellspacing="0" cellpadding="4" align="center" class="tborder">
<tr class="titlebg">
<td>Gallery</td>
</tr><tr>
<td class="windowbg">'
;

// load the gallery
echo '<iframe id="myframe" src="http://www.???.com/gallery" scrolling="no" marginwidth="0" marginheight="0" frameborder="0" vspace="0" hspace="0" style="overflow:novisible; width:100%; display:none"></iframe>';

echo '
</td>
</tr>
</table>
</form>'
;
}

?>


/index.php


find:

'findmember' => array('Subs-Auth.php', 'JSMembers'),

after add;
'gallery' => array('Gallery.php', 'Gallery'),


themes/???/index.template

find:
if ($context['user']['is_logged'])
echo '
<a href="', $scripturl, '?action=calendar">', ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/calendar.gif" alt="' . $txt['calendar24'] . '" style="margin: 2px 0;" border="0" />' : $txt['calendar24']), '</a>', $context['menu_separator'];


after add:
echo'
<a href="', $scripturl, '?action=gallery">', ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/gallery.gif" alt="Gallery"' . $txt[''] . '" style="margin: 2px 0;" border="0" />' : $txt['Gallery']), '</a>', $context['menu_separator'];



change www.???.com to reflect your actual location, the template has a javascript that allows the iframe to open full, it's the best i could do. It similar to the FlashChat intergration and where i got the idea :)

i would also suggestion tweaking the gallery menu to meet your needs, and you could also prevent direct access to the gallery via a .htaccess file

-snork

kegobeer

One thing that doesn't work well at all with this tweak is the config page.  Expanding the options does not expand the "frame" that Coppermine sits in.  Everything else works great.
Do not send me a private message unless I ask for one.  Make your post public so everyone can benefit.

There are no stupid questions
But there are a LOT of inquisitive idiots

snork13

Quote from: kegobeer on January 02, 2006, 07:10:35 PM
One thing that doesn't work well at all with this tweak is the config page.  Expanding the options does not expand the "frame" that Coppermine sits in.  Everything else works great.

yes, i noticed, you have to expand the last option first :-\

-snork

conradk

Hi,

Just wanted to throw in my results...

I'm using coppermine 1.4.3 and SMF 1.1 RC2. All I get is a broken image icon after "Hello, [user]," When I click on the broken icon it gives me a php error that occurred on line 3 of Sources/Gallery.php, some unexpected text encountered... (Sorry, didn't write down the error as I was rushing to get the forum back up.)

I've tried creating a static link in SMF to the gallery, but I lose my login credentials when I do that. Linking out of a topic works fine, though.

Thanks,
Conrad

Crazie

1st off, thanks for this mod. 

Now for the big ?'s.

1.  The iFrame isn't expanding at all.  What you see in this screenshot I took is all I can see.  And I can't adjust it.

2.  I'm using a modified version of the default theme, and can't (for the life of me) figure out how to make the "Gallery.gif" look like the others.  I searched forever through all the .gif files, and they all look like the gallery one.  I'm wondering how in the heck I'm supposed to slip the "Gallery" in between the Calendar and Members buttons.

Maybe I'm just tired and did something wrong, but I have triple and quadruple checked my work.  Any suggestions?

Crazie

On second thought, I think I'll just disable bridging alltogether.  For some reason, the only thing that didn't work when I bridged, was the logout.  My forums would NOT let me log out.  Due to this, I'm scrapping the whole "Bridge" thing for now.

Crazie

UPDATE:  I resume my request for assitance with this.  I now have Coppermine fully bridged and working!  Whew! ;D

Joachim Müller

posting a link to your page might be a good start if you need help ::)

Crazie

Sure thing, I just took the mod out becuase it was looking a bit bad the way it came out.

Here's a link to the site: http://atv-edge.com/forum

user/pw: test / test

I put the mod back in, and you'll see that "Gallery" shows up above all the other links, instead of in-line with them.  And the iframe doesn't expand at all, seems to be a fixed height.

justinkase

I just installed both SMF and Coppermine 1.4.4 and have the same problem with the gallery button and the Coppermine frame.

Any suggestions?

snork13



Quote from: justinkase on March 14, 2006, 08:18:39 PM
I just installed both SMF and Coppermine 1.4.4 and have the same problem with the gallery button and the Coppermine frame.

Any suggestions?

accroding to Senkusha over at smf, In your php.ini, make sure register_long_arrays=On is set

http://www.simplemachines.org/community/index.php?topic=41542.msg512991#msg512991

aravot


daimmo

added coppermine latest version to smf 1.1 rc2
bridged following the tutorial on the coppermine documentation
seems to work
but i cannot manage groups and users
the "users" function moves me to the userlist on smf, and that's ok..
the "groups" page does not make what i set
i just want "registered users" to be able to do quite everything on the website (upload to personal and public galleries), plus having "global moderators" (or "administrators") create new public galleries
i'm talking of www.abruzzesi.com and www.abruzzesi.com/gallery

Crazie

Quote from: snork13 on March 15, 2006, 11:49:03 PM

accroding to Senkusha over at smf, In your php.ini, make sure register_long_arrays=On is set

http://www.simplemachines.org/community/index.php?topic=41542.msg512991#msg512991

I've been in the middle of moving or I would have replied much sooner, but where is the php.ini file????  I'm feeling stupid for asking, but I've looked almost everywhere and can't seem to find it.  Maybe the move stole some brain cells or something. ???

Crazie


Joachim Müller

Quote from: snork13 on March 15, 2006, 11:49:03 PM
accroding to Senkusha over at smf, In your php.ini, make sure register_long_arrays=On is set
Only applies if you're on PHP5. However, don't worry about it, you wouldn't be able to run coppermine if this setting was wrong, no need to look for php.ini. You usually can't change it anyway when webhosted.

Starrbuck

Quote from: snork13 on January 02, 2006, 07:07:48 PM
i would also suggestion tweaking the gallery menu to meet your needs, and you could also prevent direct access to the gallery via a .htaccess file

Hey, snork, this all worked great for me!  I did do some tweaks to the available options in CPG, such as removing the login/logout links and the ability to bring up your profile.

Do you have any examples of how to prevent direct access to the gallery?  I want to only be able to get there from the SMF menu, but I have no idea how to accomplish this...

Crazie

Quote from: GauGau on March 29, 2006, 09:59:50 PM
Only applies if you're on PHP5. However, don't worry about it, you wouldn't be able to run coppermine if this setting was wrong, no need to look for php.ini. You usually can't change it anyway when webhosted.

That being the case, do you guys have any other suggestions for me?  I don't want to abandon the iframe option, especially when I'm so close to having it working perfectly.

gofwd

Quote from: Crazie on March 03, 2006, 09:11:36 AM
Sure thing, I just took the mod out becuase it was looking a bit bad the way it came out.

Here's a link to the site: http://atv-edge.com/forum

user/pw: test / test

I put the mod back in, and you'll see that "Gallery" shows up above all the other links, instead of in-line with them.  And the iframe doesn't expand at all, seems to be a fixed height.


I had the same problem.  Java errors 'on' revealed permission denied on IFrame resize due to domain mismatch.  Turns out the $scriptrul in SMF had no 'www' after the 'http:' but cpg had to have it  in Gallery.template.php.  So rather than risk breaking SMF I replaced the $scripturl with the hard url including the 'www' so there was no domain mismatch in the index.template.php file (only one place where the gallery button was added.)

Hope this topic is not too cold for a little more input, it has been very helpful to me.

CoasterJoe.com

Is there a way to do this while using the Tiny Portal mod for SMF? I'm running this and and I cant seem to find where to change the code in
themes/???/index.template I'm think the mod changes this. Any thoughts?