Version 4.7.23
This commit is contained in:
1 parent
7124a02564
commit
25ddeb65d6
1791 files changed
+76990
-44452
No files matched your search
@@ -39,7 +39,7 @@ class _seo extends \IPS\Dispatcher\Controller
|
||||
*/
|
||||
public function execute()
|
||||
{
|
||||
\IPS\Dispatcher::i()->checkAcpPermission( 'seo_manage' );
|
||||
\IPS\Dispatcher::i()->checkAcpPermission( 'seo_furls' );
|
||||
|
||||
/* Get tab content */
|
||||
$this->activeTab = \IPS\Request::i()->tab ?: 'urls';
|
||||
@@ -189,6 +189,8 @@ class _seo extends \IPS\Dispatcher\Controller
|
||||
|
||||
$form->add( new \IPS\Helpers\Form\Codemirror( 'use_robotstxt_custom_editor', ( $value === 'custom' ? \IPS\Settings::i()->robots_txt : '' ), FALSE, [], NULL, NULL, NULL, 'use_robotstxt_custom_editor' ) );
|
||||
|
||||
$form->add( new \IPS\Helpers\Form\YesNo( 'seo_reduce_links', \IPS\Settings::i()->seo_reduce_links, TRUE, [], NULL, NULL, NULL, 'seo_reduce_links' ) );
|
||||
|
||||
/* Are we saving? */
|
||||
if ( $values = $form->values() )
|
||||
{
|
||||
@@ -199,7 +201,7 @@ class _seo extends \IPS\Dispatcher\Controller
|
||||
$value = $values['use_robotstxt_custom_editor'];
|
||||
}
|
||||
|
||||
$form->saveAsSettings( [ 'robots_txt' => $value ] );
|
||||
$form->saveAsSettings( [ 'robots_txt' => $value, 'seo_reduce_links' => $values['seo_reduce_links'] ] );
|
||||
|
||||
\IPS\Session::i()->log( 'acplog__robotstxt_edited' );
|
||||
|
||||
@@ -275,7 +277,10 @@ class _seo extends \IPS\Dispatcher\Controller
|
||||
/* Init */
|
||||
$form = new \IPS\Helpers\Form;
|
||||
$form->addMessage( 'sitemap_blurb', 'ipsMessage ipsMessage_info' );
|
||||
$form->add( new \IPS\Helpers\Form\Url( 'sitemap_url', \IPS\Settings::i()->sitemap_url ?: \IPS\Settings::i()->base_url . 'sitemap.php', FALSE ) );
|
||||
if( !\IPS\CIC )
|
||||
{
|
||||
$form->add( new \IPS\Helpers\Form\Url( 'sitemap_url', \IPS\Settings::i()->sitemap_url ?: \IPS\Settings::i()->base_url . 'sitemap.php', FALSE ) );
|
||||
}
|
||||
|
||||
/* Get extension settings */
|
||||
$useRecommendedSettings = TRUE;
|
||||
@@ -312,34 +317,37 @@ class _seo extends \IPS\Dispatcher\Controller
|
||||
/* Are we saving? */
|
||||
if ( $values = $form->values() )
|
||||
{
|
||||
if ( $values['sitemap_configuration_info'] )
|
||||
if( $values[ 'sitemap_configuration_info' ] )
|
||||
{
|
||||
$values = array_merge( $values, $recommendedSettings );
|
||||
}
|
||||
|
||||
try
|
||||
if( !\IPS\CIC )
|
||||
{
|
||||
if( !( $values['sitemap_url'] instanceof \IPS\Http\Url ) )
|
||||
try
|
||||
{
|
||||
throw new \RuntimeException;
|
||||
if( !( $values[ 'sitemap_url' ] instanceof \IPS\Http\Url ) )
|
||||
{
|
||||
throw new \RuntimeException;
|
||||
}
|
||||
$response = $values[ 'sitemap_url' ]->setQueryString( 'testsettings', 1 )->request()->get();
|
||||
|
||||
if( $response->httpResponseCode != 200 or !mb_strpos( $values[ 'sitemap_url' ], 'sitemap.php' ) )
|
||||
{
|
||||
$form->error = \IPS\Member::loggedIn()->language()->addToStack( 'invalid_sitemap_url' );
|
||||
}
|
||||
}
|
||||
|
||||
$response = $values['sitemap_url']->setQueryString( 'testsettings', 1 )->request()->get();
|
||||
|
||||
if ( $response->httpResponseCode != 200 or !mb_strpos( $values['sitemap_url'], "sitemap.php" ) )
|
||||
catch( \RuntimeException $e )
|
||||
{
|
||||
$form->error = \IPS\Member::loggedIn()->language()->addToStack( 'invalid_sitemap_url' );
|
||||
$form->error = \IPS\Member::loggedIn()->language()->addToStack( 'form_url_bad' );
|
||||
}
|
||||
|
||||
}
|
||||
catch ( \RuntimeException $e )
|
||||
{
|
||||
$form->error = \IPS\Member::loggedIn()->language()->addToStack( 'form_url_bad' );
|
||||
}
|
||||
|
||||
if( !$form->error )
|
||||
{
|
||||
$values['sitemap_url'] = (string) $values['sitemap_url'];
|
||||
if( isset( $values[ 'sitemap_url' ] ) )
|
||||
{
|
||||
$values['sitemap_url'] = (string) $values['sitemap_url'];
|
||||
}
|
||||
|
||||
|
||||
foreach( \IPS\Application::allExtensions( 'core', 'Sitemap', FALSE, 'core' ) as $extKey => $extension )
|
||||
{
|
||||
@@ -348,9 +356,10 @@ class _seo extends \IPS\Dispatcher\Controller
|
||||
$extension->saveSettings( $values );
|
||||
}
|
||||
}
|
||||
|
||||
$form->saveAsSettings( array( 'sitemap_url' => $values['sitemap_url'] ) );
|
||||
|
||||
if( !\IPS\CIC )
|
||||
{
|
||||
$form->saveAsSettings( ['sitemap_url' => $values[ 'sitemap_url' ]] );
|
||||
}
|
||||
/* Clear guest page caches */
|
||||
\IPS\Data\Cache::i()->clearAll();
|
||||
|
||||
|
||||
Reference in new issue
Block a user