4images Forum & Community

4images Issues / Ausgaben => Feedback & Suggestions => Topic started by: thunderstrike on August 14, 2007, 02:30:01 PM

Title: [FIX] - lightbox.php - delete link
Post by: thunderstrike on August 14, 2007, 02:30:01 PM
In lightbox.php file,

find:

Quote
"lang_delete_lightbox" => $lang['delete_lightbox'],
"url_delete_lightbox" => $site_sess->url(ROOT_PATH."lightbox.php?action=clearlightbox"),

replace:

Quote
"url_delete_lightbox" => (isset($num_rows) && $num_rows > 0) ? $site_sess->url(ROOT_PATH."lightbox.php?action=clearlightbox") : 0,
"num_rows" => (isset($num_rows) && $num_rows > 0) ? (int)$num_rows : 0,

In includes/page_header.php file,

find:

Quote
$msg = (clear_lightbox()) ? $lang['lightbox_delete_success'] : $lang['lightbox_delete_error'];

replace:

Quote
$msg = (isset($HTTP_POST_VARS['num_rows']) && $HTTP_POST_VARS['num_rows'] > 0 && clear_lightbox()) ? $lang['lightbox_delete_success'] : redirect($url);

In templates/your_template/lightbox.html file,

find:

Quote
<script language="JavaScript">
                    function clearlightbox() {
                        if (confirm('{lang_delete_lightbox_confirm}')) {
                         location.href = "{url_delete_lightbox}";
                        }
                       }
                    </script>
                        <a href="javascript:clearlightbox()"><b>{lang_delete_lightbox}</b></a>

replace:

Quote
{if num_rows}
                        <script language="JavaScript">
                    function clearlightbox() {
                        if (confirm('{lang_delete_lightbox_confirm}')) {
                         location.href = "{url_delete_lightbox}";
                        }
                       }
                    </script>
                        <form method="post" action="{url_delete_lightbox}">
                        <input type="hidden" name="action" value="clearlightbox">
                        <input type="hidden" name="num_rows" value="{num_rows}">
                        <input type="image" src="{template_image_url}/delete_lightbox.gif" onClick="javascript:clearlightbox()" />
                        </form>
                        {endif num_rows}

Thank to Mawenzi for draw button:

http://www.4homepages.de/forum/index.php?topic=18408.msg98456#msg98456

No show delete lightbox button if quant is 0 + chek for user try to use URL for delete. If num_rows no find, redirect to index.php file. ;)
Title: Re: [FIX] - lightbox.php - delete link
Post by: mawenzi on August 14, 2007, 02:46:54 PM
@thunderstrike
... the fix works perfect ... thanks ...
@all
... you can use that fix in 4images version 1.7.0 - 1.7.4 ...
Title: Re: [FIX] - lightbox.php - delete link
Post by: thunderstrike on August 14, 2007, 02:49:03 PM
Thank Mawenzi.

Suggestion: Use POST form + image button so no URL can use for user. ;)
Title: Re: [FIX] - lightbox.php - delete link
Post by: thunderstrike on August 14, 2007, 04:39:38 PM
1st topic update. ;)
Title: Re: [FIX] - lightbox.php - delete link
Post by: thunderstrike on August 14, 2007, 11:46:12 PM
No ide german is diff . . . thank for post.
Title: Re: [FIX] - lightbox.php - delete link
Post by: mawenzi on August 15, 2007, 12:29:42 AM
@ivan / @all
... I think a better solution is ...
... if you have no different template/images folder or use german lanuage version ...
... use {template_image_url} instead of {template_lang_image_url} ...
Title: Re: [FIX] - lightbox.php - delete link
Post by: thunderstrike on August 15, 2007, 12:32:53 AM
Done !
Title: Re: [FIX] - lightbox.php - delete link
Post by: kai on August 16, 2007, 01:38:40 PM
@ thunderstrike: Thanks for the quick fix.
Title: Re: [FIX] - lightbox.php - delete link
Post by: thunderstrike on August 16, 2007, 01:44:25 PM
@Kai: Is move to fix place in forum ? :)

http://www.4homepages.de/forum/index.php?board=17.0
Title: Re: [FIX] - lightbox.php - delete link
Post by: thunderstrike on August 16, 2007, 08:05:39 PM
Is no ... what did ? Same 1st post ... :|

axcept: <input type="submit" name="lightbox_button" class="button" id="lightbox_button" onClick="javascript:clearlightbox()" value="{lang_delete_lightbox}" />
Title: Re: [FIX] - lightbox.php - delete link
Post by: thunderstrike on August 16, 2007, 08:13:56 PM
Only 1 line change ... rest is same!
Title: Re: [FIX] - lightbox.php - delete link
Post by: thunderstrike on August 16, 2007, 08:25:37 PM
Should target destination ...  browser use ?
Title: Re: [FIX] - lightbox.php - delete link
Post by: thunderstrike on August 16, 2007, 08:38:56 PM
I no change JS code ... use same from ZIP lightbox.html file ... JS error ?
Title: Re: [FIX] - lightbox.php - delete link
Post by: thunderstrike on August 16, 2007, 08:46:39 PM
No get ... JS code say: if confirm ... if no .. should no clear ...
Title: Re: [FIX] - lightbox.php - delete link
Post by: thunderstrike on August 16, 2007, 08:49:55 PM
I mean ... no reproduce ...
Title: Re: [FIX] - lightbox.php - delete link
Post by: thunderstrike on August 16, 2007, 10:39:58 PM
In german + code repost ... no get.