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: more than 4 custom fields in 1.5.3  (Read 14716 times)

0 Members and 1 Guest are viewing this topic.

localhistory

  • Coppermine newbie
  • Offline Offline
  • Posts: 4
more than 4 custom fields in 1.5.3
« on: April 01, 2010, 10:47:28 am »

Hi -

I'd like to use coppermine to catalog and display images from an historical association.  We use Dublin Core metadata to describe our images, which means we need 15 user defineable description fields.  I know there are some threads on modifying 1.4.3 for more than 4 user defineable description fields, but I don't know if these methods will work in 1.5.3.

Thanks!
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15760
Re: more than 4 custom fields in 1.5.3
« Reply #1 on: April 01, 2010, 11:00:32 am »

Please post those tutorials how to modify cpg1.4.x and we will see if that mod(s) can be applied to cpg1.5.x.
Logged

localhistory

  • Coppermine newbie
  • Offline Offline
  • Posts: 4
Re: more than 4 custom fields in 1.5.3
« Reply #2 on: April 01, 2010, 10:35:15 pm »

The second to last post in thread lists a solution for 1.4.x

http://forum.coppermine-gallery.net/index.php/topic,7803.0.html

Thanks!
Logged

Jeff Bailey

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: us
  • Offline Offline
  • Gender: Male
  • Posts: 1322
  • Fishing relaxes me.
    • Bailey Family Co.
Re: more than 4 custom fields in 1.5.3
« Reply #3 on: April 01, 2010, 11:30:12 pm »

That is a mod for 1.3.x  ;)

this one is for 1.4.x => http://forum.coppermine-gallery.net/index.php/topic,23695.0.html
I don't know if it will work for 1.5.x though
Logged
Thinking is the hardest work there is, which is probably the reason why so few engage in it. - Henry Ford

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15760
Re: more than 4 custom fields in 1.5.3
« Reply #4 on: April 02, 2010, 08:11:41 am »

Looks like this mod can be ported to cpg1.5.x. But you have to consider http://documentation.coppermine-gallery.net/en/dev_superglobals.htm

Maybe we can change the Coppermine code in a way, that the modification effort can be reduced or even be dropped and the mod can be converted to a plugin. I'll have a look at it after the Easter weekend.
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: more than 4 custom fields in 1.5.3
« Reply #5 on: April 02, 2010, 09:17:55 am »

There is a way to circumvent the extra security that Inspekt adds - take a look at the Joomla bridge:
Concerning the code used in my bridge, I guess I'm not respecting the "spirit" of the  "Inspekt package" . I  got to access directly to stored superglobals with "_source" property  (especially $COOKIE) before calling Joomla .
I'm not fond though of that "lazy" way of programming.
The entire approach of that mod that requires an awfull lot of modifications is something that I'm not very fond of, so let's review the entire idea:
I'd like to use coppermine to catalog and display images from an historical association.  We use Dublin Core metadata to describe our images, which means we need 15 user defineable description fields.  I know there are some threads on modifying 1.4.3 for more than 4 user defineable description fields, but I don't know if these methods will work in 1.5.3.
Why not use IPTC instead? The data can then be stored as meta data inside the image, so you don't lose anything if you should decide to use another app. The drawback is that coppermine can only read IPTC data, but it can not write it back, so the additional information would reside in Coppermine's database.
Logged

localhistory

  • Coppermine newbie
  • Offline Offline
  • Posts: 4
Re: more than 4 custom fields in 1.5.3
« Reply #6 on: April 02, 2010, 07:22:54 pm »

RE: IPTC

There are a few issues there.

We're looking for a way for small (read underfunded with volunteers with zero to minimal computer skills) local historical groups to be able to catalog and digitize their collections and make them accessible to the public and the worldwide scholarly community.  Coppermine would be ideal for this because it's free, photo and data entry is easy, and it will run on really cheap shared hosting. 

Using IPTC would mean adding a layer of complexity and expense.  The data would have to be attached to each image with a program capable of doing so, and volunteers would have to learn an additional procedure.  The fewer steps for the volunteers and the less they have to learn, the better.

