mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-16 09:49:54 +09:00
git-svn-id: http://xe-core.googlecode.com/svn/trunk@1498 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
96ebb942a0
commit
7f16030e4d
2 changed files with 36 additions and 20 deletions
|
|
@ -48,12 +48,13 @@
|
|||
|
||||
// 임시 파일 저장 장소 지정
|
||||
$tmp_uploaded_path = sprintf('./files/cache/blogapi/%s/%s/', $this->mid, $user_id);
|
||||
$uploaded_target_path = sprintf('/files/cache/blogapi/%s/%s/', $this->mid, $user_id);
|
||||
|
||||
switch($method_name) {
|
||||
// 블로그 정보
|
||||
case 'blogger.getUsersBlogs' :
|
||||
$obj->blogid = $this->mid;
|
||||
$obj->url = Context::getRequestUri().$this->mid;
|
||||
$obj->blogid = $this->mid;
|
||||
$obj->blogName = $this->module_info->browser_title;
|
||||
$blog_list = array($obj);
|
||||
|
||||
|
|
@ -80,16 +81,23 @@
|
|||
|
||||
// 파일 업로드
|
||||
case 'metaWeblog.newMediaObject' :
|
||||
$fileinfo = $params[3];
|
||||
$filedata = base64_decode($fileinfo->value->struct->member[0]->value->base64->body);
|
||||
$filename = $fileinfo->value->struct->member[1]->value->string->body;
|
||||
$fileinfo = $params[3]->value->struct->member;
|
||||
foreach($fileinfo as $key => $val) {
|
||||
$nodename = $val->name->body;
|
||||
if($nodename == 'bits') $filedata = base64_decode($val->value->base64->body);
|
||||
elseif($nodename == 'name') $filename = $val->value->string->body;
|
||||
}
|
||||
|
||||
$tmp_arr = explode('/',$filename);
|
||||
$filename = array_pop($tmp_arr);
|
||||
|
||||
if(!is_dir($tmp_uploaded_path)) FileHandler::makeDir($tmp_uploaded_path);
|
||||
|
||||
$target_filename = sprintf('%s%s', $tmp_uploaded_path, $filename);
|
||||
FileHandler::writeFile($target_filename, $filedata);
|
||||
$obj->url = 'http://blog.nzeo.com/'.$target_filename;
|
||||
|
||||
$content = getXmlRpcResponse('{UPLOADED_PATH}'.$filename);
|
||||
$content = getXmlRpcResponse($obj);
|
||||
break;
|
||||
|
||||
// 글작성
|
||||
|
|
@ -147,7 +155,7 @@
|
|||
$obj->uploaded_count = $file_count;
|
||||
}
|
||||
}
|
||||
$obj->content = str_replace($this->mid.'/{UPLOADED_PATH}',sprintf('./files/attach/images/%s/%s/%s', $this->module_srl, $document_srl, $filename), $obj->content);
|
||||
$obj->content = str_replace($uploaded_target_path,sprintf('/files/attach/images/%s/%s/%s', $this->module_srl, $document_srl, $filename), $obj->content);
|
||||
|
||||
$oDocumentController = &getController('document');
|
||||
$obj->allow_comment = 'Y';
|
||||
|
|
@ -157,9 +165,10 @@
|
|||
if(!$output->toBool()) {
|
||||
$content = getXmlRpcFailure(1, $output->getMessage());
|
||||
} else {
|
||||
$content = getXmlRpcResponse(Context::getRequestUri().$this->mid.'/'.$document_srl);
|
||||
FileHandler::removeDir($tmp_uploaded_path);
|
||||
//$content = getXmlRpcResponse(Context::getRequestUri().$this->mid.'/'.$document_srl);
|
||||
$content = getXmlRpcResponse(''.$document_srl);
|
||||
}
|
||||
FileHandler::removeDir($tmp_uploaded_path);
|
||||
break;
|
||||
|
||||
// 글 수정
|
||||
|
|
@ -224,12 +233,16 @@
|
|||
for($i=0;$i<$file_count;$i++) {
|
||||
$file_info['tmp_name'] = sprintf('%s%s', $tmp_uploaded_path, $file_list[$i]);
|
||||
$file_info['name'] = $file_list[$i];
|
||||
|
||||
$moved_filename = sprintf('./files/attach/images/%s/%s/%s', $this->module_srl, $document_srl, $file_info['name']);
|
||||
if(file_exists($moved_filename)) continue;
|
||||
|
||||
$oFileController->insertFile($file_info, $this->module_srl, $document_srl, 0, true);
|
||||
}
|
||||
$obj->uploaded_count += $file_count;
|
||||
}
|
||||
}
|
||||
$obj->content = str_replace($this->mid.'/{UPLOADED_PATH}',sprintf('./files/attach/images/%s/%s/%s', $this->module_srl, $document_srl, $filename), $obj->content);
|
||||
$obj->content = str_replace($uploaded_target_path,sprintf('/files/attach/images/%s/%s/%s', $this->module_srl, $document_srl, $filename), $obj->content);
|
||||
|
||||
$oDocumentController = &getController('document');
|
||||
$output = $oDocumentController->updateDocument($source_obj,$obj);
|
||||
|
|
|
|||
|
|
@ -24,28 +24,31 @@
|
|||
return $buff;
|
||||
}
|
||||
|
||||
function _getEncodedVal($val) {
|
||||
if(is_int($val)) $buff = sprintf("<i4>%d</i4>\n", $val);
|
||||
elseif(is_double($val)) $buff = sprintf("<double>%f</double>\n", $val);
|
||||
elseif(is_bool($val)) $buff = sprintf("<boolean>%d</boolean>\n", $val?1:0);
|
||||
function _getEncodedVal($val, $is_sub_set = false) {
|
||||
if(is_int($val)) $buff = sprintf("<param><value><i4>%d</i4></value></param>\n", $val);
|
||||
elseif(is_double($val)) $buff = sprintf("<param><value><double>%f</double></value></param>\n", $val);
|
||||
elseif(is_bool($val)) $buff = sprintf("<param><value><boolean>%d</boolean></value></param>\n", $val?1:0);
|
||||
elseif(is_object($val)) {
|
||||
$values = get_object_vars($val);
|
||||
$val_count = count($values);
|
||||
$buff = "<struct>";
|
||||
$buff = "<value><struct>";
|
||||
foreach($values as $k => $v) {
|
||||
$buff .= sprintf("<member>\n<name>%s</name>\n<value>%s</value>\n</member>\n", htmlspecialchars($k), _getEncodedVal($v));
|
||||
}
|
||||
$buff .= "</struct>\n";
|
||||
$buff .= "</struct></value>\n";
|
||||
if(!$is_sub_set) $buff = '<param>'.$buff.'</param>';
|
||||
} elseif(is_array($val)) {
|
||||
$val_count = count($val);
|
||||
$buff = "<array>\n<data>";
|
||||
$buff = "<param><value><array>\n<data>";
|
||||
for($i=0;$i<$val_count;$i++) {
|
||||
$buff .= sprintf("<value>%s</value>\n", _getEncodedVal($val[$i]));
|
||||
$buff .= _getEncodedVal($val[$i], true);
|
||||
//sprintf("<value>%s</value>\n", _getEncodedVal($val[$i]));
|
||||
}
|
||||
$buff .= "</data>\n</array>";
|
||||
$buff .= "</data>\n</array></value></param>";
|
||||
} else {
|
||||
$buff = sprintf("<string>%s</string>\n", $val);
|
||||
$buff = sprintf("<param><value><string>%s</string></value></param>\n", $val);
|
||||
}
|
||||
return sprintf("<param>\n<value>%s</value>\n</param>", $buff);
|
||||
//return sprintf("<param>\n<value>%s</value>\n</param>", $buff);
|
||||
return $buff;
|
||||
}
|
||||
?>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue