<?
header("Pragma: no-cache");
?>
<script>
d = new Array;
<?
$list = new iconlist($_GET['tabid']);


/*
if (substr($sys['path'], 0, 1) == "/") {
	$sys['path'] = substr($sys['path'], 1, strlen($sys['path']));
}
$userinfo = $auth->getUserInfoById($sys['uid']);
$groupInfo = $auth->getGroupInfo($userinfo['gid']);
$tmp = split("::",$sys['path']);
$splited = split("/", $tmp[1]);
$sys['sharename'] = $splited[1];
$subpath = substr($tmp[1], strlen(gluePath("/",$sys['sharename'])));
*/




$shareInfo = $share->getInfo($sys['path']);
$sys['fullPath'] = $shareInfo['path'];
$sys['subpath'] = $shareInfo['subpath'];
$sys['sharename'] = $shareInfo['sharename'];


//debug($sys);

$userinfo = $auth->getUserInfoById($sys['uid']);


$rs = $db->query("SELECT * FROM ".$settings->config['flags_tablename'].",".$settings->config['share_info_tablename']." WHERE ".$settings->config['share_info_tablename'].".to_uid='".$auth->currentUserInfo['id']."' AND ".$settings->config['flags_tablename'].".id=".$settings->config['share_info_tablename'].".fid and ".$settings->config['flags_tablename'].".shared='1' AND ".$settings->config['flags_tablename'].".uid='".$sys['uid']."' and ".$settings->config['share_info_tablename'].".as='".$sys['sharename']."'");



		if ($rs->RecordCount() > 0) {
			$shareInfo = $rs->fields;
			$sys['pathPermissions']['write'] = $shareInfo['write'];
		} else {
			exit('share info problem');
		}

	/*
	if ($userinfo['path'] == "") {
		$userpath = $groupInfo['path'];
	} else {
		$userpath = $userinfo['path'];
	}
	*/

/*
$sys['fullPath'] = gluePath($userpath, $shareInfo['path'], $subpath);
*/

/* ar putea pune un flag, hasSpace, pt meniu (upload, paste) */


//get dir listing
$d = @dir($sys['fullPath']);
if (!$d) {
	die("/*failed to read folder contents*/");
}

//arrange data for icon listing
$i = 0;
while ($file = @$d->read()) {
	if ($file != "." && $file != ".." && !in_array($file, $ignoreFiles)) {
		$fullpath = gluePath($sys['fullPath'],$file);


		if (is_dir($fullpath)) {
?>

d[<?echo $i;?>] = new Array;
d[<?echo $i;?>]['text'] = '<?echo $str->safeJS($file);?>';
d[<?echo $i;?>]['path'] = '<?echo $str->safeJS(gluePath("/", $sys['sharename'], $sys['subpath'], $file));?>';
d[<?echo $i;?>]['uid'] = '<?echo $str->safeJS($sys['uid']);?>';
d[<?echo $i;?>]['user'] = '<?echo $str->safeJS($userinfo['username']);?>';

<?
			$i++;
		}
	}
}
?>
treeitem = parent.AfianTreeHandler.all['<?echo $_GET['id'];?>'];
parent.AfianTreeDataLoaded(d, treeitem, parent.ListSharedFolder);
</script>