The biggest issue is probably that IPTC is a standard for press images and the metadata fields reflect this.  We're going to be cataloging documents and objects in addition to photos.  I realize we could fudge things a little, but this would mean getting volunteers to understand that IPTC metadata field "X" is really Dublin Core metadata field "Y."  Trust me, this is a recipe for data entry disaster.

My bet is that if additional metadata fields could be easily added to coppermine you would get quite a following in the museum and library communities.  The one decent web gallery product that allows for Dublin Core is ridiculously expensive and charges rip-off hosting and maintenance rates.
Logged

deanhat

  • Contributor
  • Coppermine newbie
  • ***
  • Offline Offline
  • Posts: 13
Re: more than 4 custom fields in 1.5.3
« Reply #7 on: April 05, 2010, 04:25:59 pm »

there is a full tutorial on thishttp://www.bloggersplace.com/tutorials/ site with pictures and download files ..  . i think if you have a clean install of coppermine 1.5.3 you can just replace the files with the download files .. make sure to backup your files your replacing though . I took the Liberty to attach the files here aswell ,,
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: more than 4 custom fields in 1.5.3
« Reply #8 on: April 06, 2010, 07:22:31 am »

Thanks for your time to come up with those instructions and your readiness to share them. I have changed your profile status accordingly. However, there are some things I'd like to remark first regarding your tutorial:

  • It's not a bright idea to use the zip archive attached if you're running anything else than cpg1.5.3 RC
  • There is no guarantee that I haven't made a mistake performing the copy and paste, nor is there any gauarntee that the code changes posted will work in the first place
  • I'm still convinced that nobody needs so many extra fields

Please allow me as well to post my thoughts on your tutorial itself
  • The colors you use are a no-no
  • URLs with file names with spaces in it (like custom fields to coppermine.php) are a very bad idea, and they lead to URLs like http://www.bloggersplace.com/tutorials/addinfieldstocoppermine1.5.x/custom%20fields%20to%20coppermine.php that simply don't look nice
  • Capitalization: in English sentences start with an uppercase word. It increases readability a lot
  • Ortography: using a basic spell checker (decent browsers come with spell checkers) can correct the worst mistakes, which increases the readability and (most importantly) the credibility of your postings
  • Some of your instructions (like the database manipulation section) are incomplete or inaccurate
  • Indentation of code increases readability enourmously
  • Your usage of punctuation marks is... exotic (like the ,,,,, lines). Doesn't look nice nor interessting nor does it give you an individual note. It just looks...bad
  • I'm pretty sure that you assume too much: posting detailed instructions means posting detailed instructions: in several spaces you just write "etc. etc." - the needed steps might be obvious to you, but not to the newbies who try to replicate this complicated hack.
  • Wannabe-jokes with the confusion of the words "ass" and "add" are not funny.

Anyway: instructions start here:

Tutorial on how to add more custom fields to your picture in coppermin 1.5.x
(lets all just take some time and love opensource)

If you use the download files then be sure those files you overrighting have not been modified ,, the files in the add on is edited from the file you would have if you had a clean install of coppermine 1.5.x

here are my files you can download if you want to compare or replace with your clean instalation of coppermine

please be sure to Backup any file you replace

You can find the latest updates to coppermine 1.5.x at sourceforge.net
here is a screenshot of the outcome :
« Last Edit: April 06, 2010, 08:05:33 am by Joachim Müller »
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: more than 4 custom fields in 1.5.3
« Reply #9 on: April 06, 2010, 07:26:38 am »

Adding custom fields to coppermine 1.5.x
step 1
changing your SQL database and adapting it to changes :

