Advanced search  

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Pages: [1]   Go Down

Author Topic: Добавление статистики в плагин onlinestats  (Read 4400 times)

0 Members and 1 Guest are viewing this topic.

Shaman

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 37

Продолжая тему Файл anycontent.php - пример добавления статистики под списком категорий...
Плагин onlinestats использует только свой файл /plugins/onlinestats/include/init.inc.php, в котором указано только значения языковых файлов:

Code: [Select]
<?php

if (!defined('IN_COPPERMINE')) { die('Not in Coppermine...');}

// submit your lang file for this plugin on the coppermine forums
// plugin will try to use the configured language if it is available.

if (file_exists("./plugins/onlinestats/lang/{$CONFIG['lang']}.php")) {
  require 
"./plugins/onlinestats/lang/{$CONFIG['lang']}.php";
} else {
require 
"./plugins/onlinestats/lang/english.php";}

?>

При вставке в соответственные места файлов codebase.php или init.inc.php плагина строки

Code: [Select]
require('include/init.inc.php');
плагин отказывается подгружать этот файл и ругается.
Может есть смысл прописать определенные переменные init.inc.php плагина или есть более легкий метод?
Сам плагин о котором идет речь, лежит здесь.
Logged

Makc666

  • Moderator
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 1614
  • Русский (ISO-8859-1) - Russian - Русский (Windows)
    • Makc's home page

В файле:
codebase.php

в фунцию:
function online_mainpage()

после строки:
Code: [Select]
global $CONFIG, $cpg_udb, $matches, $lang_plugin_onlinestats, $lang_plugin_onlinestats_date_fmt;
добавьте строку:
Code: [Select]
global $statistics, $cat_data, $template_statistics;
В этой же функции после строки:
Code: [Select]
endtable();
добавьте блок:
Code: [Select]
<?php
    
if ($statistics && count($cat_data) > 0) {
        
$template template_extract_block($template_statistics'footer');
        
$params = array('{STATISTICS}' => $statistics);
        echo 
template_eval($template$params);
    }
?>

И конечно не забывает, что в файле:
./themes/classic/theme.php

У нас есть такой шаблон:
Code: [Select]
// HTML template for STATISTICS
$template_statistics = <<<EOT
<!-- BEGIN footer -->
        <tr>
                <td colspan="3" class="tableh1" align="center"><span class="statlink">{STATISTICS}</span></td>
        </tr>
<!-- END footer -->

EOT;
//{THEMES}
Logged

Shaman

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 37

Спасибо большое! Я поступил чуть по-другому:
Мой плагин onlinestats несколько изменен, потому точно не скажу, но вместо последнего действия я использовал код:
Code: [Select]
echo <<<EOT
    $statistics     
EOT;
в нужном мне месте. Пи этом theme.php изменять не надо :)
Logged
Pages: [1]   Go Up
 

Page created in 0.017 seconds with 15 queries.