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   Go Down

Author Topic: When vote for file... New feature.  (Read 39004 times)

0 Members and 1 Guest are viewing this topic.

Master of Orion

  • Coppermine newbie
  • Offline Offline
  • Gender: Male
  • Posts: 10
    • Wonderful China
When vote for file... New feature.
« on: March 06, 2006, 10:59:28 am »

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/

« Last Edit: March 17, 2006, 05:21:17 pm by GauGau »
Logged

twistah

  • Coppermine newbie
  • Offline Offline
  • Posts: 4
Re: When vote for file... New feature.
« Reply #1 on: March 16, 2006, 12:46:40 pm »

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

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: When vote for file... New feature.
« Reply #2 on: March 16, 2006, 03:45:35 pm »

please post it.
Logged

twistah

  • Coppermine newbie
  • Offline Offline
  • Posts: 4
Re: When vote for file... New feature.
« Reply #3 on: March 17, 2006, 10:21:22 am »

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:

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

Code: [Select]
...

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

crxman

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 27
Re: When vote for file... New feature.
« Reply #4 on: April 14, 2006, 04:35:20 pm »

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

adiboy

  • Coppermine novice
  • *
  • Offline Offline
  • Gender: Male
  • Posts: 37
    • Computer repair stoke on trent
Re: When vote for file... New feature.
« Reply #5 on: May 09, 2006, 11:15:56 pm »

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

complexity

  • Coppermine newbie
  • Offline Offline
  • Posts: 3
Re: When vote for file... New feature.
« Reply #6 on: May 15, 2006, 01:37:02 pm »

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

war59312

  • Coppermine newbie
  • Offline Offline
  • Gender: Male
  • Posts: 6
  • God Bless America
    • Will's Blog
Re: When vote for file... New feature.
« Reply #7 on: May 17, 2006, 01:21:43 am »

Yeah it's broke, sadly. :(

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

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: When vote for file... New feature.
« Reply #8 on: May 17, 2006, 01:24:15 am »

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
« Last Edit: May 19, 2006, 06:19:25 am by GauGau »
Logged

complexity

  • Coppermine newbie
  • Offline Offline
  • Posts: 3
Re: When vote for file... New feature.
« Reply #9 on: May 18, 2006, 09:33:00 am »

hmmm no luck anyone got this working that can help ?
Logged

younk

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 28
Re: When vote for file... New feature.
« Reply #10 on: May 31, 2006, 12:25:30 pm »

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

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: When vote for file... New feature.
« Reply #11 on: June 01, 2006, 07:36:24 am »

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

younk

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 28
Re: When vote for file... New feature.
« Reply #12 on: June 01, 2006, 12:02:11 pm »

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

younk

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 28
Re: When vote for file... New feature.
« Reply #13 on: June 01, 2006, 12:47:35 pm »

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

Nibbler

  • Guest
Re: When vote for file... New feature.
« Reply #14 on: June 01, 2006, 02:43:57 pm »

Post your changed file.
Logged

Dr Preacox

  • Contributor
  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 122
  • Is the Matrix...
    • Dynamic Creations
Re: When vote for file... New feature.
« Reply #15 on: June 01, 2006, 02:49:28 pm »

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 ...
Logged
My Mods:
Making Memberlist Public - VIEW
Different Way of Displaying Categories - VIEW
Coming Soon - Automated Sub Domains -MOD

younk

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 28
Re: When vote for file... New feature.
« Reply #16 on: June 05, 2006, 08:28:22 pm »

Logged

Nibbler

  • Guest
Re: When vote for file... New feature.
« Reply #17 on: June 05, 2006, 08:49:26 pm »

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

younk

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 28
Re: When vote for file... New feature.
« Reply #18 on: June 06, 2006, 10:36:54 am »

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  ;)
Logged

complexity

  • Coppermine newbie
  • Offline Offline
  • Posts: 3
Re: When vote for file... New feature.
« Reply #19 on: June 08, 2006, 06:27:39 pm »

anyone get this working yet..
Logged
Pages: [1] 2   Go Up
 

Page created in 0.032 seconds with 19 queries.