Example #1
0
 function do_inline($page, $param1, $param2)
 {
     mb_ereg('^(.*?)(?:\\s*,\\s*(.*?))?$', trim($param1), $m);
     $file = $m[1];
     $page = $m[2] == '' ? $page : Page::getinstance($m[2]);
     if (!Attach::getinstance($page)->isexist($file)) {
         return '<span class="warning">ファイルがありません</span>';
     }
     $url = SCRIPTURL . '?cmd=attach' . '&amp;param=download' . '&amp;page=' . rawurlencode($page->getpagename()) . '&amp;file=' . rawurlencode($file);
     return '<a href="' . $url . '">' . htmlspecialchars($file) . '</a>';
 }
Example #2
0
 function do_inline($page, $param1, $param2)
 {
     mb_ereg('^(.*?)(?:\\s*,\\s*(.*?))?$', trim($param1), $m);
     $file = $m[1];
     $page = $m[2] == '' ? $page : Page::getinstance($m[2]);
     if (!Attach::getinstance($page)->isexist($file)) {
         return '<span class="warning">ファイルがありません</span>';
     }
     if (!mb_ereg('\\.(.+?)$', $file, $m) || !isset(Plugin_image::$type[$m[1]])) {
         return '<span class="warning">.' . htmlspecialchars($m[1]) . 'には対応していません</span>';
     }
     $url = SCRIPTURL . '?plugin=image&amp;page=' . rawurlencode($page->getpagename()) . '&amp;file=' . rawurlencode($file);
     if ($m[1] == 'swf') {
         $smarty = new PluginSmarty('image');
         $smarty->assign('url', $url);
         return $smarty->fetch('swf.tpl.htm');
     } else {
         return '<img src="' . $url . '" />';
     }
 }
Example #3
0
 /**
  * ページ名を変更する(ソースコードを移動する)。
  * 
  * @param	Page	$page	変更前ページ
  * @param	Page	$newpage	変更後ページ
  * @return	bool	成功すればtrue。
  */
 protected function _rename($page, $newpage)
 {
     if ($newpage->isexist()) {
         return false;
     }
     $db = DataBase::getinstance();
     $db->begin();
     $mail = Mail::getinstance();
     $old = $mail->setsending(false);
     $newpage->write($page->getsource());
     $page->write('');
     $mail->setsending($old);
     try {
         Attach::getinstance($page)->move($newpage);
     } catch (DBException $e) {
         $db->rollback();
         return false;
     }
     $this->notify(array($page, $newpage));
     $this->mail($page, $newpage);
     $db->commit();
     return true;
 }
Example #4
0
 protected function change_attach($attach, $arg)
 {
     if ($arg[0] == 'rename') {
         $head = '添付ファイルの名前が変更されました。';
         $body[] = '旧ファイル名:' . $arg[1];
         $body[] = '新ファイル名:' . $arg[2];
     }
     if ($arg[0] == 'move') {
         $from = Attach::getinstance(Page::getinstance($arg[1]))->getlist();
         $to = Attach::getinstance(Page::getinstance($arg[2]))->getlist();
         if ($from == array() && $to == array()) {
             //添付ファイルがない場合は何もしない
             return;
         }
         $head = '添付ファイルの添付先が変更されました。';
         $body[] = '旧ページ名:' . $arg[1];
         $body[] = '新ページ名:' . $arg[2];
         $body[] = '';
         $body[] = '以下のファイルが新ページに添付されています。';
         $body[] = join("\n", $to);
         $body[] = '以下のファイルが旧ページ添付されています。';
         $body[] = join("\n", $from);
     } else {
         return;
     }
     $subject = '[' . SITENAME . '] ' . $attach->getpage()->getpagename();
     $text[] = $head;
     $text[] = $this->geturl($attach->getpage());
     $text[] = '----------------------------------------------------------------------';
     $text[] = join("\n", $body);
     sendmail($subject, join("\n", $text));
 }
Example #5
0
 function update($show, $arg)
 {
     if ($arg == 'done') {
         $page = $this->getcurrentPage();
         $list = Attach::getinstance($page)->getlist();
         if ($list != array()) {
             $smarty = $this->getSmarty();
             $smarty->assign('attach', $list);
             $smarty->assign('pagename', $page->getpagename());
             $this->setbody($smarty->fetch('page.tpl.htm'));
         }
     }
 }