phpBB_CMS Version: 1.0.0

Ответы на вопросы, связанные с модами для phpBB 2.0.x, кроме относящихся к форуму Для авторов (phpBB 2.0.x).
Аватара пользователя
xvoid
phpBB 1.4.3
Сообщения: 98
Стаж: 18 лет 6 месяцев

phpBB_CMS Version: 1.0.0

Сообщение xvoid »

При запуске скрипта, который создает таблицы в бд, выскакивает ошибка:

Код: Выделить всё

Could not insert first content forum 

DEBUG MODE 

SQL Error : 1136 Column count doesn't match value count at row 1 

INSERT INTO phpbb_forums VALUES (2, 3, 'Test', '', 0, 10, 1, 1, 2, NULL, 0, 0, 0, 5, 5, 5, 5, 5, 5, 5, 5, 0) 

Line : 187 
File : install_cms.php
Запрос выглядит так:

Код: Выделить всё

$sql =   "INSERT INTO " . $table_prefix. "forums VALUES (2, 3, 'Test', '', 0, 10, 1, 1, 2, NULL, 0, 0, 0, 5, 5, 5, 5, 5, 5, 5, 5, 0)"; 
if( !($result = $db->sql_query($sql)) ) 
{ 
   message_die(GENERAL_ERROR, 'Could not insert first content forum', '', __LINE__, __FILE__, $sql); 
}
Помогите пожайлуста !

ЗЫ полный код скрипта

Код: Выделить всё

<?php
/***************************************************************************
 *                                install_cms.php
 *                            -------------------
 *   begin                : Saturday, Feb 13, 2001
 *   copyright            : (C) 2003 IK
 *   email                : cms@kohl-net.de
 *
 *
 ***************************************************************************/

/***************************************************************************
 *
 *   This program is free software; you can redistribute it and/or modify
 *   it under the terms of the GNU General Public License as published by
 *   the Free Software Foundation; either version 2 of the License, or
 *   (at your option) any later version.
 *
 ***************************************************************************/

define('IN_PHPBB', true);
$phpbb_root_path = './';
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.'.$phpEx);

//
// Start session management
//
$userdata = session_pagestart($user_ip, PAGE_INDEX);
init_userprefs($userdata);
//
// End session management
//

// Check if install_cms.php has been run before

$sql = "SELECT cat_type FROM " . CATEGORIES_TABLE . " ORDER BY cat_order DESC";
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
if ($row['cat_type'] == 2)
{
	message_die('', 'Looks like you already installed the phpBB_CMS changes :)', '', '', '', '');
}

else
{
// Alter the categories table
$sql = "ALTER TABLE  " . CATEGORIES_TABLE . " ADD cat_type TINYINT NOT NULL";
if( !($result = $db->sql_query($sql)) )
{
	message_die(GENERAL_ERROR, 'Could not edit ' . CATEGORIES_TABLE . ' for cat_type', '', __LINE__, __FILE__, $sql);
}

// Insert the portals category
$sql = "SELECT cat_order FROM " . CATEGORIES_TABLE . " ORDER BY cat_order DESC";
if( !($result = $db->sql_query($sql)) )
{
	message_die(GENERAL_ERROR, 'Could not querry the lowest category', '', __LINE__, __FILE__, $sql);
}
$row = $db->sql_fetchrow($result);
$lowest_cat = $row['cat_order'] + 20;
$sql = "SELECT cat_id FROM " . CATEGORIES_TABLE . " ORDER BY cat_id DESC";
if( !($result = $db->sql_query($sql)) )
{
	message_die(GENERAL_ERROR, 'Could not querry the cat_id', '', __LINE__, __FILE__, $sql);
}
$row = $db->sql_fetchrow($result);
$highest_id = $row['cat_id'] + 1;

$cat_name = "Portals";

$sql = "INSERT INTO " . CATEGORIES_TABLE . " (cat_id, cat_title, cat_order, cat_type) VALUES ($highest_id, '$cat_name', $lowest_cat, 2)";
if( !($result = $db->sql_query($sql)) )
{
	message_die(GENERAL_ERROR, 'Could not write portal category', '', __LINE__, __FILE__, $sql);
}

// Alter the posts table
$sql = "ALTER TABLE  " . POSTS_TABLE . " ADD portal_post_type TINYINT NOT NULL";
if( !($result = $db->sql_query($sql)) )
{
	message_die(GENERAL_ERROR, 'Could not edit ' . POSTS_TABLE . ' for portal_post_type', '', __LINE__, __FILE__, $sql);
}


// Create CMS table & write default values

$sql =	"CREATE TABLE " . $table_prefix. "cms (
		config_id tinyint(4) NOT NULL default '0',
		left_column smallint(4) NOT NULL default '0',
		right_column smallint(4) NOT NULL default '0', 
		sitemap_cats tinyint(4) NOT NULL default '0', 
		portal_posts tinyint(4) NOT NULL default '0',
		PRIMARY KEY  (config_id)
		) TYPE=MyISAM";
