Skip to content
Permalink
Browse files

ver 3.1.0

  • Loading branch information...
dercsyong committed Mar 15, 2019
1 parent 04fda07 commit e6b333e1a11c75d00302750d059dc19b8f02fe28
Showing with 1,523 additions and 1,750 deletions.
  1. +15 −12 README.md
  2. +45 −59 build/complete.php
  3. +35 −91 index.php
  4. +0 −160 themark.php
  5. +1,428 −1,428 { → useless}/namumark.php
@@ -1,16 +1,19 @@
# UnofficialNamuMirror
정말 단순하게 나무위키의 데이터베이스 덤프를 이용하여<br>
'읽기전용' 미러 페이지로 이용 가능한 소스입니다.<br>
namumark가 상당히 오래전에 공개되었고, 그동안 문법이 여러번 바뀌었기 때문에<br>
정상작동을 보증하지 않습니다.<br><br>
제가 github에 자주 접속하지 않기 때문에 이슈보고는 github보다는 아래 링크에서 해주시는게 좋습니다.<br>
정말 단순하게 나무위키의 데이터베이스 덤프를 이용하여<br>
'읽기전용' 미러 페이지로 이용 가능한 소스입니다.<br>
namumark가 상당히 오래전에 공개되었고, 그동안 문법이 여러번 바뀌었기 때문에<br>
정상작동을 보증하지 않습니다.<br><br>
제가 github에 자주 접속하지 않기 때문에 이슈보고는 github보다는 아래 링크에서 해주시는게 좋습니다.<br>
http://thewiki.ga/request/<br>
Email : dercsyong@thewiki.ga<br><br>
# 서버 환경
ver 3.x 부터는 다음 서버 환경에서 동작하도록 수정되었습니다.<hr>
# 3.1.x 이후 버전
ver 3.1.x 부터는 namumark를 일부 수정한 theMark를 사용하기 때문에 namumark를 사용하시려면 3.0.5 이하 버전을 참고해서 수정해야 합니다.<br>
theMark : https://github.com/dercsyong/TheMarkProject
# 서버 환경
ver 3.x 부터는 다음 서버 환경에서 동작하도록 수정되었습니다.<hr>
nginx + php-fpm<br>
PHP 7.x 이상<br>
mongoDB 3.4.x 및 mongoDB Driver v1.5 이상<hr>
mongoDB Driver 문제로 동작하지 않는 경우 ver 2.x 참고해서 수정해야 합니다.<br><br>
# 덤프 파일 (json 및 sql)
http://dump.thewiki.ga
PHP 7.x 이상<br>
mongoDB 3.4.x 및 mongoDB Driver v1.5 이상<hr>
mongoDB Driver 문제로 동작하지 않는 경우 ver 2.x 참고해서 수정해야 합니다.<br><br>
# 덤프 파일 (json 및 sql)
http://dump.thewiki.ga
@@ -50,72 +50,58 @@
$tp = "";
}
// MongoDB 접속
try{
$mongo = new MongoDB\Driver\Manager('mongodb://username:password@localhost:27017/thewiki');
} catch (MongoDB\Driver\Exception $ex){
error_log($ex->getMessage());
die();
}
$query = new MongoDB\Driver\Query(array('namespace' => $namespace, 'title' => array('$regex' => '^'.$_GET['w'])), array('limit' => 10 ));
define('THEWIKI', true);
include $_SERVER['DOCUMENT_ROOT'].'/config.php';
if(!$config_db){
$arr = $mongo->executeQuery('thewiki.docData180326', $query);
} else {
$sql = "SELECT * FROM settings WHERE ip = '$_SERVER[REMOTE_ADDR]'";
$res = mysqli_query($config_db, $sql);
$cnt = mysqli_num_rows($res);
if($cnt){
$settings = mysqli_fetch_array($res);
define('THEWIKI', true);
include $_SERVER['DOCUMENT_ROOT'].'/config.php';
if(!$config_db){
$arr = $mongo->executeQuery('thewiki.docData180326', $query);
} else {
$sql = "SELECT * FROM settings WHERE ip = '0.0.0.0'";
$sql = "SELECT * FROM settings WHERE ip = '$_SERVER[REMOTE_ADDR]'";
$res = mysqli_query($config_db, $sql);
$settings = mysqli_fetch_array($res);
}
if($settings['docVersion']!='180326'){
try{
$mongo = new MongoDB\Driver\Manager('mongodb://username:password@mongodbMirrorServer:27017/thewiki');
} catch (MongoDB\Driver\Exception $ex){
error_log($ex->getMessage());
die();
$cnt = mysqli_num_rows($res);
if($cnt){
$settings = mysqli_fetch_array($res);
} else {
$sql = "SELECT * FROM settings WHERE ip = '0.0.0.0'";
$res = mysqli_query($config_db, $sql);
$settings = mysqli_fetch_array($res);
}
}
if($settings['docVersion']=='180925'&&$alpha){
if($namespace=='12'){
$namespace = '11';
} else if($namespace=='13'){
$namespace = '6';
if($settings['docVersion']=='180925'&&$alpha){
if($namespace=='12'){
$namespace = '11';
} else if($namespace=='13'){
$namespace = '6';
}
} else {
if($namespace=='6'||$namespace=='11'){
$namespace = 12;
}
}
} else {
if($namespace=='6'||$namespace=='11'){
$namespace = 12;
$query = new MongoDB\Driver\Query(array('namespace' => $namespace, 'title' => array('$regex'=>'^'.$_GET['w'])), array('limit' => 10 ));
switch($settings['docVersion']){
case '160229': $arr = $mongo->executeQuery('thewiki.docData160229', $query); break;
case '160329': $arr = $mongo->executeQuery('thewiki.docData160329', $query); break;
case '160425': $arr = $mongo->executeQuery('thewiki.docData160425', $query); break;
case '160530': $arr = $mongo->executeQuery('thewiki.docData160530', $query); break;
case '160627': $arr = $mongo->executeQuery('thewiki.docData160627', $query); break;
case '160728': $arr = $mongo->executeQuery('thewiki.docData160728', $query); break;
case '160829': $arr = $mongo->executeQuery('thewiki.docData160829', $query); break;
case '161031': $arr = $mongo->executeQuery('thewiki.docData161031', $query); break;
case '170327': $arr = $mongo->executeQuery('thewiki.docData170327', $query); break;
case '180925': $arr = $mongo->executeQuery('thewiki.docData180925', $query); break;
default: $arr = $mongo->executeQuery('thewiki.docData180326', $query); break;
}
}
$query = new MongoDB\Driver\Query(array('namespace' => $namespace, 'title' => array('$regex' => '^'.$_GET['w'])), array('limit' => 10 ));
switch($settings['docVersion']){
case '160229': $arr = $mongo->executeQuery('thewiki.docData160229', $query); break;
case '160329': $arr = $mongo->executeQuery('thewiki.docData160329', $query); break;
case '160425': $arr = $mongo->executeQuery('thewiki.docData160425', $query); break;
case '160530': $arr = $mongo->executeQuery('thewiki.docData160530', $query); break;
case '160627': $arr = $mongo->executeQuery('thewiki.docData160627', $query); break;
case '160728': $arr = $mongo->executeQuery('thewiki.docData160728', $query); break;
case '160829': $arr = $mongo->executeQuery('thewiki.docData160829', $query); break;
case '161031': $arr = $mongo->executeQuery('thewiki.docData161031', $query); break;
case '170327': $arr = $mongo->executeQuery('thewiki.docData170327', $query); break;
case '180925': $arr = $mongo->executeQuery('thewiki.docData180925', $query); break;
default: $arr = $mongo->executeQuery('thewiki.docData180326', $query); break;
$data = array();
foreach($arr as $doc){
$data[] = $tp.$doc->title;
}
echo json_encode($data, JSON_PRETTY_PRINT|JSON_UNESCAPED_UNICODE);
} catch (MongoDB\Driver\Exception\Exception $e){
die();
}
$data = array();
foreach($arr as $doc){
$data[] = $tp.$doc->title;
}
echo json_encode($data, JSON_PRETTY_PRINT|JSON_UNESCAPED_UNICODE);
?>
?>
126 index.php
@@ -652,119 +652,64 @@ function urlencode(str) {
if($arr['text']!=""){
// 분류 문서
if($namespace=="2"&&$settings['docVersion']==$settingsref['docVersion']){
$sql = "SELECT * FROM category WHERE target = '$w'";
$res = mysqli_query($config_db, $sql);
$arr_category = mysqli_fetch_array($res);
$root_directory = explode(",", $arr_category['root']);
$list_document = explode(",", $arr_category['title']);
$sql = "SELECT * FROM category WHERE target != '$w' AND root LIKE '%".$w."%'";
$res = mysqli_query($config_db, $sql);
while($arr_root=mysqli_fetch_array($res)){
$x++;
$low_directory[$x] = $arr_root['target'];
}
$arr2 = "= 관련 분류 =
";
foreach($low_directory as $key=>$value){
if($value!=""&&$value!=$w){
$value = str_replace("_(NISDISKBAN)_", ",", $value);
$unique_check[] = "분류:".$value;
}
}
foreach($root_directory as $key => $value){
if($value!=""&&$value!=$w){
$value = str_replace("_(NISDISKBAN)_", ",", $value);
$unique_check[] = $value;
}
}
$unique_check = array_unique($unique_check);
foreach($unique_check as $value){
$arr2 = $arr2."[[:".$value."]]{{{#!html <br>}}}";
}
$arr2 = $arr2."
= 분류된 문서 =
";
foreach($list_document as $key=>$value){
$value = str_replace("_(NISDISKBAN)_", ",", $value);
$tp = explode(":", $value);
if($tp[0]=="파일"){
$value = ":".$value;
}
if($tp[0]==""||mb_substr($value, 0, 1, "UTF-8")==""){
if(mb_substr($value, 1, 1, "UTF-8")!=":"){
$value = "틀:".mb_substr($value, 1, mb_strlen($value, "UTF-8"), "UTF-8");
if($namespace=="2"){
try{
$mongo2 = new MongoDB\Driver\Manager('mongodb://username:password@localhost:27017/thewiki');
$query = array("title"=>"분류:".$w);
$query = new MongoDB\Driver\Query($query);
$print = $mongo2->executeQuery('thewiki.category'.$settings['docVersion'], $query);
foreach($print as $value){
$arr2 = "= 상위 분류 =\n";
foreach($value->up as $topCa){
$arr2 .= "[[:".$topCa."]]\n";
}
$arr2 .= "= 하위 분류 =\n";
foreach($value->btm as $btmCa){
$arr2 .= "[[:".$btmCa."]]\n";
}
$arr2 .= "= 포함된 문서 =\n";
foreach($value->includeDoc as $inDoc){
$arr2 .= "[[".$inDoc."]]\n";
}
}
if($tp[0]!="분류"&&$tp[0]!="사용자"){
$arr2 = $arr2."[[".$value."]]{{{#!html <br>}}}";
}
} catch (MongoDB\Driver\Exception\Exception $e){
$arr2 = "{{{+2 mongoDB 서버에 접속할 수 없습니다}}}";
}
$arr['text'] = $arr2."
= 분류 설명 =
".$arr[text];
$arr['text'] = $arr2."\n= 분류 설명 =\n".$arr['text'];
}
// noredirect 지원
require_once($_SERVER['DOCUMENT_ROOT']."/theMark.php");
$theMark = new theMark($arr['text']);
if($noredirect){
define('noredirect', true);
$theMark->redirect = false;
}
require_once($_SERVER['DOCUMENT_ROOT']."/namumark.php");
// themark 통합
define('USETHEMARK', true);
if($settings['docStrikeLine']){
define('THEMARK_STRIKELINE', true);
if(!$settings['docStrikeLine']){
$theMark->strikeLine = true;
}
if($namespace=='3'||$namespace=='11'){
define('THEMARK_IMGLOAD', 1);
} else {
define('THEMARK_IMGLOAD', $settings['imgAutoLoad']);
if($namespace=='3'||$namespace=='11'||$settings['imgAutoLoad']=='0'){
$theMark->imageAsLink = false;
}
include $_SERVER['DOCUMENT_ROOT'].'/themark.php';
echo themark($arr['text']);
echo $theMark->toHtml();
} else {
if($namespace=="11"){
$sql = "SELECT * FROM file WHERE name = '$_GET[w]'";
$res = mysqli_query($config_db, $sql);
$cnt = mysqli_num_rows($res);
if($cnt>0){
require_once($_SERVER['DOCUMENT_ROOT']."/namumark.php");
require_once($_SERVER['DOCUMENT_ROOT']."/theMark.php");
$arr['text'] = "[[".$_GET['w']."]]";
// MySQLWikiPage와는 달리 PlainWikiPage의 첫 번째 인수로 위키텍스트를 받습니다.
$wPage = new PlainWikiPage($arr['text']);
$theMark = new theMark($arr['text']);
// NamuMark 생성자는 WikiPage를 인수로 받습니다.
$wEngine = new NamuMark($wPage);
// 위키링크의 앞에 붙을 경로를 prefix에 넣습니다.
$wEngine->prefix = "/w";
$wPrint = $wEngine->toHtml();
echo $wPrint;
echo $theMark->toHtml();
} else { ?>
업로드된 이미지가 아닙니다.<br><a href='/Upload.php' target='_top'>이미지 업로드</a></div></div><?=$THEWIKI_FOOTER?></article></div></body></html>
<?php die();
}
}
?><script>
(function() {
var cx = 'partner-pub-8464541176962266:7351409120';
var gcse = document.createElement('script');
gcse.type = 'text/javascript';
gcse.async = true;
gcse.src = 'https://cse.google.com/cse.js?cx=' + cx;
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(gcse, s);
})();
</script>
<gcse:searchbox-only></gcse:searchbox-only>
?>
<!-- 구글 광고 영역 -->
<?php
$cURLs = "http://ac.search.naver.com/nx/ac?_callback=result&q=".rawurlencode($_GET['w'])."&q_enc=UTF-8&st=100&frm=nv&r_format=json&r_enc=UTF-8&r_unicode=0&t_koreng=1&ans=1";
$ch = curl_init();
@@ -796,7 +741,6 @@ function urlencode(str) {
?>
</div>
</div>
<?=$THEWIKI_FOOTER?>
</article>
</div>
Oops, something went wrong.

0 comments on commit e6b333e

Please sign in to comment.
You can’t perform that action at this time.