|
|
phpBB2 by Przemo
Support forów phpBB2 modified by Przemo
|
|
Przesunięty przez: joli 29-06-2009, 19:40 |
[Problem] Integracja forum z własnym portalem. |
Autor |
Wiadomość |
Y-i
Posty: 11
|
Wysłany: 06-01-2008, 18:51 [Problem] Integracja forum z własnym portalem.
|
|
|
Poniższe kody są do integracji forum ze strona www, problem w tym że stronę mam na innym serwerze niż forum i nie wiem w którym fragmencie kodu podopisywać adresy do forum.
Kod: | <?php
define('IN_PHPBB', true);
$phpbb_root_path = './forum/';
$page_path = './../';
include($phpbb_root_path . 'extension.inc'.$phpEx);
include($phpbb_root_path . 'common.'.$phpEx);
include($phpbb_root_path . 'includes/bbcode.'.$phpEx);
$board_config['smilies_path'] = $phpbb_root_path.$board_config['smilies_path'];
$userdata = session_pagestart($user_ip, PAGE_INDEX, $session_length);
init_userprefs($userdata);
$total_posts = get_db_stat('postcount');
$total_users = get_db_stat('usercount');
$newest_userdata = get_db_stat('newestuser');
$newest_user = $newest_userdata['username'];
$newest_uid = $newest_userdata['user_id'];
$scfile=explode("/",$_SERVER['PHP_SELF']);
$redir = "../";
?> |
Kod: |
<?php
//link pierwszy LOGIN
if( $userdata['session_logged_in'] )
{
//powitanie
echo '<center><b>Witaj '.$userdata['username'].'</b></center>';
echo '<center>';
switch( $userdata['user_avatar_type'] )
{
case USER_AVATAR_UPLOAD:
$avatar = ( $board_config['allow_avatar_upload'] ) ? '<img src="./forum/' . $board_config['avatar_path'] . '/' . $userdata['user_avatar'] . '" alt="" border="0" />' : '';
break;
case USER_AVATAR_REMOTE:
$avatar = ( $board_config['allow_avatar_remote'] ) ? '<img src="./forum/' . $userdata['user_avatar'] . '" alt="" border="0" />' : '';
break;
case USER_AVATAR_GALLERY:
$avatar = ( $board_config['allow_avatar_local'] ) ? '<img src="./forum/' . $board_config['avatar_gallery_path'] . '/' . $userdata['user_avatar'] . '" alt="" border="0" />' : '';
break;
}
if( $avatar != '' )
{
echo $avatar;
}
else {
echo '<img src="./images/non_avatar.jpg" height="70" width="70">';
}
echo '</center>';
//edytuj profil
echo '<center><A HREF="'.append_sid($phpbb_root_path.'profile.php?mode=editprofile').'">Edytuj profil</A><br></center>';
//kod odpowiadajacy za prywatne wiadomosci
if ( ($userdata['session_logged_in']) && (empty($gen_simple_header)) )
{
if ( $userdata['user_new_privmsg'] )
{
$l_message_new = ( $userdata['user_new_privmsg'] == 1 ) ? $lang['New_pm'] : $lang['New_pms'];
$l_privmsgs_text = sprintf($l_message_new, $userdata['user_new_privmsg']);
if ( $userdata['user_last_privmsg'] > $userdata['user_lastvisit'] )
{
$sql = "UPDATE " . USERS_TABLE . "
SET user_last_privmsg = " . $userdata['user_lastvisit'] . "
WHERE user_id = " . $userdata['user_id'];
if ( !$db->sql_query($sql) )
{
message_die(GENERAL_ERROR, 'Could not update private message new/read time for user', '', __LINE__, __FILE__, $sql);
}
$s_privmsg_new = 1;
$icon_pm = $images['pm_new_msg'];
}
else
{
$s_privmsg_new = 0;
$icon_pm = $images['pm_new_msg'];
}
}
else
{
$l_privmsgs_text = $lang['No_new_pm'];
$s_privmsg_new = 0;
$icon_pm = $images['pm_no_new_msg'];
}
if ( $userdata['user_unread_privmsg'] )
{
$l_message_unread = ( $userdata['user_unread_privmsg'] == 1 ) ? $lang['Unread_pm'] : $lang['Unread_pms'];
$l_privmsgs_text_unread = sprintf($l_message_unread, $userdata['user_unread_privmsg']);
}
else
{
$l_privmsgs_text_unread = $lang['No_unread_pm'];
}
}
else
{
$icon_pm = $images['pm_no_new_msg'];
$l_privmsgs_text = $lang['Login_check_pm'];
$l_privmsgs_text_unread = '';
$s_privmsg_new = 0;
}
//link Prywatne Wiadomosci
echo '<center>Wiadomości: <a href="'.append_sid("forum/privmsg.".$phpEx."?folder=inbox") . '" onclick="jump_to_inbox();return false;" target="_new">'.$userdata['user_new_privmsg'].'</a><br></center>';
//link wyloguj
echo '<center><a href="'.append_sid('forum/login.php?logout=true&redirect='.$redir.'&sid='.$userdata['session_id']).'">Wyloguj</a><br></center>';
}
//to wszystko jak jestesmy zalogowani, pokazuje opcje
else
//to wszystko jak nie jestesmy zalogowni, pokazuja sie formularze
{
echo '<center>
<form valign="top" method="post" action="forum/login.php" STYLE="display: inline" name="login">
Login:<br>
<input type="text" name="username" class="textbox" style="width:100px"><br>
Hasło:<br>
<input type="password" name="password" class="textbox" style="width:100px">
<input type="hidden" name="redirect" value="../">
<input type="hidden" name="login" value="login" class="button">
<input type="submit" value="Zaloguj" class="button">
<input class="text" type="checkbox" name="autologin">Zapamiętaj
</form>';
//link zarejestruj
echo '<A HREF="'.append_sid($phpbb_root_path.'profile.php?mode=register').'" class=l>Rejestracja</a><br>';
//link zapomnialem hasla
echo '<A HREF="'.append_sid($phpbb_root_path.'profile.php?mode=sendpassword').'" class=l>Zapomniałem hasła</a>';
}
?> |
Kod: |
<?php
echo 'Niusów: ';
$sql = "SELECT forum_topics, forum_posts FROM " . FORUMS_TABLE. " WHERE forum_id =1";
if ( !($result = $db->sql_query($sql)) )
{
die('blad');
}
$row = $db->sql_fetchrow($result);
$total_posts2 = $row['forum_posts'];
$total_topics2 = $row['forum_topics'];
echo $total_topics2;
echo '<br>';
echo("Postów: ".$total_posts."<br>");
echo(sprintf($l_total_post_s, $total_posts) . 'Tematów: ' . get_db_stat('topiccount') . '<br>');
echo("Użytkowników: ".$total_users."<br>Witamy: <b><a href=forum/profile.php?mode=viewprofile&u=".$newest_uid.">".
$newest_user."</A></b>");
?> |
Kod: | table width="100%">
<?php
$conf['how_many_news'] = '4';
$page = $_GET['page'];
if ( $page != '' && file_exists($page.'.php') ) { include($page.'.php'); } else {
$sql = 'SELECT
t.topic_id,
t.topic_time,
t.topic_title,
pt.post_text,
u.username,
u.user_id,
u.user_rank,
u.user_posts,
t.topic_replies,
pt.bbcode_uid,
t.forum_id,
t.topic_poster,
t.topic_first_post_id,
t.topic_status,
pt.post_id,
p.post_id,
p.enable_smilies
FROM
' . TOPICS_TABLE . ' AS t,
' . USERS_TABLE . ' AS u,
' . POSTS_TEXT_TABLE . ' AS pt,
' . POSTS_TABLE . ' AS p
WHERE
t.forum_id IN (1) AND
t.topic_time <= ' . time() . ' AND
t.topic_poster = u.user_id AND
t.topic_first_post_id = pt.post_id AND
t.topic_first_post_id = p.post_id AND
t.topic_status <> 2
ORDER BY
t.topic_time DESC LIMIT 0, ' . $conf['how_many_news'] . '';
$result = $db->sql_query($sql);
while( $row = $db->sql_fetchrow($result) )
{
$text = $row['post_text'];
$text = bbcode_strip($text, $row['bbcode_uid'], $userdata['username']);
$text = nl2br($text);
$text = smilies_pass($text);
$text = make_clickable($text);
echo '<tr>';
echo '<td align="left"><font size="2"><b>Tytuł:</b> <a href="forum/'.append_sid('viewtopic.' . $phpEx . '?t=' . $row['topic_id']).'"class="public" >'.$row['topic_title'].'</a></span></font><br></td>';
echo '<td align="right"><a href="./forum/' . append_sid('profile.'.$phpEx.'?mode=viewprofile&u='.$row['user_id'].'') . '">'.$row['username'].'</a>, '.create_date($board_config['default_dateformat'], $row['topic_time'], $board_config['board_timezone']).'</td>';
echo '</tr>';
echo '<tr><td colspan="2">';
echo '<br />'.$text;
echo '</td></tr>';
echo '<tr>';
echo '<td colspan="2" align="right"><a href="./forum/'.append_sid('viewtopic.' . $phpEx . '?t=' . $row['topic_id']).'"class="public" >Zobacz komentarze</a></p></td>';}
echo '</tr></table>';
$db->sql_freeresult($result);
}
} |
|
|
|
|
 |
Gadatliwa Kasia
|
|
|
|
|
Nie możesz pisać nowych tematów Nie możesz odpowiadać w tematach Nie możesz zmieniać swoich postów Nie możesz usuwać swoich postów Nie możesz głosować w ankietach Nie możesz załączać plików na tym forum Możesz ściągać załączniki na tym forum
|
Dodaj temat do Ulubionych Wersja do druku
|
Kopiowanie wszelkich treści zawartych na forum, modyfikacji oraz instrukcji bez zgody administracji i autorów tematów/postów zabronione!
Powered by phpBB modified by Przemo © 2003 phpBB
| Strona wygenerowana w 0,1 sekundy. Zapytań do SQL: 12 | |
 |
|