Changeset 762

Show
Ignore:
Timestamp:
07/28/06 10:29:57 (2 years ago)
Author:
coolengineer
Message:

* 플러그인에서 기본 API로 이관함.

* 접근 URL 변경:

기존: http://blah/install-path/plugin/BlogAPI
변경: http://blah/install-path/api
추가: http://blah/install-path/api?id=<admin-email>

* .htaliases 의 위치 변경

기존: /install-path/plugin/BlogAPI/.htaliases
변경: /install-path/.htaliases

* TODO: 스킨에 rsd link 삽입. (기존, 플러그인에서 하던 일)

Location:
sandbox
Files:
2 removed
5 copied
1 moved

Legend:

Unmodified
Added
Removed
  • sandbox/blog/api/apicore.php

    r740 r762  
    11<?php 
    2 includeOnce( "Eolin.PHP.Core" ); 
    3 includeOnce( "Eolin.PHP.XMLStruct" ); 
    4 includeOnce( "Eolin.PHP.XMLTree" ); 
    5 includeOnce( "Eolin.PHP.XMLRPC" ); 
    6 includeOnce( "Tattertools.Control.RSS" ); 
    7 includeOnce( "Tattertools.Core" ); 
    8 includeOnce( "Tattertools.Control.Auth" ); 
    9 includeOnce( "Tattertools.Data.Post" ); 
    10 includeOnce( "Tattertools.Data.Category" ); 
     2requireComponent( "Eolin.PHP.Core" ); 
     3requireComponent( "Eolin.PHP.XMLStruct" ); 
     4requireComponent( "Eolin.PHP.XMLTree" ); 
     5requireComponent( "Eolin.PHP.XMLRPC" ); 
     6requireComponent( "Tattertools.Control.RSS" ); 
     7requireComponent( "Tattertools.Core" ); 
     8requireComponent( "Tattertools.Control.Auth" ); 
     9requireComponent( "Tattertools.Data.Post" ); 
     10requireComponent( "Tattertools.Data.Category" ); 
    1111 
    1212/*--------- Tatter tools Core component load   -----------*/ 
     
    1919/*--------- Basic functions -----------*/ 
    2020 
     21function _get_request_id( $id ) 
     22{ 
     23    if( $_GET["id"] ) 
     24    { 
     25        DEBUG( "\nUse url request id: ". $_GET["id"] . "\n"); 
     26        return $_GET["id"]; 
     27    } 
     28    return $id; 
     29} 
     30 
    2131function _get_canonical_id( $id ) 
    2232{ 
    23     global $blogapi_dir; 
    24     $alias_file = $blogapi_dir . "/.htaliases"; 
     33    $alias_file = ROOT . "/.htaliases"; 
     34    $canon = _get_request_id( $id ); 
     35 
    2536    if( !file_exists( $alias_file ) ) 
    2637    { 
    27         return $id; 
    28     } 
     38        return $canon; 
     39    } 
     40 
    2941    $fd = fopen( $alias_file, "r" ); 
    30     $canon = $id; 
    3142    while( !feof($fd) ) 
    3243    { 
     
    428439function _deleteAttachment($owner,$parent,$name){ 
    429440    global $database, $blogapi_dir; 
    430     @unlink("$blogapi_dir/../../attach/$owner/$name"); 
     441    @unlink(ROOT . "/attach/$owner/$name"); 
    431442    $name=mysql_escape_string($name); 
    432443    $parent_clause = ""; 
  • sandbox/blog/api/index.php

    r740 r762  
    11<?php 
     2define('ROOT', '../..'); 
     3require ROOT . '/lib/include.php'; 
     4 
    25/*--------- Debugging environment -----------*/ 
    36global $debug, $debug_file, $blogapi_dir; 
    47$debug = 0; /* DEBUGLOG */ 
    5 $debug_file = "../../plugins/BlogAPI/.htdebug.log"; 
     8$debug_file = ROOT . "/.htdebug.log"; 
    69$blogapi_dir = dirname( __FILE__ ); 
    710 
     
    3336} 
    3437 
    35 /*--------- Tatter tools Core component load   -----------*/ 
    36  
    37 function includeOnce($name){ 
    38     global $blogapi_dir; 
    39     if(!ereg('^[[:alnum:]]+[[:alnum:].]+$',$name)) 
    40         return ; 
    41     if( TATTERTOOLS_VERSION < "1.0.6" && file_exists( $blogapi_dir . "/$name.php" ) ) 
    42     { 
    43         DEBUG ( $blogapi_dir . "/$name.php\n"); 
    44         include_once( $blogapi_dir . "/$name.php"); 
    45     } 
    46     else 
    47     { 
    48         $componet_file = $blogapi_dir . "/../../components/$name.php"; 
    49         if( file_exists( $componet_file ) ) 
    50         { 
    51             include_once( $componet_file ); 
    52         } 
    53         else 
    54         { 
    55             print( "File($componet_file) doesn't exist\n" ); 
    56         } 
    57     } 
    58 } 
    59  
    6038/*--------- API main ---------------*/ 
    6139function BlogAPI() 
     
    7048{ 
    7149    global $hostURL, $blogURL; 
    72     $target .= '<link rel="EditURI" type="application/rsd+xml" title="RSD" href="'.$hostURL.$blogURL.'/plugin/BlogAPI/rsd" />'.CRLF; 
     50    $target .= '<link rel="EditURI" type="application/rsd+xml" title="RSD" href="'.$hostURL.$blogURL.'/api/rsd" />'.CRLF; 
    7351    return $target; 
    7452} 
     
    7755{ 
    7856    global $hostURL, $blogURL; 
    79     global $service; 
    8057    global $owner; 
    8158    $homeurl = $hostURL.$blogURL; 
    82     $apiurl = $homeurl . "/plugin/BlogAPI"; 
    83     $blogid = $service['domain'] . $blogURL; 
     59    $apiurl = $homeurl . "/api"; 
    8460    $blogid = $owner; 
    8561 
     
    9874} 
    9975 
    100 function BlogAPITest() 
     76if( substr( $_SERVER["REQUEST_URI"], -8 ) == "/api/rsd" ) 
    10177{ 
    102     global $debug,$service, $blog; 
    103     if( !$debug ) 
    104     { 
    105         print( "<b>Set \"\$debug = 1;\" in " . __FILE__ ); 
    106         return; 
    107     } 
    108     print( "<pre>" ); 
    109     print( dirname(__FILE__) . "\n" ); 
    110     print( "Test page for checking.\n" ); 
    111     print( "Tatter tools version: " . TATTERTOOLS_VERSION . "\n"); 
    112     print( "Tatter tools root: " . ROOT . "\n"); 
    113     print( "Included " ); 
    114     print_r( get_included_files() ); 
    115     print( "</pre>" ); 
     78    SendRSD(); 
    11679} 
    117  
    118 function BlogAPIAtom() 
     80else 
    11981{ 
    120     includeOnce( "atom" ); 
    121     DoAtom(); 
     82    BlogAPI(); 
    12283} 
    12384?> 
  • sandbox/blog/api/metaweblog.php

    r740 r762  
    256256function metaWeblog_newMediaObject() 
    257257{ 
    258     global $blogapi_dir, $owner; 
     258    global $owner; 
    259259    DEBUG( "Enter: " . __FUNCTION__ . "\n" ); 
    260260    $params = func_get_args(); 
     
    268268    $mediaOjbect = $params[3]['bits']; 
    269269 
    270     $tmp_dir = "$blogapi_dir/../../attach/temp"; 
     270    $tmp_dir = ROOT. "/attach/temp"; 
    271271    if( !is_dir( $tmp_dir ) ) 
    272272    {