Пример #1
0
 public function action_thumbnail($imgId = 0)
 {
     $img = Model_Attach::find($imgId);
     $mime = $img['mime'];
     $body = $img['thumbData'];
     if (isset($mime) && isset($body)) {
         header($mime);
         echo $body;
         return Response::forge($body, 200, array('Content-Type' => $mime));
     }
     return Response::forge($body, 200, array('Content-Type' => $mime));
 }
Пример #2
0
 /**
  * 管理者権限で画像を削除コントローラ
  * @param type $shortName
  * @param type $threadId
  * @param type $imgId
  * @return type
  */
 public function action_adminImageDelete($shortName = null, $threadId = null, $imgId = null)
 {
     if ($shortName == null || $threadId == null || $imgId == null) {
         $log = new Logging();
         $log->writeLog_Warning('trying to detele attache. but shortName or threadId or imgId is null.', __FILE__, __LINE__);
         return Response::forge('パラメータ異常');
     }
     $mode = Input::get('mode');
     if ($mode == null || $mode != 'confirm' && $mode != 'delete') {
         $log = new Logging();
         $log->writeLog_Warning('trying to detele attache. but mode-parameter is invalid.', __FILE__, __LINE__);
         return Response::forge('パラメータ異常');
     }
     //掲示板を取得
     $board = $this->getBoardFromShortName($shortName);
     if ($board == null) {
         $log = new Logging();
         $log->writeLog_Warning('trying to detele attache. but board is missing.', __FILE__, __LINE__);
         return Response::forge('パラメータ異常');
     }
     //スレッドのbbsIdを確認
     if (!$this->isBoardContainsArticle($board, $threadId)) {
         $log = new Logging();
         $log->writeLog_Warning('trying to detele attache. but board is not contain thread.', __FILE__, __LINE__);
         return Response::forge('パラメータ異常');
     }
     //画像が指定の掲示板に含まれるか?
     if (!$this->isBoadrdContainsAttach($board, $imgId)) {
         $log = new Logging();
         $log->writeLog_Warning('trying to detele attache. but board is not contain attache.', __FILE__, __LINE__);
         return Response::forge('パラメータ異常');
     }
     $this->setBoardTitle($board);
     $backURL = '/bbs/thread' . DS . $shortName . DS . $threadId;
     if ($this->isBoardMine($board)) {
         if ($mode == 'confirm') {
             $data['imgId'] = $imgId;
             $data['shortName'] = $shortName;
             $data['threadId'] = $threadId;
             $data['backURL'] = $backURL;
             $content = View::forge('bbs/imgDeleteConfirm', $data);
             $this->template->content = $content;
             return;
         } else {
             if ($mode == 'delete') {
                 $at = Model_Attach::find($imgId);
                 $at->delete();
                 Session::set('errorMsg', '画像を削除しました。');
                 Response::redirect($backURL);
             }
         }
     }
     $log = new Logging();
     $log->writeLog_Warning('trying to detele attache. but owner is invalid', __FILE__, __LINE__);
     return Response::forge('パラメータ異常');
 }
Пример #3
0
<?php

if (isset($imgId) && isset($shortName)) {
    //掲示板を取得
    $query = Model_Board::query()->where('shortName', $shortName);
    $board = $query->get_one();
    if ($board == null) {
        echo 'パラメータ異常';
        return;
    }
    //画像のbbsIDを確認
    $img = Model_Attach::find($imgId);
    if ($img == null) {
        echo 'パラメータ異常';
        return;
    }
    if ($img->bbsId != $board->id) {
        echo 'パラメータ異常';
        return;
    }
    if (Auth::check()) {
        if ($board->userId == Auth::get('id')) {
            echo '<img src =\'/imgLoader/thumbnail/' . $imgId . '\' width=100/><BR>';
            echo '<BR>';
            echo '管理者権限で画像を削除しますか?<BR>';
            echo '<div id=\'redBox\'> <a href = \'' . Uri::current() . '?mode=delete\'>削除</a></div>';
            echo '<div id=\'shortBox\'> <a href = \'' . $backURL . '\'>キャンセル</a></div>';
            echo '<BR>';
            echo '<BR>';
            return;
        }