When vote for file... New feature. When vote for file... New feature.
 

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

When vote for file... New feature.

Started by Master of Orion, March 06, 2006, 10:59:28 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Master of Orion

Possible do? When vote for file, visitor goes to the next one in album?

Look at this for example - http://china.kulichki.com/english/girls/


twistah

Hello !

I have a dead simpe hack for this as I needed to speed up the voting process on my site as well.

Anyone interested to see the small modifications ?

Joachim Müller


twistah

Right.

Remember; this is a quick-and-dirty hack made to the Coppermine code on my site to speed up the voting process from a users standpoint.
The problem is that after voting on an image in an album, the resulting page is the same image. The user then have to click the "next" button
to move on to the next image in the album.

Im a bit suprised this isnt an optional feature in Coppermine (afaik).

So to the hack:

Open the include/theme.inc.php file, locate the heme_html_rating_box function.
Replace the theme_html_rating_box function to:


if (!function_exists('theme_html_rating_box')) {  //{THEMES}
function theme_html_rating_box()
{
    global $CONFIG, $CURRENT_PIC_DATA, $CURRENT_ALBUM_DATA, $THEME_DIR;
    global $template_image_rating, $lang_rate_pic, $pos, $album;

    if (!(USER_CAN_RATE_PICTURES && $CURRENT_ALBUM_DATA['votes'] == 'YES')) return '';

    $votes = $CURRENT_PIC_DATA['votes'] ? sprintf($lang_rate_pic['rating'], round($CURRENT_PIC_DATA['pic_rating'] / 2000, 1), $CURRENT_PIC_DATA['votes']) : $lang_rate_
pic['no_votes'];
    $pid = $CURRENT_PIC_DATA['pid'];

    if (defined('THEME_HAS_RATING_GRAPHICS')) {
        $location= $THEME_DIR;
    } else {
        $location= '';
    }

    if (isset($_GET['autonext'])){     
        $params = array('{TITLE}' => $lang_rate_pic['rate_this_pic'],
                '{VOTES}' => $votes,
                '{RATE0}' => "ratepic.php?pic=$pid&rate=0&nextpos=".($pos+1)."&album=$album",
                '{RATE1}' => "ratepic.php?pic=$pid&rate=1&nextpos=".($pos+1)."&album=$album",
                '{RATE2}' => "ratepic.php?pic=$pid&rate=2&nextpos=".($pos+1)."&album=$album",
                '{RATE3}' => "ratepic.php?pic=$pid&rate=3&nextpos=".($pos+1)."&album=$album",
                '{RATE4}' => "ratepic.php?pic=$pid&rate=4&nextpos=".($pos+1)."&album=$album",
                '{RATE5}' => "ratepic.php?pic=$pid&rate=5&nextpos=".($pos+1)."&album=$album",
                '{RUBBISH}' => $lang_rate_pic['rubbish'],
                '{POOR}' => $lang_rate_pic['poor'],
                '{FAIR}' => $lang_rate_pic['fair'],
                '{GOOD}' => $lang_rate_pic['good'],
                '{EXCELLENT}' => $lang_rate_pic['excellent'],
                '{GREAT}' => $lang_rate_pic['great'],
                '{WIDTH}' => $CONFIG['picture_table_width'],
                '{LOCATION}' => $location,        //theme dir or default images directory
                );
    }else{     
        $params = array('{TITLE}' => $lang_rate_pic['rate_this_pic'],
                '{VOTES}' => $votes,
                '{RATE0}' => "ratepic.php?pic=$pid&rate=0",
                '{RATE1}' => "ratepic.php?pic=$pid&rate=1",
                '{RATE2}' => "ratepic.php?pic=$pid&rate=2",
                '{RATE3}' => "ratepic.php?pic=$pid&rate=3",
                '{RATE4}' => "ratepic.php?pic=$pid&rate=4",
                '{RATE5}' => "ratepic.php?pic=$pid&rate=5",
                '{RUBBISH}' => $lang_rate_pic['rubbish'],
                '{POOR}' => $lang_rate_pic['poor'],
                '{FAIR}' => $lang_rate_pic['fair'],
                '{GOOD}' => $lang_rate_pic['good'],
                '{EXCELLENT}' => $lang_rate_pic['excellent'],
                '{GREAT}' => $lang_rate_pic['great'],
                '{WIDTH}' => $CONFIG['picture_table_width'],
                '{LOCATION}' => $location,        //theme dir or default images directory
                );

    }
    return template_eval($template_image_rating, $params);
}
}  //{THEMES}




