Ejemplo n.º 1
0
 /**
  * get next available file name
  *
  * @param string $fileToMove the path of the file will be moved to
  * @param string $destFolder the path of destination folder
  * @return string
  */
 function getNextAvailableFileName($fileToMove, $destFolder)
 {
     $folderPath = addslashes(backslashToSlash(getParentPath($fileToMove)));
     $destFolder = addslashes(backslashToSlash(getParentPath($destFolder)));
     $finalPath = $destFolder . basename($fileToMove);
     if (file_exists($fileToMove)) {
         if (is_file()) {
             $fileExt = getFileExt($fileToMove);
             $fileBaseName = basename($fileToMove, '.' . $fileExt);
             $count = 1;
             while (file_exists($destFolder . $fileBaseName . $count . "." . $fileExt)) {
                 $count++;
             }
             $filePath = $destFolder . $fileBaseName . $count . "." . $fileExt;
         } elseif (is_dir()) {
             $folderName = basename($fileToMove);
             $count = 1;
             while (file_exists($destFolder . $folderName . $count)) {
                 $count++;
             }
             $filePath = $destFolder . $fileBaseName . $count;
         }
     }
     return $finalPath;
 }
Ejemplo n.º 2
0
} elseif (!rename(removeTrailingSlash($_POST['original_path']), addTrailingSlash(getParentPath($_POST['original_path'])) . $_POST['name'])) {
    $error = ERR_RENAME_FAILED;
} else {
    //update record of session if image exists in session for cut or copy
    include_once CLASS_SESSION_ACTION;
    $sessionAction = new SessionAction();
    $selectedDocuments = $sessionAction->get();
    if (removeTrailingSlash($sessionAction->getFolder()) == getParentPath($_POST['original_path']) && sizeof($selectedDocuments)) {
        if (($key = array_search(basename($_POST['original_path']), $selectedDocuments)) !== false) {
            $selectedDocuments[$key] = $_POST['name'];
            $sessionAction->set($selectedDocuments);
        }
    } elseif (removeTrailingSlash($sessionAction->getFolder()) == removeTrailingSlash($_POST['original_path'])) {
        $sessionAction->setFolder($_POST['original_path']);
    }
    $path = addTrailingSlash(getParentPath($_POST['original_path'])) . $_POST['name'];
    if (is_file($path)) {
        include_once CLASS_FILE;
        $file = new file($path);
        $fileInfo = $file->getFileInfo();
        $fileInfo['mtime'] = date(DATE_TIME_FORMAT, $fileInfo['mtime']);
    } else {
        include_once CLASS_MANAGER;
        $manager = new manager($path, false);
        $fileInfo = $manager->getFolderInfo();
        $fileInfo['mtime'] = date(DATE_TIME_FORMAT, $fileInfo['mtime']);
    }
    event_system(LOG_MY_FOLDER_CHANGE, LOG_MY_FOLDER_PATH, $_POST['original_path']);
    event_system(LOG_MY_FOLDER_CHANGE, LOG_MY_FOLDER_NEW_PATH, $path);
}
echo "{";
Ejemplo n.º 3
0
	function exec($args, $stdin, &$stdout, &$stderr, &$system)
	{
		$path = $args;
		
		if (empty($path))
		{
			$home_id = $_SESSION['murrix']['user']->home_id;
			
			if ($home_id > 0)
			{
				$home = new mObject($home_id);
				$path = $home->getPath();
			}
			else
				return true;
		}
			
		if ($path == ".")
			return true;
			
		if ($path == "..")
		{
			$path = getParentPath($_SESSION['murrix']['path']);
		}
		else if ($path{0} != "/")
		{
			$path = $_SESSION['murrix']['path']."/$path";
		}
	
		global $root_id;
		$node_id = getNode($path);
		
		$invalid = false;
		if ($node_id == $root_id)
		{
			$root_obj = new mObject($root_id);
			
			if ($root_obj->getPath() != $path)
				$invalid = true;
		}
		else if ($node_id <= 0)
			$invalid = true;
			
		if ($invalid)
		{
			$stderr = ucf(i18n("no such path"))." \"$path\"";
			return true;
		}
		
		$object = new mObject(getNode($path));
		if (!$object->hasRight("read") && !isAdmin())
		{
			$stderr = ucf(i18n("permission denied, no rights"));
			return true;
		}
		
		$_SESSION['murrix']['path'] = $path;
		$stdout = "Entered \"$path\"";
		
		if ($response != null)
			$system->TriggerEventIntern($response, "newlocation", array("path" => $path));
			
		return true;
	}
Ejemplo n.º 4
0
<div class="main">
	<div class="container">
		<center>
		<?
			global $wwwpath;
		
			$parent = new mObject(getNode(getParentPath($object->getPathInTree())));
			
			$invert = "";
			if ($parent->getMeta("sort_direction", "") == "asc")
				$invert = "!";
			
			$family = fetch("FETCH node WHERE link:node_top='".$parent->getNodeId()."' AND link:type='sub' AND !property:class_name='comment' AND !property:class_name='poll_answer' NODESORTBY property:version SORTBY $invert".$parent->getMeta("sort_by", "property:name"));
			
			$family = getReadable($family);
			
			$prev = false;
			$next = false;
			
			for ($n = 0; $n < count($family); $n++)
			{
				if ($family[$n]->getNodeId() == $object->getNodeId())
				{
					if ($n > 0)
						$prev = $family[$n-1];
						
					if ($n < count($family)-1)
						$next = $family[$n+1];
				
					break;
				}
Ejemplo n.º 5
0
<?
require_once("system/functions.php");

$abspath = getcwd();
$wwwpath = getParentPath($_SERVER["SCRIPT_NAME"]);
$version = "0.7 alpha";
?>