MyBB.de Forum

Normale Version: problem mit dem 'welcome user panel' plug in
Du siehst gerade eine vereinfachte Darstellung unserer Inhalte. Normale Ansicht mit richtiger Formatierung.
Seiten: 1 2
ich habe das 'welcome user panel' plug in von kingwolf ver. 2.0 installiert
und kann mich wenn das aktiviert ist nicht einloggen.
wenn ich es frisch aktiviere, kann ich mich normal einloggen. alle weiteren einlog versuche schlagen fehl. bekomme dann immer folgende nachhricht:

'Fatal error: Cannot redeclare user_exists() (previously declared in /srv/www/httpd/phost/w/com/pytalhost/web-forum/web/inc/functions_user.php:9) in /srv/www/httpd/phost/w/com/pytalhost/web-forum/web/inc/functions_user.php on line 21'


hier ein auszug der function_user.php

3 /**
4 * Checks if a user with uid $uid exists in the database.
5 *
6 * @param int The uid to check for.
7 * @return boolean True when exists, false when not.
8 */
9 function user_exists($uid)
10 {
11 global $db;
12 $query = $db->query("SELECT * FROM ".TABLE_PREFIX."users WHERE uid='".intval ($uid)."' LIMIT 1");
13 if($db->fetch_array($query))
14 {
15 return true;
16 }
17 else
18 {
19 return false;
20 }
21 }
22
23 /**
24 * Checks if $username already exists in the database.
25 *
26 * @param string The username for check for.
27 * @return boolean True when exists, false when not.
28 */


ist da etwas falsch? habe es mit ie und dem ff probiert immer dasselbe.
1.einlog versuch klappt. ausloggen klappt auch bis auf das ganz obere 'log out'
nach jedem weiteren einloggen erhalte ich die obere nachricht.


username: test
passw.: tester

http://web-forum.pytalhost.com/

wäre sehr nett, wenn mir jemand behilflich wäre

Dave

Das Problem ist, dass das Plugin versucht die Funktion user_exists zu definieren, welche allerdings bereits definiert ist. Suche mal in der Plugindatei nach dem Abschnitt mit der Funktion und nehmen diesen raus.
da ich mich damit nicht auskenne wäre es nett, was genau uch rausnejmen muss
Zitat:<?php
/*======================================================================*\
|| #################################################################### ||
|| # Turkish Plugin : [mybb12x Welcome User Panel # ||
|| # $file: wpanel.php üretim: 07.03.2007 # ||
|| # Ozan Çaðan - Nickname : K i N G W @ L F # ||
|| # http://www.ozancagan.com - eposta@ozancagan.com # ||
|| #################################################################### ||
\*======================================================================*/

$plugins->add_hook("index_start", "w_panel");

function wpanel_info()
{
return array(
"name" => "Welcome User Panel",
"description" => "Avatar plus user info , for display index page.",
"website" => "http://www.mybbturkiye.com",
"author" => "KiNGW@LF",
"authorsite" => "http://www.mybbturkiye.com",
"version" => "2.0",
);
}

