aboutsummaryrefslogtreecommitdiffstats
path: root/documentation/articles/contents.asciidoc
blob: 65de7794726ff4e3f288390544facb729cfeffdf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
---
title: Contents
order: 1
layout: page
---

= Community articles for Vaadin Framework

Helpful articles about Vaadin Framework written by the users for the users. The
articles are presented as written by the author. Vaadin does not edit or maintain them.
Pull requests welcome!

NOTE: All contributions are very welcome! Just write your article in link:asciidoctor.org/docs/asciidoc-writers-guide[AsciiDoc],
put it in this directory and send us a pull request. Updates to existing articles
are great, too.

[discrete]
== Articles
- <<AccessControlForViews#access-control-for-views,"Access control or views">>
- <<CreatingAServlet3%2E0Application#creating-a-servlet-3.0-application,"Creating a Servlet 3.0 application">>
- <<DevelopingPortletsForTheWebSpherePortalServer#developing-portlets-for-the-websphere-portal-server,"Developing portlets for the WebSphere Portal Server">>
- <<ConfigureComboBoxesWisely#configure-comboboxes-wisely,"Configure ComboBoxes wisely">>
- <<LettingTheUserDownloadAFile#letting-the-user-download-a-file,"Letting the user download a file">>
- <<UsingVaadinInIBMDomino#using-vaadin-in-ibm-domino,"Using Vaadin in IBM Domino">>
- <<VaadinTutorialForSwingDevelopers#a-hitchhikers-guide-to-convert-aswing-appto-modern-web-app,"Vaadin tutorial for Swing developers">>
- <<SettingAndReadingSessionAttributes#setting-and-reading-session-attributes,"Setting and reading session attributes">>
- <<EnablingServerPush#enabling-server-push,"Enabling server push">>
- <<CleaningUpResourcesInAUI#cleaning-up-resources-in-a-ui,"Cleaning up resources in a UI">>
- <<SendingEmailFromJavaApplications#sending-email-from-java-applications,"Sending email from Java applications">>
- <<OptimizingSluggishUI#optimizing-sluggish-ui,"Optimizing sluggish UI">>
- <<UsingParametersWithViews#using-parameters-with-views,"Using parameters with views">>
- <<ConfiguringPushForYourEnvironment#configuring-push-for-your-environment,"Configuring push for your environment">>
- <<SettingAndReadingCookies#setting-and-reading-cookies,"Setting and reading cookies">>
- <<UsingPolling#using-polling,"Using polling">>
- <<FindingTheCurrentUIAndPageAndVaadinSession#finding-the-current-ui-and-page-and-vaadin-session,"Finding the current UI and page and Vaadin Session">>
- <<CreatingAnApplicationThatPreservesStateOnRefresh#creating-an-application-that-preserves-state-on-refresh,"Creating an application that preserves state on refresh">>
- <<SendingEventsFromTheClientToTheServerUsingRPC#sending-events-from-the-client-to-the-server-using-RPC,"Sending events from the client to the server using RPC">>
- <<HandlingLogout#handling-logout,"Handling logout">>
- <<ScalableWebApplications#scalable-web-applications,"Scalable web applications">>
- <<RememberToTheSetTheLocale#remember-to-the-set-the-locale,"Remember to the set the locale">>
- <<MVCBasicsInITMillToolkit#mvc-basics-in-itmill-toolkit,"MVC Basics in IT Mill Toolkit">>
- <<CustomizingTheStartupPageInAnApplication#customizing-the-startup-page-in-an-application,"Customizing the startup page in an application">>
- <<UsingURIFragments#using-uri-fragments,"Using URI fragments">>
- <<AccessingWebPageAndBrowserInformation#accessing-web-page-and-browser-information,"Accessing web page and browser information">>
- <<GeneratingDynamicResourcesBasedOnURIOrParameters#generating-dynamic-resources-based-on-uri-or-parameters,"Generating dynamic resources based on URI or parameters">>
- <<OptimizingTheWidgetSet#optimizing-the-widget-set,"Optimizing the widget set">>
- <<UsingServerInitiatedEvents#using-server-initiated-events,"Using server-initiated events">>
- <<ChooseInputFieldComponentsWisely#choosing-input-field-components-wisely,"Choose input field components wisely">>
- <<CreatingASimpleComponent#creating-a-simple-component,"Creating a simple component">>
- <<IntegratingAnExistingGWTWidget#integrating-an-existing-gwt-widget,"Integrating an existing GWT widget">>
- <<IntegrationExperiences#integrating-vaadin-applications-with-other-technologies,"Integration experiences">>
- <<VaadinOnGrailsCreateProjectInIntelliJIDEA#vaadin-on-grails-with-intellij-idea,"Vaadin on grails - Create project in IntelliJ IDEA">>
- <<VaadinOnGrailsDatabaseAccess#vaadin-on-grails-database-access,"Vaadin on grails - Database access">>
- <<VaadinOnGrailsMultipleUIs#vaadin-on-grails-multiple-uis,"Vaadin on grails - Multiple UIs">>
- <<IntegratingAJavaScriptComponent#integrating-a-javascript-component,"Integrating a JavaScript component">>
- <<IntegratingAJavaScriptLibraryAsAnExtension#integrating-a-javascript-library-as-an-extension,"Integrating a JavaScript library as an extension">>
- <<UsingAJavaScriptLibraryOrAStyleSheetInAnAddOn#using-a-javascript-library-or-a-style-sheet-in-an-addon,"Using a JavaScript library or a style sheet in an add-on">>
- <<ExposingServerSideAPIToJavaScript#exposing-server-side-api-to-javascript,"Exposing server-side API to JavaScript">>
- <<UsingRPCFromJavaScript#using-rpc-from-javascript,"Using RPC from JavaScript">>
- <<IBGettingStartedWithVaadinSpringWithoutSpringBoot#i-b-getting-started-with-vaadin-spring-without-spring-boot,"I b - Getting started with Vaadin Spring withoout Spring Boot">>
- <<Vaadin7SpringSecurityBaseAuthentification#vaadin-7-spring-security-base-authentication,"Vaadin 7 + Spring Security (base authentication)">>
- <<UsingBeanValidationToValidateInput#using-bean-validation-to-validate-input,"Using Bean Validation to validate input">>
- <<VaadinSpringTips#vaadin-spring-tips,"Vaadin Spring tips">>
- <<VaadinCDI#vaadin-cdi,"Vaadin CDI">>
- <<IIInjectionAndScopes#ii-injection-and-scopes,"II - Injection and scopes">>
- <<CreatingSecureVaadinApplicationsUsingJEE6#creating-secure-vaadin-applications-using-jee6,"Creating secure Vaadin applications using JEE6">>
- <<UsingVaadinCDIWithJAASAuthentication#using-vaadin-cdi-with-jaas-authentication,"Using Vaadin CDI with JAAS authentication">>
- <<LoadTestingWithGatling#loading-testing-with-gatling,"Load testing with Gatling">>
- <<VaadinScalabilityTestingWithAmazonWebServices#vaadin-scalability-testing-with-amazon-web-services,"Vaadin scalability testing with Amazon Web Services">>
- <<UsingFontIcons#using-font-icons-in-vaadin-7.2,"Using font icons in Vaadin 7.2">>
- <<DynamicallyInjectingCSS#dynamically-injecting-css,"Dynamically injecting CSS">>
- <<ValoExamples#valo-examples,"Valo examples">>
- <<ReadOnlyVsDisabledFields#read-only-vs-disabled-fields,"Read-only vs Disabled fields">>
- <<ValoThemeGettingStarted#valo-theme-getting-started,"Valo theme - Getting started">>
- <<UseTooltipsToClarifyFunctions#use-tooltips-to-clarify-functions,"Use tooltips to clarify functions">>
- <<EnableAndDisableButtonsToIndicateState#enable-and-disable-buttons-to-indicate-state,"Enable and disable buttons to indicate state">>
- <<ChangingThemeOnTheFly#changing-theme-on-the-fly,"Changing theme on the fly">>
- <<MarkRequiredFieldsAsSuch#mark-required-fields-as-such,"Mark required fields as such">>
- <<PackagingSCSSOrCSSinAnAddon#packaging-scss-or-css-in-an-add-on,"Packaging SCSS or CSS in an add-on">>
- <<RightAlignComparableNumericalFields#right-align-comparable-numeric-fields,"Right-align comparable numerical fields">>
- <<CustomizingComponentThemeWithSass#customizing-component-theme-with-sass,"Customizing component theme with Sass">>
- <<WidgetStylingUsingOnlyCSS#widget-styling-using-only-css,"Widget styling using only CSS">>
- <<VisuallyDistinguishPrimaryActions#visually-distinguish-primary-actions,"Visually distinguish primary actions">>
- <<LabelButtonsExpressively#label-buttons-expressively,"Label buttons expressively">>
- <<CreatingAServlet3%2E0Application#creating-a-servlet-3.0-application,"Creating a servlet 3.0 application">>
- <<CreatingAnEclipseProject#creating-an-eclipse-project,"Creating an Eclipse project">>
- <<CreatingASimpleComponentContainer#creating-a-simple-component-container,"Creating a simple component container">>
- <<UsingRPCToSendEventsToTheClient#using-rpc-to-send-events-to-the-client,"Using RPC to send events to the client">>
- <<CreatingAComponentExtension#creating-a-component-extension,"Creating a component extension">>
- <<CreatingAUIExtension#creating-a-ui-extension,"Creating a UI extension">>
- <<UsingDeclarativeServices#using-declarative-services,"Using declarative services">>
- <<DynamicallyUpdatingStateBeforeSendingChangesToClient#dynamically-updating-state-before-sending-changes-to-client,"Dynamically updating state before sending changes to client">>
- <<GettingStartedOnNetBeans#getting-started-on-netbeans,"Getting started on NetBeans">>
- <<ComponentAddonProjectSetupHOWTO#component-add-on-project-setup-howto,"Component add-on project setup how-to">>
- <<CreatingAThemeUsingSass#creating-a-theme-using-sass,"Creating a theme using Sass">>
- <<OpeningAUIInAPopupWindow#opening-a-ui-in-a-popup-window,"Opening a UI in a popup window">>
- <<ViewChangeConfirmations#view-change-confirmations,"View change confirmations">>
- <<CreatingABookmarkableApplicationWithBackButtonSupport#creating-a-bookmarkable-application-with-back-button-support,"Creating a bookmarkable application with back button support">>
- <<BroadcastingMessagesToOtherUsers#broadcasting-messages-to-other-users,"Broadcasting messages to other users">>
- <<ConfigureInputFieldsToGuideDataEntry#configure-input-fields-to-guide-data-entry,"Configure input fields to guide data entry">>
- <<CreatingMultiTabApplications#creating-multi-tab-applications,"Creating multi-tab applications">>
- <<AddingASplashScreen#adding-a-splash-sreen,"Adding a splash screen">>
value='backport/48013/stable29'>backport/48013/stable29 Nextcloud server, a safe home for all your data: https://github.com/nextcloud/serverwww-data
aboutsummaryrefslogtreecommitdiffstats
path: root/lib/log.php
blob: 894575ef059b516a161ac515ead774e40b1bee87 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
<?php
/**
 * ownCloud
 *
 * @author Frank Karlitschek
 * @author Jakob Sack
 * @copyright 2010 Frank Karlitschek karlitschek@kde.org
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
 * License as published by the Free Software Foundation; either
 * version 3 of the License, or any later version.
 *
 * This library 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 AFFERO GENERAL PUBLIC LICENSE for more details.
 *
 * You should have received a copy of the GNU Affero General Public
 * License along with this library.  If not, see <http://www.gnu.org/licenses/>.
 *
 */
