コード例 #1
0
ファイル: blocks.php プロジェクト: acohn/grinnellplans-php
<?php

require_once 'Plans.php';
require 'functions-main.php';
require 'syntax-classes.php';
$dbh = db_connect();
$idcookie = User::id();
$thispage = new PlansPage('Preferences', 'blocks', PLANSVNAME . ' - Blocking', 'blocks.php');
if (!User::logged_in()) {
    populate_guest_page($thispage);
    $denied = new AlertText('You are not allowed to edit as a guest.', 'Access Denied');
    $thispage->append($denied);
} else {
    populate_page($thispage, $dbh, $idcookie);
    if (isset($_REQUEST["unblock_user"])) {
        Block::removeBlock($idcookie, $_REQUEST["unblock_user"]);
        $success = new InfoText('User unblocked.');
        $thispage->append($success);
    }
    $header = new WidgetGroup('blocking_header', true);
    $heading = new HeadingText('Blocking', 1);
    $header->append($heading);
    $thispage->append($header);
    $user = User::get();
    if ($user->webview == 1) {
        $warning = new AlertText("Warning! Your plan is set to be viewable by guests. This will allow blocked users to read your plan\n            simply by logging out. If you would like to change this setting, please visit\n            <a href=\"/webview.php\">the guest settings page</a>.");
        $header->append($warning);
    }
    $about = new InfoText('Users that you have blocked will not be able to read your plan, and you will not see each other listed in quicklove or search results.
        <a href="/blocking-about.php">See the FAQ for more information</a>.
        <br /><br />
コード例 #2
0
ファイル: edit.php プロジェクト: acohn/grinnellplans-php
<?php

require_once 'Plans.php';
require 'functions-main.php';
require "syntax-classes.php";
$dbh = db_connect();
///connect to the database
$idcookie = User::id();
// Create the new page
$page = new PlansPage('Main', 'edit', PLANSVNAME . ' - Edit Plan', 'edit.php');
if (!User::logged_in()) {
    populate_guest_page($page);
    //tell them not able to use page
    $page->append(new AlertText("You are not allowed to edit as a guest.", false));
} else {
    populate_page($page, $dbh, $idcookie);
    // Get the user and plan information
    $q = Doctrine_Query::create()->from('Accounts a')->innerJoin('a.Plan p')->where('a.userid = ?', $idcookie)->orderBy('p.id ASC');
    $user = $q->fetchOne();
    if (!isset($_POST["plan"])) {
        // If this is the test server, give them a warning
        if ($GLOBALS['ENVIRONMENT'] == 'testing') {
            $betawarn = new AlertText('Remember, any changes you make here won\'t show up on regular Plans.', 'We\'re in beta');
            $page->append($betawarn);
        }
        // Add the edit form
        $plantext = $user->Plan->edit_text;
        $editbox = make_editbox($plantext, $user, 1);
        $page->append($editbox);
        $editbox->append(new HiddenInput('edit_text_md5', md5($plantext)));
        $log_msg = "Edit page loaded: id {$idcookie}, edit_text \"" . substr($plantext, 0, 50) . "..." . substr($plantext, -50) . '"';