Version 4.1.2

This commit is contained in:
Neo committed 2025-12-19 05:32:19 -08:00
1 parent 3ba79295ee
commit 28bd025b35
1131 files changed
+63658 -20579

No files matched your search

@@ -167,7 +167,6 @@ class _advanced extends \IPS\Dispatcher\Controller
$options = array(
'None' => 'datastore_method_None',
'Apc' => 'datastore_method_Apc',
'Eaccelerator' => 'datastore_method_Eaccelerator',
'Memcache' => 'datastore_method_Memcache',
'Redis' => 'datastore_method_Redis',
'Wincache' => 'datastore_method_Wincache',
@@ -329,6 +328,7 @@ class _advanced extends \IPS\Dispatcher\Controller
}
}, NULL, NULL, 'task_use_cron' ) );
$form->add( new \IPS\Helpers\Form\Number( 'widget_cache_ttl', ( isset( \IPS\Settings::i()->widget_cache_ttl ) ) ? \IPS\Settings::i()->widget_cache_ttl : 60, FALSE, array( 'min' => 60 ), NULL, \IPS\Member::loggedIn()->language()->addToStack('for'), \IPS\Member::loggedIn()->language()->addToStack('seconds') ) );
$form->add( new \IPS\Helpers\Form\YesNo( 'auto_polling_enabled', \IPS\Settings::i()->auto_polling_enabled, FALSE ) );
if ( $values = $form->values() )
{
@@ -630,6 +630,7 @@ class _advanced extends \IPS\Dispatcher\Controller
$definition = \IPS\Http\Url::furlDefinition();
$table = new \IPS\Helpers\Table\Custom( $definition, \IPS\Http\Url::internal( 'app=core&module=settings&controller=advanced&tab=furl' ) );
$table->include = array( 'friendly', 'real' );
$table->limit = 100;
$table->langPrefix = 'furl_';
$table->mainColumn = 'real';
$table->parsers = array(
@@ -735,12 +736,13 @@ class _advanced extends \IPS\Dispatcher\Controller
{
$furl = \IPS\Settings::i()->furl_configuration ? json_decode( \IPS\Settings::i()->furl_configuration, TRUE ) : array();
$save = array(
'friendly' => $values['furl_friendly'],
'real' => $values['furl_real'],
'custom' => true
);
$currentDefinition = \IPS\Http\Url::furlDefinition();
$save = \IPS\Request::i()->key ? $currentDefinition[ \IPS\Request::i()->key ] : array();
$save['friendly'] = $values['furl_friendly'];
$save['real'] = $values['furl_real'];
$save['custom'] = true;
if ( \IPS\Request::i()->key )
{
$furl[ \IPS\Request::i()->key ] = $save;
@@ -56,10 +56,12 @@ class _email extends \IPS\Dispatcher\Controller
'options' => array( 'mail' => 'mail_method_php', 'smtp' => 'mail_method_smtp' ),
'toggles' => array(
'mail' => array( 'php_mail_extra' ),
'smtp' => array( 'smtp_host', 'smtp_port', 'smtp_user', 'smtp_pass', 'smtp_helo' )
'smtp' => array( 'smtp_host', 'smtp_port', 'smtp_user', 'smtp_pass', 'smtp_helo', 'smtp_protocol' )
)
) ) );
$options = array( 'plain' => 'smtp_plaintext', 'ssl' => 'smtp_ssl', 'tls' => 'smtp_tls' );
$settingsForm->add( new \IPS\Helpers\Form\Text( 'smtp_host', \IPS\Settings::i()->smtp_host, FALSE, array(), NULL, NULL, NULL, 'smtp_host' ) );
$settingsForm->add( new \IPS\Helpers\Form\Select( 'smtp_protocol', \IPS\Settings::i()->smtp_protocol, FALSE, array( 'options' => $options ), NULL, NULL, NULL, 'smtp_protocol' ) );
$settingsForm->add( new \IPS\Helpers\Form\Number( 'smtp_port', \IPS\Settings::i()->smtp_port, FALSE, array(), NULL, NULL, NULL, 'smtp_port' ) );
$settingsForm->add( new \IPS\Helpers\Form\Text( 'smtp_user', \IPS\Settings::i()->smtp_user, FALSE, array(), NULL, NULL, NULL, 'smtp_user' ) );
$settingsForm->add( new \IPS\Helpers\Form\Password( 'smtp_pass', \IPS\Settings::i()->smtp_pass, FALSE, array(), NULL, NULL, NULL, 'smtp_pass' ) );
@@ -68,7 +70,7 @@ class _email extends \IPS\Dispatcher\Controller
{
$sendTestEmail = FALSE;
foreach( array( 'mail_method', 'smtp_host', 'smtp_port', 'smtp_pass', 'smtp_user', 'php_mail_extra' ) as $setting )
foreach( array( 'mail_method', 'smtp_host', 'smtp_port', 'smtp_pass', 'smtp_user', 'php_mail_extra', 'smtp_protocol' ) as $setting )
{
if( $values[ $setting ] != \IPS\Settings::i()->$setting )
{
@@ -49,19 +49,12 @@ class _general extends \IPS\Dispatcher\Controller
$form->add( new \IPS\Helpers\Form\Editor( 'site_offline_message', \IPS\Settings::i()->site_offline_message, FALSE, array( 'app' => 'core', 'key' => 'Admin', 'autoSaveKey' => 'onlineoffline', 'attachIds' => array( NULL, NULL, 'site_offline_message' ) ), NULL, NULL, NULL, 'site_offline_message_id' ) );
$form->add( new \IPS\Helpers\Form\Address( 'site_address', \IPS\GeoLocation::buildFromJson( \IPS\Settings::i()->site_address ), FALSE ) );
$form->add( new \IPS\Helpers\Form\Translatable( 'copyright_line', NULL, FALSE, array( 'app' => 'core', 'key' => 'copyright_line_value', 'placeholder' => \IPS\Member::loggedIn()->language()->addToStack('copyright_line_placeholder') ) ) );
$form->addHeader( 'home_link' );
$form->add( new \IPS\Helpers\Form\YesNo( 'show_home_link', \IPS\Settings::i()->show_home_link, FALSE, array(
'togglesOn' => array( 'home_name', 'home_url' ),
) ) );
$form->add( new \IPS\Helpers\Form\Translatable( 'home_name', NULL, FALSE, array( 'placeholder' => \IPS\Member::loggedIn()->language()->addToStack('home_name_placeholder'), 'app' => 'core', 'key' => 'home_name_value' ), NULL, NULL, NULL, 'home_name' ) );
$form->add( new \IPS\Helpers\Form\Url( 'home_url', \IPS\Settings::i()->home_url, FALSE, array( 'placeholder' => \IPS\Member::loggedIn()->language()->addToStack('home_url_placeholder') ), NULL, NULL, NULL, 'home_url' ) );
$form->add( new \IPS\Helpers\Form\Stack( 'upgrade_email', explode( ',', \IPS\Settings::i()->upgrade_email ), FALSE, array( 'stackFieldType' => 'Email' ) ) );
if ( $values = $form->values() )
{
\IPS\Lang::saveCustom( 'core', "copyright_line_value", $values['copyright_line'] );
\IPS\Lang::saveCustom( 'core', "home_name_value", $values['home_name'] );
unset( $values['copyright_line'], $values['home_name'] );
unset( $values['copyright_line'] );
$form->saveAsSettings();
@@ -7,7 +7,6 @@
* @package IPS Social Suite
* @since 17 Apr 2013
* @version SVN_VERSION_NUMBER
* @modified 13.09.2015 by IAF
*/
namespace IPS\core\modules\admin\settings;
@@ -96,29 +95,9 @@ class _licensekey extends \IPS\Dispatcher\Controller
protected function settings()
{
$form = new \IPS\Helpers\Form;
$form->addHeader('ipb_license_edit_main');
$form->add( new \IPS\Helpers\Form\Text( 'ipb_reg_number', \IPS\Settings::i()->ipb_reg_number, TRUE ) );
$form->add( new \IPS\Helpers\Form\YesNo( 'ipb_license_active', \IPS\Settings::i()->ipb_license_active ) );
$form->add( new \IPS\Helpers\Form\Text( 'ipb_license_expires', \IPS\Settings::i()->ipb_license_expires ) );
$form->add( new \IPS\Helpers\Form\YesNo( 'ipb_license_cloud', \IPS\Settings::i()->ipb_license_cloud ) );
$form->addHeader('ipb_license_urls');
$form->add( new \IPS\Helpers\Form\Text( 'ipb_license_url', \IPS\Settings::i()->ipb_license_url ) );
$form->add( new \IPS\Helpers\Form\Text( 'ipb_license_test_url', \IPS\Settings::i()->ipb_license_test_url ) );
$form->addHeader('ipb_license_components');
$form->add( new \IPS\Helpers\Form\YesNo( 'ipb_license_product_forums', \IPS\Settings::i()->ipb_license_product_forums ) );
$form->add( new \IPS\Helpers\Form\YesNo( 'ipb_license_product_calendar', \IPS\Settings::i()->ipb_license_product_calendar ) );
$form->add( new \IPS\Helpers\Form\YesNo( 'ipb_license_product_blog', \IPS\Settings::i()->ipb_license_product_blog ) );
$form->add( new \IPS\Helpers\Form\YesNo( 'ipb_license_product_gallery', \IPS\Settings::i()->ipb_license_product_gallery ) );
$form->add( new \IPS\Helpers\Form\YesNo( 'ipb_license_product_downloads', \IPS\Settings::i()->ipb_license_product_downloads ) );
$form->add( new \IPS\Helpers\Form\YesNo( 'ipb_license_product_cms', \IPS\Settings::i()->ipb_license_product_cms ) );
$form->add( new \IPS\Helpers\Form\YesNo( 'ipb_license_product_nexus', \IPS\Settings::i()->ipb_license_product_nexus ) );
$form->add( new \IPS\Helpers\Form\YesNo( 'ipb_license_product_copyright', \IPS\Settings::i()->ipb_license_product_copyright ) );
$form->addHeader('ipb_license_services');
$form->add( new \IPS\Helpers\Form\Text( 'ipb_license_chat_limit', \IPS\Settings::i()->ipb_license_chat_limit ) );
$form->add( new \IPS\Helpers\Form\Text( 'ipb_license_support', \IPS\Settings::i()->ipb_license_support ) );
$form->add( new \IPS\Helpers\Form\Text( 'ipb_reg_number', NULL, TRUE, array(), function( $val ){
\IPS\IPS::checkLicenseKey( $val, \IPS\Settings::i()->base_url );
} ) );
if ( $values = $form->values() )
{
@@ -141,6 +120,4 @@ class _licensekey extends \IPS\Dispatcher\Controller
\IPS\Output::i()->title = \IPS\Member::loggedIn()->language()->addToStack('license_settings');
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate( 'global' )->block( 'menu__core_settings_licensekey', $form );
}
}
/* Nulled by IandroidFan (IAF) */
}
@@ -56,7 +56,7 @@ class _posting extends \IPS\Dispatcher\Controller
{
$this->tabs['urlFilters'] = 'url_settings';
}
/* Choose active tab */
if ( isset( \IPS\Request::i()->tab ) and array_key_exists( \IPS\Request::i()->tab, $this->tabs ) )
{
@@ -112,12 +112,14 @@ class _posting extends \IPS\Dispatcher\Controller
) ) );
$form->add( new \IPS\Helpers\Form\Text( 'attach_allowed_extensions', \IPS\Settings::i()->attach_allowed_extensions ? explode( ',', \IPS\Settings::i()->attach_allowed_extensions ) : NULL, FALSE, array( 'nullLang' => 'no_restriction', 'autocomplete' => array( 'freeChoice' => TRUE, 'source' => array( 'doc', 'docx', 'log', 'msg', 'odt', 'pages', 'rtf', 'tex', 'txt', 'wpd', 'wps', 'csv', 'dat', 'gbr', 'ged', 'key', 'keychain', 'pps', 'ppt', 'pptx', 'sdf', 'tar', 'tax2012', 'tax2014', 'vcf', 'xml', 'aif', 'iff', 'm3u', 'm4a', 'mid', 'mp3', 'mpa', 'ra', 'wav', 'wma', '3g2', '3gp', 'asf', 'asx', 'avi', 'flv', 'm4v', 'mov', 'mp4', 'mpg', 'rm', 'srt', 'swf', 'vob', 'wmv', '3dm', '3ds', 'max', 'obj', 'bmp', 'dds', 'gif', 'jpg', 'png', 'psd', 'pspimage', 'tga', 'thm', 'tif', 'tiff', 'yuv', 'ai', 'eps', 'ps', 'svg', 'indd', 'pct', 'pdf', 'xlr', 'xls', 'xlsx', 'accdb', 'db', 'dbf', 'mdb', 'pdb', 'sql', 'apk', 'app', 'bat', 'cgi', 'com', 'exe', 'gadget', 'jar', 'pif', 'vb', 'wsf', 'dem', 'gam', 'nes', 'rom', 'sav', 'dwg', 'dxf', 'gpx', 'kml', 'kmz', 'asp', 'aspx', 'cer', 'cfm', 'csr', 'css', 'htm', 'html', 'js', 'jsp', 'php', 'rss', 'xhtml', 'crx', 'plugin', 'fnt', 'fon', 'otf', 'ttf', 'cab', 'cpl', 'cur', 'deskthemepack', 'dll', 'dmp', 'drv', 'icns', 'ico', 'lnk', 'sys', 'cfg', 'ini', 'prf', 'hqx', 'mim', 'uue', '7z', 'cbr', 'deb', 'gz', 'pkg', 'rar', 'rpm', 'sitx', 'tar.gz', 'zip', 'zipx', 'bin', 'cue', 'dmg', 'iso', 'mdf', 'toast', 'vcd', 'c', 'class', 'cpp', 'cs', 'dtd', 'fla', 'h', 'java', 'lua', 'm', 'pl', 'py', 'sh', 'sln', 'swift', 'vcxproj', 'xcodeproj', 'bak', 'tmp', 'crdownload', 'ics', 'msi', 'part', 'torrent' ) ) ), NULL, NULL, NULL, 'attach_allowed_extensions' ) );
$form->addHeader('posting_images');
$form->add( new \IPS\Helpers\Form\WidthHeight( 'attachment_resample_size', \IPS\Settings::i()->attachment_resample_size ? explode( 'x', \IPS\Settings::i()->attachment_resample_size ) : array( 0, 0 ), FALSE, array( 'resizableDiv' => FALSE, 'unlimited' => array( 0, 0 ) ), NULL, NULL, NULL, 'attachment_resample_size' ) );
$form->add( new \IPS\Helpers\Form\YesNo( 'allow_remote_images', \IPS\Settings::i()->allow_remote_images, FALSE, array( 'togglesOn' => array( 'remote_image_proxy' ) ) ) );
$form->add( new \IPS\Helpers\Form\YesNo( 'remote_image_proxy', \IPS\Settings::i()->remote_image_proxy, FALSE, array(), NULL, NULL, NULL, 'remote_image_proxy' ) );
$form->add( new \IPS\Helpers\Form\WidthHeight( 'attachment_resample_size', \IPS\Settings::i()->attachment_resample_size ? explode( 'x', \IPS\Settings::i()->attachment_resample_size ) : array( 0, 0 ), FALSE, array( 'resizableDiv' => FALSE, 'unlimited' => array( 0, 0 ) ), NULL, NULL, NULL, 'attachment_resample_size' ) );
$current = ( isset( \IPS\Settings::i()->attachment_image_size ) ) ? explode( 'x', \IPS\Settings::i()->attachment_image_size ) : array( 1000, 750 );
$form->add( new \IPS\Helpers\Form\WidthHeight( 'attachment_image_size', $current, FALSE, array( 'resizableDiv' => FALSE ), NULL, NULL, NULL, 'attachment_image_size' ) );
$form->add( new \IPS\Helpers\Form\Number( 'max_video_width', \IPS\Settings::i()->max_video_width, FALSE, array( 'unlimited' => 0 ), NULL, NULL, 'px' ) );
$form->addHeader('posting_content');
$form->add( new \IPS\Helpers\Form\YesNo( 'strip_quotes', !\IPS\Settings::i()->strip_quotes, FALSE, array(), NULL, NULL, NULL, 'strip_quotes' ) );
$form->add( new \IPS\Helpers\Form\Number( 'max_title_length', \IPS\Settings::i()->max_title_length, FALSE, array( 'max' => 255 ), NULL, NULL, \IPS\Member::loggedIn()->language()->addToStack('max_title_length_suffix') ) );
$form->add( new \IPS\Helpers\Form\Number( 'merge_concurrent_posts', \IPS\Settings::i()->merge_concurrent_posts, FALSE, array( 'unlimited' => 0, 'unlimitedLang' => 'never' ), NULL, NULL, \IPS\Member::loggedIn()->language()->addToStack('minutes') ) );
$form->add( new \IPS\Helpers\Form\Number( 'flood_control', \IPS\Settings::i()->flood_control, FALSE, array( 'unlimited' => 0, 'unlimitedLang' => 'none' ), NULL, NULL, \IPS\Member::loggedIn()->language()->addToStack('seconds') ) );
@@ -169,7 +171,6 @@ class _posting extends \IPS\Dispatcher\Controller
{
$clearCss = ( $values['max_video_width'] !== \IPS\Settings::i()->max_video_width );
$values['strip_quotes'] = $values['strip_quotes'] ? FALSE : TRUE;
$values['attachment_resample_size'] = implode( 'x', $values['attachment_resample_size'] );
$values['attachment_image_size'] = implode( 'x', $values['attachment_image_size'] );
$values['attach_allowed_extensions'] = is_array( $values['attach_allowed_extensions'] ) ? implode( ',', array_unique( array_map( function( $val )
@@ -328,33 +329,13 @@ class _posting extends \IPS\Dispatcher\Controller
{
$values['ipb_url_whitelist'] = implode( ",", $values['ipb_url_whitelist'] );
$values['ipb_url_blacklist'] = implode( ",", $values['ipb_url_blacklist'] );
/* We need to clean these up */
$nofollowExclude = array();
foreach( $values['posts_add_nofollow_exclude'] as $domain )
{
/* We only want to compare against the domain, not the full URL */
$domain = str_replace( array( 'http://', 'https://' ), '', $domain );
/* And we are comparing against the non-www. version during parsing */
$domain = preg_replace( '/^www\./', '', $domain );
/* Use the domain as the key as well to prevent duplicates for efficiency purposes */
$nofollowExclude[ $domain ] = $domain;
}
$values['posts_add_nofollow_exclude'] = json_encode( array_values( $nofollowExclude ) );
$values['posts_add_nofollow_exclude'] = json_encode( $values['posts_add_nofollow_exclude'] );
$form->saveAsSettings( $values );
/* Clear guest page caches */
\IPS\Data\Cache::i()->clearAll();
\IPS\Session::i()->log( 'acplogs__url_filter_settings' );
/* Redirect otherwise our changes to posts_add_nofollow_exclude won't reflect initially */
\IPS\Output::i()->redirect( \IPS\Http\Url::internal( 'app=core&module=settings&controller=posting&tab=urlFilters' ), 'saved' );
}
return $form;
@@ -1,242 +0,0 @@
<?php
/**
* @brief Search settings
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Social Suite
* @since 14 Apr 2014
* @version SVN_VERSION_NUMBER
*/
namespace IPS\core\modules\admin\settings;
/* 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;
}
/**
* Search settings
*/
class _search extends \IPS\Dispatcher\Controller
{
/**
* Execute
*
* @return void
*/
public function execute()
{
\IPS\Dispatcher::i()->checkAcpPermission( 'search_manage' );
parent::execute();
}
/**
* Manage Settings
*
* @return void
* @note There is a hardcoded check for Sphinx here
* @todo The lang string replacements need to be checked <- checked for what?
*/
protected function manage()
{
/* Rebuild button */
\IPS\Output::i()->sidebar['actions'] = array(
'rebuildIndex' => array(
'title' => 'search_rebuild_index',
'icon' => 'undo',
'link' => \IPS\Http\Url::internal( 'app=core&module=settings&controller=search&do=queueIndexRebuild' ),
'data' => array( 'confirm' => '', 'confirmSubMessage' => \IPS\Member::loggedIn()->language()->get('search_rebuild_index_confirm') ),
),
);
\IPS\Member::loggedIn()->language()->words['search_engine__sphinx_desc'] = sprintf( \IPS\Member::loggedIn()->language()->get('search_engine__sphinx_desc'), \IPS\Settings::i()->sphinx_base_path . '/sphinx.conf' );
$form = new \IPS\Helpers\Form;
$form->add( new \IPS\Helpers\Form\Radio( 'search_engine', isset( \IPS\Request::i()->search_sphinx_server ) ? 'sphinx' : \IPS\Settings::i()->search_engine, TRUE, array( 'options' => $this->_getEngines(), 'toggles' => array( 'mysql' => array( 'search_index_timeframe' ), 'sphinx' => array( 'form_header_sphinx_header', 'form_header_sphinx_instructions', 'search_sphinx_server', 'search_sphinx_port', 'sphinx_base_path', 'sphinx_prefix' ) ) ) ) );
$form->add( new \IPS\Helpers\Form\Number( 'search_index_timeframe', \IPS\Settings::i()->search_index_timeframe, FALSE, array( 'unlimited' => 0, 'unlimitedLang' => 'all' ), NULL, \IPS\Member::loggedIn()->language()->addToStack('search_index_timeframe_prefix'), \IPS\Member::loggedIn()->language()->addToStack('search_index_timeframe_suffix'), 'search_index_timeframe' ) );
$form->addHeader( 'sphinx_header' );
if ( \IPS\Settings::i()->search_engine == 'sphinx' )
{
$form->addMessage( 'sphinx_instructions', '', TRUE, 'form_header_sphinx_instructions' );
}
$form->add( new \IPS\Helpers\Form\Text( 'search_sphinx_server', \IPS\Settings::i()->search_sphinx_server, FALSE, array(), function( $val )
{
if ( $val === 'localhost' )
{
throw new \DomainException('search_sphinx_server_err');
}
}, NULL, NULL, 'search_sphinx_server' ) );
$form->add( new \IPS\Helpers\Form\Number( 'search_sphinx_port', \IPS\Settings::i()->search_sphinx_port, FALSE, array( 'placeholder' => "3312" ), NULL, NULL, NULL, 'search_sphinx_port' ) );
$form->add( new \IPS\Helpers\Form\Text( 'sphinx_base_path', \IPS\Settings::i()->sphinx_base_path, FALSE, array( 'placeholder' => "/var/sphinx" ), NULL, NULL, NULL, 'sphinx_base_path' ) );
$form->add( new \IPS\Helpers\Form\Text( 'sphinx_prefix', \IPS\Settings::i()->sphinx_prefix, FALSE, array(), NULL, NULL, NULL, 'sphinx_prefix' ) );
if ( $values = $form->values() )
{
$existing = \IPS\Settings::i()->search_engine;
$indexPrune = \IPS\Settings::i()->search_index_timeframe;
/* Did we just enable Sphinx? If so, we need some more instructions... */
if( $existing != $values['search_engine'] and $values['search_engine'] === 'sphinx' )
{
\IPS\Output::i()->redirect( \IPS\Http\Url::internal( 'app=core&module=settings&controller=search&do=sphinxInstructions' )->setQueryString( $values ) );
}
/* Otherwise go ahead and save... */
$form->saveAsSettings();
\IPS\Session::i()->log( 'acplogs__search_settings' );
/* And re-index if setting updated */
if( $existing != $values['search_engine'] or $indexPrune != $values['search_index_timeframe'] )
{
\IPS\Content\Search\Index::i()->rebuild();
}
}
\IPS\Output::i()->title = \IPS\Member::loggedIn()->language()->addToStack('menu__core_settings_search');
\IPS\Output::i()->output .= \IPS\Theme::i()->getTemplate( 'global' )->block( 'menu__core_settings_search', $form );
}
/**
* Show Sphinx instructions
*
* @return void
*/
public function sphinxInstructions()
{
$configuration = array();
foreach ( array( 'search_sphinx_server', 'search_sphinx_port', 'sphinx_prefix', 'sphinx_base_path' ) as $k )
{
$configuration[ $k ] = isset( \IPS\Request::i()->$k ) ? \IPS\Request::i()->$k : '';
}
$error = NULL;
if ( isset( \IPS\Request::i()->check ) )
{
try
{
$database = \IPS\Db::i( 'SPHINXQL', array(
'sql_host' => \IPS\Request::i()->search_sphinx_server,
'sql_user' => NULL,
'sql_pass' => NULL,
'sql_database' => NULL,
'sql_port' => (int) \IPS\Request::i()->search_sphinx_port,
'sql_socket' => NULL,
'sql_utf8mb4' => NULL,
) );
$result = $database->query("SHOW STATUS");
\IPS\Db::i()->update( 'core_sys_conf_settings', array( 'conf_value' => 'sphinx' ), array( 'conf_key=?', 'search_engine' ) );
foreach ( $configuration as $k => $v )
{
\IPS\Db::i()->update( 'core_sys_conf_settings', array( 'conf_value' => $v ), array( 'conf_key=?', $k ) );
\IPS\Settings::i()->$k = $v;
}
unset( \IPS\Data\Store::i()->settings );
\IPS\Session::i()->log( 'acplogs__search_settings' );
\IPS\Content\Search\Index::i()->rebuild();
\IPS\Output::i()->redirect( \IPS\Http\Url::internal( 'app=core&module=settings&controller=search' ), 'sphinx_setup_successful' );
}
catch( \Exception $exception )
{
\IPS\Log::i( \LOG_INFO )->write( get_class( $exception ) . "\n" . $exception->getCode() . ": " . $exception->getMessage() . "\n" . $exception->getTraceAsString() );
$error = 'sphinx_appear_invalid';
}
}
$configurationUrl = \IPS\Http\Url::internal( 'app=core&module=settings&controller=search&do=sphinxConfiguration' )->setQueryString( $configuration );
\IPS\Output::i()->title = \IPS\Member::loggedIn()->language()->addToStack('sphinx_header');
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate( 'settings' )->sphinxInstructions( $configurationUrl, $error );
}
/**
* Get Sphinx conifguration file
*
* @return void
*/
public function sphinxConfiguration()
{
$server = isset( \IPS\Request::i()->search_sphinx_server ) ? \IPS\Request::i()->search_sphinx_server : \IPS\Settings::i()->search_sphinx_server;
$port = isset( \IPS\Request::i()->search_sphinx_port ) ? \IPS\Request::i()->search_sphinx_port : \IPS\Settings::i()->search_sphinx_port;
$prefix = isset( \IPS\Request::i()->sphinx_prefix ) ? \IPS\Request::i()->sphinx_prefix : \IPS\Settings::i()->sphinx_prefix;
$path = isset( \IPS\Request::i()->sphinx_base_path ) ? \IPS\Request::i()->sphinx_base_path : \IPS\Settings::i()->sphinx_base_path;
$collation = 'utf8_general_ci';
$sphinxConfiguration = <<<SPHINX
searchd
{
listen = {$server}:{$port}:mysql41
max_children = 30
pid_file = {$path}/buildsearchd.pid
preopen_indexes = 0
collation_server = {$collation}
workers = threads
}
index {$prefix}ips
{
type = rt
path = {$path}/index
rt_field = index_title
rt_field = index_content
rt_field = index_tags
rt_attr_bigint = index_object_id
rt_attr_bigint = index_item_id
rt_attr_bigint = index_container_id
rt_attr_bigint = index_author
rt_attr_bigint = index_views
rt_attr_bigint = index_num_comments
rt_attr_bigint = index_num_reviews
rt_attr_json = index_permissions
rt_attr_timestamp = index_date_created
rt_attr_timestamp = index_date_updated
rt_attr_string = index_class
rt_attr_uint = index_class_id
rt_attr_uint = index_hidden
}
SPHINX;
\IPS\Output::i()->sendOutput( $sphinxConfiguration, 200, 'application/octet-stream', array( 'Content-Disposition' => 'attachment; filename=sphinx.conf' ) );
}
/**
* Get the array of engine options
*
* @return array
*/
protected function _getEngines()
{
$engines = array();
foreach ( new \DirectoryIterator( \IPS\ROOT_PATH . "/system/Content/Search/" ) as $file )
{
if ( $file->isDir() and !$file->isDot() and $file != 'index.html' )
{
$name = mb_strtolower( $file );
$engines[ $name ] = 'search_engine__' . $name;
}
}
return $engines;
}
/**
* Queue an index rebuild
*
* @return void
*/
protected function queueIndexRebuild()
{
\IPS\Content\Search\Index::i()->rebuild();
\IPS\Session::i()->log( 'acplogs__queued_search_index' );
\IPS\Output::i()->redirect( \IPS\Http\Url::internal( 'app=core&module=settings&controller=search' ), 'search_index_rebuilding' );
}
}
@@ -78,21 +78,76 @@ class _terms extends \IPS\Dispatcher\Controller
if ( $values = $form->values() )
{
/* What were our previous values? */
$existingPrivacyPolicy = iterator_to_array( \IPS\Db::i()->select( 'word_custom', 'core_sys_lang_words', array( 'word_key=?', 'privacy_text_value' ) ) );
$existingRegistrationTerms = iterator_to_array( \IPS\Db::i()->select( 'word_custom', 'core_sys_lang_words', array( 'word_key=?', 'reg_rules_value' ) ) );
/* Save */
foreach ( array( 'gl_guidelines' => 'guidelines_value', 'privacy_text' => 'privacy_text_value', 'reg_rules' => 'reg_rules_value' ) as $k => $v )
{
\IPS\Lang::saveCustom( 'core', $v, $values[ $k ] );
unset( $values[ $k ] );
}
$form->saveAsSettings( $values );
/* Clear guest page caches */
\IPS\Data\Cache::i()->clearAll();
/* Log */
\IPS\Session::i()->log( 'acplogs__terms_edited' );
/* Do we need to ask the admin if they want to ask members to reconfirm? */
$changedPrivacyPolicy = $existingPrivacyPolicy != iterator_to_array( \IPS\Db::i()->select( 'word_custom', 'core_sys_lang_words', array( 'word_key=?', 'privacy_text_value' ) ) );
$changedRegistrationTerms = $existingRegistrationTerms != iterator_to_array( \IPS\Db::i()->select( 'word_custom', 'core_sys_lang_words', array( 'word_key=?', 'reg_rules_value' ) ) );
if ( $changedPrivacyPolicy or $changedRegistrationTerms )
{
\IPS\Output::i()->redirect( \IPS\Http\Url::internal('app=core&module=settings&controller=terms&do=reconfirm')->setQueryString( array(
'privacy' => intval( $changedPrivacyPolicy ),
'reg' => intval( $changedRegistrationTerms )
) ) );
}
}
\IPS\Output::i()->title = \IPS\Member::loggedIn()->language()->addToStack('menu__core_settings_terms');
\IPS\Output::i()->output .= \IPS\Theme::i()->getTemplate( 'global' )->block( 'menu__core_settings_terms', $form );
}
/**
* Ask the admin if they want users to re-confirm
*
* @return void
*/
protected function reconfirm()
{
$form = new \IPS\Helpers\Form;
$form->addMessage( 'admin_reconfirm_blurb' );
if ( \IPS\Request::i()->reg )
{
$form->add( new \IPS\Helpers\Form\YesNo( 'admin_reconfirm_reg_terms', FALSE ) );
}
if ( \IPS\Request::i()->privacy )
{
$form->add( new \IPS\Helpers\Form\YesNo( 'admin_reconfirm_privacy', FALSE ) );
}
if ( $values = $form->values() )
{
if ( isset( $values['admin_reconfirm_reg_terms'] ) and $values['admin_reconfirm_reg_terms'] )
{
\IPS\Db::i()->update( 'core_members', "members_bitoptions2 = members_bitoptions2 | " . \IPS\Member::$bitOptions['members_bitoptions']['members_bitoptions2']['must_reaccept_terms'] );
}
if ( isset( $values['admin_reconfirm_privacy'] ) and $values['admin_reconfirm_privacy'] )
{
\IPS\Db::i()->update( 'core_members', "members_bitoptions2 = members_bitoptions2 | " . \IPS\Member::$bitOptions['members_bitoptions']['members_bitoptions2']['must_reaccept_privacy'] );
}
\IPS\Output::i()->redirect( \IPS\Http\Url::internal('app=core&module=settings&controller=terms') );
}
\IPS\Output::i()->title = \IPS\Member::loggedIn()->language()->addToStack('menu__core_settings_terms');
\IPS\Output::i()->output = $form;
}
}