<?php if(!defined('__MAGIC__')) exit; $v = $this->Sql('fetch', $this->wr_no); echo Widget::Inst()->Parse( $this->TBN(), 'wr_no', $v['wr_no'], 'wr_content', Editor::Inst('', $this->Config('editor', 'name'))->db_out($v['wr_content']) ); ?> <?php if(Widget::Inst()->Config('is_page')) {?> <div class="center"><a href="<?php echo $this->Link('modify', $v['wr_no'])?>"><img src="<?php echo $this->path_img('btn_modify_page.gif')?>" alt="수정"/></a></div> <?php }?>
)->height($height )->html( ); $data = $v; ob_start(); include($this->path_view('write.php')); $v['content'] = ob_get_contents(); ob_end_clean(); } else { $v['content'] = Widget::Inst()->Parse( $this->TBN(), 'wr_no', $v['wr_no'], 'wr_content', Editor::Inst('', $this->Config('editor', 'name'))->db_out($v['wr_content']) ); if($v['wr_subject']) { if($v['wr_category']) $v['content'] = "<div class=\"{$v['wr_category']}\"></div>".$v['content']; $v['content'] = "<h2>{$v['wr_subject']}</h2>".$v['content']; } if(!$key && $mode!='write' && $this->Config('mb','admin') && Widget::Inst()->Config('is_page')) { $v['content'].= '<input class="order" type="hidden" name="order[]" value="'.$v['wr_no'].'"/>'; $v['href_modify'] = $this->Link('modify', $v['wr_no']); $v['href_delete'] = $this->Link('delete', $v['wr_no']); } } $this->list[$k] = $v; }
if (!defined("__MAGIC__")) { exit; } // 게시판 생성 if ($_POST['bo_no'] == '') { $data['bo_subject'] = GV::String('bo_subject'); $_POST['bo_no'] = Board::Inst()->Action('insert_record', $data); unset($_POST['bo_subject']); } if (!$_POST['list_view']) { $_POST['list_view'] = 0; } if (!$_POST['show_notice']) { $_POST['show_notice'] = 0; } if (!$_POST['use_comment']) { $_POST['use_comment'] = 0; } $data = Widget::Inst()->Action('data_implode', $_POST); $key = DB::Get()->InsertEx($this->TBN(), $data); if (!$key) { Dialog::Alert('정확한 정보를 입력하세요.'); } Widget::Inst()->Action('add_widget', $key); ?> <script> window.opener.location.reload(); window.close(); </script> <?php exit;
<?php if (!defined('__MAGIC__')) { exit; } $v = $this->view; if (!$v) { $v = Widget::Inst()->Action('data_explode', $this->wg_no); } if ($v['bo_no']) { echo Write::Inst($v['skin'], $v['bo_no'])->SetConfig('img_width', '', $v['img_width'])->SetConfig('cols', '', $v['cols'])->SetConfig('rows', '', $v['rows'])->SetConfig('list_view', '', $v['list_view'])->SetConfig('use_comment', '', $v['use_comment'])->SetConfig('show_notice', '', $v['show_notice'])->html(); }
<?php if (!defined("__MAGIC__")) { exit; } if ($_POST['bo_no'] == '') { $data['bo_subject'] = GV::String('bo_subject'); $_POST['bo_no'] = Board::Inst()->Action('insert_record', $data); unset($_POST['bo_subject']); } $_POST['columns'] = implode('|', $_POST['columns']); if (!$_POST['list_view']) { $_POST['list_view'] = 0; } if (!$_POST['show_notice']) { $_POST['show_notice'] = 0; } if (!$_POST['use_comment']) { $_POST['use_comment'] = 0; } $data = Widget::Inst()->Action('data_implode', $_POST); $key_name = $this->KN(); $key = GV::Number($key_name); DB::Get()->Update($this->TBN(), $data, "where {$key_name}='{$key}' "); ?> <script> window.opener.location.reload(); window.close(); </script> <?php exit;
<?php if (!defined("__MAGIC__")) { exit; } $table = array(); $table['widget'] = Widget::Inst()->Table();
$top_btns[10]['link'] = $m->Link('view'); if ($m->Action('is_admin')) { $top_btns[20]['title'] = '관리자'; $top_btns[20]['link'] = Path::admin(); if (Widget::Inst()->Config('is_page')) { $top_btns[21]['title'] = '페이지[ON]'; } else { $top_btns[21]['title'] = '페이지[OFF]'; } $top_btns[21]['link'] = Widget::Inst()->Config('link_page'); if (Widget::Inst()->Config('is_design')) { $top_btns[22]['title'] = '디자인[ON]'; } else { $top_btns[22]['title'] = '디자인[OFF]'; } $top_btns[22]['link'] = Widget::Inst()->Config('link_design'); } $top_btns[30] = array(); $top_btns[30]['title'] = '로그아웃'; $top_btns[30]['link'] = $m->Link('logout'); } else { $top_btns[10] = array(); $top_btns[10]['title'] = '로그인'; $top_btns[10]['link'] = $m->Link('login'); $top_btns[20] = array(); $top_btns[20]['title'] = '비밀번호 찾기'; $top_btns[20]['link'] = $m->Link('find_pw'); $top_btns[30] = array(); $top_btns[30]['title'] = '회원가입'; $top_btns[30]['link'] = $m->Link('regist'); }
if (!$data['skin']) { $data['skin'] = $view['skin']; } $this->data = $data; /* * 폼 업데이트 링크 생성 */ $key_name = $this->KN(); $key = GV::Number($key_name); $this->action = $this->Link('insert'); if ($key) { $this->action = $this->Link('update'); } /* * 게시판 스킨 목록 */ $skin_list = array(); $skin_list[] = array('name' => '최신글스킨선택'); foreach (Magic::Inst()->SkinList() as $v) { if ($data['skin'] == $v['skin']) { $v['selected'] = 'selected'; } $skin_list[] = $v; } $this->skin_list = $skin_list; /* * 하단 버튼 링크생성 */ $this->btn_ok = Widget::Inst()->path_img('btn_ok.gif'); $this->btn_cancel = Widget::Inst()->path_img('btn_cancel.gif');
<?php if (!defined('__MAGIC__')) { exit; } $page = $this->Action('fetch_page'); $contents = array_filter(explode(',', $page['m_contents'])); if (sizeof($contents) != 0) { $tbn = $this->TBN(); $key_name = $this->KN(); $key = $page[$key_name]; $field = 'm_contents'; /* * 컨텐츠의 위젯을 미리 html로 변환해 줌 * layout 결과를 받아서 하게되면 해당 위젯의 css,js가 인크루드 되지 못함 */ foreach ($contents as $k => $v) { $contents[$k] = Widget::Inst()->Parse($tbn, $key_name, $key, $field, $v, $k); } } echo Layout::Inst($page['m_layout'])->Contents($contents)->html();
public function Parse($tbn, $key_name, $key, $field, $content, $index = null) { /* * 위젯호출 문법 패턴 * [[Widget|503]] 이런식으로 된 문자열을 파싱함 */ $pattern = "/(\\[\\[Widget)([^\\]]*)(\\]\\])/"; /* * 위젯과 위젯이 아닌 문자열을 분리 * 나중에 분리된 문자열과 변환된 위젯 스킨을 합하여 반환함 */ $split = preg_split($pattern, $content); /* * 위젯구문을 구해낸다 * [2]파라미터에 위젯 번호또는 빈 내용이 들어있다. * 매치된 전체 문장: $match[0][$i] * $match[2][$i] - 내용 */ preg_match_all($pattern, $content, $match, PREG_PATTERN_ORDER); // 파싱 결과가 저장될 배열 $result_parse = array(); //$read_pos=0; /* * 매칭된 문장의 갯수만큼 루프를 돌면서 변환함 * 위젯이 설정되지 않았을 경우 : 링크로 스킨 변경 팝업창을 호출 하도록 함 * 위젯이 이미 설정되어 있는 경우 : 위젯 스킨을 호출하여 HTML로 출력해줌 */ for ($i = 0; $i < count($match[0]); $i++) { $wg_no = array_pop(explode('|', $match[2][$i])); //$read_pos += strlen($split[$i]); /* * 위젯 번호가 ?인 경우 * wg_no를 get으로 받아옴 */ if ($wg_no == '?') { $wg_no = GV::Number('wg_no'); } // 위젯 번호가 있을 경우 // 위젯 번호가 있지만 삭제된 경우 패스함 if (intval($wg_no) && Widget::Inst()->wg_no($wg_no)->Sql('fetch', $wg_no)) { // 페이지게시판 중첩으로 입력되었을 경우 if ($this->old != $wg_no) { $this->old = $wg_no; $result_parse[$i] = Widget::Inst()->wg_no($wg_no)->html(); } // 위젯 입력모드일 경우 } else { if (GV::String($this->Mode('name'))) { $result_parse[$i] = $this->html(); // 위젯 번호가 없을 경우 } else { if (Member::Inst()->Action('is_admin')) { $result_parse[$i] = '<a class="button popup ui-icon-plusthick" href="' . $this->Link('write', $index ? $index : $i, $tbn, $key_name, $key, $field) . '" width="618" height="400">위젯추가</a>'; } } } //$read_pos += strlen($match[0][$i]); } // 변환되어 저장될 결과값 $result = ''; /* * 파싱된 결과 값과 기존의 html을 합친다. * head는 가장 마지막에 html()함수가 호출되어야 모든 스크립트/스타일들이 인크루드 되기 때문에 * 이렇게 시간차를 두고 호출한다. */ foreach ($result_parse as $k => $v) { if (is_object($v)) { $v = $v->html(); } $result .= $split[$k] . $v; } // 마지막으로 남은 html을 합쳐줌 $result .= $split[$i]; return $result; }
function Insert($data, $key = array()) { $ret = array(); // $data의 마지막에 + 기호가 있다면 앞의 결과($key)와 합쳐서 반환함 if (strpos($data, '+') !== false) { $ret[] = $key[0]; $data = substr($data, 0, -1); } $_data = explode(':', $data); // 타입에 맞도록 데이터 입력 switch ($_data[0]) { case 'widget': // 위젯 입력 $_clear['wg_skin'] = $_data[1]; $_clear['wg_width'] = '100'; $_clear['wg_width_unit'] = '%'; if ($_data[1] == 'page') { $_clear['wg_param'] = 'wr_no=' . $key[0] . '[]editor=cheditor[]editor_width=100%[]editor_height=500px'; } else { if ($_data[1] == 'write') { if ($_data[2] == 'mobile') { $_clear['wg_param'] = 'skin=mbasic[]img_width=500[]rows=20[]columns=wr_datetime|wr_subject|wr_writer|wr_hit[]use_comment=1[]show_notice=1[]bo_no=' . $key[0]; } else { $_clear['wg_param'] = 'skin=basic[]img_width=500[]rows=20[]columns=wr_datetime|wr_subject|wr_writer|wr_hit[]use_comment=1[]show_notice=1[]bo_no=' . $key[0]; } } else { if ($_data[1] == 'webclip') { $_clear['wg_param'] = 'skin=' . $_data[2]; } } } $ret[] = DB::Get()->InsertEx(Widget::Inst()->TBN(), $_clear); break; case 'write': // 게시글 입력 파일이 있다면 파일 내용을, 없다면 받은 키 값으로 위젯호출 구문을 적어넣는다 $_path = __DIR__ . '/page/' . $_data[1]; if (is_file($_path)) { $contents = addslashes(implode('', file($_path))); } else { $contents = ''; rsort($key); foreach ($key as $v) { $contents .= '[[Widget|' . $v . ']]'; } } $_clear['bo_no'] = 0; $_clear['wr_subject'] = 'page'; $_clear['wr_content'] = $contents; $ret[] = DB::Get()->InsertEx(Write::Inst()->TBN(), $_clear); break; case 'board': // 게시판 입력 $_clear['bo_subject'] = $_data[1]; $_clear['bo_editor'] = 'cheditor'; $ret[] = DB::Get()->InsertEx(Board::Inst()->TBN(), $_clear); break; } return $ret; }
$top_btns = array(); if ($m->Action('is_login')) { $top_btns[10] = array(); $top_btns[10]['title'] = '회원페이지'; $top_btns[10]['link'] = $m->Link('view'); if ($m->Action('is_admin')) { $top_btns[20]['title'] = '관리자'; $top_btns[20]['link'] = Path::admin(); $top_btns[21]['link'] = Widget::Inst()->Config('link_page'); if (Widget::Inst()->Config('is_page')) { $top_btns[21]['title'] = '페이지수정[On]'; } else { $top_btns[21]['title'] = '페이지수정[Off]'; } $top_btns[22]['link'] = Widget::Inst()->Config('link_design'); if (Widget::Inst()->Config('is_design')) { $top_btns[22]['title'] = '위젯수정[On]'; } else { $top_btns[22]['title'] = '위젯수정[Off]'; } } $top_btns[30] = array(); $top_btns[30]['title'] = '로그아웃'; $top_btns[30]['link'] = $m->Link('logout'); } else { $top_btns[10] = array(); $top_btns[10]['title'] = '로그인'; $top_btns[10]['link'] = $m->Link('login'); $top_btns[20] = array(); $top_btns[20]['title'] = '비밀번호 찾기'; $top_btns[20]['link'] = $m->Link('find_pw');
*/ if (!$this->wgSkin && $this->wg_no) { $view = $this->Sql('fetch', $this->wg_no); $this->wgSkin = $view['wg_skin']; } /* * 위젯목록 */ $list = array(); $this->widget_list[0] = array(0 => array('link' => $this->Link('skin_cancel'), 'name' => '선택하세요')); foreach (Widget::Inst()->SkinList() as $v) { $v['link'] = $this->Link('skin', $v['skin']); $v['selected'] = $this->wgSkin == $v['skin'] ? 'selected' : ''; $list[] = $v; } $this->widget_list['기본'] = $list; $list = array(); foreach (Widget::Inst()->SkinList("관리자") as $v) { $v['link'] = $this->Link('skin', $v['skin']); $v['selected'] = $this->wgSkin == $v['skin'] ? 'selected' : ''; $list[] = $v; } $this->widget_list['관리자'] = $list; /* * 위젯수정 : 컨텐츠 */ if ($this->wgSkin) { $this->contents = Widget::Inst($this->wgSkin, $this->wg_no)->Html(); } else { $this->contents = '위젯을 선택하세요'; }
* version 1.0 * 사용자의 구미에 맞도록 초기설치 제어를 수행함 */ $cfg = array(); // 데이터베이스 정보 $cfg['dbinfo'] = array('host' => 'localhost', 'user' => '', 'password' => '', 'db' => '', 'prefix' => 'm3_'); // 관리자 정보 $cfg['admin_info'] = array('id' => 'admin', 'password' => '', 'password_confirm' => '', 'name' => '최고관리자'); // 홈페이지 기본정보 $cfg['hp_info'] = array('title' => '매직보드'); // data 폴더 목록 // '폴더명'=>'권한값' $cfg['data_folder'] = array(Path::data() => 0707, Path::data_file() => 0707, Path::data('cache') => 0707, Path::data('zmLog') => 0707, Path::data('zmLogConnect') => 0755, Path::data('cheditor') => 0707, Path::data_member() => 0707); // 설치 테이블 정보 // '테이블명'=>'설치모듈 인스턴스' $cfg['tables'] = array('magic' => Magic::Inst(), 'config' => Config::Inst(), 'write' => Write::Inst(), 'board' => Board::Inst(), 'file' => File::Inst(), 'comment' => Comment::Inst(), 'member' => Member::Inst(), 'tag' => Tag::Inst(), 'widget' => Widget::Inst()); /* * 메뉴구성 및 기본 컨텐츠 설정 $cfg['default_data'] = " kr:index =widget:page=write:index.html +메뉴얼:basic =widget:page=write=widget:webclip:sub_title+=widget:page ++영문홈페이지:basic =widget:page=write=widget:webclip:sub_title+=widget:page ++모바일홈페이지:basic =widget:page=write=widget:webclip:sub_title+=widget:page +게시판:basic =widget:page=write=widget:webclip:sub_title+=widget:page ++공지사항:basic =widget:page=write=widget:webclip:sub_title+=widget:write=board:공지 eng:index =widget:page=write:index.html +English Sample:basic =widget:page=write member:member
$wg_no = $this->wg_no; // 위젯번호 /* * 위젯번호가 있을 때 * 위젯 정보 얻어오기 */ if ($wg_no) { // 위젯정보 $view = $this->Sql('fetch', $wg_no); if ($view['wg_skin']) { $this->widget = Widget::Inst($view['wg_skin'], $wg_no)->html(); $this->widget_width = $view['wg_width'] . $view['wg_width_unit']; } // 디자인 모드일때 상단의 버튼 출력 $this->wg_buttons = array(); if ($this->Config('mb', 'admin') && $this->Config('is_design')) { // 해당위젯에서 정의한 버튼 $this->wg_buttons = Widget::Inst($view['wg_skin'], $view['wg_no'])->Config('button'); if (!is_array($this->wg_buttons)) { $this->wg_buttons = array(); } $config_path = Path::MB('skin/Widget/' . $view['wg_skin'] . '/config.php'); if (is_file($config_path)) { include $config_path; } // 기본버튼1 $this->wg_buttons[] = array('class' => 'ui-icon-wrench popup tp', 'href' => $this->Link('edit', $wg_no), 'width' => '100', 'height' => '100', 'title' => $skin['name'], 'name' => '위젯수정'); // 기본버튼2 $this->wg_buttons[] = array('class' => 'ui-icon-trash wg_delete no-text', 'href' => $this->Link('delete', $wg_no, Url::This()), 'name' => '위젯삭제'); } }