Your IP : 216.73.216.240


Current Path : /home/j/u/v/juvelize/www/modules/mod_jts_counterstats/
Upload File :
Current File : /home/j/u/v/juvelize/www/modules/mod_jts_counterstats/mod_jts_counterstats.php

<?php
/**
 # mod_jts_counterstats
 # @version		1.4.2
 # ------------------------------------------------------------------------
 # author    Sarki for Joomlatutos.com inspired by Open Source Code Solutions Co and VINAORA
 # copyright Copyright (C) 2011 Joomlatutos.com All Rights Reserved.
 # @license - http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL or later.
 # Website: http://www.joomlatutos.com
 # @email: info@joomlatutos.com
-------------------------------------------------------------------------*/

// No direct access to this file
defined('_JEXEC') or die;

// Include the syndicate functions only once
require_once dirname(__FILE__).'/helper.php';

// Custom Text
$text_date		=	$params->get( 'text_date', 'We are on ' );
$text_title		=	$params->get( 'text_title', 'Number of visitors' );
$text_today		=	$params->get( 'text_today', 'Today' );
$text_yesterday	=	$params->get( 'text_yesterday', 'Yesterday' );
$text_week		=	$params->get( 'text_week', 'Week' );
$text_month  	=	$params->get( 'text_month', 'Month' );
$text_total		=	$params->get( 'text_total', 'Total' );
$text_plural	=	$params->get( 'text_plural', 's' );
$text_isonline	=	$params->get( 'text_isonline', ' ' );
$text_totalusers=	$params->get( 'text_totalusers', ' ' );
$text_online	=	$params->get( 'text_online', ' ' );
$text_guest		=	$params->get( 'text_guest', 'guest' );
$text_register	=	$params->get( 'text_register', 'register' );
$text_username	=	$params->get( 'text_username', 'Username' );
$text_ip		=	$params->get( 'text_ip', 'IP' );

// Counter & Texte color
$initialise		=	$params->get('initialise', 0);
$locktime		=	(int)$params->get('locktime', 15);
$textcolor		=	$params->get('textcolor', 'textcolor');
$text_color		=	'color:'.$textcolor.'; ';

// Width 
$widthtable		=	$params->get( 'widthtable', "auto" );
if($widthtable 	>	0){    
    $width 		= 	'width:'.$widthtable.'px; ';
}else{
    $width		=	'width:auto; ';
}

// Margin & Padding
$margintop		=	$params->get('margintop', '0' );
$marginright	=	$params->get('marginright', '0' );
$marginbottom	=	$params->get('marginbottom', '0' );
$marginleft		=	$params->get('marginleft', '0' );
$margin			=	'margin:'.$margintop.'px '.$marginright.'px '.$marginbottom.'px '.$marginleft.'px; ';

$paddingtop		=	$params->get('paddingtop', '10' );
$paddingright	=	$params->get('paddingright', '10' );
$paddingbottom	=	$params->get('paddingbottom', '10' );
$paddingleft	=	$params->get('paddingleft', '10' );
$padding		=	'padding:'.$paddingtop.'px '.$paddingright.'px '.$paddingbottom.'px '.$paddingleft.'px; ';

// Display Border
$background		=	$params->get('background', 0);
$bgcolor		=	$params->get('bgcolor', '#ffffff');
if($background	<	1){
	$background	=	'background:none;';
} else {
	$background	=	'background:'.$bgcolor.';';
}
$borderround	=	$params->get('borderround', '0');
$border_radius	=	'border-radius:'.$borderround.'px; -moz-border-radius:'.$borderround.'px; -o-border-radius:'.$borderround.'px; -webkit-border-radius:'.$borderround.'px; ' ;
$border			=	$params->get('border', '0' );
$borderwidth	=	$params->get('borderwidth', '1' );
$bordercolor	=	$params->get('bordercolor', '#999999');
if($border 		< 	1){    
    $border		= 	'border:none; ';
} else {
	$border		= 	'border:solid '.$borderwidth.'px '.$bordercolor.'; ';
}

