<?php
include("../config.php3");
include($BIB."bib_generic.php3");

# si aucune date n'a été entrée,on affiche la date actuelle dans les champs texte
$current_european_date = date("Y-m-d H:i:s", my_local_time());

#table plog_users
$squeryUSER = "INSERT INTO plog_users (id,user,password,email,full_name,about,properties,status,resource_picture_id) VALUES(".$id.",'".utf8_encode($login)."','".md5($pwd)."','".$email."','".$login."','','a:0:{}','1','0')";
main_db_query($squeryUSER, 1, $DATABASE_PLOG);

#table plog_blogs
$settings = "O:12:\"blogsettings\":3:{s:6:\"_objId\";N;s:3:\"log\";N;s:6:\"_props\";a:14:{s:6:\"locale\";s:5:\"fr_FR\";s:14:\"show_posts_max\";s:2:\"15\";s:8:\"template\";s:3:\"KTF\";s:17:\"show_more_enabled\";b:1;s:16:\"recent_posts_max\";s:2:\"10\";s:17:\"xmlrpc_ping_hosts\";a:2:{i:0;s:27:\"http://rpc.weblogs.com/RPC2\";i:1;s:0:\"\";}s:16:\"htmlarea_enabled\";b:1;s:16:\"comments_enabled\";b:1;s:16:\"categories_order\";s:1:\"1\";s:14:\"comments_order\";s:1:\"1\";s:11:\"time_offset\";s:1:\"0\";s:21:\"link_categories_order\";s:1:\"1\";s:29:\"show_future_posts_in_calendar\";b:0;s:27:\"new_drafts_autosave_enabled\";b:0;}}";
$mangled_blog = strtolower($login);
$squeryBLOG = "INSERT INTO plog_blogs (id,blog,owner_id,about,settings,mangled_blog,status,show_in_summary)".
			" VALUES(".$id.",'".utf8_encode($titre)."',".$id.",'','".$settings."','".$mangled_blog."','1','1')";
main_db_query($squeryBLOG, 1, $DATABASE_PLOG);

#table plog_gallery_albums
# creation automatique du premier dossier

$squeryAlbum = "INSERT INTO plog_gallery_albums(owner_id,name,flags,parent_id,date,properties,show_album,normalized_name,mangled_name)".
				" VALUES (".$id.",'Mes Images','0','0','".$current_european_date."','a:0:{}','1','Mes Images','mes_images')";
main_db_query($squeryAlbum, 1, $DATABASE_PLOG);

#table plog_articles_categories
# creation automatique de la premiere categorie
$nameCategorie = utf8_encode("Générale");
$description = utf8_encode("Première catégorie");
$squeryCategories = "INSERT INTO plog_articles_categories(name,url,blog_id,last_modification,in_main_page,parent_id ,description, properties,mangled_name)".
				" VALUES ('".$nameCategorie."','','".$id."','".$current_european_date."','1','0','".$description."','a:0:{}','gnrale')";
main_db_query($squeryCategories, 1, $DATABASE_PLOG);

?>