Browse Source

휘파람보드 1.2.0

- 대규모 업데이트
master
장선근 6 years ago
parent
commit
3a90bcaa25
  1. 22
      wheeparam/application/controllers/Board.php
  2. 16
      wheeparam/application/controllers/admin/Board.php
  3. 2
      wheeparam/application/helpers/common_helper.php
  4. 10
      wheeparam/application/models/Board_model.php
  5. 23
      wheeparam/config/wheeparam.sql
  6. 2
      wheeparam/views/skins/board/view/basic/view.php
  7. 2
      wheeparam/views/skins/board/write/basic/write.php
  8. 2
      wheeparam/views/themes/admin/board/read.php
  9. 2
      wheeparam/views/themes/admin/board/write.php

22
wheeparam/application/controllers/Board.php

@ -692,17 +692,17 @@ class Board extends WB_Controller {
{
$filedata = $this->upload->data();
$this->data['upload_array'][] = array(
"brd_key" => $brd_key,
"att_target_type" => 'BOARD',
"att_origin" => $filedata['orig_name'],
"att_filename" => $dir_path . "/" . $filedata['file_name'],
"att_caption" => $filedata['orig_name'],
"att_filepath" => $dir_path . "/" . $filedata['file_name'],
"att_downloads" => 0,
"att_filesize" => $filedata['file_size'] * 1024,
"att_image_width" => $filedata['image_width'] ? $filedata['image_width'] : 0,
"att_image_height" => $filedata['image_height'] ? $filedata['image_height'] : 0,
"att_width" => $filedata['image_width'] ? $filedata['image_width'] : 0,
"att_height" => $filedata['image_height'] ? $filedata['image_height'] : 0,
"att_ext" => $filedata['file_ext'],
"att_is_image" => ($filedata['is_image'] == 1) ? 'Y' : 'N',
"att_regtime" => date('Y-m-d H:i:s')
"reg_user" => $this->member->is_login(),
"reg_datetime" => date('Y-m-d H:i:s')
);
}
}
@ -806,9 +806,9 @@ class Board extends WB_Controller {
if(isset($this->data['upload_array']) && count($this->data['upload_array']) >0 )
{
foreach($this->data['upload_array'] as &$arr) {
$arr['post_idx'] = $post_idx;
$arr['att_target'] = $post_idx;
}
$this->db->insert_batch("board_attach", $this->data['upload_array']);
$this->db->insert_batch("attach", $this->data['upload_array']);
}
// 자신의 글은 바로 볼수 있도록
@ -885,7 +885,7 @@ class Board extends WB_Controller {
$this->board_common($brd_key, 'download');
if(! $att = $this->db->where('att_idx', $att_idx)->where('brd_key', $brd_key)->where('post_idx', $post_idx)->get('board_attach')->row_array())
if(! $att = $this->db->where('att_idx', $att_idx)->where('att_target_type', 'BOARD')->where('att_target', $post_idx)->get('attach')->row_array())
{
alert(langs( 'board/msg/invalid_attach_file' ));
exit;
@ -895,8 +895,10 @@ class Board extends WB_Controller {
$this->point_process('brd_point_download', "POST_ATTACH_DOWNLOAD", "첨부파일 다운로드", $post_idx, ($post['mem_userid'] == $this->member->info('userid')) );
$this->db->where('att_idx', $att['att_idx'])->set('att_downloads', 'att_downloads + 1', FALSE)->update('attach');
$this->load->helper('download');
$data = file_get_contents(FCPATH.$att['att_filename']);
$data = file_get_contents(FCPATH.$att['att_filepath']);
$name = urlencode($att['att_origin']);
force_download($name, $data);
}

16
wheeparam/application/controllers/admin/Board.php

@ -446,17 +446,17 @@ class Board extends WB_Controller
{
$filedata = $this->upload->data();
$this->data['upload_array'][] = array(
"brd_key" => $brd_key,
"att_target_type" => 'BOARD',
"att_origin" => $filedata['orig_name'],
"att_filename" => $dir_path . "/" . $filedata['file_name'],
"att_caption" => $filedata['orig_name'],
"att_filepath" => $dir_path . "/" . $filedata['file_name'],
"att_downloads" => 0,
"att_filesize" => $filedata['file_size'] * 1024,
"att_image_width" => $filedata['image_width'] ? $filedata['image_width'] : 0,
"att_image_height" => $filedata['image_height'] ? $filedata['image_height'] : 0,
"att_width" => $filedata['image_width'] ? $filedata['image_width'] : 0,
"att_height" => $filedata['image_height'] ? $filedata['image_height'] : 0,
"att_ext" => $filedata['file_ext'],
"att_is_image" => ($filedata['is_image'] == 1) ? 'Y' : 'N',
"att_regtime" => date('Y-m-d H:i:s')
"reg_user" => $this->member->is_login(),
"reg_datetime" => date('Y-m-d H:i:s')
);
}
}
@ -554,9 +554,9 @@ class Board extends WB_Controller
if(isset($this->data['upload_array']) && count($this->data['upload_array']) >0 )
{
foreach($this->data['upload_array'] as &$arr) {
$arr['post_idx'] = $post_idx;
$arr['att_target'] = $post_idx;
}
$this->db->insert_batch("board_attach", $this->data['upload_array']);
$this->db->insert_batch("attach", $this->data['upload_array']);
}
alert(langs('게시판/msg/write_success'), base_url("admin/board/read/{$brd_key}/{$post_idx}"));

2
wheeparam/application/helpers/common_helper.php

@ -712,7 +712,7 @@ function get_post_thumbnail($post, $thumb_width = '', $thumb_height = '')
{
if($file['att_is_image'] == 'Y')
{
return thumbnail($file['att_filename'], $thumb_width, $thumb_height);
return thumbnail($file['att_filepath'], $thumb_width, $thumb_height);
}
}
}

10
wheeparam/application/models/Board_model.php

@ -203,7 +203,7 @@ class Board_model extends WB_Model
function get_attach_list($brd_key, $post_idx)
{
if(empty($brd_key) OR empty($post_idx)) return array();
$file_list = $this->db->where('brd_key', $brd_key)->where('post_idx', $post_idx)->get('board_attach')->result_array();
$file_list = $this->db->where('att_target_type', 'BOARD')->where('att_target', $post_idx)->get('attach')->result_array();
foreach($file_list as &$f)
{
$f['link'] = base_url("board/{$brd_key}/download/{$post_idx}/{$f['att_idx']}");
@ -290,15 +290,15 @@ class Board_model extends WB_Model
{
if(empty($att_idx)) return false;
$this->db->where("att_idx", $att_idx);
$result = $this->db->get('board_attach');
$result = $this->db->get('attach');
$attach = $result->row_array();
if(! $attach) return false;
if( file_exists(FCPATH. $attach['att_filename']) )
if( file_exists(FCPATH. $attach['att_filepath']) )
{
@unlink(FCPATH.$attach['att_filename']);
@unlink(FCPATH.$attach['att_filepath']);
}
$this->db->where("att_idx", $att_idx);
$this->db->delete("board_attach");
$this->db->delete("attach");
}
/**

23
wheeparam/config/wheeparam.sql

@ -135,29 +135,6 @@ PRIMARY KEY (`brd_key`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
DROP TABLE IF EXISTS `wb_board_attach`;
CREATE TABLE `wb_board_attach` (
`att_idx` int(10) unsigned NOT NULL AUTO_INCREMENT,
`brd_key` varchar(20) NOT NULL DEFAULT '''''',
`post_idx` int(10) unsigned NOT NULL DEFAULT '0',
`att_is_image` enum('Y','N') NOT NULL DEFAULT 'N',
`att_origin` varchar(255) NOT NULL DEFAULT '''''',
`att_filename` varchar(255) NOT NULL DEFAULT '0',
`att_caption` varchar(255) NOT NULL DEFAULT '''''',
`att_downloads` int(10) unsigned NOT NULL DEFAULT '0',
`att_ext` varchar(10) NOT NULL DEFAULT '''''',
`att_regtime` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`att_ip` int(10) unsigned NOT NULL DEFAULT '0',
`att_filesize` int(10) unsigned NOT NULL DEFAULT '0',
`att_image_width` int(10) unsigned NOT NULL DEFAULT '0',
`att_image_height` int(10) unsigned NOT NULL DEFAULT '0',
PRIMARY KEY (`att_idx`),
KEY `brd_key` (`brd_key`),
KEY `post_idx` (`post_idx`),
KEY `att_is_image` (`att_is_image`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
DROP TABLE IF EXISTS `wb_board_category`;
CREATE TABLE `wb_board_category` (
`bca_idx` int(10) unsigned NOT NULL AUTO_INCREMENT,

2
wheeparam/views/skins/board/view/basic/view.php

@ -54,7 +54,7 @@
<h4>첨부파일</h4>
<ul class="nav nav-pills nav-stacked">
<?php foreach($view['file'] as $f) :?>
<li><a href="<?=$f['link']?>"><i class="fa fa-download"></i> <?=$f['att_origin']?> (<?=format_size($f['att_filesize'])?>)</a></li>
<li><a href="<?=$f['link']?>"><i class="fa fa-download"></i> <?=$f['att_origin']?> (<?=format_size($f['att_filesize'])?>) <small>다운로드수 : <?=number_format($f['att_downloads'])?></small></a></li>
<?php endforeach;?>
</ul>
</div>

2
wheeparam/views/skins/board/write/basic/write.php

@ -118,7 +118,7 @@
<div class="col-sm-9 col-md-10">
<?php foreach($view['file'] as $attach) : ?>
<div class="col-sm-3">
<?php $img_url = ($attach['att_is_image'] == 'Y') ? base_url($attach['att_filename']) : base_url('assets/images/common/attach.png'); ?>
<?php $img_url = ($attach['att_is_image'] == 'Y') ? base_url($attach['att_filepath']) : base_url('assets/images/common/attach.png'); ?>
<figure>
<img class="img-responsive" src="<?=$img_url?>" <?=($attach['att_is_image'] != 'Y')?'style="max-width:64px;margin:auto"':''?>>
<figcaption><?=$attach['att_origin']?></figcaption>

2
wheeparam/views/themes/admin/board/read.php

@ -69,7 +69,7 @@
<!-- S:첨부파일중 이미지 표시 -->
<?php foreach($view['file'] as $f) : if($f['att_is_image']!='Y') continue;?>
<figure style="margin-bottom:10px;">
<img src="<?=base_url($f['att_filename'])?>" alt="<?=$f['att_origin']?>">
<img src="<?=base_url($f['att_filepath'])?>" alt="<?=$f['att_origin']?>">
<figcaption class="sr-only"><?=$f['att_origin']?></figcaption>
</figure>
<?php endforeach;?>

2
wheeparam/views/themes/admin/board/write.php

@ -49,7 +49,7 @@
<div class="controls">
<?php foreach($view['file'] as $attach) : ?>
<div class="col-sm-3">
<?php $img_url = ($attach['att_is_image'] == 'Y') ? base_url($attach['att_filename']) : base_url('assets/images/common/attach.png'); ?>
<?php $img_url = ($attach['att_is_image'] == 'Y') ? base_url($attach['att_filepath']) : base_url('assets/images/common/attach.png'); ?>
<figure>
<img class="img-responsive" src="<?=$img_url?>" <?=($attach['att_is_image'] != 'Y')?'style="max-width:64px;margin:auto"':''?>>
<figcaption><?=$attach['att_origin']?></figcaption>

Loading…
Cancel
Save