<?php
/*
+ ----------------------------------------------------------------------------------------------------+
|        e107 website system 
|        Plugin Ajax File: e107_plugins/lightbox/ajax_bb.php
|        Email: support@free-source.net
|        $Revision: 372 $
|        $Date: 2007-02-12 23:22:29 +0200 (Mon, 12 Feb 2007) $
|        $Author: secretr $
|        Copyright Corllete Lab ( http://www.clabteam.com ) under GNU GPL License (http://gnu.org)
|        Support Sites : http://www.free-source.net/ | http://dev.e107bg.org/
+----------------------------------------------------------------------------------------------------+
*/
require_once("../../class2.php");
header("Content-Type: text/html; charset=".CHARSET);

$lan_file = e_PLUGIN."lightbox/languages/".e_LANGUAGE.".php";
include_lan($lan_file);

require_once(e_HANDLER."form_handler.php");
if($pref['lightb_window']) {
    if(check_class($pref['lightb_wperms'])) {
        echo "
        <div id='lb-uform' style='width: 100%; text-align: center; margin-top: 20px; display: block'>
    	<form method='post' action='".e_SELF."'>
    	<table class='fborder' style='width:96%'>
    	<tr>
    		<td class='fcaption' colspan='2' style='padding: 5px'>".(check_class($pref['lightb_advwperms']) ? "<a href='#' onclick='expandit(\"lb-uform\"); expandit(\"lb-aform\"); return false;'>".LB_LAN_40."</a> &raquo;" : '&nbsp;')."</td>
    	</tr>
    	<tr>
    		<td class='forumheader3' style='padding: 5px'>".LB_LAN_28."</td>
    		<td class='forumheader3' style='padding: 5px'>".form::form_text('lb_img', '40', 'http://', 250)."</td>
    	</tr>
    	<tr>
    		<td class='forumheader3' style='padding: 5px'>".LB_LAN_29."</td>
    		<td class='forumheader3' style='padding: 5px'>".form::form_text('lb_thimg', '40', '', 250)."</td>
    	</tr>
    	<tr>
    		<td class='forumheader3' style='padding: 5px'>".LB_LAN_29a."</td>
    		<td class='forumheader3' style='padding: 5px'>".form::form_text('lb_thtext', '40', '', 250)."</td>
    	</tr>
    	<tr>
    		<td class='forumheader3' style='padding: 5px'>".LB_LAN_30."</td>
    		<td class='forumheader3' style='padding: 5px'>".form::form_text('lb_title', '40', '', 250)."</td>
    	</tr>
    	<tr>
    		<td class='forumheader3' style='padding: 5px'>".LB_LAN_31."</td>
    		<td class='forumheader3' style='padding: 5px'>".form::form_text('lb_group', '40', '', 250)."</td>
    	</tr>
    	<tr>
    		<td class='forumheader3' style='padding: 5px'>".LB_LAN_32."</td>
    		<td class='forumheader3' style='padding: 5px'>
            ".form::form_select_open('lb_float')."
    		".form::form_option('', true, '')."
    		".form::form_option(LB_LAN_33, false, 'left')."
    		".form::form_option(LB_LAN_34, false, 'right')."
    		".form::form_select_close()."
    		</td>
    	</tr>
    	<tr>
    		<td class='fcaption' colspan='2' style='text-align: left; padding: 3px 5px'>
                ".form::form_button('button', 'lb_bbinsert', LB_LAN_7, "onclick='if(addLightbox(\"default\")) Windows.closeAll();'")."
                ".form::form_button('button', 'lb_bbcancel', LB_LAN_8, "onclick='Windows.closeAll()'")."
            </td>
    	</tr>
    	</table>
    	</form>
    	</div>
        ";

        if(check_class($pref['lightb_advwperms'])) { //other permissions!
            //imgselectors - destination images
            $parms = "name=lb_imgsel";
            //array params
    		$parms .= "&path[]=".e_IMAGE.'newspost_images/';//news
    		$parms .= "&path[]=".e_FILE.'downloadimages/';//downloads
    		$parms .= "&path[]=".e_FILE.'public/';//public
    		$parms .= "&path[]=".e_IMAGE.'custom/';//custom
    		/* httpath example:
            $parms .= "&htpath[]=".e_IMAGE_ABS.'newspost_images/';//news
    		$parms .= "&htpath[]=".e_FILE_ABS.'downloadimages/';//downloads
    		$parms .= "&htpath[]=".e_FILE_ABS.'public/';//public*/

    		$parms .= "&label[]=".LB_LAN_42;//news
    		$parms .= "&label[]=".LB_LAN_43;//downloads
    		$parms .= "&label[]=".LB_LAN_44;//public
    		$parms .= "&label[]=".LB_LAN_45;//custom
    		//array params end
    		$parms .= "&default=".e_IMAGE_ABS."generic/blank.gif";
    		$parms .= "&float=left";
    		$parms .= "&width=60px";
    		$parms .= "&height=60px";
    		$parms .= "&multiple=TRUE";

            $lbimg = $tp->parseTemplate("{LB_IMAGESELECTOR={$parms}}");
            
            //imgselectors - thumb images
            $parms = "name=lb_thimgsel";
            //array params
    		$parms .= "&path[]=".e_IMAGE.'newspost_images/';//news
    		$parms .= "&path[]=".e_FILE.'downloadthumbs/';//downloads
    		$parms .= "&path[]=".e_FILE.'public/';//public
    		$parms .= "&path[]=".e_IMAGE.'custom/';//custom
    		
    		$parms .= "&label[]=".LB_LAN_42;//news
    		$parms .= "&label[]=".LB_LAN_43a;//downloads
    		$parms .= "&label[]=".LB_LAN_44;//public
    		$parms .= "&label[]=".LB_LAN_45;//custom
    		//array params end
    		$parms .= "&default=".e_IMAGE_ABS."generic/blank.gif";
    		$parms .= "&float=left";
    		$parms .= "&width=60px";
    		$parms .= "&height=60px";
    		$parms .= "&multiple=TRUE";

            $lbthimg = $tp->parseTemplate("{LB_IMAGESELECTOR={$parms}}");
            //admin options
            echo "
                 <div id='lb-aform' style='width: 100%; text-align: center; margin-top: 20px; display: none'>
                    <form method='post' action='".e_SELF."'>
                	<table class='fborder' style='width:96%'>
                	<tr>
                		<td class='fcaption' colspan='2' style='padding: 5px'>&laquo; <a href='#' onclick='expandit(\"lb-uform\"); expandit(\"lb-aform\"); return false;'>".LB_LAN_41."</a></td>
                	</tr>
                	<tr>
                		<td class='forumheader3' style='padding: 5px;width: 30%;'>".LB_LAN_28."</td>
                        <td class='forumheader3' style='padding: 5px;width: 60%;padding: 5px'>
                            {$lbimg}
                        </td>
                	</tr>
                	<tr>
                		<td class='forumheader3' style='padding: 5px'>".LB_LAN_29."</td>
                		<td class='forumheader3' style='padding: 5px'>
                            {$lbthimg}
                        </td>
                	</tr>
                	<tr>
                		<td class='forumheader3' style='padding: 5px'>".LB_LAN_29a."</td>
                		<td class='forumheader3' style='padding: 5px'>".form::form_text('lb_athtext', '40', '', 250)."</td>
                	</tr>
                	<tr>
                		<td class='forumheader3' style='padding: 5px'>".LB_LAN_30."</td>
                		<td class='forumheader3' style='padding: 5px'>".form::form_text('lb_atitle', '40', '', 250)."</td>
                	</tr>
                	<tr>
                		<td class='forumheader3' style='padding: 5px'>".LB_LAN_31."</td>
                		<td class='forumheader3' style='padding: 5px'>".form::form_text('lb_agroup', '40', '', 250)."</td>
                	</tr>
                	<tr>
                		<td class='forumheader3' style='padding: 5px'>".LB_LAN_32."</td>
                		<td class='forumheader3' style='padding: 5px'>
                        ".form::form_select_open('lb_afloat')."
                		".form::form_option('', true, '')."
                		".form::form_option(LB_LAN_33, false, 'left')."
                		".form::form_option(LB_LAN_34, false, 'right')."
                		".form::form_select_close()."
                		</td>
                	</tr>
                	<tr>
                		<td class='fcaption' colspan='2' style='text-align: left; padding: 3px 5px'>
                            ".form::form_button('button', 'lb_abbinsert', LB_LAN_7, "onclick='if(addLightbox(\"advanced\")) Windows.closeAll();'")."
                            ".form::form_button('button', 'lb_abbcancel', LB_LAN_8, "onclick='Windows.closeAll()'")."
                        </td>
                	</tr>
                	</table>
                	</form>
                 </div>
            ";
        }
    } else {
        echo LB_LAN_38;
    }
}
$page = ob_get_clean();
$etag = md5($page);
header("Cache-Control: must-revalidate");
header("ETag: {$etag}");
header("Content-Length: ".strlen($page), true);
echo $page;
?>