Version 4.0.13.1

This commit is contained in:
Neo committed 2025-12-19 04:57:54 -08:00
1 parent f9e857d255
commit c6a86f0d9b
7517 files changed
+597400 -668041

No files matched your search

Whitespace-only changes.
@@ -0,0 +1,170 @@
<?php
/**
* @brief logs
* @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
* @subpackage Chat
* @since 15 Mar 2015
* @version SVN_VERSION_NUMBER
*/
namespace IPS\chat\modules\admin\chat;
/* 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;
}
/**
* logs
*/
class _logs extends \IPS\Dispatcher\Controller
{
/**
* Execute
*
* @return void
*/
public function execute()
{
\IPS\Dispatcher::i()->checkAcpPermission( 'logs_manage' );
parent::execute();
}
/**
* Show logs
*
* @return void
*/
protected function manage()
{
/* Create the table */
$table = new \IPS\Helpers\Table\Db( 'chat_log_archive', \IPS\Http\Url::internal( 'app=chat&module=chat&controller=logs' ) );
$table->langPrefix = 'chatlog_';
/* Column stuff */
$table->include = array( 'log_time', 'log_user', 'log_message' );
$table->mainColumn = 'log_message';
$table->widths = array( 'log_time' => '20', 'log_user' => '20', 'log_message' => '60' );
/* Sort stuff */
$table->sortBy = $table->sortBy ?: 'log_time';
$table->sortDirection = $table->sortDirection ?: 'desc';
/* Search */
$table->quickSearch = 'log_message';
$table->advancedSearch = array(
'log_user' => \IPS\Helpers\Table\SEARCH_CONTAINS_TEXT,
'log_time' => \IPS\Helpers\Table\SEARCH_DATE_RANGE,
);
/* Formatters */
$self = $this;
$table->parsers = array(
'log_time' => function( $val, $row )
{
$date = \IPS\DateTime::ts( $val );
return $date->localeDate() . ' ' . $date->localeTime( FALSE );
},
'log_user' => function( $val, $row ) use ( $self )
{
return $self->cleanMessage( $val );
},
'log_message' => function( $val, $row ) use ( $self )
{
$val = $self->cleanMessage( $val );
if( $row['log_code'] == 2 )
{
$_extra = explode( '_', $row['log_extra'] );
if( $_extra[0] == 1 )
{
$val = \IPS\Member::loggedIn()->language()->addToStack('chatlog__hasentered', FALSE, array( 'sprintf' => $row['log_user'] ) );
}
else
{
$val = \IPS\Member::loggedIn()->language()->addToStack('chatlog__hasleft', FALSE, array( 'sprintf' => $row['log_user'] ) );
}
}
else if( $row['log_code'] == 5 )
{
$val = \IPS\Member::loggedIn()->language()->addToStack('chatlog__kicked', FALSE, array( 'sprintf' => $val ) );
}
if( mb_strpos( $val, '/me' ) === 0 )
{
$val = mb_substr( $val, 4 );
}
if( mb_strpos( $row['log_extra'], 'private=' ) === 0 )
{
$_user = mb_substr( $row['log_extra'], mb_strrpos( $row['log_extra'], '=' ) + 1 );
$_uid = $_user;
$_user = \IPS\Member::load( $_user );
$val = \IPS\Member::loggedIn()->language()->addToStack('chatlog__private', FALSE, array( 'sprintf' => array( $_user->name, $val ) ) );
}
return $val;
}
);
/* Root buttons */
\IPS\Output::i()->sidebar['actions']['settings'] = array(
'title' => 'prunesettings',
'icon' => 'cog',
'link' => \IPS\Http\Url::internal( 'app=chat&module=chat&controller=logs&do=settings' ),
'data' => array( 'ipsDialog' => '', 'ipsDialog-title' => \IPS\Member::loggedIn()->language()->addToStack('prunesettings') )
);
/* Display */
\IPS\Output::i()->title = \IPS\Member::loggedIn()->language()->addToStack('ipschat_log_archive');
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate( 'global', 'core' )->block( 'title', (string) $table );
}
/**
* Clean "special" characters
*
* @param string String to clean
* @return string Cleaned string
*/
public function cleanMessage( $string )
{
$string = str_replace( "__N__" , "\n", $string );
$string = str_replace( "__C__" , ",", $string );
$string = str_replace( "__E__" , "=", $string );
$string = str_replace( "__PS__" , "+", $string );
$string = str_replace( "__A__" , "&", $string );
$string = str_replace( "__P__" , "%", $string );
return $string;
}
/**
* Settings
*
* @return void
*/
public function settings()
{
$form = new \IPS\Helpers\Form;
$form->add( new \IPS\Helpers\Form\Number( 'ipchat_log_prune', \IPS\Settings::i()->ipchat_log_prune, FALSE, array( 'unlimited' => 0, 'unlimitedLang' => 'never' ), NULL, \IPS\Member::loggedIn()->language()->addToStack('after'), \IPS\Member::loggedIn()->language()->addToStack('days') ) );
if ( $form->values() )
{
$form->saveAsSettings();
\IPS\Session::i()->log( 'acplog__chatlog_settings' );
\IPS\Output::i()->redirect( \IPS\Http\Url::internal( 'app=chat&module=chat&controller=logs' ), 'saved' );
}
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate( 'global', 'core' )->block( 'settings', $form, FALSE );
}
}
@@ -0,0 +1,106 @@
<?php
/**
* @brief 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
* @subpackage Chat
* @since 15 Mar 2015
* @version SVN_VERSION_NUMBER
*/
namespace IPS\chat\modules\admin\chat;
/* 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;
}
/**
* settings
*/
class _settings extends \IPS\Dispatcher\Controller
{
/**
* Execute
*
* @return void
*/
public function execute()
{
\IPS\Dispatcher::i()->checkAcpPermission( 'settings_manage' );
parent::execute();
}
/**
* Show the settings form
*
* @return void
*/
protected function manage()
{
$form = new \IPS\Helpers\Form;
$form->add( new \IPS\Helpers\Form\YesNo( 'ipchat_new_window', \IPS\Settings::i()->ipchat_new_window, TRUE ) );
$form->add( new \IPS\Helpers\Form\YesNo( 'ipschat_enable_rules', \IPS\Settings::i()->ipschat_enable_rules, TRUE, array( 'togglesOn' => array( 'ipschat_rules_id' ) ) ) );
$form->add( new \IPS\Helpers\Form\Translatable( 'ipschat_rules_text', NULL, FALSE, array( 'app' => 'core', 'key' => 'ipschat_rules', 'editor' => array( 'app' => 'core', 'key' => 'Admin', 'autoSaveKey' => 'ipschat_rules', 'attachIds' => array( NULL, NULL, 'ipschat_rules' ) ) ), NULL, NULL, NULL, 'ipschat_rules_id' ) );
$form->add( new \IPS\Helpers\Form\YesNo( 'ipchat_hide_usermessage', !\IPS\Settings::i()->ipchat_hide_usermessage, TRUE ) );
$form->add( new \IPS\Helpers\Form\YesNo( 'ipchat_no_buffer', \IPS\Settings::i()->ipchat_no_buffer, TRUE ) );
$form->add( new \IPS\Helpers\Form\Number( 'ipchat_inactive_minutes', \IPS\Settings::i()->ipchat_inactive_minutes, TRUE, array(), NULL, NULL, \IPS\Member::loggedIn()->language()->addToStack('minutes') ) );
$form->add( new \IPS\Helpers\Form\Select( 'ipchat_24hour', \IPS\Settings::i()->ipchat_24hour, TRUE, array( 'options' => array( '12' => 'chat_12hour', '24' => 'chat_24hour' ) ) ) );
if( \IPS\Settings::i()->ipschat_online )
{
$times = explode( ',', \IPS\Settings::i()->ipschat_online );
/* Do we need to adjust the time zone? */
if( isset( $times[2] ) AND $times[2] != \IPS\Member::loggedIn()->timezone )
{
$start = new \IPS\DateTime( '2015-01-01 ' . $times[0], new \DateTimeZone( $times[2] ) );
$start->setTimezone( new \DateTimeZone( \IPS\Member::loggedIn()->timezone ) );
$times[0] = $start->format( 'H:i' );
$end = new \IPS\DateTime( '2015-01-01 ' . $times[1], new \DateTimeZone( $times[2] ) );
$end->setTimezone( new \DateTimeZone( \IPS\Member::loggedIn()->timezone ) );
$times[1] = $end->format( 'H:i' );
}
}
else
{
$times = array( 0 => '', 1 => '' );
}
$form->add( new \IPS\Helpers\Form\Custom( 'ipschat_online', $times, FALSE, array(
'getHtml' => function( $element )
{
return \IPS\Theme::i()->getTemplate( 'settings' )->chatOnline( $element->value );
},
'formatValue' => function( $element )
{
$element->value[2] = \IPS\Member::loggedIn()->timezone;
return $element->value;
}
), NULL, NULL, NULL, 'ipschat_online' ) );
if ( $values = $form->values( TRUE ) )
{
\IPS\Lang::saveCustom( 'chat', "ipschat_rules", $values['ipschat_rules_text'] );
unset( $values['ipschat_rules_text'] );
$values['ipchat_hide_usermessage'] = !$values['ipchat_hide_usermessage'];
$form->saveAsSettings( $values );
/* Clear guest page caches */
\IPS\Data\Cache::i()->clearAll();
\IPS\Session::i()->log( 'acplogs__chat_settings' );
}
\IPS\Output::i()->title = \IPS\Member::loggedIn()->language()->addToStack('menu__chat_chat_settings');
\IPS\Output::i()->output .= \IPS\Theme::i()->getTemplate( 'global', 'core' )->block( 'menu__chat_chat_settings', $form );
}
}
Whitespace-only changes.