Webboard

Pełna wersja: Błąd w memberlist.
Aktualnie przeglądasz uproszczoną wersję forum. Kliknij tutaj, by zobaczyć wersję z pełnym formatowaniem.
wersja skryptu MyBB: 1.8
adres forum: haxballerz.eu
na czym polega problem (screen, opis, komunikaty):

Po wejściu w odnośnik:
Kod:
http://haxballerz.xaa.pl/memberlist.php

Pojawia się seria komunikatów:
Kod:
Parse error: syntax error, unexpected '' (T_ENCAPSED_AND_WHITESPACE), expecting identifier (T_STRING) or variable (T_VARIABLE) or number (T_NUM_STRING) in /home/haxballe/public_html/memberlist.php(427) : eval()'d code on line 11

Zawartość memberlist.php
Kod:
<?php
/**
* MyBB 1.8
* Copyright 2014 MyBB Group, All Rights Reserved
*
* Website: http://www.mybb.com
* License: http://www.mybb.com/about/license
*
*/

define("IN_MYBB", 1);
define('THIS_SCRIPT', 'memberlist.php');

$templatelist = "memberlist,memberlist_search,memberlist_user,memberlist_user_groupimage,memberlist_user_avatar,memberlist_user_userstar";
$templatelist .= ",multipage,multipage_end,multipage_jump_page,multipage_nextpage,multipage_page,multipage_page_current,multipage_page_link_current,multipage_prevpage,multipage_start,memberlist_referrals,memberlist_referrals_bit,memberlist_error,memberlist_orderarrow";

require_once "./global.php";

// Load global language phrases
$lang->load("memberlist");

if($mybb->settings['enablememberlist'] == 0)
{
    error($lang->memberlist_disabled);
}

$plugins->run_hooks("memberlist_start");

add_breadcrumb($lang->nav_memberlist, "memberlist.php");

if($mybb->usergroup['canviewmemberlist'] == 0)
{
    error_no_permission();
}