function wpanel_activate()
{
global $db;

// Orjinal Temada bul ve deðiþtir.
require MYBB_ROOT. "/inc/adminfunctions_templates.php";
find_replace_templatesets("index", '#{\$header}#', "{\$header}\n{\$wpanel}");

// Hoþgeldiniz Paneli için yeni þablon yarat.
$templatearray = array(
"tid" => "NULL",
"title" => "index_welcomepanel",
"template" => "<table border=\"0\" cellspacing=\"1\" cellpadding=\"4\" class=\"tborder\">
<tr>
<td class=\"thead\" colspan=\"4\"><i>&raquo;</i> <b>\$lang->wpanel_welcome \$username</b></td>
</tr>
<tr>
\$avatarbox
\$yourstatsheader
\$boardstatsheader
\$spotlightheader
</tr>
<tr>
\$yourstatsbox
\$boardstatsbox
\$spotlightbox
</tr>
\$userbox
</table>
<br />",
"sid" => "-1",
);
$db->insert_query(TABLE_PREFIX."templates", $templatearray);

// Hoþgeldiniz panel ayarlarý yükle.
$wpanel_group = array(
"gid" => "NULL",
"title" => "Welcome User Panel",
"name" => "Welcome User Panel",
"description" => "Welcome user panel settings.",
"disporder" => "1",
"isdefault" => "no",
);
$db->insert_query(TABLE_PREFIX."settinggroups", $wpanel_group);
$gid = $db->insert_id();

// Hoþgeldiniz panel ayar gruplarýný yükle.
$wpanel_1 = array(
"sid" => "NULL",
"name" => "showavatarbox",
"title" => "Show \'Avatar\' Box ?",
"description" => "Display avatar box.",
"optionscode" => "yesno",
"value" => "yes",
"disporder" => "1",
"gid" => intval($gid),
);
$db->insert_query(TABLE_PREFIX."settings", $wpanel_1);
$wpanel_2 = array(
"sid" => "NULL",
"name" => "showyourstatsbox",
"title" => "Show \'User info\' Box?",
"description" => "Display user info box.",
"optionscode" => "yesno",
"value" => "yes",
"disporder" => "2",
"gid" => intval($gid),
);
$db->insert_query(TABLE_PREFIX."settings", $wpanel_2);
$wpanel_3 = array(
"sid" => "NULL",
"name" => "showboardstatsbox",
"title" => "Show \'Boardstats\' Box?",
"description" => "Display boardstats box.",
"optionscode" => "yesno",
"value" => "yes",
"disporder" => "3",
"gid" => intval($gid),
);
$db->insert_query(TABLE_PREFIX."settings", $wpanel_3);
$wpanel_4 = array(
"sid" => "NULL",
"name" => "rastgeleuyeler",
"title" => "Show \'Board Users\' Box?",
"description" => "Display Board Users box.",
"optionscode" => "yesno",
"value" => "yes",
"disporder" => "4",
"gid" => intval($gid),
);
$db->insert_query(TABLE_PREFIX."settings", $wpanel_4);
$wpanel_5 = array(
"sid" => "NULL",
"name" => "showuserbox",
"title" => "Show \'User\' Box?",
"description" => "Display user box.",
"optionscode" => "yesno",
"value" => "yes",
"disporder" => "5",
"gid" => intval($gid),
);
$db->insert_query(TABLE_PREFIX."settings", $wpanel_5);

// Rebuilt settings.php
rebuild_settings();
}

function wpanel_deactivate()
{
global $db;
// Hoþgeldiniz Paneli þablon tüm verileri yok et.
require MYBB_ROOT. "/inc/adminfunctions_templates.php";
find_replace_templatesets("index", '#{\$wpanel}#', "", 0);


// Hoþgeldiniz Paneli tema tüm verileri yok et.
$db->query("DELETE FROM ".TABLE_PREFIX."templates WHERE title='index_welcomepanel'");

// Hoþgeldiniz Paneli veritabaný tüm verileri yok et.
$query = $db->query("SELECT gid FROM ".TABLE_PREFIX."settinggroups WHERE name='Welcome User Panel'");
$g = $db->fetch_array($query);
$db->query("DELETE FROM ".TABLE_PREFIX."settinggroups WHERE gid='".$g['gid']."'");

// Hoþgeldiniz Paneli veritabaný tüm verileri yok et.
$db->query("DELETE FROM ".TABLE_PREFIX."settings WHERE gid='".$g['gid']."'");

// Rebuilt settings.php
rebuild_settings();
}


