Need help/suggestions for upgrade of customized install Need help/suggestions for upgrade of customized install
 

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

Need help/suggestions for upgrade of customized install

Started by Oldiesmann, January 03, 2013, 07:48:31 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Oldiesmann

Several years ago, I became an assistant webmaster/forum admin for a photography forum due to my extensive knowledge of SMF. The site uses Coppermine for their photo gallery, and at some point in time, the original webmaster (who has since disappeared without a trace) made a bunch of changes to the gallery code to support the competitions that the site runs.

I have been planning for some time now to upgrade the site to the latest version of SMF and Coppermine, but have been holding off because I want to upgrade the forum and the gallery at the same time (to minimize downtime and such). In September of 2011, I went through and documented the changes they'd made (using TextDiff to compare their code with an unmodified copy of Coppermine 1.4.19), but haven't had much of a chance until now to do any more with it.

I see that the code has changed a bit in 1.5 (which isn't all that surprising really), so I would like to know if anyone could help me port these changes to 1.5. The changes are too extensive to post here, but I have listed them all at http://cafe.oldiesmann.us/forum/index.php?topic=2.0 for anyone who's interested.

I haven't looked at the custom files they've created either, so I'm not sure how much (if any) that code needs to be changed to make things work. Any assistance you could provide would be greatly appreciated.
Michael "Oldiesmann" Eshom
SMF Project Manager

phill104

That is indeed quite extensive. What exactly does all that do? It may be that some of it can be achieved with existing plugins.

With CPG 1.5.x as well as a lot of new features being integrated and increased security the plugin engine is far more extensive. This makes mods such as yours for CPG1.4.19 a little obsolete so I would suggest you look into creating a plugin to achive the results you are after. While the CPG team can probably advise it is not something we could code for you as we simply do not have the time with such a small team.
It is a mistake to think you can solve any major problems just with potatoes.

lurkalot

Hi Oldiesmann

Looks like you have a job on your hands there.  :o  Coppermine has gone through quite a few code changes since 1.4.xx, including core code, themes and plugins, all of which will need replacing via upgrade.   I'm assuming your going to set this all up on your test site first?

I would personally Un-bridge, then upgrade your SMF 1.1.17 to SMF 2.0.3 I know you are familiar with that  ;) then upgrade Coppermine to 1.5.20. re bridge using the SMF 2 bridge file.

Then go to work on the file edits if they are still applicable.   Went through this myself after 1.5.xx was released.   

I'll let one of the code worthy members of the team advise you about the code changes.  ;)

Say hello to Pat for me.  ;)
Running SMF 2.1.4  / Tinyportal 3.0.1, bridged with Coppermine 1.6.25, plus cpmfetch 2.0.0

Oldiesmann

I honestly couldn't tell you what some of those code edits do - all of that was done by an admin who has gone AWOL (nobody's seen or heard from him in a long time). Here is what I do know (or at least what I can figure out by guessing).

Most of the edits to functions.inc.php seem to be related to competitions that are run on the forum from time to time. The album with an ID of 2 is an admins-only album which is used to hold photos that users submit to the current competition, so admins can vote on them. The "pot" stuff is picture of the day/week/month.

The edits to picmgmt.php and search.inc.php add support for a "critique" feature (one of the custom fields is used to allow users to specify whether or not they want critiques on their work).

The edits to smilies.inc.php are fairly straightforward - adding a bunch of smilies and splitting them into rows (limiting it to 15 smilies per row).

The first edit to theme.inc.php adds a POTD link to the menu, which points to a custom file that handles the "picture of the day" feature.

The rest add support for changing the background color in the popup window when viewing an image.

The language file edits handle all the custom stuff.

The edit to anycontent.php adds a custom block just above where the latest additions are shown.

The change to db_input.php handles the "critique" thing I mentioned earlier.

The first few changes to displayimage.php prevent the filename and album link from being displayed unless it's in the "competitions" album or you're an admin.

The next edit again handles the critique thing.

The edits to editOnePic.php and editpics.php handle critique and the "picture of the ..." stuff (6 new checkboxes are added - one each for setting as picture of the day, week or month and another one each for moving the the appropriate archive when a new picture of the day/week/month is chosen).

The bulk of the edits to profile.php are some "show quota mod". The final edit adds a link to the user's forum profile to their profile page in the gallery.

The edit to ratepic.php simply changes the rating options from 5 to 10 (since we can rate each photo from 1 to 10 stars)

The edits to script.js change the height and width of the popup window.

The edits to upload.php handle showing the quota, adding a reminder about photo upload limits (3 per day, except for premium members), a reminder about filenames (not entirely sure why that's there, unless it's related to software limitations) and again the critique thing.

The edit to util.php is for a thing called "cracker shots". I'm not entirely sure what that is.

There are also quite a few custom files involved here, but since those just involve database queries (as far as I know), there's really not any need to post them here.

The bulk of the edits are in functions.php, and I can handle all the template stuff myself.
Michael "Oldiesmann" Eshom
SMF Project Manager

Oldiesmann

One minor update to my previous post. The edit to util.php is for "Cafe Crackers" - a daily showcase of photos nominated for Photo of the Day which didn't "make it" to that level.
Michael "Oldiesmann" Eshom
SMF Project Manager

lurkalot

Some of that stuff is built into 1.5.x

ratings can now be set to ten from config page.  Anycontent is still there also, so you can add custom code to that as before. Custom fields, there is four built in

