mirror of
https://github.com/nuxsmin/sysPass.git
synced 2026-03-05 16:14:11 +01:00
74 lines
2.3 KiB
PHP
74 lines
2.3 KiB
PHP
<?php
|
|
/**
|
|
* sysPass
|
|
*
|
|
* @author nuxsmin
|
|
* @link http://syspass.org
|
|
* @copyright 2012-2017, Rubén Domínguez nuxsmin@$syspass.org
|
|
*
|
|
* This file is part of sysPass.
|
|
*
|
|
* sysPass is free software: you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License as published by
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
* (at your option) any later version.
|
|
*
|
|
* sysPass is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License
|
|
* along with sysPass. If not, see <http://www.gnu.org/licenses/>.
|
|
*/
|
|
|
|
namespace SP\Mgmt\Files;
|
|
|
|
use SP\DataModel\ItemSearchData;
|
|
use SP\Mgmt\ItemSearchInterface;
|
|
use SP\Storage\DbWrapper;
|
|
use SP\Storage\QueryData;
|
|
use SP\DataModel\FileExtData;
|
|
|
|
/**
|
|
* Class FileSearch
|
|
*
|
|
* @package SP\Mgmt\Files
|
|
*/
|
|
class FileSearch extends FileBase implements ItemSearchInterface
|
|
{
|
|
/**
|
|
* @param ItemSearchData $SearchData
|
|
* @return mixed
|
|
*/
|
|
public function getMgmtSearch(ItemSearchData $SearchData)
|
|
{
|
|
$Data = new QueryData();
|
|
$Data->setMapClassName(FileExtData::class);
|
|
$Data->setSelect('accfile_id, accfile_name, CONCAT(ROUND(accfile_size/1000, 2), "KB") AS accfile_size, accfile_thumb, accfile_type, account_name, name');
|
|
$Data->setFrom('accFiles JOIN accounts ON account_id = accfile_accountId JOIN customers ON id = account_customerId');
|
|
$Data->setOrder('accfile_name');
|
|
|
|
if ($SearchData->getSeachString() !== '') {
|
|
$Data->setWhere('accfile_name LIKE ? OR accfile_type LIKE ? OR account_name LIKE ? OR name LIKE ?');
|
|
|
|
$search = '%' . $SearchData->getSeachString() . '%';
|
|
$Data->addParam($search);
|
|
$Data->addParam($search);
|
|
$Data->addParam($search);
|
|
$Data->addParam($search);
|
|
}
|
|
|
|
$Data->setLimit('?,?');
|
|
$Data->addParam($SearchData->getLimitStart());
|
|
$Data->addParam($SearchData->getLimitCount());
|
|
|
|
DbWrapper::setFullRowCount();
|
|
|
|
$queryRes = DbWrapper::getResultsArray($Data);
|
|
|
|
$queryRes['count'] = $Data->getQueryNumRows();
|
|
|
|
return $queryRes;
|
|
}
|
|
} |