/** * Main driver for running system check * @since 1.2.4 * @param $registry * @param $mode ('log', 'return') * @return array * * Note: This is English text only. Can be call before database and languges are loaded */ function run_system_check($registry, $mode = 'log') { $mlog = $counts = array(); $mlog[] = check_install_directory($registry); $mlog = array_merge($mlog, check_file_permissions($registry)); $mlog = array_merge($mlog, check_php_configuraion($registry)); $mlog = array_merge($mlog, check_server_configuration($registry)); $counts['error_count'] = $counts['warning_count'] = $counts['notice_count'] = 0; foreach ($mlog as $message) { if ($message['type'] == 'E') { if ($mode == 'log') { //only save errors to the log $error = new AError($message['body']); $error->toLog()->toDebug(); $registry->get('messages')->saveError($message['title'], $message['body']); } $counts['error_count']++; } else { if ($message['type'] == 'W') { if ($mode == 'log') { $registry->get('messages')->saveWarning($message['title'], $message['body']); } $counts['warning_count']++; } else { if ($message['type'] == 'N') { if ($mode == 'log') { $registry->get('messages')->saveNotice($message['title'], $message['body']); } $counts['notice_count']++; } } } } return array($mlog, $counts); }
/** * Main driver for running system check * @since 1.2.4 * @param Registry $registry * @param string $mode ('log', 'return') * @return array * * Note: This is English text only. Can be call before database and languages are loaded */ function run_system_check($registry, $mode = 'log') { $mlog = $counts = array(); //run anyway $mlog[] = check_install_directory(); if (IS_ADMIN === true && (!$registry->get('config')->get('config_system_check') || $registry->get('config')->get('config_system_check') == 1) || IS_ADMIN !== true && (!$registry->get('config')->get('config_system_check') || $registry->get('config')->get('config_system_check') == 2)) { $mlog = array_merge($mlog, check_file_permissions($registry)); $mlog = array_merge($mlog, check_php_configuraion()); $mlog = array_merge($mlog, check_server_configuration($registry)); $mlog = array_merge($mlog, check_order_statuses($registry)); $mlog = array_merge($mlog, check_web_access()); } $counts['error_count'] = $counts['warning_count'] = $counts['notice_count'] = 0; foreach ($mlog as $message) { if ($message['type'] == 'E') { if ($mode == 'log') { //only save errors to the log $error = new AError($message['body']); $error->toLog()->toDebug(); $registry->get('messages')->saveError($message['title'], $message['body']); } $counts['error_count']++; } else { if ($message['type'] == 'W') { if ($mode == 'log') { $registry->get('messages')->saveWarning($message['title'], $message['body']); } $counts['warning_count']++; } else { if ($message['type'] == 'N') { if ($mode == 'log') { $registry->get('messages')->saveNotice($message['title'], $message['body']); } $counts['notice_count']++; } } } } return array($mlog, $counts); }
<?php require '../../include/mellivora.inc.php'; enforce_authentication(CONST_USER_CLASS_MODERATOR); head('Site management'); menu_management(); check_server_configuration(); $categories = db_query_fetch_all('SELECT * FROM categories ORDER BY title'); if (empty($categories)) { message_generic('Welcome', 'Your CTF is looking a bit empty! Start by adding a category using the menu above.'); } section_subhead('CTF Overview', '<a href="' . CONFIG_SITE_ADMIN_URL . 'visualise">Visualise challenge availability</a>', false); foreach ($categories as $category) { echo ' <h4> ', htmlspecialchars($category['title']), ' <a href="edit_category.php?id=', htmlspecialchars($category['id']), '" class="btn btn-xs btn-primary">Edit category</a> <a href="new_challenge.php?category=', htmlspecialchars($category['id']), '" class="btn btn-xs btn-primary">Add challenge</a> </h4> '; $challenges = db_select_all('challenges', array('id', 'title', 'description', 'exposed', 'available_from', 'available_until', 'points'), array('category' => $category['id']), 'points ASC'); if (empty($challenges)) { message_inline_blue('This category is empty! Use the link above to add a challenge.'); } else { echo ' <table class="table table-striped table-hover"> <thead> <tr> <th>Title</th> <th>Description</th> <th class="center">Points</th>