Version 4.1.19

This commit is contained in:
Neo committed 2025-12-19 05:38:56 -08:00
1 parent 28bd025b35
commit 2bd5025018
2674 files changed
+233518 -77766

No files matched your search

@@ -2,9 +2,9 @@
/**
* @brief languages
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Social Suite
* @package IPS Community Suite
* @since 25 Jun 2013
* @version SVN_VERSION_NUMBER
*/
@@ -35,7 +35,7 @@ class _languages extends \IPS\Node\Controller
*/
public function execute()
{
\IPS\Dispatcher::i()->checkAcpPermission( 'lang_packs' );
\IPS\Dispatcher::i()->checkAcpPermission( 'lang_words' );
parent::execute();
}
@@ -96,7 +96,7 @@ class _languages extends \IPS\Node\Controller
/* reset default language if we want this to be default */
if( isset( $values['lang_default'] ) and $values['lang_default'] )
{
\IPS\DB::i()->update( 'core_sys_lang', array( 'lang_default' => 0 ) );
\IPS\Db::i()->update( 'core_sys_lang', array( 'lang_default' => 0 ) );
}
/* Add "UTF8" if we can */
@@ -511,7 +511,7 @@ class _languages extends \IPS\Node\Controller
{
if ( !is_array( $data ) )
{
$lang = \IPS\DB::i()->select( '*', 'core_sys_lang', array( 'lang_id=?', \IPS\Request::i()->id ) )->first();
$lang = \IPS\Db::i()->select( '*', 'core_sys_lang', array( 'lang_id=?', \IPS\Request::i()->id ) )->first();
unset( $lang['lang_id'] );
$lang['lang_title'] = $lang['lang_title'] . ' ' . \IPS\Member::loggedIn()->language()->get('copy_noun');
@@ -550,6 +550,7 @@ class _languages extends \IPS\Node\Controller
function()
{
unset( \IPS\Data\Store::i()->languages );
unset( \IPS\Data\Store::i()->listFormats );
/* Clear guest page caches */
\IPS\Data\Cache::i()->clearAll();
@@ -575,8 +576,15 @@ class _languages extends \IPS\Node\Controller
{
\IPS\Output::i()->error( 'node_error', '2C126/5', 404, '' );
}
if ( \IPS\Db::i()->select( 'COUNT(*)', 'core_sys_lang_words', array( 'lang_id=? AND word_export=1 AND word_custom IS NOT NULL', $lang->id ), 'word_id' )->first() < 1 )
$count = 0;
try
{
$count = \IPS\Db::i()->select( 'COUNT(word_id)', 'core_sys_lang_words', array( 'lang_id=? AND word_export=1 AND word_custom IS NOT NULL', $lang->id ), 'word_id', NULL, 'word_id' )->first();
}
catch ( \UnderflowException $e ) {}
if ( $count < 1 )
{
\IPS\Output::i()->error( 'core_lang_download_empty', '1C126/7', 404, '' );
}
@@ -671,7 +679,7 @@ class _languages extends \IPS\Node\Controller
move_uploaded_file( $values['lang_upload'], $tempFile );
/* Initate a redirector */
\IPS\Output::i()->redirect( \IPS\Http\Url::internal( 'app=core&module=languages&controller=languages&do=import&file=' . urlencode( $tempFile ) . '&key=' . md5_file( $tempFile ) . '&into=' . \IPS\Request::i()->id ) );
\IPS\Output::i()->redirect( \IPS\Http\Url::internal( 'app=core&module=languages&controller=languages&do=import' )->setQueryString( array( 'file' => $tempFile, 'key' => md5_file( $tempFile ), 'into' => \IPS\Request::i()->id ) ) );
}
\IPS\Output::i()->output = $form;
@@ -700,7 +708,7 @@ class _languages extends \IPS\Node\Controller
function( $data )
{
/* Open XML file */
$xml = new \XMLReader;
$xml = new \IPS\Xml\XMLReader;
$xml->open( \IPS\Request::i()->file );
$xml->read();
@@ -748,9 +756,9 @@ class _languages extends \IPS\Node\Controller
/* Copy over default language strings */
$default = \IPS\Lang::defaultLanguage();
$prefix = \IPS\Db::i()->prefix;
$defaultStmt = \IPS\Db::i()->prepare( "INSERT INTO `{$prefix}core_sys_lang_words` ( `lang_id`, `word_app`, `word_key`, `word_default`, `word_custom`, `word_default_version`, `word_custom_version`, `word_js`, `word_export` ) SELECT {$insertId} AS `lang_id`, `word_app`, `word_key`, `word_default`, NULL AS `word_custom`, `word_default_version`, NULL AS `word_custom_version`, `word_js`, `word_export` FROM `{$prefix}core_sys_lang_words` WHERE `lang_id`={$default} AND `word_export`=1" );
$defaultStmt = \IPS\Db::i()->prepare( "INSERT INTO `{$prefix}core_sys_lang_words` ( `lang_id`, `word_app`, `word_plugin`, `word_key`, `word_default`, `word_custom`, `word_default_version`, `word_custom_version`, `word_js`, `word_export` ) SELECT {$insertId} AS `lang_id`, `word_app`, `word_plugin`, `word_key`, `word_default`, NULL AS `word_custom`, `word_default_version`, NULL AS `word_custom_version`, `word_js`, `word_export` FROM `{$prefix}core_sys_lang_words` WHERE `lang_id`={$default} AND `word_export`=1" );
$defaultStmt->execute();
$customStmt = \IPS\Db::i()->prepare( "INSERT INTO `{$prefix}core_sys_lang_words` ( `lang_id`, `word_app`, `word_key`, `word_default`, `word_custom`, `word_default_version`, `word_custom_version`, `word_js`, `word_export` ) SELECT {$insertId} AS `lang_id`, `word_app`, `word_key`, `word_default`, `word_custom`, `word_default_version`, `word_custom_version`, `word_js`, `word_export` FROM `{$prefix}core_sys_lang_words` WHERE `lang_id`={$default} AND `word_export`=0" );
$customStmt = \IPS\Db::i()->prepare( "INSERT INTO `{$prefix}core_sys_lang_words` ( `lang_id`, `word_app`, `word_plugin`, `word_key`, `word_default`, `word_custom`, `word_default_version`, `word_custom_version`, `word_js`, `word_export` ) SELECT {$insertId} AS `lang_id`, `word_app`, `word_plugin`, `word_key`, `word_default`, `word_custom`, `word_default_version`, `word_custom_version`, `word_js`, `word_export` FROM `{$prefix}core_sys_lang_words` WHERE `lang_id`={$default} AND `word_export`=0" );
$customStmt->execute();
}
@@ -810,6 +818,8 @@ class _languages extends \IPS\Node\Controller
/* Clear guest page caches */
\IPS\Data\Cache::i()->clearAll();
@unlink( \IPS\Request::i()->file );
\IPS\Output::i()->redirect( \IPS\Http\Url::internal( 'app=core&module=languages&controller=languages' ) );
}
);
@@ -922,7 +932,14 @@ class _languages extends \IPS\Node\Controller
$where = \IPS\Db::i()->in( 'member_group_id', $values['member_reset_where'] );
}
\IPS\Db::i()->update( 'core_members', array( 'language' => \IPS\Request::i()->id ), $where );
if ( $where )
{
\IPS\Db::i()->update( 'core_members', array( 'language' => \IPS\Request::i()->id ), $where );
}
else
{
\IPS\Member::updateAllMembers( array( 'language' => \IPS\Request::i()->id ) );
}
\IPS\Output::i()->redirect( \IPS\Http\Url::internal( 'app=core&module=languages&controller=languages' ), 'reset' );
}