Ejemplo n.º 1
0
 function puchipuchi($staff = 'Arai', $action = '', $comment = '')
 {
     $this->method = 'puchipuchi';
     $result = $this->post(compact('staff', 'action', 'comment'));
     if (SimpleTag::setof($tag, $result, 'rsp')) {
         return $tag->toHash();
     }
     return false;
 }
Ejemplo n.º 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');
 }
Ejemplo n.º 3
0
 function publish($src, &$paraser)
 {
     if (ExceptionTrigger::isException() && stripos($src, 'form ') !== false && SimpleTag::setof($tag, $src)) {
         foreach ($tag->getIn('input') as $input) {
             if (ExceptionTrigger::invalid($input->param('name'))) {
                 // どうやら発行されているようだ
                 $exceptions = ExceptionTrigger::get($input->param('name'));
                 $addHtml = '';
                 foreach ($exceptions as $e) {
                     $addHtml .= sprintf('<%s class="%s">%s</%s>', $this->tagName, $this->class, $e->getMessage(), $this->tagName);
                 }
                 $src = str_replace($input->getPlain(), $input->getPlain() . $addHtml, $src);
             }
         }
     }
     return $src;
 }