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

@@ -12,7 +12,7 @@
namespace IPS\forums\modules\admin\forums;
/* To prevent PHP errors (extending class does not exist) revealing path */
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
{
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
exit;
@@ -23,6 +23,11 @@ if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
*/
class _forums extends \IPS\Node\Controller
{
/**
* @brief Has been CSRF-protected
*/
public static $csrfProtected = TRUE;
/**
* Node Class
*/
@@ -117,6 +122,11 @@ class _forums extends \IPS\Node\Controller
return parent::permissions();
}
/**
* Form to add/edit a forum
*
* @return void
*/
protected function form()
{
parent::form();
@@ -1,242 +0,0 @@
<?php
/**
* @brief Feeds
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
* @copyright (c) Invision Power Services, Inc.
* @license https://www.invisioncommunity.com/legal/standards/
* @package Invision Community
* @subpackage Forums
* @since 04 Feb 2014
*/
namespace IPS\forums\modules\admin\forums;
/* 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;
}
/**
* rss
*/
class _rss extends \IPS\Node\Controller
{
/**
* Execute
*
* @return void
*/
public function execute()
{
\IPS\Dispatcher::i()->checkAcpPermission( 'rss_manage' );
parent::execute();
}
/**
* Node Class
*/
protected $nodeClass = '\IPS\forums\Feed';
/**
* Get Root Buttons
*
* @return array
*/
public function _getRootButtons()
{
$buttons = parent::_getRootButtons();
if ( isset( \IPS\Output::i()->sidebar['actions']['add'] ) )
{
\IPS\Output::i()->sidebar['actions']['add']['link'] = \IPS\Output::i()->sidebar['actions']['add']['link']->setQueryString( '_new', TRUE );
}
return $buttons;
}
/**
* Add/Edit Form
*
* @return void
*/
protected function form()
{
$nodeClass = $this->nodeClass;
if ( !\IPS\Request::i()->id and $nodeClass::canAddRoot() )
{
\IPS\Output::i()->output = new \IPS\Helpers\Wizard( array(
'rss_import_url' => function( $data )
{
$form = new \IPS\Helpers\Form( 'form', 'continue' );
$form->add( new \IPS\Helpers\Form\Url( 'rss_import_url', NULL, TRUE ) );
$form->add( new \IPS\Helpers\Form\Text( 'rss_import_auth_user' ) );
$form->add( new \IPS\Helpers\Form\Password( 'rss_import_auth_pass' ) );
if ( $values = $form->values() )
{
try
{
$request = $values['rss_import_url']->request();
if ( $values['rss_import_auth_user'] or $values['rss_import_auth_pass'] )
{
$request = $request->login( $values['rss_import_auth_user'], $values['rss_import_auth_pass'] );
}
$response = $request->get();
if ( $response->httpResponseCode == 401 )
{
$form->error = \IPS\Member::loggedIn()->language()->addToStack( 'rss_import_auth' );
return $form;
}
$response = $response->decodeXml();
if ( !( $response instanceof \IPS\Xml\Rss ) and !( $response instanceof \IPS\Xml\Atom ) )
{
$form->error = \IPS\Member::loggedIn()->language()->addToStack( 'rss_import_invalid' );
return $form;
}
}
catch ( \IPS\Http\Request\Exception $e )
{
$form->error = \IPS\Member::loggedIn()->language()->addToStack( 'form_url_bad' );
return $form;
}
catch ( \Exception $e )
{
$form->error = \IPS\Member::loggedIn()->language()->addToStack( 'rss_import_invalid' );
return $form;
}
return $values;
}
return $form;
},
'rss_import_preview' => function( $data )
{
if ( isset( \IPS\Request::i()->continue ) )
{
return $data;
}
$request = \IPS\Http\Url::external( $data['rss_import_url'] )->request();
if ( $data['rss_import_auth_user'] or $data['rss_import_auth_pass'] )
{
$request = $request->login( $data['rss_import_auth_user'], $data['rss_import_auth_pass'] );
}
return \IPS\Theme::i()->getTemplate( 'feeds' )->importPreview( $request->get()->decodeXml()->articles() );
},
'rss_import_details' => function ( $data )
{
$request = \IPS\Http\Url::external( $data['rss_import_url'] )->request();
if ( $data['rss_import_auth_user'] or $data['rss_import_auth_pass'] )
{
$request = $request->login( $data['rss_import_auth_user'], $data['rss_import_auth_pass'] );
}
$form = new \IPS\Helpers\Form;
$form->add( new \IPS\Helpers\Form\Node( 'rss_import_forum_id', NULL, TRUE, array( 'class' => 'IPS\forums\Forum', 'permissionCheck' => function ( $forum )
{
return $forum->sub_can_post and !$forum->redirect_url;
} ) ) );
$form->add( new \IPS\Helpers\Form\Member( 'rss_import_mid', \IPS\Member::loggedIn(), TRUE, array(), function( $val ){
if( !is_array( $val ) )
{
$val = array( $val );
}
foreach( $val as $member )
{
if( $member instanceof \IPS\Member )
{
if( !$member->member_id )
{
throw new \InvalidArgumentException( 'form_member_bad' );
}
}
else
{
$testMember = \IPS\Member::load( $member );
if( !$testMember->member_id )
{
throw new \InvalidArgumentException( 'form_member_bad' );
}
}
}
} ) );
$form->add( new \IPS\Helpers\Form\Text( 'rss_import_showlink', \IPS\Member::loggedIn()->language()->addToStack('rss_import_showlink_default') ) );
$form->add( new \IPS\Helpers\Form\Radio( 'rss_import_topic_open', NULL, FALSE, array( 'options' => array( 1 => 'unlocked', 0 => 'locked' ) ) ) );
$form->add( new \IPS\Helpers\Form\Radio( 'rss_import_topic_hide', NULL, FALSE, array( 'options' => array( 0 => 'unhidden', 1 => 'hidden' ) ) ) );
$form->add( new \IPS\Helpers\Form\Text( 'rss_import_topic_pre', NULL, FALSE, array( 'trim' => FALSE ) ) );
if ( $values = $form->values() )
{
$import = new \IPS\forums\Feed;
$import->enabled = TRUE;
$import->title = $request->get()->decodeXml()->title();
$import->url = (string) $data['rss_import_url'];
$import->forum_id = $values['rss_import_forum_id']->_id;
$import->mid = $values['rss_import_mid']->member_id;
$import->pergo = 10;
$import->time = 30;
$import->showlink = $values['rss_import_showlink'];
$import->topic_open = $values['rss_import_topic_open'];
$import->topic_hide = $values['rss_import_topic_hide'];
$import->topic_pre = $values['rss_import_topic_pre'];
$import->auth = ( $data['rss_import_auth_user'] or $data['rss_import_auth_pass'] );
$import->auth_user = ( $data['rss_import_auth_user'] or $data['rss_import_auth_pass'] ) ? $data['rss_import_auth_user'] : NULL;
$import->auth_pass = ( $data['rss_import_auth_user'] or $data['rss_import_auth_pass'] ) ? $data['rss_import_auth_pass'] : NULL;
$import->save();
try
{
$import->run();
}
catch( \Exception $e )
{
\IPS\Output::i()->error( 'rss_run_error', '3F181/3', 500, '' );
}
\IPS\Db::i()->update( 'core_tasks', array( 'enabled' => 1 ), array( '`key`=?', 'rssimport' ) );
\IPS\Session::i()->log( 'acplog__node_created', array( (string) $import->title => TRUE, (string) $import->title => FALSE ) );
\IPS\Output::i()->redirect( \IPS\Http\Url::internal('app=forums&module=forums&controller=rss' ) );
}
return $form;
}
), \IPS\Http\Url::internal('app=forums&module=forums&controller=rss&do=form') );
}
else
{
return parent::form();
}
}
/**
* Run
*
* @return void
*/
public function run()
{
\IPS\Dispatcher::i()->checkAcpPermission( 'rss_run' );
try
{
$feed = \IPS\forums\Feed::load( \IPS\Request::i()->id );
$feed->run();
}
catch ( \OutOfRangeException $e )
{
\IPS\Output::i()->error( 'node_error', '2F181/1', 404, '' );
}
catch ( \Exception $e )
{
\IPS\Output::i()->error( 'rss_run_error', '3F181/2', 500, '' );
}
\IPS\Session::i()->log( 'acplog__rss_ran', array( $feed->title => FALSE ) );
\IPS\Output::i()->redirect( \IPS\Http\Url::internal('app=forums&module=forums&controller=rss' ) );
}
}
@@ -12,7 +12,7 @@
namespace IPS\forums\modules\admin\forums;
/* To prevent PHP errors (extending class does not exist) revealing path */
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
{
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
exit;
@@ -23,6 +23,11 @@ if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
*/
class _savedActions extends \IPS\Node\Controller
{
/**
* @brief Has been CSRF-protected
*/
public static $csrfProtected = TRUE;
/**
* Node Class
*/
@@ -12,7 +12,7 @@
namespace IPS\forums\modules\admin\forums;
/* To prevent PHP errors (extending class does not exist) revealing path */
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
{
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
exit;
@@ -23,6 +23,11 @@ if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
*/
class _settings extends \IPS\Dispatcher\Controller
{
/**
* @brief Has been CSRF-protected
*/
public static $csrfProtected = TRUE;
/**
* Manage Settings
*
@@ -43,7 +48,8 @@ class _settings extends \IPS\Dispatcher\Controller
}
$activeTab = \IPS\Request::i()->tab ?: 'settings';
$activeTabContents = call_user_func( array( $this, 'manage' . mb_ucfirst( $activeTab ) ) );
$methodFunction = 'manage' . mb_ucfirst( $activeTab );
$activeTabContents = $this->$methodFunction();
if( \IPS\Request::i()->isAjax() and !isset( \IPS\Request::i()->ajaxValidate ) )
{
@@ -64,7 +70,24 @@ class _settings extends \IPS\Dispatcher\Controller
protected function manageArchiving()
{
\IPS\Dispatcher::i()->checkAcpPermission( 'archive_manage' );
if ( \IPS\CIC2 )
{
return \IPS\Cicloud\getForumArchiveForm();
}
else
{
return $this->manageArchivingForm();
}
}
/**
* Archive settings
*
* @return string
*/
protected function manageArchivingForm()
{
\IPS\Output::i()->jsFiles = array_merge( \IPS\Output::i()->jsFiles, \IPS\Output::i()->js( 'admin_settings.js', 'forums', 'admin' ) );
/* Init */
@@ -172,7 +195,7 @@ class _settings extends \IPS\Dispatcher\Controller
'archive_topic_starter_not',
'form_header_archive_topics_where',
'form_header_archive_topics_not_where'
),
)
) ) );
$form->add( new \IPS\Helpers\Form\Radio( 'archive_storage_location', \IPS\Settings::i()->archive_remote_sql_host ? 'remote' : 'local', FALSE, array(
@@ -187,6 +210,7 @@ class _settings extends \IPS\Dispatcher\Controller
$form->add( new \IPS\Helpers\Form\Number( 'archive_sql_port', \IPS\Settings::i()->archive_sql_port ?: ini_get('mysqli.default_port'), FALSE, array(), NULL, NULL, NULL, 'archive_sql_port' ) );
$form->add( new \IPS\Helpers\Form\Text( 'archive_sql_socket', \IPS\Settings::i()->archive_sql_socket ?: ini_get('mysqli.default_socket'), FALSE, array(), NULL, NULL, NULL, 'archive_sql_socket' ) );
$form->add( new \IPS\Helpers\Form\Text( 'archive_sql_tbl_prefix', \IPS\Settings::i()->archive_sql_tbl_prefix ?: NULL, FALSE, array(), NULL, NULL, NULL, 'archive_sql_tbl_prefix' ) );
$form->addHeader( 'archive_topics_where' );
$form->add( new \IPS\Helpers\Form\Custom( 'archive_last_post', isset( $existingValues['archive_last_post'] ) ? $existingValues['archive_last_post'] : array( '>', 0, 'm', TRUE ), FALSE, array( 'getHtml' => array( $this, '_beforeAfterTimeAgo' ), 'validate' => array( $this, '_validateBeforeAfterTimeAgo' ) ), NULL, NULL, NULL, 'archive_last_post' ) );
@@ -221,7 +245,7 @@ class _settings extends \IPS\Dispatcher\Controller
$rules = array();
foreach ( $values as $k => $v )
{
if ( in_array( $k, array( 'archive_last_post' ) ) )
if ( \in_array( $k, array( 'archive_last_post' ) ) )
{
if ( ( !isset( $v[3] ) or !$v[3] ) and $v[1] )
{
@@ -236,7 +260,7 @@ class _settings extends \IPS\Dispatcher\Controller
);
}
}
elseif ( in_array( $k, array( 'archive_not_last_post' ) ) )
elseif ( \in_array( $k, array( 'archive_not_last_post' ) ) )
{
if ( ( !isset( $v[3] ) or !$v[3] ) and $v[1] )
{
@@ -251,7 +275,7 @@ class _settings extends \IPS\Dispatcher\Controller
);
}
}
elseif( in_array( $k, array( 'archive_topic_forums' ) ) )
elseif( \in_array( $k, array( 'archive_topic_forums' ) ) )
{
if ( !empty( $v ) )
{
@@ -266,7 +290,7 @@ class _settings extends \IPS\Dispatcher\Controller
);
}
}
elseif( in_array( $k, array( 'archive_topic_not_forums' ) ) )
elseif( \in_array( $k, array( 'archive_topic_not_forums' ) ) )
{
if ( !empty( $v ) )
{
@@ -281,9 +305,9 @@ class _settings extends \IPS\Dispatcher\Controller
);
}
}
elseif ( in_array( $k, array( 'archive_topic_pinned', 'archive_topic_featured', 'archive_topic_state', 'archive_topic_approved', 'archive_topic_poll' ) ) )
elseif ( \in_array( $k, array( 'archive_topic_pinned', 'archive_topic_featured', 'archive_topic_state', 'archive_topic_approved', 'archive_topic_poll' ) ) )
{
if ( !empty( $v ) and count( $v ) == 1 )
if ( !empty( $v ) and \count( $v ) == 1 )
{
$rules[] = array(
'archive_key' => md5( "forums_{$k}" ),
@@ -296,9 +320,9 @@ class _settings extends \IPS\Dispatcher\Controller
);
}
}
elseif( in_array( $k, array( 'archive_topic_post', 'archive_topic_view', 'archive_topic_rating' ) ) )
elseif( \in_array( $k, array( 'archive_topic_post', 'archive_topic_view', 'archive_topic_rating' ) ) )
{
if ( !isset( $v[2] ) and $v[1] )
if ( !isset( $v[2] ) and $v[1] and $v[0] )
{
$rules[] = array(
'archive_key' => md5( "forums_{$k}" ),
@@ -311,9 +335,9 @@ class _settings extends \IPS\Dispatcher\Controller
);
}
}
elseif( in_array( $k, array( 'archive_not_topic_post', 'archive_not_topic_view', 'archive_not_topic_rating' ) ) )
elseif( \in_array( $k, array( 'archive_not_topic_post', 'archive_not_topic_view', 'archive_not_topic_rating' ) ) )
{
if ( !isset( $v[2] ) and $v[1] )
if ( !isset( $v[2] ) and $v[1] and $v[0] )
{
$rules[] = array(
'archive_key' => md5( "forums_{$k}" ),
@@ -326,9 +350,9 @@ class _settings extends \IPS\Dispatcher\Controller
);
}
}
elseif( in_array( $k, array( 'archive_topic_starter' ) ) )
elseif( \in_array( $k, array( 'archive_topic_starter' ) ) )
{
if ( is_array( $v ) and count( $v ) )
if ( \is_array( $v ) and \count( $v ) )
{
$ids = array();
foreach( $v AS $member )
@@ -347,9 +371,9 @@ class _settings extends \IPS\Dispatcher\Controller
);
}
}
elseif( in_array( $k, array( 'archive_topic_starter_not' ) ) )
elseif( \in_array( $k, array( 'archive_topic_starter_not' ) ) )
{
if ( is_array( $v ) AND count( $v ) )
if ( \is_array( $v ) AND \count( $v ) )
{
$ids = array();
foreach( $v AS $member )
@@ -431,7 +455,7 @@ class _settings extends \IPS\Dispatcher\Controller
$form->saveAsSettings( $settingValues );
\IPS\Db::i()->delete( 'forums_archive_rules' );
if ( count( $rules ) )
if ( \count( $rules ) )
{
\IPS\Db::i()->insert( 'forums_archive_rules', $rules );
}
@@ -531,6 +555,8 @@ class _settings extends \IPS\Dispatcher\Controller
if ( isset( \IPS\Request::i()->confirm ) )
{
\IPS\Session::i()->csrfCheck();
if ( \IPS\Settings::i()->archive_on )
{
$whereClause = \IPS\Db::i()->compileWhereClause( \IPS\Application::load('forums')->archiveWhere( \IPS\Db::i()->select( '*', 'forums_archive_rules' ) ) );
@@ -552,7 +578,7 @@ class _settings extends \IPS\Dispatcher\Controller
else
{
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate( 'global', 'core' )->decision( 'uanrchive_settings_change', array(
'restore_unmatched_settings' => \IPS\Http\Url::internal( 'app=forums&module=forums&controller=settings&do=unarchive&confirm=1' ),
'restore_unmatched_settings' => \IPS\Http\Url::internal( 'app=forums&module=forums&controller=settings&do=unarchive&confirm=1' )->csrf(),
'leave_archived_topics' => \IPS\Http\Url::internal( 'app=forums&module=forums&controller=settings&tab=archiving' ),
) );
}
@@ -590,13 +616,31 @@ class _settings extends \IPS\Dispatcher\Controller
'fluid' => 'forums_default_view_fluid'
)
), function( $value ) {
if( $value !== '*' AND count( $value ) !== 0 AND count( $value ) < 2 )
if( $value !== '*' AND \count( $value ) !== 0 AND \count( $value ) < 2 )
{
throw new \DomainException( 'forums_default_view_choose_error' );
}
} ) );
$form->add( new \IPS\Helpers\Form\Number( 'forums_topics_per_page', \IPS\Settings::i()->forums_topics_per_page , TRUE, array( 'min' => 5, 'max' => 100 ) ) );
$form->add( new \IPS\Helpers\Form\Radio( 'forums_view_list_method', \IPS\Settings::i()->forums_view_list_method, FALSE, array(
'options' => array(
'list' => 'forums_topic_list_list',
'snippet' => 'forums_topic_list_snippet'
),
) ) );
$form->add( new \IPS\Helpers\Form\YesNo( 'forums_view_list_choose', \IPS\Settings::i()->forums_view_list_choose, FALSE, array(), NULL, NULL, NULL, 'forums_view_list_choose' ) );
$form->addHeader('question_settings');
$form->add( new \IPS\Helpers\Form\YesNo( 'forums_questions_downvote', \IPS\Settings::i()->forums_questions_downvote ) );
$form->add( new \IPS\Helpers\Form\YesNo( 'forums_answers_downvote', \IPS\Settings::i()->forums_answers_downvote ) );
$form->add( new \IPS\Helpers\Form\Radio( 'forums_new_questions', \IPS\Settings::i()->forums_new_questions, FALSE, array( 'options' => array( '0' => 'forums_new_questions_best', '1' => 'forums_new_questions_any' ) ) ) );
$form->addHeader('topic_settings');
$popularNowMaximum = 14400000;
$form->add( new \IPS\Helpers\Form\Custom( 'forums_popular_now', json_decode( \IPS\Settings::i()->forums_popular_now, TRUE ), FALSE, array(
'getHtml' => function( $obj ) use ( $popularNowMaximum )
@@ -606,18 +650,38 @@ class _settings extends \IPS\Dispatcher\Controller
/* If popular now time is greater than 10,000 days */
'validate' => function( $obj ) use ( $popularNowMaximum )
{
if( $obj->value['minutes'] > $popularNowMaximum )
if( isset( $obj->value['minutes'] ) AND $obj->value['minutes'] > $popularNowMaximum )
{
throw new \LengthException( \IPS\Member::loggedIn()->language()->addToStack('form_number_max', FALSE, array( 'sprintf' => array( $popularNowMaximum ) ) ) );
}
}
) ) );
$form->add( new \IPS\Helpers\Form\Number( 'forums_posts_per_page', \IPS\Settings::i()->forums_posts_per_page , TRUE, array( 'min' => 2, 'max' => 250 ) ) );
$form->add( new \IPS\Helpers\Form\Number( 'forums_topics_per_page', \IPS\Settings::i()->forums_topics_per_page , TRUE, array( 'min' => 5, 'max' => 100 ) ) );
$form->addHeader('question_settings');
$form->add( new \IPS\Helpers\Form\YesNo( 'forums_questions_downvote', \IPS\Settings::i()->forums_questions_downvote ) );
$form->add( new \IPS\Helpers\Form\YesNo( 'forums_answers_downvote', \IPS\Settings::i()->forums_answers_downvote ) );
$form->add( new \IPS\Helpers\Form\Radio( 'forums_new_questions', \IPS\Settings::i()->forums_new_questions, FALSE, array( 'options' => array( '0' => 'forums_new_questions_best', '1' => 'forums_new_questions_any' ) ) ) );
$form->add( new \IPS\Helpers\Form\CheckboxSet( 'forums_topics_show_meta', \IPS\Settings::i()->forums_topics_show_meta ? json_decode( \IPS\Settings::i()->forums_topics_show_meta, TRUE ) : array(), FALSE, array(
'options' => array(
'time' => 'forums_topic_show_meta_time',
'moderation' => 'forums_topic_show_meta_moderation'
) ) ) );
$form->addHeader('topic_summary_settings');
$form->add( new \IPS\Helpers\Form\CheckboxSet( 'forums_topic_activity', \IPS\Settings::i()->forums_topic_activity ? json_decode( \IPS\Settings::i()->forums_topic_activity, TRUE ) : NULL, FALSE, array(
'options' => array( 'desktop' => 'forums_topic_activity_desktop_on', 'mobile' => 'forums_topic_activity_mobile_on' ),
'toggles' => array( 'desktop' => array( 'forums_topic_activity_desktop' ) )
) ) );
$form->add( new \IPS\Helpers\Form\Radio( 'forums_topic_activity_desktop', \IPS\Settings::i()->forums_topic_activity_desktop, FALSE, array( 'options' => array( 'sidebar' => 'forums_topic_activity_desktop_sidebar', 'post' => 'forums_topic_activity_desktop_post' ) ), NULL, NULL, NULL, 'forums_topic_activity_desktop' ) );
$form->add( new \IPS\Helpers\Form\Number( 'forums_topics_activity_pages_show', \IPS\Settings::i()->forums_topics_activity_pages_show , TRUE, array( 'unlimited' => 0, 'unlimitedLang'=> 'forums_topics_activity_pages_show_unlimited', 'min' => 0, 'max' => 100 ), NULL, \IPS\Member::loggedIn()->language()->addToStack('forums_topics_activity_pages_show_prefix') ) );
$form->add( new \IPS\Helpers\Form\CheckboxSet( 'forums_topic_activity_features', \IPS\Settings::i()->forums_topic_activity_features ? json_decode( \IPS\Settings::i()->forums_topic_activity_features, TRUE ) : array(), FALSE, array(
'options' => array(
'popularDays' => 'forums_topic_activity_features_popularDays',
'topPost' => 'forums_topic_activity_features_topPost',
'uploads' => 'forums_topic_activity_features_uploads'
) ) ) );
if ( $values = $form->values() )
{
@@ -632,7 +696,22 @@ class _settings extends \IPS\Dispatcher\Controller
if ( isset( $values['forums_default_view_choose'] ) )
{
$values['forums_default_view_choose'] = ( is_array( $values['forums_default_view_choose'] ) AND !count( $values['forums_default_view_choose'] ) ) ? NULL : json_encode( $values['forums_default_view_choose'] );
$values['forums_default_view_choose'] = ( \is_array( $values['forums_default_view_choose'] ) AND !\count( $values['forums_default_view_choose'] ) ) ? NULL : json_encode( $values['forums_default_view_choose'] );
}
if ( isset( $values['forums_topic_activity'] ) )
{
$values['forums_topic_activity'] = json_encode( $values['forums_topic_activity'] );
}
if ( isset( $values['forums_topic_activity_features'] ) )
{
$values['forums_topic_activity_features'] = json_encode( $values['forums_topic_activity_features'] );
}
if ( isset( $values['forums_topics_show_meta'] ) )
{
$values['forums_topics_show_meta'] = json_encode( $values['forums_topics_show_meta'] );
}
$form->saveAsSettings( $values );
@@ -12,7 +12,7 @@
namespace IPS\forums\modules\admin\stats;
/* To prevent PHP errors (extending class does not exist) revealing path */
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
{
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
exit;
@@ -23,6 +23,11 @@ if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
*/
class _posts extends \IPS\Dispatcher\Controller
{
/**
* @brief Has been CSRF-protected
*/
public static $csrfProtected = TRUE;
/**
* Manage
*
@@ -59,7 +64,6 @@ class _posts extends \IPS\Dispatcher\Controller
'areaOpacity' => 0.4,
'chartArea' => array( 'width' => '70%', 'left' => '5%' ),
'height' => 400,
'trendlines' => array( 0 => array( 'type' => 'exponential', 'color' => '#000', 'lineWidth' => 2, 'opacity' => 0.3 ) )
),
'ColumnChart',
'monthly',
@@ -12,7 +12,7 @@
namespace IPS\forums\modules\admin\stats;
/* To prevent PHP errors (extending class does not exist) revealing path */
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
{
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
exit;
@@ -23,6 +23,11 @@ if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
*/
class _topics extends \IPS\Dispatcher\Controller
{
/**
* @brief Has been CSRF-protected
*/
public static $csrfProtected = TRUE;
/**
* Manage
*
@@ -62,7 +67,6 @@ class _topics extends \IPS\Dispatcher\Controller
'areaOpacity' => 0.4,
'chartArea' => array( 'width' => '70%', 'left' => '5%' ),
'height' => 400,
'trendlines' => array( 0 => array( 'type' => 'exponential', 'color' => '#000', 'lineWidth' => 2, 'opacity' => 0.3 ) )
),
'ColumnChart',
'monthly',