diff --git a/admin/index.php b/admin/index.php index 5102e634..d74a35a5 100644 --- a/admin/index.php +++ b/admin/index.php @@ -6,7 +6,7 @@ require_once BASE . 'config.local.php'; if(file_exists(BASE . 'install') && (!isset($config['installed']) || !$config['installed'])) { header('Location: ' . BASE_URL . 'install/'); - die('Setup detected that install/ directory exists. Please visit this url to start MyAAC Installation.
Delete install/ directory if you already installed MyAAC.
Remember to REFRESH this page when you\'re done!'); + throw new RuntimeException('Setup detected that install/ directory exists. Please visit this url to start MyAAC Installation.
Delete install/ directory if you already installed MyAAC.
Remember to REFRESH this page when you\'re done!'); } define('ADMIN_PANEL', true); diff --git a/index.php b/index.php index 40ef9dfc..a6138fc8 100644 --- a/index.php +++ b/index.php @@ -65,7 +65,7 @@ if(config('env') === 'dev') { if((!isset($config['installed']) || !$config['installed']) && file_exists(BASE . 'install')) { header('Location: ' . BASE_URL . 'install/'); - die('Setup detected that install/ directory exists. Please visit this url to start MyAAC Installation.
Delete install/ directory if you already installed MyAAC.
Remember to REFRESH this page when you\'re done!'); + throw new RuntimeException('Setup detected that install/ directory exists. Please visit this url to start MyAAC Installation.
Delete install/ directory if you already installed MyAAC.
Remember to REFRESH this page when you\'re done!'); } $found = false; @@ -183,7 +183,7 @@ $twig->addGlobal('status', $status); // verify myaac tables exists in database if(!$db->hasTable('myaac_account_actions')) { - die('Seems that the table myaac_account_actions of MyAAC doesn\'t exist in the database. This is a fatal error. You can try to reinstall MyAAC by visiting this url.'); + throw new RuntimeException('Seems that the table myaac_account_actions of MyAAC doesn\'t exist in the database. This is a fatal error. You can try to reinstall MyAAC by visiting this url.'); } // database migrations diff --git a/install/index.php b/install/index.php index bd3e3bed..7cebc9b0 100644 --- a/install/index.php +++ b/install/index.php @@ -57,7 +57,7 @@ if($step == 'finish' && (!isset($config['installed']) || !$config['installed'])) // step verify $steps = array(1 => 'welcome', 2 => 'license', 3 => 'requirements', 4 => 'config', 5 => 'database', 6 => 'admin', 7 => 'finish'); if(!in_array($step, $steps)) // check if step is valid - die('ERROR: Unknown step.'); + throw new RuntimeException('ERROR: Unknown step.'); $install_status['step'] = $step; $errors = array(); diff --git a/system/functions.php b/system/functions.php index f64c785a..787c4579 100644 --- a/system/functions.php +++ b/system/functions.php @@ -903,7 +903,7 @@ function load_config_lua($filename) if(!@file_exists($config_file)) { log_append('error.log', '[load_config_file] Fatal error: Cannot load config.lua (' . $filename . '). Error: ' . print_r(error_get_last(), true)); - die('ERROR: Cannot find ' . $filename . ' file. More info in system/logs/error.log'); + throw new RuntimeException('ERROR: Cannot find ' . $filename . ' file. More info in system/logs/error.log'); } $result = array(); @@ -949,7 +949,7 @@ function load_config_lua($filename) $ret = @eval("return $value;"); if((string) $ret == '') // = parser error { - die('ERROR: Loading config.lua file. Line ' . ($ln + 1) . ' of LUA config file is not valid [key: ' . $key . ']'); + throw new RuntimeException('ERROR: Loading config.lua file. Line ' . ($ln + 1) . ' of LUA config file is not valid [key: ' . $key . ']'); } $result[$key] = $ret; } diff --git a/system/init.php b/system/init.php index 21660880..41cfb053 100644 --- a/system/init.php +++ b/system/init.php @@ -15,7 +15,7 @@ if(file_exists(BASE . 'config.local.php')) // user customizations require BASE . 'config.local.php'; if(!isset($config['installed']) || !$config['installed']) { - die('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.'); } date_default_timezone_set($config['date_timezone']); @@ -139,7 +139,7 @@ else { $vocations->load($file); if(!$vocations) - die('ERROR: Cannot load vocations.xml file.'); + throw new RuntimeException('ERROR: Cannot load vocations.xml file.'); $config['vocations'] = array(); foreach($vocations->getElementsByTagName('vocation') as $vocation) { diff --git a/system/item.php b/system/item.php index 0434fe39..4d213360 100644 --- a/system/item.php +++ b/system/item.php @@ -24,7 +24,7 @@ function generateItem($id = 100, $count = 1) { function itemImageExists($id, $count = 1) { if(!isset($id)) - die('ERROR - itemImageExists: id has been not set!'); + throw new RuntimeException('ERROR - itemImageExists: id has been not set!'); $file_name = $id; if($count > 1) diff --git a/system/libs/items_images.php b/system/libs/items_images.php index 415c6a07..f2a917f9 100644 --- a/system/libs/items_images.php +++ b/system/libs/items_images.php @@ -241,7 +241,7 @@ class Items_Images self::$spr = fopen(self::$files['spr'], 'rb'); if(!self::$otb || !self::$dat || !self::$spr) - die('ERROR: Cannot load data files.'); + throw new RuntimeException('ERROR: Cannot load data files.'); /* if ( $nostand ) { diff --git a/system/pages/forum/show_board.php b/system/pages/forum/show_board.php index 602e2071..2ead991d 100644 --- a/system/pages/forum/show_board.php +++ b/system/pages/forum/show_board.php @@ -57,8 +57,7 @@ if(isset($last_threads[0])) $player->load($thread['player_id']); if(!$player->isLoaded()) { - error('Forum error: Player not loaded.'); - die(); + throw new RuntimeException('Forum error: Player not loaded.'); } $player_account = $player->getAccount(); diff --git a/system/pages/forum/show_thread.php b/system/pages/forum/show_thread.php index 5af7c42b..bf6cda75 100644 --- a/system/pages/forum/show_thread.php +++ b/system/pages/forum/show_thread.php @@ -46,8 +46,7 @@ foreach($posts as &$post) $player = $post['player']; $player->load($post['player_id']); if(!$player->isLoaded()) { - error('Forum error: Player not loaded.'); - die(); + throw new RuntimeException('Forum error: Player not loaded.'); } if($config['characters']['outfit']) {