Facebook  Twitter 

SMFHacks.com

+- +-

SMFHacks.com

+- User Information

Welcome, Guest.
Please login or register.
 
 
 
Forgot your password?

+- Forum Stats

Members
Total Members: 12414
Latest: danilubrin
New This Month: 4
New This Week: 3
New Today: 1
Stats
Total Posts: 39951
Total Topics: 7033
Most Online Today: 96
Most Online Ever: 2482
(April 09, 2011, 07:02:45 pm)
Users Online
Members: 0
Guests: 30
Total: 30

Author Topic: Edit picture problems  (Read 5889 times)

0 Members and 1 Guest are viewing this topic.

Offline iosarian

  • Newbie
  • *
  • Posts: 24
    • View Profile
Edit picture problems
« on: December 06, 2007, 02:44:48 pm »
1. After I edit picture uploaded by other administrator, it shows to me that the picture is uploaded by "guest".
2. The members can Bulk upload pictures without titles. But in edit view the titles are required.
3. When member edits picture and replaces the picture file, "next" and "previous" don't work.

Offline SMFHacks

  • Administrator
  • Hero Member
  • *****
  • Posts: 14980
    • View Profile
Re: Edit picture problems
« Reply #1 on: December 06, 2007, 09:53:46 pm »
On list of things to look into this weekend
Get your Forum Ranked! at https://www.forumrankings.net - find out how your forum compares with others!

Like What I do? Support me at https://www.patreon.com/vbgamer45/

Offline iosarian

  • Newbie
  • *
  • Posts: 24
    • View Profile
Re: Edit picture problems
« Reply #2 on: December 07, 2007, 05:23:41 pm »
In function EditPicture2(),                
// Update the Database entry
The query updates the ID_CAT and when user edits picture the ID_CAT in database is not "0". I think there is no need to update ID_CAT.

Offline SMFHacks

  • Administrator
  • Hero Member
  • *****
  • Posts: 14980
    • View Profile
Re: Edit picture problems
« Reply #3 on: December 08, 2007, 11:32:23 am »
Couldn't recreate number #1, #3 on my test gallery using the latest version.

#2 added in next update to for non gallery admin's to require the title.
Get your Forum Ranked! at https://www.forumrankings.net - find out how your forum compares with others!

Like What I do? Support me at https://www.patreon.com/vbgamer45/

Offline iosarian

  • Newbie
  • *
  • Posts: 24
    • View Profile
Re: Edit picture problems
« Reply #4 on: December 08, 2007, 02:08:05 pm »
#3: If member edits pictire and replace the file in gallery smf_gallery_pic table for this picture that ID_CAT is the same USER_ID_CAT. It happens after editing.
And if I have picture 1, 2, 3, 4 in one category and edit number 3, with "next" link in picture view it takes from number 2 to number 4 (skiping number 3)
I removed ID_CAT in update query and for now it seems it works.

#1: I only can tell you what happens in the database. After editing it show that ID_MEMBER is 99999.

Offline SMFHacks

  • Administrator
  • Hero Member
  • *****
  • Posts: 14980
    • View Profile
Re: Edit picture problems
« Reply #5 on: December 08, 2007, 02:15:56 pm »
For #3. USER_ID_CAT and ID_CAT can not be both set one needs to be zero otherwise it would cause problems.

