<?php
/*
###################################################################################
  Bigware Shop 2.3
  Release Datum: 23.08.2015
  
  Bigware Shop
  http://www.bigware.de

  Copyright (c) 2015 Bigware LTD
  (c) 2000-2001 The Exchange Project  (earlier name of osCommerce)
  (c) 2015	Bigware LTD

  Copyrightvermerke duerfen nicht entfernt werden.
  ------------------------------------------------------------------------
  Dieses Programm ist freie Software. Sie koennen es unter den Bedingungen
  der GNU General Public License, wie von der Free Software Foundation
  veroeffentlicht, weitergeben und/oder modifizieren, entweder gemaess Version 2 
  der Lizenz oder (nach Ihrer Option) jeder spaeteren Version.
  Die Veroeffentlichung dieses Programms erfolgt in der Hoffnung, dass es Ihnen
  von Nutzen sein wird, aber OHNE IRGENDEINE GARANTIE, sogar ohne die
  implizite Garantie der MARKTREIFE oder der VERWENDBARKEIT FUER EINEN
  BESTIMMTEN ZWECK. Details finden Sie in der GNU General Public License.
  
  Sie sollten eine Kopie der GNU General Public License zusammen mit diesem
  Programm erhalten haben. Falls nicht, schreiben Sie an die Free Software
  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.

  Infos:
  ------------------------------------------------------------------------
  Der Bigware Shop wurde vor vielen Jahren bereits aus dem bekannten Shopsystem osCommerce
  weiter- und neuentwickelt.
  Der Bigware Shop legt im hohen Masse Wert auf Bedienerfreundlichkeit, beinhaltet eine leichte
  Installation, viele neue professionelle Werkzeuge und zeichnet sich aus durch eine grosse 
  Community, die bei Problemen weiterhelfen kann.
  
  Der Bigware Shop ist auf jedem System lauffaehig, welches eine PHP Umgebung
  (ab PHP 4.1.3) und mySQL zur Verfuegung stellt und auf Linux basiert.
 
  Hilfe erhalten Sie im Forum auf www.bigware.de 
  
  -----------------------------------------------------------------------
  
 ##################################################################################




*/
?>
<?php
require('load_this/load_bigware_11.php');
require(FOLDER_RELATIV_INFOPAGES . "lang/" . $language . '/' . 'infopages.php');
function browse_infopages () {
global $language;
	$query="SELECT * FROM " . DB_TBL_INFOPAGES . " WHERE language='$language' ORDER BY v_order";
	$daftar = go_db_db_query(DB_DATABASE, $query) or die("Infopages ERROR: ".go_db_error());$c=0;
	while ($buffer = go_db_fetch_array($daftar)) {$result[$c]=$buffer;$c++;}
return $result;
}
function data_read ($infopages_id) {
	$result=go_db_fetch_array(go_db_db_query(DB_DATABASE, "SELECT * FROM " . DB_TBL_INFOPAGES . " WHERE infopages_id=$infopages_id"));
return $result;
}
$warning=go_picture(FOLDER_RELATIV_INFOPAGES . 'picture/icons/warning.gif', WARNING_INFOPAGES); 
function oops_message($error) {
	global $warning;
	switch ($error) {
		case "20":return "<tr class=MessageStackWrong><td>$warning ." . ERROR_20_INFOPAGES . "</td></tr>";break;
		case "80":return "<tr class=MessageStackWrong><td>$warning " . ERROR_80_INFOPAGES . "</td></tr>";break;
		default:return $error;
	}
}
?>
<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
<html <?php echo HTML_PARAMS; ?>>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
<title><?php echo TITLE; ?></title>
<link rel="stylesheet" type="text/css" href="load_this/style.css">
<script language="javascript" src="load_this/menu.js"></script>
</head>
<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" bgcolor="#FFFFFF">
<!-- header //-->
<?php require(FOLDER_RELATIV_INCLUDES . 'load_bigware_9.php'); ?>
<!-- header_eof //-->
<!-- body //-->
<table border="0" width="100%" cellspacing="2" cellpadding="2">
  <tr>
    <td width="<?php echo FRAME_WIDTH; ?>" valign="top">
<!-- left_navigation //-->
<!-- left_navigation_eof //-->
</td>
<!-- body_text //-->
    <td width="100%" valign="top">
