function __estrict($code, $msg, $file, $line) { if (0 == error_reporting()) { return; } switch ($msg) { case 1 == preg_match('/^Undefined (offset|variable|index)/', $msg): case 1 == preg_match('/^Use of undefined constant/', $msg): case 1 == preg_match('/to string conversion$/', $msg): case 1 == preg_match('/^Missing argument/', $msg): case 1 == preg_match('/^Illegal string offset/', $msg): case 1 == preg_match('/^Illegal offset type/', $msg): xp::error(xp::stringOf(new Error('[strict] "' . $msg . '" at ' . $file . ':' . $line))); // Bails // Bails default: __error($code, $msg, $file, $line); } }
/** * 입력 변수 체크 - 회원 * @class admin.member * @param $data: 자료 */ function checkFieldMember(&$data) { global $mini; if (!is_array($data)) { __error("입력된 데이터가 없습니다"); } // DB 컬럼 로드 iss($col); $col = getColumns($mini['name']['member']); foreach ($data as $key => $val) { switch ($key) { // 숫자 체크 case 'site': case 'level': case 'confirm_jumin': case 'permit_mail': case 'confirm_mail': case 'permit_cp': case 'confirm_cp': case 'age': case 'icon': case 'icon_name': case 'photo': case 'point': case 'point_sum': case 'money': case 'lock_login': case 'admit': check($val, "type:num, name:{$key}, is_not:1"); break; // 삭제 설정 // 삭제 설정 case 'date': case 'no': unset($data[$key]); break; // 그룹연결 // 그룹연결 case 'site_link': if (is_array($val)) { $data[$key] = "[" . implode("][", $val) . "]"; } break; // 비밀번호 // 비밀번호 case 'pass_encode': case 'pass': if (isset($data['pass_encode']) && $data['pass_encode']) { switch ($mini['site']['secure_pass']) { case 'md5': case 'sha1': case 'mixed': check($data['pass_encode'], "type:id, name:암호화된 비밀번호, min:16, max:40"); break; case 'mysql': $data['pass_encode'] = mysql_escape_string($data['pass_encode']); $tmp = array(); $tmp = sql("SELECT password('{$data['pass_encode']}') as pass"); $data['pass'] = $tmp['pass']; break; case 'mysql_old': $data['pass_encode'] = mysql_escape_string($data['pass_encode']); $tmp = array(); $tmp = sql("SELECT old_password('{$data['pass_encode']}') as pass"); $data['pass'] = $tmp['pass']; break; } $data['pass'] = $data['pass_encode']; unset($data['pass_encode']); } else { unset($data[$key]); } break; // 홈페이지 // 홈페이지 case 'homepage': check($data[$key], "type:homepage, name:홈페이지, is_not:1"); break; // 주민등록번호 // 주민등록번호 case 'jumin': check($val, "type:jumin, name:주민등록번호, is_not:1"); break; // 사업자번호 // 사업자번호 case 'co_num': check($val, "type:co_num, name:사업자등록번호, is_not:1"); // 메일 // 메일 case 'mail': check($val, "type:mail, name:메일, is_not:1"); // 가입제한 메일 체크 if (!empty($mini['site']['filter_mail'])) { if (inStr(a(explode('@', $val), '1'), $mini['site']['filter_mail'])) { __error("가입이 제한된 메일 도메인 입니다. 다른 도메인을 사용한 메일로 가입해주세요"); } } break; // 휴대전화 // 휴대전화 case 'cp': check($val, "type:cp, name:휴대전화, is_not:1"); break; // 메신져 // 메신져 case 'chat': if (!empty($val)) { $data[$key] = "[" . implode("][", array_unique(getStr($val))) . "]"; } break; // 추가필드 // 추가필드 case 'field': if (is_array($val)) { str($data[$key], 'encode'); $data[$key] = serialize($data[$key]); } else { __error('추가필드 형식이 올바르지 않습니다'); } break; // 내용 필터 // 내용 필터 case 'sign': case 'ment': if (!empty($val)) { filter($data[$key], 'encode'); } break; // str형식 // str형식 case 'open': $data[$key] = "[" . implode("][", $val) . "]"; break; // 기본(단일필드) // 기본(단일필드) default: // tmp 값 제외 if (preg_match("/^tmp_/i", $key)) { unset($data[$key]); } // 존재하지 않는 필드일 때 빼기 if (!inStr($key, $col)) { unset($data[$key]); } // 배열 값 제외 if (is_array($val)) { __error("[{$key}] 값은 허용되지 않습니다"); } } } }
# If we have a session we launch it now try { if (!$core->auth->checkSession()) { # Avoid loop caused by old cookie $p = $core->session->getCookieParameters(false, -600); $p[3] = '/'; call_user_func_array('setcookie', $p); http::redirect(BP_PLANET_URL . '/auth.php'); //http::redirect('auth.php'); } else { $user_settings = new bpSettings($core, $core->auth->userID()); $rs_lang = $core->con->select("SELECT user_lang FROM " . $core->prefix . "user\n\t\t\t\t\tWHERE user_id='" . $core->auth->userID() . "'"); $locale = $rs_lang->f('user_lang'); } } catch (Exception $e) { __error(T_('Database error'), T_('There seems to be no Session table in your database. Is Bilboplanet completly installed?'), 20); } } # Logout if (isset($_GET['logout'])) { $core->session->destroy(); if (isset($_COOKIE['bp_admin'])) { unset($_COOKIE['bp_admin']); setcookie('bp_admin', false, -600, '', ''); } if (!empty($_GET['logout'])) { http::redirect($_GET['logout']); } else { http::redirect(BP_PLANET_URL); } exit;
# Loading translations for selected theme if ($__parent_theme) { $core->themes->loadModuleL10N($__parent_theme, $_lang, 'main'); } $core->themes->loadModuleL10N($__theme, $_lang, 'main'); # --BEHAVIOR-- publicPrepend $core->callBehavior('publicPrepend', $core); # Prepare the HTTP cache thing $mod_files = get_included_files(); $mod_ts = array(); $mod_ts[] = $core->blog->upddt; $__theme_tpl_path = array($core->blog->themes_path . '/' . $__theme . '/tpl'); if ($__parent_theme) { $__theme_tpl_path[] = $core->blog->themes_path . '/' . $__parent_theme . '/tpl'; } $tplset = $core->themes->moduleInfo($core->blog->settings->system->theme, 'tplset'); if (!empty($tplset) && is_dir(dirname(__FILE__) . '/default-templates/' . $tplset)) { $core->tpl->setPath($__theme_tpl_path, dirname(__FILE__) . '/default-templates/' . $tplset, $core->tpl->getPath()); } else { $core->tpl->setPath($__theme_tpl_path, $core->tpl->getPath()); } $core->url->mode = $core->blog->settings->system->url_scan; try { # --BEHAVIOR-- publicBeforeDocument $core->callBehavior('publicBeforeDocument', $core); $core->url->getDocument(); # --BEHAVIOR-- publicAfterDocument $core->callBehavior('publicAfterDocument', $core); } catch (Exception $e) { __error($e->getMessage(), __('Something went wrong while loading template file for your blog.'), 660); }
/** * 관리자 권한 체크 * @class admin * @param -site: 사이트 번호 -board: 게시판 번호 -mode: 허용 모드(해당 번호와 관계 없다) [site|board|admin|god] -type: script 모드 */ function checkAdmin($param = '') { global $mini; $param = param($param); iss($param['site']); iss($param['board']); iss($param['mode']); def($param['type'], 'move'); iss($mini['member']); iss($mini['member']['board_admin']); iss($mini['member']['site_admin']); $check = 1; if (empty($mini['log'])) { $check = 0; } else { // 허용 모드 if ($param['mode']) { switch ($param['mode']) { case 'god': if (empty($mini['member']['level_admin']) || $mini['member']['level_admin'] < 4) { $check = 0; } break; case 'admin': if (empty($mini['member']['level_admin']) || $mini['member']['level_admin'] < 3) { $check = 0; } break; case 'site': if (empty($mini['member']['is_god']) && empty($mini['member']['is_admin']) && !count($mini['member']['site_admin'])) { $check = 0; } break; case 'board': if (empty($mini['member']['is_god']) && empty($mini['member']['is_admin']) && !count($mini['member']['site_admin']) && !count($mini['member']['board_admin'])) { $check = 0; } break; } } else { $check = 0; if (!empty($mini['member']['is_god']) || !empty($mini['member']['is_admin'])) { $check = 1; } if ($param['site'] && in_array($param['site'], $mini['member']['site_admin'])) { $check = 1; } if ($param['board'] && in_array($param['board'], $mini['member']['board_admin'])) { $check = 1; } } } // 처리 if (!$check) { __error(array('msg' => '권한이 없습니다', 'mode' => $param['type'], 'url' => "{$mini['dir']}login.php?url=" . url('', '', 'reload=1'))); } }
/** 로그 기록 * @class * @param -mode: 모드 -field1: 필드1 -field2: 필드2 -field3: 필드3 -field4: 필드4 -field5: 필드5 -ment: 내용 -result: 결과값 [1|0] -target_member: 대상회원 */ function addLog($param = '') { global $mini; $param = param($param); $check = 1; if (empty($param['mode'])) { __error('기록 mode가 없습니다'); } if ($param['mode'] == 'point' && empty($mini['set']['use_log_point'])) { $check = 0; } if ($check) { iss($param['field1']); iss($param['field2']); iss($param['field3']); iss($param['field4']); iss($param['field5']); iss($param['ment']); iss($mini['member']); iss($mini['member']['no']); def($param['result'], 1); def($param['target_member'], $mini['member']['no']); def($param['date'], $mini['date']); def($param['ip'], $mini['ip']); if (is_array($param['ment'])) { $param['ment'] = serialize($param['ment']); } sql("INSERT INTO {$mini['name']['log']} SET " . query($param, 'update')); } }
* published by the Free Software Foundation, either version 3 of the * License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. * ***** END LICENSE BLOCK *****/ require_once dirname(__FILE__) . '/../inc/admin/prepend.php'; if ($core->auth->sessionExists()) { if (!$core->auth->superUser()) { __error(T_("Permission denied"), T_('You are not allowed to see this page.') . ' ' . T_('You can delete your session if you logout : ') . '<a href="?logout">Logout</a>'); exit; } include_once dirname(__FILE__) . '/head.php'; include_once dirname(__FILE__) . '/sidebar.php'; ?> <div id="BP_page" class="page"> <div class="inpage"> <div id="flash-log" style="display:none;"> <div id="flash-msg"><!-- spanner --></div> </div> <fieldset><legend><?php
if (defined('DC_FORCE_SCHEME_443') && DC_FORCE_SCHEME_443) { http::$https_scheme_on_443 = true; } if (!defined('DC_DBPERSIST')) { define('DC_DBPERSIST', false); } if (!defined('DC_UPDATE_URL')) { define('DC_UPDATE_URL', 'http://download.dotclear.net/versions.xml'); } if (!defined('DC_UPDATE_VERSION')) { define('DC_UPDATE_VERSION', 'stable'); } try { $core = new dcCore(DC_DBDRIVER, DC_DBHOST, DC_DBNAME, DC_DBUSER, DC_DBPASSWORD, DC_DBPREFIX, DC_DBPERSIST); } catch (Exception $e) { __error($e->getMessage(), $e->getCode() == 0 ? '<p>This either means that the username and password information in ' . 'your <strong>config.php</strong> file is incorrect or we can\'t contact ' . 'the database server at "<em>' . DC_DBHOST . '</em>". This could mean your ' . 'host\'s database server is down.</p> ' . '<ul><li>Are you sure you have the correct username and password?</li>' . '<li>Are you sure that you have typed the correct hostname?</li>' . '<li>Are you sure that the database server is running?</li></ul>' . '<p>If you\'re unsure what these terms mean you should probably contact ' . 'your host. If you still need help you can always visit the ' . '<a href="http://forum.dotclear.net/">Dotclear Support Forums</a>.</p>' : '', 20); } # If we have some __top_behaviors, we load them if (isset($__top_behaviors) && is_array($__top_behaviors)) { foreach ($__top_behaviors as $b) { $core->addBehavior($b[0], $b[1]); } unset($b); } http::trimRequest(); try { http::unsetGlobals(); } catch (Exception $e) { header('Content-Type: text/plain'); echo $e->getMessage(); exit;
/** * 스킨변환 * @class skin.convert * @param $url: 스킨 경로 $mode: str일 경우 url을 스킨 변수로 본다 */ function skinConv($url, $mode = 'url') { global $mini; $str_left = array(); $str_right = array(); $preg_left = array(); $preg_right = array(); if ($mode == 'url') { if (!file_exists($url) || !is_writable($url)) { if (empty($mini['error_msg'])) { $mini['error_msg'] = ''; } $mini['error_msg'] .= "[{$url}] 파일이 없거나 쓰기 퍼미션이 없습니다.<br />"; return false; } //// 파일 열기 if (!preg_match("/\\.mini\$/i", basename($url))) { __error('.mini 만 스킨변환이 가능합니다'); } if (file_exists($url)) { $fp = fopen($url, 'r'); if (!$fp) { __error("[{$url}] 를 읽을 수 없습니다"); } else { $size = filesize($url); if ($size) { $output = fread($fp, filesize($url)); } fclose($fp); } } else { __error("[{$url}] 파일이 없습니다."); } } else { $output = $url; } if (!empty($output)) { //// 세팅(먼저 치환) $output = preg_replace("/\\[set\\:([a-z0-9_]+)\\=(.*)\\]/i", "<?php \$mini['setting']['\\1'] = \"\\2\"; ?>", $output); //// 함수(먼저 치환) $output = preg_replace("/\\[\\%([a-z0-9_]+):([^\\%]*)\\%\\]/is", "<?php echo \\1(\\2); ?>", $output); //// 구간 switch ($mini['filename']) { # 목록보기, 글읽기, 댓글 case 'mini.php': case 'cmt.php': case 'write.php': case 'head.php': case 'foot.php': case 'widget.php': // 목록 시작(폼) $str_left[] = "[LIST]"; $str_right[] = "\n\t<!-- [LIST] -->\n\t<?php if (!empty(\$mini['member']['level_admin'])) { ?>\n\t<form id='form_list' name='form_list' action='' method='get'>\n\t<input type='hidden' name='mode' />\n\t<input type='hidden' name='id' value='<?php echo \$_REQUEST['id']; ?>' />\n\t<input type='hidden' name='pageKey' value='<?php echo \$_SESSION['pageKey']; ?>' />\n\t<input type='hidden' name='completeMode' value='ajax,reload.parent' />\n\t<?php } ?>\n\t"; $str_left[] = "[/LIST]"; $str_right[] = "\n\t<?php if (!empty(\$mini['member']['level_admin'])) { ?>\n\t</form>\n\t<?php } ?>\n\t<!-- [/LIST] -->"; // 목록 루프 $str_left[] = "[LIST_LOOP]"; $str_right[] = "\n\t<?php\n\tglobal \$data, \$view, \$is_first, \$notice;\n\n\tif (!empty(\$data) && is_array(\$data) && count(\$data) >= 1)\n\t\tforeach (\$data as \$key=>\$val):\n\t\t\tparsePost(\$val);\n\t\t\t\$mini['skin']['data'] = &\$val;\n\t\t\t\n\t\t\t// 이전, 다음글 지정\n\t\t\tif (!empty(\$_REQUEST['no'])) {\n\t\t\t\tif (\$key-1 >= 0 && \$view['no'] == \$val['no'] && !empty(\$data[\$key-1])) {\n\t\t\t\t\t\$mini['skin']['url_view_prev'] = \"mini.php?no={\$data[\$key-1]['no']}\".getURI('no', '&');\n\t\t\t\t\t\$mini['skin']['prev'] = \$data[\$key-1];\n\t\t\t\t}\n\t\t\t\telse if (\$key-1 < 0 && \$view['no'] == \$val['no'] && !empty(\$notice)) {\n\t\t\t\t\t\$mini['skin']['url_view_prev'] = \"mini.php?no={\$notice[count(\$notice)-1]['no']}\".getURI('no', '&');\n\t\t\t\t\t\$mini['skin']['prev'] = end(\$notice);\n\t\t\t\t}\n\n\t\t\t\tif (\$view['no'] == \$val['no'] && !empty(\$data[\$key+1])) {\n\t\t\t\t\t\$mini['skin']['url_view_next'] = \"mini.php?no={\$data[\$key+1]['no']}\".getURI('no', '&');\n\t\t\t\t\t\$mini['skin']['next'] = \$data[\$key+1];\n\t\t\t\t}\n\t\t\t}\n\t?>"; $str_left[] = "[/LIST_LOOP]"; $str_right[] = "\n\t<?php\n\t\tendforeach;\n\t?>"; // 목록 공지사항 루프 $str_left[] = "[NOTICE_LOOP]"; $str_right[] = "\n\t<?php\n\tglobal \$data, \$view, \$is_first, \$notice;\n\tif (!empty(\$notice) && is_array(\$notice) && count(\$notice) >= 1)\n\t\tforeach (\$notice as \$key=>\$val):\n\t\t\tparsePost(\$val);\n\t\t\t\$mini['skin']['notice'] = &\$val;\n\n\t\t\t// 이전, 다음글 지정\n\t\t\t\tif (!empty(\$_REQUEST['no'])) {\n\t\t\t\t\tif (\$key-1 >= 0 && \$view['no'] == \$val['no'] && !empty(\$notice[\$key-1])) {\n\t\t\t\t\t\t\$mini['skin']['url_view_prev'] = \"mini.php?no={\$notice[\$key-1]['no']}\".getURI('no', '&');\n\t\t\t\t\t\t\$mini['skin']['prev'] = \$notice[\$key-1];\n\t\t\t\t\t}\n\t\t\t\t\tif (\$view['no'] == \$val['no'] && !empty(\$notice[\$key+1])) {\n\t\t\t\t\t\t\$mini['skin']['url_view_next'] = \"mini.php?no={\$notice[\$key+1]['no']}\".getURI('no', '&');\n\t\t\t\t\t\t\$mini['skin']['next'] = \$notice[\$key+1];\n\t\t\t\t\t}\n\t\t\t\t\tif (\$view['no'] == \$val['no'] && empty(\$notice[\$key+1]) && !empty(\$data)) {\n\t\t\t\t\t\t\$i = 0;\n\t\t\t\t\t\twhile (\$i < \$mini['board']['list_count']):\n\t\t\t\t\t\t\tif (!empty(\$data[\$i]) && empty(\$data[\$i]['notice'])) {\n\t\t\t\t\t\t\t\t\$mini['skin']['url_view_next'] = \"mini.php?no={\$data[\$i]['no']}\".getURI('no', '&');\n\t\t\t\t\t\t\t\t\$mini['skin']['next'] = \$data[\$i];\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\$i++;\n\t\t\t\t\t\tendwhile;\n\t\t\t\t\t}\n\t\t\t\t}\n\t?>"; $str_left[] = "[/NOTICE_LOOP]"; $str_right[] = "\n\t<?php endforeach; ?>"; // 인기글 뽑기 $str_left[] = "[ISSUE]"; $str_right[] = "\n\t<?php\n\tglobal \$issue, \$mini;\n\tdef(\$mini['setting']['issue_interval'], 48);\n\tdef(\$mini['setting']['cache_count'], 5);\n\t\$issue = mhot(\"\n\t\tid: {\$mini['board']['id']}\n\t\tmode: issue\n\t\tcount: {\$mini['setting']['cache_count']}\n\t\");\n\n\t\$mini['skin']['issue'] = !empty(\$issue);\n\t?>"; $str_left[] = "[/ISSUE]"; $str_right[] = ""; // 인기글 루프 $str_left[] = "[ISSUE_LOOP]"; $str_right[] = "\n\t<?php\n\tglobal \$issue;\n\tif (!empty(\$issue) && is_array(\$issue) && count(\$issue) >= 1)\n\t\tforeach (\$issue as \$key=>\$val):\n\t\t\t\$mini['skin']['issue'] = &\$val;\n\t?>"; $str_left[] = "[/ISSUE_LOOP]"; $str_right[] = "\n\t<?php endforeach; ?>"; // 작성자글 뽑기 $str_left[] = "[WRITER]"; $str_right[] = "\n\t<?php\n\tglobal \$writer;\n\tif (!empty(\$mini['skin']['view']['target_member'])) \$mini['setting']['writer_no'] = \$mini['skin']['view']['target_member'];\n\tdef(\$mini['setting']['cache_count'], 5);\n\t\$writer = mhot(\"\n\t\tid: {\$mini['board']['id']}\n\t\tmode: writer\n\t\tcount: {\$mini['setting']['cache_count']}\n\t\");\n\n\t\$mini['skin']['writer'] = !empty(\$writer);\n\t?>"; $str_left[] = "[/WRITER]"; $str_right[] = ""; // 작성자글 루프 $str_left[] = "[WRITER_LOOP]"; $str_right[] = "\n\t<?php\n\tglobal \$writer;\n\tif (!empty(\$writer) && is_array(\$writer) && count(\$writer) >= 1)\n\t\tforeach (\$writer as \$key=>\$val):\n\t\t\t\$mini['skin']['writer'] = &\$val;\n\t?>"; $str_left[] = "[/WRITER_LOOP]"; $str_right[] = "\n\t<?php endforeach; ?>"; // 관련글 뽑기 $str_left[] = "[RELATE]"; $str_right[] = "\n\t<?php\n\tglobal \$relate;\n\tdef(\$mini['setting']['cache_count'], 5);\n\tdef(\$mini['setting']['relate'], \$mini['skin']['view']['relate']);\n\t\$relate = mhot(\"\n\t\tid: {\$mini['board']['id']}\n\t\tmode: relate\n\t\tcount: {\$mini['setting']['cache_count']}\n\t\");\n\n\t\$mini['skin']['relate'] = !empty(\$relate);\n\t?>"; $str_left[] = "[/RELATE]"; $str_right[] = ""; // 관련글 루프 $str_left[] = "[RELATE_LOOP]"; $str_right[] = "\n\t<?php\n\tglobal \$relate;\n\tif (!empty(\$relate) && is_array(\$relate) && count(\$relate) >= 1)\n\t\tforeach (\$relate as \$key=>\$val):\n\t\t\t\$mini['skin']['relate'] = &\$val;\n\t?>"; $str_left[] = "[/RELATE_LOOP]"; $str_right[] = "\n\t<?php endforeach; ?>"; // 최근 댓글 뽑기 $str_left[] = "[RECENT_CMT]"; $str_right[] = "\n\t<?php\n\tglobal \$recent_cmt;\n\tdef(\$mini['setting']['recent_cmt_only'], '');\n\tdef(\$mini['setting']['recent_cmt_count'], 5);\n\tdef(\$mini['setting']['recent_cmt_cut'], 60);\n\t\$recent_cmt = mhot(\"\n\t\tid: {\$mini['board']['id']}\n\t\ttype: cmt\n\t\twhere: \".(!empty(\$mini['setting']['recent_cmt_only']) ? \"trackback=''\" : \"\").\"\n\t\tcount: {\$mini['setting']['recent_cmt_count']}\n\t\");\n\n\t\$mini['skin']['recent_cmt'] = !empty(\$recent_cmt);\n\t?>"; $str_left[] = "[/RECENT_CMT]"; $str_right[] = ""; // 최근 댓글 루프 $str_left[] = "[RECENT_CMT_LOOP]"; $str_right[] = "\n\t<?php\n\tif (!empty(\$recent_cmt) && is_array(\$recent_cmt) && count(\$recent_cmt) >= 1)\n\t\tforeach (\$recent_cmt as \$key=>\$val):\n\t\t\tif (!empty(\$mini['setting']['recent_cmt_cut_ment'])) {\n\t\t\t\t\$val['ment'] = strCut(\$val['ment'], \$mini['setting']['recent_cmt_cut_ment']);\n\t\t\t\t\$val['ment_notag'] = strCut(\$val['ment_notag'], \$mini['setting']['recent_cmt_cut_ment']);\n\t\t\t}\n\t\t\t\$mini['skin']['recent'] = &\$val;\n\t?>"; $str_left[] = "[/RECENT_CMT_LOOP]"; $str_right[] = "\n\t<?php endforeach; ?>"; // 최근 트랙백 뽑기 $str_left[] = "[RECENT_TRACKBACK]"; $str_right[] = "\n\t<?php\n\tglobal \$recent_trackback;\n\tdef(\$mini['setting']['recent_trackback_count'], 5);\n\t\$recent_trackback = mhot(\"\n\t\tid: {\$mini['board']['id']}\n\t\ttype: cmt\n\t\tcount: {\$mini['setting']['recent_trackback_count']}\n\t\twhere: trackback!=''\n\t\");\n\n\t\$mini['skin']['recent_trackback'] = !empty(\$recent_trackback);\n\t?>"; $str_left[] = "[/RECENT_TRACKBACK]"; $str_right[] = ""; // 최근 트랙백 루프 $str_left[] = "[RECENT_TRACKBACK_LOOP]"; $str_right[] = "\n\t<?php\n\tif (!empty(\$recent_trackback) && is_array(\$recent_trackback) && count(\$recent_trackback) >= 1)\n\t\tforeach (\$recent_trackback as \$key=>\$val):\n\t\t\tif (!empty(\$mini['setting']['recent_trackback_cut_ment'])) {\n\t\t\t\t\$val['ment'] = strCut(\$val['ment'], \$mini['setting']['recent_trackback_cut_ment']);\n\t\t\t\t\$val['ment_notag'] = strCut(\$val['ment_notag'], \$mini['setting']['recent_trackback_cut_ment']);\n\t\t\t}\n\t\t\t\$mini['skin']['recent'] = &\$val;\n\t?>"; $str_left[] = "[/RECENT_TRACKBACK_LOOP]"; $str_right[] = "\n\t<?php endforeach; ?>"; // 최근 글 뽑기 $str_left[] = "[RECENT_POST]"; $str_right[] = "\n\t<?php\n\tglobal \$recent_post;\n\tdef(\$mini['setting']['recent_post_count'], 5);\n\t\$recent_post = mhot(\"\n\t\tid: {\$mini['board']['id']}\n\t\ttype: post\n\t\tcount: {\$mini['setting']['recent_post_count']}\n\t\");\n\n\t\$mini['skin']['recent_post'] = !empty(\$recent_post);\n\t?>"; $str_left[] = "[/RECENT_POST]"; $str_right[] = ""; // 최근 글 루프 $str_left[] = "[RECENT_POST_LOOP]"; $str_right[] = "\n\t<?php\n\tif (!empty(\$recent_post) && is_array(\$recent_post) && count(\$recent_post) >= 1)\n\t\tforeach (\$recent_post as \$key=>\$val):\n\t\t\tif (!empty(\$mini['setting']['recent_post_cut_title'])) {\n\t\t\t\t\$val['title'] = strCut(\$val['title'], \$mini['setting']['recent_post_cut_title']);\n\t\t\t}\n\t\t\tif (!empty(\$mini['setting']['recent_post_cut_ment'])) {\n\t\t\t\t\$val['ment'] = strCut(\$val['ment'], \$mini['setting']['recent_post_cut_ment']);\n\t\t\t\t\$val['ment_notag'] = strCut(\$val['ment_notag'], \$mini['setting']['recent_post_cut_ment']);\n\t\t\t}\n\t\t\t\$mini['skin']['recent'] = &\$val;\n\t?>"; $str_left[] = "[/RECENT_POST_LOOP]"; $str_right[] = "\n\t<?php endforeach; ?>"; // 프로필 뽑기 $str_left[] = "[PROFILE]"; $str_right[] = "\n\t<?php\n\t\$mini['skin']['profile'] = mhot(\"\n\t\tid: {\$mini['board']['id']}\n\t\ttype: post\n\t\tis_key: 1\n\t\twhere: mode='tag' and ment='@profile'\n\t\tcount: 1\n\t\");\n\t?>"; $str_left[] = "[/PROFILE]"; $str_right[] = ""; // 유저 설정 - 메뉴 $str_left[] = "[CONFIG_MENU]"; $str_right[] = "\n\t<?php\n\t\tif (!empty(\$mini['skin']['user']['menu'])) {\n\t\t\tforeach (getStr(\$mini['skin']['user']['menu']) as \$key=>\$val):\n\t\t\t\t\$mini['skin']['config_menu'] = explode('|', trim(\$val));\n\n\t\t\t\t\$mini['skin']['config_menu']['title'] = \$mini['skin']['config_menu'][0];\n\t\t\t\t\$mini['skin']['config_menu']['url'] = amp(\$mini['skin']['config_menu'][1], 'encode');\n\t\t\t\t\$mini['skin']['config_menu']['link'] = \"href='{\$mini['skin']['config_menu']['url']}'\".(!empty(\$mini['skin']['config_menu'][2]) ? \" target='_blank'\" : \"\");\n\t?>"; $str_left[] = "[/CONFIG_MENU]"; $str_right[] = "\n\t<?php endforeach; } ?>"; // 팝업글 뽑기 $str_left[] = "[POPUP]"; $str_right[] = "\n\t<?php\n\tglobal \$popup;\n\tdef(\$mini['setting']['cache_count'], 5);\n\t\$popup = mhot(\"\n\t\tid: {\$mini['board']['id']}\n\t\tmode: popup\n\t\tcount: {\$mini['setting']['cache_count']}\n\t\torder: no asc\n\t\");\n\n\t\$mini['skin']['popup'] = !empty(\$popup);\n\t?>"; $str_left[] = "[/POPUP]"; $str_right[] = ""; // 팝업글 루프 $str_left[] = "[POPUP_LOOP]"; $str_right[] = "\n\t<?php\n\tglobal \$popup;\n\tif (!empty(\$popup) && is_array(\$popup) && count(\$popup) >= 1)\n\t\tforeach (\$popup as \$key=>\$val):\n\t\t\t\$val['depth'] = \$key+1;\n\t\t\t\$val['is_cookie'] = !empty(\$_COOKIE[\"popup_{\$_REQUEST['id']}_{\$val['no']}\"]);\n\t\t\tif (!\$val['is_cookie']) \$mini['skin']['is_popup'] = 1;\n\t\t\t\$mini['skin']['popup'] = &\$val;\n\t\t\t\n\t?>"; $str_left[] = "[/POPUP_LOOP]"; $str_right[] = "\n\t<?php endforeach; ?>"; // 팝업글 스크립트 $str_left[] = "[POPUP_SCRIPT]"; $str_right[] = "\n\t<?php if (!empty(\$mini['skin']['is_popup'])) { ?>\n\t<script type='text/javascript'>\n\t//<![CDATA[\n\t\t\$\$('div[id^=popup]').each(function (item) {\n\t\t\titem.addEvent('dblclick', function () {\n\t\t\t\tpopupClose(this);\n\t\t\t});\n\t\t});\n\n\t\t// 배경 생성\n\t\tvar wcWidth = window.getScrollWidth();\n\t\tvar wcHeight = window.getScrollHeight();\n\t\t\n\t\tif (window.ie6) {\n\t\t\twcWidth -= 20;\n\t\t\twcHeight -= 4;\n\t\t}\n\n\t\tnew Element('div', {\n\t\t\t'id': 'backPopup',\n\t\t\t'styles': {\n\t\t\t\twidth: wcWidth.px(),\n\t\t\t\theight: wcHeight.px(),\n\t\t\t\tposition: 'absolute',\n\t\t\t\ttop: 0,\n\t\t\t\tleft: 0,\n\t\t\t\topacity: 0.25,\n\t\t\t\tzindex: '1',\n\t\t\t\tbackgroundColor: '#000000'\n\t\t\t}\n\t\t}).inject(document.body);\n\t//]]>\n\t</script>\n\t<?php } ?>"; $str_left[] = "[/POPUP_SCRIPT]"; $str_right[] = ""; // 쪽지 뽑기 $str_left[] = "[MEMO]"; $str_right[] = "\n\t<?php\n\tglobal \$memo;\n\tdef(\$mini['setting']['cache_count'], 5);\n\tdef(\$mini['setting']['cut_ment'], 0);\n\t\$memo = mhot(\"\n\t\tmode: memo\n\t\");\n\n\t\$mini['skin']['memo'] = !empty(\$memo);\n\t?>"; $str_left[] = "[/MEMO]"; $str_right[] = ""; // 쪽지 루프 $str_left[] = "[MEMO_LOOP]"; $str_right[] = "\n\t<?php\n\tglobal \$memo;\n\tif (!empty(\$memo) && is_array(\$memo) && count(\$memo) >= 1)\n\t\tforeach (\$memo as \$key=>\$val):\n\t\t\t\$val['depth'] = \$key+1;\n\t\t\t\$val['js_friend'] = \"onclick='view_member.action(\\\"friend\\\", { target_member: \\\"{\$val['from_member']}\\\" });'\";\n\t\t\t\$val['js_memo_block'] = \"onclick='view_member.action(\\\"memo_block\\\", { target_member: \\\"{\$val['from_member']}\\\" });'\";\n\t\t\t\$val['js_memo_save'] = \"onclick='view_member.action(\\\"memo_save\\\", { memo_no: \\\"{\$val['no']}\\\" }); memoAction(\\\"read\\\", \\\"{\$val['no']}\\\");'\";\n\t\t\t\$val['js_memo_del'] = \"onclick='view_member.action(\\\"memo_del\\\", { memo_no: \\\"{\$val['no']}\\\" }); memoAction(\\\"next\\\", \\\"{\$val['no']}\\\");'\";\n\t\t\t\$mini['skin']['memo'] = &\$val;\n\t\t\n\t\techo \"<div id='memoDiv{\$mini['skin']['memo']['no']}' class='iiMemo' style='z-index:{\$mini['skin']['memo']['depth']}; position:absolute; left:50px; top:50px; width:200px; height:300px; border:10px solid #545454; padding:10px 15px; line-height:1.5; background:#fff url(\\\"{\$mini['skin']['dir']}image/title_back.gif\\\") repeat-x 0 -2px;' title='더블클릭하면 닫힙니다.'>\";\n\t?>"; $str_left[] = "[/MEMO_LOOP]"; $str_right[] = "\n\t</div>\n\t<?php endforeach; ?>"; // 쪽지 스크립트 $str_left[] = "[MEMO_SCRIPT]"; $str_right[] = "\n\t<script type='text/javascript'>\n\t//<![CDATA[\n\t\t\$\$('.iiMemo').each(function (item) {\n\t\t\tvar no = item.id.toString().replace(/^memoDiv/i, '');\n\n\t\t\titem.addEvent('dblclick', function () {\n\t\t\t\tthis.remove();\n\t\t\t});\n\n\t\t\tvar tool = \$('memoMove' + no);\n\t\t\tif (\$chk(tool)) {\n\t\t\t\titem.makeDraggable({\n\t\t\t\t\thandle: tool\n\t\t\t\t});\n\t\t\t}\n\t\t});\n\n\t\tfunction memoAction(mode, no) {\n\t\t\tswitch (mode) {\n\t\t\t\tcase 'read':\n\t\t\t\t\tnew Ajax(miniDir + 'ajax.php', {\n\t\t\t\t\t\tonComplete: function (item) {\n\t\t\t\t\t\t\tif (\$chk(item)) {\n\t\t\t\t\t\t\t\tdata = setJSON(item);\n\n\t\t\t\t\t\t\t\tif (data['error'] == 1) {\n\t\t\t\t\t\t\t\t\terror(data['msg']);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\t\t\$('memoDiv' + no).remove();\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\terror('데이터 전송에 실패했습니다');\n\t\t\t\t\t\t\t}\t\t\t\t\t\n\t\t\t\t\t\t},\n\t\t\t\t\t\tonfailure: function () {\n\t\t\t\t\t\t\terror('데이터 전송에 실패했습니다');\n\t\t\t\t\t\t}\n\t\t\t\t\t}).send(miniDir + 'ajax.php', Object.toQueryString({\n\t\t\t\t\t\t'mode': 'memo_read',\n\t\t\t\t\t\t'no': no\n\t\t\t\t\t}));\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'read_all':\n\t\t\t\t\tnew Ajax(miniDir + 'ajax.php', {\n\t\t\t\t\t\tonComplete: function (item) {\n\t\t\t\t\t\t\tif (\$chk(item)) {\n\t\t\t\t\t\t\t\tdata = setJSON(item);\n\n\t\t\t\t\t\t\t\tif (data['error'] == 1) {\n\t\t\t\t\t\t\t\t\terror(data['msg']);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\t\t\$\$('div[id^=memoDiv]').each(function(item) {\n\t\t\t\t\t\t\t\t\t\titem.remove();\n\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\terror('데이터 전송에 실패했습니다');\n\t\t\t\t\t\t\t}\t\t\t\t\t\n\t\t\t\t\t\t},\n\t\t\t\t\t\tonfailure: function () {\n\t\t\t\t\t\t\terror('데이터 전송에 실패했습니다');\n\t\t\t\t\t\t}\n\t\t\t\t\t}).send(miniDir + 'ajax.php', Object.toQueryString({\n\t\t\t\t\t\t'mode': 'memo_read'\n\t\t\t\t\t}));\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'next':\n\t\t\t\t\t\$('memoDiv' + no).remove();\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'close':\n\t\t\t\t\t\$\$('div[id^=memoDiv]').each(function(item) {\n\t\t\t\t\t\titem.remove();\n\t\t\t\t\t});\n\t\t\t\t\tbreak;\n\n\t\t\t\tdefault:\n\t\t\t\t\terror('정의되지 않은 모드 입니다');\t\t\t\t\t\n\t\t\t}\n\t\t}\n\t//]]>\n\t</script>"; $str_left[] = "[/MEMO_SCRIPT]"; $str_right[] = ""; // 카테고리 보기 $str_left[] = "[VIEW_CATEGORY]"; $str_right[] = "\n\t<?php\n\tif (!empty(\$mini['skin']['view']['category']) && is_array(\$mini['skin']['view']['category']))\n\t\tforeach(\$mini['skin']['view']['category'] as \$key => \$val):\n\t\t\t\$mini['skin']['category']['no'] = \$val;\n\t\t\t\$mini['skin']['category']['name'] = \$mini['board']['category_name'][\$val];\n\t\t\t\$mini['skin']['category']['is_first'] = (!\$key);\n\t\t\t\$mini['skin']['category']['url_view'] = \"mini.php?id={\$_REQUEST['id']}&category=\".urlencode(\$val);\n\t\t\t\$mini['skin']['category']['link_view'] = \"href='{\$mini['skin']['category']['url_view']}'\";\n\t?>"; $str_left[] = "[/VIEW_CATEGORY]"; $str_right[] = "\n\t<?php endforeach; ?>"; // 카테고리 목록 뽑기 $str_left[] = "[CATEGORY_LIST]"; $str_right[] = "\n\t<?php\n\tif (!empty(\$mini['board']['category']))\n\t\tforeach(\$mini['board']['category'] as \$key => \$val):\n\t\t\t\$mini['skin']['category'] = \$val;\n\t\t\t\$mini['skin']['category']['is_now'] = !empty(\$_REQUEST['category']) && \$_REQUEST['category'] == \$val['no'];\n\t\t\t\$mini['skin']['category']['url_view'] = \"{\$mini['dir']}mini.php?id={\$_REQUEST['id']}&category={\$val['no']}\".getURI(\"category,id,div,start,page\");\n\t\t\turlToLink(\$mini['skin']['category']);\n\t?>"; $str_left[] = "[/CATEGORY_LIST]"; $str_right[] = "\n\t<?php endforeach; ?>"; // 태그 $str_left[] = "[VIEW_TAG]"; $str_right[] = "\n\t<?php \n\tif (!empty(\$mini['skin']['view']['tag']) && is_array(\$mini['skin']['view']['tag'])) {\n\t\tforeach(\$mini['skin']['view']['tag'] as \$key => \$val):\n\t\t\t\$mini['skin']['tag']['name'] = \$val;\n\t\t\t\$mini['skin']['tag']['is_first'] = (!\$key);\n\t\t\t\$mini['skin']['tag']['url_view'] = \"mini.php?id={\$_REQUEST['id']}&s[tag]=\".urlencode(\$val);\n\t\t\t\$mini['skin']['tag']['link_view'] = \"href='{\$mini['skin']['tag']['url_view']}'\";\n\t?>"; $str_left[] = "[/VIEW_TAG]"; $str_right[] = "\n\t<?php endforeach; } ?>"; // 파일 $str_left[] = "[VIEW_FILE]"; $str_right[] = "\n\t<?php\n\tif (!empty(\$mini['skin']['view']['file_data']) && !empty(\$mini['board']['file_value']))\n\t\tforeach (\$mini['skin']['view']['file_data'] as \$key=>\$val):\n\t\t\tparseFile(\$val);\n\t\t\t\$mini['skin']['file'] = \$val;\n\t\t\t\$mini['skin']['file']['num'] = \$key + 1;\n\t?>"; $str_left[] = "[/VIEW_FILE]"; $str_right[] = "\n\t<?php endforeach; ?>"; // 링크 $str_left[] = "[VIEW_LINK]"; $str_right[] = "\n\t<?php\n\tif (!empty(\$mini['skin']['view']['link']) && !empty(\$mini['board']['link_value']))\n\t\tforeach (\$mini['skin']['view']['link'] as \$key=>\$val):\n\t\t\t\$mini['skin']['link']['no'] = \$key;\n\t\t\t\$mini['skin']['link']['value'] = \$val;\n\t?>"; $str_left[] = "[/VIEW_LINK]"; $str_right[] = "\n\t<?php endforeach; ?>"; // 추가필드 $str_left[] = "[VIEW_FIELD]"; $str_right[] = "\n\t<?php\n\tif (!empty(\$mini['board']['field']) && !empty(\$mini['skin']['view']['field']))\n\t\tforeach (\$mini['skin']['view']['field'] as \$key=>\$val):\n\t\t\t\$mini['skin']['field']['name'] = empty(\$mini['board']['field'][\$key]['name']) ? \$key : \$mini['board']['field'][\$key]['name'];\n\t\t\t\$mini['skin']['field']['value'] = \$val;\n\t\t\t\$mini['skin']['field']['is_array'] = is_array(\$val);\n\t?>"; $str_left[] = "[/VIEW_FIELD]"; $str_right[] = "\n\t<?php endforeach; ?>"; // 추기필드 멀티 $str_left[] = "[VIEW_FIELD_ARRAY]"; $str_right[] = "\n\t<?php\n\tif (is_array(\$val)) {\n\t\tforeach (\$val as \$key2=>\$val2):\n\t\t\t\$mini['skin']['field']['value'] = \$val2;\n\t?>"; $str_left[] = "[/VIEW_FIELD_ARRAY]"; $str_right[] = "\n\t<?php endforeach; } ?>"; // 검색 $str_left[] = "[SEARCH]"; $str_right[] = "\n\t<!-- [SEARCH] -->\n\t<?php if (getPermit(\"name:search\") && !empty(\$mini['board']['use_search'])) { ?>\n\t<form id='form_search' name='form_search' action='mini.php' method='get'>\n\t<input type='hidden' name='id' value='<?php echo \$_REQUEST['id']; ?>' />\n\t<?php if (!empty(\$_REQUEST['skinmake'])) { ?><input type='hidden' name='skinmake' value='<?php echo \$_REQUEST['skinmake']; ?>' /><?php } ?>"; $str_left[] = "[/SEARCH]"; $str_right[] = "\n\t</form>\n\t<?php } ?>\n\t<!-- [/SEARCH] -->"; //+ 댓글임시 $str_left[] = "[CMT2]"; $str_right[] = "\n\t<?php \n\tif (\$mini['board']['use_comment']) {\n\t\techo \"<iframe id='comment' name='comment' src='{\$mini['dir']}cmt.php?id={\$_REQUEST['id']}&no={\$_REQUEST['no']}\".(!empty(\$_REQUEST['pass_encode']) ? \"&pass_encode={\$_REQUEST['pass_encode']}\" : \"\").getURI(\"id, no, start, div, sort, s, quick, and, is_cmt, page\").\"' frameborder='0' style='border:0; width:100%;'></iframe>\";\n\t?>"; $str_left[] = "[/CMT2]"; $str_right[] = "\n\t<?php } ?>"; // 댓글 목록 폼 $str_left[] = "[CMT_LIST_FORM]"; $str_right[] = "\n\t<?php\n\tif (!empty(\$mini['board']['use_comment'])) { \n\t?>\n\t<div id='commentDiv'>\n\t<form id='form_cmt' name='form_cmt' action='cmt.x.php<?php echo getURI(\"id, no, mode, reply, target_post, script, formMode\", \"?\"); ?>' method='post'>\n\t<input type='hidden' name='id' value='<?php echo \$_REQUEST['id']; ?>' />\n\t<input type='hidden' name='target_post' value='<?php echo \$_REQUEST['no']; ?>' />\n\t<input type='hidden' name='reply' />\n\t<input type='hidden' name='mode' />\n\t<input type='hidden' name='pageCmtKey' value='<?php if (!empty(\$_SESSION['pageCmtKey'])) echo \$_SESSION['pageCmtKey']; ?>' />\n\t<input type='hidden' name='sel' />"; $str_left[] = "[/CMT_LIST_FORM]"; $str_right[] = "\n\t</form>\n\t</div>\n\t<?php } ?>"; // 댓글 루프 $str_left[] = "[CMT_LOOP]"; $str_right[] = "\n\t<?php\n\tif (!empty(\$mini['skin']['cmt']['data']) && is_array(\$mini['skin']['cmt']['data']))\n\t\tforeach (\$mini['skin']['cmt']['data'] as \$key=>\$val):\n\t\t\tparseComment(\$val);\n\t\t\t\$mini['skin']['data'] = &\$val;\n\t?>"; $str_left[] = "[/CMT_LOOP]"; $str_right[] = "\n\t<?php endforeach; ?>"; // 댓글 루프 $str_left[] = "[CMT_ALL_LOOP]"; $str_right[] = "\n\t<?php\n\t\$tmp_data = array();\n\tif (!empty(\$mini['skin']['cmt']['notice'])) \$tmp_data = array_merge(\$tmp_data, \$mini['skin']['cmt']['notice']);\n\tif (!empty(\$mini['skin']['cmt']['trackback'])) \$tmp_data = array_merge(\$tmp_data, \$mini['skin']['cmt']['trackback']);\n\tif (!empty(\$mini['skin']['cmt']['data'])) \$tmp_data = array_merge(\$tmp_data, \$mini['skin']['cmt']['data']);\n\n\tif (!empty(\$tmp_data))\n\t\tforeach (\$tmp_data as \$key=>\$val):\n\t\t\tparseComment(\$val);\n\t\t\t\$mini['skin']['data'] = &\$val;\n\t?>"; $str_left[] = "[/CMT_ALL_LOOP]"; $str_right[] = "\n\t<?php endforeach; ?>"; // 댓글 공지사항 루프 $str_left[] = "[CMT_NOTICE_LOOP]"; $str_right[] = "\n\t<?php\n\tif (!empty(\$mini['skin']['cmt']['notice']) && is_array(\$mini['skin']['cmt']['notice']))\n\t\tforeach (\$mini['skin']['cmt']['notice'] as \$key=>\$val):\n\t\t\tparseComment(\$val);\n\t\t\t\$mini['skin']['data'] = &\$val;\n\t?>"; $str_left[] = "[/CMT_NOTICE_LOOP]"; $str_right[] = "\n\t<?php endforeach; ?>"; // 댓글 엮인글 루프 $str_left[] = "[CMT_TRACKBACK_LOOP]"; $str_right[] = "\n\t<?php\n\tif (!empty(\$mini['skin']['cmt']['trackback']) && is_array(\$mini['skin']['cmt']['trackback']))\n\t\tforeach (\$mini['skin']['cmt']['trackback'] as \$key=>\$val):\n\t\t\tparseComment(\$val);\n\t\t\t\$mini['skin']['data'] = &\$val;\n\t?>"; $str_left[] = "[/CMT_TRACKBACK_LOOP]"; $str_right[] = "\n\t<?php endforeach; ?>"; // 댓글 입력 폼 $str_left[] = "[CMT_FORM]"; $str_right[] = "\n\t<?php if (getPermit(\"name:comment\")) { ?><div id='write_comment_div'>"; $str_left[] = "[/CMT_FORM]"; $str_right[] = "\n\t</div><?php } ?>"; // 댓글 링크 $str_left[] = "[CMT_LINK]"; $str_right[] = "\n\t<?php\n\tif (!empty(\$val['link']) && !empty(\$mini['board']['link_value']))\n\t\tforeach (\$val['link'] as \$key2=>\$val2):\n\t\t\t\$mini['skin']['link']['no'] = \$key2;\n\t\t\t\$mini['skin']['link']['value'] = \$val2;\n\t?>"; $str_left[] = "[/CMT_LINK]"; $str_right[] = "\n\t<?php endforeach; ?>"; // 댓글 추가필드 $str_left[] = "[CMT_FIELD]"; $str_right[] = "\n\t<?php\n\tif (!empty(\$mini['board']['field']) && !empty(\$val['field']) && !empty(\$mini['board']['use_cmt_field']))\n\t\tforeach (\$val['field'] as \$key2=>\$val2):\n\t\t\t\$mini['skin']['field']['name'] = empty(\$mini['board']['field'][\$key2]['name']) ? \$key2 : \$mini['board']['field'][\$key2]['name'];\n\t\t\t\$mini['skin']['field']['value'] = \$val2;\n\t?>"; $str_left[] = "[/CMT_FIELD]"; $str_right[] = "\n\t<?php endforeach; ?>"; // 태그 $str_left[] = "[CMT_TAG]"; $str_right[] = "\n\t<?php\n\tif (is_array(\$val['tag']))\n\t\tforeach(\$val['tag'] as \$key2 => \$val2):\n\t\t\t\$mini['skin']['tag']['name'] = \$val2;\n\t\t\t\$mini['skin']['tag']['is_first'] = (!\$key2);\n\t\t\t\$mini['skin']['tag']['url_view'] = \"mini.php?id={\$_REQUEST['id']}&is_cmt=1&s[tag]=\".urlencode(\$val2);\n\t\t\t\$mini['skin']['tag']['link_view'] = \"href='{\$mini['skin']['tag']['url_view']}' target='_parent'\";\n\t?>"; $str_left[] = "[/CMT_TAG]"; $str_right[] = "\n\t<?php endforeach; ?>"; // 추가필드 입력 $str_left[] = "[CMT_FORM_FIELD]"; $str_right[] = "\n\t<?php\n\tif (!empty(\$mini['board']['field']) && !empty(\$mini['board']['use_cmt_field']))\n\t\tforeach (\$mini['board']['field'] as \$key=>\$val):\n\t\t\tswitch (\$val['mode']):\n\t\t\t\tcase 'text':\n\t\t\t\t\t\$val['form'] = \"<input type='text' name='field[{\$key}]' class='fieldText' />\";\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'select':\n\t\t\t\t\t\$val['form'] = \"<select name='field[{\$key}]' class='fieldSelect'>\".getOption(\"str:{\$val['items']}\").\"</select>\";\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'checkbox':\n\t\t\t\t\t\$val['form'] = getOption(\"\n\t\t\t\t\t\tstr: {\$val['items']}\n\t\t\t\t\t\tskin: <input id='field{\$key}[:rand:]' type='checkbox' name='field[{\$key}]' value='[:value:]' /><label for='field{\$key}[:rand:]'>[:key:]</label>\n\t\t\t\t\t\");\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'radio':\n\t\t\t\t\t\$val['form'] = getOption(\"\n\t\t\t\t\t\tstr: {\$val['items']}\n\t\t\t\t\t\tskin: <input id='field{\$key}[:rand:]' type='radio' name='field[{\$key}]' value='[:value:]' /> <label for='field{\$key}[:rand:]'>[:key:]</label>\n\t\t\t\t\t\");\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'textarea':\n\t\t\t\t\t\$val['form'] = \"<textarea name='field[{\$key}]' class='fieldTextarea' cols='60' rows='5'></textarea>\";\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'select-multiple':\n\t\t\t\t\t\$val['form'] = \"<select name='field[{\$key}]' multiple='multiple' class='fieldSelectMulti'>\".getOption(\"str:{\$val['items']}\").\"</select>\";\n\t\t\t\t\tbreak;\n\t\t\tendswitch;\n\n\t\t\t\$mini['skin']['field'] = \$val;\n\t?>"; $str_left[] = "[/CMT_FORM_FIELD]"; $str_right[] = "\n\t<?php endforeach; ?>"; // 링크 $str_left[] = "[CMT_FORM_LINK]"; $str_right[] = "\n\t<?php\n\tif (!empty(\$mini['board']['link_value']))\n\t\tfor (\$i=1; \$i<=\$mini['board']['link_value']; \$i++):\n\t\t\t\$mini['skin']['link']['no'] = \$i;\n\t\t\t\$mini['skin']['link']['name'] = \"link[{\$i}]\";\n\t?>"; $str_left[] = "[/CMT_FORM_LINK]"; $str_right[] = "\n\t<?php endfor; ?>"; // 트랙백 보내기 $str_left[] = "[TRACKBACK_FORM]"; $str_right[] = "\n\t<?php\n\tif (!empty(\$mini['board']['use_trackback'])) { \n\t?>\n\t<form id='form_trackback' name='form_trackback' action='<?php echo \$mini['dir']; ?>ajax.php?url=<?php echo url(); ?>' method='post'>\n\t<input type='hidden' name='id' value='<?php echo \$_REQUEST['id']; ?>' />\n\t<input type='hidden' name='no' value='<?php echo \$_REQUEST['no']; ?>' />\n\t<input type='hidden' name='mode' value='trackback' />\n\t<input type='hidden' name='pageKey' value='<?php if (!empty(\$_SESSION['pageKey'])) echo \$_SESSION['pageKey']; ?>' />"; $str_left[] = "[/TRACKBACK_FORM]"; $str_right[] = "\n\t</form>\n\t<div id='comment_end' style='clear:both;'></div>\n\t<?php } ?>"; // 글쓰기 폼 $str_left[] = "[WRITE_FORM]"; $str_right[] = "\n\t<form id='form_write' name='form_write' action='write.x.php<?php echo getURI(\"id, no, mode\", \"?\"); ?>' method='post' enctype='multipart/form-data'>\n\t<input type='hidden' name='mode' value='<?php echo \$_REQUEST['mode']; ?>' />\n\t<input type='hidden' name='pageKey' value='<?php echo \$_SESSION['pageKey']; ?>' />\n\t<input type='hidden' name='no' value='<?php echo \$_REQUEST['no']; ?>' />\n\t<input type='hidden' name='id' value='<?php echo \$_REQUEST['id']; ?>' />"; $str_left[] = "[/WRITE_FORM]"; $str_right[] = "\n\t</form>"; // 글쓰기 추가필드 $str_left[] = "[WRITE_FIELD]"; $str_right[] = "\n\t<?php\n\tif (!empty(\$mini['board']['field']))\n\t\tforeach (\$mini['board']['field'] as \$key=>\$val):\n\t\t\tif (\$val['is_admin'] && empty(\$mini['member']['level_admin'])) continue;\n\n\t\t\tswitch (\$val['mode']):\n\t\t\t\tcase 'text':\n\t\t\t\t\t\$val['form'] = \"<input type='text' name='field[{\$key}]' class='formText' />\";\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'select':\n\t\t\t\t\t\$val['form'] = \"<select name='field[{\$key}]' class='formSelect'>\".getOption(\"str:{\$val['items']}\").\"</select>\";\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'checkbox':\n\t\t\t\t\t\$val['form'] = getOption(\"\n\t\t\t\t\t\tstr: {\$val['items']}\n\t\t\t\t\t\tskin: <input id='field{\$key}[:rand:]' type='checkbox' name='field[{\$key}]' value='[:value:]' /><label for='field{\$key}[:rand:]'>[:key:]</label>\n\t\t\t\t\t\");\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'radio':\n\t\t\t\t\t\$val['form'] = getOption(\"\n\t\t\t\t\t\tstr: {\$val['items']}\n\t\t\t\t\t\tskin: <input id='field{\$key}[:rand:]' type='radio' name='field[{\$key}]' value='[:value:]' /> <label for='field{\$key}[:rand:]'>[:key:]</label>\n\t\t\t\t\t\");\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'textarea':\n\t\t\t\t\t\$val['form'] = \"<textarea name='field[{\$key}]' class='formTextarea' style='width:80%;' cols='60' rows='5'></textarea>\";\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'select-multiple':\n\t\t\t\t\t\$val['form'] = \"<select name='field[{\$key}][]' multiple='multiple' class='formSelect'>\".getOption(\"str:{\$val['items']}\").\"</select>\";\n\t\t\t\t\tbreak;\n\t\t\tendswitch;\n\n\t\t\t\$mini['skin']['field'] = \$val;\n\t?>"; $str_left[] = "[/WRITE_FIELD]"; $str_right[] = "\n\t<?php endforeach; ?>"; // 글쓰기 링크 $str_left[] = "[WRITE_LINK]"; $str_right[] = "\n\t<?php\n\tif (!empty(\$mini['board']['link_value']))\n\t\tfor (\$i=1; \$i<=\$mini['board']['link_value']; \$i++):\n\t\t\t\$mini['skin']['link']['no'] = \$i;\n\t\t\t\$mini['skin']['link']['name'] = \"link[{\$i}]\";\n\t?>"; $str_left[] = "[/WRITE_LINK]"; $str_right[] = "\n\t<?php endfor; ?>"; // 글쓰기 핑백 $str_left[] = "[WRITE_PINGBACK]"; $str_right[] = "\n\t<?php \n\tif (!empty(\$mini['skin']['data']['pingback_arr']) && is_array(\$mini['skin']['data']['pingback_arr'])) {\n\t\tforeach(\$mini['skin']['data']['pingback_arr'] as \$key => \$val):\n\t\t\t\$mini['skin']['pingback']['url'] = \$val;\n\t\t\t\$mini['skin']['pingback']['is_first'] = (!\$key);\n\t?>"; $str_left[] = "[/WRITE_PINGBACK]"; $str_right[] = "\n\t<?php endforeach; } ?>"; // 글쓰기 파일업로드 $str_left[] = "[FILE_SWF]"; $str_right[] = ' <?php def($mini[\'setting\'][\'file_name\'], \'iiFile\'); def($mini[\'setting\'][\'file_button_width\'], \'60\'); def($mini[\'setting\'][\'file_button_height\'], \'20\'); def($mini[\'setting\'][\'file_button_bgcolor\'], \'#d1d1d1\'); ?> <?php if (!empty($mini[\'skin\'][\'data\'][\'is_file\'])) { ?> <script type=\'text/javascript\'> //<![CDATA[ window.addEvent(\'load\', function () { toggleMenu("bottomContent_file", "", $("bottomMenu_file")); $(\'bottomContent_tag\').toggle(\'hide\'); }); //]]> </script> <?php } ?> <!-- swfupload 설정 --> <script type=\'text/javascript\' src=\'<?php echo $mini[\'skin\'][\'rdir\']; ?>addon/iiUpload/iiUpload.js\'></script> <script type=\'text/javascript\' src=\'<?php echo $mini[\'skin\'][\'rdir\']; ?>js/mini.file.js\'></script> <script type=\'text/javascript\'> //<![CDATA[ <?php $limitsize = getByte(get_cfg_var("upload_max_filesize"), \'decode\'); ?> var <?php echo $mini[\'setting\'][\'file_name\']; ?>Upload = new MiniFileUpload({ name: \'<?php echo $mini[\'setting\'][\'file_name\']; ?>\', target: $(\'fileUpload\'), form: $(\'<?php echo $mini[\'setting\'][\'file_name\'] == \'iiFile\' ? \'form_write\' : \'form_cmt\'; ?>\'), flash_url: \'<?php echo $mini[\'skin\'][\'rdir\']; ?>addon/iiUpload/iiUpload.swf\', use_swfupload: \'<?php echo !empty($mini[\'set\'][\'use_swfupload\']) ? 1 : 0; ?>\', button_url: \'<?php echo $mini[\'skin\'][\'dir\']; ?>image/button_upload.png\', upload_url: \'<?php echo dirname($_SERVER[\'PHP_SELF\']); ?>/upload.php\', exec_url: \'<?php echo $mini[\'skin\'][\'rdir\']; ?>file.x.php?id=<?php echo $_REQUEST[\'id\']; ?>&no=<?php echo $_REQUEST[\'no\']; ?>\', width: <?php echo $mini[\'setting\'][\'file_button_width\']; ?>, height: <?php echo $mini[\'setting\'][\'file_button_height\']; ?>, bgcolor: \'<?php echo $mini[\'setting\'][\'file_button_bgcolor\']; ?>\', params: { "sid": "<?php echo session_id(); ?>", "id" : "<?php echo $_REQUEST[\'id\']; ?>", "mode" : "<?php echo $mini[\'setting\'][\'file_name\'] == \'iiFile\' ? \'post\' : \'comment\'; ?>", "swf" : "1", "pageURL" : "<?php echo url(); ?>", "no" : "<?php echo $mini[\'setting\'][\'file_name\'] == \'iiFile\' ? $_REQUEST[\'no\'] : \'\'; ?>", <?php echo $mini[\'setting\'][\'file_name\'] == \'iiFile\' ? \'\' : "\\"target_post\\" : \\"{$_REQUEST[\'no\']}\\","; ?> "pass_encode" : "<?php if (!empty($_REQUEST[\'pass_encode\'])) echo $_REQUEST[\'pass_encode\']; ?>" }, onSelectEach: function (no, name, size) { var limit = <?php echo !empty($mini[\'board\'][\'file_limit_each\']) ? $mini[\'board\'][\'file_limit_each\'] : "0"; ?>; if (limit && limit * 1048576 < size) { error(\'파일 용량이 \' + (limit * 1048576) + \'bytes를 초과했습니다\'); return false; } return true; }, onSelect: function (count, size) { var limit = <?php echo !empty($mini[\'board\'][\'file_limit\']) ? min($mini[\'board\'][\'file_limit\'], $limitsize) : $limitsize; ?>; if (count + parseInt($(\'<?php echo $mini[\'setting\'][\'file_name\']; ?>Count\').innerHTML) > <?php echo $mini[\'board\'][\'file_value\']; ?>) { error(\'파일은 <?php echo $mini[\'board\'][\'file_value\']; ?>개까지만 올릴 수 있습니다\'); return false; } if (size + parseInt($(\'<?php echo $mini[\'setting\'][\'file_name\']; ?>Size\').innerHTML) > limit * 1048576) { error(\'총 업로드 용량이 <?php echo $mini[\'board\'][\'file_limit\']; ?>M를 초과했습니다\'); return false; } return true; }, onEnd: function (no, item) { if ($chk(item)) { var data = setJSON(item); if ($chk(data[\'error\']) && (data[\'error\'] == \'1\' || data[\'error\'] == 1)) { if (data[\'mode\'].toString().match(/goto/)) { __script(data); } else { error(data[\'msg\']); } } else { <?php echo $mini[\'setting\'][\'file_name\']; ?>AddItem(data[\'data\']); } } }, onError: function (msg) { alert(\'파일 업로드 실패: \' + msg); } }); //]]> </script> <script type=\'text/javascript\'> //<![CDATA[ // 파일추가 function <?php echo $mini[\'setting\'][\'file_name\']; ?>AddItem(data) { // 값 수정 if (!$chk(data["point"])) data["point"] = 0; if (!$chk(data["hit"])) data["hit"] = 0; if (!$chk(data["download"])) data["download"] = 0; var output = \'\'; // 파일 종류에 따른 썸네일 선택 var thumb = \'\'; switch (data[\'type\']) { case \'image\': thumb = \'download.php?mode=view&no=\' + data["no"]; break; case \'music\': thumb = \'<?php echo $mini[\'skin\'][\'dir\']; ?>image/ext/music.gif\'; break; case \'movie\': thumb = \'<?php echo $mini[\'skin\'][\'dir\']; ?>image/ext/movie.gif\'; break; case \'swf\': case \'flv\': thumb = \'<?php echo $mini[\'skin\'][\'dir\']; ?>image/ext/flv.gif\'; break; default: // 추가 타입 switch (data[\'ext\']) { case \'rar\': case \'zip\': case \'alz\': case \'tar\': case \'gz\': case \'bz\': case \'7z\': thumb = \'<?php echo $mini[\'skin\'][\'dir\']; ?>image/ext/zip.gif\'; break; case \'doc\': case \'docx\': case \'xls\': case \'xlsx\': case \'ppt\': case \'pptx\': thumb = \'<?php echo $mini[\'skin\'][\'dir\']; ?>image/ext/office.gif\'; break; case \'hwp\': thumb = \'<?php echo $mini[\'skin\'][\'dir\']; ?>image/ext/hwp.gif\'; break; case \'txt\': thumb = \'<?php echo $mini[\'skin\'][\'dir\']; ?>image/ext/word.gif\'; break; case \'psd\': thumb = \'<?php echo $mini[\'skin\'][\'dir\']; ?>image/ext/psd.gif\'; break; default: thumb = \'<?php echo $mini[\'skin\'][\'dir\']; ?>image/ext/other.gif\'; } } // html 삽입 output = "<li id=\'<?php echo $mini[\'setting\'][\'file_name\']; ?>_" + data["no"] + "\' style=\'list-style-type:none; margin-bottom:5px;\'>" + "<table border=\'0\' cellpadding=\'0\' cellspacing=\'0\' style=\'width:95%;\'><tr>" + "<td width=\'30\' rowspan=\'2\'><input type=\'checkbox\' name=\'<?php echo $mini[\'setting\'][\'file_name\']; ?>Sel[]\' value=\'" + data["no"] + "\' /></td>" + "<td width=\'70\' rowspan=\'2\'><img src=\'" + thumb + "\' style=\'width:50px; height:35px; border:5px solid #ccc; cursor:pointer;\' alt=\'미리보기\' onclick=\'window.open(\\""+(data["type"] == "image" ? miniDir + "addon/phpthumb/preview.php?no=" + data["no"] : miniDir + "download.php?mode=view&no=" + data["no"]) + "\\",\\"ie_preview\\",\\"width=640, height=480, resizable=1\\");\' /></td>" + "<td>" + "<span style=\'font-size:10px; font-family:verdana;\'>" + data["no"] + "</span> <span style=\'font-size:11px; font-weight:bold; color:#333; font-family:dotum;\'>" + data["name"] + "</span> <span style=\'font-size:10px; font-family:tahoma;\'>(" + data["size_out"] + ")</span> " + "</td>" + "</tr>" + "<tr>" + "<td><span class=\'word kor_s\'>설명 <input type=\'text\' name=\'" + <?php echo $mini[\'setting\'][\'file_name\']; ?>Upload.setting["name"] + "Title[" + data["no"] + "]\' value=\'" + data["title"] + "\' class=\'formText\' style=\'width:50%;\' /></span><span class=\'kor_s\'>포인트 <input type=\'text\' name=\'" + <?php echo $mini[\'setting\'][\'file_name\']; ?>Upload.setting["name"] + "Point[" + data["no"] + "]\' value=\'" + data["point"] + "\' class=\'formText\' style=\'width:50px; text-align:right;\' /></span>" + " <img src=\'<?php echo $mini[\'skin\'][\'dir\']; ?>image/icon/edit.gif\' border=\'0\' style=\'vertical-align:middle; cursor:pointer;\' alt=\'수정\' onclick=\'<?php echo $mini[\'setting\'][\'file_name\']; ?>Edit(" + data["no"] + ");\' />" + " <img src=\'<?php echo $mini[\'skin\'][\'dir\']; ?>image/icon/x_gray.gif\' border=\'0\' style=\'vertical-align:middle; cursor:pointer;\' alt=\'삭제\' onclick=\'<?php echo $mini[\'setting\'][\'file_name\']; ?>DelItem(" + data["no"] + ");\' />" + "</td>" + "</tr></table>" + "</li>"; $(\'<?php echo $mini[\'setting\'][\'file_name\']; ?>\').innerHTML += output; <?php echo $mini[\'setting\'][\'file_name\']; ?>Upload.addFile(data); $(\'<?php echo $mini[\'setting\'][\'file_name\']; ?>Count\').innerHTML = <?php echo $mini[\'setting\'][\'file_name\']; ?>Upload.count; $(\'<?php echo $mini[\'setting\'][\'file_name\']; ?>Size\').innerHTML = <?php echo $mini[\'setting\'][\'file_name\']; ?>Upload.size; <?php echo $mini[\'setting\'][\'file_name\']; ?>Upload.addMent(data[\'no\']); }; // 파일삭제 function <?php echo $mini[\'setting\'][\'file_name\']; ?>DelItem(no, mode) { if (mode || confirm("파일을 삭제하시겠습니까?")) { if ($chk($(\'<?php echo $mini[\'setting\'][\'file_name\']; ?>_\' + no))) $(\'<?php echo $mini[\'setting\'][\'file_name\']; ?>_\' + no).remove(); ajaxForm({ url: <?php echo $mini[\'setting\'][\'file_name\']; ?>Upload.setting[\'exec_url\'] + \'&mode=del&target=\' + no, onComplete: function (data) { <?php echo $mini[\'setting\'][\'file_name\']; ?>Upload.delFile(no); $(\'<?php echo $mini[\'setting\'][\'file_name\']; ?>Count\').innerHTML = <?php echo $mini[\'setting\'][\'file_name\']; ?>Upload.count; $(\'<?php echo $mini[\'setting\'][\'file_name\']; ?>Size\').innerHTML = <?php echo $mini[\'setting\'][\'file_name\']; ?>Upload.size; } }); } }; // 선택파일 삭제 function <?php echo $mini[\'setting\'][\'file_name\']; ?>DelItems() { var data = <?php echo $mini[\'setting\'][\'file_name\']; ?>Upload.getQueryString(\'del\'); if (data) { if (confirm("선택한 파일들을 삭제하시겠습니까?")) { ajaxForm({ url: <?php echo $mini[\'setting\'][\'file_name\']; ?>Upload.setting[\'exec_url\'] + \'&mode=del\', values: data, onComplete: function (item) { var matches = data.toString().match(/sel\\[\\]=([0-9]+)/g); for (var i=0; i < matches.length; i++) { <?php echo $mini[\'setting\'][\'file_name\']; ?>DelItem(parseInt(matches[i].toString().replace(/[^0-9]+/g, \'\')), 1); } $(\'<?php echo $mini[\'setting\'][\'file_name\']; ?>Count\').innerHTML = <?php echo $mini[\'setting\'][\'file_name\']; ?>Upload.count; $(\'<?php echo $mini[\'setting\'][\'file_name\']; ?>Size\').innerHTML = <?php echo $mini[\'setting\'][\'file_name\']; ?>Upload.size; } }); } } else { error(\'파일을 선택해 주세요\'); } }; // 설명수정 function <?php echo $mini[\'setting\'][\'file_name\']; ?>Edit(no) { var ins = { title: <?php echo $mini[\'setting\'][\'file_name\']; ?>Upload.setting[\'form\'].elements[<?php echo $mini[\'setting\'][\'file_name\']; ?>Upload.setting[\'name\'] + \'Title[\' + no + \']\'].value, point: <?php echo $mini[\'setting\'][\'file_name\']; ?>Upload.setting[\'form\'].elements[<?php echo $mini[\'setting\'][\'file_name\']; ?>Upload.setting[\'name\'] + \'Point[\' + no + \']\'].value }; ajaxForm({ url: <?php echo $mini[\'setting\'][\'file_name\']; ?>Upload.setting[\'exec_url\'] + \'&mode=text&target=\' + no, values: ins, onComplete: function (data) { __script(data); } }); }; // 선택 설명수정 function <?php echo $mini[\'setting\'][\'file_name\']; ?>Edits() { var data = <?php echo $mini[\'setting\'][\'file_name\']; ?>Upload.getQueryString(); var sel = {}; var no = 0; var obj = <?php echo $mini[\'setting\'][\'file_name\']; ?>Upload.getCheckbox(); for (var i = 0; i < obj.length; i++) { no = obj[i].value; sel[\'sel[\' + no + \']\'] = no; sel[\'title[\' + no + \']\'] = <?php echo $mini[\'setting\'][\'file_name\']; ?>Upload.setting[\'form\'].elements[<?php echo $mini[\'setting\'][\'file_name\']; ?>Upload.setting[\'name\'] + \'Title[\' + no + \']\'].value; sel[\'point[\' + no + \']\'] = <?php echo $mini[\'setting\'][\'file_name\']; ?>Upload.setting[\'form\'].elements[<?php echo $mini[\'setting\'][\'file_name\']; ?>Upload.setting[\'name\'] + \'Point[\' + no + \']\'].value; } if (data) { ajaxForm({ url: <?php echo $mini[\'setting\'][\'file_name\']; ?>Upload.setting[\'exec_url\'] + \'&mode=text\', values: sel, onComplete: function (item) { __script(item); } }); } else { error(\'파일을 선택해 주세요\'); } }; // 기존값 적용 <?php if ($mini[\'setting\'][\'file_name\'] == \'iiFile\' && !empty($mini[\'skin\'][\'data\'][\'files\'])) { foreach ($mini[\'skin\'][\'data\'][\'files\'] as $key=>$val): unset($val[\'history_hit\']); parseFile($val); echo "{$mini[\'setting\'][\'file_name\']}AddItem(".setJSON($val).");\\n"; endforeach; } ?> //]]> </script>'; $str_left[] = "[/FILE_SWF]"; $str_right[] = ""; break; #회원가입 #회원가입 case 'member.php': case 'agree.php': // 폼 $str_left[] = "[FORM]"; $str_right[] = "\n\t<form id='form_join' name='form_join' action='member.x.php<?php echo getURI(\"mode, no\", \"?\"); ?>' method='post' enctype='multipart/form-data'>\n\t<input type='hidden' name='mode' value='<?php echo \$_REQUEST['mode']; ?>' />\n\t<input type='hidden' name='no' value='<?php echo \$_REQUEST['no']; ?>' />\n\t<input type='hidden' name='completeMode' value='ajax,alert,reload.parent' />"; $str_left[] = "[/FORM]"; $str_right[] = "\n\t</form>"; // 추가필드 $str_left[] = "[FIELD]"; $str_right[] = "\n\t<?php\n\tif (!empty(\$mini['site']['field']))\n\t\tforeach (\$mini['site']['field'] as \$key=>\$val):\n\t\t\tswitch (\$val['mode']):\n\t\t\t\tcase 'text':\n\t\t\t\t\t\$val['form'] = \"<input type='text' name='field[{\$key}]' class='formText' />\";\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'select':\n\t\t\t\t\t\$val['form'] = \"<select name='field[{\$key}]' class='formSelect'>\".getOption(\"str:{\$val['items']}\").\"</select>\";\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'checkbox':\n\t\t\t\t\t\$val['form'] = getOption(\"\n\t\t\t\t\t\tstr: {\$val['items']}\n\t\t\t\t\t\tskin: <input id='field{\$key}[:rand:]' type='checkbox' name='field[{\$key}]' value='[:value:]' /><label for='field{\$key}[:rand:]'>[:key:]</label>\n\t\t\t\t\t\");\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'radio':\n\t\t\t\t\t\$val['form'] = getOption(\"\n\t\t\t\t\t\tstr: {\$val['items']}\n\t\t\t\t\t\tskin: <input id='field{\$key}[:rand:]' type='radio' name='field[{\$key}]' value='[:value:]' /> <label for='field{\$key}[:rand:]'>[:key:]</label>\n\t\t\t\t\t\");\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'textarea':\n\t\t\t\t\t\$val['form'] = \"<textarea name='field[{\$key}]' class='formTextarea' cols='60' rows='5'></textarea>\";\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'select-multiple':\n\t\t\t\t\t\$val['form'] = \"<select name='field[{\$key}]' multiple='multiple' class='formSelect'>\".getOption(\"str:{\$val['items']}\").\"</select>\";\n\t\t\t\t\tbreak;\n\t\t\tendswitch;\n\n\t\t\t\$mini['skin']['field'] = \$val;\n\t\t\t\$mini['skin']['field']['join_setting'] = !empty(\$mini['site']['join_setting'][\"field_{\$key}\"]);\n\t\t\t\$mini['skin']['field']['join_check'] = !empty(\$mini['site']['join_check'][\"field[{\$key}]\"]);\n\n\t\t\tif (\$mini['skin']['field']['join_setting']) {\n\t?>"; $str_left[] = "[/FIELD]"; $str_right[] = "\n\t<?php } endforeach; ?>"; // 약관 폼 $str_left[] = "[AGREE]"; $str_right[] = "\n\t<form id='form_agree' name='form_agree' action='<?php echo str_replace(\"&\", \"&\", urldecode(url())); ?>' method='post'>"; $str_left[] = "[/AGREE]"; $str_right[] = "\n\t</form>"; break; #파일 #파일 case 'file.php': // 업로드 폼 $str_left[] = "[UPLOAD]"; $str_right[] = "\n\t<form id='form_upload' name='form_upload' action='upload.php' method='post' enctype='multipart/form-data'>\n\t<input type='hidden' name='id' value='<?php echo \$_REQUEST['id']; ?>' />\n\t<input type='hidden' name='no' value='<?php echo \$_REQUEST['no']; ?>' />\n\t<input type='hidden' name='mode' value='<?php echo \$_REQUEST['mode']; ?>' />\n\t<input type='hidden' name='swf' value='<?php echo !empty(\$mini['set']['use_swfupload']) ? 1 : 0; ?>' />\n\t<input type='hidden' name='pass_encode' value='<?php if (!empty(\$_REQUEST['pass_encode'])) echo \$_REQUEST['pass_encode']; ?>' />"; $str_left[] = "[/UPLOAD]"; $str_right[] = "\n\t</form>"; // 파일목록 폼 $str_left[] = "[FORM]"; $str_right[] = "\n\t<form id='form_file' name='form_file' action='file.x.php' method='post'>\n\t<input type='hidden' name='id' value='<?php echo \$_REQUEST['id']; ?>' />\n\t<input type='hidden' name='no' value='<?php echo \$_REQUEST['no']; ?>' />\n\t<input type='hidden' name='mode' value='<?php echo \$_REQUEST['mode']; ?>' />"; $str_left[] = "[/FORM]"; $str_right[] = "\n\t</form>"; // 툴 폼 $str_left[] = "[FORM_TOOL]"; $str_right[] = "\n\t<form id='form_tool' name='form_tool' method='post'>\n\t<input type='hidden' name='target' />"; $str_left[] = "[/FORM_TOOL]"; $str_right[] = "\n\t</form>"; break; #마이메뉴 #마이메뉴 case 'mymenu.php': // 메신져 $str_left[] = "[VIEW_CHAT]"; $str_right[] = "\n\t<?php\n\tif (!empty(\$mini['skin']['data']['chat'])) {\n\t\tforeach (\$mini['skin']['data']['chat'] as \$key => \$val):\n\t\t\t\$mini['skin']['chat']['mode'] = \$val['mode'];\n\t\t\t\$mini['skin']['chat']['value'] = \$val['value'];\n\t?>"; $str_left[] = "[/VIEW_CHAT]"; $str_right[] = "\n\t<?php endforeach; } ?>"; // 쪽지 $str_left[] = "[MEMO_FORM]"; $str_right[] = "\n\t<form id='form_memo_list' name='form_memo_list' action='mymenu.x.php' method='post'>\n\t<input type='hidden' name='mode' />\n\t<input type='hidden' name='mode2' value='<?php echo \$_REQUEST['mode']; ?>' />\n\t<input type='hidden' name='url' value='<?php echo url(); ?>' />\n\t<input type='hidden' name='completeMode' value='ajax,reload' />"; $str_left[] = "[/MEMO_FORM]"; $str_right[] = "\n\t</form>"; // 쪽지 목록 $str_left[] = "[MEMO_LOOP]"; $str_right[] = "\n\t<?php\n\tglobal \$data;\n\tif (!empty(\$data) && is_array(\$data) && count(\$data) >= 1)\n\t\tforeach (\$data as \$key=>\$val):\n\t\t\tparseMemo(\$val);\n\t\t\t\$val['ment_notag'] = strCut(\$val['ment_notag'], 30, '...');\n\t\t\tif (\$val['target_member'] == \$mini['member']['no']) {\n\t\t\t\t\$val['name_him'] = \$val['name_from'];\n\t\t\t\t\$val['js_send_him'] = \$val['js_send_from'];\n\t\t\t}\n\t\t\tif (\$val['from_member'] == \$mini['member']['no']) {\n\t\t\t\t\$val['name_him'] = \$val['name_target'];\n\t\t\t\t\$val['js_send_him'] = \$val['js_send_target'];\n\t\t\t}\n\t\t\t\$mini['skin']['data'] = &\$val;\n\n\t?>"; $str_left[] = "[/MEMO_LOOP]"; $str_right[] = "\n\t<?php\n\t\tendforeach;\n\t?>"; // 친구목록 $str_left[] = "[MEMO_FRIEND_LOOP]"; $str_right[] = "\n\t<?php\n\tglobal \$data;\n\tif (!empty(\$data) && is_array(\$data) && count(\$data) >= 1)\n\t\tforeach (\$data as \$key=>\$val):\n\t\t\t\$mini['skin']['data'] = &\$val;\n\n\t?>"; $str_left[] = "[/MEMO_FRIEND_LOOP]"; $str_right[] = "\n\t<?php\n\t\tendforeach;\n\t?>"; // 포인트기록 목록 $str_left[] = "[LOG_POINT_LOOP]"; $str_right[] = "\n\t<?php\n\tglobal \$data;\n\tif (!empty(\$data) && is_array(\$data) && count(\$data) >= 1)\n\t\tforeach (\$data as \$key=>\$val):\n\t\t\t\$mini['skin']['data'] = &\$val;\n\n\t?>"; $str_left[] = "[/LOG_POINT_LOOP]"; $str_right[] = "\n\t<?php\n\t\tendforeach;\n\t?>"; break; #쪽지쓰기 #쪽지쓰기 case 'memo.write.php': // 쪽지보내기 $str_left[] = "[MEMO_WRITE_FORM]"; $str_right[] = "\n\t<form id='form_memo_write' name='form_memo_write' action='ajax.php' method='post'>\n\t<input type='hidden' name='mode' value='send_memo' />\n\t<input type='hidden' name='target_member' value='<?php echo \$_REQUEST['no']; ?>' />"; $str_left[] = "[/MEMO_WRITE_FORM]"; $str_right[] = "\n\t</form>"; break; #신고 #신고 case 'report.php': // 폼 $str_left[] = "[FORM]"; $str_right[] = "\n\t<form id='form_report' name='form_report' action='report.x.php' method='post'>\n\t<input type='hidden' name='id' value='<?php echo \$_REQUEST['id']; ?>' />\n\t<input type='hidden' name='mode' value='<?php echo \$_REQUEST['mode']; ?>' />\n\t<input type='hidden' name='no' value='<?php echo \$_REQUEST['no']; ?>' />"; $str_left[] = "[/FORM]"; $str_right[] = "\n\t</form>"; break; #비밀번호 #비밀번호 case 'pass.php': // 폼 $str_left[] = "[FORM]"; $str_right[] = "\n\t<form id='form_pass' name='form_pass' action='<?php echo \$data['path']; ?>' method='get'<?php if (!empty(\$_REQUEST['target'])) echo \" target='{\$_REQUEST['target']}'\"; ?>>\n\t<?php if (!empty(\$data['form'])) echo \$data['form']; ?>"; $str_left[] = "[/FORM]"; $str_right[] = "\n\t</form>"; break; #자료관리 #자료관리 case 'manage.php': // 폼 $str_left[] = "[FORM]"; $str_right[] = "\n\t<form id='form_manage' name='form_manage' action='manage.x.php' method='post'>\n\t<input type='hidden' name='id' value='<?php echo \$_REQUEST['id']; ?>' />\n\t<input type='hidden' name='mode' value='<?php echo \$_REQUEST['mode']; ?>' />\n\t<input type='hidden' name='report' value='<?php echo (!empty(\$_REQUEST['report']) ? 1 : 0); ?>' />\n\t<?php\n\t\tforeach (\$_REQUEST['no'] as \$val):\n\t\t\techo \"<input type='hidden' name='no[]' value='{\$val}' />\n\";\n\t\tendforeach;\n\t?>"; $str_left[] = "[/FORM]"; $str_right[] = "\n\t</form>"; // 신고자 목록 $str_left[] = "[REPORTER_LOOP]"; $str_right[] = "\n\t<?php\n\tglobal \$target_name, \$report;\n\t\n\t\$tmp_ment = getStr(\$report['ment']);\n\n\tif (!empty(\$target_name) && is_array(\$target_name) && count(\$target_name) >= 1)\n\t\tforeach (\$target_name as \$key=>\$val):\n\t\t\t\$mini['skin']['name'] = \$val;\n\t\t\t\$mini['skin']['ment'] = \$tmp_ment[\$key];\n\t?>"; $str_left[] = "[/REPORTER_LOOP]"; $str_right[] = "\n\t<?php\n\t\tendforeach;\n\t?>"; // 신고사유 목록 $str_left[] = "[REPORTER_MENT_LOOP]"; $str_right[] = "\n\t<?php\n\tglobal \$report;\n\n\tif (!empty(\$report['ment'])) {\n\t\tforeach ( as \$key=>\$val):\n\t\t\t\$mini['skin']['ment'] = \$val;\n\t?>"; $str_left[] = "[/REPORTER_MENT_LOOP]"; $str_right[] = "\n\t<?php\n\t\tendforeach;\n\t}\n\t?>"; break; #아이디/비밀번호 찾기 #아이디/비밀번호 찾기 case 'login.find.php': // 찾기 $str_left[] = "[FIND]"; $str_right[] = "\n\t<form id='form_find' name='form_find' action='login.find.php<?php echo getURI(\"mode\", \"?\"); ?>' method='post'>\n\t<input type='hidden' name='mode' />\n\t<input type='hidden' name='site' value='<?php echo \$mini['site']['no']; ?>' />\n\t"; $str_left[] = "[/FIND]"; $str_right[] = "\n\t</form>"; // 비밀번호 변경 $str_left[] = "[FIND_PASS]"; $str_right[] = "\n\t<form id='form_find_pass' name='form_find_pass' action='login.find.php<?php echo getURI(\"mode\", \"?\"); ?>' method='post'>\n\t<input type='hidden' name='mode' value='pass_ok' />\n\t<input type='hidden' name='no' value='<?php echo \$_REQUEST['no']; ?>' />\n\t<input type='hidden' name='site' value='<?php echo \$mini['site']['no']; ?>' />\n\t<input type='hidden' name='answer' value='<?php if (!empty(\$_REQUEST['qna_answer'])) echo \$_REQUEST['qna_answer']; ?>' />\n\t"; $str_left[] = "[/FIND_PASS]"; $str_right[] = "\n\t</form>"; break; } #모든곳 // 로그인 $str_left[] = "[LOGIN]"; $str_right[] = "\n\t<form id='form_login' name='form_login' action='login.php<?php echo getURI(\"mode\", \"?\"); ?>' method='post'>\n\t<input type='hidden' name='mode' value='login' />\n\t<input type='hidden' name='completeMode' value='ajax,reload.parent' />\n\t<input type='hidden' name='completeScript' value='login_autosave' />"; $str_left[] = "[LOGIN_NORMAL]"; $str_right[] = "\n\t<form id='form_login' name='form_login' action='login.php<?php echo getURI(\"mode\", \"?\"); ?>' method='post'>\n\t<input type='hidden' name='mode' value='login' />"; $str_left[] = "[/LOGIN]"; $str_right[] = "\n\t</form>"; // 툴 레이어 $str_left[] = "[TOOL /]"; $str_right[] = "\n\t<div id='tool' style='display:none;' class='tool'>\n\t\t<img src='<?php echo \$mini['skin']['dir']; ?>image/icon/x_gray.gif' border='0' class='hand' style='vertical-align:middle;' alt='삭제' title='삭제' <?php echo \$mini['skin']['js_post_del']; ?> />\n\t\t<img src='<?php echo \$mini['skin']['dir']; ?>image/icon/alert.gif' border='0' class='hand' style='vertical-align:middle;' alt='관리' title='관리' <?php echo \$mini['skin']['js_pop_post_manage']; ?> />\n\t</div>\n\t"; // 툴 댓글 레이어 $str_left[] = "[TOOL_CMT /]"; $str_right[] = "\n\t<div id='tool_cmt' style='display:none;' class='tool'>\n\t\t<img src='<?php echo \$mini['skin']['dir']; ?>image/icon/x_gray.gif' border='0' class='hand' style='vertical-align:middle;' alt='삭제' title='삭제' <?php echo \$mini['skin']['js_cmt_del']; ?> />\n\t\t<img src='<?php echo \$mini['skin']['dir']; ?>image/icon/alert.gif' border='0' class='hand' style='vertical-align:middle;' alt='관리' title='관리' <?php echo \$mini['skin']['js_pop_cmt_manage']; ?> />\n\t</div>"; // 툴 쪽지 친구목록 레이어 $str_left[] = "[TOOL_MEMO /]"; $str_right[] = "\n\t<div id='tool' style='display:none;' class='tool'>\n\t\t<img src='<?php echo \$mini['skin']['dir']; ?>image/icon/against.gif' border='0' class='hand' style='vertical-align:middle;' alt='차단'1 title='차단' <?php echo \$mini['skin']['js_memo_block']; ?> />\n\t\t<img src='<?php echo \$mini['skin']['dir']; ?>image/icon/x_gray.gif' border='0' class='hand' style='vertical-align:middle;' alt='삭제' title='삭제' <?php echo \$mini['skin']['js_friend']; ?> />\n\t</div>"; // 툴 쪽지 목록 레이어 $str_left[] = "[TOOL_MEMO_LIST /]"; $str_right[] = "\n\t<div id='tool' style='display:none;' class='tool'>\n\t\t<img src='<?php echo \$mini['skin']['dir']; ?>image/icon/paper-clip.gif' border='0' class='hand' style='vertical-align:middle;' alt='보관' title='보관' <?php echo \$mini['skin']['js_memo_save_action']; ?> />\n\t\t<img src='<?php echo \$mini['skin']['dir']; ?>image/icon/x_gray.gif' border='0' class='hand' style='vertical-align:middle;' alt='삭제' title='삭제' <?php echo \$mini['skin']['js_del']; ?> />\n\t</div>"; // 툴 쪽지 보관함 레이어 $str_left[] = "[TOOL_MEMO_SAVE /]"; $str_right[] = "\n\t<div id='tool' style='display:none;' class='tool'>\n\t\t<img src='<?php echo \$mini['skin']['dir']; ?>image/icon/paper-clip.gif' border='0' class='hand' style='vertical-align:middle;' alt='보관' title='보관' <?php echo \$mini['skin']['js_memo_save_action']; ?> />\n\t\t<img src='<?php echo \$mini['skin']['dir']; ?>image/icon/x_gray.gif' border='0' class='hand' style='vertical-align:middle;' alt='삭제' title='삭제' <?php echo \$mini['skin']['js_del']; ?> />\n\t</div>"; //// 목록 호출 if (strpos($output, "[LIST_INC]") !== false) { $fp = fopen("{$mini['sdir']}list.php", "r"); $tmp_include_data = ''; while (!feof($fp)) { $tmp_include_data .= fgets($fp, 4096); } fclose($fp); unset($mat); preg_match("/\\<\\!\\-\\- \\[LIST\\] \\-\\-\\>(.+)\\<\\!\\-\\- \\[\\/LIST\\] \\-\\-\\>/sU", $tmp_include_data, $mat); $str_left[] = "[LIST_INC]"; $str_right[] = $mat[1]; $str_left[] = "[/LIST_INC]"; $str_right[] = ""; unset($tmp_include_data); unset($mat); } //// 검색 호출 if (strpos($output, "[SEARCH_INC]") !== false) { $fp = fopen("{$mini['sdir']}list.php", "r"); $tmp_include_data = ''; while (!feof($fp)) { $tmp_include_data .= fgets($fp, 4096); } fclose($fp); unset($mat); preg_match("/\\<\\!\\-\\- \\[SEARCH\\] \\-\\-\\>(.+)\\<\\!\\-\\- \\[\\/SEARCH\\] \\-\\-\\>/sU", $tmp_include_data, $mat); $str_left[] = "[SEARCH_INC]"; $str_right[] = $mat[1]; $str_left[] = "[/SEARCH_INC]"; $str_right[] = ""; unset($tmp_include_data); unset($mat); } //// 댓글 목록 호출 if (strpos($output, "[CMT_INC /]") !== false) { $str_left[] = "[CMT_INC /]"; $str_right[] = "\n\t\t\t\t<?php \n\t\t\t\tif (!empty(\$mini['board']['use_comment'])) {\n\t\t\t\t\tinclude \"{$mini['sdir']}cmt.php\";\n\t\t\t\t}\n\t\t\t\t?>"; } //// 치환 $output = str_replace($str_left, $str_right, $output); $str_left = $str_right = array(); //// PHP 구문은 먼저 뺀다 preg_match_all("/\\<\\?(.+)\\?\\>/isU", $output, $mat); foreach ($mat[0] as $key => $val) { $output = str_replace($val, "<!--exchange-miniboard-{$key}-->", $output); } //// 특별 // depth 증가 $preg_left[] = "/\\[depth:([^\\]]*)\\]/i"; $preg_right[] = "<?php echo !preg_match(\"/[^0-9]/\", \"\\1\") ? (int)(\"\\1\" * \$val['depth']) : str_repeat(\"\\1\", \$val['depth']); ?>"; $preg_left[] = "/\\[depth0:([^\\]]*)\\]/i"; $preg_right[] = "<?php echo !preg_match(\"/[^0-9]/\", \"\\1\") ? (int)(\"\\1\" * \$val['depth']-1) : str_repeat(\"\\1\", \$val['depth']-1); ?>"; // include $preg_left[] = "/\\[include:([^\\]]+)\\]/i"; $preg_right[] = "<?php include \"{$mini['dir']}\\1\"; ?>"; // 스킨경로가 포함된 include if (!empty($mini['sdir'])) { $preg_left[] = "/\\[sinclude:([^\\]]+)\\]/i"; $preg_right[] = "<?php include \"{$mini['sdir']}\\1\"; ?>"; } // 주석 $preg_left[] = "/^\\s*?\\#\\#.+\$/m"; $preg_right[] = ""; //// 논리문 $preg_left[] = "/\\[if:([a-z0-9_]+)\\.([a-z0-9_]+)\\.([a-z0-9_]+)\\.([a-z0-9_]+)\\]/i"; $preg_right[] = "<?php if (!empty(\$mini['skin']['\\1']['\\2']['\\3']['\\4'])) { ?>"; $preg_left[] = "/\\[if:([a-z0-9_]+)\\.([a-z0-9_]+)\\.([a-z0-9_]+)\\]/i"; $preg_right[] = "<?php if (!empty(\$mini['skin']['\\1']['\\2']['\\3'])) { ?>"; $preg_left[] = "/\\[\\!if:([a-z0-9_]+)\\.([a-z0-9_]+)\\.([a-z0-9_]+)\\]/i"; $preg_right[] = "<?php if (empty(\$mini['skin']['\\1']['\\2']['\\3'])) { ?>"; $preg_left[] = "/\\[if:([a-z0-9_]+)\\.([a-z0-9_]+)\\]/i"; $preg_right[] = "<?php if (!empty(\$mini['skin']['\\1']['\\2'])) { ?>"; $preg_left[] = "/\\[\\!if:([a-z0-9_]+)\\.([a-z0-9_]+)\\]/i"; $preg_right[] = "<?php if (empty(\$mini['skin']['\\1']['\\2'])) { ?>"; $preg_left[] = "/\\[if:([a-z0-9_]+)\\]/i"; $preg_right[] = "<?php if (!empty(\$mini['skin']['\\1'])) { ?>"; $preg_left[] = "/\\[\\!if:([a-z0-9_]+)\\]/i"; $preg_right[] = "<?php if (empty(\$mini['skin']['\\1'])) { ?>"; $str_left[] = "[endif]"; $str_right[] = "<?php } ?>"; //// 변수 $preg_left[] = "/\\[:([a-z0-9_]+)\\.([a-z0-9_]+)\\.([a-z0-9_]+)\\.([a-z0-9_]+):\\]/i"; $preg_right[] = "<?php echo \$mini['skin']['\\1']['\\2']['\\3']['\\4']; ?>"; $preg_left[] = "/\\[:([a-z0-9_]+)\\.([a-z0-9_]+)\\.([a-z0-9_]+):\\]/i"; $preg_right[] = "<?php echo \$mini['skin']['\\1']['\\2']['\\3']; ?>"; $preg_left[] = "/\\[:([a-z0-9_]+)\\.([a-z0-9_]+):\\]/i"; $preg_right[] = "<?php echo \$mini['skin']['\\1']['\\2']; ?>"; $preg_left[] = "/\\[:([a-z0-9_]+):\\]/i"; $preg_right[] = "<?php echo \$mini['skin']['\\1']; ?>"; //// 변환 $output = str_replace($str_left, $str_right, $output); $output = preg_replace($preg_left, $preg_right, $output); //// PHP 구문을 붙인다 $output = preg_replace("/\\<\\!\\-\\-exchange\\-miniboard\\-([0-9]+)\\-\\-\\>/e", '$mat[0][\\1]', $output); if ($mode == 'url') { //// 쓰기 $fp = fopen(preg_replace("/\\.mini\$/i", ".php", $url), "w+"); flock($fp, LOCK_EX); if (!$fp || !fwrite($fp, $output)) { __error("[{$url}] 파일 쓰기를 실패 했습니다. 파일 권한을 확인해 보세요"); } flock($fp, LOCK_UN); fclose($fp); } else { $output = preg_replace_callback("/\\<\\?(php)? echo ([^;]+)\\; \\?\\>/i", create_function('$matches', "global \$mini; return eval(\"return \".stripslashes(\$matches[2]).\";\");"), $output); return $output; } } }
/** * 입력 변수 체크 - 그룹 * @class admin.site * @param $data: 자료 */ function checkFieldSite(&$data) { global $mini; if (!is_array($data)) { __error("입력된 데이터가 없습니다"); } // DB 컬럼 로드 iss($col); $col = getColumns($mini['name']['site']); foreach ($data as $key => $val) { switch ($key) { // 삭제 설정 case 'date': case 'no': unset($data[$key]); break; // 그룹연결 // 그룹연결 case 'site_link': if (is_array($val)) { $data[$key] = "[" . implode("][", $val) . "]"; } break; // 추가필드 // 추가필드 case 'field': if (is_array($val)) { str($data[$key], 'encode'); $data[$key] = serialize($data[$key]); } else { __error('추가필드 형식이 올바르지 않습니다'); } break; // 가입항목설정 // 가입항목설정 case 'join_setting': if (is_array($val)) { $data[$key] = serialize($data[$key]); } else { __error('가입항목설정 형식이 올바르지 않습니다'); } break; // 템플릿 // 템플릿 case 'template': if (is_array($val)) { str($data[$key], 'encode'); $data[$key] = serialize($data[$key]); } else { __error('템플릿 형식이 올바르지 않습니다'); } break; // 메일 // 메일 case 'mail': check($val, "type:mail, name:대표 메일"); break; // 휴대전화 // 휴대전화 case 'cp': check($val, "type:cp, name:대표 휴대전화, is_not:1"); break; // 회원상태목록 // 회원상태목록 case 'status': if (!empty($val)) { $tmp = array_unique(getStr($val)); if (is_array($tmp)) { $data[$key] = "[" . implode("][", $tmp) . "]"; } } break; // 그룹이름 태그처리 // 그룹이름 태그처리 case 'name': // str($data[$key], 'encode'); break; // 기본(단일필드) // 기본(단일필드) default: // tmp 값 제외 if (preg_match("/^tmp_/i", $key)) { unset($data[$key]); } // 배열 값 제외 if (is_array($val)) { __error("[{$key}] 값은 허용되지 않습니다"); } // 존재하지 않는 필드일 때 빼기 if (!inStr($key, $col)) { unset($data[$key]); } // 권한 if (preg_match("/permit_/i", $key) && $val && count(getStr($val)) > 1) { $data[$key] = "[" . implode("][", array_unique(getStr($val))) . "]"; } } } }
/** 자료 비밀번호 일치여부 확인 * @class io * @param $data: 자료 데이터 $move: 비밀번호 입력 이동 여부 $error: 모드 지정 * @return Boolean */ function checkPass($data, $move = 0, $error = '') { global $mini; iss($_REQUEST['id']); iss($_REQUEST['group']); iss($_REQUEST['no']); iss($_REQUEST['pass_encode']); if (!empty($mini['member']['level_admin'])) { return true; } if (!empty($data['target_member']) && empty($mini['log'])) { __error('로그인이 필요합니다'); } if (!empty($data['target_member']) && !empty($mini['log']) && $data['target_member'] != $mini['member']['no']) { __error('권한이 없습니다'); } if (empty($data['target_member'])) { if (empty($_REQUEST['pass_encode'])) { if ($move) { $url = preg_match("/^upload\\./i", $mini['filename']) && !empty($_REQUEST['pageURL']) ? $_REQUEST['pageURL'] : url(); if (!empty($_REQUEST['iframe'])) { $url = ''; } __error(array('mode' => !empty($error) ? $error : 'goto' . (!empty($_REQUEST['iframe']) ? '.parent' : ''), 'url' => "pass.php?id={$_REQUEST['id']}&group={$_REQUEST['group']}&url={$url}")); } else { __error('권한이 없습니다'); } } else { if ($_REQUEST['pass_encode'] != md5("{$data['pass']}|{$mini['ip']}|" . session_id())) { __error("비밀번호가 일치하지 않습니다"); } } } return false; }
/** 메일 보내기 * @class notification * @param -mode: 메일 보내는 방법 (auto) #auto 자동인식 #text #html #both -file: 첨부파일, array 가능, _FILES array 를 넘겨야 함 -ment: 내용 -title: 제목 -from_name: 보내는사람 이름 -from_mail: 보내는사람 메일 -to_name: 받는사람 이름 -to_mail: 받는사람 메일 -error_mail: 에러났을때 받을메일 -is_base: base64사용 -is_socket: socket 전송 사용 -socket_host: -socket_port: * @return */ function send_mail($param) { global $mini; $param = param($param); def($param['mode'], 'auto'); def($param['is_base'], '1'); def($param['is_socket'], '1'); $header = $type = $ment_file = ''; $eof = "\r\n"; $param['ment'] = trim($param['ment']); $param['title'] = trim($param['title']); $title = $param['title']; // 인코딩 if ($param['is_base']) { if ($param['to_name']) { $param['to_name'] = "=?{$mini['set']['lang']}?B?" . base64_encode($param['to_name']) . "?= "; } if ($param['from_name']) { $param['from_name'] = "=?{$mini['set']['lang']}?B?" . base64_encode($param['from_name']) . "?= "; } if ($param['title']) { $param['title'] = "=?{$mini['set']['lang']}?B?" . base64_encode($param['title']) . "?="; } else { $param['title'] = 'No.title'; } } if (!empty($param['file'])) { foreach ($param['file'] as $key => $val) { if ($val['size']) { $fp = fopen($val['tmp_name'], "rb"); if ($fp) { $ment_file .= "{$eof}--------------010504050703010207050203{$eof}"; $ment_file .= "Content-Type: application/octet-stream; charset={$mini['set']['lang']}{$eof}"; $ment_file .= "Content-Transfer-Encoding: base64{$eof}"; if ($param['is_base']) { $ment_file .= "Content-Disposition: attachment; filename=\"=?{$mini['set']['lang']}?B?" . base64_encode($val['name']) . "?=\"{$eof}{$eof}"; } else { $ment_file .= "Content-Disposition: attachment; filename=\"{$val['name']}\"{$eof}{$eof}"; } $ment_file .= trim(chunk_split(base64_encode(fread($fp, $val['size'])))); fclose($fp); $param['mode'] = 'both'; } } } } // 자동 선택 if ($param['mode'] == 'auto') { if (eregi("^\\<", $param['ment'])) { $param['mode'] = 'html'; } elseif (strpos($param['ment'], '<') !== false) { $param['mode'] = 'both'; } else { $param['mode'] = 'text'; } } switch ($param['mode']) { case 'text': $type = "text/plain"; break; case 'html': $type = "text/html"; break; case 'both': $type = "multipart/mixed"; //$param['ment'] = nl2br($param['ment']); //$param['ment'] = chunk_split(trim($param['ment'])); break; default: __error('send_mail 함수 mode 값 에러'); } //// 헤더 정보 생성 $header .= "Return-Path: {$param['from_mail']}{$eof}"; // 리턴 if (!empty($param['is_notice'])) { $header .= "Disposition-Notification-To: <{$param['from_mail']}>{$eof}"; } // 수신확인 $header .= "Date: " . date("D, j M Y H:i:s O") . "{$eof}"; // 시간 $header .= "From: {$param['from_name']}<{$param['from_mail']}>{$eof}"; // 보내는사람 $header .= "MIME-Version: 1.0{$eof}"; $header .= "X-Mailer: the M Mailer beta{$eof}"; if (!empty($param['error_mail'])) { $header .= "Errors-To: <{$param['error_mail']}>{$eof}"; } $header .= "Content-Type: {$type}"; //$header .= "To: {$param['to_name']}<{$param['to_mail']}>{$eof}"; // 보내는사람 //$header .= "Subject: {$param['title']}{$eof}"; if ($param['mode'] == 'both') { $header .= ";{$eof} boundary=\"------------010504050703010207050203\"{$eof}"; } else { $header .= "; charset={$mini['set']['lang']}{$eof}"; $header .= "Content-Transfer-Encoding: 8bit{$eof}"; } $header .= "Status:"; $ment_tmp = ''; if ($param['mode'] == 'both') { $ment_tmp .= "This is a multi-part message in MIME format.{$eof}"; } else { $ment_tmp .= $param['ment'] . $eof; } // 복합 출력 if ($param['mode'] == 'both') { $ment_tmp .= "--------------010504050703010207050203{$eof}"; $ment_tmp .= "Content-Type: text/html; charset={$mini['set']['lang']}{$eof}"; $ment_tmp .= "Content-Transfer-Encoding: 8bit{$eof}{$eof}"; if ($param['ment']) { $ment_tmp .= $param['ment'] . $eof . $eof; } if ($ment_file) { $ment_tmp .= $ment_file; } //$ment_tmp .= "--------------20070101--{$eof}"; } if (!$param['is_socket']) { return mail($param['to_mail'], $param['title'], $ment_tmp, $header); } else { if (!empty($mini['set']['socket_host'])) { def($param['socket_host'], $mini['set']['socket_host']); } if (!empty($mini['set']['socket_port'])) { def($param['socket_port'], $mini['set']['socket_port']); } def($param['socket_host'], ini_get("SMTP")); def($param['socket_port'], ini_get("smtp_port")); $fp = @fsockopen($param['socket_host'], $param['socket_port'], $errno, $errstr, 5); if ($fp) { $rcv = fgets($fp, 1024); fputs($fp, "HELO {$_SERVER['SERVER_NAME']}{$eof}"); $rcv = fgets($fp, 1024); fputs($fp, "MAIL FROM:{$param['from_mail']}{$eof}"); $rcv = fgets($fp, 1024); fputs($fp, "RCPT TO:{$param['to_mail']}{$eof}"); $rcv = fgets($fp, 1024); fputs($fp, "DATA{$eof}"); fputs($fp, "Subject: {$param['title']}{$eof}"); fputs($fp, "{$header}{$eof}{$eof}"); fputs($fp, "{$ment_tmp}{$eof}"); fputs($fp, ".{$eof}"); $rcv = fgets($fp, 1024); fputs($fp, "QUIT{$eof}"); fclose($fp); return 1; } else { return 0; } } }
/** * 입력 변수 체크 - 게시판 * @class admin.board * @param $data: 자료 */ function checkFieldBoard(&$data) { global $mini; if (!is_array($data)) { __error("입력된 데이터가 없습니다"); } // DB 컬럼 로드 iss($col); $col = getColumns($mini['name']['admin']); foreach ($data as $key => $val) { switch ($key) { // 삭제 설정 case 'date': case 'no': case 'dir': unset($data[$key]); break; // 그룹연결 // 그룹연결 case 'site_link': if (is_array($val)) { $data[$key] = "[" . implode("][", $val) . "]"; } break; // 카테고리 // 카테고리 case 'category': if (is_array($val)) { foreach ($val as $key2 => $val2) { check($val2['no'], 'type:num, name: 카테고리번호'); check($val2['depth'], 'type:num, name: 카테고리단계, is_not:1'); check($val2['name'], 'name: 카테고리이름'); str($data[$key][$key2]['name'], 'encode'); } $data[$key] = serialize($data[$key]); } else { __error('카테고리 형식이 올바르지 않습니다'); } break; // 추가필드 // 추가필드 case 'field': if (is_array($val)) { str($data[$key], 'encode'); $data[$key] = serialize($data[$key]); } else { __error('추가필드 형식이 올바르지 않습니다'); } break; // 옵션 // 옵션 case 'options': if (is_array($val)) { str($data[$key], 'encode'); $data[$key] = serialize($data[$key]); } else { __error('스킨옵션 형식이 올바르지 않습니다'); } break; // 단축키 // 단축키 case 'key_map': if (is_array($val)) { str($data[$key], 'encode'); $data[$key] = serialize($data[$key]); } else { __error('단축키 형식이 올바르지 않습니다'); } break; // 기본(단일필드) // 기본(단일필드) default: // tmp 값 제외 if (preg_match("/^tmp_/i", $key)) { unset($data[$key]); } // 배열 값 제외 if (is_array($val) && !preg_match("/^(config)\$/", $key)) { __error("[{$key}] 값은 허용되지 않습니다"); } // 존재하지 않는 필드일 때 빼기 if (!inStr($key, $col)) { unset($data[$key]); } // 권한 if (preg_match("/permit_/i", $key) && $val && count(getStr($val)) > 1) { $data[$key] = "[" . implode("][", array_unique(getStr($val))) . "]"; //__error($data[$key]); } break; } } }
$core->setBlog($_SESSION['sess_blog_id']); if (!$core->blog->id) { throw new Exception('Permission denied.'); } } elseif ($core->auth->sessionExists()) { # If we have a session we launch it now try { if (!$core->auth->checkSession()) { # Avoid loop caused by old cookie $p = $core->session->getCookieParameters(false, -600); $p[3] = '/'; call_user_func_array('setcookie', $p); http::redirect('auth.php'); } } catch (Exception $e) { __error(__('Database error'), __('There seems to be no Session table in your database. Is Dotclear completly installed?'), 20); } # Check nonce from POST requests if (!empty($_POST)) { if (empty($_POST['xd_check']) || !$core->checkNonce($_POST['xd_check'])) { http::head(412); header('Content-Type: text/plain'); echo 'Precondition Failed'; exit; } } if (!empty($_REQUEST['switchblog']) && $core->auth->getPermissions($_REQUEST['switchblog']) !== false) { $_SESSION['sess_blog_id'] = $_REQUEST['switchblog']; if (isset($_SESSION['media_manager_dir'])) { unset($_SESSION['media_manager_dir']); }
__error("target folder {$targetfolder} does not exist"); return 1; } _debug("target folder is {$targetFolder}"); $tempFile = $_FILES['Filedata']['tmp_name']; $targetFile = rtrim($targetFolder, '/') . "/" . $_FILES['Filedata']['name']; // you may want to do some additional checks on the uploaded files // here. if (file_exists($targetFile)) { __error("target file {$targetFile} already exists!"); return 1; } // We do not allow to upload files matching the // global $no_access pattern. See _config/conf.php for details. if (matches_noaccess_pattern($targetFile)) { __error("file {$targetFile} matches \$no_access pattern ({$no_access})"); return 1; } move_uploaded_file($tempFile, $targetFile); echo '1'; /** TODO: - currently, the implementation only works if the user has configured the same home directory like given in the global configuration as "home_dir", since we have no access to the session for authenticating the user. Notes: - We don't want to pass the absolute directory to the home directory by a post variable. This enables everybody to move a file from a random location on the server to any other location.
/** 코멘트 목록 뽑기 * @class io * @param -name: 검색배열이름 (list_cmt) -id: 게시판아이디, board_data가 있으면 없어도 된다 -page: 페이지 (마지막페이지) -target_post: 대상게시물번호. view가 있으면 없어도 된다 $board_data: 게시판정보 $view: 게시물정보 * @return Array */ function getListCmt($param, $board_data = '', $view = '') { global $mini; $param = param($param); $output = array(); iss($param['page']); def($param['name'], 'list_cmt'); def($_REQUEST['cPage'], $param['page']); def($_REQUEST['cPage'], 999999999999); //// 게시판정보 if (empty($board_data) && !empty($param['id'])) { getBoard($param['id']); if (empty($mini['site']) || $mini['site']['no'] != $mini['board']['site']) { getSite($mini['board']['site']); } } else { if (empty($board_data) && !empty($mini['board'])) { $board_data = $mini['board']; } } //// 게시물정보 if (empty($view)) { $view = sql("SELECT * FROM {$board_data['table']} WHERE no={$param['target_post']}"); if (!is_array($view)) { __error('게시물이 존재하지 않습니다' . ' (' . __FILE__ . ' line ' . __LINE__ . ' in ' . __FUNCTION__ . ')'); } parsePost($view); $output['view'] = $view; } else { $param['target_post'] = $view['no']; } $is_comment_page = !empty($board_data['use_comment_page']) && !empty($board_data['list_count_comment']) ? 1 : 0; if (!$is_comment_page) { $board_data['list_count_comment'] = 9999999; } //// 공지사항 제외 $is_first = 0; if ($is_comment_page || empty($_REQUEST['cQuick']) && empty($_REQUEST['cS']) && empty($_REQUEST['cSort'])) { $_REQUEST['cS']['notice!'] = 0; $is_first = 1; } $_REQUEST['cAnd'] = 1; //// 검색 처리 setSearch("\n\t\t\tname: {$param['name']}\n\t\t\tquickName: cQuick\n\t\t\tsName: cS\n\t\t\tandName: cAnd\n\t\t\tis_simple: 1\n\t\t"); //// 기본 검색쿼리 지정 check($param['target_post'], 'type:num, name:게시물번호'); $tmp_trackback = !empty($board_data['use_trackback_cmt']) ? '' : " and trackback=''"; $mini['list'][$param['name']]['where'] = !empty($mini['list'][$param['name']]['where']) ? $mini['list'][$param['name']]['where'] . " and target_post={$param['target_post']}{$tmp_trackback}" : "WHERE target_post={$param['target_post']}{$tmp_trackback}"; //// 공지사항 로드 if ($is_first) { $notice = sql("q:SELECT * FROM {$board_data['table_cmt']} WHERE notice=1 and target_post={$param['target_post']} ORDER BY num, mode:array"); $output['notice'] = $notice; } //// 정렬 처리 setSort("\n\t\t\tname: {$param['name']}\n\t\t\tsortName: cSort\n\t\t\ttable: {$board_data['table_cmt']}\n\t\t\torder: ORDER BY num, reply\n\t\t\torder_desc: ORDER BY num DESC, reply ASC\n\t\t"); //// 리스트 $data = getList("\n\t\t\tname: {$param['name']}\n\t\t\tlist: {$board_data['list_count_comment']}\n\t\t\ttable: {$board_data['table_cmt']}\n\t\t\tpageName: cPage\n\t\t\tdivName: cDiv\n\t\t\tstartName: cStart\n\t\t"); $output['data'] = $data; // pr($mini['list'][$param['name']]); //// 트랙백 같이 뽑기 /* $t_data = array(); if (!empty($board_data['use_trackback_cmt'])) { $t_data = sql("q:SELECT * FROM {$board_data['table_cmt']} WHERE target_post={$view['no']} and trackback!='' ORDER BY num, mode:array"); $output['data'] = array_merge($t_data, $output['data']); unset($t_data); } */ //// 트랙백 따로 뽑기 if ($is_first && empty($board_data['use_trackback_cmt'])) { $t_data = sql("q:SELECT * FROM {$board_data['table_cmt']} WHERE target_post={$view['no']} and trackback!='' ORDER BY num, mode:array"); $output['trackback'] = $t_data; } return $output; }
/** 파일 업로드 * @class file * @param -target: $_FILES 중에서 하나만 지정한 key값 -filename: 파일명 강제지정 -is_copy: copy를 사용한다 * @return Array 성공한 _FILES 배열 */ function uploadFile($param = '') { global $mini, $_FILES; iss($param); $param = param($param); iss($param['target']); iss($success); def($param['is_copy'], 0); foreach ($_FILES as $key => $val) { //// 타겟 체크 if ($param['target'] && $param['target'] != $key) { continue; } //// 파일명 강제지정 if (!empty($param['filename']) && !empty($val['path'])) { $val['path'] = dirname($val['path']) . '/' . $param['filename']; $val['name_insert'] = $param['filename']; } //// 파일 업로드 if (!empty($val['path'])) { if ($param['is_copy']) { $result = copy($val['tmp_name'], $val['path']); } else { $result = move_uploaded_file($val['tmp_name'], $val['path']); } if ($result) { $success[] = $val; } else { foreach ($success as $val2) { @unlink($val2['path']); } __error("[{$val['tmp_name']}] 파일 업로드에 실패했습니다"); } } } return $success; }
/** * 로그인 * @class login * @param $data: POST array -site: 그룹번호 -board: 게시판번호 -is_passed: 무조건로그인[0!|1] */ function setLogin(&$data, $param) { global $mini; $param = param($param); iss($data['uid']); iss($data['pass']); iss($data['pass_encode']); iss($data['autologin']); iss($mini['set']['use_login_session']); iss($pass_after); iss($key_login); iss($autologin_after); def($mini['this']['script'], $_REQUEST['script']); def($mini['this']['script'], 'back'); def($mini['set']['lock_login'], 5); def($param['is_passed'], 0); $site_data = $board_data = array(); $site = ''; if (empty($param['site'])) { __error('선택된 그룹이 없습니다.' . ' (' . __FILE__ . ' line ' . __LINE__ . ' in ' . __FUNCTION__ . ')'); } //// 그룹 로드 if (!empty($mini['site']) && $mini['site']['no'] == $param['site']) { $site_data = $mini['site']; } else { $site_data = getSite($param['site'], 1); } //// 게시판 로드 if (!empty($param['board'])) { if (!empty($mini['board']) && $mini['board']['no'] == $param['board']) { $board_data = $mini['board']; } else { $board_data = getBoard($param['board'], 1); } } else { if (!empty($mini['board']['site']) && $mini['board']['site'] == $site_data['no']) { $board_data = $mini['board']; } } //// 변수 검사 check($data['uid'], "name: 아이디"); if (!$param['is_passed']) { check($data['pass_encode'], "type:id, name:암호화된 비밀번호, min:16, max:40"); } if (!isset($site_data)) { __error('선택된 그룹이 없습니다.'); } $data['uid'] = mysql_escape_string($data['uid']); //// 미니아이 로그인 if (preg_match("/^\\@/", $data['uid'])) { __error('준비중 입니다.'); } else { $site = "[{$site_data['no']}]"; // 그룹의 그룹연결 if (!empty($site_data['site_link'])) { $site .= $site_data['site_link']; } // 게시판의 그룹연결 if (!empty($board_data['site_link'])) { $site .= $board_data['site_link']; } } //// 데이터 로드 $tmp_data = sql("q:SELECT * FROM {$mini['name']['member']} WHERE uid='{$data['uid']}', mode:array"); //// 아이디 확인 if (!is_array($tmp_data)) { __error('일치하는 회원이 없습니다'); } //// 그룹 확인 $check = 0; foreach ($tmp_data as $key => $val) { if (inStr($val['site'], $site) || count(array_intersect(getStr($site), getStr($val['site_link']))) || inStr('god', $val['admin']) || inStr('admin', $val['admin'])) { $check = 1; $data_ex = $val; } } if (!$check) { __error('일치하는 회원이 없습니다'); } //// 컨버팅 회원 확인 if (preg_match("/^\\!/", $data_ex['pass'])) { if (!empty($mini['complete']['ajax'])) { __complete(array('mode' => 'ajax,reload.parent', 'script' => "window.open(\"{$mini['dir']}login.conv.php?no={$data_ex['no']}\", \"conv\", \"width=400, height=400, scrollbars=2\");")); } else { __complete(array('mode' => 'move', 'url' => "{$mini['dir']}login.conv.php?no={$data_ex['no']}")); } } //// 실패 회수 확인 if ($data_ex['lock_login'] >= $mini['set']['lock_login'] && $data_ex['no'] != 1) { __error("로그인을 {$mini['set']['lock_login']}회 이상 실패하여 아이디가 잠겼습니다. 관리자에게 문의하세요"); } //// 비밀번호 확인 if (!$param['is_passed'] && $data['pass_encode'] != md5("{$data_ex['pass']}|{$mini['ip']}|" . session_id())) { if ($data_ex['pass'] == 'reset!') { __error('비밀번호가 초기화 되었습니다. 아이디/비밀번호 찾기를 통해 새 비밀번호로 설정해 주세요'); } sql("UPDATE {$mini['name']['member']} SET lock_login = lock_login + 1 WHERE no={$data_ex['no']}"); addLog("\n\t\t\t\tmode: login_lock_login\n\t\t\t\ttarget_member: {$data_ex['no']}\n\t\t\t\tfield1: {$data_ex['lock_login']}\n\t\t\t"); __error("비밀번호가 일치하지 않습니다 (" . ($data_ex['lock_login'] + 1) . "회 오류)"); } //// 암호화 // 자동 로그인 if ($data['autologin']) { $pass_after = ''; $key_login = md5($mini['date']); $autologin_after = md5("{$data_ex['pass']}|{$mini['ip']}|{$key_login}"); $interval = time() + 2592000; // 30 days after } else { $pass_after = md5("{$data_ex['pass']}|{$mini['ip']}"); $key_login = $autologin_after = ''; $interval = 0; } //// 굽기 // 세션 if ($mini['set']['use_login_session']) { $_SESSION['m_no'] = $data_ex['no']; $_SESSION['m_pass'] = $pass_after; } else { setcookie("m_no", $data_ex['no'], $interval, '/'); setcookie("m_pass", $pass_after, $interval, '/'); } // 자동로그인 if ($data['autologin']) { setcookie("m_no", $data_ex['no'], $interval, '/'); setcookie("m_autologin", $autologin_after, $interval, '/'); } else { setcookie("m_autologin", '', 0, '/'); } //// 로그인 기록 추가 def($mini['set']['login_history_count'], 10); $data_ex['history_login'] .= "{$mini['ip']}|{$mini['date']}\n"; $tmp = explode("\n", $data_ex['history_login']); if (count($tmp) > $mini['set']['login_history_count']) { unset($tmp[0]); } $data_ex['history_login'] = is_array($tmp) ? implode("\n", $tmp) : ""; //// 로그인 포인트 설정 if (!empty($site_data['point_login'])) { if (!sql("SELECT COUNT(*) FROM {$mini['name']['log']} WHERE mode='point' and target_member={$data_ex['no']} and field3='로그인' and date >= '" . date("Y/m/d 00:00:00", $mini['time']) . "'")) { setPoint("\n\t\t\t\t\ttarget: {$data_ex['no']}\n\t\t\t\t\tmsg: 로그인\n\t\t\t\t\tpoint: {$site_data['point_login']}\n\t\t\t\t"); } } //// 다중 자동로그인 설정 //+ 정식버젼에서 지울 구문임 if (!empty($data_ex['ip']) && strpos($data_ex['ip'], '[') === false) { $data_ex['ip'] = "[{$data_ex['ip']}]"; } if (!empty($data_ex['key_login']) && strpos($data_ex['key_login'], '[') === false) { $data_ex['key_login'] = "******"; } if (empty($key_login)) { $key_login = '******'; } // 입력 $data_ex['ip'] .= "[{$mini['ip']}]"; $data_ex['key_login'] .= "[{$key_login}]"; // 3개 한정 $arr_ip = getStr($data_ex['ip']); if (count($arr_ip) > 5) { unset($arr_ip[0]); $data_ex['ip'] = "[" . implode("][", $arr_ip) . "]"; } $arr_key_login = getStr($data_ex['key_login']); if (count($arr_key_login) > 5) { unset($arr_key_login[0]); $data_ex['key_login'] = "******" . implode("][", $arr_key_login) . "]"; } //// DB수정 sql("UPDATE {$mini['name']['member']} SET ip='{$data_ex['ip']}', date_login='******'date']}', key_login='******'key_login']}', lock_login=0, count_login=count_login+1, history_login='******'history_login']}' WHERE no={$data_ex['no']}"); }
/** 최근게시물 * @class io * @param -id: 게시판아이디 -table: 임의지정테이블 -mode: 최근게시물모드 [!|issue|writer|relate|popup|memo] -order: 임의정렬쿼리 -where: 임의검색쿼리 -count: 출력수 -cut_title: 제목길이 -cut_ment: 내용길이 -skin: 게시물 스킨 -skin_not: 게시물이 없을 떄 스킨 -skin_first: 첫 게시물 스킨 -debug: debug모드 -is_key: 키테이블 사용여부 -type: 종류 [post!|cmt|memo|member] * @return Array 스킨이 있을 경우엔 리턴 안됨 */ function mhot($param) { global $mini; $param = param($param); def($param['cut_title'], 0); def($param['cut_ment'], 0); def($param['count'], 5); def($param['type'], 'post'); // 설정 기본값 def($mini['setting']['issue_interval'], 48); if (preg_match("/[^0-9]/", $mini['setting']['issue_interval'])) { $mini['setting']['issue_interval'] = 48; } if (preg_match("/[^0-9\\,]/", $param['count'])) { __error('출력개수에는 숫자와 ,만 입력 가능합니다' . ' (' . __FILE__ . ' line ' . __LINE__ . ' in ' . __FUNCTION__ . ')'); } if ($param['count'] > 100) { __error('출력개수는 100개를 초과할 수 없습니다' . ' (' . __FILE__ . ' line ' . __LINE__ . ' in ' . __FUNCTION__ . ')'); } $where = $order = $board_data = $table = ''; $data = $sel_board = array(); // 복수 게시판 지정(keyTable 이 사용된다) if (!empty($param['id']) && (strpos($param['id'], '[') !== false || $param['id'] == '*')) { $is_multi = 1; // 게시판 나눠넣기 if (strpos($param['id'], '[') !== false) { $sel_board = getStr($param['id']); } } // 테이블 임의지정 if (!empty($param['table'])) { $table = $param['table']; } // 키테이블 지정 if (!empty($param['is_key'])) { $table = $mini['name']['search']; } // 아이디로 테이블 지정 if (!$table && !empty($param['id']) && $param['id'] != '*') { if (!empty($mini['board']) && !empty($mini['board']['id']) && $mini['board']['id'] == $param['id']) { $board_data =& $mini['board']; } else { $board_data = getBoard($param['id'], 1); } $table = $param['type'] == 'post' ? $board_data['table'] : $board_data['table_cmt']; } // 키테이블인데 글, 댓글이 아닐 경우 에러 if (!empty($param['is_key']) && $param['type'] != 'post' && $param['type'] != 'cmt') { __error('검색테이블을 참조할 때는 글, 댓글 형식만 사용하실 수 있습니다' . ' (' . __FILE__ . ' line ' . __LINE__ . ' in ' . __FUNCTION__ . ')'); } // 특별 모드 if (!empty($param['mode'])) { switch ($param['mode']) { case 'issue': $where .= " and (issue=1 or (date>=DATE_ADD('{$mini['date']}', INTERVAL -{$mini['setting']['issue_interval']} HOUR) and date<=DATE_ADD('{$mini['date']}', INTERVAL 1 DAY)))"; $order .= ",issue*999999 + hit + vote*10 desc"; break; case 'writer': if (empty($mini['setting']['writer_no'])) { return 0; } $where .= " and target_member={$mini['setting']['writer_no']}"; $order .= ",no desc"; break; case 'relate': if (empty($mini['setting']['relate'])) { return 0; } $where .= " and " . sqlSel(explode(",", $mini['setting']['relate'])); $order .= ",no desc"; break; case 'popup': $where .= " and popup=1"; $order .= ",no desc"; break; case 'memo': $table = $mini['name']['memo']; $param['count'] = 20; $param['type'] = 'memo'; if (!empty($mini['log'])) { $where .= " and target_member={$mini['member']['no']} and date_read=0 and del_target=0"; $order .= ",no"; } break; } } // 여러 테이블 검색시 게시판 정보 로드 및 쿼리 설정 if (!empty($is_multi)) { $q_admin = ''; if (!empty($param['id']) && !empty($sel_board)) { $q_admin .= 'WHERE ' . sqlSel($sel_board); // $where .= " and ".sqlSel($sel_board, 'id'); } $data_board = sql("\n\t\t\tq: SELECT * FROM {$mini['name']['admin']} {$q_admin}\n\t\t\tmode: array\n\t\t"); $board_name = $board_data_arr = array(); if (!empty($data_board)) { foreach ($data_board as $key => $val) { $board_name[$val['no']] = $val['name']; parseBoard($val); $board_data_arr[$val['no']] = $val; } unset($data_board); } } // 키 테이블 검색시 종류에 따라 쿼리 설정 if (!empty($param['is_key'])) { $where .= $param['type'] == 'post' ? " and cmt_no=0" : " and cmt_no!=0"; } // 테이블명이 지정되지 않았다면 에러 if (empty($param['id']) && empty($param['table']) && empty($table)) { __error('게시판 아이디나 테이블명을 입력해주세요' . ' (' . __FILE__ . ' line ' . __LINE__ . ' in ' . __FUNCTION__ . ')'); } // 임의 설정 추가 if (!empty($param['where'])) { if (!preg_match("/^ ?(and|or)/i", $param['where'])) { $param['where'] = " and ({$param['where']})"; } $where .= $param['where']; } if (!empty($param['order'])) { if (!preg_match("/^\\,/i", $param['order'])) { $param['order'] = ",{$param['order']}"; } $order .= $param['order']; } else { if (empty($order)) { $order = ",date desc"; } } // 쪽지인데 로그인이 안되어 있다면 넘김 if (!empty($param['mode']) && $param['mode'] == 'memo' && empty($mini['log'])) { return false; } else { // 쿼리날림 if ($where) { $where = "WHERE " . substr($where, 4); } if ($order) { $order = "ORDER BY " . substr($order, 1); } // 복수 게시판일 경우 if (!empty($is_multi)) { // 전체 게시판일 때 if (empty($sel_board) && $param['id'] == '*') { $sel_board = array_keys($board_data_arr); } if (!empty($sel_board)) { $tmp_data = array(); $tmp_data_order = array(); $order_name = $order_type = ''; $order_data = array(); $data = array(); // order 분석 if (count(explode(",", $order)) > 1) { __error('정렬 기준은 한개만 가능합니다' . ' (' . __FILE__ . ' line ' . __LINE__ . ' in ' . __FUNCTION__ . ')'); } $tmp_order = explode(" ", str_replace("ORDER BY ", "", $order)); $order_name = $tmp_order[0]; $order_type = empty($tmp_order[1]) ? 'asc' : $tmp_order[1]; unset($tmp_order); foreach ($sel_board as $val) { // 키테이블 사용시 if (!empty($param['is_key'])) { $tmp_where = !empty($where) ? $where . " and id={$val}" : "WHERE id={$val}"; $table = $mini['name']['search']; } else { $tmp_where = $where; $table = $param['type'] == 'post' ? $mini['name']['board'] . $val : $mini['name']['cmt'] . $val; } $tmp_data = array_merge($tmp_data, sql(array('q' => "SELECT * FROM {$table} {$tmp_where} " . (!empty($param['is_key']) ? "GROUP BY num" : "") . " {$order} LIMIT {$param['count']}", 'mode' => 'array', 'extra_name' => 'id', 'extra_value' => $val))); } // 정렬 기준에 따라서 나눔 foreach ($tmp_data as $key => $val) { $order_data[$key] = $val[$order_name]; } // 정렬 if ($order_type == 'asc') { asort($order_data); } else { arsort($order_data); } // 정렬한 순서대로 data 정의 $i = 0; foreach ($order_data as $key => $val) { if ($i >= $param['count']) { break; } $data[$i] = $tmp_data[$key]; ++$i; } unset($tmp_data); unset($order_data); } } else { $data = sql(array('q' => "SELECT * FROM {$table} {$where} " . (!empty($param['is_key']) ? "GROUP BY num" : "") . " {$order} LIMIT {$param['count']}", 'mode' => 'array')); } if (!empty($data)) { $a = 0; $count_data = count($data); foreach ($data as $key => $val) { // 여러 게시판 사용시 게시판 정보 입력 if (!empty($is_multi)) { if (!empty($board_name[$data[$key]['id']])) { $data[$key]['board_name'] = $board_name[$data[$key]['id']]; } if (!empty($data[$key]['id'])) { $data[$key]['url_board'] = "{$mini['dir']}mini.php?id={$data[$key]['id']}"; } if (!empty($board_data_arr)) { $mini['board_data'] = $board_data_arr[$data[$key]['id']]; } } else { $mini['board_data'] = $board_data; } if (!empty($param['is_key'])) { // 키 테이블 사용 시 진짜 자료 로드 $val2 = sql("SELECT * FROM " . (!empty($data[$key]['cmt_no']) ? $mini['name']['cmt'] : $mini['name']['board']) . "{$data[$key]['id']} WHERE " . (!empty($data[$key]['cmt_no']) ? "no={$data[$key]['cmt_no']}" : "num={$data[$key]['num']}")); $data[$key] = array_merge($data[$key], $val2); } // title 은 포함된 변수가 많기 때문에 먼저 잘라준다 if (!empty($param['cut_title']) && !empty($data[$key]['title'])) { $data[$key]['title'] = strCut($data[$key]['title'], $param['cut_title']); } // 가공 함수 실행 $tmp_func = "parse" . ($param['type'] == 'cmt' ? 'comment' : $param['type']); if ($count_data == 1) { $tmp_func($data[$key], 'view'); } else { $tmp_func($data[$key], ''); } // 내용 자르기 if (!empty($param['cut_ment']) && !empty($data[$key]['ment'])) { $data[$key]['ment'] = strCut($data[$key]['ment'], $param['cut_ment']); $data[$key]['ment_notag'] = strCut($data[$key]['ment_notag'], $param['cut_ment']); } // if (!empty($param['debug'])) { // echo nl2br(print_r($data[$key], 1)); // exit; // } if (!empty($param['skin'])) { $skin = ''; if ($a == 0 && !empty($param['skin_first'])) { $skin = $param['skin_first']; } else { $skin = $param['skin']; } // 논리문 $preg_left = $preg_right = array(); $preg_left[] = "/\\[:([a-z0-9_]+)\\.([a-z0-9_]+)\\.([a-z0-9_]+):\\]/ie"; $preg_right[] = "\$data[{$key}]['\\1']['\\2']['\\3']"; $preg_left[] = "/\\[:([a-z0-9_]+)\\.([a-z0-9_]+):\\]/ie"; $preg_right[] = "\$data[{$key}]['\\1']['\\2']"; $preg_left[] = "/\\[:([a-z0-9_]+):\\]/ie"; $preg_right[] = "\$data[{$key}]['\\1']"; $skin = preg_replace($preg_left, $preg_right, $skin); echo $skin; } $a++; } if (empty($param['skin'])) { if (count($data) == 1 && $param['count'] == 1) { return current($data); } else { return $data; } } } else { if (!empty($param['skin_not'])) { echo $param['skin_not']; } } } }
} if (!defined('DC_UPDATE_VERSION')) { define('DC_UPDATE_VERSION', 'stable'); } if (!defined('DC_ALLOW_MULTI_MODULES')) { define('DC_ALLOW_MULTI_MODULES', false); } l10n::init(); try { $core = new dcCore(DC_DBDRIVER, DC_DBHOST, DC_DBNAME, DC_DBUSER, DC_DBPASSWORD, DC_DBPREFIX, DC_DBPERSIST); } catch (Exception $e) { init_prepend_l10n(); if (!defined('DC_CONTEXT_ADMIN')) { __error(__('Site temporarily unavailable'), __('<p>We apologize for this temporary unavailability.<br />' . 'Thank you for your understanding.</p>'), 20); } else { __error(__('Unable to connect to database'), $e->getCode() == 0 ? sprintf(__('<p>This either means that the username and password information in ' . 'your <strong>config.php</strong> file is incorrect or we can\'t contact ' . 'the database server at "<em>%s</em>". This could mean your ' . 'host\'s database server is down.</p> ' . '<ul><li>Are you sure you have the correct username and password?</li>' . '<li>Are you sure that you have typed the correct hostname?</li>' . '<li>Are you sure that the database server is running?</li></ul>' . '<p>If you\'re unsure what these terms mean you should probably contact ' . 'your host. If you still need help you can always visit the ' . '<a href="http://forum.dotclear.net/">Dotclear Support Forums</a>.</p>') . (DC_DEBUG ? __('The following error was encountered while trying to read the database:') . '</p><ul><li>' . $e->getMessage() . '</li></ul>' : ''), DC_DBHOST != '' ? DC_DBHOST : 'localhost') : '', 20); } } # If we have some __top_behaviors, we load them if (isset($__top_behaviors) && is_array($__top_behaviors)) { foreach ($__top_behaviors as $b) { $core->addBehavior($b[0], $b[1]); } unset($b); } http::trimRequest(); try { http::unsetGlobals(); } catch (Exception $e) { header('Content-Type: text/plain'); echo $e->getMessage();