mirror of
				https://github.com/slawkens/myaac.git
				synced 2025-10-31 07:56:23 +01:00 
			
		
		
		
	Compare commits
	
		
			17 Commits
		
	
	
		
			feature/cs
			...
			feature/el
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
|   | 998e15cabd | ||
|   | c81861d8c8 | ||
|   | c3c1a6b2a6 | ||
|   | d0590d2747 | ||
|   | c79a1d5f3a | ||
|   | ada1e391d4 | ||
|   | 193e18523d | ||
|   | 3fb9b1ae2f | ||
|   | 561bdcd766 | ||
|   | 556ef47d59 | ||
|   | 130ad25c4d | ||
|   | 08bea2c541 | ||
|   | 8974830621 | ||
|   | d582120fac | ||
|   | 8227303b89 | ||
|   | 7a402ec0e0 | ||
|   | 790d85a88a | 
							
								
								
									
										1
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							| @@ -47,6 +47,7 @@ system/cache/* | |||||||
| !system/cache/twig/index.html | !system/cache/twig/index.html | ||||||
| !system/cache/signatures/index.html | !system/cache/signatures/index.html | ||||||
| !system/cache/plugins/index.html | !system/cache/plugins/index.html | ||||||
|  | !system/cache/persistent/index.html | ||||||
|  |  | ||||||
| # logs | # logs | ||||||
| system/logs/* | system/logs/* | ||||||
|   | |||||||
							
								
								
									
										22
									
								
								admin/includes/debugbar.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										22
									
								
								admin/includes/debugbar.php
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,22 @@ | |||||||
|  | <?php | ||||||
|  |  | ||||||
|  | $hooks->register('debugbar_admin_head_end', HOOK_ADMIN_HEAD_END, function ($params) { | ||||||
|  | 	global $debugBar; | ||||||
|  |  | ||||||
|  | 	if (!isset($debugBar)) { | ||||||
|  | 		return; | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	$debugBarRenderer = $debugBar->getJavascriptRenderer(); | ||||||
|  | 	echo $debugBarRenderer->renderHead(); | ||||||
|  | }); | ||||||
|  | $hooks->register('debugbar_admin_body_end', HOOK_ADMIN_BODY_END, function ($params) { | ||||||
|  | 	global $debugBar; | ||||||
|  |  | ||||||
|  | 	if (!isset($debugBar)) { | ||||||
|  | 		return; | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	$debugBarRenderer = $debugBar->getJavascriptRenderer(); | ||||||
|  | 	echo $debugBarRenderer->render(); | ||||||
|  | }); | ||||||
| @@ -30,6 +30,7 @@ if(!$db->hasTable('myaac_account_actions')) { | |||||||
| 	throw new RuntimeException('Seems that the table <strong>myaac_account_actions</strong> of MyAAC doesn\'t exist in the database. This is a fatal error. You can try to reinstall MyAAC by visiting <a href="' . BASE_URL . 'install">this</a> url.'); | 	throw new RuntimeException('Seems that the table <strong>myaac_account_actions</strong> of MyAAC doesn\'t exist in the database. This is a fatal error. You can try to reinstall MyAAC by visiting <a href="' . BASE_URL . 'install">this</a> url.'); | ||||||
| } | } | ||||||
|  |  | ||||||
|  | require __DIR__ . '/includes/debugbar.php'; | ||||||
| require SYSTEM . 'status.php'; | require SYSTEM . 'status.php'; | ||||||
| require SYSTEM . 'login.php'; | require SYSTEM . 'login.php'; | ||||||
| require __DIR__ . '/includes/functions.php'; | require __DIR__ . '/includes/functions.php'; | ||||||
|   | |||||||
| @@ -50,7 +50,7 @@ if (!empty($action)) { | |||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	$php = isset($_POST['php']) && $_POST['php'] == 1; | 	$php = isset($_POST['php']) && $_POST['php'] == 1; | ||||||
| 	$enable_tinymce = isset($_POST['enable_tinymce']) && $_POST['enable_tinymce'] == 1; | 	$enable_tinymce = (isset($_POST['enable_tinymce']) && $_POST['enable_tinymce'] == 1) ?: $enable_tinymce; | ||||||
| 	if ($php) { | 	if ($php) { | ||||||
| 		$body = $_POST['body']; | 		$body = $_POST['body']; | ||||||
| 	} | 	} | ||||||
|   | |||||||
| @@ -26,8 +26,8 @@ | |||||||
| if (version_compare(phpversion(), '8.0', '<')) die('PHP version 8.0 or higher is required.'); | if (version_compare(phpversion(), '8.0', '<')) die('PHP version 8.0 or higher is required.'); | ||||||
|  |  | ||||||
| const MYAAC = true; | const MYAAC = true; | ||||||
| const MYAAC_VERSION = '0.10.0-dev'; | const MYAAC_VERSION = '1.0-dev'; | ||||||
| const DATABASE_VERSION = 36; | const DATABASE_VERSION = 38; | ||||||
| const TABLE_PREFIX = 'myaac_'; | const TABLE_PREFIX = 'myaac_'; | ||||||
| define('START_TIME', microtime(true)); | define('START_TIME', microtime(true)); | ||||||
| define('MYAAC_OS', stripos(PHP_OS, 'WIN') === 0 ? 'WINDOWS' : (strtoupper(PHP_OS) === 'DARWIN' ? 'MAC' : 'LINUX')); | define('MYAAC_OS', stripos(PHP_OS, 'WIN') === 0 ? 'WINDOWS' : (strtoupper(PHP_OS) === 'DARWIN' ? 'MAC' : 'LINUX')); | ||||||
|   | |||||||
| @@ -13,10 +13,13 @@ | |||||||
|         "nikic/fast-route": "^1.3", |         "nikic/fast-route": "^1.3", | ||||||
|         "matomo/device-detector": "^6.0", |         "matomo/device-detector": "^6.0", | ||||||
|         "illuminate/database": "^10.18", |         "illuminate/database": "^10.18", | ||||||
|         "peppeocchi/php-cron-scheduler": "4.*" |         "illuminate/filesystem": "^10.18", | ||||||
|  |         "peppeocchi/php-cron-scheduler": "4.*", | ||||||
|  |         "symfony/process": "^6.3" | ||||||
|     }, |     }, | ||||||
|     "require-dev": { |     "require-dev": { | ||||||
|         "filp/whoops": "^2.15" |         "filp/whoops": "^2.15", | ||||||
|  |         "maximebf/debugbar": "dev-master" | ||||||
|     }, |     }, | ||||||
|     "autoload": { |     "autoload": { | ||||||
|         "psr-4": { |         "psr-4": { | ||||||
|   | |||||||
							
								
								
									
										15
									
								
								system/bin/dump_database.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										15
									
								
								system/bin/dump_database.php
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,15 @@ | |||||||
|  | <?php | ||||||
|  |  | ||||||
|  | if(PHP_SAPI !== 'cli') { | ||||||
|  | 	echo 'This script can be run only in command line mode.'; | ||||||
|  | 	exit(1); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | require_once __DIR__ . '/../../common.php'; | ||||||
|  | require_once SYSTEM . 'functions.php'; | ||||||
|  | require_once SYSTEM . 'init.php'; | ||||||
|  |  | ||||||
|  | $test = new \Illuminate\Database\Schema\MySqlSchemaState($eloquentConnection); | ||||||
|  | $test->dump($eloquentConnection, BASE . 'dump.sql'); | ||||||
|  |  | ||||||
|  | echo 'Dumped.'; | ||||||
							
								
								
									
										0
									
								
								system/cache/persistent/index.html
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										0
									
								
								system/cache/persistent/index.html
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -111,6 +111,8 @@ try { | |||||||
| 	$capsule->addConnection([ | 	$capsule->addConnection([ | ||||||
| 		'driver' => 'mysql', | 		'driver' => 'mysql', | ||||||
| 		'database' => $config['database_name'], | 		'database' => $config['database_name'], | ||||||
|  | 		'username' => $config['database_user'], | ||||||
|  | 		'password' => $config['database_password'], | ||||||
| 	]); | 	]); | ||||||
|  |  | ||||||
| 	$capsule->getConnection()->setPdo($db); | 	$capsule->getConnection()->setPdo($db); | ||||||
|   | |||||||
| @@ -469,20 +469,30 @@ function tickers() | |||||||
|  */ |  */ | ||||||
| function template_place_holder($type): string | function template_place_holder($type): string | ||||||
| { | { | ||||||
| 	global $twig, $template_place_holders; | 	global $twig, $template_place_holders, $debugBar; | ||||||
| 	$ret = ''; | 	$ret = ''; | ||||||
|  |  | ||||||
|  | 	if (isset($debugBar)) { | ||||||
|  | 		$debugBarRenderer = $debugBar->getJavascriptRenderer(); | ||||||
|  | 	} | ||||||
|  |  | ||||||
| 	if(array_key_exists($type, $template_place_holders) && is_array($template_place_holders[$type])) | 	if(array_key_exists($type, $template_place_holders) && is_array($template_place_holders[$type])) | ||||||
| 		$ret = implode($template_place_holders[$type]); | 		$ret = implode($template_place_holders[$type]); | ||||||
|  |  | ||||||
| 	if($type === 'head_start') { | 	if($type === 'head_start') { | ||||||
| 		$ret .= template_header(); | 		$ret .= template_header(); | ||||||
|  | 		if (isset($debugBar)) { | ||||||
|  | 			$ret .= $debugBarRenderer->renderHead(); | ||||||
|  | 		} | ||||||
| 	} | 	} | ||||||
| 	elseif ($type === 'body_start') { | 	elseif ($type === 'body_start') { | ||||||
| 		$ret .= $twig->render('browsehappy.html.twig'); | 		$ret .= $twig->render('browsehappy.html.twig'); | ||||||
| 	} | 	} | ||||||
| 	elseif($type === 'body_end') { | 	elseif($type === 'body_end') { | ||||||
| 		$ret .= template_ga_code(); | 		$ret .= template_ga_code(); | ||||||
|  | 		if (isset($debugBar)) { | ||||||
|  | 			$ret .= $debugBarRenderer->render(); | ||||||
|  | 		} | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	return $ret; | 	return $ret; | ||||||
| @@ -1252,7 +1262,7 @@ function clearCache() | |||||||
| 	deleteDirectory(CACHE . 'signatures', ['index.html'], true); | 	deleteDirectory(CACHE . 'signatures', ['index.html'], true); | ||||||
| 	deleteDirectory(CACHE . 'twig', ['index.html'], true); | 	deleteDirectory(CACHE . 'twig', ['index.html'], true); | ||||||
| 	deleteDirectory(CACHE . 'plugins', ['index.html'], true); | 	deleteDirectory(CACHE . 'plugins', ['index.html'], true); | ||||||
| 	deleteDirectory(CACHE, ['signatures', 'twig', 'plugins', 'index.html'], true); | 	deleteDirectory(CACHE, ['signatures', 'twig', 'plugins', 'index.html', 'persistent'], true); | ||||||
|  |  | ||||||
| 	// routes cache | 	// routes cache | ||||||
| 	$routeCacheFile = CACHE . 'route.cache'; | 	$routeCacheFile = CACHE . 'route.cache'; | ||||||
|   | |||||||
| @@ -16,10 +16,16 @@ if(!isset($config['installed']) || !$config['installed']) { | |||||||
| 	throw new RuntimeException('MyAAC has not been installed yet or there was error during installation. Please install again.'); | 	throw new RuntimeException('MyAAC has not been installed yet or there was error during installation. Please install again.'); | ||||||
| } | } | ||||||
|  |  | ||||||
|  | use DebugBar\StandardDebugBar; | ||||||
|  |  | ||||||
| if(config('env') === 'dev') { | if(config('env') === 'dev') { | ||||||
| 	require SYSTEM . 'exception.php'; | 	require SYSTEM . 'exception.php'; | ||||||
| } | } | ||||||
|  |  | ||||||
|  | if (config('env') === 'dev' || getBoolean(config('enable_debugbar'))) { | ||||||
|  | 	$debugBar = new StandardDebugBar(); | ||||||
|  | } | ||||||
|  |  | ||||||
| if(empty($config['server_path'])) { | if(empty($config['server_path'])) { | ||||||
| 	throw new RuntimeException('Server Path has been not set. Go to config.php and set it.'); | 	throw new RuntimeException('Server Path has been not set. Go to config.php and set it.'); | ||||||
| } | } | ||||||
|   | |||||||
| @@ -38,7 +38,7 @@ class DataLoader | |||||||
| 	{ | 	{ | ||||||
| 		self::$startTime = microtime(true); | 		self::$startTime = microtime(true); | ||||||
|  |  | ||||||
| 		require LIBS . 'items.php'; | 		require_once LIBS . 'items.php'; | ||||||
| 		if(Items::loadFromXML()) { | 		if(Items::loadFromXML()) { | ||||||
| 			success(self::$locale['step_database_loaded_items'] . self::getLoadedTime()); | 			success(self::$locale['step_database_loaded_items'] . self::getLoadedTime()); | ||||||
| 		} | 		} | ||||||
|   | |||||||
| @@ -129,6 +129,9 @@ class Settings implements ArrayAccess | |||||||
| 			if (is_bool($value)) { | 			if (is_bool($value)) { | ||||||
| 				$settingsDb[$key] = $value ? 'true' : 'false'; | 				$settingsDb[$key] = $value ? 'true' : 'false'; | ||||||
| 			} | 			} | ||||||
|  | 			elseif (is_array($value)) { | ||||||
|  | 				$settingsDb[$key] = $value; | ||||||
|  | 			} | ||||||
| 			else { | 			else { | ||||||
| 				$settingsDb[$key] = (string)$value; | 				$settingsDb[$key] = (string)$value; | ||||||
| 			} | 			} | ||||||
| @@ -373,7 +376,6 @@ class Settings implements ArrayAccess | |||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		$this->settingsDatabase[$pluginKeyName][$key] = $value; | 		$this->settingsDatabase[$pluginKeyName][$key] = $value; | ||||||
| 		$this->updateInDatabase($pluginKeyName, $key, $value); |  | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	#[\ReturnTypeWillChange] | 	#[\ReturnTypeWillChange] | ||||||
| @@ -414,7 +416,6 @@ class Settings implements ArrayAccess | |||||||
|  |  | ||||||
| 		unset($this->settingsFile[$pluginKeyName]['settings'][$key]); | 		unset($this->settingsFile[$pluginKeyName]['settings'][$key]); | ||||||
| 		unset($this->settingsDatabase[$pluginKeyName][$key]); | 		unset($this->settingsDatabase[$pluginKeyName][$key]); | ||||||
| 		$this->deleteFromDatabase($pluginKeyName, $key); |  | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| @@ -532,8 +533,11 @@ class Settings implements ArrayAccess | |||||||
|  |  | ||||||
| 	public static function saveConfig($config, $filename, &$content = '') | 	public static function saveConfig($config, $filename, &$content = '') | ||||||
| 	{ | 	{ | ||||||
| 		$content = "<?php" . PHP_EOL . | 		$content = "<?php" . PHP_EOL; | ||||||
| 			"\$config['installed'] = true;" . PHP_EOL; |  | ||||||
|  | 		unset($config['installed']); | ||||||
|  |  | ||||||
|  | 		$content .= "\$config['installed'] = true;" . PHP_EOL; | ||||||
|  |  | ||||||
| 		foreach ($config as $key => $value) { | 		foreach ($config as $key => $value) { | ||||||
| 			$content .= "\$config['$key'] = "; | 			$content .= "\$config['$key'] = "; | ||||||
|   | |||||||
| @@ -33,7 +33,7 @@ class Towns | |||||||
| 	/** | 	/** | ||||||
| 	 * @var string | 	 * @var string | ||||||
| 	 */ | 	 */ | ||||||
| 	private static $filename = CACHE . 'towns.php'; | 	private static $filename = CACHE . 'persistent/' . 'towns.php'; | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| 	 * Determine towns | 	 * Determine towns | ||||||
|   | |||||||
| @@ -40,7 +40,7 @@ class Items | |||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		require_once LIBS . 'cache_php.php'; | 		require_once LIBS . 'cache_php.php'; | ||||||
| 		$cache_php = new Cache_PHP(config('cache_prefix'), CACHE); | 		$cache_php = new Cache_PHP(config('cache_prefix'), CACHE . 'persistent/'); | ||||||
| 		$cache_php->set('items', $items, 5 * 365 * 24 * 60 * 60); | 		$cache_php->set('items', $items, 5 * 365 * 24 * 60 * 60); | ||||||
| 		return true; | 		return true; | ||||||
| 	} | 	} | ||||||
| @@ -68,7 +68,7 @@ class Items | |||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		require_once LIBS . 'cache_php.php'; | 		require_once LIBS . 'cache_php.php'; | ||||||
| 		$cache_php = new Cache_PHP(config('cache_prefix'), CACHE); | 		$cache_php = new Cache_PHP(config('cache_prefix'), CACHE . 'persistent/'); | ||||||
| 		self::$items = $cache_php->get('items'); | 		self::$items = $cache_php->get('items'); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
|   | |||||||
| @@ -41,7 +41,7 @@ class NPCs | |||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		require_once LIBS . 'cache_php.php'; | 		require_once LIBS . 'cache_php.php'; | ||||||
| 		$cache_php = new Cache_PHP(config('cache_prefix'), CACHE); | 		$cache_php = new Cache_PHP(config('cache_prefix'), CACHE . 'persistent/'); | ||||||
| 		$cache_php->set('npcs', $npcs, 5 * 365 * 24 * 60 * 60); | 		$cache_php->set('npcs', $npcs, 5 * 365 * 24 * 60 * 60); | ||||||
| 		return true; | 		return true; | ||||||
| 	} | 	} | ||||||
| @@ -53,7 +53,7 @@ class NPCs | |||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		require_once LIBS . 'cache_php.php'; | 		require_once LIBS . 'cache_php.php'; | ||||||
| 		$cache_php = new Cache_PHP(config('cache_prefix'), CACHE); | 		$cache_php = new Cache_PHP(config('cache_prefix'), CACHE . 'persistent/'); | ||||||
| 		self::$npcs = $cache_php->get('npcs'); | 		self::$npcs = $cache_php->get('npcs'); | ||||||
| 	} | 	} | ||||||
| } | } | ||||||
|   | |||||||
| @@ -370,7 +370,14 @@ class POT | |||||||
|             throw new RuntimeException('Please install PHP pdo extension. MyAAC will not work without it.'); |             throw new RuntimeException('Please install PHP pdo extension. MyAAC will not work without it.'); | ||||||
|         } |         } | ||||||
|  |  | ||||||
|         $this->db = new OTS_DB_MySQL($params); | 	    global $debugBar; | ||||||
|  | 		if (isset($debugBar)) { | ||||||
|  | 			$this->db = new DebugBar\DataCollector\PDO\TraceablePDO(new OTS_DB_MySQL($params)); | ||||||
|  | 			$debugBar->addCollector(new DebugBar\DataCollector\PDO\PDOCollector($this->db)); | ||||||
|  | 		} | ||||||
|  | 		else { | ||||||
|  | 			$this->db = new OTS_DB_MySQL($params); | ||||||
|  | 		} | ||||||
|  |  | ||||||
|         $this->db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); |         $this->db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); | ||||||
|     } |     } | ||||||
|   | |||||||
| @@ -952,7 +952,7 @@ class OTS_Account extends OTS_Row_DAO implements IteratorAggregate, Countable | |||||||
| 			return $query['group_id']; | 			return $query['group_id']; | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		return 0; | 		return 1; | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	public function getAccGroupId() | 	public function getAccGroupId() | ||||||
|   | |||||||
| @@ -117,12 +117,15 @@ class OTS_DB_MySQL extends OTS_Base_DB | |||||||
| 			} | 			} | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
|  | 		$driverAttributes = []; // debugbar dont like persistent connection | ||||||
|  | 		if (config('env') !== 'dev' && !getBoolean(config('enable_debugbar'))) { | ||||||
|  | 			$driverAttributes[PDO::ATTR_PERSISTENT] = $params['persistent']; | ||||||
|  | 		} | ||||||
|  |  | ||||||
| 		if(isset($params['socket'][0])) { | 		if(isset($params['socket'][0])) { | ||||||
| 			$dns[] = 'unix_socket=' . $params['socket']; | 			$dns[] = 'unix_socket=' . $params['socket']; | ||||||
|  |  | ||||||
| 			parent::__construct('mysql:' . implode(';', $dns), $user, $password, array( | 			parent::__construct('mysql:' . implode(';', $dns), $user, $password, $driverAttributes); | ||||||
| 				PDO::ATTR_PERSISTENT => $params['persistent'] |  | ||||||
| 			)); |  | ||||||
|  |  | ||||||
| 			return; | 			return; | ||||||
| 		} | 		} | ||||||
| @@ -135,9 +138,7 @@ class OTS_DB_MySQL extends OTS_Base_DB | |||||||
| 			$dns[] = 'port=' . $params['port']; | 			$dns[] = 'port=' . $params['port']; | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		parent::__construct('mysql:' . implode(';', $dns), $user, $password, array( | 		parent::__construct('mysql:' . implode(';', $dns), $user, $password, $driverAttributes); | ||||||
| 			PDO::ATTR_PERSISTENT => $params['persistent'] |  | ||||||
| 		)); |  | ||||||
|     } |     } | ||||||
|  |  | ||||||
| 	public function __destruct() | 	public function __destruct() | ||||||
|   | |||||||
| @@ -1,5 +1,7 @@ | |||||||
| <?php | <?php | ||||||
|  |  | ||||||
|  | require_once LIBS . 'Settings.php'; | ||||||
|  |  | ||||||
| $query = $db->query("SELECT `id` FROM `players` WHERE (`name` = " . $db->quote("Rook Sample") . " OR `name` = " . $db->quote("Sorcerer Sample") . " OR `name` = " . $db->quote("Druid Sample") . " OR `name` = " . $db->quote("Paladin Sample") . " OR `name` = " . $db->quote("Knight Sample") . " OR `name` = " . $db->quote("Account Manager") . ") ORDER BY `id`;"); | $query = $db->query("SELECT `id` FROM `players` WHERE (`name` = " . $db->quote("Rook Sample") . " OR `name` = " . $db->quote("Sorcerer Sample") . " OR `name` = " . $db->quote("Druid Sample") . " OR `name` = " . $db->quote("Paladin Sample") . " OR `name` = " . $db->quote("Knight Sample") . " OR `name` = " . $db->quote("Account Manager") . ") ORDER BY `id`;"); | ||||||
|  |  | ||||||
| $highscores_ignored_ids = array(); | $highscores_ignored_ids = array(); | ||||||
|   | |||||||
							
								
								
									
										8
									
								
								system/migrations/37.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										8
									
								
								system/migrations/37.php
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,8 @@ | |||||||
|  | <?php | ||||||
|  |  | ||||||
|  | // 2023-11-11 | ||||||
|  | // Add Guest page access | ||||||
|  |  | ||||||
|  | use MyAAC\Models\Pages; | ||||||
|  |  | ||||||
|  | Pages::query()->where('access', 1)->update(['access' => 0]); | ||||||
							
								
								
									
										5
									
								
								system/migrations/38.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								system/migrations/38.php
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,5 @@ | |||||||
|  | <?php | ||||||
|  |  | ||||||
|  | // 2023-11-11 | ||||||
|  | // execute highscores_ids_hidden once again, cause of settings | ||||||
|  | require __DIR__ . '/20.php'; | ||||||
| @@ -79,7 +79,7 @@ $ignore = false; | |||||||
|  |  | ||||||
| /** @var boolean $logged */ | /** @var boolean $logged */ | ||||||
| /** @var OTS_Account $account_logged */ | /** @var OTS_Account $account_logged */ | ||||||
| $logged_access = 1; | $logged_access = 0; | ||||||
| if($logged && $account_logged && $account_logged->isLoaded()) { | if($logged && $account_logged && $account_logged->isLoaded()) { | ||||||
| 	$logged_access = $account_logged->getAccess(); | 	$logged_access = $account_logged->getAccess(); | ||||||
| } | } | ||||||
|   | |||||||
| @@ -1588,7 +1588,13 @@ Sent by MyAAC,<br/> | |||||||
| 		'beforeSave' => function(&$settings, &$values) { | 		'beforeSave' => function(&$settings, &$values) { | ||||||
| 			global $config; | 			global $config; | ||||||
|  |  | ||||||
| 			$configToSave = []; | 			$configOriginal = $config; | ||||||
|  | 			unset($config); | ||||||
|  |  | ||||||
|  | 			$config = []; | ||||||
|  | 			require BASE . 'config.local.php'; | ||||||
|  |  | ||||||
|  | 			$configToSave = $config; | ||||||
|  |  | ||||||
| 			$server_path = ''; | 			$server_path = ''; | ||||||
| 			$database = []; | 			$database = []; | ||||||
| @@ -1625,7 +1631,7 @@ Sent by MyAAC,<br/> | |||||||
| 			// if fail - revert the setting and inform the user | 			// if fail - revert the setting and inform the user | ||||||
| 			if (!file_exists($server_path . 'config.lua')) { | 			if (!file_exists($server_path . 'config.lua')) { | ||||||
| 				error('Server Path is invalid - cannot find config.lua in the directory. Setting have been reverted.'); | 				error('Server Path is invalid - cannot find config.lua in the directory. Setting have been reverted.'); | ||||||
| 				$configToSave['server_path'] = $config['server_path']; | 				$configToSave['server_path'] = $configOriginal['server_path']; | ||||||
| 			} | 			} | ||||||
|  |  | ||||||
| 			// test database connection | 			// test database connection | ||||||
| @@ -1633,7 +1639,7 @@ Sent by MyAAC,<br/> | |||||||
| 			if ($database['database_overwrite'] && !Settings::testDatabaseConnection($database)) { | 			if ($database['database_overwrite'] && !Settings::testDatabaseConnection($database)) { | ||||||
| 				foreach ($database as $key => $value) { | 				foreach ($database as $key => $value) { | ||||||
| 					if (!in_array($key, ['database_log', 'database_persistent'])) { // ignore these two | 					if (!in_array($key, ['database_log', 'database_persistent'])) { // ignore these two | ||||||
| 						$configToSave[$key] = $config[$key]; | 						$configToSave[$key] = $configOriginal[$key]; | ||||||
| 					} | 					} | ||||||
| 				} | 				} | ||||||
| 			} | 			} | ||||||
|   | |||||||
| @@ -1,5 +1,3 @@ | |||||||
| <br/><br/> |  | ||||||
|  |  | ||||||
| <form action="{{ constant('ADMIN_URL') }}?p={{ page }}" method="post" style="float: left"> | <form action="{{ constant('ADMIN_URL') }}?p={{ page }}" method="post" style="float: left"> | ||||||
| 	{{ csrf() }} | 	{{ csrf() }} | ||||||
| 	<input type="hidden" name="action" value="edit" /> | 	<input type="hidden" name="action" value="edit" /> | ||||||
|   | |||||||
| @@ -21,10 +21,12 @@ | |||||||
| 				<div class="form-group row"> | 				<div class="form-group row"> | ||||||
| 					<label for="access">Access</label> | 					<label for="access">Access</label> | ||||||
| 					<select class="form-control" id="access" name="access"> | 					<select class="form-control" id="access" name="access"> | ||||||
|  | 						<option value="0" {% if access == 0 %}selected{% endif %}>Guest*</option> | ||||||
| 						{% for id, group in groups %} | 						{% for id, group in groups %} | ||||||
| 							<option value="{{ group.getId() }}"{% if access == group.getId() %} selected{% endif %}>{{ group.getName() }}</option> | 							<option value="{{ group.getId() }}"{% if access == group.getId() %} selected{% endif %}>{{ group.getName()|title }}</option> | ||||||
| 						{% endfor %} | 						{% endfor %} | ||||||
| 					</select> | 					</select> | ||||||
|  | 					<br>* Guest means everyone will have access to this page. Player means registered and logged in user. | ||||||
| 				</div> | 				</div> | ||||||
| 				<div class="form-group row"> | 				<div class="form-group row"> | ||||||
| 					<label for="php">PHP | 					<label for="php">PHP | ||||||
| @@ -66,7 +68,8 @@ | |||||||
| 				if (!this.checked) { | 				if (!this.checked) { | ||||||
| 					tinymce.remove('#editor'); | 					tinymce.remove('#editor'); | ||||||
| 				} else { | 				} else { | ||||||
| 					if (tinymce.get('#editor')!== null){ | 					$('#php').prop('checked', false); | ||||||
|  | 					if (tinymce.get('#editor')!== null) { | ||||||
| 						tinymce.activeEditor.show(); | 						tinymce.activeEditor.show(); | ||||||
| 					} else { | 					} else { | ||||||
| 						tinymceInit(); | 						tinymceInit(); | ||||||
|   | |||||||
| @@ -25,15 +25,7 @@ | |||||||
| 			<td>{{ log.body|nl2br}}</td> | 			<td>{{ log.body|nl2br}}</td> | ||||||
| 			{% if canEdit  %} | 			{% if canEdit  %} | ||||||
| 				<td> | 				<td> | ||||||
| 					<a href="{{ constant('ADMIN_URL') }}?p=changelog&action=edit&id={{ log.id }}" title="Edit in Admin Panel" target="_blank"> | 					{{ include('admin.links.html.twig', {page: 'changelog', id: log.id, hidden: log.hidden }) }} | ||||||
| 						<img src="images/edit.png"/>Edit |  | ||||||
| 					</a> |  | ||||||
| 					<a href="{{ constant('ADMIN_URL') }}?p=changelog&action=delete&id={{ log.id }}" onclick="return confirm('Are you sure?');" title="Delete in Admin Panel" target="_blank"> |  | ||||||
| 						<img src="images/del.png"/>Delete |  | ||||||
| 					</a> |  | ||||||
| 					<a href="{{ constant('ADMIN_URL') }}?p=changelog&action=hide&id={{ log.id }}"  title="{% if log.hidden != 1 %}Hide{% else %}Show{% endif %} in Admin Panel" target="_blank"> |  | ||||||
| 						<img src="images/{{ (log.hidden != 1 ? 'success' : 'error') }}.png"/>{{ (log.hidden != 1) ? 'Hide' : 'Show' }} |  | ||||||
| 					</a> |  | ||||||
| 				</td> | 				</td> | ||||||
| 			{% endif %} | 			{% endif %} | ||||||
| 		</tr> | 		</tr> | ||||||
|   | |||||||
| @@ -123,7 +123,7 @@ if(isset($config['boxes'])) | |||||||
| 		  document.getElementById("submenu_"+activeSubmenuItem).style.color = "white"; | 		  document.getElementById("submenu_"+activeSubmenuItem).style.color = "white"; | ||||||
| 		  document.getElementById("ActiveSubmenuItemIcon_"+activeSubmenuItem).style.visibility = "visible"; | 		  document.getElementById("ActiveSubmenuItemIcon_"+activeSubmenuItem).style.visibility = "visible"; | ||||||
| 		  menus = localStorage.getItem('menus'); | 		  menus = localStorage.getItem('menus'); | ||||||
| 		  if(menus.lastIndexOf("&") === -1) { | 		  if(menus == null || menus.lastIndexOf("&") === -1) { | ||||||
| 			  menus = "news=1&account=0&community=0&library=0&forum=0<?php if (setting('core.gifts_system')) echo '&shops=0'; ?>&"; | 			  menus = "news=1&account=0&community=0&library=0&forum=0<?php if (setting('core.gifts_system')) echo '&shops=0'; ?>&"; | ||||||
| 		  } | 		  } | ||||||
| 		  FillMenuArray(); | 		  FillMenuArray(); | ||||||
|   | |||||||
| @@ -20,18 +20,9 @@ | |||||||
| 						<div id="TickerEntry-{{ i }}-ShortText" class="NewsTickerShortText">{{ ticker.body_short|raw }}</div> | 						<div id="TickerEntry-{{ i }}-ShortText" class="NewsTickerShortText">{{ ticker.body_short|raw }}</div> | ||||||
| 						<div id="TickerEntry-{{ i }}-FullText" class="NewsTickerFullText">{{ ticker.body|raw }} | 						<div id="TickerEntry-{{ i }}-FullText" class="NewsTickerFullText">{{ ticker.body|raw }} | ||||||
| 							{% if canEdit %} | 							{% if canEdit %} | ||||||
| 							<a href="{{ constant('ADMIN_URL') }}?p=news&action=edit&id={{ ticker.id }}" title="Edit"> | 								<table> | ||||||
| 								<img src="images/edit.png"/> | 									{{ include('admin.links.html.twig', {page: 'news', id: ticker.id, hidden: ticker.hidden }) }} | ||||||
| 								Edit | 								</table> | ||||||
| 							</a> |  | ||||||
| 							<a id="delete" href="{{ constant('ADMIN_URL') }}?p=news&action=delete&id={{ ticker.id }}" onclick="return confirm('Are you sure?');" title="Delete"> |  | ||||||
| 								<img src="images/del.png"/> |  | ||||||
| 								Delete |  | ||||||
| 							</a> |  | ||||||
| 							<a href="{{ constant('ADMIN_URL') }}?p=news&action=hide&id={{ ticker.id }}" title="{% if ticker.hidden != 1 %}Hide{% else %}Show{% endif %}"> |  | ||||||
| 								<img src="images/{% if ticker.hidden != 1 %}success{% else %}error{% endif %}.png"/> |  | ||||||
| 								{% if ticker.hidden != 1 %}Hide{% else %}Show{% endif %} |  | ||||||
| 							</a> |  | ||||||
| 							{% endif %} | 							{% endif %} | ||||||
| 						</div> | 						</div> | ||||||
| 					</div> | 					</div> | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user