86 lines
1.8 KiB
PHP
86 lines
1.8 KiB
PHP
<?php
|
|
|
|
/**
|
|
* @brief Converter Photopost Core Class
|
|
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
|
* @copyright (c) Invision Power Services, Inc.
|
|
* @package Invision Community
|
|
* @subpackage Converter
|
|
* @since 6 December 2016
|
|
* @note Only redirect scripts are supported right now
|
|
*/
|
|
|
|
namespace IPS\convert\Software\Core;
|
|
|
|
/* To prevent PHP errors (extending class does not exist) revealing path */
|
|
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
|
{
|
|
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
|
|
exit;
|
|
}
|
|
|
|
class _Photopost extends \IPS\convert\Software
|
|
{
|
|
/**
|
|
* Software Name
|
|
*
|
|
* @return string
|
|
*/
|
|
public static function softwareName()
|
|
{
|
|
/* Child classes must override this method */
|
|
return "Photopost";
|
|
}
|
|
|
|
/**
|
|
* Software Key
|
|
*
|
|
* @return string
|
|
*/
|
|
public static function softwareKey()
|
|
{
|
|
/* Child classes must override this method */
|
|
return "photopost";
|
|
}
|
|
|
|
/**
|
|
* Content we can convert from this software.
|
|
*
|
|
* @return NULL
|
|
*/
|
|
public static function canConvert()
|
|
{
|
|
return NULL;
|
|
}
|
|
|
|
/**
|
|
* Check if we can redirect the legacy URLs from this software to the new locations
|
|
*
|
|
* @return NULL|\IPS\Http\Url
|
|
*/
|
|
public function checkRedirects()
|
|
{
|
|
/* If we can't access profiles, don't bother trying to redirect */
|
|
if( !\IPS\Member::loggedIn()->canAccessModule( \IPS\Application\Module::get( 'core', 'members' ) ) )
|
|
{
|
|
return NULL;
|
|
}
|
|
|
|
$url = \IPS\Request::i()->url();
|
|
|
|
if( mb_strpos( $url->data[ \IPS\Http\Url::COMPONENT_PATH ], 'member.php' ) !== FALSE )
|
|
{
|
|
try
|
|
{
|
|
$data = (string) $this->app->getLink( \IPS\Request::i()->cat, array( 'members', 'core_members' ) );
|
|
return \IPS\Member::load( $data )->url();
|
|
}
|
|
catch( \Exception $e )
|
|
{
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
return NULL;
|
|
}
|
|
} |