if( !($result = $db->sql_query($sql)) )
{
	message_die(GENERAL_ERROR, 'Could not create table ' . $table_prefix . 'cms', '', __LINE__, __FILE__, $sql);
}
$sql =	"INSERT INTO " . $table_prefix. "cms VALUES (1, 150, 200, 3, 10)";
if( !($result = $db->sql_query($sql)) )
{
	message_die(GENERAL_ERROR, 'Could write default values for table ' . $table_prefix . 'cms', '', __LINE__, __FILE__, $sql);
}


// Create CMS Blocks table

$sql =	"CREATE TABLE " . $table_prefix. "cms_blocks (
		block_id tinyint(4) NOT NULL auto_increment,
		name tinytext NOT NULL,
		file tinytext NOT NULL,
		location tinyint(4) NOT NULL default '0',
		block_order tinyint(4) NOT NULL default '0',
		PRIMARY KEY  (block_id)
		) TYPE=MyISAM";
if( !($result = $db->sql_query($sql)) )
{
	message_die(GENERAL_ERROR, 'Could not create table ' . $table_prefix . 'cms_blocks', '', __LINE__, __FILE__, $sql);
}

// Insert blocks

$sql =	"INSERT INTO " . $table_prefix. "cms_blocks VALUES (1, 'Latest Content', 'block_last_content.php', 0, 30)";
if( !($result = $db->sql_query($sql)) )
{
	message_die(GENERAL_ERROR, 'Could not insert Last Content Block', '', __LINE__, __FILE__, $sql);
}
$sql =	"INSERT INTO " . $table_prefix. "cms_blocks VALUES (2, 'Affiliates Block', 'block_affiliates.php', 0, 20)";
if( !($result = $db->sql_query($sql)) )
{
	message_die(GENERAL_ERROR, 'Could not insert Affiliates Block', '', __LINE__, __FILE__, $sql);
}
$sql =	"INSERT INTO " . $table_prefix. "cms_blocks VALUES (3, 'Counter Block', 'block_counter.php', 0, 10)";
if( !($result = $db->sql_query($sql)) )
{
	message_die(GENERAL_ERROR, 'Could not insert Counter Block', '', __LINE__, __FILE__, $sql);
}
$sql =	"INSERT INTO " . $table_prefix. "cms_blocks VALUES (4, 'Users last on', 'block_laston.php', 1, 30)";
if( !($result = $db->sql_query($sql)) )
{
	message_die(GENERAL_ERROR, 'Could not insert Last On Block', '', __LINE__, __FILE__, $sql);
}
$sql =	"INSERT INTO " . $table_prefix. "cms_blocks VALUES (5, 'Last Posts', 'block_last_posts.php', 1, 40)";
if( !($result = $db->sql_query($sql)) )
{
	message_die(GENERAL_ERROR, 'Could not insert Last Posts Block', '', __LINE__, __FILE__, $sql);
}
$sql =	"INSERT INTO " . $table_prefix. "cms_blocks VALUES (6, 'User Control Panel', 'block_user_cp.php', 1, 20)";
if( !($result = $db->sql_query($sql)) )
{
	message_die(GENERAL_ERROR, 'Could not insert User CP Block', '', __LINE__, __FILE__, $sql);
}
$sql =	"INSERT INTO " . $table_prefix. "cms_blocks VALUES (7, 'Site search block', 'block_site_search.php', 1, 50)";
if( !($result = $db->sql_query($sql)) )
{
	message_die(GENERAL_ERROR, 'Could not insert Site Search Block', '', __LINE__, __FILE__, $sql);
}

// Table and content for counter block

$sql =	"CREATE TABLE " . $table_prefix. "counter (id tinyint(4) NOT NULL default '0', count int(11) NOT NULL default '0', PRIMARY KEY  (id)) TYPE=MyISAM";
if( !($result = $db->sql_query($sql)) )
{
	message_die(GENERAL_ERROR, 'Could not create counter block table', '', __LINE__, __FILE__, $sql);
}

$sql =	"INSERT INTO " . $table_prefix. "counter VALUES (1, 1)";
if( !($result = $db->sql_query($sql)) )
{
	message_die(GENERAL_ERROR, 'Could not insert counter value', '', __LINE__, __FILE__, $sql);
}


