mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-05-12 13:32:16 +09:00
git-svn-id: http://xe-core.googlecode.com/svn/trunk@1826 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
0b40c9e772
commit
e74c0e7035
7 changed files with 324 additions and 273 deletions
15
.htaccess
15
.htaccess
|
|
@ -6,22 +6,25 @@ RewriteRule ^([a-zA-Z0-9_]+)/([[:digit:]]+)page$ ./index.php?mid=$1&page=$2 [L]
|
|||
# administrator page
|
||||
RewriteRule ^admin$ ./index.php?module=admin [L]
|
||||
|
||||
# mid + act
|
||||
RewriteRule ^([a-zA-Z0-9_]+)/api$ ./index.php?mid=$1&act=api [L]
|
||||
|
||||
# document permanent link
|
||||
RewriteRule ^([[:digit:]]+)$ ./index.php?document_srl=$1 [L]
|
||||
|
||||
# document + act permanent link
|
||||
# document + act link
|
||||
RewriteRule ^([[:digit:]]+)/([a-zA-Z0-9_]+)$ ./index.php?document_srl=$1&act=$2 [L]
|
||||
|
||||
# mid + document permanent link
|
||||
# mid + document link
|
||||
RewriteRule ^([a-zA-Z0-9_]+)/([[:digit:]]+)$ ./index.php?mid=$1&document_srl=$2 [L]
|
||||
|
||||
# mid + act permanent link
|
||||
# mid + act link
|
||||
RewriteRule ^([a-zA-Z0-9_]+)/([a-zA-Z0-9_]+)$ ./index.php?mid=$1&act=$2 [L]
|
||||
|
||||
# mid + page permanent link
|
||||
# mid + page link
|
||||
RewriteRule ^([a-zA-Z0-9_]+)/page/([[:digit:]]+)$ ./index.php?mid=$1&page=$2 [L]
|
||||
|
||||
# mid + category permanent link
|
||||
# mid + category link
|
||||
RewriteRule ^([a-zA-Z0-9_]+)/category/([[:digit:]]+)$ ./index.php?mid=$1&category=$2 [L]
|
||||
|
||||
# mid + category + page
|
||||
|
|
@ -39,5 +42,5 @@ RewriteRule ^([a-zA-Z0-9_]+)/tag/(.*)$ ./index.php?mid=$1&search_target=tag&sear
|
|||
# mid + search target writer
|
||||
RewriteRule ^([a-zA-Z0-9_]+)/writer/(.*)$ ./index.php?mid=$1&search_target=nick_name&search_keyword=$2 [L]
|
||||
|
||||
# module permanent link
|
||||
# module link
|
||||
RewriteRule ^([a-zA-Z0-9_]+)(/){0,1}$ ./index.php?mid=$1 [L]
|
||||
|
|
|
|||
|
|
@ -19,12 +19,23 @@
|
|||
Context::addHtmlHeader(" ".'<link rel="EditURI" type="application/rsd+xml" title="RSD" href="'.$rsd_url.'" />');
|
||||
}
|
||||
|
||||
// called_position가 before_module_proc일때 실행
|
||||
if($called_position != 'before_module_proc' || $_REQUEST['act'] != 'api') return;
|
||||
// act가 api가 아니면 그냥 리턴~
|
||||
if($_REQUEST['act']!='api') return;
|
||||
|
||||
/**
|
||||
* blogapi의 경우 GET argument와 XML Content가 같이 오기에 제로보드XE의 경우 XML Content가 오면 이것만 처리하기에
|
||||
* GET argument중에 mid값을 강제 설정해야 모듈을 정상적으로 찾는다
|
||||
**/
|
||||
if($called_position == 'before_module_init') {
|
||||
$mid = $_REQUEST['mid'];
|
||||
Context::set('mid', $mid, true);
|
||||
$this->mid = $mid;
|
||||
}
|
||||
|
||||
// 관련 func 파일 읽음
|
||||
require_once('./addons/blogapi/blogapi.func.php');
|
||||
|
||||
// xmlprc 파싱
|
||||
// 요청된 xmlrpc를 파싱
|
||||
$oXmlParser = new XmlParser();
|
||||
$xmlDoc = $oXmlParser->parse();
|
||||
|
|
@ -40,6 +51,9 @@
|
|||
$user_id = trim($params[1]->value->string->body);
|
||||
$password = trim($params[2]->value->string->body);
|
||||
|
||||
// 모듈 실행전이라면 인증을 처리한다.
|
||||
if($called_position == 'before_module_init') {
|
||||
|
||||
// member controller을 이용해서 로그인 시도
|
||||
if($user_id && $password) {
|
||||
$oMemberController = &getController('member');
|
||||
|
|
@ -49,6 +63,18 @@
|
|||
$content = getXmlRpcFailure(1, $output->getMessage());
|
||||
printContent($content);
|
||||
}
|
||||
} else {
|
||||
$content = getXmlRpcFailure(1, 'not logged');
|
||||
printContent($content);
|
||||
}
|
||||
}
|
||||
|
||||
// 모듈에서 무언가 작업을 하기 전에 blogapi tool의 요청에 대한 처리를 하고 강제 종료한다.
|
||||
if($called_position == 'before_module_proc') {
|
||||
|
||||
// 글쓰기 권한 체크 (권한명의 경우 약속이 필요할듯..)
|
||||
if(!$this->grant->write_document) {
|
||||
printContent( getXmlRpcFailure(1, 'no permission') );
|
||||
}
|
||||
|
||||
// 카테고리의 정보를 구해옴
|
||||
|
|
@ -92,6 +118,11 @@
|
|||
|
||||
// 파일 업로드
|
||||
case 'metaWeblog.newMediaObject' :
|
||||
// 파일 업로드 권한 체크
|
||||
if(!$this->grant->fileupload) {
|
||||
printContent( getXmlRpcFailure(1, 'no permission') );
|
||||
}
|
||||
|
||||
$fileinfo = $params[3]->value->struct->member;
|
||||
foreach($fileinfo as $key => $val) {
|
||||
$nodename = $val->name->body;
|
||||
|
|
@ -106,7 +137,7 @@
|
|||
|
||||
$target_filename = sprintf('%s%s', $tmp_uploaded_path, $filename);
|
||||
FileHandler::writeFile($target_filename, $filedata);
|
||||
$obj->url = 'http://blog.nzeo.com/'.$target_filename;
|
||||
$obj->url = Context::getRequestUri().$target_filename;
|
||||
|
||||
$content = getXmlRpcResponse($obj);
|
||||
printContent($content);
|
||||
|
|
@ -193,13 +224,15 @@
|
|||
|
||||
$oDocumentModel = &getModel('document');
|
||||
$oDocument = $oDocumentModel->getDocument($document_srl);
|
||||
$obj = $oDocument->getObjectVars();
|
||||
|
||||
// 글 수정 권한 체크
|
||||
if(!$oDocument->isGranted()) {
|
||||
$content = getXmlRpcFailure(1, 'no permisstion');
|
||||
$content = getXmlRpcFailure(1, 'no permission');
|
||||
break;
|
||||
}
|
||||
|
||||
$obj = $oDocument->getObjectVars();
|
||||
|
||||
$info = $params[3];
|
||||
|
||||
// 글, 제목, 카테고리 정보 구함
|
||||
|
|
@ -277,6 +310,16 @@
|
|||
$tmp_arr = explode('/', $tmp_val);
|
||||
$document_srl = array_pop($tmp_arr);
|
||||
|
||||
// 글 받아오기
|
||||
$oDocumentModel = &getModel('document');
|
||||
$oDocument = $oDocumentModel->getDocument($document_srl);
|
||||
|
||||
// 글 삭제 권한 체크
|
||||
if(!$oDocument->isGranted()) {
|
||||
$content = getXmlRpcFailure(1, 'no permission');
|
||||
break;
|
||||
}
|
||||
|
||||
$oDocumentController = &getController('document');
|
||||
$output = $oDocumentController->deleteDocument($document_srl);
|
||||
if(!$output->toBool()) $content = getXmlRpcFailure(1, $output->getMessage());
|
||||
|
|
@ -347,4 +390,5 @@ RSDContent;
|
|||
printContent($content);
|
||||
break;
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@
|
|||
* @brief blogapi구현을 위한 함수 모음집
|
||||
**/
|
||||
|
||||
// 오류 표시
|
||||
function getXmlRpcFailure($error, $message) {
|
||||
return
|
||||
sprintf(
|
||||
|
|
@ -16,6 +17,7 @@
|
|||
);
|
||||
}
|
||||
|
||||
// 결과 표시
|
||||
function getXmlRpcResponse($params) {
|
||||
$buff = '<?xml version="1.0" encoding="utf-8"?>'."\n<methodResponse><params>";
|
||||
$buff .= _getEncodedVal($params);
|
||||
|
|
@ -24,6 +26,7 @@
|
|||
return $buff;
|
||||
}
|
||||
|
||||
// 인코딩 처리
|
||||
function _getEncodedVal($val, $is_sub_set = false) {
|
||||
if(is_int($val)) $buff = sprintf("<value><i4>%d</i4></value>", $val);
|
||||
elseif(is_double($val)) $buff = sprintf("<value><double>%f</double></value>", $val);
|
||||
|
|
@ -50,6 +53,7 @@
|
|||
return $buff;
|
||||
}
|
||||
|
||||
// 결과 출력
|
||||
function printContent($content) {
|
||||
header("Content-Type: text/xml; charset=UTF-8");
|
||||
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
|
||||
|
|
|
|||
|
|
@ -380,7 +380,7 @@
|
|||
* @brief GET/POST방식일 경우 처리
|
||||
**/
|
||||
function _setRequestArgument() {
|
||||
if($this->_getRequestMethod() == 'XMLRPC') return;
|
||||
//if($this->_getRequestMethod() == 'XMLRPC') return;
|
||||
if(!count($_REQUEST)) return;
|
||||
|
||||
foreach($_REQUEST as $key => $val) {
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@
|
|||
* 0 : files/_debug_message.php 에 연결하여 출력
|
||||
* 1 : Response Method 가 XML 형식이 아닐 경우 브라우저에 최상단에 주석으로 표시
|
||||
**/
|
||||
define('__DEBUG_OUTPUT__', 1);
|
||||
define('__DEBUG_OUTPUT__', 0);
|
||||
|
||||
/**
|
||||
* @brief 디버깅 메세지 출력
|
||||
|
|
@ -24,7 +24,7 @@
|
|||
* 2 : 1 + DB 쿼리
|
||||
* 3 : 모든 로그
|
||||
**/
|
||||
define('__DEBUG__', 1);
|
||||
define('__DEBUG__', 0);
|
||||
|
||||
/**
|
||||
* @brief 간단하게 사용하기 위한 함수 정의한 파일 require
|
||||
|
|
|
|||
|
|
@ -184,7 +184,7 @@
|
|||
* tail -f ./files/_debug_message.php 하여 계속 살펴 볼 수 있다
|
||||
**/
|
||||
function debugPrint($buff = null, $display_line = true) {
|
||||
if(!$buff) return;
|
||||
//if(!$buff) return;
|
||||
|
||||
if(__DEBUG_OUTPUT__==1) {
|
||||
print sprintf("<!--\n%s\n-->", print_r($buff,true));
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
<form id="fo_insert_member" action="./" method="get" onsubmit="return procFilter(this, insert)">
|
||||
<input type="hidden" name="page" value="{$page}" />
|
||||
<input type="hidden" name="member_srl" value="{$member_srl}" />
|
||||
<input type="hidden" name="member_srl" value="{$member_info->member_srl}" />
|
||||
<input type="hidden" name="content" value="{htmlspecialchars($member_info->signature)}" />
|
||||
<!--@if($member_info->member_srl)-->
|
||||
<input type="hidden" name="user_id" value="{htmlspecialchars($member_info->user_id)}" />
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue