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

Author Topic: Removing URL and Favorites from File information block?  (Read 4072 times)

0 Members and 1 Guest are viewing this topic.

protheus

  • Coppermine newbie
  • Offline Offline
  • Posts: 7
Removing URL and Favorites from File information block?
« on: February 11, 2011, 03:15:38 pm »

Hello,

I've tried to find out something about this URL and Favorites removal on the forum, but couldn't reach anything close to what I need. For now the Description of the image has only two stats, On or Off, so I am curios (and in need) of how to disable just 2 ranges from that, in my case the URL and Favorites fields. I've tried finding a plugin for that, but search ended with 0 result everytime. So, I've tried on a test bench (my gallery cloned on my home pc) to manually edit bits of code here and there, related to it, but every time ended in an error, mostly because I'm under the beginner level in the php / html / script coding business. I've tried also to change the SQL db fields, also with no success.

So from this:

File information
Filename:          XYZ.jpg
Album name:     someone / Noncoder
Keywords:        bla bla bla
Filesize:              XYZ KiB
Date added:     Jan XX 2029
Dimensions:      YYYY x ZZZZ pixels
Displayed:       "a few" times
URL:            http://www.jurnalulm.eu/displayimage.php?pid=290
Favorites:   Add to Favorites
I need the bolded ones to be masked, hidden, removed or any other action that makes them not visible for non-admin members.

Any advice? (gallery link, if needed http://www.jurnalulm.eu )

Thank you in advance,

Catalin C.
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15760
Re: Removing URL and Favorites from File information block?
« Reply #1 on: February 11, 2011, 10:25:33 pm »

Open displayimage.php, find
Code: [Select]
   // Create the absolute URL for display in info
    $info[$lang_picinfo['URL']] = '<a href="' . $CONFIG["ecards_more_pic_target"] . (substr($CONFIG["ecards_more_pic_target"], -1) == '/' ? '' : '/') .basename($CPG_PHP_SELF) . "?pid={$CURRENT_PIC_DATA['pid']}" . '" >' . $CONFIG["ecards_more_pic_target"] . (substr($CONFIG["ecards_more_pic_target"], -1) == '/' ? '' : '/') . basename($CPG_PHP_SELF) . "?pid={$CURRENT_PIC_DATA['pid']}" . '</a>';

    // Create the add to fav link
    $ref = $REFERER ? "&amp;referer=$REFERER" : '';
    
    if (!in_array($CURRENT_PIC_DATA['pid'], $FAVPICS)) {
        $info[$lang_picinfo['addFavPhrase']] = "<a href=\"addfav.php?pid=" . $CURRENT_PIC_DATA['pid'] . $ref . "\" >" . $lang_picinfo['addFav'] . '</a>';
    } else {
        $info[$lang_picinfo['addFavPhrase']] = "<a href=\"addfav.php?pid=" . $CURRENT_PIC_DATA['pid']  . $ref . "\" >" . $lang_picinfo['remFav'] . '</a>';
    }
and delete it or add a check for GALLERY_ADMIN_MODE if you need to have that rows for admins.


Moving to themes board.
Logged

Phill Luckhurst

  • Administrator
  • Coppermine addict
  • *****
  • Country: gb
  • Offline Offline
  • Gender: Male
  • Posts: 4826
    • Windsurf.me
Re: Removing URL and Favorites from File information block?
« Reply #2 on: February 11, 2011, 10:42:18 pm »

Maybe for a future release this should be a theme selectable item (in theme.php)?
Logged
It is a mistake to think you can solve any major problems just with potatoes.

protheus

  • Coppermine newbie
  • Offline Offline
  • Posts: 7
Re: Removing URL and Favorites from File information block?
« Reply #3 on: February 11, 2011, 11:41:27 pm »

Thanks Andre. I will try tomorrow the "doctor prescribed medicine". And also thank you for moving the topic. I wandered around for some time and still missed the right direction, it seems.

Phill, that would really be great, especially because there are plugin's that change the way the download link and other fields of the Description "box" appear and where you can place them, and in a better/ergonomic way.

As soon as I manage to test and implement the very tiny and highly microscopic change (I'm really ashamed I missed that spot, seems I'm even worse at programming than I thought) I will "close the case".

Thank you alot,

Catalin C.
Logged

protheus

  • Coppermine newbie
  • Offline Offline
  • Posts: 7
Re: Removing URL and Favorites from File information block?
« Reply #4 on: February 13, 2011, 02:03:00 pm »

Perfect, the solution works as it should, and the code part, I just moved it to a new file, in case I will need it back sometime.

Thank you very much,

Catalin C.
Logged

protheus

  • Coppermine newbie
  • Offline Offline
  • Posts: 7
Re: Removing URL and Favorites from File information block?
« Reply #5 on: March 03, 2011, 08:45:55 am »

Okay, sorry for coming back on this solved thread, but after I removed that bits of code, in the log "database" appears some strange things:

Code: [Select]
2011年 03月 02日 04:45 AM - While executing query 'SELECT r.pid, r.aid, filepath, filename, url_prefix, pwidth, pheight, filesize, ctime, r.title, r.keywords, r.votes, pic_rating, hits, caption, r.owner_id
FROM cpg_pictures AS r
INNER JOIN cpg_albums AS a ON a.aid = r.aid
WHERE (1)
AND approved = 'YES'
ORDER BY r.pid ASC LIMIT 0 ,-2' in include/functions.inc.php on line 1501 the following error was encountered:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '-2' at line 6
Mar 02, 2011 at 08:43 PM - While executing query 'SELECT r.pid, r.aid, filepath, filename, url_prefix, pwidth, pheight, filesize, ctime, r.title, r.keywords, r.votes, pic_rating, hits, caption, r.owner_id FROM cpg_pictures AS r
WHERE ((aid = 1 ) OR (keywords like '%(a user name was here, replaced it for privacy reasons)%' ))AND approved='YES'
ORDER BY filename DESC, pid DESC
LIMIT 0 ,-25' in include/functions.inc.php on line 1305 the following error was encountered:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '-25' at line 4
2011年 03月 03日 06:49 AM - While executing query 'SELECT cid FROM cpg_categories WHERE lft BETWEEN AND ' in include/functions.inc.php on line 54 the following error was encountered:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'AND' at line 1
2011年 03月 03日 07:24 AM - While executing query 'SELECT cid FROM cpg_categories WHERE lft BETWEEN AND ' in include/functions.inc.php on line 54 the following error was encountered:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'AND' at line 1

Everything is working as it should, but I'm just wondering if this is something to be scared of?

Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15760
Re: Removing URL and Favorites from File information block?
« Reply #6 on: March 03, 2011, 09:48:00 am »

Those errors aren't connected with this mod. You'll see big red error boxes while viewing your gallery when those errors occur.
Logged
Pages: [1]   Go Up
 

Page created in 0.021 seconds with 20 queries.