// Shadow
$shadow			=	$params->get('shadow', '0' );
$colorshadow	=	$params->get('colorshadow', '#666666' );
$shadowsize		=	$params->get('shadowsize', '1' );
$shadowopacity	=	$params->get('shadowopacity', '1' );
$shadowhorizontal =	$params->get('shadowhorizontal', '1' );
$shadowvertical	=	$params->get('shadowvertical', '1' );
if($shadow 		< 	1){    
    $shadow		= '';
} else {
	$shadow		= 'box-shadow:'.$colorshadow.' '.$shadowhorizontal.'px '.$shadowvertical.'px '.$shadowopacity.'px '.$shadowsize.'px; -moz-box-shadow:'.$colorshadow.' '.$shadowhorizontal.'px '.$shadowvertical.'px '.$shadowopacity.'px '.$shadowsize.'px; -webkit-box-shadow:'.$colorshadow.' '.$shadowhorizontal.'px '.$shadowvertical.'px '.$shadowopacity.'px '.$shadowsize.'px; ';
}

// S�paration lines
$linestyle		=	$params->get('linestyle', 'dotted' );
$linecolor		=	$params->get('linecolor', '#bbbbbb' );
$lineheight		=	$params->get('lineheight', '1' );
$separator		=	'style="border-top:'.$lineheight.'px '.$linestyle.' '.$linecolor.';"';

// Class suffix
$moduleclass_sfx = htmlspecialchars($params->get('moduleclass_sfx'));

// Logo 
$showlogo		=	$params->get('showlogo', 1);
$logoalign		=	$params->get('logoalign', 'left');
$logoimg		=	$params->get('logoimg', '' );
$logourl		=	$params->get('logourl', 'www.joomlatutos.com' );
$logotarget		=	$params->get('logotarget', '_blank' );
if($logourl 	==	'0'){
	$logo_urla	=	'';
	$logo_urlb	=	'';
} else {
	$logo_urla	=	'<a href="http://'.$logourl.'" target="'.$logotarget.'">';
	$logo_urlb	=	'</a>';
}
if($logoimg 	==	''){
    $logoimg 	=	$logo_urla.'<img id="jts_counter_img" src="modules/mod_jts_counterstats/tmpl/images/logo.png" alt="'.$logourl.'" title="'.$logourl.'" align="'.$logoalign.'">'.$logo_urlb;
} else {
    $logoimg 	=	$logo_urla.'<img id="jts_counter_img" src="'.$logoimg.'" alt="'.$logourl.'" title="'.$logourl.'" align="'.$logoalign.'">'.$logo_urlb;
}

// Numbers Images
$shownum		=	$params->get( 'shownum', 1);
if($shownum		< 	1){
    $shownum 	= 	'style="display:none;"';
} else {
    $shownum 	= 	'';
}
$digits 		= 	$params->get('digits', 5);
$digit_type 	= 	$params->get('digit_type', 'default');
$spacenum		=	$params->get('spacenum', '1');
$spacedigit		=	'style="margin-right:'.$spacenum.'px;"';
$showseparator1	=	$params->get('showseparator1', 0);

// Date
$showdate		=   $params->get('showdate', 0);
$showtextdate   =   $params->get('showtextdate', 1);
if($showtextdate < 	1){
    $showtextdate = 'JTS_COUNTER_ONLY_DATE';
} else {
    $showtextdate = $text_date;
}
$showseparator2	=	$params->get('showseparator2', 0);
$showtitle		=	$params->get('showtitle', 0);
$dateini   		=   $params->get('dateini', '...date...');

$date 			= 	JFactory::getDate()->toFormat('%d %B %Y');

// Stats
// Images
$showimg		=	$params->get('showimg', 1);
if($showimg		< 1){    
    $img_none 	= 'none';
} else {
	$img_none 	= 'inherit';
}
$showtoday		=	$params->get('showtoday', 1);
$showyesterday	=	$params->get('showyesterday', 1);
$showweek		=	$params->get('showweek', 1);
$showmonth		=	$params->get('showmonth', 1);
$showtotal		=	$params->get('showtotal', 1);
$showseparator3	=	$params->get('showseparator3', 1);

$day 			=	date('d');
$month1			=	date('n');
$year 			=	date('Y');
$daystart 		=	mktime(0,0,0,$month1,$day,$year);
$monthstart 	=  	mktime(0,0,0,$month1,1,$year);
// Weekstart
$weekday		=	date('w');
$weekday--;
if ($weekday 	< 	0){
	$weekday 	= 	7;
}
$weekday		=	$weekday * 24*60*60;
$weekstart		=	$daystart - $weekday;
// Yesterday
$yesterdaystart	=	$daystart - (24*60*60);
$now 			=	time();