For #1 This is the only portion of the code that deals with changing the picture owner and only updates if that member's name is found.
Code: [Select]
// Change the picture owner if selected
if (allowedTo('smfgallery_manage') && isset($_REQUEST['pic_postername']))
{
$pic_postername = str_replace('"','', $_REQUEST['pic_postername']);
$pic_postername = str_replace("'",'', $pic_postername);
$pic_postername = str_replace('\\','', $pic_postername);
$pic_postername = htmlspecialchars($pic_postername, ENT_QUOTES);

$memid = 0;

$dbresult = db_query("
SELECT
realName, ID_MEMBER
FROM {$db_prefix}members
WHERE realName = '$pic_postername' OR memberName = '$pic_postername'  LIMIT 1", __FILE__, __LINE__);
$row = mysql_fetch_assoc($dbresult);
mysql_free_result($dbresult);

if (db_affected_rows() != 0)
{
// Member found update the picture owner

$memid = $row['ID_MEMBER'];
db_query("UPDATE {$db_prefix}gallery_pic
SET ID_MEMBER = $memid WHERE ID_PICTURE = $id LIMIT 1", __FILE__, __LINE__);


}

}
Get your Forum Ranked! at https://www.forumrankings.net - find out how your forum compares with others!

Like What I do? Support me at https://www.patreon.com/vbgamer45/

Offline iosarian

  • Newbie
  • *
  • Posts: 24
    • View Profile
Re: Edit picture problems
« Reply #6 on: December 08, 2007, 02:41:20 pm »
For #3. USER_ID_CAT and ID_CAT can not be both set one needs to be zero otherwise it would cause problems.
In EditPicture2():
$cat = (int) $_REQUEST['cat'] but the link is "action=gallery;su=user;u=XXXX;cat=YYY" and I think $cat takes the YYY value which in this case is user category ID.
After that udate query updates the ID_CAT with $cat.

Offline SMFHacks

  • Administrator
  • Hero Member
  • *****
  • Posts: 14980
    • View Profile
Re: Edit picture problems
« Reply #7 on: December 08, 2007, 03:06:32 pm »
Fixed for next update

Open Sources/Gallery.php

Find
Code: [Select]
// Update the Database entry
$t = time();

db_query("UPDATE {$db_prefix}gallery_pic
SET ID_CAT = $cat, filesize = $filesize, filename = '" . $extrafolder . $filename . "',  thumbfilename = '" . $extrafolder . $thumbname . "', height = $sizes[1], width = $sizes[0], approved = $approved, date =  $t, title = '$title', description = '$description', keywords = '$keywords', allowcomments = $allowcomments, sendemail = $sendemail WHERE ID_PICTURE = $id LIMIT 1", __FILE__, __LINE__);


Change to
Code: [Select]

// Update the Database entry
$t = time();
if ($row['USER_ID_CAT'] == 0)
{
db_query("UPDATE {$db_prefix}gallery_pic
SET ID_CAT = $cat, filesize = $filesize, filename = '" . $extrafolder . $filename . "',  thumbfilename = '" . $extrafolder . $thumbname . "', height = $sizes[1], width = $sizes[0], approved = $approved, date =  $t, title = '$title', description = '$description', keywords = '$keywords', allowcomments = $allowcomments, sendemail = $sendemail WHERE ID_PICTURE = $id LIMIT 1", __FILE__, __LINE__);
}
else
{
db_query("UPDATE {$db_prefix}gallery_pic
SET USER_ID_CAT = $cat, filesize = $filesize, filename = '" . $extrafolder . $filename . "',  thumbfilename = '" . $extrafolder . $thumbname . "', height = $sizes[1], width = $sizes[0], approved = $approved, date =  $t, title = '$title', description = '$description', keywords = '$keywords', allowcomments = $allowcomments, sendemail = $sendemail WHERE ID_PICTURE = $id LIMIT 1", __FILE__, __LINE__);
}
Get your Forum Ranked! at https://www.forumrankings.net - find out how your forum compares with others!

Like What I do? Support me at https://www.patreon.com/vbgamer45/

 

Related Topics

  Subject / Started by Replies Last post
2 Replies
3265 Views
Last post September 17, 2009, 03:10:11 am
by Doughboy99
0 Replies
3309 Views
Last post October 16, 2010, 02:23:48 am
by morokat
0 Replies
2200 Views
Last post March 20, 2014, 04:12:32 pm
by Michel68
1 Replies
1872 Views
Last post October 28, 2014, 09:46:32 pm
by SMFHacks
1 Replies
267 Views
Last post August 27, 2019, 11:52:06 am
by SMFHacks

+- Recent Topics

Contact Page Problem by emmebroke
December 11, 2019, 04:19:25 pm

hashTags only used by admins, but visible to everyone? by SMFHacks
December 08, 2019, 05:09:23 pm

Responsive Layout by Matthias
November 30, 2019, 03:05:57 pm

Secure connection failed Pretty Url Pro by Rock Lee
November 26, 2019, 10:44:23 am

Black Friday Sale Week 2019 by SMFHacks
November 23, 2019, 04:47:56 pm

German Translation missing in SMF 2.1R1 by SMFHacks
November 19, 2019, 02:38:42 pm

Unread items issue by SMFHacks
November 19, 2019, 10:07:32 am

Update detect mobile mode PHP5 to PHP7 by Rock Lee
November 16, 2019, 07:18:13 pm

PHP error by davejo
November 12, 2019, 12:09:47 pm

Message Editor Pro Issues by SMFHacks
November 06, 2019, 09:58:33 pm

Powered by EzPortal