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

+21 -17
View File
@@ -1,7 +1,7 @@
//<?php
/* To prevent PHP errors (extending class does not exist) revealing path */
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
{
exit;
}
@@ -43,7 +43,24 @@ class cms_hook_FriendlyUrl extends _HOOK_CLASS_
/* Try to find a page */
try
{
$page = \IPS\cms\Pages\Page::loadFromPath( $potentialFurl );
list( $pagePath, $pageNumber ) = \IPS\cms\Pages\Page::getStrippedPagePath( $potentialFurl );
try
{
$page = \IPS\cms\Pages\Page::loadFromPath( $pagePath );
}
catch( \Exception $e )
{
/* Try from furl */
try
{
$page = \IPS\cms\Pages\Page::load( \IPS\Db::i()->select( 'store_current_id', 'cms_url_store', array( 'store_type=? and store_path=?', 'page', $pagePath ) )->first() );
}
catch( \UnderflowException $e )
{
throw new \OutOfRangeException;
}
}
return static::createFromComponents( $components[ static::COMPONENT_HOST ], $components[ static::COMPONENT_SCHEME ], $components[ static::COMPONENT_PATH ], $components[ static::COMPONENT_QUERY ], $components[ static::COMPONENT_PORT ], $components[ static::COMPONENT_USERNAME ], $components[ static::COMPONENT_PASSWORD ], $components[ static::COMPONENT_FRAGMENT ] )
->setFriendlyUrlData( 'content_page_path', array( $potentialFurl ), array( 'path' => $potentialFurl ), $potentialFurl );
}
@@ -105,24 +122,11 @@ class cms_hook_FriendlyUrl extends _HOOK_CLASS_
{
if ( $seoTemplate === 'content_page_path' )
{
/* If we want to use a gateway script, adjust accordingly */
if ( \IPS\Settings::i()->cms_use_different_gateway )
{
$baseUrl = static::baseUrl( $this->data[ static::COMPONENT_SCHEME ] );
if ( mb_substr( $this->url, 0, mb_strlen( $baseUrl ) ) === $baseUrl ) // Only if it isn't already, such as from |IPS\Request::i()->url()
{
$this->url = \IPS\Settings::i()->cms_root_page_url . mb_substr( $this->url, mb_strlen( $baseUrl ) );
$this->data = static::componentsFromUrlString( $this->url );
$this->queryString = $this->data['query'];
$this->data['query'] = static::convertQueryAsArrayToString( $this->queryString );
}
}
/* Set basic properties */
$this->seoTemplate = 'content_page_path';
$this->seoTitles = is_string( $seoTitles ) ? array( $seoTitles ) : $seoTitles;
$this->seoTitles = \is_string( $seoTitles ) ? array( $seoTitles ) : $seoTitles;
$this->friendlyUrlComponent = $friendlyUrlComponent;
$this->seoPagination = true;
/* Set hidden query string */
$this->hiddenQueryString = array( 'app' => 'cms', 'module' => 'pages', 'controller' => 'page' ) + $matchedParams;