<?php
// www.bcoos.net 2006-09 1.0.2 GPL
// $Id: main.php,v 1.5 2003/07/13 05:59:39 half-dead Exp $
// ------------------------------------------------------------------------- //
//               E-Xoops: Content Management for the Masses                  //
//                       < http://www.e-xoops.com >                          //
// ------------------------------------------------------------------------- //
// Original Author: Kazumi Ono
// Author Website : http://www.mywebaddons.com/ , http://www.myweb.ne.jp
// License Type   : GPL: See /manual/LICENSES/GPL.txt
// ------------------------------------------------------------------------- //
if ( !preg_match("/admin\.php/i", _PHP_SELF) ) {
	exit();
	}
include (XOOPS_ROOT_PATH."/modules/system/admin/blocksadmin/blocksadmin.php");
$op = "list";
if ( isset($_POST) ) {
	foreach ( $_POST as $k => $v ) {
		$$k = $v;
 	}
}
if ( isset($_GET['op']) ) {
	if ( $_GET['op'] == "edit" || $_GET['op'] == "delete" || $_GET['op'] == "delete_ok" ) {
		$op = $_GET['op'];
		$bid = $_GET['bid'];
	}
}
if ( $op == "list" ) {
	xoops_cp_header();
	list_blocks();
	xoops_cp_footer();
	exit();
}
if ( $op == "order" ) {
	$size = count($bid);
	for ( $i = 0; $i < $size; $i++ ) {
		if ( $oldweight[$i] != $weight[$i] || $oldvisible[$i] != $visible[$i] || $oldside[$i] != $side[$i] )
		order_block($bid[$i], $weight[$i], $visible[$i], $side[$i]);
	}
	redirect_header("admin.php?fct=blocksadmin",1,_UPDATED);
	exit();
}
if ( $op == "save" ) {
	save_block($bside, $bweight, $bvisible, $btitle, $bcontent, $bctype);
	exit();
}
if ( $op == "update" ) {
	update_block($bid, $bside, $bweight, $bposition, $bvisible, $btitle, $bcontent, $bctype, $options);
	exit();
}
if ( $op == "delete_ok" ) {
	delete_block_ok($bid);
	exit();
}
if ( $op == "delete" ) {
	xoops_cp_header();
	delete_block($bid);
	xoops_cp_footer();
	exit();
}
if ( $op == "edit" ) {
	xoops_cp_header();
	edit_block($bid);
	xoops_cp_footer();
	exit();
}
if ( $op == "preview" ) {
	xoops_cp_header();
	preview_cblock($bid, $btitle, $bcontent, $bctype, $bposition, $options);
	edit_block($bid, $op);
	xoops_cp_footer();
	exit();
}
?>
