Permalink
Browse files

eXperience Analytics: referral; minor other fixes

  • Loading branch information...
z3d0 committed May 4, 2012
1 parent 62c4932 commit a1ae944250e389dbd40ff5b46fbd7bf5a72dbd43
Showing with 505 additions and 152 deletions.
  1. +1 −1 .htaccess
  2. +7 −2 TODO.txt
  3. +4 −0 administrator/admin_headers.php
  4. +155 −0 administrator/analytics.php
  5. +1 −1 administrator/config.php
  6. +1 −1 administrator/newarticle.php
  7. +2 −2 administrator/newmenuvoice.php
  8. +1 −1 administrator/pages.php
  9. +2 −1 article.php
  10. +9 −0 class/eXperience.php
  11. +2 −2 class/visits.php
  12. +10 −1 config.php
  13. +21 −0 dbdata.php
  14. +55 −0 includes/referral.php
  15. +3 −2 includes/tablenames.php
  16. +1 −1 index.php
  17. +8 −1 language/en/lang_administrator.php
  18. +7 −0 language/it/lang_administrator.php
  19. +3 −1 modules/mod_homepage/module.php
  20. +73 −100 sql/experience.sql
  21. +1 −0 templates/common/administrator/css/style.css
  22. BIN templates/common/administrator/images/icon-article.png
  23. BIN templates/common/administrator/images/icon-article.png.bk
  24. BIN templates/common/administrator/images/icon-category.png
  25. BIN templates/common/administrator/images/icon-category.png.bk
  26. BIN templates/common/administrator/images/icon-config.png
  27. BIN templates/common/administrator/images/icon-config.png.bk
  28. BIN templates/common/administrator/images/icon-histogram.png
  29. BIN templates/common/administrator/images/icon-menu.png
  30. BIN templates/common/administrator/images/icon-menu.png.bk
  31. BIN templates/common/administrator/images/icon-module.png
  32. BIN templates/common/administrator/images/icon-module.png.bk
  33. BIN templates/common/administrator/images/icon-section.png
  34. BIN templates/common/administrator/images/icon-section.png.bk
  35. BIN templates/common/administrator/images/icon-template.png
  36. BIN templates/common/administrator/images/icon-template.png.bk
  37. BIN templates/common/administrator/images/icon-user.png
  38. BIN templates/common/administrator/images/icon-user.png.bk
  39. BIN templates/common/administrator/images/menu/icon-16-histogram.png
  40. +138 −35 templates/common/administrator/index.php
