Example #1
0
require 'libraries/start.php';
function errorHtml($e)
{
    require 'classes/InvoiceHtml.php';
    $html = new InvoiceHtml();
    $html->setData($e);
    $html->error();
    exit;
}
// error check
try {
    $object = Routing::getToken('object');
    $id = Routing::getToken('id');
    $action = Routing::getToken('action');
    pr(Routing::parse());
    if ($object != 'invoices' && $object != 'payments') {
        throw new Exception('Invalid URL', 400);
    }
    if (!is_numeric($id)) {
        throw new Exception('Invalid ID supplied in URL', 400);
    }
    if ($action != 'view') {
        throw new Exception('Invalid action supplied in URL', 400);
    }
} catch (Exception $e) {
    errorHtml($e);
}
// find wkhtml; change value below for Windows/Linux path differences
$os = 'windows';
$PATH = Configuration::get('base_dir') . DS . 'libraries' . DS;