ここの情報は古いです。ご理解頂いた上でお取り扱いください。

Changeset 6899


Ignore:
Timestamp:
May 1, 2008, 7:57:40 PM (11 years ago)
Author:
ebihara
Message:

#2162:バナー画像追加・変更時に画像の形式チェックなどをおこなうようにした

Location:
OpenPNE/branches/stable-2.8.x/webapp/modules/admin
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • OpenPNE/branches/stable-2.8.x/webapp/modules/admin/do/insert_c_banner.php

    r1856 r6899  
    1010    function execute($requests)
    1111    {
    12         //c_banner insert
     12        $upfile_obj = $_FILES['upfile'];
     13        if (empty($upfile_obj) || $upfile_obj['error'] === UPLOAD_ERR_NO_FILE) {
     14            admin_client_redirect('insert_c_banner', '画像は必ず指定してください');
     15        }
     16
     17        if (!($image = t_check_image($upfile_obj))) {
     18            admin_client_redirect('insert_c_banner', '画像は' . IMAGE_MAX_FILESIZE . 'KB以内のGIF・JPEG・PNGにしてください');
     19        }
     20
    1321        $c_banner_id = db_admin_insert_c_banner($requests['a_href'], $requests['type'], $requests['nickname']);
    14         //c_banner insert
    1522
    16         //c_image delete && insert
    17         $ext = t_check_image_format($_FILES['upfile']);
    18         $c_banner['image_filename'] = "b_{$c_banner_id}_".time().".{$ext}";
    19         admin_insert_c_image($_FILES['upfile'], $c_banner['image_filename']);
    20         //c_image delete && insert
    21 
    22         //c_banner update
     23        $ext = t_check_image_format($upfile_obj);
     24        $c_banner['image_filename'] = sprintf('b_%d_%d.%s', $c_banner_id, time(), $ext);
     25        admin_insert_c_image($upfile_obj, $c_banner['image_filename']);
    2326        db_admin_update_c_banner($c_banner_id, $c_banner);
    24         //c_banner update
    2527
    2628        admin_client_redirect('edit_c_banner', 'バナーを追加しました');
  • OpenPNE/branches/stable-2.8.x/webapp/modules/admin/do/update_c_banner.php

    r1856 r6899  
    1212        $c_banner_id = $requests['c_banner_id'];
    1313
    14         //c_image delete && insert
    15         if ($_FILES['upfile']['name']) {
     14        $upfile_obj = $_FILES['upfile'];
     15        if (!empty($upfile_obj) && $upfile_obj['error'] !== UPLOAD_ERR_NO_FILE) {
     16            if (!($image = t_check_image($upfile_obj))) {
     17                $tail = '&c_banner_id=' . $c_banner_id;
     18                admin_client_redirect('update_c_banner', '画像は' . IMAGE_MAX_FILESIZE . 'KB以内のGIF・JPEG・PNGにしてください', $tail);
     19            }
     20
    1621            db_admin_delete_c_image4c_banner_id($c_banner_id);
    1722
    18             $ext = t_check_image_format($_FILES['upfile']);
    19             $c_banner['image_filename'] = "b_{$c_banner_id}_".time().".{$ext}";
    20             admin_insert_c_image($_FILES['upfile'], $c_banner['image_filename']);
     23            $ext = t_check_image_format($upfile_obj);
     24            $c_banner['image_filename'] = sprintf('b_%d_%d.%s', $c_banner_id, time(), $ext);
     25            admin_insert_c_image($upfile_obj, $c_banner['image_filename']);
    2126        }
    22         //c_image delete && insert
    2327
    2428        $c_banner['a_href'] = $requests['a_href'];
     
    2832        $c_banner['is_hidden_after'] = $requests['is_hidden_after'];
    2933
    30         //c_banner update
    3134        db_admin_update_c_banner($c_banner_id, $c_banner);
    32         //c_banner update
    3335
    3436        admin_client_redirect('edit_c_banner', 'バナーを変更しました');
  • OpenPNE/branches/stable-2.8.x/webapp/modules/admin/templates/insert_c_banner.tpl

    r1487 r6899  
    1111({*ここまで:navi*})
    1212
     13({if $msg})<p class="actionMsg">({$msg})</p>({/if})
    1314<h2>バナー追加</h2>
    1415<div class="contents">
  • OpenPNE/branches/stable-2.8.x/webapp/modules/admin/templates/update_c_banner.tpl

    r2803 r6899  
    77({*ここまで:navi*})
    88
     9({if $msg})<p class="actionMsg">({$msg})</p>({/if})
    910<h2>バナー変更</h2>
    1011<div class="contents">
Note: See TracChangeset for help on using the changeset viewer.