1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56
<?php
namespace hji\users\admin;
use hji\users\core\abstracts\Component;
class BaseController extends Component
{
function setActionHooks(){}
function prepareActionsModelParameters()
{
$request = $this->di()->get('hji\\users\\models\\Request');
$settingsModel = $this->di()->get('hji\\users\\models\\Settings');
$params = array(
'pageNumber' => $request->get('paged'),
'sortField' => $request->get('orderby') ? $request->get('orderby') : 'timestamp',
'sortOrder' => $request->get('order') ? $request->get('order') : 'desc',
'timestamp' => $settingsModel->getTimeframe(),
'action' => 'avm,listings.search,listings.get,form_entry',
'ipAddress' => $request->get('ipAddress'),
'user' => $request->get('email'),
'site' => $request->get('site')
);
if ($tab = $request->get('tab'))
{
if ($tab != 'all')
{
$params['action'] = $tab;
}
}
if ($searchString = $request->get('s'))
{
if (filter_var($searchString, FILTER_VALIDATE_EMAIL))
{
$params['user'] = $searchString;
}
else if (filter_var($searchString, FILTER_VALIDATE_IP))
{
$params['ipAddress'] = $searchString;
}
else
{
$params['parameters'] = $searchString;
}
}
return array_filter($params);
}
}