Seditio Source
Root |
./othercms/ips_4.3.4/applications/convert/sources/Software/Core/Phpmyforum.php
<?php

/**
 * @brief        Converter PhpMyForum 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
_Phpmyforum extends \IPS\convert\Software
{
   
/**
     * Software Name
     *
     * @return    string
     */
   
public static function softwareName()
    {
       
/* Child classes must override this method */
       
return "PhpMyForum";
    }

   
/**
     * Software Key
     *
     * @return    string
     */
   
public static function softwareKey()
    {
       
/* Child classes must override this method */
       
return "phpmyforum";
    }

   
/**
     * 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 ], 'profile.php' ) !== FALSE )
        {
            try
            {
               
$data = (string) $this->app->getLink( \IPS\Request::i()->id, array( 'members', 'core_members' ) );
                return \
IPS\Member::load( $data )->url();
            }
            catch( \
Exception $e )
            {
                return
NULL;
            }
        }

        return
NULL;
    }
}