[ Index ]
 

Code source de b2evolution 2.1.0-beta

Accédez au Source d'autres logiciels libres

Classes | Fonctions | Variables | Constantes | Tables

title

Body

[fermer]

/blogs/install/ -> _functions_create.php (source)

   1  <?php
   2  /**

   3   * This file implements creation of DB tables

   4   *

   5   * b2evolution - {@link http://b2evolution.net/}

   6   * Released under GNU GPL License - {@link http://b2evolution.net/about/license.html}

   7   * @copyright (c)2003-2007 by Francois PLANQUE - {@link http://fplanque.net/}

   8   * Parts of this file are copyright (c)2004 by Vegar BERG GULDAL - {@link http://funky-m.com/}

   9   * Parts of this file are copyright (c)2005 by Jason EDGECOMBE

  10   *

  11   * @license http://b2evolution.net/about/license.html GNU General Public License (GPL)

  12   *

  13   * {@internal Open Source relicensing agreement:

  14   * Daniel HAHLER grants Francois PLANQUE the right to license

  15   * Daniel HAHLER's contributions to this file and the b2evolution project

  16   * under any OSI approved OSS license (http://www.opensource.org/licenses/).

  17   *

  18   * Vegar BERG GULDAL grants Francois PLANQUE the right to license

  19   * Vegar BERG GULDAL's contributions to this file and the b2evolution project

  20   * under any OSI approved OSS license (http://www.opensource.org/licenses/).

  21   *

  22   * Jason EDGECOMBE grants Francois PLANQUE the right to license

  23   * Jason EDGECOMBE's contributions to this file and the b2evolution project

  24   * under any OSI approved OSS license (http://www.opensource.org/licenses/).

  25   *

  26   * Matt FOLLETT grants Francois PLANQUE the right to license

  27   * Matt FOLLETT contributions to this file and the b2evolution project

  28   * under any OSI approved OSS license (http://www.opensource.org/licenses/).

  29   * }}

  30   *

  31   * @package install

  32   *

  33   * {@internal Below is a list of authors who have contributed to design/coding of this file: }}

  34   * @author blueyed: Daniel HAHLER.

  35   * @author fplanque: Francois PLANQUE.

  36   * @author vegarg: Vegar BERG GULDAL.

  37   * @author edgester: Jason EDGECOMBE.

  38   * @author mfollett: Matt Follett.

  39   *

  40   * @version $Id: _functions_create.php,v 1.230 2007/07/04 21:10:25 blueyed Exp $

  41   */
  42  if( !defined('EVO_MAIN_INIT') ) die( 'Please, do not access this page directly.' );
  43  
  44  load_class( 'users/model/_group.class.php' );
  45  load_funcs( 'collections/model/_category.funcs.php' );
  46  
  47  /**

  48   * Used for fresh install

  49   */
  50  function create_tables()
  51  {
  52      global $inc_path;
  53  
  54      require_once dirname(__FILE__).'/_db_schema.inc.php';
  55      load_class('_core/model/db/_upgrade.funcs.php');
  56  
  57      // Alter DB to match DB schema:

  58      install_make_db_schema_current( true );
  59  }
  60  
  61  
  62  /**

  63   * Insert all default data:

  64   */
  65  function create_default_data()
  66  {
  67      global $Group_Admins, $Group_Privileged, $Group_Bloggers, $Group_Users;
  68      global $DB;
  69  
  70      // Inserting sample data triggers events: instead of checking if $Plugins is an object there, just use a fake one..

  71      load_class('plugins/model/_plugins_admin_no_db.class.php');
  72      global $Plugins;
  73      $Plugins = new Plugins_admin_no_DB(); // COPY

  74  
  75      // upgrade to 0.8.7

  76      echo 'Creating default blacklist entries... ';
  77      $query = "INSERT INTO T_antispam(aspm_string) VALUES ".
  78      "('online-casino'), ('penis-enlargement'), ".
  79      "('order-viagra'), ('order-phentermine'), ('order-xenical'), ".
  80      "('order-prophecia'), ('sexy-lingerie'), ('-porn-'), ".
  81      "('-adult-'), ('-tits-'), ('buy-phentermine'), ".
  82      "('order-cheap-pills'), ('buy-xenadrine'),    ('xxx'), ".
  83      "('paris-hilton'), ('parishilton'), ('camgirls'), ('adult-models')";
  84      $DB->query( $query );
  85      echo "OK.<br />\n";
  86  
  87  
  88      // upgrade to 0.8.9

  89      echo 'Creating default groups... ';
  90      $Group_Admins = new Group(); // COPY !

  91      $Group_Admins->set( 'name', 'Administrators' );
  92      $Group_Admins->set( 'perm_admin', 'visible' );
  93      $Group_Admins->set( 'perm_blogs', 'editall' );
  94      $Group_Admins->set( 'perm_stats', 'edit' );
  95      $Group_Admins->set( 'perm_spamblacklist', 'edit' );
  96      $Group_Admins->set( 'perm_files', 'all' );
  97      $Group_Admins->set( 'perm_options', 'edit' );
  98      $Group_Admins->set( 'perm_templates', 1 );
  99      $Group_Admins->set( 'perm_users', 'edit' );
 100      $Group_Admins->dbinsert();
 101  
 102      $Group_Privileged = new Group(); // COPY !

 103      $Group_Privileged->set( 'name', 'Privileged Bloggers' );
 104      $Group_Privileged->set( 'perm_admin', 'visible' );
 105      $Group_Privileged->set( 'perm_blogs', 'viewall' );
 106      $Group_Privileged->set( 'perm_stats', 'user' );
 107      $Group_Privileged->set( 'perm_spamblacklist', 'edit' );
 108      $Group_Privileged->set( 'perm_files', 'add' );
 109      $Group_Privileged->set( 'perm_options', 'view' );
 110      $Group_Privileged->set( 'perm_templates', 0 );
 111      $Group_Privileged->set( 'perm_users', 'view' );
 112      $Group_Privileged->dbinsert();
 113  
 114      $Group_Bloggers = new Group(); // COPY !

 115      $Group_Bloggers->set( 'name', 'Bloggers' );
 116      $Group_Bloggers->set( 'perm_admin', 'visible' );
 117      $Group_Bloggers->set( 'perm_blogs', 'user' );
 118      $Group_Bloggers->set( 'perm_stats', 'none' );
 119      $Group_Bloggers->set( 'perm_spamblacklist', 'view' );
 120      $Group_Bloggers->set( 'perm_files', 'view' );
 121      $Group_Bloggers->set( 'perm_options', 'none' );
 122      $Group_Bloggers->set( 'perm_templates', 0 );
 123      $Group_Bloggers->set( 'perm_users', 'none' );
 124      $Group_Bloggers->dbinsert();
 125  
 126      $Group_Users = new Group(); // COPY !

 127      $Group_Users->set( 'name', 'Basic Users' );
 128      $Group_Users->set( 'perm_admin', 'none' );
 129      $Group_Users->set( 'perm_blogs', 'user' );
 130      $Group_Users->set( 'perm_stats', 'none' );
 131      $Group_Users->set( 'perm_spamblacklist', 'none' );
 132      $Group_Users->set( 'perm_files', 'none' );
 133      $Group_Users->set( 'perm_options', 'none' );
 134      $Group_Users->set( 'perm_templates', 0 );
 135      $Group_Users->set( 'perm_users', 'none' );
 136      $Group_Users->dbinsert();
 137      echo "OK.<br />\n";
 138  
 139  
 140      echo 'Creating admin user... ';
 141  
 142      global $timestamp, $admin_email, $default_locale, $install_password;
 143      global $random_password;
 144  
 145      $User_Admin = & new User();
 146      $User_Admin->set( 'login', 'admin' );
 147      if( !isset( $install_password ) )
 148      {
 149          $random_password = generate_random_passwd(); // no ambiguous chars

 150      }
 151      else
 152      {
 153          $random_password = $install_password;
 154      }
 155      $User_Admin->set( 'pass', md5($random_password) );    // random

 156      $User_Admin->set( 'nickname', 'admin' );
 157      $User_Admin->set_email( $admin_email );
 158      $User_Admin->set( 'validated', 1 ); // assume it's validated

 159      $User_Admin->set( 'ip', '127.0.0.1' );
 160      $User_Admin->set( 'domain', 'localhost' );
 161      $User_Admin->set( 'level', 10 );
 162      $User_Admin->set( 'locale', $default_locale );
 163      $User_Admin->set_datecreated( $timestamp++ );
 164      // Note: NEVER use database time (may be out of sync + no TZ control)

 165      $User_Admin->set_Group( $Group_Admins );
 166      $User_Admin->dbinsert();
 167      echo "OK.<br />\n";
 168  
 169  
 170      // Upgrade to Phoenix-Alpha

 171      echo 'Creating default Post Types... ';
 172      $DB->query( "
 173          INSERT INTO T_items__type ( ptyp_ID, ptyp_name )
 174          VALUES ( 1, 'Post' ),
 175                       ( 2, 'Link' ),
 176                       ( 1000, 'Page' ),
 177                       ( 2000, 'Reserved' ),
 178                       ( 3000, 'Reserved' ),
 179                       ( 4000, 'Reserved' ),
 180                       ( 5000, 'Reserved' ) " );
 181      echo "OK.<br />\n";
 182  
 183  
 184      // Upgrade to Phoenix-Beta

 185      echo 'Creating default file types... ';
 186      // Contribs: feel free to add more types here...

 187      // TODO: dh> shouldn't they get localized to the app's default locale?

 188      $DB->query( "INSERT INTO T_filetypes
 189              (ftyp_ID, ftyp_extensions, ftyp_name, ftyp_mimetype, ftyp_icon, ftyp_viewtype, ftyp_allowed)
 190          VALUES
 191              (1, 'gif', 'GIF image', 'image/gif', 'image2.png', 'image', 1),
 192              (2, 'png', 'PNG image', 'image/png', 'image2.png', 'image', 1),
 193              (3, 'jpg jpeg', 'JPEG image', 'image/jpeg', 'image2.png', 'image', 1),
 194              (4, 'txt', 'Text file', 'text/plain', 'document.png', 'text', 1),
 195              (5, 'htm html', 'HTML file', 'text/html', 'html.png', 'browser', 0),
 196              (6, 'pdf', 'PDF file', 'application/pdf', 'pdf.png', 'browser', 1),
 197              (7, 'doc', 'Microsoft Word file', 'application/msword', 'doc.gif', 'external', 1),
 198              (8, 'xls', 'Microsoft Excel file', 'application/vnd.ms-excel', 'xls.gif', 'external', 1),
 199              (9, 'ppt', 'Powerpoint', 'application/vnd.ms-powerpoint', 'ppt.gif', 'external', 1),
 200              (10, 'pps', 'Slideshow', 'pps', 'pps.gif', 'external', 1),
 201              (11, 'zip', 'ZIP archive', 'application/zip', 'zip.gif', 'external', 1),
 202              (12, 'php php3 php4 php5 php6', 'PHP script', 'application/x-httpd-php', 'php.gif', 'text', 0),
 203              (13, 'css', 'Style sheet', 'text/css', '', 'text', 1)
 204          " );
 205      echo "OK.<br />\n";
 206  
 207  
 208      create_default_settings();
 209  
 210      install_basic_skins();
 211  
 212      install_basic_plugins();
 213  
 214      return true;
 215  }
 216  
 217  
 218  /**

 219   * Create a new a blog

 220   * This funtion has to handle all needed DB dependencies!

 221   *

 222   * @todo move this to Blog object

 223   */
 224  function create_blog(
 225      $blog_name,
 226      $blog_shortname,
 227      $blog_urlname,
 228      $blog_staticfilename = '', // obsolete
 229      $blog_tagline = '',
 230      $blog_longdesc = '',
 231      $blog_links_blog_ID = 0 )
 232  {
 233      global $DB, $default_locale;
 234  
 235      $query = "INSERT INTO T_blogs( blog_name, blog_shortname, blog_siteurl,
 236                          blog_urlname,
 237                          blog_tagline, blog_longdesc, blog_locale,
 238                          blog_allowcomments, blog_allowtrackbacks,
 239                          blog_in_bloglist, blog_links_blog_ID )
 240      VALUES ( ";
 241      $query .= "'".$DB->escape($blog_name)."', ";
 242      $query .= "'".$DB->escape($blog_shortname)."', ";
 243      $query .= "'', ";
 244      $query .= "'".$DB->escape($blog_urlname)."', ";
 245      $query .= "'".$DB->escape($blog_tagline)."', ";
 246      $query .= "'".$DB->escape($blog_longdesc)."', ";
 247      $query .= "'".$DB->escape($default_locale)."', ";
 248      $query .= "'post_by_post', 0, 1, $blog_links_blog_ID )";
 249  
 250      if( ! ($DB->query( $query )) )
 251          return false;
 252  
 253      return $DB->insert_id;  // blog ID

 254  }
 255  
 256  
 257  /**

 258   * This is called only for fresh installs and fills the tables with

 259   * demo/tutorial things.

 260   */
 261  function create_demo_contents()
 262  {
 263      global $baseurl, $new_db_version;
 264      global $random_password, $query;
 265      global $timestamp, $admin_email;
 266      global $Group_Admins, $Group_Privileged, $Group_Bloggers, $Group_Users;
 267      global $blog_all_ID, $blog_a_ID, $blog_b_ID, $blog_linkblog_ID;
 268      global $DB;
 269      global $default_locale, $install_password;
 270      global $Plugins;
 271  
 272      echo 'Creating demo user... ';
 273      $User_Demo = & new User();
 274      $User_Demo->set( 'login', 'demouser' );
 275      $User_Demo->set( 'pass', md5($random_password) ); // random

 276      $User_Demo->set( 'nickname', 'Mr. Demo' );
 277      $User_Demo->set_email( $admin_email );
 278      $User_Demo->set( 'validated', 1 ); // assume it's validated

 279      $User_Demo->set( 'ip', '127.0.0.1' );
 280      $User_Demo->set( 'domain', 'localhost' );
 281      $User_Demo->set( 'level', 0 );
 282      $User_Demo->set( 'locale', $default_locale );
 283      $User_Demo->set_datecreated( $timestamp++ );
 284      $User_Demo->set_Group( $Group_Users );
 285      $User_Demo->dbinsert();
 286      echo "OK.<br />\n";
 287  
 288  
 289      global $default_locale, $query, $timestamp;
 290      global $blog_all_ID, $blog_a_ID, $blog_b_ID, $blog_linkblog_ID;
 291  
 292      $default_blog_longdesc = T_("This is the long description for the blog named '%s'. %s");
 293  
 294      echo "Creating default blogs... ";
 295  
 296      $blog_shortname = 'Blog A';
 297      $blog_a_long = sprintf( T_('%s Title'), $blog_shortname );
 298      $blog_stub = 'a';
 299      $blog_a_ID = create_blog(
 300          $blog_a_long,
 301          $blog_shortname,
 302          $blog_stub,
 303          $blog_stub.'.html',
 304          sprintf( T_('Tagline for %s'), $blog_shortname ),
 305          sprintf( $default_blog_longdesc, $blog_shortname, '' ),
 306          3 );    // !!! Linkblofg ID

 307  
 308      $blog_shortname = 'Blog B';
 309      $blog_stub = 'b';
 310      $blog_b_ID = create_blog(
 311          sprintf( T_('%s Title'), $blog_shortname ),
 312          $blog_shortname,
 313          $blog_stub,
 314          $blog_stub.'.html',
 315          sprintf( T_('Tagline for %s'), $blog_shortname ),
 316          sprintf( $default_blog_longdesc, $blog_shortname, '' ),
 317          3 );    // !!! Linkblofg ID

 318  
 319      $blog_shortname = 'Linkblog';
 320      $blog_stub = 'links';
 321      $blog_more_longdesc = '<br />
 322  <br />
 323  <strong>'.T_("The main purpose for this blog is to be included as a side item to other blogs where it will display your favorite/related links.").'</strong>';
 324      $blog_linkblog_ID = create_blog(
 325          sprintf( T_('%s Title'), $blog_shortname ),
 326          $blog_shortname,
 327          $blog_stub,
 328          $blog_stub.'.html',
 329          sprintf( T_('Tagline for %s'), $blog_shortname ),
 330          sprintf( $default_blog_longdesc, $blog_shortname, $blog_more_longdesc ),
 331          0 /* no Link blog */ );
 332  
 333      echo "OK.<br />\n";
 334  
 335  
 336      global $query, $timestamp;
 337  
 338      echo 'Creating sample categories... ';
 339  
 340      // Create categories for blog A

 341      $cat_ann_a = cat_create( 'Welcome', 'NULL', $blog_a_ID );
 342      $cat_news = cat_create( 'News', 'NULL', $blog_a_ID );
 343      $cat_bg = cat_create( 'Background', 'NULL', $blog_a_ID );
 344      $cat_fun = cat_create( 'Fun', 'NULL', $blog_a_ID );
 345      $cat_life = cat_create( 'In real life', $cat_fun, $blog_a_ID );
 346      $cat_web = cat_create( 'On the web', $cat_fun, $blog_a_ID );
 347      $cat_sports = cat_create( 'Sports', $cat_life, $blog_a_ID );
 348      $cat_movies = cat_create( 'Movies', $cat_life, $blog_a_ID );
 349      $cat_music = cat_create( 'Music', $cat_life, $blog_a_ID );
 350  
 351      // Create categories for blog B

 352      $cat_ann_b = cat_create( 'Announcements', 'NULL', $blog_b_ID );
 353      $cat_b2evo = cat_create( 'b2evolution Tips', 'NULL', $blog_b_ID );
 354  
 355      // Create categories for linkblog

 356      $cat_linkblog_b2evo = cat_create( 'b2evolution', 'NULL', $blog_linkblog_ID );
 357      $cat_linkblog_contrib = cat_create( 'contributors', 'NULL', $blog_linkblog_ID );
 358  
 359      echo "OK.<br />\n";
 360  
 361  
 362      echo 'Creating sample posts... ';
 363  
 364      // Insert a post:

 365      $now = date('Y-m-d H:i:s',$timestamp++);
 366      $edited_Item = & new Item();
 367      $edited_Item->insert( 1, T_('First Post'), T_('<p>This is the first post.</p>
 368  
 369  <p>It appears in a single category.</p>'), $now, $cat_ann_a );
 370  
 371      // Insert a post:

 372      $now = date('Y-m-d H:i:s',$timestamp++);
 373      $edited_Item = & new Item();
 374      $edited_Item->insert( 1, T_('Second post'), T_('<p>This is the second post.</p>
 375  
 376  <p>It appears in multiple categories.</p>'), $now, $cat_news, array( $cat_ann_a ) );
 377  
 378  
 379  
 380      // POPULATE THE LINKBLOG:

 381  
 382      // Insert a post into linkblog:

 383      $now = date('Y-m-d H:i:s',$timestamp++);
 384      $edited_Item = & new Item();
 385      $edited_Item->insert( 1, 'Danny', '', $now, $cat_linkblog_contrib, array(), 'published',    'en-US', '', 'http://brendoman.com/dbc', 'disabled', array() );
 386  
 387      // Insert a post into linkblog:

 388      $now = date('Y-m-d H:i:s',$timestamp++);
 389      $edited_Item = & new Item();
 390      $edited_Item->insert( 1, 'Yabba', '', $now, $cat_linkblog_contrib, array(), 'published',    'en-UK', '', 'http://www.innervisions.org.uk/babbles/', 'disabled', array() );
 391  
 392      // Insert a post into linkblog:

 393      $now = date('Y-m-d H:i:s',$timestamp++);
 394      $edited_Item = & new Item();
 395      $edited_Item->insert( 1, 'Halton', '', $now, $cat_linkblog_contrib, array(), 'published',    'en-US', '', 'http://browsermonkey.com/', 'disabled', array() );
 396  
 397      // Insert a post into linkblog:

 398      $now = date('Y-m-d H:i:s',$timestamp++);
 399      $edited_Item = & new Item();
 400      $edited_Item->insert( 1, 'Topanga', '', $now, $cat_linkblog_contrib, array(), 'published',    'en-US', '', 'http://www.tenderfeelings.be', 'disabled', array() );
 401  
 402      // Insert a post into linkblog:

 403      $now = date('Y-m-d H:i:s',$timestamp++);
 404      $edited_Item = & new Item();
 405      $edited_Item->insert( 1, 'EdB', '', $now, $cat_linkblog_contrib, array(), 'published',    'en-US', '', 'http://wonderwinds.com/', 'disabled', array() );
 406  
 407      // Insert a post into linkblog:

 408      $now = date('Y-m-d H:i:s',$timestamp++);
 409      $edited_Item = & new Item();
 410      $edited_Item->insert( 1, 'dAniel', '', $now, $cat_linkblog_contrib, array(), 'published',    'de-DE', '', 'http://daniel.hahler.de/', 'disabled', array() );
 411  
 412      // Insert a post into linkblog:

 413      $now = date('Y-m-d H:i:s',$timestamp++);
 414      $edited_Item = & new Item();
 415      $edited_Item->insert( 1, 'Francois', '', $now, $cat_linkblog_contrib, array(), 'published',     'fr-FR', '', 'http://fplanque.com/', 'disabled', array() );
 416  
 417      // Insert a post into linkblog:

 418      $now = date('Y-m-d H:i:s',$timestamp++);
 419      $edited_Item = & new Item();
 420      $edited_Item->insert( 1, 'b2evolution home', '', $now, $cat_linkblog_b2evo, array(), 'published',    'en-EU', '', 'http://b2evolution.net/', 'disabled', array() );
 421  
 422      // Insert a post into linkblog:

 423      $now = date('Y-m-d H:i:s',$timestamp++);
 424      $edited_Item = & new Item();
 425      $edited_Item->insert( 1, 'User manual', '', $now, $cat_linkblog_b2evo, array(), 'published',    'en-EU', '', 'http://manual.b2evolution.net/', 'disabled', array() );
 426  
 427      // Insert a post into linkblog:

 428      $now = date('Y-m-d H:i:s',$timestamp++);
 429      $edited_Item = & new Item();
 430      $edited_Item->insert( 1, 'Support forums', '', $now, $cat_linkblog_b2evo, array(), 'published',    'en-EU', '', 'http://forums.b2evolution.net/', 'disabled', array() );
 431  
 432  
 433      global $query, $timestamp;
 434  
 435      // Insert a post:

 436      $now = date('Y-m-d H:i:s',$timestamp++);
 437      $edited_Item = & new Item();
 438      $edited_Item->insert( 1, T_("Clean Permalinks!"), T_("b2evolution uses old-style permalinks and feedback links by default. This is to ensure maximum compatibility with various webserver configurations.
 439  
 440  Nethertheless, once you feel comfortable with b2evolution, you should try activating clean permalinks in the Global Settings &gt; Link options in the admin interface."), $now, $cat_b2evo );
 441  
 442      // Insert a post:

 443      $now = date('Y-m-d H:i:s',$timestamp++);
 444      $edited_Item = & new Item();
 445      $edited_Item->insert( 1, T_("Apache optimization..."), T_("In the <code>/blogs</code> folder there is a file called [<code>sample.htaccess</code>]. You should try renaming it to [<code>.htaccess</code>].
 446  
 447  This will optimize the way b2evolution is handled by the webserver (if you are using Apache). This file is not active by default because a few hosts would display an error right away when you try to use it. If this happens to you when you rename the file, just remove it and you'll be fine."), $now, $cat_b2evo );
 448  
 449      // Insert a post:

 450      $now = date('Y-m-d H:i:s',$timestamp++);
 451      $edited_Item = & new Item();
 452      $edited_Item->insert( 1, T_("Skins, Stubs, Templates &amp; website integration..."), T_("By default, blogs are displayed using a skin. (More on skins in another post.)
 453  
 454  This means, blogs are accessed through '<code>index.php</code>', which loads default parameters from the database and then passes on the display job to a skin.
 455  
 456  Alternatively, if you don't want to use the default DB parameters and want to, say, force a skin, a category or a specific linkblog, you can create a stub file like the provided '<code>a_stub.php</code>' and call your blog through this stub instead of index.php .
 457  
 458  Finally, if you need to do some very specific customizations to your blog, you may use plain templates instead of skins. In this case, call your blog through a full template, like the provided '<code>a_noskin.php</code>'.
 459  
 460  If you want to integrate a b2evolution blog into a complex website, you'll probably want to do it by copy/pasting code from <code>a_noskin.php</code> into a page of your website.
 461  
 462  You will find more information in the stub/template files themselves. Open them in a text editor and read the comments in there.
 463  
 464  Either way, make sure you go to the blogs admin and set the correct access method for your blog. When using a stub or a template, you must also set its filename in the 'Stub name' field. Otherwise, the permalinks will not function properly."), $now, $cat_b2evo );
 465  
 466      // Insert a post:

 467      $now = date('Y-m-d H:i:s',$timestamp++);
 468      $edited_Item = & new Item();
 469      $edited_Item->insert( 1, T_("About widgets..."), T_('b2evolution blogs are installed with a default selection of Widgets. For example, the sidebar of this blog includes widgets like a calendar, a search field, a list of categories, a list of XML feeds, etc.
 470  
 471  You can add, remove and reorder widgets from the Blog Settings tab in the admin interface.
 472  
 473  Note: to be displayed widgets are placed in containers. Each container appears in a specific place on a skin. If you change the skin of your blog, the new skin may not use the same containers as the previous one. Make sure you place your widgets in containers that exist in the specific skin you are using.'), $now, $cat_b2evo );
 474  
 475      // Insert a post:

 476      $now = date('Y-m-d H:i:s',$timestamp++);
 477      $edited_Item = & new Item();
 478      $edited_Item->insert( 1, T_("About skins..."), T_('By default, b2evolution blogs are displayed using a skin.
 479  
 480  You can change the skin used by any blog by editing the blog settings in the admin interface.
 481  
 482  You can download additional skins from the <a href="http://skins.b2evolution.net/" target="_blank">skin site</a>. To install them, unzip them in the /blogs/skins directory, then go to General Settings &gt; Skins in the admin interface and click on "Install new".
 483  
 484  You can also create your own skins by duplicating, renaming and customizing any existing skin folder from the /blogs/skins directory.
 485  
 486  To start customizing a skin, open its "<code>index.main.php</code>" file in an editor and read the comments in there. And, of course, read the manual on skins!'), $now, $cat_b2evo );
 487  
 488  
 489      // Create newbie posts:

 490      $now = date('Y-m-d H:i:s',$timestamp++);
 491      $edited_Item = & new Item();
 492      $edited_Item->insert( 1, T_('This is a multipage post'), T_('This is page 1 of a multipage post.
 493  
 494  You can see the other pages by clicking on the links below the text.
 495  
 496  <!--nextpage-->
 497  
 498  This is page 2.
 499  
 500  <!--nextpage-->
 501  
 502  This is page 3.
 503  
 504  <!--nextpage-->
 505  
 506  This is page 4.
 507  
 508  It is the last page.'), $now, $cat_bg );
 509  
 510  
 511      $now = date('Y-m-d H:i:s',$timestamp++);
 512      $edited_Item = & new Item();
 513      $edited_Item->insert( 1, T_('Extended post with no teaser'), T_('This is an extended post with no teaser. This means that you won\'t see this teaser any more when you click the "more" link.
 514  
 515  <!--more--><!--noteaser-->
 516  
 517  This is the extended text. You only see it when you have clicked the "more" link.'), $now, $cat_bg );
 518  
 519  
 520      $now = date('Y-m-d H:i:s',$timestamp++);
 521      $edited_Item = & new Item();
 522      $edited_Item->insert( 1, T_('Extended post'), T_('This is an extended post. This means you only see this small teaser by default and you must click on the link below to see more.
 523  
 524  <!--more-->
 525  
 526  This is the extended text. You only see it when you have clicked the "more" link.'), $now, $cat_bg );
 527  
 528      // Insert a post:

 529      $now = date('Y-m-d H:i:s',$timestamp++);
 530      $edited_Item = & new Item();
 531      $edited_Item->insert( 1, T_("Welcome to b2evolution!"), T_("Three blogs have been created with sample contents:
 532  <ul>
 533      <li><strong>Blog A</strong>: You are currently looking at it. It contains a few sample posts, using simple features of b2evolution.</li>
 534      <li><strong>Blog B</strong>: You can access it from a link at the top of the page. It contains information about more advanced features.</li>
 535      <li><strong>Linkblog</strong>: The linkblog is included by default in the sidebar of both Blog A &amp; Blog B.</li>
 536  </ul>
 537  
 538  You can add new blogs, delete unwanted blogs and customize existing blogs (title, sidebar, skin, widgets, etc.) from the Blog Settings tab in the admin interface."), $now, $cat_ann_a );
 539  
 540  
 541      $info_page = T_("This blog is powered by b2evolution.
 542  
 543  You are currently looking at an info page about %s.
 544  
 545  Info pages are very much like regular posts, except that they do not appear in the regular flow of posts. They appear as info pages in the sidebar instead.
 546  
 547  If needed, a skin can format info pages differently from regular posts.");
 548  
 549      // Insert a PAGE:

 550      $now = date('Y-m-d H:i:s',$timestamp++);
 551      $edited_Item = & new Item();
 552      $edited_Item->insert( 1, T_("About Blog B"), sprintf( $info_page, T_('Blog B') ), $now, $cat_ann_b,
 553          array(), 'published', '#', '', '', 'open', array('default'), 1000 );
 554  
 555      // Insert a PAGE:

 556      $now = date('Y-m-d H:i:s',$timestamp++);
 557      $edited_Item = & new Item();
 558      $edited_Item->insert( 1, T_("About Blog A"), sprintf( $info_page, T_('Blog A') ), $now, $cat_ann_a,
 559          array(), 'published', '#', '', '', 'open', array('default'), 1000 );
 560  
 561      // Insert a PAGE:

 562      $now = date('Y-m-d H:i:s',$timestamp++);
 563      $edited_Item = & new Item();
 564      $edited_Item->insert( 1, T_("About this system"), T_("This blog platform is powered by b2evolution.
 565  
 566  You are currently looking at an info page about this system. It is cross-posted among the 3 demo blogs. Thus, this page will be linked on each of these blogs.
 567  
 568  Info pages are very much like regular posts, except that they do not appear in the regular flow of posts. They appear as info pages in the sidebar instead.
 569  
 570  If needed, a skin can format info pages differently from regular posts."), $now, $cat_ann_a,
 571          array( $cat_ann_a, $cat_ann_b, $cat_linkblog_b2evo ), 'published', '#', '', '', 'open', array('default'), 1000 );
 572  
 573      echo "OK.<br />\n";
 574  
 575  
 576  
 577      echo 'Creating sample comments... ';
 578  
 579      $now = date('Y-m-d H:i:s');
 580      $query = "INSERT INTO T_comments( comment_post_ID, comment_type, comment_author,
 581                                                                                  comment_author_email, comment_author_url, comment_author_IP,
 582                                                                                  comment_date, comment_content, comment_karma)
 583                          VALUES( 1, 'comment', 'miss b2', 'missb2@example.com', 'http://example.com', '127.0.0.1',
 584                                       '$now', '".
 585                                       $DB->escape(T_('Hi, this is a comment.<br />To delete a comment, just log in, and view the posts\' comments, there you will have the option to edit or delete them.')). "', 0)";
 586      $DB->query( $query );
 587  
 588      echo "OK.<br />\n";
 589  
 590  
 591      echo 'Creating default group/blog permissions... ';
 592      // Admin for blog A:

 593      $query = "
 594          INSERT INTO T_coll_group_perms( bloggroup_blog_ID, bloggroup_group_ID, bloggroup_ismember,
 595              bloggroup_perm_poststatuses, bloggroup_perm_delpost, bloggroup_perm_comments,
 596              bloggroup_perm_cats, bloggroup_perm_properties,
 597              bloggroup_perm_media_upload, bloggroup_perm_media_browse, bloggroup_perm_media_change )
 598          VALUES
 599              ( $blog_a_ID, ".$Group_Admins->ID.", 1, 'published,deprecated,protected,private,draft', 1, 1, 1, 1, 1, 1, 1 ),
 600              ( $blog_a_ID, ".$Group_Privileged->ID.", 1, 'published,deprecated,protected,private,draft', 1, 1, 0, 0, 1, 1, 1 ),
 601              ( $blog_a_ID, ".$Group_Bloggers->ID.", 1, 'published,deprecated,protected,private,draft', 0, 0, 0, 0, 1, 1, 0 ),
 602              ( $blog_a_ID, ".$Group_Users->ID.", 1, '', 0, 0, 0, 0, 0, 0, 0 ),
 603              ( $blog_b_ID, ".$Group_Admins->ID.", 1, 'published,deprecated,protected,private,draft', 1, 1, 1, 1, 1, 1, 1 ),
 604              ( $blog_b_ID, ".$Group_Privileged->ID.", 1, 'published,deprecated,protected,private,draft', 1, 1, 0, 0, 1, 1, 1 ),
 605              ( $blog_b_ID, ".$Group_Bloggers->ID.", 1, 'published,deprecated,protected,private,draft', 0, 0, 0, 0, 1, 1, 0 ),
 606              ( $blog_b_ID, ".$Group_Users->ID.", 1, '', 0, 0, 0, 0, 0, 0, 0 ),
 607              ( $blog_linkblog_ID, ".$Group_Admins->ID.", 1, 'published,deprecated,protected,private,draft', 1, 1, 1, 1, 1, 1, 1 ),
 608              ( $blog_linkblog_ID, ".$Group_Privileged->ID.", 1, 'published,deprecated,protected,private,draft', 1, 1, 0, 0, 1, 1, 1 ),
 609              ( $blog_linkblog_ID, ".$Group_Bloggers->ID.", 1, 'published,deprecated,protected,private,draft', 0, 0, 0, 0, 1, 1, 0 ),
 610              ( $blog_linkblog_ID, ".$Group_Users->ID.", 1, '', 0, 0, 0, 0, 0, 0, 0 )";
 611      $DB->query( $query );
 612      echo "OK.<br />\n";
 613  
 614      /*

 615      // Note: we don't really need this any longer, but we might use it for a better default setup later...

 616      echo 'Creating default user/blog permissions... ';

 617      // Admin for blog A:

 618      $query = "INSERT INTO T_coll_user_perms( bloguser_blog_ID, bloguser_user_ID, bloguser_ismember,

 619                              bloguser_perm_poststatuses, bloguser_perm_delpost, bloguser_perm_comments,

 620                              bloguser_perm_cats, bloguser_perm_properties,

 621                              bloguser_perm_media_upload, bloguser_perm_media_browse, bloguser_perm_media_change )

 622                          VALUES

 623                              ( $blog_a_ID, ".$User_Demo->ID.", 1,

 624                              'published,deprecated,protected,private,draft', 1, 1, 0, 0, 1, 1, 1 )";

 625      $DB->query( $query );

 626      echo "OK.<br />\n";

 627      */
 628  
 629  
 630      install_basic_widgets();
 631  
 632  }
 633  
 634  
 635  /*

 636   * $Log: _functions_create.php,v $

 637   * Revision 1.230  2007/07/04 21:10:25  blueyed

 638   * More test include fixes

 639   *

 640   * Revision 1.229  2007/06/27 02:23:24  fplanque

 641   * new default template for skins named index.main.php

 642   *

 643   * Revision 1.228  2007/06/25 11:02:29  fplanque

 644   * MODULES (refactored MVC)

 645   *

 646   * Revision 1.227  2007/05/28 01:35:23  fplanque

 647   * fixed static page generation

 648   *

 649   * Revision 1.226  2007/05/14 02:43:06  fplanque

 650   * Started renaming tables. There probably won't be a better time than 2.0.

 651   *

 652   * Revision 1.225  2007/05/13 20:44:52  fplanque

 653   * more pages support

 654   *

 655   * Revision 1.224  2007/05/08 00:54:31  fplanque

 656   * public blog list as a widget

 657   *

 658   * Revision 1.223  2007/05/07 18:59:45  fplanque

 659   * renamed skin .page.php files to .tpl.php

 660   *

 661   * Revision 1.222  2007/04/26 00:11:09  fplanque

 662   * (c) 2007

 663   *

 664   * Revision 1.221  2007/03/26 12:59:18  fplanque

 665   * basic pages support

 666   *

 667   * Revision 1.220  2007/03/25 13:20:52  fplanque

 668   * cleaned up blog base urls

 669   * needs extensive testing...

 670   *

 671   * Revision 1.219  2007/03/20 09:53:26  fplanque

 672   * Letting boggers view their own stats.

 673   * + Letthing admins view the aggregate by default.

 674   *

 675   * Revision 1.218  2007/03/18 01:39:54  fplanque

 676   * renamed _main.php to main.page.php to comply with 2.0 naming scheme.

 677   * (more to come)

 678   *

 679   * Revision 1.217  2007/02/21 21:33:43  fplanque

 680   * allow jpeg extension on new installs/upgrades

 681   *

 682   * Revision 1.216  2007/01/24 13:47:28  fplanque

 683   * cleaned up file types

 684   *

 685   * Revision 1.215  2007/01/20 16:08:36  blueyed

 686   * fixed grammar

 687   *

 688   * Revision 1.214  2007/01/15 19:10:29  fplanque

 689   * install refactoring

 690   *

 691   * Revision 1.213  2007/01/15 17:00:42  fplanque

 692   * cleaned up default contents

 693   *

 694   * Revision 1.212  2007/01/15 03:53:24  fplanque

 695   * refactoring / simplified installer

 696   *

 697   * Revision 1.211  2007/01/14 01:32:14  fplanque

 698   * more widgets supported! :)

 699   *

 700   * Revision 1.210  2007/01/12 02:40:26  fplanque

 701   * widget default params proof of concept

 702   * (param customization to be done)

 703   *

 704   * Revision 1.209  2007/01/08 02:11:56  fplanque

 705   * Blogs now make use of installed skins

 706   * next step: make use of widgets inside of skins

 707   *

 708   * Revision 1.208  2006/12/17 23:42:39  fplanque

 709   * Removed special behavior of blog #1. Any blog can now aggregate any other combination of blogs.

 710   * Look into Advanced Settings for the aggregating blog.

 711   * There may be side effects and new bugs created by this. Please report them :]

 712   *

 713   * Revision 1.207  2006/12/12 20:26:12  blueyed

 714   * Fixed sample post about sample.htaccess in (obsolete/removed) "admin" folder. See http://forums.b2evolution.net/viewtopic.php?p=48204#48204

 715   *

 716   * Revision 1.206  2006/12/07 20:31:29  fplanque

 717   * fixed install

 718   *

 719   * Revision 1.205  2006/12/07 16:06:24  fplanque

 720   * prepared new file editing permission

 721   *

 722   * Revision 1.204  2006/12/04 22:25:20  blueyed

 723   * Do not output "Installing default plugins... " always

 724   *

 725   * Revision 1.203  2006/11/30 06:04:12  blueyed

 726   * Moved Plugins::install() and sort() galore to Plugins_admin

 727   *

 728   * Revision 1.202  2006/10/10 23:00:41  blueyed

 729   * Fixed some table names to alias; fixed plugin install procedure; installed ping plugins; moved some upgrade code to 1.9

 730   *

 731   * Revision 1.201  2006/10/06 21:52:52  blueyed

 732   * Enable upload for new "css" type

 733   *

 734   * Revision 1.200  2006/10/06 21:03:07  blueyed

 735   * Removed deprecated/unused "upload_allowedext" Setting, which restricted file extensions during upload though!

 736   */
 737  ?>


Généré le : Thu Nov 29 23:58:50 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics