Version 5.0.0 beta 1
This commit is contained in:
1 parent
25ddeb65d6
commit
15c7beabc5
6736 files changed
+627902
-497943
No files matched your search
@@ -11,30 +11,39 @@
|
||||
namespace IPS\core\modules\admin\system;
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
|
||||
use IPS\Application;
|
||||
use IPS\Dispatcher;
|
||||
use IPS\Dispatcher\Controller;
|
||||
use IPS\Output;
|
||||
use IPS\Request;
|
||||
use OutOfRangeException;
|
||||
use function defined;
|
||||
|
||||
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
{
|
||||
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
|
||||
header( ( $_SERVER['SERVER_PROTOCOL'] ?? 'HTTP/1.0' ) . ' 403 Forbidden' );
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Live Search
|
||||
*/
|
||||
class _livesearch extends \IPS\Dispatcher\Controller
|
||||
class livesearch extends Controller
|
||||
{
|
||||
/**
|
||||
* @brief Has been CSRF-protected
|
||||
*/
|
||||
public static $csrfProtected = TRUE;
|
||||
public static bool $csrfProtected = TRUE;
|
||||
|
||||
/**
|
||||
* Execute
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function execute()
|
||||
public function execute() : void
|
||||
{
|
||||
\IPS\Dispatcher::i()->checkAcpPermission( 'livesearch_manage', 'core', 'livesearch' );
|
||||
Dispatcher::i()->checkAcpPermission( 'livesearch_manage', 'core' );
|
||||
parent::execute();
|
||||
}
|
||||
|
||||
@@ -43,24 +52,24 @@ class _livesearch extends \IPS\Dispatcher\Controller
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function manage()
|
||||
protected function manage() : void
|
||||
{
|
||||
$results = array();
|
||||
|
||||
try
|
||||
{
|
||||
$exploded = explode( '_', \IPS\Request::i()->search_key );
|
||||
$app = \IPS\Application::load( $exploded[0] );
|
||||
$exploded = explode( '_', Request::i()->search_key );
|
||||
$app = Application::load( $exploded[0] );
|
||||
foreach ( $app->extensions( 'core', 'LiveSearch' ) as $k => $extension )
|
||||
{
|
||||
if ( $k === $exploded[1] and method_exists( $extension, 'getResults' ) )
|
||||
if ( $k === $exploded[1] )
|
||||
{
|
||||
$results = $extension->getResults( urldecode( \IPS\Request::i()->search_term ) );
|
||||
$results = $extension->getResults( urldecode( Request::i()->search_term ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
catch ( \OutOfRangeException $e ) { }
|
||||
catch ( OutOfRangeException $e ) { }
|
||||
|
||||
\IPS\Output::i()->json( array_values( $results ) );
|
||||
Output::i()->json( array_values( $results ) );
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user