/*
 *
 * The following SQL statement is just a help for developers and will not be
 * executed!
 *
 * CREATE TABLE `log` (
 * `id` INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY ,
 * `moment` DATETIME NOT NULL ,
 * `appid` VARCHAR( 255 ) NOT NULL ,
 * `user` VARCHAR( 255 ) NOT NULL ,
 * `action` VARCHAR( 255 ) NOT NULL ,
 * `info` TEXT NOT NULL
 * ) ENGINE = MYISAM ;
 *
 */

/**
 * This class is for logging
 */
class OC_LOG {
	/**
	 * @brief adds an entry to the log
	 * @param $appid id of the app
	 * @param $subject username
	 * @param $predicate action
	 * @param $object = null; additional information
	 * @returns true/false
	 *
	 * This function adds another entry to the log database
	 */
	public static function add( $appid, $subject, $predicate, $object = ' ' ){
		$query=OC_DB::prepare("INSERT INTO *PREFIX*log(moment,appid,user,action,info) VALUES(NOW(),?,?,?,?)");
		$result=$query->execute(array($appid,$subject,$predicate,$object));
		// Die if we have an error
		if( PEAR::isError($result)) {
			$entry = 'DB Error: "'.$result->getMessage().'"<br />';
			$entry .= 'Offending command was: '.$query.'<br />';
			error_log( $entry );
			die( $entry );
		}
		return true;
	}

