Помощ за интеграцията на код :(

PHP, MySQL, Javascript, XHTML и др.

Модератор: Екип Програмиране

Отговори
Потребителски аватар

Автор на темата
Nixe ss
Рекламатор
Рекламатор
Мнения: 84
Регистриран: 07 дек 2017, 03:57

Помощ за интеграцията на код :(

Мнение от Nixe ss » 09 яну 2018, 21:59

Здравейте, как мога да променя този код без да бъгна нещо като казвам да променя имам предвид да променя интеграционния код за 3.1 форумна система !

Взимам това!

Код: Избери всички

define('IN_PHPBB', true);
		$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : $forum_path;
		$phpEx = substr(strrchr(__FILE__, '.'), 1);
		include($phpbb_root_path . 'common.' . $phpEx);
		include($phpbb_root_path . 'includes/functions_display.' . $phpEx);
		include($phpbb_root_path . 'includes/functions_user.' . $phpEx);
		$user->session_begin();
		$auth->acl($user->data);
		$user->setup('viewforum');
		$request->enable_super_globals();
От

Код: Избери всички

<?php
switch ($phpbb_version) {
	case '3.1': {
		
		define('IN_PHPBB', true);
		$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : $forum_path;
		$phpEx = substr(strrchr(__FILE__, '.'), 1);
		include($phpbb_root_path . 'common.' . $phpEx);
		include($phpbb_root_path . 'includes/functions_display.' . $phpEx);
		include($phpbb_root_path . 'includes/functions_user.' . $phpEx);
		$user->session_begin();
		$auth->acl($user->data);
		$user->setup('viewforum');
		$request->enable_super_globals();
		
		//we need it for db connection
		include($forum_path.'config.php');
		$bb_db = $dbname;
		$bb_prefix = preg_replace("/[^A-Za-z0-9 ]/", '', $table_prefix);
		
		break;
	}
	case '3.0': {
		define('IN_PHPBB', true); 
		$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : $forum_path; 
		$phpEx = substr(strrchr(__FILE__, '.'), 1); 
		include($phpbb_root_path . 'common.' . $phpEx); 
		include($phpbb_root_path . 'includes/functions_display.' . $phpEx);
		include($phpbb_root_path . 'includes/functions_user.' . $phpEx);
		$user->session_begin();
		$auth->acl($user->data);
		$user->setup('viewtopic');
		
		//we need it for db connection
		include($forum_path.'config.php');
		$bb_db = $dbname;
		$bb_prefix = preg_replace("/[^A-Za-z0-9 ]/", '', $table_prefix);
		
		break;
	}
	
}
Заменям кода която съм дал горе с този!

Код: Избери всички

DEFINE('IN_PHPBB', true);
$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './forum/'; // На мястото на "forum" напишете пътя до вашият  форум (името на папката). Ако тя е "forum" оставете кода така!
$phpEx = substr(strrchr(__FILE__, '.'), 1);
require_once ($phpbb_root_path . 'common.' . $phpEx);
$user->session_begin();
$auth->acl($user->data);
$user->setup();
Която се намира в index.php

Код: Избери всички

<?php
/*
* Продукт на CS-4X4.COM
* Система от CS-4X4 - www.cs-4x4.com
* Версия: 1.1
* Автор: sed1
* Контакти: Skype:danito19955
* Системата е завършена на: 100%
* Извършени проверки: Да
*/

// PHPBB3 интеграция
header('Content-Type: text/html; charset=UTF-8');
DEFINE('IN_PHPBB', true);
$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './forum/'; // На мястото на "forum" напишете пътя до вашият  форум (името на папката). Ако тя е "forum" оставете кода така!
$phpEx = substr(strrchr(__FILE__, '.'), 1);
require_once ($phpbb_root_path . 'common.' . $phpEx);
$user->session_begin();
$auth->acl($user->data);
$user->setup();

session_start();
ob_start();
DEFINE('enigmaserv',true);
require_once "configs/connect.php";
require_once "inc/function_poll.php";
require_once "inc/security.php";
require_once "inc/bans.php";
require_once 'inc/Language.php';

$lang = Language::getInstance();
/*
 * Проверка и слагане на език.
 */
if (isset($_POST) && count($_POST) >= 2 && $_POST['submitten'] == 77) {
    $lang->setLang($_POST['lang']);
    header("Location: ".$_SERVER['REQUEST_URI']."");
    exit;
}

$page = $_SERVER['REQUEST_URI'];

$id = (int)addslashes($_GET['id']);
if ($id) {
$zaqvka = mysql_query("SELECT * FROM `novini` WHERE id='$id'");
$sql = mysql_query("SELECT * FROM novini WHERE id='$id'") or die (mysql_error());
$data = mysql_fetch_assoc($sql);
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!-- html --><html>
<!-- head --><head>
<title><?php
if ($page == "/")                               { echo "".$lang->nachalo."";}
if ($page == "/index.php")                      { echo "".$lang->nachalo."";}
if ($page == "/read-".$id.".php")               { echo "".$lang->titlenews." &bull; ".$data[zaglavie]."";}
if ($page == "/index.php?p=servers")            { echo "".$lang->servers."";} 
if ($page == "/index.php?p=smsservices")        { echo "".$lang->smsservices."";} 
if ($page == "/index.php?p=staff")              { echo "".$lang->staff."";} 
if ($page == "/index.php?p=contacts")           { echo "".$lang->kontakti."";} 
if ($page == "/index.php?p=sms-admin")          { echo "".$lang->smsadmin."";} 
if ($page == "/index.php?p=sms-admban")         { echo "".$lang->smsadminban."";} 
if ($page == "/index.php?p=advertising")        { echo "".$lang->advertising."";} 
if ($page == "/index.php?p=advertising728x90")  { echo "".$lang->advertising." 728x90";} 
if ($page == "/index.php?p=advertising468x60")  { echo "".$lang->advertising." 468x60";} 
if ($page == "/index.php?p=advertising88x31")   { echo "".$lang->advertising." 88x31";} 
if ($page == "/index.php?p=sms-rank")           { echo "".$lang->smsrank."";} 
if ($page == "/index.php?p=sms-nick")           { echo "".$lang->smsnick."";} 
if ($page == "/index.php?p=ChangeUsername")     { echo "".$lang->ChangeUsername."";}
if ($page == "/index.php?p=user_warnings")      { echo "".$lang->user_warnings."";} 
if ($page == "/index.php?p=poll-results")       { echo "".$lang->pollresults."";}
if ($page == "/index.php?p=commentars_poll")    { echo "".$lang->commentarspoll."";}
echo ' &bull; '; echo $lang->moto; 
?></title>
<meta name="Author" content="sed1" />
<meta name="copyright" content="© <?php echo $lang->moto; ?>" />
<meta name="Keywords" content="<?php echo $lang->keywords; ?>" /> 
<meta name="Description" content="<?php echo $lang->deschome; ?>" />
<meta http-equiv="Content-Language" content="bg" />
<meta name="rating" content="general" />
<meta name="revisit-after" content="1 Days" />
<meta name="robots" content="index,follow" /> 
<link rel="shortcut icon" href="<?php echo $siteurl; ?>/images/favicon.ico" type="image/x-icon" />
<link type="text/css" rel="StyleSheet" href="<?php echo $siteurl; ?>/engine/style.css" />
<link type="text/css" rel="StyleSheet" href="<?php echo $siteurl; ?>/engine/my.css" />
<script type="text/javascript" src="<?php echo $siteurl; ?>/js/jquery.js"></script>
<script type="text/javascript" src="<?php echo $siteurl; ?>/js/jquery.min.js"></script>
<script type="text/javascript" src="<?php echo $siteurl; ?>/js/main_tooltip.js"></script>
<script type="text/javascript" src="<?php echo $siteurl; ?>/js/jquery.slimscroll.min.js"></script>
<script type="text/javascript" src="<?php echo $siteurl; ?>/js/jquery.slimscroll.js"></script>
<script type="text/javascript" src="<?php echo $siteurl; ?>/js/scrolltopcontrol.js"></script>
<!-- <script type="text/javascript" src="<?php echo $siteurl; ?>/js/bb-jquery.js"></script> -->
</head><!-- </head> -->
<!-- body --><body onkeypress="return disableCtrlKeyCombination(event);" onkeydown = "return disableCtrlKeyCombination(event);">

<!-- container_wrap --><div id="container_wrap">
<!-- container_bg --><div class="container_bg">

<!-- <header> -->
<div id="header">
<?php require_once ('inc/menu.php'); ?>
<div id="h_speedbar"><a href="/"><?php echo $lang->nachalo; ?></a> »
<?php
if ($page == "/read-".$id.".php")               { echo '<a href='.$page.'>'.$data[zaglavie].'</a>';}
if ($page == "/index.php?p=servers")            { echo '<a href='.$page.'>'.$lang->servers.'</a>';}
if ($page == "/index.php?p=smsservices")        { echo '<a href='.$page.'>'.$lang->smsservices.'</a>';}
if ($page == "/index.php?p=staff")              { echo '<a href='.$page.'>'.$lang->staff.'</a>';}
if ($page == "/index.php?p=contacts")           { echo '<a href='.$page.'>'.$lang->kontakti.'</a>';} 
if ($page == "/index.php?p=sms-admin")          { echo '<a href='.$page.'>'.$lang->smsadmin.'</a>';}  
if ($page == "/index.php?p=sms-admban")         { echo '<a href='.$page.'>'.$lang->smsadminban.'</a>';} 
if ($page == "/index.php?p=advertising")        { echo '<a href='.$page.'>'.$lang->advertising.'</a>';} 
if ($page == "/index.php?p=advertising728x90")  { echo '<a href='.$page.'>'.$lang->advertising.' 728x90</a>';} 
if ($page == "/index.php?p=advertising468x60")  { echo '<a href='.$page.'>'.$lang->advertising.' 468x60</a>';}  
if ($page == "/index.php?p=advertising88x31")   { echo '<a href='.$page.'>'.$lang->advertising.' 88x31</a>';} 
if ($page == "/index.php?p=sms-rank")           { echo '<a href='.$page.'>'.$lang->smsrank.'</a>';}
if ($page == "/index.php?p=sms-nick")           { echo '<a href='.$page.'>'.$lang->smsnick.'</a>';}
if ($page == "/index.php?p=ChangeUsername")     { echo '<a href='.$page.'>'.$lang->ChangeUsername.'</a>';}
if ($page == "/index.php?p=sms_warnings")       { echo '<a href='.$page.'>'.$lang->user_warnings.'</a>';}
if ($page == "/index.php?p=poll-results")       { echo '<a href='.$page.'>'.$lang->pollresults.'</a>';}
if ($page == "/poll-".$id.".php")               { echo '<a href='.$page.'>'.$lang->commentarspoll.'</a>';}
?>
</div>
<div class="right" style="margin:9px 7px 0 0; overflow:hidden;">
<?php require_once ('inc/login.php'); ?>
</div>
</div>
<!-- </header> -->
     
<!-- content --><div id="content">
		
<!-- side_right -->
<div class="side_right">
<!-- <container> -->
<?php require_once ('inc/right_menu.php'); ?>
<!-- </container> -->
</div>
<!-- /side_right -->
           
<!-- left --><div id="left">
<?php
switch ($_GET['p']) {
case "commentars":
require_once('inc/pages/com_news.php');
break;
case "commentars_poll":
require_once('inc/pages/com_poll.php');
break;
case "contacts":
require_once "inc/pages/contacts.php";
break;
case "servers":
require_once "inc/pages/servers.php";
break;
case "staff":
require_once "inc/pages/staff.php";
break;
case "poll-results":
require_once "inc/pages/pollresults.php";
break;
case "smsservices":
require_once "inc/pages/smsservices.php";
break;
case "sms-admin":
require_once "inc/pages/sms/smsadmin.php";
break;
case "sms-admban":
require_once "inc/pages/sms/smsadmban.php";
break;
case "ChangeUsername":
require_once "inc/pages/sms/ChangeUsername.php";
break;
case "sms_warnings":
require_once "inc/pages/sms/sms_warnings.php";
break;
case "sms-nick":
require_once "inc/pages/sms/smsnick.php";
break;
case "sms-rank":
require_once "inc/pages/sms/smsrank.php";
break;
case "advertising":
require_once "inc/pages/sms/advertising.php";
break;
case "advertising88x31":
require_once "inc/pages/sms/advertising88x31.php";
break;
case "advertising468x60":
require_once "inc/pages/sms/advertising468x60.php";
break;
case "advertising728x90":
require_once "inc/pages/sms/advertising728x90.php";
break;
default:
require_once "inc/pages/news.php";
}
?>
</div><!-- /left -->

<!-- dawn_box -->
<?php require_once 'inc/dawn_box.php'; ?>
<!-- /dawn_box -->

<!-- clear: both -->
<div style="clear: both;"></div>
<!-- /clear: both -->

</div><!-- /content -->
		
<!-- <footer> -->
<?php require_once 'inc/footer.php'; ?>
<!-- </footer> -->

</div><!-- /container_bg -->
</div><!-- /container_wrap -->

</body><!-- /body -->
</html><!-- /html -->
И получавам на 20 реда грешки :D



Системата е на cs4x4 !

Моля обяснете малко по подробно понеже съм доста невеж в тази област :)

Мерси Брат :)

Потребителски аватар

Алекс trim()
Потребител
Потребител
Мнения: 27
Регистриран: 03 яну 2017, 01:13

Помощ за интеграцията на код :(

Мнение от Алекс trim() » 12 яну 2018, 23:44

Как да ти помогнем, без да знаем грешките?
но все пак, пробвай

Код: Избери всички

$user->setup('viewforum');
да го направиш

Код: Избери всички

$user->setup();

както и

Код: Избери всички

$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : $forum_path;
така

Код: Избери всички

$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './forum/'; //Тук сложи папката на форумът ти, задължително със точката и наклонената черта отпред
но така или иначе тази система трябва да се пренапише, за да тръгне на 3.1, така че няма смисъл от това, което правиш :bl:

Отговори

Върни се в “Уеб Програмиране”

Кой е на линия

Потребители, разглеждащи този форум: Google [Bot] и 1 гост