Version 4.3.0
This commit is contained in:
1 parent
96997ddd8e
commit
fe1acf984a
1349 files changed
+116159
-67711
No files matched your search
@@ -83,6 +83,47 @@ class _UBBthreads extends \IPS\convert\Software
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Allows software to add additional menu row options
|
||||
*
|
||||
* @param array $rows Existing rows
|
||||
* @return array
|
||||
*/
|
||||
public function extraMenuRows( $rows )
|
||||
{
|
||||
$count = $this->countRows( static::canConvert()['convertForumsTopicsRatings']['table'], static::canConvert()['convertForumsTopicsRatings']['where'] );
|
||||
|
||||
if( $count )
|
||||
{
|
||||
$rows['convertForumsTopicsRatings'] = array(
|
||||
'step_method' => 'convertForumsTopicsRatings',
|
||||
'step_title' => 'convert_ratings',
|
||||
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'core_ratings' )->first(),
|
||||
'source_rows' => $count,
|
||||
'per_cycle' => 1500,
|
||||
'dependencies' => array( 'convertForumsTopics' ),
|
||||
'link_type' => 'topic_ratings',
|
||||
);
|
||||
}
|
||||
|
||||
$count = $this->countRows( static::canConvert()['convertForumsTopicsFollowers']['table'], static::canConvert()['convertForumsTopicsFollowers']['where'] );
|
||||
|
||||
if( $count )
|
||||
{
|
||||
$rows['convertForumsTopicsFollowers'] = array(
|
||||
'step_method' => 'convertForumsTopicsFollowers',
|
||||
'step_title' => 'convert_follows',
|
||||
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'core_follow' )->first(),
|
||||
'source_rows' => $count,
|
||||
'per_cycle' => 1000,
|
||||
'dependencies' => array( 'convertForumsTopics' ),
|
||||
'link_type' => 'core_follows',
|
||||
);
|
||||
}
|
||||
|
||||
return $rows;
|
||||
}
|
||||
|
||||
/**
|
||||
* Count Source Rows for a specific step
|
||||
*
|
||||
@@ -247,7 +288,7 @@ class _UBBthreads extends \IPS\convert\Software
|
||||
{
|
||||
$libraryClass = $this->getLibrary();
|
||||
|
||||
foreach ( $this->fetch( 'WATCH_LISTS', 'WATCH_ID', array( 'WATCH_TYPE=?', 'f' ), 'USER_ID ASC, WATCH_ID ASC' ) as $row )
|
||||
foreach ( $this->fetch( 'WATCH_LISTS', 'WATCH_ID', array( 'WATCH_TYPE=?', 'f' ) ) as $row )
|
||||
{
|
||||
$libraryClass->convertFollow( array(
|
||||
'follow_app' => 'forums',
|
||||
@@ -390,7 +431,7 @@ class _UBBthreads extends \IPS\convert\Software
|
||||
{
|
||||
$libraryClass = $this->getLibrary();
|
||||
|
||||
foreach ( $this->fetch( 'WATCH_LISTS', 'WATCH_ID', array( 'WATCH_TYPE=?', 't' ), 'USER_ID ASC, WATCH_ID ASC' ) as $row )
|
||||
foreach ( $this->fetch( 'WATCH_LISTS', 'WATCH_ID', array( 'WATCH_TYPE=?', 't' ) ) as $row )
|
||||
{
|
||||
$libraryClass->convertFollow( array(
|
||||
'follow_app' => 'forums',
|
||||
@@ -489,7 +530,25 @@ class _UBBthreads extends \IPS\convert\Software
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if( preg_match( '#/ubbthreads.php/topics/([0-9]+)($|/)#i', $url->data[ \IPS\Http\Url::COMPONENT_PATH ], $matches ) )
|
||||
//ubbthreads.php?ubb=showflat&Number=?
|
||||
if( isset( \IPS\Request::i()->Number ) AND isset( \IPS\Request::i()->ubb ) )
|
||||
{
|
||||
try
|
||||
{
|
||||
$data = (string) $this->app->getLink( (int) \IPS\Request::i()->Number, array( 'posts', 'forums_posts' ) );
|
||||
$post = \IPS\forums\Topic\Post::load( $data );
|
||||
|
||||
if( $post->item()->canView() )
|
||||
{
|
||||
return $post->url();
|
||||
}
|
||||
}
|
||||
catch ( \OutOfRangeException $e )
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
elseif( preg_match( '#/ubbthreads.php/topics/([0-9]+)($|/)#i', $url->data[ \IPS\Http\Url::COMPONENT_PATH ], $matches ) )
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -510,6 +569,18 @@ class _UBBthreads extends \IPS\convert\Software
|
||||
}
|
||||
catch( \Exception $e )
|
||||
{
|
||||
try
|
||||
{
|
||||
$data = (string) $this->app->getLink( (int) $matches[1], array( 'posts', 'forums_posts' ) );
|
||||
$post = \IPS\forums\Topic\Post::load( $data );
|
||||
|
||||
if( $post->item()->canView() )
|
||||
{
|
||||
return $post->url();
|
||||
}
|
||||
}
|
||||
catch ( \OutOfRangeException $e ) { }
|
||||
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
@@ -530,6 +601,23 @@ class _UBBthreads extends \IPS\convert\Software
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
elseif( preg_match( '#ubbthreads.php/ubb/showflat/Number/([0-9]+)($|/)#i', $url->data[ \IPS\Http\Url::COMPONENT_PATH ], $matches ) )
|
||||
{
|
||||
try
|
||||
{
|
||||
$data = (string) $this->app->getLink( (int) $matches[1], array( 'posts', 'forums_posts' ) );
|
||||
$post = \IPS\forums\Topic\Post::load( $data );
|
||||
|
||||
if( $post->item()->canView() )
|
||||
{
|
||||
return $post->url();
|
||||
}
|
||||
}
|
||||
catch ( \OutOfRangeException $e )
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user