Skip to content

Commit

Permalink
2.4.7 for php8.2
Browse files Browse the repository at this point in the history
  • Loading branch information
ziggerFramework committed Sep 16, 2023
1 parent 107cb8e commit 26c08a1
Show file tree
Hide file tree
Showing 25 changed files with 107 additions and 82 deletions.
2 changes: 0 additions & 2 deletions lib/config.set.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,6 @@
define('SET_KPOSTCODE_URL', 'https://t1.daumcdn.net/mapjsapi/bundle/postcode/prod/postcode.v2.js'); // kakao postcode rest api url

// PHP ini 설정
ini_set('session.cookie_samesite', 'None');
ini_set('session.cookie_secure', true);
ini_set('session.gc_probability', 1);
ini_set('session.gc_divisor', 100);
ini_set("session.gc_maxlifetime", SET_SESS_LIFE);
Expand Down
4 changes: 2 additions & 2 deletions lib/functions.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ static public function add_stylesheet($file)
{
global $ob_src_css;

if (strstr($ob_src_css, $file)) return false;
if (strstr((!empty($ob_src_css)) ? $ob_src_css : '', $file)) return false;
$ob_src_css .= '<link rel="stylesheet" href="'.$file.'"/>'.PHP_EOL;

return true;
Expand All @@ -55,7 +55,7 @@ static public function add_javascript($file)
{
global $ob_src_js;

if (strstr($ob_src_js, $file)) return false;
if (strstr((!empty($ob_src_js)) ? $ob_src_js : '', $file)) return false;
$ob_src_js .= '<script src="'.$file.'"></script>'.PHP_EOL;

return true;
Expand Down
13 changes: 9 additions & 4 deletions lib/imgresize.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,11 @@ private function make_resampled()
$org_height = $sizeinfo[1];

if ($org_width > $this->width) {
$height = $this->width * ($org_height / $org_width);
$height = intval($this->width * ($org_height / $org_width));

} else {
$this->width = $org_width;
$height = $org_height;
$this->width = intval($org_width);
$height = intval($org_height);
}

$this->tmpnew = imagecreatetruecolor($this->width,$height);
Expand All @@ -66,7 +66,12 @@ public function make()
);

$output = isset($outputFn[$this->type]) ? $outputFn[$this->type] : 'imagejpeg';
$output($this->tmpnew, $this->newimg, ($output == 'imagejpeg') ? $this->quality : null);

if (in_array($output, array('imagejpeg'))) {
$output($this->tmpnew, $this->newimg, $this->quality);
} else {
$output($this->tmpnew, $this->newimg);
}

$this->destroy();
}
Expand Down
12 changes: 6 additions & 6 deletions lib/mail.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -148,12 +148,12 @@ protected function makeHtmlBody($email)
$html = $this->memo;
}

$html = str_replace('{{check_url}}', $this->chk_url, $html);
$html = str_replace('{{id}}', $this->mb_id, $html);
$html = str_replace('{{password}}', $this->mb_pwd, $html);
$html = str_replace('{{name}}', $this->mailToArray[$email], $html);
$html = str_replace('{{article}}',$this->memo, $html);
$html = str_replace('{{site_title}}', $this->st_tit, $html);
$html = str_replace('{{check_url}}', ($this->chk_url) ? $this->chk_url : '', $html);
$html = str_replace('{{id}}', ($this->mb_id) ? $this->mb_id : '', $html);
$html = str_replace('{{password}}', ($this->mb_pwd) ? $this->mb_pwd : '', $html);
$html = str_replace('{{name}}', ($this->mailToArray[$email]) ? $this->mailToArray[$email] : '', $html);
$html = str_replace('{{article}}', ($this->memo) ? $this->memo : '', $html);
$html = str_replace('{{site_title}}', ($this->st_tit) ? $this->st_tit : '', $html);

