8 |
9 | This file is part of XAMPP.
10 |
11 | XAMPP is free software: you can redistribute it and/or modify
12 | it under the terms of the GNU General Public License as published by
13 | the Free Software Foundation, either version 3 of the License, or
14 | (at your option) any later version.
15 |
16 | XAMPP is distributed in the hope that it will be useful,
17 | but WITHOUT ANY WARRANTY; without even the implied warranty of
18 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 | GNU General Public License for more details.
20 |
21 | You should have received a copy of the GNU General Public License
22 | along with XAMPP. If not, see .
23 |
24 | */
25 |
26 | #import "ProFTPDSecurityCheck.h"
27 |
28 |
29 | @implementation ProFTPDSecurityCheck
30 |
31 | - (id) init
32 | {
33 | self = [super init];
34 | if (self != nil) {
35 |
36 | if (![NSBundle loadNibNamed:@"ProFTPDSecurityCheck" owner:self]) {
37 | [self release];
38 | return Nil;
39 | }
40 |
41 | [self setTitle:XPLocalizedString(@"Secure ProFTPD", @"The title of the Security Check ProFTPD page")];
42 | [self setStepTitle:XPLocalizedString(@"ProFTPD", @"The step title of the Security Check ProFTPD page which will displayed on the left side")];
43 | [self setType:AssistantNormalPage];
44 | }
45 | return self;
46 | }
47 |
48 | - (id) copyWithZone:(NSZone *)zone
49 | {
50 | return [[[self class] allocWithZone:zone] init];
51 | }
52 |
53 | - (BOOL) valid
54 | {
55 | if (changeNobodyPassword) {
56 | if ([[password stringValue] length] < 6)
57 | return NO;
58 |
59 | if (![[password stringValue] isEqualToString:[passwordConfirm stringValue]])
60 | return NO;
61 | }
62 |
63 | return YES;
64 | }
65 |
66 | - (void) calcualteTasks
67 | {
68 |
69 | }
70 |
71 | - (NSArray*) tasks
72 | {
73 | return [NSArray array];
74 | }
75 |
76 | - (void) checkSecurity
77 | {
78 |
79 | }
80 |
81 | - (BOOL) isSecure
82 | {
83 | return NO;
84 | }
85 |
86 | @end
87 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | XAMPP Control
2 | =============
3 |
4 | XAMPP Control is an simple little application that helps on the all day use of XAMPP on Mac OS X. It's shipped with XAMPP since 1.0.0.
5 |
--------------------------------------------------------------------------------
/Resources/AlertCautionIcon.icns:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ApacheFriends/XAMPP-Control/f0654c67ce3ac32bcfdc89d7103f1f69cfadf4bd/Resources/AlertCautionIcon.icns
--------------------------------------------------------------------------------
/Resources/AssistantStepActive.tiff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ApacheFriends/XAMPP-Control/f0654c67ce3ac32bcfdc89d7103f1f69cfadf4bd/Resources/AssistantStepActive.tiff
--------------------------------------------------------------------------------
/Resources/AssistantStepDisabled.tiff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ApacheFriends/XAMPP-Control/f0654c67ce3ac32bcfdc89d7103f1f69cfadf4bd/Resources/AssistantStepDisabled.tiff
--------------------------------------------------------------------------------
/Resources/AssistantStepInactive.tiff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ApacheFriends/XAMPP-Control/f0654c67ce3ac32bcfdc89d7103f1f69cfadf4bd/Resources/AssistantStepInactive.tiff
--------------------------------------------------------------------------------
/Resources/English.lproj/Credits.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
33 |
34 |
35 |
36 | The Apache Friends Team
37 |
38 | - Carsten Wiedmann - Support & Windows Version
39 | - Christian Speich - Mac OS X Version
40 | - Florian Pollini - Support
41 | - Henning Bopp - Support
42 | - Kai 'Oswald' Seidler - Project Leader & Linux Version
43 | - Kay Vogelgesang - Windows Version
44 | - Michael Kremsier - Support
45 | - Stefan König - Support
46 |
47 |
48 |
--------------------------------------------------------------------------------
/Resources/English.lproj/GettingStarted.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
18 |
19 |
20 |
21 |
22 | Getting Started
23 | Where should I put my Websites?
24 |
25 | You can put your Websites in #XAMPP_ROOT#htdocs/ and access them via
26 | http://localhost/
27 |
28 | Or you put your Websites in the Sites-Folder in your Home and access them via
29 | http://localhost/~#USER#/.
30 |
31 | Whats the username and the password for MySQL?
32 |
33 |
34 | Username: | root |
35 | Password: | No password |
36 |
37 |
38 |
39 |
--------------------------------------------------------------------------------
/Resources/English.lproj/InfoPlist.strings:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ApacheFriends/XAMPP-Control/f0654c67ce3ac32bcfdc89d7103f1f69cfadf4bd/Resources/English.lproj/InfoPlist.strings
--------------------------------------------------------------------------------
/Resources/English.lproj/Localizable.strings:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ApacheFriends/XAMPP-Control/f0654c67ce3ac32bcfdc89d7103f1f69cfadf4bd/Resources/English.lproj/Localizable.strings
--------------------------------------------------------------------------------
/Resources/German.lproj/Credits.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
33 |
34 |
35 |
36 | Das Apache Friends Team
37 |
38 | - Carsten Wiedmann - Support & Windows Version
39 | - Christian Speich - Mac OS X Version
40 | - Florian Pollini - Support
41 | - Henning Bopp - Support
42 | - Kai 'Oswald' Seidler - Projektleiter & Linux Version
43 | - Kay Vogelgesang - Windows Version
44 | - Michael Kremsier - Support
45 | - Stefan König - Support
46 |
47 |
48 |
--------------------------------------------------------------------------------
/Resources/German.lproj/GettingStarted.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
18 |
19 |
20 |
21 |
22 | Erste Schritte
23 | Wo soll ich meine Seiten ablegen?
24 |
25 | Du kannst deine Seiten in #XAMPP_ROOT#htdocs/ ablegen und dann via
26 | http://localhost/ aufrufen.
27 |
28 | Oder du legst deine Webseiten in den Websites-Ordner in deinem Benutzerverzeichnis ab und kannst sie dann via
29 | http://localhost/~#USER#/ aufrufen.
30 |
31 | Wie lautet der Benutzername und das Passwort von MySQL?
32 |
33 |
34 | Benutzername: | root |
35 | Passwort: | Kein Passwort |
36 |
37 |
38 |
39 |
--------------------------------------------------------------------------------
/Resources/German.lproj/Localizable.strings:
--------------------------------------------------------------------------------
1 | /* Cancel */
2 | "Cancel" = "Abbrechen";
3 |
4 | /* The hostname can not resolved! */
5 | "HostnameError001" = "Der Computername konnte nicht aufgelöst werden!";
6 |
7 | /* XAMPP can not resolve the IP for the hostname of this computer. By clicking 'OK', XAMPP will add the hostname to the hosts-File. */
8 | "HostnameError001Description" = "XAMPP konnte nicht die IP-Addresse für den Computernamen ermitteln. Bei einem Klick auf 'OK', wird XAMPP den Computernamen in die hosts-Datei einfügen.";
9 |
10 | /* Button Title for the Install Guide */
11 | "InstallGuideButton" = "Installations Anleitung";
12 |
13 | /* OK */
14 | "OK" = "OK";
15 |
16 | /* Reload the Module %@ */
17 | "Reload %@" = "%@ aktualisieren";
18 |
19 | /* Module is Running ToolTip */
20 | "Running" = "Läuft";
21 |
22 | /* Start a Module */
23 | "Start" = "Starten";
24 |
25 | /* Start the Module %@ */
26 | "Start %@" = "%@ starten";
27 |
28 | /* Module is Starting ToolTip */
29 | "Starting" = "Startet…";
30 |
31 | /* Stop a Module */
32 | "Stop" = "Stoppen";
33 |
34 | /* Stop the Module %@ */
35 | "Stop %@" = "%@ stoppen";
36 |
37 | /* Module is Stopping ToolTip */
38 | "Stopping" = "Stoppt…";
39 |
40 | /* Module is in a Unknown Stat ToolTip */
41 | "Unknown" = "Unbekant";
42 |
43 | /* Alert Message for the Wrong Install Location error */
44 | "WorngInstallLocation" = "XAMPP befindet sich am falschen Ort!";
45 |
46 | /* Alert Message Description for the Wrong Install Location error */
47 | "WorngInstallLocationDescription" = "XAMPP muss unter /Programme (/Applications) zu finden sein. Bitte folge genau den Installations Anweisungen.";
48 |
--------------------------------------------------------------------------------
/Resources/Icon.icns:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ApacheFriends/XAMPP-Control/f0654c67ce3ac32bcfdc89d7103f1f69cfadf4bd/Resources/Icon.icns
--------------------------------------------------------------------------------
/Resources/IndicatorGreen.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ApacheFriends/XAMPP-Control/f0654c67ce3ac32bcfdc89d7103f1f69cfadf4bd/Resources/IndicatorGreen.png
--------------------------------------------------------------------------------
/Resources/IndicatorRed.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ApacheFriends/XAMPP-Control/f0654c67ce3ac32bcfdc89d7103f1f69cfadf4bd/Resources/IndicatorRed.png
--------------------------------------------------------------------------------
/Resources/IndicatorUnknown.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ApacheFriends/XAMPP-Control/f0654c67ce3ac32bcfdc89d7103f1f69cfadf4bd/Resources/IndicatorUnknown.png
--------------------------------------------------------------------------------
/Resources/IndicatorYellow.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ApacheFriends/XAMPP-Control/f0654c67ce3ac32bcfdc89d7103f1f69cfadf4bd/Resources/IndicatorYellow.png
--------------------------------------------------------------------------------
/Resources/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | BetaFeedbackURL
6 | http://www.apachefriends.org/xampp-beta.php
7 | SupportForumURL
8 | http://www.apachefriends.org/f/
9 | BugtrackerURL
10 | http://bugs.xampp.org/
11 | InstallGuideURL
12 | http://www.apachefriends.org/en/xampp-macosx.html
13 | XAMPPPath
14 | /Applications/XAMPP/
15 | isBeta
16 | YES
17 | CFBundleDevelopmentRegion
18 | English
19 | CFBundleExecutable
20 | ${EXECUTABLE_NAME}
21 | CFBundleIconFile
22 | Icon.icns
23 | CFBundleIdentifier
24 | org.apachefriends.${PRODUCT_NAME:identifier}
25 | CFBundleInfoDictionaryVersion
26 | 6.0
27 | CFBundleName
28 | ${PRODUCT_NAME}
29 | CFBundlePackageType
30 | APPL
31 | CFBundleShortVersionString
32 | 1.7.3-beta1
33 | CFBundleSignature
34 | ????
35 | CFBundleVersion
36 | B8B.1
37 | NSMainNibFile
38 | MainMenu
39 | NSPrincipalClass
40 | NSApplication
41 |
42 |
43 |
--------------------------------------------------------------------------------
/Resources/TaskFailed.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ApacheFriends/XAMPP-Control/f0654c67ce3ac32bcfdc89d7103f1f69cfadf4bd/Resources/TaskFailed.png
--------------------------------------------------------------------------------
/Resources/TaskSuccess.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ApacheFriends/XAMPP-Control/f0654c67ce3ac32bcfdc89d7103f1f69cfadf4bd/Resources/TaskSuccess.png
--------------------------------------------------------------------------------
/Resources/success_big.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ApacheFriends/XAMPP-Control/f0654c67ce3ac32bcfdc89d7103f1f69cfadf4bd/Resources/success_big.png
--------------------------------------------------------------------------------
/Sources/AboutController.h:
--------------------------------------------------------------------------------
1 | /*
2 |
3 | XAMPP
4 | Copyright (C) 2009 by Apache Friends
5 |
6 | Authors of this file:
7 | - Christian Speich
8 |
9 | This file is part of XAMPP.
10 |
11 | XAMPP is free software: you can redistribute it and/or modify
12 | it under the terms of the GNU General Public License as published by
13 | the Free Software Foundation, either version 3 of the License, or
14 | (at your option) any later version.
15 |
16 | XAMPP is distributed in the hope that it will be useful,
17 | but WITHOUT ANY WARRANTY; without even the implied warranty of
18 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 | GNU General Public License for more details.
20 |
21 | You should have received a copy of the GNU General Public License
22 | along with XAMPP. If not, see .
23 |
24 | */
25 |
26 | #import
27 | #import
28 |
29 | @interface AboutController : NSWindowController {
30 | IBOutlet NSTextField *XAMPPName;
31 | IBOutlet NSTextField *versionsField;
32 |
33 | IBOutlet WebView *webView;
34 | }
35 |
36 | - (void) setupContent;
37 |
38 | @end
39 |
--------------------------------------------------------------------------------
/Sources/AboutController.m:
--------------------------------------------------------------------------------
1 | /*
2 |
3 | XAMPP
4 | Copyright (C) 2009 by Apache Friends
5 |
6 | Authors of this file:
7 | - Christian Speich
8 |
9 | This file is part of XAMPP.
10 |
11 | XAMPP is free software: you can redistribute it and/or modify
12 | it under the terms of the GNU General Public License as published by
13 | the Free Software Foundation, either version 3 of the License, or
14 | (at your option) any later version.
15 |
16 | XAMPP is distributed in the hope that it will be useful,
17 | but WITHOUT ANY WARRANTY; without even the implied warranty of
18 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 | GNU General Public License for more details.
20 |
21 | You should have received a copy of the GNU General Public License
22 | along with XAMPP. If not, see .
23 |
24 | */
25 |
26 | #import "AboutController.h"
27 | #import "XPConfiguration.h"
28 |
29 | #import
30 | #import
31 |
32 | @implementation AboutController
33 |
34 | - (NSString *)windowNibName
35 | {
36 | return @"About";
37 | }
38 |
39 | - (IBAction)showWindow:(id)sender
40 | {
41 | if (![self isWindowLoaded]) {
42 | [self loadWindow];
43 |
44 | [self setupContent];
45 | }
46 |
47 | return [super showWindow:sender];
48 | }
49 |
50 | - (void) setupContent
51 | {
52 | NSMutableAttributedString* versionsString;
53 | NSMutableAttributedString* XAMPPString;
54 | NSMutableString* creditsHTML;
55 | NSMutableParagraphStyle* centeredParagraphStyle;
56 |
57 | centeredParagraphStyle = [NSMutableParagraphStyle new];
58 | [centeredParagraphStyle setAlignment:NSCenterTextAlignment];
59 |
60 | XAMPPString = [[XAMPPName attributedStringValue] mutableCopy];
61 | versionsString = [[NSMutableAttributedString alloc] initWithString:[NSString stringWithFormat:@"Version %@", [XPConfiguration version]]
62 | attributes:[NSDictionary dictionaryWithObject:centeredParagraphStyle forKey:NSParagraphStyleAttributeName]];
63 | creditsHTML = [[NSMutableString alloc] initWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"Credits" ofType:@"html"]];
64 |
65 | PlugInInvokeHook(AboutWindowSetupHook,
66 | [NSDictionary dictionaryWithObjectsAndKeys:
67 | XAMPPString, HookXAMPPLabelKey,
68 | versionsString, HookVersionsStringKey,
69 | creditsHTML, HookCreditsHTMLKey,
70 | [self window], HookWindowKey,
71 | Nil]);
72 |
73 | [XAMPPName setAttributedStringValue:XAMPPString];
74 | [versionsField setAttributedStringValue:versionsString];
75 | [[webView mainFrame] loadHTMLString:creditsHTML
76 | baseURL:Nil];
77 |
78 | [versionsString release];
79 | [XAMPPString release];
80 | [creditsHTML release];
81 | [centeredParagraphStyle release];
82 | }
83 |
84 | @end
85 |
--------------------------------------------------------------------------------
/Sources/Additions/NSBezierPathAdditions.h:
--------------------------------------------------------------------------------
1 | /*
2 | File: NSBezierPathAdditions.h
3 |
4 | Abstract: NSBezierPath convenience nethods for drawing rectangles with rounded corners
5 |
6 | Version: 1.0
7 |
8 | Copyright: © Copyright 2005 Apple Computer, Inc. All rights reserved.
9 |
10 | Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple Computer, Inc.
11 | ("Apple") in consideration of your agreement to the following terms, and your
12 | use, installation, modification or redistribution of this Apple software
13 | constitutes acceptance of these terms. If you do not agree with these terms,
14 | please do not use, install, modify or redistribute this Apple software.
15 |
16 | In consideration of your agreement to abide by the following terms, and subject
17 | to these terms, Apple grants you a personal, non-exclusive license, under Apple's
18 | copyrights in this original Apple software (the "Apple Software"), to use,
19 | reproduce, modify and redistribute the Apple Software, with or without
20 | modifications, in source and/or binary forms; provided that if you redistribute
21 | the Apple Software in its entirety and without modifications, you must retain
22 | this notice and the following text and disclaimers in all such redistributions of
23 | the Apple Software. Neither the name, trademarks, service marks or logos of
24 | Apple Computer, Inc. may be used to endorse or promote products derived from the
25 | Apple Software without specific prior written permission from Apple. Except as
26 | expressly stated in this notice, no other rights or licenses, express or implied,
27 | are granted by Apple herein, including but not limited to any patent rights that
28 | may be infringed by your derivative works or by other works in which the Apple
29 | Software may be incorporated.
30 |
31 | The Apple Software is provided by Apple on an "AS IS" basis. APPLE MAKES NO
32 | WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED
33 | WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
34 | PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND OPERATION ALONE OR IN
35 | COMBINATION WITH YOUR PRODUCTS.
36 |
37 | IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL OR
38 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
39 | GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
40 | ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION
41 | OF THE APPLE SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT, TORT
42 | (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN
43 | ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
44 | */
45 |
46 | #import
47 |
48 | @interface NSBezierPath (RoundRect)
49 | + (NSBezierPath *)bezierPathWithRoundedRect:(NSRect)rect cornerRadius:(float)radius;
50 |
51 | - (void)appendBezierPathWithRoundedRect:(NSRect)rect cornerRadius:(float)radius;
52 | @end
--------------------------------------------------------------------------------
/Sources/Additions/NSBezierPathAdditions.m:
--------------------------------------------------------------------------------
1 | /*
2 | File: NSBezierPathAdditions.m
3 |
4 | Abstract: NSBezierPath convenience nethods for drawing rectangles with rounded corners
5 |
6 | Version: 1.0
7 |
8 | Copyright: © Copyright 2005 Apple Computer, Inc. All rights reserved.
9 |
10 | Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple Computer, Inc.
11 | ("Apple") in consideration of your agreement to the following terms, and your
12 | use, installation, modification or redistribution of this Apple software
13 | constitutes acceptance of these terms. If you do not agree with these terms,
14 | please do not use, install, modify or redistribute this Apple software.
15 |
16 | In consideration of your agreement to abide by the following terms, and subject
17 | to these terms, Apple grants you a personal, non-exclusive license, under Apple's
18 | copyrights in this original Apple software (the "Apple Software"), to use,
19 | reproduce, modify and redistribute the Apple Software, with or without
20 | modifications, in source and/or binary forms; provided that if you redistribute
21 | the Apple Software in its entirety and without modifications, you must retain
22 | this notice and the following text and disclaimers in all such redistributions of
23 | the Apple Software. Neither the name, trademarks, service marks or logos of
24 | Apple Computer, Inc. may be used to endorse or promote products derived from the
25 | Apple Software without specific prior written permission from Apple. Except as
26 | expressly stated in this notice, no other rights or licenses, express or implied,
27 | are granted by Apple herein, including but not limited to any patent rights that
28 | may be infringed by your derivative works or by other works in which the Apple
29 | Software may be incorporated.
30 |
31 | The Apple Software is provided by Apple on an "AS IS" basis. APPLE MAKES NO
32 | WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED
33 | WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
34 | PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND OPERATION ALONE OR IN
35 | COMBINATION WITH YOUR PRODUCTS.
36 |
37 | IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL OR
38 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
39 | GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
40 | ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION
41 | OF THE APPLE SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT, TORT
42 | (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN
43 | ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
44 | */
45 |
46 | #import "NSBezierPathAdditions.h"
47 |
48 | @implementation NSBezierPath (RoundRect)
49 |
50 | + (NSBezierPath *)bezierPathWithRoundedRect:(NSRect)rect cornerRadius:(float)radius {
51 | NSBezierPath *result = [NSBezierPath bezierPath];
52 | [result appendBezierPathWithRoundedRect:rect cornerRadius:radius];
53 | return result;
54 | }
55 |
56 | - (void)appendBezierPathWithRoundedRect:(NSRect)rect cornerRadius:(float)radius {
57 | if (!NSIsEmptyRect(rect)) {
58 | if (radius > 0.0) {
59 | // Clamp radius to be no larger than half the rect's width or height.
60 | float clampedRadius = MIN(radius, 0.5 * MIN(rect.size.width, rect.size.height));
61 |
62 | NSPoint topLeft = NSMakePoint(NSMinX(rect), NSMaxY(rect));
63 | NSPoint topRight = NSMakePoint(NSMaxX(rect), NSMaxY(rect));
64 | NSPoint bottomRight = NSMakePoint(NSMaxX(rect), NSMinY(rect));
65 |
66 | [self moveToPoint:NSMakePoint(NSMidX(rect), NSMaxY(rect))];
67 | [self appendBezierPathWithArcFromPoint:topLeft toPoint:rect.origin radius:clampedRadius];
68 | [self appendBezierPathWithArcFromPoint:rect.origin toPoint:bottomRight radius:clampedRadius];
69 | [self appendBezierPathWithArcFromPoint:bottomRight toPoint:topRight radius:clampedRadius];
70 | [self appendBezierPathWithArcFromPoint:topRight toPoint:topLeft radius:clampedRadius];
71 | [self closePath];
72 | } else {
73 | // When radius == 0.0, this degenerates to the simple case of a plain rectangle.
74 | [self appendBezierPathWithRect:rect];
75 | }
76 | }
77 | }
78 |
79 | @end
--------------------------------------------------------------------------------
/Sources/Additions/NSFileHandle+OpenAsRoot.h:
--------------------------------------------------------------------------------
1 | //
2 | // NSFileHandle+OpenAsRoot.h
3 | // XAMPP Control
4 | //
5 | // Created by Christian Speich on 26.06.09.
6 | // Copyright 2009 __MyCompanyName__. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 |
12 | @interface NSFileHandle (OpenAsRoot)
13 |
14 | + (id)fileHandleWithRootPrivilegesForUpdatingAtPath:(NSString *)path;
15 |
16 | @end
17 |
--------------------------------------------------------------------------------
/Sources/Additions/NSObject+Additions.h:
--------------------------------------------------------------------------------
1 | /*
2 |
3 | XAMPP
4 | Copyright (C) 2009 by Apache Friends
5 |
6 | Authors of this file:
7 | - Christian Speich
8 |
9 | This file is part of XAMPP.
10 |
11 | XAMPP is free software: you can redistribute it and/or modify
12 | it under the terms of the GNU General Public License as published by
13 | the Free Software Foundation, either version 3 of the License, or
14 | (at your option) any later version.
15 |
16 | XAMPP is distributed in the hope that it will be useful,
17 | but WITHOUT ANY WARRANTY; without even the implied warranty of
18 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 | GNU General Public License for more details.
20 |
21 | You should have received a copy of the GNU General Public License
22 | along with XAMPP. If not, see .
23 |
24 | */
25 |
26 | #import
27 |
28 |
29 | @interface NSObject (Additions)
30 |
31 | - (id) mainThreadProxy;
32 | - (id) unproxy;
33 |
34 | @end
35 |
--------------------------------------------------------------------------------
/Sources/Additions/NSObject+Additions.m:
--------------------------------------------------------------------------------
1 | //
2 | // NSObject+Additions.m
3 | // XAMPP Control
4 | //
5 | // Created by Christian Speich on 10.07.09.
6 | // Copyright 2009 __MyCompanyName__. All rights reserved.
7 | //
8 |
9 | #import "NSObject+Additions.h"
10 | #import "XPMainThreadProxy.h"
11 |
12 | @implementation NSObject (Additions)
13 |
14 | - (id) mainThreadProxy
15 | {
16 | XPMainThreadProxy *proxy = [[XPMainThreadProxy alloc] init];
17 |
18 | [proxy setTarget:self];
19 |
20 | return [proxy autorelease];
21 | }
22 |
23 | - (id)unproxy {
24 | if([self isKindOfClass:NSClassFromString(@"_NSControllerObjectProxy")]) {
25 | return [self valueForKey:@"unproxy"];
26 | } else {
27 | return self;
28 | }
29 | }
30 |
31 | @end
32 |
--------------------------------------------------------------------------------
/Sources/Additions/NSString+Additions.h:
--------------------------------------------------------------------------------
1 | /*
2 |
3 | XAMPP
4 | Copyright (C) 2009 by Apache Friends
5 |
6 | Authors of this file:
7 | - Christian Speich
8 |
9 | This file is part of XAMPP.
10 |
11 | XAMPP is free software: you can redistribute it and/or modify
12 | it under the terms of the GNU General Public License as published by
13 | the Free Software Foundation, either version 3 of the License, or
14 | (at your option) any later version.
15 |
16 | XAMPP is distributed in the hope that it will be useful,
17 | but WITHOUT ANY WARRANTY; without even the implied warranty of
18 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 | GNU General Public License for more details.
20 |
21 | You should have received a copy of the GNU General Public License
22 | along with XAMPP. If not, see .
23 |
24 | */
25 |
26 | #import
27 |
28 |
29 | @interface NSString (Additions)
30 |
31 | - (BOOL) boolValue;
32 |
33 | @end
34 |
--------------------------------------------------------------------------------
/Sources/Additions/NSString+Additions.m:
--------------------------------------------------------------------------------
1 | //
2 | // NSString+Additions.m
3 | // XAMPP Control
4 | //
5 | // Created by Christian Speich on 10.07.09.
6 | // Copyright 2009 __MyCompanyName__. All rights reserved.
7 | //
8 |
9 | #import "NSString+Additions.h"
10 |
11 |
12 | @implementation NSString (Additions)
13 |
14 | - (BOOL) boolValue
15 | {
16 | if ([self hasPrefix:@"Y"]
17 | || [self hasPrefix:@"y"]
18 | || [self hasPrefix:@"T"]
19 | || [self hasPrefix:@"t"])
20 | return YES;
21 |
22 | return [self intValue]!=0;
23 | }
24 |
25 | @end
26 |
--------------------------------------------------------------------------------
/Sources/Additions/NSWorkspace+Additions.h:
--------------------------------------------------------------------------------
1 | /*
2 |
3 | XAMPP
4 | Copyright (C) 2009 by Apache Friends
5 |
6 | Authors of this file:
7 | - Christian Speich
8 |
9 | This file is part of XAMPP.
10 |
11 | XAMPP is free software: you can redistribute it and/or modify
12 | it under the terms of the GNU General Public License as published by
13 | the Free Software Foundation, either version 3 of the License, or
14 | (at your option) any later version.
15 |
16 | XAMPP is distributed in the hope that it will be useful,
17 | but WITHOUT ANY WARRANTY; without even the implied warranty of
18 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 | GNU General Public License for more details.
20 |
21 | You should have received a copy of the GNU General Public License
22 | along with XAMPP. If not, see .
23 |
24 | */
25 |
26 | #import
27 |
28 |
29 | @interface NSWorkspace (Additions)
30 |
31 | - (BOOL) processIsRunning:(pid_t)aPID;
32 | - (BOOL) processIsRunningWithName:(NSString*)name;
33 | - (BOOL) isPortInUse:(uint)port;
34 |
35 | @end
36 |
--------------------------------------------------------------------------------
/Sources/Additions/NSWorkspace+Additions.m:
--------------------------------------------------------------------------------
1 | /*
2 |
3 | XAMPP
4 | Copyright (C) 2009 by Apache Friends
5 |
6 | Authors of this file:
7 | - Christian Speich
8 |
9 | This file is part of XAMPP.
10 |
11 | XAMPP is free software: you can redistribute it and/or modify
12 | it under the terms of the GNU General Public License as published by
13 | the Free Software Foundation, either version 3 of the License, or
14 | (at your option) any later version.
15 |
16 | XAMPP is distributed in the hope that it will be useful,
17 | but WITHOUT ANY WARRANTY; without even the implied warranty of
18 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 | GNU General Public License for more details.
20 |
21 | You should have received a copy of the GNU General Public License
22 | along with XAMPP. If not, see .
23 |
24 | */
25 |
26 | #import "NSWorkspace+Additions.h"
27 |
28 | #include
29 | #include
30 |
31 | @implementation NSWorkspace (Additions)
32 |
33 | - (BOOL) processIsRunning:(pid_t)aPID
34 | {
35 | int name[] = {CTL_KERN, KERN_PROC, KERN_PROC_ALL, 0};
36 |
37 | size_t length = 0;
38 |
39 | if (sysctl(name, 4, NULL, &length, NULL, 0) != noErr)
40 | return NO;
41 |
42 | struct kinfo_proc *result = malloc(length);
43 |
44 | if (sysctl(name, 4, result, &length, NULL, 0) != noErr)
45 | return NO;
46 |
47 | struct kinfo_proc *tmpInfoProc;
48 | int i, procCount = length / sizeof(struct kinfo_proc);
49 |
50 | for (i=0; ikp_proc.p_pid == aPID)
55 | {
56 | free(result);
57 | return YES;
58 | }
59 | }
60 |
61 | free(result);
62 |
63 | return NO;
64 | }
65 |
66 | - (BOOL) processIsRunningWithName:(NSString*)aName
67 | {
68 | int name[] = {CTL_KERN, KERN_PROC, KERN_PROC_ALL, 0};
69 |
70 | size_t length = 0;
71 |
72 | if (sysctl(name, 4, NULL, &length, NULL, 0) != noErr)
73 | return NO;
74 |
75 | struct kinfo_proc *result = malloc(length);
76 |
77 | if (sysctl(name, 4, result, &length, NULL, 0) != noErr)
78 | return NO;
79 |
80 | struct kinfo_proc *tmpInfoProc;
81 | int i, procCount = length / sizeof(struct kinfo_proc);
82 |
83 | for (i=0; ikp_proc.p_comm]] == NSOrderedSame)
88 | {
89 | free(result);
90 | return YES;
91 | }
92 | }
93 |
94 | free(result);
95 |
96 | return NO;
97 | }
98 |
99 | - (BOOL) isPortInUse:(uint)port
100 | {
101 | NSTask* bash = [[NSTask new] autorelease];
102 | NSString* argument;
103 |
104 | argument = [NSString stringWithFormat:@"netstat -an | egrep -q \"[.:]%i .*LISTEN\"", port];
105 |
106 | [bash setLaunchPath:@"/bin/bash"];
107 | [bash setArguments:[NSArray arrayWithObjects:@"-c", argument, Nil]];
108 |
109 | [bash launch];
110 | [bash waitUntilExit];
111 |
112 | if ([bash terminationStatus] == 0) // egrep returns success == one programm is using port 80
113 | return YES;
114 | else
115 | return NO;
116 | }
117 |
118 | @end
119 |
--------------------------------------------------------------------------------
/Sources/App_Delegate.h:
--------------------------------------------------------------------------------
1 | /*
2 |
3 | XAMPP
4 | Copyright (C) 2009 by Apache Friends
5 |
6 | Authors of this file:
7 | - Christian Speich
8 |
9 | This file is part of XAMPP.
10 |
11 | XAMPP is free software: you can redistribute it and/or modify
12 | it under the terms of the GNU General Public License as published by
13 | the Free Software Foundation, either version 3 of the License, or
14 | (at your option) any later version.
15 |
16 | XAMPP is distributed in the hope that it will be useful,
17 | but WITHOUT ANY WARRANTY; without even the implied warranty of
18 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 | GNU General Public License for more details.
20 |
21 | You should have received a copy of the GNU General Public License
22 | along with XAMPP. If not, see .
23 |
24 | */
25 |
26 | #import
27 |
28 | @class ModulesMenuController;
29 | @class ControlsWindowController;
30 | @class SecurityCheckController;
31 |
32 | @interface App_Delegate : NSObject {
33 | IBOutlet NSMenu* modulesMenu;
34 |
35 | ModulesMenuController* modulesMenuController;
36 | ControlsWindowController* controlsWindowController;
37 | SecurityCheckController* securityCheckController;
38 | }
39 |
40 | - (NSArray*) plugInDirectories;
41 |
42 | - (IBAction) showControlsWindow:(id)sender;
43 |
44 | - (IBAction) visitApacheForum:(id)sender;
45 | - (IBAction) visitBugtracker:(id)sender;
46 | - (IBAction) sendFeedback:(id)sender;
47 |
48 | - (void) installLocationCheck;
49 | - (IBAction) showSecurityCheck:(id)sender;
50 |
51 | @end
52 |
--------------------------------------------------------------------------------
/Sources/Assistant/AssistantController.h:
--------------------------------------------------------------------------------
1 | /*
2 |
3 | XAMPP
4 | Copyright (C) 2009 by Apache Friends
5 |
6 | Authors of this file:
7 | - Christian Speich
8 |
9 | This file is part of XAMPP.
10 |
11 | XAMPP is free software: you can redistribute it and/or modify
12 | it under the terms of the GNU General Public License as published by
13 | the Free Software Foundation, either version 3 of the License, or
14 | (at your option) any later version.
15 |
16 | XAMPP is distributed in the hope that it will be useful,
17 | but WITHOUT ANY WARRANTY; without even the implied warranty of
18 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 | GNU General Public License for more details.
20 |
21 | You should have received a copy of the GNU General Public License
22 | along with XAMPP. If not, see .
23 |
24 | */
25 |
26 | #import
27 |
28 | @class AssistantPage;
29 | @class AssistantStepIndicatorView;
30 |
31 | @interface AssistantController : NSWindowController {
32 | IBOutlet NSView* pageView;
33 | IBOutlet NSButton* backButton;
34 | IBOutlet NSButton* forwardButton;
35 | IBOutlet AssistantStepIndicatorView* stepIndicatorView;
36 |
37 | IBOutlet NSArrayController *pagesController;
38 |
39 | NSArray* pages;
40 | NSString* title;
41 | AssistantPage* currentPage;
42 | BOOL isShown;
43 | }
44 |
45 | - (NSArray*)pages;
46 | - (void)setPages:(NSArray*)anArray;
47 |
48 | - (NSString*) title;
49 | - (void) setTitle:(NSString*)anString;
50 |
51 | - (IBAction) continue:(id)sender;
52 | - (IBAction) goBack:(id)sender;
53 |
54 | @end
55 |
--------------------------------------------------------------------------------
/Sources/Assistant/AssistantController.m:
--------------------------------------------------------------------------------
1 | /*
2 |
3 | XAMPP
4 | Copyright (C) 2009 by Apache Friends
5 |
6 | Authors of this file:
7 | - Christian Speich
8 |
9 | This file is part of XAMPP.
10 |
11 | XAMPP is free software: you can redistribute it and/or modify
12 | it under the terms of the GNU General Public License as published by
13 | the Free Software Foundation, either version 3 of the License, or
14 | (at your option) any later version.
15 |
16 | XAMPP is distributed in the hope that it will be useful,
17 | but WITHOUT ANY WARRANTY; without even the implied warranty of
18 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 | GNU General Public License for more details.
20 |
21 | You should have received a copy of the GNU General Public License
22 | along with XAMPP. If not, see .
23 |
24 | */
25 |
26 | #import "AssistantController.h"
27 | #import "AssistantPage.h"
28 | #import "AssistantStepIndicatorView.h"
29 |
30 | #import
31 |
32 | NSString *AssistantControllerContext = @"AssistantContollerContext";
33 |
34 | @interface AssistantController (PRIVAT)
35 |
36 | - (void) showPage:(AssistantPage*)anPage;
37 |
38 | @end
39 |
40 |
41 | @implementation AssistantController
42 |
43 | - (id) init
44 | {
45 | self = [super init];
46 | if (self != nil) {
47 | [self loadWindow];
48 | [[self window] setDelegate:self];
49 | isShown = NO;
50 | }
51 | return self;
52 | }
53 |
54 | - (NSString *)windowNibName
55 | {
56 | return @"Assistant";
57 | }
58 |
59 | - (void) dealloc
60 | {
61 | [self setTitle:Nil];
62 | [self setPages:Nil];
63 |
64 | [super dealloc];
65 | }
66 |
67 |
68 | - (void) awakeFromNib
69 | {
70 | [pagesController addObserver:self
71 | forKeyPath:@"selection"
72 | options:0
73 | context:AssistantControllerContext];
74 | }
75 |
76 | - (IBAction) showWindow:(id)sender
77 | {
78 | [super showWindow:sender];
79 | if (!isShown)
80 | [self showPage:[pages objectAtIndex:0]];
81 | isShown = YES;
82 | }
83 |
84 | - (NSArray*)pages
85 | {
86 | return pages;
87 | }
88 |
89 | - (void)setPages:(NSArray*)anArray
90 | {
91 | NSEnumerator* enumerator;
92 | AssistantPage* page;
93 | NSMutableArray* steps;
94 |
95 | if ([anArray isEqualToArray:pages])
96 | return;
97 |
98 | [self willChangeValueForKey:@"pages"];
99 |
100 | [pages release];
101 | pages = [anArray retain];
102 |
103 | enumerator = [pages objectEnumerator];
104 | steps = [NSMutableArray array];
105 |
106 | while ((page = [enumerator nextObject])) {
107 | [page setAssistantController:self];
108 | [steps addObject:[page stepTitle]];
109 | }
110 |
111 | [stepIndicatorView setSteps:steps];
112 |
113 | [self didChangeValueForKey:@"pages"];
114 | }
115 |
116 | - (NSString*) title
117 | {
118 | return title;
119 | }
120 |
121 | - (void) setTitle:(NSString*)anString
122 | {
123 | if ([anString isEqualToString:title])
124 | return;
125 |
126 | [self willChangeValueForKey:@"title"];
127 |
128 | [title release];
129 | title = [anString retain];
130 |
131 | [self didChangeValueForKey:@"title"];
132 | }
133 |
134 | - (IBAction) continue:(id)sender
135 | {
136 | if (![pagesController canSelectNext])
137 | return [self close];
138 |
139 | if (![currentPage isValid]) {
140 | NSBeep();
141 | return;
142 | }
143 |
144 | [pagesController selectNext:sender];
145 | }
146 |
147 | - (IBAction) goBack:(id)sender
148 | {
149 | [pagesController selectPrevious:sender];
150 | }
151 |
152 | - (void) observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context
153 | {
154 | if (context != AssistantControllerContext)
155 | return [super observeValueForKeyPath:keyPath ofObject:object change:change context:context];
156 |
157 | if (object == pagesController
158 | && [keyPath isEqualToString:@"selection"])
159 | [self showPage:[[pagesController selection] unproxy]];
160 |
161 | }
162 |
163 | - (void) showPage:(AssistantPage*)anPage
164 | {
165 | int pageIndex;
166 |
167 | if ([anPage isEqualTo:currentPage])
168 | return;
169 |
170 | [currentPage pageWillDisappear];
171 | [[currentPage view] removeFromSuperview];
172 | [currentPage pageDidDisappear];
173 | [currentPage release];
174 |
175 | currentPage = [anPage retain];
176 | [currentPage pageWillAppear];
177 | [pageView addSubview:[currentPage view]];
178 | [currentPage pageDidAppear];
179 |
180 | pageIndex = [pages indexOfObject:currentPage];
181 |
182 | if (pageIndex == 0
183 | || [currentPage type] == AssistantWorkingkPage
184 | || [currentPage type] == AssistantConclusionPage)
185 | [backButton setEnabled:NO];
186 | else
187 | [backButton setEnabled:YES];
188 |
189 | if ([currentPage isEqualTo:[pages lastObject]])
190 | [forwardButton setTitle:XPLocalizedString(@"Close", @"Close the Assistant (last page)")];
191 | else if ([currentPage type] == AssistantSummaryPage)
192 | [forwardButton setTitle:XPLocalizedString(@"Do it!", @"The summary has show now let the assistant execute the steps")];
193 | else
194 | [forwardButton setTitle:XPLocalizedString(@"Continue", @"Continue the assistant")];
195 |
196 | if ([currentPage type] == AssistantWorkingkPage)
197 | [forwardButton setEnabled:NO];
198 | else
199 | [forwardButton setEnabled:YES];
200 |
201 | [stepIndicatorView selectStep:pageIndex];
202 | }
203 |
204 | - (BOOL)windowShouldClose:(id)sender
205 | {
206 | return [currentPage type] != AssistantWorkingkPage;
207 | }
208 |
209 | - (void)windowWillClose:(NSNotification *)notification
210 | {
211 | isShown = NO;
212 | }
213 |
214 | @end
215 |
--------------------------------------------------------------------------------
/Sources/Assistant/AssistantPage.h:
--------------------------------------------------------------------------------
1 | /*
2 |
3 | XAMPP
4 | Copyright (C) 2009 by Apache Friends
5 |
6 | Authors of this file:
7 | - Christian Speich
8 |
9 | This file is part of XAMPP.
10 |
11 | XAMPP is free software: you can redistribute it and/or modify
12 | it under the terms of the GNU General Public License as published by
13 | the Free Software Foundation, either version 3 of the License, or
14 | (at your option) any later version.
15 |
16 | XAMPP is distributed in the hope that it will be useful,
17 | but WITHOUT ANY WARRANTY; without even the implied warranty of
18 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 | GNU General Public License for more details.
20 |
21 | You should have received a copy of the GNU General Public License
22 | along with XAMPP. If not, see .
23 |
24 | */
25 |
26 | #import
27 | #import
28 |
29 | typedef enum {
30 | AssistantNormalPage = 1,
31 | AssistantSummaryPage = 2,
32 | AssistantWorkingkPage = 3,
33 | AssistantConclusionPage = 4,
34 | AssistantUnknownPage = 5
35 | } AssistantPageType;
36 |
37 | @class AssistantController;
38 |
39 | @interface AssistantPage : XPViewController {
40 | AssistantPageType type;
41 | AssistantController*assistantController;
42 | NSString* title;
43 | NSString* stepTitle;
44 | BOOL isValid;
45 | }
46 |
47 | - (AssistantPageType) type;
48 | - (void) setType:(AssistantPageType)anType;
49 |
50 | - (NSString*) title;
51 | - (void) setTitle:(NSString*)anTitle;
52 |
53 | - (NSString*) stepTitle;
54 | - (void) setStepTitle:(NSString*)anStepTitle;
55 |
56 | - (AssistantController*) assistantController;
57 | - (void) setAssistantController:(AssistantController*)anController;
58 |
59 | - (void) pageWillAppear;
60 | - (void) pageDidAppear;
61 | - (void) pageWillDisappear;
62 | - (void) pageDidDisappear;
63 |
64 | // Is the pagecontent valid so that the page can disappear and show the next page
65 | // The error presentation is the task of the assistant page
66 | - (BOOL) isValid;
67 | - (void) setIsValid:(BOOL)isValid;
68 |
69 | @end
70 |
--------------------------------------------------------------------------------
/Sources/Assistant/AssistantPage.m:
--------------------------------------------------------------------------------
1 | /*
2 |
3 | XAMPP
4 | Copyright (C) 2009 by Apache Friends
5 |
6 | Authors of this file:
7 | - Christian Speich
8 |
9 | This file is part of XAMPP.
10 |
11 | XAMPP is free software: you can redistribute it and/or modify
12 | it under the terms of the GNU General Public License as published by
13 | the Free Software Foundation, either version 3 of the License, or
14 | (at your option) any later version.
15 |
16 | XAMPP is distributed in the hope that it will be useful,
17 | but WITHOUT ANY WARRANTY; without even the implied warranty of
18 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 | GNU General Public License for more details.
20 |
21 | You should have received a copy of the GNU General Public License
22 | along with XAMPP. If not, see .
23 |
24 | */
25 |
26 | #import "AssistantPage.h"
27 |
28 |
29 | @implementation AssistantPage
30 |
31 | - (id) init
32 | {
33 | self = [super init];
34 | if (self != nil) {
35 | [self setIsValid:YES];
36 | }
37 | return self;
38 | }
39 |
40 |
41 | - (void) dealloc
42 | {
43 | [self setTitle:Nil];
44 | [self setStepTitle:Nil];
45 |
46 | [super dealloc];
47 | }
48 |
49 |
50 | #pragma mark -
51 | #pragma mark Getter and Setter
52 |
53 | - (AssistantPageType) type
54 | {
55 | return type;
56 | }
57 |
58 | - (void) setType:(AssistantPageType)anType
59 | {
60 | type = anType;
61 | }
62 |
63 | - (NSString*) title
64 | {
65 | return title;
66 | }
67 |
68 | - (void) setTitle:(NSString*)anTitle
69 | {
70 | if ([anTitle isEqualToString:title])
71 | return;
72 |
73 | [title release];
74 | title = [anTitle retain];
75 | }
76 |
77 | - (NSString*) stepTitle;
78 | {
79 | return stepTitle;
80 | }
81 |
82 | - (void) setStepTitle:(NSString*)anStepTitle
83 | {
84 | if ([anStepTitle isEqualToString:stepTitle])
85 | return;
86 |
87 | [stepTitle release];
88 | stepTitle = [anStepTitle retain];
89 | }
90 |
91 | - (AssistantController*) assistantController
92 | {
93 | return assistantController;
94 | }
95 |
96 | - (void) setAssistantController:(AssistantController*)anController
97 | {
98 | assistantController = anController;
99 | }
100 |
101 | #pragma mark -
102 |
103 | - (void) pageWillAppear
104 | {
105 | }
106 |
107 | - (void) pageDidAppear
108 | {
109 | }
110 |
111 | - (void) pageWillDisappear
112 | {
113 | }
114 |
115 | - (void) pageDidDisappear
116 | {
117 | }
118 |
119 | - (BOOL) isValid
120 | {
121 | return isValid;
122 | }
123 |
124 | - (void) setIsValid:(BOOL)valid
125 | {
126 | if (valid == isValid)
127 | return;
128 |
129 | [self willChangeValueForKey:@"isValid"];
130 | isValid = valid;
131 | [self didChangeValueForKey:@"isValid"];
132 | }
133 |
134 | @end
135 |
--------------------------------------------------------------------------------
/Sources/Assistant/AssistantStepIndicatorView.h:
--------------------------------------------------------------------------------
1 | /*
2 |
3 | XAMPP
4 | Copyright (C) 2009 by Apache Friends
5 |
6 | Authors of this file:
7 | - Christian Speich
8 |
9 | This file is part of XAMPP.
10 |
11 | XAMPP is free software: you can redistribute it and/or modify
12 | it under the terms of the GNU General Public License as published by
13 | the Free Software Foundation, either version 3 of the License, or
14 | (at your option) any later version.
15 |
16 | XAMPP is distributed in the hope that it will be useful,
17 | but WITHOUT ANY WARRANTY; without even the implied warranty of
18 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 | GNU General Public License for more details.
20 |
21 | You should have received a copy of the GNU General Public License
22 | along with XAMPP. If not, see .
23 |
24 | */
25 |
26 | #import
27 |
28 |
29 | @interface AssistantStepIndicatorView : NSView {
30 | NSArray* steps;
31 | NSMutableArray* stepInformations;
32 | uint currentStepIndex;
33 |
34 | NSImage* activeImage;
35 | NSImage* inactiveImage;
36 | NSImage* disabledImage;
37 | }
38 |
39 | - (NSArray*) steps;
40 | - (void) setSteps:(NSArray*) anArray;
41 |
42 | - (void) selectStep:(uint)step;
43 |
44 | @end
45 |
--------------------------------------------------------------------------------
/Sources/Assistant/AssistantStepIndicatorView.m:
--------------------------------------------------------------------------------
1 | /*
2 |
3 | XAMPP
4 | Copyright (C) 2009 by Apache Friends
5 |
6 | Authors of this file:
7 | - Christian Speich
8 |
9 | This file is part of XAMPP.
10 |
11 | XAMPP is free software: you can redistribute it and/or modify
12 | it under the terms of the GNU General Public License as published by
13 | the Free Software Foundation, either version 3 of the License, or
14 | (at your option) any later version.
15 |
16 | XAMPP is distributed in the hope that it will be useful,
17 | but WITHOUT ANY WARRANTY; without even the implied warranty of
18 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 | GNU General Public License for more details.
20 |
21 | You should have received a copy of the GNU General Public License
22 | along with XAMPP. If not, see .
23 |
24 | */
25 |
26 | #import "AssistantStepIndicatorView.h"
27 |
28 | NSString* inactiveStep = @"Inactive";
29 | NSString* disabledStep = @"Disabeld";
30 |
31 | @implementation AssistantStepIndicatorView
32 |
33 | - (void) awakeFromNib
34 | {
35 | activeImage = [[NSImage alloc] initWithContentsOfFile:
36 | [[NSBundle bundleForClass:[AssistantStepIndicatorView class]]
37 | pathForImageResource:@"AssistantStepActive"]];
38 | inactiveImage = [[NSImage alloc] initWithContentsOfFile:
39 | [[NSBundle bundleForClass:[AssistantStepIndicatorView class]]
40 | pathForImageResource:@"AssistantStepInactive"]];
41 | disabledImage = [[NSImage alloc] initWithContentsOfFile:
42 | [[NSBundle bundleForClass:[AssistantStepIndicatorView class]]
43 | pathForImageResource:@"AssistantStepDisabled"]];
44 | }
45 |
46 |
47 | - (void) dealloc
48 | {
49 | [activeImage release];
50 | [inactiveImage release];
51 | [disabledImage release];
52 | [steps release];
53 | [stepInformations release];
54 |
55 | [super dealloc];
56 | }
57 |
58 | - (NSArray*) steps
59 | {
60 | return steps;
61 | }
62 |
63 | - (void) setSteps:(NSArray*) anArray
64 | {
65 | [steps release];
66 | [stepInformations release];
67 |
68 | steps = [anArray retain];
69 | stepInformations = [NSMutableArray new];
70 |
71 | for (int i = 0; i < [steps count]; i++)
72 | [stepInformations addObject:disabledStep];
73 |
74 | [self setNeedsDisplay:YES];
75 | }
76 |
77 | - (void) selectStep:(uint)step
78 | {
79 | NSParameterAssert(step < [steps count]);
80 |
81 | if (step == currentStepIndex)
82 | return;
83 |
84 | currentStepIndex = step;
85 |
86 | for (int i = 0; i <= step; ++i)
87 | [stepInformations replaceObjectAtIndex:i withObject:inactiveStep];
88 |
89 | [self setNeedsDisplay:YES];
90 | }
91 |
92 | - (void)drawRect:(NSRect)rect {
93 | NSTextFieldCell* textCell;
94 | NSImageCell* indicatorCell;
95 | uint i, count = [steps count];
96 | NSImage* indicatorImage;
97 |
98 | int x = 5;
99 | int y = 0;
100 |
101 | textCell = [NSTextFieldCell new];
102 | indicatorCell = [NSImageCell new];
103 |
104 | [indicatorCell setImageAlignment:NSImageAlignCenter];
105 |
106 | for (i = 0; i < count; i++) {
107 | NSString* step = [steps objectAtIndex:i];
108 | NSString* stepInformation = [stepInformations objectAtIndex:i];
109 | NSRect indicatorRect;
110 | NSRect textRect;
111 |
112 | [textCell setStringValue:step];
113 |
114 | // First draw the indicator image
115 | if (i == currentStepIndex) {
116 | indicatorImage = activeImage;
117 | [textCell setFont:[NSFont boldSystemFontOfSize:12.f]];
118 | [textCell setTextColor:[NSColor controlTextColor]];
119 | } else if ([stepInformation isEqualToString:inactiveStep]) {
120 | indicatorImage = inactiveImage;
121 | [textCell setFont:[NSFont systemFontOfSize:12.f]];
122 | [textCell setTextColor:[NSColor controlTextColor]];
123 | } else {
124 | indicatorImage = disabledImage;
125 | [textCell setFont:[NSFont systemFontOfSize:12.f]];
126 | [textCell setTextColor:[NSColor disabledControlTextColor]];
127 | }
128 |
129 | [indicatorCell setImage:indicatorImage];
130 |
131 |
132 | indicatorRect.size = [indicatorImage size];
133 | indicatorRect.origin.x = x;
134 |
135 | textRect.size = [textCell cellSize];
136 | textRect.origin.x = NSMaxX(indicatorRect) + 5;
137 | textRect.origin.y = y;
138 | y += 19.f;
139 |
140 | indicatorRect.origin.y = textRect.origin.y + NSHeight(textRect)/2 - NSHeight(indicatorRect)/2 + 1;
141 |
142 | [indicatorCell drawWithFrame:indicatorRect
143 | inView:self];
144 |
145 | [textCell drawWithFrame:textRect
146 | inView:self];
147 | }
148 |
149 | [textCell release];
150 | [indicatorCell release];
151 | }
152 |
153 | - (BOOL) isFlipped
154 | {
155 | return YES;
156 | }
157 |
158 | @end
159 |
--------------------------------------------------------------------------------
/Sources/ControlsWindowController.h:
--------------------------------------------------------------------------------
1 | /*
2 |
3 | XAMPP
4 | Copyright (C) 2009 by Apache Friends
5 |
6 | Authors of this file:
7 | - Christian Speich
8 |
9 | This file is part of XAMPP.
10 |
11 | XAMPP is free software: you can redistribute it and/or modify
12 | it under the terms of the GNU General Public License as published by
13 | the Free Software Foundation, either version 3 of the License, or
14 | (at your option) any later version.
15 |
16 | XAMPP is distributed in the hope that it will be useful,
17 | but WITHOUT ANY WARRANTY; without even the implied warranty of
18 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 | GNU General Public License for more details.
20 |
21 | You should have received a copy of the GNU General Public License
22 | along with XAMPP. If not, see .
23 |
24 | */
25 |
26 | #import
27 |
28 |
29 | @interface ControlsWindowController : NSWindowController {
30 |
31 | }
32 |
33 | @end
34 |
--------------------------------------------------------------------------------
/Sources/ControlsWindowController.m:
--------------------------------------------------------------------------------
1 | /*
2 |
3 | XAMPP
4 | Copyright (C) 2009 by Apache Friends
5 |
6 | Authors of this file:
7 | - Christian Speich
8 |
9 | This file is part of XAMPP.
10 |
11 | XAMPP is free software: you can redistribute it and/or modify
12 | it under the terms of the GNU General Public License as published by
13 | the Free Software Foundation, either version 3 of the License, or
14 | (at your option) any later version.
15 |
16 | XAMPP is distributed in the hope that it will be useful,
17 | but WITHOUT ANY WARRANTY; without even the implied warranty of
18 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 | GNU General Public License for more details.
20 |
21 | You should have received a copy of the GNU General Public License
22 | along with XAMPP. If not, see .
23 |
24 | */
25 |
26 | #import "ControlsWindowController.h"
27 |
28 | #import
29 | #import
30 | #import
31 | #import
32 | #import
33 |
34 | #define SPACE (8)
35 | #define MARGIN (17)
36 |
37 | @interface ControlsWindowController (PRIVATE)
38 |
39 | - (NSRect) contentFrame;
40 | - (void) updateContent;
41 |
42 | @end
43 |
44 |
45 | @implementation ControlsWindowController
46 |
47 | - (void) awakeFromNib
48 | {
49 | [[self window] setFrame:[[self window] frameRectForContentRect:[self contentFrame]] display:YES animate:NO];
50 | [self updateContent];
51 |
52 | PlugInInvokeHook(ControlsWindowDidLoadHook,
53 | [NSDictionary dictionaryWithObject:[self window]
54 | forKey:HookWindowKey]);
55 | }
56 |
57 | @end
58 |
59 | @implementation ControlsWindowController (PRIVATE)
60 |
61 | - (NSRect) contentFrame
62 | {
63 | NSRect frame;
64 | NSArray *contols;
65 | NSEnumerator *enumerator;
66 | int maxWidth = 0;
67 | id object;
68 |
69 | frame = [[self window] frame];
70 | contols = [[[PlugInManager sharedPlugInManager] registry] objectsForCategorie:XPControlsPlugInCategorie];
71 | enumerator = [contols objectEnumerator];
72 |
73 | frame.size.height = SPACE;
74 |
75 | while ((object = [enumerator nextObject])) {
76 | if ([object isKindOfClass:[XPViewController class]]) {
77 | if (maxWidth < NSWidth([[object view] frame]))
78 | maxWidth = NSWidth([[object view] frame]);
79 | frame.size.height += NSHeight([[object view] frame]);
80 | if (![object isEqual:[contols lastObject]])
81 | frame.size.height += SPACE;
82 | }
83 | }
84 |
85 | frame.size.width = maxWidth + MARGIN*2;
86 | frame.size.height += MARGIN;
87 |
88 | return frame;
89 | }
90 |
91 | - (void) updateContent
92 | {
93 | NSArray *subviews;
94 | NSArray *controls;
95 | NSEnumerator *enumerator;
96 | NSView *view;
97 | NSRect contentFrame;
98 | NSRect viewFrame;
99 | XPViewController *controller;
100 | int y;
101 | int x = MARGIN;
102 |
103 | contentFrame = [self contentFrame];
104 |
105 | [[self window] setFrame:[[self window] frameRectForContentRect:contentFrame] display:YES animate:YES];
106 |
107 | subviews = [[[[self window] contentView] subviews] copy];
108 | enumerator = [subviews objectEnumerator];
109 |
110 | while ((view = [enumerator nextObject]))
111 | [view removeFromSuperviewWithoutNeedingDisplay];
112 |
113 | [subviews release];
114 |
115 | controls = [[[PlugInManager sharedPlugInManager] registry] objectsForCategorie:XPControlsPlugInCategorie];
116 | enumerator = [controls objectEnumerator];
117 |
118 | y = NSHeight(contentFrame) - SPACE;
119 |
120 | while ((controller = [enumerator nextObject])) {
121 |
122 | if (![controller isKindOfClass:[XPViewController class]]) {
123 | DLog(@"%@ is not an XPViewController!", controls);
124 | continue;
125 | }
126 |
127 | view = [controller view];
128 |
129 | viewFrame = [view frame];
130 |
131 | y -= NSHeight(viewFrame);
132 |
133 | viewFrame.origin.y = y;
134 | viewFrame.origin.x = x;
135 | viewFrame.size.width = NSWidth(contentFrame) - 2*MARGIN;
136 |
137 | [view setFrame:viewFrame];
138 | [view setAutoresizingMask:NSViewWidthSizable];
139 |
140 | [[[self window] contentView] addSubview:view];
141 |
142 | y -= SPACE;
143 | }
144 | }
145 |
146 | @end
147 |
--------------------------------------------------------------------------------
/Sources/Debug.h:
--------------------------------------------------------------------------------
1 | /*
2 |
3 | XAMPP
4 | Copyright (C) 2009 by Apache Friends
5 |
6 | Authors of this file:
7 | - Christian Speich
8 |
9 | This file is part of XAMPP.
10 |
11 | XAMPP is free software: you can redistribute it and/or modify
12 | it under the terms of the GNU General Public License as published by
13 | the Free Software Foundation, either version 3 of the License, or
14 | (at your option) any later version.
15 |
16 | XAMPP is distributed in the hope that it will be useful,
17 | but WITHOUT ANY WARRANTY; without even the implied warranty of
18 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 | GNU General Public License for more details.
20 |
21 | You should have received a copy of the GNU General Public License
22 | along with XAMPP. If not, see .
23 |
24 | */
25 |
26 | #import
27 |
28 | void DLog(NSString* format, ...);
29 |
--------------------------------------------------------------------------------
/Sources/Debug.m:
--------------------------------------------------------------------------------
1 | /*
2 |
3 | XAMPP
4 | Copyright (C) 2009 by Apache Friends
5 |
6 | Authors of this file:
7 | - Christian Speich
8 |
9 | This file is part of XAMPP.
10 |
11 | XAMPP is free software: you can redistribute it and/or modify
12 | it under the terms of the GNU General Public License as published by
13 | the Free Software Foundation, either version 3 of the License, or
14 | (at your option) any later version.
15 |
16 | XAMPP is distributed in the hope that it will be useful,
17 | but WITHOUT ANY WARRANTY; without even the implied warranty of
18 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 | GNU General Public License for more details.
20 |
21 | You should have received a copy of the GNU General Public License
22 | along with XAMPP. If not, see .
23 |
24 | */
25 |
26 | #import "Debug.h"
27 |
28 | void DLog(NSString* format, ...)
29 | {
30 | va_list args;
31 |
32 | va_start(args, format);
33 |
34 | NSLogv(format, args);
35 |
36 | va_end(args);
37 | }
38 |
--------------------------------------------------------------------------------
/Sources/GettingStartedController.h:
--------------------------------------------------------------------------------
1 | /*
2 |
3 | XAMPP
4 | Copyright (C) 2009 by Apache Friends
5 |
6 | Authors of this file:
7 | - Christian Speich
8 |
9 | This file is part of XAMPP.
10 |
11 | XAMPP is free software: you can redistribute it and/or modify
12 | it under the terms of the GNU General Public License as published by
13 | the Free Software Foundation, either version 3 of the License, or
14 | (at your option) any later version.
15 |
16 | XAMPP is distributed in the hope that it will be useful,
17 | but WITHOUT ANY WARRANTY; without even the implied warranty of
18 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 | GNU General Public License for more details.
20 |
21 | You should have received a copy of the GNU General Public License
22 | along with XAMPP. If not, see .
23 |
24 | */
25 |
26 | #import
27 | #import
28 |
29 | @interface GettingStartedController : NSWindowController {
30 | IBOutlet WebView *webView;
31 | }
32 |
33 | @end
34 |
--------------------------------------------------------------------------------
/Sources/GettingStartedController.m:
--------------------------------------------------------------------------------
1 | /*
2 |
3 | XAMPP
4 | Copyright (C) 2009 by Apache Friends
5 |
6 | Authors of this file:
7 | - Christian Speich
8 |
9 | This file is part of XAMPP.
10 |
11 | XAMPP is free software: you can redistribute it and/or modify
12 | it under the terms of the GNU General Public License as published by
13 | the Free Software Foundation, either version 3 of the License, or
14 | (at your option) any later version.
15 |
16 | XAMPP is distributed in the hope that it will be useful,
17 | but WITHOUT ANY WARRANTY; without even the implied warranty of
18 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 | GNU General Public License for more details.
20 |
21 | You should have received a copy of the GNU General Public License
22 | along with XAMPP. If not, see .
23 |
24 | */
25 |
26 | #import "GettingStartedController.h"
27 | #import "XPConfiguration.h"
28 |
29 | @implementation GettingStartedController
30 |
31 | + (void)initialize
32 | {
33 | NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
34 | NSDictionary *appDefaults = [NSDictionary
35 | dictionaryWithObject:@"YES" forKey:@"showGettingStartedWindowAtStartup"];
36 |
37 | [defaults registerDefaults:appDefaults];
38 | }
39 |
40 | - (id) init
41 | {
42 | self = [super init];
43 | if (self != nil) {
44 |
45 | if (![NSBundle loadNibNamed:@"GettingStarted" owner:self]) {
46 | [self release];
47 | return nil;
48 | }
49 |
50 | if ([[NSUserDefaults standardUserDefaults] boolForKey:@"showGettingStartedWindowAtStartup"])
51 | [self showWindow:self];
52 | }
53 | return self;
54 | }
55 |
56 | - (void) awakeFromNib
57 | {
58 | NSMutableString *htmlCode;
59 |
60 | [[self window] setBackgroundColor:[NSColor whiteColor]];
61 |
62 | htmlCode = [[NSMutableString alloc] initWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"GettingStarted" ofType:@"html"]];
63 |
64 | [htmlCode replaceOccurrencesOfString:@"#USER#"
65 | withString:NSUserName()
66 | options:NSCaseInsensitiveSearch
67 | range:NSMakeRange(0, [htmlCode length])];
68 | [htmlCode replaceOccurrencesOfString:@"#XAMPP_ROOT#"
69 | withString:[XPConfiguration XAMPPPath]
70 | options:NSCaseInsensitiveSearch
71 | range:NSMakeRange(0, [htmlCode length])];
72 |
73 | [[webView mainFrame] loadHTMLString:htmlCode
74 | baseURL:Nil];
75 | [webView setPolicyDelegate:self];
76 |
77 | [htmlCode release];
78 | }
79 |
80 | - (void)webView:(WebView *)sender
81 | decidePolicyForNavigationAction:(NSDictionary *)actionInformation
82 | request:(NSURLRequest *)request
83 | frame:(WebFrame *)frame
84 | decisionListener:(id)listener
85 | {
86 | NSURL *url = [actionInformation objectForKey:WebActionOriginalURLKey];
87 |
88 | //Ignore file URLs, but open anything else
89 | if (![url isFileURL]) {
90 | [[NSWorkspace sharedWorkspace] openURL:url];
91 | }
92 |
93 | [listener ignore];
94 | }
95 |
96 | @end
97 |
--------------------------------------------------------------------------------
/Sources/Helper Classes/KQueue.h:
--------------------------------------------------------------------------------
1 | /*
2 |
3 | XAMPP
4 | Copyright (C) 2009 by Apache Friends
5 |
6 | Authors of this file:
7 | - Christian Speich
8 |
9 | This file is part of XAMPP.
10 |
11 | XAMPP is free software: you can redistribute it and/or modify
12 | it under the terms of the GNU General Public License as published by
13 | the Free Software Foundation, either version 3 of the License, or
14 | (at your option) any later version.
15 |
16 | XAMPP is distributed in the hope that it will be useful,
17 | but WITHOUT ANY WARRANTY; without even the implied warranty of
18 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 | GNU General Public License for more details.
20 |
21 | You should have received a copy of the GNU General Public License
22 | along with XAMPP. If not, see .
23 |
24 | */
25 |
26 | #import
27 | #include
28 |
29 | extern NSString *KQueueNewEvent;
30 | extern NSString *KQueueIdentKey;
31 | extern NSString *KQueueFilterKey;
32 | extern NSString *KQueueFlagsKey;
33 | extern NSString *KQueueFilterFlagsKey;
34 | extern NSString *KQueueFilterDataKey;
35 |
36 | /* Filters */
37 | extern NSString *KQueueReadFilter;
38 | extern NSString *KQueueWriteFilter;
39 | extern NSString *KQueueVNodeFilter;
40 | extern NSString *KQueueProcFilter;
41 | extern NSString *KQueueSignalFilter;
42 |
43 | /* VNode Filter Flags */
44 | #define KQueueVNodeDeleteFilterFlag (NOTE_DELETE)
45 | #define KQueueVNodeWriteFilterFlag (NOTE_WRITE)
46 | #define KQueueVNodeExtendFilterFlag (NOTE_EXTEND)
47 | #define KQueueVNodeAttribFilterFlag (NOTE_ATTRIB)
48 | #define KQueueVNodeLinkFilterFlag (NOTE_LINK)
49 | #define KQueueVNodeRenameFilterFlag (NOTE_RENAME)
50 | #define KQueueVNodeRevokeFilterFlag (NOTE_REVOKE)
51 |
52 | /* Proc Filter Flags */
53 | #define KQueueProcessExitFilterFlag (NOTE_EXIT)
54 | #define KQueueProcessForkFilterFlag (NOTE_FORK)
55 | #define KQueueProcessExecFilterFlag (NOTE_EXEC)
56 |
57 | @interface KQueue : NSObject {
58 | int queueFD;
59 | NSMutableArray *watchedIdents;
60 | bool keepThreadRunning;
61 | }
62 |
63 | + (id) sharedKQueue;
64 | - (int) queueFD;
65 |
66 | - (void) addIdent:(uint)aIdent withFilter:(NSString*)aFilter andFilterFlags:(uint) fflags;
67 | - (void) removeIdent:(uint)aIdent fromFilter:(NSString*)aFilter;
68 |
69 | - (uint) intFromFilter:(NSString*)aFilter;
70 |
71 | @end
72 |
--------------------------------------------------------------------------------
/Sources/Helper Classes/XPMainThreadProxy.h:
--------------------------------------------------------------------------------
1 | /*
2 |
3 | XAMPP
4 | Copyright (C) 2009 by Apache Friends
5 |
6 | Authors of this file:
7 | - Christian Speich
8 |
9 | This file is part of XAMPP.
10 |
11 | XAMPP is free software: you can redistribute it and/or modify
12 | it under the terms of the GNU General Public License as published by
13 | the Free Software Foundation, either version 3 of the License, or
14 | (at your option) any later version.
15 |
16 | XAMPP is distributed in the hope that it will be useful,
17 | but WITHOUT ANY WARRANTY; without even the implied warranty of
18 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 | GNU General Public License for more details.
20 |
21 | You should have received a copy of the GNU General Public License
22 | along with XAMPP. If not, see .
23 |
24 | */
25 |
26 | #import
27 |
28 |
29 | @interface XPMainThreadProxy : NSProxy {
30 | id _target;
31 | NSInvocation* _invocation;
32 | }
33 |
34 | - (id) target;
35 | - (void) setTarget:(id)target;
36 |
37 | @end
38 |
--------------------------------------------------------------------------------
/Sources/Helper Classes/XPMainThreadProxy.m:
--------------------------------------------------------------------------------
1 | /*
2 |
3 | XAMPP
4 | Copyright (C) 2009 by Apache Friends
5 |
6 | Authors of this file:
7 | - Christian Speich
8 |
9 | This file is part of XAMPP.
10 |
11 | XAMPP is free software: you can redistribute it and/or modify
12 | it under the terms of the GNU General Public License as published by
13 | the Free Software Foundation, either version 3 of the License, or
14 | (at your option) any later version.
15 |
16 | XAMPP is distributed in the hope that it will be useful,
17 | but WITHOUT ANY WARRANTY; without even the implied warranty of
18 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 | GNU General Public License for more details.
20 |
21 | You should have received a copy of the GNU General Public License
22 | along with XAMPP. If not, see .
23 |
24 | */
25 |
26 | #import "XPMainThreadProxy.h"
27 |
28 | @implementation XPMainThreadProxy
29 |
30 | - (id) init
31 | {
32 | return self;
33 | }
34 |
35 |
36 | - (void) dealloc
37 | {
38 | [self setTarget:Nil];
39 |
40 | [super dealloc];
41 | }
42 |
43 |
44 | - (id) target
45 | {
46 | return _target;
47 | }
48 |
49 | - (void) setTarget:(id)target
50 | {
51 | if (target == _target)
52 | return;
53 |
54 | [_target release];
55 | _target = [target retain];
56 | }
57 |
58 | - (NSMethodSignature *)methodSignatureForSelector:(SEL)selector
59 | {
60 | return [[self target] methodSignatureForSelector:selector];
61 | }
62 |
63 | - (void)forwardInvocation:(NSInvocation *)invocation
64 | {
65 | [invocation setTarget:[self target]];
66 | [invocation retainArguments];
67 |
68 | [invocation performSelectorOnMainThread:@selector(invoke)
69 | withObject:Nil
70 | waitUntilDone:NO];
71 | }
72 |
73 | @end
74 |
--------------------------------------------------------------------------------
/Sources/Helper Classes/XPProcessWatcher.h:
--------------------------------------------------------------------------------
1 | /*
2 |
3 | XAMPP
4 | Copyright (C) 2009 by Apache Friends
5 |
6 | Authors of this file:
7 | - Christian Speich
8 |
9 | This file is part of XAMPP.
10 |
11 | XAMPP is free software: you can redistribute it and/or modify
12 | it under the terms of the GNU General Public License as published by
13 | the Free Software Foundation, either version 3 of the License, or
14 | (at your option) any later version.
15 |
16 | XAMPP is distributed in the hope that it will be useful,
17 | but WITHOUT ANY WARRANTY; without even the implied warranty of
18 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 | GNU General Public License for more details.
20 |
21 | You should have received a copy of the GNU General Public License
22 | along with XAMPP. If not, see .
23 |
24 | */
25 |
26 | #import
27 |
28 |
29 | @interface XPProcessWatcher : NSObject {
30 | NSString* pidFile;
31 | id delegate;
32 |
33 | int status;
34 |
35 | int watchDirFD;
36 | int watchPID;
37 | }
38 |
39 | - (NSString*) pidFile;
40 | - (void) setPidFile:(NSString*)pidFile;
41 |
42 | - (id) delegate;
43 | - (void) setDelegate:(id)anDelegate;
44 |
45 | - (void) forceCheckNow;
46 |
47 | @end
48 |
--------------------------------------------------------------------------------
/Sources/Helper Classes/XPRootTask.h:
--------------------------------------------------------------------------------
1 | /*
2 |
3 | XAMPP
4 | Copyright (C) 2009 by Apache Friends
5 |
6 | Authors of this file:
7 | - Christian Speich
8 |
9 | This file is part of XAMPP.
10 |
11 | XAMPP is free software: you can redistribute it and/or modify
12 | it under the terms of the GNU General Public License as published by
13 | the Free Software Foundation, either version 3 of the License, or
14 | (at your option) any later version.
15 |
16 | XAMPP is distributed in the hope that it will be useful,
17 | but WITHOUT ANY WARRANTY; without even the implied warranty of
18 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 | GNU General Public License for more details.
20 |
21 | You should have received a copy of the GNU General Public License
22 | along with XAMPP. If not, see .
23 |
24 | */
25 |
26 | #import
27 | #include
28 |
29 | @interface XPRootTask : NSObject {
30 | NSArray *arguments;
31 | NSDictionary *environment;
32 | NSString *launchPath;
33 | NSFileHandle *communicationsPipe;
34 | int terminationStatus;
35 | pid_t taskPid;
36 | }
37 |
38 | + (NSError*) authorize;
39 | - (NSError*) authorize;
40 |
41 | + (AuthorizationRef) authorizationRef;
42 |
43 | - (NSArray*) arguments;
44 | - (void) setArguments:(NSArray*) arguments;
45 |
46 | - (NSDictionary*) environment;
47 | - (void) setEnvironment:(NSDictionary*)enviroment;
48 |
49 | - (NSString*) launchPath;
50 | - (void) setLaunchPath:(NSString*)launchPath;
51 |
52 | - (NSFileHandle*) communicationsPipe;
53 |
54 | - (void) launch;
55 | - (void) waitUntilExit;
56 | - (bool) isRunning;
57 | - (int) terminationStatus;
58 |
59 | @end
60 |
--------------------------------------------------------------------------------
/Sources/Helper Tools/open-helper-tool.c:
--------------------------------------------------------------------------------
1 | /*
2 |
3 | XAMPP
4 | Copyright (C) 2009 by Apache Friends
5 |
6 | Authors of this file:
7 | - Christian Speich
8 |
9 | This file is part of XAMPP.
10 |
11 | XAMPP is free software: you can redistribute it and/or modify
12 | it under the terms of the GNU General Public License as published by
13 | the Free Software Foundation, either version 3 of the License, or
14 | (at your option) any later version.
15 |
16 | XAMPP is distributed in the hope that it will be useful,
17 | but WITHOUT ANY WARRANTY; without even the implied warranty of
18 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 | GNU General Public License for more details.
20 |
21 | You should have received a copy of the GNU General Public License
22 | along with XAMPP. If not, see .
23 |
24 | */
25 |
26 | #include
27 | #include
28 | #include
29 | #include
30 | #include
31 |
32 | /* ---- Thanks to apple for the fd sending code ---- */
33 |
34 | // When we pass a descriptor, we have to pass at least one byte
35 | // of data along with it, otherwise the recvmsg call will not
36 | // block if the descriptor hasn't been written to the other end
37 | // of the socket yet.
38 |
39 | static const char kDummyData = 'D';
40 |
41 | // Due to a kernel bug in Mac OS X 10.4.x and earlier
42 | // , you will run into problems if you write
43 | // data to a socket while a process is trying to receive a descriptor
44 | // from that socket. A common symptom of this problem is that, if
45 | // you write two descriptors back-to-back, the second one just
46 | // disappears.
47 | //
48 | // To avoid this problem, we explicitly ACK all descriptor transfers.
49 | // After writing a descriptor, the sender reads an ACK byte from the
50 | // socket. After reading a descriptor, the receiver sends an ACK byte
51 | // (kACKData) to unblock the sender.
52 |
53 | static const char kACKData = 'A';
54 |
55 | static _Bool kWorkaround4650646 = 1;
56 |
57 | static int WriteDescriptor(int fd, int fdToWrite)
58 | // Write the descriptor fdToWrite to fd.
59 | {
60 | int err;
61 | struct msghdr msg;
62 | struct iovec iov;
63 | struct {
64 | struct cmsghdr hdr;
65 | int fd;
66 | } control;
67 | ssize_t bytesSent;
68 | char ack;
69 |
70 | // Pre-conditions
71 |
72 | assert(fd >= 0);
73 | assert(fdToWrite >= 0);
74 |
75 | control.hdr.cmsg_len = sizeof(control);
76 | control.hdr.cmsg_level = SOL_SOCKET;
77 | control.hdr.cmsg_type = SCM_RIGHTS;
78 | control.fd = fdToWrite;
79 |
80 | iov.iov_base = (char *) &kDummyData;
81 | iov.iov_len = sizeof(kDummyData);
82 |
83 | msg.msg_name = NULL;
84 | msg.msg_namelen = 0;
85 | msg.msg_iov = &iov;
86 | msg.msg_iovlen = 1;
87 | msg.msg_control = &control;
88 | msg.msg_controllen = control.hdr.cmsg_len;
89 | msg.msg_flags = 0;
90 | do {
91 | bytesSent = sendmsg(fd, &msg, 0);
92 | if (bytesSent == sizeof(kDummyData)) {
93 | err = 0;
94 | } else {
95 | assert(bytesSent == -1);
96 |
97 | err = errno;
98 | assert(err != 0);
99 | }
100 | } while (err == EINTR);
101 |
102 | // After writing the descriptor, try to read an ACK back from the
103 | // recipient. If that fails, or we get the wrong ACK, we've failed.
104 |
105 | if ( (err == 0) && kWorkaround4650646 ) {
106 | do {
107 | ssize_t bytesRead;
108 |
109 | bytesRead = read(fd, &ack, sizeof(ack));
110 | if (bytesRead == 0) {
111 | err = EPIPE;
112 | } else if (bytesRead == -1) {
113 | err = errno;
114 | }
115 | } while (err == EINTR);
116 |
117 | if ( (err == 0) && (ack != kACKData) ) {
118 | err = EINVAL;
119 | }
120 | }
121 |
122 | return err;
123 | }
124 |
125 | int main(int argc, char **argv) {
126 | int fd;
127 |
128 | if (argc != 2) {
129 | int result[1] = { 500+argc };
130 | write(STDOUT_FILENO, result, sizeof(result));
131 | return 1;
132 | }
133 |
134 | fd = open(argv[1], O_CREAT | O_RDWR);
135 |
136 | if (fd < 0) {
137 | int result[1] = { 2 };
138 | write(STDOUT_FILENO, result, sizeof(result));
139 | return 2;
140 | }
141 |
142 | int result[1] = { 0 };
143 | write(STDOUT_FILENO, result, sizeof(result));
144 |
145 | WriteDescriptor(STDOUT_FILENO, fd);
146 |
147 | //close(fd);
148 |
149 | return 0;
150 | }
151 |
--------------------------------------------------------------------------------
/Sources/Helper Tools/xproottask-helper-tool.c:
--------------------------------------------------------------------------------
1 | /*
2 |
3 | XAMPP
4 | Copyright (C) 2009 by Apache Friends
5 |
6 | Authors of this file:
7 | - Christian Speich
8 |
9 | This file is part of XAMPP.
10 |
11 | XAMPP is free software: you can redistribute it and/or modify
12 | it under the terms of the GNU General Public License as published by
13 | the Free Software Foundation, either version 3 of the License, or
14 | (at your option) any later version.
15 |
16 | XAMPP is distributed in the hope that it will be useful,
17 | but WITHOUT ANY WARRANTY; without even the implied warranty of
18 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 | GNU General Public License for more details.
20 |
21 | You should have received a copy of the GNU General Public License
22 | along with XAMPP. If not, see .
23 |
24 | */
25 |
26 | #include
27 | #include
28 |
29 | int main(int argc, char **argv) {
30 | setuid(0);
31 | pid_t pid[1];
32 | pid[0] = getpid();
33 |
34 | // Make stderr and stdout the same
35 | dup2(STDOUT_FILENO, STDERR_FILENO);
36 |
37 | write(STDOUT_FILENO, pid, sizeof(pid));
38 |
39 | // Remove the first element in the argv array an execute the task
40 | for (int i = 1; i < argc; i++) {
41 | argv[i-1] = argv[i];
42 | }
43 | argv[argc-1] = NULL;
44 |
45 | execv(argv[0], argv);
46 |
47 | exit(-1);
48 | }
49 |
--------------------------------------------------------------------------------
/Sources/ModulesMenuController.h:
--------------------------------------------------------------------------------
1 | /*
2 |
3 | XAMPP
4 | Copyright (C) 2009 by Apache Friends
5 |
6 | Authors of this file:
7 | - Christian Speich
8 |
9 | This file is part of XAMPP.
10 |
11 | XAMPP is free software: you can redistribute it and/or modify
12 | it under the terms of the GNU General Public License as published by
13 | the Free Software Foundation, either version 3 of the License, or
14 | (at your option) any later version.
15 |
16 | XAMPP is distributed in the hope that it will be useful,
17 | but WITHOUT ANY WARRANTY; without even the implied warranty of
18 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 | GNU General Public License for more details.
20 |
21 | You should have received a copy of the GNU General Public License
22 | along with XAMPP. If not, see .
23 |
24 | */
25 |
26 | #import
27 |
28 |
29 | @interface ModulesMenuController : NSObject {
30 | NSMenu *menu;
31 | }
32 |
33 | - (id) initWithMenu:(NSMenu*)menu;
34 |
35 | @end
36 |
--------------------------------------------------------------------------------
/Sources/SecurityCheck/Pages/SecurityCheckConclusionPage.h:
--------------------------------------------------------------------------------
1 | //
2 | // SecurityCheckConclusionPage.h
3 | // XAMPP Control
4 | //
5 | // Created by Christian Speich on 05.09.09.
6 | // Copyright 2009 __MyCompanyName__. All rights reserved.
7 | //
8 |
9 | #import
10 | #import
11 |
12 | @interface SecurityCheckConclusionPage : AssistantPage {
13 |
14 | }
15 |
16 | @end
17 |
--------------------------------------------------------------------------------
/Sources/SecurityCheck/Pages/SecurityCheckConclusionPage.m:
--------------------------------------------------------------------------------
1 | //
2 | // SecurityCheckConclusionPage.m
3 | // XAMPP Control
4 | //
5 | // Created by Christian Speich on 05.09.09.
6 | // Copyright 2009 __MyCompanyName__. All rights reserved.
7 | //
8 |
9 | #import "SecurityCheckConclusionPage.h"
10 |
11 |
12 | @implementation SecurityCheckConclusionPage
13 |
14 | - (id) init
15 | {
16 | self = [super init];
17 | if (self != nil) {
18 |
19 | if (![NSBundle loadNibNamed:@"SecurityCheckConclusionPage" owner:self]) {
20 | [self release];
21 | return Nil;
22 | }
23 |
24 | [self setTitle:XPLocalizedString(@"Conclusion...", @"The title of the Security Check Conclusion page")];
25 | [self setStepTitle:XPLocalizedString(@"Conclusion...", @"The step title of the Security Check Conclusion page which will displayed on the left side")];
26 | [self setType:AssistantConclusionPage];
27 | }
28 | return self;
29 | }
30 |
31 | @end
32 |
--------------------------------------------------------------------------------
/Sources/SecurityCheck/Pages/SecurityCheckSummaryPage.h:
--------------------------------------------------------------------------------
1 | /*
2 |
3 | XAMPP
4 | Copyright (C) 2009 by Apache Friends
5 |
6 | Authors of this file:
7 | - Christian Speich
8 |
9 | This file is part of XAMPP.
10 |
11 | XAMPP is free software: you can redistribute it and/or modify
12 | it under the terms of the GNU General Public License as published by
13 | the Free Software Foundation, either version 3 of the License, or
14 | (at your option) any later version.
15 |
16 | XAMPP is distributed in the hope that it will be useful,
17 | but WITHOUT ANY WARRANTY; without even the implied warranty of
18 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 | GNU General Public License for more details.
20 |
21 | You should have received a copy of the GNU General Public License
22 | along with XAMPP. If not, see .
23 |
24 | */
25 |
26 | #import
27 |
28 | #import
29 |
30 | @class SecurityTasksView;
31 |
32 | @interface SecurityCheckSummaryPage : AssistantPage {
33 | IBOutlet SecurityTasksView* tasksView;
34 | NSArray* securityChecks;
35 | }
36 |
37 | - (id) initWithSecurityChecks:(NSArray*)anArray;
38 |
39 | - (void) setSecurityChecks:(NSArray*)anArray;
40 | - (NSArray*)securityChecks;
41 |
42 | @end
43 |
--------------------------------------------------------------------------------
/Sources/SecurityCheck/Pages/SecurityCheckSummaryPage.m:
--------------------------------------------------------------------------------
1 | /*
2 |
3 | XAMPP
4 | Copyright (C) 2009 by Apache Friends
5 |
6 | Authors of this file:
7 | - Christian Speich
8 |
9 | This file is part of XAMPP.
10 |
11 | XAMPP is free software: you can redistribute it and/or modify
12 | it under the terms of the GNU General Public License as published by
13 | the Free Software Foundation, either version 3 of the License, or
14 | (at your option) any later version.
15 |
16 | XAMPP is distributed in the hope that it will be useful,
17 | but WITHOUT ANY WARRANTY; without even the implied warranty of
18 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 | GNU General Public License for more details.
20 |
21 | You should have received a copy of the GNU General Public License
22 | along with XAMPP. If not, see .
23 |
24 | */
25 |
26 | #import "SecurityCheckSummaryPage.h"
27 | #import "SecurityCheckProtocol.h"
28 | #import "SecurityTaskProtocol.h"
29 | #import "SecurityTasksView.h"
30 |
31 | @implementation SecurityCheckSummaryPage
32 |
33 | - (id) initWithSecurityChecks:(NSArray*)anArray
34 | {
35 | self = [super init];
36 | if (self != nil) {
37 |
38 | if (![NSBundle loadNibNamed:@"SecurityCheckSummaryPage" owner:self]) {
39 | [self release];
40 | return Nil;
41 | }
42 |
43 | [self setSecurityChecks:anArray];
44 | [self setTitle:XPLocalizedString(@"Summary", @"The title of the Security Check summary page")];
45 | [self setStepTitle:XPLocalizedString(@"Summary", @"The step title of the Security Check summary page which will displayed on the left side")];
46 | [self setType:AssistantSummaryPage];
47 | }
48 | return self;
49 | }
50 |
51 | - (void) dealloc
52 | {
53 | [self setSecurityChecks:Nil];
54 | [super dealloc];
55 | }
56 |
57 |
58 | #pragma mark -
59 | #pragma mark Getter and Setter
60 |
61 | - (void) setSecurityChecks:(NSArray*)anArray
62 | {
63 | if ([anArray isEqualToArray:securityChecks])
64 | return;
65 |
66 | [securityChecks release];
67 | securityChecks = [anArray retain];
68 | }
69 |
70 | - (NSArray*)securityChecks
71 | {
72 | return securityChecks;
73 | }
74 |
75 | #pragma mark -
76 | #pragma mark Tasks
77 |
78 | - (void) pageWillAppear
79 | {
80 | // Calculate all tasks
81 | [securityChecks makeObjectsPerformSelector:@selector(calcualteTasks)];
82 |
83 | // Well add the titels to the TasksView
84 | NSEnumerator* enumerator = [securityChecks objectEnumerator];
85 | NSMutableArray* taskTitels = [NSMutableArray array];
86 | id securityCheck;
87 |
88 | while ((securityCheck = [enumerator nextObject])) {
89 | NSEnumerator* tasksEnumerator = [[securityCheck tasks] objectEnumerator];
90 | id task;
91 |
92 | while ((task = [tasksEnumerator nextObject])) {
93 | [taskTitels addObject:[task localizedTitle]];
94 | }
95 | }
96 |
97 | [tasksView setTaskTitels:taskTitels];
98 | }
99 |
100 | @end
101 |
102 |
--------------------------------------------------------------------------------
/Sources/SecurityCheck/Pages/SecurityCheckWelcomePage.h:
--------------------------------------------------------------------------------
1 | /*
2 |
3 | XAMPP
4 | Copyright (C) 2009 by Apache Friends
5 |
6 | Authors of this file:
7 | - Christian Speich
8 |
9 | This file is part of XAMPP.
10 |
11 | XAMPP is free software: you can redistribute it and/or modify
12 | it under the terms of the GNU General Public License as published by
13 | the Free Software Foundation, either version 3 of the License, or
14 | (at your option) any later version.
15 |
16 | XAMPP is distributed in the hope that it will be useful,
17 | but WITHOUT ANY WARRANTY; without even the implied warranty of
18 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 | GNU General Public License for more details.
20 |
21 | You should have received a copy of the GNU General Public License
22 | along with XAMPP. If not, see .
23 |
24 | */
25 |
26 | #import
27 |
28 | #import
29 |
30 | @interface SecurityCheckWelcomePage : AssistantPage {
31 |
32 | }
33 |
34 | @end
35 |
--------------------------------------------------------------------------------
/Sources/SecurityCheck/Pages/SecurityCheckWelcomePage.m:
--------------------------------------------------------------------------------
1 | /*
2 |
3 | XAMPP
4 | Copyright (C) 2009 by Apache Friends
5 |
6 | Authors of this file:
7 | - Christian Speich
8 |
9 | This file is part of XAMPP.
10 |
11 | XAMPP is free software: you can redistribute it and/or modify
12 | it under the terms of the GNU General Public License as published by
13 | the Free Software Foundation, either version 3 of the License, or
14 | (at your option) any later version.
15 |
16 | XAMPP is distributed in the hope that it will be useful,
17 | but WITHOUT ANY WARRANTY; without even the implied warranty of
18 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 | GNU General Public License for more details.
20 |
21 | You should have received a copy of the GNU General Public License
22 | along with XAMPP. If not, see .
23 |
24 | */
25 |
26 | #import "SecurityCheckWelcomePage.h"
27 |
28 |
29 | @implementation SecurityCheckWelcomePage
30 |
31 | - (id) init
32 | {
33 | self = [super init];
34 | if (self != nil) {
35 |
36 | if (![NSBundle loadNibNamed:@"SecurityCheckWelcomePage" owner:self]) {
37 | [self release];
38 | return Nil;
39 | }
40 |
41 | [self setTitle:XPLocalizedString(@"Welcome to the Security Check", @"The title of the Security Check welcome page")];
42 | [self setStepTitle:XPLocalizedString(@"Welcome", @"The step title of the Security Check welcome page which will displayed on the left side")];
43 | [self setType:AssistantNormalPage];
44 | }
45 | return self;
46 | }
47 |
48 | @end
49 |
--------------------------------------------------------------------------------
/Sources/SecurityCheck/Pages/SecurityCheckWorkPage.h:
--------------------------------------------------------------------------------
1 | /*
2 |
3 | XAMPP
4 | Copyright (C) 2009 by Apache Friends
5 |
6 | Authors of this file:
7 | - Christian Speich
8 |
9 | This file is part of XAMPP.
10 |
11 | XAMPP is free software: you can redistribute it and/or modify
12 | it under the terms of the GNU General Public License as published by
13 | the Free Software Foundation, either version 3 of the License, or
14 | (at your option) any later version.
15 |
16 | XAMPP is distributed in the hope that it will be useful,
17 | but WITHOUT ANY WARRANTY; without even the implied warranty of
18 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 | GNU General Public License for more details.
20 |
21 | You should have received a copy of the GNU General Public License
22 | along with XAMPP. If not, see .
23 |
24 | */
25 |
26 | #import
27 |
28 | #import
29 |
30 | @class SecurityTasksView;
31 |
32 | @interface SecurityCheckWorkPage : AssistantPage {
33 | IBOutlet SecurityTasksView* tasksView;
34 | NSArray* securityChecks;
35 |
36 | NSArray* _tasks;
37 | }
38 |
39 | - (id) initWithSecurityChecks:(NSArray*)anArray;
40 |
41 | - (void) setSecurityChecks:(NSArray*)anArray;
42 | - (NSArray*)securityChecks;
43 |
44 | - (NSArray*) tasks;
45 | - (void) setTasks:(NSArray*)anArray;
46 |
47 | @end
48 |
--------------------------------------------------------------------------------
/Sources/SecurityCheck/Pages/SecurityCheckWorkPage.m:
--------------------------------------------------------------------------------
1 | /*
2 |
3 | XAMPP
4 | Copyright (C) 2009 by Apache Friends
5 |
6 | Authors of this file:
7 | - Christian Speich
8 |
9 | This file is part of XAMPP.
10 |
11 | XAMPP is free software: you can redistribute it and/or modify
12 | it under the terms of the GNU General Public License as published by
13 | the Free Software Foundation, either version 3 of the License, or
14 | (at your option) any later version.
15 |
16 | XAMPP is distributed in the hope that it will be useful,
17 | but WITHOUT ANY WARRANTY; without even the implied warranty of
18 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 | GNU General Public License for more details.
20 |
21 | You should have received a copy of the GNU General Public License
22 | along with XAMPP. If not, see .
23 |
24 | */
25 |
26 | #import "SecurityCheckWorkPage.h"
27 | #import "SecurityCheckProtocol.h"
28 | #import "SecurityTaskProtocol.h"
29 | #import "SecurityTasksView.h"
30 | #import "NSObject+Additions.h"
31 |
32 | @implementation SecurityCheckWorkPage
33 |
34 | - (id) initWithSecurityChecks:(NSArray*)anArray
35 | {
36 | self = [super init];
37 | if (self != nil) {
38 |
39 | if (![NSBundle loadNibNamed:@"SecurityCheckWorkPage" owner:self]) {
40 | [self release];
41 | return Nil;
42 | }
43 |
44 | [self setSecurityChecks:anArray];
45 | [self setTitle:XPLocalizedString(@"Securing XAMPP...", @"The title of the Security Check work page")];
46 | [self setStepTitle:XPLocalizedString(@"Securing...", @"The step title of the Security Check work page which will displayed on the left side")];
47 | [self setType:AssistantWorkingkPage];
48 | [tasksView setCenterVertically:YES];
49 | }
50 | return self;
51 | }
52 |
53 | - (void) dealloc
54 | {
55 | [self setSecurityChecks:Nil];
56 | [super dealloc];
57 | }
58 |
59 |
60 | #pragma mark -
61 | #pragma mark Getter and Setter
62 |
63 | - (void) setSecurityChecks:(NSArray*)anArray
64 | {
65 | if ([anArray isEqualToArray:securityChecks])
66 | return;
67 |
68 | [securityChecks release];
69 | securityChecks = [anArray retain];
70 | }
71 |
72 | - (NSArray*)securityChecks
73 | {
74 | return securityChecks;
75 | }
76 |
77 | - (NSArray*) tasks
78 | {
79 | return _tasks;
80 | }
81 |
82 | - (void) setTasks:(NSArray*)anArray
83 | {
84 | if ([anArray isEqualToArray:_tasks])
85 | return;
86 |
87 | [_tasks release];
88 | _tasks = [anArray retain];
89 | }
90 |
91 | #pragma mark -
92 | #pragma mark Tasks
93 |
94 | - (void) pageWillAppear
95 | {
96 | // Well add the titels to the TasksView
97 | NSEnumerator* enumerator = [securityChecks objectEnumerator];
98 | NSMutableArray* taskTitels = [NSMutableArray array];
99 | NSMutableArray* tasks = [NSMutableArray array];
100 | id securityCheck;
101 |
102 | while ((securityCheck = [enumerator nextObject])) {
103 | NSEnumerator* tasksEnumerator = [[securityCheck tasks] objectEnumerator];
104 | id task;
105 |
106 | while ((task = [tasksEnumerator nextObject])) {
107 | [taskTitels addObject:[task localizedTitle]];
108 | }
109 |
110 | [tasks addObjectsFromArray:[securityCheck tasks]];
111 | }
112 |
113 | [tasksView setTaskTitels:taskTitels];
114 | [self setTasks:tasks];
115 | }
116 |
117 | - (void) pageDidAppear
118 | {
119 | [NSThread detachNewThreadSelector:@selector(work)
120 | toTarget:self
121 | withObject:Nil];
122 | }
123 |
124 | - (void) work
125 | {
126 | NSAutoreleasePool* pool = [NSAutoreleasePool new];
127 | NSEnumerator* enumerator = [[self tasks] objectEnumerator];
128 | id task;
129 | uint currentTask = 0;
130 |
131 | while ((task = [enumerator nextObject])) {
132 | NSLog(@"%@", task);
133 | [tasksView setStatus:SecurityTaskWorkingStatus forTask:currentTask];
134 | @try {
135 | if ([task run])
136 | [tasksView setStatus:SecurityTaskSuccessStatus forTask:currentTask];
137 | else
138 | [tasksView setStatus:SecurityTaskFailStatus forTask:currentTask];
139 | }
140 | @catch (NSException * e) {
141 | NSLog(@"Exception while [%@<%p> run]: %@", NSStringFromClass([task class]), task, e);
142 | [tasksView setStatus:SecurityTaskFailStatus forTask:currentTask];
143 | }
144 | @finally {
145 | currentTask++;
146 | }
147 | }
148 |
149 | /* Wait one second and then go to the next page */
150 |
151 | [[[self assistantController] mainThreadProxy] performSelector:@selector(continue:)
152 | withObject:self
153 | afterDelay:1.0];
154 |
155 | [pool release];
156 | }
157 |
158 | @end
159 |
--------------------------------------------------------------------------------
/Sources/SecurityCheck/SecurityCheckController.h:
--------------------------------------------------------------------------------
1 | /*
2 |
3 | XAMPP
4 | Copyright (C) 2009 by Apache Friends
5 |
6 | Authors of this file:
7 | - Christian Speich
8 |
9 | This file is part of XAMPP.
10 |
11 | XAMPP is free software: you can redistribute it and/or modify
12 | it under the terms of the GNU General Public License as published by
13 | the Free Software Foundation, either version 3 of the License, or
14 | (at your option) any later version.
15 |
16 | XAMPP is distributed in the hope that it will be useful,
17 | but WITHOUT ANY WARRANTY; without even the implied warranty of
18 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 | GNU General Public License for more details.
20 |
21 | You should have received a copy of the GNU General Public License
22 | along with XAMPP. If not, see .
23 |
24 | */
25 |
26 | #import
27 |
28 | #import
29 |
30 | @interface SecurityCheckController : AssistantController {
31 | NSArray* securityChecks;
32 | NSArray* securityCheckPages;
33 | }
34 |
35 | @end
36 |
--------------------------------------------------------------------------------
/Sources/SecurityCheck/SecurityCheckController.m:
--------------------------------------------------------------------------------
1 | /*
2 |
3 | XAMPP
4 | Copyright (C) 2009 by Apache Friends
5 |
6 | Authors of this file:
7 | - Christian Speich
8 |
9 | This file is part of XAMPP.
10 |
11 | XAMPP is free software: you can redistribute it and/or modify
12 | it under the terms of the GNU General Public License as published by
13 | the Free Software Foundation, either version 3 of the License, or
14 | (at your option) any later version.
15 |
16 | XAMPP is distributed in the hope that it will be useful,
17 | but WITHOUT ANY WARRANTY; without even the implied warranty of
18 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 | GNU General Public License for more details.
20 |
21 | You should have received a copy of the GNU General Public License
22 | along with XAMPP. If not, see .
23 |
24 | */
25 |
26 | #import "SecurityCheckController.h"
27 |
28 | #import "SecurityCheckWelcomePage.h"
29 | #import "SecurityCheckSummaryPage.h"
30 | #import "SecurityCheckWorkPage.h"
31 | #import "SecurityCheckConclusionPage.h"
32 |
33 | #import
34 | #import
35 |
36 | @interface SecurityCheckController (PRIVATE)
37 |
38 | - (BOOL) setupPages;
39 |
40 | @end
41 |
42 |
43 | @implementation SecurityCheckController
44 |
45 | - (void) awakeFromNib
46 | {
47 | [super awakeFromNib];
48 |
49 | [self setTitle:@"Security Check"];
50 | }
51 |
52 | - (void) prepareSecurityChecks {
53 | PlugInRegistry* plugInRegistry = [[PlugInManager sharedPlugInManager] registry];
54 | NSArray* all = [plugInRegistry objectsForCategorie:XPSecurityChecksPlugInCategorie];
55 | NSMutableArray* securityChecksFiltered = [NSMutableArray array];
56 |
57 | for (int i = 0; i < [all count]; i++) {
58 | id obj = [all objectAtIndex:i];
59 | if ([obj conformsToProtocol:@protocol(SecurityCheckProtocol)] &&
60 | [obj conformsToProtocol:@protocol(NSCopying)]) {
61 | /* Make a copy here so we have a fresh securitycheck every-
62 | time we open this assistant */
63 | obj = [obj copy];
64 | [securityChecksFiltered addObject:obj];
65 | [obj checkSecurity];
66 | [obj release];
67 | }
68 | else {
69 | DLog(@"%@ does not conforms to the SecurityCheckProtocol or NSCopying Protocol.!", obj);
70 | }
71 | }
72 |
73 | [securityChecks release];
74 | securityChecks = [securityChecksFiltered retain];
75 | }
76 |
77 | - (void) prepareSecurityCheckPages {
78 | NSPredicate *predicate;
79 |
80 | predicate = [NSPredicate predicateWithFormat:@"isSecure == NO"];
81 |
82 | [securityCheckPages release];
83 | securityCheckPages = [[securityChecks filteredArrayUsingPredicate:predicate] retain];
84 | }
85 |
86 | - (BOOL) setupPages
87 | {
88 | NSMutableArray* array;
89 |
90 | array = [NSMutableArray array];
91 |
92 | [self prepareSecurityChecks];
93 | [self prepareSecurityCheckPages];
94 |
95 | /* There are no security checks to display, this assistant is useless
96 | display a message to the user and returns bool here to avoid the display
97 | of the assistant window. */
98 | if ([securityChecks count] == 0) {
99 | NSRunAlertPanel(XPLocalizedString(@"NoSecurityCheksTitle", @"Titel for the modal alert panel which is shown when no valid securitychecks are registered."),
100 | XPLocalizedString(@"NoSecurityChecksDescription", @"Description for the modal altert panel which is shown when no valid securitychecks are registered."),
101 | XPLocalizedString(@"OK", @"Titel for the OK-Button of an modal alert panel"),
102 | Nil, Nil);
103 | return NO;
104 | }
105 |
106 | [array addObject:[[SecurityCheckWelcomePage new] autorelease]];
107 |
108 | [array addObjectsFromArray:securityCheckPages];
109 |
110 | [array addObject:[[[SecurityCheckSummaryPage alloc] initWithSecurityChecks:securityChecks] autorelease]];
111 | [array addObject:[[[SecurityCheckWorkPage alloc] initWithSecurityChecks:securityChecks] autorelease]];
112 | [array addObject:[[SecurityCheckConclusionPage new] autorelease]];
113 |
114 | [self setPages:array];
115 |
116 | return YES;
117 | }
118 |
119 | - (IBAction) showWindow:(id)sender
120 | {
121 | if (!isShown && ![self setupPages])
122 | return;
123 |
124 | [super showWindow:sender];
125 | }
126 |
127 | @end
128 |
--------------------------------------------------------------------------------
/Sources/SecurityCheck/SecurityCheckProtocol.h:
--------------------------------------------------------------------------------
1 | /*
2 |
3 | XAMPP
4 | Copyright (C) 2009 by Apache Friends
5 |
6 | Authors of this file:
7 | - Christian Speich
8 |
9 | This file is part of XAMPP.
10 |
11 | XAMPP is free software: you can redistribute it and/or modify
12 | it under the terms of the GNU General Public License as published by
13 | the Free Software Foundation, either version 3 of the License, or
14 | (at your option) any later version.
15 |
16 | XAMPP is distributed in the hope that it will be useful,
17 | but WITHOUT ANY WARRANTY; without even the implied warranty of
18 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 | GNU General Public License for more details.
20 |
21 | You should have received a copy of the GNU General Public License
22 | along with XAMPP. If not, see .
23 |
24 | */
25 |
26 | @protocol SecurityCheckProtocol
27 |
28 | - (void) calcualteTasks;
29 |
30 | - (NSArray*) tasks;
31 |
32 | - (void) checkSecurity;
33 | - (BOOL) isSecure;
34 |
35 | @end
36 |
--------------------------------------------------------------------------------
/Sources/SecurityCheck/SecurityTaskProtocol.h:
--------------------------------------------------------------------------------
1 | /*
2 |
3 | XAMPP
4 | Copyright (C) 2009 by Apache Friends
5 |
6 | Authors of this file:
7 | - Christian Speich
8 |
9 | This file is part of XAMPP.
10 |
11 | XAMPP is free software: you can redistribute it and/or modify
12 | it under the terms of the GNU General Public License as published by
13 | the Free Software Foundation, either version 3 of the License, or
14 | (at your option) any later version.
15 |
16 | XAMPP is distributed in the hope that it will be useful,
17 | but WITHOUT ANY WARRANTY; without even the implied warranty of
18 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 | GNU General Public License for more details.
20 |
21 | You should have received a copy of the GNU General Public License
22 | along with XAMPP. If not, see .
23 |
24 | */
25 |
26 | #import
27 |
28 | @protocol SecurityTaskProtocol
29 |
30 | - (NSString*) localizedTitle;
31 | - (BOOL) run;
32 |
33 | @end
34 |
--------------------------------------------------------------------------------
/Sources/SecurityCheck/SecurityTasksView.h:
--------------------------------------------------------------------------------
1 | /*
2 |
3 | XAMPP
4 | Copyright (C) 2009 by Apache Friends
5 |
6 | Authors of this file:
7 | - Christian Speich
8 |
9 | This file is part of XAMPP.
10 |
11 | XAMPP is free software: you can redistribute it and/or modify
12 | it under the terms of the GNU General Public License as published by
13 | the Free Software Foundation, either version 3 of the License, or
14 | (at your option) any later version.
15 |
16 | XAMPP is distributed in the hope that it will be useful,
17 | but WITHOUT ANY WARRANTY; without even the implied warranty of
18 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 | GNU General Public License for more details.
20 |
21 | You should have received a copy of the GNU General Public License
22 | along with XAMPP. If not, see .
23 |
24 | */
25 |
26 | #import
27 |
28 | enum _SecurityTaskStatus {
29 | SecurityTaskNoStatus = 1,
30 | SecurityTaskWorkingStatus,
31 | SecurityTaskSuccessStatus,
32 | SecurityTaskFailStatus,
33 | SecurityTaskUnknownStatus
34 | };
35 |
36 | typedef enum _SecurityTaskStatus SecurityTaskStatus;
37 |
38 | @interface SecurityTasksView : NSView {
39 | NSArray* taskTitels;
40 |
41 | NSArray* taskInformations;
42 |
43 | BOOL centerVertically;
44 | }
45 |
46 | - (void) setTaskTitels:(NSArray*)anArray;
47 | - (NSArray*) taskTitels;
48 |
49 | - (void) setCenterVertically:(BOOL)center;
50 | - (BOOL) centerVertically;
51 |
52 | - (SecurityTaskStatus) statusForTask:(uint)task;
53 | - (void) setStatus:(SecurityTaskStatus)status forTask:(uint)task;
54 |
55 | @end
56 |
--------------------------------------------------------------------------------
/Sources/Views/StatusIndicatorView.h:
--------------------------------------------------------------------------------
1 | /*
2 |
3 | XAMPP
4 | Copyright (C) 2009 by Apache Friends
5 |
6 | Authors of this file:
7 | - Christian Speich
8 |
9 | This file is part of XAMPP.
10 |
11 | XAMPP is free software: you can redistribute it and/or modify
12 | it under the terms of the GNU General Public License as published by
13 | the Free Software Foundation, either version 3 of the License, or
14 | (at your option) any later version.
15 |
16 | XAMPP is distributed in the hope that it will be useful,
17 | but WITHOUT ANY WARRANTY; without even the implied warranty of
18 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 | GNU General Public License for more details.
20 |
21 | You should have received a copy of the GNU General Public License
22 | along with XAMPP. If not, see .
23 |
24 | */
25 |
26 | #import
27 |
28 | enum _StatusIndicator {
29 | GreenStatus,
30 | YellowStatus,
31 | RedStatus,
32 | WorkingStatus,
33 | NoStatus,
34 | UnknownStatus
35 | };
36 |
37 | typedef enum _StatusIndicator StatusIndicator;
38 |
39 | @interface StatusIndicatorView : NSView {
40 | StatusIndicator status;
41 | NSProgressIndicator *progressIndicator;
42 | }
43 |
44 | - (StatusIndicator) status;
45 | - (void) setStatus:(StatusIndicator)status;
46 |
47 | @end
48 |
--------------------------------------------------------------------------------
/Sources/Views/StatusIndicatorView.m:
--------------------------------------------------------------------------------
1 | /*
2 |
3 | XAMPP
4 | Copyright (C) 2009 by Apache Friends
5 |
6 | Authors of this file:
7 | - Christian Speich
8 |
9 | This file is part of XAMPP.
10 |
11 | XAMPP is free software: you can redistribute it and/or modify
12 | it under the terms of the GNU General Public License as published by
13 | the Free Software Foundation, either version 3 of the License, or
14 | (at your option) any later version.
15 |
16 | XAMPP is distributed in the hope that it will be useful,
17 | but WITHOUT ANY WARRANTY; without even the implied warranty of
18 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 | GNU General Public License for more details.
20 |
21 | You should have received a copy of the GNU General Public License
22 | along with XAMPP. If not, see .
23 |
24 | */
25 |
26 | #import "StatusIndicatorView.h"
27 |
28 |
29 | @implementation StatusIndicatorView
30 |
31 | - (id)initWithFrame:(NSRect)frame {
32 | self = [super initWithFrame:frame];
33 | if (self) {
34 | progressIndicator = [[NSProgressIndicator alloc] initWithFrame:[self bounds]];
35 |
36 | [progressIndicator setStyle:NSProgressIndicatorSpinningStyle];
37 | [progressIndicator setIndeterminate:YES];
38 | [progressIndicator setControlSize:NSSmallControlSize];
39 |
40 | [progressIndicator setAutoresizingMask:NSViewWidthSizable|NSViewHeightSizable];
41 |
42 | [self addSubview:progressIndicator];
43 |
44 | [self setStatus:UnknownStatus];
45 | }
46 | return self;
47 | }
48 |
49 | - (void)drawRect:(NSRect)rect {
50 | NSImage *image;
51 |
52 | if (status == NoStatus || status == WorkingStatus)
53 | return;
54 |
55 | switch (status) {
56 | case GreenStatus:
57 | image = [NSImage imageNamed:@"IndicatorGreen"];
58 | break;
59 | case YellowStatus:
60 | image = [NSImage imageNamed:@"IndicatorYellow"];
61 | break;
62 | case RedStatus:
63 | image = [NSImage imageNamed:@"IndicatorRed"];
64 | break;
65 | default:
66 | image = [NSImage imageNamed:@"IndicatorUnknown"];
67 | break;
68 | }
69 |
70 | NSSize imageSize = [image size];
71 | NSRect imageRect;
72 | NSRect sourceRect;
73 |
74 | imageRect.size = imageSize;
75 | imageRect.origin.x = NSWidth([self bounds])/2 - imageSize.width/2;
76 | imageRect.origin.y = NSHeight([self bounds])/2 - imageSize.height/2;
77 |
78 | sourceRect.size = imageSize;
79 | sourceRect.origin.x = sourceRect.origin.y = 0;
80 |
81 | [image drawInRect:imageRect fromRect:sourceRect operation:NSCompositeSourceOver fraction:1.f];
82 | }
83 |
84 | - (StatusIndicator) status
85 | {
86 | return status;
87 | }
88 |
89 | - (void) setStatus:(StatusIndicator)anStatus
90 | {
91 |
92 | if (anStatus == status)
93 | return;
94 |
95 | status = anStatus;
96 |
97 | if (anStatus == WorkingStatus) {
98 | [progressIndicator startAnimation:self];
99 | [progressIndicator setHidden:NO];
100 | }
101 | else {
102 | [progressIndicator setHidden:YES];
103 | [progressIndicator stopAnimation:self];
104 | }
105 |
106 | [self setNeedsDisplay:YES];
107 | }
108 |
109 | @end
110 |
--------------------------------------------------------------------------------
/Sources/XAMPP Control.h:
--------------------------------------------------------------------------------
1 | /*
2 |
3 | XAMPP
4 | Copyright (C) 2009 by Apache Friends
5 |
6 | Authors of this file:
7 | - Christian Speich
8 |
9 | This file is part of XAMPP.
10 |
11 | XAMPP is free software: you can redistribute it and/or modify
12 | it under the terms of the GNU General Public License as published by
13 | the Free Software Foundation, either version 3 of the License, or
14 | (at your option) any later version.
15 |
16 | XAMPP is distributed in the hope that it will be useful,
17 | but WITHOUT ANY WARRANTY; without even the implied warranty of
18 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 | GNU General Public License for more details.
20 |
21 | You should have received a copy of the GNU General Public License
22 | along with XAMPP. If not, see .
23 |
24 | */
25 |
26 | /* PlugIn Stuff */
27 | #import
28 | #import
29 |
30 | /* Status und Error (Handling) */
31 | #import
32 | #import
33 | #import
34 |
35 | /* Module */
36 | #import
37 | #import
38 |
39 | /* Assistant */
40 | #import
41 | #import
42 |
43 | /* Security Check */
44 | #import
45 | #import
46 |
47 | /* Utilitys */
48 | #import
49 | #import
50 | #import
51 | #import
52 | #import
53 |
54 | /* Additions */
55 | #import
56 | #import
57 | #import
58 |
59 | /* I18N */
60 | #import
61 |
--------------------------------------------------------------------------------
/Sources/XPAlert.h:
--------------------------------------------------------------------------------
1 | /*
2 |
3 | XAMPP
4 | Copyright (C) 2009 by Apache Friends
5 |
6 | Authors of this file:
7 | - Christian Speich
8 |
9 | This file is part of XAMPP.
10 |
11 | XAMPP is free software: you can redistribute it and/or modify
12 | it under the terms of the GNU General Public License as published by
13 | the Free Software Foundation, either version 3 of the License, or
14 | (at your option) any later version.
15 |
16 | XAMPP is distributed in the hope that it will be useful,
17 | but WITHOUT ANY WARRANTY; without even the implied warranty of
18 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 | GNU General Public License for more details.
20 |
21 | You should have received a copy of the GNU General Public License
22 | along with XAMPP. If not, see .
23 |
24 | */
25 |
26 | #import
27 |
28 | @interface XPAlert : NSObject {
29 |
30 | }
31 |
32 | + (void) presentError:(NSError*)anError;
33 |
34 | - (id) initWithError:(NSError*)anError;
35 |
36 | - (void) runModal;
37 |
38 | @end
39 |
--------------------------------------------------------------------------------
/Sources/XPAlert.m:
--------------------------------------------------------------------------------
1 | /*
2 |
3 | XAMPP
4 | Copyright (C) 2009 by Apache Friends
5 |
6 | Authors of this file:
7 | - Christian Speich
8 |
9 | This file is part of XAMPP.
10 |
11 | XAMPP is free software: you can redistribute it and/or modify
12 | it under the terms of the GNU General Public License as published by
13 | the Free Software Foundation, either version 3 of the License, or
14 | (at your option) any later version.
15 |
16 | XAMPP is distributed in the hope that it will be useful,
17 | but WITHOUT ANY WARRANTY; without even the implied warranty of
18 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 | GNU General Public License for more details.
20 |
21 | You should have received a copy of the GNU General Public License
22 | along with XAMPP. If not, see .
23 |
24 | */
25 |
26 | #import "XPAlert.h"
27 |
28 |
29 | @implementation XPAlert
30 |
31 | + (void) presentError:(NSError*)anError
32 | {
33 | // TODO: !!!!
34 | [NSApp presentError:anError];
35 | return;
36 |
37 | XPAlert* controller = [[self alloc] initWithError:anError];
38 |
39 | [controller runModal];
40 |
41 | [controller release];
42 | }
43 |
44 | - (id) initWithError:(NSError*)anError
45 | {
46 | self = [super init];
47 | if (self != nil) {
48 |
49 | [self release];
50 |
51 | if ([[anError domain] isEqualToString:NSCocoaErrorDomain]
52 | && [anError code] == NSUserCancelledError) {
53 | self = Nil;
54 | } else {
55 | NSAlert* alert;
56 | alert = [NSAlert alertWithError:anError];
57 | [alert setAlertStyle:NSCriticalAlertStyle];
58 | self = [alert retain];
59 | }
60 | }
61 | return self;
62 | }
63 |
64 | - (void) runModal
65 | {
66 |
67 | }
68 |
69 | @end
70 |
--------------------------------------------------------------------------------
/Sources/XPBox.h:
--------------------------------------------------------------------------------
1 | /*
2 |
3 | XAMPP
4 | Copyright (C) 2009 by Apache Friends
5 |
6 | Authors of this file:
7 | - Christian Speich
8 |
9 | This file is part of XAMPP.
10 |
11 | XAMPP is free software: you can redistribute it and/or modify
12 | it under the terms of the GNU General Public License as published by
13 | the Free Software Foundation, either version 3 of the License, or
14 | (at your option) any later version.
15 |
16 | XAMPP is distributed in the hope that it will be useful,
17 | but WITHOUT ANY WARRANTY; without even the implied warranty of
18 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 | GNU General Public License for more details.
20 |
21 | You should have received a copy of the GNU General Public License
22 | along with XAMPP. If not, see .
23 |
24 | */
25 |
26 | #import
27 |
28 |
29 | @interface XPBox : NSBox {
30 | NSColor *xp_fillColor;
31 | }
32 |
33 | - (void)setFillColor:(NSColor *)fillColor;
34 | - (NSColor *)fillColor;
35 |
36 | @end
37 |
--------------------------------------------------------------------------------
/Sources/XPBox.m:
--------------------------------------------------------------------------------
1 | /*
2 |
3 | XAMPP
4 | Copyright (C) 2009 by Apache Friends
5 |
6 | Authors of this file:
7 | - Christian Speich
8 |
9 | This file is part of XAMPP.
10 |
11 | XAMPP is free software: you can redistribute it and/or modify
12 | it under the terms of the GNU General Public License as published by
13 | the Free Software Foundation, either version 3 of the License, or
14 | (at your option) any later version.
15 |
16 | XAMPP is distributed in the hope that it will be useful,
17 | but WITHOUT ANY WARRANTY; without even the implied warranty of
18 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 | GNU General Public License for more details.
20 |
21 | You should have received a copy of the GNU General Public License
22 | along with XAMPP. If not, see .
23 |
24 | */
25 |
26 | #import "XPBox.h"
27 |
28 | static BOOL hasFillColorMethods = NO;
29 |
30 | @implementation XPBox
31 |
32 | + (void)initialize
33 | {
34 | if ([super instancesRespondToSelector:@selector(fillColor)]) {
35 | DLog(@"NSBox supports fillColor.");
36 | hasFillColorMethods = YES;
37 | }
38 | }
39 |
40 | - (void)setFillColor:(NSColor *)fillColor
41 | {
42 | if (hasFillColorMethods)
43 | return [super setFillColor:fillColor];
44 | else {
45 | [xp_fillColor release];
46 | xp_fillColor = [fillColor retain];
47 | }
48 | }
49 |
50 | - (NSColor *)fillColor
51 | {
52 | if (hasFillColorMethods)
53 | return [super fillColor];
54 | else
55 | return xp_fillColor;
56 | }
57 |
58 | - (void)drawRect:(NSRect)rect {
59 | if (!hasFillColorMethods) {
60 | NSLog(@"%@", [self fillColor]);
61 | [[self fillColor] setFill];
62 | NSRectFill(rect);
63 | }
64 | [super drawRect:rect];
65 | }
66 |
67 | @end
68 |
--------------------------------------------------------------------------------
/Sources/XPConfiguration.h:
--------------------------------------------------------------------------------
1 | /*
2 |
3 | XAMPP
4 | Copyright (C) 2009 by Apache Friends
5 |
6 | Authors of this file:
7 | - Christian Speich
8 |
9 | This file is part of XAMPP.
10 |
11 | XAMPP is free software: you can redistribute it and/or modify
12 | it under the terms of the GNU General Public License as published by
13 | the Free Software Foundation, either version 3 of the License, or
14 | (at your option) any later version.
15 |
16 | XAMPP is distributed in the hope that it will be useful,
17 | but WITHOUT ANY WARRANTY; without even the implied warranty of
18 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 | GNU General Public License for more details.
20 |
21 | You should have received a copy of the GNU General Public License
22 | along with XAMPP. If not, see .
23 |
24 | */
25 |
26 | #import
27 |
28 |
29 | @interface XPConfiguration : NSObject {
30 | NSString *version;
31 | NSArray *PHPVersions;
32 | NSString *activePHP;
33 | }
34 |
35 | + (id) sharedConfiguration;
36 |
37 | + (BOOL) isBetaVersion;
38 | - (BOOL) isBetaVersion;
39 |
40 | + (NSString*) version;
41 | - (NSString*) version;
42 |
43 | + (NSString*) fullXAMPPPathFor:(NSString*)anPath;
44 | - (NSString*) fullXAMPPPathFor:(NSString*)anPath;
45 | + (NSString*) XAMPPPath;
46 | - (NSString*) XAMPPPath;
47 |
48 | - (NSArray*) PHPVersions;
49 | - (void) setPHPVersions:(NSArray*)anArray;
50 | - (NSString*) activePHP;
51 | - (void) setActivePHP:(NSString*)anString;
52 | - (void) updatePHPVersions;
53 |
54 | - (NSURL*) supportForumURL;
55 | - (NSURL*) bugtrackerURL;
56 | - (NSURL*) installGuideURL;
57 |
58 | - (BOOL) hasFixRights;
59 |
60 | @end
61 |
--------------------------------------------------------------------------------
/Sources/XPConfiguration.m:
--------------------------------------------------------------------------------
1 | /*
2 |
3 | XAMPP
4 | Copyright (C) 2009 by Apache Friends
5 |
6 | Authors of this file:
7 | - Christian Speich
8 |
9 | This file is part of XAMPP.
10 |
11 | XAMPP is free software: you can redistribute it and/or modify
12 | it under the terms of the GNU General Public License as published by
13 | the Free Software Foundation, either version 3 of the License, or
14 | (at your option) any later version.
15 |
16 | XAMPP is distributed in the hope that it will be useful,
17 | but WITHOUT ANY WARRANTY; without even the implied warranty of
18 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 | GNU General Public License for more details.
20 |
21 | You should have received a copy of the GNU General Public License
22 | along with XAMPP. If not, see .
23 |
24 | */
25 |
26 | #import "XPConfiguration.h"
27 | #include
28 |
29 | static id sharedConfiguration = Nil;
30 |
31 | @implementation XPConfiguration
32 |
33 | #pragma mark -
34 | #pragma mark SINGELTON
35 |
36 | + (id) allocWithZone:(NSZone*)aZone
37 | {
38 | if (sharedConfiguration == Nil)
39 | sharedConfiguration = [super allocWithZone:aZone];
40 | return nil;
41 | }
42 |
43 | + (id) sharedConfiguration
44 | {
45 | if (sharedConfiguration == Nil)
46 | [self alloc];
47 |
48 | return sharedConfiguration;
49 | }
50 |
51 | - (int) retainCount
52 | {
53 | return INT_MAX;
54 | }
55 |
56 | - (void) release
57 | {
58 | }
59 |
60 | #pragma mark -
61 | #pragma mark Proptertys
62 |
63 | + (BOOL) isBetaVersion
64 | {
65 | return [[self sharedConfiguration] isBetaVersion];
66 | }
67 |
68 | - (BOOL) isBetaVersion
69 | {
70 | char isBeta = [[[[NSBundle mainBundle] infoDictionary] valueForKey:@"isBeta"] characterAtIndex:0];
71 | if (isBeta == 'Y'
72 | || isBeta == 'y'
73 | || isBeta == 'T'
74 | || isBeta == 't')
75 | return YES;
76 | return NO;
77 | }
78 |
79 | + (NSString*) version
80 | {
81 | return [[self sharedConfiguration] version];
82 | }
83 |
84 | - (NSString*) version
85 | {
86 | if (!version) {
87 | version = [NSString stringWithContentsOfFile:[self fullXAMPPPathFor:@"/xamppfiles/lib/VERSION"]];
88 | version = [version stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
89 |
90 | [version retain];
91 |
92 | if (!version)
93 | version = @"Unknown";
94 | }
95 |
96 | return version;
97 | }
98 |
99 | + (NSString*) fullXAMPPPathFor:(NSString*)anPath
100 | {
101 | return [[self sharedConfiguration] fullXAMPPPathFor:anPath];
102 | }
103 |
104 | - (NSString*) fullXAMPPPathFor:(NSString*)anPath
105 | {
106 | return [[self XAMPPPath] stringByAppendingPathComponent:anPath];
107 | }
108 |
109 | + (NSString*) XAMPPPath
110 | {
111 | return [[self sharedConfiguration] XAMPPPath];
112 | }
113 |
114 | - (NSString*) XAMPPPath
115 | {
116 | return [[[NSBundle mainBundle] infoDictionary] objectForKey:@"XAMPPPath"];
117 | }
118 |
119 | - (NSURL*) supportForumURL
120 | {
121 | return [NSURL URLWithString:[[[NSBundle mainBundle] infoDictionary] objectForKey:@"SupportForumURL"]];
122 | }
123 |
124 | - (NSURL*) bugtrackerURL
125 | {
126 | return [NSURL URLWithString:[[[NSBundle mainBundle] infoDictionary] objectForKey:@"BugtrackerURL"]];
127 | }
128 |
129 | - (NSURL*) installGuideURL
130 | {
131 | return [NSURL URLWithString:[[[NSBundle mainBundle] infoDictionary] objectForKey:@"InstallGuideURL"]];
132 | }
133 |
134 | - (BOOL) hasFixRights
135 | {
136 | return [[NSFileManager defaultManager] fileExistsAtPath:[self fullXAMPPPathFor:@"/etc/xampp/rights_fixed"]];
137 | }
138 |
139 | - (NSArray*) PHPVersions
140 | {
141 | if (!PHPVersions)
142 | [self updatePHPVersions];
143 |
144 | return PHPVersions;
145 | }
146 |
147 | - (NSString*) activePHP
148 | {
149 | if (!activePHP)
150 | [self updatePHPVersions];
151 |
152 | return activePHP;
153 | }
154 |
155 | - (void) updatePHPVersions
156 | {
157 | NSArray *files;
158 | NSMutableArray *tmp;
159 | char buf[BUFSIZ];
160 | int rc = 0;
161 |
162 | files = [[NSFileManager defaultManager] directoryContentsAtPath:[self fullXAMPPPathFor:@"/bin"]];
163 |
164 | files = [files filteredArrayUsingPredicate:[NSPredicate predicateWithFormat:@"SELF MATCHES 'php-[0-9].*'"]];
165 |
166 | tmp = [NSMutableArray array];
167 |
168 | int i, count = [files count];
169 | for (i = 0; i < count; i++) {
170 | NSString * obj = [files objectAtIndex:i];
171 |
172 | [tmp addObject:[obj substringFromIndex:4]];
173 | }
174 |
175 | [self setPHPVersions:tmp];
176 |
177 | rc = readlink([[self fullXAMPPPathFor:@"/bin/php"] fileSystemRepresentation], buf, BUFSIZ);
178 |
179 | if (rc > 0) {
180 | buf[rc] = '\0';
181 | [self setActivePHP:[[[NSString stringWithUTF8String:buf] substringFromIndex:4] retain]];
182 | }
183 | }
184 |
185 | - (void) setActivePHP:(NSString*)anString
186 | {
187 | if ([anString isEqualToString:activePHP])
188 | return;
189 |
190 | [self willChangeValueForKey:@"activePHP"];
191 |
192 | [activePHP release];
193 | activePHP = [anString retain];
194 |
195 | [self didChangeValueForKey:@"activePHP"];
196 | }
197 |
198 | - (void) setPHPVersions:(NSArray*)anArray
199 | {
200 | if ([anArray isEqualToArray:PHPVersions])
201 | return;
202 |
203 | [self willChangeValueForKey:@"PHPVersions"];
204 |
205 | [PHPVersions release];
206 | PHPVersions = [anArray retain];
207 |
208 | [self didChangeValueForKey:@"PHPVersions"];
209 | }
210 |
211 | @end
212 |
--------------------------------------------------------------------------------
/Sources/XPError.h:
--------------------------------------------------------------------------------
1 | /*
2 |
3 | XAMPP
4 | Copyright (C) 2009 by Apache Friends
5 |
6 | Authors of this file:
7 | - Christian Speich
8 |
9 | This file is part of XAMPP.
10 |
11 | XAMPP is free software: you can redistribute it and/or modify
12 | it under the terms of the GNU General Public License as published by
13 | the Free Software Foundation, either version 3 of the License, or
14 | (at your option) any later version.
15 |
16 | XAMPP is distributed in the hope that it will be useful,
17 | but WITHOUT ANY WARRANTY; without even the implied warranty of
18 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 | GNU General Public License for more details.
20 |
21 | You should have received a copy of the GNU General Public License
22 | along with XAMPP. If not, see .
23 |
24 | */
25 |
26 | extern NSString *XAMPPControlErrorDomain;
27 | extern NSString* XPErrorLogFileKey;
28 | extern NSString* XPErrorModuleNameKey;
29 |
30 | typedef enum _XPError {
31 | XPNoError,
32 | XPDidNotStart,
33 | XPDidNotStop,
34 | XPDidNotReload,
35 | XPWebSharingIsOn,
36 | XPSyntaxError,
37 | XPOtherServerRunning,
38 | XPHostnameResolveFail,
39 | XPUnknownError
40 | } XPError;
--------------------------------------------------------------------------------
/Sources/XPError.m:
--------------------------------------------------------------------------------
1 | /*
2 |
3 | XAMPP
4 | Copyright (C) 2009 by Apache Friends
5 |
6 | Authors of this file:
7 | - Christian Speich
8 |
9 | This file is part of XAMPP.
10 |
11 | XAMPP is free software: you can redistribute it and/or modify
12 | it under the terms of the GNU General Public License as published by
13 | the Free Software Foundation, either version 3 of the License, or
14 | (at your option) any later version.
15 |
16 | XAMPP is distributed in the hope that it will be useful,
17 | but WITHOUT ANY WARRANTY; without even the implied warranty of
18 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 | GNU General Public License for more details.
20 |
21 | You should have received a copy of the GNU General Public License
22 | along with XAMPP. If not, see .
23 |
24 | */
25 |
26 | #import
27 |
28 | NSString *XAMPPControlErrorDomain = @"XAMPPErrorDomain";
29 | NSString* XPErrorLogFileKey = @"LogFile";
30 | NSString* XPErrorModuleNameKey = @"ModuleName";
31 |
--------------------------------------------------------------------------------
/Sources/XPHostnameResolveRecoveryAttempter.h:
--------------------------------------------------------------------------------
1 | /*
2 |
3 | XAMPP
4 | Copyright (C) 2009 by Apache Friends
5 |
6 | Authors of this file:
7 | - Christian Speich
8 |
9 | This file is part of XAMPP.
10 |
11 | XAMPP is free software: you can redistribute it and/or modify
12 | it under the terms of the GNU General Public License as published by
13 | the Free Software Foundation, either version 3 of the License, or
14 | (at your option) any later version.
15 |
16 | XAMPP is distributed in the hope that it will be useful,
17 | but WITHOUT ANY WARRANTY; without even the implied warranty of
18 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 | GNU General Public License for more details.
20 |
21 | You should have received a copy of the GNU General Public License
22 | along with XAMPP. If not, see .
23 |
24 | */
25 |
26 | #import
27 |
28 | @class XPModule;
29 |
30 | @interface XPHostnameResolveRecoveryAttempter : NSObject {
31 | XPModule* module;
32 | }
33 |
34 | - (id) initWithModule:(XPModule*)module;
35 | - (BOOL) addHostnameToHosts;
36 |
37 | @end
38 |
--------------------------------------------------------------------------------
/Sources/XPHostnameResolveRecoveryAttempter.m:
--------------------------------------------------------------------------------
1 | /*
2 |
3 | XAMPP
4 | Copyright (C) 2009 by Apache Friends
5 |
6 | Authors of this file:
7 | - Christian Speich
8 |
9 | This file is part of XAMPP.
10 |
11 | XAMPP is free software: you can redistribute it and/or modify
12 | it under the terms of the GNU General Public License as published by
13 | the Free Software Foundation, either version 3 of the License, or
14 | (at your option) any later version.
15 |
16 | XAMPP is distributed in the hope that it will be useful,
17 | but WITHOUT ANY WARRANTY; without even the implied warranty of
18 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 | GNU General Public License for more details.
20 |
21 | You should have received a copy of the GNU General Public License
22 | along with XAMPP. If not, see .
23 |
24 | */
25 |
26 | #include
27 |
28 | #import "XPHostnameResolveRecoveryAttempter.h"
29 | #import "XPModule.h"
30 | #import "XPAlert.h"
31 | #import "NSFileHandle+OpenAsRoot.h"
32 |
33 | @implementation XPHostnameResolveRecoveryAttempter
34 |
35 | - (id) initWithModule:(XPModule*)inModule;
36 | {
37 | self = [super init];
38 | if (self != nil) {
39 | module = inModule;
40 | }
41 | return self;
42 | }
43 |
44 | - (BOOL)attemptRecoveryFromError:(NSError *)error
45 | optionIndex:(uint)recoveryOptionIndex
46 | {
47 | if (recoveryOptionIndex == 0) {
48 | if (![self addHostnameToHosts])
49 | return NO;
50 |
51 | NSError* error = [module start];
52 | if (error) {
53 | [XPAlert presentError:error];
54 | return NO;
55 | }
56 | }
57 |
58 | return YES;
59 | }
60 |
61 | - (BOOL) addHostnameToHosts
62 | {
63 | NSFileHandle* hosts = [NSFileHandle fileHandleWithRootPrivilegesForUpdatingAtPath:@"/etc/hosts"];
64 | char hostname[256];
65 |
66 | gethostname(hostname, 256);
67 |
68 | if (!hosts)
69 | return NO;
70 |
71 | [hosts seekToEndOfFile];
72 | [hosts writeData:[[NSString stringWithFormat:@"#Added by XAMPP Control\n127.0.0.1 %s\n\n", hostname] dataUsingEncoding:NSASCIIStringEncoding]];
73 | return YES;
74 | }
75 |
76 | @end
77 |
--------------------------------------------------------------------------------
/Sources/XPLocalization.h:
--------------------------------------------------------------------------------
1 | /*
2 |
3 | XAMPP
4 | Copyright (C) 2009 by Apache Friends
5 |
6 | Authors of this file:
7 | - Christian Speich
8 |
9 | This file is part of XAMPP.
10 |
11 | XAMPP is free software: you can redistribute it and/or modify
12 | it under the terms of the GNU General Public License as published by
13 | the Free Software Foundation, either version 3 of the License, or
14 | (at your option) any later version.
15 |
16 | XAMPP is distributed in the hope that it will be useful,
17 | but WITHOUT ANY WARRANTY; without even the implied warranty of
18 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 | GNU General Public License for more details.
20 |
21 | You should have received a copy of the GNU General Public License
22 | along with XAMPP. If not, see .
23 |
24 | */
25 |
26 | #define XPLocalizedString(key, comment) (NSLocalizedStringFromTableInBundle((key), @"Localizable", [NSBundle bundleForClass:[self class]], (comment)))
27 |
--------------------------------------------------------------------------------
/Sources/XPModule.h:
--------------------------------------------------------------------------------
1 | /*
2 |
3 | XAMPP
4 | Copyright (C) 2009 by Apache Friends
5 |
6 | Authors of this file:
7 | - Christian Speich
8 |
9 | This file is part of XAMPP.
10 |
11 | XAMPP is free software: you can redistribute it and/or modify
12 | it under the terms of the GNU General Public License as published by
13 | the Free Software Foundation, either version 3 of the License, or
14 | (at your option) any later version.
15 |
16 | XAMPP is distributed in the hope that it will be useful,
17 | but WITHOUT ANY WARRANTY; without even the implied warranty of
18 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 | GNU General Public License for more details.
20 |
21 | You should have received a copy of the GNU General Public License
22 | along with XAMPP. If not, see .
23 |
24 | */
25 |
26 | #import
27 | #import
28 |
29 | @class XPProcessWatcher;
30 |
31 | @interface XPModule : NSObject {
32 | XPProcessWatcher* processWatcher;
33 | NSString *pidFile;
34 | NSString* _name;
35 | XPStatus status;
36 | BOOL _shouldRunStartTests;
37 |
38 | int watchDirFD;
39 | int watchPID;
40 | }
41 |
42 | // The Name of the Module
43 | - (NSString*) name;
44 | - (void) setName:(NSString*)anName;
45 |
46 | - (NSString*) pidFile;
47 | - (void) setPidFile:(NSString*)aPidFile;
48 |
49 | // The method is called on an seperate thread
50 | // returns an NSError or nil if no error happens
51 | - (NSError*) start;
52 | - (NSError*) stop;
53 | - (NSError*) reload;
54 |
55 | //
56 | - (BOOL) shouldRunStartTests;
57 | - (void) setShouldRunStartTests:(BOOL)should;
58 | - (NSError*) runStartTests;
59 |
60 | - (XPStatus) status;
61 | - (void) setStatus:(XPStatus) aStatus;
62 |
63 | - (void) checkFixRightsAndRunIfNeeded;
64 |
65 | /*- (void) refreshStatusCheck;
66 | - (void) removeStatusCheck;
67 | - (void) setupStatusCheck;*/
68 |
69 | @end
70 |
--------------------------------------------------------------------------------
/Sources/XPModuleViewController.h:
--------------------------------------------------------------------------------
1 | /*
2 |
3 | XAMPP
4 | Copyright (C) 2009 by Apache Friends
5 |
6 | Authors of this file:
7 | - Christian Speich
8 |
9 | This file is part of XAMPP.
10 |
11 | XAMPP is free software: you can redistribute it and/or modify
12 | it under the terms of the GNU General Public License as published by
13 | the Free Software Foundation, either version 3 of the License, or
14 | (at your option) any later version.
15 |
16 | XAMPP is distributed in the hope that it will be useful,
17 | but WITHOUT ANY WARRANTY; without even the implied warranty of
18 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 | GNU General Public License for more details.
20 |
21 | You should have received a copy of the GNU General Public License
22 | along with XAMPP. If not, see .
23 |
24 | */
25 |
26 | #import
27 | #import
28 |
29 | @class XPModule;
30 | @class StatusIndicatorView;
31 |
32 | @interface XPModuleViewController : XPViewController {
33 | IBOutlet NSButton *actionButton;
34 | IBOutlet StatusIndicatorView *statusIndicator;
35 | IBOutlet NSTextField*nameField;
36 |
37 | XPModule *module;
38 |
39 | NSMenuItem *startItem;
40 | NSMenuItem *stopItem;
41 | NSMenuItem *reloadItem;
42 | }
43 |
44 | - (id) initWithModule:(XPModule*) module;
45 |
46 | - (IBAction) action:(id)sender;
47 | - (IBAction) stop:(id)sender;
48 | - (IBAction) start:(id)sender;
49 | - (IBAction) reload:(id)sender;
50 |
51 | @end
52 |
--------------------------------------------------------------------------------
/Sources/XPModuleViewController.m:
--------------------------------------------------------------------------------
1 | /*
2 |
3 | XAMPP
4 | Copyright (C) 2009 by Apache Friends
5 |
6 | Authors of this file:
7 | - Christian Speich
8 |
9 | This file is part of XAMPP.
10 |
11 | XAMPP is free software: you can redistribute it and/or modify
12 | it under the terms of the GNU General Public License as published by
13 | the Free Software Foundation, either version 3 of the License, or
14 | (at your option) any later version.
15 |
16 | XAMPP is distributed in the hope that it will be useful,
17 | but WITHOUT ANY WARRANTY; without even the implied warranty of
18 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 | GNU General Public License for more details.
20 |
21 | You should have received a copy of the GNU General Public License
22 | along with XAMPP. If not, see .
23 |
24 | */
25 |
26 | #import "XPModuleViewController.h"
27 | #import "StatusIndicatorView.h"
28 | #import "XPModule.h"
29 | #import "XPAlert.h"
30 |
31 | @interface XPModuleViewController (PRIVATE)
32 |
33 | - (void) updateActionButton;
34 |
35 | @end
36 |
37 |
38 | @implementation XPModuleViewController
39 |
40 | - (id) initWithModule:(XPModule*) aModule
41 | {
42 | NSParameterAssert(aModule != Nil);
43 |
44 | self = [self init];
45 | if (self != nil) {
46 | module = [aModule retain];
47 |
48 | if (![NSBundle loadNibNamed:@"ModuleView" owner:self]) {
49 | [self release];
50 | return nil;
51 | }
52 |
53 | [module addObserver:self forKeyPath:@"status" options:Nil context:NULL];
54 | [self observeValueForKeyPath:@"status" ofObject:module change:Nil context:NULL];
55 | [nameField setStringValue:[module name]];
56 | }
57 | return self;
58 | }
59 |
60 | - (void) dealloc
61 | {
62 | [module release];
63 |
64 | [super dealloc];
65 | }
66 |
67 | - (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context
68 | {
69 | if (module == object && [keyPath isEqualToString:@"status"]) {
70 | // Update status
71 |
72 | switch ([module status]) {
73 | case XPNotRunning:
74 | [actionButton setTitle:XPLocalizedString(@"Start", @"Start a Module")];
75 | [actionButton setEnabled:YES];
76 | [statusIndicator setStatus:RedStatus];
77 | [statusIndicator setToolTip:@"Not Running"];
78 | break;
79 | case XPRunning:
80 | [actionButton setTitle:XPLocalizedString(@"Stop", @"Stop a Module")];
81 | [actionButton setEnabled:YES];
82 | [statusIndicator setStatus:GreenStatus];
83 | [statusIndicator setToolTip:XPLocalizedString(@"Running", @"Module is Running ToolTip")];
84 | break;
85 | case XPStarting:
86 | [actionButton setEnabled:NO];
87 | [statusIndicator setStatus:WorkingStatus];
88 | [statusIndicator setToolTip:XPLocalizedString(@"Starting", @"Module is Starting ToolTip")];
89 | break;
90 | case XPStopping:
91 | [actionButton setEnabled:NO];
92 | [statusIndicator setStatus:WorkingStatus];
93 | [statusIndicator setToolTip:XPLocalizedString(@"Stopping", @"Module is Stopping ToolTip")];
94 | break;
95 | default:
96 | [actionButton setEnabled:NO];
97 | [statusIndicator setStatus:UnknownStatus];
98 | [statusIndicator setToolTip:XPLocalizedString(@"Unknown", @"Module is in a Unknown Stat ToolTip")];
99 | break;
100 | }
101 | }
102 | }
103 |
104 | - (IBAction) action:(id)sender
105 | {
106 | switch ([module status]) {
107 | case XPNotRunning:
108 | [self start:sender];
109 | break;
110 | case XPRunning:
111 | [self stop:sender];
112 | break;
113 | default:
114 | break;
115 | }
116 | }
117 |
118 | - (IBAction) reload:(id)sender
119 | {
120 | [NSThread detachNewThreadSelector:@selector(doReload)
121 | toTarget:self
122 | withObject:Nil];
123 | }
124 |
125 | - (void) doReload
126 | {
127 | NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
128 | NSError *error;
129 |
130 | error = [module reload];
131 |
132 | if (error)
133 | [XPAlert presentError:error];
134 |
135 | [pool release];
136 | }
137 |
138 | - (IBAction) start:(id)sender
139 | {
140 | [NSThread detachNewThreadSelector:@selector(doStart)
141 | toTarget:self
142 | withObject:Nil];
143 | }
144 |
145 | - (void) doStart
146 | {
147 | NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
148 | NSError *error;
149 |
150 | error = [module start];
151 | NSLog(@"%@", error);
152 | if (error)
153 | [XPAlert presentError:error];
154 |
155 | [pool release];
156 | }
157 |
158 | - (IBAction) stop:(id)sender
159 | {
160 | [NSThread detachNewThreadSelector:@selector(doStop)
161 | toTarget:self
162 | withObject:Nil];
163 | }
164 |
165 | - (void) doStop
166 | {
167 | NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
168 | NSError *error;
169 |
170 | error = [module stop];
171 |
172 | if (error)
173 | [XPAlert presentError:error];
174 |
175 | [pool release];
176 | }
177 |
178 | @end
179 |
180 |
--------------------------------------------------------------------------------
/Sources/XPPlugInCategories.h:
--------------------------------------------------------------------------------
1 | /*
2 |
3 | XAMPP
4 | Copyright (C) 2009 by Apache Friends
5 |
6 | Authors of this file:
7 | - Christian Speich
8 |
9 | This file is part of XAMPP.
10 |
11 | XAMPP is free software: you can redistribute it and/or modify
12 | it under the terms of the GNU General Public License as published by
13 | the Free Software Foundation, either version 3 of the License, or
14 | (at your option) any later version.
15 |
16 | XAMPP is distributed in the hope that it will be useful,
17 | but WITHOUT ANY WARRANTY; without even the implied warranty of
18 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 | GNU General Public License for more details.
20 |
21 | You should have received a copy of the GNU General Public License
22 | along with XAMPP. If not, see .
23 |
24 | */
25 |
26 | #import
27 |
28 | extern NSString* XPModulesPlugInCategorie;
29 | extern NSString* XPControlsPlugInCategorie;
30 | extern NSString* XPSecurityChecksPlugInCategorie;
31 |
32 |
--------------------------------------------------------------------------------
/Sources/XPPlugInCategories.m:
--------------------------------------------------------------------------------
1 | /*
2 |
3 | XAMPP
4 | Copyright (C) 2009 by Apache Friends
5 |
6 | Authors of this file:
7 | - Christian Speich
8 |
9 | This file is part of XAMPP.
10 |
11 | XAMPP is free software: you can redistribute it and/or modify
12 | it under the terms of the GNU General Public License as published by
13 | the Free Software Foundation, either version 3 of the License, or
14 | (at your option) any later version.
15 |
16 | XAMPP is distributed in the hope that it will be useful,
17 | but WITHOUT ANY WARRANTY; without even the implied warranty of
18 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 | GNU General Public License for more details.
20 |
21 | You should have received a copy of the GNU General Public License
22 | along with XAMPP. If not, see .
23 |
24 | */
25 |
26 | #import "XPPlugInCategories.h"
27 |
28 | NSString* XPModulesPlugInCategorie = @"Modules";
29 | NSString* XPControlsPlugInCategorie = @"Controls";
30 | NSString* XPSecurityChecksPlugInCategorie = @"SecurityChecks";
31 |
32 |
--------------------------------------------------------------------------------
/Sources/XPPlugInHooks.h:
--------------------------------------------------------------------------------
1 | /*
2 |
3 | XAMPP
4 | Copyright (C) 2009 by Apache Friends
5 |
6 | Authors of this file:
7 | - Christian Speich
8 |
9 | This file is part of XAMPP.
10 |
11 | XAMPP is free software: you can redistribute it and/or modify
12 | it under the terms of the GNU General Public License as published by
13 | the Free Software Foundation, either version 3 of the License, or
14 | (at your option) any later version.
15 |
16 | XAMPP is distributed in the hope that it will be useful,
17 | but WITHOUT ANY WARRANTY; without even the implied warranty of
18 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 | GNU General Public License for more details.
20 |
21 | You should have received a copy of the GNU General Public License
22 | along with XAMPP. If not, see .
23 |
24 | */
25 |
26 | #import
27 |
28 | /*
29 | !
30 | ! In this file are all public hooks and hook parameters for
31 | ! XAMPP Control listed. Please be prepared that parameters
32 | ! can be [NSNull null] and handle this probbably.
33 | !
34 | ! Be warned that undocumented Hooks and parameters can be
35 | ! changed or removed at any time!
36 | !
37 | */
38 |
39 | /*
40 |
41 | Is invoked when the Contols Window is loaded and
42 | configured.
43 |
44 | The following parameters are avaiable:
45 | - HookWindowKey (NSWindow*)
46 |
47 | */
48 | extern NSString* const ControlsWindowDidLoadHook;
49 |
50 | /*
51 |
52 | Is invoked when the About Window is beeing configured.
53 |
54 | The following parameters are avaiable:
55 | - HookWindowKey (NSWindow*)
56 | - HookVersionsStringKey (NSMutableAttributedString*)
57 | - HookCreditsHTMLKey (NSMutableString*)
58 | - HookXAMPPLabelKey (NSMutableAttributedString*)
59 |
60 | */
61 | extern NSString* const AboutWindowSetupHook;
62 | extern NSString* const HookVersionsStringKey;
63 | extern NSString* const HookCreditsHTMLKey;
64 | extern NSString* const HookXAMPPLabelKey;
65 |
66 | /*
67 |
68 | Global Hook Keys that are used in many Hooks
69 |
70 | */
71 |
72 | extern NSString* const HookWindowKey;
73 |
--------------------------------------------------------------------------------
/Sources/XPPlugInHooks.m:
--------------------------------------------------------------------------------
1 | /*
2 |
3 | XAMPP
4 | Copyright (C) 2009 by Apache Friends
5 |
6 | Authors of this file:
7 | - Christian Speich
8 |
9 | This file is part of XAMPP.
10 |
11 | XAMPP is free software: you can redistribute it and/or modify
12 | it under the terms of the GNU General Public License as published by
13 | the Free Software Foundation, either version 3 of the License, or
14 | (at your option) any later version.
15 |
16 | XAMPP is distributed in the hope that it will be useful,
17 | but WITHOUT ANY WARRANTY; without even the implied warranty of
18 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 | GNU General Public License for more details.
20 |
21 | You should have received a copy of the GNU General Public License
22 | along with XAMPP. If not, see .
23 |
24 | */
25 |
26 | #import "XPPlugInHooks.h"
27 |
28 | NSString* const ControlsWindowDidLoadHook = @"controlsWindowDidLoad";
29 |
30 | NSString* const AboutWindowSetupHook = @"aboutSetup";
31 | NSString* const HookVersionsStringKey = @"versionsString";
32 | NSString* const HookCreditsHTMLKey = @"creditsHTML";
33 | NSString* const HookXAMPPLabelKey = @"XAMPPLabel";
34 |
35 | NSString* const HookWindowKey = @"window";
36 |
--------------------------------------------------------------------------------
/Sources/XPStatus.h:
--------------------------------------------------------------------------------
1 | /*
2 |
3 | XAMPP
4 | Copyright (C) 2009 by Apache Friends
5 |
6 | Authors of this file:
7 | - Christian Speich
8 |
9 | This file is part of XAMPP.
10 |
11 | XAMPP is free software: you can redistribute it and/or modify
12 | it under the terms of the GNU General Public License as published by
13 | the Free Software Foundation, either version 3 of the License, or
14 | (at your option) any later version.
15 |
16 | XAMPP is distributed in the hope that it will be useful,
17 | but WITHOUT ANY WARRANTY; without even the implied warranty of
18 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 | GNU General Public License for more details.
20 |
21 | You should have received a copy of the GNU General Public License
22 | along with XAMPP. If not, see .
23 |
24 | */
25 |
26 | typedef enum {
27 | XPNotRunning,
28 | XPRunning,
29 | XPStarting,
30 | XPStopping,
31 | XPUnknownStatus
32 | } XPStatus;
--------------------------------------------------------------------------------
/Sources/XPViewController.h:
--------------------------------------------------------------------------------
1 | /*
2 |
3 | XAMPP
4 | Copyright (C) 2009 by Apache Friends
5 |
6 | Authors of this file:
7 | - Christian Speich
8 |
9 | This file is part of XAMPP.
10 |
11 | XAMPP is free software: you can redistribute it and/or modify
12 | it under the terms of the GNU General Public License as published by
13 | the Free Software Foundation, either version 3 of the License, or
14 | (at your option) any later version.
15 |
16 | XAMPP is distributed in the hope that it will be useful,
17 | but WITHOUT ANY WARRANTY; without even the implied warranty of
18 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 | GNU General Public License for more details.
20 |
21 | You should have received a copy of the GNU General Public License
22 | along with XAMPP. If not, see