コード例 #1
0
ファイル: newproject.php プロジェクト: lobolabs/fossfactory
    $name = trim($name);
    $reqmts = trim($reqmts);
    $fundgoal2 = (int) ($fundgoal * 100);
    if ($_REQUEST["newproject_action"] === 'savedraft') {
        list($rc, $err) = ff_saveprojectdraft($username, $name, $fundgoal2, $reqmts, $draftid === '' ? false : $draftid);
        if ($rc) {
            header("Location: newproject.php?draft={$draftid}&name=" . urlencode($name) . "&reqmts=" . urlencode($reqmts) . "&err=1");
            exit;
        }
        $draftid = $err;
        header("Location: account.php?tab=drafts");
        exit;
    }
    list($rc, $id) = ff_createproject($username, $name, $reqmts, '', false, empty($draftid) ? false : $draftid);
    if (!$rc) {
        ff_setfundinggoal($username, $id, $fundgoal2 . $GLOBALS['pref_currency']);
        header("Location: " . projurl($id));
        exit;
    }
    header("Location: newproject.php?draft={$draftid}&name=" . urlencode($name) . "&reqmts=" . urlencode($reqmts) . "&fundgoal=" . urlencode($fundgoal) . "&err=1");
    exit;
}
apply_template("New Project", array(array("name" => "New Project", "href" => "newproject.php")));
if ($err) {
    print "<div class=error>" . htmlentities($err) . "</div>\n";
}
?>
<h1>Create a New Project</h1>
<script>
function newProjectSubmitCheck() {
    f = document.form;
コード例 #2
0
        exit;
    }
    $tempdir = "{$GLOBALS['DATADIR']}/tempattachments/{$sid}";
    $attachments = array();
    foreach ($_REQUEST as $key => $filename) {
        if (!ereg("^attachment_filename_([a-zA-Z0-9]+)\$", $key, $parts)) {
            continue;
        }
        $basename = $parts[1];
        $attachments[] = array('filename' => $filename, 'pathname' => "{$tempdir}/{$basename}", 'description' => '');
    }
    $reqmts = trim($reqmts);
    $lead = $_REQUEST["makemelead"] ? $username : ($parent['lead'] ? $parent['lead'] : '');
    list($rc, $id) = ff_createproject($username, $name, $reqmts, $p, $attachments, false, 'subproject', $lead, isset($_REQUEST["allotment"]) ? round(floatval($_REQUEST["allotment"]) * 10) : false);
    if (!$rc) {
        ff_setfundinggoal($username, $id, (int) ($fundgoal * 100) . $GLOBALS['pref_currency']);
        header("Location: " . projurl($id));
        exit;
    }
    $err = $id;
}
apply_template("New Project", array(array("name" => "New Project", "href" => "newsubproject.php?p={$p}")));
if ($err) {
    print "<div class=error>" . htmlentities($err) . "</div>\n";
}
?>
<h1>Create a New Subproject</h1>
<?php 
if ($username == '') {
    ?>
<p class="note">
コード例 #3
0
ファイル: project.php プロジェクト: lobolabs/fossfactory
                    if (!$rc) {
                        if (!isset($currencies[$_REQUEST["currency"]])) {
                            exit;
                        }
                        $currency = $currencies[$_REQUEST["currency"]];
                        $amount = round($_REQUEST["remove_amount"] * $currency["multiplier"]) . $currency["code"];
                        list($rc, $err) = ff_setsponsorship($id, $username, "-{$amount}", true);
                    }
                    header("Location: {$GLOBALS['SITE_URL']}" . projurl($id, "tab=" . urlencode($tab) . "&r_err={$rc}&amount={$amount}"));
                    exit;
                } else {
                    if ($_POST['init_goal'] && $GLOBALS['username']) {
                        // Assume English numbers: 1,000,000.01 OR 1 000 000.01 -> 1000000.01
                        $amount = (double) str_replace(array(' ', ','), '', $_POST['init_goal']);
                        $amount = (int) ($amount * 100);
                        list($rc, $msg) = ff_setfundinggoal($GLOBALS['username'], $id, $amount . $GLOBALS['pref_currency']);
                        if ($rc == 0) {
                            header("Location: {$GLOBALS['SITE_URL']}" . projurl($id, "tab=" . urlencode($tab)));
                        }
                    }
                }
            }
        }
    }
}
$parent = scrub($_REQUEST["parent"]);
$post = scrub($_REQUEST["post"]);
if (!$tab) {
    $tab = 'requirements';
}
// Get the project info