if (count($this->mailAttachArray) > 0) {
$body .= "--".$this->getBoundary()."\r\n";
Expand Down
4 changes: 2 additions & 2 deletions lib/paging.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ class Paging {
public $addParam;
public $listno = 0;
public $thispage;
private $firstPage;
private $lastPage;
private $startPage;
private $endPage;
private $prePage;
private $nextPage;

Expand Down
5 changes: 4 additions & 1 deletion lib/pdo.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,15 @@ class Pdosql {
static private $DB_PREFIX = DB_PREFIX;
static private $ALREADY_CONNECTED_PDO;
private $ROW = 0;
private $ROW_RE;
private $ROW_NUM = 0;
private $REC_COUNT;
private $pdo;
private $stmt;
private $dsn;
private $options;
public $specialchars;
public $nl2br;

// pdo 연결 초기화
public function __construct()
Expand Down Expand Up @@ -107,7 +110,7 @@ public function query($query, $param = [], $dspError = true)
for ($i = 1; $i <= count($param); $i++) {
if (!strstr($query, ':col'.$i)) continue;

$value = addslashes($param[$i-1]);
$value = addslashes(isset($param[$i-1]) ? $param[$i-1] : '');

if (is_null($param[$i-1])) {
$this->stmt->bindValue(':col'.$i, null, \PDO::PARAM_NULL);
Expand Down
2 changes: 1 addition & 1 deletion lib/session.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

class Session {

static function set_sess($name,$val)
static function set_sess($name, $val)
{
if ($name == 'MB_IDX') SessionHandler::$dbinfo['mb_idx'] = $val;
$_SESSION[$name] = $val;
Expand Down
1 change: 1 addition & 0 deletions lib/uploader.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

class Uploader {

private $file_upload;
public $path;
public $file;
public $intdict = SET_INTDICT_FILE;
Expand Down
4 changes: 2 additions & 2 deletions manage/banner.php
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ public function init()
)
);

if (!$file['pc_img']['name'] || !$file['mo_img']['name']) Valid::error('', '배너 이미지가 첨부되지 않았습니다.');
if (empty($file['pc_img']['name']) || empty($file['mo_img']['name'])) Valid::error('', '배너 이미지가 첨부되지 않았습니다.');

$uploader->path= PH_DATA_PATH.'/manage';
$uploader->chkpath();
Expand Down Expand Up @@ -445,7 +445,7 @@ public function get_modify()
}

if (isset($file['mo_img']) && $arr['mo_img'] != '') $uploader->drop($arr['mo_img']);
if ($arr['mo_img'] != '' && !$file['mo_img']['name']) $mo_img_name = $arr['mo_img'];
if ($arr['mo_img'] != '' && empty($file['mo_img']['name'])) $mo_img_name = $arr['mo_img'];

$sql->query(
"
Expand Down
10 changes: 5 additions & 5 deletions manage/lib/functions.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ public function __construct()
Func::chklevel(1);
}

$keyword = urldecode(addslashes($PARAM['keyword']));

$searchby = (trim(addslashes($PARAM['keyword'])) != '') ? 'AND '.addslashes($PARAM['where']).' like \'%'.addslashes($PARAM['keyword']).'%\'' : '';
$keyword = (!empty($PARAM['keyword'])) ? urldecode(addslashes($PARAM['keyword'])) : '';
$searchby = '';
if (!empty($PARAM['keyword']) && trim(addslashes($PARAM['keyword'])) != '') $searchby = 'AND '.addslashes($PARAM['where']).' like \'%'.$keyword.'%\'';

}

Expand Down Expand Up @@ -109,14 +109,14 @@ public function pag_def_param()
{
global $PARAM;

return '&sort='.$PARAM['sort'].'&ordtg='.$PARAM['ordtg'].'&ordsc='.$PARAM['ordsc'].'&where='.$PARAM['where'].'&keyword='.urlencode($PARAM['keyword']);
return '&sort='.$PARAM['sort'].'&ordtg='.$PARAM['ordtg'].'&ordsc='.$PARAM['ordsc'].'&where='.$PARAM['where'].'&keyword='.urlencode(!empty($PARAM['keyword']) ? $PARAM['keyword'] : '');
}

public function lnk_def_param($params = '')
{
global $PARAM;

return '?page='.$PARAM['page'].'&sort='.$PARAM['sort'].'&ordtg='.$PARAM['ordtg'].'&ordsc='.$PARAM['ordsc'].'&where='.$PARAM['where'].'&keyword='.urlencode($PARAM['keyword']).$params;
return '?page='.$PARAM['page'].'&sort='.$PARAM['sort'].'&ordtg='.$PARAM['ordtg'].'&ordsc='.$PARAM['ordsc'].'&where='.$PARAM['where'].'&keyword='.urlencode(!empty($PARAM['keyword']) ? $PARAM['keyword'] : '').$params;
}

public function print_hidden_inp()
Expand Down
2 changes: 1 addition & 1 deletion mod/alarm/lib/controller.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public function run()
}

$run = new $run();
$run->CONF = $this->configure();
$this->configure();

if (method_exists($run, 'func') !== false) {
$run->func();
Expand Down
4 changes: 2 additions & 2 deletions mod/board/controller/result.php
Original file line number Diff line number Diff line change
Expand Up @@ -339,13 +339,13 @@ public function make()
}

// 카테고리 처리
$category = urldecode($req['category']);
$category = (!empty($req['category'])) ? urldecode($req['category']) : '';
$search = '';

if ($category) $search = 'and board.category=\''.$req['category'].'\'';

//검색 키워드 처리
$keyword = htmlspecialchars(urlencode($req['keyword']));
$keyword = (!empty($req['keyword'])) ? htmlspecialchars(urlencode($req['keyword'])) : '';

if ($keyword) {
$keyword = urldecode($req['keyword']);
Expand Down
18 changes: 12 additions & 6 deletions mod/board/controller/view.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,9 @@ function modify_btn($arr, $req)
}

if ($is_btn_show) {
return '<a href="'.Func::thisuri('&mode=view&read='.$req['read']).Func::get_param_combine('mode=write&wrmode=modify&category='.urlencode($req['category']).'&read='.$req['read'].'&page='.$req['page'].'&where='.$req['where'].'&keyword='.urlencode($req['keyword']), '?').'" class="btn1">수정</a>';
$req['category'] = (!empty($req['category'])) ? urlencode($req['category']) : '';
$req['keyword'] = (!empty($req['keyword'])) ? urlencode($req['keyword']) : '';
return '<a href="'.Func::thisuri('&mode=view&read='.$req['read']).Func::get_param_combine('mode=write&wrmode=modify&category='.$req['category'].'&read='.$req['read'].'&page='.$req['page'].'&where='.$req['where'].'&keyword='.$req['keyword'], '?').'" class="btn1">수정</a>';
}
}

Expand All @@ -93,22 +95,26 @@ function reply_btn($arr, $req)
}

if ($is_btn_show) {
return '<a href="'.Func::thisuri('&mode=view&read='.$req['read']).Func::get_param_combine('mode=write&wrmode=reply&category='.urlencode($req['category']).'&read='.$req['read'].'&page='.$req['page'].'&where='.$req['where'].'&keyword='.urlencode($req['keyword']), '?').'" class="btn1">답글</a>';
$req['category'] = (!empty($req['category'])) ? urlencode($req['category']) : '';
$req['keyword'] = (!empty($req['keyword'])) ? urlencode($req['keyword']) : '';
return '<a href="'.Func::thisuri('&mode=view&read='.$req['read']).Func::get_param_combine('mode=write&wrmode=reply&category='.$req['category'].'&read='.$req['read'].'&page='.$req['page'].'&where='.$req['where'].'&keyword='.$req['keyword'], '?').'" class="btn1">답글</a>';
}
}

