<?php
/*
	[UCenter Home] (C) 2007-2008 Comsenz Inc.
	$Id: site_desktop_show_empty.php 10953 2009-01-12 02:55:37Z liguode $
*/

if(!defined('IN_UCHOME')) {
	exit('Access Denied');
}
@include_once(S_ROOT.'./data/site_config.php');
$list = $bar = $desktop = $share = $publish = array();
$cdtat_start = '****----****';
$cdtat_end = '####----####';
$arrow = '$';
$desktopId = 0;
$siteurl = 'http://www.ii888ii.com/';
if ( !empty($_SGLOBAL['supe_uid']) )
{
	if ( isset( $_GET['action'] ) && $_GET['action'] == 'save' )
	{
		$setarr = array(
			'bar_name' => addslashes($_POST['desktop_label'])
		);
		if( intval($_GET['desktop']) > 0 )
		{
			updatetable('site_bar', $setarr, array('desktop_id'=>intval($_GET['desktop']),'uid'=>$_SGLOBAL['supe_uid']));
		}
	}
	$query = $_SGLOBAL['db']->query("SELECT * FROM ".tname('site_bar')." where desktop_id=".intval($_GET['desktop'])." order by bar_id");
	while ($value = $_SGLOBAL['db']->fetch_array($query)) {
		$list[] = $value;
	}
	$query = $_SGLOBAL['db']->query("SELECT * FROM ".tname('site_share')." where desktop_id=".$list[0]['desktop_id']);
	while ($value = $_SGLOBAL['db']->fetch_array($query)) {
		$share[] = $value;
	}
	//$query = $_SGLOBAL['db']->query("SELECT * FROM ".tname('site_publish')." where uid=".$_SGLOBAL['supe_uid']." and desktop_id=".$list[0]['desktop_id']);
	$query = $_SGLOBAL['db']->query("SELECT * FROM ".tname('site_publish')." where desktop_id=".$list[0]['desktop_id']." order by id desc limit 1");
	while ($value = $_SGLOBAL['db']->fetch_array($query)) {
		$publish[] = $value;
	}
}
else
{
	if ( isset( $_GET['action'] ) && $_GET['action'] == 'save' )
	{
		header("location: /window/login.php");
		exit;
	}
	$query = $_SGLOBAL['db']->query("SELECT * FROM ".tname('site_bar')." where desktop_id=".intval($_GET['desktop'])." order by bar_id");
	while ($value = $_SGLOBAL['db']->fetch_array($query)) {
		$list[] = $value;
	}
	$query = $_SGLOBAL['db']->query("SELECT * FROM ".tname('site_share')." where desktop_id=".$list[0]['desktop_id']);
	while ($value = $_SGLOBAL['db']->fetch_array($query)) {
		$share[] = $value;
	}
}
?>