Could not connect to the database ( statistics_mod )

Hulp nodig bij een modificaties of op zoek naar een MOD? Bekijk ons archief. Support wordt helaas niet meer verleend.
Forumregels

Sinds 1 januari 2009 wordt phpBB2 niet meer ondersteund.
Onderstaande informatie is verouderd en dient uitsluitend als archief.
phpBB2.0.x
Gebruikersavatar
Diablo Gamer
Berichten: 1394
Lid geworden op: 02 jan 2004, 20:33
Locatie: Dalen/Drenthe/Holland
Contacteer:

Could not connect to the database ( statistics_mod )

Bericht door Diablo Gamer » 06 nov 2005, 02:06

Support template:
  • Wat is het probleem? Could not connect to the database
    Wanneer ontstond het probleem? naar het installen van deze mod
    Adres van je forum: http://www.torrentgame.nl/forum/
    Geïnstalleerde mods: jep
    Huidige template: fiblue3d
    phpBB versie: 2.0.18
    Host: aurelius.tiscali.nl
    Heb je onlangs een mod of stijl geïnstalleerd? nop
    Heb je gezocht naar een antwoord? ja via google

Overige opmerkingen:

ik probeer mijn een DB update te doen via mod_table_inst.php maar dan krijg ik deze melding ( zie sceen )

Afbeelding
It`s nice to be important, but it`s more important to be nice.

Gebruikersavatar
mattle
Berichten: 848
Lid geworden op: 05 mar 2005, 07:40
Locatie: Doetinchem
Contacteer:

Bericht door mattle » 06 nov 2005, 08:45

doet de rest van je forum wel?

Gebruikersavatar
Bee
Berichten: 13403
Lid geworden op: 29 aug 2004, 10:30

Bericht door Bee » 06 nov 2005, 09:23

Code: Selecteer alles

CREATE TABLE phpbb_stats_config (
   config_name varchar(50) NOT NULL,
   config_value varchar(50) NOT NULL,
   CONSTRAINT phpbb_attachments_config_pkey PRIMARY KEY (config_name)
);

CREATE TABLE phpbb_stats_modules (
  module_id int4 NOT NULL DEFAULT 0,
  name varchar(150) NOT NULL default '',
  active int2 NOT NULL default 0,
  installed int2 NOT NULL default 0,
  display_order int4 NOT NULL default 0,
  update_time int4 NOT NULL default 0,
  auth_value int2 NOT NULL default 0,
  module_info_cache text,
  module_db_cache text,
  module_result_cache text,
  module_info_time int4 NOT NULL default 0,
  module_cache_time int4 NOT NULL default 0,
  CONSTRAINT phpbb_stats_modules_pkey PRIMARY KEY (module_id)
);

INSERT INTO phpbb_stats_config (config_name, config_value) VALUES ('install_date', 'HIER_JE_UNIX_TIMESTAMP');
INSERT INTO phpbb_stats_config (config_name, config_value) VALUES ('return_limit', '10');
INSERT INTO phpbb_stats_config (config_name, config_value) VALUES ('version', '2.1.5');
INSERT INTO phpbb_stats_config (config_name, config_value) VALUES ('modules_dir', 'stat_modules');
INSERT INTO phpbb_stats_config (config_name, config_value) VALUES ('page_views', '0');
Vervang HIER_JE_UNIX_TIMESTAMP door een zelfgemaakte timestamp van het tijdstip dat je dit gaat uitvoeren.
... Maar ik modereer (nog) niet.

Gebruikersavatar
Diablo Gamer
Berichten: 1394
Lid geworden op: 02 jan 2004, 20:33
Locatie: Dalen/Drenthe/Holland
Contacteer:

Bericht door Diablo Gamer » 06 nov 2005, 13:35

oke nu krijg ik geen errors meer maar nu kan ik weer geen Statistieken Modules Installeeren & Activeren


dit is de hele mod_table_inst.php

Code: Selecteer alles

<?
/***************************************************************************
 *                            mod_table_inst.php
 *                            -------------------
 *   begin                : Sunday, Jan 13, 2002
 *   copyright            : (C) 2002 Meik Sievertsen
 *   email                : acyd.burn@gmx.de
 *
 *   $Id: mod_table_inst.php,v 1.7 2003/02/05 21:45:30 acydburn Exp $
 *
 ***************************************************************************/

/***************************************************************************
 *
 *   This program is free software; you can redistribute it and/or modify
 *   it under the terms of the GNU General Public License as published by
 *   the Free Software Foundation; either version 2 of the License, or
 *   (at your option) any later version.
 *
 ***************************************************************************/

define('IN_PHPBB', true);

$phpbb_root_path = './';
include($phpbb_root_path.'extension.inc');
include($phpbb_root_path.'common.'.$phpEx);	
	
$userdata = session_pagestart($user_ip, PAGE_INDEX);
init_userprefs($userdata);

if ( (!isset($dbms)) || ($dbms == 'oracle') || ($dbms == 'msaccess') )
{
	message_die(GENERAL_ERROR, "This Mod does not support Oracle and MsAccess Databases.");
}

include($phpbb_root_path.'includes/db.'.$phpEx);

//
// Run a complete SQL-Statement, this could be an array
//
function evaluate_statement($sql_query, $hide = FALSE, $replace = FALSE)
{
	global $table_prefix, $remove_remarks, $delimiter, $db;
	
	$errored = FALSE;
	if ($replace)
	{
		$sql_query = preg_replace('/phpbb_/', $table_prefix, $sql_query);
	}

	$sql_query = $remove_remarks($sql_query);
	$sql_query = split_sql_file($sql_query, $delimiter);

	$sql_count = count($sql_query);

	for($i = 0; $i < $sql_count; $i++)
	{
		if (!$hide)
		{
			echo "Running :: " . $sql_query[$i];
		}
		flush();

		if ( !($result = $db->sql_query($sql_query[$i])) )
		{
			$errored = true;
			$error = $db->sql_error();
			if (!$hide)
			{
				echo " -> <b>FAILED</b> ---> <u>" . $error['message'] . "</u><br /><br />\n\n";
			}
		}
		else
		{
			if (!$hide)
			{
				echo " -> <b><span class=\"ok\">COMPLETED</span></b><br /><br />\n\n";
			}
		}
	}

	if ($errored)
	{
		return (FALSE);
	}
	else
	{
		return $result;
	}
}

