Exemplo n.º 1
0
function processRequest($q)
{
    $q = rtrim($q, ' /');
    if (!$q) {
        $q = '/';
    }
    try {
        runController($q, array(), getMiddlewares($q));
    } catch (LoadException $e) {
        error_log(formatException($e));
        runController('/_404');
    }
}
Exemplo n.º 2
0
 /**
  * Log an exception.
  *
  * @param Exception $Ex
  */
 function logException($Ex)
 {
     if (!class_exists('Gdn', false)) {
         return;
     }
     if ($Ex instanceof Gdn_UserException) {
         return;
     }
     // Attempt to log the exception in the PHP logs
     errorLog(formatException($Ex));
 }
Exemplo n.º 3
0
    $content = $inventory->getContent();
} else {
    try {
        $inventory = new InternshipInventory();
        $inventory->handleRequest();
        $content = $inventory->getContent();
    } catch (\Exception $e) {
        try {
            \NQ::simple('intern', \Intern\UI\NotifyUI::ERROR, 'The Intern Inventory has experienced an error. The software engineers have been notified about this problem. We apologize for the inconvenience.');
            $message = formatException($e);
            emailError($message);
            \NQ::close();
            \Intern\UI\NotifyUI::display();
            \PHPWS_Core::goBack();
        } catch (Exception $e) {
            $message2 = formatException($e);
            echo "The Intern Inventory has experienced a major internal error.  Attempting to email an admin and then exit.";
            $message = "Something terrible has happened, and the exception catch-all threw an exception.\n\nThe first exception was:\n\n{$message}\n\nThe second exception was:\n\n{$message2}";
            mail('*****@*****.**', 'A Major Intern Inventory Error Has Occurred', $message);
            exit;
        }
    }
}
/**
 * Plug content into TopUI. Show notifications. Add Style.
 */
if (isset($content)) {
    if ($content === false) {
        \NQ::close();
        \PHPWS_Core::reroute('index.php?module=intern');
    }
Exemplo n.º 4
0
function deleteRecord($tableName, $primaryField, $key)
{
    try {
        global $conn;
        $stmt = $conn->prepare("DELETE FROM `{$tableName}`\n\t\t\tWHERE \t\t{$primaryField} = :key");
        $stmt->bindParam(':key', $key);
        $stmt->execute();
        return array('result' => true, 'message' => '<p class="center-align">' . ucwords(str_replace('_', ' ', $tableName)) . ' was successfuly removed.</p>');
    } catch (PDOException $e) {
        return array('result' => false, 'message' => $e->errorInfo[1] === 1451 ? 'Sorry, but you cannot delete this record because there is/are (a) record(s) that depends on this particular ' . ucwords(str_replace('_', ' ', $tableName)) : formatException($e));
    }
}