View
@@ -1,6 +1,6 @@
#Options +FollowSymLinks
RewriteEngine on
-RewriteBase /eXperience/
+RewriteBase /eXperience-git/
#RewriteBase /
#http://www.generateit.net/mod-rewrite/
View
@@ -13,8 +13,7 @@ quando cancello un menutype, se qualcuno lo usava che si fa??
tutte le condizioni di esistenza sui campi che devono essere univoci........
-decidere se i blocchi stan sopra o sotto
-decidere se i blocchi son relativi al template o al modulo
+eliminare tabella components e relativi richiami
html del module del template, se non esiste va ignorata la riga dell'include
@@ -46,6 +45,12 @@ permessi di visualizzazione ai moduli, li scegli nella creazione modulo
visualizzazione articoli in base al mese e anno (url sito.com/2012/02)
+cambio tipologia di pagina inline (url, article, etc) con select option e poi redirect alla modifica pagina
+
+controllo chmod e segnalazione errori
+
+se htaccess attivo crearlo in base alla base_url
+
---- PRIORITA ALTA ----
sorting categorie in ajax come nel menu
@@ -68,7 +68,9 @@
$template->replace("L_Modules", $lang['Modules']);
$template->replace("L_Plugins", $lang['Plugins']);
$template->replace("L_Extensions", $lang['Extensions']);
+$template->replace("L_Pages_manag", $lang['Pages_manag']);
$template->replace("L_Template_manag", $lang['Template_manag']);
+$template->replace("L_Analytics_tools", $lang['Analytics_tools']);
$template->replace("L_Help", $lang['Help']);
$template->replace("L_User", $lang['User']);
@@ -286,10 +288,12 @@
$template->replace("L_Search_module", $lang['Search_module']);
$template->replace("L_HTML_Header", $lang['HTML_Header']);
$template->replace("L_HTML_Footer", $lang['HTML_Footer']);
+$template->replace("L_HTML_Content", $lang['HTML_Content']);
$template->replace("L_Border_header", $lang['Border_header']);
$template->replace("L_Border_content", $lang['Border_content']);
$template->replace("L_Border_footer", $lang['Border_footer']);
$template->replace("L_Module_details", $lang['Module_details']);
$template->replace("L_Module_options", $lang['Module_options']);
+$template->replace("L_Show_module_name", $lang['Show_module_name']);
?>
View
@@ -0,0 +1,155 @@
+<?php
+/**
+*
+* @package eXperience
+* @version $Id$
+* @copyright (c) 2012 Marco Mazza
+* @license http://opensource.org/licenses/gpl-license.php GNU Public License
+*
+*/
+
+define('in_eXperience', true);
+
+define('ABSPATH', dirname(dirname(__FILE__)).'/');
+
+if ( ! file_exists( ABSPATH . 'dbdata.php') )
+{
+ header("Location: ../index.php");
+ exit;
+}
+
+include '../config.php';
+
+// Check if the user is logged in and admin
+
+if(!isSet($_SESSION['username']) || (!$User->is_admin($_SESSION['username'])))
+{
+ header("Location: index.php");
+ exit;
+}
+
+$root_path = '../';
+
+$template = new Template;
+$template->load(TEMPLATE_ADMIN_PATH . "index.php");
+
+include('./admin_headers.php');
+
+if (isset($_GET['page']))
+{
+ $page_type = $_GET['page'];
+}
+else
+{
+ $page_type = 'default';
+}
+
+switch ($page_type) {
+
+ case 'default':
+
+ $sql = 'SELECT DISTINCT parsed_url, count(*) as count, referral_id
+ FROM ' . REFERRAL_TABLE_NAME . "
+ GROUP BY parsed_url
+ ORDER BY count DESC
+ LIMIT 0,10";
+ $result = $db->sql_query($sql);
+
+ if (mysql_num_rows($result) == 0) {
+
+ $referral_list_html = "<tr><td>No referral.</td><td></td></tr>";
+
+ }
+
+ while ($rs = $db->sql_fetcharray($result)) {
+
+ $referral_list_html .= "<tr>\n
+ <td><a href=\"analytics.php?page=domain&id=" .$rs['referral_id']. "\">" .$rs['parsed_url']. "</a></td>\n
+ <td>" .$rs['count']. "</td>\n
+ </tr>\n";
+
+ }
+
+ $sql = 'SELECT count(*) as tot, search_keywords
+ FROM ' . REFERRAL_TABLE_NAME . "
+ WHERE search_keywords != ''
+ GROUP BY search_keywords
+ ORDER BY tot DESC
+ LIMIT 0,10";
+ $result = $db->sql_query($sql);
+
+ if (mysql_num_rows($result) == 0) {
+
+ $keywords_list_html = "<tr><td>No record.</td><td></td></tr>";
+
+ }
+
+ while ($rs = $db->sql_fetcharray($result)) {
+
+ $keywords_list_html .= "<tr>\n
+ <td>" .$rs['search_keywords']. "</td>\n
+ <td>" .$rs['tot']. "</td>\n
+ </tr>\n";
+
+ }
+
+ break;
+ case 'domain':
+
+ if (isset($_GET['id']))
+ {
+ $domain_id = $_GET['id'];
+
+ $sql = 'SELECT parsed_url
+ FROM ' . REFERRAL_TABLE_NAME . "
+ WHERE referral_id = '$domain_id'";
+ $result = $db->sql_query($sql);
+ $rs = $db->sql_fetcharray($result);
+
+ $parsed_url = $rs['0'];
+
+ $sql = 'SELECT complete_url
+ FROM ' . REFERRAL_TABLE_NAME . "
+ WHERE parsed_url = '$parsed_url'";
+ $result = $db->sql_query($sql);
+ while ($rs = $db->sql_fetcharray($result)) {
+
+ $complete_url_html .= "<tr>\n
+ <td><a href=\"http://" .$rs['0']. "\">" .$rs['0']. "</a></td>\n
+ </tr>\n";
+
+
+ }
+
+ $sql = 'SELECT count(*)
+ FROM ' . REFERRAL_TABLE_NAME . "
+ WHERE parsed_url = '$parsed_url'";
+ $result = $db->sql_query($sql);
+ $rs = $db->sql_fetcharray($result);
+
+ $total_urls = $rs['0'];
+
+
+
+ }
+ else
+ {
+ header("Location: analytics.php");
+ }
+
+ break;
+
+ } //switch
+
+$template->page_type = $page_type;
+
+$template->replace("referral_list", $referral_list_html);
+$template->replace("keywords_list", $keywords_list_html);
+$template->replace("complete_url", $complete_url_html);
+$template->replace("parsed_url", $parsed_url);
+$template->replace("total_urls", $total_urls);
+$template->page = "analytics";
+
+$template->publish();
+
+?>
View
@@ -3,7 +3,7 @@
*
* @package eXperience
* @version $Id$
-* @copyright (c) 2011 Marco Mazza
+* @copyright (c) 2012 Marco Mazza
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
*/
@@ -3,7 +3,7 @@
*
* @package eXperience
* @version $Id$
-* @copyright (c) 2011 Marco Mazza
+* @copyright (c) 2012 Marco Mazza
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
*/
@@ -54,11 +54,11 @@
if (isset($_GET['type']))
{
-$menutype_to_edit = $_GET['type'];
+ $menutype_to_edit = $_GET['type'];
}
else
{
-$menutype_to_edit = "article";
+ header("Location: menus.php");
}
View
@@ -86,7 +86,7 @@
else
{
$error_submit = true;
- $error_text = "Non puoi cancellare la pagina <b>Home</b>!";
+ $error_text = $lang['Error_delete_home_page'];
}
}
View
@@ -266,7 +266,7 @@
$accesso_ok = false;
//eventualmente da spostare dentro un if accesso consentito
-
+ /*
$user_ip = $_SERVER['REMOTE_ADDR'];
$timestamp = time();
@@ -297,6 +297,7 @@
$result = $db->sql_query($sql);
} else { }
+ * */
$sql = 'SELECT *
FROM ' . ARTICLE_TABLE_NAME . "
View
@@ -1,4 +1,13 @@
<?php
+/**
+*
+* @package eXperience
+* @version $Id$
+* @copyright (c) 2012 Marco Mazza
+* @license http://opensource.org/licenses/gpl-license.php GNU Public License
+*
+*/
+
class eXperience {
/*
View
@@ -4,7 +4,7 @@ class visit {
function add() {
- $user_ip = $_SERVER['REMOTE_ADDR'];
+ /*$user_ip = $_SERVER['REMOTE_ADDR'];
$user_agent = $_SERVER['HTTP_USER_AGENT'];
$timestamp = time();
@@ -21,7 +21,7 @@ function add() {
$sql = 'INSERT INTO ' . VISIT_TABLE_NAME . " VALUES ('', '', '', '', '$user_ip', '$timestamp', '$user_agent')";
$result = mysql_query($sql);
- }
+ } */
}
View
@@ -1,4 +1,12 @@
<?php
+/**
+*
+* @package eXperience
+* @version $Id$
+* @copyright (c) 2012 Marco Mazza
+* @license http://opensource.org/licenses/gpl-license.php GNU Public License
+*
+*/
if (substr_count($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip')) ob_start("ob_gzhandler"); else ob_start();
@@ -105,5 +113,6 @@
$User = new User;
-include('language.php');
+ include($root_path . 'language.php');
+ include($root_path . 'includes/referral.php');
?>
View
@@ -0,0 +1,21 @@
+<?php
+
+/** The name of the database for eXperience */
+define('DB_NAME', 'experience-git');
+
+/** MySQL database username */
+define('DB_USER', 'root');
+
+/** MySQL database password */
+define('DB_PASSWORD', '');
+
+/** MySQL hostname */
+define('DB_HOST', 'localhost');
+
+/** Database Charset to use in creating database tables. */
+define('DB_CHARSET', 'utf8');
+
+/** The Database Collate type. Don't change this if in doubt. */
+define('DB_COLLATE', '');
+
+?>
View
@@ -0,0 +1,55 @@
+<?php
+/**
+*
+* @package eXperience
+* @version $Id$
+* @copyright (c) 2012 Marco Mazza
+* @license http://opensource.org/licenses/gpl-license.php GNU Public License
+*
+*/
+
+if (isSet($_SERVER['HTTP_REFERER'])) {
+
+ $referer = $_SERVER['HTTP_REFERER'];
+ $url_host = parse_url($referer, PHP_URL_HOST);
+
+ if ($url_host == $_SERVER['HTTP_HOST']) {
+
+ //qui ci metto il breadcrumb etc
+
+ }
+
+ else {
+
+ $current_time = time();
+
+ $keyword_url = $referer;
+ $parts_url = parse_url($keyword_url);
+ $query = isset($parts_url['query']) ? $parts_url['query'] : (isset($parts_url['fragment']) ? $parts_url['fragment'] : '');
+
+ if($query) {
+
+ parse_str($query, $parts_query);
+ $keywords = isset($parts_query['q']) ? $parts_query['q'] : (isset($parts_query['p']) ? $parts_query['p'] : '');
+ }
+ else {
+
+ $keywords = "";
+
+ }
+
+ $sql = 'INSERT INTO ' . REFERRAL_TABLE_NAME . " VALUES ('', '$url_host', '$referer', '$current_time', '$keywords')";
+ $result = $db->sql_query($sql);
+
+ }
+
+}
+
+else {
+ //
+ //there is no referer, we do nothing
+ //you don't say?
+ //
+}
+
+?>
Oops, something went wrong.

0 comments on commit a1ae944

Please sign in to comment.