protected function checkLastSearch($id = false)
    {
        $interval = getConfig('security.search_interval');

        if (!$interval) {
            return true;
        }

        $id = $id ? md5($id) : false;
        $lastSearch = $this->request->getSession()->read('last_search');

        if ($lastSearch) {
            //Checks if it's the same search
            if ($id && !empty($lastSearch['id']) && $id === $lastSearch['id']) {
                return true;
            //Checks if the interval has not yet expired
            } elseif (($lastSearch['time'] + $interval) > time()) {
                return false;
            }
        }

        $this->request->getSession()->write('last_search', compact('id') + ['time' => time()]);

        return true;
    }
protected function checkLastSearch($id = false)
    {
        $interval = getConfig('security.search_interval');

        if (!$interval) {
            return true;
        }

        $id = $id ? md5($id) : false;
        $lastSearch = $this->request->getSession()->read('last_search');

        if ($lastSearch) {
            //Checks if it's the same search
            if ($id && !empty($lastSearch['id']) && $id === $lastSearch['id']) {
                return true;
            //Checks if the interval has not yet expired
            } elseif (($lastSearch['time'] + $interval) > time()) {
                return false;
            }
        }

        $this->request->getSession()->write('last_search', compact('id') + ['time' => time()]);

        return true;
    }
protected function checkLastSearch ( $ id = false ) { $ interval = getConfig ( 'security.search_interval' ) ; if ( ! $ interval ) { return true ; } $ id = $ id ? md5 ( $ id ) : false ; $ lastSearch = $ this -> request -> getSession ( ) -> read ( 'last_search' ) ; if ( $ lastSearch ) { //Checks if it's the same search if ( $ id && ! empty ( $ lastSearch [ 'id' ] ) && $ id === $ lastSearch [ 'id' ] ) { return true ; //Checks if the interval has not yet expired } elseif ( ( $ lastSearch [ 'time' ] + $ interval ) > time ( ) ) { return false ; } } $ this -> request -> getSession ( ) -> write ( 'last_search' , compact ( 'id' ) + [ 'time' => time ( ) ] ) ; return true ; }
Checks if the latest search has been executed out of the minimum
interval
@param string $id Query ID
@return bool
Checks if the latest search has been executed out of the minimum interval