public function flow_handled(Flow $flow) { if (!$flow->isPost()) { $flow->vars("_onetimeticket", uniqid("") . mt_rand()); $flow->sessions("_onetimeticket", $flow->inVars("_onetimeticket")); } }
// foreach(R(new TwitterAPI())->friends_timeline() as $message) $messages[] = Message::parse($message); foreach (R(new WassrAPI())->friends_timeline() as $message) { $messages[] = Message::parse($message); } $messages = omerge($messages, "key"); rosort($messages, "created_at"); return $messages; } public static function update($text) { R(new TwitterAPI())->update($text); R(new WassrAPI())->update($text); } } $flow = new Flow(); if ($flow->isPost() && $flow->isVars("text")) { Message::update($flow->inVars("text")); $flow->redirect_self(); } $flow->vars("messages", Message::friends_timeline()); //$flow->output(__FILE__); exit; ?> <rt:template> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> </head> <body> <form method="post"> <textarea rows="3" cols="50" name="text"></textarea>
<?php require dirname(__FILE__) . '/__init__.php'; Rhaco::import('generic.Flow'); Rhaco::import('network.http.Header'); $flow = new Flow(); if (!$flow->isVariable('id')) { Header::redirect(Rhaco::url()); } $db = new DbUtil(Event::connection()); if ($flow->isPost() && $flow->isVariable('pass')) { $participant = $db->get(new Participant($flow->getVariable('id'))); if (Variable::istype('Participant', $participant) && $participant->hash === $flow->getVariable('pass')) { $db->delete($participant); Header::redirect(Rhaco::url()); } } $flow->setVariable('hatena', Rhaco::obj('HatenaSyntax', array('headlevel' => 4, 'id' => 'event_description'))); $flow->write('cancel.html');
<?php require dirname(__FILE__) . '/__init__.php'; Rhaco::import('generic.Flow'); $flow = new Flow(); $db = new DbUtil(Event::connection()); if ($flow->isPost() && $flow->isVariable('answer') && strtolower($flow->getVariable('answer')) == strtolower(Rhaco::constant('ANSWER'))) { $p = $flow->toObject(new Participant()); if ($db->insert($p)) { $flow->setVariable('participant', $p); $flow->write('thanks.html'); Rhaco::end(); } } else { ExceptionTrigger::raise(new GenericException('登録に失敗しました')); } $flow->setVariable('event', $db->get(new Event(), new C(Q::depend(), Q::eq(Event::columnId(), Rhaco::constant('CURRENT_EVENT', 1))))); $flow->setVariable('hatena', Rhaco::obj('HatenaSyntax', array('headlevel' => 4, 'id' => 'event_description'))); $flow->write('index.html');