<th>보안이미지</th> <td> <input class='ed' type=input size=10 name=wr_key itemname="자동등록방지" required><img id='kcaptcha_image' /><span style="margin-left:85px">왼쪽의 글자를 입력하세요.</span> </td> </tr> <? } ?> <tr> <td colspan="2" style="text-align:center"> <? if($member['mb_id']) { ?> <span class="button green"><a href="#tmpsave" id="btn_tmpsave">임시저장</a></span> <? } ?> <span class="button red"><input type=submit id="btn_submit" value="완료" border=0 accesskey='s'></span> <span class="button"><a href="javascript:history.go(-1);" id="btn_back">뒤로</a></span> <span class="button"><a href="<?php echo wiki_url(); ?> " id="btn_list">시작페이지</a></span></td> </td> </tr> </table> </form> <script type="text/javascript" src="<?php echo $wiki['g4_url']; ?> /js/jquery.kcaptcha.js"></script> <script type="text/javascript"> <? // 관리자라면 분류 선택에 '공지' 옵션을 추가함
/** * * 위키 문서 링크 * * @param array $matches 매칭 결과 * @param array $params {@link NarinParser} 에서 전달하는 파라미터 * @return string 문서 링크 */ public function wiki_internal_link($matches, $params) { $doc = $matches[2].$matches[4]; $title = $matches[6]; $path = explode("/", $matches[4]); // 문서내 링크 if(preg_match("/^#/", $matches[4])) { if(!$title) $title = preg_replace("/^#/", "", $matches[4]); return sprintf( '<a href="%s" class="%s">%s</a>', $matches[4], "wiki_active_link", $title ); } if(!$title) $title = array_pop($path); // 문서 존재 여부 확인 list($ns, $docname, $full) = wiki_page_name($doc); $article =& wiki_class_load("Article"); $is_exists = $article->exists($ns, $docname); if($is_exists) $class = "wiki_active_link"; else $class = "wiki_inactive_link"; // [[/narin/나린위키 문법#HML 직접 작성]] 과 같이 // 문단 링크 허용 (FROM 2011-12-01) /* $hash = ''; if(strpos($full, '#')) { list($doc, $hash) = explode('#', $full); $hash = '#' . $hash; } */ return sprintf( '<a href="%s" class="%s">%s</a>', wiki_url('read', array('doc'=>$doc)), $class, $title ); }
exit; } if($wiki_folder_switch == "wiki_folder_select") { $wiki_folder = $wiki_folder_select; } else { $wiki_folder = $wiki_folder_input; } $wiki_doc = stripcslashes($wiki_doc); $wiki_folder = stripcslashes($wiki_folder); // 문자열 끝에 '/' 가 있다면 '/' 삭제 $wiki_folder = preg_replace("/\/$/", "", $wiki_folder); // target folder 가 없다면 '/' 로 셋팅 $toDoc = ($wiki_folder == "" ? "/" : $wiki_folder."/") . $wiki_doc; // target folder 유효성 체크 wiki_validate_doc($toDoc); if($write[ns] != $wiki_folder || $write[doc] != $wiki_doc) { $wikiArticle->moveDoc($fulldoc, $toDoc, $write['wr_id']); } $wikiArticle->updateLevel($toDoc, $wiki_access_level, $wiki_edit_level); wiki_goto_url(wiki_url('read', array('doc'=>$toDoc))); ?>
* @license GPL2 (http://narinwiki.org/license) * @author byfun (http://byfun.com) * @filesource */ include_once "./_common.php"; if( !$is_wiki_admin ) { alert("권한이 없습니다"); exit; } $folder = stripcslashes($folder); $move_to_folder = stripcslashes($move_to_folder); if($folder != $move_to_folder) { $wikiArticle =& wiki_class_load("Article"); for($i=0; $i<count($chk_wr_id); $i++) { $wr = &$wikiArticle->getArticleById($chk_wr_id[$i]); if(!$wr) continue; $fromDoc = wiki_doc($folder, $wr['wr_subject']); $toDoc = wiki_doc($move_to_folder, $wr['wr_subject']); $wikiArticle->moveDoc($fromDoc, $toDoc, $wr['wr_id']); } } header("location:".wiki_url('folder', array('loc'=>stripcslashes($move_to_folder)))); ?>
* @subpackage event * @license GPL2 (http://narinwiki.org/license) * @author byfun (http://byfun.com) * @filesource */ if (!defined('_GNUBOARD_')) exit; // 위키문서 링크 수정 (/ 로 시작하지 않는 문서에 대해서) $util =& wiki_class_load("Util"); $content = $util->wiki_fix_internal_link($wr_content); if($content != $wr_content) { $content = mysql_real_escape_string($content); sql_query("UPDATE ".$this->wiki['write_table']." SET wr_content = '$content' WHERE wr_id = $comment_id"); } // 최근 변경 내역 업데이트 if($w == 'c' || $w == 'cu') { list($ns, $docname, $doc) = wiki_page_name($wr_doc); $wikiChanges =& wiki_class_load("Changes"); if($w == 'c') $status = "댓글 작성"; else $status = "댓글 편집"; $wikiChanges->update("DOC", $doc, $status, ($member['mb_id'] ? $member['mb_id'] : $wr_name)); } wiki_goto_url(wiki_url('read', array('doc'=>$doc.'#c_'.$comment_id))); exit; ?>
echo $diffData; ?> <div class="clear" style="margin-top:10px"> <div style="float:left"> <span class="button"><a href="<?php echo wiki_url(); ?> ">시작페이지</a></span> <span class="button"><a href="<?php echo wiki_url('history', array('doc' => $doc)); ?> ">문서이력 목록</a></span> <span class="button red"><a href="<?php echo wiki_url('read', array('doc' => $doc)); ?> ">문서보기</a></span> <? if($is_wiki_admin || $is_doc_owner) { ?> <span class="button green"><a href="javascript:recover_history(<?php echo $article['wr_id']; ?> , <?php echo $hid; ?> );">이 문서로 복원</a></span> <? } ?> </div> <div style="float:right"> <span class="button"><a href="javascript:history.go(-1);">뒤로</a></span> </div>
for ($i=count($wr_id_array)-1; $i>=0; $i--) { $write = sql_fetch(" select wr_id from ".$this->wiki['write_table']." where wr_id = '".$wr_id_array[$i]."' "); if(!$write) { $wikiArticle->deleteArticleById($wr_id_array[$i]); $wikiCache->delete($wr_id_array[$i]); $d_doc = $delete_all_docs[$wr_id_array[$i]]; $wikiHistory->setUnlinked($wr_id_array[$i], $d_doc); $backlinks = $wikiArticle->getBackLinks($d_doc, $includeSelf = false); $wikiChanges->update("DOC", $d_doc, "삭제", $member['mb_id']); for($k=0; $k<count($backlinks); $k++) { $wikiArticle->shouldUpdateCache($backlinks[$k]['wr_id'], 1); } } } if($folder) { $bo_table = $wiki['bo_table']; $ns = $wikiNS->get($folder); if(!$ns) wiki_goto_url(wiki_url()); else wiki_goto_url(wiki_url('folder', array('loc'=>$folder))); exit; } ?>
/** * * 트리 배열로 트리 HTML 생성 * * @param array $tree _build_tree 에서 만들어지 트리 배열 * @param string $prefix prefix 로 사용할 부모 폴더 경로 * @param string $current 현재 폴더 경로 * @return string 트리 HTML */ function _build_list($tree, $prefix = '', $current = '') { $url = $this->wiki['url'].'/folder.php?bo_table='.$this->wiki['bo_table'].'&loc='; $ul = ''; foreach ($tree as $key => $value) { $li = ''; $folder = $prefix.$key; if(preg_match("/^".preg_quote($folder, "/")."/", $current)) $class = ' class="open"'; else $class = ''; $link = wiki_url('folder', array('loc'=>$folder)); if (is_array($value)) { $li .= '<li'.$class.'><span class="folder"><a href="'.$link.'" code="'.wiki_input_value($folder).'">'.$key.'</a></span>'; $sub = $this->_build_list($value, "$prefix$key/", $current); if($sub) $li .= $sub; $ul .= $li.'</li>'; } else { if($class != '') $closed = " leaf"; else $closed = " leaf leaf_folder"; $ul .= '<li'.$class.'><span class="folder '.$closed.'"><a href="'.$link.'" code="'.wiki_input_value($folder).'">'.$key.'</a></span></li>'; } } return strlen($ul) ? sprintf('<ul>%s</ul>', $ul) : ''; }
/** * * 네비게이션 문자열 반환 * * @uses $navi = wiki_navigation("/narin/plugins/locing", false); * * @param string $doc 문서 또는 폴더 경로 * @param boolean $isNS $doc가 폴더 경로인지 아닌지 * @return string 네비게이션문자열 (e.g. Home > 폴더 > 문서) */ function wiki_navigation($doc, $isNS=false) { global $wiki; if(!$isNS) list($ns, $docname, $fullpath) = wiki_page_name($doc); else $ns = $doc; $path = explode("/", $ns); $wiki_navigation = "<a href='".wiki_url('folder')."'>Home</a> > "; $hrefPath = ""; for($i=0; $i<count($path); $i++) { if($path[$i]) { $hrefPath .= "/".$path[$i]; $wiki_navigation .= " <a href='".wiki_url('folder', array('loc'=>$hrefPath))."'>".$path[$i]."</a> > "; } } return $wiki_navigation . " <a href='".wiki_url('read', array('doc'=>$doc))."'>$docname</a>"; }
/** * * include 처리 without js (currently no js version though) * * @param array $args 파라미터 * @param array $params {@link NarinParser} 에서 전달하는 파라미터/ can be null * @return string include되고 파싱된 결과 */ public function wiki_include_nojs($args, $params) { // default parser, if params is not null if ($params) { $wikiParser = new NarinParser(); $plugins =& $params['plugins']; $default =& $plugins[array_search('wiki_default_parser', $plugins)]; } else { $wikiParser = wiki_class_load("Parser"); } // if partial nocache used, should use container if (isset($args['partialnocache'])) { $args['nocontainer'] = false; } // folder access level check $wikiNS = wiki_class_load("Namespace"); $n = $wikiNS->get($args['loc']); if ($this->member['mb_level'] < $n['ns_access_level']) { return ""; } // container pre/post-fix vars if ($args['nocontainer']) { // flag box=no OR nocontainer $prefix = ""; $postfix = ""; } else { $prefix = "<div style='border:1px gray dotted; padding:5px; overflow:auto;'>" . "<div style='padding:5px 10px;background-color:#f8f8f8;'>"; if (isset($args['partialnocache']) || isset($args['pnc'])) { $prefix .= "(partial nocache를 이용한) "; } $prefix .= "Include된 문서: " . "<a href='" . wiki_url('read', array('doc' => $args['path'])) . "'>" . $args['path'] . "</a></div>"; $postfix = "</div>"; } // get include article $wikiArticle = wiki_class_load("Article"); if (!$wikiArticle->exists($args['loc'], $args['docname'])) { return $this->error_msg($args, "nonexist", $prefix, $postfix); } // cannot include itself $thisDoc = $this->doc . $this->board[bo_subject]; //TODO: should be better way.. if ($this->doc == $args['path'] || $thisDoc == $args['path']) { return $this->error_msg($args, "self", $prefix, $postfix); } $d = $wikiArticle->getArticle($args['loc'], $args['docname']); // page access level check if ($this->member['mb_level'] < $d['access_level']) { return ""; } // include loop check if ($this->check_loop($d)) { return $this->error_msg($args, "loop", $prefix, $postfix); } // random=element 처리 if (isset($args['random'])) { // element can be section_# for section, wiki_table, wiki_code, wiki_box if ($args['random'] == "wiki_box") { $matches = array(); $lines = explode("\n", $d['wr_content']); $pattern = '/^\\s{2,}(.*?)$/'; foreach ($lines as $k => $line) { if (preg_match($pattern, $line, $match) && strlen($match[1]) > 0) { array_push($matches, $match); } } $n = count($matches); if ($n == 0) { return $prefix . "해당 element가 없습니다." . $postfix; } $rndKey = array_rand($matches); $d['wr_content'] = $matches[$rndKey][0]; $content = $wikiParser->parse($d); $content = $this->treat_footnotes(&$default, $content); $pattern = '/^<div class=\'narin_contents\'>|<div id="wiki_footnotes">.*<\\/div>$|<\\/div>$/s'; $content = preg_replace($pattern, "", $content); return $prefix . $content . $postfix; } } // find the first secname and its level $pattern = '/[^=](=+)\\s*(.*?)\\s*\\1[^=]/s'; if (preg_match($pattern, $d['wr_content'], $matches)) { $args['includeTopSectionLevel'] = strlen($matches[1]); // update the secmane based on param firstseconly if ($args['firstseconly']) { $args['secname'] = $matches[2]; } } // extract specific section with given secname if ($args['secname']) { $pattern = '/[^=](=+)\\s*' . $args['secname'] . '\\s*\\1[^=]/s'; if (preg_match($pattern, $d['wr_content'], $match)) { if (preg_match('/[^=](=+)\\s*' . $args['secname'] . '\\s*\\1(.*?)[^=]\\1[^=]/s', $d['wr_content'], $matches)) { $section = $matches[1] . $args['secname'] . $matches[1] . $matches[2]; } else { preg_match('/[^=](=+)\\s*' . $args['secname'] . '.*/s', $d['wr_content'], $matches); $section = $matches[0]; } $d['wr_content'] = $section; } else { return $this->error_msg($args, "nosec", $prefix, $postfix); } } // for now ignore any 'include' in $d $loop_include_msg = ""; if (!$args['nocontainer']) { $loop_include_msg = "<html><div style='border:1px gray dotted; padding:5px; overflow:auto;'><div style='padding:5px 10px;background-color:#f8f8f8;'>Include 대상 문서: \${1}</div><div style='color:red;padding:5px;'>다단계 include 대상이나, include 하지 않았습니다.</div></div></html>"; } $d['wr_content'] = preg_replace("/{{page=([^?]*)[^}]*}}/s", $loop_include_msg, $d['wr_content']); // parse the included page $content = $wikiParser->parse($d); // if nocontainer, prepare seamless including, like closing tags, section & prepare afterwards if ($args['nocontainer']) { // $params['parser']->stop = true; $this->save_section(&$default, &$args); $closeTags = $this->get_before(&$default, &$args); $openTags = $this->get_after(&$default, &$args); } // get rid of wiki_content, wiki_toc and wiki_footnote if ($args['nocontainer']) { // update footnotes $content = $this->treat_footnotes(&$default, $content); $pattern = '/^<div class=\'narin_contents\'>|<div id=\'wiki_toc\'>.*<!--\\/\\/ wiki_toc -->|<div id="wiki_footnotes">.*<\\/div>$|<\\/div>$/s'; } else { $pattern = '/^<div class=\'narin_contents\'>|<div id=\'wiki_toc\'>.*<!--\\/\\/ wiki_toc -->|<a name[^<]*><\\/a>|<a href="#footnote_(\\d)" name="footnote_top_(\\d)" id="footnote_top_(\\d)">(\\d)\\)|<div id="wiki_footnotes">.*<\\/div>$|<\\/div>$/s'; } $content = preg_replace($pattern, "", $content); if ($args['nocontainer']) { // add secname to TOC $pattern = '/<h(\\d)>([^<\\/h\\1]*)<\\/h\\1>/'; preg_match_all($pattern, $content, $matches, PREG_SET_ORDER); foreach ($matches as $v) { array_push($default->toc, array("level" => $v[1], "title" => $v[2])); } $this->recover_section(&$default, &$args); return $closeTags . $content . "<!--// wiki_include -->" . $openTags; } else { return $prefix . $content . $postfix . "<!--// wiki_include -->"; } }
/** * * 그누보드 extend 처리 * * <g4>/extends/narin.wiki.extend.php 에서 호출하며, * 요청되는 스크립트 파일에 따라 위키에서 필요한 처리를 수행 * * @param string $scriptFile 스크립트 파일 (write.php, board.php, write_update.php ...) */ function board($scriptFile) { global $wiki, $bo_table, $wr_id, $board, $doc; // view if($scriptFile == "board.php" && $wr_id) { $wikiArticle =& wiki_class_load("Article"); $view = & $wikiArticle->getArticleById($wr_id); $doc = ($view[ns] == "/" ? "" : $view[ns]."/") . $view[doc]; wiki_goto_url(wiki_url('read', array('doc'=>$doc))); exit; } // list if($scriptFile == "board.php" && !$wr_id) { header("location:".wiki_url()); exit; } // 에디터에게 글 작성 권한을 주기 위해... if($wr_id && $this->member['mb_id'] && $this->member['mb_id'] != $this->write['mb_id']) { $wikiArticle =& wiki_class_load("Article"); $wikiConfig =& wiki_class_load("Config"); $default_edit_level = $wikiConfig->setting['edit_level']; $article = & $wikiArticle->getArticleById($wr_id); $edit_level = ( $article['edit_level'] ? $article['edit_level'] : $default_edit_level); $is_doc_editor = ($this->member['mb_level'] >= $edit_level ); if($scriptFile == "write.php" || $scriptFile == "write_update.php") { if($is_doc_editor) { $this->write['mb_id'] = $this->member['mb_id']; $this->write['is_editor'] = true; } } } else if($wr_id && $this->member['mb_id'] && $this->member['mb_id'] == $this->write['mb_id']) { $this->write['is_owner'] = true; } // write if($scriptFile == "write.php" && !$doc && !$wr_id ) { header("location:".wiki_url()); exit; } }
/** * * 백링크 반환 * (백링크 : 문서를 링크하고 있는 다른 문서들) * * @param string $doc 문서경로를 포함한 문서명 * @param boolean $includeSelf $doc 자신도 백링크에 포함할지 안할지 * @return array 문서목록 배열 */ public function getBackLinks($doc, $includeSelf = false) { $escapedDoc = mysql_real_escape_string($doc); $list = array(); // 2011-12-11 : 문서명뒤의 hash 태그사용할 수 있도록 수정 $sql = "SELECT *, wb.wr_subject AS doc FROM ".$this->wiki['write_table']." AS wb LEFT JOIN ".$this->wiki['nsboard_table']." AS nt ON wb.wr_id = nt.wr_id WHERE nt.bo_table= '".$this->wiki['bo_table']."' AND ( wb.wr_content LIKE '%[[".$escapedDoc."]]%' OR wb.wr_content LIKE '%[[".$escapedDoc."#%]]%' OR wb.wr_content LIKE '%[[".$escapedDoc."|%' OR wb.wr_content LIKE '%[[".$escapedDoc."#%|%' ) AND wb.wr_content NOT LIKE '%[[".$escapedDoc."/%'"; $result = sql_query($sql); while($row = sql_fetch_array($result)) { if(!$this->hasInternalLink($row['wr_content'], $doc)) { continue; } $bdoc = ($row['ns'] == "/" ? "/" : $row['ns'] . "/") . $row['doc']; if(!$includeSelf && $bdoc == $doc) continue; $row['href'] = wiki_url('read', array('doc'=>$bdoc)); array_push($list, $row); } if(count($list)) $list = wiki_subval_asort($list, "doc"); return $list; }
$wiki_admin_href = $wiki['url']."/adm/"; // 관리 패스 $admin_href = $wiki['g4_url']."/adm/board_form.php?w=u&bo_table=".$bo_table; } // 최근 변경내역 보기 링크 $recent_href = wiki_url('recent'); // 백링크 $back_links = $wikiArticle->getBackLinks($doc); // 문서이력 URL if( $is_doc_owner || $is_wiki_admin || $member['mb_level'] >= $history_access_level) { $history_href = wiki_url('history', array('doc'=>$doc)); } else $history_href = ""; // 네비게이션 $navigation = wiki_navigation($doc); // 공헌자 $contributors = $write['contributors']; // 문서이력 보기라면 버튼 감춤 if($is_history) { $update_href = ""; $delete_href = ""; $comment_delete_href = ""; $doc_admin_href = "";
// 폴더 정보 로드 $ns = $wikiNS->get($loc); // 권한 검사 if($w != 'u' || !$loc || !$wiki_loc || !$ns || !$wiki_access_level || !$is_wiki_admin) { alert("권한이 없습니다"); exit; } // 문자열 끝에 '/' 가 있다면 '/' 삭제 $loc = preg_replace("/\/$/", "", $loc); $wiki_loc = preg_replace("/\/$/", "", $wiki_loc); if(!$wiki_loc) $wiki_loc = "/"; // 폴더 업데이트 (이동) if($ns['ns'] != "/" && $wiki_loc != "/" && $ns['ns'] != $wiki_loc) { $wikiNS->updateNamespace($loc, $wiki_loc); } // 템플릿 설정 $wikiNS->setTemplate($wiki_loc, $wiki_template); // 권한 설정 $wikiNS->updateAccessLevel($wiki_loc, $wiki_access_level); // 리다이렉트 wiki_goto_url(wiki_url('folder', array('loc'=>stripcslashes($wiki_loc)))); ?>
/** * * dataout inline 처리 without js (currently no js version though) * * @param array $args 파라미터 * @param array $params {@link NarinParser} 에서 전달하는 파라미터/ can be null * @return string output */ public function wiki_dataout_inline_nojs($args, $params) { if($args['having']>0) { $having = "HAVING COUNT(1)=".$args['having']; } if($args['method'] == "rank") { if($args['having_target']>0) { $having_target = "HAVING COUNT(1)=".$args['having_target']; } $sql_wr_id = "SELECT wr_id FROM ".$args['db_table']." WHERE bo_table='".$this->bo_table."' AND ".$args['filter_keyword']." AND (".$args['filter_target'].") GROUP BY wr_id ".$having_target; $res_wr_id = sql_query($sql_wr_id); $row_wr_id = mysql_fetch_assoc($res_wr_id); $sort_wr_id = $row_wr_id['wr_id']; if(!$sort_wr_id) return " <span style='color:red;'>등록정보없음</span> "; // make all wr_id list without filter_target mysql_query("SET @rank=0"); $sql_rank = "SELECT rank FROM ( SELECT @rank:=@rank+1 AS rank, wr_id, val FROM ( SELECT d.wr_id, val FROM ( SELECT wr_id FROM ".$args['db_table']." WHERE bo_table='".$this->bo_table."' AND ".$args['filter_keyword']." AND (".$args['filter_where'].") GROUP BY wr_id ".$having." ) c, ".$args['db_table']." d WHERE d.bo_table='".$this->bo_table."' AND ".$args['filter_keyword']." AND d.wr_id=c.wr_id AND col = '".$args['field']."' ORDER BY CAST(val AS DECIMAL) ".$args['sort']." ) r ) g WHERE g.wr_id = ".$sort_wr_id; //TODO: order should be done by proper casting.. maybe need to specify the data type // e.g. _int --> CAST(val AS UNSIGNED), _dt --> CAST(val AS DATETIME), _num --> CAST(val AS DECIMAL) $res_rank = sql_query($sql_rank); $row_rank = mysql_fetch_assoc($res_rank); return " ".$row_rank['rank']." "; } $sql_wr_id = "SELECT wr_id FROM ".$args['db_table']." WHERE bo_table='".$this->bo_table."' AND ".$args['filter_keyword']." AND (".$args['filter_where'].") GROUP BY wr_id ".$having; $res_wr_id = sql_query($sql_wr_id); if($args['method'] == "count") { $nb_count = mysql_num_rows($res_wr_id); return " ".$nb_count." "; }else { $data_array = array(); while($row_wr_id = mysql_fetch_assoc($res_wr_id)) { $wr_id = $row_wr_id['wr_id']; // fullpath is reserved for %pageid%, docname is reserved for %title% if($args['field']=='fullpath' || $args['field']=='%pageid%' || $args['field']=='%title%') { $wikiArticle =& wiki_class_load("Article"); $write = $wikiArticle->getArticleById($wr_id); $fullpath = wiki_doc($write['ns'], $write['doc']); $href = wiki_url('read', array('doc'=>$fullpath)); if($args['field']=='fullpath' || $args['field']=='%pageid%') { array_push($data_array, "<a href='".$href."' class='wiki_active_link'>".$fullpath."</a>"); }else { array_push($data_array, "<a href='".$href."' class='wiki_active_link'>".$write['doc']."</a>"); } }else { $sql = "SELECT val FROM ".$args['db_table']." WHERE bo_table='".$this->bo_table."' AND ".$args['filter_keyword']." AND col='".$args['field']."' AND wr_id=".$wr_id." GROUP BY wr_id"; $row = sql_fetch($sql); array_push($data_array, $row['val']); } if($args['method'] == "item") { return " ".array_shift($data_array)." "; } } if(count($data_array) == 0) return " <span style='color:red;'>등록정보없음</span> "; sort($data_array); return " ".implode(", ", $data_array)." "; } }
$sql = "SELECT * FROM ".$wiki['changes_table']." WHERE bo_table = '".$wiki['bo_table']."' ORDER BY id DESC LIMIT $from_record, $page_rows"; $page_base_url = wiki_url('recent', array('page'=>'')); if($wiki['fancy_url']) $page_base_url .= '/'; $paging = get_paging(10, $page, $total_page, $page_base_url); if($is_wiki_admin) { $clear_href = "javascript:clear_changes();"; $delete_selected_href = "javascript:delete_selected_changes();"; } else { $clear_href = ""; $delete_selected_href = ""; } $list = array(); $res = sql_query($sql); while($row = sql_fetch_array($res)) { if($row['target_type'] == "DOC") { $row['view_href'] = wiki_url('read', array('doc'=>$row[target])); } else if($row['target_type'] == "FOLDER") { $row['view_href'] = wiki_url('folder', array('loc'=>$row[target])); } array_push($list, $row); } $wikiControl->includePage($wiki['inc_skin_path'] . "/recent.skin.php", $layout=true); ?>
$wikiArticle =& wiki_class_load("Article"); $article = $delete_article; $doc = wiki_doc($article['ns'], $article['doc']); $backlinks = $wikiArticle->getBackLinks($doc, $includeSelf = false); for($i=0; $i<count($backlinks); $i++) { $wikiArticle->shouldUpdateCache($backlinks[$i]['wr_id'], 1); } $wikiArticle->deleteArticleById($wr_id); // 문서 이력 삭제 $wikiHistory =& wiki_class_load("History"); $wikiHistory->setUnlinked($wr_id, $doc); //$wikiHistory->clear($wr_id, $delete_all = true); // 캐시 삭제 $wikiCache =& wiki_class_load("Cache"); $wikiCache->delete($wr_id); // 최근 변경 내역 업데이트 $wikiChanges =& wiki_class_load("Changes"); $wikiChanges->update("DOC", $doc, "삭제", ($member['mb_id'] ? $member['mb_id'] : $write[wr_name])); wiki_goto_url(wiki_url()); exit; ?>
/** * * 문서이력 목록 반환 * * @param int $wr_id 문서 id * @param string $doc 문서명(경로포함) * @param int $page 페이지 * @param int $page_rows 한 페이지당 보여줄 목록 수 * @return array 문서이력 목록 */ function getHistory($wr_id, $doc, $page = 1, $page_rows = 20) { $bo_table = $this->wiki[bo_table]; $wr_id = mysql_real_escape_string($wr_id); $sql_all = "SELECT id FROM ".$this->wiki['history_table']." AS ht LEFT JOIN ".$this->wiki['write_table']." AS wt ON ht.wr_id = wt.wr_id WHERE ht.bo_table = '".$this->wiki['bo_table']."' AND ht.wr_id = '$wr_id' ORDER BY ht.id DESC"; $result = sql_query($sql_all); $total_count = mysql_num_rows($result); $total_page = ceil($total_count / $page_rows); $from_record = ($page - 1) * $page_rows; // 시작 열을 구함 $sql = "SELECT ht.*, wt.wr_option, wt.mb_id, mt.mb_name, mt.mb_nick FROM ".$this->wiki['history_table']." AS ht LEFT JOIN ".$this->wiki['write_table']." AS wt ON ht.wr_id = wt.wr_id JOIN ".$this->g4['member_table']." AS mt ON wt.mb_id = mt.mb_id WHERE ht.bo_table = '".$this->wiki['bo_table']."' AND ht.wr_id = '$wr_id' ORDER BY ht.id DESC LIMIT $from_record, $page_rows"; $list = wiki_sql_list($sql); for($i=0; $i<count($list); $i++) { // 로그인 안한 상태로 작성했다면... if(!$list[$i]['mb_name']) { $list[$i]['mb_name'] = $list['editor_mb_id']; $list[$i]['mb_nick'] = $list['editor_mb_id']; } $list[$i]['content'] = nl2br(wiki_text($list[$i]['content'])); $list[$i]['date'] = date("Y-m-d h:i", strtotime($list[$i]['reg_date'])); if($list[$i][mb_id] == $this->member[mb_id] || $this->is_admin) { if($page != 1 || $i > 0) { $list[$i]['recover_href'] = "javascript:recover_history($wr_id, ".$list[$i]['id'].");"; if($this->is_admin) { $list[$i]['delete_href'] = "javascript:delete_history(".$list[$i]['id'].");"; } } } } $page_base_url = wiki_url('history', array('doc'=>$doc, 'page'=>'')); $paging = get_paging(10, $page, $total_page, $page_base_url); $ret = array($list, $paging); return $ret; }