// Online
$showonline		=	$params->get('showonline', 1);
$showguest      =   $params->get('showguest', 1);
$showregister   =   $params->get('showregister', 1);
$showname 		= 	$params->get('showname', 0);
$showseparator4	=	$params->get('showseparator4', 0);
// Users
modJVCounterHelper::tempTable();
$user = JFactory::getUser();
$username='';
if($user->id){
$username=$user->username;
}
modJVCounterHelper::kiemtra($locktime,$username,$user->id);
$array_name=array();
if($user->id){
    $array_name= array($user->username);
}
// Username
if($showname 	< 	1){    
    $text_username_result_none = 'none';
} else {
	$text_username_result_none = '';
}

// IP
$showip         =   $params->get('showip', 0);
$ip= $_SERVER['REMOTE_ADDR'];
$vcount=modJVCounterHelper::countVisit($ip,$locktime);

// Initialize
$showcounter		=	$params->get( 'showcounter', 1 );

$document = JFactory::getDocument();
$document->addStyleSheet(JURI::base().'modules/mod_jts_counterstats/tmpl/css/jts_counterstats.css');

$count=modJVCounterHelper::visitCounter();
$n=$count + $initialise;
$div=100000;
if($n>$div){
	$div*=10;
}
$arr = & modJVCounterHelper::getDigits( $count,$records);

foreach($arr as $a){
    $kq=modJVCounterHelper::showDigitImage( $digit_type, $a );
}

// Counter
$db= & JFactory::getDBO();

$query =    "SELECT COUNT(*) FROM #__vvtemp WHERE ses>'$daystart'";
$db->setQuery($query);
$today_visitors = $db->loadResult();

$query =    "SELECT COUNT(*) FROM #__vvtemp WHERE ses>'$yesterdaystart' and ses<'$daystart'";
$db->setQuery($query);
$yesterday_visitors = $db->loadResult();

$query =    "SELECT COUNT(*) FROM #__vvtemp WHERE ses>='$weekstart'";
$db->setQuery($query);
$week_visitors = $db->loadResult();

$query =    "SELECT COUNT(*) FROM #__vvtemp WHERE ses>='$monthstart'";
$db->setQuery($query);

$month_visitors =  $db->loadResult();


if($text_today==""){
    $text_today=JText::_('JTS_COUNTER_TEXT_TODAY');    
}
$stoday=modJVCounterHelper::showInfoDigit($today_visitors);

if($text_yesterday==""){
    $text_yesterday=JText::_('JTS_COUNTER_TEXT_YESTERDAY');
}
$syesterday=modJVCounterHelper::showInfoDigit($yesterday_visitors);

if($text_week==""){  
    $text_week=JText::_('JTS_COUNTER_TEXT_WEEK');
}
$sweek=modJVCounterHelper::showInfoDigit($week_visitors);

if($text_month==""){
    $text_month=JText::_('JTS_COUNTER_TEXT_MONTH');
}
$smonth=modJVCounterHelper::showInfoDigit($month_visitors);

if($text_total==""){
    $text_total=JText::_('JTS_COUNTER_TEXT_TOTAL');
}
$sall=modJVCounterHelper::showInfoDigit($n);

if($text_totalcount==""){
    $text_totalcount=JText::_('JTS_COUNTER_TEXT_TOTALUSERS');
}

$ses=modJVCounterHelper::getSes();

$s_name=modJVCounterHelper::showNameRegister($locktime);
$dem		=	0;
if($s_name){
    foreach($s_name as $a) {
    $dem++;
    }
}else{
    $dem	=	0;
}
$t_count	=	modJVCounterHelper::countTotal($locktime);
$items		=	modJVCounterHelper::getList($params);

// Plural Users online
if($t_count > 1){    
    $text_online_result = $text_plural;
} else {
	$text_online_result = '';
}
// Plural Guest
if($t_count - $dem > 1){    
    $text_guest_result = $text_plural;
} else {
	$text_guest_result = '';
}
// Plural Member
if($dem > 1){    
    $text_member_result = $text_plural;
} else {
	$text_member_result = '';
}
// Show Guest
if($t_count - $dem > 0){    
	if($showguest == 0){ 
		$guest = 0;
	} else {
		$guest = 1;
	}
}

require JModuleHelper::getLayoutPath('mod_jts_counterstats', $params->get('layout', 'default'));