Esempio n. 1
0
function a_ltree($page) {//{{{
	global $cf_datadir,$cf_adminroot,$SCRIPT_NAME,$domdir;
	$c = "$cf_adminroot/$cf_datadir";
	$loc = $GLOBALS[np][0];
	if (is_file($page)) {
		$res[] = "$page";
		return $res;
	} 
	if (is_dir($page)) {
		$query[] = "*";
		$args[] = '1';
		$args[] = '-r';
		$ls = c_ls($page,'',$query,$args);
		if (!is_array($ls)) return FALSE;
		foreach ($ls as $it) {
				$res[] = "$page/$it";
				if (is_dir($page.'/'.$it)) {
					array_pop($res);
					$tmp = a_ltree("$page/$it");
					if (is_array($tmp)) $res = array_merge($res,$tmp);
				}
		}
		return $res;
	} else {
		return FALSE;
	}
}//}}}
Esempio n. 2
0
function a_synctree($p,$o='VIEW') {
	global $cf_adminroot, $cf_webroot, $cf_datadir;
	$dom = explode('/',$p);
	if ($o == 'FULL') {
		$to = "$cf_webroot/$dom[1]/$cf_datadir/$file";
		$from = "$cf_adminroot/$cf_datadir".$p;
		$file = @stristr($from,$dom[1]);
		$back = a_ltree($from);
		$back = diff_date($back,$to,$dom[1]);
		if (is_array($back)) {
			while (list($k,$v) = each($back)) {
				$from = $v;
				$file = @stristr($from,$dom[1]);
				$to = "$cf_webroot/$dom[1]/$cf_datadir/$file";
				if (is_file($from)) { 
					a_mkdir($to);
					@copy($from,$to);
				} 
			}
		}
	} elseif ($o == 'LIST') {
		if (is_array($p)) {
			foreach ($p as $q) {
				$from = $q;
				$file = str_replace('data','',stristr($q,$cf_datadir));
				$dom = explode('/',$file);
				$to = "$cf_webroot/$dom[1]/$cf_datadir$file";
				$back = a_ltree($from);
				$back = diff_date($back,$to,$dom[1]);
				if (is_file($from)) {
					a_mkdir($to);
					copy($from, $to);
				} 
			}
		}
	} else {
		$to = "$cf_webroot/$dom[1]/$cf_datadir";
		$from = "$cf_adminroot/$cf_datadir".$p;
		$back = a_ltree($from);
		$back = diff_date($back,$to,$dom[1]);
	}
	return $back;
}