| 1 | <?php | 
|---|
| 2 | # -- BEGIN LICENSE BLOCK --------------------------------------- | 
|---|
| 3 | # | 
|---|
| 4 | # This file is part of Dotclear 2. | 
|---|
| 5 | # | 
|---|
| 6 | # Copyright (c) 2003-2013 Olivier Meunier & Association Dotclear | 
|---|
| 7 | # Licensed under the GPL version 2.0 license. | 
|---|
| 8 | # See LICENSE file or | 
|---|
| 9 | # http://www.gnu.org/licenses/old-licenses/gpl-2.0.html | 
|---|
| 10 | # | 
|---|
| 11 | # -- END LICENSE BLOCK ----------------------------------------- | 
|---|
| 12 |  | 
|---|
| 13 | if (!defined('DC_CONTEXT_ADMIN')){return;} | 
|---|
| 14 |  | 
|---|
| 15 | $version = $core->plugins->moduleInfo('pages','version'); | 
|---|
| 16 | if (version_compare($core->getVersion('pages'),$version,'>=')) { | 
|---|
| 17 |      return; | 
|---|
| 18 | } | 
|---|
| 19 |  | 
|---|
| 20 | /* Create first page | 
|---|
| 21 | -------------------------------------------------------- */ | 
|---|
| 22 | $core->setBlog('default'); | 
|---|
| 23 |  | 
|---|
| 24 | $core->blog->settings->addNamespace('pages'); | 
|---|
| 25 |  | 
|---|
| 26 | $params = array( | 
|---|
| 27 |      'post_type' => 'page', | 
|---|
| 28 |      'no_content' => true | 
|---|
| 29 | ); | 
|---|
| 30 | $counter = $core->blog->getPosts($params,true); | 
|---|
| 31 |  | 
|---|
| 32 | If( $counter->f(0) == 0 && $core->blog->settings->pages->firstpage == null ) { | 
|---|
| 33 |       | 
|---|
| 34 |      $core->blog->settings->pages->put('firstpage',true, 'boolean'); | 
|---|
| 35 |  | 
|---|
| 36 |      $cur = $core->con->openCursor($core->prefix.'post'); | 
|---|
| 37 |      $cur->user_id = $core->auth->userID(); | 
|---|
| 38 |      $cur->post_type = 'page'; | 
|---|
| 39 |      $cur->post_format = 'xhtml'; | 
|---|
| 40 |      $cur->post_lang = $core->blog->settings->system->lang; | 
|---|
| 41 |      $cur->post_title = __('My first page'); | 
|---|
| 42 |      $cur->post_content = __('<p>'.__('This is your first page. When you\'re ready to blog, log in to edit or delete it.').'</p>'); | 
|---|
| 43 |      $cur->post_content_xhtml = $cur->post_content; | 
|---|
| 44 |      $cur->post_excerpt = ''; | 
|---|
| 45 |      $cur->post_excerpt_xhtml = $cur->post_excerpt; | 
|---|
| 46 |      $cur->post_status = 1; | 
|---|
| 47 |      $cur->post_open_comment = 0; | 
|---|
| 48 |      $cur->post_open_tb = 0; | 
|---|
| 49 |      $post_id = $core->blog->addPost($cur); | 
|---|
| 50 |       | 
|---|
| 51 | } | 
|---|
| 52 |  | 
|---|
| 53 | $core->setVersion('pages',$version); | 
|---|
| 54 | return true; | 
|---|
| 55 | ?> | 
|---|