コード例 #1
0
ファイル: blocks.php プロジェクト: acohn/grinnellplans-php
    $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 />
        <b>Please be aware that your activity on Notes is still visible to everyone.</b> If you feel this presents a serious problem to you, please <a href="mailto:grinnellplans@gmail.com">contact the administrators</a>.');
    $header->append($about);
    $heading = new HeadingText('Blocked Users', 2);
    $thispage->append($heading);
    $blocklist = new WidgetList('blocked_user_list', true);
    $thispage->append($blocklist);
    $q = Doctrine_Query::create()->select("*")->from("Accounts a")->innerJoin("a.BlockedBy b")->where("b.blocking_user_id = ?", $idcookie);
    $blocked_users = $q->execute();
    foreach ($blocked_users as $blocked_user) {
        $entry = new WidgetGroup('newplan', false);
        $plan = new PlanLink($blocked_user->username);
        $form = new Form('block', 'User blocking options');
        $item = new HiddenInput('unblock_user', $blocked_user->userid);
        $form->append($item);
        $item = new SubmitInput("Unblock {$blocked_user->username}");
        $form->append($item);
        $entry->append($plan);
        $entry->append($form);
        $blocklist->append($entry);
    }
}
interface_disp_page($thispage);
db_disconnect($dbh);
コード例 #2
0
ファイル: anonymous.php プロジェクト: acohn/grinnellplans-php
    $offset = isset($_GET['offset']) ? $_GET['offset'] : 0;
    if (!is_numeric($offset)) {
        $offset = 0;
    }
    $linkbox = new WidgetGroup("linkbox", false);
    $linkbox->append(new RegularText("<br />"));
    if (isset($offset) && $offset > 0) {
        $link = new Hyperlink('newer_secrets', false, 'anonymous.php?offset=' . ($offset - $count), 'Newer Secrets');
        $linkbox->append($link);
    }
    $link = new Hyperlink('older_secrets', false, 'anonymous.php?offset=' . ($offset + $count), 'Older Secrets');
    $linkbox->append($link);
    $select_query = "select * from secrets where display = 'yes' or display = 'pref'  order by date desc limit {$offset}, {$count}";
    if (!($secrets = mysql_query($select_query))) {
        $page->append(new AlertText("No secrets", false));
    } else {
        $box_o_secrets = new WidgetGroup('secrets', true);
        $box_o_secrets->append($linkbox);
        $page->append($box_o_secrets);
        while ($row = mysql_fetch_array($secrets)) {
            $text = $row['secret_text'];
            $secret = new Secret($text);
            $secret->date = strtotime($row['date']);
            $secret->secret_id = $row['secret_id'];
            $box_o_secrets->append($secret);
        }
        $box_o_secrets->append($linkbox);
    }
}
interface_disp_page($page);
db_disconnect($dbh);
コード例 #3
0
 /**
  * @param FormItem|FormItemSet
  */
 public function append($item)
 {
     $item->parent_form = $this;
     parent::append($item);
 }
コード例 #4
0
ファイル: planwatch.php プロジェクト: acohn/grinnellplans-php
$item = new TextInput('mytime', $mytime);
$item->title = 'Plans updated in the past:';
$item->description = 'hours';
$item->cols = 2;
$timeform->append($item);
$item = new SubmitInput('See Plans');
$timeform->append($item);
$q = Doctrine_Query::create()->select("userid,username,DATE_FORMAT(changed,\n'%l:%i %p, %a %M %D ') as updated")->from("Accounts a")->where("changed > DATE_SUB(NOW(), INTERVAL ? HOUR)", $mytime)->orderBy("changed desc");
if (User::logged_in()) {
    $q->andWhereNotIn("userid", Block::allUserIdsWithBlockingRelationships(User::id()));
} else {
    $q->andWhere('webview = 1');
}
$results = $q->fetchArray();
//do the query with specifying date format to be returned
$newplanslist = new WidgetList('new_plan_list', true);
$thispage->append($newplanslist);
//display the results of the query
foreach ($results as $new_plans) {
    $entry = new WidgetGroup('newplan', false);
    $plan = new PlanLink($new_plans["username"]);
    $time = new RegularText($new_plans["updated"], 'Date Created');
    $entry->append($plan);
    $entry->append($time);
    $newplanslist->append($entry);
}
interface_disp_page($thispage);
db_disconnect($dbh);
?>