Exemplo n.º 1
0
 /**
  * get current or the specified dir information
  *
  * @param string $path
  * @return array
  */
 function getFolderInfo($path = null)
 {
     if (is_null($path)) {
         return $this->currentFolderInfo;
     } else {
         $obj = new manager($path, false);
         $obj->setSessionAction($this->sessionAction);
         $obj->getFileList();
         return $obj->getFolderInfo();
     }
 }
Exemplo n.º 2
0
        $search->addSearchKeyword('mtime_from', @$_GET['search_mtime_from']);
        $search->addSearchKeyword('mtime_to', @$_GET['search_mtime_to']);
        $search->addSearchKeyword('size_from', @$_GET['search_size_from']);
        $search->addSearchKeyword('size_to', @$_GET['search_size_to']);
        $search->addSearchKeyword('recursive', @$_GET['search_recursively']);
        $search->addSearchKeyword('name', @$_GET['search_name']);
        $search->doSearch();
        $fileList = $search->getFoundFiles();
        $folderInfo = $search->getRootFolderInfo();
    } else {
        include_once CLASS_MANAGER;
        include_once CLASS_SESSION_ACTION;
        $sessionAction = new SessionAction();
        include_once DIR_AJAX_INC . "class.manager.php";
        $manager = new manager();
        $manager->setSessionAction($sessionAction);
        $fileList = $manager->getFileList();
        $folderInfo = $manager->getFolderInfo();
    }
    $pagination->setUrl(CONFIG_URL_FILEnIMAGE_MANAGER);
} else {
    include_once CLASS_PAGINATION;
    $pagination = new pagination(false);
}
$pagination->setTotal(sizeof($fileList));
$pagination->setFirstText(PAGINATION_FIRST);
$pagination->setPreviousText(PAGINATION_PREVIOUS);
$pagination->setNextText(PAGINATION_NEXT);
$pagination->setLastText(PAGINATION_LAST);
$pagination->setLimit(!empty($_GET['limit']) ? (int) $_GET['limit'] : CONFIG_DEFAULT_PAGINATION_LIMIT);
echo $pagination->getPaginationHTML();
Exemplo n.º 3
0
		/**
		 * get the file according to the search keywords
		 *
		 */
		function doSearch($baseFolderPath = null)
		{
			
			$baseFolderPath = addTrailingSlash(backslashToSlash((is_null($baseFolderPath)?$this->rootFolder:$baseFolderPath)));
			
			$dirHandler = @opendir($baseFolderPath);
			if($dirHandler)
			{
				while(false !== ($file = readdir($dirHandler)))
				{
					if($file != '.' && $file != '..')
					{
						$path = $baseFolderPath . $file;
						if(is_file($path))
						{
							$isValid = true;

							$fileTime = @filemtime($path);
							$fileSize = @filesize($path);	
							if($this->searchkeywords['name'] !== ''  && @eregi($this->searchkeywords['name'], $file) === false)
							{
								$isValid = false;
							}
							if($this->searchkeywords['mtime_from'] != '' && $fileTime < @strtotime($this->searchkeywords['mtime_from']))
							{
								$isValid = false;
							}
							if($this->searchkeywords['mtime_to'] != '' && $fileTime > @strtotime($this->searchkeywords['mtime_to']))
							{
								$isValid = false;
							}							
							if($this->searchkeywords['size_from'] != '' && $fileSize < @strtotime($this->searchkeywords['size_from']))
							{
								$isValid = false;
							}
							if($this->searchkeywords['size_to'] != '' && $fileSize > @strtotime($this->searchkeywords['size_to']))
							{
								$isValid = false;
							}			
							if($isValid && isListingDocument($path))
							{
								$finalPath = $path;
								$objFile = new file($finalPath);
								$tem = $objFile->getFileInfo();
								$obj = new manager($finalPath, false);			
								$obj->setSessionAction($this->sessionAction);
								$selectedDocuments = $this->sessionAction->get();													
								$fileType = $obj->getFileType($finalPath);
								
								foreach($fileType as $k=>$v)
								{
									$tem[$k] = $v;
								}
								
								$tem['path'] = backslashToSlash($finalPath);		
								$tem['type'] = (is_dir($finalPath)?'folder':'file');
/*								$tem['size'] = transformFileSize($tem['size']);
								$tem['ctime'] = date(DATE_TIME_FORMAT, $tem['ctime']);
								$tem['mtime'] = date(DATE_TIME_FORMAT, $tem['mtime']);*/
								$tem['flag'] = (array_search($tem['path'], $selectedDocuments) !== false?($this->sessionAction->getAction() == "copy"?'copyFlag':'cutFlag'):'noFlag');
								$tem['url'] = getFileUrl($tem['path']);
								$this->rootFolderInfo['file']++;
								$manager = null;
								$this->files[] = $tem;
								$tem = null;								
							}
						}elseif(is_dir($path) && $this->searchkeywords['recursive'])
						{
							$this->Search($baseFolderPath);
						}
					}
				}
			}
			 
		}