diff options
Diffstat (limited to 'plugins')
452 files changed, 2412 insertions, 13100 deletions
diff --git a/plugins/API/API.php b/plugins/API/API.php index 8d616b153d..c645a91aea 100644 --- a/plugins/API/API.php +++ b/plugins/API/API.php @@ -19,11 +19,11 @@ class Piwik_API extends Piwik_Plugin public function getInformation() { return array( - 'description' => Piwik_Translate('API_PluginDescription'), - 'homepage' => 'misc/redirectToUrl.php?url=http://dev.piwik.org/trac/wiki/API/Reference', + 'name' => 'API', + 'description' => 'All the data in Piwik is available through simple APIs. This plugin is the web service entry point, that you can call to get your Web Analytics data in xml, json, php, csv, etc. Discover the <a href="http://dev.piwik.org/trac/wiki/API/Reference">Piwik APIs</a>.', 'author' => 'Piwik', - 'author_homepage' => 'http://piwik.org/', - 'version' => Piwik_Version::VERSION, + 'homepage' => 'http://piwik.org/', + 'version' => '0.1', ); } } diff --git a/plugins/API/templates/listAllAPI.tpl b/plugins/API/templates/listAllAPI.tpl index 68d51b6684..42a1bcdfe3 100644 --- a/plugins/API/templates/listAllAPI.tpl +++ b/plugins/API/templates/listAllAPI.tpl @@ -1,25 +1,8 @@ {assign var=showSitesSelection value=true} {assign var=showPeriodSelection value=false} -{assign var=showMenu value=false} {include file="CoreAdminHome/templates/header.tpl"} -<style> -{fetch file="plugins/API/templates/styles.css"} -</style> -<h2>{'API_QuickDocumentationTitle'|translate}</h2> -<p>{'API_PluginDescription'|translate}</p> - -{if $isSuperUser} - <p>{'API_GenerateVisits'|translate:'VisitorGenerator':'VisitorGenerator'}</p> -{/if} - -<p><b>{'API_MoreInformation'|translate:"<a target='_blank' href='misc/redirectToUrl.php?url=http://dev.piwik.org/trac/wiki/API'>":"</a>":"<a target='_blank' href='misc/redirectToUrl.php?url=http://dev.piwik.org/trac/wiki/API/Reference'>":"</a>"}</b></p> - -<h2>{'API_UserAuthentication'|translate}</h2> -<p> -{'API_UsingTokenAuth'|translate:'<b>':'</b>':"<u><code>&token_auth=$token_auth</code></u>"}<br /> -<span id='token_auth'>token_auth = <b>{$token_auth}</b></span><br /> -{'API_KeepTokenSecret'|translate:'<b>':'</b>'} +{'API_QuickDocumentation'|translate:$token_auth} +<span id='token_auth'>token_auth = <b>{$token_auth}</b></span> <p><i>{'API_LoadedAPIs'|translate:$countLoadedAPI}</i></p> {$list_api_methods_with_links} -<br />
\ No newline at end of file diff --git a/plugins/Actions/API.php b/plugins/Actions/API.php index 8b45cc989f..658d5da13f 100644 --- a/plugins/Actions/API.php +++ b/plugins/Actions/API.php @@ -62,18 +62,7 @@ class Piwik_Actions_API public function getPageUrls( $idSite, $period, $date, $expanded = false, $idSubtable = false ) { - $dataTable = $this->getDataTable('Actions_actions_url', $idSite, $period, $date, $expanded, $idSubtable ); - - // Average time on page = total time on page / number visits on that page - $dataTable->filter('ColumnCallbackAddColumnQuotient', array('avg_time_on_page', 'sum_time_spent', 'nb_visits', 0)); - - // Bounce rate = single page visits on this page / visits started on this page - $dataTable->filter('ColumnCallbackAddColumnPercentage', array('bounce_rate', 'entry_bounce_count', 'entry_nb_visits', 0)); - - // % Exit = Number of visits that finished on this page / visits on this page - $dataTable->filter('ColumnCallbackAddColumnPercentage', array('exit_rate', 'exit_nb_visits', 'nb_visits', 0)); - - return $dataTable; + return $this->getDataTable('Actions_actions_url', $idSite, $period, $date, $expanded, $idSubtable ); } public function getPageTitles( $idSite, $period, $date, $expanded = false, $idSubtable = false) diff --git a/plugins/Actions/Actions.php b/plugins/Actions/Actions.php index 9919c02019..199726675a 100644 --- a/plugins/Actions/Actions.php +++ b/plugins/Actions/Actions.php @@ -19,8 +19,7 @@ */ class Piwik_Actions extends Piwik_Plugin { - static protected $actionUrlCategoryDelimiter = null; - static protected $actionTitleCategoryDelimiter = null; + static protected $actionCategoryDelimiter = null; static protected $defaultActionName = null; static protected $defaultActionNameWhenNotDefined = null; static protected $defaultActionUrlWhenNotDefined = null; @@ -32,10 +31,11 @@ class Piwik_Actions extends Piwik_Plugin public function getInformation() { $info = array( - 'description' => Piwik_Translate('Actions_PluginDescription'), + 'name' => 'Actions', + 'description' => 'Reports about the page views, the outlinks and downloads. Outlinks and Downloads tracking is automatic!', 'author' => 'Piwik', - 'author_homepage' => 'http://piwik.org/', - 'version' => Piwik_Version::VERSION, + 'homepage' => 'http://piwik.org/', + 'version' => '0.1', ); return $info; } @@ -53,18 +53,7 @@ class Piwik_Actions extends Piwik_Plugin public function __construct() { - // for BC, we read the old style delimiter first (see #1067) - $actionDelimiter = Zend_Registry::get('config')->General->action_category_delimiter; - if(empty($actionDelimiter)) - { - self::$actionUrlCategoryDelimiter = Zend_Registry::get('config')->General->action_url_category_delimiter; - self::$actionTitleCategoryDelimiter = Zend_Registry::get('config')->General->action_title_category_delimiter; - } - else - { - self::$actionUrlCategoryDelimiter = self::$actionTitleCategoryDelimiter = $actionDelimiter; - } - + self::$actionCategoryDelimiter = Zend_Registry::get('config')->General->action_category_delimiter; self::$defaultActionName = Zend_Registry::get('config')->General->action_default_name; self::$defaultActionNameWhenNotDefined = Zend_Registry::get('config')->General->action_default_name_when_not_defined; self::$defaultActionUrlWhenNotDefined = Zend_Registry::get('config')->General->action_default_url_when_not_defined; @@ -75,8 +64,6 @@ class Piwik_Actions extends Piwik_Plugin function addWidgets() { - Piwik_AddWidget( 'Actions_Actions', 'Actions_SubmenuPagesEntry', 'Actions', 'getEntryPageUrls'); - Piwik_AddWidget( 'Actions_Actions', 'Actions_SubmenuPagesExit', 'Actions', 'getExitPageUrls'); Piwik_AddWidget( 'Actions_Actions', 'Actions_SubmenuPages', 'Actions', 'getPageUrls'); Piwik_AddWidget( 'Actions_Actions', 'Actions_SubmenuPageTitles', 'Actions', 'getPageTitles'); Piwik_AddWidget( 'Actions_Actions', 'Actions_SubmenuOutlinks', 'Actions', 'getOutlinks'); @@ -86,8 +73,6 @@ class Piwik_Actions extends Piwik_Plugin function addMenus() { Piwik_AddMenu('Actions_Actions', 'Actions_SubmenuPages', array('module' => 'Actions', 'action' => 'getPageUrls')); - Piwik_AddMenu('Actions_Actions', 'Actions_SubmenuPagesEntry', array('module' => 'Actions', 'action' => 'getEntryPageUrls')); - Piwik_AddMenu('Actions_Actions', 'Actions_SubmenuPagesExit', array('module' => 'Actions', 'action' => 'getExitPageUrls')); Piwik_AddMenu('Actions_Actions', 'Actions_SubmenuPageTitles', array('module' => 'Actions', 'action' => 'getPageTitles')); Piwik_AddMenu('Actions_Actions', 'Actions_SubmenuOutlinks', array('module' => 'Actions', 'action' => 'getOutlinks')); Piwik_AddMenu('Actions_Actions', 'Actions_SubmenuDownloads', array('module' => 'Actions', 'action' => 'getDownloads')); @@ -128,7 +113,6 @@ class Piwik_Actions extends Piwik_Plugin public function archiveDay( $notification ) { //TODO Actions should use integer based keys like other archive in piwik - /* @var $archiveProcessing Piwik_ArchiveProcessing */ $archiveProcessing = $notification->getNotificationObject(); $this->actionsTablesByType = array( @@ -159,12 +143,11 @@ class Piwik_Actions extends Piwik_Plugin FROM (".$archiveProcessing->logTable." as t1 LEFT JOIN ".$archiveProcessing->logVisitActionTable." as t2 USING (idvisit)) LEFT JOIN ".$archiveProcessing->logActionTable." as t3 ON (t2.idaction_url = t3.idaction) - WHERE visit_last_action_time >= ? - AND visit_last_action_time <= ? + WHERE visit_server_date = ? AND idsite = ? GROUP BY t3.idaction ORDER BY nb_hits DESC"; - $query = $archiveProcessing->db->query($query, array( $archiveProcessing->getStartDatetimeUTC(), $archiveProcessing->getEndDatetimeUTC(), $archiveProcessing->idsite )); + $query = $archiveProcessing->db->query($query, array( $archiveProcessing->strDateStart, $archiveProcessing->idsite )); $modified = $this->updateActionsTableWithRowQuery($query); /* @@ -178,12 +161,11 @@ class Piwik_Actions extends Piwik_Plugin FROM (".$archiveProcessing->logTable." as t1 LEFT JOIN ".$archiveProcessing->logVisitActionTable." as t2 USING (idvisit)) LEFT JOIN ".$archiveProcessing->logActionTable." as t3 ON (t2.idaction_name = t3.idaction) - WHERE visit_last_action_time >= ? - AND visit_last_action_time <= ? + WHERE visit_server_date = ? AND idsite = ? GROUP BY t3.idaction ORDER BY nb_hits DESC"; - $query = $archiveProcessing->db->query($query, array( $archiveProcessing->getStartDatetimeUTC(), $archiveProcessing->getEndDatetimeUTC(), $archiveProcessing->idsite )); + $query = $archiveProcessing->db->query($query, array( $archiveProcessing->strDateStart, $archiveProcessing->idsite )); $modified = $this->updateActionsTableWithRowQuery($query); /* @@ -198,12 +180,11 @@ class Piwik_Actions extends Piwik_Plugin sum(case visit_total_actions when 1 then 1 else 0 end) as entry_bounce_count FROM ".$archiveProcessing->logTable." JOIN ".$archiveProcessing->logActionTable." ON (visit_entry_idaction_url = idaction) - WHERE visit_last_action_time >= ? - AND visit_last_action_time <= ? + WHERE visit_server_date = ? AND idsite = ? GROUP BY visit_entry_idaction_url "; - $query = $archiveProcessing->db->query($query, array( $archiveProcessing->getStartDatetimeUTC(), $archiveProcessing->getEndDatetimeUTC(), $archiveProcessing->idsite )); + $query = $archiveProcessing->db->query($query, array( $archiveProcessing->strDateStart, $archiveProcessing->idsite )); $modified = $this->updateActionsTableWithRowQuery($query); @@ -213,15 +194,15 @@ class Piwik_Actions extends Piwik_Plugin $query = "SELECT name, type, count(distinct visitor_idcookie) as exit_nb_uniq_visitors, - count(*) as exit_nb_visits + count(*) as exit_nb_visits, + sum(case visit_total_actions when 1 then 1 else 0 end) as exit_bounce_count FROM ".$archiveProcessing->logTable." JOIN ".$archiveProcessing->logActionTable." ON (visit_exit_idaction_url = idaction) - WHERE visit_last_action_time >= ? - AND visit_last_action_time <= ? + WHERE visit_server_date = ? AND idsite = ? GROUP BY visit_exit_idaction_url "; - $query = $archiveProcessing->db->query($query, array( $archiveProcessing->getStartDatetimeUTC(), $archiveProcessing->getEndDatetimeUTC(), $archiveProcessing->idsite )); + $query = $archiveProcessing->db->query($query, array( $archiveProcessing->strDateStart, $archiveProcessing->idsite )); $modified = $this->updateActionsTableWithRowQuery($query); /* @@ -233,12 +214,11 @@ class Piwik_Actions extends Piwik_Plugin FROM (".$archiveProcessing->logTable." log_visit JOIN ".$archiveProcessing->logVisitActionTable." log_link_visit_action USING (idvisit)) JOIN ".$archiveProcessing->logActionTable." log_action ON (log_action.idaction = log_link_visit_action.idaction_url_ref) - WHERE visit_last_action_time >= ? - AND visit_last_action_time <= ? + WHERE visit_server_date = ? AND idsite = ? GROUP BY idaction_url_ref "; - $query = $archiveProcessing->db->query($query, array( $archiveProcessing->getStartDatetimeUTC(), $archiveProcessing->getEndDatetimeUTC(), $archiveProcessing->idsite )); + $query = $archiveProcessing->db->query($query, array( $archiveProcessing->strDateStart, $archiveProcessing->idsite )); $modified = $this->updateActionsTableWithRowQuery($query); $this->archiveDayRecordInDatabase($archiveProcessing); } @@ -340,21 +320,12 @@ class Piwik_Actions extends Piwik_Plugin } } - if($type == Piwik_Tracker_Action::TYPE_ACTION_NAME) - { - $categoryDelimiter = self::$actionTitleCategoryDelimiter; - } - else - { - $categoryDelimiter = self::$actionUrlCategoryDelimiter; - } - - if(empty($categoryDelimiter)) + if(empty(self::$actionCategoryDelimiter)) { return array( trim($name) ); } - $split = explode($categoryDelimiter, $name, self::$limitLevelSubCategory); + $split = explode(self::$actionCategoryDelimiter, $name, self::$limitLevelSubCategory); // trim every category and remove empty categories $split = array_map('trim', $split); @@ -378,14 +349,9 @@ class Piwik_Actions extends Piwik_Plugin $rowsProcessed = 0; while( $row = $query->fetch() ) { - // in some unknown case, the type field is NULL, as reported in #1082 - we ignore this page view - if(empty($row['type'])) { - continue; - } - $actionExplodedNames = $this->getActionExplodedNames($row['name'], $row['type']); - // we work on the root table of the given TYPE (either ACTION_URL or DOWNLOAD or OUTLINK etc.) + // we work on the root table of the given TYPE (either ACTION or DOWNLOAD or OUTLINK etc.) $currentTable =& $this->actionsTablesByType[$row['type']]; // go to the level of the subcategory @@ -404,7 +370,7 @@ class Piwik_Actions extends Piwik_Plugin { $actionName = '/' . $actionName; } - else + else if( $row['type'] == Piwik_Tracker_Action::TYPE_ACTION_NAME ) { $actionName = ' ' . $actionName; } @@ -431,14 +397,6 @@ class Piwik_Actions extends Piwik_Plugin } } - // For pages that bounce, we don't know the time on page. - if($row['type'] == Piwik_Tracker_Action::TYPE_ACTION_URL - && isset($row['nb_visits']) - && !isset($row['sum_time_spent'])) - { - $row['sum_time_spent'] = Zend_Registry::get('config')->Tracker->default_time_one_page_visit * $row['nb_visits']; - } - foreach($row as $name => $value) { // we don't add this information as itnot pertinent diff --git a/plugins/Actions/Controller.php b/plugins/Actions/Controller.php index 5e85433fbb..64974199b4 100644 --- a/plugins/Actions/Controller.php +++ b/plugins/Actions/Controller.php @@ -17,91 +17,29 @@ */ class Piwik_Actions_Controller extends Piwik_Controller { - const ACTIONS_REPORT_ROWS_DISPLAY = 100; - - protected function getPageUrlsView($currentAction, $controllerActionSubtable) + public function getPageUrls($fetch = false) { $view = Piwik_ViewDataTable::factory(); $view->init( $this->pluginName, - $currentAction, + __FUNCTION__, 'Actions.getPageUrls', - $controllerActionSubtable ); + 'getPageUrlsSubDataTable' ); $view->setColumnTranslation('label', Piwik_Translate('Actions_ColumnPageURL')); - return $view; - } - - public function getPageUrls($fetch = false) - { - $view = $this->getPageUrlsView(__FUNCTION__, 'getPageUrlsSubDataTable'); - $this->configureViewPageUrls($view); $this->configureViewActions($view); return $this->renderView($view, $fetch); } public function getPageUrlsSubDataTable($fetch = false) { - $view = $this->getPageUrlsView(__FUNCTION__, 'getPageUrlsSubDataTable'); - $this->configureViewPageUrls($view); - $this->configureViewActions($view); - return $this->renderView($view, $fetch); - } - - protected function configureViewPageUrls($view) - { - $view->setColumnsToDisplay( array('label','nb_hits','nb_visits', 'bounce_rate', 'avg_time_on_page', 'exit_rate') ); - } - - public function getEntryPageUrls($fetch = false) - { - $view = $this->getPageUrlsView(__FUNCTION__, 'getEntryPageUrlsSubDataTable'); - $this->configureViewEntryPageUrls($view); - $this->configureViewActions($view); - return $this->renderView($view, $fetch); - } - - public function getEntryPageUrlsSubDataTable($fetch = false) - { - $view = $this->getPageUrlsView(__FUNCTION__, 'getEntryPageUrlsSubDataTable'); - $this->configureViewEntryPageUrls($view); + $view = Piwik_ViewDataTable::factory(); + $view->init( $this->pluginName, + __FUNCTION__, + 'Actions.getPageUrls', + 'getActionsSubDataTable' ); $this->configureViewActions($view); return $this->renderView($view, $fetch); } - - protected function configureViewEntryPageUrls($view) - { - $view->setSortedColumn('entry_nb_visits'); - $view->setColumnsToDisplay( array('label','entry_nb_visits', 'entry_bounce_count', 'bounce_rate') ); - $view->setColumnTranslation('entry_bounce_count', Piwik_Translate('General_ColumnBounces'), Piwik_Translate('General_BouncesDefinition')); - $view->setColumnTranslation('entry_nb_visits', Piwik_Translate('General_ColumnEntrances'), Piwik_Translate('General_EntrancesDefinition')); - // remove pages that are not entry pages - $view->queueFilter('ColumnCallbackDeleteRow', array('entry_nb_visits', 'strlen')); - } - public function getExitPageUrls($fetch = false) - { - $view = $this->getPageUrlsView(__FUNCTION__, 'getExitPageUrlsSubDataTable'); - $this->configureViewExitPageUrls($view); - $this->configureViewActions($view); - return $this->renderView($view, $fetch); - } - - public function getExitPageUrlsSubDataTable($fetch = false) - { - $view = $this->getPageUrlsView(__FUNCTION__, 'getExitPageUrlsSubDataTable'); - $this->configureViewExitPageUrls($view); - $this->configureViewActions($view); - return $this->renderView($view, $fetch); - } - - protected function configureViewExitPageUrls($view) - { - $view->setSortedColumn('exit_nb_visits'); - $view->setColumnsToDisplay( array('label', 'exit_nb_visits', 'nb_visits', 'exit_rate') ); - $view->setColumnTranslation('exit_nb_visits', Piwik_Translate('General_ColumnExits'), Piwik_Translate('General_ExitsDefinition')); - // remove pages that are not exit pages - $view->queueFilter('ColumnCallbackDeleteRow', array('exit_nb_visits', 'strlen')); - } - public function getPageTitles($fetch = false) { $view = Piwik_ViewDataTable::factory(); @@ -110,7 +48,6 @@ class Piwik_Actions_Controller extends Piwik_Controller 'Actions.getPageTitles', 'getPageTitlesSubDataTable' ); $view->setColumnTranslation('label', Piwik_Translate('Actions_ColumnPageName')); - $this->configureViewPageTitles($view); $this->configureViewActions($view); return $this->renderView($view, $fetch); } @@ -122,16 +59,10 @@ class Piwik_Actions_Controller extends Piwik_Controller __FUNCTION__, 'Actions.getPageTitles', 'getPageTitlesSubDataTable' ); - $this->configureViewPageTitles($view); $this->configureViewActions($view); return $this->renderView($view, $fetch); } - protected function configureViewPageTitles($view) - { - $view->setColumnsToDisplay( array('label','nb_hits','nb_visits') ); - } - public function getDownloads($fetch = false) { $view = Piwik_ViewDataTable::factory(); @@ -141,6 +72,7 @@ class Piwik_Actions_Controller extends Piwik_Controller 'getDownloadsSubDataTable' ); $this->configureViewDownloads($view); + $view->disableShowAllColumns(); return $this->renderView($view, $fetch); } @@ -152,6 +84,7 @@ class Piwik_Actions_Controller extends Piwik_Controller 'Actions.getDownloads', 'getDownloadsSubDataTable'); $this->configureViewDownloads($view); + $view->disableSearchBox(); return $this->renderView($view, $fetch); } @@ -163,6 +96,8 @@ class Piwik_Actions_Controller extends Piwik_Controller 'Actions.getOutlinks', 'getOutlinksSubDataTable' ); $this->configureViewOutlinks($view); + $view->disableExcludeLowPopulation(); + $view->disableShowAllColumns(); return $this->renderView($view, $fetch); } @@ -174,21 +109,34 @@ class Piwik_Actions_Controller extends Piwik_Controller 'Actions.getOutlinks', 'getOutlinksSubDataTable'); $this->configureViewOutlinks($view); + $view->disableSearchBox(); return $this->renderView($view, $fetch); } - /* - * Page titles & Page URLs reports - */ protected function configureViewActions($view) { + $view->setTemplate('CoreHome/templates/datatable_actions.tpl'); + + if(Piwik_Common::getRequestVar('idSubtable', -1) != -1) + { + $view->setTemplate('CoreHome/templates/datatable_actions_subdatable.tpl'); + } + $currentlySearching = $view->setSearchRecursive(); + + if($currentlySearching) + { + $view->setTemplate('CoreHome/templates/datatable_actions_recursive.tpl'); + } + $view->disableSort(); + $view->disableOffsetInformation(); + $view->disableShowAllViewsIcons(); + $view->disableShowAllColumns(); + + $view->setLimit( 100 ); + $view->setColumnsToDisplay( array('label','nb_hits','nb_visits') ); $view->setColumnTranslation('nb_hits', Piwik_Translate('General_ColumnPageviews')); $view->setColumnTranslation('nb_visits', Piwik_Translate('General_ColumnUniquePageviews')); - $view->setColumnTranslation('avg_time_on_page', Piwik_Translate('General_ColumnAverageTimeOnPage'), Piwik_Translate('General_AverageTimeOnPageDefinition')); - $view->setColumnTranslation('bounce_rate', Piwik_Translate('General_ColumnBounceRate'), Piwik_Translate('General_PageBounceRateDefinition')); - $view->setColumnTranslation('exit_rate', Piwik_Translate('General_ColumnExitRate'), Piwik_Translate('General_PageExitRateDefinition')); - $view->queueFilter('ColumnCallbackReplace', array('avg_time_on_page', array('Piwik', 'getPrettyTimeFromSeconds'))); - + if(Piwik_Common::getRequestVar('enable_filter_excludelowpop', '0', 'string' ) != '0') { // computing minimum value to exclude @@ -202,14 +150,18 @@ class Piwik_Actions_Controller extends Piwik_Controller $view->setExcludeLowPopulation( 'nb_hits', $nbActionsLowPopulationThreshold ); } - - $this->configureGenericViewActions($view); + + $view->main(); + + // we need to rewrite the phpArray so it contains all the recursive arrays + if($currentlySearching) + { + $phpArrayRecursive = $this->getArrayFromRecursiveDataTable($view->getDataTable()); + $view->getView()->arrayDataTable = $phpArrayRecursive; + } return $view; } - /* - * Downloads report - */ protected function configureViewDownloads($view) { $view->setColumnsToDisplay( array('label','nb_visits','nb_hits') ); @@ -217,12 +169,9 @@ class Piwik_Actions_Controller extends Piwik_Controller $view->setColumnTranslation('nb_hits', Piwik_Translate('Actions_ColumnDownloads')); $view->setColumnTranslation('nb_visits', Piwik_Translate('Actions_ColumnUniqueDownloads')); $view->disableExcludeLowPopulation(); - $this->configureGenericViewActions($view); + $view->setLimit( 15 ); } - /* - * Outlinks report - */ protected function configureViewOutlinks($view) { $view->setColumnsToDisplay( array('label','nb_visits','nb_hits') ); @@ -230,38 +179,9 @@ class Piwik_Actions_Controller extends Piwik_Controller $view->setColumnTranslation('nb_hits', Piwik_Translate('Actions_ColumnClicks')); $view->setColumnTranslation('nb_visits', Piwik_Translate('Actions_ColumnUniqueClicks')); $view->disableExcludeLowPopulation(); - $this->configureGenericViewActions($view); + $view->setLimit( 15 ); } - /* - * Common to all Actions reports, how to use the custom Actions Datatable html - */ - protected function configureGenericViewActions($view) - { - $view->setTemplate('CoreHome/templates/datatable_actions.tpl'); - if(Piwik_Common::getRequestVar('idSubtable', -1) != -1) - { - $view->setTemplate('CoreHome/templates/datatable_actions_subdatable.tpl'); - } - $currentlySearching = $view->setSearchRecursive(); - if($currentlySearching) - { - $view->setTemplate('CoreHome/templates/datatable_actions_recursive.tpl'); - } - // disable Footer icons - $view->disableShowAllViewsIcons(); - $view->disableShowAllColumns(); - - $view->setLimit( self::ACTIONS_REPORT_ROWS_DISPLAY ); - $view->main(); - // we need to rewrite the phpArray so it contains all the recursive arrays - if($currentlySearching) - { - $phpArrayRecursive = $this->getArrayFromRecursiveDataTable($view->getDataTable()); - $view->getView()->arrayDataTable = $phpArrayRecursive; - } - } - protected function getArrayFromRecursiveDataTable( $dataTable, $depth = 0 ) { $table = array(); diff --git a/plugins/Actions/tests/Actions.test.php b/plugins/Actions/tests/Actions.test.php index a7f0197334..08f11e81ef 100644 --- a/plugins/Actions/tests/Actions.test.php +++ b/plugins/Actions/tests/Actions.test.php @@ -56,11 +56,7 @@ class Test_Piwik_Actions extends UnitTestCase ), array( 'params' => array( 'name' => '', 'type' => Piwik_Tracker_Action::TYPE_ACTION_NAME), - 'expected' => array( Zend_Registry::get('config')->General->action_default_name_when_not_defined ), - ), - array( - 'params' => array( 'name' => '', 'type' => Piwik_Tracker_Action::TYPE_ACTION_URL), - 'expected' => array( Zend_Registry::get('config')->General->action_default_url_when_not_defined ), + 'expected' => array( 'index' ), ), array( 'params' => array( 'name' => 'http://example.org/download.zip', 'type' => Piwik_Tracker_Action::TYPE_DOWNLOAD), diff --git a/plugins/AnonymizeIP/AnonymizeIP.php b/plugins/AnonymizeIP/AnonymizeIP.php deleted file mode 100644 index e921b57e31..0000000000 --- a/plugins/AnonymizeIP/AnonymizeIP.php +++ /dev/null @@ -1,79 +0,0 @@ -<?php -/** - * Piwik - Open source web analytics - * - * @link http://piwik.org - * @license http://www.gnu.org/licenses/gpl-3.0.html Gpl v3 or later - * @version $Id$ - * - * @category Piwik_Plugins - * @package Piwik_AnonymizeIP - */ - -/** - * Anonymize visitor IP addresses to comply with the privacy laws/guidelines in countries, such as Germany. - * - * @package Piwik_AnonymizeIP - */ -class Piwik_AnonymizeIP extends Piwik_Plugin -{ - /** - * Get plugin information - */ - public function getInformation() - { - return array( - 'description' => Piwik_Translate('AnonymizeIP_PluginDescription'), - 'author' => 'Piwik', - 'author_homepage' => 'http://piwik.org/', - 'version' => Piwik_Version::VERSION, - 'TrackerPlugin' => true, - ); - } - - /** - * Get list of hooks to register - */ - public function getListHooksRegistered() - { - return array( - 'Tracker.saveVisitorInformation' => 'anonymizeVisitorIpAddress', - ); - } - - /** - * Internal function to mask portions of the visitor IP address - * - * @param $ip Unsigned long representation of IP address - * @param $maskLength Number of octets to reset - */ - static public function applyIPMask($ip, $maskLength) - { - $maskedIP = pack('V', (float)$ip); - - switch($maskLength) { - case 4: - $maskedIP[3] = "\0"; - case 3: - $maskedIP[2] = "\0"; - case 2: - $maskedIP[1] = "\0"; - case 1: - $maskedIP[0] = "\0"; - case 0: - default: - } - - $res = unpack('V', $maskedIP); - return sprintf("%u", $res[1]); - } - - /** - * Hook on Tracker.saveVisitorInformation to anonymize visitor IP addresses - */ - function anonymizeVisitorIpAddress($notification) - { - $visitorInfo =& $notification->getNotificationObject(); - $visitorInfo['location_ip'] = self::applyIPMask($visitorInfo['location_ip'], Piwik_Tracker_Config::getInstance()->Tracker['ip_address_mask_length']); - } -} diff --git a/plugins/AnonymizeIP/tests/AnonymizeIP.test.php b/plugins/AnonymizeIP/tests/AnonymizeIP.test.php deleted file mode 100644 index 7afd3e68bc..0000000000 --- a/plugins/AnonymizeIP/tests/AnonymizeIP.test.php +++ /dev/null @@ -1,46 +0,0 @@ -<?php -if(!defined("PIWIK_PATH_TEST_TO_ROOT")) { - define('PIWIK_PATH_TEST_TO_ROOT', getcwd().'/../../..'); -} -if(!defined('PIWIK_CONFIG_TEST_INCLUDED')) -{ - require_once PIWIK_PATH_TEST_TO_ROOT . "/tests/config_test.php"; -} - -if(!class_exists('Piwik_AnonymizeIP', false)) -{ - require_once dirname(__FILE__) . '/../AnonymizeIP.php'; -} - -class Test_Piwik_AnonymizeIP extends UnitTestCase -{ - // IP addresses and expected results - protected $ipAddresses = array( - // long => array( expected0, expected1, expected2, expected3, expected4 ), - '0' => array( 0, 0, 0, 0, 0 ), // 00 00 00 00 - '1' => array( 1, 0, 0, 0, 0 ), // 00 00 00 01 - '255' => array( 255, 0, 0, 0, 0 ), // 00 00 00 FF - '256' => array( 256, 256, 0, 0, 0 ), // 00 00 01 00 - '257' => array( 257, 256, 0, 0, 0 ), // 00 00 01 01 - '65535' => array( 65535, 65280, 0, 0, 0), // 00 00 FF FF - '65536' => array( 65536, 65536, 65536, 0, 0), // 00 01 00 00 - '65793' => array( 65793, 65792, 65536, 0, 0), // 00 01 01 01 - '16777215' => array( 16777215, 16776960, 16711680, 0, 0), // 00 FF FF FF - '16777216' => array( 16777216, 16777216, 16777216, 16777216, 0), // 01 00 00 00 - '2147483647' => array( 2147483647, 2147483392, 2147418112, 2130706432, 0), // 7F FF FF FF - '2147483648' => array( '2147483648', '2147483648', '2147483648', '2147483648', 0), // 80 00 00 00 - '4294967295' => array( '4294967295', '4294967040', '4294901760', '4278190080', 0), // FF FF FF FF - ); - - public function test_applyIPMask() - { - foreach($this->ipAddresses as $ip => $expected) - { - // each IP is tested with 0 to 4 octets masked - for($maskLength = 0; $maskLength <= 4; $maskLength++) - { - $this->assertTrue( Piwik_AnonymizeIP::applyIPMask($ip, $maskLength) == $expected[$maskLength] ); - } - } - } -} diff --git a/plugins/CoreAdminHome/Controller.php b/plugins/CoreAdminHome/Controller.php index 2c63abbc7c..767d6ce8ca 100644 --- a/plugins/CoreAdminHome/Controller.php +++ b/plugins/CoreAdminHome/Controller.php @@ -16,38 +16,37 @@ */ class Piwik_CoreAdminHome_Controller extends Piwik_Controller { - public function index() + function getDefaultAction() { - return $this->redirectToIndex('UsersManager', 'userSettings'); + return 'redirectToIndex'; + } + + function redirectToIndex() + { + if(Piwik::isUserIsSuperUser()) + { + $module = 'CorePluginsAdmin'; + } + else + { + $module = 'SitesManager'; + } + header("Location:index.php?module=" . $module); } - public function generalSettings() + public function index() { - $view = Piwik_View::factory('generalSettings'); - $view->enableBrowserTriggerArchiving = Piwik_ArchiveProcessing::isBrowserTriggerArchivingEnabled(); - $view->todayArchiveTimeToLive = Piwik_ArchiveProcessing::getTodayArchiveTimeToLive(); - - $this->setGeneralVariablesView($view); - $view->menu = Piwik_GetAdminMenu(); + Piwik::checkUserIsSuperUser(); + $view = $this->getDefaultIndexView(); echo $view->render(); } - public function setGeneralSettings() + protected function getDefaultIndexView() { - $response = new Piwik_API_ResponseBuilder(Piwik_Common::getRequestVar('format')); - try { - Piwik::checkUserIsSuperUser(); - $this->checkTokenInUrl(); - $enableBrowserTriggerArchiving = Piwik_Common::getRequestVar('enableBrowserTriggerArchiving'); - $todayArchiveTimeToLive = Piwik_Common::getRequestVar('todayArchiveTimeToLive'); - - Piwik_ArchiveProcessing::setBrowserTriggerArchiving((bool)$enableBrowserTriggerArchiving); - Piwik_ArchiveProcessing::setTodayArchiveTimeToLive($todayArchiveTimeToLive); - $toReturn = $response->getResponse(); - } catch(Exception $e ) { - $toReturn = $response->getResponseException( $e ); - } - echo $toReturn; + $view = Piwik_View::factory('index'); + $view->content = ''; + $this->setGeneralVariablesView($view); + $view->menu = Piwik_GetAdminMenu(); + return $view; } - } diff --git a/plugins/CoreAdminHome/CoreAdminHome.php b/plugins/CoreAdminHome/CoreAdminHome.php index 8b15308f92..c395ae00c2 100644 --- a/plugins/CoreAdminHome/CoreAdminHome.php +++ b/plugins/CoreAdminHome/CoreAdminHome.php @@ -19,10 +19,11 @@ class Piwik_CoreAdminHome extends Piwik_Plugin public function getInformation() { return array( - 'description' => Piwik_Translate('CoreAdminHome_PluginDescription'), + 'name' => 'Administration area', + 'description' => 'Administration area of Piwik.', 'author' => 'Piwik', - 'author_homepage' => 'http://piwik.org/', - 'version' => Piwik_Version::VERSION, + 'homepage' => 'http://piwik.org/', + 'version' => '0.1', ); } @@ -30,7 +31,6 @@ class Piwik_CoreAdminHome extends Piwik_Plugin { return array( 'template_css_import' => 'css', - 'AdminMenu.add' => 'addMenu' ); } @@ -38,12 +38,4 @@ class Piwik_CoreAdminHome extends Piwik_Plugin { echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"plugins/CoreAdminHome/templates/menu.css\" />\n"; } - - function addMenu() - { - Piwik_AddAdminMenu('CoreAdminHome_MenuGeneralSettings', - array('module' => 'CoreAdminHome', 'action' => 'generalSettings'), - Piwik::isUserIsSuperUser(), - $order = 6); - } } diff --git a/plugins/CoreAdminHome/templates/footer.tpl b/plugins/CoreAdminHome/templates/footer.tpl index 4c988266c2..f9ab9402da 100644 --- a/plugins/CoreAdminHome/templates/footer.tpl +++ b/plugins/CoreAdminHome/templates/footer.tpl @@ -1,2 +1,2 @@ -</div> + {include file="CoreHome/templates/piwik_tag.tpl"} diff --git a/plugins/CoreAdminHome/templates/generalSettings.js b/plugins/CoreAdminHome/templates/generalSettings.js deleted file mode 100644 index f77a5ff9f5..0000000000 --- a/plugins/CoreAdminHome/templates/generalSettings.js +++ /dev/null @@ -1,30 +0,0 @@ -function getGeneralSettingsAJAX() -{ - var ajaxRequest = piwikHelper.getStandardAjaxConf('ajaxLoading', 'ajaxError'); - var enableBrowserTriggerArchiving = $('input[name=enableBrowserTriggerArchiving]:checked').val(); - var todayArchiveTimeToLive = $('#todayArchiveTimeToLive').val(); - var request = ''; - request += 'module=CoreAdminHome'; - request += '&action=setGeneralSettings'; - request += '&format=json'; - request += '&enableBrowserTriggerArchiving='+enableBrowserTriggerArchiving; - request += '&todayArchiveTimeToLive='+todayArchiveTimeToLive; - request += '&token_auth=' + piwik.token_auth; - ajaxRequest.data = request; - return ajaxRequest; -} - -$(document).ready( function() { - $('#generalSettingsSubmit').click( function() { - $.ajax( getGeneralSettingsAJAX() ); - }); - - $('input').keypress( function(e) { - var key=e.keyCode || e.which; - if (key==13) { - $('#generalSettingsSubmit').click(); - } - } - ) -}); - diff --git a/plugins/CoreAdminHome/templates/generalSettings.tpl b/plugins/CoreAdminHome/templates/generalSettings.tpl deleted file mode 100644 index fa103f4347..0000000000 --- a/plugins/CoreAdminHome/templates/generalSettings.tpl +++ /dev/null @@ -1,53 +0,0 @@ -{assign var=showSitesSelection value=false} -{assign var=showPeriodSelection value=false} -{include file="CoreAdminHome/templates/header.tpl"} -{loadJavascriptTranslations plugins='UsersManager'} -<script type="text/javascript" src="plugins/CoreAdminHome/templates/generalSettings.js"></script> - -<h2>{'General_GeneralSettings'|translate}</h2> - -{ajaxErrorDiv id=ajaxError} -{ajaxLoadingDiv id=ajaxLoading} -<table class="adminTable adminTableNoBorder" style='width:900px;'> -<tr> - <td style='width:400px'>{'General_AllowPiwikArchivingToTriggerBrowser'|translate}</td> - <td style='width:220px'> - <fieldset> - <label><input type="radio" value="1" name="enableBrowserTriggerArchiving"{if $enableBrowserTriggerArchiving==1} checked="checked"{/if} /> - {'General_Yes'|translate} <br /> - <span class="form-description">{'General_Default'|translate}</span> - </label><br /><br /> - - <label><input type="radio" value="0" name="enableBrowserTriggerArchiving"{if $enableBrowserTriggerArchiving==0} checked="checked"{/if} /> - {'General_No'|translate} <br /> - <span class="form-description">{'General_ArchivingTriggerDescription'|translate:"<a href='misc/redirectToUrl.php?url=http://piwik.org/docs/setup-auto-archiving/' target='_blank'>":"</a>"}</span> - </label> - </fieldset> - <td> - {capture assign=browserArchivingHelp} - {'General_ArchivingInlineHelp'|translate}<br /> - {'General_SeeTheOfficialDocumentationForMoreInformation'|translate:"<a href='misc/redirectToUrl.php?url=http://piwik.org/docs/setup-auto-archiving/' target='_blank'>":"</a>"} - {/capture} - {$browserArchivingHelp|inlineHelp} </td> - </td> -</tr> -<tr> - <td><label for="todayArchiveTTL">{'General_ReportsForTodayWillBeProcessedAtMostEvery'|translate}</label></td> - <td> - {'General_NSeconds'|translate:"<input size='3' value='$todayArchiveTimeToLive' id='todayArchiveTimeToLive' />"} - </td> - <td width='450px'> - {capture assign=archiveTodayTTLHelp} - {'General_SmallTrafficYouCanLeaveDefault'|translate:10}<br /> - {'General_MediumToHighTrafficItIsRecommendedTo'|translate:1800:3600} - {/capture} - {$archiveTodayTTLHelp|inlineHelp} </td> - </td> -</tr> - -</table> -<input type="submit" value="{'General_Save'|translate}" id="generalSettingsSubmit" class="submit" /> -<br /><br /> - - -{include file="CoreAdminHome/templates/footer.tpl"} diff --git a/plugins/CoreAdminHome/templates/header.tpl b/plugins/CoreAdminHome/templates/header.tpl index c40295db70..c58df79c2b 100644 --- a/plugins/CoreAdminHome/templates/header.tpl +++ b/plugins/CoreAdminHome/templates/header.tpl @@ -2,7 +2,7 @@ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> -<title>Piwik › {'CoreAdminHome_Administration'|translate}</title> +<title>Piwik › Administration</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta name="generator" content="Piwik {$piwik_version}" /> <link rel="shortcut icon" href="plugins/CoreHome/templates/images/favicon.ico" /> @@ -10,20 +10,18 @@ {include file="CoreHome/templates/js_global_variables.tpl"} <link rel="stylesheet" type="text/css" href="themes/default/common.css" /> -<link rel="stylesheet" type="text/css" href="libs/jquery/themes/base/jquery-ui.css" class="ui-theme" /> +<link rel="stylesheet" type="text/css" href="libs/jquery/jquery-calendar.css" /> +<link rel="stylesheet" type="text/css" href="libs/jquery/thickbox.css" /> <link rel="stylesheet" type="text/css" href="plugins/CoreAdminHome/templates/styles.css" /> {postEvent name="template_css_import"} +<script type="text/javascript" src="themes/default/common.js"></script> <script type="text/javascript" src="libs/jquery/jquery.js"></script> <script type="text/javascript" src="libs/jquery/jquery-ui.js"></script> -<script type="text/javascript" src="libs/jquery/jquery.bgiframe.js"></script> <script type="text/javascript" src="libs/jquery/jquery.blockUI.js"></script> +<script type="text/javascript" src="libs/jquery/thickbox.js"></script> <script type="text/javascript" src="libs/jquery/fdd2div-modified.js"></script> <script type="text/javascript" src="libs/javascript/sprintf.js"></script> -<script type="text/javascript" src="themes/default/common.js"></script> - -<script type="text/javascript" src="libs/jquery/jquery.history.js"></script> -<script type="text/javascript" src="plugins/CoreHome/templates/broadcast.js"></script> {postEvent name="template_js_import"} </head> @@ -37,22 +35,6 @@ {include file="CoreHome/templates/js_disabled_notice.tpl"} </div> -<br class="clearAll" /> +<br clear="all"/> <div id="content"> - -{ajaxRequestErrorDiv} -{if !isset($showMenu) || $showMenu} - {include file="CoreAdminHome/templates/menu.tpl"} -{/if} - -{if !empty($configFileNotWritable)} -<div class="ajaxSuccess" style="display:normal"> - <p>{'General_ConfigFileIsNotWritable'|translate:"(config/config.ini.php)":"<br/>"}</p> -</div> -{elseif strpos($url, 'updated=1')} -<div class="ajaxSuccess" style="display:normal"> - <p>{'General_YourChangesHaveBeenSaved'|translate}</p> -</div> -{/if} - diff --git a/plugins/CoreAdminHome/templates/index.tpl b/plugins/CoreAdminHome/templates/index.tpl new file mode 100644 index 0000000000..e207fb8be4 --- /dev/null +++ b/plugins/CoreAdminHome/templates/index.tpl @@ -0,0 +1,17 @@ +{assign var=showSitesSelection value=false} +{assign var=showPeriodSelection value=false} +{include file="CoreAdminHome/templates/header.tpl"} +{include file="CoreAdminHome/templates/menu.tpl"} + +<div style="clear:both;"> + +<div id='content'> +{if $content}{$content}{/if} +</div> + +<div id="footer" style="border-top:1px solid gray; margin-top:20px;padding-top:10px;"> +<a href='index.php?module=CoreHome'>{'General_BackToHomepage'|translate}</a> + +</div> + +{include file="CoreAdminHome/templates/footer.tpl"} diff --git a/plugins/CoreAdminHome/templates/menu.css b/plugins/CoreAdminHome/templates/menu.css index 8ecc659a4c..772e5d90eb 100644 --- a/plugins/CoreAdminHome/templates/menu.css +++ b/plugins/CoreAdminHome/templates/menu.css @@ -1,5 +1,5 @@ #tablist { - padding-bottom: 1px; + padding: 3px 0; margin-left: 0; margin-bottom: 0; margin-top: 0.1em; @@ -10,7 +10,6 @@ list-style: none; display: inline; margin: 0; - padding-bottom:3px; } #tablist li a { @@ -25,11 +24,9 @@ #tablist li a:link,#tablist li a:visited { color: black; - -moz-border-radius:4px 4px 0 0; - -webkit-border-radius:4px 4px 0 0; } -#tablist li a:hover, #tablist li a.active { +#tablist li a:hover { color: black; background: #defdbb; border-color: black; diff --git a/plugins/CoreAdminHome/templates/menu.tpl b/plugins/CoreAdminHome/templates/menu.tpl index 9200e8160c..3dc4469aa5 100644 --- a/plugins/CoreAdminHome/templates/menu.tpl +++ b/plugins/CoreAdminHome/templates/menu.tpl @@ -1,9 +1,7 @@ -{if count($menu) > 1} - <div id="menu"> - <ul id="tablist"> - {foreach from=$menu key=name item=url name=menu} - <li> <a href='index.php{$url|@urlRewriteWithParameters}' {if isset($currentAdminMenuName) && $name==$currentAdminMenuName}class='active'{/if}>{$name|translate}</a></li> - {/foreach} - </ul> - </div> -{/if}
\ No newline at end of file +<div id="menu"> +<ul id="tablist"> +{foreach from=$menu key=name item=url name=menu} + <li><a href='index.php{$url|@urlRewriteWithParameters}'>{$name|translate}</a></li> +{/foreach} +</ul> +</div> diff --git a/plugins/CoreAdminHome/templates/styles.css b/plugins/CoreAdminHome/templates/styles.css index 3c2bbdda7b..04cfb8fa59 100644 --- a/plugins/CoreAdminHome/templates/styles.css +++ b/plugins/CoreAdminHome/templates/styles.css @@ -1,9 +1,15 @@ +body { + font-family: Georgia, Trebuchet MS, arial, sans-serif; +} + img { vertical-align: baseline; } + textarea { font-size: 1em; } + a { color: black; } @@ -34,13 +40,15 @@ table.admin tbody tr { table.admin tbody td { color: #414141; text-align: left; - vertical-align:top; } table.admin tbody th { text-align: left; padding: 2px; } +table.admin tbody td { + vertical-align:middle; +} table.admin tbody td, table.admin tbody th { color: #536C2A; text-decoration: none; @@ -87,16 +95,20 @@ table.admin tbody td:hover, table.admin tbody th:hover { h2 { border-bottom-color:#DADADA; color:#666666; + -x-system-font:none; border-bottom-style:solid; border-bottom-width:1px; clear:both; font-family:Georgia,"Times New Roman",Times,serif; font-size:24px; font-size-adjust:none; + font-stretch:normal; font-style:normal; + font-variant:normal; font-weight:normal; + line-height:normal; margin:5px 0pt 0pt -4px; - padding:0pt 0px 7px 0pt; + padding:0pt 280px 7px 0pt; } p { @@ -108,19 +120,7 @@ p { margin:0pt 15px; padding:0pt; } -textarea, input, select { - background-color:#FFFFFF; - border-color:#939EA5; - -moz-border-radius:4px; - -webkit-border-radius:4px; - border-style:solid; - border-width:1px; - margin:1px; - padding:3px; -} -input[disabled] { - background-color:#F7F7F7; -} + .adminTable { border-width: 1px; border-style: solid; @@ -139,9 +139,8 @@ input[disabled] { border-bottom-width: 1px; border-bottom-style: solid; border-bottom-color: #ccc; - font-size: 13px; + font-size: 11px; vertical-align: text-top; - vertical-align:top; } .adminTable td { padding: 7px 15px 9px 10px; @@ -189,23 +188,3 @@ input[disabled] { .adminTable .active { background-color: #ECF9DD; } - -.adminTable .ui-inline-help { - margin-top:0; - width:100%; -} -/* admin table, without borders */ -.adminTableNoBorder { - border:0; -} -.adminTableNoBorder td, .adminTableNoBorder th { - border:0; -} - -/* other styles */ - -.form-description { - color:#666666; - font-style:italic; - margin-left:10px; -}
\ No newline at end of file diff --git a/plugins/CoreHome/Controller.php b/plugins/CoreHome/Controller.php index 853e65d4e3..043feb8f28 100644 --- a/plugins/CoreHome/Controller.php +++ b/plugins/CoreHome/Controller.php @@ -23,22 +23,13 @@ class Piwik_CoreHome_Controller extends Piwik_Controller function redirectToCoreHomeIndex() { - $defaultReport = Piwik_UsersManager_API::getInstance()->getUserPreference(Piwik::getCurrentUserLogin(), Piwik_UsersManager_API::PREFERENCE_DEFAULT_REPORT); - $module = 'CoreHome'; - $action = 'index'; - - // User preference: default report to load is the All Websites dashboard - if($defaultReport == 'MultiSites' - && Piwik_PluginsManager::getInstance()->isPluginActivated('MultiSites')) + // redirect to Login only for anonymous user + if((bool)Zend_Registry::get('config')->General->default_module_login == true + && Piwik::getCurrentUserLogin() == 'anonymous') { - $module = 'MultiSites'; + return Piwik_FrontController::dispatch('Login', false); } - if($defaultReport == Piwik::getLoginPluginName()) - { - $module = Piwik::getLoginPluginName(); - } - - parent::redirectToIndex($module, $action); + parent::redirectToIndex('CoreHome', 'index'); } public function showInContext() @@ -46,6 +37,7 @@ class Piwik_CoreHome_Controller extends Piwik_Controller $controllerName = Piwik_Common::getRequestVar('moduleToLoad'); $actionName = Piwik_Common::getRequestVar('actionToLoad', 'index'); $view = $this->getDefaultIndexView(); + $view->basicHtmlView = true; $view->content = Piwik_FrontController::getInstance()->fetchDispatch( $controllerName, $actionName ); echo $view->render(); } @@ -59,33 +51,8 @@ class Piwik_CoreHome_Controller extends Piwik_Controller return $view; } - protected function setDateTodayIfWebsiteCreatedToday() - { - $date = Piwik_Common::getRequestVar('date', false); - if($date == 'today') - { - return; - } - $websiteId = Piwik_Common::getRequestVar('idSite', false); - if ($websiteId) { - $website = new Piwik_Site($websiteId); - $datetimeCreationDate = $this->site->getCreationDate()->getDatetime(); - $creationDateLocalTimezone = Piwik_Date::factory($datetimeCreationDate, $website->getTimezone())->toString('Y-m-d'); - $todayLocalTimezone = Piwik_Date::factory('now', $website->getTimezone())->toString('Y-m-d'); - if( $creationDateLocalTimezone == $todayLocalTimezone ) - { - Piwik::redirectToModule( 'CoreHome', 'index', - array( 'date' => 'today', - 'idSite' => $websiteId, - 'period' => Piwik_Common::getRequestVar('period')) - ); - } - } - } - public function index() { - $this->setDateTodayIfWebsiteCreatedToday(); $view = $this->getDefaultIndexView(); echo $view->render(); } diff --git a/plugins/CoreHome/CoreHome.php b/plugins/CoreHome/CoreHome.php index 7fb831ce9d..8fd24df88e 100644 --- a/plugins/CoreHome/CoreHome.php +++ b/plugins/CoreHome/CoreHome.php @@ -19,10 +19,11 @@ class Piwik_CoreHome extends Piwik_Plugin public function getInformation() { return array( - 'description' => Piwik_Translate('CoreHome_PluginDescription'), + 'name' => 'Homepage', + 'description' => 'Web Analytics Reports Structure.', 'author' => 'Piwik', - 'author_homepage' => 'http://piwik.org/', - 'version' => Piwik_Version::VERSION, + 'homepage' => 'http://piwik.org/', + 'version' => '0.1', ); } } diff --git a/plugins/CoreHome/templates/broadcast.js b/plugins/CoreHome/templates/broadcast.js index 74d1149ee3..1a2d67383c 100644 --- a/plugins/CoreHome/templates/broadcast.js +++ b/plugins/CoreHome/templates/broadcast.js @@ -19,8 +19,6 @@ broadcast.init = function() { // Initialize history plugin. // The callback is called at once by present location.hash $.historyInit(broadcast.pageload); - - piwikHelper.showAjaxLoading(); } /************************************************ @@ -63,23 +61,16 @@ broadcast.propagateAjax = function (ajaxUrl) // available in global scope var currentHashStr = window.location.hash; - // Because $.history plugin doesn't care about # or ? sign in front of the query string - // We take it out if it exists + // Because $.history plugin doens't care about # or ? sign infront of the query string + // We take it out if exist; currentHashStr = currentHashStr.replace(/^\?|^#/,''); ajaxUrl = ajaxUrl.replace(/^\?|&#/,''); var params_vals = ajaxUrl.split("&"); - for( var i=0; i<params_vals.length; i++ ) - { - currentHashStr = broadcast.updateParamValue(params_vals[i],currentHashStr); + for( var i=0; i<params_vals.length; i++ ) { + currentHashStr = broadcast.updateParamValue(params_vals[i],currentHashStr); } - // if the module is not 'Goals', we specifically unset the 'idGoal' parameter - // this is to ensure that the URLs are clean (and that clicks on graphs work as expected - they are broken with the extra parameter) - if(broadcast.getParamValue('action', currentHashStr) != 'goalReport') - { - currentHashStr = broadcast.updateParamValue('idGoal=', currentHashStr); - } // Let history know about this new Hash and load it. $.historyLoad(currentHashStr); }; @@ -115,10 +106,7 @@ broadcast.propagateNewPage = function (str) for( var i=0; i<params_vals.length; i++ ) { // update both the current search query and hash string currentSearchStr = broadcast.updateParamValue(params_vals[i],currentSearchStr); - - if(currentHashStr.length != 0 ) { - currentHashStr = broadcast.updateParamValue(params_vals[i],currentHashStr); - } + currentHashStr = broadcast.updateParamValue(params_vals[i],currentHashStr); } // Now load the new page. @@ -147,17 +135,12 @@ broadcast.updateParamValue = function(newParamValue,urlStr) var paramName = p_v[0]; var valFromUrl = broadcast.getParamValue(paramName,urlStr); - // if set 'idGoal=' then we remove the parameter from the URL automatically (rather than passing an empty value) - var paramValue = p_v[1]; - if(paramValue == '') - { - newParamValue = ''; - } + if( valFromUrl != '') { // replacing current param=value to newParamValue; var regToBeReplace = new RegExp(paramName + '=' + valFromUrl, 'ig'); urlStr = urlStr.replace( regToBeReplace, newParamValue ); - } else if(newParamValue != '') { + } else { urlStr += (urlStr == '') ? newParamValue : '&' + newParamValue; } @@ -171,7 +154,8 @@ broadcast.loadAjaxContent = function(urlAjax) { urlAjax = urlAjax.match(/^\?/) ? urlAjax : "?" + urlAjax; - piwikHelper.showAjaxLoading(); + // showing loading... + $('#loadingPiwik').show(); $('#content').hide(); $("object").remove(); @@ -180,21 +164,21 @@ broadcast.loadAjaxContent = function(urlAjax) function sectionLoaded(content) { - if(content.substring(0, 14) == '<!DOCTYPE html') { - window.location.reload(); - return; - } + if(content.substring(0, 14) == '<!DOCTYPE html') { + window.location.reload(); + return; + } if(urlAjax == broadcast.lastUrlRequested) { - $('#content').html( content ).show(); - piwikHelper.hideAjaxLoading(); - broadcast.lastUrlRequested = null; - } + $('#content').html( content ).show(); + $('#loadingPiwik').hide(); + broadcast.lastUrlRequested = null; + } } - piwikMenu.activateMenu( - broadcast.getParamValue('module', urlAjax), - broadcast.getParamValue('action', urlAjax), - broadcast.getParamValue('idGoal', urlAjax) + piwikMenu.activateMenu( + broadcast.getParamValue('module', urlAjax), + broadcast.getParamValue('action', urlAjax), + broadcast.getParamValue('idGoal', urlAjax) ); ajaxRequest = { type: 'GET', diff --git a/plugins/CoreHome/templates/calendar.js b/plugins/CoreHome/templates/calendar.js index 506f994e00..43f35f0110 100644 --- a/plugins/CoreHome/templates/calendar.js +++ b/plugins/CoreHome/templates/calendar.js @@ -1,20 +1,22 @@ + Date.prototype.getWeek = function() { - var onejan = new Date(this.getFullYear(),0,1); - return Math.ceil((((this - onejan) / 86400000) + onejan.getDay())/7); +var onejan = new Date(this.getFullYear(),0,1); +return Math.ceil((((this - onejan) / 86400000) + onejan.getDay())/7); } var splitDate = piwik.currentDateString.split("-"); + var currentYear = splitDate[0]; var currentMonth = splitDate[1] - 1; var currentDay = splitDate[2]; -var currentDate = new Date(currentYear, currentMonth, currentDay); +var currentDate = new Date(currentYear, currentMonth, currentDay); var todayDate = new Date; var todayMonth = todayDate.getMonth(); var todayYear = todayDate.getFullYear(); var todayDay = todayDate.getDate(); -function highlightCurrentPeriod( date ) +function isDateSelected( date ) { var valid = false; @@ -23,16 +25,21 @@ function highlightCurrentPeriod( date ) var dateDay = date.getDate(); var style = ''; - // we don't color dates in the future + if( date.toLocaleDateString() == todayDate.toLocaleDateString()) + { + style = style + 'dateToday '; + } + + // we dont color dates in the future if( dateMonth == todayMonth && dateYear == todayYear && dateDay >= todayDay ) { - return [true, '']; + return [true, style]; } - // we don't color dates before the minimum date + // we dont color dates before the minimum date if( dateYear < piwik.minDateYear || ( dateYear == piwik.minDateYear && @@ -44,7 +51,7 @@ function highlightCurrentPeriod( date ) ) ) { - return [true, '']; + return [true, style]; } // we color all day of the month for the same year for the month period @@ -80,85 +87,67 @@ function highlightCurrentPeriod( date ) if(valid) { - return [true, 'ui-datepicker-current-period']; + return [true, style+'dateUsedStats']; } + return [true, style]; +} + - return [true, '']; +function updateDate() +{ + var date = formatDate(popUpCal.getDateFor($('#calendar')[0])); + // Let broadcast do it job: + // It will replace date value to both search query and hash and load the new page. + broadcast.propagateNewPage('date='+date); } -function updateDate(dateText, inst) +function formatDate(date) { - var date = dateText; - // Let broadcast do its job: - // It will replace date value to both search query and hash and load the new page. - broadcast.propagateNewPage('date=' + date); + var day = date.getDate(); + var month = date.getMonth() + 1; + return date.getFullYear() + '-' + + (month < 10 ? '0' : '') + month + '-' + + (day < 10 ? '0' : '') + day ; } $(document).ready(function(){ - $('#datepicker').datepicker({ - onSelect: updateDate, - showOtherMonths: false, - dateFormat: 'yy-mm-dd', - firstDay: 1, - minDate: new Date(piwik.minDateYear, piwik.minDateMonth - 1, piwik.minDateDay), - maxDate: new Date(piwik.maxDateYear, piwik.maxDateMonth - 1, piwik.maxDateDay), - prevText: "", - nextText: "", - currentText: "", - beforeShowDay: highlightCurrentPeriod, - defaultDate: currentDate, - changeMonth: true, - changeYear: true, - // jquery-ui-i18n 1.7.2 lacks some translations, so we use our own - dayNamesMin: [ - _pk_translate('CoreHome_DaySu_js'), - _pk_translate('CoreHome_DayMo_js'), - _pk_translate('CoreHome_DayTu_js'), - _pk_translate('CoreHome_DayWe_js'), - _pk_translate('CoreHome_DayTh_js'), - _pk_translate('CoreHome_DayFr_js'), - _pk_translate('CoreHome_DaySa_js')], - dayNamesShort: [ - _pk_translate('CoreHome_ShortDay_1_js'), - _pk_translate('CoreHome_ShortDay_2_js'), - _pk_translate('CoreHome_ShortDay_3_js'), - _pk_translate('CoreHome_ShortDay_4_js'), - _pk_translate('CoreHome_ShortDay_5_js'), - _pk_translate('CoreHome_ShortDay_6_js'), - _pk_translate('CoreHome_ShortDay_7_js')], - dayNames: [ - _pk_translate('CoreHome_LongDay_1_js'), - _pk_translate('CoreHome_LongDay_2_js'), - _pk_translate('CoreHome_LongDay_3_js'), - _pk_translate('CoreHome_LongDay_4_js'), - _pk_translate('CoreHome_LongDay_5_js'), - _pk_translate('CoreHome_LongDay_6_js'), - _pk_translate('CoreHome_LongDay_7_js')], - monthNamesShort: [ - _pk_translate('CoreHome_ShortMonth_1_js'), - _pk_translate('CoreHome_ShortMonth_2_js'), - _pk_translate('CoreHome_ShortMonth_3_js'), - _pk_translate('CoreHome_ShortMonth_4_js'), - _pk_translate('CoreHome_ShortMonth_5_js'), - _pk_translate('CoreHome_ShortMonth_6_js'), - _pk_translate('CoreHome_ShortMonth_7_js'), - _pk_translate('CoreHome_ShortMonth_8_js'), - _pk_translate('CoreHome_ShortMonth_9_js'), - _pk_translate('CoreHome_ShortMonth_10_js'), - _pk_translate('CoreHome_ShortMonth_11_js'), - _pk_translate('CoreHome_ShortMonth_12_js')], - monthNames: [ - _pk_translate('CoreHome_MonthJanuary_js'), - _pk_translate('CoreHome_MonthFebruary_js'), - _pk_translate('CoreHome_MonthMarch_js'), - _pk_translate('CoreHome_MonthApril_js'), - _pk_translate('CoreHome_MonthMay_js'), - _pk_translate('CoreHome_MonthJune_js'), - _pk_translate('CoreHome_MonthJuly_js'), - _pk_translate('CoreHome_MonthAugust_js'), - _pk_translate('CoreHome_MonthSeptember_js'), - _pk_translate('CoreHome_MonthOctober_js'), - _pk_translate('CoreHome_MonthNovember_js'), - _pk_translate('CoreHome_MonthDecember_js')] - }); -}); + + $("#calendar").calendar({ + onSelect: updateDate, + showOtherMonths: true, + dateFormat: 'DMY-', + firstDay: 1, + minDate: new Date(piwik.minDateYear, piwik.minDateMonth - 1, piwik.minDateDay), + maxDate: new Date(piwik.maxDateYear, piwik.maxDateMonth - 1, piwik.maxDateDay), + changeFirstDay: false, + prevText: "", + nextText: "", + currentText: "", + customDate: isDateSelected, + dayNames: [ + _pk_translate('CoreHome_DaySu_js'), + _pk_translate('CoreHome_DayMo_js'), + _pk_translate('CoreHome_DayTu_js'), + _pk_translate('CoreHome_DayWe_js'), + _pk_translate('CoreHome_DayTh_js'), + _pk_translate('CoreHome_DayFr_js'), + _pk_translate('CoreHome_DaySa_js')], + monthNames: [ + _pk_translate('CoreHome_MonthJanuary_js'), + _pk_translate('CoreHome_MonthFebruary_js'), + _pk_translate('CoreHome_MonthMarch_js'), + _pk_translate('CoreHome_MonthApril_js'), + _pk_translate('CoreHome_MonthMay_js'), + _pk_translate('CoreHome_MonthJune_js'), + _pk_translate('CoreHome_MonthJuly_js'), + _pk_translate('CoreHome_MonthAugust_js'), + _pk_translate('CoreHome_MonthSeptember_js'), + _pk_translate('CoreHome_MonthOctober_js'), + _pk_translate('CoreHome_MonthNovember_js'), + _pk_translate('CoreHome_MonthDecember_js')] + }, + currentDate); + + $("#calendar").hide(); + } +); diff --git a/plugins/CoreHome/templates/cloud.tpl b/plugins/CoreHome/templates/cloud.tpl index b05a8db239..18d24c1e7e 100644 --- a/plugins/CoreHome/templates/cloud.tpl +++ b/plugins/CoreHome/templates/cloud.tpl @@ -1,12 +1,12 @@ <div id="{$properties.uniqueId}"> <div class="tagCloud"> {if count($cloudValues) == 0} - <div class="pk-emptyDataTable">{'General_NoDataForTagCloud'|translate}</div> + <div id="emptyDatatable">{'General_NoDataForTagCloud'|translate}</div> {else} {foreach from=$cloudValues key=word item=value} <span title="{$value.word} ({$value.value} {$columnTranslation})" class="word size{$value.size} {* we strike tags with 0 hits *} {if $value.value == 0}valueIsZero{/if}"> {if false !== $labelMetadata[$value.word].url}<a href="{$labelMetadata[$value.word].url}" target="_blank">{/if} - {if false !== $labelMetadata[$value.word].logo}<img src="{$labelMetadata[$value.word].logo}" width="{$value.logoWidth}" />{else} + {if false !== $labelMetadata[$value.word].logo}<img src="{$labelMetadata[$value.word].logo}" width="{$value.logoWidth}">{else} {$value.wordTruncated}{/if}{if false !== $labelMetadata[$value.word].url}</a>{/if}</span> {/foreach} {/if} diff --git a/plugins/CoreHome/templates/datatable.css b/plugins/CoreHome/templates/datatable.css index 47f89df30e..48fcf6824f 100644 --- a/plugins/CoreHome/templates/datatable.css +++ b/plugins/CoreHome/templates/datatable.css @@ -1,4 +1,3 @@ - /*Overriding some dataTable css for better dashboard display*/ .widget .dataTableWrapper, .widget .dataTableAllColumnsWrapper, @@ -53,7 +52,6 @@ table.dataTable td.label, table.subDataTable td.label, table.dataTableActions td.label { width: 100%; - white-space:nowrap; } table.dataTable img, @@ -83,15 +81,6 @@ table.dataTable th { background: #D4E3ED url(images/bg_header.jpg) repeat-x; } -table.dataTable th.first { - -moz-border-radius:6px 0 0 0; - -webkit-border-radius:6px 0 0 0; -} - -table.dataTable th.last { - -moz-border-radius:0 6px 0 0; - -webkit-border-radius:0 6px 0 0; -} table.dataTable th.columnSorted { font-weight: bold; padding-right: 20px; @@ -219,86 +208,85 @@ table thead div { position: absolute; } -.dataTablePages { +#dataTablePages { color: #BFBFBF; font-weight: bold; margin: 10px; font-size: 0.9em; } -.dataTableSearchPattern { +#dataTableSearchPattern { display: inline; white-space: nowrap; } -.dataTableSearchPattern input { +#dataTableSearchPattern input { font-size: 0.7em; padding: 2px; border: 1px solid #B3B3B3; color: #0C183A; } -.dataTableSearchPattern input:hover { +#dataTableSearchPattern input:hover { background: #F7F7FF none repeat scroll 0%; } -.dataTableSearchPattern #keyword { +#dataTableSearchPattern #keyword { background: transparent url(images/search.png) no-repeat scroll 4px center; padding: 3px 3px 3px 20px; } -.dataTableExcludeLowPopulation,.dataTableNext,.dataTablePrevious { +#dataTableExcludeLowPopulation,#dataTableNext,#dataTablePrevious { font-size: 0.9em; color: #184A83; text-decoration: underline; cursor: pointer; } -/* @todo are these supposed to be together? */ -.subDataTable.dataTableFeatures { +.subDataTable#dataTableFeatures { padding-top: 0px; padding-bottom: 5px; width: 100%; } -.dataTableFeatures { +#dataTableFeatures { padding-top: 10px; padding-bottom: 10px; width: 100%; text-align: center; } -.dataTableExcludeLowPopulation { +#dataTableExcludeLowPopulation { float: right; font-size: 0.8em; color: #C3C6D8; text-align: right; } -.dataTableNext,.dataTablePrevious,.dataTableSearchPattern,.pk-loadingDataTable +#dataTableNext,#dataTablePrevious,#dataTableSearchPattern,#loadingDataTable { display: none; } -.subDataTable .dataTableFooterIcons { +.subDataTable #dataTableFooterIcons { height: 0px; } -.dataTableFooterIcons { +#dataTableFooterIcons { float: right; height: 18px; } -.exportToFormatIcons { +#exportToFormat { float: right; } -.dataTableFooterIconsShow { +#dataTableFooterIconsShow { float: right; } -.dataTableFooterIcons,.dataTableFooterIcons a { +#dataTableFooterIcons,#dataTableFooterIcons a { text-decoration: none; color: #8894B1; font-size:0.9em; @@ -308,7 +296,7 @@ table thead div { clear: both; } -.pk-loadingDataTable { +#loadingDataTable { float: left; font-size: 0.9em; color: #193B6C; @@ -320,7 +308,6 @@ table.dataTableActions tr td.labelodd { background-image: none; } - /* levels higher than 4 have a default padding left */ tr.subActionsDataTable td.label,tr.actionsDataTable td.label { padding-left: 7em; @@ -331,32 +318,27 @@ tr.level0 td.label { } tr.level1 td.label { - padding-left: +2.5em; + padding-left: +3.5em; } tr.level2 td.label { - padding-left: +3.5em; + padding-left: +5.5em; } tr.level3 td.label { - padding-left: +4.5em; + padding-left: +6.5em; } tr.level4 td.label { - padding-left: +5em; + padding-left: +7em; } -/* less right margins for the link image in the Pa*/ -table.dataTableActions img.link { - margin-right: 0.3em; - margin-left:-0.5em; -} tr td.label img.plusMinus { + margin-left: -1em; margin-right: 0em; - margin-left:-1em; } -.pk-emptyDataTable { +#emptyDatatable { padding-top: 20px; padding-bottom: 10px; text-align: center; diff --git a/plugins/CoreHome/templates/datatable.js b/plugins/CoreHome/templates/datatable.js index 75c11a62ad..3de4c8fb22 100644 --- a/plugins/CoreHome/templates/datatable.js +++ b/plugins/CoreHome/templates/datatable.js @@ -131,7 +131,7 @@ dataTable.prototype = // Function called to trigger the AJAX request // The ajax request contains the function callback to trigger if the request is successful or failed - // displayLoading = false When we don't want to display the Loading... DIV .pk-loadingDataTable + // displayLoading = false When we don't want to display the Loading... DIV #loadingDataTable // for example when the script add a Loading... it self and doesn't want to display the generic Loading reloadAjaxDataTable: function(displayLoading, callbackSuccess) { @@ -148,7 +148,7 @@ dataTable.prototype = if(displayLoading) { - $('#'+self.workingDivId+' .pk-loadingDataTable').last().css('display','block'); + $('#'+self.workingDivId+' #loadingDataTable').css('display','block'); } $.ajax(self.buildAjaxRequest(callbackSuccess)); @@ -170,15 +170,14 @@ dataTable.prototype = { // we add class to the table so that we can give a different style to the subtable $(content).find('table.dataTable').addClass('subDataTable'); - $(content).find('.dataTableFeatures').addClass('subDataTable'); + $(content).find('#dataTableFeatures').addClass('subDataTable'); //we force the initialisation of subdatatables - dataTableSel.html( $(content) ); + dataTableSel.html( $(content).html() ); } else { - dataTableSel.find('object').remove(); - dataTableSel.html( $(content) ); + dataTableSel.html( $(content).html() ); piwikHelper.lazyScrollTo(dataTableSel[0], 400); } }, @@ -205,52 +204,10 @@ dataTable.prototype = self.handleLowPopulationLink(domElem); self.handleOffsetInformation(domElem); self.handleExportBox(domElem); - self.handleLinkedRows(domElem); self.applyCosmetics(domElem); self.handleSubDataTable(domElem); }, - handleLinkedRows: function(domElem) - { - var self = this; - - var urlLinkFoundDom = $("tr td:first-child:has('.urlLink')", domElem); - if(urlLinkFoundDom.length == 0) - { - self.truncate( $("table tr td:first-child", domElem) ); - } - else - { - urlLinkFoundDom.each( function(){ - // we add a link based on the <span id="urlLink"> present in the column label (the first column) - // if this span is there, we add the link around the HTML in the TD - // but we add this link only for the rows that are not clickable already (subDataTable) - var imgToPrepend = ''; - if( $(this).find('img').length == 0 ) - { - var imageLinkWidth = 10; - var imageLinkHeight = 9; - imgToPrepend = '<img class="link" width="'+imageLinkWidth+'" height="'+imageLinkHeight+'" src="themes/default/images/link.gif" /> '; - } - var urlLinkDom = $('.urlLink',this); - var urlToLink = $(urlLinkDom).html(); - $(urlLinkDom).remove(); - - var truncationOffsetBecauseImageIsPrepend = -2; //website subtable needs -9. - - self.truncate( $(this), truncationOffsetBecauseImageIsPrepend ); - if( urlToLink.match("javascript:") ) - { - $(this).prepend(imgToPrepend).wrapInner('<a href="#" onclick="' + urlToLink.replace("javascript:","") + '"></a>'); - } - else - { - $(this).prepend(imgToPrepend).wrapInner('<a target="_blank" href="' + urlToLink + '"></a>'); - } - }); - } - }, - // if sorting the columns is enabled, when clicking on a column, // - if this column was already the one used for sorting, we revert the order desc<->asc // - we send the ajax request with the new sorting information @@ -282,13 +239,7 @@ dataTable.prototype = $(".sortable#"+self.param.filter_sort_column+' #thDIV', domElem).parent() .addClass('columnSorted') .prepend('<div id="sortIconContainer"><img id="sortIcon" width="'+imageSortWidth+'" height="'+imageSortHeight+'" src="themes/default/images/sort'+prefixSortIcon+ self.param.filter_sort_order+'.png" /></div>'); - - - $("th.sortable", domElem) - .hover( function() { $(this).css({ cursor: "pointer"}); }, - function() { $(this).css({ cursor: "auto"}); - }); - } + } }, // Add behaviour to the low population link @@ -297,7 +248,7 @@ dataTable.prototype = var self = this; // Set the string for the DIV, either "Exclude low pop" or "Include all" - $('.dataTableExcludeLowPopulation', domElem) + $('#dataTableExcludeLowPopulation', domElem) .each( function() { @@ -350,7 +301,7 @@ dataTable.prototype = currentPattern = ''; } - $('.dataTableSearchPattern', domElem) + $('#dataTableSearchPattern', domElem) .show() .each(function(){ // when enter is pressed in the input field we submit the form @@ -396,7 +347,7 @@ dataTable.prototype = { var target = this; var clearImg = $('<span style="position: relative;">\ - <img src="plugins/CoreHome/templates/images/reset_search.png" style="position: absolute; top: 4px; left: -15px; cursor: pointer; display: inline;" title="Clear" />\ + <img src="plugins/CoreHome/templates/images/reset_search.png" style="position: absolute; top: 4px; left: -15px; cursor: pointer; display: inline;" title="Clear"/>\ </span>') .click( function() { $('#keyword', target).val(''); @@ -414,7 +365,7 @@ dataTable.prototype = { var self = this; - $('.dataTablePages', domElem).each( + $('#dataTablePages', domElem).each( function(){ var offset = 1+Number(self.param.filter_offset); var offsetEnd = Number(self.param.filter_offset) + Number(self.param.filter_limit); @@ -433,7 +384,7 @@ dataTable.prototype = ); // Display the next link if the total Rows is greater than the current end row - $('.dataTableNext', domElem) + $('#dataTableNext', domElem) .each(function(){ var offsetEnd = Number(self.param.filter_offset) + Number(self.param.filter_limit); @@ -452,7 +403,7 @@ dataTable.prototype = ; // Display the previous link if the current offset is not zero - $('.dataTablePrevious', domElem) + $('#dataTablePrevious', domElem) .each(function(){ var offset = 1+Number(self.param.filter_offset); if(offset != 1) @@ -485,18 +436,18 @@ dataTable.prototype = } // When the (+) image is hovered, the export buttons are displayed - $('.dataTableFooterIconsShow', domElem) + $('#dataTableFooterIconsShow', domElem) .show() .hover( function() { $(this).fadeOut('slow'); - $('.exportToFormatIcons', $(this).parent()).show('slow'); + $('#exportToFormat', $(this).parent()).show('slow'); }, function(){} ); //timeout object used to hide the datatable export buttons var timeout = null; - $('.dataTableFooterIcons', domElem) + $('#dataTableFooterIcons', domElem) .hover( function() { //display 'hand' cursor $(this).css({ cursor: "pointer"}); @@ -515,8 +466,8 @@ dataTable.prototype = //set a timeout that will hide export buttons after a few moments var dom = this; timeout = setTimeout(function(){ - $('.exportToFormatIcons', dom).fadeOut('fast', function(){ //queue the two actions - $('.dataTableFooterIconsShow', dom).show('fast');}); + $('#exportToFormat', dom).fadeOut('fast', function(){ //queue the two actions + $('#dataTableFooterIconsShow', dom).show('fast');}); }, 1000); } ); @@ -530,7 +481,7 @@ dataTable.prototype = } ); - $('.tableGoals', domElem) + $('#tableGoals', domElem) .show() .click( function(){ @@ -543,7 +494,7 @@ dataTable.prototype = } ); - $('.tableAllColumnsSwitch', domElem) + $('#tableAllColumnsSwitch', domElem) .show() .click( function(){ @@ -560,8 +511,8 @@ dataTable.prototype = } ); - $('.exportToFormatIcons img', domElem).click(function(){ - $(this).siblings('.linksExportToFormat').toggle(); + $('#exportToFormat img', domElem).click(function(){ + $(this).siblings('#linksExportToFormat').toggle(); }); $('.exportToFormat', domElem).attr( 'href', function(){ @@ -626,6 +577,42 @@ dataTable.prototype = applyCosmetics: function(domElem) { var self = this; + + var urlLinkFoundDom = $("tr:not('.subDataTable') td:first-child:has('#urlLink')", domElem); + if(urlLinkFoundDom.length == 0) + { + self.truncate( $("table tr td:first-child", domElem) ); + } + else + { + var imageLinkWidth = 10; + var imageLinkHeight = 9; + urlLinkFoundDom.each( function(){ + // we add a link based on the <span id="urlLink"> present in the column label (the first column) + // if this span is there, we add the link around the HTML in the TD + // but we add this link only for the rows that are not clickable already (subDataTable) + var imgToPrepend = ''; + if( $(this).find('img').length == 0 ) + { + imgToPrepend = '<img width="'+imageLinkWidth+'" height="'+imageLinkHeight+'" src="themes/default/images/link.gif" /> '; + } + var urlLinkDom = $('#urlLink',this); + var urlToLink = $(urlLinkDom).html(); + $(urlLinkDom).remove(); + + var truncationOffsetBecauseImageIsPrepend = -2; //website subtable needs -9. + self.truncate( $(this), truncationOffsetBecauseImageIsPrepend ); + + if( urlToLink.match("javascript:") ) + { + $(this).prepend(imgToPrepend).wrapInner('<a href="#" onclick="' + urlToLink.replace("javascript:","") + '"></a>'); + } + else + { + $(this).prepend(imgToPrepend).wrapInner('<a target="_blank" href="' + urlToLink + '"></a>'); + } + }); + } // Add some styles on the cells even/odd // label (first column of a data row) or not @@ -635,6 +622,14 @@ dataTable.prototype = $("tr:odd td", domElem).slice(1).addClass('columnodd'); $("tr:even td", domElem).slice(1).addClass('columneven'); + // Change cursor on mouse hover if sort is enabled + if( self.param.enable_sort ) + { + $("th.sortable", domElem) + .hover( function() { $(this).css({ cursor: "pointer"}); }, + function() { $(this).css({ cursor: "auto"}); + }); + } }, //behaviour for 'nested DataTable' (DataTable loaded on a click on a row) @@ -661,7 +656,7 @@ dataTable.prototype = '<tr>'+ '<td colspan="'+numberOfColumns+'" class="cellSubDataTable">'+ '<div id="'+divIdToReplaceWithSubTable+'">'+ - '<span class="pk-loadingDataTable" style="display:inline"><img src="themes/default/images/loading-blue.gif" />'+ _pk_translate('CoreHome_Loading_js') +'</span>'+ + '<span id="loadingDataTable" style="display:inline"><img src="themes/default/images/loading-blue.gif" />'+ _pk_translate('CoreHome_Loading_js') +'</span>'+ '</div>'+ '</td>'+ '</tr>' @@ -744,9 +739,6 @@ actionDataTable.prototype = handleExportBox: dataTable.prototype.handleExportBox, handleSort: dataTable.prototype.handleSort, onClickSort: dataTable.prototype.onClickSort, - handleLinkedRows: dataTable.prototype.handleLinkedRows, - truncate: dataTable.prototype.truncate, - handleOffsetInformation: dataTable.prototype.handleOffsetInformation, //initialisation of the actionDataTable init: function(workingDivId, domElem) @@ -786,12 +778,10 @@ actionDataTable.prototype = self.handleExportBox(domElem); self.handleSort(domElem); - self.handleLinkedRows(domElem); - self.handleOffsetInformation(domElem); if( self.workingDivId != undefined) { - self.handleSearchBox(domElem, self.dataTableLoaded ); - self.handleLowPopulationLink(domElem, self.dataTableLoaded ); + self.handleSearchBox(domElem, self.actionsDataTableLoaded ); + self.handleLowPopulationLink(domElem, self.actionsDataTableLoaded ); } }, @@ -850,8 +840,8 @@ actionDataTable.prototype = $("td:first-child:odd", this).addClass('label labeleven'); $("td:first-child:even", this).addClass('label labelodd'); // we truncate the labels columns from the second row -// $("td:first-child", this).truncate(30); -// $('.truncated', this).tooltip(); + $("td:first-child", this).truncate(30); + $('.truncated', this).tooltip(); }) .removeClass('rowToProcess'); }, @@ -885,7 +875,7 @@ actionDataTable.prototype = $(domElem).after( '\ <tr id="'+divIdToReplaceWithSubTable+'" class="cellSubDataTable">\ <td colspan="'+numberOfColumns+'">\ - <span class="pk-loadingDataTable" style="display:inline"><img src="themes/default/images/loading-blue.gif" /> Loading...</span>\ + <span id="loadingDataTable" style="display:inline"><img src="themes/default/images/loading-blue.gif" /> Loading...</span>\ </td>\ </tr>\ '); @@ -951,7 +941,7 @@ actionDataTable.prototype = }, //called when the full table actions is loaded - dataTableLoaded: function(response) + actionsDataTableLoaded: function(response) { var content = $(response); var idToReplace = $(content).attr('id'); @@ -961,7 +951,7 @@ actionDataTable.prototype = self.parentId = ''; var dataTableSel = $('#'+idToReplace); - dataTableSel.html( $(content) ); + dataTableSel.html($(content).html()); piwikHelper.lazyScrollTo(dataTableSel[0], 400); }, @@ -986,8 +976,7 @@ actionDataTable.prototype = } // we execute the bindDataTableEvent function for the new DIV - self.init(self.workingDivId, $('#'+self.workingDivId)); -// self.init(self.workingDivId, $('#'+idToReplace)); + self.init(self.workingDivId, $('#'+idToReplace)); //bind back the click event (disabled to avoid double-click problem) self.disabledRowDom.click( @@ -1001,7 +990,7 @@ actionDataTable.prototype = //helper function for actionDataTable function getLevelFromClass( style) { - if (!style || typeof style == "undefined") return 0; + if (typeof style == "undefined") return 0; var currentLevelIndex = style.indexOf('level'); var currentLevel = 0; @@ -1015,7 +1004,7 @@ function getLevelFromClass( style) //helper function for actionDataTable function getNextLevelFromClass( style ) { - if (!style || typeof style == "undefined") return 0; + if (typeof style == "undefined") return 0; currentLevel = getLevelFromClass(style); newLevel = currentLevel; // if this is not a row to process so diff --git a/plugins/CoreHome/templates/datatable.tpl b/plugins/CoreHome/templates/datatable.tpl index 56c508a151..7cbdc6f2cc 100644 --- a/plugins/CoreHome/templates/datatable.tpl +++ b/plugins/CoreHome/templates/datatable.tpl @@ -4,14 +4,14 @@ {$arrayDataTable.message} {else} {if count($arrayDataTable) == 0} - <div class="pk-emptyDataTable">{'CoreHome_TableNoData'|translate}</div> + <div id="emptyDatatable">{'CoreHome_TableNoData'|translate}</div> {else} <a name="{$properties.uniqueId}"></a> <table cellspacing="0" class="dataTable"> <thead> <tr> - {foreach from=$dataTableColumns item=column name=head} - <th class="sortable {if $smarty.foreach.head.first}first{elseif $smarty.foreach.head.last}last{/if}" id="{$column}"><div id="thDIV">{$columnTranslations[$column]}</div></th> + {foreach from=$dataTableColumns item=column} + <th class="sortable" id="{$column}"><div id="thDIV">{$columnTranslations[$column]}</div></th> {/foreach} </tr> </thead> @@ -21,7 +21,7 @@ <tr {if $row.idsubdatatable && $javascriptVariablesToSet.controllerActionCalledWhenRequestSubTable != null}class="subDataTable" id="{$row.idsubdatatable}"{/if}> {foreach from=$dataTableColumns item=column} <td> -{if !$row.idsubdatatable && $column=='label' && !empty($row.metadata.url)}<span class="urlLink">{$row.metadata.url}</span>{/if} +{if !$row.idsubdatatable && $column=='label' && isset($row.metadata.url)}<span id="urlLink">{$row.metadata.url}</span>{/if} {if $column=='label'}{logoHtml metadata=$row.metadata alt=$row.columns.label}{/if} {if isset($row.columns[$column])}{$row.columns[$column]}{else}{$defaultWhenColumnValueNotDefined}{/if} </td> diff --git a/plugins/CoreHome/templates/datatable_actions.tpl b/plugins/CoreHome/templates/datatable_actions.tpl index 44c8a16911..1ffa6b99c1 100644 --- a/plugins/CoreHome/templates/datatable_actions.tpl +++ b/plugins/CoreHome/templates/datatable_actions.tpl @@ -4,13 +4,13 @@ {$arrayDataTable.message} {else} {if count($arrayDataTable) == 0} - <div class="pk-emptyDataTable">{'CoreHome_TableNoData'|translate}</div> + <div id="emptyDatatable">{'CoreHome_TableNoData'|translate}</div> {else} <table cellspacing="0" class="dataTable dataTableActions"> <thead> <tr> - {foreach from=$dataTableColumns item=column name=head} - <th class="sortable {if $smarty.foreach.head.first}first{elseif $smarty.foreach.head.last}last{/if}" id="{$column}"><div id="thDIV">{if !empty($columnDescriptions[$column])}<label title='{$columnDescriptions[$column]|escape:'html'}'>{/if}{$columnTranslations[$column]|escape:'html'}{if !empty($columnDescriptions[$column])}</label>{/if}</div></td> + {foreach from=$dataTableColumns item=column} + <th class="sortable" id="{$column}">{$columnTranslations[$column]}</td> {/foreach} </tr> </thead> @@ -20,7 +20,6 @@ <tr {if $row.idsubdatatable}class="rowToProcess subActionsDataTable" id="{$row.idsubdatatable}"{else} class="actionsDataTable rowToProcess"{/if}> {foreach from=$dataTableColumns item=column} <td> - {if !$row.idsubdatatable && $column=='label' && isset($row.metadata.url)}<span class="urlLink">{$row.metadata.url}</span>{/if} {if isset($row.columns[$column])}{$row.columns[$column]}{else}{$defaultWhenColumnValueNotDefined}{/if} </td> {/foreach} diff --git a/plugins/CoreHome/templates/datatable_actions_recursive.tpl b/plugins/CoreHome/templates/datatable_actions_recursive.tpl index 48e98197d1..d405ea3fdc 100644 --- a/plugins/CoreHome/templates/datatable_actions_recursive.tpl +++ b/plugins/CoreHome/templates/datatable_actions_recursive.tpl @@ -4,7 +4,7 @@ {$arrayDataTable.message} {else} {if count($arrayDataTable) == 0} - <div class="pk-emptyDataTable">{'CoreHome_TableNoData'|translate}</div> + <div id="emptyDatatable">{'CoreHome_TableNoData'|translate}</div> {else} <table cellspacing="0" class="dataTable dataTableActions"> <thead> diff --git a/plugins/CoreHome/templates/datatable_actions_subdatable.tpl b/plugins/CoreHome/templates/datatable_actions_subdatable.tpl index dbd7b903c7..0a1ec0bb0d 100644 --- a/plugins/CoreHome/templates/datatable_actions_subdatable.tpl +++ b/plugins/CoreHome/templates/datatable_actions_subdatable.tpl @@ -9,7 +9,6 @@ <tr {if $row.idsubdatatable}class="subActionsDataTable" id="{$row.idsubdatatable}"{else}class="actionsDataTable"{/if}> {foreach from=$dataTableColumns item=column} <td> - {if !$row.idsubdatatable && $column=='label' && isset($row.metadata.url)}<span class="urlLink">{$row.metadata.url}</span>{/if} {if isset($row.columns[$column])}{$row.columns[$column]}{else}{$defaultWhenColumnValueNotDefined}{/if} </td> {/foreach} diff --git a/plugins/CoreHome/templates/datatable_footer.tpl b/plugins/CoreHome/templates/datatable_footer.tpl index 329a2002e9..1398bed288 100644 --- a/plugins/CoreHome/templates/datatable_footer.tpl +++ b/plugins/CoreHome/templates/datatable_footer.tpl @@ -1,40 +1,36 @@ -<div class="dataTableFeatures"> +<div id="dataTableFeatures"> {if $properties.show_exclude_low_population} - <span class="dataTableExcludeLowPopulation"></span> -{/if} - -{if $properties.show_offset_information} -<div> - <span class="dataTablePages"></span> - <span class="dataTablePrevious">‹ {'General_Previous'|translate}</span> - <span class="dataTableNext">{'General_Next'|translate} ›</span> -</div> + <span id="dataTableExcludeLowPopulation"></span> {/if} {if $properties.show_search} -<span class="dataTableSearchPattern"> +<span id="dataTableSearchPattern"> <input id="keyword" type="text" length="15" /> <input type="submit" value="{'General_Search'|translate}" /> </span> {/if} +{if $properties.show_offset_information} + <span id="dataTablePages"></span> + <span id="dataTablePrevious">‹ {'General_Previous'|translate}</span> + <span id="dataTableNext">{'General_Next'|translate} ›</span> +{/if} {if $properties.show_footer_icons} <div> - <span class="dataTableFooterIcons"> - <span class="exportToFormatIcons" style="display:none;padding-left:4px;"> + <span id="dataTableFooterIcons"> + <span id="exportToFormat" style="display:none;padding-left:4px;"> {if $properties.show_export_as_image_icon} <span id="dataTableFooterExportAsImageIcon"> <a href="javascript:piwikHelper.OFC.jquery.popup('{$chartDivId}');"><img title="{'General_ExportAsImage_js'|translate}" src="themes/default/images/image.png" /></a> </span> {/if} <img width="16" height="16" src="themes/default/images/export.png" title="{'General_Export'|translate}" /> - <span class="linksExportToFormat" style="display:none"> + <span id="linksExportToFormat" style="display:none"> <a target="_blank" class="exportToFormat" methodToCall="{$properties.apiMethodToRequestDataTable}" format="CSV" filter_limit="100">CSV</a> | - <a target="_blank" class="exportToFormat" methodToCall="{$properties.apiMethodToRequestDataTable}" format="TSV" filter_limit="100">TSV (Excel)</a> | <a target="_blank" class="exportToFormat" methodToCall="{$properties.apiMethodToRequestDataTable}" format="XML" filter_limit="100">XML</a> | <a target="_blank" class="exportToFormat" methodToCall="{$properties.apiMethodToRequestDataTable}" format="JSON" filter_limit="100">Json</a> | <a target="_blank" class="exportToFormat" methodToCall="{$properties.apiMethodToRequestDataTable}" format="PHP" filter_limit="100">Php</a> | - <a target="_blank" class="exportToFormat" methodToCall="{$properties.apiMethodToRequestDataTable}" format="RSS" filter_limit="100" date="last10"><img border="0" src="themes/default/images/feed.png" /></a> + <a target="_blank" class="exportToFormat" methodToCall="{$properties.apiMethodToRequestDataTable}" format="RSS" filter_limit="100" date="last10"><img border="0" src="themes/default/images/feed.png"></a> </span> {if $properties.show_all_views_icons} <a class="viewDataTable" format="cloud"><img width="16" height="16" src="themes/default/images/tagcloud.png" title="{'General_TagCloud'|translate}" /></a> @@ -42,12 +38,12 @@ <a class="viewDataTable" format="graphPie"><img width="16" height="16" src="themes/default/images/chart_pie.png" title="{'General_Piechart'|translate}" /></a> {/if} </span> - <span class="dataTableFooterIconsShow" style="display:none;padding-left:4px;"> + <span id="dataTableFooterIconsShow" style="display:none;padding-left:4px;"> <img src="plugins/CoreHome/templates/images/more.png" /> </span> {if $properties.show_table} - <span class="tableAllColumnsSwitch" style="display:none;float:right;padding-right:4px;border-right:1px solid #82A1D2;"> + <span id="tableAllColumnsSwitch" style="display:none;float:right;padding-right:4px;border-right:1px solid #82A1D2;"> {if $javascriptVariablesToSet.viewDataTable != 'table'} <img title="{'General_DisplayNormalTable'|translate}" src="themes/default/images/table.png" /> {elseif $properties.show_table_all_columns} @@ -57,9 +53,9 @@ {/if} {if $properties.show_goals} - <span class="tableGoals" style="display:none;float:right;padding-right:4px;"> + <span id="tableGoals" style="display:none;float:right;padding-right:4px;"> {if $javascriptVariablesToSet.viewDataTable != 'tableGoals'} - <img title="{'General_DisplayGoals'|translate}" src="themes/default/images/goal.png" /> + <img title="View Goals" src="themes/default/images/goal.png" /> {/if} </span> {/if} @@ -67,7 +63,7 @@ </div> {/if} -<span class="pk-loadingDataTable"><img src="themes/default/images/loading-blue.gif" /> {'General_LoadingData'|translate}</span> +<span id="loadingDataTable"><img src="themes/default/images/loading-blue.gif" /> {'General_LoadingData'|translate}</span> </div> <div class="dataTableSpacer" /> diff --git a/plugins/CoreHome/templates/date.js b/plugins/CoreHome/templates/date.js index 4b33793a55..7ca90166a6 100644 --- a/plugins/CoreHome/templates/date.js +++ b/plugins/CoreHome/templates/date.js @@ -1,7 +1,7 @@ $(document).ready(function(){ $("#periodString").hide(); $("#otherPeriods").hide(); - $("#datepicker").hide(); + $("#calendar").hide(); $("#periodString").show(); // we get the content of the div before modifying it (append image, etc.) @@ -54,7 +54,7 @@ $(document).ready(function(){ { $("#currentPeriod:not(.hoverPeriod)") .addClass("hoverPeriod") - .append(' <img src="plugins/CoreHome/templates/images/more_period.gif" style="vertical-align:middle" />'); + .append(' <img src="plugins/CoreHome/templates/images/more_period.gif" style="vertical-align:middle">'); } }, function(){ restoreCurrentPeriod(); @@ -83,10 +83,6 @@ $(document).ready(function(){ }) .click(function(){ - $("#datepicker").toggle(); - if($("#datepicker").is(":visible")) - { - $("#datepicker .ui-state-highlight").removeClass('ui-state-highlight'); - } + $("#calendar").toggle(); }); } ); diff --git a/plugins/CoreHome/templates/graph.tpl b/plugins/CoreHome/templates/graph.tpl index eab4ef04f5..ff4f282a1b 100644 --- a/plugins/CoreHome/templates/graph.tpl +++ b/plugins/CoreHome/templates/graph.tpl @@ -7,9 +7,6 @@ </div></div> <script type="text/javascript"> <!-- - {if $flashParameters.includeData} - piwikHelper.OFC.set("{$chartDivId}", '{$flashParameters.data}'); - {/if} swfobject.embedSWF( "{$flashParameters.ofcLibraryPath}open-flash-chart.swf?{$tag}", "{$chartDivId}", @@ -17,10 +14,10 @@ "{$flashParameters.requiredFlashVersion}", "{$flashParameters.swfLibraryPath}expressInstall.swf", {literal}{{/literal} - "{if $flashParameters.includeData}x-{/if}data-file":"{$urlGraphData|escape:"url"}", {if $flashParameters.includeData} "id":"{$chartDivId}", {/if} + "{if $flashParameters.includeData}x-{/if}data-file":"{$urlGraphData|escape:"url"}", "loading":"{'General_Loading'|translate|escape:"html"}" {literal}}, {{/literal} @@ -31,6 +28,9 @@ "bgcolor":"#FFFFFF" {literal}}{/literal} ); + {if $flashParameters.includeData} + piwikHelper.OFC.set("{$chartDivId}", '{$flashParameters.data}'); + {/if} //--> </script> {else} diff --git a/plugins/CoreHome/templates/header.tpl b/plugins/CoreHome/templates/header.tpl index 9fbb3f6a95..d88d17ac95 100644 --- a/plugins/CoreHome/templates/header.tpl +++ b/plugins/CoreHome/templates/header.tpl @@ -1,15 +1,7 @@ -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" - "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> -<html xmlns="http://www.w3.org/1999/xhtml"> -<head> -<title>Piwik › {'CoreHome_WebAnalyticsReports'|translate}</title> -<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> -<meta name="generator" content="Piwik {$piwik_version}" /> -<link rel="shortcut icon" href="plugins/CoreHome/templates/images/favicon.ico" /> -{loadJavascriptTranslations plugins='CoreHome'} -{include file="CoreHome/templates/js_global_variables.tpl"} -{include file="CoreHome/templates/js_css_includes.tpl"} -</head> -<body> -{include file="CoreHome/templates/top_bar.tpl"} -{include file="CoreHome/templates/top_screen.tpl"} +<div id="header"> +{include file="CoreHome/templates/header_message.tpl"} +{include file="CoreHome/templates/logo.tpl"} +{include file="CoreHome/templates/period_select.tpl"} +{include file="CoreHome/templates/js_disabled_notice.tpl"} +</div> +<br /> diff --git a/plugins/CoreHome/templates/header_message.tpl b/plugins/CoreHome/templates/header_message.tpl index 2fca652693..2a5f3a5ee6 100644 --- a/plugins/CoreHome/templates/header_message.tpl +++ b/plugins/CoreHome/templates/header_message.tpl @@ -1,14 +1,10 @@ <span id="header_message"> -{if $piwikUrl == 'http://piwik.org/demo/'} +{if $piwikUrl == 'http://piwik.org/demo/'} {'General_YouAreCurrentlyViewingDemoOfPiwik'|translate:"<a target='_blank' href='http://piwik.org'>Piwik</a>":"<a href='http://piwik.org/'>":"</a>":"<a href='http://piwik.org'>piwik.org</a>"} {elseif $latest_version_available} - <img src='themes/default/images/warning_small.png' alt='' style="vertical-align: middle;" /> - {if $isSuperUser} - {'General_PiwikXIsAvailablePleaseUpdateNow'|translate:$latest_version_available:"<br /><a href='index.php?module=CoreUpdater&action=newVersionAvailable'>":"</a>":"<a href='misc/redirectToUrl.php?url=http://piwik.org/changelog/' target='_blank'>":"</a>"} - {else} - {'General_PiwikXIsAvailablePleaseNotifyPiwikAdmin'|translate:"<a href='misc/redirectToUrl.php?url=http://piwik.org/' target='_blank'>Piwik</a> <a href='misc/redirectToUrl.php?url=http://piwik.org/changelog/' target='_blank'>$latest_version_available</a>"} - {/if} + <img src='themes/default/images/warning_small.png' alt='' style="vertical-align: middle;"> + {'General_PiwikXIsAvailablePleaseUpdateNow'|translate:$latest_version_available:"<br /><a href='index.php?module=CoreUpdater&action=newVersionAvailable'>":"</a>":"<a href='misc/redirectToUrl.php?url=http://piwik.org/changelog/' target='_blank'>":"</a>"} {else} - {'General_PiwikIsACollaborativeProjectYouCanContribute'|translate:"<a href='misc/redirectToUrl.php?url=http://piwik.org'>":"$piwik_version</a>":"<br />":"<a target='_blank' href='misc/redirectToUrl.php?url=http://piwik.org/contribute/'>":"</a>"} + {'General_PiwikIsACollaborativeProjectYouCanContribute'|translate:"<a href='misc/redirectToUrl.php?url=http://piwik.org'>":"$piwik_version</a>":"<br />":"<a target='_blank' href='misc/redirectToUrl.php?url=http://piwik.org/contribute/'>":"</a>"} {/if} </span> diff --git a/plugins/CoreHome/templates/index.tpl b/plugins/CoreHome/templates/index.tpl index cba7cbed4d..6c34885895 100644 --- a/plugins/CoreHome/templates/index.tpl +++ b/plugins/CoreHome/templates/index.tpl @@ -1,13 +1,24 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<title>Piwik › Web Analytics Reports</title> +<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> +<meta name="generator" content="Piwik {$piwik_version}" /> +<link rel="shortcut icon" href="plugins/CoreHome/templates/images/favicon.ico" /> +{loadJavascriptTranslations plugins='CoreHome'} +{include file="CoreHome/templates/js_global_variables.tpl"} +{include file="CoreHome/templates/js_css_includes.tpl"} +</head> +<body> {assign var=showSitesSelection value=true} - +{include file="CoreHome/templates/top_bar.tpl"} {include file="CoreHome/templates/header.tpl"} +{include file="CoreHome/templates/menu.tpl"} +<div style='clear:both'></div> +{include file="CoreHome/templates/loading.tpl"} -{if isset($menu) && $menu}{include file="CoreHome/templates/menu.tpl"}{/if} -<div style="clear:both;"></div> -{ajaxLoadingDiv} -{ajaxRequestErrorDiv} - -<div id="content"> +<div id='content'> {if $content}{$content}{/if} </div> diff --git a/plugins/CoreHome/templates/js_css_includes.tpl b/plugins/CoreHome/templates/js_css_includes.tpl index 06311092aa..d4ac685907 100644 --- a/plugins/CoreHome/templates/js_css_includes.tpl +++ b/plugins/CoreHome/templates/js_css_includes.tpl @@ -1,14 +1,16 @@ <link rel="stylesheet" type="text/css" href="themes/default/common.css" /> -<link rel="stylesheet" type="text/css" href="libs/jquery/themes/base/jquery-ui.css" class="ui-theme" /> +<link rel="stylesheet" type="text/css" href="libs/jquery/thickbox.css" /> +<link rel="stylesheet" type="text/css" href="libs/jquery/jquery-calendar.css" /> <link rel="stylesheet" type="text/css" href="plugins/CoreHome/templates/styles.css" /> <link rel="stylesheet" type="text/css" href="plugins/CoreHome/templates/menu.css" /> <link rel="stylesheet" type="text/css" href="plugins/CoreHome/templates/datatable.css" /> <link rel="stylesheet" type="text/css" href="plugins/CoreHome/templates/cloud.css" /> +<link rel="stylesheet" type="text/css" href="plugins/Dashboard/templates/dashboard.css" /> {postEvent name="template_css_import"} +<script type="text/javascript" src="themes/default/common.js"></script> <script type="text/javascript" src="libs/jquery/jquery.js"></script> <script type="text/javascript" src="libs/jquery/jquery-ui.js"></script> -<script type="text/javascript" src="libs/jquery/jquery.bgiframe.js"></script> <script type="text/javascript" src="libs/jquery/tooltip/jquery.tooltip.js"></script> <script type="text/javascript" src="libs/jquery/truncate/jquery.truncate.js"></script> <script type="text/javascript" src="libs/jquery/jquery.scrollTo.js"></script> @@ -16,9 +18,9 @@ <script type="text/javascript" src="libs/jquery/fdd2div-modified.js"></script> <script type="text/javascript" src="libs/jquery/superfish_modified.js"></script> <script type="text/javascript" src="libs/jquery/jquery.history.js"></script> +<script type="text/javascript" src="libs/jquery/thickbox.js"></script> <script type="text/javascript" src="libs/swfobject/swfobject.js"></script> <script type="text/javascript" src="libs/javascript/sprintf.js"></script> -<script type="text/javascript" src="themes/default/common.js"></script> <script type="text/javascript" src="plugins/CoreHome/templates/datatable.js"></script> <script type="text/javascript" src="plugins/CoreHome/templates/broadcast.js"></script> <script type="text/javascript" src="plugins/CoreHome/templates/menu.js"></script> diff --git a/plugins/CoreHome/templates/loading.tpl b/plugins/CoreHome/templates/loading.tpl new file mode 100644 index 0000000000..5dc8755980 --- /dev/null +++ b/plugins/CoreHome/templates/loading.tpl @@ -0,0 +1,4 @@ +<div id="loadingPiwik" {if isset($basicHtmlView) && $basicHtmlView}style="display:none"{/if}> +<img src="themes/default/images/loading-blue.gif" alt="" /> {'General_LoadingData'|translate} +</div> +<div id="loadingError">{'General_ErrorRequest'|translate}</div> diff --git a/plugins/CoreHome/templates/menu.css b/plugins/CoreHome/templates/menu.css index a4d9df5ed5..b95539af8c 100644 --- a/plugins/CoreHome/templates/menu.css +++ b/plugins/CoreHome/templates/menu.css @@ -27,7 +27,6 @@ float: left; list-style: none; z-index: 49; - margin-right:1px; } .nav li.current ul { @@ -60,16 +59,10 @@ position: absolute; } -.nav li, .nav li:hover,.nav li.sfHover,.nav li.current,.nav a:focus,.nav a:hover,.nav a:active{ - -moz-border-radius:5px 5px 0 0; - -webkit-border-radius:5px 5px 0 0; -} - /* LEVEL1 HOVER */ -.nav li:hover,.nav li.sfHover,.nav li.current,.nav a:focus,.nav a:hover,.nav a:active { +.nav li:hover,.nav li.sfHover,.nav li.current,.nav a:focus,.nav a:hover,.nav a:active + { background: #C9D5FF; - -moz-border-radius:5px 5px 0 0; - -webkit-border-radius:5px 5px 0 0; } .nav li { diff --git a/plugins/CoreHome/templates/menu.js b/plugins/CoreHome/templates/menu.js index eef1dd5ba4..51139ed6b7 100644 --- a/plugins/CoreHome/templates/menu.js +++ b/plugins/CoreHome/templates/menu.js @@ -10,7 +10,7 @@ menu.prototype = if(urlLoaded == menu.prototype.lastUrlRequested) { $('#content').html( content ).show(); - piwikHelper.hideAjaxLoading(); + $('#loadingPiwik').hide(); menu.prototype.lastUrlRequested = null; } }, @@ -47,7 +47,7 @@ menu.prototype = .superfish({ pathClass : 'current', animation : {opacity:'show'}, - delay : 2000 + delay : 1000 }); this.param.superfish.find("li") .click( self.onClickLI ) @@ -130,10 +130,8 @@ menu.prototype = }; $(document).ready( function(){ - if($('.nav').size()) { - piwikMenu = new menu(); - piwikMenu.init(); - piwikMenu.loadFirstSection(); - broadcast.init(); - } + piwikMenu = new menu(); + piwikMenu.init(); + piwikMenu.loadFirstSection(); + broadcast.init(); }); diff --git a/plugins/CoreHome/templates/period_select.tpl b/plugins/CoreHome/templates/period_select.tpl index 1c704ff5b5..1db1f1092b 100644 --- a/plugins/CoreHome/templates/period_select.tpl +++ b/plugins/CoreHome/templates/period_select.tpl @@ -1,4 +1,5 @@ {loadJavascriptTranslations plugins='CoreHome'} +<script type="text/javascript" src="libs/jquery/jquery-calendar.js"></script> <script type="text/javascript" src="plugins/CoreHome/templates/calendar.js"></script> <script type="text/javascript" src="plugins/CoreHome/templates/date.js"></script> @@ -10,11 +11,11 @@ {foreach from=$otherPeriods item=thisPeriod} | <a href='{url period=$thisPeriod}'>{$periodsNames.$thisPeriod.singular}</a>{/foreach} </span> </span> - <br /> - <span id="datepicker"></span> + <br/> + <span id="calendar"></span> </span> -{literal}<script type="text/javascript"> +{literal}<script language="javascript"> $(document).ready(function() { // this will trigger to change only the period value on search query and hash string. $("#otherPeriods a").bind('click',function(e) { @@ -26,4 +27,5 @@ $(document).ready(function() { });</script> {/literal} -<div style="clear:both;"></div> +<div style="clear:both"></div> + diff --git a/plugins/CoreHome/templates/piwik_tag.tpl b/plugins/CoreHome/templates/piwik_tag.tpl index 994388e7cf..fb4c1886fc 100644 --- a/plugins/CoreHome/templates/piwik_tag.tpl +++ b/plugins/CoreHome/templates/piwik_tag.tpl @@ -1,8 +1,8 @@ {if $piwikUrl == 'http://piwik.org/demo/' || $debugTrackVisitsInsidePiwikUI} -<div style="clear:both;"></div> +<div style="clear:both"></div> {literal} <!-- Piwik --> -<script src="piwik.js" type="text/javascript"></script> +<script language="javascript" src="piwik.js" type="text/javascript"></script> <script type="text/javascript"> try { var piwikTracker = Piwik.getTracker("piwik.php", 1); diff --git a/plugins/CoreHome/templates/sites_selection.tpl b/plugins/CoreHome/templates/sites_selection.tpl index be60868dda..21ed8f743b 100644 --- a/plugins/CoreHome/templates/sites_selection.tpl +++ b/plugins/CoreHome/templates/sites_selection.tpl @@ -8,11 +8,11 @@ {/foreach} </select> {hiddenurl idSite=null} - <input type="submit" value="go" /> + <input type="submit" value="go"/> </form> </span> - {literal}<script type="text/javascript"> + {literal}<script language="javascript"> $(document).ready(function() { var extraPadding = 0; // if there is only one website, we dont show the arrows image, so no need to add the extra padding diff --git a/plugins/CoreHome/templates/styles.css b/plugins/CoreHome/templates/styles.css index 8db24b9a65..c3537c2cdb 100644 --- a/plugins/CoreHome/templates/styles.css +++ b/plugins/CoreHome/templates/styles.css @@ -11,10 +11,6 @@ h2 { clear:both; } -h2 a { - text-decoration:none; -} - h3 { font-size: 1.3em; margin-top: 2em; @@ -24,7 +20,6 @@ h3 { p { padding-bottom: 1em; margin-right: 1em; - margin-left:1em; } /* Content */ @@ -50,14 +45,26 @@ p { padding-left:10px; } +#calendar { + display: block; +} + /* Calendar*/ -div.ui-datepicker { - font-size: 62.5%; +.calendar td.dateToday,.calendar td.dateToday a { + font-weight: bold; } -.ui-datepicker-current-period a, .ui-datepicker-current-period a:link, .ui-datepicker-current-period a:visited { - border: 1px solid #2E85FF; +.calendar td.dateUsedStats,.calendar td.dateUsedStats a { color: #2E85FF; + border-color: #2E85FF; +} + +.calendar td.calendar_unselectable { + color: #F2F7FF; +} + +.calendar { + line-height: 1.33; } #otherPeriods a { @@ -85,7 +92,6 @@ div .sparkline { margin-top:10px; border-bottom:1px solid white; } - .sparkline img { vertical-align: middle; padding-right: 10px; diff --git a/plugins/CoreHome/templates/top_bar.tpl b/plugins/CoreHome/templates/top_bar.tpl index 53957f4110..7245055a2d 100644 --- a/plugins/CoreHome/templates/top_bar.tpl +++ b/plugins/CoreHome/templates/top_bar.tpl @@ -13,7 +13,7 @@ <nobr> <small> {'General_HelloUser'|translate:"<strong>$userLogin</strong>"} -{if $userLogin != 'anonymous'}| <a href='index.php?module=CoreAdminHome'>{'General_Settings'|translate}</a>{/if} +{if isset($userHasSomeAdminAccess) && $userHasSomeAdminAccess}| <a href='index.php?module=CoreAdminHome'>{'General_Settings'|translate}</a>{/if} {if $showSitesSelection && $showWebsiteSelectorInUserInterface}| {include file=CoreHome/templates/sites_selection.tpl}{/if} | {if $userLogin == 'anonymous'}<a href='index.php?module={$loginModule}'>{'Login_LogIn'|translate}</a>{else}<a href='index.php?module={$loginModule}&action=logout'>{'Login_Logout'|translate}</a>{/if} </small> @@ -21,6 +21,6 @@ </nobr> </div> -<br class="clearAll" /> +<br clear="all" /> </div> diff --git a/plugins/CoreHome/templates/top_screen.tpl b/plugins/CoreHome/templates/top_screen.tpl deleted file mode 100644 index d88d17ac95..0000000000 --- a/plugins/CoreHome/templates/top_screen.tpl +++ /dev/null @@ -1,7 +0,0 @@ -<div id="header"> -{include file="CoreHome/templates/header_message.tpl"} -{include file="CoreHome/templates/logo.tpl"} -{include file="CoreHome/templates/period_select.tpl"} -{include file="CoreHome/templates/js_disabled_notice.tpl"} -</div> -<br /> diff --git a/plugins/CorePluginsAdmin/Controller.php b/plugins/CorePluginsAdmin/Controller.php index 866ed0f8ca..b759f2b550 100644 --- a/plugins/CorePluginsAdmin/Controller.php +++ b/plugins/CorePluginsAdmin/Controller.php @@ -20,54 +20,38 @@ class Piwik_CorePluginsAdmin_Controller extends Piwik_Controller { Piwik::checkUserIsSuperUser(); - $plugins = array(); - $listPlugins = Piwik_PluginsManager::getInstance()->readPluginsDirectory(); + $loadedPlugins = Piwik_PluginsManager::getInstance()->getLoadedPlugins(); + $plugins = array(); foreach($listPlugins as $pluginName) { $oPlugin = Piwik_PluginsManager::getInstance()->loadPlugin($pluginName); - $plugins[$pluginName] = array( - 'activated' => Piwik_PluginsManager::getInstance()->isPluginActivated($pluginName), - 'alwaysActivated' => Piwik_PluginsManager::getInstance()->isPluginAlwaysActivated($pluginName), - ); + $plugins[$pluginName]= array( 'activated' => Piwik_PluginsManager::getInstance()->isPluginActivated($pluginName), + 'alwaysActivated' => Piwik_PluginsManager::getInstance()->isPluginAlwaysActivated($pluginName), + 'info' => $oPlugin->getInformation() + ); } - - Piwik_PluginsManager::getInstance()->loadTranslations(); - - $loadedPlugins = Piwik_PluginsManager::getInstance()->getLoadedPlugins(); - foreach($loadedPlugins as $oPlugin) - { - $pluginName = $oPlugin->getClassName(); - $plugins[$pluginName]['info'] = $oPlugin->getInformation(); - } - + $view = Piwik_View::factory('manage'); $view->pluginsName = $plugins; $this->setGeneralVariablesView($view); $view->menu = Piwik_GetAdminMenu(); - if(!Zend_Registry::get('config')->isFileWritable()) - { - $view->configFileNotWritable = true; - } - echo $view->render(); } function deactivate() { Piwik::checkUserIsSuperUser(); - $this->checkTokenInUrl(); $pluginName = Piwik_Common::getRequestVar('pluginName', null, 'string'); Piwik_PluginsManager::getInstance()->deactivatePlugin($pluginName); - Piwik_Url::redirectToUrl('index.php?module=CorePluginsAdmin&action=index'); + Piwik_Url::redirectToUrl('index.php?module=CorePluginsAdmin'); } function activate() { Piwik::checkUserIsSuperUser(); - $this->checkTokenInUrl(); $pluginName = Piwik_Common::getRequestVar('pluginName', null, 'string'); Piwik_PluginsManager::getInstance()->activatePlugin($pluginName); - Piwik_Url::redirectToUrl('index.php?module=CorePluginsAdmin&action=index'); + Piwik_Url::redirectToUrl('index.php?module=CorePluginsAdmin'); } } diff --git a/plugins/CorePluginsAdmin/CorePluginsAdmin.php b/plugins/CorePluginsAdmin/CorePluginsAdmin.php index 3680c7dd80..dc634819a7 100644 --- a/plugins/CorePluginsAdmin/CorePluginsAdmin.php +++ b/plugins/CorePluginsAdmin/CorePluginsAdmin.php @@ -19,10 +19,11 @@ class Piwik_CorePluginsAdmin extends Piwik_Plugin public function getInformation() { return array( - 'description' => Piwik_Translate('CorePluginsAdmin_PluginDescription'), + 'name' => 'Plugins Management', + 'description' => 'Plugins Administration Interface.', 'author' => 'Piwik', - 'author_homepage' => 'http://piwik.org/', - 'version' => Piwik_Version::VERSION, + 'homepage' => 'http://piwik.org/', + 'version' => '0.1', ); } @@ -33,9 +34,6 @@ class Piwik_CorePluginsAdmin extends Piwik_Plugin function addMenu() { - Piwik_AddAdminMenu('CorePluginsAdmin_MenuPlugins', - array('module' => 'CorePluginsAdmin', 'action' => 'index'), - Piwik::isUserIsSuperUser(), - $order = 7); + Piwik_AddAdminMenu('CorePluginsAdmin_MenuPlugins', array('module' => 'CorePluginsAdmin', 'action' => 'index')); } } diff --git a/plugins/CorePluginsAdmin/templates/manage.tpl b/plugins/CorePluginsAdmin/templates/manage.tpl index 0c83104a57..c77eea691e 100644 --- a/plugins/CorePluginsAdmin/templates/manage.tpl +++ b/plugins/CorePluginsAdmin/templates/manage.tpl @@ -1,6 +1,7 @@ {assign var=showSitesSelection value=false} {assign var=showPeriodSelection value=false} {include file="CoreAdminHome/templates/header.tpl"} +{include file="CoreAdminHome/templates/menu.tpl"} <div style="max-width:980px;"> @@ -19,7 +20,7 @@ <tbody id="plugins"> {foreach from=$pluginsName key=name item=plugin} {if !$plugin.alwaysActivated} - <tr class={if $plugin.activated}"active"{else}"deactivate"{/if}> + <tr class={if $plugin.activated}"active"{else}class="deactivate"{/if}> <td class="name"> {if isset($plugin.info.homepage)}<a title="{'CorePluginsAdmin_PluginHomepage'|translate}" href="{$plugin.info.homepage}">{/if} {$name} @@ -29,7 +30,7 @@ <td class="desc"> {$plugin.info.description|nl2br} <cite>By - {if isset($plugin.info.author_homepage)}<a title="Author Homepage" href="misc/redirectToUrl.php?url={$plugin.info.author_homepage}">{/if} + {if isset($plugin.info.author_homepage)}<a title="Author Homepage" href="{$plugin.info.author_homepage}">{/if} {$plugin.info.author}{if isset($plugin.info.author_homepage)}</a>{/if}.</cite> </td> <td class="status"> @@ -40,8 +41,8 @@ <td class="togl action-links" {if $plugin.alwaysActivated}title="{'CorePluginsAdmin_ActivatedHelp'|translate}"{/if}> {if $plugin.alwaysActivated} <center>-</center> - {elseif $plugin.activated}<a href='index.php?module=CorePluginsAdmin&action=deactivate&pluginName={$name}&token_auth={$token_auth}'>{'CorePluginsAdmin_Deactivate'|translate}</a> - {else}<a href='index.php?module=CorePluginsAdmin&action=activate&pluginName={$name}&token_auth={$token_auth}'>{'CorePluginsAdmin_Activate'|translate}</a>{/if} + {elseif $plugin.activated}<a href=index.php?module=CorePluginsAdmin&action=deactivate&pluginName={$name}>{'CorePluginsAdmin_Deactivate'|translate}</a> + {else}<a href=index.php?module=CorePluginsAdmin&action=activate&pluginName={$name}>{'CorePluginsAdmin_Activate'|translate}</a>{/if} </td> </tr> {/if} diff --git a/plugins/CoreUpdater/Controller.php b/plugins/CoreUpdater/Controller.php index 266121356e..824e8a73f2 100644 --- a/plugins/CoreUpdater/Controller.php +++ b/plugins/CoreUpdater/Controller.php @@ -88,7 +88,7 @@ class Piwik_CoreUpdater_Controller extends Piwik_Controller Piwik::checkDirectoriesWritableOrDie( array(self::PATH_TO_EXTRACT_LATEST_VERSION) ); // we catch exceptions in the caller (i.e., oneClickUpdate) - $fetched = Piwik_Http::fetchRemoteFile(self::LATEST_PIWIK_URL, $this->pathPiwikZip); + $fetched = Piwik::fetchRemoteFile(self::LATEST_PIWIK_URL, $this->pathPiwikZip); } private function oneClick_Unpack() @@ -139,11 +139,6 @@ class Piwik_CoreUpdater_Controller extends Piwik_Controller private function oneClick_Copy() { /* - * Overwrite the downloaded robots.txt with our local copy - */ - Piwik::copy(PIWIK_DOCUMENT_ROOT . '/robots.txt', $this->pathRootExtractedPiwik . '/robots.txt'); - - /* * Copy all files to PIWIK_INCLUDE_PATH. * These files are accessed through the dispatcher. */ @@ -190,29 +185,17 @@ class Piwik_CoreUpdater_Controller extends Piwik_Controller { } - public function index() - { - $language = Piwik_Common::getRequestVar('language', ''); - if(!empty($language)) - { - Piwik_LanguagesManager_API::getInstance()->setLanguageForSession($language); - } - $this->runUpdaterAndExit(); - } - - protected function runUpdaterAndExit() + public function runUpdaterAndExit($updater, $componentsWithUpdateFile) { - $updater = new Piwik_Updater(); - $componentsWithUpdateFile = Piwik_CoreUpdater::getComponentUpdates($updater); if(empty($componentsWithUpdateFile)) { - Piwik::redirectToModule('CoreHome'); + return; } - - Piwik::setMaxExecutionTime(0); - - if(Piwik_Common::isPhpCliMode()) + + if(Piwik::isPhpCliMode()) { + Piwik::setMaxExecutionTime(0); + $view = Piwik_View::factory('update_welcome'); $this->doWelcomeUpdates($view, $componentsWithUpdateFile); @@ -224,14 +207,12 @@ class Piwik_CoreUpdater_Controller extends Piwik_Controller } else if(Piwik_Common::getRequestVar('updateCorePlugins', 0, 'integer') == 1) { - $this->warningMessages = array(); $view = Piwik_View::factory('update_database_done'); $this->doExecuteUpdates($view, $updater, $componentsWithUpdateFile); } else { $view = Piwik_View::factory('update_welcome'); - $view->queries = $updater->getSqlQueriesToExecute(); $this->doWelcomeUpdates($view, $componentsWithUpdateFile); } exit; @@ -240,12 +221,13 @@ class Piwik_CoreUpdater_Controller extends Piwik_Controller private function doWelcomeUpdates($view, $componentsWithUpdateFile) { $view->new_piwik_version = Piwik_Version::VERSION; - $view->commandUpgradePiwik = "<br /><code>php ".Piwik_Common::getPathToPiwikRoot()."/index.php -- \"module=CoreUpdater\" </code>"; + $pluginNamesToUpdate = array(); $coreToUpdate = false; // handle case of existing database with no tables - if(!Piwik::isInstalled()) + $tablesInstalled = Piwik::getTablesInstalled(); + if(count($tablesInstalled) == 0) { $this->errorMessages[] = Piwik_Translate('CoreUpdater_EmptyDatabaseError', Zend_Registry::get('config')->database->dbname); $this->coreError = true; @@ -272,20 +254,7 @@ class Piwik_CoreUpdater_Controller extends Piwik_Controller } } } - - // check file integrity - $integrityInfo = Piwik::getFileIntegrityInformation(); - if(isset($integrityInfo[1])) - { - if($integrityInfo[0] == false) - { - $this->warningMessages[] = '<b>'.Piwik_Translate('General_FileIntegrityWarningExplanation').'</b>'; - } - $this->warningMessages = array_merge($this->warningMessages, array_slice($integrityInfo, 1)); - } - $view->coreError = $this->coreError; - $view->warningMessages = $this->warningMessages; $view->errorMessages = $this->errorMessages; $view->current_piwik_version = $currentVersion; $view->pluginNamesToUpdate = $pluginNamesToUpdate; @@ -331,4 +300,11 @@ class Piwik_CoreUpdater_Controller extends Piwik_Controller } } } + + public function saveLanguage() + { + $language = Piwik_Common::getRequestVar('language'); + Piwik_LanguagesManager_API::setLanguageForSession($language); + Piwik_Url::redirectToReferer(); + } } diff --git a/plugins/CoreUpdater/CoreUpdater.php b/plugins/CoreUpdater/CoreUpdater.php index 247713f44d..22dc0319e8 100644 --- a/plugins/CoreUpdater/CoreUpdater.php +++ b/plugins/CoreUpdater/CoreUpdater.php @@ -19,10 +19,11 @@ class Piwik_CoreUpdater extends Piwik_Plugin public function getInformation() { return array( - 'description' => Piwik_Translate('CoreUpdater_PluginDescription'), + 'name' => 'Updater', + 'description' => 'Piwik updating mechanism', 'author' => 'Piwik', - 'author_homepage' => 'http://piwik.org/', - 'version' => Piwik_Version::VERSION, + 'homepage' => 'http://piwik.org/', + 'version' => '0.1', ); } @@ -35,34 +36,34 @@ class Piwik_CoreUpdater extends Piwik_Plugin return $hooks; } - public static function getComponentUpdates($updater) + function dispatch() { - $updater->addComponentToCheck('core', Piwik_Version::VERSION); + $language = Piwik_Common::getRequestVar('language', '', 'string'); + if($language != '') + { + $updaterController = new Piwik_CoreUpdater_Controller(); + $updaterController->saveLanguage(); + exit; + } - $plugins = Piwik_PluginsManager::getInstance()->getLoadedPlugins(); + $updater = new Piwik_Updater(); + $updater->addComponentToCheck('core', Piwik_Version::VERSION); + + $plugins = Piwik_PluginsManager::getInstance()->getInstalledPlugins(); foreach($plugins as $pluginName => $plugin) { $updater->addComponentToCheck($pluginName, $plugin->getVersion()); } $componentsWithUpdateFile = $updater->getComponentsWithUpdateFile(); - if(count($componentsWithUpdateFile) == 0 && !$updater->hasNewVersion('core')) - { - return null; - } - - return $componentsWithUpdateFile; - } - - function dispatch() - { - $module = Piwik_Common::getRequestVar('module', '', 'string'); - $updater = new Piwik_Updater(); - if(self::getComponentUpdates($updater) !== null && $module != 'CoreUpdater') + if(count($componentsWithUpdateFile) == 0) { - Piwik::redirectToModule('CoreUpdater'); + return; } - } + + $updaterController = new Piwik_CoreUpdater_Controller(); + $updaterController->runUpdaterAndExit($updater, $componentsWithUpdateFile); + } function updateCheck() { diff --git a/plugins/CoreUpdater/templates/cli_update_database_done.tpl b/plugins/CoreUpdater/templates/cli_update_database_done.tpl index 6cda000c79..98ab7a8012 100644 --- a/plugins/CoreUpdater/templates/cli_update_database_done.tpl +++ b/plugins/CoreUpdater/templates/cli_update_database_done.tpl @@ -54,9 +54,9 @@ {'CoreUpdater_HelpMessageIntroductionWhenWarning'|translate|unescape} * {$helpMessage} - {else} - {'CoreUpdater_PiwikHasBeenSuccessfullyUpgraded'|translate|unescape} {/if} + {'CoreUpdater_PiwikHasBeenSuccessfullyUpgraded'|translate|unescape} + {/if} {/textformat} diff --git a/plugins/CoreUpdater/templates/cli_update_welcome.tpl b/plugins/CoreUpdater/templates/cli_update_welcome.tpl index 28d60bd955..3a76f18366 100644 --- a/plugins/CoreUpdater/templates/cli_update_welcome.tpl +++ b/plugins/CoreUpdater/templates/cli_update_welcome.tpl @@ -15,22 +15,20 @@ * {$helpMessage} {else} - {if $coreToUpdate || count($pluginNamesToUpdate) > 0} - {'CoreUpdater_DatabaseUpgradeRequired'|translate|unescape} + {'CoreUpdater_DatabaseUpgradeRequired'|translate|unescape} - {'CoreUpdater_YourDatabaseIsOutOfDate'|translate|unescape} + {'CoreUpdater_YourDatabaseIsOutOfDate'|translate|unescape} - {if $coreToUpdate} - {'CoreUpdater_PiwikWillBeUpgradedFromVersionXToVersionY'|translate:$current_piwik_version:$new_piwik_version|unescape} + {if $coreToUpdate} + {'CoreUpdater_PiwikWillBeUpgradedFromVersionXToVersionY'|translate:$current_piwik_version:$new_piwik_version|unescape} - {/if} - {if count($pluginNamesToUpdate) > 0} - {assign var=listOfPlugins value=$pluginNamesToUpdate|@implode:', '} - {'CoreUpdater_TheFollowingPluginsWillBeUpgradedX'|translate:$listOfPlugins|unescape} - - {/if} - {'CoreUpdater_TheUpgradeProcessMayTakeAWhilePleaseBePatient'|translate|unescape} + {/if} + {if count($pluginNamesToUpdate) > 0} + {assign var=listOfPlugins value=$pluginNamesToUpdate|@implode:', '} + {'CoreUpdater_TheFollowingPluginsWillBeUpgradedX'|translate:$listOfPlugins|unescape} {/if} + {'CoreUpdater_TheUpgradeProcessMayTakeAWhilePleaseBePatient'|translate|unescape} + {/if} {/textformat} diff --git a/plugins/CoreUpdater/templates/header.tpl b/plugins/CoreUpdater/templates/header.tpl index 076801771d..0194dad6f4 100644 --- a/plugins/CoreUpdater/templates/header.tpl +++ b/plugins/CoreUpdater/templates/header.tpl @@ -7,20 +7,6 @@ <link rel="shortcut icon" href="plugins/CoreHome/templates/images/favicon.ico" /> <link rel="stylesheet" type="text/css" href="themes/default/simple_structure.css" /> - <link rel="stylesheet" type="text/css" href="libs/jquery/themes/base/jquery-ui.css" class="ui-theme" /> -{literal} -<style> -* { - margin: 0; - padding: 0; -} -.topBarElem { - font-family:arial,sans-serif !important; - font-size:13px; - line-height:1.33; -} -</style> -{/literal} {postEvent name="template_css_import"} <script type="text/javascript" src="libs/jquery/jquery.js"></script> diff --git a/plugins/CoreUpdater/templates/update_database_done.tpl b/plugins/CoreUpdater/templates/update_database_done.tpl index 28b0b235d5..ab2740bc7d 100644 --- a/plugins/CoreUpdater/templates/update_database_done.tpl +++ b/plugins/CoreUpdater/templates/update_database_done.tpl @@ -2,14 +2,14 @@ {assign var='helpMessage' value='CoreUpdater_HelpMessageContent'|translate:'<a target="_blank" href="misc/redirectToUrl.php?url=http://piwik.org/faq/">':'</a>':'</li><li>'} {if $coreError} - <br /><br /> + <br><br> <div class="error"> - <img src="themes/default/images/error_medium.png" /> {'CoreUpdater_CriticalErrorDuringTheUpgradeProcess'|translate} + <img src="themes/default/images/error_medium.png"> {'CoreUpdater_CriticalErrorDuringTheUpgradeProcess'|translate} {foreach from=$errorMessages item=message} - <pre>{$message}</pre><br /> + <pre>{$message}</pre> {/foreach} </div> - <br /> + <br> <p>{'CoreUpdater_HelpMessageIntroductionWhenError'|translate} <ul><li>{$helpMessage}</li></ul></p> @@ -23,38 +23,38 @@ {if count($warningMessages) > 0} <div class="warning"> - <p><img src="themes/default/images/warning_medium.png" /> {'CoreUpdater_WarningMessages'|translate}</p> + <p><img src="themes/default/images/warning_medium.png"> {'CoreUpdater_WarningMessages'|translate}</p> {foreach from=$warningMessages item=message} - <pre>{$message}</pre><br /> + <pre>{$message}</pre> {/foreach} </div> {/if} {if count($errorMessages) > 0} <div class="warning"> - <p><img src="themes/default/images/warning_medium.png" /> {'CoreUpdater_ErrorDuringPluginsUpdates'|translate}</p> + <p><img src="themes/default/images/warning_medium.png"> {'CoreUpdater_ErrorDuringPluginsUpdates'|translate}</p> {foreach from=$errorMessages item=message} - <pre>{$message}</pre><br /> + <pre>{$message}</pre> {/foreach} {if isset($deactivatedPlugins) && count($deactivatedPlugins) > 0} {assign var=listOfDeactivatedPlugins value=$deactivatedPlugins|@implode:', '} - <p style="color:red"><img src="themes/default/images/error_medium.png" /> {'CoreUpdater_WeAutomaticallyDeactivatedTheFollowingPlugins'|translate:$listOfDeactivatedPlugins}</p> + <p style="color:red"><img src="themes/default/images/error_medium.png"> {'CoreUpdater_WeAutomaticallyDeactivatedTheFollowingPlugins'|translate:$listOfDeactivatedPlugins}</p> {/if} </div> {/if} {if count($errorMessages) > 0 || count($warningMessages) > 0} - <br /> + <br> <p>{'CoreUpdater_HelpMessageIntroductionWhenWarning'|translate} <ul><li>{$helpMessage}</li></ul> </p> - {else} - <p class="success">{'CoreUpdater_PiwikHasBeenSuccessfullyUpgraded'|translate}</p> {/if} + + <p class="success">{'CoreUpdater_PiwikHasBeenSuccessfullyUpgraded'|translate}</p> <form action="index.php"> - <input type="submit" class="submit" value="{'CoreUpdater_ContinueToPiwik'|translate}" /> + <input type="submit" class="submit" value="{'CoreUpdater_ContinueToPiwik'|translate}"/> </form> {/if} diff --git a/plugins/CoreUpdater/templates/update_new_version_available.tpl b/plugins/CoreUpdater/templates/update_new_version_available.tpl index d2218175c7..7823386807 100644 --- a/plugins/CoreUpdater/templates/update_new_version_available.tpl +++ b/plugins/CoreUpdater/templates/update_new_version_available.tpl @@ -2,14 +2,14 @@ <p><b>{'CoreUpdater_ThereIsNewVersionAvailableForUpdate'|translate}</b></p> <p>{'CoreUpdater_YouCanUpgradeAutomaticallyOrDownloadPackage'|translate:$piwik_new_version}</p> -<br /> +<br> <form action="index.php"> -<input type="hidden" name="module" value="CoreUpdater" /> -<input type="hidden" name="action" value="oneClickUpdate" /> -<input type="submit" class="submit" value="{'CoreUpdater_UpdateAutomatically'|translate}" /> +<input type="hidden" name="module" value="CoreUpdater"> +<input type="hidden" name="action" value="oneClickUpdate"> +<input type="submit" class="submit" value="{'CoreUpdater_UpdateAutomatically'|translate}"/> <a style="margin-left:50px" class="submit button" href="http://piwik.org/latest.zip">{'CoreUpdater_DownloadX'|translate:$piwik_new_version}</a> </form> -<br /> + <a href='index.php'>« {'General_BackToPiwik'|translate}</a> {include file="CoreUpdater/templates/footer.tpl"} diff --git a/plugins/CoreUpdater/templates/update_one_click_done.tpl b/plugins/CoreUpdater/templates/update_one_click_done.tpl index f4fbde8036..7f1b878f2c 100644 --- a/plugins/CoreUpdater/templates/update_one_click_done.tpl +++ b/plugins/CoreUpdater/templates/update_one_click_done.tpl @@ -5,14 +5,14 @@ {/foreach} {if $coreError} - <br /><br /> - <div class="error"><img src="themes/default/images/error_medium.png" /> {$coreError}</div> - <br /><br /> - <div class="warning"><img src="themes/default/images/warning_medium.png" /> {'CoreUpdater_UpdateHasBeenCancelledExplanation'|translate:"<br /><br />":"<a target='_blank' href='misc/redirectToUrl.php?url=http://piwik.org/docs/update/'>":"</a>"}</div> - <br /><br /> + <br/><br/> + <div class="error"><img src="themes/default/images/error_medium.png"> {$coreError}</div> + <br/><br/> + <div class="warning"><img src="themes/default/images/warning_medium.png"> {'CoreUpdater_UpdateHasBeenCancelledExplanation'|translate:"<br/><br/>":"<a target='_blank' href='misc/redirectToUrl.php?url=http://piwik.org/docs/update/'>":"</a>"}</div> + <br/><br/> {/if} <form action="index.php"> -<input type="submit" class="submit" value="{'CoreUpdater_ContinueToPiwik'|translate}" /> +<input type="submit" class="submit" value="{'CoreUpdater_ContinueToPiwik'|translate}"/> </form> {include file="CoreUpdater/templates/footer.tpl"} diff --git a/plugins/CoreUpdater/templates/update_welcome.tpl b/plugins/CoreUpdater/templates/update_welcome.tpl index f5a8da5dbc..c36e5751c1 100644 --- a/plugins/CoreUpdater/templates/update_welcome.tpl +++ b/plugins/CoreUpdater/templates/update_welcome.tpl @@ -3,97 +3,38 @@ {assign var='helpMessage' value='CoreUpdater_HelpMessageContent'|translate:'<a target="_blank" href="misc/redirectToUrl.php?url=http://piwik.org/faq/">':'</a>':'</li><li>'} {if $coreError} - <br /><br /> + <br><br> <div class="error"> - <img src="themes/default/images/error_medium.png" /> {'CoreUpdater_CriticalErrorDuringTheUpgradeProcess'|translate} + <img src="themes/default/images/error_medium.png"> {'CoreUpdater_CriticalErrorDuringTheUpgradeProcess'|translate} {foreach from=$errorMessages item=message} <pre>{$message}</pre> {/foreach} </div> - <br /> + <br> <p>{'CoreUpdater_HelpMessageIntroductionWhenError'|translate} <ul><li>{$helpMessage}</li></ul></p> {else} - {if $coreToUpdate || count($pluginNamesToUpdate) > 0} - <p style='font-size:110%;padding-top:1em;'><b>{'CoreUpdater_DatabaseUpgradeRequired'|translate}</b></p> - <p>{'CoreUpdater_YourDatabaseIsOutOfDate'|translate}</p> + <p><b>{'CoreUpdater_DatabaseUpgradeRequired'|translate}</b></p> + <p>{'CoreUpdater_YourDatabaseIsOutOfDate'|translate}</p> - {if $coreToUpdate} - <p>{'CoreUpdater_PiwikWillBeUpgradedFromVersionXToVersionY'|translate:$current_piwik_version:$new_piwik_version}</p> - {/if} - - {if count($pluginNamesToUpdate) > 0} - {assign var=listOfPlugins value=$pluginNamesToUpdate|@implode:', '} - <p>{'CoreUpdater_TheFollowingPluginsWillBeUpgradedX'|translate:$listOfPlugins}</p> - {/if} - - <p><strong>{'CoreUpdater_NoteForLargePiwikInstances'|translate}</strong></p> - <ul> - <li>{'CoreUpdater_TheUpgradeProcessMayFailExecuteCommand'|translate:$commandUpgradePiwik}</li> - <li>{'CoreUpdater_YouCouldManuallyExecuteSqlQueries'|translate}<br /> - <a href='#' id='showSql' style='margin-left:20px'>› {'CoreUpdater_ClickHereToViewSqlQueries'|translate}</a> - <div id='sqlQueries' style='display:none'> - <br /> - <code> - # {'CoreUpdater_NoteItIsExpectedThatQueriesFail'|translate}<br /><br /> - {foreach from=$queries item=query} {$query}<br /> - {/foreach} - </code> - </div> - <br /><br /> - <p><strong>{'CoreUpdater_ReadyToGo'|translate}</strong></p> - <p>{'CoreUpdater_TheUpgradeProcessMayTakeAWhilePleaseBePatient'|translate}</p> + {if $coreToUpdate} + <p>{'CoreUpdater_PiwikWillBeUpgradedFromVersionXToVersionY'|translate:$current_piwik_version:$new_piwik_version}</p> {/if} - {if count($warningMessages) > 0} - <p><i>{$warningMessages[0]}</i> - {if count($warningMessages) > 1} - <button id="more-results" class="ui-button ui-state-default ui-corner-all">{'General_Details'|translate}</button> - {/if} - </p> + {if count($pluginNamesToUpdate) > 0} + {assign var=listOfPlugins value=$pluginNamesToUpdate|@implode:', '} + <p>{'CoreUpdater_TheFollowingPluginsWillBeUpgradedX'|translate:$listOfPlugins}</p> {/if} - {if $coreToUpdate || count($pluginNamesToUpdate) > 0} - <br /> - <form action="index.php"> - <input type="hidden" name="updateCorePlugins" value="1" /> - <input type="submit" class="submit" value="{'CoreUpdater_UpgradePiwik'|translate}" /> - </form> - {else} - {if count($warningMessages) == 0} - <p class="success">{'CoreUpdater_PiwikHasBeenSuccessfullyUpgraded'|translate}</p> - {/if} + <p>{'CoreUpdater_TheUpgradeProcessMayFail'|translate}</p> + <p>{'CoreUpdater_TheUpgradeProcessMayTakeAWhilePleaseBePatient'|translate}</p> - <br /> - <form action="index.php"> - <input type="submit" class="submit" value="{'CoreUpdater_ContinueToPiwik'|translate}" /> - </form> - {/if} + <br> + <form action="index.php"> + <input type="hidden" name="updateCorePlugins" value="1"> + <input type="submit" class="submit" value="{'CoreUpdater_UpgradePiwik'|translate}"/> + </form> {/if} -{include file="Installation/templates/integrityDetails.tpl"} - -{literal} -<style> -code { - background-color:#F0F7FF; - border-color:#00008B; - border-style:dashed dashed dashed solid; - border-width:1px 1px 1px 5px; - direction:ltr; - display:block; - margin:2px 2px 20px; - padding:4px; - text-align:left; -} -</style> -<script type="text/javascript"> -$(document).ready(function() { - $('#showSql').click( function () { - $('#sqlQueries').toggle(); - }); -}); -</script> -{/literal} {include file="CoreUpdater/templates/footer.tpl"} diff --git a/plugins/DBStats/API.php b/plugins/DBStats/API.php index 4821f4e2b9..cb7618a908 100644 --- a/plugins/DBStats/API.php +++ b/plugins/DBStats/API.php @@ -27,7 +27,7 @@ class Piwik_DBStats_API return self::$instance; } - public function getDBStatus() + static public function getDBStatus() { Piwik::checkUserIsSuperUser(); $configDb = Zend_Registry::get('config')->database->toArray(); @@ -45,16 +45,13 @@ class Piwik_DBStats_API return $status; } - public function getTableStatus($table, $field = '') + static public function getTableStatus($table, $field = '') { Piwik::checkUserIsSuperUser(); $db = Zend_Registry::get('db'); // http://dev.mysql.com/doc/refman/5.1/en/show-table-status.html - $tables = $db->fetchAll("SHOW TABLE STATUS LIKE ". $db->quote($table)); + $tables = $db->fetchAll("SHOW TABLE STATUS LIKE ?", $table); - if(!isset($tables[0])) { - throw new Exception('Error, table or field not found'); - } if ($field == '') { return $tables[0]; @@ -65,7 +62,7 @@ class Piwik_DBStats_API } } - public function getAllTablesStatus() + static public function getAllTablesStatus() { Piwik::checkUserIsSuperUser(); $db = Zend_Registry::get('db'); @@ -75,7 +72,7 @@ class Piwik_DBStats_API $table = array(); foreach($tablesPiwik as $tableName) { - $t = $this->getTableStatus($tableName); + $t = self::getTableStatus($tableName); $total['Data_length'] += $t['Data_length']; $total['Index_length'] += $t['Index_length']; $total['Rows'] += $t['Rows']; diff --git a/plugins/DBStats/Controller.php b/plugins/DBStats/Controller.php index dca55f0fe1..4896519e6e 100644 --- a/plugins/DBStats/Controller.php +++ b/plugins/DBStats/Controller.php @@ -18,9 +18,8 @@ class Piwik_DBStats_Controller extends Piwik_Controller { function index() { - Piwik::checkUserIsSuperUser(); $view = Piwik_View::factory('DBStats'); - $view->tablesStatus = Piwik_DBStats_API::getInstance()->getAllTablesStatus(); + $view->tablesStatus = Piwik_DBStats_API::getAllTablesStatus(); $this->setGeneralVariablesView($view); $view->menu = Piwik_GetAdminMenu(); echo $view->render(); diff --git a/plugins/DBStats/DBStats.php b/plugins/DBStats/DBStats.php index 6e12ecf1c0..58c7c6b967 100644 --- a/plugins/DBStats/DBStats.php +++ b/plugins/DBStats/DBStats.php @@ -19,10 +19,11 @@ class Piwik_DBStats extends Piwik_Plugin public function getInformation() { return array( - 'description' => Piwik_Translate('DBStats_PluginDescription'), + 'name' => 'Database statistics', + 'description' => 'This plugin reports the database usage by Piwik tables.', 'author' => 'Piwik', - 'author_homepage' => 'http://piwik.org/', - 'version' => Piwik_Version::VERSION, + 'homepage' => 'http://piwik.org/', + 'version' => '0.1', ); } @@ -33,9 +34,6 @@ class Piwik_DBStats extends Piwik_Plugin function addMenu() { - Piwik_AddAdminMenu('DBStats_DatabaseUsage', - array('module' => 'DBStats', 'action' => 'index'), - Piwik::isUserIsSuperUser(), - $order = 9); + Piwik_AddAdminMenu('DBStats_DatabaseUsage', array('module' => 'DBStats', 'action' => 'index')); } } diff --git a/plugins/DBStats/templates/DBStats.tpl b/plugins/DBStats/templates/DBStats.tpl index e5f054d6f0..2a65c22fc7 100644 --- a/plugins/DBStats/templates/DBStats.tpl +++ b/plugins/DBStats/templates/DBStats.tpl @@ -1,17 +1,16 @@ {assign var=showSitesSelection value=false} {assign var=showPeriodSelection value=false} {include file="CoreAdminHome/templates/header.tpl"} +{include file="CoreAdminHome/templates/menu.tpl"} <div style="max-width:980px;"> <h2>{'DBStats_DatabaseUsage'|translate}</h2> {assign var=totalSize value=$tablesStatus.Total.Total_length} -<p>{'DBStats_MainDescription'|translate:$totalSize} -<br /> -{'DBStats_LearnMore'|translate:"<a href='misc/redirectToUrl.php?url=http://piwik.org/docs/setup-auto-archiving/' target='_blank'>Piwik Auto Archiving</a>"}</p> +<p>{'DBStats_MainDescription'|translate:$totalSize}</p> <table class="adminTable"> <thead> <th>{'DBStats_Table'|translate}</th> - <th>{'DBStats_RowCount'|translate}</th> + <th>{'DBStats_RowNumber'|translate}</th> <th>{'DBStats_DataSize'|translate}</th> <th>{'DBStats_IndexSize'|translate}</th> <th>{'DBStats_TotalSize'|translate}</th> diff --git a/plugins/Dashboard/Controller.php b/plugins/Dashboard/Controller.php index 21d608ee82..863883f6be 100644 --- a/plugins/Dashboard/Controller.php +++ b/plugins/Dashboard/Controller.php @@ -21,12 +21,16 @@ class Piwik_Dashboard_Controller extends Piwik_Controller $view = Piwik_View::factory($template); $this->setGeneralVariablesView($view); - $view->availableWidgets = json_encode(Piwik_GetWidgetsList()); - $layout = $this->getLayout(); - if(empty($layout)) { - $layout = $this->getDefaultLayout(); + // layout was JSON.stringified + $layout = html_entity_decode($this->getLayout()); + $layout = str_replace("\\\"", "\"", $layout); + + if(!empty($layout) + && strstr($layout, '[[') == false) { + $layout = "'$layout'"; } $view->layout = $layout; + $view->availableWidgets = json_encode(Piwik_GetWidgetsList()); return $view; } @@ -52,7 +56,7 @@ class Piwik_Dashboard_Controller extends Piwik_Controller protected function saveLayoutForUser( $login, $idDashboard, $layout) { $paramsBind = array($login, $idDashboard, $layout, $layout); - Piwik_Query('INSERT INTO '.Piwik_Common::prefixTable('user_dashboard') . + Piwik_Query('INSERT INTO '.Piwik::prefixTable('user_dashboard') . ' (login, iddashboard, layout) VALUES (?,?,?) ON DUPLICATE KEY UPDATE layout=?', @@ -70,7 +74,7 @@ class Piwik_Dashboard_Controller extends Piwik_Controller protected function getLayoutForUser( $login, $idDashboard) { $paramsBind = array($login, $idDashboard); - $return = Piwik_FetchAll('SELECT layout FROM '.Piwik_Common::prefixTable('user_dashboard') . + $return = Piwik_FetchAll('SELECT layout FROM '.Piwik::prefixTable('user_dashboard') . ' WHERE login = ? AND iddashboard = ?', $paramsBind); if(count($return) == 0) { @@ -86,14 +90,14 @@ class Piwik_Dashboard_Controller extends Piwik_Controller */ public function saveLayout() { - $this->checkTokenInUrl(); $layout = Piwik_Common::getRequestVar('layout'); $idDashboard = Piwik_Common::getRequestVar('idDashboard', 1, 'int' ); $currentUser = Piwik::getCurrentUserLogin(); + if($currentUser == 'anonymous') { $session = new Zend_Session_Namespace("Piwik_Dashboard"); - $session->dashboardLayout = $layout; + $session->idDashboard = $layout; } else { @@ -115,84 +119,16 @@ class Piwik_Dashboard_Controller extends Piwik_Controller { $session = new Zend_Session_Namespace("Piwik_Dashboard"); - if(!isset($session->dashboardLayout)) + if(!isset($session->idDashboard)) { return false; } - $layout = $session->dashboardLayout; + return $session->idDashboard; } else { - $layout = $this->getLayoutForUser($currentUser,$idDashboard); - } - - // layout was JSON.stringified - $layout = html_entity_decode($layout); - $layout = str_replace("\\\"", "\"", $layout); - - // compatibility with the old layout format - if(!empty($layout) - && strstr($layout, '[[') == false) { - $layout = "'$layout'"; - } - $layout = $this->removeDisabledPluginFromLayout($layout); - return $layout; - } - - protected function removeDisabledPluginFromLayout($layout) - { - $layout = str_replace("\n", "", $layout); - // if the json decoding works (ie. new Json format) - // we will only return the widgets that are from enabled plugins - if($layoutObject = json_decode($layout, $assoc = false)) - { - foreach($layoutObject as &$row) - { - if(!is_array($row)) - { - $row = array(); - continue; - } - - foreach($row as $widgetId => $widget) - { - if(isset($widget->parameters->module)) { - $controllerName = $widget->parameters->module; - $controllerAction = $widget->parameters->action; - if(!Piwik_IsWidgetDefined($controllerName, $controllerAction)) - { - unset($row[$widgetId]); - } - } - } - } - $layout = json_encode($layoutObject); - } - return $layout; - } - - protected function getDefaultLayout() - { - $defaultLayout = '[ - [ - {"uniqueId":"widgetVisitsSummarygetEvolutionGraph","parameters":{"module":"VisitsSummary","action":"getEvolutionGraph","columns":["nb_visits"]}}, - {"uniqueId":"widgetVisitorInterestgetNumberOfVisitsPerVisitDuration","parameters":{"module":"VisitorInterest","action":"getNumberOfVisitsPerVisitDuration"}}, - {"uniqueId":"widgetUserSettingsgetBrowser","parameters":{"module":"UserSettings","action":"getBrowser"}}, - {"uniqueId":"widgetUserCountrygetCountry","parameters":{"module":"UserCountry","action":"getCountry"}}, - {"uniqueId":"widgetExampleFeedburnerfeedburner","parameters":{"module":"ExampleFeedburner","action":"feedburner"}} - ], - [ - {"uniqueId":"widgetReferersgetKeywords","parameters":{"module":"Referers","action":"getKeywords"}}, - {"uniqueId":"widgetReferersgetWebsites","parameters":{"module":"Referers","action":"getWebsites"}} - ], - [ - {"uniqueId":"widgetReferersgetSearchEngines","parameters":{"module":"Referers","action":"getSearchEngines"}}, - {"uniqueId":"widgetVisitTimegetVisitInformationPerServerTime","parameters":{"module":"VisitTime","action":"getVisitInformationPerServerTime"}}, - {"uniqueId":"widgetExampleRssWidgetrssPiwik","parameters":{"module":"ExampleRssWidget","action":"rssPiwik"}} - ] - ]'; - $defaultLayout = $this->removeDisabledPluginFromLayout($defaultLayout); - return $defaultLayout; + return $this->getLayoutForUser($currentUser,$idDashboard); + } } } diff --git a/plugins/Dashboard/Dashboard.php b/plugins/Dashboard/Dashboard.php index cf9cacfb06..5e977160ea 100644 --- a/plugins/Dashboard/Dashboard.php +++ b/plugins/Dashboard/Dashboard.php @@ -11,6 +11,7 @@ */ /** + * * @package Piwik_Dashboard */ class Piwik_Dashboard extends Piwik_Plugin @@ -18,10 +19,11 @@ class Piwik_Dashboard extends Piwik_Plugin public function getInformation() { return array( - 'description' => Piwik_Translate('Dashboard_PluginDescription'), + 'name' => 'Dashboard', + 'description' => 'Your Web Analytics Dashboard. You can customize Your Dashboard: add new widgets, change the order of your widgets. Each user can access his own custom Dashboard.', 'author' => 'Piwik', - 'author_homepage' => 'http://piwik.org/', - 'version' => Piwik_Version::VERSION, + 'homepage' => 'http://piwik.org/', + 'version' => '0.1', ); } @@ -30,7 +32,6 @@ class Piwik_Dashboard extends Piwik_Plugin return array( 'template_js_import' => 'js', 'template_css_import' => 'css', - 'UsersManager.deleteUser' => 'deleteDashboardLayout', ); } @@ -47,25 +48,19 @@ class Piwik_Dashboard extends Piwik_Plugin { echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"plugins/Dashboard/templates/dashboard.css\" />\n"; } - - function deleteDashboardLayout($notification) - { - $userLogin = $notification->getNotificationObject(); - Piwik_Query('DELETE FROM ' . Piwik_Common::prefixTable('user_dashboard') . ' WHERE login = ?', array($userLogin)); - } - + public function install() { // we catch the exception try{ - $sql = "CREATE TABLE ". Piwik_Common::prefixTable('user_dashboard')." ( + $sql = "CREATE TABLE ". Piwik::prefixTable('user_dashboard')." ( login VARCHAR( 100 ) NOT NULL , iddashboard INT NOT NULL , layout TEXT NOT NULL, PRIMARY KEY ( login , iddashboard ) ) DEFAULT CHARSET=utf8 " ; Piwik_Exec($sql); - } catch(Exception $e){ + } catch(Zend_Db_Statement_Exception $e){ // mysql code error 1050:table already exists // see bug #153 http://dev.piwik.org/trac/ticket/153 if(!Zend_Registry::get('db')->isErrNo($e, '1050')) @@ -77,7 +72,7 @@ class Piwik_Dashboard extends Piwik_Plugin public function uninstall() { - $sql = "DROP TABLE ". Piwik_Common::prefixTable('user_dashboard') ; + $sql = "DROP TABLE ". Piwik::prefixTable('user_dashboard') ; Piwik_Exec($sql); } diff --git a/plugins/Dashboard/templates/Dashboard.js b/plugins/Dashboard/templates/Dashboard.js index 74d81ec3b7..73f15ecb04 100644 --- a/plugins/Dashboard/templates/Dashboard.js +++ b/plugins/Dashboard/templates/Dashboard.js @@ -79,30 +79,15 @@ dashboard.prototype = // load all widgets $('.widget', self.dashboardElement).each( function() { var uniqueId = $(this).attr('id'); - self.reloadWidget(uniqueId); + function onWidgetLoadedReplaceElementWithContent(loadedContent) + { + $('#'+uniqueId+'>.widgetContent', self.dashboardElement).html(loadedContent); + } + widget = widgetsHelper.getWidgetObjectFromUniqueId(uniqueId); + widgetParameters = widget["parameters"]; + $.ajax(widgetsHelper.getLoadWidgetAjaxRequest(uniqueId, widgetParameters, onWidgetLoadedReplaceElementWithContent)); }); }, - - reloadEnclosingWidget: function(domNodeInsideWidget) - { - var uniqueId = $(domNodeInsideWidget).parents('.widget').attr('id'); - this.reloadWidget(uniqueId); - }, - - reloadWidget: function(uniqueId) - { - function onWidgetLoadedReplaceElementWithContent(loadedContent) - { - $('#'+uniqueId+'>.widgetContent', self.dashboardElement).html(loadedContent); - } - widget = widgetsHelper.getWidgetObjectFromUniqueId(uniqueId); - if(widget == false) - { - return; - } - widgetParameters = widget["parameters"]; - $.ajax(widgetsHelper.getLoadWidgetAjaxRequest(uniqueId, widgetParameters, onWidgetLoadedReplaceElementWithContent)); - }, addDummyWidgetAtBottomOfColumn: function(columnNumber) { @@ -124,14 +109,13 @@ dashboard.prototype = } columnElement = $(self.dashboardColumnsElement[columnNumber]); emptyWidgetContent = '<div class="sortable">'+ - widgetsHelper.getEmptyWidgetHtml(uniqueId, widgetName)+ + widgetsHelper.getEmptyWidgetHtml(uniqueId, widgetName, _pk_translate('Dashboard_LoadingWidget_js'))+ '</div>'; if(addWidgetOnTop) { columnElement.prepend(emptyWidgetContent); } else { columnElement.append(emptyWidgetContent); } - widgetElement = $('#'+ uniqueId); widgetElement .hover( function() { @@ -157,14 +141,10 @@ dashboard.prototype = { var self = this; - function onStart(event, ui) { - if(!jQuery.support.noCloneEvent) { - $('object', this).hide(); - } + function onStart() { } function onStop(event, ui) { - $('object', this).show(); $('.widgetHover', this).removeClass('widgetHover'); $('.widgetTopHover', this).removeClass('widgetTopHover'); $('.button#close', this).hide(); @@ -181,7 +161,7 @@ dashboard.prototype = forcePlaceholderSize: true, placeholder: 'hover', handle: '.widgetTop', - helper: 'clone', + helper: 'original', start: onStart, stop: onStop }); @@ -241,7 +221,7 @@ dashboard.prototype = var ajaxRequest = { type: 'POST', - url: 'index.php?module=Dashboard&action=saveLayout&token_auth='+piwik.token_auth, + url: 'index.php?module=Dashboard&action=saveLayout', dataType: 'html', async: true, error: piwikHelper.ajaxHandleError, diff --git a/plugins/Dashboard/templates/dashboard.css b/plugins/Dashboard/templates/dashboard.css index 2551c8cff7..7c78adcbcb 100644 --- a/plugins/Dashboard/templates/dashboard.css +++ b/plugins/Dashboard/templates/dashboard.css @@ -18,21 +18,14 @@ margin-right: 5px; margin-left: 5px; overflow: hidden; - -moz-border-radius:4px; - -webkit-border-radius:4px; } .widgetHover { border: 1px solid #CBD3E7; } -.widgetContent h2 { - font-size:1.2em; -} .widgetTop { background: #F0F0FA; - -moz-border-radius:4px 4px 0 0; - -webkit-border-radius:4px 4px 0 0; border-bottom: 1px solid #D2D9EB; width: 100%; cursor: move; diff --git a/plugins/Dashboard/templates/index.tpl b/plugins/Dashboard/templates/index.tpl index ae957e33f7..faf0a11323 100644 --- a/plugins/Dashboard/templates/index.tpl +++ b/plugins/Dashboard/templates/index.tpl @@ -1,32 +1,56 @@ {loadJavascriptTranslations plugins='CoreHome Dashboard'} <script type="text/javascript"> +{if !empty($layout) } piwik.dashboardLayout = {$layout}; +{else} +{literal} + piwik.dashboardLayout = + [ + [ + {"uniqueId":"widgetVisitsSummarygetEvolutionGraph","parameters":{"module":"VisitsSummary","action":"getEvolutionGraph","columns":["nb_visits"]}}, + {"uniqueId":"widgetVisitorInterestgetNumberOfVisitsPerVisitDuration","parameters":{"module":"VisitorInterest","action":"getNumberOfVisitsPerVisitDuration"}}, + {"uniqueId":"widgetUserSettingsgetBrowser","parameters":{"module":"UserSettings","action":"getBrowser"}}, + {"uniqueId":"widgetUserCountrygetCountry","parameters":{"module":"UserCountry","action":"getCountry"}}, + {"uniqueId":"widgetExampleFeedburnerfeedburner","parameters":{"module":"ExampleFeedburner","action":"feedburner"}} + ], + [ + {"uniqueId":"widgetReferersgetKeywords","parameters":{"module":"Referers","action":"getKeywords"}}, + {"uniqueId":"widgetReferersgetWebsites","parameters":{"module":"Referers","action":"getWebsites"}} + ], + [ + {"uniqueId":"widgetReferersgetSearchEngines","parameters":{"module":"Referers","action":"getSearchEngines"}}, + {"uniqueId":"widgetVisitTimegetVisitInformationPerServerTime","parameters":{"module":"VisitTime","action":"getVisitInformationPerServerTime"}}, + {"uniqueId":"widgetExampleRssWidgetrssPiwik","parameters":{"module":"ExampleRssWidget","action":"rssPiwik"}} + ] + ]; +{/literal} {* the old dashboard layout style is: piwik.dashboardLayout = 'VisitsSummary.getEvolutionGraph~VisitorInterest.getNumberOfVisitsPerVisitDuration~UserSettings.getBrowser~ExampleFeedburner.feedburner|Referers.getKeywords~Referers.getWebsites|Referers.getSearchEngines~VisitTime.getVisitInformationPerServerTime~ExampleRssWidget.rssPiwik|'; *} - piwik.availableWidgets = {$availableWidgets}; +{/if} +piwik.availableWidgets = {$availableWidgets}; </script> {literal} <script type="text/javascript"> $(document).ready( function() { - piwik.dashboardObject = new dashboard(); - var widgetMenuObject = new widgetMenu(piwik.dashboardObject); - piwik.dashboardObject.init(piwik.dashboardLayout); + var dashboardObject = new dashboard(); + var widgetMenuObject = new widgetMenu(dashboardObject); + dashboardObject.init(piwik.dashboardLayout); widgetMenuObject.init(); - $('#addWidget.button').click(function(){widgetMenuObject.show();}); + $('.button#addWidget').click(function(){widgetMenuObject.show();}); }); </script> {/literal} <div id="dashboard"> <div class="dialog" id="confirm"> - <img src="themes/default/images/delete.png" style="padding: 10px; position: relative; margin-top: 10%; float: left;" /> + <img src="themes/default/images/delete.png" style="padding: 10px; position: relative; margin-top: 10%; float: left;"/> <p>{'Dashboard_DeleteWidgetConfirm'|translate}</p> - <input id="yes" type="button" value="{'General_Yes'|translate}" /> - <input id="no" type="button" value="{'General_No'|translate}" /> + <input id="yes" type="button" value="{'General_Yes'|translate}"/> + <input id="no" type="button" value="{'General_No'|translate}"/> </div> <div class="button" id="addWidget"> @@ -34,7 +58,7 @@ $(document).ready( function() { </div> <div class="menu" id="widgetChooser"> - <div id="closeMenuIcon"><img src="themes/default/images/close_medium.png" title="{'General_Close'|translate}" /></div> + <div id="closeMenuIcon"><img src="themes/default/images/close_medium.png" title="{'General_Close'|translate}"/></div> <div id="menuTitleBar">{'Dashboard_SelectWidget'|translate}</div> <div class="subMenu" id="sub1"></div> diff --git a/plugins/Dashboard/templates/widgetMenu.js b/plugins/Dashboard/templates/widgetMenu.js index 997c87158f..6556b9085f 100644 --- a/plugins/Dashboard/templates/widgetMenu.js +++ b/plugins/Dashboard/templates/widgetMenu.js @@ -55,7 +55,7 @@ widgetsHelper.getLoadWidgetAjaxRequest = function (widgetUniqueId, widgetParamet return ajaxRequest; }; -widgetsHelper.getEmptyWidgetHtml = function (uniqueId, widgetName) +widgetsHelper.getEmptyWidgetHtml = function (uniqueId, widgetName, widgetLoadingString) { return '<div id="'+uniqueId+'" class="widget">'+ '<div class="widgetTop">'+ @@ -66,7 +66,7 @@ widgetsHelper.getEmptyWidgetHtml = function (uniqueId, widgetName) '</div>'+ '<div class="widgetContent">'+ '<div class="widgetLoading">'+ - _pk_translate('Dashboard_LoadingWidget_js') + + widgetLoadingString + '</div>'+ '</div>'+ '</div>'; @@ -194,7 +194,10 @@ widgetMenu.prototype = widgetUniqueId, '<div title="'+_pk_translate("Dashboard_AddPreviewedWidget_js")+'">'+ _pk_translate('Dashboard_WidgetPreview_js')+ - '</div>' + '</div>', + '<span id="loadingPiwik">'+ + '<img src="themes/default/images/loading-blue.gif"> ' +_pk_translate('Dashboard_LoadingWidget_js') + + '</span>' ); $('#sub3').html(emptyWidgetHtml); @@ -228,7 +231,6 @@ widgetMenu.prototype = self.filterOutAlreadyLoadedWidget(); $.blockUI({ message: self.menuElement, - centerY: 0, css: {width:'', top: '5%',left:'10%', right:'10%', margin:"0px", textAlign:'', cursor:'', border:'0px'} }); } @@ -307,7 +309,7 @@ widgetMenu.prototype = ); $.extend($.blockUI.defaults.overlayCSS, { backgroundColor: '#000000', opacity: '0.4'}); $.extend($.blockUI.defaults,{ fadeIn: 0, fadeOut: 0 }); - $(document).keydown( function(e) { + $(window).keydown( function(e) { var key = e.keyCode || e.which; if(key == 27) { self.hideMenu(); diff --git a/plugins/ExampleAPI/ExampleAPI.php b/plugins/ExampleAPI/ExampleAPI.php index 271b58c9ab..aaddcfe89b 100644 --- a/plugins/ExampleAPI/ExampleAPI.php +++ b/plugins/ExampleAPI/ExampleAPI.php @@ -19,18 +19,15 @@ class Piwik_ExampleAPI extends Piwik_Plugin { /** * Return information about this plugin. - * - * @see Piwik_Plugin - * * @return array */ public function getInformation() { return array( - 'description' => Piwik_Translate('ExampleAPI_PluginDescription'), - 'homepage' => 'index.php?module=API&action=listAllAPI#ExampleAPI', + 'name' => 'Example API', + 'description' => 'Example Plugin: How to create an API for your plugin, to export your data in multiple formats without any special coding? Visit the <a href="index.php?module=API&action=listAllAPI#ExampleAPI">ExampleAPI example methods</a>.', 'author' => 'Piwik', - 'author_homepage' => 'http://piwik.org/', + 'homepage' => 'http://piwik.org/', 'version' => '0.1', ); } diff --git a/plugins/ExampleFeedburner/ExampleFeedburner.php b/plugins/ExampleFeedburner/ExampleFeedburner.php index ca7b582ce1..5a1458e13f 100644 --- a/plugins/ExampleFeedburner/ExampleFeedburner.php +++ b/plugins/ExampleFeedburner/ExampleFeedburner.php @@ -16,19 +16,13 @@ */ class Piwik_ExampleFeedburner extends Piwik_Plugin { - /** - * Return information about this plugin. - * - * @see Piwik_Plugin - * - * @return array - */ public function getInformation() { return array( - 'description' => Piwik_Translate('ExampleFeedburner_PluginDescription'), + 'name' => 'Example Feedburner', + 'description' => 'Example Plugin: How to display your Feedburner subscriber in a Widget in the Dashboard?', 'author' => 'Piwik', - 'author_homepage' => 'http://piwik.org/', + 'homepage' => 'http://piwik.org/', 'version' => '0.1', ); } @@ -36,8 +30,8 @@ class Piwik_ExampleFeedburner extends Piwik_Plugin function install() { try{ - Piwik_Exec('ALTER TABLE '.Piwik_Common::prefixTable('site'). " ADD `feedburnerName` VARCHAR( 100 ) DEFAULT NULL"); - } catch(Exception $e){ + Piwik_Exec('ALTER TABLE '.Piwik::prefixTable('site'). " ADD `feedburnerName` VARCHAR( 100 ) DEFAULT NULL"); + } catch(Zend_Db_Statement_Exception $e){ // mysql code error 1060: column already exists // if there is another error we throw the exception, otherwise it is OK as we are simply reinstalling the plugin if(!Zend_Registry::get('db')->isErrNo($e, '1060')) @@ -49,7 +43,7 @@ class Piwik_ExampleFeedburner extends Piwik_Plugin function uninstall() { - Piwik_Query('ALTER TABLE '.Piwik_Common::prefixTable('site'). " DROP `feedburnerName`"); + Piwik_Query('ALTER TABLE '.Piwik::prefixTable('site'). " DROP `feedburnerName`"); } } @@ -70,7 +64,7 @@ class Piwik_ExampleFeedburner_Controller extends Piwik_Controller { $view = Piwik_View::factory('feedburner'); $idSite = Piwik_Common::getRequestVar('idSite',1,'int'); - $feedburnerFeedName = Piwik_FetchOne('SELECT feedburnerName FROM '.Piwik_Common::prefixTable('site'). + $feedburnerFeedName = Piwik_FetchOne('SELECT feedburnerName FROM '.Piwik::prefixTable('site'). ' WHERE idsite = ?', $idSite ); if(empty($feedburnerFeedName)) { @@ -78,63 +72,9 @@ class Piwik_ExampleFeedburner_Controller extends Piwik_Controller } $view->feedburnerFeedName = $feedburnerFeedName; $view->idSite = $idSite; - $view->fbStats = $this->getFeedData($feedburnerFeedName); echo $view->render(); } - - /** - * Returns array of counts and images based on Feedburner URI - * - * @param string $uri - * @return array() - */ - protected function getFeedData($uri) - { - // Awareness API only supports yesterday and back; - // we get stats for previous two days; - // @see http://code.google.com/apis/feedburner/awareness_api.html#dates - $yesterday = Piwik_Date::factory('-1 day', 'America/Los_Angeles'); - $beforeYesterday = Piwik_Date::factory('-2 day', 'America/Los_Angeles'); - - //create url to gather XML feed from - $url = 'https://feedburner.google.com/api/awareness/1.0/GetFeedData?uri='.$uri.'&dates='.$beforeYesterday->toString().','.$yesterday->toString(); - $data = ''; - try { - $data = Piwik_Http::sendHttpRequest($url, 5); - $xml = new SimpleXMLElement($data); - } catch(Exception $e) { - return "Error parsing the data for feed $uri. Fetched data was: \n'". $data."'"; - } - - if(count($xml->feed->entry) != 2) { - return "Error fetching the Feedburner stats. Expected XML, Got: \n" . strip_tags($data); - } - $data = array(); - $i = 0; - foreach($xml->feed->entry as $feedDay){ - $data[0][$i] = (int)$feedDay['circulation']; - $data[1][$i] = (int)$feedDay['hits']; - $data[2][$i] = (int)$feedDay['reach']; - $i++; - } - - foreach($data as $key => $value) { - if( $value[0] == $value[1]) { - $img = 'stop.png'; - } else if($value[0] < $value[1]) { - $img = 'arrow_up.png'; - } else { - $img = 'arrow_down.png'; - } - - $prefixImage = '<img alt="" src="./plugins/MultiSites/images/'; - $suffixImage = '" />'; - $data[$key][2] = $prefixImage . $img . $suffixImage; - } - return $data; - } - /** * Function called to save the Feedburner ID entered in the form * @@ -144,7 +84,7 @@ class Piwik_ExampleFeedburner_Controller extends Piwik_Controller // we save the value in the DB for an authenticated user if(Piwik::getCurrentUserLogin() != 'anonymous') { - Piwik_Query('UPDATE '.Piwik_Common::prefixTable('site').' + Piwik_Query('UPDATE '.Piwik::prefixTable('site').' SET feedburnerName = ? WHERE idsite = ?', array(Piwik_Common::getRequestVar('name','','string'), Piwik_Common::getRequestVar('idSite',1,'int')) ); diff --git a/plugins/ExampleFeedburner/templates/feedburner.tpl b/plugins/ExampleFeedburner/templates/feedburner.tpl index 812dcdc23e..e0cb2e6747 100644 --- a/plugins/ExampleFeedburner/templates/feedburner.tpl +++ b/plugins/ExampleFeedburner/templates/feedburner.tpl @@ -1,57 +1,37 @@ <script type="text/javascript"> var idSite = {$idSite}; + {literal} $(document).ready(function(){ + function getName() { return $("#feedburnerName").val(); } + function loadIframe() + { + var feedburnerName = getName(); + $("#feedburnerIframe").html( + '<iframe height=100px frameborder="0" marginheight="10" marginwidth="10" \ + src="http://www.feedburner.com/fb/ticker/api-ticker2.jsp?uris='+feedburnerName+'"></iframe>'); + } + $("#feedburnerSubmit").click( function(){ var feedburnerName = getName(); - $.get('?module=ExampleFeedburner&action=saveFeedburnerName&idSite='+idSite+'&name='+feedburnerName); - piwik.dashboardObject.reloadEnclosingWidget($(this)); + $.get('index.php?module=ExampleFeedburner&action=saveFeedburnerName&idSite='+idSite+'&name='+feedburnerName); + loadIframe(); + }); + + loadIframe(); }); </script> -<style> -.metric { font-weight:bold;text-align:left; } -.feedburner td { padding:0px 3px; } -</style> -{/literal} - -{if !is_array($fbStats)} - {$fbStats} -{else} -<table class='feedburner' align="center" cellpadding="2" style='text-align:center'> - <tr> - <td></td> - <td style="text-decoration:underline;">Previous</td> - <td style="text-decoration:underline;">Yesterday</td> - <td></td> - </tr> - <tr> - <td class='metric'>Circulation</td> - <td>{$fbStats[0][0]}</td> - <td>{$fbStats[0][1]}</td> - <td>{$fbStats[0][2]}</td> - </tr> - <tr> - <td class='metric'>Hits</td> - <td>{$fbStats[1][0]}</td> - <td>{$fbStats[1][1]}</td> - <td>{$fbStats[1][2]}</td> - </tr> - <tr> - <td class='metric'>Reach</td> - <td>{$fbStats[2][0]}</td> - <td>{$fbStats[2][1]}</td> - <td>{$fbStats[2][2]}</td> - </tr> -</table> -{/if} +{/literal} +<span id="feedburnerIframe"></span> <center> -<input id="feedburnerName" type="text" value="{$feedburnerFeedName}" /> -<input id="feedburnerSubmit" type="submit" value="ok" /> +<input id="feedburnerName" type="text" value="{$feedburnerFeedName}"> +<input id="feedburnerSubmit" type="submit" value="ok"> </center> + diff --git a/plugins/ExamplePlugin/ExamplePlugin.php b/plugins/ExamplePlugin/ExamplePlugin.php index e0a500d617..3891cc54fd 100644 --- a/plugins/ExamplePlugin/ExamplePlugin.php +++ b/plugins/ExamplePlugin/ExamplePlugin.php @@ -16,19 +16,13 @@ */ class Piwik_ExamplePlugin extends Piwik_Plugin { - /** - * Return information about this plugin. - * - * @see Piwik_Plugin - * - * @return array - */ public function getInformation() { return array( - 'description' => Piwik_Translate('ExamplePlugin_PluginDescription'), + 'name' => 'Example Plugin', + 'description' => 'Example Plugin: This plugin shows how to create a very simple plugin, that exports two widgets in the Dashboard.', 'author' => 'Piwik', - 'author_homepage' => 'http://piwik.org/', + 'homepage' => 'http://piwik.org/', 'version' => '0.1', 'translationAvailable' => true, ); @@ -85,9 +79,9 @@ class Piwik_ExamplePlugin_Controller extends Piwik_Controller */ function exampleWidget() { - echo "Hello world! <br /> You can output whatever you want in widgets, and put them on dashboard or everywhere on the web (in your blog, website, etc.). - <br />Widgets can include graphs, tables, flash, text, images, etc. - <br />It's very easy to create a new plugin and widgets in Piwik. Have a look at this example file (/plugins/ExamplePlugin/ExamplePlugin.php). + echo "Hello world! <br> You can output whatever you want in widgets, and put them on dashboard or everywhere on the web (in your blog, website, etc.). + <br>Widgets can include graphs, tables, flash, text, images, etc. + <br>It's very easy to create a new plugin and widgets in Piwik. Have a look at this example file (/plugins/ExamplePlugin/ExamplePlugin.php). <div id='happycoding'><i>Happy coding!</i></div> <div id='jsenabled'>You can easily use Jquery in widgets</div> <script type=\"text/javascript\">$('#happycoding').hide().fadeIn(5000);$('#jsenabled').hide().css({'color':'red'}).fadeIn(10000);</script>"; @@ -103,7 +97,7 @@ class Piwik_ExamplePlugin_Controller extends Piwik_Controller function photostreamMatt() { - echo '<iframe align=center src=http://www.flickr.com/slideShow/index.gne?user_id=34965144@N00&set_id=72157602308487455 frameBorder=0 width=380 scrolling=no height=500></iframe> '; + echo '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" type="application/x-shockwave-flash" width="400px" height="343px" id="InsertWidget_35ba729b-1935-4165-a818-f17e7c9b4748" align="middle"><param name="movie" value="http://widgetserver.com/syndication/flash/wrapper/InsertWidget.swf"/><param name="quality" value="high" /><param name="wmode" value="transparent" /><param name="menu" value="false" /><param name="flashvars" value="r=2&appId=35ba729b-1935-4165-a818-f17e7c9b4748" /> <embed src="http://widgetserver.com/syndication/flash/wrapper/InsertWidget.swf" name="InsertWidget_35ba729b-1935-4165-a818-f17e7c9b4748" width="400px" height="343px" quality="high" menu="false" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" wmode="transparent" align="middle" flashvars="r=2&appId=35ba729b-1935-4165-a818-f17e7c9b4748" /></object>'; } /** @@ -114,71 +108,57 @@ class Piwik_ExamplePlugin_Controller extends Piwik_Controller function index() { $out = ''; - $out .= '<i>This page aims to list the different functions you can use when programming plugins for Piwik.</i><br />'; - $out .= '<b>Be careful, the following APIs may change in the near future as Piwik is still in development.</b><br />'; + $out .= '<i>This page aims to list the different functions you can use when programming plugins for Piwik.</i><br>'; + $out .= '<b>Be careful, the following APIs may change in the near future as Piwik is still in development.</b><br>'; $out .= '<h2>General</h2>'; $out .= '<h3>Accessible from your plugin controller</h3>'; - $out .= '<code>$this->date</code> = current selected <b>Piwik_Date</b> object (<a href="http://dev.piwik.org/trac/browser/trunk/core/Date.php">class</a>)<br />'; - $out .= '<code>$period = Piwik_Common::getRequestVar("period");</code> - Get the current selected period<br />'; - $out .= '<code>$idSite = Piwik_Common::getRequestVar("idSite");</code> - Get the selected idSite<br />'; - $out .= '<code>$site = new Piwik_Site($idSite);</code> - Build the Piwik_Site object (<a href="http://dev.piwik.org/trac/browser/trunk/core/Site.php">class</a>)<br />'; - $out .= '<code>$this->str_date</code> = current selected date in YYYY-MM-DD format<br />'; + $out .= '<code>$this->date</code> = current selected <b>Piwik_Date</b> object (<a href="http://dev.piwik.org/trac/browser/trunk/core/Date.php">class</a>)<br/>'; + $out .= '<code>$period = Piwik_Common::getRequestVar("period");</code> - Get the current selected period<br/>'; + $out .= '<code>$idSite = Piwik_Common::getRequestVar("idSite");</code> - Get the selected idSite<br/>'; + $out .= '<code>$site = new Piwik_Site($idSite);</code> - Build the Piwik_Site object (<a href="http://dev.piwik.org/trac/browser/trunk/core/Site.php">class</a>)<br/>'; + $out .= '<code>$this->str_date</code> = current selected date in YYYY-MM-DD format<br/>'; $out .= '<h3>Misc</h3>'; - $out .= '<code>Piwik_AddMenu( $mainMenuName, $subMenuName, $url );</code> - Adds an entry to the menu in the Piwik interface (See the example in the <a href="http://dev.piwik.org/trac/browser/trunk/plugins/UserCountry/UserCountry.php#L146">UserCountry Plugin file</a>)<br />'; - $out .= '<code>Piwik_AddWidget( $widgetCategory, $widgetName, $controllerName, $controllerAction, $customParameters = array());</code> - Adds a widget that users can add in the dashboard, or export using the Widgets link at the top of the screen. See the example in the <a href="http://dev.piwik.org/trac/browser/trunk/plugins/UserCountry/UserCountry.php#L143">UserCountry Plugin file</a> or any other plugin)<br />'; - $out .= '<code>Piwik_Common::prefixTable("site")</code> = <b>' . Piwik_Common::prefixTable("site") . '</b><br />'; + $out .= '<code>Piwik_AddMenu( $mainMenuName, $subMenuName, $url );</code> - Adds an entry to the menu in the Piwik interface (See the example in the <a href="http://dev.piwik.org/trac/browser/trunk/plugins/UserCountry/UserCountry.php#L146">UserCountry Plugin file</a>)<br/>'; + $out .= '<code>Piwik_AddWidget( $widgetCategory, $widgetName, $controllerName, $controllerAction, $customParameters = array());</code> - Adds a widget that users can add in the dashboard, or export using the Widgets link at the top of the screen. See the example in the <a href="http://dev.piwik.org/trac/browser/trunk/plugins/UserCountry/UserCountry.php#L143">UserCountry Plugin file</a> or any other plugin)<br/>'; + $out .= '<code>Piwik::prefixTable("site")</code> = <b>' . Piwik::prefixTable("site") . '</b><br/>'; $out .= '<h2>User access</h2>'; - $out .= '<code>Piwik::getCurrentUserLogin()</code> = <b>' . Piwik::getCurrentUserLogin() . '</b><br />'; - $out .= '<code>Piwik::isUserHasSomeAdminAccess()</code> = <b>' . self::boolToString(Piwik::isUserHasSomeAdminAccess()) . '</b><br />'; - $out .= '<code>Piwik::isUserHasAdminAccess( array $idSites = array(1,2) )</code> = <b>' . self::boolToString(Piwik::isUserHasAdminAccess(array(1,2) )) . '</b><br />'; - $out .= '<code>Piwik::isUserHasViewAccess( array $idSites = array(1) ) </code> = <b>' . self::boolToString(Piwik::isUserHasViewAccess(array(1))) . '</b><br />'; - $out .= '<code>Piwik::isUserIsSuperUser()</code> = <b>' . self::boolToString(Piwik::isUserIsSuperUser()) . '</b><br />'; + $out .= '<code>Piwik::getCurrentUserLogin()</code> = <b>' . Piwik::getCurrentUserLogin() . '</b><br/>'; + $out .= '<code>Piwik::isUserHasSomeAdminAccess()</code> = <b>' . self::boolToString(Piwik::isUserHasSomeAdminAccess()) . '</b><br/>'; + $out .= '<code>Piwik::isUserHasAdminAccess( array $idSites = array(1,2) )</code> = <b>' . self::boolToString(Piwik::isUserHasAdminAccess(array(1,2) )) . '</b><br/>'; + $out .= '<code>Piwik::isUserHasViewAccess( array $idSites = array(1) ) </code> = <b>' . self::boolToString(Piwik::isUserHasViewAccess(array(1))) . '</b><br/>'; + $out .= '<code>Piwik::isUserIsSuperUser()</code> = <b>' . self::boolToString(Piwik::isUserIsSuperUser()) . '</b><br/>'; $out .= '<h2>Execute SQL queries</h2>'; - $txtQuery = "SELECT token_auth FROM ".Piwik_Common::prefixTable('user')." WHERE login = ?"; + $txtQuery = "SELECT token_auth FROM ".Piwik::prefixTable('user')." WHERE login = ?"; $result = Piwik_FetchOne($txtQuery, array('anonymous')); - $out .= '<code>Piwik_FetchOne("'.$txtQuery.'", array("anonymous"))</code> = <b>' . var_export($result,true) . '</b><br />'; - $out .= '<br />'; + $out .= '<code>Piwik_FetchOne("'.$txtQuery.'", array("anonymous"))</code> = <b>' . var_export($result,true) . '</b><br/>'; + $out .= '<br>'; $query = Piwik_Query($txtQuery, array('anonymous')); $fetched = $query->fetch(); $token_auth = $fetched['token_auth']; - $out .= '<code>$query = Piwik_Query("'.$txtQuery.'", array("anonymous"))</code><br />'; - $out .= '<code>$fetched = $query->fetch();</code><br />'; - $out .= 'At this point, we have: <code>$fetched[\'token_auth\'] == <b>'.var_export($token_auth,true) . '</b></code><br />'; + $out .= '<code>$query = Piwik_Query("'.$txtQuery.'", array("anonymous"))</code><br>'; + $out .= '<code>$fetched = $query->fetch();</code><br>'; + $out .= 'At this point, we have: <code>$fetched[\'token_auth\'] == <b>'.var_export($token_auth,true) . '</b></code><br/>'; $out .= '<h2>Example Sites information API</h2>'; - $out .= '<code>Piwik_SitesManager_API::getInstance()->getSitesWithViewAccess()</code> = <b><pre>' .var_export(Piwik_SitesManager_API::getInstance()->getSitesWithViewAccess(),true) . '</pre></b><br />'; - $out .= '<code>Piwik_SitesManager_API::getInstance()->getSitesWithAdminAccess()</code> = <b><pre>' .var_export(Piwik_SitesManager_API::getInstance()->getSitesWithAdminAccess(),true) . '</pre></b><br />'; + $out .= '<code>Piwik_SitesManager_API::getSitesWithViewAccess()</code> = <b><pre>' .var_export(Piwik_SitesManager_API::getSitesWithViewAccess(),true) . '</pre></b><br/>'; + $out .= '<code>Piwik_SitesManager_API::getSitesWithAdminAccess()</code> = <b><pre>' .var_export(Piwik_SitesManager_API::getSitesWithAdminAccess(),true) . '</pre></b><br/>'; $out .= '<h2>Example API Users information</h2>'; - $out .= 'View the list of API methods you can call on <a href="http://dev.piwik.org/trac/wiki/API/Reference#Methods">API reference</a><br />'; - $out .= 'For example you can try <code>Piwik_UsersManager_API::getInstance()->getUsersSitesFromAccess("view");</code> or <code>Piwik_UsersManager_API::getInstance()->deleteUser("userToDelete");</code><br />'; - - $out .= '<h2>Javascript in Piwik</h2>'; - $out .= '<h3>i18n internationalization</h3>'; - $out .= 'In order to translate strings within Javascript code, you can use the javascript function _pk_translate( token );. - <ul><li>The "token" parameter is the string unique key found in the translation file. For this token string to be available in Javascript, you must - suffix your token by "_js" in the language file. For example, you can add <code>\'Goals_AddGoal_js\' => \'Add Goal\',</code> in the lang/en.php file</li> - <li>You then need to instruct Piwik to load your Javascript translations for your plugin; by default, all translation strings are not loaded in Javascript for performance reasons. This can be done by calling the Smarty modifier before any your javascript includes that would be using the translations, eg. - <code>{loadJavascriptTranslations plugins=\'$YOUR_PLUGIN_NAME\'}</code>. In our previous example, the $YOUR_PLUGIN_NAME being Goals, we would write <code>{loadJavascriptTranslations plugins=\'Goals\'}</code> - </li><li>You can then print this string from your JS code by doing <code>_pk_translate(\'Goals_AddGoal_js\');</code>. - </li></ul>'; - - $out .= '<h3>Reload a widget in the dashboard</h3>'; - $out .= 'It is sometimes useful to reload one widget in the dashboard (for example, every 20 seconds for a real time widget, or after a setting change). - You can easily force your widget to reload in the dashboard by calling the helper function <code>piwik.dashboardObject.reloadEnclosingWidget($(this));</code>.'; + $out .= 'View the list of API methods you can call on <a href="http://dev.piwik.org/trac/wiki/API/Reference#Methods">API reference</a><br/>'; + $out .= 'For example you can try <code>Piwik_UsersManager_API::getUsersSitesFromAccess("view");</code> or <code>Piwik_UsersManager_API::deleteUser("userToDelete");</code><br/>'; $out .= '<h2>Smarty plugins</h2>'; - $out .= 'There are some builtin plugins for Smarty especially developped for Piwik. <br /> - You can find them on the <a href="http://dev.piwik.org/trac/browser/trunk/core/SmartyPlugins">SVN at /trunk/core/SmartyPlugins</a>. <br /> - More documentation to come about smarty plugins.<br />'; + $out .= 'There are some builtin plugins for Smarty especially developped for Piwik. <br> + You can find them on the <a href="http://dev.piwik.org/trac/browser/trunk/core/SmartyPlugins">SVN at /trunk/core/SmartyPlugins</a>. <br> + More documentation to come about smarty plugins.<br/>'; echo $out; } diff --git a/plugins/ExamplePlugin/lang/en.php b/plugins/ExamplePlugin/lang/en.php index 9d2ee29350..9fcf727fd0 100644 --- a/plugins/ExamplePlugin/lang/en.php +++ b/plugins/ExamplePlugin/lang/en.php @@ -11,7 +11,6 @@ */ $translations = array( - 'ExamplePlugin_PluginDescription' => 'Example Plugin: This plugin shows how to create a very simple plugin, that exports two widgets in the Dashboard.', 'ExamplePlugin_exampleWidgets' => 'Example Widgets', 'ExamplePlugin_exampleWidget' => 'Example widget', 'ExamplePlugin_blogPiwikRss' => 'Blog Piwik RSS', diff --git a/plugins/ExampleRssWidget/ExampleRssWidget.php b/plugins/ExampleRssWidget/ExampleRssWidget.php index f36f850e7e..7c583cefa3 100644 --- a/plugins/ExampleRssWidget/ExampleRssWidget.php +++ b/plugins/ExampleRssWidget/ExampleRssWidget.php @@ -16,19 +16,13 @@ */ class Piwik_ExampleRssWidget extends Piwik_Plugin { - /** - * Return information about this plugin. - * - * @see Piwik_Plugin - * - * @return array - */ public function getInformation() { return array( - 'description' => Piwik_Translate('ExampleRssWidget_PluginDescription'), + 'name' => 'Example Rss Widget', + 'description' => 'Example Plugin: How to create a new widget that reads a RSS feed?', 'author' => 'Piwik', - 'author_homepage' => 'http://piwik.org/', + 'homepage' => 'http://piwik.org/', 'version' => '0.1', ); } diff --git a/plugins/ExampleUI/API.php b/plugins/ExampleUI/API.php index 8d741a8c2b..1a606d0f16 100644 --- a/plugins/ExampleUI/API.php +++ b/plugins/ExampleUI/API.php @@ -26,11 +26,11 @@ class Piwik_ExampleUI_API return self::$instance; } - public function getTemperaturesEvolution($date, $period) + function getTemperaturesEvolution($date, $period) { $period = new Piwik_Period_Range($period, 'last30'); - $dateStart = $period->getDateStart()->toString('Y-m-d'); // eg. "2009-04-01" - $dateEnd = $period->getDateEnd()->toString('Y-m-d'); // eg. "2009-04-30" + $dateStart = $period->getDateStart()->get('Y-m-d'); // eg. "2009-04-01" + $dateEnd = $period->getDateEnd()->get('Y-m-d'); // eg. "2009-04-30" // here you could select from your custom table in the database, eg. $query = "SELECT AVG(temperature) @@ -56,7 +56,7 @@ class Piwik_ExampleUI_API } // we generate an array of random server temperatures - public function getTemperatures() + function getTemperatures() { $xAxis = array( '0h', '1h', '2h', '3h', '4h', '5h', '6h', '7h', '8h', '9h', '10h', '11h', @@ -75,7 +75,7 @@ class Piwik_ExampleUI_API return $dataTable; } - public function getPlanetRatios() + function getPlanetRatios() { $planetRatios = array( 'Mercury' => 0.382, @@ -93,7 +93,7 @@ class Piwik_ExampleUI_API return $dataTable; } - public function getPlanetRatiosWithLogos() + function getPlanetRatiosWithLogos() { $planetsDataTable = $this->getPlanetRatios(); foreach($planetsDataTable->getRows() as $row) diff --git a/plugins/ExampleUI/Controller.php b/plugins/ExampleUI/Controller.php index 3fe44d43ef..a1066a6abe 100644 --- a/plugins/ExampleUI/Controller.php +++ b/plugins/ExampleUI/Controller.php @@ -77,11 +77,11 @@ class Piwik_ExampleUI_Controller extends Piwik_Controller echo "<h2>Simple tag cloud</h2>"; $this->echoSimpleTagClouds(); - echo "<br /><br /><h2>Advanced tag cloud: with logos and links</h2> + echo "<br/><br/><h2>Advanced tag cloud: with logos and links</h2> <ul style='list-style-type:disc;margin-left:50px'> <li>The logo size is proportional to the value returned by the API</li> <li>The logo is linked to a specific URL</li> - </ul><br /><br />"; + </ul><br/><br/>"; $this->echoAdvancedTagClouds(); } function echoSimpleTagClouds() diff --git a/plugins/ExampleUI/ExampleUI.php b/plugins/ExampleUI/ExampleUI.php index 9f365fb367..fd5caf430f 100644 --- a/plugins/ExampleUI/ExampleUI.php +++ b/plugins/ExampleUI/ExampleUI.php @@ -26,19 +26,13 @@ */ class Piwik_ExampleUI extends Piwik_Plugin { - /** - * Return information about this plugin. - * - * @see Piwik_Plugin - * - * @return array - */ public function getInformation() { return array( - 'description' => Piwik_Translate('ExampleUI_PluginDescription'), + 'name' => 'Example User Interface', + 'description' => 'Example Plugin: This plugin shows how to work with the Piwik UI: create tables, graphs, etc.', 'author' => 'Piwik', - 'author_homepage' => 'http://piwik.org/', + 'homepage' => 'http://piwik.org/', 'version' => '0.1', ); } diff --git a/plugins/ExampleUI/images/icons-planet/LICENSE b/plugins/ExampleUI/images/icons-planet/LICENSE index cbaa1f23ed..229295935c 100644 --- a/plugins/ExampleUI/images/icons-planet/LICENSE +++ b/plugins/ExampleUI/images/icons-planet/LICENSE @@ -1,3 +1,3 @@ -Author : Dan Wiersema -License: Free for non-commercial use. +Author : Dan Wiersema
+License: Free for non-commercial use.
http://www.iconspedia.com/icon/neptune-4672.html
\ No newline at end of file diff --git a/plugins/Feedback/Controller.php b/plugins/Feedback/Controller.php index a626e71989..7060f72816 100644 --- a/plugins/Feedback/Controller.php +++ b/plugins/Feedback/Controller.php @@ -1,11 +1,11 @@ <?php /** * Piwik - Open source web analytics - * + * * @link http://piwik.org * @license http://www.gnu.org/licenses/gpl-3.0.html Gpl v3 or later * @version $Id$ - * + * * @category Piwik_Plugins * @package Piwik_Feedback */ @@ -15,11 +15,10 @@ * @package Piwik_Feedback */ class Piwik_Feedback_Controller extends Piwik_Controller -{ +{ function index() - { + { $view = Piwik_View::factory('index'); - $view->nonce = Piwik_Nonce::getNonce('Piwik_Feedback.sendFeedback', 3600); echo $view->render(); } @@ -28,18 +27,16 @@ class Piwik_Feedback_Controller extends Piwik_Controller */ function sendFeedback() { - $email = Piwik_Common::getRequestVar('email', '', 'string'); $body = Piwik_Common::getRequestVar('body', '', 'string'); - $category = Piwik_Common::getRequestVar('category', '', 'string'); - $nonce = Piwik_Common::getRequestVar('nonce', '', 'string'); + $email = Piwik_Common::getRequestVar('email', '', 'string'); $view = Piwik_View::factory('sent'); - try + try { $minimumBodyLength = 35; if(strlen($body) < $minimumBodyLength) { - throw new Exception(Piwik_TranslateException('Feedback_ExceptionBodyLength', array($minimumBodyLength))); + throw new Exception(sprintf("Message must be at least %s characters long.", $minimumBodyLength)); } if(!Piwik::isValidEmailString($email)) { @@ -47,21 +44,14 @@ class Piwik_Feedback_Controller extends Piwik_Controller } if(strpos($body, 'http://') !== false) { - throw new Exception(Piwik_TranslateException('Feedback_ExceptionNoUrls')); + throw new Exception("The message cannot contain a URL, to avoid spams messages."); } - if(!Piwik_Nonce::verifyNonce('Piwik_Feedback.sendFeedback', $nonce)) - { - throw new Exception(Piwik_TranslateException('General_ExceptionNonceMismatch')); - } - + $mail = new Piwik_Mail(); - $mail->setFrom(Piwik_Common::unsanitizeInputValue($email)); - $mail->addTo('hello@piwik.org', 'Piwik Team'); - $mail->setSubject('[ Feedback form - Piwik ] ' . $category); - $mail->setBodyText(Piwik_Common::unsanitizeInputValue($body) . "\n" - . 'Piwik ' . Piwik_Version::VERSION . "\n" - . 'IP: ' . Piwik_Common::getIpString() . "\n" - . 'URL: ' . Piwik_Url::getReferer() . "\n"); + $mail->setFrom($email); + $mail->addTo('hello@piwik.org','Piwik Team'); + $mail->setSubject('[ Feedback form - Piwik ]'); + $mail->setBodyText($body); @$mail->send(); } catch(Exception $e) @@ -69,7 +59,7 @@ class Piwik_Feedback_Controller extends Piwik_Controller $view->ErrorString = $e->getMessage(); $view->message = $body; } - + echo $view->render(); } } diff --git a/plugins/Feedback/Feedback.php b/plugins/Feedback/Feedback.php index 5cbd0afdf2..895d99462d 100644 --- a/plugins/Feedback/Feedback.php +++ b/plugins/Feedback/Feedback.php @@ -1,11 +1,11 @@ <?php /** * Piwik - Open source web analytics - * + * * @link http://piwik.org * @license http://www.gnu.org/licenses/gpl-3.0.html Gpl v3 or later * @version $Id$ - * + * * @category Piwik_Plugins * @package Piwik_Feedback */ @@ -19,28 +19,11 @@ class Piwik_Feedback extends Piwik_Plugin public function getInformation() { return array( - 'description' => Piwik_Translate('Feedback_PluginDescription'), + 'name' => 'Feedback', + 'description' => 'Send your Feedback to the Piwik Team in one click. Share your ideas and suggestions with us!', 'author' => 'Piwik', - 'author_homepage' => 'http://piwik.org/', - 'version' => Piwik_Version::VERSION, - ); - } - - function getListHooksRegistered() - { - return array( - 'template_css_import' => 'css', - 'template_js_import' => 'js', + 'homepage' => 'http://piwik.org/', + 'version' => '0.1', ); } - - function css() - { - echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"plugins/Feedback/templates/styles.css\" />\n"; - } - - function js() - { - echo "<script type=\"text/javascript\" src=\"plugins/Feedback/templates/feedback.js\"></script>\n"; - } } diff --git a/plugins/Feedback/images/go-previous.png b/plugins/Feedback/images/go-previous.png Binary files differdeleted file mode 100644 index c37bc0414c..0000000000 --- a/plugins/Feedback/images/go-previous.png +++ /dev/null diff --git a/plugins/Feedback/templates/feedback.js b/plugins/Feedback/templates/feedback.js deleted file mode 100644 index adaaa45448..0000000000 --- a/plugins/Feedback/templates/feedback.js +++ /dev/null @@ -1,28 +0,0 @@ -$(function() { - var feedback = $('a#topbar-feedback'); - if (feedback.size()) { - var fbDiv = $('<div id="feedback-dialog"></div>').appendTo('body'); - - $.get(feedback.attr('href'), function(data) { - fbDiv.html(data); - }); - - fbDiv.dialog({ - title: feedback.html(), - bgiframe: true, - modal: true, - height: 480, - width: 500, - resizable: false, - autoOpen: false - }); - - $('#topbar-feedback').click(function() { - $('#feedback-faq').show(); - $('#feedback-form').hide(); - $('#feedback-sent').hide().empty(); - fbDiv.dialog('open'); - return false; - }); - } -}); diff --git a/plugins/Feedback/templates/index.tpl b/plugins/Feedback/templates/index.tpl index 02f553c177..aec45f58ce 100644 --- a/plugins/Feedback/templates/index.tpl +++ b/plugins/Feedback/templates/index.tpl @@ -1,63 +1,24 @@ {literal} -<script type="text/javascript"> -$(function() { - $('#feedback-contact').click(function() { - $('#feedback-faq').hide(); - $('#feedback-form').show(); - return false; - }); +<style> +input, textarea, p { + font-family: Georgia,"Trebuchet MS", Verdana, Arial, Helvetica, sans-serif; + font-size:0.9em; + padding:0.2em; +} +input { + margin-top:0.8em; +} +</style> +{/literal} - $('#feedback-home').click(function() { - $('#feedback-form').hide(); - $('#feedback-faq').show(); - return false; - }); +<form method="post" action="index.php?module=Feedback&action=sendFeedback"> - $('#feedback-form-submit').click(function() { - var feedback = $('#feedback-form form'); - $('#feedback-form').hide(); - $.post(feedback.attr('action'), feedback.serialize(), function (data) { - $('#feedback-sent').show().html(data); - }); - return false; - }); -}); -</script> -{/literal} +<p><strong>your email :</strong> +<br /><input type="text" name="email" size="40" /></p> - <div id="feedback-faq"> - <p><strong>{'Feedback_DoYouHaveBugReportOrFeatureRequest'|translate}</strong></p> - <p>» {'Feedback_ViewAnswersToFAQ'|translate:"<a target='_blank' href='misc/redirectToUrl.php?url=http://piwik.org/faq/'>":"</a>"}.</p> - <ul> - <li>{'Feedback_WhyAreMyVisitsNoTracked'|translate}</li> - <li>{'Feedback_HowToExclude'|translate}</li> - <li>{'Feedback_WhyWrongCountry'|translate}</li> - <li>{'Feedback_HowToAnonymizeIP'|translate}</li> - </ul> - <p>» {'Feedback_VisitTheForums'|translate:"<a target='_blank' href='misc/redirectToUrl.php?url=http://forum.piwik.org/'>":"</a>"}.</p> - <p>» {'Feedback_LearnWaysToParticipate'|translate:"<a target='_blank' href='misc/redirectToUrl.php?url=http://piwik.org/contribute/'>":"</a>"}.</p> - <br /> - <p><strong>{'Feedback_SpecialRequest'|translate}</strong></p> - <p>» <a target='_blank' href="#" id="feedback-contact">{'Feedback_ContactThePiwikTeam'|translate}</a></p> - </div> - <div id="feedback-form" style="display:none;"> - <form method="post" action="index.php?module=Feedback&action=sendFeedback"> - <p><strong>{'Feedback_IWantTo'|translate}</strong> - <select name="category"> - <option value="share">{'Feedback_CategoryShareStory'|translate}</option> - <option value="sponsor">{'Feedback_CategorySponsor'|translate}</option> - <option value="hire">{'Feedback_CategoryHire'|translate}</option> - <option value="security">{'Feedback_CategorySecurity'|translate}</option> - </select> - </p> - <p><strong>{'Feedback_MyEmailAddress'|translate}</strong><br /> - <input type="text" name="email" size="59" /> - <input type="hidden" name="nonce" value="{$nonce}" /></p> - <p><strong>{'Feedback_MyMessage'|translate}</strong> {'Feedback_DetailsPlease'|translate}<br /> - <textarea name="body" cols="57" rows="10"></textarea></p> - <p><input id="feedback-form-submit" type="submit" value="{'Feedback_SendFeedback'|translate}" /></p> - <p><a href="#" id="feedback-home"><img src="plugins/Feedback/images/go-previous.png" border="0" title="{'General_Previous'|translate}" alt="[{'General_Previous'|translate}]" /></a></p> - </form> - </div> - <div id="feedback-sent" style="display:none;"> - </div> +<p><strong>your feedback:</strong><br/> +<i>please be precise if you request for a feature or report a bug</i></p> +<textarea name="body" cols="37" rows="10"></textarea> +<br/> +<input type="submit" value="Send feedback" /> +</form> diff --git a/plugins/Feedback/templates/sent.tpl b/plugins/Feedback/templates/sent.tpl index 5ae4c1872a..65495497bf 100644 --- a/plugins/Feedback/templates/sent.tpl +++ b/plugins/Feedback/templates/sent.tpl @@ -1,20 +1,33 @@ {literal} -<script type="text/javascript"> - $('#feedback-retry').click(function() { - $('#feedback-sent').hide().empty(); - $('#feedback-form').show(); - return false; - }); -</script> +<style> +body { + font-family: Georgia,"Trebuchet MS", Verdana, Arial, Helvetica, sans-serif; + font-size:0.9em; + padding:0.2em; +} +#error { + color: red; + text-align: center; + border: 2px solid red; + background-color:#FFFBFB; + margin: 10px; + padding: 10px; +} +#success { + color: #38D73B; + text-align: center; + border: 2px solid red; + margin: 10px; + padding: 10px; +} +</style> {/literal} {if isset($ErrorString)} - <div id="feedback-error"><strong>{'General_Error'|translate}:</strong> {$ErrorString}</div> - <p>{'Feedback_ManuallySendEmailTo'|translate} <a href='mailto:hello@piwik.org?subject={'[Feedback form - Piwik]'|escape:"hex"}&body={$message|stripeol|escape:"hex"}'>hello@piwik.org</a></p> - <textarea cols="53" rows="10" readonly="readonly">{$message}</textarea> - <p><a href="#" id="feedback-retry"><img src="plugins/Feedback/images/go-previous.png" border="0" title="{'General_Previous'|translate}" alt="[{'General_Previous'|translate}]" /></a></p> + <div id="error"><strong>{'General_Error'|translate}:</strong> {$ErrorString}</div> + <p>Please manually send your message at <a href='mailto:hello@piwik.org'>hello@piwik.org</a></p> + <p>{$message}</p> {else} - <div id="feedback-success">{'Feedback_MessageSent'|translate}</div> - <p><strong>{'Feedback_ThankYou'|translate}</strong></p> - <p>-- {'Feedback_ThePiwikTeam'|translate}</p> + <div id="success">Your message was sent to Piwik.</div> + <p><strong>Thank you for your helping us making Piwik better!</strong><br /> The Piwik Team</p> {/if} diff --git a/plugins/Feedback/templates/styles.css b/plugins/Feedback/templates/styles.css deleted file mode 100644 index 8d95ab93db..0000000000 --- a/plugins/Feedback/templates/styles.css +++ /dev/null @@ -1,28 +0,0 @@ -#feedback-form input, #feedback-form textarea, #feedback-sent textarea, #feedback-form select, #feedback-faq p, #feedback-form p, #feedback-sent div, #feedback-sent p, #feedback-faq li { - font-family: "Trebuchet MS", Verdana, Arial, Helvetica, sans-serif; - font-size:0.9em; - padding:0.2em; -} -#feedback-faq ul { - list-style-type:disc; - list-style-position:inside; - padding-left:2.5em; -} -#feedback-faq, #feedback-form, #feedback-sent { - margin-right:1em; -} -#feedback-error { - color: red; - text-align: center; - border: 2px solid red; - background-color:#FFFBFB; - margin: 10px; - padding: 10px; -} -#feedback-success { - color: #38D73B; - text-align: center; - border: 2px solid #38D73B; - margin: 10px; - padding: 10px; -} diff --git a/plugins/Goals/API.php b/plugins/Goals/API.php index 6f00d96868..5ed95fd68b 100644 --- a/plugins/Goals/API.php +++ b/plugins/Goals/API.php @@ -27,7 +27,7 @@ class Piwik_Goals_API return self::$instance; } - public function getGoals( $idSite ) + static public function getGoals( $idSite ) { $goals = Piwik_FetchAll("SELECT * FROM ".Piwik_Common::prefixTable('goal')." @@ -53,16 +53,16 @@ class Piwik_Goals_API // save in db $db = Zend_Registry::get('db'); $idGoal = $db->fetchOne("SELECT max(idgoal) + 1 - FROM ".Piwik_Common::prefixTable('goal')." + FROM ".Piwik::prefixTable('goal')." WHERE idsite = ?", $idSite); if($idGoal == false) { $idGoal = 1; } - $this->checkPatternIsValid($patternType, $pattern); - $name = $this->checkName($name); - $pattern = $this->checkPattern($pattern); - $db->insert(Piwik_Common::prefixTable('goal'), + self::checkPatternIsValid($patternType, $pattern); + $name = self::checkName($name); + $pattern = self::checkPattern($pattern); + $db->insert(Piwik::prefixTable('goal'), array( 'idsite' => $idSite, 'idgoal' => $idGoal, @@ -81,10 +81,10 @@ class Piwik_Goals_API public function updateGoal( $idSite, $idGoal, $name, $matchAttribute, $pattern, $patternType, $caseSensitive, $revenue ) { Piwik::checkUserHasAdminAccess($idSite); - $name = $this->checkName($name); - $pattern = $this->checkPattern($pattern); - $this->checkPatternIsValid($patternType, $pattern); - Zend_Registry::get('db')->update( Piwik_Common::prefixTable('goal'), + $name = self::checkName($name); + $pattern = self::checkPattern($pattern); + self::checkPatternIsValid($patternType, $pattern); + Zend_Registry::get('db')->update( Piwik::prefixTable('goal'), array( 'name' => $name, 'match_attribute' => $matchAttribute, @@ -103,7 +103,8 @@ class Piwik_Goals_API if($patternType == 'exact' && substr($pattern, 0, 4) != 'http') { - throw new Exception(Piwik_TranslateException('Goals_ExceptionInvalidMatchingString', array("http:// or https://", "http://www.yourwebsite.com/newsletter/subscribed.html"))); + throw new Exception("If you choose 'exact match', the matching string must be a + URL starting with http:// or https://. For example, 'http://www.yourwebsite.com/newsletter/subscribed.html'."); } } @@ -120,12 +121,12 @@ class Piwik_Goals_API public function deleteGoal( $idSite, $idGoal ) { Piwik::checkUserHasAdminAccess($idSite); - Piwik_Query("UPDATE ".Piwik_Common::prefixTable('goal')." + Piwik_Query("UPDATE ".Piwik::prefixTable('goal')." SET deleted = 1 WHERE idsite = ? AND idgoal = ?", array($idSite, $idGoal)); - Piwik_Query("DELETE FROM ".Piwik_Common::prefixTable("log_conversion")." WHERE idgoal = ?", $idGoal); + Piwik_Query("DELETE FROM ".Piwik::prefixTable("log_conversion")." WHERE idgoal = ?", $idGoal); Piwik_Common::regenerateCacheWebsiteAttributes($idSite); } @@ -156,7 +157,7 @@ class Piwik_Goals_API $request = new Piwik_API_Request("method=VisitFrequency.getVisitsReturning&idSite=$idSite&period=$period&date=$date&format=original"); $nbVisitsReturning = $request->process(); // echo $nbVisitsConvertedReturningVisitors; -// echo "<br />". $nbVisitsReturning;exit; +// echo "<br>". $nbVisitsReturning;exit; return Piwik::getPercentageSafe($nbVisitsConvertedReturningVisitors, $nbVisitsReturning, Piwik_Goals::ROUNDING_PRECISION); } @@ -210,7 +211,7 @@ class Piwik_Goals_API return $dataTable; } - protected function getNumeric( $idSite, $period, $date, $toFetch ) + protected static function getNumeric( $idSite, $period, $date, $toFetch ) { Piwik::checkUserHasViewAccess( $idSite ); $archive = Piwik_Archive::build($idSite, $period, $date ); @@ -220,16 +221,16 @@ class Piwik_Goals_API public function getConversions( $idSite, $period, $date, $idGoal = false ) { - return $this->getNumeric( $idSite, $period, $date, Piwik_Goals::getRecordName('nb_conversions', $idGoal)); + return self::getNumeric( $idSite, $period, $date, Piwik_Goals::getRecordName('nb_conversions', $idGoal)); } public function getConversionRate( $idSite, $period, $date, $idGoal = false ) { - return $this->getNumeric( $idSite, $period, $date, Piwik_Goals::getRecordName('conversion_rate', $idGoal)); + return self::getNumeric( $idSite, $period, $date, Piwik_Goals::getRecordName('conversion_rate', $idGoal)); } public function getRevenue( $idSite, $period, $date, $idGoal = false ) { - return $this->getNumeric( $idSite, $period, $date, Piwik_Goals::getRecordName('revenue', $idGoal)); + return self::getNumeric( $idSite, $period, $date, Piwik_Goals::getRecordName('revenue', $idGoal)); } } diff --git a/plugins/Goals/Controller.php b/plugins/Goals/Controller.php index 032135c111..06d16b93b0 100644 --- a/plugins/Goals/Controller.php +++ b/plugins/Goals/Controller.php @@ -18,54 +18,33 @@ class Piwik_Goals_Controller extends Piwik_Controller { const CONVERSION_RATE_PRECISION = 1; - protected $goalColumnNameToLabel = array( - 'nb_conversions' => 'Goals_ColumnConversions', - 'conversion_rate'=> 'Goals_ColumnConversionRate', - 'revenue' => 'Goals_ColumnRevenue', - ); - - public function __construct() + function __construct() { parent::__construct(); $this->idSite = Piwik_Common::getRequestVar('idSite'); - $this->goals = Piwik_Goals_API::getInstance()->getGoals($this->idSite); + $this->goals = Piwik_Goals_API::getGoals($this->idSite); } - public function widgetGoalReport() - { - $view = $this->getGoalReportView(); - $view->displayFullReport = false; - echo $view->render(); - } - - public function goalReport() - { - $view = $this->getGoalReportView(); - $view->displayFullReport = true; - $view->goalSegments = $this->getAvailableGoalSegments(); - echo $view->render(); - } - - protected function getGoalReportView() + function goalReport() { $idGoal = Piwik_Common::getRequestVar('idGoal', null, 'int'); if(!isset($this->goals[$idGoal])) { - Piwik::redirectToModule('Goals', 'index', array('idGoal' => null)); + throw new Exception("idgoal $idGoal not valid."); } $goalDefinition = $this->goals[$idGoal]; $view = Piwik_View::factory('single_goal'); - $this->setGeneralVariablesView($view); + $view->currency = Piwik::getCurrency(); $goal = $this->getMetricsForGoal($idGoal); foreach($goal as $name => $value) { $view->$name = $value; } - $view->idGoal = $idGoal; - $view->goalName = $goalDefinition['name']; + $view->name = $goalDefinition['name']; + $view->title = $goalDefinition['name'] . ' - Conversions'; $view->graphEvolution = $this->getEvolutionGraph(true, array(Piwik_Goals::getRecordName('nb_conversions', $idGoal)), $idGoal); - $view->nameGraphEvolution = 'GoalsgetEvolutionGraph'.$idGoal; + $view->nameGraphEvolution = 'GoalsgetEvolutionGraph'; $view->topSegments = $this->getTopSegments($idGoal); // conversion rate for new and returning visitors @@ -73,31 +52,75 @@ class Piwik_Goals_Controller extends Piwik_Controller $view->conversion_rate_returning = round( $request->process(), self::CONVERSION_RATE_PRECISION ); $request = new Piwik_API_Request("method=Goals.getConversionRateNewVisitors&format=original"); $view->conversion_rate_new = round( $request->process(), self::CONVERSION_RATE_PRECISION ); - return $view; + + $verticalSlider = array(); + // string label + // array parameters to ajax call on click (module, action) + // specific order + // (intermediate labels) + // automatically load the first from the list, highlights it + $view->tableByConversion = Piwik_FrontController::getInstance()->fetchDispatch('Referers', 'getKeywords', array(false, 'tableGoals')); + echo $view->render(); } - public function index() + protected function getTopSegments($idGoal) { - $view = $this->getOverviewView(); - $view->goalsJSON = json_encode($this->goals); - $view->goalSegments = $this->getAvailableGoalSegments(); - $view->userCanEditGoals = Piwik::isUserHasAdminAccess($this->idSite); - $view->displayFullReport = true; - echo $view->render(); + $columnNbConversions = 'goal_'.$idGoal.'_nb_conversions'; + $columnConversionRate = 'goal_'.$idGoal.'_conversion_rate'; + + $topSegmentsToLoad = array( + 'country' => 'UserCountry.getCountry', + 'keyword' => 'Referers.getKeywords', + 'website' => 'Referers.getWebsites', + ); + + $topSegments = array(); + foreach($topSegmentsToLoad as $segmentName => $apiMethod) + { + $request = new Piwik_API_Request("method=$apiMethod + &format=original + &filter_update_columns_when_show_all_goals=1 + &filter_sort_order=desc + &filter_sort_column=$columnNbConversions + &filter_limit=3"); + $datatable = $request->process(); + $topSegment = array(); + foreach($datatable->getRows() as $row) + { + $topSegment[] = array ( + 'name' => $row->getColumn('label'), + 'nb_conversions' => $row->getColumn($columnNbConversions), + 'conversion_rate' => $row->getColumn($columnConversionRate), + 'metadata' => $row->getMetadata(), + ); + } + $topSegments[$segmentName] = $topSegment; + } + return $topSegments; } - public function widgetGoalsOverview( ) + protected function getMetricsForGoal($idGoal) { - $view = $this->getOverviewView(); - $view->displayFullReport = false; - echo $view->render(); + $request = new Piwik_API_Request("method=Goals.get&format=original&idGoal=$idGoal"); + $datatable = $request->process(); + $dataRow = $datatable->getFirstRow(); + return array ( + 'id' => $idGoal, + 'nb_conversions' => $dataRow->getColumn(Piwik_Goals::getRecordName('nb_conversions', $idGoal)), + 'conversion_rate' => round($dataRow->getColumn(Piwik_Goals::getRecordName('conversion_rate', $idGoal)), 1), + 'revenue' => $dataRow->getColumn(Piwik_Goals::getRecordName('revenue', $idGoal)), + 'urlSparklineConversions' => $this->getUrlSparkline('getEvolutionGraph', array('columns' => array(Piwik_Goals::getRecordName('nb_conversions', $idGoal)), 'idGoal' => $idGoal)), + 'urlSparklineConversionRate' => $this->getUrlSparkline('getEvolutionGraph', array('columns' => array(Piwik_Goals::getRecordName('conversion_rate', $idGoal)), 'idGoal' => $idGoal)), + 'urlSparklineRevenue' => $this->getUrlSparkline('getEvolutionGraph', array('columns' => array(Piwik_Goals::getRecordName('revenue', $idGoal)), 'idGoal' => $idGoal)), + ); } - protected function getOverviewView() + function index() { $view = Piwik_View::factory('overview'); - $this->setGeneralVariablesView($view); + $view->currency = Piwik::getCurrency(); + $view->title = 'All goals - evolution'; $view->graphEvolution = $this->getEvolutionGraph(true, array(Piwik_Goals::getRecordName('nb_conversions'))); $view->nameGraphEvolution = 'GoalsgetEvolutionGraph'; @@ -106,7 +129,7 @@ class Piwik_Goals_Controller extends Piwik_Controller $view->urlSparklineConversionRate = $this->getUrlSparkline('getEvolutionGraph', array('columns' => array(Piwik_Goals::getRecordName('conversion_rate')))); $view->urlSparklineRevenue = $this->getUrlSparkline('getEvolutionGraph', array('columns' => array(Piwik_Goals::getRecordName('revenue')))); - $request = new Piwik_API_Request("method=Goals.get&format=original&idGoal=0"); + $request = new Piwik_API_Request("method=Goals.get&format=original"); $datatable = $request->process(); $dataRow = $datatable->getFirstRow(); $view->nb_conversions = $dataRow->getColumn('Goal_nb_conversions'); @@ -122,36 +145,26 @@ class Piwik_Goals_Controller extends Piwik_Controller $view->goalMetrics = $goalMetrics; $view->goals = $this->goals; - return $view; - } - - public function getLastNbConversionsGraph( $fetch = false ) - { - $view = $this->getLastUnitGraph($this->pluginName, __FUNCTION__, 'Goals.getConversions'); - return $this->renderView($view, $fetch); - } - - public function getLastConversionRateGraph( $fetch = false ) - { - $view = $this->getLastUnitGraph($this->pluginName, __FUNCTION__, 'Goals.getConversionRate'); - return $this->renderView($view, $fetch); - } - - public function getLastRevenueGraph( $fetch = false ) - { - $view = $this->getLastUnitGraph($this->pluginName, __FUNCTION__, 'Goals.getRevenue'); - return $this->renderView($view, $fetch); + $view->goalsJSON = json_encode($this->goals); + $view->userCanEditGoals = Piwik::isUserHasAdminAccess($this->idSite); + echo $view->render(); } - public function addNewGoal() + function addNewGoal() { $view = Piwik_View::factory('add_new_goal'); - $this->setGeneralVariablesView($view); $view->userCanEditGoals = Piwik::isUserHasAdminAccess($this->idSite); + $view->currency = Piwik::getCurrency(); $view->onlyShowAddNewGoal = true; echo $view->render(); } + protected $goalColumnNameToLabel = array( + 'nb_conversions' => 'Goals_ColumnConversions', + 'conversion_rate'=> 'Goals_ColumnConversionRate', + 'revenue' => 'Goals_ColumnRevenue', + ); + public function getEvolutionGraph( $fetch = false, $columns = false, $idGoal = false) { if(empty($columns)) @@ -180,7 +193,7 @@ class Piwik_Goals_Controller extends Piwik_Controller if(!empty($idGoal) && isset($this->goals[$idGoal])) { $goalName = $this->goals[$idGoal]['name']; - $columnTranslation = "$columnTranslation (".Piwik_Translate('Goals_GoalX', "$goalName").")"; + $columnTranslation = "$columnTranslation (goal \"$goalName\")"; } $view->setColumnTranslation($columnName, $columnTranslation); } @@ -188,73 +201,21 @@ class Piwik_Goals_Controller extends Piwik_Controller return $this->renderView($view, $fetch); } - protected function getAvailableGoalSegments() + function getLastNbConversionsGraph( $fetch = false ) { - $segments = array(); - Piwik_PostEvent('Goals.getAvailableGoalSegments', $segments); - $segmentsByGroup = array(); - foreach($segments as $segment) - { - $group = $segment['group']; - unset($segment['group']); - $segmentsByGroup[$group][] = $segment; - } - return $segmentsByGroup; + $view = $this->getLastUnitGraph($this->pluginName, __FUNCTION__, 'Goals.getConversions'); + return $this->renderView($view, $fetch); } - protected function getTopSegments($idGoal) + function getLastConversionRateGraph( $fetch = false ) { - $columnNbConversions = 'goal_'.$idGoal.'_nb_conversions'; - $columnConversionRate = 'goal_'.$idGoal.'_conversion_rate'; - - $topSegmentsToLoad = array( - 'country' => 'UserCountry.getCountry', - 'keyword' => 'Referers.getKeywords', - 'website' => 'Referers.getWebsites', - ); - - $topSegments = array(); - foreach($topSegmentsToLoad as $segmentName => $apiMethod) - { - $request = new Piwik_API_Request("method=$apiMethod - &format=original - &filter_update_columns_when_show_all_goals=1 - &filter_sort_order=desc - &filter_sort_column=$columnNbConversions - &filter_limit=3"); - $datatable = $request->process(); - $topSegment = array(); - foreach($datatable->getRows() as $row) - { - $conversions = $row->getColumn($columnNbConversions); - if($conversions > 0) - { - $topSegment[] = array ( - 'name' => $row->getColumn('label'), - 'nb_conversions' => $conversions, - 'conversion_rate' => $row->getColumn($columnConversionRate), - 'metadata' => $row->getMetadata(), - ); - } - } - $topSegments[$segmentName] = $topSegment; - } - return $topSegments; + $view = $this->getLastUnitGraph($this->pluginName, __FUNCTION__, 'Goals.getConversionRate'); + return $this->renderView($view, $fetch); } - - protected function getMetricsForGoal($idGoal) + + function getLastRevenueGraph( $fetch = false ) { - $request = new Piwik_API_Request("method=Goals.get&format=original&idGoal=$idGoal"); - $datatable = $request->process(); - $dataRow = $datatable->getFirstRow(); - return array ( - 'id' => $idGoal, - 'nb_conversions' => $dataRow->getColumn(Piwik_Goals::getRecordName('nb_conversions', $idGoal)), - 'conversion_rate' => round($dataRow->getColumn(Piwik_Goals::getRecordName('conversion_rate', $idGoal)), 1), - 'revenue' => $dataRow->getColumn(Piwik_Goals::getRecordName('revenue', $idGoal)), - 'urlSparklineConversions' => $this->getUrlSparkline('getEvolutionGraph', array('columns' => array(Piwik_Goals::getRecordName('nb_conversions', $idGoal)), 'idGoal' => $idGoal)), - 'urlSparklineConversionRate' => $this->getUrlSparkline('getEvolutionGraph', array('columns' => array(Piwik_Goals::getRecordName('conversion_rate', $idGoal)), 'idGoal' => $idGoal)), - 'urlSparklineRevenue' => $this->getUrlSparkline('getEvolutionGraph', array('columns' => array(Piwik_Goals::getRecordName('revenue', $idGoal)), 'idGoal' => $idGoal)), - ); + $view = $this->getLastUnitGraph($this->pluginName, __FUNCTION__, 'Goals.getRevenue'); + return $this->renderView($view, $fetch); } } diff --git a/plugins/Goals/Goals.php b/plugins/Goals/Goals.php index 6ab468f09e..7e36b3a4d3 100644 --- a/plugins/Goals/Goals.php +++ b/plugins/Goals/Goals.php @@ -26,10 +26,11 @@ class Piwik_Goals extends Piwik_Plugin public function getInformation() { $info = array( - 'description' => Piwik_Translate('Goals_PluginDescription'), + 'name' => '(ALPHA) Goal Tracking', + 'description' => 'Create Goals and see reports about your goal conversions: evolution over time, revenue per visit, conversions per referer, per keyword, etc.', 'author' => 'Piwik', - 'author_homepage' => 'http://piwik.org/', - 'version' => Piwik_Version::VERSION, + 'homepage' => 'http://piwik.org/', + 'version' => '0.1', 'TrackerPlugin' => true, // this plugin must be loaded during the stats logging ); @@ -54,20 +55,11 @@ class Piwik_Goals extends Piwik_Plugin // add the 'goal' entry in the website array $array =& $notification->getNotificationObject(); - $array['goals'] = Piwik_Goals_API::getInstance()->getGoals($idsite); + $array['goals'] = Piwik_Goals_API::getGoals($idsite); } function addWidgets() { - Piwik_AddWidget('Goals_Goals', 'Goals_GoalsOverview', 'Goals', 'widgetGoalsOverview'); - $goals = Piwik_Tracker_GoalManager::getGoalDefinitions(Piwik_Common::getRequestVar('idSite')); - if(count($goals) > 0) - { - foreach($goals as $goal) - { - Piwik_AddWidget('Goals_Goals', $goal['name'], 'Goals', 'widgetGoalReport', array('idGoal' => $goal['idgoal'])); - } - } } function addMenus() @@ -75,14 +67,14 @@ class Piwik_Goals extends Piwik_Plugin $goals = Piwik_Tracker_GoalManager::getGoalDefinitions(Piwik_Common::getRequestVar('idSite')); if(count($goals)==0) { - Piwik_AddMenu('Goals_Goals', 'Goals_AddNewGoal', array('module' => 'Goals', 'action' => 'addNewGoal')); + Piwik_AddMenu('Goals', 'Add a new Goal', array('module' => 'Goals', 'action' => 'addNewGoal')); } else { - Piwik_AddMenu('Goals_Goals', 'Goals_Overview', array('module' => 'Goals', 'action' => 'index')); + Piwik_AddMenu('Goals', 'Overview', array('module' => 'Goals')); foreach($goals as $goal) { - Piwik_AddMenu('Goals_Goals', str_replace('%', '%%', $goal['name']), array('module' => 'Goals', 'action' => 'goalReport', 'idGoal' => $goal['idgoal'])); + Piwik_AddMenu('Goals', str_replace('%', '%%', $goal['name']), array('module' => 'Goals', 'action' => 'goalReport', 'idGoal' => $goal['idgoal'])); } } } @@ -96,7 +88,7 @@ class Piwik_Goals extends Piwik_Plugin static public function getRecordName($recordName, $idGoal = false, $visitorReturning = false) { $idGoalStr = $returningStr = ''; - if(!empty($idGoal)) + if($idGoal !== false) { $idGoalStr = $idGoal . "_"; } @@ -188,14 +180,14 @@ class Piwik_Goals extends Piwik_Plugin $metricName = Piwik_Archive::$mappingFromIdToNameGoal[$metricId]; $recordName = self::getRecordName($metricName, $idgoal, $visitor_returning); $archiveProcessing->insertNumericRecord($recordName, $value); -// echo $record . "<br />"; +// echo $record . "<br>"; } } } // Stats for all goals $totalAllGoals = array( - self::getRecordName('conversion_rate') => $this->getConversionRate($archiveProcessing->getNumberOfVisitsConverted(), $archiveProcessing), + self::getRecordName('conversion_rate') => round(100 * $archiveProcessing->getNumberOfVisitsConverted() / $archiveProcessing->getNumberOfVisits(), self::ROUNDING_PRECISION), self::getRecordName('nb_conversions') => $nb_conversions, self::getRecordName('revenue') => $revenue, ); diff --git a/plugins/Goals/templates/GoalForm.js b/plugins/Goals/templates/GoalForm.js index 13ed40ba5e..f3c5af4227 100644 --- a/plugins/Goals/templates/GoalForm.js +++ b/plugins/Goals/templates/GoalForm.js @@ -1,35 +1,18 @@ function showAddNewGoal() { - hideForms(); $("#GoalForm").show(); - showCancel(); - piwikHelper.lazyScrollTo("#AddEditGoals", 400); + $("#EditGoals").hide(); + $.scrollTo("#AddEditGoals", 400); return false; } function showEditGoals() { - hideForms(); $("#EditGoals").show(); - showCancel(); - piwikHelper.lazyScrollTo("#AddEditGoals", 400); - return false; -} - -function hideForms() -{ $("#GoalForm").hide(); - $("#EditGoals").hide(); -} - -function showCancel() -{ - $("#goalsCancel").show(); - $('#goalsCancelLink').click( function(){ - hideForms(); - $("#goalsCancel").hide(); - }); + $.scrollTo("#AddEditGoals", 400); + return false; } // init the goal form with existing goal value, if any @@ -59,6 +42,11 @@ function initGoalForm(goalMethodAPI, submitText, goalName, matchAttribute, patte } } +function initAndShowAddGoalForm() +{ + initGoalForm('Goals.addGoal', 'Add Goal', '', 'url', '', 'contains', false, '0'); + return showAddNewGoal(); +} function bindGoalForm() { @@ -90,85 +78,78 @@ function bindGoalForm() $('a[name=linkAddNewGoal]').click( function(){ initAndShowAddGoalForm(); - piwikHelper.lazyScrollTo('#goal_name'); } ); } +function bindListGoalEdit() +{ + $('a[name=linkEditGoal]').click( function() { + var goalId = $(this).attr('id'); + var goal = piwik.goals[goalId]; + initGoalForm("Goals.updateGoal", "Update Goal", goal.name, goal.match_attribute, goal.pattern, goal.pattern_type, (goal.case_sensitive=='0' ? false : true), goal.revenue, goalId); + showAddNewGoal(); + return false; + }); + + $('a[name=linkDeleteGoal]').click( function() { + var goalId = $(this).attr('id'); + var goal = piwik.goals[goalId]; + if(confirm(sprintf("Are you sure you want to delete the Goal '%s'?", goal.name))) + { + $.ajax( getAjaxDeleteGoal( goalId ) ); + } + return false; + }); + + $('a[name=linkEditGoals]').click( function(){ + return showEditGoals(); + } ); +} function getAjaxDeleteGoal(idGoal) { - var ajaxRequest = piwikHelper.getStandardAjaxConf('goalAjaxLoading'); - piwikHelper.lazyScrollTo("#AddEditGoals", 400); + var ajaxRequest = piwikHelper.getStandardAjaxConf(); + piwikHelper.toggleAjaxLoading(); var parameters = {}; parameters.idSite = piwik.idSite; - parameters.idGoal = idGoal; - parameters.method = 'Goals.deleteGoal'; + parameters.idGoal = idGoal; + parameters.method = 'Goals.deleteGoal'; parameters.module = 'API'; parameters.format = 'json'; - parameters.token_auth = piwik.token_auth; + parameters.token_auth = piwik.token_auth; ajaxRequest.data = parameters; return ajaxRequest; } function getAjaxAddGoal() { - var ajaxRequest = piwikHelper.getStandardAjaxConf('goalAjaxLoading'); - piwikHelper.lazyScrollTo("#AddEditGoals", 400); + var ajaxRequest = piwikHelper.getStandardAjaxConf(); + piwikHelper.toggleAjaxLoading(); + var parameters = {}; parameters.idSite = piwik.idSite; parameters.name = encodeURIComponent( $('#goal_name').val() ); - + if($('[name=trigger_type]').val() == 'manually') { parameters.matchAttribute = 'manually'; parameters.patternType = 'regex'; parameters.pattern = '.*'; parameters.caseSensitive = 0; } else { - parameters.matchAttribute = $('input[name=match_attribute]:checked').val(); + parameters.matchAttribute = $('input[name=match_attribute][checked]').val(); parameters.patternType = $('[name=pattern_type]').val(); parameters.pattern = encodeURIComponent( $('input[name=pattern]').val() ); parameters.caseSensitive = $('#case_sensitive').attr('checked') == true ? 1: 0; } parameters.revenue = $('input[name=revenue]').val(); - parameters.idGoal = $('input[name=goalIdUpdate]').val(); - parameters.method = $('input[name=methodGoalAPI]').val(); + parameters.idGoal = $('input[name=goalIdUpdate]').val(); + parameters.method = $('input[name=methodGoalAPI]').val(); parameters.module = 'API'; parameters.format = 'json'; - parameters.token_auth = piwik.token_auth; + parameters.token_auth = piwik.token_auth; ajaxRequest.data = parameters; return ajaxRequest; } - -function bindListGoalEdit() -{ - $('a[name=linkEditGoal]').click( function() { - var goalId = $(this).attr('id'); - var goal = piwik.goals[goalId]; - initGoalForm("Goals.updateGoal", _pk_translate('Goals_UpdateGoal_js'), goal.name, goal.match_attribute, goal.pattern, goal.pattern_type, (goal.case_sensitive=='0' ? false : true), goal.revenue, goalId); - showAddNewGoal(); - return false; - }); - - $('a[name=linkDeleteGoal]').click( function() { - var goalId = $(this).attr('id'); - var goal = piwik.goals[goalId]; - if(confirm(sprintf(_pk_translate('Goals_DeleteGoalConfirm_js'), '"'+goal.name+'"'))) - { - $.ajax( getAjaxDeleteGoal( goalId ) ); - } - return false; - }); - - $('a[name=linkEditGoals]').click( function(){ - return showEditGoals(); - } ); -} - -function initAndShowAddGoalForm() -{ - initGoalForm('Goals.addGoal', _pk_translate('Goals_AddGoal_js'), '', 'url', '', 'contains', false, '0'); - return showAddNewGoal(); -}
\ No newline at end of file diff --git a/plugins/Goals/templates/add_edit_goal.tpl b/plugins/Goals/templates/add_edit_goal.tpl index 5a5081ccaa..c09f1cdab3 100644 --- a/plugins/Goals/templates/add_edit_goal.tpl +++ b/plugins/Goals/templates/add_edit_goal.tpl @@ -1,49 +1,44 @@ + +<div id="AddEditGoals"> {if isset($onlyShowAddNewGoal)} - <h2>{'Goals_AddNewGoal'|translate}</h2> + <h2>Add a new Goal</h2> {else} - <h2>Goals management</h2> - <ul class='listCircle'> - <li><a onclick='' name='linkAddNewGoal'><u>{'Goals_CreateNewGOal'|translate}</u></a></li> - <li><a onclick='' name='linkEditGoals'>{'Goals_ViewAndEditGoals'|translate}</a></li> - <li>{'Goals_LearnMoreAboutGoalTrackingDocumentation'|translate:"<a href='misc/redirectToUrl.php?url=http://piwik.org/docs/tracking-goals-web-analytics/' target='_blank'>":"</a>"}</li> - </ul> - <br/> + <h2><a onclick='' name="linkAddNewGoal">+ Add a new Goal</a> + or <a onclick='' name="linkEditGoals">Edit</a> existing Goals</h2> {/if} -{ajaxErrorDiv} -{ajaxLoadingDiv id=goalAjaxLoading} + <div> + <div id="ajaxError" style="display:none"></div> + <div id="ajaxLoading" style="display:none"><div id="loadingPiwik"><img src="themes/default/images/loading-blue.gif" alt="" /> {'General_LoadingData'|translate}</div></div> + </div> -<div id="AddEditGoals"> - {if !isset($onlyShowAddNewGoal)} - {include file="Goals/templates/list_goal_edit.tpl"} - {/if} +{if !isset($onlyShowAddNewGoal)} + {include file="Goals/templates/list_goal_edit.tpl"} +{/if} {include file="Goals/templates/form_add_goal.tpl"} - <div id='goalsCancel'>{'General_OrCancel'|translate:"<a id='goalsCancelLink'>":"</a>"}</div> + <a id='bottom'></a> </div> -{loadJavascriptTranslations plugins='Goals'} +{literal} <script type="text/javascript" src="plugins/Goals/templates/GoalForm.js"></script> -<script type="text/javascript"> - -var mappingMatchTypeName = {ldelim} - "url": "{'Goals_URL'|translate|escape}", - "file": "{'Goals_Filename'|translate|escape}", - "external_website": "{'Goals_ExternalWebsiteUrl'|translate|escape}" -{rdelim}; -var mappingMatchTypeExamples = {ldelim} - "url": "{'General_ForExampleShort'|translate} {'Goals_Contains'|translate:"'checkout/confirmation'"|escape} \ - <br />{'General_ForExampleShort'|translate|escape} {'Goals_IsExactly'|translate:"'http://example.com/thank-you.html'"|escape} \ - <br />{'General_ForExampleShort'|translate|escape} {'Goals_MatchesExpression'|translate:"'(.*)\\\/demo\\\/(.*)'"|escape}", - "file": "{'General_ForExampleShort'|translate|escape} {'Goals_Contains'|translate:"'files/brochure.pdf'"|escape} \ - <br />{'General_ForExampleShort'|translate|escape} {'Goals_IsExactly'|translate:"'http://example.com/files/brochure.pdf'"|escape} \ - <br />{'General_ForExampleShort'|translate|escape} {'Goals_MatchesExpression'|translate:"'(.*)\\\.zip'"|escape}", - "external_website": "{'General_ForExampleShort'|translate|escape} {'Goals_Contains'|translate:"'amazon.com'"|escape} \ - <br />{'General_ForExampleShort'|translate|escape} {'Goals_IsExactly'|translate:"'http://mypartner.com/landing.html'"|escape} \ - <br />{'General_ForExampleShort'|translate|escape} {'Goals_MatchesExpression'|translate:"'http://www.amazon.com\\\/(.*)\\\/yourAffiliateId'"|escape}" -{rdelim}; +<script language="javascript"> + +var mappingMatchTypeName = { + "url": "URL", + "file": "filename", + "external_website": "external website URL" +}; +var mappingMatchTypeExamples = { + "url": "eg. contains 'checkout/confirmation'<br>eg. is exactly 'http://example.com/thank-you.html'<br>eg. matches the expression '(.*)\\\/demo\\\/(.*)'", + "file": "eg. contains 'files/brochure.pdf'<br>eg. is exactly 'http://example.com/files/brochure.pdf'<br>eg. matches the expression '(.*)\\\.zip'", + "external_website": "eg. contains 'amazon.com'<br>eg. is exactly 'http://mypartner.com/landing.html'<br>eg. matches the expression 'http://www.amazon.com\\\/(.*)\\\/yourAffiliateId'" +}; + bindGoalForm(); +{/literal} + {if !isset($onlyShowAddNewGoal)} piwik.goals = {$goalsJSON}; bindListGoalEdit(); diff --git a/plugins/Goals/templates/add_new_goal.tpl b/plugins/Goals/templates/add_new_goal.tpl index 7450bf4764..05a7f66e8d 100644 --- a/plugins/Goals/templates/add_new_goal.tpl +++ b/plugins/Goals/templates/add_new_goal.tpl @@ -2,5 +2,7 @@ {if $userCanEditGoals} {include file=Goals/templates/add_edit_goal.tpl} {else} -{'Goals_NoGoalsNeedAccess'|translate} +Only an Administrator or the Super User can add Goals for a given website. +Please ask your Piwik administrator to set up a Goal for your website. +<br>Tracking Goals are a great tool to help you maximize your website performance! {/if} diff --git a/plugins/Goals/templates/form_add_goal.tpl b/plugins/Goals/templates/form_add_goal.tpl index 76350d9f40..b60dbe7ad4 100644 --- a/plugins/Goals/templates/form_add_goal.tpl +++ b/plugins/Goals/templates/form_add_goal.tpl @@ -1,74 +1,85 @@ +{literal} +<style> +.goalInlineHelp{ +color:#9B9B9B; +} +</style> +{/literal} <span id='GoalForm' style="display:none;"> <form> -<table class="tableForm tableFormGoals"> - <tbody> - <tr> - <td>{'Goals_GoalName'|translate} </td> - <td><input type="text" name="name" value="" id="goal_name" /></td> - </tr> - <tr> - <td style='width:240px;'>{'Goals_GoalIsTriggered'|translate} - <select name="trigger_type"> - <option value="visitors">{'Goals_WhenVisitors'|translate}</option> - <option value="manually">{'Goals_Manually'|translate}</option> - </select> - </td> - <td> - <input type="radio" id="match_attribute_url" value="url" name="match_attribute" /> - <label for="match_attribute_url">{'Goals_VisitUrl'|translate}</label> - <br /> - <input type="radio" id="match_attribute_file" value="file" name="match_attribute" /> - <label for="match_attribute_file">{'Goals_Download'|translate}</label> - <br /> - <input type="radio" id="match_attribute_external_website" value="external_website" name="match_attribute" /> - <label for="match_attribute_external_website">{'Goals_ClickOutlink'|translate}</label> - </td> + <table class="tableForm"> + <tbody> + <tr> + <td>Goal Name </td> + <td><input type="text" name="name" value="" id="goal_name" /></td> </tr> - </tbody> - <tbody id="match_attribute_section"> - <tr> - <td>{'Goals_WhereThe'|translate} <span id="match_attribute_name"></span></td> - <td> - <select name="pattern_type"> - <option value="contains">{'Goals_Contains'|translate:""}</option> - <option value="exact">{'Goals_IsExactly'|translate:""}</option> - <option value="regex">{'Goals_MatchesExpression'|translate:""}</option> - </select> - - <input type="text" name="pattern" value="" /> - <br /> - <div id="examples_pattern" class="goalInlineHelp"></div> - <br /> - <span style="float:right"> - {'Goals_Optional'|translate} <input type="checkbox" id="case_sensitive" /> - <label for="case_sensitive">{'Goals_CaseSensitive'|translate}</label> - </span> - </td> - </tr> - </tbody> - <tbody id="manual_trigger_section" style="display:none"> - <tr><td colspan="2"> - {'Goals_WhereVisitedPageManuallyCallsJavascriptTrackerLearnMore'|translate:"<a target='_blank' href='misc/redirectToUrl.php?url=http://piwik.org/docs/javascript-tracking/'>":"</a>"} - </td></tr> - </tbody> - <tbody> - <tr> - <td>(optional) {'Goals_DefaultRevenue'|translate}</td> - <td>{'<input type="text" name="revenue" size="1" value="0" />'|money:$idSite} - <div class="goalInlineHelp"> {'Goals_DefaultRevenueHelp'|translate} </div> - </td> - </tr> - <tr> - <tr> - <td colspan="2" style="border:0"> - <input type="hidden" name="methodGoalAPI" value="" /> - <input type="hidden" name="goalIdUpdate" value="" /> - <center> - <input type="submit" value="" name="submit" id="goal_submit" class="submit" /> - </center> - </td> - </tr> - </tbody> -</table> + <tr> + <td>Goal is triggered + <select name="trigger_type"> + <option value="visitors">when visitors</option> + <option value="manually">manually</option> + </select> + </td> + <td> + <input type="radio" id="match_attribute_url" value="url" name="match_attribute"/> + <label for="match_attribute_url">Visit a given URL (page or group of pages)</label> + <br /> + <input type="radio" id="match_attribute_file" value="file" name="match_attribute"/> + <label for="match_attribute_file">Download a file</label> + <br /> + <input type="radio" id="match_attribute_external_website" value="external_website" name="match_attribute"/> + <label for="match_attribute_external_website">Click on a Link to an external website </label> + </td> + </tr> + </tbody> + <tbody id="match_attribute_section"> + <tr> + <td>where the <span id="match_attribute_name"></span></td> + <td> + <select name="pattern_type"> + <option value="contains">contains</option> + <option value="exact">is exactly</option> + <option value="regex">matches the expression</option> + </select> + + <input type="text" name="pattern" value=""/> + <br /> + <div id="examples_pattern" class="goalInlineHelp"></div> + <br /> + <span style="float:right"> + (optional) <input type="checkbox" id="case_sensitive"/> + <label for="case_sensitive">Case sensitive match</label> + </span> + </td> + </tr> + </tbody> + <tbody id="manual_trigger_section" style="display:none"> + <tr> + <td colspan="2"> + where the visited page manually calls the JavaScript piwikTracker.trackGoal() method (<a target='_blank' href='misc/redirectToUrl.php?url=http://piwik.org/docs/javascript-tracking/'>learn more</a>) + </td> + </tr> + </tbody> + <tbody> + <tr> + <td>(optional) Goal default value is </td> + <td>{$currency} <input type="text" name="revenue" size="1" value="0"/> + <div class="goalInlineHelp"> + For example, a Contact Form submitted by a visitor <br /> + may be worth $10 on average. Piwik will help you understand <br /> + how well your visitors segments are performing.</div> + </td> + </tr> + <tr> + <td colspan="2" style="border:0"> + <div class="submit"> + <input type="hidden" name="methodGoalAPI" value=""> + <input type="hidden" name="goalIdUpdate" value=""> + <input type="submit" value="Add Goal" name="submit" id="goal_submit" class="submit" /> + </div> + </td> + </tr> + </tbody> + </table> </form> </span> diff --git a/plugins/Goals/templates/goals.css b/plugins/Goals/templates/goals.css deleted file mode 100644 index 2fc9e0fbd5..0000000000 --- a/plugins/Goals/templates/goals.css +++ /dev/null @@ -1,40 +0,0 @@ -ul.ulGoalTopElements { - list-style-type:circle; - margin-left:30px; -} -.ulGoalTopElements a { - text-decoration:none; - color:#0033CC; - border-bottom:1px dotted #0033CC; - line-height:2em; -} -.goalTopElement { - border-bottom:1px dotted; -} -.listCircle { - list-style:circle outside none; - margin-left:30px; -} -.segmentSelector ul li .segment{ - cursor:pointer; - border-bottom:1px dotted black; -} -.segmentSelector ul li.activeSegment .segment { - font-weight: bold; - border:0; -} - -#titleGoalsBySegment { - padding-top:30px; -} -.goalInlineHelp { - color:#9B9B9B; -} -.tableFormGoals { - width:700px; -} -#goalsCancel { - margin-left:550px; - margin-top:20px; - display:none; -}
\ No newline at end of file diff --git a/plugins/Goals/templates/list_goal_edit.tpl b/plugins/Goals/templates/list_goal_edit.tpl index 805f3c2277..92cab34b25 100644 --- a/plugins/Goals/templates/list_goal_edit.tpl +++ b/plugins/Goals/templates/list_goal_edit.tpl @@ -1,41 +1,22 @@ <span id='EditGoals' style="display:none;"> - <table class="tableForm tableFormGoals"> + <table class="tableForm"> <thead style="font-weight:bold"> <td>Id</td> - <td>{'Goals_GoalName'|translate}</td> - <td>{'Goals_GoalIsTriggeredWhen'|translate}</td> - <td>{'Goals_ColumnRevenue'|translate}</td> - <td>{'General_Edit'|translate}</td> - <td>{'General_Delete'|translate}</td> + <td>Goal Name</td> + <td>Goal is Triggered when</td> + <td>Revenue</td> + <td>Edit</td> + <td>Delete</td> </thead> {foreach from=$goals item=goal} <tr> <td>{$goal.idgoal}</td> <td>{$goal.name}</td> - <td><span class='matchAttribute'>{$goal.match_attribute}</span> {if isset($goal.pattern_type)}<br />{'Goals_Pattern'|translate} {$goal.pattern_type}: {$goal.pattern}</b>{/if}</td> - <td>{if $goal.revenue==0}-{else}{$goal.revenue|money:$idSite}{/if}</td> - <td><a href='#' name="linkEditGoal" id="{$goal.idgoal}"><img src='plugins/UsersManager/images/edit.png' border="0" /> {'General_Edit'|translate}</a></td> - <td><a href='#' name="linkDeleteGoal" id="{$goal.idgoal}"><img src='plugins/UsersManager/images/remove.png' border="0" /> {'General_Delete'|translate}</a></td> + <td>{$goal.match_attribute} {if isset($goal.pattern_type)}<br>Pattern {$goal.pattern_type}: {$goal.pattern}</b>{/if}</td> + <td>{if $goal.revenue==0}-{else}{$currency}{$goal.revenue}{/if}</td> + <td><a href='#' name="linkEditGoal" id="{$goal.idgoal}"><img src='plugins/UsersManager/images/edit.png' border=0> Edit</a></td> + <td><a href='#' name="linkDeleteGoal" id="{$goal.idgoal}"><img src='plugins/UsersManager/images/remove.png' border=0> Delete</a></td> </tr> {/foreach} </table> </span> - -<script type="text/javascript"> -var goalTypeToTranslation = {ldelim} - "manually" : "{'Goals_ManuallyTriggeredUsingJavascriptFunction'|translate}", - "file" : "{'Goals_Download'|translate}", - "url" : "{'Goals_VisitUrl'|translate}", - "external_website" : "{'Goals_ClickOutlink'|translate}" -{rdelim} -{literal} -$(document).ready( function() { - // translation of the goal "match attribute" to human readable description - $('.matchAttribute').each( function() { - matchAttribute = $(this).text(); - translation = goalTypeToTranslation[matchAttribute]; - $(this).text(translation); - }); -} ); -{/literal} -</script> diff --git a/plugins/Goals/templates/list_top_segment.tpl b/plugins/Goals/templates/list_top_segment.tpl index 4e1ca412d3..6dbe69813f 100644 --- a/plugins/Goals/templates/list_top_segment.tpl +++ b/plugins/Goals/templates/list_top_segment.tpl @@ -1,10 +1,5 @@ {foreach from=$topSegment item=element name=topGoalElements} - {assign var=goal_nb_conversion value=$element.nb_conversions} - {assign var=goal_conversion_rate value=$element.conversion_rate} - <span class='goalTopElement' title='{'Goals_Conversions'|translate:"<b>$goal_nb_conversion</b>"}, - {'Goals_ConversionRate'|translate:"<b>$goal_conversion_rate%</b>"}'> - {$element.name}</span> - {logoHtml metadata=$element.metadata alt=$element.name} - {if $smarty.foreach.topGoalElements.iteration == $smarty.foreach.topGoalElements.total-1} and {elseif $smarty.foreach.topGoalElements.iteration < $smarty.foreach.topGoalElements.total-1}, {else}{/if} -{/foreach}
\ No newline at end of file +<span class='goalTopElement' title='<b>{$element.nb_conversions}</b> conversions, <b>{$element.conversion_rate}%</b> conversion rate'> +{$element.name}</span>{logoHtml metadata=$element.metadata alt=$element.name}{if $smarty.foreach.topGoalElements.iteration == $smarty.foreach.topGoalElements.total-1} and {elseif $smarty.foreach.topGoalElements.iteration < $smarty.foreach.topGoalElements.total-1}, {else}{/if} +{/foreach} {* (<a href=''>more</a>) *} diff --git a/plugins/Goals/templates/overview.tpl b/plugins/Goals/templates/overview.tpl index f08633c487..1e342840dc 100644 --- a/plugins/Goals/templates/overview.tpl +++ b/plugins/Goals/templates/overview.tpl @@ -1,32 +1,23 @@ -<link rel="stylesheet" type="text/css" href="plugins/Goals/templates/goals.css" /> {include file="Goals/templates/title_and_evolution_graph.tpl"} {foreach from=$goalMetrics item=goal} - {assign var=nb_conversions value=$goal.nb_conversions} - {assign var=conversion_rate value=$goal.conversion_rate} - {assign var=name value=$goal.name} - - <h2 style="padding-top: 30px;"> - {if $displayFullReport}<a href="javascript:broadcast.propagateAjax('module=Goals&action=goalReport&idGoal={$goal.id}')">{/if} - {'Goals_GoalX'|translate:"'$name'"} - {if $displayFullReport}</a>{/if} - </h2> - <div id='leftcolumn'> - <div class="sparkline">{sparkline src=$goal.urlSparklineConversions} - {'Goals_Conversions'|translate:"<strong>$nb_conversions</strong>"}</div> - </div> - <div id='rightcolumn'> - <div class="sparkline">{sparkline src=$goal.urlSparklineConversionRate} - {'Goals_ConversionRate'|translate:"<strong>$conversion_rate%</strong>"}</div> - </div> +{assign var=nb_conversions value=$goal.nb_conversions} +{assign var=conversion_rate value=$goal.conversion_rate} +<h2 style="padding-top: 30px;">{$goal.name} (goal)</h2> +<div id='leftcolumn'> + <div class="sparkline">{sparkline src=$goal.urlSparklineConversions} + {'%s conversions'|translate:"<strong>$nb_conversions</strong>"}</div> +</div> +<div id='rightcolumn'> + <div class="sparkline">{sparkline src=$goal.urlSparklineConversionRate} + {'%s conversion rate'|translate:"<strong>$conversion_rate%</strong>"}</div> + {* (<a href=''>more</a>) *} +</div> {/foreach} -{if $displayFullReport} +{if $userCanEditGoals} + {include file=Goals/templates/add_edit_goal.tpl} +{/if} - {include file="Goals/templates/table_by_segment.tpl"} - - {if $userCanEditGoals} - {include file=Goals/templates/add_edit_goal.tpl} - {/if} -{/if}
\ No newline at end of file +{include file="Goals/templates/release_notes.tpl} diff --git a/plugins/Goals/templates/release_notes.tpl b/plugins/Goals/templates/release_notes.tpl new file mode 100644 index 0000000000..d987a7d849 --- /dev/null +++ b/plugins/Goals/templates/release_notes.tpl @@ -0,0 +1,36 @@ +<div style="clear:both" /> +<br><br><hr> +<b>About the Goal Tracking Plugin</b><br> +<pre> +The Goal Tracking Plugin is in alpha release. There is more coming soon! + +Give us Feedback! +If you find any other bug, or if you have suggestions, please send us a message using the "Give us feedback" link at the top of the Piwik pages. + +Work left to do on the Goal Tracking plugin: +- The Goal Report page will display conversion table by search engines, country, keyword, campaign, etc. +- Contemplate adding goal conversions per landing page? If we add Goals per landing page, what page is used for goals that are triggered using piwikTracker.trackGoal in javascript? +- The Goal Overview page will link to a Goal Report page with a "(more)" link that will ajax reload the page +- Provide widgets for the dashboard, general goal overview, and one widget for each goal. With: graph evolution, sparklines. Widget with top segments for each goal. +- Add visits with conversion sparkline in VisitsSummary overview +- Add link under goal conversion to full goal reports (optional display) +- Internationalization of all strings i18n +- Provide documentation, screenshots, blog post + add screenshot and inline help in "Add a New Goal" +- N/A% should be n/a +- Way to test a URL against the regex +- Test summary row works ok with subtables campaigns + +Known bugs +- see bug described in http://forum.piwik.org/index.php?showtopic=150 +- Your top converting keyword include keyword without conversions? +- The Goal total nb conversions should be sum of all goal conversions (wrong number when deleting a Goal) +- After adding goal, the window should ideally refresh to the goal report page, and not to the dashboard +- Outlink trailing slash is automatically deleted from the URL, there would be a problem when trying to exact match a URL with trailing slash +- lines with 0 visits and no conversion should not appear + +Feature requests +- need to clarify that goals are triggered once per visit max, but can be triggered multiple times by one unique visitor > need option to force only once per uniq visitor? (ie. e-commerce transaction) +- GeoIp compatibility, archive goals by city, country? see archiveDayAggregateGoals +- Goal conversions, revenue, etc. by hour +- I would like to be able to plot conversions, for a given keyword/website, over the last N days/weeks/etc. See #534 +- when entering the regex to detect as a goal, we could query the piwik API for this regex and list all URLs that match the regex; allows for an easy debug/check that the regex is correct and will be triggererd when expected diff --git a/plugins/Goals/templates/single_goal.tpl b/plugins/Goals/templates/single_goal.tpl index 41968df30e..289be7b417 100644 --- a/plugins/Goals/templates/single_goal.tpl +++ b/plugins/Goals/templates/single_goal.tpl @@ -1,28 +1,40 @@ -<link rel="stylesheet" type="text/css" href="plugins/Goals/templates/goals.css" /> {include file="Goals/templates/title_and_evolution_graph.tpl"} -<div style="clear:both;"></div> +<div style="clear:both"></div> {if $nb_conversions > 0} - <h2>{'Goals_ConversionsOverview'|translate}</h2> + <h2>Conversions Overview</h2> <ul class="ulGoalTopElements"> - <li>{'Goals_BestCountries'|translate} {include file='Goals/templates/list_top_segment.tpl' topSegment=$topSegments.country}</li> - {if count($topSegments.keyword)>0}<li>{'Goals_BestKeywords'|translate} {include file='Goals/templates/list_top_segment.tpl' topSegment=$topSegments.keyword}</li>{/if} - {if count($topSegments.website)>0}<li>{'Goals_BestReferers'|translate} {include file='Goals/templates/list_top_segment.tpl' topSegment=$topSegments.website}</li>{/if} - <li>{'Goals_ReturningVisitorsConversionRateIs'|translate:"<b>$conversion_rate_returning%</b>"}, {'Goals_NewVisitorsConversionRateIs'|translate:"<b>$conversion_rate_new%</b>"}</li> + <li>Your best converting countries are: {include file='Goals/templates/list_top_segment.tpl' topSegment=$topSegments.country}</li> + {if count($topSegments.keyword)>0}<li>Your top converting keywords are: {include file='Goals/templates/list_top_segment.tpl' topSegment=$topSegments.keyword}</li>{/if} + {if count($topSegments.website)>0}<li>Your best converting websites referers are: {include file='Goals/templates/list_top_segment.tpl' topSegment=$topSegments.website}</li>{/if} + <li>Returning visitors conversion rate is <b>{$conversion_rate_returning}%</b>, New Visitors conversion rate is <b>{$conversion_rate_new}%</b></li> </ul> {/if} +<hr> +{$tableByConversion} - +<hr> {literal} -<script type="text/javascript"> +<style> +ul.ulGoalTopElements { + list-style-type:circle; + margin-left:30px; +} +.ulGoalTopElements a { + text-decoration:none; + color:#0033CC; + border-bottom:1px dotted #0033CC; + line-height:2em; +} +.goalTopElement { + border-bottom:1px dotted; +} +</style> +<script> $(document).ready( function() { - $('.goalTopElement').tooltip(); -}); + $('.goalTopElement') + .tooltip() + ; + }); </script> {/literal} - -{if $displayFullReport} - {if $nb_conversions > 0} - {include file="Goals/templates/table_by_segment.tpl"} - {/if} -{/if}
\ No newline at end of file diff --git a/plugins/Goals/templates/table_by_segment.tpl b/plugins/Goals/templates/table_by_segment.tpl deleted file mode 100644 index 3dfa45eaa5..0000000000 --- a/plugins/Goals/templates/table_by_segment.tpl +++ /dev/null @@ -1,72 +0,0 @@ -<h2 id='titleGoalsBySegment'>{if isset($idGoal)} - {'Goals_GoalConversionsBySegment'|translate:$goalName} - {else}{'Goals_ConversionsOverviewBySegment'|translate}{/if}</h2> - -<div class='segmentSelector' style='float: left;width: 220px;padding-left: 10px;height:450px'> - {foreach from=$goalSegments key=segmentFamilyName item=segments} - {'Goals_ViewGoalsBySegment'|translate:$segmentFamilyName} - <ul class='listCircle'> - {foreach from=$segments item=segment} - <li title='{'Goals_ViewGoalsBySegment'|translate:$segment.name}' class='goalSegment' module='{$segment.module}' action='{$segment.action}'> - <span class='segment'>{$segment.name}</span> - </li> - {/foreach} - </ul> - {/foreach} -</div> - -<div style='float: left;'> - {ajaxLoadingDiv id=tableGoalsLoading} - - <div id='tableGoalsBySegment'></div> -</div> -<div style='clear:both'></div> -{literal} -<script type="text/javascript"> -$(document).ready( function() { - var countLoaded = 0; - /* - * For each 'segment' in the list, a click will trigger an ajax request to load the datatable - * showing Goals metrics (conversion, conv. rates, revenue) for this segment - */ - $('.goalSegment').click( function() { - var self = this; - $('.goalSegment').removeClass('activeSegment'); - $(this).addClass('activeSegment'); - var module = $(this).attr('module'); - var action = $(this).attr('action'); - widgetUniqueId = module+action; - self.expectedWidgetUniqueId = widgetUniqueId; - - var idGoal = broadcast.getValueFromHash('idGoal'); - var widgetParameters = { - 'module': module, - 'action': action, - 'viewDataTable': 'tableGoals', - 'filter_only_display_idgoal': idGoal.length ? idGoal : 0 // 0 is Piwik_DataTable_Filter_UpdateColumnsWhenShowAllGoals::GOALS_FULL_TABLE - }; - var onWidgetLoadedCallback = function (response) { - if(widgetUniqueId != self.expectedWidgetUniqueId) { - return; - } - $('#tableGoalsBySegment').html($(response)); - $('#tableGoalsLoading').hide(); - $('#tableGoalsBySegment').show(); - - countLoaded++; - // only scroll down to the loaded datatable if this is not the first one - // otherwise, screen would jump down to the table when loading the report - if(countLoaded > 1) - { - piwikHelper.lazyScrollTo("#titleGoalsBySegment", 400); - } - }; - $('#tableGoalsBySegment').hide(); - $('#tableGoalsLoading').show(); - ajaxRequest = widgetsHelper.getLoadWidgetAjaxRequest(widgetUniqueId, widgetParameters, onWidgetLoadedCallback); - $.ajax(ajaxRequest); - }); - $('.goalSegment').first().click(); -}); -</script> -{/literal} diff --git a/plugins/Goals/templates/title_and_evolution_graph.tpl b/plugins/Goals/templates/title_and_evolution_graph.tpl index 0ac5707d00..8a344df003 100644 --- a/plugins/Goals/templates/title_and_evolution_graph.tpl +++ b/plugins/Goals/templates/title_and_evolution_graph.tpl @@ -1,22 +1,18 @@ <script type="text/javascript" src="plugins/CoreHome/templates/sparkline.js"></script> <a name="evolutionGraph" graphId="{$nameGraphEvolution}"></a> - -{if $displayFullReport} - <h2>{if isset($goalName)}{'Goals_GoalX'|translate:$goalName}{else}{'Goals_GoalsOverview'|translate}{/if}</h2> -{/if} +<h2>{$title}</h2> {$graphEvolution} <div id='leftcolumn'> <div class="sparkline">{sparkline src=$urlSparklineConversions} - {'Goals_Conversions'|translate:"<strong>$nb_conversions</strong>"}</div> + {'%s conversions'|translate:"<strong>$nb_conversions</strong>"}</div> {if $revenue != 0 } <div class="sparkline">{sparkline src=$urlSparklineRevenue} - {assign var=revenue value=$revenue|money:$idSite} - {'Goals_OverallRevenue'|translate:"<strong>$revenue</strong>"}</div> + {'%s overall revenue'|translate:"<strong>$currency$revenue</strong>"}</div> {/if} </div> <div id='rightcolumn'> <div class="sparkline">{sparkline src=$urlSparklineConversionRate} - {'Goals_OverallConversionRate'|translate:"<strong>$conversion_rate%</strong>"}</div> + {'%s overall conversion rate (visits with a completed goal)'|translate:"<strong>$conversion_rate%</strong>"}</div> </div> diff --git a/plugins/Installation/Controller.php b/plugins/Installation/Controller.php index ef0929899e..022c1e4911 100644 --- a/plugins/Installation/Controller.php +++ b/plugins/Installation/Controller.php @@ -11,7 +11,6 @@ */ /** - * Installation controller * * @package Piwik_Installation */ @@ -22,7 +21,6 @@ class Piwik_Installation_Controller extends Piwik_Controller 'welcome' => 'Installation_Welcome', 'systemCheck' => 'Installation_SystemCheck', 'databaseSetup' => 'Installation_DatabaseSetup', - 'databaseCheck' => 'Installation_DatabaseCheck', 'tablesCreation' => 'Installation_Tables', 'generalSetup' => 'Installation_GeneralSetup', 'firstWebsiteSetup' => 'Installation_SetupWebsite', @@ -40,54 +38,35 @@ class Piwik_Installation_Controller extends Piwik_Controller if(!isset($this->session->currentStepDone)) { $this->session->currentStepDone = ''; - $this->session->skipThisStep = array(); } Piwik_PostEvent('InstallationController.construct', $this); } - /** - * Get installation steps - * - * @return array installation steps - */ public function getInstallationSteps() { return $this->steps; } - /** - * Get default action (first installation step) - * - * @return string function name - */ function getDefaultAction() { $steps = array_keys($this->steps); return $steps[0]; } - /** - * Installation Step 1: Welcome - */ - function welcome($message) + function welcome() { $view = new Piwik_Installation_View( $this->pathView . 'welcome.tpl', $this->getInstallationSteps(), __FUNCTION__ ); - $view->newInstall = !file_exists(Piwik_Config::getDefaultUserConfigPath()); - $view->errorMessage = $message; $this->skipThisStep( __FUNCTION__ ); - $view->showNextStep = $view->newInstall; + $view->showNextStep = true; $this->session->currentStepDone = __FUNCTION__; echo $view->render(); } - /** - * Installation Step 2: System Check - */ function systemCheck() { $this->checkPreviousStepIsValid( __FUNCTION__ ); @@ -101,16 +80,12 @@ class Piwik_Installation_Controller extends Piwik_Controller $view->infos = self::getSystemInformation(); $view->helpMessages = array( - 'zlib' => 'Installation_SystemCheckZlibHelp', - 'SPL' => 'Installation_SystemCheckSplHelp', - 'iconv' => 'Installation_SystemCheckIconvHelp', - 'dom' => 'Installation_SystemCheckDomHelp', - 'set_time_limit' => 'Installation_SystemCheckTimeLimitHelp', - 'mail' => 'Installation_SystemCheckMailHelp', - 'parse_ini_file' => 'Installation_SystemCheckParseIniFileHelp', - 'debug_backtrace' => 'Installation_SystemCheckDebugBacktraceHelp', - 'create_function' => 'Installation_SystemCheckCreateFunctionHelp', - 'eval' => 'Installation_SystemCheckEvalHelp', + 'zlib' => 'Installation_SystemCheckZlibHelp', + 'SPL' => 'Installation_SystemCheckSplHelp', + 'iconv' => 'Installation_SystemCheckIconvHelp', + 'dom' => 'Installation_SystemCheckDomHelp', + 'set_time_limit' => 'Installation_SystemCheckTimeLimitHelp', + 'mail' => 'Installation_SystemCheckMailHelp', ); $view->problemWithSomeDirectories = (false !== array_search(false, $view->infos['directories'])); @@ -119,7 +94,6 @@ class Piwik_Installation_Controller extends Piwik_Controller && $view->infos['phpVersion_ok'] && count($view->infos['adapters']) && !count($view->infos['missing_extensions']) - && !count($view->infos['missing_functions']) ; $this->session->currentStepDone = __FUNCTION__; @@ -127,9 +101,6 @@ class Piwik_Installation_Controller extends Piwik_Controller echo $view->render(); } - /** - * Installation Step 3: Database Set-up - */ function databaseSetup() { $this->checkPreviousStepIsValid( __FUNCTION__ ); @@ -154,7 +125,7 @@ class Piwik_Installation_Controller extends Piwik_Controller if($form->validate()) { $adapter = $form->getSubmitValue('adapter'); - $port = Piwik_Db_Adapter::getDefaultPortForAdapter($adapter); + $port = Piwik_Db::getDefaultPortForAdapter($adapter); $dbInfos = array( 'host' => $form->getSubmitValue('host'), @@ -182,12 +153,9 @@ class Piwik_Installation_Controller extends Piwik_Controller try{ try { Piwik::createDatabaseObject($dbInfos); - $this->session->databaseCreated = true; } catch (Zend_Db_Adapter_Exception $e) { - $db = Piwik_Db_Adapter::factory($adapter, $dbInfos); - // database not found, we try to create it - if($db->isErrNo($e, '1049')) + if(Zend_Registry::isRegistered('db') && Zend_Registry::get('db')->isErrNo($e, '1049')) { $dbInfosConnectOnly = $dbInfos; $dbInfosConnectOnly['dbname'] = null; @@ -197,12 +165,11 @@ class Piwik_Installation_Controller extends Piwik_Controller } else { - throw $e; + throw $e; } } Piwik::checkDatabaseVersion(); - $this->session->databaseVersionOk = true; $this->session->db_infos = $dbInfos; $this->redirectToNextStep( __FUNCTION__ ); @@ -212,76 +179,11 @@ class Piwik_Installation_Controller extends Piwik_Controller } $view->addForm($form); - echo $view->render(); - } - - /** - * Installation Step 4: Database Check - */ - function databaseCheck() - { - $this->checkPreviousStepIsValid( __FUNCTION__ ); - $view = new Piwik_Installation_View( - $this->pathView . 'databaseCheck.tpl', - $this->getInstallationSteps(), - __FUNCTION__ - ); - - $error = false; - $this->skipThisStep( __FUNCTION__ ); - - if(isset($this->session->databaseVersionOk) - && $this->session->databaseVersionOk === true) - { - $view->databaseVersionOk = true; - } - else - { - $error = true; - } - - if(isset($this->session->databaseCreated) - && $this->session->databaseCreated === true) - { - $dbInfos = $this->session->db_infos; - $view->databaseName = $dbInfos['dbname']; - $view->databaseCreated = true; - } - else - { - $error = true; - } - - $this->createDbFromSessionInformation(); - $db = Zend_Registry::get('db'); - - try { - $db->checkClientVersion(); - } catch(Exception $e) { - $view->clientVersionWarning = $e->getMessage(); - $error = true; - } - - if(!Piwik::isDatabaseConnectionUTF8()) - { - $dbInfos = $this->session->db_infos; - $dbInfos['charset'] = 'utf8'; - $this->session->db_infos = $dbInfos; - } + $view->infos = self::getSystemInformation(); - $view->showNextStep = true; - $this->session->currentStepDone = __FUNCTION__; - - if($error === false) - { - $this->redirectToNextStep(__FUNCTION__); - } echo $view->render(); } - /** - * Installation Step 5: Table Creation - */ function tablesCreation() { $this->checkPreviousStepIsValid( __FUNCTION__ ); @@ -307,31 +209,29 @@ class Piwik_Installation_Controller extends Piwik_Controller $this->session->skipThisStep = $tmp; } + if(!Piwik::isDatabaseConnectionUTF8()) + { +// $view->charsetWarning = true; + } + $tablesInstalled = Piwik::getTablesInstalled(); $tablesToInstall = Piwik::getTablesNames(); $view->tablesInstalled = ''; if(count($tablesInstalled) > 0) { - // we have existing tables $view->tablesInstalled = implode(', ', $tablesInstalled); $view->someTablesInstalled = true; $minimumCountPiwikTables = 12; $baseTablesInstalled = preg_grep('/archive_numeric|archive_blob/', $tablesInstalled, PREG_GREP_INVERT); - - Piwik::createAccessObject(); - Piwik::setUserIsSuperUser(); - - if(count($baseTablesInstalled) >= $minimumCountPiwikTables && - count(Piwik_SitesManager_API::getInstance()->getAllSitesId()) > 0 && - count(Piwik_UsersManager_API::getInstance()->getUsers()) > 0) + if(count($baseTablesInstalled) >= $minimumCountPiwikTables ) { $view->showReuseExistingTables = true; // when the user reuses the same tables we skip the website creation step // workaround ZF-1743 $tmp = $this->session->skipThisStep; $tmp['firstWebsiteSetup'] = true; - $tmp['displayJavascriptCode'] = true; + $tmp['displayJavascriptCode'] = true; $this->session->skipThisStep = $tmp; } } @@ -346,13 +246,18 @@ class Piwik_Installation_Controller extends Piwik_Controller $view->showNextStep = true; } + if(isset($this->session->databaseCreated) + && $this->session->databaseCreated === true) + { + $view->databaseName = $this->session->db_infos['dbname']; + $view->databaseCreated = true; + unset($this->session->databaseCreated); + } + $this->session->currentStepDone = __FUNCTION__; echo $view->render(); } - /** - * Installation Step 6: General Set-up (superuser login/password/email and subscriptions) - */ function generalSetup() { $this->checkPreviousStepIsValid( __FUNCTION__ ); @@ -372,7 +277,6 @@ class Piwik_Installation_Controller extends Piwik_Controller 'login' => $form->getSubmitValue('login'), 'password' => md5( $form->getSubmitValue('password') ), 'email' => $form->getSubmitValue('email'), - 'salt' => Piwik_Common::generateUniqId(), ); $this->session->superuser_infos = $superUserInfos; @@ -392,7 +296,7 @@ class Piwik_Installation_Controller extends Piwik_Controller if( !isset($params['community'])) { $params['community'] = '0'; } $url = $host . '?' . http_build_query($params, '', '&'); try { - Piwik_Http::sendHttpRequest($url, $timeout = 2); + Piwik::sendHttpRequest($url, $timeout = 2); } catch(Exception $e) { // e.g., disable_functions = fsockopen; allow_url_open = Off } @@ -404,9 +308,6 @@ class Piwik_Installation_Controller extends Piwik_Controller echo $view->render(); } - /** - * Installation Step 7: Configure first web-site - */ public function firstWebsiteSetup() { $this->checkPreviousStepIsValid( __FUNCTION__ ); @@ -425,12 +326,12 @@ class Piwik_Installation_Controller extends Piwik_Controller $this->session->generalSetupSuccessMessage = true; } - $this->initObjectsToCallAPI(); if($form->validate()) { $name = urlencode($form->getSubmitValue('siteName')); $url = urlencode($form->getSubmitValue('url')); + $this->initObjectsToCallAPI(); $request = new Piwik_API_Request(" method=SitesManager.addSite @@ -455,9 +356,6 @@ class Piwik_Installation_Controller extends Piwik_Controller echo $view->render(); } - /** - * Installation Step 8: Display JavaScript tracking code - */ public function displayJavascriptCode() { $this->checkPreviousStepIsValid( __FUNCTION__ ); @@ -475,6 +373,7 @@ class Piwik_Installation_Controller extends Piwik_Controller $this->session->firstWebsiteSetupSuccessMessage = true; } + $view->websiteName = urldecode($this->session->site_name); $jsTag = Piwik::getJavascriptCode($this->session->site_idSite, Piwik_Url::getCurrentUrlWithoutFileName()); @@ -486,9 +385,6 @@ class Piwik_Installation_Controller extends Piwik_Controller echo $view->render(); } - /** - * Installation Step 9: Finished! - */ public function finished() { $this->checkPreviousStepIsValid( __FUNCTION__ ); @@ -499,21 +395,14 @@ class Piwik_Installation_Controller extends Piwik_Controller __FUNCTION__ ); $this->skipThisStep( __FUNCTION__ ); + $this->writeConfigFileFromSession(); - if(!file_exists(Piwik_Config::getDefaultUserConfigPath())) - { - $this->writeConfigFileFromSession(); - } - + $this->session->currentStepDone = __FUNCTION__; $view->showNextStep = false; - $this->session->currentStepDone = __FUNCTION__; echo $view->render(); } - /** - * Instantiate access and log objects - */ protected function initObjectsToCallAPI() { // connect to the database using the DB infos currently in the session @@ -524,20 +413,6 @@ class Piwik_Installation_Controller extends Piwik_Controller Piwik::createLogObject(); } - /** - * Create database connection from session-store - */ - protected function createDbFromSessionInformation() - { - $dbInfos = $this->session->db_infos; - Zend_Registry::get('config')->disableSavingConfigurationFileUpdates(); - Zend_Registry::get('config')->database = $dbInfos; - Piwik::createDatabaseObject($dbInfos); - } - - /** - * Write configuration file from session-store - */ protected function writeConfigFileFromSession() { if(!isset($this->session->superuser_infos) @@ -547,50 +422,32 @@ class Piwik_Installation_Controller extends Piwik_Controller } $config = Zend_Registry::get('config'); $config->superuser = $this->session->superuser_infos; - $dbInfos = $this->session->db_infos; - $config->database = $dbInfos; - - unset($this->session->superuser_infos); - unset($this->session->db_infos); - } - - /** - * Save language selection in session-store - */ - public function saveLanguage() - { - $language = Piwik_Common::getRequestVar('language'); - Piwik_LanguagesManager_API::getInstance()->setLanguageForSession($language); - Piwik_Url::redirectToReferer(); + $config->database = $this->session->db_infos; } /** * The previous step is valid if it is either * - any step before (OK to go back) * - the current step (case when validating a form) - * If step is invalid, then exit. - * - * @param string $currentStep Current step */ protected function checkPreviousStepIsValid( $currentStep ) { $error = false; - if(empty($this->session->currentStepDone)) - { + // first we make sure that the config file is not present, ie. Installation state is expected + try { + $config = new Piwik_Config(); + $config->init(); $error = true; + } catch(Exception $e) { } - else if($currentStep == 'finished' && $this->session->currentStepDone == 'finished') + + if(empty($this->session->currentStepDone)) { - // ok to refresh this page or use language selector + $error = true; } else { - if(file_exists(Piwik_Config::getDefaultUserConfigPath())) - { - $error = true; - } - $steps = array_keys($this->steps); // the currentStep @@ -618,12 +475,6 @@ class Piwik_Installation_Controller extends Piwik_Controller } } - /** - * Redirect to next step - * - * @param string Current step - * @return none - */ protected function redirectToNextStep($currentStep) { $steps = array_keys($this->steps); @@ -632,23 +483,14 @@ class Piwik_Installation_Controller extends Piwik_Controller Piwik::redirectToModule('Installation' , $nextStep); } - /** - * Skip this step (typically to mark the current function as completed) - * - * @param string function name - */ - protected function skipThisStep( $step ) + protected function createDbFromSessionInformation() { - $skipThisStep = $this->session->skipThisStep; - if(isset($skipThisStep[$step]) && $skipThisStep[$step]) - { - $this->redirectToNextStep($step); - } + $dbInfos = $this->session->db_infos; + Zend_Registry::get('config')->disableSavingConfigurationFileUpdates(); + Zend_Registry::get('config')->database = $dbInfos; + Piwik::createDatabaseObject($dbInfos); } - /** - * Get system information - */ public static function getSystemInformation() { $minimumPhpVersion = Zend_Registry::get('config')->General->minimum_php_version; @@ -657,17 +499,6 @@ class Piwik_Installation_Controller extends Piwik_Controller $infos = array(); $infos['directories'] = Piwik::checkDirectoriesWritable(); - - $serverSoftware = $_SERVER['SERVER_SOFTWARE']; - if(preg_match('/^Microsoft-IIS\/(.+)/', $serverSoftware, $matches) && version_compare($matches[1], '7') >= 0) - { - Piwik::createWebConfigFiles(); - } - else if(strpos($serverSoftware, 'Apache/') === 0) - { - Piwik::createHtAccessFiles(); - } - $infos['phpVersion_minimum'] = $minimumPhpVersion; $infos['phpVersion'] = phpversion(); $infos['phpVersion_ok'] = version_compare( $minimumPhpVersion, $infos['phpVersion']) === -1; @@ -678,7 +509,6 @@ class Piwik_Installation_Controller extends Piwik_Controller 'zlib', 'SPL', 'iconv', - 'Reflection', ); $infos['needed_extensions'] = $needed_extensions; $infos['missing_extensions'] = array(); @@ -696,7 +526,7 @@ class Piwik_Installation_Controller extends Piwik_Controller $infos['pdo_ok'] = true; } - $infos['adapters'] = Piwik_Db_Adapter::getAdapters(); + $infos['adapters'] = Piwik_Db::getAdapters(); $infos['json'] = false; if(in_array('json', $extensions)) @@ -710,72 +540,36 @@ class Piwik_Installation_Controller extends Piwik_Controller $infos['xml'] = true; } + // warnings $needed_functions = array( - 'debug_backtrace', - 'create_function', - 'eval', + 'set_time_limit', + 'mail', ); $infos['needed_functions'] = $needed_functions; $infos['missing_functions'] = array(); foreach($needed_functions as $needed_function) { - if(!self::functionExists($needed_function)) + if(!function_exists($needed_function)) { $infos['missing_functions'][] = $needed_function; } } - // warnings - $desired_functions = array( - 'set_time_limit', - 'mail', - 'parse_ini_file', - ); - $infos['desired_functions'] = $desired_functions; - $infos['missing_desired_functions'] = array(); - foreach($desired_functions as $desired_function) - { - if(!self::functionExists($desired_function)) - { - $infos['missing_desired_functions'][] = $desired_function; - } - } - - $infos['openurl'] = Piwik_Http::getTransportMethod(); + $infos['openurl'] = Piwik::getTransportMethod(); $infos['gd_ok'] = false; if (in_array('gd', $extensions)) { - $gdInfo = gd_info(); + $gdInfo = gd_info(); $infos['gd_version'] = $gdInfo['GD Version']; - preg_match('/([0-9]{1})/', $gdInfo['GD Version'], $gdVersion); - if($gdVersion[0] >= 2) - { + preg_match('/([0-9]{1})/', $gdInfo['GD Version'], $gdVersion); + if($gdVersion[0] >= 2) + { $infos['gd_ok'] = true; - } + } } - $infos['hasMbstring'] = false; - $infos['multibyte_ok'] = true; - if(function_exists('mb_internal_encoding')) - { - $infos['hasMbstring'] = true; - if (((int) ini_get('mbstring.func_overload')) != 0) - { - $infos['multibyte_ok'] = false; - } - } - - /** - * @see http://php.net/ip2long - */ - $infos['isIpv4'] = true; - if(strpos($_SERVER['REMOTE_ADDR'], ':') !== false) - { - $infos['isIpv4'] = false; - } - - $infos['serverVersion'] = addslashes($serverSoftware); + $infos['serverVersion'] = addslashes($_SERVER['SERVER_SOFTWARE']); $infos['serverOs'] = @php_uname(); $infos['serverTime'] = date('H:i:s'); @@ -783,7 +577,8 @@ class Piwik_Installation_Controller extends Piwik_Controller $infos['memoryMinimum'] = $minimumMemoryLimit; $infos['memory_ok'] = true; - $infos['memoryCurrent'] = '-1'; + // on windows the ini_get is not working? + $infos['memoryCurrent'] = '?M'; $raised = Piwik::raiseMemoryLimitIfNecessary(); if( $memoryValue = Piwik::getMemoryLimitValue() ) @@ -792,98 +587,24 @@ class Piwik_Installation_Controller extends Piwik_Controller $infos['memory_ok'] = $memoryValue >= $minimumMemoryLimit; } - $infos['isWindows'] = strtoupper(substr(PHP_OS, 0, 3)) == 'WIN'; - - $infos['protocol_ok'] = true; - $infos['protocol'] = self::getProtocolInformation(); - if(Piwik_Url::getCurrentScheme() == 'http' && - $infos['protocol'] !== null) - { - $infos['protocol_ok'] = false; - } - - $integrityInfo = Piwik::getFileIntegrityInformation(); - $infos['integrity'] = $integrityInfo[0]; - - $infos['integrityErrorMessages'] = array(); - if(isset($integrityInfo[1])) - { - if($infos['integrity'] == false) - { - $infos['integrityErrorMessages'][] = '<b>'.Piwik_Translate('General_FileIntegrityWarningExplanation').'</b>'; - } - $infos['integrityErrorMessages'] = array_merge($infos['integrityErrorMessages'], array_slice($integrityInfo, 1)); - } + $infos['isWindows'] = substr(PHP_OS, 0, 3) == 'WIN'; - $infos['timezone'] = Piwik::isTimezoneSupportEnabled(); return $infos; } - /** - * Get protocol information, with the exception of HTTPS - * - * @return string protocol information - */ - public static function getProtocolInformation() + protected function skipThisStep( $step ) { - if(Piwik_Common::getRequestVar('clientProtocol', 'http', 'string') == 'https') - { - return 'https'; - } - - if(isset($_SERVER['SERVER_PORT']) && $_SERVER['SERVER_PORT'] == 443) + if(isset($this->session->skipThisStep[$step]) + && $this->session->skipThisStep[$step]) { - return 'SERVER_PORT=443'; - } - - if(isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && strtolower($_SERVER['HTTP_X_FORWARDED_PROTO']) == 'https') - { - return 'X-Forwarded-Proto'; - } - - if(isset($_SERVER['HTTP_X_FORWARDED_SCHEME']) && strtolower($_SERVER['HTTP_X_FORWARDED_SCHEME']) == 'https') - { - return 'X-Forwarded-Scheme'; - } - - if(isset($_SERVER['HTTP_X_URL_SCHEME']) && strtolower($_SERVER['HTTP_X_URL_SCHEME']) == 'https') - { - return 'X-Url-Scheme'; + $this->redirectToNextStep($step); } - - return null; } - /** - * Test if function exists. Also handles case where function is disabled via Suhosin. - * - * @param string $functionName Function name - * @return bool True if function exists (not disabled); False otherwise. - */ - public static function functionExists($functionName) + public function saveLanguage() { - // eval() is a language construct - if($functionName == 'eval') - { - // does not check suhosin.executor.eval.whitelist (or blacklist) - if(extension_loaded('suhosin')) - { - return @ini_get("suhosin.executor.disable_eval") != "1"; - } - return true; - } - - $exists = function_exists($functionName); - if(extension_loaded('suhosin')) - { - $blacklist = @ini_get("suhosin.executor.func.blacklist"); - if(!empty($blacklist)) - { - $blacklistFunctions = array_map('strtolower', array_map('trim', explode(',', $blacklist))); - return $exists && !in_array($functionName, $blacklistFunctions); - } - - } - return $exists; + $language = Piwik_Common::getRequestVar('language'); + Piwik_LanguagesManager_API::setLanguageForSession($language); + Piwik_Url::redirectToReferer(); } } diff --git a/plugins/Installation/FormDatabaseSetup.php b/plugins/Installation/FormDatabaseSetup.php index 807cffd723..2669cbcc5f 100644 --- a/plugins/Installation/FormDatabaseSetup.php +++ b/plugins/Installation/FormDatabaseSetup.php @@ -16,26 +16,22 @@ */ class Piwik_Installation_FormDatabaseSetup extends Piwik_Form { - function __construct() - { - parent::__construct($action = '', $attributes = 'autocomplete="off"'); - } function init() { - $availableAdapters = Piwik_Db_Adapter::getAdapters(); + $infos = Piwik_Installation_Controller::getSystemInformation(); $adapters = array(); - foreach($availableAdapters as $adapter => $port) + foreach($infos['adapters'] as $adapter => $port) { $adapters[$adapter] = $adapter; } $formElements = array( - array('text', 'host', Piwik_Translate('Installation_DatabaseSetupServer'), 'value='.'localhost'), - array('text', 'username', Piwik_Translate('Installation_DatabaseSetupLogin')), - array('password', 'password', Piwik_Translate('Installation_DatabaseSetupPassword')), - array('text', 'dbname', Piwik_Translate('Installation_DatabaseSetupDatabaseName')), - array('text', 'tables_prefix', Piwik_Translate('Installation_DatabaseSetupTablePrefix'), 'value='.'piwik_'), - array('select', 'adapter', Piwik_Translate('Installation_DatabaseSetupAdapter'), $adapters), + array('text', 'host', 'mysql server', 'value='.'localhost'), + array('text', 'username', 'login'), + array('password', 'password', 'password'), + array('text', 'dbname', 'database name'), + array('text', 'tables_prefix', 'table prefix', 'value='.'piwik_'), + array('select', 'adapter', 'adapter', $adapters), ); $this->addElements( $formElements ); diff --git a/plugins/Installation/FormFirstWebsiteSetup.php b/plugins/Installation/FormFirstWebsiteSetup.php index 115b859a95..65f2666263 100644 --- a/plugins/Installation/FormFirstWebsiteSetup.php +++ b/plugins/Installation/FormFirstWebsiteSetup.php @@ -16,20 +16,6 @@ */ class Piwik_Installation_FormFirstWebsiteSetup extends Piwik_Form { - function validate() - { - try { - $timezone = $this->getSubmitValue('timezone'); - if(!empty($timezone)) - { - Piwik_SitesManager_API::getInstance()->setDefaultTimezone($timezone); - } - } catch(Exception $e) { - $this->_errors['timezone'] = Piwik_Translate('General_NotValid', Piwik_Translate('Installation_Timezone')); - } - return parent::validate(); - } - function init() { $urlToGoAfter = 'index.php' . Piwik_Url::getCurrentQueryString(); @@ -37,14 +23,9 @@ class Piwik_Installation_FormFirstWebsiteSetup extends Piwik_Form $urlExample = 'http://example.org'; $javascriptOnClickUrlExample = "\"javascript:if(this.value=='$urlExample'){this.value='http://';} this.style.color='black';\""; - $timezones = Piwik_SitesManager_API::getInstance()->getTimezonesList(); - $timezones = array_merge(array('No timezone' => Piwik_Translate('SitesManager_SelectACity')), $timezones); - $formElements = array( - array('text', 'siteName', Piwik_Translate('Installation_SetupWebSiteName')), - array('text', 'url', Piwik_Translate('Installation_SetupWebSiteURL'), "style='color:rgb(153, 153, 153);' value=$urlExample onfocus=".$javascriptOnClickUrlExample." onclick=".$javascriptOnClickUrlExample), - array('select', 'timezone', Piwik_Translate('Installation_Timezone'), $timezones), - + array('text', 'siteName', 'website name'), + array('text', 'url', 'website URL', "style='color:rgb(153, 153, 153);' value=$urlExample onfocus=".$javascriptOnClickUrlExample." onclick=".$javascriptOnClickUrlExample), ); $this->addElements( $formElements ); @@ -54,13 +35,6 @@ class Piwik_Installation_FormFirstWebsiteSetup extends Piwik_Form $formRules[] = array($row[1], Piwik_Translate('General_Required', $row[2]), 'required'); } - - $submitTimezone = $this->getSubmitValue('timezone'); - if(!$this->isSubmitted() - || !empty($submitTimezone)) - { - $this->setSelected('timezone', $submitTimezone); - } $this->addRules( $formRules ); $this->addElement('submit', 'submit', Piwik_Translate('Installation_SubmitGo')); diff --git a/plugins/Installation/FormGeneralSetup.php b/plugins/Installation/FormGeneralSetup.php index a1b62aaaf9..0f9e8d0662 100644 --- a/plugins/Installation/FormGeneralSetup.php +++ b/plugins/Installation/FormGeneralSetup.php @@ -16,25 +16,6 @@ */ class Piwik_Installation_FormGeneralSetup extends Piwik_Form { - function __construct() - { - parent::__construct($action = '', $attributes = 'autocomplete="off"'); - } - - function validate() - { - try { - $login = $this->getSubmitValue('login'); - if(!empty($login)) - { - Piwik::checkValidLoginString($login); - } - } catch(Exception $e) { - $this->_errors['login'] = $e->getMessage(); - } - return parent::validate(); - } - function init() { $urlToGoAfter = 'index.php' . Piwik_Url::getCurrentQueryString(); diff --git a/plugins/Installation/Installation.php b/plugins/Installation/Installation.php index fbdd695b76..0b17c974f5 100644 --- a/plugins/Installation/Installation.php +++ b/plugins/Installation/Installation.php @@ -21,10 +21,11 @@ class Piwik_Installation extends Piwik_Plugin public function getInformation() { $info = array( - 'description' => Piwik_Translate('Installation_PluginDescription'), + 'name' => 'Installation', + 'description' => 'Installation process of Piwik. The Installation is usually done once only. If the configuration file config/config.inc.php is deleted, the installation will start again.', 'author' => 'Piwik', - 'author_homepage' => 'http://piwik.org/', - 'version' => Piwik_Version::VERSION, + 'homepage' => 'http://piwik.org/', + 'version' => '0.1', ); return $info; @@ -34,7 +35,6 @@ class Piwik_Installation extends Piwik_Plugin { $hooks = array( 'FrontController.NoConfigurationFile' => 'dispatch', - 'FrontController.badConfigurationFile' => 'dispatch', ); return $hooks; } @@ -49,18 +49,8 @@ class Piwik_Installation extends Piwik_Plugin return new $this->installationControllerName(); } - function dispatch($notification = null) + function dispatch() { - if($notification) - { - $exception = $notification->getNotificationObject(); - $message = $exception->getMessage(); - } - else - { - $message = ''; - } - Piwik_Translate::getInstance()->loadUserTranslation(); Piwik_PostEvent('Installation.startInstallation', $this); @@ -69,7 +59,7 @@ class Piwik_Installation extends Piwik_Plugin $controller = $this->getInstallationController(); if(in_array($step, array_keys($controller->getInstallationSteps())) || $step == 'saveLanguage') { - $controller->$step($message); + $controller->$step(); } else { diff --git a/plugins/Installation/View.php b/plugins/Installation/View.php index 7f3ae3c197..0b5e288890 100644 --- a/plugins/Installation/View.php +++ b/plugins/Installation/View.php @@ -48,11 +48,6 @@ class Piwik_Installation_View extends Piwik_View { $this->previousModuleName = $this->steps[$this->currentStepId - 1]; } - $this->previousPreviousModuleName = ''; - if(isset($this->steps[$this->currentStepId - 2])) - { - $this->previousPreviousModuleName = $this->steps[$this->currentStepId - 2]; - } return parent::render(); } diff --git a/plugins/Installation/templates/databaseCheck.tpl b/plugins/Installation/templates/databaseCheck.tpl deleted file mode 100644 index 3374582f74..0000000000 --- a/plugins/Installation/templates/databaseCheck.tpl +++ /dev/null @@ -1,34 +0,0 @@ -{assign var=ok value="<img src='themes/default/images/ok.png' />"} -{assign var=error value="<img src='themes/default/images/error.png' />"} -{assign var=warning value="<img src='themes/default/images/warning.png' />"} -{assign var=link value="<img src='themes/default/images/link.gif' />"} - -<h1>{'Installation_DatabaseCheck'|translate}</h1> - -<table class="infosServer"> - <tr> - <td class="label">{'Installation_DatabaseServerVersion'|translate}</td> - <td>{if isset($databaseVersionOk)}{$ok}{else}{$error}{/if}</td> - </tr> - <tr> - <td class="label">{'Installation_DatabaseClientVersion'|translate}</td> - <td>{if isset($clientVersionWarning)}{$warning}{else}{$ok}{/if}</td> - </tr> -{if isset($clientVersionWarning)} - <tr> - <td colspan="2"> - <small> - <span style="color:#FF7F00">{$clientVersionWarning}</span> - </small> - </td> - </tr> -{/if} - <tr> - <td class="label">{'Installation_DatabaseCreation'|translate}</td> - <td>{if isset($databaseCreated)}{$ok}{else}{$error}{/if}</td> - </tr> -</table> - -<p> -{$link} <a href="misc/redirectToUrl.php?url=http://piwik.org/docs/requirements/" target="_blank">{'Installation_Requirements'|translate}</a> -</p> diff --git a/plugins/Installation/templates/databaseSetup.tpl b/plugins/Installation/templates/databaseSetup.tpl index ff60befc62..65646a7664 100644 --- a/plugins/Installation/templates/databaseSetup.tpl +++ b/plugins/Installation/templates/databaseSetup.tpl @@ -2,7 +2,7 @@ {if isset($errorMessage)} <div class="error"> - <img src="themes/default/images/error_medium.png" /> + <img src="themes/default/images/error_medium.png"> {'Installation_DatabaseErrorConnect'|translate}: <br />{$errorMessage} diff --git a/plugins/Installation/templates/displayJavascriptCode.tpl b/plugins/Installation/templates/displayJavascriptCode.tpl index 4cdd03c082..41f5fa6c53 100644 --- a/plugins/Installation/templates/displayJavascriptCode.tpl +++ b/plugins/Installation/templates/displayJavascriptCode.tpl @@ -27,7 +27,7 @@ $(document).ready( function(){ <span id="toFade" class="success"> {'Installation_SetupWebsiteSetupSuccess'|translate:$websiteName} - <img src="themes/default/images/success_medium.png" /> + <img src="themes/default/images/success_medium.png"> </span> {/if} <h1>{'Installation_JsTag'|translate}</h1> @@ -36,10 +36,9 @@ $(document).ready( function(){ {$javascriptTag} </code> -<h1>{'Installation_JsTagHelpTitle'|translate}</h1> +<h1>{'Installation_QuickHelp'|translate}:</h1> {include file=SitesManager/templates/JavascriptTagHelp.tpl} - -<br /> -<h1>{'Installation_LargePiwikInstances'|translate}</h1> -{'Installation_JsTagArchivingHelp'|translate} +<ul> +<li>{'Installation_JsTagArchivingHelp'|translate}</li> <!-- <li>Link to help with the main blog engines wordpress/drupal/myspace/blogspot</li> --> +</ul> diff --git a/plugins/Installation/templates/firstWebsiteSetup.tpl b/plugins/Installation/templates/firstWebsiteSetup.tpl index f8d19f70af..2e97223be7 100644 --- a/plugins/Installation/templates/firstWebsiteSetup.tpl +++ b/plugins/Installation/templates/firstWebsiteSetup.tpl @@ -3,7 +3,7 @@ {if isset($displayGeneralSetupSuccess)} <span id="toFade" class="success"> {'Installation_GeneralSetupSuccess'|translate} - <img src="themes/default/images/success_medium.png" /> + <img src="themes/default/images/success_medium.png"> </span> {/if} @@ -11,7 +11,7 @@ {if isset($errorMessage)} <div class="error"> - <img src="themes/default/images/error_medium.png" /> + <img src="themes/default/images/error_medium.png"> {'Installation_SetupWebsiteError'|translate}: <br />- {$errorMessage} diff --git a/plugins/Installation/templates/integrityDetails.tpl b/plugins/Installation/templates/integrityDetails.tpl deleted file mode 100644 index edac941868..0000000000 --- a/plugins/Installation/templates/integrityDetails.tpl +++ /dev/null @@ -1,43 +0,0 @@ -{if !isset($warningMessages)} -{assign var=warningMessages value=$infos.integrityErrorMessages} -{/if} -<div id="integrity-results" title="{'Installation_SystemCheckFileIntegrity'|translate}" style="display:none; font-size: 62.5%;"> - <table> - {foreach from=$warningMessages item=msg} - <tr><td>{$msg}</td></tr> - {/foreach} - </table> -</div> -<script type="text/javascript"> -{literal}<!-- -$(function() { - $("#integrity-results").dialog({ - bgiframe: true, - modal: true, - autoOpen: false, - width: 600, - buttons: { - Ok: function() { - $(this).dialog('close'); - } - } - }); -}); -$('#more-results').click(function() { - $('#integrity-results').dialog('open'); -}) -.hover( - function(){ - $(this).addClass("ui-state-hover"); - }, - function(){ - $(this).removeClass("ui-state-hover"); - } -).mousedown(function(){ - $(this).addClass("ui-state-active"); -}) -.mouseup(function(){ - $(this).removeClass("ui-state-active"); -}); -//-->{/literal} -</script> diff --git a/plugins/Installation/templates/structure.tpl b/plugins/Installation/templates/structure.tpl index b98ca8e077..074b13abd3 100644 --- a/plugins/Installation/templates/structure.tpl +++ b/plugins/Installation/templates/structure.tpl @@ -5,9 +5,7 @@ <title>Piwik › {'Installation_Installation'|translate}</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> -<link rel="stylesheet" type="text/css" href="themes/default/common.css" /> -<link rel="stylesheet" type="text/css" href="libs/jquery/themes/base/jquery-ui.css" /> -<link rel="stylesheet" type="text/css" href="themes/default/styles.css" /> +{postEvent name="template_css_import"} <script type="text/javascript" src="libs/jquery/jquery.js"></script> <script type="text/javascript" src="libs/jquery/jquery-ui.js"></script> @@ -18,17 +16,12 @@ $(document).ready( function(){ $('#toFade').fadeOut(4000, function(){ $(this).css('display', 'hidden'); } ); $('input:first').focus(); - $('#progressbar').progressbar({ -{/literal} - value: {$percentDone} -{literal} }); -}); </script> {/literal} {literal} -<style type="text/css"> +<style> div.both { clear: both; } @@ -51,7 +44,7 @@ body { } #logo { - padding:30px; + padding:30; } h1 { @@ -67,12 +60,6 @@ h3 { color:#3F5163; } -.topBarElem { - font-family:arial,sans-serif !important; - font-size:13px; - line-height:1.33; -} - .error { color:red; font-size:100%; @@ -93,18 +80,13 @@ h3 { padding:10; } .warning { - margin:10px; color:#ff5502; font-size:130%; font-weight:bold; - padding:10px 20px 10px 30px; + padding:10; border: 1px solid #ff5502; } -.warning ul { - list-style:disc; -} - .success img, .warning img { border:0; vertical-align:bottom; @@ -131,8 +113,10 @@ h3 { margin: auto; background: #FFFFFF; padding: 0.2em 2em 2em 2em; - -moz-border-radius: 8px; - -webkit-border-radius: 8px; + + -moz-border-radius: 8px; + -khtml-border-radius: 8px; + -webkit-border-radius: 8px; } /* form errors */ #adminErrors { @@ -146,20 +130,20 @@ h3 { font-size:90%; } -#generalInstall ul { +#generalInstall UL { list-style-type: decimal; } -li.futureStep { +LI.futureStep { color: #d3d3d3; } -li.actualStep { +LI.actualStep { font-weight: bold; } -li.pastStep { +LI.pastStep { color: #008000; } -p.nextStep a { +P.nextStep A { font-weight: bold; padding: 0.5em; color: #ae0000; @@ -169,6 +153,21 @@ p.nextStep a { line-height:1em; } +#installPercent { + width: 100%; + height: 1.5em; + margin: 0; + padding: 0; + background-color: #eee; + border: 1px solid #ddd; +} +#installPercent P { + height: 1.5em; + background-color: #8aaecc; + margin: 0; + padding: 0; +} + td { border-color:#FFFFFF rgb(198, 205, 216) rgb(198, 205, 216) rgb(198, 205, 216) ; border-style:solid; @@ -202,15 +201,11 @@ input { {/literal} </head> <body> - <div id="main"> <div id="content"> <div id="logo"> <span id="title">Piwik</span> <span id="subtitle"># {'General_OpenSourceWebAnalytics'|translate}</span> - </div> - <div style="float:right" id="topRightBar"> - <br /> - {postEvent name="template_topBar"} + <span style="float:right">{postEvent name="template_topBar"}</span> </div> <div class="both"></div> @@ -229,13 +224,13 @@ input { <div class="both"></div> - <br /> - <br /> <h3>{'Installation_InstallationStatus'|translate}</h3> - <div id="progressbar"></div> - {'Installation_PercentDone'|translate:$percentDone} + <div id="installPercent"> + <p style="width: {$percentDone}%;"></p> </div> + + {'Installation_PercentDone'|translate:$percentDone} </div> </body> </html> diff --git a/plugins/Installation/templates/systemCheck.tpl b/plugins/Installation/templates/systemCheck.tpl index b0433c96a3..75b3c6843b 100644 --- a/plugins/Installation/templates/systemCheck.tpl +++ b/plugins/Installation/templates/systemCheck.tpl @@ -82,7 +82,7 @@ <small> {foreach from=$infos.missing_extensions item=missing_extension} <p> - <i>{$helpMessages[$missing_extension]|translate}</i> + {$helpMessages[$missing_extension]|translate} </p> {/foreach} </small> @@ -90,21 +90,6 @@ </tr> {/if} <tr> - <td class="label">{'Installation_SystemCheckFunctions'|translate}</td> - <td>{foreach from=$infos.needed_functions item=needed_function} - {$needed_function} - {if in_array($needed_function, $infos.missing_functions)} - {$error} - <p> - <i>{$helpMessages[$needed_function]|translate}</i> - </p> - {else} - {$ok}<br /> - {/if} - {/foreach} - </td> - </tr> - <tr> <td valign="top"> {'Installation_SystemCheckWriteDirs'|translate} </td> @@ -136,23 +121,6 @@ <h1>{'Optional'|translate}</h1> <table class="infos"> <tr> - <td class="label">{'Installation_SystemCheckFileIntegrity'|translate}</td> - <td> - {if empty($infos.integrityErrorMessages)} - {$ok} - {else} - {if $infos.integrity} - {$warning} <i>{$infos.integrityErrorMessages[0]}</i> - {else} - {$error} <i>{$infos.integrityErrorMessages[0]}</i> - {/if} - {if count($infos.integrityErrorMessages) > 1} - <button id="more-results" class="ui-button ui-state-default ui-corner-all">{'General_Details'|translate}</button> - {/if} - {/if} - </td> - </tr> - <tr> <td class="label">{'Installation_SystemCheckMemoryLimit'|translate}</td> <td> {$infos.memoryCurrent} @@ -161,13 +129,6 @@ </td> </tr> <tr> - <td class="label">{'SitesManager_Timezone'|translate}</td> - <td> - {if $infos.timezone}{$ok}{else}{$warning} - <br /><i>{'SitesManager_AdvancedTimezoneSupportNotFound'|translate}</i>{/if} - </td> - </tr> - <tr> <td class="label">{'Installation_SystemCheckOpenURL'|translate}</td> <td> {if $infos.openurl}{$infos.openurl} {$ok}{else}{$warning} <br /><i>{'Installation_SystemCheckOpenURLHelp'|translate}</i>{/if} @@ -187,22 +148,16 @@ {if $infos.gd_ok}{$ok}{else}{$warning} <br /><i>{'Installation_SystemCheckGDHelp'|translate}</i>{/if} </td> </tr> - {if $infos.hasMbstring} - <tr> - <td class="label">{'Installation_SystemCheckMbstring'|translate}</td> - <td> - {if $infos.multibyte_ok}{$ok}{else}{$warning} <br /><i>{'Installation_SystemCheckMbstringHelp'|translate}</i>{/if} - </td> - </tr> - {/if} <tr> <td class="label">{'Installation_SystemCheckFunctions'|translate}</td> - <td>{foreach from=$infos.desired_functions item=desired_function} - {$desired_function} - {if in_array($desired_function, $infos.missing_desired_functions)} + <td>{foreach from=$infos.needed_functions item=needed_function} + {$needed_function} + {if in_array($needed_function, $infos.missing_functions)} {$warning} <p> - <i>{$helpMessages[$desired_function]|translate}</i> + <small> + {$helpMessages[$needed_function]|translate} + </small> </p> {else} {$ok}<br /> @@ -210,24 +165,10 @@ {/foreach} </td> </tr> - <tr> - <td class="label">{'Installation_SystemCheckProtocol'|translate}</td> - <td> - {if $infos.protocol_ok}{$ok}{else}{$warning} {$infos.protocol}<br /><i>{'Installation_SystemCheckProtocolHelp'|translate}</i><br /><br /><code>[General]</code><br /><code>reverse_proxy = 1</code><br />{/if} - </td> - </tr> - <tr> - <td class="label">{'Installation_SystemCheckIpv4'|translate}</td> - <td> - {if $infos.isIpv4}{$ok}{else}{$warning}<br /><i>{'Installation_SystemCheckIpv4Help'|translate}</i>{/if} - </td> - </tr> </table> -{include file="Installation/templates/integrityDetails.tpl"} - <p> -{$link} <a href="misc/redirectToUrl.php?url=http://piwik.org/docs/requirements/" target="_blank">{'Installation_Requirements'|translate}</a> +{$link} <a href="http://piwik.org/docs/requirements/" target="_blank">{'Installation_Requirements'|translate}</a> </p> {if !$showNextStep} diff --git a/plugins/Installation/templates/tablesCreation.tpl b/plugins/Installation/templates/tablesCreation.tpl index 028799e9fd..8047bef92e 100644 --- a/plugins/Installation/templates/tablesCreation.tpl +++ b/plugins/Installation/templates/tablesCreation.tpl @@ -1,8 +1,14 @@ <h1>{'Installation_Tables'|translate}</h1> +{if isset($charsetWarning)} + <div class="warning">{'Installation_ConnectionCharacterSetNotUtf8'|translate} + <img src="themes/default/images/warning_medium.png"> + </div> +{/if} + {if isset($someTablesInstalled)} <div class="warning">{'Installation_TablesWithSameNamesFound'|translate:"<span id='linkToggle'>":"</span>"} - <img src="themes/default/images/warning_medium.png" /> + <img src="themes/default/images/warning_medium.png"> </div> <div id="toggle" style="display:none;color:#4F2410"><small><i>{'Installation_TablesFound'|translate}: <br />{$tablesInstalled} </i></small></div> @@ -11,7 +17,7 @@ <p>{'Installation_TablesWarningHelp'|translate}</p> <p class="nextStep"><a href="{url action=$nextModuleName}">{'Installation_TablesReuse'|translate} »</a></p> {else} - <p class="nextStep"><a href="{url action=$previousPreviousModuleName}">« {'Installation_GoBackAndDefinePrefix'|translate}</a></p> + <p class="nextStep"><a href="{url action=$previousModuleName}">« {'Installation_GoBackAndDefinePrefix'|translate}</a></p> {/if} <p class="nextStep"><a href="{url deleteTables=1}" id="eraseAllTables">{'Installation_TablesDelete'|translate} »</a></p> @@ -19,19 +25,24 @@ {if isset($existingTablesDeleted)} <div class="success"> {'Installation_TablesDeletedSuccess'|translate} - <img src="themes/default/images/success_medium.png" /></div> + <img src="themes/default/images/success_medium.png"></div> +{/if} + +{if isset($databaseCreated)} + <div class="success"> {'Installation_DatabaseCreatedSuccess'|translate:"'$databaseName'"} + <img src="themes/default/images/success_medium.png"></div> {/if} {if isset($tablesCreated)} <div class="success"> {'Installation_TablesCreatedSuccess'|translate} - <img src="themes/default/images/success_medium.png" /></div> + <img src="themes/default/images/success_medium.png"></div> {/if} {literal} <script> $(document).ready( function(){ {/literal} - var strConfirmEraseTables = "{'Installation_ConfirmDeleteExistingTables'|translate:"[$tablesInstalled]":"<br />"} "; + var strConfirmEraseTables = "{'Installation_ConfirmDeleteExistingTables'|translate:"[$tablesInstalled]":"<br>"} "; {literal} // toggle the display of the tables detected during the installation when clicking diff --git a/plugins/Installation/templates/welcome.tpl b/plugins/Installation/templates/welcome.tpl index 2de55967e2..c2985c3c36 100644 --- a/plugins/Installation/templates/welcome.tpl +++ b/plugins/Installation/templates/welcome.tpl @@ -1,29 +1,4 @@ <h1>{'Installation_Welcome'|translate}</h1> -{if $newInstall} {'Installation_WelcomeHelp'|translate:$totalNumberOfSteps} -{else} -<p>{'Installation_ConfigurationHelp'|translate}</p> -<br /> -<div class="error"> -{$errorMessage} -</div> -{/if} -{literal} -<script type="text/javascript"> -<!-- -$(function() { -if (document.location.protocol === 'https:') { - $('p.nextStep a').attr('href', $('p.nextStep a').attr('href') + '&clientProtocol=https'); -} -}); -//--> -</script> -{/literal} - -{if !$showNextStep} -<p class="nextStep"> - <a href="{url}">{'General_Refresh'|translate} »</a> -</p> -{/if} diff --git a/plugins/LanguagesManager/API.php b/plugins/LanguagesManager/API.php index 0e128ceb68..16199235a8 100644 --- a/plugins/LanguagesManager/API.php +++ b/plugins/LanguagesManager/API.php @@ -27,9 +27,8 @@ class Piwik_LanguagesManager_API } return self::$instance; } - - protected $availableLanguageNames = null; - protected $languageNames = null; + static protected $availableLanguageNames = null; + static protected $languageNames = null; /** * Returns true if specified language is available @@ -37,10 +36,10 @@ class Piwik_LanguagesManager_API * @param string $languageCode * @return bool true if language available; false otherwise */ - public function isLanguageAvailable($languageCode) + static public function isLanguageAvailable($languageCode) { return $languageCode !== false - && in_array($languageCode, $this->getAvailableLanguages()); + && in_array($languageCode, self::getAvailableLanguages()); } /** @@ -48,11 +47,11 @@ class Piwik_LanguagesManager_API * * @return array Arry of strings, each containing its ISO language code */ - public function getAvailableLanguages() + static public function getAvailableLanguages() { - if(!is_null($this->languageNames)) + if(!is_null(self::$languageNames)) { - return $this->languageNames; + return self::$languageNames; } $path = PIWIK_INCLUDE_PATH . "/lang/"; $languages = glob($path . "*.php"); @@ -62,7 +61,7 @@ class Piwik_LanguagesManager_API { $languageNames[] = substr($language, $pathLength, -strlen('.php')); } - $this->languageNames = $languageNames; + self::$languageNames = $languageNames; return $languageNames; } @@ -71,11 +70,11 @@ class Piwik_LanguagesManager_API * * @return array Array of arrays */ - public function getAvailableLanguagesInfo() + static public function getAvailableLanguagesInfo() { require PIWIK_INCLUDE_PATH . '/lang/en.php'; $englishTranslation = $translations; - $filenames = $this->getAvailableLanguages(); + $filenames = self::getAvailableLanguages(); $languagesInfo = array(); foreach($filenames as $filename) { @@ -100,22 +99,22 @@ class Piwik_LanguagesManager_API * * @return array Arry of array, each containing its ISO language code and name of the language */ - public function getAvailableLanguageNames() + static public function getAvailableLanguageNames() { - if(!is_null($this->availableLanguageNames)) + if(!is_null(self::$availableLanguageNames)) { - return $this->availableLanguageNames; + return self::$availableLanguageNames; } - $filenames = $this->getAvailableLanguages(); + $filenames = self::getAvailableLanguages(); $languagesInfo = array(); foreach($filenames as $filename) { require PIWIK_INCLUDE_PATH . "/lang/$filename.php"; $languagesInfo[] = array( 'code' => $filename, 'name' => $translations['General_OriginalLanguageName']); } - $this->availableLanguageNames = $languagesInfo; - return $this->availableLanguageNames; + self::$availableLanguageNames = $languagesInfo; + return self::$availableLanguageNames; } /** @@ -124,9 +123,9 @@ class Piwik_LanguagesManager_API * @param string $languageCode ISO language code * @return array|false Array of arrays, each containing 'label' (translation index) and 'value' (translated string); false if language unavailable */ - public function getTranslationsForLanguage($languageCode) + static public function getTranslationsForLanguage($languageCode) { - if(!$this->isLanguageAvailable($languageCode)) + if(!self::isLanguageAvailable($languageCode)) { return false; } @@ -145,10 +144,10 @@ class Piwik_LanguagesManager_API * @param string $login * @param string|false $layout */ - public function getLanguageForUser( $login ) + static public function getLanguageForUser( $login ) { Piwik::checkUserIsSuperUserOrTheUser($login); - return Piwik_FetchOne('SELECT language FROM '.Piwik_Common::prefixTable('user_language') . + return Piwik_FetchOne('SELECT language FROM '.Piwik::prefixTable('user_language') . ' WHERE login = ? ', array($login )); } @@ -158,11 +157,11 @@ class Piwik_LanguagesManager_API * @param string $login * @param string $languageCode */ - public function setLanguageForUser($login, $languageCode) + static public function setLanguageForUser($login, $languageCode) { Piwik::checkUserIsSuperUserOrTheUser($login); $paramsBind = array($login, $languageCode, $languageCode); - Piwik_Query('INSERT INTO '.Piwik_Common::prefixTable('user_language') . + Piwik_Query('INSERT INTO '.Piwik::prefixTable('user_language') . ' (login, language) VALUES (?,?) ON DUPLICATE KEY UPDATE language=?', @@ -174,7 +173,7 @@ class Piwik_LanguagesManager_API * * @return string|null */ - public function getLanguageForSession() + static public function getLanguageForSession() { $session = new Zend_Session_Namespace("Piwik_LanguagesManager"); if(isset($session->language)) @@ -189,7 +188,7 @@ class Piwik_LanguagesManager_API * * @param string $languageCode ISO language code */ - public function setLanguageForSession($languageCode) + static public function setLanguageForSession($languageCode) { $session = new Zend_Session_Namespace("Piwik_LanguagesManager"); $session->language = $languageCode; diff --git a/plugins/LanguagesManager/Controller.php b/plugins/LanguagesManager/Controller.php index f0e678125f..c7546540f2 100644 --- a/plugins/LanguagesManager/Controller.php +++ b/plugins/LanguagesManager/Controller.php @@ -23,12 +23,12 @@ class Piwik_LanguagesManager_Controller extends Piwik_Controller public function saveLanguage() { $language = Piwik_Common::getRequestVar('language'); - Piwik_LanguagesManager_API::getInstance()->setLanguageForSession($language); + Piwik_LanguagesManager_API::setLanguageForSession($language); if(Zend_Registry::isRegistered('access')) { $currentUser = Piwik::getCurrentUserLogin(); if($currentUser && $currentUser !== 'anonymous') { - Piwik_LanguagesManager_API::getInstance()->setLanguageForUser($currentUser, $language); + Piwik_LanguagesManager_API::setLanguageForUser($currentUser, $language); } } Piwik_Url::redirectToReferer(); diff --git a/plugins/LanguagesManager/LanguagesManager.php b/plugins/LanguagesManager/LanguagesManager.php index 6ee5178910..8db9f2e353 100644 --- a/plugins/LanguagesManager/LanguagesManager.php +++ b/plugins/LanguagesManager/LanguagesManager.php @@ -20,10 +20,11 @@ class Piwik_LanguagesManager extends Piwik_Plugin public function getInformation() { return array( - 'description' => Piwik_Translate('LanguagesManager_PluginDescription'), + 'name' => 'Languages Management', + 'description' => 'This plugin will display a list of the available languages for the Piwik interface. The language selected will be saved in the preferences for each user.', 'author' => 'Piwik', - 'author_homepage' => 'http://piwik.org/', - 'version' => Piwik_Version::VERSION, + 'homepage' => 'http://piwik.org/', + 'version' => '0.1', ); } @@ -33,7 +34,6 @@ class Piwik_LanguagesManager extends Piwik_Plugin 'template_css_import' => 'css', 'template_topBar' => 'showLanguagesSelector', 'Translate.getLanguageToLoad' => 'getLanguageToLoad', - 'UsersManager.deleteUser' => 'deleteUserLanguage', ); } @@ -49,12 +49,11 @@ class Piwik_LanguagesManager extends Piwik_Plugin */ function showLanguagesSelector() { - // don't use Piwik_View::factory() here - $view = new Piwik_View("LanguagesManager/templates/languages.tpl"); - $view->languages = Piwik_LanguagesManager_API::getInstance()->getAvailableLanguageNames(); + $view = Piwik_View::factory("languages"); + $view->languages = Piwik_LanguagesManager_API::getAvailableLanguageNames(); $view->currentLanguageCode = self::getLanguageCodeForCurrentUser(); $view->currentLanguageName = self::getLanguageNameForCurrentUser(); - echo $view->render(); + echo $view ->render(); } function getLanguageToLoad($notification) @@ -62,27 +61,21 @@ class Piwik_LanguagesManager extends Piwik_Plugin $language =& $notification->getNotificationObject(); $language = self::getLanguageCodeForCurrentUser(); } - - function deleteUserLanguage($notification) - { - $userLogin = $notification->getNotificationObject(); - Piwik_Query('DELETE FROM ' . Piwik_Common::prefixTable('user_language') . ' WHERE login = ?', $userLogin); - } - + /** - * @throws Exception if non-recoverable error + * @throws Zend_Db_Statement_Exception if non-recoverable error */ public function install() { // we catch the exception try{ - $sql = "CREATE TABLE ". Piwik_Common::prefixTable('user_language')." ( + $sql = "CREATE TABLE ". Piwik::prefixTable('user_language')." ( login VARCHAR( 100 ) NOT NULL , language VARCHAR( 10 ) NOT NULL , PRIMARY KEY ( login ) ) DEFAULT CHARSET=utf8 " ; Piwik_Exec($sql); - } catch(Exception $e){ + } catch(Zend_Db_Statement_Exception $e){ // mysql code error 1050:table already exists // see bug #153 http://dev.piwik.org/trac/ticket/153 if(!Zend_Registry::get('db')->isErrNo($e, '1050')) @@ -93,25 +86,26 @@ class Piwik_LanguagesManager extends Piwik_Plugin } /** - * @throws Exception if non-recoverable error + * @throws Zend_Db_Statement_Exception if non-recoverable error */ public function uninstall() { - $sql = "DROP TABLE ". Piwik_Common::prefixTable('user_language') ; + $sql = "DROP TABLE ". Piwik::prefixTable('user_language') ; Piwik_Exec($sql); } - + + /** * @return string Two letters language code, eg. "fr" */ static public function getLanguageCodeForCurrentUser() { $languageCode = self::getLanguageFromPreferences(); - if(!Piwik_LanguagesManager_API::getInstance()->isLanguageAvailable($languageCode)) + if(!Piwik_LanguagesManager_API::isLanguageAvailable($languageCode)) { - $languageCode = Piwik_Common::extractLanguageCodeFromBrowserLanguage(Piwik_Common::getBrowserLanguage(), Piwik_LanguagesManager_API::getInstance()->getAvailableLanguages()); + $languageCode = Piwik_Common::extractLanguageCodeFromBrowserLanguage(Piwik_Common::getBrowserLanguage(), Piwik_LanguagesManager_API::getAvailableLanguages()); } - if(!Piwik_LanguagesManager_API::getInstance()->isLanguageAvailable($languageCode)) + if(!Piwik_LanguagesManager_API::isLanguageAvailable($languageCode)) { $languageCode = 'en'; } @@ -124,7 +118,7 @@ class Piwik_LanguagesManager extends Piwik_Plugin static public function getLanguageNameForCurrentUser() { $languageCode = self::getLanguageCodeForCurrentUser(); - $languages = Piwik_LanguagesManager_API::getInstance()->getAvailableLanguageNames(); + $languages = Piwik_LanguagesManager_API::getAvailableLanguageNames(); foreach($languages as $language) { if($language['code'] === $languageCode) @@ -139,14 +133,14 @@ class Piwik_LanguagesManager extends Piwik_Plugin */ static protected function getLanguageFromPreferences() { - if ($language = Piwik_LanguagesManager_API::getInstance()->getLanguageForSession()) + if ($language = Piwik_LanguagesManager_API::getLanguageForSession()) { return $language; } try { $currentUser = Piwik::getCurrentUserLogin(); - return Piwik_LanguagesManager_API::getInstance()->getLanguageForUser($currentUser); + return Piwik_LanguagesManager_API::getLanguageForUser($currentUser); } catch(Exception $e) { return false; } diff --git a/plugins/LanguagesManager/templates/languages.tpl b/plugins/LanguagesManager/templates/languages.tpl index 444caf7218..a7ebf9ff03 100644 --- a/plugins/LanguagesManager/templates/languages.tpl +++ b/plugins/LanguagesManager/templates/languages.tpl @@ -3,16 +3,15 @@ <form action="index.php?{if $currentModule != ''}module=LanguagesManager&{/if}action=saveLanguage" method="get"> <select name="language"> <option value="{$currentLanguageCode}">{$currentLanguageName}</option> - <option href='misc/redirectToUrl.php?url=http://piwik.org/translations/'>{'LanguagesManager_AboutPiwikTranslations'|translate}</option> {foreach from=$languages item=language} <option value="{$language.code}">{$language.name}</option> {/foreach} </select> - <input type="submit" value="go" /> + <input type="submit" value="go"/> </form> </span> - {literal}<script type="text/javascript"> + {literal}<script language="javascript"> $(document).ready(function() { $("#languageSelection").fdd2div({CssClassName:"formDiv"}); $("#languageSelection").show(); diff --git a/plugins/LanguagesManager/tests/LanguagesManager.test.php b/plugins/LanguagesManager/tests/LanguagesManager.test.php index b7a0c84711..bdd44e3c90 100644 --- a/plugins/LanguagesManager/tests/LanguagesManager.test.php +++ b/plugins/LanguagesManager/tests/LanguagesManager.test.php @@ -19,62 +19,23 @@ class Test_Languages_Manager extends UnitTestCase // test all languages function test_getTranslationsForLanguages() { - $englishStrings = Piwik_LanguagesManager_API::getInstance()->getTranslationsForLanguage('en'); - $englishStringsWithParameters = array(); - foreach($englishStrings as $englishString) - { - $stringLabel = $englishString['label']; - $stringValue = $englishString['value']; - $count = $this->getCountParametersToReplace($stringValue); - if($count > 0) - { - $englishStringsWithParameters[$stringLabel] = $count; - } - } - // we also test that none of the language php files outputs any character on the screen (eg. space before the <?php) - $languages = Piwik_LanguagesManager_API::getInstance()->getAvailableLanguages(); + $languages = Piwik_LanguagesManager_API::getAvailableLanguages(); foreach($languages as $language) { ob_start(); - $strings = Piwik_LanguagesManager_API::getInstance()->getTranslationsForLanguage($language); + $strings = Piwik_LanguagesManager_API::getTranslationsForLanguage($language); $content = ob_get_flush(); $this->assertTrue(strpos(serialize($strings), "<script") === false, " language file containing javascript"); $this->assertTrue(count($strings) > 100); // at least 100 translations in the language file $this->assertTrue(strlen($content) == 0, "buffer was ".strlen($content)." long but should be zero. Translation file for '$language' must be buggy."); - - // checking that translated strings have the same number of %s as the english source strings - foreach($strings as $string) - { - $stringLabel = $string['label']; - $stringValue = $string['value']; - - if(!empty($stringValue) - && isset($englishStringsWithParameters[$stringLabel])) - { - $englishParametersCount = $englishStringsWithParameters[$stringLabel]; - $countTranslation = $this->getCountParametersToReplace($stringValue); - //$this->assertEqual($countTranslation, $englishParametersCount, - // "The string $stringLabel has $englishParametersCount parameters in English, but $countTranslation in the language $language."); - } - } } $this->pass(); } - private function getCountParametersToReplace($string) - { - $sprintfParameters = array('%s', '%1$s', '%2$s', '%3$s', '%4$s', '%5$s', '%6$s'); - $count = 0; - foreach($sprintfParameters as $parameter) - { - $count += substr_count($string, $parameter); - } - return $count; - } //test language when it's not defined function test_getTranslationsForLanguages_not() { - $this->assertFalse(Piwik_LanguagesManager_API::getInstance()->getTranslationsForLanguage("../no-language")); + $this->assertFalse(Piwik_LanguagesManager_API::getTranslationsForLanguage("../no-language")); } } diff --git a/plugins/Live/API.php b/plugins/Live/API.php index b6439a143f..8f688ff23b 100644 --- a/plugins/Live/API.php +++ b/plugins/Live/API.php @@ -11,277 +11,136 @@ */ /** - * @see plugins/Referers/functions.php - */ -require_once PIWIK_INCLUDE_PATH . '/plugins/Live/Visitor.php'; - -/** + * * @package Piwik_Live */ -class Piwik_Live_API +class Piwik_Live_API { static private $instance = null; + /* * @return Piwik_Live_API */ static public function getInstance() { if (self::$instance == null) - { + { $c = __CLASS__; self::$instance = new $c(); } return self::$instance; } - - const TYPE_FETCH_VISITS = 1; - const TYPE_FETCH_PAGEVIEWS = 2; /* * @return Piwik_DataTable */ - public function getLastVisitForVisitor( $visitorId, $idSite ) + public function getLastVisitForVisitor( $visitorId, $idSite = null ) { - return $this->getLastVisitsForVisitor($visitorId, $idSite, $limit = 1); + return $this->getLastVisitsForVisitor($visitorId, $idSite, 1); } - + /* * @return Piwik_DataTable */ public function getLastVisitsForVisitor( $visitorId, $idSite, $limit = 10 ) { - Piwik::checkUserHasViewAccess($idSite); - $visitorDetails = $this->loadLastVisitorDetailsFromDatabase($idSite, $visitorId, $limit); - $table = $this->getCleanedVisitorsFromDetails($visitorDetails, $idSite); + if(is_null($idSite)) + { + Piwik::checkUserIsSuperUser(); + } + else + { + Piwik::checkUserHasViewAccess($idSite); + } + $visitorDetails = self::loadLastVisitorDetailsFromDatabase($visitorId, $idSite, $limit); + $table = self::getCleanedVisitorsFromDetails($visitorDetails); return $table; } /* * @return Piwik_DataTable */ - public function getLastVisits( $idSite, $limit = 10, $minIdVisit = false ) + public function getLastVisits( $idSite = false, $limit = 10, $minIdVisit = false ) { - Piwik::checkUserHasViewAccess($idSite); - $visitorDetails = $this->loadLastVisitorDetailsFromDatabase($idSite, $visitorId = null, $limit, $minIdVisit); - $table = $this->getCleanedVisitorsFromDetails($visitorDetails, $idSite); + if(is_null($idSite)) + { + Piwik::checkUserIsSuperUser(); + } + else + { + Piwik::checkUserHasViewAccess($idSite); + } + $visitorDetails = self::loadLastVisitorDetailsFromDatabase(null, $idSite, $limit, $minIdVisit); + $table = self::getCleanedVisitorsFromDetails($visitorDetails); return $table; } - - /* - * @return Piwik_DataTable - */ - public function getLastVisitsDetails( $idSite, $limit = 1000, $minIdVisit = false ) - { - Piwik::checkUserHasViewAccess($idSite); - $visitorDetails = $this->loadLastVisitorDetailsFromDatabase($idSite, $visitorId = null, $limit, $minIdVisit); - $dataTable = $this->getCleanedVisitorsFromDetails($visitorDetails, $idSite); - return $dataTable; - } - - - /* - * @return Piwik_DataTable - */ - public function getUsersInLastXMin( $idSite, $minutes = 30 ) - { - Piwik::checkUserHasViewAccess($idSite); - $visitorData = $this->loadLastVisitorInLastXTimeFromDatabase($idSite, $minutes, $days = 0, self::TYPE_FETCH_VISITS); - return $visitorData; - } - - /* - * @return Piwik_DataTable - */ - public function getUsersInLastXDays( $idSite, $days = 10 ) - { - Piwik::checkUserHasViewAccess($idSite); - $visitorData = $this->loadLastVisitorInLastXTimeFromDatabase($idSite, $minutes = 0, $days, self::TYPE_FETCH_VISITS); - return $visitorData; - } - - /* - * @return array - */ - public function getPageImpressionsInLastXDays($idSite, $days = 10) - { - Piwik::checkUserHasViewAccess($idSite); - $visitorData = $this->loadLastVisitorInLastXTimeFromDatabase($idSite, $minutes = 0, $days, self::TYPE_FETCH_PAGEVIEWS); - return $visitorData; - } - - /* - * @return array - */ - public function getPageImpressionsInLastXMin($idSite, $minutes = 30) - { - Piwik::checkUserHasViewAccess($idSite); - $visitorData = $this->loadLastVisitorInLastXTimeFromDatabase($idSite, $minutes, $days = 0, self::TYPE_FETCH_PAGEVIEWS); - return $visitorData; - } /* * @return Piwik_DataTable */ - private function getCleanedVisitorsFromDetails($visitorDetails, $idSite) + static private function getCleanedVisitorsFromDetails($visitorDetails) { $table = new Piwik_DataTable(); - foreach($visitorDetails as $visitorDetail) { - $this->cleanVisitorDetails($visitorDetail); + self::cleanVisitorDetails($visitorDetail); $visitor = new Piwik_Live_Visitor($visitorDetail); $visitorDetailsArray = $visitor->getAllVisitorDetails(); - - $site = new Piwik_Site($idSite); - $timezone = $site->getTimezone(); - $dateTimeVisit = Piwik_Date::factory($visitorDetailsArray['firstActionTimestamp'], $timezone); + $dateTimeVisit = Piwik_Date::factory($visitorDetailsArray['firstActionTimestamp']); + //TODO TO FIX $visitorDetailsArray['serverDatePretty'] = $dateTimeVisit->getLocalized('%shortDay% %day% %shortMonth%'); $visitorDetailsArray['serverTimePretty'] = $dateTimeVisit->getLocalized('%time%'); - - // get Detail - 100 single SQL Statements - Performance Issue - $idvisit = $visitorDetailsArray['idVisit']; - - $sql = " - SELECT DISTINCT " .Piwik_Common::prefixTable('log_action').".name AS pageUrl - FROM " .Piwik_Common::prefixTable('log_link_visit_action')." - INNER JOIN " .Piwik_Common::prefixTable('log_action')." - ON " .Piwik_Common::prefixTable('log_link_visit_action').".idaction_url = " .Piwik_Common::prefixTable('log_action').".idaction - WHERE " .Piwik_Common::prefixTable('log_link_visit_action').".idvisit = $idvisit; - "; - - $visitorDetailsArray['actionDetails'] = Piwik_FetchAll($sql); - - $sql = " - SELECT DISTINCT " .Piwik_Common::prefixTable('log_action').".name AS pageUrl - FROM " .Piwik_Common::prefixTable('log_link_visit_action')." - INNER JOIN " .Piwik_Common::prefixTable('log_action')." - ON " .Piwik_Common::prefixTable('log_link_visit_action').".idaction_name = " .Piwik_Common::prefixTable('log_action').".idaction - WHERE " .Piwik_Common::prefixTable('log_link_visit_action').".idvisit = $idvisit; - "; - - $visitorDetailsArray['actionDetailsTitle'] = Piwik_FetchAll($sql); $table->addRowFromArray( array(Piwik_DataTable_Row::COLUMNS => $visitorDetailsArray)); } - return $table; } - + /* * @return array */ - private function loadLastVisitorDetailsFromDatabase($idSite, $visitorId = null, $limit = null, $minIdVisit = false ) + private function loadLastVisitorDetailsFromDatabase($visitorId = null, $idSite = null, $limit = null, $minIdVisit = false ) { $where = $whereBind = array(); - - $where[] = Piwik_Common::prefixTable('log_visit') . ".idsite = ? "; - $whereBind[] = $idSite; - - if(!empty($visitorId)) + + if(!is_null($idSite)) + { + $where[] = " idsite = ? "; + $whereBind[] = $idSite; + } + + if(!is_null($visitorId)) { - $where[] = Piwik_Common::prefixTable('log_visit') . ".visitor_idcookie = ? "; + $where[] = " visitor_idcookie = ? "; $whereBind[] = $visitorId; } - - if(!empty($minIdVisit)) + + if(!is_null($minIdVisit)) { - $where[] = Piwik_Common::prefixTable('log_visit') . ".idvisit > ? "; + $where[] = " idvisit > ? "; $whereBind[] = $minIdVisit; } - + $sqlWhere = ""; if(count($where) > 0) { $sqlWhere = " WHERE " . join(' AND ', $where); } - - $sql = "SELECT " . Piwik_Common::prefixTable('log_visit') . ".* , - " . Piwik_Common::prefixTable ( 'goal' ) . ".match_attribute - FROM " . Piwik_Common::prefixTable('log_visit') . " - LEFT JOIN ".Piwik_Common::prefixTable('log_conversion')." - ON " . Piwik_Common::prefixTable('log_visit') . ".idvisit = " . Piwik_Common::prefixTable('log_conversion') . ".idvisit - LEFT JOIN ".Piwik_Common::prefixTable('goal')." - ON (" . Piwik_Common::prefixTable('goal') . ".idsite = " . Piwik_Common::prefixTable('log_visit') . ".idsite - AND " . Piwik_Common::prefixTable('goal') . ".idgoal = " . Piwik_Common::prefixTable('log_conversion') . ".idgoal) - AND " . Piwik_Common::prefixTable('goal') . ".deleted = 0 - $sqlWhere - ORDER BY idsite,idvisit DESC + + $sql = "SELECT * + FROM " . Piwik::prefixTable('log_visit') . " + $sqlWhere + ORDER BY idvisit DESC LIMIT $limit"; - + return Piwik_FetchAll($sql, $whereBind); } - /** - * Load last Visitors PAGES or DETAILS in MINUTES or DAYS from database - * - * @param int $idSite - * @param int $minutes - * @param int $days - * @param int $type self::TYPE_FETCH_VISITS or self::TYPE_FETCH_PAGEVIEWS + /* * - * @return mixed - */ - private function loadLastVisitorInLastXTimeFromDatabase($idSite, $minutes = 0, $days = 0, $type = false ) - { - $where = $whereBind = array(); - - $where[] = " " . Piwik_Common::prefixTable('log_visit') . ".idsite = ? "; - $whereBind[] = $idSite; - - if($minutes != 0) - { - $timeLimit = mktime(date("H"), date("i") - $minutes, 0, date("m"), date("d"), date("Y")); - $where[] = " visit_last_action_time > '".date('Y-m-d H:i:s',$timeLimit)."'"; - } - - if($days != 0) - { - $timeLimit = mktime(0, 0, 0, date("m"), date("d") - $days + 1, date("Y")); - $where[] = " visit_last_action_time > '".date('Y-m-d H:i:s', $timeLimit)."'"; - } - - $sqlWhere = ""; - if(count($where) > 0) - { - $sqlWhere = " WHERE " . join(' AND ', $where); - } - - // Details - if($type == self::TYPE_FETCH_VISITS) - { - $sql = "SELECT " . Piwik_Common::prefixTable('log_visit') . ".idvisit - FROM " . Piwik_Common::prefixTable('log_visit') . " - $sqlWhere - ORDER BY idsite,idvisit DESC"; - } - // Pages - elseif($type == self::TYPE_FETCH_PAGEVIEWS) - { - $sql = "SELECT " . Piwik_Common::prefixTable('log_link_visit_action') . ".idaction_url - FROM " . Piwik_Common::prefixTable('log_link_visit_action') . " - INNER JOIN " . Piwik_Common::prefixTable('log_visit') . " - ON " . Piwik_Common::prefixTable('log_visit') . ".idvisit = " . Piwik_Common::prefixTable('log_link_visit_action') . ".idvisit - $sqlWhere"; - } - else - { - // no $type is set --> ERROR - throw new Exception("type parameter is not properly set."); - } - - // return $sql by fetching - return Piwik_FetchAll($sql, $whereBind); - } - - - /** - * Removes fields that are not meant to be displayed (md5 config hash) - * Or that the user should only access if he is super user (cookie, IP) - * - * @return void */ - private function cleanVisitorDetails( &$visitorDetails ) + static private function cleanVisitorDetails( &$visitorDetails ) { - $toUnset = array('config_md5config'); + $toUnset = array('config_md5config'); if(!Piwik::isUserIsSuperUser()) { $toUnset[] = 'visitor_idcookie'; @@ -295,5 +154,4 @@ class Piwik_Live_API } } } - } diff --git a/plugins/Live/Controller.php b/plugins/Live/Controller.php index c35be89d06..5c60d5a6e3 100644 --- a/plugins/Live/Controller.php +++ b/plugins/Live/Controller.php @@ -1,184 +1,57 @@ <?php /** * Piwik - Open source web analytics - * + * * @link http://piwik.org * @license http://www.gnu.org/licenses/gpl-3.0.html Gpl v3 or later * @version $Id$ - * + * * @category Piwik_Plugins * @package Piwik_Live */ /** + * * @package Piwik_Live */ class Piwik_Live_Controller extends Piwik_Controller { - function __construct() - { - parent::__construct(); - $this->idSite = Piwik_Common::getRequestVar('idSite'); - $this->minIdVisit = Piwik_Common::getRequestVar('minIdVisit', 0, 'int'); - } - - function index() + function widget() { - $this->widget(true); - } - - public function widget($fetch = false) - { - $view = Piwik_View::factory('index'); - $view->idSite = Piwik_Common::getRequestVar('idSite'); - $view->visitorsCountHalfHour = $this->getUsersInLastXMin(30); - $view->visitorsCountToday = $this->getUsersInLastXDays(1); - $view->pisHalfhour = $this->getPageImpressionsInLastXMin(30); - $view->pisToday = $this->getPageImpressionsInLastXDays(1); - $view->visitors = $this->getLastVisitsStart($fetch = true); - + $view = Piwik_View::factory('index'); + $this->setGeneralVariablesView($view); + $view->visitors = $this->getLastVisits($fetch = true); echo $view->render(); } - - public function getLastVisitsDetails($fetch = false) + + function getLastVisits($fetch = false) { - $view = Piwik_ViewDataTable::factory(''); - $view->init( $this->pluginName, - __FUNCTION__, - 'Live.getLastVisitsDetails', - 'getPagesFromVisitId'); -// All colomns in DB which could be shown -//'ip', 'idVisit', 'countActions', 'isVisitorReturning', 'country', 'countryFlag', 'continent', 'provider', 'providerUrl', 'idSite', -//'serverDate', 'visitLength', 'visitLengthPretty', 'firstActionTimestamp', 'lastActionTimestamp', 'refererType', 'refererName', -//'keywords', 'refererUrl', 'searchEngineUrl', 'searchEngineIcon', 'operatingSystem', 'operatingSystemShortName', 'operatingSystemIcon', -//'browserFamily', 'browserFamilyDescription', 'browser', 'browserIcon', 'screen', 'resolution', 'screenIcon', 'plugins', 'lastActionDateTime', -//'serverDatePretty', 'serverTimePretty', 'actionDetails' - - $view->setColumnsToDisplay(array( - 'idVisit', - 'serverDatePretty', - 'serverTimePretty', - 'ip', - 'countActions', - 'visitLengthPretty', - 'keywords', - 'refererUrl', - 'operatingSystemShortName', - 'browser', - 'screen', - 'resolution', - 'plugins', - )); - - $view->setColumnsTranslations(array( - 'idVisit' => Piwik_Translate(''), - 'serverDatePretty' => Piwik_Translate('Live_Date'), - 'serverTimePretty' => Piwik_Translate('Live_Time'), - 'ip' => 'IP', - 'countActions' => Piwik_Translate('VisitorInterest_ColumnPagesPerVisit'), - 'visitLengthPretty' => Piwik_Translate('VisitorInterest_ColumnVisitDuration'), - 'keywords' => Piwik_Translate('Referers_ColumnKeyword'), - 'refererUrl' => Piwik_Translate('Live_Referrer_URL'), - 'operatingSystemShortName' => Piwik_Translate('UserSettings_ColumnOperatingSystem'), - 'browser' => Piwik_Translate('UserSettings_ColumnBrowser'), - 'screen' => Piwik_Translate('UserSettings_ColumnTypeOfScreen'), - 'resolution' => Piwik_Translate('UserSettings_ColumnResolution'), - 'plugins' => Piwik_Translate('UserSettings_ColumnPlugin'), - )); - - $view->disableSort(); - $view->setLimit(10); - $view->disableExcludeLowPopulation(); - $view->setSortedColumn('idVisit', 'ASC'); - $view->disableSearchBox(); - // "Include low population" link won't be displayed under this table - $view->disableExcludeLowPopulation(); - // disable the tag cloud, pie charts, bar chart icons - $view->disableShowAllViewsIcons(); - // disable the button "show more datas" - $view->disableShowAllColumns(); - - return $this->renderView($view, $fetch); - } - - function getPagesFromVisitId( $fetch = false) - { - $view = Piwik_ViewDataTable::factory(''); - $view->init( $this->pluginName, - __FUNCTION__, - 'Live.getLastVisitsForVisitor', - 'getPagesFromVisitId'); - - return $this->renderView($view, $fetch); - } - - public function getLastVisitsStart($fetch = false) - { - $view = Piwik_View::factory('lastVisits'); - $view->idSite = Piwik_Common::getRequestVar('idSite'); + $idSite = Piwik_Common::getRequestVar('idSite', null, 'int'); + $minIdVisit = Piwik_Common::getRequestVar('minIdVisit', 0, 'int'); + $limit = 10; + $api = new Piwik_API_Request("method=Live.getLastVisits&idSite=$idSite&limit=$limit&minIdVisit=$minIdVisit&format=php&serialize=0&disable_generic_filters=1"); - $view->visitors = $this->getLastVisits(10); - + $view = Piwik_View::factory('lastVisits'); + $visitors = $api->process(); + if($minIdVisit == 0) + { + $visitors = array_slice($visitors, 3); + } + $view->visitors = $visitors; $rendered = $view->render($fetch); - + if($fetch) { return $rendered; } echo $rendered; } - - public function getLastVisits($limit = 10) - { - $api = new Piwik_API_Request("method=Live.getLastVisits&idSite=$this->idSite&limit=$limit&format=php&serialize=0&disable_generic_filters=1"); - $visitors = $api->process(); - - return $visitors; - } - - public function getUsersInLastXMin($minutes = 30) { - $api = new Piwik_API_Request("method=Live.getUsersInLastXMin&idSite=".$this->idSite."&minutes=".$minutes."&format=php&serialize=0&disable_generic_filters=1"); - $visitors_halfhour = $api->process(); - - return count($visitors_halfhour); - } - - public function getUsersInLastXDays($days = 1) { - $api = new Piwik_API_Request("method=Live.getUsersInLastXDays&idSite=$this->idSite&days=$days&format=php&serialize=0&disable_generic_filters=1"); - $visitors_today = $api->process(); - - return count($visitors_today); - } - - public function getPageImpressionsInLastXMin($minutes = 30) { - $api = new Piwik_API_Request("method=Live.getPageImpressionsInLastXMin&idSite=$this->idSite&minutes=$minutes&format=php&serialize=0&disable_generic_filters=1"); - $pis_halfhour = $api->process(); - - return count($pis_halfhour); - } - - public function getPageImpressionsInLastXDays($days = 1) { - $api = new Piwik_API_Request("method=Live.getPageImpressionsInLastXDays&idSite=$this->idSite&days=$days&format=php&serialize=0&disable_generic_filters=1"); - $pis_today = $api->process(); - - return count($pis_today); - } - - public function ajaxTotalVisitors($fetch = false) + + function index() { - $view = Piwik_View::factory('totalVisits'); - $view->idSite = Piwik_Common::getRequestVar('idSite'); - $view->visitorsCountHalfHour = $this->getUsersInLastXMin(30); - $view->visitorsCountToday = $this->getUsersInLastXDays(1); - $view->pisHalfhour = $this->getPageImpressionsInLastXMin(30); - $view->pisToday = $this->getPageImpressionsInLastXDays(1); - - $rendered = $view->render($fetch); - - if($fetch) - { - return $rendered; - } - echo $rendered; + $view = Piwik_View::factory('structure'); + $this->setGeneralVariablesView($view); + $view->visitors = $this->getLastVisits($fetch = true); + echo $view->render(); } } diff --git a/plugins/Live/Live.php b/plugins/Live/Live.php index 4fbec02c54..f659a8ae0e 100644 --- a/plugins/Live/Live.php +++ b/plugins/Live/Live.php @@ -1,16 +1,30 @@ <?php /** * Piwik - Open source web analytics - * + * * @link http://piwik.org * @license http://www.gnu.org/licenses/gpl-3.0.html Gpl v3 or later * @version $Id$ - * + * * @category Piwik_Plugins * @package Piwik_Live */ /** + TODO Live! Plugin + ==== + - api propre + - html + - jquery spy + - make sure only one query is launched at once or what if requests takes more than 10s to succeed? + - simple stats above in TEXT + - Security review + - blog post, push version + +//TODO add api to get actions name/count/first/last/etc + */ + +/** * * @package Piwik_Live */ @@ -19,34 +33,13 @@ class Piwik_Live extends Piwik_Plugin public function getInformation() { return array( - 'description' => Piwik_Translate('Live_PluginDescription'), + 'name' => 'Live Visitors', + 'description' => 'Live Visitors!', 'author' => 'Piwik', - 'author_homepage' => 'http://piwik.org/', - 'version' => Piwik_Version::VERSION, - ); - } - - function getListHooksRegistered() - { - return array( - 'template_css_import' => 'css', - 'WidgetsList.add' => 'addWidget', - 'Menu.add' => 'addMenu', + 'homepage' => 'http://piwik.org/', + 'version' => '0.1', ); } - - function css() - { - echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"themes/default/styles.css\" />\n"; - } - - function addMenu() - { - Piwik_AddMenu('General_Visitors', 'Live_VisitorLog', array('module' => 'Live', 'action' => 'getLastVisitsDetails')); - } - - public function addWidget() { - Piwik_AddWidget('Live!', 'Live Visitors!', 'Live', 'widget'); - } - } + +Piwik_AddWidget('Live!', 'Live Visitors!', 'Live', 'widget'); diff --git a/plugins/Live/Visitor.php b/plugins/Live/Visitor.php index 1ac82ebddc..8887566009 100644 --- a/plugins/Live/Visitor.php +++ b/plugins/Live/Visitor.php @@ -1,22 +1,24 @@ <?php /** * Piwik - Open source web analytics - * + * * @link http://piwik.org * @license http://www.gnu.org/licenses/gpl-3.0.html Gpl v3 or later * @version $Id$ - * + * * @category Piwik_Plugins * @package Piwik_Live */ +// no direct access +defined('PIWIK_INCLUDE_PATH') or die; + /** * @see plugins/Referers/functions.php * @see plugins/UserCountry/functions.php * @see plugins/UserSettings/functions.php * @see plugins/Provider/functions.php */ - require_once PIWIK_INCLUDE_PATH . '/plugins/Referers/functions.php'; require_once PIWIK_INCLUDE_PATH . '/plugins/UserCountry/functions.php'; require_once PIWIK_INCLUDE_PATH . '/plugins/UserSettings/functions.php'; @@ -32,7 +34,7 @@ class Piwik_Live_Visitor { $this->details = $visitorRawData; } - + function getAllVisitorDetails() { return array( @@ -51,7 +53,7 @@ class Piwik_Live_Visitor 'visitLengthPretty' => $this->getVisitLengthPretty(), 'firstActionTimestamp' => $this->getTimestampFirstAction(), 'lastActionTimestamp' => $this->getTimestampLastAction(), - + 'refererType' => $this->getRefererType(), 'refererName' => $this->getRefererTypeName(), 'keywords' => $this->getKeywords(), @@ -59,7 +61,7 @@ class Piwik_Live_Visitor 'refererName' => $this->getRefererName(), 'searchEngineUrl' => $this->getSearchEngineUrl(), 'searchEngineIcon' => $this->getSearchEngineIcon(), - + 'operatingSystem' => $this->getOperatingSystem(), 'operatingSystemShortName' => $this->getOperatingSystemShortName(), 'operatingSystemIcon' => $this->getOperatingSystemIcon(), @@ -71,18 +73,14 @@ class Piwik_Live_Visitor 'resolution' => $this->getResolution(), 'screenIcon' => $this->getScreenTypeIcon(), 'plugins' => $this->getPlugins(), - 'lastActionDateTime' => $this->getDateTimeLastAction(), - 'isVisitorGoalConverted' => $this->isVisitorGoalConverted(), - 'goalIcon' => $this->getGoalIcon(), - 'goalType' => $this->getGoalType(), ); } - + function getServerDate() { - return date('Y-m-d', strtotime($this->details['visit_last_action_time'])); + return $this->details['visit_server_date']; } - + function getIp() { if(isset($this->details['location_ip'])) @@ -91,17 +89,17 @@ class Piwik_Live_Visitor } return false; } - + function getIdVisit() { return $this->details['idvisit']; } - + function getIdSite() { return $this->details['idsite']; } - + function getNumberOfActions() { return $this->details['visit_total_actions']; @@ -111,42 +109,42 @@ class Piwik_Live_Visitor { return $this->details['visit_total_time']; } - + function getVisitLengthPretty() { return Piwik::getPrettyTimeFromSeconds($this->details['visit_total_time']); } - + function isVisitorReturning() { return $this->details['visitor_returning']; } - + function getTimestampFirstAction() { return strtotime($this->details['visit_first_action_time']); } - + function getTimestampLastAction() { return strtotime($this->details['visit_last_action_time']); } - + function getCountryName() { return Piwik_CountryTranslate($this->details['location_country']); } - + function getCountryFlag() { return Piwik_getFlagFromCode($this->details['location_country']); } - + function getContinent() { return Piwik_ContinentTranslate($this->details['location_continent']); } - + function getRefererType() { $map = array( @@ -161,27 +159,27 @@ class Piwik_Live_Visitor } return $map[Piwik_Common::REFERER_TYPE_DIRECT_ENTRY]; } - + function getRefererTypeName() { return Piwik_getRefererTypeLabel($this->details['referer_type']); } - + function getKeywords() { return $this->details['referer_keyword']; } - + function getRefererUrl() { - return $this->details['referer_url']; + return $this->details['referer_url']; } - + function getRefererName() { - return $this->details['referer_name']; + return $this->details['referer_name']; } - + function getSearchEngineUrl() { if($this->getRefererType() == 'searchEngine' @@ -191,7 +189,7 @@ class Piwik_Live_Visitor } return null; } - + function getSearchEngineIcon() { $searchEngineUrl = $this->getSearchEngineUrl(); @@ -204,7 +202,7 @@ class Piwik_Live_Visitor function getPlugins() { - $plugins = array( + $plugins = array( 'config_pdf', 'config_flash', 'config_java', @@ -218,10 +216,10 @@ class Piwik_Live_Visitor $return = array(); foreach($plugins as $plugin) { - if($this->details[$plugin] == 1) + if($this->details[$plugin] == 1) { $pluginShortName = substr($plugin, 7); - $return[] = $pluginShortName; + $return[] = $pluginShortName; } } return implode(", ", $return); @@ -231,12 +229,12 @@ class Piwik_Live_Visitor { return Piwik_getOSLabel($this->details['config_os']); } - + function getOperatingSystemShortName() { return Piwik_getOSShortLabel($this->details['config_os']); } - + function getOperatingSystemIcon() { return Piwik_getOSLogo($this->details['config_os']); @@ -246,82 +244,44 @@ class Piwik_Live_Visitor { return Piwik_getBrowserTypeLabel($this->getBrowserFamily()); } - + function getBrowserFamily() { return Piwik_getBrowserFamily($this->details['config_browser_name']); } - + function getBrowser() { return Piwik_getBrowserLabel($this->details['config_browser_name'] . ";" . $this->details['config_browser_version']); } - + function getBrowserIcon() { return Piwik_getBrowsersLogo($this->details['config_browser_name'] . ";" . $this->details['config_browser_version']); } - + function getScreenType() { return Piwik_getScreenTypeFromResolution($this->details['config_resolution']); } - + function getResolution() { return $this->details['config_resolution']; } - + function getScreenTypeIcon() { return Piwik_getScreensLogo($this->getScreenType()); } - + function getProvider() { return Piwik_getHostnameName($this->details['location_provider']); } - + function getProviderUrl() { return Piwik_getHostnameUrl($this->details['location_provider']); } - - function getDateTimeLastAction() - { - return date('Y-m-d H:i:s', strtotime($this->details['visit_last_action_time'])); - } - - function isVisitorGoalConverted() - { - return $this->details['visit_goal_converted']; - } - - function getGoalType() - { - if(isset($this->details['match_attribute'])){ - return $this->details['match_attribute']; - } - return false; - } - - function getGoalIcon() - { - if(isset($this->details['match_attribute'])){ - $goalicon = ""; - switch ($this->details['match_attribute']) { - case "url": - $goalicon = "plugins/Live/templates/images/goal.png"; - break; - case "file": - $goalicon = "plugins/Live/templates/images/download.png"; - break; - case "external_website": - $goalicon = "plugins/Live/templates/images/outboundlink.png"; - break; - } - return $goalicon; - } - return false; - } } diff --git a/plugins/Live/templates/images/download.png b/plugins/Live/templates/images/download.png Binary files differdeleted file mode 100644 index 1920b1bb22..0000000000 --- a/plugins/Live/templates/images/download.png +++ /dev/null diff --git a/plugins/Live/templates/images/file0.png b/plugins/Live/templates/images/file0.png Binary files differdeleted file mode 100644 index 2c6ce30fe3..0000000000 --- a/plugins/Live/templates/images/file0.png +++ /dev/null diff --git a/plugins/Live/templates/images/file1.png b/plugins/Live/templates/images/file1.png Binary files differdeleted file mode 100644 index 074e577058..0000000000 --- a/plugins/Live/templates/images/file1.png +++ /dev/null diff --git a/plugins/Live/templates/images/file2.png b/plugins/Live/templates/images/file2.png Binary files differdeleted file mode 100644 index 48aeb390f2..0000000000 --- a/plugins/Live/templates/images/file2.png +++ /dev/null diff --git a/plugins/Live/templates/images/file3.png b/plugins/Live/templates/images/file3.png Binary files differdeleted file mode 100644 index 0827cabe17..0000000000 --- a/plugins/Live/templates/images/file3.png +++ /dev/null diff --git a/plugins/Live/templates/images/file4.png b/plugins/Live/templates/images/file4.png Binary files differdeleted file mode 100644 index a4c277981e..0000000000 --- a/plugins/Live/templates/images/file4.png +++ /dev/null diff --git a/plugins/Live/templates/images/file5.png b/plugins/Live/templates/images/file5.png Binary files differdeleted file mode 100644 index 5701f2b274..0000000000 --- a/plugins/Live/templates/images/file5.png +++ /dev/null diff --git a/plugins/Live/templates/images/file6.png b/plugins/Live/templates/images/file6.png Binary files differdeleted file mode 100644 index 5099a0222d..0000000000 --- a/plugins/Live/templates/images/file6.png +++ /dev/null diff --git a/plugins/Live/templates/images/file7.png b/plugins/Live/templates/images/file7.png Binary files differdeleted file mode 100644 index 8559758b56..0000000000 --- a/plugins/Live/templates/images/file7.png +++ /dev/null diff --git a/plugins/Live/templates/images/file8.png b/plugins/Live/templates/images/file8.png Binary files differdeleted file mode 100644 index 515bd791d7..0000000000 --- a/plugins/Live/templates/images/file8.png +++ /dev/null diff --git a/plugins/Live/templates/images/file9.png b/plugins/Live/templates/images/file9.png Binary files differdeleted file mode 100644 index c06ec15bdb..0000000000 --- a/plugins/Live/templates/images/file9.png +++ /dev/null diff --git a/plugins/Live/templates/images/goal.png b/plugins/Live/templates/images/goal.png Binary files differdeleted file mode 100644 index e4bc611f87..0000000000 --- a/plugins/Live/templates/images/goal.png +++ /dev/null diff --git a/plugins/Live/templates/images/outboundlink.png b/plugins/Live/templates/images/outboundlink.png Binary files differdeleted file mode 100644 index 0010931e2c..0000000000 --- a/plugins/Live/templates/images/outboundlink.png +++ /dev/null diff --git a/plugins/Live/templates/index.tpl b/plugins/Live/templates/index.tpl index 617dc91660..5c012ea5cc 100644 --- a/plugins/Live/templates/index.tpl +++ b/plugins/Live/templates/index.tpl @@ -1,49 +1,28 @@ +<h2>Live! (alpha)</h2> {literal} <script type="text/javascript" src="plugins/Live/templates/scripts/spy.js"></script> <script type="text/javascript" charset="utf-8"> - - $(document).ready(function() { - if($('#_spyTmp').size() == 0) { - $('#visitsLive > div:gt(2)').fadeEachDown(); // initial fade - $('#visitsLive').spy({ - limit: 10, - ajax: 'index.php?module=Live&idSite={/literal}{$idSite}{literal}&action=getLastVisitsStart', - fadeLast: 2, - isDupe: check_for_dupe, - timeout: 8000, - customParameterName: 'minIdVisit', - customParameterValueCallback: lastIdVisit, - fadeInSpeed: 600 - }); - } + $(document).ready(function() { + $('#visits').spy({ + limit: 10, + ajax: 'index.php?module=Live&idSite=1&action=getLastVisits', + timeout: 500, + customParameterName: 'minIdVisit', + customParameterValueCallback: lastIdVisit, + fadeInSpeed: 1400 } + ); }); - - // first I'm ensuring that 'last' has been initialised (with last.constructor == Object), - // then prev.html() == last.html() will return true if the HTML is the same, or false, - // if I have a different entry. - function check_for_dupe(prev, last) - { - if (last.constructor == Object) { - return (prev.html() == last.html()); - } - else { - return 0; - } - } - + function lastIdVisit() { - updateTotalVisits(); - updateVisitBox(); - return $('#visitsLive > div:lt(2) .idvisit').html(); + return $('#visits > div:lt(2) .idvisit').html(); } - var pauseImage = "plugins/Live/templates/images/pause.gif"; var pauseDisabledImage = "plugins/Live/templates/images/pause_disabled.gif"; var playImage = "plugins/Live/templates/images/play.gif"; var playDisabledImage = "plugins/Live/templates/images/play_disabled.gif"; - + function onClickPause() { $('#pauseImage').attr('src', pauseImage); @@ -57,127 +36,50 @@ return playSpy(); } - // updates the numbers of total visits in startbox - function updateTotalVisits() - { - $("#visitsTotal").load("index.php?module=Live&idSite={/literal}{$idSite}{literal}&action=ajaxTotalVisitors"); - } - - // updates the visit table, to refresh the already presented visotors pages - function updateVisitBox() - { - $("#visitsLive").load("index.php?module=Live&idSite={/literal}{$idSite}{literal}&action=getLastVisitsStart"); - } - - /* TOOLTIP */ - $('#visitsLive label').tooltip({ - track: true, - delay: 0, - showURL: false, - showBody: " - ", - fade: 250 - }); - </script> <style> -#visitsLive { - text-align:left; - font-size:90%; -} -#visitsLive .datetime, #visitsLive .country, #visitsLive .referer, #visitsLive .settings, #visitsLive .returning , #visitsLive .countActions{ - border-bottom:1px solid #C1DAD7; - border-right:1px solid #C1DAD7; - padding:5px 5px 5px 12px; -} - -#visitsLive .datetime { - background:#D4E3ED url(plugins/CoreHome/templates/images/bg_header.jpg) repeat-x scroll 0 0; - border-top:1px solid #C1DAD7; - color:#6D929B; - margin:0; +#visits { text-align:left; } - -#visitsLive .country { - color:#4F6B72; - background:#FFFFFF url(plugins/CoreHome/templates/images/bullet1.gif) no-repeat scroll 0 0; -} - -#visitsLive .referer { - background:#F9FAFA none repeat scroll 0 0; - color:#797268; -} - -#visitsLive .pagesTitle { - display:block; +#visits .datetime, #visits .country, #visits .referer, #visits .settings, #visits .returning { float:left; - padding-top: 3px; + margin-right:10px; + overflow:hidden; + padding-left:1px; + max-width:700px; } - -#visitsLive .countActions { - background:#FFFFFF none repeat scroll 0 0; - color:#4F6B72; +#visits .datetime { + width:110px; } - -#visitsLive .settings { - background:#FFFFFF none repeat scroll 0 0; - color:#4F6B72; +#visits .country { + width:30px; } - -#visitsLive .returning { - background:#F9FAFA none repeat scroll 0 0; - color:#797268; +#visits .referer { + width:200px; } - -#visitsLive .visit { +#visits .settings { + width:100px; } - -#visitsLive .alt { +#visits .returning { + width:30px; } - -#visitsLive .actions { - background:#F9FAFA none repeat scroll 0 0; - color:#797268; - padding:0px 5px 0px 12px; +#visits .visit { + border-bottom:1px solid #C1DAD7; + background-color:#F9FAFA; + padding:10px; + line-height:24px; + height:40px; +} +#visits .alt { + background-color:#FFFFFF; } - </style> {/literal} -<div id="visitsTotal"> - <table class="dataTable" cellspacing="0"> - <thead> - <tr> - <th id="label" class="sortable label" style="cursor: auto;"> - <div id="thDIV">Period<div></th> - <th id="label" class="sortable label" style="cursor: auto;"> - <div id="thDIV">Visits<div></th> - <th id="label" class="sortable label" style="cursor: auto;"> - <div id="thDIV">PageViews<div></th> - </tr> - </thead> - <tbody> - <tr> - <tr class=""> - <td class="columnodd">Today</td> - <td class="columnodd">{$visitorsCountToday}</td> - <td class="columnodd">{$pisToday}</td> - </tr> - <tr class=""> - <td class="columnodd">Last 30 minutes</td> - <td class="columnodd">{$visitorsCountHalfHour}</td> - <td class="columnodd">{$pisHalfhour}</td> - </tr> - </tbody> - </table> -</div> - -<div id='visitsLive'> {$visitors} -</div> <div> - <a href="javascript:void(0);" onclick="onClickPause();"><img id="pauseImage" border="0" src="plugins/Live/templates/images/pause_disabled.gif" /></a> - <a href="javascript:void(0);" onclick="onClickPlay();"><img id="playImage" border="0" src="plugins/Live/templates/images/play.gif" /></a> -</div> + <a href="#?" onclick="onClickPause();"><img id="pauseImage" border="0" src="plugins/Live/templates/images/pause_disabled.gif"></a> + <a href="#?" onclick="onClickPlay();"><img id="playImage" border="0" src="plugins/Live/templates/images/play.gif"></a> +</div>
\ No newline at end of file diff --git a/plugins/Live/templates/lastVisits.tpl b/plugins/Live/templates/lastVisits.tpl index e67ab5ec71..ac515f2d63 100644 --- a/plugins/Live/templates/lastVisits.tpl +++ b/plugins/Live/templates/lastVisits.tpl @@ -1,35 +1,15 @@ +<div id="visits"> {foreach from=$visitors item=visitor} - <div id="{$visitor.idVisit}" class="visit{if $visitor.idVisit % 2} alt{/if}"> + <div class="visit{if $visitor.idVisit % 2} alt{/if}"> <div style="display:none" class="idvisit">{$visitor.idVisit}</div> - <div class="datetime"> - {$visitor.serverDatePretty} - {$visitor.serverTimePretty} - <img src="{$visitor.countryFlag}" title="{$visitor.country}, Provider {$visitor.provider}" /> - <img src="{$visitor.browserIcon}" title="{$visitor.browser} with plugins {$visitor.plugins} enabled" /> - <img src="{$visitor.operatingSystemIcon}" title="{$visitor.operatingSystem}, {$visitor.resolution}" /> - {if $visitor.isVisitorGoalConverted}<img src="{$visitor.goalIcon}" title="{$visitor.goalType}" />{/if} - {if $visitor.isVisitorReturning} <img src="plugins/Live/templates/images/returningVisitor.gif" title="Returning Visitor" />{/if} - <label id="" title="IP: {$visitor.ip} - Duration: {$visitor.visitLengthPretty}">more...</label> - </div> - <!--<div class="settings"></div>--> - <div class="referer"> - {if $visitor.refererType != 'directEntry'}from <a href="{$visitor.refererUrl}" target="_blank">{if !empty($visitor.searchEngineIcon)}<img src="{$visitor.searchEngineIcon}" /> {/if}{$visitor.refererName}</a> - {if !empty($visitor.keywords)}"{$visitor.keywords}"{/if} - {/if} - {if $visitor.refererType == 'directEntry'}Direct entry{/if} - </div> - <div id="{$visitor.idVisit}_actions" class="settings"> - <span class="pagesTitle">Pages:</span> - {php} $col = 0; {/php} - {foreach from=$visitor.actionDetails item=action} - {php} - $col++; - if ($col>=9) - { - $col=0; - } - {/php} - <a href="{$action.pageUrl}" target="_blank"><img align="middle" src="plugins/Live/templates/images/file{php} echo $col; {/php}.png" title="{$action.pageUrl}" /></a> - {/foreach} + <div class="datetime">{$visitor.serverDatePretty}<br/>{$visitor.serverTimePretty}</div> + <div class="country"><img src="{$visitor.countryFlag}" title="{$visitor.country}, Provider {$visitor.provider}"></div> + <div class="referer">{if $visitor.refererType != 'directEntry'}from <a href="{$visitor.refererUrl}">{$visitor.refererName}</a> {if !empty($visitor.keywords)}"{$visitor.keywords}"{/if}{/if}</div> + <div class="settings"> + <img src="{$visitor.browserIcon}" title="{$visitor.browser} with plugins {$visitor.plugins} enabled"> + <img src="{$visitor.operatingSystemIcon}" title="{$visitor.operatingSystem}, {$visitor.resolution}"> </div> + <div class="returning">{if $visitor.isVisitorReturning}<img src="plugins/Live/templates/images/returningVisitor.gif" title="Returning Visitor">{/if}</div> </div> {/foreach} +</div> diff --git a/plugins/Live/templates/scripts/spy.js b/plugins/Live/templates/scripts/spy.js index 27454fe029..c2fb38863c 100644 --- a/plugins/Live/templates/scripts/spy.js +++ b/plugins/Live/templates/scripts/spy.js @@ -12,12 +12,12 @@ $.fn.spy = function(settings) { spy.parsing = 0; spy.waitTimer = 0; spy.json = null; - + if (!settings.ajax) { alert("An AJAX/AJAH URL must be set for the spy to work."); return; } - + spy.attachHolder = function() { // not mad on this, but the only way to parse HTML collections if (o.method == 'html') @@ -37,7 +37,7 @@ $.fn.spy = function(settings) { else return 0; } - + spy.parse = function(e, r) { spy.parsing = 1; // flag to stop pull via ajax if (o.method == 'html') { @@ -45,7 +45,7 @@ $.fn.spy = function(settings) { } else if (o.method == 'json') { eval('spy.json = ' + r); // convert text to json } - + if ((o.method == 'json' && spy.json.constructor == Array) || o.method == 'html') { if (spy.parseItem(e)) { spy.waitTimer = window.setInterval(function() { @@ -65,7 +65,7 @@ $.fn.spy = function(settings) { spy.parsing = 0; } } - + // returns true if there's more to parse spy.parseItem = function(e) { if (o.method == 'html') { @@ -74,7 +74,7 @@ $.fn.spy = function(settings) { if (i.size() > 0) { i.hide(); spy.addItem(e, i); - } + } return ($('div#_spyTmp').find('div').size() != 0); } else { if (spy.json.length) { @@ -85,21 +85,20 @@ $.fn.spy = function(settings) { return (spy.json.length != 0); } } - + spy.addItem = function(e, i) { if (! o.isDupe.call(this, i, spy.last)) { spy.last = i; // note i is a pointer - so when it gets modified, so does spy.last - $('#' + e.id + ' > div:gt(' + (o.limit - 2) + ')').remove(); - $('#' + e.id + ' > div:gt(' + (o.limit - o.fadeLast - 2) + ')').fadeEachDown(); + $('#' + e.id + ' > div:gt(' + (o.limit - 1) + ')').remove(); o.push.call(e, i); $('#' + e.id + ' > div:first').fadeIn(o.fadeInSpeed); } } - + spy.push = function(r) { $('#' + this.id).prepend(r); } - + var o = { limit: (settings.limit || 10), ajax: settings.ajax, @@ -110,7 +109,7 @@ $.fn.spy = function(settings) { fadeInSpeed: (settings.fadeInSpeed || 'slow'), // 1400 = crawl customParameterName: settings.customParameterName, customParameterValueCallback: settings.customParameterValueCallback, - isDupe: (settings.isDupe || spy.isDupe) + isDupe: (settings.isDupe || spy.isDupe), }; spy.attachHolder(); @@ -126,22 +125,11 @@ $.fn.spy = function(settings) { $.get(o.ajax, parameters, function(r) { spy.parse(e, r); }); - } + } }, o.timeout); }); }; -$.fn.fadeEachDown = function() { - var s = this.size()+5; - return this.each(function(i) { - var o = 1 - (s == 1 ? 0.5 : 0.85/s*(i+1)); - var e = this.style; - if (window.ActiveXObject) - e.filter = "alpha(opacity=" + o*100 + ")"; - e.opacity = o; - }); -}; - function pauseSpy() { spyRunning = 0; return false; } @@ -149,6 +137,3 @@ function pauseSpy() { function playSpy() { spyRunning = 1; return false; } - - - diff --git a/plugins/Live/templates/structure.tpl b/plugins/Live/templates/structure.tpl new file mode 100644 index 0000000000..a3bbc0f4f6 --- /dev/null +++ b/plugins/Live/templates/structure.tpl @@ -0,0 +1,5 @@ +{assign var=showSitesSelection value=true} +{assign var=showPeriodSelection value=false} +{include file="CoreAdminHome/templates/header.tpl"} +{include file="Live/templates/index.tpl"} + diff --git a/plugins/Live/templates/totalVisits.tpl b/plugins/Live/templates/totalVisits.tpl deleted file mode 100644 index a7294d7853..0000000000 --- a/plugins/Live/templates/totalVisits.tpl +++ /dev/null @@ -1,26 +0,0 @@ -<div id="visitsTotal"> - <table class="dataTable" cellspacing="0"> - <thead> - <tr> - <th id="label" class="sortable label" style="cursor: auto;"> - <div id="thDIV">{'Live_Date'|translate}</div></th> - <th id="label" class="sortable label" style="cursor: auto;"> - <div id="thDIV">{'General_ColumnNbVisits'|translate}</div></th> - <th id="label" class="sortable label" style="cursor: auto;"> - <div id="thDIV">{'General_ColumnPageviews'|translate}</div></th> - </tr> - </thead> - <tbody> - <tr class=""> - <td class="columnodd">{'General_Today'|translate}</td> - <td class="columnodd">{$visitorsCountToday}</td> - <td class="columnodd">{$pisToday}</td> - </tr> - <tr class=""> - <td class="columnodd">{'Live_Last30Minutes'|translate}</td> - <td class="columnodd">{$visitorsCountHalfHour}</td> - <td class="columnodd">{$pisHalfhour}</td> - </tr> - </tbody> - </table> -</div> diff --git a/plugins/Login/Auth.php b/plugins/Login/Auth.php index c36254d64a..9bc4902831 100644 --- a/plugins/Login/Auth.php +++ b/plugins/Login/Auth.php @@ -28,7 +28,7 @@ class Piwik_Login_Auth implements Piwik_Auth { $rootLogin = Zend_Registry::get('config')->superuser->login; $rootPassword = Zend_Registry::get('config')->superuser->password; - $rootToken = Piwik_UsersManager_API::getInstance()->getTokenAuth($rootLogin, $rootPassword); + $rootToken = Piwik_UsersManager_API::getTokenAuth($rootLogin, $rootPassword); if($this->login == $rootLogin && $this->token_auth == $rootToken) @@ -42,7 +42,7 @@ class Piwik_Login_Auth implements Piwik_Auth } $login = Piwik_FetchOne( - 'SELECT login FROM '.Piwik_Common::prefixTable('user').' WHERE token_auth = ?', + 'SELECT login FROM '.Piwik::prefixTable('user').' WHERE token_auth = ?', array($this->token_auth) ); if($login !== false) diff --git a/plugins/Login/Controller.php b/plugins/Login/Controller.php index 02056be0bf..022c47bf01 100644 --- a/plugins/Login/Controller.php +++ b/plugins/Login/Controller.php @@ -11,47 +11,13 @@ */ /** - * Login controller * * @package Piwik_Login */ class Piwik_Login_Controller extends Piwik_Controller { /** - * Get referer to redirect to upon successful login. - * Remembers referer URL even if navigation is: login form -> reset password -> login form - * - * @returns string - */ - static public function getRefererToRedirect() - { - // retrieve any previously saved referer - $ns = new Zend_Session_Namespace('Piwik_Login.referer'); - $referer = $ns->referer; - if(empty($referer)) - { - // if the referer contains module=Login, Installation, or CoreUpdater, we instead redirect to the doc root - $referer = Piwik_Url::getLocalReferer(); - if(empty($referer) || preg_match('/module=(Login|Installation|CoreUpdater)/', $referer)) - { - $referer = 'index.php'; - } - $ns->referer = $referer; - $ns->setExpirationSeconds(300, 'referer'); - } - else if(!Piwik_Url::isLocalUrl($referer)) - { - $referer = 'index.php'; - } - - return $referer; - } - - /** * Default action - * - * @param none - * @return void */ function index() { @@ -60,39 +26,34 @@ class Piwik_Login_Controller extends Piwik_Controller /** * Login form - * - * @param string $messageNoAccess Access error message - * @param string $currentUrl Current URL - * @return void */ - function login($messageNoAccess = null) + function login() { - $urlToRedirect = self::getRefererToRedirect(); - + $messageNoAccess = null; $form = new Piwik_Login_Form(); + + $currentUrl = Piwik_Url::getReferer(); + $urlToRedirect = Piwik_Common::getRequestVar('form_url', $currentUrl, 'string'); + $urlToRedirect = htmlspecialchars_decode($urlToRedirect); + if($form->validate()) { - $nonce = $form->getSubmitValue('form_nonce'); - if(Piwik_Nonce::verifyNonce('Piwik_Login.login', $nonce)) - { - $login = $form->getSubmitValue('form_login'); - $password = $form->getSubmitValue('form_password'); - $md5Password = md5($password); - try { - $this->authenticateAndRedirect($login, $md5Password, $urlToRedirect); - } catch(Exception $e) { - $messageNoAccess = $e->getMessage(); - } - } - else + // if the current url to redirect contains module=Login or Installation we instead redirect to the doc root + if(preg_match('/module=(Login|Installation)/', $urlToRedirect)) { - $messageNoAccess = Piwik_Translate('Login_InvalidNonceOrReferer'); + $urlToRedirect = 'index.php'; } + + $login = $form->getSubmitValue('form_login'); + $password = $form->getSubmitValue('form_password'); + $md5Password = md5($password); + $messageNoAccess = $this->authenticateAndRedirect($login, $md5Password, $urlToRedirect); } $view = Piwik_View::factory('login'); + // make navigation login form -> reset password -> login form remember your first url + $view->urlToRedirect = $urlToRedirect; $view->AccessErrorString = $messageNoAccess; - $view->nonce = Piwik_Nonce::getNonce('Piwik_Login.login'); $view->linkTitle = Piwik::getRandomTitle(); $view->addForm( $form ); $view->subTemplate = 'genericForm.tpl'; @@ -101,29 +62,28 @@ class Piwik_Login_Controller extends Piwik_Controller /** * Form-less login - * - * @param none - * @return void */ function logme() { + $login = Piwik_Common::getRequestVar('login', null, 'string'); $password = Piwik_Common::getRequestVar('password', null, 'string'); + $currentUrl = 'index.php'; + $urlToRedirect = Piwik_Common::getRequestVar('url', $currentUrl, 'string'); + $urlToRedirect = htmlspecialchars_decode($urlToRedirect); + if(strlen($password) != 32) { - throw new Exception(Piwik_TranslateException('Login_ExceptionPasswordMD5HashExpected')); + throw new Exception("The password parameter is expected to be a MD5 hash of the password."); } - - $login = Piwik_Common::getRequestVar('login', null, 'string'); if($login == Zend_Registry::get('config')->superuser->login) - { - throw new Exception(Piwik_TranslateException('Login_ExceptionInvalidSuperUserAuthenticationMethod', array("logme"))); + { + throw new Exception("The Super User cannot be authenticated using this URL."); + } + $authenticated = $this->authenticateAndRedirect($login, $password, $urlToRedirect); + if($authenticated === false) + { + echo Piwik_Translate('Login_LoginPasswordNotCorrect'); } - - $currentUrl = 'index.php'; - $urlToRedirect = Piwik_Common::getRequestVar('url', $currentUrl, 'string'); - $urlToRedirect = htmlspecialchars_decode($urlToRedirect); - - $this->authenticateAndRedirect($login, $password, $urlToRedirect); } /** @@ -136,33 +96,51 @@ class Piwik_Login_Controller extends Piwik_Controller */ protected function authenticateAndRedirect($login, $md5Password, $urlToRedirect) { - $info = array( 'login' => $login, - 'md5Password' => $md5Password, - ); - Piwik_PostEvent('Login.initSession', $info); + $tokenAuth = Piwik_UsersManager_API::getTokenAuth($login, $md5Password); + + $auth = Zend_Registry::get('auth'); + $auth->setLogin($login); + $auth->setTokenAuth($tokenAuth); + + $authResult = $auth->authenticate(); + if(!$authResult->isValid()) + { + return Piwik_Translate('Login_LoginPasswordNotCorrect'); + } + + $authCookieName = Zend_Registry::get('config')->General->login_cookie_name; + $authCookieExpiry = time() + Zend_Registry::get('config')->General->login_cookie_expire; + $cookie = new Piwik_Cookie($authCookieName, $authCookieExpiry); + $cookie->set('login', $login); + $cookie->set('token_auth', $authResult->getTokenAuth()); + $cookie->save(); + + Zend_Session::regenerateId(); + Piwik_Url::redirectToUrl($urlToRedirect); } /** * Lost password form. Email password reset information. - * - * @param none - * @return void */ function lostPassword() { $messageNoAccess = null; - $urlToRedirect = self::getRefererToRedirect(); - $form = new Piwik_Login_PasswordForm(); + $currentUrl = 'index.php'; + $urlToRedirect = Piwik_Common::getRequestVar('form_url', $currentUrl, 'string'); + $urlToRedirect = htmlspecialchars_decode($urlToRedirect); + if($form->validate()) { $loginMail = $form->getSubmitValue('form_login'); - $messageNoAccess = $this->lostPasswordFormValidated($loginMail); + $messageNoAccess = $this->lostPasswordFormValidated($loginMail, $urlToRedirect); } $view = Piwik_View::factory('lostPassword'); $view->AccessErrorString = $messageNoAccess; + // make navigation login form -> reset password -> login form remember your first url + $view->urlToRedirect = $urlToRedirect; $view->linkTitle = Piwik::getRandomTitle(); $view->addForm( $form ); $view->subTemplate = 'genericForm.tpl'; @@ -176,7 +154,7 @@ class Piwik_Login_Controller extends Piwik_Controller * @param string $urlToRedirect (URL to redirect to, if successfully validated) * @return string (failure message if unable to validate) */ - protected function lostPasswordFormValidated($loginMail) + protected function lostPasswordFormValidated($loginMail, $urlToRedirect) { $user = self::getUserInformation($loginMail); if( $user === null ) @@ -206,7 +184,7 @@ class Piwik_Login_Controller extends Piwik_Controller '\n', "\n", sprintf(Piwik_Translate('Login_MailPasswordRecoveryBody'), $login, $ip, $url, $resetToken) - ) . "\n" + ) ); $piwikHost = $_SERVER['HTTP_HOST']; @@ -227,6 +205,7 @@ class Piwik_Login_Controller extends Piwik_Controller } $view->linkTitle = Piwik::getRandomTitle(); + $view->urlToRedirect = $urlToRedirect; echo $view->render(); exit; @@ -234,26 +213,28 @@ class Piwik_Login_Controller extends Piwik_Controller /** * Reset password form. Enter new password here. - * - * @param none - * @return void */ function resetPassword() { $messageNoAccess = null; - $urlToRedirect = self::getRefererToRedirect(); $form = new Piwik_Login_ResetPasswordForm(); + $currentUrl = 'index.php'; + $urlToRedirect = Piwik_Common::getRequestVar('form_url', $currentUrl, 'string'); + $urlToRedirect = htmlspecialchars_decode($urlToRedirect); + if($form->validate()) { $loginMail = $form->getSubmitValue('form_login'); $token = $form->getSubmitValue('form_token'); $password = $form->getSubmitValue('form_password'); - $messageNoAccess = $this->resetPasswordFormValidated($loginMail, $token, $password); + $messageNoAccess = $this->resetPasswordFormValidated($loginMail, $token, $password, $urlToRedirect); } $view = Piwik_View::factory('resetPassword'); $view->AccessErrorString = $messageNoAccess; + // make navigation login form -> reset password -> login form remember your first url + $view->urlToRedirect = $urlToRedirect; $view->linkTitle = Piwik::getRandomTitle(); $view->addForm( $form ); $view->subTemplate = 'genericForm.tpl'; @@ -269,7 +250,7 @@ class Piwik_Login_Controller extends Piwik_Controller * @param string $urlToRedirect (URL to redirect to, if successfully validated) * @return string (failure message) */ - protected function resetPasswordFormValidated($loginMail, $token, $password) + protected function resetPasswordFormValidated($loginMail, $token, $password, $urlToRedirect) { $user = self::getUserInformation($loginMail); if( $user === null ) @@ -291,7 +272,7 @@ class Piwik_Login_Controller extends Piwik_Controller } else { - Piwik_UsersManager_API::getInstance()->updateUser($user['login'], $password); + Piwik_UsersManager_API::updateUser($user['login'], $password); } } catch(Exception $e) @@ -301,6 +282,7 @@ class Piwik_Login_Controller extends Piwik_Controller $view = Piwik_View::factory('passwordchanged'); $view->linkTitle = Piwik::getRandomTitle(); + $view->urlToRedirect = $urlToRedirect; echo $view->render(); exit; @@ -326,13 +308,13 @@ class Piwik_Login_Controller extends Piwik_Controller 'password' => Zend_Registry::get('config')->superuser->password, ); } - else if( Piwik_UsersManager_API::getInstance()->userExists($loginMail) ) + else if( Piwik_UsersManager_API::userExists($loginMail) ) { - $user = Piwik_UsersManager_API::getInstance()->getUser($loginMail); + $user = Piwik_UsersManager_API::getUser($loginMail); } - else if( Piwik_UsersManager_API::getInstance()->userEmailExists($loginMail) ) + else if( Piwik_UsersManager_API::userEmailExists($loginMail) ) { - $user = Piwik_UsersManager_API::getInstance()->getUserByEmail($loginMail); + $user = Piwik_UsersManager_API::getUserByEmail($loginMail); } return $user; @@ -388,9 +370,6 @@ class Piwik_Login_Controller extends Piwik_Controller /** * Clear session information - * - * @param none - * @return void */ static public function clearSession() { @@ -403,9 +382,6 @@ class Piwik_Login_Controller extends Piwik_Controller /** * Logout current user - * - * @param none - * @return void */ public function logout() { diff --git a/plugins/Login/Form.php b/plugins/Login/Form.php index 88483c1fe6..04176cd52d 100644 --- a/plugins/Login/Form.php +++ b/plugins/Login/Form.php @@ -25,15 +25,20 @@ class Piwik_Login_Form extends Piwik_Form function init() { + // if form_url is not defined, go to referrer + $currentUrl = Piwik_Url::getReferer(); + $urlToGoAfter = Piwik_Common::getRequestVar('form_url', $currentUrl, 'string'); + $urlToGoAfter = htmlspecialchars_decode($urlToGoAfter); + $formElements = array( array('text', 'form_login'), array('password', 'form_password'), - array('hidden', 'form_nonce'), + array('hidden', 'form_url', $urlToGoAfter), ); $this->addElements( $formElements ); $formRules = array( - array('form_login', sprintf(Piwik_Translate('General_Required'), Piwik_Translate('General_Username')), 'required'), + array('form_login', sprintf(Piwik_Translate('General_Required'), Piwik_Translate('Login_Login')), 'required'), array('form_password', sprintf(Piwik_Translate('General_Required'), Piwik_Translate('Login_Password')), 'required'), ); $this->addRules( $formRules ); diff --git a/plugins/Login/Login.php b/plugins/Login/Login.php index 0002029d82..3866cd7ba7 100644 --- a/plugins/Login/Login.php +++ b/plugins/Login/Login.php @@ -19,10 +19,11 @@ class Piwik_Login extends Piwik_Plugin public function getInformation() { $info = array( - 'description' => Piwik_Translate('Login_PluginDescription'), + 'name' => 'Login', + 'description' => 'Login Authentication plugin, reading the credentials from the config/config.inc.php file for the Super User, and from the Database for the other users. Can be easily replaced to introduce a new Authentication mechanism (OpenID, htaccess, custom Auth, etc.).', 'author' => 'Piwik', - 'author_homepage' => 'http://piwik.org/', - 'version' => Piwik_Version::VERSION, + 'homepage' => 'http://piwik.org/', + 'version' => '0.1', ); return $info; } @@ -33,7 +34,6 @@ class Piwik_Login extends Piwik_Plugin 'FrontController.initAuthenticationObject' => 'initAuthenticationObject', 'FrontController.NoAccessException' => 'noAccess', 'API.Request.authenticate' => 'ApiRequestAuthenticate', - 'Login.initSession' => 'initSession', ); return $hooks; } @@ -68,8 +68,7 @@ class Piwik_Login extends Piwik_Plugin $authCookieName = Zend_Registry::get('config')->General->login_cookie_name; $authCookieExpiry = time() + Zend_Registry::get('config')->General->login_cookie_expire; - $authCookiePath = Zend_Registry::get('config')->General->login_cookie_path; - $authCookie = new Piwik_Cookie($authCookieName, $authCookieExpiry, $authCookiePath); + $authCookie = new Piwik_Cookie($authCookieName, $authCookieExpiry); $defaultLogin = 'anonymous'; $defaultTokenAuth = 'anonymous'; if($authCookie->isCookieFound()) @@ -80,36 +79,4 @@ class Piwik_Login extends Piwik_Plugin $auth->setLogin($defaultLogin); $auth->setTokenAuth($defaultTokenAuth); } - - function initSession($notification) - { - $info = $notification->getNotificationObject(); - $login = $info['login']; - $md5Password = $info['md5Password']; - - $tokenAuth = Piwik_UsersManager_API::getInstance()->getTokenAuth($login, $md5Password); - - $auth = Zend_Registry::get('auth'); - $auth->setLogin($login); - $auth->setTokenAuth($tokenAuth); - - $authResult = $auth->authenticate(); - if(!$authResult->isValid()) - { - throw new Exception(Piwik_Translate('Login_LoginPasswordNotCorrect')); - } - - $ns = new Zend_Session_Namespace('Piwik_Login.referer'); - unset($ns->referer); - - $authCookieName = Zend_Registry::get('config')->General->login_cookie_name; - $authCookieExpiry = time() + Zend_Registry::get('config')->General->login_cookie_expire; - $authCookiePath = Zend_Registry::get('config')->General->login_cookie_path; - $cookie = new Piwik_Cookie($authCookieName, $authCookieExpiry, $authCookiePath); - $cookie->set('login', $login); - $cookie->set('token_auth', $authResult->getTokenAuth()); - $cookie->save(); - - Zend_Session::regenerateId(); - } } diff --git a/plugins/Login/PasswordForm.php b/plugins/Login/PasswordForm.php index dac4192c6f..7bb39d454c 100644 --- a/plugins/Login/PasswordForm.php +++ b/plugins/Login/PasswordForm.php @@ -25,8 +25,12 @@ class Piwik_Login_PasswordForm extends Piwik_Form function init() { + $currentUrl = 'index.php'; + $urlToGoAfter = Piwik_Common::getRequestVar('form_url', $currentUrl, 'string'); + $formElements = array( array('text', 'form_login'), + array('hidden', 'form_url', $urlToGoAfter), ); $this->addElements( $formElements ); diff --git a/plugins/Login/ResetPasswordForm.php b/plugins/Login/ResetPasswordForm.php index 87470f6e18..a62cf775d1 100644 --- a/plugins/Login/ResetPasswordForm.php +++ b/plugins/Login/ResetPasswordForm.php @@ -25,6 +25,9 @@ class Piwik_Login_ResetPasswordForm extends Piwik_Form function init() { + $currentUrl = 'index.php'; + $urlToGoAfter = Piwik_Common::getRequestVar('form_url', $currentUrl, 'string'); + $resetToken = Piwik_Common::getRequestVar('token', '', 'string'); $formElements = array( @@ -32,6 +35,7 @@ class Piwik_Login_ResetPasswordForm extends Piwik_Form array('password', 'form_password'), array('password', 'form_password_bis'), array('text', 'form_token'), + array('hidden', 'form_url', $urlToGoAfter), ); $this->addElements( $formElements ); @@ -41,7 +45,7 @@ class Piwik_Login_ResetPasswordForm extends Piwik_Form $this->setDefaults($defaults); $formRules = array( - array('form_login', sprintf(Piwik_Translate('General_Required'), Piwik_Translate('General_Username')), 'required'), + array('form_login', sprintf(Piwik_Translate('General_Required'), Piwik_Translate('Login_Login')), 'required'), array('form_password', sprintf(Piwik_Translate('General_Required'), Piwik_Translate('Login_Password')), 'required'), array('form_password_bis', sprintf(Piwik_Translate('General_Required'), Piwik_Translate('Login_PasswordRepeat')), 'required'), array('form_token', sprintf(Piwik_Translate('General_Required'), Piwik_Translate('Login_PasswordResetToken')), 'required'), diff --git a/plugins/Login/templates/header.tpl b/plugins/Login/templates/header.tpl index b1cb4b4ae7..5b46dd7440 100644 --- a/plugins/Login/templates/header.tpl +++ b/plugins/Login/templates/header.tpl @@ -2,12 +2,11 @@ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" dir="ltr"> <head> - <title>Piwik › {'Login_LogIn'|translate}</title> - <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> + <title>Piwik › Login</title> + <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <link rel="shortcut icon" href="plugins/CoreHome/templates/images/favicon.ico" /> <link rel="stylesheet" type="text/css" href="plugins/Login/templates/login.css" media="screen" /> - {postEvent name="template_css_import"} {literal} <script type="text/javascript"> @@ -21,8 +20,6 @@ window.onload = focusit; </script> {/literal} - <script type="text/javascript" src="libs/jquery/jquery.js"></script> - {postEvent name="template_js_import"} </head> <body class="login"> diff --git a/plugins/Login/templates/login.css b/plugins/Login/templates/login.css index af9a89aee7..e80d7c4a19 100644 --- a/plugins/Login/templates/login.css +++ b/plugins/Login/templates/login.css @@ -14,6 +14,7 @@ form { padding: 16px 16px 40px 16px; font-weight: bold; -moz-border-radius: 5px; + -khtml-border-radius: 5px; -webkit-border-radius: 5px; border-radius: 5px; } @@ -33,6 +34,7 @@ form .forgetmenot { border-width: 1px; border-style: solid; -moz-border-radius: 3px; + -khtml-border-radius: 3px; -webkit-border-radius: 3px; border-radius: 3px; cursor: default; diff --git a/plugins/Login/templates/login.tpl b/plugins/Login/templates/login.tpl index f837ada5c3..16d23a0a06 100644 --- a/plugins/Login/templates/login.tpl +++ b/plugins/Login/templates/login.tpl @@ -16,9 +16,8 @@ <form {$form_data.attributes}> <p> - <label>{'General_Username'|translate}:<br /> - <input type="text" name="form_login" id="form_login" class="input" value="" size="20" tabindex="10" /> - <input type="hidden" name="form_nonce" id="form_nonce" value="{$nonce}" /></label> + <label>{'Login_Login'|translate}:<br /> + <input type="text" name="form_login" id="form_login" class="input" value="" size="20" tabindex="10" /></label> </p> <p> @@ -28,13 +27,14 @@ {* <p class="forgetmenot"><label><input name="rememberme" type="checkbox" id="rememberme" value="forever" tabindex="90" /> Remember Me</label></p> *} + {$form_data.form_url.html} <p class="submit"> <input type="submit" value="{'Login_LogIn'|translate}" tabindex="100" /> </p> </form> <p id="nav"> -<a href="index.php?module=Login&action=lostPassword" title="{'Login_LostYourPassword'|translate}">{'Login_LostYourPassword'|translate}</a> +<a href="index.php?module=Login&action=lostPassword&form_url={$urlToRedirect|escape:url}" title="{'Login_LostYourPassword'|translate}">{'Login_LostYourPassword'|translate}</a> </p> </div> diff --git a/plugins/Login/templates/lostPassword.tpl b/plugins/Login/templates/lostPassword.tpl index 7e3e8fbe66..9f079f7ea4 100644 --- a/plugins/Login/templates/lostPassword.tpl +++ b/plugins/Login/templates/lostPassword.tpl @@ -23,13 +23,14 @@ <label>{'Login_LoginOrEmail'|translate}:<br /> <input type="text" name="form_login" id="form_login" class="input" value="" size="20" tabindex="10" /></label> </p> + {$form_data.form_url.html} <p class="submit"> <input type="submit" value="{'Login_RemindPassword'|translate}" tabindex="100" /> </p> </form> <p id="nav"> -<a href="index.php?module=Login" title="{'Login_LogIn'|translate}">{'Login_LogIn'|translate}</a> +<a href="index.php?module=Login&form_url={$urlToRedirect|escape:url}" title="{'Login_LogIn'|translate}">{'Login_LogIn'|translate}</a> </p> </div> diff --git a/plugins/Login/templates/passwordchanged.tpl b/plugins/Login/templates/passwordchanged.tpl index 5337abc2c2..9963a060d9 100644 --- a/plugins/Login/templates/passwordchanged.tpl +++ b/plugins/Login/templates/passwordchanged.tpl @@ -13,7 +13,7 @@ {/if} <p id="nav"> -<a href="index.php?module=Login" title="{'Login_LogIn'|translate}">{'Login_LogIn'|translate}</a> +<a href="index.php?module=Login&form_url={$urlToRedirect|escape:url}" title="{'Login_LogIn'|translate}">{'Login_LogIn'|translate}</a> </p> </div> diff --git a/plugins/Login/templates/passwordsent.tpl b/plugins/Login/templates/passwordsent.tpl index 7529c57f24..175498c1f8 100644 --- a/plugins/Login/templates/passwordsent.tpl +++ b/plugins/Login/templates/passwordsent.tpl @@ -13,7 +13,7 @@ {/if} <p id="nav"> -<a href="index.php?module=Login" title="{'Login_LogIn'|translate}">{'Login_LogIn'|translate}</a> +<a href="index.php?module=Login&form_url={$urlToRedirect|escape:url}" title="{'Login_LogIn'|translate}">{'Login_LogIn'|translate}</a> </p> </div> diff --git a/plugins/Login/templates/resetPassword.tpl b/plugins/Login/templates/resetPassword.tpl index 49644b21b4..2bb77b4ae9 100644 --- a/plugins/Login/templates/resetPassword.tpl +++ b/plugins/Login/templates/resetPassword.tpl @@ -35,13 +35,14 @@ <input type="text" name="form_token" id="form_token" class="input" value="{$form_data.form_token.value}" size="20" tabindex="40" /></label> </p> + {$form_data.form_url.html} <p class="submit"> <input type="submit" value="{'Login_ChangePassword'|translate}" tabindex="100" /> </p> </form> <p id="nav"> -<a href="index.php?module=Login&action=lostPassword" title="{'Login_LostYourPassword'|translate}">{'Login_LostYourPassword'|translate}</a> +<a href="index.php?module=Login&action=lostPassword&form_url={$urlToRedirect|escape:url}" title="{'Login_LostYourPassword'|translate}">{'Login_LostYourPassword'|translate}</a> </p> </div> diff --git a/plugins/MultiSites/Controller.php b/plugins/MultiSites/Controller.php deleted file mode 100644 index 1d7b0a8280..0000000000 --- a/plugins/MultiSites/Controller.php +++ /dev/null @@ -1,195 +0,0 @@ -<?php -/** - * Piwik - Open source web analytics - * - * @link http://piwik.org - * @license http://www.gnu.org/licenses/gpl-3.0.html Gpl v3 or later - * @version $Id$ - * - * @category Piwik_Plugins - * @package Piwik_MultiSites - */ - -/** - * - * @package Piwik_MultiSites - */ -class Piwik_MultiSites_Controller extends Piwik_Controller -{ - protected $orderBy = 'names'; - protected $order = 'desc'; - protected $evolutionBy = 'visits'; - protected $mySites = array(); - protected $page = 1; - protected $limit = 20; - protected $period; - protected $date; - protected $dateToStr; - - - function index() - { - $this->getSitesInfo(); - } - - - public function getSitesInfo() - { - Piwik::checkUserHasSomeViewAccess(); - // overwrites the default Date set in the parent controller - // Instead of the default current website's local date, - // we set "today" or "yesterday" based on the default Piwik timezone - $piwikDefaultTimezone = Piwik_SitesManager_API::getInstance()->getDefaultTimezone(); - $date = Piwik_Common::getRequestVar('date', 'today'); - $date = $this->getDateParameterInTimezone($date, $piwikDefaultTimezone); - $this->setDate($date); - - $mySites = Piwik_SitesManager_API::getInstance()->getSitesWithAtLeastViewAccess(); - $params = $this->getGraphParamsModified(); - $this->dateToStr = $params['date']; - - $ids = 'all'; - $this->period = Piwik_Common::getRequestVar('period', 'day'); - - $lastDate = date('Y-m-d',strtotime("-1 ".$this->period, strtotime($this->strDate))); - - $visits = Piwik_VisitsSummary_API::getInstance()->getVisits($ids, $this->period, $this->strDate); - $lastVisits = Piwik_VisitsSummary_API::getInstance()->getVisits($ids, $this->period, $lastDate); - - $actions = Piwik_VisitsSummary_API::getInstance()->getActions($ids, $this->period, $this->strDate); - $lastActions = Piwik_VisitsSummary_API::getInstance()->getActions($ids, $this->period, $lastDate); - - $uniqueUsers = Piwik_VisitsSummary_API::getInstance()->getUniqueVisitors($ids, $this->period, $this->strDate); - $lastUniqueUsers = Piwik_VisitsSummary_API::getInstance()->getUniqueVisitors($ids, $this->period, $lastDate); - - $visitsSummary = $this->getSummary($lastVisits, $visits, $mySites, "visits"); - $actionsSummary = $this->getSummary($lastActions, $actions, $mySites, "actions"); - $uniqueSummary = $this->getSummary($lastUniqueUsers, $uniqueUsers, $mySites, "unique"); - - $visitsArray = $visits->getArray(); - $actionsArray = $actions->getArray(); - $uniqueUsersArray = $uniqueUsers->getArray(); - $lastVisitsArray = $lastVisits->getArray(); - $lastActionsArray = $lastActions->getArray(); - $lastUniqueUsersArray = $lastUniqueUsers->getArray(); - foreach($mySites as &$site) - { - $idSite = $site['idsite']; - $site['visits'] = array_shift($visitsArray[$idSite]->getColumn(0)); - $site['actions'] = array_shift($actionsArray[$idSite]->getColumn(0)); - $site['unique'] = array_shift($uniqueUsersArray[$idSite]->getColumn(0)); - $site['lastVisits'] = array_shift($lastVisitsArray[$idSite]->getColumn(0)); - $site['lastActions'] = array_shift($lastActionsArray[$idSite]->getColumn(0)); - $site['lastUnique'] = array_shift($lastUniqueUsersArray[$idSite]->getColumn(0)); - $site['visitsSummaryValue'] = $visitsSummary[$idSite]; - $site['actionsSummaryValue'] = $actionsSummary[$idSite]; - $site['uniqueSummaryValue'] = $uniqueSummary[$idSite]; - - } - - $view = new Piwik_View("MultiSites/templates/index.tpl"); - $view->mySites = $mySites; - $view->evolutionBy = $this->evolutionBy; - $view->period = $this->period; - $view->date = $this->strDate; - $view->page = $this->page; - $view->limit = $this->limit; - $view->orderBy = $this->orderBy; - $view->order = $this->order; - $view->dateToStr = $this->dateToStr; - - $view->autoRefreshTodayReport = false; - // if the current date is today, or yesterday, - // in case the website is set to UTC-12), or today in UTC+14, we refresh the page every 5min - if(in_array($this->strDate, array( 'today', date('Y-m-d'), - 'yesterday', Piwik_Date::factory('yesterday')->toString('Y-m-d'), - Piwik_Date::factory('now', 'UTC+14')->toString('Y-m-d')))) - { - $view->autoRefreshTodayReport = true; - } - $this->setGeneralVariablesView($view); - $this->setMinMaxDateAcrossWebsites($mySites, $view); - - echo $view->render(); - } - - /** - * The Multisites reports displays the first calendar date as the earliest day available for all websites. - * Also, today is the later "today" available across all timezones. - * @param $mySites - * @param $view - * @return void - */ - private function setMinMaxDateAcrossWebsites($mySites, $view) - { - $minDate = null; - $maxDate = Piwik_Date::now(); - foreach($mySites as &$site) - { - // look for 'now' in the website's timezone - $timezone = $site['timezone']; - $date = Piwik_Date::factory('now', $timezone); - if($date->isLater($maxDate)) - { - $maxDate = clone $date; - } - - // look for the absolute minimum date - $creationDate = $site['ts_created']; - $date = Piwik_Date::factory($creationDate, $timezone); - if(is_null($minDate) - || $date->isEarlier($minDate)) - { - $minDate = clone $date; - } - } - $this->setMinDateView($minDate, $view); - $this->setMaxDateView($maxDate, $view); - } - - private function getSummary($lastVisits, $currentVisits, $mySites, $type) - { - $currentVisitsArray = $currentVisits->getArray(); - $lastVisitsArray = $lastVisits->getArray(); - $summaryArray = array(); - foreach($mySites as $site) - { - $idSite = $site['idsite']; - $current = array_shift($currentVisitsArray[$idSite]->getColumn(0)); - $last = array_shift($lastVisitsArray[$idSite]->getColumn(0)); - $summaryArray[$idSite] = $this->fillSummary($current, $last, $this->evolutionBy); - } - return $summaryArray; - } - - private function fillSummary($current, $last, $type) - { - if($current == 0 && $last == 0) - { - $summary = 0; - } - elseif($last == 0) - { - $summary = 100; - } - else - { - $summary = (($current - $last) / $last) * 100; - } - - $output = round($summary,2); - - return $output; - } - - public function getEvolutionGraph( $fetch = false, $columns = false) - { - $view = $this->getLastUnitGraph($this->pluginName, __FUNCTION__, "VisitsSummary.get"); - if(empty($columns)) - { - $columns = Piwik_Common::getRequestVar('columns'); - } - $view->setColumnsToDisplay($columns); - return $this->renderView($view, $fetch); - } -} diff --git a/plugins/MultiSites/MultiSites.php b/plugins/MultiSites/MultiSites.php deleted file mode 100644 index ccdc2169b6..0000000000 --- a/plugins/MultiSites/MultiSites.php +++ /dev/null @@ -1,46 +0,0 @@ -<?php -/** - * Piwik - Open source web analytics - * - * @link http://piwik.org - * @license http://www.gnu.org/licenses/gpl-3.0.html Gpl v3 or later - * @version $Id$ - * - * @category Piwik_Plugins - * @package Piwik_MultiSites - */ - -/** - * - * @package Piwik_MultiSites - */ -class Piwik_MultiSites extends Piwik_Plugin -{ - public function getInformation() - { - return array( - 'description' => Piwik_Translate('MultiSites_PluginDescription'), - 'author' => 'ClearCode.cc', - 'author_homepage' => "http://clearcode.cc/", - 'version' => Piwik_Version::VERSION, - ); - } - - public function getListHooksRegistered() - { - return array( - 'template_css_import' => 'css', - 'template_js_import' => 'js', - ); - } - - public function css() - { - echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"plugins/MultiSites/templates/styles.css\" />\n"; - } - - public function js() - { - echo "<script type=\"text/javascript\" src=\"plugins/MultiSites/templates/common.js\"></script>\n"; - } -} diff --git a/plugins/MultiSites/images/arrow_asc.gif b/plugins/MultiSites/images/arrow_asc.gif Binary files differdeleted file mode 100644 index df463fa72f..0000000000 --- a/plugins/MultiSites/images/arrow_asc.gif +++ /dev/null diff --git a/plugins/MultiSites/images/arrow_desc.gif b/plugins/MultiSites/images/arrow_desc.gif Binary files differdeleted file mode 100644 index abe79f0769..0000000000 --- a/plugins/MultiSites/images/arrow_desc.gif +++ /dev/null diff --git a/plugins/MultiSites/images/arrow_down.png b/plugins/MultiSites/images/arrow_down.png Binary files differdeleted file mode 100644 index efa4624a05..0000000000 --- a/plugins/MultiSites/images/arrow_down.png +++ /dev/null diff --git a/plugins/MultiSites/images/arrow_up.png b/plugins/MultiSites/images/arrow_up.png Binary files differdeleted file mode 100644 index 800536e52e..0000000000 --- a/plugins/MultiSites/images/arrow_up.png +++ /dev/null diff --git a/plugins/MultiSites/images/door_in.png b/plugins/MultiSites/images/door_in.png Binary files differdeleted file mode 100644 index 41676a0a5b..0000000000 --- a/plugins/MultiSites/images/door_in.png +++ /dev/null diff --git a/plugins/MultiSites/images/link.gif b/plugins/MultiSites/images/link.gif Binary files differdeleted file mode 100644 index e160f23b63..0000000000 --- a/plugins/MultiSites/images/link.gif +++ /dev/null diff --git a/plugins/MultiSites/images/loading-blue.gif b/plugins/MultiSites/images/loading-blue.gif Binary files differdeleted file mode 100644 index 8a3f8c01b6..0000000000 --- a/plugins/MultiSites/images/loading-blue.gif +++ /dev/null diff --git a/plugins/MultiSites/images/stop.png b/plugins/MultiSites/images/stop.png Binary files differdeleted file mode 100644 index 84d56a4532..0000000000 --- a/plugins/MultiSites/images/stop.png +++ /dev/null diff --git a/plugins/MultiSites/templates/common.js b/plugins/MultiSites/templates/common.js deleted file mode 100644 index 2fc8dc86f0..0000000000 --- a/plugins/MultiSites/templates/common.js +++ /dev/null @@ -1,245 +0,0 @@ -function setRowData (idsite, visits, actions, unique, name, url, visitsSummaryValue, actionsSummaryValue, uniqueSummaryValue) -{ - this.idsite = idsite; - this.visits = visits; - this.unique = unique; - this.name = name; - this.url = url; - this.actions = actions; - this.visitsSummaryValue = parseFloat(visitsSummaryValue); - this.actionsSummaryValue = parseFloat(actionsSummaryValue); - this.uniqueSummaryValue = parseFloat(uniqueSummaryValue); -} - -function setOrderBy(self, allSites, params, mOrderBy) -{ - if(params['mOrderBy'] == mOrderBy) { - if(params['order'] == 'desc') { - params['order'] = 'asc'; - } - else { - params['order'] = 'desc'; - } - } - params['mOrderBy'] = mOrderBy; - prepareRows(allSites, params); - - $('.arrow').removeClass('multisites_desc multisites_asc'); - if($(self).attr('class') == 'evolution') - { - mOrderBy = 'evolution'; - } - $('#' + mOrderBy + ' .arrow').addClass('multisites_' + params['order']); - - return params; -} - -function prepareRows(allUnsortedSites, params) -{ - var allSites; - $("#tb").find("tr").remove(); - $("#next").html(''); - $("#prev").html(''); - var mOrderBy = params['mOrderBy']; - - allSites = orderBy(allUnsortedSites, params); - - if(allSites.length > params['limit']) - { - allSites = limitBy(allSites, params); - } - - - displayRows(allSites, params); - - showPagination(allUnsortedSites, params); - params['sitesVisible'] = allSites; -} - -function orderBy(allSites, params) -{ - if(params['mOrderBy'] == 'names') - { - allSites.sort(function(a,b) { - if (a['name'].toLowerCase() == b['name'].toLowerCase()) - { - return 0; - } - return (a['name'].toLowerCase() < b['name'].toLowerCase()) ? -1 : 1; - }); - } - else if(params['mOrderBy'] == 'visits') - { - allSites.sort(function(a,b) { - if (a['visits'] == b['visits']) { - return 0; - } - return (a['visits'] < b['visits']) ? -1 : 1; - }); - } - else if(params['mOrderBy'] == 'actions') - { - allSites.sort(function (a,b) { - if (a['actions'] == b['actions']) { - return 0; - } - return (a['actions'] < b['actions']) ? -1 : 1; - }); - } - else if(params['mOrderBy'] == 'unique') - { - allSites.sort(function (a,b) { - if (a['unique'] == b['unique']) { - return 0; - } - return (a['unique'] < b['unique']) ? -1 : 1; - }); - } - else if(params['mOrderBy'] == 'uniqueSummary') - { - allSites.sort(function (a,b) { - if (a['uniqueSummaryValue'] == b['uniqueSummaryValue']) { - return 0; - } - return (a['uniqueSummaryValue'] - b['uniqueSummaryValue'] <= 0.01) ? -1 : 1; - }); - } - else if(params['mOrderBy'] == 'actionsSummary') - { - allSites.sort(function (a,b) { - if (a['actionsSummaryValue'] == b['actionsSummaryValue']) { - return 0; - } - return (a['actionsSummaryValue'] - b['actionsSummaryValue'] <= 0.01) ? -1 : 1; - }); - } - else if(params['mOrderBy'] == 'visitsSummary') - { - allSites.sort(function (a,b) { - if (a['visitsSummaryValue'] == b['visitsSummaryValue']) { - return 0; - } - return (a['visitsSummaryValue'] - b['visitsSummaryValue'] <= 0.01) ? -1 : 1; - }); - } - - if(params['order'] == 'asc') - { - allSites.reverse(); - } - return allSites; -} - -function limitBy(allSites, params) -{ - var begin = (params['page'] - 1) * params['limit']; - var end = (params['page'] * params['limit']); - return allSites.slice(begin, end); -} - -function switchEvolution(params) -{ - $('.actions').hide(); - $('.unique').hide(); - $('.visits').hide(); - $('.' + params['evolutionBy']).show(); - sitesVisible = params['sitesVisible']; - for(i = 0; i < allSites.length; i++) - { - $('#sparkline_' + allSites[i].idsite).html(getSparklineImg(allSites[i].idsite, params['evolutionBy'], params)); - } -} - -function displayRows(allSites, params) -{ - for(var i = 0; i < allSites.length; i++) - { - var str = params['row']; - str = str.replace(/%uniqueSummary%/g, getImageForSummary(allSites[i].uniqueSummaryValue)); - str = str.replace(/%actionsSummary%/g, getImageForSummary(allSites[i].actionsSummaryValue)); - str = str.replace(/%visitsSummary%/g, getImageForSummary(allSites[i].visitsSummaryValue)); - str = str.replace(/%sparkline%/g, getSparklineImg(allSites[i].idsite, params['evolutionBy'], params)); - str = str.replace(/%actions%/g, allSites[i].actions); - str = str.replace(/%idsite%/g, allSites[i].idsite); - str = str.replace(/%visits%/g, allSites[i].visits); - str = str.replace(/%name%/g, allSites[i].name); - str = str.replace(/%unique%/g, allSites[i].unique); - str = str.replace(/%main_url%/g, allSites[i].url); - str = str.replace(/%date%/g, params['date']); - str = str.replace(/%period%/g, params['period']); - - $('#tb').append('<tr class="tables_row" id="row_'+ allSites[i].idsite+'">' + str + '</tr>'); - } - - $(".table_row").show(); - $('.actions').hide(); - $('.unique').hide(); - $('.visits').hide(); - $('#main_indicator').hide(); - $('.' + params['evolutionBy']).show(); - $("#main_indicator").hide(); -} - -function getSparklineImg(id, column, params) -{ - if(column == 'unique') - { - column = 'uniq_visitors'; - } - return '<img class="sparkline" alt="" src="?module=MultiSites&action=getEvolutionGraph&period=' + params['period'] + '&date=' + params['dateToStr'] + '&evolutionBy=' + params['evolutionBy'] + '&columns[]=nb_' + column + '&idSite=' + id + '&idsite=' + id + '&viewDataTable=sparkline" width="100" height="25" />'; -} - - - -function showPagination(allSites, params) -{ - if ((params['page'] * params['limit']) < allSites.length) - { - var html = '<span style="cursor:pointer;" class="pointer" onClick="changePage(allSites, params, \'next\');">' + params['next'] + ' »</span>'; - $("#next").html(html); - } - if(params['page'] > 1) - { - html = '<span style="cursor:pointer;" onClick="changePage(allSites, params, \'prev\');">« ' + params['prev'] + '</span>' - $("#prev").html(html); - } - var start = (params['page'] - 1) * params['limit'] + 1; - var count = allSites.length; - var end = parseInt(start) + parseInt(params['limit']) - 1; - if(end > count) end = count; - html = '<span>' + (start ) + ' - ' + end + ' of ' + count + '</span>'; - $("#counter").html(html); -} - -function changePage(allSites, params, kind) -{ - if(kind == 'next') - { - params['page']++; - } - else - { - params['page']--; - } - prepareRows(allSites, params); - return params; -} - - -function getImageForSummary(value) -{ - if(value > 0) - { - return '<img src="plugins/MultiSites/images/arrow_up.png" alt="" /> <b style="color: green;">' + value + ' %</b>'; - } - else if(value == 0) - { - return '<img src="plugins/MultiSites/images/stop.png" alt="" /> <b>' + value + '%</b>'; - } - else - { - return '<img src="plugins/MultiSites/images/arrow_down.png" alt="" /> <b style="color: red;">' + value +' %</b>'; - } -} - - diff --git a/plugins/MultiSites/templates/index.tpl b/plugins/MultiSites/templates/index.tpl deleted file mode 100644 index d4aa6e0097..0000000000 --- a/plugins/MultiSites/templates/index.tpl +++ /dev/null @@ -1,99 +0,0 @@ -<img src="plugins/MultiSites/images/arrow_desc.gif" style="display: none" /> -<img src="plugins/MultiSites/images/arrow_asc.gif" style="display: none" /> -{assign var=showSitesSelection value=false} -{assign var=showPeriodSelection value=true} -{include file="CoreHome/templates/header.tpl"} - -<script type="text/javascript" src="plugins/MultiSites/templates/common.js"></script> -<style> -{fetch file="plugins/MultiSites/templates/styles.css"} -</style> - -<div id="multisites" style="margin: auto"> -<div id="main"> -{include file="MultiSites/templates/row.tpl" assign="row"} -<script type="text/javascript"> - var allSites = new Array(); - var params = new Array(); - {foreach from=$mySites key=i item=site} - allSites[{$i}] = new setRowData({$site.idsite}, {$site.visits}, {$site.actions}, {$site.unique}, '{$site.name|escape:"quotes"}', '{$site.main_url}', '{$site.visitsSummaryValue|replace:",":"."}', '{$site.actionsSummaryValue|replace:",":"."}', '{$site.uniqueSummaryValue|replace:",":"."}'); - {/foreach} - params['period'] = '{$period}'; - params['date'] = '{$date}'; - params['dateToStr'] = '{$dateToStr}'; - params['evolutionBy'] = '{$evolutionBy}'; - params['mOrderBy'] = '{$orderBy}'; - params['order'] = '{$order}'; - params['site'] = '{$site}'; - params['limit'] = '{$limit}'; - params['page'] = 1; - params['prev'] = "{'General_Previous'|translate}"; - params['next'] = "{'General_Next'|translate}"; - params['row'] = '{$row|escape:"javascript"}'; -</script> - -{postEvent name="template_headerMultiSites"} -<div align="center"> -<table id="mt" class="dataTable" cellspacing="0" style="width:850px;"> - <thead> - <th id="names" class="label" style="text-align:center"> - <span style="cursor:pointer;" onClick="params = setOrderBy(this,allSites, params, 'names');">{'General_Website'|translate}</span> - <span class="arrow multisites_desc"></span> - </th> - <th id="visits" class="multisites-column" style="width: 100px"> - <span style="cursor:pointer;" onClick="params = setOrderBy(this,allSites, params, 'visits');">{'General_ColumnNbVisits'|translate}</span> - <span class="arrow"></span> - </th> - <th id="actions" class="multisites-column" style="width: 110px"> - <span style="cursor:pointer;" onClick="params = setOrderBy(this,allSites, params, 'actions');">{'General_ColumnPageviews'|translate}</span> - <span class="arrow"></span> - </th> - <th id="unique" class="multisites-column" style="width: 120px"> - <span style="cursor:pointer;" onClick="params = setOrderBy(this,allSites, params, 'unique');">{'General_ColumnNbUniqVisitors'|translate}</span> - <span class="arrow"></span> - </th> - <th id="evolution" style="text-align:center; width:350px" colspan="2"> - <span class="arrow "></span> - <span class="evolution" style="cursor:pointer;" onClick="params = setOrderBy(this,allSites, params, $('#evolution_selector').val() + 'Summary');"> {'MultiSites_Evolution'|translate}</span> - <select class="selector" id="evolution_selector" onchange="params['evolutionBy'] = $('#evolution_selector').val(); switchEvolution(params);"> - <option value="visits" {if $evolutionBy eq 'visits'} selected {/if}>{'General_ColumnNbVisits'|translate}</option> - <option value="actions" {if $evolutionBy eq 'actions'} selected {/if}>{'General_ColumnPageviews'|translate}</option> - <option value="unique"{if $evolutionBy eq 'unique'} selected {/if}>{'General_ColumnNbUniqVisitors'|translate}</option> - </select> - </th> - </thead> - - <tbody id="tb"> - </tbody> - - <tfoot> - <tr row_id="last" > - <td colspan="8" class="clean" style="padding: 20px"> - <span id="prev" class="pager" style="padding-right: 20px;"></span> - <span id="dataTablePages"> - <span id="counter"> - </span> - </span> - <span id="next" class="clean" style="padding-left: 20px;"></span> - </td> - </tr> - </tfoot> -</table> -</div> -<script type="text/javascript"> -prepareRows(allSites, params, '{$orderBy}'); - -{if $autoRefreshTodayReport} -{literal} -function refreshAfter(timeoutPeriod) { - setTimeout("location.reload(true);",timeoutPeriod); -} -refreshAfter(5*60*1000); -{/literal} -{/if} -</script> -</div> -</div> - -</body> -</html> diff --git a/plugins/MultiSites/templates/row.tpl b/plugins/MultiSites/templates/row.tpl deleted file mode 100644 index c651eaed5b..0000000000 --- a/plugins/MultiSites/templates/row.tpl +++ /dev/null @@ -1,26 +0,0 @@ -<td class="multisites-label label" > - <a title="View reports" href="index.php?module=CoreHome&action=index&date=%date%&period=%period%&idSite=%idsite%">%name%</a> - - <span style="width: 10px; margin-left:3px"> - <a target="_blank" title="{'General_GoTo'|translate:"%main_url%"}" href="%main_url%"><img src="plugins/MultiSites/images/link.gif" /></a> - </span> -</td> -<td class="multisites-column"> - %visits% -</td> -<td class="multisites-column"> - %actions% -</td> -<td class="multisites-column"> - %unique% -</td> -<td style="width:170px"> - <div class="visits" style="display:none">%visitsSummary%</div> - <div class="actions"style="display:none">%actionsSummary%</div> - <div class="unique" >%uniqueSummary%</div> -</td> -<td style="width:180px"> - <div id="sparkline_%idsite%" style="width: 100px; margin: auto"> - %sparkline% - </div -</td> diff --git a/plugins/MultiSites/templates/styles.css b/plugins/MultiSites/templates/styles.css deleted file mode 100644 index 5c8204d9d0..0000000000 --- a/plugins/MultiSites/templates/styles.css +++ /dev/null @@ -1,46 +0,0 @@ -.indicator { - background-image: url("../images/loading-blue.gif"); - background-position: center; - background-repeat: no-repeat; - height: 20px; - width: 60px; - margin: auto; - border: 0px !important; -} -.clean { - border: 0px !important; -} -#multisites td, #multisites tr, #multisites .sparkline { - text-align: center; - vertical-align: middle; - padding: 1px ; - margin: 0px ; -} -#multisites td.multisites-label { - padding-left: 15px ; - text-align:left; - width: 250px; -} -#multisites td.multisites-label a:hover { - text-decoration: underline; -} -#multisites td.multisites-column, #multisites th.multisites-column { - width:70px; -} -#multisites td.multisites-column-evolution, #multisites th.multisites-column-evolution { - width:70px; -} -.multisites_asc -{ - width: 10px; - height: 12px; - display: inline-block; - background-image: url('plugins/MultiSites/images/arrow_asc.gif'); -} -.multisites_desc -{ - width: 10px; - height: 13px; - display: inline-block; - background-image: url('plugins/MultiSites/images/arrow_desc.gif'); -}
\ No newline at end of file diff --git a/plugins/Provider/API.php b/plugins/Provider/API.php index 272925dded..9f29baba58 100644 --- a/plugins/Provider/API.php +++ b/plugins/Provider/API.php @@ -10,6 +10,9 @@ * @package Piwik_Provider */ +// no direct access +defined('PIWIK_INCLUDE_PATH') or die; + /** * @see plugins/Provider/functions.php */ @@ -42,7 +45,6 @@ class Piwik_Provider_API $dataTable->queueFilter('ColumnCallbackAddMetadata', array('label', 'url', 'Piwik_getHostnameUrl')); $dataTable->queueFilter('ColumnCallbackReplace', array('label', 'Piwik_getHostnameName')); $dataTable->queueFilter('ReplaceColumnNames'); - $dataTable->queueFilter('ReplaceSummaryRowLabel'); return $dataTable; } } diff --git a/plugins/Provider/Provider.php b/plugins/Provider/Provider.php index aec31c9f51..a547846fc8 100644 --- a/plugins/Provider/Provider.php +++ b/plugins/Provider/Provider.php @@ -19,10 +19,11 @@ class Piwik_Provider extends Piwik_Plugin public function getInformation() { $info = array( - 'description' => Piwik_Translate('Provider_PluginDescription'), + 'name' => 'Provider', + 'description' => 'Reports the Provider of the visitors.', 'author' => 'Piwik', - 'author_homepage' => 'http://piwik.org/', - 'version' => Piwik_Version::VERSION, + 'homepage' => 'http://piwik.org/', + 'version' => '0.1', 'TrackerPlugin' => true, // this plugin must be loaded during the stats logging ); @@ -44,25 +45,19 @@ class Piwik_Provider extends Piwik_Plugin function install() { // add column hostname / hostname ext in the visit table - $query = "ALTER IGNORE TABLE `".Piwik_Common::prefixTable('log_visit')."` ADD `location_provider` VARCHAR( 100 ) NULL"; + $query = "ALTER IGNORE TABLE `".Piwik::prefixTable('log_visit')."` ADD `location_provider` VARCHAR( 100 ) NULL"; // if the column already exist do not throw error. Could be installed twice... try { Piwik_Exec($query); } - catch(Exception $e) { - if(!Zend_Registry::get('db')->isErrNo($e, '1060')) - { - throw $e; - } - } - + catch(Exception $e){} } function uninstall() { // add column hostname / hostname ext in the visit table - $query = "ALTER TABLE `".Piwik_Common::prefixTable('log_visit')."` DROP `location_provider`"; + $query = "ALTER TABLE `".Piwik::prefixTable('log_visit')."` DROP `location_provider`"; Piwik_Exec($query); } @@ -85,10 +80,9 @@ class Piwik_Provider extends Piwik_Plugin function archivePeriod( $notification ) { - $maximumRowsInDataTable = Zend_Registry::get('config')->General->datatable_archiving_maximum_rows_standard; $archiveProcessing = $notification->getNotificationObject(); $dataTableToSum = array( 'Provider_hostnameExt' ); - $archiveProcessing->archiveDataTable($dataTableToSum, null, $maximumRowsInDataTable); + $archiveProcessing->archiveDataTable($dataTableToSum); } /** @@ -102,9 +96,7 @@ class Piwik_Provider extends Piwik_Plugin $labelSQL = "location_provider"; $interestByProvider = $archiveProcessing->getArrayInterestForLabel($labelSQL); $tableProvider = $archiveProcessing->getDataTableFromArray($interestByProvider); - $columnToSortByBeforeTruncation = Piwik_Archive::INDEX_NB_VISITS; - $maximumRowsInDataTable = Zend_Registry::get('config')->General->datatable_archiving_maximum_rows_standard; - $archiveProcessing->insertBlobRecord($recordName, $tableProvider->getSerialized($maximumRowsInDataTable, null, $columnToSortByBeforeTruncation)); + $archiveProcessing->insertBlobRecord($recordName, $tableProvider->getSerialized()); destroy($tableProvider); } @@ -153,13 +145,6 @@ class Piwik_Provider extends Piwik_Plugin } else { - $cleanHostname = null; - Piwik_PostEvent('Provider.getCleanHostname', $cleanHostname, $hostname); - if($cleanHostname !== null) - { - return $cleanHostname; - } - $e = explode('.', $hostname); $s = sizeof($e); @@ -188,13 +173,13 @@ class Piwik_Provider extends Piwik_Plugin return trim(strtolower(@gethostbyaddr(long2ip($ip)))); } - static public function headerUserCountry($notification) + public function headerUserCountry($notification) { $out =& $notification->getNotificationObject(); $out = '<div id="leftcolumn">'; } - static public function footerUserCountry($notification) + public function footerUserCountry($notification) { $out =& $notification->getNotificationObject(); $out = '</div> diff --git a/plugins/Provider/functions.php b/plugins/Provider/functions.php index 7966fe64aa..4397c40867 100644 --- a/plugins/Provider/functions.php +++ b/plugins/Provider/functions.php @@ -20,7 +20,7 @@ function Piwik_getHostnameName($in) { if(empty($in)) { - return html_entity_decode(Piwik_Translate('General_Unknown'), ENT_COMPAT, 'UTF-8'); + return Piwik_Translate('General_Unknown'); } if(strtolower($in) === 'ip') { @@ -41,10 +41,6 @@ function Piwik_getHostnameName($in) */ function Piwik_getHostnameUrl($in) { - if($in == Piwik_DataTable::LABEL_SUMMARY_ROW) - { - return false; - } if(empty($in) || strtolower($in) === 'ip') { diff --git a/plugins/Referers/API.php b/plugins/Referers/API.php index 8153a148cb..decd1cbd2f 100644 --- a/plugins/Referers/API.php +++ b/plugins/Referers/API.php @@ -10,6 +10,9 @@ * @package Piwik_Referers */ +// no direct access +defined('PIWIK_INCLUDE_PATH') or die; + /** * @see plugins/Referers/functions.php */ @@ -54,7 +57,7 @@ class Piwik_Referers_API return $dataTable; } - public function getRefererType($idSite, $period, $date, $typeReferer = false) + function getRefererType($idSite, $period, $date, $typeReferer = false) { $dataTable = $this->getDataTable('Referers_type', $idSite, $period, $date, $expanded = false); if($typeReferer !== false) @@ -65,13 +68,13 @@ class Piwik_Referers_API return $dataTable; } - public function getKeywords($idSite, $period, $date, $expanded = false) + function getKeywords($idSite, $period, $date, $expanded = false) { $dataTable = $this->getDataTable('Referers_searchEngineByKeyword', $idSite, $period, $date, $expanded); return $dataTable; } - public function getSearchEnginesFromKeywordId($idSite, $period, $date, $idSubtable) + function getSearchEnginesFromKeywordId($idSite, $period, $date, $idSubtable) { $dataTable = $this->getDataTable('Referers_searchEngineByKeyword',$idSite, $period, $date, $expanded = false, $idSubtable); $dataTable->queueFilter('ColumnCallbackAddMetadata', array( 'label', 'url', 'Piwik_getSearchEngineUrlFromName') ); @@ -84,7 +87,7 @@ class Piwik_Referers_API return $dataTable; } - public function getSearchEngines($idSite, $period, $date, $expanded = false) + function getSearchEngines($idSite, $period, $date, $expanded = false) { $dataTable = $this->getDataTable('Referers_keywordBySearchEngine',$idSite, $period, $date, $expanded); $dataTable->queueFilter('ColumnCallbackAddMetadata', array( 'label', 'url', 'Piwik_getSearchEngineUrlFromName') ); @@ -92,7 +95,7 @@ class Piwik_Referers_API return $dataTable; } - public function getKeywordsFromSearchEngineId($idSite, $period, $date, $idSubtable) + function getKeywordsFromSearchEngineId($idSite, $period, $date, $idSubtable) { $dataTable = $this->getDataTable('Referers_keywordBySearchEngine',$idSite, $period, $date, $expanded = false, $idSubtable); @@ -104,25 +107,25 @@ class Piwik_Referers_API return $dataTable; } - public function getCampaigns($idSite, $period, $date, $expanded = false) + function getCampaigns($idSite, $period, $date, $expanded = false) { $dataTable = $this->getDataTable('Referers_keywordByCampaign',$idSite, $period, $date, $expanded); return $dataTable; } - public function getKeywordsFromCampaignId($idSite, $period, $date, $idSubtable) + function getKeywordsFromCampaignId($idSite, $period, $date, $idSubtable) { $dataTable = $this->getDataTable('Referers_keywordByCampaign',$idSite, $period, $date, $expanded = false, $idSubtable); return $dataTable; } - public function getWebsites($idSite, $period, $date, $expanded = false) + function getWebsites($idSite, $period, $date, $expanded = false) { $dataTable = $this->getDataTable('Referers_urlByWebsite',$idSite, $period, $date, $expanded); return $dataTable; } - public function getUrlsFromWebsiteId($idSite, $period, $date, $idSubtable) + function getUrlsFromWebsiteId($idSite, $period, $date, $idSubtable) { $dataTable = $this->getDataTable('Referers_urlByWebsite',$idSite, $period, $date, $expanded = false, $idSubtable); $dataTable->queueFilter('ColumnCallbackAddMetadata', array( 'label', 'url', create_function('$label', 'return $label;')) ); @@ -130,27 +133,27 @@ class Piwik_Referers_API return $dataTable; } - public function getNumberOfDistinctSearchEngines($idSite, $period, $date) + function getNumberOfDistinctSearchEngines($idSite, $period, $date) { return $this->getNumeric('Referers_distinctSearchEngines', $idSite, $period, $date); } - public function getNumberOfDistinctKeywords($idSite, $period, $date) + function getNumberOfDistinctKeywords($idSite, $period, $date) { return $this->getNumeric('Referers_distinctKeywords', $idSite, $period, $date); } - public function getNumberOfDistinctCampaigns($idSite, $period, $date) + function getNumberOfDistinctCampaigns($idSite, $period, $date) { return $this->getNumeric('Referers_distinctCampaigns', $idSite, $period, $date); } - public function getNumberOfDistinctWebsites($idSite, $period, $date) + function getNumberOfDistinctWebsites($idSite, $period, $date) { return $this->getNumeric('Referers_distinctWebsites', $idSite, $period, $date); } - public function getNumberOfDistinctWebsitesUrls($idSite, $period, $date) + function getNumberOfDistinctWebsitesUrls($idSite, $period, $date) { return $this->getNumeric('Referers_distinctWebsitesUrls', $idSite, $period, $date); } diff --git a/plugins/Referers/Controller.php b/plugins/Referers/Controller.php index 098ad12ad3..658cc5ab8f 100644 --- a/plugins/Referers/Controller.php +++ b/plugins/Referers/Controller.php @@ -76,9 +76,9 @@ class Piwik_Referers_Controller extends Piwik_Controller return $this->renderView($view, $fetch); } - function getKeywords( $fetch = false) + function getKeywords( $fetch = false, $viewDataTable = null) { - $view = Piwik_ViewDataTable::factory(); + $view = Piwik_ViewDataTable::factory($viewDataTable); $view->init( $this->pluginName, __FUNCTION__, 'Referers.getKeywords', 'getSearchEnginesFromKeywordId' diff --git a/plugins/Referers/Referers.php b/plugins/Referers/Referers.php index 291971370c..3e305ba3d2 100644 --- a/plugins/Referers/Referers.php +++ b/plugins/Referers/Referers.php @@ -23,10 +23,11 @@ class Piwik_Referers extends Piwik_Plugin public function getInformation() { $info = array( - 'description' => Piwik_Translate('Referers_PluginDescription'), + 'name' => 'Referers', + 'description' => 'Reports the Referers data: Search Engines, Keywords, Websites, Campaign Tracking, Direct Entry. ', 'author' => 'Piwik', - 'author_homepage' => 'http://piwik.org/', - 'version' => Piwik_Version::VERSION, + 'homepage' => 'http://piwik.org/', + 'version' => '0.1', ); return $info; @@ -39,7 +40,6 @@ class Piwik_Referers extends Piwik_Plugin 'ArchiveProcessing_Period.compute' => 'archivePeriod', 'WidgetsList.add' => 'addWidgets', 'Menu.add' => 'addMenus', - 'Goals.getAvailableGoalSegments' => 'addGoalSegments', ); return $hooks; } @@ -62,49 +62,12 @@ class Piwik_Referers extends Piwik_Plugin function addMenus() { - Piwik_AddMenu('Referers_Referers', 'Referers_SubmenuEvolution', array('module' => 'Referers', 'action' => 'index')); + Piwik_AddMenu('Referers_Referers', 'Referers_SubmenuEvolution', array('module' => 'Referers')); Piwik_AddMenu('Referers_Referers', 'Referers_SubmenuSearchEngines', array('module' => 'Referers', 'action' => 'getSearchEnginesAndKeywords')); Piwik_AddMenu('Referers_Referers', 'Referers_SubmenuWebsites', array('module' => 'Referers', 'action' => 'getWebsites')); Piwik_AddMenu('Referers_Referers', 'Referers_SubmenuCampaigns', array('module' => 'Referers', 'action' => 'getCampaigns')); } - function addGoalSegments( $notification ) - { - $segments =& $notification->getNotificationObject(); - $segments = array_merge($segments, array( - array( - 'group' => Piwik_Translate('Referers_Referers'), - 'name' => Piwik_Translate('Referers_Keywords'), - 'module' => 'Referers', - 'action' => 'getKeywords', - ), - array( - 'group' => Piwik_Translate('Referers_Referers'), - 'name' => Piwik_Translate('Referers_SearchEngines'), - 'module' => 'Referers', - 'action' => 'getSearchEngines', - ), - array( - 'group' => Piwik_Translate('Referers_Referers'), - 'name' => Piwik_Translate('Referers_Websites'), - 'module' => 'Referers', - 'action' => 'getWebsites', - ), - array( - 'group' => Piwik_Translate('Referers_Referers'), - 'name' => Piwik_Translate('Referers_Campaigns'), - 'module' => 'Referers', - 'action' => 'getCampaigns', - ), - array( - 'group' => Piwik_Translate('Referers_Referers'), - 'name' => Piwik_Translate('Referers_Type'), - 'module' => 'Referers', - 'action' => 'getRefererType', - ), - )); - } - function archivePeriod( $notification ) { $archiveProcessing = $notification->getNotificationObject(); @@ -187,7 +150,7 @@ class Piwik_Referers extends Piwik_Plugin destroy($this->distinctUrls); } - protected function archiveDayAggregateVisits(Piwik_ArchiveProcessing $archiveProcessing) + protected function archiveDayAggregateVisits($archiveProcessing) { $query = "SELECT referer_type, referer_name, @@ -201,12 +164,11 @@ class Piwik_Referers extends Piwik_Plugin sum(case visit_total_actions when 1 then 1 else 0 end) as bounce_count, sum(case visit_goal_converted when 1 then 1 else 0 end) as nb_visits_converted FROM ".$archiveProcessing->logTable." - WHERE visit_last_action_time >= ? - AND visit_last_action_time <= ? + WHERE visit_server_date = ? AND idsite = ? GROUP BY referer_type, referer_name, referer_url, referer_keyword ORDER BY nb_visits DESC"; - $query = $archiveProcessing->db->query($query, array( $archiveProcessing->getStartDatetimeUTC(), $archiveProcessing->getEndDatetimeUTC(), $archiveProcessing->idsite )); + $query = $archiveProcessing->db->query($query, array( $archiveProcessing->strDateStart, $archiveProcessing->idsite )); $this->interestBySearchEngine = $this->interestByKeyword = diff --git a/plugins/Referers/images/searchEngines/1.cz.png b/plugins/Referers/images/searchEngines/1.cz.png Binary files differdeleted file mode 100644 index 1e660b7409..0000000000 --- a/plugins/Referers/images/searchEngines/1.cz.png +++ /dev/null diff --git a/plugins/Referers/images/searchEngines/acont.de.png b/plugins/Referers/images/searchEngines/acont.de.png Binary files differnew file mode 100644 index 0000000000..5099e6163c --- /dev/null +++ b/plugins/Referers/images/searchEngines/acont.de.png diff --git a/plugins/Referers/images/searchEngines/all.by.png b/plugins/Referers/images/searchEngines/all.by.png Binary files differdeleted file mode 100644 index 1e660b7409..0000000000 --- a/plugins/Referers/images/searchEngines/all.by.png +++ /dev/null diff --git a/plugins/Referers/images/searchEngines/apollo.lv.png b/plugins/Referers/images/searchEngines/apollo.lv.png Binary files differdeleted file mode 100644 index 9268827b64..0000000000 --- a/plugins/Referers/images/searchEngines/apollo.lv.png +++ /dev/null diff --git a/plugins/Referers/images/searchEngines/bg.setooz.com.png b/plugins/Referers/images/searchEngines/bg.setooz.com.png Binary files differdeleted file mode 100644 index 1e660b7409..0000000000 --- a/plugins/Referers/images/searchEngines/bg.setooz.com.png +++ /dev/null diff --git a/plugins/Referers/images/searchEngines/blogs.gigablast.com.png b/plugins/Referers/images/searchEngines/blogs.gigablast.com.png Binary files differdeleted file mode 100644 index bcd8577d24..0000000000 --- a/plugins/Referers/images/searchEngines/blogs.gigablast.com.png +++ /dev/null diff --git a/plugins/Referers/images/searchEngines/blogs.seekport.de.png b/plugins/Referers/images/searchEngines/blogs.seekport.de.png Binary files differnew file mode 100644 index 0000000000..d5da478ca6 --- /dev/null +++ b/plugins/Referers/images/searchEngines/blogs.seekport.de.png diff --git a/plugins/Referers/images/searchEngines/blogsearch.google.com.png b/plugins/Referers/images/searchEngines/blogsearch.google.com.png Binary files differindex 5e701b1d4e..ac1b2d8b10 100644 --- a/plugins/Referers/images/searchEngines/blogsearch.google.com.png +++ b/plugins/Referers/images/searchEngines/blogsearch.google.com.png diff --git a/plugins/Referers/images/searchEngines/cf.dir.yahoo.com.png b/plugins/Referers/images/searchEngines/cf.dir.yahoo.com.png Binary files differdeleted file mode 100644 index 1e660b7409..0000000000 --- a/plugins/Referers/images/searchEngines/cf.dir.yahoo.com.png +++ /dev/null diff --git a/plugins/Referers/images/searchEngines/class.hit-parade.com.png b/plugins/Referers/images/searchEngines/class.hit-parade.com.png Binary files differnew file mode 100644 index 0000000000..3525114470 --- /dev/null +++ b/plugins/Referers/images/searchEngines/class.hit-parade.com.png diff --git a/plugins/Referers/images/searchEngines/clusty.com.png b/plugins/Referers/images/searchEngines/clusty.com.png Binary files differdeleted file mode 100644 index e34962d22d..0000000000 --- a/plugins/Referers/images/searchEngines/clusty.com.png +++ /dev/null diff --git a/plugins/Referers/images/searchEngines/data.quicksearches.net.png b/plugins/Referers/images/searchEngines/data.quicksearches.net.png Binary files differdeleted file mode 100644 index 1e660b7409..0000000000 --- a/plugins/Referers/images/searchEngines/data.quicksearches.net.png +++ /dev/null diff --git a/plugins/Referers/images/searchEngines/de.forestle.org.png b/plugins/Referers/images/searchEngines/de.forestle.org.png Binary files differdeleted file mode 100644 index bacb890e10..0000000000 --- a/plugins/Referers/images/searchEngines/de.forestle.org.png +++ /dev/null diff --git a/plugins/Referers/images/searchEngines/digg.com.png b/plugins/Referers/images/searchEngines/digg.com.png Binary files differdeleted file mode 100644 index 1edeb3b202..0000000000 --- a/plugins/Referers/images/searchEngines/digg.com.png +++ /dev/null diff --git a/plugins/Referers/images/searchEngines/directory.google.com.png b/plugins/Referers/images/searchEngines/directory.google.com.png Binary files differnew file mode 100644 index 0000000000..154ecfcfe0 --- /dev/null +++ b/plugins/Referers/images/searchEngines/directory.google.com.png diff --git a/plugins/Referers/images/searchEngines/duckduckgo.com.png b/plugins/Referers/images/searchEngines/duckduckgo.com.png Binary files differdeleted file mode 100644 index 329ab66f6c..0000000000 --- a/plugins/Referers/images/searchEngines/duckduckgo.com.png +++ /dev/null diff --git a/plugins/Referers/images/searchEngines/ecosia.org.png b/plugins/Referers/images/searchEngines/ecosia.org.png Binary files differdeleted file mode 100644 index 6945878ae8..0000000000 --- a/plugins/Referers/images/searchEngines/ecosia.org.png +++ /dev/null diff --git a/plugins/Referers/images/searchEngines/find.copernic.com.png b/plugins/Referers/images/searchEngines/find.copernic.com.png Binary files differnew file mode 100644 index 0000000000..d646c9fbb4 --- /dev/null +++ b/plugins/Referers/images/searchEngines/find.copernic.com.png diff --git a/plugins/Referers/images/searchEngines/friendfeed.com.png b/plugins/Referers/images/searchEngines/friendfeed.com.png Binary files differdeleted file mode 100644 index a9bc79919e..0000000000 --- a/plugins/Referers/images/searchEngines/friendfeed.com.png +++ /dev/null diff --git a/plugins/Referers/images/searchEngines/froogle.google.com.png b/plugins/Referers/images/searchEngines/froogle.google.com.png Binary files differindex 5e701b1d4e..ac1b2d8b10 100644 --- a/plugins/Referers/images/searchEngines/froogle.google.com.png +++ b/plugins/Referers/images/searchEngines/froogle.google.com.png diff --git a/plugins/Referers/images/searchEngines/fulltext.centrum.cz.png b/plugins/Referers/images/searchEngines/fulltext.centrum.cz.png Binary files differnew file mode 100644 index 0000000000..0530ca5bdd --- /dev/null +++ b/plugins/Referers/images/searchEngines/fulltext.centrum.cz.png diff --git a/plugins/Referers/images/searchEngines/g.msn.com.png b/plugins/Referers/images/searchEngines/g.msn.com.png Binary files differnew file mode 100644 index 0000000000..5ca23d7674 --- /dev/null +++ b/plugins/Referers/images/searchEngines/g.msn.com.png diff --git a/plugins/Referers/images/searchEngines/gais.cs.ccu.edu.tw.png b/plugins/Referers/images/searchEngines/gais.cs.ccu.edu.tw.png Binary files differdeleted file mode 100644 index 1e660b7409..0000000000 --- a/plugins/Referers/images/searchEngines/gais.cs.ccu.edu.tw.png +++ /dev/null diff --git a/plugins/Referers/images/searchEngines/google.canoe.com.png b/plugins/Referers/images/searchEngines/google.canoe.com.png Binary files differdeleted file mode 100644 index 1e660b7409..0000000000 --- a/plugins/Referers/images/searchEngines/google.canoe.com.png +++ /dev/null diff --git a/plugins/Referers/images/searchEngines/googlesyndicatedsearch.com.png b/plugins/Referers/images/searchEngines/googlesyndicatedsearch.com.png Binary files differdeleted file mode 100644 index ffa48426b1..0000000000 --- a/plugins/Referers/images/searchEngines/googlesyndicatedsearch.com.png +++ /dev/null diff --git a/plugins/Referers/images/searchEngines/guide.opendns.com.png b/plugins/Referers/images/searchEngines/guide.opendns.com.png Binary files differnew file mode 100644 index 0000000000..f227c390fe --- /dev/null +++ b/plugins/Referers/images/searchEngines/guide.opendns.com.png diff --git a/plugins/Referers/images/searchEngines/hledani.tiscali.cz.png b/plugins/Referers/images/searchEngines/hledani.tiscali.cz.png Binary files differnew file mode 100644 index 0000000000..e5b9a88685 --- /dev/null +++ b/plugins/Referers/images/searchEngines/hledani.tiscali.cz.png diff --git a/plugins/Referers/images/searchEngines/hotbot.lycos.com.png b/plugins/Referers/images/searchEngines/hotbot.lycos.com.png Binary files differdeleted file mode 100644 index c6ed91697c..0000000000 --- a/plugins/Referers/images/searchEngines/hotbot.lycos.com.png +++ /dev/null diff --git a/plugins/Referers/images/searchEngines/hotbox.png b/plugins/Referers/images/searchEngines/hotbox.png Binary files differnew file mode 100644 index 0000000000..ad53185532 --- /dev/null +++ b/plugins/Referers/images/searchEngines/hotbox.png diff --git a/plugins/Referers/images/searchEngines/ie4.nomade.fr.png b/plugins/Referers/images/searchEngines/ie4.nomade.fr.png Binary files differdeleted file mode 100644 index 1e660b7409..0000000000 --- a/plugins/Referers/images/searchEngines/ie4.nomade.fr.png +++ /dev/null diff --git a/plugins/Referers/images/searchEngines/images.google.com.png b/plugins/Referers/images/searchEngines/images.google.com.png Binary files differindex dd52532085..154ecfcfe0 100644 --- a/plugins/Referers/images/searchEngines/images.google.com.png +++ b/plugins/Referers/images/searchEngines/images.google.com.png diff --git a/plugins/Referers/images/searchEngines/images.search.yahoo.com.png b/plugins/Referers/images/searchEngines/images.search.yahoo.com.png Binary files differdeleted file mode 100644 index 91dcc48793..0000000000 --- a/plugins/Referers/images/searchEngines/images.search.yahoo.com.png +++ /dev/null diff --git a/plugins/Referers/images/searchEngines/ko.search.need2find.com.png b/plugins/Referers/images/searchEngines/ko.search.need2find.com.png Binary files differdeleted file mode 100644 index 1e660b7409..0000000000 --- a/plugins/Referers/images/searchEngines/ko.search.need2find.com.png +++ /dev/null diff --git a/plugins/Referers/images/searchEngines/lo.st.png b/plugins/Referers/images/searchEngines/lo.st.png Binary files differdeleted file mode 100644 index 134e0fd950..0000000000 --- a/plugins/Referers/images/searchEngines/lo.st.png +++ /dev/null diff --git a/plugins/Referers/images/searchEngines/meta.rrzn.uni-hannover.de.png b/plugins/Referers/images/searchEngines/meta.rrzn.uni-hannover.de.png Binary files differdeleted file mode 100644 index b63fa1b649..0000000000 --- a/plugins/Referers/images/searchEngines/meta.rrzn.uni-hannover.de.png +++ /dev/null diff --git a/plugins/Referers/images/searchEngines/metaresults.copernic.com.png b/plugins/Referers/images/searchEngines/metaresults.copernic.com.png Binary files differdeleted file mode 100644 index 1e660b7409..0000000000 --- a/plugins/Referers/images/searchEngines/metaresults.copernic.com.png +++ /dev/null diff --git a/plugins/Referers/images/searchEngines/morfeo.centrum.cz.png b/plugins/Referers/images/searchEngines/morfeo.centrum.cz.png Binary files differnew file mode 100644 index 0000000000..0530ca5bdd --- /dev/null +++ b/plugins/Referers/images/searchEngines/morfeo.centrum.cz.png diff --git a/plugins/Referers/images/searchEngines/mserv.rrzn.uni-hannover.de.png b/plugins/Referers/images/searchEngines/mserv.rrzn.uni-hannover.de.png Binary files differnew file mode 100644 index 0000000000..99489c9ab4 --- /dev/null +++ b/plugins/Referers/images/searchEngines/mserv.rrzn.uni-hannover.de.png diff --git a/plugins/Referers/images/searchEngines/msxml.excite.com.png b/plugins/Referers/images/searchEngines/msxml.excite.com.png Binary files differnew file mode 100644 index 0000000000..8ef8d0ba7c --- /dev/null +++ b/plugins/Referers/images/searchEngines/msxml.excite.com.png diff --git a/plugins/Referers/images/searchEngines/news.google.com.png b/plugins/Referers/images/searchEngines/news.google.com.png Binary files differindex dd52532085..154ecfcfe0 100644 --- a/plugins/Referers/images/searchEngines/news.google.com.png +++ b/plugins/Referers/images/searchEngines/news.google.com.png diff --git a/plugins/Referers/images/searchEngines/news.openfind.com.tw.png b/plugins/Referers/images/searchEngines/news.openfind.com.tw.png Binary files differdeleted file mode 100644 index 1e660b7409..0000000000 --- a/plugins/Referers/images/searchEngines/news.openfind.com.tw.png +++ /dev/null diff --git a/plugins/Referers/images/searchEngines/news.seekport.de.png b/plugins/Referers/images/searchEngines/news.seekport.de.png Binary files differnew file mode 100644 index 0000000000..d5da478ca6 --- /dev/null +++ b/plugins/Referers/images/searchEngines/news.seekport.de.png diff --git a/plugins/Referers/images/searchEngines/nmsearch.3721.com.png b/plugins/Referers/images/searchEngines/nmsearch.3721.com.png Binary files differnew file mode 100644 index 0000000000..6b4384e007 --- /dev/null +++ b/plugins/Referers/images/searchEngines/nmsearch.3721.com.png diff --git a/plugins/Referers/images/searchEngines/otsing.delfi.ee.png b/plugins/Referers/images/searchEngines/otsing.delfi.ee.png Binary files differdeleted file mode 100644 index 2816690eef..0000000000 --- a/plugins/Referers/images/searchEngines/otsing.delfi.ee.png +++ /dev/null diff --git a/plugins/Referers/images/searchEngines/p.zhongsou.com.png b/plugins/Referers/images/searchEngines/p.zhongsou.com.png Binary files differdeleted file mode 100644 index 131e9c509d..0000000000 --- a/plugins/Referers/images/searchEngines/p.zhongsou.com.png +++ /dev/null diff --git a/plugins/Referers/images/searchEngines/pesquisa.sapo.pt.png b/plugins/Referers/images/searchEngines/pesquisa.sapo.pt.png Binary files differdeleted file mode 100644 index 1e660b7409..0000000000 --- a/plugins/Referers/images/searchEngines/pesquisa.sapo.pt.png +++ /dev/null diff --git a/plugins/Referers/images/searchEngines/recherche.hit-parade.com.png b/plugins/Referers/images/searchEngines/recherche.hit-parade.com.png Binary files differdeleted file mode 100644 index 1e660b7409..0000000000 --- a/plugins/Referers/images/searchEngines/recherche.hit-parade.com.png +++ /dev/null diff --git a/plugins/Referers/images/searchEngines/rechercher.nomade.tiscali.fr.png b/plugins/Referers/images/searchEngines/rechercher.nomade.tiscali.fr.png Binary files differdeleted file mode 100644 index 1e660b7409..0000000000 --- a/plugins/Referers/images/searchEngines/rechercher.nomade.tiscali.fr.png +++ /dev/null diff --git a/plugins/Referers/images/searchEngines/search-dyn.tiscali.it.png b/plugins/Referers/images/searchEngines/search-dyn.tiscali.it.png Binary files differnew file mode 100644 index 0000000000..13ef7b5474 --- /dev/null +++ b/plugins/Referers/images/searchEngines/search-dyn.tiscali.it.png diff --git a/plugins/Referers/images/searchEngines/search.babylon.com.png b/plugins/Referers/images/searchEngines/search.babylon.com.png Binary files differdeleted file mode 100644 index 02c03a13d2..0000000000 --- a/plugins/Referers/images/searchEngines/search.babylon.com.png +++ /dev/null diff --git a/plugins/Referers/images/searchEngines/search.conduit.com.png b/plugins/Referers/images/searchEngines/search.conduit.com.png Binary files differdeleted file mode 100644 index fac5fe2d55..0000000000 --- a/plugins/Referers/images/searchEngines/search.conduit.com.png +++ /dev/null diff --git a/plugins/Referers/images/searchEngines/search.dogpile.com.png b/plugins/Referers/images/searchEngines/search.dogpile.com.png Binary files differdeleted file mode 100644 index 1e660b7409..0000000000 --- a/plugins/Referers/images/searchEngines/search.dogpile.com.png +++ /dev/null diff --git a/plugins/Referers/images/searchEngines/search.freecause.com.png b/plugins/Referers/images/searchEngines/search.freecause.com.png Binary files differdeleted file mode 100644 index 1e660b7409..0000000000 --- a/plugins/Referers/images/searchEngines/search.freecause.com.png +++ /dev/null diff --git a/plugins/Referers/images/searchEngines/search.iwon.com.png b/plugins/Referers/images/searchEngines/search.iwon.com.png Binary files differdeleted file mode 100644 index 1e660b7409..0000000000 --- a/plugins/Referers/images/searchEngines/search.iwon.com.png +++ /dev/null diff --git a/plugins/Referers/images/searchEngines/search.msn.com.png b/plugins/Referers/images/searchEngines/search.msn.com.png Binary files differnew file mode 100644 index 0000000000..6217b7151c --- /dev/null +++ b/plugins/Referers/images/searchEngines/search.msn.com.png diff --git a/plugins/Referers/images/searchEngines/search.naver.com.png b/plugins/Referers/images/searchEngines/search.naver.com.png Binary files differdeleted file mode 100644 index a97c282800..0000000000 --- a/plugins/Referers/images/searchEngines/search.naver.com.png +++ /dev/null diff --git a/plugins/Referers/images/searchEngines/search.netscape.com.png b/plugins/Referers/images/searchEngines/search.netscape.com.png Binary files differnew file mode 100644 index 0000000000..a7dfae8e6f --- /dev/null +++ b/plugins/Referers/images/searchEngines/search.netscape.com.png diff --git a/plugins/Referers/images/searchEngines/search.nifty.com.png b/plugins/Referers/images/searchEngines/search.nifty.com.png Binary files differdeleted file mode 100644 index 1e660b7409..0000000000 --- a/plugins/Referers/images/searchEngines/search.nifty.com.png +++ /dev/null diff --git a/plugins/Referers/images/searchEngines/search.opera.com.png b/plugins/Referers/images/searchEngines/search.opera.com.png Binary files differdeleted file mode 100644 index 1e660b7409..0000000000 --- a/plugins/Referers/images/searchEngines/search.opera.com.png +++ /dev/null diff --git a/plugins/Referers/images/searchEngines/search.rambler.ru.png b/plugins/Referers/images/searchEngines/search.rambler.ru.png Binary files differnew file mode 100644 index 0000000000..d26d31ed09 --- /dev/null +++ b/plugins/Referers/images/searchEngines/search.rambler.ru.png diff --git a/plugins/Referers/images/searchEngines/search.supereva.com.png b/plugins/Referers/images/searchEngines/search.supereva.com.png Binary files differdeleted file mode 100644 index 1e660b7409..0000000000 --- a/plugins/Referers/images/searchEngines/search.supereva.com.png +++ /dev/null diff --git a/plugins/Referers/images/searchEngines/search.www.ee.png b/plugins/Referers/images/searchEngines/search.www.ee.png Binary files differdeleted file mode 100644 index 1e660b7409..0000000000 --- a/plugins/Referers/images/searchEngines/search.www.ee.png +++ /dev/null diff --git a/plugins/Referers/images/searchEngines/search.yaca.yandex.ru.png b/plugins/Referers/images/searchEngines/search.yaca.yandex.ru.png Binary files differnew file mode 100644 index 0000000000..bc3c364935 --- /dev/null +++ b/plugins/Referers/images/searchEngines/search.yaca.yandex.ru.png diff --git a/plugins/Referers/images/searchEngines/search1.seznam.cz.png b/plugins/Referers/images/searchEngines/search1.seznam.cz.png Binary files differnew file mode 100644 index 0000000000..49ea24c48c --- /dev/null +++ b/plugins/Referers/images/searchEngines/search1.seznam.cz.png diff --git a/plugins/Referers/images/searchEngines/searchservice.myspace.com.png b/plugins/Referers/images/searchEngines/searchservice.myspace.com.png Binary files differdeleted file mode 100644 index 5c37fe2ff9..0000000000 --- a/plugins/Referers/images/searchEngines/searchservice.myspace.com.png +++ /dev/null diff --git a/plugins/Referers/images/searchEngines/servizi.mediaset.it.png b/plugins/Referers/images/searchEngines/servizi.mediaset.it.png Binary files differdeleted file mode 100644 index 1e660b7409..0000000000 --- a/plugins/Referers/images/searchEngines/servizi.mediaset.it.png +++ /dev/null diff --git a/plugins/Referers/images/searchEngines/smart.delfi.lv.png b/plugins/Referers/images/searchEngines/smart.delfi.lv.png Binary files differdeleted file mode 100644 index 2816690eef..0000000000 --- a/plugins/Referers/images/searchEngines/smart.delfi.lv.png +++ /dev/null diff --git a/plugins/Referers/images/searchEngines/suche.defind.de.png b/plugins/Referers/images/searchEngines/suche.defind.de.png Binary files differdeleted file mode 100644 index 1e660b7409..0000000000 --- a/plugins/Referers/images/searchEngines/suche.defind.de.png +++ /dev/null diff --git a/plugins/Referers/images/searchEngines/translate.google.com.png b/plugins/Referers/images/searchEngines/translate.google.com.png Binary files differindex dd52532085..154ecfcfe0 100644 --- a/plugins/Referers/images/searchEngines/translate.google.com.png +++ b/plugins/Referers/images/searchEngines/translate.google.com.png diff --git a/plugins/Referers/images/searchEngines/travel.gigablast.com.png b/plugins/Referers/images/searchEngines/travel.gigablast.com.png Binary files differdeleted file mode 100644 index 1e660b7409..0000000000 --- a/plugins/Referers/images/searchEngines/travel.gigablast.com.png +++ /dev/null diff --git a/plugins/Referers/images/searchEngines/vivisimo.com.png b/plugins/Referers/images/searchEngines/vivisimo.com.png Binary files differdeleted file mode 100644 index 1f8de0fa21..0000000000 --- a/plugins/Referers/images/searchEngines/vivisimo.com.png +++ /dev/null diff --git a/plugins/Referers/images/searchEngines/web.toile.com.png b/plugins/Referers/images/searchEngines/web.toile.com.png Binary files differnew file mode 100644 index 0000000000..b5111f71f3 --- /dev/null +++ b/plugins/Referers/images/searchEngines/web.toile.com.png diff --git a/plugins/Referers/images/searchEngines/wps.openfind.com.tw.png b/plugins/Referers/images/searchEngines/wps.openfind.com.tw.png Binary files differdeleted file mode 100644 index 1e660b7409..0000000000 --- a/plugins/Referers/images/searchEngines/wps.openfind.com.tw.png +++ /dev/null diff --git a/plugins/Referers/images/searchEngines/www.123people.com.png b/plugins/Referers/images/searchEngines/www.123people.com.png Binary files differdeleted file mode 100644 index 205208a9d2..0000000000 --- a/plugins/Referers/images/searchEngines/www.123people.com.png +++ /dev/null diff --git a/plugins/Referers/images/searchEngines/www.4call.dastelefonbuch.de.png b/plugins/Referers/images/searchEngines/www.4call.dastelefonbuch.de.png Binary files differdeleted file mode 100644 index 1e660b7409..0000000000 --- a/plugins/Referers/images/searchEngines/www.4call.dastelefonbuch.de.png +++ /dev/null diff --git a/plugins/Referers/images/searchEngines/www.acoon.de.png b/plugins/Referers/images/searchEngines/www.acoon.de.png Binary files differdeleted file mode 100644 index 1e660b7409..0000000000 --- a/plugins/Referers/images/searchEngines/www.acoon.de.png +++ /dev/null diff --git a/plugins/Referers/images/searchEngines/www.caloweb.de.png b/plugins/Referers/images/searchEngines/www.caloweb.de.png Binary files differdeleted file mode 100644 index 1e660b7409..0000000000 --- a/plugins/Referers/images/searchEngines/www.caloweb.de.png +++ /dev/null diff --git a/plugins/Referers/images/searchEngines/www.crossbot.de.png b/plugins/Referers/images/searchEngines/www.crossbot.de.png Binary files differdeleted file mode 100644 index 1e660b7409..0000000000 --- a/plugins/Referers/images/searchEngines/www.crossbot.de.png +++ /dev/null diff --git a/plugins/Referers/images/searchEngines/www.cuil.com.png b/plugins/Referers/images/searchEngines/www.cuil.com.png Binary files differdeleted file mode 100644 index 3743b19ac5..0000000000 --- a/plugins/Referers/images/searchEngines/www.cuil.com.png +++ /dev/null diff --git a/plugins/Referers/images/searchEngines/www.dasoertliche.de.png b/plugins/Referers/images/searchEngines/www.dasoertliche.de.png Binary files differdeleted file mode 100644 index 1e660b7409..0000000000 --- a/plugins/Referers/images/searchEngines/www.dasoertliche.de.png +++ /dev/null diff --git a/plugins/Referers/images/searchEngines/www.deskfeeds.com.png b/plugins/Referers/images/searchEngines/www.deskfeeds.com.png Binary files differdeleted file mode 100644 index 1e660b7409..0000000000 --- a/plugins/Referers/images/searchEngines/www.deskfeeds.com.png +++ /dev/null diff --git a/plugins/Referers/images/searchEngines/www.dino-online.de.png b/plugins/Referers/images/searchEngines/www.dino-online.de.png Binary files differdeleted file mode 100644 index e902d495e9..0000000000 --- a/plugins/Referers/images/searchEngines/www.dino-online.de.png +++ /dev/null diff --git a/plugins/Referers/images/searchEngines/www.eniro.se.png b/plugins/Referers/images/searchEngines/www.eniro.se.png Binary files differdeleted file mode 100644 index 09223f35fd..0000000000 --- a/plugins/Referers/images/searchEngines/www.eniro.se.png +++ /dev/null diff --git a/plugins/Referers/images/searchEngines/www.enrio.se.png b/plugins/Referers/images/searchEngines/www.enrio.se.png Binary files differnew file mode 100644 index 0000000000..b537ac03e6 --- /dev/null +++ b/plugins/Referers/images/searchEngines/www.enrio.se.png diff --git a/plugins/Referers/images/searchEngines/www.eo.st.png b/plugins/Referers/images/searchEngines/www.eo.st.png Binary files differnew file mode 100644 index 0000000000..19184f55db --- /dev/null +++ b/plugins/Referers/images/searchEngines/www.eo.st.png diff --git a/plugins/Referers/images/searchEngines/www.eu.ixquick.com.png b/plugins/Referers/images/searchEngines/www.eu.ixquick.com.png Binary files differnew file mode 100644 index 0000000000..a688041220 --- /dev/null +++ b/plugins/Referers/images/searchEngines/www.eu.ixquick.com.png diff --git a/plugins/Referers/images/searchEngines/www.eudip.com.png b/plugins/Referers/images/searchEngines/www.eudip.com.png Binary files differdeleted file mode 100644 index 1e660b7409..0000000000 --- a/plugins/Referers/images/searchEngines/www.eudip.com.png +++ /dev/null diff --git a/plugins/Referers/images/searchEngines/www.eurip.com.png b/plugins/Referers/images/searchEngines/www.eurip.com.png Binary files differdeleted file mode 100644 index 1e660b7409..0000000000 --- a/plugins/Referers/images/searchEngines/www.eurip.com.png +++ /dev/null diff --git a/plugins/Referers/images/searchEngines/www.everyclick.com.png b/plugins/Referers/images/searchEngines/www.everyclick.com.png Binary files differdeleted file mode 100644 index a86286737a..0000000000 --- a/plugins/Referers/images/searchEngines/www.everyclick.com.png +++ /dev/null diff --git a/plugins/Referers/images/searchEngines/www.facebook.com.png b/plugins/Referers/images/searchEngines/www.facebook.com.png Binary files differdeleted file mode 100644 index 50794d05c3..0000000000 --- a/plugins/Referers/images/searchEngines/www.facebook.com.png +++ /dev/null diff --git a/plugins/Referers/images/searchEngines/www.feedminer.com.png b/plugins/Referers/images/searchEngines/www.feedminer.com.png Binary files differdeleted file mode 100644 index 1e660b7409..0000000000 --- a/plugins/Referers/images/searchEngines/www.feedminer.com.png +++ /dev/null diff --git a/plugins/Referers/images/searchEngines/www.feedster.com.png b/plugins/Referers/images/searchEngines/www.feedster.com.png Binary files differdeleted file mode 100644 index 1e660b7409..0000000000 --- a/plugins/Referers/images/searchEngines/www.feedster.com.png +++ /dev/null diff --git a/plugins/Referers/images/searchEngines/www.firstsfind.com.png b/plugins/Referers/images/searchEngines/www.firstsfind.com.png Binary files differdeleted file mode 100644 index 1e660b7409..0000000000 --- a/plugins/Referers/images/searchEngines/www.firstsfind.com.png +++ /dev/null diff --git a/plugins/Referers/images/searchEngines/www.fixsuche.de.png b/plugins/Referers/images/searchEngines/www.fixsuche.de.png Binary files differdeleted file mode 100644 index 8f6591c35e..0000000000 --- a/plugins/Referers/images/searchEngines/www.fixsuche.de.png +++ /dev/null diff --git a/plugins/Referers/images/searchEngines/www.gnadenmeer.de.png b/plugins/Referers/images/searchEngines/www.gnadenmeer.de.png Binary files differdeleted file mode 100644 index 1e660b7409..0000000000 --- a/plugins/Referers/images/searchEngines/www.gnadenmeer.de.png +++ /dev/null diff --git a/plugins/Referers/images/searchEngines/www.google.com.png b/plugins/Referers/images/searchEngines/www.google.com.png Binary files differindex dd52532085..154ecfcfe0 100644 --- a/plugins/Referers/images/searchEngines/www.google.com.png +++ b/plugins/Referers/images/searchEngines/www.google.com.png diff --git a/plugins/Referers/images/searchEngines/www.google.interia.pl.png b/plugins/Referers/images/searchEngines/www.google.interia.pl.png Binary files differnew file mode 100644 index 0000000000..75a8d7c0f0 --- /dev/null +++ b/plugins/Referers/images/searchEngines/www.google.interia.pl.png diff --git a/plugins/Referers/images/searchEngines/www.hooseek.com.png b/plugins/Referers/images/searchEngines/www.hooseek.com.png Binary files differdeleted file mode 100644 index 446d33f37d..0000000000 --- a/plugins/Referers/images/searchEngines/www.hooseek.com.png +++ /dev/null diff --git a/plugins/Referers/images/searchEngines/www.hotbot.com.png b/plugins/Referers/images/searchEngines/www.hotbot.com.png Binary files differnew file mode 100644 index 0000000000..882c6f89bc --- /dev/null +++ b/plugins/Referers/images/searchEngines/www.hotbot.com.png diff --git a/plugins/Referers/images/searchEngines/www.ilse.nl.png b/plugins/Referers/images/searchEngines/www.ilse.nl.png Binary files differdeleted file mode 100644 index 1e636956f3..0000000000 --- a/plugins/Referers/images/searchEngines/www.ilse.nl.png +++ /dev/null diff --git a/plugins/Referers/images/searchEngines/www.jungle-spider.de.png b/plugins/Referers/images/searchEngines/www.jungle-spider.de.png Binary files differdeleted file mode 100644 index 7827fa705a..0000000000 --- a/plugins/Referers/images/searchEngines/www.jungle-spider.de.png +++ /dev/null diff --git a/plugins/Referers/images/searchEngines/www.kostenlos.de.png b/plugins/Referers/images/searchEngines/www.kostenlos.de.png Binary files differdeleted file mode 100644 index 6efc23a5cf..0000000000 --- a/plugins/Referers/images/searchEngines/www.kostenlos.de.png +++ /dev/null diff --git a/plugins/Referers/images/searchEngines/www.latne.lv.png b/plugins/Referers/images/searchEngines/www.latne.lv.png Binary files differdeleted file mode 100644 index e340e33092..0000000000 --- a/plugins/Referers/images/searchEngines/www.latne.lv.png +++ /dev/null diff --git a/plugins/Referers/images/searchEngines/www.maailm.com.png b/plugins/Referers/images/searchEngines/www.maailm.com.png Binary files differdeleted file mode 100644 index 1e660b7409..0000000000 --- a/plugins/Referers/images/searchEngines/www.maailm.com.png +++ /dev/null diff --git a/plugins/Referers/images/searchEngines/www.meceoo.fr.png b/plugins/Referers/images/searchEngines/www.meceoo.fr.png Binary files differdeleted file mode 100644 index 1e660b7409..0000000000 --- a/plugins/Referers/images/searchEngines/www.meceoo.fr.png +++ /dev/null diff --git a/plugins/Referers/images/searchEngines/www.meinestadt.de.png b/plugins/Referers/images/searchEngines/www.meinestadt.de.png Binary files differindex 869889da09..c172657c4c 100644 --- a/plugins/Referers/images/searchEngines/www.meinestadt.de.png +++ b/plugins/Referers/images/searchEngines/www.meinestadt.de.png diff --git a/plugins/Referers/images/searchEngines/www.mister-wong.com.png b/plugins/Referers/images/searchEngines/www.mister-wong.com.png Binary files differdeleted file mode 100644 index af332512c3..0000000000 --- a/plugins/Referers/images/searchEngines/www.mister-wong.com.png +++ /dev/null diff --git a/plugins/Referers/images/searchEngines/www.monstercrawler.com.png b/plugins/Referers/images/searchEngines/www.monstercrawler.com.png Binary files differdeleted file mode 100644 index 0bcc37fce0..0000000000 --- a/plugins/Referers/images/searchEngines/www.monstercrawler.com.png +++ /dev/null diff --git a/plugins/Referers/images/searchEngines/www.mozbot.com.png b/plugins/Referers/images/searchEngines/www.mozbot.com.png Binary files differnew file mode 100644 index 0000000000..1a284a60ad --- /dev/null +++ b/plugins/Referers/images/searchEngines/www.mozbot.com.png diff --git a/plugins/Referers/images/searchEngines/www.multimania.lycos.fr.png b/plugins/Referers/images/searchEngines/www.multimania.lycos.fr.png Binary files differnew file mode 100644 index 0000000000..cb1478bb01 --- /dev/null +++ b/plugins/Referers/images/searchEngines/www.multimania.lycos.fr.png diff --git a/plugins/Referers/images/searchEngines/www.mysearch.com.png b/plugins/Referers/images/searchEngines/www.mywebsearch.com.png Binary files differindex 5a437790fd..5a437790fd 100644 --- a/plugins/Referers/images/searchEngines/www.mysearch.com.png +++ b/plugins/Referers/images/searchEngines/www.mywebsearch.com.png diff --git a/plugins/Referers/images/searchEngines/www.neti.ee.png b/plugins/Referers/images/searchEngines/www.neti.ee.png Binary files differdeleted file mode 100644 index 650222e4b8..0000000000 --- a/plugins/Referers/images/searchEngines/www.neti.ee.png +++ /dev/null diff --git a/plugins/Referers/images/searchEngines/www.netster.com.png b/plugins/Referers/images/searchEngines/www.netster.com.png Binary files differdeleted file mode 100644 index 1e660b7409..0000000000 --- a/plugins/Referers/images/searchEngines/www.netster.com.png +++ /dev/null diff --git a/plugins/Referers/images/searchEngines/www.overture.com.png b/plugins/Referers/images/searchEngines/www.overture.com.png Binary files differdeleted file mode 100644 index 91dcc48793..0000000000 --- a/plugins/Referers/images/searchEngines/www.overture.com.png +++ /dev/null diff --git a/plugins/Referers/images/searchEngines/www.qualigo.at.png b/plugins/Referers/images/searchEngines/www.qualigo.at.png Binary files differdeleted file mode 100644 index 74658bd886..0000000000 --- a/plugins/Referers/images/searchEngines/www.qualigo.at.png +++ /dev/null diff --git a/plugins/Referers/images/searchEngines/www.qualigo.de.png b/plugins/Referers/images/searchEngines/www.qualigo.de.png Binary files differnew file mode 100644 index 0000000000..b87866c2e3 --- /dev/null +++ b/plugins/Referers/images/searchEngines/www.qualigo.de.png diff --git a/plugins/Referers/images/searchEngines/www.rpmfind.net.png b/plugins/Referers/images/searchEngines/www.rpmfind.net.png Binary files differdeleted file mode 100644 index 8e196f112e..0000000000 --- a/plugins/Referers/images/searchEngines/www.rpmfind.net.png +++ /dev/null diff --git a/plugins/Referers/images/searchEngines/www.searchscout.com.png b/plugins/Referers/images/searchEngines/www.searchscout.com.png Binary files differdeleted file mode 100644 index 1e660b7409..0000000000 --- a/plugins/Referers/images/searchEngines/www.searchscout.com.png +++ /dev/null diff --git a/plugins/Referers/images/searchEngines/www.seekport.de.png b/plugins/Referers/images/searchEngines/www.seekport.de.png Binary files differnew file mode 100644 index 0000000000..d5da478ca6 --- /dev/null +++ b/plugins/Referers/images/searchEngines/www.seekport.de.png diff --git a/plugins/Referers/images/searchEngines/www.sogou.com.png b/plugins/Referers/images/searchEngines/www.sogou.com.png Binary files differdeleted file mode 100644 index e8561b7b22..0000000000 --- a/plugins/Referers/images/searchEngines/www.sogou.com.png +++ /dev/null diff --git a/plugins/Referers/images/searchEngines/www.soso.com.png b/plugins/Referers/images/searchEngines/www.soso.com.png Binary files differdeleted file mode 100644 index d23736e56e..0000000000 --- a/plugins/Referers/images/searchEngines/www.soso.com.png +++ /dev/null diff --git a/plugins/Referers/images/searchEngines/www.start.no.png b/plugins/Referers/images/searchEngines/www.start.no.png Binary files differnew file mode 100644 index 0000000000..095f39a869 --- /dev/null +++ b/plugins/Referers/images/searchEngines/www.start.no.png diff --git a/plugins/Referers/images/searchEngines/www.tixuma.de.png b/plugins/Referers/images/searchEngines/www.tixuma.de.png Binary files differdeleted file mode 100644 index 4e516ebfb3..0000000000 --- a/plugins/Referers/images/searchEngines/www.tixuma.de.png +++ /dev/null diff --git a/plugins/Referers/images/searchEngines/www.trusted--search.com.png b/plugins/Referers/images/searchEngines/www.trusted--search.com.png Binary files differdeleted file mode 100644 index 1e660b7409..0000000000 --- a/plugins/Referers/images/searchEngines/www.trusted--search.com.png +++ /dev/null diff --git a/plugins/Referers/images/searchEngines/www.vindex.nl.png b/plugins/Referers/images/searchEngines/www.vindex.nl.png Binary files differdeleted file mode 100644 index 2e1185eb06..0000000000 --- a/plugins/Referers/images/searchEngines/www.vindex.nl.png +++ /dev/null diff --git a/plugins/Referers/images/searchEngines/www.web.nl.png b/plugins/Referers/images/searchEngines/www.web.nl.png Binary files differdeleted file mode 100644 index 1e660b7409..0000000000 --- a/plugins/Referers/images/searchEngines/www.web.nl.png +++ /dev/null diff --git a/plugins/Referers/images/searchEngines/www.webalta.ru.png b/plugins/Referers/images/searchEngines/www.webalta.ru.png Binary files differnew file mode 100644 index 0000000000..ba7a30a043 --- /dev/null +++ b/plugins/Referers/images/searchEngines/www.webalta.ru.png diff --git a/plugins/Referers/images/searchEngines/www.x-recherche.com.png b/plugins/Referers/images/searchEngines/www.x-recherche.com.png Binary files differdeleted file mode 100644 index 1e660b7409..0000000000 --- a/plugins/Referers/images/searchEngines/www.x-recherche.com.png +++ /dev/null diff --git a/plugins/Referers/images/searchEngines/www.ya.ru.png b/plugins/Referers/images/searchEngines/www.ya.ru.png Binary files differnew file mode 100644 index 0000000000..bc3c364935 --- /dev/null +++ b/plugins/Referers/images/searchEngines/www.ya.ru.png diff --git a/plugins/Referers/images/searchEngines/www.yandex.ru.png b/plugins/Referers/images/searchEngines/www.yandex.ru.png Binary files differnew file mode 100644 index 0000000000..bc3c364935 --- /dev/null +++ b/plugins/Referers/images/searchEngines/www.yandex.ru.png diff --git a/plugins/Referers/images/searchEngines/wxsl.nl.png b/plugins/Referers/images/searchEngines/wxsl.nl.png Binary files differdeleted file mode 100644 index 1e660b7409..0000000000 --- a/plugins/Referers/images/searchEngines/wxsl.nl.png +++ /dev/null diff --git a/plugins/Referers/images/searchEngines/ya.ru.png b/plugins/Referers/images/searchEngines/ya.ru.png Binary files differnew file mode 100644 index 0000000000..bc3c364935 --- /dev/null +++ b/plugins/Referers/images/searchEngines/ya.ru.png diff --git a/plugins/Referers/templates/index.tpl b/plugins/Referers/templates/index.tpl index bd7dfd96cf..0f2aff9729 100644 --- a/plugins/Referers/templates/index.tpl +++ b/plugins/Referers/templates/index.tpl @@ -4,7 +4,7 @@ <h2>{'Referers_Evolution'|translate}</h2> {$graphEvolutionReferers} -<br /> +<br/> <div id='leftcolumn'> <h2>{'Referers_Type'|translate}</h2> <div id='leftcolumn'> @@ -26,7 +26,7 @@ {$dataTableRefererType} </div> -<div style="clear:both;"></div> +<div style="clear:both" /> <p>View <a href="javascript:broadcast.propagateAjax('module=Referers&action=getSearchEnginesAndKeywords')">{'Referers_SubmenuSearchEngines'|translate}</a>, diff --git a/plugins/SecurityInfo/Controller.php b/plugins/SecurityInfo/Controller.php deleted file mode 100644 index 8059d88702..0000000000 --- a/plugins/SecurityInfo/Controller.php +++ /dev/null @@ -1,44 +0,0 @@ -<?php -/** - * Piwik - Open source web analytics - * - * @link http://piwik.org - * @license http://www.gnu.org/licenses/gpl-3.0.html Gpl v3 or later - * @version $Id$ - * - * @category Piwik_Plugins - * @package Piwik_SecurityInfo - */ - -/** - * @package Piwik_SecurityInfo - */ -class Piwik_SecurityInfo_Controller extends Piwik_Controller -{ - function index() - { - Piwik::checkUserIsSuperUser(); - - require_once(dirname(__FILE__) . '/PhpSecInfo/PhpSecInfo.php'); - - // instantiate the class - $psi = new PhpSecInfo(); - - // load and run all tests - $psi->loadAndRun(); - - // grab the results as a multidimensional array - $results = $psi->getResultsAsArray(); - - // suppress results - unset($results['test_results']['Core']['memory_limit']); - unset($results['test_results']['Core']['post_max_size']); - unset($results['test_results']['Core']['upload_max_filesize']); - - $view = Piwik_View::factory('index'); - $this->setGeneralVariablesView($view); - $view->menu = Piwik_GetAdminMenu(); - $view->results = $results; - echo $view->render(); - } -} diff --git a/plugins/SecurityInfo/LICENSE b/plugins/SecurityInfo/LICENSE deleted file mode 100644 index 26c1d76267..0000000000 --- a/plugins/SecurityInfo/LICENSE +++ /dev/null @@ -1,10 +0,0 @@ -Copyright (C) 2006 Edward Finkler - - -Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - 3. The name of the author may not be used to endorse or promote products derived from this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
\ No newline at end of file diff --git a/plugins/SecurityInfo/PhpSecInfo/PhpSecInfo.php b/plugins/SecurityInfo/PhpSecInfo/PhpSecInfo.php deleted file mode 100644 index e12a057433..0000000000 --- a/plugins/SecurityInfo/PhpSecInfo/PhpSecInfo.php +++ /dev/null @@ -1,591 +0,0 @@ -<?php -/** - * Main class file - * - * @package PhpSecInfo - * @author Ed Finkler <coj@funkatron.com> - */ - - -/** - * The default language setting if none is set/retrievable - * - */ -define ('PHPSECINFO_LANG_DEFAULT', 'en'); - -/** - * a general version string to differentiate releases - * - */ -define ('PHPSECINFO_VERSION', '0.2.2'); - -/** - * a YYYYMMDD date string to indicate "build" date - * - */ -define ('PHPSECINFO_BUILD', '20080723'); - -/** - * Homepage for phpsecinfo project - * - */ -define ('PHPSECINFO_URL', 'http://phpsecinfo.com'); - -/** - * The base folder where views are stored. Include trailing slash - * - */ -define('PHPSECINFO_VIEW_DIR_DEFAULT', 'View/'); - - -/** - * The default format, used to load the proper view. - */ -define('PHPSECINFO_FORMAT_DEFAULT', 'Html'); - - -/** - * The base directory, used to resolve requires and includes - */ -define('PHPSECINFO_BASE_DIR', dirname(__FILE__)); - -/** - * This is the main class for the phpsecinfo system. It's responsible for - * dynamically loading tests, running those tests, and generating the results - * output - * - * Example: - * <code> - * <?php require_once(PHPSECINFO_BASE_DIR.'/PhpSecInfo.php'); ?> - * <?php phpsecinfo(); ?> - * </code> - * - * If you want to capture the output, or just grab the test results and display them - * in your own way, you'll need to do slightly more work. - * - * Example: - * <code> - * require_once(PHPSECINFO_BASE_DIR.'/PhpSecInfo.php'); - * // instantiate the class - * $psi = new PhpSecInfo(); - * - * // load and run all tests - * $psi->loadAndRun(); - * - * // grab the results as a multidimensional array - * $results = $psi->getResultsAsArray(); - * echo "<pre>"; echo print_r($results, true); echo "</pre>"; - * - * // grab the standard results output as a string - * $html = $psi->getOutput(); - * - * // send it to the browser - * echo $html; - * </code> - * - * - * The procedural function "phpsecinfo" is defined below this class. - * @see phpsecinfo() - * - * @author Ed Finkler <coj@funkatron.com> - * - * see CHANGELOG for changes - * - */ -class PhpSecInfo -{ - - /** - * An array of tests to run - * - * @var array PhpSecInfo_Test - */ - var $tests_to_run = array(); - - - /** - * An array of results. Each result is an associative array: - * <code> - * $result['result'] = PHPSECINFO_TEST_RESULT_NOTICE; - * $result['message'] = "a string describing the test results and what they mean"; - * </code> - * - * @var array - */ - var $test_results = array(); - - - /** - * An array of tests that were not run - * - * <code> - * $result['result'] = PHPSECINFO_TEST_RESULT_NOTRUN; - * $result['message'] = "a string explaining why the test was not run"; - * </code> - * - * @var array - */ - var $tests_not_run = array(); - - - /** - * The language code used. Defaults to PHPSECINFO_LANG_DEFAULT, which - * is 'en' - * - * @var string - * @see PHPSECINFO_LANG_DEFAULT - */ - var $language = PHPSECINFO_LANG_DEFAULT; - - - /** - * An array of integers recording the number of test results in each category. Categories can include - * some or all of the PHPSECINFO_TEST_* constants. Constants are the keys, # of results are the values. - * - * @var array - */ - var $result_counts = array(); - - - /** - * The number of tests that have been run - * - * @var integer - */ - var $num_tests_run = 0; - - - /** - * The base directory for phpsecinfo. Set within the constructor. Paths are resolved from this. - * @var string - */ - var $_base_dir; - - - /** - * The directory PHPSecInfo will look for views. It defaults to the value - * in PHPSECINFO_VIEW_DIR_DEFAULT, but can be changed with the setViewDirectory() - * method. - * - * @var string - */ - var $_view_directory; - - - /** - * The output format, used to load the proper view - * - * @var string - **/ - var $_format; - - /** - * Constructor - * - * @return PhpSecInfo - */ - function PhpSecInfo($opts = null) { - - $this->_base_dir = dirname(__FILE__); - - if ($opts) { - if (isset($opts['view_directory'])) { - $this->setViewDirectory($opts['view_directory']); - } else { - $this->setViewDirectory(dirname(__FILE__).DIRECTORY_SEPARATOR . PHPSECINFO_VIEW_DIR_DEFAULT); - } - - if (isset($opts['format'])) { - $this->setFormat($opts['format']); - } else { - if (strtolower(php_sapi_name()) == 'cli' ) { - $this->setFormat('Cli'); - } else { - $this->setFormat(PHPSECINFO_FORMAT_DEFAULT); - } - } - - } else { /* Use defaults */ - $this->setViewDirectory(dirname(__FILE__).DIRECTORY_SEPARATOR . PHPSECINFO_VIEW_DIR_DEFAULT); - if (strtolower(php_sapi_name()) == 'cli' ) { - $this->setFormat('Cli'); - } else { - $this->setFormat(PHPSECINFO_FORMAT_DEFAULT); - } - } - } - - - /** - * recurses through the Test subdir and includes classes in each test group subdir, - * then builds an array of classnames for the tests that will be run - * - */ - function loadTests() { - - $test_root = dir(dirname(__FILE__).DIRECTORY_SEPARATOR.'Test'); - - //echo "<pre>"; echo print_r($test_root, true); echo "</pre>"; - - while (false !== ($entry = $test_root->read())) { - if ( is_dir($test_root->path.DIRECTORY_SEPARATOR.$entry) && !preg_match('|^\.(.*)$|', $entry) ) { - $test_dirs[] = $entry; - } - } - //echo "<pre>"; echo print_r($test_dirs, true); echo "</pre>"; - - // include_once all files in each test dir - foreach ($test_dirs as $test_dir) { - $this_dir = dir($test_root->path.DIRECTORY_SEPARATOR.$test_dir); - - while (false !== ($entry = $this_dir->read())) { - if (!is_dir($this_dir->path.DIRECTORY_SEPARATOR.$entry)) { - include_once $this_dir->path.DIRECTORY_SEPARATOR.$entry; - $classNames[] = "PhpSecInfo_Test_".$test_dir."_".basename($entry, '.php'); - } - } - - } - - // modded this to not throw a PHP5 STRICT notice, although I don't like passing by value here - $this->tests_to_run = $classNames; - } - - - /** - * This runs the tests in the tests_to_run array and - * places returned data in the following arrays/scalars: - * - $this->test_results - * - $this->result_counts - * - $this->num_tests_run - * - $this->tests_not_run; - * - */ - function runTests() { - // initialize a bunch of arrays - $this->test_results = array(); - $this->result_counts = array(); - $this->result_counts[PHPSECINFO_TEST_RESULT_NOTRUN] = 0; - $this->num_tests_run = 0; - - foreach ($this->tests_to_run as $testClass) { - - /** - * @var $test PhpSecInfo_Test - */ - $test = new $testClass(); - - if ($test->isTestable()) { - $test->test(); - $rs = array( 'result' => $test->getResult(), - 'message' => $test->getMessage(), - 'value_current' => $test->getCurrentTestValue(), - 'value_recommended' => $test->getRecommendedTestValue(), - 'moreinfo_url' => $test->getMoreInfoURL(), - ); - $this->test_results[$test->getTestGroup()][$test->getTestName()] = $rs; - - // initialize if not yet set - if (!isset ($this->result_counts[$rs['result']]) ) { - $this->result_counts[$rs['result']] = 0; - } - - $this->result_counts[$rs['result']]++; - $this->num_tests_run++; - } else { - $rs = array( 'result' => $test->getResult(), - 'message' => $test->getMessage(), - 'value_current' => NULL, - 'value_recommended' => NULL, - 'moreinfo_url' => $test->getMoreInfoURL(), - ); - $this->result_counts[PHPSECINFO_TEST_RESULT_NOTRUN]++; - $this->tests_not_run[$test->getTestGroup()."::".$test->getTestName()] = $rs; - } - } - } - - - /** - * This is the main output method. The look and feel mimics phpinfo() - * - */ - function renderOutput($page_title="Security Information About PHP") { - /** - * We need to use PhpSecInfo_Test::getBooleanIniValue() below - * @see PhpSecInfo_Test::getBooleanIniValue() - */ - if (!class_exists('PhpSecInfo_Test')) { - include( dirname(__FILE__).DIRECTORY_SEPARATOR.'Test'.DIRECTORY_SEPARATOR.'Test.php'); - } - $this->loadView($this->_format); - } - - - /** - * This is a helper method that makes it easy to output tables of test results - * for a given test group - * - * @param string $group_name - * @param array $group_results - */ - function _outputRenderTable($group_name, $group_results) { - - // exit out if $group_results was empty or not an array. This sorta seems a little hacky... - if (!is_array($group_results) || sizeof($group_results) < 1) { - return false; - } - - ksort($group_results); - - $this->loadView($this->_format.'/Result', array('group_name'=>$group_name, 'group_results'=>$group_results)); - - return true; - } - - - - /** - * This outputs a table containing a summary of the test results (counts and % in each result type) - * - * @see PHPSecInfo::_outputRenderTable() - * @see PHPSecInfo::_outputGetResultTypeFromCode() - */ - function _outputRenderStatsTable() { - - foreach($this->result_counts as $code=>$val) { - if ($code != PHPSECINFO_TEST_RESULT_NOTRUN) { - $percentage = round($val/$this->num_tests_run * 100,2); - $result_type = $this->_outputGetResultTypeFromCode($code); - $stats[$result_type] = array( 'count' => $val, - 'result' => $code, - 'message' => "$val out of {$this->num_tests_run} ($percentage%)"); - } - } - - $this->_outputRenderTable('Test Results Summary', $stats); - - } - - - - /** - * This outputs a table containing a summary or test that were not executed, and the reasons why they were skipped - * - * @see PHPSecInfo::_outputRenderTable() - */ - function _outputRenderNotRunTable() { - - $this->_outputRenderTable('Tests Not Run', $this->tests_not_run); - - } - - - - - /** - * This is a helper function that returns a CSS class corresponding to - * the result code the test returned. This allows us to color-code - * results - * - * @param integer $code - * @return string - */ - function _outputGetCssClassFromResult($code) { - - switch ($code) { - case PHPSECINFO_TEST_RESULT_OK: - return 'value-ok'; - break; - - case PHPSECINFO_TEST_RESULT_NOTICE: - return 'value-notice'; - break; - - case PHPSECINFO_TEST_RESULT_WARN: - return 'value-warn'; - break; - - case PHPSECINFO_TEST_RESULT_NOTRUN: - return 'value-notrun'; - break; - - case PHPSECINFO_TEST_RESULT_ERROR: - return 'value-error'; - break; - - default: - return 'value-notrun'; - break; - } - - } - - - - /** - * This is a helper function that returns a label string corresponding to - * the result code the test returned. This is mainly used for the Test - * Results Summary table. - * - * @see PHPSecInfo::_outputRenderStatsTable() - * @param integer $code - * @return string - */ - function _outputGetResultTypeFromCode($code) { - - switch ($code) { - case PHPSECINFO_TEST_RESULT_OK: - return 'Pass'; - break; - - case PHPSECINFO_TEST_RESULT_NOTICE: - return 'Notice'; - break; - - case PHPSECINFO_TEST_RESULT_WARN: - return 'Warning'; - break; - - case PHPSECINFO_TEST_RESULT_NOTRUN: - return 'Not Run'; - break; - - case PHPSECINFO_TEST_RESULT_ERROR: - return 'Error'; - break; - - default: - return 'Invalid Result Code'; - break; - } - - } - - - /** - * Loads and runs all the tests - * - * As loading, then running, is a pretty common process, this saves a extra method call - * - * @since 0.1.1 - * - */ - function loadAndRun() { - $this->loadTests(); - $this->runTests(); - } - - - /** - * returns an associative array of test data. Four keys are set: - * - test_results (array) - * - tests_not_run (array) - * - result_counts (array) - * - num_tests_run (integer) - * - * note that this must be called after tests are loaded and run - * - * @since 0.1.1 - * @return array - */ - function getResultsAsArray() { - $results = array(); - - $results['test_results'] = $this->test_results; - $results['tests_not_run'] = $this->tests_not_run; - $results['result_counts'] = $this->result_counts; - $results['num_tests_run'] = $this->num_tests_run; - - return $results; - } - - - - /** - * returns the standard output as a string instead of echoing it to the browser - * - * note that this must be called after tests are loaded and run - * - * @since 0.1.1 - * - * @return string - */ - function getOutput() { - ob_start(); - $this->renderOutput(); - $output = ob_get_clean(); - return $output; - } - - - /** - * A very, very simple "view" system - * - */ - function loadView($view_name, $data=null) { - if ($data != null) { - extract($data); - } - - $view_file = $this->getViewDirectory().$view_name.".php"; - - if ( file_exists($view_file) && is_readable($view_file) ) { - ob_start(); - include $view_file; - echo ob_get_clean(); - } else { - user_error("The view '{$view_file}' either does not exist or is not readable", E_USER_WARNING); - } - - - } - - - /** - * Returns the current view directory - * - * @return string - */ - function getViewDirectory() { - return $this->_view_directory; - } - - - /** - * Sets the directory that PHPSecInfo will look in for views - * - * @param string $newdir - */ - function setViewDirectory($newdir) { - $this->_view_directory = $newdir; - } - - - - - function getFormat() { - return $this->_format; - } - - - function setFormat($format) { - $this->_format = $format; - } - -} - - - - -/** - * A globally-available function that runs the tests and creates the result page - * - */ -function phpsecinfo() { - // modded this to not throw a PHP5 STRICT notice, although I don't like passing by value here - $psi = new PhpSecInfo(); - $psi->loadAndRun(); - $psi->renderOutput(); -} - diff --git a/plugins/SecurityInfo/PhpSecInfo/Test/Application/php.php b/plugins/SecurityInfo/PhpSecInfo/Test/Application/php.php deleted file mode 100644 index 0d86d309e9..0000000000 --- a/plugins/SecurityInfo/PhpSecInfo/Test/Application/php.php +++ /dev/null @@ -1,66 +0,0 @@ -<?php -/** - * Test class for PHP Application - * - * @package PhpSecInfo - * @author Piwik - */ - -/** - * require the PhpSecInfo_Test_Application class - */ -require_once(PHPSECINFO_BASE_DIR.'/Test/Test_Application.php'); - -/** - * Test class for PHP application - * - * Checks PHP version - * - * @package PhpSecInfo - * @author Piwik - */ -class PhpSecInfo_Test_Application_Php extends PhpSecInfo_Test_Application -{ - var $test_name = "PHP"; - - var $recommended_value = null; - - function _retrieveCurrentValue() { - $this->current_value = PHP_VERSION;; - - $url = 'http://php.net/releases/?serialize=1&version=5'; - $timeout = Piwik_UpdateCheck::SOCKET_TIMEOUT; - try { - $latestVersion = Piwik_Http::sendHttpRequest($url, $timeout); - $versionInfo = Piwik_Common::unserialize_array($latestVersion); - $this->recommended_value = $versionInfo['version']; - } catch(Exception $e) { - $this->recommended_value = ''; - } - } - - function _execTest() { - if (version_compare($this->current_value, '5.2.1') < 0) { - return PHPSECINFO_TEST_RESULT_WARN; - } - - if (empty($this->recommended_value)) { - return PHPSECINFO_TEST_RESULT_ERROR; - } - - if (version_compare($this->current_value, $this->recommended_value) >= 0 ) { - return PHPSECINFO_TEST_RESULT_OK; - } - - return PHPSECINFO_TEST_RESULT_NOTICE; - } - - function _setMessages() { - parent::_setMessages(); - - $this->setMessageForResult(PHPSECINFO_TEST_RESULT_OK, 'en', "You are running PHP ".$this->recommended_value." (the latest version)."); - $this->setMessageForResult(PHPSECINFO_TEST_RESULT_NOTICE, 'en', "You are running PHP ".$this->current_value.". The latest version of PHP is ".$this->recommended_value."."); - $this->setMessageForResult(PHPSECINFO_TEST_RESULT_WARN, 'en', "You are running PHP ".$this->current_value." which is really old. We recommend running the latest (stable) version of PHP which includes numerous bug fixes and security fixes."); - $this->setMessageForResult(PHPSECINFO_TEST_RESULT_ERROR, 'en', "Unable to determine the latest version of PHP available."); - } -} diff --git a/plugins/SecurityInfo/PhpSecInfo/Test/Application/piwik.php b/plugins/SecurityInfo/PhpSecInfo/Test/Application/piwik.php deleted file mode 100644 index 5a495a352c..0000000000 --- a/plugins/SecurityInfo/PhpSecInfo/Test/Application/piwik.php +++ /dev/null @@ -1,58 +0,0 @@ -<?php -/** - * Test class for Piwik Application - * - * @package PhpSecInfo - * @author Piwik - */ - -/** - * require the PhpSecInfo_Test_Application class - */ -require_once(PHPSECINFO_BASE_DIR.'/Test/Test_Application.php'); - -/** - * Test class for Piwik application - * - * Checks Piwik version - * - * @package PhpSecInfo - * @author Piwik - */ -class PhpSecInfo_Test_Application_Piwik extends PhpSecInfo_Test_Application -{ - var $test_name = "Piwik"; - - var $recommended_value = null; - - function _retrieveCurrentValue() { - $this->current_value = Piwik_Version::VERSION; - - $this->recommended_value = Piwik_GetOption(Piwik_UpdateCheck::LATEST_VERSION); - } - - function _execTest() { - if (version_compare($this->current_value, '0.5') < 0) { - return PHPSECINFO_TEST_RESULT_WARN; - } - - if (empty($this->recommended_value)) { - return PHPSECINFO_TEST_RESULT_ERROR; - } - - if (version_compare($this->current_value, $this->recommended_value) >= 0) { - return PHPSECINFO_TEST_RESULT_OK; - } - - return PHPSECINFO_TEST_RESULT_NOTICE; - } - - function _setMessages() { - parent::_setMessages(); - - $this->setMessageForResult(PHPSECINFO_TEST_RESULT_OK, 'en', "You are running Piwik ".$this->current_value." (the latest version)."); - $this->setMessageForResult(PHPSECINFO_TEST_RESULT_NOTICE, 'en', "You are running Piwik ".$this->current_value.". The latest version of Piwik is ".$this->recommended_value."."); - $this->setMessageForResult(PHPSECINFO_TEST_RESULT_WARN, 'en', "You are running Piwik ".$this->current_value." which is no longer supported by the Piwik developers. We recommend running the latest (stable) version of Piwik which includes numerous enhancements, bug fixes, and security fixes."); - $this->setMessageForResult(PHPSECINFO_TEST_RESULT_ERROR, 'en', "Unable to determine the latest version of Piwik available."); - } -} diff --git a/plugins/SecurityInfo/PhpSecInfo/Test/CGI/force_redirect.php b/plugins/SecurityInfo/PhpSecInfo/Test/CGI/force_redirect.php deleted file mode 100644 index 9822cbf394..0000000000 --- a/plugins/SecurityInfo/PhpSecInfo/Test/CGI/force_redirect.php +++ /dev/null @@ -1,71 +0,0 @@ -<?php -/** - * Test class for cgi force_redirect - * - * @package PhpSecInfo - * @author Ed Finkler <coj@funkatron.com> - */ - -/** - * require the PhpSecInfo_Test_Cgi class - */ -require_once(PHPSECINFO_BASE_DIR.'/Test/Test_Cgi.php'); - -/** - * Test class for cgi force_redirect - * - * @package PhpSecInfo - * @author Ed Finkler <coj@funkatron.com> - */ -class PhpSecInfo_Test_Cgi_Force_Redirect extends PhpSecInfo_Test_Cgi -{ - - /** - * This should be a <b>unique</b>, human-readable identifier for this test - * - * @var string - */ - var $test_name = "force_redirect"; - - /** - * The recommended setting value - * - * @var mixed - */ - var $recommended_value = TRUE; - - - - function _retrieveCurrentValue() { - $this->current_value = $this->getBooleanIniValue('cgi.force_redirect'); - } - - - /** - * Checks to see if cgi.force_redirect is enabled - * - */ - function _execTest() { - - if ($this->current_value == $this->recommended_value) { - return PHPSECINFO_TEST_RESULT_OK; - } - - return PHPSECINFO_TEST_RESULT_WARN; - } - - - - /** - * Set the messages specific to this test - * - */ - function _setMessages() { - parent::_setMessages(); - - $this->setMessageForResult(PHPSECINFO_TEST_RESULT_OK, 'en', "force_redirect is enabled, which is the recommended setting"); - $this->setMessageForResult(PHPSECINFO_TEST_RESULT_WARN, 'en', "force_redirect is disabled. In most cases, this is a <strong>serious</strong> security vulnerability. Unless you are absolutely sure this is not needed, enable this setting"); - - } - -}
\ No newline at end of file diff --git a/plugins/SecurityInfo/PhpSecInfo/Test/Core/allow_url_fopen.php b/plugins/SecurityInfo/PhpSecInfo/Test/Core/allow_url_fopen.php deleted file mode 100644 index 799bb88110..0000000000 --- a/plugins/SecurityInfo/PhpSecInfo/Test/Core/allow_url_fopen.php +++ /dev/null @@ -1,79 +0,0 @@ -<?php -/** - * Test Class for allow_url_fopen - * - * @package PhpSecInfo - * @author Ed Finkler <coj@funkatron.com> - */ - - -/** - * require the PhpSecInfo_Test_Core class - */ -require_once(PHPSECINFO_BASE_DIR.'/Test/Test_Core.php'); - -/** - * Test Class for allow_url_fopen - * - * @package PhpSecInfo - * - * - */ -class PhpSecInfo_Test_Core_Allow_Url_Fopen extends PhpSecInfo_Test_Core -{ - /** - * This should be a <b>unique</b>, human-readable identifier for this test - * - * @var string - */ - var $test_name = "allow_url_fopen"; - - /** - * The recommended setting value - * - * @var mixed - */ - var $recommended_value = FALSE; - - - - function _retrieveCurrentValue() { - $this->current_value = $this->getBooleanIniValue('allow_url_fopen'); - } - - - /** - * Checks to see if allow_url_fopen is enabled - * - */ - function _execTest() { - if ( version_compare(PHP_VERSION, '5.2', '<') ) { /* this is much more severe if we're running < 5.2 */ - if ($this->current_value == $this->recommended_value) { - return PHPSECINFO_TEST_RESULT_OK; - } - - return PHPSECINFO_TEST_RESULT_WARN; - } else { /* In 5.2, we'll consider allow_url_fopen "safe" */ - $this->recommended_value = TRUE; - return PHPSECINFO_TEST_RESULT_OK; - } - } - - - /** - * Set the messages specific to this test - * - */ - function _setMessages() { - parent::_setMessages(); - if ( version_compare(PHP_VERSION, '5.2', '<') ) { /* this is much more severe if we're running < 5.2 */ - $this->setMessageForResult(PHPSECINFO_TEST_RESULT_OK, 'en', 'allow_url_fopen is disabled, which is the recommended setting'); - $this->setMessageForResult(PHPSECINFO_TEST_RESULT_WARN, 'en', 'allow_url_fopen is enabled. This could be a serious security risk. You should disable allow_url_fopen and consider using the <a href="http://php.net/manual/en/ref.curl.php" target="_blank">PHP cURL functions</a> instead.'); - - } else { - $this->setMessageForResult(PHPSECINFO_TEST_RESULT_OK, 'en', 'You are running PHP 5.2 or greater, which makes allow_url_fopen significantly safer. Make sure allow_url_include is <em>disabled</em>, though'); - } - } - - -}
\ No newline at end of file diff --git a/plugins/SecurityInfo/PhpSecInfo/Test/Core/allow_url_include.php b/plugins/SecurityInfo/PhpSecInfo/Test/Core/allow_url_include.php deleted file mode 100644 index 59bedcafc1..0000000000 --- a/plugins/SecurityInfo/PhpSecInfo/Test/Core/allow_url_include.php +++ /dev/null @@ -1,82 +0,0 @@ -<?php -/** - * Test Class for allow_url_include - * - * @package PhpSecInfo - * @author Ed Finkler <coj@funkatron.com> - */ - - -/** - * require the PhpSecInfo_Test_Core class - */ -require_once(PHPSECINFO_BASE_DIR.'/Test/Test_Core.php'); - -/** - * Test Class for allow_url_include - * - * @package PhpSecInfo - * - * - */ -class PhpSecInfo_Test_Core_Allow_Url_Include extends PhpSecInfo_Test_Core -{ - /** - * This should be a <b>unique</b>, human-readable identifier for this test - * - * @var string - */ - var $test_name = "allow_url_include"; - - - var $recommended_value = FALSE; - - - function _retrieveCurrentValue() { - $this->current_value = $this->getBooleanIniValue('allow_url_include'); - } - - - /** - * Checks to see if allow_url_fopen is enabled - * - */ - function _execTest() { - if ($this->current_value == $this->recommended_value) { - return PHPSECINFO_TEST_RESULT_OK; - } - - return PHPSECINFO_TEST_RESULT_WARN; - } - - - /** - * allow_url_include is only available since PHP 5.2 - * - * @return boolean - */ - function isTestable() { - - if ( version_compare(PHP_VERSION, '5.2', '<') ) { - return false; - } else { - return true; - } - } - - - - /** - * Set the messages specific to this test - * - */ - function _setMessages() { - parent::_setMessages(); - - $this->setMessageForResult(PHPSECINFO_TEST_RESULT_NOTRUN, 'en', 'You are running a version of PHP older than 5.2, and allow_url_include is not available'); - $this->setMessageForResult(PHPSECINFO_TEST_RESULT_OK, 'en', 'allow_url_include is disabled, which is the recommended setting'); - $this->setMessageForResult(PHPSECINFO_TEST_RESULT_WARN, 'en', 'allow_url_include is enabled. This could be a serious security risk. You should disable allow_url_include and consider using the <a href="http://php.net/manual/en/ref.curl.php" target="_blank">PHP cURL functions</a> instead.'); - } - - -}
\ No newline at end of file diff --git a/plugins/SecurityInfo/PhpSecInfo/Test/Core/display_errors.php b/plugins/SecurityInfo/PhpSecInfo/Test/Core/display_errors.php deleted file mode 100644 index e0e93d6748..0000000000 --- a/plugins/SecurityInfo/PhpSecInfo/Test/Core/display_errors.php +++ /dev/null @@ -1,62 +0,0 @@ -<?php -/** - * Test class for display_errors - * - * @package PhpSecInfo - * @author Ed Finkler <coj@funkatron.com> - */ - - -/** - * require the PhpSecInfo_Test_Core class - */ -require_once(PHPSECINFO_BASE_DIR.'/Test/Test_Core.php'); - -/** - * Test class for display_errors - * - * @package PhpSecInfo - */ -class PhpSecInfo_Test_Core_Display_Errors extends PhpSecInfo_Test_Core -{ - - /** - * This should be a <b>unique</b>, human-readable identifier for this test - * - * @var string - */ - var $test_name = "display_errors"; - - var $recommended_value = FALSE; - - function _retrieveCurrentValue() { - $this->current_value = $this->getBooleanIniValue('display_errors'); - } - - - /** - * Checks to see if display_errors is enabled - * - */ - function _execTest() { - if ($this->current_value == $this->recommended_value) { - return PHPSECINFO_TEST_RESULT_OK; - } - - return PHPSECINFO_TEST_RESULT_NOTICE; - } - - - /** - * Set the messages specific to this test - * - */ - function _setMessages() { - parent::_setMessages(); - - $this->setMessageForResult(PHPSECINFO_TEST_RESULT_OK, 'en', 'display_errors is disabled, which is the recommended setting'); - $this->setMessageForResult(PHPSECINFO_TEST_RESULT_NOTICE, 'en', 'display_errors is enabled. This is not recommended on "production" servers, as it could reveal sensitive information. You should consider disabling this feature'); - } - - -}
\ No newline at end of file diff --git a/plugins/SecurityInfo/PhpSecInfo/Test/Core/expose_php.php b/plugins/SecurityInfo/PhpSecInfo/Test/Core/expose_php.php deleted file mode 100644 index 3f26648193..0000000000 --- a/plugins/SecurityInfo/PhpSecInfo/Test/Core/expose_php.php +++ /dev/null @@ -1,64 +0,0 @@ -<?php -/** - * Test class for expose_php - * - * @package PhpSecInfo - * @author Ed Finkler <coj@funkatron.com> - */ - - -/** - * require the PhpSecInfo_Test_Core class - */ -require_once(PHPSECINFO_BASE_DIR.'/Test/Test_Core.php'); - -/** - * Test class for expose_php - * - * @package PhpSecInfo - */ -class PhpSecInfo_Test_Core_Expose_Php extends PhpSecInfo_Test_Core -{ - - /** - * This should be a <b>unique</b>, human-readable identifier for this test - * - * @var string - */ - var $test_name = "expose_php"; - - var $recommended_value = FALSE; - - function _retrieveCurrentValue() { - $this->current_value = $this->returnBytes(ini_get('expose_php')); - } - - /** - * Checks to see if expose_php is enabled - * - */ - function _execTest() { - - if ($this->current_value == $this->recommended_value) { - return PHPSECINFO_TEST_RESULT_OK; - } - - return PHPSECINFO_TEST_RESULT_NOTICE; - } - - - /** - * Set the messages specific to this test - * - */ - function _setMessages() { - parent::_setMessages(); - - $this->setMessageForResult(PHPSECINFO_TEST_RESULT_OK, 'en', 'expose_php is disabled, which is the recommended setting'); - $this->setMessageForResult(PHPSECINFO_TEST_RESULT_NOTICE, 'en', 'expose_php is enabled. This adds - the PHP "signature" to the web server header, including the PHP version number. This - could attract attackers looking for vulnerable versions of PHP'); - } - - -}
\ No newline at end of file diff --git a/plugins/SecurityInfo/PhpSecInfo/Test/Core/file_uploads.php b/plugins/SecurityInfo/PhpSecInfo/Test/Core/file_uploads.php deleted file mode 100644 index 6a3c822aae..0000000000 --- a/plugins/SecurityInfo/PhpSecInfo/Test/Core/file_uploads.php +++ /dev/null @@ -1,63 +0,0 @@ -<?php -/** - * Test Class for file_uploads - * - * @package PhpSecInfo - * @author Ed Finkler <coj@funkatron.com> - */ - - -/** - * require the PhpSecInfo_Test_Core class - */ -require_once(PHPSECINFO_BASE_DIR.'/Test/Test_Core.php'); - -/** - * Test Class for file_uploads - * - * @package PhpSecInfo - */ -class PhpSecInfo_Test_Core_File_Uploads extends PhpSecInfo_Test_Core -{ - - /** - * This should be a <b>unique</b>, human-readable identifier for this test - * - * @var string - */ - var $test_name = "file_uploads"; - - var $recommended_value = FALSE; - - function _retrieveCurrentValue() { - $this->current_value = $this->returnBytes(ini_get('file_uploads')); - } - - /** - * Checks to see if expose_php is enabled - * - */ - function _execTest() { - - if ($this->current_value == $this->recommended_value) { - return PHPSECINFO_TEST_RESULT_OK; - } - - return PHPSECINFO_TEST_RESULT_NOTICE; - } - - - - /** - * Set the messages specific to this test - * - */ - function _setMessages() { - parent::_setMessages(); - - $this->setMessageForResult(PHPSECINFO_TEST_RESULT_OK, 'en', 'file_uploads are disabled. Unless you\'re sure you need them, this is the recommended setting'); - $this->setMessageForResult(PHPSECINFO_TEST_RESULT_NOTICE, 'en', 'file_uploads are enabled. If you do not require file upload capability, consider disabling them.'); - } - - -}
\ No newline at end of file diff --git a/plugins/SecurityInfo/PhpSecInfo/Test/Core/gid.php b/plugins/SecurityInfo/PhpSecInfo/Test/Core/gid.php deleted file mode 100644 index 88a6f3c6c1..0000000000 --- a/plugins/SecurityInfo/PhpSecInfo/Test/Core/gid.php +++ /dev/null @@ -1,93 +0,0 @@ -<?php -/** - * Test class for GID - * - * @package PhpSecInfo - * @author Ed Finkler <coj@funkatron.com> - */ - - -/** - * require the PhpSecInfo_Test_Core class - */ -require_once(PHPSECINFO_BASE_DIR.'/Test/Test_Core.php'); - - -/** - * the minimum "safe" UID that php should be executing as. This can vary, - * but in general 100 seems like a good min. - * - */ -define ('PHPSECINFO_MIN_SAFE_GID', 100); - -/** - * Test class for GID - * - * @package PhpSecInfo - */ -class PhpSecInfo_Test_Core_Gid extends PhpSecInfo_Test_Core -{ - - /** - * This should be a <b>unique</b>, human-readable identifier for this test - * - * @var string - */ - var $test_name = "group_id"; - - var $recommended_value = PHPSECINFO_MIN_SAFE_GID; - - - /** - * This test only works under Unix OSes - * - * @return boolean - */ - function isTestable() { - if ($this->osIsWindows()) { - return false; - } elseif ($this->getUnixId() === false) { - $this->setMessageForResult(PHPSECINFO_TEST_RESULT_NOTRUN, 'en', 'Functions required to retrieve group ID not available'); - return false; - } - return true; - } - - function _retrieveCurrentValue() { - $id = $this->getUnixId(); - if (is_array($id)) { - $lowest_gid = key($id['groups']); - $this->current_value = $lowest_gid; - } else { - $this->current_value = false; - } - } - - /** - * Checks the GID of the PHP process to make sure it is above PHPSECINFO_MIN_SAFE_GID - * - * @see PHPSECINFO_MIN_SAFE_GID - */ - function _execTest() { - if ($this->current_value >= $this->recommended_value) { - return PHPSECINFO_TEST_RESULT_OK; - } - - return PHPSECINFO_TEST_RESULT_WARN; - } - - - /** - * Set the messages specific to this test - * - */ - function _setMessages() { - parent::_setMessages(); - - $this->setMessageForResult(PHPSECINFO_TEST_RESULT_OK, 'en', 'PHP is executing as what is probably a non-privileged group'); - $this->setMessageForResult(PHPSECINFO_TEST_RESULT_WARN, 'en', 'PHP may be executing as a "privileged" group, which could be a serious security vulnerability.'); - $this->setMessageForResult(PHPSECINFO_TEST_RESULT_NOTRUN, 'en', 'This test will not run on Windows OSes'); - } - - -}
\ No newline at end of file diff --git a/plugins/SecurityInfo/PhpSecInfo/Test/Core/magic_quotes_gpc.php b/plugins/SecurityInfo/PhpSecInfo/Test/Core/magic_quotes_gpc.php deleted file mode 100644 index 89a0ff6f0d..0000000000 --- a/plugins/SecurityInfo/PhpSecInfo/Test/Core/magic_quotes_gpc.php +++ /dev/null @@ -1,80 +0,0 @@ -<?php -/** - * Test Class for magic_quotes_gpc - * - * @package PhpSecInfo - * @author Ed Finkler <coj@funkatron.com> - */ - - - -/** - * require the PhpSecInfo_Test_Core class - */ -require_once(PHPSECINFO_BASE_DIR.'/Test/Test_Core.php'); - -/** - * Test Class for magic_quotes_gpc - * - * @package PhpSecInfo - */ -class PhpSecInfo_Test_Core_Magic_Quotes_GPC extends PhpSecInfo_Test_Core -{ - /** - * This should be a <b>unique</b>, human-readable identifier for this test - * - * @var string - */ - var $test_name = "magic_quotes_gpc"; - - - var $recommended_value = FALSE; - - - function _retrieveCurrentValue() { - $this->current_value = $this->getBooleanIniValue('magic_quotes_gpc'); - } - - - /** - * magic_quotes_gpc has been removed since PHP 6.0 - * - * @return boolean - */ - function isTestable() { - return version_compare(PHP_VERSION, '6', '<') ; - } - - - /** - * Checks to see if allow_url_fopen is enabled - * - */ - function _execTest() { - if ($this->current_value == $this->recommended_value) { - return PHPSECINFO_TEST_RESULT_OK; - } - - return PHPSECINFO_TEST_RESULT_NOTICE; - } - - - /** - * Set the messages specific to this test - * - */ - function _setMessages() { - parent::_setMessages(); - - - $this->setMessageForResult(PHPSECINFO_TEST_RESULT_NOTRUN, 'en', 'You are running PHP 6 or later and magic_quotes_gpc has been removed'); - $this->setMessageForResult(PHPSECINFO_TEST_RESULT_OK, 'en', 'magic_quotes_gpc is disabled, which is the recommended setting'); - $this->setMessageForResult(PHPSECINFO_TEST_RESULT_NOTICE, 'en', 'magic_quotes_gpc is enabled. This - feature is inconsistent in blocking attacks, and can in some cases cause data loss with - uploaded files. You should <i>not</i> rely on magic_quotes_gpc to block attacks. It is - recommended that magic_quotes_gpc be disabled, and input filtering be handled by your PHP - scripts'); - } - - -}
\ No newline at end of file diff --git a/plugins/SecurityInfo/PhpSecInfo/Test/Core/memory_limit.php b/plugins/SecurityInfo/PhpSecInfo/Test/Core/memory_limit.php deleted file mode 100644 index 82a33d8db9..0000000000 --- a/plugins/SecurityInfo/PhpSecInfo/Test/Core/memory_limit.php +++ /dev/null @@ -1,88 +0,0 @@ -<?php -/** - * Test Class for memory_limit setting - * - * @package PhpSecInfo - * @author Paul Reinheimer - * @author Ed Finkler - * @author Mark Wallaert <mark@autumnweave.com> - */ - - -/** - * require the PhpSecInfo_Test_Core class - */ -require_once(PHPSECINFO_BASE_DIR.'/Test/Test_Core.php'); - -/** - * The max recommended size for the memory_limit setting, in bytes - * - */ -define ('PHPSECINFO_MEMORY_LIMIT', 8*1024*1024); - -/** - * Test Class for memory_limit setting - * - * @package PhpSecInfo - */ -class PhpSecInfo_Test_Core_Memory_Limit extends PhpSecInfo_Test_Core -{ - - - /** - * This should be a <b>unique</b>, human-readable identifier for this test - * - * @var string - */ - var $test_name = "memory_limit"; - - var $recommended_value = PHPSECINFO_MEMORY_LIMIT; - - function _retrieveCurrentValue() { - $this->current_value = $this->returnBytes(ini_get('memory_limit')); - } - - - /** - * Check to see if the memory_limit setting is enabled. - * - * Test conditions and results: - * OK: memory_limit enabled and set to a value of 8MB or less. - * NOTICE: memory_limit enabled and set to a value greater than 8MB. - * WARNING: memory_limit disabled (compile time option). - * - * @return integer - */ - function _execTest() { - if (!$this->current_value) { - return PHPSECINFO_TEST_RESULT_WARN; - } else if ($this->returnBytes($this->current_value) <= PHPSECINFO_MEMORY_LIMIT) { - return PHPSECINFO_TEST_RESULT_OK; - } - return PHPSECINFO_TEST_RESULT_NOTICE; - } - - - /** - * Set the messages specific to this test - * - * @access public - * @return null - */ - function _setMessages() { - parent::_setMessages(); - $this->setMessageForResult(PHPSECINFO_TEST_RESULT_OK, 'en', 'memory_limit is enabled, and appears to be set - to a realistic value.'); - $this->setMessageForResult(PHPSECINFO_TEST_RESULT_NOTICE, 'en', 'memory_limit is set to a very high value. Are - you sure your apps require this much memory? If not, lower the limit, as certain attacks or poor - programming practices can lead to exhaustion of server resources. It is recommended that you set this - to a realistic value (8M for example) from which it can be expanded as required.'); - $this->setMessageForResult(PHPSECINFO_TEST_RESULT_WARN, 'en', 'memory_limit does not appear to be enabled. This - leaves the server vulnerable to attacks that attempt to exhaust resources and creates an environment - where poor programming practices can propagate unchecked. This must be enabled at compile time by - including the parameter "--enable-memory-limit" in the configure line. Once enabled "memory_limit" may - be set in php.ini to define the maximum amount of memory a script is allowed to allocate.'); - } - - -}
\ No newline at end of file diff --git a/plugins/SecurityInfo/PhpSecInfo/Test/Core/open_basedir.php b/plugins/SecurityInfo/PhpSecInfo/Test/Core/open_basedir.php deleted file mode 100644 index d5b0d282f6..0000000000 --- a/plugins/SecurityInfo/PhpSecInfo/Test/Core/open_basedir.php +++ /dev/null @@ -1,69 +0,0 @@ -<?php -/** - * Test Class for open_basedir - * - * @package PhpSecInfo - * @author Ed Finkler <coj@funkatron.com> - */ - - -/** - * require the PhpSecInfo_Test_Core class - */ -require_once(PHPSECINFO_BASE_DIR.'/Test/Test_Core.php'); - -/** - * Test Class for open_basedir - * - * @package PhpSecInfo - */ -class PhpSecInfo_Test_Core_Open_Basedir extends PhpSecInfo_Test_Core -{ - - /** - * This should be a <b>unique</b>, human-readable identifier for this test - * - * @var string - */ - var $test_name = "open_basedir"; - - var $recommended_value = TRUE; - - - function _retrieveCurrentValue() { - $this->current_value = $this->getBooleanIniValue('open_basedir'); - } - - - /** - * Checks to see if allow_url_fopen is enabled - * - */ - function _execTest() { - if ($this->current_value == $this->recommended_value) { - return PHPSECINFO_TEST_RESULT_OK; - } - - return PHPSECINFO_TEST_RESULT_NOTICE; - } - - - /** - * Set the messages specific to this test - * - */ - function _setMessages() { - parent::_setMessages(); - - $this->setMessageForResult(PHPSECINFO_TEST_RESULT_OK, 'en', 'open_basedir is enabled, which is the - recommended setting. Keep in mind that other web applications not written in PHP will not - be restricted by this setting.'); - $this->setMessageForResult(PHPSECINFO_TEST_RESULT_NOTICE, 'en', 'open_basedir is disabled. When - this is enabled, only files that are in the - given directory/directories and their subdirectories can be read by PHP scripts. - You should consider turning this on. Keep in mind that other web applications not - written in PHP will not be restricted by this setting.'); - } - - -}
\ No newline at end of file diff --git a/plugins/SecurityInfo/PhpSecInfo/Test/Core/post_max_size.php b/plugins/SecurityInfo/PhpSecInfo/Test/Core/post_max_size.php deleted file mode 100644 index 09bd2474ec..0000000000 --- a/plugins/SecurityInfo/PhpSecInfo/Test/Core/post_max_size.php +++ /dev/null @@ -1,71 +0,0 @@ -<?php -/** - * Test Class for post_max_size - * - * @package PhpSecInfo - * @author Ed Finkler <coj@funkatron.com> - */ - - -/** - * require the PhpSecInfo_Test_Core class - */ -require_once(PHPSECINFO_BASE_DIR.'/Test/Test_Core.php'); - -/** - * The max recommended size for the post_max_size setting, in bytes - * - */ -define ('PHPSECINFO_POST_MAXLIMIT', 1024*256); - -/** - * Test Class for post_max_size - * - * @package PhpSecInfo - */ -class PhpSecInfo_Test_Core_Post_Max_Size extends PhpSecInfo_Test_Core -{ - - /** - * This should be a <b>unique</b>, human-readable identifier for this test - * - * @var string - */ - var $test_name = "post_max_size"; - - var $recommended_value = PHPSECINFO_POST_MAXLIMIT; - - function _retrieveCurrentValue() { - $this->current_value = $this->returnBytes(ini_get('post_max_size')); - } - - /** - * Check to see if the post_max_size setting is enabled. - */ - function _execTest() { - - if ($this->current_value - && $this->current_value <= $this->recommended_value - && $post_max_size != -1) { - return PHPSECINFO_TEST_RESULT_OK; - } - - return PHPSECINFO_TEST_RESULT_NOTICE; - } - - - /** - * Set the messages specific to this test - * - */ - function _setMessages() { - parent::_setMessages(); - - $this->setMessageForResult(PHPSECINFO_TEST_RESULT_OK, 'en', 'post_max_size is enabled, and appears to - be a relatively low value'); - $this->setMessageForResult(PHPSECINFO_TEST_RESULT_NOTICE, 'en', 'post_max_size is not enabled, or is set to - a high value. Allowing a large value may open up your server to denial-of-service attacks'); - } - - -}
\ No newline at end of file diff --git a/plugins/SecurityInfo/PhpSecInfo/Test/Core/register_globals.php b/plugins/SecurityInfo/PhpSecInfo/Test/Core/register_globals.php deleted file mode 100644 index 1caa7e8e30..0000000000 --- a/plugins/SecurityInfo/PhpSecInfo/Test/Core/register_globals.php +++ /dev/null @@ -1,77 +0,0 @@ -<?php -/** - * Test Class for register_globals - * - * @package PhpSecInfo - * @author Ed Finkler <coj@funkatron.com> - */ - - -/** - * require the PhpSecInfo_Test_Core class - */ -require_once(PHPSECINFO_BASE_DIR.'/Test/Test_Core.php'); - - -/** - * Test Class for register_globals - * - * @package PhpSecInfo - */ -class PhpSecInfo_Test_Core_Register_Globals extends PhpSecInfo_Test_Core -{ - - /** - * This should be a <b>unique</b>, human-readable identifier for this test - * - * @var string - */ - var $test_name = "register_globals"; - - - var $recommended_value = FALSE; - - - function _retrieveCurrentValue() { - $this->current_value = $this->getBooleanIniValue('register_globals'); - } - - - /** - * register_globals has been removed since PHP 6.0 - * - * @return boolean - */ - function isTestable() { - return version_compare(PHP_VERSION, '6', '<') ; - } - - - - /** - * Checks to see if allow_url_fopen is enabled - * - */ - function _execTest() { - if ($this->current_value == $this->recommended_value) { - return PHPSECINFO_TEST_RESULT_OK; - } - - return PHPSECINFO_TEST_RESULT_WARN; - } - - - /** - * Set the messages specific to this test - * - */ - function _setMessages() { - parent::_setMessages(); - - $this->setMessageForResult(PHPSECINFO_TEST_RESULT_NOTRUN, 'en', 'You are running PHP 6 or later and register_globals has been removed'); - $this->setMessageForResult(PHPSECINFO_TEST_RESULT_OK, 'en', 'register_globals is disabled, which is the recommended setting'); - $this->setMessageForResult(PHPSECINFO_TEST_RESULT_WARN, 'en', 'register_globals is enabled. This could be a serious security risk. You should disable register_globals immediately'); - } - - -}
\ No newline at end of file diff --git a/plugins/SecurityInfo/PhpSecInfo/Test/Core/uid.php b/plugins/SecurityInfo/PhpSecInfo/Test/Core/uid.php deleted file mode 100644 index cbc3ae13ec..0000000000 --- a/plugins/SecurityInfo/PhpSecInfo/Test/Core/uid.php +++ /dev/null @@ -1,93 +0,0 @@ -<?php -/** - * Test class for UID - * - * @package PhpSecInfo - * @author Ed Finkler <coj@funkatron.com> - */ - - -/** - * require the PhpSecInfo_Test_Core class - */ -require_once(PHPSECINFO_BASE_DIR.'/Test/Test_Core.php'); - - -/** - * the minimum "safe" UID that php should be executing as. This can vary, - * but in general 100 seems like a good min. - * - */ -define ('PHPSECINFO_MIN_SAFE_UID', 100); - -/** - * Test class for UID - * - * @package PhpSecInfo - */ -class PhpSecInfo_Test_Core_Uid extends PhpSecInfo_Test_Core -{ - - /** - * This should be a <b>unique</b>, human-readable identifier for this test - * - * @var string - */ - var $test_name = "user_id"; - - var $recommended_value = PHPSECINFO_MIN_SAFE_UID; - - /** - * This test only works under Unix OSes - * - * @return boolean - */ - function isTestable() { - if ($this->osIsWindows()) { - return false; - } elseif ($this->getUnixId() === false) { - $this->setMessageForResult(PHPSECINFO_TEST_RESULT_NOTRUN, 'en', 'Functions required to retrieve user ID not available'); - return false; - } - return true; - } - - - function _retrieveCurrentValue() { - $id = $this->getUnixId(); - if (is_array($id)) { - $this->current_value = $id['uid']; - } else { - $this->current_value = false; - } - - } - - /** - * Checks the GID of the PHP process to make sure it is above PHPSECINFO_MIN_SAFE_UID - * - * @see PHPSECINFO_MIN_SAFE_UID - */ - function _execTest() { - if ($this->current_value >= $this->recommended_value) { - return PHPSECINFO_TEST_RESULT_OK; - } - - return PHPSECINFO_TEST_RESULT_WARN; - } - - - /** - * Set the messages specific to this test - * - */ - function _setMessages() { - parent::_setMessages(); - - $this->setMessageForResult(PHPSECINFO_TEST_RESULT_OK, 'en', 'PHP is executing as what is probably a non-privileged user'); - $this->setMessageForResult(PHPSECINFO_TEST_RESULT_WARN, 'en', 'PHP may be executing as a "privileged" user, which could be a serious security vulnerability.'); - $this->setMessageForResult(PHPSECINFO_TEST_RESULT_NOTRUN, 'en', 'This test will not run on Windows OSes'); - } - - -}
\ No newline at end of file diff --git a/plugins/SecurityInfo/PhpSecInfo/Test/Core/upload_max_filesize.php b/plugins/SecurityInfo/PhpSecInfo/Test/Core/upload_max_filesize.php deleted file mode 100644 index bc0b66b42b..0000000000 --- a/plugins/SecurityInfo/PhpSecInfo/Test/Core/upload_max_filesize.php +++ /dev/null @@ -1,70 +0,0 @@ -<?php -/** - * Test Class for upload_max_filesize - * - * @package PhpSecInfo - * @author Ed Finkler <coj@funkatron.com> - */ - -/** - * require the PhpSecInfo_Test_Core class - */ -require_once(PHPSECINFO_BASE_DIR.'/Test/Test_Core.php'); - -/** - * The max recommended size for the upload_max_filesize setting, in bytes - * - */ -define ('PHPSECINFO_UPLOAD_MAXLIMIT', 1024*256); - - -/** - * Test Class for upload_max_filesize - * - * @package PhpSecInfo - */ -class PhpSecInfo_Test_Core_Upload_Max_Filesize extends PhpSecInfo_Test_Core -{ - - - /** - * This should be a <b>unique</b>, human-readable identifier for this test - * - * @var string - */ - var $test_name = "upload_max_filesize"; - - var $recommended_value = PHPSECINFO_UPLOAD_MAXLIMIT; - - function _retrieveCurrentValue() { - $this->current_value = $this->returnBytes(ini_get('upload_max_filesize')); - } - - /** - * Check to see if the post_max_size setting is enabled. - */ - function _execTest() { - - if ($this->current_value - && $this->current_value <= $this->recommended_value - && $post_max_size != -1) { - return PHPSECINFO_TEST_RESULT_OK; - } - - return PHPSECINFO_TEST_RESULT_NOTICE; - } - - - /** - * Set the messages specific to this test - * - */ - function _setMessages() { - parent::_setMessages(); - - $this->setMessageForResult(PHPSECINFO_TEST_RESULT_OK, 'en', 'upload_max_filesize is enabled, and appears to be a relatively low value.'); - $this->setMessageForResult(PHPSECINFO_TEST_RESULT_NOTICE, 'en', 'upload_max_filesize is not enabled, or is set to a high value. Are you sure your apps require uploading files of this size? If not, lower the limit, as large file uploads can impact server performance'); - } - - -}
\ No newline at end of file diff --git a/plugins/SecurityInfo/PhpSecInfo/Test/Core/upload_tmp_dir.php b/plugins/SecurityInfo/PhpSecInfo/Test/Core/upload_tmp_dir.php deleted file mode 100644 index 729c702daf..0000000000 --- a/plugins/SecurityInfo/PhpSecInfo/Test/Core/upload_tmp_dir.php +++ /dev/null @@ -1,99 +0,0 @@ -<?php -/** - * Test Class for upload_tmp_dir - * - * @package PhpSecInfo - * @author Ed Finkler <coj@funkatron.com> - */ - -/** - * require the PhpSecInfo_Test_Core class - */ -require_once(PHPSECINFO_BASE_DIR.'/Test/Test_Core.php'); - -/** - * Test Class for upload_tmp_dir - * - * @package PhpSecInfo - */ -class PhpSecInfo_Test_Core_Upload_Tmp_Dir extends PhpSecInfo_Test_Core -{ - - /** - * This should be a <b>unique</b>, human-readable identifier for this test - * - * @var string - */ - var $test_name = "upload_tmp_dir"; - - var $recommended_value = "A non-world readable/writable directory"; - - function _retrieveCurrentValue() { - $this->current_value = ini_get('upload_tmp_dir'); - - if( empty($this->current_value) ) { - if (function_exists("sys_get_temp_dir")) { - $this->current_value = sys_get_temp_dir(); - } else { - $this->current_value = $this->sys_get_temp_dir(); - } - } - } - - /** - * We are disabling this function on Windows OSes right now until - * we can be certain of the proper way to check world-readability - * - * @return unknown - */ - function isTestable() { - if ($this->osIsWindows()) { - return FALSE; - } else { - return TRUE; - } - } - - /** - * Check if upload_tmp_dir matches PHPSECINFO_TEST_COMMON_TMPDIR, or is word-writable - * - * This is still unix-specific, and it's possible that for now - * this test should be disabled under Windows builds. - * - * @see PHPSECINFO_TEST_COMMON_TMPDIR - */ - function _execTest() { - - $perms = fileperms($this->current_value); - - if ($this->current_value - && !preg_match("|".PHPSECINFO_TEST_COMMON_TMPDIR."/?|", $this->current_value) - && ! ($perms & 0x0004) - && ! ($perms & 0x0002) ) { - return PHPSECINFO_TEST_RESULT_OK; - } - - // rewrite current_value to display perms - $this->current_value .= " (".substr(sprintf('%o', $perms), -4).")"; - - return PHPSECINFO_TEST_RESULT_NOTICE; - } - - - /** - * Set the messages specific to this test - * - */ - function _setMessages() { - parent::_setMessages(); - - $this->setMessageForResult(PHPSECINFO_TEST_RESULT_NOTRUN, 'en', 'Test not run -- currently disabled on Windows OSes'); - $this->setMessageForResult(PHPSECINFO_TEST_RESULT_OK, 'en', 'upload_tmp_dir is enabled, which is the - recommended setting. Make sure your upload_tmp_dir path is not world-readable'); - $this->setMessageForResult(PHPSECINFO_TEST_RESULT_NOTICE, 'en', 'upload_tmp_dir is disabled, or is set to a - common world-writable directory. This typically allows other users on this server - to access temporary copies of files uploaded via your PHP scripts. You should set - upload_tmp_dir to a non-world-readable directory'); - } - -}
\ No newline at end of file diff --git a/plugins/SecurityInfo/PhpSecInfo/Test/Curl/file_support.php b/plugins/SecurityInfo/PhpSecInfo/Test/Curl/file_support.php deleted file mode 100644 index 816d747259..0000000000 --- a/plugins/SecurityInfo/PhpSecInfo/Test/Curl/file_support.php +++ /dev/null @@ -1,75 +0,0 @@ -<?php -/** - * Test class for CURL file_support - * - * @package PhpSecInfo - * @author Ed Finkler <coj@funkatron.com> - */ - -/** - * require the PhpSecInfo_Test_Curl class - */ -require_once(PHPSECINFO_BASE_DIR.'/Test/Test_Curl.php'); - -/** - * Test class for CURL file_support - * - * Checks for CURL file:// support; if this is installed, it can be used to bypass - * safe_mode and open_basedir - * - * - * @package PhpSecInfo - * @author Ed Finkler <coj@funkatron.com> - */ -class PhpSecInfo_Test_Curl_File_Support extends PhpSecInfo_Test_Curl -{ - - /** - * This should be a <b>unique</b>, human-readable identifier for this test - * - * @var string - */ - var $test_name = "file_support"; - - var $recommended_value = '5.1.6+ or 4.4.4+'; - - function _retrieveCurrentValue() { - $this->current_value = PHP_VERSION; - } - - - /** - * Checks to see if libcurl's "file://" support is enabled by examining the "protocols" array - * in the info returned from curl_version() - * @return integer - * - */ - function _execTest() { - - $curlinfo = curl_version(); - - if ( version_compare($this->current_value, '5.1.6', '>=') || - (version_compare($this->current_value, '4.4.4', '>=')) && ( version_compare($this->current_value, '5', '<') ) - ) { - return PHPSECINFO_TEST_RESULT_OK; - } else { - return PHPSECINFO_TEST_RESULT_WARN; - } - - } - - - - /** - * Set the messages specific to this test - * - */ - function _setMessages() { - parent::_setMessages(); - - $this->setMessageForResult(PHPSECINFO_TEST_RESULT_OK, 'en', "You are running PHP 4.4.4 or higher, or PHP 5.1.6 or higher. These versions fix the security hole present in the cURL functions that allow it to bypass safe_mode and open_basedir restrictions."); - $this->setMessageForResult(PHPSECINFO_TEST_RESULT_WARN, 'en', "A security hole present in your version of PHP allows the cURL functions to bypass safe_mode and open_basedir restrictions. You should upgrade to the latest version of PHP."); - - } - -}
\ No newline at end of file diff --git a/plugins/SecurityInfo/PhpSecInfo/Test/Session/save_path.php b/plugins/SecurityInfo/PhpSecInfo/Test/Session/save_path.php deleted file mode 100644 index 5a7ae7752e..0000000000 --- a/plugins/SecurityInfo/PhpSecInfo/Test/Session/save_path.php +++ /dev/null @@ -1,99 +0,0 @@ -<?php -/** - * Test class for session save_path - * - * @package PhpSecInfo - * @author Thomas CORBIERE <thomas@votre-grandeur-celeste.com> - */ - -/** - * require the PhpSecInfo_Test_Core class - */ -require_once(PHPSECINFO_BASE_DIR.'/Test/Test_Session.php'); - -/** - * Test class for session save_path - * - * @package PhpSecInfo - */ -class PhpSecInfo_Test_Session_Save_Path extends PhpSecInfo_Test_Session -{ - - /** - * This should be a <b>unique</b>, human-readable identifier for this test - * - * @var string - */ - var $test_name = "save_path"; - - var $recommended_value = "A non-world readable/writable directory"; - - function _retrieveCurrentValue() { - $this->current_value = ini_get('session.save_path'); - - if( empty($this->current_value) ) { - if (function_exists("sys_get_temp_dir")) { - $this->current_value = sys_get_temp_dir(); - } else { - $this->current_value = $this->sys_get_temp_dir(); - } - } - } - - - /** - * We are disabling this function on Windows OSes right now until - * we can be certain of the proper way to check world-readability - * - * @return unknown - */ - function isTestable() { - if ($this->osIsWindows()) { - return FALSE; - } else { - return TRUE; - } - } - - - /** - * Check if session.save_path matches PHPSECINFO_TEST_COMMON_TMPDIR, or is word-writable - * - * This is still unix-specific, and it's possible that for now - * this test should be disabled under Windows builds. - * - * @see PHPSECINFO_TEST_COMMON_TMPDIR - */ - function _execTest() { - - $perms = fileperms($this->current_value); - - if ($this->current_value - && !preg_match("|".PHPSECINFO_TEST_COMMON_TMPDIR."/?|", $this->current_value) - && ! ($perms & 0x0004) - && ! ($perms & 0x0002) ) { - return PHPSECINFO_TEST_RESULT_OK; - } - - // rewrite current_value to display perms - $this->current_value .= " (".substr(sprintf('%o', $perms), -4).")"; - - return PHPSECINFO_TEST_RESULT_NOTICE; - } - - /** - * Set the messages specific to this test - * - */ - function _setMessages() { - parent::_setMessages(); - - $this->setMessageForResult(PHPSECINFO_TEST_RESULT_NOTRUN, 'en', 'Test not run -- currently disabled on Windows OSes'); - $this->setMessageForResult(PHPSECINFO_TEST_RESULT_OK, 'en', 'save_path is enabled, which is the - recommended setting. Make sure your save_path path is not world-readable'); - $this->setMessageForResult(PHPSECINFO_TEST_RESULT_NOTICE, 'en', 'save_path is disabled, or is set to a - common world-writable directory. This typically allows other users on this server - to access session files. You should set save_path to a non-world-readable directory'); - } - -} diff --git a/plugins/SecurityInfo/PhpSecInfo/Test/Session/use_trans_sid.php b/plugins/SecurityInfo/PhpSecInfo/Test/Session/use_trans_sid.php deleted file mode 100644 index f7f3f2e4a9..0000000000 --- a/plugins/SecurityInfo/PhpSecInfo/Test/Session/use_trans_sid.php +++ /dev/null @@ -1,66 +0,0 @@ -<?php -/** - * Test class for session use_trans_sid - * - * @package PhpSecInfo - * @author Ed Finkler <coj@funkatron.com> - */ - - -/** - * require the PhpSecInfo_Test_Session class - */ -require_once(PHPSECINFO_BASE_DIR.'/Test/Test_Session.php'); - -/** - * Test class for session use_trans_sid - * - * @package PhpSecInfo - * @author Ed Finkler <coj@funkatron.com> - */ -class PhpSecInfo_Test_Session_Use_Trans_Sid extends PhpSecInfo_Test_Session -{ - - /** - * This should be a <b>unique</b>, human-readable identifier for this test - * - * @var string - */ - var $test_name = "use_trans_sid"; - - - var $recommended_value = FALSE; - - - function _retrieveCurrentValue() { - $this->current_value = $this->getBooleanIniValue('session.use_trans_sid'); - } - - - /** - * Checks to see if allow_url_fopen is enabled - * - */ - function _execTest() { - if ($this->current_value == $this->recommended_value) { - return PHPSECINFO_TEST_RESULT_OK; - } - - return PHPSECINFO_TEST_RESULT_NOTICE; - } - - - /** - * Set the messages specific to this test - * - */ - function _setMessages() { - parent::_setMessages(); - - $this->setMessageForResult(PHPSECINFO_TEST_RESULT_OK, 'en', 'use_trans_sid is disabled, which is the recommended setting'); - $this->setMessageForResult(PHPSECINFO_TEST_RESULT_NOTICE, 'en', 'use_trans_sid is enabled. This makes session hijacking easier. Consider disabling this feature'); - - } - - -}
\ No newline at end of file diff --git a/plugins/SecurityInfo/PhpSecInfo/Test/Suhosin/extension.php b/plugins/SecurityInfo/PhpSecInfo/Test/Suhosin/extension.php deleted file mode 100644 index 50e4d05359..0000000000 --- a/plugins/SecurityInfo/PhpSecInfo/Test/Suhosin/extension.php +++ /dev/null @@ -1,46 +0,0 @@ -<?php -/** - * Test class for Suhosin extension - * - * @package PhpSecInfo - * @author Piwik - */ - -/** - * require the PhpSecInfo_Test_Suhosin class - */ -require_once(PHPSECINFO_BASE_DIR.'/Test/Test_Suhosin.php'); - -/** - * Test class for Suhosin extension - * - * Checks for suhosin extension - * - * @package PhpSecInfo - * @author Piwik - */ -class PhpSecInfo_Test_Suhosin_Extension extends PhpSecInfo_Test_Suhosin -{ - var $test_name = "Suhosin extension"; - - var $recommended_value = true; - - function _retrieveCurrentValue() { - $this->current_value = extension_loaded('suhosin'); - } - - function _execTest() { - if ( $this->current_value === true ) { - return PHPSECINFO_TEST_RESULT_OK; - } else { - return PHPSECINFO_TEST_RESULT_NOTICE; - } - } - - function _setMessages() { - parent::_setMessages(); - - $this->setMessageForResult(PHPSECINFO_TEST_RESULT_OK, 'en', "You are running PHP with the Suhosin extension loaded. This extension provides high-level runtime protections, and additional filtering and logging features."); - $this->setMessageForResult(PHPSECINFO_TEST_RESULT_NOTICE, 'en', "You are not running PHP with the Suhosin extension loaded. We recommend both the patch and extension for low- and high-level protections including transparent cookie encryption and remote inclusion vulnerabilities."); - } -} diff --git a/plugins/SecurityInfo/PhpSecInfo/Test/Suhosin/patch.php b/plugins/SecurityInfo/PhpSecInfo/Test/Suhosin/patch.php deleted file mode 100644 index bd8bf5f827..0000000000 --- a/plugins/SecurityInfo/PhpSecInfo/Test/Suhosin/patch.php +++ /dev/null @@ -1,55 +0,0 @@ -<?php -/** - * Test class for Suhosin patch - * - * @package PhpSecInfo - * @author Piwik - */ - -/** - * require the PhpSecInfo_Test_Suhosin class - */ -require_once(PHPSECINFO_BASE_DIR.'/Test/Test_Suhosin.php'); - -/** - * Test class for Suhosin - * - * Checks for Suhosin patch which implements low-level protections against bufferoverflows or format string vulnerabilities - * - * @package PhpSecInfo - * @author Piwik - */ -class PhpSecInfo_Test_Suhosin_Patch extends PhpSecInfo_Test_Suhosin -{ - var $test_name = "Suhosin patch"; - - var $recommended_value = true; - - function _retrieveCurrentValue() { - if (preg_match('/Suhosin/', $_SERVER['SERVER_SOFTWARE'])) { - $this->current_value = true; - } else { - $this->current_value = false; - - $constants = get_defined_constants(false); - if(isset($constants['SUHOSIN_PATCH']) && $constants['SUHOSIN_PATCH'] == 1) { - $this->current_value = true; - } - } - } - - function _execTest() { - if ( $this->current_value === true ) { - return PHPSECINFO_TEST_RESULT_OK; - } else { - return PHPSECINFO_TEST_RESULT_NOTICE; - } - } - - function _setMessages() { - parent::_setMessages(); - - $this->setMessageForResult(PHPSECINFO_TEST_RESULT_OK, 'en', "You are running PHP with the Suhosin patch applied against the PHP core. This patch implements various low-level protections against (for example) buffer overflows and format string vulnerabilities."); - $this->setMessageForResult(PHPSECINFO_TEST_RESULT_NOTICE, 'en', "You are not running PHP with the Suhosin patch applied. We recommend both the patch and extension for low- and high-level protections against (for example) buffer overflows and format string vulnerabilities."); - } -} diff --git a/plugins/SecurityInfo/PhpSecInfo/Test/Test.php b/plugins/SecurityInfo/PhpSecInfo/Test/Test.php deleted file mode 100644 index 5b577dfece..0000000000 --- a/plugins/SecurityInfo/PhpSecInfo/Test/Test.php +++ /dev/null @@ -1,571 +0,0 @@ -<?php -/** - * Skeleton Test class file - * - * @package PhpSecInfo - * @author Ed Finkler <coj@funkatron.com> - */ - -/** - * require the main PhpSecInfo class - */ -require_once(PHPSECINFO_BASE_DIR.'/PhpSecInfo.php'); - - - -define ('PHPSECINFO_TEST_RESULT_OK', -1); - -define ('PHPSECINFO_TEST_RESULT_NOTICE', -2); - -define ('PHPSECINFO_TEST_RESULT_WARN', -4); - -define ('PHPSECINFO_TEST_RESULT_ERROR', -1024); - -define ('PHPSECINFO_TEST_RESULT_NOTRUN', -2048); - -define ('PHPSECINFO_TEST_COMMON_TMPDIR', '/tmp'); - -define ('PHPSECINFO_TEST_MOREINFO_BASEURL', 'http://phpsec.org/projects/phpsecinfo/tests/'); - -/** - * This is a skeleton class for PhpSecInfo tests You should extend this to make a "group" skeleton - * to categorize tests under, then make a subdir with your group name that contains test classes - * extending your group skeleton class. - * @package PhpSecInfo - */ -class PhpSecInfo_Test -{ - - /** - * This value is used to group test results together. - * - * For example, all tests related to the mysql lib should be grouped under "mysql." - * - * @var string - */ - var $test_group = 'misc'; - - - /** - * This should be a <b>unique</b>, human-readable identifier for this test - * - * @var string - */ - var $test_name = 'misc_test'; - - - /** - * This is the recommended value the test will be looking for - * - * @var mixed - */ - var $recommended_value = "bar"; - - - /** - * The result returned from the test - * - * @var integer - */ - var $_result = PHPSECINFO_TEST_RESULT_NOTRUN; - - - /** - * The message corresponding to the result of the test - * - * @var string - */ - var $_message; - - - /** - * the language code. Should be a pointer to the setting in the PhpSecInfo object - * - * @var string - */ - var $_language = PHPSECINFO_LANG_DEFAULT; - - /** - * Enter description here... - * - * @var mixed - */ - var $current_value; - - /** - * This is a hash of messages that correspond to various test result levels. - * - * There are five messages, each corresponding to one of the result constants - * (PHPSECINFO_TEST_RESULT_OK, PHPSECINFO_TEST_RESULT_NOTICE, PHPSECINFO_TEST_RESULT_WARN, - * PHPSECINFO_TEST_RESULT_ERROR, PHPSECINFO_TEST_RESULT_NOTRUN) - * - * - * @var array array - */ - var $_messages = array(); - - - - - /** - * Constructor for Test skeleton class - * - * @return PhpSecInfo_Test - */ - function PhpSecInfo_Test() { - //$this->_setTestValues(); - - $this->_retrieveCurrentValue(); - //$this->setRecommendedValue(); - - $this->_setMessages(); - } - - - /** - * Determines whether or not it's appropriate to run this test (for example, if - * this test is for a particular library, it shouldn't be run if the lib isn't - * loaded). - * - * This is a terrible name, but I couldn't think of a better one atm. - * - * @return boolean - */ - function isTestable() { - - return true; - } - - - /** - * The "meat" of the test. This is where the real test code goes. You should override this when extending - * - * @return integer - */ - function _execTest() { - - return PHPSECINFO_TEST_RESULT_NOTRUN; - } - - - /** - * This function loads up result messages into the $this->_messages array. - * - * Using this method rather than setting $this->_messages directly allows result - * messages to be inherited. This is broken out into a separate function rather - * than the constructor for ease of extension purposes (php4 is whack, man). - * - */ - function _setMessages() { - $this->setMessageForResult(PHPSECINFO_TEST_RESULT_OK, 'en', 'This setting should be safe'); - $this->setMessageForResult(PHPSECINFO_TEST_RESULT_NOTICE, 'en', 'This could potentially be a security issue'); - $this->setMessageForResult(PHPSECINFO_TEST_RESULT_WARN, 'en', 'This setting may be a serious security problem'); - $this->setMessageForResult(PHPSECINFO_TEST_RESULT_ERROR, 'en', 'There was an error running this test'); - $this->setMessageForResult(PHPSECINFO_TEST_RESULT_NOTRUN, 'en', 'This test cannot be run'); - } - - - /** - * Placeholder - extend for tests - * - */ - function _retrieveCurrentValue() { - $this->current_value = "foo"; - } - - - - /** - * This is the wrapper that executes the test and sets the result code and message - */ - function test() { - $result = $this->_execTest(); - $this->_setResult($result); - - } - - - - /** - * Retrieves the result - * - * @return integer - */ - function getResult() { - return $this->_result; - } - - - - - /** - * Retrieves the message for the current result - * - * @return string - */ - function getMessage() { - if (!isset($this->_message) || empty($this->_message)) { - $this->_setMessage($this->_result, $this->_language); - } - - return $this->_message; - } - - - - /** - * Sets the message for a given result code and language - * - * <code> - * $this->setMessageForResult(PHPSECINFO_TEST_RESULT_NOTRUN, 'en', 'This test cannot be run'); - * </code> - * - * @param integer $result_code - * @param string $language_code - * @param string $message - * - */ - function setMessageForResult($result_code, $language_code, $message) { - - if ( !isset($this->_messages[$result_code]) ) { - $this->_messages[$result_code] = array(); - } - - if ( !is_array($this->_messages[$result_code]) ) { - $this->_messages[$result_code] = array(); - } - - $this->_messages[$result_code][$language_code] = $message; - - } - - - - - /** - * returns the current value. This function should be used to access the - * value for display. All values are cast as strings - * - * @return string - */ - function getCurrentTestValue() { - return $this->getStringValue($this->current_value); - } - - /** - * returns the recommended value. This function should be used to access the - * value for display. All values are cast as strings - * - * @return string - */ - function getRecommendedTestValue() { - return $this->getStringValue($this->recommended_value); - } - - - /** - * Sets the result code - * - * @param integer $result_code - */ - function _setResult($result_code) { - $this->_result = $result_code; - } - - - /** - * Sets the $this->_message variable based on the passed result and language codes - * - * @param integer $result_code - * @param string $language_code - */ - function _setMessage($result_code, $language_code) { - $messages = $this->_messages[$result_code]; - $message = $messages[$language_code]; - $this->_message = $message; - } - - - /** - * Returns a link to a page with detailed information about the test - * - * URL is formatted as PHPSECINFO_TEST_MOREINFO_BASEURL + testName - * - * @see PHPSECINFO_TEST_MOREINFO_BASEURL - * - * @return string|boolean - */ - function getMoreInfoURL() { - if ($tn = $this->getTestName()) { - return PHPSECINFO_TEST_MOREINFO_BASEURL.strtolower("{$tn}.html"); - } else { - return false; - } - } - - - - - /** - * This retrieves the name of this test. - * - * If a name has not been set, this returns a formatted version of the class name. - * - * @return string - */ - function getTestName() { - if (isset($this->test_name) && !empty($this->test_name)) { - return $this->test_name; - } else { - return ucwords( - str_replace('_', ' ', - get_class($this) - ) - ); - } - - } - - - /** - * sets the test name - * - * @param string $test_name - */ - function setTestName($test_name) { - $this->test_name = $test_name; - } - - - /** - * Returns the test group this test belongs to - * - * @return string - */ - function getTestGroup() { - return $this->test_group; - } - - - /** - * sets the test group - * - * @param string $test_group - */ - function setTestGroup($test_group) { - $this->test_group = $test_group; - } - - - /** - * This function takes the shorthand notation used in memory limit settings for PHP - * and returns the byte value. Totally stolen from http://us3.php.net/manual/en/function.ini-get.php - * - * <code> - * echo 'post_max_size in bytes = ' . $this->return_bytes(ini_get('post_max_size')); - * </code> - * - * @link http://php.net/manual/en/function.ini-get.php - * @param string $val - * @return integer - */ - function returnBytes($val) { - $val = trim($val); - - if ( (int)$val === 0 ) { - return 0; - } - - $last = strtolower($val{strlen($val)-1}); - switch($last) { - // The 'G' modifier is available since PHP 5.1.0 - case 'g': - $val *= 1024; - case 'm': - $val *= 1024; - case 'k': - $val *= 1024; - } - - return $val; - } - - - /** - * This just does the usual PHP string casting, except for - * the boolean FALSE value, where the string "0" is returned - * instead of an empty string - * - * @param mixed $val - * @return string - */ - function getStringValue($val) { - if ($val === FALSE) { - return "0"; - } else { - return (string)$val; - } - } - - - /** - * This method converts the several possible return values from - * allegedly "boolean" ini settings to proper booleans - * - * Properly converted input values are: 'off', 'on', 'false', 'true', '', '0', '1' - * (the last two might not be neccessary, but I'd rather be safe) - * - * If the ini_value doesn't match any of those, the value is returned as-is. - * - * @param string $ini_key the ini_key you need the value of - * @return boolean|mixed - */ - function getBooleanIniValue($ini_key) { - - $ini_val = ini_get($ini_key); - - switch ( strtolower($ini_val) ) { - - case 'off': - return false; - break; - case 'on': - return true; - break; - case 'false': - return false; - break; - case 'true': - return true; - break; - case '0': - return false; - break; - case '1': - return true; - break; - case '': - return false; - break; - default: - return $ini_val; - - } - - } - - /** - * sys_get_temp_dir provides some temp dir detection capability - * that is lacking in versions of PHP that do not have the - * sys_get_temp_dir() function - * - * @return string|NULL - */ - function sys_get_temp_dir() { - // Try to get from environment variable - if ( !empty($_ENV['TMP']) ) { - return realpath( $_ENV['TMP'] ); - } else if ( !empty($_ENV['TMPDIR']) ) { - return realpath( $_ENV['TMPDIR'] ); - } else if ( !empty($_ENV['TEMP']) ) { - return realpath( $_ENV['TEMP'] ); - } else { - return NULL; - } - } - - - /** - * A quick function to determine whether we're running on Windows. - * Uses the PHP_OS constant. - * - * @return boolean - */ - function osIsWindows() { - if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') { - return true; - } else { - return false; - } - } - - - /** - * Returns an array of data returned from the UNIX 'id' command - * - * includes uid, username, gid, groupname, and groups (if "exec" - * is enabled). Groups is an array of all the groups the user - * belongs to. Keys are the group ids, values are the group names. - * - * returns FALSE if no suitable function is available to retrieve - * the data - * - * @return array|boolean - */ - function getUnixId() { - - if ($this->osIsWindows()) { - return false; - } - - $success = false; - - - if (function_exists("exec") && !PhpSecInfo_Test::getBooleanIniValue('safe_mode')) { - $id_raw = exec('id'); - // uid=1000(coj) gid=1000(coj) groups=1000(coj),1001(admin) - preg_match( "|uid=(\d+)\((\S+)\)\s+gid=(\d+)\((\S+)\)\s+groups=(.+)|i", - $id_raw, - $matches); - - if (!$matches) { - /** - * for some reason the output from 'id' wasn't as we expected. - * return false so the test doesn't run. - */ - $success = false; - } else { - $id_data = array( 'uid'=>$matches[1], - 'username'=>$matches[2], - 'gid'=>$matches[3], - 'group'=>$matches[4] ); - - if ($matches[5]) { - $gs = $matches[5]; - $gs = explode(',', $gs); - foreach ($gs as $groupstr) { - preg_match("/(\d+)\(([^\)]+)\)/", $groupstr, $subs); - $groups[$subs[1]] = $subs[2]; - } - ksort($groups); - $id_data['groups'] = $groups; - } - $success = true; - } - - } - - if (!$success && function_exists("posix_getpwuid") && function_exists("posix_geteuid") - && function_exists('posix_getgrgid') && function_exists('posix_getgroups') ) { - $data = posix_getpwuid( posix_getuid() ); - $id_data['uid'] = $data['uid']; - $id_data['username'] = $data['name']; - $id_data['gid'] = $data['gid']; - //$group_data = posix_getgrgid( posix_getegid() ); - //$id_data['group'] = $group_data['name']; - $groups = posix_getgroups(); - foreach ( $groups as $gid ) { - //$group_data = posix_getgrgid(posix_getgid()); - $id_data['groups'][$gid] = '<unknown>'; - } - $success = true; - } - - if ($success) { - return $id_data; - } else { - return false; - } - } - -} diff --git a/plugins/SecurityInfo/PhpSecInfo/Test/Test_Application.php b/plugins/SecurityInfo/PhpSecInfo/Test/Test_Application.php deleted file mode 100644 index af7a2f9926..0000000000 --- a/plugins/SecurityInfo/PhpSecInfo/Test/Test_Application.php +++ /dev/null @@ -1,54 +0,0 @@ -<?php -/** - * Skeleton Test class file for Application group - * - * @package PhpSecInfo - * @author Anthon Pang - */ - -/** - * require the main PhpSecInfo class - */ -require_once(PHPSECINFO_BASE_DIR.'/Test/Test.php'); - - - -/** - * This is a skeleton class for PhpSecInfo "Application" tests - * @package PhpSecInfo - */ -class PhpSecInfo_Test_Application extends PhpSecInfo_Test -{ - - /** - * This value is used to group test results together. - * - * For example, all tests related to the mysql lib should be grouped under "mysql." - * - * @var string - */ - var $test_group = 'Application'; - - - /** - * "Application" tests should pretty much be always testable, so the default is just to return true - * - * @return boolean - */ - function isTestable() { - return Piwik_Http::getTransportMethod() !== null; - } - - function getMoreInfoURL() { - $urls = array( - 'Piwik' => 'http://piwik.org/changelog', - 'PHP' => 'http://php.net/', - ); - - if ($tn = $this->getTestName()) { - return $urls[$tn]; - } else { - return false; - } - } -} diff --git a/plugins/SecurityInfo/PhpSecInfo/Test/Test_Cgi.php b/plugins/SecurityInfo/PhpSecInfo/Test/Test_Cgi.php deleted file mode 100644 index 6843a59afa..0000000000 --- a/plugins/SecurityInfo/PhpSecInfo/Test/Test_Cgi.php +++ /dev/null @@ -1,61 +0,0 @@ -<?php -/** - * Skeleton Test class file for Cgi group - * - * @package PhpSecInfo - * @author Ed Finkler <coj@funkatron.com> - */ - -/** - * require the main PhpSecInfo class - */ -require_once(PHPSECINFO_BASE_DIR.'/Test/Test.php'); - - - -/** - * This is a skeleton class for PhpSecInfo "CGI" tests - * @package PhpSecInfo - */ -class PhpSecInfo_Test_Cgi extends PhpSecInfo_Test -{ - - /** - * This value is used to group test results together. - * - * For example, all tests related to the mysql lib should be grouped under "mysql." - * - * @var string - */ - var $test_group = 'CGI'; - - - - /** - * "CGI" tests should only be run if we're running as a CGI. The best way I could think of - * to test this was to preg against the php_sapi_name() return value. - * - * @return boolean - */ - function isTestable() { - /*if ( preg_match('/^cgi.*$/', php_sapi_name()) ) { - return true; - } else { - return false; - }*/ - return strpos(php_sapi_name(), 'cgi') === 0; - } - - - /** - * Set the messages for CGI tests - * - */ - function _setMessages() { - parent::_setMessages(); - - $this->setMessageForResult(PHPSECINFO_TEST_RESULT_NOTRUN, 'en', "You don't seem to be using the CGI SAPI"); - - } - -}
\ No newline at end of file diff --git a/plugins/SecurityInfo/PhpSecInfo/Test/Test_Core.php b/plugins/SecurityInfo/PhpSecInfo/Test/Test_Core.php deleted file mode 100644 index 58230794d2..0000000000 --- a/plugins/SecurityInfo/PhpSecInfo/Test/Test_Core.php +++ /dev/null @@ -1,44 +0,0 @@ -<?php -/** - * Skeleton Test class file for Core group - * - * @package PhpSecInfo - * @author Ed Finkler <coj@funkatron.com> - */ - -/** - * require the main PhpSecInfo class - */ -require_once(PHPSECINFO_BASE_DIR.'/Test/Test.php'); - - - -/** - * This is a skeleton class for PhpSecInfo "Core" tests - * @package PhpSecInfo - */ -class PhpSecInfo_Test_Core extends PhpSecInfo_Test -{ - - /** - * This value is used to group test results together. - * - * For example, all tests related to the mysql lib should be grouped under "mysql." - * - * @var string - */ - var $test_group = 'Core'; - - - /** - * "Core" tests should pretty much be always testable, so the default is just to return true - * - * @return boolean - */ - function isTestable() { - - return true; - } - - -}
\ No newline at end of file diff --git a/plugins/SecurityInfo/PhpSecInfo/Test/Test_Curl.php b/plugins/SecurityInfo/PhpSecInfo/Test/Test_Curl.php deleted file mode 100644 index a1e7d57a6f..0000000000 --- a/plugins/SecurityInfo/PhpSecInfo/Test/Test_Curl.php +++ /dev/null @@ -1,62 +0,0 @@ -<?php -/** - * Skeleton Test class file for ` group - * - * @package PhpSecInfo - * @author Ed Finkler <coj@funkatron.com> - */ - -/** - * require the main PhpSecInfo class - */ -require_once(PHPSECINFO_BASE_DIR.'/Test/Test.php'); - - - -/** - * This is a skeleton class for PhpSecInfo "Curl" tests - * @package PhpSecInfo - */ -class PhpSecInfo_Test_Curl extends PhpSecInfo_Test -{ - - /** - * This value is used to group test results together. - * - * For example, all tests related to the mysql lib should be grouped under "mysql." - * - * @var string - */ - var $test_group = 'Curl'; - - - - /** - * "Curl" tests should only be run if the curl extension is installed. We can check - * for this by seeing if the function curl_init() is defined - * - * @return boolean - */ - function isTestable() { -/* if ( function_exists('curl_init') ) { - return true; - } else { - return false; - } -*/ - return extension_loaded('curl'); - } - - - /** - * Set the messages for Curl tests - * - */ - function _setMessages() { - parent::_setMessages(); - - $this->setMessageForResult(PHPSECINFO_TEST_RESULT_NOTRUN, 'en', "CURL support is not enabled in your PHP install"); - - } - -}
\ No newline at end of file diff --git a/plugins/SecurityInfo/PhpSecInfo/Test/Test_Session.php b/plugins/SecurityInfo/PhpSecInfo/Test/Test_Session.php deleted file mode 100644 index 5270fa62c4..0000000000 --- a/plugins/SecurityInfo/PhpSecInfo/Test/Test_Session.php +++ /dev/null @@ -1,46 +0,0 @@ -<?php -/** - * Skeleton Test class file for Session group - * - * @package PhpSecInfo - * @author Ed Finkler <coj@funkatron.com> - */ - - -/** - * require the main PhpSecInfo class - */ -require_once(PHPSECINFO_BASE_DIR.'/Test/Test.php'); - - - -/** - * This is a skeleton class for PhpSecInfo "Session" tests - * @package PhpSecInfo - */ -class PhpSecInfo_Test_Session extends PhpSecInfo_Test -{ - - /** - * This value is used to group test results together. - * - * For example, all tests related to the mysql lib should be grouped under "mysql." - * - * @var string - */ - var $test_group = 'Session'; - - - /** - * "Session" tests should pretty much be always testable, so the default is - * just to return true - * - * @return boolean - */ - function isTestable() { - - return true; - } - - -}
\ No newline at end of file diff --git a/plugins/SecurityInfo/PhpSecInfo/Test/Test_Suhosin.php b/plugins/SecurityInfo/PhpSecInfo/Test/Test_Suhosin.php deleted file mode 100644 index c9a9b3a779..0000000000 --- a/plugins/SecurityInfo/PhpSecInfo/Test/Test_Suhosin.php +++ /dev/null @@ -1,50 +0,0 @@ -<?php -/** - * Skeleton Test class file for Suhosin group - * - * @package PhpSecInfo - * @author Anthon Pang - */ - -/** - * require the main PhpSecInfo class - */ -require_once(PHPSECINFO_BASE_DIR.'/Test/Test.php'); - - - -/** - * This is a skeleton class for PhpSecInfo "Suhosin" tests - * @package PhpSecInfo - */ -class PhpSecInfo_Test_Suhosin extends PhpSecInfo_Test -{ - - /** - * This value is used to group test results together. - * - * For example, all tests related to the mysql lib should be grouped under "mysql." - * - * @var string - */ - var $test_group = 'Suhosin'; - - - /** - * "Suhosin" tests should pretty much be always testable, so the default is just to return true - * - * @return boolean - */ - function isTestable() { - - return true; - } - - function getMoreInfoURL() { - if ($tn = $this->getTestName()) { - return 'http://www.hardened-php.net/suhosin/index.html'; - } else { - return false; - } - } -} diff --git a/plugins/SecurityInfo/README b/plugins/SecurityInfo/README deleted file mode 100644 index 6f6f0cd45c..0000000000 --- a/plugins/SecurityInfo/README +++ /dev/null @@ -1,89 +0,0 @@ -## PHPSECINFO - -*Now on GitHub* - -_see LICENSE for copyright and license info_ - -Mailing List for bug reports, feedback, etc: -http://lists.phpsec.org/mailman/listinfo/phpsecinfo - - -### WHAT IS PHPSECINFO? -PHPSecInfo is a PHP environment security auditing tool modeled after the -phpsecinfo() function. From a single function call, PHPSecInfo runs a -series of tests on your PHP environment to identify potential security -issues and offer suggestions. It can be useful as part of a multilayered -security approach. - - -#### WHAT IS PHPSECINFO NOT? -* It is not a replacement for secure coding practices -* It does not audit PHP code -* It is not comprehensive test for either your hosting environment - or your web application -* It is not the "final word." PHPSecInfo identifies *potential* problems - and offers suggestions for improvement. Your environment may _require_ - certain settings that trigger cautions or warnings. - - -### HOW DO I USE PHPSECINFO? - -The simplest way: - -* Uncompress and upload the contents of the archive to your web server's - document root -* Open a browser and view the index.php file where you've uploaded the files - (probably something like http://www.yourdomain.com/phpsecinfo/index.php) - - -### WHAT DO I DO IF I GET A NOTICE OR WARNING? - -Read the explanation of the result carefully. Research the issue on-line --- resources like the php.net official docs and the PHP Security Guide are -very useful. Investigate why your environment is set up in such a way. If -there's not a compelling reason to keep it as-is, you should probably - -A by no means comprehensive list of resources to get your started: - -Web Sites: -http://www.php.net/manual/en/security.php -http://phpsec.org/projects/guide/ - -Books: -http://phparch.com/pgps -http://phpsecurity.org/ -http://apachesecurity.net/ - - -### HOW CAN I CUSTOMIZE THE OUTPUT OF PHPSECINFO? - -PHPSecInfo is intended to be used as a self-contained tool. However, you -can obtain the test results in an array and then present this data in your -preferred format. - -Example: -<code> -require_once('PhpSecInfo/PhpSecInfo.php'); -// instantiate the class -$psi = new PhpSecInfo(); - -// load and run all tests -$psi->loadAndRun(); - -// grab the results as a multidimensional array -$results = $psi->getResultsAsArray(); -echo "<pre>"; echo print_r($results, true); echo "</pre>"; - -// grab the standard results output as a string -$html = $psi->getOutput(); - -// send it to the browser -echo $html; -</code> - - -### HOW CAN I OFFER FEEDBACK, REPORT BUGS, COMPLAIN, ETC.? - -The best way is to subscribe to and post on the PHPSecInfo Mailing List: - -http://lists.phpsec.org/mailman/listinfo/phpsecinfo diff --git a/plugins/SecurityInfo/SecurityInfo.php b/plugins/SecurityInfo/SecurityInfo.php deleted file mode 100644 index 849b3992af..0000000000 --- a/plugins/SecurityInfo/SecurityInfo.php +++ /dev/null @@ -1,44 +0,0 @@ -<?php -/** - * Piwik - Open source web analytics - * - * @link http://piwik.org - * @license http://www.gnu.org/licenses/gpl-3.0.html Gpl v3 or later - * @version $Id$ - * - * @category Piwik_Plugins - * @package Piwik_SecurityInfo - */ - -/** - * - * @package Piwik_SecurityInfo - */ -class Piwik_SecurityInfo extends Piwik_Plugin -{ - public function getInformation() - { - $info = array( - 'description' => Piwik_Translate('SecurityInfo_PluginDescription'), - 'author' => 'Piwik', - 'author_homepage' => 'http://piwik.org/', - 'version' => Piwik_Version::VERSION, - ); - return $info; - } - - function getListHooksRegistered() - { - return array( - 'AdminMenu.add' => 'addMenu', - ); - } - - function addMenu() - { - Piwik_AddAdminMenu('SecurityInfo_Security', - array('module' => 'SecurityInfo', 'action' => 'index'), - Piwik::isUserIsSuperUser(), - $order = 10); - } -} diff --git a/plugins/SecurityInfo/templates/index.tpl b/plugins/SecurityInfo/templates/index.tpl deleted file mode 100644 index 0f053c1014..0000000000 --- a/plugins/SecurityInfo/templates/index.tpl +++ /dev/null @@ -1,31 +0,0 @@ -{assign var=showSitesSelection value=false} -{assign var=showPeriodSelection value=false} -{include file="CoreAdminHome/templates/header.tpl"} -{loadJavascriptTranslations plugins='SecurityInfo'} - -<h2>{'SecurityInfo_SecurityInformation'|translate}</h2> -<p>{'SecurityInfo_PluginDescription'|translate}</p> - -<div style="max-width:980px;"> -{foreach from=$results.test_results key=i item=section} -<h2>{$i}</h2> -<table class="adminTable"> - <thead> - <tr> - <th>{'SecurityInfo_Test'|translate}</th> - <th>{'SecurityInfo_Result'|translate}</th> - </tr> - </thead> - <tbody> - {foreach from=$section key=j item=test} - <tr> - <td>{$j}</td> - <td style="{if $test.result==-1}background-color:green;color:white;{elseif $test.result==-2}background-color:yellow;color:black;{else if $test.result=--4}background-color:red;color:white;{/if}">{$test.message}</td> - </tr> - {/foreach} - </tbody> -</table> -{/foreach} -</div> - -{include file="CoreAdminHome/templates/footer.tpl"} diff --git a/plugins/SitesManager/API.php b/plugins/SitesManager/API.php index e00c159a8b..81c660875f 100644 --- a/plugins/SitesManager/API.php +++ b/plugins/SitesManager/API.php @@ -17,10 +17,6 @@ class Piwik_SitesManager_API { static private $instance = null; - - /** - * @return Piwik_SitesManager_API - */ static public function getInstance() { if (self::$instance == null) @@ -31,11 +27,6 @@ class Piwik_SitesManager_API return self::$instance; } - const OPTION_EXCLUDED_IPS_GLOBAL = 'SitesManager_ExcludedIpsGlobal'; - const OPTION_DEFAULT_TIMEZONE = 'SitesManager_DefaultTimezone'; - const OPTION_DEFAULT_CURRENCY = 'SitesManager_DefaultCurrency'; - const OPTION_EXCLUDED_QUERY_PARAMETERS_GLOBAL = 'SitesManager_ExcludedQueryParameters'; - /** * Returns the javascript tag for the given idSite. * This tag must be included on every page to be tracked by Piwik @@ -43,7 +34,7 @@ class Piwik_SitesManager_API * @param int $idSite * @return string The Javascript tag ready to be included on the HTML pages */ - public function getJavascriptTag( $idSite, $piwikUrl = '', $actionName = '') + static public function getJavascriptTag( $idSite, $piwikUrl = '', $actionName = '') { Piwik::checkUserHasViewAccess($idSite); @@ -65,10 +56,10 @@ class Piwik_SitesManager_API * @exception if the site ID doesn't exist or the user doesn't have access to it * @return array */ - public function getSiteFromId( $idSite ) + static public function getSiteFromId( $idSite ) { Piwik::checkUserHasViewAccess( $idSite ); - $site = Zend_Registry::get('db')->fetchRow("SELECT * FROM ".Piwik_Common::prefixTable("site")." WHERE idsite = ?", $idSite); + $site = Zend_Registry::get('db')->fetchRow("SELECT * FROM ".Piwik::prefixTable("site")." WHERE idsite = ?", $idSite); return $site; } @@ -78,11 +69,11 @@ class Piwik_SitesManager_API * * @return array list of alias URLs */ - private function getAliasSiteUrlsFromId( $idsite ) + static private function getAliasSiteUrlsFromId( $idsite ) { $db = Zend_Registry::get('db'); $result = $db->fetchAll("SELECT url - FROM ".Piwik_Common::prefixTable("site_url"). " + FROM ".Piwik::prefixTable("site_url"). " WHERE idsite = ?", $idsite); $urls = array(); foreach($result as $url) @@ -98,11 +89,11 @@ class Piwik_SitesManager_API * @exception if the website ID doesn't exist or the user doesn't have access to it * @return array list of URLs */ - public function getSiteUrlsFromId( $idSite ) + static public function getSiteUrlsFromId( $idSite ) { Piwik::checkUserHasViewAccess($idSite); - $site = $this->getSiteFromId($idSite); - $urls = $this->getAliasSiteUrlsFromId($idSite); + $site = self::getSiteFromId($idSite); + $urls = self::getAliasSiteUrlsFromId($idSite); return array_merge(array($site['main_url']), $urls); } @@ -111,10 +102,10 @@ class Piwik_SitesManager_API * * @return array the list of websites ID */ - public function getAllSitesId() + static public function getAllSitesId() { Piwik::checkUserIsSuperUser(); - $result = Piwik_FetchAll("SELECT idsite FROM ".Piwik_Common::prefixTable('site')); + $result = Piwik_FetchAll("SELECT idsite FROM ".Piwik::prefixTable('site')); $idSites = array(); foreach($result as $idSite) { @@ -130,10 +121,10 @@ class Piwik_SitesManager_API * * @return array for each site, an array of information (idsite, name, main_url, etc.) */ - public function getSitesWithAdminAccess() + static public function getSitesWithAdminAccess() { - $sitesId = $this->getSitesIdWithAdminAccess(); - return $this->getSitesFromIds($sitesId); + $sitesId = self::getSitesIdWithAdminAccess(); + return self::getSitesFromIds($sitesId); } /** @@ -142,10 +133,10 @@ class Piwik_SitesManager_API * * @return array for each site, an array of information (idsite, name, main_url, etc.) */ - public function getSitesWithViewAccess() + static public function getSitesWithViewAccess() { - $sitesId = $this->getSitesIdWithViewAccess(); - return $this->getSitesFromIds($sitesId); + $sitesId = self::getSitesIdWithViewAccess(); + return self::getSitesFromIds($sitesId); } /** @@ -154,10 +145,10 @@ class Piwik_SitesManager_API * * @return array array for each site, an array of information (idsite, name, main_url, etc.) */ - public function getSitesWithAtLeastViewAccess() + static public function getSitesWithAtLeastViewAccess() { - $sitesId = $this->getSitesIdWithAtLeastViewAccess(); - return $this->getSitesFromIds($sitesId); + $sitesId = self::getSitesIdWithAtLeastViewAccess(); + return self::getSitesFromIds($sitesId); } /** @@ -166,7 +157,7 @@ class Piwik_SitesManager_API * * @return array list of websites ID */ - public function getSitesIdWithAdminAccess() + static public function getSitesIdWithAdminAccess() { $sitesId = Zend_Registry::get('access')->getSitesIdWithAdminAccess(); return $sitesId; @@ -178,7 +169,7 @@ class Piwik_SitesManager_API * * @return array list of websites ID */ - public function getSitesIdWithViewAccess() + static public function getSitesIdWithViewAccess() { return Zend_Registry::get('access')->getSitesIdWithViewAccess(); } @@ -189,7 +180,7 @@ class Piwik_SitesManager_API * * @return array list of websites ID */ - public function getSitesIdWithAtLeastViewAccess() + static public function getSitesIdWithAtLeastViewAccess() { return Zend_Registry::get('access')->getSitesIdWithAtLeastViewAccess(); } @@ -200,7 +191,7 @@ class Piwik_SitesManager_API * * @param array list of website ID */ - private function getSitesFromIds( $idSites ) + static private function getSitesFromIds( $idSites ) { if(count($idSites) === 0) { @@ -208,105 +199,57 @@ class Piwik_SitesManager_API } $db = Zend_Registry::get('db'); $sites = $db->fetchAll("SELECT * - FROM ".Piwik_Common::prefixTable("site")." + FROM ".Piwik::prefixTable("site")." WHERE idsite IN (".implode(", ", $idSites).") ORDER BY idsite ASC"); return $sites; } - - /** - * Returns the list of websites ID associated with a URL. - * - * @param string $url - * @return array list of websites ID - */ - public function getSitesIdFromSiteUrl( $url ) - { - $url = $this->removeTrailingSlash($url); - - if(Piwik::isUserIsSuperUser()) - { - $ids = Zend_Registry::get('db')->fetchAll( - 'SELECT idsite FROM ' . Piwik_Common::prefixTable('site') . ' WHERE main_url = ? ' . - 'UNION SELECT idsite FROM ' . Piwik_Common::prefixTable('site_url') . ' WHERE url = ?', array($url, $url)); - } - else - { - $login = Piwik::getCurrentUserLogin(); - $ids = Zend_Registry::get('db')->fetchAll( - 'SELECT idsite FROM ' . Piwik_Common::prefixTable('site') . ' WHERE main_url = ? ' . - 'AND idsite IN (' . Piwik_Access::getSqlAccessSite('idsite') . ') ' . - 'UNION SELECT idsite FROM ' . Piwik_Common::prefixTable('site_url') . ' WHERE url = ? ' . - 'AND idsite IN (' . Piwik_Access::getSqlAccessSite('idsite') . ')', array($url, $login, $url, $login)); - } - - return $ids; - } - + /** - * Add a website. - * Requires Super User access. + * Add a website in the database. * * The website is defined by a name and an array of URLs. - * @param string Site name - * @param array|string The URLs array must contain at least one URL called the 'main_url' ; - * if several URLs are provided in the array, they will be recorded - * as Alias URLs for this website. - * @param string Comma separated list of IPs to exclude from the reports (allows wildcards) - * @param string Timezone string, eg. 'Europe/London' + * The name must not be empty. + * The URLs array must contain at least one URL called the 'main_url' ; + * if several URLs are provided in the array, they will be recorded as Alias URLs for + * this website. + * + * Requires Super User access. * * @return int the website ID created */ - public function addSite( $siteName, $urls, $excludedIps = null, $excludedQueryParameters = null, $timezone = null, $currency = null ) + static public function addSite( $siteName, $urls ) { Piwik::checkUserIsSuperUser(); - $this->checkName($siteName); - $urls = $this->cleanParameterUrls($urls); - $this->checkUrls($urls); - $this->checkAtLeastOneUrl($urls); - $timezone = trim($timezone); - - if(empty($timezone)) - { - $timezone = $this->getDefaultTimezone(); - } - $this->checkValidTimezone($timezone); - - if(empty($currency)) - { - $currency = $this->getDefaultCurrency(); - } - $this->checkValidCurrency($currency); + self::checkName($siteName); + $urls = self::cleanParameterUrls($urls); + self::checkUrls($urls); + self::checkAtLeastOneUrl($urls); $db = Zend_Registry::get('db'); $url = $urls[0]; $urls = array_slice($urls, 1); - $bind = array( 'name' => $siteName, - 'main_url' => $url, - 'ts_created' => Piwik_Date::now()->getDatetime() - ); - - $bind['excluded_ips'] = $this->checkAndReturnExcludedIps($excludedIps); - $bind['excluded_parameters'] = $this->checkAndReturnExcludedQueryParameters($excludedQueryParameters); - $bind['timezone'] = $timezone; - $bind['currency'] = $currency; - $db->insert(Piwik_Common::prefixTable("site"), $bind); + $db->insert(Piwik::prefixTable("site"), array( + 'name' => $siteName, + 'main_url' => $url, + ) + ); $idSite = $db->lastInsertId(); - $this->insertSiteUrls($idSite, $urls); + self::insertSiteUrls($idSite, $urls); // we reload the access list which doesn't yet take in consideration this new website Zend_Registry::get('access')->reloadAccess(); - $this->postUpdateWebsite($idSite); + self::postUpdateWebsite($idSite); return (int)$idSite; } - private function postUpdateWebsite($idSite) + private static function postUpdateWebsite($idSite) { Piwik_Common::regenerateCacheWebsiteAttributes($idSite); } @@ -318,11 +261,11 @@ class Piwik_SitesManager_API * * @param int $idSite */ - public function deleteSite( $idSite ) + static public function deleteSite( $idSite ) { Piwik::checkUserIsSuperUser(); - $idSites = Piwik_SitesManager_API::getInstance()->getAllSitesId(); + $idSites = Piwik_SitesManager_API::getAllSitesId(); if(!in_array($idSite, $idSites)) { throw new Exception("website id = $idSite not found"); @@ -335,13 +278,13 @@ class Piwik_SitesManager_API $db = Zend_Registry::get('db'); - $db->query("DELETE FROM ".Piwik_Common::prefixTable("site")." + $db->query("DELETE FROM ".Piwik::prefixTable("site")." WHERE idsite = ?", $idSite); - $db->query("DELETE FROM ".Piwik_Common::prefixTable("site_url")." + $db->query("DELETE FROM ".Piwik::prefixTable("site_url")." WHERE idsite = ?", $idSite); - $db->query("DELETE FROM ".Piwik_Common::prefixTable("access")." + $db->query("DELETE FROM ".Piwik::prefixTable("access")." WHERE idsite = ?", $idSite); Piwik_Common::deleteCacheWebsiteAttributes($idSite); @@ -353,7 +296,7 @@ class Piwik_SitesManager_API * * @exception if the parameter is not an array or if array empty */ - private function checkAtLeastOneUrl( $urls ) + static private function checkAtLeastOneUrl( $urls ) { if(!is_array($urls) || count($urls) == 0) @@ -362,52 +305,6 @@ class Piwik_SitesManager_API } } - private function checkValidTimezone($timezone) - { - $timezones = $this->getTimezonesList(); - foreach($timezones as $continent => $cities) - { - foreach($cities as $timezoneId => $city) - { - if($timezoneId == $timezone) - { - return true; - } - } - } - throw new Exception(Piwik_TranslateException('SitesManager_ExceptionInvalidTimezone', array($timezone))); - } - - private function checkValidCurrency($currency) - { - if(!in_array($currency, array_keys($this->getCurrencyList()))) - { - throw new Exception(Piwik_TranslateException('SitesManager_ExceptionInvalidCurrency', array($currency, "USD, EUR, etc."))); - } - } - - /** - * Checks that the submitted IPs (comma separated list) are valid - * Returns the cleaned up IPs - * @param $excludedIps - * - * @return array of IPs - */ - private function checkAndReturnExcludedIps($excludedIps) - { - $ips = explode(',', $excludedIps); - $ips = array_map('trim', $ips); - $ips = array_filter($ips, 'strlen'); - foreach($ips as $ip) - { - if(!$this->isValidIp($ip)) - { - throw new Exception(Piwik_TranslateException('SitesManager_ExceptionInvalidIPFormat', array($ip, "1.2.3.4 or 1.2.3.*"))); - } - } - $ips = implode(',', $ips); - return $ips; - } /** * Add a list of alias Urls to the given idSite * @@ -416,136 +313,22 @@ class Piwik_SitesManager_API * * @return int the number of inserted URLs */ - public function addSiteAliasUrls( $idSite, $urls) + static public function addSiteAliasUrls( $idSite, $urls) { Piwik::checkUserHasAdminAccess( $idSite ); - $urls = $this->cleanParameterUrls($urls); - $this->checkUrls($urls); + $urls = self::cleanParameterUrls($urls); + self::checkUrls($urls); - $urlsInit = $this->getSiteUrlsFromId($idSite); + $urlsInit = self::getSiteUrlsFromId($idSite); $toInsert = array_diff($urls, $urlsInit); - $this->insertSiteUrls($idSite, $toInsert); - $this->postUpdateWebsite($idSite); + self::insertSiteUrls($idSite, $toInsert); + self::postUpdateWebsite($idSite); return count($toInsert); } /** - * Sets IPs to be excluded from all websites. IPs can contain wildcards. - * Will also apply to websites created in the future. - * - * @param string Comma separated list of IPs to exclude from being tracked (allows wildcards) - * @return bool - */ - public function setGlobalExcludedIps($excludedIps) - { - Piwik::checkUserIsSuperUser(); - $excludedIps = $this->checkAndReturnExcludedIps($excludedIps); - Piwik_SetOption(self::OPTION_EXCLUDED_IPS_GLOBAL, $excludedIps); - Piwik_Common::deleteAllCache(); - return true; - } - - /** - * Returns the list of URL query parameters that are excluded from all websites - * - * @return string Comma separated list of URL parameters - */ - public function getExcludedQueryParametersGlobal() - { - Piwik::checkUserHasSomeAdminAccess(); - return Piwik_GetOption(self::OPTION_EXCLUDED_QUERY_PARAMETERS_GLOBAL); - } - - /** - * Sets list of URL query parameters to be excluded on all websites. - * Will also apply to websites created in the future. - * - * @param string Comma separated list of URL query parameters to exclude from URLs - * @return bool - */ - public function setGlobalExcludedQueryParameters($excludedQueryParameters) - { - Piwik::checkUserIsSuperUser(); - $excludedQueryParameters = $this->checkAndReturnExcludedQueryParameters($excludedQueryParameters); - Piwik_SetOption(self::OPTION_EXCLUDED_QUERY_PARAMETERS_GLOBAL, $excludedQueryParameters); - Piwik_Common::deleteAllCache(); - return true; - } - - /** - * Returns the list of IPs that are excluded from all websites - * - * @return string Comma separated list of IPs - */ - public function getExcludedIpsGlobal() - { - Piwik::checkUserHasSomeAdminAccess(); - return Piwik_GetOption(self::OPTION_EXCLUDED_IPS_GLOBAL); - } - - /** - * Returns the default currency that will be set when creating a website through the API. - * - * @return string Currency ID eg. 'USD' - */ - public function getDefaultCurrency() - { - Piwik::checkUserHasSomeAdminAccess(); - $defaultCurrency = Piwik_GetOption(self::OPTION_DEFAULT_CURRENCY); - if($defaultCurrency) - { - return $defaultCurrency; - } - return 'USD'; - } - - /** - * Sets the default currency that will be used when creating websites - * - * @param $defaultCurrency string eg. 'USD' - * @return bool - */ - public function setDefaultCurrency($defaultCurrency) - { - Piwik::checkUserIsSuperUser(); - $this->checkValidCurrency($defaultCurrency); - Piwik_SetOption(self::OPTION_DEFAULT_CURRENCY, $defaultCurrency); - return true; - } - - /** - * Returns the default timezone that will be set when creating a website through the API. - * Via the UI, if the default timezone is not UTC, it will be pre-selected in the drop down - * - * @return string Timezone eg. UTC+7 or Europe/Paris - */ - public function getDefaultTimezone() - { - $defaultTimezone = Piwik_GetOption(self::OPTION_DEFAULT_TIMEZONE); - if($defaultTimezone) - { - return $defaultTimezone; - } - return 'UTC'; - } - - /** - * Sets the default timezone that will be used when creating websites - * - * @param $defaultTimezone string eg. Europe/Paris or UTC+8 - * @return bool - */ - public function setDefaultTimezone($defaultTimezone) - { - Piwik::checkUserIsSuperUser(); - $this->checkValidTimezone($defaultTimezone); - Piwik_SetOption(self::OPTION_DEFAULT_TIMEZONE, $defaultTimezone); - return true; - } - - /** * Update an existing website. * If only one URL is specified then only the main url will be updated. * If several URLs are specified, both the main URL and the alias URLs will be updated. @@ -553,234 +336,59 @@ class Piwik_SitesManager_API * @param int website ID defining the website to edit * @param string website name * @param string|array the website URLs - * @param string Comma separated list of IPs to exclude from being tracked (allows wildcards) - * @param string Timezone * * @exception if any of the parameter is not correct * * @return bool true on success */ - public function updateSite( $idSite, $siteName, $urls = null, $excludedIps = null, $excludedQueryParameters = null, $timezone = null, $currency = null) + static public function updateSite( $idSite, $siteName, $urls = null) { Piwik::checkUserHasAdminAccess($idSite); - $this->checkName($siteName); + self::checkName($siteName); // SQL fields to update $bind = array(); if(!is_null($urls)) { - $urls = $this->cleanParameterUrls($urls); - $this->checkUrls($urls); - $this->checkAtLeastOneUrl($urls); + $urls = self::cleanParameterUrls($urls); + self::checkUrls($urls); + self::checkAtLeastOneUrl($urls); $url = $urls[0]; $bind['main_url'] = $url; } - - if(!is_null($currency)) - { - $currency = trim($currency); - $this->checkValidCurrency($currency); - $bind['currency'] = $currency; - } - if(!is_null($timezone)) - { - $timezone = trim($timezone); - $this->checkValidTimezone($timezone); - $bind['timezone'] = $timezone; - } - $bind['excluded_ips'] = $this->checkAndReturnExcludedIps($excludedIps); - $bind['excluded_parameters'] = $this->checkAndReturnExcludedQueryParameters($excludedQueryParameters); $bind['name'] = $siteName; + $db = Zend_Registry::get('db'); - $db->update(Piwik_Common::prefixTable("site"), + $db->update(Piwik::prefixTable("site"), $bind, "idsite = $idSite" ); // we now update the main + alias URLs - $this->deleteSiteAliasUrls($idSite); + self::deleteSiteAliasUrls($idSite); if(count($urls) > 1) { - $insertedUrls = $this->addSiteAliasUrls($idSite, array_slice($urls,1)); - } - $this->postUpdateWebsite($idSite); - } - - private function checkAndReturnExcludedQueryParameters($parameters) - { - $parameters = trim($parameters); - if(empty($parameters)) - { - return ''; + $insertedUrls = self::addSiteAliasUrls($idSite, array_slice($urls,1)); } - - $parameters = explode(',', $parameters); - $parameters = array_map('trim', $parameters); - $parameters = array_filter($parameters, 'strlen'); - $parameters = array_unique($parameters); - return implode(',', $parameters); - } - - /** - * Returns the list of supported currencies - * @see getCurrencySymbols() - * @return array ( currencyId => currencyName) - */ - public function getCurrencyList() - { - return array( - 'USD' => 'US Dollar ($)', - 'EUR' => 'Euro (€)', - 'JPY' => 'Japanese Yen (Â¥)', - 'GBP' => 'British Pound Sterling (£)', - 'AUD' => 'Australian Dollar (A$)', - 'KRW' => 'South Korean Won (â‚©)', - 'BRL' => 'Brazilian Real (R$)', - 'CNY' => 'Chinese Yuan Renminbi (CNÂ¥)', - 'DKK' => 'Danish Krone (Dkr)', - 'RUB' => 'Russian Ruble (RUB)', - 'SEK' => 'Swedish Krona (Skr)', - 'NOK' => 'Norwegian Krone (Nkr)', - 'PLN' => 'Polish Zloty (zÅ‚)', - 'TRY' => 'Turkish Lira (TL)', - 'TWD' => 'New Taiwan Dollar (NT$)', - 'HKD' => 'Hong Kong Dollar (HK$)', - 'THB' => 'Thai Baht (฿)', - 'IDR' => 'Indonesian Rupiah (Rp)', - 'ARS' => 'Argentine Peso (AR$)', - 'MXN' => 'Mexican Peso (MXN)', - 'VND' => 'Vietnamese Dong (â‚«)', - 'PHP' => 'Philippine Peso (Php)', - 'INR' => 'Indian Rupee (Rs.)', - 'VEF' => 'Venezuelan bolÃvar (Bs. F)', - 'CHF' => 'Swiss Franc (Fr.)', - ); - } - - /** - * Returns the list of currency symbols - * @see getCurrencyList() - * @return array( currencyId => currencySymbol ) - */ - public function getCurrencySymbols() - { - return array( - 'USD' => '$', - 'EUR' => '€', - 'JPY' => 'Â¥', - 'GBP' => '£', - 'AUD' => 'A$', - 'KRW' => 'â‚©', - 'BRL' => 'R$', - 'CNY' => 'CNÂ¥', - 'DKK' => 'Dkr', - 'RUB' => 'RUB', - 'SEK' => 'Skr', - 'NOK' => 'Nkr', - 'PLN' => 'zÅ‚', - 'TRY' => 'TL', - 'TWD' => 'NT$', - 'HKD' => 'HK$', - 'THB' => '฿', - 'IDR' => 'Rp', - 'ARS' => 'AR$', - 'MXN' => 'MXN', - 'VND' => 'â‚«', - 'PHP' => 'Php', - 'INR' => 'Rs.', - 'VEF' => 'Bs. F', - 'CHF' => 'Fr.', - ); - } - - - /** - * Returns the list of timezones supported. - * Used for addSite and updateSite - * - * @TODO NOT COMPATIBLE WITH API RESPONSE AUTO BUILDER - * - * @return array of timezone strings - */ - public function getTimezonesList() - { - if(!Piwik::isTimezoneSupportEnabled()) - { - return array('UTC' => $this->getTimezonesListUTCOffsets()); - } - - $continents = array( 'Africa', 'America', 'Antarctica', 'Arctic', 'Asia', 'Atlantic', 'Australia', 'Europe', 'Indian', 'Pacific'); - $timezones = timezone_identifiers_list(); - - $return = array(); - foreach($timezones as $timezone) - { - $timezoneExploded = explode('/', $timezone); - $continent = $timezoneExploded[0]; - - // only display timezones that are grouped by continent - if(!in_array($continent, $continents)) - { - continue; - } - $city = $timezoneExploded[1]; - if(!empty($timezoneExploded[2])) - { - $city .= ' - '.$timezoneExploded[2]; - } - $city = str_replace('_', ' ', $city); - $return[$continent][$timezone] = $city; - } - - foreach($continents as $continent) - { - ksort($return[$continent]); - } - - $return['UTC'] = $this->getTimezonesListUTCOffsets(); - return $return; - } - - private function getTimezonesListUTCOffsets() - { - // manually add the UTC offsets - $GmtOffsets = array (-12, -11.5, -11, -10.5, -10, -9.5, -9, -8.5, -8, -7.5, -7, -6.5, -6, -5.5, -5, -4.5, -4, -3.5, -3, -2.5, -2, -1.5, -1, -0.5, - 0, 0.5, 1, 1.5, 2, 2.5, 3, 3.5, 4, 4.5, 5, 5.5, 5.75, 6, 6.5, 7, 7.5, 8, 8.5, 8.75, 9, 9.5, 10, 10.5, 11, 11.5, 12, 12.75, 13, 13.75, 14); - - $return = array(); - foreach($GmtOffsets as $offset) - { - if($offset > 0) - { - $offset = '+'.$offset; - } - elseif($offset == 0) - { - $offset = ''; - } - $offset = 'UTC' . $offset; - $offsetName = str_replace(array('.25','.5','.75'), array(':15',':30',':45'), $offset); - $return[$offset] = $offsetName; - } - return $return; + self::postUpdateWebsite($idSite); } /** * Insert the list of alias URLs for the website. * The URLs must not exist already for this website! */ - private function insertSiteUrls($idSite, $urls) + static private function insertSiteUrls($idSite, $urls) { if(count($urls) != 0) { $db = Zend_Registry::get('db'); foreach($urls as $url) { - $db->insert(Piwik_Common::prefixTable("site_url"), array( + $db->insert(Piwik::prefixTable("site_url"), array( 'idsite' => $idSite, 'url' => $url ) @@ -792,10 +400,10 @@ class Piwik_SitesManager_API /** * Delete all the alias URLs for the given idSite. */ - private function deleteSiteAliasUrls($idsite) + static private function deleteSiteAliasUrls($idsite) { $db = Zend_Registry::get('db'); - $db->query("DELETE FROM ".Piwik_Common::prefixTable("site_url") ." + $db->query("DELETE FROM ".Piwik::prefixTable("site_url") ." WHERE idsite = ?", $idsite); } @@ -804,7 +412,7 @@ class Piwik_SitesManager_API * * @return string the URL without the trailing slash */ - private function removeTrailingSlash($url) + static private function removeTrailingSlash($url) { // if there is a final slash, we take the URL without this slash (expected URL format) if(strlen($url) > 5 @@ -820,33 +428,17 @@ class Piwik_SitesManager_API * * @return bool */ - private function isValidUrl( $url ) + static private function isValidUrl( $url ) { return Piwik_Common::isLookLikeUrl($url); } /** - * Tests if the IP is a valid IP, allowing wildcards, except in the first octet. - * Wildcards can only be used from right to left, ie. 1.1.*.* is allowed, but 1.1.*.1 is not. - * - * @param $ip - * @return bool - */ - private function isValidIp( $ip ) - { - return preg_match('~^(\d+)\.(\d+)\.(\d+)\.(\d+)$~', $ip, $matches) !== 0 - || preg_match('~^(\d+)\.(\d+)\.(\d+)\.\*$~', $ip, $matches) !== 0 - || preg_match('~^(\d+)\.(\d+)\.\*.\*$~', $ip, $matches) !== 0 - || preg_match('~^(\d+)\.\*\.\*\.\*$~', $ip, $matches) !== 0 - ; - } - - /** * Check that the website name has a correct format. * * @exception if the website name is empty */ - private function checkName($siteName) + static private function checkName($siteName) { if(empty($siteName)) { @@ -860,11 +452,11 @@ class Piwik_SitesManager_API * @exception if any of the urls is not valid * @param array */ - private function checkUrls($urls) + static private function checkUrls($urls) { foreach($urls as $url) { - if(!$this->isValidUrl($url)) + if(!self::isValidUrl($url)) { throw new Exception(sprintf(Piwik_TranslateException("SitesManager_ExceptionInvalidUrl"),$url)); } @@ -879,20 +471,19 @@ class Piwik_SitesManager_API * @param string|array urls * @return array the array of cleaned URLs */ - private function cleanParameterUrls( $urls ) + static private function cleanParameterUrls( $urls ) { if(!is_array($urls)) { $urls = array($urls); } - - $urls = array_map('urldecode', $urls); foreach($urls as &$url) { - $url = $this->removeTrailingSlash($url); + $url = self::removeTrailingSlash($url); } $urls = array_unique($urls); return $urls; } } + diff --git a/plugins/SitesManager/Controller.php b/plugins/SitesManager/Controller.php index 84dc3d5a03..ddf93d109b 100644 --- a/plugins/SitesManager/Controller.php +++ b/plugins/SitesManager/Controller.php @@ -19,56 +19,17 @@ class Piwik_SitesManager_Controller extends Piwik_Controller function index() { $view = Piwik_View::factory('SitesManager'); - $sites = Piwik_SitesManager_API::getInstance()->getSitesWithAdminAccess(); + $sites = Piwik_SitesManager_API::getSitesWithAdminAccess(); foreach($sites as &$site) { - $site['alias_urls'] = Piwik_SitesManager_API::getInstance()->getSiteUrlsFromId($site['idsite']); - $site['excluded_ips'] = str_replace(',','<br/>', $site['excluded_ips']); - $site['excluded_parameters'] = str_replace(',','<br/>', $site['excluded_parameters']); + $site['alias_urls'] = Piwik_SitesManager_API::getSiteUrlsFromId($site['idsite']); } $view->adminSites = $sites; - - $timezones = Piwik_SitesManager_API::getInstance()->getTimezonesList(); - $view->timezoneSupported = Piwik::isTimezoneSupportEnabled(); - $view->timezones = json_encode($timezones); - $view->defaultTimezone = Piwik_SitesManager_API::getInstance()->getDefaultTimezone(); - - $view->currencies = json_encode(Piwik_SitesManager_API::getInstance()->getCurrencyList()); - $view->defaultCurrency = Piwik_SitesManager_API::getInstance()->getDefaultCurrency(); - - $view->utcTime = Piwik_Date::now()->getDatetime(); - $excludedIpsGlobal = Piwik_SitesManager_API::getInstance()->getExcludedIpsGlobal(); - $view->globalExcludedIps = str_replace(',',"\n", $excludedIpsGlobal); - $excludedQueryParametersGlobal = Piwik_SitesManager_API::getInstance()->getExcludedQueryParametersGlobal(); - $view->globalExcludedQueryParameters = str_replace(',',"\n", $excludedQueryParametersGlobal); - $view->currentIpAddress = Piwik_Common::getIpString(); - $this->setGeneralVariablesView($view); $view->menu = Piwik_GetAdminMenu(); echo $view->render(); } - function setGlobalSettings() - { - $response = new Piwik_API_ResponseBuilder(Piwik_Common::getRequestVar('format')); - - try { - $this->checkTokenInUrl(); - $timezone = Piwik_Common::getRequestVar('timezone', false); - $excludedIps = Piwik_Common::getRequestVar('excludedIps', false); - $excludedQueryParameters = Piwik_Common::getRequestVar('excludedQueryParameters', false); - $currency = Piwik_Common::getRequestVar('currency', false); - Piwik_SitesManager_API::getInstance()->setDefaultTimezone($timezone); - Piwik_SitesManager_API::getInstance()->setDefaultCurrency($currency); - Piwik_SitesManager_API::getInstance()->setGlobalExcludedQueryParameters($excludedQueryParameters); - Piwik_SitesManager_API::getInstance()->setGlobalExcludedIps($excludedIps); - $toReturn = $response->getResponse(); - } catch(Exception $e ) { - $toReturn = $response->getResponseException( $e ); - } - echo $toReturn; - } - function displayJavascriptCode() { $idSite = Piwik_Common::getRequestVar('idsite', 1); @@ -77,8 +38,6 @@ class Piwik_SitesManager_Controller extends Piwik_Controller $view = Piwik_View::factory('DisplayJavascriptCode'); $this->setGeneralVariablesView($view); $view->menu = Piwik_GetAdminMenu(); - $site = new Piwik_Site($idSite); - $view->displaySiteName = $site->getName(); $view->jsTag = $jsTag; echo $view->render(); } diff --git a/plugins/SitesManager/SitesManager.php b/plugins/SitesManager/SitesManager.php index dfca3e2c6f..b2542e966c 100644 --- a/plugins/SitesManager/SitesManager.php +++ b/plugins/SitesManager/SitesManager.php @@ -19,10 +19,11 @@ class Piwik_SitesManager extends Piwik_Plugin public function getInformation() { $info = array( - 'description' => Piwik_Translate('SitesManager_PluginDescription'), + 'name' => 'Sites Management', + 'description' => 'Websites Management in Piwik: Add a new Website, Edit an existing one, Show the Javascript code to include on your pages. All the actions are also available through the API.', 'author' => 'Piwik', - 'author_homepage' => 'http://piwik.org/', - 'version' => Piwik_Version::VERSION, + 'homepage' => 'http://piwik.org/', + 'version' => '0.1', ); return $info; } @@ -32,105 +33,21 @@ class Piwik_SitesManager extends Piwik_Plugin return array( 'template_css_import' => 'css', 'AdminMenu.add' => 'addMenu', - 'Common.fetchWebsiteAttributes' => 'recordWebsiteDataInCache', + 'Common.fetchWebsiteAttributes' => 'recordWebsiteHostsInCache', ); } - function addMenu() - { - Piwik_AddAdminMenu('SitesManager_MenuSites', - array('module' => 'SitesManager', 'action' => 'index'), - Piwik::isUserHasSomeAdminAccess(), - $order = 5); - } - function css() { echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"themes/default/styles.css\" />\n"; } - /** - * Hooks when a website tracker cache is flushed (website updated, cache deleted, or empty cache) - * Will record in the tracker config file all data needed for this website in Tracker. - * - * @param $notification - * @return void - */ - function recordWebsiteDataInCache($notification) + function recordWebsiteHostsInCache($notification) { - $idSite = $notification->getNotificationInfo(); + $idsite = $notification->getNotificationInfo(); // add the 'hosts' entry in the website array $array =& $notification->getNotificationObject(); - $array['hosts'] = $this->getTrackerHosts($idSite); - $array['excluded_ips'] = $this->getTrackerExcludedIps($idSite); - $array['excluded_parameters'] = $this->getTrackerExcludedQueryParameters($idSite); - } - - /** - * Returns the array of excluded IPs to save in the config file - * @param $idSite - * @return array - */ - private function getTrackerExcludedIps($idSite) - { - $website = Piwik_SitesManager_API::getInstance()->getSiteFromId($idSite); - $excludedIps = $website['excluded_ips']; - $globalExcludedIps = Piwik_SitesManager_API::getInstance()->getExcludedIpsGlobal(); - - $excludedIps .= ',' . $globalExcludedIps; - - $ipRanges = array(); - foreach(explode(',', $excludedIps) as $ip) - { - $ipMin = $ipMax = $ip; - if(substr_count($ip, '*') > 0) - { - $ipMin = str_replace('*', '0', $ip); - $ipMax = str_replace('*', '255', $ip); - } - $ipRange = array( ip2long($ipMin), ip2long($ipMax)); - - // we can still get invalid IPs at this stage (eg. ip2long(555.1.1.1) would return false) - if($ipRange[0] === false || $ipRange[1] === false) - { - continue; - } - - // long data type is signed; convert to stringified unsigned number - $ipRange[0] = sprintf("%u", $ipRange[0]); - $ipRange[1] = sprintf("%u", $ipRange[1]); - - $ipRanges[] = $ipRange; - } - return $ipRanges; - } - - /** - * Returns the array of URL query parameters to exclude from URLs - * @param $idSite - * @return array - */ - private function getTrackerExcludedQueryParameters($idSite) - { - $website = Piwik_SitesManager_API::getInstance()->getSiteFromId($idSite); - $excludedQueryParameters = $website['excluded_parameters']; - $globalExcludedQueryParameters = Piwik_SitesManager_API::getInstance()->getExcludedQueryParametersGlobal(); - - $excludedQueryParameters .= ',' . $globalExcludedQueryParameters; - $parameters = explode(',', $excludedQueryParameters); - $parameters = array_filter($parameters, 'strlen'); - $parameters = array_unique($parameters); - return $parameters; - } - - /** - * Returns the hosts alias URLs - * @param $idSite - * @return array - */ - private function getTrackerHosts($idSite) - { - $urls = Piwik_SitesManager_API::getInstance()->getSiteUrlsFromId($idSite); + $urls = Piwik_SitesManager_API::getSiteUrlsFromId($idsite); $hosts = array(); foreach($urls as $url) { @@ -140,7 +57,12 @@ class Piwik_SitesManager extends Piwik_Plugin $hosts[] = $url['host']; } } - return $hosts; + $array['hosts'] = $hosts; } + function addMenu() + { + Piwik_AddAdminMenu('SitesManager_MenuSites', array('module' => 'SitesManager', 'action' => 'index')); + } } + diff --git a/plugins/SitesManager/templates/DisplayJavascriptCode.tpl b/plugins/SitesManager/templates/DisplayJavascriptCode.tpl index 29a1e53170..9fa7c7f617 100644 --- a/plugins/SitesManager/templates/DisplayJavascriptCode.tpl +++ b/plugins/SitesManager/templates/DisplayJavascriptCode.tpl @@ -2,6 +2,7 @@ {assign var=showPeriodSelection value=false} {include file="CoreAdminHome/templates/header.tpl"} {loadJavascriptTranslations plugins='SitesManager'} +{include file="CoreAdminHome/templates/menu.tpl"} {literal} <style> @@ -12,7 +13,7 @@ code { border-width:1px 1px 1px 5px; direction:ltr; display:block; - font-size:90%; + font-size:80%; margin:2px 2px 20px; padding:4px; text-align:left; @@ -21,7 +22,7 @@ code { </style> {/literal} -<h2>{$displaySiteName}</h2> +<h2>{$siteName}</h2> <p>{'SitesManager_JsTrackingTagHelp'|translate}:</p> <code>{$jsTag}</code> diff --git a/plugins/SitesManager/templates/SitesManager.js b/plugins/SitesManager/templates/SitesManager.js index cf14893c8c..7b523b98a4 100644 --- a/plugins/SitesManager/templates/SitesManager.js +++ b/plugins/SitesManager/templates/SitesManager.js @@ -1,7 +1,8 @@ function getDeleteSiteAJAX( idSite ) { var ajaxRequest = piwikHelper.getStandardAjaxConf(); - + piwikHelper.toggleAjaxLoading(); + var parameters = {}; parameters.module = 'API'; parameters.format = 'json'; @@ -17,28 +18,19 @@ function getDeleteSiteAJAX( idSite ) function getAddSiteAJAX( row ) { var ajaxRequest = piwikHelper.getStandardAjaxConf(); + piwikHelper.toggleAjaxLoading(); var parameters = {}; - var siteName = $(row).find('input#name').val(); - var urls = $(row).find('textarea#urls').val(); - urls = getApiFormatUrls(urls); - var excludedIps = $(row).find('textarea#excludedIps').val(); - excludedIps = getApiFormatTextarea(excludedIps); - var timezone = encodeURIComponent($(row).find('#timezones option:selected').val()); - var currency = encodeURIComponent($(row).find('#currencies option:selected').val()); - var excludedQueryParameters = $(row).find('textarea#excludedQueryParameters').val(); - excludedQueryParameters = getApiFormatTextarea(excludedQueryParameters); - + var siteName = $(row).find('input#siteadd_name').val(); + var urls = $(row).find('textarea#siteadd_urls').val(); + var urls = urls.trim().split("\n"); + var request = ''; request += '&module=API'; request += '&format=json'; request += '&method=SitesManager.addSite'; siteName = encodeURIComponent(siteName); request += '&siteName='+siteName; - request += '&timezone='+timezone; - request += '¤cy='+currency; - request += '&excludedIps='+excludedIps; - request += '&excludedQueryParameters='+excludedQueryParameters; $.each(urls, function (key,value){ request+= '&urls[]='+escape(value);} ); request += '&token_auth=' + piwik.token_auth; @@ -47,33 +39,15 @@ function getAddSiteAJAX( row ) return ajaxRequest; } -function getApiFormatUrls(urls) -{ - var aUrls = urls.trim().split("\n"); - for(var i=0; i < aUrls.length; i++) { - aUrls[i] = encodeURIComponent(aUrls[i]); - } - return aUrls; -} -function getApiFormatTextarea(textareaContent) -{ - return textareaContent.trim().split("\n").join(','); -} - function getUpdateSiteAJAX( row ) { var ajaxRequest = piwikHelper.getStandardAjaxConf(); + piwikHelper.toggleAjaxLoading(); var siteName = $(row).find('input#siteName').val(); var idSite = $(row).children('#idSite').html(); - var urls = $(row).find('textarea#urls').val(); - urls = getApiFormatUrls(urls); - var excludedIps = $(row).find('textarea#excludedIps').val(); - excludedIps = getApiFormatTextarea(excludedIps); - var excludedQueryParameters = $(row).find('textarea#excludedQueryParameters').val(); - excludedQueryParameters = getApiFormatTextarea(excludedQueryParameters); - var timezone = encodeURIComponent($(row).find('#timezones option:selected').val()); - var currency = encodeURIComponent($(row).find('#currencies option:selected').val()); + var urls = $(row).find('textarea#urls').val().trim().split("\n"); + var request = ''; request += '&module=API'; request += '&format=json'; @@ -81,10 +55,6 @@ function getUpdateSiteAJAX( row ) siteName = encodeURIComponent(siteName); request += '&siteName='+siteName; request += '&idSite='+idSite; - request += '&timezone='+timezone; - request += '¤cy='+currency; - request += '&excludedIps='+excludedIps; - request += '&excludedQueryParameters='+excludedQueryParameters; $.each(urls, function (key,value){ if(value.length>1) request+= '&urls[]='+value;} ); request += '&token_auth=' + piwik.token_auth; @@ -93,31 +63,9 @@ function getUpdateSiteAJAX( row ) return ajaxRequest; } -function getGlobalSettingsAJAX() -{ - var ajaxRequest = piwikHelper.getStandardAjaxConf('ajaxLoadingGlobalSettings', 'ajaxErrorGlobalSettings'); - var timezone = encodeURIComponent($('#defaultTimezone option:selected').val()); - var currency = encodeURIComponent($('#defaultCurrency option:selected').val()); - var excludedIps = $('textarea#globalExcludedIps').val(); - excludedIps = getApiFormatTextarea(excludedIps); - var excludedQueryParameters = $('textarea#globalExcludedQueryParameters').val(); - excludedQueryParameters = getApiFormatTextarea(excludedQueryParameters); - var request = ''; - request += 'module=SitesManager'; - request += '&action=setGlobalSettings'; - request += '&format=json'; - request += '&timezone='+timezone; - request += '¤cy='+currency; - request += '&excludedIps='+excludedIps; - request += '&excludedQueryParameters='+excludedQueryParameters; - request += '&token_auth=' + piwik.token_auth; - ajaxRequest.data = request; - return ajaxRequest; -} - $(document).ready( function() { $('.addRowSite').click( function() { - piwikHelper.hideAjaxError(); + piwikHelper.ajaxHideError(); $(this).toggle(); var numberOfRows = $('table#editSites')[0].rows.length; @@ -125,25 +73,22 @@ $(document).ready( function() { $(' <tr id="'+newRowId+'">\ <td> </td>\ - <td><input id="name" value="Name" size="15" /></td>\ - <td><textarea cols="25" rows="3" id="urls">http://siteUrl.com/\nhttp://siteUrl2.com/</textarea><br />'+aliasUrlsHelp+'</td>\ - <td><textarea cols="20" rows="4" id="excludedIps"></textarea><br />'+excludedIpHelp+'</td>\ - <td><textarea cols="20" rows="4" id="excludedQueryParameters"></textarea><br />'+excludedQueryParametersHelp+'</td>\ - <td>'+getTimezoneSelector(defaultTimezone)+'<br />' + timezoneHelp + '</td>\ - <td>'+getCurrencySelector(defaultCurrency)+'<br />' + currencyHelp + '</td>\ - <td><img src="plugins/UsersManager/images/ok.png" class="addsite" href="#" title="' + _pk_translate('SitesManager_Save_js') + '" /></td>\ - <td><img src="plugins/UsersManager/images/remove.png" class="cancel" title="' + _pk_translate('SitesManager_Cancel_js') +'" /></td>\ + <td><input id="siteadd_name" value="Name" size=25></td>\ + <td><textarea cols=30 rows=3 id="siteadd_urls">http://siteUrl.com/\nhttp://siteUrl2.com/</textarea></td>\ + <td><img src="plugins/UsersManager/images/ok.png" class="addsite" href="#"></td>\ + <td><img src="plugins/UsersManager/images/remove.png" class="cancel"></td>\ </tr>') .appendTo('#editSites') ; + $('#'+newRowId).keypress( submitSiteOnEnter ); $('.addsite').click( function(){ $.ajax( getAddSiteAJAX($('tr#'+newRowId)) ); } ); - $('.cancel').click(function() { piwikHelper.hideAjaxError(); $(this).parents('tr').remove(); $('.addRowSite').toggle(); }); - return false; + $('.cancel').click(function() { piwikHelper.ajaxHideError(); $(this).parents('tr').remove(); $('.addRowSite').toggle(); }); + } ); // when click on deleteuser, the we ask for confirmation and then delete the user $('.deleteSite').click( function() { - piwikHelper.hideAjaxError(); + piwikHelper.ajaxHideError(); var idRow = $(this).attr('id'); var nameToDelete = $(this).parent().parent().find('input#siteName').val() || $(this).parent().parent().find('td#siteName').html(); var idsiteToDelete = $(this).parent().parent().find('#idSite').html(); @@ -156,7 +101,7 @@ $(document).ready( function() { var alreadyEdited = new Array; $('.editSite') .click( function() { - piwikHelper.hideAjaxError(); + piwikHelper.ajaxHideError(); var idRow = $(this).attr('id'); if(alreadyEdited[idRow]==1) return; alreadyEdited[idRow] = 1; @@ -168,39 +113,14 @@ $(document).ready( function() { var idName = $(n).attr('id'); if(idName == 'siteName') { - var contentAfter = '<input id="'+idName+'" value="'+contentBefore+'" size="15" />'; + var contentAfter = '<input id="'+idName+'" value="'+contentBefore+'" size="25">'; $(n) .html(contentAfter) .keypress( submitSiteOnEnter ); } if(idName == 'urls') { - var contentAfter = '<textarea cols="25" rows="3" id="urls">'+contentBefore.replace(/<br *\/? *>/gi,"\n")+'</textarea>'; - contentAfter += '<br />'+aliasUrlsHelp; - $(n).html(contentAfter); - } - if(idName == 'excludedIps') - { - var contentAfter = '<textarea cols="20" rows="4" id="excludedIps">'+contentBefore.replace(/<br *\/? *>/gi,"\n")+'</textarea>'; - contentAfter += '<br />'+excludedIpHelp; - $(n).html(contentAfter); - } - if(idName == 'excludedQueryParameters') - { - var contentAfter = '<textarea cols="20" rows="4" id="excludedQueryParameters">'+contentBefore.replace(/<br *\/? *>/gi,"\n")+'</textarea>'; - contentAfter += '<br />'+excludedQueryParametersHelp; - $(n).html(contentAfter); - } - if(idName == 'timezone') - { - var contentAfter = getTimezoneSelector(contentBefore); - contentAfter += '<br />' + timezoneHelp; - $(n).html(contentAfter); - } - if(idName == 'currency') - { - var contentAfter = getCurrencySelector(contentBefore); - contentAfter += '<br />' + currencyHelp; + var contentAfter = '<textarea cols=30 rows=3 id="urls">'+contentBefore.replace(/<br *\/? *>/gi,"\n")+'</textarea>'; $(n).html(contentAfter); } } @@ -208,55 +128,15 @@ $(document).ready( function() { $(this) .toggle() .parent() - .prepend( $('<img src="plugins/UsersManager/images/ok.png" class="updateSite" title="' + _pk_translate('SitesManager_Save_js') + '" />') + .prepend( $('<img src="plugins/UsersManager/images/ok.png" class="updateSite">') .click( function(){ $.ajax( getUpdateSiteAJAX( $('tr#'+idRow) ) ); } ) ); } ); - $('#globalSettingsSubmit').click( function() { - $.ajax( getGlobalSettingsAJAX() ); - }); - - $('#defaultTimezone').html( getTimezoneSelector(defaultTimezone)); - $('#defaultCurrency').html( getCurrencySelector(defaultCurrency)); - $('td.editableSite').click( function(){ $(this).parent().find('.editSite').click(); } ); }); - -function getTimezoneSelector(selectedTimezone) -{ - var html = '<select id="timezones">'; - for(var continent in timezones) { - html += '<optgroup label="' + continent + '">'; - for(var timezoneId in timezones[continent]) { - var selected = ''; - if(timezoneId == selectedTimezone) { - selected = ' selected="selected" '; - } - html += '<option ' + selected + ' value="'+ timezoneId + '">' + timezones[continent][timezoneId] + '</option>'; - } - html += "</optgroup>\n"; - } - html += '</select>'; - return html; -} - - -function getCurrencySelector(selectedCurrency) -{ - var html = '<select id="currencies">'; - for(var currency in currencies) { - var selected = ''; - if(currency == selectedCurrency) { - selected = ' selected="selected" '; - } - html += '<option ' + selected + ' value="'+ currency + '">' + currencies[currency] + '</option>'; - } - html += '</select>'; - return html; -} - + function submitSiteOnEnter(e) { var key=e.keyCode || e.which; diff --git a/plugins/SitesManager/templates/SitesManager.tpl b/plugins/SitesManager/templates/SitesManager.tpl index b61a3eaea2..39d7f9261a 100644 --- a/plugins/SitesManager/templates/SitesManager.tpl +++ b/plugins/SitesManager/templates/SitesManager.tpl @@ -2,47 +2,9 @@ {assign var=showPeriodSelection value=false} {include file="CoreAdminHome/templates/header.tpl"} {loadJavascriptTranslations plugins='SitesManager'} - -<script type="text/javascript"> -{capture assign=excludedIpHelpPlain}{'SitesManager_HelpExcludedIps'|translate:"1.2.3.*":"1.2.*.*"}<br /><br /> {'SitesManager_YourCurrentIpAddressIs'|translate:"<i>$currentIpAddress</i>"}{/capture} -{assign var=excludedIpHelp value=$excludedIpHelpPlain|inlineHelp} -var excludedIpHelp = '{$excludedIpHelp|escape:javascript}'; -var aliasUrlsHelp = '{'SitesManager_AliasUrlHelp'|translate|inlineHelp|escape:javascript}'; -{capture assign=defaultTimezoneHelpPlain} - {if $timezoneSupported} - {'SitesManager_ChooseCityInSameTimezoneAsYou'|translate} - {else} - {'SitesManager_AdvancedTimezoneSupportNotFound'|translate} - {/if} <br /><br />{'SitesManager_UTCTimeIs'|translate:$utcTime} -{/capture} - -{capture assign=timezoneHelpPlain} - {$defaultTimezoneHelpPlain} - <br /><br />{'SitesManager_ChangingYourTimezoneWillOnlyAffectDataForward'|translate} -{/capture} - -{capture assign=currencyHelpPlain} - {'SitesManager_CurrencySymbolWillBeUsedForGoals'|translate|inlineHelp} -{/capture} - -{capture assign=excludedQueryParametersHelp} - {'SitesManager_ListOfQueryParametersToExclude'|translate} - <br /><br /> - {'SitesManager_PiwikWillAutomaticallyExcludeCommonSessionParameters'|translate:"phpsessid, sessionid, etc."} -{/capture} -{assign var=excludedQueryParametersHelp value=$excludedQueryParametersHelp|inlineHelp} -var excludedQueryParametersHelp = '{$excludedQueryParametersHelp|escape:javascript}'; -var timezoneHelp = '{$timezoneHelpPlain|inlineHelp|escape:javascript}'; -var currencyHelp = '{$currencyHelpPlain|escape:javascript}'; -{assign var=defaultTimezoneHelp value=$defaultTimezoneHelpPlain|inlineHelp}; -var timezones = {$timezones}; -var currencies = {$currencies}; -var defaultTimezone = '{$defaultTimezone}'; -var defaultCurrency = '{$defaultCurrency}'; -</script> +{include file="CoreAdminHome/templates/menu.tpl"} <script type="text/javascript" src="plugins/SitesManager/templates/SitesManager.js"></script> - {literal} <style> .addRowSite:hover, .editableSite:hover, .addsite:hover, .cancel:hover, .deleteSite:hover, .editSite:hover, .updateSite:hover{ @@ -60,27 +22,13 @@ var defaultCurrency = '{$defaultCurrency}'; #editSites { valign: top; } -option, select { - font-size:11px; -} -textarea { -font-size:9pt; -} -.admin thead th { -vertical-align:middle; -} </style> {/literal} - <h2>{'SitesManager_WebsitesManagement'|translate}</h2> -<p>{'SitesManager_MainDescription'|translate} -{if $isSuperUser} -<br />{'SitesManager_SuperUserCan'|translate:"<a href='#globalSettings'>":"</a>"} -{/if} -</p> -{ajaxErrorDiv} -{ajaxLoadingDiv} +<p>{'SitesManager_MainDescription'|translate}</p> +<div id="ajaxError" style="display:none"></div> +<div id="ajaxLoading" style="display:none"><div id="loadingPiwik"><img src="themes/default/images/loading-blue.gif" alt="" /> {'General_LoadingData'|translate} </div></div> {if $adminSites|@count == 0} {'SitesManager_NoWebsites'|translate} @@ -91,10 +39,6 @@ vertical-align:middle; <th>{'SitesManager_Id'|translate}</th> <th>{'SitesManager_Name'|translate}</th> <th>{'SitesManager_Urls'|translate}</th> - <th>{'SitesManager_ExcludedIps'|translate}</th> - <th>{'SitesManager_ExcludedParameters'|translate|replace:" ":"<br />"}</th> - <th>{'SitesManager_Timezone'|translate}</th> - <th>{'SitesManager_Currency'|translate}</th> <th> </th> <th> </th> <th> {'SitesManager_JsTrackingTag'|translate} </th> @@ -106,75 +50,15 @@ vertical-align:middle; <td id="idSite">{$site.idsite}</td> <td id="siteName" class="editableSite">{$site.name}</td> <td id="urls" class="editableSite">{foreach from=$site.alias_urls item=url}{$url}<br />{/foreach}</td> - <td id="excludedIps" class="editableSite">{foreach from=$site.excluded_ips item=ip}{$ip}<br />{/foreach}</td> - <td id="excludedQueryParameters" class="editableSite">{foreach from=$site.excluded_parameters item=parameter}{$parameter}<br />{/foreach}</td> - <td id="timezone" class="editableSite">{$site.timezone}</td> - <td id="currency" class="editableSite">{$site.currency}</td> - <td><img src='plugins/UsersManager/images/edit.png' class="editSite" id="row{$i}" href='#' title="{'General_Edit'|translate}" /></td> - <td><img src='plugins/UsersManager/images/remove.png' class="deleteSite" id="row{$i}" title="{'General_Delete'|translate}" value="{'General_Delete'|translate}" /></td> + <td><img src='plugins/UsersManager/images/edit.png' class="editSite" id="row{$i}" href='#' alt="" /></td> + <td><img src='plugins/UsersManager/images/remove.png' class="deleteSite" id="row{$i}" value="{'General_Delete'|translate}" alt="" /></td> <td><a href='{url action=displayJavascriptCode idsite=$site.idsite}'>{'SitesManager_ShowTrackingTag'|translate}</a></td> </tr> {/foreach} + </tbody> </table> - {if $isSuperUser} - <div class="addRowSite"><a href=""><img src='plugins/UsersManager/images/add.png' alt="" /> {'SitesManager_AddSite'|translate}</a></div> - {/if} -{/if} - -{if $isSuperUser} -<br /> - <a name='globalSettings'></a> - <h2>{'SitesManager_GlobalWebsitesSettings'|translate}</h2> - <br /> - <table style='width:600px' class="adminTable adminTableNoBorder" > - - <tr><td colspan="2"> - <b>{'SitesManager_GlobalListExcludedIps'|translate}</b> - <p>{'SitesManager_ListOfIpsToBeExcludedOnAllWebsites'|translate} </p> - </td></tr> - <tr><td> - <textarea cols="30" rows="3" id="globalExcludedIps">{$globalExcludedIps} -</textarea> - </td><td> - {$excludedIpHelp} - </td></tr> - - <tr><td colspan="2"> - <b>{'SitesManager_GlobalListExcludedQueryParameters'|translate}</b> - <p>{'SitesManager_ListOfQueryParametersToBeExcludedOnAllWebsites'|translate} </p> - </td></tr> - <tr><td> - <textarea cols="30" rows="3" id="globalExcludedQueryParameters">{$globalExcludedQueryParameters} -</textarea> - </td><td> - {$excludedQueryParametersHelp} - </td></tr> - - <tr><td colspan="2"> - <b>{'SitesManager_DefaultTimezoneForNewWebsites'|translate}</b> - <p>{'SitesManager_SelectDefaultTimezone'|translate} </p> - </td></tr> - <tr><td> - <div id='defaultTimezone'></div> - </td><td> - {$defaultTimezoneHelp} - </td></tr> - - <tr><td colspan="2"> - <b>{'SitesManager_DefaultCurrencyForNewWebsites'|translate}</b> - <p>{'SitesManager_SelectDefaultCurrency'|translate} </p> - </td></tr> - <tr><td> - <div id='defaultCurrency'></div> - </td><td> - {$currencyHelpPlain} - </td></tr> - </table> - <span style='margin-left:20px'><input type="submit" class="submit" id='globalSettingsSubmit' value="{'General_Save'|translate}" /></span> - {ajaxErrorDiv id=ajaxErrorGlobalSettings} - {ajaxLoadingDiv id=ajaxLoadingGlobalSettings} + <div class="addRowSite"><a href="#"><img src='plugins/UsersManager/images/add.png' alt="" /> {'SitesManager_AddSite'|translate}</a></div> {/if} -<br /><br /><br /><br /> {include file="CoreAdminHome/templates/footer.tpl"} diff --git a/plugins/SitesManager/tests/SitesManager.test.php b/plugins/SitesManager/tests/SitesManager.test.php index fbaf8c7adf..db4c765812 100644 --- a/plugins/SitesManager/tests/SitesManager.test.php +++ b/plugins/SitesManager/tests/SitesManager.test.php @@ -7,15 +7,10 @@ if(!defined('PIWIK_CONFIG_TEST_INCLUDED')) require_once PIWIK_PATH_TEST_TO_ROOT . "/tests/config_test.php"; } -require_once PIWIK_PATH_TEST_TO_ROOT . '/tests/core/Database.test.php'; +require_once "Database.test.php"; class Test_Piwik_SitesManager extends Test_Database { - public function __construct() - { - Piwik_PluginsManager::getInstance()->unloadPlugin('ExampleFeedburner'); - parent::__construct(); - } public function setUp() { parent::setUp(); @@ -24,9 +19,6 @@ class Test_Piwik_SitesManager extends Test_Database $pseudoMockAccess = new FakeAccess; FakeAccess::$superUser = true; Zend_Registry::set('access', $pseudoMockAccess); - - // clear static Site cache - Piwik_Site::clearCache(); } /** @@ -35,7 +27,7 @@ class Test_Piwik_SitesManager extends Test_Database public function test_addSite_emptyName() { try { - Piwik_SitesManager_API::getInstance()->addSite("",array("http://piwik.net")); + Piwik_SitesManager_API::addSite("",array("http://piwik.net")); } catch (Exception $expected) { return; @@ -49,7 +41,7 @@ class Test_Piwik_SitesManager extends Test_Database public function test_addSite_noUrls() { try { - Piwik_SitesManager_API::getInstance()->addSite("name",array()); + Piwik_SitesManager_API::addSite("name",array()); } catch (Exception $expected) { return; @@ -63,7 +55,7 @@ class Test_Piwik_SitesManager extends Test_Database public function test_addSite_wrongUrls1() { try { - Piwik_SitesManager_API::getInstance()->addSite("name",array("")); + Piwik_SitesManager_API::addSite("name",array("")); } catch (Exception $expected) { return; @@ -76,7 +68,7 @@ class Test_Piwik_SitesManager extends Test_Database public function test_addSite_wrongUrls2() { try { - Piwik_SitesManager_API::getInstance()->addSite("name",""); + Piwik_SitesManager_API::addSite("name",""); } catch (Exception $expected) { return; @@ -90,7 +82,7 @@ class Test_Piwik_SitesManager extends Test_Database public function test_addSite_wrongUrls3() { try { - Piwik_SitesManager_API::getInstance()->addSite("name","httpww://piwik.net"); + Piwik_SitesManager_API::addSite("name","httpww://piwik.net"); } catch (Exception $expected) { return; @@ -104,7 +96,7 @@ class Test_Piwik_SitesManager extends Test_Database public function test_addSite_wrongUrls4() { try { - Piwik_SitesManager_API::getInstance()->addSite("name","httpww://piwik.net/gqg~#"); + Piwik_SitesManager_API::addSite("name","httpww://piwik.net/gqg~#"); } catch (Exception $expected) { return; @@ -113,68 +105,19 @@ class Test_Piwik_SitesManager extends Test_Database } /** - * Test with valid IPs - */ - public function test_addSite_excludedIpsAndtimezoneAndCurrencyAndExcludedQueryParameters_valid() - { - $ips = '1.2.3.4,1.1.1.*,1.2.*.*,1.*.*.*'; - $timezone = 'Europe/Paris'; - $currency = 'EUR'; - $excludedQueryParameters = 'p1,P2, P33333'; - $expectedExcludedQueryParameters = 'p1,P2,P33333'; - $idsite = Piwik_SitesManager_API::getInstance()->addSite("name","http://piwik.net/", $ips, $excludedQueryParameters,$timezone, $currency); - $siteInfo = Piwik_SitesManager_API::getInstance()->getSiteFromId($idsite); - $this->assertEqual($siteInfo['excluded_ips'], $ips); - $this->assertEqual($siteInfo['timezone'], $timezone); - $this->assertEqual($siteInfo['currency'], $currency); - $this->assertEqual($siteInfo['excluded_parameters'], $expectedExcludedQueryParameters); - } - - /** - * Test with invalid IPs - */ - public function test_addSite_excludedIps_notValid() - { - $invalidIps = array( - '35817587341', - 'ieagieha', - '1.2.3', - '*.1.1.1', - '*.*.1.1', - '*.*.*.1', - '*.*.*.*', - '1.1.1.1.1', - ); - foreach($invalidIps as $ip) - { - $raised = false; - try { - $idsite = Piwik_SitesManager_API::getInstance()->addSite("name","http://piwik.net/", $ip); - } catch(Exception $e) { - $raised = true; - } - if(!$raised) - { - $this->fail('was expecting invalid IP exception to raise'); - } - } - $this->pass(); - } - - /** * one url -> one main_url and nothing inserted as alias urls */ public function test_addSite_oneUrl() { $url = "http://piwik.net/"; $urlOK = "http://piwik.net"; - $idsite = Piwik_SitesManager_API::getInstance()->addSite("name",$url); + $idsite = Piwik_SitesManager_API::addSite("name",$url); $this->assertIsA( $idsite,'int'); - $siteInfo = Piwik_SitesManager_API::getInstance()->getSiteFromId($idsite); + $siteInfo = Piwik_SitesManager_API::getSiteFromId($idsite); $this->assertEqual($siteInfo['main_url'], $urlOK); - $siteUrls = Piwik_SitesManager_API::getInstance()->getSiteUrlsFromId($idsite); + $siteUrls = Piwik_SitesManager_API::getSiteUrlsFromId($idsite); $this->assertTrue(count($siteUrls)===1); } @@ -185,13 +128,13 @@ class Test_Piwik_SitesManager extends Test_Database { $urls = array("http://piwik.net/","http://piwik.com","https://piwik.net/test/"); $urlsOK = array("http://piwik.net","http://piwik.com","https://piwik.net/test"); - $idsite = Piwik_SitesManager_API::getInstance()->addSite("super website",$urls); + $idsite = Piwik_SitesManager_API::addSite("super website",$urls); $this->assertIsA( $idsite,'int'); - $siteInfo = Piwik_SitesManager_API::getInstance()->getSiteFromId($idsite); + $siteInfo = Piwik_SitesManager_API::getSiteFromId($idsite); $this->assertEqual($siteInfo['main_url'], $urlsOK[0]); - $siteUrls = Piwik_SitesManager_API::getInstance()->getSiteUrlsFromId($idsite); + $siteUrls = Piwik_SitesManager_API::getSiteUrlsFromId($idsite); $this->assertEqual($siteUrls, $urlsOK); } @@ -201,10 +144,10 @@ class Test_Piwik_SitesManager extends Test_Database public function test_addSite_strangeName() { $name = "supertest(); ~@@()''!£\$'%%^'!£"; - $idsite = Piwik_SitesManager_API::getInstance()->addSite($name,"http://piwik.net"); + $idsite = Piwik_SitesManager_API::addSite($name,"http://piwik.net"); $this->assertIsA( $idsite,'int'); - $siteInfo = Piwik_SitesManager_API::getInstance()->getSiteFromId($idsite); + $siteInfo = Piwik_SitesManager_API::getSiteFromId($idsite); $this->assertEqual($siteInfo['name'], $name); } @@ -214,14 +157,14 @@ class Test_Piwik_SitesManager extends Test_Database public function test_addSite() { $name = "website "; - $idsite = Piwik_SitesManager_API::getInstance()->addSite($name,array("http://piwik.net","http://piwik.com/test/")); + $idsite = Piwik_SitesManager_API::addSite($name,array("http://piwik.net","http://piwik.com/test/")); $this->assertIsA( $idsite,'int'); - $siteInfo = Piwik_SitesManager_API::getInstance()->getSiteFromId($idsite); + $siteInfo = Piwik_SitesManager_API::getSiteFromId($idsite); $this->assertEqual($siteInfo['name'], $name); $this->assertEqual($siteInfo['main_url'], "http://piwik.net"); - $siteUrls = Piwik_SitesManager_API::getInstance()->getSiteUrlsFromId($idsite); + $siteUrls = Piwik_SitesManager_API::getSiteUrlsFromId($idsite); $this->assertEqual($siteUrls, array("http://piwik.net","http://piwik.com/test")); return $idsite; @@ -234,7 +177,7 @@ class Test_Piwik_SitesManager extends Test_Database { $idsite = $this->test_addSite(); - $siteUrlsBefore = Piwik_SitesManager_API::getInstance()->getSiteUrlsFromId($idsite); + $siteUrlsBefore = Piwik_SitesManager_API::getSiteUrlsFromId($idsite); $toAdd = array( "http://piwik1.net", "http://piwik2.net", @@ -252,10 +195,10 @@ class Test_Piwik_SitesManager extends Test_Database "http://l42578gqege.f4", "http://super.com/test/test/atqata675675/te"); - $insertedUrls = Piwik_SitesManager_API::getInstance()->addSiteAliasUrls($idsite, $toAdd); + $insertedUrls = Piwik_SitesManager_API::addSiteAliasUrls($idsite, $toAdd); $this->assertEqual($insertedUrls, count($toAdd)); - $siteUrlsAfter = Piwik_SitesManager_API::getInstance()->getSiteUrlsFromId($idsite); + $siteUrlsAfter = Piwik_SitesManager_API::getSiteUrlsFromId($idsite); $shouldHave = array_merge($siteUrlsBefore, $toAddValid); sort($shouldHave); @@ -272,14 +215,14 @@ class Test_Piwik_SitesManager extends Test_Database { $idsite = $this->test_addSite(); - $siteUrlsBefore = Piwik_SitesManager_API::getInstance()->getSiteUrlsFromId($idsite); + $siteUrlsBefore = Piwik_SitesManager_API::getSiteUrlsFromId($idsite); $toAdd = array_merge($siteUrlsBefore, array("http://piwik1.net","http://piwik2.net")); - $insertedUrls = Piwik_SitesManager_API::getInstance()->addSiteAliasUrls($idsite, $toAdd); + $insertedUrls = Piwik_SitesManager_API::addSiteAliasUrls($idsite, $toAdd); $this->assertEqual($insertedUrls, count($toAdd) - count($siteUrlsBefore)); - $siteUrlsAfter = Piwik_SitesManager_API::getInstance()->getSiteUrlsFromId($idsite); + $siteUrlsAfter = Piwik_SitesManager_API::getSiteUrlsFromId($idsite); $shouldHave = $toAdd; sort($shouldHave); @@ -296,14 +239,14 @@ class Test_Piwik_SitesManager extends Test_Database { $idsite = $this->test_addSite(); - $siteUrlsBefore = Piwik_SitesManager_API::getInstance()->getSiteUrlsFromId($idsite); + $siteUrlsBefore = Piwik_SitesManager_API::getSiteUrlsFromId($idsite); $toAdd = array(); - $insertedUrls = Piwik_SitesManager_API::getInstance()->addSiteAliasUrls($idsite, $toAdd); + $insertedUrls = Piwik_SitesManager_API::addSiteAliasUrls($idsite, $toAdd); $this->assertEqual($insertedUrls, count($toAdd)); - $siteUrlsAfter = Piwik_SitesManager_API::getInstance()->getSiteUrlsFromId($idsite); + $siteUrlsAfter = Piwik_SitesManager_API::getSiteUrlsFromId($idsite); $shouldHave = $siteUrlsBefore; sort($shouldHave); @@ -320,14 +263,14 @@ class Test_Piwik_SitesManager extends Test_Database { $idsite = $this->test_addSite(); - $siteUrlsBefore = Piwik_SitesManager_API::getInstance()->getSiteUrlsFromId($idsite); + $siteUrlsBefore = Piwik_SitesManager_API::getSiteUrlsFromId($idsite); $toAdd = $siteUrlsBefore; - $insertedUrls = Piwik_SitesManager_API::getInstance()->addSiteAliasUrls($idsite, $toAdd); + $insertedUrls = Piwik_SitesManager_API::addSiteAliasUrls($idsite, $toAdd); $this->assertEqual($insertedUrls, 0); - $siteUrlsAfter = Piwik_SitesManager_API::getInstance()->getSiteUrlsFromId($idsite); + $siteUrlsAfter = Piwik_SitesManager_API::getSiteUrlsFromId($idsite); $shouldHave = $siteUrlsBefore; sort($shouldHave); @@ -344,7 +287,7 @@ class Test_Piwik_SitesManager extends Test_Database $idsite = $this->test_addSite(); $toAdd = array("htt{}p://pigeq.com/test"); try { - $insertedUrls = Piwik_SitesManager_API::getInstance()->addSiteAliasUrls($idsite, $toAdd); + $insertedUrls = Piwik_SitesManager_API::addSiteAliasUrls($idsite, $toAdd); } catch (Exception $expected) { return; @@ -359,7 +302,7 @@ class Test_Piwik_SitesManager extends Test_Database { $toAdd = array("http://pigeq.com/test"); try { - $insertedUrls = Piwik_SitesManager_API::getInstance()->addSiteAliasUrls(-1, $toAdd); + $insertedUrls = Piwik_SitesManager_API::addSiteAliasUrls(-1, $toAdd); } catch (Exception $expected) { return; @@ -375,7 +318,7 @@ class Test_Piwik_SitesManager extends Test_Database $toAdd = array("http://pigeq.com/test"); try { - $insertedUrls = Piwik_SitesManager_API::getInstance()->addSiteAliasUrls(155, $toAdd); + $insertedUrls = Piwik_SitesManager_API::addSiteAliasUrls(155, $toAdd); } catch (Exception $expected) { return; @@ -388,7 +331,7 @@ class Test_Piwik_SitesManager extends Test_Database */ function test_getAllSitesId_noId() { - $ids = Piwik_SitesManager_API::getInstance()->getAllSitesId(); + $ids = Piwik_SitesManager_API::getAllSitesId(); $this->assertEqual(array(),$ids); } @@ -399,14 +342,14 @@ class Test_Piwik_SitesManager extends Test_Database { $name="tetq"; $idsites = array( - Piwik_SitesManager_API::getInstance()->addSite($name,array("http://piwik.net","http://piwik.com/test/")), - Piwik_SitesManager_API::getInstance()->addSite($name,array("http://piwik.net","http://piwik.com/test/")), - Piwik_SitesManager_API::getInstance()->addSite($name,array("http://piwik.net","http://piwik.com/test/")), - Piwik_SitesManager_API::getInstance()->addSite($name,array("http://piwik.net","http://piwik.com/test/")), - Piwik_SitesManager_API::getInstance()->addSite($name,array("http://piwik.net","http://piwik.com/test/")), + Piwik_SitesManager_API::addSite($name,array("http://piwik.net","http://piwik.com/test/")), + Piwik_SitesManager_API::addSite($name,array("http://piwik.net","http://piwik.com/test/")), + Piwik_SitesManager_API::addSite($name,array("http://piwik.net","http://piwik.com/test/")), + Piwik_SitesManager_API::addSite($name,array("http://piwik.net","http://piwik.com/test/")), + Piwik_SitesManager_API::addSite($name,array("http://piwik.net","http://piwik.com/test/")), ); - $ids = Piwik_SitesManager_API::getInstance()->getAllSitesId(); + $ids = Piwik_SitesManager_API::getAllSitesId(); $this->assertEqual($idsites,$ids); } @@ -417,7 +360,7 @@ class Test_Piwik_SitesManager extends Test_Database { try { - $siteInfo = Piwik_SitesManager_API::getInstance()->getSiteFromId(0); + $siteInfo = Piwik_SitesManager_API::getSiteFromId(0); } catch (Exception $expected) { return; @@ -432,7 +375,7 @@ class Test_Piwik_SitesManager extends Test_Database { try { - $siteInfo = Piwik_SitesManager_API::getInstance()->getSiteFromId("x1"); + $siteInfo = Piwik_SitesManager_API::getSiteFromId("x1"); } catch (Exception $expected) { return; @@ -445,7 +388,7 @@ class Test_Piwik_SitesManager extends Test_Database */ function test_getSiteFromId_wrongId3() { - $idsite = Piwik_SitesManager_API::getInstance()->addSite("site",array("http://piwik.net","http://piwik.com/test/")); + $idsite = Piwik_SitesManager_API::addSite("site",array("http://piwik.net","http://piwik.com/test/")); $this->assertEqual($idsite,1); // set noaccess to site 1 @@ -453,7 +396,7 @@ class Test_Piwik_SitesManager extends Test_Database FakeAccess::setIdSitesAdmin (array()); try { - $siteInfo = Piwik_SitesManager_API::getInstance()->getSiteFromId(1); + $siteInfo = Piwik_SitesManager_API::getSiteFromId(1); } catch (Exception $expected) { return; @@ -467,10 +410,10 @@ class Test_Piwik_SitesManager extends Test_Database function test_getSiteFromId_normalId() { $name = "website ''"; - $idsite = Piwik_SitesManager_API::getInstance()->addSite($name,array("http://piwik.net","http://piwik.com/test/")); + $idsite = Piwik_SitesManager_API::addSite($name,array("http://piwik.net","http://piwik.com/test/")); $this->assertIsA( $idsite,'int'); - $siteInfo = Piwik_SitesManager_API::getInstance()->getSiteFromId($idsite); + $siteInfo = Piwik_SitesManager_API::getSiteFromId($idsite); $this->assertEqual($siteInfo['name'], $name); $this->assertEqual($siteInfo['main_url'], "http://piwik.net"); } @@ -483,7 +426,7 @@ class Test_Piwik_SitesManager extends Test_Database { FakeAccess::setIdSitesAdmin (array()); - $sites = Piwik_SitesManager_API::getInstance()->getSitesWithAdminAccess(); + $sites = Piwik_SitesManager_API::getSitesWithAdminAccess(); $this->assertEqual($sites, array()); } @@ -492,18 +435,18 @@ class Test_Piwik_SitesManager extends Test_Database */ function test_getSitesWithAdminAccess() { - $idsite = Piwik_SitesManager_API::getInstance()->addSite("site1",array("http://piwik.net","http://piwik.com/test/")); - $idsite = Piwik_SitesManager_API::getInstance()->addSite("site2",array("http://piwik.com/test/")); - $idsite = Piwik_SitesManager_API::getInstance()->addSite("site3",array("http://piwik.org")); + $idsite = Piwik_SitesManager_API::addSite("site1",array("http://piwik.net","http://piwik.com/test/")); + $idsite = Piwik_SitesManager_API::addSite("site2",array("http://piwik.com/test/")); + $idsite = Piwik_SitesManager_API::addSite("site3",array("http://piwik.org")); $resultWanted = array( - 0 => array("idsite" => 1, "name" => "site1", "main_url" =>"http://piwik.net", "excluded_ips" => "", 'excluded_parameters' => '', 'timezone' => 'UTC', 'currency' => 'USD'), - 1 => array("idsite" => 3, "name" => "site3", "main_url" =>"http://piwik.org", "excluded_ips" => "", 'excluded_parameters' => '', 'timezone' => 'UTC', 'currency' => 'USD'), + 0 => array("idsite" => 1, "name" => "site1", "main_url" =>"http://piwik.net"), + 1 => array("idsite" => 3, "name" => "site3", "main_url" =>"http://piwik.org"), ); FakeAccess::setIdSitesAdmin (array(1,3)); - $sites = Piwik_SitesManager_API::getInstance()->getSitesWithAdminAccess(); + $sites = Piwik_SitesManager_API::getSitesWithAdminAccess(); // we dont test the ts_created unset($sites[0]['ts_created']); @@ -519,7 +462,7 @@ class Test_Piwik_SitesManager extends Test_Database FakeAccess::setIdSitesView (array()); FakeAccess::setIdSitesAdmin (array()); - $sites = Piwik_SitesManager_API::getInstance()->getSitesWithViewAccess(); + $sites = Piwik_SitesManager_API::getSitesWithViewAccess(); $this->assertEqual($sites, array()); } @@ -528,19 +471,19 @@ class Test_Piwik_SitesManager extends Test_Database */ function test_getSitesWithViewAccess() { - $idsite = Piwik_SitesManager_API::getInstance()->addSite("site1",array("http://piwik.net","http://piwik.com/test/")); - $idsite = Piwik_SitesManager_API::getInstance()->addSite("site2",array("http://piwik.com/test/")); - $idsite = Piwik_SitesManager_API::getInstance()->addSite("site3",array("http://piwik.org")); + $idsite = Piwik_SitesManager_API::addSite("site1",array("http://piwik.net","http://piwik.com/test/")); + $idsite = Piwik_SitesManager_API::addSite("site2",array("http://piwik.com/test/")); + $idsite = Piwik_SitesManager_API::addSite("site3",array("http://piwik.org")); $resultWanted = array( - 0 => array("idsite" => 1, "name" => "site1", "main_url" =>"http://piwik.net", "excluded_ips" => "", 'excluded_parameters' => '', 'timezone' => 'UTC', 'currency' => 'USD'), - 1 => array("idsite" => 3, "name" => "site3", "main_url" =>"http://piwik.org", "excluded_ips" => "", 'excluded_parameters' => '', 'timezone' => 'UTC', 'currency' => 'USD'), + 0 => array("idsite" => 1, "name" => "site1", "main_url" =>"http://piwik.net"), + 1 => array("idsite" => 3, "name" => "site3", "main_url" =>"http://piwik.org"), ); FakeAccess::setIdSitesView (array(1,3)); FakeAccess::setIdSitesAdmin (array()); - $sites = Piwik_SitesManager_API::getInstance()->getSitesWithViewAccess(); + $sites = Piwik_SitesManager_API::getSitesWithViewAccess(); // we dont test the ts_created unset($sites[0]['ts_created']); unset($sites[1]['ts_created']); @@ -555,7 +498,7 @@ class Test_Piwik_SitesManager extends Test_Database FakeAccess::setIdSitesView (array()); FakeAccess::setIdSitesAdmin (array()); - $sites = Piwik_SitesManager_API::getInstance()->getSitesWithAtLeastViewAccess(); + $sites = Piwik_SitesManager_API::getSitesWithAtLeastViewAccess(); $this->assertEqual($sites, array()); } @@ -564,19 +507,19 @@ class Test_Piwik_SitesManager extends Test_Database */ function test_getSitesWithAtLeastViewAccess() { - $idsite = Piwik_SitesManager_API::getInstance()->addSite("site1",array("http://piwik.net","http://piwik.com/test/")); - $idsite = Piwik_SitesManager_API::getInstance()->addSite("site2",array("http://piwik.com/test/")); - $idsite = Piwik_SitesManager_API::getInstance()->addSite("site3",array("http://piwik.org")); + $idsite = Piwik_SitesManager_API::addSite("site1",array("http://piwik.net","http://piwik.com/test/")); + $idsite = Piwik_SitesManager_API::addSite("site2",array("http://piwik.com/test/")); + $idsite = Piwik_SitesManager_API::addSite("site3",array("http://piwik.org")); $resultWanted = array( - 0 => array("idsite" => 1, "name" => "site1", "main_url" =>"http://piwik.net", "excluded_ips" => "", 'excluded_parameters' => '', 'timezone' => 'UTC', 'currency' => 'USD'), - 1 => array("idsite" => 3, "name" => "site3", "main_url" =>"http://piwik.org", "excluded_ips" => "", 'excluded_parameters' => '', 'timezone' => 'UTC', 'currency' => 'USD'), + 0 => array("idsite" => 1, "name" => "site1", "main_url" =>"http://piwik.net"), + 1 => array("idsite" => 3, "name" => "site3", "main_url" =>"http://piwik.org"), ); FakeAccess::setIdSitesView (array(1,3)); FakeAccess::setIdSitesAdmin (array()); - $sites = Piwik_SitesManager_API::getInstance()->getSitesWithAtLeastViewAccess(); + $sites = Piwik_SitesManager_API::getSitesWithAtLeastViewAccess(); // we dont test the ts_created unset($sites[0]['ts_created']); unset($sites[1]['ts_created']); @@ -589,9 +532,9 @@ class Test_Piwik_SitesManager extends Test_Database */ function test_getSiteUrlsFromId_noUrls() { - $idsite = Piwik_SitesManager_API::getInstance()->addSite("site1",array("http://piwik.net")); + $idsite = Piwik_SitesManager_API::addSite("site1",array("http://piwik.net")); - $urls = Piwik_SitesManager_API::getInstance()->getSiteUrlsFromId($idsite); + $urls = Piwik_SitesManager_API::getSiteUrlsFromId($idsite); $this->assertEqual(array("http://piwik.net"),$urls); } @@ -606,14 +549,14 @@ class Test_Piwik_SitesManager extends Test_Database "http://piwik.com"); sort($site); - $idsite = Piwik_SitesManager_API::getInstance()->addSite("site1",$site); + $idsite = Piwik_SitesManager_API::addSite("site1",$site); $siteWanted = array("http://piwik.net", "http://piwik.org", "http://piwik.com"); sort($siteWanted); - $urls = Piwik_SitesManager_API::getInstance()->getSiteUrlsFromId($idsite); + $urls = Piwik_SitesManager_API::getSiteUrlsFromId($idsite); $this->assertEqual($siteWanted, $urls); @@ -628,7 +571,7 @@ class Test_Piwik_SitesManager extends Test_Database FakeAccess::setIdSitesAdmin (array()); try { - Piwik_SitesManager_API::getInstance()->getSiteUrlsFromId(1); + Piwik_SitesManager_API::getSiteUrlsFromId(1); } catch (Exception $expected) { return; @@ -645,12 +588,12 @@ class Test_Piwik_SitesManager extends Test_Database "http://piwiknew.net", "http://piwiknew.org", "http://piwiknew.fr"); - $idsite = Piwik_SitesManager_API::getInstance()->addSite("site1",$urls); + $idsite = Piwik_SitesManager_API::addSite("site1",$urls); $newMainUrl = "http://main.url"; - Piwik_SitesManager_API::getInstance()->updateSite($idsite, "test toto@{}", $newMainUrl ); + Piwik_SitesManager_API::updateSite($idsite, "test toto@{}", $newMainUrl ); - $allUrls = Piwik_SitesManager_API::getInstance()->getSiteUrlsFromId($idsite); + $allUrls = Piwik_SitesManager_API::getSiteUrlsFromId($idsite); $this->assertEqual($allUrls[0], $newMainUrl); $aliasUrls = array_slice($allUrls,1); @@ -662,12 +605,12 @@ class Test_Piwik_SitesManager extends Test_Database */ function test_updateSite_strangeNameNoUrl() { - $idsite = Piwik_SitesManager_API::getInstance()->addSite("site1","http://main.url"); + $idsite = Piwik_SitesManager_API::addSite("site1","http://main.url"); $newName ="test toto@{'786'}"; - Piwik_SitesManager_API::getInstance()->updateSite($idsite, $newName ); + Piwik_SitesManager_API::updateSite($idsite, $newName ); - $site = Piwik_SitesManager_API::getInstance()->getSiteFromId($idsite); + $site = Piwik_SitesManager_API::getSiteFromId($idsite); $this->assertEqual($site['name'],$newName); // url didn't change because parameter url NULL in updateSite @@ -686,168 +629,20 @@ class Test_Piwik_SitesManager extends Test_Database "http://piwiknew.net", "http://piwiknew.org", "http://piwiknew.fr"); - $idsite = Piwik_SitesManager_API::getInstance()->addSite("site1",$urls); + $idsite = Piwik_SitesManager_API::addSite("site1",$urls); $newurls = array("http://piwiknew2.com", "http://piwiknew2.net", "http://piwiknew2.org", "http://piwiknew2.fr"); - Piwik_SitesManager_API::getInstance()->updateSite($idsite, "test toto@{}",$newurls ); + Piwik_SitesManager_API::updateSite($idsite, "test toto@{}",$newurls ); - $allUrls = Piwik_SitesManager_API::getInstance()->getSiteUrlsFromId($idsite); + $allUrls = Piwik_SitesManager_API::getSiteUrlsFromId($idsite); sort($allUrls); sort($newurls); $this->assertEqual($allUrls,$newurls); } - - function test_addSites_invalidTimezone() - { - // trying invalid timezones - try { - $idsite = Piwik_SitesManager_API::getInstance()->addSite("site1",array('http://example.org'), '', '', 'UTC+15'); - $this->fail('invalid timezone should raise an exception'); - } catch(Exception $e) { - } - try { - $idsite = Piwik_SitesManager_API::getInstance()->addSite("site1",array('http://example.org'), '', '', 'Paris'); - $this->fail('invalid timezone should raise an exception'); - } catch(Exception $e) { - } - $this->pass(); - } - - function test_addSites_invalidCurrency() - { - $invalidCurrency = '€'; - try { - $idsite = Piwik_SitesManager_API::getInstance()->addSite("site1",array('http://example.org'), '', 'UTC', $invalidCurrency); - $this->fail('invalid currency should raise an exception'); - } catch(Exception $e) { - } - $this->pass(); - } - - function test_setDefaultTimezoneAndCurrencyAndExcludedQueryParametersAndExcludedIps() - { - // test that they return default values - $defaultTimezone = Piwik_SitesManager_API::getInstance()->getDefaultTimezone(); - $this->assertEqual($defaultTimezone, 'UTC'); - $defaultCurrency = Piwik_SitesManager_API::getInstance()->getDefaultCurrency(); - $this->assertEqual($defaultCurrency, 'USD'); - $excludedIps = Piwik_SitesManager_API::getInstance()->getExcludedIpsGlobal(); - $this->assertEqual($excludedIps, ''); - $excludedQueryParameters = Piwik_SitesManager_API::getInstance()->getExcludedQueryParametersGlobal(); - $this->assertEqual($excludedQueryParameters, ''); - - // test that when not specified, defaults are set as expected - $idsite = Piwik_SitesManager_API::getInstance()->addSite("site1",array('http://example.org')); - $site = new Piwik_Site($idsite); - $this->assertEqual($site->getTimezone(), 'UTC'); - $this->assertEqual($site->getCurrency(), 'USD'); - $this->assertEqual($site->getExcludedQueryParameters(), ''); - $this->assertEqual($site->getExcludedIps(), ''); - - // set the global timezone and get it - $newDefaultTimezone = 'UTC+5.5'; - Piwik_SitesManager_API::getInstance()->setDefaultTimezone($newDefaultTimezone); - $defaultTimezone = Piwik_SitesManager_API::getInstance()->getDefaultTimezone(); - $this->assertEqual($defaultTimezone, $newDefaultTimezone); - - // set the default currency and get it - $newDefaultCurrency = 'EUR'; - Piwik_SitesManager_API::getInstance()->setDefaultCurrency($newDefaultCurrency); - $defaultCurrency = Piwik_SitesManager_API::getInstance()->getDefaultCurrency(); - $this->assertEqual($defaultCurrency, $newDefaultCurrency); - - // set the global IPs to exclude and get it - $newGlobalExcludedIps = '1.1.1.*,1.1.*.*,150.1.1.1'; - Piwik_SitesManager_API::getInstance()->setGlobalExcludedIps($newGlobalExcludedIps); - $globalExcludedIps = Piwik_SitesManager_API::getInstance()->getExcludedIpsGlobal(); - $this->assertEqual($globalExcludedIps, $newGlobalExcludedIps); - - // set the global URL query params to exclude and get it - $newGlobalExcludedQueryParameters = 'PHPSESSID,blabla, TesT'; - // removed the space - $expectedGlobalExcludedQueryParameters = 'PHPSESSID,blabla,TesT'; - Piwik_SitesManager_API::getInstance()->setGlobalExcludedQueryParameters($newGlobalExcludedQueryParameters); - $globalExcludedQueryParameters = Piwik_SitesManager_API::getInstance()->getExcludedQueryParametersGlobal(); - $this->assertEqual($globalExcludedQueryParameters, $expectedGlobalExcludedQueryParameters); - - // create a website and check that default currency and default timezone are set - // however, excluded IPs and excluded query Params are not returned - $idsite = Piwik_SitesManager_API::getInstance()->addSite("site1",array('http://example.org'), '', '', $newDefaultTimezone); - $site = new Piwik_Site($idsite); - $this->assertEqual($site->getTimezone(), $newDefaultTimezone); - $this->assertEqual($site->getCreationDate()->toString(), date('Y-m-d')); - $this->assertEqual($site->getCurrency(), $newDefaultCurrency); - $this->assertEqual($site->getExcludedIps(), ''); - $this->assertEqual($site->getExcludedQueryParameters(), ''); - } - - function test_getSitesIdFromSiteUrl_SuperUser() - { - $idsite = Piwik_SitesManager_API::getInstance()->addSite("site1",array("http://piwik.net","http://piwik.com")); - $idsite = Piwik_SitesManager_API::getInstance()->addSite("site2",array("http://piwik.com","http://piwik.net")); - $idsite = Piwik_SitesManager_API::getInstance()->addSite("site3",array("http://piwik.com","http://piwik.org")); - - $idsites = Piwik_SitesManager_API::getInstance()->getSitesIdFromSiteUrl('http://piwik.org'); - $this->assertTrue(count($idsites) == 1); - - $idsites = Piwik_SitesManager_API::getInstance()->getSitesIdFromSiteUrl('http://piwik.net'); - $this->assertTrue(count($idsites) == 2); - - $idsites = Piwik_SitesManager_API::getInstance()->getSitesIdFromSiteUrl('http://piwik.com'); - $this->assertTrue(count($idsites) == 3); - } - - function test_getSitesIdFromSiteUrl_User() - { - $idsite = Piwik_SitesManager_API::getInstance()->addSite("site1",array("http://piwik.net","http://piwik.com")); - $idsite = Piwik_SitesManager_API::getInstance()->addSite("site2",array("http://piwik.com","http://piwik.net")); - $idsite = Piwik_SitesManager_API::getInstance()->addSite("site3",array("http://piwik.com","http://piwik.org")); - - $saveAccess = Zend_Registry::get('access'); - - Piwik_UsersManager_API::getInstance()->addUser("user1", "geqgegagae", "tegst@tesgt.com", "alias"); - Piwik_UsersManager_API::getInstance()->setUserAccess("user1", "view", array(1)); - - Piwik_UsersManager_API::getInstance()->addUser("user2", "geqgegagae", "tegst2@tesgt.com", "alias"); - Piwik_UsersManager_API::getInstance()->setUserAccess("user2", "view", array(1)); - Piwik_UsersManager_API::getInstance()->setUserAccess("user2", "admin", array(3)); - - Piwik_UsersManager_API::getInstance()->addUser("user3", "geqgegagae", "tegst3@tesgt.com", "alias"); - Piwik_UsersManager_API::getInstance()->setUserAccess("user3", "view", array(1,2)); - Piwik_UsersManager_API::getInstance()->setUserAccess("user3", "admin", array(3)); - - $pseudoMockAccess = new FakeAccess; - FakeAccess::$superUser = false; - FakeAccess::$identity = 'user1'; - FakeAccess::setIdSitesView (array(1)); - FakeAccess::setIdSitesAdmin (array()); - Zend_Registry::set('access', $pseudoMockAccess); - $idsites = Piwik_SitesManager_API::getInstance()->getSitesIdFromSiteUrl('http://piwik.com'); - $this->assertTrue(count($idsites) == 1); - - $pseudoMockAccess = new FakeAccess; - FakeAccess::$superUser = false; - FakeAccess::$identity = 'user2'; - FakeAccess::setIdSitesView (array(1)); - FakeAccess::setIdSitesAdmin (array(3)); - Zend_Registry::set('access', $pseudoMockAccess); - $idsites = Piwik_SitesManager_API::getInstance()->getSitesIdFromSiteUrl('http://piwik.com'); - $this->assertTrue(count($idsites) == 2); - - $pseudoMockAccess = new FakeAccess; - FakeAccess::$superUser = false; - FakeAccess::$identity = 'user3'; - FakeAccess::setIdSitesView (array(1,2)); - FakeAccess::setIdSitesAdmin (array(3)); - Zend_Registry::set('access', $pseudoMockAccess); - $idsites = Piwik_SitesManager_API::getInstance()->getSitesIdFromSiteUrl('http://piwik.com'); - $this->assertTrue(count($idsites) == 3); - - Zend_Registry::set('access', $saveAccess); - } } + diff --git a/plugins/UserCountry/API.php b/plugins/UserCountry/API.php index 107c072b3d..3b83786e9a 100644 --- a/plugins/UserCountry/API.php +++ b/plugins/UserCountry/API.php @@ -10,6 +10,9 @@ * @package Piwik_UserCountry */ +// no direct access +defined('PIWIK_INCLUDE_PATH') or die; + /** * @see core/DataFiles/Countries.php * @see plugins/UserCountry/functions.php diff --git a/plugins/UserCountry/UserCountry.php b/plugins/UserCountry/UserCountry.php index f397b0a379..5c502d872d 100644 --- a/plugins/UserCountry/UserCountry.php +++ b/plugins/UserCountry/UserCountry.php @@ -19,10 +19,11 @@ class Piwik_UserCountry extends Piwik_Plugin public function getInformation() { $info = array( - 'description' => Piwik_Translate('UserCountry_PluginDescription'), + 'name' => 'Visitors Country', + 'description' => 'Reports the Country of the visitors.', 'author' => 'Piwik', - 'author_homepage' => 'http://piwik.org/', - 'version' => Piwik_Version::VERSION, + 'homepage' => 'http://piwik.org/', + 'version' => '0.1', ); return $info; } @@ -34,7 +35,6 @@ class Piwik_UserCountry extends Piwik_Plugin 'ArchiveProcessing_Period.compute' => 'archivePeriod', 'WidgetsList.add' => 'addWidgets', 'Menu.add' => 'addMenu', - 'Goals.getAvailableGoalSegments' => 'addGoalSegments', ); return $hooks; } @@ -47,26 +47,7 @@ class Piwik_UserCountry extends Piwik_Plugin function addMenu() { - Piwik_AddMenu('General_Visitors', 'UserCountry_SubmenuLocations', array('module' => 'UserCountry', 'action' => 'index')); - } - - function addGoalSegments( $notification ) - { - $segments =& $notification->getNotificationObject(); - $segments = array_merge($segments, array( - array( - 'group' => Piwik_Translate('UserCountry_Location'), - 'name' => Piwik_Translate('UserCountry_Country'), - 'module' => 'UserCountry', - 'action' => 'getCountry', - ), - array( - 'group' => Piwik_Translate('UserCountry_Location'), - 'name' => Piwik_Translate('UserCountry_Continent'), - 'module' => 'UserCountry', - 'action' => 'getContinent', - ), - )); + Piwik_AddMenu('General_Visitors', 'UserCountry_SubmenuLocations', array('module' => 'UserCountry')); } function archivePeriod( $notification ) diff --git a/plugins/UserSettings/API.php b/plugins/UserSettings/API.php index aab8f3416a..8e3b65c734 100644 --- a/plugins/UserSettings/API.php +++ b/plugins/UserSettings/API.php @@ -10,6 +10,9 @@ * @package Piwik_UserSettings */ +// no direct access +defined('PIWIK_INCLUDE_PATH') or die; + /** * @see plugins/UserSettings/functions.php */ @@ -39,10 +42,8 @@ class Piwik_UserSettings_API $dataTable = $archive->getDataTable($name); $dataTable->filter('Sort', array(Piwik_Archive::INDEX_NB_VISITS)); $dataTable->queueFilter('ReplaceColumnNames'); - $dataTable->queueFilter('ReplaceSummaryRowLabel'); return $dataTable; } - public function getResolution( $idSite, $period, $date ) { $dataTable = $this->getDataTable('UserSettings_resolution', $idSite, $period, $date); diff --git a/plugins/UserSettings/Controller.php b/plugins/UserSettings/Controller.php index ac3a72291e..367ef275d2 100644 --- a/plugins/UserSettings/Controller.php +++ b/plugins/UserSettings/Controller.php @@ -58,7 +58,7 @@ class Piwik_UserSettings_Controller extends Piwik_Controller __FUNCTION__, 'UserSettings.getOS' ); - $view->setColumnTranslation('label', Piwik_Translate('UserSettings_ColumnOperatingSystem')); + $view->setColumnTranslation('label', Piwik_Translate('UserSettings_ColumnOperatinsSystem')); return $this->renderView($view, $fetch); } diff --git a/plugins/UserSettings/UserSettings.php b/plugins/UserSettings/UserSettings.php index bb0c10dddf..66243c7ce6 100644 --- a/plugins/UserSettings/UserSettings.php +++ b/plugins/UserSettings/UserSettings.php @@ -19,21 +19,29 @@ class Piwik_UserSettings extends Piwik_Plugin public function getInformation() { $info = array( - 'description' => Piwik_Translate('UserSettings_PluginDescription'), + 'name' => 'Visitors Settings', + 'description' => 'Reports various User Settings: Browser, Browser Family, Operating System, Plugins, Resolution, Global Settings.', 'author' => 'Piwik', - 'author_homepage' => 'http://piwik.org/', - 'version' => Piwik_Version::VERSION, + 'homepage' => 'http://piwik.org/', + 'version' => '0.1', ); return $info; } + // source: http://en.wikipedia.org/wiki/List_of_web_browsers + static public $browserType = array( + "ie" => array("IE"), + "gecko" => array("NS", "PX", "FF", "FB", "CA", "GA", "KM", "MO", "SM"), + "khtml" => array("SF", "KO", "OW", "CH", "AR"), + "opera" => array("OP") + ); + static public $browserType_display = array( - 'ie' => 'Trident (IE)', - 'gecko' => 'Gecko (Firefox)', - 'khtml' => 'KHTML (Konqueror)', - 'webkit' => 'WebKit (Safari)', - 'opera' => 'Presto (Opera)', + 'ie' => 'Internet Explorer', + 'gecko' => 'Gecko (Mozilla, Netscape)', + 'khtml' => 'KHTML (Safari, Chrome)', + 'opera' => 'Opera', ); function getListHooksRegistered() @@ -60,14 +68,12 @@ class Piwik_UserSettings extends Piwik_Plugin function addMenu() { - Piwik_AddMenu('General_Visitors', 'UserSettings_SubmenuSettings', array('module' => 'UserSettings', 'action' => 'index')); + Piwik_AddMenu('General_Visitors', 'UserSettings_SubmenuSettings', array('module' => 'UserSettings')); } function archiveDay( $notification ) { require_once PIWIK_INCLUDE_PATH . '/plugins/UserSettings/functions.php'; - $maximumRowsInDataTable = Zend_Registry::get('config')->General->datatable_archiving_maximum_rows_standard; - $columnToSortByBeforeTruncation = Piwik_Archive::INDEX_NB_VISITS; $archiveProcessing = $notification->getNotificationObject(); $this->archiveProcessing = $archiveProcessing; @@ -76,21 +82,21 @@ class Piwik_UserSettings extends Piwik_Plugin $labelSQL = "CONCAT(config_os, ';', config_browser_name, ';', config_resolution)"; $interestByConfiguration = $archiveProcessing->getArrayInterestForLabel($labelSQL); $tableConfiguration = $archiveProcessing->getDataTableFromArray($interestByConfiguration); - $archiveProcessing->insertBlobRecord($recordName, $tableConfiguration->getSerialized($maximumRowsInDataTable, null, $columnToSortByBeforeTruncation)); + $archiveProcessing->insertBlobRecord($recordName, $tableConfiguration->getSerialized()); destroy($tableConfiguration); $recordName = 'UserSettings_os'; $labelSQL = "config_os"; $interestByOs = $archiveProcessing->getArrayInterestForLabel($labelSQL); $tableOs = $archiveProcessing->getDataTableFromArray($interestByOs); - $archiveProcessing->insertBlobRecord($recordName, $tableOs->getSerialized($maximumRowsInDataTable, null, $columnToSortByBeforeTruncation)); + $archiveProcessing->insertBlobRecord($recordName, $tableOs->getSerialized()); destroy($tableOs); $recordName = 'UserSettings_browser'; $labelSQL = "CONCAT(config_browser_name, ';', config_browser_version)"; $interestByBrowser = $archiveProcessing->getArrayInterestForLabel($labelSQL); $tableBrowser = $archiveProcessing->getDataTableFromArray($interestByBrowser); - $archiveProcessing->insertBlobRecord($recordName, $tableBrowser->getSerialized($maximumRowsInDataTable, null, $columnToSortByBeforeTruncation)); + $archiveProcessing->insertBlobRecord($recordName, $tableBrowser->getSerialized()); $recordName = 'UserSettings_browserType'; $tableBrowserType = $this->getTableBrowserByType($tableBrowser); @@ -103,7 +109,7 @@ class Piwik_UserSettings extends Piwik_Plugin $interestByResolution = $archiveProcessing->getArrayInterestForLabel($labelSQL); $tableResolution = $archiveProcessing->getDataTableFromArray($interestByResolution); $tableResolution->filter('ColumnCallbackDeleteRow', array('label', 'Piwik_UserSettings_keepStrlenGreater')); - $archiveProcessing->insertBlobRecord($recordName, $tableResolution->getSerialized($maximumRowsInDataTable, null, $columnToSortByBeforeTruncation)); + $archiveProcessing->insertBlobRecord($recordName, $tableResolution->getSerialized()); $recordName = 'UserSettings_wideScreen'; $tableWideScreen = $this->getTableWideScreen($tableResolution); @@ -120,7 +126,6 @@ class Piwik_UserSettings extends Piwik_Plugin function archivePeriod( $notification ) { $archiveProcessing = $notification->getNotificationObject(); - $maximumRowsInDataTable = Zend_Registry::get('config')->General->datatable_archiving_maximum_rows_standard; $dataTableToSum = array( 'UserSettings_configuration', @@ -132,7 +137,7 @@ class Piwik_UserSettings extends Piwik_Plugin 'UserSettings_plugin', ); - $archiveProcessing->archiveDataTable($dataTableToSum, null, $maximumRowsInDataTable); + $archiveProcessing->archiveDataTable($dataTableToSum); } protected function getTableWideScreen($tableResolution) diff --git a/plugins/UserSettings/functions.php b/plugins/UserSettings/functions.php index c2aebe7b64..95d19e4817 100644 --- a/plugins/UserSettings/functions.php +++ b/plugins/UserSettings/functions.php @@ -10,6 +10,9 @@ * @package Piwik_UserSettings */ +// no direct access +defined('PIWIK_INCLUDE_PATH') or die; + /** * @see libs/UserAgentParser/UserAgentParser.php */ @@ -29,7 +32,7 @@ function Piwik_getOSLabel($osId) } if( $osId == 'UNK') { - return html_entity_decode(Piwik_Translate('General_Unknown'), ENT_COMPAT, 'UTF-8'); + return Piwik_Translate('General_Unknown'); } return $osId; } @@ -43,7 +46,7 @@ function Piwik_getOSShortLabel($osId) } if( $osId == 'UNK') { - return html_entity_decode(Piwik_Translate('General_Unknown'), ENT_COMPAT, 'UTF-8'); + return Piwik_Translate('General_Unknown'); } return $osId; } @@ -56,7 +59,7 @@ function Piwik_getBrowserTypeLabel($oldLabel) } if($oldLabel == 'unknown') { - return html_entity_decode(Piwik_Translate('General_Unknown'), ENT_COMPAT, 'UTF-8'); + return Piwik_Translate('General_Unknown'); } return $oldLabel; } @@ -75,7 +78,7 @@ function Piwik_getConfigurationLabel($str) $browser = UserAgentParser::getBrowserNameFromId($name); if($browser === false) { - $browser = html_entity_decode(Piwik_Translate('General_Unknown'), ENT_COMPAT, 'UTF-8'); + $browser = Piwik_Translate('General_Unknown'); } $resolution = $values[2]; return $os . " / " . $browser . " / " . $resolution; @@ -92,7 +95,7 @@ function Piwik_getBrowserLabel($oldLabel) } if( $browserId == 'UNK') { - return html_entity_decode(Piwik_Translate('General_Unknown'), ENT_COMPAT, 'UTF-8'); + return Piwik_Translate('General_Unknown'); } return $oldLabel; } @@ -108,7 +111,7 @@ function Piwik_getBrowserShortLabel($oldLabel) } if( $browserId == 'UNK') { - return html_entity_decode(Piwik_Translate('General_Unknown'), ENT_COMPAT, 'UTF-8'); + return Piwik_Translate('General_Unknown'); } return $oldLabel; } @@ -126,19 +129,11 @@ function Piwik_getBrowserVersion($str) function Piwik_getBrowsersLogo($label) { $id = Piwik_getBrowserId($label); - // For aggregated row 'Others' - if(empty($id)) { - $id = 'UNK'; - } return 'plugins/UserSettings/images/browsers/'. $id . '.gif'; } function Piwik_getOSLogo($label) { - // For aggregated row 'Others' - if(empty($label)) { - $label = 'UNK'; - } $path = 'plugins/UserSettings/images/os/'. $label . '.gif'; return $path; } @@ -176,6 +171,14 @@ function Piwik_getScreenTypeFromResolution($resolution) function Piwik_getBrowserFamily($browserLabel) { - $familyNameToUse = UserAgentParser::getBrowserFamilyFromId(substr($browserLabel, 0, 2)); + $familyNameToUse = 'unknown'; + foreach(Piwik_UserSettings::$browserType as $familyName => $aBrowsers) + { + if(in_array(substr($browserLabel, 0, 2), $aBrowsers)) + { + $familyNameToUse = $familyName; + break; + } + } return $familyNameToUse; -} +} diff --git a/plugins/UserSettings/images/browsers/AB.gif b/plugins/UserSettings/images/browsers/AB.gif Binary files differdeleted file mode 100644 index cd651565b1..0000000000 --- a/plugins/UserSettings/images/browsers/AB.gif +++ /dev/null diff --git a/plugins/UserSettings/images/browsers/AN.gif b/plugins/UserSettings/images/browsers/AN.gif Binary files differdeleted file mode 100644 index 9c69167f2f..0000000000 --- a/plugins/UserSettings/images/browsers/AN.gif +++ /dev/null diff --git a/plugins/UserSettings/images/browsers/BE.gif b/plugins/UserSettings/images/browsers/BE.gif Binary files differdeleted file mode 100644 index 2e952f5c2c..0000000000 --- a/plugins/UserSettings/images/browsers/BE.gif +++ /dev/null diff --git a/plugins/UserSettings/images/browsers/BX.gif b/plugins/UserSettings/images/browsers/BX.gif Binary files differindex a34ba48408..73053607b7 100644 --- a/plugins/UserSettings/images/browsers/BX.gif +++ b/plugins/UserSettings/images/browsers/BX.gif diff --git a/plugins/UserSettings/images/browsers/CO.gif b/plugins/UserSettings/images/browsers/CO.gif Binary files differdeleted file mode 100644 index 462c7f6e6c..0000000000 --- a/plugins/UserSettings/images/browsers/CO.gif +++ /dev/null diff --git a/plugins/UserSettings/images/browsers/CS.gif b/plugins/UserSettings/images/browsers/CS.gif Binary files differdeleted file mode 100644 index 9078936525..0000000000 --- a/plugins/UserSettings/images/browsers/CS.gif +++ /dev/null diff --git a/plugins/UserSettings/images/browsers/DI.gif b/plugins/UserSettings/images/browsers/DI.gif Binary files differindex 0ae8bbcdb0..73053607b7 100644 --- a/plugins/UserSettings/images/browsers/DI.gif +++ b/plugins/UserSettings/images/browsers/DI.gif diff --git a/plugins/UserSettings/images/browsers/EL.gif b/plugins/UserSettings/images/browsers/EL.gif Binary files differdeleted file mode 100644 index 92de33e4ab..0000000000 --- a/plugins/UserSettings/images/browsers/EL.gif +++ /dev/null diff --git a/plugins/UserSettings/images/browsers/EP.gif b/plugins/UserSettings/images/browsers/EP.gif Binary files differdeleted file mode 100644 index 647095ec78..0000000000 --- a/plugins/UserSettings/images/browsers/EP.gif +++ /dev/null diff --git a/plugins/UserSettings/images/browsers/FD.gif b/plugins/UserSettings/images/browsers/FD.gif Binary files differdeleted file mode 100644 index e39e41ca22..0000000000 --- a/plugins/UserSettings/images/browsers/FD.gif +++ /dev/null diff --git a/plugins/UserSettings/images/browsers/FE.gif b/plugins/UserSettings/images/browsers/FE.gif Binary files differdeleted file mode 100644 index d9c6c9edac..0000000000 --- a/plugins/UserSettings/images/browsers/FE.gif +++ /dev/null diff --git a/plugins/UserSettings/images/browsers/FL.gif b/plugins/UserSettings/images/browsers/FL.gif Binary files differdeleted file mode 100644 index c52999e4ac..0000000000 --- a/plugins/UserSettings/images/browsers/FL.gif +++ /dev/null diff --git a/plugins/UserSettings/images/browsers/GE.gif b/plugins/UserSettings/images/browsers/GE.gif Binary files differdeleted file mode 100644 index 3401b729d3..0000000000 --- a/plugins/UserSettings/images/browsers/GE.gif +++ /dev/null diff --git a/plugins/UserSettings/images/browsers/HA.gif b/plugins/UserSettings/images/browsers/HA.gif Binary files differdeleted file mode 100644 index 7c87ca4f36..0000000000 --- a/plugins/UserSettings/images/browsers/HA.gif +++ /dev/null diff --git a/plugins/UserSettings/images/browsers/KP.gif b/plugins/UserSettings/images/browsers/KP.gif Binary files differdeleted file mode 100644 index 58258f12fc..0000000000 --- a/plugins/UserSettings/images/browsers/KP.gif +++ /dev/null diff --git a/plugins/UserSettings/images/browsers/KZ.gif b/plugins/UserSettings/images/browsers/KZ.gif Binary files differdeleted file mode 100644 index 3042cc80f5..0000000000 --- a/plugins/UserSettings/images/browsers/KZ.gif +++ /dev/null diff --git a/plugins/UserSettings/images/browsers/MI.gif b/plugins/UserSettings/images/browsers/MI.gif Binary files differdeleted file mode 100644 index 0688fffc23..0000000000 --- a/plugins/UserSettings/images/browsers/MI.gif +++ /dev/null diff --git a/plugins/UserSettings/images/browsers/WO.gif b/plugins/UserSettings/images/browsers/WO.gif Binary files differdeleted file mode 100644 index fd0debbd8c..0000000000 --- a/plugins/UserSettings/images/browsers/WO.gif +++ /dev/null diff --git a/plugins/UserSettings/images/browsers/WP.gif b/plugins/UserSettings/images/browsers/WP.gif Binary files differdeleted file mode 100644 index 22cd2a5adf..0000000000 --- a/plugins/UserSettings/images/browsers/WP.gif +++ /dev/null diff --git a/plugins/UserSettings/images/os/AIX.gif b/plugins/UserSettings/images/os/AIX.gif Binary files differindex 9a663f2be6..90581d1377 100644 --- a/plugins/UserSettings/images/os/AIX.gif +++ b/plugins/UserSettings/images/os/AIX.gif diff --git a/plugins/UserSettings/images/os/AMI.gif b/plugins/UserSettings/images/os/AMI.gif Binary files differdeleted file mode 100644 index 2b28a93a64..0000000000 --- a/plugins/UserSettings/images/os/AMI.gif +++ /dev/null diff --git a/plugins/UserSettings/images/os/BEO.gif b/plugins/UserSettings/images/os/BEO.gif Binary files differdeleted file mode 100644 index f38d8b90e3..0000000000 --- a/plugins/UserSettings/images/os/BEO.gif +++ /dev/null diff --git a/plugins/UserSettings/images/os/BSD.gif b/plugins/UserSettings/images/os/BSD.gif Binary files differindex 326d33d8de..c09e375398 100644 --- a/plugins/UserSettings/images/os/BSD.gif +++ b/plugins/UserSettings/images/os/BSD.gif diff --git a/plugins/UserSettings/images/os/DFB.gif b/plugins/UserSettings/images/os/DFB.gif Binary files differdeleted file mode 100644 index 6935e91a80..0000000000 --- a/plugins/UserSettings/images/os/DFB.gif +++ /dev/null diff --git a/plugins/UserSettings/images/os/DSI.gif b/plugins/UserSettings/images/os/DSI.gif Binary files differdeleted file mode 100644 index 6fb563dfa5..0000000000 --- a/plugins/UserSettings/images/os/DSI.gif +++ /dev/null diff --git a/plugins/UserSettings/images/os/HPX.gif b/plugins/UserSettings/images/os/HPX.gif Binary files differindex 062ec181a9..37a836180b 100644 --- a/plugins/UserSettings/images/os/HPX.gif +++ b/plugins/UserSettings/images/os/HPX.gif diff --git a/plugins/UserSettings/images/os/IPA.gif b/plugins/UserSettings/images/os/IPA.gif Binary files differdeleted file mode 100644 index 4e9113fac4..0000000000 --- a/plugins/UserSettings/images/os/IPA.gif +++ /dev/null diff --git a/plugins/UserSettings/images/os/IPH.gif b/plugins/UserSettings/images/os/IPH.gif Binary files differindex 82e583558d..dae428be44 100644 --- a/plugins/UserSettings/images/os/IPH.gif +++ b/plugins/UserSettings/images/os/IPH.gif diff --git a/plugins/UserSettings/images/os/IRI.gif b/plugins/UserSettings/images/os/IRI.gif Binary files differindex 65dd44a9aa..f615f25cf0 100644 --- a/plugins/UserSettings/images/os/IRI.gif +++ b/plugins/UserSettings/images/os/IRI.gif diff --git a/plugins/UserSettings/images/os/LIN.gif b/plugins/UserSettings/images/os/LIN.gif Binary files differindex 12e3888175..2ef898de04 100644 --- a/plugins/UserSettings/images/os/LIN.gif +++ b/plugins/UserSettings/images/os/LIN.gif diff --git a/plugins/UserSettings/images/os/MAC.gif b/plugins/UserSettings/images/os/MAC.gif Binary files differindex 73b2d9cac5..d6af9e1d57 100644 --- a/plugins/UserSettings/images/os/MAC.gif +++ b/plugins/UserSettings/images/os/MAC.gif diff --git a/plugins/UserSettings/images/os/NBS.gif b/plugins/UserSettings/images/os/NBS.gif Binary files differindex 33e6749cf0..c09e375398 100644 --- a/plugins/UserSettings/images/os/NBS.gif +++ b/plugins/UserSettings/images/os/NBS.gif diff --git a/plugins/UserSettings/images/os/NDS.gif b/plugins/UserSettings/images/os/NDS.gif Binary files differdeleted file mode 100644 index fe731351e4..0000000000 --- a/plugins/UserSettings/images/os/NDS.gif +++ /dev/null diff --git a/plugins/UserSettings/images/os/OBS.gif b/plugins/UserSettings/images/os/OBS.gif Binary files differdeleted file mode 100644 index 01c1b07a98..0000000000 --- a/plugins/UserSettings/images/os/OBS.gif +++ /dev/null diff --git a/plugins/UserSettings/images/os/OS2.gif b/plugins/UserSettings/images/os/OS2.gif Binary files differindex 4ec088d1b9..90fbdab26c 100644 --- a/plugins/UserSettings/images/os/OS2.gif +++ b/plugins/UserSettings/images/os/OS2.gif diff --git a/plugins/UserSettings/images/os/POS.gif b/plugins/UserSettings/images/os/POS.gif Binary files differdeleted file mode 100644 index 49e089ef24..0000000000 --- a/plugins/UserSettings/images/os/POS.gif +++ /dev/null diff --git a/plugins/UserSettings/images/os/SOS.gif b/plugins/UserSettings/images/os/SOS.gif Binary files differindex 9d17c20246..f4a97e87f2 100644 --- a/plugins/UserSettings/images/os/SOS.gif +++ b/plugins/UserSettings/images/os/SOS.gif diff --git a/plugins/UserSettings/images/os/SYL.gif b/plugins/UserSettings/images/os/SYL.gif Binary files differdeleted file mode 100644 index c6e1f25687..0000000000 --- a/plugins/UserSettings/images/os/SYL.gif +++ /dev/null diff --git a/plugins/UserSettings/images/os/T64.gif b/plugins/UserSettings/images/os/T64.gif Binary files differdeleted file mode 100644 index 3255046dc6..0000000000 --- a/plugins/UserSettings/images/os/T64.gif +++ /dev/null diff --git a/plugins/UserSettings/images/os/UNK.gif b/plugins/UserSettings/images/os/UNK.gif Binary files differindex ec7aa05e07..6de56a753a 100644 --- a/plugins/UserSettings/images/os/UNK.gif +++ b/plugins/UserSettings/images/os/UNK.gif diff --git a/plugins/UserSettings/images/os/W2K.gif b/plugins/UserSettings/images/os/W2K.gif Binary files differindex 404eeabc72..19d75be8c8 100644 --- a/plugins/UserSettings/images/os/W2K.gif +++ b/plugins/UserSettings/images/os/W2K.gif diff --git a/plugins/UserSettings/images/os/W95.gif b/plugins/UserSettings/images/os/W95.gif Binary files differindex 404eeabc72..19d75be8c8 100644 --- a/plugins/UserSettings/images/os/W95.gif +++ b/plugins/UserSettings/images/os/W95.gif diff --git a/plugins/UserSettings/images/os/W98.gif b/plugins/UserSettings/images/os/W98.gif Binary files differindex 404eeabc72..19d75be8c8 100644 --- a/plugins/UserSettings/images/os/W98.gif +++ b/plugins/UserSettings/images/os/W98.gif diff --git a/plugins/UserSettings/images/os/WI7.gif b/plugins/UserSettings/images/os/WI7.gif Binary files differindex d782a6d42d..a91e528b5c 100644 --- a/plugins/UserSettings/images/os/WI7.gif +++ b/plugins/UserSettings/images/os/WI7.gif diff --git a/plugins/UserSettings/images/os/WME.gif b/plugins/UserSettings/images/os/WME.gif Binary files differindex 404eeabc72..19d75be8c8 100644 --- a/plugins/UserSettings/images/os/WME.gif +++ b/plugins/UserSettings/images/os/WME.gif diff --git a/plugins/UserSettings/images/os/WNT.gif b/plugins/UserSettings/images/os/WNT.gif Binary files differindex 404eeabc72..19d75be8c8 100644 --- a/plugins/UserSettings/images/os/WNT.gif +++ b/plugins/UserSettings/images/os/WNT.gif diff --git a/plugins/UserSettings/images/os/WOS.gif b/plugins/UserSettings/images/os/WOS.gif Binary files differdeleted file mode 100644 index 60dcc17d6a..0000000000 --- a/plugins/UserSettings/images/os/WOS.gif +++ /dev/null diff --git a/plugins/UserSettings/images/os/WS3.gif b/plugins/UserSettings/images/os/WS3.gif Binary files differindex d782a6d42d..a91e528b5c 100644 --- a/plugins/UserSettings/images/os/WS3.gif +++ b/plugins/UserSettings/images/os/WS3.gif diff --git a/plugins/UserSettings/images/os/WVI.gif b/plugins/UserSettings/images/os/WVI.gif Binary files differindex d782a6d42d..a91e528b5c 100644 --- a/plugins/UserSettings/images/os/WVI.gif +++ b/plugins/UserSettings/images/os/WVI.gif diff --git a/plugins/UserSettings/images/os/WXP.gif b/plugins/UserSettings/images/os/WXP.gif Binary files differindex d782a6d42d..a91e528b5c 100644 --- a/plugins/UserSettings/images/os/WXP.gif +++ b/plugins/UserSettings/images/os/WXP.gif diff --git a/plugins/UserSettings/images/plugins/cookie.gif b/plugins/UserSettings/images/plugins/cookie.gif Binary files differindex 7e5f561527..1a518e122c 100644 --- a/plugins/UserSettings/images/plugins/cookie.gif +++ b/plugins/UserSettings/images/plugins/cookie.gif diff --git a/plugins/UserSettings/images/plugins/director.gif b/plugins/UserSettings/images/plugins/director.gif Binary files differindex d40a752044..4d6de84f5e 100644 --- a/plugins/UserSettings/images/plugins/director.gif +++ b/plugins/UserSettings/images/plugins/director.gif diff --git a/plugins/UserSettings/images/plugins/flash.gif b/plugins/UserSettings/images/plugins/flash.gif Binary files differindex d144c55b8d..1388f67da0 100644 --- a/plugins/UserSettings/images/plugins/flash.gif +++ b/plugins/UserSettings/images/plugins/flash.gif diff --git a/plugins/UserSettings/images/plugins/gears.gif b/plugins/UserSettings/images/plugins/gears.gif Binary files differindex ea5f0dd3f8..d721ed7840 100644 --- a/plugins/UserSettings/images/plugins/gears.gif +++ b/plugins/UserSettings/images/plugins/gears.gif diff --git a/plugins/UserSettings/images/plugins/java.gif b/plugins/UserSettings/images/plugins/java.gif Binary files differindex 0aae25f993..2525255334 100644 --- a/plugins/UserSettings/images/plugins/java.gif +++ b/plugins/UserSettings/images/plugins/java.gif diff --git a/plugins/UserSettings/images/plugins/pdf.gif b/plugins/UserSettings/images/plugins/pdf.gif Binary files differindex ac908f408f..41ae83e801 100644 --- a/plugins/UserSettings/images/plugins/pdf.gif +++ b/plugins/UserSettings/images/plugins/pdf.gif diff --git a/plugins/UserSettings/images/plugins/quicktime.gif b/plugins/UserSettings/images/plugins/quicktime.gif Binary files differindex 4822161249..144f9f60a3 100644 --- a/plugins/UserSettings/images/plugins/quicktime.gif +++ b/plugins/UserSettings/images/plugins/quicktime.gif diff --git a/plugins/UserSettings/images/plugins/realplayer.gif b/plugins/UserSettings/images/plugins/realplayer.gif Binary files differindex 6078f1a427..1e32d9632f 100644 --- a/plugins/UserSettings/images/plugins/realplayer.gif +++ b/plugins/UserSettings/images/plugins/realplayer.gif diff --git a/plugins/UserSettings/images/plugins/silverlight.gif b/plugins/UserSettings/images/plugins/silverlight.gif Binary files differindex 227f132254..d25ee0a23c 100644 --- a/plugins/UserSettings/images/plugins/silverlight.gif +++ b/plugins/UserSettings/images/plugins/silverlight.gif diff --git a/plugins/UserSettings/images/plugins/windowsmedia.gif b/plugins/UserSettings/images/plugins/windowsmedia.gif Binary files differindex 04f816250d..99a4318f29 100644 --- a/plugins/UserSettings/images/plugins/windowsmedia.gif +++ b/plugins/UserSettings/images/plugins/windowsmedia.gif diff --git a/plugins/UserSettings/images/screens/dual.gif b/plugins/UserSettings/images/screens/dual.gif Binary files differindex 5cdbbae22e..c54b5473c1 100644 --- a/plugins/UserSettings/images/screens/dual.gif +++ b/plugins/UserSettings/images/screens/dual.gif diff --git a/plugins/UserSettings/images/screens/normal.gif b/plugins/UserSettings/images/screens/normal.gif Binary files differindex 1c5c39976e..7ffecc304c 100644 --- a/plugins/UserSettings/images/screens/normal.gif +++ b/plugins/UserSettings/images/screens/normal.gif diff --git a/plugins/UserSettings/images/screens/wide.gif b/plugins/UserSettings/images/screens/wide.gif Binary files differindex 6b726d55c1..36ff560b50 100644 --- a/plugins/UserSettings/images/screens/wide.gif +++ b/plugins/UserSettings/images/screens/wide.gif diff --git a/plugins/UserSettings/templates/index.tpl b/plugins/UserSettings/templates/index.tpl index 35c0e4b51a..91400a6e7c 100644 --- a/plugins/UserSettings/templates/index.tpl +++ b/plugins/UserSettings/templates/index.tpl @@ -13,7 +13,7 @@ <h2>{'UserSettings_Configurations'|translate}</h2> {$dataTableConfiguration} - <h2>{'UserSettings_OperatingSystems'|translate}</h2> + <h2>{'UserSettings_OperatinsSystems'|translate}</h2> {$dataTableOS} <h2>{'UserSettings_Resolutions'|translate}</h2> diff --git a/plugins/UserSettings/tests/UserSettings.test.php b/plugins/UserSettings/tests/UserSettings.test.php deleted file mode 100644 index e9e8f00378..0000000000 --- a/plugins/UserSettings/tests/UserSettings.test.php +++ /dev/null @@ -1,800 +0,0 @@ -<?php -if(!defined("PIWIK_PATH_TEST_TO_ROOT")) { - define('PIWIK_PATH_TEST_TO_ROOT', getcwd().'/../../..'); -} -if(!defined('PIWIK_CONFIG_TEST_INCLUDED')) -{ - require_once PIWIK_PATH_TEST_TO_ROOT . "/tests/config_test.php"; -} - -if(!class_exists('Piwik_UserSettings', false)) -{ - require_once 'UserSettings/UserSettings.php'; -} -require 'UserSettings/functions.php'; - -class Test_Piwik_UserSettings extends UnitTestCase -{ - // User agent strings and expected parser results - protected $userAgents = array( - // 'User Agent String' => array( - // array( browser_id, name, short_name, version, major_number, minor_number, family ), - // array( os_id, name, short_name )), - - // ABrowse - 'Mozilla/5.0 (compatible; U; ABrowse 0.6; Syllable) AppleWebKit/420+ (KHTML, like Gecko)' => array( - array('AB', 'ABrowse', 'ABrowse', '0.6', '0', '6', 'webkit'), - array('SYL', 'Syllable', 'Syllable')), - 'Mozilla/5.0 (compatible; ABrowse 0.4; Syllable)' => array( - array('AB', 'ABrowse', 'ABrowse', '0.4', '0', '4', 'webkit'), - array('SYL', 'Syllable', 'Syllable')), - - // Acoo Browser (treat as IE) - 'Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; GTB6; Acoo Browser; .NET CLR 1.1.4322; .NET CLR 2.0.50727)' => array( - array('IE', 'Internet Explorer', 'IE', '8.0', '8', '0', 'ie'), - array('WXP', 'Windows XP', 'Win XP')), - 'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; Acoo Browser; .NET CLR 2.0.50727; .NET CLR 1.1.4322)' => array( - array('IE', 'Internet Explorer', 'IE', '7.0', '7', '0', 'ie'), - array('WXP', 'Windows XP', 'Win XP')), - 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; Acoo Browser; .NET CLR 1.1.4322; .NET CLR 2.0.50727)' => array( - array('IE', 'Internet Explorer', 'IE', '6.0', '6', '0', 'ie'), - array('WXP', 'Windows XP', 'Win XP')), - - // Amaya - 'amaya/9.52 libwww/5.4.0' => array( - array('AM', 'Amaya', 'Amaya', '9.52', '9', '52', 'unknown'), - false), - - // AmigaVoyager - 'AmigaVoyager/3.2 (AmigaOS/MC680x0)' => array( - array('AV', 'AmigaVoyager', 'AmigaVoyager', '3.2', '3', '2', 'unknown'), - array('AMI', 'AmigaOS', 'AmigaOS')), - 'AmigaVoyager/2.95 (compatible; MC680x0; AmigaOS; SV1)' => array( - array('AV', 'AmigaVoyager', 'AmigaVoyager', '2.95', '2', '95', 'unknown'), - array('AMI', 'AmigaOS', 'AmigaOS')), - 'AmigaVoyager/2.95 (compatible; MC680x0; AmigaOS)' => array( - array('AV', 'AmigaVoyager', 'AmigaVoyager', '2.95', '2', '95', 'unknown'), - array('AMI', 'AmigaOS', 'AmigaOS')), - - // Android - 'Mozilla/5.0 (Linux; U; Android 1.1; en-us; dream) AppleWebKit/525.10+ (KHTML, like Gecko) Version/3.0.4 Mobile Safari/523.12.2' => array( - array('AN', 'Android', 'Android', '3.0', '3', '0', 'webkit'), - array('AND', 'Android', 'Android')), - - // AOL / America Online Browser (treat as IE) - 'Mozilla/4.0 (compatible; MSIE 7.0; AOL 9.5; AOLBuild 4337.43; Windows NT 5.1; .NET CLR 1.1.4322)' => array( - array('IE', 'Internet Explorer', 'IE', '7.0', '7', '0', 'ie'), - array('WXP', 'Windows XP', 'Win XP')), - 'Mozilla/4.0 (compatible; MSIE 7.0; AOL 9.1; AOLBuild 4334.5009; Windows NT 5.1; GTB5; .NET CLR 1.1.4322)' => array( - array('IE', 'Internet Explorer', 'IE', '7.0', '7', '0', 'ie'), - array('WXP', 'Windows XP', 'Win XP')), - 'Mozilla/4.0 (compatible; MSIE 7.0; AOL 9.0; Windows NT 5.1; InfoPath.1)' => array( - array('IE', 'Internet Explorer', 'IE', '7.0', '7', '0', 'ie'), - array('WXP', 'Windows XP', 'Win XP')), - 'Mozilla/4.0 (compatible; MSIE 6.0; AOL 8.0; Windows NT 5.1; SV1)' => array( - array('IE', 'Internet Explorer', 'IE', '6.0', '6', '0', 'ie'), - array('WXP', 'Windows XP', 'Win XP')), - 'Mozilla/4.0 (compatible; MSIE 7.0; AOL 7.0; Windows NT 5.1)' => array( - array('IE', 'Internet Explorer', 'IE', '7.0', '7', '0', 'ie'), - array('WXP', 'Windows XP', 'Win XP')), - 'Mozilla/4.0 (compatible; MSIE 5.5; AOL 6.0; Windows 98; Win 9x 4.90)' => array( - array('IE', 'Internet Explorer', 'IE', '5.5', '5', '5', 'ie'), - array('WME', 'Windows Me', 'Win Me')), - 'Mozilla/4.0 (compatible; MSIE 5.5; AOL 5.0; Windows NT 5.0)' => array( - array('IE', 'Internet Explorer', 'IE', '5.5', '5', '5', 'ie'), - array('W2K', 'Windows 2000', 'Win 2000')), - 'Mozilla/4.0 (compatible; MSIE 4.01; AOL 4.0; Windows 95)' => array( - array('IE', 'Internet Explorer', 'IE', '4.01', '4', '01', 'ie'), - array('W95', 'Windows 95', 'Win 95')), - 'Mozilla/4.0 (compatible; MSIE 7.0; America Online Browser 1.1; Windows NT 5.1; (R1 1.5); .NET CLR 2.0.50727; InfoPath.1)' => array( - array('IE', 'Internet Explorer', 'IE', '7.0', '7', '0', 'ie'), - array('WXP', 'Windows XP', 'Win XP')), - 'Mozilla/4.0 (compatible; MSIE 6.0; America Online Browser 1.1; Windows 98)' => array( - array('IE', 'Internet Explorer', 'IE', '6.0', '6', '0', 'ie'), - array('W98', 'Windows 98', 'Win 98')), - - // Arora - 'Mozilla/5.0 (X11; U; Linux; de-DE) AppleWebKit/527+ (KHTML, like Gecko, Safari/419.3) Arora/0.8.0' => array( - array('AR', 'Arora', 'Arora', '0.8', '0', '8', 'webkit'), - array('LIN', 'Linux', 'Linux')), - 'Mozilla/5.0 (X11; U; Linux; en-US) AppleWebKit/527+ (KHTML, like Gecko, Safari/419.3) Arora/0.6' => array( - array('AR', 'Arora', 'Arora', '0.6', '0', '6', 'webkit'), - array('LIN', 'Linux', 'Linux')), - 'Mozilla/5.0 (Windows; U; Windows NT 5.2; pt-BR) AppleWebKit/527+ (KHTML, like Gecko, Safari/419.3) Arora/0.4 (Change: )' => array( - array('AR', 'Arora', 'Arora', '0.4', '0', '4', 'webkit'), - array('WS3', 'Windows Server 2003 / XP x64', 'Win S2003')), - 'Mozilla/5.0 (Windows; U; Windows NT 5.1; zh-CN) AppleWebKit/523.15 (KHTML, like Gecko, Safari/419.3) Arora/0.3 (Change: 287 c9dfb30)' => array( - array('AR', 'Arora', 'Arora', '0.3', '0', '3', 'webkit'), - array('WXP', 'Windows XP', 'Win XP')), - 'Mozilla/5.0 (X11; U; Linux; en-US) AppleWebKit/523.15 (KHTML, like Gecko, Safari/419.3) Arora/0.2 (Change: 189 35c14e0)' => array( - array('AR', 'Arora', 'Arora', '0.2', '0', '2', 'webkit'), - array('LIN', 'Linux', 'Linux')), - - // Avant (treat as IE) - 'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; Avant Browser; .NET CLR 2.0.50727; MAXTHON 2.0)' => array( - array('IE', 'Internet Explorer', 'IE', '7.0', '7', '0', 'ie'), - array('WXP', 'Windows XP', 'Win XP')), - 'Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0; Avant Browser; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0)' => array( - array('IE', 'Internet Explorer', 'IE', '8.0', '8', '0', 'ie'), - array('WI7', 'Windows 7', 'Win 7')), - - // AWeb - 'Amiga-AWeb/3.5.07 beta' => array( - array('AW', 'Amiga AWeb', 'AWeb', '3.5', '3', '5', 'unknown'), - array('AMI', 'AmigaOS', 'AmigaOS')), - 'Mozilla/6.0; (Spoofed by Amiga-AWeb/3.5.07 beta)' => array( - array('AW', 'Amiga AWeb', 'AWeb', '3.5', '3', '5', 'unknown'), - array('AMI', 'AmigaOS', 'AmigaOS')), - 'MSIE/6.0; (Spoofed by Amiga-AWeb/3.4APL)' => array( - array('AW', 'Amiga AWeb', 'AWeb', '3.4', '3', '4', 'unknown'), - array('AMI', 'AmigaOS', 'AmigaOS')), - - // Beonex - 'Mozilla/5.0 (Windows; U; WinNT; en; rv:1.0.2) Gecko/20030311 Beonex/0.8.2-stable' => array( - array('BE', 'Beonex', 'Beonex', '0.8', '0', '8', 'unknown'), - array('WNT', 'Windows NT', 'Win NT')), - 'Mozilla/5.0 (Windows; U; WinNT; en; Preview) Gecko/20020603 Beonex/0.8-stable' => array( - array('BE', 'Beonex', 'Beonex', '0.8', '0', '8', 'unknown'), - array('WNT', 'Windows NT', 'Win NT')), - - // BlackBerry - 'BlackBerry8700/4.1.0 Profile/MIDP-2.0 Configuration/CLDC-1.1' => array( - array('BB', 'BlackBerry', 'BlackBerry', '8700.0', '8700', '0', 'unknown'), - array('BLB', 'BlackBerry', 'BlackBerry')), - - // BrowseX - 'Mozilla/4.61 [en] (X11; U; ) - BrowseX (2.0.0 Windows)' => array( - array('BX', 'BrowseX', 'BrowseX', '2.0', '2', '0', 'unknown'), - false), - - // Camino (formerly known as Chimera; not to be confused with another browser also named Chimera) - 'Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en; rv:1.9.0.8pre) Gecko/2009022800 Camino/2.0b3pre' => array( - array('CA', 'Camino', 'Camino', '2.0', '2', '0', 'gecko'), - array('MAC', 'Mac OS', 'Mac OS')), - 'Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en; rv:1.9.0.10pre) Gecko/2009041800 Camino/2.0b3pre (like Firefox/3.0.10pre)' => array( - array('CA', 'Camino', 'Camino', '2.0', '2', '0', 'gecko'), - array('MAC', 'Mac OS', 'Mac OS')), - 'Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en; rv:1.8.1.4pre) Gecko/20070511 Camino/1.6pre' => array( - array('CA', 'Camino', 'Camino', '1.6', '1', '6', 'gecko'), - array('MAC', 'Mac OS', 'Mac OS')), - 'Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en; rv:1.8.1.6) Gecko/20070809 Firefox/2.0.0.6 Camino/1.5.1' => array( - array('CA', 'Camino', 'Camino', '1.5', '1', '5', 'gecko'), - array('MAC', 'Mac OS', 'Mac OS')), - 'Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.0.1) Gecko/20030306 Camino/0.7' => array( - array('CA', 'Camino', 'Camino', '0.7', '0', '7', 'gecko'), - array('MAC', 'Mac OS', 'Mac OS')), - 'Mozilla/5.0 (Macintosh; U; PPC Mac OS X; pl-PL; rv:1.0.1) Gecko/20021111 Chimera/0.6' => array( - array('CA', 'Camino', 'Camino', '0.6', '0', '6', 'gecko'), - array('MAC', 'Mac OS', 'Mac OS')), - - // Cheshire - 'Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en) AppleWebKit/418.8 (KHTML, like Gecko, Safari) Cheshire/1.0.UNOFFICIAL' => array( - array('CS', 'Cheshire', 'Cheshire', '1.0', '1', '0', 'webkit'), - array('MAC', 'Mac OS', 'Mac OS')), - 'Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en) AppleWebKit/419 (KHTML, like Gecko, Safari/419.3) Cheshire/1.0.ALPHA' => array( - array('CS', 'Cheshire', 'Cheshire', '1.0', '1', '0', 'webkit'), - array('MAC', 'Mac OS', 'Mac OS')), - 'Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en) AppleWebKit/418.9 (KHTML, like Safari) Cheshire/1.0.ALPHA' => array( - array('CS', 'Cheshire', 'Cheshire', '1.0', '1', '0', 'webkit'), - array('MAC', 'Mac OS', 'Mac OS')), - - // Chrome / Chromium - 'Mozilla/5.0 (Windows; U; Windows NT 5.2; en-US) AppleWebKit/532.9 (KHTML, like Gecko) Chrome/5.0.310.0 Safari/532.9' => array( - array('CH', 'Chrome', 'Chrome', '5.0', '5', '0', 'webkit'), - array('WS3', 'Windows Server 2003 / XP x64', 'Win S2003')), - 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/525.19 (KHTML, like Gecko) Chrome/1.0.154.48 Safari/525.19' => array( - array('CH', 'Chrome', 'Chrome', '1.0', '1', '0', 'webkit'), - array('WXP', 'Windows XP', 'Win XP')), - 'Mozilla/5.0 (Linux; U; en-US) AppleWebKit/525.13 (KHTML, like Gecko) Chrome/0.2.149.27 Safari/525.13' => array( - array('CH', 'Chrome', 'Chrome', '0.2', '0', '2', 'webkit'), - array('LIN', 'Linux', 'Linux')), - - // ChromePlus (treat as Chrome) - 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/532.2 (KHTML, like Gecko) ChromePlus/4.0.222.3 Chrome/4.0.222.3 Safari/532.2' => array( - array('CH', 'Chrome', 'Chrome', '4.0', '4', '0', 'webkit'), - array('WXP', 'Windows XP', 'Win XP')), - 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/525.28.3 (KHTML, like Gecko) Version/3.2.3 ChromePlus/4.0.222.3 Chrome/4.0.222.3 Safari/525.28.3' => array( - array('CH', 'Chrome', 'Chrome', '3.2', '3', '2', 'webkit'), - array('WXP', 'Windows XP', 'Win XP')), - - // CometBird - 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.5) Gecko/2009011615 Firefox/3.0.5 CometBird/3.0.5' => array( - array('CO', 'CometBird', 'CometBird', '3.0', '3', '0', 'gecko'), - array('WXP', 'Windows XP', 'Win XP')), - - // Crazy Browser (treat as IE) - 'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; InfoPath.2; .NET CLR 2.0.50727; .NET CLR 1.1.4322; Crazy Browser 3.0.0 Beta2)' => array( - array('IE', 'Internet Explorer', 'IE', '7.0', '7', '0', 'ie'), - array('WXP', 'Windows XP', 'Win XP')), - 'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; Avant Browser; .NET CLR 2.0.50727; .NET CLR 3.0.04506.590; .NET CLR 3.5.20706; Crazy Browser 2.0.1)' => array( - array('IE', 'Internet Explorer', 'IE', '7.0', '7', '0', 'ie'), - array('WXP', 'Windows XP', 'Win XP')), - - // Dillo - 'Dillo/2.0' => array( - array('DI', 'Dillo', 'Dillo', '2.0', '2', '0', 'unknown'), - false), - 'Dillo/0.6.4' => array( - array('DI', 'Dillo', 'Dillo', '0.6', '0', '6', 'unknown'), - false), - - // ELinks - 'ELinks/0.12~pre2.dfsg0-1ubuntu1-lite (textmode; Debian; Linux 2.6.32-4-jolicloud i686; 143x37-2)' => array( - array('EL', 'ELinks', 'ELinks', '0.12', '0', '12', 'unknown'), - array('LIN', 'Linux', 'Linux')), - 'ELinks/0.12pre5.GIT (textmode; CYGWIN_NT-6.1 1.7.1(0.218/5/3) i686; 80x24-2)' => array( - array('EL', 'ELinks', 'ELinks', '0.12', '0', '12', 'unknown'), - array('WI7', 'Windows 7', 'Win 7')), - 'ELinks (0.4.3; NetBSD 3.0.2_PATCH sparc64; 141x19)' => array( - array('EL', 'ELinks', 'ELinks', '0.4', '0', '4', 'unknown'), - array('NBS', 'NetBSD', 'NetBSD')), - - // Epiphany - 'Mozilla/5.0 (X11; U; Linux i686; en-us) AppleWebKit/531.2+ (KHTML, like Gecko) Safari/531.2+ Epiphany/2.29.5' => array( - array('EP', 'Epiphany', 'Epiphany', '2.29', '2', '29', 'webkit'), - array('LIN', 'Linux', 'Linux')), - 'Mozilla/5.0 (X11; U; Linux i686; en; rv:1.9.0.11) Gecko/20080528 Epiphany/2.22 Firefox/3.0' => array( - // technically, this should be 'gecko' but UserAgentParser only supports one browserType (family) per browser - array('EP', 'Epiphany', 'Epiphany', '2.22', '2', '22', 'webkit'), - array('LIN', 'Linux', 'Linux')), - - // Fennec - 'Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.2a1pre) Gecko/20090626 Fennec/1.0b2' => array( - array('FE', 'Fennec', 'Fennec', '1.0', '1', '0', 'gecko'), - array('MAC', 'Mac OS', 'Mac OS')), - 'Mozilla/5.0 (X11; U; Linux armv6l; en-US; rv:1.9.1b1pre) Gecko/20081005220218 Gecko/2008052201 Fennec/0.9pre' => array( - array('FE', 'Fennec', 'Fennec', '0.9', '0', '9', 'gecko'), - array('LIN', 'Linux', 'Linux')), - 'Mozilla/5.0 (X11; U; Linux armv6l; en-US; rv:1.9.1a1pre) Gecko/2008071707 Fennec/0.5' => array( - array('FE', 'Fennec', 'Fennec', '0.5', '0', '5', 'gecko'), - array('LIN', 'Linux', 'Linux')), - - // Firefox (formerly Firebird, formerly Phoenix; and rebranded versions) - 'Mozilla/5.0 (X11; U; Linux i686; en-US; rv:2.0a1pre) Gecko/2008060602 Minefield/4.0a1pre' => array( - array('FF', 'Firefox', 'Firefox', '4.0', '4', '0', 'gecko'), - array('LIN', 'Linux', 'Linux')), - 'Mozilla/5.0 (X11; U; Linux i686; en-US; rv:2.0a1pre) Gecko/2008060602 Minefield/4.0a1p' => array( - array('FF', 'Firefox', 'Firefox', '4.0', '4', '0', 'gecko'), - array('LIN', 'Linux', 'Linux')), - 'Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.2a2pre) Gecko/20090826 Namoroka/3.6a2pre' => array( - array('FF', 'Firefox', 'Firefox', '3.6', '3', '6', 'gecko'), - array('WVI', 'Windows Vista', 'Win Vista')), - 'Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2) Gecko/20100119 Namoroka/3.6' => array( - array('FF', 'Firefox', 'Firefox', '3.6', '3', '6', 'gecko'), - array('WI7', 'Windows 7', 'Win 7')), - 'Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.1b4pre) Gecko/20090420 Shiretoko/3.5b4pre (.NET CLR 3.5.30729)' => array( - array('FF', 'Firefox', 'Firefox', '3.5', '3', '5', 'gecko'), - array('WI7', 'Windows 7', 'Win 7')), - 'Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.2) Gecko/20090803 Ubuntu/9.04 (jaunty) Shiretoko/3.5.2' => array( - array('FF', 'Firefox', 'Firefox', '3.5', '3', '5', 'gecko'), - array('LIN', 'Linux', 'Linux')), - 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.6) Gecko/2009011913 Firefox/3.0.6' => array( - array('FF', 'Firefox', 'Firefox', '3.0', '3', '0', 'gecko'), - array('WXP', 'Windows XP', 'Win XP')), - 'Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9a7) Gecko/2007080210 GranParadiso/3.0a7' => array( - array('FF', 'Firefox', 'Firefox', '3.0', '3', '0', 'gecko'), - array('WVI', 'Windows Vista', 'Win Vista')), - 'Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.1) Gecko/2008072716 IceCat/3.0.1-g1' => array( - array('FF', 'Firefox', 'Firefox', '3.0', '3', '0', 'gecko'), - array('LIN', 'Linux', 'Linux')), - 'Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.0.1) Gecko/2008071420 Iceweasel/3.0.1 (Debian-3.0.1-1)' => array( - array('FF', 'Firefox', 'Firefox', '3.0', '3', '0', 'gecko'), - array('LIN', 'Linux', 'Linux')), - 'Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1b2) Gecko/20060821 BonEcho/2.0b2' => array( - array('FF', 'Firefox', 'Firefox', '2.0', '2', '0', 'gecko'), - array('LIN', 'Linux', 'Linux')), - 'Mozilla/5.0 (X11; U; Darwin Power Macintosh; en-US; rv:1.8.0.12) Gecko/20070803 Firefox/1.5.0.12 Fink Community Edition' => array( - array('FF', 'Firefox', 'Firefox', '1.5', '1', '5', 'gecko'), - array('MAC', 'Mac OS', 'Mac OS')), - 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.6b) Gecko/20031212 Firebird/0.7+' => array( - array('FB', 'Firebird', 'Firebird', '0.7', '0', '7', 'gecko'), - array('WXP', 'Windows XP', 'Win XP')), - 'Mozilla/5.0 (Windows; U; Win98; de-DE; rv:1.4b) Gecko/20030516 Mozilla Firebird/0.6' => array( - array('FB', 'Firebird', 'Firebird', '0.6', '0', '6', 'gecko'), - array('W98', 'Windows 98', 'Win 98')), - 'Mozilla/5.0 (Windows; U; WinNT4.0; en-US; rv:1.3a) Gecko/20021207 Phoenix/0.5' => array( - array('PX', 'Phoenix', 'Phoenix', '0.5', '0', '5', 'gecko'), - array('WNT', 'Windows NT', 'Win NT')), - 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.2b) Gecko/20020923 Phoenix/0.1' => array( - array('PX', 'Phoenix', 'Phoenix', '0.1', '0', '1', 'gecko'), - array('WXP', 'Windows XP', 'Win XP')), - 'Mozilla/5.0 (Nintendo DS v4; U; M3 Adapter CF + PassMe2; en-US; rv:1.8.0.6 ) Gecko/20060728 Firefox/1.5.0.6 (firefox.gba.ds)' => array( - array('FF', 'Firefox', 'Firefox', '1.5', '1', '5', 'gecko'), - array('NDS', 'Nintendo DS', 'DS')), - - // Flock - 'Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/532.5 (KHTML, like Gecko) Flock/3.0.0.3737 Chrome/4.1.249.1071 Safari/532.5' => array( - array('FL', 'Flock', 'Flock', '3.0', '3', '0', 'webkit'), - array('WI7', 'Windows 7', 'Win 7')), - // pre-3.0 is actually gecko - 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.7) Gecko/20091221 Firefox/3.5.7 Flock/2.5.6 (.NET CLR 3.5.30729)' => array( - array('FL', 'Flock', 'Flock', '2.5', '2', '5', 'webkit'), - array('WXP', 'Windows XP', 'Win XP')), - 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.7) Gecko/20091221 AppleWebKit/531.21.8 KHTML/4.3.5 (like Gecko) Firefox/3.5.7 Flock/2.5.6 (.NET CLR 3.5.30729)' => array( - array('FL', 'Flock', 'Flock', '2.5', '2', '5', 'webkit'), - array('WXP', 'Windows XP', 'Win XP')), - 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.7) Gecko/20091221 AppleWebKit/531.21.8 (KHTML, like Gecko) Firefox/3.5.7 Flock/2.5.6 (.NET CLR 3.5.30729)' => array( - array('FL', 'Flock', 'Flock', '2.5', '2', '5', 'webkit'), - array('WXP', 'Windows XP', 'Win XP')), - 'Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en-US; rv:1.8.1.9) Gecko/20071106 Firefox/2.0.0.9 Flock/1.0.1' => array( - array('FL', 'Flock', 'Flock', '1.0', '1', '0', 'webkit'), - array('MAC', 'Mac OS', 'Mac OS')), - 'Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.8.1.8) Gecko/20071101 Firefox/2.0.0.8 Flock/1.0' => array( - array('FL', 'Flock', 'Flock', '1.0', '1', '0', 'webkit'), - array('MAC', 'Mac OS', 'Mac OS')), - 'Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.8b5) Gecko/20051021 Flock/0.4 Firefox/1.0+' => array( - array('FL', 'Flock', 'Flock', '0.4', '0', '4', 'webkit'), - array('MAC', 'Mac OS', 'Mac OS')), - - // Fluid - 'Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_1; nl-nl) AppleWebKit/532.3+ (KHTML, like Gecko) Fluid/0.9.6 Safari/532.3+' => array( - array('FD', 'Fluid', 'Fluid', '0.9', '0', '9', 'webkit'), - array('MAC', 'Mac OS', 'Mac OS')), - 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/525.13 (KHTML, like Gecko) Fluid/0.9.4 Safari/525.13' => array( - array('FD', 'Fluid', 'Fluid', '0.9', '0', '9', 'webkit'), - array('WXP', 'Windows XP', 'Win XP')), - - // Galeon - 'Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.8) Gecko/20090327 Galeon/2.0.7' => array( - array('GA', 'Galeon', 'Galeon', '2.0', '2', '0', 'gecko'), - array('LIN', 'Linux', 'Linux')), - 'Mozilla/5.0 (X11; U; OpenBSD i386; en-US; rv:1.8.1.19) Gecko/20090701 Galeon/2.0.7' => array( - array('GA', 'Galeon', 'Galeon', '2.0', '2', '0', 'gecko'), - array('OBS', 'OpenBSD', 'OpenBSD')), - 'Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.19) Gecko/20081216 Galeon/2.0.4 Firefox/2.0.0.19' => array( - array('GA', 'Galeon', 'Galeon', '2.0', '2', '0', 'gecko'), - array('LIN', 'Linux', 'Linux')), - 'Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.0.13pre) Gecko/20080207 Galeon/2.0.1 (Ubuntu package 2.0.1-1ubuntu2) Firefox/1.5.0.13pre' => array( - array('GA', 'Galeon', 'Galeon', '2.0', '2', '0', 'gecko'), - array('LIN', 'Linux', 'Linux')), - 'Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.6) Gecko/20040406 Galeon/1.3.15' => array( - array('GA', 'Galeon', 'Galeon', '1.3', '1', '3', 'gecko'), - array('BSD', 'FreeBSD', 'FreeBSD')), - 'Mozilla/5.0 Galeon/1.2.9 (X11; Linux i686; U;) Gecko/20021213 Debian/1.2.9-0.bunk' => array( - array('GA', 'Galeon', 'Galeon', '1.2', '1', '2', 'gecko'), - array('LIN', 'Linux', 'Linux')), - 'Mozilla/5.0 Galeon/1.0.3 (X11; Linux i686; U;) Gecko/0' => array( - array('GA', 'Galeon', 'Galeon', '1.0', '1', '0', 'gecko'), - array('LIN', 'Linux', 'Linux')), - - // Google Earth embedded browser - 'Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/532.4 (KHTML, like Gecko) Google Earth/5.2.1.1329 Safari/532.4' => array( - array('GE', 'Google Earth', 'Google Earth', '5.2', '5', '2', 'webkit'), - array('WI7', 'Windows 7', 'Win 7')), - - // GreenBrowser (treat as IE) - 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1) ; SLCC1; .NET CLR 2.0.50727; .NET CLR 3.0.04506; Media Center PC 5.0; .NET CLR 3.5.21022; GreenBrowser)' => array( - array('IE', 'Internet Explorer', 'IE', '6.0', '6', '0', 'ie'), - array('WXP', 'Windows XP', 'Win XP')), - 'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; Trident/4.0; SLCC1; .NET CLR 2.0.50727; .NET CLR 3.5.30729; InfoPath.2; .NET CLR 3.0.30729; GreenBrowser)' => array( - array('IE', 'Internet Explorer', 'IE', '7.0', '7', '0', 'ie'), - array('WVI', 'Windows Vista', 'Win Vista')), - - // Hana - 'Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en) AppleWebKit/418.9 (KHTML, like Gecko) Hana/1.1' => array( - array('HA', 'Hana', 'Hana', '1.1', '1', '1', 'webkit'), - array('MAC', 'Mac OS', 'Mac OS')), - 'Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en) AppleWebKit/417.9 (KHTML, like Gecko) Hana/1.0' => array( - array('HA', 'Hana', 'Hana', '1.0', '1', '0', 'webkit'), - array('MAC', 'Mac OS', 'Mac OS')), - - // HotJava - 'HotJava/1.1.2 FCS' => array( - array('HJ', 'HotJava', 'HotJava', '1.1', '1', '1', 'unknown'), - false), - 'HotJava/1.0.1/JRE1.1.x' => array( - array('HJ', 'HotJava', 'HotJava', '1.0', '1', '0', 'unknown'), - false), - - // iBrowse - 'Mozilla/5.0 (compatible; IBrowse 3.0; AmigaOS4.0)' => array( - array('IB', 'IBrowse', 'IBrowse', '3.0', '3', '0', 'unknown'), - array('AMI', 'AmigaOS', 'AmigaOS')), - 'Mozilla/4.0 (compatible; IBrowse 2.3; AmigaOS4.0)' => array( - array('IB', 'IBrowse', 'IBrowse', '2.3', '2', '3', 'unknown'), - array('AMI', 'AmigaOS', 'AmigaOS')), - 'IBrowse/2.4 (AmigaOS 3.9; 68K)' => array( - array('IB', 'IBrowse', 'IBrowse', '2.4', '2', '4', 'unknown'), - array('AMI', 'AmigaOS', 'AmigaOS')), - 'IBrowse/2.3 (AmigaOS V51)' => array( - array('IB', 'IBrowse', 'IBrowse', '2.3', '2', '3', 'unknown'), - array('AMI', 'AmigaOS', 'AmigaOS')), - 'IBrowse/2.3 (AmigaOS 4.0)' => array( - array('IB', 'IBrowse', 'IBrowse', '2.3', '2', '3', 'unknown'), - array('AMI', 'AmigaOS', 'AmigaOS')), - - // iCab - 'iCab/4.5 (Macintosh; U; PPC Mac OS X)' => array( - array('IC', 'iCab', 'iCab', '4.5', '4', '5', 'unknown'), - array('MAC', 'Mac OS', 'Mac OS')), - 'iCab/4.5 (Macintosh; U; Mac OS X Leopard 10.5.7)' => array( - array('IC', 'iCab', 'iCab', '4.5', '4', '5', 'unknown'), - array('MAC', 'Mac OS', 'Mac OS')), - 'Mozilla/5.0 (compatible; iCab 3.0.5; Macintosh; U; PPC Mac OS)' => array( - array('IC', 'iCab', 'iCab', '3.0', '3', '0', 'unknown'), - array('MAC', 'Mac OS', 'Mac OS')), - 'Mozilla/5.0 (compatible; iCab 3.0.5; Macintosh; U; PPC Mac OS X)' => array( - array('IC', 'iCab', 'iCab', '3.0', '3', '0', 'unknown'), - array('MAC', 'Mac OS', 'Mac OS')), - 'Mozilla/5.0 (Macintosh; U; PPC Mac OS; en) iCab 3' => array( - array('IC', 'iCab', 'iCab', '3.0', '3', '0', 'unknown'), - array('MAC', 'Mac OS', 'Mac OS')), - 'Mozilla/4.5 (compatible; iCab 2.7.1; Macintosh; I; PPC)' => array( - array('IC', 'iCab', 'iCab', '2.7', '2', '7', 'unknown'), - array('MAC', 'Mac OS', 'Mac OS')), - 'iCab/2.9.8 (Macintosh; U; 68K)' => array( - array('IC', 'iCab', 'iCab', '2.9', '2', '9', 'unknown'), - array('MAC', 'Mac OS', 'Mac OS')), - 'Lynx/2.8 (compatible; iCab 2.9.8; Macintosh; U; 68K)' => array( - array('IC', 'iCab', 'iCab', '2.9', '2', '9', 'unknown'), - array('MAC', 'Mac OS', 'Mac OS')), - 'Mozilla/4/5 (compatible; iCab 2.9.8; Macintosh; U; 68K)' => array( - array('IC', 'iCab', 'iCab', '2.9', '2', '9', 'unknown'), - array('MAC', 'Mac OS', 'Mac OS')), - 'Mozilla/4.0 (compatible; MSIE 5.0; Mac_PowerPC)' => array( - array('IE', 'Internet Explorer', 'IE', '5.0', '5', '0', 'ie'), - array('MAC', 'Mac OS', 'Mac OS')), - 'Mozilla/4.76 (Macintosh; I; PPC)' => array( - array('NS', 'Netscape', 'Netscape', '4.76', '4', '76', 'gecko'), - array('MAC', 'Mac OS', 'Mac OS')), - - // Internet Explorer - 'Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)' => array( - array('IE', 'Internet Explorer', 'IE', '9.0', '9', '0', 'ie'), - array('WI7', 'Windows 7', 'Win 7')), - 'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; Trident/5.0)' => array( - array('IE', 'Internet Explorer', 'IE', '7.0', '7', '0', 'ie'), - array('WVI', 'Windows Vista', 'Win Vista')), - 'Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET CLR 3.0.04506; .NET CLR 3.5.21022; InfoPath.2; SLCC1; Zune 3.0)' => array( - array('IE', 'Internet Explorer', 'IE', '8.0', '8', '0', 'ie'), - array('WI7', 'Windows 7', 'Win 7')), - 'Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; Trident/4.0)' => array( - array('IE', 'Internet Explorer', 'IE', '8.0', '8', '0', 'ie'), - array('WVI', 'Windows Vista', 'Win Vista')), - 'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; Trident/4.0)' => array( - array('IE', 'Internet Explorer', 'IE', '7.0', '7', '0', 'ie'), - array('WVI', 'Windows Vista', 'Win Vista')), - 'Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0)' => array( - array('IE', 'Internet Explorer', 'IE', '8.0', '8', '0', 'ie'), - array('WXP', 'Windows XP', 'Win XP')), - 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.04506.30; .NET CLR 3.0.04506.648)' => array( - array('IE', 'Internet Explorer', 'IE', '6.0', '6', '0', 'ie'), - array('WXP', 'Windows XP', 'Win XP')), - 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; SV1; .NET CLR 1.1.4322; .NET CLR 2.0.50727)' => array( - array('IE', 'Internet Explorer', 'IE', '6.0', '6', '0', 'ie'), - array('WS3', 'Windows Server 2003 / XP x64', 'Win S2003')), - 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; WOW64; SV1; .NET CLR 2.0.50727)' => array( - array('IE', 'Internet Explorer', 'IE', '6.0', '6', '0', 'ie'), - array('WS3', 'Windows Server 2003 / XP x64', 'Win S2003')), - 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; Win64; x64; SV1; .NET CLR 2.0.50727)' => array( - array('IE', 'Internet Explorer', 'IE', '6.0', '6', '0', 'ie'), - array('WS3', 'Windows Server 2003 / XP x64', 'Win S2003')), - - // Internet Explorer with misbehaving Google Tool Bar - 'Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; GTB6.5; Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1) ; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729)' => array( - array('IE', 'Internet Explorer', 'IE', '8.0', '8', '0', 'ie'), - array('WXP', 'Windows XP', 'Win XP')), - 'Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; GTB0.0; Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1) ; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729)' => array( - array('IE', 'Internet Explorer', 'IE', '8.0', '8', '0', 'ie'), - array('WXP', 'Windows XP', 'Win XP')), - - // Iron - 'Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/531.0 (KHTML, like Gecko) Iron/3.0.189.0 Safari/531.0' => array( - array('IR', 'Iron', 'Iron', '3.0', '3', '0', 'webkit'), - array('WI7', 'Windows 7', 'Win 7')), - - // K-Meleon - 'Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.21) Gecko/20090331 K-Meleon/1.5.3' => array( - array('KM', 'K-Meleon', 'K-Meleon', '1.5', '1', '5', 'gecko'), - array('LIN', 'Linux', 'Linux')), - 'Mozilla/5.0 (Darwin; FreeBSD 5.6; en-GB; rv:1.8.1.17pre) Gecko/20080716 K-Meleon/1.5.0' => array( - array('KM', 'K-Meleon', 'K-Meleon', '1.5', '1', '5', 'gecko'), - array('MAC', 'Mac OS', 'Mac OS')), - 'Mozilla/5.0 (Windows; U; WinNT4.0; en-US; rv:1.2b) Gecko/20021016 K-Meleon 0.7' => array( - array('KM', 'K-Meleon', 'K-Meleon', '0.7', '0', '7', 'gecko'), - array('WNT', 'Windows NT', 'Win NT')), - - // Kapiko - 'Mozilla/5.0 (Windows; U; Windows NT 5.1; zh-CN; rv:1.9.0.1) Gecko/20080722 Firefox/3.0.1 Kapiko/3.0' => array( - array('KP', 'Kapiko', 'Kapiko', '3.0', '3', '0', 'gecko'), - array('WXP', 'Windows XP', 'Win XP')), - - // Kazehakase - 'Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.11) Gecko Kazehakase/0.5.4 Debian/0.5.4-2.1ubuntu3' => array( - array('KZ', 'Kazehakase', 'Kazehakase', '0.5', '0', '5', 'gecko'), - array('LIN', 'Linux', 'Linux')), - 'Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.13) Gecko/20080311 (Debian-1.8.1.13+nobinonly-0ubuntu1) Kazehakase/0.5.2' => array( - array('KZ', 'Kazehakase', 'Kazehakase', '0.5', '0', '5', 'gecko'), - array('LIN', 'Linux', 'Linux')), - 'Mozilla/5.0 (X11; Linux x86_64; U;) Gecko/20060207 Kazehakase/0.3.5 Debian/0.3.5-1' => array( - array('KZ', 'Kazehakase', 'Kazehakase', '0.3', '0', '3', 'gecko'), - array('LIN', 'Linux', 'Linux')), - - // KKMAN (treat as IE) - 'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; KKMAN3.2)' => array( - array('IE', 'Internet Explorer', 'IE', '7.0', '7', '0', 'ie'), - array('WXP', 'Windows XP', 'Win XP')), - - // Konqueror - 'Mozilla/5.0 (compatible; Konqueror/4.0; Linux) KHTML/4.0.5 (like Gecko)' => array( - array('KO', 'Konqueror', 'Konqueror', '4.0', '4', '0', 'khtml'), - array('LIN', 'Linux', 'Linux')), - 'Mozilla/5.0 (compatible; Konqueror/4.0; Microsoft Windows) KHTML/4.0.80 (like Gecko)' => array( - array('KO', 'Konqueror', 'Konqueror', '4.0', '4', '0', 'khtml'), - false), - 'Mozilla/5.0 (compatible; Konqueror/3.5; GNU/kFreeBSD) KHTML/3.5.9 (like Gecko) (Debian)' => array( - array('KO', 'Konqueror', 'Konqueror', '3.5', '3', '5', 'khtml'), - array('BSD', 'FreeBSD', 'FreeBSD')), - 'Mozilla/5.0 (compatible; Konqueror/2.1.1; X11)' => array( - array('KO', 'Konqueror', 'Konqueror', '2.1', '2', '1', 'khtml'), - false), - - // Links - 'Links' => array( - false, - false), - 'Links (2.1pre31; Linux 2.6.21-omap1 armv6l; x)' => array( - array('LI', 'Links', 'Links', '2.1', '2', '1', 'unknown'), - array('LIN', 'Linux', 'Linux')), - 'Links (0.99; OS/2 1 i386; 80x33)' => array( - array('LI', 'Links', 'Links', '0.99', '0', '99', 'unknown'), - array('OS2', 'OS/2', 'OS/2')), - - // Lunascape (identity crisis) - 'Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.1) Gecko/20090701 Firefox/3.5 Lunascape/5.1.2.3' => array( - array('FF', 'Firefox', 'Firefox', '3.5', '3', '5', 'gecko'), - array('WVI', 'Windows Vista', 'Win Vista')), - 'Mozilla/5.0 (Windows; U; ; cs-CZ) AppleWebKit/532+ (KHTML, like Gecko, Safari/532.0) Lunascape/5.1.2.3' => array( - array('SF', 'Safari', 'Safari', '4.0', '4', '0', 'webkit'), - false), - 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1) ; InfoPath.1; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Lunascape 5.1.2.3)' => array( - array('IE', 'Internet Explorer', 'IE', '6.0', '6', '0', 'ie'), - array('WXP', 'Windows XP', 'Win XP')), - - // Lynx - 'Lynx (textmode)' => array( - false, - false), - 'Lynx/2.8.7dev.9 libwww-FM/2.14' => array( - array('LX', 'Lynx', 'Lynx', '2.8', '2', '8', 'unknown'), - false), - - // Maxathon (treat as IE) - 'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; SV1; Maxthon; .NET CLR 1.1.4322)' => array( - array('IE', 'Internet Explorer', 'IE', '7.0', '7', '0', 'ie'), - array('WXP', 'Windows XP', 'Win XP')), - - // Midori - 'Midori/0.1.9 (X11; Linux i686; U; fr-fr) WebKit/532+' => array( - array('MI', 'Midori', 'Midori', '0.1', '0', '1', 'webkit'), - array('LIN', 'Linux', 'Linux')), - - // Mozilla Suite - 'Mozilla/5.0 (X11; U; SunOS sun4u; en-US; rv:1.7) Gecko/20070606' => array( - array('MO', 'Mozilla', 'Mozilla', '1.7', '1', '7', 'gecko'), - array('SOS', 'SunOS', 'SunOS')), - 'Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.8) Gecko/20050927 Debian/1.7.8-1sarge3' => array( - array('MO', 'Mozilla', 'Mozilla', '1.7', '1', '7', 'gecko'), - array('LIN', 'Linux', 'Linux')), - - // NCSA Mosaic - 'PATHWORKS Mosaic/1.0 libwww/2.15_Spyglass' => array( - array('MC', 'NCSA Mosaic', 'Mosaic', '1.0', '1', '0', 'unknown'), - false), - 'WinMosaic/Version 2.0 (ALPHA 2)' => array( - array('MC', 'NCSA Mosaic', 'Mosaic', '2.0', '2', '0', 'unknown'), - false), - 'VMS_Mosaic/3.8-1 (Motif;OpenVMS V7.3-2 DEC 3000 - M700) libwww/2.12_Mosaic' => array( - array('MC', 'NCSA Mosaic', 'Mosaic', '3.8', '3', '8', 'unknown'), - false), - 'Mosaic from Digital/1.02_Win32' => array( - array('MC', 'NCSA Mosaic', 'Mosaic', '1.02', '1', '02', 'unknown'), - array('W95', 'Windows 95', 'Win 95')), - 'NCSA Mosaic/2.0.0b4 (Windows AXP)' => array( - array('MC', 'NCSA Mosaic', 'Mosaic', '2.0', '2', '0', 'unknown'), - false), - 'NCSA_Mosaic/2.7b5 (X11;Linux 2.6.7 i686) libwww/2.12 modified' => array( - array('MC', 'NCSA Mosaic', 'Mosaic', '2.7', '2', '7', 'unknown'), - array('LIN', 'Linux', 'Linux')), - 'mMosaic/3.6.6 (X11;SunOS 5.8 sun4m)' => array( - array('MC', 'NCSA Mosaic', 'Mosaic', '3.6', '3', '6', 'unknown'), - array('SOS', 'SunOS', 'SunOS')), - - // Netscape Navigator (9.x) - 'Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.8pre) Gecko/20071015 Firefox/2.0.0.7 Navigator/9.0' => array( - array('NS', 'Netscape', 'Netscape', '9.0', '9', '0', 'gecko'), - array('LIN', 'Linux', 'Linux')), - 'Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.5) Gecko/20070321 Netscape/9.0' => array( - array('NS', 'Netscape', 'Netscape', '9.0', '9', '0', 'gecko'), - array('LIN', 'Linux', 'Linux')), - - // Netscape (6.x - 8.x) - 'Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.5) Gecko/20070321 Netscape/8.1.3' => array( - array('NS', 'Netscape', 'Netscape', '8.1', '8', '1', 'gecko'), - array('LIN', 'Linux', 'Linux')), - 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.2) Gecko/20040804 Netscape/7.2 (ax)' => array( - array('NS', 'Netscape', 'Netscape', '7.2', '7', '2', 'gecko'), - array('WXP', 'Windows XP', 'Win XP')), - 'Mozilla/5.0 (X11; U; OSF1 alpha; en-US; rv:0.9.4.1) Gecko/20020517 Netscape6/6.2.3' => array( - array('NS', 'Netscape', 'Netscape', '6.2', '6', '2', 'gecko'), - array('T64', 'Tru64', 'Tru64')), - 'Mozilla/5.0 (X11; U; Linux i686; en-US; rv:0.9.2) Gecko/20010726 Netscape6/6.1' => array( - array('NS', 'Netscape', 'Netscape', '6.1', '6', '1', 'gecko'), - array('LIN', 'Linux', 'Linux')), - - // Netscape Communicator (4.x) - 'Mozilla/4.76C-SGI [en] (X11; I; IRIX64 6.5 IP30)' => array( - array('NS', 'Netscape', 'Netscape', '4.76', '4', '76', 'gecko'), - array('IRI', 'IRIX', 'IRIX')), - 'Mozilla/4.72 [en] (X11; I; HP-UX B.11.00 9000/800)' => array( - array('NS', 'Netscape', 'Netscape', '4.72', '4', '72', 'gecko'), - array('HPX', 'HP-UX', 'HP-UX')), - 'Mozilla/4.41 (BEOS; U ;Nav)' => array( - array('NS', 'Netscape', 'Netscape', '4.41', '4', '41', 'gecko'), - array('BEO', 'BeOS', 'BeOS')), - 'Mozilla/4.0 (compatible; Windows NT 5.1; U; en)' => array( - array('NS', 'Netscape', 'Netscape', '4.0', '4', '0', 'gecko'), - array('WXP', 'Windows XP', 'Win XP')), - - // Netscape Navigator (up to 3.x) - 'Mozilla/3.0 (X11; I; AIX 2)' => array( - array('NS', 'Netscape', 'Netscape', '3.0', '3', '0', 'gecko'), - array('AIX', 'AIX', 'AIX')), - 'Mozilla/2.02 [fr] (WinNT; I)' => array( - array('NS', 'Netscape', 'Netscape', '2.02', '2', '02', 'gecko'), - array('WNT', 'Windows NT', 'Win NT')), - - // Omniweb - 'Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en-US) AppleWebKit/525.18 (KHTML, like Gecko, Safari/525.20) OmniWeb/v622.3.0.105198' => array( - array('OW', 'OmniWeb', 'OmniWeb', '5.8', '5', '8', 'webkit'), - array('MAC', 'Mac OS', 'Mac OS')), - 'Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en-US) AppleWebKit/522+ (KHTML, like Gecko, Safari/522) OmniWeb/v613' => array( - array('OW', 'OmniWeb', 'OmniWeb', '5.6', '5', '6', 'webkit'), - array('MAC', 'Mac OS', 'Mac OS')), - 'Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en-US) AppleWebKit/420+ (KHTML, like Gecko, Safari/420) OmniWeb/v607' => array( - array('OW', 'OmniWeb', 'OmniWeb', '5.5', '5', '5', 'webkit'), - array('MAC', 'Mac OS', 'Mac OS')), - 'Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en-US) AppleWebKit/125.4 (KHTML, like Gecko, Safari) OmniWeb/v563.34' => array( - array('OW', 'OmniWeb', 'OmniWeb', '5.1', '5', '1', 'webkit'), - array('MAC', 'Mac OS', 'Mac OS')), - 'Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en-US) AppleWebKit/85 (KHTML, like Gecko) OmniWeb/v558.36' => array( - array('OW', 'OmniWeb', 'OmniWeb', '5.0', '5', '0', 'webkit'), - array('MAC', 'Mac OS', 'Mac OS')), - 'Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en-US) AppleWebKit/85 (KHTML, like Gecko) OmniWeb/v496' => array( - array('OW', 'OmniWeb', 'OmniWeb', '4.5', '4', '5', 'webkit'), - array('MAC', 'Mac OS', 'Mac OS')), - - // Opera - 'Opera/9.63 (Windows NT 5.1; U; en) Presto/2.1.1' => array( - array('OP', 'Opera', 'Opera', '9.63', '9', '63', 'opera'), - array('WXP', 'Windows XP', 'Win XP')), - 'Opera/9.30 (Nintendo Wii; U; ; 2047-7; en)' => array( - array('OP', 'Opera', 'Opera', '9.30', '9', '30', 'opera'), - array('WII', 'Nintendo Wii', 'Wii')), - 'Opera/9.64 (Windows ME; U; en) Presto/2.1.1' => array( - array('OP', 'Opera', 'Opera', '9.64', '9', '64', 'opera'), - array('WME', 'Windows Me', 'Win Me')), - 'Opera/9.80 (Windows NT 5.1; U; en) Presto/2.2.15 Version/10.00' => array( - array('OP', 'Opera', 'Opera', '10.00', '10', '0', 'opera'), - array('WXP', 'Windows XP', 'Win XP')), - 'Mozilla/4.0 (compatible; MSIE 6.0; Nitro) Opera 8.50 [en Mozilla/4.0 (compatible; MSIE 6.0; Nitro) Opera 8.50 [ja]' => array( - array('OP', 'Opera', 'Opera', '8.50', '8', '50', 'opera'), - array('NDS', 'Nintendo DS', 'DS')), - 'Opera/9.00 (Nintendo DS U; ; 1309-9; de)' => array( - array('OP', 'Opera', 'Opera', '9.00', '9', '00', 'opera'), - array('NDS', 'Nintendo DS', 'DS')), - 'Opera/9.50 (Nintendo DSi; Opera/507; U; en-US) ' => array( - array('OP', 'Opera', 'Opera', '9.50', '9', '50', 'opera'), - array('DSI', 'Nintendo DSi', 'DSi')), - - // PSP - 'PSP (PlayStation Portable); 2.00' => array( - false, - array('PSP', 'PlayStation Portable', 'PSP')), - 'Mozilla/4.0 (PSP (PlayStation Portable); 2.00)' => array( - false, - array('PSP', 'PlayStation Portable', 'PSP')), - - // Safari - 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/525.19 (KHTML, like Gecko) Version/3.1.2 Safari/525.21' => array( - array('SF', 'Safari', 'Safari', '3.1', '3', '1', 'webkit'), - array('WXP', 'Windows XP', 'Win XP')), - 'Mozilla/5.0 (iPhone; U; CPU iPhone OS 2_2 like Mac OS X; en-us) AppleWebKit/525.18.1 (KHTML, like Gecko) Version/3.1.1 Mobile/5G77 Safari/525.20' => array( - array('SF', 'Safari', 'Safari', '3.1', '3', '1', 'webkit'), - array('IPH', 'iPhone', 'iPhone')), - 'Mozilla/5.0 (iPod; U; CPU like Mac OS X; en) AppleWebKit/420.1 (KHTML, like Gecko) Version/3.0 Mobile/3A100a Safari/419.3' => array( - array('SF', 'Safari', 'Safari', '3.0', '3', '0', 'webkit'), - array('IPD', 'iPod', 'iPod')), - 'Mozilla/5.0 (iPod; U; CPU iPhone OS 2_2_1 like Mac OS X; en-us) AppleWebKit/525.18.1 (KHTML, like Gecko) Version/3.1.1 Mobile/5H11a Safari/525.20' => array( - array('SF', 'Safari', 'Safari', '3.1', '3', '1', 'webkit'), - array('IPD', 'iPod', 'iPod')), - 'Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_5; en-us) AppleWebKit/527.3+ (KHTML, like Gecko) Version/3.1.2 Safari/525.20.1' => array( - array('SF', 'Safari', 'Safari', '3.1', '3', '1', 'webkit'), - array('MAC', 'Mac OS', 'Mac OS')), - 'Mozilla/5.0(iPad; U; CPU iPhone OS 3_2 like Mac OS X; en-us) AppleWebKit/531.21.10 (KHTML, like Gecko) Version/4.0.4 Mobile/7B314 Safari/531.21.10' => array( - array('SF', 'Safari', 'Safari', '4.0', '4', '0', 'webkit'), - array('IPA', 'iPad', 'iPad')), - - // SeaMonkey (formerly Mozilla Suite and rebranded versions) - 'Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.8) Gecko/20071008 Iceape/1.1.5 (Ubuntu-1.1.5-1ubuntu0.7.10)' => array( - array('SM', 'SeaMonkey', 'SeaMonkey', '1.1', '1', '1', 'gecko'), - array('LIN', 'Linux', 'Linux')), - 'Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1b4pre) Gecko/20090405 SeaMonkey/2.0b1pre' => array( - array('SM', 'SeaMonkey', 'SeaMonkey', '2.0', '2', '0', 'gecko'), - array('LIN', 'Linux', 'Linux')), - 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9) Gecko' => array( - // this pre-2.0 UA is missing the SeaMonkey/X.Y - array('SM', 'SeaMonkey', 'SeaMonkey', '1.9', '1', '9', 'gecko'), - array('WXP', 'Windows XP', 'Win XP')), - 'Mozilla/5.0 (Windows; U; Windows NT 5.1; cs; rv:1.9) Gecko/2008052906' => array( - // this pre-2.0 UA is missing the SeaMonkey/X.Y - array('SM', 'SeaMonkey', 'SeaMonkey', '1.9', '1', '9', 'gecko'), - array('WXP', 'Windows XP', 'Win XP')), - - // Palm webOS - 'Mozilla/5.0 (webOS/1.0; U; en-us) AppleWebKit/525.27.1 (KHTML, like Gecko) Version/1.0 Safari/525.27.1 Pre/1.0' => array( - array('WO', 'Palm webOS', 'webOS', '1.0', '1', '0', 'webkit'), - array('WOS', 'Palm webOS', 'webOS')), - 'Mozilla/5.0 (webOS/Palm webOS 1.2.9; U; en-US) AppleWebKit/525.27.1 (KHTML, like Gecko) Version/1.0 Safari/525.27.1 Pixi/1.0' => array( - array('WO', 'Palm webOS', 'webOS', '1.0', '1', '0', 'webkit'), - array('WOS', 'Palm webOS', 'webOS')), - 'Mozilla/5.0 [en] (PalmOS; U; WebPro/3.5; Palm-Zi72)' => array( - array('WP', 'WebPro', 'WebPro', '3.5', '3', '5', 'unknown'), - array('POS', 'Palm OS', 'Palm OS')), - - // Palm WebPro - 'Mozilla/4.76 [en] (PalmOS; U; WebPro/3.0.1a; Palm-Cct1)' => array( - array('WP', 'WebPro', 'WebPro', '3.0', '3', '0', 'unknown'), - array('POS', 'Palm OS', 'Palm OS')), - 'Mozilla/4.76 [en] (PalmOS; U; WebPro/3.0; Palm-Arz1)' => array( - array('WP', 'WebPro', 'WebPro', '3.0', '3', '0', 'unknown'), - array('POS', 'Palm OS', 'Palm OS')), - ); - - public function test_getBrowser() - { - foreach($this->userAgents as $userAgent => $expected) - { - $res = UserAgentParser::getBrowser($userAgent); - $family = false; - - if($res === false) - $ok = $res === $expected[0]; - else - { - $family = Piwik_getBrowserFamily($res['id']); - $ok = $expected[0][0] == $res['id'] && - $expected[0][1] == $res['name'] && - $expected[0][2] == $res['short_name'] && - $expected[0][3] == $res['version'] && - $expected[0][4] == $res['major_number'] && - $expected[0][5] == $res['minor_number'] && - $expected[0][6] == $family; - } - - $this->assertTrue($ok); - if(!$ok) - { - var_dump(array($userAgent, $res, $family)); - } - } - } - - public function test_getOperatingSystem() - { - foreach($this->userAgents as $userAgent => $expected) - { - $res = UserAgentParser::getOperatingSystem($userAgent); - - $ok = $expected[1][0] == $res['id'] && - $expected[1][1] == $res['name'] && - $expected[1][2] == $res['short_name']; - - $this->assertTrue($ok); - if(!$ok) - { - var_dump(array($userAgent, $res)); - } - } - } -} diff --git a/plugins/UsersManager/API.php b/plugins/UsersManager/API.php index 8ab60fb252..fda72c78c3 100644 --- a/plugins/UsersManager/API.php +++ b/plugins/UsersManager/API.php @@ -17,10 +17,6 @@ class Piwik_UsersManager_API { static private $instance = null; - - /** - * @return Piwik_UsersManager_API - */ static public function getInstance() { if (self::$instance == null) @@ -31,51 +27,17 @@ class Piwik_UsersManager_API return self::$instance; } - const PREFERENCE_DEFAULT_REPORT = 'defaultReport'; - const PREFERENCE_DEFAULT_REPORT_DATE = 'defaultReportDate'; - - /** - * Sets a user preference - * @param $userLogin - * @param $preferenceName - * @param $preferenceValue - * @return void - */ - public function setUserPreference($userLogin, $preferenceName, $preferenceValue) - { - Piwik::checkUserIsSuperUserOrTheUser($userLogin); - Piwik_SetOption($this->getPreferenceId($userLogin, $preferenceName), $preferenceValue); - } - - /** - * Gets a user preference - * @param $userLogin - * @param $preferenceName - * @param $preferenceValue - * @return void - */ - public function getUserPreference($userLogin, $preferenceName) - { - Piwik::checkUserIsSuperUserOrTheUser($userLogin); - return Piwik_GetOption($this->getPreferenceId($userLogin, $preferenceName)); - } - - private function getPreferenceId($login, $preference) - { - return $login . '_' . $preference; - } - /** * Returns the list of all the users * * @return array the list of all the users */ - public function getUsers() + static public function getUsers() { Piwik::checkUserIsSuperUser(); $db = Zend_Registry::get('db'); - $users = $db->fetchAll("SELECT * FROM ".Piwik_Common::prefixTable("user")." ORDER BY login ASC"); + $users = $db->fetchAll("SELECT * FROM ".Piwik::prefixTable("user")." ORDER BY login ASC"); return $users; } @@ -84,12 +46,12 @@ class Piwik_UsersManager_API * * @return array the list of all the users login */ - public function getUsersLogin() + static public function getUsersLogin() { Piwik::checkUserHasSomeAdminAccess(); $db = Zend_Registry::get('db'); - $users = $db->fetchAll("SELECT login FROM ".Piwik_Common::prefixTable("user")." ORDER BY login ASC"); + $users = $db->fetchAll("SELECT login FROM ".Piwik::prefixTable("user")." ORDER BY login ASC"); $return = array(); foreach($users as $login) { @@ -113,15 +75,15 @@ class Piwik_UsersManager_API * ) * */ - public function getUsersSitesFromAccess( $access ) + static public function getUsersSitesFromAccess( $access ) { Piwik::checkUserIsSuperUser(); - $this->checkAccessType($access); + self::checkAccessType($access); $db = Zend_Registry::get('db'); $users = $db->fetchAll("SELECT login,idsite - FROM ".Piwik_Common::prefixTable("access") + FROM ".Piwik::prefixTable("access") ." WHERE access = ?", $access); $return = array(); foreach($users as $user) @@ -147,13 +109,13 @@ class Piwik_UsersManager_API * ... * ) */ - public function getUsersAccessFromSite( $idSite ) + static public function getUsersAccessFromSite( $idSite ) { Piwik::checkUserHasAdminAccess( $idSite ); $db = Zend_Registry::get('db'); $users = $db->fetchAll("SELECT login,access - FROM ".Piwik_Common::prefixTable("access") + FROM ".Piwik::prefixTable("access") ." WHERE idsite = ?", $idSite); $return = array(); foreach($users as $user) @@ -180,15 +142,15 @@ class Piwik_UsersManager_API * ... * ) */ - public function getSitesAccessFromUser( $userLogin ) + static public function getSitesAccessFromUser( $userLogin ) { Piwik::checkUserIsSuperUser(); - $this->checkUserExists($userLogin); - $this->checkUserIsNotSuperUser($userLogin); + self::checkUserExists($userLogin); + self::checkUserIsNotSuperUser($userLogin); $db = Zend_Registry::get('db'); $users = $db->fetchAll("SELECT idsite,access - FROM ".Piwik_Common::prefixTable("access") + FROM ".Piwik::prefixTable("access") ." WHERE login = ?", $userLogin); $return = array(); foreach($users as $user) @@ -208,15 +170,15 @@ class Piwik_UsersManager_API * * @return array the user information */ - public function getUser( $userLogin ) + static public function getUser( $userLogin ) { - Piwik::checkUserIsSuperUserOrTheUser($userLogin); - $this->checkUserExists($userLogin); - $this->checkUserIsNotSuperUser($userLogin); + Piwik::checkUserIsSuperUser(); + self::checkUserExists($userLogin); + self::checkUserIsNotSuperUser($userLogin); $db = Zend_Registry::get('db'); $user = $db->fetchRow("SELECT * - FROM ".Piwik_Common::prefixTable("user") + FROM ".Piwik::prefixTable("user") ." WHERE login = ?", $userLogin); return $user; } @@ -228,39 +190,48 @@ class Piwik_UsersManager_API * * @return array the user information */ - public function getUserByEmail( $userEmail ) + static public function getUserByEmail( $userEmail ) { Piwik::checkUserIsSuperUser(); - $this->checkUserEmailExists($userEmail); + self::checkUserEmailExists($userEmail); $db = Zend_Registry::get('db'); $user = $db->fetchRow("SELECT * - FROM ".Piwik_Common::prefixTable("user") + FROM ".Piwik::prefixTable("user") ." WHERE email = ?", $userEmail); return $user; } - private function checkLogin($userLogin) + static private function checkLogin($userLogin) { - if($this->userExists($userLogin)) + if(self::userExists($userLogin)) { throw new Exception(Piwik_TranslateException('UsersManager_ExceptionLoginExists', $userLogin)); } - Piwik::checkValidLoginString($userLogin); + $loginMinimumLength = 3; + $loginMaximumLength = 100; + $l = strlen($userLogin); + if(!($l >= $loginMinimumLength + && $l <= $loginMaximumLength + && (preg_match('/^[A-Za-z0-9_.-]*$/', $userLogin) > 0)) + ) + { + throw new Exception(Piwik_TranslateException('UsersManager_ExceptionInvalidLoginFormat', array($loginMinimumLength, $loginMaximumLength))); + } } - private function checkPassword($password) + static private function checkPassword($password) { - if(!$this->isValidPasswordString($password)) + if(!self::isValidPasswordString($password)) { throw new Exception(Piwik_TranslateException('UsersManager_ExceptionInvalidPassword')); } } - private function checkEmail($email) + static private function checkEmail($email) { - if($this->userEmailExists($email)) + if(self::userEmailExists($email)) { throw new Exception(Piwik_TranslateException('UsersManager_ExceptionEmailExists', $email)); } @@ -271,7 +242,7 @@ class Piwik_UsersManager_API } } - private function getCleanAlias($alias,$userLogin) + static private function getCleanAlias($alias,$userLogin) { if(empty($alias)) { @@ -280,7 +251,7 @@ class Piwik_UsersManager_API return $alias; } - private function getCleanPassword($password) + static private function getCleanPassword($password) { // if change here, should also edit the installation process // to change how the root pwd is saved in the config file @@ -302,30 +273,29 @@ class Piwik_UsersManager_API * * @exception in case of an invalid parameter */ - public function addUser( $userLogin, $password, $email, $alias = false ) + static public function addUser( $userLogin, $password, $email, $alias = false ) { Piwik::checkUserIsSuperUser(); - $this->checkLogin($userLogin); - $this->checkUserIsNotSuperUser($userLogin); - $this->checkPassword($password); - $this->checkEmail($email); + self::checkLogin($userLogin); + self::checkUserIsNotSuperUser($userLogin); + self::checkPassword($password); + self::checkEmail($email); - $alias = $this->getCleanAlias($alias,$userLogin); - $passwordTransformed = $this->getCleanPassword($password); + $alias = self::getCleanAlias($alias,$userLogin); + $passwordTransformed = self::getCleanPassword($password); - $token_auth = $this->getTokenAuth($userLogin, $passwordTransformed); + $token_auth = self::getTokenAuth($userLogin, $passwordTransformed); $db = Zend_Registry::get('db'); - $db->insert( Piwik_Common::prefixTable("user"), array( + $db->insert( Piwik::prefixTable("user"), array( 'login' => $userLogin, 'password' => $passwordTransformed, 'alias' => $alias, 'email' => $email, 'token_auth' => $token_auth, - 'date_registered' => Piwik_Date::now()->getDatetime() - ) + ) ); // we reload the access list which doesn't yet take in consideration this new user @@ -341,12 +311,12 @@ class Piwik_UsersManager_API * * @see addUser() for all the parameters */ - public function updateUser( $userLogin, $password = false, $email = false, $alias = false ) + static public function updateUser( $userLogin, $password = false, $email = false, $alias = false ) { Piwik::checkUserIsSuperUserOrTheUser($userLogin); - $this->checkUserIsNotAnonymous( $userLogin ); - $this->checkUserIsNotSuperUser($userLogin); - $userInfo = $this->getUser($userLogin); + self::checkUserIsNotAnonymous( $userLogin ); + self::checkUserIsNotSuperUser($userLogin); + $userInfo = self::getUser($userLogin); if(empty($password)) { @@ -354,8 +324,8 @@ class Piwik_UsersManager_API } else { - $this->checkPassword($password); - $password = $this->getCleanPassword($password); + self::checkPassword($password); + $password = self::getCleanPassword($password); } if(empty($alias)) @@ -370,15 +340,15 @@ class Piwik_UsersManager_API if($email != $userInfo['email']) { - $this->checkEmail($email); + self::checkEmail($email); } - $alias = $this->getCleanAlias($alias,$userLogin); - $token_auth = $this->getTokenAuth($userLogin,$password); + $alias = self::getCleanAlias($alias,$userLogin); + $token_auth = self::getTokenAuth($userLogin,$password); $db = Zend_Registry::get('db'); - $db->update( Piwik_Common::prefixTable("user"), + $db->update( Piwik::prefixTable("user"), array( 'password' => $password, 'alias' => $alias, @@ -398,18 +368,19 @@ class Piwik_UsersManager_API * * @return bool true on success */ - public function deleteUser( $userLogin ) + static public function deleteUser( $userLogin ) { Piwik::checkUserIsSuperUser(); - $this->checkUserIsNotAnonymous( $userLogin ); - $this->checkUserIsNotSuperUser($userLogin); - if(!$this->userExists($userLogin)) + self::checkUserIsNotAnonymous( $userLogin ); + self::checkUserIsNotSuperUser($userLogin); + if(!self::userExists($userLogin)) { throw new Exception(Piwik_TranslateException("UsersManager_ExceptionDeleteDoesNotExist", $userLogin)); } - $this->deleteUserOnly( $userLogin ); - $this->deleteUserAccess( $userLogin ); + + self::deleteUserOnly( $userLogin ); + self::deleteUserAccess( $userLogin ); } /** @@ -417,10 +388,11 @@ class Piwik_UsersManager_API * * @return bool true if the user is known */ - public function userExists( $userLogin ) + static public function userExists( $userLogin ) { + Piwik::checkUserHasSomeAdminAccess(); $count = Piwik_FetchOne("SELECT count(*) - FROM ".Piwik_Common::prefixTable("user"). " + FROM ".Piwik::prefixTable("user"). " WHERE login = ?", $userLogin); return $count != 0; } @@ -430,11 +402,11 @@ class Piwik_UsersManager_API * * @return bool true if the user is known */ - public function userEmailExists( $userEmail ) + static public function userEmailExists( $userEmail ) { Piwik::checkUserHasSomeAdminAccess(); $count = Piwik_FetchOne("SELECT count(*) - FROM ".Piwik_Common::prefixTable("user"). " + FROM ".Piwik::prefixTable("user"). " WHERE email = ?", $userEmail); return $count != 0; } @@ -456,11 +428,11 @@ class Piwik_UsersManager_API * * @return bool true on success */ - public function setUserAccess( $userLogin, $access, $idSites) + static public function setUserAccess( $userLogin, $access, $idSites) { - $this->checkAccessType( $access ); - $this->checkUserExists( $userLogin); - $this->checkUserIsNotSuperUser($userLogin); + self::checkAccessType( $access ); + self::checkUserExists( $userLogin); + self::checkUserIsNotSuperUser($userLogin); if($userLogin == 'anonymous' && $access == 'admin') @@ -472,7 +444,7 @@ class Piwik_UsersManager_API // has an 'admin' access if($idSites === 'all') { - $idSites = Piwik_SitesManager_API::getInstance()->getSitesIdWithAdminAccess(); + $idSites = Piwik_SitesManager_API::getSitesIdWithAdminAccess(); } // in case the idSites is an integer we build an array elseif(!is_array($idSites)) @@ -484,7 +456,7 @@ class Piwik_UsersManager_API // basically an admin can give the view or the admin access to any user for the websites he manages Piwik::checkUserHasAdminAccess( $idSites ); - $this->deleteUserAccess( $userLogin, $idSites); + self::deleteUserAccess( $userLogin, $idSites); // delete UserAccess $db = Zend_Registry::get('db'); @@ -495,7 +467,7 @@ class Piwik_UsersManager_API { foreach($idSites as $idsite) { - $db->insert( Piwik_Common::prefixTable("access"), + $db->insert( Piwik::prefixTable("access"), array( "idsite" => $idsite, "login" => $userLogin, "access" => $access) @@ -513,9 +485,9 @@ class Piwik_UsersManager_API * @param string user login * @exception if the user doesn't exist */ - private function checkUserExists( $userLogin ) + static private function checkUserExists( $userLogin ) { - if(!$this->userExists($userLogin)) + if(!self::userExists($userLogin)) { throw new Exception(Piwik_TranslateException("UsersManager_ExceptionUserDoesNotExist", $userLogin)); } @@ -527,22 +499,22 @@ class Piwik_UsersManager_API * @param string user email * @exception if the user doesn't exist */ - private function checkUserEmailExists( $userEmail ) + static private function checkUserEmailExists( $userEmail ) { - if(!$this->userEmailExists($userEmail)) + if(!self::userEmailExists($userEmail)) { throw new Exception(Piwik_TranslateException("UsersManager_ExceptionUserDoesNotExist", $userEmail)); } } - private function checkUserIsNotAnonymous( $userLogin ) + static private function checkUserIsNotAnonymous( $userLogin ) { if($userLogin == 'anonymous') { throw new Exception(Piwik_TranslateException("UsersManager_ExceptionEditAnonymous")); } } - private function checkUserIsNotSuperUser( $userLogin ) + static private function checkUserIsNotSuperUser( $userLogin ) { if($userLogin == Zend_Registry::get('config')->superuser->login) { @@ -550,7 +522,7 @@ class Piwik_UsersManager_API } } - private function checkAccessType($access) + static private function checkAccessType($access) { $accessList = Piwik_Access::getListAccess(); @@ -570,12 +542,10 @@ class Piwik_UsersManager_API * @param string the user login. * */ - private function deleteUserOnly( $userLogin ) + static private function deleteUserOnly( $userLogin ) { $db = Zend_Registry::get('db'); - $db->query("DELETE FROM ".Piwik_Common::prefixTable("user")." WHERE login = ?", $userLogin); - - Piwik_PostEvent('UsersManager.deleteUser', $userLogin); + $db->query("DELETE FROM ".Piwik::prefixTable("user")." WHERE login = ?", $userLogin); } @@ -588,13 +558,13 @@ class Piwik_UsersManager_API * * @return bool true on success */ - private function deleteUserAccess( $userLogin, $idSites = null ) + static private function deleteUserAccess( $userLogin, $idSites = null ) { $db = Zend_Registry::get('db'); if(is_null($idSites)) { - $db->query( "DELETE FROM ".Piwik_Common::prefixTable("access"). + $db->query( "DELETE FROM ".Piwik::prefixTable("access"). " WHERE login = ?", array( $userLogin) ); } @@ -602,7 +572,7 @@ class Piwik_UsersManager_API { foreach($idSites as $idsite) { - $db->query( "DELETE FROM ".Piwik_Common::prefixTable("access"). + $db->query( "DELETE FROM ".Piwik::prefixTable("access"). " WHERE idsite = ? AND login = ?", array($idsite, $userLogin) ); @@ -616,11 +586,12 @@ class Piwik_UsersManager_API * @param string Login * @param string MD5ied string of the password */ - public function getTokenAuth($userLogin, $md5Password) + static public function getTokenAuth($userLogin, $md5Password) { if(strlen($md5Password) != 32) { - throw new Exception(Piwik_TranslateException('UsersManager_ExceptionPasswordMD5HashExpected')); + throw new Exception("UsersManager.getTokenAuth is expecting a MD5-hashed password (32 chars long string). + Please call the md5() function on the password before calling this method."); } return md5($userLogin . $md5Password ); } @@ -631,7 +602,7 @@ class Piwik_UsersManager_API * @param string email * @return bool */ - private function isValidPasswordString( $input ) + static private function isValidPasswordString( $input ) { $l = strlen($input); return $l >= 6 && $l <= 26; diff --git a/plugins/UsersManager/Controller.php b/plugins/UsersManager/Controller.php index 4ac8dca17f..630efcefb9 100644 --- a/plugins/UsersManager/Controller.php +++ b/plugins/UsersManager/Controller.php @@ -17,14 +17,11 @@ */ class Piwik_UsersManager_Controller extends Piwik_Controller { - /** - * The "Manage Users and Permissions" Admin UI screen - */ function index() { $view = Piwik_View::factory('UsersManager'); - $IdSitesAdmin = Piwik_SitesManager_API::getInstance()->getSitesIdWithAdminAccess(); + $IdSitesAdmin = Piwik_SitesManager_API::getSitesIdWithAdminAccess(); $idSiteSelected = 1; if(count($IdSitesAdmin) > 0) @@ -39,272 +36,38 @@ class Piwik_UsersManager_Controller extends Piwik_Controller } else { - $usersAccessByWebsite = Piwik_UsersManager_API::getInstance()->getUsersAccessFromSite( $idSiteSelected ); + $usersAccessByWebsite = Piwik_UsersManager_API::getUsersAccessFromSite( $idSiteSelected ); } // requires super user access - $usersLogin = Piwik_UsersManager_API::getInstance()->getUsersLogin(); + $usersLogin = Piwik_UsersManager_API::getUsersLogin(); // we dont want to display the user currently logged so that the user can't change his settings from admin to view... $currentlyLogged = Piwik::getCurrentUserLogin(); + foreach($usersLogin as $login) { - if(!isset($usersAccessByWebsite[$login])) + if( $login != $currentlyLogged + && !isset($usersAccessByWebsite[$login])) { $usersAccessByWebsite[$login] = 'noaccess'; } } - unset($usersAccessByWebsite[$currentlyLogged]); - ksort($usersAccessByWebsite); $users = array(); if(Zend_Registry::get('access')->isSuperUser()) { - $users = Piwik_UsersManager_API::getInstance()->getUsers(); + $users = Piwik_UsersManager_API::getUsers(); } $view->idSiteSelected = $idSiteSelected; $view->users = $users; $view->usersAccessByWebsite = $usersAccessByWebsite; $view->formUrl = Piwik_Url::getCurrentUrl(); - $view->websites = Piwik_SitesManager_API::getInstance()->getSitesWithAdminAccess(); - $this->setGeneralVariablesView($view); - $view->menu = Piwik_GetAdminMenu(); - echo $view->render(); - } - - const DEFAULT_DATE = 'today'; - - /** - * The "User Settings" admin UI screen view - */ - public function userSettings() - { - $view = Piwik_View::factory('userSettings'); - - $userLogin = Piwik::getCurrentUserLogin(); - if(Piwik::isUserIsSuperUser()) - { - $view->userAlias = $userLogin; - $view->userEmail = Zend_Registry::get('config')->superuser->email; - if(!Zend_Registry::get('config')->isFileWritable()) - { - $view->configFileNotWritable = true; - } - } - else - { - $user = Piwik_UsersManager_API::getInstance()->getUser($userLogin); - $view->userAlias = $user['alias']; - $view->userEmail = $user['email']; - } - - $defaultReport = Piwik_UsersManager_API::getInstance()->getUserPreference($userLogin, Piwik_UsersManager_API::PREFERENCE_DEFAULT_REPORT); - if($defaultReport === false) - { - $defaultReport = $this->getDefaultWebsiteId(); - } - $view->defaultReport = $defaultReport; - - $defaultDate = Piwik_UsersManager_API::getInstance()->getUserPreference($userLogin, Piwik_UsersManager_API::PREFERENCE_DEFAULT_REPORT_DATE); - if($defaultDate === false) - { - $defaultDate = self::DEFAULT_DATE; - } - $view->defaultDate = $defaultDate; - $view->availableDefaultDates = array( - 'today' => Piwik_Translate('General_Today'), - 'yesterday' => Piwik_Translate('General_Yesterday'), - 'week' => Piwik_Translate('General_CurrentWeek'), - 'month' => Piwik_Translate('General_CurrentMonth'), - 'year' => Piwik_Translate('General_CurrentYear'), - ); - - $view->ignoreCookieSet = $this->isIgnoreCookieFound(); - $this->initViewAnonymousUserSettings($view); - $view->piwikHost = Piwik_Url::getCurrentHost(); + $view->websites = Piwik_SitesManager_API::getSitesWithAdminAccess(); $this->setGeneralVariablesView($view); $view->menu = Piwik_GetAdminMenu(); echo $view->render(); } - - public function setIgnoreCookie() - { - Piwik::checkUserHasSomeViewAccess(); - $this->checkTokenInUrl(); - $cookie = $this->getIgnoreCookie(); - if($cookie->isCookieFound()) - { - $cookie->delete(); - } - else - { - $cookie->save(); - } - Piwik::redirectToModule('UsersManager', 'userSettings'); - } - - protected function getIgnoreCookie() - { - $cookie_name = Zend_Registry::get('config')->Tracker->ignore_visits_cookie_name; - $cookie_path = Zend_Registry::get('config')->Tracker->cookie_path; - return new Piwik_Cookie($cookie_name, null, $cookie_path); - } - - protected function isIgnoreCookieFound() - { - $cookie = $this->getIgnoreCookie(); - return $cookie->isCookieFound(); - } - - /** - * The Super User can modify Anonymous user settings - * @param $view - */ - protected function initViewAnonymousUserSettings($view) - { - if(!Piwik::isUserIsSuperUser()) - { - return; - } - $userLogin = 'anonymous'; - - // Which websites are available to the anonymous users? - $anonymousSitesAccess = Piwik_UsersManager_API::getInstance()->getSitesAccessFromUser($userLogin); - $anonymousSites = array(); - foreach($anonymousSitesAccess as $info) - { - $idSite = $info['site']; - $anonymousSites[$idSite] = Piwik_SitesManager_API::getInstance()->getSiteFromId($idSite); - } - $view->anonymousSites = $anonymousSites; - - // Which report is displayed by default to the anonymous user? - $anonymousDefaultReport = Piwik_UsersManager_API::getInstance()->getUserPreference($userLogin, Piwik_UsersManager_API::PREFERENCE_DEFAULT_REPORT); - if($anonymousDefaultReport === false) - { - if(empty($anonymousSites)) - { - $anonymousDefaultReport = Piwik::getLoginPluginName(); - } - else - { - // we manually imitate what would happen, in case the anonymous user logs in - // and is redirected to the first website available to him in the list - // @see getDefaultWebsiteId() - reset($anonymousSites); - $anonymousDefaultReport = key($anonymousSites); - } - } - $view->anonymousDefaultReport = $anonymousDefaultReport; - - $anonymousDefaultDate = Piwik_UsersManager_API::getInstance()->getUserPreference($userLogin, Piwik_UsersManager_API::PREFERENCE_DEFAULT_REPORT_DATE); - if($anonymousDefaultDate === false) - { - $anonymousDefaultDate = self::DEFAULT_DATE; - } - $view->anonymousDefaultDate = $anonymousDefaultDate; - } - - /** - * Records settings for the anonymous users (default report, default date) - */ - public function recordAnonymousUserSettings() - { - $response = new Piwik_API_ResponseBuilder(Piwik_Common::getRequestVar('format')); - try { - Piwik::checkUserIsSuperUser(); - $this->checkTokenInUrl(); - $anonymousDefaultReport = Piwik_Common::getRequestVar('anonymousDefaultReport'); - $anonymousDefaultDate = Piwik_Common::getRequestVar('anonymousDefaultDate'); - $userLogin = 'anonymous'; - Piwik_UsersManager_API::getInstance()->setUserPreference($userLogin, - Piwik_UsersManager_API::PREFERENCE_DEFAULT_REPORT, - $anonymousDefaultReport); - Piwik_UsersManager_API::getInstance()->setUserPreference($userLogin, - Piwik_UsersManager_API::PREFERENCE_DEFAULT_REPORT_DATE, - $anonymousDefaultDate); - $toReturn = $response->getResponse(); - } catch(Exception $e ) { - $toReturn = $response->getResponseException( $e ); - } - echo $toReturn; - } - - /** - * Records settings from the "User Settings" page - */ - public function recordUserSettings() - { - $response = new Piwik_API_ResponseBuilder(Piwik_Common::getRequestVar('format')); - try { - $this->checkTokenInUrl(); - $alias = Piwik_Common::getRequestVar('alias'); - $email = Piwik_Common::getRequestVar('email'); - $defaultReport = Piwik_Common::getRequestVar('defaultReport'); - $defaultDate = Piwik_Common::getRequestVar('defaultDate'); - - $newPassword = false; - $password = Piwik_Common::getRequestvar('password', false); - $passwordBis = Piwik_Common::getRequestvar('passwordBis', false); - if(!empty($password) - || !empty($passwordBis)) - { - if($password != $passwordBis) - { - throw new Exception(Piwik_Translate('Login_PasswordsDoNotMatch')); - } - $newPassword = $password; - } - - $userLogin = Piwik::getCurrentUserLogin(); - if(Piwik::isUserIsSuperUser()) - { - $superUser = Zend_Registry::get('config')->superuser; - $updatedSuperUser = false; - if($newPassword !== false) - { - $md5PasswordSuperUser = md5($newPassword); - $superUser->password = $md5PasswordSuperUser; - $updatedSuperUser = true; - } - if($superUser->email != $email) - { - $superUser->email = $email; - $updatedSuperUser = true; - } - if($updatedSuperUser) - { - Zend_Registry::get('config')->superuser = $superUser->toArray(); - } - } - else - { - Piwik_UsersManager_API::getInstance()->updateUser($userLogin, $newPassword, $email, $alias); - } - - // logs the user in with the new password - if($newPassword !== false) - { - $info = array( 'login' => $userLogin, - 'md5Password' => md5($newPassword), - ); - Piwik_PostEvent('Login.initSession', $info); - } - - Piwik_UsersManager_API::getInstance()->setUserPreference($userLogin, - Piwik_UsersManager_API::PREFERENCE_DEFAULT_REPORT, - $defaultReport); - Piwik_UsersManager_API::getInstance()->setUserPreference($userLogin, - Piwik_UsersManager_API::PREFERENCE_DEFAULT_REPORT_DATE, - $defaultDate); - - $toReturn = $response->getResponse(); - } catch(Exception $e ) { - $toReturn = $response->getResponseException( $e ); - } - echo $toReturn; - } - } diff --git a/plugins/UsersManager/UsersManager.php b/plugins/UsersManager/UsersManager.php index 5471a75658..10fe88a003 100644 --- a/plugins/UsersManager/UsersManager.php +++ b/plugins/UsersManager/UsersManager.php @@ -19,10 +19,11 @@ class Piwik_UsersManager extends Piwik_Plugin public function getInformation() { $info = array( - 'description' => Piwik_Translate('UsersManager_PluginDescription'), + 'name' => 'Users Management', + 'description' => 'Users Management in Piwik: add a new User, edit an existing one, update the permissions. All the actions are also available through the API.', 'author' => 'Piwik', - 'author_homepage' => 'http://piwik.org/', - 'version' => Piwik_Version::VERSION, + 'homepage' => 'http://piwik.org/', + 'version' => '0.1', ); return $info; @@ -35,14 +36,7 @@ class Piwik_UsersManager extends Piwik_Plugin function addMenu() { - Piwik_AddAdminMenu('UsersManager_MenuUsers', - array('module' => 'UsersManager', 'action' => 'index'), - Piwik::isUserHasSomeAdminAccess(), - $order = 3); - Piwik_AddAdminMenu('UsersManager_MenuUserSettings', - array('module' => 'UsersManager', 'action' => 'userSettings'), - Piwik::isUserHasSomeViewAccess(), - $order = 1); + Piwik_AddAdminMenu('UsersManager_MenuUsers', array('module' => 'UsersManager', 'action' => 'index')); } } diff --git a/plugins/UsersManager/templates/UsersManager.js b/plugins/UsersManager/templates/UsersManager.js index 068b56785e..dd08e2ae90 100644 --- a/plugins/UsersManager/templates/UsersManager.js +++ b/plugins/UsersManager/templates/UsersManager.js @@ -1,17 +1,7 @@ -function changeSite() -{ - var action = $('form#accessSites').attr('action'); - var idsite = getIdSites(); - - action = action + '&idsite=' + idsite; - - window.location = action; - return false; -} - function getUpdateUserAJAX( row ) { - var ajaxRequest = piwikHelper.getStandardAjaxConf('ajaxLoadingUsersManagement', 'ajaxErrorUsersManagement'); + var ajaxRequest = piwikHelper.getStandardAjaxConf(); + piwikHelper.toggleAjaxLoading(); var parameters = {}; parameters.module = 'API'; @@ -31,7 +21,8 @@ function getUpdateUserAJAX( row ) function getDeleteUserAJAX( login ) { - var ajaxRequest = piwikHelper.getStandardAjaxConf('ajaxLoadingUsersManagement', 'ajaxErrorUsersManagement'); + var ajaxRequest = piwikHelper.getStandardAjaxConf(); + piwikHelper.toggleAjaxLoading(); var parameters = {}; parameters.module = 'API'; @@ -47,7 +38,8 @@ function getDeleteUserAJAX( login ) function getAddUserAJAX( row ) { - var ajaxRequest = piwikHelper.getStandardAjaxConf('ajaxLoadingUsersManagement', 'ajaxErrorUsersManagement'); + var ajaxRequest = piwikHelper.getStandardAjaxConf(); + piwikHelper.toggleAjaxLoading(); var parameters = {}; parameters.module = 'API'; @@ -118,16 +110,15 @@ function bindUpdateAccess() // callback called when the ajax request Update the user permissions is successful function successCallback (response) { - piwikHelper.hideAjaxLoading(); // if the permission couldn't be granted if(response.result == "error") { - piwikHelper.showAjaxError(response.message); + piwikHelper.ajaxShowError(response.message); } // if the permission change was successful else { - piwikHelper.hideAjaxError(); + piwikHelper.ajaxHideError(); $(self).parent().parent().find('.accessGranted') .attr("src","plugins/UsersManager/images/no-access.png" ) @@ -172,7 +163,7 @@ $(document).ready( function() { // when click on edituser, the cells become editable $('.edituser') .click( function() { - piwikHelper.hideAjaxError(); + piwikHelper.ajaxHideError(); var idRow = $(this).attr('id'); if(alreadyEdited[idRow]==1) return; alreadyEdited[idRow] = 1; @@ -184,7 +175,7 @@ $(document).ready( function() { var idName = $(n).attr('id'); if(idName != 'userLogin') { - var contentAfter = '<input id="'+idName+'" value="'+contentBefore+'" size="25" />'; + var contentAfter = '<input id="'+idName+'" value="'+contentBefore+'" size="25">'; $(n).html(contentAfter); } } @@ -193,7 +184,7 @@ $(document).ready( function() { $(this) .toggle() .parent() - .prepend( $('<img src="plugins/UsersManager/images/ok.png" class="updateuser" />') + .prepend( $('<img src="plugins/UsersManager/images/ok.png" class="updateuser">') .click( function(){ $.ajax( getUpdateUserAJAX( $('tr#'+idRow) ) ); } ) ); }); @@ -206,7 +197,7 @@ $(document).ready( function() { // when click on deleteuser, the we ask for confirmation and then delete the user $('.deleteuser') .click( function() { - piwikHelper.hideAjaxError(); + piwikHelper.ajaxHideError(); var idRow = $(this).attr('id'); var loginToDelete = $(this).parent().parent().find('#userLogin').html(); if( confirm(sprintf(_pk_translate('UsersManager_DeleteConfirm_js'),'"'+loginToDelete+'"')) ) @@ -217,7 +208,7 @@ $(document).ready( function() { ); $('.addrow').click( function() { - piwikHelper.hideAjaxError(); + piwikHelper.ajaxHideError(); $(this).toggle(); var numberOfRows = $('table#users')[0].rows.length; @@ -225,22 +216,21 @@ $(document).ready( function() { var newRowId = 'row' + newRowId; $(' <tr id="'+newRowId+'">\ - <td><input id="useradd_login" value="login?" size="10" /></td>\ - <td><input id="useradd_password" value="password" size="10" /></td>\ - <td><input id="useradd_email" value="email@domain.com" size="15" /></td>\ - <td><input id="useradd_alias" value="alias" size="15" /></td>\ + <td><input id="useradd_login" value="login?" size=10></td>\ + <td><input id="useradd_password" value="password" size=10></td>\ + <td><input id="useradd_email" value="email@domain.com" size=15></td>\ + <td><input id="useradd_alias" value="alias" size=15></td>\ <td>-</td>\ - <td><img src="plugins/UsersManager/images/ok.png" class="adduser" /></td>\ - <td><img src="plugins/UsersManager/images/remove.png" class="cancel" /></td>\ + <td><img src="plugins/UsersManager/images/ok.png" class="adduser"></td>\ + <td><img src="plugins/UsersManager/images/remove.png" class="cancel"></td>\ </tr>') .appendTo('#users') ; $('#'+newRowId).keypress( submitOnEnter ); $('.adduser').click( function(){ $.ajax( getAddUserAJAX($('tr#'+newRowId)) ); } ); - $('.cancel').click(function() { piwikHelper.hideAjaxError(); $(this).parents('tr').remove(); $('.addrow').toggle(); }); + $('.cancel').click(function() { piwikHelper.ajaxHideError(); $(this).parents('tr').remove(); $('.addrow').toggle(); }); }); $('.updateAccess') .click( bindUpdateAccess ); - $('#accessUpdated').hide(); }); diff --git a/plugins/UsersManager/templates/UsersManager.tpl b/plugins/UsersManager/templates/UsersManager.tpl index ecd42dcd30..be8b398c82 100644 --- a/plugins/UsersManager/templates/UsersManager.tpl +++ b/plugins/UsersManager/templates/UsersManager.tpl @@ -2,6 +2,7 @@ {assign var=showPeriodSelection value=false} {include file="CoreAdminHome/templates/header.tpl"} {loadJavascriptTranslations plugins='UsersManager'} +{include file="CoreAdminHome/templates/menu.tpl"} {literal} <style> @@ -15,6 +16,17 @@ text-align:center; } +#accessUpdated { + color: red; + text-align: center; + font-weight: bold; + width: 350px; + margin: 10px; + padding: 10px; + display: none; + border: 3px solid green; + color: green; +} #access td, #users td { spacing: 0px; padding: 2px 5px 5px 4px; @@ -44,7 +56,7 @@ <p>{'UsersManager_MainDescription'|translate}</p> <div id="sites"> <form method="post" action="{url action=index}" id="accessSites"> - <p>{'UsersManager_Sites'|translate}: <select id="selectIdsite" name="idsite" onchange="changeSite()"> + <p>{'UsersManager_Sites'|translate}: <select id="selectIdsite" name="idsite" onchange="this.form.submit()"> <optgroup label="{'UsersManager_AllWebsites'|translate}"> <option label="{'UsersManager_AllWebsites'|translate}" value="all" {if $idSiteSelected=='all'} selected="selected"{/if}>{'UsersManager_ApplyToAllWebsites'|translate}</option> @@ -60,10 +72,6 @@ </form> </div> -{ajaxErrorDiv} -{ajaxLoadingDiv} -<div id="accessUpdated" class="ajaxSuccess"><p>{'General_Done'|translate}!</p></div> - <table class="admin" id="access"> <thead> <tr> @@ -75,9 +83,9 @@ </thead> <tbody> -{assign var=accesValid value="<img src='plugins/UsersManager/images/ok.png' class='accessGranted' />"} -{assign var=accesInvalid value="<img src='plugins/UsersManager/images/no-access.png' class='updateAccess' />"} {foreach from=$usersAccessByWebsite key=login item=access} +{assign var=accesValid value="<img src='plugins/UsersManager/images/ok.png' class='accessGranted'>"} +{assign var=accesInvalid value="<img src='plugins/UsersManager/images/no-access.png' class='updateAccess'>"} <tr> <td id='login'>{$login}</td> <td id='noaccess'>{if $access=='noaccess' and $idSiteSelected!='all'}{$accesValid}{else}{$accesInvalid}{/if} </td> @@ -88,24 +96,24 @@ </tbody> </table> +<div id="accessUpdated">{'General_Done'|translate}!</div> + <div class="dialog" id="confirm"> <p>{'UsersManager_ChangeAllConfirm'|translate:"<span id='login'></span>"}</p> - <input id="yes" type="button" value="{'General_Yes'|translate}" /> - <input id="no" type="button" value="{'General_No'|translate}" /> + <input id="yes" type="button" value="{'General_Yes'|translate}"/> + <input id="no" type="button" value="{'General_No'|translate}"/> </div> {if $userIsSuperUser} - <br /> + <br/> <h2>{'UsersManager_UsersManagement'|translate}</h2> <p>{'UsersManager_UsersManagementMainDescription'|translate}</p> - - {ajaxErrorDiv id=ajaxErrorUsersManagement} - {ajaxLoadingDiv id=ajaxLoadingUsersManagement} - + <div id="ajaxError" style="display:none"></div> + <div id="ajaxLoading" style="display:none"><div id="loadingPiwik"><img src="themes/default/images/loading-blue.gif" alt="" /> {'General_LoadingData'|translate}</div></div> <table class="admin" id="users"> <thead> <tr> - <th>{'General_Username'|translate}</th> + <th>{'UsersManager_Login'|translate}</th> <th>{'UsersManager_Password'|translate}</th> <th>{'UsersManager_Email'|translate}</th> <th>{'UsersManager_Alias'|translate}</th> @@ -124,15 +132,15 @@ <td id="email" class="editable">{$user.email}</td> <td id="alias" class="editable">{$user.alias}</td> <td id="alias">{$user.token_auth}</td> - <td><img src='plugins/UsersManager/images/edit.png' class="edituser" id="row{$i}" href='#' /></td> - <td><img src='plugins/UsersManager/images/remove.png' class="deleteuser" id="row{$i}" value="Delete" /></td> + <td><img src='plugins/UsersManager/images/edit.png' class="edituser" id="row{$i}" href='#'></td> + <td><img src='plugins/UsersManager/images/remove.png' class="deleteuser" id="row{$i}" value="Delete"></td> </tr> {/if} {/foreach} </tbody> </table> - <div class="addrow"><a href="#"><img src='plugins/UsersManager/images/add.png' /> {'UsersManager_AddUser'|translate}</a></div> + <div class="addrow"><a href="#"><img src='plugins/UsersManager/images/add.png'> {'UsersManager_AddUser'|translate}</a></div> {/if} {include file="CoreAdminHome/templates/footer.tpl"} diff --git a/plugins/UsersManager/templates/userSettings.js b/plugins/UsersManager/templates/userSettings.js deleted file mode 100644 index 87ac2877ea..0000000000 --- a/plugins/UsersManager/templates/userSettings.js +++ /dev/null @@ -1,60 +0,0 @@ -function getUserSettingsAJAX() -{ - var ajaxRequest = piwikHelper.getStandardAjaxConf('ajaxLoadingUserSettings', 'ajaxErrorUserSettings'); - var alias = $('#alias').val(); - var email = $('#email').val(); - var password = $('#password').val(); - var passwordBis = $('#passwordBis').val(); - var defaultReport = $('input[name=defaultReport]:checked').val(); - if(defaultReport == 1) { - defaultReport = $('#defaultReportWebsite option:selected').val(); - } - var defaultDate = $('input[name=defaultDate]:checked').val(); - var request = ''; - request += 'module=UsersManager'; - request += '&action=recordUserSettings'; - request += '&format=json'; - request += '&alias='+alias; - request += '&email='+email; - request += '&password='+password; - request += '&passwordBis='+passwordBis; - request += '&defaultReport='+defaultReport; - request += '&defaultDate='+defaultDate; - request += '&token_auth=' + piwik.token_auth; - ajaxRequest.data = request; - return ajaxRequest; -} -function getAnonymousUserSettingsAJAX() -{ - var ajaxRequest = piwikHelper.getStandardAjaxConf('ajaxLoadingAnonymousUserSettings', 'ajaxErrorAnonymousUserSettings'); - var anonymousDefaultReport = $('input[name=anonymousDefaultReport]:checked').val(); - if(anonymousDefaultReport == 1) { - anonymousDefaultReport = $('#anonymousDefaultReportWebsite option:selected').val(); - } - var anonymousDefaultDate = $('input[name=anonymousDefaultDate]:checked').val(); - var request = ''; - request += 'module=UsersManager'; - request += '&action=recordAnonymousUserSettings'; - request += '&format=json'; - request += '&anonymousDefaultReport='+anonymousDefaultReport; - request += '&anonymousDefaultDate='+anonymousDefaultDate; - request += '&token_auth=' + piwik.token_auth; - ajaxRequest.data = request; - return ajaxRequest; -} - -$(document).ready( function() { - $('#userSettingsSubmit').click( function() { - $.ajax( getUserSettingsAJAX() ); - }); - $('#userSettingsTable input').keypress( function(e) { - var key=e.keyCode || e.which; - if (key==13) { - $('#userSettingsSubmit').click(); - }}); - - $('#anonymousUserSettingsSubmit').click( function() { - $.ajax( getAnonymousUserSettingsAJAX() ); - }); -}); - diff --git a/plugins/UsersManager/templates/userSettings.tpl b/plugins/UsersManager/templates/userSettings.tpl deleted file mode 100644 index c4b18b2cbd..0000000000 --- a/plugins/UsersManager/templates/userSettings.tpl +++ /dev/null @@ -1,130 +0,0 @@ -{assign var=showSitesSelection value=false} -{assign var=showPeriodSelection value=false} -{include file="CoreAdminHome/templates/header.tpl"} -{loadJavascriptTranslations plugins='UsersManager'} -<script type="text/javascript" src="plugins/UsersManager/templates/userSettings.js"></script> -<h2>{'UsersManager_MenuUserSettings'|translate}</h2> - -<br /> -<table id='userSettingsTable' class="adminTable adminTableNoBorder" style='width:1000px'> -<tr> - <td><label for="username">{'General_Username'|translate} </label></td> - <td> - <input size="25" value="{$userLogin}" id="username" disabled="disabled" /> - <span class='form-description'>{'UsersManager_YourUsernameCannotBeChanged'|translate}</span> - </td> -</tr> - -<tr> - <td><label for="alias">{'UsersManager_Alias'|translate} </label></td> - <td><input size="25" value="{$userAlias}" id="alias"{if $isSuperUser} disabled="disabled"{/if} /> - {if $isSuperUser} - <span class='form-description'> - {'UsersManager_TheSuperUserAliasCannotBeChanged'|translate} - </span> - {/if} - </td> -</td> -</tr> -<tr> - <td><label for="email">{'UsersManager_Email'|translate} </label></td> - <td><input size="25" value="{$userEmail}" id="email" /></td> -</tr> -<tr> - <td>{'UsersManager_ReportToLoadByDefault'|translate}</td> - <td> - <fieldset> - <label><input type="radio" value="MultiSites" name="defaultReport"{if $defaultReport=='MultiSites'} checked="checked"{/if} /> {'General_AllWebsitesDashboard'|translate}</label><br /> - <label><input type="radio" value="1" name="defaultReport"{if $defaultReport!='MultiSites'} checked="checked"{/if} /> {'General_DashboardForASpecificWebsite'|translate}</label> - <select id="defaultReportWebsite"> - {if isset($sites)}{foreach from=$sites item=info} - <option value="{$info.idsite}" {if $defaultReport==$info.idsite} selected="selected"{/if}>{$info.name}</option> - {/foreach}{/if} - </select> - </fieldset> - </td> -</tr> -<tr> - <td>{'UsersManager_ReportDateToLoadByDefault'|translate}</td> - <td> - <fieldset> - {foreach from=$availableDefaultDates key=value item=description} - <label><input type="radio"{if $defaultDate==$value} checked="checked"{/if} value="{$value}" name="defaultDate" /> {$description}</label><br /> - {/foreach} - </fieldset> - </td> -</tr> - -<tr> - <td><label for="email">{'UsersManager_ChangePassword'|translate} </label></td> - <td><input size="25" value="" autocomplete="off" id="password" type="password" /> - <span class='form-description'>{'UsersManager_IfYouWouldLikeToChangeThePasswordTypeANewOne'|translate}</span> - <br /><input size="25" value="" autocomplete="off" id="passwordBis" type="password" /> - <span class='form-description'> {'UsersManager_TypeYourPasswordAgain'|translate}</span> - </td> -</tr> -</table> - -{ajaxErrorDiv id=ajaxErrorUserSettings} -{ajaxLoadingDiv id=ajaxLoadingUserSettings} -<input type="submit" value="{'General_Save'|translate}" id="userSettingsSubmit" class="submit" /> - -<br/><br/> -<a name='excludeCookie'></a><h2>{'UsersManager_ExcludeVisitsViaCookie'|translate}</h2> -<p>{if $ignoreCookieSet}{'UsersManager_YourVisitsAreIgnoredOnDomain'|translate:"<strong>":$piwikHost:"</strong>"} -{else}{'UsersManager_YourVisitsAreNotIgnored'|translate:"<strong>":"</strong>"}{/if}</p> -<span style='margin-left:20px'> -<a href='{url token_auth=$token_auth action=setIgnoreCookie}#excludeCookie'>› {if $ignoreCookieSet}{'UsersManager_ClickHereToDeleteTheCookie'|translate} -{else}{'UsersManager_ClickHereToSetTheCookieOnDomain'|translate:$piwikHost}{/if} -<br /> -</a></span> - -<br/><br/> -{if $isSuperUser} - <h2>{'UsersManager_MenuAnonymousUserSettings'|translate}</h2> - {if count($anonymousSites) == 0} - <br /><span class='form-description'><b>{'UsersManager_NoteNoAnonymousUserAccessSettingsWontBeUsed'|translate}</b></span><br /> - {/if} - <br /> - - {ajaxErrorDiv id=ajaxErrorAnonymousUserSettings} - {ajaxLoadingDiv id=ajaxLoadingAnonymousUserSettings} - - <table id='anonymousUserSettingsTable' class="adminTable adminTableNoBorder" style='width:800px'> - <tr> - <td style='width:400px'>{'UsersManager_WhenUsersAreNotLoggedInAndVisitPiwikTheyShouldAccess'|translate}</td> - <td> - <fieldset> - <label><input type="radio" value="Login" name="anonymousDefaultReport"{if $anonymousDefaultReport==$loginModule} checked="checked"{/if} /> {'UsersManager_TheLoginScreen'|translate}</label><br /> - <label><input {if empty($anonymousSites)}disabled="disabled" {/if}type="radio" value="MultiSites" name="anonymousDefaultReport"{if $anonymousDefaultReport=='MultiSites'} checked="checked"{/if} /> {'General_AllWebsitesDashboard'|translate}</label><br /> - - <label><input {if empty($anonymousSites)}disabled="disabled" {/if}type="radio" value="1" name="anonymousDefaultReport"{if $anonymousDefaultReport>0} checked="checked"{/if} /> {'General_DashboardForASpecificWebsite'|translate}</label> - {if !empty($anonymousSites)} - <select id="anonymousDefaultReportWebsite"> - {foreach from=$anonymousSites item=info} - <option value="{$info.idsite}" {if $anonymousDefaultReport==$info.idsite} selected="selected"{/if}>{$info.name}</option> - {/foreach} - </select> - {/if} - </fieldset> - </td> - </tr> - <tr> - <td>{'UsersManager_ForAnonymousUsersReportDateToLoadByDefault'|translate}</td> - <td> - <fieldset> - {foreach from=$availableDefaultDates key=value item=description} - <label><input type="radio" {if $anonymousDefaultDate==$value}checked="checked" {/if}value="{$value}" name="anonymousDefaultDate" /> {$description}</label><br /> - {/foreach} - </fieldset> - </td> - </tr> - - </table> - -<input type="submit" value="{'General_Save'|translate}" id="anonymousUserSettingsSubmit" class="submit" /> - -{/if} - - -{include file="CoreAdminHome/templates/footer.tpl"} diff --git a/plugins/UsersManager/tests/UsersManager.test.php b/plugins/UsersManager/tests/UsersManager.test.php index 6b8d8b6407..a76251d639 100644 --- a/plugins/UsersManager/tests/UsersManager.test.php +++ b/plugins/UsersManager/tests/UsersManager.test.php @@ -7,7 +7,7 @@ if(!defined('PIWIK_CONFIG_TEST_INCLUDED')) require_once PIWIK_PATH_TEST_TO_ROOT . "/tests/config_test.php"; } -require_once PIWIK_PATH_TEST_TO_ROOT . '/tests/core/Database.test.php'; +require_once "Database.test.php"; class Test_Piwik_UsersManager extends Test_Database { @@ -53,12 +53,12 @@ class Test_Piwik_UsersManager extends Test_Database { $newAlias = $user['alias']; } - $userAfter = Piwik_UsersManager_API::getInstance()->getUser($user["login"]); + $userAfter = Piwik_UsersManager_API::getUser($user["login"]); unset($userAfter['date_registered']); // we now compute what the token auth should be, it should always be a hash of the login and the current password // if the password has changed then the token_auth has changed! - $user['token_auth']= Piwik_UsersManager_API::getInstance()->getTokenAuth($user["login"], md5($newPassword) ); + $user['token_auth']= Piwik_UsersManager_API::getTokenAuth($user["login"], md5($newPassword) ); $user['password']=md5($newPassword); $user['email']=$newEmail; @@ -78,28 +78,28 @@ class Test_Piwik_UsersManager extends Test_Database 'password'=>"geqgeagae", 'email'=>"test@test.com", 'alias'=>"alias"); - Piwik_UsersManager_API::getInstance()->addUser($user['login'],$user['password'] ,$user['email'] ,$user['alias'] ); + Piwik_UsersManager_API::addUser($user['login'],$user['password'] ,$user['email'] ,$user['alias'] ); try { - Piwik_UsersManager_API::getInstance()->addUser('superusertest','te','fake@fale.co','ega'); + Piwik_UsersManager_API::addUser('superusertest','te','fake@fale.co','ega'); $this->fail(); } catch (Exception $expected) { $this->assertPattern("(UsersManager_ExceptionSuperUser)", $expected->getMessage()); } try { - Piwik_UsersManager_API::getInstance()->updateUser('superusertest','te','fake@fale.co','ega'); + Piwik_UsersManager_API::updateUser('superusertest','te','fake@fale.co','ega'); $this->fail(); } catch (Exception $expected) { $this->assertPattern("(UsersManager_ExceptionSuperUser)", $expected->getMessage()); } try { - Piwik_UsersManager_API::getInstance()->deleteUser('superusertest','te','fake@fale.co','ega'); + Piwik_UsersManager_API::deleteUser('superusertest','te','fake@fale.co','ega'); $this->fail(); } catch (Exception $expected) { $this->assertPattern("(UsersManager_ExceptionSuperUser)", $expected->getMessage()); } try { - Piwik_UsersManager_API::getInstance()->deleteUser('superusertest','te','fake@fale.co','ega'); + Piwik_UsersManager_API::deleteUser('superusertest','te','fake@fale.co','ega'); $this->fail(); } catch (Exception $expected) { $this->assertPattern("(UsersManager_ExceptionSuperUser)", $expected->getMessage()); @@ -117,11 +117,11 @@ class Test_Piwik_UsersManager extends Test_Database 'email'=>"test@test.com", 'alias'=>"alias"); - Piwik_UsersManager_API::getInstance()->addUser($user['login'],$user['password'] ,$user['email'] ,$user['alias'] ); + Piwik_UsersManager_API::addUser($user['login'],$user['password'] ,$user['email'] ,$user['alias'] ); try { - Piwik_UsersManager_API::getInstance()->updateUser( $login, "pas"); + Piwik_UsersManager_API::updateUser( $login, "pas"); } catch (Exception $expected) { $this->assertPattern("(UsersManager_ExceptionInvalidPassword)", $expected->getMessage()); @@ -140,7 +140,7 @@ class Test_Piwik_UsersManager extends Test_Database function test_addUser_wrongLogin1() { try { - Piwik_UsersManager_API::getInstance()->addUser(12, "password", "email@email.com", "alias"); + Piwik_UsersManager_API::addUser(12, "password", "email@email.com", "alias"); } catch (Exception $expected) { $this->assertPattern("(UsersManager_ExceptionInvalidLogin)", $expected->getMessage()); @@ -155,7 +155,7 @@ class Test_Piwik_UsersManager extends Test_Database function test_addUser_wrongLogin2() { try { - Piwik_UsersManager_API::getInstance()->addUser("gegag'ggea'", "password", "email@email.com", "alias"); + Piwik_UsersManager_API::addUser("gegag'ggea'", "password", "email@email.com", "alias"); } catch (Exception $expected) { $this->assertPattern("(UsersManager_ExceptionInvalidLogin)", $expected->getMessage()); @@ -169,7 +169,7 @@ class Test_Piwik_UsersManager extends Test_Database function test_addUser_wrongLogin3() { try { - Piwik_UsersManager_API::getInstance()->addUser("gegag11gge@", "password", "email@email.com", "alias"); + Piwik_UsersManager_API::addUser("gegag11gge@", "password", "email@email.com", "alias"); } catch (Exception $expected) { $this->assertPattern("(UsersManager_ExceptionInvalidLogin)", $expected->getMessage()); @@ -184,7 +184,7 @@ class Test_Piwik_UsersManager extends Test_Database function test_addUser_wrongLogin4() { try { - Piwik_UsersManager_API::getInstance()->addUser("geg'ag11gge@", "password", "email@email.com", "alias"); + Piwik_UsersManager_API::addUser("geg'ag11gge@", "password", "email@email.com", "alias"); } catch (Exception $expected) { $this->assertPattern("(UsersManager_ExceptionInvalidLogin)", $expected->getMessage()); @@ -199,8 +199,8 @@ class Test_Piwik_UsersManager extends Test_Database function test_addUser_existingLogin() { try { - Piwik_UsersManager_API::getInstance()->addUser("test", "password", "email@email.com", "alias"); - Piwik_UsersManager_API::getInstance()->addUser("test", "password2", "em2ail@email.com", "al2ias"); + Piwik_UsersManager_API::addUser("test", "password", "email@email.com", "alias"); + Piwik_UsersManager_API::addUser("test", "password2", "em2ail@email.com", "al2ias"); } catch (Exception $expected) { $this->assertPattern("(UsersManager_ExceptionLoginExists)", $expected->getMessage()); @@ -216,7 +216,7 @@ class Test_Piwik_UsersManager extends Test_Database function test_addUser_wrongPassword1() { try { - Piwik_UsersManager_API::getInstance()->addUser("geggeqgeqag", "pas", "email@email.com", "alias"); + Piwik_UsersManager_API::addUser("geggeqgeqag", "pas", "email@email.com", "alias"); } catch (Exception $expected) { $this->assertPattern("(UsersManager_ExceptionInvalidPassword)", $expected->getMessage()); @@ -230,7 +230,7 @@ class Test_Piwik_UsersManager extends Test_Database function test_addUser_wrongPassword2() { try { - Piwik_UsersManager_API::getInstance()->addUser("ghqgeggg", "gegageqqqqqqqgeqgqeg84897897897897g122", "email@email.com", "alias"); + Piwik_UsersManager_API::addUser("ghqgeggg", "gegageqqqqqqqgeqgqeg84897897897897g122", "email@email.com", "alias"); } catch (Exception $expected) { $this->assertPattern("(UsersManager_ExceptionInvalidPassword)", $expected->getMessage()); @@ -245,7 +245,7 @@ class Test_Piwik_UsersManager extends Test_Database function test_addUser_wrongPassword3() { try { - Piwik_UsersManager_API::getInstance()->addUser("geggeqgeqag", "", "email@email.com", "alias"); + Piwik_UsersManager_API::addUser("geggeqgeqag", "", "email@email.com", "alias"); } catch (Exception $expected) { $this->assertPattern("(UsersManager_ExceptionInvalidPassword)", $expected->getMessage()); @@ -259,7 +259,7 @@ class Test_Piwik_UsersManager extends Test_Database function test_addUser_wrongEmail1() { try { - Piwik_UsersManager_API::getInstance()->addUser("geggeqgeqag", "geqgeagae", "ema'il@email.com", "alias"); + Piwik_UsersManager_API::addUser("geggeqgeqag", "geqgeagae", "ema'il@email.com", "alias"); } catch (Exception $expected) { $this->assertPattern("(mail)", $expected->getMessage()); @@ -274,7 +274,7 @@ class Test_Piwik_UsersManager extends Test_Database function test_addUser_wrongEmail2() { try { - Piwik_UsersManager_API::getInstance()->addUser("geggeqgeqag", "geqgeagae", "@email.com", "alias"); + Piwik_UsersManager_API::addUser("geggeqgeqag", "geqgeagae", "@email.com", "alias"); } catch (Exception $expected) { $this->assertPattern("(mail)", $expected->getMessage()); @@ -288,7 +288,7 @@ class Test_Piwik_UsersManager extends Test_Database function test_addUser_wrongEmail3() { try { - Piwik_UsersManager_API::getInstance()->addUser("geggeqgeqag", "geqgeagae", "email@.com", "alias"); + Piwik_UsersManager_API::addUser("geggeqgeqag", "geqgeagae", "email@.com", "alias"); } catch (Exception $expected) { $this->assertPattern("(mail)", $expected->getMessage()); @@ -303,7 +303,7 @@ class Test_Piwik_UsersManager extends Test_Database function test_addUser_wrongEmail4() { try { - Piwik_UsersManager_API::getInstance()->addUser("geggeqgeqag", "geqgeagae", "email@4.", "alias"); + Piwik_UsersManager_API::addUser("geggeqgeqag", "geqgeagae", "email@4.", "alias"); } catch (Exception $expected) { $this->assertPattern("(mail)", $expected->getMessage()); @@ -319,7 +319,7 @@ class Test_Piwik_UsersManager extends Test_Database { try { - Piwik_UsersManager_API::getInstance()->addUser("geggeqgeqag", "geqgeagae", "", "alias"); + Piwik_UsersManager_API::addUser("geggeqgeqag", "geqgeagae", "", "alias"); } catch (Exception $expected) { $this->assertPattern("(mail)", $expected->getMessage()); @@ -334,8 +334,8 @@ class Test_Piwik_UsersManager extends Test_Database function test_addUser_emptyAlias() { $login ="geggeqgeqag"; - Piwik_UsersManager_API::getInstance()->addUser($login, "geqgeagae", "mgeagi@geq.com", ""); - $user = Piwik_UsersManager_API::getInstance()->getUser($login); + Piwik_UsersManager_API::addUser($login, "geqgeagae", "mgeagi@geq.com", ""); + $user = Piwik_UsersManager_API::getUser($login); $this->assertEqual($user['alias'], $login); $this->assertEqual($user['login'], $login); @@ -346,8 +346,8 @@ class Test_Piwik_UsersManager extends Test_Database function test_addUser_noAliasSpecified() { $login ="geggeqg455eqag"; - Piwik_UsersManager_API::getInstance()->addUser($login, "geqgeagae", "mgeagi@geq.com"); - $user = Piwik_UsersManager_API::getInstance()->getUser($login); + Piwik_UsersManager_API::addUser($login, "geqgeagae", "mgeagi@geq.com"); + $user = Piwik_UsersManager_API::getUser($login); $this->assertEqual($user['alias'], $login); $this->assertEqual($user['login'], $login); @@ -364,12 +364,11 @@ class Test_Piwik_UsersManager extends Test_Database $email = "mgeag4544i@geq.com"; $alias = "her is my alias )(&|\" '£%*(&%+))"; - $time = time(); - Piwik_UsersManager_API::getInstance()->addUser($login, $password, $email, $alias); - $user = Piwik_UsersManager_API::getInstance()->getUser($login); + Piwik_UsersManager_API::addUser($login, $password, $email, $alias); + $user = Piwik_UsersManager_API::getUser($login); // check that the date registered is correct - $this->assertTrue( strtotime($user['date_registered']) == $time , + $this->assertTrue( strtotime($user['date_registered']) >= time() - 1 , "the date_registered ".strtotime($user['date_registered'])." is different from the time() ". time()); $this->assertTrue($user['date_registered'] <= time() ); @@ -392,10 +391,10 @@ class Test_Piwik_UsersManager extends Test_Database */ function test_deleteUser_doesntExist() { - Piwik_UsersManager_API::getInstance()->addUser("geggeqgeqag", "geqgeagae", "test@test.com", "alias"); + Piwik_UsersManager_API::addUser("geggeqgeqag", "geqgeagae", "test@test.com", "alias"); try { - Piwik_UsersManager_API::getInstance()->deleteUser("geggeqggnew"); + Piwik_UsersManager_API::deleteUser("geggeqggnew"); } catch (Exception $expected) { $this->assertPattern("(UsersManager_ExceptionDeleteDoesNotExist)", $expected->getMessage()); @@ -410,7 +409,7 @@ class Test_Piwik_UsersManager extends Test_Database function test_deleteUser_emptyUser() { try { - Piwik_UsersManager_API::getInstance()->deleteUser(""); + Piwik_UsersManager_API::deleteUser(""); } catch (Exception $expected) { $this->assertPattern("(UsersManager_ExceptionDeleteDoesNotExist)", $expected->getMessage()); @@ -425,7 +424,7 @@ class Test_Piwik_UsersManager extends Test_Database function test_deleteUser_nullUser() { try { - Piwik_UsersManager_API::getInstance()->deleteUser(null); + Piwik_UsersManager_API::deleteUser(null); } catch (Exception $expected) { $this->assertPattern("(UsersManager_ExceptionDeleteDoesNotExist)", $expected->getMessage()); @@ -441,35 +440,35 @@ class Test_Piwik_UsersManager extends Test_Database { //create the 3 websites - $idsite = Piwik_SitesManager_API::getInstance()->addSite("site1",array("http://piwik.net","http://piwik.com/test/")); - $idsite = Piwik_SitesManager_API::getInstance()->addSite("site2",array("http://piwik.com/test/")); - $idsite = Piwik_SitesManager_API::getInstance()->addSite("site3",array("http://piwik.org")); + $idsite = Piwik_SitesManager_API::addSite("site1",array("http://piwik.net","http://piwik.com/test/")); + $idsite = Piwik_SitesManager_API::addSite("site2",array("http://piwik.com/test/")); + $idsite = Piwik_SitesManager_API::addSite("site3",array("http://piwik.org")); //add user and set some rights - Piwik_UsersManager_API::getInstance()->addUser("geggeqgeqag", "geqgeagae", "test@test.com", "alias"); - Piwik_UsersManager_API::getInstance()->setUserAccess("geggeqgeqag", "view", array(1,2)); - Piwik_UsersManager_API::getInstance()->setUserAccess("geggeqgeqag", "admin", array(1,3)); + Piwik_UsersManager_API::addUser("geggeqgeqag", "geqgeagae", "test@test.com", "alias"); + Piwik_UsersManager_API::setUserAccess("geggeqgeqag", "view", array(1,2)); + Piwik_UsersManager_API::setUserAccess("geggeqgeqag", "admin", array(1,3)); // check rights are set - $this->assertNotEqual(Piwik_UsersManager_API::getInstance()->getSitesAccessFromUser("geggeqgeqag"), array()); + $this->assertNotEqual(Piwik_UsersManager_API::getSitesAccessFromUser("geggeqgeqag"), array()); // delete the user - Piwik_UsersManager_API::getInstance()->deleteUser("geggeqgeqag"); + Piwik_UsersManager_API::deleteUser("geggeqgeqag"); // try to get it, it should raise an exception try { - $user = Piwik_UsersManager_API::getInstance()->getUser("geggeqgeqag"); + $user = Piwik_UsersManager_API::getUser("geggeqgeqag"); $this->fail("Exception not raised."); } catch (Exception $expected) { $this->assertPattern("(UsersManager_ExceptionUserDoesNotExist)", $expected->getMessage()); } // add the same user - Piwik_UsersManager_API::getInstance()->addUser("geggeqgeqag", "geqgeagae", "test@test.com", "alias"); + Piwik_UsersManager_API::addUser("geggeqgeqag", "geqgeagae", "test@test.com", "alias"); //checks access have been deleted //to do so we recreate the same user login and check if the rights are still there - $this->assertEqual(Piwik_UsersManager_API::getInstance()->getSitesAccessFromUser("geggeqgeqag"), array()); + $this->assertEqual(Piwik_UsersManager_API::getSitesAccessFromUser("geggeqgeqag"), array()); } @@ -481,7 +480,7 @@ class Test_Piwik_UsersManager extends Test_Database { // try to get it, it should raise an exception try { - $user = Piwik_UsersManager_API::getInstance()->getUser("geggeqgeqag"); + $user = Piwik_UsersManager_API::getUser("geggeqgeqag"); $this->fail("Exception not raised."); } catch (Exception $expected) { @@ -499,8 +498,8 @@ class Test_Piwik_UsersManager extends Test_Database $email = "mgeag4544i@geq.com"; $alias = ""; - Piwik_UsersManager_API::getInstance()->addUser($login, $password, $email, $alias); - $user = Piwik_UsersManager_API::getInstance()->getUser($login); + Piwik_UsersManager_API::addUser($login, $password, $email, $alias); + $user = Piwik_UsersManager_API::getUser($login); // check that all fields are the same $this->assertEqual($user['login'], $login); @@ -518,7 +517,7 @@ class Test_Piwik_UsersManager extends Test_Database */ function test_getUsers_noUser() { - $this->assertEqual(Piwik_UsersManager_API::getInstance()->getUsers(), array()); + $this->assertEqual(Piwik_UsersManager_API::getUsers(), array()); } /** @@ -527,11 +526,11 @@ class Test_Piwik_UsersManager extends Test_Database function test_getUsers() { - Piwik_UsersManager_API::getInstance()->addUser("gegg4564eqgeqag", "geqgegagae", "tegst@tesgt.com", "alias"); - Piwik_UsersManager_API::getInstance()->addUser("geggeqge632ge56a4qag", "geqgegeagae", "tesggt@tesgt.com", "alias"); - Piwik_UsersManager_API::getInstance()->addUser("geggeqgeqagqegg", "geqgeaggggae", "tesgggt@tesgt.com"); + Piwik_UsersManager_API::addUser("gegg4564eqgeqag", "geqgegagae", "tegst@tesgt.com", "alias"); + Piwik_UsersManager_API::addUser("geggeqge632ge56a4qag", "geqgegeagae", "tesggt@tesgt.com", "alias"); + Piwik_UsersManager_API::addUser("geggeqgeqagqegg", "geqgeaggggae", "tesgggt@tesgt.com"); - $users = Piwik_UsersManager_API::getInstance()->getUsers(); + $users = Piwik_UsersManager_API::getUsers(); foreach($users as &$user) { unset($user['token_auth']); @@ -553,11 +552,11 @@ class Test_Piwik_UsersManager extends Test_Database function test_getUsersLogin() { - Piwik_UsersManager_API::getInstance()->addUser("gegg4564eqgeqag", "geqgegagae", "tegst@tesgt.com", "alias"); - Piwik_UsersManager_API::getInstance()->addUser("geggeqge632ge56a4qag", "geqgegeagae", "tesggt@tesgt.com", "alias"); - Piwik_UsersManager_API::getInstance()->addUser("geggeqgeqagqegg", "geqgeaggggae", "tesgggt@tesgt.com"); + Piwik_UsersManager_API::addUser("gegg4564eqgeqag", "geqgegagae", "tegst@tesgt.com", "alias"); + Piwik_UsersManager_API::addUser("geggeqge632ge56a4qag", "geqgegeagae", "tesggt@tesgt.com", "alias"); + Piwik_UsersManager_API::addUser("geggeqgeqagqegg", "geqgeaggggae", "tesgggt@tesgt.com"); - $logins = Piwik_UsersManager_API::getInstance()->getUsersLogin(); + $logins = Piwik_UsersManager_API::getUsersLogin(); $this->assertEqual($logins, array( "gegg4564eqgeqag", "geggeqge632ge56a4qag", "geggeqgeqagqegg") @@ -572,7 +571,7 @@ class Test_Piwik_UsersManager extends Test_Database { // try to get it, it should raise an exception try { - Piwik_UsersManager_API::getInstance()->setUserAccess("nologin", "view", 1); + Piwik_UsersManager_API::setUserAccess("nologin", "view", 1); $this->fail("Exception not raised."); } catch (Exception $expected) { @@ -586,11 +585,11 @@ class Test_Piwik_UsersManager extends Test_Database */ function test_setUserAccess_wrongAccess() { - Piwik_UsersManager_API::getInstance()->addUser("gegg4564eqgeqag", "geqgegagae", "tegst@tesgt.com", "alias"); + Piwik_UsersManager_API::addUser("gegg4564eqgeqag", "geqgegagae", "tegst@tesgt.com", "alias"); // try to get it, it should raise an exception try { - Piwik_UsersManager_API::getInstance()->setUserAccess("gegg4564eqgeqag", "viewnotknown", 1); + Piwik_UsersManager_API::setUserAccess("gegg4564eqgeqag", "viewnotknown", 1); $this->fail("Exception not raised."); } catch (Exception $expected) { @@ -603,14 +602,14 @@ class Test_Piwik_UsersManager extends Test_Database */ function test_setUserAccess_idsitesIsAll() { - Piwik_UsersManager_API::getInstance()->addUser("gegg4564eqgeqag", "geqgegagae", "tegst@tesgt.com", "alias"); + Piwik_UsersManager_API::addUser("gegg4564eqgeqag", "geqgegagae", "tegst@tesgt.com", "alias"); FakeAccess::$superUser = false; - Piwik_UsersManager_API::getInstance()->setUserAccess("gegg4564eqgeqag", "view", "all"); + Piwik_UsersManager_API::setUserAccess("gegg4564eqgeqag", "view", "all"); FakeAccess::$superUser = true; - $access = Piwik_UsersManager_API::getInstance()->getSitesAccessFromUser("gegg4564eqgeqag"); + $access = Piwik_UsersManager_API::getSitesAccessFromUser("gegg4564eqgeqag"); $access = $this->_flatten($access); FakeAccess::$superUser = false; @@ -629,16 +628,16 @@ class Test_Piwik_UsersManager extends Test_Database { FakeAccess::$superUser = true; - $id1=Piwik_SitesManager_API::getInstance()->addSite("test",array("http://piwik.net","http://piwik.com/test/")); - $id2=Piwik_SitesManager_API::getInstance()->addSite("test2",array("http://piwik.net","http://piwik.com/test/")); - $id3=Piwik_SitesManager_API::getInstance()->addSite("test3",array("http://piwik.net","http://piwik.com/test/")); - $id4=Piwik_SitesManager_API::getInstance()->addSite("test4",array("http://piwik.net","http://piwik.com/test/")); - $id5=Piwik_SitesManager_API::getInstance()->addSite("test5",array("http://piwik.net","http://piwik.com/test/")); + $id1=Piwik_SitesManager_API::addSite("test",array("http://piwik.net","http://piwik.com/test/")); + $id2=Piwik_SitesManager_API::addSite("test2",array("http://piwik.net","http://piwik.com/test/")); + $id3=Piwik_SitesManager_API::addSite("test3",array("http://piwik.net","http://piwik.com/test/")); + $id4=Piwik_SitesManager_API::addSite("test4",array("http://piwik.net","http://piwik.com/test/")); + $id5=Piwik_SitesManager_API::addSite("test5",array("http://piwik.net","http://piwik.com/test/")); - Piwik_UsersManager_API::getInstance()->addUser("gegg4564eqgeqag", "geqgegagae", "tegst@tesgt.com", "alias"); - Piwik_UsersManager_API::getInstance()->setUserAccess("gegg4564eqgeqag", "view", "all"); + Piwik_UsersManager_API::addUser("gegg4564eqgeqag", "geqgegagae", "tegst@tesgt.com", "alias"); + Piwik_UsersManager_API::setUserAccess("gegg4564eqgeqag", "view", "all"); - $access = Piwik_UsersManager_API::getInstance()->getSitesAccessFromUser("gegg4564eqgeqag"); + $access = Piwik_UsersManager_API::getSitesAccessFromUser("gegg4564eqgeqag"); $access = $this->_flatten($access); $this->assertEqual( array($id1,$id2,$id3,$id4,$id5), array_keys($access)); @@ -649,11 +648,11 @@ class Test_Piwik_UsersManager extends Test_Database */ function test_setUserAccess_idsitesEmpty() { - Piwik_UsersManager_API::getInstance()->addUser("gegg4564eqgeqag", "geqgegagae", "tegst@tesgt.com", "alias"); + Piwik_UsersManager_API::addUser("gegg4564eqgeqag", "geqgegagae", "tegst@tesgt.com", "alias"); - Piwik_UsersManager_API::getInstance()->setUserAccess("gegg4564eqgeqag", "view", array()); + Piwik_UsersManager_API::setUserAccess("gegg4564eqgeqag", "view", array()); - $access = Piwik_UsersManager_API::getInstance()->getSitesAccessFromUser("gegg4564eqgeqag"); + $access = Piwik_UsersManager_API::getSitesAccessFromUser("gegg4564eqgeqag"); $access = $this->_flatten($access); $this->assertEqual( array(), $access); @@ -664,12 +663,12 @@ class Test_Piwik_UsersManager extends Test_Database */ function test_setUserAccess_idsitesOneSite() { - Piwik_UsersManager_API::getInstance()->addUser("gegg4564eqgeqag", "geqgegagae", "tegst@tesgt.com", "alias"); - $id1=Piwik_SitesManager_API::getInstance()->addSite("test",array("http://piwik.net","http://piwik.com/test/")); + Piwik_UsersManager_API::addUser("gegg4564eqgeqag", "geqgegagae", "tegst@tesgt.com", "alias"); + $id1=Piwik_SitesManager_API::addSite("test",array("http://piwik.net","http://piwik.com/test/")); - Piwik_UsersManager_API::getInstance()->setUserAccess("gegg4564eqgeqag", "view", array(1)); + Piwik_UsersManager_API::setUserAccess("gegg4564eqgeqag", "view", array(1)); - $access = Piwik_UsersManager_API::getInstance()->getSitesAccessFromUser("gegg4564eqgeqag"); + $access = Piwik_UsersManager_API::getSitesAccessFromUser("gegg4564eqgeqag"); $access = $this->_flatten($access); $this->assertEqual( array(1), array_keys($access)); } @@ -680,14 +679,14 @@ class Test_Piwik_UsersManager extends Test_Database function test_setUserAccess_idsitesMultipleSites() { - Piwik_UsersManager_API::getInstance()->addUser("gegg4564eqgeqag", "geqgegagae", "tegst@tesgt.com", "alias"); - $id1=Piwik_SitesManager_API::getInstance()->addSite("test",array("http://piwik.net","http://piwik.com/test/")); - $id2=Piwik_SitesManager_API::getInstance()->addSite("test",array("http://piwik.net","http://piwik.com/test/")); - $id3=Piwik_SitesManager_API::getInstance()->addSite("test",array("http://piwik.net","http://piwik.com/test/")); + Piwik_UsersManager_API::addUser("gegg4564eqgeqag", "geqgegagae", "tegst@tesgt.com", "alias"); + $id1=Piwik_SitesManager_API::addSite("test",array("http://piwik.net","http://piwik.com/test/")); + $id2=Piwik_SitesManager_API::addSite("test",array("http://piwik.net","http://piwik.com/test/")); + $id3=Piwik_SitesManager_API::addSite("test",array("http://piwik.net","http://piwik.com/test/")); - Piwik_UsersManager_API::getInstance()->setUserAccess("gegg4564eqgeqag", "view", array($id1,$id3)); + Piwik_UsersManager_API::setUserAccess("gegg4564eqgeqag", "view", array($id1,$id3)); - $access = Piwik_UsersManager_API::getInstance()->getSitesAccessFromUser("gegg4564eqgeqag"); + $access = Piwik_UsersManager_API::getSitesAccessFromUser("gegg4564eqgeqag"); $access = $this->_flatten($access); $this->assertEqual( array($id1,$id3), array_keys($access)); } @@ -697,14 +696,14 @@ class Test_Piwik_UsersManager extends Test_Database function test_setUserAccess_withIdSitesIsStringCommaSeparated() { - Piwik_UsersManager_API::getInstance()->addUser("gegg4564eqgeqag", "geqgegagae", "tegst@tesgt.com", "alias"); - $id1=Piwik_SitesManager_API::getInstance()->addSite("test",array("http://piwik.net","http://piwik.com/test/")); - $id2=Piwik_SitesManager_API::getInstance()->addSite("test",array("http://piwik.net","http://piwik.com/test/")); - $id3=Piwik_SitesManager_API::getInstance()->addSite("test",array("http://piwik.net","http://piwik.com/test/")); + Piwik_UsersManager_API::addUser("gegg4564eqgeqag", "geqgegagae", "tegst@tesgt.com", "alias"); + $id1=Piwik_SitesManager_API::addSite("test",array("http://piwik.net","http://piwik.com/test/")); + $id2=Piwik_SitesManager_API::addSite("test",array("http://piwik.net","http://piwik.com/test/")); + $id3=Piwik_SitesManager_API::addSite("test",array("http://piwik.net","http://piwik.com/test/")); - Piwik_UsersManager_API::getInstance()->setUserAccess("gegg4564eqgeqag", "view", "1,3"); + Piwik_UsersManager_API::setUserAccess("gegg4564eqgeqag", "view", "1,3"); - $access = Piwik_UsersManager_API::getInstance()->getSitesAccessFromUser("gegg4564eqgeqag"); + $access = Piwik_UsersManager_API::getSitesAccessFromUser("gegg4564eqgeqag"); $access = $this->_flatten($access); $this->assertEqual( array($id1,$id3), array_keys($access)); } @@ -715,14 +714,14 @@ class Test_Piwik_UsersManager extends Test_Database */ function test_setUserAccess_multipleCallDistinctAccessSameUser() { - Piwik_UsersManager_API::getInstance()->addUser("gegg4564eqgeqag", "geqgegagae", "tegst@tesgt.com", "alias"); - $id1=Piwik_SitesManager_API::getInstance()->addSite("test",array("http://piwik.net","http://piwik.com/test/")); - $id2=Piwik_SitesManager_API::getInstance()->addSite("test",array("http://piwik.net","http://piwik.com/test/")); + Piwik_UsersManager_API::addUser("gegg4564eqgeqag", "geqgegagae", "tegst@tesgt.com", "alias"); + $id1=Piwik_SitesManager_API::addSite("test",array("http://piwik.net","http://piwik.com/test/")); + $id2=Piwik_SitesManager_API::addSite("test",array("http://piwik.net","http://piwik.com/test/")); - Piwik_UsersManager_API::getInstance()->setUserAccess("gegg4564eqgeqag", "view", array($id1)); - Piwik_UsersManager_API::getInstance()->setUserAccess("gegg4564eqgeqag", "admin", array($id2)); + Piwik_UsersManager_API::setUserAccess("gegg4564eqgeqag", "view", array($id1)); + Piwik_UsersManager_API::setUserAccess("gegg4564eqgeqag", "admin", array($id2)); - $access = Piwik_UsersManager_API::getInstance()->getSitesAccessFromUser("gegg4564eqgeqag"); + $access = Piwik_UsersManager_API::getSitesAccessFromUser("gegg4564eqgeqag"); $access = $this->_flatten($access); $this->assertEqual( array($id1=>'view',$id2=>'admin'), $access); } @@ -732,19 +731,19 @@ class Test_Piwik_UsersManager extends Test_Database */ function test_setUserAccess_multipleCallDistinctAccessMultipleUser() { - Piwik_UsersManager_API::getInstance()->addUser("user1", "geqgegagae", "tegst@tesgt.com", "alias"); - Piwik_UsersManager_API::getInstance()->addUser("user2", "geqgegagae", "tegst2@tesgt.com", "alias"); - $id1=Piwik_SitesManager_API::getInstance()->addSite("test1",array("http://piwik.net","http://piwik.com/test/")); - $id2=Piwik_SitesManager_API::getInstance()->addSite("test2",array("http://piwik.net","http://piwik.com/test/")); - $id3=Piwik_SitesManager_API::getInstance()->addSite("test2",array("http://piwik.net","http://piwik.com/test/")); + Piwik_UsersManager_API::addUser("user1", "geqgegagae", "tegst@tesgt.com", "alias"); + Piwik_UsersManager_API::addUser("user2", "geqgegagae", "tegst2@tesgt.com", "alias"); + $id1=Piwik_SitesManager_API::addSite("test1",array("http://piwik.net","http://piwik.com/test/")); + $id2=Piwik_SitesManager_API::addSite("test2",array("http://piwik.net","http://piwik.com/test/")); + $id3=Piwik_SitesManager_API::addSite("test2",array("http://piwik.net","http://piwik.com/test/")); - Piwik_UsersManager_API::getInstance()->setUserAccess("user1", "view", array($id1,$id2)); - Piwik_UsersManager_API::getInstance()->setUserAccess("user2", "admin", array($id1)); - Piwik_UsersManager_API::getInstance()->setUserAccess("user2", "view", array($id3)); + Piwik_UsersManager_API::setUserAccess("user1", "view", array($id1,$id2)); + Piwik_UsersManager_API::setUserAccess("user2", "admin", array($id1)); + Piwik_UsersManager_API::setUserAccess("user2", "view", array($id3)); - $access1 = Piwik_UsersManager_API::getInstance()->getSitesAccessFromUser("user1"); + $access1 = Piwik_UsersManager_API::getSitesAccessFromUser("user1"); $access1 = $this->_flatten($access1); - $access2 = Piwik_UsersManager_API::getInstance()->getSitesAccessFromUser("user2"); + $access2 = Piwik_UsersManager_API::getSitesAccessFromUser("user2"); $access2 = $this->_flatten($access2); $wanted1 = array( $id1 => 'view', $id2 => 'view', ); $wanted2 = array( $id1 => 'admin', $id3 => 'view' ); @@ -753,9 +752,9 @@ class Test_Piwik_UsersManager extends Test_Database $this->assertEqual($access2, $wanted2); - $access1 = Piwik_UsersManager_API::getInstance()->getUsersAccessFromSite($id1); - $access2 = Piwik_UsersManager_API::getInstance()->getUsersAccessFromSite($id2); - $access3 = Piwik_UsersManager_API::getInstance()->getUsersAccessFromSite($id3); + $access1 = Piwik_UsersManager_API::getUsersAccessFromSite($id1); + $access2 = Piwik_UsersManager_API::getUsersAccessFromSite($id2); + $access3 = Piwik_UsersManager_API::getUsersAccessFromSite($id3); $wanted1 = array( 'user1' => 'view', 'user2' => 'admin', ); $wanted2 = array( 'user1' => 'view' ); $wanted3 = array( 'user2' => 'view' ); @@ -764,8 +763,8 @@ class Test_Piwik_UsersManager extends Test_Database $this->assertEqual($access2, $wanted2); $this->assertEqual($access3, $wanted3); - $access1 = Piwik_UsersManager_API::getInstance()->getUsersSitesFromAccess('view'); - $access2 = Piwik_UsersManager_API::getInstance()->getUsersSitesFromAccess('admin'); + $access1 = Piwik_UsersManager_API::getUsersSitesFromAccess('view'); + $access2 = Piwik_UsersManager_API::getUsersSitesFromAccess('admin'); $wanted1 = array( 'user1' => array($id1,$id2), 'user2' => array($id3) ); $wanted2 = array( 'user2' => array($id1) ); @@ -779,15 +778,15 @@ class Test_Piwik_UsersManager extends Test_Database */ function test_setUserAccess_multipleCallOverwriteSingleUserOneSite() { - Piwik_UsersManager_API::getInstance()->addUser("user1", "geqgegagae", "tegst@tesgt.com", "alias"); + Piwik_UsersManager_API::addUser("user1", "geqgegagae", "tegst@tesgt.com", "alias"); - $id1=Piwik_SitesManager_API::getInstance()->addSite("test1",array("http://piwik.net","http://piwik.com/test/")); - $id2=Piwik_SitesManager_API::getInstance()->addSite("test2",array("http://piwik.net","http://piwik.com/test/")); + $id1=Piwik_SitesManager_API::addSite("test1",array("http://piwik.net","http://piwik.com/test/")); + $id2=Piwik_SitesManager_API::addSite("test2",array("http://piwik.net","http://piwik.com/test/")); - Piwik_UsersManager_API::getInstance()->setUserAccess("user1", "view", array($id1,$id2)); - Piwik_UsersManager_API::getInstance()->setUserAccess("user1", "admin", array($id1)); + Piwik_UsersManager_API::setUserAccess("user1", "view", array($id1,$id2)); + Piwik_UsersManager_API::setUserAccess("user1", "admin", array($id1)); - $access1 = Piwik_UsersManager_API::getInstance()->getSitesAccessFromUser("user1"); + $access1 = Piwik_UsersManager_API::getSitesAccessFromUser("user1"); $access1 = $this->_flatten($access1); $wanted1 = array( $id1 => 'admin', $id2 => 'view', ); @@ -802,7 +801,7 @@ class Test_Piwik_UsersManager extends Test_Database function test_getSitesAccessFromUser_wrongUser() { try { - $access1 = Piwik_UsersManager_API::getInstance()->getSitesAccessFromUser("user1"); + $access1 = Piwik_UsersManager_API::getSitesAccessFromUser("user1"); } catch (Exception $expected) { $this->assertPattern("(UsersManager_ExceptionUserDoesNotExist)", $expected->getMessage()); @@ -817,7 +816,7 @@ class Test_Piwik_UsersManager extends Test_Database function test_getUsersAccessFromSite_wrongSite() { try { - $access1 = Piwik_UsersManager_API::getInstance()->getUsersAccessFromSite(1); + $access1 = Piwik_UsersManager_API::getUsersAccessFromSite(1); } catch (Exception $expected) { return; @@ -831,7 +830,7 @@ class Test_Piwik_UsersManager extends Test_Database function test_getUsersSitesFromAccess_wrongSite() { try { - $access1 = Piwik_UsersManager_API::getInstance()->getUsersSitesFromAccess('unknown'); + $access1 = Piwik_UsersManager_API::getUsersSitesFromAccess('unknown'); } catch (Exception $expected) { $this->assertPattern("(UsersManager_ExceptionAccessValues)", $expected->getMessage()); @@ -847,7 +846,7 @@ class Test_Piwik_UsersManager extends Test_Database function test_updateUser_wrongLogin() { try { - Piwik_UsersManager_API::getInstance()->updateUser( "lolgin", "password"); + Piwik_UsersManager_API::updateUser( "lolgin", "password"); } catch (Exception $expected) { $this->assertPattern("(UsersManager_ExceptionUserDoesNotExist)", $expected->getMessage()); @@ -868,9 +867,9 @@ class Test_Piwik_UsersManager extends Test_Database 'email'=>"test@test.com", 'alias'=>"alias"); - Piwik_UsersManager_API::getInstance()->addUser($user['login'],$user['password'] ,$user['email'] ,$user['alias'] ); + Piwik_UsersManager_API::addUser($user['login'],$user['password'] ,$user['email'] ,$user['alias'] ); - Piwik_UsersManager_API::getInstance()->updateUser( $login, "passowordOK"); + Piwik_UsersManager_API::updateUser( $login, "passowordOK"); $this->_checkUserHasNotChanged($user, "passowordOK"); } @@ -887,9 +886,9 @@ class Test_Piwik_UsersManager extends Test_Database 'email'=>"test@test.com", 'alias'=>"alias"); - Piwik_UsersManager_API::getInstance()->addUser($user['login'],$user['password'] ,$user['email'] ,$user['alias'] ); + Piwik_UsersManager_API::addUser($user['login'],$user['password'] ,$user['email'] ,$user['alias'] ); - Piwik_UsersManager_API::getInstance()->updateUser( $login, "passowordOK", null, "newalias"); + Piwik_UsersManager_API::updateUser( $login, "passowordOK", null, "newalias"); $this->_checkUserHasNotChanged($user, "passowordOK", null, "newalias"); } @@ -906,9 +905,9 @@ class Test_Piwik_UsersManager extends Test_Database 'email'=>"test@test.com", 'alias'=>"alias"); - Piwik_UsersManager_API::getInstance()->addUser($user['login'],$user['password'] ,$user['email'] ,$user['alias'] ); + Piwik_UsersManager_API::addUser($user['login'],$user['password'] ,$user['email'] ,$user['alias'] ); - Piwik_UsersManager_API::getInstance()->updateUser( $login, "passowordOK", "email@geaga.com"); + Piwik_UsersManager_API::updateUser( $login, "passowordOK", "email@geaga.com"); $this->_checkUserHasNotChanged($user, "passowordOK", "email@geaga.com"); } @@ -951,9 +950,9 @@ class Test_Piwik_UsersManager extends Test_Database 'email'=>"test@test.com", 'alias'=>"alias"); - Piwik_UsersManager_API::getInstance()->addUser($user['login'],$user['password'] ,$user['email'] ,$user['alias'] ); + Piwik_UsersManager_API::addUser($user['login'],$user['password'] ,$user['email'] ,$user['alias'] ); - Piwik_UsersManager_API::getInstance()->updateUser( $login, "passowordOK", "email@geaga.com", "NEW ALIAS"); + Piwik_UsersManager_API::updateUser( $login, "passowordOK", "email@geaga.com", "NEW ALIAS"); $this->_checkUserHasNotChanged($user, "passowordOK", "email@geaga.com", "NEW ALIAS"); } diff --git a/plugins/VisitFrequency/API.php b/plugins/VisitFrequency/API.php index 1b7e43d4a9..8e770d9007 100644 --- a/plugins/VisitFrequency/API.php +++ b/plugins/VisitFrequency/API.php @@ -54,7 +54,7 @@ class Piwik_VisitFrequency_API $dataTable = $archive->getDataTableFromNumeric($toFetch); if($bounceRateReturningRequested !== false) { - $dataTable->filter('ColumnCallbackAddColumnPercentage', array('bounce_rate_returning', 'bounce_count_returning', 'nb_visits_returning', 0)); + $dataTable->filter('ColumnCallbackAddColumnPercentage', array('bounce_count_returning', 'bounce_rate_returning', 'nb_visits_returning', 0)); $dataTable->deleteColumns($toFetch); } return $dataTable; diff --git a/plugins/VisitFrequency/VisitFrequency.php b/plugins/VisitFrequency/VisitFrequency.php index 5dcdfeb581..ccd83d0662 100644 --- a/plugins/VisitFrequency/VisitFrequency.php +++ b/plugins/VisitFrequency/VisitFrequency.php @@ -19,10 +19,11 @@ class Piwik_VisitFrequency extends Piwik_Plugin public function getInformation() { $info = array( - 'description' => Piwik_Translate('VisitFrequency_PluginDescription'), + 'name' => 'Visits Frequency', + 'description' => 'Reports various statistics about the Returning Visitor versus the First time visitor.', 'author' => 'Piwik', - 'author_homepage' => 'http://piwik.org/', - 'version' => Piwik_Version::VERSION, + 'homepage' => 'http://piwik.org/', + 'version' => '0.1', ); return $info; } @@ -46,7 +47,7 @@ class Piwik_VisitFrequency extends Piwik_Plugin function addMenu() { - Piwik_AddMenu('General_Visitors', 'VisitFrequency_SubmenuFrequency', array('module' => 'VisitFrequency', 'action' => 'index')); + Piwik_AddMenu('General_Visitors', 'VisitFrequency_SubmenuFrequency', array('module' => 'VisitFrequency')); } function archivePeriod( $notification ) @@ -66,7 +67,6 @@ class Piwik_VisitFrequency extends Piwik_Plugin function archiveDay($notification) { - /* @var $archiveProcessing Piwik_ArchiveProcessing */ $archiveProcessing = $notification->getNotificationObject(); $query = "SELECT count(distinct visitor_idcookie) as nb_uniq_visitors_returning, @@ -77,11 +77,11 @@ class Piwik_VisitFrequency extends Piwik_Plugin sum(case visit_total_actions when 1 then 1 else 0 end) as bounce_count_returning, sum(case visit_goal_converted when 1 then 1 else 0 end) as nb_visits_converted_returning FROM ".$archiveProcessing->logTable." - WHERE visit_last_action_time >= ? - AND visit_last_action_time <= ? + WHERE visit_server_date = ? AND idsite = ? - AND visitor_returning = 1"; - $row = $archiveProcessing->db->fetchRow($query, array( $archiveProcessing->getStartDatetimeUTC(), $archiveProcessing->getEndDatetimeUTC(), $archiveProcessing->idsite ) ); + AND visitor_returning = 1 + GROUP BY visitor_returning"; + $row = $archiveProcessing->db->fetchRow($query, array( $archiveProcessing->strDateStart, $archiveProcessing->idsite ) ); if($row === false || $row === null) { diff --git a/plugins/VisitFrequency/templates/index.tpl b/plugins/VisitFrequency/templates/index.tpl index 1d7e483157..ec4664d310 100644 --- a/plugins/VisitFrequency/templates/index.tpl +++ b/plugins/VisitFrequency/templates/index.tpl @@ -2,7 +2,7 @@ <script type="text/javascript" src="plugins/CoreHome/templates/sparkline.js"></script> <a name="evolutionGraph" graphId="VisitFrequencygetEvolutionGraph"></a> -<h2>{'VisitFrequency_ColumnReturningVisits'|translate}</h2> +<h2>{'VisitFrequency_Evolution'|translate}</h2> {$graphEvolutionVisitFrequency} <br /> diff --git a/plugins/VisitTime/Controller.php b/plugins/VisitTime/Controller.php index b49f35452f..7053c9d545 100644 --- a/plugins/VisitTime/Controller.php +++ b/plugins/VisitTime/Controller.php @@ -16,7 +16,7 @@ */ class Piwik_VisitTime_Controller extends Piwik_Controller { - public function index() + function index() { $view = Piwik_View::factory('index'); $view->dataTableVisitInformationPerLocalTime = $this->getVisitInformationPerLocalTime(true); @@ -24,7 +24,7 @@ class Piwik_VisitTime_Controller extends Piwik_Controller echo $view->render(); } - public function getVisitInformationPerServerTime( $fetch = false) + function getVisitInformationPerServerTime( $fetch = false) { $view = Piwik_ViewDataTable::factory( 'graphVerticalBar'); $view->init( $this->pluginName, __FUNCTION__, "VisitTime.getVisitInformationPerServerTime" ); @@ -42,7 +42,7 @@ class Piwik_VisitTime_Controller extends Piwik_Controller return $this->renderView($view, $fetch); } - public function getVisitInformationPerLocalTime( $fetch = false) + function getVisitInformationPerLocalTime( $fetch = false) { $view = Piwik_ViewDataTable::factory( 'graphVerticalBar'); $view->init( $this->pluginName, __FUNCTION__, "VisitTime.getVisitInformationPerLocalTime" ); diff --git a/plugins/VisitTime/VisitTime.php b/plugins/VisitTime/VisitTime.php index 510a7f7ffd..d565a3fb91 100644 --- a/plugins/VisitTime/VisitTime.php +++ b/plugins/VisitTime/VisitTime.php @@ -19,10 +19,11 @@ class Piwik_VisitTime extends Piwik_Plugin public function getInformation() { $info = array( - 'description' => Piwik_Translate('VisitTime_PluginDescription'), + 'name' => 'Visits Time', + 'description' => 'Reports the Local and Server time. Server time information can be useful to schedule a maintenance on the Website.', 'author' => 'Piwik', - 'author_homepage' => 'http://piwik.org/', - 'version' => Piwik_Version::VERSION, + 'homepage' => 'http://piwik.org/', + 'version' => '0.1', ); return $info; } @@ -34,7 +35,6 @@ class Piwik_VisitTime extends Piwik_Plugin 'ArchiveProcessing_Period.compute' => 'archivePeriod', 'WidgetsList.add' => 'addWidgets', 'Menu.add' => 'addMenu', - 'Goals.getAvailableGoalSegments' => 'addGoalSegments', ); return $hooks; } @@ -47,20 +47,9 @@ class Piwik_VisitTime extends Piwik_Plugin function addMenu() { - Piwik_AddMenu('General_Visitors', 'VisitTime_SubmenuTimes', array('module' => 'VisitTime', 'action' => 'index')); + Piwik_AddMenu('General_Visitors', 'VisitTime_SubmenuTimes', array('module' => 'VisitTime')); } - function addGoalSegments( $notification ) - { - $segments =& $notification->getNotificationObject(); - $segments[] = array( - 'group' => Piwik_Translate('VisitTime_ColumnServerTime'), - 'name' => Piwik_Translate('VisitTime_ColumnServerTime'), - 'module' => 'VisitTime', - 'action' => 'getVisitInformationPerServerTime', - ); - } - function archivePeriod( $notification ) { $archiveProcessing = $notification->getNotificationObject(); @@ -84,37 +73,16 @@ class Piwik_VisitTime extends Piwik_Plugin $labelSQL = "HOUR(visitor_localtime)"; $this->interestByLocalTime = $archiveProcessing->getArrayInterestForLabel($labelSQL); - $labelSQL = "HOUR(visit_last_action_time)"; + $labelSQL = "HOUR(visit_first_action_time)"; $this->interestByServerTime = $archiveProcessing->getArrayInterestForLabel($labelSQL); - $this->interestByServerTime = $this->convertServerTimeToLocalTimezone($this->interestByServerTime, $archiveProcessing); - } - - protected function convertServerTimeToLocalTimezone($interestByServerTime, $archiveProcessing) - { - $date = Piwik_Date::factory($archiveProcessing->getStartDatetimeUTC())->toString(); - $timezone = $archiveProcessing->site->getTimezone(); - $visitsByHourTz = array(); - foreach($interestByServerTime as $hour => $stats) - { - $datetime = $date . ' '.$hour.':00:00'; - $hourInTz = (int)Piwik_Date::factory($datetime, $timezone)->toString('H'); - $visitsByHourTz[$hourInTz] = $stats; - } - return $visitsByHourTz; } protected function archiveDayAggregateGoals($archiveProcessing) { $query = $archiveProcessing->queryConversionsBySingleSegment("HOUR(server_time)"); - $goalByServerTime = array(); while($row = $query->fetch()) { - $goalByServerTime[$row['label']][$row['idgoal']] = $archiveProcessing->getGoalRowFromQueryRow($row); - } - $goalByServerTime = $this->convertServerTimeToLocalTimezone($goalByServerTime, $archiveProcessing); - foreach($goalByServerTime as $hour => $goals) - { - $this->interestByServerTime[$hour][Piwik_Archive::INDEX_GOALS] = $goals; + $this->interestByServerTime[$row['label']][Piwik_Archive::INDEX_GOALS][$row['idgoal']] = $archiveProcessing->getGoalRowFromQueryRow($row); } $archiveProcessing->enrichConversionsByLabelArray($this->interestByServerTime); } diff --git a/plugins/VisitorGenerator/Controller.php b/plugins/VisitorGenerator/Controller.php deleted file mode 100644 index cac81633d3..0000000000 --- a/plugins/VisitorGenerator/Controller.php +++ /dev/null @@ -1,118 +0,0 @@ -<?php -/** - * Piwik - Open source web analytics - * - * @link http://piwik.org - * @license http://www.gnu.org/licenses/gpl-3.0.html Gpl v3 or later - * @version $Id$ - * - * @category Piwik_Plugin - * @package Piwik_VisitorGenerator - */ - -/** - * - * @package Piwik_VisitorGenerator - */ -class Piwik_VisitorGenerator_Controller extends Piwik_Controller { - - public function index() { - Piwik::checkUserIsSuperUser(); - - $sitesList = Piwik_SitesManager_API::getInstance()->getSitesWithAdminAccess(); - - $view = Piwik_View::factory('index'); - $this->setGeneralVariablesView($view); - $view->assign('sitesList', $sitesList); - - $view->menu = Piwik_GetAdminMenu(); - echo $view->render(); - } - - public function generate() { - // Only admin is allowed to do this! - Piwik::checkUserIsSuperUser(); - $this->checkTokenInUrl(); - - $GET = $_GET; - $POST = $_POST; - $COOKIE = $_COOKIE; - $REQUEST = $_REQUEST; - - if(Piwik_Common::getRequestVar('choice', 'no') != 'yes') { - Piwik::redirectToModule('VisitorGenerator', 'index'); - } - - $minVisitors = Piwik_Common::getRequestVar('minVisitors', 20, 'int'); - $maxVisitors = Piwik_Common::getRequestVar('maxVisitors', 100, 'int'); - $nbActions = Piwik_Common::getRequestVar('nbActions', 10, 'int'); - $daysToCompute = Piwik_Common::getRequestVar('daysToCompute', 1, 'int'); - $idSite = Piwik_Common::getRequestVar('idSite'); - Piwik::setMaxExecutionTime(0); - - $loadedPlugins = Piwik_PluginsManager::getInstance()->getLoadedPlugins(); - $loadedPlugins = array_keys($loadedPlugins); - // we have to unload the Provider plugin otherwise it tries to lookup the IP for a hostname, and there is no dns server here - if(Piwik_PluginsManager::getInstance()->isPluginActivated('Provider')) { - Piwik_PluginsManager::getInstance()->unloadPlugin('Provider'); - } - - // we set the DO NOT load plugins so that the Tracker generator doesn't load the plugins we've just disabled. - // if for some reasons you want to load the plugins, comment this line, and disable the plugin Provider in the plugins interface - Piwik_PluginsManager::getInstance()->doNotLoadPlugins(); - - $generator = new Piwik_VisitorGenerator_Generator(); - $generator->setMaximumUrlDepth(3); - - //$generator->disableProfiler(); - $generator->setIdSite( $idSite ); - - $nbActionsTotal = 0; - //$generator->emptyAllLogTables(); - $generator->init(); - - $timer = new Piwik_Timer; - - $startTime = time() - ($daysToCompute-1)*86400; - $dates = array(); - while($startTime <= time()) { - $visitors = rand($minVisitors, $maxVisitors); - $actions = $nbActions; - $generator->setTimestampToUse($startTime); - - $nbActionsTotalThisDay = $generator->generate($visitors, $actions); - $actionsPerVisit = round($nbActionsTotalThisDay / $visitors); - - $date = array(); - $date['visitors'] = $visitors; - $date['actionsPerVisit'] = $actionsPerVisit; - $date['startTime'] = $startTime; - $dates[] = $date; - - $startTime += 86400; - $nbActionsTotal += $nbActionsTotalThisDay; - //sleep(1); - } - - $generator->end(); - - // Recover all super globals - $_GET = $GET; - $_POST = $POST; - $_COOKIE = $COOKIE; - $_REQUEST = $REQUEST; - - // Reload plugins - Piwik_PluginsManager::getInstance()->loadPlugins($loadedPlugins); - - // Init view - $view = Piwik_View::factory('generate'); - $view->menu = Piwik_GetAdminMenu(); - $this->setGeneralVariablesView($view); - $view->assign('dates', $dates); - $view->assign('timer', $timer); - $view->assign('nbActionsTotal', $nbActionsTotal); - $view->assign('nbRequestsPerSec', round($nbActionsTotal / $timer->getTime(),0)); - echo $view->render(); - } -} diff --git a/plugins/VisitorGenerator/Generator.php b/plugins/VisitorGenerator/Generator.php deleted file mode 100644 index 9b32a83799..0000000000 --- a/plugins/VisitorGenerator/Generator.php +++ /dev/null @@ -1,623 +0,0 @@ -<?php -/** - * Piwik - Open source web analytics - * - * @link http://piwik.org - * @license http://www.gnu.org/licenses/gpl-3.0.html Gpl v3 or later - * @version $Id$ - * - * @category Piwik_Plugin - * @package Piwik_VisitorGenerator - */ - -/** - * Class used to generate fake visits. - * Useful to test performances, general functional testing, etc. - * - * Objective: - * Generate thousands of visits / actions per visitor using - * a single request to misc/generateVisits.php - * - * Requirements of the visits generator script. Fields that can be edited: - * - url => campaigns - * - campaign CPC - * - referer - * - search engine - * - misc site - * - same website - * - url => multiple directories, page names - * - multiple idsite - * - multiple settings configurations - * - action_name - * - HTML title - * - * @package Piwik_VisitorGenerator - * - * "Le Generator, il est trop Fort!" - * - Random fan - */ -class Piwik_VisitorGenerator_Generator -{ - /** - * GET parameters array of values to be used for the current visit - * - * @var array ('res' => '1024x768', 'urlref' => 'http://google.com/search?q=piwik', ...) - */ - protected $currentget = array(); - - /** - * Array of all the potential values for the visit parameters - * Values of 'resolution', 'urlref', etc. will be randomly read from this array - * - * @var array ( - * 'res' => array('1024x768','800x600'), - * 'urlref' => array('google.com','intel.com','amazon.com'), - * ....) - */ - protected $allget = array(); - - /** - * See @see setMaximumUrlDepth - * - * @var int - */ - protected $maximumUrlDepth = 1; - - /** - * Unix timestamp to use for the generated visitor - * - * @var int Unix timestamp - */ - protected $timestampToUse; - - /** - * See @see disableProfiler() - * The profiler is enabled by default - * - * @var bool - */ - protected $profiling = true; - - /** - * If set to true, this will TRUNCATE the profiling tables at every new generated visit - * @see initProfiler() - * - * @var bool - */ - public $reinitProfilingAtEveryRequest = true; - - /** - * Hostname used to prefix all the generated URLs - * we could make this variable dynamic so that a visitor can make hit on several hosts and - * only the good ones should be kept (feature not yet implemented in piwik) - * - * @var string - */ - public $host = 'http://localhost'; - - /** - * IdSite to generate visits for (@see setIdSite()) - * - * @var int - */ - public $idSite = 1; - - /** - * Overwrite the global GET/POST/COOKIE variables and set the fake ones @see setFakeRequest() - * Reads the configuration file but disables write to this file - * Creates the database object & enable profiling by default (@see disableProfiler()) - * - */ - public function __construct() - { - $_COOKIE = $_GET = $_POST = array(); - - // init GET and REQUEST to the empty array - $this->setFakeRequest(); - - Piwik::createConfigObject(PIWIK_USER_PATH . '/config/config.ini.php'); - Zend_Registry::get('config')->disableSavingConfigurationFileUpdates(); - - // setup database - Piwik::createDatabaseObject(); - - Piwik_Tracker_Db::enableProfiling(); - - $this->timestampToUse = time(); - } - - /** - * Sets the depth level of the generated URLs - * value = 1 => path OR path/page1 - * value = 2 => path OR path/pageRand OR path/dir1/pageRand - * - * @param int Depth - */ - public function setMaximumUrlDepth($value) - { - $this->maximumUrlDepth = (int)$value; - } - - /** - * Set the timestamp to use as the starting time for the visitors times - * You have to call this method for every day you want to generate data - * - * @param int Unix timestamp - */ - public function setTimestampToUse($timestamp) - { - $this->timestampToUse = $timestamp; - } - - /** - * Returns the timestamp to be used as the visitor timestamp - * - * @return int Unix timestamp - */ - public function getTimestampToUse() - { - return $this->timestampToUse; - } - - /** - * Set the idsite to generate the visits for - * To be called before init() - * - * @param int idSite - */ - public function setIdSite($idSite) - { - $this->idSite = $idSite; - } - - /** - * Add a value to the GET global array. - * The generator script will then randomly read a value from this array. - * - * For example, $name = 'res' $aValue = '1024x768' - * - * @param string Name of the parameter _GET[$name] - * @param array|mixed Value of the parameter - */ - protected function addParam( $name, $aValue) - { - if(is_array($aValue)) - { - $this->allget[$name] = array_merge( $aValue, - (array)@$this->allget[$name]); - } - else - { - $this->allget[$name][] = $aValue; - } - } - - /** - * TRUNCATE all logs related tables to start a fresh logging database. - * Be careful, any data deleted this way is deleted forever - */ - public function emptyAllLogTables() - { - $db = Zend_Registry::get('db'); - $db->query('TRUNCATE TABLE '.Piwik_Common::prefixTable('log_action')); - $db->query('TRUNCATE TABLE '.Piwik_Common::prefixTable('log_visit')); - $db->query('TRUNCATE TABLE '.Piwik_Common::prefixTable('log_link_visit_action')); - } - - /** - * Call this method to disable the SQL query profiler - */ - public function disableProfiler() - { - $this->profiling = false; - Piwik_Tracker_Db::disableProfiling(); - } - - /** - * This is called at the end of the Generator script. - * Calls the Profiler output if the profiler is enabled. - */ - public function end() - { - if($this->profiling) - { - Piwik::printSqlProfilingReportTracker(); - } - Piwik_Tracker::disconnectDatabase(); - } - - /** - * Init the Generator script: - * - init the SQL profiler - * - init the random generator - * - setup the different possible values for parameters such as 'resolution', - * 'color', 'hour', 'minute', etc. - * - load from DataFiles and setup values for the other parameters such as UserAgent, Referers, AcceptedLanguages, etc. - * @see misc/generateVisitsData/ - */ - public function init() - { - Piwik::createLogObject(); - - $this->initProfiler(); - - /* - * Init the random number generator - */ - function make_seed() - { - list($usec, $sec) = explode(' ', microtime()); - return (float) $sec + ((float) $usec * 100000); - } - mt_srand(make_seed()); - - // set rec=1 parameter, required as of 0.5.5 in order to force the request to be recorded - $this->setCurrentRequest('rec', 1); - - /* - * Sets values for: resolutions, colors, idSite, times - */ - $common = array( - 'res' => array('1289x800','1024x768','800x600','564x644','200x100','50x2000',), - 'col' => array(24,32,16), - 'idsite'=> $this->idSite, - 'h' => range(0,23), - 'm' => range(0,59), - 's' => range(0,59), - ); - - foreach($common as $label => $values) - { - $this->addParam($label,$values); - } - - /* - * Sets values for: outlinks, downloads, campaigns - */ - // we get the name of the Download/outlink variables - $downloadOrOutlink = array('download', 'link'); - - // we have a 20% chance to add a download or outlink variable to the URL - $this->addParam('piwik_downloadOrOutlink', $downloadOrOutlink); - $this->addParam('piwik_downloadOrOutlink', array_fill(0,8,'')); - - // we get the variables name for the campaign parameters - $campaigns = array( - Piwik_Tracker_Config::getInstance()->Tracker['campaign_var_name'] - ); - // we generate a campaign in the URL in 3/18 % of the generated URls - $this->addParam('piwik_vars_campaign', $campaigns); - $this->addParam('piwik_vars_campaign', array_fill(0,15,'')); - - - /* - * Sets values for: Referers, user agents, accepted languages - */ - // we load some real referers to be used by the generator - $referers = array(); - require_once PIWIK_INCLUDE_PATH . '/plugins/VisitorGenerator/data/Referers.php'; - - $this->addParam('urlref',$referers); - - // and we add 2000 empty referers so that some visitors don't come using a referer (direct entry) - $this->addParam('urlref',array_fill(0,2000,'')); - - // load some user agent and accept language - $userAgent = $acceptLanguages = array(); - require_once PIWIK_INCLUDE_PATH . '/plugins/VisitorGenerator/data/UserAgent.php'; - require_once PIWIK_INCLUDE_PATH . '/plugins/VisitorGenerator/data/AcceptLanguage.php'; - $this->userAgents=$userAgent; - $this->acceptLanguage=$acceptLanguages; - } - - /** - * If the SQL profiler is enabled and if the reinit at every request is set to true, - * then we TRUNCATE the profiling information so that we only profile one visitor at a time - */ - protected function initProfiler() - { - /* - * Inits the profiler - */ - if($this->profiling) - { - if($this->reinitProfilingAtEveryRequest) - { - $all = Piwik_Query('TRUNCATE TABLE '.Piwik_Common::prefixTable('log_profiling').'' ); - } - } - } - /** - * Launches the process and generates an exact number of nbVisitors - * For each visit, we setup the timestamp to the common timestamp - * Then we generate between 1 and nbActionsMaxPerVisit actions for this visit - * The generated actions will have a growing timestamp so it looks like a real visit - * - * @param int The number of visits to generate - * @param int The maximum number of actions to generate per visit - * - * @return int The number of total actions generated - */ - public function generate( $nbVisitors, $nbActionsMaxPerVisit ) - { - $nbActionsTotal = 0; - for($i = 0; $i < $nbVisitors; $i++) - { - $nbActions = mt_rand(1, $nbActionsMaxPerVisit); - Piwik_VisitorGenerator_Visit::setTimestampToUse($this->getTimestampToUse()); - - $this->generateNewVisit(); - for($j = 1; $j <= $nbActions; $j++) - { - $this->generateActionVisit(); - $this->saveVisit(); - } - $nbActionsTotal += $nbActions; - } - return $nbActionsTotal; - } - - /** - * Generates a new visitor. - * Loads random values for all the necessary parameters (resolution, local time, referers, etc.) from the fake GET array. - * Also generates a random IP. - * - * We change the superglobal values of HTTP_USER_AGENT, HTTP_CLIENT_IP, HTTP_ACCEPT_LANGUAGE to the generated value. - */ - protected function generateNewVisit() - { - $this->setCurrentRequest( 'urlref' , $this->getRandom('urlref')); - $this->setCurrentRequest( 'idsite', $this->getRandom('idsite')); - $this->setCurrentRequest( 'res' ,$this->getRandom('res')); - $this->setCurrentRequest( 'col' ,$this->getRandom('col')); - $this->setCurrentRequest( 'h' ,$this->getRandom('h')); - $this->setCurrentRequest( 'm' ,$this->getRandom('m')); - $this->setCurrentRequest( 's' ,$this->getRandom('s')); - $this->setCurrentRequest( 'fla' ,$this->getRandom01()); - $this->setCurrentRequest( 'java' ,$this->getRandom01()); - $this->setCurrentRequest( 'dir' ,$this->getRandom01()); - $this->setCurrentRequest( 'qt' ,$this->getRandom01()); - $this->setCurrentRequest( 'realp' ,$this->getRandom01()); - $this->setCurrentRequest( 'pdf' ,$this->getRandom01()); - $this->setCurrentRequest( 'wma' ,$this->getRandom01()); - $this->setCurrentRequest( 'gears' ,$this->getRandom01()); - $this->setCurrentRequest( 'ag' ,$this->getRandom01()); - $this->setCurrentRequest( 'cookie',$this->getRandom01()); - - $_SERVER['HTTP_CLIENT_IP'] = mt_rand(0,255).".".mt_rand(0,255).".".mt_rand(0,255).".".mt_rand(0,255); - $_SERVER['HTTP_USER_AGENT'] = $this->userAgents[mt_rand(0,count($this->userAgents)-1)]; - $_SERVER['HTTP_ACCEPT_LANGUAGE'] = $this->acceptLanguage[mt_rand(0,count($this->acceptLanguage)-1)]; - } - - /** - * Generates a new action for the current visitor. - * We random generate some campaigns, action names, download or outlink clicks, etc. - * We generate a new Referer, that would be read in the case the visit last page is older than 30 minutes. - * - * This function tries to generate actions that use the features of Piwik (campaigns, downloads, outlinks, action_name set in the JS tag, etc.) - */ - protected function generateActionVisit() - { - // we don't keep the previous action values - // reinit them to empty string - $this->setCurrentRequest( 'download', ''); - $this->setCurrentRequest( 'link', ''); - $this->setCurrentRequest( 'action_name', ''); - - // generate new url referer ; case the visitor stays more than 30min - // (when the visit is known this value will simply be ignored) - $this->setCurrentRequest( 'urlref' , $this->getRandom('urlref')); - - // generates the current URL - $url = $this->getRandomUrlFromHost($this->host); - - // we generate a campaign - $urlVars = $this->getRandom('piwik_vars_campaign'); - - // if we actually generated a campaign - if(!empty($urlVars)) - { - // campaign name - $urlValue = $this->getRandomString(5,3,'lower'); - - // add the parameter to the url - $url .= '?'. $urlVars . '=' . $urlValue; - - // for a campaign of the CPC kind, we sometimes generate a keyword - if($urlVars == Piwik_Tracker_Config::getInstance()->Tracker['campaign_var_name'] - && mt_rand(0,1)==0) - { - $url .= '&'. Piwik_Tracker_Config::getInstance()->Tracker['campaign_keyword_var_name'] - . '=' . $this->getRandomString(6,3,'ALL');; - } - } - else - { - // we generate a download Or Outlink parameter in the GET request so that - // the current action is counted as a download action OR a outlink click action - $GETParamToAdd = $this->getRandom('piwik_downloadOrOutlink'); - if(!empty($GETParamToAdd)) - { - - $possibleDownloadHosts = array('http://piwik.org/',$this->host); - $nameDownload = $this->getRandomUrlFromHost($possibleDownloadHosts[mt_rand(0,1)]); - $extensions = array('.zip','.tar.gz'); - $nameDownload .= $extensions[mt_rand(0,1)]; - $urlValue = $nameDownload; - - // add the parameter to the url - $this->setCurrentRequest( $GETParamToAdd , $urlValue); - } - } - - $this->setCurrentRequest( 'url' ,$url); - - // setup the title of the page - $this->setCurrentRequest( 'action_name',$this->getRandomString(15,5)); - } - - /** - * Returns a random URL using the $host as the URL host. - * Depth level depends on @see setMaximumUrlDepth() - * - * @param string Hostname of the URL to generate, eg. http://example.com/ - * - * @return string The generated URL - */ - protected function getRandomUrlFromHost( $host ) - { - $url = $host; - - $deep = mt_rand(0,$this->maximumUrlDepth); - for($i=0;$i<$deep;$i++) - { - $name = $this->getRandomString(1,1,'alnum'); - - $url .= '/'.$name; - } - return $url; - } - - /** - * Generates a random string from minLength to maxLength using a specified set of characters - * - * Taken from php.net and then badly hacked by some unknown monkey - * - * @param int (optional) Maximum length of the string to generate - * @param int (optional) Minimum length of the string to generate - * @param string (optional) Characters set to use, 'ALL' or 'lower' or 'upper' or 'numeric' or 'ALPHA' or 'ALNUM' - * - * @return string The generated random string - */ - protected function getRandomString($maxLength = 15, $minLength = 5, $type = 'ALL') - { - $len = mt_rand($minLength, $maxLength); - - // Register the lower case alphabet array - $alpha = array('a', 'd', 'e', 'f', 'g'); - - // Register the upper case alphabet array - $ALPHA = array('A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', - 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'); - - // Register the numeric array - $num = array('1', '2', '3', '8', '9', '0'); - - // Register the strange array - $strange = array('/', '?', '!','"','£','$','%','^','&','*','(',')',' '); - - // Initialize the keyVals array for use in the for loop - $keyVals = array(); - - // Initialize the key array to register each char - $key = array(); - - // Loop through the choices and register - // The choice to keyVals array - switch ($type) - { - case 'lower' : - $keyVals = $alpha; - break; - case 'upper' : - $keyVals = $ALPHA; - break; - case 'numeric' : - $keyVals = $num; - break; - case 'ALPHA' : - $keyVals = array_merge($alpha, $ALPHA); - break; - case 'alnum' : - $keyVals = array_merge($alpha, $num); - break; - case 'ALNUM' : - $keyVals = array_merge($alpha, $ALPHA, $num); - break; - case 'ALL' : - $keyVals = array_merge($alpha, $ALPHA, $num, $strange); - break; - } - - // Loop as many times as specified - // Register each value to the key array - for($i = 0; $i <= $len-1; $i++) - { - $r = mt_rand(0,count($keyVals)-1); - $key[$i] = $keyVals[$r]; - } - - // Glue the key array into a string and return it - return join("", $key); - } - - /** - * Sets the _GET and _REQUEST superglobal to the current generated array of values. - * @see setCurrentRequest() - * This method is called once the current action parameters array has been generated from - * the global parameters array - */ - protected function setFakeRequest() - { - $_GET = $this->currentget; - } - - /** - * Sets a value in the current action request array. - * - * @param string Name of the parameter to set - * @param string Value of the parameter - */ - protected function setCurrentRequest($name,$value) - { - $this->currentget[$name] = $value; - } - - /** - * Returns a value for the given parameter $name read randomly from the global parameter array. - * @see init() - * - * @param string Name of the parameter value to randomly load and return - * @return mixed Random value for the parameter named $name - * @throws Exception if the parameter asked for has never been set - * - */ - protected function getRandom( $name ) - { - if(!isset($this->allget[$name])) - { - throw new exception("You are asking for $name which doesnt exist"); - } - else - { - $index = mt_rand(0,count($this->allget[$name])-1); - $value =$this->allget[$name][$index]; - return $value; - } - } - - /** - * Returns either 0 or 1 - * - * @return int 0 or 1 - */ - protected function getRandom01() - { - return mt_rand(0,1); - } - - /** - * Saves the visit - * - replaces GET and REQUEST by the fake generated request - * - load the Tracker class and call the method to launch the recording - * - * This will save the visit in the database - */ - protected function saveVisit() - { - $this->setFakeRequest(); - $process = new Piwik_VisitorGenerator_Tracker(); - $process->main(); - unset($process); - } -} diff --git a/plugins/VisitorGenerator/Tracker.php b/plugins/VisitorGenerator/Tracker.php deleted file mode 100644 index 0bc70796a9..0000000000 --- a/plugins/VisitorGenerator/Tracker.php +++ /dev/null @@ -1,53 +0,0 @@ -<?php -/** - * Piwik - Open source web analytics - * - * @link http://piwik.org - * @license http://www.gnu.org/licenses/gpl-3.0.html Gpl v3 or later - * @version $Id$ - * - * @category Piwik_Plugin - * @package Piwik_VisitorGenerator - */ - -/** - * Fake Piwik_Tracker that: - * - overwrite the sendHeader method so that no headers are sent. - * - doesn't print the 1pixel transparent GIF at the end of the visit process - * - overwrite the Tracker Visit object to use so we use our own Tracker_visit @see Piwik_Tracker_Generator_Visit - * - * @package Piwik_VisitorGenerator - */ -class Piwik_VisitorGenerator_Tracker extends Piwik_Tracker -{ - /** - * Does nothing instead of sending headers - */ - protected function sendHeader($header) - { - } - - /** - * Does nothing instead of displaying a 1x1 transparent pixel GIF - */ - protected function end() - { - } - - /** - * Returns our 'generator home made' Piwik_VisitorGenerator_Visit object. - * - * @return Piwik_VisitorGenerator_Visit - */ - protected function getNewVisitObject() - { - $visit = new Piwik_VisitorGenerator_Visit(); - $visit->generateTimestamp(); - return $visit; - } - - static function disconnectDatabase() - { - return; - } -} diff --git a/plugins/VisitorGenerator/Visit.php b/plugins/VisitorGenerator/Visit.php deleted file mode 100644 index 4aa41adcd0..0000000000 --- a/plugins/VisitorGenerator/Visit.php +++ /dev/null @@ -1,47 +0,0 @@ -<?php -/** - * Piwik - Open source web analytics - * - * @link http://piwik.org - * @license http://www.gnu.org/licenses/gpl-3.0.html Gpl v3 or later - * @version $Id$ - * - * @category Piwik_Plugin - * @package Piwik_VisitorGenerator - */ - -/** - * Fake Piwik_Tracker_Visit class that overwrite all the Time related method to be able - * to setup a given timestamp for the generated visitor and actions. - * - * @package Piwik_VisitorGenerator - */ -class Piwik_VisitorGenerator_Visit extends Piwik_Tracker_Visit -{ - static protected $timestampToUse; - - static public function setTimestampToUse($time) - { - self::$timestampToUse = $time; - } - protected function getCurrentDate( $format = "Y-m-d") - { - return date($format, $this->getCurrentTimestamp() ); - } - - protected function getCurrentTimestamp() - { - return self::$timestampToUse; - } - - public function generateTimestamp() - { - self::$timestampToUse = max(@$this->visitorInfo['visit_last_action_time'],self::$timestampToUse); - self::$timestampToUse += mt_rand(4,1840); - } - - protected function updateCookie() - { - @parent::updateCookie(); - } -} diff --git a/plugins/VisitorGenerator/VisitorGenerator.php b/plugins/VisitorGenerator/VisitorGenerator.php deleted file mode 100644 index ee13df4b32..0000000000 --- a/plugins/VisitorGenerator/VisitorGenerator.php +++ /dev/null @@ -1,44 +0,0 @@ -<?php -/** - * Piwik - Open source web analytics - * - * @link http://piwik.org - * @license http://www.gnu.org/licenses/gpl-3.0.html Gpl v3 or later - * @version $Id$ - * - * @category Piwik_Plugin - * @package Piwik_VisitorGenerator - */ - -/** - * - * @package Piwik_VisitorGenerator - */ -class Piwik_VisitorGenerator extends Piwik_Plugin { - - public function getInformation() { - $info = array( - 'description' => Piwik_Translate('VisitorGenerator_PluginDescription'), - 'author' => 'Piwik', - 'author_homepage' => 'http://piwik.org/', - 'version' => Piwik_Version::VERSION, - ); - return $info; - } - - public function getListHooksRegistered() { - return array( - 'AdminMenu.add' => 'addMenu', - ); - } - - public function addMenu() { - Piwik_AddAdminMenu( - 'VisitorGenerator_VisitorGenerator', - array('module' => 'VisitorGenerator', 'action' => 'index'), - Piwik::isUserIsSuperUser(), - $order = 10 - ); - } -} -?> diff --git a/plugins/VisitorGenerator/data/AcceptLanguage.php b/plugins/VisitorGenerator/data/AcceptLanguage.php deleted file mode 100644 index 49dde7c841..0000000000 --- a/plugins/VisitorGenerator/data/AcceptLanguage.php +++ /dev/null @@ -1,544 +0,0 @@ -<?php -/** - * Piwik - Open source web analytics - * - * @link http://piwik.org - * @license http://www.gnu.org/licenses/gpl-3.0.html Gpl v3 or later - * @version $Id$ - * - * @category Piwik_Plugin - * @package Piwik_VisitorGenerator - */ - -/** - * Accept-Language: strings - * - * @package Piwik_VisitorGenerator - */ -$acceptLanguages = array( -"fr", -"fr,fr-fr;q=0.8,en-us", -"fr-FR,fr;q=0.9,en;q=", -"fr", -"fr", -"fr", -"fr", -"fr", -"fr", -"fr", -"fr,fr-fr;q=0.8,en-us", -"fr", -"fr,fr-fr;q=0.8,en-us", -"fr,fr-fr;q=0.8,en-us", -"fr", -"fr", -"fr-ch", -"fr", -"fr,fr-fr;q=0.8,en-us", -"fr,fr-fr;q=0.8,en-us", -"fr", -"fr,fr-fr;q=0.8,en-us", -"fr", -"fr", -"fr", -"fr", -"fr,fr-fr;q=0.8,en-us", -"fr,fr-fr;q=0.8,en-us", -"fr-ca", -"fr", -"fr", -"de", -"fr", -"fr", -"fr", -"fr-fr", -"tr", -"en-us", -"fr", -"fr", -"fr", -"fr", -"fr", -"fr", -"fr", -"fr", -"fr", -"fr,fr-fr;q=0.8,en-us", -"fr", -"fr", -"en", -"fr", -"fr", -"fr,fr-fr;q=0.8,en-us", -"fr", -"fr", -"hu-hu,hu;q=0.8,en-us", -"fr", -"fr-be", -"fr", -"cs,en-us;q=0.7,en;q=", -"en,fr;q=0.91,de;q=0.", -"fr", -"fr-be", -"fr", -"fr", -"fr,fr-fr;q=0.8,en-us", -"fr", -"fr", -"fr,fr-fr;q=0.8,en-us", -"fr", -"fr,fr-fr;q=0.8,en-us", -"fr-be", -"fr", -"fr", -"fr", -"fr,fr-fr;q=0.8,en-us", -"fr", -"fr", -"fr-be", -"fr,fr-fr;q=0.8,en-us", -"en-us,en;q=0.5", -"fr", -"it-it,it;q=0.8,en-us", -"fr", -"fr", -"fr", -"fr", -"fr", -"fr-fr", -"el,fi;q=0.5", -"fr,fr-fr;q=0.8,en-us", - -"fr", -"fr", -"fr", -"fr", -"fr", -"fr", - -"fr", -"fr,fr-fr;q=0.8,en-us", -"fr", -"fr", -"fr", -"fr", -"fr,de-ch;q=0.5", -"fr", -"fr-ch", -"fr", -"fr", -"fr", -"fr", -"fr", -"fr", -"fr,fr-fr;q=0.8,en-us", -"fr-fr,fr;q=0.5", -"fr", -"fr", -"fr", -"fr", -"fr-be", -"fr-ca", -"fr", -"fr", -"fr", -"en-gb", -"fr", -"fr", -"fr,fr-fr;q=0.8,en-us", -"fr", -"en,fr;q=0.8,fr-fr;q=", -"fr,fr-fr;q=0.8,en-us", -"fr-be", -"fr", -"fr", -"fr,fr-fr;q=0.8,en-us", -"fr,fr-fr;q=0.8,en-us", -"fr,fr-fr;q=0.8,en-us", -"fr,fr-fr;q=0.8,en-us", -"fr,fr-fr;q=0.8,en-us", -"fr", -"fr", -"pl", -"fr", -"fr", -"en-us", -"fr,fr-fr;q=0.8,en-us", -"fr,fr-fr;q=0.8,en-us", -"fr,fr-fr;q=0.8,en-us", -"fr,fr-fr;q=0.8,en-us", -"fr", -"fr", -"fr", -"fr", -"fr,fr-fr;q=0.8,en-us", -"en-us,en;q=0.5", -"fr", -"de", -"it", -"en-us,en;q=0.5", -"fr", -"en-us,en;q=0.5", -"fr", -"fr,fr-fr;q=0.8,en-us", -"fr", -"fr, en", -"fr,fr-fr;q=0.8,en-us", -"fr", -"fr", -"fr", -"fr", -"fr", -"fr", -"fr", -"fr", -"fr", -"fr", -"fr", -"fr,fr-fr;q=0.8,en-us", -"fr", -"fr,fr-fr;q=0.8,en-us", -"fr,fr-fr;q=0.8,en-us", -"fr", -"fr,ar-dz;q=0.5", -"fr", -"fr", -"fr", -"fr", -"fr,fr-fr;q=0.8,en-us", -"fr,fr-fr;q=0.8,en-us", -"pl,en-us;q=0.7,en;q=", -"en-gb", -"fr-be", -"hu", -"fr", -"fr,fr-fr;q=0.8,en-us", -"de-de,de;q=0.8,en-us", -"fr,fr-fr;q=0.8,en-us", -"fr", -"fr", -"fr", -"fr", -"en-us", -"fr", -"fr-ch", -"de", -"fr", -"fr", -"bg", -"fr,ar-ma;q=0.5", -"fr", -"fr", -"fr-be", - -"fr", -"fr", -"fr", -"fr", -"fr,fr-fr;q=0.8,en-us", -"fr", -"en-us,en;q=0.5", -"fr,fr-fr;q=0.8,en-us", -"fr", -"fr", -"fr", -"fr", -"fr", -"fr", -"fr", -"fr", -"fr", -"fr", -"fr,fr-fr;q=0.8,en-us", -"fr,fr-fr;q=0.8,en-us", -"fr", -"fr", -"fr", -"fr,fr-fr;q=0.8,en-us", -"fr", -"fr", -"fr", -"fr", -"fr", -"fr", -"fr", -"fr", -"fr", -"fr", -"fr", -"fr", -"fr", -"fr", -"fr", -"fr", -"fr", -"fr", -"fr", -"fr,fr-fr;q=0.8,en-us", -"fr", -"fr,fr-fr;q=0.8,en-us", -"fr", -"fr", -"fr", -"fr,fr-fr;q=0.8,en-us", -"en-us,en;q=0.5", -"fr", -"fr", -"fr-fr, fr;q=0.50", -"fr", -"fr", -"fr", -"fr,fr-fr;q=0.8,en-us", -"fr", -"fr", -"fr", -"fr,fr-fr;q=0.8,en-us", -"fr,fr-fr;q=0.8,en-us", -"fr", -"fr", -"fr", -"fr,fr-fr;q=0.8,en-us", -"fr", -"fr,fr-fr;q=0.8,en-us", -"fr", -"fr", -"fr", -"fr", -"fr", -"fr", -"fr,fr-fr;q=0.8,en-us", -"da-dk", -"fr", -"fr,fr-fr;q=0.8,en-us", -"he", -"fr", -"fr", -"fr", -"fr", -"fr", -"fr", -"fr", -"fr,fr-fr;q=0.8,en-us", -"fr,fr-fr;q=0.8,en-us", -"fr", -"fr", -"fr", -"fr", -"fr,fr-fr;q=0.8,en-us", -"fr", -"fr", -"fr", -"fr", -"fr-ca", -"fr", -"fr", -"fr", -"fr", -"fr", -"fr", -"fr", -"fr", -"zh-cn", -"fr", -"fr", -"fr", -"fr,fr-fr;q=0.8,en-us", -"fr", -"fr", -"fr", -"fr,fr-fr;q=0.8,en-us", -"fr", -"fr", -"fr", -"fr", -"fr", -"fr,fr-fr;q=0.8,en-us", -"fr", -"fr", -"fr", -"fr", -"fr", -"fr", -"it", -"fr", -"fr,fr-fr;q=0.8,en-us", -"fr,fr-fr;q=0.8,en-us", -"fr", -"fr", -"fr", -"fr", -"fr", -"fr", -"fr", -"fr", -"fr", -"fr", -"fr-ch", -"cs,en-us;q=0.7,en;q=", -"th", -"fr,fr-fr;q=0.8,en-us", -"fr", -"fr", -"fr", -"fr", -"fr,fr-fr;q=0.8,en-us", -"fr-be", -"fr", -"fr", -"fr", -"fr", -"en-us", -"fr", -"fr,fr-fr;q=0.8,en-us", -"fr", -"fr", -"fr", -"fr", -"fr", -"fr", -"fr", -"fr", -"fr", -"fr", -"fr,fr-fr;q=0.5", -"cs,en-us;q=0.7,en;q=", -"fr", -"fr", -"fr", -"en-us", -"fr", -"fr,fr-fr;q=0.8,en-us", -"fr,fr-fr;q=0.8,en-us", -"fr", -"fr", -"fr", -"ar-bh", -"fr", -"fr", -"fr", -"fr", -"fr", -"fr", -"fr", -"en-us", -"fr,fr-fr;q=0.8,en-us", -"fr", -"fr-ca", -"fr-FR,fr;q=0.9,en;q=", -"fr", -"fr,fr-fr;q=0.8,en-us", -"fr,fr-fr;q=0.8,en-us", -"en-us", -"fr", -"fr", -"fr", -"fr", -"fr,fr-fr;q=0.8,en-us", -"fr-be,fr;q=0.5", -"fr", -"fr", -"fr", -"en-us", -"fr-fr", -"fr,fr-fr;q=0.8,en-us", -"fr", -"fr,fr-fr;q=0.8,en-us", -"fr,fr-fr;q=0.8,en-us", -"fr,fr-fr;q=0.8,en-us", -"fr,fr-fr;q=0.8,en-us", -"fr", -"fr", -"fr", -"fr,fr-fr;q=0.8,en-us", -"fr,fr-fr;q=0.8,en-us", -"fr", -"fr", -"fr", -"fr", -"fr-be", -"fr", -"fr", -"fr", -"fr", -"fr-be", -"fr", -"fr-ca", -"fr", -"fr", -"fr", -"fr", -"fr", -"fr", -"fr", -"fr,fr-fr;q=0.8,en-us", -"fr", -"fr", -"fr", -"fr,fr-fr;q=0.8,en-us", -"fr", -"fr", -"fr", -"fr,fr-fr;q=0.8,en-us", - -"fr", -"fr", -"fr", -"fr", -"fr", -"fr", -"fr", -"fr", -"fr", -"fr-be", -"fr-fr", -"tr", -"fr", -"fr", -"fr", -"fr", -"fr", -"fr", -"fr", -"fr", -"fr", -"fr", -"fr", -"fr", -"fr", -"fr-be", -"fr,fr-fr;q=0.8,en-us", -"fr", -"fr", -"fr", -"fr-be", -"fr", -"en-gb", -"fr", -"fr", -"fr,fr-fr;q=0.8,en-us", -"fr", -"fr", -"fr", -"fr", -"fr", -"fr", -"fr", -"fr", -"fr,fr-fr;q=0.8,en-us", -"fr,fr-fr;q=0.8,en-us", -"fr", -"fr", -"fr", -"fr-fr", -"es-es,es;q=0.8,en-us", -"fr,fr-fr;q=0.8,en-us", -"fr-be", -"fr", -"fr", -"en-us,en;q=0.5", -"fr", -"fr", -"fr", - - ); - diff --git a/plugins/VisitorGenerator/data/Referers.php b/plugins/VisitorGenerator/data/Referers.php deleted file mode 100644 index 3d0086d850..0000000000 --- a/plugins/VisitorGenerator/data/Referers.php +++ /dev/null @@ -1,702 +0,0 @@ -<?php -/** - * Piwik - Open source web analytics - * - * @link http://piwik.org - * @license http://www.gnu.org/licenses/gpl-3.0.html Gpl v3 or later - * @version $Id$ - * - * @category Piwik_Plugin - * @package Piwik_VisitorGenerator - */ - -/** - * Referer: strings - * - * @package Piwik_VisitorGenerator - */ -$referers = array( -"http://www.google.fr/search?hl=fr&q=statistique langues internet&btnG=Recherche Google&meta=", -"http://annusiteperso.free.fr/", -"http://www.google.com/search?hl=fr&sa=X&oi=spell&resnum=0&ct=result&cd=1&q=logiciel arab gratuit&spell=1", -"http://www.google.de/search?hl=de&q=phpmyvisits&meta=&btnG=Google-Suche", -"http://www.narodnjaci-mp3.cro-windows-vista.info/permalink.php?article=6.txt", -"http://lelogiciellibre.net/telecharger/statistiques-audience-sites.php", -"http://www.framasoft.net/article2101.html", -"http://humour25.free.fr/index.php3?page=videos-sexe", -"http://search.ke.voila.fr/S/orange?rtype=kw&profil=smart&bhv=web_fr&rdata=google&logid=2093200001174768155748412&keap=28&prevnbans=10&ap=4", -"http://translate.google.com/translate_n?hl=en&sl=fr&u=http://www.phpmyvisites.net/&prev=/search%3Fq%3Dopen%2Bsource%2Bweb%2Banalytics%26hl%3Den%26safe%3Doff%26sa%3DG", -"http://blog.bobobook.cn/?p=95", -"http://www.google.com/search?q=creer site gratuit facile logiciel&sourceid=ie7&rls=com.microsoft:en-US&ie=utf8&oe=utf8", -"http://search.ke.voila.fr/S/voila?profil=voila&bhv=web_fr&rdata=site%20de%20traduction%20gratuit", -"http://www.google.com/search?sourceid=navclient&hl=fr&ie=UTF-8&rls=SUNA,SUNA:2006-25,SUNA:fr&q=configuration des mises %c3%a0 jour", -"http://www.phpmyvisites.net/faq/", -"http://www.framasoft.net/article2101.html", -"http://www.neutrinium238.com/tutoriaux/photoshop/index.php?id=9", -"http://www.google.co.th/search?hl=th&q=web statistic php&btnG=%E0%B8%84%E0%B9%89%E0%B8%99%E0%B8%AB%E0%B8%B2&meta=", -"http://www.creer-un-site-internet.com/statistiques-site-internet.php", -"http://forums.phpbb-fr.com/viewtopic_122536.html?hl=statistique", -"http://www.computer.co.hu/index.php?option=com_contact&task=view&contact_id=3&Itemid=3", -"http://www.google.fr/search?hl=fr&sa=X&oi=spell&resnum=0&ct=result&cd=1&q=phpmyvisites&spell=1", -"http://siio.free.fr/12_Images3D_2005_001/index.htm", -"http://www.phpmyvisites.us/", -"http://philipeau.free.fr/logiciels.htm", -"http://www.girls-love-shit.com/", -"http://www.satellitemania.it/", -"http://www.google.fr/search?hl=fr&q=phpmyvisites.net&meta=", -"http://www.videoscoop.ch/nature.php", -"http://www.google.fr/search?q=phpmyvisites&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:fr:official&client=firefox-a", -"http://www.csr.gov.rw/", -"http://www.google.fr/search?q=statistiques php&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:fr:official&client=firefox-a", -"http://fr.search.yahoo.com/search?p=statistiques&fr=yfp-t-501&ei=UTF-8&meta=vc%3D", -"http://anonymouse.org/cgi-bin/anon-www.cgi/http://www.tempsgranollers.com/rss.xml", -"http://www.phpmyvisites.net/", -"http://www.phpmyvisites.net/", -"http://anonymouse.org/cgi-bin/anon-www.cgi/http://www.tempsgranollers.com/rss.xml", -"http://www.google.es/search?hl=es&newwindow=1&q=php my visit&btnG=B%C3%BAsqueda&meta=lr%3D", -"http://www.google.fr/search?hl=fr&q=creation de site web gratuit avec free&meta=", -"http://www.gayfluence.com/index2.php", -"http://www.phpscripts-fr.net/scripts/script.php?id=2120", -"http://christophe.papin1.free.fr/cuisiniere.php?page=1&total=27", -"http://universsimpson.free.fr/ullmanspage.php", -"http://www.google.fr/search?q=configuration phpmyvisites&ie=utf-8&oe=utf-8&aq=t&rls=com.ubuntu:fr:official&client=firefox-a", -"http://www.rapidojeux.com/", -"http://www.phpmyvisites.us/", -"http://www.unopiuuno.ch/", -"http://www.babylon-x-fr.com/vcount/index.php?site=1&date=2007-03-23&period=1&mod=view_visits", -"http://www.google.fr/search?hl=fr&q=The server encountered an internal error or misconfiguration and was unable to complete your request.&btnG=Recherche Google&meta=", -"http://forum.pluxml.org/viewtopic.php?pid=3670", -"http://stats.pointdecroix.org/phpmyvisites.php", -"http://www.imageshock.eu/hotovo.php?idcka=69950&klic=st6njip0", -"http://www.google.be/search?q=download&hl=fr&lr=lang_fr&start=30&sa=N", -"http://www.justiciaviva.org.pe/phpmyvisites/index.php?part=pages&img=1&stats=1&date=2007-03-24&oldd=2007-03-24&per=1&site=1", -"http://search.ke.voila.fr/S/orange?rtype=kw&profil=orange&bhv=web_fr&kw= &rdata=jeu pour jouer maintenant gratuit", -"http://www.google.fr/search?q=phpmyvisites&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:fr:official&client=firefox-a", -"http://www.phwinfo.com/forum/showthread.php?t=1316", -"http://by139fd.bay139.hotmail.msn.com/cgi-bin/getmsg?msg=274D9F1D-403E-49E1-A79C-9C568CABCFD0&start=0&len=7532&imgsafe=n&curmbox=00000000%2d0000%2d0000%2d0000%2d000000000001&a=3ce4627258ed7575c8d95f64bf4f6b108d8b30c775297517dcfee686fb26e3e0", -"http://gibsea28.wifeo.com/index.php", -"http://www.phpmyvisites.net/", -"http://www.phpmyvisites.net/?_RW_=http%3A%2F%2Fwww.moto-site.ru%2F%3Fpg%3D0201|onclick|L8", -"http://www.closerie-des-sacres.com/accueil.php?page=accueil1&lang=fr", -"http://www.la-cuisine-marocaine.com/phpmyvisites/index.php?mod=login&error_login=1", -"http://www.phpmyvisites.net/phpmv2/", -"http://shoe.free.fr/root.php?target=snap", -"http://www.phpmyvisites.net/", -"http://www.jecolorie.com/", -"http://www.google.fr/search?sourceid=navclient&hl=fr&ie=UTF-8&rls=DVXB,DVXB:2005-27,DVXB:fr&q=php my visite", -"http://www.borber.com/en/projects/wp2drupal", -"http://www.fil-en-scene.net/stats/phpmyvisites.php", -"http://www.cote-dopale.com/statistiques/", -"http://del.icio.us/search/?all=statistics&page=2", -"http://www.unilago.com.co/", -"http://www.offestival.com/contact-fr.html", -"http://www.google.fr/search?hl=fr&q=telecharger plusieurs langue dans une site %2Bphp&meta=", -"http://www.phpmyvisites.net/telechargements.html", -"http://www.phpmyvisites.us/documentation/Installation", -"http://www.phpscripts-fr.net/scripts/derniers.php", -"http://belgant.winetux.be/forums/index.php?act=idx", -"http://www.phpmyvisites.net/screenshots.html", -"http://www.phpmyvisites.us/", -"http://www.logement.com.tn/mvente.htm", -"http://www.vinternet.net/", -"http://crok.dockyr.com/", -"http://www.lorajos.nl/", -"http://homeomath.imingo.net/pagedr.htm", -"http://www.tophost.it/aiuto/cat2/15/63/", -"http://www.guides-webmaster.com/annuaire/", -"http://www.google.co.ma/search?hl=fr&q=hebergeur my site for free&meta=", -"http://www.delfiweb.com/v2/", -"http://www.cuelgatuinvento.com/ideas/modules/news/article.php?storyid=113", -"http://www.radioslavonija.hr/program/?o_programu", -"http://www.mangas.adultes.free.fr/", -"http://forum.telecharger.01net.com/telecharger/programmation_et_developpement/open_source/outil_gratuit_de_statistiques_de_sites_internet_pour_webmasters-311247/messages-1.html", -"http://www.phpmyvisites.us/", -"http://www.kaerwa-all-stars.de/rechts.htm", -"http://www.google.fr/search?hl=fr&q=statistique site web&btnG=Recherche Google&meta=", -"http://www.chorus-chanson.fr/HOME2/NUMERO57/dossierBrassens572.htm", -"http://www.shirtjemeteenmissie.nl/static/index.php?mod=admin_index", -"http://www.phpmyvisites.net/etudes-de-cas.html", -"http://www.google.co.ma/search?hl=fr&q=logiciel gratuit&meta=", -"http://www.fnar-tounes.com/sitemap.php", -"http://www.11vm-serv.net/index.php?p=domregister", -"http://www.google.fr/search?hl=fr&client=firefox-a&channel=s&rls=org.mozilla%3Afr%3Aofficial&q=Fatal error%3A Call to undefined function&btnG=Rechercher&meta=lr%3Dlang_fr", -"http://proxyjoint.com/Y29t/ZGdhbWVza3k/d3d3/aHR0cDovL3d3dy5kZ2FtZXNreS5jb20vY2hlY2tvdXRfcGF5bWVudC5waHA/69/0/", -"http://blog.bretagne-balades.org/index.php/", -"http://www.framasoft.net/article2101.html", -"http://www.google.fr/search?sourceid=navclient&hl=fr&ie=UTF-8&rls=GGLJ,GGLJ:2006-40,GGLJ:fr&q=phpmyvisites", -"http://www.unilago.com.co/", -"http://www.google.ca/search?hl=fr&q=statistiques site web&btnG=Recherche Google&meta=", -"http://wars-world.fr/login.php", -"http://www.phpmyvisites.net/?_RW_=http%3A%2F%2Fal-kanz.org%2Fblog%2F|onclick|L0", -"http://news.itoncc.com/MingPao/eaindex.htm", -"http://yanael.com/", -"http://www.google.com/search?hl=en&rls=SUNA,SUNA:2006-13,SUNA:en&q=related:www.platinium-ca.com/nice.htm", -"http://search.live.com/results.aspx?q=undefined&first=31&FORM=PERE3", -"http://www.neutrinium238.com/tutoriaux/photoshop/utiliser_outil_plume.html", -"http://www.scat-hell.com/", -"http://search.ke.voila.fr/S/orange?rtype=kw&profil=orange&bhv=web_fr&rdata=GRATUIT&logid=1533300001174789477883674&keap=68&prevnbans=11&ap=8", -"http://www.google.fr/search?hl=fr&q=simsun.ttc download&meta=", -"http://www.webview360.com/room?room=165399", -"http://www.zone-webmasters.net/scripts-php-41.php", -"http://www.google.fr/search?hl=fr&sa=X&oi=spell&resnum=0&ct=result&cd=1&q=mesure d%27audience&spell=1", -"http://www.mercy-mercy.com", -"http://www.xxxpass.se/", -"http://www.phpmyvisites.net/", -"http://www.google.ca/search?hl=en&q=phpMyVisites&meta=", -"http://www.google.fr/search?hl=fr&rls=GGLJ,GGLJ:2006-29,GGLJ:fr&sa=X&oi=spell&resnum=0&ct=result&cd=1&q=php my visite&spell=1", -"http://foro.powers.cl/viewtopic.php?t=190228&sid=44b527252cd76e00ec9da17a102b0bda", -"http://www.thediary.org/coleo", -"http://www.girls-love-shit.com/", -"http://didier-ott.no-ip.org/public/genea/cousins/diff/diff%20Files/doc6905.htm", -"http://www.google.fr/search?hl=fr&q=statistique visite en PHP rapide&btnG=Rechercher&meta=", -"http://seznamka.uzdroje.cz/", -"http://www.google.fr/search?sourceid=navclient&aq=t&hl=fr&ie=UTF-8&rlz=1T4HPEB_frFR214FR214&q=erreur 500", -"javascript:Defcat(live)", -"http://imagelatente.ernestotimor.com/pages/ym-houses_11b.html", -"http://www.google.fr/search?hl=fr&q=PHPMyVisites&btnG=Recherche Google&meta=lr%3Dlang_fr", -"http://news.itoncc.com/MingPao/jaindex.htm", -"http://www.tosdn.com/script/script.php?sid=2622&scat=23", -"http://www.bswr.de/Fauna/Wanderfalke/OB_live1.htm", -"http://linux.tlk.fr/games/Powermanga/screenshots/", -"http://msdgmedia.free.fr/PagesNews/PageNews.html", -"http://www.dotclear.net/forum/viewtopic.php?id=26210", -"http://www.phpscripts-fr.net/scripts/script.php?id=2120", -"http://szex.szextra.hu/cikk/?r=1", -"http://www.startrek-voyager.nl/voyager/dek1.htm", -"http://www.svenalbert.de/24-0-meine-gedanken.html", -"http://www.google.fr/search?q=phpmyvisites&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:fr:official&client=firefox-a", -"http://www.google.fr/search?q=phpmyvisites&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:fr:official&client=firefox-a", -"http://www.google.fr/search?hl=fr&q=phpmyvisites&meta=", -"http://siscalocca.org/blog/index.php", -"http://search.ke.voila.fr/S/orange?rtype=kw&profil=smart&bhv=web_fr&kw= &rdata=moteurs de recherches", -"http://www.phpmyvisites.us/requirements.html", -"http://www.roi-president.com/galerie/pages/Cardinal_de_Richelieu.htm", -"http://www.phpmyvisites.net/telechargements.html", -"http://e.bardiau.free.fr/bonheur.html", -"http://www.phpmyvisites.net/forums/index.php/t/1328/0/", -"http://www.geraldlevanchau.com/stat/index.php?site=1&date=2007-03-24&period=1&mod=view_source", -"http://www.asap-provence.fr/?get=Links&do=top-rank", -"http://www.google.fr/search?hl=fr&q=logiciel pour creer des site internet gratuit avec exemple&meta=", -"http://www.meteo.lt/oru_prognoze.php", -"http://meshlab.sourceforge.net/phpmv2/index.php?site=1&period=1&mod=view_referers&date=2007-03-22", -"http://www.icaformation.fr/Presentation.php", -"http://search.ke.voila.fr/S/orange?sev=&rtype=kw&profil=orange&bhv=web_fr&rdata=SOUMETTRE UN SITE%2BORANGE&submit.x=32&submit.y=5", -"http://www.google.cn/search?q=CV de statistique&complete=1&hl=zh-CN&inlang=zh-CN&newwindow=1&client=aff-5566&channel=searchbutton2&hs=z7h&affdom=5566.net&start=40&sa=N", -"http://www.phpmyvisites.net/phpmv2/index.php?site=1&date=2007-03-24&period=1&mod=view_visits", -"http://www.phpmyvisites.net/phpmv2/index.php?site=1&date=2007-03-24&period=1&mod=view_pages", -"http://membres.lycos.fr/ecrausaz/?", -"http://www.commentcamarche.net/forum/affich-1081477-adresse-ip-visiteur", -"http://www.phpmyvisites.net/forums/index.php/t/3252/0/", -"http://www.phpmyvisites.net/documentation/Accueil", -"http://www.phpmyvisites.net/telechargements.html", -"http://www.phpmyvisites.net/", -"http://www.framasoft.net/article2101.html", -"http://www.framasoft.net/article2101.html", -"http://www.phpmyvisites.net/", -"http://www.phpmyvisites.net/telechargements.html", -"http://www.phpmyvisites.net/documentation/Accueil", -"http://www.phpmyvisites.net/documentation/Accueil", -"http://www.phpmyvisites.net/telechargements.html", -"http://www.phpmyvisites.net/", -"http://www.framasoft.net/article2101.html", -"http://www.lust-and-cross.com/", -"http://frank.albrecht.free.fr/gestclasse_v7/index.php?page=accueil", -"http://www.tendanceouest.com/radiolive.htm", -"http://www.delfiweb.com/v2/", -"http://www.pieces-auto-export.com/casse_auto_Aunis.php", -"http://www.lavillat.com/news.php", -"http://diskuse.jakpsatweb.cz/index.php?action=vthread&forum=13&topic=24403", -"http://forums.wifeo.com/viewtopic.php?t=4997", -"http://www.webmaster-experience.net/", -"http://www.malta.poznan.pl/", -"http://www.controlcomp.eu/webstat/demo", -"http://www.google.fr/search?sourceid=navclient-ff&ie=UTF-8&rls=GGGL,GGGL:2006-22,GGGL:fr&q=lettre pour logo", -"http://www.google.fr/search?hl=fr&q=phpmyvisites&meta=", -"http://www.linuxorable.fr/croquerrant/phpmyvisit/phpmyvisites.php", -"http://www.google.fr/search?hl=fr&rls=GGIH,GGIH:2007-02,GGIH:fr&q=related:www.tele2.fr/", -"http://www.lapalousey.com/agence_cav4.php?select=3&n=3", -"http://www.lapalousey.com/agence_cav2.php?select=3&n=3&cat=1", -"http://perso.orange.fr/amp-racing/cadre/contenu.htm", -"http://www.google.fr/custom?q=fonctionnement de debug&hl=fr&oe=ISO-8859-1&client=pub-3703351194586770&channel=1361273120&cof=FORID:1%3BGL:1%3BLBGC:336699%3BLC:%230000ff%3BVLC:%23663399%3BGFNT:%230000ff%3BGIMP:%230000ff%3BDIV:%23336699%3B&domains=french.ircfast.com&start=20&sa=N", -"http://www.mycodes.net/soft/6536.htm", -"http://www.kolucci.ru/", -"http://www.google.fr/search?hl=fr&q=outil stats php mysql &meta=", -"http://www.phpmyvisites.net/", -"http://search.ke.voila.fr/S/orange?rtype=kw&profil=orange&bhv=web_fr&kw= &rdata=dictionnaire gratuit", -"http://www.google.fr/search?hl=fr&q=demo&btnG=Recherche Google&meta=", -"http://www.google.fr/search?hl=fr&q=demo&btnG=Recherche Google&meta=", -"http://aqua.lorca.free.fr/poissons.php3", -"http://www.phpmyvisites.net/forums/index.php/t/2593/0/", -"http://www.controlcomp.eu/webstat/demo", -"http://www.dhammadana.org/dhamma/3_caracteristiques.htm", -"http://www.phpmyvisites.us/", -"http://aj.garcia.free.fr/index10.htm", -"http://www.hotel-post-nesselwang.de/inh_home.htm", -"http://www.sex974.com/videocochon.php", -"http://www.siteporno.be/stats/index.php?mod=login", -"http://www.rouen.fr/vousetes/touriste", -"http://www.phpmyvisites.net/", -"http://www.google.fr/search?hl=fr&q=phpMyVisites&btnG=Rechercher&meta=cr%3DcountryFR", -"http://cgpa64.free.fr/bdd/base.php", -"http://www.google.fr/search?hl=fr&sa=X&oi=spell&resnum=0&ct=result&cd=1&q=cr%C3%A9er un logiciel de jeu entierement gratuit&spell=1", -"http://delmotte.brice.free.fr/heol/maisonautonome/electricite.php", -"http://www.google.fr/search?q=oscommerce&hl=fr&lr=lang_fr&start=40&sa=N", -"http://xcell05.free.fr/pages/divers/index.html", -"http://www.google.it/search?hl=it&client=firefox-a&channel=s&rls=org.mozilla%3Ait%3Aofficial&hs=fSj&q=phpmyvisits&btnG=Cerca&meta=", -"http://www.balsa-composites.com/", -"http://msdgmedia.free.fr/Multimedia/Ge_FeuilleVolante/FeuilleVolanteComplet.htm", -"http://www.starclubbing.com/component/option,com_zoom/Itemid,31/", -"http://www.futureadvertising.net/", -"http://www.google.fr/search?hl=fr&q=logiciel libre cr%C3%A9ation site web &meta=", -"http://www.phpmyvisites.net/", -"http://www.phpmyvisites.net/", -"http://www.google.fr/search?q=logiciel gratuit&hl=fr&client=firefox-a&channel=s&rls=org.mozilla:fr:official&hs=qxj&start=10&sa=N", -"http://www.google.fr/search?hl=fr&q=PHP Fatal error%3A Call to undefined function &btnG=Rechercher&meta=", -"http://www.google.fr/search?client=firefox-a&rls=org.mozilla%3Afr%3Aofficial&channel=s&hl=fr&q=Call to undefined function%3A imagecreatefrompng%28%29 easyphp&meta=&btnG=Recherche Google", -"http://www.google.fr/search?client=firefox-a&rls=org.mozilla%3Afr%3Aofficial&channel=s&hl=fr&q=Call to undefined function%3A imagecreatefrompng%28%29 easyphp&meta=&btnG=Recherche Google", -"http://vauv.net/index.php", -"http://planetenat2.free.fr/apljav/applets_java.htm", -"http://www.lascholastique.fr/stats/phpmyvisites.php", -"http://www.google.fr/search?hl=fr&sa=X&oi=spell&resnum=0&ct=result&cd=1&q=traduire en espagnol %22il faut que%22&spell=1", -"http://www.lessymboles.com/article_maladieschroniques.htm", -"http://www.phpmyvisites.net/phpmv2/", -"http://zerod.info/videos/", -"http://by140fd.bay140.hotmail.msn.com/cgi-bin/getmsg?msg=FD8E5F4E-1F13-4322-AC97-82AB6D74FDB8&mfs=&_HMaction=move&tobox=00000000-0000-0000-0000-000000000002&direction=next&wo=&curmbox=00000000%2d0000%2d0000%2d0000%2d000000000001&a=946d46e12e9c2bbdf47228e3483f2962a4c2c7622e3139d82e3a8f498e6c108f", -"http://www.google.fr/search?hl=fr&q=documentation logiciel statistique&meta=", -"http://laville.respublicae.org/eng/thecity.htm", -"http://www.phpmyvisites.net/etudes-de-cas.html", -"http://www.phpmyvisites.net/telechargements.html", -"http://www.phpscripts-fr.net/scripts/scripts.php?cat=Statistiques&deb=10&tri=NOM&sens=ASC", -"http://www.phpmyvisites.us/", -"http://www.google.be/search?hl=fr&q=site php my sql gratuit&meta=", -"http://www.fengshui.antylicho.pl/miejsca-mocy/", -"http://www.google.fr/search?hl=fr&q=phpmyvisites&btnG=Rechercher&meta=", -"http://search.ke.voila.fr/S/orange?sev=&rtype=kw&profil=orange&bhv=web_fr&rdata=dictionnaire gratuit", -"http://toubibs.free.free.fr/index2.php?page=Votre%20ordinateur&menu=Votre%20ordinateur", -"http://www.google.com/search?client=opera&rls=en&q=open source web analytic&sourceid=opera&ie=utf-8&oe=utf-8", -"http://fr.google.mozilla.com/search?q=site de telechargement gratuit et rapide&hl=fr&lr=&start=10&sa=N", -"http://www.google.com/search?sourceid=navclient&hl=fr&ie=UTF-8&rls=SUNA,SUNA:2007-12,SUNA:fr&q=telecharger net stats", -"http://www.lagratte.net/index.php?error=404", -"http://www.google.fr/search?q=installer javascript&hl=fr&start=10&sa=N", -"http://www.educlasse.ch/", -"http://www.sacaboulons.com/index.php?lng=fr", -"http://www.google.fr/search?client=firefox-a&rls=org.mozilla%3Afr%3Aofficial&channel=s&hl=fr&q=erreur 500&meta=&btnG=Recherche Google", -"http://www.frxoops.org/modules/newbb/viewtopic.php?topic_id=20495&forum=12", -"http://search.free.fr/google.pl", -"http://mon-evenement.com/annuaire/annuaire_des_prestataires/fiche_prest.php?id_annu_prest=2990&cp=91100&submit=4", -"http://209.85.129.104/search?q=cache:z-1yaW4CGjAJ:svt.ac-dijon.fr/dyn/article.php3%3Fid_article%3D62 ministere education nationale DP%26D svt coll%C3%A8ge&hl=fr&strip=1", -"http://tropics-l.nuxit.net/lin%e9/Comming%20Soon%20-%20Lin%e9arts.net.htm", -"http://localhost/essai/phpmyvisites_2_2/phpmv2/index.php?site=1&date=2007-03-24&period=1&mod=view_visits", -"http://universsimpson.free.fr/itchyscratchy.php", -"http://www.google.fr/search?q=php my visit&ie=utf-8&oe=utf-8&rls=org.mozilla:fr:official&client=firefox-a", -"http://www.google.fr/search?hl=fr&client=firefox-a&channel=s&rls=org.mozilla%3Afr%3Aofficial&hs=Kq5&q=joomla mesure d audience&btnG=Rechercher&meta=", -"http://sd-4869.dedibox.fr/mariage/index.php?option=com_content&task=category§ionid=1&id=1&Itemid=5", -"http://www.phpsecure.info/v2/zone/pComment?d=1093902187", -"http://www.mon-evenement.com/annuaire/annuaire_des_prestataires/fiche_prest.php?submit=7&id_annu_prest=1017&cp=26790", -"http://www.phpmyvisites.net/", -"http://www.cri74.org/docs/web/", -"http://www.google.fr/search?q=The server encountered an internal error or misconfiguration and was unable to complete your request&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:fr:official&client=firefox-a", -"http://www.phpmyvisites.net/phpmv2/index.php?site=1&date=2007-03-24&period=1&", -"http://www.phpmyvisites.net/forums/index.php/t/1302/0/", -"http://www.google.fr/search?q=phpmyvisit&ie=utf-8&oe=utf-8&aq=t&rls=com.ubuntu:fr:official&client=firefox-a", -"http://weblog.photos.free.fr/dotclear/index.php?General", -"http://www.webrankinfo.com/forums/viewtopic_45017.htm", -"http://www.jetelecharge.com/Scripts/530.php", -"http://www.google.fr/search?hl=fr&q=telecharger logiciel gratuit pour sites pour creation de site web&btnG=Recherche Google&meta=", -"http://www.roseindia.net/software-technology-news/software-news.jsp?newsid=3503", -"http://perso.numericable.fr/~penieric/", -"http://www.google.com/search?hl=fr&q=logiciel de creation de calendrier en php&lr=", -"http://forum.pctuning.cz/viewforum.php?f=52", -"http://search.ke.voila.fr/S/voila?profil=voila&bhv=web_fr&rdata=google%20images", -"http://www.phpmyvisites.net/", -"http://www.fhs-ecommerce.nl/custom.php", -"http://www.phpmyvisites.net/forums/index.php/t/1341/0/", -"http://www.google.fr/search?hl=fr&q=free web&btnG=Rechercher&meta=lr%3Dlang_fr", -"http://www.google.fr/search?client=firefox-a&rls=org.mozilla%3Afr-FR%3Aofficial&channel=s&hl=fr&q=fput %2B socket&meta=&btnG=Recherche Google", -"http://www.php-open.com/open191424.htm", -"http://www.google.fr/custom?hl=fr&ie=ISO-8859-1&oe=ISO-8859-1&client=pub-6180957820147812&cof=FORID%3A1%3BGL%3A1%3BL%3Ahttp%3A%2F%2Fwww.amipclub.com%2Fnavlogo.png%3BLH%3A35%3BLW%3A100%3BLBGC%3A336699%3BLP%3A1%3BLC%3A%230066cc%3BVLC%3A%23663399%3BGFNT%3A%23e1771e%3BGIMP%3A%23e1771e%3BDIV%3A%23336699%3B&q=logiciel cr%E9ation site internet test&meta=", -"http://aj.garcia.free.fr/index10.htm", -"http://question.com/What/de/you/want/to/know/my/referer?", -"http://www.phpmyvisites.net/forums/index.php/t/1302/0/", -"http://www.phpmyvisites.net/", -"http://www.adresse-ip.net/adresse-ip-complet2.php", -"http://www.phpmyvisites.net/", -"http://www.phpmyvisites.net/fonctionnalites.html", -"http://controlcomp.eu/webstat/demo", -"http://www.narodnjaci-mp3.cro-windows-vista.info/-Legende-Slagera-Muzika-grada-mog-2-17-Hej-sta-je-s-vama-ljudi.MP3.php", -"http://www.narodnjaci-mp3.cro-windows-vista.info/64-Budjenje---Sve-da-hocu.mp3.php", -"http://saggerboys.com/", -"http://www.google.fr/search?hl=fr&q=demo&btnG=Recherche Google&meta=", -"http://www.google.co.ma/search?hl=en&q=creation gratuite de site", -"http://www.phpscripts-fr.net/scripts/script.php?id=2120", -"http://www.google.fr/custom?domains=phpmyvisites.net&q=WWW&sa=Recherche&sitesearch=phpmyvisites.net&client=pub-4902541541856011&forid=1&ie=ISO-8859-1&oe=ISO-8859-1&cof=GALT%3A%23008000%3BGL%3A1%3BDIV%3A%23336699%3BVLC%3A663399%3BAH%3Acenter%3BBGC%3AFFFFFF%3BLBGC%3A336699%3BALC%3A0000FF%3BLC%3A0000FF%3BT%3A000000%3BGFNT%3A0000FF%3BGIMP%3A0000FF%3BFORID%3A1%3B&hl=fr", -"http://www.google.fr/search?hl=fr&q=related:perso.orange.fr/sos.derivesectaire/ARCHIVES%25202003.htm", -"http://www.webdrole.com/histoire_drole/Sexe_&_cochon/Sexe_&_cochon01.htm", -"http://www.commentcamarche.net/forum/affich-1081477-adresse-ip-visiteur", -"http://www.google.fr/search?hl=fr&q=phpmy visites&btnG=Rechercher&meta=", -"http://7ii7.net/j/", -"http://www.google.fr/search?hl=fr&q=phpmv2 &btnG=Rechercher&meta=lr%3Dlang_fr", -"http://aj.garcia.free.fr/index1.htm", -"http://www.google.com/search?q=phpmyvisites&ie=UTF-8&oe=UTF-8", -"http://www.google.com/search?hl=fr&sa=X&oi=spell&resnum=0&ct=result&cd=1&q=http://www.phpmyvisites.net&spell=1", -"http://search.ninemsn.com.au/results.aspx?q=download chinese simplifie&geovar=3025&FORM=REDIR", -"http://www.google.fr/search?hl=fr&q=ins%C3%A9rer du java&meta=", -"http://www.revolutionsoundrecords.org/punbb/viewtopic.php?pid=13077", -"http://rnaud.net/", -"http://www.google.fr/search?client=firefox-a&rls=org.mozilla%3Afr%3Aofficial&channel=s&hl=fr&q=php my visites&meta=&btnG=Recherche Google", -"http://www.google.fr/search?hl=fr&q=php my visites&btnG=Recherche Google&meta=", -"http://www.google.fr/search?q=web statistics open source&ie=utf-8&oe=utf-8&rls=org.debian:en-US:unofficial&client=firefox-a", -"http://www.google.fr/search?hl=fr&q=phpmyvisites&btnG=Recherche Google&meta=", -"http://www.phpmyvisites.net/documentation/Accueil", -"http://www.21andy.com/blog/20050821/11.html", -"http://www.rouen.fr/breve/3684-carnavaldesenfants", -"http://www.aolrecherche.aol.fr/aol/search?enc=iso&p=lb&q=DEMO", -"http://www.phpmyvisites.net/", -"http://www.google.fr/search?q=maximum execution time&start=0&ie=utf-8&oe=utf-8&client=firefox-a&rls=org.mozilla:fr:official", -"http://www.phpmyvisites.net/phpmv2/index.php?site=1&date=2007-03-24&period=1&mod=view_source", -"http://dolycho.free.fr/zenphoto/", -"http://www.google.fr/search?hl=fr&sa=X&oi=spell&resnum=1&ct=result&cd=1&q=statistiques mots cl%C3%A9s sur Internet &spell=1", -"http://www.phpmyvisites.net/", -"http://www.mycodes.net/soft/6536.htm", -"http://www.joomlafrance.org/8/32.html", -"http://www.tophost.it/aiuto/cat2/15/63/", -"http://www.phpmyvisites.us/", -"http://groups.google.fr/group/developpeur/web/applications-php", -"http://www.ddrbordeaux.com/Site/Galerie/DDRBordeauxGL05/DDRBordeauxGL05.html", -"http://www.google.com/search?hl=fr&rls=GGLG,GGLG:2005-45,GGLG:fr&sa=X&oi=spell&resnum=0&ct=result&cd=1&q=logiciel gestion de sites gratuit&spell=1", -"http://www.raleigh-northcarolina.biz/search/Agriculture.html", -"http://www.google.com/search?hl=en&q=related:perso.orange.fr/lelogisdantan/", -"http://www.google.fr/search?q=faire un chmod&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:fr:official&client=firefox-a", -"http://www.forum-marketing.com/-t-1685-0.html", -"http://mrfou.ath.cx/palune/", -"http://www.pokerhouse.co.uk/virutal.html", -"http://www.phpmyvisites.net", -"http://www.cmsps.cz/vedeni-skoly", -"http://allez-stade-de-reims.wifeo.com/calendrier.php", -"http://www.google.fr/search?hl=fr&client=firefox-a&rls=org.mozilla%3Afr%3Aofficial&q=creation d un site web simple et gratuit&btnG=Rechercher&meta=", -"http://www.google.com/search?hl=fr&q=phpMyVisites 2.2 mise a jour&btnG=Rechercher&lr=", -"http://linearts.net/forums/index.php?showtopic=1256", -"http://www.pieces-auto-export.com/autos_occasion_autos_accidentees.php", -"http://www.google.fr/search?hl=fr&client=firefox-a&rls=org.mozilla:fr:official&hs=aG8&sa=X&oi=spell&resnum=0&ct=result&cd=1&q=compatibilit%C3%A9 php5&spell=1", -"http://www.mywaysites.info/T4_0_2/index.php?id=132", -"http://www.planetenergie.org/article.php3?id_article=486", -"http://binarylook.net/2007/03/kak-prodvigat-open-source/", -"http://patatorandco.free.fr/?page=liens", -"http://www.schnouki.net/post/2007/01/15/Plugin-phpMyVisites-pour-DotClear-2-52", -"http://besttrader.free.fr/pub/Linux_Debian_on_AMILO_Si_1520/index.html", -"http://www.prepaidlegal.com/", -"http://www.phpmyvisites.net/fonctionnalites.html", -"http://babelfish.altavista.com/babelfish/trurl_pagecontent?lp=fr_en&url=http%3A%2F%2Fwww.altersystems.fr%2FProduits-Joomla.Extensions-phpMyVisites.Tracker.html", -"http://sex-sensuality.com/", -"http://www.narodnjaci-mp3.cro-windows-vista.info/Narodni-MEGAMIX-2001-ala-Cika-DejOO.php", -"http://search.ke.voila.fr/S/orange?rtype=kw&profil=orange&bhv=web_fr&kw= &rdata=english", -"http://aj.garcia.free.fr/Livret9/PageGardeLivret9.htm", -"http://www.phpmyvisites.net/forums/index.php/t/1302/0/", -"http://www.phpmyvisites.us/documentation/Main_Page", -"http://www.phpmyvisites.net/", -"http://www.phpmyvisites.net/", -"http://www.google.fr/search?q=logiciel de creation de site en php&hl=fr", -"http://fr.search.yahoo.com/search?ei=UTF-8&p=logiciel gratuit&meta=vl%3D&ybs=0&fl=1&vl=&pstart=1&fr=slv7-&b=21", -"http://www.phpmyvisites.net/forums/index.php/t/1727/0/", -"http://www.phpmyvisites.net/?_RW_=http%3A%2F%2Fwww.ladsdate.net%2F|onclick|L0", -"http://www.rochebuffere.com/", -"http://www.google.com/search?sourceid=navclient&ie=UTF-8&rls=RNWE,RNWE:2004-53,RNWE:en&q=statistiques recherches internet", -"http://www.google.fr/search?hl=fr&q=stats sites &meta=", -"http://www.google.fr/search?hl=fr&q=phpmyvisites&btnG=Recherche Google&meta=", -"http://theglu.tuxfamily.org/index.php/post/2007/01/05/Aidez-la-recherche-avec-les-resources-inutilisees-de-votre-pc-boinc-world-community-grid-fightaids", -"http://www.phpmyvisites.net/?_RW_=http%3A%2F%2Fwww.paysage-photo.ch%2F|onclick|L7", -"http://autoimage.autoweb.cz/audi/index.htm", -"http://www.easy-script.com/script.php?c=php&sc=stat&ord=click", -"http://www.google.fr/search?hl=fr&q=configurer le temp d%27un cookie &meta=", -"http://www.google.fr/search?hl=fr&q=lettre de augmentation graduit&btnG=Recherche Google&meta=", -"http://etablissements.ac-amiens.fr/0601188r/ecrire/?exec=admin_plugin", -"http://www.phpscripts-fr.net/scripts/derniers.php", -"http://universsimpson.free.fr/itchyscratchy.php", -"http://www.phpbank.net/description.php?id=1270", -"http://www.forzamotorsport2.fr/recherche/google-demo.html", -"http://www.apprendre-en-ligne.net/blog/index.php", -"http://www.google.fr/search?q=comparaison google analytics et xiti&sourceid=navclient-ff&ie=UTF-8&rlz=1B3GGGL_frFR210FR210", -"http://www.google.fr/search?hl=fr&q=demo&btnG=Recherche Google&meta=", -"http://www.skunk.powa.fr/shadow/login.php", -"http://www.phpscripts-fr.net/scripts/scripts.php?cat=Statistiques&deb=10&tri=NOM&sens=ASC", -"http://216.239.59.104/search?q=cache:-TzFlx2Y6p8J:www.scienceetviejunior.fr/svj.php%3FrubriqueSvj%3Dindex-gratuit-article%255Camp%3Bid_article%3D1206 science et vie junior&hl=fr&strip=1", -"http://www.google.fr/search?sourceid=navclient-ff&ie=UTF-8&rls=GGGL,GGGL:2006-39,GGGL:fr&q=phpmyvisites", -"http://www.phpmyvisites.net/", -"http://www.phpmyvisites.net/", -"http://www.duplication-video.com/supports-video.html", -"http://www.google.fr/search?sourceid=navclient&aq=t&hl=fr&ie=UTF-8&rlz=1T4GFRG_frMA215MA215&q=t%c3%a9l%c3%a9charger logiciel nintendo ds", -"http://www.google.fr/search?sourceid=navclient&aq=t&hl=fr&ie=UTF-8&rls=GGLG,GGLG:2005-39,GGLG:fr&q=phpmyvisits", -"http://www.idbleues.com/catalogue-materiel.php", -"http://dadoun.net/", -"http://rcma.free.fr/escort/2004.htm", -"http://www.google.ca/search?hl=fr&q=stats site web&btnG=Rechercher&meta=", -"http://www.google.fr/search?hl=fr&rlz=1T4ADBR_frFR212FR212&sa=X&oi=spell&resnum=0&ct=result&cd=1&q=phpmyvisites&spell=1", -"http://cmkh.net/?q=user/1", -"http://www.souvenirducameroun.com/productssimple.html", -"http://www.epochtimes.com.ua/", -"http://www.google.fr/search?hl=fr&rlz=1T4GFRB_frFR206FR207&sa=X&oi=spell&resnum=0&ct=result&cd=1&q=wiki licence application web&spell=1", -"http://www.pasdagence.com/", -"http://www.google.fr/search?hl=fr&q=The server encountered an internal error or misconfiguration and was unable to complete your request.&btnG=Recherche Google&meta=", -"http://www.gea-erge.fr/", -"http://www.google.fr/search?hl=fr&q=phpmyvisites&meta=", -"http://szex.szextra.hu/index.php", -"http://www.google.fr/search?q=mesure audience site&hl=fr&rls=GGLG,GGLG:2006-10,GGLG:fr&start=10&sa=N", -"http://akatsuki.kurai.free.fr/site.php", -"http://tw.search.yahoo.com/search?fr=fp-tab-web-t&ei=UTF-8&p=phpMyVisites", -"http://www.google.com/search?client=safari&rls=en&q=phpmyvisites&ie=UTF-8&oe=UTF-8", -"http://www.phpmyvisites.net/telechargements.html", -"http://www.google.fr/search?hl=fr&rls=GGIC,GGIC:1970--2,GGIC:fr&q=related:www.free.fr/", -"http://www.google.fr/search?hl=fr&q=related:perso.orange.fr/resistances/lactonlesap/index.htm", -"http://diskuse.jakpsatweb.cz/index.php?action=vthread&forum=13&topic=24403", -"http://universsimpson.free.fr/ullmanspage.php", -"http://www.google.fr/search?hl=fr&q=demande emploi mise %C3%A0 jour site internet&btnG=Rechercher&meta=lr%3Dlang_fr", -"http://www.juggletube.com/", -"http://www.google.com/search?hl=fr&client=safari&rls=fr&q=statistique internet gratuit&btnG=Rechercher&lr=", -"http://www.google.com/search?q=www.free.fr coppermine &rls=com.microsoft:fr:IE-SearchBox&ie=UTF-8&oe=UTF-8&sourceid=ie7&rlz=1I7SKPB", -"http://www.phpmyvisites.net/telechargements.html", -"http://www.agilav.fr/DepartementReconditionnement.html", -"http://www.phpmyvisites.us/", -"http://www.google.com/search?hl=fr&q=statistiques site&lr=lang_fr", -"http://www.librairie-portugaise.com/", -"http://www.raleigh-northcarolina.biz/search/Slippage.html", -"http://blog-perso.onzeweb.info/2006/05/06/wordpress-phpmyvisites-10/", -"http://starclubbing.com/", -"http://www.gastonspectacles.com/?gclid=COve_eGmkIsCFQIvlAodV2mvSQ", -"http://www.phpmyvisites.net/forums/index.php/t/2677/0/", -"http://www.google.com/search?client=safari&rls=fr&q=phpmyvisites&ie=UTF-8&oe=UTF-8", -"http://search.ke.voila.fr/S/orange?rtype=kw&profil=smart&bhv=web_fr&rdata=GOOGLE&logid=2354200001174838174938809&keap=28&prevnbans=10&ap=4", -"http://universsimpson.free.fr/ullmanspage.php", -"http://iut-rcc.univ-reims.fr/accueil.php?menu=5&lang=fr", -"http://www.industriespionage.net/main/?page_id=4", -"http://www.ethicall-telecom.fr/ect_webcount/", -"http://www.google.co.ma/search?hl=fr&q=creer un sites web gratuit&meta=", -"http://www.phpmyvisites.net/forums/index.php?t=rview&goto=13676", -"http://www.google.com/search?client=opera&rls=en&q=phpmyvisites&sourceid=opera&ie=utf-8&oe=utf-8", -"http://127.0.0.1/www.info-distrib.fr/?sct=liste&url=carte_mere.htm", -"http://www.google.ch/search?hl=fr&client=firefox-a&rls=org.mozilla%3Afr%3Aofficial&hs=6Y&q=statistiques web&btnG=Rechercher&meta=", -"http://www.google.fr/search?sourceid=navclient&aq=t&hl=fr&ie=UTF-8&rls=GFRD,GFRD:2007-09,GFRD:fr&q=phpmyvisits", -"http://www.nuitpourpre.net/leblog/index.php/?q=", -"http://www.sex974.com/goodies.php", -"http://beet.ddl.free.fr/index.php?id=05", -"http://sex974.com/abonnement.php", -"http://www.revolunet.com/sites.utiles.asp?Toutes-Statistiques%20PHP/MySQL", -"http://www.phpmyvisites.net/", -"http://www.opensourcescripts.com/dir/PHP/Web_Traffic_Analysis/297.html", -"http://www.google.com/search?sourceid=gmail&q=phpmyvisites", -"http://www.google.es/search?hl=es&q=download simsun.ttc&btnG=B%C3%BAsqueda&meta=", -"http://www.raleigh-northcarolina.biz/search/May.html", -"http://cm5.free.fr/index.htm", -"http://www.google.fr/search?hl=fr&client=firefox-a&rls=org.mozilla%3Afr%3Aofficial&hs=ps&q=php my stat&btnG=Rechercher&meta=", -"http://www.gsm-wifi.net/index.php?option=com_frontpage&Itemid=1", -"http://search.msn.fr/results.aspx?q=logiciel gratuit&FORM=MSN6B&lang=fr-fr&cp=1252", -"http://www.google.fr/search?hl=fr&client=firefox-a&rls=org.mozilla%3Afr%3Aofficial&hs=fJq&q=stats phpmyvisite&btnG=Rechercher&meta=", -"http://www.google.com/search?client=safari&rls=fr-fr&q=php statistics&ie=UTF-8&oe=UTF-8", -"http://www.google.com/search?hl=fr&q=d%C3%A9mo&btnG=Recherche Google&lr=", -"http://ebw2.be/Saint-Joseph_Tubize/STJoseph.html", -"http://www.phpmyvisites.net/phpmv2/", -"http://www.google.fr/search?hl=fr&client=firefox-a&rls=org.mozilla%3Afr%3Aofficial&hs=aNq&q=php typer les m%C3%A9thodes int string&btnG=Rechercher&meta=", -"http://www.google.com/search?client=opera&rls=en&q=phpmyvisites&sourceid=opera&ie=utf-8&oe=utf-8", -"http://www.phpmyvisites.net/telechargements.html", -"http://www.castelpourpre.com/maison.html", -"http://www.castelpourpre.com/maison.html", -"http://www.google.fr/search?client=firefox-a&rls=org.mozilla%3Afr%3Aofficial&channel=s&hl=fr&q=phpmv2&meta=&btnG=Recherche Google", -"http://www.google.fr/search?q=SCRIPT STATISTIQUE&hl=fr&pwst=1&start=10&sa=N", -"http://www.antennereunion.fr/rubrique.php3?id_rubrique=41&debut_page=432", -"http://www.phpmyvisites.net/", -"http://www.0-8.biz/", -"http://www.kess.snug.pl/", -"http://www.google.ch/search?q=statistiques gratuites site web&start=0&ie=utf-8&oe=utf-8&client=firefox-a&rls=org.mozilla:fr:official", -"http://www.google.fr/search?hl=fr&q=tout les site gratuit logiciel&btnG=Recherche Google&meta=", -"http://www.phpmyvisites.us/", -"http://www.google.fr/search?client=firefox-a&rls=org.mozilla%3Afr%3Aofficial&channel=s&hl=fr&q=phpmyvisites&meta=&btnG=Recherche Google", -"http://www.animal-virtuel.com/stats/phpmyvisites.php", -"http://www.fruits-basket-temple.com/index.php?section=anime", -"http://www.google.fr/search?hl=fr&q=phpmyvisites&meta=", -"http://www.google.fr/search?hl=fr&q=phpmyvisites&btnG=Recherche Google&meta=", -"http://www.pilarcanalda.com/inici/index.php", -"http://www.phpmyvisites.net/telechargements.html", -"http://www.google.com/search?hl=fr&q=phpmyvisites&btnG=Recherche Google&lr=", -"http://www.phpmyvisites.us/", -"http://www.phpmyvisites.net/", -"http://www.phpmyvisites.net/", -"http://www.google.com/search?hl=fr&q=PhpMyVisit&btnG=Rechercher&lr=lang_fr", -"http://info-afrique.be/", -"http://www.jazzentete.com/", -"http://www.phpmyvisites.net/?_RW_=http%3A%2F%2Fwww.annuaire-telephone-portable.com%2Fsat%2Fdetection.php|onclick|L0", -"http://www.phpmyvisites.net/forums/index.php/t/2613/0/", -"http://www.google.fr/search?hl=fr&q=logiciel gratuit open source&meta=", -"http://www.phpmyvisites.us/", -"http://spiritangeldesign.free.fr/index.php?p=credit", -"http://generation1.free.fr/rubriques.htm", -"http://www.google.fr/search?hl=fr&q=outil informatique et statistique&btnG=Recherche Google&meta=", -"http://www.commentcamarche.net/forum/affich-2802486-hebergement-et-statistiques-de-visites", -"http://www.google.be/search?q=phpmyvisites&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:fr:official&client=firefox-a", -"http://www.google.fr/search?client=firefox-a&rls=org.mozilla%3Afr%3Aofficial&channel=s&hl=fr&q=phpmyvisites&meta=&btnG=Recherche Google", -"http://www.phpmyvisites.net/forums/index.php/t/1497/0/", -"http://www.nili.be/", -"http://www.google.com/search?hl=fr&client=safari&rls=fr&q=statistiques php&btnG=Rechercher&lr=", -"http://www.parisrandovelo.com/forum/viewtopic.php?t=605&start=15", -"http://www.google.fr/search?hl=fr&q=demo&btnG=Recherche Google&meta=cr%3DcountryFR", -"http://natation.privas.dyndns.org/modules/intro_cnp/", -"http://www.phpmyvisites.net/", -"http://www.digigasin.ch/product_info.php?products_id=2214&osCsid=70959f3746c784495a5032cbb79dbc3d", -"http://msdgmedia.free.fr/Multimedia/DessinerPlume/index.htm", -"http://msdgmedia.free.fr/Multimedia/DessinerPlume/index.htm", -"http://fr.ask.com/web?q=gratuit&l=dir&o=1124", -"http://www.google.fr/search?hl=fr&client=firefox-a&channel=s&rls=org.mozilla%3Afr%3Aofficial&hs=r2q&q=fichier contenant les sites visit%C3%A9s&btnG=Rechercher&meta=", -"http://www.lorajos.nl/", -"http://www.rugby13montpellier.com/shop.php", -"http://www.beautediscount.com/", -"http://www.google.fr/search?hl=fr&client=firefox-a&channel=s&rls=org.mozilla%3Afr%3Aofficial&q=php site web&btnG=Rechercher&meta=", -"http://www.forum-newbeetle.fr/", -"http://france.catsfamily.net/main/coupsdecoeur.html", -"http://www.google.fr/search?hl=fr&q=phpmyvisites&btnG=Recherche Google&meta=", -"http://www.phpscripts-fr.net/scripts/derniers.php", -"http://generation1.free.fr", -"http://www.google.fr/search?hl=fr&client=firefox-a&rls=org.mozilla%3Afr%3Aofficial&hs=kwB&q=free statistiques&btnG=Rechercher&meta=cr%3DcountryFR", -"http://www.google.fr/search?hl=fr&q=tout les site gratuit logiciel&btnG=Recherche Google&meta=", -"http://forum.tvsport.ro//index.php?s=d2589da3f1f7173e22d695934e8fe0f4&act=Forward&f=92&t=2053", -"http://www.google.fr/search?hl=fr&q=creation site libre OR open source&btnG=Rechercher&meta=", -"http://www.phpmyvisites.net/forums/index.php/t/1302/0/", -"http://www.google.fr/search?q=unable open&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:fr:official&client=firefox-a", -"http://www.google.fr/search?hl=fr&q=statistiques sites&meta=", -"http://www.phpmyvisites.us/requirements.html", -"http://www.phpmyvisites.us/", -"http://www.satellitemania.it/", -"http://www.google.com.tr/search?hl=tr&q=phpmyvisites&meta=", -"http://www.phpmyvisites.us/", -"http://www.google.fr/search?client=firefox-a&rls=org.mozilla%3Afr%3Aofficial&channel=s&hl=fr&q=d%C3%A9mo &meta=&btnG=Recherche Google", -"http://www.google.fr/search?sourceid=navclient&hl=fr&ie=UTF-8&rlz=1T4GGIC_frFR215&q=demo", -"http://www.amnestyinternational.be/shopping/page_101.php", -"http://www.google.fr/search?hl=fr&q=phpmv2&meta=", -"http://www.google.fr/custom?hl=fr&ie=ISO-8859-1&oe=ISO-8859-1&client=pub-4902541541856011&cof=FORID%3A1%3BGL%3A1%3BLBGC%3A336699%3BLC%3A%230000ff%3BVLC%3A%23663399%3BGFNT%3A%230000ff%3BGIMP%3A%230000ff%3BDIV%3A%23336699%3B&domains=phpmyvisites.net&q=installation&btnG=Rechercher&sitesearch=phpmyvisites.net&meta=", -"http://www.phpmyvisites.net/", -"http://www.google.co.ma/search?hl=fr&q=related:search1-1.free.fr/", -"http://www.google.co.ma/search?hl=fr&q=related:search1-1.free.fr/", -"http://www.szextra.hu/hir/?id=201&r=5", -"http://www.google.fr/search?hl=fr&ned=&q=type de serveur utilis%C3%A9 par free&btnmeta%3Dsearch%3Dsearch=Rechercher sur le Web", -"http://www.canner-evasion.com/", -"http://universsimpson.free.fr/itchyscratchy.php", -"http://googeli.dynalias.com/", -"http://aj.garcia.free.fr/index10.htm", -"http://www.google.fr/search?sourceid=navclient&hl=fr&ie=UTF-8&rls=GGIH,GGIH:2006-51,GGIH:fr&q=d%c3%a9mo", -"http://www.le-phoenix.fr/", -"http://www.bmcharmilles.fr/fenetres.php?menu=3", -"http://www.nass-collection.com/visite/index.php?site=1&date=2007-03-24&period=1&mod=view_referers", -"http://www.neutrinium238.com/tutoriaux/photoshop/index.php?id=3", -"http://www.phpmyvisites.net/", -"http://www.annees-laser.com/Page/Boutique/Boutique.aspx", -"http://www.wifeo.com/membre-actualite.php?article=32-phpmyvisites--statistiques-gratuite", -"http://www.magalieforever.com/videos/clips.html", -"http://192.168.1.1/~bureau3/Musica/Musiques.php", -"http://www.phpmyvisites.us/", -"http://www.antigone-net.net/index.php?option=com_content&task=section&id=5&Itemid=79", -"http://www.gonthier-be.com/qui.htm", -"http://www.deosjuggling.fr/", -"http://www.google.fr/search?hl=fr&q=communaute de pratique open source&btnG=Rechercher&meta=", -"http://www.google.com/search?client=safari&rls=fr&q=phpmyvisites&ie=UTF-8&oe=UTF-8", -"http://www.sex974.com/freetour.php?q=solo", -"http://blog-perso.onzeweb.info/developpement/wp-phpmyvisites", -"http://www.google.fr/search?hl=fr&q=related:perso.orange.fr/laurent.cleon/", -"http://www.google.be/search?q=les sites web les plus visit%C3%A9s&hl=fr&rls=SKPB,SKPB:2006-40,SKPB:fr&start=20&sa=N", -"http://tourdumonde.cochisette.com/index2.php", -"http://www.lespaladins.com/fr_accueil.php", -"http://diskuse.jakpsatweb.cz/index.php?action=vthread&forum=13&topic=24403", -"http://www.google.fr/search?hl=fr&q=getthunderbird.com&btnG=Rechercher&meta=cr%3DcountryFR", -"http://www.google.com/search?sourceid=navclient&ie=UTF-8&rls=RNWE,RNWE:2004-16,RNWE:en&q=phpmyvisites", -"http://www.google.fr/search?hl=fr&q=php statistiques&btnG=Recherche Google&meta=", -"http://www.phpmyvisites.net/forums/index.php/m/15653/0/?srch=mot de passe", -"http://www.phpmyvisites.us/", -"http://www.tendanceouest.com/radiolive.htm", -"http://www.puget-passion.fr/Champignon/lamorille.htm", -"http://www.google.com/search?client=safari&rls=fr-fr&q=phpmyvisites&ie=UTF-8&oe=UTF-8", -"http://smmobadix.free.fr/index.php?", -"http://aide-a-la-navigation.orange.fr/process?key=0019f5a5de969bfa7df5c354e6fa71e7cac", -"http://www.swalif.net/softs/showthread.php?t=146114", -"http://fr.search.yahoo.com/search?ei=UTF-8&p=google&meta=vl%3D&ybs=0&fl=1&vl=&pstart=1&fr=logout&b=61", -"http://www.google.fr/search?hl=fr&client=firefox-a&rls=org.mozilla%3Afr%3Aofficial&hs=9GD&q=phpmyvisites&btnG=Rechercher&meta=", -"http://www.google.fr/search?hl=fr&client=firefox-a&channel=s&rls=org.mozilla%3Afr%3Aofficial&hs=nds&q=Unable to open &btnG=Rechercher&meta=", -"http://search.live.com/results.aspx?q=logiciel gratuit&mkt=fr-fr&FORM=LIVSOP&go.x=0&go.y=6", -"http://www.furia-metal.com/", -"http://www.posicionanet.com/garantias.html", -"http://sos.primavista.net/Mail-Senden.93.0.html", -"http://www.poeta.cz/", -"http://diskuse.jakpsatweb.cz/index.php?action=vthread&forum=13&topic=24403", -"http://localhost/", -"http://www.google.fr/search?q=phpmyvisits&sourceid=navclient-ff&ie=UTF-8&rlz=1B2GGGL_frFR207FR207", -"http://www.google.com/search?q=php nuke tracker&rls=com.microsoft:fr-ca&ie=UTF-8&oe=UTF-8&startIndex=&startPage=1", -"http://www.stumbleupon.com/refer.php?url=http%3A%2F%2Fwww.phpmyvisites.net%2F", -"http://www.lenautilus.net/nautilusgb/galerie.html", -"http://www.google.fr/search?hl=fr&q=logiciel visite site internet&meta=lr%3Dlang_fr", -"http://universsimpson.free.fr/ullmanspage.php", -"http://www.google.fr/search?hl=fr&rlz=1T4GFRG_frFR212FR212&sa=X&oi=spell&resnum=0&ct=result&cd=1&q=h%C3%A9bergement sur free&spell=1", -"http://www.google.com/search?hl=en&safe=off&client=firefox-a&rls=org.mozilla:en-US:official&hs=SOY&sa=X&oi=spell&resnum=0&ct=result&cd=1&q=phpmyvisites&spell=1", -"http://lesemouvus.jeun.fr/index.htm?sid=ea0882e54624b43fa556e463c5ad299f", -"http://www.google.fr/search?sourceid=navclient&ie=UTF-8&rlz=1T4GGLJ_enBE215BE215&q=DEMO", -"http://82.225.141.143/", -"http://www.google.fr/search?hl=fr&q=DEMO&meta=", -"http://www.phpmyvisites.net/telechargements.html", -"http://www.phpmyvisites.net/forums/index.php/f/15/0/", -"http://www.scat-hell.com/", -"http://flouz.info/", -"http://krimhlab.free.fr/index.php?main=gallerie&menu_h=menuhga", -"http://www.lordphoenix.info/logiciels/", -"http://www.phpmyvisites.net/?_RW_=http%3A%2F%2Fwww.saxy.fr%2F|onclick|L11", -"http://www.commecadujapon.com/php/photo.php?photofile=20060110.1300.1.jpg&titre=Shinseijin - nouvelle adulte", -"http://www.jeffroy.eu/index2.php", -"http://forum.spip.org/fr_174961.html?var_recherche=statistiques", -"http://127.0.0.1/", -"http://www.google.de/search?q=phpmyvisites&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:de:official&client=firefox-a", -"http://www.phpmyvisites.us/", -"http://www.google.fr/search?q=cr%C3%A9er facilement un site web en php&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:fr:official&client=firefox-a", -"http://www.phpmyvisites.net/?_RW_=http%3A%2F%2Fwww.diskutime.com%2Fdisk%2Fkerkopostime.php%3Fanetari%3DBlici%23bottom|onclick|L128", -"http://www.phpmyvisites.net/documentation/index.php?title=Configuration&oldid=1550", -"http://www.google.fr/custom?domains=http%3A%2F%2Fwww.autourdecheznous.info&q=ring bourguesan ffb&sa=Recherche Google&sitesearch=&client=pub-6772093135347263&forid=1&ie=ISO-8859-1&oe=ISO-8859-1&cof=GALT%3A%23008000%3BGL%3A1%3BDIV%3A%23E6E6E6%3BVLC%3A663399%3BAH%3Acenter%3BBGC%3AFFFFFF%3BLBGC%3A336699%3BALC%3A0000FF%3BLC%3A0000FF%3BT%3A000000%3BGFNT%3A0000FF%3BGIMP%3A0000FF%3BFORID%3A11&hl=fr&ad=w9&num=10", -"http://www.commentcamarche.net/forum/affich-2802486-hebergement-et-statistiques-de-visites", -"http://www.archives.rennes.fr/fonds/affichedetailfig.php?cot=100Fi378", -"http://www.pechemouchecorse.com/phpBB2-fr/search.php", -"http://www.autooptions.fr/catalogue_viewprod_1360_0_9_0_0.html", -"http://www.nalao.com/", -"http://www.mandrivalinux-online.eu/phpmv2/index.php?site=1&date=2007-03-25&period=1&mod=view_referers", -"http://www.google.be/search?hl=fr&q=statistiques web phpmyvisites&btnG=Rechercher&meta=", -"http://fr.search.yahoo.com/search?p=t%C3%A9l%C3%A9charger cv gratuit&rs=1&fr2=rs-top&ei=UTF-8&meta=vl%3D&ybs=0&fl=1&vl=&fr=yfp-t-501", -"http://www.arlon-is-on.be/", -"http://www.google.fr/search?hl=fr&q=t%C3%A9l%C3%A9charger gratuit de logiciel de cr%C3%A9ation de site internet en php&meta=", -"http://www.malta.poznan.pl/", -"http://www.google.fr/search?hl=fr&q=phpmyvisits", -"http://www.phpmyvisites.us/", -"http://www.phpmyvisites.us/", -"http://www.mfhg.org/showmedia.php?mediaID=82", -"http://www.google.fr/search?q=phpmyvisites&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:fr:official&client=firefox-a", -"http://www.animule.net/php/commentaires.php?id=90", -"http://www.google.fr/search?q=Fatal error%3A Call to undefined function%3A&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:fr:official&client=firefox-a", -"http://www.google.fr/custom?hl=fr&ie=ISO-8859-1&oe=ISO-8859-1&client=pub-4902541541856011&cof=FORID%3A1%3BGL%3A1%3BLBGC%3A336699%3BLC%3A%230000ff%3BVLC%3A%23663399%3BGFNT%3A%230000ff%3BGIMP%3A%230000ff%3BDIV%3A%23336699%3B&domains=phpmyvisites.net&q=traduction&btnG=Rechercher&sitesearch=phpmyvisites.net&meta=lr%3Dlang_fr", -"http://www.webrankinfo.com/outils/echanges-de-liens.php?rub=res", -"http://www.google.fr/search?q=web analyse php&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:fr:official&client=firefox-a", -"http://www.donuts-models.com/pages/elite_pro.html", -"http://www.google.fr/search?hl=fr&q=fichier traduction php&meta=", -"http://www.google.ch/search?hl=fr&q=website statistique open source&btnG=Recherche Google&meta=", -"http://www.saxy.fr/", -"http://search.ke.voila.fr/S/orange?sev=&rtype=kw&profil=deskbar_ora_h&bhv=web_fr&rdata=teste", -"http://www.rendy.eu/odkazy/", -"http://homeomath.imingo.net/annales_bacsti.htm", -"http://www.google.fr/search?hl=fr&client=firefox-a&rls=org.mozilla%3Afr%3Aofficial&hs=F7Z&q=imagecreatefrompng gd&btnG=Rechercher&meta=", -"http://www.google.fr/search?client=firefox-a&rls=org.mozilla%3Afr%3Aofficial&channel=s&hl=fr&q=phpmyvisites&meta=&btnG=Recherche Google", -"http://www.jeremysumpter.info/view.php?lang=e&flag=5&page=pp-cp&num=1", -"http://events.idi.ntnu.no/mrc2007/organisation.php", -"http://www.google.fr/search?q=modifier droit utilisateur mysql&hl=fr&start=20&sa=N", -"http://streaming.bpi.fr/bpi-visites/catalogue/phpmyvisites.php", -"http://www.forum-newbeetle.fr/recent.php", -"http://www.captainnelson.com/archives/89", -"http://insousciance.expose.free.fr/decidela/index.php", -"http://www.google.fr/search?hl=fr&q=phpmyvisites&meta=", -"http://www.google.fr/search?hl=fr&q=guide de communaute arabe open source &btnG=Recherche Google&meta=", -"http://donbass.free.fr/radio/profile.php?id=210", -"http://www.psn3.com/Cerisier,Evans/fiche.html", -"http://aide-a-la-navigation.orange.fr/process?key=002e98505757dcabd69a8a215dfe57cf9c6", -"http://search.ke.voila.fr/S/orange?rtype=kw&profil=smart&bhv=web_fr&kw= &rdata=t%E9l%E9chargements", -"http://www.epochtimes.ru/", -"http://www.poterie-bois.com/petits animaux/chats", -"http://forum.hardware.fr/hfr/WindowsSoftware/ajout-compteur-site-sujet_172698_1.htm", -"http://www.gougueule.com/Spongestats", - ); diff --git a/plugins/VisitorGenerator/data/UserAgent.php b/plugins/VisitorGenerator/data/UserAgent.php deleted file mode 100644 index b5f019a482..0000000000 --- a/plugins/VisitorGenerator/data/UserAgent.php +++ /dev/null @@ -1,69 +0,0 @@ -<?php -/** - * Piwik - Open source web analytics - * - * @link http://piwik.org - * @license http://www.gnu.org/licenses/gpl-3.0.html Gpl v3 or later - * @version $Id$ - * - * @category Piwik_Plugin - * @package Piwik_VisitorGenerator - */ - -/** - * User-Agent: strings - * - * @package Piwik_VisitorGenerator - */ -$userAgent = array( -"Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)", -"Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 5.0 )", -"Mozilla/4.0 (compatible; MSIE 5.5; Windows 98; Win 9x 4.90)", -"Mozilla/4.8 [en] (Windows NT 5.1; U)", -"Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; en) Opera 8.0", -"Opera/7.51 (Windows NT 5.1; U) [en]", -"Opera/7.50 (Windows XP; U)", -"Avant Browser/1.2.789rel1 (http://www.avantbrowser.com)", -"Mozilla/5.0 (Windows; U; Win98; en-US; rv:1.4) Gecko Netscape/7.1 (ax)", -"Mozilla/5.0 (Windows; U; Windows XP) Gecko MultiZilla/1.6.1.0a", -"Opera/7.50 (Windows ME; U) [en]", -"Mozilla/3.01Gold (Win95; I)", -"Mozilla/2.02E (Win95; U)", -"Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)", -"Googlebot/2.1 (+http://www.googlebot.com/bot.html)", -"msnbot/1.0 (+http://search.msn.com/msnbot.htm)", -"msnbot/0.11 (+http://search.msn.com/msnbot.htm)", -"Mozilla/5.0 (compatible; Yahoo! Slurp; http://help.yahoo.com/help/us/ysearch/slurp)", -"Mozilla/2.0 (compatible; Ask Jeeves/Teoma)", -"Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en) AppleWebKit/125.2 (KHTML, like Gecko) Safari/125.8", -"Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en) AppleWebKit/125.2 (KHTML, like Gecko) Safari/85.8", -"Mozilla/4.0 (compatible; MSIE 5.15; Mac_PowerPC)", -"Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.7a) Gecko/20040614 Firefox/0.9.0+", -"Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en-US) AppleWebKit/125.4 (KHTML, like Gecko, Safari) OmniWeb/v563.15", -"Mozilla/5.0 (X11; U; Linux; i686; en-US; rv:1.6) Gecko Debian/1.6-7", -"ozilla/5.0 (X11; U; Linux; i686; en-US; rv:1.6) Gecko Epiphany/1.2.5", -"Mozilla/5.0 (X11; U; Linux i586; en-US; rv:1.7.3) Gecko/20040924 Epiphany/1.4.4 (Ubuntu)", -"Mozilla/5.0 (X11; U; Linux; i686; en-US; rv:1.6) Gecko Galeon/1.3.14", -"Konqueror/3.0-rc4; (Konqueror/3.0-rc4; i686 Linux;;datecode)", -"Mozilla/5.0 (compatible; Konqueror/3.3; Linux 2.6.8-gentoo-r3; X11;", -"Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.6) Gecko/20040614 Firefox/0.8", -"ELinks/0.9.3 (textmode; Linux 2.6.9-kanotix-8 i686; 127x41)", -"ELinks (0.4pre5; Linux 2.6.10-ac7 i686; 80x33)", -"Links (2.1pre15; Linux 2.4.26 i686; 158x61)", -"Links/0.9.1 (Linux 2.4.24; i386;)", -"MSIE (MSIE 6.0; X11; Linux; i686) Opera 7.23", -"Lynx/2.8.5rel.1 libwww-FM/2.14 SSL-MM/1.4.1 GNUTLS/0.8.12", -"w3m/0.5.1", -"Links (2.1pre15; FreeBSD 5.3-RELEASE i386; 196x84)", -"Mozilla/5.0 (X11; U; FreeBSD; i386; en-US; rv:1.7) Gecko", -"Mozilla/4.77 [en] (X11; I; IRIX;64 6.5 IP30)", -"Mozilla/4.8 [en] (X11; U; SunOS; 5.7 sun4u)", -"Mozilla/3.0 (compatible; NetPositive/2.1.1; BeOS)", -"Gulper Web Bot 0.2.4 (www.ecsl.cs.sunysb.edu/~maxim/cgi-bin/Link/GulperBot)", -"EmailWolf 1.00", -"grub-client-1.5.3; (grub-client-1.5.3; Crawl your own stuff with http://grub.org)", -"Download Demon/3.5.0.11", -"OmniWeb/2.7-beta-3 OWF/1.0", -"SearchExpress", -"Microsoft URL Control - 6.00.8862", -); diff --git a/plugins/VisitorGenerator/templates/generate.tpl b/plugins/VisitorGenerator/templates/generate.tpl deleted file mode 100644 index a4063f25b9..0000000000 --- a/plugins/VisitorGenerator/templates/generate.tpl +++ /dev/null @@ -1,30 +0,0 @@ -{assign var=showSitesSelection value=false} -{assign var=showPeriodSelection value=false} -{include file="CoreAdminHome/templates/header.tpl"} - -<h2>{'VisitorGenerator_VisitorGenerator'|translate}</h2> - -<table class="adminTable adminTableNoBorder" style="width: 600px;"> -<thead> - <tr> - <th>{'VisitorGenerator_Visitors'|translate}</th> - <th>{'VisitorGenerator_ActionsPerVisit'|translate}</th> - <th>{'VisitorGenerator_Date'|translate}</th> - </tr> -</thead> -<tbody> -{foreach from=$dates item=date} - <tr> - <td>{$date.visitors}</td> - <td>{$date.actionsPerVisit}</td> - <td>{$date.startTime|date_format:"%Y-%m-%d"}</td> - </tr> -{/foreach} -</tbody> -</table> - -<p>{'VisitorGenerator_NbActions'|translate}: {$nbActionsTotal}<br /> -{'VisitorGenerator_NbRequestsPerSec'|translate}: {$nbRequestsPerSec}<br /> -{$timer}</p> - -{include file="CoreAdminHome/templates/footer.tpl"}
\ No newline at end of file diff --git a/plugins/VisitorGenerator/templates/index.tpl b/plugins/VisitorGenerator/templates/index.tpl deleted file mode 100644 index f54349b472..0000000000 --- a/plugins/VisitorGenerator/templates/index.tpl +++ /dev/null @@ -1,45 +0,0 @@ -{assign var=showSitesSelection value=false} -{assign var=showPeriodSelection value=false} -{include file="CoreAdminHome/templates/header.tpl"} - -<h2>{'VisitorGenerator_VisitorGenerator'|translate}</h2> -<p>{'VisitorGenerator_PluginDescription'|translate}</p> - -<form method="POST" action="{url module=VisitorGenerator action=generate}"> -<table class="adminTable adminTableNoBorder" style="width: 600px;"> -<tr> - <td><label for="idSite">{'VisitorGenerator_SelectWebsite'|translate}</label></td> - <td><select name="idSite"> - {foreach from=$sitesList item=site} - <option value="{$site.idsite}">{$site.name}</option> - {/foreach} - </select></td> -</tr> -<tr> - <td><label for="minVisitors">{'VisitorGenerator_MinVisitors'|translate}</label></td> - <td><input type="text" value="20" name="minVisitors" /></td> -</tr> -<tr> - <td><label for="maxVisitors">{'VisitorGenerator_MaxVisitors'|translate}</label></td> - <td><input type="text" value="100" name="maxVisitors" /></td> -</tr> -<tr> - <td><label for="nbActions">{'VisitorGenerator_NbActions'|translate}</label></td> - <td><input type="text" value="10" name="nbActions" /></td> -</tr> -<tr> - <td><label for="daysToCompute">{'VisitorGenerator_DaysToCompute'|translate}</label></td> - <td><input type="text" value="1" name="daysToCompute" /></td> -</tr> -</table> -<p>{'VisitorGenerator_Warning'|translate}<br /> -{'VisitorGenerator_NotReversible'|translate:'<b>':'</b>'}<br /><br /> -{'VisitorGenerator_AreYouSure'|translate}<br /> -</p> -<input type="checkbox" name="choice" id="choice" value="yes" /> <label for="choice">{'VisitorGenerator_ChoiceYes'|translate}</label> -<br /> -<input type="hidden" value="{$token_auth}" name="token_auth" /> -<input type="submit" value="{'VisitorGenerator_Submit'|translate}" name="submit" class="submit" /> -</form> - -{include file="CoreAdminHome/templates/footer.tpl"}
\ No newline at end of file diff --git a/plugins/VisitorInterest/VisitorInterest.php b/plugins/VisitorInterest/VisitorInterest.php index ee4fdbd3f2..2379972407 100644 --- a/plugins/VisitorInterest/VisitorInterest.php +++ b/plugins/VisitorInterest/VisitorInterest.php @@ -19,10 +19,11 @@ class Piwik_VisitorInterest extends Piwik_Plugin public function getInformation() { $info = array( - 'description' => Piwik_Translate('VisitorInterest_PluginDescription'), + 'name' => 'Visitors Interest', + 'description' => 'Reports about the Visitor Interest: number of pages viewed, time spent on the Website.', 'author' => 'Piwik', - 'author_homepage' => 'http://piwik.org/', - 'version' => Piwik_Version::VERSION, + 'homepage' => 'http://piwik.org/', + 'version' => '0.1', ); return $info; @@ -73,7 +74,7 @@ class Piwik_VisitorInterest extends Piwik_Plugin function addMenu() { Piwik_RenameMenuEntry('General_Visitors', 'VisitFrequency_SubmenuFrequency', - 'General_Visitors', 'VisitorInterest_Engagement' ); + 'General_Visitors', 'VisitorInterest_SubmenuFrequencyLoyalty' ); } function postLoad() @@ -158,13 +159,13 @@ class Piwik_VisitorInterest extends Piwik_Plugin return $table; } - static public function headerVisitsFrequency($notification) + public function headerVisitsFrequency($notification) { $out =& $notification->getNotificationObject(); $out = '<div id="leftcolumn">'; } - static public function footerVisitsFrequency($notification) + public function footerVisitsFrequency($notification) { $out =& $notification->getNotificationObject(); $out = '</div> diff --git a/plugins/VisitsSummary/API.php b/plugins/VisitsSummary/API.php index e3ea62e02c..1bf80f2e50 100644 --- a/plugins/VisitsSummary/API.php +++ b/plugins/VisitsSummary/API.php @@ -55,13 +55,13 @@ class Piwik_VisitsSummary_API $dataTable = $archive->getDataTableFromNumeric($toFetch); if($bounceRateRequested !== false) { - $dataTable->filter('ColumnCallbackAddColumnPercentage', array('bounce_rate', 'bounce_count', 'nb_visits', 0)); + $dataTable->filter('ColumnCallbackAddColumnPercentage', array('bounce_count', 'bounce_rate', 'nb_visits', 0)); $dataTable->deleteColumns($toFetch); } return $dataTable; } - protected function getNumeric( $idSite, $period, $date, $toFetch ) + protected static function getNumeric( $idSite, $period, $date, $toFetch ) { Piwik::checkUserHasViewAccess( $idSite ); $archive = Piwik_Archive::build($idSite, $period, $date ); @@ -71,41 +71,41 @@ class Piwik_VisitsSummary_API public function getVisits( $idSite, $period, $date ) { - return $this->getNumeric( $idSite, $period, $date, 'nb_visits'); + return self::getNumeric( $idSite, $period, $date, 'nb_visits'); } public function getUniqueVisitors( $idSite, $period, $date ) { - return $this->getNumeric( $idSite, $period, $date, 'nb_uniq_visitors'); + return self::getNumeric( $idSite, $period, $date, 'nb_uniq_visitors'); } public function getActions( $idSite, $period, $date ) { - return $this->getNumeric( $idSite, $period, $date, 'nb_actions'); + return self::getNumeric( $idSite, $period, $date, 'nb_actions'); } public function getMaxActions( $idSite, $period, $date ) { - return $this->getNumeric( $idSite, $period, $date, 'max_actions'); + return self::getNumeric( $idSite, $period, $date, 'max_actions'); } public function getBounceCount( $idSite, $period, $date ) { - return $this->getNumeric( $idSite, $period, $date, 'bounce_count'); + return self::getNumeric( $idSite, $period, $date, 'bounce_count'); } public function getVisitsConverted( $idSite, $period, $date ) { - return $this->getNumeric( $idSite, $period, $date, 'nb_visits_converted'); + return self::getNumeric( $idSite, $period, $date, 'nb_visits_converted'); } public function getSumVisitsLength( $idSite, $period, $date ) { - return $this->getNumeric( $idSite, $period, $date, 'sum_visit_length'); + return self::getNumeric( $idSite, $period, $date, 'sum_visit_length'); } public function getSumVisitsLengthPretty( $idSite, $period, $date ) { - return Piwik::getPrettyTimeFromSeconds($this->getSumVisitsLength( $idSite, $period, $date )); + return Piwik::getPrettyTimeFromSeconds(self::getSumVisitsLength( $idSite, $period, $date )); } } diff --git a/plugins/VisitsSummary/VisitsSummary.php b/plugins/VisitsSummary/VisitsSummary.php index 77273376ea..6ae9228c1c 100644 --- a/plugins/VisitsSummary/VisitsSummary.php +++ b/plugins/VisitsSummary/VisitsSummary.php @@ -19,10 +19,11 @@ class Piwik_VisitsSummary extends Piwik_Plugin public function getInformation() { $info = array( - 'description' => Piwik_Translate('VisitsSummary_PluginDescription'), + 'name' => 'Visits Summary', + 'description' => 'Reports the general Analytics numbers: visits, unique visitors, number of actions, Bounce Rate, etc.', 'author' => 'Piwik', - 'author_homepage' => 'http://piwik.org/', - 'version' => Piwik_Version::VERSION, + 'homepage' => 'http://piwik.org/', + 'version' => '0.1', ); return $info; } @@ -44,7 +45,7 @@ class Piwik_VisitsSummary extends Piwik_Plugin function addMenu() { - Piwik_AddMenu('General_Visitors', 'VisitsSummary_SubmenuOverview', array('module' => 'VisitsSummary', 'action' => 'index'), true); + Piwik_AddMenu('General_Visitors', 'VisitsSummary_SubmenuOverview', array('module' => 'VisitsSummary'), true); } } diff --git a/plugins/VisitsSummary/templates/sparklines.tpl b/plugins/VisitsSummary/templates/sparklines.tpl index 8dfc316160..f8ce97cc29 100644 --- a/plugins/VisitsSummary/templates/sparklines.tpl +++ b/plugins/VisitsSummary/templates/sparklines.tpl @@ -3,11 +3,11 @@ {if isset($urlSparklineNbUniqVisitors)} <div class="sparkline">{sparkline src=$urlSparklineNbUniqVisitors} {'VisitsSummary_NbUniqueVisitors'|translate:"<strong>$nbUniqVisitors</strong>"}</div> {/if} - <div class="sparkline">{sparkline src=$urlSparklineNbActions} {'VisitsSummary_NbActionsDescription'|translate:"<strong>$nbActions</strong>"}</div> + <div class="sparkline">{sparkline src=$urlSparklineNbActions} {'VisitsSummary_NbActions'|translate:"<strong>$nbActions</strong>"}</div> </div> <div id='rightcolumn'> <div class="sparkline">{sparkline src=$urlSparklineSumVisitLength} {assign var=sumtimeVisitLength value=$sumVisitLength|sumtime} {'VisitsSummary_TotalTime'|translate:"<strong>$sumtimeVisitLength</strong>"}</div> <div class="sparkline">{sparkline src=$urlSparklineMaxActions} {'VisitsSummary_MaxNbActions'|translate:"<strong>$maxActions</strong>"}</div> <div class="sparkline">{sparkline src=$urlSparklineBounceRate} {'VisitsSummary_NbVisitsBounced'|translate:"<strong>$bounceRate%</strong>"}</div> </div> -<div style="clear:both;"></div> +<div style="clear:both" />
\ No newline at end of file diff --git a/plugins/Widgetize/Controller.php b/plugins/Widgetize/Controller.php index 700c9885f7..8cd3b7c902 100644 --- a/plugins/Widgetize/Controller.php +++ b/plugins/Widgetize/Controller.php @@ -41,9 +41,17 @@ class Piwik_Widgetize_Controller extends Piwik_Controller echo $view->render(); } + function testClearspring() + { + $view = Piwik_View::factory('test_widget'); + $view->url1 = Piwik_Url::getCurrentUrlWithoutQueryString().'?module=Widgetize&action=iframe&moduleToWidgetize=Referers&actionToWidgetize=getKeywords&idSite=1&period=day&date=yesterday&filter_limit=5&token_auth='.Piwik::getCurrentUserTokenAuth(); + $view->url2 = Piwik_Url::getCurrentUrlWithoutQueryString().'?module=Widgetize&action=iframe&moduleToWidgetize=VisitTime&actionToWidgetize=getVisitInformationPerServerTime&idSite=1&period=day&date=yesterday&viewDataTable=graphVerticalBar&show_footer=0&token_auth='.Piwik::getCurrentUserTokenAuth(); + $view->url3 = Piwik_Url::getCurrentUrlWithoutQueryString().'?module=Widgetize&action=iframe&moduleToWidgetize=Referers&actionToWidgetize=getKeywords&idSite=1&period=day&date=yesterday&viewDataTable=cloud&show_footer=1&filter_limit=15&show_search=false&token_auth='.Piwik::getCurrentUserTokenAuth(); + echo $view->render(); + } + function js() { - Piwik_API_Request::reloadAuthUsingTokenAuth(); $controllerName = Piwik_Common::getRequestVar('moduleToWidgetize'); $actionName = Piwik_Common::getRequestVar('actionToWidgetize'); $parameters = array ( $fetch = true ); @@ -57,7 +65,6 @@ class Piwik_Widgetize_Controller extends Piwik_Controller function iframe() { - Piwik_API_Request::reloadAuthUsingTokenAuth(); $controllerName = Piwik_Common::getRequestVar('moduleToWidgetize'); $actionName = Piwik_Common::getRequestVar('actionToWidgetize'); $parameters = array ( $fetch = true ); diff --git a/plugins/Widgetize/Widgetize.php b/plugins/Widgetize/Widgetize.php index cfe98e3aa1..9e60096a01 100644 --- a/plugins/Widgetize/Widgetize.php +++ b/plugins/Widgetize/Widgetize.php @@ -19,10 +19,11 @@ class Piwik_Widgetize extends Piwik_Plugin public function getInformation() { return array( - 'description' => Piwik_Translate('Widgetize_PluginDescription'), + 'name' => 'Widgetize your data!', + 'description' => 'The plugin makes it very easy to export any Piwik Widget in your Blog, Website or on Igoogle and Netvibes!', 'author' => 'Piwik', - 'author_homepage' => 'http://piwik.org/', - 'version' => Piwik_Version::VERSION, + 'homepage' => 'http://piwik.org/', + 'version' => '0.1', ); } } diff --git a/plugins/Widgetize/templates/index.tpl b/plugins/Widgetize/templates/index.tpl index 3e705fb001..f2f3573019 100644 --- a/plugins/Widgetize/templates/index.tpl +++ b/plugins/Widgetize/templates/index.tpl @@ -1,6 +1,6 @@ {assign var=showSitesSelection value=true} {assign var=showPeriodSelection value=true} -{include file="CoreHome/templates/header.tpl"} +{include file="CoreAdminHome/templates/header.tpl"} {loadJavascriptTranslations plugins='Dashboard'} <link rel="stylesheet" type="text/css" href="plugins/CoreHome/templates/styles.css" /> @@ -8,16 +8,16 @@ <link rel="stylesheet" type="text/css" href="plugins/CoreHome/templates/cloud.css" /> <link rel="stylesheet" type="text/css" href="plugins/Dashboard/templates/dashboard.css" /> +<script type="text/javascript" src="themes/default/common.js"></script> <script type="text/javascript" src="libs/swfobject/swfobject.js"></script> <script type="text/javascript" src="libs/jquery/tooltip/jquery.tooltip.js"></script> <script type="text/javascript" src="libs/jquery/truncate/jquery.truncate.js"></script> <script type="text/javascript" src="libs/jquery/jquery.scrollTo.js"></script> -<script type="text/javascript" src="themes/default/common.js"></script> <script type="text/javascript" src="plugins/CoreHome/templates/datatable.js"></script> <script type="text/javascript" src="plugins/Dashboard/templates/widgetMenu.js"></script> <script type="text/javascript" src="plugins/Widgetize/templates/widgetize.js"></script> - +<script src="http://cdn.clearspring.com/launchpad/v2/standalone.js" type="text/javascript"></script> {literal} <style> .menu { @@ -64,11 +64,9 @@ $(document).ready( function() { menu.registerCallbackOnWidgetLoad( widgetized.callbackAddExportButtonsUnderWidget ); menu.registerCallbackOnMenuHover( widgetized.deleteEmbedElements ); menu.show(); - var dashboardUrl = document.location.protocol + '//' + document.location.hostname + document.location.pathname + '?module=Widgetize&action=iframe&moduleToWidgetize=Dashboard&actionToWidgetize=index&idSite=1&period=week&date=yesterday'; $('#exportFullDashboard').html( - widgetized.getInputFormWithHtml( 'dashboardEmbed', '<iframe src="'+ dashboardUrl +'" frameborder="0" marginheight="0" marginwidth="0" width="100%" height="100%"></iframe>') + widgetized.getInputFormWithHtml( 'dashboardEmbed', '<iframe src="'+document.location.protocol + '//' + document.location.hostname + document.location.pathname + '?'+'module=Widgetize&action=iframe&moduleToWidgetize=Dashboard&actionToWidgetize=index&idSite=1&period=week&date=yesterday" frameborder="0" marginheight="0" marginwidth="0" width="100%" height="100%"></iframe>') ); - $('#linkDashboardUrl').attr('href',dashboardUrl); }); {/literal} @@ -76,18 +74,13 @@ $(document).ready( function() { <div style="max-width:980px;"> <p>With Piwik, you can export your Web Analytics reports on your blog, website, or intranet dashboard... in one click. - <p><b>› Widget authentication:</b> If you want your widgets to be viewable by everybody, you first have to set the 'view' permissions - to the anonymous user in the <a href='index.php?module=UsersManager'>Users Management section</a>. - <br />Alternatively, if you are publishing widgets on a password protected or private page, - you don't necessarily have to allow 'anonymous' to view your reports. In this case, you can add the secret token_auth parameter (found in the <a href='{url module=API action=listAllAPI}' target='_blank'>API page</a>) in the widget URL. - </p> - <p><b>› Widgetize the full dashboard:</b> You can also display the full Piwik dashboard in your application or website in an IFRAME (<a href='' target='_blank' id='linkDashboardUrl'>see example</a>). - The date parameter can be set to a specific calendar date, "today", or "yesterday". The period parameter can be set to "day", "week", "month", or "year". - The language parameter can be set to the language code of a translation, such as language=fr. + If you want your widgets to be viewable by everybody, you first have to set the 'view' permissions + to the anonymous user in the <a href='index.php?module=UsersManager'>Users Management section</a>. + <br>Note: You can also display the full Piwik dashboard in your application or website in an Iframe. For example, for idSite=1 and date=yesterday, you can write: <span id='exportFullDashboard'></span> </p> - <p> <b>› Select a report, and copy paste in your page the embed code below the widget:</b> - <div id="widgetChooser" style='height:600px'> + + <div id="widgetChooser"> <div class="subMenu" id="sub1"></div> <div class="subMenu" id="sub2"></div> <div class="subMenu" id="sub3"></div> diff --git a/plugins/Widgetize/templates/js.tpl b/plugins/Widgetize/templates/js.tpl index a92c76e6fc..18ea5d877b 100644 --- a/plugins/Widgetize/templates/js.tpl +++ b/plugins/Widgetize/templates/js.tpl @@ -1,19 +1,19 @@ {loadJavascriptTranslations disableOutputScriptTag=1 plugins='CoreHome'} -document.write('<link rel="stylesheet" type="text/css" href="{$piwikUrl}themes/default/common.css" />'); -document.write('<link rel="stylesheet" type="text/css" href="{$piwikUrl}plugins/CoreHome/templates/styles.css" />'); -document.write('<link rel="stylesheet" type="text/css" href="{$piwikUrl}plugins/CoreHome/templates/datatable.css" />'); -document.write('<link rel="stylesheet" type="text/css" href="{$piwikUrl}plugins/CoreHome/templates/cloud.css" />'); +document.write('<link rel="stylesheet" href="{$piwikUrl}themes/default/common.css">'); +document.write('<link rel="stylesheet" href="{$piwikUrl}plugins/CoreHome/templates/styles.css">'); +document.write('<link rel="stylesheet" href="{$piwikUrl}plugins/CoreHome/templates/datatable.css">'); +document.write('<link rel="stylesheet" href="{$piwikUrl}plugins/CoreHome/templates/cloud.css">'); -document.write('<scr'+'ipt type="text/javascript" src="{$piwikUrl}libs/swfobject/swfobject.js"></scr'+'ipt>'); -document.write('<scr'+'ipt type="text/javascript" src="{$piwikUrl}libs/jquery/jquery.js"></scr'+'ipt>'); -document.write('<scr'+'ipt type="text/javascript" src="{$piwikUrl}libs/jquery/jquery-ui.js"></scr'+'ipt>'); -document.write('<scr'+'ipt type="text/javascript" src="{$piwikUrl}libs/jquery/tooltip/jquery.tooltip.js"></scr'+'ipt>'); -document.write('<scr'+'ipt type="text/javascript" src="{$piwikUrl}libs/jquery/truncate/jquery.truncate.js"></scr'+'ipt>'); -document.write('<scr'+'ipt type="text/javascript" src="{$piwikUrl}libs/javascript/sprintf.js"></scr'+'ipt>'); -document.write('<scr'+'ipt type="text/javascript" src="{$piwikUrl}themes/default/common.js"></scr'+'ipt>'); -document.write('<scr'+'ipt type="text/javascript" src="{$piwikUrl}plugins/CoreHome/templates/datatable.js"></scr'+'ipt>'); +document.write('<scr'+'ipt language="javascript" src="{$piwikUrl}themes/default/common.js"></scr'+'ipt>'); +document.write('<scr'+'ipt language="javascript" src="{$piwikUrl}libs/swfobject/swfobject.js"></scr'+'ipt>'); +document.write('<scr'+'ipt language="javascript" src="{$piwikUrl}libs/jquery/jquery.js"></scr'+'ipt>'); +document.write('<scr'+'ipt language="javascript" src="{$piwikUrl}libs/jquery/jquery-ui.js"></scr'+'ipt>'); +document.write('<scr'+'ipt language="javascript" src="{$piwikUrl}libs/jquery/tooltip/jquery.tooltip.js"></scr'+'ipt>'); +document.write('<scr'+'ipt language="javascript" src="{$piwikUrl}libs/jquery/truncate/jquery.truncate.js"></scr'+'ipt>'); +document.write('<scr'+'ipt language="javascript" src="{$piwikUrl}libs/javascript/sprintf.js"></scr'+'ipt>'); +document.write('<scr'+'ipt language="javascript" src="{$piwikUrl}plugins/CoreHome/templates/datatable.js"></scr'+'ipt>'); var content = '{$content|escape:'javascript'}'; -document.write('<scr'+'ipt type="text/javascript">document.write(content)</scr'+'ipt>'); +document.write('<scr'+'ipt language="javascript">document.write(content)</scr'+'ipt>'); diff --git a/plugins/Widgetize/templates/widgetize.js b/plugins/Widgetize/templates/widgetize.js index 5f8a3c368d..e509a63cdd 100644 --- a/plugins/Widgetize/templates/widgetize.js +++ b/plugins/Widgetize/templates/widgetize.js @@ -4,7 +4,7 @@ function widgetize() this.getInputFormWithHtml = function(inputId, htmlEmbed) { - return '<input class="formEmbedCode" id="'+inputId+'" value="'+ htmlEmbed.replace(/"/g, '"') +'" onclick="javascript:document.getElementById(\''+inputId+'\').focus();document.getElementById(\''+inputId+'\').select();" readonly="true" type="text" />'; + return '<input class="formEmbedCode" id="'+inputId+'" value="'+ htmlEmbed.replace(/"/g, '"') +'" onclick="javascript:document.getElementById(\''+inputId+'\').focus();document.getElementById(\''+inputId+'\').select();" readonly="true" type="text">'; } this.getEmbedUrl = function( parameters, exportFormat ) @@ -84,9 +84,21 @@ function widgetize() '</span>'+ '</div>' ); - }); - + }); + + // Add the Clearspring Export + $(exportButtonsElement).append( + '<div id="embedThisWidgetEverywhere">'+ + '<div id="exportThisWidget">'+ + '<label for="flashEmbed">› Export anywhere!</label>'+ + '<img src="http://cdn.clearspring.com/launchpad/static/cs_button_share1.gif">'+ + '</div>'+ + '<div id="exportThisWidgetMenu"></div>'+ + '</div>' + ); + // We then replace the div iframeDivToExport with the actual Iframe html + // Clearspring will then build a widget that has the same html as this div $('#iframeDivToExport') .html(widgetIframeHtml); @@ -95,8 +107,17 @@ function widgetize() .parent() .append(exportButtonsElement); + // Call clearspring + $Launchpad.ShowButton({ + actionElement : "exportThisWidget", + targetElement : "exportThisWidgetMenu", + userId : "4797da88692e4fe9", + widgetName : widgetName + " - Piwik", + source : "iframeDivToExport" + }); + // JS is buggy at least on IE //var widgetJS = '<script type="text/javascript" src="'+ getEmbedUrl(pluginId, actionId, "js") +'"></scr'+'ipt>'; - //divEmbedThisWidget.append('<br />Embed JS: '+ getInputFormWithHtml('javascriptEmbed', widgetJS)); + //divEmbedThisWidget.append('<br/>Embed JS: '+ getInputFormWithHtml('javascriptEmbed', widgetJS)); } } |