Example #1
0
<?
/**
 * 
 * 임시 저장
 *
 * @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(!$member['mb_id']) wiki_ajax_error('로그인한 사용자만 사용할 수 있습니다.');
if(!$wr_doc) wiki_ajax_error('문서 제목이 누락되었습니다.');
if(!$wr_content) wiki_ajax_error('문서 내용이 없습니다.'); 

$id = md5($member['mb_id']."_".$wr_doc);
$reg = "tmpsave/$id";	
wiki_set_option($reg, array("wr_content", "wr_date"), array($wr_content, date("Y-m-d h:i:s")));

echo json_encode(array('code'=>1));

?>
Example #2
0
	/**
	 * 
	 * 문서 잠금 해제
	 * 
	 * @param string $doc 경로를 포함한 문서명
	 */
	protected function unlock($doc) {
		$doc_code = md5($doc);		
		wiki_set_option("locked_docs/$doc_code", null, null);	// remove
	}
Example #3
0
        $count++;
    }
    $fileName = $fileName_a . '_' . $count . $fileName_b;
}
// Create target dir
if (!file_exists($targetDir)) {
    @mkdir($targetDir);
}
// Look for the content type header
if (isset($_SERVER["HTTP_CONTENT_TYPE"])) {
    $contentType = $_SERVER["HTTP_CONTENT_TYPE"];
}
if (isset($_SERVER["CONTENT_TYPE"])) {
    $contentType = $_SERVER["CONTENT_TYPE"];
}
wiki_set_option("uploading", $fileName, time());
// Handle non multipart uploads older WebKit versions didn't support multipart in HTML5
if (strpos($contentType, "multipart") !== false) {
    if (isset($_FILES['file']['tmp_name']) && is_uploaded_file($_FILES['file']['tmp_name'])) {
        // Open temp file
        $out = fopen($targetDir . DIRECTORY_SEPARATOR . $fileName, $chunk == 0 ? "wb" : "ab");
        if ($out) {
            // Read binary input stream and append it to temp file
            $in = fopen($_FILES['file']['tmp_name'], "rb");
            if ($in) {
                while ($buff = fread($in, 4096)) {
                    fwrite($out, $buff);
                }
            } else {
                die('{"jsonrpc" : "2.0", "error" : {"code": 101, "message": "파일 입력 스트림 생성 실패 1"}, "id" : "id"}');
            }
Example #4
0
// 최근 변경 내역 업데이트
$wikiChanges =& wiki_class_load("Changes");
$status = "새문서";

if($w == "u") {
	$thumb =& wiki_class_load("Thumb");				
	$thumb->deleteThumb($wiki['bo_table']."-".$wr_id . "-");
}	

if($w == 'u') $status = "편집";	
$wikiChanges->update("DOC", $fullname, $status, ($member['mb_id'] ? $member['mb_id'] : $wr_name));				

// 임시저장 삭제
$id = md5($member['mb_id']."_".stripcslashes($wr_doc));
$reg = "tmpsave/$id";	
wiki_set_option($reg, null, null);

@mkdir(WIKI_PATH."/data/$bo_table");
@chmod(WIKI_PATH."/data/$bo_table", 0707);
@mkdir(WIKI_PATH."/data/$bo_table/css");
@chmod(WIKI_PATH."/data/$bo_table/css", 0707);
@mkdir(WIKI_PATH."/data/$bo_table/files");
@chmod(WIKI_PATH."/data/$bo_table/files", 0707);
@mkdir(WIKI_PATH."/data/$bo_table/js");
@chmod(WIKI_PATH."/data/$bo_table/js", 0707);
@mkdir(WIKI_PATH."/data/$bo_table/thumb");
@chmod(WIKI_PATH."/data/$bo_table/thumb", 0707);

?>

Example #5
0
	
wiki_set_option("uploading", $file, null);

// uploading 이 기록된 시간이 6시간 이전이면..
// (6시간 이전에 파일 올리다 중단된 것이면)
// 삭제
$ctime = time();
$expire = 6*60*60; // 6시간
$not_completed_files = wiki_get_option("uploading");
if(!empty($not_completed_files)) {
	foreach($not_completed_files as $file => $timestamp) {	
		if($ctime - $timestamp > $expire) {		
			$deleted = $media->deleteUnusedFile($file);
			unset($not_completed_files[$file]);
		}
	}		
	$uploading_files = array();
	$uploading_times = array();
	foreach($not_completed_files as $file => $timestamp) {
		array_push($uploading_files, $file);
		array_push($uploading_times, $timestamp);
	}	
	wiki_set_option("uploading", $uploading_files, $uploading_times);
} else {
	wiki_set_option("uploading", null, null);
}

echo $json;

?>