'{$view['qa_num']}' order by qa_num asc limit 1 ";
$next = sql_fetch($sql.$next_search);
$next_href = '';
if (isset($next['qa_id']) && $next['qa_id']) {
$next_qa_subject = get_text(cut_str($next['qa_subject'], 255));
$next_href = G5_BBS_URL.'/qaview.php?qa_id='.$next['qa_id'].$qstr;
}
// 관련질문
$rows = 10;
$sql = " select *
from {$g5['qa_content_table']}
where qa_id <> '$qa_id'
and qa_related = '{$view['qa_related']}'
and qa_type = '0'
order by qa_num, qa_type
limit 0, $rows ";
$result = sql_query($sql);
$rel_list = array();
$rel_count = 0;
for($i=0; $row=sql_fetch_array($result); $i++) {
$rel_list[$i] = $row;
$rel_list[$i]['category'] = get_text($row['qa_category']);
$rel_list[$i]['subject'] = conv_subject($row['qa_subject'], $subject_len, '…');
$rel_list[$i]['name'] = get_text($row['qa_name']);
$rel_list[$i]['date'] = substr($row['qa_datetime'], 2, 8);
$rel_list[$i]['view_href'] = G5_BBS_URL.'/qaview.php?qa_id='.$row['qa_id'].$qstr;
$rel_count++;
}
$view['rel_count'] = $rel_count;
$update_href = '';
$delete_href = '';
$write_href = G5_BBS_URL.'/qawrite.php';
$rewrite_href = G5_BBS_URL.'/qawrite.php?w=r&qa_id='.$view['qa_id'];
$list_href = G5_BBS_URL.'/qalist.php'.preg_replace('/^&/', '?', $qstr);
/*
if($view['qa_type']) {
if($is_admin)
$update_href = G5_BBS_URL.'/qawrite.php?w=u&qa_id='.$view['qa_id'].$qstr;
} else {
if($view['qa_status'] == 0)
$update_href = G5_BBS_URL.'/qawrite.php?w=u&qa_id='.$view['qa_id'].$qstr;
}
*/
if(($view['qa_type'] && $is_admin) || (!$view['qa_type'] && $view['qa_status'] == 0)) {
$update_href = G5_BBS_URL.'/qawrite.php?w=u&qa_id='.$view['qa_id'].$qstr;
$delete_href = G5_BBS_URL.'/qadelete.php?qa_id='.$view['qa_id'].$qstr;
}
// 질문글이고 등록된 답변이 있다면
$answer = array();
$answer_update_href = '';
$answer_delete_href = '';
if(!$view['qa_type'] && $view['qa_status']) {
$sql = " select *
from {$g5['qa_content_table']}
where qa_type = '1'
and qa_parent = '{$view['qa_id']}' ";
$answer = sql_fetch($sql);
if($is_admin) {
$answer_update_href = G5_BBS_URL.'/qawrite.php?w=u&qa_id='.$answer['qa_id'].$qstr;
$answer_delete_href = G5_BBS_URL.'/qadelete.php?qa_id='.$answer['qa_id'].$qstr;
}
}
$stx = get_text(stripslashes($stx));
$is_dhtml_editor = false;
// 모바일에서는 DHTML 에디터 사용불가
if ($config['cf_editor'] && $qaconfig['qa_use_editor'] && !G5_IS_MOBILE) {
$is_dhtml_editor = true;
}
$editor_html = editor_html('qa_content', $content, $is_dhtml_editor);
$editor_js = '';
$editor_js .= get_editor_js('qa_content', $is_dhtml_editor);
$editor_js .= chk_editor_js('qa_content', $is_dhtml_editor);
$ss_name = 'ss_qa_view_'.$qa_id;
if(!get_session($ss_name))
set_session($ss_name, TRUE);
// 첨부파일
$view['img_file'] = array();
$view['download_href'] = array();
$view['download_source'] = array();
$view['img_count'] = 0;
$view['download_count'] = 0;
for ($i=1; $i<=2; $i++) {
if(preg_match("/\.({$config['cf_image_extension']})$/i", $view['qa_file'.$i])) {
$view['img_file'][] = '';
$view['img_count']++;
continue;
}
if ($view['qa_file'.$i]) {
$view['download_href'][] = G5_BBS_URL.'/qadownload.php?qa_id='.$view['qa_id'].'&no='.$i;
$view['download_source'][] = $view['qa_source'.$i];
$view['download_count']++;
}
}
include_once($skin_file);
} else {
echo '