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
  • admin/services.php

    r2227 r2566  
    3939               throw new Exception('No post ID'); 
    4040          } 
    41            
     41 
    4242          $params = array('post_id' => (integer) $get['id']); 
    43            
     43 
    4444          if (isset($get['post_type'])) { 
    4545               $params['post_type'] = $get['post_type']; 
    4646          } 
    47            
     47 
    4848          $rs = $core->blog->getPosts($params); 
    49            
     49 
    5050          if ($rs->isEmpty()) { 
    5151               throw new Exception('No post for this ID'); 
    5252          } 
    53            
     53 
    5454          $rsp = new xmlTag('post'); 
    5555          $rsp->id = $rs->post_id; 
    56            
     56 
    5757          $rsp->blog_id($rs->blog_id); 
    5858          $rsp->user_id($rs->user_id); 
     
    8383          $rsp->cat_title($rs->cat_title); 
    8484          $rsp->cat_url($rs->cat_url); 
    85            
     85 
    8686          $rsp->post_display_content($rs->getContent(true)); 
    8787          $rsp->post_display_excerpt($rs->getExcerpt(true)); 
    88            
     88 
    8989          $metaTag = new xmlTag('meta'); 
    9090          if (($meta = @unserialize($rs->post_meta)) !== false) 
     
    9898          } 
    9999          $rsp->post_meta($metaTag); 
    100            
    101           return $rsp; 
    102      } 
    103       
     100 
     101          return $rsp; 
     102     } 
     103 
    104104     public static function getCommentById($core,$get) 
    105105     { 
     
    107107               throw new Exception('No comment ID'); 
    108108          } 
    109            
     109 
    110110          $rs = $core->blog->getComments(array('comment_id' => (integer) $get['id'])); 
    111            
     111 
    112112          if ($rs->isEmpty()) { 
    113113               throw new Exception('No comment for this ID'); 
    114114          } 
    115            
     115 
    116116          $rsp = new xmlTag('post'); 
    117117          $rsp->id = $rs->comment_id; 
    118            
     118 
    119119          $rsp->comment_dt($rs->comment_dt); 
    120120          $rsp->comment_upddt($rs->comment_upddt); 
     
    129129          $rsp->post_dt($rs->post_dt); 
    130130          $rsp->user_id($rs->user_id); 
    131            
     131 
    132132          $rsp->comment_display_content($rs->getContent(true)); 
    133            
     133 
    134134          if ($core->auth->userID()) { 
    135135               $rsp->comment_ip($rs->comment_ip); 
     
    137137               $rsp->comment_spam_disp(dcAntispam::statusMessage($rs)); 
    138138          } 
    139            
    140           return $rsp; 
    141      } 
    142       
     139 
     140          return $rsp; 
     141     } 
     142 
    143143     public static function quickPost($core,$get,$post) 
    144144     { 
    145145          # Create category 
    146146          if (!empty($post['new_cat_title']) && $core->auth->check('categories', $core->blog->id)) { 
    147            
     147 
    148148               $cur_cat = $core->con->openCursor($core->prefix.'category'); 
    149149               $cur_cat->cat_title = $post['new_cat_title']; 
    150150               $cur_cat->cat_url = ''; 
    151                 
     151 
    152152               $parent_cat = !empty($post['new_cat_parent']) ? $post['new_cat_parent'] : ''; 
    153                 
     153 
    154154               # --BEHAVIOR-- adminBeforeCategoryCreate 
    155155               $core->callBehavior('adminBeforeCategoryCreate', $cur_cat); 
    156                 
     156 
    157157               $post['cat_id'] = $core->blog->addCategory($cur_cat, (integer) $parent_cat); 
    158                 
     158 
    159159               # --BEHAVIOR-- adminAfterCategoryCreate 
    160160               $core->callBehavior('adminAfterCategoryCreate', $cur_cat, $post['cat_id']); 
    161161          } 
    162            
     162 
    163163          $cur = $core->con->openCursor($core->prefix.'post'); 
    164            
     164 
    165165          $cur->post_title = !empty($post['post_title']) ? $post['post_title'] : ''; 
    166166          $cur->user_id = $core->auth->userID(); 
     
    172172          $cur->post_open_comment = (integer) $core->blog->settings->system->allow_comments; 
    173173          $cur->post_open_tb = (integer) $core->blog->settings->system->allow_trackbacks; 
    174            
     174 
    175175          # --BEHAVIOR-- adminBeforePostCreate 
    176176          $core->callBehavior('adminBeforePostCreate',$cur); 
    177            
     177 
    178178          $return_id = $core->blog->addPost($cur); 
    179            
     179 
    180180          # --BEHAVIOR-- adminAfterPostCreate 
    181181          $core->callBehavior('adminAfterPostCreate',$cur,$return_id); 
    182            
     182 
    183183          $rsp = new xmlTag('post'); 
    184184          $rsp->id = $return_id; 
    185            
     185 
    186186          $post = $core->blog->getPosts(array('post_id' => $return_id)); 
    187            
     187 
    188188          $rsp->post_status = $post->post_status; 
    189189          $rsp->post_url = $post->getURL(); 
    190190          return $rsp; 
    191191     } 
    192       
     192 
    193193     public static function validatePostMarkup($core,$get,$post) 
    194194     { 
     
    196196               throw new Exception('No entry excerpt'); 
    197197          } 
    198            
     198 
    199199          if (!isset($post['content'])) { 
    200200               throw new Exception('No entry content'); 
    201201          } 
    202            
     202 
    203203          if (empty($post['format'])) { 
    204204               throw new Exception('No entry format'); 
    205205          } 
    206            
     206 
    207207          if (!isset($post['lang'])) { 
    208208               throw new Exception('No entry lang'); 
    209209          } 
    210            
     210 
    211211          $excerpt = $post['excerpt']; 
    212212          $excerpt_xhtml = ''; 
     
    215215          $format = $post['format']; 
    216216          $lang = $post['lang']; 
    217            
     217 
    218218          $core->blog->setPostContent(0,$format,$lang,$excerpt,$excerpt_xhtml,$content,$content_xhtml); 
    219            
     219 
    220220          $rsp = new xmlTag('result'); 
    221            
     221 
    222222          $v = htmlValidator::validate($excerpt_xhtml.$content_xhtml); 
    223            
     223 
    224224          $rsp->valid($v['valid']); 
    225225          $rsp->errors($v['errors']); 
    226            
    227           return $rsp; 
    228      } 
    229       
     226 
     227          return $rsp; 
     228     } 
     229 
    230230     public static function getZipMediaContent($core,$get,$post) 
    231231     { 
     
    233233               throw new Exception('No media ID'); 
    234234          } 
    235            
     235 
    236236          $id = (integer) $get['id']; 
    237            
     237 
    238238          if (!$core->auth->check('media,media_admin',$core->blog)) { 
    239239               throw new Exception('Permission denied'); 
    240240          } 
    241            
     241 
    242242          try { 
    243243               $core->media = new dcMedia($core); 
    244244               $file = $core->media->getFile($id); 
    245245          } catch (Exception $e) {} 
    246            
     246 
    247247          if ($file === null || $file->type != 'application/zip' || !$file->editable) { 
    248248               throw new Exception('Not a valid file'); 
    249249          } 
    250            
     250 
    251251          $rsp = new xmlTag('result'); 
    252252          $content = $core->media->getZipContent($file); 
    253            
     253 
    254254          foreach ($content as $k => $v) { 
    255255               $rsp->file($k); 
    256256          } 
    257            
    258           return $rsp; 
    259      } 
    260       
     257 
     258          return $rsp; 
     259     } 
     260 
    261261     public static function getMeta($core,$get) 
    262262     { 
     
    265265          $metaId = !empty($get['metaId']) ? $get['metaId'] : null; 
    266266          $metaType = !empty($get['metaType']) ? $get['metaType'] : null; 
    267            
     267 
    268268          $sortby = !empty($get['sortby']) ? $get['sortby'] : 'meta_type,asc'; 
    269            
     269 
    270270          $rs = $core->meta->getMetadata(array( 
    271271               'meta_type' => $metaType, 
     
    274274               'post_id' => $postid)); 
    275275          $rs = $core->meta->computeMetaStats($rs); 
    276            
     276 
    277277          $sortby = explode(',',$sortby); 
    278278          $sort = $sortby[0]; 
    279279          $order = isset($sortby[1]) ? $sortby[1] : 'asc'; 
    280            
     280 
    281281          switch ($sort) { 
    282282               case 'metaId': 
     
    292292                    $sort = 'meta_type'; 
    293293          } 
    294            
     294 
    295295          $rs->sort($sort,$order); 
    296            
     296 
    297297          $rsp = new xmlTag(); 
    298            
     298 
    299299          while ($rs->fetch()) 
    300300          { 
     
    306306               $metaTag->roundpercent = $rs->roundpercent; 
    307307               $metaTag->CDATA($rs->meta_id); 
    308                 
     308 
    309309               $rsp->insertNode($metaTag); 
    310310          } 
    311            
    312           return $rsp; 
    313      } 
    314       
     311 
     312          return $rsp; 
     313     } 
     314 
    315315     public static function setPostMeta($core,$get,$post) 
    316316     { 
     
    318318               throw new Exception('No post ID'); 
    319319          } 
    320            
     320 
    321321          if (empty($post['meta']) && $post['meta'] != '0') { 
    322322               throw new Exception('No meta'); 
    323323          } 
    324            
     324 
    325325          if (empty($post['metaType'])) { 
    326326               throw new Exception('No meta type'); 
    327327          } 
    328            
     328 
    329329          # Get previous meta for post 
    330330          $post_meta = $core->meta->getMetadata(array( 
     
    335335               $pm[] = $post_meta->meta_id; 
    336336          } 
    337            
     337 
    338338          foreach ($core->meta->splitMetaValues($post['meta']) as $m) 
    339339          { 
     
    342342               } 
    343343          } 
    344            
     344 
    345345          return true; 
    346346     } 
    347       
     347 
    348348     public static function delMeta($core,$get,$post) 
    349349     { 
     
    351351               throw new Exception('No post ID'); 
    352352          } 
    353            
     353 
    354354          if (empty($post['metaId']) && $post['metaId'] != '0') { 
    355355               throw new Exception('No meta ID'); 
    356356          } 
    357            
     357 
    358358          if (empty($post['metaType'])) { 
    359359               throw new Exception('No meta type'); 
    360360          } 
    361            
     361 
    362362          $core->meta->delPostMeta($post['postId'],$post['metaType'],$post['metaId']); 
    363            
     363 
    364364          return true; 
    365365     } 
    366       
     366 
    367367     public static function searchMeta($core,$get) 
    368368     { 
    369369          $q = !empty($get['q']) ? $get['q'] : null; 
    370370          $metaType = !empty($get['metaType']) ? $get['metaType'] : null; 
    371            
     371 
    372372          $sortby = !empty($get['sortby']) ? $get['sortby'] : 'meta_type,asc'; 
    373            
     373 
    374374          $rs = $core->meta->getMetadata(array('meta_type' => $metaType)); 
    375375          $rs = $core->meta->computeMetaStats($rs); 
    376            
     376 
    377377          $sortby = explode(',',$sortby); 
    378378          $sort = $sortby[0]; 
    379379          $order = isset($sortby[1]) ? $sortby[1] : 'asc'; 
    380            
     380 
    381381          switch ($sort) { 
    382382               case 'metaId': 
     
    392392                    $sort = 'meta_type'; 
    393393          } 
    394            
     394 
    395395          $rs->sort($sort,$order); 
    396            
     396 
    397397          $rsp = new xmlTag(); 
    398            
     398 
    399399          while ($rs->fetch()) 
    400400          { 
     
    407407                    $metaTag->roundpercent = $rs->roundpercent; 
    408408                    $metaTag->CDATA($rs->meta_id); 
    409                      
     409 
    410410                    $rsp->insertNode($metaTag); 
    411411               } 
    412412          } 
    413            
    414           return $rsp; 
    415      } 
    416       
     413 
     414          return $rsp; 
     415     } 
     416 
    417417     public static function setSectionFold($core,$get,$post) 
    418418     { 
     
    434434               if ($k !== false) { 
    435435                    unset($toggles[$k]); 
    436                }  
     436               } 
    437437          } else { // false == unfold section ==> add it to unfolded list 
    438438               if ($k === false) { 
    439439                    $toggles[]=$section; 
    440                };  
     440               }; 
    441441          } 
    442442          $core->auth->user_prefs->toggles->put('unfolded_sections',join(',',$toggles)); 
    443443          return true; 
    444444     } 
    445       
     445 
    446446     public static function getModuleById($core, $get, $post) 
    447447     { 
     
    466466          elseif ($list == 'plugin-new') { 
    467467               $store = new dcStore( 
    468                     $core->plugins,  
     468                    $core->plugins, 
    469469                    $core->blog->settings->system->store_plugin_url 
    470470               ); 
     
    497497     } 
    498498} 
    499 ?> 
Note: See TracChangeset for help on using the changeset viewer.

Sites map