diff options
author | Fabian Becker <fabian.becker@uni-tuebingen.de> | 2013-07-18 13:45:02 +0400 |
---|---|---|
committer | Fabian Becker <fabian.becker@uni-tuebingen.de> | 2013-07-18 13:45:02 +0400 |
commit | 03b4953f008c1063e6d7166143ba844e8c6e89cc (patch) | |
tree | 7b9f0fef13d75417c551f813c98dba1a22f2fff3 /core | |
parent | 9b2c0a7a450fff3b634f8119c8003ae1d20b97d0 (diff) |
Refactor class Piwik_Common to \Piwik\Core\Common
Notice that auto refactoring has created a nested namespace. Not sure this is what we want - so we might have to edit those nested namespaces afterwards (I think they don't look so good)
Diffstat (limited to 'core')
111 files changed, 564 insertions, 564 deletions
diff --git a/core/API/DataTableGenericFilter.php b/core/API/DataTableGenericFilter.php index 39dbba045c..9561c26ee5 100644 --- a/core/API/DataTableGenericFilter.php +++ b/core/API/DataTableGenericFilter.php @@ -8,7 +8,7 @@ * @category Piwik * @package Piwik */ -use Piwik\Core\Piwik_Common; +use Piwik\Core\Common; /** * @package Piwik @@ -132,7 +132,7 @@ class Piwik_API_DataTableGenericFilter } try { - $value = Piwik_Common::getRequestVar($name, $defaultValue, $type, $this->request); + $value = Common::getRequestVar($name, $defaultValue, $type, $this->request); settype($value, $type); $filterParameters[] = $value; } catch (Exception $e) { diff --git a/core/API/DataTableManipulator/LabelFilter.php b/core/API/DataTableManipulator/LabelFilter.php index 1d6ca323d9..43f43ce056 100644 --- a/core/API/DataTableManipulator/LabelFilter.php +++ b/core/API/DataTableManipulator/LabelFilter.php @@ -8,7 +8,7 @@ * @category Piwik * @package Piwik */ -use Piwik\Core\Piwik_Common; +use Piwik\Core\Common; /** * This class is responsible for handling the label parameter that can be @@ -120,7 +120,7 @@ class Piwik_API_DataTableManipulator_LabelFilter extends Piwik_API_DataTableMani $label = urldecode($label); $label = trim($label); - $sanitizedLabel = Piwik_Common::sanitizeInputValue( $label ); + $sanitizedLabel = Common::sanitizeInputValue( $label ); $variations[] = $sanitizedLabel; if ($this->apiModule == 'Actions' diff --git a/core/API/DocumentationGenerator.php b/core/API/DocumentationGenerator.php index e36023af01..0f40826e22 100644 --- a/core/API/DocumentationGenerator.php +++ b/core/API/DocumentationGenerator.php @@ -9,7 +9,7 @@ * @package Piwik */ use Piwik\Core\Piwik; -use Piwik\Core\Piwik_Common; +use Piwik\Core\Common; /** * @package Piwik @@ -27,7 +27,7 @@ class Piwik_API_DocumentationGenerator { $plugins = Piwik_PluginsManager::getInstance()->getLoadedPluginsName(); foreach ($plugins as $plugin) { - $plugin = Piwik_Common::unprefixClass($plugin); + $plugin = Common::unprefixClass($plugin); try { Piwik_API_Proxy::getInstance()->registerClass('Piwik_' . $plugin . '_API'); } catch (Exception $e) { @@ -52,9 +52,9 @@ class Piwik_API_DocumentationGenerator $str = $toc = ''; $token_auth = "&token_auth=" . Piwik::getCurrentUserTokenAuth(); $parametersToSet = array( - 'idSite' => Piwik_Common::getRequestVar('idSite', 1, 'int'), - 'period' => Piwik_Common::getRequestVar('period', 'day', 'string'), - 'date' => Piwik_Common::getRequestVar('date', 'today', 'string') + 'idSite' => Common::getRequestVar('idSite', 1, 'int'), + 'period' => Common::getRequestVar('period', 'day', 'string'), + 'date' => Common::getRequestVar('date', 'today', 'string') ); foreach (Piwik_API_Proxy::getInstance()->getMetadata() as $class => $info) { diff --git a/core/API/Proxy.php b/core/API/Proxy.php index 16a0f6dd32..ae07892e3d 100644 --- a/core/API/Proxy.php +++ b/core/API/Proxy.php @@ -8,7 +8,7 @@ * @category Piwik * @package Piwik */ -use Piwik\Core\Piwik_Common; +use Piwik\Core\Common; /** * To differentiate between "no value" and default value of null @@ -281,7 +281,7 @@ class Piwik_API_Proxy foreach ($requiredParameters as $name => $defaultValue) { try { if ($defaultValue instanceof Piwik_API_Proxy_NoDefaultValue) { - $requestValue = Piwik_Common::getRequestVar($name, null, null, $parametersRequest); + $requestValue = Common::getRequestVar($name, null, null, $parametersRequest); } else { try { @@ -289,7 +289,7 @@ class Piwik_API_Proxy // segment parameter is an exception: we do not want to sanitize user input or it would break the segment encoding $requestValue = ($parametersRequest['segment']); } else { - $requestValue = Piwik_Common::getRequestVar($name, $defaultValue, null, $parametersRequest); + $requestValue = Common::getRequestVar($name, $defaultValue, null, $parametersRequest); } } catch (Exception $e) { // Special case: empty parameter in the URL, should return the empty string diff --git a/core/API/Request.php b/core/API/Request.php index 19bf6634ca..184a566d09 100644 --- a/core/API/Request.php +++ b/core/API/Request.php @@ -9,7 +9,7 @@ * @package Piwik */ use Piwik\Core\Piwik; -use Piwik\Core\Piwik_Common; +use Piwik\Core\Common; /** * An API request is the object used to make a call to the API and get the result. @@ -70,7 +70,7 @@ class Piwik_API_Request $request = trim($request); $request = str_replace(array("\n", "\t"), '', $request); - $requestParsed = Piwik_Common::getArrayFromQueryString($request); + $requestParsed = Common::getArrayFromQueryString($request); $requestArray = $requestParsed + $defaultRequest; } @@ -125,14 +125,14 @@ class Piwik_API_Request public function process() { // read the format requested for the output data - $outputFormat = strtolower(Piwik_Common::getRequestVar('format', 'xml', 'string', $this->request)); + $outputFormat = strtolower(Common::getRequestVar('format', 'xml', 'string', $this->request)); // create the response $response = new Piwik_API_ResponseBuilder($outputFormat, $this->request); try { // read parameters - $moduleMethod = Piwik_Common::getRequestVar('method', null, 'string', $this->request); + $moduleMethod = Common::getRequestVar('method', null, 'string', $this->request); list($module, $method) = $this->extractModuleAndMethod($moduleMethod); @@ -164,7 +164,7 @@ class Piwik_API_Request static public function reloadAuthUsingTokenAuth($request = null) { // if a token_auth is specified in the API request, we load the right permissions - $token_auth = Piwik_Common::getRequestVar('token_auth', '', 'string', $request); + $token_auth = Common::getRequestVar('token_auth', '', 'string', $request); if ($token_auth) { Piwik_PostEvent('API.Request.authenticate', array($token_auth)); Piwik_Access::getInstance()->reloadAccess(); @@ -217,7 +217,7 @@ class Piwik_API_Request if(empty($_SERVER['QUERY_STRING'])) { return array(); } - $GET = Piwik_Common::getArrayFromQueryString($_SERVER['QUERY_STRING']); + $GET = Common::getArrayFromQueryString($_SERVER['QUERY_STRING']); return $GET; } diff --git a/core/API/ResponseBuilder.php b/core/API/ResponseBuilder.php index d4082226d1..f826319fca 100644 --- a/core/API/ResponseBuilder.php +++ b/core/API/ResponseBuilder.php @@ -9,7 +9,7 @@ * @package Piwik */ use Piwik\Core\Piwik; -use Piwik\Core\Piwik_Common; +use Piwik\Core\Common; /** * @package Piwik @@ -164,7 +164,7 @@ class Piwik_API_ResponseBuilder */ protected function caseRendererPHPSerialize($defaultSerializeValue = 1) { - $serialize = Piwik_Common::getRequestVar('serialize', $defaultSerializeValue, 'int', $this->request); + $serialize = Common::getRequestVar('serialize', $defaultSerializeValue, 'int', $this->request); if ($serialize) { return true; } @@ -190,27 +190,27 @@ class Piwik_API_ResponseBuilder return $dataTable; } - $method = Piwik_Common::getRequestVar('method', '', 'string', $this->request); + $method = Common::getRequestVar('method', '', 'string', $this->request); $renderer = Piwik_DataTable_Renderer::factory($format); $renderer->setTable($dataTable); - $renderer->setRenderSubTables(Piwik_Common::getRequestVar('expanded', false, 'int', $this->request)); - $renderer->setHideIdSubDatableFromResponse(Piwik_Common::getRequestVar('hideIdSubDatable', false, 'int', $this->request)); + $renderer->setRenderSubTables(Common::getRequestVar('expanded', false, 'int', $this->request)); + $renderer->setHideIdSubDatableFromResponse(Common::getRequestVar('hideIdSubDatable', false, 'int', $this->request)); if ($format == 'php') { $renderer->setSerialize($this->caseRendererPHPSerialize()); - $renderer->setPrettyDisplay(Piwik_Common::getRequestVar('prettyDisplay', false, 'int', $this->request)); + $renderer->setPrettyDisplay(Common::getRequestVar('prettyDisplay', false, 'int', $this->request)); } else if ($format == 'html') { $renderer->setTableId($this->request['method']); } else if ($format == 'csv' || $format == 'tsv') { - $renderer->setConvertToUnicode(Piwik_Common::getRequestVar('convertToUnicode', true, 'int', $this->request)); + $renderer->setConvertToUnicode(Common::getRequestVar('convertToUnicode', true, 'int', $this->request)); } // prepare translation of column names if ($format == 'html' || $format == 'csv' || $format == 'tsv' || $format = 'rss') { $renderer->setApiMethod($method); - $renderer->setIdSite(Piwik_Common::getRequestVar('idSite', false, 'int', $this->request)); - $renderer->setTranslateColumnNames(Piwik_Common::getRequestVar('translateColumnNames', false, 'int', $this->request)); + $renderer->setIdSite(Common::getRequestVar('idSite', false, 'int', $this->request)); + $renderer->setTranslateColumnNames(Common::getRequestVar('translateColumnNames', false, 'int', $this->request)); } return $renderer->render(); @@ -282,16 +282,16 @@ class Piwik_API_ResponseBuilder protected function handleDataTable($datatable) { // if requested, flatten nested tables - if (Piwik_Common::getRequestVar('flat', '0', 'string', $this->request) == '1') { + if (Common::getRequestVar('flat', '0', 'string', $this->request) == '1') { $flattener = new Piwik_API_DataTableManipulator_Flattener($this->apiModule, $this->apiMethod, $this->request); - if (Piwik_Common::getRequestVar('include_aggregate_rows', '0', 'string', $this->request) == '1') { + if (Common::getRequestVar('include_aggregate_rows', '0', 'string', $this->request) == '1') { $flattener->includeAggregateRows(); } $datatable = $flattener->flatten($datatable); } // if the flag disable_generic_filters is defined we skip the generic filters - if (0 == Piwik_Common::getRequestVar('disable_generic_filters', '0', 'string', $this->request)) { + if (0 == Common::getRequestVar('disable_generic_filters', '0', 'string', $this->request)) { $genericFilter = new Piwik_API_DataTableGenericFilter($this->request); $genericFilter->filter($datatable); } @@ -300,14 +300,14 @@ class Piwik_API_ResponseBuilder $datatable->queueFilter('SafeDecodeLabel'); // if the flag disable_queued_filters is defined we skip the filters that were queued - if (Piwik_Common::getRequestVar('disable_queued_filters', 'false', 'string', $this->request) == 'false') { + if (Common::getRequestVar('disable_queued_filters', 'false', 'string', $this->request) == 'false') { $datatable->applyQueuedFilters(); } // use the ColumnDelete filter if hideColumns/showColumns is provided (must be done // after queued filters are run so processed metrics can be removed, too) - $hideColumns = Piwik_Common::getRequestVar('hideColumns', '', 'string', $this->request); - $showColumns = Piwik_Common::getRequestVar('showColumns', '', 'string', $this->request); + $hideColumns = Common::getRequestVar('hideColumns', '', 'string', $this->request); + $showColumns = Common::getRequestVar('showColumns', '', 'string', $this->request); if ($hideColumns !== '' || $showColumns !== '') { $datatable->filter('ColumnDelete', array($hideColumns, $showColumns)); } @@ -315,7 +315,7 @@ class Piwik_API_ResponseBuilder // apply label filter: only return rows matching the label parameter (more than one if more than one label) $label = $this->getLabelFromRequest($this->request); if (!empty($label)) { - $addLabelIndex = Piwik_Common::getRequestVar('labelFilterAddLabelIndex', 0, 'int', $this->request) == 1; + $addLabelIndex = Common::getRequestVar('labelFilterAddLabelIndex', 0, 'int', $this->request) == 1; $filter = new Piwik_API_DataTableManipulator_LabelFilter($this->apiModule, $this->apiMethod, $this->request); $datatable = $filter->filter($label, $datatable, $addLabelIndex); @@ -437,7 +437,7 @@ class Piwik_API_ResponseBuilder // Case dimension is a PHP array case (is_array($value)): - $json .= Piwik_Common::json_encode($value); + $json .= Common::json_encode($value); break; // Case dimension is a Piwik_DataTable_Array or a Piwik_DataTable @@ -452,7 +452,7 @@ class Piwik_API_ResponseBuilder // Case scalar default: - $json .= Piwik_Common::json_encode($value); + $json .= Common::json_encode($value); break; } @@ -479,9 +479,9 @@ class Piwik_API_ResponseBuilder */ static public function getLabelFromRequest($request) { - $label = Piwik_Common::getRequestVar('label', array(), 'array', $request); + $label = Common::getRequestVar('label', array(), 'array', $request); if (empty($label)) { - $label = Piwik_Common::getRequestVar('label', '', 'string', $request); + $label = Common::getRequestVar('label', '', 'string', $request); if (!empty($label)) { $label = array($label); } @@ -496,7 +496,7 @@ class Piwik_API_ResponseBuilder // this is needed because Piwik_API_Proxy uses Piwik_Common::getRequestVar which in turn // uses Piwik_Common::sanitizeInputValue. This causes the > that separates recursive labels // to become > and we need to undo that here. - $label = Piwik_Common::unsanitizeInputValues($label); + $label = Common::unsanitizeInputValues($label); return $label; } } diff --git a/core/Access.php b/core/Access.php index 52ef921eba..10f798e937 100644 --- a/core/Access.php +++ b/core/Access.php @@ -9,7 +9,7 @@ * @package Piwik */ use Piwik\Core\Config; -use Piwik\Core\Piwik_Common; +use Piwik\Core\Common; /** * Class to handle User Access: @@ -195,8 +195,8 @@ class Piwik_Access public static function getSqlAccessSite($select) { return "SELECT " . $select . " - FROM " . Piwik_Common::prefixTable('access') . " as t1 - JOIN " . Piwik_Common::prefixTable('site') . " as t2 USING (idsite) " . + FROM " . Common::prefixTable('access') . " as t1 + JOIN " . Common::prefixTable('site') . " as t2 USING (idsite) " . " WHERE login = ?"; } diff --git a/core/ArchiveProcessor/Rules.php b/core/ArchiveProcessor/Rules.php index e1a1b2004b..34abbec536 100644 --- a/core/ArchiveProcessor/Rules.php +++ b/core/ArchiveProcessor/Rules.php @@ -10,7 +10,7 @@ */ use Piwik\Core\Config; use Piwik\Core\Piwik; -use Piwik\Core\Piwik_Common; +use Piwik\Core\Common; /** * This class contains Archiving rules/logic which are used in several places @@ -205,9 +205,9 @@ class Piwik_ArchiveProcessor_Rules { return !self::$archivingDisabledByTests && (Piwik_ArchiveProcessor_Rules::isBrowserTriggerEnabled() - || Piwik_Common::isPhpCliMode() + || Common::isPhpCliMode() || (Piwik::isUserIsSuperUser() - && Piwik_Common::isArchivePhpTriggered())); + && Common::isArchivePhpTriggered())); } public static function isBrowserTriggerEnabled() diff --git a/core/AssetManager.php b/core/AssetManager.php index 6a62cb176f..1c50f69ce6 100644 --- a/core/AssetManager.php +++ b/core/AssetManager.php @@ -10,7 +10,7 @@ */ use Piwik\Core\Config; use Piwik\Core\Piwik; -use Piwik\Core\Piwik_Common; +use Piwik\Core\Common; /** * @see libs/jsmin/jsmin.php @@ -82,7 +82,7 @@ class Piwik_AssetManager public static function generateAssetsCacheBuster() { $pluginList = md5(implode(",", Piwik_PluginsManager::getInstance()->getLoadedPluginsName())); - $cacheBuster = md5(Piwik_Common::getSalt() . $pluginList . PHP_VERSION . Piwik_Version::VERSION); + $cacheBuster = md5(Common::getSalt() . $pluginList . PHP_VERSION . Piwik_Version::VERSION); return $cacheBuster; } @@ -430,7 +430,7 @@ class Piwik_AssetManager $mergedFileDirectory = PIWIK_USER_PATH . '/' . self::MERGED_FILE_DIR; if (!is_dir($mergedFileDirectory)) { - Piwik_Common::mkdir($mergedFileDirectory); + Common::mkdir($mergedFileDirectory); } if (!is_writable($mergedFileDirectory)) { diff --git a/core/CacheFile.php b/core/CacheFile.php index a7697084cd..21dafedf65 100644 --- a/core/CacheFile.php +++ b/core/CacheFile.php @@ -9,7 +9,7 @@ * @package Piwik */ use Piwik\Core\Piwik; -use Piwik\Core\Piwik_Common; +use Piwik\Core\Common; /** * Code originally inspired from OpenX @@ -91,7 +91,7 @@ class Piwik_CacheFile protected function cleanupId($id) { - if (!Piwik_Common::isValidFilename($id)) { + if (!Common::isValidFilename($id)) { throw new Exception("Invalid cache ID request $id"); } return $id; @@ -110,7 +110,7 @@ class Piwik_CacheFile return false; } if (!is_dir($this->cachePath)) { - Piwik_Common::mkdir($this->cachePath); + Common::mkdir($this->cachePath); } if (!is_writable($this->cachePath)) { return false; diff --git a/core/Common.php b/core/Common.php index 36c3c97db4..bad3bf28ed 100644 --- a/core/Common.php +++ b/core/Common.php @@ -16,7 +16,7 @@ namespace Piwik\Core { * * @package Piwik */ - class Piwik_Common + class Common { const CLASSES_PREFIX = 'Piwik_'; @@ -185,10 +185,10 @@ namespace Piwik\Core { $value = false; } if (!empty($name)) { - $name = \Piwik\Core\Piwik_Common::sanitizeInputValue($name); + $name = \Piwik\Core\Common::sanitizeInputValue($name); } if (!empty($value)) { - $value = \Piwik\Core\Piwik_Common::sanitizeInputValue($value); + $value = \Piwik\Core\Common::sanitizeInputValue($value); } // if array without indexes @@ -497,7 +497,7 @@ namespace Piwik\Core { // $_GET and $_REQUEST already urldecode()'d // decode // note: before php 5.2.7, htmlspecialchars() double encodes &#x hex items - $value = html_entity_decode($value, \Piwik\Core\Piwik_Common::HTML_ENCODING_QUOTE_STYLE, 'UTF-8'); + $value = html_entity_decode($value, \Piwik\Core\Common::HTML_ENCODING_QUOTE_STYLE, 'UTF-8'); // filter $value = str_replace(array("\n", "\r", "\0"), '', $value); @@ -611,7 +611,7 @@ namespace Piwik\Core { // we deal w/ json differently if ($varType == 'json') { $value = \Piwik\Core\self::undoMagicQuotes($requestArrayToUse[$varName]); - $value = \Piwik\Core\Piwik_Common::json_decode($value, $assoc = true); + $value = \Piwik\Core\Common::json_decode($value, $assoc = true); return \Piwik\Core\self::sanitizeInputValues($value, $alreadyStripslashed = true); } diff --git a/core/Controller.php b/core/Controller.php index bfb37b59d8..651351be5f 100644 --- a/core/Controller.php +++ b/core/Controller.php @@ -10,7 +10,7 @@ */ use Piwik\Core\Config; use Piwik\Core\Piwik; -use Piwik\Core\Piwik_Common; +use Piwik\Core\Common; /** * Parent class of all plugins Controllers (located in /plugins/PluginName/Controller.php @@ -62,9 +62,9 @@ abstract class Piwik_Controller { $aPluginName = explode('_', get_class($this)); $this->pluginName = $aPluginName[1]; - $date = Piwik_Common::getRequestVar('date', 'yesterday', 'string'); + $date = Common::getRequestVar('date', 'yesterday', 'string'); try { - $this->idSite = Piwik_Common::getRequestVar('idSite', false, 'int'); + $this->idSite = Common::getRequestVar('idSite', false, 'int'); $this->site = new Piwik_Site($this->idSite); $date = $this->getDateParameterInTimezone($date, $this->site->getTimezone()); $this->setDate($date); @@ -198,9 +198,9 @@ abstract class Piwik_Controller $_GET['columns'] = implode(',', $columnsToDisplay); // load translations from meta data - $idSite = Piwik_Common::getRequestVar('idSite'); - $period = Piwik_Common::getRequestVar('period'); - $date = Piwik_Common::getRequestVar('date'); + $idSite = Common::getRequestVar('idSite'); + $period = Common::getRequestVar('period'); + $date = Common::getRequestVar('date'); $meta = Piwik_API_API::getInstance()->getReportMetadata($idSite, $period, $date); $columns = array_merge($columnsToDisplay, $selectableColumns); @@ -254,7 +254,7 @@ abstract class Piwik_Controller protected function getGraphParamsModified($paramsToSet = array()) { if (!isset($paramsToSet['period'])) { - $period = Piwik_Common::getRequestVar('period'); + $period = Common::getRequestVar('period'); } else { $period = $paramsToSet['period']; } @@ -396,8 +396,8 @@ abstract class Piwik_Controller } $this->setPeriodVariablesView($view); - $rawDate = Piwik_Common::getRequestVar('date'); - $periodStr = Piwik_Common::getRequestVar('period'); + $rawDate = Common::getRequestVar('date'); + $periodStr = Common::getRequestVar('period'); if ($periodStr != 'range') { $date = Piwik_Date::factory($this->strDate); $period = Piwik_Period::factory($periodStr, $date); @@ -484,7 +484,7 @@ abstract class Piwik_Controller if (!$view->isValidHost) { // invalid host, so display warning to user $validHost = Config::getInstance()->General['trusted_hosts'][0]; - $invalidHost = Piwik_Common::sanitizeInputValue($_SERVER['HTTP_HOST']); + $invalidHost = Common::sanitizeInputValue($_SERVER['HTTP_HOST']); $emailSubject = rawurlencode(Piwik_Translate('CoreHome_InjectedHostEmailSubject', $invalidHost)); $emailBody = rawurlencode(Piwik_Translate('CoreHome_InjectedHostEmailBody')); @@ -496,8 +496,8 @@ abstract class Piwik_Controller $invalidUrl = Piwik_Url::getCurrentUrlWithoutQueryString($checkIfTrusted = false); $validUrl = Piwik_Url::getCurrentScheme() . '://' . $validHost . Piwik_Url::getCurrentScriptName(); - $invalidUrl = Piwik_Common::sanitizeInputValue($invalidUrl); - $validUrl = Piwik_Common::sanitizeInputValue($validUrl); + $invalidUrl = Common::sanitizeInputValue($invalidUrl); + $validUrl = Common::sanitizeInputValue($validUrl); $changeTrustedHostsUrl = "index.php" . Piwik_Url::getCurrentQueryStringWithParametersModified(array( @@ -553,7 +553,7 @@ abstract class Piwik_Controller return; } - $currentPeriod = Piwik_Common::getRequestVar('period'); + $currentPeriod = Common::getRequestVar('period'); $view->displayUniqueVisitors = Piwik::isUniqueVisitorsEnabled($currentPeriod); $availablePeriods = array('day', 'week', 'month', 'year', 'range'); if (!in_array($currentPeriod, $availablePeriods)) { @@ -594,7 +594,7 @@ abstract class Piwik_Controller $metricsForAllPeriods = array('nb_visits', 'nb_actions'), $labelDisplayed = true) { // columns is set in the request if metrics picker has been used - $columns = Piwik_Common::getRequestVar('columns', false); + $columns = Common::getRequestVar('columns', false); if ($columns !== false) { $columns = Piwik::getArrayFromApiParameter($columns); $firstColumn = $columns[0]; @@ -669,7 +669,7 @@ abstract class Piwik_Controller if (Piwik::isUserIsSuperUser()) { Piwik_ExitWithMessage("Error: no website was found in this Piwik installation. - <br />Check the table '" . Piwik_Common::prefixTable('site') . "' in your database, it should contain your Piwik websites.", false, true); + <br />Check the table '" . Common::prefixTable('site') . "' in your database, it should contain your Piwik websites.", false, true); } $currentLogin = Piwik::getCurrentUserLogin(); @@ -769,7 +769,7 @@ abstract class Piwik_Controller */ protected function checkTokenInUrl() { - if (Piwik_Common::getRequestVar('token_auth', false) != Piwik::getCurrentUserTokenAuth()) { + if (Common::getRequestVar('token_auth', false) != Piwik::getCurrentUserTokenAuth()) { throw new Piwik_Access_NoAccessException(Piwik_TranslateException('General_ExceptionInvalidToken')); } } diff --git a/core/Cookie.php b/core/Cookie.php index 8165a6bc36..d68d97a28e 100644 --- a/core/Cookie.php +++ b/core/Cookie.php @@ -8,7 +8,7 @@ * @category Piwik * @package Piwik */ -use Piwik\Core\Piwik_Common; +use Piwik\Core\Common; /** * Simple class to handle the cookies: @@ -156,7 +156,7 @@ class Piwik_Cookie . (!$Secure ? '' : '; secure') . (!$HTTPOnly ? '' : '; HttpOnly'); - Piwik_Common::sendHeader($header, false); + Common::sendHeader($header, false); } /** @@ -164,7 +164,7 @@ class Piwik_Cookie */ protected function setP3PHeader() { - Piwik_Common::sendHeader("P3P: CP='OTI DSP COR NID STP UNI OTPa OUR'"); + Common::sendHeader("P3P: CP='OTI DSP COR NID STP UNI OTPa OUR'"); } /** @@ -204,7 +204,7 @@ class Piwik_Cookie { $signature = substr($content, -40); if (substr($content, -43, 3) == self::VALUE_SEPARATOR . '_=' && - $signature == sha1(substr($content, 0, -40) . Piwik_Common::getSalt()) + $signature == sha1(substr($content, 0, -40) . Common::getSalt()) ) { // strip trailing: VALUE_SEPARATOR '_=' signature" return substr($content, 0, -43); @@ -270,7 +270,7 @@ class Piwik_Cookie $cookieStr .= '_='; // sign cookie - $signature = sha1($cookieStr . Piwik_Common::getSalt()); + $signature = sha1($cookieStr . Common::getSalt()); return $cookieStr . $signature; } @@ -381,6 +381,6 @@ class Piwik_Cookie */ protected static function escapeValue($value) { - return Piwik_Common::sanitizeInputValues($value); + return Common::sanitizeInputValues($value); } } diff --git a/core/DataAccess/ArchiveSelector.php b/core/DataAccess/ArchiveSelector.php index 46b677d7e8..f0241bd06f 100644 --- a/core/DataAccess/ArchiveSelector.php +++ b/core/DataAccess/ArchiveSelector.php @@ -9,7 +9,7 @@ * @package Piwik */ use Piwik\Core\Piwik; -use Piwik\Core\Piwik_Common; +use Piwik\Core\Common; /** * Data Access object used to query archives @@ -200,7 +200,7 @@ class Piwik_DataAccess_ArchiveSelector static public function getArchiveData($archiveIds, $recordNames, $archiveDataType, $loadAllSubtables) { // create the SQL to select archive data - $inNames = Piwik_Common::getSqlStringFieldsArray($recordNames); + $inNames = Common::getSqlStringFieldsArray($recordNames); if ($loadAllSubtables) { $name = reset($recordNames); diff --git a/core/DataAccess/ArchiveTableCreator.php b/core/DataAccess/ArchiveTableCreator.php index e501a9b28a..cbcb25c8ac 100644 --- a/core/DataAccess/ArchiveTableCreator.php +++ b/core/DataAccess/ArchiveTableCreator.php @@ -1,6 +1,6 @@ <?php use Piwik\Core\Piwik; -use Piwik\Core\Piwik_Common; +use Piwik\Core\Common; /** * Piwik - Open source web analytics @@ -34,7 +34,7 @@ class Piwik_DataAccess_ArchiveTableCreator { $tableNamePrefix = "archive_" . $type; $tableName = $tableNamePrefix . "_" . $date->toString('Y_m'); - $tableName = Piwik_Common::prefixTable($tableName); + $tableName = Common::prefixTable($tableName); self::createArchiveTablesIfAbsent($tableName, $tableNamePrefix); return $tableName; } @@ -50,7 +50,7 @@ class Piwik_DataAccess_ArchiveTableCreator $sql = Piwik::getTableCreateSql($tableNamePrefix); // replace table name template by real name - $tableNamePrefix = Piwik_Common::prefixTable($tableNamePrefix); + $tableNamePrefix = Common::prefixTable($tableNamePrefix); $sql = str_replace($tableNamePrefix, $tableName, $sql); try { $db->query($sql); @@ -96,7 +96,7 @@ class Piwik_DataAccess_ArchiveTableCreator static public function getDateFromTableName($tableName) { - $tableName = Piwik_Common::unprefixTable($tableName); + $tableName = Common::unprefixTable($tableName); $date = str_replace(array('archive_numeric_', 'archive_blob_'), '', $tableName); return $date; } diff --git a/core/DataAccess/ArchiveWriter.php b/core/DataAccess/ArchiveWriter.php index 413f9d76eb..edf6c1ffac 100644 --- a/core/DataAccess/ArchiveWriter.php +++ b/core/DataAccess/ArchiveWriter.php @@ -10,7 +10,7 @@ */ use Piwik\Core\Config; use Piwik\Core\Piwik; -use Piwik\Core\Piwik_Common; +use Piwik\Core\Common; /** * This class is used to create a new Archive. @@ -78,7 +78,7 @@ class Piwik_DataAccess_ArchiveWriter $idSite = $this->idSite; $db = Zend_Registry::get('db'); - $locked = self::PREFIX_SQL_LOCK . Piwik_Common::generateUniqId(); + $locked = self::PREFIX_SQL_LOCK . Common::generateUniqId(); $date = date("Y-m-d H:i:s"); $dbLockName = "allocateNewArchiveId.$numericTable"; @@ -125,7 +125,7 @@ class Piwik_DataAccess_ArchiveWriter . $period->getId() . '/' . $period->getDateStart()->toString('Y-m-d') . ',' . $period->getDateEnd()->toString('Y-m-d'); - return $lockName . '/' . md5($lockName . Piwik_Common::getSalt()); + return $lockName . '/' . md5($lockName . Common::getSalt()); } public function finalizeArchive() diff --git a/core/DataAccess/LogAggregator.php b/core/DataAccess/LogAggregator.php index 2992aa203c..1378a59c3f 100644 --- a/core/DataAccess/LogAggregator.php +++ b/core/DataAccess/LogAggregator.php @@ -8,7 +8,7 @@ * @category Piwik * @package Piwik */ -use Piwik\Core\Piwik_Common; +use Piwik\Core\Common; /** * This class queries the Visitor logs tables (visits, actions, conversions, ecommerce) @@ -312,8 +312,8 @@ class Piwik_DataAccess_LogAggregator count(distinct idorder) as `" . Piwik_Metrics::INDEX_ECOMMERCE_ORDERS . "`, count(idvisit) as `" . Piwik_Metrics::INDEX_NB_VISITS . "`, case idorder when '0' then " . Piwik_Tracker_GoalManager::IDGOAL_CART . " else " . Piwik_Tracker_GoalManager::IDGOAL_ORDER . " end as ecommerceType - FROM " . Piwik_Common::prefixTable('log_conversion_item') . " - LEFT JOIN " . Piwik_Common::prefixTable('log_action') . " + FROM " . Common::prefixTable('log_conversion_item') . " + LEFT JOIN " . Common::prefixTable('log_action') . " ON $field = idaction WHERE server_time >= ? AND server_time <= ? diff --git a/core/DataTable/Renderer/Csv.php b/core/DataTable/Renderer/Csv.php index 555f35a71a..38c97fa2fc 100644 --- a/core/DataTable/Renderer/Csv.php +++ b/core/DataTable/Renderer/Csv.php @@ -9,7 +9,7 @@ * @package Piwik */ use Piwik\Core\Piwik; -use Piwik\Core\Piwik_Common; +use Piwik\Core\Common; /** * CSV export @@ -345,8 +345,8 @@ class Piwik_DataTable_Renderer_Csv extends Piwik_DataTable_Renderer { $fileName = 'Piwik ' . Piwik_Translate('General_Export'); - $period = Piwik_Common::getRequestVar('period', false); - $date = Piwik_Common::getRequestVar('date', false); + $period = Common::getRequestVar('period', false); + $date = Common::getRequestVar('date', false); if ($period || $date) // in test cases, there are no request params set { if ($period == 'range') { diff --git a/core/DataTable/Renderer/Json.php b/core/DataTable/Renderer/Json.php index 6d815ea4bc..2d408d7fda 100644 --- a/core/DataTable/Renderer/Json.php +++ b/core/DataTable/Renderer/Json.php @@ -9,7 +9,7 @@ * @package Piwik */ use Piwik\Core\Piwik; -use Piwik\Core\Piwik_Common; +use Piwik\Core\Common; /** * JSON export. @@ -77,7 +77,7 @@ class Piwik_DataTable_Renderer_Json extends Piwik_DataTable_Renderer $callback = create_function('&$value,$key', 'if(is_string($value)){$value = html_entity_decode($value, ENT_QUOTES, "UTF-8");}'); array_walk_recursive($array, $callback); - $str = Piwik_Common::json_encode($array); + $str = Common::json_encode($array); return $this->jsonpWrap($str); } @@ -88,8 +88,8 @@ class Piwik_DataTable_Renderer_Json extends Piwik_DataTable_Renderer */ protected function jsonpWrap($str) { - if (($jsonCallback = Piwik_Common::getRequestVar('callback', false)) === false) - $jsonCallback = Piwik_Common::getRequestVar('jsoncallback', false); + if (($jsonCallback = Common::getRequestVar('callback', false)) === false) + $jsonCallback = Common::getRequestVar('jsoncallback', false); if ($jsonCallback !== false) { if (preg_match('/^[0-9a-zA-Z_]*$/D', $jsonCallback) > 0) { $str = $jsonCallback . "(" . $str . ")"; diff --git a/core/DataTable/Renderer/Rss.php b/core/DataTable/Renderer/Rss.php index 4ea2c0453c..662ad0ad82 100644 --- a/core/DataTable/Renderer/Rss.php +++ b/core/DataTable/Renderer/Rss.php @@ -8,7 +8,7 @@ * @category Piwik * @package Piwik */ -use Piwik\Core\Piwik_Common; +use Piwik\Core\Common; /** * RSS Feed. @@ -59,8 +59,8 @@ class Piwik_DataTable_Renderer_Rss extends Piwik_DataTable_Renderer "\nPlease specify only one idSite or consider using &format=XML instead."); } - $idSite = Piwik_Common::getRequestVar('idSite', 1, 'int'); - $period = Piwik_Common::getRequestVar('period'); + $idSite = Common::getRequestVar('idSite', 1, 'int'); + $period = Common::getRequestVar('period'); $piwikUrl = Piwik_Url::getCurrentUrlWithoutFileName() . "?module=CoreHome&action=index&idSite=" . $idSite . "&period=" . $period; @@ -73,7 +73,7 @@ class Piwik_DataTable_Renderer_Rss extends Piwik_DataTable_Renderer $pudDate = date('r', $timestamp); $dateInSiteTimezone = Piwik_Date::factory($timestamp)->setTimezone($site->getTimezone())->toString('Y-m-d'); - $thisPiwikUrl = Piwik_Common::sanitizeInputValue($piwikUrl . "&date=$dateInSiteTimezone"); + $thisPiwikUrl = Common::sanitizeInputValue($piwikUrl . "&date=$dateInSiteTimezone"); $siteName = $site->getName(); $title = $siteName . " on " . $date; @@ -85,7 +85,7 @@ class Piwik_DataTable_Renderer_Rss extends Piwik_DataTable_Renderer <author>http://piwik.org</author> <description>"; - $out .= Piwik_Common::sanitizeInputValue($this->renderDataTable($subtable)); + $out .= Common::sanitizeInputValue($this->renderDataTable($subtable)); $out .= "</description>\n\t</item>\n"; } diff --git a/core/Db/Schema/Myisam.php b/core/Db/Schema/Myisam.php index c8d6d9a040..1758ee384b 100644 --- a/core/Db/Schema/Myisam.php +++ b/core/Db/Schema/Myisam.php @@ -10,7 +10,7 @@ */ use Piwik\Core\Config; use Piwik\Core\Piwik; -use Piwik\Core\Piwik_Common; +use Piwik\Core\Common; /** * MySQL schema @@ -534,7 +534,7 @@ class Piwik_Db_Schema_Myisam implements Piwik_Db_Schema_Interface // The anonymous user is the user that is assigned by default // note that the token_auth value is anonymous, which is assigned by default as well in the Login plugin $db = Zend_Registry::get('db'); - $db->query("INSERT INTO " . Piwik_Common::prefixTable("user") . " + $db->query("INSERT INTO " . Common::prefixTable("user") . " VALUES ( 'anonymous', '', 'anonymous', 'anonymous@example.org', 'anonymous', '" . Piwik_Date::factory('now')->getDatetime() . "' );"); } diff --git a/core/FrontController.php b/core/FrontController.php index c201546ed7..6836578670 100644 --- a/core/FrontController.php +++ b/core/FrontController.php @@ -10,7 +10,7 @@ */ use Piwik\Core\Config; use Piwik\Core\Piwik; -use Piwik\Core\Piwik_Common; +use Piwik\Core\Common; /** * @see core/PluginsManager.php @@ -74,11 +74,11 @@ class Piwik_FrontController if (is_null($module)) { $defaultModule = 'CoreHome'; - $module = Piwik_Common::getRequestVar('module', $defaultModule, 'string'); + $module = Common::getRequestVar('module', $defaultModule, 'string'); } if (is_null($action)) { - $action = Piwik_Common::getRequestVar('action', false); + $action = Common::getRequestVar('action', false); } if (!Piwik_Session::isFileBasedSessions() @@ -130,7 +130,7 @@ class Piwik_FrontController Piwik_PostEvent('FrontController.NoAccessException', array($e), $pending = true); } catch (Exception $e) { $debugTrace = $e->getTraceAsString(); - $message = Piwik_Common::sanitizeInputValue($e->getMessage()); + $message = Common::sanitizeInputValue($e->getMessage()); Piwik_ExitWithMessage($message, '' /* $debugTrace */, true); } } @@ -178,8 +178,8 @@ class Piwik_FrontController // which load the HTML page of the installer with the error. // This is at least required for misc/cron/archive.php and useful to all other scripts return (defined('PIWIK_ENABLE_DISPATCH') && !PIWIK_ENABLE_DISPATCH) - || Piwik_Common::isPhpCliMode() - || Piwik_Common::isArchivePhpTriggered(); + || Common::isPhpCliMode() + || Common::isArchivePhpTriggered(); } /** @@ -232,7 +232,7 @@ class Piwik_FrontController ); Piwik::dieIfDirectoriesNotWritable($directoriesToCheck); - Piwik_Common::assignCliParametersToRequest(); + Common::assignCliParametersToRequest(); Piwik_Translate::getInstance()->loadEnglishTranslation(); @@ -292,7 +292,7 @@ class Piwik_FrontController // Force the auth to use the token_auth if specified, so that embed dashboard // and all other non widgetized controller methods works fine - if (($token_auth = Piwik_Common::getRequestVar('token_auth', false, 'string')) !== false) { + if (($token_auth = Common::getRequestVar('token_auth', false, 'string')) !== false) { Piwik_API_Request::reloadAuthUsingTokenAuth(); } Piwik::raiseMemoryLimitIfNecessary(); @@ -315,9 +315,9 @@ class Piwik_FrontController protected function handleMaintenanceMode() { if (Config::getInstance()->General['maintenance_mode'] == 1 - && !Piwik_Common::isPhpCliMode() + && !Common::isPhpCliMode() ) { - $format = Piwik_Common::getRequestVar('format', ''); + $format = Common::getRequestVar('format', ''); $message = "Piwik is in scheduled maintenance. Please come back later." . " The administrator can disable maintenance by editing the file piwik/config/config.ini.php and removing the following: " @@ -340,12 +340,12 @@ class Piwik_FrontController protected function handleSSLRedirection() { - if (!Piwik_Common::isPhpCliMode() + if (!Common::isPhpCliMode() && Config::getInstance()->General['force_ssl'] == 1 && !Piwik::isHttps() // Specifically disable for the opt out iframe - && !(Piwik_Common::getRequestVar('module', '') == 'CoreAdminHome' - && Piwik_Common::getRequestVar('action', '') == 'optOut') + && !(Common::getRequestVar('module', '') == 'CoreAdminHome' + && Common::getRequestVar('action', '') == 'optOut') ) { $url = Piwik_Url::getCurrentUrl(); $url = str_replace("http://", "https://", $url); diff --git a/core/Http.php b/core/Http.php index 60f8ea6e65..cc536477f2 100644 --- a/core/Http.php +++ b/core/Http.php @@ -10,7 +10,7 @@ */ use Piwik\Core\Config; use Piwik\Core\Piwik; -use Piwik\Core\Piwik_Common; +use Piwik\Core\Common; /** * Server-side http client to retrieve content from remote servers, and optionally save to a local file. @@ -75,7 +75,7 @@ class Piwik_Http $file = null; if ($destinationPath) { // Ensure destination directory exists - Piwik_Common::mkdir(dirname($destinationPath)); + Common::mkdir(dirname($destinationPath)); if (($file = @fopen($destinationPath, 'wb')) === false || !is_resource($file)) { throw new Exception('Error while creating the file: ' . $destinationPath); } @@ -338,7 +338,7 @@ class Piwik_Http throw new Exception('Timed out waiting for server response'); } - $fileLength += Piwik_Common::strlen($line); + $fileLength += Common::strlen($line); if (is_resource($file)) { // save to file @@ -390,13 +390,13 @@ class Piwik_Http $handle = fopen($aUrl, 'rb', false, $ctx); while (!feof($handle)) { $response = fread($handle, 8192); - $fileLength += Piwik_Common::strlen($response); + $fileLength += Common::strlen($response); fwrite($file, $response); } fclose($handle); } else { $response = file_get_contents($aUrl, 0, $ctx); - $fileLength = Piwik_Common::strlen($response); + $fileLength = Common::strlen($response); } // restore the socket_timeout value @@ -498,7 +498,7 @@ class Piwik_Http } $contentLength = @curl_getinfo($ch, CURLINFO_CONTENT_LENGTH_DOWNLOAD); - $fileLength = is_resource($file) ? @curl_getinfo($ch, CURLINFO_SIZE_DOWNLOAD) : Piwik_Common::strlen($response); + $fileLength = is_resource($file) ? @curl_getinfo($ch, CURLINFO_SIZE_DOWNLOAD) : Common::strlen($response); $status = @curl_getinfo($ch, CURLINFO_HTTP_CODE); @curl_close($ch); diff --git a/core/IP.php b/core/IP.php index 3e528eb628..64ca6072ff 100644 --- a/core/IP.php +++ b/core/IP.php @@ -10,9 +10,9 @@ */ use Piwik\Core\Config; -use Piwik\Core\Piwik_Common; +use Piwik\Core\Common; -if (Piwik_Common::isWindows() || !function_exists('inet_ntop')) { +if (Common::isWindows() || !function_exists('inet_ntop')) { function _inet_ntop($in_addr) { return php_compat_inet_ntop($in_addr); @@ -23,7 +23,7 @@ if (Piwik_Common::isWindows() || !function_exists('inet_ntop')) { return inet_ntop($in_addr); } } -if (Piwik_Common::isWindows() || !function_exists('inet_pton')) { +if (Common::isWindows() || !function_exists('inet_pton')) { function _inet_pton($address) { return php_compat_inet_pton($address); @@ -137,7 +137,7 @@ class Piwik_IP if (($ip = @_inet_pton($ipRangeString)) === false) return false; - $maxbits = Piwik_Common::strlen($ip) * 8; + $maxbits = Common::strlen($ip) * 8; if (!isset($bits)) $bits = $maxbits; @@ -230,17 +230,17 @@ class Piwik_IP public static function long2ip($ip) { // IPv4 - if (Piwik_Common::strlen($ip) == 4) { + if (Common::strlen($ip) == 4) { return self::N2P($ip); } // IPv6 - transitional address? - if (Piwik_Common::strlen($ip) == 16) { + if (Common::strlen($ip) == 16) { if (substr_compare($ip, "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff", 0, 12) === 0 || substr_compare($ip, "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", 0, 12) === 0 ) { // remap 128-bit IPv4-mapped and IPv4-compat addresses - return self::N2P(Piwik_Common::substr($ip, 12)); + return self::N2P(Common::substr($ip, 12)); } } @@ -298,7 +298,7 @@ class Piwik_IP return false; } - $lowLen = Piwik_Common::strlen($low); + $lowLen = Common::strlen($low); $i = $lowLen - 1; $bits = $lowLen * 8 - $bits; @@ -327,7 +327,7 @@ class Piwik_IP */ public static function isIpInRange($ip, $ipRanges) { - $ipLen = Piwik_Common::strlen($ip); + $ipLen = Common::strlen($ip); if (empty($ip) || empty($ipRanges) || ($ipLen != 4 && $ipLen != 16)) { return false; } @@ -347,7 +347,7 @@ class Piwik_IP $low = $range[0]; $high = $range[1]; - if (Piwik_Common::strlen($low) != $ipLen) { + if (Common::strlen($low) != $ipLen) { continue; } @@ -423,13 +423,13 @@ class Piwik_IP if ($p !== false) { $elements = explode(',', $csv); for ($i = count($elements); $i--;) { - $element = trim(Piwik_Common::sanitizeInputValue($elements[$i])); + $element = trim(Common::sanitizeInputValue($elements[$i])); if (empty($excludedIps) || (!in_array($element, $excludedIps) && !self::isIpInRange(self::P2N(self::sanitizeIp($element)), $excludedIps))) { return $element; } } } - return trim(Piwik_Common::sanitizeInputValue($csv)); + return trim(Common::sanitizeInputValue($csv)); } /** @@ -460,7 +460,7 @@ function php_compat_inet_ntop($in_addr) { $r = bin2hex($in_addr); - switch (Piwik_Common::strlen($in_addr)) { + switch (Common::strlen($in_addr)) { case 4: // IPv4 address $prefix = ''; diff --git a/core/Log.php b/core/Log.php index 2707b4a19c..6f0dee2047 100644 --- a/core/Log.php +++ b/core/Log.php @@ -9,7 +9,7 @@ * @package Piwik */ use Piwik\Core\Config; -use Piwik\Core\Piwik_Common; +use Piwik\Core\Common; /** * @@ -35,7 +35,7 @@ abstract class Piwik_Log extends Zend_Log { parent::__construct(); - $this->currentRequestKey = substr(Piwik_Common::generateUniqId(), 0, 8); + $this->currentRequestKey = substr(Common::generateUniqId(), 0, 8); $log_dir = Config::getInstance()->log['logger_file_path']; if ($log_dir[0] != '/' && $log_dir[0] != DIRECTORY_SEPARATOR) { @@ -45,13 +45,13 @@ abstract class Piwik_Log extends Zend_Log $this->fileFormatter = $fileFormatter; $this->screenFormatter = $screenFormatter; - $this->logToDatabaseTableName = Piwik_Common::prefixTable($logToDatabaseTableName); + $this->logToDatabaseTableName = Common::prefixTable($logToDatabaseTableName); $this->logToDatabaseColumnMapping = $logToDatabaseColumnMapping; } function addWriteToFile() { - Piwik_Common::mkdir(dirname($this->logToFileFilename)); + Common::mkdir(dirname($this->logToFileFilename)); $writerFile = new Zend_Log_Writer_Stream($this->logToFileFilename); $writerFile->setFormatter($this->fileFormatter); $this->addWriter($writerFile); @@ -176,7 +176,7 @@ class Piwik_Log_Formatter_ScreenFormatter implements Zend_Log_Formatter_Interfac function formatEvent($event) { // no injection in error messages, backtrace when displayed on screen - return array_map(array('Piwik\Core\Piwik_Common', 'sanitizeInputValue'), $event); + return array_map(array('Piwik\Core\Common', 'sanitizeInputValue'), $event); } function format($string) @@ -186,7 +186,7 @@ class Piwik_Log_Formatter_ScreenFormatter implements Zend_Log_Formatter_Interfac static public function getFormattedString($string) { - if (!Piwik_Common::isPhpCliMode()) { + if (!Common::isPhpCliMode()) { @header('Content-Type: text/html; charset=utf-8'); } return $string; diff --git a/core/Log/Exception.php b/core/Log/Exception.php index 2865ad74a3..b86a3dd6c7 100644 --- a/core/Log/Exception.php +++ b/core/Log/Exception.php @@ -8,7 +8,7 @@ * @category Piwik * @package Piwik */ -use Piwik\Core\Piwik_Common; +use Piwik\Core\Common; /** * Class used to log an exception event. @@ -94,7 +94,7 @@ class Piwik_Log_Exception_Formatter_ScreenFormatter extends Piwik_Log_Formatter_ $event = parent::formatEvent($event); $errstr = $event['message']; - $outputFormat = strtolower(Piwik_Common::getRequestVar('format', 'html', 'string')); + $outputFormat = strtolower(Common::getRequestVar('format', 'html', 'string')); $response = new Piwik_API_ResponseBuilder($outputFormat); $message = $response->getResponseException(new Exception($errstr)); return parent::format($message); diff --git a/core/Log/Message.php b/core/Log/Message.php index 6852f572c0..cc425116be 100644 --- a/core/Log/Message.php +++ b/core/Log/Message.php @@ -9,7 +9,7 @@ * @package Piwik */ use Piwik\Core\Piwik; -use Piwik\Core\Piwik_Common; +use Piwik\Core\Common; /** * Class used to log a standard message event. @@ -77,14 +77,14 @@ class Piwik_Log_Message_Formatter_ScreenFormatter extends Piwik_Log_Formatter_Sc } else { $message = $event['message']; } - if (!Piwik_Common::isPhpCliMode()) { + if (!Common::isPhpCliMode()) { $message .= "<br/>"; } $message .= "\n"; $memory = ''; // Hacky: let's hide the memory usage in CLI to hide from the archive.php output - if (!Piwik_Common::isPhpCliMode()) { + if (!Common::isPhpCliMode()) { $memory = '[' . Piwik::getMemoryUsage() . '] '; } $message = '[' . $event['timestamp'] . '] [' . $event['requestKey'] . '] ' . $memory . $message; diff --git a/core/Menu/Abstract.php b/core/Menu/Abstract.php index 1547a27eae..35e677875d 100644 --- a/core/Menu/Abstract.php +++ b/core/Menu/Abstract.php @@ -8,7 +8,7 @@ * @category Piwik * @package Piwik_Menu */ -use Piwik\Core\Piwik_Common; +use Piwik\Core\Common; /** * @package Piwik_Menu @@ -56,7 +56,7 @@ abstract class Piwik_Menu_Abstract { if ($displayedForCurrentUser) { // make sure the idSite value used is numeric (hack-y fix for #3426) - if (!is_numeric(Piwik_Common::getRequestVar('idSite', false))) { + if (!is_numeric(Common::getRequestVar('idSite', false))) { $idSites = Piwik_SitesManager_API::getInstance()->getSitesIdWithAtLeastViewAccess(); $url['idSite'] = reset($idSites); } diff --git a/core/Nonce.php b/core/Nonce.php index 4cb6b440d6..49f52a29b5 100644 --- a/core/Nonce.php +++ b/core/Nonce.php @@ -8,7 +8,7 @@ * @category Piwik * @package Piwik */ -use Piwik\Core\Piwik_Common; +use Piwik\Core\Common; /** * Nonce class. @@ -42,7 +42,7 @@ class Piwik_Nonce // to handle browser pre-fetch or double fetch caused by some browser add-ons/extensions if (empty($nonce)) { // generate a new nonce - $nonce = md5(Piwik_Common::getSalt() . time() . Piwik_Common::generateUniqId()); + $nonce = md5(Common::getSalt() . time() . Common::generateUniqId()); $ns->nonce = $nonce; $ns->setExpirationSeconds($ttl, 'nonce'); } diff --git a/core/Option.php b/core/Option.php index 179e25c23c..424d9e1a05 100644 --- a/core/Option.php +++ b/core/Option.php @@ -8,7 +8,7 @@ * @category Piwik * @package Piwik */ -use Piwik\Core\Piwik_Common; +use Piwik\Core\Common; /** * Piwik_Option provides a very simple mechanism to save/retrieve key-values pair @@ -69,7 +69,7 @@ class Piwik_Option return $this->all[$name]; } $value = Piwik_FetchOne('SELECT option_value ' . - 'FROM `' . Piwik_Common::prefixTable('option') . '`' . + 'FROM `' . Common::prefixTable('option') . '`' . 'WHERE option_name = ?', $name); if ($value === false) { return false; @@ -88,7 +88,7 @@ class Piwik_Option public function set($name, $value, $autoLoad = 0) { $autoLoad = (int)$autoLoad; - Piwik_Query('INSERT INTO `' . Piwik_Common::prefixTable('option') . '` (option_name, option_value, autoload) ' . + Piwik_Query('INSERT INTO `' . Common::prefixTable('option') . '` (option_name, option_value, autoload) ' . ' VALUES (?, ?, ?) ' . ' ON DUPLICATE KEY UPDATE option_value = ?', array($name, $value, $autoLoad, $value)); @@ -103,7 +103,7 @@ class Piwik_Option */ public function delete($name, $value = null) { - $sql = 'DELETE FROM `' . Piwik_Common::prefixTable('option') . '` WHERE option_name = ?'; + $sql = 'DELETE FROM `' . Common::prefixTable('option') . '` WHERE option_name = ?'; $bind[] = $name; if (isset($value)) { @@ -125,7 +125,7 @@ class Piwik_Option */ public function deleteLike($name, $value = null) { - $sql = 'DELETE FROM `' . Piwik_Common::prefixTable('option') . '` WHERE option_name LIKE ?'; + $sql = 'DELETE FROM `' . Common::prefixTable('option') . '` WHERE option_name LIKE ?'; $bind[] = $name; if (isset($value)) { @@ -150,7 +150,7 @@ class Piwik_Option } $all = Piwik_FetchAll('SELECT option_value, option_name - FROM `' . Piwik_Common::prefixTable('option') . '` + FROM `' . Common::prefixTable('option') . '` WHERE autoload = 1'); foreach ($all as $option) { $this->all[$option['option_name']] = $option['option_value']; diff --git a/core/Period/Range.php b/core/Period/Range.php index e126ec835b..f23e3dce69 100644 --- a/core/Period/Range.php +++ b/core/Period/Range.php @@ -8,7 +8,7 @@ * @category Piwik * @package Piwik */ -use Piwik\Core\Piwik_Common; +use Piwik\Core\Common; /** * from a starting date to an ending date @@ -356,11 +356,11 @@ class Piwik_Period_Range extends Piwik_Period public static function getLastDate($date = false, $period = false) { if ($date === false) { - $date = Piwik_Common::getRequestVar('date'); + $date = Common::getRequestVar('date'); } if ($period === false) { - $period = Piwik_Common::getRequestVar('period'); + $period = Common::getRequestVar('period'); } // can't get the last date for range periods & dates that use lastN/previousN diff --git a/core/Piwik.php b/core/Piwik.php index b377cd54a7..6f9ceb3bce 100644 --- a/core/Piwik.php +++ b/core/Piwik.php @@ -16,7 +16,7 @@ use Piwik\Core\Config; use Piwik_Access; use Piwik_Access_NoAccessException; use Piwik_AssetManager; -use Piwik\Core\Piwik_Common; +use Piwik\Core\Common; use Piwik_Db_Adapter; use Piwik_Db_Schema; use Piwik_Log_APICall; @@ -118,10 +118,10 @@ class Piwik */ static public function prefixClass($class) { - if (!strncmp($class, Piwik_Common::CLASSES_PREFIX, strlen(Piwik_Common::CLASSES_PREFIX))) { + if (!strncmp($class, Common::CLASSES_PREFIX, strlen(Common::CLASSES_PREFIX))) { return $class; } - return Piwik_Common::CLASSES_PREFIX . $class; + return Common::CLASSES_PREFIX . $class; } /** @@ -184,15 +184,15 @@ class Piwik $key = 'piwikUrl'; $url = Piwik_GetOption($key); - if (Piwik_Common::isPhpCliMode() + if (Common::isPhpCliMode() // in case archive.php is triggered with domain localhost - || Piwik_Common::isArchivePhpTriggered() + || Common::isArchivePhpTriggered() || defined('PIWIK_MODE_ARCHIVE') ) { return $url; } - $currentUrl = Piwik_Common::sanitizeInputValue(Piwik_Url::getCurrentUrlWithoutFileName()); + $currentUrl = Common::sanitizeInputValue(Piwik_Url::getCurrentUrlWithoutFileName()); if (empty($url) // if URL changes, always update the cache @@ -272,7 +272,7 @@ class Piwik static public function copyRecursive($source, $target, $excludePhp = false) { if (is_dir($source)) { - Piwik_Common::mkdir($target, false); + Common::mkdir($target, false); $d = dir($source); while (false !== ($entry = $d->read())) { if ($entry == '.' || $entry == '..') { @@ -317,7 +317,7 @@ class Piwik @chmod($dest, 0755); if (!@copy($source, $dest)) { $message = "Error while creating/copying file to <code>$dest</code>. <br />" - . self::getErrorMessageMissingPermissions(Piwik_Common::getPathToPiwikRoot()); + . self::getErrorMessageMissingPermissions(Common::getPathToPiwikRoot()); throw new Exception($message); } } @@ -334,7 +334,7 @@ class Piwik { $message = "Please check that the web server has enough permission to write to these files/directories:<br />"; - if (Piwik_Common::isWindows()) { + if (Common::isWindows()) { $message .= "On Windows, check that the folder is not read only and is writable. You can try to execute:<br />"; } else { @@ -406,7 +406,7 @@ class Piwik */ static private function getMakeWritableCommand($realpath) { - if (Piwik_Common::isWindows()) { + if (Common::isWindows()) { return "<code>cacls $realpath /t /g " . get_current_user() . ":f</code><br />"; } return "<code>chmod -R 0755 $realpath</code><br />"; @@ -427,15 +427,15 @@ class Piwik $directoryList = ''; foreach ($resultCheck as $dir => $bool) { - $realpath = Piwik_Common::realpath($dir); + $realpath = Common::realpath($dir); if (!empty($realpath) && $bool === false) { $directoryList .= self::getMakeWritableCommand($realpath); } } // Also give the chown since the chmod is only 755 - if (!Piwik_Common::isWindows()) { - $realpath = Piwik_Common::realpath(PIWIK_INCLUDE_PATH . '/'); + if (!Common::isWindows()) { + $realpath = Common::realpath(PIWIK_INCLUDE_PATH . '/'); $directoryList = "<code>chown -R www-data:www-data " . $realpath . "</code><br/>" . $directoryList; } @@ -467,10 +467,10 @@ class Piwik // Create an empty directory $isFile = strpos($directoryToCheck, '.') !== false; if (!$isFile && !file_exists($directoryToCheck)) { - Piwik_Common::mkdir($directoryToCheck); + Common::mkdir($directoryToCheck); } - $directory = Piwik_Common::realpath($directoryToCheck); + $directory = Common::realpath($directoryToCheck); $resultCheck[$directory] = false; if ($directory !== false // realpath() returns FALSE on failure && is_writable($directoryToCheck) @@ -506,7 +506,7 @@ class Piwik */ static public function getAutoUpdateMakeWritableMessage() { - $realpath = Piwik_Common::realpath(PIWIK_INCLUDE_PATH . '/'); + $realpath = Common::realpath(PIWIK_INCLUDE_PATH . '/'); $message = ''; $message .= "<code>chown -R www-data:www-data " . $realpath . "</code><br />"; $message .= "<code>chmod -R 0755 " . $realpath . "</code><br />"; @@ -545,7 +545,7 @@ class Piwik '/tmp', ); foreach ($directoriesToProtect as $directoryToProtect) { - Piwik_Common::createHtAccess(PIWIK_INCLUDE_PATH . $directoryToProtect, $overwrite = true); + Common::createHtAccess(PIWIK_INCLUDE_PATH . $directoryToProtect, $overwrite = true); } // Allow/Deny lives in different modules depending on the Apache version @@ -565,7 +565,7 @@ class Piwik '/misc/user' => $denyDirectPhp . $allowStaticAssets, ); foreach ($directoriesToProtect as $directoryToProtect => $content) { - Piwik_Common::createHtAccess(PIWIK_INCLUDE_PATH . $directoryToProtect, $overwrite = true, $content); + Common::createHtAccess(PIWIK_INCLUDE_PATH . $directoryToProtect, $overwrite = true, $content); } } @@ -971,7 +971,7 @@ class Piwik } $minimumMemoryLimit = Config::getInstance()->General['minimum_memory_limit']; - if (Piwik_Common::isArchivePhpTriggered() + if (Common::isArchivePhpTriggered() && Piwik::isUserIsSuperUser() ) { // archive.php: no time limit, high memory limit @@ -1024,7 +1024,7 @@ class Piwik static public function shouldLoggerLog() { try { - $shouldLog = (Piwik_Common::isPhpCliMode() + $shouldLog = (Common::isPhpCliMode() || Config::getInstance()->log['log_only_when_cli'] == 0) && (Config::getInstance()->log['log_only_when_debug_parameter'] == 0 @@ -1115,7 +1115,7 @@ class Piwik if (is_null($db)) { $db = Piwik_Tracker::getDatabase(); } - $tableName = Piwik_Common::prefixTable('log_profiling'); + $tableName = Common::prefixTable('log_profiling'); $all = $db->fetchAll('SELECT * FROM ' . $tableName); if ($all === false) { @@ -1499,7 +1499,7 @@ class Piwik preg_match('~^(http|https)://(.*)$~D', $piwikUrl, $matches); $piwikUrl = @$matches[2]; $jsCode = str_replace('{$idSite}', $idSite, $jsCode); - $jsCode = str_replace('{$piwikUrl}', Piwik_Common::sanitizeInputValue($piwikUrl), $jsCode); + $jsCode = str_replace('{$piwikUrl}', Common::sanitizeInputValue($piwikUrl), $jsCode); return $jsCode; } @@ -1854,7 +1854,7 @@ class Piwik */ static public function getModule() { - return Piwik_Common::getRequestVar('module', '', 'string'); + return Common::getRequestVar('module', '', 'string'); } /** @@ -1864,7 +1864,7 @@ class Piwik */ static public function getAction() { - return Piwik_Common::getRequestVar('action', '', 'string'); + return Common::getRequestVar('action', '', 'string'); } /** @@ -2229,7 +2229,7 @@ class Piwik static public function createTableFromCSVFile($tableName, $fields, $filePath, $fileSpec) { // On Windows, MySQL expects forward slashes as directory separators - if (Piwik_Common::isWindows()) { + if (Common::isWindows()) { $filePath = str_replace('\\', '/', $filePath); } @@ -2320,7 +2320,7 @@ class Piwik */ static public function tableInsertBatch($tableName, $fields, $values, $throwException = false) { - $filePath = PIWIK_USER_PATH . '/' . Piwik_AssetManager::MERGED_FILE_DIR . $tableName . '-' . Piwik_Common::generateUniqId() . '.csv'; + $filePath = PIWIK_USER_PATH . '/' . Piwik_AssetManager::MERGED_FILE_DIR . $tableName . '-' . Common::generateUniqId() . '.csv'; if (Zend_Registry::get('db')->hasBulkLoader()) { try { @@ -2385,7 +2385,7 @@ class Piwik $query = "INSERT $ignore INTO " . $tableName . " $fieldList - VALUES (" . Piwik_Common::getSqlStringFieldsArray($row) . ")"; + VALUES (" . Common::getSqlStringFieldsArray($row) . ")"; Piwik_Query($query, $row); } } @@ -2408,7 +2408,7 @@ class Piwik { if (is_null(self::$lockPrivilegeGranted)) { try { - Piwik_LockTables(Piwik_Common::prefixTable('log_visit')); + Piwik_LockTables(Common::prefixTable('log_visit')); Piwik_UnlockAllTables(); self::$lockPrivilegeGranted = true; diff --git a/core/Plugin.php b/core/Plugin.php index 582bb7ff51..51a21b6049 100644 --- a/core/Plugin.php +++ b/core/Plugin.php @@ -8,7 +8,7 @@ * @category Piwik * @package Piwik */ -use Piwik\Core\Piwik_Common; +use Piwik\Core\Common; /** * @see core/Plugin/MetadataLoader.php @@ -46,7 +46,7 @@ class Piwik_Plugin public function __construct($pluginName = false) { if (empty($pluginName)) { - $pluginName = Piwik_Common::unprefixClass(get_class($this)); + $pluginName = Common::unprefixClass(get_class($this)); } $this->pluginName = $pluginName; diff --git a/core/Plugin/MetadataLoader.php b/core/Plugin/MetadataLoader.php index e96ce56ec4..5b514b8610 100644 --- a/core/Plugin/MetadataLoader.php +++ b/core/Plugin/MetadataLoader.php @@ -8,7 +8,7 @@ * @category Piwik * @package Piwik */ -use Piwik\Core\Piwik_Common; +use Piwik\Core\Common; /** * @see core/Version.php @@ -132,7 +132,7 @@ class Piwik_Plugin_MetadataLoader return array(); } - $info = Piwik_Common::json_decode($json, $assoc = true); + $info = Common::json_decode($json, $assoc = true); if (!is_array($info) || empty($info) ) { diff --git a/core/PluginsArchiver.php b/core/PluginsArchiver.php index f568ac5459..ad0579e332 100644 --- a/core/PluginsArchiver.php +++ b/core/PluginsArchiver.php @@ -10,7 +10,7 @@ * @package Piwik_PluginArchiver */ use Piwik\Core\Config; -use Piwik\Core\Piwik_Common; +use Piwik\Core\Common; /** * Plugins that archive metrics for websites can implement an Archiver that extends this class @@ -32,7 +32,7 @@ abstract class Piwik_PluginsArchiver // todo: review this concept, each plugin should somehow maintain the list of report names they generate public function shouldArchive() { - $pluginName = Piwik_Common::unprefixClass(get_class($this)); + $pluginName = Common::unprefixClass(get_class($this)); $pluginName = str_replace("_Archiver", "", $pluginName); return $this->getProcessor()->shouldProcessReportsForPlugin($pluginName); } diff --git a/core/PluginsManager.php b/core/PluginsManager.php index 0d03e46078..ffad1670c2 100644 --- a/core/PluginsManager.php +++ b/core/PluginsManager.php @@ -10,7 +10,7 @@ */ use Piwik\Core\Config; use Piwik\Core\Piwik; -use Piwik\Core\Piwik_Common; +use Piwik\Core\Common; /** * @see core/Menu/Abstract.php @@ -320,7 +320,7 @@ class Piwik_PluginsManager { $existingPlugins = $this->readPluginsDirectory(); $isPluginInFilesystem = array_search($pluginName, $existingPlugins) !== false; - return Piwik_Common::isValidFilename($pluginName) + return Common::isValidFilename($pluginName) && $isPluginInFilesystem; } @@ -496,7 +496,7 @@ class Piwik_PluginsManager $pluginFileName = sprintf("%s/%s.php", $pluginName, $pluginName); $pluginClassName = sprintf('Piwik_%s', $pluginName); - if (!Piwik_Common::isValidFilename($pluginName)) { + if (!Common::isValidFilename($pluginName)) { throw new Exception(sprintf("The plugin filename '%s' is not a valid filename", $pluginFileName)); } diff --git a/core/ProxyHeaders.php b/core/ProxyHeaders.php index 4cd540e4da..ae319b986d 100644 --- a/core/ProxyHeaders.php +++ b/core/ProxyHeaders.php @@ -8,7 +8,7 @@ * @category Piwik * @package Piwik */ -use Piwik\Core\Piwik_Common; +use Piwik\Core\Common; /** * Proxy headers @@ -24,7 +24,7 @@ class Piwik_ProxyHeaders */ public static function getProtocolInformation() { - if (Piwik_Common::getRequestVar('clientProtocol', 'http', 'string') == 'https') { + if (Common::getRequestVar('clientProtocol', 'http', 'string') == 'https') { return 'https'; } diff --git a/core/ReportRenderer/Pdf.php b/core/ReportRenderer/Pdf.php index 85a3c9dbda..2b20ecb169 100644 --- a/core/ReportRenderer/Pdf.php +++ b/core/ReportRenderer/Pdf.php @@ -8,7 +8,7 @@ * @category Piwik * @package Piwik_ReportRenderer */ -use Piwik\Core\Piwik_Common; +use Piwik\Core\Common; /** * @see libs/tcpdf @@ -314,7 +314,7 @@ class Piwik_ReportRenderer_Pdf extends Piwik_ReportRenderer private function formatText($text) { - return Piwik_Common::unsanitizeInputValue($text); + return Common::unsanitizeInputValue($text); } private function paintReportTable() @@ -373,7 +373,7 @@ class Piwik_ReportRenderer_Pdf extends Piwik_ReportRenderer if ($logoHeight < 16) { $topMargin = 2; } - $path = Piwik_Common::getPathToPiwikRoot() . "/" . $rowMetadata['logo']; + $path = Common::getPathToPiwikRoot() . "/" . $rowMetadata['logo']; if (file_exists($path)) { $this->TCPDF->Image($path, $posX + ($leftMargin = 2), $posY + $topMargin, $logoWidth / 4); } diff --git a/core/Segment.php b/core/Segment.php index f4a2be255e..1e2da61f2d 100644 --- a/core/Segment.php +++ b/core/Segment.php @@ -9,7 +9,7 @@ * @package Piwik */ use Piwik\Core\Piwik; -use Piwik\Core\Piwik_Common; +use Piwik\Core\Common; /** * @@ -241,7 +241,7 @@ class Piwik_Segment // join condition provided $alias = isset($table['tableAlias']) ? $table['tableAlias'] : $table['table']; $sql .= " - LEFT JOIN " . Piwik_Common::prefixTable($table['table']) . " AS " . $alias + LEFT JOIN " . Common::prefixTable($table['table']) . " AS " . $alias . " ON " . $table['joinOn']; continue; } @@ -250,7 +250,7 @@ class Piwik_Segment throw new Exception("Table '$table' can't be used for segmentation"); } - $tableSql = Piwik_Common::prefixTable($table) . " AS $table"; + $tableSql = Common::prefixTable($table) . " AS $table"; if ($i == 0) { // first table diff --git a/core/Session.php b/core/Session.php index 7072c26c53..5f2d362b6b 100644 --- a/core/Session.php +++ b/core/Session.php @@ -10,7 +10,7 @@ */ use Piwik\Core\Config; use Piwik\Core\Piwik; -use Piwik\Core\Piwik_Common; +use Piwik\Core\Common; /** * Session initialization. @@ -42,7 +42,7 @@ class Piwik_Session extends Zend_Session */ public static function start($options = false) { - if (Piwik_Common::isPhpCliMode() + if (Common::isPhpCliMode() || self::$sessionStarted || (defined('PIWIK_ENABLE_SESSION_START') && !PIWIK_ENABLE_SESSION_START) ) { @@ -81,7 +81,7 @@ class Piwik_Session extends Zend_Session // for "files", use our own folder to prevent local session file hijacking $sessionPath = self::getSessionsDirectory(); // We always call mkdir since it also chmods the directory which might help when permissions were reverted for some reasons - Piwik_Common::mkdir($sessionPath); + Common::mkdir($sessionPath); @ini_set('session.save_handler', 'files'); @ini_set('session.save_path', $sessionPath); @@ -95,7 +95,7 @@ class Piwik_Session extends Zend_Session $db = Zend_Registry::get('db'); $config = array( - 'name' => Piwik_Common::prefixTable('session'), + 'name' => Common::prefixTable('session'), 'primary' => 'id', 'modifiedColumn' => 'modified', 'dataColumn' => 'data', @@ -128,7 +128,7 @@ class Piwik_Session extends Zend_Session $message = sprintf("Error: %s %s %s\n<pre>Debug: the original error was \n%s</pre>", Piwik_Translate('General_ExceptionUnableToStartSession'), - Piwik::getErrorMessageMissingPermissions(Piwik_Common::getPathToPiwikRoot() . '/tmp/sessions/'), + Piwik::getErrorMessageMissingPermissions(Common::getPathToPiwikRoot() . '/tmp/sessions/'), $enableDbSessions, $e->getMessage() ); diff --git a/core/Session/Namespace.php b/core/Session/Namespace.php index 0b65168ca4..22199fdfd6 100644 --- a/core/Session/Namespace.php +++ b/core/Session/Namespace.php @@ -8,7 +8,7 @@ * @category Piwik * @package Piwik */ -use Piwik\Core\Piwik_Common; +use Piwik\Core\Common; /** * Session namespace. @@ -24,7 +24,7 @@ class Piwik_Session_Namespace extends Zend_Session_Namespace */ public function __construct($namespace = 'Default', $singleInstance = false) { - if (Piwik_Common::isPhpCliMode()) { + if (Common::isPhpCliMode()) { self::$_readable = true; return; } diff --git a/core/Tracker.php b/core/Tracker.php index f375ea35e4..e82e88f053 100644 --- a/core/Tracker.php +++ b/core/Tracker.php @@ -10,7 +10,7 @@ */ use Piwik\Core\Config; use Piwik\Core\Piwik; -use Piwik\Core\Piwik_Common; +use Piwik\Core\Common; /** * Class used by the logging script piwik.php called by the javascript tag. @@ -161,12 +161,12 @@ class Piwik_Tracker private function initBulkTrackingRequests($rawData) { // POST data can be array of string URLs or array of arrays w/ visit info - $jsonData = Piwik_Common::json_decode($rawData, $assoc = true); + $jsonData = Common::json_decode($rawData, $assoc = true); if (isset($jsonData['requests'])) { $this->requests = $jsonData['requests']; } - $tokenAuth = Piwik_Common::getRequestVar('token_auth', false, null, $jsonData); + $tokenAuth = Common::getRequestVar('token_auth', false, null, $jsonData); if (empty($tokenAuth)) { throw new Exception(" token_auth must be specified when using Bulk Tracking Import. See <a href='http://piwik.org/docs/tracking-api/reference/'>Tracking Doc</a>"); } @@ -264,7 +264,7 @@ class Piwik_Tracker { // don't run scheduled tasks in CLI mode from Tracker, this is the case // where we bulk load logs & don't want to lose time with tasks - return !Piwik_Common::isPhpCliMode() + return !Common::isPhpCliMode() && $this->getState() != self::STATE_LOGGING_DISABLE; } @@ -375,11 +375,11 @@ class Piwik_Tracker if ((isset($GLOBALS['PIWIK_TRACKER_DEBUG']) && $GLOBALS['PIWIK_TRACKER_DEBUG']) || $authenticated) { $result['error'] = Piwik_Tracker_GetErrorMessage($e); } - echo Piwik_Common::json_encode($result); + echo Common::json_encode($result); exit; } if (isset($GLOBALS['PIWIK_TRACKER_DEBUG']) && $GLOBALS['PIWIK_TRACKER_DEBUG']) { - Piwik_Common::sendHeader('Content-Type: text/html; charset=utf-8'); + Common::sendHeader('Content-Type: text/html; charset=utf-8'); $trailer = '<span style="color: #888888">Backtrace:<br /><pre>' . $e->getTraceAsString() . '</pre></span>'; $headerPage = file_get_contents(PIWIK_INCLUDE_PATH . '/plugins/Zeitgeist/templates/simpleLayoutHeader.tpl'); $footerPage = file_get_contents(PIWIK_INCLUDE_PATH . '/plugins/Zeitgeist/templates/simpleLayoutFooter.tpl'); @@ -388,7 +388,7 @@ class Piwik_Tracker echo $headerPage . '<p>' . Piwik_Tracker_GetErrorMessage($e) . '</p>' . $trailer . $footerPage; } // If not debug, but running authenticated (eg. during log import) then we display raw errors elseif ($authenticated) { - Piwik_Common::sendHeader('Content-Type: text/html; charset=utf-8'); + Common::sendHeader('Content-Type: text/html; charset=utf-8'); echo Piwik_Tracker_GetErrorMessage($e); } else { $this->outputTransparentGif(); @@ -569,7 +569,7 @@ class Piwik_Tracker protected function sendHeader($header) { - Piwik_Common::sendHeader($header); + Common::sendHeader($header); } protected function isVisitValid() @@ -638,7 +638,7 @@ class Piwik_Tracker return $this->tokenAuth; } - return Piwik_Common::getRequestVar('token_auth', false); + return Common::getRequestVar('token_auth', false); } /** @@ -689,18 +689,18 @@ class Piwik_Tracker } // Tests can force the use of 3rd party cookie for ID visitor - if (Piwik_Common::getRequestVar('forceUseThirdPartyCookie', false, null, $args) == 1) { + if (Common::getRequestVar('forceUseThirdPartyCookie', false, null, $args) == 1) { self::updateTrackerConfig('use_third_party_id_cookie', 1); } // Tests using window_look_back_for_visitor - if (Piwik_Common::getRequestVar('forceLargeWindowLookBackForVisitor', false, null, $args) == 1) { + if (Common::getRequestVar('forceLargeWindowLookBackForVisitor', false, null, $args) == 1) { self::updateTrackerConfig('window_look_back_for_visitor', 2678400); } // Tests can force the enabling of IP anonymization $forceIpAnonymization = false; - if (Piwik_Common::getRequestVar('forceIpAnonymization', false, null, $args) == 1) { + if (Common::getRequestVar('forceIpAnonymization', false, null, $args) == 1) { self::updateTrackerConfig('ip_address_mask_length', 2); $section = Config::getInstance()->Plugins_Tracker; @@ -711,19 +711,19 @@ class Piwik_Tracker } // Custom IP to use for this visitor - $customIp = Piwik_Common::getRequestVar('cip', false, null, $args); + $customIp = Common::getRequestVar('cip', false, null, $args); if (!empty($customIp)) { self::setForceIp($customIp); } // Custom server date time to use - $customDatetime = Piwik_Common::getRequestVar('cdt', false, null, $args); + $customDatetime = Common::getRequestVar('cdt', false, null, $args); if (!empty($customDatetime)) { self::setForceDateTime($customDatetime); } // Custom visitor id - $customVisitorId = Piwik_Common::getRequestVar('cid', false, null, $args); + $customVisitorId = Common::getRequestVar('cid', false, null, $args); if (!empty($customVisitorId)) { self::setForceVisitorId($customVisitorId); } diff --git a/core/Tracker/Action.php b/core/Tracker/Action.php index b98f284f78..ddba2c0dcc 100644 --- a/core/Tracker/Action.php +++ b/core/Tracker/Action.php @@ -9,7 +9,7 @@ * @package Piwik */ use Piwik\Core\Config; -use Piwik\Core\Piwik_Common; +use Piwik\Core\Common; /** * Interface of the Action object. @@ -142,7 +142,7 @@ class Piwik_Tracker_Action implements Piwik_Tracker_Action_Interface // Clean up host & hash tags, for URLs $parsedUrl = @parse_url($fullUrl); $parsedUrl = self::cleanupHostAndHashTag($parsedUrl); - $url = Piwik_Common::getParseUrlReverse($parsedUrl); + $url = Common::getParseUrlReverse($parsedUrl); if (!empty($url)) { return $url; } @@ -261,7 +261,7 @@ class Piwik_Tracker_Action implements Piwik_Tracker_Action_Interface static public function cleanupUrl($url) { - $url = Piwik_Common::unsanitizeInputValue($url); + $url = Common::unsanitizeInputValue($url); $url = self::cleanupString($url); $url = self::convertMatrixUrl($url); return $url; @@ -353,17 +353,17 @@ class Piwik_Tracker_Action implements Piwik_Tracker_Action_Interface if (empty($parsedUrl['query'])) { if (empty($parsedUrl['fragment'])) { - return Piwik_Common::getParseUrlReverse($parsedUrl); + return Common::getParseUrlReverse($parsedUrl); } // Exclude from the hash tag as well - $queryParameters = Piwik_Common::getArrayFromQueryString($parsedUrl['fragment']); + $queryParameters = Common::getArrayFromQueryString($parsedUrl['fragment']); $parsedUrl['fragment'] = self::getQueryStringWithExcludedParameters($queryParameters, $parametersToExclude); - $url = Piwik_Common::getParseUrlReverse($parsedUrl); + $url = Common::getParseUrlReverse($parsedUrl); return $url; } - $queryParameters = Piwik_Common::getArrayFromQueryString($parsedUrl['query']); + $queryParameters = Common::getArrayFromQueryString($parsedUrl['query']); $parsedUrl['query'] = self::getQueryStringWithExcludedParameters($queryParameters, $parametersToExclude); - $url = Piwik_Common::getParseUrlReverse($parsedUrl); + $url = Common::getParseUrlReverse($parsedUrl); return $url; } @@ -375,7 +375,7 @@ class Piwik_Tracker_Action implements Piwik_Tracker_Action_Interface */ public static function getQueryParametersToExclude($idSite) { - $campaignTrackingParameters = Piwik_Common::getCampaignParameters(); + $campaignTrackingParameters = Common::getCampaignParameters(); $campaignTrackingParameters = array_merge( $campaignTrackingParameters[0], // campaign name parameters @@ -459,7 +459,7 @@ class Piwik_Tracker_Action implements Piwik_Tracker_Action_Interface static public function getSqlSelectActionId() { $sql = "SELECT idaction, type, name - FROM " . Piwik_Common::prefixTable('log_action') + FROM " . Common::prefixTable('log_action') . " WHERE " . " ( hash = CRC32(?) AND name = ? AND type = ? ) "; return $sql; @@ -533,7 +533,7 @@ class Piwik_Tracker_Action implements Piwik_Tracker_Action_Interface } } - $sql = "INSERT INTO " . Piwik_Common::prefixTable('log_action') . + $sql = "INSERT INTO " . Common::prefixTable('log_action') . "( name, hash, type, url_prefix ) VALUES (?,CRC32(?),?,?)"; // Then, we insert all new actions in the lookup table foreach ($actionsToInsert as $actionToInsert) { @@ -691,9 +691,9 @@ class Piwik_Tracker_Action implements Piwik_Tracker_Action_Interface $fields = implode(", ", array_keys($insertWithoutNulls)); $bind = array_values($insertWithoutNulls); - $values = Piwik_Common::getSqlStringFieldsArray($insertWithoutNulls); + $values = Common::getSqlStringFieldsArray($insertWithoutNulls); - $sql = "INSERT INTO " . Piwik_Common::prefixTable('log_link_visit_action') . " ($fields) VALUES ($values)"; + $sql = "INSERT INTO " . Common::prefixTable('log_link_visit_action') . " ($fields) VALUES ($values)"; Piwik_Tracker::getDatabase()->query($sql, $bind); $this->idLinkVisitAction = Piwik_Tracker::getDatabase()->lastInsertId(); @@ -804,7 +804,7 @@ class Piwik_Tracker_Action implements Piwik_Tracker_Action_Interface } $url = self::cleanupString($url); - if (!Piwik_Common::isLookLikeUrl($url)) { + if (!Common::isLookLikeUrl($url)) { printDebug("WARNING: URL looks invalid and is discarded"); $url = ''; } @@ -923,19 +923,19 @@ class Piwik_Tracker_Action implements Piwik_Tracker_Action_Interface ? $website['sitesearch_keyword_parameters'] : array(); $queryString = (!empty($parsedUrl['query']) ? $parsedUrl['query'] : '') . (!empty($parsedUrl['fragment']) ? $separator . $parsedUrl['fragment'] : ''); - $parametersRaw = Piwik_Common::getArrayFromQueryString($queryString); + $parametersRaw = Common::getArrayFromQueryString($queryString); // strtolower the parameter names for smooth site search detection $parameters = array(); foreach ($parametersRaw as $k => $v) { - $parameters[Piwik_Common::mb_strtolower($k)] = $v; + $parameters[Common::mb_strtolower($k)] = $v; } // decode values if they were sent from a client using another charset self::reencodeParameters($parameters, $this->pageEncoding); // Detect Site Search keyword foreach ($keywordParameters as $keywordParameterRaw) { - $keywordParameter = Piwik_Common::mb_strtolower($keywordParameterRaw); + $keywordParameter = Common::mb_strtolower($keywordParameterRaw); if (!empty($parameters[$keywordParameter])) { $actionName = $parameters[$keywordParameter]; break; @@ -951,7 +951,7 @@ class Piwik_Tracker_Action implements Piwik_Tracker_Action_Interface : array(); foreach ($categoryParameters as $categoryParameterRaw) { - $categoryParameter = Piwik_Common::mb_strtolower($categoryParameterRaw); + $categoryParameter = Common::mb_strtolower($categoryParameterRaw); if (!empty($parameters[$categoryParameter])) { $categoryName = $parameters[$categoryParameter]; break; @@ -968,10 +968,10 @@ class Piwik_Tracker_Action implements Piwik_Tracker_Action_Interface // @see excludeQueryParametersFromUrl() // Excluded the detected parameters from the URL $parametersToExclude = array($categoryParameterRaw, $keywordParameterRaw); - $parsedUrl['query'] = self::getQueryStringWithExcludedParameters(Piwik_Common::getArrayFromQueryString($parsedUrl['query']), $parametersToExclude); - $parsedUrl['fragment'] = self::getQueryStringWithExcludedParameters(Piwik_Common::getArrayFromQueryString($parsedUrl['fragment']), $parametersToExclude); + $parsedUrl['query'] = self::getQueryStringWithExcludedParameters(Common::getArrayFromQueryString($parsedUrl['query']), $parametersToExclude); + $parsedUrl['fragment'] = self::getQueryStringWithExcludedParameters(Common::getArrayFromQueryString($parsedUrl['fragment']), $parametersToExclude); } - $url = Piwik_Common::getParseUrlReverse($parsedUrl); + $url = Common::getParseUrlReverse($parsedUrl); if (is_array($actionName)) { $actionName = reset($actionName); } diff --git a/core/Tracker/Db.php b/core/Tracker/Db.php index 6ddb7b5183..6d33bc39c5 100644 --- a/core/Tracker/Db.php +++ b/core/Tracker/Db.php @@ -8,7 +8,7 @@ * @category Piwik * @package Piwik */ -use Piwik\Core\Piwik_Common; +use Piwik\Core\Common; /** * Simple database wrapper. @@ -98,7 +98,7 @@ abstract class Piwik_Tracker_Db $time = $info['sum_time_ms']; $count = $info['count']; - $queryProfiling = "INSERT INTO " . Piwik_Common::prefixTable('log_profiling') . " + $queryProfiling = "INSERT INTO " . Common::prefixTable('log_profiling') . " (query,count,sum_time_ms) VALUES (?,$count,$time) ON DUPLICATE KEY UPDATE count=count+$count,sum_time_ms=sum_time_ms+$time"; diff --git a/core/Tracker/GoalManager.php b/core/Tracker/GoalManager.php index 1f47cfcef5..fb22e339e7 100644 --- a/core/Tracker/GoalManager.php +++ b/core/Tracker/GoalManager.php @@ -9,7 +9,7 @@ * @package Piwik */ use Piwik\Core\Config; -use Piwik\Core\Piwik_Common; +use Piwik\Core\Common; /** * @package Piwik @@ -125,7 +125,7 @@ class Piwik_Tracker_GoalManager */ function detectGoalsMatchingUrl($idSite, $action) { - if (!Piwik_Common::isGoalPluginEnabled()) { + if (!Common::isGoalPluginEnabled()) { return false; } @@ -194,7 +194,7 @@ class Piwik_Tracker_GoalManager function detectGoalId($idSite) { - if (!Piwik_Common::isGoalPluginEnabled()) { + if (!Common::isGoalPluginEnabled()) { return false; } $goals = $this->getGoalDefinitions($idSite); @@ -228,7 +228,7 @@ class Piwik_Tracker_GoalManager $location_country = isset($visitorInformation['location_country']) ? $visitorInformation['location_country'] - : Piwik_Common::getCountry( + : Common::getCountry( $browserLanguage, $enableLanguageToCountryGuess = Config::getInstance()->Tracker['enable_language_to_country_guess'], $visitorInformation['location_ip'] @@ -285,13 +285,13 @@ class Piwik_Tracker_GoalManager // 0) In some (unknown!?) cases the campaign is not found in the attribution cookie, but the URL ref was found. // In this case we look up if the current visit is credited to a campaign and will credit this campaign rather than the URL ref (since campaigns have higher priority) if (empty($refererCampaignName) - && $type == Piwik_Common::REFERER_TYPE_CAMPAIGN + && $type == Common::REFERER_TYPE_CAMPAIGN && !empty($name) ) { // Use default values per above } // 1) Campaigns from 1st party cookie elseif (!empty($refererCampaignName)) { - $type = Piwik_Common::REFERER_TYPE_CAMPAIGN; + $type = Common::REFERER_TYPE_CAMPAIGN; $name = $refererCampaignName; $keyword = $refererCampaignKeyword; $time = $refererTimestamp; @@ -301,7 +301,7 @@ class Piwik_Tracker_GoalManager $referrer = $referrer->getRefererInformation($refererUrl, $currentUrl = '', $idSite); // if the parsed referer is interesting enough, ie. website or search engine - if (in_array($referrer['referer_type'], array(Piwik_Common::REFERER_TYPE_SEARCH_ENGINE, Piwik_Common::REFERER_TYPE_WEBSITE))) { + if (in_array($referrer['referer_type'], array(Common::REFERER_TYPE_SEARCH_ENGINE, Common::REFERER_TYPE_WEBSITE))) { $type = $referrer['referer_type']; $name = $referrer['referer_name']; $keyword = $referrer['referer_keyword']; @@ -358,7 +358,7 @@ class Piwik_Tracker_GoalManager printDebug("There is an existing cart for this visit"); } if ($this->isGoalAnOrder) { - $orderIdNumeric = Piwik_Common::hashStringToInt($this->orderId); + $orderIdNumeric = Common::hashStringToInt($this->orderId); $goal['idgoal'] = self::IDGOAL_ORDER; $goal['idorder'] = $this->orderId; $goal['buster'] = $orderIdNumeric; @@ -407,13 +407,13 @@ class Piwik_Tracker_GoalManager */ protected function getEcommerceItemsFromRequest() { - $items = Piwik_Common::unsanitizeInputValue($this->request->getParam('ec_items')); + $items = Common::unsanitizeInputValue($this->request->getParam('ec_items')); if (empty($items)) { printDebug("There are no Ecommerce items in the request"); // we still record an Ecommerce order without any item in it return array(); } - $items = Piwik_Common::json_decode($items, $assoc = true); + $items = Common::json_decode($items, $assoc = true); if (!is_array($items)) { printDebug("Error while json_decode the Ecommerce items = " . var_export($items, true)); return false; @@ -440,7 +440,7 @@ class Piwik_Tracker_GoalManager // Select all items currently in the Cart if any $sql = "SELECT idaction_sku, idaction_name, idaction_category, idaction_category2, idaction_category3, idaction_category4, idaction_category5, price, quantity, deleted, idorder as idorder_original_value - FROM " . Piwik_Common::prefixTable('log_conversion_item') . " + FROM " . Common::prefixTable('log_conversion_item') . " WHERE idvisit = ? AND (idorder = ? OR idorder = ?)"; @@ -660,7 +660,7 @@ class Piwik_Tracker_GoalManager $updateParts[] = $name . " = ?"; $sqlBind[] = $value; } - $sql = 'UPDATE ' . Piwik_Common::prefixTable('log_conversion_item') . " + $sql = 'UPDATE ' . Common::prefixTable('log_conversion_item') . " SET " . implode($updateParts, ', ') . " WHERE idvisit = ? AND idorder = ? @@ -689,7 +689,7 @@ class Piwik_Tracker_GoalManager printDebug("Ecommerce items that are added to the cart/order"); printDebug($itemsToInsert); - $sql = "INSERT INTO " . Piwik_Common::prefixTable('log_conversion_item') . " + $sql = "INSERT INTO " . Common::prefixTable('log_conversion_item') . " (idaction_sku, idaction_name, idaction_category, idaction_category2, idaction_category3, idaction_category4, idaction_category5, price, quantity, deleted, idorder, idsite, idvisitor, server_time, idvisit) VALUES "; @@ -700,7 +700,7 @@ class Piwik_Tracker_GoalManager $sql .= ','; } $newRow = array_values($this->getItemRowEnriched($goal, $item)); - $sql .= " ( " . Piwik_Common::getSqlStringFieldsArray($newRow) . " ) "; + $sql .= " ( " . Common::getSqlStringFieldsArray($newRow) . " ) "; $i++; $bind = array_merge($bind, $newRow); } @@ -778,7 +778,7 @@ class Piwik_Tracker_GoalManager printDebug($newGoalDebug); $fields = implode(", ", array_keys($newGoal)); - $bindFields = Piwik_Common::getSqlStringFieldsArray($newGoal); + $bindFields = Common::getSqlStringFieldsArray($newGoal); if ($mustUpdateNotInsert) { $updateParts = $sqlBind = $updateWhereParts = array(); @@ -790,13 +790,13 @@ class Piwik_Tracker_GoalManager $updateWhereParts[] = $name . " = ?"; $sqlBind[] = $value; } - $sql = 'UPDATE ' . Piwik_Common::prefixTable('log_conversion') . " + $sql = 'UPDATE ' . Common::prefixTable('log_conversion') . " SET " . implode($updateParts, ', ') . " WHERE " . implode($updateWhereParts, ' AND '); Piwik_Tracker::getDatabase()->query($sql, $sqlBind); return true; } else { - $sql = 'INSERT IGNORE INTO ' . Piwik_Common::prefixTable('log_conversion') . " + $sql = 'INSERT IGNORE INTO ' . Common::prefixTable('log_conversion') . " ($fields) VALUES ($bindFields) "; $bind = array_values($newGoal); $result = Piwik_Tracker::getDatabase()->query($sql, $bind); diff --git a/core/Tracker/Referer.php b/core/Tracker/Referer.php index 85a456f95c..1c8469f3f0 100644 --- a/core/Tracker/Referer.php +++ b/core/Tracker/Referer.php @@ -8,7 +8,7 @@ * @category Piwik * @package Piwik */ -use Piwik\Core\Piwik_Common; +use Piwik\Core\Common; /** * @package Piwik @@ -64,9 +64,9 @@ class Piwik_Tracker_Referer $this->idsite = $idSite; // default values for the referer_* fields - $refererUrl = Piwik_Common::unsanitizeInputValue($refererUrl); + $refererUrl = Common::unsanitizeInputValue($refererUrl); if (!empty($refererUrl) - && !Piwik_Common::isLookLikeUrl($refererUrl) + && !Common::isLookLikeUrl($refererUrl) ) { $refererUrl = ''; } @@ -76,7 +76,7 @@ class Piwik_Tracker_Referer $this->refererUrl = $refererUrl; $this->refererUrlParse = @parse_url($this->refererUrl); $this->currentUrlParse = @parse_url($currentUrl); - $this->typeRefererAnalyzed = Piwik_Common::REFERER_TYPE_DIRECT_ENTRY; + $this->typeRefererAnalyzed = Common::REFERER_TYPE_DIRECT_ENTRY; $this->nameRefererAnalyzed = ''; $this->keywordRefererAnalyzed = ''; $this->refererHost = ''; @@ -104,7 +104,7 @@ class Piwik_Tracker_Referer if (!empty($this->refererHost) && !$refererDetected ) { - $this->typeRefererAnalyzed = Piwik_Common::REFERER_TYPE_WEBSITE; + $this->typeRefererAnalyzed = Common::REFERER_TYPE_WEBSITE; $this->nameRefererAnalyzed = mb_strtolower($this->refererHost, 'UTF-8'); } @@ -124,12 +124,12 @@ class Piwik_Tracker_Referer */ protected function detectRefererSearchEngine() { - $searchEngineInformation = Piwik_Common::extractSearchEngineInformationFromUrl($this->refererUrl); + $searchEngineInformation = Common::extractSearchEngineInformationFromUrl($this->refererUrl); Piwik_PostEvent('Tracker.detectRefererSearchEngine', array(&$searchEngineInformation, $this->refererUrl)); if ($searchEngineInformation === false) { return false; } - $this->typeRefererAnalyzed = Piwik_Common::REFERER_TYPE_SEARCH_ENGINE; + $this->typeRefererAnalyzed = Common::REFERER_TYPE_SEARCH_ENGINE; $this->nameRefererAnalyzed = $searchEngineInformation['name']; $this->keywordRefererAnalyzed = $searchEngineInformation['keywords']; return true; @@ -142,18 +142,18 @@ class Piwik_Tracker_Referer protected function detectCampaignFromString($string) { foreach ($this->campaignNames as $campaignNameParameter) { - $campaignName = trim(urldecode(Piwik_Common::getParameterFromQueryString($string, $campaignNameParameter))); + $campaignName = trim(urldecode(Common::getParameterFromQueryString($string, $campaignNameParameter))); if (!empty($campaignName)) { break; } } if (!empty($campaignName)) { - $this->typeRefererAnalyzed = Piwik_Common::REFERER_TYPE_CAMPAIGN; + $this->typeRefererAnalyzed = Common::REFERER_TYPE_CAMPAIGN; $this->nameRefererAnalyzed = $campaignName; foreach ($this->campaignKeywords as $campaignKeywordParameter) { - $campaignKeyword = Piwik_Common::getParameterFromQueryString($string, $campaignKeywordParameter); + $campaignKeyword = Common::getParameterFromQueryString($string, $campaignKeywordParameter); if (!empty($campaignKeyword)) { $this->keywordRefererAnalyzed = trim(urldecode($campaignKeyword)); break; @@ -163,7 +163,7 @@ class Piwik_Tracker_Referer // if the campaign keyword is empty, try to get a keyword from the referrer URL if (empty($this->keywordRefererAnalyzed)) { // Set the Campaign keyword to the keyword found in the Referer URL if any - $referrerUrlInfo = Piwik_Common::extractSearchEngineInformationFromUrl($this->refererUrl); + $referrerUrlInfo = Common::extractSearchEngineInformationFromUrl($this->refererUrl); if (!empty($referrerUrlInfo['keywords'])) { $this->keywordRefererAnalyzed = $referrerUrlInfo['keywords']; } @@ -176,7 +176,7 @@ class Piwik_Tracker_Referer ) { // This parameter sometimes is found & contains the page with the adsense ad bringing visitor to our site $adsenseReferrerParameter = 'url'; - $value = trim(urldecode(Piwik_Common::getParameterFromQueryString($this->refererUrlParse['query'], $adsenseReferrerParameter))); + $value = trim(urldecode(Common::getParameterFromQueryString($this->refererUrlParse['query'], $adsenseReferrerParameter))); if (!empty($value)) { $parsedAdsenseReferrerUrl = parse_url($value); if (!empty($parsedAdsenseReferrerUrl['host'])) { @@ -207,7 +207,7 @@ class Piwik_Tracker_Referer ) { return false; } - $campaignParameters = Piwik_Common::getCampaignParameters(); + $campaignParameters = Common::getCampaignParameters(); $this->campaignNames = $campaignParameters[0]; $this->campaignKeywords = $campaignParameters[1]; @@ -241,12 +241,12 @@ class Piwik_Tracker_Referer if (isset($this->currentUrlParse['host'])) { $currentHost = mb_strtolower($this->currentUrlParse['host'], 'UTF-8'); if ($currentHost == mb_strtolower($this->refererHost, 'UTF-8')) { - $this->typeRefererAnalyzed = Piwik_Common::REFERER_TYPE_DIRECT_ENTRY; + $this->typeRefererAnalyzed = Common::REFERER_TYPE_DIRECT_ENTRY; return true; } } if (Piwik_Tracker_Visit::isHostKnownAliasHost($this->refererHost, $this->idsite)) { - $this->typeRefererAnalyzed = Piwik_Common::REFERER_TYPE_DIRECT_ENTRY; + $this->typeRefererAnalyzed = Common::REFERER_TYPE_DIRECT_ENTRY; return true; } } diff --git a/core/Tracker/Request.php b/core/Tracker/Request.php index 243e6e4462..e27e2eaded 100644 --- a/core/Tracker/Request.php +++ b/core/Tracker/Request.php @@ -1,6 +1,6 @@ <?php use Piwik\Core\Config; -use Piwik\Core\Piwik_Common; +use Piwik\Core\Common; /** * Piwik - Open source web analytics @@ -59,7 +59,7 @@ class Piwik_Tracker_Request { $shouldAuthenticate = Config::getInstance()->Tracker['tracking_requests_require_authentication']; if ($shouldAuthenticate) { - $tokenAuth = $tokenAuthFromBulkRequest || Piwik_Common::getRequestVar('token_auth', false, 'string', $this->params); + $tokenAuth = $tokenAuthFromBulkRequest || Common::getRequestVar('token_auth', false, 'string', $this->params); try { $idSite = $this->getIdSite(); $this->isAuthenticated = $this->authenticateSuperUserOrAdmin($tokenAuth, $idSite); @@ -157,15 +157,15 @@ class Piwik_Tracker_Request */ public function getBrowserLanguage() { - return Piwik_Common::getRequestVar('lang', Piwik_Common::getBrowserLanguage(), 'string', $this->params); + return Common::getRequestVar('lang', Common::getBrowserLanguage(), 'string', $this->params); } public function getLocalTime() { $localTimes = array( - 'h' => (string)Piwik_Common::getRequestVar('h', $this->getCurrentDate("H"), 'int', $this->params), - 'i' => (string)Piwik_Common::getRequestVar('m', $this->getCurrentDate("i"), 'int', $this->params), - 's' => (string)Piwik_Common::getRequestVar('s', $this->getCurrentDate("s"), 'int', $this->params) + 'h' => (string)Common::getRequestVar('h', $this->getCurrentDate("H"), 'int', $this->params), + 'i' => (string)Common::getRequestVar('m', $this->getCurrentDate("i"), 'int', $this->params), + 's' => (string)Common::getRequestVar('s', $this->getCurrentDate("s"), 'int', $this->params) ); foreach ($localTimes as $k => $time) { if (strlen($time) == 1) { @@ -189,7 +189,7 @@ class Piwik_Tracker_Request public function getGoalRevenue($defaultGoalRevenue) { - return Piwik_Common::getRequestVar('revenue', $defaultGoalRevenue, 'float', $this->params); + return Common::getRequestVar('revenue', $defaultGoalRevenue, 'float', $this->params); } public function getParam($name) @@ -244,7 +244,7 @@ class Piwik_Tracker_Request $paramDefaultValue = $supportedParams[$name][0]; $paramType = $supportedParams[$name][1]; - $value = Piwik_Common::getRequestVar($name, $paramDefaultValue, $paramType, $this->params); + $value = Common::getRequestVar($name, $paramDefaultValue, $paramType, $this->params); return $value; } @@ -262,7 +262,7 @@ class Piwik_Tracker_Request public function getIdSite() { - $idSite = Piwik_Common::getRequestVar('idsite', 0, 'int', $this->params); + $idSite = Common::getRequestVar('idsite', 0, 'int', $this->params); Piwik_PostEvent('Tracker.setRequest.idSite', array(&$idSite, $this->params)); if ($idSite <= 0) { throw new Exception('Invalid idSite'); @@ -273,7 +273,7 @@ class Piwik_Tracker_Request public function getUserAgent() { $default = @$_SERVER['HTTP_USER_AGENT']; - return Piwik_Common::getRequestVar('ua', is_null($default) ? false : $default, 'string', $this->params); + return Common::getRequestVar('ua', is_null($default) ? false : $default, 'string', $this->params); } public function getCustomVariables($scope) @@ -284,7 +284,7 @@ class Piwik_Tracker_Request $parameter = 'cvar'; } - $customVar = Piwik_Common::unsanitizeInputValues(Piwik_Common::getRequestVar($parameter, '', 'json', $this->params)); + $customVar = Common::unsanitizeInputValues(Common::getRequestVar($parameter, '', 'json', $this->params)); if (!is_array($customVar)) { return array(); } @@ -399,13 +399,13 @@ class Piwik_Tracker_Request } // If a third party cookie was not found, we default to the first party cookie if (!$found) { - $idVisitor = Piwik_Common::getRequestVar('_id', '', 'string', $this->params); + $idVisitor = Common::getRequestVar('_id', '', 'string', $this->params); $found = strlen($idVisitor) >= Piwik_Tracker::LENGTH_HEX_ID_STRING; } if ($found) { $truncated = substr($idVisitor, 0, Piwik_Tracker::LENGTH_HEX_ID_STRING); - $binVisitorId = @Piwik_Common::hex2bin($truncated); + $binVisitorId = @Common::hex2bin($truncated); if (!empty($binVisitorId)) { return $binVisitorId; } @@ -464,7 +464,7 @@ class Piwik_Tracker_Request foreach ($locationOverrideParams as $queryParamName => $info) { list($type, $locationResultKey) = $info; - $value = Piwik_Common::getRequestVar($queryParamName, false, $type, $this->params); + $value = Common::getRequestVar($queryParamName, false, $type, $this->params); if (!empty($value)) { $location[$locationResultKey] = $value; } @@ -477,7 +477,7 @@ class Piwik_Tracker_Request $pluginsInOrder = array('fla', 'java', 'dir', 'qt', 'realp', 'pdf', 'wma', 'gears', 'ag', 'cookie'); $plugins = array(); foreach ($pluginsInOrder as $param) { - $plugins[] = Piwik_Common::getRequestVar($param, 0, 'int', $this->params); + $plugins[] = Common::getRequestVar($param, 0, 'int', $this->params); } return $plugins; } diff --git a/core/Tracker/Visit.php b/core/Tracker/Visit.php index 7cdcff57bf..c04d7f5a00 100644 --- a/core/Tracker/Visit.php +++ b/core/Tracker/Visit.php @@ -9,7 +9,7 @@ * @package Piwik */ use Piwik\Core\Config; -use Piwik\Core\Piwik_Common; +use Piwik\Core\Common; /** * @package Piwik @@ -318,7 +318,7 @@ class Piwik_Tracker_Visit implements Piwik_Tracker_Visit_Interface $updateParts[] = $name . " = ?"; $sqlBind[] = $value; } - $sqlQuery = "UPDATE " . Piwik_Common::prefixTable('log_visit') . " + $sqlQuery = "UPDATE " . Common::prefixTable('log_visit') . " SET $sqlActionUpdate " . implode($updateParts, ', ') . " WHERE idsite = ? AND idvisit = ?"; @@ -571,9 +571,9 @@ class Piwik_Tracker_Visit implements Piwik_Tracker_Visit_Interface $this->visitorInfo['config_resolution'] = substr($this->visitorInfo['config_resolution'], 0, 9); $fields = implode(", ", array_keys($this->visitorInfo)); - $values = Piwik_Common::getSqlStringFieldsArray($this->visitorInfo); + $values = Common::getSqlStringFieldsArray($this->visitorInfo); - $sql = "INSERT INTO " . Piwik_Common::prefixTable('log_visit') . " ($fields) VALUES ($values)"; + $sql = "INSERT INTO " . Common::prefixTable('log_visit') . " ($fields) VALUES ($values)"; $bind = array_values($this->visitorInfo); Piwik_Tracker::getDatabase()->query($sql, $bind); @@ -602,7 +602,7 @@ class Piwik_Tracker_Visit implements Piwik_Tracker_Visit_Interface ) { return $this->visitorInfo['idvisitor']; } - return Piwik_Common::hex2bin($this->generateUniqueVisitorId()); + return Common::hex2bin($this->generateUniqueVisitorId()); } /** @@ -610,7 +610,7 @@ class Piwik_Tracker_Visit implements Piwik_Tracker_Visit_Interface */ static public function generateUniqueVisitorId() { - $uniqueId = substr(Piwik_Common::generateUniqId(), 0, Piwik_Tracker::LENGTH_HEX_ID_STRING); + $uniqueId = substr(Common::generateUniqId(), 0, Piwik_Tracker::LENGTH_HEX_ID_STRING); return $uniqueId; } @@ -680,7 +680,7 @@ class Piwik_Tracker_Visit implements Piwik_Tracker_Visit_Interface visit_goal_buyer $selectCustomVariables "; - $from = "FROM " . Piwik_Common::prefixTable('log_visit'); + $from = "FROM " . Common::prefixTable('log_visit'); list($timeLookBack,$timeLookAhead) = $this->getWindowLookupThisVisit(); @@ -1018,7 +1018,7 @@ class Piwik_Tracker_Visit implements Piwik_Tracker_Visit_Interface protected function getConfigHash($os, $browserName, $browserVersion, $resolution, $plugin_Flash, $plugin_Java, $plugin_Director, $plugin_Quicktime, $plugin_RealPlayer, $plugin_PDF, $plugin_WindowsMedia, $plugin_Gears, $plugin_Silverlight, $plugin_Cookie, $ip, $browserLang) { $hash = md5($os . $browserName . $browserVersion . $plugin_Flash . $plugin_Java . $plugin_Director . $plugin_Quicktime . $plugin_RealPlayer . $plugin_PDF . $plugin_WindowsMedia . $plugin_Gears . $plugin_Silverlight . $plugin_Cookie . $ip . $browserLang, $raw_output = true); - return Piwik_Common::substr($hash, 0, Piwik_Tracker::LENGTH_BINARY_ID); + return Common::substr($hash, 0, Piwik_Tracker::LENGTH_BINARY_ID); } /** @@ -1032,7 +1032,7 @@ class Piwik_Tracker_Visit implements Piwik_Tracker_Visit_Interface if ($this->isVisitorKnown()) { return -1; } - return Piwik_Common::generateUniqId(); + return Common::generateUniqId(); } // is the referer host any of the registered URLs for this website? diff --git a/core/Tracker/VisitExcluded.php b/core/Tracker/VisitExcluded.php index 062020dbe7..b405d435cf 100644 --- a/core/Tracker/VisitExcluded.php +++ b/core/Tracker/VisitExcluded.php @@ -8,7 +8,7 @@ * @category Piwik * @package Piwik */ -use Piwik\Core\Piwik_Common; +use Piwik\Core\Common; /** * This class contains the logic to exclude some visitors from being tracked as per user settings @@ -127,7 +127,7 @@ class Piwik_Tracker_VisitExcluded */ protected function isNonHumanBot() { - $allowBots = Piwik_Common::getRequestVar('bots', false) != false; + $allowBots = Common::getRequestVar('bots', false) != false; return !$allowBots && (strpos($this->userAgent, 'Googlebot') !== false // Googlebot || strpos($this->userAgent, 'Google Web Preview') !== false // Google Instant diff --git a/core/Translate.php b/core/Translate.php index a1ac503edd..95a2f58771 100644 --- a/core/Translate.php +++ b/core/Translate.php @@ -9,7 +9,7 @@ * @package Piwik */ use Piwik\Core\Config; -use Piwik\Core\Piwik_Common; +use Piwik\Core\Common; /** * @package Piwik @@ -73,7 +73,7 @@ class Piwik_Translate { $translations = array(); $path = PIWIK_INCLUDE_PATH . '/lang/' . $language . '.php'; - if (!Piwik_Common::isValidFilename($language) || !is_readable($path)) { + if (!Common::isValidFilename($language) || !is_readable($path)) { throw new Exception(Piwik_TranslateException('General_ExceptionLanguageFileNotFound', array($language))); } require $path; @@ -98,7 +98,7 @@ class Piwik_Translate public function getLanguageToLoad() { if (is_null(self::$languageToLoad)) { - $lang = Piwik_Common::getRequestVar('language', '', 'string'); + $lang = Common::getRequestVar('language', '', 'string'); Piwik_PostEvent('Translate.getLanguageToLoad', array(&$lang)); diff --git a/core/TranslationWriter.php b/core/TranslationWriter.php index c7b073712d..5cec03e006 100644 --- a/core/TranslationWriter.php +++ b/core/TranslationWriter.php @@ -9,7 +9,7 @@ * @package Piwik * */ -use Piwik\Core\Piwik_Common; +use Piwik\Core\Common; /** * Write translations to file @@ -52,7 +52,7 @@ class Piwik_TranslationWriter */ static public function getTranslationPath($lang, $base = 'lang') { - if (!Piwik_Common::isValidFilename($lang) || + if (!Common::isValidFilename($lang) || ($base !== 'lang' && $base !== 'tmp') ) { throw new Exception(Piwik_TranslateException('General_ExceptionLanguageFileNotFound', array($lang))); diff --git a/core/Twig.php b/core/Twig.php index 6af9f80413..57f1b00ee6 100644 --- a/core/Twig.php +++ b/core/Twig.php @@ -9,7 +9,7 @@ * @package Piwik */ use Piwik\Core\Piwik; -use Piwik\Core\Piwik_Common; +use Piwik\Core\Common; /** @@ -215,7 +215,7 @@ class Piwik_Twig { $plugins = Piwik_PluginsManager::getInstance()->getLoadedPluginsName(); foreach($plugins as $name) { - $name = Piwik_Common::unprefixClass($name); + $name = Common::unprefixClass($name); $path = sprintf("%s/plugins/%s/templates/", PIWIK_INCLUDE_PATH, $name); if (is_dir($path)) { $loader->addPath(PIWIK_INCLUDE_PATH . '/plugins/' . $name . '/templates', $name); diff --git a/core/UpdateCheck.php b/core/UpdateCheck.php index 62fcc33415..0f35a966d9 100644 --- a/core/UpdateCheck.php +++ b/core/UpdateCheck.php @@ -9,7 +9,7 @@ * @package Piwik */ use Piwik\Core\Config; -use Piwik\Core\Piwik_Common; +use Piwik\Core\Common; /** * Class to check if a newer version of Piwik is available @@ -47,7 +47,7 @@ class Piwik_UpdateCheck 'piwik_version' => Piwik_Version::VERSION, 'php_version' => PHP_VERSION, 'url' => Piwik_Url::getCurrentUrlWithoutQueryString(), - 'trigger' => Piwik_Common::getRequestVar('module', '', 'string'), + 'trigger' => Common::getRequestVar('module', '', 'string'), 'timezone' => Piwik_SitesManager_API::getInstance()->getDefaultTimezone(), ); diff --git a/core/Updater.php b/core/Updater.php index 9ec42e8b59..b048dc6d0a 100644 --- a/core/Updater.php +++ b/core/Updater.php @@ -8,7 +8,7 @@ * @category Piwik * @package Piwik */ -use Piwik\Core\Piwik_Common; +use Piwik\Core\Common; /** * @see core/Option.php @@ -131,7 +131,7 @@ class Piwik_Updater } } // unfortunately had to extract this query from the Piwik_Option class - $queries[] = 'UPDATE `' . Piwik_Common::prefixTable('option') . '` + $queries[] = 'UPDATE `' . Common::prefixTable('option') . '` SET option_value = \'' . $fileVersion . '\' WHERE option_name = \'' . $this->getNameInOptionTable($componentName) . '\';'; } diff --git a/core/Updates/0.2.10.php b/core/Updates/0.2.10.php index 627c626af8..bb4358e411 100644 --- a/core/Updates/0.2.10.php +++ b/core/Updates/0.2.10.php @@ -9,7 +9,7 @@ * @package Updates */ use Piwik\Core\Piwik; -use Piwik\Core\Piwik_Common; +use Piwik\Core\Common; /** * @package Updates @@ -19,7 +19,7 @@ class Piwik_Updates_0_2_10 extends Piwik_Updates static function getSql($schema = 'Myisam') { return array( - 'CREATE TABLE `' . Piwik_Common::prefixTable('option') . '` ( + 'CREATE TABLE `' . Common::prefixTable('option') . '` ( idoption BIGINT NOT NULL AUTO_INCREMENT , option_name VARCHAR( 64 ) NOT NULL , option_value LONGTEXT NOT NULL , @@ -27,23 +27,23 @@ class Piwik_Updates_0_2_10 extends Piwik_Updates )' => false, // 0.1.7 [463] - 'ALTER IGNORE TABLE `' . Piwik_Common::prefixTable('log_visit') . '` + 'ALTER IGNORE TABLE `' . Common::prefixTable('log_visit') . '` CHANGE `location_provider` `location_provider` VARCHAR( 100 ) DEFAULT NULL' => '1054', // 0.1.7 [470] - 'ALTER TABLE `' . Piwik_Common::prefixTable('logger_api_call') . '` + 'ALTER TABLE `' . Common::prefixTable('logger_api_call') . '` CHANGE `parameter_names_default_values` `parameter_names_default_values` TEXT, CHANGE `parameter_values` `parameter_values` TEXT, CHANGE `returned_value` `returned_value` TEXT' => false, - 'ALTER TABLE `' . Piwik_Common::prefixTable('logger_error') . '` + 'ALTER TABLE `' . Common::prefixTable('logger_error') . '` CHANGE `message` `message` TEXT' => false, - 'ALTER TABLE `' . Piwik_Common::prefixTable('logger_exception') . '` + 'ALTER TABLE `' . Common::prefixTable('logger_exception') . '` CHANGE `message` `message` TEXT' => false, - 'ALTER TABLE `' . Piwik_Common::prefixTable('logger_message') . '` + 'ALTER TABLE `' . Common::prefixTable('logger_message') . '` CHANGE `message` `message` TEXT' => false, // 0.2.2 [489] - 'ALTER IGNORE TABLE `' . Piwik_Common::prefixTable('site') . '` + 'ALTER IGNORE TABLE `' . Common::prefixTable('site') . '` CHANGE `feedburnerName` `feedburnerName` VARCHAR( 100 ) DEFAULT NULL' => '1054', ); } diff --git a/core/Updates/0.2.12.php b/core/Updates/0.2.12.php index 72bde57ba1..5712a132ff 100644 --- a/core/Updates/0.2.12.php +++ b/core/Updates/0.2.12.php @@ -8,7 +8,7 @@ * @category Piwik * @package Updates */ -use Piwik\Core\Piwik_Common; +use Piwik\Core\Common; /** * @package Updates @@ -18,14 +18,14 @@ class Piwik_Updates_0_2_12 extends Piwik_Updates static function getSql($schema = 'Myisam') { return array( - 'ALTER TABLE `' . Piwik_Common::prefixTable('site') . '` + 'ALTER TABLE `' . Common::prefixTable('site') . '` CHANGE `ts_created` `ts_created` TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL' => false, - 'ALTER TABLE `' . Piwik_Common::prefixTable('log_visit') . '` + 'ALTER TABLE `' . Common::prefixTable('log_visit') . '` DROP `config_color_depth`' => false, // 0.2.12 [673] // Note: requires INDEX privilege - 'DROP INDEX index_idaction ON `' . Piwik_Common::prefixTable('log_action') . '`' => '1091', + 'DROP INDEX index_idaction ON `' . Common::prefixTable('log_action') . '`' => '1091', ); } diff --git a/core/Updates/0.2.13.php b/core/Updates/0.2.13.php index a70d1d68b8..d548761222 100644 --- a/core/Updates/0.2.13.php +++ b/core/Updates/0.2.13.php @@ -8,7 +8,7 @@ * @category Piwik * @package Updates */ -use Piwik\Core\Piwik_Common; +use Piwik\Core\Common; /** * @package Updates @@ -18,9 +18,9 @@ class Piwik_Updates_0_2_13 extends Piwik_Updates static function getSql($schema = 'Myisam') { return array( - 'DROP TABLE IF EXISTS `' . Piwik_Common::prefixTable('option') . '`' => false, + 'DROP TABLE IF EXISTS `' . Common::prefixTable('option') . '`' => false, - 'CREATE TABLE `' . Piwik_Common::prefixTable('option') . "` ( + 'CREATE TABLE `' . Common::prefixTable('option') . "` ( option_name VARCHAR( 64 ) NOT NULL , option_value LONGTEXT NOT NULL , autoload TINYINT NOT NULL DEFAULT '1', diff --git a/core/Updates/0.2.24.php b/core/Updates/0.2.24.php index e71b829bcd..4533832d90 100644 --- a/core/Updates/0.2.24.php +++ b/core/Updates/0.2.24.php @@ -8,7 +8,7 @@ * @category Piwik * @package Updates */ -use Piwik\Core\Piwik_Common; +use Piwik\Core\Common; /** * @package Updates @@ -19,11 +19,11 @@ class Piwik_Updates_0_2_24 extends Piwik_Updates { return array( 'CREATE INDEX index_type_name - ON ' . Piwik_Common::prefixTable('log_action') . ' (type, name(15))' => false, + ON ' . Common::prefixTable('log_action') . ' (type, name(15))' => false, 'CREATE INDEX index_idsite_date - ON ' . Piwik_Common::prefixTable('log_visit') . ' (idsite, visit_server_date)' => false, - 'DROP INDEX index_idsite ON ' . Piwik_Common::prefixTable('log_visit') => false, - 'DROP INDEX index_visit_server_date ON ' . Piwik_Common::prefixTable('log_visit') => false, + ON ' . Common::prefixTable('log_visit') . ' (idsite, visit_server_date)' => false, + 'DROP INDEX index_idsite ON ' . Common::prefixTable('log_visit') => false, + 'DROP INDEX index_visit_server_date ON ' . Common::prefixTable('log_visit') => false, ); } diff --git a/core/Updates/0.2.27.php b/core/Updates/0.2.27.php index dd43c0eb10..92a738f903 100644 --- a/core/Updates/0.2.27.php +++ b/core/Updates/0.2.27.php @@ -9,7 +9,7 @@ * @package Updates */ use Piwik\Core\Piwik; -use Piwik\Core\Piwik_Common; +use Piwik\Core\Common; /** * @package Updates @@ -19,13 +19,13 @@ class Piwik_Updates_0_2_27 extends Piwik_Updates static function getSql($schema = 'Myisam') { $sqlarray = array( - 'ALTER TABLE `' . Piwik_Common::prefixTable('log_visit') . '` + 'ALTER TABLE `' . Common::prefixTable('log_visit') . '` ADD `visit_goal_converted` VARCHAR( 1 ) NOT NULL AFTER `visit_total_time`' => false, // 0.2.27 [826] - 'ALTER IGNORE TABLE `' . Piwik_Common::prefixTable('log_visit') . '` + 'ALTER IGNORE TABLE `' . Common::prefixTable('log_visit') . '` CHANGE `visit_goal_converted` `visit_goal_converted` TINYINT(1) NOT NULL' => false, - 'CREATE TABLE `' . Piwik_Common::prefixTable('goal') . "` ( + 'CREATE TABLE `' . Common::prefixTable('goal') . "` ( `idsite` int(11) NOT NULL, `idgoal` int(11) NOT NULL, `name` varchar(50) NOT NULL, @@ -38,7 +38,7 @@ class Piwik_Updates_0_2_27 extends Piwik_Updates PRIMARY KEY (`idsite`,`idgoal`) )" => false, - 'CREATE TABLE `' . Piwik_Common::prefixTable('log_conversion') . '` ( + 'CREATE TABLE `' . Common::prefixTable('log_conversion') . '` ( `idvisit` int(10) unsigned NOT NULL, `idsite` int(10) unsigned NOT NULL, `visitor_idcookie` char(32) NOT NULL, diff --git a/core/Updates/0.2.32.php b/core/Updates/0.2.32.php index 921a48ed79..f14b5a5892 100644 --- a/core/Updates/0.2.32.php +++ b/core/Updates/0.2.32.php @@ -8,7 +8,7 @@ * @category Piwik * @package Updates */ -use Piwik\Core\Piwik_Common; +use Piwik\Core\Common; /** * @package Updates @@ -19,13 +19,13 @@ class Piwik_Updates_0_2_32 extends Piwik_Updates { return array( // 0.2.32 [941] - 'ALTER TABLE `' . Piwik_Common::prefixTable('access') . '` + 'ALTER TABLE `' . Common::prefixTable('access') . '` CHANGE `login` `login` VARCHAR( 100 ) NOT NULL' => false, - 'ALTER TABLE `' . Piwik_Common::prefixTable('user') . '` + 'ALTER TABLE `' . Common::prefixTable('user') . '` CHANGE `login` `login` VARCHAR( 100 ) NOT NULL' => false, - 'ALTER TABLE `' . Piwik_Common::prefixTable('user_dashboard') . '` + 'ALTER TABLE `' . Common::prefixTable('user_dashboard') . '` CHANGE `login` `login` VARCHAR( 100 ) NOT NULL' => '1146', - 'ALTER TABLE `' . Piwik_Common::prefixTable('user_language') . '` + 'ALTER TABLE `' . Common::prefixTable('user_language') . '` CHANGE `login` `login` VARCHAR( 100 ) NOT NULL' => '1146', ); } diff --git a/core/Updates/0.2.33.php b/core/Updates/0.2.33.php index ac82c5d5ac..c203db12d4 100644 --- a/core/Updates/0.2.33.php +++ b/core/Updates/0.2.33.php @@ -9,7 +9,7 @@ * @package Updates */ use Piwik\Core\Piwik; -use Piwik\Core\Piwik_Common; +use Piwik\Core\Common; /** * @package Updates @@ -20,9 +20,9 @@ class Piwik_Updates_0_2_33 extends Piwik_Updates { $sqlarray = array( // 0.2.33 [1020] - 'ALTER TABLE `' . Piwik_Common::prefixTable('user_dashboard') . '` + 'ALTER TABLE `' . Common::prefixTable('user_dashboard') . '` CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci ' => '1146', - 'ALTER TABLE `' . Piwik_Common::prefixTable('user_language') . '` + 'ALTER TABLE `' . Common::prefixTable('user_language') . '` CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci ' => '1146', ); diff --git a/core/Updates/0.2.35.php b/core/Updates/0.2.35.php index 70e4c17fdd..90f1b8fd6d 100644 --- a/core/Updates/0.2.35.php +++ b/core/Updates/0.2.35.php @@ -8,7 +8,7 @@ * @category Piwik * @package Updates */ -use Piwik\Core\Piwik_Common; +use Piwik\Core\Common; /** * @package Updates @@ -18,7 +18,7 @@ class Piwik_Updates_0_2_35 extends Piwik_Updates static function getSql($schema = 'Myisam') { return array( - 'ALTER TABLE `' . Piwik_Common::prefixTable('user_dashboard') . '` + 'ALTER TABLE `' . Common::prefixTable('user_dashboard') . '` CHANGE `layout` `layout` TEXT NOT NULL' => false, ); } diff --git a/core/Updates/0.2.37.php b/core/Updates/0.2.37.php index adb9096327..1b3e9ad28e 100644 --- a/core/Updates/0.2.37.php +++ b/core/Updates/0.2.37.php @@ -8,7 +8,7 @@ * @category Piwik * @package Updates */ -use Piwik\Core\Piwik_Common; +use Piwik\Core\Common; /** * @package Updates @@ -18,7 +18,7 @@ class Piwik_Updates_0_2_37 extends Piwik_Updates static function getSql($schema = 'Myisam') { return array( - 'DELETE FROM `' . Piwik_Common::prefixTable('user_dashboard') . "` + 'DELETE FROM `' . Common::prefixTable('user_dashboard') . "` WHERE layout LIKE '%.getLastVisitsGraph%' OR layout LIKE '%.getLastVisitsReturningGraph%'" => false, ); diff --git a/core/Updates/0.4.1.php b/core/Updates/0.4.1.php index bae1d4c793..17d5b27910 100644 --- a/core/Updates/0.4.1.php +++ b/core/Updates/0.4.1.php @@ -8,7 +8,7 @@ * @category Piwik * @package Updates */ -use Piwik\Core\Piwik_Common; +use Piwik\Core\Common; /** * @package Updates @@ -18,9 +18,9 @@ class Piwik_Updates_0_4_1 extends Piwik_Updates static function getSql($schema = 'Myisam') { return array( - 'ALTER TABLE `' . Piwik_Common::prefixTable('log_conversion') . '` + 'ALTER TABLE `' . Common::prefixTable('log_conversion') . '` CHANGE `idlink_va` `idlink_va` INT(11) DEFAULT NULL' => false, - 'ALTER TABLE `' . Piwik_Common::prefixTable('log_conversion') . '` + 'ALTER TABLE `' . Common::prefixTable('log_conversion') . '` CHANGE `idaction` `idaction` INT(11) DEFAULT NULL' => '1054', ); } diff --git a/core/Updates/0.4.2.php b/core/Updates/0.4.2.php index 7b629c97ca..ac931d6357 100644 --- a/core/Updates/0.4.2.php +++ b/core/Updates/0.4.2.php @@ -8,7 +8,7 @@ * @category Piwik * @package Updates */ -use Piwik\Core\Piwik_Common; +use Piwik\Core\Common; /** * @package Updates @@ -18,11 +18,11 @@ class Piwik_Updates_0_4_2 extends Piwik_Updates static function getSql($schema = 'Myisam') { return array( - 'ALTER TABLE `' . Piwik_Common::prefixTable('log_visit') . '` + 'ALTER TABLE `' . Common::prefixTable('log_visit') . '` ADD `config_java` TINYINT(1) NOT NULL AFTER `config_flash`' => '1060', - 'ALTER TABLE `' . Piwik_Common::prefixTable('log_visit') . '` + 'ALTER TABLE `' . Common::prefixTable('log_visit') . '` ADD `config_quicktime` TINYINT(1) NOT NULL AFTER `config_director`' => '1060', - 'ALTER TABLE `' . Piwik_Common::prefixTable('log_visit') . '` + 'ALTER TABLE `' . Common::prefixTable('log_visit') . '` ADD `config_gears` TINYINT(1) NOT NULL AFTER `config_windowsmedia`, ADD `config_silverlight` TINYINT(1) NOT NULL AFTER `config_gears`' => false, ); diff --git a/core/Updates/0.4.php b/core/Updates/0.4.php index 5b578e7800..2ccecc2c16 100644 --- a/core/Updates/0.4.php +++ b/core/Updates/0.4.php @@ -8,7 +8,7 @@ * @category Piwik * @package Updates */ -use Piwik\Core\Piwik_Common; +use Piwik\Core\Common; /** * @package Updates @@ -19,13 +19,13 @@ class Piwik_Updates_0_4 extends Piwik_Updates { return array( // 0.4 [1140] - 'UPDATE `' . Piwik_Common::prefixTable('log_visit') . '` + 'UPDATE `' . Common::prefixTable('log_visit') . '` SET location_ip=location_ip+CAST(POW(2,32) AS UNSIGNED) WHERE location_ip < 0' => false, - 'ALTER TABLE `' . Piwik_Common::prefixTable('log_visit') . '` + 'ALTER TABLE `' . Common::prefixTable('log_visit') . '` CHANGE `location_ip` `location_ip` BIGINT UNSIGNED NOT NULL' => false, - 'UPDATE `' . Piwik_Common::prefixTable('logger_api_call') . '` + 'UPDATE `' . Common::prefixTable('logger_api_call') . '` SET caller_ip=caller_ip+CAST(POW(2,32) AS UNSIGNED) WHERE caller_ip < 0' => false, - 'ALTER TABLE `' . Piwik_Common::prefixTable('logger_api_call') . '` + 'ALTER TABLE `' . Common::prefixTable('logger_api_call') . '` CHANGE `caller_ip` `caller_ip` BIGINT UNSIGNED' => false, ); } diff --git a/core/Updates/0.5.4.php b/core/Updates/0.5.4.php index bde45af871..f5fc2fb90a 100644 --- a/core/Updates/0.5.4.php +++ b/core/Updates/0.5.4.php @@ -9,7 +9,7 @@ * @package Updates */ use Piwik\Core\Config; -use Piwik\Core\Piwik_Common; +use Piwik\Core\Common; /** * @package Updates @@ -19,14 +19,14 @@ class Piwik_Updates_0_5_4 extends Piwik_Updates static function getSql($schema = 'Myisam') { return array( - 'ALTER TABLE `' . Piwik_Common::prefixTable('log_action') . '` + 'ALTER TABLE `' . Common::prefixTable('log_action') . '` CHANGE `name` `name` TEXT' => false, ); } static function update() { - $salt = Piwik_Common::generateUniqId(); + $salt = Common::generateUniqId(); $config = Config::getInstance(); $superuser = $config->superuser; if (!isset($superuser['salt'])) { diff --git a/core/Updates/0.5.5.php b/core/Updates/0.5.5.php index e781f02db2..1cba67d7a9 100644 --- a/core/Updates/0.5.5.php +++ b/core/Updates/0.5.5.php @@ -9,7 +9,7 @@ * @package Updates */ use Piwik\Core\Piwik; -use Piwik\Core\Piwik_Common; +use Piwik\Core\Common; /** * @package Updates @@ -19,8 +19,8 @@ class Piwik_Updates_0_5_5 extends Piwik_Updates static function getSql($schema = 'Myisam') { $sqlarray = array( - 'DROP INDEX index_idsite_date ON ' . Piwik_Common::prefixTable('log_visit') => '1091', - 'CREATE INDEX index_idsite_date_config ON ' . Piwik_Common::prefixTable('log_visit') . ' (idsite, visit_server_date, config_md5config(8))' => '1061', + 'DROP INDEX index_idsite_date ON ' . Common::prefixTable('log_visit') => '1091', + 'CREATE INDEX index_idsite_date_config ON ' . Common::prefixTable('log_visit') . ' (idsite, visit_server_date, config_md5config(8))' => '1061', ); $tables = Piwik::getTablesInstalled(); diff --git a/core/Updates/0.5.php b/core/Updates/0.5.php index 1a01bcf5f1..d465f9c225 100644 --- a/core/Updates/0.5.php +++ b/core/Updates/0.5.php @@ -8,7 +8,7 @@ * @category Piwik * @package Updates */ -use Piwik\Core\Piwik_Common; +use Piwik\Core\Common; /** * @package Updates @@ -18,16 +18,16 @@ class Piwik_Updates_0_5 extends Piwik_Updates static function getSql($schema = 'Myisam') { return array( - 'ALTER TABLE ' . Piwik_Common::prefixTable('log_action') . ' ADD COLUMN `hash` INTEGER(10) UNSIGNED NOT NULL AFTER `name`;' => '1060', - 'ALTER TABLE ' . Piwik_Common::prefixTable('log_visit') . ' CHANGE visit_exit_idaction visit_exit_idaction_url INTEGER(11) NOT NULL;' => '1054', - 'ALTER TABLE ' . Piwik_Common::prefixTable('log_visit') . ' CHANGE visit_entry_idaction visit_entry_idaction_url INTEGER(11) NOT NULL;' => '1054', - 'ALTER TABLE ' . Piwik_Common::prefixTable('log_link_visit_action') . ' CHANGE `idaction_ref` `idaction_url_ref` INTEGER(10) UNSIGNED NOT NULL;' => '1054', - 'ALTER TABLE ' . Piwik_Common::prefixTable('log_link_visit_action') . ' CHANGE `idaction` `idaction_url` INTEGER(10) UNSIGNED NOT NULL;' => '1054', - 'ALTER TABLE ' . Piwik_Common::prefixTable('log_link_visit_action') . ' ADD COLUMN `idaction_name` INTEGER(10) UNSIGNED AFTER `idaction_url_ref`;' => '1060', - 'ALTER TABLE ' . Piwik_Common::prefixTable('log_conversion') . ' CHANGE `idaction` `idaction_url` INTEGER(11) UNSIGNED NOT NULL;' => '1054', - 'UPDATE ' . Piwik_Common::prefixTable('log_action') . ' SET `hash` = CRC32(name);' => false, - 'CREATE INDEX index_type_hash ON ' . Piwik_Common::prefixTable('log_action') . ' (type, hash);' => '1061', - 'DROP INDEX index_type_name ON ' . Piwik_Common::prefixTable('log_action') . ';' => '1091', + 'ALTER TABLE ' . Common::prefixTable('log_action') . ' ADD COLUMN `hash` INTEGER(10) UNSIGNED NOT NULL AFTER `name`;' => '1060', + 'ALTER TABLE ' . Common::prefixTable('log_visit') . ' CHANGE visit_exit_idaction visit_exit_idaction_url INTEGER(11) NOT NULL;' => '1054', + 'ALTER TABLE ' . Common::prefixTable('log_visit') . ' CHANGE visit_entry_idaction visit_entry_idaction_url INTEGER(11) NOT NULL;' => '1054', + 'ALTER TABLE ' . Common::prefixTable('log_link_visit_action') . ' CHANGE `idaction_ref` `idaction_url_ref` INTEGER(10) UNSIGNED NOT NULL;' => '1054', + 'ALTER TABLE ' . Common::prefixTable('log_link_visit_action') . ' CHANGE `idaction` `idaction_url` INTEGER(10) UNSIGNED NOT NULL;' => '1054', + 'ALTER TABLE ' . Common::prefixTable('log_link_visit_action') . ' ADD COLUMN `idaction_name` INTEGER(10) UNSIGNED AFTER `idaction_url_ref`;' => '1060', + 'ALTER TABLE ' . Common::prefixTable('log_conversion') . ' CHANGE `idaction` `idaction_url` INTEGER(11) UNSIGNED NOT NULL;' => '1054', + 'UPDATE ' . Common::prefixTable('log_action') . ' SET `hash` = CRC32(name);' => false, + 'CREATE INDEX index_type_hash ON ' . Common::prefixTable('log_action') . ' (type, hash);' => '1061', + 'DROP INDEX index_type_name ON ' . Common::prefixTable('log_action') . ';' => '1091', ); } diff --git a/core/Updates/0.6-rc1.php b/core/Updates/0.6-rc1.php index b1e83f3d3b..bde19cff94 100644 --- a/core/Updates/0.6-rc1.php +++ b/core/Updates/0.6-rc1.php @@ -8,7 +8,7 @@ * @category Piwik * @package Updates */ -use Piwik\Core\Piwik_Common; +use Piwik\Core\Common; /** * @package Updates @@ -20,19 +20,19 @@ class Piwik_Updates_0_6_rc1 extends Piwik_Updates $defaultTimezone = 'UTC'; $defaultCurrency = 'USD'; return array( - 'ALTER TABLE ' . Piwik_Common::prefixTable('user') . ' CHANGE date_registered date_registered TIMESTAMP NULL' => false, - 'ALTER TABLE ' . Piwik_Common::prefixTable('site') . ' CHANGE ts_created ts_created TIMESTAMP NULL' => false, - 'ALTER TABLE ' . Piwik_Common::prefixTable('site') . ' ADD `timezone` VARCHAR( 50 ) NOT NULL AFTER `ts_created` ;' => false, - 'UPDATE ' . Piwik_Common::prefixTable('site') . ' SET `timezone` = "' . $defaultTimezone . '";' => false, - 'ALTER TABLE ' . Piwik_Common::prefixTable('site') . ' ADD currency CHAR( 3 ) NOT NULL AFTER `timezone` ;' => false, - 'UPDATE ' . Piwik_Common::prefixTable('site') . ' SET `currency` = "' . $defaultCurrency . '";' => false, - 'ALTER TABLE ' . Piwik_Common::prefixTable('site') . ' ADD `excluded_ips` TEXT NOT NULL AFTER `currency` ;' => false, - 'ALTER TABLE ' . Piwik_Common::prefixTable('site') . ' ADD excluded_parameters VARCHAR( 255 ) NOT NULL AFTER `excluded_ips` ;' => false, - 'ALTER TABLE ' . Piwik_Common::prefixTable('log_visit') . ' ADD INDEX `index_idsite_datetime_config` ( `idsite` , `visit_last_action_time` , `config_md5config` ( 8 ) ) ;' => false, - 'ALTER TABLE ' . Piwik_Common::prefixTable('log_visit') . ' ADD INDEX index_idsite_idvisit (idsite, idvisit) ;' => false, - 'ALTER TABLE ' . Piwik_Common::prefixTable('log_conversion') . ' DROP INDEX index_idsite_date' => false, - 'ALTER TABLE ' . Piwik_Common::prefixTable('log_conversion') . ' DROP visit_server_date;' => false, - 'ALTER TABLE ' . Piwik_Common::prefixTable('log_conversion') . ' ADD INDEX index_idsite_datetime ( `idsite` , `server_time` )' => false, + 'ALTER TABLE ' . Common::prefixTable('user') . ' CHANGE date_registered date_registered TIMESTAMP NULL' => false, + 'ALTER TABLE ' . Common::prefixTable('site') . ' CHANGE ts_created ts_created TIMESTAMP NULL' => false, + 'ALTER TABLE ' . Common::prefixTable('site') . ' ADD `timezone` VARCHAR( 50 ) NOT NULL AFTER `ts_created` ;' => false, + 'UPDATE ' . Common::prefixTable('site') . ' SET `timezone` = "' . $defaultTimezone . '";' => false, + 'ALTER TABLE ' . Common::prefixTable('site') . ' ADD currency CHAR( 3 ) NOT NULL AFTER `timezone` ;' => false, + 'UPDATE ' . Common::prefixTable('site') . ' SET `currency` = "' . $defaultCurrency . '";' => false, + 'ALTER TABLE ' . Common::prefixTable('site') . ' ADD `excluded_ips` TEXT NOT NULL AFTER `currency` ;' => false, + 'ALTER TABLE ' . Common::prefixTable('site') . ' ADD excluded_parameters VARCHAR( 255 ) NOT NULL AFTER `excluded_ips` ;' => false, + 'ALTER TABLE ' . Common::prefixTable('log_visit') . ' ADD INDEX `index_idsite_datetime_config` ( `idsite` , `visit_last_action_time` , `config_md5config` ( 8 ) ) ;' => false, + 'ALTER TABLE ' . Common::prefixTable('log_visit') . ' ADD INDEX index_idsite_idvisit (idsite, idvisit) ;' => false, + 'ALTER TABLE ' . Common::prefixTable('log_conversion') . ' DROP INDEX index_idsite_date' => false, + 'ALTER TABLE ' . Common::prefixTable('log_conversion') . ' DROP visit_server_date;' => false, + 'ALTER TABLE ' . Common::prefixTable('log_conversion') . ' ADD INDEX index_idsite_datetime ( `idsite` , `server_time` )' => false, ); } diff --git a/core/Updates/0.6.3.php b/core/Updates/0.6.3.php index 82041c3620..7b2c21accc 100644 --- a/core/Updates/0.6.3.php +++ b/core/Updates/0.6.3.php @@ -9,7 +9,7 @@ * @package Updates */ use Piwik\Core\Config; -use Piwik\Core\Piwik_Common; +use Piwik\Core\Common; /** * @package Updates @@ -19,9 +19,9 @@ class Piwik_Updates_0_6_3 extends Piwik_Updates static function getSql($schema = 'Myisam') { return array( - 'ALTER TABLE `' . Piwik_Common::prefixTable('log_visit') . '` + 'ALTER TABLE `' . Common::prefixTable('log_visit') . '` CHANGE `location_ip` `location_ip` INT UNSIGNED NOT NULL' => false, - 'ALTER TABLE `' . Piwik_Common::prefixTable('logger_api_call') . '` + 'ALTER TABLE `' . Common::prefixTable('logger_api_call') . '` CHANGE `caller_ip` `caller_ip` INT UNSIGNED' => false, ); } diff --git a/core/Updates/0.7.php b/core/Updates/0.7.php index fa153883a9..d50796fc20 100644 --- a/core/Updates/0.7.php +++ b/core/Updates/0.7.php @@ -8,7 +8,7 @@ * @category Piwik * @package Updates */ -use Piwik\Core\Piwik_Common; +use Piwik\Core\Common; /** * @package Updates @@ -18,7 +18,7 @@ class Piwik_Updates_0_7 extends Piwik_Updates static function getSql($schema = 'Myisam') { return array( - 'ALTER TABLE `' . Piwik_Common::prefixTable('option') . '` + 'ALTER TABLE `' . Common::prefixTable('option') . '` CHANGE `option_name` `option_name` VARCHAR(255) NOT NULL' => false, ); } diff --git a/core/Updates/0.9.1.php b/core/Updates/0.9.1.php index 31998ad17d..f76928c314 100644 --- a/core/Updates/0.9.1.php +++ b/core/Updates/0.9.1.php @@ -9,7 +9,7 @@ * @package Updates */ use Piwik\Core\Piwik; -use Piwik\Core\Piwik_Common; +use Piwik\Core\Common; /** * @package Updates @@ -35,11 +35,11 @@ class Piwik_Updates_0_9_1 extends Piwik_Updates $timezoneList = '"' . implode('","', $brokenTZ) . '"'; return array( - 'UPDATE ' . Piwik_Common::prefixTable('site') . ' + 'UPDATE ' . Common::prefixTable('site') . ' SET timezone = "UTC" WHERE timezone IN (' . $timezoneList . ')' => false, - 'UPDATE `' . Piwik_Common::prefixTable('option') . '` + 'UPDATE `' . Common::prefixTable('option') . '` SET option_value = "UTC" WHERE option_name = "SitesManager_DefaultTimezone" AND option_value IN (' . $timezoneList . ')' => false, diff --git a/core/Updates/1.10.2-b1.php b/core/Updates/1.10.2-b1.php index 10a28c6143..f6c09c6e47 100755 --- a/core/Updates/1.10.2-b1.php +++ b/core/Updates/1.10.2-b1.php @@ -8,7 +8,7 @@ * @category Piwik * @package Updates */ -use Piwik\Core\Piwik_Common; +use Piwik\Core\Common; /** * @package Updates @@ -19,7 +19,7 @@ class Piwik_Updates_1_10_2_b1 extends Piwik_Updates { return array( // ignore existing column name error (1060) - 'ALTER TABLE ' . Piwik_Common::prefixTable('report') + 'ALTER TABLE ' . Common::prefixTable('report') . " ADD COLUMN hour tinyint NOT NULL default 0 AFTER period" => 1060, ); } diff --git a/core/Updates/1.10.2-b2.php b/core/Updates/1.10.2-b2.php index 7c05ea806c..fd0907ab97 100644 --- a/core/Updates/1.10.2-b2.php +++ b/core/Updates/1.10.2-b2.php @@ -8,7 +8,7 @@ * @category Piwik * @package Updates */ -use Piwik\Core\Piwik_Common; +use Piwik\Core\Common; /** * @package Updates @@ -19,7 +19,7 @@ class Piwik_Updates_1_10_2_b2 extends Piwik_Updates { return array( // ignore existing column name error (1060) - 'ALTER TABLE ' . Piwik_Common::prefixTable('site') + 'ALTER TABLE ' . Common::prefixTable('site') . " ADD COLUMN `keep_url_fragment` TINYINT NOT NULL DEFAULT 0 AFTER `group`" => 1060, ); } diff --git a/core/Updates/1.12-b1.php b/core/Updates/1.12-b1.php index c91dbb1df0..44c9eccd9d 100644 --- a/core/Updates/1.12-b1.php +++ b/core/Updates/1.12-b1.php @@ -8,7 +8,7 @@ * @category Piwik * @package Updates */ -use Piwik\Core\Piwik_Common; +use Piwik\Core\Common; /** * @package Updates @@ -23,7 +23,7 @@ class Piwik_Updates_1_12_b1 extends Piwik_Updates static function getSql($schema = 'Myisam') { return array( - 'ALTER TABLE `' . Piwik_Common::prefixTable('log_link_visit_action') . '` + 'ALTER TABLE `' . Common::prefixTable('log_link_visit_action') . '` ADD `custom_float` FLOAT NULL DEFAULT NULL' => 1060 ); } diff --git a/core/Updates/1.12-b16.php b/core/Updates/1.12-b16.php index fb5ba2a9a6..29cfa88489 100644 --- a/core/Updates/1.12-b16.php +++ b/core/Updates/1.12-b16.php @@ -8,7 +8,7 @@ * @category Piwik * @package Updates */ -use Piwik\Core\Piwik_Common; +use Piwik\Core\Common; /** * @package Updates @@ -19,7 +19,7 @@ class Piwik_Updates_1_12_b16 extends Piwik_Updates { return array( // ignore existing column name error (1060) - 'ALTER TABLE ' . Piwik_Common::prefixTable('report') + 'ALTER TABLE ' . Common::prefixTable('report') . " ADD COLUMN idsegment INT(11) AFTER description" => 1060, ); } diff --git a/core/Updates/1.2-rc1.php b/core/Updates/1.2-rc1.php index 7f36539f7b..beb3b97034 100644 --- a/core/Updates/1.2-rc1.php +++ b/core/Updates/1.2-rc1.php @@ -8,7 +8,7 @@ * @category Piwik * @package Updates */ -use Piwik\Core\Piwik_Common; +use Piwik\Core\Common; /** * @package Updates @@ -19,7 +19,7 @@ class Piwik_Updates_1_2_rc1 extends Piwik_Updates { return array( // Various performance improvements schema updates - 'ALTER TABLE `' . Piwik_Common::prefixTable('log_visit') . '` + 'ALTER TABLE `' . Common::prefixTable('log_visit') . '` DROP `visit_server_date`, DROP INDEX `index_idsite_date_config`, DROP INDEX `index_idsite_datetime_config`, @@ -44,7 +44,7 @@ class Piwik_Updates_1_2_rc1 extends Piwik_Updates ADD custom_var_k5 VARCHAR(100) DEFAULT NULL, ADD custom_var_v5 VARCHAR(100) DEFAULT NULL ' => false, - 'ALTER TABLE `' . Piwik_Common::prefixTable('log_link_visit_action') . '` + 'ALTER TABLE `' . Common::prefixTable('log_link_visit_action') . '` ADD `idsite` INT( 10 ) UNSIGNED NOT NULL AFTER `idlink_va` , ADD `server_time` DATETIME AFTER `idsite`, ADD `idvisitor` BINARY(8) NOT NULL AFTER `idsite`, @@ -52,7 +52,7 @@ class Piwik_Updates_1_2_rc1 extends Piwik_Updates ADD INDEX `index_idsite_servertime` ( `idsite` , `server_time` ) ' => false, - 'ALTER TABLE `' . Piwik_Common::prefixTable('log_conversion') . '` + 'ALTER TABLE `' . Common::prefixTable('log_conversion') . '` DROP `referer_idvisit`, ADD `idvisitor` BINARY(8) NOT NULL AFTER `idsite`, ADD visitor_count_visits SMALLINT(5) UNSIGNED NOT NULL, @@ -70,46 +70,46 @@ class Piwik_Updates_1_2_rc1 extends Piwik_Updates ' => false, // Migrate 128bits IDs inefficiently stored as 8bytes (256 bits) into 64bits - 'UPDATE ' . Piwik_Common::prefixTable('log_visit') . ' + 'UPDATE ' . Common::prefixTable('log_visit') . ' SET idvisitor = binary(unhex(substring(visitor_idcookie,1,16))), config_id = binary(unhex(substring(config_md5config,1,16))) ' => false, - 'UPDATE ' . Piwik_Common::prefixTable('log_conversion') . ' + 'UPDATE ' . Common::prefixTable('log_conversion') . ' SET idvisitor = binary(unhex(substring(visitor_idcookie,1,16))) ' => false, // Drop migrated fields - 'ALTER TABLE `' . Piwik_Common::prefixTable('log_visit') . '` + 'ALTER TABLE `' . Common::prefixTable('log_visit') . '` DROP visitor_idcookie, DROP config_md5config ' => false, - 'ALTER TABLE `' . Piwik_Common::prefixTable('log_conversion') . '` + 'ALTER TABLE `' . Common::prefixTable('log_conversion') . '` DROP visitor_idcookie ' => false, // Recreate INDEX on new field - 'ALTER TABLE `' . Piwik_Common::prefixTable('log_visit') . '` + 'ALTER TABLE `' . Common::prefixTable('log_visit') . '` ADD INDEX `index_idsite_datetime_config` (idsite, visit_last_action_time, config_id) ' => false, // Backfill action logs as best as we can - 'UPDATE ' . Piwik_Common::prefixTable('log_link_visit_action') . ' as action, - ' . Piwik_Common::prefixTable('log_visit') . ' as visit + 'UPDATE ' . Common::prefixTable('log_link_visit_action') . ' as action, + ' . Common::prefixTable('log_visit') . ' as visit SET action.idsite = visit.idsite, action.server_time = visit.visit_last_action_time, action.idvisitor = visit.idvisitor WHERE action.idvisit=visit.idvisit ' => false, - 'ALTER TABLE `' . Piwik_Common::prefixTable('log_link_visit_action') . '` + 'ALTER TABLE `' . Common::prefixTable('log_link_visit_action') . '` CHANGE `server_time` `server_time` DATETIME NOT NULL ' => false, // New index used max once per request, in case this table grows significantly in the future - 'ALTER TABLE `' . Piwik_Common::prefixTable('option') . '` ADD INDEX ( `autoload` ) ' => false, + 'ALTER TABLE `' . Common::prefixTable('option') . '` ADD INDEX ( `autoload` ) ' => false, // new field for websites - 'ALTER TABLE `' . Piwik_Common::prefixTable('site') . '` ADD `group` VARCHAR( 250 ) NOT NULL' => false, + 'ALTER TABLE `' . Common::prefixTable('site') . '` ADD `group` VARCHAR( 250 ) NOT NULL' => false, ); } diff --git a/core/Updates/1.2.3.php b/core/Updates/1.2.3.php index 066cea1a82..c7cc2ce03c 100644 --- a/core/Updates/1.2.3.php +++ b/core/Updates/1.2.3.php @@ -9,7 +9,7 @@ * @package Updates */ use Piwik\Core\Config; -use Piwik\Core\Piwik_Common; +use Piwik\Core\Common; /** * @package Updates @@ -23,7 +23,7 @@ class Piwik_Updates_1_2_3 extends Piwik_Updates 'ALTER DATABASE `' . Config::getInstance()->database['dbname'] . '` DEFAULT CHARACTER SET utf8' => false, // Various performance improvements schema updates - 'ALTER TABLE `' . Piwik_Common::prefixTable('log_visit') . '` + 'ALTER TABLE `' . Common::prefixTable('log_visit') . '` DROP INDEX index_idsite_datetime_config, DROP INDEX index_idsite_idvisit, ADD INDEX index_idsite_config_datetime (idsite, config_id, visit_last_action_time), diff --git a/core/Updates/1.2.5-rc1.php b/core/Updates/1.2.5-rc1.php index d17bfd3825..7eafdd9ad9 100644 --- a/core/Updates/1.2.5-rc1.php +++ b/core/Updates/1.2.5-rc1.php @@ -8,7 +8,7 @@ * @category Piwik * @package Updates */ -use Piwik\Core\Piwik_Common; +use Piwik\Core\Common; /** * @package Updates @@ -18,9 +18,9 @@ class Piwik_Updates_1_2_5_rc1 extends Piwik_Updates static function getSql($schema = 'Myisam') { return array( - 'ALTER TABLE `' . Piwik_Common::prefixTable('goal') . '` + 'ALTER TABLE `' . Common::prefixTable('goal') . '` ADD `allow_multiple` tinyint(4) NOT NULL AFTER case_sensitive' => false, - 'ALTER TABLE `' . Piwik_Common::prefixTable('log_conversion') . '` + 'ALTER TABLE `' . Common::prefixTable('log_conversion') . '` ADD buster int unsigned NOT NULL AFTER revenue, DROP PRIMARY KEY, ADD PRIMARY KEY (idvisit, idgoal, buster)' => false, diff --git a/core/Updates/1.2.5-rc7.php b/core/Updates/1.2.5-rc7.php index b1da1cd65a..f1b8805228 100644 --- a/core/Updates/1.2.5-rc7.php +++ b/core/Updates/1.2.5-rc7.php @@ -8,7 +8,7 @@ * @category Piwik * @package Updates */ -use Piwik\Core\Piwik_Common; +use Piwik\Core\Common; /** * @package Updates @@ -18,7 +18,7 @@ class Piwik_Updates_1_2_5_rc7 extends Piwik_Updates static function getSql($schema = 'Myisam') { return array( - 'ALTER TABLE `' . Piwik_Common::prefixTable('log_visit') . '` + 'ALTER TABLE `' . Common::prefixTable('log_visit') . '` ADD INDEX index_idsite_idvisitor (idsite, idvisitor)' => false, ); } diff --git a/core/Updates/1.4-rc1.php b/core/Updates/1.4-rc1.php index 52e5589959..794c512e67 100644 --- a/core/Updates/1.4-rc1.php +++ b/core/Updates/1.4-rc1.php @@ -8,7 +8,7 @@ * @category Piwik * @package Updates */ -use Piwik\Core\Piwik_Common; +use Piwik\Core\Common; /** * @package Updates @@ -18,9 +18,9 @@ class Piwik_Updates_1_4_rc1 extends Piwik_Updates static function getSql($schema = 'Myisam') { return array( - 'ALTER TABLE `' . Piwik_Common::prefixTable('pdf') . '` + 'ALTER TABLE `' . Common::prefixTable('pdf') . '` ADD COLUMN `format` VARCHAR(10)' => false, - 'UPDATE `' . Piwik_Common::prefixTable('pdf') . '` + 'UPDATE `' . Common::prefixTable('pdf') . '` SET format = "pdf"' => false, ); } diff --git a/core/Updates/1.4-rc2.php b/core/Updates/1.4-rc2.php index f38e8208a0..a25e69ffc7 100644 --- a/core/Updates/1.4-rc2.php +++ b/core/Updates/1.4-rc2.php @@ -8,7 +8,7 @@ * @category Piwik * @package Updates */ -use Piwik\Core\Piwik_Common; +use Piwik\Core\Common; /** * @package Updates @@ -21,16 +21,16 @@ class Piwik_Updates_1_4_rc2 extends Piwik_Updates "SET sql_mode=''" => false, // this converts the 32-bit UNSIGNED INT column to a 16 byte VARBINARY; // _but_ MySQL does string conversion! (e.g., integer 1 is converted to 49 -- the ASCII code for "1") - 'ALTER TABLE ' . Piwik_Common::prefixTable('log_visit') . ' + 'ALTER TABLE ' . Common::prefixTable('log_visit') . ' MODIFY location_ip VARBINARY(16) NOT NULL' => false, - 'ALTER TABLE ' . Piwik_Common::prefixTable('logger_api_call') . ' + 'ALTER TABLE ' . Common::prefixTable('logger_api_call') . ' MODIFY caller_ip VARBINARY(16) NOT NULL' => false, // fortunately, 2^32 is 10 digits long and fits in the VARBINARY(16) without truncation; // to fix this, we cast to an integer, convert to hex, pad out leading zeros, and unhex it - 'UPDATE ' . Piwik_Common::prefixTable('log_visit') . " + 'UPDATE ' . Common::prefixTable('log_visit') . " SET location_ip = UNHEX(LPAD(HEX(CONVERT(location_ip, UNSIGNED)), 8, '0'))" => false, - 'UPDATE ' . Piwik_Common::prefixTable('logger_api_call') . " + 'UPDATE ' . Common::prefixTable('logger_api_call') . " SET caller_ip = UNHEX(LPAD(HEX(CONVERT(caller_ip, UNSIGNED)), 8, '0'))" => false, ); } diff --git a/core/Updates/1.5-b1.php b/core/Updates/1.5-b1.php index ba72c69a3f..a8c7b76d31 100644 --- a/core/Updates/1.5-b1.php +++ b/core/Updates/1.5-b1.php @@ -8,7 +8,7 @@ * @category Piwik * @package Updates */ -use Piwik\Core\Piwik_Common; +use Piwik\Core\Common; /** * @package Updates @@ -18,7 +18,7 @@ class Piwik_Updates_1_5_b1 extends Piwik_Updates static function getSql($schema = 'Myisam') { return array( - 'CREATE TABLE `' . Piwik_Common::prefixTable('log_conversion_item') . '` ( + 'CREATE TABLE `' . Common::prefixTable('log_conversion_item') . '` ( idsite int(10) UNSIGNED NOT NULL, idvisitor BINARY(8) NOT NULL, server_time DATETIME NOT NULL, @@ -36,11 +36,11 @@ class Piwik_Updates_1_5_b1 extends Piwik_Updates INDEX index_idsite_servertime ( idsite, server_time ) ) DEFAULT CHARSET=utf8 ' => false, - 'ALTER IGNORE TABLE `' . Piwik_Common::prefixTable('log_visit') . '` + 'ALTER IGNORE TABLE `' . Common::prefixTable('log_visit') . '` ADD visitor_days_since_order SMALLINT(5) UNSIGNED NOT NULL AFTER visitor_days_since_last, ADD visit_goal_buyer TINYINT(1) NOT NULL AFTER visit_goal_converted' => false, - 'ALTER IGNORE TABLE `' . Piwik_Common::prefixTable('log_conversion') . '` + 'ALTER IGNORE TABLE `' . Common::prefixTable('log_conversion') . '` ADD visitor_days_since_order SMALLINT(5) UNSIGNED NOT NULL AFTER visitor_days_since_first, ADD idorder varchar(100) default NULL AFTER buster, ADD items SMALLINT UNSIGNED DEFAULT NULL, diff --git a/core/Updates/1.5-b2.php b/core/Updates/1.5-b2.php index 4711c7a97f..9544271bce 100644 --- a/core/Updates/1.5-b2.php +++ b/core/Updates/1.5-b2.php @@ -8,7 +8,7 @@ * @category Piwik * @package Updates */ -use Piwik\Core\Piwik_Common; +use Piwik\Core\Common; /** * @package Updates @@ -18,7 +18,7 @@ class Piwik_Updates_1_5_b2 extends Piwik_Updates static function getSql($schema = 'Myisam') { return array( - 'ALTER TABLE `' . Piwik_Common::prefixTable('log_link_visit_action') . '` + 'ALTER TABLE `' . Common::prefixTable('log_link_visit_action') . '` ADD custom_var_k1 VARCHAR(100) DEFAULT NULL AFTER time_spent_ref_action, ADD custom_var_v1 VARCHAR(100) DEFAULT NULL, ADD custom_var_k2 VARCHAR(100) DEFAULT NULL, diff --git a/core/Updates/1.5-b3.php b/core/Updates/1.5-b3.php index 2beb4ad583..6f72eb6ac5 100644 --- a/core/Updates/1.5-b3.php +++ b/core/Updates/1.5-b3.php @@ -8,7 +8,7 @@ * @category Piwik * @package Updates */ -use Piwik\Core\Piwik_Common; +use Piwik\Core\Common; /** * @package Updates @@ -18,7 +18,7 @@ class Piwik_Updates_1_5_b3 extends Piwik_Updates static function getSql($schema = 'Myisam') { return array( - 'ALTER TABLE `' . Piwik_Common::prefixTable('log_visit') . '` + 'ALTER TABLE `' . Common::prefixTable('log_visit') . '` CHANGE custom_var_k1 custom_var_k1 VARCHAR(100) DEFAULT NULL, CHANGE custom_var_v1 custom_var_v1 VARCHAR(100) DEFAULT NULL, CHANGE custom_var_k2 custom_var_k2 VARCHAR(100) DEFAULT NULL, @@ -29,7 +29,7 @@ class Piwik_Updates_1_5_b3 extends Piwik_Updates CHANGE custom_var_v4 custom_var_v4 VARCHAR(100) DEFAULT NULL, CHANGE custom_var_k5 custom_var_k5 VARCHAR(100) DEFAULT NULL, CHANGE custom_var_v5 custom_var_v5 VARCHAR(100) DEFAULT NULL' => false, - 'ALTER TABLE `' . Piwik_Common::prefixTable('log_conversion') . '` + 'ALTER TABLE `' . Common::prefixTable('log_conversion') . '` CHANGE custom_var_k1 custom_var_k1 VARCHAR(100) DEFAULT NULL, CHANGE custom_var_v1 custom_var_v1 VARCHAR(100) DEFAULT NULL, CHANGE custom_var_k2 custom_var_k2 VARCHAR(100) DEFAULT NULL, @@ -40,7 +40,7 @@ class Piwik_Updates_1_5_b3 extends Piwik_Updates CHANGE custom_var_v4 custom_var_v4 VARCHAR(100) DEFAULT NULL, CHANGE custom_var_k5 custom_var_k5 VARCHAR(100) DEFAULT NULL, CHANGE custom_var_v5 custom_var_v5 VARCHAR(100) DEFAULT NULL' => false, - 'ALTER TABLE `' . Piwik_Common::prefixTable('log_link_visit_action') . '` + 'ALTER TABLE `' . Common::prefixTable('log_link_visit_action') . '` CHANGE custom_var_k1 custom_var_k1 VARCHAR(100) DEFAULT NULL, CHANGE custom_var_v1 custom_var_v1 VARCHAR(100) DEFAULT NULL, CHANGE custom_var_k2 custom_var_k2 VARCHAR(100) DEFAULT NULL, diff --git a/core/Updates/1.5-b4.php b/core/Updates/1.5-b4.php index dcf67cf04d..5a869301ed 100644 --- a/core/Updates/1.5-b4.php +++ b/core/Updates/1.5-b4.php @@ -8,7 +8,7 @@ * @category Piwik * @package Updates */ -use Piwik\Core\Piwik_Common; +use Piwik\Core\Common; /** * @package Updates @@ -18,7 +18,7 @@ class Piwik_Updates_1_5_b4 extends Piwik_Updates static function getSql($schema = 'Myisam') { return array( - 'ALTER TABLE `' . Piwik_Common::prefixTable('site') . '` + 'ALTER TABLE `' . Common::prefixTable('site') . '` ADD ecommerce TINYINT DEFAULT 0' => false, ); } diff --git a/core/Updates/1.5-b5.php b/core/Updates/1.5-b5.php index 87913e6153..76729f4270 100644 --- a/core/Updates/1.5-b5.php +++ b/core/Updates/1.5-b5.php @@ -8,7 +8,7 @@ * @category Piwik * @package Updates */ -use Piwik\Core\Piwik_Common; +use Piwik\Core\Common; /** * @package Updates @@ -18,7 +18,7 @@ class Piwik_Updates_1_5_b5 extends Piwik_Updates static function getSql($schema = 'Myisam') { return array( - 'CREATE TABLE `' . Piwik_Common::prefixTable('session') . '` ( + 'CREATE TABLE `' . Common::prefixTable('session') . '` ( id CHAR(32) NOT NULL, modified INTEGER, lifetime INTEGER, diff --git a/core/Updates/1.6-b1.php b/core/Updates/1.6-b1.php index f8d87d9945..ef54c76b44 100644 --- a/core/Updates/1.6-b1.php +++ b/core/Updates/1.6-b1.php @@ -8,7 +8,7 @@ * @category Piwik * @package Updates */ -use Piwik\Core\Piwik_Common; +use Piwik\Core\Common; /** * @package Updates @@ -18,12 +18,12 @@ class Piwik_Updates_1_6_b1 extends Piwik_Updates static function getSql($schema = 'Myisam') { return array( - 'ALTER TABLE `' . Piwik_Common::prefixTable('log_conversion_item') . '` + 'ALTER TABLE `' . Common::prefixTable('log_conversion_item') . '` ADD idaction_category2 INTEGER(10) UNSIGNED NOT NULL AFTER idaction_category, ADD idaction_category3 INTEGER(10) UNSIGNED NOT NULL, ADD idaction_category4 INTEGER(10) UNSIGNED NOT NULL, ADD idaction_category5 INTEGER(10) UNSIGNED NOT NULL' => false, - 'ALTER TABLE `' . Piwik_Common::prefixTable('log_visit') . '` + 'ALTER TABLE `' . Common::prefixTable('log_visit') . '` CHANGE custom_var_k1 custom_var_k1 VARCHAR(200) DEFAULT NULL, CHANGE custom_var_v1 custom_var_v1 VARCHAR(200) DEFAULT NULL, CHANGE custom_var_k2 custom_var_k2 VARCHAR(200) DEFAULT NULL, @@ -34,7 +34,7 @@ class Piwik_Updates_1_6_b1 extends Piwik_Updates CHANGE custom_var_v4 custom_var_v4 VARCHAR(200) DEFAULT NULL, CHANGE custom_var_k5 custom_var_k5 VARCHAR(200) DEFAULT NULL, CHANGE custom_var_v5 custom_var_v5 VARCHAR(200) DEFAULT NULL' => false, - 'ALTER TABLE `' . Piwik_Common::prefixTable('log_conversion') . '` + 'ALTER TABLE `' . Common::prefixTable('log_conversion') . '` CHANGE custom_var_k1 custom_var_k1 VARCHAR(200) DEFAULT NULL, CHANGE custom_var_v1 custom_var_v1 VARCHAR(200) DEFAULT NULL, CHANGE custom_var_k2 custom_var_k2 VARCHAR(200) DEFAULT NULL, @@ -45,7 +45,7 @@ class Piwik_Updates_1_6_b1 extends Piwik_Updates CHANGE custom_var_v4 custom_var_v4 VARCHAR(200) DEFAULT NULL, CHANGE custom_var_k5 custom_var_k5 VARCHAR(200) DEFAULT NULL, CHANGE custom_var_v5 custom_var_v5 VARCHAR(200) DEFAULT NULL' => false, - 'ALTER TABLE `' . Piwik_Common::prefixTable('log_link_visit_action') . '` + 'ALTER TABLE `' . Common::prefixTable('log_link_visit_action') . '` CHANGE custom_var_k1 custom_var_k1 VARCHAR(200) DEFAULT NULL, CHANGE custom_var_v1 custom_var_v1 VARCHAR(200) DEFAULT NULL, CHANGE custom_var_k2 custom_var_k2 VARCHAR(200) DEFAULT NULL, diff --git a/core/Updates/1.7-b1.php b/core/Updates/1.7-b1.php index 62632a5183..2b4567e978 100644 --- a/core/Updates/1.7-b1.php +++ b/core/Updates/1.7-b1.php @@ -8,7 +8,7 @@ * @category Piwik * @package Updates */ -use Piwik\Core\Piwik_Common; +use Piwik\Core\Common; /** * @package Updates @@ -18,9 +18,9 @@ class Piwik_Updates_1_7_b1 extends Piwik_Updates static function getSql($schema = 'Myisam') { return array( - 'ALTER TABLE `' . Piwik_Common::prefixTable('pdf') . '` + 'ALTER TABLE `' . Common::prefixTable('pdf') . '` ADD COLUMN `aggregate_reports_format` TINYINT(1) NOT NULL AFTER `reports`' => false, - 'UPDATE `' . Piwik_Common::prefixTable('pdf') . '` + 'UPDATE `' . Common::prefixTable('pdf') . '` SET `aggregate_reports_format` = 1' => false, ); } diff --git a/core/Updates/1.7.2-rc5.php b/core/Updates/1.7.2-rc5.php index d526d5f708..648c2c6b04 100644 --- a/core/Updates/1.7.2-rc5.php +++ b/core/Updates/1.7.2-rc5.php @@ -8,7 +8,7 @@ * @category Piwik * @package Updates */ -use Piwik\Core\Piwik_Common; +use Piwik\Core\Common; /** * @package Updates @@ -18,7 +18,7 @@ class Piwik_Updates_1_7_2_rc5 extends Piwik_Updates static function getSql($schema = 'Myisam') { return array( - 'ALTER TABLE `' . Piwik_Common::prefixTable('pdf') . '` + 'ALTER TABLE `' . Common::prefixTable('pdf') . '` CHANGE `aggregate_reports_format` `display_format` TINYINT(1) NOT NULL' => false ); } diff --git a/core/Updates/1.7.2-rc7.php b/core/Updates/1.7.2-rc7.php index b6a25fae96..51d1bfa887 100755 --- a/core/Updates/1.7.2-rc7.php +++ b/core/Updates/1.7.2-rc7.php @@ -8,7 +8,7 @@ * @category Piwik * @package Updates */ -use Piwik\Core\Piwik_Common; +use Piwik\Core\Common; /** * @package Updates @@ -18,7 +18,7 @@ class Piwik_Updates_1_7_2_rc7 extends Piwik_Updates static function getSql($schema = 'Myisam') { return array( - 'ALTER TABLE `' . Piwik_Common::prefixTable('user_dashboard') . '` + 'ALTER TABLE `' . Common::prefixTable('user_dashboard') . '` ADD `name` VARCHAR( 100 ) NULL DEFAULT NULL AFTER `iddashboard`' => false, ); } @@ -26,14 +26,14 @@ class Piwik_Updates_1_7_2_rc7 extends Piwik_Updates static function update() { try { - $dashboards = Piwik_FetchAll('SELECT * FROM `' . Piwik_Common::prefixTable('user_dashboard') . '`'); + $dashboards = Piwik_FetchAll('SELECT * FROM `' . Common::prefixTable('user_dashboard') . '`'); foreach ($dashboards AS $dashboard) { $idDashboard = $dashboard['iddashboard']; $login = $dashboard['login']; $layout = $dashboard['layout']; $layout = html_entity_decode($layout); $layout = str_replace("\\\"", "\"", $layout); - Piwik_Query('UPDATE `' . Piwik_Common::prefixTable('user_dashboard') . '` SET layout = ? WHERE iddashboard = ? AND login = ?', array($layout, $idDashboard, $login)); + Piwik_Query('UPDATE `' . Common::prefixTable('user_dashboard') . '` SET layout = ? WHERE iddashboard = ? AND login = ?', array($layout, $idDashboard, $login)); } Piwik_Updater::updateDatabase(__FILE__, self::getSql()); } catch (Exception $e) { diff --git a/core/Updates/1.8.3-b1.php b/core/Updates/1.8.3-b1.php index 9605f15702..ca8c0a1c70 100644 --- a/core/Updates/1.8.3-b1.php +++ b/core/Updates/1.8.3-b1.php @@ -8,7 +8,7 @@ * @category Piwik‚ * @package Updates */ -use Piwik\Core\Piwik_Common; +use Piwik\Core\Common; /** * @package Updates @@ -19,10 +19,10 @@ class Piwik_Updates_1_8_3_b1 extends Piwik_Updates static function getSql($schema = 'Myisam') { return array( - 'ALTER TABLE `' . Piwik_Common::prefixTable('site') . '` + 'ALTER TABLE `' . Common::prefixTable('site') . '` CHANGE `excluded_parameters` `excluded_parameters` TEXT NOT NULL' => false, - 'CREATE TABLE `' . Piwik_Common::prefixTable('report') . '` ( + 'CREATE TABLE `' . Common::prefixTable('report') . '` ( `idreport` INT(11) NOT NULL AUTO_INCREMENT, `idsite` INTEGER(11) NOT NULL, `login` VARCHAR(100) NOT NULL, @@ -55,7 +55,7 @@ class Piwik_Updates_1_8_3_b1 extends Piwik_Updates // - migrate previous reports, if any, from Piwik_Common::prefixTable('pdf') to Piwik_Common::prefixTable('report') // - delete Piwik_Common::prefixTable('pdf') - $reports = Piwik_FetchAll('SELECT * FROM `' . Piwik_Common::prefixTable('pdf') . '`'); + $reports = Piwik_FetchAll('SELECT * FROM `' . Common::prefixTable('pdf') . '`'); foreach ($reports AS $report) { $idreport = $report['idreport']; @@ -82,7 +82,7 @@ class Piwik_Updates_1_8_3_b1 extends Piwik_Updates $parameters[Piwik_PDFReports::DISPLAY_FORMAT_PARAMETER] = $display_format; Piwik_Query( - 'INSERT INTO `' . Piwik_Common::prefixTable('report') . '` SET + 'INSERT INTO `' . Common::prefixTable('report') . '` SET idreport = ?, idsite = ?, login = ?, description = ?, period = ?, type = ?, format = ?, reports = ?, parameters = ?, ts_created = ?, ts_last_sent = ?, deleted = ?', @@ -94,8 +94,8 @@ class Piwik_Updates_1_8_3_b1 extends Piwik_Updates is_null($period) ? Piwik_PDFReports::DEFAULT_PERIOD : $period, Piwik_PDFReports::EMAIL_TYPE, is_null($format) ? Piwik_PDFReports::DEFAULT_REPORT_FORMAT : $format, - Piwik_Common::json_encode(preg_split('/,/', $reports)), - Piwik_Common::json_encode($parameters), + Common::json_encode(preg_split('/,/', $reports)), + Common::json_encode($parameters), $ts_created, $ts_last_sent, $deleted @@ -103,7 +103,7 @@ class Piwik_Updates_1_8_3_b1 extends Piwik_Updates ); } - Piwik_Query('DROP TABLE `' . Piwik_Common::prefixTable('pdf') . '`'); + Piwik_Query('DROP TABLE `' . Common::prefixTable('pdf') . '`'); } catch (Exception $e) { } diff --git a/core/Updates/1.8.4-b1.php b/core/Updates/1.8.4-b1.php index 58b8139647..e36349e8d1 100644 --- a/core/Updates/1.8.4-b1.php +++ b/core/Updates/1.8.4-b1.php @@ -8,7 +8,7 @@ * @category Piwik * @package Updates */ -use Piwik\Core\Piwik_Common; +use Piwik\Core\Common; /** * @package Updates @@ -23,11 +23,11 @@ class Piwik_Updates_1_8_4_b1 extends Piwik_Updates static function getSql($schema = 'Myisam') { - $action = Piwik_Common::prefixTable('log_action'); - $duplicates = Piwik_Common::prefixTable('log_action_duplicates'); - $visitAction = Piwik_Common::prefixTable('log_link_visit_action'); - $conversion = Piwik_Common::prefixTable('log_conversion'); - $visit = Piwik_Common::prefixTable('log_visit'); + $action = Common::prefixTable('log_action'); + $duplicates = Common::prefixTable('log_action_duplicates'); + $visitAction = Common::prefixTable('log_link_visit_action'); + $conversion = Common::prefixTable('log_conversion'); + $visit = Common::prefixTable('log_visit'); return array( diff --git a/core/Updates/1.9-b16.php b/core/Updates/1.9-b16.php index dade3e37b3..096e7eadf8 100755 --- a/core/Updates/1.9-b16.php +++ b/core/Updates/1.9-b16.php @@ -8,7 +8,7 @@ * @category Piwik * @package Updates */ -use Piwik\Core\Piwik_Common; +use Piwik\Core\Common; /** * @package Updates @@ -23,23 +23,23 @@ class Piwik_Updates_1_9_b16 extends Piwik_Updates static function getSql($schema = 'Myisam') { return array( - 'ALTER TABLE `' . Piwik_Common::prefixTable('log_link_visit_action') . '` + 'ALTER TABLE `' . Common::prefixTable('log_link_visit_action') . '` CHANGE `idaction_url` `idaction_url` INT( 10 ) UNSIGNED NULL DEFAULT NULL' => false, - 'ALTER TABLE `' . Piwik_Common::prefixTable('log_visit') . '` + 'ALTER TABLE `' . Common::prefixTable('log_visit') . '` ADD visit_total_searches SMALLINT(5) UNSIGNED NOT NULL AFTER `visit_total_actions`' => 1060, - 'ALTER TABLE `' . Piwik_Common::prefixTable('site') . '` + 'ALTER TABLE `' . Common::prefixTable('site') . '` ADD sitesearch TINYINT DEFAULT 1 AFTER `excluded_parameters`, ADD sitesearch_keyword_parameters TEXT NOT NULL AFTER `sitesearch`, ADD sitesearch_category_parameters TEXT NOT NULL AFTER `sitesearch_keyword_parameters`' => 1060, // enable Site Search for all websites, users can manually disable the setting - 'UPDATE `' . Piwik_Common::prefixTable('site') . '` + 'UPDATE `' . Common::prefixTable('site') . '` SET `sitesearch` = 1' => false, ); } diff --git a/core/Updates/1.9-b19.php b/core/Updates/1.9-b19.php index 9dc79c3d4a..de201fcb8d 100755 --- a/core/Updates/1.9-b19.php +++ b/core/Updates/1.9-b19.php @@ -8,7 +8,7 @@ * @category Piwik * @package Updates */ -use Piwik\Core\Piwik_Common; +use Piwik\Core\Common; /** * @package Updates @@ -18,10 +18,10 @@ class Piwik_Updates_1_9_b19 extends Piwik_Updates static function getSql($schema = 'Myisam') { return array( - 'ALTER TABLE `' . Piwik_Common::prefixTable('log_link_visit_action') . '` + 'ALTER TABLE `' . Common::prefixTable('log_link_visit_action') . '` CHANGE `idaction_url_ref` `idaction_url_ref` INT( 10 ) UNSIGNED NULL DEFAULT 0' => false, - 'ALTER TABLE `' . Piwik_Common::prefixTable('log_visit') . '` + 'ALTER TABLE `' . Common::prefixTable('log_visit') . '` CHANGE `visit_exit_idaction_url` `visit_exit_idaction_url` INT( 10 ) UNSIGNED NULL DEFAULT 0' => false ); diff --git a/core/Updates/1.9-b9.php b/core/Updates/1.9-b9.php index c70169d3ef..b67304d93d 100755 --- a/core/Updates/1.9-b9.php +++ b/core/Updates/1.9-b9.php @@ -8,7 +8,7 @@ * @category Piwik * @package Updates */ -use Piwik\Core\Piwik_Common; +use Piwik\Core\Common; /** * @package Updates @@ -22,8 +22,8 @@ class Piwik_Updates_1_9_b9 extends Piwik_Updates static function getSql($schema = 'Myisam') { - $logVisit = Piwik_Common::prefixTable('log_visit'); - $logConversion = Piwik_Common::prefixTable('log_conversion'); + $logVisit = Common::prefixTable('log_visit'); + $logConversion = Common::prefixTable('log_conversion'); $addColumns = "DROP `location_continent`, ADD `location_region` CHAR(2) NULL AFTER `location_country`, diff --git a/core/Updates/1.9.1-b2.php b/core/Updates/1.9.1-b2.php index bf478a6fc8..f2bcb81f42 100644 --- a/core/Updates/1.9.1-b2.php +++ b/core/Updates/1.9.1-b2.php @@ -8,7 +8,7 @@ * @category Piwik * @package Updates */ -use Piwik\Core\Piwik_Common; +use Piwik\Core\Common; /** * @package Updates @@ -18,7 +18,7 @@ class Piwik_Updates_1_9_1_b2 extends Piwik_Updates static function getSql($schema = 'Myisam') { return array( - 'ALTER TABLE ' . Piwik_Common::prefixTable('site') . " DROP `feedburnerName`" => 1091 + 'ALTER TABLE ' . Common::prefixTable('site') . " DROP `feedburnerName`" => 1091 ); } diff --git a/core/Updates/1.9.3-b8.php b/core/Updates/1.9.3-b8.php index 67e296ea81..3a0db01948 100755 --- a/core/Updates/1.9.3-b8.php +++ b/core/Updates/1.9.3-b8.php @@ -8,7 +8,7 @@ * @category Piwik * @package Updates */ -use Piwik\Core\Piwik_Common; +use Piwik\Core\Common; /** * @package Updates @@ -19,7 +19,7 @@ class Piwik_Updates_1_9_3_b8 extends Piwik_Updates { return array( // ignore existing column name error (1060) - 'ALTER TABLE ' . Piwik_Common::prefixTable('site') + 'ALTER TABLE ' . Common::prefixTable('site') . " ADD COLUMN excluded_user_agents TEXT NOT NULL AFTER excluded_parameters" => 1060, ); } diff --git a/core/Url.php b/core/Url.php index b31d854935..ab7b7c65e1 100644 --- a/core/Url.php +++ b/core/Url.php @@ -10,7 +10,7 @@ */ use Piwik\Core\Config; use Piwik\Core\Piwik; -use Piwik\Core\Piwik_Common; +use Piwik\Core\Common; /** * Class to retrieve absolute URL or URI components of the current URL, @@ -197,7 +197,7 @@ class Piwik_Url } // Only punctuation we allow is '[', ']', ':', '.' and '-' - $hostLength = Piwik_Common::strlen($host); + $hostLength = Common::strlen($host); if ($hostLength !== strcspn($host, '`~!@#$%^&*()_+={}\\|;"\'<>,?/ ')) { return false; } @@ -205,9 +205,9 @@ class Piwik_Url foreach ($trustedHosts as &$trustedHost) { $trustedHost = preg_quote($trustedHost); } - $untrustedHost = Piwik_Common::mb_strtolower($host); + $untrustedHost = Common::mb_strtolower($host); $untrustedHost = rtrim($untrustedHost, '.'); - $hostRegex = Piwik_Common::mb_strtolower('/(^|.)' . implode('|', $trustedHosts) . '$/'); + $hostRegex = Common::mb_strtolower('/(^|.)' . implode('|', $trustedHosts) . '$/'); $result = preg_match($hostRegex, $untrustedHost); return 0 !== $result; } @@ -284,7 +284,7 @@ class Piwik_Url } $host = self::getHost($checkTrustedHost); - $default = Piwik_Common::sanitizeInputValue($host ? $host : $default); + $default = Common::sanitizeInputValue($host ? $host : $default); return Piwik_IP::getNonProxyIpFromHeader($default, $hostHeaders); } @@ -318,7 +318,7 @@ class Piwik_Url static function getArrayFromCurrentQueryString() { $queryString = self::getCurrentQueryString(); - $urlValues = Piwik_Common::getArrayFromQueryString($queryString); + $urlValues = Common::getArrayFromQueryString($queryString); return $urlValues; } @@ -391,7 +391,7 @@ class Piwik_Url */ static public function redirectToUrl($url) { - if (Piwik_Common::isLookLikeUrl($url) + if (Common::isLookLikeUrl($url) || strpos($url, 'index.php') === 0 ) { @header("Location: $url"); diff --git a/core/View.php b/core/View.php index 8047dc6230..c8ee8c3089 100644 --- a/core/View.php +++ b/core/View.php @@ -10,7 +10,7 @@ */ use Piwik\Core\Config; use Piwik\Core\Piwik; -use Piwik\Core\Piwik_Common; +use Piwik\Core\Common; /** * Transition for pre-Piwik 0.4.4 @@ -48,7 +48,7 @@ class Piwik_View implements Piwik_View_Interface $this->initializeTwig(); $this->piwik_version = Piwik_Version::VERSION; - $this->piwikUrl = Piwik_Common::sanitizeInputValue(Piwik_Url::getCurrentUrlWithoutFileName()); + $this->piwikUrl = Common::sanitizeInputValue(Piwik_Url::getCurrentUrlWithoutFileName()); } /** @@ -99,13 +99,13 @@ class Piwik_View implements Piwik_View_Interface $sites = Piwik_SitesManager_API::getInstance()->getSitesWithAtLeastViewAccess($count); usort($sites, create_function('$site1, $site2', 'return strcasecmp($site1["name"], $site2["name"]);')); $this->sites = $sites; - $this->url = Piwik_Common::sanitizeInputValue(Piwik_Url::getCurrentUrl()); + $this->url = Common::sanitizeInputValue(Piwik_Url::getCurrentUrl()); $this->token_auth = Piwik::getCurrentUserTokenAuth(); $this->userHasSomeAdminAccess = Piwik::isUserHasSomeAdminAccess(); $this->userIsSuperUser = Piwik::isUserIsSuperUser(); $this->latest_version_available = Piwik_UpdateCheck::isNewestVersionAvailable(); - $this->disableLink = Piwik_Common::getRequestVar('disableLink', 0, 'int'); - $this->isWidget = Piwik_Common::getRequestVar('widget', 0, 'int'); + $this->disableLink = Common::getRequestVar('disableLink', 0, 'int'); + $this->isWidget = Common::getRequestVar('widget', 0, 'int'); if (Config::getInstance()->General['autocomplete_min_sites'] <= count($sites)) { $this->show_autocompleter = true; } else { diff --git a/core/ViewDataTable.php b/core/ViewDataTable.php index 91da163f47..e8026c916a 100644 --- a/core/ViewDataTable.php +++ b/core/ViewDataTable.php @@ -10,7 +10,7 @@ */ use Piwik\Core\Config; use Piwik\Core\Piwik; -use Piwik\Core\Piwik_Common; +use Piwik\Core\Common; /** * This class is used to load (from the API) and customize the output of a given DataTable. @@ -179,7 +179,7 @@ abstract class Piwik_ViewDataTable $this->viewProperties['request_parameters_to_modify'] = array(); $this->viewProperties['columns_to_display'] = array(); - $columns = Piwik_Common::getRequestVar('columns', false); + $columns = Common::getRequestVar('columns', false); if ($columns !== false) { $this->viewProperties['columns_to_display'] = Piwik::getArrayFromApiParameter($columns); array_unshift($this->viewProperties['columns_to_display'], 'label'); @@ -225,7 +225,7 @@ abstract class Piwik_ViewDataTable $defaultType = 'table'; } - $type = Piwik_Common::getRequestVar('viewDataTable', $defaultType, 'string'); + $type = Common::getRequestVar('viewDataTable', $defaultType, 'string'); switch ($type) { case 'cloud': $result = new Piwik_ViewDataTable_Cloud(); @@ -366,7 +366,7 @@ abstract class Piwik_ViewDataTable $this->currentControllerName = $currentControllerName; $this->currentControllerAction = $currentControllerAction; $this->controllerActionCalledWhenRequestSubTable = $controllerActionCalledWhenRequestSubTable; - $this->idSubtable = Piwik_Common::getRequestVar('idSubtable', false, 'int'); + $this->idSubtable = Common::getRequestVar('idSubtable', false, 'int'); foreach ($defaultProperties as $name => $value) { $this->setViewProperty($name, $value); @@ -647,7 +647,7 @@ abstract class Piwik_ViewDataTable private function areGenericFiltersDisabled() { // if disable_generic_filters query param is set to '1', generic filters are disabled - if (Piwik_Common::getRequestVar('disable_generic_filters', '0', 'string') == 1) { + if (Common::getRequestVar('disable_generic_filters', '0', 'string') == 1) { return true; } @@ -705,7 +705,7 @@ abstract class Piwik_ViewDataTable $requestArray = array( 'method' => $this->viewProperties['apiMethodToRequestDataTable'], 'format' => 'original', - 'disable_generic_filters' => Piwik_Common::getRequestVar('disable_generic_filters', 1, 'int') + 'disable_generic_filters' => Common::getRequestVar('disable_generic_filters', 1, 'int') ); $toSetEventually = array( @@ -744,7 +744,7 @@ abstract class Piwik_ViewDataTable { // we need the URL encoded segment parameter, we fetch it from _SERVER['QUERY_STRING'] instead of default URL decoded _GET $segmentRaw = false; - $segment = Piwik_Common::getRequestVar('segment', '', 'string'); + $segment = Common::getRequestVar('segment', '', 'string'); if (!empty($segment)) { $request = Piwik_API_Request::getRequestParametersGET(); if(!empty($request['segment'])) { @@ -826,7 +826,7 @@ abstract class Piwik_ViewDataTable foreach ($_GET as $name => $value) { try { - $requestValue = Piwik_Common::getRequestVar($name); + $requestValue = Common::getRequestVar($name); } catch (Exception $e) { $requestValue = ''; } @@ -909,7 +909,7 @@ abstract class Piwik_ViewDataTable protected function getDefaultOrCurrent($nameVar) { if (isset($_GET[$nameVar])) { - return Piwik_Common::sanitizeInputValue($_GET[$nameVar]); + return Common::sanitizeInputValue($_GET[$nameVar]); } $default = $this->getDefault($nameVar); return $default; @@ -1530,8 +1530,8 @@ abstract class Piwik_ViewDataTable */ public function hasReportBeenPurged() { - $strPeriod = Piwik_Common::getRequestVar('period', false); - $strDate = Piwik_Common::getRequestVar('date', false); + $strPeriod = Common::getRequestVar('period', false); + $strDate = Common::getRequestVar('date', false); if ($strPeriod !== false && $strDate !== false @@ -1539,7 +1539,7 @@ abstract class Piwik_ViewDataTable ) { // if range, only look at the first date if ($strPeriod == 'range') { - $idSite = Piwik_Common::getRequestVar('idSite', ''); + $idSite = Common::getRequestVar('idSite', ''); if (intval($idSite) != 0) { $site = new Piwik_Site($idSite); $timezone = $site->getTimezone(); @@ -1620,9 +1620,9 @@ abstract class Piwik_ViewDataTable { // if filter_column_recursive & filter_pattern_recursive are supplied, and flat isn't supplied // we have to load all the child subtables. - return Piwik_Common::getRequestVar('filter_column_recursive', false) !== false - && Piwik_Common::getRequestVar('filter_pattern_recursive', false) !== false - && Piwik_Common::getRequestVar('flat', false) === false; + return Common::getRequestVar('filter_column_recursive', false) !== false + && Common::getRequestVar('filter_pattern_recursive', false) !== false + && Common::getRequestVar('flat', false) === false; } /** diff --git a/core/ViewDataTable/GenerateGraphData.php b/core/ViewDataTable/GenerateGraphData.php index 8658093102..91a1d889b7 100644 --- a/core/ViewDataTable/GenerateGraphData.php +++ b/core/ViewDataTable/GenerateGraphData.php @@ -9,7 +9,7 @@ * @package Piwik */ use Piwik\Core\Piwik; -use Piwik\Core\Piwik_Common; +use Piwik\Core\Common; /** * Reads data from the API and prepares data to give to the renderer Piwik_Visualization_Chart. @@ -59,7 +59,7 @@ abstract class Piwik_ViewDataTable_GenerateGraphData extends Piwik_ViewDataTable $controllerActionCalledWhenRequestSubTable, $defaultProperties); - $columns = Piwik_Common::getRequestVar('columns', false); + $columns = Common::getRequestVar('columns', false); if ($columns !== false) { $columns = Piwik::getArrayFromApiParameter($columns); } else { @@ -79,7 +79,7 @@ abstract class Piwik_ViewDataTable_GenerateGraphData extends Piwik_ViewDataTable // selectable columns if ($this->getViewDataTableId() != 'generateDataChartEvolution') { $selectableColumns = array('nb_visits', 'nb_actions'); - if (Piwik_Common::getRequestVar('period', false) == 'day') { + if (Common::getRequestVar('period', false) == 'day') { $selectableColumns[] = 'nb_uniq_visitors'; } $this->setSelectableColumns($selectableColumns); @@ -161,7 +161,7 @@ abstract class Piwik_ViewDataTable_GenerateGraphData extends Piwik_ViewDataTable protected function addSeriesPickerToView($multiSelect = true) { if (count($this->selectableColumns) - && Piwik_Common::getRequestVar('showSeriesPicker', 1) == 1 + && Common::getRequestVar('showSeriesPicker', 1) == 1 ) { // build the final configuration for the series picker $columnsToDisplay = $this->getColumnsToDisplay(); @@ -181,7 +181,7 @@ abstract class Piwik_ViewDataTable_GenerateGraphData extends Piwik_ViewDataTable protected function getUnitsForColumnsToDisplay() { // derive units from column names - $idSite = Piwik_Common::getRequestVar('idSite', null, 'int'); + $idSite = Common::getRequestVar('idSite', null, 'int'); $units = $this->deriveUnitsFromRequestedColumnNames($this->getColumnsToDisplay(), $idSite); if (!empty($this->yAxisUnit)) { // force unit to the value set via $this->setAxisYUnit() @@ -240,7 +240,7 @@ abstract class Piwik_ViewDataTable_GenerateGraphData extends Piwik_ViewDataTable // if addTotalRow was called in GenerateGraphHTML, add a row containing totals of // different metrics - if (Piwik_Common::getRequestVar('add_total_row', 0) == 1) { + if (Common::getRequestVar('add_total_row', 0) == 1) { $this->dataTable->queueFilter('AddSummaryRow', array(0, Piwik_Translate('General_Total'), null, false)); } @@ -275,7 +275,7 @@ abstract class Piwik_ViewDataTable_GenerateGraphData extends Piwik_ViewDataTable $this->view->setDisplayPercentageInTooltip($this->displayPercentageInTooltip); // show_all_ticks is not real query param, it is set by GenerateGraphHTML. - if (Piwik_Common::getRequestVar('show_all_ticks', 0) == 1) { + if (Common::getRequestVar('show_all_ticks', 0) == 1) { $this->view->showAllTicks(); } diff --git a/core/ViewDataTable/GenerateGraphData/ChartEvolution.php b/core/ViewDataTable/GenerateGraphData/ChartEvolution.php index d0cbb29f3e..5a51049c8e 100644 --- a/core/ViewDataTable/GenerateGraphData/ChartEvolution.php +++ b/core/ViewDataTable/GenerateGraphData/ChartEvolution.php @@ -9,7 +9,7 @@ * @package Piwik */ use Piwik\Core\Piwik; -use Piwik\Core\Piwik_Common; +use Piwik\Core\Common; /** * Piwik_ViewDataTable_GenerateGraphData for the Evolution graph (eg. Last 30 days visits) using Piwik_Visualization_Chart_Evolution @@ -93,7 +93,7 @@ class Piwik_ViewDataTable_GenerateGraphData_ChartEvolution extends Piwik_ViewDat protected function loadDataTableFromAPI() { - $period = Piwik_Common::getRequestVar('period'); + $period = Common::getRequestVar('period'); // period will be overridden when 'range' is requested in the UI // but the graph will display for each day of the range. // Default 'range' behavior is to return the 'sum' for the range @@ -129,7 +129,7 @@ class Piwik_ViewDataTable_GenerateGraphData_ChartEvolution extends Piwik_ViewDat $uniqueIdsDataTable[] = $idDataTable; } - $idSite = Piwik_Common::getRequestVar('idSite', null, 'int'); + $idSite = Common::getRequestVar('idSite', null, 'int'); $requestedColumnNames = $this->getColumnsToDisplay(); $units = $this->getUnitsForColumnsToDisplay(); @@ -276,8 +276,8 @@ class Piwik_ViewDataTable_GenerateGraphData_ChartEvolution extends Piwik_ViewDat // 1) Custom Date Range always have link disabled, otherwise // the graph data set is way too big and fails to display // 2) disableLink parameter is set in the Widgetize "embed" code - $linkEnabled = !Piwik_Common::getRequestVar('disableLink', 0, 'int') - && Piwik_Common::getRequestVar('period', 'day') != 'range'; + $linkEnabled = !Common::getRequestVar('disableLink', 0, 'int') + && Common::getRequestVar('period', 'day') != 'range'; } return $linkEnabled; } diff --git a/core/ViewDataTable/GenerateGraphHTML.php b/core/ViewDataTable/GenerateGraphHTML.php index f34390404d..501f7fc558 100644 --- a/core/ViewDataTable/GenerateGraphHTML.php +++ b/core/ViewDataTable/GenerateGraphHTML.php @@ -9,7 +9,7 @@ * @package Piwik */ use Piwik\Core\Piwik; -use Piwik\Core\Piwik_Common; +use Piwik\Core\Common; /** * This class generates the HTML code to embed graphs in the page. @@ -140,7 +140,7 @@ abstract class Piwik_ViewDataTable_GenerateGraphHTML extends Piwik_ViewDataTable protected function buildView() { // access control - $idSite = Piwik_Common::getRequestVar('idSite', 1, 'int'); + $idSite = Common::getRequestVar('idSite', 1, 'int'); Piwik_API_Request::reloadAuthUsingTokenAuth(); if (!Piwik::isUserHasViewAccess($idSite)) { throw new Exception(Piwik_TranslateException('General_ExceptionPrivilegeAccessWebsite', array("'view'", $idSite))); diff --git a/core/ViewDataTable/GenerateGraphHTML/ChartEvolution.php b/core/ViewDataTable/GenerateGraphHTML/ChartEvolution.php index aec31a7a3a..00c5079760 100644 --- a/core/ViewDataTable/GenerateGraphHTML/ChartEvolution.php +++ b/core/ViewDataTable/GenerateGraphHTML/ChartEvolution.php @@ -8,7 +8,7 @@ * @category Piwik * @package Piwik */ -use Piwik\Core\Piwik_Common; +use Piwik\Core\Common; /** * Generates HTML embed for the Evolution graph @@ -100,10 +100,10 @@ class Piwik_ViewDataTable_GenerateGraphHTML_ChartEvolution extends Piwik_ViewDat */ private function calculateEvolutionDateRange() { - $period = Piwik_Common::getRequestVar('period'); + $period = Common::getRequestVar('period'); $defaultLastN = self::getDefaultLastN($period); - $this->originalDate = Piwik_Common::getRequestVar('date', 'last' . $defaultLastN, 'string'); + $this->originalDate = Common::getRequestVar('date', 'last' . $defaultLastN, 'string'); if ($period != 'range') // show evolution limit if the period is not a range { @@ -143,9 +143,9 @@ class Piwik_ViewDataTable_GenerateGraphHTML_ChartEvolution extends Piwik_ViewDat } $lastNParamName = self::getLastNParamName($period); - $lastN = Piwik_Common::getRequestVar($lastNParamName, $defaultLastN, 'int'); + $lastN = Common::getRequestVar($lastNParamName, $defaultLastN, 'int'); - $site = new Piwik_Site(Piwik_Common::getRequestVar('idSite')); + $site = new Piwik_Site(Common::getRequestVar('idSite')); $dateRange = Piwik_Controller::getDateRangeRelativeToEndDate($period, 'last' . $lastN, $endDate, $site); diff --git a/core/ViewDataTable/HtmlTable.php b/core/ViewDataTable/HtmlTable.php index 6267a2aca2..e1bfe37f10 100644 --- a/core/ViewDataTable/HtmlTable.php +++ b/core/ViewDataTable/HtmlTable.php @@ -10,7 +10,7 @@ */ use Piwik\Core\Config; use Piwik\Core\Piwik; -use Piwik\Core\Piwik_Common; +use Piwik\Core\Common; /** * Outputs an AJAX Table for a given DataTable. @@ -158,7 +158,7 @@ class Piwik_ViewDataTable_HtmlTable extends Piwik_ViewDataTable protected function handleLowPopulation($columnToApplyFilter = null) { - if (Piwik_Common::getRequestVar('enable_filter_excludelowpop', '0', 'string') == '0') { + if (Common::getRequestVar('enable_filter_excludelowpop', '0', 'string') == '0') { return; } if (is_null($columnToApplyFilter)) { diff --git a/core/ViewDataTable/HtmlTable/Goals.php b/core/ViewDataTable/HtmlTable/Goals.php index 325253872f..6e1ddb535d 100644 --- a/core/ViewDataTable/HtmlTable/Goals.php +++ b/core/ViewDataTable/HtmlTable/Goals.php @@ -9,7 +9,7 @@ * @package Piwik */ use Piwik\Core\Piwik; -use Piwik\Core\Piwik_Common; +use Piwik\Core\Common; /** * @package Piwik @@ -24,13 +24,13 @@ class Piwik_ViewDataTable_HtmlTable_Goals extends Piwik_ViewDataTable_HtmlTable public function main() { - $this->idSite = Piwik_Common::getRequestVar('idSite', null, 'int'); - $this->processOnlyIdGoal = Piwik_Common::getRequestVar('idGoal', Piwik_DataTable_Filter_AddColumnsProcessedMetricsGoal::GOALS_OVERVIEW, 'string'); + $this->idSite = Common::getRequestVar('idSite', null, 'int'); + $this->processOnlyIdGoal = Common::getRequestVar('idGoal', Piwik_DataTable_Filter_AddColumnsProcessedMetricsGoal::GOALS_OVERVIEW, 'string'); $this->isEcommerce = $this->processOnlyIdGoal == Piwik::LABEL_ID_GOAL_IS_ECOMMERCE_ORDER; $this->viewProperties['show_exclude_low_population'] = true; $this->viewProperties['show_goals'] = true; - if (Piwik_Common::getRequestVar('documentationForGoalsPage', 0, 'int') == 1) { + if (Common::getRequestVar('documentationForGoalsPage', 0, 'int') == 1) { $this->setReportDocumentation(Piwik_Translate('Goals_ConversionByTypeReportDocumentation', array('<br />', '<br />', '<a href="http://piwik.org/docs/tracking-goals-web-analytics/" target="_blank">', '</a>'))); } @@ -140,7 +140,7 @@ class Piwik_ViewDataTable_HtmlTable_Goals extends Piwik_ViewDataTable_HtmlTable foreach ($goals as $goal) { $idgoal = $goal['idgoal']; - $goal['name'] = Piwik_Common::unsanitizeInputValue($goal['name']); + $goal['name'] = Common::unsanitizeInputValue($goal['name']); if ($this->processOnlyIdGoal > Piwik_DataTable_Filter_AddColumnsProcessedMetricsGoal::GOALS_FULL_TABLE && $this->processOnlyIdGoal != $idgoal diff --git a/core/ViewDataTable/Sparkline.php b/core/ViewDataTable/Sparkline.php index 09a4d7373a..f20d3bc1ec 100644 --- a/core/ViewDataTable/Sparkline.php +++ b/core/ViewDataTable/Sparkline.php @@ -8,7 +8,7 @@ * @category Piwik * @package Piwik */ -use Piwik\Core\Piwik_Common; +use Piwik\Core\Common; /** * Reads the requested DataTable from the API and prepare data for the Sparkline view. @@ -35,7 +35,7 @@ class Piwik_ViewDataTable_Sparkline extends Piwik_ViewDataTable $this->mainAlreadyExecuted = true; // If period=range, we force the sparkline to draw daily data points - $period = Piwik_Common::getRequestVar('period'); + $period = Common::getRequestVar('period'); if ($period == 'range') { $_GET['period'] = 'day'; } @@ -53,12 +53,12 @@ class Piwik_ViewDataTable_Sparkline extends Piwik_ViewDataTable $graph = new Piwik_Visualization_Sparkline(); $graph->setValues($values); - $height = Piwik_Common::getRequestVar('height', 0, 'int'); + $height = Common::getRequestVar('height', 0, 'int'); if (!empty($height)) { $graph->setHeight($height); } - $width = Piwik_Common::getRequestVar('width', 0, 'int'); + $width = Common::getRequestVar('width', 0, 'int'); if (!empty($width)) { $graph->setWidth($width); } diff --git a/core/Visualization/Chart.php b/core/Visualization/Chart.php index 9c8f53700d..3c6374e852 100644 --- a/core/Visualization/Chart.php +++ b/core/Visualization/Chart.php @@ -9,7 +9,7 @@ * @package Piwik */ use Piwik\Core\Piwik; -use Piwik\Core\Piwik_Common; +use Piwik\Core\Common; /** * Generates the data in the Open Flash Chart format, from the given data. @@ -57,7 +57,7 @@ abstract class Piwik_Visualization_Chart implements Piwik_View_Interface // unsanitize here is safe since data gets outputted as JSON, not HTML // NOTE: this is a quick fix for a double-encode issue. if this file is refactored, // this fix can probably be removed (or at least made more understandable). - 'label' => Piwik_Common::unsanitizeInputValue($label), + 'label' => Common::unsanitizeInputValue($label), 'internalLabel' => $label ); @@ -168,7 +168,7 @@ abstract class Piwik_Visualization_Chart implements Piwik_View_Interface ); Piwik_PostEvent('Visualization_Chart.render', array(&$data)); - return Piwik_Common::json_encode($data); + return Common::json_encode($data); } public function customizeChartProperties() diff --git a/core/Visualization/Cloud.php b/core/Visualization/Cloud.php index 3458c70605..9d37bf9423 100644 --- a/core/Visualization/Cloud.php +++ b/core/Visualization/Cloud.php @@ -8,7 +8,7 @@ * @category Piwik * @package Piwik */ -use Piwik\Core\Piwik_Common; +use Piwik\Core\Common; /** * Generates a tag cloud from a given data array. @@ -52,8 +52,8 @@ class Piwik_Visualization_Cloud implements Piwik_View_Interface $maxValue = max($this->wordsArray); foreach ($this->wordsArray as $word => $popularity) { $wordTruncated = $word; - if (Piwik_Common::mb_strlen($word) > $this->truncatingLimit) { - $wordTruncated = Piwik_Common::mb_substr($word, 0, $this->truncatingLimit - 3) . '...'; + if (Common::mb_strlen($word) > $this->truncatingLimit) { + $wordTruncated = Common::mb_substr($word, 0, $this->truncatingLimit - 3) . '...'; } // case hideFutureHoursWhenToday=1 shows hours with no visits |