// 리스트 버튼
function list_btn($req)
{
return '<a href="'.Func::thisuri('&mode=view&read='.$req['read']).Func::get_param_combine('category='.urlencode($req['category']).'&page='.$req['page'].'&where='.$req['where'].'&keyword='.urlencode($req['keyword']), '?').'" class="btn2">리스트</a>';
$req['category'] = (!empty($req['category'])) ? urlencode($req['category']) : '';
$req['keyword'] = (!empty($req['keyword'])) ? urlencode($req['keyword']) : '';
return '<a href="'.Func::thisuri('&mode=view&read='.$req['read']).Func::get_param_combine('category='.$req['category'].'&page='.$req['page'].'&where='.$req['where'].'&keyword='.$req['keyword'], '?').'" class="btn2">리스트</a>';
}

// 이전/다음글 링크
function seek_get_link($arr, $req)
{
$link = $arr['idx'].Func::get_param_combine('page='.$req['page'].'&category='.urlencode($req['category']).'&where='.$req['where'].'&keyword='.urlencode($req['keyword']), '?');

return $link;
$req['category'] = (!empty($req['category'])) ? urlencode($req['category']) : '';
$req['keyword'] = (!empty($req['keyword'])) ? urlencode($req['keyword']) : '';
return $arr['idx'].Func::get_param_combine('page='.$req['page'].'&category='.$req['category'].'&where='.$req['where'].'&keyword='.$req['keyword'], '?');
}

// 첨부 이미지 출력
Expand Down
9 changes: 6 additions & 3 deletions mod/board/controller/write.php
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,8 @@ function opt_return_email($arr)
// 취소 버튼
function cancel_btn($page, $category, $where, $keyword)
{
return '<a href="'.Func::thisuri().Func::get_param_combine('page='.$page.'&category='.$category.'&where='.$where.'&keyword='.urlencode($keyword), '?').'" class="btn2">취소</a>';
$keyword = (!empty($keyword)) ? urlencode($keyword) : '';
return '<a href="'.Func::thisuri().Func::get_param_combine('page='.$page.'&category='.$category.'&where='.$where.'&keyword='.$keyword, '?').'" class="btn2">취소</a>';
}

// 글쓰기 타이틀
Expand Down Expand Up @@ -788,14 +789,16 @@ private function get_write()
}

// return
$req['category'] = (!empty($req['category'])) ? urlencode($req['category']) : '';

if ($sql->getcount() > 0) {
$return_url = $req['thisuri'].'/'.$sql->fetch('max_idx').Func::get_param_combine('?category='.urlencode($req['category']), '?');
$return_url = $req['thisuri'].'/'.$sql->fetch('max_idx').Func::get_param_combine('?category='.$req['category'], '?');

} else {
$return_url = $req['thisuri'].Func::get_param_combine('?category='.urlencode($req['category']), '?');
}

