4images Forum & Community
4images Modifications / Modifikationen => Mods & Plugins (Releases & Support) => Topic started by: Vladec on November 05, 2006, 08:08:18 PM
-
Hello All!!!
:arrow: :!: Update: 21.11.2007
After searching and looking and asking i finaly got help from Nicky (Thank you!) and with my little modification (paging) this mod looks great.
This mod will allow you to show all images, that member has uploaded, with paging on his profile page , that is very convinient and atractive in my opinion.
So here it is:
Open member.php and find:
//-----------------------------------------------------
//--- Show Profile ------------------------------------
//-----------------------------------------------------
if ($action == "showprofile") {
$txt_clickstream = $lang['profile'];
if (isset($HTTP_GET_VARS[URL_USER_ID]) || isset($HTTP_POST_VARS[URL_USER_ID])) {
$user_id = (isset($HTTP_GET_VARS[URL_USER_ID])) ? intval($HTTP_GET_VARS[URL_USER_ID]) : intval($HTTP_POST_VARS[URL_USER_ID]);
if (!$user_id) {
$user_id = GUEST;
}
}
else {
$user_id = GUEST;
}
Add below:
//-----------------------------------------------------
//--- START Show user images in profile ---------------
//-----------------------------------------------------
$imgtable_width = ceil(intval($config['image_table_width']) / $config['image_cells']);
if ((substr($config['image_table_width'], -1)) == "%") {
$imgtable_width .= "%";
}
$additional_sql = "";
if (!empty($additional_image_fields)) {
foreach ($additional_image_fields as $key => $val) {
$additional_sql .= ", i.".$key;
}
}
$sql1 = "SELECT COUNT(*) as user_count_images
FROM ".IMAGES_TABLE."
WHERE user_id = $user_id";
$row = $site_db->query_firstrow($sql1);
$user_total_images = $row['user_count_images'];
$site_template->register_vars($lang['user_profile_images'] = preg_replace("/".$site_template->start."user_total_images".$site_template->end."/siU", $user_total_images, $lang['user_profile_images']));
unset($user_total_images);
$user_images = 20; // SET HERE HOW MUCH IMAGES SHOULD BE SHOWN
$sql2 = "SELECT COUNT(i.user_id) AS images
FROM (".IMAGES_TABLE." i, ".CATEGORIES_TABLE." c)
LEFT JOIN ".USERS_TABLE." u ON (".get_user_table_field("u.", "user_id")." = i.user_id)
WHERE i.image_active = 1 AND c.cat_id = i.cat_id AND i.user_id = $user_id AND i.cat_id NOT IN (".get_auth_cat_sql("auth_viewcat", "NOTIN").")";
$result = $site_db->query_firstrow($sql2);
$num_images = $result['images'];
$site_db->free_result();
$num_rows_all = (isset($num_images)) ? $num_images : 0;
$link_arg = $site_sess->url(ROOT_PATH."member.php?action=showprofile&user_id=$user_id");
include(ROOT_PATH.'includes/paging.php');
$getpaging = new Paging($page, $user_images, $num_rows_all, $link_arg);
$offset = $getpaging->get_offset();
$site_template->register_vars(array(
"paging" => $getpaging->get_paging(),
"paging_stats" => $getpaging->get_paging_stats()
));
$sql3 = "SELECT i.image_id, i.cat_id, i.user_id, i.image_name, i.image_description, i.image_keywords, i.image_date, i.image_active, i.image_media_file, i.image_thumb_file, i.image_download_url, i.image_allow_comments, i.image_comments, i.image_downloads, i.image_votes, i.image_rating, i.image_hits".$additional_sql.", c.cat_name".get_user_table_field(", u.", "user_name")."
FROM (".IMAGES_TABLE." i, ".CATEGORIES_TABLE." c)
LEFT JOIN ".USERS_TABLE." u ON (".get_user_table_field("u.", "user_id")." = i.user_id)
WHERE i.image_active = 1 AND c.cat_id = i.cat_id AND i.user_id = $user_id AND i.cat_id NOT IN (".get_auth_cat_sql("auth_viewcat", "NOTIN").")
ORDER BY i.image_date DESC
LIMIT $offset, $user_images";
$result = $site_db->query($sql3);
$num_rows = $site_db->get_numrows($result);
if (!$num_rows) {
$user_profile_images = "<table width=\"".$config['image_table_width']."\" border=\"0\" cellpadding=\"".$config['image_table_cellpadding']."\" cellspacing=\"".$config['image_table_cellspacing']."\"><tr class=\"imagerow1\"><td>";
$user_profile_images .= $lang['no_new_images'];
$user_profile_images .= "</td></tr></table>";
}
else {
$user_profile_images = "<table width=\"".$config['image_table_width']."\" border=\"0\" cellpadding=\"".$config['image_table_cellpadding']."\" cellspacing=\"".$config['image_table_cellspacing']."\">";
$count = 0;
$bgcounter = 0;
while ($image_row = $site_db->fetch_array($result)){
$user_named = format_text($image_row['user_name'], 2);
if ($count == 0) {
$row_bg_number = ($bgcounter++ % 2 == 0) ? 1 : 2;
$user_profile_images .= "<tr class=\"imagerow".$row_bg_number."\">\n";
}
$user_profile_images .= "<td width=\"".$imgtable_width."\" valign=\"top\">\n";
show_image($image_row);
$user_profile_images .= $site_template->parse_template("thumbnail_bit");
$user_profile_images .= "\n</td>\n";
$count++;
if ($count == $config['image_cells']) {
$user_profile_images .= "</tr>\n";
$count = 0;
}
} // end while
if ($count > 0) {
$leftover = ($config['image_cells'] - $count);
if ($leftover >= 1) {
for ($f = 0; $f < $leftover; $f++) {
$user_profile_images .= "<td width=\"".$imgtable_width."\">\n \n</td>\n";
}
$user_profile_images .= "</tr>\n";
}
}
$user_profile_images .= "</table>\n";
} // end else
$site_template->register_vars("user_profile_images", $user_profile_images);
$site_template->register_vars("lang_user_profile_images", $lang['user_profile_images']);
unset($user_profile_images);
//-----------------------------------------------------
//--- END Show user images in profile -----------------
//-----------------------------------------------------
Open member_profile.html and after:
<table width="100%" border="0" cellspacing="0" cellpadding="1">
<tr>
<td valign="top" class="head1">
<table width="100%" border="0" cellpadding="4" cellspacing="0">
<tr>
<td valign="top" class="head1">{lang_profile_of} {user_name}</td>
<td valign="top" class="head1" align="right"><a href="{url_show_user_images}" class="head1">{lang_show_user_images}</a></td>
</tr>
<tr>
<td class="row1"><b>{lang_join_date}</b></td>
<td class="row1">{user_join_date}</td>
</tr>
<tr>
<td class="row2"><b>{lang_last_action}</b></td>
<td class="row2">{user_last_action}</td>
</tr>
<tr>
<td class="row1"><b>{lang_comments}</b></td>
<td class="row1">{user_comments}</td>
</tr>
<tr>
<td class="row2"><b>{lang_email}</b></td>
<td class="row2">{if user_email}<a href="{user_mailform_link}">{user_email_save}</a>{endif user_email}</td>
</tr>
<tr>
<td class="row1"><b>{lang_homepage}</b></td>
<td class="row1">{if user_homepage}<a href="{user_homepage}" target="_blank">{user_homepage}</a>{endif user_homepage}</td>
</tr>
<tr>
<td class="row2"><b>{lang_icq}</b></td>
<td class="row2">{if user_icq}<a href="http://www.icq.com/people/about_me.php?uin={user_icq}" target="_blank">{user_icq}</a> (<b>{user_icq_status}</b>){endif user_icq}</td>
</tr>
</table>
</td>
</tr>
</table>
or any where else you like images to be shown add:
<br />
<table width="100%" border="0" cellspacing="0" cellpadding="1">
<tr>
<td valign="top" class="head1">
<table width="100%" border="0" cellpadding="4" cellspacing="0">
<tr>
<table width="100%" border="0" cellpadding="4" cellspacing="0">
<tr>
<td valign="top" class="head1">{lang_user_profile_images}</td>
</tr>
<tr>
<td class="row1">{user_profile_images}</td>
</tr>
</table>
</td>
</tr>
</table>
<br />
{paging}
<br />
<br />
into lang/yourlanguage/main.php
add this anywhere
$lang['user_profile_images'] = "User added {user_total_images} image(s) to this Gallery";
That's It, Have Fun!
-
$sql = "SELECT COUNT(user_id) AS images
FROM ".IMAGES_TABLE."
WHERE user_id = ".$user_id;
i do not agree with this.. for paging... think... pics there are not visible for guest or images that are locked for another users/guest will be counted too..
paging will be there wrong.
and {paging} you forgot in template ;)
-
Sorry, my mystake :oops: i've modifed the mod with {paging} now it looks ok.
Nicky, i didn't anderstand that:
i do not agree with this.. for paging... think... pics there are not visible for guest or images that are locked for another users/guest..
paging will be there wrong.
-
i edited your paging SQL
to
$sql = "SELECT COUNT(i.user_id) AS images
FROM (".IMAGES_TABLE." i, ".CATEGORIES_TABLE." c)
LEFT JOIN ".USERS_TABLE." u ON (".get_user_table_field("u.", "user_id")." = i.user_id)
WHERE i.image_active = 1 AND c.cat_id = i.cat_id AND i.user_id = $user_id AND i.cat_id NOT IN (".get_auth_cat_sql("auth_viewcat", "NOTIN").")";
==EDITED==
{paging} in template
-
Hello Nicky,
thanks for this ;-)
Greez Darkness :mrgreen:
-
Vladec, how's implementation of lang packs going?
-
Thanks for this mod
8)
-
:lol: This is a great mod! And it works! (I was serching this more time ago..)
-
Nach dem Einbau dieses Mods bekomme ich im Kontrolzentrum folgende Fehlermeldung:
After the installation of this Mods I get the following error message in the Controlpanel:
DB Error: Bad SQL Query: SELECT COUNT(*) as user_count_images FROM 4images_images WHERE user_id =
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 '' at line 3
DB Error: Bad SQL Query: SELECT COUNT(i.user_id) AS images FROM (4images_images i, 4images_categories c) LEFT JOIN 4images_users u ON (u.user_id = i.user_id) WHERE i.image_active = 1 AND c.cat_id = i.cat_id AND i.user_id = AND i.cat_id NOT IN (0)
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 i.cat_id NOT IN (0)' at line 4
DB Error: Bad SQL Query: SELECT i.image_id, i.cat_id, i.user_id, i.image_name, i.image_description, i.image_keywords, i.image_date, i.image_active, i.image_media_file, i.image_thumb_file, i.image_download_url, i.image_allow_comments, i.image_comments, i.image_downloads, i.image_votes, i.image_rating, i.image_hits, i.image_photographer, c.cat_name, u.user_name FROM (4images_images i, 4images_categories c) LEFT JOIN 4images_users u ON (u.user_id = i.user_id) WHERE i.image_active = 1 AND c.cat_id = i.cat_id AND i.user_id = AND i.cat_id NOT IN (0) ORDER BY i.image_date DESC LIMIT 0, 20
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 i.cat_id NOT IN (0) ORDER BY i.image_date DESC
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /www/htdocs/digitcom/includes/db_mysql.php on line 116
Wer kann mir beim beheben helfen???
-
i saw your site, i see there that you have avatar mod too, maybe is this the reason, and somewhere you did the mistake.
i saw that bildergallery (ivan) have avatar mod and it works for him > http://www.bildergallery.com/member.php?action=showprofile&user_id=1&l=deutsch
-
Before i add this mod to my gallery it works without errors.
The error comes when i want to edit my profile, not when i show the profil.
Here is my member.php
http://www.philmax.de/member.txt (http://www.philmax.de/member.txt)
-
you added mod before
//-----------------------------------------------------
//--- Show Profile ------------------------------------
//-----------------------------------------------------
if ($action == "showprofile") {
.........
instead of below
-
Thats it.
:roll:
-
I just installed the mod and it works fine.... but paging is visible two times below the thumbnails.... I already removed the paging tag from the html code... but there is still one paging left.... seems it gets generated somewhere in the member.php... cause there are definately no more paging tags in the html file.....
Please help, as I need to remove paging for this mod...
Thanx
-
Nice mod.
Thanks.
-
I must be doing something wrong or not having something right. I have been looking at this code for over an hour now. Maybe a fresh set of eyes could look at it for me.
http://hellonturf.com/memberphp.txt
http://hellonturf.com/memberprofile.txt
Any ideas?
-
I saw earlier in a post here something about a query...do I need to run a query?
I can't figure out what is going on and why it's not showing up.
-
I must be doing something wrong or not having something right. I have been looking at this code for over an hour now. Maybe a fresh set of eyes could look at it for me.
http://hellonturf.com/memberphp.txt
http://hellonturf.com/memberprofile.txt
Any ideas?
Anyone help me on this? Thanks :)
-
Jenn,
just do it like "Vladec" writen in his 1st post.
step by step. then it's work fine.
-
Thanks Nicky, I did, Even did it three times. I must be forgetting something. ...lol
-
I redid this again for the fourth time and I am still getting nothing.
-
Ok, I uninstalled my entire site and reuploaded it brand new. No mods nothing thinking that maybe a mod was interferring. Still the same thing.
Here are the two files that I modified. Is this all that I need to modify?
http://www.hellonturf.com/4image/templates/default/member_profile.html
http://www.hellonturf.com/4image/member.php
What am I missing? Obviously it is something? Is there a setting in Admin Panel that I need to set?
This is driving me insane.
-
member_profile.html is correct as far as I can tell.....
can not see the member.php by viewing source as it looks different, please post that as an attachment or copy the code in to verify.
-
The code was too long to post so here is a text
-
Thanks ivan...did that and still nothing :?
-
I think...Not positive...I know why it may not be working...
Here is the original file
<table width="100%" border="0" cellspacing="0" cellpadding="1">
<tr>
<td valign="top" class="head1">
<table width="100%" border="0" cellpadding="4" cellspacing="0">
<tr>
<td valign="top" class="head1">{lang_profile_of} {user_name}</td>
<td valign="top" class="head1" align="right"><a href="{url_show_user_images}" class="head1">{lang_show_user_images}</a></td>
</tr>
<tr>
<td class="row1"><b>{lang_join_date}</b></td>
<td class="row1">{user_join_date}</td>
</tr>
<tr>
<td class="row2"><b>{lang_last_action}</b></td>
<td class="row2">{user_last_action}</td>
</tr>
<tr>
<td class="row1"><b>{lang_comments}</b></td>
<td class="row1">{user_comments}</td>
</tr>
<tr>
<td class="row2"><b>{lang_email}</b></td>
<td class="row2">{if user_email}<a href="{user_mailform_link}">{user_email_save}</a>{endif user_email}</td>
</tr>
<tr>
<td class="row1"><b>{lang_homepage}</b></td>
<td class="row1">{if user_homepage}<a href="{user_homepage}" target="_blank">{user_homepage}</a>{endif user_homepage}</td>
</tr>
<tr>
<td class="row2"><b>{lang_icq}</b></td>
<td class="row2">{if user_icq}<a href="http://www.icq.com/people/about_me.php?uin={user_icq}" target="_blank">{user_icq}</a> (<b>{user_icq_status}</b>){endif user_icq}</td>
</tr>
</table>
</td>
</tr>
</table>
<br />
<table width="100%" border="0" cellspacing="0" cellpadding="1">
<tr>
<td valign="top" class="head1">
<table width="100%" border="0" cellpadding="4" cellspacing="0">
<tr>
<table width="100%" border="0" cellpadding="4" cellspacing="0">
<tr>
<td valign="top" class="head1">Last images from {user_name} ({user_name} added {user_total_images} images to this Gallery)</td>
</tr>
<tr>
<td class="row1">{user_profile_images}</td>
</tr>
</table>
</td>
</tr>
</table>
<br />
{paging}
<br />
<br />
Here is the file after it's uploaded
<table width="100%" border="0" cellspacing="0" cellpadding="1">
<tr>
<td valign="top" class="head1">
<table width="100%" border="0" cellpadding="4" cellspacing="0">
<tr>
<td valign="top" class="head1">{lang_profile_of} {user_name}</td>
<td valign="top" class="head1" align="right"><a href="4images1.7.4(4)/4images/templates/default/%7Burl_show_user_images%7D" class="head1">{lang_show_user_images}</a></td>
</tr>
<tr>
<td class="row1"><b>{lang_join_date}</b></td>
<td class="row1">{user_join_date}</td>
</tr>
<tr>
<td class="row2"><b>{lang_last_action}</b></td>
<td class="row2">{user_last_action}</td>
</tr>
<tr>
<td class="row1"><b>{lang_comments}</b></td>
<td class="row1">{user_comments}</td>
</tr>
<tr>
<td class="row2"><b>{lang_email}</b></td>
<td class="row2">{if user_email}<a href="4images1.7.4(4)/4images/templates/default/%7Buser_mailform_link%7D">{user_email_save}</a>{endif user_email}</td>
</tr>
<tr>
<td class="row1"><b>{lang_homepage}</b></td>
<td class="row1">{if user_homepage}<a href="4images1.7.4(4)/4images/templates/default/%7Buser_homepage%7D" target="_blank">{user_homepage}</a>{endif user_homepage}</td>
</tr>
<tr>
<td class="row2"><b>{lang_icq}</b></td>
<td class="row2">{if user_icq}<a href="http://www.icq.com/people/about_me.php?uin={user_icq}" target="_blank">{user_icq}</a> (<b>{user_icq_status}</b>){endif user_icq}</td>
</tr>
</table>
</td>
</tr>
</table>
<br />
<table width="100%" border="0" cellspacing="0" cellpadding="1">
<tr>
<td valign="top" class="head1">
<table width="100%" border="0" cellpadding="4" cellspacing="0">
<tr>
<table width="100%" border="0" cellpadding="4" cellspacing="0">
<tr>
<td valign="top" class="head1">Last images from {user_name} ({user_name} added {user_total_images} images to this Gallery)</td>
</tr>
<tr>
<td class="row1">{user_profile_images}</td>
</tr>
</table>
</td>
</tr>
</table>
<br />
{paging}
<br />
<br />
Why would it be changing to look like that in red.....
-
try uploading in ASCII and not binary to see if that makes a difference
-
That was weird. Ok fixed that problem but it's still not showing the images, or the table it is supposed to produce...Here are the two files with the codes that is sitting on the server.
http://www.hellonturf.com/member_profile.txt
httP://www.hellonturf.com/member.txt
-
Yes thats all fixed but its still not working.
-
@Jenn
I have redone it according to how your member.php looked and attached it below.
If that dont work I dont know why its not working as I am out of ideas as everything looks right.
-
when visiting your gallery page and i go to your profile i can see last images added at bottom of page
-
:oops: Ya know what?
I was accessing my profile going into the control panel.
When I clicked on my name next to the image is when I saw the image.
I'm so sorry for all the run around guys. Are you not supposed to see the images going into the control panel? Thats what I thought the profile was...Now I feel so dumb..
Thanks so much for all your help and dealing with me. I really do appreciate it.
-
well at least it is figured out :wink:
-
:mrgreen: Thank you Vladec and Nicky. This was so easy to add and works beautifully!
-
excellent I modulate!!!!!!!!!!!!! :lol: :lol: :lol: :lol:
-
Hi guys,
How can I show the user images ONLY in the control panel (Editprofile) of this user. :roll:
Many thanks in advance,
Cruxy
-
Hi guys,
How can I show the user images ONLY in the control panel (Editprofile) of this user. :roll:
Many thanks in advance,
Cruxy
I no get ... is no what MOD do now ?
-
Hi Thunderstrike, :D
The mod shows the user images on the page member_profile.thml (/member.php?action=showprofile&user_id=1).
I do not want that. I want to show the user images on the the page member_editprofile.html (/member.php?action=editprofile).
That means that only you can see your own images.
-
That means that only you can see your own images.
Ok so all upload image of same user and user can see in editprofile page. Correct ?
-
Exactly :D
-
Hi Thunderstrike, is it possible to tweak this code to show the user images in editprofile.html?
I really tried every trick but it does not want to work for me. :roll:
-
I really tried every trick but it does not want to work for me.
Well ... for me is work ... (MOD ready. 8)) :
http://www.4homepages.de/forum/index.php?topic=19353.0
-
Ich habe nicht ganz verstanden, wo ich die Sprache ändern kann. "Last images from xxx (xxx added 426 images to this Gallery)" will ich gern in Deutsch angezeigt haben...
Where can I change the language into german?
-
ohne viel aufwand, ändere is in dem template selbst
-
Hab es gefunden, danke für den Tipp!
-
Thanks for the mod!
The mod works fine, but I want "Last images from USER (USER added NUMBER OF IMAGES images to this Gallery)" to get the information from the language file (i have 5 different language) How can I do that?
-
page 1 and 1st post updated.
have phun
-
in meiner gallery werden standradmäßig 30 bilder angezeigt, dann kommt das paging. gibt es eine möglichkeite die standardeinstellung für diesen mod zu ändern, d.h. dass nur in den profilen 6 bilder angezeigt werden. alles andere sollte bei den standardeinstellungen bleiben.
-
hi
$user_images = 20; // SET HERE HOW MUCH IMAGES SHOULD BE SHOWN
steht bei dir warscheinlich auf 30 :)
ändere es auf 6
-
ja, perfekt... danke!
-
Nice mod.
Thanks.
Steffen
-
Thanks for the mod.. It works fine on me.. :)
-
Hello All
I used this code on user_name=username but paging in this code don`t working, if i want to see pictures in structure
/member.php?action=showprofile&user_name=ataka
PLEASE, administrators and users help me!
//-----------------------------------------------------
//--- START Show user images in profile ---------------
//-----------------------------------------------------
$imgtable_width = ceil(intval($config['image_table_width']) / $config['image_cells']);
if ((substr($config['image_table_width'], -1)) == "%") {
$imgtable_width .= "%";
}
$additional_sql = "";
if (!empty($additional_image_fields)) {
foreach ($additional_image_fields as $key => $val) {
$additional_sql .= ", i.".$key;
}
}
$sql1 = "SELECT COUNT(*) as user_count_images
FROM ".IMAGES_TABLE."
WHERE user_id = $user_id";
$row = $site_db->query_firstrow($sql1);
$user_total_images = $row['user_count_images'];
$site_template->register_vars($lang['user_profile_images'] = preg_replace("/".$site_template->start."user_total_images".$site_template->end."/siU", $user_total_images, $lang['user_profile_images']));
unset($user_total_images);
$user_images = 10; // SET HERE HOW MUCH IMAGES SHOULD BE SHOWN
$user_name = (isset($HTTP_POST_VARS['user_name']) ? un_htmlspecialchars(trim($HTTP_POST_VARS['user_name'])) : (isset($HTTP_GET_VARS['user_name']) ? un_htmlspecialchars(trim($HTTP_GET_VARS['user_name'])) : ""));
$sql2 = "SELECT COUNT(i.user_id) AS images
FROM (".IMAGES_TABLE." i, ".CATEGORIES_TABLE." c)
LEFT JOIN ".USERS_TABLE." u ON (".get_user_table_field("u.", "user_id")." = i.user_id)
WHERE i.image_active = 1 AND c.cat_id = i.cat_id AND i.user_id = $user_id AND i.cat_id NOT IN (".get_auth_cat_sql("auth_viewcat", "NOTIN").")";
$result = $site_db->query_firstrow($sql2);
$num_images = $result['images'];
$site_db->free_result();
$num_rows_all = (isset($num_images)) ? $num_images : 0;
$link_arg = $site_sess->url(ROOT_PATH."member.php?action=showprofile&user_name=$user_name");
include(ROOT_PATH.'includes/paging.php');
$getpaging = new Paging($page, $user_images, $num_rows_all, $link_arg);
$offset = $getpaging->get_offset();
$site_template->register_vars(array("paging" => $getpaging->get_paging(),"paging_stats" => $getpaging->get_paging_stats()
));
$sql3 = "SELECT i.image_id, i.cat_id, i.user_id, i.image_name, i.image_description, i.image_keywords, i.image_date, i.image_active, i.image_media_file, i.image_thumb_file, i.image_download_url, i.image_allow_comments, i.image_comments, i.image_downloads, i.image_votes, i.image_rating, i.image_hits".$additional_sql.", c.cat_name".get_user_table_field(", u.", "user_name")."
FROM (".IMAGES_TABLE." i, ".CATEGORIES_TABLE." c)
LEFT JOIN ".USERS_TABLE." u ON (".get_user_table_field("u.", "user_id")." = i.user_id)
WHERE ".get_user_table_field("", "user_name")." = '".strtolower($user_name)."' AND i.image_active = 1 AND c.cat_id = i.cat_id
ORDER BY i.image_date DESC
LIMIT $offset, $user_images";
$result = $site_db->query($sql3);
$num_rows = $site_db->get_numrows($result);
if (!$num_rows) {
$user_profile_images = "<table width=\"".$config['image_table_width']."\" border=\"0\" cellpadding=\"".$config['image_table_cellpadding']."\" cellspacing=\"".$config['image_table_cellspacing']."\"><tr class=\"imagerow1\"><td>";
$user_profile_images .= $lang['no_new_images'];
$user_profile_images .= "</td></tr></table>";
}
else {
$user_profile_images = "<table width=\"".$config['image_table_width']."\" border=\"0\" cellpadding=\"".$config['image_table_cellpadding']."\" cellspacing=\"".$config['image_table_cellspacing']."\">";
$count = 0;
$bgcounter = 0;
while ($image_row = $site_db->fetch_array($result)){
$user_named = format_text($image_row['user_name'], 2);
if ($count == 0) {
$row_bg_number = ($bgcounter++ % 2 == 0) ? 1 : 2;
$user_profile_images .= "\n";
}
$user_profile_images .= "\n";
show_image($image_row);
$user_profile_images .= $site_template->parse_template("thumbnail_bit");
$user_profile_images .= "\n";
$count++;
if ($count == $config['image_cells']) {
$user_profile_images .= "\n";
$count = 0;
}
} // end while
if ($count > 0) {
$leftover = ($config['image_cells'] - $count);
if ($leftover >= 1) {
for ($f = 0; $f < $leftover; $f++) {
$user_profile_images .= "\n";
}
$user_profile_images .= "\n";
}
}
$user_profile_images .= "\n";
} // end else
$site_template->register_vars("user_profile_images", $user_profile_images);
$site_template->register_vars("lang_user_profile_images", $lang['user_profile_images']);
unset($user_profile_images);
//-----------------------------------------------------
//--- END Show user images in profile -----------------
//-----------------------------------------------------
-
Welcome to 4images forum.
Try this:
$user_name = (isset($HTTP_POST_VARS['user_name']) ? un_htmlspecialchars(trim($HTTP_POST_VARS['user_name'])) : (isset($HTTP_GET_VARS['user_name']) ? un_htmlspecialchars(trim($HTTP_GET_VARS['user_name'])) : ""));
$sql = "SELECT user_id
FROM ".USERS_TABLE."
WHERE user_name LIKE '$user_name' AND user_id <> " . GUEST;
if ($row = $site_db->query_firstrow($sql))
{
$user_id = $row['user_id'];
}
else
{
if ($user_row = get_user_info($user_id))
{
$user_name = $user_row['user_name'];
}
}
//-----------------------------------------------------
//--- START Show user images in profile ---------------
//-----------------------------------------------------
$imgtable_width = ceil(intval($config['image_table_width']) / $config['image_cells']);
if ((substr($config['image_table_width'], -1)) == "%") {
$imgtable_width .= "%";
}
$additional_sql = "";
if (!empty($additional_image_fields)) {
foreach ($additional_image_fields as $key => $val) {
$additional_sql .= ", i.".$key;
}
}
$sql = "SELECT COUNT(*) as num
FROM ".IMAGES_TABLE."
WHERE ".get_user_table_field("", "user_id")." = $user_id AND image_active = 1 AND cat_id NOT IN (".get_auth_cat_sql("auth_viewcat", "NOTIN").") AND user_id <> ". GUEST;
$row = $site_db->query_firstrow($sql);
$num_rows_all = $row['num'];
$user_images = 10; // SET HERE HOW MUCH IMAGES SHOULD BE SHOWN
$link_arg = $site_sess->url(ROOT_PATH."member.php?action=showprofile&user_name=".urlencode($user_name));
include(ROOT_PATH.'includes/paging.php');
$getpaging = new Paging($page, $user_images, $num_rows_all, $link_arg);
$offset = $getpaging->get_offset();
if (!$num_rows_all) {
$user_profile_images = "<table width=\"".$config['image_table_width']."\" border=\"0\" cellpadding=\"".$config['image_table_cellpadding']."\" cellspacing=\"".$config['image_table_cellspacing']."\"><tr class=\"imagerow1\"><td>";
$user_profile_images .= $lang['no_new_images'];
$user_profile_images .= "</td></tr></table>";
}
else {
$sql = "SELECT i.image_id, i.cat_id, i.user_id, i.image_name, i.image_description, i.image_keywords, i.image_date, i.image_active, i.image_media_file, i.image_thumb_file, i.image_download_url, i.image_allow_comments, i.image_comments, i.image_downloads, i.image_votes, i.image_rating, i.image_hits".$additional_sql.", c.cat_name".get_user_table_field(", u.", "user_name")."
FROM (".IMAGES_TABLE." i, ".CATEGORIES_TABLE." c)
LEFT JOIN ".USERS_TABLE." u ON (".get_user_table_field("u.", "user_id")." = i.user_id)
WHERE ".get_user_table_field("u.", "user_id")." = '$user_id' AND i.image_active = 1 AND c.cat_id = i.cat_id AND u.user_id <> ".GUEST."
ORDER BY i.image_date DESC
LIMIT $offset, $user_images";
$result = $site_db->query($sql);
$user_profile_images = "<table width=\"".$config['image_table_width']."\" border=\"0\" cellpadding=\"".$config['image_table_cellpadding']."\" cellspacing=\"".$config['image_table_cellspacing']."\">";
$count = 0;
$bgcounter = 0;
while ($image_row = $site_db->fetch_array($result)){
$user_named = format_text($image_row['user_name'], 2);
if ($count == 0) {
$row_bg_number = ($bgcounter++ % 2 == 0) ? 1 : 2;
$user_profile_images .= "\n";
}
$user_profile_images .= "\n";
show_image($image_row);
$user_profile_images .= $site_template->parse_template("thumbnail_bit");
$user_profile_images .= "\n";
$count++;
if ($count == $config['image_cells']) {
$user_profile_images .= "\n";
$count = 0;
}
} // end while
if ($count > 0) {
$leftover = ($config['image_cells'] - $count);
if ($leftover >= 1) {
for ($f = 0; $f < $leftover; $f++) {
$user_profile_images .= "\n";
}
$user_profile_images .= "\n";
}
}
$user_profile_images .= "\n";
} // end else
$site_template->register_vars(array(
"user_profile_images" => $user_profile_images,
"lang_user_profile_images" => str_replace("{user_total_images}", $num_rows_all, $lang['user_profile_images']),
"paging" => $getpaging->get_paging(),
"paging_stats" => $getpaging->get_paging_stats(),
));
unset($user_profile_images);
//-----------------------------------------------------
//--- END Show user images in profile -----------------
//-----------------------------------------------------
-
I guess it's something else you've edited...the code I've posted is just modified your code...
-
2 V@no;
thanks, it`s my mistake, Thanx, Great 4images!
-
2 V@no!
Hello, all!
I used this --> [MOD] Show user images in profile
I make new file details_user.php and copy in this -> code from details.php
Please, help with NEXT PREV thumbs only from USER (Not category)
Please, Help !
My code:
Code: $act_key = array_search($image_id, $image_id_cache);
$next_image_id = (isset($image_id_cache[$act_key + 1])) ? $image_id_cache[$act_key + 1] : 0;
$next1_image_id = (isset($image_id_cache[$act_key + 2])) ? $image_id_cache[$act_key + 2] : 0;
$prev_image_id = (isset($image_id_cache[$act_key - 1])) ? $image_id_cache[$act_key - 1] : 0;
$prev1_image_id = (isset($image_id_cache[$act_key - 2])) ? $image_id_cache[$act_key - 2] : 0;
unset($image_id_cache);
// Get next and previous image
if (!empty($next_prev_cache[$next_image_id])) {
$next_image_name = format_text($next_prev_cache[$next_image_id]['image_name'], 2);
$next_image_url = $site_sess->url("/profile/pic".$next_image_id.((!empty($mode)) ? "&mode=".$mode : ""));
if (!get_file_path($next_prev_cache[$next_image_id]['image_media_file'], "media", $next_prev_cache[$next_image_id]['cat_id'], 0, 0)) {
$next_image_file = ICON_PATH."/404.gif";
}
else {
$next_image_file = get_file_path($next_prev_cache[$next_image_id]['image_media_file'], "media", $next_prev_cache[$next_image_id]['cat_id'], 0, 1);
}
if (!get_file_path($next_prev_cache[$next_image_id]['image_thumb_file'], "thumb", $next_prev_cache[$next_image_id]['cat_id'], 0, 0)) {
$next_thumb_file = ICON_PATH."/".get_file_extension($next_prev_cache[$next_image_id]['image_media_file']).".gif";
}
else {
$next_thumb_file = get_file_path($next_prev_cache[$next_image_id]['image_thumb_file'], "thumb", $next_prev_cache[$next_image_id]['cat_id'], 0, 1);
}
}
else {
$next_image_name = REPLACE_EMPTY;
$next_image_url = REPLACE_EMPTY;
$next_image_file = REPLACE_EMPTY;
$next_thumb_file = REPLACE_EMPTY;
}
if (!empty($next_prev_cache[$next1_image_id])) {
$next1_image_name = format_text($next_prev_cache[$next1_image_id]['image_name'], 2);
$next1_image_url = $site_sess->url("/profile/pic".$next1_image_id.((!empty($mode)) ? "&mode=".$mode : ""));
if (!get_file_path($next_prev_cache[$next1_image_id]['image_media_file'], "media", $next_prev_cache[$next1_image_id]['cat_id'], 0, 0)) {
$next1_image_file = ICON_PATH."/404.gif";
}
else {
$next1_image_file = get_file_path($next_prev_cache[$next1_image_id]['image_media_file'], "media", $next_prev_cache[$next1_image_id]['cat_id'], 0, 1);
}
if (!get_file_path($next_prev_cache[$next1_image_id]['image_thumb_file'], "thumb", $next_prev_cache[$next1_image_id]['cat_id'], 0, 0)) {
$next1_thumb_file = ICON_PATH."/".get_file_extension($next_prev_cache[$next1_image_id]['image_media_file']).".gif";
}
else {
$next1_thumb_file = get_file_path($next_prev_cache[$next1_image_id]['image_thumb_file'], "thumb", $next_prev_cache[$next1_image_id]['cat_id'], 0, 1);
}
}
else {
$next1_image_name = REPLACE_EMPTY;
$next1_image_url = REPLACE_EMPTY;
$next1_image_file = REPLACE_EMPTY;
$next1_thumb_file = REPLACE_EMPTY;
}
if (!empty($next_prev_cache[$prev_image_id])) {
$prev_image_name = format_text($next_prev_cache[$prev_image_id]['image_name'], 2);
$prev_image_url = $site_sess->url("/profile/pic".$prev_image_id.((!empty($mode)) ? "&mode=".$mode : ""));
if (!get_file_path($next_prev_cache[$prev_image_id]['image_media_file'], "media", $next_prev_cache[$prev_image_id]['cat_id'], 0, 0)) {
$prev_image_file = ICON_PATH."/404.gif";
}
else {
$prev_image_file = get_file_path($next_prev_cache[$prev_image_id]['image_media_file'], "media", $next_prev_cache[$prev_image_id]['cat_id'], 0, 1);
}
if (!get_file_path($next_prev_cache[$prev_image_id]['image_thumb_file'], "thumb", $next_prev_cache[$prev_image_id]['cat_id'], 0, 0)) {
$prev_thumb_file = ICON_PATH."/".get_file_extension($next_prev_cache[$prev_image_id]['image_media_file']).".gif";
}
else {
$prev_thumb_file = get_file_path($next_prev_cache[$prev_image_id]['image_thumb_file'], "thumb", $next_prev_cache[$prev_image_id]['cat_id'], 0, 1);
}
}
else {
$prev_image_name = REPLACE_EMPTY;
$prev_image_url = REPLACE_EMPTY;
$prev_image_file = REPLACE_EMPTY;
$prev_thumb_file = REPLACE_EMPTY;
}
if (!empty($next_prev_cache[$prev1_image_id])) {
$prev1_image_name = format_text($next_prev_cache[$prev1_image_id]['image_name'], 2);
$prev1_image_url = $site_sess->url("/profile/pic".$prev1_image_id.((!empty($mode)) ? "&mode=".$mode : ""));
if (!get_file_path($next_prev_cache[$prev1_image_id]['image_media_file'], "media", $next_prev_cache[$prev1_image_id]['cat_id'], 0, 0)) {
$prev1_image_file = ICON_PATH."/404.gif";
}
else {
$prev1_image_file = get_file_path($next_prev_cache[$prev1_image_id]['image_media_file'], "media", $next_prev_cache[$prev1_image_id]['cat_id'], 0, 1);
}
if (!get_file_path($next_prev_cache[$prev1_image_id]['image_thumb_file'], "thumb", $next_prev_cache[$prev1_image_id]['cat_id'], 0, 0)) {
$prev1_thumb_file = ICON_PATH."/".get_file_extension($next_prev_cache[$prev1_image_id]['image_media_file']).".gif";
}
else {
$prev1_thumb_file = get_file_path($next_prev_cache[$prev1_image_id]['image_thumb_file'], "thumb", $next_prev_cache[$prev1_image_id]['cat_id'], 0, 1);
}
}
else {
$prev1_image_name = REPLACE_EMPTY;
$prev1_image_url = REPLACE_EMPTY;
$prev1_image_file = REPLACE_EMPTY;
$prev1_thumb_file = REPLACE_EMPTY;
}
$site_template->register_vars(array(
"next_image_id" => $next_image_id,
"next_image_name" => $next_image_name,
"next_image_url" => $next_image_url,
"next_image_file" => $next_image_file,
"next_thumb_file" => $next_thumb_file,
"next1_image_id" => $next1_image_id,
"next1_image_name" => $next1_image_name,
"next1_image_url" => $next1_image_url,
"next1_image_file" => $next1_image_file,
"next1_thumb_file" => $next1_thumb_file,
"prev_image_id" => $prev_image_id,
"prev_image_name" => $prev_image_name,
"prev_image_url" => $prev_image_url,
"prev_image_file" => $prev_image_file,
"prev_thumb_file" => $prev_thumb_file,
"prev1_image_id" => $prev1_image_id,
"prev1_image_name" => $prev1_image_name,
"prev1_image_url" => $prev1_image_url,
"prev1_image_file" => $prev1_image_file,
"prev1_thumb_file" => $prev1_thumb_file
));
unset($next_prev_cache);
Who know this problem?
-
kann man in Userprofile noch die Kategorie listen in den der User seine bilder hat?
-
hello
last time i added show user images in profile but there's problem when any user have no favorite images in lightbox it's ok he can see his profile , but when he try to add favorite he can't see his profile it looks like blan page "white page ",>
i mean his profile appears like white page and all users can see his page is blank not only him ! ^-^
this mode link http://www.4homepages.de/forum/index.php?topic=15390.0
and this my member.php
action is
member.php?action=showprofile&user_id=
<?php
/**************************************************************************
* *
* 4images - A Web Based Image Gallery Management System *
* ---------------------------------------------------------------- *
* *
* File: details.php *
* Copyright: (C) 2002-2009 Jan Sorgalla *
* Email: jan@4homepages.de *
* Web: http://www.4homepages.de *
* Scriptversion: 1.7.7 *
* *
* Never released without support from: Nicky (http://www.nicky.net) *
* *
**************************************************************************
* *
* Dieses Script ist KEINE Freeware. Bitte lesen Sie die Lizenz- *
* bedingungen (Lizenz.txt) für weitere Informationen. *
* --------------------------------------------------------------- *
* This script is NOT freeware! Please read the Copyright Notice *
* (Licence.txt) for further information. *
* *
*************************************************************************/
$main_template = 'details';
define('GET_CACHES', 1);
define('ROOT_PATH', './');
include(ROOT_PATH.'global.php');
require(ROOT_PATH.'includes/sessions.php');
$user_access = get_permission();
include(ROOT_PATH.'includes/page_header.php');
if (!$image_id) {
redirect($url);
}
$additional_sql = "";
if (!empty($additional_user_fields)) {
foreach ($additional_user_fields as $key => $val) {
$additional_sql .= ", u.".$key;
}
}
if (!empty($additional_image_fields)) {
foreach ($additional_image_fields as $key => $val) {
$additional_sql .= ", i.".$key;
}
}
$sql = "SELECT i.image_id, i.cat_id, i.user_id, i.image_name, i.image_description, i.image_newfield, i.image_keywords, i.image_date, i.image_active, i.image_media_file, i.image_thumb_file, i.image_download_url, i.image_allow_comments, i.image_comments, i.image_downloads, i.image_votes, i.image_rating, i.image_hits".$additional_sql.", c.cat_name".get_user_table_field(", u.", "user_name").get_user_table_field(", u.", "user_email")."
FROM (".IMAGES_TABLE." i, ".CATEGORIES_TABLE." c)
LEFT JOIN ".USERS_TABLE." u ON (".get_user_table_field("u.", "user_id")." = i.user_id)
WHERE i.image_id = $image_id AND i.image_active = 1 AND c.cat_id = i.cat_id";
$image_row = $site_db->query_firstrow($sql);
$cat_id = (isset($image_row['cat_id'])) ? $image_row['cat_id'] : 0;
$is_image_owner = ($image_row['user_id'] > USER_AWAITING && $user_info['user_id'] == $image_row['user_id']) ? 1 : 0;
if (!check_permission("auth_viewcat", $cat_id) || !check_permission("auth_viewimage", $cat_id) || !$image_row) {
redirect($url);
}
$random_cat_image = (defined("SHOW_RANDOM_IMAGE") && SHOW_RANDOM_IMAGE == 0) ? "" : get_random_image($cat_id);
$site_template->register_vars("random_cat_image", $random_cat_image);
unset($random_cat_image);
//-----------------------------------------------------
//--- Show Image --------------------------------------
//-----------------------------------------------------
$image_allow_comments = (check_permission("auth_readcomment", $cat_id)) ? $image_row['image_allow_comments'] : 0;
$image_name = format_text($image_row['image_name'], 2);
show_image($image_row, $mode, 0, 1);
//--- SEO variables -------------------------------
$meta_keywords = !empty($image_row['image_keywords']) ? implode(", ", explode(" ", $image_row['image_keywords'])) : "";
$meta_description = !empty($image_row['image_description']) ? strip_tags($image_row['image_description']) . ". " : "";
$site_template->register_vars(array(
"detail_meta_description" => $meta_description,
"detail_meta_keywords" => $meta_keywords,
"prepend_head_title" => $image_name . " - ",
//User Pic
"userpic" => $user_pic,
//End User Pic
));
$in_mode = 0;
$sql = "";
if ($mode == "lightbox") {
if (!empty($user_info['lightbox_image_ids'])) {
$image_id_sql = str_replace(" ", ", ", trim($user_info['lightbox_image_ids']));
$sql = "SELECT image_id, cat_id, image_name, image_media_file, image_thumb_file
FROM ".IMAGES_TABLE."
WHERE image_active = 1 AND image_id IN ($image_id_sql) AND (cat_id NOT IN (".get_auth_cat_sql("auth_viewimage", "NOTIN").", ".get_auth_cat_sql("auth_viewcat", "NOTIN").")) ORDER BY image_sticky DESC, ".$config['image_order']." ".$config['image_sort'].", image_id ".$config['image_sort'];
$in_mode = 1;
}
}
elseif ($mode == "search") {
if (!isset($session_info['searchid']) || empty($session_info['searchid'])) {
$session_info['search_id'] = $site_sess->get_session_var("search_id");
}
if (!empty($session_info['search_id'])) {
$search_id = unserialize($session_info['search_id']);
}
$sql_where_query = "";
if (!empty($search_id['image_ids'])) {
$sql_where_query .= "AND image_id IN (".$search_id['image_ids'].") ";
}
if (!empty($search_id['user_ids'])) {
$sql_where_query .= "AND user_id IN (".$search_id['user_ids'].") ";
}
if (!empty($search_id['search_new_images']) && $search_id['search_new_images'] == 1) {
$new_cutoff = time() - 60 * 60 * 24 * $config['new_cutoff'];
$sql_where_query .= "AND image_date >= $new_cutoff ";
}
if (!empty($search_id['search_cat']) && $search_id['search_cat'] != 0) {
$cat_id_sql = 0;
if (check_permission("auth_viewcat", $search_id['search_cat'])) {
$sub_cat_ids = get_subcat_ids($search_id['search_cat'], $search_id['search_cat'], $cat_parent_cache);
$cat_id_sql .= ", ".$search_id['search_cat'];
if (!empty($sub_cat_ids[$search_id['search_cat']])) {
foreach ($sub_cat_ids[$search_id['search_cat']] as $val) {
if (check_permission("auth_viewcat", $val)) {
$cat_id_sql .= ", ".$val;
}
}
}
}
$cat_id_sql = $cat_id_sql !== 0 ? "AND cat_id IN ($cat_id_sql)" : "";
}
else {
$cat_id_sql = get_auth_cat_sql("auth_viewcat", "NOTIN");
$cat_id_sql = $cat_id_sql !== 0 ? "AND cat_id NOT IN (".$cat_id_sql.")" : "";
}
if (!empty($sql_where_query)) {
$sql = "SELECT image_id, cat_id, image_name, image_media_file, image_thumb_file
FROM ".IMAGES_TABLE."
WHERE image_active = 1
$sql_where_query
$cat_id_sql
ORDER BY ".$config['image_order']." ".$config['image_sort'].", image_id ".$config['image_sort'];
$in_mode = 1;
}
}
if (!$in_mode || empty($sql)) {
$sql = "SELECT image_id, cat_id, image_name, image_media_file, image_thumb_file
FROM ".IMAGES_TABLE."
WHERE image_active = 1 AND cat_id = $cat_id
ORDER BY ".$config['image_order']." ".$config['image_sort'].", image_id ".$config['image_sort'];
}
$result = $site_db->query($sql);
$image_id_cache = array();
$next_prev_cache = array();
$break = 0;
$prev_id = 0;
while($row = $site_db->fetch_array($result)) {
$image_id_cache[] = $row['image_id'];
$next_prev_cache[$row['image_id']] = $row;
if ($break) {
break;
}
if ($prev_id == $image_id) {
$break = 1;
}
$prev_id = $row['image_id'];
}
$site_db->free_result();
if (!function_exists("array_search")) {
function array_search($needle, $haystack) {
$match = false;
foreach ($haystack as $key => $value) {
if ($value == $needle) {
$match = $key;
}
}
return $match;
}
}
$act_key = array_search($image_id, $image_id_cache);
$next_image_id = (isset($image_id_cache[$act_key + 1])) ? $image_id_cache[$act_key + 1] : 0;
$prev_image_id = (isset($image_id_cache[$act_key - 1])) ? $image_id_cache[$act_key - 1] : 0;
unset($image_id_cache);
// Get next and previous image
if (!empty($next_prev_cache[$next_image_id])) {
$next_image_name = format_text($next_prev_cache[$next_image_id]['image_name'], 2);
$next_image_url = $site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$next_image_id.((!empty($mode)) ? "&mode=".$mode : ""));
if (!get_file_path($next_prev_cache[$next_image_id]['image_media_file'], "media", $next_prev_cache[$next_image_id]['cat_id'], 0, 0)) {
$next_image_file = ICON_PATH."/404.gif";
}
else {
$next_image_file = get_file_path($next_prev_cache[$next_image_id]['image_media_file'], "media", $next_prev_cache[$next_image_id]['cat_id'], 0, 1);
}
if (!get_file_path($next_prev_cache[$next_image_id]['image_thumb_file'], "thumb", $next_prev_cache[$next_image_id]['cat_id'], 0, 0)) {
$next_thumb_file = ICON_PATH."/".get_file_extension($next_prev_cache[$next_image_id]['image_media_file']).".gif";
}
else {
$next_thumb_file = get_file_path($next_prev_cache[$next_image_id]['image_thumb_file'], "thumb", $next_prev_cache[$next_image_id]['cat_id'], 0, 1);
}
}
else {
$next_image_name = REPLACE_EMPTY;
$next_image_url = REPLACE_EMPTY;
$next_image_file = REPLACE_EMPTY;
$next_thumb_file = REPLACE_EMPTY;
}
if (!empty($next_prev_cache[$prev_image_id])) {
$prev_image_name = format_text($next_prev_cache[$prev_image_id]['image_name'], 2);
$prev_image_url = $site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$prev_image_id.((!empty($mode)) ? "&mode=".$mode : ""));
if (!get_file_path($next_prev_cache[$prev_image_id]['image_media_file'], "media", $next_prev_cache[$prev_image_id]['cat_id'], 0, 0)) {
$prev_image_file = ICON_PATH."/404.gif";
}
else {
$prev_image_file = get_file_path($next_prev_cache[$prev_image_id]['image_media_file'], "media", $next_prev_cache[$prev_image_id]['cat_id'], 0, 1);
}
if (!get_file_path($next_prev_cache[$prev_image_id]['image_thumb_file'], "thumb", $next_prev_cache[$prev_image_id]['cat_id'], 0, 0)) {
$prev_thumb_file = ICON_PATH."/".get_file_extension($next_prev_cache[$prev_image_id]['image_media_file']).".gif";
}
else {
$prev_thumb_file = get_file_path($next_prev_cache[$prev_image_id]['image_thumb_file'], "thumb", $next_prev_cache[$prev_image_id]['cat_id'], 0, 1);
}
}
else {
$prev_image_name = REPLACE_EMPTY;
$prev_image_url = REPLACE_EMPTY;
$prev_image_file = REPLACE_EMPTY;
$prev_thumb_file = REPLACE_EMPTY;
}
$site_template->register_vars(array(
"next_image_id" => $next_image_id,
"next_image_name" => $next_image_name,
"next_image_url" => $next_image_url,
"next_image_file" => $next_image_file,
"next_thumb_file" => $next_thumb_file,
"prev_image_id" => $prev_image_id,
"prev_image_name" => $prev_image_name,
"prev_image_url" => $prev_image_url,
"prev_image_file" => $prev_image_file,
"prev_thumb_file" => $prev_thumb_file
));
unset($next_prev_cache);
//-----------------------------------------------------
//--- Save Comment ------------------------------------
//-----------------------------------------------------
$error = 0;
if ($action == "postcomment" && isset($HTTP_POST_VARS[URL_ID])) {
$id = intval($HTTP_POST_VARS[URL_ID]);
$sql = "SELECT cat_id, image_allow_comments
FROM ".IMAGES_TABLE."
WHERE image_id = $id";
$row = $site_db->query_firstrow($sql);
if ($row['image_allow_comments'] == 0 || !check_permission("auth_postcomment", $row['cat_id']) || !$row) {
$msg = $lang['comments_deactivated'];
}
else {
$user_name = un_htmlspecialchars(trim($HTTP_POST_VARS['user_name']));
$comment_headline = un_htmlspecialchars(trim($HTTP_POST_VARS['comment_headline']));
$comment_text = un_htmlspecialchars(trim($HTTP_POST_VARS['comment_text']));
$response_to = (isset($HTTP_POST_VARS['response_to'])) ? un_htmlspecialchars(trim($HTTP_POST_VARS['response_to'])) : "";
$captcha = (isset($HTTP_POST_VARS['captcha'])) ? un_htmlspecialchars(trim($HTTP_POST_VARS['captcha'])) : "";
// Flood Check
$sql = "SELECT comment_ip, comment_date
FROM ".COMMENTS_TABLE."
WHERE image_id = $id
ORDER BY comment_date DESC
LIMIT 1";
$spam_row = $site_db->query_firstrow($sql);
$spamtime = $spam_row['comment_date'] + 180;
if ($session_info['session_ip'] == $spam_row['comment_ip'] && time() <= $spamtime && $user_info['user_level'] != ADMIN) {
$msg .= (($msg != "") ? "<br />" : "").$lang['spamming'];
$error = 1;
}
$user_name_field = get_user_table_field("", "user_name");
if (!empty($user_name_field)) {
if ($site_db->not_empty("SELECT $user_name_field FROM ".USERS_TABLE." WHERE $user_name_field = '".strtolower($user_name)."' AND ".get_user_table_field("", "user_id")." <> '".$user_info['user_id']."'")) {
$msg .= (($msg != "") ? "<br />" : "").$lang['username_exists'];
$error = 1;
}
}
if ($user_name == "") {
$msg .= (($msg != "") ? "<br />" : "").$lang['name_required'];
$error = 1;
}
/*
if ($comment_headline == "") {
$msg .= (($msg != "") ? "<br />" : "").$lang['headline_required'];
$error = 1;
}
*/
if ($comment_text == "") {
$msg .= (($msg != "") ? "<br />" : "").$lang['comment_required'];
$error = 1;
}
if ($captcha_enable_comments && !captcha_validate($captcha)) {
$msg .= (($msg != "") ? "<br />" : "").$lang['captcha_required'];
$error = 1;
}
if (!$error) {
if ($response_to) {
$response = 1;
} else {$response = 0;}
$sql = "INSERT INTO ".COMMENTS_TABLE."
(image_id, user_id, user_name, comment_headline, comment_text, comment_ip, comment_date, response)
VALUES
($id, ".$user_info['user_id'].", '$user_name', '$comment_headline', '$comment_text', '".$session_info['session_ip']."', ".time().", '$response')";
$site_db->query($sql);
$commentid = $site_db->get_insert_id();
update_comment_count($id, $user_info['user_id']);
$sql = "SELECT 'user_id', 'image_thumb_file', 'cat_id' FROM ".IMAGES_TABLE." WHERE image_id = $id";
$user_id = $site_db->query($sql);
$user_id = $image_row['user_id'];
if ($image_row['user_id'] != $user_info['user_id']) {
$image_url = $script_url."/details.php?".URL_IMAGE_ID."=".$id."";
$image_name_url = "[url=http://".$image_url."]".$image_name."[/url]";
if (!empty($image_row['image_thumb_file'])) {
$cat_id = $image_row['cat_id'];
$image_thumb_file = $image_row['image_thumb_file'];
$thumb = $site_sess->url(ROOT_PATH."data/thumbnails/".$cat_id."/".$image_thumb_file);
$thumb = "[url=http://".$image_url."][img]http://".$thumb."[/img][/url]";
} else {
$thumb = "";
}
$pm_from = 0; //Hier bitte die user_id vom Absender angeben
$pm_type = 5;
$pm_bbcode = 1;
$pm_smiles = 1;
$pm_sig = "-- \n Mit freundlichen Grüßen, \n euer Picsforfree.de Team";
$pm_message = "Das folgende Bild hat ein Kommentar von ".$user_name." erhalten: \n\n [B]Bild:[/B] ".$image_name_url."\n".$thumb." \n\n [B]Überschrift:[/B] ".$comment_headline." \n [B]Kommentar:[/B] ".$comment_text."\n\n".$pm_sig;
$pm_subject = "\"".$image_name."\" hat ein Kommentar von ".$user_name." erhalten";
$sql = "INSERT INTO ".PM_TABLE."
(pm_date, pm_to, pm_from, pm_subject, pm_type, pm_text, pm_bbcode, pm_html, pm_ip, pm_smiles)
VALUES
('".time()."', $user_id, $pm_from, '".$pm_subject."', $pm_type, '".$pm_message."', $pm_bbcode, 0, '".$session_info['session_ip']."', $pm_smiles)";
$result = $site_db->query($sql);
}
$msg = $lang['comment_success'];
if ($response_to) {
$sql = "UPDATE ".COMMENTS_TABLE."
SET comment_response = '$commentid'
WHERE comment_id = $response_to";
$site_db->query($sql);
}
}
}
unset($row);
unset($spam_row);
}
//-----------------------------------------------------
//--- Show Comments -----------------------------------
//-----------------------------------------------------
if ($image_allow_comments == 1) {
$site_template->register_vars(array(
"has_rss" => true,
"rss_title" => "RSS Feed: ".$image_name." (".str_replace(':', '', $lang['comments']).")",
"rss_url" => $script_url."/rss.php?action=comments&".URL_IMAGE_ID."=".$image_id
));
$additional_sql = "";
if (!empty($additional_user_fields)) {
$table_fields = $site_db->get_table_fields(USERS_TABLE);
foreach ($additional_user_fields as $key => $val) {
if (isset($table_fields[$key])) {
$additional_sql .= ", u.$key";
}
}
}
$sql = "SELECT c.comment_id, c.image_id, c.user_id, c.user_name AS comment_user_name,u.admin_text, c.comment_response, c.response, c.comment_headline, c.comment_text, c.comment_ip, c.comment_date".get_user_table_field(", u.", "user_level").get_user_table_field(", u.", "user_name").get_user_table_field(", u.", "user_email").get_user_table_field(", u.", "user_showemail").get_user_table_field(", u.", "user_invisible").get_user_table_field(", u.", "user_joindate").get_user_table_field(", u.", "user_lastaction").get_user_table_field(", u.", "user_comments").get_user_table_field(", u.", "user_homepage").get_user_table_field(", u.", "user_icq").get_user_table_field(", u.", "user_id").$additional_sql."
, u.userpic
FROM ".COMMENTS_TABLE." c
LEFT JOIN ".USERS_TABLE." u ON (".get_user_table_field("u.", "user_id")." = c.user_id)
WHERE c.image_id = $image_id AND c.response = 0
ORDER BY c.comment_date ASC";
$result = $site_db->query($sql);
$comment_row = array();
while ($row = $site_db->fetch_array($result)) {
$comment_row[] = $row;
}
$site_db->free_result($result);
$num_comments = sizeof($comment_row);
if (!$num_comments) {
$comments = "<tr><td class=\"commentrow1\" colspan=\"2\">".$lang['no_comments']."</td></tr>";
}
else {
$comments = "";
$bgcounter = 0;
for ($i = 0; $i < $num_comments; $i++) {
$row_bg_number = ($bgcounter++ % 2 == 0) ? 1 : 2;
$comment_user_email = "";
$comment_user_email_save = "";
$comment_user_mailform_link = "";
$comment_user_email_button = "";
$comment_user_homepage_button = "";
$comment_user_icq_button = "";
$comment_user_profile_button = "";
$comment_user_status_img = REPLACE_EMPTY;
$comment_user_name = format_text($comment_row[$i]['comment_user_name'], 2);
$comment_user_info = $lang['userlevel_guest'];
$comment_headline = format_text($comment_row[$i]['comment_headline'], 0, $config['wordwrap_comments'], 0, 0);
$comment_user_id = $comment_row[$i]['user_id'];
if (isset($comment_row[$i][$user_table_fields['user_name']]) && $comment_user_id != GUEST) {
$comment_user_name = format_text($comment_row[$i][$user_table_fields['user_name']], 2);
$comment_user_profile_link = !empty($url_show_profile) ? $site_sess->url(preg_replace("/{user_id}/", $comment_user_id, $url_show_profile)) : $site_sess->url(ROOT_PATH."member.php?action=showprofile&".URL_USER_ID."=".$comment_user_id);
$comment_user_profile_button = "<a href=\"".$comment_user_profile_link."\"><img src=\"".get_gallery_image("profile.gif")."\" border=\"0\" alt=\"".$comment_user_name."\" /></a>";
// Commentusername mit Profil verlinken
$comment_user_name = "<a href=\"".$comment_user_profile_link."\">".$comment_user_name."</a>";
$comment_user_status_img = ($comment_row[$i][$user_table_fields['user_lastaction']] >= (time() - 300) && ((isset($comment_row[$i][$user_table_fields['user_invisible']]) && $comment_row[$i][$user_table_fields['user_invisible']] == 0) || $user_info['user_level'] == ADMIN)) ? "<img src=\"".get_gallery_image("user_online.gif")."\" border=\"0\" alt=\"Online\" />" : "<img src=\"".get_gallery_image("user_offline.gif")."\" border=\"0\" alt=\"Offline\" />";
$comment_user_homepage = (isset($comment_row[$i][$user_table_fields['user_homepage']])) ? format_url($comment_row[$i][$user_table_fields['user_homepage']]) : "";
if (!empty($comment_user_homepage)) {
$comment_user_homepage_button = "<a href=\"".$comment_user_homepage."\" target=\"_blank\"><img src=\"".get_gallery_image("homepage.gif")."\" border=\"0\" alt=\"".$comment_user_homepage."\" /></a>";
}
$comment_user_icq = (isset($comment_row[$i][$user_table_fields['user_icq']])) ? format_text($comment_row[$i][$user_table_fields['user_icq']]) : "";
if (!empty($comment_user_icq)) {
$comment_user_icq_button = "<a href=\"http://www.icq.com/people/about_me.php?uin=".$comment_user_icq."\" target=\"_blank\"><img src=\"http://status.icq.com/online.gif?icq=".$comment_user_icq."&img=5\" width=\"18\" height=\"18\" border=\"0\" alt=\"".$comment_user_icq."\" /></a>";
}
if (!empty($comment_row[$i][$user_table_fields['user_email']]) && (!isset($comment_row[$i][$user_table_fields['user_showemail']]) || (isset($comment_row[$i][$user_table_fields['user_showemail']]) && $comment_row[$i][$user_table_fields['user_showemail']] == 1))) {
$comment_user_email = format_text($comment_row[$i][$user_table_fields['user_email']]);
$comment_user_email_save = format_text(str_replace("@", " at ", $comment_row[$i][$user_table_fields['user_email']]));
if (!empty($url_mailform)) {
$comment_user_mailform_link = $site_sess->url(preg_replace("/{user_id}/", $comment_user_id, $url_mailform));
}
else {
$comment_user_mailform_link = $site_sess->url(ROOT_PATH."member.php?action=mailform&".URL_USER_ID."=".$comment_user_id);
}
$comment_user_email_button = "<a href=\"".$comment_user_mailform_link."\"><img src=\"".get_gallery_image("email.gif")."\" border=\"0\" alt=\"".$comment_user_email_save."\" /></a>";
}
//---------- [MOD] BUDDY V2 beta ----------
//---------- 2007 by eMagix ----------
//---------- 2010 by Sumale.nin ----------
//---------- Start Code ----------
if (($user_info['user_level'] != GUEST) && ($user_info['user_id'] != $comment_user_id)) {
$buddy_url = $self_url;
$buddy_url .= (!empty($mode)) ? ((strpos($buddy_url, '?') !== false) ? "&" : "?")."mode=".$mode : "";
$buddy_url .= strpos($buddy_url, '?') !== false ? "&" : "?";
// IF USER ALREADY A BUDDY SHOW ALREADY BUDDY TEXT
$buddy_status = check_buddy($comment_user_id);
if ($buddy_status == 1) {
$buddy_button = $lang['user_buddy_yes'];
}
// IF USER REQUEST PENDING SHOW PENDING TEXT
elseif ($buddy_status == 0) {
$buddy_button = $lang['user_buddy_pending'];
}
// IF NOT YET BUDDY SHOW BUTTON
elseif ($buddy_status == -1) {
$buddy_url .= "action=addbuddy&id=".$comment_user_id."";
$buddy_button = "<a href=\"".$site_sess->url($buddy_url)."\"><img src=\"".get_gallery_image("buddy_no.gif")."\" border=\"0\" alt=\"\" /></a>";
}
}
else {
// BUDDY BUTTON DISABLED
if ($user_info['user_level'] != GUEST && $user_info['user_id'] == $comment_user_id)
{
$buddy_button = "";
}
else
{
$buddy_button = "<img src=\"".get_gallery_image("buddy_off.gif")."\" border=\"0\" alt=\"\" />";
}
}
//----------- END CODE -----------------
if (!isset($comment_row[$i][$user_table_fields['user_level']]) || (isset($comment_row[$i][$user_table_fields['user_level']]) && $comment_row[$i][$user_table_fields['user_level']] == USER)) {
$comment_user_info = $lang['userlevel_user'];
}
elseif ($comment_row[$i][$user_table_fields['user_level']] == ADMIN) {
$comment_user_info = $lang['userlevel_admin'];
}
$comment_user_info .= "<br />";
$comment_user_info .= (isset($comment_row[$i][$user_table_fields['user_joindate']])) ? "<br />".$lang['join_date']." ".format_date($config['date_format'], $comment_row[$i][$user_table_fields['user_joindate']]) : "";
$comment_user_info .= (isset($comment_row[$i][$user_table_fields['user_comments']])) ? "<br />".$lang['comments']." ".$comment_row[$i][$user_table_fields['user_comments']] : "";
}
$comment_user_ip = ($user_info['user_level'] == ADMIN) ? $comment_row[$i]['comment_ip'] : "";
$admin_links = "";
if ($user_info['user_level'] == ADMIN) {
$admin_links .= "<a href=\"".$site_sess->url(ROOT_PATH."admin/index.php?goto=".urlencode("comments.php?action=editcomment&comment_id=".$comment_row[$i]['comment_id']))."\" target=\"_blank\">".$lang['edit']."</a>";
$admin_links .= "<a href=\"".$site_sess->url(ROOT_PATH."admin/index.php?goto=".urlencode("comments.php?action=removecomment&comment_id=".$comment_row[$i]['comment_id']))."\" target=\"_blank\">".$lang['delete']."</a>";
}
elseif ($is_image_owner && $user_info['user_id'] == $comment_user_id) {
$admin_links .= ($config['user_edit_comments'] != 1) ? "" : "<a href=\"".$site_sess->url(ROOT_PATH."member.php?action=editcomment&".URL_COMMENT_ID."=".$comment_row[$i]['comment_id'])."\">".$lang['edit']."</a> ";
$admin_links .= ($config['user_delete_comments'] != 1) ? "" : "<a href=\"".$site_sess->url(ROOT_PATH."member.php?action=removecomment&".URL_COMMENT_ID."=".$comment_row[$i]['comment_id'])."\">".$lang['delete']."</a>";
}$responses = "";
$response_comment_id = "";
if ($comment_row[$i]['comment_response'] != 0) {
$bg_number = $bgcounter;
$response_bg = ($bg_number++ % 2 == 0) ? 1 : 2;
$responses .= "<br /><table class=\"reply\" width=\"90%\" align=\"center\" cellpadding=\"5\" cellspacing=\"0\" >\n";
$response_row['comment_response'] = $comment_row[$i]['comment_response'];
while ($response_row['comment_response'] != 0) {
$sql = "SELECT c.comment_id, c.image_id, c.user_id, c.user_name AS response_user_name, c.comment_headline, c.comment_text, c.comment_ip, c.comment_date, c.comment_response".get_user_table_field(", u.", "user_level").get_user_table_field(", u.", "user_name")."
FROM ".COMMENTS_TABLE." c
LEFT JOIN ".USERS_TABLE." u ON (".get_user_table_field("u.", "user_id")." = c.user_id)
WHERE c.comment_id = ".$response_row['comment_response'];
$response_row = $site_db->query_firstrow($sql);
$response_user_name = format_text($response_row['response_user_name'], 2);
$response_user_info = $lang['userlevel_guest'];
$response_user_id = $response_row['user_id'];
$response_date = format_date($config['date_format']." ".$config['time_format'], $response_row['comment_date']);
$response_text = format_text($response_row['comment_text'], $config['html_comments'], $config['wordwrap_comments'], $config['bb_comments'], $config['bb_img_comments']);
$response_comment_id = $response_row['comment_id'];
if (isset($response_row[$user_table_fields['user_name']]) && $response_user_id != GUEST) {
$response_user_profile_link = !empty($url_show_profile) ? $site_sess->url(preg_replace("/{user_id}/", $response_user_id, $url_show_profile)) : $site_sess->url(ROOT_PATH."member.php?action=showprofile&".URL_USER_ID."=".$response_user_id);
$response_user_name = "<a href=\"".$response_user_profile_link."\">".format_text($response_row[$user_table_fields['user_name']], 2)."</a>";
if (!isset($response_row[$user_table_fields['user_level']]) || (isset($response_row[$user_table_fields['user_level']]) && $response_row[$user_table_fields['user_level']] == USER)) {
$response_user_info = $lang['userlevel_user'];
}
elseif ($response_row[$user_table_fields['user_level']] == ADMIN) {
$response_user_info = $lang['userlevel_admin'];
}
}
$response_user_ip = ($user_info['user_level'] == ADMIN) ? $response_row['comment_ip'] : "";
$response_admin_links = "";
if ($user_info['user_level'] == ADMIN) {
$response_admin_links .= "<a href=\"".$site_sess->url(ROOT_PATH."admin/index.php?goto=".urlencode("comments.php?action=editcomment&comment_id=".$response_row['comment_id']))."\" target=\"_blank\">".$lang['edit']."</a> ";
$response_admin_links .= "<a href=\"".$site_sess->url(ROOT_PATH."admin/index.php?goto=".urlencode("comments.php?action=removecomment&comment_id=".$response_row['comment_id']))."\" target=\"_blank\">".$lang['delete']."</a>";
}
elseif ($is_image_owner) {
$response_admin_links .= ($config['user_edit_comments'] != 1) ? "" : "<a href=\"".$site_sess->url(ROOT_PATH."member.php?action=editcomment&".URL_COMMENT_ID."=".$response_row['comment_id'])."\">".$lang['edit']."</a> ";
$response_admin_links .= ($config['user_delete_comments'] != 1) ? "" : "<a href=\"".$site_sess->url(ROOT_PATH."member.php?action=removecomment&".URL_COMMENT_ID."=".$response_row['comment_id'])."\">".$lang['delete']."</a>";
}
$responses .= "<tr class=\"reply-bit2\">\n<a name=\"comment".$response_comment_id."\"></a>\n<td class=\"commentrow".$response_bg."\">\n";
$responses .= "<table width=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\n";
$responses .= "<tr>\n<td><b>".$lang['response'].$response_user_name."</b> (".$response_user_info.")</td>\n";
$responses .= "<td class=\"date-reply\">".$response_date."</td>\n</tr>\n";
$responses .= "<tr>\n<td colspan=\"2\"><hr>\n".$response_text."</td>\n</tr>\n";
$responses .= "<tr>\n<td>".$response_user_ip."</td>\n";
$responses .= "<td align=\"right\">".$response_admin_links."</td>\n</tr>\n";
$responses .= "</table>\n</td>\n</tr>\n</div>";
$response_bg = ($bg_number++ % 2 == 0) ? 1 : 2;
}
$responses .= "</table>\n";
}
$response_to_id = "";
if ($response_comment_id) {
$response_to_id .= $response_comment_id;
} else {
$response_to_id .= $comment_row[$i]['comment_id'];
}
$site_template->register_vars(array(
"comment_id" => $comment_row[$i]['comment_id'],
"comment_user_pm" => ($config['pm'] && $comment_row[$i]['user_id'] != GUEST && $user_info['user_level'] > GUEST && $user_info['user_id'] != $comment_row[$i]['user_id']) ? "<a href=\"".$site_sess->url(ROOT_PATH."pm.php?action=quote&mode=comment&id=".$comment_row[$i]['comment_id']."&user_id=".$comment_row[$i]['user_id'])."\" /><img src=\"".get_gallery_image("pm.gif")."\" border=\"0\" alt=\"".$lang['pm_user_pm_alt']."\" /></div></a>" : "",
"comment_user_id" => $comment_user_id,
"comment_user_status_img" => $comment_user_status_img,
"comment_user_name" => $comment_user_name,
"comment_user_info" => $comment_user_info,
"comment_user_profile_button" => $comment_user_profile_button,
"comment_user_email" => $comment_user_email,
"comment_user_email_save" => $comment_user_email_save,
"comment_user_mailform_link" => $comment_user_mailform_link,
"comment_user_email_button" => $comment_user_email_button,
"comment_user_homepage_button" => $comment_user_homepage_button,
"comment_user_icq_button" => $comment_user_icq_button,
"comment_user_ip" => $comment_user_ip,
"comment_userpic" => ($config['userpic'] && $comment_row[$i]['userpic']) ? ROOT_PATH."data/userpic/".$comment_row[$i]['userpic'] : "",
"comment_headline" => $comment_headline,
"responses" => $responses,
"response_to_id" => $response_to_id,
"lang_post_response" => $lang['post_response'],
"comment_text" => format_text($comment_row[$i]['comment_text'], $config['html_comments'], $config['wordwrap_comments'], $config['bb_comments'], $config['bb_img_comments']),
"comment_date" => format_date($config['date_format']." ".$config['time_format'], $comment_row[$i]['comment_date']),
"buddy_button" => $buddy_button,
// BUDDY MOD BY EMAGIX - REFRESH BY SUMALE.NIN
"row_bg_number" => $row_bg_number,
"admin_links" => $admin_links
));
$comments .= $site_template->parse_template("comment_bit");
} // end while
} //end else
$site_template->register_vars("comments", $comments);
unset($comments);
//-----------------------------------------------------
//--- BBCode & Form -----------------------------------
//-----------------------------------------------------
$allow_posting = check_permission("auth_postcomment", $cat_id);
$bbcode = "";
if ($config['bb_comments'] == 1 && $allow_posting) {
$site_template->register_vars(array(
"lang_bbcode" => $lang['bbcode'],
"lang_tag_prompt" => $lang['tag_prompt'],
"lang_link_text_prompt" => $lang['link_text_prompt'],
"lang_link_url_prompt" => $lang['link_url_prompt'],
"lang_link_email_prompt" => $lang['link_email_prompt'],
"lang_list_type_prompt" => $lang['list_type_prompt'],
"lang_list_item_prompt" => $lang['list_item_prompt']
));
$bbcode = $site_template->parse_template("bbcode");
}
if (!$allow_posting) {
$comment_form = "";
}
else {
$user_name = (isset($HTTP_POST_VARS['user_name']) && $error) ? format_text(trim(stripslashes($HTTP_POST_VARS['user_name'])), 2) : (($user_info['user_level'] != GUEST) ? format_text($user_info['user_name'], 2) : "");
$comment_headline = (isset($HTTP_POST_VARS['comment_headline']) && $error) ? format_text(trim(stripslashes($HTTP_POST_VARS['comment_headline'])), 2) : "";
$comment_text = (isset($HTTP_POST_VARS['comment_text']) && $error) ? format_text(trim(stripslashes($HTTP_POST_VARS['comment_text'])), 2) : "";
$response_to = (isset($HTTP_POST_VARS['response_to']) && $error) ? format_text(trim(stripslashes($HTTP_POST_VARS['response_to'])), 2) : "";
$site_template->register_vars(array(
"bbcode" => $bbcode,
"user_name" => $user_name,
"comment_headline" => $comment_headline,
"comment_text" => $comment_text,"response_to" => $response_to,
"lang_clear" => $lang['clear'],
"lang_clear_desc" => $lang['clear_desc'],
"lang_post_comment" => $lang['post_comment'],
"lang_name" => $lang['name'],
"lang_headline" => $lang['headline'],
"lang_comment" => $lang['comment'],
"lang_captcha" => $lang['captcha'],
"lang_captcha_desc" => $lang['captcha_desc'],
"captcha_comments" => (bool)$captcha_enable_comments
));
$comment_form = $site_template->parse_template("comment_form");
}
$site_template->register_vars("comment_form", $comment_form);
unset($comment_form);
} // end if allow_comments
// Admin Links
$admin_links = "";
if ($user_info['user_level'] == ADMIN) {
$admin_links .= "<a href=\"".$site_sess->url(ROOT_PATH."admin/index.php?goto=".urlencode("images.php?action=editimage&image_id=".$image_id))."\" target=\"_blank\">".$lang['edit']."</a> ";
$admin_links .= "<a href=\"".$site_sess->url(ROOT_PATH."admin/index.php?goto=".urlencode("images.php?action=removeimage&image_id=".$image_id))."\" target=\"_blank\">w".$lang['delete']."</a>";
}
elseif ($is_image_owner) {
$admin_links .= ($config['user_edit_image'] != 1) ? "" : "<a href=\"".$site_sess->url(ROOT_PATH."member.php?action=editimage&".URL_IMAGE_ID."=".$image_id)."\">".$lang['edit']."</a> ";
$admin_links .= ($config['user_delete_image'] != 1) ? "" : "<a href=\"".$site_sess->url(ROOT_PATH."member.php?action=removeimage&".URL_IMAGE_ID."=".$image_id)."\">".$lang['delete']."</a>";
}
$site_template->register_vars("admin_links", $admin_links);
// Update Hits
if ($user_info['user_level'] != ADMIN) {
$sql = "UPDATE ".IMAGES_TABLE."
SET image_hits = image_hits + 1
WHERE image_id = $image_id";
$site_db->query($sql);
}
//-----------------------------------------------------
//---Clickstream---------------------------------------
//-----------------------------------------------------
$clickstream = "<span class=\"clickstream\"><a href=\"".$site_sess->url(ROOT_PATH."index.php")."\" class=\"clickstream\">".$lang['home']."</a>".$config['category_separator'];
if ($mode == "lightbox" && $in_mode) {
$page_url = "";
if (preg_match("/".URL_PAGE."=([0-9]+)/", $url, $regs)) {
if (!empty($regs[1]) && $regs[1] != 1) {
$page_url = "?".URL_PAGE."=".$regs[1];
}
}
$clickstream .= "<a href=\"".$site_sess->url(ROOT_PATH."lightbox.php".$page_url)."\" class=\"clickstream\">".$lang['lightbox']."</a>".$config['category_separator'];
}
elseif ($mode == "search" && $in_mode) {
$page_url = "";
if (preg_match("/".URL_PAGE."=([0-9]+)/", $url, $regs)) {
if (!empty($regs[1]) && $regs[1] != 1) {
$page_url = "&".URL_PAGE."=".$regs[1];
}
}
$clickstream .= "<a href=\"".$site_sess->url(ROOT_PATH."search.php?show_result=1".$page_url)."\" class=\"clickstream\">".$lang['search']."</a>".$config['category_separator'];
}
else {
$clickstream .= get_category_path($cat_id, 1).$config['category_separator'];
}
$clickstream .= $image_name."</span>";
$sql = "SELECT l.lightbox_image_ids, u.user_id, l.user_id".get_user_table_field(", u.", "user_name")."
FROM (".LIGHTBOXES_TABLE." l, ".USERS_TABLE." u)
WHERE l.lightbox_image_ids LIKE '%$image_id%' AND u.user_id=l.user_id";
$result = $site_db->query($sql);
$lightbox_row = array();
while ($row = $site_db->fetch_array($result)) {
$lightbox_row[] = $row;
}
$site_db->free_result($result);
$num_rows = sizeof($lightbox_row);
if ($num_rows) {
for ($i = 0; $i < $num_rows; $i++) {
$lightbox_list .= "<a href=\"".$site_sess->url(ROOT_PATH."member.php?action=showprofile&".URL_USER_ID."=".$lightbox_row[$i]['user_id'])."\">".$lightbox_row[$i]['user_name']."</a>";
if ($i+1 != $num_rows) {
$lightbox_list .= ", ";
}
}
}
//-----------------------------------------------------
//--- Print Out ---------------------------------------
//-----------------------------------------------------
$site_template->register_vars(array(
"lightbox_list" => $lightbox_list,
"msg" => $msg,
"clickstream" => $clickstream,
"lang_category" => $lang['category'],
"lang_added_by" => $lang['added_by'],
"lang_description" => $lang['description'],
"lang_keywords" => $lang['keywords'],
"lang_date" => $lang['date'],
"lang_hits" => $lang['hits'],
"lang_downloads" => $lang['downloads'],
"lang_rating" => $lang['rating'],
"lang_votes" => $lang['votes'],
"lang_author" => $lang['author'],
"lang_comment" => $lang['comment'],
"lang_prev_image" => $lang['prev_image'],
"lang_next_image" => $lang['next_image'],
"lang_file_size" => $lang['file_size']
));
//-----------------------------------------------------
//--- [MOD] Ajax Star Rating --------------by Bash-T---
//START------------------------------------------------
$site_template->register_vars(array(
"ajax_rating_labels_0" => $lang['ajax_rating_labels'][0],
"ajax_rating_labels_1" => $lang['ajax_rating_labels'][1],
"ajax_rating_labels_2" => $lang['ajax_rating_labels'][2],
"ajax_rating_labels_3" => $lang['ajax_rating_labels'][3],
"ajax_rating_labels_4" => $lang['ajax_rating_labels'][4],
"ajax_rating_labels_5" => $lang['ajax_rating_labels'][5],
"ajax_rating_messages_0" => $lang['ajax_rating_messages'][0],
"ajax_rating_messages_1" => $lang['ajax_rating_messages'][1],
"ajax_rating_messages_2" => $lang['ajax_rating_messages'][2],
"ajax_rating_messages_3" => $lang['ajax_rating_messages'][3],
"ajax_rating_points" => $lang['ajax_rating_points']
));
//-----------------------------------------------------
//--- [MOD] Ajax Star Rating --------------by Bash-T---
//--------------------------------------------------END
$site_template->print_template($site_template->parse_template($main_template));
include(ROOT_PATH.'includes/page_footer.php');
?>
-----------------------
Edit :1
---------------------
i think i found why is that problem but i can't show images when i solve it ,
WHERE i.image_active = 1 AND i.user_id = " . (int)$user_id . " AND i.cat_id NOT IN (".get_auth_cat_sql("auth_viewcat", "NOTIN").")";
in
WHERE i.image_active = 1 when i change it to 0 the problem is gone but the mod doesn't work
------------------
Edit:2
------------------
i think i found the problem is with this mode
http://www.4homepages.de/forum/index.php?topic=17452.0
when i add both of modes show images mod doesn't work and appear blank page
please help ?
-
kann man in Userprofile noch die Kategorie listen in den der User seine bilder hat?
Das wäre wirklich eine super Erweiterung
-
It's a great MOD, but will get performance problems (if you are not using your own cache). This post is for people with performance problems.
I removed the paging (since when you click on "show all images by XXX" it shows you all images with paging anyway). And I get rid of all the $row calculations,
since it really slows down anything (not just here, I would suggest you get rid of it anywhere).
So the best solution to solve performance problems is placing your thumbnails into <div> containers like this:
1. The modified PHP
//-----------------------------------------------------
//--- START Show user images in profile ---------------
//-----------------------------------------------------
$sql3 = "SELECT i.image_id, i.cat_id, i.user_id, i.image_name, i.image_description, i.image_keywords, i.image_date, i.image_active, i.image_media_file, i.image_thumb_file, i.image_download_url, i.image_allow_comments, i.image_comments, i.image_downloads, i.image_votes, i.image_rating, i.image_hits".$additional_sql.", c.cat_name".get_user_table_field(", u.", "user_name")."
FROM (".IMAGES_TABLE." i, ".CATEGORIES_TABLE." c)
LEFT JOIN ".USERS_TABLE." u ON (".get_user_table_field("u.", "user_id")." = i.user_id)
WHERE i.image_active = 1 AND c.cat_id = i.cat_id AND i.user_id = $user_id AND i.cat_id NOT IN (".get_auth_cat_sql("auth_viewcat", "NOTIN").")
ORDER BY i.image_date DESC
LIMIT 5";
$result = $site_db->query($sql3);
$num_rows = $site_db->get_numrows($result);
if (!$num_rows) {
$user_profile_images .= $lang['no_new_images'];
}
else {
while ($image_row = $site_db->fetch_array($result)){
show_image($image_row);
$user_profile_images .= $site_template->parse_template("thumbnail_bit_profile");
} // end while
} // end else
$site_template->register_vars("user_profile_images", $user_profile_images);
$site_template->register_vars("lang_user_profile_images", $lang['user_profile_images']);
unset($user_profile_images);
//-----------------------------------------------------
//--- END Show user images in profile -----------------
//-----------------------------------------------------
Less code --> Less Queries --> More performance
Then create a thumbnail_bit_profile with <div>'s
(just an example)
<div style="float: left; padding-left: 32px; padding-bottom: 20px;">
<div style="width: 210px; border: 1px solid #dddddd; padding: 1px;">
<div class="imgteaser">
<a href="details.php?image_id={image_id}&mode=search"><img src="data/thumbnails/{cat_id}/{thumbnail_file_name}" width="210" height="210">
</a>
</div>
</div>
</div>
and finally use {user_profile_images} inside a table in your member_profile.html
-
thx
-
Could you help me to show photos one by one in row not in column.
-
Could you help me to show photos one by one in row not in column.
search in the code:
$imgtable_width = ceil(intval($config['image_table_width']) / $config['image_cells']);
insert above:
$config['image_cells'] = 1;
mfg Andi
-
Could you help me to show photos one by one in row not in column.
search in the code:
$imgtable_width = ceil(intval($config['image_table_width']) / $config['image_cells']);
insert above:
$config['image_cells'] = 1;
mfg Andi
It doesn't help. (