|
From: OryNider <ory...@us...> - 2008-03-08 15:32:43
|
Update of /cvsroot/mxbb/mx_linkdb In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv25414 Modified Files: Tag: core28x linkdb.php Added Files: Tag: core28x linkdb_install.php linkdb_uninstall.php Log Message: update for new mx_mod 2.8.2 --- NEW FILE: linkdb_install.php --- <?php /** * * @package phpBB2 Mod - pafileDB * @version $Id: linkdb_install.php,v 1.1.2.1 2008/03/08 15:32:36 orynider Exp $ * @copyright (c) 2002-2006 [Jon Ohlsson, Mohd Basri, wGEric, PHP Arena, pafileDB, CRLin] mxBB Project Team * @license http://opensource.org/licenses/gpl-license.php GNU General Public License v2 * */ $phpEx = substr(strrchr(__FILE__, '.'), 1); if ( !defined('PORTAL_BACKEND') && @file_exists( './viewtopic.' . $phpEx ) ) // -------------------------------------------- phpBB MOD MODE { define( 'MXBB_MODULE', false ); define( 'IN_PHPBB', true ); $phpbb_root_path = $module_root_path = './'; $mx_mod_path = $phpbb_root_path . 'mx_mod/'; include($phpbb_root_path . 'common.' . $phpEx); include($mx_mod_path . "includes/functions_required.$phpEx"); //Check if forum_hack is installed if (!isset($mx_root_path)) { $mx_root_path = './'; @define('IN_PORTAL', true); include_once($mx_mod_path . "includes/mx_constants.$phpEx"); include_once($mx_mod_path . "includes/shared/phpbb2/includes/functions.$phpEx"); } else { @define('IN_PORTAL', true); include_once($mx_root_path . "includes/mx_constants.$phpEx"); include_once($mx_root_path . "includes/shared/phpbb2/includes/functions.$phpEx"); } require($mx_mod_path . "includes/functions_core.$phpEx"); require($mx_mod_path . "includes/functions_styles.$phpEx"); //Check for cash mod if (file_exists($phpbb_root_path . 'includes/functions_cash.'.$phpEx)) { define('IN_CASHMOD', true); } //@ini_set( 'display_errors', '1' ); error_reporting (E_ERROR | E_WARNING | E_PARSE); // This will NOT report uninitialized variables //error_reporting(E_ALL & ~E_NOTICE); define( 'PAGE_KB', -502 ); // If this id generates a conflict with other mods, change it ;) // // Instatiate the mx_cache class // $mx_cache = new mx_cache(); // // Get mxBB config settings // //$portal_config = $mx_cache->obtain_mxbb_config(); // // instatiate the mx_request_vars class // $mx_request_vars = new mx_request_vars(); // // Page selector // $page_id = $mx_request_vars->request('page', MX_TYPE_INT, 1); $is_block = false; // // instatiate the mx_user class // $mx_user = new mx_user(); if (file_exists("./modcp.$phpEx")) // phpBB2 { define('PORTAL_BACKEND', 'phpbb2'); $tplEx = 'tpl'; // // Start user session // - populate $userdata and $lang // $mx_user->init($user_ip, $page_id, false); init_userprefs($userdata); $mx_user->set_module_default_style('prosilver'); // For compatibility with core 2.8.x if (!$userdata['user_level'] == ADMIN) { die('Only admins may run this script!!!'); } } else if (@file_exists("./mcp.$phpEx")) // phpBB3 { define('PORTAL_BACKEND', 'phpbb3'); $tplEx = 'html'; // // Start user session // - populate $userdata and $lang // $mx_user->init($user_ip, $page_id, false); $user->setup(); // // End session management // $mx_user->set_module_default_style('prosilver'); // For compatibility with core 2.8.x if ($userdata['user_type'] != USER_FOUNDER) { die('Only admins may run this script!!!'); } } else { die('Copy this file in phpbb_root_path were is your viewtopic.php file!!!'); } } else // --------------------------------------------------------------------------------- mxBB Module MODE { define( 'MXBB_MODULE', true ); if ( !function_exists( 'read_block_config' ) ) { define( 'IN_PORTAL', true ); $mx_root_path = './../../'; $module_root_path = './'; $phpEx = substr(strrchr(__FILE__, '.'), 1); include_once( $mx_root_path . 'common.' . $phpEx ); // Start session management $mx_user->init($user_ip, PAGE_INDEX); // End session management define( 'MXBB_27x', file_exists( $mx_root_path . 'mx_login.' . $phpEx ) ); } else { if( !defined('IN_PORTAL') || !is_object($mx_block)) { die("Hacking attempt"); } // // Read Block Settings (default mode) // $title = !empty( $mx_block->block_info['block_title'] ) ? $mx_block->block_info['block_title'] : $lang['KB_title']; $desc = $mx_block->block_info['block_desc']; $block_size = ( isset( $block_size ) && !empty( $block_size ) ? $block_size : '100%' ); //Check for cash mod if (file_exists($phpbb_root_path . 'includes/functions_cash.'.$phpEx)) { define('IN_CASHMOD', true); } $is_block = true; global $images; } define( 'MXBB_27x', @file_exists( $mx_root_path . 'mx_login.'.$phpEx ) ); } // // Check if mx_common Mod is prezent // if (!file_exists($mx_mod_path . "includes/functions_admincp.$phpEx")) { die('mx mod is not uploaded!!!'); } else { require($mx_mod_path . "includes/functions_admincp.$phpEx"); } // // Check if mx_common Mod is prezent // if ( !file_exists( $mx_mod_path . 'includes/' . 'functions_admincp.' . $phpEx ) ) { die('mx_mod folder is not uploaded!!!'); } else { include_once( $mx_mod_path . 'includes/' . 'functions_admincp.' . $phpEx ); include_once( $mx_mod_path . 'includes/functions_required.' . $phpEx ); } $page_title = 'Installing/Upgrading linkDB'; include($phpbb_root_path . 'includes/page_header.'.$phpEx); $sql = array(); // If fresh install if ( !$result = $db->sql_query( "SELECT config_name from " . $table_prefix . "linkdb_config" ) ) { $message = "<b>This is a fresh install!</b><br/><br/>"; $sql[] = "DROP TABLE IF EXISTS " . $table_prefix . "linkdb_categories "; $sql[] = "DROP TABLE IF EXISTS " . $table_prefix . "linkdb "; $sql[] = "DROP TABLE IF EXISTS " . $table_prefix . "linkdb_config "; $sql[] = "DROP TABLE IF EXISTS " . $table_prefix . "linkdb_custom "; $sql[] = "DROP TABLE IF EXISTS " . $table_prefix . "linkdb_customdata "; $sql[] = "DROP TABLE IF EXISTS " . $table_prefix . "linkdb_votes "; $sql[] = "DROP TABLE IF EXISTS " . $table_prefix . "linkdb_comments "; $sql[] = "CREATE TABLE " . $table_prefix . "linkdb_categories ( cat_id int(10) NOT NULL auto_increment, cat_name text, cat_desc text, cat_parent int(50) default NULL, parents_data text NOT NULL, cat_order int(50) default NULL, cat_allow_file tinyint(2) NOT NULL default '1', cat_allow_comments tinyint(2) NOT NULL default '-1', internal_comments tinyint(2) NOT NULL default '-1', autogenerate_comments tinyint(2) NOT NULL default '-1', comments_forum_id mediumint(8) NOT NULL DEFAULT '-1', cat_allow_ratings tinyint(2) NOT NULL default '-1', show_pretext tinyint(2) NOT NULL default '-1', notify tinyint(2) NOT NULL default '-1', notify_group mediumint(8) NOT NULL default '-1', cat_links mediumint(8) NOT NULL default '-1', cat_last_link_id mediumint(8) unsigned NOT NULL default '0', cat_last_link_name varchar(255) NOT NULL default '', cat_last_link_time INT(50) UNSIGNED NOT NULL default '0', auth_view tinyint(3) NOT NULL DEFAULT '0', auth_post tinyint(3) NOT NULL DEFAULT '0', auth_rate tinyint(3) NOT NULL DEFAULT '0', auth_view_comment tinyint(3) NOT NULL DEFAULT '0', auth_post_comment tinyint(3) NOT NULL DEFAULT '0', auth_edit_comment tinyint(3) NOT NULL DEFAULT '0', auth_delete_comment tinyint(3) NOT NULL DEFAULT '0', auth_edit tinyint(3) NOT NULL DEFAULT '0', auth_delete tinyint(3) NOT NULL DEFAULT '2', auth_approval tinyint(3) NOT NULL DEFAULT '0', auth_approval_edit tinyint(3) NOT NULL DEFAULT '0', auth_view_groups varchar(255) NOT NULL default '0', auth_post_groups varchar(255) NOT NULL default '0', auth_rate_groups varchar(255) NOT NULL default '0', auth_view_comment_groups varchar(255) NOT NULL default '0', auth_post_comment_groups varchar(255) NOT NULL default '0', auth_edit_comment_groups varchar(255) NOT NULL default '0', auth_delete_comment_groups varchar(255) NOT NULL default '0', auth_edit_groups varchar(255) NOT NULL default '0', auth_delete_groups varchar(255) NOT NULL default '0', auth_approval_groups varchar(255) NOT NULL default '0', auth_approval_edit_groups varchar(255) NOT NULL default '0', auth_moderator_groups varchar(255) NOT NULL default '0', PRIMARY KEY (cat_id), KEY cat_order (cat_order) )"; $sql[] = "INSERT INTO " . $table_prefix . "linkdb_categories VALUES (1, 'PHP', '', '', '', '1', 0, '-1', '-1', '-1', '-1', '-1', '-1', '-1', '-1', '-1', 0, '', 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)"; $sql[] = "INSERT INTO " . $table_prefix . "linkdb_categories VALUES (2, 'Bulletin Board', '', 1, '', '2', 1, '-1', '-1', '-1', '-1', '-1', '-1', '-1', '-1', '-1', 0, '', 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)"; $sql[] = "CREATE TABLE " . $table_prefix . "linkdb ( link_id mediumint(8) unsigned NOT NULL auto_increment, link_name text, link_desc text, link_longdesc text, link_catid mediumint(8) unsigned NOT NULL default '0', link_approved tinyint(1) NOT NULL default '0', link_url varchar(100) NOT NULL default '', link_logo_src varchar(120) default NULL, link_time int(25) default '0', user_id mediumint(8) NOT NULL default '0', poster_ip varchar(8) NOT NULL default '', post_username varchar(25) default NULL, last_user_ip varchar(8) NOT NULL default '', link_hits int(10) unsigned NOT NULL default '0', topic_id mediumint(8) unsigned NOT NULL default '0', PRIMARY KEY (link_id) )"; $sql[] = "INSERT INTO " . $table_prefix . "linkdb VALUES (1, 'phpBB Official Website', 'Official phpBB Website', '', 2, 1, 'http://www.phpbb.com/', 'linkdb/images/phpBB_88a.gif', " . time() . ", " . $userdata['user_id'] . ", '', '', '', '', '')"; $sql[] = "INSERT INTO " . $table_prefix . "linkdb VALUES (2, 'mxP Official Website', NULL, 'Mx-Publisher - Modular Portal & CMS', 2, 1, 'http://mx-publisher.com', 'linkdb/images/mxbb_88a.gif', " . time() . ", " . $userdata['user_id'] . ", '', '', '', '', '')"; $sql[] = "CREATE TABLE " . $table_prefix . "linkdb_config ( config_name varchar(255) NOT NULL default '', config_value varchar(255) NOT NULL default '', PRIMARY KEY (config_name) )"; // -------------------------------------------------------- // Table structure for table `phpbb_pa_comments` $sql[] = "CREATE TABLE " . $table_prefix . "linkdb_comments ( comments_id int(10) NOT NULL auto_increment, link_id int(10) NOT NULL default '0', comments_text text NOT NULL, comments_title text NOT NULL, comments_time int(50) NOT NULL default '0', comment_bbcode_uid varchar(10) default NULL, poster_id mediumint(8) NOT NULL default '0', PRIMARY KEY (comments_id), KEY comments_id (comments_id), FULLTEXT KEY comment_bbcode_uid (comment_bbcode_uid) )"; $sql[] = "CREATE TABLE " . $table_prefix . "linkdb_custom ( custom_id int(50) NOT NULL auto_increment, custom_name text NOT NULL, custom_description text NOT NULL, data text NOT NULL, field_order int(20) NOT NULL default '0', field_type tinyint(2) NOT NULL default '0', regex varchar(255) NOT NULL default '', PRIMARY KEY (custom_id) )"; $sql[] = "CREATE TABLE " . $table_prefix . "linkdb_customdata ( customdata_file int(50) NOT NULL default '0', customdata_custom int(50) NOT NULL default '0', data text NOT NULL )"; $sql[] = "CREATE TABLE " . $table_prefix . "linkdb_votes ( user_id mediumint(8) NOT NULL default '0', votes_ip varchar(50) NOT NULL default '0', votes_link int(50) NOT NULL default '0', rate_point tinyint(3) unsigned NOT NULL default '0', KEY user_id (user_id) )"; // General $sql[] = "INSERT INTO " . $table_prefix . "linkdb_config VALUES ('enable_module', '0')"; // settings_disable $sql[] = "INSERT INTO " . $table_prefix . "linkdb_config VALUES ('module_name', 'Download Database')"; // settings_dbname $sql[] = "INSERT INTO " . $table_prefix . "linkdb_config VALUES ('wysiwyg_path', 'mx_mod/mx_shared/')"; $sql[] = "INSERT INTO " . $table_prefix . "linkdb_config VALUES ('site_logo', 'http://" . $board_config['server_name'] . $board_config['script_path'] . "linkdb/images/web_logo88a.gif')"; $sql[] = "INSERT INTO " . $table_prefix . "linkdb_config VALUES ('site_url', 'http://" . $board_config['server_name'] . $board_config['script_path'] . "')"; $sql[] = "INSERT INTO " . $table_prefix . "linkdb_config VALUES ('display_interval', '6000')"; $sql[] = "INSERT INTO " . $table_prefix . "linkdb_config VALUES ('lock_submit_site', '0')"; // Link $sql[] = "INSERT INTO " . $table_prefix . "linkdb_config VALUES ('width', '88')"; $sql[] = "INSERT INTO " . $table_prefix . "linkdb_config VALUES ('height', '31')"; $sql[] = "INSERT INTO " . $table_prefix . "linkdb_config VALUES ('display_links_logo', '1')"; $sql[] = "INSERT INTO " . $table_prefix . "linkdb_config VALUES ('allow_no_logo', '0')"; $sql[] = "INSERT INTO " . $table_prefix . "linkdb_config VALUES ('split_links', '1')"; // Appearance $sql[] = "INSERT INTO " . $table_prefix . "linkdb_config VALUES ('sort_method', 'link_time')"; $sql[] = "INSERT INTO " . $table_prefix . "linkdb_config VALUES ('sort_order', 'DESC')"; $sql[] = "INSERT INTO " . $table_prefix . "linkdb_config VALUES ('pagination', '10')"; $sql[] = "INSERT INTO " . $table_prefix . "linkdb_config VALUES ('use_simple_navigation', '1')"; $sql[] = "INSERT INTO " . $table_prefix . "linkdb_config VALUES ('cat_col', '2')"; $sql[] = "INSERT INTO " . $table_prefix . "linkdb_config VALUES ('settings_newdays', '1')"; // New -------------------- // Comments $sql[] = "INSERT INTO " . $table_prefix . "linkdb_config VALUES ('use_comments', '0')"; // comments_show $sql[] = "INSERT INTO " . $table_prefix . "linkdb_config VALUES ('internal_comments', '1')"; // NEW $sql[] = "INSERT INTO " . $table_prefix . "linkdb_config VALUES ('formatting_comment_wordwrap', '1')"; // formatting_comment_fixup $sql[] = "INSERT INTO " . $table_prefix . "linkdb_config VALUES ('formatting_comment_image_resize', '300')"; // NEW $sql[] = "INSERT INTO " . $table_prefix . "linkdb_config VALUES ('formatting_comment_truncate_links', '1')"; // NEW $sql[] = "INSERT INTO " . $table_prefix . "linkdb_config VALUES ('max_comment_subject_chars', '50')"; // NEW $sql[] = "INSERT INTO " . $table_prefix . "linkdb_config VALUES ('max_comment_chars', '5000')"; $sql[] = "INSERT INTO " . $table_prefix . "linkdb_config VALUES ('allow_comment_wysiwyg', '0')"; // allow_wysiwyg_comments & allow_wysiwyg $sql[] = "INSERT INTO " . $table_prefix . "linkdb_config VALUES ('allow_comment_html', '1')"; $sql[] = "INSERT INTO " . $table_prefix . "linkdb_config VALUES ('allow_comment_bbcode', '1')"; $sql[] = "INSERT INTO " . $table_prefix . "linkdb_config VALUES ('allow_comment_smilies', '1')"; $sql[] = "INSERT INTO " . $table_prefix . "linkdb_config VALUES ('allow_comment_links', '1')"; $sql[] = "INSERT INTO " . $table_prefix . "linkdb_config VALUES ('allow_comment_images', '0')"; $sql[] = "INSERT INTO " . $table_prefix . "linkdb_config VALUES ('no_comment_image_message', '[No image please]')"; $sql[] = "INSERT INTO " . $table_prefix . "linkdb_config VALUES ('no_comment_link_message', '[No links please]')"; $sql[] = "INSERT INTO " . $table_prefix . "linkdb_config VALUES ('allowed_comment_html_tags', 'b,i,u,a')"; // NEW $sql[] = "INSERT INTO " . $table_prefix . "linkdb_config VALUES ('del_topic', '1')"; // NEW $sql[] = "INSERT INTO " . $table_prefix . "linkdb_config VALUES ('autogenerate_comments', '1')"; // NEW $sql[] = "INSERT INTO " . $table_prefix . "linkdb_config VALUES ('comments_pagination', '5')"; $sql[] = "INSERT INTO " . $table_prefix . "linkdb_config VALUES ('comments_forum_id', '1')"; // New // Ratings $sql[] = "INSERT INTO " . $table_prefix . "linkdb_config VALUES ('use_ratings', '0')"; $sql[] = "INSERT INTO " . $table_prefix . "linkdb_config VALUES ('votes_check_userid', '1')"; $sql[] = "INSERT INTO " . $table_prefix . "linkdb_config VALUES ('votes_check_ip', '1')"; // Instructions $sql[] = "INSERT INTO " . $table_prefix . "linkdb_config VALUES ('show_pretext', '0')"; // NEW $sql[] = "INSERT INTO " . $table_prefix . "linkdb_config VALUES ('pt_header', 'Link Submission Instructions')"; // NEW $sql[] = "INSERT INTO " . $table_prefix . "linkdb_config values ('pt_body', 'Please check your references and include as much information as you can.')"; // NEW // Notifications $sql[] = "INSERT INTO " . $table_prefix . "linkdb_config VALUES ('notify', 'pm')"; // pm_notify $sql[] = "INSERT INTO " . $table_prefix . "linkdb_config VALUES ('notify_group', '0')"; // NEW $message .= mx_do_install_upgrade( $sql ); } else { // Upgrade checks $upgrade_280 = 0; // validate before 2.8.0 $result = $db->sql_query( "SELECT config_value from " . $table_prefix . "linkdb_config WHERE config_name = 'comments_forum_id'" ); if ( $db->sql_numrows( $result ) == 0 ) { $upgrade_280 = 1; $message .= "<b>Upgrading to v. 2.8.0...ok</b><br/><br/>"; } else { $message .= "<b>Validating v. 2.8.0...ok</b><br/><br/>"; } $message = "<b>Upgrading!</b><br/><br/>"; if ( $upgrade_280 == 1 ) { //$sql[] = "INSERT INTO " . $table_prefix . "linkdb_config VALUES ('comments_forum_id', '0')"; //$sql[] = "ALTER TABLE " . $table_prefix . "linkdb_categories MODIFY cat_allow_ratings tinyint(2) NOT NULL default '-1' "; //$sql[] = "ALTER TABLE " . $table_prefix . "linkdb_categories ADD auth_approval_groups tinyint(2) NOT NULL default '0' "; // // Category // $sql[] = "ALTER TABLE " . $table_prefix . "linkdb_categories ADD cat_desc text "; $sql[] = "ALTER TABLE " . $table_prefix . "linkdb_categories ADD cat_allow_file tinyint(2) NOT NULL default '1' "; $sql[] = "ALTER TABLE " . $table_prefix . "linkdb_categories ADD cat_allow_comments tinyint(2) NOT NULL default '-1' "; $sql[] = "ALTER TABLE " . $table_prefix . "linkdb_categories ADD internal_comments tinyint(2) NOT NULL default '-1' "; $sql[] = "ALTER TABLE " . $table_prefix . "linkdb_categories ADD autogenerate_comments tinyint(2) NOT NULL default '-1' "; $sql[] = "ALTER TABLE " . $table_prefix . "linkdb_categories ADD comments_forum_id mediumint(8) NOT NULL DEFAULT '-1' "; $sql[] = "ALTER TABLE " . $table_prefix . "linkdb_categories ADD cat_allow_ratings tinyint(2) NOT NULL default '-1' "; $sql[] = "ALTER TABLE " . $table_prefix . "linkdb_categories ADD show_pretext tinyint(2) NOT NULL default '-1' "; $sql[] = "ALTER TABLE " . $table_prefix . "linkdb_categories ADD notify tinyint(2) NOT NULL default '-1' "; $sql[] = "ALTER TABLE " . $table_prefix . "linkdb_categories ADD notify_group mediumint(8) NOT NULL default '-1' "; $sql[] = "ALTER TABLE " . $table_prefix . "linkdb_categories ADD cat_last_link_id mediumint(8) unsigned NOT NULL default '0' "; $sql[] = "ALTER TABLE " . $table_prefix . "linkdb_categories ADD cat_last_link_name varchar(255) NOT NULL default '' "; $sql[] = "ALTER TABLE " . $table_prefix . "linkdb_categories ADD cat_last_link_time INT(50) UNSIGNED NOT NULL default '0' "; $sql[] = "ALTER TABLE " . $table_prefix . "linkdb_categories ADD auth_view tinyint(3) NOT NULL DEFAULT '0' "; $sql[] = "ALTER TABLE " . $table_prefix . "linkdb_categories ADD auth_post tinyint(3) NOT NULL DEFAULT '0' "; $sql[] = "ALTER TABLE " . $table_prefix . "linkdb_categories ADD auth_rate tinyint(3) NOT NULL DEFAULT '0' "; $sql[] = "ALTER TABLE " . $table_prefix . "linkdb_categories ADD auth_view_comment tinyint(3) NOT NULL DEFAULT '0' "; $sql[] = "ALTER TABLE " . $table_prefix . "linkdb_categories ADD auth_post_comment tinyint(3) NOT NULL DEFAULT '0' "; $sql[] = "ALTER TABLE " . $table_prefix . "linkdb_categories ADD auth_edit_comment tinyint(3) NOT NULL DEFAULT '0' "; $sql[] = "ALTER TABLE " . $table_prefix . "linkdb_categories ADD auth_delete_comment tinyint(3) NOT NULL DEFAULT '0' "; $sql[] = "ALTER TABLE " . $table_prefix . "linkdb_categories ADD auth_edit tinyint(3) NOT NULL DEFAULT '0' "; $sql[] = "ALTER TABLE " . $table_prefix . "linkdb_categories ADD auth_delete tinyint(3) NOT NULL DEFAULT '2' "; $sql[] = "ALTER TABLE " . $table_prefix . "linkdb_categories ADD auth_approval tinyint(3) NOT NULL DEFAULT '0' "; $sql[] = "ALTER TABLE " . $table_prefix . "linkdb_categories ADD auth_approval_edit tinyint(3) NOT NULL DEFAULT '0' "; $sql[] = "ALTER TABLE " . $table_prefix . "linkdb_categories ADD auth_view_groups varchar(255) NOT NULL default '0' "; $sql[] = "ALTER TABLE " . $table_prefix . "linkdb_categories ADD auth_post_groups varchar(255) NOT NULL default '0' "; $sql[] = "ALTER TABLE " . $table_prefix . "linkdb_categories ADD auth_rate_groups varchar(255) NOT NULL default '0' "; $sql[] = "ALTER TABLE " . $table_prefix . "linkdb_categories ADD auth_view_comment_groups varchar(255) NOT NULL default '0' "; $sql[] = "ALTER TABLE " . $table_prefix . "linkdb_categories ADD auth_post_comment_groups varchar(255) NOT NULL default '0' "; $sql[] = "ALTER TABLE " . $table_prefix . "linkdb_categories ADD auth_edit_comment_groups varchar(255) NOT NULL default '0' "; $sql[] = "ALTER TABLE " . $table_prefix . "linkdb_categories ADD auth_delete_comment_groups varchar(255) NOT NULL default '0' "; $sql[] = "ALTER TABLE " . $table_prefix . "linkdb_categories ADD auth_edit_groups varchar(255) NOT NULL default '0' "; $sql[] = "ALTER TABLE " . $table_prefix . "linkdb_categories ADD auth_delete_groups varchar(255) NOT NULL default '0' "; $sql[] = "ALTER TABLE " . $table_prefix . "linkdb_categories ADD auth_approval_groups varchar(255) NOT NULL default '0' "; $sql[] = "ALTER TABLE " . $table_prefix . "linkdb_categories ADD auth_approval_edit_groups varchar(255) NOT NULL default '0' "; $sql[] = "ALTER TABLE " . $table_prefix . "linkdb_categories ADD auth_moderator_groups varchar(255) NOT NULL default '0' "; // // linkdb // $sql[] = "ALTER TABLE " . $table_prefix . "linkdb ADD link_desc text "; $sql[] = "ALTER TABLE " . $table_prefix . "linkdb ADD topic_id mediumint(8) unsigned NOT NULL default '0' "; // // Config // $sql[] = "ALTER TABLE " . $table_prefix . "linkdb_config DROP PRIMARY KEY, ADD PRIMARY KEY (config_name) "; $sql[] = "DELETE FROM " . $table_prefix . "linkdb_config" . " WHERE config_name = 'allow_guest_submit_site'"; $sql[] = "DELETE FROM " . $table_prefix . "linkdb_config" . " WHERE config_name = 'allow_vote'"; $sql[] = "DELETE FROM " . $table_prefix . "linkdb_config" . " WHERE config_name = 'linkdb_versions'"; $sql[] = "DELETE FROM " . $table_prefix . "linkdb_config" . " WHERE config_name = 'link_validation'"; $sql[] = "DELETE FROM " . $table_prefix . "linkdb_config" . " WHERE config_name = 'email_notify'"; $sql[] = "DELETE FROM " . $table_prefix . "linkdb_config" . " WHERE config_name = 'display_logo_num'"; $sql[] = "UPDATE " . $table_prefix . "linkdb_config" . " SET config_name = 'notify', config_value = 'pm' WHERE config_name = 'pm_notify'"; $sql[] = "UPDATE " . $table_prefix . "linkdb_config" . " SET config_name = 'pagination' WHERE config_name = 'settings_link_page'"; // General $sql[] = "INSERT INTO " . $table_prefix . "linkdb_config VALUES ('enable_module', '0') "; $sql[] = "INSERT INTO " . $table_prefix . "linkdb_config VALUES ('module_name', 'Download Database') "; $sql[] = "INSERT INTO " . $table_prefix . "linkdb_config VALUES ('wysiwyg_path', 'mx_mod/mx_shared/') "; // Appearance $sql[] = "INSERT INTO " . $table_prefix . "linkdb_config VALUES ('use_simple_navigation', '1') "; $sql[] = "INSERT INTO " . $table_prefix . "linkdb_config VALUES ('settings_newdays', '1') "; // Comments $sql[] = "INSERT INTO " . $table_prefix . "linkdb_config VALUES ('use_comments', '0') "; // comments_show $sql[] = "INSERT INTO " . $table_prefix . "linkdb_config VALUES ('internal_comments', '1') "; // NEW $sql[] = "INSERT INTO " . $table_prefix . "linkdb_config VALUES ('formatting_comment_wordwrap', '1') "; // formatting_comment_fixup $sql[] = "INSERT INTO " . $table_prefix . "linkdb_config VALUES ('formatting_comment_image_resize', '300') "; // NEW $sql[] = "INSERT INTO " . $table_prefix . "linkdb_config VALUES ('formatting_comment_truncate_links', '1') "; // NEW $sql[] = "INSERT INTO " . $table_prefix . "linkdb_config VALUES ('max_comment_subject_chars', '50') "; // NEW $sql[] = "INSERT INTO " . $table_prefix . "linkdb_config VALUES ('max_comment_chars', '5000') "; $sql[] = "INSERT INTO " . $table_prefix . "linkdb_config VALUES ('allow_comment_wysiwyg', '0') "; // allow_wysiwyg_comments & allow_wysiwyg $sql[] = "INSERT INTO " . $table_prefix . "linkdb_config VALUES ('allow_comment_html', '1') "; $sql[] = "INSERT INTO " . $table_prefix . "linkdb_config VALUES ('allow_comment_bbcode', '1') "; $sql[] = "INSERT INTO " . $table_prefix . "linkdb_config VALUES ('allow_comment_smilies', '1') "; $sql[] = "INSERT INTO " . $table_prefix . "linkdb_config VALUES ('allow_comment_links', '1') "; $sql[] = "INSERT INTO " . $table_prefix . "linkdb_config VALUES ('allow_comment_images', '0') "; $sql[] = "INSERT INTO " . $table_prefix . "linkdb_config VALUES ('no_comment_image_message', '[No image please]') "; $sql[] = "INSERT INTO " . $table_prefix . "linkdb_config VALUES ('no_comment_link_message', '[No links please]') "; $sql[] = "INSERT INTO " . $table_prefix . "linkdb_config VALUES ('allowed_comment_html_tags', 'b,i,u,a') "; // NEW $sql[] = "INSERT INTO " . $table_prefix . "linkdb_config VALUES ('del_topic', '1') "; // NEW $sql[] = "INSERT INTO " . $table_prefix . "linkdb_config VALUES ('autogenerate_comments', '1') "; // NEW $sql[] = "INSERT INTO " . $table_prefix . "linkdb_config VALUES ('comments_pagination', '5') "; $sql[] = "INSERT INTO " . $table_prefix . "linkdb_config VALUES ('comments_forum_id', '1') "; // New $sql[] = "INSERT INTO " . $table_prefix . "linkdb_config VALUES ('show_pretext', '0') "; // NEW $sql[] = "INSERT INTO " . $table_prefix . "linkdb_config VALUES ('pt_header', 'Link Submission Instructions') "; // NEW $sql[] = "INSERT INTO " . $table_prefix . "linkdb_config values ('pt_body', 'Please check your references and include as much information as you can.') "; // NEW // Ratings $sql[] = "INSERT INTO " . $table_prefix . "linkdb_config VALUES ('use_ratings', '0') "; $sql[] = "INSERT INTO " . $table_prefix . "linkdb_config VALUES ('votes_check_userid', '1') "; $sql[] = "INSERT INTO " . $table_prefix . "linkdb_config VALUES ('votes_check_ip', '1') "; // // Comments // // -------------------------------------------------------- // Table structure for table `phpbb_pa_comments` $sql[] = "CREATE TABLE " . $table_prefix . "linkdb_comments ( comments_id int(10) NOT NULL auto_increment, link_id int(10) NOT NULL default '0', comments_text text NOT NULL, comments_title text NOT NULL, comments_time int(50) NOT NULL default '0', comment_bbcode_uid varchar(10) default NULL, poster_id mediumint(8) NOT NULL default '0', PRIMARY KEY (comments_id), KEY comments_id (comments_id), FULLTEXT KEY comment_bbcode_uid (comment_bbcode_uid) )"; } else { $message .= "<b>Nothing to upgrade...</b><br/><br/>"; } $message .= mx_do_install_upgrade( $sql ); // // Empty module cache // //include_once( $phpbb_root_path . 'mx_mod/functions_tools.' . $phpEx ); //$module_cache = new module_cache($phpbb_root_path . 'linkdb/'); //$module_cache->tidy(); //$module_cache->save(); } echo "<br /><br />"; echo "<table width=\"90%\" align=\"center\" cellpadding=\"4\" cellspacing=\"1\" border=\"0\" class=\"forumline\">"; echo "<tr><th class=\"thHead\" align=\"center\">Mod Installation/Upgrading/Uninstalling Information - mod specific db tables</th></tr>"; echo "<tr><td class=\"row1\" align=\"left\"><span class=\"gen\">" . $message . "</span></td></tr>"; echo "</table><br />"; include($phpbb_root_path . 'includes/page_tail.'.$phpEx); ?> --- NEW FILE: linkdb_uninstall.php --- <?php /** * * @package phpBB2 Mod - pafileDB * @version $Id: linkdb_uninstall.php,v 1.1.2.1 2008/03/08 15:32:38 orynider Exp $ * @copyright (c) 2002-2006 [Jon Ohlsson, Mohd Basri, wGEric, PHP Arena, pafileDB, CRLin] mxBB Project Team * @license http://opensource.org/licenses/gpl-license.php GNU General Public License v2 * */ $phpEx = substr(strrchr(__FILE__, '.'), 1); if ( !defined('PORTAL_BACKEND') && @file_exists( './viewtopic.' . $phpEx ) ) // -------------------------------------------- phpBB MOD MODE { define( 'MXBB_MODULE', false ); define( 'IN_PHPBB', true ); $phpbb_root_path = $module_root_path = './'; $mx_mod_path = $phpbb_root_path . 'mx_mod/'; include($phpbb_root_path . 'common.' . $phpEx); include($mx_mod_path . "includes/functions_required.$phpEx"); //Check if forum_hack is installed if (!isset($mx_root_path)) { $mx_root_path = './'; @define('IN_PORTAL', true); include_once($mx_mod_path . "includes/mx_constants.$phpEx"); include_once($mx_mod_path . "includes/shared/phpbb2/includes/functions.$phpEx"); } else { @define('IN_PORTAL', true); include_once($mx_root_path . "includes/mx_constants.$phpEx"); include_once($mx_root_path . "includes/shared/phpbb2/includes/functions.$phpEx"); } require($mx_mod_path . "includes/functions_core.$phpEx"); require($mx_mod_path . "includes/functions_styles.$phpEx"); //Check for cash mod if (file_exists($phpbb_root_path . 'includes/functions_cash.'.$phpEx)) { define('IN_CASHMOD', true); } //@ini_set( 'display_errors', '1' ); error_reporting (E_ERROR | E_WARNING | E_PARSE); // This will NOT report uninitialized variables //error_reporting(E_ALL & ~E_NOTICE); define( 'PAGE_KB', -502 ); // If this id generates a conflict with other mods, change it ;) // // Instatiate the mx_cache class // $mx_cache = new mx_cache(); // // Get mxBB config settings // //$portal_config = $mx_cache->obtain_mxbb_config(); // // instatiate the mx_request_vars class // $mx_request_vars = new mx_request_vars(); // // Page selector // $page_id = $mx_request_vars->request('page', MX_TYPE_INT, 1); $is_block = false; // // instatiate the mx_user class // $mx_user = new mx_user(); if (file_exists("./modcp.$phpEx")) // phpBB2 { define('PORTAL_BACKEND', 'phpbb2'); $tplEx = 'tpl'; // // Start user session // - populate $userdata and $lang // $mx_user->init($user_ip, $page_id, false); init_userprefs($userdata); $mx_user->set_module_default_style('prosilver'); // For compatibility with core 2.8.x if (!$userdata['user_level'] == ADMIN) { die('Only admins may run this script!!!'); } } else if (@file_exists("./mcp.$phpEx")) // phpBB3 { define('PORTAL_BACKEND', 'phpbb3'); $tplEx = 'html'; // // Start user session // - populate $userdata and $lang // $mx_user->init($user_ip, $page_id, false); $user->setup(); // // End session management // $mx_user->set_module_default_style('prosilver'); // For compatibility with core 2.8.x if ($userdata['user_type'] != USER_FOUNDER) { die('Only admins may run this script!!!'); } } else { die('Copy this file in phpbb_root_path were is your viewtopic.php file!!!'); } } else // --------------------------------------------------------------------------------- mxBB Module MODE { define( 'MXBB_MODULE', true ); if ( !function_exists( 'read_block_config' ) ) { define( 'IN_PORTAL', true ); $mx_root_path = './../../'; $module_root_path = './'; $phpEx = substr(strrchr(__FILE__, '.'), 1); include_once( $mx_root_path . 'common.' . $phpEx ); // Start session management $mx_user->init($user_ip, PAGE_INDEX); // End session management define( 'MXBB_27x', file_exists( $mx_root_path . 'mx_login.' . $phpEx ) ); } else { if( !defined('IN_PORTAL') || !is_object($mx_block)) { die("Hacking attempt"); } // // Read Block Settings (default mode) // $title = !empty( $mx_block->block_info['block_title'] ) ? $mx_block->block_info['block_title'] : $lang['KB_title']; $desc = $mx_block->block_info['block_desc']; $block_size = ( isset( $block_size ) && !empty( $block_size ) ? $block_size : '100%' ); //Check for cash mod if (file_exists($phpbb_root_path . 'includes/functions_cash.'.$phpEx)) { define('IN_CASHMOD', true); } $is_block = true; global $images; } define( 'MXBB_27x', @file_exists( $mx_root_path . 'mx_login.'.$phpEx ) ); } // // Check if mx_common Mod is prezent // if (!file_exists($mx_mod_path . "includes/functions_admincp.$phpEx")) { die('mx mod is not uploaded!!!'); } else { require($mx_mod_path . "includes/functions_admincp.$phpEx"); } $page_title = 'Uninstalling linkDB'; include($phpbb_root_path . 'includes/page_header.'.$phpEx); $sql = array( "DROP TABLE " . $table_prefix . "linkdb_categories ", "DROP TABLE " . $table_prefix . "linkdb ", "DROP TABLE " . $table_prefix . "linkdb_config ", "DROP TABLE " . $table_prefix . "linkdb_custom ", "DROP TABLE " . $table_prefix . "linkdb_customdata ", "DROP TABLE " . $table_prefix . "linkdb_votes ", "DROP TABLE " . $table_prefix . "linkdb_comments ", ); echo "<br /><br />"; echo "<table width=\"90%\" align=\"center\" cellpadding=\"4\" cellspacing=\"1\" border=\"0\" class=\"forumline\">"; echo "<tr><th class=\"thHead\" align=\"center\">Mod Installation/Upgrading/Uninstalling Information - mod specific db tables</th></tr>"; echo "<tr><td class=\"row1\" align=\"left\"><span class=\"gen\">" . mx_do_install_upgrade( $sql ) . "</span></td></tr>"; echo "</table><br />"; include($phpbb_root_path . 'includes/page_tail.'.$phpEx); ?> Index: linkdb.php =================================================================== RCS file: /cvsroot/mxbb/mx_linkdb/linkdb.php,v retrieving revision 1.13.2.2 retrieving revision 1.13.2.3 diff -C2 -d -r1.13.2.2 -r1.13.2.3 *** linkdb.php 15 Feb 2008 23:52:24 -0000 1.13.2.2 --- linkdb.php 8 Mar 2008 15:32:35 -0000 1.13.2.3 *************** *** 13,26 **** if ( !defined('PORTAL_BACKEND') && @file_exists( './viewtopic.' . $phpEx ) ) // -------------------------------------------- phpBB MOD MODE { ! define( 'MXBB_MODULE', false ); ! define( 'IN_PHPBB', true ); ! define( 'IN_PORTAL', true ); ! define( 'IN_DOWNLOAD', true ); ! define( 'IN_LINKS', true ); ! ! // When run as a phpBB mod these paths are identical ;) ! $phpbb_root_path = $module_root_path = $mx_root_path = './'; $mx_mod_path = $phpbb_root_path . 'mx_mod/'; //Check for cash mod if (file_exists($phpbb_root_path . 'includes/functions_cash.'.$phpEx)) --- 13,46 ---- if ( !defined('PORTAL_BACKEND') && @file_exists( './viewtopic.' . $phpEx ) ) // -------------------------------------------- phpBB MOD MODE { ! define('MXBB_MODULE', false); ! define('IN_PHPBB', true); ! ! $phpbb_root_path = $module_root_path = './'; $mx_mod_path = $phpbb_root_path . 'mx_mod/'; + + include($phpbb_root_path . 'common.' . $phpEx); + include($mx_mod_path . "includes/functions_required.$phpEx"); + + //Check if forum_hack is installed + if (!isset($mx_root_path)) + { + $mx_root_path = './'; + @define('IN_PORTAL', true); + include_once($mx_mod_path . "includes/mx_constants.$phpEx"); + include_once($mx_mod_path . "includes/shared/phpbb2/includes/functions.$phpEx"); + } + else + { + @define('IN_PORTAL', true); + include_once($mx_root_path . "includes/mx_constants.$phpEx"); + include_once($mx_root_path . "includes/shared/phpbb2/includes/functions.$phpEx"); + //Redefine mx_root_path to include phpbb page_tail.php + $mx_root_path = $phpbb_root_path; + } + + require($mx_mod_path . "includes/functions_core.$phpEx"); + require($mx_mod_path . "includes/functions_styles.$phpEx"); + //Check for cash mod if (file_exists($phpbb_root_path . 'includes/functions_cash.'.$phpEx)) *************** *** 29,41 **** } ! include( $phpbb_root_path . 'common.' . $phpEx ); ! ! @ini_set( 'display_errors', '1' ); error_reporting (E_ERROR | E_WARNING | E_PARSE); // This will NOT report uninitialized variables ! include_once( $mx_mod_path . 'includes/functions_required.' . $phpEx ); ! include_once( $mx_mod_path . 'includes/functions_core.' . $phpEx ); ! ! define( 'PAGE_LINKS', -502 ); // If this id generates a conflict with other mods, change it ;) // --- 49,57 ---- } ! //@ini_set( 'display_errors', '1' ); error_reporting (E_ERROR | E_WARNING | E_PARSE); // This will NOT report uninitialized variables + //error_reporting(E_ALL & ~E_NOTICE); ! define( 'PAGE_KB', -502 ); // If this id generates a conflict with other mods, change it ;) // *************** *** 43,51 **** // $mx_cache = new mx_cache(); ! // // Get mxBB config settings // ! $portal_config = $mx_cache->obtain_mxbb_config(); // --- 59,67 ---- // $mx_cache = new mx_cache(); ! // // Get mxBB config settings // ! //$portal_config = $mx_cache->obtain_mxbb_config(); // *************** *** 53,87 **** // $mx_request_vars = new mx_request_vars(); $is_block = false; ! if ( file_exists("./modcp.$phpEx") ) // phpBB2 { define('PORTAL_BACKEND', 'phpbb2'); $tplEx = 'tpl'; ! include_once( $phpbb_root_path . 'includes/bbcode.' . $phpEx ); ! include_once( $phpbb_root_path . 'includes/functions_post.' . $phpEx ); ! ! // Start session management ! $userdata = session_pagestart( $user_ip, PAGE_DOWNLOAD ); ! init_userprefs( $userdata ); ! // End session management ! ! } ! else if ( @file_exists("./mcp.$phpEx") ) // phpBB3 { define('PORTAL_BACKEND', 'phpbb3'); $tplEx = 'html'; ! ! //include_once( $mx_mod_path . 'includes/shared/phpbb2/includes/bbcode.' . $phpEx ); ! //include_once( $mx_mod_path . 'includes/shared/phpbb2/includes/functions_post.' . $phpEx ); ! // ! // Start session management // ! $user->session_begin(); ! $userdata = $user->data; $user->setup(); // --- 69,119 ---- // $mx_request_vars = new mx_request_vars(); + + // + // Page selector + // + $page_id = $mx_request_vars->request('page', MX_TYPE_INT, 1); $is_block = false; + + // + // instatiate the mx_user class + // + $mx_user = new mx_user(); ! if (file_exists("./modcp.$phpEx")) // phpBB2 { define('PORTAL_BACKEND', 'phpbb2'); $tplEx = 'tpl'; + + // + // Start user session + // - populate $userdata and $lang + // + $mx_user->init($user_ip, $page_id, false); + //init_userprefs($userdata); + $mx_user->init_style(); //Overwrite template class ! /* ! $mx_user->set_module_default_style('_core'); // For compatibility with core 2.8.x ! if (!$userdata['user_level'] == ADMIN) ! { ! die('Only admins may run this script!!!'); ! } ! */ ! include_once($phpbb_root_path . 'includes/bbcode.' . $phpEx); ! include_once($phpbb_root_path . 'includes/functions_post.' . $phpEx); ! } ! else if (@file_exists("./mcp.$phpEx")) // phpBB3 { define('PORTAL_BACKEND', 'phpbb3'); $tplEx = 'html'; ! // ! // Start user session ! // - populate $userdata and $lang // ! $mx_user->init($user_ip, $page_id, false); $user->setup(); // *************** *** 89,96 **** // ! // ! // Get phpBB config settings ! // ! $board_config = $config; } else --- 121,133 ---- // ! /* ! $mx_user->set_module_default_style('_core'); // For compatibility with core 2.8.x ! if ($userdata['user_type'] != USER_FOUNDER) ! { ! die('Only admins may run this script!!!'); ! } ! */ ! include_once($mx_mod_path . "includes/shared/phpbb2/includes/bbcode.$phpEx"); ! include_once($mx_mod_path . "includes/shared/phpbb2/includes/functions_post.$phpEx"); } else *************** *** 146,159 **** $block_size = ( isset( $block_size ) && !empty( $block_size ) ? $block_size : '100%' ); - //Check for cash mod - if (file_exists($phpbb_root_path . 'includes/functions_cash.'.$phpEx)) - { - define('IN_CASHMOD', true); - } - $is_block = true; global $images; } ! define( 'MXBB_27x', @file_exists( $mx_root_path . 'mx_login.'.$phpEx ) ); } --- 183,190 ---- $block_size = ( isset( $block_size ) && !empty( $block_size ) ? $block_size : '100%' ); $is_block = true; global $images; } ! define( 'MXBB_27x', file_exists( $mx_root_path . 'mx_login.php' ) ); } *************** *** 178,196 **** // Get action variable other wise set it to the main // ! $action = $mx_request_vars->request('action', MX_TYPE_NO_TAGS, 'main'); // =================================================== // Is admin? // =================================================== ! switch (PORTAL_BACKEND) ! { ! case 'internal': ! case 'phpbb2': ! $is_admin = ( ( $userdata['user_level'] == ADMIN ) && $userdata['session_logged_in'] ) ? true : 0; ! break; ! case 'phpbb3': ! $is_admin = ( $userdata['user_type'] == USER_FOUNDER ) ? true : 0; ! break; ! } // =================================================== --- 209,218 ---- // Get action variable other wise set it to the main // ! $action = ( isset( $_REQUEST['action'] ) ) ? htmlspecialchars( $_REQUEST['action'] ) : 'main'; // =================================================== // Is admin? // =================================================== ! $is_admin = ( ( $userdata['user_level'] == ADMIN ) && $userdata['session_logged_in'] ) ? true : 0; // =================================================== |