Forum PHPBoost

   Le 08/12/10 à 08h56 Citer      

Booster Minigun

Groupe: Membre

Inscrit le: 25/11/10
Messages: 25
Bonjour à tous,

Bien que je trouve le calendrier Phpboost très bien fait, il ne correspond pas vraiment à mes besoins car gérant une guilde MMO, j'ai besoin que les membres puissent s'inscrire à des sorties.

En cherchant donc sur le net je suis tombé sur un calendrier super pratique et déja tout fait en php : PHPRAID.
Je l'ai installé pour le tester, et il marche vraiment très bien et correspond à ce que je souhaite.

Mais le soucis, c'est qu'il demande une authentification alternative à celle de phpboost. Et ça, ça m'embête...
En fouillant un peu, j'ai vu qu'on pouvait personnaliser l'authentification pour qu'il n'y en ait qu'une seule avec les CMS les plus connus (phpbb, joomla).
Cela correspond juste à 3 fichiers à modifier/adapter.

Je me demandais donc si une ame charitable voulait bien m'aider à adapter ces 3 fichiers pour phpboost.

Merci encore.

Pour le DL de l'archive : phpRaider_v1[1].0.10.zip

Et voici les 3 fichiers qu'il faudrait modifier pour fusionner l'authentification. (j'ai mis en exemple ceux de phpbb3, mais il y en a d'autres dans l'archive)

INSTALL.php
Caché:
Code PHP :
<?php
// SECURITY MEASURE DO NOT REMOVE!!
defined('_VALID_SETUP') or die('Restricted Access');
 
include(RAIDER_BASE_PATH.'authentication'.DIRECTORY_SEPARATOR.'phpbb3'.DIRECTORY_SEPARATOR.'phpbb3.configure.php');
include(RAIDER_BASE_PATH.'configuration.php');
 
// add to database
$link = mysql_connect($pConfig['db_server'], $pConfig['db_user'], $pConfig['db_pass']);
 
if(!$link) {
	$output .= '<font color=red>Unable to connect to database.</font><br>';
	$error = 1;
}
 
if(!mysql_select_db($pConfig['db_name']))
	$output .= '<font color=red>Unable to select database.</font><br>';
else
	$output .= '<font color=green>Database selected.</font><br>';
 
$result = mysql_query("SELECT * FROM {$pConfig['db_prefix']}profile");
$count = mysql_num_rows($result);
 
// setup output
$output = '<form method="post" action="install.php?option='.$i.'">';
 
if($count == 0)
	$output .= '<strong>THE FIRST USER TO VISIT PHPRAIDER AFTER LOGGING INTO THE FORUMS WILL BE SET AS AN ADMINISTRATOR!!!</strong><br><br>';
 
// each field for configuration
$output .= "<div class=contentHeader>Setup Authentication Method</div><br>
				<div class=contentBody>
					<div align=center>
						<table width=100% cellpadding=3 cellspacing=1 border=0>";
 
for($j=0; $j<count($auth_option); $j++) {
	if(empty($_POST[$auth_option[$j]['variable']])) {
		$name = $auth_option[$j]['text'];
	} else {
		$name = $_POST[$auth_option[$j]['variable']];
	}
 
	$output .= '<tr>
					<td width="30%" valign="top"><div align="right"><strong>'.$auth_option[$j]['text'].':</strong><br>'.$auth_option[$j]['description'].'</div></td>
					<td width="70%" valign="top">
						<div align="left">
							<input type="text" name="'.$auth_option[$j]['variable'].'" value="'.$auth_option[$j]['value'].'" class="post" style="width:200px">
						</div>
					</td>
				</tr>';
}
 
$output .= "</table></div><br></div><div align=center><br><input type=submit name=submit value=Submit class=mainoption></div>";
 
// introduction file
if($task == '') {
	if(empty($_POST)) {
		$p->assign($_POST);
		$p->assign('output', $output);
 
		// display form
		$p->display($option.'.tpl');
	} else {
		// add to database
		$link = mysql_connect($pConfig['db_server'], $pConfig['db_user'], $pConfig['db_pass']);
 
		if(!$link) {
			$output .= '<font color=red>Unable to connect to database.</font><br>';
			$error = 1;
		}
 
		if(!mysql_select_db($pConfig['db_name']))
			$output .= '<font color=red>Unable to select database.</font><br>';
		else
			$output .= '<font color=green>Database selected.</font><br>';
 
		// do the auth options
		for($j=0;$j<count($auth_option);$j++) {
			$sql = sprintf("INSERT INTO %sconfig_auth"
				. "\n (`name`, `value`)"
				. "\n VALUES ('%s','%s');"
				,$pConfig['db_prefix'],$auth_option[$j]['variable'],(get_magic_quotes_gpc())?$_POST[$auth_option[$j]['variable']]:addslashes($_POST[$auth_option[$j]['variable']]));
			mysql_query($sql) or die(mysql_error());
		}
 
		// do the auth required
		foreach($auth_default as $key=>$value) {
			$sql = sprintf("INSERT INTO %sconfig_auth"
				. "\n (`name`, `value`)"
				. "\n  VALUES ('%s','%s');"
				,$pConfig['db_prefix'],$key,$value);
			mysql_query($sql) or die(mysql_error());
		}
 
		mysql_close($link);
 
		header('Location: install.php?option='.$next_option);
		exit;
	}
} else {
	printError($pLang['invalidOption']);
}
?>



CONFIGURE.php
Caché:
Code PHP :
<?php
	// options for the user to change
	// users will have control over these variables
	$auth_option = array(
						array(
							'text'=>'Registration URL',
							'description'=>'URL of register file',
							'variable'=>'register_url',
							'value'=>'http://'.$_SERVER['HTTP_HOST'].'/phpbb3/ucp.php?mode=register'),
						array(
							'text'=>'phpBB Path',
							'description'=>'Path to your installed phpBB3 forum, including trailing slash!',
							'variable'=>'phpbb_path',
							'value'=>RAIDER_BASE_PATH.'phpBB3'.DIRECTORY_SEPARATOR),
						array(
							'text'=>'phpBB URL',
							'description'=>'Including trailing slash!',
							'variable'=>'phpbb_url',
							'value'=>'http://'.$_SERVER['HTTP_HOST'].'/phpbb3/'),
					);
 
	// hard coded options specific to the login script
	// users will not have control over these variables
	$auth_default = array(
						'use_login'=>0
					);
?>


et FUNCTIONS.php
Caché:
Code PHP :
<?php
/***************************************************************************
 *                                 auth_phpbb3.php
 *                            -------------------
 *   begin                : June 6, 2007
 *   copyright            : (C) 2005 Kyle Spraggs - mod for phpBB3 keldrak@gmail.com
 *   email                : spiffyjr@gmail.com
 *
 ***************************************************************************/
 
/***************************************************************************
 *
 *   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.
 *
 ***************************************************************************/
 
// no direct access
defined('_VALID_RAID') or die('Restricted Access');
 
// check profile
// Specific to phpBB authentication only. Checks to see if a profile exists
// for phpBB user and if not, creates one.
function pVerify($user) {
	global $db_raid, $pConfig, $pConfig_auth;
 
	$userdata = array();
 
	// Check that it's not an anonymous user or a bot that's authenticated by phpBB3
	if ($user->data['user_id'] != '1' && $user->data['is_registered'] == 1 && $user->data['username'] != 'Anonymous' && empty($user->data['is_bot'])) {
		$sql['SELECT'] = '*';
		$sql['FROM'] = 'profile';
		if (empty($pConfig_auth['phpbb_bridge_on_id'])) {
			$sql['WHERE'] = 'user_email = '.$db_raid->quote_smart(utf8_decode($user->data['user_email']));
		} else {
			$sql['WHERE'] = 'profile_id='.intval($user->data['user_id']);
		}
 
		$result = $db_raid->set_query('select', $sql, __FILE__, __LINE__);
		unset($sql);
 
		// if nothing returns we need to create profile
		// otherwise they have a profile so let's set their ID
		// we'll just use the phpBB user id as the profile ID to simplify things
		if(($db_raid->sql_numrows($result) == 0)) {
			// are they a super user?
			$sql['SELECT'] = '*';
			$sql['FROM'] = 'profile';
			$sql['WHERE'] = 'profile_id>0';
 
			$check = $db_raid->set_query('select', $sql, __FILE__, __LINE__);
 
			// nothing returned, create profile
			$sql['INSERT'] = 'profile';
			$sql['VALUES'] = array(
								'profile_id'=>$user->data['user_id'],
								'user_email'=>utf8_decode($user->data['user_email']),
								'password'=>'',
								'group_id'=>(($db_raid->sql_numrows($check) == 0)?1:$pConfig['default_group']),
								'username'=>utf8_decode($user->data['username']),
								'join_date'=>time());
			$db_raid->set_query('insert', $sql, __FILE__, __LINE__);
			$userdata['group_id'] = $sql['VALUES']['group_id'];
		} else {
			// profile exists set group
			$data = $db_raid->sql_fetchrow($result);
			$userdata['group_id'] = $data['group_id'];
		}
		// setup session information
		$userdata['profile_id'] = $user->data['user_id'];
		$userdata['session_logged_in'] = 1;
		$userdata['username'] = utf8_decode($user->data['username']);
		$userdata['user_email'] = utf8_decode($user->data['user_email']);
		$userdata['timezone'] = '';
		$userdata['dst'] = '';
	}
	return $userdata;
}
 
// login function for phpBB3
function pLogin()
{
	global $pConfig_auth;
 
	// redirect to phpbb3's login form, with a return to this page.
	header("Location: " . $pConfig_auth['phpbb_url'].'/ucp.php?mode=login&redirect='.$_SERVER['PHP_SELF']);
	exit;
}
 
// logout function for phpBB
function pLogout()
{
	global $user;
// unset the session and remove all cookies
	foreach($_SESSION as $key=>$value)
		unset($_SESSION[$key]);
 
//    phpbb3 session kill
	$user->session_kill();
}
 
// define our auth type
if( isset( $_GET["phpbb_root_path"] ) || isset( $_POST["phpbb_root_path"]) || isset($_GET['pConfig_auth[phpbb_path]']) || isset($_POST['pConfig_auth[phpbb_path]']) ) {
	log_hack();
	die('Hack attempt.');
} else {
	$phpbb_root_path = $pConfig_auth['phpbb_path'];
	$phpEx = substr(strrchr(__FILE__, '.'), 1);
 
	// setup phpBB user integration
	define('IN_PHPBB', true);
 
	include_once($pConfig_auth['phpbb_path'].'common.php');
 
	global $user_group_table;
	$user_group_table = $table_prefix . "user_group";
 
	// Start session management - phpBB3
	$user->session_begin();
	$auth->acl($user->data);
	$user->setup();
 
	// remove the phpbb3 template variable.
	unset($template);
	$db_raid->sql_query('SET NAMES DEFAULT');
	$db_raid->sql_query('SET SESSION sql_mode=DEFAULT');
 
	$pMain = new Mainframe(pVerify($user));
}
?>
 


Encore merci de votre aide.

pm    
   Le 12/09/11 à 21h39 Citer      

Booster Fuzil

Groupe: Membre

Inscrit le: 29/06/10
Messages: 50
t'as eu une une réponse ?

pm    
   Le 13/09/11 à 08h40 Citer      

Modérateur

Equipe Rédaction
Equipe Modération

Sexe:
Inscrit le: 13/03/10
Messages: 1086
Lieu: Proche de Perpi...
Bin si tu es le premier à répondre, je doute qu'il y est eut une réponse à son soucis...
____________________
Mon ptit site

pm http://www.trains-et-trainz.fr    
Répondre
Vous n'êtes pas autorisé à écrire dans cette catégorie
Annonces