Advanced search  

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]

Pages: [1] 2 3   Go Down

Author Topic: [How To] Coppermine within SMF  (Read 81248 times)

0 Members and 1 Guest are viewing this topic.

snork13

  • Contributor
  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 260
  • Internet! Is that thing still around?
    • Gallery
[How To] Coppermine within SMF
« on: January 02, 2006, 07:07:48 pm »

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
Code: [Select]
<?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
Code: [Select]
<?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:

Code: [Select]
'findmember' => array('Subs-Auth.php', 'JSMembers'),
after add;
Code: [Select]
'gallery' => array('Gallery.php', 'Gallery'),

themes/???/index.template

find:
Code: [Select]
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:
Code: [Select]
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
« Last Edit: March 31, 2006, 08:25:51 am by GauGau »
Logged

kegobeer

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 4637
  • Beer - it does a body good!
    • The Kazebeer Family Website
Re: [How To] Coppermine within SMF
« Reply #1 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.
Logged
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

  • Contributor
  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 260
  • Internet! Is that thing still around?
    • Gallery
Re: [How To] Coppermine within SMF
« Reply #2 on: January 02, 2006, 07:17:59 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
Logged

conradk

  • Coppermine newbie
  • Offline Offline
  • Posts: 1
Re: [How To] Coppermine within SMF
« Reply #3 on: January 11, 2006, 04:32:26 am »

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
Logged

Crazie

  • Coppermine newbie
  • Offline Offline
  • Posts: 14
Re: [How To] Coppermine within SMF
« Reply #4 on: March 02, 2006, 03:01:30 pm »

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?
Logged

Crazie

  • Coppermine newbie
  • Offline Offline
  • Posts: 14
Re: [How To] Coppermine within SMF
« Reply #5 on: March 03, 2006, 12:37:51 am »

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.
Logged

Crazie

  • Coppermine newbie
  • Offline Offline
  • Posts: 14
Re: [How To] Coppermine within SMF
« Reply #6 on: March 03, 2006, 02:01:32 am »

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

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47844
  • aka "GauGau"
    • gaugau.de
Re: [How To] Coppermine within SMF
« Reply #7 on: March 03, 2006, 08:58:55 am »

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

Crazie

  • Coppermine newbie
  • Offline Offline
  • Posts: 14
Re: [How To] Coppermine within SMF
« Reply #8 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.
Logged

justinkase

  • Coppermine newbie
  • Offline Offline
  • Posts: 1
Re: [How To] Coppermine within SMF
« Reply #9 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?
Logged

snork13

  • Contributor
  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 260
  • Internet! Is that thing still around?
    • Gallery
Re: [How To] Coppermine within SMF
« Reply #10 on: March 15, 2006, 11:49:03 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
Logged

aravot

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Gender: Male
  • Posts: 73
    • Product Compare for Virtuemart Shopping Cart
Re: [How To] Coppermine within SMF
« Reply #11 on: March 16, 2006, 12:51:32 am »

Logged

daimmo

  • Coppermine newbie
  • Offline Offline
  • Posts: 5
Re: [How To] Coppermine within SMF
« Reply #12 on: March 20, 2006, 04:32:43 am »

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
Logged

Crazie

  • Coppermine newbie
  • Offline Offline
  • Posts: 14
Re: [How To] Coppermine within SMF
« Reply #13 on: March 29, 2006, 06:10:10 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. ???
Logged

Crazie

  • Coppermine newbie
  • Offline Offline
  • Posts: 14
Re: [How To] Coppermine within SMF
« Reply #14 on: March 29, 2006, 06:49:40 pm »

How to add a tabs (button) to SMF 1.1

Thanks for that link!  Now if I can only find the php.ini file...lol.
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47844
  • aka "GauGau"
    • gaugau.de
Re: [How To] Coppermine within SMF
« Reply #15 on: March 29, 2006, 09:59:50 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.
Logged

Starrbuck

  • Coppermine newbie
  • Offline Offline
  • Posts: 6
Re: [How To] Coppermine within SMF
« Reply #16 on: March 30, 2006, 11:31:38 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...
Logged

Crazie

  • Coppermine newbie
  • Offline Offline
  • Posts: 14
Re: [How To] Coppermine within SMF
« Reply #17 on: March 31, 2006, 02:00:03 am »

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.
Logged

gofwd

  • Coppermine newbie
  • Offline Offline
  • Posts: 1
Re: [How To] Coppermine within SMF
« Reply #18 on: April 11, 2006, 04:19:53 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.
Logged

CoasterJoe.com

  • Coppermine newbie
  • Offline Offline
  • Posts: 5
Re: [How To] Coppermine within SMF
« Reply #19 on: April 26, 2006, 03:23:39 am »

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?
Logged
Pages: [1] 2 3   Go Up
 

Page created in 0.029 seconds with 21 queries.