// Showing advanced search page?
if($mybb->get_input('action') == "search")
{
    $plugins->run_hooks("memberlist_search");
    add_breadcrumb($lang->nav_memberlist_search);
    eval("\$search_page = \"".$templates->get("memberlist_search")."\";");
    output_page($search_page);
}
else
{
    $colspan = 6;
    $search_url = '';

    // Incoming sort field?
    if(isset($mybb->input['sort']))
    {
        $mybb->input['sort'] = strtolower($mybb->get_input('sort'));
    }
    else
    {
        $mybb->input['sort'] = $mybb->settings['default_memberlist_sortby'];
    }

    $sort_selected = array(
        'regdate' => '',
        'lastvisit' => '',
        'reputation' => '',
        'postnum' => '',
        'referrals' => '',
        'username' => ''
    );

    switch($mybb->input['sort'])
    {
        case "regdate":
            $sort_field = "u.regdate";
            break;
        case "lastvisit":
            $sort_field = "u.lastactive";
            break;
        case "reputation":
            $sort_field = "u.reputation";
            break;
        case "postnum":
            $sort_field = "u.postnum";
            break;
        case "threadnum":
            $sort_field = "u.threadnum";
            break;
        case "referrals":
            $sort_field = "u.referrals";
            break;
        default:
            $sort_field = "u.username";
            $mybb->input['sort'] = 'username';
            break;
    }
    $sort_selected[$mybb->input['sort']] = " selected=\"selected\"";

    // Incoming sort order?
    if(isset($mybb->input['order']))
    {
        $mybb->input['order'] = strtolower($mybb->input['order']);
    }
    else
    {
        $mybb->input['order'] = strtolower($mybb->settings['default_memberlist_order']);
    }

    $order_check = array('ascending' => '', 'descending' => '');
    if($mybb->input['order'] == "ascending" || (!$mybb->input['order'] && $mybb->input['sort'] == 'username'))
    {
        $sort_order = "ASC";
        $sortordernow = "ascending";
        $oppsort = $lang->desc;
        $oppsortnext = "descending";
        $mybb->input['order'] = "ascending";
    }
    else
    {
        $sort_order = "DESC";
        $sortordernow = "descending";
        $oppsort = $lang->asc;
        $oppsortnext = "ascending";
        $mybb->input['order'] = "descending";
    }
    $order_check[$mybb->input['order']] = " checked=\"checked\"";

    // Incoming results per page?
    $mybb->input['perpage'] = $mybb->get_input('perpage', MyBB::INPUT_INT);
    if($mybb->input['perpage'] > 0 && $mybb->input['perpage'] <= 500)
    {
        $per_page = $mybb->input['perpage'];
    }
    else if($mybb->settings['membersperpage'])
    {
        $per_page = $mybb->input['perpage'] = (int)$mybb->settings['membersperpage'];
    }
    else
    {
        $per_page = $mybb->input['perpage'] = 20;
    }

    $search_query = '1=1';
    $search_url = "";

    // Limiting results to a certain letter
    if(isset($mybb->input['letter']))
    {
        $letter = chr(ord($mybb->get_input('letter')));
        if($mybb->input['letter'] == -1)
        {
            $search_query .= " AND u.username NOT REGEXP('[a-zA-Z]')";
        }
        else if(strlen($letter) == 1)
        {
            $search_query .= " AND u.username LIKE '".$db->escape_string_like($letter)."%'";
        }
        $search_url .= "&letter={$letter}";
    }

    // Searching for a matching username
    $search_username = htmlspecialchars_uni(trim($mybb->get_input('username')));
    if($search_username != '')
    {
        $username_like_query = $db->escape_string_like($search_username);

        // Name begins with
        if($mybb->input['username_match'] == "begins")
        {
            $search_query .= " AND u.username LIKE '".$username_like_query."%'";
            $search_url .= "&username_match=begins";
        }
        // Just contains
        else
        {
            $search_query .= " AND u.username LIKE '%".$username_like_query."%'";
        }

        $search_url .= "&username=".urlencode($search_username);
    }

    // Website contains
    $mybb->input['website'] = trim($mybb->get_input('website'));
    $search_website = htmlspecialchars_uni($mybb->input['website']);
    if(trim($mybb->input['website']))
    {
        $search_query .= " AND u.website LIKE '%".$db->escape_string_like($mybb->input['website'])."%'";
        $search_url .= "&website=".urlencode($mybb->input['website']);
    }

    // Search by contact field input
    foreach(array('aim', 'icq', 'google', 'skype', 'yahoo') as $cfield)
    {
        $csetting = 'allow'.$cfield.'field';
        $mybb->input[$cfield] = trim($mybb->get_input($cfield));
        if($mybb->input[$cfield] && $mybb->settings[$csetting] != '')
        {
            if($mybb->settings[$csetting] != -1)
            {
                $gids = explode(',', (string)$mybb->settings[$csetting]);

                $search_query .= " AND (";
                $or = '';
                foreach($gids as $gid)
                {
                    $gid = (int)$gid;
                    $search_query .= $or.'u.usergroup=\''.$gid.'\'';
                    switch($db->type)
                    {
                        case 'pgsql':
                        case 'sqlite':
                            $search_query .= " OR ','||u.additionalgroups||',' LIKE '%,{$gid},%'";
                            break;
                        default:
                            $search_query .= " OR CONCAT(',',u.additionalgroups,',') LIKE '%,{$gid},%'";
                            break;
                    }
                    $or = ' OR ';
                }
                $search_query .= ")";
            }
            if($cfield == 'icq')
            {
                $search_query .= " AND u.{$cfield} LIKE '%".(int)$mybb->input[$cfield]."%'";
            }
            else
            {
                $search_query .= " AND u.{$cfield} LIKE '%".$db->escape_string_like($mybb->input[$cfield])."%'";
            }
            $search_url .= "&{$cfield}=".urlencode($mybb->input[$cfield]);
        }
    }

    $usergroups_cache = $cache->read('usergroups');

    $group = array();
    foreach($usergroups_cache as $gid => $groupcache)
    {
        if($groupcache['showmemberlist'] == 0)
        {
            $group[] = (int)$gid;
        }
    }

    if(is_array($group) && !empty($group))
    {
        $hiddengroup = implode(',', $group);

        $search_query .= " AND u.usergroup NOT IN ({$hiddengroup})";

        foreach($group as $hidegid)
        {
            switch($db->type)
            {
                case "pgsql":
                case "sqlite":
                    $search_query .= " AND ','||u.additionalgroups||',' NOT LIKE '%,{$hidegid},%'";
                    break;
                default:
                    $search_query .= " AND CONCAT(',',u.additionalgroups,',') NOT LIKE '%,{$hidegid},%'";
                    break;
            }
        }
    }
  
    $sorturl = htmlspecialchars_uni("memberlist.php?perpage={$mybb->input['perpage']}{$search_url}");
    $search_url = htmlspecialchars_uni("memberlist.php?sort={$mybb->input['sort']}&order={$mybb->input['order']}&perpage={$mybb->input['perpage']}{$search_url}");

    $plugins->run_hooks('memberlist_intermediate');

    $query = $db->simple_select("users u", "COUNT(*) AS users", "{$search_query}");
    $num_users = $db->fetch_field($query, "users");

    $page = $mybb->get_input('page', MyBB::INPUT_INT);
    if($page && $page > 0)
    {
        $start = ($page - 1) * $per_page;
    }
    else
    {
        $start = 0;
        $page = 1;
    }

    $sort = htmlspecialchars_uni($mybb->input['sort']);
    eval("\$orderarrow['{$sort}'] = \"".$templates->get("memberlist_orderarrow")."\";");

    // Referral?
    if($mybb->settings['usereferrals'] == 1)
    {
        $colspan = 7;
        eval("\$referral_header = \"".$templates->get("memberlist_referrals")."\";");
    }

    $multipage = multipage($num_users, $per_page, $page, $search_url);

    // Cache a few things
    $usertitles = $cache->read('usertitles');
    $usertitles_cache = array();
    foreach($usertitles as $usertitle)
    {
        $usertitles_cache[$usertitle['posts']] = $usertitle;
    }
    $users = '';
    $query = $db->query("
        SELECT u.*, f.*
        FROM ".TABLE_PREFIX."users u
        LEFT JOIN ".TABLE_PREFIX."userfields f ON (f.ufid=u.uid)
        WHERE {$search_query}
        ORDER BY {$sort_field} {$sort_order}
        LIMIT {$start}, {$per_page}
    ");
    while($user = $db->fetch_array($query))
    {
        $user = $plugins->run_hooks("memberlist_user", $user);

        $alt_bg = alt_trow();

        $user['username'] = format_name($user['username'], $user['usergroup'], $user['displaygroup']);

        $user['profilelink'] = build_profile_link($user['username'], $user['uid']);

        // Get the display usergroup
        if(empty($user['displaygroup']))
        {
            $user['displaygroup'] = $user['usergroup'];
        }
        $usergroup = $usergroups_cache[$user['displaygroup']];

        // Build referral?
        if($mybb->settings['usereferrals'] == 1)
        {
            eval("\$referral_bit = \"".$templates->get("memberlist_referrals_bit")."\";");
        }

        $usergroup['groupimage'] = '';
        // Work out the usergroup/title stuff
        if(!empty($usergroup['image']))
        {
            if(!empty($mybb->user['language']))
            {
                $language = $mybb->user['language'];
            }
            else
            {
                $language = $mybb->settings['bblanguage'];
            }
            $usergroup['image'] = str_replace("{lang}", $language, $usergroup['image']);
            $usergroup['image'] = str_replace("{theme}", $theme['imgdir'], $usergroup['image']);
            eval("\$usergroup['groupimage'] = \"".$templates->get("memberlist_user_groupimage")."\";");
        }

        $has_custom_title = 0;
        if(trim($user['usertitle']) != "")
        {
            $has_custom_title = 1;
        }

        if($usergroup['usertitle'] != "" && !$has_custom_title)
        {
            $user['usertitle'] = $usergroup['usertitle'];
        }
        elseif(is_array($usertitles_cache) && !$usergroup['usertitle'])
        {
            foreach($usertitles_cache as $posts => $titleinfo)
            {
                if($user['postnum'] >= $posts)
                {
                    if(!$has_custom_title)
                    {
                        $user['usertitle'] = $titleinfo['title'];
                    }
                    $user['stars'] = $titleinfo['stars'];
                    $user['starimage'] = $titleinfo['starimage'];
                    break;
                }
            }
        }
        
        $user['usertitle'] = htmlspecialchars_uni($user['usertitle']);

        if(!empty($usergroup['stars']))
        {
            $user['stars'] = $usergroup['stars'];
        }

        if(empty($user['starimage']))
        {
            $user['starimage'] = $usergroup['starimage'];
        }

        $user['userstars'] = '';
        if(!empty($user['starimage']))
        {
            // Only display stars if we have an image to use...
            $starimage = str_replace("{theme}", $theme['imgdir'], $user['starimage']);

            for($i = 0; $i < $user['stars']; ++$i)
            {
                eval("\$user['userstars'] .= \"".$templates->get("memberlist_user_userstar", 1, 0)."\";");
            }
        }

        if($user['userstars'] && $usergroup['groupimage'])
        {
            $user['userstars'] = "<br />".$user['userstars'];
        }

        // Show avatar
        $useravatar = format_avatar($user['avatar'], $user['avatardimensions'], my_strtolower($mybb->settings['memberlistmaxavatarsize']));
        eval("\$user['avatar'] = \"".$templates->get("memberlist_user_avatar")."\";");

        if($user['invisible'] == 1 && $mybb->usergroup['canviewwolinvis'] != 1 && $user['uid'] != $mybb->user['uid'])
        {
            $user['lastvisit'] = $lang->lastvisit_never;

            if($user['lastvisit'])
            {
                // We have had at least some active time, hide it instead
                $user['lastvisit'] = $lang->lastvisit_hidden;
            }
        }
        else
        {
            $user['lastvisit'] = my_date('relative', $user['lastactive']);
        }

        $user['regdate'] = my_date('relative', $user['regdate']);
        $user['postnum'] = my_number_format($user['postnum']);
        $user['threadnum'] = my_number_format($user['threadnum']);
        eval("\$users .= \"".$templates->get("memberlist_user")."\";");
    }

    // Do we have no results?
    if(!$users)
    {
        eval("\$users = \"".$templates->get("memberlist_error")."\";");
    }

    $plugins->run_hooks("memberlist_end");

    eval("\$memberlist = \"".$templates->get("memberlist")."\";");
    output_page($memberlist);
}

Czy wiecie jak się z tym uporać?
O ile nie robiłeś zmian w tym pliku, a zakładam, że nie - to problem leży w szablonie memberlist, najprawdopodobniej masz wywołany kod php w szablonie, a tego robić nie powinieneś.

Wstaw zawartość szablonu memberlist.
Kod:
<html>
<head>
<title>{$mybb->settings['bbname']} - {$lang->member_list}</title>
{$headerinclude}
</head>
<body>
{$header}
<form method="post" action="memberlist.php">
<table border="0" cellspacing="{$theme['borderwidth']}" cellpadding="{$theme['tablespace']}" class="tborder">
<tr>
<td class="thead" colspan="3">
    <div class="float_right">
        <strong><a href="memberlist.php?action=search">{$lang->advanced_search}</a></strong>
    </div>
    <div><strong>{$lang->search_members}</strong></div>
</td>
</tr>
<tr>
    <td class="tcat"><strong><label for="username">{$lang->username}</label></strong></td>
    <td class="tcat mobile_hide"><strong><label for="website">{$lang->website}</label></strong></td>
    <td class="tcat"><strong><label for="sort">{$lang->sort_by}</label></strong></td>
</tr>
<tr>
    <td class="trow1" width="33%" style="vertical-align: top;">
        {$lang->contains}<br />
        <input type="text" class="textbox" name="username" id="username" style="width: 99%; margin-top: 4px;" value="{$search_username}" />
    </td>
    <td class="trow1 mobile_hide" width="33%" style="vertical-align: top;">
        {$lang->contains}<br />
        <input type="text" class="textbox" name="website" id="website" style="width: 99%; margin-top: 4px;" value="{$search_website}" />
    </td>
    <td class="trow1" width="33%">
        <div class="smalltext" style="margin-bottom: 3px;">
            <input type="radio" class="radio" name="order" id="order_asc" value="ascending"{$order_check['ascending']} /> <label for="order_asc">{$lang->order_asc}</label>&nbsp;<br />
            <input type="radio" class="radio" name="order" id="order_desc" value="descending"{$order_check['descending']} /> <label for="order_desc">{$lang->order_desc}</label>
        </div>
        <select name="sort" id="sort" style="width: 99%;">
            <option value="username"{$sort_selected['username']}>{$lang->sort_by_username}</option>
            <option value="regdate"{$sort_selected['regdate']}>{$lang->sort_by_regdate}</option>
            <option value="lastvisit"{$sort_selected['lastvisit']}>{$lang->sort_by_lastvisit}</option>
            <option value="postnum"{$sort_selected['postnum']}>{$lang->sort_by_posts}</option>
            <option value="threadnum"{$sort_selected['threadnum']}>{$lang->sort_by_threads}</option>
            <option value="referrals"{$sort_selected['referrals']}>{$lang->sort_by_referrals}</option>
        </select>
    </td>
</tr>
</table>
<div align="center"><br /><input type="submit" class="button" name="submit" value="{$lang->search}" /></div>
</form>
<br />
{$multipage}
<table border="0" cellspacing="{$theme['borderwidth']}" cellpadding="{$theme['tablespace']}" class="tborder">
<tr>
<td class="thead" colspan="7">
    <div class="float_right">
        <a href="memberlist.php?username_match=begins&amp;username={$lang->a}" style="padding: 5px;">{$lang->a}</a>
        <a href="memberlist.php?username_match=begins&amp;username={$lang->b}" style="padding: 5px;">{$lang->b}</a>
        <a href="memberlist.php?username_match=begins&amp;username={$lang->c}" style="padding: 5px;">{$lang->c}</a>
        <a href="memberlist.php?username_match=begins&amp;username={$lang->d}" style="padding: 5px;">{$lang->d}</a>
        <a href="memberlist.php?username_match=begins&amp;username={$lang->e}" style="padding: 5px;">{$lang->e}</a>
        <a href="memberlist.php?username_match=begins&amp;username={$lang->f}" style="padding: 5px;">{$lang->f}</a>
        <a href="memberlist.php?username_match=begins&amp;username={$lang->g}" style="padding: 5px;">{$lang->g}</a>
        <a href="memberlist.php?username_match=begins&amp;username={$lang->h}" style="padding: 5px;">{$lang->h}</a>
        <a href="memberlist.php?username_match=begins&amp;username={$lang->i}" style="padding: 5px;">{$lang->i}</a>
        <a href="memberlist.php?username_match=begins&amp;username={$lang->j}" style="padding: 5px;">{$lang->j}</a>
        <a href="memberlist.php?username_match=begins&amp;username={$lang->k}" style="padding: 5px;">{$lang->k}</a>
        <a href="memberlist.php?username_match=begins&amp;username={$lang->l}" style="padding: 5px;">{$lang->l}</a>
        <a href="memberlist.php?username_match=begins&amp;username={$lang->m}" style="padding: 5px;">{$lang->m}</a>
        <a href="memberlist.php?username_match=begins&amp;username={$lang->n}" style="padding: 5px;">{$lang->n}</a>
        <a href="memberlist.php?username_match=begins&amp;username={$lang->o}" style="padding: 5px;">{$lang->o}</a>
        <a href="memberlist.php?username_match=begins&amp;username={$lang->p}" style="padding: 5px;">{$lang->p}</a>
        <a href="memberlist.php?username_match=begins&amp;username={$lang->q}" style="padding: 5px;">{$lang->q}</a>
        <a href="memberlist.php?username_match=begins&amp;username={$lang->r}" style="padding: 5px;">{$lang->r}</a>
        <a href="memberlist.php?username_match=begins&amp;username={$lang->s}" style="padding: 5px;">{$lang->s}</a>
        <a href="memberlist.php?username_match=begins&amp;username={$lang->t}" style="padding: 5px;">{$lang->t}</a>
        <a href="memberlist.php?username_match=begins&amp;username={$lang->u}" style="padding: 5px;">{$lang->u}</a>
        <a href="memberlist.php?username_match=begins&amp;username={$lang->v}" style="padding: 5px;">{$lang->v}</a>
        <a href="memberlist.php?username_match=begins&amp;username={$lang->w}" style="padding: 5px;">{$lang->w}</a>
        <a href="memberlist.php?username_match=begins&amp;username={$lang->x}" style="padding: 5px;">{$lang->x}</a>
        <a href="memberlist.php?username_match=begins&amp;username={$lang->y}" style="padding: 5px;">{$lang->y}</a>
        <a href="memberlist.php?username_match=begins&amp;username={$lang->z}" style="padding: 5px;">{$lang->z}</a>
    </div>
    <div><strong>{$lang->member_list}</strong></div></td>
</tr>
<tr>
<td class="tcat" width="1%"><span class="smalltext"><strong>{$lang->avatar}</strong></span></td>
<td class="tcat"><span class="smalltext"><a href="{$sorturl}&amp;sort=username&amp;order=ascending"><strong>{$lang->username}</strong></a> {$orderarrow['username']}</span></td>
<td class="tcat mobile_hide" width="15%" align="center"><span class="smalltext"><a href="{$sorturl}&amp;sort=regdate&amp;order=ascending"><strong>{$lang->joined}</strong></a> {$orderarrow['regdate']}</span></td>
<td class="tcat mobile_hide" width="15%" align="center"><span class="smalltext"><a href="{$sorturl}&amp;sort=lastvisit&amp;order=descending"><strong>{$lang->lastvisit}</strong></a> {$orderarrow['lastvisit']}</span></td>
<td class="tcat mobile_hide" width="10%" align="center"><span class="smalltext"><a href="{$sorturl}&amp;sort=postnum&amp;order=descending"><strong>{$lang->posts}</strong></a> {$orderarrow['postnum']}</span></td>
<td class="tcat mobile_hide" width="10%" align="center"><span class="smalltext"><a href="{$sorturl}&amp;sort=threadnum&amp;order=descending"><strong>{$lang->threads}</strong></a> {$orderarrow['threadnum']}</span></td>
{$referral_header}
</tr>
{$users}
</table>
<div class="float_right" style="padding-top: 4px;">
    <a href="showteam.php"><strong>{$lang->forumteam}</strong></a>
</div>
{$multipage}
<br class="clear" />
{$footer}
<link rel="stylesheet" href="{$mybb->asset_url}/jscripts/select2/select2.css">
<script type="text/javascript" src="{$mybb->asset_url}/jscripts/select2/select2.min.js"></script>
<script type="text/javascript">
<!--
if(use_xmlhttprequest == "1")
{
    MyBB.select2();
    $("#username").select2({
        placeholder: "{$lang->search_user}",
        minimumInputLength: 3,
        maximumSelectionSize: 3,
        multiple: false,
        ajax: { // instead of writing the function to execute the request we use Select2's convenient helper
            url: "xmlhttp.php?action=get_users",
            dataType: 'json',
            data: function (term, page) {
                return {
                    query: term, // search term
                };
            },
            results: function (data, page) { // parse the results into the format expected by Select2.
                // since we are using custom formatting functions we do not need to alter remote JSON data
                return {results: data};
            }
        },
        initSelection: function(element, callback) {
            var value = $(element).val();
            if (value !== "") {
                callback({
                    id: value,
                    text: value
                });
            }
        },
       // Allow the user entered text to be selected as well
       createSearchChoice:function(term, data) {
            if ( $(data).filter( function() {
                return this.text.localeCompare(term)===0;
            }).length===0) {
                return {id:term, text:term};
            }
        },
    });
}
// -->
</script>
</body>
</html>
Spróbuj wgrać oryginalny plik memberlist.php
a memberlist_users?
Wgrałem oryginalny plik memberlist_users i działa.