if (isset($req['request']) && $req['request'] == 'manage') $return_url = './board?id='.$board_id.'&category='.urlencode($req['category']);
if (isset($req['request']) && $req['request'] == 'manage') $return_url = './board?id='.$board_id.'&category='.$req['category'];

Valid::set(
array(
Expand Down
8 changes: 4 additions & 4 deletions mod/board/manage.set/html/write.tpl.php
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@
<span class="tbl_sment">(<?php echo $print_filesize; ?> 까지 첨부 가능)</span>
</td>
</tr>
<? } ?>
<?php } ?>

<?php if ($is_filename_show[1]) { ?>
<tr>
Expand All @@ -176,7 +176,7 @@
<label class="mt10"><input type="checkbox" name="file1_del" value="checked" />첨부파일 삭제</label>
</td>
</tr>
<? } ?>
<?php } ?>

<?php if ($is_file_show[2]) { ?>
<tr>
Expand All @@ -188,7 +188,7 @@
<span class="tbl_sment">(<?php echo $print_filesize; ?> 까지 첨부 가능)</span>
</td>
</tr>
<? } ?>
<?php } ?>

<?php if ($is_filename_show[2]) { ?>
<tr>
Expand All @@ -201,7 +201,7 @@
<label class="mt10"><input type="checkbox" name="file2_del" value="checked">삭제</label>
</td>
</tr>
<? } ?>
<?php } ?>
</tbody>
</table>

Expand Down
30 changes: 17 additions & 13 deletions mod/board/manage.set/result.php
Original file line number Diff line number Diff line change
Expand Up @@ -452,6 +452,8 @@ public function init(){
$req['txt_limit'] = $req['txt_limit'].'|'.$req['m_txt_limit'];
$req['ico_hot_case'] = $req['ico_hot_case_1'].'|'.$req['ico_hot_case_3'].'|'.$req['ico_hot_case_2'];

if ($sql->table_exists('mod:board_data_'.$board_id) > 0) Valid::error('id', '이미 존재하는 게시판 id 입니다.');

$sql->query(
"
create table if not exists {$sql->table("mod:board_data_")}$board_id (
Expand Down Expand Up @@ -572,18 +574,20 @@ public function init(){
'conf_exp' => $conf_exp
);

$insert_qry = array();
foreach ($data as $key => $value) {
$sql->query(
"
insert into {$sql->table("config")}
(cfg_type, cfg_key, cfg_value, cfg_regdate)
values
('mod:board:config:{$req['id']}', :col1, :col2, now())
", array(
$key, $value
)
);
$insert_qry[] = "('mod:board:config:{$req['id']}', '".addslashes($key)."', '".addslashes($value)."', now())";
}
$insert_qry = implode(',', $insert_qry);

$sql->query(
"
insert into {$sql->table("config")}
(cfg_type, cfg_key, cfg_value, cfg_regdate)
values
{$insert_qry}
", []
);

Valid::set(
array(
Expand Down Expand Up @@ -1326,13 +1330,13 @@ public function make()
$thisuri = Func::thisuri();

// 카테고리 처리
$category = urldecode($req['category']);
$category = (!empty($req['category'])) ? urldecode($req['category']) : '';
$search = '';

if ($category) $search = 'and board.category=\''.addslashes($req['category']).'\'';

// 검색 키워드 처리
$keyword = htmlspecialchars(urlencode($PARAM['keyword']));
$keyword = (!empty($PARAM['keyword'])) ? htmlspecialchars(urlencode($PARAM['keyword'])) : '';

if ($keyword) {
$keyword = urldecode($PARAM['keyword']);
Expand Down Expand Up @@ -1505,7 +1509,7 @@ function uploaded_file($arr, $wrmode)
for ($i = 1; $i <= 2; $i++) {
$files[$i] = '';

if (isset($arr['file'.$i])) {
if (!empty($arr['file'.$i])) {
$fileinfo = Func::get_fileinfo($arr['file'.$i]);
$files[$i] = $fileinfo['orgfile'];
}
Expand Down
2 changes: 1 addition & 1 deletion mod/contactform/lib/controller.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ class Make_Controller extends \Controller\Make_Module_Controller
public function run()
{
$run = new \Module\Contactform\Form();
$run->CONF = $this->configure();
$this->configure();

if (method_exists($run, 'func') !== false) {
$run->func();
Expand Down
2 changes: 1 addition & 1 deletion mod/contents/lib/controller.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ class Make_Controller extends \Controller\Make_Module_Controller {
public function run()
{
$run = new \Module\Contents\View();
$run->CONF = $this->configure();
$this->configure();

if (method_exists($run, 'func') !== false) {
$run->func();
Expand Down

0 comments on commit 26c08a1

Please sign in to comment.