<?php
if (!eregi("admin.php", $PHP_SELF)) die("Access Denied"); 
include (XOOPS_ROOT_PATH."/modules/system/admin/blocksadmin/blocksadmin.php");
$op = "list";
if ( isset($HTTP_POST_VARS) ) {
	foreach ( $HTTP_POST_VARS as $k => $v ) {
		$$k = $v;
  	}
}

if ( isset($HTTP_GET_VARS['op']) ) {
	if ( $HTTP_GET_VARS['op'] == "edit" || $HTTP_GET_VARS['op'] == "delete" || $HTTP_GET_VARS['op'] == "delete_ok" ) {
		$op = $HTTP_GET_VARS['op'];
		$bid = $HTTP_GET_VARS['bid'];
	}
}

if ( $op == "list" ) {
	xoops_cp_header();
      	list_blocks();
      	xoops_cp_footer();
	exit();
}

if ( $op == "order" ) {
	$size = sizeof($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,_AM_DBUPDATED);
	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();
}

?>