diff --git a/LEGALNOTICE b/LEGALNOTICE index 14ee74c5534..f6ad6267c96 100644 --- a/LEGALNOTICE +++ b/LEGALNOTICE @@ -1,6 +1,6 @@ COPYRIGHT - Piwik - Open Source Web Analytics + Piwik - free/libre analytics platform The software package is: @@ -77,40 +77,40 @@ THIRD-PARTY COMPONENTS AND LIBRARIES Name: jqPlot Link: http://www.jqplot.com/ - License: Dual-licensed: MIT or GPL v2 + License: Dual-licensed: MIT (Expat) or GPL v2 Name: jQuery Link: http://jquery.com/ - License: Dual-licensed: MIT or GPL + License: Dual-licensed: MIT (Expat) or GPL Notes: - GPL version not explicitly stated in source but GPL v2 is in git - - includes Sizzle.js - multi-licensed: MIT, New BSD, or GPL [v2] + - includes Sizzle.js - multi-licensed: MIT (Expat), New BSD, or GPL [v2] Name: jQuery UI Link: http://jqueryui.com/ - License: Dual-licensed: MIT or GPL + License: Dual-licensed: MIT (Expat) or GPL Notes: - GPL version not explicitly stated in source but GPL v2 is in git Name: jquery.history Link: http://tkyk.github.com/jquery-history-plugin/ - License: MIT + License: MIT (Expat) Name: jquery.scrollTo Link: http://plugins.jquery.com/project/ScrollTo - License: Dual licensed: MIT or GPL + License: Dual licensed: MIT (Expat) or GPL Name: jquery Tooltip Link: http://bassistance.de/jquery-plugins/jquery-plugin-tooltip/ - License: Dual licensed: MIT or GPL + License: Dual licensed: MIT (Expat) or GPL Name: jquery placeholder Link: http://mths.be/placeholder - License: Dual licensed: MIT or GPL + License: Dual licensed: MIT (Expat) or GPL Name: jquery smartbanner Link: https://github.com/jasny/jquery.smartbanner - License: Dual licensed: MIT + License: Dual licensed: MIT (Expat) Name: json2.js Link: http://json.org/ @@ -206,19 +206,19 @@ THIRD-PARTY COMPONENTS AND LIBRARIES Name: Raphaël - JavaScript Vector Library Link: http://raphaeljs.com/ - License: MIT + License: MIT (Expat) Name: lessphp Link: http://leafo.net/lessphp - License: GPL3/MIT + License: GPL3, MIT (Expat) Name: Symfony Console Component Link: https://github.com/symfony/Console - License: MIT + License: MIT (Expat) Name: AngularJS Link: https://github.com/angular/angular.js - License: MIT + License: MIT (Expat) Name: Mousetrap Link: https://github.com/ccampbell/mousetrap @@ -267,7 +267,6 @@ THIRD-PARTY CONTENT Notes: - the "New BSD" license refers to either the "Modified BSD" and "Simplified BSD" licenses (2- or 3-clause), which are GPL compatible. -- the "MIT" license is also referred to as the "X11" license - icons for browsers, operating systems, browser plugins, search engines, and and flags of countries are nominative use of third-party trademarks when referring to the corresponding product or entity diff --git a/README.md b/README.md index a377eab0298..b6268294986 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,8 @@ # Piwik - piwik.org -## We’re seeking a talented open source Software Engineer! +## We’re seeking a talented Software Engineer -Are you looking for a new challenge? We are currently seeking a software engineer or software developer who is passionate about data processing, security, privacy, the open source philosophy and usable interface design. +Are you looking for a new challenge? We are currently seeking a software engineer or software developer who is passionate about data processing, security, privacy, the open source and free/libre philosophy and usable interface design. [View Job Description](http://piwik.org/blog/2014/05/piwik-expanding-seeking-talented-software-engineer-new-zealand-poland/) - [Apply online](http://piwik.org/jobs/) @@ -10,13 +10,13 @@ We are grateful if you can share the Job Description with your friends and colle ## Description -Piwik is the leading Free/Libre open source Web Analytics platform. +Piwik is the leading Free/Libre open analytics platform. Piwik is a full featured PHP MySQL software program that you download and install on your own webserver. At the end of the five minute installation process you will be given a JavaScript code. Simply copy and paste this tag on websites you wish to track and access your analytics reports in real time. -Piwik aims to be a Free software alternative to Google Analytics, and is already used on more than 1,000,000 websites. +Piwik aims to be a Free software alternative to Google Analytics, and is already used on more than 1,000,000 websites. Privacy is built-in! ## Mission Statement diff --git a/composer.json b/composer.json index 0cfa4c9f062..de87087718e 100644 --- a/composer.json +++ b/composer.json @@ -1,7 +1,7 @@ { "name": "piwik/piwik", "type": "application", - "description": "Open Source Real Time Web Analytics Platform", + "description": "the leading free/libre analytics platform", "keywords": ["piwik","web","analytics"], "homepage": "http://piwik.org", "license": "GPL-3.0+", diff --git a/config/global.ini.php b/config/global.ini.php index cb5017b642f..b5b21294bcb 100644 --- a/config/global.ini.php +++ b/config/global.ini.php @@ -375,7 +375,7 @@ ; The release server is an essential part of the Piwik infrastructure/ecosystem ; to provide the latest software version. -latest_version_url = http://builds.piwik.org/latest.zip +latest_version_url = http://builds.piwik.org/piwik-latest.zip ; The API server is an essential part of the Piwik infrastructure/ecosystem to ; provide services to Piwik installations, e.g., getLatestVersion and @@ -609,6 +609,7 @@ Plugins[] = MultiSites Plugins[] = Referrers Plugins[] = UserSettings +Plugins[] = DevicesDetection Plugins[] = Goals Plugins[] = SEO Plugins[] = Events diff --git a/core/API/DataTableGenericFilter.php b/core/API/DataTableGenericFilter.php index 0fe56c57d01..6db2f2b4763 100644 --- a/core/API/DataTableGenericFilter.php +++ b/core/API/DataTableGenericFilter.php @@ -1,6 +1,6 @@ delete(); diff --git a/core/AssetManager/UIAsset.php b/core/AssetManager/UIAsset.php index 4361812e9cb..c380ed4a8db 100644 --- a/core/AssetManager/UIAsset.php +++ b/core/AssetManager/UIAsset.php @@ -1,6 +1,6 @@ configCache['PluginsInstalled'] = array('PluginsInstalled' => array()); - - // DevicesDetection plugin is not yet enabled by default - if (isset($configGlobal['Plugins'])) { - $this->configCache['Plugins'] = $this->configGlobal['Plugins']; - $this->configCache['Plugins']['Plugins'][] = 'DevicesDetection'; - } - if (isset($configGlobal['Plugins_Tracker'])) { - $this->configCache['Plugins_Tracker'] = $this->configGlobal['Plugins_Tracker']; - $this->configCache['Plugins_Tracker']['Plugins_Tracker'][] = 'DevicesDetection'; - } } /** diff --git a/core/Console.php b/core/Console.php index 097da68b455..d03fe0501fa 100644 --- a/core/Console.php +++ b/core/Console.php @@ -1,6 +1,6 @@ getDefaultWebsiteId(); + $websiteId = $userPreferences->getDefaultWebsiteId(); } if (empty($defaultDate)) { - $defaultDate = $this->getDefaultDate(); + $defaultDate = $userPreferences->getDefaultDate(); } if (empty($defaultPeriod)) { - $defaultPeriod = $this->getDefaultPeriod(); + $defaultPeriod = $userPreferences->getDefaultPeriod(); } $parametersString = ''; if (!empty($parameters)) { @@ -813,82 +815,6 @@ public function redirectToIndex($moduleToRedirect, $actionToRedirect, $websiteId exit; } - /** - * Returns default site ID that Piwik should load. - * - * _Note: This value is a Piwik setting set by each user._ - * - * @return bool|int - * @api - */ - protected function getDefaultWebsiteId() - { - $defaultWebsiteId = false; - - // User preference: default website ID to load - $defaultReport = APIUsersManager::getInstance()->getUserPreference(Piwik::getCurrentUserLogin(), APIUsersManager::PREFERENCE_DEFAULT_REPORT); - if (is_numeric($defaultReport)) { - $defaultWebsiteId = $defaultReport; - } - - if ($defaultWebsiteId && Piwik::isUserHasViewAccess($defaultWebsiteId)) { - return $defaultWebsiteId; - } - - $sitesId = APISitesManager::getInstance()->getSitesIdWithAtLeastViewAccess(); - if (!empty($sitesId)) { - return $sitesId[0]; - } - return false; - } - - /** - * Returns default date for Piwik reports. - * - * _Note: This value is a Piwik setting set by each user._ - * - * @return string `'today'`, `'2010-01-01'`, etc. - * @api - */ - protected function getDefaultDate() - { - // NOTE: a change in this function might mean a change in plugins/UsersManager/javascripts/usersSettings.js as well - $userSettingsDate = APIUsersManager::getInstance()->getUserPreference(Piwik::getCurrentUserLogin(), APIUsersManager::PREFERENCE_DEFAULT_REPORT_DATE); - if ($userSettingsDate == 'yesterday') { - return $userSettingsDate; - } - // if last7, last30, etc. - if (strpos($userSettingsDate, 'last') === 0 - || strpos($userSettingsDate, 'previous') === 0 - ) { - return $userSettingsDate; - } - return 'today'; - } - - /** - * Returns default period type for Piwik reports. - * - * @return string `'day'`, `'week'`, `'month'`, `'year'` or `'range'` - * @api - */ - protected function getDefaultPeriod() - { - $userSettingsDate = APIUsersManager::getInstance()->getUserPreference(Piwik::getCurrentUserLogin(), APIUsersManager::PREFERENCE_DEFAULT_REPORT_DATE); - if ($userSettingsDate === false) { - return PiwikConfig::getInstance()->General['default_period']; - } - if (in_array($userSettingsDate, array('today', 'yesterday'))) { - return 'day'; - } - if (strpos($userSettingsDate, 'last') === 0 - || strpos($userSettingsDate, 'previous') === 0 - ) { - return 'range'; - } - return $userSettingsDate; - } - /** * Checks that the token_auth in the URL matches the currently logged-in user's token_auth. * diff --git a/core/Plugin/ControllerAdmin.php b/core/Plugin/ControllerAdmin.php index b3799c2ac61..4254cdbb2c3 100644 --- a/core/Plugin/ControllerAdmin.php +++ b/core/Plugin/ControllerAdmin.php @@ -1,6 +1,6 @@ phpVersion = PHP_VERSION; $view->phpIsNewEnough = version_compare($view->phpVersion, '5.3.0', '>='); } - - protected function getDefaultWebsiteId() - { - $sitesId = \Piwik\Plugins\SitesManager\API::getInstance()->getSitesIdWithAdminAccess(); - if (!empty($sitesId)) { - return $sitesId[0]; - } - return parent::getDefaultWebsiteId(); - } } diff --git a/core/Plugin/Dependency.php b/core/Plugin/Dependency.php index 4e5a574966b..7e87324612b 100644 --- a/core/Plugin/Dependency.php +++ b/core/Plugin/Dependency.php @@ -1,6 +1,6 @@ getMessage() . "\n" . $e->getTraceAsString()); - $loadingError = array('message' => $e->getMessage()); + $message = $e->getMessage(); + if (\Piwik_ShouldPrintBackTraceWithMessage()) { + $message .= "\n" . $e->getTraceAsString(); + } + + $loadingError = array('message' => $message); } $view = new View("@CoreHome/_dataTable"); diff --git a/core/Profiler.php b/core/Profiler.php index ae9c5e8b766..bcbf67019cf 100644 --- a/core/Profiler.php +++ b/core/Profiler.php @@ -1,6 +1,6 @@ rendering .= $reportView->render(); } + + public function getAttachments($report, $processedReports, $prettyDate) + { + $additionalFiles = array(); + + foreach ($processedReports as $processedReport) { + if ($processedReport['displayGraph']) { + + $additionalFiles[] = $this->getAttachment($report, $processedReport, $prettyDate); + } + } + + return $additionalFiles; + } + + protected function getAttachment($report, $processedReport, $prettyDate) + { + $additionalFile = array(); + + $segment = \Piwik\Plugins\ScheduledReports\API::getSegment($report['idsegment']); + + $segmentName = $segment != null ? sprintf(' (%s)', $segment['name']) : ''; + + $processedReportMetadata = $processedReport['metadata']; + + $additionalFile['filename'] = + sprintf( + '%s - %s - %s %d - %s %d%s.png', + $processedReportMetadata['name'], + $prettyDate, + Piwik::translate('General_Website'), + $report['idsite'], + Piwik::translate('General_Report'), + $report['idreport'], + $segmentName + ); + + $additionalFile['cid'] = $processedReportMetadata['uniqueId']; + + $additionalFile['content'] = + ReportRenderer::getStaticGraph( + $processedReportMetadata, + Html::IMAGE_GRAPH_WIDTH, + Html::IMAGE_GRAPH_HEIGHT, + $processedReport['evolutionGraph'], + $segment + ); + + $additionalFile['mimeType'] = 'image/png'; + + $additionalFile['encoding'] = \Zend_Mime::ENCODING_BASE64; + + return $additionalFile; + } } diff --git a/core/ReportRenderer/Pdf.php b/core/ReportRenderer/Pdf.php index 66f47df27bf..47c2ebf9005 100644 --- a/core/ReportRenderer/Pdf.php +++ b/core/ReportRenderer/Pdf.php @@ -1,6 +1,6 @@ TCPDF->Write("1em", $message); $this->TCPDF->Ln(); } + + /** + * Get report attachments, ex. graph images + * + * @param $report + * @param $processedReports + * @param $prettyDate + * @return array + */ + public function getAttachments($report, $processedReports, $prettyDate) + { + return array(); + } } diff --git a/core/ScheduledTask.php b/core/ScheduledTask.php index de1d582b7bd..18cb2aa94e2 100644 --- a/core/ScheduledTask.php +++ b/core/ScheduledTask.php @@ -1,6 +1,6 @@ Piwik page"); - echo "Piwik is a free open source web analytics that lets you keep control of your data."; + echo "Piwik is a free/libre web analytics that lets you keep control of your data."; break; case self::STATE_NOSCRIPT_REQUEST: diff --git a/core/Tracker/Action.php b/core/Tracker/Action.php index a3650a9ad4d..f7d1f2ccb81 100644 --- a/core/Tracker/Action.php +++ b/core/Tracker/Action.php @@ -1,6 +1,6 @@ activatePlugin('DevicesDetection'); + } catch(\Exception $e) { + } + } +} diff --git a/core/Url.php b/core/Url.php index d9fa0bf55f2..5ad0aa5acf6 100644 --- a/core/Url.php +++ b/core/Url.php @@ -1,6 +1,6 @@
Then reload this page to access your analytics reports." . "\n\n