	/**
	 * @brief Fetches log entries
	 * @param $filter = array(); array with filter options
	 * @returns array with entries
	 *
	 * This function fetches the log entries according to the filter options
	 * passed.
	 *
	 * $filter is an associative array.
	 * The following keys are optional:
	 *   - from: all entries after this date
	 *   - until: all entries until this date
	 *   - user: username (default: current user)
	 *   - app: only entries for this app
	 */
	public static function get( $filter = array()){
		$queryString='SELECT * FROM *PREFIX*log WHERE 1=1 ORDER BY moment DESC';
		$params=array();
		if(isset($filter['from'])){
			$queryString.='AND moment>? ';
			array_push($params,$filter('from'));
		}
		if(isset($filter['until'])){
			$queryString.='AND moment<? ';
			array_push($params,$filter('until'));
		}
		if(isset($filter['user'])){
			$queryString.='AND user=? ';
			array_push($params,$filter('user'));
		}
		if(isset($filter['app'])){
			$queryString.='AND appid=? ';
			array_push($params,$filter('app'));
		}
		$query=OC_DB::prepare($queryString);
		$result=$query->execute($params)->fetchAll();
		if(count($result)>0 and is_numeric($result[0]['moment'])){
			foreach($result as &$row){
				$row['moment']=OC_UTIL::formatDate($row['moment']);
			}
		}
		return $result;
		
	}

	/**
	 * @brief removes log entries
	 * @param $date delete entries older than this date
	 * @returns true/false
	 *
	 * This function deletes all entries that are older than $date.
	 */
	public static function deleteBefore( $date ){
		$query=OC_DB::prepare("DELETE FROM *PREFIX*log WHERE moment<?");
		$query->execute(array($date));
		return true;
	}

	/**
	 * @brief removes all log entries
	 * @returns true/false
	 *
	 * This function deletes all log entries.
	 */
	public static function deleteAll(){
		$query=OC_DB::prepare("DELETE FROM *PREFIX*log");
		$query->execute();
		return true;
	}
	
	/**
	 * @brief filter an array of log entries on action
	 * @param array $logs the log entries to filter
	 * @param array $actions an array of actions to filter for
	 * @returns array
	 */
	public static function filterAction($logs,$actions){
		$filteredLogs=array();
		foreach($logs as $log){
			if(array_search($log['action'],$actions)!==false){
				$filteredLogs[]=$log;
			}
		}
		return $filteredLogs;
	}
}



?>