function w_panel()
{
global $db, $mybb, $cache, $templates, $lang, $wpanel;
// Wpanel Dil dosyasýsýný yükle.
$lang->load("wpanel");

require "./inc/functions_user.php";
if($mybb->settings['showyourstatsbox'] != "no" && $mybb->settings['showboardstatsbox'] != "no" && $mybb->settings['rastgeleuyeler'] != "no")
{
$width = " width=\"33%\"";
}
else
{
$width = "";
}
if($mybb->user['uid'] == 0)
{
$username = $lang->wpanel_guser;
}
else
{
$username = $mybb->user['username'];
}
if($mybb->settings['showavatarbox'] != "no")
{
if($mybb->user['uid'] != 0 && $mybb->user['avatar'])
{
$avatar = "<img src=\"".$mybb->user['avatar']."\">";
}
$avatarbox = "<td class=\"trow1\" valign=\"center\" align=\"center\" rowspan=\"3\"><table border=\"0\" cellpadding=\"10\"><tr><td>$avatar</td></tr></table></td>";
}
if($mybb->settings['showyourstatsbox'] != "no")
{
if($mybb->user['uid'] != 0)
{
$title = get_usertitle($mybb->user['uid']);
if($mybb->user['email'])
{
$email = "$lang->wpanel_regemail</td><td><a href=\"mailto:".$mybb->user['email']."\">". $mybb->user['email'] ."</a>";
}
}
else
{
$mybb->user['uid'] = "0";
$mybb->user['postnum'] = "0";
$title = $lang->wpanel_gtitle;
}
$yourstatsheader = "<td class=\"tcat\"$width><b><u>$lang->wpanel_yourinfo</u></b></td>";
$yourstatsbox = "<td class=\"trow2\" valign=\"top\"$width><table width=\"100%\" cellpadding=\"1\" cellspacing=\"1\"><tr><td>$lang->wpanel_userid</td><td>".$mybb->user['uid']."</td></tr><tr><td>$lang->wpanel_posts</td><td>".$mybb->user['postnum']."</td></tr><tr><td>$lang->wpanel_title</td><td>$title</td></tr><tr><td>$email</td></tr></table></td>";
}
if($mybb->settings['showboardstatsbox'] != "no")
{
$stats = $cache->read("stats");
$boardstatsheader = "<td class=\"tcat\"$width><b><u>$lang->wpanel_boardinfo</u></b></td>";
$boardstatsbox = "<td class=\"trow1\" valign=\"top\"$width><table width=\"100%\" cellpadding=\"1\" cellspacing=\"1\"><tr><td>$lang->wpanel_tmembers</td><td>$stats[numusers]</td></tr><tr><td>$lang->wpanel_tthreads</td><td>$stats[numthreads]</td></tr><tr><td>$lang->wpanel_tposts</td><td>$stats[numposts]</td></tr><tr><td>$lang->wpanel_newmem</td><td><a href=\"member.php?action=profile&uid=$stats[lastuid]\">$stats[lastusername]</a></td></tr></table></td>";
}
if($mybb->settings['rastgeleuyeler'] != "no")
{
$query = $db->query("SELECT uid,username,postnum FROM ".TABLE_PREFIX."users ORDER BY rand() LIMIT 0,1");
$spotlight = $db->fetch_array($query);
if($mybb->user['uid'] != 0)
{
$spotlight_options = "<td colspan=\"2\"><br><center><a href=\"member.php?action=emailuser&uid=$spotlight[uid]\">$lang->wpanel_email</a> | <a href=\"private.php?action=send&uid=$spotlight[uid]\">$lang->wpanel_pm</a></center></td>";
}
220 $title = get_usertitle($spotlight['uid']); $spotlightheader = "<td class=\"tcat\"$width><b><u>$lang->wpanel_spotlight</u></b></td>";
$spotlightbox = "<td class=\"trow2\" valign=\"top\"$width><table width=\"100%\" cellpadding=\"1\" cellspacing=\"1\"><tr><td>$lang->wpanel_spotuser</td><td><a href=\"member.php?action=profile&uid=$spotlight[uid]\">$spotlight[username]</a></td></tr><tr><td>$lang->wpanel_spottitle</td><td>$title</td></tr><tr><td>$lang->wpanel_spotpost</td><td>$spotlight[postnum]</td></tr><tr>$spotlight_options</tr></table></td>";
}

// Prepare the main templates for use
unset($admincplink);

// Load appropriate welcome block for the current logged in user
if($mybb->user['uid'] != 0)
{
// User can access the admin cp and we're not hiding admin cp links, fetch it
if($mybb->usergroup['cancp'] == "yes" && $mybb->config['hide_admin_links'] != 1)
{
eval("\$admincplink = \"".$templates->get("header_welcomeblock_member_admin")."\";");
}
if($mybb->settings['showuserbox'] != "no")
{
$userbox = "<tr><td colspan=\"3\" class=\"trow1\"><table width=\"90%\" cellpadding=\"1\" cellspacing=\"1\" align=\"center\"><tr>
<span style=\"float:right;\"><a href=\"#\" onclick=\"MyBB.popupWindow('misc.php?action=buddypopup', 'buddyList', 170, 300);\">{$lang->welcome_open_buddy_list}</a></span> <img src=images/toplinks/ka.gif> (<a href=\"{$mybb->settings['bburl']}/usercp.php\"><strong>{$lang->welcome_usercp}</strong></a>$admincplink &mdash; <a href=\"{$mybb->settings['bburl']}/member.php?action=logout&amp;logoutkey={$mybb->user['logoutkey']}\">{$lang->welcome_logout}</a>
)<br /><span style=\"float:right;\"><a href= \"http://www.mybbturkiye.com\" target=\"_blank\"><div style=\"text-align: right; font-size: 8px;\"><b>Welcome U. Plugin</b></div></a></span><a href=\"search.php?action=getnew\">$lang->welcome_newposts</a> | <a href=\"search.php?action=getdaily\">$lang->welcome_todaysposts</a> | <a href=\"private.php\">$lang->welcome_pms</a> $lang->welcome_pms_usage</span> </tr></table></td></tr>";
}
eval("\$wpanel = \"".$templates->get("index_welcomepanel")."\";");
}
}
if(!function_exists("rebuild_settings"))
{
function rebuild_settings()
{
global $db, $mybb;

if(!file_exists(MYBB_ROOT."inc/settings.php"))
{
$mode = "x";
}
else
{
$mode = "w";
}
$options = array(
"order_by" => "title",
"order_dir" => "ASC"
);
$query = $db->simple_select(TABLE_PREFIX."settings", "value, name", "", $options);

while($setting = $db->fetch_array($query))
{
$setting['value'] = str_replace("\"", "\\\"", $setting['value']);
$settings .= "\$settings['".$setting['name']."'] = \"".$setting['value']."\";\n";
$mybb->settings[$setting['name']] = $setting['value'];
}
$settings = "<"."?php\n/*********************************\ \n DO NOT EDIT THIS FILE, PLEASE USE\n THE SETTINGS EDITOR\n\*********************************/\n\n$settings\n?".">";
$file = @fopen(MYBB_ROOT."inc/settings.php", $mode);
@fwrite($file, $settings);
@fclose($file);
$GLOBALS['settings'] = &$mybb->settings;
}
}
?>

