Beispiel #1
0
$PAGE->page_start();
$PAGE->stripe_start();

#$q = $db->query('SELECT COUNT(*) AS c FROM alerts');
#$total = $q->field(0, 'c');
#$tabledata = array (
#	'header' => array('Stat', 'Number'),
#	'rows' => $rows
#);
#$PAGE->display_table($tabledata);

if (DEVSITE) {
    $out = '';
    if (get_http_var('submit_photo')) {
        $out = submit_photo();
    } else {
        $out = display_form();
    }
    print $out;
} else {
    ?><p>You can't upload files on a live site, as it doesn't have permissions
    to commit to git. Please go to one of the staging sites.</p>
    <?
}

function submit_photo() {
    $dir = "../images";
    $pid = intval(get_http_var('pid'));
    $errors = array();
Beispiel #2
0
$this_page = 'admin_photos';
$db = new ParlDB();
$PAGE->page_start();
$PAGE->stripe_start();
?>

<p>Photos are automatically added to version control and committed. Because of this,
the photo upload interface only works on a development version of the site. On the
other hand, setting attribution needs to be done on the live database, on the live
version of the site.
</p>

<?php 
$out = '';
if (get_http_var('submit')) {
    $out = DEVSITE ? submit_photo() : submit_attribution();
} else {
    $out = DEVSITE ? display_photo_form() : display_attribution_form();
}
print $out;
function submit_photo()
{
    $dir = "../images";
    $pid = intval(get_http_var('pid'));
    $errors = array();
    if (!array_key_exists('photo', $_FILES)) {
        array_push($errors, 'Not got the photo.');
    } elseif ($_FILES['photo']['error'] > 0) {
        array_push($errors, 'There was an error uploading the photo.');
    } elseif (!is_uploaded_file($_FILES['photo']['tmp_name'])) {
        array_push($errors, 'Did not get an uploaded file.');