コード例 #1
0
 function beforeDelete($db)
 {
     $event = $db->get(new Event($this->event));
     if (!Variable::istype('Event', $event) || !$event->isActive($db)) {
         return false;
     }
     return true;
 }
コード例 #2
0
ファイル: ClippAPI.php プロジェクト: riaf/private-arbo
 function add($entry)
 {
     $this->method = 'add';
     if (Variable::istype('ClippAtomEntry10', $entry)) {
         $this->browser->setRequestHeader(array('type' => 'application/atom+xml;type=entry;charset=utf-8', 'rawdata' => '<?xml version="1.0" encoding="utf-8"?>' . PHP_EOL . $entry->get()));
         return $this->post();
     }
     return false;
 }
コード例 #3
0
ファイル: ConcertView.php プロジェクト: riaf/concert
 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');
 }
コード例 #4
0
ファイル: cancel.php プロジェクト: riaf/jp.rhaco-users.kaigi
<?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');