// Insert first CMS category, forums, topics and posts

$lowest_cat -= 10;
$sql =	"INSERT INTO " . $table_prefix. "categories VALUES (3, 'Home', $lowest_cat, 1)";
if( !($result = $db->sql_query($sql)) )
{
	message_die(GENERAL_ERROR, 'Could not insert first CMS category', '', __LINE__, __FILE__, $sql);
}

$sql =	"INSERT INTO " . $table_prefix. "forums VALUES (2, 3, 'Test', '', 0, 10, 1, 1, 2, NULL, 0, 0, 0, 5, 5, 5, 5, 5, 5, 5, 5, 0)";
if( !($result = $db->sql_query($sql)) )
{
	message_die(GENERAL_ERROR, 'Could not insert first content forum', '', __LINE__, __FILE__, $sql);
}
$sql =	"INSERT INTO " . $table_prefix. "forums VALUES (3, 2, 'Home', '', 0, 10, 2, 1, 4, NULL, 0, 0, 0, 5, 5, 5, 5, 5, 5, 5, 5, 0)";
if( !($result = $db->sql_query($sql)) )
{
	message_die(GENERAL_ERROR, 'Could not insert first portal forum', '', __LINE__, __FILE__, $sql);
}

$sql =	"INSERT INTO " . $table_prefix. "topics VALUES (2, 2, 'First Topic', 2, 1047745804, 3, 0, 0, 0, 0, 2, 2, 0)";
if( !($result = $db->sql_query($sql)) )
{
	message_die(GENERAL_ERROR, 'Could not insert first content topic', '', __LINE__, __FILE__, $sql);
}
$sql =	"INSERT INTO " . $table_prefix. "topics VALUES (3, 3, 'First news item', 2, 1047745843, 5, 1, 0, 0, 0, 3, 5, 0)";
if( !($result = $db->sql_query($sql)) )
{
	message_die(GENERAL_ERROR, 'Could not insert first portal topic', '', __LINE__, __FILE__, $sql);
}

$sql =	"INSERT INTO " . $table_prefix. "posts VALUES (2, 2, 2, 2, 1047745804, '7f000001', '', 1, 0, 1, 0, NULL, 0, 0)";
if( !($result = $db->sql_query($sql)) )
{
	message_die(GENERAL_ERROR, 'Could not insert content post', '', __LINE__, __FILE__, $sql);
}
$sql =	"INSERT INTO " . $table_prefix. "posts VALUES (3, 3, 3, 2, 1047745843, '7f000001', '', 1, 0, 1, 0, NULL, 0, 0)";
if( !($result = $db->sql_query($sql)) )
{
	message_die(GENERAL_ERROR, 'Could not insert first portal post', '', __LINE__, __FILE__, $sql);
}
$sql =	"INSERT INTO " . $table_prefix. "posts VALUES (5, 3, 3, 2, 1048411991, '7f000001', '', 1, 0, 1, 0, NULL, 0, 0)";
if( !($result = $db->sql_query($sql)) )
{
	message_die(GENERAL_ERROR, 'Could not insert second portal post', '', __LINE__, __FILE__, $sql);
}

$sql =	"INSERT INTO " . $table_prefix. "posts_text VALUES (2, '614a0bab2d', 'First Topic', 'Hi, this is the first content page of the [b:614a0bab2d]First Topic [/b:614a0bab2d]menu point ! Congratulations !!! :P')";
if( !($result = $db->sql_query($sql)) )
{
	message_die(GENERAL_ERROR, 'Could not insert content post text', '', __LINE__, __FILE__, $sql);
}
$sql =	"INSERT INTO " . $table_prefix. "posts_text VALUES (3, 'b623251ecb', 'First news item', 'Hello, this is the first news item for your page')";
if( !($result = $db->sql_query($sql)) )
{
	message_die(GENERAL_ERROR, 'Could not insert first portal post text', '', __LINE__, __FILE__, $sql);
}
$sql =	"INSERT INTO " . $table_prefix. "posts_text VALUES (5, '5472e72826', 'Second news item', 'This is the second news item')";
if( !($result = $db->sql_query($sql)) )
{
	message_die(GENERAL_ERROR, 'Could not insert second portal post text', '', __LINE__, __FILE__, $sql);
}



message_die('', 'Congratulations, you have successfully installed the phpBB_CMS changes to your database', '', '', '', '');

}

?>

Вернуться в «Поддержка модов для phpBB 2.0.x»