Пример #1
0
/**
 * Main entry point for churchtools.
 * This will be called from /index.php
 * Function load constants and simple functions and have a try and catch for the whole application
 * It calls churchtools_app().
 */
function churchtools_main()
{
    try {
        require "system/includes/constants.php";
        include_once INCLUDES . "/functions.php";
        includePlugins();
        churchtools_app();
    } catch (SQLException $e) {
        //  TODO: get sql and show it to admin only
        //  if (DEBUG) {
        //  echo "<h3>PDO-Error:</h3>", $db->errorCode(), "<br>", $db->lastQuery(), '<br>';
        //  }
        //  else {
        //  echo "<h3>Database-Error:</h3>", "There is an error";
        //  }
        CTException::reportError($e);
    } catch (CTException $e) {
        $e->reportError($e);
    } catch (Exception $e) {
        echo '
<div class="alert alert-error">
    <h3>Sorry, but there is an Error:</h3>
    <p><br/>' . $e->getMessage() . '</p>
  </div>';
    }
}
Пример #2
0
/**
 * Main entry point for churchtools.
 * This will be called from /index.php
 * Function loads constants and simple functions and have a try and catch for the whole application
 * It calls churchtools_app().
 */
function churchtools_main()
{
    try {
        //TODO: find a good place for constants.php
        require "system/includes/constants.php";
        include_once INCLUDES . "/functions.php";
        include_once INCLUDES . "/start.php";
        churchtools_app();
    } catch (SqlException $e) {
        //  TODO: get sql and show it to admin only
        //  if (DEBUG) {
        //  echo "<h3>PDO-Error:</h3>", $db->errorCode(), "<br>", $db->lastQuery(), '<br>';
        //  }
        //  else {
        //  echo "<h3>Database-Error:</h3>", "There is an error";
        //  }
        CTException::reportError($e);
    } catch (CTException $e) {
        $e->reportError($e);
    } catch (Exception $e) {
        echo '
<div style="margin:2em;padding:2em;background-color:#ffdddd">
    <h3>Sorry, but there is an Error:</h3>
    <p><br/>' . $e->getMessage() . '</p>
  </div>';
    }
}