And modify the last part of the ratepic.php


...

$nextposlink = $_GET['nextpos']."&album=".$_GET['album'];
$location = "displayimage.php?pos=";
$location .= isset($_GET['nextpos']) ? $nextposlink : (- $pic);

$header_location = (@preg_match('/Microsoft|WebSTAR|Xitami/', getenv('SERVER_SOFTWARE'))) ? 'Refresh: 0; URL=' : 'Location: ';
header($header_location . $location);
pageheader($lang_info, "<META http-equiv=\"refresh\" content=\"1;url=$location\">");
msg_box($lang_info, $lang_rate_pic_php['rate_ok'], $lang_continue, $location);
pagefooter();
ob_end_flush();

?>


Now, for making this work (Coppermine will behave as usual), you must add a query parameter to your link for the album you want your users to vote on.

This is the old type link: http://www.yoursite.com/album/displayimage.php?album=388&pos=0
This, with the extra parameter: http://www.yoursite.com/album/displayimage.php?album=388&pos=0&autonext=true

Again, this isnt a study of php code exellence, but a simple walkthrough of a 10 minutes hack to make voting easier for our users.

If wanted, I could sure make this more proper Coppermine style and quality.

(If I've forgotten somthing above, let me know)

/twistah

crxman

Very usefull mod thanks ! will wait for the final code to ad it :)

adiboy

is this code done yet coz i tryed it and it dosen't work.
Computer repair stoke on trent  :o http://sy2.com

complexity

this is exactly what i need, i think i added it correctly but no luck..

IF you could set it up like


find


replace

find

replace


It would be greatly appreciated. And am I understanding it correctly, this mod will move you on to the next image, after you vote?

war59312

Yeah it's broke, sadly. :(

Parse error: syntax error, unexpected T_STRING in /gallery/include/themes.inc.php on line 2303
God Bless America

Joachim Müller

#8
make sure you copied everything correctly.

Let me add a note that editing themes.inc.php is not recommended at all. Instead: edit themes/yourtheme/theme.php

complexity

hmmm no luck anyone got this working that can help ?

younk

I can't get it to work. I really really want it to, and i have tried in an hour, but it just show the same error:
Parse error: syntax error, unexpected T_STRING in /gallery/include/themes.inc.php on line 2303
Sadly

I hope someone get this to work, because it would really rock!

Joachim Müller

Did you paste in the dots at the very start of the code box? You mustn't, they are just meant to show you that there's code in front of it. The instructions for this mod are not newbie-safe, you can't just copy and paste. As suggested: editing themes.inc.php is silly in the first place, that's why I won't look into this. If the original contributor doesn't reply, there will probably little you can do.

younk

I thought they where typeos (type errors) I try again.

younk

I still can't get it to work. And you are right, but if this is the only way to make voting jump to next image i really need it.

You dont know another funktion to do this?

Nibbler


Dr Preacox

In a way I find this mod weird because it turns coppermine into a well advanced Hot or Not website, but I can see the benifits too ...
My Mods:
Making Memberlist Public - VIEW
Different Way of Displaying Categories - VIEW
Coming Soon - Automated Sub Domains -MOD


Nibbler

You've got that line split over 2 lines. Put them on the same line.

younk

Now i have corrected that file, but is still get this error:
Fatal error: Call to undefined function: theme_main_menu() in /mounted-storage/home11b/sub002/sc16206-UEQL/babez.dk/galleri/include/themes.inc.php on line 1213

I have uploadet the new files: www.younk.dk/test/files2.rar

I hope you can help me again.

BTW Thanks for the first part of help  ;)

complexity