$forms['database']['message'] = $result['message']; $forms['database']['reasons'] = $result['reasons']; } elseif (was_submitted('delete_database') && isset($_POST['database_delete_confirmation'])) { $result = $cif_user->delete_database($_POST['database_delete_confirmation']); $forms['database']['submitted'] = true; $forms['database']['status'] = $result['status']; $forms['database']['message'] = $result['message']; $forms['database']['reasons'] = $result['reasons']; } } // Gather AFS data $afs_data = array(); $afs_data['available'] = $cif_user->afs_available; if ($cif_user->afs_available) { $afs_data['used'] = $cif_user->get_storage_used(); $afs_data['quota'] = $cif_user->get_storage_size(); $afs_data['free'] = $cif_user->get_storage_free(); $afs_data['used_percent'] = $cif_user->get_storage_percent_used(); } else { $afs_data['error_message'] = 'Sorry, our file storage is down right now.'; } $web_hosting = array('available' => false); // Ping hosting server to see if it is online // The last argument is the timeout. If the server is down, // it WILL take at least that long for this function to return $hosting_server_connection = @fsockopen(WEB_HOSTING_URL, 80, $errno, $errstr, 0.001); if ($hosting_server_connection) { $web_hosting['available'] = true; fclose($hosting_server_connection); } echo $twig->render('index.html', array('user' => array('cifid' => $cif_user->cifid, 'email' => $cif_user->email, 'full_name' => $cif_user->full_name, 'first_name' => $cif_user->first_name, 'lcc' => $cif_user->lcc, 'afs' => $afs_data, 'web_hosting' => $web_hosting, 'database' => $database_data, 'has_lab_access' => $has_lab_access), 'forms' => $forms));