<?php
/*
editf.php
phpRechnung - is easy-to-use Web-based multilingual accounting software.
Copyright (C) 2001 - 2008 Edy Corak < phprechnung at ecorak dot net >
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
require_once("../include/phprechnung.inc.php");
require_once("../include/smarty.inc.php");
CheckUser();
CheckAdminGroup1();
CheckSession();
if(isset($_POST['settingID']))
{
$settingID = $_POST['settingID'];
}
if(isset($_POST['page']))
{
$page = $_POST['page'];
}
if(isset($_POST['Order']))
{
$Order = $_POST['Order'];
}
if(isset($_POST['Sort']))
{
$Sort = $_POST['Sort'];
}
if(isset($_POST['PrintCompanyData']))
{
$PrintCompanyData = $_POST['PrintCompanyData'];
}
if(isset($_POST['PrintPositionName']))
{
$PrintPositionName = $_POST['PrintPositionName'];
}
if(isset($_POST['CompanyLogo']))
{
$CompanyLogo = $_POST['CompanyLogo'];
}
if(isset($_POST['CompanyLogoWidth']))
{
$CompanyLogoWidth = $_POST['CompanyLogoWidth'];
}
if(isset($_POST['CompanyLogoHeight']))
{
$CompanyLogoHeight = $_POST['CompanyLogoHeight'];
}
if(isset($_POST['EmailInternal']))
{
$EmailInternal = $_POST['EmailInternal'];
}
if(isset($_POST['EmailUseSignature']))
{
$EmailUseSignature = $_POST['EmailUseSignature'];
}
if(isset($_POST['EmailSignature']))
{
$EmailSignature = strip_tags($_POST['EmailSignature']);
}
if(isset($_POST['StockActive']))
{
$StockActive = $_POST['StockActive'];
}
if(isset($_POST['Reminder']))
{
$Reminder = $_POST['Reminder'];
}
if(isset($_POST['ReminderDays']))
{
$ReminderDays = $_POST['ReminderDays'];
}
if(isset($_POST['ReminderPrice']))
{
$ReminderPrice = ereg_replace(",", ".", $_POST['ReminderPrice']);
}
if(isset($_POST['EntrysPerPage']))
{
$EntrysPerPage = $_POST['EntrysPerPage'];
}
if(isset($_POST['SessionSec']))
{
$SessionSec = $_POST['SessionSec'];
}
// Database connection
//
DBConnect();
function UserInput($mark)
{
global $smarty, $settingID, $page, $PrintCompanyData, $PrintPositionName,
$CompanyLogo, $CompanyLogoWidth, $CompanyLogoHeight, $EmailInternal, $EmailUseSignature,
$EmailSignature, $StockActive, $Reminder, $ReminderDays,$ReminderPrice, $EntrysPerPage,
$SessionSec, $Order, $Sort;
$smarty->assign("settingID","$settingID");
$smarty->assign("page","$page");
$smarty->assign("PrintCompanyData","$PrintCompanyData");
$smarty->assign("PrintPositionName","$PrintPositionName");
$smarty->assign("CompanyLogo","$CompanyLogo");
$smarty->assign("CompanyLogoWidth","$CompanyLogoWidth");
$smarty->assign("CompanyLogoHeight","$CompanyLogoHeight");
$smarty->assign("EmailInternal","$EmailInternal");
$smarty->assign("EmailUseSignature","$EmailUseSignature");
$smarty->assign("EmailSignature","$EmailSignature");
$smarty->assign("StockActive","$StockActive");
$smarty->assign("Reminder","$Reminder");
$smarty->assign("ReminderDays","$ReminderDays");
$smarty->assign("ReminderPrice","$ReminderPrice");
$smarty->assign("EntrysPerPage","$EntrysPerPage");
$smarty->assign("SessionSec","$SessionSec");
$smarty->assign("Order","$Order");
$smarty->assign("Sort","$Sort");
$smarty->assign("Mark","$mark");
}
if ($EntrysPerPage < 25)
{
$smarty->assign("FieldError","$a[entrys_per_page] - $a[field_error]");
UserInput("EntrysPerPage");
$smarty->display('config/editf.tpl');
}
else if ($SessionSec < 120)
{
$smarty->assign("FieldError","$a[session_sec] - $a[field_error]");
UserInput("SessionSec");
$smarty->display('config/editf.tpl');
}
else
{
// $query = $db->Execute("UPDATE {$TBLName}setting SET PRINT_COMPANY_DATA='$PrintCompanyData', PRINT_POSITION_NAME='$PrintPositionName', COMPANY_LOGO='$CompanyLogo', COMPANY_LOGO_WIDTH='$CompanyLogoWidth', COMPANY_LOGO_HEIGHT='$CompanyLogoHeight', EMAIL_INTERNAL='$EmailInternal', EMAIL_USE_SIGNATURE='$EmailUseSignature', EMAIL_SIGNATURE='$EmailSignature', INVENTORY_CHECK_ACTIVE='$StockActive', REMINDER='$Reminder', REMINDER_DAYS='$ReminderDays', REMINDER_PRICE='$ReminderPrice', ENTRYS_PER_PAGE='$EntrysPerPage', SESSION_SEC='$SessionSec', MODIFIEDBY='$_SESSION[Username]' WHERE SETTINGID=$settingID");
$query = $db->Execute("UPDATE {$TBLName}setting SET PRINT_COMPANY_DATA='$PrintCompanyData', PRINT_POSITION_NAME='$PrintPositionName', COMPANY_LOGO='$CompanyLogo', COMPANY_LOGO_WIDTH='$CompanyLogoWidth', COMPANY_LOGO_HEIGHT='$CompanyLogoHeight', EMAIL_INTERNAL='$EmailInternal', EMAIL_USE_SIGNATURE='$EmailUseSignature', EMAIL_SIGNATURE='$EmailSignature', INVENTORY_CHECK_ACTIVE='2', REMINDER='$Reminder', REMINDER_DAYS='$ReminderDays', REMINDER_PRICE='0.00', ENTRYS_PER_PAGE='$EntrysPerPage', SESSION_SEC='$SessionSec', MODIFIEDBY='$_SESSION[Username]' WHERE SETTINGID=$settingID");
Header("Location: $web/config/list.php?page=$page&Order=$Order&Sort=$Sort&$sessname=$sessid#$settingID");
}
?>