|
From: <dac...@us...> - 2007-09-01 23:53:03
|
Revision: 36
http://thevr.svn.sourceforge.net/thevr/?rev=36&view=rev
Author: dachebodt
Date: 2007-09-01 16:53:02 -0700 (Sat, 01 Sep 2007)
Log Message:
-----------
fixed installation bug
Modified Paths:
--------------
mods/cms/trunk/modules/content/info/acp_content.php
mods/cms/trunk/modules/content/info/cms_content.php
Modified: mods/cms/trunk/modules/content/info/acp_content.php
===================================================================
--- mods/cms/trunk/modules/content/info/acp_content.php 2007-09-01 23:52:02 UTC (rev 35)
+++ mods/cms/trunk/modules/content/info/acp_content.php 2007-09-01 23:53:02 UTC (rev 36)
@@ -30,99 +30,53 @@
{
global $db, $phpbb_root_path, $phpEx;
- include_once($phpbb_root_path . "modules/mods/acp_mods.$phpEx");
include_once($phpbb_root_path . "modules/content/constants.$phpEx");
- $_module = new acp_modules();
- $_module->module_class = 'cms';
+ $sql_ary[] = 'CREATE TABLE IF NOT EXISTS ' . CONTENT_TABLE . " (
+ `id` mediumint(8) NOT NULL auto_increment,
+ `title` varchar(100) collate utf8_bin NOT NULL,
+ `content_id` mediumint(8) NOT NULL,
+ `summary_bitfield` varchar(255) collate utf8_bin NOT NULL,
+ `summary_uid` varchar(5) collate utf8_bin NOT NULL,
+ `summary_options` int(11) unsigned NOT NULL default '7',
+ `summary` text collate utf8_bin,
+ `image` text collate utf8_bin NOT NULL,
+ `content` text collate utf8_bin,
+ `content_bitfield` varchar(255) collate utf8_bin NOT NULL,
+ `content_uid` varchar(5) collate utf8_bin NOT NULL,
+ `content_options` int(11) NOT NULL default '7',
+ `keywords` text collate utf8_bin,
+ `author` mediumint(8) NOT NULL,
+ `post_time` int(11) NOT NULL default '0',
+ `status` tinyint(1) NOT NULL default '0',
+ `approver` mediumint(8) NOT NULL,
+ PRIMARY KEY (`id`)
+ ) CHARACTER SET `utf8` COLLATE `utf8_bin`";
- $errors = array();
- $module_data = array(
- 'parent_id' => 0,
- 'module_langname' => 'CMS_CONTENT',
- 'module_basename' => '',
- 'module_mode' => '',
- 'module_auth' => '',
- 'module_enabled' => 1,
- 'module_display' => 1,
- 'module_class' => 'cms',
- 'module_dir' => 'content',
- );
+ $sql_ary[] = 'CREATE TABLE IF NOT EXISTS ' . CONTENT_TYPES_TABLE . " (
+ `content_id` int(3) NOT NULL auto_increment,
+ `content_name` varchar(125) collate utf8_bin NOT NULL,
+ `content_langname` varchar(255) collate utf8_bin NOT NULL,
+ `permission` mediumtext collate utf8_bin NOT NULL,
+ `content_fields` text collate utf8_bin,
+ `req_approval` tinyint(1) NOT NULL default '1',
+ `allow_comments` tinyint(1) NOT NULL default '1',
+ `allow_ratings` tinyint(1) NOT NULL default '1',
+ `allow_views` tinyint(1) NOT NULL default '1',
+ `allow_keywords` tinyint(1) NOT NULL default '0',
+ `allow_bbcode` tinyint(1) NOT NULL default '1',
+ `allow_smilies` tinyint(1) NOT NULL default '1',
+ `allow_urls` tinyint(1) NOT NULL default '1',
+ `display_type` tinyint(1) NOT NULL default '0',
+ `active` tinyint(1) NOT NULL default '0',
+ `content_order` tinyint(2) NOT NULL default '0',
+ PRIMARY KEY (`content_id`)
+ ) CHARACTER SET `utf8` COLLATE `utf8_bin`";
- $errors = $_module->update_module_data($module_data, true);
-
- if(!sizeof($errors))
+ foreach($sql_ary as $i => $sql)
{
- $parent_id = $db->sql_nextid();
-
- $module_data = array(
- 'parent_id' => $parent_id,
- 'module_langname' => 'News',
- 'module_basename' => 'content',
- 'module_mode' => 'news',
- 'module_auth' => '',
- 'module_enabled' => 1,
- 'module_display' => 1,
- 'module_class' => 'cms',
- 'module_dir' => 'content',
- );
-
- $errors = $_module->update_module_data($module_data, true);
- $mod_id = $db->sql_nextid();
+ $db->sql_query($sql);
}
-
- if(!sizeof($errors))
- {
- $sql_ary[] = 'CREATE TABLE IF NOT EXISTS ' . CONTENT_TABLE . " (
- `id` mediumint(8) NOT NULL auto_increment,
- `title` varchar(100) collate utf8_bin NOT NULL,
- `content_id` mediumint(8) NOT NULL,
- `summary_bitfield` varchar(255) collate utf8_bin NOT NULL,
- `summary_uid` varchar(5) collate utf8_bin NOT NULL,
- `summary_options` int(11) unsigned NOT NULL default '7',
- `summary` text collate utf8_bin,
- `image` text collate utf8_bin NOT NULL,
- `content` text collate utf8_bin,
- `content_bitfield` varchar(255) collate utf8_bin NOT NULL,
- `content_uid` varchar(5) collate utf8_bin NOT NULL,
- `content_options` int(11) NOT NULL default '7',
- `keywords` text collate utf8_bin,
- `author` mediumint(8) NOT NULL,
- `post_time` int(11) NOT NULL default '0',
- `status` tinyint(1) NOT NULL default '0',
- `approver` mediumint(8) NOT NULL,
- PRIMARY KEY (`id`)
- ) CHARACTER SET `utf8` COLLATE `utf8_bin`";
-
- $sql_ary[] = 'CREATE TABLE IF NOT EXISTS ' . CONTENT_TYPES_TABLE . " (
- `content_id` int(3) NOT NULL auto_increment,
- `content_name` varchar(125) collate utf8_bin NOT NULL,
- `content_langname` varchar(255) collate utf8_bin NOT NULL,
- `permission` mediumtext collate utf8_bin NOT NULL,
- `content_fields` text collate utf8_bin,
- `req_approval` tinyint(1) NOT NULL default '1',
- `allow_comments` tinyint(1) NOT NULL default '1',
- `allow_ratings` tinyint(1) NOT NULL default '1',
- `allow_views` tinyint(1) NOT NULL default '1',
- `allow_keywords` tinyint(1) NOT NULL default '0',
- `allow_bbcode` tinyint(1) NOT NULL default '1',
- `allow_smilies` tinyint(1) NOT NULL default '1',
- `allow_urls` tinyint(1) NOT NULL default '1',
- `display_type` tinyint(1) NOT NULL default '0',
- `active` tinyint(1) NOT NULL default '0',
- `content_order` tinyint(2) NOT NULL default '0',
- PRIMARY KEY (`content_id`)
- ) CHARACTER SET `utf8` COLLATE `utf8_bin`";
-
- $time = time();
- $sql_ary[] = 'INSERT INTO ' . CONTENT_TABLE . " VALUES (1, 'Welcome to phpbb3 CMS', $mod_id, '', '', 7, NULL, '', 'Congratulations! You have successfully installed the phpbb3 CMS. You may now configure your site as you wish. From the administrative control panel you can enable/disable modules and their blocks.\n\nEnjoy.', '', '', 7, '', 2, $time, 1, 0);";
- $sql_ary[] = 'INSERT INTO ' . CONTENT_TYPES_TABLE . " VALUES ($mod_id, '', '', '', 0x613a343a7b733a353a227469746c65223b613a373a7b733a353a226c6162656c223b733a353a225469746c65223b733a343a2274797065223b733a313a2230223b733a363a22746561736572223b733a313a2231223b733a343a22626f6479223b733a313a2231223b733a383a227265717569726564223b733a313a2231223b733a343a226e616d65223b733a353a227469746c65223b733a383a2276616c6964617465223b733a313a2230223b7d733a353a22696d616765223b613a373a7b733a353a226c6162656c223b733a353a22496d616765223b733a343a2274797065223b733a313a2230223b733a363a22746561736572223b733a313a2231223b733a343a22626f6479223b733a313a2231223b733a343a226e616d65223b733a353a22696d616765223b733a383a227265717569726564223b733a313a2230223b733a383a2276616c6964617465223b733a313a2230223b7d733a373a2273756d6d617279223b613a373a7b733a353a226c6162656c223b733a303a22223b733a343a2274797065223b733a313a2231223b733a343a226e616d65223b733a373a2273756d6d617279223b733a363a22746561736572223b733a313a2230223b733a343a22626f6479223b733a313a2230223b733a383a227265717569726564223b733a313a2230223b733a383a2276616c6964617465223b733a313a2230223b7d733a373a22636f6e74656e74223b613a373a7b733a353a226c6162656c223b733a343a224e657773223b733a343a2274797065223b733a313a2232223b733a363a22746561736572223b733a313a2231223b733a343a22626f6479223b733a313a2231223b733a343a226e616d65223b733a373a22636f6e74656e74223b733a383a227265717569726564223b733a313a2230223b733a383a2276616c6964617465223b733a313a2230223b7d7d, 1, 1, 0, 0, 1, 1, 1, 1, 0, 0, 0);";
-
- foreach($sql_ary as $i => $sql)
- {
- $db->sql_query($sql);
- }
- }
}
function uninstall()
Modified: mods/cms/trunk/modules/content/info/cms_content.php
===================================================================
--- mods/cms/trunk/modules/content/info/cms_content.php 2007-09-01 23:52:02 UTC (rev 35)
+++ mods/cms/trunk/modules/content/info/cms_content.php 2007-09-01 23:53:02 UTC (rev 36)
@@ -26,21 +26,28 @@
$parent_id = $db->sql_fetchfield('module_id');
$db->sql_freeresult($result);
- $sql = 'SELECT module_langname, module_mode, module_auth
- FROM ' . MODULES_TABLE . "
- WHERE parent_id = $parent_id
- AND module_dir = 'content'
- AND module_class = 'cms'
- AND module_mode <> ''
- ORDER BY left_id";
- $result = $db->sql_query($sql);
+ if($parent_id)
+ {
+ $sql = 'SELECT module_langname, module_mode, module_auth
+ FROM ' . MODULES_TABLE . "
+ WHERE parent_id = $parent_id
+ AND module_dir = 'content'
+ AND module_class = 'cms'
+ AND module_mode <> ''
+ ORDER BY left_id";
+ $result = $db->sql_query($sql);
- $modes_ary = array();
- while($row = $db->sql_fetchrow($result))
+ $modes_ary = array();
+ while($row = $db->sql_fetchrow($result))
+ {
+ $modes_ary[$row['module_mode']] = array('title' => $row['module_langname'], 'auth' => $row['module_auth'], 'cat' => array('CMS_CONTENT'));
+ }
+ $db->sql_freeresult($result);
+ }
+ else
{
- $modes_ary[$row['module_mode']] = array('title' => $row['module_langname'], 'auth' => $row['module_auth'], 'cat' => array('CMS_CONTENT'));
+ $modes_ary['news'] = array('title' => 'News', 'auth' => '', 'cat' => array('CMS_CONTENT'));
}
- $db->sql_freeresult($result);
return array(
'filename' => 'cms_content',
@@ -52,6 +59,30 @@
function install()
{
+ global $db, $phpbb_root_path, $phpEx;
+
+ include_once($phpbb_root_path . "modules/content/constants.$phpEx");
+
+ $mod_id = '';
+ $sql = 'SELECT module_id
+ FROM ' . MODULES_TABLE . "
+ WHERE module_mode = 'news'
+ AND module_dir = 'content'";
+ $result = $db->sql_query($sql);
+ $mod_id = $db->sql_fetchfield('module_id');
+ $db->sql_freeresult($result);
+
+ if($mod_id)
+ {
+ $time = time();
+ $sql_ary[] = 'INSERT INTO ' . CONTENT_TABLE . " VALUES (1, 'Welcome to phpbb3 CMS', $mod_id, '', '', 7, NULL, '', 'Congratulations! You have successfully installed the phpbb3 CMS. You may now configure your site as you wish. From the administrative control panel you can enable/disable modules and their blocks.\n\nEnjoy.', '', '', 7, '', 2, $time, 1, 0);";
+ $sql_ary[] = 'INSERT INTO ' . CONTENT_TYPES_TABLE . " VALUES ($mod_id, '', '', '', 0x613a343a7b733a353a227469746c65223b613a373a7b733a353a226c6162656c223b733a353a225469746c65223b733a343a2274797065223b733a313a2230223b733a363a22746561736572223b733a313a2231223b733a343a22626f6479223b733a313a2231223b733a383a227265717569726564223b733a313a2231223b733a343a226e616d65223b733a353a227469746c65223b733a383a2276616c6964617465223b733a313a2230223b7d733a353a22696d616765223b613a373a7b733a353a226c6162656c223b733a353a22496d616765223b733a343a2274797065223b733a313a2230223b733a363a22746561736572223b733a313a2231223b733a343a22626f6479223b733a313a2231223b733a343a226e616d65223b733a353a22696d616765223b733a383a227265717569726564223b733a313a2230223b733a383a2276616c6964617465223b733a313a2230223b7d733a373a2273756d6d617279223b613a373a7b733a353a226c6162656c223b733a303a22223b733a343a2274797065223b733a313a2231223b733a343a226e616d65223b733a373a2273756d6d617279223b733a363a22746561736572223b733a313a2230223b733a343a22626f6479223b733a313a2230223b733a383a227265717569726564223b733a313a2230223b733a383a2276616c6964617465223b733a313a2230223b7d733a373a22636f6e74656e74223b613a373a7b733a353a226c6162656c223b733a343a224e657773223b733a343a2274797065223b733a313a2232223b733a363a22746561736572223b733a313a2231223b733a343a22626f6479223b733a313a2231223b733a343a226e616d65223b733a373a22636f6e74656e74223b733a383a227265717569726564223b733a313a2230223b733a383a2276616c6964617465223b733a313a2230223b7d7d, 1, 1, 0, 0, 1, 1, 1, 1, 0, 0, 0);";
+
+ foreach($sql_ary as $i => $sql)
+ {
+ $db->sql_query($sql);
+ }
+ }
}
function uninstall()
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|