<?php
$widget['widget_title'] = "Statistics";
$widget['widget_has_settings'] = 1;
$widget['widget_shrink_icon'] = 1;
$widget['widget_uninstall_icon'] = 1;
$widget['name'] = 'Statistics';
$widget['desc'] = 'This widget inserts common statistics about your website. Examples include the number of members, stories, votes, comments, and your Pligg version.';
$widget['version'] = 0.1;

$sw_version = get_misc_data('sw_version');
if ($sw_version == '') $sw_version='1';
$sw_members = get_misc_data('sw_members');
if ($sw_members == '') $sw_members='1';
$sw_groups = get_misc_data('sw_groups');
if ($sw_groups == '') $sw_groups='1';
$sw_links = get_misc_data('sw_links');
if ($sw_links == '') $sw_links='1';
$sw_published = get_misc_data('sw_published');
if ($sw_published == '') $sw_published='1';
$sw_upcoming = get_misc_data('sw_upcoming');
if ($sw_upcoming == '') $sw_upcoming='1';
$sw_votes = get_misc_data('sw_votes');
if ($sw_votes == '') $sw_votes='1';
$sw_comments = get_misc_data('sw_comments');
if ($sw_comments == '') $sw_comments='1';
$sw_newuser = get_misc_data('sw_newuser');
if ($sw_newuser == '') $sw_newuser='1';

if ($_REQUEST['widget']=='statistics'){
    if(isset($_REQUEST['version']))
		$sw_version = sanitize($_REQUEST['version'], 3);
    misc_data_update('sw_version', $sw_version);
    if(isset($_REQUEST['members']))
		$sw_members = sanitize($_REQUEST['members'], 3);
    misc_data_update('sw_members', $sw_members);
    if(isset($_REQUEST['groups']))
		$sw_groups = sanitize($_REQUEST['groups'], 3);
    misc_data_update('sw_groups', $sw_groups);
    if(isset($_REQUEST['links']))
		$sw_links = sanitize($_REQUEST['links'], 3);
    misc_data_update('sw_links', $sw_links);
    if(isset($_REQUEST['published']))
		$sw_published = sanitize($_REQUEST['published'], 3);
    misc_data_update('sw_published', $sw_published);
    if(isset($_REQUEST['upcoming']))
		$sw_upcoming = sanitize($_REQUEST['upcoming'], 3);
    misc_data_update('sw_upcoming', $sw_upcoming);
    if(isset($_REQUEST['votes']))
		$sw_votes = sanitize($_REQUEST['votes'], 3);
    misc_data_update('sw_votes', $sw_votes);
    if(isset($_REQUEST['comments']))
		$sw_comments = sanitize($_REQUEST['comments'], 3);
    misc_data_update('sw_comments', $sw_comments);
    if(isset($_REQUEST['latestuser']))
		$sw_newuser = sanitize($_REQUEST['latestuser'], 3);
    misc_data_update('sw_newuser', $sw_newuser);
}


if ($main_smarty){
    $main_smarty->assign('sw_version', $sw_version);
	$main_smarty->assign('sw_members', $sw_members);
	$main_smarty->assign('sw_groups', $sw_groups);
	$main_smarty->assign('sw_links', $sw_links);
	$main_smarty->assign('sw_published', $sw_published);
	$main_smarty->assign('sw_upcoming', $sw_upcoming);
	$main_smarty->assign('sw_votes', $sw_votes);
	$main_smarty->assign('sw_comments', $sw_comments);
	$main_smarty->assign('sw_newuser', $sw_newuser);
}
?>
