All pastes #1299463 Raw Edit

line number

public php v1 · immutable
#1299463 ·published 2009-01-04 07:16 UTC
rendered paste body
<?php//-----------------// Bump Me Up//-----------------define( 'IPB_THIS_SCRIPT', '' );require_once( 'init.php' );$INFO = array();//--------------------------------// Require our global functions//--------------------------------require_once ROOT_PATH   . "sources/ipsclass.php";require_once ROOT_PATH   . "sources/classes/class_display.php";require_once ROOT_PATH   . "sources/classes/class_session.php";require_once ROOT_PATH   . "sources/classes/class_forums.php";require_once ROOT_PATH   . "conf_global.php";# Initiate super-class$ipsclass       = new ipsclass();$ipsclass->vars = $INFO;//--------------------------------// The clocks a' tickin'//--------------------------------		$Debug = new Debug;$Debug->startTimer();//--------------------------------// Load the DB driver and such//--------------------------------$ipsclass->init_db_connection();//--------------------------------//  Set up our vars//--------------------------------$ipsclass->parse_incoming();//--------------------------------// Set debug mode//--------------------------------$ipsclass->DB->set_debug_mode( $ipsclass->vars['sql_debug'] == 1 ? intval($_GET['debug']) : 0 );//--------------------------------//  Initialize the FUNC//--------------------------------$ipsclass->initiate_ipsclass();//===========================================================================// START THE MAGIC...//===========================================================================	$message = '';	//insert Bump Me Up settings group	$result = $ipsclass->DB->query("SELECT * FROM `" . $INFO['sql_tbl_prefix'] . "conf_settings_titles` WHERE conf_title_title = 'Bump Me Up'");	if ($ipsclass->DB->get_num_rows($result) > 0) {		$message .= '- Bump Me Up settings group already exists<br />';	} else {		$ipsclass->DB->query("INSERT INTO `" . $INFO['sql_tbl_prefix'] . "conf_settings_titles` VALUES ( NULL , 'Bump Me Up', 'Bump Me Up Settings', 6, 0, 'bump_me_up', '');");		$message .= '- Bump Me Up settings group inserted<br />';		}		//get the id of the Bump Me Up settings group	$result = $ipsclass->DB->query("SELECT conf_title_id FROM `" . $INFO['sql_tbl_prefix'] . "conf_settings_titles` WHERE conf_title_title = 'Bump Me Up'");	$row = $ipsclass->DB->fetch_row($result);	$group_id = $row['conf_title_id'];		//insert Bump Me Up settings in to the group	$result = $ipsclass->DB->query("SELECT * FROM " . $INFO['sql_tbl_prefix'] . "conf_settings WHERE conf_title = 'Bump Me Up' OR conf_title = 'Bump page' OR conf_title = 'Start Date' OR conf_title = 'Recache forums' OR conf_title = 'Mark topic read' OR conf_title = 'Closed topics'");	if ($ipsclass->DB->get_num_rows($result) > 0) {		$message .= '- Bump Me Up settings already exists<br />';	} else {		$ipsclass->DB->query("INSERT INTO `" . $INFO['sql_tbl_prefix'] . "conf_settings` (conf_title,conf_description,conf_group,conf_type,conf_key,conf_value,conf_default,conf_extra,conf_evalphp,conf_protected,conf_position,conf_start_group,conf_end_group,conf_add_cache) VALUES ( 'Bump Me Up', 'Do you want to enable this mod ?', '{$group_id}', 'yes_no', 'bump_enable', '0' , '0' , NULL , NULL , 1, 0, '', '0', '1');");		$ipsclass->DB->query("INSERT INTO `" . $INFO['sql_tbl_prefix'] . "conf_settings` (conf_title,conf_description,conf_group,conf_type,conf_key,conf_value,conf_default,conf_extra,conf_evalphp,conf_protected,conf_position,conf_start_group,conf_end_group,conf_add_cache) VALUES ( 'Bump page', 'To which page do you want to be redirected after bumping a topic ?', '{$group_id}', 'dropdown', 'bump_redirect_page', '0' , '0' , '2=Bumped topic\r\n1=Forum index\r\n0=Board index' , NULL , 1, 1, '', '0', '1');");		$ipsclass->DB->query("INSERT INTO `" . $INFO['sql_tbl_prefix'] . "conf_settings` (conf_title,conf_description,conf_group,conf_type,conf_key,conf_value,conf_default,conf_extra,conf_evalphp,conf_protected,conf_position,conf_start_group,conf_end_group,conf_add_cache) VALUES ( 'Start date', 'Should the start date of the bumped topic be changed when bumping ?', '{$group_id}', 'yes_no', 'bump_start_date', '0' , '0' , NULL , NULL , 1, 2, '', '0', '1');");		$ipsclass->DB->query("INSERT INTO `" . $INFO['sql_tbl_prefix'] . "conf_settings` (conf_title,conf_description,conf_group,conf_type,conf_key,conf_value,conf_default,conf_extra,conf_evalphp,conf_protected,conf_position,conf_start_group,conf_end_group,conf_add_cache) VALUES ( 'Recache forums', 'Do you want to recache the forums after a bump (needed to update the forum index) ?', '{$group_id}', 'yes_no', 'bump_recache_forums', '0' , '0' , NULL , NULL , 1, 3, '', '0', '1');");		$ipsclass->DB->query("INSERT INTO `" . $INFO['sql_tbl_prefix'] . "conf_settings` (conf_title,conf_description,conf_group,conf_type,conf_key,conf_value,conf_default,conf_extra,conf_evalphp,conf_protected,conf_position,conf_start_group,conf_end_group,conf_add_cache) VALUES ( 'Mark topic read', 'Do you want to mark the bumped topic as read ?', '{$group_id}', 'yes_no', 'bump_mark_read', '0' , '0' , NULL , NULL , 1, 4, '', '0', '1');");		$ipsclass->DB->query("INSERT INTO `" . $INFO['sql_tbl_prefix'] . "conf_settings` (conf_title,conf_description,conf_group,conf_type,conf_key,conf_value,conf_default,conf_extra,conf_evalphp,conf_protected,conf_position,conf_start_group,conf_end_group,conf_add_cache) VALUES ( 'Closed topics', 'Allow locked topics to be bumped ?', '{$group_id}', 'yes_no', 'bump_closed', '0' , '0' , NULL , NULL , 1, 5, '', '0', '1');");		$message .= '- Bump Me Up settings inserted to group<br />';	}		//alter group table for Bump permissions	$query = mysql_query("SHOW COLUMNS FROM `" . $INFO['sql_tbl_prefix'] . "groups` LIKE 'g_bump_%'") or die(mysql_error());	if (mysql_num_rows($query) == 0) {  		$ipsclass->DB->query("ALTER TABLE `" . $INFO['sql_tbl_prefix'] . "groups` ADD `g_bump_others` TINYINT( 1 ) NOT NULL , 							ADD `g_bump_interval` INT( 10 ) NOT NULL , 							ADD `g_bump_forums` TEXT , 							ADD `g_bump_enable` TINYINT( 1 ) NOT NULL");		$message .= '- Bump Me Up settings for groups inserted<br />';	} else {		$message .= '- Bump Me Up settings for groups already exists<br />';	}		//alter member table for Bump permissions	$query = mysql_query("SHOW COLUMNS FROM `" . $INFO['sql_tbl_prefix'] . "members` LIKE 'last_bump'") or die(mysql_error());	if (mysql_num_rows($query) == 0) {    		$ipsclass->DB->query("ALTER TABLE `" . $INFO['sql_tbl_prefix'] . "members` ADD `last_bump` INT( 10 ) NOT NULL");		$message .= '- Bump Me Up settings for members inserted<br />';	} else {	    $message .= '- Bump Me Up settings for members already exists<br />';	} 		//add message that we are done	$message .= '<br />The installer has done all needed database changes.<br />Please remove this file from your ipb installation';		//print message and that's a wrap!	echo "<html>\n<head>\n<title>Bump Me Up Installation</title>\n</head>\n<body>\n";	echo "<table style='border: 1px solid rgb(0, 0, 0); width: 70%; background-color: rgb(230, 233, 238);text-align:center;'>\n<tbody>\n<tr>\n<td>\n";	echo $message;	echo "</td>\n</tr>\n</tbody>\n</table><br />";	echo "\n</body>\n</html>";						?>