Beispiel #1
0
 * @subpackage admin
 * @license GPL2 (http://narinwiki.org/license)
 * @author	byfun (http://byfun.com)
 * @filesource
 */

$pageid = "nowiki";

include_once("_common.php");
include_once "admin.head.php";

$sql = "SELECT wr_id, wr_subject FROM ".$wiki['write_table']." WHERE wr_id NOT IN ( SELECT wr_id FROM {$wiki[nsboard_table]} ) AND wr_is_comment <> 1";
$list = wiki_sql_list($sql);

$sql = "SELECT * FROM ".$wiki['ns_table']." WHERE bo_table = '".$wiki['bo_table']."'";
$ns_list = wiki_sql_list($sql);
$ns_options = "";
foreach($ns_list as $idx => $ns)
{
	$v = wiki_input_value($ns['ns']);
	$ns_options .= "<option value=\"$v\">".$ns['ns']."</option>";
}
if(!$ns_options) $ns_options = "<option value=\"/\">/</option>";
?>


<? if(count($list) > 0) { ?>

<style type="text/css">
	.name_error { color:#ff0000; }
</style>
	/**
	 *
	 * 폴더 이름 변경
	 *
	 * @param string $srcNS 변경전 이름
	 * @param string $dstNS 변경후 이름
	 */
	function updateNamespace($srcNS, $dstNS)
	{
		if($srcNS == "/") return;
		$wikiArticle =& wiki_class_load("Article");

		$escapedSrcNS = mysql_real_escape_string($srcNS);
		$escapedDstNS = mysql_real_escape_string($dstNS);

		// $srcNS 의 하위 ns 를 읽어온다
		$list = wiki_sql_list("SELECT * FROM ".$this->wiki['ns_table']."
						  WHERE ns like '$escapedSrcNS/%' AND bo_table='".$this->wiki['bo_table']."'");		

		foreach($list as $k=>$v) {
			// $srcNS 의 하위 ns 를 업데이트한다.
			$to = preg_replace("/^(".preg_quote($srcNS, "/").")(.*?)/", $dstNS, $v['ns']);
			$this->updateNamespace($v['ns'], $to);
		}

		// $srcNS 를 업데이트한다.
		$this->_updateNamespace($wikiArticle, $srcNS, $dstNS);
	}
Beispiel #3
0
<?
/**
 * 
 * 문서 검색 응답 (by toolbar)
 *
 * @package	narinwiki
 * @subpackage pages
 * @license GPL2 (http://narinwiki.org/license)
 * @author	byfun (http://byfun.com)
 * @filesource
 */
 
if(!defined("__NARIN_API__")) wiki_not_found_page();

if(wiki_is_euckr()) $find_doc = iconv("UTF-8", "CP949", rawurldecode($find_doc)); 

$sql = "SELECT * FROM ".$wiki['write_table']." AS wt 
			  LEFT JOIN ".$wiki['nsboard_table']." AS nt ON nt.bo_table = '".$wiki['bo_table']."' AND wt.wr_id = nt.wr_id 
			  WHERE nt.ns <> '' AND wt.wr_subject LIKE '%$find_doc%'";
$result = wiki_sql_list($sql);
$list = array();
foreach($result as $idx => $v) {
	array_push($list, array("folder"=>$v['ns'], "docname"=>$v['wr_subject']));
}

echo wiki_json_encode($list);

?>
	/**
	 * 
	 * 공헌자 목록 반환
	 * 
	 * @param int $wr_id 문서 id
	 * @return array 공헌자 목록
	 */	
	public function getContributor($wr_id) {
		$sql = "SELECT ct.editor, mt.mb_id, mt.mb_name, mt.mb_nick FROM ". $this->wiki['contrib_table'] . " AS ct
						LEFT JOIN " . $this->g4['member_table'] . " AS mt
							ON ct.editor = mt.mb_id
						WHERE bo_table = '" . $this->wiki['bo_table'] . "' AND wr_id = " . $wr_id . "
						ORDER BY id ASC";
		return wiki_sql_list($sql);		
	}
	/**
	 * 
	 * unlinked 문서 이력 목록 반환
	 * 
	 * @return array unlinked 문서 이력
	 */
	public function unlinkedHistory() {
		$sql = "SELECT doc FROM ".$this->wiki['history_table']." WHERE bo_table = '".$this->bo_table."' AND wr_id = -1 GROUP BY doc";
		return wiki_sql_list($sql);
	}