Version 4.5.0

This commit is contained in:
Neo committed 2025-12-19 05:51:58 -08:00
1 parent 1a0c7fd3c2
commit f79dcf067a
3791 files changed
+248032 -76372

No files matched your search

+95 -21
View File
@@ -5,19 +5,22 @@
* @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
*/
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;
}
/**
* Converter Software Class
*/
abstract class _Software
{
/**
@@ -43,8 +46,8 @@ abstract class _Software
/**
* Constructor
*
* @param \IPS\convert\App The application to reference for database and other information.
* @param bool If the database is needed or not.
* @param \IPS\convert\App $app The application to reference for database and other information.
* @param bool $needDB If the database is needed or not.
* @return void
* @throws \InvalidArgumentException
*/
@@ -87,16 +90,16 @@ abstract class _Software
{
try
{
$this->db = \IPS\Db::i( 'convert_' . $this->app->name, $connectionSettings );
$this->db = \IPS\Db::i( 'convert_' . $this->app->app_id, $connectionSettings );
/* Are we utf8? */
if ( !in_array( $this->app->db_charset, array( 'utf8', 'utf8mb4' ) ) )
if ( !\in_array( $this->app->db_charset, array( 'utf8', 'utf8mb4' ) ) )
{
/* Get all db charsets */
$charsets = static::getDatabaseCharsets( $this->db );
/* Set a flag that the data is not UTF8... we need to convert it to UTF8 at conversion time. */
if ( !in_array( mb_strtolower( $this->app->db_charset ), $charsets ) )
if ( !\in_array( mb_strtolower( $this->app->db_charset ), $charsets ) )
{
/* @todo We need to use a comprehensive conversion system like the UTF8 Converter... or maybe we can provide instructions on how to use it on non-IPS databases if MB can't do it? */
throw new \InvalidArgumentException( 'invalid_charset' );
@@ -117,26 +120,97 @@ abstract class _Software
* Magic __call() method
*
* @param string $name The method to call without convert prefix.
* @param mixed $arguements Arguments to pass to the method
* @param mixed $arguments Arguments to pass to the method
* @return mixed
*/
public function __call( $name, $arguments )
{
if ( method_exists( $this, 'convert' . $name ) )
{
return call_user_func( array( $this, 'convert' . $name ), $arguments );
$function = 'convert' . $name;
return $this->$function( $arguments );
}
elseif ( method_exists( $this, $name ) )
{
return call_user_func( $this, array( $name, $arguments ) );
return $this->$name( $arguments );
}
else
{
\IPS\Log::log( "Call to undefined method in " . get_class( $this ) . "::{$name}", 'converters' );
\IPS\Log::log( "Call to undefined method in " . \get_class( $this ) . "::{$name}", 'converters' );
return NULL;
}
}
/**
* Software
*
* @return array
*/
public static function software()
{
return array(
'core' => array(
'expressionengine' => 'IPS\convert\Software\Core\Expressionengine',
'invisioncommunity' => 'IPS\convert\Software\Core\Invisioncommunity',
'joomla' => 'IPS\convert\Software\Core\Joomla',
'mybb' => 'IPS\convert\Software\Core\Mybb',
'photopost' => 'IPS\convert\Software\Core\Photopost',
'phpbb' => 'IPS\convert\Software\Core\Phpbb',
'phpmyforum' => 'IPS\convert\Software\Core\Phpmyforum',
'punbb' => 'IPS\convert\Software\Core\Punbb',
'smf' => 'IPS\convert\Software\Core\Smf',
'ubbthreads' => 'IPS\convert\Software\Core\UBBthreads',
'vanilla' => 'IPS\convert\Software\Core\Vanilla',
'vbulletin' => 'IPS\convert\Software\Core\Vbulletin',
'vbulletin5' => 'IPS\convert\Software\Core\Vbulletin5',
'woltlab' => 'IPS\convert\Software\Core\Woltlab',
'wordpress' => 'IPS\convert\Software\Core\Wordpress',
'xenforo' => 'IPS\convert\Software\Core\Xenforo',
),
'blog' => array(
'vbulletin' => 'IPS\convert\Software\Blog\Vbulletin',
),
'calendar' => array(
'mybb' => 'IPS\convert\Software\Calendar\Mybb',
'vbulletin' => 'IPS\convert\Software\Calendar\Vbulletin',
),
'cms' => array(
'joomla' => 'IPS\convert\Software\Cms\Joomla',
'vbulletin' => 'IPS\convert\Software\Cms\Vbulletin',
'wordpress' => 'IPS\convert\Software\Cms\Wordpress',
'xenforo' => 'IPS\convert\Software\Cms\Xenforo',
'xenfororm' => 'IPS\convert\Software\Cms\Xenfororm',
),
'downloads' => array(
'xenforo' => 'IPS\convert\Software\Downloads\Xenforo',
),
'forums' => array(
'bbpress' => 'IPS\convert\Software\Forums\Bbpress',
'expressionengine' => 'IPS\convert\Software\Forums\Expressionengine',
'invisioncommunity' => 'IPS\convert\Software\Forums\Invisioncommunity',
'mybb' => 'IPS\convert\Software\Forums\Mybb',
'phpbb' => 'IPS\convert\Software\Forums\Phpbb',
'phpmyforum' => 'IPS\convert\Software\Forums\Phpmyforum',
'punbb' => 'IPS\convert\Software\Forums\Punbb',
'smf' => 'IPS\convert\Software\Forums\Smf',
'ubbthreads' => 'IPS\convert\Software\Forums\UBBthreads',
'vanilla' => 'IPS\convert\Software\Forums\Vanilla',
'vbulletin' => 'IPS\convert\Software\Forums\Vbulletin',
'vbulletin5' => 'IPS\convert\Software\Forums\Vbulletin5',
'woltlab' => 'IPS\convert\Software\Forums\Woltlab',
'xenforo' => 'IPS\convert\Software\Forums\Xenforo',
),
'gallery' => array(
'coppermine' => 'IPS\convert\Software\Gallery\Coppermine',
'photoplog' => 'IPS\convert\Software\Gallery\Photoplog',
'photopost' => 'IPS\convert\Software\Gallery\Photopost',
'vbulletin' => 'IPS\convert\Software\Gallery\Vbulletin',
'xenforo' => 'IPS\convert\Software\Gallery\Xenforo',
),
'nexus' => array()
);
}
/**
* Software Name
*
@@ -153,7 +227,7 @@ abstract class _Software
* Software Key
*
* @return string
* #throws \BadMethodCallException
* @throws \BadMethodCallException
*/
public static function softwareKey()
{
@@ -322,29 +396,30 @@ abstract class _Software
*
* @param string|NULL $library Specific library to fetch
* @return \IPS\convert\Library
* @throws \InvalidArgumentException
*/
public function getLibrary( $library=NULL )
{
$library = $library ?: $this->app->sw;
if ( ! class_exists( 'IPS\\convert\\Library\\' . ucwords( $library ) ) )
$classname = \IPS\convert\Library::libraries()[ $library ];
if ( ! class_exists( $classname ) )
{
throw new \InvalidArgumentException( 'invalid_library' );
}
$classname = 'IPS\\convert\\Library\\' . ucwords( $library );
return new $classname( $this );
}
/**
* Allows software to add additional menu row options
*
* @param array $rows Existing rows
* @return array
*/
public function extraMenuRows( $rows )
public function extraMenuRows()
{
return $rows;
return array();
}
/**
@@ -364,7 +439,6 @@ abstract class _Software
* @param string $idColumn The ID column to sort on, when not using keys.
* @param string|array|NULL $where WHERE clause for specific data to fetch.
* @param string $what What to fetch
*
* @return \IPS\Db\Select An \IPS\Db\Select object that can be further manipulated if necessary (e.g. joins)
*/
public function fetch( $table, $idColumn='id', $where=NULL, $what='*' )
@@ -384,9 +458,9 @@ abstract class _Software
$whereClause = array();
$whereClause[] = array( $libraryClass::$currentKeyName . '>?', $_SESSION['currentKeyValue'] );
if ( !is_null( $where ) )
if ( !\is_null( $where ) )
{
if ( is_string( $where ) )
if ( \is_string( $where ) )
{
$whereClause[] = array( $where );
}
@@ -414,7 +488,7 @@ abstract class _Software
/**
* Updates Posted Content to work with the parser.
*
* @param string The post
* @param string $post The post
* @return string The converted post
*/
public static function fixPostData( $post )