open your sql database manager tool (im using phpmyadmin) and access your database then the table called 'cpg15x_config'(this is the default name)
Screenshot step01.1.jpg
next we will add new rows to this table , the pictures have 4 fields at the moment and we want to add more so we will have to add to the table ; user_field5_name ; user_field6_name etc. you can add as many as you need i added 8 but to keep the tutorial little more simple i will only add 4 here you can use your own logic to add more ;-)
so now just click the insert tab and add the fields "user_field5_name" etc...
FYI these rows hold the data you want your picture fields when uploading to be named ...........
Screenshot step01.2.jpg
so when that is done we will move to changing the _pictures table
now go to the cpg15x_pictures and look at the structure
there are fields called user1 , user2 , etc.

FYI. this is where coppermine will save the data the user types in to the custom picture fields
Screenshot step01.3.jpg
if we look at the structure of the field it has user(x) as varchar(255) with collation latin1_swedish_ci(this may vary and its important that you add tables in the same collation as the ones already in the database)and is not null, so now we will make 4 more fields adding to the user 4 and so on .

now lets add the fields we need. Right at the bottom of the sturcture window there is a add fields field , so now

add 4 fields > at end of table > hit "go"

now fill the new details for the new fields as shown below
Screenshot step01.4.jpg
 then hit "save"

... now you will be happy to know that step1 is over and we are done editing the database ....go have a smoke/coffie
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: more than 4 custom fields in 1.5.3
« Reply #10 on: April 06, 2010, 07:28:15 am »

Step2.Editing/modifing the db_input.php file

lets open the db_input.php file .

look for the code :
Code: [Select]
if (!USER_CAN_UPLOAD_PICTURES) {
if ($CONFIG['log_mode'] != 0) {
log_write('Denied privileged access to db_input.php (upload picture) for user '.$USER_DATA['user_name'].' at ' . $hdr_ip, CPG_SECURITY_LOG);
}
cpg_die(ERROR, $lang_errors['perm_denied'], __FILE__, __LINE__);
}

$album = $superCage->post->getInt('album');
$title = $superCage->post->getEscaped('title');
$caption = $superCage->post->getEscaped('caption');
$keywords = $superCage->post->getEscaped('keywords');
$user1 = $superCage->post->getEscaped('user1');
$user2 = $superCage->post->getEscaped('user2');
$user3 = $superCage->post->getEscaped('user3');
$user4 = $superCage->post->getEscaped('user4');
then add at the bottom of that
Code: [Select]
$user5 = $superCage->post->getEscaped('user5');
$user6 = $superCage->post->getEscaped('user6');
$user7 = $superCage->post->getEscaped('user7');
$user8 = $superCage->post->getEscaped('user8');
when that is done
now look for the code :
Code: [Select]
// Upload is ok
// 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, $superCage->post->getInt('width'), $superCage->post->getInt('height'));
then after $user4, add user5 and so forth
here is how it should look
Code: [Select]
// Upload is ok
// 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, $user5, $user6, $user7, $user8, $category, $raw_ip, $hdr_ip, $superCage->post->getInt('width'), $superCage->post->getInt('height'));
save the file !!
okay awesome stuff now the file feeding the database is edited ..
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: more than 4 custom fields in 1.5.3
« Reply #11 on: April 06, 2010, 07:29:39 am »

Step3.Editing/modifing the displayimage.php file

