Beispiel #1
0
<?php

$site = Model_Site::Get($_REQUEST['id']);
if ($site->exists()) {
    require_once 'options.inc.php';
    $pm->setVariable('site', $site);
    if ($_SERVER['REQUEST_METHOD'] == 'POST') {
        include 'update.inc.php';
        Typeframe::Redirect('Site updated.', Plugin_Breadcrumbs::SavedState(Typeframe::CurrentPage()->applicationUri()));
    }
} else {
    Typeframe::Redirect('Invalid site specified.', Plugin_Breadcrumbs::SavedState(Typeframe::CurrentPage()->applicationUri()));
}
Beispiel #2
0
<?php

$site = Model_Site::Get($_REQUEST['id']);
if ($site->exists()) {
    $pm->setVariable('site', $site);
    if ($_SERVER['REQUEST_METHOD'] == 'POST') {
        Model_Site::Delete($_POST['id']);
        Typeframe::Redirect('Site deleted.', Plugin_Breadcrumbs::SavedState(Typeframe::CurrentPage()->applicationUri()));
    }
} else {
    Typeframe::Redirect('Invalid site specified.', Typeframe::CurrentPage()->applicationUri());
}
Beispiel #3
0
<?php

/*
	Comment admin delete controller

	24 march 2011: cleanedup
	29 march 2011: modified to use Comment class
*/
// back link
$back = Plugin_Breadcrumbs::SavedState(TYPEF_WEB_DIR . '/admin/comments');
// can only process POSTs
if ('POST' != $_SERVER['REQUEST_METHOD']) {
    Typeframe::Redirect('Nothing to do.', $back);
    return;
}
// delete given comment
$comment = Model_Comment::Get(@$_POST['commentid']);
if ($comment->exists()) {
    $comment->delete();
}
// done
Typeframe::Redirect('Comment deleted.', $back);
Beispiel #4
0
/**
 * Typeframe News application
 *
 * admin-side delete controller
 */
// save some typing below
$typef_app_dir = Typeframe::CurrentPage()->applicationUri();
// if not posting, bounce out of here
if ('POST' != $_SERVER['REQUEST_METHOD']) {
    Typeframe::Redirect('Nothing to do.', $typef_app_dir);
    return;
}
// create news article object from given id
$newsid = @$_POST['newsid'];
$article = Model_News_Article::Get($newsid);
// news article must exist to proceed
if (!$article->exists()) {
    Typeframe::Redirect('Invalid article id specified.', $typef_app_dir);
    return;
}
// current user must be the author of the article or an admin
if (Typeframe::User()->get('userid') != $article['authorid'] && Typeframe::User()->get('usergroupid') != TYPEF_ADMIN_USERGROUPID) {
    Typeframe::Redirect("You cannot delete other users' news items.", $typef_app_dir, 1, false);
    return;
}
// perform the delete
$article->delete();
// done
Typeframe::Redirect('Article has been deleted.', Plugin_Breadcrumbs::SavedState($typef_app_dir));
Beispiel #5
0
<?php

$comment = Model_Comment::Get($_REQUEST['commentid']);
if ($comment->exists()) {
    if ($_SERVER['REQUEST_METHOD'] == 'POST') {
        $state = $comment['approved'] ? 'unapproved' : 'approved';
        $comment['approved'] = !$comment['approved'];
        $comment->save();
        Typeframe::Redirect("Comment {$state}.", Plugin_Breadcrumbs::SavedState(TYPEF_WEB_DIR . '/admin/comments'));
    }
    $pm->setVariable('comment', $comment);
} else {
    Typeframe::Redirect("Invalid comment specified.", Plugin_Breadcrumbs::SavedState(TYPEF_WEB_DIR . '/admin/comments'), 1);
}
Beispiel #6
0
<?php

include 'form.inc.php';
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    $article = Model_News_Article::Create();
    include 'update.inc.php';
    if (!$article->dirty()) {
        Typeframe::Redirect('Article created.', Plugin_Breadcrumbs::SavedState(Typeframe::CurrentPage()->page()->uri()));
    }
}