Webmaster общности: Predpriemach.com | SearchEngines.bg

    Добавете още статистика в админ панела

    Автор: djvato

    Здравейте … с този уток вие добавяте още статистика във вашия админ панел Winking
    и така да несе бавим нека започнем направо с урока …

    отворете admin/index.php и намерете

    "L_GZIP_COMPRESSION" => $lang['Gzip_compression'])

    преди него добавете

    "L_BOARD_STATISTICS" => $lang['Board_Statistics'],
    "L_VERSION_STATISTICS" => $lang['Version_Statistics'],
    "L_MEMBERS_STATISTICS" => $lang['Members_Statistics'],
    "L_DATABASE_STATISTICS" => $lang['Database_Statistics'],
    "L_NUMBER_DEACTIVATED_USERS" => $lang['Thereof_deactivated_users'],
    "L_NUMBER_DEACTIVATED_USERS" => $lang['Thereof_deactivated_users'],
    "L_NAME_DEACTIVATED_USERS" => $lang['Deactivated_Users'],
    "L_NUMBER_MODERATORS" => $lang['Thereof_Moderators'],
    "L_NAME_MODERATORS" => $lang['Users_with_Mod_Privileges'],
    "L_NUMBER_ADMINISTRATORS" => $lang['Thereof_Administrators'],
    "L_NAME_ADMINISTRATORS" => $lang['Users_with_Admin_Privileges'],
    "L_DB_SIZE" => $lang['DB_size'],
    "L_PHPBB_VERSION" => $lang['Version_of_board'],
    "L_PHP_VERSION" => $lang['Version_of_PHP'],
    "L_MYSQL_VERSION" => $lang['Version_of_MySQL'],

    намирате

    $total_topics = get_db_stat('topiccount');

    след него добавяте

    $sql = "SELECT COUNT(user_id) AS total
    FROM " . USERS_TABLE . "
    WHERE user_active = 0
    AND user_id <> " . ANONYMOUS;
    if ( !($result = $db->sql_query($sql)) )
    {
    throw_error("Couldn't get statistic data!", __LINE__, __FILE__, $sql);
    }
    if ( $row = $db->sql_fetchrow($result) )
    {
    $total_deactivated_users = $row['total'];
    }
    else
    {
    throw_error("Couldn't update pending information!", __LINE__, __FILE__, $sql);
    }
    $db->sql_freeresult($result);
    $deactivated_names = '';
    $sql = "SELECT username
    FROM " . USERS_TABLE . "
    WHERE user_active = 0
    AND user_id <> " . ANONYMOUS . "
    ORDER BY username";
    if ( !($result = $db->sql_query($sql)) )
    {
    throw_error("Couldn't get statistic data!", __LINE__, __FILE__, $sql);
    }
    while ( $row = $db->sql_fetchrow($result) )
    {
    $deactivated_names .= (($deactivated_names == '') ? '' : ', ') . $row['username'];
    }
    $db->sql_freeresult($result);
    $sql = "SELECT COUNT(user_id) AS total
    FROM " . USERS_TABLE . "
    WHERE user_level = " . MOD . "
    AND user_id <> " . ANONYMOUS;
    if ( !($result = $db->sql_query($sql)) )
    {
    throw_error("Couldn't get statistic data!", __LINE__, __FILE__, $sql);
    }
    if ( $row = $db->sql_fetchrow($result) )
    {
    $total_moderators = $row['total'];
    }
    else
    {
    throw_error("Couldn't update pending information!", __LINE__, __FILE__, $sql);
    }
    $db->sql_freeresult($result);
    $moderator_names = '';
    $sql = "SELECT username
    FROM " . USERS_TABLE . "
    WHERE user_level = " . MOD . "
    AND user_id <> " . ANONYMOUS . "
    ORDER BY username";
    if ( !($result = $db->sql_query($sql)) )
    {
    throw_error("Couldn't get statistic data!", __LINE__, __FILE__, $sql);
    }
    while ( $row = $db->sql_fetchrow($result) )
    {
    $moderator_names .= (($moderator_names == '') ? '' : ', ') . $row['username'];
    }
    $db->sql_freeresult($result);
    $sql = "SELECT COUNT(user_id) AS total
    FROM " . USERS_TABLE . "
    WHERE user_level = " . ADMIN . "
    AND user_id <> " . ANONYMOUS;
    if ( !($result = $db->sql_query($sql)) )
    {
    throw_error("Couldn't get statistic data!", __LINE__, __FILE__, $sql);
    }
    if ( $row = $db->sql_fetchrow($result) )
    {
    $total_administrators = $row['total'];
    }
    else
    {
    throw_error("Couldn't update pending information!", __LINE__, __FILE__, $sql);
    }
    $db->sql_freeresult($result);
    $administrator_names = '';
    $sql = "SELECT username
    FROM " . USERS_TABLE . "
    WHERE user_level = " . ADMIN . "
    AND user_id <> " . ANONYMOUS . "
    ORDER BY username";
    if ( !($result = $db->sql_query($sql)) )
    {
    throw_error("Couldn't get statistic data!", __LINE__, __FILE__, $sql);
    }
    while ( $row = $db->sql_fetchrow($result) )
    {
    $administrator_names .= (($administrator_names == '') ? '' : ', ') . $row['username'];
    }

    намирате

    else
    {
    $dbsize = sprintf("%.2f Bytes", $dbsize);
    }
    }

    след него добавяте

    $sql = "SELECT VERSION() AS mysql_version";
    $result = $db->sql_query($sql);
    if ( !$result )
    {
    throw_error("Couldn't obtain MySQL Version", __LINE__, __FILE__, $sql);
    }
    $row = $db->sql_fetchrow($result);
    $mysql_version = $row['mysql_version'];
    $db->sql_freeresult($result);
    

    намирате

    "GZIP_COMPRESSION" => ( $board_config['gzip_compress'] ) ? $lang['ON'] : $lang['OFF'])

    преди него добавяте

    "PHPBB_VERSION" => '2' . $board_config['version'],
    "PHP_VERSION" => phpversion(),
    "MYSQL_VERSION" => $mysql_version,
    "NUMBER_OF_DEACTIVATED_USERS" => $total_deactivated_users,
    "NUMBER_OF_MODERATORS" => $total_moderators,
    "NUMBER_OF_ADMINISTRATORS" => $total_administrators,
    "NAMES_OF_ADMINISTRATORS" => htmlspecialchars($administrator_names),
    "NAMES_OF_MODERATORS" => htmlspecialchars($moderator_names),
    "NAMES_OF_DEACTIVATED" => htmlspecialchars($deactivated_names),

    отваряте language/lang_вашия темплейт/lang_admin.php и намирате

    //
    // That's all Folks!
    // -------------------------------------------------

    преди него добавете

    //
    //Advance Admin Index
    //
    $lang['Members_Statistics'] = 'Потребители Статистика';
    $lang['Version_Statistics'] = 'Версия статистика';
    $lang['Board_Statistics'] = 'Форум Статистика';
    $lang['Database_Statistics'] = 'База данни статистика';
    $lang['Thereof_deactivated_users'] = 'Потребители който не са активирани';
    $lang['Thereof_Moderators'] = 'Модератори';
    $lang['Thereof_Administrators'] = 'Администратори';
    $lang['Deactivated_Users'] = 'Потребители който искат да се активират';
    $lang['Users_with_Admin_Privileges'] = 'Потребители с администратор. превилегии ';
    $lang['Users_with_Mod_Privileges'] = 'Потребители с модератор. превилегии ';
    $lang['DB_size'] = 'Големина на базата данни';
    $lang['Version_of_board'] = 'Версия <a href="http://www.phpbb.com">phpbb</a>';
    $lang['Version_of_PHP'] = 'Версия <a href="http://www.php.net/">PHP</a>';
    $lang['Version_of_MySQL'] = 'Версия <a href="http://www.mysql.com/">MySQL</a>';

    отваряте templates/subSilver/admin/index_body.tpl и намирате

    <tr>
    <th width="25%" nowrap height="25" class="thCornerL">{L_STATISTIC}</th>
    <th width="25%" height="25" class="thTop">{L_VALUE}</th>
    <th width="25%" nowrap height="25" class="thTop">{L_STATISTIC}</th>
    <th width="25%" height="25" class="thCornerR">{L_VALUE}</th>
    </tr>
    <tr>
    <td class="row1" nowrap>{L_NUMBER_POSTS}:</td>
    <td class="row2"><b>{NUMBER_OF_POSTS}</b></td>
    <td class="row1" nowrap>{L_POSTS_PER_DAY}:</td>
    <td class="row2"><b>{POSTS_PER_DAY}</b></td>
    </tr>
    <tr>
    <td class="row1" nowrap>{L_NUMBER_TOPICS}:</td>
    <td class="row2"><b>{NUMBER_OF_TOPICS}</b></td>
    <td class="row1" nowrap>{L_TOPICS_PER_DAY}:</td>
    <td class="row2"><b>{TOPICS_PER_DAY}</b></td>
    </tr>
    <tr>
    <td class="row1" nowrap>{L_NUMBER_USERS}:</td>
    <td class="row2"><b>{NUMBER_OF_USERS}</b></td>
    <td class="row1" nowrap>{L_USERS_PER_DAY}:</td>
    <td class="row2"><b>{USERS_PER_DAY}</b></td>
    </tr>
    <tr>
    <td class="row1" nowrap>{L_BOARD_STARTED}:</td>
    <td class="row2"><b>{START_DATE}</b></td>
    <td class="row1" nowrap>{L_AVATAR_DIR_SIZE}:</td>
    <td class="row2"><b>{AVATAR_DIR_SIZE}</b></td>
    </tr>
    <tr>
    <td class="row1" nowrap>{L_DB_SIZE}:</td>
    <td class="row2"><b>{DB_SIZE}</b></td>
    <td class="row1" nowrap>{L_GZIP_COMPRESSION}:</td>
    <td class="row2"><b>{GZIP_COMPRESSION}</b></td>
    </tr>

    заменяне го с

    <tr>
    <th class="thHead" colspan="3">{L_DATABASE_STATISTICS}</th>
    </tr>
    <tr>
    <td class="row1" colspan="2" width="33%">{L_DB_SIZE}:</td>
    <td class="row2" width="67%"><b>{DB_SIZE}</b></td>
    </tr>
    <tr>
    <td class="row1" nowrap colspan="2" width="33%">{L_AVATAR_DIR_SIZE}:</td>
    <td class="row2" width="67%"><b>{AVATAR_DIR_SIZE}</b></td>
    </tr>
    <tr>
    <td class="row1" nowrap colspan="2" width="33%">{L_GZIP_COMPRESSION}:</td>
    <td class="row2" width="67%"><b>{GZIP_COMPRESSION}</b></td>
    </tr>
    </table>
    <br />
    <table width="100%" cellspacing="1" cellpadding="4" border="0" align="center" class="forumline">
    <tr>
    <th class="thHead" colspan="3">{L_MEMBERS_STATISTICS}</th>
    </tr>
    <tr>
    <td class="row1" colspan="2" width="33%">{L_NUMBER_USERS}:</td>
    <td class="row2" width="67%"><b>{NUMBER_OF_USERS}</b></td>
    </tr>
    <tr>
    <td class="row3" width="10"> </td>
    <td class="row1">{L_USERS_PER_DAY}:</td>
    <td class="row2"><b>{USERS_PER_DAY}</b></td>
    </tr>
    <tr>
    <td class="row1" colspan="2" width="33%">{L_NUMBER_DEACTIVATED_USERS}:</td>
    <td class="row2" width="67%"><b>{NUMBER_OF_DEACTIVATED_USERS}</b></td>
    </tr>
    <tr>
    <td class="row1" colspan="2" width="33%">{L_NAME_DEACTIVATED_USERS}:</td>
    <td class="row2" width="67%"><b>{NAMES_OF__DEACTIVATED}</b></td>
    </tr>
    <tr>
    <td class="row1" colspan="2" width="33%">{L_NUMBER_ADMINISTRATORS}:</td>
    <td class="row2" width="67%"><b>{NUMBER_OF_ADMINISTRATORS}</b></td>
    </tr>
    <tr>
    <td class="row3" width="10"> </td>
    <td class="row1">{L_NAME_ADMINISTRATORS}:</td>
    <td class="row2"><font color="#FF0000"><b>{NAMES_OF_ADMINISTRATORS}</b></font></td>
    </tr>
    <tr>
    <td class="row1" colspan="2" width="33%">{L_NUMBER_MODERATORS}:</td>
    <td class="row2" width="67%"><b>{NUMBER_OF_MODERATORS}</b></td>
    </tr>
    <tr>
    <td class="row3" width="10"> </td>
    <td class="row1">{L_NAME_MODERATORS}:</td>
    <td class="row2"><b>{NAMES_OF_MODERATORS}</b></td>
    </tr>
    <tr>
    <td class="spaceRow" height="1" colspan="3"><img src="templates/subSilver/images/spacer.gif" alt="" width="1" height="1" /></td>
    </tr>
    </table>
    <br />
    <table width="100%" cellspacing="1" cellpadding="4" border="0" align="center" class="forumline">
    <tr>
    <th class="thHead" colspan="3">{L_VERSION_STATISTICS}</th>
    </tr>
    <tr>
    <td class="row1" nowrap colspan="2" width="33%">{L_PHPBB_VERSION}:</td>
    <td class="row2" width="67%"><b>{PHPBB_VERSION}</b></td>
    </tr>
    <tr>
    <td class="row1" nowrap colspan="2" width="33%">{L_PHP_VERSION}:</td>
    <td class="row2" width="67%"><b>{PHP_VERSION}</b></td>
    </tr>
    <tr>
    <td class="row1" nowrap colspan="2" width="33%">{L_MYSQL_VERSION}:</td>
    <td class="row2" width="67%"><b>{MYSQL_VERSION}</b></td>
    </tr>
    <tr>
    <td class="spaceRow" height="1" colspan="3"><img src="templates/subSilver/images/spacer.gif" alt="" width="1" height="1" /></td>
    </tr>
    </table>
    <br />
    <table width="100%" cellspacing="1" cellpadding="4" border="0" align="center" class="forumline">
    <tr>
    <th class="thHead" colspan="3">{L_BOARD_STATISTICS}</th>
    </tr>
    <tr>
    <td class="row1" nowrap colspan="2" width="33%">{L_BOARD_STARTED}:</td>
    <td class="row2" width="67%"><b>{START_DATE}</b></td>
    </tr>
    <tr>
    <td class="row1" nowrap colspan="2" width="33%">{L_NUMBER_POSTS}:</td>
    <td class="row2" width="67%"><b>{NUMBER_OF_POSTS}</b></td>
    </tr>
    <tr>
    <td class="row3" width="10"> </td>
    <td class="row1">{L_POSTS_PER_DAY}:</td>
    <td class="row2"><b>{POSTS_PER_DAY}</b></td>
    </tr>
    <tr>
    <td class="row1" nowrap colspan="2" width="33%">{L_NUMBER_TOPICS}:</td>
    <td class="row2" width="67%"><b>{NUMBER_OF_TOPICS}</b></td>
    </tr>
    <tr>
    <td class="row3" width="10"> </td>
    <td class="row1">{L_TOPICS_PER_DAY}:</td>
    <td class="row2"><b>{TOPICS_PER_DAY}</b></td>
    </tr>
    <tr>
    <td class="spaceRow" height="1" colspan="3"><img src="templates/subSilver/images/spacer.gif" alt="" width="1" height="1" /></td>
    </tr>

    Оставете коментар