function fill_new_table_data($dbms)
{
	
	$data = '';

	if ( ($dbms == 'mysql') || ($dbms == 'mysql4') )
	{
		$data = '
CREATE TABLE phpbb_stats_config (
  config_name varchar(50) NOT NULL default \'\',
  config_value varchar(255) NOT NULL default \'\',
  PRIMARY KEY (config_name)
);

CREATE TABLE phpbb_stats_modules (
  module_id tinyint(8) NOT NULL default \'0\',
  name varchar(150) NOT NULL default \'\',
  active tinyint(1) NOT NULL default \'0\',
  installed tinyint(1) NOT NULL default \'0\',
  display_order mediumint(8) unsigned NOT NULL default \'0\',
  update_time mediumint(8) unsigned NOT NULL default \'0\',
  auth_value tinyint(2) NOT NULL default \'0\',
  module_info_cache blob,
  module_db_cache blob,
  module_result_cache blob,
  module_info_time int(10) unsigned NOT NULL default \'0\',
  module_cache_time int(10) unsigned NOT NULL default \'0\',
  PRIMARY KEY (module_id)
);

INSERT INTO phpbb_stats_config (config_name, config_value) VALUES (\'install_date\', \'' . time() . '\');
INSERT INTO phpbb_stats_config (config_name, config_value) VALUES (\'return_limit\', \'10\');
INSERT INTO phpbb_stats_config (config_name, config_value) VALUES (\'version\', \'2.1.5\');
INSERT INTO phpbb_stats_config (config_name, config_value) VALUES (\'modules_dir\', \'stat_modules\');
INSERT INTO phpbb_stats_config (config_name, config_value) VALUES (\'page_views\', \'0\');
';
	}
	else if ( ($dbms == 'mssql') || ($dbms == 'mssql-odbc') )
	{
		$data = '
BEGIN TRANSACTION
GO

CREATE TABLE [phpbb_stats_config] (
	[config_name] [varchar] (50) NOT NULL ,
	[config_value] [varchar] (50) NOT NULL 
) ON [PRIMARY]
GO

ALTER TABLE [phpbb_stats_config] WITH NOCHECK ADD 
	CONSTRAINT [PK_phpbb_stats_config] PRIMARY KEY CLUSTERED 
	(
		[config_name]
	)  ON [PRIMARY] 
GO

CREATE TABLE [phpbb_stats_modules] (
	[module_id] [int] NOT NULL ,
	[name] [char] (150) NOT NULL ,
	[active] [int] NOT NULL,
	[installed] [int] NOT NULL,
	[display_order] [int] NOT NULL,
	[update_time] [int] NOT NULL,
	[auth_value] [int] NOT NULL,
	[module_info_cache] [text],
	[module_db_cache] [text],
	[module_result_cache] [text],
	[module_info_time] [int] NOT NULL,
	[module_cache_time] [int] NOT NULL
) ON [PRIMARY]
GO

ALTER TABLE [phpbb_stats_modules] WITH NOCHECK ADD 
	CONSTRAINT [PK_phpbb_stats_modules] PRIMARY KEY  CLUSTERED 
	(
		[module_id]
	)  ON [PRIMARY] 
GO

ALTER TABLE [phpbb_stats_modules] WITH NOCHECK ADD 
	CONSTRAINT [DF_phpbb_stats_modules_module_id] DEFAULT (0) FOR [module_id],
	CONSTRAINT [DF_phpbb_stats_modules_active] DEFAULT (0) FOR [active],
	CONSTRAINT [DF_phpbb_stats_modules_installed] DEFAULT (0) FOR [installed],
	CONSTRAINT [DF_phpbb_stats_modules_display_order] DEFAULT (0) FOR [display_order],
	CONSTRAINT [DF_phpbb_stats_modules_update_time] DEFAULT (0) FOR [update_time],
	CONSTRAINT [DF_phpbb_stats_modules_auth_value] DEFAULT (0) FOR [auth_value],
	CONSTRAINT [DF_phpbb_stats_modules_module_info_time] DEFAULT (0) FOR [module_info_time],
	CONSTRAINT [DF_phpbb_stats_modules_module_cache_time] DEFAULT (0) FOR [module_cache_time]
GO

INSERT INTO phpbb_stats_config (config_name, config_value) VALUES (\'install_date\', \'' . time() . '\');
INSERT INTO phpbb_stats_config (config_name, config_value) VALUES (\'return_limit\', \'10\');
INSERT INTO phpbb_stats_config (config_name, config_value) VALUES (\'version\', \'2.1.5\');
INSERT INTO phpbb_stats_config (config_name, config_value) VALUES (\'modules_dir\', \'stat_modules\');
INSERT INTO phpbb_stats_config (config_name, config_value) VALUES (\'page_views\', \'0\');

COMMIT
GO
	';
	}
	else if ($dbms == 'postgres')
	{
		$data = '
CREATE TABLE phpbb_stats_config (
   config_name varchar(50) NOT NULL,
   config_value varchar(50) NOT NULL,
   CONSTRAINT phpbb_attachments_config_pkey PRIMARY KEY (config_name)
);

CREATE TABLE phpbb_stats_modules (
  module_id int4 NOT NULL DEFAULT 0,
  name varchar(150) NOT NULL default \'\',
  active int2 NOT NULL default 0,
  installed int2 NOT NULL default 0,
  display_order int4 NOT NULL default 0,
  update_time int4 NOT NULL default 0,
  auth_value int2 NOT NULL default 0,
  module_info_cache text,
  module_db_cache text,
  module_result_cache text,
  module_info_time int4 NOT NULL default 0,
  module_cache_time int4 NOT NULL default 0,
  CONSTRAINT phpbb_stats_modules_pkey PRIMARY KEY (module_id)
);

INSERT INTO phpbb_stats_config (config_name, config_value) VALUES (\'install_date\', \'' . time() . '\');
INSERT INTO phpbb_stats_config (config_name, config_value) VALUES (\'return_limit\', \'10\');
INSERT INTO phpbb_stats_config (config_name, config_value) VALUES (\'version\', \'2.1.5\');
INSERT INTO phpbb_stats_config (config_name, config_value) VALUES (\'modules_dir\', \'stat_modules\');
INSERT INTO phpbb_stats_config (config_name, config_value) VALUES (\'page_views\', \'0\');
';
	}

	return $data;
}

?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;">
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css">
<!--

font,th,td,p,body { font-family: "Courier New", courier; font-size: 11pt }

a:link,a:active,a:visited { color : #006699; }
a:hover		{ text-decoration: underline; color : #DD6900;}

hr	{ height: 0px; border: solid #D1D7DC 0px; border-top-width: 1px;}

.maintitle,h1,h2	{font-weight: bold; font-size: 22px; font-family: "Trebuchet MS",Verdana, Arial, Helvetica, sans-serif; text-decoration: none; line-height : 120%; color : #000000;}

.ok {color:green}

/* Import the fancy styles for IE only (NS4.x doesn't use the @import function) */
@import url("templates/subSilver/formIE.css"); 
-->
</style>
</head>
<body bgcolor="#FFFFFF" text="#000000" link="#006699" vlink="#5584AA">

<table width="100%" border="0" cellspacing="0" cellpadding="10" align="center"> 
	<tr>
		<td><table width="100%" border="0" cellspacing="0" cellpadding="0">
			<tr>
				<td><img src="templates/subSilver/images/logo_phpBB.gif" border="0" alt="Forum Home" vspace="1" /></td>
				<td align="center" width="100%" valign="middle"><span class="maintitle">Installing Statistics Mod Version 2.1.5</span></td>
			</tr>
		</table></td>
	</tr>
</table>

<br clear="all" />

<?

//
// Here we go
//
include($phpbb_root_path.'includes/sql_parse.'.$phpEx);

$available_dbms = array(
	"mysql" => array(
		"DELIM" => ";",
		"DELIM_BASIC" => ";",
		"COMMENTS" => "remove_remarks"
	), 
	"mysql4" => array(
		"DELIM" => ";", 
		"DELIM_BASIC" => ";",
		"COMMENTS" => "remove_remarks"
	),
	"mssql" => array(
		"DELIM" => "GO", 
		"DELIM_BASIC" => ";",
		"COMMENTS" => "remove_comments"
	),
	"mssql-odbc" =>	array(
		"DELIM" => "GO",
		"DELIM_BASIC" => ";",
		"COMMENTS" => "remove_comments"
	),
	"postgres" => array(
		"LABEL" => "PostgreSQL 7.x",
		"DELIM" => ";", 
		"DELIM_BASIC" => ";",
		"COMMENTS" => "remove_comments"
	)
);

$remove_remarks = $available_dbms[$dbms]['COMMENTS'];;
$delimiter = $available_dbms[$dbms]['DELIM']; 
$delimiter_basic = $available_dbms[$dbms]['DELIM_BASIC']; 

$sql_query = fill_new_table_data($dbms);

$result = evaluate_statement($sql_query, false, true);

$message = '';

if ( !$result )
{
	$message .= "<br />Some queries failed. Please contact me via email, pm, at the board or whatever, so we can solve your problems...<br />";
}
else
{
	$message .= "<br />Statistics Mod Tables generated successfully.";
}

echo "\n<br />\n<b>COMPLETE! Go to the Administration Panel and Install Modules. You have to install and activate Modules before you are able to see anything within the statistics page.</b><br />\n";
echo $message . "<br />";
echo "<br /><b>NOW DELETE THIS FILE</b><br />\n";
echo "</body>";
echo "</html>";

?>
It`s nice to be important, but it`s more important to be nice.

Gebruikersavatar
Bee
Berichten: 13403
Lid geworden op: 29 aug 2004, 10:30

Bericht door Bee » 06 nov 2005, 13:55

Er zijn verder geen SQL opdrachten die je hoeft te doen, dat had ik al gecontroleerd, dus dit moet ergens anders achter te zoeken zijn,
... Maar ik modereer (nog) niet.

Gebruikersavatar
Diablo Gamer
Berichten: 1394
Lid geworden op: 02 jan 2004, 20:33
Locatie: Dalen/Drenthe/Holland
Contacteer:

Bericht door Diablo Gamer » 06 nov 2005, 14:05

anders wacht ik wel even er mee tot dat Acyd Burn ( http://www.opentools.de ) deze mod een update geeft
It`s nice to be important, but it`s more important to be nice.

Gebruikersavatar
Paul
Beheerder
Beheerder
Berichten: 20315
Lid geworden op: 23 okt 2003, 11:38
Locatie: Utrecht
Contacteer:

Bericht door Paul » 06 nov 2005, 17:25

Denk niet die ie hem update meer :)
gebruik je extreme styles?

Makavelibrox
Berichten: 402
Lid geworden op: 01 jul 2005, 18:02
Contacteer:

Bericht door Makavelibrox » 08 nov 2005, 16:11

Bee schreef:

Code: Selecteer alles

CREATE TABLE phpbb_stats_config (
   config_name varchar(50) NOT NULL,
   config_value varchar(50) NOT NULL,
   CONSTRAINT phpbb_attachments_config_pkey PRIMARY KEY (config_name)
);

CREATE TABLE phpbb_stats_modules (
  module_id int4 NOT NULL DEFAULT 0,
  name varchar(150) NOT NULL default '',
  active int2 NOT NULL default 0,
  installed int2 NOT NULL default 0,
  display_order int4 NOT NULL default 0,
  update_time int4 NOT NULL default 0,
  auth_value int2 NOT NULL default 0,
  module_info_cache text,
  module_db_cache text,
  module_result_cache text,
  module_info_time int4 NOT NULL default 0,
  module_cache_time int4 NOT NULL default 0,
  CONSTRAINT phpbb_stats_modules_pkey PRIMARY KEY (module_id)
);

INSERT INTO phpbb_stats_config (config_name, config_value) VALUES ('install_date', 'HIER_JE_UNIX_TIMESTAMP');
INSERT INTO phpbb_stats_config (config_name, config_value) VALUES ('return_limit', '10');
INSERT INTO phpbb_stats_config (config_name, config_value) VALUES ('version', '2.1.5');
INSERT INTO phpbb_stats_config (config_name, config_value) VALUES ('modules_dir', 'stat_modules');
INSERT INTO phpbb_stats_config (config_name, config_value) VALUES ('page_views', '0');
Vervang HIER_JE_UNIX_TIMESTAMP door een zelfgemaakte timestamp van het tijdstip dat je dit gaat uitvoeren.
Wil je een voorbeeld geven, hoe je die UNIX TIMESTAMP moet aanpassen?

Gebruikersavatar
Bee
Berichten: 13403
Lid geworden op: 29 aug 2004, 10:30

Bericht door Bee » 08 nov 2005, 17:00

Tuesday, November 8th 2005, 14:59:51 (GMT +1) translates to 1131461991
http://www.4webhelp.net/us/timestamp.ph ... timezone=1
... Maar ik modereer (nog) niet.

Makavelibrox
Berichten: 402
Lid geworden op: 01 jul 2005, 18:02
Contacteer:

Bericht door Makavelibrox » 08 nov 2005, 22:36

http://www.4webhelp.net/us/timestamp.ph ... timezone=0

Code: Selecteer alles

Uw SQL-query is succesvol uitgevoerd.
SQL-query: 
CREATE TABLE phpbb_stats_config(
config_name varchar( 50 ) NOT NULL ,
config_value varchar( 50 ) NOT NULL ,
CONSTRAINT phpbb_attachments_config_pkey PRIMARY KEY ( config_name )
);# MySQL gaf een lege resultaat set terug (0 rijen).
CREATE TABLE phpbb_stats_modules(
module_id int4 NOT NULL DEFAULT 0,
name varchar( 150 ) NOT NULL default '',
active int2 NOT NULL default 0,
installed int2 NOT NULL default 0,
display_order int4 NOT NULL default 0,
update_time int4 NOT NULL default 0,
auth_value int2 NOT NULL default 0,
module_info_cache text,
module_db_cache text,
module_result_cache text,
module_info_time int4 NOT NULL default 0,
module_cache_time int4 NOT NULL default 0,
CONSTRAINT phpbb_stats_modules_pkey PRIMARY KEY ( module_id )
);# MySQL gaf een lege resultaat set terug (0 rijen).
INSERT INTO phpbb_stats_config( config_name, config_value )
VALUES (
'install_date', '1131489210'
);# Getroffen rijen:1
INSERT INTO phpbb_stats_config( config_name, config_value )
VALUES (
'return_limit', '10'
);# Getroffen rijen:1
INSERT INTO phpbb_stats_config( config_name, config_value )
VALUES (
'version', '2.1.5'
);# Getroffen rijen:1
INSERT INTO phpbb_stats_config( config_name, config_value )
VALUES (
'modules_dir', 'stat_modules'
);# Getroffen rijen:1
INSERT INTO phpbb_stats_config( config_name, config_value )
VALUES (
'page_views', '0'
);# Getroffen rijen:1
--> http://www.yoursite.com/phpBB2/mod_table_inst.php

--> phpBB : Critical Error

Could not connect to the database

en nu :thumb:

Gebruikersavatar
Bee
Berichten: 13403
Lid geworden op: 29 aug 2004, 10:30

Bericht door Bee » 08 nov 2005, 22:51

Je hebt de SQL uitgevoerd, dus is de installatie niet meer nodig.
... Maar ik modereer (nog) niet.

Makavelibrox
Berichten: 402
Lid geworden op: 01 jul 2005, 18:02
Contacteer:

Bericht door Makavelibrox » 09 nov 2005, 16:59

Oke,

ik heb alle files op de juiste manier ge-upload, zoals in de install beschreven stond.

install.txt:

Code: Selecteer alles

#################################################################
## Mod Title:    Board Statistics
## Mod Version:  2.1.5
## Mod Author: Acyd Burn < acyd.burn@gmx.de > - Meik Sievertsen ( http://www.opentools.de/board )
## Mod Description:
##	Original Idea and Statistics Mod 2.0.x (c) Nivisec
##
##	(This Description comes from the Original Statistics Mod V2.0.0b, made by Nivisec)
##    The Statistics Mod is a complete statistics core
##    for your phpBB 2 board.
##
##    Unlike the previous 1.x versions, it now does not rely on hard coded
##    statistics, but instead uses modules. Users may enable/disable modules
##    from the admin control panel and they are very easy to install. Just
##    upload the module directory into your statistics module directory that
##    you define in the admin control panel.
##
##    You also now have complete control over what user levels can view each
##    individual module!
##
##    A new nice feature is your ability to define the update period for each
##    module of statistics. If the update period has not arrived, a fast database
##    cached version will be used instead of calculating the complete new set of
##    statistics. Usefull for long query modules and rarely updated statistics modules.
##
##    Active/De-Activate your modules at will inside the admin control panel. You can
##    also place your favorite modules on top of your page. A simple click moves a module
##    up and down.
##
## Installation Level:  easy
## Installation Time:   5-10 Minutes
## Files To Edit:       constants.php
##			templates/subSilver/overall_header.tpl (if you are editing your header)
##			includes/template.php (if you use the file-cache version of the template)
## Included Files:      install.txt  (This file, you don't have to upload it)
##			mod_table_inst.php (Only needed for Installation, after Installation: DELETE the File from 

your webspace)
##
##                      statistics.php
##			admin/admin_statistics.php
##			includes/functions_stats.php
##			includes/functions_module.php
##			language/lang_english/lang_statistics.php
##			language/lang_german/lang_statistics.php
##			templates/subSilver/statistics.tpl
##			templates/subSilver/admin/stat_config_body.tpl
##			templates/subSilver/admin/stat_edit_module.tpl
##			templates/subSilver/admin/stat_manage_modules.tpl
##                      templates/subSilver/images/icon_mini_statistics.png
##                      stat_modules/*
##
## Complete Dedicated Page: -- OLD Page: http://nivisec.com/mods/statistics_2.php
##			    -- NEW Page: http://www.opentools.de/board (Download Section)
##					 http://www.opentools.de/board/show_modules.php (For Downloading/Uploading 

Modules)
##
##                          - Download the latest version
##                          - Download more modules
##                          - Submit your own written modules
#################################################################
##
## Author Note:
##
## Make sure you run the mod_table_inst.php to
## add the required tables before installing any other parts.
##
## After it is installed, you should see a new admin control panel
## section to get you started.
## You have to install and activate Modules before you see anything
## within your statistics page.
##
## To access the statistics page, you simply open statistics.php
## after it is uploaded. You may also optionally install the
## extra icon link as instructed below.
##
## Module Authors should read the docs/module_coding_guidelines.html
## or http://www.opentools.de/docs/module_coding_guidelines.html
##
#################################################################
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD
#################################################################
##
## VERSION HISTORY
##
## v2.1.5 - 2002-02-05
##	- bugfix: old language layout again allowed.
##	- bugfix: security adjustments to the most active topics, most viewed topics and top attachments modules.
##		if cache was used, users were able to see hidden topics or attachments
##	- bugfix: smilies module adjusted, now only one method is really allowed (smilepref to 0)
##	- more little bugfixes
##
## v2.1.4 - 2002-12-01
##	- fixed bug: Smilies Module (should be more time intensive but 'very' accurate)
##	- fixed bug: Condition setting within Top Downloaded Attachments Module
##	- Added install-switch to the module info parser (no need to parse some things on statistics page 

generation)
##	- fixed bug: Admin page Module Preview
##	- fixed some template issues
##	- module loop changed to be more stable through the page generation.
##	- fixed bug: escaping single quotes
##	- fixed templates (row colors) for nearly all provided modules
##	- Old Modules (Those from Statistics Mod Versions prior or equal Version 2.1.2 will not work... you are 

receiving an error now)
##		All Module Authors should upgrade their Modules to be Version 2.1.3/2.1.4 compatible.
##	- Other minor bugfixes not mentioned here
##
## v2.1.3 - 2002-11-11
##	- fixed bug: caching screws up themes and language variables
##	- speed increasements
##	- fixed issues with Admin Language Part
##	- Re-done the complete caching mechanism
##	- Module Coding Guidelines and Explanation of this new mechanisms: docs/module_coding_guidelines.html
##		or http://www.opentools.de/docs/module_coding_guidelines.html
##	- added a condition setting to the Installation, Module Authors are able to re-check Requirements now
##	- added a setting to check the needed Statistics Mod Version for a Module
##
## v2.1.2
##	- fixed bug: could not set update time back to 0
##	- fixed bug: some issues with Modules that require additional Mods
##			If this was the case, you was unable to uninstall them.
##	- New Multi Language Support added, even cached Versions should be displayed correctly.
##			But be aware if you are writing Modules, only Language Files are 
##			supported, which are defined through the $template->set_vars function.
##	- Added Recommended Update Time to info.txt
##	- Statistics Mod is able to Debug and Recommend a Update Time for you
##	- Automatic Detect and Set of recommended Update Times
##	- You are able to Install&Activate, Activate, Deactivate, Uninstall at the 
##			Module Configuration Page directly.
##	- added a symbolic Link (<a name="<module_id>">) to the statistics Output Page.
##	- added most common used Language Variables to the lang_statistics.php file.
##
## v2.1.1
##	- fixed bug: not able to deactivate Module
##	- fixed bug: not able to uninstall Module
##	- added fix for caching template systems, now all should work just fine with Template Cache File
##	- added uninstaller and update instructions (update.txt)
##
## v2.1.0
##	- Author of the Statistics Mod changed: now Acyd Burn.
##	- New Install File to be more db-safe. :)
##	- Rewrite of the module parser
##		- $template can be used in modules
##		- all things are templated, no prints/echos anymore
##	- Rewrite of the Permissions System (ALL, REG, ADMIN)
##	- Rewrite of the Modules Functions and DB to make it more compatible and db-compliant (added also a 

module_id)
##	- Rewrite of the Administration Interface (seperated template files)
##	- SQL Install Execution rewritten (a complete schema for all databases now supported, no variables needed. 
##		If the SQL file does not exist, no SQL is executed)
##	- Administrative Statistics (one little bug fixed with most users online stats and integrated AMod 

Compatibility)
##
##
#################################################################

#
# Here starts the Installation, follow the steps very close.
# After installing this Mod, please go straight to your Administration Panel
# and install and activate Modules. You will see nothing before you have not done so.
#

#
# Copy/Upload all files to their respective Location
#
# statistics.php								-> statistics.php
# admin/admin_statistics.php							-> admin/admin_statistics.php
# includes/functions_stats.php							-> includes/functions_stats.php
# includes/functions_module.php							-> includes/functions_module.php
# templates/subSilver/statistics.tpl						-> 

templates/subSilver/statistics.tpl
# templates/subSilver/admin/stat_config_body.tpl				-> 

templates/subSilver/admin/stat_config_body.tpl
# templates/subSilver/admin/stat_edit_module.tpl				-> 

templates/subSilver/admin/stat_edit_module.tpl
# templates/subSilver/admin/stat_manage_modules.tpl				-> 

templates/subSilver/admin/stat_manage_modules.tpl
# templates/subSilver/images/icon_mini_statistics.png				-> 

templates/subSilver/images/icon_mini_statistics.png
# stat_modules/*								-> stat_modules (upload the complete 

directory and all sub directories)
#

#
# Upload the Language Files (English (German is optional)) provided with the Statistics Mod, located at the language 

folder
# to your language Directory.
#
# language/lang_english/lang_statistics.php			-> language/lang_english/lang_statistics.php
# 

# 
# Installing the Statistics Mod (First Step -- Database):
#
# Upload this File to your phpBB2 Root Directory (where your config.php file is), it is only needed for 

installation: 
#	
#	mod_table_inst.php			-> mod_table_inst.php
#

#
# Now we want to create the tables, therefore we run mod_table_inst.php 

(http://www.yoursite.com/phpBB2/mod_table_inst.php)
# Contact me if you have questions or problems.
#

#
# For Uninstallation:
#	Upload mod_uninst.php			-> mod_uninst.php
#	Run the script and delete it after execution
#

#
# Now you have to alter existing phpBB2 files, read the instructions carefully and make sure you find the right 

lines.
#

#
#-----[ OPEN ]------------------------------------------
#
includes/constants.php

#
#-----[ FIND ]------------------------------------------
#
if ( !defined('IN_PHPBB') )
{
	die("Hacking attempt");
}

#
#-----[ AFTER, ADD ]------------------------------------------
#
define('MODULES_TABLE', $table_prefix . 'stats_modules');
define('STATS_CONFIG_TABLE', $table_prefix . 'stats_config');


#-------------------------------------------------------------
# Optional install of tiny link beside Usergroups in header
#-------------------------------------------------------------

#
#-----[ OPEN ]------------------------------------------
#
templates/subSilver/overall_header.tpl

#
#-----[ FIND ]------------------------------------------
#
<td align="center" valign="top" nowrap="nowrap"><span class="mainmenu">&nbsp;<a href="{U_FAQ}" class="mainmenu"><img 

src="templates/subSilver/images/icon_mini_faq.gif" width="12" height="13" border="0" alt="{L_FAQ}" hspace="3" 

/>{L_FAQ}</a></span><span class="mainmenu">&nbsp; &nbsp;<a href="{U_SEARCH}" class="mainmenu"><img 

src="templates/subSilver/images/icon_mini_search.gif" width="12" height="13" border="0" alt="{L_SEARCH}" hspace="3" 

/>{L_SEARCH}</a>&nbsp; &nbsp;<a href="{U_MEMBERLIST}" class="mainmenu"><img 

src="templates/subSilver/images/icon_mini_members.gif" width="12" height="13" border="0" alt="{L_MEMBERLIST}" 

hspace="3" />{L_MEMBERLIST}</a>&nbsp; &nbsp;<a href="{U_GROUP_CP}" class="mainmenu"><img 

src="templates/subSilver/images/icon_mini_groups.gif" width="12" height="13" border="0" alt="{L_USERGROUPS}" 

hspace="3" />{L_USERGROUPS}</a>&nbsp;

#
#-----[ AFTER, ADD ]------------------------------------------
#
&nbsp;<a href="statistics.php" class="mainmenu"><img src="templates/subSilver/images/icon_mini_statistics.png" 

width="12" height="13" border="0" alt="Statistics" hspace="3" />Statistics</a>&nbsp;

#
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------
#

#-------------------------------------------------------------
# NOTE: THIS STEP IS ONLY NEEDED IF YOU USE THE FILE-BASED CACHED TEMPLATE.PHP FILE
#
# If you are using the template cache system (only file-based is mentioned here), 
# please adjust your template.php as followed (This will NOT disable the Template Caching)
# It is a little tweak to let the template use the non-cached output if no cached template 
# file could be found.
#-------------------------------------------------------------

# 
#-----[ OPEN ]--------------------------------------------- 
# 
includes/template.php

#
#-----[ FIND ]---------------------------------------------
# around line 144
			$fp = fopen($cache_file, 'w+');
			fwrite ($fp, '<?php' . "\n" . $this->compiled_code[$handle] . "\n?" . '>');

# 
#-----[ REPLACE WITH ]-------------------------------------- 
# 
			$fp = @fopen($cache_file, 'w+');
			if (!$fp)
			{
				eval($this->compiled_code[$handle]);
				return true;
			}
			fwrite ($fp, '<?php' . "\n" . $this->compiled_code[$handle] . "\n?" . '>');

#
#-----[ FIND ]---------------------------------------------
# around line 188
			$fp = fopen($cache_file, 'w+');
			fwrite ($fp, '<?php' . "\n" . $code . "\n?" . '>');

# 
#-----[ REPLACE WITH ]-------------------------------------- 
# 
			$fp = @fopen($cache_file, 'w+');
			if (!$fp)
			{
				$_str = '';
				eval($code);
				$this->assign_var($varname, $_str);
				return true;
			}
			fwrite ($fp, '<?php' . "\n" . $code . "\n?" . '>');


# EoM
Als ik nu de Statics op mn forum wil bekijken, krijg ik dit:

Code: Selecteer alles

Could not query statistics config table

DEBUG MODE

SQL Error : 1146 Table 'pieterc_phpb12.STATS_CONFIG_TABLE' doesn't exist

SELECT * FROM STATS_CONFIG_TABLE

Line : 36
File : statistics.php
Blijkbaar moet je dus nog een table aanmaken , die vreemd genoeg niet in mod_table_inst.php staat. :?

Owja, nog een vraagje, is er een makkelijker manier als er dit staat:

Code: Selecteer alles

Line : 36
File : statistics.php
Om die Line 36 dan te vinden?

Groet :thumb:

Gebruikersavatar
XGE_Lithium
Berichten: 1278
Lid geworden op: 26 okt 2005, 19:28
Locatie: Heythuysen
Contacteer:

Bericht door XGE_Lithium » 09 nov 2005, 17:05

Makavelibrox schreef:Owja, nog een vraagje, is er een makkelijker manier als er dit staat:

Code: Selecteer alles

Line : 36
File : statistics.php
Om die Line 36 dan te vinden?
Werk je met Kladblok? Zoja; open het bestand dat je moet Edit-en in Kladblog, en duw op "ctrl+G". Je krijgt dan een soort zoekfunctie, maar dan zoeken op regel :thumb:

Helaas kan ik je niet verder helpen met je modificatie.

Lith.

Gebruikersavatar
Paul
Beheerder
Beheerder
Berichten: 20315
Lid geworden op: 23 okt 2003, 11:38
Locatie: Utrecht
Contacteer:

Bericht door Paul » 09 nov 2005, 17:20

constants.php niet goed aangepast.

Makavelibrox
Berichten: 402
Lid geworden op: 01 jul 2005, 18:02
Contacteer:

Bericht door Makavelibrox » 09 nov 2005, 18:01

Ctrl + G werkt niet hoor :bier:

Ik had alles eraf gehaald en opnieuw erop gegooid en doen deed hij het inenen wel :?

maar nu krijg ik bij mn admin panel rare dingen te zien.

Code: Selecteer alles

Statistics
Edit module
Package Module
Statistics Configuration
Statistics Modules
Stats configuration
Stats langcp
Als ik er op 1 klik, krijg ik rechts te zien:
Warning: main(./../stats_mod/includes/constants.php): failed to open stream: No such file or directory in /xxx/admin/admin_edit_module.php on line 62

en dan een stuk of 20 errors, in de regels 62, 78, 79, 80 allemaal verwijzend naar admin_edit_module.php :

Code: Selecteer alles

<?php
/***************************************************************************
*                           admin_edit_module.php
*                            -------------------
*   begin                : Fri, Jan 24, 2003
*   copyright            : (C) 2003 Meik Sievertsen
*   email                : acyd.burn@gmx.de
*
*   $Id: admin_edit_module.php,v 1.10 2003/03/16 19:38:27 acydburn Exp $
*
*
***************************************************************************/

/***************************************************************************
*
*   This program is free software; you can redistribute it and/or modify
*   it under the terms of the GNU General Public License as published by
*   the Free Software Foundation; either version 2 of the License, or
*   (at your option) any later version.
*
***************************************************************************/

define('IN_PHPBB', true);

//
// Let's set the root dir for phpBB
//
$phpbb_root_path = './../';
require($phpbb_root_path . 'extension.inc');
if (!empty($board_config))
{
	@include_once($phpbb_root_path . 'language/lang_' . $board_config['default_lang'] . '/lang_admin_statistics.' . $phpEx);
}

if( !empty($setmodules) )
{
	$filename = basename(__FILE__);
	$module['Statistics']['Edit_module'] = $filename . '?mode=select_module';
	return;
}

if( isset($HTTP_POST_VARS['mode']) || isset($HTTP_GET_VARS['mode']) )
{
	$mode = ( isset($HTTP_POST_VARS['mode']) ) ? $HTTP_POST_VARS['mode'] : $HTTP_GET_VARS['mode'];
}
else
{
	$mode = '';
}

$submit = (isset($HTTP_POST_VARS['submit'])) ? TRUE : FALSE;
$cancel = ( isset($HTTP_POST_VARS['cancel']) ) ? TRUE : FALSE;

if ($cancel)
{
	$no_page_header = TRUE;
}

require('pagestart.' . $phpEx);

@include_once($phpbb_root_path . 'language/lang_' . $board_config['default_lang'] . '/lang_admin_statistics.' . $phpEx);
include($phpbb_root_path . 'stats_mod/includes/constants.'.$phpEx);

$sql = "SELECT * FROM " . STATS_CONFIG_TABLE;
	 
if ( !($result = $db->sql_query($sql)) )
{
	message_die(GENERAL_ERROR, 'Could not query statistics config table', '', __LINE__, __FILE__, $sql);
}

$stats_config = array();

while ($row = $db->sql_fetchrow($result))
{
	$stats_config[$row['config_name']] = trim($row['config_value']);
}

include($phpbb_root_path . 'stats_mod/includes/lang_functions.'.$phpEx);
include($phpbb_root_path . 'stats_mod/includes/stat_functions.'.$phpEx);
include($phpbb_root_path . 'stats_mod/includes/admin_functions.'.$phpEx);

$message = '';

if ($mode == 'mod_edit')
{
	if( isset($HTTP_POST_VARS['module']) || isset($HTTP_GET_VARS['module']) )
	{
		$module_id = ( isset($HTTP_POST_VARS['module']) ) ? intval($HTTP_POST_VARS['module']) : intval($HTTP_GET_VARS['module']);
	}
	else
	{
		message_die(GENERAL_ERROR, 'Unable to edit Module.');
	}

	$template->set_filenames(array(
		'body' => 'admin/stat_edit_module.tpl')
	);

	$sql = "SELECT m.*, i.* FROM " . MODULES_TABLE . " m, " . MODULE_INFO_TABLE . " i WHERE i.module_id = m.module_id AND m.module_id = " . $module_id;

	if (!($result = $db->sql_query($sql)) )
	{
		message_die(GENERAL_ERROR, 'Unable to get Module Informations', '', __LINE__, __FILE__, $sql);
	}

	if ($db->sql_numrows($result) == 0)
	{
		message_die(GENERAL_MESSAGE, 'Module not found.');
	}

	$mod_info = $db->sql_fetchrow($result);
	$mod_info_changed = FALSE;
}

if ($submit && $mode == 'mod_edit')
{
	if (isset($HTTP_POST_VARS['update_time']))
	{
		if (intval($mod_info['update_time']) != intval($HTTP_POST_VARS['update_time']))
		{
			$sql = "UPDATE " . MODULES_TABLE . " SET update_time = " . intval($HTTP_POST_VARS['update_time']) . " WHERE module_id = " . $module_id;

			if ( !($result = $db->sql_query($sql)) )
			{
				message_die(GENERAL_ERROR, 'Unable to update modules table', '', __LINE__, __FILE__, $sql);
			}
	
			$mod_info_changed = TRUE;
			$message = ($message == '') ? $message . $lang['Msg_changed_update_time'] : $message . '<br />' . $lang['Msg_changed_update_time'];
		}
	}

	if (isset($HTTP_POST_VARS['clear_module_cache']))
	{
		$sql = "UPDATE " . CACHE_TABLE . " SET module_cache_time = 0, db_cache = '', priority = 0 WHERE module_id = " . $module_id;

		if ( !($result = $db->sql_query($sql)) )
		{
			message_die(GENERAL_ERROR, 'Unable to update modules cache table', '', __LINE__, __FILE__, $sql);
		}
	
		$message = ($message == '') ? $message . $lang['Msg_cleared_module_cache'] : $message . '<br />' . $lang['Msg_cleared_module_cache'];
	}

	// Permission Updates
	$update_sql = '';
	$perm_array = array('perm_all', 'perm_reg', 'perm_mod', 'perm_admin');

	for ($i = 0; $i < count($perm_array); $i++)
	{
		if (isset($HTTP_POST_VARS[$perm_array[$i]]))
		{
			$update_sql .= ($update_sql == '') ? $perm_array[$i] . ' = 1' : ', ' . $perm_array[$i] . ' = 1';
		}
		else
		{
			$update_sql .= ($update_sql == '') ? $perm_array[$i] . ' = 0' : ', ' . $perm_array[$i] . ' = 0';
		}
	}

	if ($update_sql != '')
	{
		$sql = "UPDATE " . MODULES_TABLE . " SET " . $update_sql . " WHERE module_id = " . $module_id;

		if ( !($result = $db->sql_query($sql)) )
		{
			message_die(GENERAL_ERROR, 'Unable to update Permissions', '', __LINE__, __FILE__, $sql);
		}

		$message = ($message == '') ? $message . $lang['Msg_permissions_updated'] : $message . '<br />' . $lang['Msg_permissions_updated'];
		$mod_info_changed = TRUE;
	}
	
	// Admin Panel Integration fields
	// Get Module Variables
	$sql = "SELECT * FROM " . MODULE_ADMIN_TABLE . " WHERE module_id = " . $module_id;

	if (!$result = $db->sql_query($sql))
	{
		message_die(GENERAL_ERROR, 'Could not find Module Admin Table', '', __LINE__, __FILE__, $sql);
	}
	
	$rows = $db->sql_fetchrowset($result);
	$num_rows = $db->sql_numrows($result);

	$admin_update = FALSE;

	for ($i = 0; $i < $num_rows; $i++)
	{
		if (isset($HTTP_POST_VARS[trim($rows[$i]['config_name'])]))
		{
			if (trim($HTTP_POST_VARS[trim($rows[$i]['config_name'])]) != trim($rows[$i]['config_value']))
			{
				$sql = "UPDATE " . MODULE_ADMIN_TABLE . " SET config_value = '" . trim($HTTP_POST_VARS[trim($rows[$i]['config_name'])]) . "' 
				WHERE config_name = '" . trim($rows[$i]['config_name']) . "' AND module_id = " . $module_id;
	
				if ( !($result = $db->sql_query($sql)) )
				{
					message_die(GENERAL_ERROR, 'Unable to update modules cache table', '', __LINE__, __FILE__, $sql);
				}
				$admin_update = TRUE;
			}			
		}
	}

	if ($admin_update)
	{
		$message = ($message == '') ? $message . $lang['Msg_module_fields_updated'] : $message . '<br />' . $lang['Msg_module_fields_updated'];
	}
}

if (isset($HTTP_POST_VARS['add_group']) && $mode == 'mod_edit')
{
	$group_id = intval($HTTP_POST_VARS['group']);

	if ( (!$group_id) || (empty($group_id)) )
	{
		message_die(GENERAL_MESSAGE, 'Wrong Group ID submitted, hacking attempt ?');
	}

	if( isset($HTTP_POST_VARS['module']) || isset($HTTP_GET_VARS['module']) )
	{
		$module_id = ( isset($HTTP_POST_VARS['module']) ) ? intval($HTTP_POST_VARS['module']) : intval($HTTP_GET_VARS['module']);
	}
	else
	{
		message_die(GENERAL_ERROR, 'Unable to edit Module.');
	}

	$sql = "INSERT INTO " . MODULE_GROUP_AUTH_TABLE . " (module_id, group_id) VALUES (" . $module_id . ", " . $group_id . ")";

	if ( !($result = $db->sql_query($sql)) )
	{
		message_die(GENERAL_ERROR, "Couldn't insert Group", "", __LINE__, __FILE__, $sql);
	}
}

if (isset($HTTP_POST_VARS['delete_group']) && $mode == 'mod_edit')
{
	$group_id = intval($HTTP_POST_VARS['added_group']);

	if ( (!$group_id) || (empty($group_id)) )
	{
		message_die(GENERAL_MESSAGE, 'Wrong Group ID submitted, hacking attempt ?');
	}

	if( isset($HTTP_POST_VARS['module']) || isset($HTTP_GET_VARS['module']) )
	{
		$module_id = ( isset($HTTP_POST_VARS['module']) ) ? intval($HTTP_POST_VARS['module']) : intval($HTTP_GET_VARS['module']);
	}
	else
	{
		message_die(GENERAL_ERROR, 'Unable to edit Module.');
	}

	$sql = "DELETE FROM " . MODULE_GROUP_AUTH_TABLE . " WHERE module_id = " . $module_id . " AND group_id = " . $group_id;

	if ( !($result = $db->sql_query($sql)) )
	{
		message_die(GENERAL_ERROR, "Couldn't delete Group", "", __LINE__, __FILE__, $sql);
	}
}

if ($mode == 'mod_edit')
{
	if( isset($HTTP_POST_VARS['module']) || isset($HTTP_GET_VARS['module']) )
	{
		$module_id = ( isset($HTTP_POST_VARS['module']) ) ? intval($HTTP_POST_VARS['module']) : intval($HTTP_GET_VARS['module']);
	}
	else
	{
		message_die(GENERAL_ERROR, 'Unable to edit Module.');
	}

	$template->set_filenames(array(
		'body' => 'admin/stat_edit_module.tpl')
	);

	if ($mod_info_changed)
	{
		$sql = "SELECT m.*, i.* FROM " . MODULES_TABLE . " m, " . MODULE_INFO_TABLE . " i WHERE i.module_id = m.module_id AND m.module_id = " . $module_id;

		if (!($result = $db->sql_query($sql)) )
		{
			message_die(GENERAL_ERROR, 'Unable to get Module Informations', '', __LINE__, __FILE__, $sql);
		}

		if ($db->sql_numrows($result) == 0)
		{
			message_die(GENERAL_MESSAGE, 'Module not found.');
		}

		$mod_info = $db->sql_fetchrow($result);
	}

	$s_hidden_fields = '<input type="hidden" name="module" value="' . $module_id . '" />';

	$module_langs = get_module_languages(trim($mod_info['short_name']));
	$module_languages = '';
	
	for ($i = 0; $i < count($module_langs); $i++)
	{
		$module_languages .= ( ($module_languages == '') ? $module_langs[$i] : ', ' . $module_langs[$i]);
	}

	$yes_no_switches = array('perm_all', 'perm_reg', 'perm_mod', 'perm_admin');

	for ($i = 0; $i < count($yes_no_switches); $i++)
	{
		eval("\$" . $yes_no_switches[$i] . " = ( intval(\$mod_info['" . $yes_no_switches[$i] . "']) != 0 ) ? 'checked=\"checked\"' : '';");
	}

	$sql = "SELECT group_id, group_name
	FROM " . GROUPS_TABLE . "
	WHERE group_single_user = 0
	ORDER BY group_name";

	if ( !($result = $db->sql_query($sql)) )
	{
		message_die(GENERAL_ERROR, "Couldn't query Groups Table", "", __LINE__, __FILE__, $sql);
	}

	$num_groups = $db->sql_numrows($result);
	$group_name = $db->sql_fetchrowset($result);

	$group_ids = array();
	for ($i = 0; $i < $num_groups; $i++)
	{
		$group_ids[] = $group_name[$i]['group_id'];
	}

	$sql = "SELECT g.group_id, g.group_name
	FROM " . GROUPS_TABLE . " g, " . MODULE_GROUP_AUTH_TABLE . " m
	WHERE m.group_id = g.group_id AND m.module_id = " . intval($mod_info['module_id']) . "
	ORDER BY group_name";

	if ( !($result = $db->sql_query($sql)) )
	{
		message_die(GENERAL_ERROR, "Couldn't query Groups Table", "", __LINE__, __FILE__, $sql);
	}

	$rows = $db->sql_fetchrowset($result);
	$num_rows = $db->sql_numrows($result);

	// Rebuild Auth Table, maybe the user have deleted groups
	if (($num_groups > 0) && ($num_rows > 0))
	{
		for ($i = 0; $i < $num_rows; $i++)
		{
			if (!in_array($rows[$i]['group_id'], $group_ids))
			{
				$sql = "DELETE FROM " . MODULE_GROUP_AUTH_TABLE . " WHERE module_id = " . $module_id . " AND group_id = " . $rows[$i]['group_id'];
			
				if ( !($result = $db->sql_query($sql)) )
				{
					message_die(GENERAL_ERROR, "Couldn't delete Group", "", __LINE__, __FILE__, $sql);
				}
			}
		}
	}

	$added_groups = array();

	for ($i = 0; $i < $num_rows; $i++)
	{
		$added_groups['group_id'][] = $rows[$i]['group_id'];
		$added_groups['group_name'][] = $rows[$i]['group_name'];
	}

	$act_group = 0;
	if ( $num_groups > 0 )
	{
		$group_select = '<select name="group">';

		for($i = 0; $i < count($group_name); $i++)
		{
			$add = FALSE;

			if (count($added_groups['group_id']) == 0)
			{
				$add = TRUE;
			}
			else if (!in_array($group_name[$i]['group_id'], $added_groups['group_id']))
			{
				$add = TRUE;
			}

			if ($add)
			{
				$selected = ($act_group == 0) ? ' selected="selected"' : '';
				$group_select .= '<option value="' . $group_name[$i]['group_id'] . '"' . $selected . '>' . $group_name[$i]['group_name'] . '</option>';
				$act_group++;
			}
		}
		$group_select .= '</select>';
	}
	
	if ($act_group == 0)
	{
		$group_select = $lang['No_groups_to_add'];
	}
	else
	{
		$template->assign_block_vars('switch_groups_there', array());
	}

	if (count($added_groups['group_id']) == 0)
	{
		$group_added_select = $lang['No_groups_selected'];
	}
	else
	{
		$template->assign_block_vars('switch_groups_selected', array());
		$group_added_select = '<select name="added_group">';

		for($i = 0; $i < count($added_groups['group_id']); $i++)
		{
			$selected = ($i == 0) ? ' selected="selected"' : '';
			$group_added_select .= '<option value="' . $added_groups['group_id'][$i] . '"' . $selected . '>' . $added_groups['group_name'][$i] . '</option>';
		}
		$group_added_select .= '</select>';
	}


	// Module Edit Panel
	$template->assign_vars(array(
		'L_EDIT_MODULE' => $lang['Edit_module'],
		'L_EDIT_MODULE_EXPLAIN' => $lang['Edit_module_explain'],
		'L_MODULE_INFORMATIONS' => $lang['Module_informations'],
		'L_MODULE_NAME' => $lang['Module_name'],
		'L_MODULE_DESCRIPTION' => $lang['Module_description'],
		'L_MODULE_VERSION' => $lang['Module_version'],
		'L_MODULE_AUTHOR' => $lang['Module_author'],
		'L_AUTHOR_EMAIL' => $lang['Author_email'],
		'L_MODULE_URL' => $lang['Module_url'],
		'L_UPDATE_URL' => $lang['Update_url'],
		'L_MODULE_LANGUAGES' => $lang['Module_languages'],
		'L_MODULE_STATUS' => $lang['Module_status'],
		'L_MESSAGES' => $lang['Messages'],
		'L_PREVIEW_MODULE' => $lang['Preview_module'],
		'L_CONFIGURATION' => $lang['Module_configuration'],
		'L_UPDATE_TIME' => $lang['Update_time'],
		'L_UPDATE_TIME_EXPLAIN' => $lang['Update_time_explain'],
		'L_UPDATE_MODULE' => $lang['Update_module'],
		'L_CLEAR_MODULE_CACHE' => $lang['Clear_module_cache'],
		'L_CLEAR_MODULE_CACHE_EXPLAIN' => $lang['Clear_module_cache_explain'],
		'L_SUBMIT' => $lang['Submit'],
		'L_RESET' => $lang['Reset'],
		'L_UPDATE' => $lang['Update'],
	
		'L_PERMISSIONS' => $lang['Permissions'],
		'L_PERMISSIONS_TITLE' => $lang['Set_permissions_title'],
		'L_PERM_ALL' => $lang['Perm_all'],
		'L_PERM_REG' => $lang['Perm_reg'],
		'L_PERM_MOD' => $lang['Perm_mod'],
		'L_PERM_ADMIN' => $lang['Perm_admin'],
		'L_GROUPS' => $lang['Perm_group'],
		'L_ADDED_GROUPS' => $lang['Added_groups'],
		'L_GROUPS_TITLE' => $lang['Perm_groups_title'],
		'L_ADD' => $lang['Perm_add_group'],
		'L_REMOVE' => $lang['Perm_remove_group'],
		
		'PERM_ALL' => $perm_all,
		'PERM_REG' => $perm_reg,
		'PERM_MOD' => $perm_mod,
		'PERM_ADMIN' => $perm_admin,
		'S_GROUP_SELECT' => $group_select,
		'S_SELECTED_GROUPS' => $group_added_select,

		'MODULE_NAME' => nl2br($mod_info['long_name']),
		'MODULE_DESCRIPTION' => nl2br($mod_info['extra_info']),
		'MODULE_AUTHOR' => trim($mod_info['author']),
		'MODULE_VERSION' => trim($mod_info['version']),
		'AUTHOR_EMAIL' => trim($mod_info['email']),
		'MODULE_URL' => trim($mod_info['url']),
		'MODULE_STATUS' => (intval($mod_info['active']) == 1) ? $lang['Active'] : $lang['Not_active'],
		'U_MODULE_URL' => trim($mod_info['url']),
		'UPDATE_URL' => trim($mod_info['update_site']),
		'U_UPDATE_URL' => trim($mod_info['update_site']),
		'MODULE_LANGUAGES' => $module_languages,
		'MESSAGE' => $message,
		'S_HIDDEN_FIELDS' => $s_hidden_fields,
		'UPDATE_TIME' => intval($mod_info['update_time']),
		'S_ACTION' => append_sid('admin_edit_module.'.$phpEx.'?mode='.$mode),
		'U_PREVIEW_MODULE' => append_sid($phpbb_root_path . 'statistics.'.$phpEx.'?preview='.$module_id))
	);

	// Admin Panel Integration fields
	// Get Module Variables
	$sql = "SELECT * FROM " . MODULE_ADMIN_TABLE . " WHERE module_id = " . $module_id;

	if (!$result = $db->sql_query($sql))
	{
		message_die(GENERAL_ERROR, 'Could not find Module Admin Table', '', __LINE__, __FILE__, $sql);
	}
	
	$rows = $db->sql_fetchrowset($result);
	$num_rows = $db->sql_numrows($result);

	if ($num_rows > 0)
	{
		// Include Language
		$sql = "SELECT config_value FROM " . CONFIG_TABLE . " WHERE config_name = 'default_lang'";
		if (!($result = $db->sql_query($sql)))
		{
			message_die(GENERAL_ERROR, 'Unable to query config table', '', __LINE__, __FILE__, $sql);
		}

		$row = $db->sql_fetchrow($result);
		$default_board_lang = trim($row['config_value']);

		$language = $board_config['default_lang'];
		$language_file = $phpbb_root_path . 'modules/language/lang_' . $language . '/lang_modules.' . $phpEx;

		if ( !@file_exists(@realpath($language_file)) )
		{
			$language = $default_board_lang;
		}

		$language_file = $phpbb_root_path . 'modules/language/lang_' . $language . '/lang_modules.' . $phpEx;

		include($language_file);

		// Set Language
		$keys = array();
		eval('\$current_lang = $' . $mod_info['short_name'] . ';');
		
		if (is_array($current_lang))
		{
			foreach ($current_lang as $key => $value)
			{
				$lang[$key] = $value;
				$keys[] = $key;
			}
		}
	}

	for ($i = 0; $i < $num_rows; $i++)
	{
		$lang_title = $lang[trim($rows[$i]['config_title'])];
		$lang_explain = (isset($lang[trim($rows[$i]['config_explain'])])) ? $lang[trim($rows[$i]['config_explain'])] : '';

		switch (trim($rows[$i]['config_trigger']))
		{
			case 'enum':
				$option_field = '<input type="radio" name="' . trim($rows[$i]['config_name']) . '" value="1" ';
				if (intval($rows[$i]['config_value']) == 1)
				{
					$option_field .= 'checked=\"checked\" ';
				}
				$option_field .= ' /> ' . $lang['Yes'] . '&nbsp;&nbsp;<input type="radio" name="' . trim($rows[$i]['config_name']) . '" value="0" ';
				if (intval($rows[$i]['config_value']) == 0)
				{
					$option_field .= 'checked=\"checked\" ';
				}
				$option_field .= ' /> ' . $lang['No'];
				break;
			case 'integer':
				$option_field = '<input type="text" name="' . trim($rows[$i]['config_name']) . '" value="' . intval($rows[$i]['config_value']) . '" />';
				break;
		}

		$template->assign_block_vars('module_admin_fields', array(
			'L_TITLE' => $lang_title,
			'L_EXPLAIN' => $lang_explain,
			'S_OPTION_FIELD' => $option_field)
		);
	}

	if ( (!isset($HTTP_POST_VARS['fileupload'])) && (!isset($HTTP_POST_VARS['fileselect'])) )
	{
		$module_paks = array();
	
		$dir = @opendir($phpbb_root_path . 'modules/pakfiles');

		while($file = @readdir($dir))
		{
			if( !@is_dir($phpbb_root_path . 'modules/pakfiles' . '/' . $file) )
			{
				if ( eregi('.pak$', $file) )
				{
					$module_paks[] = $file;
				}
			}
		}

		@closedir($dir);

		if (count($module_paks) > 0)
		{
			$module_select_field = '<select name="selected_pak_file">';

			for ($i = 0; $i < count($module_paks); $i++)
			{
				$selected = ($i == 0) ? ' selected="selected"' : '';

				$module_select_field .= '<option value="' . $module_paks[$i] . '"' . $selected . '>' . $module_paks[$i] . '</option>';
			}
	
			$module_select_field .= '</select>';
			
			$s_hidden_fields = '<input type="hidden" name="fileselect" value="1" />';
		}
		else
		{
			$module_select_field = $lang['No_module_packages_found'];
			$s_hidden_fields = '';
		}

		$template->assign_vars(array(
			'L_SELECT_MODULE' => $lang['Select_module_pak'],
			'S_SELECT_MODULE' => $module_select_field,
			'S_SELECT_HIDDEN_FIELDS' => $s_hidden_fields)
		);

		$s_hidden_fields = '<input type="hidden" name="fileupload" value="1" /><input type="hidden" name="update_id" value="' . $module_id . '" />';

		$template->assign_vars(array(
			'L_INSTALL_MODULE' => $lang['Install_module'],
			'L_INSTALL_MODULE_EXPLAIN' => $lang['Install_module_explain'],
			'L_UPLOAD_MODULE' => $lang['Upload_module_pak'],
			'L_SUBMIT' => $lang['Submit'],
			'S_ACTION_UPDATE' => append_sid($phpbb_root_path . 'admin/admin_statistics.'.$phpEx.'?mode=mod_install'),
			'S_UPLOAD_HIDDEN_FIELDS' => $s_hidden_fields)
		);

	}

}
else if ($mode == 'select_module')
{
	$template->set_filenames(array(
		'body' => 'admin/stat_select_module.tpl')
	);

	$sql = "SELECT m.module_id, i.long_name FROM " . MODULES_TABLE . " m, " . MODULE_INFO_TABLE . " i WHERE i.module_id = m.module_id ORDER BY long_name ASC";

	if (!($result = $db->sql_query($sql)) )
	{
		message_die(GENERAL_ERROR, 'Unable to get Module Informations', '', __LINE__, __FILE__, $sql);
	}

	if ($db->sql_numrows($result) == 0)
	{
		message_die(GENERAL_MESSAGE, 'No installed Modules found.');
	}

	$rows = $db->sql_fetchrowset($result);
	
	$module_select_field = '<select name="module">';

	for ($i = 0; $i < count($rows); $i++)
	{
		$selected = ($i == 0) ? ' selected="selected"' : '';

		$module_select_field .= '<option value="' . $rows[$i]['module_id'] . '"' . $selected . '>' . $rows[$i]['long_name'] . '</option>';
	}
	
	$module_select_field .= '</select>';
	
	$template->assign_vars(array(
		'L_SELECT_MODULE_TITLE' => $lang['Module_select_title'],
		'L_SELECT_MODULE_EXPLAIN' => $lang['Module_select_explain'],
		'L_MODULE_SELECT' => $lang['Module_select_title'],
		'L_EDIT' => $lang['Edit'],
		'S_ACTION' => append_sid('admin_edit_module.'.$phpEx.'?mode=mod_edit'),
		'S_MODULE_SELECT' => $module_select_field)
	);

}

$template->pparse('body');

//
// Page Footer
//
include('./page_footer_admin.'.$phpEx);

?>
zo ook vele errors bij;
admin_stats_config.php
admin_stats_lang.php

Gebruikersavatar
Paul
Beheerder
Beheerder
Berichten: 20315
Lid geworden op: 23 okt 2003, 11:38
Locatie: Utrecht
Contacteer:

Bericht door Paul » 09 nov 2005, 18:03

Niet alle files geupload

Makavelibrox
Berichten: 402
Lid geworden op: 01 jul 2005, 18:02
Contacteer:

Bericht door Makavelibrox » 09 nov 2005, 18:27

wel alle files ge-upload, maaar verkeerd ge-upload :thumb: :cry:

u werkt dat ook weer, maar nog niet helemaal.

Als ik doe: edit modules:

Code: Selecteer alles

Algemene fout
Unable to get Module Informations

DEBUG MODE

SQL Error : 1146 Table 'pieterc_phpb12.phpbb_module_info' doesn't exist

SELECT m.module_id, i.long_name FROM phpbb_stats_modules m, phpbb_module_info i WHERE i.module_id = m.module_id ORDER BY long_name ASC

Line : 639
File : admin_edit_module.php
En als ik doe Manage modules:

Code: Selecteer alles

Algemene fout
Unable to get Module Informations

DEBUG MODE

SQL Error : 1146 Table 'pieterc_phpb12.phpbb_module_info' doesn't exist

SELECT m.*, i.* FROM phpbb_stats_modules m, phpbb_module_info i WHERE i.module_id = m.module_id ORDER BY module_order ASC

Line : 414
File : admin_statistics.php
deze Table heb ik ook nooit geinstalleerd :roll:

Gebruikersavatar
Paul
Beheerder
Beheerder
Berichten: 20315
Lid geworden op: 23 okt 2003, 11:38
Locatie: Utrecht
Contacteer:

Bericht door Paul » 09 nov 2005, 18:37

sql niet uitgevoerd.

Makavelibrox
Berichten: 402
Lid geworden op: 01 jul 2005, 18:02
Contacteer:

Bericht door Makavelibrox » 09 nov 2005, 18:38

weet ik, maar hoe moet ik die table aanmaken dan?

Gebruikersavatar
Paul
Beheerder
Beheerder
Berichten: 20315
Lid geworden op: 23 okt 2003, 11:38
Locatie: Utrecht
Contacteer:

Bericht door Paul » 09 nov 2005, 18:44

de querys staan op de vorige pagina ;)

EDIT: 6666 bericht :bier:

Gesloten