|
From: <be...@us...> - 2012-11-27 23:37:45
|
Revision: 10282
http://sourceforge.net/p/xoops/svn/10282
Author: beckmi
Date: 2012-11-27 23:37:42 +0000 (Tue, 27 Nov 2012)
Log Message:
-----------
Adding Toplist module
Added Paths:
-----------
XoopsModules/toplist/
XoopsModules/toplist/branches/
XoopsModules/toplist/releases/
XoopsModules/toplist/trunk/
XoopsModules/toplist/trunk/toplist/
XoopsModules/toplist/trunk/toplist/add.php
XoopsModules/toplist/trunk/toplist/admin/
XoopsModules/toplist/trunk/toplist/admin/admin_header.php
XoopsModules/toplist/trunk/toplist/admin/index.html
XoopsModules/toplist/trunk/toplist/admin/index.php
XoopsModules/toplist/trunk/toplist/admin/menu.php
XoopsModules/toplist/trunk/toplist/details.php
XoopsModules/toplist/trunk/toplist/images/
XoopsModules/toplist/trunk/toplist/images/index.html
XoopsModules/toplist/trunk/toplist/images/toplist.png
XoopsModules/toplist/trunk/toplist/images/xoops-toplist.png
XoopsModules/toplist/trunk/toplist/include/
XoopsModules/toplist/trunk/toplist/include/date.inc.php
XoopsModules/toplist/trunk/toplist/include/functions.php
XoopsModules/toplist/trunk/toplist/include/index.html
XoopsModules/toplist/trunk/toplist/include/picture.php
XoopsModules/toplist/trunk/toplist/include/sql.querys.inc.php
XoopsModules/toplist/trunk/toplist/include/user_agent_data.class.php
XoopsModules/toplist/trunk/toplist/include/xoops.php
XoopsModules/toplist/trunk/toplist/index.php
XoopsModules/toplist/trunk/toplist/language/
XoopsModules/toplist/trunk/toplist/language/english/
XoopsModules/toplist/trunk/toplist/language/english/admin.php
XoopsModules/toplist/trunk/toplist/language/english/index.html
XoopsModules/toplist/trunk/toplist/language/english/main.php
XoopsModules/toplist/trunk/toplist/language/english/modinfo.php
XoopsModules/toplist/trunk/toplist/language/german/
XoopsModules/toplist/trunk/toplist/language/german/admin.php
XoopsModules/toplist/trunk/toplist/language/german/index.html
XoopsModules/toplist/trunk/toplist/language/german/main.php
XoopsModules/toplist/trunk/toplist/language/german/modinfo.php
XoopsModules/toplist/trunk/toplist/language/index.html
XoopsModules/toplist/trunk/toplist/sql/
XoopsModules/toplist/trunk/toplist/sql/index.html
XoopsModules/toplist/trunk/toplist/sql/mysql.sql
XoopsModules/toplist/trunk/toplist/templates/
XoopsModules/toplist/trunk/toplist/templates/index.html
XoopsModules/toplist/trunk/toplist/templates/toplist_add.html
XoopsModules/toplist/trunk/toplist/templates/toplist_code.html
XoopsModules/toplist/trunk/toplist/templates/toplist_detail.html
XoopsModules/toplist/trunk/toplist/templates/toplist_index.html
XoopsModules/toplist/trunk/toplist/templates/toplist_navi.html
XoopsModules/toplist/trunk/toplist/xoops_version.php
Added: XoopsModules/toplist/trunk/toplist/add.php
===================================================================
--- XoopsModules/toplist/trunk/toplist/add.php (rev 0)
+++ XoopsModules/toplist/trunk/toplist/add.php 2012-11-27 23:37:42 UTC (rev 10282)
@@ -0,0 +1,56 @@
+<?php
+// ------------------------------------------------------------------------- //
+// XOOPS - PHP Content Management System //
+// <http://www.xoops.org/> //
+// ------------------------------------------------------------------------- //
+// Based on: //
+// myPHPNUKE Web Portal System - http://myphpnuke.com/ //
+// PHP-NUKE Web Portal System - http://phpnuke.org/ //
+// Thatware - http://thatware.org/ //
+// ------------------------------------------------------------------------- //
+// 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. //
+// //
+// This program is distributed in the hope that it will be useful, //
+// but WITHOUT ANY WARRANTY; without even the implied warranty of //
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
+// GNU General Public License for more details. //
+// //
+// You should have received a copy of the GNU General Public License //
+// along with this program; if not, write to the Free Software //
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA //
+// ------------------------------------------------------------------------- //
+
+include_once("../../mainfile.php");
+
+if (!$xoopsUser) {
+ redirect_header( XOOPS_URL.'/user.php', 3, _MD_TOPLIST_SITE_MSG_NO_USER);
+}
+
+$xoopsOption['show_cblock'] = 1;
+$xoopsOption['template_main'] = "toplist_add.html";
+include $GLOBALS['xoops']->path('header.php');
+
+if (isset($_POST['action'])) {
+
+ if (!empty($_POST['name'])) {
+
+ $user_id = $xoopsUser->getVar('uid');
+ $website_name = stripslashes($_REQUEST['name']);
+ $website_url = $_REQUEST['url'];
+ $website_description = stripslashes($_REQUEST['description']);
+ $website_approve = 0;
+
+ $result = $xoopsDB->queryF("insert into ".$xoopsDB->prefix("toplist_websites")." set user_id = '$user_id', website_name = '$website_name', website_url = '$website_url', website_description = '$website_description', website_approve = '$website_approve' ") or
+ redirect_header( XOOPS_URL.'/modules/toplist/', 3, _MD_TOPLIST_SITE_MSG_FALSE);
+
+ redirect_header( XOOPS_URL.'/modules/toplist/', 3, _MD_TOPLIST_SITE_MSG_CHECKING);
+ exit();
+ } else {
+ redirect_header( XOOPS_URL.'/modules/toplist/add.php', 3, _MD_TOPLIST_SITE_MSG_FALSE);
+ }
+}
+include $GLOBALS['xoops']->path('footer.php');
+?>
Added: XoopsModules/toplist/trunk/toplist/admin/admin_header.php
===================================================================
--- XoopsModules/toplist/trunk/toplist/admin/admin_header.php (rev 0)
+++ XoopsModules/toplist/trunk/toplist/admin/admin_header.php 2012-11-27 23:37:42 UTC (rev 10282)
@@ -0,0 +1,27 @@
+<?php
+
+ include '../../../mainfile.php';
+ include_once XOOPS_ROOT_PATH.'/class/xoopsmodule.php';
+ include XOOPS_ROOT_PATH.'/include/cp_functions.php';
+
+ if ( $xoopsUser ) {
+ $xoopsModule = XoopsModule::getByDirname("toplist");
+
+ if ( !$xoopsUser->isAdmin($xoopsModule->mid()) ) {
+ redirect_header(XOOPS_URL."/",2,_NOPERM);
+ exit();
+ }
+ }
+ else {
+ redirect_header(XOOPS_URL."/",2,_NOPERM);
+ exit();
+ }
+
+ if ( file_exists("../language/".$xoopsConfig['language']."/admin.php") ) {
+ include("../language/".$xoopsConfig['language']."/admin.php");
+ }
+ else {
+ include("../language/english/admin.php");
+ }
+
+?>
\ No newline at end of file
Added: XoopsModules/toplist/trunk/toplist/admin/index.html
===================================================================
--- XoopsModules/toplist/trunk/toplist/admin/index.html (rev 0)
+++ XoopsModules/toplist/trunk/toplist/admin/index.html 2012-11-27 23:37:42 UTC (rev 10282)
@@ -0,0 +1 @@
+ <script>history.go(-1);</script>
\ No newline at end of file
Added: XoopsModules/toplist/trunk/toplist/admin/index.php
===================================================================
--- XoopsModules/toplist/trunk/toplist/admin/index.php (rev 0)
+++ XoopsModules/toplist/trunk/toplist/admin/index.php 2012-11-27 23:37:42 UTC (rev 10282)
@@ -0,0 +1,224 @@
+<?php
+// ------------------------------------------------------------------------- //
+// XOOPS - PHP Content Management System //
+// <http://www.xoops.org/> //
+// ------------------------------------------------------------------------- //
+// Based on: //
+// myPHPNUKE Web Portal System - http://myphpnuke.com/ //
+// PHP-NUKE Web Portal System - http://phpnuke.org/ //
+// Thatware - http://thatware.org/ //
+// ------------------------------------------------------------------------- //
+// 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. //
+// //
+// This program is distributed in the hope that it will be useful, //
+// but WITHOUT ANY WARRANTY; without even the implied warranty of //
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
+// GNU General Public License for more details. //
+// //
+// You should have received a copy of the GNU General Public License //
+// along with this program; if not, write to the Free Software //
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA //
+// ------------------------------------------------------------------------- //
+
+ include_once 'admin_header.php';
+ include XOOPS_ROOT_PATH.'/class/xoopsformloader.php';
+
+
+ if (isset($_GET['op']) && $_GET['op'] == 'Siteshow') {
+ $op = 'Siteshow';
+ }
+ if (isset($_GET['op']) && $_GET['op'] == 'Siteeedit') {
+ $op = 'Siteedit';
+ }
+ if (isset($_GET['op']) && $_GET['op'] == 'Siteblock') {
+ $op = 'Siteblock';
+ }
+ if (isset($_GET['op']) && $_GET['op'] == 'Siteapprove') {
+ $op = 'Siteapprove';
+ }
+ if (isset($_POST['op']) && $_POST['op'] == 'Sitesave') {
+ $op = 'Sitesave';
+ }
+
+/*********************************************************/
+/* Ephemerids Functions to have a Historic Ephemerids */
+/*********************************************************/
+
+function Choice() {
+
+ global $xoopsModule;
+ xoops_cp_header();
+
+ echo '<table class="outer" width="100%"><tr><td class="even">';
+ echo "<a href='../../system/admin.php?fct=preferences&op=showmod&mod=".$xoopsModule ->getVar('mid')."'>"._AM_TOPLIST_CONFIG."</a><br />";
+ echo "<a href='index.php?op=Siteshow'>"._AM_TOPLIST_EDIT."</a><br />";
+ echo '</td></tr></table>';
+ xoops_cp_footer();
+}
+
+function Siteblock($block=0) {
+
+ global $xoopsDB;
+
+ if (isset($_POST['block']) && $_POST['block'] == 1) {
+
+ $result = $xoopsDB->queryF("UPDATE ".$xoopsDB->prefix("toplist_websites")." SET website_approve = 0 WHERE id=".$xoopsDB->quoteString($_POST['id'])."");
+ redirect_header("index.php?op=Siteshow",2,_AM_TOPLIST_BLOCKTRUE);
+ exit();
+ }
+ else {
+ xoops_cp_header();
+ xoops_confirm(array('id' => $_GET['id'], 'block' => 1), 'index.php?op=Siteblock', _AM_TOPLIST_SUREBLOCKSITE);
+ xoops_cp_footer();
+ }
+}
+
+function Siteapprove() {
+
+ global $xoopsDB;
+
+ $result = $xoopsDB->queryF("UPDATE ".$xoopsDB->prefix("toplist_websites")." SET website_approve = 1 WHERE id=".$xoopsDB->quoteString($_GET['id'])."");
+
+ redirect_header("index.php?op=Siteshow",2,_AM_TOPLIST_APPROVETRUE);
+ exit();
+}
+
+
+
+function Sitesave() {
+
+ global $xoopsDB;
+
+ $id = $_POST['id'];
+ $website_name = $_POST['website_name'];
+ $website_url = $_POST['website_url'];
+ $website_description = $_POST['website_description'];
+ $website_approve = $_POST['website_approve'];
+
+
+ $xoopsDB->query("UPDATE ".$xoopsDB->prefix('toplist_websites')." SET website_name = '".$website_name."', website_url = '".$website_url."', website_description = '".$website_description."', website_approve = '".$website_approve."' WHERE id = '".$id."'");
+ redirect_header("index.php?op=Siteshow",3,_AM_TOPLIST_MSGMOD.$_POST['approved']);
+ exit();
+}
+
+function Siteedit($id) {
+
+ global $xoopsDB, $xoopsModule;
+ $myts =& MyTextSanitizer::getInstance();
+ xoops_cp_header();
+
+ $result=$xoopsDB->query("SELECT id, user_id, website_name, website_url, website_description, website_approve FROM ".$xoopsDB->prefix("toplist_websites")." WHERE id = $id ");
+ list($id, $user_id, $website_name, $website_url, $website_description, $website_approve) = $xoopsDB->fetchRow($result);
+
+ /*
+ if($user_id !=0 ) {
+ $disabled="readonly='readonly'";
+ }
+ */
+
+ $edform = new XoopsThemeForm(_AM_TOPLIST_EDITENTRY, "toplist", "index.php");
+ $edformuname = new XoopsFormText(_AM_TOPLIST_SITENAME, "website_name", 75, 75, $website_name);
+ #$edformuname->setExtra(''.$disabled.'');
+ $edform->addElement($edformuname);
+
+ $edformemail = new XoopsFormText(_AM_TOPLIST_URL, "website_url", 75, 75, $website_url);
+ #$edformemail->setExtra(''.$disabled.'');
+ $edform->addElement($edformemail);
+
+ $edformmessage = new XoopsFormDhtmlTextArea(_AM_TOPLIST_DSC, 'website_description', $website_description, 10, 50);
+ $edform->addElement($edformmessage);
+
+ $edformapprove = new XoopsFormRadioYN(_AM_TOPLIST_APPROVE, 'website_approve', $website_approve, _YES, _NO);
+ $edform->addElement($edformapprove);
+
+ $op_hidden = new XoopsFormHidden("op", "Sitesave");
+ $edform->addElement($op_hidden);
+
+ $idmsg_hidden = new XoopsFormHidden("id", $_GET['id']);
+ $edform->addElement($idmsg_hidden);
+
+ $submit_button = new XoopsFormButton("", "dbsubmit", _SUBMIT, "submit");
+ $edform->addElement($submit_button);
+
+ $edform->display();
+
+
+ xoops_cp_footer();
+}
+
+function Siteshow() {
+
+ global $xoopsDB;
+ $myts =& MyTextSanitizer::getInstance();
+ xoops_cp_header();
+
+ echo "<table border='0' width='90%' class='outer' align='center'>
+ <tr>
+ <td class='even'><b>"._AM_TOPLIST_NUM."</b></td>
+ <td class='odd'><b>"._AM_TOPLIST_SITENAME."</b></td>
+ <td class='even'><b>"._AM_TOPLIST_URL."</b></td><td class='odd'><b>"._AM_TOPLIST_DSC."</b></td>
+ <td class='even'><b>"._AM_TOPLIST_ACTION."</b></td>
+ </tr>";
+
+
+ $result=$xoopsDB->query("SELECT id, user_id, website_name, website_url, website_description, website_approve FROM ".$xoopsDB->prefix("toplist_websites")." ORDER BY id DESC");
+ $nbmessage=$xoopsDB->getRowsNum($result);
+
+ $i = 0;
+ while (list($id, $user_id, $website_name, $website_url, $website_description, $website_approve) = $xoopsDB->fetchRow($result)) {
+
+ $message = "";
+ $title = "";
+
+ $message=$myts->htmlSpecialChars($message, 0, 1, 1);
+ $title=$myts->htmlSpecialChars($title, 0, 0, 0);
+
+ if($website_approve == 0) $approve="<a href='index.php?op=Siteapprove&id=$id'>"._AM_TOPLIST_APPROVE."</a> | ";
+ else $approve="";
+ $i++;
+
+ $website_description = substr ($website_description, 0, 30 );
+
+ echo "<tr>
+ <td class='odd'>$i.)</td>
+ <td class='odd'>$website_name </td>
+ <td class='odd'>$website_url </td>
+ <td class='even'>$website_description </td>
+
+ <td class='odd'>".$approve."<a href='index.php?op=Siteeedit&id=$id'>"._AM_TOPLIST_EDIT."</a> | <a href='index.php?op=Siteblock&id=$id'>"._AM_TOPLIST_BLOCK."</a></td>
+ </tr>";
+ $nbmessage--;
+ }
+
+ echo "</table>";
+
+ xoops_cp_footer();
+}
+
+
+switch($op) {
+ case "Sitesave":
+ Sitesave();
+ break;
+ case "Siteedit":
+ Siteedit($_GET["id"]);
+ break;
+ case "Siteapprove":
+ Siteapprove();
+ break;
+ case "Siteblock":
+ Siteblock();
+ break;
+
+ case "Siteshow":
+ Siteshow();
+ break;
+ default:
+ Choice();
+ break;
+}
+
+?>
Added: XoopsModules/toplist/trunk/toplist/admin/menu.php
===================================================================
--- XoopsModules/toplist/trunk/toplist/admin/menu.php (rev 0)
+++ XoopsModules/toplist/trunk/toplist/admin/menu.php 2012-11-27 23:37:42 UTC (rev 10282)
@@ -0,0 +1,7 @@
+<?php
+
+$adminmenu[1]['title'] = _MI_TOPLIST_MODULE_SETTINGS;
+$adminmenu[1]['link'] = "admin/index.php?op=Siteshow";
+
+
+?>
\ No newline at end of file
Added: XoopsModules/toplist/trunk/toplist/details.php
===================================================================
--- XoopsModules/toplist/trunk/toplist/details.php (rev 0)
+++ XoopsModules/toplist/trunk/toplist/details.php 2012-11-27 23:37:42 UTC (rev 10282)
@@ -0,0 +1,210 @@
+<?php
+// ------------------------------------------------------------------------- //
+// XOOPS - PHP Content Management System //
+// <http://www.xoops.org/> //
+// ------------------------------------------------------------------------- //
+// Based on: //
+// myPHPNUKE Web Portal System - http://myphpnuke.com/ //
+// PHP-NUKE Web Portal System - http://phpnuke.org/ //
+// Thatware - http://thatware.org/ //
+// ------------------------------------------------------------------------- //
+// 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. //
+// //
+// This program is distributed in the hope that it will be useful, //
+// but WITHOUT ANY WARRANTY; without even the implied warranty of //
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
+// GNU General Public License for more details. //
+// //
+// You should have received a copy of the GNU General Public License //
+// along with this program; if not, write to the Free Software //
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA //
+// ------------------------------------------------------------------------- //
+
+
+
+if(strpos(getenv('REQUEST_URI'), '/modules/toplist/') === 0)
+{
+$oldurl = getenv('REQUEST_URI');
+$newurl = str_replace("modules/toplist", "topliste", $oldurl); @header("HTTP/1.1 301 Moved Permanently");
+@header("Location: $newurl");
+}
+
+include_once("../../mainfile.php");
+
+$xoopsOption['template_main'] = 'toplist_detail.html';
+
+include $GLOBALS['xoops']->path('header.php');
+
+require_once("include/functions.php");
+// check valid date
+require_once("include/date.inc.php");
+// read xoops websites today
+require_once("include/sql.querys.inc.php");
+
+// follow link
+$xoopsModuleConfig['toplist_nofollow'] == 0 ? $xoopsTpl->assign('follow', 'rel="nofollow"') : $xoopsTpl->assign('follow', '');
+
+// today
+$result21 = $xoopsDB->query($sql);
+
+#print_r($xoopsDB->fetchRow($result21));
+$website = array();
+
+while(list($site_count, $timestamp, $url, $name, $description) = $xoopsDB->fetchRow($result21)) {
+ $website[$timestamp] = array("site_count" => $site_count, "timestamp" => $timestamp, "url" => $url, "name" => $name, "description" => $description);
+}
+
+// user today exists?
+if (count($website) > 0) {
+
+ $j = 0;
+ foreach ($website as $key => $value) {
+
+ if ($key >= $t_hour) {
+ $j++;
+ }
+
+ $website_name = $value['name'];
+ $website_description = $value['description'];
+ $website_url = $value['url'];
+ }
+ $site_count = count($website);
+ $count_last_hour = $j;
+}
+
+
+$count_today = $site_count;
+$count_week = 0;
+$count_month = 0;
+$count_six_month = 0;
+$count_year = 0;
+$count_always = 0;
+$count_days = 0;
+$highest_value = 0;
+
+#print_r($website);
+
+
+$lowest_value = 10000000;
+
+// history
+$result1 = $xoopsDB->query($sql1);
+// url is valid
+
+#print_r($xoopsDB->fetchRow($result1));
+#exit();
+
+while(list($site_count, $timestamp, $profileid, $url, $name, $description) = $xoopsDB->fetchRow($result1)) {
+ $website_history[$timestamp] = array("site_count" => $site_count, "timestamp" => $timestamp, "profilid" => $profileid, "url" => $url, "name" => $name, "description" => $description);
+}
+
+#print_r($website_history);
+
+// history exists?
+if (count($website_history) > 0) {
+
+ foreach ($website_history as $key => $value) {
+
+ // online_since
+ if (!isset($online_since)) {
+ $online_since = $key;
+ }
+ // yesterday
+ if ($key == $yesterday) {
+ $count_yesterday = $value['site_count'];
+ }
+ // week
+ if ($key >= $week) {
+ $count_week = $count_week + $value['site_count'];
+ }
+ // month
+ if ($key >= $t_month) {
+ $count_month = $count_month + $value['site_count'];
+ }
+ // six month
+ if ($key >= $t_six_month) {
+ $count_six_month = $count_six_month + $value['site_count'];
+ }
+ // year
+ if ($key >= $t_year) {
+ $count_year = $count_year + $value['site_count'];
+ }
+ // always
+ $count_always = $count_always + $value['site_count'];
+
+ // count days
+ $count_days++;
+
+ // highest value
+ $highest_value < $value['site_count'] ? $highest_value = $value['site_count'] : $highest_value = $highest_value;
+
+ // lowest value
+ $lowest_value < $value['site_count'] ? $lowest_value = $lowest_value : $lowest_value = $value['site_count'];
+
+ // website description
+ $website_description = $value['description'];
+
+ // website name
+ $website_name = $value['name'];
+
+ // website url
+ $website_url = $value['url'];
+ }
+}
+
+$online_since = date("d.m.Y",$online_since);
+$online_since == "01.01.1970" ? $online_since = date("d.m.Y",time()) : $online_since = $online_since;
+
+$online_since_day = $count_days+1;
+
+$highest_value = $highest_value < $count_today ? $highest_value = $count_today : $highest_value = $highest_value;
+$lowest_value = $lowest_value > $count_today ? $lowest_value = $count_today : $lowest_value = $lowest_value;
+
+empty($lowest_value) ? $lowest_value = 0 : $lowest_value = $lowest_value;
+
+$count_last_hour = empty($count_last_hour) ? $count_last_hour = 0 : $count_last_hour = $count_last_hour;
+$count_today = empty($count_today) ? $count_today = 0 : $count_today = $count_today;
+$count_yesterday = empty($count_yesterday) ? $count_yesterday = 0 : $count_yesterday = $count_yesterday;
+$count_week = $count_week + $count_today;
+
+empty($count_week) ? $count_week = 0 : $count_week = $count_week;
+
+$count_month = $count_month + $count_today;
+
+empty($count_month) ? $count_month = 0 : $count_month = $count_month;
+
+$count_six_month = $count_six_month + $count_today;
+
+empty($count_six_month) ? $count_six_month = 0 : $count_six_month = $count_six_month;
+
+$count_year = $count_year + $count_today;
+
+empty($count_year) ? $count_year = 0 : $count_year = $count_year;
+
+$count_always = $count_always + $count_today;
+
+$average = round($count_always / $online_since_day);
+
+$xoopsTpl->assign('website_name', $website_name);
+$xoopsTpl->assign('website_description', $website_description);
+$xoopsTpl->assign('website_url', $website_url);
+$xoopsTpl->assign('online_since', $online_since);
+$xoopsTpl->assign('online_since_day', $online_since_day);
+$xoopsTpl->assign('highest_value', $highest_value);
+$xoopsTpl->assign('lowest_value', $lowest_value);
+$xoopsTpl->assign('count_last_hour', $count_last_hour);
+$xoopsTpl->assign('count_today', $count_today);
+$xoopsTpl->assign('count_yesterday', $count_yesterday);
+$xoopsTpl->assign('count_week', $count_week);
+$xoopsTpl->assign('count_month', $count_month);
+$xoopsTpl->assign('count_six_month', $count_six_month);
+$xoopsTpl->assign('count_year', $count_year);
+$xoopsTpl->assign('count_always', $count_always);
+$xoopsTpl->assign('count_average', $average);
+
+$xoopsTpl->assign('xoops_pagetitle', _MD_TOPLIST_ALWAYS." ".str_replace("http://www.","",$website_name));
+include(XOOPS_ROOT_PATH."/footer.php");
+?>
\ No newline at end of file
Added: XoopsModules/toplist/trunk/toplist/images/index.html
===================================================================
--- XoopsModules/toplist/trunk/toplist/images/index.html (rev 0)
+++ XoopsModules/toplist/trunk/toplist/images/index.html 2012-11-27 23:37:42 UTC (rev 10282)
@@ -0,0 +1 @@
+ <script>history.go(-1);</script>
\ No newline at end of file
Added: XoopsModules/toplist/trunk/toplist/images/toplist.png
===================================================================
(Binary files differ)
Property changes on: XoopsModules/toplist/trunk/toplist/images/toplist.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: XoopsModules/toplist/trunk/toplist/images/xoops-toplist.png
===================================================================
(Binary files differ)
Property changes on: XoopsModules/toplist/trunk/toplist/images/xoops-toplist.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: XoopsModules/toplist/trunk/toplist/include/date.inc.php
===================================================================
--- XoopsModules/toplist/trunk/toplist/include/date.inc.php (rev 0)
+++ XoopsModules/toplist/trunk/toplist/include/date.inc.php 2012-11-27 23:37:42 UTC (rev 10282)
@@ -0,0 +1,51 @@
+<?php
+
+$hour = date("H");
+$day = date("d");
+$month = date("m");
+$year = date("Y");
+
+$t_hour = mktime($hour-1,0,0,$month,$day,$year);
+$today = mktime(0,0,0,$month,$day,$year);
+$tomorrow = mktime(0,0,0,$month,$day+1,$year);
+$yesterday = mktime(0,0,0,$month,$day-1,$year);
+$week = mktime(0,0,0,$month,$day-6,$year);
+
+$t_month = mktime(0,0,0,$month-1,$day,$year);
+$t_six_month = mktime(0,0,0,$month-6,$day,$year);
+$t_year = mktime(0,0,0,$month,$day,$year-1);
+
+$history_array = array();
+
+#echo $today."<br>".$tomorrow;
+
+// last id in database
+$sql = "SELECT id, timestamp FROM ".$xoopsDB->prefix("toplist_log")." ORDER BY id DESC LIMIT 1";
+$result = $xoopsDB->query($sql) or exit("Error");
+$last_timestamp = $xoopsDB->fetchArray($result);
+
+// last timestamp
+if ($last_timestamp['timestamp'] < $today) {
+
+ $sql = "SELECT count(".$xoopsDB->prefix("toplist_log").".website_id) as visitors, ".$xoopsDB->prefix("toplist_log").".website_id FROM ".$xoopsDB->prefix("toplist_log")."
+ GROUP BY ".$xoopsDB->prefix("toplist_log").".website_id ORDER BY visitors DESC";
+
+ $result = $xoopsDB->query($sql);
+
+ while(list($visitors, $user_id) = $xoopsDB->fetchRow($result)) {
+
+ $history_array[] = array("website_id" => $user_id,
+ "site_count" => $visitors,
+ "timestamp" => $yesterday);
+ }
+
+ for ($i=0;$i<count($history_array);$i++) {
+ $sql_history_write = "insert into ".$xoopsDB->prefix("toplist_history")." set website_id = '".$history_array[$i]['website_id']."', site_count = '".$history_array[$i]['site_count']."', timestamp = '$yesterday'";
+ $result = $xoopsDB->queryF($sql_history_write);
+ }
+
+ // delete toplist_log
+ $result = $xoops |