function _redirectForm($url, $headers)
    {
        print <<<HTML
<html>
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" /></head>
<body onload="document.login.submit();">
    <form action="{$url}" method="post" name="login">
HTML;
        foreach ($headers as $name => $value) {
            printf('<input type="hidden" name="%s" value="%s" />', $name, $value);
        }
        print <<<HTML
        <input type="submit" value="login" />
    </form>
</body>
</html>
HTML;
        Rhaco::end();
    }
Exemple #2
0
 function upload()
 {
     if ($this->isPost() && $this->isFile('stage')) {
         $file = $this->getFile('stage');
         $src = mb_convert_encoding(file_get_contents($file->tmp), 'utf-8', 'Shift_JIS,EUC-JP,UTF-8');
         if (SimpleTag::setof($tag, $src, 'body', true)) {
             foreach ($tag->getIn('applet') as $applet) {
                 if ($applet->getParameter('code') != 'MasaoConstruction') {
                     continue;
                 }
                 $gamedata = array();
                 foreach ($applet->getIn('param') as $param) {
                     $gamedata[$param->getParameter('name')] = array('name' => $param->getParameter('name'), 'value' => $param->getParameter('value'));
                 }
                 if (empty($gamedata)) {
                     break;
                 }
                 $stage = $this->dbUtil->insert($this->toObject(new Stage()));
                 if (!Variable::istype('Stage', $stage)) {
                     break;
                 }
                 $_images = array('title', 'ending', 'gameover', 'pattern', 'chizu');
                 foreach ($_images as $k) {
                     if (!isset($gamedata[sprintf("filename_%s", $k)])) {
                         continue;
                     }
                     $gamedata[sprintf("filename_%s", $k)] = array('name' => sprintf("filename_%s", $k), 'value' => 'images/' . $k . '.gif');
                     if ($this->isFile('img_' . $k)) {
                         $image = $this->getFile('img_' . $k);
                         $img_info = getimagesize($image->tmp);
                         if ($img_info[2] != IMAGETYPE_GIF) {
                             continue;
                         }
                         $filename = Rhaco::path(sprintf('images/%s_%d.gif', $k, $stage->id));
                         if (move_uploaded_file($image->tmp, $filename)) {
                             $gamedata[sprintf("filename_%s", $k)] = array('name' => sprintf("filename_%s", $k), 'value' => sprintf("images/%s_%d.gif", $k, $stage->getId()));
                         }
                     }
                 }
                 FileUtil::write(Rhaco::path(sprintf('stages/%d.apif', $stage->id)), serialize($gamedata));
                 Header::redirect(Rhaco::url());
                 Rhaco::end();
             }
         }
     }
     return $this->parser('upload.html');
 }
Exemple #3
0
<?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');