Advanced search  

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Pages: [1]   Go Down

Author Topic: Disable Right Click  (Read 6482 times)

0 Members and 1 Guest are viewing this topic.

karmicblonde

  • Coppermine newbie
  • Offline Offline
  • Posts: 4
Disable Right Click
« on: November 20, 2006, 12:55:29 am »

Hey Guys,
Ive just updated one site to 1.4.10  and Im trying to add a code I had for 1.4.9.. and it doesnt seem to be working..


code (for disable right click) Is:



<body>
<script language=JavaScript>
<!--

//Disable right mouse click Script
//Prairie Was Here


var message="Copyright 2006 Muze.ca";

///////////////////////////////////
function clickIE4(){
if (event.button==2){
alert(message);
return false;
}
}

function clickNS4(e){
if (document.layers||document.getElementById&&!document.all){
if (e.which==2||e.which==3){
alert(message);
return false;
}
}
}

if (document.layers){
document.captureEvents(Event.MOUSEDOWN);
document.onmousedown=clickNS4;
}
else if (document.all&&!document.getElementById){
document.onmousedown=clickIE4;
}

document.oncontextmenu=new Function("alert(message);return false")

// -->
</script>
<div id="Menu1" style="position:absolute; width:800px; height:30px; z-index:1; left: 20px; top: 100px; visibility: hidden;">                <span class="topmenu">

                        <table border="0" cellpadding="0" cellspacing="0">

                                <tr>
                                        <td>




No matter where I try - this just doesnt seem to be working on the upgrade... any ideas????

Much Appreciated!!!!!!!

R.

« Last Edit: November 20, 2006, 06:00:28 am by Sami »
Logged

Sami

  • VIP
  • Coppermine addict
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 3686
  • BMossavari
    • My Project
Re: Disable Right Click
« Reply #1 on: November 20, 2006, 05:38:14 am »

post a link to the gallery
Logged
‍I don't answer to PM with support question
Please post your issue to related board

karmicblonde

  • Coppermine newbie
  • Offline Offline
  • Posts: 4
Re: Disable Right Click
« Reply #2 on: November 20, 2006, 05:40:17 am »

sorry..lol

www.BeerGraffitiWalls.com

and thank you
Logged

Sami

  • VIP
  • Coppermine addict
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 3686
  • BMossavari
    • My Project
Re: Disable Right Click
« Reply #3 on: November 20, 2006, 05:45:44 am »

Where did you put that code !?
I don't see it on your gallery
Logged
‍I don't answer to PM with support question
Please post your issue to related board

karmicblonde

  • Coppermine newbie
  • Offline Offline
  • Posts: 4
Re: Disable Right Click
« Reply #4 on: November 20, 2006, 05:47:59 am »

thats just it...

it works at another site - on the previous vers.  www.photos.muze.ca

I cant put it on www.BeerGraffitiWalls.com - I cant seem to find where I can place it where its recognized  :(
Logged

Sami

  • VIP
  • Coppermine addict
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 3686
  • BMossavari
    • My Project
Re: Disable Right Click
« Reply #5 on: November 20, 2006, 05:50:30 am »

Then put it under themes/your theme/template.html
Logged
‍I don't answer to PM with support question
Please post your issue to related board

karmicblonde

  • Coppermine newbie
  • Offline Offline
  • Posts: 4
Re: Disable Right Click
« Reply #6 on: November 20, 2006, 05:58:34 am »

thank you SOOO MUCH

I (UNfortunately)  would NEVER have figured that out on my own! LOL


thank you thank you thank you!

R.
Logged

kenth32

  • Coppermine newbie
  • Offline Offline
  • Posts: 2
Re: Disable Right Click
« Reply #7 on: December 29, 2006, 04:41:48 am »

Thanks for posting the script, it seems to have one minor flaw.
The script works only when viewing the normal_pictures and in the main gallery.

If you click on the image to open it to full size the right click is still accessable.
The script only seems to prevent right-click the scaled down versions of the pictures.

Is there a way to disable the right click on the full size image?

Kent
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: Disable Right Click
« Reply #8 on: December 29, 2006, 08:49:58 am »

Edit themes/yourtheme/theme.php, find
Code: [Select]
function theme_display_fullsize_pic()and add the suggested code into the HTML template section. If you don't have this section in your custom theme, find
Code: [Select]
?>in themes/yourtheme/theme.php and add into a new line before it the code below:
Code: [Select]
// Display the full size image
function theme_display_fullsize_pic()
{
    global $CONFIG, $THEME_DIR, $ALBUM_SET;
    global $lang_errors, $lang_fullsize_popup, $lang_charset;

    if (isset($_GET['picfile']))
    {
        if (!GALLERY_ADMIN_MODE) cpg_die(ERROR, $lang_errors['access_denied'], __FILE__, __LINE__);

    $picfile = $_GET['picfile'];
    $picname = $CONFIG['fullpath'] . $picfile;
    $imagesize = @getimagesize($picname);
    $imagedata = array('name' => $picfile, 'path' => path2url($picname), 'geometry' => $imagesize[3]);
    }
    elseif (isset($_GET['pid']))
    {
    $pid = (int)$_GET['pid'];
    $sql = "SELECT * " . "FROM {$CONFIG['TABLE_PICTURES']} " . "WHERE pid='$pid' $ALBUM_SET";
    $result = cpg_db_query($sql);

    if (!mysql_num_rows($result)) cpg_die(ERROR, $lang_errors['non_exist_ap'], __FILE__, __LINE__);

    $row = mysql_fetch_array($result);
    $pic_url = get_pic_url($row, 'fullsize');
    $geom = 'width="' . $row['pwidth'] . '" height="' . $row['pheight'] . '"';
    $imagedata = array('name' => $row['filename'], 'path' => $pic_url, 'geometry' => $geom);
    }

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
  <head>
  <meta http-equiv="content-type" content="text/html; charset=<?php echo $CONFIG['charset'] == 'language file' $lang_charset $CONFIG['charset'?>" />
  <title><?php echo $CONFIG['gallery_name'?>: <?php echo $lang_fullsize_popup['click_to_close'];
      
?>
</title>
  <script type="text/javascript" src="scripts.js"></script>
  <style type="text/css">
  body { margin: 0; padding: 0; background-color: gray; }
  img { margin:0; padding:0; border:0; }
  #content { margin:0 auto; padding:0; border:0; }
  table { border:0; height:100%; width:100%; border-collapse:collapse}
  td {         vertical-align: middle; text-align:center; }
  </style>
  </head>
  <body>
    <script language="JavaScript" type="text/JavaScript">
      adjust_popup();
    </script>
    <table>
      <tr>
            <td>
          <div id="content">
              <?php     echo  '<a href="javascript: window.close()"><img src="'
                
htmlspecialchars($imagedata['path']) . '" '
                
$imagedata['geometry']
                . 
'alt="'
                
htmlspecialchars($imagedata['name'])
                . 
'" title="'
                
htmlspecialchars($imagedata['name'])
                . 
"\n" $lang_fullsize_popup['click_to_close']
                . 
'" /></a><br />' ."\n";
               
?>

          </div>
        </td>
      </tr>
    </table>
  </body>
</html>
<?php
}

This being said: no-right-click scripts are just silly. Don't use them. They suck. If you want to find out why, search the board - we have discussed this in many threads already.
Logged
Pages: [1]   Go Up
 

Page created in 0.022 seconds with 19 queries.