| 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 | $core->blog->settings->addNamespace('pages'); | 
|---|
| 21 |  | 
|---|
| 22 | if ($core->getVersion('pages') == null) { | 
|---|
| 23 |  | 
|---|
| 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); | 
|---|
| 30 |  | 
|---|
| 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 | } | 
|---|
| 50 | } | 
|---|
| 51 |  | 
|---|
| 52 | $core->setVersion('pages',$version); | 
|---|
| 53 | return true; | 
|---|
| 54 | ?> | 
|---|