Version 5.0.0 beta 1
This commit is contained in:
1 parent
25ddeb65d6
commit
15c7beabc5
6736 files changed
+627902
-497943
No files matched your search
@@ -11,29 +11,43 @@
|
||||
namespace IPS\core\modules\front\system;
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
|
||||
use Exception;
|
||||
use IPS\Application;
|
||||
use IPS\Db;
|
||||
use IPS\Dispatcher\Controller;
|
||||
use IPS\Lang;
|
||||
use IPS\Member;
|
||||
use IPS\Output;
|
||||
use IPS\Request;
|
||||
use IPS\Session;
|
||||
use IPS\Widget;
|
||||
use UnderflowException;
|
||||
use function defined;
|
||||
|
||||
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
{
|
||||
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
|
||||
header( ( $_SERVER['SERVER_PROTOCOL'] ?? 'HTTP/1.0' ) . ' 403 Forbidden' );
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Visual Language Editor
|
||||
*/
|
||||
class _vle extends \IPS\Dispatcher\Controller
|
||||
class vle extends Controller
|
||||
{
|
||||
/**
|
||||
* Execute
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function execute()
|
||||
public function execute() : void
|
||||
{
|
||||
if ( !\IPS\Member::loggedIn()->hasAcpRestriction( 'core', 'languages', 'lang_words' ) )
|
||||
if ( !Member::loggedIn()->hasAcpRestriction( 'core', 'languages', 'lang_words' ) )
|
||||
{
|
||||
\IPS\Output::i()->json( 'NO_PERMISSION', 403 );
|
||||
Output::i()->json( 'NO_PERMISSION', 403 );
|
||||
}
|
||||
return parent::execute();
|
||||
parent::execute();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -41,18 +55,18 @@ class _vle extends \IPS\Dispatcher\Controller
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function get()
|
||||
public function get() : void
|
||||
{
|
||||
try
|
||||
{
|
||||
$word = \IPS\Member::loggedIn()->language()->get( \IPS\Request::i()->key );
|
||||
$word = Member::loggedIn()->language()->get( Request::i()->key );
|
||||
}
|
||||
catch ( \UnderflowException $e )
|
||||
catch ( UnderflowException $e )
|
||||
{
|
||||
$word = NULL;
|
||||
}
|
||||
|
||||
\IPS\Output::i()->json( $word );
|
||||
Output::i()->json( $word );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -60,24 +74,24 @@ class _vle extends \IPS\Dispatcher\Controller
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function set()
|
||||
public function set() : void
|
||||
{
|
||||
\IPS\Session::i()->csrfCheck();
|
||||
Session::i()->csrfCheck();
|
||||
|
||||
try
|
||||
{
|
||||
$word = \IPS\Db::i()->select( '*', 'core_sys_lang_words', array( 'lang_id=? AND word_key=?', \IPS\Member::loggedIn()->language()->id, \IPS\Request::i()->key ) )->first();
|
||||
$word = Db::i()->select( '*', 'core_sys_lang_words', array( 'lang_id=? AND word_key=?', Member::loggedIn()->language()->id, Request::i()->key ) )->first();
|
||||
}
|
||||
catch( \UnderflowException $e )
|
||||
catch( UnderflowException $e )
|
||||
{
|
||||
$word = NULL;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
$application = \IPS\Application::load( $word['word_app'] );
|
||||
$application = Application::load( $word['word_app'] );
|
||||
}
|
||||
catch ( \Exception $e )
|
||||
catch ( Exception $e )
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -86,28 +100,28 @@ class _vle extends \IPS\Dispatcher\Controller
|
||||
{
|
||||
if ( $word['word_export'] )
|
||||
{
|
||||
\IPS\Db::i()->update( 'core_sys_lang_words', array( 'word_custom' => \IPS\Request::i()->value, 'word_custom_version' => $application->long_version ), array( 'word_id=?', $word['word_id'] ) );
|
||||
Db::i()->update( 'core_sys_lang_words', array( 'word_custom' => Request::i()->value, 'word_custom_version' => $application->long_version ), array( 'word_id=?', $word['word_id'] ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
\IPS\Lang::saveCustom( $word['word_app'], $word['word_key'], array( \IPS\Member::loggedIn()->language()->id => \IPS\Request::i()->value ) );
|
||||
Lang::saveCustom( $word['word_app'], $word['word_key'], array( Member::loggedIn()->language()->id => Request::i()->value ) );
|
||||
}
|
||||
|
||||
$string = \IPS\Request::i()->value ?: $word['word_default'];
|
||||
$string = Request::i()->value ?: $word['word_default'];
|
||||
}
|
||||
else
|
||||
{
|
||||
\IPS\Lang::saveCustom( 'core', \IPS\Request::i()->key, array( \IPS\Member::loggedIn()->language()->id => \IPS\Request::i()->value ) );
|
||||
Lang::saveCustom( 'core', Request::i()->key, array( Member::loggedIn()->language()->id => Request::i()->value ) );
|
||||
|
||||
$string = \IPS\Request::i()->value;
|
||||
$string = Request::i()->value;
|
||||
}
|
||||
|
||||
\IPS\Db::i()->insert( 'core_admin_logs', array(
|
||||
'member_id' => \IPS\Member::loggedIn()->member_id,
|
||||
'member_name' => \IPS\Member::loggedIn()->name,
|
||||
Db::i()->insert( 'core_admin_logs', array(
|
||||
'member_id' => Member::loggedIn()->member_id,
|
||||
'member_name' => Member::loggedIn()->name,
|
||||
'ctime' => time(),
|
||||
'note' => json_encode( array( $word['word_key'] => FALSE, \IPS\Member::loggedIn()->language()->title => FALSE ) ),
|
||||
'ip_address' => \IPS\Request::i()->ipAddress(),
|
||||
'note' => json_encode( array( $word['word_key'] => FALSE, Member::loggedIn()->language()->title => FALSE ) ),
|
||||
'ip_address' => Request::i()->ipAddress(),
|
||||
'appcomponent' => 'core',
|
||||
'module' => 'system',
|
||||
'controller' => 'vle',
|
||||
@@ -115,8 +129,8 @@ class _vle extends \IPS\Dispatcher\Controller
|
||||
'lang_key' => 'acplogs__lang_translate'
|
||||
) );
|
||||
|
||||
\IPS\Widget::deleteCaches();
|
||||
Widget::deleteCaches();
|
||||
|
||||
\IPS\Output::i()->sendOutput( $string, 200, 'text/text' );
|
||||
Output::i()->sendOutput( $string, 200, 'text/text' );
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user