<?php
/*-------------------------------------------------------+
| PHP-Fusion Content Management System
| Copyright © 2002 - 2008 Nick Jones
| http://www.php-fusion.co.uk/
+--------------------------------------------------------+
| Filename: infusion.php
| Author: Titus (diphputz) Kaptein
| Website: http://www.diphputz.de/
| © 2012 by Titus Kaptein
+--------------------------------------------------------+
| This program is released as free software under the
| Affero GPL license. You can redistribute it and/or
| modify it under the terms of this license which you
| can read by viewing the included agpl.txt or online
| at www.gnu.org/licenses/agpl.html. Removal of this
| copyright header is strictly prohibited without
| written permission from the original author(s).
+--------------------------------------------------------*/
if (!defined("IN_FUSION")) { die("Access Denied"); }

include INFUSIONS."did_webstats_panel/infusion_db.php";

// Check if locale file is available matching the current site locale setting.
if (file_exists(INFUSIONS."did_webstats_panel/locale/".$settings['locale'].".php")) {
	// Load the locale file matching the current site locale setting.
	include INFUSIONS."did_webstats_panel/locale/".$settings['locale'].".php";
} else {
	// Load the infusion's default locale file.
	include INFUSIONS."did_webstats_panel/locale/English.php";
}

// Infusion general information
$inf_title = $locale['Dws_title'];
$inf_description = $locale['Dws_desc'];
$inf_version = "1.4.1";
$inf_developer = "diphputz";
$inf_email = "info@diphputz.de";
$inf_weburl = "http://diphputz.de";

$inf_folder = "did_webstats_panel"; // The folder in which the infusion resides.

// Delete any items not required below.
$inf_newtable[1] = DB_DID_WEBSTATS."visits (
id INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,
date BIGINT(8) DEFAULT '0' NOT NULL,
hits INT(4) DEFAULT '0' NOT NULL,
visits INT(4) DEFAULT '0' NOT NULL,
PRIMARY KEY (id)
)";

$inf_newtable[2] = DB_DID_WEBSTATS."ips (
id INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,
date BIGINT(8) DEFAULT '0' NOT NULL,
ip VARCHAR(15) DEFAULT '0.0.0.0' NOT NULL,
PRIMARY KEY (id)
)";

$inf_newtable[3] = DB_DID_WEBSTATS."settings (
  `id` smallint(1) NOT NULL AUTO_INCREMENT,
  `lastweek` smallint(1) NOT NULL DEFAULT '1',
  `clickslastdays` smallint(1) NOT NULL DEFAULT '3',
  `clicksperhour` smallint(1) NOT NULL DEFAULT '1',
  `clickspervisit` smallint(1) NOT NULL DEFAULT '1',
  `active` smallint(1) NOT NULL DEFAULT '1',
  `puplicstats` smallint(1) NOT NULL DEFAULT '1',
  `showallvisitors` smallint(1) NOT NULL DEFAULT '1',
  `beginyear` int(4) NOT NULL DEFAULT '2012',
  `beginmonth` int(2) NOT NULL DEFAULT '1',
  `beginday` int(2) NOT NULL DEFAULT '13',
  `barcolor` VARCHAR(6) NOT NULL DEFAULT '0099cc',
  `sitemap_getvars` TEXT,
  PRIMARY KEY (id)
)";

$inf_newtable[4] = DB_DID_WEBSTATS."sitemap (
	`id` INT(11) NOT NULL AUTO_INCREMENT,
	`path` VARCHAR(50) NOT NULL,
	`name` VARCHAR(20) NOT NULL,
	`clicks` INT(11) NOT NULL,
	PRIMARY KEY (id)
)";

$inf_insertdbrow[1] = DB_DID_WEBSTATS."settings (`id`, `lastweek`, `clickslastdays`, `clicksperhour`, `clickspervisit`, `active`, `puplicstats`, `showallvisitors`, `beginyear`, `beginmonth`, `beginday`) 
							VALUES ('1', '1', '3', '1', '1', '1', '1', '1', '".date('Y')."', '".date('n')."', '".date('j')."')";
$inf_insertdbrow[2] = DB_PREFIX."panels (`panel_name`, `panel_filename`, `panel_content`, `panel_side`, `panel_order`, `panel_type`, `panel_access`, `panel_display`, `panel_status`, `panel_url_list`, `panel_restriction`)
							VALUES ('Webstatistik', 'did_webstats_panel', '', 1, 5, 'file', 0, 0, 1, '', 1);";

$inf_droptable[1] = DB_DID_WEBSTATS."visits";
$inf_droptable[2] = DB_DID_WEBSTATS."ips";
$inf_droptable[3] = DB_DID_WEBSTATS."settings";
$inf_droptable[4] = DB_DID_WEBSTATS."sitemap";

$inf_adminpanel[1] = array(
	"title" => $locale['Dws_admin1'],
	"image" => "did_webstats.gif",
	"panel" => "webstats_admin.php",
	"rights" => "DWS"
);
?>