4images Forum & Community
4images Modifications / Modifikationen => Mods & Plugins (Releases & Support) => Topic started by: V@no on March 27, 2003, 01:44:45 PM
-
-------- Overview -----------------
This MOD will let guests add picture to their lightbox, based on sessions + cookies.
u can see it an action here (http://gallery.vano.org)
-------- Known issue -------------
"GUESTs" lightbox is separate from "USERs", that means, that if u add some images to the lightbox, while u are not logged in and then do login, u wont have those images in the lightbox, untill u logged out.
-------- Installation ---------------
1.
Open /includes/functions.php
Find: if ($user_info['user_level'] != GUEST) {
Replace with: if ($user_info['user_level'] >= GUEST) {
1.2.
Find next:function add_to_lightbox($id) {
global $user_info, $site_db;
$id = intval($id);
if (!$id) {
return false;
}
$lightbox_ids = $user_info['lightbox_image_ids'];
$lightbox_array = explode(" ", $lightbox_ids);
if (!in_array($id, $lightbox_array)) {
$lightbox_ids .= " ".$id;
}
$user_info['lightbox_image_ids'] = trim($lightbox_ids);
$user_info['lightbox_lastaction'] = time();
Replace with:function add_to_lightbox($id) {
global $user_info, $site_db, $site_sess;
$id = intval($id);
if (!$id) {
return false;
}
if ($user_info['user_level'] == GUEST) {
$lightbox = $site_sess->get_session_var('lightbox');
$user_info['lightbox_image_ids'] = ($lightbox) ? $lightbox : $site_sess->read_cookie_data("lightbox");
}
$lightbox_ids = $user_info['lightbox_image_ids'];
$lightbox_array = explode(" ", $lightbox_ids);
if (!in_array($id, $lightbox_array)) {
$lightbox_ids .= " ".$id;
}
$user_info['lightbox_image_ids'] = trim($lightbox_ids);
$user_info['lightbox_lastaction'] = time();
if ($user_info['user_level'] == GUEST) {
$site_sess->set_cookie_data("lightbox", $user_info['lightbox_image_ids'], 1);
$site_sess->set_cookie_data("lightbox_lastaction", $user_info['lightbox_lastaction'], 1);
$site_sess->set_session_var("lightbox", $user_info['lightbox_image_ids']);
$site_sess->set_session_var("lightbox_lastaction", $user_info['lightbox_lastaction']);
return 1;
}
1.3.
Find next:function remove_from_lightbox($id) {
global $user_info, $site_db;
$lightbox_array = explode(" ",$user_info['lightbox_image_ids']);
foreach ($lightbox_array as $key => $val) {
if ($val == $id) {
unset($lightbox_array[$key]);
}
}
$user_info['lightbox_image_ids'] = trim(implode(" ", $lightbox_array));
$user_info['lightbox_lastaction'] = time();
Replace with:function remove_from_lightbox($id) {
global $user_info, $site_db, $site_sess;
if ($user_info['user_level'] == GUEST) {
$lightbox = $site_sess->get_session_var('lightbox');
$user_info['lightbox_image_ids'] = ($lightbox) ? $lightbox : $site_sess->read_cookie_data("lightbox");
}
$lightbox_array = explode(" ",$user_info['lightbox_image_ids']);
foreach ($lightbox_array as $key => $val) {
if ($val == $id) {
unset($lightbox_array[$key]);
}
}
$user_info['lightbox_image_ids'] = trim(implode(" ", $lightbox_array));
$user_info['lightbox_lastaction'] = time();
if ($user_info['user_level'] == GUEST) {
$site_sess->set_cookie_data("lightbox", $user_info['lightbox_image_ids'], 1);
$site_sess->set_cookie_data("lightbox_lastaction", $user_info['lightbox_lastaction'], 1);
$site_sess->set_session_var("lightbox", $user_info['lightbox_image_ids']);
$site_sess->set_session_var("lightbox_lastaction", $user_info['lightbox_lastaction']);
return 1;
}
1.4.
Find next:function clear_lightbox() {
global $user_info, $site_db;
$current_time = time();
Replace with:function clear_lightbox() {
global $user_info, $site_db, $site_sess;
$current_time = time();
if ($user_info['user_level'] == GUEST) {
$user_info['lightbox_image_ids'] = "";
$user_info['lightbox_lastaction'] = $current_time;
$site_sess->set_cookie_data("lightbox", "");
$site_sess->drop_session_var("lightbox");
$site_sess->set_cookie_data("lightbox_lastaction", $current_time, 1);
$site_sess->set_session_var("lightbox_lastaction", $current_time);
return true;
}
1.5.
Find next:function check_lightbox($id) {
global $user_info;
Replace with:function check_lightbox($id) {
global $user_info, $site_sess;
if ($user_info['user_level'] == GUEST) {
$lightbox = $site_sess->get_session_var('lightbox');
$user_info['lightbox_image_ids'] = ($lightbox) ? $lightbox : $site_sess->read_cookie_data("lightbox");
}
2.
Open /lightbox.php
Find and remove (or comment):if ($user_info['user_level'] == GUEST || $user_info['user_level'] == USER_AWAITING) {
show_error_page($lang['lightbox_register']);
}
2.1.
Find next:if (!empty($user_info['lightbox_image_ids'])) {
Add before:if ($user_info['user_level'] == GUEST) {
$lightbox = $site_sess->get_session_var('lightbox');
$user_info['lightbox_image_ids'] = ($lightbox) ? $lightbox : $site_sess->read_cookie_data("lightbox");
$lightbox = $site_sess->get_session_var('lightbox_lastaction');
$user_info['lightbox_lastaction'] = ($lightbox) ? $lightbox : $site_sess->read_cookie_data("lightbox_lastaction");
}
2.2a. (4images v1.7 - 1.7.3)
Find next: if (!empty($user_info['lightbox_image_ids'])) {
$download_button = "<a href=\"".$site_sess->url(ROOT_PATH."download.php?action=lightbox")."\"><img src=\"".get_gallery_image("download_zip.gif")."\" border=\"0\" alt=\"\" /></a>";
Replace with: if (!empty($user_info['lightbox_image_ids']) && $user_info['user_level'] != GUEST) {
$download_button = "<a href=\"".$site_sess->url(ROOT_PATH."download.php?action=lightbox")."\"><img src=\"".get_gallery_image("download_zip.gif")."\" border=\"0\" alt=\"\" /></a>";
2.2b. (4images v1.7.4 and newer)
Find: if ($download_allowed && !empty($user_info['lightbox_image_ids'])) {
$download_button = "<a href=\"".$site_sess->url(ROOT_PATH."download.php?action=lightbox")."\"><img src=\"".get_gallery_image("download_zip.gif")."\" border=\"0\" alt=\"\" /></a>";
Replace with: if ($download_allowed && !empty($user_info['lightbox_image_ids']) && $user_info['user_level'] != GUEST) {
$download_button = "<a href=\"".$site_sess->url(ROOT_PATH."download.php?action=lightbox")."\"><img src=\"".get_gallery_image("download_zip.gif")."\" border=\"0\" alt=\"\" /></a>";
3.
Open /templates/<yourtemplate>/user_loginform.html
Insert:<a href="{url_lightbox}">{lang_lightbox}</a>
4. * Fix
Open /includes/page_header.php
Find://-----------------------------------------------------
//--- Add & Delete from Lists -------------------------
//-----------------------------------------------------
if ($action == "addtolightbox" && $id) {
if ($user_info['user_level'] >= USER) {
$msg = (add_to_lightbox($id)) ? $lang['lightbox_add_success'] : $lang['lightbox_add_error'];
}
else {
$msg = $lang['lightbox_register'];
}
}
if ($action == "removefromlightbox" && $id) {
if ($user_info['user_level'] >= USER) {
$msg = (remove_from_lightbox($id)) ? $lang['lightbox_remove_success'] : $lang['lightbox_remove_error'];
}
else {
$msg = $lang['lightbox_register'];
}
}
if ($action == "clearlightbox") {
if ($user_info['user_level'] >= USER) {
$msg = (clear_lightbox()) ? $lang['lightbox_delete_success'] : $lang['lightbox_delete_error'];
}
else {
$msg = $lang['lightbox_register'];
}
}
Replace with://-----------------------------------------------------
//--- Add & Delete from Lists -------------------------
//-----------------------------------------------------
if ($action == "addtolightbox" && $id) {
if ($user_info['user_level'] >= GUEST) {
$msg = (add_to_lightbox($id)) ? $lang['lightbox_add_success'] : $lang['lightbox_add_error'];
}
else {
$msg = $lang['lightbox_register'];
}
}
if ($action == "removefromlightbox" && $id) {
if ($user_info['user_level'] >= GUEST) {
$msg = (remove_from_lightbox($id)) ? $lang['lightbox_remove_success'] : $lang['lightbox_remove_error'];
}
else {
$msg = $lang['lightbox_register'];
}
}
if ($action == "clearlightbox") {
if ($user_info['user_level'] >= GUEST) {
$msg = (clear_lightbox()) ? $lang['lightbox_delete_success'] : $lang['lightbox_delete_error'];
}
else {
$msg = $lang['lightbox_register'];
}
}
5. Added 9-23-2003 *optional, only if u want let your guests download the lightbox
Open download.php
Find:
if ($action == "lightbox") {
Add after:
if ($user_info['user_level'] == GUEST) {
$lightbox = $site_sess->get_session_var('lightbox');
$user_info['lightbox_image_ids'] = ($lightbox) ? $lightbox : $site_sess->read_cookie_data("lightbox");
}
-
i've tried this mod but it seems that it's not working cause when i click in "album" button as a guest it doesn't save that info and then i go to the album link and it says that i don't have any images on favs.
should i post my code here?
-
Ops. sry, forgot add one more step :oops:
Check out step 4.
-
Everything I had follow.
after result is, I am act as guest, I can select my light boxs, the picture I selected have a "tick" there.
but when I click on lightbox link it give me below message.
Error
--------------------------------------------------------------------------------
In order to use the lightbox, you have to register.
P/s: again, the select picture lightbox is WORKING but just when click on the lightbox link to show the fully selected lightbox is not working
Which file I had to refer back?
-
did u do step 2. ? are those three line in your lightbox.php commented (means two forward slashes infront of each line: //) or deleted now?
-
Dear V@no,
It is done! this mod very peferctly now!
Yes, you are right, I since I check all script I found one / is missing. when replace it, it work perfectly.
V@no, Thank again!
Because of you, our gallery look more advance! nice jobs! Want I spend you a dinner? :lol: he he
-
i get an error after install this mod. Warning: Cannot add header information - headers already sent by (output started at /homepages/0/d72423240/htdocs/smssprueche/nuke/homepage/4images/includes/functions.php:2526) in /homepages/0/d72423240/htdocs/smssprueche/nuke/homepage/4images/includes/sessions.php on line 171
this comes 4 times.
this is line 171:
function set_cookie_data($name, $value, $permanent = 1) {
$cookie_expire = ($permanent) ? $this->current_time + 60 * 60 * 24 * 365 : 0;
$cookie_name = COOKIE_NAME.$name;
setcookie($cookie_name, $value, $cookie_expire, COOKIE_PATH, COOKIE_DOMAIN, COOKIE_SECURE);
}
i saved the changed files and copy back the original files, but i have still the above error.
-
Warning: Cannot add header information - headers already sent by (output started at /homepages/0/d72423240/htdocs/smssprueche/nuke/homepage/4images/includes/functions.php:2526) in /homepages/0/d72423240/htdocs/smssprueche/nuke/homepage/4images/includes/sessions.php on line 171
usualy this error shows when u have some extra space or new line after closing ?> in .php files. check again every file u edited.
-
@ V@no
Hi , I've a problem with your MOD . After all modification , guests are unable to download our choosed images in lightbox ( botton are visible but inactive ) and unable to clear our lightbox..
What happens ?
-
strange, everything works just fine for me...exept download button ;)
to fix that, in lightboxes.php find: if (!empty($user_info['lightbox_image_ids']) && $user_info['user_level'] != GUEST) {
replace with: if (!empty($user_info['lightbox_image_ids'])) {
-
strange, everything works just fine for me...exept download button ;)
to fix that,...
Thank's , the fix works fine.
But the first problem continue to persist... may be the problem caused by the cookies ?
-
I'm not sure...can I try? :wink:
-
I'm not sure...can I try? :wink:
Here the link to my under-construction-website..
http://www.faithhill.it/portal/modules.php?name=TechMedia&file=index
-
at the begining I was getting javascript error messages, and clear lighbox didnt work, then I closed my browser and opened again - no error messages, clear lighbox working now, but download never worked, it just refreshing whole page.
does your download button work for members at all?
-
..
does your download button work for members at all?
Ya, for members the download through the lightbox page works fine!
-
thank you!
it works perfectly!
-
thank you!
it works perfectly!
What ? 8O
-
V@no
could you please check if it is allright!
sincerly
vincent
-
V@no
could you please check if it is allright!
sincerly
vincent
sorry, what is alright?
Didnt understand your post..
-
This mod would be perfect, but...
My Gallery runs with 4images 1.7.1. Added pictures are tagged but the lightbox is empty.
I think there is a problem with my version, vano´s gallery runs with 1.7
I checked the cookies, there is one difference:
1.7.1
sessionid 86532440b238abb46f19f1e81d3a09fa
1.7.
4images_sid 0a88f4ebcce9a4b3eea48d3eac2b724e
Could you please post a changed mod that runs also with 1.7.1 ? would be great!
-
this mod should work on v1.7.1 by default.
Do u have in your cookies: 4images_lightbox
?
if u dont, then u probably made a misstake during installation.
-
Hello
i would like to have the possibility to send the lightbox - as example to request how much the picture will cost!
But i don't wan't guests do download the image!
sincerly
vincent
-
Hello
i would like to have the possibility to send the lightbox - as example to request how much the picture will cost!
But i don't wan't guests do download the image!
sorry I dont quet understand your request....send lightbox where?
guest download lightbox is optional in step 5
-
@Vano
Imagine you select with the lightbox 10 Picture then you should be able to send this lightbox like a contact sheet to me to request the price of the picture!
or i will send a couple of picture to a agency to ask if it is what he was looking for!
do you know what i mean?
sincelry
vincent
-
yeah, well, this request has absolutely nothing to do with this mod ;) start a new request topic or something ;)
-
v@no
you wan't belive me but there have been a mod about this!
:cry:
:roll: Vincent
-
v@no
you wan't belive me but there have been a mod about this!
:cry:
:roll: Vincent
yeah, I remmember something like "Send lightbox to administrator"
Well, maybe u should start a new request topic and someone could recover it ;)
-
hay guys
is there a demo for this mod ?
-
i think it works on V@no's Homepage!
8) VIncent
-
ok i will check it
thank you
-
I Have installed it and i belive it works!
but how can i see my lightbox or Album in german
i think i miss or need buton somewhere
sincerly
vincent
-
all none-dafault language images should go into /template/<yourtemplate>/images_<language_name>/ for example for your german language it should be:
template/<yourtemplate>/images_german/
-
Sorry V@no
you missunderstoud my writting!
if i look at your homepage you have on the left side the menu for loging in just below you have a link called Album!
This link is i am missing!
if you look at my page i don't have a login box (i Removed it)
sincerly
vincent
-
second Problem i found
i have two domain name pointing to one homepage
www.foto-kocher.com
www.foto-kocher.biz
if i do a Album (=Lightbox) in .com it ist not showing up in .biz/lightbox.php
how is this to fix?
sincerly
vincent
-
if i look at your homepage you have on the left side the menu for loging in just below you have a link called Album!
This link is i am missing!
its in user_logininfo.html template
-
second Problem i found
i have two domain name pointing to one homepage
www.foto-kocher.com
www.foto-kocher.biz
if i do a Album (=Lightbox) in .com it ist not showing up in .biz/lightbox.php
how is this to fix?
sincerly
vincent
-
there is nothing u can do about it, u can not have same cookies for two different domains.
-
ok i will have to search for a solution to force one domain to the other!
:? :? :roll:
vincent
-
Hello
i have another Problem with the lightbox - i put some picture in - and a couple of hours later it is empty!
why this happen?
vincent
-
that's because for some reason there is no cookies being set on your site...
here are the headers I receive from your site when adding an image to lightbox:HTTP/1.1 302 Object Moved
Location: ./templates/4dark/images/lightbox_yes.gif
Server: Microsoft-IIS/5.0
Content-Type: text/html
Content-Length: 164
<head><title>Document Moved</title></head>
<body><h1>Object Moved</h1>This document may be found <a HREF="./templates/4dark/images/lightbox_yes.gif">here</a></body>
and this are the headers from my site:HTTP/1.1 302 Found
Date: Sun, 10 Apr 2005 17:29:59 GMT
Server: Apache/2.0.53 (Unix)
Set-Cookie: PHPSESSID=pnabxOCw05f9EyIqnnvlIpkOsL9; path=/
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
Set-Cookie: 4images_lightbox=s%3A0%3A%22%22%3B; expires=Sat, 09 Jul 2005 17:29:59 GMT; path=/
Set-Cookie: 4images_lightbox_lastaction=i%3A1113154199%3B; expires=Sat, 09 Jul 2005 17:29:59 GMT; path=/
Location: ./templates/vano/images/lightbox_no.gif
Content-Length: 0
Connection: close
Content-Type: image/gif
I dont know, maybe its because your server is running on Windows system with IIS webserver? dont know...
P.S. try and see if it works without the "Add/remove images to/from lightbox without page refresh" mod.
-
i removed - but now my page gives a error!
http://www.4homepages.de/forum/index.php?topic=7581.0
vincent
-
this mod should work on v1.7.1 by default.
Do u have in your cookies: 4images_lightbox
?
if u dont, then u probably made a misstake during installation.
yes I have this in the cookies, but still not working :(
Actually I had removed the user login, register option, (from the template) the entire area which holds the user login, random images, etc (I did this, to make space for wrapping this gallery into mambo) later I added you code and include: <a href="{url_lightbox}">{lang_lightbox}</a> for the lightbox link
Now I am able to add images to the lightbox, but when I view, it’s empty…. What might have gone wrong? Using 1.7.1
Thanks V@no for the MOD, its really cool feature :wink:
Paul :D
-
I dont know what u did wrong, I just tested it on a fresh v1.7.1 and it worked just fine.
Can I test yours?
-
ok, I've updated the code to v1.2
Now it uses build-in functions to set/read cookies and sessions.
To upgrade, u'll need redo steps: 1.2, 1.3, 1.4, 1.5, 2.1, 4. and 5.
Step 2.1 was changed, so u'll need remove previos code:if ($user_info['user_level'] == GUEST) {
$cookie_name = (defined("COOKIE_NAME")) ? COOKIE_NAME : "4images_";
$cookie_lightbox = isset($HTTP_COOKIE_VARS[$cookie_name.'lightbox_lastaction']) ? unserialize(stripslashes($HTTP_COOKIE_VARS[$cookie_name.'lightbox_lastaction'])) : "";
$user_info['lightbox_lastaction'] = (isset($session_info['lightbox_lastaction'])) ? $session_info['lightbox_lastaction'] : $cookie_lightbox;
}
-
Yes it works!
Thanks a million :wink:, this MOD is really cool, and useful :idea:
Paul :)
-
Hello,
i have installed V1.2 from this Mod.
It works but when i close the Browser and come back the Pics are deleted from the Lightbox.
I have look that i have the cookie 4image_lightbox but i don´t have.
Now i have test V@no´s site and on this all works but i don´t have a cookie from V@no, too!!!
-
yeah no cookies being set, I have no clue why it doesnt save it into cookies...only in session.
-
oops...V@no...I did do the entire step 2.....I wasn't thinking and just read your older response. Again, I did the entire step 2, but get the error above.
thanks
-
strange, everything works just fine for me...exept download button ;)
to fix that, in lightboxes.php find: if (!empty($user_info['lightbox_image_ids']) && $user_info['user_level'] != GUEST) {
replace with: if (!empty($user_info['lightbox_image_ids'])) {
I applied this and now the download button is active in lighbox page.. working fine!
i have also applied Jan's mod http://www.4homepages.de/forum/index.php?topic=1861.msg19276#msg19276 for using gallery for documents... so when i press download from the detail page.. it download the document... but if I press download in lighbox page (to download selected items).. it is downloading the images and not the documents in zip file... what should i MOD so that even in the lighbox.php page too my guest can download the selected documents
Thanks :D
-
yeah no cookies being set, I have no clue why it doesnt save it into cookies...only in session.
Ist das nicht ein Problem?
Wenn ich nicht eingeloggt bin und einige Bilder als Gast LightBox mache, kommt nicht in meine Lightbox wenn ich gleichzeitig einlogge.
zum Beispiel!
Ich lege ein Paar Bilder als Gast in meine Light Box und dann logge ich mich ein, aber meine ausgewählte Bilder kommen nicht in meine Light Box!
Thanks V@no for the MOD 8)
m.a
-
hi,
i do all the mods and it works fine, i can select the image with the lightbox-button.
(i've removed the users window from the left and added the lightbox link (<a href="{url_lightbox}">{lang_lightbox}</a>)in the template/details. html)
but when i hit the lightbox link to show the lightbox i get only a blank page with nothing in it, no error message nothing. . .
what can i do?
best,
chris
-
You must have made a mistake while edited lightbox.php
to see the errors in global.php find line with error_reporting
add below:
error_reporting(E_ALL);
@ini_set("display_errors", 1);
-
my 4image ver is 1.7.10 and i do not find and replace step 2.2 :roll:
-
Added step 2.2b
-
Doesn't work how?
-
how to enable download button? (zip file)
please check travelwallpaper.tk