Skip to content

Commit

Permalink
Merge pull request #3 from aaei924/temp
Browse files Browse the repository at this point in the history
Temp
  • Loading branch information
aaei924 committed Sep 10, 2021
2 parents 8e6414a + da15cd9 commit 4f2d20c
Show file tree
Hide file tree
Showing 7 changed files with 252 additions and 150 deletions.
201 changes: 159 additions & 42 deletions PressDoLib.php

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions data/language/ko-kr.php
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,9 @@
'msg:changed_thread_topic' => '스레드 주제를 <b>@1@</b>로 변경',
'msg:changed_thread_document' => '스레드를 <b>@1@</b>로 이동',
'msg:noDisplayHideAuthor' => '숨겨진 댓글 보이지 않기',
'msg:thread_invalid_status' => '토론이 열린 상태가 아닙니다.',
'msg:thread_status_pause' => '중지된 토론입니다.',
'msg:thread_status_close' => '닫힌 토론입니다.',
'msg:b_user' => ' @1@ 사용자가 @2@ ',
'msg:b_aclgroup_add' => '@1@ ACL 그룹에 추가',
'msg:b_aclgroup_remove' => '@1@ ACL 그룹에서 제거',
Expand Down
22 changes: 18 additions & 4 deletions index.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@
exit;
case 'w':
case 'jump':
WikiSkin::ConstPage('wiki',[$full_title, $ns, $title, utf8_decode($content), $datetime, $rev, null, ['error' => $err_content, 'notice' => $api_data['discuss_progress']]]);
($api_doc['content'] !== null)? $con = utf8_decode($content):$con = null;
WikiSkin::ConstPage('wiki',[$full_title, $ns, $title, $con, $datetime, $rev, null, ['error' => $err_content, 'notice' => $api_data['discuss_progress']]]);
unset($api);
break;
case 'edit':
Expand Down Expand Up @@ -140,7 +141,9 @@
if(isset($_POST['token']) && $_SESSION['editor']['token'] !== $_POST['token']){
$errMsg = $lang['msg:err_csrf_token'];
$raw = $_POST['content'];
}
}elseif(isset($api['page']['error'])){
WikiSkin::ConstPage('move', [$_GET['title'],$ns,$title,$token,$api['page']['error']]);
}else{
$_SESSION['editor'] = array(
'fulltitle' => $full_title,
'namespace' => $api_doc['namespace'],
Expand All @@ -150,7 +153,8 @@
'baserev' => $baserev,
'raw' => $raw
);
WikiSkin::ConstPage('move', [$_GET['title'],$ns,$title,$token]);
WikiSkin::ConstPage('move', [$_GET['title'],$ns,$title,$token]);
}
break;
case 'delete':
WikiSkin::ConstPage('delete', [$_GET['title'],$ns,$title]);
Expand Down Expand Up @@ -226,12 +230,22 @@
$err = 'no_permission';
elseif(isset($long))
$err = ['too_long', $long[0], $long[1]];
elseif($api_data['status'] !== 'normal')
$err = 'thread_invalid_status';
else{
Thread::addThreadComment($api_data['slug'], $_POST['text'], $api['session']['identifier']);
Header('Location: '.$conf['FullURL'].$uri['thread'].$api_data['slug']);
}
}elseif(in_array($_POST['status'], ['normal', 'pause', 'close']) && $api_data['updateThreadStatus'] === true){
Thread::updateStatus($_GET['title'], $_POST['status'], $api['session']['member']['username']);
Header('Location: '.$conf['FullURL'].$uri['thread'].$api_data['slug']);
}elseif(isset($_POST['document']) && $api_data['updateThreadDocument'] === true){
Thread::moveThread($_GET['title'], $_POST['document'], $api['session']['member']['username']);
Header('Location: '.$conf['FullURL'].$uri['thread'].$api_data['slug']);
}elseif(isset($_POST['topic']) && $api_data['updateThreadTopic'] === true){

}
WikiSkin::ConstPage('thread', [$ns, $title, $api_data,$err]);
WikiSkin::ConstPage('thread', [$ns, $title, $api_data, $err]);
break;
case 'edit_request':

Expand Down
55 changes: 27 additions & 28 deletions internal.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,23 +58,15 @@ function verifyACL($sess, $title, $vn, $ns, $t){
return true;
}

$rev = @$_GET['rev'];
$full_title = @$_GET['title'];
if(isset($_GET['rev'])) $rev = $_GET['rev'];
$full_title = $_GET['title'];
$sess = [
'member' => $member,
'ip' => $post_sess['ip'],
'identifier' => $i,
'menus' => []
];
preg_match('/^('.implode('|',$_ns).'):(.*)$/', $full_title, $get_ns);
if(!$get_ns){
$NameSpace = $lang['ns:document'];
$Title = $full_title;
} else {
$NameSpace = $get_ns[1];
$Title = $get_ns[2];
}
$rawNS = array_search($NameSpace, $_ns);
list($rawNS, $NameSpace, $Title) = Docs::parseTitle($full_title);

