NewsFeaturesDownloadsDevelopmentSupportAbout Us

lifetype/branches/lifetype-1.0.6/wizard.php

Go to the documentation of this file.
00001 <?php
00002 
00003     if (!defined( "PLOG_CLASS_PATH" )) {
00004         define( "PLOG_CLASS_PATH", dirname(__FILE__)."/");
00005     }
00006 
00007     set_time_limit (5 * 3600);
00008 
00009     //
00010     // enable this for debugging purposes
00011     //
00012     define( "DB_WIZARD_DEBUG", false );
00013 
00014     //
00015     // in case you're having problems with time outs while upgrading (probably too
00016     // many records) lower this figure
00017     //
00018     define( "WIZARD_MAX_RECORDS_PER_STEP", 50 );
00019 
00020     //
00021     // threshold that defines up to how many records we should not divide the
00022     // transformations in more than one step
00023     //
00024     define( "WIZARD_MAX_RECORDS_THRESHOLD", 100 );
00025 
00026     // many hosts don't have this enabled and we, for the time being, need it...
00027     ini_set("arg_seperator.output", "&amp;");
00028 
00029     include_once( PLOG_CLASS_PATH."class/controller/controller.class.php" );
00030     include_once( PLOG_CLASS_PATH."class/template/templateservice.class.php" );
00031     include_once( PLOG_CLASS_PATH."class/action/action.class.php" );
00032     include_once( PLOG_CLASS_PATH."class/template/template.class.php" );
00033     include_once( PLOG_CLASS_PATH."class/view/view.class.php" );
00034     include_once( PLOG_CLASS_PATH."class/database/adodb/adodb.inc.php" );
00035     include_once( PLOG_CLASS_PATH."class/data/validator/stringvalidator.class.php" );
00036     include_once( PLOG_CLASS_PATH."class/data/validator/emailvalidator.class.php" );
00037     include_once( PLOG_CLASS_PATH."class/data/validator/passwordvalidator.class.php" );
00038     include_once( PLOG_CLASS_PATH."class/dao/users.class.php" );
00039     include_once( PLOG_CLASS_PATH."class/dao/blogs.class.php" );
00040     include_once( PLOG_CLASS_PATH."class/dao/articlecategories.class.php" );
00041     include_once( PLOG_CLASS_PATH."class/dao/articles.class.php" );
00042     include_once( PLOG_CLASS_PATH."class/net/http/httpvars.class.php" );
00043     include_once( PLOG_CLASS_PATH."class/dao/userpermissions.class.php" );
00044     include_once( PLOG_CLASS_PATH."class/misc/version.class.php" );
00045     include_once( PLOG_CLASS_PATH."class/file/file.class.php" );
00046     include_once( PLOG_CLASS_PATH."class/file/finder/filefinder.class.php" );
00047     include_once( PLOG_CLASS_PATH."class/gallery/resizers/gddetector.class.php" );
00048     include_once( PLOG_CLASS_PATH."class/config/configfilestorage.class.php" );
00049     include_once( PLOG_CLASS_PATH."class/data/textfilter.class.php" );
00050     include_once( PLOG_CLASS_PATH."class/locale/locales.class.php" );
00051     include_once( PLOG_CLASS_PATH."class/locale/localefinder.class.php" );
00052 
00053     define( "TEMP_FOLDER", "./tmp" );
00054 
00055     // sql querys used to create the tables
00056 
00057     // maps used to map requests with actions
00058     $_actionMap["Default"] = "WizardIntro";
00059     $_actionMap["Intro"] = "WizardIntro";
00060     $_actionMap["Step1"] = "WizardStepOne";
00061     $_actionMap["Step2"] = "WizardStepTwo";
00062     $_actionMap["Step3"] = "WizardStepThree";
00063     $_actionMap["Step4"] = "WizardStepFour";
00064     $_actionMap["Step5"] = "WizardStepFive";
00065     $_actionMap["Update1"] = "UpdateStepOne";
00066     $_actionMap["Update2"] = "UpdateStepTwo";
00067     $_actionMap["Update3"] = "UpdateStepThree";
00068     $_actionMap["Update4"] = "UpdateStepFour";
00069 
00070 
00071 
00072     $Tables[0]["desc"] = "Articles";
00073     $Tables[0]["code"] = "CREATE TABLE {dbprefix}articles (
00074   id int(10) unsigned NOT NULL auto_increment,
00075   category_id int(10) unsigned NOT NULL default '0',
00076   date timestamp(14) NOT NULL,
00077   modification_date timestamp(14) NOT NULL,
00078   user_id int(10) unsigned NOT NULL default '0',
00079   blog_id int(10) unsigned NOT NULL default '0',
00080   status INTEGER(5) NOT NULL default 1,
00081   num_reads int(10) default '0',
00082   properties TEXT NOT NULL default '',
00083   slug varchar(255) NOT NULL,
00084   PRIMARY KEY (id),
00085   KEY num_reads (num_reads),
00086   KEY category_id (category_id),
00087   KEY blog_id (blog_id),
00088   KEY user_id (user_id),
00089   KEY slug (slug),
00090   KEY blog_id_slug (blog_id,slug),
00091   KEY blog_id_slug_category_id (blog_id,slug,category_id),
00092   KEY date (date),
00093   KEY status (status)
00094 ) TYPE=MyISAM;";
00095 
00096     $Tables[1]["desc"] = "Article categories";
00097     $Tables[1]["code"] = "CREATE TABLE {dbprefix}articles_categories (
00098   id int(10) unsigned NOT NULL auto_increment,
00099   name varchar(255) NOT NULL default '',
00100   url varchar(255) NOT NULL default '',
00101   blog_id int(10) unsigned NOT NULL default '0',
00102   last_modification timestamp(14) NOT NULL,
00103   in_main_page TINYINT(1) NOT NULL DEFAULT '1',
00104   parent_id INTEGER(10) NOT NULL DEFAULT '0',
00105   description TEXT NOT NULL DEFAULT '',
00106   properties text NOT NULL default '',
00107   mangled_name varchar(255) NOT NULL default '',
00108   PRIMARY KEY  (id),
00109   KEY parent_id (parent_id),
00110   KEY blog_id (blog_id),
00111   KEY mangled_name (mangled_name)
00112 ) TYPE=MyISAM;";
00113 
00114     $Tables[2]["desc"] = "Comments";
00115     $Tables[2]["code"] = "CREATE TABLE {dbprefix}articles_comments (
00116   id int(10) unsigned NOT NULL auto_increment,
00117   article_id int(10) unsigned NOT NULL default '0',
00118   topic text NOT NULL,
00119   text text,
00120   date timestamp(14) NOT NULL,
00121   user_email varchar(255) default '',
00122   user_url varchar(255) default '',
00123   user_name varchar(255) NOT NULL default 'Anonymous',
00124   parent_id int(10) unsigned default '0',
00125   client_ip varchar(15) default '0.0.0.0',
00126   send_notification tinyint(1) default '0',
00127   status tinyint(2) default '1',
00128   spam_rate float default '0',
00129   properties TEXT NOT NULL DEFAULT '',
00130   normalized_text TEXT NOT NULL DEFAULT '',
00131   normalized_topic TEXT NOT NULL DEFAULT '',
00132   PRIMARY KEY  (id),
00133   KEY parent_id (parent_id),
00134   KEY article_id (article_id),
00135   FULLTEXT KEY normalized_fields (normalized_text,normalized_topic),
00136   FULLTEXT KEY normalized_text (normalized_text),
00137   FULLTEXT KEY normalized_topic (normalized_topic)
00138 ) TYPE=MyISAM;";
00139 
00140     $Tables[3]["desc"] = "Notifications";
00141     $Tables[3]["code"] = "CREATE TABLE {dbprefix}articles_notifications (
00142   id int(10) NOT NULL auto_increment,
00143   blog_id int(10) NOT NULL default '0',
00144   user_id int(10) NOT NULL default '0',
00145   article_id int(10) NOT NULL default '0',
00146   PRIMARY KEY  (id),
00147   KEY article_id (article_id),
00148   KEY user_id (user_id),
00149   KEY blog_id (blog_id)
00150 ) TYPE=MyISAM;";
00151 
00152     $Tables[4]["desc"] = "Blogs";
00153     $Tables[4]["code"] = "CREATE TABLE {dbprefix}blogs (
00154   id int(10) unsigned NOT NULL auto_increment,
00155   blog varchar(50) NOT NULL default '',
00156   owner_id int(10) unsigned NOT NULL default '0',
00157   about text,
00158   settings text NOT NULL,
00159   mangled_blog varchar(50) NOT NULL default '',
00160   status int(4) NOT NULL default '1',
00161   show_in_summary int(4) not null default '1',
00162   PRIMARY KEY  (id),
00163   KEY owner_id (owner_id),
00164   KEY mangled_blog (mangled_blog)
00165 ) TYPE=MyISAM;";
00166 
00167     $Tables[5]["desc"] = "MyLinks";
00168     $Tables[5]["code"] = "CREATE TABLE {dbprefix}mylinks (
00169   id int(10) unsigned NOT NULL auto_increment,
00170   category_id int(10) unsigned NOT NULL default '0',
00171   url varchar(255) NOT NULL default '',
00172   name varchar(100) default '',
00173   description text NOT NULL,
00174   blog_id int(10) unsigned NOT NULL default '0',
00175   rss_feed varchar(255) not null default '',
00176   date timestamp(14) not null,
00177   properties TEXT NOT NULL DEFAULT '',
00178   PRIMARY KEY  (id),
00179   KEY blog_id (blog_id),
00180   KEY category_id (category_id)
00181 ) TYPE=MyISAM;";
00182 
00183     $Tables[6]["desc"] = "MyLinks Categories";
00184     $Tables[6]["code"] = "CREATE TABLE {dbprefix}mylinks_categories (
00185   id int(10) NOT NULL auto_increment,
00186   name varchar(100) NOT NULL default '',
00187   blog_id int(10) NOT NULL default '0',
00188   last_modification timestamp(14) NOT NULL,
00189   properties TEXT NOT NULL DEFAULT '',
00190   PRIMARY KEY  (id),
00191   KEY blog_id (blog_id)
00192 ) TYPE=MyISAM;";
00193 
00194     $Tables[7]["desc"] = "MyRecent";
00195     $Tables[7]["code"] = "CREATE TABLE {dbprefix}myrecent (
00196   id int(10) unsigned NOT NULL auto_increment,
00197   category_id int(10) unsigned NOT NULL default '0',
00198   name varchar(255) NOT NULL default '',
00199   text text NOT NULL,
00200   user_id int(10) unsigned NOT NULL default '0',
00201   blog_id int(10) unsigned NOT NULL default '0',
00202   PRIMARY KEY  (id)
00203 ) TYPE=MyISAM;";
00204 
00205     $Tables[8]["desc"] = "MyRecent categories";
00206     $Tables[8]["code"] = "CREATE TABLE {dbprefix}myrecent_categories (
00207   id int(10) unsigned NOT NULL auto_increment,
00208   name varchar(255) NOT NULL default '',
00209   blog_id int(10) unsigned NOT NULL default '0',
00210   last_modification timestamp(14) NOT NULL,
00211   PRIMARY KEY  (id)
00212 ) TYPE=MyISAM;";
00213 
00214     $Tables[9]["desc"] = "Permissions";
00215     $Tables[9]["code"] = "CREATE TABLE {dbprefix}permissions (
00216   id int(10) unsigned NOT NULL auto_increment,
00217   permission varchar(25) NOT NULL default '',
00218   description varchar(100) NOT NULL default '',
00219   PRIMARY KEY  (id)
00220 ) TYPE=MyISAM;";
00221 
00222     $Tables[10]["desc"] = "Referrers";
00223     $Tables[10]["code"] = "CREATE TABLE {dbprefix}referers (
00224   id int(10) NOT NULL auto_increment,
00225   url text NOT NULL,
00226   article_id int(10) NOT NULL default '0',
00227   blog_id int(10) NOT NULL default '0',
00228   hits int(10) default '1',
00229   last_date timestamp(14),
00230   PRIMARY KEY  (id),
00231   KEY article_id (article_id),
00232   KEY blog_id (blog_id),
00233   KEY blog_id_article_id (blog_id, article_id)
00234 ) TYPE=MyISAM;";
00235 
00236     $Tables[11]["desc"] = "Trackbacks";
00237     $Tables[11]["code"] = "CREATE TABLE {dbprefix}trackbacks (
00238   id int(10) NOT NULL auto_increment,
00239   url text NOT NULL,
00240   title varchar(255) default '',
00241   article_id int(10) NOT NULL default '0',
00242   excerpt varchar(255) default '',
00243   blog_name varchar(255) default '',
00244   date timestamp(14) NOT NULL,
00245   properties TEXT NOT NULL DEFAULT '',
00246   PRIMARY KEY  (id),
00247   KEY article_id (article_id)
00248 ) TYPE=MyISAM;";
00249 
00250     $Tables[12]["desc"] = "Users";
00251     $Tables[12]["code"] = "CREATE TABLE {dbprefix}users (
00252   id int(10) unsigned NOT NULL auto_increment,
00253   user varchar(15) NOT NULL default '',
00254   password varchar(32) NOT NULL default '',
00255   email varchar(255) NOT NULL default '',
00256   full_name varchar(255) NOT NULL default '',
00257   about text,
00258   properties TEXT NOT NULL default '',
00259   status integer(4) NOT NULL DEFAULT 1,
00260   resource_picture_id integer(10) NOT NULL DEFAULT 0,
00261   PRIMARY KEY  (id),
00262   UNIQUE KEY user (user)
00263 ) TYPE=MyISAM;";
00264 
00265     $Tables[13]["desc"] = "Permissions";
00266     $Tables[13]["code"] = "CREATE TABLE {dbprefix}users_permissions (
00267   id int(10) unsigned NOT NULL auto_increment,
00268   user_id int(10) unsigned NOT NULL default '0',
00269   blog_id int(10) unsigned NOT NULL default '0',
00270   permission_id int(10) unsigned NOT NULL default '0',
00271   PRIMARY KEY  (id),
00272   KEY user_id (user_id),
00273   KEY blog_id (blog_id),
00274   KEY user_id_permission_id (user_id,permission_id)
00275 ) TYPE=MyISAM;";
00276 
00277 
00278    $Tables[14]["desc"] = "Configuration";
00279    $Tables[14]["code"] = "CREATE TABLE {dbprefix}config (
00280    id int(10) NOT NULL auto_increment,
00281    config_key varchar(255) NOT NULL default '',
00282    config_value text NOT NULL,
00283    value_type int(3) default '0',
00284    PRIMARY KEY  (id,config_key)
00285    ) TYPE=MyISAM;";
00286 
00287    $Tables[15]["desc"] = "Filtered Content";
00288    $Tables[15]["code"] = "CREATE TABLE {dbprefix}filtered_content (
00289    id int(10) NOT NULL auto_increment,
00290    reg_exp text,
00291    blog_id int(10) NOT NULL default '0',
00292    reason text,
00293    date timestamp(14) NOT NULL,
00294    PRIMARY KEY  (id),
00295    KEY blog_id (blog_id)
00296    ) TYPE=MyISAM;";
00297 
00298    $Tables[16]["desc"] = "Blocked content";
00299    $Tables[16]["code"] = "CREATE TABLE {dbprefix}host_blocking_rules (
00300    id int(10) NOT NULL auto_increment,
00301    reason text,
00302    date timestamp(14) NOT NULL,
00303    blog_id int(10) NOT NULL default '0',
00304    block_type int(1) default '1',
00305    list_type int(1) default '1',
00306    mask int(2) default '0',
00307    host varchar(15) default '0.0.0.0',
00308    PRIMARY KEY  (id),
00309    KEY blog_id (blog_id)
00310    ) TYPE=MyISAM;";
00311 
00312    $Tables[17]["desc"] = "Gallery Resources";
00313    $Tables[17]["code"] = "CREATE TABLE {dbprefix}gallery_resources (
00314    id int(10) NOT NULL auto_increment,
00315    owner_id int(10) NOT NULL default '0',
00316    album_id int(10) NOT NULL default '0',
00317    description text,
00318    date timestamp(14) NOT NULL,
00319    flags int(10) default '0',
00320    resource_type int(3) default NULL,
00321    file_path varchar(255) default '',
00322    file_name varchar(255) default '',
00323    metadata text,
00324    thumbnail_format varchar(4) not null default 'same',
00325    normalized_description text NOT NULL default '',
00326    properties TEXT NOT NULL DEFAULT '',
00327    PRIMARY KEY  (id),
00328    KEY album_id (album_id),
00329    KEY owner_id (owner_id),
00330    KEY file_name (file_name),
00331    KEY album_id_owner_id (album_id, owner_id),
00332    KEY resource_type (resource_type),
00333    FULLTEXT KEY normalized_description (normalized_description)
00334    ) TYPE=MyISAM;";
00335 
00336    $Tables[18]["desc"] = "Gallery Albums";
00337    $Tables[18]["code"] = "CREATE TABLE {dbprefix}gallery_albums (
00338    id int(10) NOT NULL auto_increment,
00339    owner_id int(10) NOT NULL default '0',
00340    description text NOT NULL,
00341    name varchar(255) NOT NULL default '',
00342    flags int(10) NOT NULL default '0',
00343    parent_id int(10) NOT NULL default '0',
00344    date timestamp(14) NOT NULL,
00345    properties text NOT NULL DEFAULT '',
00346    show_album TINYINT(1) DEFAULT 1,
00347    normalized_description text NOT NULL default '',
00348    normalized_name varchar(255) NOT NULL default '',
00349    mangled_name varchar(255) NOT NULL default '',
00350    PRIMARY KEY  (id),
00351    KEY parent_id (parent_id),
00352    KEY owner_id (owner_id),
00353    KEY mangled_name (mangled_name),
00354    KEY owner_id_mangled_name (owner_id, mangled_name),
00355    FULLTEXT KEY normalized_name (normalized_name),
00356    FULLTEXT KEY normalized_description (normalized_description),
00357    FULLTEXT KEY normalized_fields (normalized_name, normalized_description)
00358    ) TYPE=MyISAM;";
00359 
00360    $Tables[19]["desc"] = "Bayesian Filter data table";
00361    $Tables[19]["code"] = "CREATE TABLE {dbprefix}bayesian_filter_info (
00362    id int(10) unsigned NOT NULL auto_increment,
00363    blog_id int(10) unsigned default NULL,
00364    total_spam int(10) unsigned default NULL,
00365    total_nonspam int(10) unsigned default NULL,
00366    PRIMARY KEY  (id),
00367    KEY blog_id (blog_id)
00368    ) TYPE=MyISAM;";
00369 
00370    $Tables[20]["desc"] = "Bayesian Filter Information";
00371    $Tables[20]["code"] = "CREATE TABLE {dbprefix}bayesian_tokens (
00372    id int(10) unsigned NOT NULL auto_increment,
00373    blog_id int(10) unsigned default NULL,
00374    token char(100) default NULL,
00375    spam_occurrences int(10) unsigned default NULL,
00376    nonspam_occurrences int(10) unsigned default NULL,
00377    prob float default NULL,
00378    PRIMARY KEY  (id),
00379    KEY blog_id (blog_id),
00380    KEY token (token)
00381    ) TYPE=MyISAM;";
00382 
00383    $Tables[21]["desc"] = "Map of categories to articles";
00384    $Tables[21]["code"] = "CREATE TABLE {dbprefix}article_categories_link(
00385    article_id int(10) NOT NULL,
00386    category_id int(10) NOT NULL,
00387    PRIMARY KEY (article_id, category_id)
00388    ) TYPE=MyISAM;";
00389 
00390    $Tables[22]["desc"] = "Definition of custom fields";
00391    $Tables[22]["code"] = "CREATE TABLE {dbprefix}custom_fields_definition (
00392    id int(10) NOT NULL auto_increment,
00393    field_name varchar(255) NOT NULL default '',
00394    field_description text NOT NULL,
00395    field_type int(2) NOT NULL default '1',
00396    blog_id int(10) NOT NULL default '0',
00397    date TIMESTAMP(14),
00398    searchable TINYINT(1) default 1,
00399    hidden TINYINT(1) default 1,
00400    PRIMARY KEY  (id,field_name),
00401    KEY blog_id (blog_id)
00402    ) TYPE=MyISAM;";
00403 
00404    $Tables[23]["desc"] = "Custom fields that have been assigned to articles";
00405    $Tables[23]["code"] = "CREATE TABLE {dbprefix}custom_fields_values (
00406    id int(10) NOT NULL auto_increment,
00407    field_id int(10) NOT NULL default '0',
00408    field_value text NOT NULL,
00409    normalized_value text NOT NULL,
00410    blog_id int(10) default NULL,
00411    article_id int(10) default NULL,
00412    PRIMARY KEY  (id),
00413    FULLTEXT KEY normalized_value (normalized_value),
00414    KEY blog_id (blog_id),
00415    KEY article_id (article_id),
00416    KEY field_id (field_id),
00417    KEY blog_id_article_id (blog_id, article_id)
00418    ) TYPE=MyISAM;";
00419 
00420    $Tables[24]["desc"] = "Text of the articles";
00421    $Tables[24]["code"] = "CREATE TABLE {dbprefix}articles_text (
00422    id int(10) NOT NULL auto_increment,
00423    article_id int(10) NOT NULL DEFAULT 0,
00424    text TEXT NOT NULL DEFAULT '',
00425    topic TEXT NOT NULL DEFAULT '',
00426    normalized_text TEXT NOT NULL DEFAULT '',
00427    normalized_topic TEXT NOT NULL DEFAULT '',
00428    mangled_topic text NOT NULL,
00429    PRIMARY KEY (id),
00430    KEY article_id (article_id),
00431    FULLTEXT KEY normalized_text (normalized_text),
00432    FULLTEXT KEY normalized_topic (normalized_topic),
00433    FULLTEXT KEY normalized_fields (normalized_text, normalized_topic)
00434    ) TYPE=MyISAM;";
00435 
00436 
00437 
00438    // ---
00439    // changes needed to update from 0.3 to 1.0
00440    $Changes["Articles"] = Array( "ALTER TABLE {dbprefix}articles CHANGE status old_status ENUM('published', 'draft', 'deleted' )",
00441                                  "ALTER TABLE {dbprefix}articles ADD COLUMN status INTEGER(5) NOT NULL DEFAULT 1",
00442                                  "ALTER TABLE {dbprefix}articles ADD COLUMN slug VARCHAR(255) NOT NULL DEFAULT ''",
00443                                  "ALTER TABLE {dbprefix}articles ADD KEY num_reads(num_reads)",
00444                                  "ALTER TABLE {dbprefix}articles ADD KEY category_id(category_id)",
00445                                  "ALTER TABLE {dbprefix}articles ADD KEY blog_id(blog_id)",
00446                                  "ALTER TABLE {dbprefix}articles ADD KEY slug(slug)",
00447                                  "ALTER TABLE {dbprefix}articles ADD KEY user_id(user_id)",
00448                                  "ALTER TABLE {dbprefix}articles ADD KEY blog_id_slug(blog_id,slug)",
00449                                  "ALTER TABLE {dbprefix}articles ADD KEY blog_id_slug_category_id(blog_id,slug,category_id)",
00450                                  "ALTER TABLE {dbprefix}articles ADD KEY date(date)",
00451                                  "ALTER TABLE {dbprefix}articles ADD KEY status(status)" );
00452                                  
00453 
00454     $Changes["Article Categories"] = Array( "ALTER TABLE {dbprefix}articles_categories ADD COLUMN parent_id INTEGER(10) NOT NULL DEFAULT 0",
00455                                             "ALTER TABLE {dbprefix}articles_categories ADD COLUMN mangled_name VARCHAR(255) NOT NULL DEFAULT ''",
00456                                             "ALTER TABLE {dbprefix}articles_categories ADD COLUMN properties TEXT NOT NULL DEFAULT ''",
00457                                             "ALTER TABLE {dbprefix}articles_categories ADD COLUMN description TEXT NOT NULL DEFAULT ''",
00458                                             "ALTER TABLE {dbprefix}articles_categories ADD KEY parent_id(parent_id)",
00459                                             "ALTER TABLE {dbprefix}articles_categories ADD KEY blog_id(blog_id)",
00460                                             "ALTER TABLE {dbprefix}articles_categories ADD KEY mangled_name(mangled_name)");
00461 
00462 
00463     $Changes["User Comments"] = Array( "ALTER TABLE {dbprefix}articles_comments ADD COLUMN normalized_text TEXT NOT NULL DEFAULT ''",
00464                                        "ALTER TABLE {dbprefix}articles_comments ADD COLUMN normalized_topic TEXT NOT NULL DEFAULT ''",
00465                                        "ALTER TABLE {dbprefix}articles_comments ADD FULLTEXT normalized_text(normalized_text)",
00466                                        "ALTER TABLE {dbprefix}articles_comments ADD FULLTEXT normalized_topic(normalized_topic)",
00467                                        "ALTER TABLE {dbprefix}articles_comments ADD FULLTEXT normalized_text_topic(normalized_topic,normalized_text)",
00468                                        "ALTER TABLE {dbprefix}articles_comments ADD KEY parent_id(parent_id)",
00469                                        "ALTER TABLE {dbprefix}articles_comments ADD KEY article_id(article_id)");
00470 
00471     $Changes["Notifications"] = Array( "ALTER TABLE {dbprefix}articles_notifications ADD KEY article_id(article_id)",
00472                                        "ALTER TABLE {dbprefix}articles_notifications ADD KEY user_id(user_id)",
00473                                        "ALTER TABLE {dbprefix}articles_notifications ADD KEY blog_id(blog_id)");
00474 
00475     $Changes["Blogs"] = Array( "ALTER TABLE {dbprefix}blogs ADD COLUMN mangled_blog VARCHAR(50) NOT NULL DEFAULT ''",
00476                                "ALTER TABLE {dbprefix}blogs ADD COLUMN properties TEXT NOT NULL DEFAULT ''",
00477                                "ALTER TABLE {dbprefix}blogs ADD COLUMN status INTEGER(4) NOT NULL DEFAULT '1'",
00478                                "ALTER TABLE {dbprefix}blogs ADD COLUMN show_in_summary INTEGER(4) NOT NULL DEFAULT '1'",
00479                                "ALTER TABLE {dbprefix}blogs ADD KEY owner_id(owner_id)",
00480                                "ALTER TABLE {dbprefix}blogs ADD KEY mangled_blog(mangled_blog)");
00481 
00482     $Changes["Referrers"] = Array( "ALTER TABLE {dbprefix}referers ADD KEY article_id(article_id)",
00483                                    "ALTER TABLE {dbprefix}referers ADD KEY blog_id(blog_id)",
00484                                    "ALTER TABLE {dbprefix}referers ADD   KEY blog_id_article_id (blog_id, article_id)");
00485 
00486     $Changes["Trackbacks"] = Array( "ALTER TABLE {dbprefix}trackbacks ADD KEY article_id(article_id)" );
00487 
00488     $Changes["Filtered Content"] = Array( "ALTER TABLE {dbprefix}filtered_content ADD KEY blog_id(blog_id)" );
00489 
00490     $Changes["Blocked hosts"] = Array( "ALTER TABLE {dbprefix}host_blocking_rules ADD KEY blog_id(blog_id)" );
00491 
00492     $Changes["Gallery Albums"] = Array( "ALTER TABLE {dbprefix}gallery_albums ADD COLUMN normalized_name VARCHAR(255) NOT NULL DEFAULT ''",
00493                                         "ALTER TABLE {dbprefix}gallery_albums ADD COLUMN normalized_description TEXT NOT NULL DEFAULT ''",
00494                                         "ALTER TABLE {dbprefix}gallery_albums ADD COLUMN mangled_name VARCHAR(255) NOT NULL DEFAULT ''",
00495                                         "ALTER TABLE {dbprefix}gallery_albums ADD FULLTEXT normalized_name(normalized_name)",
00496                                         "ALTER TABLE {dbprefix}gallery_albums ADD FULLTEXT normalized_description(normalized_description)",
00497                                         "ALTER TABLE {dbprefix}gallery_albums ADD FULLTEXT normalized_name_description(normalized_name, normalized_description)",
00498                                         "ALTER TABLE {dbprefix}gallery_albums ADD KEY parent_id(parent_id)",
00499                                         "ALTER TABLE {dbprefix}gallery_albums ADD KEY owner_id(owner_id)",
00500                                         "ALTER TABLE {dbprefix}gallery_albums ADD KEY mangled_name(mangled_name)",
00501                                         "ALTER TABLE {dbprefix}gallery_albums ADD KEY owner_id_mangled_name(owner_id,mangled_name)");
00502 
00503     $Changes["Gallery Resources"] = Array( "ALTER TABLE {dbprefix}gallery_resources ADD COLUMN normalized_description TEXT NOT NULL DEFAULT ''",
00504                                            "ALTER TABLE {dbprefix}gallery_resources ADD FULLTEXT normalized_description(normalized_description)",
00505                                            "ALTER TABLE {dbprefix}gallery_resources ADD KEY album_id(album_id)",
00506                                            "ALTER TABLE {dbprefix}gallery_resources ADD KEY owner_id(owner_id)",
00507                                            "ALTER TABLE {dbprefix}gallery_resources ADD KEY file_name(file_name)",
00508                                            "ALTER TABLE {dbprefix}gallery_resources ADD KEY album_id_owner_id(album_id,owner_id)",
00509                                            "ALTER TABLE {dbprefix}gallery_resources ADD KEY resource_type(resource_type)");
00510 
00511 
00512     $Changes["Links"] = Array( "ALTER TABLE {dbprefix}mylinks ADD COLUMN properties TEXT NOT NULL DEFAULT ''",
00513                                "ALTER TABLE {dbprefix}mylinks ADD COLUMN date TIMESTAMP(14)",
00514                                "ALTER TABLE {dbprefix}mylinks ADD COLUMN rss_feed VARCHAR(255) NOT NULL DEFAULT ''",
00515                                "ALTER TABLE {dbprefix}mylinks ADD KEY blog_id(blog_id)",
00516                                "ALTER TABLE {dbprefix}mylinks ADD KEY category_id(category_id)");
00517 
00518     $Changes["Links Categories"] = Array( "ALTER TABLE {dbprefix}mylinks_categories ADD COLUMN properties TEXT NOT NULL DEFAULT ''",
00519                                           "ALTER TABLE {dbprefix}mylinks_categories ADD KEY blog_id(blog_id)");
00520 
00521     $Changes["Users"] = Array( "ALTER TABLE {dbprefix}users ADD COLUMN full_name VARCHAR(255) NOT NULL DEFAULT ''",
00522                                 "ALTER TABLE {dbprefix}users ADD COLUMN properties TEXT NOT NULL DEFAULT ''",
00523                                 "ALTER TABLE {dbprefix}users ADD COLUMN resource_picture_id INTEGER(10) NOT NULL DEFAULT 0",
00524                                 "ALTER TABLE {dbprefix}users ADD COLUMN status INTEGER(4) NOT NULL DEFAULT 1" );
00525 
00526     $Changes["Bayesian Filter data table"] = Array( "ALTER TABLE {dbprefix}bayesian_filter_info ADD KEY blog_id(blog_id)" );
00527 
00528     $Changes["Permissions"] = Array( "ALTER TABLE {dbprefix}users_permissions ADD KEY user_id(user_id)",
00529                                      "ALTER TABLE {dbprefix}users_permissions ADD KEY blog_id(blog_id)",
00530                                      "ALTER TABLE {dbprefix}users_permissions ADD KEY user_id_permission_id(user_id,permission_id)");
00531 
00532    // ---
00533 
00534    // ---
00535    // end of changes needed in 1.0
00536    // ---
00537 
00538 $Inserts[0] = "INSERT INTO {dbprefix}config (config_key, config_value, value_type) VALUES ('comments_enabled','1',1);";
00539 $Inserts[1] = "INSERT INTO {dbprefix}config (config_key, config_value, value_type) VALUES ('rdf_enabled','1',1);";
00540 $Inserts[2] = "INSERT INTO {dbprefix}config (config_key, config_value, value_type) VALUES ('temp_folder','./tmp',3);";
00541 $Inserts[3] = "INSERT INTO {dbprefix}config (config_key, config_value, value_type) VALUES ('base_url','{plog_base_url}',3);";
00542 $Inserts[4] = "INSERT INTO {dbprefix}config (config_key, config_value, value_type) VALUES ('show_posts_max','15',1);";
00543 $Inserts[5] = "INSERT INTO {dbprefix}config (config_key, config_value, value_type) VALUES ('recent_posts_max','10',1);";
00544 $Inserts[6] = "INSERT INTO {dbprefix}config (config_key, config_value, value_type) VALUES ('default_template','standard',3);";
00545 $Inserts[7] = "INSERT INTO {dbprefix}config (config_key, config_value, value_type) VALUES ('template_folder','./templates',3);";
00546 $Inserts[8] = "INSERT INTO {dbprefix}config (config_key, config_value, value_type) VALUES ('default_blog_id','1',1);";
00547 $Inserts[9] = "INSERT INTO {dbprefix}config (config_key, config_value, value_type) VALUES ('default_locale','en_UK',3);";
00548 $Inserts[10] = "INSERT INTO {dbprefix}config (config_key, config_value, value_type) VALUES ('html_allowed_tags_in_comments','<a><i><br><br/><b>',3);";
00549 $Inserts[11] = "INSERT INTO {dbprefix}config (config_key, config_value, value_type) VALUES ('referer_tracker_enabled','1',1);";
00550 $Inserts[12] = "INSERT INTO {dbprefix}config (config_key, config_value, value_type) VALUES ('rss_parser_enabled','1',1);";
00551 $Inserts[13] = "INSERT INTO {dbprefix}config (config_key, config_value, value_type) VALUES ('show_more_enabled','1',1);";
00552 $Inserts[14] = "INSERT INTO {dbprefix}config (config_key, config_value, value_type) VALUES ('show_more_threshold','150',1);";
00553 $Inserts[15] = "INSERT INTO {dbprefix}config (config_key, config_value, value_type) VALUES ('update_article_reads','1',1);";
00554 $Inserts[16] = "INSERT INTO {dbprefix}config (config_key, config_value, value_type) VALUES ('email_service_enabled','1',1);";
00555 $Inserts[17] = "INSERT INTO {dbprefix}config (config_key, config_value, value_type) VALUES ('post_notification_source_address','noreply@your.host.com',3);";
00556 $Inserts[18] = "INSERT INTO {dbprefix}config (config_key, config_value, value_type) VALUES ('request_format_mode','1',1);";
00557 $Inserts[19] = "INSERT INTO {dbprefix}config (config_key, config_value, value_type) VALUES ('xmlrpc_ping_hosts','a:2:{i:0;s:27:\"http://rpc.weblogs.com/RPC2\";i:1;s:0:\"\";}',5);";
00558 $Inserts[20] = "INSERT INTO {dbprefix}config (config_key, config_value, value_type) VALUES ('trackback_server_enabled','1',1);";
00559 $Inserts[21] = "INSERT INTO {dbprefix}config (config_key, config_value, value_type) VALUES ('htmlarea_enabled','1',1);";
00560 $Inserts[22] = "INSERT INTO {dbprefix}config (config_key, config_value, value_type) VALUES ('plugin_manager_enabled','1',1);";
00561 $Inserts[23] = "INSERT INTO {dbprefix}config (config_key, config_value, value_type) VALUES ('check_email_address_validity','0',1);";
00562 $Inserts[24] = "INSERT INTO {dbprefix}config (config_key, config_value, value_type) VALUES ('summary_page_show_max','10',1);";
00563 $Inserts[25] = "INSERT INTO {dbprefix}config (config_key, config_value, value_type) VALUES ('minimum_password_length','4',1);";
00564 $Inserts[26] = "INSERT INTO {dbprefix}config (config_key, config_value, value_type) VALUES ('templates','a:3:{i:0;s:7:\"blueish\";i:1;s:4:\"grey\";i:2;s:8:\"standard\";}',5);";
00565 $Inserts[27] = "INSERT INTO {dbprefix}config (config_key, config_value, value_type) VALUES ('locales','a:0:{}',5)";
00566 $Inserts[28] = "INSERT INTO {dbprefix}config (config_key, config_value, value_type) VALUES ('email_service_type','php',3);";
00567 $Inserts[29] = "INSERT INTO {dbprefix}config (config_key, config_value, value_type) VALUES ('smtp_host','your.smtp.host.com',3);";
00568 $Inserts[30] = "INSERT INTO {dbprefix}config (config_key, config_value, value_type) VALUES ('smtp_port','25',1);";
00569 $Inserts[31] = "INSERT INTO {dbprefix}config (config_key, config_value, value_type) VALUES ('smtp_use_authentication','0',1);";
00570 $Inserts[32] = "INSERT INTO {dbprefix}config (config_key, config_value, value_type) VALUES ('smtp_username','',3);";
00571 $Inserts[33] = "INSERT INTO {dbprefix}config (config_key, config_value, value_type) VALUES ('smtp_password','',3);";
00572 $Inserts[34] = "INSERT INTO {dbprefix}config (config_key, config_value, value_type) VALUES ('locale_folder','./locale',3);";
00573 $Inserts[35] = "INSERT INTO {dbprefix}config (config_key, config_value, value_type) VALUES ('xmlrpc_ping_enabled','0',1);";
00574 $Inserts[36] = "INSERT INTO {dbprefix}config (config_key, config_value, value_type) VALUES ('path_to_tar','{path_to_tar}',3);";
00575 $Inserts[37] = "INSERT INTO {dbprefix}config (config_key, config_value, value_type) VALUES ('path_to_gzip','{path_to_gzip}',3);";
00576 $Inserts[38] = "INSERT INTO {dbprefix}config (config_key, config_value, value_type) VALUES ('path_to_bz2','{path_to_bz2}',3);";
00577 $Inserts[39] = "INSERT INTO {dbprefix}config (config_key, config_value, value_type) VALUES ('path_to_unzip','{path_to_unzip}',3);";
00578 $Inserts[40] = "INSERT INTO {dbprefix}config (config_key, config_value, value_type) VALUES ('users_can_add_templates',1,1);";
00579 $Inserts[41] = "INSERT INTO {dbprefix}config (config_key, config_value, value_type) VALUES ('maximum_file_upload_size', 2000000, 1);";
00580 $Inserts[42] = "INSERT INTO {dbprefix}config (config_key, config_value, value_type) VALUES ('upload_forbidden_files', '*.php *.php3 *.php4 *.phtml *.htm *.html *.exe *.com *.bat .htaccess *.sh', 3);";
00581 $Inserts[43] = "INSERT INTO {dbprefix}config (config_key, config_value, value_type) VALUES ('comments_order', 1, 1);";
00582 $Inserts[44] = "INSERT INTO {dbprefix}config (config_key, config_value, value_type) VALUES ('security_pipeline_enabled', 1, 1);";
00583 $Inserts[45] = "INSERT INTO {dbprefix}config (config_key, config_value, value_type) VALUES ('maximum_comment_size', 0, 1 );";
00584 $Inserts[46] = "INSERT INTO {dbprefix}config (config_key, config_value, value_type) VALUES ('resources_enabled', 1, 1 );";
00585 $Inserts[47] = "INSERT INTO {dbprefix}config (config_key, config_value, value_type) VALUES ('thumbnail_method', 'gd', 3);";
00586 $Inserts[48] = "INSERT INTO {dbprefix}config (config_key, config_value, value_type) VALUES ('path_to_convert', '{path_to_convert}', 3);";
00587 $Inserts[49] = "INSERT INTO {dbprefix}config (config_key, config_value, value_type) VALUES ('thumbnail_height', 120, 1);";
00588 $Inserts[50] = "INSERT INTO {dbprefix}config (config_key, config_value, value_type) VALUES ('thumbnail_width', 120, 1);";
00589 $Inserts[51] = "INSERT INTO {dbprefix}config (config_key, config_value, value_type) VALUES ('thumbnails_keep_aspect_ratio', 1, 1);";
00590 $Inserts[52] = "INSERT INTO {dbprefix}config (config_key, config_value, value_type) VALUES ('xmlrpc_api_enabled', 1, 1);";
00591 $Inserts[53] = "INSERT INTO {dbprefix}config (config_key, config_value, value_type) VALUES ('uploads_enabled', 1, 1);";
00592 $Inserts[54] = "INSERT INTO {dbprefix}config (config_key, config_value, value_type) VALUES ('default_rss_profile', 'rss090', 3);";
00593 $Inserts[55] = "INSERT INTO {dbprefix}config (config_key, config_value, value_type) VALUES('bayesian_filter_enabled', 1, 2);";
00594 $Inserts[56] = "INSERT INTO {dbprefix}config (config_key, config_value, value_type) VALUES('bayesian_filter_spam_probability_treshold', '0.9', 6);";
00595 $Inserts[57] = "INSERT INTO {dbprefix}config (config_key, config_value, value_type) VALUES('bayesian_filter_nonspam_probability_treshold', '0.2', 6);";
00596 $Inserts[58] = "INSERT INTO {dbprefix}config (config_key, config_value, value_type) VALUES('bayesian_filter_min_length_token', '3', 1);";
00597 $Inserts[59] = "INSERT INTO {dbprefix}config (config_key, config_value, value_type) VALUES('bayesian_filter_max_length_token', '100', 1);";
00598 $Inserts[60] = "INSERT INTO {dbprefix}config (config_key, config_value, value_type) VALUES('bayesian_filter_number_significant_tokens', 15, 1);";
00599 $Inserts[61] = "INSERT INTO {dbprefix}config (config_key, config_value, value_type) VALUES('bayesian_filter_spam_comments_action', 0, 1 );";
00600 $Inserts[62] = "INSERT INTO {dbprefix}config (config_key, config_value, value_type) VALUES('ip_address_filter_enabled', 1, 1 );";
00601 $Inserts[63] = "INSERT INTO {dbprefix}config (config_key, config_value, value_type) VALUES('content_filter_enabled', 1, 1 );";
00602 $Inserts[64] = "INSERT INTO {dbprefix}config (config_key, config_value, value_type) VALUES('thumbnail_format','same',3);";
00603 $Inserts[65] = "INSERT INTO {dbprefix}config (config_key, config_value, value_type) VALUES('resources_folder','./gallery/',3);";
00604 $Inserts[66] = "INSERT INTO {dbprefix}config (config_key, config_value, value_type) VALUES('beautify_comments_text', '1', 1);";
00605 $Inserts[67] = "INSERT INTO {dbprefix}config (config_key, config_value, value_type) VALUES('disable_apache_error_handler', '0', 1);";
00606 $Inserts[68] = "INSERT INTO {dbprefix}config (config_key, config_value, value_type) VALUES('show_future_posts_in_calendar', '0', 1);";
00607 $Inserts[69] = "INSERT INTO {dbprefix}config (config_key, config_value, value_type) VALUES('xhtml_converter_enabled', '1', 1);";
00608 $Inserts[70] = "INSERT INTO {dbprefix}config (config_key, config_value, value_type) VALUES('xhtml_converter_aggresive_mode_enabled', '0', 1);";
00609 $Inserts[71] = "INSERT INTO {dbprefix}config (config_key, config_value, value_type) VALUES('search_engine_enabled', '1', 1);";
00610 $Inserts[72] = "INSERT INTO {dbprefix}config (config_key, config_value, value_type) VALUES('search_in_custom_fields', '1', 1);";
00611 $Inserts[73] = "INSERT INTO {dbprefix}config (config_key, config_value, value_type) VALUES('search_in_comments', '1', 1);";
00612 $Inserts[74] = "INSERT INTO {dbprefix}config (config_key, config_value, value_type) VALUES('resources_quota', '0', 1);";
00613 $Inserts[75] = "INSERT INTO {dbprefix}config (config_key, config_value, value_type) VALUES('category_link_format', '/blog/{blogname}/{catname}$', 3);";
00614 $Inserts[76] = "INSERT INTO {dbprefix}config (config_key, config_value, value_type) VALUES('blog_link_format', '/blog/{blogname}$', 3);";
00615 $Inserts[77] = "INSERT INTO {dbprefix}config (config_key, config_value, value_type) VALUES('archive_link_format', '/blog/{blogname}/archives/{year}/?{month}/?{day}', 3);";
00616 $Inserts[78] = "INSERT INTO {dbprefix}config (config_key, config_value, value_type) VALUES('user_posts_link_format', '/blog/{blogname}/user/{username}$', 3);";
00617 $Inserts[79] = "INSERT INTO {dbprefix}config (config_key, config_value, value_type) VALUES('post_trackbacks_link_format', '/blog/{blogname}/post/trackbacks/{postname}$', 3);";
00618 $Inserts[80] = "INSERT INTO {dbprefix}config (config_key, config_value, value_type) VALUES('template_link_format', '/blog/{blogname}/page/{templatename}$', 3);";
00619 $Inserts[81] = "INSERT INTO {dbprefix}config (config_key, config_value, value_type) VALUES('album_link_format', '/blog/{blogname}/album/{albumname}$', 3);";
00620 $Inserts[82] = "INSERT INTO {dbprefix}config (config_key, config_value, value_type) VALUES('resource_link_format', '/blog/{blogname}/resource/{albumname}/{resourcename}$', 3);";
00621 $Inserts[83] = "INSERT INTO {dbprefix}config (config_key, config_value, value_type) VALUES('resource_preview_link_format', '/blog/{blogname}/resource/{albumname}/preview/{resourcename}$', 3);";
00622 $Inserts[84] = "INSERT INTO {dbprefix}config (config_key, config_value, value_type) VALUES('resource_download_link_format', '/blog/{blogname}/resource/{albumname}/download/{resourcename}$', 3);";
00623 $Inserts[85] = "INSERT INTO {dbprefix}config (config_key, config_value, value_type) VALUES('permalink_format', '/blog/{blogname}/{catname}/{year}/{month}/{day}/{postname}$', 3);";
00624 $Inserts[86] = "INSERT INTO {dbprefix}config (config_key, config_value, value_type) VALUES('script_name', 'index.php', 3);";
00625 $Inserts[87] = "INSERT INTO {dbprefix}config (config_key, config_value, value_type) VALUES('thumbnail_generator_use_smoothing_algorithm', '0', 1);";
00626 $Inserts[88] = "INSERT INTO {dbprefix}config (config_key, config_value, value_type) VALUES('resource_server_use_http_caching', '1', 1);";
00627 $Inserts[89] = "INSERT INTO {dbprefix}config (config_key, config_value, value_type) VALUES('medium_size_thumbnail_width', '640', 1);";
00628 $Inserts[90] = "INSERT INTO {dbprefix}config (config_key, config_value, value_type) VALUES('medium_size_thumbnail_height', '480', 1);";
00629 $Inserts[91] = "INSERT INTO {dbprefix}config (config_key, config_value, value_type) VALUES('resource_medium_size_preview_link_format', '/blog/{blogname}/resource/{albumname}/preview-med/{resourcename}$', 3);";
00630 $Inserts[92] = "INSERT INTO {dbprefix}config (config_key, config_value, value_type) VALUES('subdomains_enabled', '0', 1);";
00631 $Inserts[93] = "INSERT INTO {dbprefix}config (config_key, config_value, value_type) VALUES('include_blog_id_in_url', '1', 1);";
00632 $Inserts[94] = "INSERT INTO {dbprefix}config (config_key, config_value, value_type) VALUES('send_xmlrpc_pings_enabled_by_default', '1', 1);";
00633 $Inserts[95] = "INSERT INTO {dbprefix}config (config_key, config_value, value_type) VALUES('forbidden_usernames', 'admin www blog ftp wiki forums', 3);";
00634 $Inserts[96] = "INSERT INTO {dbprefix}config (config_key, config_value, value_type) VALUES('force_registration_confirmation', '0', 1);";
00635 $Inserts[97] = "INSERT INTO {dbprefix}config (config_key, config_value, value_type) VALUES('summary_blogs_per_page', '25', 3);";
00636 $Inserts[98] = "INSERT INTO {dbprefix}config (config_key, config_value, value_type) VALUES('subdomains_base_url', '', 3);";
00637 $Inserts[99] = "INSERT INTO {dbprefix}config (config_key, config_value, value_type) VALUES('autosave_new_drafts_time_millis', '300000', 3);";
00638 $Inserts[100] = "INSERT INTO {dbprefix}config (config_key, config_value, value_type) VALUES('save_drafts_via_xmlhttprequest_enabled', '1', 1);";
00639 $Inserts[101] = "INSERT INTO {dbprefix}config (config_key, config_value, value_type) VALUES('need_email_confirm_registration', '1', 1);";
00640 $Inserts[102] = "INSERT INTO {dbprefix}config (config_key, config_value, value_type) VALUES('force_one_blog_per_email_account', '0', 1);";
00641 $Inserts[103] = "INSERT INTO {dbprefix}config (config_key, config_value, value_type) VALUES('summary_show_agreement', '1', 1);";
00642 $Inserts[104] = "INSERT INTO {dbprefix}config (config_key, config_value, value_type) VALUES('default_time_offset', '0', 3);";
00643 $Inserts[105] = "INSERT INTO {dbprefix}config (config_key, config_value, value_type) VALUES('template_cache_enabled', '1', 1);";
00644 $Inserts[106] = "INSERT INTO {dbprefix}config (config_key, config_value, value_type) VALUES('template_http_cache_enabled', '0', 1);";
00645 $Inserts[107] = "INSERT INTO {dbprefix}config (config_key, config_value, value_type) VALUES('template_compile_check', '1', 1);";
00646 $Inserts[108] = "INSERT INTO {dbprefix}config (config_key, config_value, value_type) VALUES('update_cached_article_reads', '1', 1);";
00647 $Inserts[109] = "INSERT INTO {dbprefix}config (config_key, config_value, value_type) VALUES('allow_php_code_in_templates', '0', 1);";
00648 $Inserts[110] = "INSERT INTO {dbprefix}config (config_key, config_value, value_type) VALUES('thumbnail_generator_use_smoothing_algorithm', '1', 1);";
00649 $Inserts[111] = "INSERT INTO {dbprefix}config (config_key, config_value, value_type) VALUES('template_cache_lifetime', '-1', 3);";
00650 $Inserts[112] = "INSERT INTO {dbprefix}config (config_key, config_value, value_type) VALUES('use_http_accept_language_detection', '0', 1);";
00651 $Inserts[113] = "INSERT INTO {dbprefix}config (config_key, config_value, value_type) VALUES('session_save_path', '', 3);";
00652 $Inserts[114] = "INSERT INTO {dbprefix}config (config_key, config_value, value_type) VALUES('skip_dashboard', '0', 1);";
00653 $Inserts[115] = "INSERT INTO {dbprefix}config (config_key, config_value, value_type) VALUES('use_captcha_auth', '0', 1);";
00654 $Inserts[116] = "INSERT INTO {dbprefix}config (config_key, config_value, value_type) VALUES('http_cache_lifetime', '1800', 3);";
00655 
00656 
00660      function connectDb( $ignoreError = false , $selectDatabase = true )
00661      {
00662         $config = new ConfigFileStorage();
00663         // open a connection to the database
00664         $db = NewADOConnection( 'mysql' );
00665         if ( $selectDatabase ) {
00666             $res = $db->Connect($config->getValue( "db_host" ), $config->getValue( "db_username" ), $config->getValue( "db_password" ), $config->getValue( "db_database" ));
00667         } else {
00668             $res = $db->Connect($config->getValue( "db_host" ), $config->getValue( "db_username" ), $config->getValue( "db_password" ));
00669         }
00670 
00671         if( DB_WIZARD_DEBUG )
00672             $db->debug = true;
00673 
00674         // return error
00675         if( $ignoreError )
00676             return $db;
00677 
00678         if( !$res )
00679             return false;
00680 
00681         return $db;
00682     }
00683 
00687     function getDbPrefix()
00688     {
00689         $config = new ConfigFileStorage();
00690         return $config->getValue( "db_prefix" );
00691     }
00692 
00696     class WizardTools extends Object
00697     {
00702        function isNewInstallation()
00703        {
00704            $configFile = new ConfigFileStorage();
00705            // if plog hasn't been installed, this file will have empty settings
00706            if( $configFile->getValue( "db_host") == "" && $configFile->getValue( "db_username") == "" &&
00707                $configFile->getValue( "db_database") == "" && $configFile->getValue( "db_prefix" ) == "" &&
00708                $configFile->getValue( "db_password" ) == "" )
00709                $isNew = true;
00710            else
00711                $isNew = false;
00712 
00713            return( $isNew );
00714        }
00715     }
00716 
00720     class WizardView extends View
00721     {
00722 
00723         var $_templateName;
00724 
00725         function WizardView( $templateName )
00726         {
00727             $this->View();
00728             $this->_templateName = $templateName;
00729         }
00730 
00731         function render()
00732         {
00733             // build the file name
00734             $templateFileName = "wizard/".$this->_templateName.".template";
00735 
00736             //$t = new Template( $templateFileName, "" );
00737             $t = new Smarty();
00738             $v = new Version();
00739             $this->_params->setValue( "version", $v->getVersion());
00740             $this->_params->setValue( "projectPage", $v->getProjectPage());
00741             $this->_params->setValue( "safeMode", ini_get("safe_mode"));
00742             $t->assign( $this->_params->getAsArray());
00743             $t->template_dir    = "./templates";
00744             $t->compile_dir     = TEMP_FOLDER;
00745             $t->cache_dir       = TEMP_FOLDER;
00746             $t->use_sub_dirs    = false;
00747             $t->caching = false;
00748 
00749             print $t->fetch( $templateFileName );
00750         }
00751     }
00752 
00756     class WizardIntro extends Action
00757     {
00758         function WizardIntro( $actionInfo, $request )
00759         {
00760             $this->Action( $actionInfo, $request );
00761         }
00762 
00763         function perform()
00764         {
00765             // we can detect whether plog is already installed or not and direct users to the right
00766             // place
00767             if( WizardTools::isNewInstallation())
00768                 $this->_view = new WizardView( "intro" );
00769             else {
00770                 Controller::setForwardAction( "Update1" );
00771                 return false;
00772             }
00773 
00774             $this->setCommonData();
00775             return true;
00776         }
00777     }
00778 
00784     class WizardStepOne extends Action
00785     {
00786 
00787         var $_dbServer;
00788         var $_dbUser;
00789         var $_dbPassword;
00790