What plugins are installed and active?   There might be new versions already ported to 1.5.x  And as Phill said above, there might be plugins that will do some of the other jobs.
Running SMF 2.1.4  / Tinyportal 3.0.1, bridged with Coppermine 1.6.25, plus cpmfetch 2.0.0

phill104

Yep, some of that is already available. I think what you need to do is find out what is already available then from thre look at what custom mods or plugins are needed to finish your desired functionality. Much of what has been done is already possible with 1.5 so no point re-inventing the wheel. But there are some aspects that could be achieved with a plugin or two.

Admin only albums is an out of the box function. The picture of the day/week etc can be done with meta albums maybe using Andre's excellent extended meta album plugin - http://forum.coppermine-gallery.net/index.php/topic,63706.0.html , or even modifying the pic of the week plugin - http://forum.coppermine-gallery.net/index.php/topic,74462.0.html. There is also a great little hot pictures plugin that might do the trick - http://forum.coppermine-gallery.net/index.php/topic,74690.0.html

The critique feature would probably need a new plugin which should be simple to write. There is nothing I am aware of thatwill do that.
It is a mistake to think you can solve any major problems just with potatoes.

Oldiesmann

I will definitely look into those plugins and see what's possible. The biggest things are that the moderators/admins have been doing things a certain way for years, so if we change things around too much, I'll have to make sure I inform them of the new methods of doing things.
Michael "Oldiesmann" Eshom
SMF Project Manager

Oldiesmann

I've gone back through the edits in functions.inc.php and actually understand what they do now...

First edit prevents the link to the owner's profile from being displayed in the photo caption unless you're an admin.
Second edit changes how ratings are calculated/displayed in the photo caption.
Third edit changes how items are sorted in the albums within the competitions category (album ID between 101 and 200)

Most of the other edits change the way the "meta" albums work:
Prevent inclusion/counting of photos from the competition album (album 2) in the meta albums
For the "top rated" album: Competition photos are included, but only if you're an admin. Sort order is changed regardless.

One edit also adds three new meta albums (the "archive" albums for picture of the day/week/month).

The final edits remove the display of the image size from the picture title.

Still looking into how exactly the "picture of the ...", competitions and "crackers" work.
Michael "Oldiesmann" Eshom
SMF Project Manager

Oldiesmann

Hate to bump an old topic, but I'm finally getting around to working on this (got busy and didn't have time).

Is there any feature to show the quota on the upload page for 1.5? I looked at profile.php and see that it appears to already show that on the profile (though I don't have a non-bridged install to test it with at the moment), but it doesn't show on the upload page, and the code has changed there, so I'm not sure if the hack from 1.4 will work (in fact I'm not entirely sure where to add it there).
Michael "Oldiesmann" Eshom
SMF Project Manager

Αndré

IMHO that's a feature that should go to core. Can you please post the URL of the existing mod? Thanks.

Oldiesmann

Here you go :)

http://forum.coppermine-gallery.net/index.php/topic,33109.msg154364.html#msg154364

From a brief look at the code, it appears it's already shown in the profile now, but it doesn't appear to be shown on the upload form at all.
Michael "Oldiesmann" Eshom
SMF Project Manager

Αndré

Open upload.php, find
define('ADMIN_PHP', true);
and below, add
define('REGISTER_PHP', true);

find
        $form_array = array(
            sprintf($lang_upload_php['max_fsize'], cpg_format_bytes($max_file_size)),

and replace with
        if (USER_ID && $USER_DATA['group_quota']) {
            if ($disk_usage = mysql_result(cpg_db_query("SELECT ROUND(SUM(total_filesize)/1024) AS disk_usage FROM {$CONFIG['TABLE_PICTURES']} WHERE owner_id = ".USER_ID), 0)) {
                $disk_usage_output = '<div style="float: right;"><div style="float: left;">'.$lang_register_php['disk_usage'].':&nbsp;</div><div style="float: left;">'.theme_display_bar($disk_usage, $USER_DATA['group_quota'],150,'', '', '/'.$USER_DATA['group_quota'].'&nbsp;'.$lang_byte_units[1],'red','green').'</div>';
            }
        }
        $form_array = array(
            sprintf($lang_upload_php['max_fsize'], cpg_format_bytes($max_file_size)).$disk_usage_output,


find
    $max_fsize = sprintf($lang_upload_php['max_fsize'], cpg_format_bytes($max_file_size));
and replace with
    global $CONFIG, $USER_DATA, $lang_register_php, $lang_byte_units;
    if (USER_ID && $USER_DATA['group_quota']) {
        if ($disk_usage = mysql_result(cpg_db_query("SELECT ROUND(SUM(total_filesize)/1024) AS disk_usage FROM {$CONFIG['TABLE_PICTURES']} WHERE owner_id = ".USER_ID), 0)) {
            $disk_usage_output = '<div style="float: right;"><div style="float: left;">'.$lang_register_php['disk_usage'].':&nbsp;</div><div style="float: left;">'.theme_display_bar($disk_usage, $USER_DATA['group_quota'],150,'', '', '/'.$USER_DATA['group_quota'].'&nbsp;'.$lang_byte_units[1],'red','green').'</div>';
        }
    }
    $max_fsize = sprintf($lang_upload_php['max_fsize'], cpg_format_bytes($max_file_size)).$disk_usage_output;



For the flash uploader the quota should be updated after each upload IMHO. This isn't implemented yet.

Oldiesmann

Thanks for the help. I've gotten all the other custom changes figured out and will be testing things in the coming weeks. I'll let you know if I have any more questions :)
Michael "Oldiesmann" Eshom
SMF Project Manager