Version 4.5.0
This commit is contained in:
1 parent
1a0c7fd3c2
commit
f79dcf067a
3791 files changed
+248032
-76372
No files matched your search
@@ -12,7 +12,7 @@
|
||||
namespace IPS\cms\widgets;
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
{
|
||||
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
|
||||
exit;
|
||||
@@ -46,14 +46,12 @@ class _Database extends \IPS\Widget
|
||||
/**
|
||||
* Specify widget configuration
|
||||
*
|
||||
* @param \IPS\Helpers\Form|NULL $form Form helper
|
||||
* @return null|\IPS\Helpers\Form
|
||||
*/
|
||||
public function configuration( &$form=null )
|
||||
{
|
||||
if ( $form === null )
|
||||
{
|
||||
$form = new \IPS\Helpers\Form;
|
||||
}
|
||||
$form = parent::configuration( $form );
|
||||
|
||||
$databases = array();
|
||||
$disabled = array();
|
||||
@@ -62,7 +60,7 @@ class _Database extends \IPS\Widget
|
||||
{
|
||||
$databases[ $db->id ] = $db->_title;
|
||||
|
||||
if ( $db->page_id )
|
||||
if ( $db->page_id and $db->page_id != \IPS\Request::i()->pageID )
|
||||
{
|
||||
$disabled[] = $db->id;
|
||||
|
||||
@@ -78,13 +76,13 @@ class _Database extends \IPS\Widget
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! count( $databases ) )
|
||||
if ( ! \count( $databases ) )
|
||||
{
|
||||
$form->addMessage('cms_err_no_databases_to_use');
|
||||
}
|
||||
else
|
||||
{
|
||||
$form->add( new \IPS\Helpers\Form\Select( 'database', ( isset( $this->configuration['database'] ) ? $this->configuration['database'] : NULL ), FALSE, array( 'options' => $databases, 'disabled' => $disabled ) ) );
|
||||
$form->add( new \IPS\Helpers\Form\Select( 'database', ( isset( $this->configuration['database'] ) ? (int) $this->configuration['database'] : NULL ), FALSE, array( 'options' => $databases, 'disabled' => $disabled ) ) );
|
||||
}
|
||||
|
||||
return $form;
|
||||
@@ -119,14 +117,14 @@ class _Database extends \IPS\Widget
|
||||
{
|
||||
try
|
||||
{
|
||||
$database = \IPS\cms\Databases::load( intval( $this->configuration['database'] ) );
|
||||
$database = \IPS\cms\Databases::load( \intval( $this->configuration['database'] ) );
|
||||
|
||||
if ( ! $database->page_id and \IPS\cms\Pages\Page::$currentPage )
|
||||
{
|
||||
$database->page_id = \IPS\cms\Pages\Page::$currentPage->id;
|
||||
$database->save();
|
||||
}
|
||||
|
||||
|
||||
static::$html = \IPS\cms\Databases\Dispatcher::i()->setDatabase( $database->id )->run();
|
||||
}
|
||||
catch ( \OutOfRangeException $e )
|
||||
|
||||
Reference in new issue
Block a user