예제 #1
0
 $sql = "SELECT * FROM " . STATS_MODULES_TABLE . "\n\tWHERE module_id = " . $module_id;
 $result = $db->sql_query($sql);
 $__stat_module_data[$module_id] = $db->sql_fetchrow($result);
 $module_info = generate_module_info($__stat_module_data[$module_id]);
 $module_name = trim($module_info['dname']);
 $auth_value = intval($module_info['auth_value']);
 $template->assign_vars(array('ACTIVE_CHECKED_YES' => intval($module_info['active']) == 1 ? 'checked="checked"' : '', 'ACTIVE_CHECKED_NO' => intval($module_info['active']) == 0 ? 'checked="checked"' : '', 'UPDATE_TIME' => $module_info['update_time'], 'MODULE_DNAME' => $module_info['dname'], 'S_AUTH_SELECT' => gen_auth_select($auth_value), 'MODULE_NAME' => $module_info['name']));
 // Compile the Module without using cache functions if it's active
 $return_limit = $__stats_config['return_limit'];
 // Start Time
 $stat_starttime = explode(' ', microtime());
 $stat_starttime = $stat_starttime[1] + $stat_starttime[0];
 $db->num_queries['total'] = 0;
 $mod_lang = 'module_language_parse';
 $__module_id = $module_id;
 $__module_info = generate_module_info($__stat_module_data[$__module_id]);
 $__module_name = $module_name;
 $__tpl_name = 'preview';
 $__module_root_path = './../' . IP_ROOT_PATH;
 $__module_data = $__stat_module_data[$__module_id];
 $statistics->result_cache_used = false;
 $statistics->db_cache_used = false;
 $stat_db->begin_cached_query();
 $result_cache->begin_cached_results();
 include IP_ROOT_PATH . $__stats_config['modules_dir'] . '/' . $__module_name . '_module.php';
 $stat_db->end_cached_query($__module_id);
 $result_cache->end_cached_query($__module_id);
 $template->set_filenames(array($__tpl_name => STATS_TPL . $__module_info['dname'] . '.tpl'));
 // End Time
 $stat_endtime = explode(' ', microtime());
 $stat_endtime = $stat_endtime[1] + $stat_endtime[0];
$result = $db->sql_query($sql);
$module_count = $db->sql_numrows($result);
$module_data = $db->sql_fetchrowset($result);
$template->_tpldata['stats_row_link.'] = array();
// for all installed modules output an inpage link
$num_modules = 0;
for ($i = 0; $i < $module_count; $i++) {
    // dont show the link to index and dont show this module itself
    if ($module_data[$i]['name'] != '_stats_overview_section' && $module_data[$i]['name'] != 'forum_index') {
        $module_dir = trim($module_data[$i]['name']);
        // unset (eventually included) language variable of last loop
        unset($mod_name);
        $mod_name = $lang['module_name_' . $module_data[$i]['name']];
        // fall back solution in case no appropriate language file was found or the variable was not declared (module name from txt file)
        if ($mod_name == '') {
            $other_module_info = generate_module_info($module_data[$i]);
            $mod_name = $other_module_info['name'];
        }
        $template->assign_block_vars('stats_row_link', array('START' => $num_modules % $num_columns == 0 ? '<tr>' : '', 'END' => $num_modules % $num_columns == $num_columns - 1 ? '</tr>' : '', 'COL_WIDTH' => $num_modules % $num_columns == $num_columns - 1 ? '' : ' width="' . floor(100 / $num_columns) . '%"', 'U_STATS_LINK' => IP_ROOT_PATH . 'statistics.' . PHP_EXT . '#s' . $module_data[$i]['module_id'], 'STATS_LINK' => $mod_name . $width));
        $num_modules++;
    }
    // add empty cells for padding the last table row
    $empty_cells = '';
    if ($num_modules % $num_columns != 0) {
        for ($j = 1; $j <= $num_columns - $num_modules % $num_columns; $j++) {
            $empty_cells .= '<td class="row1"><span class="gen">&nbsp;</span></td>';
        }
        $empty_cells .= '</tr>';
    }
}
$template->assign_vars(array('MODULE_NAME' => $my_lang_module_name, 'NUM_COLUMNS' => $num_columns, 'EMPTY_CELLS' => $empty_cells));