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/public/lib.urlhandlers.php

    r1674 r2566  
    1515{ 
    1616     public $args; 
    17       
     17 
    1818     public function getURLFor($type,$value='') { 
    1919          $core =& $GLOBALS['core']; 
     
    3030          return $url; 
    3131     } 
    32       
     32 
    3333     public function register($type,$url,$representation,$handler) 
    3434     { 
     
    3838          parent::register($t[0],$t[1],$t[2],$t[3]); 
    3939     } 
    40       
     40 
    4141     public static function p404() 
    4242     { 
    4343          throw new Exception ("Page not found",404); 
    4444     } 
    45       
     45 
    4646     public static function default404($args,$type,$e) 
    4747     { 
     
    5151          $_ctx =& $GLOBALS['_ctx']; 
    5252          $core = $GLOBALS['core']; 
    53            
     53 
    5454          header('Content-Type: text/html; charset=UTF-8'); 
    5555          http::head(404,'Not Found'); 
     
    5757          $_ctx->current_tpl = '404.html'; 
    5858          $_ctx->content_type = 'text/html'; 
    59            
     59 
    6060          echo $core->tpl->getData($_ctx->current_tpl); 
    61            
     61 
    6262          # --BEHAVIOR-- publicAfterDocument 
    6363          $core->callBehavior('publicAfterDocument',$core); 
    6464          exit; 
    6565     } 
    66       
     66 
    6767     protected static function getPageNumber(&$args) 
    6868     { 
     
    7474               } 
    7575          } 
    76            
     76 
    7777          return false; 
    7878     } 
    79       
     79 
    8080     protected static function serveDocument($tpl,$content_type='text/html',$http_cache=true,$http_etag=true) 
    8181     { 
    8282          $_ctx =& $GLOBALS['_ctx']; 
    8383          $core =& $GLOBALS['core']; 
    84            
     84 
    8585          if ($_ctx->nb_entry_per_page === null) { 
    8686               $_ctx->nb_entry_per_page = $core->blog->settings->system->nb_post_per_page; 
    8787          } 
    88            
     88 
    8989          $tpl_file = $core->tpl->getFilePath($tpl); 
    90            
     90 
    9191          if (!$tpl_file) { 
    9292               throw new Exception('Unable to find template '); 
    9393          } 
    94            
     94 
    9595          $result = new ArrayObject; 
    96            
     96 
    9797          $_ctx->current_tpl = $tpl; 
    9898          $_ctx->content_type = $content_type; 
     
    100100          $_ctx->http_etag = $http_etag; 
    101101          $core->callBehavior('urlHandlerBeforeGetData',$_ctx); 
    102            
     102 
    103103          if ($_ctx->http_cache) { 
    104104               $GLOBALS['mod_files'][] = $tpl_file; 
     
    111111          $result['tpl'] = $_ctx->current_tpl; 
    112112          $result['blogupddt'] = $core->blog->upddt; 
    113            
     113 
    114114          # --BEHAVIOR-- urlHandlerServeDocument 
    115115          $core->callBehavior('urlHandlerServeDocument',$result); 
    116            
     116 
    117117          if ($_ctx->http_cache && $_ctx->http_etag) { 
    118118               http::etag($result['content'],http::getSelfURI()); 
     
    120120          echo $result['content']; 
    121121     } 
    122       
     122 
    123123     public function getDocument() 
    124124     { 
    125125          $core =& $GLOBALS['core']; 
    126            
     126 
    127127          $type = $args = ''; 
    128            
     128 
    129129          if ($this->mode == 'path_info') 
    130130          { 
     
    134134          { 
    135135               $part = ''; 
    136                 
     136 
    137137               $qs = $this->parseQueryString(); 
    138                 
     138 
    139139               # Recreates some _GET and _REQUEST pairs 
    140140               if (!empty($qs)) 
     
    147147                    $_GET = $qs; 
    148148                    $_REQUEST = array_merge($qs,$_REQUEST); 
    149                      
     149 
    150150                    list($k,$v) = each($qs); 
    151151                    if ($v === null) { 
     
    156156               } 
    157157          } 
    158            
     158 
    159159          $_SERVER['URL_REQUEST_PART'] = $part; 
    160            
     160 
    161161          $this->getArgs($part,$type,$this->args); 
    162            
     162 
    163163          # --BEHAVIOR-- urlHandlerGetArgsDocument 
    164164          $core->callBehavior('urlHandlerGetArgsDocument',$this); 
    165            
     165 
    166166          if (!$type) 
    167167          { 
     
    175175          } 
    176176     } 
    177       
     177 
    178178     public static function home($args) 
    179179     { 
    180180          $n = self::getPageNumber($args); 
    181            
     181 
    182182          if ($args && !$n) 
    183183          { 
    184                # "Then specified URL went unrecognized by all URL handlers and  
     184               # "Then specified URL went unrecognized by all URL handlers and 
    185185               # defaults to the home page, but is not a page number. 
    186186               self::p404(); 
     
    189189          { 
    190190               $core =& $GLOBALS['core']; 
    191                 
     191 
    192192               if ($n) { 
    193193                    $GLOBALS['_page_number'] = $n; 
    194194                    $core->url->type = $n > 1 ? 'default-page' : 'default'; 
    195195               } 
    196                 
     196 
    197197               if (empty($_GET['q'])) { 
    198198                    self::serveDocument('home.html'); 
     
    203203          } 
    204204     } 
    205       
     205 
    206206     public static function search() 
    207207     { 
    208208          $_ctx =& $GLOBALS['_ctx']; 
    209209          $core =& $GLOBALS['core']; 
    210            
     210 
    211211          $core->url->type='search'; 
    212            
     212 
    213213          $GLOBALS['_search'] = !empty($_GET['q']) ? rawurldecode($_GET['q']) : ''; 
    214214          if ($GLOBALS['_search']) { 
     
    217217               $GLOBALS['_search_count'] = $core->blog->getPosts($params,true)->f(0); 
    218218          } 
    219            
     219 
    220220          self::serveDocument('search.html'); 
    221221     } 
    222       
     222 
    223223     public static function lang($args) 
    224224     { 
    225225          $_ctx =& $GLOBALS['_ctx']; 
    226226          $core =& $GLOBALS['core']; 
    227            
     227 
    228228          $n = self::getPageNumber($args); 
    229229          $params = new ArrayObject(array( 
    230230               'lang' => $args)); 
    231            
     231 
    232232          $core->callBehavior('publicLangBeforeGetLangs',$params,$args); 
    233            
     233 
    234234          $_ctx->langs = $core->blog->getLangs($params); 
    235            
     235 
    236236          if ($_ctx->langs->isEmpty()) { 
    237237               # The specified language does not exist. 
     
    247247          } 
    248248     } 
    249       
     249 
    250250     public static function category($args) 
    251251     { 
    252252          $_ctx =& $GLOBALS['_ctx']; 
    253253          $core =& $GLOBALS['core']; 
    254            
     254 
    255255          $n = self::getPageNumber($args); 
    256            
     256 
    257257          if ($args == '' && !$n) { 
    258258               # No category was specified. 
     
    265265                    'post_type' => 'post', 
    266266                    'without_empty' => false)); 
    267                 
     267 
    268268               $core->callBehavior('publicCategoryBeforeGetCategories',$params,$args); 
    269                 
     269 
    270270               $_ctx->categories = $core->blog->getCategories($params); 
    271                 
     271 
    272272               if ($_ctx->categories->isEmpty()) { 
    273273                    # The specified category does no exist. 
     
    283283          } 
    284284     } 
    285       
     285 
    286286     public static function archive($args) 
    287287     { 
    288288          $_ctx =& $GLOBALS['_ctx']; 
    289289          $core =& $GLOBALS['core']; 
    290            
     290 
    291291          $year = $month = $cat_url = null; 
    292292          # Nothing or year and month 
     
    301301                    'month' => $m[2], 
    302302                    'type' => 'month')); 
    303                 
     303 
    304304               $core->callBehavior('publicArchiveBeforeGetDates',$params,$args); 
    305                 
     305 
    306306               $_ctx->archives = $core->blog->getDates($params); 
    307                 
     307 
    308308               if ($_ctx->archives->isEmpty()) { 
    309309                    # There is no entries for the specified period. 
     
    320320          } 
    321321     } 
    322       
     322 
    323323     public static function post($args) 
    324324     { 
     
    331331               $_ctx =& $GLOBALS['_ctx']; 
    332332               $core =& $GLOBALS['core']; 
    333                 
     333 
    334334               $core->blog->withoutPassword(false); 
    335                 
     335 
    336336               $params = new ArrayObject(array( 
    337337                    'post_url' => $args)); 
    338                 
     338 
    339339               $core->callBehavior('publicPostBeforeGetPosts',$params,$args); 
    340340 
    341341               $_ctx->posts = $core->blog->getPosts($params); 
    342                 
     342 
    343343               $_ctx->comment_preview = new ArrayObject(); 
    344344               $_ctx->comment_preview['content'] = ''; 
     
    349349               $_ctx->comment_preview['preview'] = false; 
    350350               $_ctx->comment_preview['remember'] = false; 
    351                 
     351 
    352352               $core->blog->withoutPassword(true); 
    353                 
     353 
    354354               if ($_ctx->posts->isEmpty()) 
    355355               { 
     
    361361                    $post_id = $_ctx->posts->post_id; 
    362362                    $post_password = $_ctx->posts->post_password; 
    363                      
     363 
    364364                    # Password protected entry 
    365365                    if ($post_password != '' && !$_ctx->preview) 
     
    371371                              $pwd_cookie = array(); 
    372372                         } 
    373                           
     373 
    374374                         # Check for match 
    375375                         if ((!empty($_POST['password']) && $_POST['password'] == $post_password) 
     
    385385                         } 
    386386                    } 
    387                      
     387 
    388388                    $post_comment = 
    389389                         isset($_POST['c_name']) && isset($_POST['c_mail']) && 
    390390                         isset($_POST['c_site']) && isset($_POST['c_content']) && 
    391391                         $_ctx->posts->commentsActive(); 
    392                      
     392 
    393393                    # Posting a comment 
    394394                    if ($post_comment) 
     
    402402                              exit; 
    403403                         } 
    404                           
     404 
    405405                         $name = $_POST['c_name']; 
    406406                         $mail = $_POST['c_mail']; 
     
    408408                         $content = $_POST['c_content']; 
    409409                         $preview = !empty($_POST['preview']); 
    410                           
     410 
    411411                         if ($content != '') 
    412412                         { 
     
    419419                              $content = $core->HTMLfilter($content); 
    420420                         } 
    421                           
     421 
    422422                         $_ctx->comment_preview['content'] = $content; 
    423423                         $_ctx->comment_preview['rawcontent'] = $_POST['c_content']; 
     
    425425                         $_ctx->comment_preview['mail'] = $mail; 
    426426                         $_ctx->comment_preview['site'] = $site; 
    427                           
     427 
    428428                         if ($preview) 
    429429                         { 
    430430                              # --BEHAVIOR-- publicBeforeCommentPreview 
    431431                              $core->callBehavior('publicBeforeCommentPreview',$_ctx->comment_preview); 
    432                                
     432 
    433433                              $_ctx->comment_preview['preview'] = true; 
    434434                         } 
     
    444444                              $cur->comment_status = $core->blog->settings->system->comments_pub ? 1 : -1; 
    445445                              $cur->comment_ip = http::realIP(); 
    446                                
     446 
    447447                              $redir = $_ctx->posts->getURL(); 
    448448                              $redir .= $core->blog->settings->system->url_scan == 'query_string' ? '&' : '?'; 
    449                                
     449 
    450450                              try 
    451451                              { 
     
    453453                                        throw new Exception(__('You must provide a valid email address.')); 
    454454                                   } 
    455                                     
     455 
    456456                                   # --BEHAVIOR-- publicBeforeCommentCreate 
    457457                                   $core->callBehavior('publicBeforeCommentCreate',$cur); 
    458                                    if ($cur->post_id) {                          
     458                                   if ($cur->post_id) { 
    459459                                        $comment_id = $core->blog->addComment($cur); 
    460                                          
     460 
    461461                                        # --BEHAVIOR-- publicAfterCommentCreate 
    462462                                        $core->callBehavior('publicAfterCommentCreate',$cur,$comment_id); 
    463463                                   } 
    464                                     
     464 
    465465                                   if ($cur->comment_status == 1) { 
    466466                                        $redir_arg = 'pub=1'; 
     
    468468                                        $redir_arg = 'pub=0'; 
    469469                                   } 
    470                                     
     470 
    471471                                   header('Location: '.$redir.$redir_arg); 
    472472                              } 
     
    478478                         } 
    479479                    } 
    480                      
     480 
    481481                    # The entry 
    482482                    if ($_ctx->posts->trackbacksActive()) { 
     
    487487          } 
    488488     } 
    489       
     489 
    490490     public static function preview($args) 
    491491     { 
    492492          $core = $GLOBALS['core']; 
    493493          $_ctx = $GLOBALS['_ctx']; 
    494            
     494 
    495495          if (!preg_match('#^(.+?)/([0-9a-z]{40})/(.+?)$#',$args,$m)) { 
    496496               # The specified Preview URL is malformed. 
     
    513513          } 
    514514     } 
    515       
     515 
    516516     public static function feed($args) 
    517517     { 
     
    521521          $post_id = null; 
    522522          $subtitle = ''; 
    523            
     523 
    524524          $mime = 'application/xml'; 
    525            
     525 
    526526          $_ctx =& $GLOBALS['_ctx']; 
    527527          $core =& $GLOBALS['core']; 
    528            
     528 
    529529          if (preg_match('!^([a-z]{2}(-[a-z]{2})?)/(.*)$!',$args,$m)) { 
    530530               $params = new ArrayObject(array('lang' => $m[1])); 
    531                 
     531 
    532532               $args = $m[3]; 
    533                 
     533 
    534534               $core->callBehavior('publicFeedBeforeGetLangs',$params,$args); 
    535                 
     535 
    536536               $_ctx->langs = $core->blog->getLangs($params); 
    537                 
     537 
    538538               if ($_ctx->langs->isEmpty()) { 
    539539                    # The specified language does not exist. 
     
    544544               } 
    545545          } 
    546            
     546 
    547547          if (preg_match('#^rss2/xslt$#',$args,$m)) 
    548548          { 
     
    573573               return; 
    574574          } 
    575            
     575 
    576576          if ($cat_url) 
    577577          { 
     
    579579                    'cat_url' => $cat_url, 
    580580                    'post_type' => 'post')); 
    581                 
     581 
    582582               $core->callBehavior('publicFeedBeforeGetCategories',$params,$args); 
    583                 
     583 
    584584               $_ctx->categories = $core->blog->getCategories($params); 
    585                 
     585 
    586586               if ($_ctx->categories->isEmpty()) { 
    587587                    # The specified category does no exist. 
     
    589589                    return; 
    590590               } 
    591                 
     591 
    592592               $subtitle = ' - '.$_ctx->categories->cat_title; 
    593593          } 
     
    597597                    'post_id' => $post_id, 
    598598                    'post_type' => '')); 
    599                      
     599 
    600600               $core->callBehavior('publicFeedBeforeGetPosts',$params,$args); 
    601                 
     601 
    602602               $_ctx->posts = $core->blog->getPosts($params); 
    603                 
     603 
    604604               if ($_ctx->posts->isEmpty()) { 
    605605                    # The specified post does not exist. 
     
    607607                    return; 
    608608               } 
    609                 
     609 
    610610               $subtitle = ' - '.$_ctx->posts->post_title; 
    611611          } 
    612            
     612 
    613613          $tpl = $type; 
    614614          if ($comments) { 
     
    620620          } 
    621621          $tpl .= '.xml'; 
    622            
     622 
    623623          if ($type == 'atom') { 
    624624               $mime = 'application/atom+xml'; 
    625625          } 
    626            
     626 
    627627          $_ctx->feed_subtitle = $subtitle; 
    628            
     628 
    629629          header('X-Robots-Tag: '.context::robotsPolicy($core->blog->settings->system->robots_policy,'')); 
    630630          self::serveDocument($tpl,$mime); 
     
    633633          } 
    634634     } 
    635       
     635 
    636636     public static function trackback($args) 
    637637     { 
     
    644644          } 
    645645     } 
    646       
     646 
    647647     public static function rsd($args) 
    648648     { 
    649649          $core =& $GLOBALS['core']; 
    650650          http::cache($GLOBALS['mod_files'],$GLOBALS['mod_ts']); 
    651            
     651 
    652652          header('Content-Type: text/xml; charset=UTF-8'); 
    653653          echo 
     
    658658          "  <engineLink>http://www.dotclear.org/</engineLink>\n". 
    659659          '  <homePageLink>'.html::escapeHTML($core->blog->url)."</homePageLink>\n"; 
    660            
     660 
    661661          if ($core->blog->settings->system->enable_xmlrpc) 
    662662          { 
    663663               $u = sprintf(DC_XMLRPC_URL,$core->blog->url,$core->blog->id); 
    664                 
     664 
    665665               echo 
    666666               "  <apis>\n". 
     
    671671               "  </apis>\n"; 
    672672          } 
    673            
     673 
    674674          echo 
    675675          "</service>\n". 
    676676          "</rsd>\n"; 
    677677     } 
    678       
     678 
    679679     public static function xmlrpc($args) 
    680680     { 
     
    685685     } 
    686686} 
    687 ?> 
Note: See TracChangeset for help on using the changeset viewer.

Sites map