Dotclear


Ignore:
Timestamp:
11/17/13 20:25:53 (12 years ago)
Author:
franck <carnet.franck.paul@…>
Branch:
2.6
Children:
2567:6c11245cbf04, 2568:61c67a7d17fa
Message:

Add some people in CREDITS, remove trailing spaces and tabs.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • inc/core/class.dc.xmlrpc.php

    r1968 r2566  
    2121     private $trace_args = true; 
    2222     private $trace_response = true; 
    23       
     23 
    2424     public function __construct($core,$blog_id) 
    2525     { 
    2626          parent::__construct(); 
    27            
     27 
    2828          $this->core =& $core; 
    2929          $this->blog_id = $blog_id; 
    30            
     30 
    3131          # Blogger methods 
    3232          $this->addCallback('blogger.newPost',array($this,'blogger_newPost'), 
    3333               array('string','string','string','string','string','string','integer'), 
    3434               'New post'); 
    35            
     35 
    3636          $this->addCallback('blogger.editPost',array($this,'blogger_editPost'), 
    3737               array('boolean','string','string','string','string','string','integer'), 
    3838               'Edit a post'); 
    39            
     39 
    4040          $this->addCallback('blogger.getPost',array($this,'blogger_getPost'), 
    4141               array('struct','string','integer','string','string'), 
    4242               'Return a posts by ID'); 
    43            
     43 
    4444          $this->addCallback('blogger.deletePost',array($this,'blogger_deletePost'), 
    4545               array('string','string','string','string','string','integer'), 
    4646               'Delete a post'); 
    47            
     47 
    4848          $this->addCallback('blogger.getRecentPosts',array($this,'blogger_getRecentPosts'), 
    4949               array('array','string','string','string','string','integer'), 
    5050               'Return a list of recent posts'); 
    51            
     51 
    5252          $this->addCallback('blogger.getUsersBlogs',array($this,'blogger_getUserBlogs'), 
    5353               array('struct','string','string','string'), 
    5454               "Return user's blog"); 
    55            
     55 
    5656          $this->addCallback('blogger.getUserInfo',array($this,'blogger_getUserInfo'), 
    5757               array('struct','string','string','string'), 
    5858               'Return User Info'); 
    59            
     59 
    6060          # Metaweblog methods 
    6161          $this->addCallback('metaWeblog.newPost',array($this,'mw_newPost'), 
    6262               array('string','string','string','string','struct','boolean'), 
    6363               'Creates a new post, and optionnaly publishes it.'); 
    64            
     64 
    6565          $this->addCallback('metaWeblog.editPost',array($this,'mw_editPost'), 
    6666               array('boolean','string','string','string','struct','boolean'), 
    6767               'Updates information about an existing entry'); 
    68            
     68 
    6969          $this->addCallback('metaWeblog.getPost',array($this,'mw_getPost'), 
    7070               array('struct','string','string','string'), 
    7171               'Returns information about a specific post'); 
    72            
     72 
    7373          $this->addCallback('metaWeblog.getRecentPosts',array($this,'mw_getRecentPosts'), 
    7474               array('array','string','string','string','integer'), 
    7575               'List of most recent posts in the system'); 
    76            
     76 
    7777          $this->addCallback('metaWeblog.getCategories',array($this,'mw_getCategories'), 
    7878               array('array','string','string','string'), 
    7979               'List of all categories defined in the weblog'); 
    80            
     80 
    8181          $this->addCallback('metaWeblog.newMediaObject',array($this,'mw_newMediaObject'), 
    8282               array('struct','string','string','string','struct'), 
    8383               'Upload a file on the web server'); 
    84            
     84 
    8585          # MovableType methods 
    8686          $this->addCallback('mt.getRecentPostTitles',array($this,'mt_getRecentPostTitles'), 
    8787               array('array','string','string','string','integer'), 
    8888               'List of most recent posts in the system'); 
    89            
     89 
    9090          $this->addCallback('mt.getCategoryList',array($this,'mt_getCategoryList'), 
    9191               array('array','string','string','string'), 
    9292               'List of all categories defined in the weblog'); 
    93            
     93 
    9494          $this->addCallback('mt.getPostCategories',array($this,'mt_getPostCategories'), 
    9595               array('array','string','string','string'), 
    9696               'List of all categories to which the post is assigned'); 
    97            
     97 
    9898          $this->addCallback('mt.setPostCategories',array($this,'mt_setPostCategories'), 
    9999               array('boolean','string','string','string','array'), 
    100100               'Sets the categories for a post'); 
    101            
     101 
    102102          $this->addCallback('mt.publishPost',array($this,'mt_publishPost'), 
    103103               array('boolean','string','string','string'), 
    104104               'Retrieve pings list for a post'); 
    105            
     105 
    106106          $this->addCallback('mt.supportedMethods',array($this,'listMethods'), 
    107107               array(),'Retrieve information about the XML-RPC methods supported by the server.'); 
    108            
     108 
    109109          $this->addCallback('mt.supportedTextFilters',array($this,'mt_supportedTextFilters'), 
    110110               array(),'Retrieve information about supported text filters.'); 
    111            
     111 
    112112          # WordPress methods 
    113113          $this->addCallback('wp.getUsersBlogs',array($this,'wp_getUsersBlogs'), 
    114114               array('array','string','string'), 
    115115               'Retrieve the blogs of the user.'); 
    116            
     116 
    117117          $this->addCallback('wp.getPage',array($this,'wp_getPage'), 
    118118               array('struct','integer','integer','string','string'), 
    119119               'Get the page identified by the page ID.'); 
    120            
     120 
    121121          $this->addCallback('wp.getPages',array($this,'wp_getPages'), 
    122122               array('array','integer','string','string','integer'), 
    123123               'Get an array of all the pages on a blog.'); 
    124            
     124 
    125125          $this->addCallback('wp.newPage',array($this,'wp_newPage'), 
    126126               array('integer','integer','string','string','struct','boolean'), 
    127127               'Create a new page.'); 
    128            
     128 
    129129          $this->addCallback('wp.deletePage',array($this,'wp_deletePage'), 
    130130               array('boolean','integer','string','string','integer'), 
    131131               'Removes a page from the blog.'); 
    132            
     132 
    133133          $this->addCallback('wp.editPage',array($this,'wp_editPage'), 
    134134               array('boolean','integer','integer','string','string','struct','boolean'), 
    135135               'Make changes to a blog page.'); 
    136            
     136 
    137137          $this->addCallback('wp.getPageList',array($this,'wp_getPageList'), 
    138138               array('array','integer','string','string'), 
    139139               'Get an array of all the pages on a blog. Just the minimum details, lighter than wp.getPages.'); 
    140            
     140 
    141141          $this->addCallback('wp.getAuthors',array($this,'wp_getAuthors'), 
    142142               array('array','integer','string','string'), 
    143143               'Get an array of users for the blog.'); 
    144            
     144 
    145145          $this->addCallback('wp.getCategories',array($this,'wp_getCategories'), 
    146146               array('array','integer','string','string'), 
    147147               'Get an array of available categories on a blog.'); 
    148            
     148 
    149149          $this->addCallback('wp.getTags',array($this,'wp_getTags'), 
    150150               array('array','integer','string','string'), 
    151151               'Get list of all tags for the blog.'); 
    152            
     152 
    153153          $this->addCallback('wp.newCategory',array($this,'wp_newCategory'), 
    154154               array('integer','integer','string','string','struct'), 
    155155               'Create a new category.'); 
    156            
     156 
    157157          $this->addCallback('wp.deleteCategory',array($this,'wp_deleteCategory'), 
    158158               array('boolean','integer','string','string','integer'), 
    159159               'Delete a category with a given ID.'); 
    160            
     160 
    161161          $this->addCallback('wp.suggestCategories',array($this,'wp_suggestCategories'), 
    162162               array('array','integer','string','string','string','integer'), 
    163163               'Get an array of categories that start with a given string.'); 
    164            
     164 
    165165          $this->addCallback('wp.uploadFile',array($this,'wp_uploadFile'), 
    166166               array('struct','integer','string','string','struct'), 
    167167               'Upload a file'); 
    168            
     168 
    169169          $this->addCallback('wp.getPostStatusList',array($this,'wp_getPostStatusList'), 
    170170               array('array','integer','string','string'), 
    171171               'Retrieve all of the post statuses.'); 
    172            
     172 
    173173          $this->addCallback('wp.getPageStatusList',array($this,'wp_getPageStatusList'), 
    174174               array('array','integer','string','string'), 
    175175               'Retrieve all of the pages statuses.'); 
    176            
     176 
    177177          $this->addCallback('wp.getPageTemplates',array($this,'wp_getPageTemplates'), 
    178178               array('struct','integer','string','string'), 
    179179               'Retrieve page templates.'); 
    180            
     180 
    181181          $this->addCallback('wp.getOptions',array($this,'wp_getOptions'), 
    182182               array('struct','integer','string','string','array'), 
    183183               'Retrieve blog options'); 
    184            
     184 
    185185          $this->addCallback('wp.setOptions',array($this,'wp_setOptions'), 
    186186               array('struct','integer','string','string','struct'), 
    187187               'Update blog options'); 
    188            
     188 
    189189          $this->addCallback('wp.getComment',array($this,'wp_getComment'), 
    190190               array('struct','integer','string','string','integer'), 
    191191               "Gets a comment, given it's comment ID."); 
    192            
     192 
    193193          $this->addCallback('wp.getCommentCount',array($this,'wp_getCommentCount'), 
    194194               array('array','integer','string','string','integer'), 
    195195               'Retrieve comment count.'); 
    196            
     196 
    197197          $this->addCallback('wp.getComments',array($this,'wp_getComments'), 
    198198               array('array','integer','string','string','struct'), 
    199199               'Gets a set of comments for a given post.'); 
    200            
     200 
    201201          $this->addCallback('wp.deleteComment',array($this,'wp_deleteComment'), 
    202202               array('boolean','integer','string','string','integer'), 
    203203               'Delete a comment with given ID.'); 
    204            
     204 
    205205          $this->addCallback('wp.editComment',array($this,'wp_editComment'), 
    206206               array('boolean','integer','string','string','integer','struct'), 
    207207               'Edit a comment with given ID.'); 
    208            
     208 
    209209          $this->addCallback('wp.newComment',array($this,'wp_newComment'), 
    210210               array('integer','integer','string','string','integer','struct'), 
    211211               'Create a new comment for a given post ID.'); 
    212            
     212 
    213213          $this->addCallback('wp.getCommentStatusList',array($this,'wp_getCommentStatusList'), 
    214214               array('array','integer','string','string'), 
    215215               'Retrieve all of the comment statuses.'); 
    216                 
     216 
    217217          # Pingback support 
    218218          $this->addCallback('pingback.ping',array($this,'pingback_ping'), 
     
    220220               'Notify a link to a post.'); 
    221221     } 
    222       
     222 
    223223     public function serve($data=false,$encoding='UTF-8') 
    224224     { 
    225225          parent::serve(false,$encoding); 
    226226     } 
    227       
     227 
    228228     public function call($methodname,$args) 
    229229     { 
     
    237237          } 
    238238     } 
    239       
     239 
    240240     private function debugTrace($methodname,$args,$rsp) 
    241241     { 
     
    243243               return; 
    244244          } 
    245            
     245 
    246246          if (($fp = @fopen($this->debug_file,'a')) !== false) 
    247247          { 
    248248               fwrite($fp,'['.date('r').']'.' '.$methodname); 
    249                 
     249 
    250250               if ($this->trace_args) { 
    251251                    fwrite($fp,"\n- args ---\n".var_export($args,1)); 
    252252               } 
    253                 
     253 
    254254               if ($this->trace_response) { 
    255255                    fwrite($fp,"\n- response ---\n".var_export($rsp,1)); 
     
    259259          } 
    260260     } 
    261       
     261 
    262262     /* Internal methods 
    263263     --------------------------------------------------- */ 
     
    267267               return true; 
    268268          } 
    269            
     269 
    270270          if ($this->core->auth->checkUser($user_id,$pwd) !== true) { 
    271271               throw new Exception('Login error'); 
    272272          } 
    273            
     273 
    274274          return true; 
    275275     } 
    276       
     276 
    277277     private function setBlog($bypass = false) 
    278278     { 
     
    280280               throw new Exception('No blog ID given.'); 
    281281          } 
    282            
     282 
    283283          if ($this->blog_loaded) { 
    284284               return true; 
    285285          } 
    286            
     286 
    287287          $this->core->setBlog($this->blog_id); 
    288288          $this->blog_loaded = true; 
    289            
     289 
    290290          if (!$this->core->blog->id) { 
    291291               $this->core->blog = null; 
    292292               throw new Exception('Blog does not exist.'); 
    293293          } 
    294            
     294 
    295295          if (!$bypass && 
    296296               (!$this->core->blog->settings->system->enable_xmlrpc || 
     
    299299               throw new Exception('Not enough permissions on this blog.'); 
    300300          } 
    301            
     301 
    302302          foreach ($this->core->plugins->getModules() as $id => $m) { 
    303303               $this->core->plugins->loadNsFile($id,'xmlrpc'); 
    304304          } 
    305            
     305 
    306306          return true; 
    307307     } 
    308       
     308 
    309309     private function getPostRS($post_id,$user,$pwd,$post_type='post') 
    310310     { 
     
    315315               'post_type' => $post_type 
    316316          )); 
    317            
     317 
    318318          if ($rs->isEmpty()) { 
    319319               throw new Exception('This entry does not exist'); 
    320320          } 
    321            
     321 
    322322          return $rs; 
    323323     } 
    324       
     324 
    325325     private function getCatID($cat_url) 
    326326     { 
    327327          $rs = $this->core->blog->getCategories(array('cat_url' => $cat_url)); 
    328            
     328 
    329329          return $rs->isEmpty() ? null : $rs->cat_id; 
    330330     } 
    331       
     331 
    332332     /* Generic methods 
    333333     --------------------------------------------------- */ 
     
    336336          $this->setUser($user,$pwd); 
    337337          $this->setBlog(); 
    338            
     338 
    339339          $title = !empty($struct['title']) ? $struct['title'] : ''; 
    340340          $excerpt = !empty($struct['mt_excerpt']) ? $struct['mt_excerpt'] : ''; 
     
    343343          $open_comment = isset($struct['mt_allow_comments']) ? $struct['mt_allow_comments'] : 1; 
    344344          $open_tb = isset($struct['mt_allow_pings']) ? $struct['mt_allow_pings'] : 1; 
    345            
     345 
    346346          if ($description !== null) { 
    347347               $content = $description; 
    348348          } 
    349            
     349 
    350350          if (!$title) { 
    351351               $title = text::cutString(html::clean($content),25).'...'; 
    352352          } 
    353            
     353 
    354354          $excerpt_xhtml = $this->core->callFormater('xhtml',$excerpt); 
    355355          $content_xhtml = $this->core->callFormater('xhtml',$content); 
    356            
     356 
    357357          if (empty($content)) { 
    358358               throw new Exception('Cannot create an empty entry'); 
    359359          } 
    360            
     360 
    361361          $cur = $this->core->con->openCursor($this->core->prefix.'post'); 
    362            
     362 
    363363          $cur->user_id = $this->core->auth->userID(); 
    364364          $cur->post_lang = $this->core->auth->getInfo('user_lang'); 
     
    372372          $cur->post_status = (integer) $publish; 
    373373          $cur->post_format = 'xhtml'; 
    374            
     374 
    375375          if ($dateCreated) { 
    376376               if ($dateCreated instanceof xmlrpcDate) { 
     
    380380               } 
    381381          } 
    382            
     382 
    383383          # Categories in an array 
    384384          if (isset($struct['categories']) && is_array($struct['categories'])) 
     
    386386               $categories = $struct['categories']; 
    387387               $cat_id = !empty($categories[0]) ? $categories[0] : null; 
    388                 
     388 
    389389               $cur->cat_id = $this->getCatID($cat_id); 
    390390          } 
    391            
     391 
    392392          if (isset($struct['wp_slug'])) { 
    393393               $cur->post_url = $struct['wp_slug']; 
    394394          } 
    395            
     395 
    396396          if (isset($struct['wp_password'])) { 
    397397               $cur->post_password = $struct['wp_password']; 
    398398          } 
    399            
     399 
    400400          $cur->post_type = 'post'; 
    401401          if (!empty($struct['post_type'])) { 
    402402               $cur->post_type = $struct['post_type']; 
    403403          } 
    404            
     404 
    405405          if ($cur->post_type == 'post') 
    406406          { 
    407407               # --BEHAVIOR-- xmlrpcBeforeNewPost 
    408408               $this->core->callBehavior('xmlrpcBeforeNewPost',$this,$cur,$content,$struct,$publish); 
    409                 
     409 
    410410               $post_id = $this->core->blog->addPost($cur); 
    411                 
     411 
    412412               # --BEHAVIOR-- xmlrpcAfterNewPost 
    413413               $this->core->callBehavior('xmlrpcAfterNewPost',$this,$post_id,$cur,$content,$struct,$publish); 
     
    418418                    $cur->post_position = (integer) $struct['wp_page_order']; 
    419419               } 
    420                 
     420 
    421421               $this->core->blog->settings->system->post_url_format = '{t}'; 
    422                 
     422 
    423423               $post_id = $this->core->blog->addPost($cur); 
    424424          } 
     
    427427               throw new Exception('Invalid post type',401); 
    428428          } 
    429            
     429 
    430430          return (string) $post_id; 
    431431     } 
    432       
     432 
    433433     private function editPost($post_id,$user,$pwd,$content,$struct=array(),$publish=true) 
    434434     { 
    435435          $post_id = (integer) $post_id; 
    436            
     436 
    437437          $post_type = 'post'; 
    438438          if (!empty($struct['post_type'])) { 
    439439               $post_type = $struct['post_type']; 
    440440          } 
    441            
     441 
    442442          $post = $this->getPostRS($post_id,$user,$pwd,$post_type); 
    443            
     443 
    444444          $title = (!empty($struct['title'])) ? $struct['title'] : ''; 
    445445          $excerpt = (!empty($struct['mt_excerpt'])) ? $struct['mt_excerpt'] : ''; 
     
    448448          $open_comment = (isset($struct['mt_allow_comments'])) ? $struct['mt_allow_comments'] : 1; 
    449449          $open_tb = (isset($struct['mt_allow_pings'])) ? $struct['mt_allow_pings'] : 1; 
    450            
     450 
    451451          if ($description !== null) { 
    452452               $content = $description; 
    453453          } 
    454            
     454 
    455455          if (!$title) { 
    456456               $title = text::cutString(html::clean($content),25).'...'; 
    457457          } 
    458            
     458 
    459459          $excerpt_xhtml = $this->core->callFormater('xhtml',$excerpt); 
    460460          $content_xhtml = $this->core->callFormater('xhtml',$content); 
    461            
     461 
    462462          if (empty($content)) { 
    463463               throw new Exception('Cannot create an empty entry'); 
    464464          } 
    465            
     465 
    466466          $cur = $this->core->con->openCursor($this->core->prefix.'post'); 
    467            
     467 
    468468          $cur->post_type = $post_type; 
    469469          $cur->post_title = trim($title); 
     
    477477          $cur->post_format = 'xhtml'; 
    478478          $cur->post_url = $post->post_url; 
    479            
    480            
     479 
     480 
    481481          if ($dateCreated) { 
    482482               if ($dateCreated instanceof xmlrpcDate) { 
     
    488488               $cur->post_dt = $post->post_dt; 
    489489          } 
    490            
     490 
    491491          # Categories in an array 
    492492          if (isset($struct['categories']) && is_array($struct['categories'])) 
     
    494494               $categories = $struct['categories']; 
    495495               $cat_id = !empty($categories[0]) ? $categories[0] : null; 
    496                 
     496 
    497497               $cur->cat_id = $this->getCatID($cat_id); 
    498498          } 
    499            
     499 
    500500          if (isset($struct['wp_slug'])) { 
    501501               $cur->post_url = $struct['wp_slug']; 
    502502          } 
    503            
     503 
    504504          if (isset($struct['wp_password'])) { 
    505505               $cur->post_password = $struct['wp_password']; 
    506506          } 
    507            
     507 
    508508          if ($cur->post_type == 'post') 
    509509          { 
    510510               # --BEHAVIOR-- xmlrpcBeforeEditPost 
    511511               $this->core->callBehavior('xmlrpcBeforeEditPost',$this,$post_id,$cur,$content,$struct,$publish); 
    512                 
     512 
    513513               $this->core->blog->updPost($post_id,$cur); 
    514                 
     514 
    515515               # --BEHAVIOR-- xmlrpcAfterEditPost 
    516516               $this->core->callBehavior('xmlrpcAfterEditPost',$this,$post_id,$cur,$content,$struct,$publish); 
     
    521521                    $cur->post_position = (integer) $struct['wp_page_order']; 
    522522               } 
    523                 
     523 
    524524               $this->core->blog->settings->system->post_url_format = '{t}'; 
    525                 
     525 
    526526               $this->core->blog->updPost($post_id,$cur); 
    527527          } 
     
    530530               throw new Exception('Invalid post type',401); 
    531531          } 
    532            
     532 
    533533          return true; 
    534534     } 
    535       
     535 
    536536     private function getPost($post_id,$user,$pwd,$type='mw') 
    537537     { 
    538538          $post_id = (integer) $post_id; 
    539            
     539 
    540540          $post = $this->getPostRS($post_id,$user,$pwd); 
    541            
     541 
    542542          $res = new ArrayObject(); 
    543            
     543 
    544544          $res['dateCreated'] = new xmlrpcDate($post->getTS()); 
    545545          $res['userid'] = $post->user_id; 
    546546          $res['postid'] = $post->post_id; 
    547            
     547 
    548548          if ($post->cat_id) { 
    549549               $res['categories'] = array($post->cat_url); 
    550550          } 
    551            
     551 
    552552          if ($type == 'blogger') { 
    553553               $res['content'] = $post->post_content_xhtml; 
    554554          } 
    555            
     555 
    556556          if ($type == 'mt' || $type == 'mw') { 
    557557               $res['title'] = $post->post_title; 
    558558          } 
    559            
     559 
    560560          if ($type == 'mw') { 
    561561               $res['description'] = $post->post_content_xhtml; 
     
    568568               $res['mt_keywords'] = ''; 
    569569          } 
    570            
     570 
    571571          # --BEHAVIOR-- xmlrpcGetPostInfo 
    572572          $this->core->callBehavior('xmlrpcGetPostInfo',$this,$type,array(&$res)); 
    573            
     573 
    574574          return $res; 
    575575     } 
    576       
     576 
    577577     private function deletePost($post_id,$user,$pwd) 
    578578     { 
    579579          $post_id = (integer) $post_id; 
    580            
     580 
    581581          $this->getPostRS($post_id,$user,$pwd); 
    582582          $this->core->blog->delPost($post_id); 
    583            
     583 
    584584          return true; 
    585585     } 
    586       
     586 
    587587     private function getRecentPosts($blog_id,$user,$pwd,$nb_post,$type='mw') 
    588588     { 
    589589          $this->setUser($user,$pwd); 
    590590          $this->setBlog(); 
    591            
     591 
    592592          $nb_post = (integer) $nb_post; 
    593            
     593 
    594594          if ($nb_post > 50) { 
    595595               throw new Exception('Cannot retrieve more than 50 entries'); 
    596596          } 
    597            
     597 
    598598          $params = array(); 
    599599          $params['limit'] = $nb_post; 
    600            
     600 
    601601          $posts = $this->core->blog->getPosts($params); 
    602            
     602 
    603603          $res = array(); 
    604604          while ($posts->fetch()) 
    605605          { 
    606606               $tres = array(); 
    607                 
     607 
    608608               $tres['dateCreated'] = new xmlrpcDate($posts->getTS()); 
    609609               $tres['userid'] = $posts->user_id; 
    610610               $tres['postid'] = $posts->post_id; 
    611                 
     611 
    612612               if ($posts->cat_id) { 
    613613                    $tres['categories'] = array($posts->cat_url); 
    614614               } 
    615                 
     615 
    616616               if ($type == 'blogger') { 
    617617                    $tres['content'] = $posts->post_content_xhtml; 
    618618               } 
    619                 
     619 
    620620               if ($type == 'mt' || $type == 'mw') { 
    621621                    $tres['title'] = $posts->post_title; 
    622622               } 
    623                 
     623 
    624624               if ($type == 'mw') { 
    625625                    $tres['description'] = $posts->post_content_xhtml; 
     
    632632                    $tres['mt_keywords'] = ''; 
    633633               } 
    634                 
     634 
    635635               # --BEHAVIOR-- xmlrpcGetPostInfo 
    636636               $this->core->callBehavior('xmlrpcGetPostInfo',$this,$type,array(&$tres)); 
    637                 
     637 
    638638               $res[] = $tres; 
    639639          } 
    640            
     640 
    641641          return $res; 
    642642     } 
    643       
     643 
    644644     private function getUserBlogs($user,$pwd) 
    645645     { 
    646646          $this->setUser($user,$pwd); 
    647647          $this->setBlog(); 
    648            
     648 
    649649          return array(array( 
    650650               'url' => $this->core->blog->url, 
     
    653653          )); 
    654654     } 
    655       
     655 
    656656     private function getUserInfo($user,$pwd) 
    657657     { 
    658658          $this->setUser($user,$pwd); 
    659            
     659 
    660660          return array( 
    661661               'userid' => $this->core->auth->userID(), 
     
    667667          ); 
    668668     } 
    669       
     669 
    670670     private function getCategories($blog_id,$user,$pwd) 
    671671     { 
     
    673673          $this->setBlog(); 
    674674          $rs = $this->core->blog->getCategories(); 
    675            
     675 
    676676          $res = array(); 
    677            
     677 
    678678          $l = $rs->level; 
    679679          $stack = array('',$rs->cat_url); 
    680            
     680 
    681681          while ($rs->fetch()) 
    682682          { 
     
    694694                    $parent = end($stack); 
    695695               } 
    696                 
     696 
    697697               $res[] = array( 
    698698                    'categoryId' => $rs->cat_url, 
     
    705705                         $this->core->url->getURLFor('feed','category/'.$rs->cat_url.'/rss2') 
    706706               ); 
    707                 
     707 
    708708               $stack[] = $rs->cat_url; 
    709709               $l = $rs->level; 
    710710          } 
    711            
     711 
    712712          return $res; 
    713713     } 
    714       
     714 
    715715     private function getPostCategories($post_id,$user,$pwd) 
    716716     { 
    717717          $post_id = (integer) $post_id; 
    718            
     718 
    719719          $post = $this->getPostRS($post_id,$user,$pwd); 
    720            
     720 
    721721          return array( 
    722722               array( 
     
    727727          ); 
    728728     } 
    729       
     729 
    730730     private function setPostCategories($post_id,$user,$pwd,$categories) 
    731731     { 
    732732          $post_id = (integer) $post_id; 
    733            
     733 
    734734          $post = $this->getPostRS($post_id,$user,$pwd); 
    735            
     735 
    736736          $cat_id = (!empty($categories[0]['categoryId'])) ? $categories[0]['categoryId'] : null; 
    737            
     737 
    738738          foreach($categories as $v) 
    739739          { 
     
    743743               } 
    744744          } 
    745            
     745 
    746746          # w.bloggar sends -1 for no category. 
    747747          if ($cat_id == -1) { 
    748748               $cat_id = null; 
    749749          } 
    750            
     750 
    751751          if ($cat_id) { 
    752752               $cat_id = $this->getCatID($cat_id); 
    753753          } 
    754            
     754 
    755755          $this->core->blog->updPostCategory($post_id,(integer) $cat_id); 
    756            
     756 
    757757          return true; 
    758758     } 
    759       
     759 
    760760     private function publishPost($post_id,$user,$pwd) 
    761761     { 
    762762          $post_id = (integer) $post_id; 
    763            
     763 
    764764          $this->getPostRS($post_id,$user,$pwd); 
    765            
     765 
    766766          # --BEHAVIOR-- xmlrpcBeforePublishPost 
    767767          $this->core->callBehavior('xmlrpcBeforePublishPost',$this,$post_id); 
    768            
     768 
    769769          $this->core->blog->updPostStatus($post_id,1); 
    770            
     770 
    771771          # --BEHAVIOR-- xmlrpcAfterPublishPost 
    772772          $this->core->callBehavior('xmlrpcAfterPublishPost',$this,$post_id); 
    773            
     773 
    774774          return true; 
    775775     } 
    776       
     776 
    777777     private function newMediaObject($blog_id,$user,$pwd,$file) 
    778778     { 
     
    780780               throw new Exception('No file name'); 
    781781          } 
    782            
     782 
    783783          if (empty($file['bits'])) { 
    784784               throw new Exception('No file content'); 
    785785          } 
    786            
     786 
    787787          $file_name = $file['name']; 
    788788          $file_bits = base64_decode($file['bits']); 
    789            
    790           $this->setUser($user,$pwd); 
    791           $this->setBlog(); 
    792            
     789 
     790          $this->setUser($user,$pwd); 
     791          $this->setBlog(); 
     792 
    793793          $media = new dcMedia($this->core); 
    794            
     794 
    795795          $dir_name = path::clean(dirname($file_name)); 
    796796          $file_name = basename($file_name); 
    797            
     797 
    798798          $dir_name = preg_replace('!^/!','',$dir_name); 
    799799          if ($dir_name != '') 
     
    809809               } 
    810810          } 
    811            
     811 
    812812          $media_id = $media->uploadBits($file_name,$file_bits); 
    813            
     813 
    814814          $f = $media->getFile($media_id); 
    815815          return array( 
     
    819819          ); 
    820820     } 
    821       
     821 
    822822     private function translateWpStatus($s) 
    823823     { 
     
    829829               'scheduled' => -1 
    830830          ); 
    831            
     831 
    832832          if (is_int($s)) { 
    833833               $status = array_flip($status); 
     
    837837          } 
    838838     } 
    839       
     839 
    840840     private function translateWpCommentstatus($s) 
    841841     { 
     
    845845               'spam' => -2 
    846846          ); 
    847            
     847 
    848848          if (is_int($s)) { 
    849849               $status = array_flip($status); 
     
    853853          } 
    854854     } 
    855       
     855 
    856856     private function translateWpOptions($options=array()) 
    857857     { 
     
    860860               $timezone = dt::getTimeOffset($this->core->blog->settings->system->blog_timezone)/3600; 
    861861          } 
    862            
     862 
    863863          $res = array ( 
    864864              'software_name' => array ( 
     
    903903               ) 
    904904          ); 
    905            
     905 
    906906          if (!empty($options)) 
    907907          { 
     
    914914               return $r; 
    915915          } 
    916            
     916 
    917917          return $res; 
    918918     } 
    919       
     919 
    920920     private function getPostStatusList($blog_id,$user,$pwd) 
    921921     { 
    922922          $this->setUser($user,$pwd); 
    923923          $this->setBlog(); 
    924            
     924 
    925925          return array( 
    926926               'draft' => 'Draft', 
     
    931931          ); 
    932932     } 
    933       
     933 
    934934     private function getPageStatusList($blog_id,$user,$pwd) 
    935935     { 
     
    937937          $this->setBlog(); 
    938938          $this->checkPagesPermission(); 
    939            
     939 
    940940          return array( 
    941941               'draft' => 'Draft', 
     
    945945          ); 
    946946     } 
    947       
     947 
    948948     private function checkPagesPermission() 
    949949     { 
     
    951951               throw new Exception('Pages management is not available on this blog.'); 
    952952          } 
    953            
     953 
    954954          if (!$this->core->auth->check('pages,contentadmin',$this->core->blog->id)) { 
    955955               throw new Exception('Not enough permissions to edit pages.',401); 
    956956          } 
    957957     } 
    958       
     958 
    959959     private function getPages($blog_id,$user,$pwd,$limit=null,$id=null) 
    960960     { 
     
    962962          $this->setBlog(); 
    963963          $this->checkPagesPermission(); 
    964            
     964 
    965965          $params = array( 
    966966               'post_type' => 'page', 
    967967               'order' => 'post_position ASC, post_title ASC' 
    968968          ); 
    969            
     969 
    970970          if ($id) { 
    971971               $params['post_id'] = (integer) $id; 
     
    974974               $params['limit'] = $limit; 
    975975          } 
    976            
     976 
    977977          $posts = $this->core->blog->getPosts($params); 
    978            
     978 
    979979          $res = array(); 
    980980          while ($posts->fetch()) 
     
    10061006                    "wp_page_template"       => 'default' 
    10071007               ); 
    1008                 
     1008 
    10091009               # --BEHAVIOR-- xmlrpcGetPageInfo 
    10101010               $this->core->callBehavior('xmlrpcGetPageInfo',$this,array(&$tres)); 
    1011                 
     1011 
    10121012               $res[] = $tres; 
    10131013          } 
    1014            
     1014 
    10151015          return $res; 
    10161016     } 
    1017       
     1017 
    10181018     private function newPage($blog_id,$user,$pwd,$struct,$publish) 
    10191019     { 
     
    10211021          $this->setBlog(); 
    10221022          $this->checkPagesPermission(); 
    1023            
     1023 
    10241024          $struct['post_type'] = 'page'; 
    1025            
     1025 
    10261026          return $this->newPost($blog_id,$user,$pwd,null,$struct,$publish); 
    10271027     } 
    1028       
     1028 
    10291029     private function editPage($page_id,$user,$pwd,$struct,$publish) 
    10301030     { 
     
    10321032          $this->setBlog(); 
    10331033          $this->checkPagesPermission(); 
    1034            
     1034 
    10351035          $struct['post_type'] = 'page'; 
    1036            
     1036 
    10371037          return $this->editPost($page_id,$user,$pwd,null,$struct,$publish); 
    10381038     } 
    1039       
     1039 
    10401040     private function deletePage($page_id,$user,$pwd) 
    10411041     { 
     
    10431043          $this->setBlog(); 
    10441044          $this->checkPagesPermission(); 
    1045            
     1045 
    10461046          $page_id = (integer) $page_id; 
    1047            
     1047 
    10481048          $this->getPostRS($page_id,$user,$pwd,'page'); 
    10491049          $this->core->blog->delPost($page_id); 
    1050            
     1050 
    10511051          return true; 
    10521052     } 
    1053       
     1053 
    10541054     private function getAuthors($user,$pwd) 
    10551055     { 
    10561056          $this->setUser($user,$pwd); 
    10571057          $this->setBlog(); 
    1058            
     1058 
    10591059          $rs = $this->core->getBlogPermissions($this->core->blog->id); 
    10601060          $res = array(); 
    1061            
     1061 
    10621062          foreach($rs as $k => $v) 
    10631063          { 
     
    10701070          return $res; 
    10711071     } 
    1072       
     1072 
    10731073     private function getTags($user,$pwd) 
    10741074     { 
    10751075          $this->setUser($user,$pwd); 
    10761076          $this->setBlog(); 
    1077            
     1077 
    10781078          $tags = $this->core->meta->getMeta('tag'); 
    10791079          $tags->sort('meta_id_lower','asc'); 
    1080            
     1080 
    10811081          $res = array(); 
    10821082          $url   = $this->core->blog->url. 
     
    10971097          return $res; 
    10981098     } 
    1099       
     1099 
    11001100     private function newCategory($user,$pwd,$struct) 
    11011101     { 
    11021102          $this->setUser($user,$pwd); 
    11031103          $this->setBlog(); 
    1104            
     1104 
    11051105          if (empty($struct['name'])) { 
    11061106               throw new Exception('You mus give a category name.'); 
    11071107          } 
    1108            
     1108 
    11091109          $cur = $this->core->con->openCursor($this->core->prefix.'category'); 
    11101110          $cur->cat_title = $struct['name']; 
    1111            
     1111 
    11121112          if (!empty($struct['slug'])) { 
    11131113               $cur->cat_url = $struct['slug']; 
     
    11191119               } 
    11201120          } 
    1121            
     1121 
    11221122          $parent = !empty($struct['category_parent']) ? (integer) $struct['category_parent'] : 0; 
    1123            
     1123 
    11241124          $id = $this->core->blog->addCategory($cur,$parent); 
    11251125          $rs = $this->core->blog->getCategory($id); 
    11261126          return $rs->cat_url; 
    11271127     } 
    1128       
     1128 
    11291129     private function deleteCategory($user,$pwd,$cat_id) 
    11301130     { 
    11311131          $this->setUser($user,$pwd); 
    11321132          $this->setBlog(); 
    1133            
     1133 
    11341134          $c = $this->core->blog->getCategories(array('cat_url' => $cat_id)); 
    11351135          if ($c->isEmpty()) { 
     
    11381138          $cat_id = $c->cat_id; 
    11391139          unset($c); 
    1140            
     1140 
    11411141          $this->core->blog->delCategory((integer) $cat_id); 
    11421142          return true; 
    11431143     } 
    1144       
     1144 
    11451145     private function searchCategories($user,$pwd,$category,$limit) 
    11461146     { 
    11471147          $this->setUser($user,$pwd); 
    11481148          $this->setBlog(); 
    1149            
     1149 
    11501150          $strReq = 'SELECT cat_id, cat_title, cat_url '. 
    11511151                    'FROM '.$this->core->prefix.'category '. 
     
    11531153                    "AND LOWER(cat_title) LIKE LOWER('%".$this->core->con->escape($category)."%') ". 
    11541154                    ($limit > 0 ? $this->core->con->limit($limit) : ''); 
    1155            
     1155 
    11561156          $rs = $this->core->con->select($strReq); 
    1157            
     1157 
    11581158          $res = array(); 
    11591159          while ($rs->fetch()) 
     
    11661166          return $res; 
    11671167     } 
    1168       
     1168 
    11691169     private function countComments($user,$pwd,$post_id) 
    11701170     { 
    11711171          $this->setUser($user,$pwd); 
    11721172          $this->setBlog(); 
    1173            
     1173 
    11741174          $res = array( 
    11751175               'approved' => 0, 
     
    11791179          ); 
    11801180          $rs = $this->core->blog->getComments(array('post_id' => $post_id)); 
    1181            
     1181 
    11821182          while ($rs->fetch()) { 
    11831183               $res['total']++; 
     
    11921192          return $res; 
    11931193     } 
    1194       
     1194 
    11951195     private function getComments($user,$pwd,$struct,$id=null) 
    11961196     { 
    11971197          $this->setUser($user,$pwd); 
    11981198          $this->setBlog(); 
    1199            
     1199 
    12001200          $params = array(); 
    1201            
     1201 
    12021202          if (!empty($struct['status'])) { 
    12031203               $params['comment_status'] = $this->translateWpCommentstatus($struct['status']); 
    12041204          } 
    1205            
     1205 
    12061206          if (!empty($struct['post_id'])) { 
    12071207               $params['post_id'] = (integer) $struct['post_id']; 
    12081208          } 
    1209            
     1209 
    12101210          if (isset($id)) { 
    12111211               $params['comment_id'] = $id; 
    12121212          } 
    1213            
     1213 
    12141214          $offset = !empty($struct['offset']) ? (integer) $struct['offset'] : 0; 
    12151215          $limit = !empty($struct['number']) ? (integer) $struct['number'] : 10; 
    12161216          $params['limit'] = array($offset,$limit); 
    1217            
     1217 
    12181218          $rs = $this->core->blog->getComments($params); 
    12191219          $res = array(); 
     
    12381238          return $res; 
    12391239     } 
    1240       
     1240 
    12411241     private function addComment($user,$pwd,$post_id,$struct) 
    12421242     { 
    12431243          $this->setUser($user,$pwd); 
    12441244          $this->setBlog(); 
    1245            
     1245 
    12461246          if (empty($struct['content'])) { 
    12471247               throw new Exception('Sorry, you cannot post an empty comment',401); 
    12481248          } 
    1249            
     1249 
    12501250          if (is_numeric($post_id)) { 
    12511251               $p['post_id'] = $post_id; 
     
    12571257               throw new Exception('Sorry, no such post.',404); 
    12581258          } 
    1259            
     1259 
    12601260          $cur = $this->core->con->openCursor($this->core->prefix.'comment'); 
    1261            
     1261 
    12621262          $cur->comment_author = $this->core->auth->getInfo('user_cn'); 
    12631263          $cur->comment_email = $this->core->auth->getInfo('user_email'); 
    12641264          $cur->comment_site = $this->core->auth->getInfo('user_url'); 
    1265            
     1265 
    12661266          $cur->comment_content = $struct['content']; 
    12671267          $cur->post_id = (integer) $post_id; 
    1268            
     1268 
    12691269          $id = $this->core->blog->addComment($cur); 
    12701270          return $id; 
    12711271     } 
    1272       
     1272 
    12731273     private function updComment($user,$pwd,$comment_id,$struct) 
    12741274     { 
    12751275          $this->setUser($user,$pwd); 
    12761276          $this->setBlog(); 
    1277            
     1277 
    12781278          $cur = $this->core->con->openCursor($this->core->prefix.'comment'); 
    1279            
     1279 
    12801280          if (isset($struct['status'])) { 
    12811281               $cur->comment_status = $this->translateWpCommentstatus($struct['status']); 
    12821282          } 
    1283            
     1283 
    12841284          if (isset($struct['date_created_gmt'])) { 
    12851285               if ($struct['date_created_gmt'] instanceof xmlrpcDate) { 
     
    12901290               $cur->comment_dt = $struct['date_created_gmt']; 
    12911291          } 
    1292            
     1292 
    12931293          if (isset($struct['content'])) { 
    12941294               $cur->comment_content = $struct['content']; 
    12951295          } 
    1296            
     1296 
    12971297          if (isset($struct['author'])) { 
    12981298               $cur->comment_author = $struct['author']; 
    12991299          } 
    1300            
     1300 
    13011301          if (isset($struct['author_url'])) { 
    13021302               $cur->comment_site = $struct['author_url']; 
    13031303          } 
    1304            
     1304 
    13051305          if (isset($struct['author_email'])) { 
    13061306               $cur->comment_email = $struct['author_email']; 
    13071307          } 
    1308            
     1308 
    13091309          $this->core->blog->updComment($comment_id,$cur); 
    13101310          return true; 
    13111311     } 
    1312       
     1312 
    13131313     private function delComment($user,$pwd,$comment_id) 
    13141314     { 
    13151315          $this->setUser($user,$pwd); 
    13161316          $this->setBlog(); 
    1317            
     1317 
    13181318          $this->core->blog->delComment($comment_id); 
    13191319          return true; 
    13201320     } 
    1321       
     1321 
    13221322     /* Blogger methods 
    13231323     --------------------------------------------------- */ 
     
    13261326          return $this->newPost($blogid,$username,$password,$content,array(),$publish); 
    13271327     } 
    1328       
     1328 
    13291329     public function blogger_editPost($appkey,$postid,$username,$password,$content,$publish) 
    13301330     { 
    13311331          return $this->editPost($postid,$username,$password,$content,array(),$publish); 
    13321332     } 
    1333       
     1333 
    13341334     public function blogger_getPost($appkey,$postid,$username,$password) 
    13351335     { 
    13361336          return $this->getPost($postid,$username,$password,'blogger'); 
    13371337     } 
    1338       
     1338 
    13391339     public function blogger_deletePost($appkey,$postid,$username,$password,$publish) 
    13401340     { 
    13411341          return $this->deletePost($postid,$username,$password); 
    13421342     } 
    1343       
     1343 
    13441344     public function blogger_getRecentPosts($appkey,$blogid,$username,$password,$numberOfPosts) 
    13451345     { 
    13461346          return $this->getRecentPosts($blogid,$username,$password,$numberOfPosts,'blogger'); 
    13471347     } 
    1348       
     1348 
    13491349     public function blogger_getUserBlogs($appkey,$username,$password) 
    13501350     { 
    13511351          return $this->getUserBlogs($username,$password); 
    13521352     } 
    1353       
     1353 
    13541354     public function blogger_getUserInfo($appkey,$username,$password) 
    13551355     { 
    13561356          return $this->getUserInfo($username,$password); 
    13571357     } 
    1358       
    1359       
     1358 
     1359 
    13601360     /* Metaweblog methods 
    13611361     ------------------------------------------------------- */ 
     
    13641364          return $this->newPost($blogid,$username,$password,'',$content,$publish); 
    13651365     } 
    1366       
     1366 
    13671367     public function mw_editPost($postid,$username,$password,$content,$publish) 
    13681368     { 
    13691369          return $this->editPost($postid,$username,$password,'',$content,$publish); 
    13701370     } 
    1371       
     1371 
    13721372     public function mw_getPost($postid,$username,$password) 
    13731373     { 
    13741374          return $this->getPost($postid,$username,$password,'mw'); 
    13751375     } 
    1376       
     1376 
    13771377     public function mw_getRecentPosts($blogid,$username,$password,$numberOfPosts) 
    13781378     { 
    13791379          return $this->getRecentPosts($blogid,$username,$password,$numberOfPosts,'mw'); 
    13801380     } 
    1381       
     1381 
    13821382     public function mw_getCategories($blogid,$username,$password) 
    13831383     { 
    13841384          return $this->getCategories($blogid,$username,$password); 
    13851385     } 
    1386       
     1386 
    13871387     public function mw_newMediaObject($blogid,$username,$password,$file) 
    13881388     { 
    13891389          return $this->newMediaObject($blogid,$username,$password,$file); 
    13901390     } 
    1391       
     1391 
    13921392     /* MovableType methods 
    13931393     --------------------------------------------------- */ 
     
    13961396          return $this->getRecentPosts($blogid,$username,$password,$numberOfPosts,'mt'); 
    13971397     } 
    1398       
     1398 
    13991399     public function mt_getCategoryList($blogid,$username,$password) 
    14001400     { 
    14011401          return $this->getCategories($blogid,$username,$password); 
    14021402     } 
    1403       
     1403 
    14041404     public function mt_getPostCategories($postid,$username,$password) 
    14051405     { 
    14061406          return $this->getPostCategories($postid,$username,$password); 
    14071407     } 
    1408       
     1408 
    14091409     public function mt_setPostCategories($postid,$username,$password,$categories) 
    14101410     { 
    14111411          return $this->setPostCategories($postid,$username,$password,$categories); 
    14121412     } 
    1413       
     1413 
    14141414     public function mt_publishPost($postid,$username,$password) 
    14151415     { 
    14161416          return $this->publishPost($postid,$username,$password); 
    14171417     } 
    1418       
     1418 
    14191419     public function mt_supportedTextFilters() 
    14201420     { 
    14211421          return array(); 
    14221422     } 
    1423       
     1423 
    14241424     /* WordPress methods 
    14251425     --------------------------------------------------- */ 
     
    14281428          return $this->getUserBlogs($username,$password); 
    14291429     } 
    1430       
     1430 
    14311431     public function wp_getPage($blogid,$pageid,$username,$password) 
    14321432     { 
    14331433          $res = $this->getPages($blogid,$username,$password,null,$pageid); 
    1434            
     1434 
    14351435          if (empty($res)) { 
    14361436               throw new Exception('Sorry, no such page',404); 
    14371437          } 
    1438            
     1438 
    14391439          return $res[0]; 
    14401440     } 
    1441       
     1441 
    14421442     public function wp_getPages($blogid,$username,$password,$num=10) 
    14431443     { 
    14441444          return $this->getPages($blogid,$username,$password,$num); 
    14451445     } 
    1446       
     1446 
    14471447     public function wp_newPage($blogid,$username,$password,$content,$publish) 
    14481448     { 
    14491449          return $this->newPage($blogid,$username,$password,$content,$publish); 
    14501450     } 
    1451       
     1451 
    14521452     public function wp_deletePage($blogid,$username,$password,$pageid) 
    14531453     { 
    14541454          return $this->deletePage($pageid,$username,$password); 
    14551455     } 
    1456       
     1456 
    14571457     public function wp_editPage($blogid,$pageid,$username,$password,$content,$publish) 
    14581458     { 
    14591459          return $this->editPage($pageid,$username,$password,$content,$publish); 
    14601460     } 
    1461       
     1461 
    14621462     public function wp_getPageList($blogid,$username,$password) 
    14631463     { 
     
    14751475          return $res; 
    14761476     } 
    1477       
     1477 
    14781478     public function wp_getAuthors($blogid,$username,$password) 
    14791479     { 
    14801480          return $this->getAuthors($username,$password); 
    14811481     } 
    1482       
     1482 
    14831483     public function wp_getCategories($blogid,$username,$password) 
    14841484     { 
    14851485          return $this->getCategories($blogid,$username,$password); 
    14861486     } 
    1487       
     1487 
    14881488     public function wp_getTags($blogid,$username,$password) 
    14891489     { 
    14901490          return $this->getTags($username,$password); 
    14911491     } 
    1492       
     1492 
    14931493     public function wp_newCategory($blogid,$username,$password,$content) 
    14941494     { 
    14951495          return $this->newCategory($username,$password,$content); 
    14961496     } 
    1497       
     1497 
    14981498     public function wp_deleteCategory($blogid,$username,$password,$categoryid) 
    14991499     { 
    15001500          return $this->deleteCategory($username,$password,$categoryid); 
    15011501     } 
    1502       
     1502 
    15031503     public function wp_suggestCategories($blogid,$username,$password,$category,$max_results=0) 
    15041504     { 
    15051505          return $this->searchCategories($username,$password,$category,$max_results); 
    15061506     } 
    1507       
     1507 
    15081508     public function wp_uploadFile($blogid,$username,$password,$file) 
    15091509     { 
    15101510          return $this->newMediaObject($blogid,$username,$password,$file); 
    15111511     } 
    1512       
     1512 
    15131513     public function wp_getPostStatusList($blogid,$username,$password) 
    15141514     { 
    15151515          return $this->getPostStatusList($blogid,$username,$password); 
    15161516     } 
    1517       
     1517 
    15181518     public function wp_getPageStatusList($blogid,$username,$password) 
    15191519     { 
    15201520          return $this->getPostStatusList($blogid,$username,$password); 
    15211521     } 
    1522       
     1522 
    15231523     public function wp_getPageTemplates($blogid,$username,$password) 
    15241524     { 
    15251525          return array('Default' => 'default'); 
    15261526     } 
    1527       
     1527 
    15281528     public function wp_getOptions($blogid,$username,$password,$options=array()) 
    15291529     { 
    15301530          $this->setUser($username,$password); 
    15311531          $this->setBlog(); 
    1532            
     1532 
    15331533          return $this->translateWpOptions($options); 
    15341534     } 
    1535       
     1535 
    15361536     public function wp_setOptions($blogid,$username,$password,$options) 
    15371537     { 
    15381538          $this->setUser($username,$password); 
    15391539          $this->setBlog(); 
    1540            
     1540 
    15411541          if (!$this->core->auth->check('admin',$this->core->blog->id)) { 
    15421542               throw new Exception('Not enough permissions to edit options.',401); 
    15431543          } 
    1544            
     1544 
    15451545          $opt = $this->translateWpOptions(); 
    1546            
     1546 
    15471547          $done = array(); 
    15481548          $blog_changes = false; 
    15491549          $cur = $this->core->con->openCursor($this->core->prefix.'blog'); 
    1550            
     1550 
    15511551          $this->core->blog->settings->addNamespace('system'); 
    1552            
     1552 
    15531553          foreach ($options as $name => $value) 
    15541554          { 
     
    15561556                    continue; 
    15571557               } 
    1558                 
     1558 
    15591559               switch ($name) 
    15601560               { 
     
    15791579               } 
    15801580          } 
    1581            
     1581 
    15821582          if ($blog_changes) { 
    15831583               $this->core->updBlog($this->core->blog->id,$cur); 
    15841584               $this->core->setBlog($this->core->blog->id); 
    15851585          } 
    1586            
     1586 
    15871587          return $this->translateWpOptions($done); 
    15881588     } 
    1589       
     1589 
    15901590     public function wp_getComment($blogid,$username,$password,$commentid) 
    15911591     { 
    15921592          $res = $this->getComments($username,$password,array(),$commentid); 
    1593            
     1593 
    15941594          if (empty($res)) { 
    15951595               throw new Exception('Sorry, no such comment',404); 
    15961596          } 
    1597            
     1597 
    15981598          return $res[0]; 
    15991599     } 
    1600       
     1600 
    16011601     public function wp_getCommentCount($blogid,$username,$password,$postid) 
    16021602     { 
    16031603          return $this->countComments($username,$password,$postid); 
    16041604     } 
    1605       
     1605 
    16061606     public function wp_getComments($blogid,$username,$password,$struct) 
    16071607     { 
    16081608          return $this->getComments($username,$password,$struct); 
    16091609     } 
    1610       
     1610 
    16111611     public function wp_deleteComment($blogid,$username,$password,$commentid) 
    16121612     { 
    16131613          return $this->delComment($username,$password,$commentid); 
    16141614     } 
    1615       
     1615 
    16161616     public function wp_editComment($blogid,$username,$password,$commentid,$content) 
    16171617     { 
    16181618          return $this->updComment($username,$password,$commentid,$content); 
    16191619     } 
    1620       
     1620 
    16211621     public function wp_newComment($blogid,$username,$password,$postid,$content) 
    16221622     { 
    16231623          return $this->addComment($username,$password,$postid,$content); 
    16241624     } 
    1625       
     1625 
    16261626     public function wp_getCommentStatusList($blogid,$username,$password) 
    16271627     { 
    16281628          $this->setUser($username,$password); 
    16291629          $this->setBlog(); 
    1630            
     1630 
    16311631          return array( 
    16321632               'hold' => 'Unapproved', 
     
    16521652               throw new Exception(__('LOL!'), 0); 
    16531653          } 
    1654            
     1654 
    16551655          # Time to get things done... 
    16561656          $this->setBlog(true); 
     
    16591659     } 
    16601660} 
    1661 ?> 
Note: See TracChangeset for help on using the changeset viewer.

Sites map