Version 4.5.0
This commit is contained in:
1 parent
1a0c7fd3c2
commit
f79dcf067a
3791 files changed
+248032
-76372
No files matched your search
@@ -4,7 +4,7 @@
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @package Invision Community
|
||||
* @subpackage Converter
|
||||
* @subpackage convert
|
||||
* @since 21 Jan 2015
|
||||
* @version
|
||||
*/
|
||||
@@ -12,7 +12,7 @@
|
||||
namespace IPS\convert;
|
||||
|
||||
/* 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;
|
||||
@@ -23,6 +23,22 @@ if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
*/
|
||||
class _Application extends \IPS\Application
|
||||
{
|
||||
/**
|
||||
* Can the user access this application?
|
||||
*
|
||||
* @param \IPS\Member|\IPS\Member\Group|NULL $memberOrGroup Member/group we are checking against or NULL for currently logged on user
|
||||
* @return bool
|
||||
*/
|
||||
public function canAccess( $memberOrGroup=NULL )
|
||||
{
|
||||
if ( \IPS\DEMO_MODE === TRUE )
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return parent::canAccess( $memberOrGroup );
|
||||
}
|
||||
|
||||
/**
|
||||
* [Node] Get Node Description
|
||||
*
|
||||
@@ -55,7 +71,15 @@ class _Application extends \IPS\Application
|
||||
/* We don't allow the application to be disabled since its hooks are required for redirects */
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* [Node] Get buttons to display in tree
|
||||
* Example code explains return value
|
||||
*
|
||||
* @param string $url Base URL
|
||||
* @param bool $subnode Is this a subnode?
|
||||
* @return array
|
||||
*/
|
||||
public function getButtons( $url, $subnode=FALSE )
|
||||
{
|
||||
$buttons = parent::getButtons( $url, $subnode );
|
||||
@@ -103,12 +127,20 @@ class _Application extends \IPS\Application
|
||||
/**
|
||||
* Ensure the appropriate tables have a conv_parent column for internal references
|
||||
*
|
||||
* @param string|NULL The application to check, or NULL to check all.
|
||||
* @param string|NULL $application The application to check, or NULL to check all.
|
||||
* @return void
|
||||
*/
|
||||
public static function checkConvParent( $application=NULL )
|
||||
{
|
||||
$parents = array(
|
||||
'blog' => array(
|
||||
'tables' => array(
|
||||
'blog_categories' => array(
|
||||
'prefix' => 'category_',
|
||||
'column' => 'conv_parent'
|
||||
)
|
||||
)
|
||||
),
|
||||
'downloads' => array(
|
||||
'tables' => array(
|
||||
'downloads_categories' => array(
|
||||
@@ -173,27 +205,40 @@ class _Application extends \IPS\Application
|
||||
|
||||
foreach( $parents AS $app => $tables )
|
||||
{
|
||||
if ( !is_null( $application ) )
|
||||
if ( !\is_null( $application ) AND $application != $app )
|
||||
{
|
||||
if ( $application != $app )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( static::appisEnabled( $app ) )
|
||||
if ( static::appisEnabled( $app ) OR $application === NULL )
|
||||
{
|
||||
foreach( $tables['tables'] AS $table => $data )
|
||||
{
|
||||
$column = $data['prefix'] . $data['column'];
|
||||
if ( \IPS\Db::i()->checkForColumn( $table, $column ) === FALSE )
|
||||
if ( \IPS\Db::i()->checkForTable( $table ) )
|
||||
{
|
||||
\IPS\Db::i()->addColumn( $table, array(
|
||||
'name' => $column,
|
||||
'type' => 'BIGINT',
|
||||
'length' => 20,
|
||||
'default' => 0,
|
||||
) );
|
||||
$column = $data['prefix'] . $data['column'];
|
||||
if ( \IPS\Db::i()->checkForColumn( $table, $column ) === FALSE )
|
||||
{
|
||||
\IPS\Db::i()->addColumn( $table, array(
|
||||
'name' => $column,
|
||||
'type' => 'VARCHAR',
|
||||
'length' => 255,
|
||||
'default' => '0',
|
||||
) );
|
||||
}
|
||||
else
|
||||
{
|
||||
$localDefinition = \IPS\Db::i()->getTableDefinition( $table, TRUE );
|
||||
if( $localDefinition['columns'][ $column ]['type'] !== 'VARCHAR' )
|
||||
{
|
||||
\IPS\Db::i()->changeColumn( $table, $column, array(
|
||||
'name' => $column,
|
||||
'type' => 'VARCHAR',
|
||||
'length' => 255,
|
||||
'default' => '0',
|
||||
) );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user