<?php
/*
+---------------------------------------------------------------+
|        Floating Logo Menu v1.00 - by Barry
|
|        v1.00
|
|        This module for the e107 .7+ website system
|        Copyright Steve Dunstan 2001-2002
|        http://e107.org
|        jalist@e107.org
|
|        Released under the terms and conditions of the
|        GNU General Public License (http://gnu.org).
|
+---------------------------------------------------------------+
*/

require_once("../../class2.php");
if (!getperms("P"))
{
    header("location:" . e_HTTP . "index.php");
    exit;
}
require_once(e_ADMIN . "auth.php");

if (e_LANGUAGE != "English" && file_exists(e_PLUGIN . "floating_logo/languages/admin/" . e_LANGUAGE . ".php"))
{
    include_once(e_PLUGIN . "floating_logo/languages/admin/" . e_LANGUAGE . ".php");
}
else
{
    include_once(e_PLUGIN . "floating_logo/languages/admin/English.php");
}
if (isset($_POST['update']))
{
    // Update rest
    // $pref['flogo_height'] = $tp->toDB($_POST['flogo_height']);
    // $pref['flogo_width'] = $tp->toDB($_POST['flogo_width']);
    // get logo size
    $flogo_size = getimagesize(e_PLUGIN . "floating_logo/logos/" . $_POST['flogo_logo']);
    $pref['flogo_logo'] = $tp->toDB($_POST['flogo_logo']);

    $pref['flogo_height'] = $flogo_size[1];
    $pref['flogo_width'] = $flogo_size[0];
    $pref['flogo_link'] = $tp->toDB($_POST['flogo_link']);
    $pref['flogo_alt'] = $tp->toDB($_POST['flogo_alt']);
    $pref['flogo_duration'] = $tp->toDB($_POST['flogo_duration']);
    $pref['flogo_Hoffset'] = $tp->toDB($_POST['flogo_Hoffset']);
    $pref['flogo_location'] = $tp->toDB($_POST['flogo_location']);
    $pref['flogo_Voffset'] = $tp->toDB($_POST['flogo_Voffset']);
    save_prefs();
    $flogo_msgtext = "<tr><td class='forumheader3' colspan='2'><strong>" . FLOGO_A2 . "</strong></td></tr>";
}
// get file list
require_once(e_HANDLER . "file_class.php");
$snow_fl = new e_file;

$flogo_list = $snow_fl->get_files(e_PLUGIN . "floating_logo/logos/", '');

$flogo_text .= "<form method='post' action='" . e_SELF . "' id='snowform'>
<table class='fborder' width='97%'>
<tr><td class='fcaption' colspan='2'><strong>" . FLOGO_A3 . "</strong></td></tr>
$flogo_msgtext
<tr>
<td style='width:30%' class='forumheader3'>" . FLOGO_A4 . "</td>
<td style='width:70%' class='forumheader3'>
		<input class='tbox' type='text' id='flogo_logo' name='flogo_logo' size='60' value='" . $tp->toFORM($pref['flogo_logo']) . "' maxlength='100' /><br />";

foreach($flogo_list as $flogo_logo)
{
    $flogo_text .= "<a href=\"javascript:insertext('" . $flogo_logo['fname'] . "','flogo_logo','newsicn')\"><img src='" . $flogo_logo['path'] . $flogo_logo['fname'] . "' style='border:0' alt='' /></a> ";
}

$flogo_text .= "</td></tr>";
// $flogo_text .= "
// <tr>
// <td style='width:30%' class='forumheader3'>" . FLOGO_A5 . "</td>
// <td style='width:70%' class='forumheader3'><input class='tbox' type='text'  size='10' name='flogo_height' value='" . $tp->toFORM($pref['flogo_height']) . "' /></td>
// </tr>";
// $flogo_text .= "
// <tr>
// <td style='width:30%' class='forumheader3'>" . FLOGO_A6 . "</td>
// <td style='width:70%' class='forumheader3'><input class='tbox' type='text'  size='10' name='flogo_width' value='" . $tp->toFORM($pref['flogo_width']) . "' /></td>
// </tr>";
$flogo_text .= "
<tr>
<td style='width:30%' class='forumheader3'>" . FLOGO_A7 . "</td>
<td style='width:70%' class='forumheader3'><input class='tbox' type='text'  size='80%' name='flogo_link' value='" . $tp->toFORM($pref['flogo_link']) . "' /></td>
</tr>";
$flogo_text .= "
<tr>
<td style='width:30%' class='forumheader3'>" . FLOGO_A8 . "</td>
<td style='width:70%' class='forumheader3'><input class='tbox' type='text'  size='50%' name='flogo_alt' value='" . $tp->toFORM($pref['flogo_alt']) . "' /></td>
</tr>";

$flogo_text .= "
<tr>
<td style='width:30%' class='forumheader3'>" . FLOGO_A9 . "</td>
<td style='width:70%' class='forumheader3'><input class='tbox' type='text'  size='10' name='flogo_duration' value='" . $tp->toFORM($pref['flogo_duration']) . "' /></td>
</tr>";
$flogo_text .= "
<tr>
<td style='width:30%' class='forumheader3'>" . FLOGO_A10 . "</td>
<td style='width:70%' class='forumheader3'>
<input class='tbox' type='radio'  name='flogo_location' value='cn' " .
($pref['flogo_location'] == 'cn'?"checked='checked'":'') . " /> " . FLOGO_A20 . "<br />
<input class='tbox' type='radio'  name='flogo_location' value='ul' " .
($pref['flogo_location'] == 'ul'?"checked='checked'":'') . " /> " . FLOGO_A11 . "<br />
<input class='tbox' type='radio'  name='flogo_location' value='ur' " .
($pref['flogo_location'] == "ur"?"checked='checked'":'') . " />" . FLOGO_A13 . "<br />
<input class='tbox' type='radio'  name='flogo_location' value='ll' " .
($pref['flogo_location'] == "ll"?"checked='checked'":'') . " />" . FLOGO_A12 . "<br />
<input class='tbox' type='radio'  name='flogo_location' value='lr' " .
($pref['flogo_location'] == "lr"?"checked='checked'":'') . " />" . FLOGO_A14 . "
</td>
</tr>";

$flogo_text .= "
<tr>
<td style='width:30%' class='forumheader3'>" . FLOGO_A15 . "</td>
<td style='width:70%' class='forumheader3'><input class='tbox' type='text'  size='10' name='flogo_Hoffset' value='" . $tp->toFORM($pref['flogo_Hoffset']) . "' /></td>
</tr>";
$flogo_text .= "
<tr>
<td style='width:30%' class='forumheader3'>" . FLOGO_A16 . "</td>
<td style='width:70%' class='forumheader3'><input class='tbox' type='text'  size='10' name='flogo_Voffset' value='" . $tp->toFORM($pref['flogo_Voffset']) . "' /></td>
</tr>";
$flogo_text .= "
<tr>
<td colspan='2' class='fcaption' style='text-align: left;'><input type='submit' name='update' value='" . FLOGO_A17 . "' class='button' />\n
</td>
</tr></table></form>";

$ns->tablerender(FLOGO_A1, $flogo_text);

require_once(e_ADMIN . "footer.php");
