Direct Links to Pictures Under Thumbnails (and after uploading, too) [MOD/HACK] Direct Links to Pictures Under Thumbnails (and after uploading, too) [MOD/HACK]
 

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

Direct Links to Pictures Under Thumbnails (and after uploading, too) [MOD/HACK]

Started by faptastic, July 16, 2006, 02:38:18 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

faptastic

Sorry, I'm not sure if this is the right category, but's relating to themes and visual appearance, so here goes.

Anyways, I use cpg to let people browse, or direct link. In fact, direct linking is only allowed on a few domains through .htaccess and such, but that's a different story.

The first mod is for showing direct links in text boxes in the thumbnail viewing. However, when you click on the text box, all of the text is copied, allowing the user to simply click and cut and paste the whole direct link.

The second mod is the same thing, only it shows it at the top of each screen when you're uploading and placing files. It also needs improvement.

First mod screenshot:
http://img135.imageshack.us/img135/1707/picture1dm2.png
and the code:

Find

        $pic_data = get_pic_data($album, $thumb_count, $album_name, $lower_limit, $thumb_per_page);

        $total_pages = ceil($thumb_count / $thumb_per_page);

        $i = 0;
        if (count($pic_data) > 0) {


and add after it
        //START HAX
        echo("<script type=\"text/javascript\">
        function highlight(field) {
       
        field.focus();
       
        field.select();
}
       
</script>
        ");
        //END HAX


then find
                        $pic_url =  get_pic_url($row, 'thumb');

                        if (!is_image($row['filename'])) {
                                $image_info = getimagesize(urldecode($pic_url));
                                $row['pwidth'] = $image_info[0];
                                $row['pheight'] = $image_info[1];
                        }

                        $image_size = compute_img_size($row['pwidth'], $row['pheight'], $CONFIG['thumb_width']);

                        $thumb_list[$i]['pos'] = $key < 0 ? $key : $i - 1 + $lower_limit;
                        $thumb_list[$i]['pid'] = $row['pid'];;

$thumb_list[$i]['image'] = "<img src=\"" . $pic_url . "\" class=\"image\" {$image_size['geom']} border=\"0\" alt=\"{$row['filename']}\" title=\"$pic_title\"/>";


and comment out
$thumb_list[$i]['caption'] = bb_decode($row['caption_text']);
and after that line add
//START HAX
$hax_ctext = bb_decode($row['caption_text']);
if ($hax_ctext == ""){ $hax_br = ""; }else{ $hax_br = "<br>"; }
                        $thumb_list[$i]['caption'] = $hax_ctext . $hax_br . "<input type=\"text\" onClick='highlight(this);' style=\"width: 115px;\" size=\"21\" value=\"".$CONFIG['ecards_more_pic_target'].get_pic_url($row, '')."\" />";
//END HAX




the second mod has no screenshot. However, it does what the first one does when you upload. You upload, click continue, choose the album, and click continue. Then, on the next page is the URL as well as the album selection screen for the next file which needs to have an album selected. I would not recommend using it until someone does a better job. Here is the code:

find
            // Change file permission
            @chmod($uploaded_pic, octdec($CONFIG['default_file_mode'])); //silence the output in case chmod is disabled

            // Create thumbnail and internediate image and add the image into the DB
            $result = add_picture($album, $filepath, $picture_name, 0,$title, $caption, $keywords, $user1, $user2, $user3, $user4, $category, $raw_ip, $hdr_ip, $movie_wd, $movie_ht);


and after that add


//OMGHAX

if ($uploaded_pic != ""){
echo ("
<center><table><tr><td><center>
<script type=\"text/javascript\">

function highlight(field) {
        field.focus();
        field.select();
}
</script>

Direct link to the last picture you uploaded:
<br>
<form>
<input type=\"text\" onClick='highlight(this);' style=\"width: 500px\" size=\"70\" value=\"".$CONFIG['ecards_more_pic_target']. $uploaded_pic."\" />
</form>

<br>
Don't forget to click continue after copy and pasting this link!
</center></td></tr></table></center>

");
}


//end OMGHAX




Well, that's it. and remember, TRY THIS ON A TEST INSTALLATION FIRST!

Joachim Müller

Thanks for your contrib. You should post what files to edit, this is not obvious for most users. Also, you should keep different mods in different threads for ease of use.
Attaching your screenshot to posting.

boltonline


Nibbler


boltonline

Quote from: Nibbler on July 25, 2006, 10:02:03 PM
First mod is include/functions.inc.php, second is upload.php
thanks!

i was wondering if anyone knew how to make this so it would only show up if you were logged on as one of the users?

Joachim Müller

Quote from: boltonline on July 25, 2006, 09:47:52 PM
anybody know what file that is that you are sopost to edit?
@faptastic: that's why I didn't move this thread to the mods section: the instructions are incomplete.

@boltonline:
if (USER_ID){
    // code for registered users comes here
} else {
    // code for guests/anonymous visitors.
}

boltonline

where would i put that code?
Quote from: GauGau on July 25, 2006, 11:53:02 PM
if (USER_ID){
    // code for registered users comes here
} else {
    // code for guests/anonymous visitors.
}


UPDATE:
just use this as the code in place of the one above if you want it so only people who login can view the direct links:
//START HAX
if (USER_ID){
    $hax_ctext = bb_decode($row['caption_text']);
if ($hax_ctext == ""){ $hax_br = ""; }else{ $hax_br = "<br>"; }
                        $thumb_list[$i]['caption'] = $hax_ctext . $hax_br . "<input type=\"text\" onClick='highlight(this);' style=\"width: 115px;\" size=\"21\" value=\"".$CONFIG['ecards_more_pic_target'].get_pic_url($row, '')."\" />";

} else {
    // code for guests/anonymous visitors.
}
//END HAX