open file and look for this code , its around line 200
Code: [Select]
for ($i = 1; $i <= 4; $i++) {then change the 4 to the amount of fields you need (when adding 4 the code should be
Code: [Select]
for ($i = 1; $i <= 8; $i++) {this code you should finde around line 200 in the cade

Save your file
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: more than 4 custom fields in 1.5.3
« Reply #12 on: April 06, 2010, 07:32:57 am »

Step4.Editing/modifing the editpics.php file

open file and look for this code
Code: [Select]
$THUMB_ROWSPAN = 5;then change the 5 to the amount of fields you need +1 for spacing (when adding 4 the code should be :
Code: [Select]
$THUMB_ROWSPAN = 9;this code you should find around line 108

now just below that is this code
Code: [Select]
if ($CONFIG['user_field1_name'] != '') {
$THUMB_ROWSPAN++;
}
if ($CONFIG['user_field2_name'] != '') {
$THUMB_ROWSPAN++;
}
if ($CONFIG['user_field3_name'] != '') {
$THUMB_ROWSPAN++;
}
if ($CONFIG['user_field4_name'] != '') {
$THUMB_ROWSPAN++;
}
add onto this code
Code: [Select]
if ($CONFIG['user_field5_name'] != '') {
$THUMB_ROWSPAN++;
}
etc....

so at the end the code should look like this :
Code: [Select]
if ($CONFIG['user_field1_name'] != '') {
$THUMB_ROWSPAN++;
}
if ($CONFIG['user_field2_name'] != '') {
$THUMB_ROWSPAN++;
}
if ($CONFIG['user_field3_name'] != '') {
$THUMB_ROWSPAN++;
}
if ($CONFIG['user_field4_name'] != '') {
$THUMB_ROWSPAN++;
}
if ($CONFIG['user_field5_name'] != '') {
$THUMB_ROWSPAN++;
}
if ($CONFIG['user_field6_name'] != '') {
$THUMB_ROWSPAN++;
}
if ($CONFIG['user_field7_name'] != '') {
$THUMB_ROWSPAN++;
}
if ($CONFIG['user_field8_name'] != '') {
$THUMB_ROWSPAN++;
}
next we find this code
the next code should be located around line 149
Code: [Select]
$data = array(
array($icon_array['file_info'] . $lang_editpics_php['pic_info'], '', 3),
array($icon_array['album'] . $lang_common['album'], 'aid', 1),
array($icon_array['title'] . $lang_common['title'], 'title', 0, 255),
array($icon_array['description'] . $captionLabel, 'caption', 2, $CONFIG['max_img_desc_length']),
array($icon_array['keyword'] . $keywordLabel, 'keywords', 0, 255),
array($CONFIG['user_field1_name'], 'user1', 0, 255),
array($CONFIG['user_field2_name'], 'user2', 0, 255),
array($CONFIG['user_field3_name'], 'user3', 0, 255),
array($CONFIG['user_field4_name'], 'user4', 0, 255),
);
then we add to it so it looks like this
Code: [Select]
$data = array(
array($icon_array['file_info'] . $lang_editpics_php['pic_info'], '', 3),
array($icon_array['album'] . $lang_common['album'], 'aid', 1),
array($icon_array['title'] . $lang_common['title'], 'title', 0, 255),
array($icon_array['description'] . $captionLabel, 'caption', 2, $CONFIG['max_img_desc_length']),
array($icon_array['keyword'] . $keywordLabel, 'keywords', 0, 255),
array($CONFIG['user_field1_name'], 'user1', 0, 255),
array($CONFIG['user_field2_name'], 'user2', 0, 255),
array($CONFIG['user_field3_name'], 'user3', 0, 255),
array($CONFIG['user_field4_name'], 'user4', 0, 255),
array($CONFIG['user_field5_name'], 'user5', 0, 255),
array($CONFIG['user_field6_name'], 'user6', 0, 255),
array($CONFIG['user_field7_name'], 'user7', 0, 255),
array($CONFIG['user_field8_name'], 'user8', 0, 255),
);
just incase you have copied and pasted and just changed the values with flash gordan's speed but no presision, take a look again and make sure you changed the ['user_fieldX_name'] and the 'userX' next to it ...

okay next find the code 
Code: [Select]
$aid = $superCage->post->getInt("aid$pid");

$title = get_post_var('title', $pid);
$caption = get_post_var('caption', $pid);
$keywords = get_post_var('keywords', $pid);
$user1 = get_post_var('user1', $pid);
$user2 = get_post_var('user2', $pid);
$user3 = get_post_var('user3', $pid);
$user4 = get_post_var('user4', $pid);
and add to it so it looks like this
Code: [Select]
$aid = $superCage->post->getInt("aid$pid");

$title = get_post_var('title', $pid);
$caption = get_post_var('caption', $pid);
$keywords = get_post_var('keywords', $pid);
$user1 = get_post_var('user1', $pid);
$user2 = get_post_var('user2', $pid);
$user3 = get_post_var('user3', $pid);
$user4 = get_post_var('user4', $pid);
$user5 = get_post_var('user5', $pid);
$user6 = get_post_var('user6', $pid);
$user7 = get_post_var('user7', $pid);
$user8 = get_post_var('user8', $pid);
are you catching my drift ??

the next code is around line 290 by now .. it depends on how many fields you been adding
look for this code that will update your pictures
Code: [Select]
$update = "aid = '$aid'";
$update .= ", title = '$title'";
$update .= ", caption = '$caption'";
$update .= ", keywords = '$keywords'";
$update .= ", user1 = '$user1'";
$update .= ", user2 = '$user2'";
$update .= ", user3 = '$user3'";
$update .= ", user4 = '$user4'";
..... haaaa yea you guest it it should now look like this
Code: [Select]
$update = "aid = '$aid'";
$update .= ", title = '$title'";
$update .= ", caption = '$caption'";
$update .= ", keywords = '$keywords'";
$update .= ", user1 = '$user1'";
$update .= ", user2 = '$user2'";
$update .= ", user3 = '$user3'";
$update .= ", user4 = '$user4'";
$update .= ", user5 = '$user5'";
$update .= ", user6 = '$user6'";
$update .= ", user7 = '$user7'";
$update .= ", user8 = '$user8'";
..okay so now that we have our edit and updating script up to date ,, we can move on to the next step ....after having a nice cup of coffie/smoke
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: more than 4 custom fields in 1.5.3
« Reply #13 on: April 06, 2010, 07:36:41 am »

Step5.Editing/modifing the edit_one_pic.php file

okay so lets take a look here this is almost the same as the previous one so lets start with the 1st piece of code

here is the first code to be altered
Code: [Select]
//Check if the form token is valid
if(!checkFormToken()){
cpg_die(ERROR, $lang_errors['invalid_form_token'], __FILE__, __LINE__);
}

$pid = $superCage->post->getInt('id');
$aid = $superCage->post->getInt('aid');
$pwidth = $superCage->post->getInt('pwidth');
$pheight = $superCage->post->getInt('pheight');
$title = cpgSanitizeUserTextInput($superCage->post->getEscaped('title'));
$caption = cpgSanitizeUserTextInput($superCage->post->getEscaped('caption'));
$keywords = cpgSanitizeUserTextInput(utf_replace($superCage->post->getEscaped('keywords')));
$user1 = cpgSanitizeUserTextInput($superCage->post->getEscaped('user1'));
$user2 = cpgSanitizeUserTextInput($superCage->post->getEscaped('user2'));
$user3 = cpgSanitizeUserTextInput($superCage->post->getEscaped('user3'));
$user4 = cpgSanitizeUserTextInput($superCage->post->getEscaped('user4'));
just add at the bottom
Code: [Select]
$user5 = cpgSanitizeUserTextInput($superCage->post->getEscaped('user5'));etc ... etc....

next this code we will be looking for
Code: [Select]
$update .= ", user4 = '{$user4}'"; and we will simply ass .... oops i mean add
Code: [Select]
$update .= ", user5 = '{$user5}'";and so forth and so on ! etc etc......

now look for this code
Code: [Select]
$THUMB_ROWSPAN = 7;then change the 7 to the amount of fields you need +3 for spacing (when adding 4 the code should be :
Code: [Select]
$THUMB_ROWSPAN = 11;this code you should find around line 358

now just below that is this code
Code: [Select]
if ($CONFIG['user_field1_name'] != '') {
$THUMB_ROWSPAN++;
}
if ($CONFIG['user_field2_name'] != '') {
$THUMB_ROWSPAN++;
}
if ($CONFIG['user_field3_name'] != '') {
$THUMB_ROWSPAN++;
}
if ($CONFIG['user_field4_name'] != '') {
$THUMB_ROWSPAN++;
}
add onto this code
Code: [Select]
if ($CONFIG['user_field5_name'] != '') {
$THUMB_ROWSPAN++;
}
etc....

so at the end the code should look like this :
Code: [Select]
if ($CONFIG['user_field1_name'] != '') {
$THUMB_ROWSPAN++;
}
if ($CONFIG['user_field2_name'] != '') {
$THUMB_ROWSPAN++;
}
if ($CONFIG['user_field3_name'] != '') {
$THUMB_ROWSPAN++;
}
if ($CONFIG['user_field4_name'] != '') {
$THUMB_ROWSPAN++;
}
if ($CONFIG['user_field5_name'] != '') {
$THUMB_ROWSPAN++;
}
if ($CONFIG['user_field6_name'] != '') {
$THUMB_ROWSPAN++;
}
if ($CONFIG['user_field7_name'] != '') {
$THUMB_ROWSPAN++;
}
if ($CONFIG['user_field8_name'] != '') {
$THUMB_ROWSPAN++;
}
next find the code aroundabout line 600
Code: [Select]
if ($CONFIG['user_field4_name'] != '') {

echo <<< EOT

<tr>
<td class="tableb" style="white-space: nowrap;">
{$CONFIG['user_field4_name']}
</td>
<td width="100%" class="tableb" valign="top">
<input type="text" style="width: 100%" name="user4" maxlength="255" value="{$CURRENT_PIC['user4']}" class="textinput" />
</td>
</tr>
EOT;
}
then just add
Code: [Select]
if ($CONFIG['user_field5_name'] != '') {

echo <<< EOT

<tr>
<td class="tableb" style="white-space: nowrap;">
{$CONFIG['user_field5_name']}
</td>
<td width="100%" class="tableb" valign="top">
<input type="text" style="width: 100%" name="user5" maxlength="255" value="{$CURRENT_PIC['user5']}" class="textinput" />
</td>
</tr>
EOT;
}
look carefully so you dont miss one of the number that you need to change there are 4 changes in each area .

i hope you are still on the bandwaggon ! if not download the download files and revise them but for those of you who are still with me lets go to the next step ! others revise before proceeding

snort snort ,,,,, mmmmm a minute break
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: more than 4 custom fields in 1.5.3
« Reply #14 on: April 06, 2010, 07:37:47 am »

Step6.Editing/modifing the upload.php file

lets open that upload.php thing ..
look for this code it should be around line 755
Code: [Select]
if(!empty($CONFIG['user_field4_name'])) {
$form_array[] = array($CONFIG['user_field4_name'], 'user4', 0, 255, 1);
}
then just add the nessasery below
Code: [Select]
if(!empty($CONFIG['user_field5_name'])) {
$form_array[] = array($CONFIG['user_field5_name'], 'user5', 0, 255, 1);
}
if(!empty($CONFIG['user_field6_name'])) {
$form_array[] = array($CONFIG['user_field6_name'], 'user6', 0, 255, 1);
}
etc.etc......
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: more than 4 custom fields in 1.5.3
« Reply #15 on: April 06, 2010, 07:39:16 am »

Step7.Editing/modifing the "Thumbnails.php"

open Thumbnails.php and look for the code :
Code: [Select]
// find out if a parameter has been submitted at all
$allowed = array('title', 'caption', 'keywords', 'filename', 'pic_raw_ip', 'pic_hdr_ip', 'user1', 'user2', 'user3', 'user4');
and then add
Code: [Select]
,'user5', 'user6'there is no comma after the last field you insert .

save the file ..

before proceeding to the next section where we will be working in diffrent folders , i want to add something

if your users are using XP publisher to upload photos you will have to update the xp_publish.php aswell
in there find the code
Code: [Select]
// Add a picture
function process_picture()
{
global $CONFIG, $IMG_TYPES;
global $lang_db_input_php, $lang_errors;
$superCage = Inspekt::makeSuperCage();

@unlink(LOGFILE);

if (!USER_ID || !USER_CAN_UPLOAD_PICTURES) simple_die(ERROR, $lang_errors['perm_denied'], __FILE__, __LINE__);

//$album = (int)$_GET['album'];
$album = $superCage->get->getInt('album');
$title = '';
$caption = '';
$keywords = '';
$user1 = '';
$user2 = '';
$user3 = '';
$user4 = '';
and just add
Code: [Select]
$user5 = '';etc. to the bottom .

awesome stuff ..
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: more than 4 custom fields in 1.5.3
« Reply #16 on: April 06, 2010, 07:40:13 am »

Step8.Editing/modifing the
include/search.inc.php

this is my Favourite one because i think all the people seaching my pictures :-) ahhhhh

okay look for code
Code: [Select]
$allowed = array('title', 'caption', 'keywords', 'filename', 'pic_raw_ip', 'pic_hdr_ip', 'user1', 'user2', 'user3', 'user4');then add 'user5', 'user6', etc.etc.....

just in case you get the commas wrong here is a example
Code: [Select]
$allowed = array('title', 'caption', 'keywords', 'filename', 'pic_raw_ip', 'pic_hdr_ip', 'user1', 'user2', 'user3', 'user4', 'user5', 'user6', 'user7', 'user8');save search.inc.php
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: more than 4 custom fields in 1.5.3
« Reply #17 on: April 06, 2010, 07:42:43 am »

Step9.Editing/modifing the "include/picmgmt.inc.php"

look for this code
Code: [Select]
// Add a picture to an album
function add_picture($aid, $filepath, $filename, $position = 0, $title = '', $caption = '', $keywords = '', $user1 = '', $user2 = '', $user3 = '', $user4 = '', $category = 0, $raw_ip = '', $hdr_ip = '', $iwidth = 0, $iheight = 0)
{
and change it to
Code: [Select]
// Add a picture to an album
function add_picture($aid, $filepath, $filename, $position = 0, $title = '', $caption = '', $keywords = '', $user1 = '', $user2 = '', $user3 = '', $user4 = '', $user5 = '', $user6 = '', $user7 = '', $user8 = '', $category = 0, $raw_ip = '', $hdr_ip = '', $iwidth = 0, $iheight = 0)
{
now find
Code: [Select]
// Populate Array to pass to plugins, then to SQL
$CURRENT_PIC_DATA['aid'] = $aid;
$CURRENT_PIC_DATA['filepath'] = $filepath;
$CURRENT_PIC_DATA['filename'] = $filename;
$CURRENT_PIC_DATA['filesize'] = $image_filesize;
$CURRENT_PIC_DATA['total_filesize'] = $total_filesize;
$CURRENT_PIC_DATA['pwidth'] = $imagesize[0];
$CURRENT_PIC_DATA['pheight'] = $imagesize[1];
$CURRENT_PIC_DATA['owner_id'] = $user_id;
$CURRENT_PIC_DATA['title'] = $title;
$CURRENT_PIC_DATA['caption'] = $caption;
$CURRENT_PIC_DATA['keywords'] = $keywords;
$CURRENT_PIC_DATA['approved'] = $approved;
$CURRENT_PIC_DATA['user1'] = $user1;
$CURRENT_PIC_DATA['user2'] = $user2;
$CURRENT_PIC_DATA['user3'] = $user3;
$CURRENT_PIC_DATA['user4'] = $user4;
$CURRENT_PIC_DATA['pic_raw_ip'] = $raw_ip;
$CURRENT_PIC_DATA['pic_hdr_ip'] = $hdr_ip;
$CURRENT_PIC_DATA['position'] = $position;
$CURRENT_PIC_DATA = CPGPluginAPI::filter('add_file_data',$CURRENT_PIC_DATA);
and modify to look like this
Code: [Select]
// Populate Array to pass to plugins, then to SQL
$CURRENT_PIC_DATA['aid'] = $aid;
$CURRENT_PIC_DATA['filepath'] = $filepath;
$CURRENT_PIC_DATA['filename'] = $filename;
$CURRENT_PIC_DATA['filesize'] = $image_filesize;
$CURRENT_PIC_DATA['total_filesize'] = $total_filesize;
$CURRENT_PIC_DATA['pwidth'] = $imagesize[0];
$CURRENT_PIC_DATA['pheight'] = $imagesize[1];
$CURRENT_PIC_DATA['owner_id'] = $user_id;
$CURRENT_PIC_DATA['title'] = $title;
$CURRENT_PIC_DATA['caption'] = $caption;
$CURRENT_PIC_DATA['keywords'] = $keywords;
$CURRENT_PIC_DATA['approved'] = $approved;
$CURRENT_PIC_DATA['user1'] = $user1;
$CURRENT_PIC_DATA['user2'] = $user2;
$CURRENT_PIC_DATA['user3'] = $user3;
$CURRENT_PIC_DATA['user4'] = $user4;
$CURRENT_PIC_DATA['user5'] = $user5;
$CURRENT_PIC_DATA['user6'] = $user6;
$CURRENT_PIC_DATA['user7'] = $user7;
$CURRENT_PIC_DATA['user8'] = $user8;
$CURRENT_PIC_DATA['pic_raw_ip'] = $raw_ip;
$CURRENT_PIC_DATA['pic_hdr_ip'] = $hdr_ip;
$CURRENT_PIC_DATA['position'] = $position;
$CURRENT_PIC_DATA = CPGPluginAPI::filter('add_file_data',$CURRENT_PIC_DATA);
make sure you change both values in each field

next we will look for this code ,,,,,
Code: [Select]
$query = "INSERT INTO {$CONFIG['TABLE_PICTURES']} (aid, filepath, filename, filesize, total_filesize, pwidth, pheight, ctime, owner_id, title, caption, keywords, approved, user1, user2, user3, user4, pic_raw_ip, pic_hdr_ip, position) VALUESand add "user5, user6" etc etc.....

next phase look just below that there you will find
Code: [Select]
'{$CURRENT_PIC_DATA['user4']}',now just add
Code: [Select]
'{$CURRENT_PIC_DATA['user5']}','{$CURRENT_PIC_DATA['user6']}',etc.etc.....

now its time to have a soul shakedown !! 
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: more than 4 custom fields in 1.5.3
« Reply #18 on: April 06, 2010, 07:43:42 am »

Step10.Editing/modifing the "include/admin.inc.php"

look for this code
Code: [Select]

'custom_fields_image_description' => array(
'user_field1_name' => array(
'type' => 'textfield',
'default_value' => '',
'help_link' => 'f=configuration.htm&amp;as=admin_custom_image&amp;ae=admin_custom_image_end',
),
'user_field2_name' => array(
'type' => 'textfield',
'default_value' => '',
'help_link' => '',
),
'user_field3_name' => array(
'type' => 'textfield',
'default_value' => '',
'help_link' => '',
),
'user_field4_name' => array(
'type' => 'textfield',
'default_value' => '',
'help_link' => '',
),
then add to the bottom ,
Code: [Select]
'user_field5_name' => array(
'type' => 'textfield',
'default_value' => '',
'help_link' => '',
),
'user_field6_name' => array(
'type' => 'textfield',
'default_value' => '',
'help_link' => '',
),
etc..ect....
Instructions continue on the next page - use the pagination link to go to the second page of this thread.
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: more than 4 custom fields in 1.5.3
« Reply #19 on: April 06, 2010, 07:44:44 am »

Step11.Editing/modifing the "include/functions.inc.php"

look for code
Code: [Select]
//if ($CONFIG['display_uploader']) {
$select_column_list[] = 'r.owner_id';
//}
if (GALLERY_ADMIN_MODE) {
$select_column_list[] = 'pic_raw_ip';
$select_column_list[] = 'pic_hdr_ip';
}
for ($i = 1; $i <= 4; $i++) {
if ($CONFIG['user_field' . $i . '_name']) {
$select_column_list[] = 'user' . $i;
}
}
}
and change to 4 to the number you require according to the fields you inculde
Code: [Select]
for ($i = 1; $i <= 8; $i++) {
Logged
Pages: [1] 2   Go Up
 

Page created in 0.053 seconds with 21 queries.