getCode(), $e->getMessage()); echo $message; exit; } } // }}} /* check the following variables READ_DATABASE_BASE_DSN WRITE_DATABASE_BASE_DSN UNIQUE_ID check that the software has the following libraries mysqli_connect apache must have the following modules unique_id php5 */ function href($uri) { return xml_attribute_value($uri); } function element_value($value) { return xml_element_value($value); } function attribute_value($value) { return xml_attribute_value($value); } function comment_value($value) { return xml_comment_value($value); } function map_uri($address, $locality, $regionCode, $postalCode) { return sprintf('https://www.google.com/maps/search/?api=1&query=%s,%s,%s++%s', $address, $locality, $regionCode, $postalCode); } function fieldDebuggingIsOn() { return isset($_SERVER['LIFELINE_FIELD_NAME_DEBUGGING']) && $_SERVER['LIFELINE_FIELD_NAME_DEBUGGING'] == 1; } $service_path_map = array('Subscription' => 'subscriptions'); $relative_path_map = array( '/vigils/?' => 'VigilsService', '/vigils/[^/]+/?' => 'VigilService', '/vigils/[^/]+/[^/]+/entry-form' => 'SlotService', '/vigils/[^/]+/[^/]+/?' => 'SlotService', '/?' => 'HomeService', '/((400)|(401)|(403)|(404)|(405)|(408)|(410)|(411)|(412)|(413)|(414)|(415)){1}' => 'FileService', // HTTP errors - intended only for the server to use ); // {{{ this one must be last in the list $relative_path_map['.+'] = 'FileService'; // }}} function lifeline_error_handler($number, $string, $filename, $line_number, $context) { if($string == 'No data store.') { // send an email message here $GLOBALS['notice_message'] = "ATTENTION: $string"; return true; } else { // maybe send one here too return true; } } function lifeline_exception_handler($exception) { return true; } function check_for_fatal_errors() { $err = error_get_last(); print_r($err);exit; send_response(new Response(array(array(HTTP_STATUS_RESPONSE_INTERNAL_SERVER_ERROR => null)), sprintf('%s, in file %s on line %d', $err['message'], $err['file'], $err['line']), $err['type'])); } set_error_handler('lifeline_error_handler', E_USER_NOTICE); set_exception_handler('lifeline_exception_handler'); //register_shutdown_function('check_for_fatal_errors'); // FIXME: this should be enabled while developing error_reporting(E_ALL); try { if(mb_ereg('(.*v1).*', $_SERVER['REQUEST_URI'], $matches)) { session_set_cookie_params(0, $matches[1]); } session_start(); $_SESSION['user'] = array('user_id' => 1); require_once('lib/TimePoint.php'); //require_once('lib/LifelineService.php'); //require_once('lib/UIEventLogWriter.php'); //UIEventLogWriter::log(TimePoint::now(), 'requests screen', LifelineService::getUserOtherId(), $_SERVER['REQUEST_URI']); require_once('lib/dispatch.php'); } catch(Exception $e) { echo "
";print_r($e);exit; try { if(isset($obj) && is_object($obj)) { if(is_a($e, 'TemplateNotFoundException')) { $response = $obj->notFound("Missing template"); send_response($response); } elseif(is_a($e, 'ConnectionException')) { $response = $obj->serviceUnavailable(5); send_response($response); } else { $response = $obj->errorReport($e); send_response($response); } } else { if(is_a($e, 'ConnectionException')) { $response = new LifelineResponse(array(array(HTTP_STATUS_RESPONSE_SERVICE_UNAVAILABLE => null), array('Content-Type' => 'text/plain'), array(HTTP_CONTENT_LANGUAGE => 'en_US'), array(HTTP_RETRY_AFTER => 5), ), 'Service unavailable. Please retry your request after five seconds.'); send_response($response); } else { echo 'Uncaught exception:'; print_r($e); echo ''; } } } catch(Exception $e) { echo ''; print_r($e); echo ''; } } restore_error_handler();