<table border=0 width="100%">
<tr><td align=right><?php echo $language; ?></td></tr>
<?php 
switch($adgrafics_infopages) {
case "Added":
		$data=browse_infopages();
 		$no=1;
		 if (sizeof($data) > 0) {while (list($key, $val)=each($data)) {$no++; }	} ;
		$title="" . ADD_QUEUE_INFOPAGES . " #$no";
		echo go_fetch_form('',NAME_OF_FILE_INFOPAGES_MANAGER, 'adgrafics_infopages=AddSure');
		include('main_bigware_59.php');
	break;
case "AddSure":
	function add_infopages ($data) {
	global $language;
	$query ="INSERT INTO " . DB_TBL_INFOPAGES . " VALUES(null, '$data[visible]', '$data[v_order]', '$data[info_title]', '$data[description]','$language')";
	go_db_db_query(DB_DATABASE, $query) or die ("Infopages ERROR: ".go_db_error());
	}
		if ($v_order && $info_title && $description) {
		if ((INT)$v_order) {
		add_infopages($_POST);
		$data=browse_infopages();
		$title="" . go_picture(FOLDER_RELATIV_INFOPAGES . '/picture/icons/confirm_red.gif', CONFIRM_INFOPAGES) .SUCCED_INFOPAGES . ADD_QUEUE_INFOPAGES . " $v_order ";
		include('main_bigware_60.php');
		} else {$error="20";}
		} else {$error="80";}
	break;
case "Edit":
		if ($infopages_id) {
		$change=data_read($infopages_id);
		$data=browse_infopages();
		$button=array("Update");
		$title="" . CHANGE_ID_INFOPAGES . " $infopages_id"; 
		echo go_fetch_form('',NAME_OF_FILE_INFOPAGES_MANAGER, 'adgrafics_infopages=Update');
		echo go_fetch_hidden_field('infopages_id', "$infopages_id");
		include('main_bigware_59.php');
		} else {$error="80";}
	break;
case "Update":
	function update_infopages ($data) {
	go_db_db_query(DB_DATABASE, "UPDATE " . DB_TBL_INFOPAGES . " SET info_title='$data[info_title]', description='$data[description]', visible='$data[visible]', v_order=$data[v_order] WHERE infopages_id=$data[infopages_id]") or die ("update_infopages: ".go_db_error());
	}
		if ($infopages_id && $description && $v_order) {
		if ((INT)$v_order) {
		update_infopages($_POST);
		$data=browse_infopages();
		$title="$confirm " . UPDATE_ID_INFOPAGES . " $infopages_id " . SUCCED_INFOPAGES . "";
		include('main_bigware_60.php');
		} else {$error="20"; } 
		} else {$error="80";}
	break;
      case 'Visible':
	function go_set_infopages_visible($infopages_id, $visible) {
	if ($visible == '1') {
	return go_db_query("update " . DB_TBL_INFOPAGES . " set visible = '0' where infopages_id = '" . $infopages_id . "'");
	} else{
	return go_db_query("update " . DB_TBL_INFOPAGES . " set visible = '1' where infopages_id = '" . $infopages_id . "'");
	} 
	}
		go_set_infopages_visible($infopages_id, $visible);
		$data=browse_infopages();
		if ($visible == '1') {	$vivod=DEACTIVATION_ID_INFOPAGES;
		}else{$vivod=ACTIVATION_ID_INFOPAGES;}
		$title="$confirm $vivod $infopages_id " . SUCCED_INFOPAGES . "";
		include('main_bigware_60.php');
        break;
case "Delete":
		if ($infopages_id) {
		$delete=data_read($infopages_id);
		$data=browse_infopages();
		$title="" . DELETE_CONFITMATION_ID_INFOPAGES . " $infopages_id";
		echo "<tr class=pageGeneralsign><td>$title  </td></tr>";
		echo "<tr><td>" . TITLE_INFOPAGES . " $delete[info_title]</td></tr><tr><td align=right>";
		echo go_fetch_form('',NAME_OF_FILE_INFOPAGES_MANAGER, "adgrafics_infopages=DelSure&infopages_id=$val[infopages_id]");
		echo go_fetch_hidden_field('infopages_id', "$infopages_id");
		echo go_picture_submit('button_delete.gif', PICTURE_DELETE);
		echo '<a href="' . go_href_link(NAME_OF_FILE_INFOPAGES_MANAGER, '', 'NONSSL') . '">' . go_picture_button('button_cancel.gif', PICTURE_CANCEL) . '</a>';
		echo "</form></td></tr>";
		} else {$error="80";}
		break;
case "DelSure":
	function delete_infopages ($infopages_id) {
	go_db_db_query(DB_DATABASE, "DELETE FROM " . DB_TBL_INFOPAGES . " WHERE infopages_id=$infopages_id");
	}
		if ($infopages_id) {
		delete_infopages($infopages_id);
		$data=browse_infopages();
		$title="$confirm " . DELETED_ID_INFOPAGES . " $infopages_id " . SUCCED_INFOPAGES . "";
		include('main_bigware_60.php');
		} else {$error="80";}
		break;
default:
		$data=browse_infopages();
		$title="" . MANAGER_INFOPAGES . "";
		include('main_bigware_60.php');
	}
if ($error) {
		$content=oops_message($error);
		echo $content;
		$data=browse_infopages();
 		$no=1;
		 if (sizeof($data) > 0) {while (list($key, $val)=each($data)) {$no++; }	} ;
		$title="" . ADD_QUEUE_INFOPAGES . " $no";
		echo go_fetch_form('',NAME_OF_FILE_INFOPAGES_MANAGER, 'adgrafics_infopages=AddSure');
		include('main_bigware_59.php');
}
?>
</table>
</td>
<!-- body_text_eof //-->
  </tr>
</table>
<!-- body_eof //-->
<!-- footer //-->
<?php require(FOLDER_RELATIV_INCLUDES . 'load_bigware_7.php'); ?>
<!-- footer_eof //-->
<br>
</body>
</html>
<?php require(FOLDER_RELATIV_INCLUDES . 'load_bigware_6.php'); ?>