<?php
/*
	[UCenter Home] (C) 2007-2008 Comsenz Inc.
	$Id: site_add_icon.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 = $empty = array();
$cdtat_start = '****----****';
$cdtat_end = '####----####';
if ( !empty($_SGLOBAL['supe_uid']) )
{
	if ( $_POST['add_desktop_id'] )
	{
		$query = $_SGLOBAL['db']->query("SELECT * FROM ".tname('site_desktop')." where uid=".$_SGLOBAL['supe_uid']." and desktop_id=".intval($_POST['add_desktop_id']));
		while ($value = $_SGLOBAL['db']->fetch_array($query)) {
			$list[] = $value;
		}
		$setarr = array(
			'uid' => $_SGLOBAL['supe_uid'],
			'content' => $list[0]['content'],
			'active' => 0,
			'createtime' => $_SGLOBAL['timestamp']
		);
		$aid = inserttable('site_desktop', $setarr, 1);
		$desktopId = $aid;
		$setbararr = array(
			'desktop_id' => $aid,
			'bar_name' => addslashes(strip_tags($_POST['add_desktop_name'])),
			'uid' => $_SGLOBAL['supe_uid'],			
			'active' => 0,
			'createtime' => $_SGLOBAL['timestamp']
		);
		inserttable('site_bar', $setbararr, 1);
	}
}
else
{
	header("location: /window/login.php");
}
?>