Note: if for some reasons you cannot install composer, instead install the latest Piwik release from ". - "builds.piwik.org.

"; + "builds.piwik.org.

"; } } diff --git a/index.php b/index.php index e7eaf1a9fd1..cc6780eb9bb 100644 --- a/index.php +++ b/index.php @@ -1,6 +1,6 @@ Piwik is an open source web analytics software that makes it easy to get the information you want from your visitors.<\/p>

This process is split up into %s easy steps and will take around 5 minutes.<\/p>", + "WelcomeHelp": "

Piwik is a free/libre web analytics software that makes it easy to get the information you want from your visitors.<\/p>

This process is split up into %s easy steps and will take around 5 minutes.<\/p>", "WelcomeToCommunity": "Welcome to the Piwik community!" }, "LanguagesManager": { diff --git a/libs/PiwikTracker/PiwikTracker.php b/libs/PiwikTracker/PiwikTracker.php index f6bfe1da1f5..3afc2db93a2 100644 --- a/libs/PiwikTracker/PiwikTracker.php +++ b/libs/PiwikTracker/PiwikTracker.php @@ -1,6 +1,6 @@ 0 if not success: fatal_error( - "couldn't open the configuration file, " - "required to get the authentication token" + "the configuration file" + self.options.config_file + " could not be read. Please check permission. This file must be readable to get the authentication token" ) updatetokenfile = os.path.abspath( @@ -1365,15 +1364,15 @@ def invalidate_reports(): else: dates = [date.strftime('%Y-%m-%d') for date in stats.dates_recorded] if dates: - print 'Purging Piwik archives for dates: ' + ' '.join(dates) + print '\nPurging Piwik archives for dates: ' + ' '.join(dates) result = piwik.call_api( 'CoreAdminHome.invalidateArchivedReports', dates=','.join(dates), idSites=','.join(str(site_id) for site_id in stats.piwik_sites), ) - print('To re-process these reports with your new update data, execute the following command: \n ' - '`piwik/console core:archive --url=http://example/piwik/`\n' - 'Reference: http://piwik.org/docs/setup-auto-archiving/ ') + print('\nTo re-process these reports with your newly imported data, execute the following command: \n' + '$ /path/to/piwik/console core:archive --url=http://example/piwik/\n' + '\nReference: http://piwik.org/docs/setup-auto-archiving/ ') class Hit(object): diff --git a/misc/others/cli-script-bootstrap.php b/misc/others/cli-script-bootstrap.php index da0d3fbf72b..a5c200f30cd 100644 --- a/misc/others/cli-script-bootstrap.php +++ b/misc/others/cli-script-bootstrap.php @@ -1,6 +1,6 @@ -# based on a script by Steve Redler IV, steve@sr-tech.com 5-21-2001 - -set -e - -TMP_DIR="/tmp" -THIS_DIR=`pwd` -SCRIPT_PATH=`readlink -f $0` -SCRIPT_DIR=`dirname ${SCRIPT_PATH}` - -JSON_GREP="python $SCRIPT_DIR/jsongrep.py" - -PKG_BUILD_PROGRAM=`basename $0` -#PKG_BUILD_PROGRAM="apkg-build" -PKG_BUILD_VER="1.0" -PKG_BUILD_FORMAT="zip" # ar, tar, zip - -PKG_CONTROL_DIR="CONTROL" -PKG_WEBMAN_DIR="webman" -PKG_WEB_DIR="www" - -PKG_WEB_USER="admin" -PKG_WEB_GROUP="administrators" - -PKG_WEB_USER_ID=999 -PKG_WEB_GROUP_ID=999 - -PKG_WEB_PERM=770 - -PKG_DIR_PERM=755 -PKG_FILE_PERM=644 - -PKG_VERSION_FILE="apkg-version" -PKG_DATA_FILE="data.tar.gz" -PKG_CONTROL_FILE="control.tar.gz" - -PKG_CONFIG_FILE="config.json" -PKG_ICON_ENABLE_FILE="icon-enable.png" -PKG_ICON_DISABLE_FILE="icon-disable.png" - -PKG_PRE_INSTALL_SCRIPT="pre-install.sh" -PKG_PRE_UNINSTALL_SCRIPT="pre-uninstall.sh" - -PKG_POST_INSTALL_SCRIPT="post-install.sh" -PKG_POST_UNINSTALL_SCRIPT="post-uninstall.sh" - -PKG_START_STOP_SCRIPT="start-stop.sh" - -PKG_SCRIPT_LIST="$PKG_PRE_INSTALL_SCRIPT $PKG_PRE_UNINSTALL_SCRIPT \ - $PKG_POST_INSTALL_SCRIPT $PKG_POST_UNINSTALL_SCRIPT \ - $PKG_START_STOP_SCRIPT" - -PKG_SRC_DIR=$1 -PKG_DEST_DIR=$2 -PKG_TMP_DIR=$TMP_DIR/APKG_BUILD.$$ - -PKG_SUFFIX="apk" - - -pkg_struct_check() { - local owd=`pwd` - local error=0 - - # check pkg base dir - if [ ! -d $PKG_SRC_DIR ]; then - echo " *** Error: Directory $PKG_SRC_DIR does not exist" >&2 - return 1 - fi - - cd $PKG_SRC_DIR - - # check pkg control dir - if [ ! -d "$PKG_CONTROL_DIR" ]; then - echo " *** Error: Directory $PKG_SRC_DIR has no $PKG_CONTROL_DIR subdirectory." >&2 - error=1 - fi - - # check pkg config file - if [ ! -f "$PKG_CONTROL_DIR/$PKG_CONFIG_FILE" ]; then - echo " *** Error: Package config file $PKG_SRC_DIR/$PKG_CONTROL_DIR/$PKG_CONFIG_FILE not found." >&2 - error=1 - fi - - # TODO: check pkg config file is utf8 format - - # check enable pkg icon file - if [ ! -f "$PKG_CONTROL_DIR/$PKG_ICON_ENABLE_FILE" ]; then - echo " *** Error: Package enable icon file $PKG_SRC_DIR/$PKG_CONTROL_DIR/$PKG_ICON_ENABLE_FILE not found." >&2 - error=1 - fi - - # check disable pkg icon file - if [ ! -f "$PKG_CONTROL_DIR/$PKG_ICON_DISABLE_FILE" ]; then - echo " *** Error: Package disable icon file $PKG_SRC_DIR/$PKG_CONTROL_DIR/$PKG_ICON_DISABLE_FILE not found." >&2 - error=1 - fi - - cd $owd - - return $error -} - -required_field() { - field=$1 - - raw_value=`$JSON_GREP app $field < $PKG_CONTROL_DIR/$PKG_CONFIG_FILE` - value=`expr "$raw_value" : '..\(.*\).'` - if [ -z "$value" ]; then - echo " *** Error: $PKG_CONTROL_DIR/$PKG_CONFIG_FILE is missing field $field" >&2 - return 1 - fi - echo $value - return 0 -} - -pkg_config_check() { - local owd=`pwd` - local error=0 - - cd $PKG_SRC_DIR - - PKG_FIELD_PACKAGE=`required_field package` - [ "$?" -ne 0 ] && error=1 - - PKG_FIELD_NAME=`required_field name` - [ "$?" -ne 0 ] && error=1 - - PKG_FIELD_VERSION=`required_field version` - [ "$?" -ne 0 ] && error=1 - - PKG_FIELD_SECTION=`required_field section` -# [ "$?" -ne 0 ] && error=1 - - PKG_FIELD_VISIBILITY=`required_field visibility` - [ "$?" -ne 0 ] && error=1 - - PKG_FIELD_PRIORITY=`required_field priority` - [ "$?" -ne 0 ] && error=1 - - PKG_FIELD_MAINTAINER=`required_field maintainer` - [ "$?" -ne 0 ] && error=1 - - PKG_FIELD_EMAIL=`required_field email` -# [ "$?" -ne 0 ] && error=1 - - PKG_FIELD_WEBSITE=`required_field website` -# [ "$?" -ne 0 ] && error=1 - - PKG_FIELD_ARCHITECTURE=`required_field architecture` - [ "$?" -ne 0 ] && error=1 - - PKG_FIELD_FIRMWARE=`required_field firmware` - [ "$?" -ne 0 ] && error=1 - - PKG_FIELD_DESCRIPTION=`required_field description` - [ "$?" -ne 0 ] && error=1 - - PKG_FIELD_CHANGES=`required_field changes` -# [ "$?" -ne 0 ] && error=1 - -# PKG_FIELD_TAGS=`required_field tags` -# [ "$?" -ne 0 ] && error=1 - - if echo $PKG_FIELD_PACKAGE | grep '[^a-z0-9.+-]' > /dev/null 2>&1; then - if [ $error -eq 1 ]; then - echo >&2 - fi - echo " *** Error: Package name $PKG_FIELD_PACKAGE contains illegal characters, (other than [a-z0-9.+-])" >&2 - error=1 - fi - -# if [ -z "$PKG_FIELD_SECTION" ]; then -# if [ $error -eq 1 ]; then -# echo >&2 -# fi -# echo " The Section field should have one of the following values:" >&2 -# echo " admin, base, comm, editors, extras, games, graphics, kernel, libs, misc, net, text, web, x11" >&2 -# fi - - if [ -z "$PKG_FIELD_PRIORITY" ]; then - if [ $error -eq 1 ]; then - echo >&2 - fi - echo " The Priority field should have one of the following values:" >&2 - echo " required, important, standard, optional, extra" >&2 - echo " If you don't know which priority value you should be using, then use \`optional'" >&2 - - fi - - cd $owd - - return $error -} - -pkg_script_check() { - local owd=`pwd` - local error=0 - - cd $PKG_SRC_DIR - - for script_file in $PKG_SCRIPT_LIST; do - if [ -f $PKG_CONTROL_DIR/$script_file -a ! -x $PKG_CONTROL_DIR/$script_file ]; then - echo " *** Error: package script $PKG_CONTROL_DIR/$script_file is not executable" >&2 - error=1 - fi - done - - cd $owd - - return $error -} - -pkg_misc_check() { - local owd=`pwd` - local error=0 - - cd $PKG_SRC_DIR - - tilde_files=`find . -name '*~'` - if [ -n "$tilde_files" ]; then - echo "*** Warning: The following files have names ending in '~'. -You probably want to remove them: " >&2 - ls -ld $tilde_files - echo >&2 - fi - - swap_files=`find . -name '*.swp'` - if [ -n "$swap_files" ]; then - echo "*** Warning: The following files have names ending in '.swp'. -You probably want to remove them: " >&2 - ls -ld $swap_files - echo >&2 - fi - - svn_files=`find . -name '.svn'` - if [ -n "$svn_files" ]; then - echo "*** Warning: The following files have names ending in '.svn'. -You probably want to remove them: " >&2 - ls -ld $svn_files - echo >&2 - fi - - git_files=`find . -name '*.git'` - if [ -n "$git_files" ]; then - echo "*** Warning: The following files have names ending in '.git'. -You probably want to remove them: " >&2 - ls -ld $git_files - echo >&2 - fi - - cvs_files=`find . -name '*.cvs'` - if [ -n "$cvs_files" ]; then - echo "*** Warning: The following files have names ending in '.cvs'. -You probably want to remove them: " >&2 - ls -ld $cvs_files - echo >&2 - fi - -# maybe check SUID & GUID file - -# large_uid_files=`find . -uid +99` -# if [ -n "$large_uid_files" ]; then -# echo "*** Warning: The following files have a UID greater than 99. -#You probably want to chown these to a system user: " >&2 -# ls -ld $large_uid_files -# echo >&2 -# fi - - cd $owd - - return $error -} - -### -# apkg-build "main" -### - -# set pkg dest dir -case $# in -1) - PKG_SRC_DIR=`readlink -f $PKG_SRC_DIR` - PKG_DEST_DIR=$THIS_DIR - ;; -2) - PKG_SRC_DIR=`readlink -f $PKG_SRC_DIR` - PKG_DEST_DIR=`readlink -f $PKG_DEST_DIR` - ;; -*) - echo "Usage: $PKG_BUILD_PROGRAM []" >&2 - exit 1 - ;; -esac - -if [ $PKG_SRC_DIR = $PKG_DEST_DIR ]; then - echo "*** Error: Can't not build pkg in the same directory" >&2 - echo " pkg_directory: $PKG_SRC_DIR" >&2 - echo " destination_directory: $PKG_DEST_DIR" >&2 - exit 1 -fi - -# check pkg package folder structure -echo "Check package folder structure..." -if ! pkg_struct_check; then - echo >&2 - echo "$PKG_BUILD_PROGRAM: Please fix the above errors and try again." >&2 - exit 1 -fi -echo "Done" - -echo - -# check pkg config -echo "Check package config information..." -if ! pkg_config_check; then - echo >&2 - echo "$PKG_BUILD_PROGRAM: Please fix the above errors and try again." >&2 - exit 1 -fi -echo "Done" - -echo - -# check pkg script -echo "Check package script file..." -if ! pkg_script_check; then - echo >&2 - echo "$PKG_BUILD_PROGRAM: Please fix the above errors and try again." >&2 - exit 1 -fi -echo "Done" - -echo - -# check pkg misc -echo "Check package misc..." -if ! pkg_misc_check; then - echo >&2 - echo "$PKG_BUILD_PROGRAM: Please fix the above errors and try again." >&2 - exit 1 -fi -echo "Done" - -echo - -# archive pkg control script -mkdir -p $PKG_TMP_DIR - -# force chown user:group to web folder -if [ -d $PKG_SRC_DIR/$PKG_WEB_DIR ]; then - echo -n "Force change $PKG_SRC_DIR/$PKG_WEB_DIR/* owner and group to $PKG_WEB_USER:$PKG_WEB_GROUP ... " - if [ `ls -la $PKG_SRC_DIR/$PKG_WEB_DIR | wc -l` -gt 3 ]; then - # change owner - sudo chown $PKG_WEB_USER_ID:$PKG_WEB_GROUP_ID $PKG_SRC_DIR/$PKG_WEB_DIR -R - # TODO change file permission - # chmod $PKG_WEB_PERM $PKG_SRC_DIR/$PKG_WEB_DIR -R - fi - echo "Done" - - echo -fi - -echo -n "Archive package data..." -tar -C $PKG_SRC_DIR -czf $PKG_TMP_DIR/$PKG_DATA_FILE . --exclude=$PKG_CONTROL_DIR -echo "Done" - -echo - -# archive pkg data -echo -n "Archive package control script..." -tar -C $PKG_SRC_DIR/$PKG_CONTROL_DIR -czf $PKG_TMP_DIR/$PKG_CONTROL_FILE . -echo "Done" - -echo - -# generate pkg version -echo -n "Generate $PKG_VERSION_FILE..." -echo $PKG_BUILD_VER > $PKG_TMP_DIR/$PKG_VERSION_FILE -echo "Done" - -echo - -# prepare pkg filename -PKG_ARCHIVE_FILE=${PKG_FIELD_PACKAGE}_${PKG_FIELD_VERSION}_${PKG_FIELD_ARCHITECTURE}.$PKG_SUFFIX - -# use which type archive -echo "Use $PKG_BUILD_FORMAT format to archive $PKG_ARCHIVE_FILE..." -cd $PKG_TMP_DIR - -PKG_ARCHIVE_LIST="./$PKG_VERSION_FILE ./$PKG_DATA_FILE ./$PKG_CONTROL_FILE" - -rm -rf $TMP_DIR/$PKG_ARCHIVE_FILE - -if [ "$PKG_BUILD_FORMAT" = "ar" ] ; then - ar -crvf $TMP_DIR/$PKG_ARCHIVE_FILE $PKG_ARCHIVE_LIST -elif [ "$PKG_BUILD_FORMAT" = "tar" ] ; then - tar -zcvf $TMP_DIR/$PKG_ARCHIVE_FILE $PKG_ARCHIVE_LIST -elif [ "$PKG_BUILD_FORMAT" = "zip" ] ; then - zip -r $TMP_DIR/$PKG_ARCHIVE_FILE $PKG_ARCHIVE_LIST -fi -echo "Done" - -PKG_SIZE=`ls -l $TMP_DIR/$PKG_ARCHIVE_FILE | awk '{print $5}'` -PKG_MD5=`md5sum $TMP_DIR/$PKG_ARCHIVE_FILE | cut -d' ' -f1` -PKG_SHA1=`sha1sum $TMP_DIR/$PKG_ARCHIVE_FILE | cut -d' ' -f1` - -# move pkg to dest dir -[ "$PKG_DEST_DIR" != "$TMP_DIR" ] && mkdir -p $PKG_DEST_DIR && mv $TMP_DIR/$PKG_ARCHIVE_FILE $PKG_DEST_DIR - -echo - -# clean up -echo -n "Clean building data..." -rm -f $PKG_TMP_DIR/$PKG_VERSION_FILE $PKG_TMP_DIR/$PKG_DATA_FILE $PKG_TMP_DIR/$PKG_CONTROL_FILE -rmdir $PKG_TMP_DIR -echo "Done" - -echo - -echo "Package Summary" -echo " Source: $PKG_SRC_DIR" -echo " Destination: $PKG_DEST_DIR" -echo " Package: $PKG_FIELD_PACKAGE" -echo " Name: $PKG_FIELD_NAME" -echo " Version: $PKG_FIELD_VERSION" -echo " Section: $PKG_FIELD_SECTION" -echo " Visibility: $PKG_FIELD_VISIBILITY" -echo " Priority: $PKG_FIELD_PRIORITY" -echo " Maintainer: $PKG_FIELD_MAINTAINER" -echo " Email: $PKG_FIELD_EMAIL" -echo " WebSite: $PKG_FIELD_WEBSITE" -echo " Architecture: $PKG_FIELD_ARCHITECTURE" -echo " Firmware: $PKG_FIELD_FIRMWARE" -echo " Description: $PKG_FIELD_DESCRIPTION" -echo " Changes: $PKG_FIELD_CHANGES" -echo " File: $PKG_ARCHIVE_FILE" -echo " Size: $PKG_SIZE" -echo " MD5sum: $PKG_MD5" -echo " SHA1sum: $PKG_SHA1" diff --git a/misc/package/ASUStor/build.sh b/misc/package/ASUStor/build.sh deleted file mode 100644 index 06d6d9e74f7..00000000000 --- a/misc/package/ASUStor/build.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/sh - -LATEST=`curl -s http://api.piwik.org/1.0/getLatestVersion/` -curl -s http://builds.piwik.org/piwik-$LATEST.tar.gz | gunzip | tar xf - - -mkdir -p Piwik/CONTROL -mv piwik Piwik/www - -sed "s/{{VERSION}}/$LATEST/" Piwik/CONTROL/config.json -cp ../../gpl-3.0.txt Piwik/CONTROL/license.txt -cp CONTROL/*.png Piwik/CONTROL/ - -sh apkg_build Piwik diff --git a/misc/package/ASUStor/config.json.tpl b/misc/package/ASUStor/config.json.tpl deleted file mode 100644 index 9062331e3d6..00000000000 --- a/misc/package/ASUStor/config.json.tpl +++ /dev/null @@ -1,37 +0,0 @@ -{ - "app":{ - "package":"piwik", - "name":"Piwik", - "version":"{{VERSION}}", - "section":"Web Hosting", - "visibility":true, - "priority":"optional", - "depends":[], - "conflicts":[], - "suggests":[], - "maintainer":"Piwik", - "email":"hello@piwik.org", - "website":"http://piwik.org/", - "architecture":"any", - "firmware":"any", - "description":"Open source, self-hosted web analytics.", - "changes":"http://piwik.org/changelog/", - "tags":["analytics", "visits", "visitors", "hits"] - }, - "desktop":{ - "icon":{ - "type":"webserver", - "title":"Piwik" - }, - "privilege":{ - "accessible":"users", - "customizable":true - } - }, - "install":{ - "dep-service":{ - "start":["httpd", "mysql"], - "restart":[] - } - } -} diff --git a/misc/package/ASUStor/jsongrep.py b/misc/package/ASUStor/jsongrep.py deleted file mode 100644 index 7b1b4713a01..00000000000 --- a/misc/package/ASUStor/jsongrep.py +++ /dev/null @@ -1,37 +0,0 @@ -#Original author: Terry Jones (http://blogs.fluidinfo.com/terry/about/) -#Source: http://blogs.fluidinfo.com/terry/2010/11/25/jsongrep-py-python-for-extracting-pieces-of-json-objects/ - -#!/usr/bin/env python - -import sys -import re -import json -from pprint import pprint - -def jsongrep(d, patterns): - try: - pattern = patterns.pop(0) - except IndexError: - pprint(d) - else: - if isinstance(d, dict): - keys = filter(pattern.match, d.keys()) - elif isinstance(d, list): - keys = map(int, - filter(pattern.match, - ['%d' % i for i in range(len(d))])) - else: - if pattern.match(str(d)): - pprint(d) - return - for item in (d[key] for key in keys): - jsongrep(item, patterns[:]) - -if __name__ == '__main__': - try: - j = json.loads(sys.stdin.read()) - except ValueError, e: - print >>sys.stderr, 'Could not load JSON object from stdin.' - sys.exit(1) - - jsongrep(j, map(re.compile, sys.argv[1:])) diff --git a/misc/package/QNAP/build.sh b/misc/package/QNAP/build.sh deleted file mode 100644 index 0ef74e21c7b..00000000000 --- a/misc/package/QNAP/build.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/sh - -LATEST=`curl -s http://api.piwik.org/1.0/getLatestVersion/` -curl -s http://builds.piwik.org/piwik-$LATEST.tar.gz | gunzip | tar xf - - -cp icons/qpkg_icon_80.gif piwik/.qpkg_icon_80.gif -cp icons/qpkg_icon.gif piwik/.qpkg_icon.gif -cp icons/qpkg_icon_gray.gif piwik/.qpkg_icon_gray.gif - -tar cf - piwik | gzip >Piwik.tgz - -sed "s/{{VERSION}}/$LATEST/" qpkg.cfg - -cp header.qpkg Piwik_$LATEST.qpkg -tar zcf - qinstall.sh Piwik.tgz qpkg.cfg >>Piwik_$LATEST.qpkg - -zip Piwik_$LATEST.zip Piwik_$LATEST.qpkg diff --git a/misc/package/QNAP/header.qpkg b/misc/package/QNAP/header.qpkg deleted file mode 100644 index 7a143ecd195..00000000000 --- a/misc/package/QNAP/header.qpkg +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/sh -/bin/echo "Install QNAP package on TS-NAS ..." -/bin/grep "/mnt/HDA_ROOT" /proc/mounts 1>>/dev/null 2>>/dev/null -[ $? = 0 ] || return 1 -[ -d /mnt/HDA_ROOT/update_pkg/tmp ] || /bin/mkdir -p /mnt/HDA_ROOT/update_pkg/tmp -/bin/dd if=${0} bs=487 skip=1 | /bin/tar zxv -C /mnt/HDA_ROOT/update_pkg/tmp -[ $? = 0 ] || return 1 -cd /mnt/HDA_ROOT/update_pkg/tmp && ( /bin/sh qinstall.sh || echo "Installation Abort." ) && cd .. && /bin/rm -rf /mnt/HDA_ROOT/update_pkg/tmp && exit 10 -exit 1 diff --git a/misc/package/QNAP/icons/qpkg_icon.gif b/misc/package/QNAP/icons/qpkg_icon.gif deleted file mode 100755 index eec1713ce21..00000000000 Binary files a/misc/package/QNAP/icons/qpkg_icon.gif and /dev/null differ diff --git a/misc/package/QNAP/icons/qpkg_icon_80.gif b/misc/package/QNAP/icons/qpkg_icon_80.gif deleted file mode 100755 index 43fefcb95f4..00000000000 Binary files a/misc/package/QNAP/icons/qpkg_icon_80.gif and /dev/null differ diff --git a/misc/package/QNAP/icons/qpkg_icon_gray.gif b/misc/package/QNAP/icons/qpkg_icon_gray.gif deleted file mode 100755 index 7efe51ce9d2..00000000000 Binary files a/misc/package/QNAP/icons/qpkg_icon_gray.gif and /dev/null differ diff --git a/misc/package/QNAP/qinstall.sh b/misc/package/QNAP/qinstall.sh deleted file mode 100755 index 3f834fe1d54..00000000000 --- a/misc/package/QNAP/qinstall.sh +++ /dev/null @@ -1,246 +0,0 @@ -#!/bin/sh -#================================================================ -# Copyright (C) 2010 QNAP Systems, Inc. -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; either version 2 -# of the License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -#---------------------------------------------------------------- -# -# qinstall.sh -# -# Abstract: -# A QPKG installation script for -# Piwik v1.0 -# -# HISTORY: -# 2008/03/26 - Created - KenChen -# 2010/11/05 - Modified - AndyChuo (zeonism at gmail dot com) -# 2012/07/28 - Modified - Anthon Pang (anthon at piwik dot org) -# -#================================================================ - -##### Util ##### -CMD_APACHE="/usr/local/apache/bin/apachectl" -CMD_CP="/bin/cp" -CMD_CUT="/bin/cut" -CMD_CHMOD="/bin/chmod" -CMD_ECHO="/bin/echo" -CMD_GETCFG="/sbin/getcfg" -CMD_GREP="/bin/grep" -CMD_LN="/bin/ln" -CMD_MKTEMP="/bin/mktemp" -CMD_MKDIR="/bin/mkdir" -CMD_PIDOF="/bin/pidof" -CMD_READLINK="/usr/bin/readlink" -CMD_RM="/bin/rm" -CMD_SETCFG="/sbin/setcfg" -CMD_SYNC="/bin/sync" -CMD_SETCFG="/sbin/setcfg" -CMD_SLEEP="/bin/sleep" -CMD_TAR="/bin/tar" -CMD_TOUCH="/bin/touch" -CMD_WLOG="/sbin/write_log" - -##### System ##### -UPDATE_PROCESS="/tmp/update_process" -UPDATE_PB=0 -UPDATE_P1=1 -UPDATE_P2=2 -UPDATE_PE=3 - -SYS_HOSTNAME=`/bin/hostname` -SYS_IP=`$CMD_GREP "${SYS_HOSTNAME}" /etc/hosts | $CMD_CUT -f 1` -SYS_CONFIG_DIR="/etc/config" #put the configuration files here -SYS_INIT_DIR="/etc/init.d" -SYS_rcS_DIR="/etc/rcS.d/" -SYS_rcK_DIR="/etc/rcK.d/" -SYS_QPKG_CONFIG_FILE="/etc/config/qpkg.conf" #qpkg infomation file -SYS_QPKG_CONF_FIELD_NAME="Name" -SYS_QPKG_CONF_FIELD_VERSION="Version" -SYS_QPKG_CONF_FIELD_QPKGFILE="QPKG_File" -SYS_QPKG_CONF_FIELD_ENABLE="Enable" -SYS_QPKG_CONF_FIELD_DATE="Date" -SYS_QPKG_CONF_FIELD_SHELL="Shell" -SYS_QPKG_CONF_FIELD_INSTALL_PATH="Install_Path" -SYS_QPKG_CONF_FIELD_CONFIG_PATH="Config_Path" -SYS_QPKG_CONF_FIELD_WEBUI="WebUI" -SYS_QPKG_CONF_FIELD_WEBPORT="Web_Port" -SYS_QPKG_CONF_FIELD_SERVICEPORT="Service_Port" -SYS_QPKG_CONF_FIELD_AUTHOR="Author" -SYS_WEB_STATUS=`${CMD_GETCFG} QWEB enable` -PUBLIC_SHARE=`/sbin/getcfg SHARE_DEF defPublic -d Public -f /etc/config/def_share.info` -WEB_SHARE=`/sbin/getcfg SHARE_DEF defWeb -d Qweb -f /etc/config/def_share.info` - -##### QPKG ##### -# -. qpkg.cfg -##### Func ###### -# -find_base(){ - # Determine BASE installation location according to smb.conf - - publicdir=`/sbin/getcfg Public path -f /etc/config/smb.conf` - if [ ! -z $publicdir ] && [ -d $publicdir ];then - publicdirp1=`/bin/echo $publicdir | /bin/cut -d "/" -f 2` - publicdirp2=`/bin/echo $publicdir | /bin/cut -d "/" -f 3` - publicdirp3=`/bin/echo $publicdir | /bin/cut -d "/" -f 4` - if [ ! -z $publicdirp1 ] && [ ! -z $publicdirp2 ] && [ ! -z $publicdirp3 ]; then - [ -d "/${publicdirp1}/${publicdirp2}/${PUBLIC_SHARE}" ] && QPKG_BASE="/${publicdirp1}/${publicdirp2}" - fi - fi - - # Determine BASE installation location by checking where the Public folder is. - if [ -z $QPKG_BASE ]; then - for datadirtest in /share/HDA_DATA /share/HDB_DATA /share/HDC_DATA /share/HDD_DATA /share/MD0_DATA /share/MD1_DATA; do - [ -d $datadirtest/$PUBLIC_SHARE ] && QPKG_BASE="/${publicdirp1}/${publicdirp2}" - done - fi - if [ -z $QPKG_BASE ] ; then - echo "The ${PUBLIC_SHARE} share not found." - _exit 1 - fi - -} - -_exit(){ - local ret=0 - - case $1 in - 0)#normal exit - ret=0 - if [ "x$QPKG_INSTALL_MSG" != "x" ]; then - $CMD_WLOG "${QPKG_INSTALL_MSG}" 4 - else - $CMD_WLOG "${QPKG_NAME} ${QPKG_VER} installation succeeded." 4 - fi - $CMD_ECHO "$UPDATE_PE" > ${UPDATE_PROCESS} - ;; - *) - ret=1 - if [ "x$QPKG_INSTALL_MSG" != "x" ];then - $CMD_WLOG "${QPKG_INSTALL_MSG}" 1 - else - $CMD_WLOG "${QPKG_NAME} ${QPKG_VER} installation failed" 1 - fi - $CMD_ECHO -1 > ${UPDATE_PROCESS} - ;; - esac - - exit $ret -} - -pre_update() -{ - TMP_DIR=/tmp - $CMD_CP -af $QPKG_CONFIG_PATH $TMP_DIR -} - -post_update() -{ - $CMD_CP -af "${TMP_DIR}/config.ini.php" ${QPKG_CONFIG_PATH} -} - -install() -{ - TMP=`$CMD_READLINK $QPKG_INSTALL_PATH` - UPDATE_FLAG=0 - if [ -f "${QPKG_SOURCE_DIR}/${QPKG_SOURCE_FILE}" ]; then - if [ -d ${QPKG_DIR} ]; then - CURRENT_QPKG_VER="`/sbin/getcfg ${QPKG_NAME} Version -f /etc/config/qpkg.conf`" - QPKG_INSTALL_MSG="${QPKG_NAME} ${QPKG_VER} is already installed. Setup will now perform package upgrading." - $CMD_ECHO "$QPKG_INSTALL_MSG" - UPDATE_FLAG=1 - fi - - $CMD_ECHO "$UPDATE_P1" > ${UPDATE_PROCESS} - if [ $UPDATE_FLAG -eq 0 ]; then - $CMD_ECHO "Install ${QPKG_NAME} ..." - [ ! -d $QPKG_DIR ] || $CMD_RM -rf $QPKG_DIR - else - pre_update - fi - - #install QPKG files - $CMD_TAR xzf "${QPKG_SOURCE_DIR}/${QPKG_SOURCE_FILE}" -C $QPKG_INSTALL_PATH - if [ $? = 0 ]; then - # restore backups - if [ ${UPDATE_FLAG} -eq 1 ]; then - post_update - else - $CMD_CHMOD 0777 "${QPKG_DIR}" - $CMD_CHMOD 0777 -R "${QPKG_DIR}/config" - $CMD_CHMOD 0777 -R "${QPKG_DIR}/tmp" - - $CMD_MKDIR -p ${QPKG_DIR}/tmp/{sessions, templates_c, cache, assets, latest, tcpdf} - $CMD_CHMOD 0777 -R "${QPKG_DIR}/tmp/" - fi - - chown httpdusr.everyone ${QPKG_DIR} -R - - $CMD_ECHO "$UPDATE_P2" > ${UPDATE_PROCESS} - else - ${CMD_RM} -rf ${QPKG_DIR} - QPKG_INSTALL_MSG="${QPKG_NAME} ${QPKG_VER} installation failed. ${QPKG_SOURCE_DIR}/${QPKG_SOURCE_FILE} file error." - $CMD_ECHO "$QPKG_INSTALL_MSG" - _exit 1 - fi - - # set QPKG information to $SYS_QPKG_CONFIG_FILE - $CMD_ECHO "Set QPKG information to $SYS_QPKG_CONFIG_FILE" - [ -f ${SYS_QPKG_CONFIG_FILE} ] || $CMD_TOUCH ${SYS_QPKG_CONFIG_FILE} - $CMD_SETCFG ${QPKG_NAME} ${SYS_QPKG_CONF_FIELD_NAME} "${QPKG_NAME}" -f ${SYS_QPKG_CONFIG_FILE} - $CMD_SETCFG ${QPKG_NAME} ${SYS_QPKG_CONF_FIELD_VERSION} "${QPKG_VER}" -f ${SYS_QPKG_CONFIG_FILE} - - #default value to activate(or not) your QPKG if it was a service/daemon - $CMD_SETCFG ${QPKG_NAME} ${SYS_QPKG_CONF_FIELD_ENABLE} "UNKNOWN" -f ${SYS_QPKG_CONFIG_FILE} - - #set the qpkg file name - [ "x${SYS_QPKG_CONF_FIELD_QPKGFILE}" = "x" ] || $CMD_SETCFG ${QPKG_NAME} ${SYS_QPKG_CONF_FIELD_QPKGFILE} "${QPKG_QPKG_FILE}" -f ${SYS_QPKG_CONFIG_FILE} - - #set the date of installation - $CMD_SETCFG ${QPKG_NAME} ${SYS_QPKG_CONF_FIELD_DATE} `date +%F` -f ${SYS_QPKG_CONFIG_FILE} - - #set the path of start/stop shell script - [ "x${QPKG_SERVICE_PROGRAM}" = "x" ] || $CMD_SETCFG ${QPKG_NAME} ${SYS_QPKG_CONF_FIELD_SHELL} "${QPKG_DIR}/${QPKG_SERVICE_PROGRAM}" -f ${SYS_QPKG_CONFIG_FILE} - - #set path where the QPKG installed - $CMD_SETCFG ${QPKG_NAME} ${SYS_QPKG_CONF_FIELD_INSTALL_PATH} "${QPKG_DIR}" -f ${SYS_QPKG_CONFIG_FILE} - - #set path where the QPKG configure directory/file is - [ "x${QPKG_CONFIG_PATH}" = "x" ] || $CMD_SETCFG ${QPKG_NAME} ${SYS_QPKG_CONF_FIELD_CONFIG_PATH} "${QPKG_CONFIG_PATH}" -f ${SYS_QPKG_CONFIG_FILE} - - #set the port number if your QPKG was a service/daemon and needed a port to run. - [ "x${QPKG_SERVICE_PORT}" = "x" ] || $CMD_SETCFG ${QPKG_NAME} ${SYS_QPKG_CONF_FIELD_SERVICEPORT} "${QPKG_SERVICE_PORT}" -f ${SYS_QPKG_CONFIG_FILE} - - #set the port number if your QPKG was a service/daemon and needed a port to run. - [ "x${QPKG_WEB_PORT}" = "x" ] || $CMD_SETCFG ${QPKG_NAME} ${SYS_QPKG_CONF_FIELD_WEBPORT} "${QPKG_WEB_PORT}" -f ${SYS_QPKG_CONFIG_FILE} - - #set the URL of your QPKG Web UI if existed. - [ "x${QPKG_WEBUI}" = "x" ] || $CMD_SETCFG ${QPKG_NAME} ${SYS_QPKG_CONF_FIELD_WEBUI} "${QPKG_WEBUI}" -f ${SYS_QPKG_CONFIG_FILE} - - #Sign up - [ "x${QPKG_AUTHOR}" = "x" ] && $CMD_ECHO "Warning: ${SYS_QPKG_CONF_FIELD_AUTHOR} is not specified!!" - [ "x${QPKG_AUTHOR}" = "x" ] || $CMD_SETCFG ${QPKG_NAME} ${SYS_QPKG_CONF_FIELD_AUTHOR} "${QPKG_AUTHOR}" -f ${SYS_QPKG_CONFIG_FILE} - - $CMD_SYNC - QPKG_INSTALL_MSG="$QPKG_NAME ${QPKG_VER} has been installed in $QPKG_DIR." - $CMD_ECHO "$QPKG_INSTALL_MSG" - _exit 0 - else - QPKG_INSTALL_MSG="${QPKG_NAME} ${QPKG_VER} installation failed. ${QPKG_SOURCE_DIR}/${QPKG_SOURCE_FILE} file not found." - $CMD_ECHO "$QPKG_INSTALL_MSG" - _exit 1 - fi -} - -##### Main ##### - -$CMD_ECHO "$UPDATE_PB" > ${UPDATE_PROCESS} -install diff --git a/misc/package/QNAP/qpkg.cfg.tpl b/misc/package/QNAP/qpkg.cfg.tpl deleted file mode 100644 index a97631cbb12..00000000000 --- a/misc/package/QNAP/qpkg.cfg.tpl +++ /dev/null @@ -1,43 +0,0 @@ -#!/bin/sh -#================================================================ -# Copyright (C) 2010 QNAP Systems, Inc. -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; either version 2 -# of the License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -#---------------------------------------------------------------- -# -# qpkg_all.cfg -# -# Abstract: -# A QPKG configuration file for -# Piwik v1.0 -# -# HISTORY: -# 2010/11/05 - Created - AndyChuo (zeonism at gmail dot com) -# 2012/07/28 - Modified - Anthon Pang (anthon at piwik dot org) -# -#================================================================ -QPKG_AUTHOR="QNAP Systems, Inc." -QPKG_SOURCE_DIR="." -QPKG_QPKG_FILE="Piwik.qpkg" -QPKG_SOURCE_FILE="Piwik.tgz" -QPKG_NAME="Piwik" -QPKG_VER="{{VERSION}}" -QPKG_MAJOR_VER="1" -QPKG_MINOR_VER="0" -QPKG_TYPE="Web Applications" -QPKG_LOG_PATH="" -QPKG_INSTALL_PATH="/share/${WEB_SHARE}" -QPKG_CONFIG_PATH="$QPKG_INSTALL_PATH/piwik/config/config.ini.php" -QPKG_DIR="$QPKG_INSTALL_PATH/piwik" -QPKG_WEBUI="/piwik/" #URL relative path of your QPKG web interface led by "/" -QPKG_INSTALL_MSG="" -QPKG_WEB_PORT="" -QPKG_SERVICE_PORT="" diff --git a/misc/package/build.sh b/misc/package/build.sh index 1bba6e54ea7..bf1b22d86fc 100755 --- a/misc/package/build.sh +++ b/misc/package/build.sh @@ -211,7 +211,7 @@ If you have any question, feel free to ask. \n\n\ Thank you,\n\n\ Piwik team" | mail -s"New Piwik Version $VERSION" "appgal@microsoft.com,hello@piwik.org" - echo "build finished! http://builds.piwik.org/latest.zip" + echo "build finished! http://builds.piwik.org/piwik-latest.zip" fi diff --git a/misc/proxy-hide-piwik-url/piwik.php b/misc/proxy-hide-piwik-url/piwik.php index fa0d4f682f7..7ec88affd63 100644 --- a/misc/proxy-hide-piwik-url/piwik.php +++ b/misc/proxy-hide-piwik-url/piwik.php @@ -1,6 +1,6 @@ 1){if(console!==undefined&&console&&console.error){console.error("The method "+d+' is registered more than once in "_paq" variable. Only the last call has an effect. Please have a look at the multiple Piwik trackers documentation: http://developer.piwik.org/api-reference/tracking-javascript#multiple-piwik-trackers')}}p[d]++}}for(r=0;r<_paq.length;r++){if(_paq[r]){L(_paq[r])}}_paq=new t();c={addPlugin:function(Q,R){a[Q]=R},getTracker:function(Q,R){return new z(Q,R)},getAsyncTracker:function(){return G}};if(typeof define==="function"&&define.amd){define("piwik",[],function(){return c})}return c}())}if(window&&window.piwikAsyncInit){window.piwikAsyncInit()}(function(){var a=(typeof AnalyticsTracker);if(a==="undefined"){AnalyticsTracker=Piwik}}());if(typeof piwik_log!=="function"){piwik_log=function(b,f,d,g){function a(h){try{return eval("piwik_"+h) -}catch(i){}return}var c,e=Piwik.getTracker(d,f);e.setDocumentTitle(b);e.setCustomData(g);c=a("tracker_pause");if(c){e.setLinkTrackingTimer(c)}c=a("download_extensions");if(c){e.setDownloadExtensions(c)}c=a("hosts_alias");if(c){e.setDomains(c)}c=a("ignore_classes");if(c){e.setIgnoreClasses(c)}e.trackPageView();if(a("install_tracker")){piwik_track=function(i,k,j,h){e.setSiteId(k);e.setTrackerUrl(j);e.trackLink(i,h)};e.enableLinkTracking()}}}; \ No newline at end of file +}catch(i){}return}var c,e=Piwik.getTracker(d,f);e.setDocumentTitle(b);e.setCustomData(g);c=a("tracker_pause");if(c){e.setLinkTrackingTimer(c)}c=a("download_extensions");if(c){e.setDownloadExtensions(c)}c=a("hosts_alias");if(c){e.setDomains(c)}c=a("ignore_classes");if(c){e.setIgnoreClasses(c)}e.trackPageView();if(a("install_tracker")){piwik_track=function(i,k,j,h){e.setSiteId(k);e.setTrackerUrl(j);e.trackLink(i,h)};e.enableLinkTracking()}}; +/*! @license-end */ +}; \ No newline at end of file diff --git a/piwik.php b/piwik.php index 325e35692a1..3e5ef800be2 100644 --- a/piwik.php +++ b/piwik.php @@ -1,6 +1,6 @@ write("Downloading $file to .$downloadTo...\n"); + $output->write("Downloading $file to $downloadTo...\n"); Http::sendHttpRequest("$urlBase/processed-ui-screenshots/$file", $timeout = 60, $userAgent = null, PIWIK_DOCUMENT_ROOT . "/" . $downloadTo); } diff --git a/plugins/CoreConsole/Commands/WatchLog.php b/plugins/CoreConsole/Commands/WatchLog.php index fc06dae46a9..f6dd3bba5f3 100644 --- a/plugins/CoreConsole/Commands/WatchLog.php +++ b/plugins/CoreConsole/Commands/WatchLog.php @@ -1,6 +1,6 @@ getTimezone(); + $currency = $website->getCurrency(); $currencies = APISitesManager::getInstance()->getCurrencySymbols(); // live api is not summable, prevents errors like "Unexpected ECommerce status value" @@ -556,12 +557,15 @@ private function addFilterToCleanVisitors(DataTable $dataTable, $idSite, $flat = $visitor = new Visitor($visitorDetailsArray); $visitorDetailsArray = $visitor->getAllVisitorDetails(); - $visitorDetailsArray['siteCurrency'] = $website->getCurrency(); + $visitorDetailsArray['siteCurrency'] = $currency; $visitorDetailsArray['siteCurrencySymbol'] = @$currencies[$visitorDetailsArray['siteCurrency']]; $visitorDetailsArray['serverTimestamp'] = $visitorDetailsArray['lastActionTimestamp']; + $dateTimeVisit = Date::factory($visitorDetailsArray['lastActionTimestamp'], $timezone); - $visitorDetailsArray['serverTimePretty'] = $dateTimeVisit->getLocalized('%time%'); - $visitorDetailsArray['serverDatePretty'] = $dateTimeVisit->getLocalized(Piwik::translate('CoreHome_ShortDateFormat')); + if($dateTimeVisit) { + $visitorDetailsArray['serverTimePretty'] = $dateTimeVisit->getLocalized('%time%'); + $visitorDetailsArray['serverDatePretty'] = $dateTimeVisit->getLocalized(Piwik::translate('CoreHome_ShortDateFormat')); + } $dateTimeVisitFirstAction = Date::factory($visitorDetailsArray['firstActionTimestamp'], $timezone); $visitorDetailsArray['serverDatePrettyFirstAction'] = $dateTimeVisitFirstAction->getLocalized(Piwik::translate('CoreHome_ShortDateFormat')); diff --git a/plugins/Live/Controller.php b/plugins/Live/Controller.php index efdde7e9fdf..224cf869ae3 100644 --- a/plugins/Live/Controller.php +++ b/plugins/Live/Controller.php @@ -1,6 +1,6 @@ wasAuthenticationSuccessful()) { $this->processFailedSession($rememberMe); } else { - $this->processSuccessfullSession($login, $authResult->getTokenAuth(), $rememberMe); + $this->processSuccessfulSession($login, $authResult->getTokenAuth(), $rememberMe); } + + /** + * Triggered after session initialize. + * This event notify about end of init session process. + * + * **Example** + * + * Piwik::addAction('Login.initSession.end', function () { + * // session has been initialized + * }); + */ + Piwik::postEvent('Login.initSession.end'); } /** @@ -131,6 +143,33 @@ protected function doAuthenticateSession($login, $md5Password) $this->setLogin($login); $this->setTokenAuth($tokenAuth); + + /** + * Triggered before authenticate function. + * This event propagate login and token_auth which will be using in authenticate process. + * + * This event exists to enable possibility for user authentication prevention. + * For example when user is locked or inactive. + * + * **Example** + * + * Piwik::addAction('Login.authenticate', function ($login, $tokenAuth) { + * if (!UserActivityManager::isActive ($login, $tokenAuth) { + * throw new Exception('Your account is inactive.'); + * } + * }); + * + * @param string $login User login. + * @param string $tokenAuth User token auth. + */ + Piwik::postEvent( + 'Login.authenticate', + array( + $login, + $tokenAuth + ) + ); + $authResult = $this->authenticate(); return $authResult; } @@ -166,8 +205,33 @@ protected function processFailedSession($rememberMe) * @param $tokenAuth * @param $rememberMe */ - protected function processSuccessfullSession($login, $tokenAuth, $rememberMe) + protected function processSuccessfulSession($login, $tokenAuth, $rememberMe) { + /** + * Triggered after successful authenticate, but before cookie creation. + * This event propagate login and token_auth which was used in authenticate process. + * + * This event exists to enable the ability to custom action before the cookie will be created, + * but after a successful authentication. + * For example when user have to fill survey or change password. + * + * **Example** + * + * Piwik::addAction('Login.authenticate.successful', function ($login, $tokenAuth) { + * // redirect to change password action + * }); + * + * @param string $login User login. + * @param string $tokenAuth User token auth. + */ + Piwik::postEvent( + 'Login.authenticate.successful', + array( + $login, + $tokenAuth + ) + ); + $cookie = $this->getAuthCookie($rememberMe); $cookie->set('login', $login); $cookie->set('token_auth', $this->getHashTokenAuth($login, $tokenAuth)); diff --git a/plugins/Login/Controller.php b/plugins/Login/Controller.php index e18ea350d4c..ae4d3e1e4bb 100644 --- a/plugins/Login/Controller.php +++ b/plugins/Login/Controller.php @@ -1,6 +1,6 @@ rendering .= $view->render(); } + + /** + * Get report attachments, ex. graph images + * + * @param $report + * @param $processedReports + * @param $prettyDate + * @return array + */ + public function getAttachments($report, $processedReports, $prettyDate) + { + return array(); + } } diff --git a/plugins/MobileMessaging/SMSProvider.php b/plugins/MobileMessaging/SMSProvider.php index 15fb226315c..9f470ef4d16 100644 --- a/plugins/MobileMessaging/SMSProvider.php +++ b/plugins/MobileMessaging/SMSProvider.php @@ -1,6 +1,6 @@ {% if not isCustomLogo %}Piwik › {% endif %}{{ 'CoreAdminHome_Administration'|translate }} - + {% include "@CoreHome/_favicon.twig" %} diff --git a/plugins/Morpheus/templates/dashboard.twig b/plugins/Morpheus/templates/dashboard.twig index a2dfff69ca5..89484103318 100644 --- a/plugins/Morpheus/templates/dashboard.twig +++ b/plugins/Morpheus/templates/dashboard.twig @@ -9,7 +9,7 @@ {{ siteName|raw }} - {% if isCustomLogo == false %}Piwik › {% endif %} {{ 'CoreHome_WebAnalyticsReports'|translate }} - + {% include "@CoreHome/_favicon.twig" %} diff --git a/plugins/MultiSites/API.php b/plugins/MultiSites/API.php index 19ec7a241c2..37f3b73b0b0 100755 --- a/plugins/MultiSites/API.php +++ b/plugins/MultiSites/API.php @@ -1,6 +1,6 @@ - + {% include "@CoreHome/_favicon.twig" %} diff --git a/plugins/PrivacyManager/Config.php b/plugins/PrivacyManager/Config.php index 88ca3a00b33..fe7d95e7b62 100644 --- a/plugins/PrivacyManager/Config.php +++ b/plugins/PrivacyManager/Config.php @@ -1,6 +1,6 @@ createAttachment($report, $processedReport, $prettyDate); - } - } - } - - return $additionalFiles; - } - - private function createAttachment($report, $processedReport, $prettyDate) - { - $additionalFile = array(); - - $segment = self::getSegment($report['idsegment']); - - $segmentName = $segment != null ? sprintf(' (%s)', $segment['name']) : ''; - - $processedReportMetadata = $processedReport['metadata']; - - $additionalFile['filename'] = - sprintf( - '%s - %s - %s %d - %s %d%s.png', - $processedReportMetadata['name'], - $prettyDate, - Piwik::translate('General_Website'), - $report['idsite'], - Piwik::translate('General_Report'), - $report['idreport'], - $segmentName - ); - - $additionalFile['cid'] = $processedReportMetadata['uniqueId']; - - $additionalFile['content'] = - ReportRenderer::getStaticGraph( - $processedReportMetadata, - Html::IMAGE_GRAPH_WIDTH, - Html::IMAGE_GRAPH_HEIGHT, - $processedReport['evolutionGraph'], - $segment - ); - - $additionalFile['mimeType'] = 'image/png'; - - $additionalFile['encoding'] = Zend_Mime::ENCODING_BASE64; - - return $additionalFile; + return $reportRenderer->getAttachments($report, $processedReports, $prettyDate); } private function checkUserHasViewPermission($login, $idSite) diff --git a/plugins/ScheduledReports/Controller.php b/plugins/ScheduledReports/Controller.php index db617419877..2bb64b8fafb 100644 --- a/plugins/ScheduledReports/Controller.php +++ b/plugins/ScheduledReports/Controller.php @@ -1,6 +1,6 @@ checkUserIsNotAnonymous($userLogin); $userInfo = $this->getUser($userLogin); + $passwordHasBeenUpdated = false; if (empty($password)) { $password = $userInfo['password']; @@ -418,6 +419,8 @@ public function updateUser($userLogin, $password = false, $email = false, $alias UsersManager::checkPassword($password); $password = UsersManager::getPasswordHash($password); } + + $passwordHasBeenUpdated = true; } if (empty($alias)) { @@ -441,10 +444,12 @@ public function updateUser($userLogin, $password = false, $email = false, $alias /** * Triggered after an existing user has been updated. + * Event notify about password change. * * @param string $userLogin The user's login handle. + * @param boolean $passwordHasBeenUpdated Flag containing information about password change. */ - Piwik::postEvent('UsersManager.updateUser.end', array($userLogin)); + Piwik::postEvent('UsersManager.updateUser.end', array($userLogin, $passwordHasBeenUpdated)); } /** diff --git a/plugins/UsersManager/Controller.php b/plugins/UsersManager/Controller.php index 543abdb96a3..12691a5ce01 100644 --- a/plugins/UsersManager/Controller.php +++ b/plugins/UsersManager/Controller.php @@ -1,6 +1,6 @@ userAlias = $user['alias']; $view->userEmail = $user['email']; - $defaultReport = APIUsersManager::getInstance()->getUserPreference($userLogin, APIUsersManager::PREFERENCE_DEFAULT_REPORT); + $userPreferences = new UserPreferences(); + $defaultReport = $userPreferences->getDefaultWebsiteId(); if ($defaultReport === false) { $defaultReport = $this->getDefaultWebsiteId(); } $view->defaultReport = $defaultReport; if ($defaultReport == 'MultiSites') { - $view->defaultReportSiteName = Site::getNameFor($this->getDefaultWebsiteId()); + + $userPreferences = new UserPreferences(); + $view->defaultReportSiteName = Site::getNameFor($userPreferences->getDefaultWebsiteId()); } else { $view->defaultReportSiteName = Site::getNameFor($defaultReport); } @@ -234,6 +237,15 @@ public function userSettings() return $view->render(); } + protected function getDefaultWebsiteId() + { + $sitesId = \Piwik\Plugins\SitesManager\API::getInstance()->getSitesIdWithAdminAccess(); + if (!empty($sitesId)) { + return $sitesId[0]; + } + return false; + } + public function setIgnoreCookie() { Piwik::checkUserHasSomeViewAccess(); diff --git a/plugins/UsersManager/LastSeenTimeLogger.php b/plugins/UsersManager/LastSeenTimeLogger.php index 82928b39ead..61e6c8b1308 100644 --- a/plugins/UsersManager/LastSeenTimeLogger.php +++ b/plugins/UsersManager/LastSeenTimeLogger.php @@ -1,6 +1,6 @@ getUserPreference(Piwik::getCurrentUserLogin(), APIUsersManager::PREFERENCE_DEFAULT_REPORT); + if (is_numeric($defaultReport)) { + $defaultWebsiteId = $defaultReport; + } + + if ($defaultWebsiteId && Piwik::isUserHasViewAccess($defaultWebsiteId)) { + return $defaultWebsiteId; + } + + $sitesId = APISitesManager::getInstance()->getSitesIdWithAtLeastViewAccess(); + if (!empty($sitesId)) { + return $sitesId[0]; + } + return false; + } + + /** + * Returns default date for Piwik reports. + * + * _Note: This value is a Piwik setting set by each user._ + * + * @return string `'today'`, `'2010-01-01'`, etc. + * @api + */ + public function getDefaultDate() + { + // NOTE: a change in this function might mean a change in plugins/UsersManager/javascripts/usersSettings.js as well + $userSettingsDate = APIUsersManager::getInstance()->getUserPreference(Piwik::getCurrentUserLogin(), APIUsersManager::PREFERENCE_DEFAULT_REPORT_DATE); + if ($userSettingsDate == 'yesterday') { + return $userSettingsDate; + } + // if last7, last30, etc. + if (strpos($userSettingsDate, 'last') === 0 + || strpos($userSettingsDate, 'previous') === 0 + ) { + return $userSettingsDate; + } + return 'today'; + } + + /** + * Returns default period type for Piwik reports. + * + * @return string `'day'`, `'week'`, `'month'`, `'year'` or `'range'` + * @api + */ + public function getDefaultPeriod() + { + $userSettingsDate = APIUsersManager::getInstance()->getUserPreference(Piwik::getCurrentUserLogin(), APIUsersManager::PREFERENCE_DEFAULT_REPORT_DATE); + if ($userSettingsDate === false) { + return Config::getInstance()->General['default_period']; + } + if (in_array($userSettingsDate, array('today', 'yesterday'))) { + return 'day'; + } + if (strpos($userSettingsDate, 'last') === 0 + || strpos($userSettingsDate, 'previous') === 0 + ) { + return 'range'; + } + return $userSettingsDate; + } +} \ No newline at end of file diff --git a/plugins/UsersManager/UsersManager.php b/plugins/UsersManager/UsersManager.php index b860aeb1866..b2c4b2e8f3e 100644 --- a/plugins/UsersManager/UsersManager.php +++ b/plugins/UsersManager/UsersManager.php @@ -1,6 +1,6 @@ Plugins['Plugins']; - $plugins[] = 'DevicesDetection'; $pluginsTracker = Config::getInstance()->Plugins_Tracker['Plugins_Tracker']; $oldTrackerConfig = Config::getInstance()->Tracker; diff --git a/tests/PHPUnit/BenchmarkTestCase.php b/tests/PHPUnit/BenchmarkTestCase.php index d3c954ffdc1..6e57944af4f 100755 --- a/tests/PHPUnit/BenchmarkTestCase.php +++ b/tests/PHPUnit/BenchmarkTestCase.php @@ -1,6 +1,6 @@ applicationTester->run(array( + * 'command' => 'my-command', + * 'arg1' => 'value1', + * 'arg2' => 'value2', + * '--option' => true, + * '--another-option' => 'value3' + * )); + * $this->assertEquals(0, $result, $this->getCommandDisplayOutputErrorMessage()); + * + * // other checks + * } + */ +class ConsoleCommandTestCase extends \IntegrationTestCase +{ + protected $applicationTester = null; + + public function setUp() + { + parent::setUp(); + + $application = new Console(); + $application->setAutoExit(false); + + $this->applicationTester = new ApplicationTester($application); + + Config::unsetInstance(); + } + + protected function getCommandDisplayOutputErrorMessage() + { + return "Command did not behave as expected. Command output: " . $this->applicationTester->getDisplay(); + } +} \ No newline at end of file diff --git a/tests/PHPUnit/Core/API/ResponseBuilderTest.php b/tests/PHPUnit/Core/API/ResponseBuilderTest.php index 9f8b886af62..930404cf3e2 100644 --- a/tests/PHPUnit/Core/API/ResponseBuilderTest.php +++ b/tests/PHPUnit/Core/API/ResponseBuilderTest.php @@ -1,6 +1,6 @@ cliMulti->request($urls); $message = "Response was: " . substr( implode("\n\n", $response), 0, 4000); - $this->assertTrue(false !== strpos($response[0], ''), $message); + $this->assertTrue(false !== strpos($response[0], ''), $message); $this->assertTrue(false !== strpos($response[0], 'Widgetize the full dashboard'). $message); } diff --git a/tests/PHPUnit/Integration/Core/CronArchive/FixedSiteIdsTest.php b/tests/PHPUnit/Integration/Core/CronArchive/FixedSiteIdsTest.php index de4c23d63b4..847af0e3c83 100644 --- a/tests/PHPUnit/Integration/Core/CronArchive/FixedSiteIdsTest.php +++ b/tests/PHPUnit/Integration/Core/CronArchive/FixedSiteIdsTest.php @@ -1,6 +1,6 @@