コード例 #1
0
<?php

include_once "db.php";
include_once "util.php";
include_once "login_filter.php";
include_once 'tables.php';
$budget_id = $_SESSION[SESSION_BUDGET_ID];
$month_id = $_SESSION[SESSION_MONTH_ID];
$folder_id_untrusted = null;
if (filter_input(INPUT_GET, 'folder_id') !== null) {
    $folder_id_untrusted = filter_input(INPUT_GET, 'folder_id');
}
if (filter_input(INPUT_POST, 'folder_id') !== null) {
    $folder_id_untrusted = filter_input(INPUT_POST, 'folder_id');
}
$folder = Folders::load_folder($folder_id_untrusted);
if ($folder_id_untrusted != $folder->id || $folder->budget_id != $budget_id) {
    die("Access Violation");
}
$unsafe_amount = filter_input(INPUT_POST, 'amount');
$unsafe_comment = filter_input(INPUT_POST, 'comment');
$message = "";
if (isset($unsafe_amount)) {
    Entries::add_transaction($folder->budget_id, $folder->id, $month_id, $unsafe_amount, $unsafe_comment);
    $message = "Added";
    header("location: index.php");
    die;
}
include 'header.php';
?>
<div role="main" class="ui-content jqm-content">
コード例 #2
0
ファイル: projection.php プロジェクト: robmayhew/escargot
        array_push($known_folders, $p->folder_id);
    }
}
foreach ($entries as $e) {
    $summary_by_folder[$e->folder_id] = $e;
    if (!in_array($e->folder_id, $known_folders)) {
        array_push($known_folders, $e->folder_id);
    }
}
$html = <<<RGDM
    <table>
        <tr><th>Folder Name</th><th>Projection</th><th>Spent</th></tr>
RGDM;
echo $html;
foreach ($known_folders as $folder_id) {
    $folder = Folders::load_folder($folder_id);
    $p = new Projection();
    $s = new EntrySummary();
    if (array_key_exists($folder_id, $projections_by_folder)) {
        $p = $projections_by_folder[$folder_id];
    }
    if (array_key_exists($folder_id, $summary_by_folder)) {
        $s = $summary_by_folder[$folder_id];
    }
    $folder_name = $folder->name;
    $amount = $p->amount;
    $spent = $s->total;
    $html = <<<RGDM
    <tr><td>{$folder_name}</td><td>{$amount}</td><td>{$spent}</td></tr>
RGDM;
    echo $html;