switch ($_GET['page']){
case 'w':
Expand All @@ -89,8 +81,14 @@ function verifyACL($sess, $title, $vn, $ns, $t){
$starcount = PressDo::countStar($fetch['docid']);
$datetime = $fetch['datetime'];
$discussProgress = (isset($discussions[0]));
($fetch['content'])? $DOC_CONTENT = PressDo::readSyntax($fetch['content'], ['title' => $full_title, 'shortUri' => $conf['UseShortURI']]) : $DOC_CONTENT = null;
$content = $DOC_CONTENT['html'];
if($fetch['content'] !== null){
$DOC_CONTENT = PressDo::readSyntax($fetch['content'], ['title' => $full_title, 'shortUri' => $conf['UseShortURI']]);
$content = htmlspecialchars(utf8_encode($DOC_CONTENT['html']));
}else{
$DOC_CONTENT = null;
$content = null;
}

}elseif(is_array($ACL)){
$err = $ACL;
}
Expand All @@ -105,7 +103,7 @@ function verifyACL($sess, $title, $vn, $ns, $t){
'namespace' => $NameSpace,
'title' => $Title,
'ForceShowNameSpace' => $conf['ForceShowNameSpace'],
'content' => htmlspecialchars(utf8_encode($content)),
'content' => $content,
'categories' => $DOC_CONTENT['categories']
],
'discuss_progress' => $discussProgress,
Expand Down Expand Up @@ -195,10 +193,13 @@ function verifyACL($sess, $title, $vn, $ns, $t){
'token' => $token
]
];
if(is_array($ACL))
$err = $ACL;
} elseif(is_array($ACL)){
$err = $ACL;
$body = [
'viewName' => 'move',
'title' => $full_title,
'error' => $ACL,
'token' => $token
];
}
break;
case 'history':
Expand Down Expand Up @@ -326,13 +327,13 @@ function verifyACL($sess, $title, $vn, $ns, $t){
if($c['type'] == 'status' || $c['type'] == 'topic' || $c['type'] == 'document')
$cont = $c['content'];
else
$cont = $c['content'];
$cont = PressDo::readSyntax($c['content'], ['thread' => true, 'shortUri' => $conf['UseShortURI']])['html'];
$blocked = ($c['hide_author'])? true:false;
array_push($discuss, [
'id' => $c['no'],
'author' => $c['contributor_m'],
'ip' => $c['contributor_i'],
'text' => PressDo::readSyntax($cont, ['thread' => true, 'shortUri' => $conf['UseShortURI']])['html'],
'text' => $cont,
'date' => $c['datetime'],
'hide_author' => $c['blind'],
'type' => $c['type'],
Expand Down Expand Up @@ -368,16 +369,15 @@ function verifyACL($sess, $title, $vn, $ns, $t){
$actions = ['create_thread', 'write_thread_comment'];
$info = Thread::getThreadInfo($_GET['title']);
$com = Thread::getComments($_GET['title']);
$doci = Docs::findByID($info['docid']);
$threads = [];
$d_perms = [];
if($doci['namespace'] == 'document')
$doctitle = $doci['title'];
if($info['namespace'] == 'document')
$doctitle = $info['title'];
else
$doctitle = $_ns[$doci['namespace']].':'.$doci['title'];
$doctitle = $_ns[$info['namespace']].':'.$info['title'];

foreach ($actions as $a)
if(verifyACL($sess, $doctitle, $a, $_ns[$doci['namespace']], $doci['title']) === true) array_push($d_perms, $a);
if(verifyACL($sess, $doctitle, $a, $_ns[$info['namespace']], $info['title']) === true) array_push($d_perms, $a);

foreach ($com as $c){
if($c['type'] == 'status' || $c['type'] == 'topic' || $c['type'] == 'document')
Expand All @@ -401,8 +401,8 @@ function verifyACL($sess, $title, $vn, $ns, $t){
'viewName' => 'thread',
'data' => [
'document' => [
'namespace' => $_ns[$doci['namespace']],
'title' => $doci['title']
'namespace' => $_ns[$info['namespace']],
'title' => $info['title']
],
'status' => $info['status'],
'topic'=> $info['topic'],
Expand Down Expand Up @@ -539,10 +539,9 @@ function verifyACL($sess, $title, $vn, $ns, $t){
$fetch = Thread::RecentDiscuss($lo);
$resultSet = [];
foreach ($fetch as $f){
$_e = Docs::findByID($f['docid']);
$rs = array(
'slug' => $f['urlstr'],
'document' => ['namespace' => $_ns[$_e['namespace']], 'title' => $_e['title']],
'document' => ['namespace' => $_ns[$f['namespace']], 'title' => $f['title']],
'topic' => $f['topic'],
'date' => $f['last_comment'],
'logtype' => $f['logtype'],
Expand Down

0 comments on commit 4f2d20c

Please sign in to comment.