Dotclear

Changeset 1939:4f832b9bf4f1


Ignore:
Timestamp:
09/18/13 08:15:54 (12 years ago)
Author:
franck <carnet.franck.paul@…>
Branch:
default
Message:

A sample page will be created only on the first installation of the plugin pages - fixes #1673

File:
1 edited

Legend:

Unmodified
Added
Removed
  • plugins/pages/_install.php

    r1802 r1939  
    1818} 
    1919 
    20 /* Create first page 
    21 -------------------------------------------------------- */ 
    2220$core->blog->settings->addNamespace('pages'); 
    2321 
    24 $params = array( 
    25      'post_type' => 'page', 
    26      'no_content' => true 
    27 ); 
    28 $counter = $core->blog->getPosts($params,true); 
     22if ($core->getVersion('pages') == null) { 
    2923 
    30 If( $counter->f(0) == 0 && $core->blog->settings->pages->firstpage == null ) { 
    31       
    32      $core->blog->settings->pages->put('firstpage',true, 'boolean'); 
     24     // Create a first pending page, only on a new installation of this plugin 
     25     $params = array( 
     26          'post_type' => 'page', 
     27          'no_content' => true 
     28     ); 
     29     $counter = $core->blog->getPosts($params,true); 
    3330 
    34      $cur = $core->con->openCursor($core->prefix.'post'); 
    35      $cur->user_id = $core->auth->userID(); 
    36      $cur->post_type = 'page'; 
    37      $cur->post_format = 'xhtml'; 
    38      $cur->post_lang = $core->blog->settings->system->lang; 
    39      $cur->post_title = __('My first page'); 
    40      $cur->post_content = __('<p>'.__('This is your first page. When you\'re ready to blog, log in to edit or delete it.').'</p>'); 
    41      $cur->post_content_xhtml = $cur->post_content; 
    42      $cur->post_excerpt = ''; 
    43      $cur->post_excerpt_xhtml = $cur->post_excerpt; 
    44      $cur->post_status = 1; 
    45      $cur->post_open_comment = 0; 
    46      $cur->post_open_tb = 0; 
    47      $post_id = $core->blog->addPost($cur); 
    48       
     31     If( $counter->f(0) == 0 && $core->blog->settings->pages->firstpage == null ) { 
     32 
     33          $core->blog->settings->pages->put('firstpage',true, 'boolean'); 
     34 
     35          $cur = $core->con->openCursor($core->prefix.'post'); 
     36          $cur->user_id = $core->auth->userID(); 
     37          $cur->post_type = 'page'; 
     38          $cur->post_format = 'xhtml'; 
     39          $cur->post_lang = $core->blog->settings->system->lang; 
     40          $cur->post_title = __('My first page'); 
     41          $cur->post_content = __('<p>'.__('This is your first page. When you\'re ready to blog, log in to edit or delete it.').'</p>'); 
     42          $cur->post_content_xhtml = $cur->post_content; 
     43          $cur->post_excerpt = ''; 
     44          $cur->post_excerpt_xhtml = $cur->post_excerpt; 
     45          $cur->post_status = -2;  // Pending status 
     46          $cur->post_open_comment = 0; 
     47          $cur->post_open_tb = 0; 
     48          $post_id = $core->blog->addPost($cur); 
     49     } 
    4950} 
    5051 
Note: See TracChangeset for help on using the changeset viewer.

Sites map