mirror of
				https://github.com/slawkens/myaac.git
				synced 2025-10-31 07:56:23 +01:00 
			
		
		
		
	Compare commits
	
		
			25 Commits
		
	
	
		
			feature/el
			...
			feature/cs
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
|   | 8ec08b5a61 | ||
|   | 19346efc38 | ||
|   | c9d5c6cfd7 | ||
|   | 4461c03d48 | ||
|   | 60c7ef2391 | ||
|   | d6c35bcbb5 | ||
|   | 4e87e7e9dc | ||
|   | 08a19158b3 | ||
|   | 9a306886fb | ||
|   | 719c542757 | ||
|   | 1ed24afc7d | ||
|   | 66479e64ed | ||
|   | 4e26f07ab6 | ||
|   | 13e6eb5666 | ||
|   | 56306dfb0a | ||
|   | f27172691c | ||
|   | 5578dbaa83 | ||
|   | 549c08c096 | ||
|   | 0127a4f417 | ||
|   | 08074d8d4f | ||
|   | 198cc5a09d | ||
|   | 3e7cbbb63b | ||
|   | 8e3a71b36b | ||
|   | 0e33fd103c | ||
|   | 046c0b5cf4 | 
							
								
								
									
										1
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							| @@ -47,7 +47,6 @@ 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/* | ||||||
|   | |||||||
| @@ -1,22 +0,0 @@ | |||||||
| <?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,7 +30,6 @@ 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; | 	$enable_tinymce = isset($_POST['enable_tinymce']) && $_POST['enable_tinymce'] == 1; | ||||||
| 	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 = '1.0-dev'; | const MYAAC_VERSION = '0.10.0-dev'; | ||||||
| const DATABASE_VERSION = 38; | const DATABASE_VERSION = 36; | ||||||
| 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,13 +13,10 @@ | |||||||
|         "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", | ||||||
|         "illuminate/filesystem": "^10.18", |         "peppeocchi/php-cron-scheduler": "4.*" | ||||||
|         "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": { | ||||||
|   | |||||||
| @@ -1,15 +0,0 @@ | |||||||
| <?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
									
									
								
							
							
						
						
									
										0
									
								
								system/cache/persistent/index.html
									
									
									
									
										vendored
									
									
								
							| @@ -111,8 +111,6 @@ 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,30 +469,20 @@ function tickers() | |||||||
|  */ |  */ | ||||||
| function template_place_holder($type): string | function template_place_holder($type): string | ||||||
| { | { | ||||||
| 	global $twig, $template_place_holders, $debugBar; | 	global $twig, $template_place_holders; | ||||||
| 	$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; | ||||||
| @@ -1262,7 +1252,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', 'persistent'], true); | 	deleteDirectory(CACHE, ['signatures', 'twig', 'plugins', 'index.html'], true); | ||||||
|  |  | ||||||
| 	// routes cache | 	// routes cache | ||||||
| 	$routeCacheFile = CACHE . 'route.cache'; | 	$routeCacheFile = CACHE . 'route.cache'; | ||||||
|   | |||||||
| @@ -16,16 +16,10 @@ 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_once LIBS . 'items.php'; | 		require 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,9 +129,6 @@ 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; | ||||||
| 			} | 			} | ||||||
| @@ -376,6 +373,7 @@ class Settings implements ArrayAccess | |||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		$this->settingsDatabase[$pluginKeyName][$key] = $value; | 		$this->settingsDatabase[$pluginKeyName][$key] = $value; | ||||||
|  | 		$this->updateInDatabase($pluginKeyName, $key, $value); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	#[\ReturnTypeWillChange] | 	#[\ReturnTypeWillChange] | ||||||
| @@ -416,6 +414,7 @@ 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); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| @@ -533,11 +532,8 @@ 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 . 'persistent/' . 'towns.php'; | 	private static $filename = CACHE . '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 . 'persistent/'); | 		$cache_php = new Cache_PHP(config('cache_prefix'), CACHE); | ||||||
| 		$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 . 'persistent/'); | 		$cache_php = new Cache_PHP(config('cache_prefix'), CACHE); | ||||||
| 		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 . 'persistent/'); | 		$cache_php = new Cache_PHP(config('cache_prefix'), CACHE); | ||||||
| 		$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 . 'persistent/'); | 		$cache_php = new Cache_PHP(config('cache_prefix'), CACHE); | ||||||
| 		self::$npcs = $cache_php->get('npcs'); | 		self::$npcs = $cache_php->get('npcs'); | ||||||
| 	} | 	} | ||||||
| } | } | ||||||
|   | |||||||
| @@ -370,14 +370,7 @@ 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.'); | ||||||
|         } |         } | ||||||
|  |  | ||||||
| 	    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 = 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 1; | 		return 0; | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	public function getAccGroupId() | 	public function getAccGroupId() | ||||||
|   | |||||||
| @@ -117,15 +117,12 @@ 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, $driverAttributes); | 			parent::__construct('mysql:' . implode(';', $dns), $user, $password, array( | ||||||
|  | 				PDO::ATTR_PERSISTENT => $params['persistent'] | ||||||
|  | 			)); | ||||||
|  |  | ||||||
| 			return; | 			return; | ||||||
| 		} | 		} | ||||||
| @@ -138,7 +135,9 @@ class OTS_DB_MySQL extends OTS_Base_DB | |||||||
| 			$dns[] = 'port=' . $params['port']; | 			$dns[] = 'port=' . $params['port']; | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		parent::__construct('mysql:' . implode(';', $dns), $user, $password, $driverAttributes); | 		parent::__construct('mysql:' . implode(';', $dns), $user, $password, array( | ||||||
|  | 			PDO::ATTR_PERSISTENT => $params['persistent'] | ||||||
|  | 		)); | ||||||
|     } |     } | ||||||
|  |  | ||||||
| 	public function __destruct() | 	public function __destruct() | ||||||
|   | |||||||
| @@ -1,7 +1,5 @@ | |||||||
| <?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(); | ||||||
|   | |||||||
| @@ -1,8 +0,0 @@ | |||||||
| <?php |  | ||||||
|  |  | ||||||
| // 2023-11-11 |  | ||||||
| // Add Guest page access |  | ||||||
|  |  | ||||||
| use MyAAC\Models\Pages; |  | ||||||
|  |  | ||||||
| Pages::query()->where('access', 1)->update(['access' => 0]); |  | ||||||
| @@ -1,5 +0,0 @@ | |||||||
| <?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 = 0; | $logged_access = 1; | ||||||
| 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,13 +1588,7 @@ Sent by MyAAC,<br/> | |||||||
| 		'beforeSave' => function(&$settings, &$values) { | 		'beforeSave' => function(&$settings, &$values) { | ||||||
| 			global $config; | 			global $config; | ||||||
|  |  | ||||||
| 			$configOriginal = $config; | 			$configToSave = []; | ||||||
| 			unset($config); |  | ||||||
|  |  | ||||||
| 			$config = []; |  | ||||||
| 			require BASE . 'config.local.php'; |  | ||||||
|  |  | ||||||
| 			$configToSave = $config; |  | ||||||
|  |  | ||||||
| 			$server_path = ''; | 			$server_path = ''; | ||||||
| 			$database = []; | 			$database = []; | ||||||
| @@ -1631,7 +1625,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'] = $configOriginal['server_path']; | 				$configToSave['server_path'] = $config['server_path']; | ||||||
| 			} | 			} | ||||||
|  |  | ||||||
| 			// test database connection | 			// test database connection | ||||||
| @@ -1639,7 +1633,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] = $configOriginal[$key]; | 						$configToSave[$key] = $config[$key]; | ||||||
| 					} | 					} | ||||||
| 				} | 				} | ||||||
| 			} | 			} | ||||||
|   | |||||||
| @@ -1,3 +1,5 @@ | |||||||
|  | <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,12 +21,10 @@ | |||||||
| 				<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()|title }}</option> | 							<option value="{{ group.getId() }}"{% if access == group.getId() %} selected{% endif %}>{{ group.getName() }}</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 | ||||||
| @@ -68,7 +66,6 @@ | |||||||
| 				if (!this.checked) { | 				if (!this.checked) { | ||||||
| 					tinymce.remove('#editor'); | 					tinymce.remove('#editor'); | ||||||
| 				} else { | 				} else { | ||||||
| 					$('#php').prop('checked', false); |  | ||||||
| 					if (tinymce.get('#editor')!== null){ | 					if (tinymce.get('#editor')!== null){ | ||||||
| 						tinymce.activeEditor.show(); | 						tinymce.activeEditor.show(); | ||||||
| 					} else { | 					} else { | ||||||
|   | |||||||
| @@ -25,7 +25,15 @@ | |||||||
| 			<td>{{ log.body|nl2br}}</td> | 			<td>{{ log.body|nl2br}}</td> | ||||||
| 			{% if canEdit  %} | 			{% if canEdit  %} | ||||||
| 				<td> | 				<td> | ||||||
| 					{{ include('admin.links.html.twig', {page: 'changelog', id: log.id, hidden: log.hidden }) }} | 					<a href="{{ constant('ADMIN_URL') }}?p=changelog&action=edit&id={{ log.id }}" title="Edit in Admin Panel" target="_blank"> | ||||||
|  | 						<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 == null || menus.lastIndexOf("&") === -1) { | 		  if(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,9 +20,18 @@ | |||||||
| 						<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 %} | ||||||
| 								<table> | 							<a href="{{ constant('ADMIN_URL') }}?p=news&action=edit&id={{ ticker.id }}" title="Edit"> | ||||||
| 									{{ include('admin.links.html.twig', {page: 'news', id: ticker.id, hidden: ticker.hidden }) }} | 								<img src="images/edit.png"/> | ||||||
| 								</table> | 								Edit | ||||||
|  | 							</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