Dave

Das Problem scheint diese Zeile
PHP-Code:
require "./inc/functions_user.php"
in der Funktion w_panel() zu sein. Nimm diese mal raus und schau, was passiert.
Erstmal danke für deine Mühen,
Bekomme dann aber folgende Fehlermeldung:

'Fatal error: Call to undefined function get_usertitle() in /srv/www/httpd/phost/w/com/pytalhost/web-forum/web/inc/plugins/wpanel.php on line 220'

Habe die Zeile oben fett makiert

Zitat:220 $title = get_usertitle($spotlight['uid']);

Dave

Das ist komisch, d.h. dass die Funktion user_exists() noch an irgendeiner anderen Stelle definiert wird und wieso wirft nicht schon diese Zeile
PHP-Code:
$title get_usertitle($mybb->user['uid']); 
den Fehler aus?
Ersetze mal die Einbund durch den require() Befehl mit include().
PHP-Code:
include "./inc/functions_user.php"
seh schon muss dringend php lernen Wink

danke dir dave, werde es heute nach der arbeit testen.
also das klappt leider auch nicht, bekomme dann die gleiche fehlermeldung wie am anfang Sad

vieleicht ist es besser das plugin nicht mehr zu nutzen, obwohl es mir sehr gut gefällt, ich resigniere langsam...

kommt die fehlermeldung denn auch bei dir / euch???
Kann es sein, dass das Plugin nicht für MyBB 1.2 geeignet ist? Wo hast du das her?
Seiten: 1 2