Compare commits
18 Commits
update_0_9
...
MAPI_NEW_D
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e953a4ea87 | ||
|
|
22ea3cb16d | ||
|
|
e021985dac | ||
|
|
37c7fe2cc1 | ||
|
|
92449d5f2b | ||
|
|
0f4c47bad2 | ||
|
|
66a09211ae | ||
|
|
4d276aa864 | ||
|
|
9a9d38606a | ||
|
|
7ef7f62f45 | ||
|
|
412bc70111 | ||
|
|
cf982c25ce | ||
|
|
dfb5dde44f | ||
|
|
5b5ddf1efb | ||
|
|
2765860524 | ||
|
|
95560e128c | ||
|
|
2c4edc911e | ||
|
|
82d37c5f89 |
70
mozilla/mailnews/base/public/nsIMapiRegistry.idl
Normal file
@@ -0,0 +1,70 @@
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2001
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Srilatha Moturi <srilatha@netscape.com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsISupports.idl"
|
||||
|
||||
interface nsIDOMWindow;
|
||||
|
||||
/**
|
||||
* This interface provides support for registering Mozilla as the default
|
||||
* Mail Client. This interface can also be used to get/set the user preference
|
||||
* for the default Mail Client.
|
||||
*
|
||||
*/
|
||||
[scriptable, uuid(c5be14ba-4e0a-4eec-a1b8-04363761d63c)]
|
||||
interface nsIMapiRegistry: nsISupports {
|
||||
|
||||
/** This is set to TRUE if Mozilla is the default Application
|
||||
*/
|
||||
attribute boolean isDefaultMailClient;
|
||||
|
||||
/** This is set TRUE only once per session.
|
||||
*/
|
||||
readonly attribute boolean showDialog;
|
||||
|
||||
/** This will bring the dialog asking the user if he/she wants to set
|
||||
* Mozilla as default Mail Client.
|
||||
* Call this only if Mozilla is not the default Mail client
|
||||
*/
|
||||
void showMailIntegrationDialog(in nsIDOMWindow parentWindow);
|
||||
|
||||
};
|
||||
|
||||
%{C++
|
||||
#define NS_IMAPIREGISTRY_CONTRACTID "@mozilla.org/mapiregistry;1"
|
||||
#define NS_IMAPIREGISTRY_CLASSNAME "Mozilla MAPI Registry"
|
||||
%}
|
||||
27
mozilla/mailnews/mapi/makefile.win
Normal file
@@ -0,0 +1,27 @@
|
||||
#!nmake
|
||||
#
|
||||
# The contents of this file are subject to the Netscape Public
|
||||
# License Version 1.1 (the "License"); you may not use this file
|
||||
# except in compliance with the License. You may obtain a copy of
|
||||
# the License at http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS
|
||||
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
# implied. See the License for the specific language governing
|
||||
# rights and limitations under the License.
|
||||
#
|
||||
# The Original Code is mozilla.org code.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
# Rights Reserved.
|
||||
#
|
||||
# Contributor(s): Srilatha Moturi <srilatha@netscape.com>
|
||||
# Krishna Mohan Khandrika <kkhandrika@netscape.com>
|
||||
|
||||
DEPTH=..\..
|
||||
|
||||
DIRS=mapihook resources mapiDll
|
||||
|
||||
include <$(DEPTH)\config\rules.mak>
|
||||
54
mozilla/mailnews/mapi/mapiDll/Mapi32.DEF
Normal file
@@ -0,0 +1,54 @@
|
||||
; ***** BEGIN LICENSE BLOCK *****
|
||||
; Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
;
|
||||
; The contents of this file are subject to the Mozilla Public License Version
|
||||
; 1.1 (the "License"); you may not use this file except in compliance with
|
||||
; the License. You may obtain a copy of the License at
|
||||
; http://www.mozilla.org/MPL/
|
||||
;
|
||||
; Software distributed under the License is distributed on an "AS IS" basis,
|
||||
; WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
; for the specific language governing rights and limitations under the
|
||||
; License.
|
||||
;
|
||||
; The Original Code is Mozilla.
|
||||
;
|
||||
; The Initial Developer of the Original Code is
|
||||
; Netscape Communications Corp.
|
||||
; Portions created by the Initial Developer are Copyright (C) 2001
|
||||
; the Initial Developer. All Rights Reserved.
|
||||
;
|
||||
; Contributor(s): Krishna Mohan Khandrika (kkhandrika@netscape.com)
|
||||
;
|
||||
; Alternatively, the contents of this file may be used under the terms of
|
||||
; either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
; the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
; in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
; of those above. If you wish to allow use of your version of this file only
|
||||
; under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
; use your version of this file under the terms of the MPL, indicate your
|
||||
; decision by deleting the provisions above and replace them with the notice
|
||||
; and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
; the provisions above, a recipient may use your version of this file under
|
||||
; the terms of any one of the MPL, the GPL or the LGPL.
|
||||
;
|
||||
; ***** END LICENSE BLOCK *****
|
||||
|
||||
LIBRARY mozMapi32.dll
|
||||
DESCRIPTION 'Mozilla Simple MAPI Support'
|
||||
|
||||
EXPORTS
|
||||
MAPILogon
|
||||
MAPILogoff
|
||||
MAPISendMail
|
||||
MAPISendDocuments
|
||||
MAPIFindNext
|
||||
MAPIReadMail
|
||||
MAPISaveMail
|
||||
MAPIDeleteMail
|
||||
MAPIAddress
|
||||
MAPIDetails
|
||||
MAPIResolveName
|
||||
MAPIFreeBuffer
|
||||
GetMapiDllVersion
|
||||
|
||||
346
mozilla/mailnews/mapi/mapiDll/MapiDll.cpp
Normal file
@@ -0,0 +1,346 @@
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is Mozilla
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corp.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2001
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s): Krishna Mohan Khandrika (kkhandrika@netscape.com)
|
||||
* Contributor(s): Rajiv Dayal (rdayal@netscape.com)
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include <windows.h>
|
||||
#include <tchar.h>
|
||||
#include <mapidefs.h>
|
||||
#include <mapi.h>
|
||||
#include "msgMapi.h"
|
||||
#include "msgMapiMain.h"
|
||||
|
||||
#define MAX_RECIPS 100
|
||||
#define MAX_FILES 100
|
||||
|
||||
const CLSID CLSID_CMapiImp = {0x29f458be, 0x8866, 0x11d5,
|
||||
{0xa3, 0xdd, 0x0, 0xb0, 0xd0, 0xf3, 0xba, 0xa7}};
|
||||
const IID IID_nsIMapi = {0x6EDCD38E,0x8861,0x11d5,
|
||||
{0xA3,0xDD,0x00,0xB0,0xD0,0xF3,0xBA,0xA7}};
|
||||
|
||||
DWORD tId = 0;
|
||||
|
||||
BOOL WINAPI DllMain(HINSTANCE aInstance, DWORD aReason, LPVOID aReserved)
|
||||
{
|
||||
switch (aReason)
|
||||
{
|
||||
case DLL_PROCESS_ATTACH : tId = TlsAlloc();
|
||||
if (tId == 0xFFFFFFFF)
|
||||
return FALSE;
|
||||
break;
|
||||
|
||||
case DLL_PROCESS_DETACH : TlsFree(tId);
|
||||
break;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
BOOL InitMozillaReference(nsIMapi **aRetValue)
|
||||
{
|
||||
// Check wehther this thread has a valid Interface
|
||||
// by looking into thread-specific-data variable
|
||||
|
||||
*aRetValue = (nsIMapi *)TlsGetValue(tId);
|
||||
|
||||
// Check whether the pointer actually resolves to
|
||||
// a valid method call; otherwise mozilla is not running
|
||||
|
||||
if ((*aRetValue) && (*aRetValue)->IsValid() == S_OK)
|
||||
return TRUE;
|
||||
|
||||
HRESULT hRes = ::CoInitialize(nsnull) ;
|
||||
|
||||
hRes = ::CoCreateInstance(CLSID_CMapiImp, NULL, CLSCTX_LOCAL_SERVER,
|
||||
IID_nsIMapi, (LPVOID *)aRetValue);
|
||||
|
||||
if (hRes == S_OK && (*aRetValue)->Initialize() == S_OK)
|
||||
if (TlsSetValue(tId, (LPVOID)(*aRetValue)))
|
||||
return TRUE;
|
||||
|
||||
// Either CoCreate or TlsSetValue failed; so return FALSE
|
||||
|
||||
if ((*aRetValue))
|
||||
(*aRetValue)->Release();
|
||||
|
||||
::CoUninitialize();
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////
|
||||
// The MAPILogon function begins a Simple MAPI session, loading the default message ////
|
||||
// store and address book providers ////
|
||||
////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
ULONG FAR PASCAL MAPILogon(ULONG aUIParam, LPTSTR aProfileName,
|
||||
LPTSTR aPassword, FLAGS aFlags,
|
||||
ULONG aReserved, LPLHANDLE aSession)
|
||||
{
|
||||
HRESULT hr = 0;
|
||||
ULONG nSessionId = 0;
|
||||
nsIMapi *pNsMapi = NULL;
|
||||
|
||||
if (!InitMozillaReference(&pNsMapi))
|
||||
return MAPI_E_FAILURE;
|
||||
|
||||
if (!(aFlags & MAPI_UNICODE))
|
||||
{
|
||||
// Need to convert the parameters to Unicode.
|
||||
|
||||
char *pUserName = (char *) aProfileName;
|
||||
char *pPassWord = (char *) aPassword;
|
||||
|
||||
TCHAR ProfileName[MAX_NAME_LEN] = {0};
|
||||
TCHAR PassWord[MAX_PW_LEN] = {0};
|
||||
|
||||
if (pUserName != NULL)
|
||||
{
|
||||
if (!MultiByteToWideChar(CP_ACP, 0, pUserName, -1, ProfileName,
|
||||
MAX_NAME_LEN))
|
||||
return MAPI_E_FAILURE;
|
||||
}
|
||||
|
||||
if (pPassWord != NULL)
|
||||
{
|
||||
if (!MultiByteToWideChar(CP_ACP, 0, pPassWord, -1, PassWord,
|
||||
MAX_NAME_LEN))
|
||||
return MAPI_E_FAILURE;
|
||||
}
|
||||
|
||||
hr = pNsMapi->Login(aUIParam, ProfileName, PassWord, aFlags,
|
||||
&nSessionId);
|
||||
}
|
||||
else
|
||||
hr = pNsMapi->Login(aUIParam, aProfileName, aPassword,
|
||||
aFlags, &nSessionId);
|
||||
if (hr == S_OK)
|
||||
(*aSession) = (LHANDLE) nSessionId;
|
||||
else
|
||||
return nSessionId;
|
||||
|
||||
return SUCCESS_SUCCESS;
|
||||
}
|
||||
|
||||
ULONG FAR PASCAL MAPILogoff (LHANDLE aSession, ULONG aUIParam,
|
||||
FLAGS aFlags, ULONG aReserved)
|
||||
{
|
||||
nsIMapi *pNsMapi = (nsIMapi *)TlsGetValue(tId);
|
||||
if (pNsMapi != NULL)
|
||||
{
|
||||
if (pNsMapi->Logoff((ULONG) aSession) == S_OK)
|
||||
pNsMapi->Release();
|
||||
pNsMapi = NULL;
|
||||
}
|
||||
|
||||
TlsSetValue(tId, NULL);
|
||||
|
||||
::CoUninitialize();
|
||||
|
||||
return SUCCESS_SUCCESS;
|
||||
}
|
||||
|
||||
ULONG FAR PASCAL MAPISendMail (LHANDLE lhSession, ULONG ulUIParam, lpnsMapiMessage lpMessage,
|
||||
FLAGS flFlags, ULONG ulReserved )
|
||||
{
|
||||
HRESULT hr = 0;
|
||||
BOOL bTempSession = FALSE ;
|
||||
nsIMapi *pNsMapi = NULL;
|
||||
|
||||
if (!InitMozillaReference(&pNsMapi))
|
||||
return MAPI_E_FAILURE;
|
||||
|
||||
if (lpMessage->nRecipCount > MAX_RECIPS)
|
||||
return MAPI_E_TOO_MANY_RECIPIENTS ;
|
||||
|
||||
if (lpMessage->nFileCount > MAX_FILES)
|
||||
return MAPI_E_TOO_MANY_FILES ;
|
||||
|
||||
if ( (!(flFlags & MAPI_DIALOG)) && (lpMessage->lpRecips == NULL) )
|
||||
return MAPI_E_UNKNOWN_RECIPIENT ;
|
||||
|
||||
if (!lhSession || pNsMapi->IsValidSession(lhSession) != S_OK)
|
||||
{
|
||||
FLAGS LoginFlag ;
|
||||
if ( (flFlags & MAPI_LOGON_UI) && (flFlags & MAPI_NEW_SESSION) )
|
||||
LoginFlag = MAPI_LOGON_UI | MAPI_NEW_SESSION ;
|
||||
else if (flFlags & MAPI_LOGON_UI)
|
||||
LoginFlag = MAPI_LOGON_UI ;
|
||||
|
||||
hr = MAPILogon (ulUIParam, (LPTSTR) NULL, (LPTSTR) NULL, LoginFlag, 0, &lhSession) ;
|
||||
if (hr != SUCCESS_SUCCESS)
|
||||
return MAPI_E_LOGIN_FAILURE ;
|
||||
bTempSession = TRUE ;
|
||||
}
|
||||
|
||||
// we need to deal with null data passed in by MAPI clients, specially when MAPI_DIALOG is set.
|
||||
// The MS COM type lib code generated by MIDL for the MS COM interfaces checks for these parameters
|
||||
// to be non null, although null is a valid value for them here.
|
||||
nsMapiRecipDesc * lpRecips ;
|
||||
nsMapiFileDesc * lpFiles ;
|
||||
|
||||
nsMapiMessage Message ;
|
||||
memset (&Message, 0, sizeof (nsMapiMessage) ) ;
|
||||
nsMapiRecipDesc Recipient ;
|
||||
memset (&Recipient, 0, sizeof (nsMapiRecipDesc) );
|
||||
nsMapiFileDesc Files ;
|
||||
memset (&Files, 0, sizeof (nsMapiFileDesc) ) ;
|
||||
|
||||
if(!lpMessage)
|
||||
{
|
||||
lpMessage = &Message ;
|
||||
}
|
||||
if(!lpMessage->lpRecips)
|
||||
{
|
||||
lpRecips = &Recipient ;
|
||||
}
|
||||
else
|
||||
lpRecips = lpMessage->lpRecips ;
|
||||
if(!lpMessage->lpFiles)
|
||||
{
|
||||
lpFiles = &Files ;
|
||||
}
|
||||
else
|
||||
lpFiles = lpMessage->lpFiles ;
|
||||
|
||||
HANDLE hEvent = CreateEvent (NULL, FALSE, FALSE, (LPCTSTR) MAPI_SENDCOMPLETE_EVENT) ;
|
||||
|
||||
hr = pNsMapi->SendMail (lhSession, lpMessage,
|
||||
(short) lpMessage->nRecipCount, lpRecips,
|
||||
(short) lpMessage->nFileCount, lpFiles,
|
||||
flFlags, ulReserved);
|
||||
|
||||
// we are seeing a problem when using Word, although we return success from the MAPI support
|
||||
// MS COM interface in mozilla, we are getting this error here. This is a temporary hack !!
|
||||
if (hr == 0x800703e6)
|
||||
hr = SUCCESS_SUCCESS;
|
||||
|
||||
if (hr == SUCCESS_SUCCESS)
|
||||
WaitForSingleObject (hEvent, INFINITE) ;
|
||||
CloseHandle (hEvent) ;
|
||||
|
||||
if (bTempSession)
|
||||
MAPILogoff (lhSession, ulUIParam, 0,0) ;
|
||||
|
||||
return hr ;
|
||||
}
|
||||
|
||||
|
||||
ULONG FAR PASCAL MAPISendDocuments(ULONG ulUIParam, LPTSTR lpszDelimChar, LPTSTR lpszFilePaths,
|
||||
LPTSTR lpszFileNames, ULONG ulReserved)
|
||||
{
|
||||
LHANDLE lhSession ;
|
||||
nsIMapi *pNsMapi = NULL;
|
||||
|
||||
if (!InitMozillaReference(&pNsMapi))
|
||||
return MAPI_E_FAILURE;
|
||||
|
||||
unsigned long result = MAPILogon (ulUIParam, (LPTSTR) NULL, (LPTSTR) NULL, MAPI_LOGON_UI, 0, &lhSession) ;
|
||||
if (result != SUCCESS_SUCCESS)
|
||||
return MAPI_E_LOGIN_FAILURE ;
|
||||
|
||||
HRESULT hr;
|
||||
|
||||
HANDLE hEvent = CreateEvent (NULL, FALSE, FALSE, (LPCTSTR) MAPI_SENDCOMPLETE_EVENT) ;
|
||||
|
||||
hr = pNsMapi->SendDocuments(lhSession, (LPTSTR) lpszDelimChar, (LPTSTR) lpszFilePaths,
|
||||
(LPTSTR) lpszFileNames, ulReserved) ;
|
||||
|
||||
if (hr == SUCCESS_SUCCESS)
|
||||
WaitForSingleObject (hEvent, INFINITE) ;
|
||||
CloseHandle (hEvent) ;
|
||||
|
||||
MAPILogoff (lhSession, ulUIParam, 0,0) ;
|
||||
|
||||
return hr ;
|
||||
}
|
||||
|
||||
ULONG FAR PASCAL MAPIFindNext(LHANDLE lhSession, ULONG ulUIParam, LPTSTR lpszMessageType,
|
||||
LPTSTR lpszSeedMessageID, FLAGS flFlags, ULONG ulReserved,
|
||||
LPTSTR lpszMessageID)
|
||||
{
|
||||
return MAPI_E_FAILURE;
|
||||
}
|
||||
|
||||
ULONG FAR PASCAL MAPIReadMail(LHANDLE lhSession, ULONG ulUIParam, LPTSTR lpszMessageID,
|
||||
FLAGS flFlags, ULONG ulReserved, lpMapiMessage FAR *lppMessage)
|
||||
{
|
||||
return MAPI_E_FAILURE;
|
||||
}
|
||||
|
||||
ULONG FAR PASCAL MAPISaveMail(LHANDLE lhSession, ULONG ulUIParam, lpMapiMessage lpMessage,
|
||||
FLAGS flFlags, ULONG ulReserved, LPTSTR lpszMessageID)
|
||||
{
|
||||
return MAPI_E_FAILURE;
|
||||
}
|
||||
|
||||
ULONG FAR PASCAL MAPIDeleteMail(LHANDLE lhSession, ULONG ulUIParam, LPTSTR lpszMessageID,
|
||||
FLAGS flFlags, ULONG ulReserved)
|
||||
{
|
||||
return MAPI_E_FAILURE;
|
||||
}
|
||||
|
||||
ULONG FAR PASCAL MAPIAddress(LHANDLE lhSession, ULONG ulUIParam, LPTSTR lpszCaption,
|
||||
ULONG nEditFields, LPTSTR lpszLabels, ULONG nRecips,
|
||||
lpMapiRecipDesc lpRecips, FLAGS flFlags,
|
||||
ULONG ulReserved, LPULONG lpnNewRecips,
|
||||
lpMapiRecipDesc FAR *lppNewRecips)
|
||||
{
|
||||
return MAPI_E_FAILURE;
|
||||
}
|
||||
|
||||
ULONG FAR PASCAL MAPIDetails(LHANDLE lhSession, ULONG ulUIParam, lpMapiRecipDesc lpRecip,
|
||||
FLAGS flFlags, ULONG ulReserved)
|
||||
{
|
||||
return MAPI_E_FAILURE;
|
||||
}
|
||||
|
||||
ULONG FAR PASCAL MAPIResolveName(LHANDLE lhSession, ULONG ulUIParam, LPTSTR lpszName,
|
||||
FLAGS flFlags, ULONG ulReserved, lpMapiRecipDesc FAR *lppRecip)
|
||||
{
|
||||
return MAPI_E_FAILURE;
|
||||
}
|
||||
|
||||
ULONG FAR PASCAL MAPIFreeBuffer(LPVOID pv)
|
||||
{
|
||||
return MAPI_E_FAILURE;
|
||||
}
|
||||
|
||||
ULONG FAR PASCAL GetMapiDllVersion()
|
||||
{
|
||||
return 94;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
62
mozilla/mailnews/mapi/mapiDll/makefile.win
Normal file
@@ -0,0 +1,62 @@
|
||||
# ***** BEGIN LICENSE BLOCK *****
|
||||
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
#
|
||||
# The contents of this file are subject to the Mozilla Public License Version
|
||||
# 1.1 (the "License"); you may not use this file except in compliance with
|
||||
# the License. You may obtain a copy of the License at
|
||||
# http://www.mozilla.org/MPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
# for the specific language governing rights and limitations under the
|
||||
# License.
|
||||
#
|
||||
# The Original Code is Mozilla.
|
||||
#
|
||||
# The Initial Developer of the Original Code is
|
||||
# Netscape Communications Corp.
|
||||
# Portions created by the Initial Developer are Copyright (C) 2001
|
||||
# the Initial Developer. All Rights Reserved.
|
||||
#
|
||||
# Contributor(s): Krishna Mohan Khandrika (kkhandrika@netscape.com)
|
||||
#
|
||||
# Alternatively, the contents of this file may be used under the terms of
|
||||
# either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
# in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
# of those above. If you wish to allow use of your version of this file only
|
||||
# under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
# use your version of this file under the terms of the MPL, indicate your
|
||||
# decision by deleting the provisions above and replace them with the notice
|
||||
# and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
# the provisions above, a recipient may use your version of this file under
|
||||
# the terms of any one of the MPL, the GPL or the LGPL.
|
||||
#
|
||||
# ***** END LICENSE BLOCK *****
|
||||
|
||||
DEPTH=..\..\..
|
||||
|
||||
MODULE = mozMapi32
|
||||
EXPORT_LIBRARY = $(MODULE)
|
||||
LIBRARY_NAME = $(MODULE)
|
||||
DEFFILE = Mapi32.def
|
||||
|
||||
REQUIRES = MapiProxy \
|
||||
msgMapi \
|
||||
xpcom \
|
||||
string \
|
||||
$(NULL)
|
||||
|
||||
include <$(DEPTH)\config\config.mak>
|
||||
###############################################################
|
||||
|
||||
LCFLAGS=-DUNICODE -D_UNICODE
|
||||
|
||||
OBJS= .\$(OBJDIR)\MapiDll.obj \
|
||||
$(NULL)
|
||||
|
||||
WIN_LIBS= ole32.lib \
|
||||
$(NULL)
|
||||
|
||||
include <$(DEPTH)\config\rules.mak>
|
||||
|
||||
47
mozilla/mailnews/mapi/mapihook/build/MapiProxy.def
Normal file
@@ -0,0 +1,47 @@
|
||||
; ***** BEGIN LICENSE BLOCK *****
|
||||
; Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
;
|
||||
; The contents of this file are subject to the Mozilla Public License Version
|
||||
; 1.1 (the "License"); you may not use this file except in compliance with
|
||||
; the License. You may obtain a copy of the License at
|
||||
; http://www.mozilla.org/MPL/
|
||||
;
|
||||
; Software distributed under the License is distributed on an "AS IS" basis,
|
||||
; WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
; for the specific language governing rights and limitations under the
|
||||
; License.
|
||||
;
|
||||
; The Original Code is Mozilla.
|
||||
;
|
||||
; The Initial Developer of the Original Code is
|
||||
; Netscape Communications Corp.
|
||||
; Portions created by the Initial Developer are Copyright (C) 2001
|
||||
; the Initial Developer. All Rights Reserved.
|
||||
;
|
||||
; Contributor(s): Krishna Mohan Khandrika (kkhandrika@netscape.com)
|
||||
;
|
||||
; Alternatively, the contents of this file may be used under the terms of
|
||||
; either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
; the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
; in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
; of those above. If you wish to allow use of your version of this file only
|
||||
; under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
; use your version of this file under the terms of the MPL, indicate your
|
||||
; decision by deleting the provisions above and replace them with the notice
|
||||
; and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
; the provisions above, a recipient may use your version of this file under
|
||||
; the terms of any one of the MPL, the GPL or the LGPL.
|
||||
;
|
||||
; ***** END LICENSE BLOCK *****
|
||||
|
||||
LIBRARY MapiProxy.dll
|
||||
DESCRIPTION 'Proxy/Stub DLL'
|
||||
|
||||
EXPORTS
|
||||
DllGetClassObject @1 PRIVATE
|
||||
DllCanUnloadNow @2 PRIVATE
|
||||
GetProxyDllInfo @3 PRIVATE
|
||||
DllRegisterServer @4 PRIVATE
|
||||
DllUnregisterServer @5 PRIVATE
|
||||
|
||||
|
||||
68
mozilla/mailnews/mapi/mapihook/build/makefile.win
Normal file
@@ -0,0 +1,68 @@
|
||||
# ***** BEGIN LICENSE BLOCK *****
|
||||
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
#
|
||||
# The contents of this file are subject to the Mozilla Public License Version
|
||||
# 1.1 (the "License"); you may not use this file except in compliance with
|
||||
# the License. You may obtain a copy of the License at
|
||||
# http://www.mozilla.org/MPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
# for the specific language governing rights and limitations under the
|
||||
# License.
|
||||
#
|
||||
# The Original Code is Mozilla.
|
||||
#
|
||||
# The Initial Developer of the Original Code is
|
||||
# Netscape Communications Corp.
|
||||
# Portions created by the Initial Developer are Copyright (C) 2001
|
||||
# the Initial Developer. All Rights Reserved.
|
||||
#
|
||||
# Contributor(s): Krishna Mohan Khandrika (kkhandrika@netscape.com)
|
||||
#
|
||||
# Alternatively, the contents of this file may be used under the terms of
|
||||
# either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
# in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
# of those above. If you wish to allow use of your version of this file only
|
||||
# under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
# use your version of this file under the terms of the MPL, indicate your
|
||||
# decision by deleting the provisions above and replace them with the notice
|
||||
# and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
# the provisions above, a recipient may use your version of this file under
|
||||
# the terms of any one of the MPL, the GPL or the LGPL.
|
||||
#
|
||||
# ***** END LICENSE BLOCK *****
|
||||
|
||||
DEPTH=..\..\..\..
|
||||
|
||||
MODULE = MapiProxy
|
||||
EXPORT_LIBRARY = $(MODULE)
|
||||
LIBRARY_NAME = $(MODULE)
|
||||
DEFFILE = MapiProxy.def
|
||||
|
||||
include <$(DEPTH)\config\config.mak>
|
||||
|
||||
##################################################################
|
||||
|
||||
LCFLAGS=-DREGISTER_PROXY_DLL -DUNICODE -D_UNICODE
|
||||
|
||||
OBJS= .\$(OBJDIR)\dlldata.obj \
|
||||
.\$(OBJDIR)\msgMapi_p.obj \
|
||||
.\$(OBJDIR)\msgMapi_i.obj \
|
||||
$(NULL)
|
||||
|
||||
WIN_LIBS= rpcrt4.lib
|
||||
|
||||
EXPORTS= msgMapi.h \
|
||||
$(NULL)
|
||||
|
||||
include <$(DEPTH)\config\rules.mak>
|
||||
|
||||
msgMapi.h msgMapi_p.c msgMapi_i.c dlldata.c : msgMapi.idl
|
||||
midl $(UNICODE_FLAGS) msgMapi.idl
|
||||
|
||||
clobber::
|
||||
rm -f dlldata.c msgMapi_i.c msgMapi_p.c msgMapi.h
|
||||
|
||||
|
||||
114
mozilla/mailnews/mapi/mapihook/build/msgMapi.idl
Normal file
@@ -0,0 +1,114 @@
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is Mozilla
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corp.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2001
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s): Krishna Mohan Khandrika (kkhandrika@netscape.com)
|
||||
* Contributor(s): Rajiv Dayal (rdayal@netscape.com)
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
// This idl will be compiled by MIDL. MS-COM is used
|
||||
// as brdige between MAPI clients and the Mozilla.
|
||||
|
||||
import "unknwn.idl";
|
||||
|
||||
typedef wchar_t LOGIN_PW_TYPE[256];
|
||||
|
||||
typedef struct
|
||||
{
|
||||
unsigned long ulReserved;
|
||||
unsigned long flFlags; /* Flags */
|
||||
unsigned long nPosition_NotUsed; /* character in text to be replaced by attachment */
|
||||
LPTSTR lpszPathName; /* Full path name including file name */
|
||||
LPTSTR lpszFileName; /* Real (original) file name */
|
||||
unsigned char * lpFileType_NotUsed ;
|
||||
} nsMapiFileDesc, * lpnsMapiFileDesc;
|
||||
|
||||
|
||||
typedef struct
|
||||
{
|
||||
unsigned long ulReserved;
|
||||
unsigned long ulRecipClass; /* MAPI_TO, MAPI_CC, MAPI_BCC, MAPI_ORIG */
|
||||
LPTSTR lpszName; /* Recipient name to display */
|
||||
LPTSTR lpszAddress; /* Recipient email address */
|
||||
unsigned long ulEIDSize_NotUsed;
|
||||
unsigned char * lpEntryID_NotUsed ;
|
||||
} nsMapiRecipDesc, * lpnsMapiRecipDesc;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
unsigned long ulReserved;
|
||||
LPTSTR lpszSubject; /* Message Subject */
|
||||
LPTSTR lpszNoteText; /* Message Text */
|
||||
LPTSTR lpszMessageType_NotUsed;
|
||||
LPTSTR lpszDateReceived_notUsed; /* in YYYY/MM/DD HH:MM format */
|
||||
LPTSTR lpszConversationID_NotUsed; /* conversation thread ID */
|
||||
unsigned long flFlags; /* unread,return receipt */
|
||||
lpnsMapiRecipDesc lpOriginator; /* Originator descriptor */
|
||||
unsigned long nRecipCount; /* Number of recipients */
|
||||
lpnsMapiRecipDesc lpRecips; /* Recipient descriptors */
|
||||
unsigned long nFileCount; /* # of file attachments */
|
||||
lpnsMapiFileDesc lpFiles; /* Attachment descriptors */
|
||||
} nsMapiMessage, * lpnsMapiMessage;
|
||||
|
||||
|
||||
[
|
||||
object,
|
||||
uuid(6EDCD38E-8861-11d5-A3DD-00B0D0F3BAA7),
|
||||
helpstring("nsIMapi Inteface"),
|
||||
pointer_default(unique)
|
||||
]
|
||||
|
||||
interface nsIMapi : IUnknown
|
||||
{
|
||||
HRESULT Login(unsigned long aUIArg, LOGIN_PW_TYPE aLogin,
|
||||
LOGIN_PW_TYPE aPassWord, unsigned long aFlags,
|
||||
[out] unsigned long *aSessionId);
|
||||
|
||||
HRESULT Initialize();
|
||||
HRESULT IsValid();
|
||||
HRESULT IsValidSession([in] unsigned long aSession);
|
||||
|
||||
HRESULT SendMail([in] unsigned long aSession, [in] lpnsMapiMessage aMessage,
|
||||
[in] short aRecipCount, [in, size_is(aRecipCount)] lpnsMapiRecipDesc aRecips,
|
||||
[in] short aFileCount, [in, size_is(aFileCount)] lpnsMapiFileDesc aFiles,
|
||||
[in] unsigned long aFlags, [in] unsigned long aReserved) ;
|
||||
|
||||
HRESULT SendDocuments( [in] unsigned long aSession,
|
||||
[in] LPTSTR aDelimChar, [in] LPTSTR aFilePaths,
|
||||
[in] LPTSTR aFileNames, [in] ULONG aFlags ) ;
|
||||
|
||||
HRESULT Logoff (unsigned long aSession);
|
||||
HRESULT CleanUp();
|
||||
};
|
||||
|
||||
|
||||
|
||||
41
mozilla/mailnews/mapi/mapihook/makefile.win
Normal file
@@ -0,0 +1,41 @@
|
||||
# ***** BEGIN LICENSE BLOCK *****
|
||||
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
#
|
||||
# The contents of this file are subject to the Mozilla Public License Version
|
||||
# 1.1 (the "License"); you may not use this file except in compliance with
|
||||
# the License. You may obtain a copy of the License at
|
||||
# http://www.mozilla.org/MPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
# for the specific language governing rights and limitations under the
|
||||
# License.
|
||||
#
|
||||
# The Original Code is Mozilla.
|
||||
#
|
||||
# The Initial Developer of the Original Code is
|
||||
# Netscape Communications Corp.
|
||||
# Portions created by the Initial Developer are Copyright (C) 2001
|
||||
# the Initial Developer. All Rights Reserved.
|
||||
#
|
||||
# Contributor(s): Srilatha Moturi (srilatha@netscape.com)
|
||||
#
|
||||
# Alternatively, the contents of this file may be used under the terms of
|
||||
# either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
# in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
# of those above. If you wish to allow use of your version of this file only
|
||||
# under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
# use your version of this file under the terms of the MPL, indicate your
|
||||
# decision by deleting the provisions above and replace them with the notice
|
||||
# and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
# the provisions above, a recipient may use your version of this file under
|
||||
# the terms of any one of the MPL, the GPL or the LGPL.
|
||||
#
|
||||
# ***** END LICENSE BLOCK *****
|
||||
|
||||
DEPTH=..\..\..
|
||||
|
||||
DIRS= build public src
|
||||
|
||||
include <$(DEPTH)\config\rules.mak>
|
||||
49
mozilla/mailnews/mapi/mapihook/public/makefile.win
Normal file
@@ -0,0 +1,49 @@
|
||||
# ***** BEGIN LICENSE BLOCK *****
|
||||
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
#
|
||||
# The contents of this file are subject to the Mozilla Public License Version
|
||||
# 1.1 (the "License"); you may not use this file except in compliance with
|
||||
# the License. You may obtain a copy of the License at
|
||||
# http://www.mozilla.org/MPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
# for the specific language governing rights and limitations under the
|
||||
# License.
|
||||
#
|
||||
# The Original Code is mozilla.org code.
|
||||
#
|
||||
# The Initial Developer of the Original Code is
|
||||
# Netscape Communications Corporation.
|
||||
# Portions created by the Initial Developer are Copyright (C) 2001
|
||||
# the Initial Developer. All Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
# Srilatha Moturi <srilatha@netscape.com>
|
||||
#
|
||||
# Alternatively, the contents of this file may be used under the terms of
|
||||
# either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
# in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
# of those above. If you wish to allow use of your version of this file only
|
||||
# under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
# use your version of this file under the terms of the MPL, indicate your
|
||||
# decision by deleting the provisions above and replace them with the notice
|
||||
# and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
# the provisions above, a recipient may use your version of this file under
|
||||
# the terms of any one of the MPL, the GPL or the LGPL.
|
||||
#
|
||||
# ***** END LICENSE BLOCK *****
|
||||
|
||||
DEPTH=..\..\..\..
|
||||
|
||||
MODULE=msgMapi
|
||||
XPIDL_MODULE=mapihook
|
||||
|
||||
XPIDLSRCS = \
|
||||
.\nsIMapiRegistry.idl \
|
||||
.\nsIMapiSupport.idl \
|
||||
$(NULL)
|
||||
|
||||
include <$(DEPTH)\config\rules.mak>
|
||||
|
||||
70
mozilla/mailnews/mapi/mapihook/public/nsIMapiRegistry.idl
Normal file
@@ -0,0 +1,70 @@
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2001
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Srilatha Moturi <srilatha@netscape.com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsISupports.idl"
|
||||
|
||||
interface nsIDOMWindow;
|
||||
|
||||
/**
|
||||
* This interface provides support for registering Mozilla as the default
|
||||
* Mail Client. This interface can also be used to get/set the user preference
|
||||
* for the default Mail Client.
|
||||
*
|
||||
*/
|
||||
[scriptable, uuid(c5be14ba-4e0a-4eec-a1b8-04363761d63c)]
|
||||
interface nsIMapiRegistry: nsISupports {
|
||||
|
||||
/** This is set to TRUE if Mozilla is the default Application
|
||||
*/
|
||||
attribute boolean isDefaultMailClient;
|
||||
|
||||
/** This is set TRUE only once per session.
|
||||
*/
|
||||
readonly attribute boolean showDialog;
|
||||
|
||||
/** This will bring the dialog asking the user if he/she wants to set
|
||||
* Mozilla as default Mail Client.
|
||||
* Call this only if Mozilla is not the default Mail client
|
||||
*/
|
||||
void showMailIntegrationDialog(in nsIDOMWindow parentWindow);
|
||||
|
||||
};
|
||||
|
||||
%{C++
|
||||
#define NS_IMAPIREGISTRY_CONTRACTID "@mozilla.org/mapiregistry;1"
|
||||
#define NS_IMAPIREGISTRY_CLASSNAME "Mozilla MAPI Registry"
|
||||
%}
|
||||
64
mozilla/mailnews/mapi/mapihook/public/nsIMapiSupport.idl
Normal file
@@ -0,0 +1,64 @@
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2001
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsISupports.idl"
|
||||
|
||||
/**
|
||||
* This interface provides support for registering Mozilla as a COM component
|
||||
* for extending the use of Mail/News through Simple MAPI.
|
||||
*
|
||||
*/
|
||||
|
||||
[noscript, uuid(8967fed2-c8bb-11d5-a3e9-00b0d0f3baa7)]
|
||||
interface nsIMapiSupport : nsISupports {
|
||||
|
||||
/** Initiates MAPI support
|
||||
*/
|
||||
|
||||
void initializeMAPISupport();
|
||||
|
||||
/** Shuts down the MAPI support
|
||||
*/
|
||||
|
||||
void shutdownMAPISupport();
|
||||
};
|
||||
|
||||
%{C++
|
||||
#define NS_IMAPISUPPORT_CONTRACTID "@mozilla.org/mapisupport;1"
|
||||
#define NS_IMAPISUPPORT_CLASSNAME "Mozilla MAPI Support"
|
||||
%}
|
||||
|
||||
|
||||
323
mozilla/mailnews/mapi/mapihook/src/Registry.cpp
Normal file
@@ -0,0 +1,323 @@
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is Mozilla
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corp.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2001
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s): Krishna Mohan Khandrika <kkhandrika@netscape.com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#undef _UNICODE
|
||||
#undef UNICODE
|
||||
|
||||
#include <objbase.h>
|
||||
#include "nsString.h"
|
||||
#include "Registry.h"
|
||||
|
||||
#define MAPI_PROXY_DLL_NAME "MapiProxy.dll"
|
||||
#define MAPI_STARTUP_ARG " /MAPIStartUp"
|
||||
#define MAX_SIZE 2048
|
||||
|
||||
// Size of a CLSID as a string
|
||||
const int CLSID_STRING_SIZE = 39;
|
||||
|
||||
// Proxy/Stub Dll Routines
|
||||
|
||||
typedef HRESULT (__stdcall ProxyServer)();
|
||||
|
||||
|
||||
// Convert a CLSID to a char string.
|
||||
|
||||
BOOL CLSIDtochar(const CLSID& clsid, char* szCLSID,
|
||||
int length)
|
||||
{
|
||||
LPOLESTR wszCLSID = NULL;
|
||||
|
||||
// Get CLSID
|
||||
HRESULT hr = StringFromCLSID(clsid, &wszCLSID);
|
||||
if (FAILED(hr))
|
||||
return FALSE;
|
||||
|
||||
// Covert from wide characters to non-wide.
|
||||
wcstombs(szCLSID, wszCLSID, length);
|
||||
|
||||
// Free memory.
|
||||
CoTaskMemFree(wszCLSID);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
// Create a key and set its value.
|
||||
|
||||
BOOL setKeyAndValue(nsCAutoString keyName, const char* subKey,
|
||||
const char* theValue)
|
||||
{
|
||||
HKEY hKey;
|
||||
BOOL retValue = TRUE;
|
||||
|
||||
nsCAutoString theKey(keyName);
|
||||
if (subKey != NULL)
|
||||
{
|
||||
theKey += "\\";
|
||||
theKey += subKey;
|
||||
}
|
||||
|
||||
// Create and open key and subkey.
|
||||
long lResult = RegCreateKeyEx(HKEY_CLASSES_ROOT, theKey.get(),
|
||||
0, NULL, REG_OPTION_NON_VOLATILE,
|
||||
KEY_ALL_ACCESS, NULL, &hKey, NULL);
|
||||
if (lResult != ERROR_SUCCESS)
|
||||
return FALSE ;
|
||||
|
||||
// Set the Value.
|
||||
if (theValue != NULL)
|
||||
{
|
||||
lResult = RegSetValueEx(hKey, NULL, 0, REG_SZ, (BYTE *)theValue,
|
||||
strlen(theValue)+1);
|
||||
if (lResult != ERROR_SUCCESS)
|
||||
retValue = FALSE;
|
||||
}
|
||||
|
||||
RegCloseKey(hKey);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
// Delete a key and all of its descendents.
|
||||
|
||||
LONG recursiveDeleteKey(HKEY hKeyParent, // Parent of key to delete
|
||||
const char* lpszKeyChild) // Key to delete
|
||||
{
|
||||
// Open the child.
|
||||
HKEY hKeyChild ;
|
||||
LONG lRes = RegOpenKeyEx(hKeyParent, lpszKeyChild, 0,
|
||||
KEY_ALL_ACCESS, &hKeyChild) ;
|
||||
if (lRes != ERROR_SUCCESS)
|
||||
{
|
||||
return lRes ;
|
||||
}
|
||||
|
||||
// Enumerate all of the decendents of this child.
|
||||
FILETIME time ;
|
||||
char szBuffer[MAX_SIZE] ;
|
||||
DWORD dwSize = MAX_SIZE ;
|
||||
while (RegEnumKeyEx(hKeyChild, 0, szBuffer, &dwSize, NULL,
|
||||
NULL, NULL, &time) == S_OK)
|
||||
{
|
||||
// Delete the decendents of this child.
|
||||
lRes = recursiveDeleteKey(hKeyChild, szBuffer) ;
|
||||
if (lRes != ERROR_SUCCESS)
|
||||
{
|
||||
// Cleanup before exiting.
|
||||
RegCloseKey(hKeyChild) ;
|
||||
return lRes;
|
||||
}
|
||||
dwSize = MAX_SIZE;
|
||||
}
|
||||
|
||||
// Close the child.
|
||||
RegCloseKey(hKeyChild) ;
|
||||
|
||||
// Delete this child.
|
||||
return RegDeleteKey(hKeyParent, lpszKeyChild) ;
|
||||
}
|
||||
|
||||
void RegisterProxy()
|
||||
{
|
||||
HINSTANCE h = NULL;
|
||||
ProxyServer *RegisterFunc = NULL;
|
||||
|
||||
char szModule[MAX_SIZE];
|
||||
char *pTemp = NULL;
|
||||
|
||||
HMODULE hModule = GetModuleHandle(NULL);
|
||||
DWORD dwResult = ::GetModuleFileName(hModule, szModule,
|
||||
sizeof(szModule)/sizeof(char));
|
||||
if (dwResult == 0)
|
||||
return;
|
||||
|
||||
pTemp = strrchr(szModule, '\\');
|
||||
if (pTemp == NULL)
|
||||
return;
|
||||
|
||||
*pTemp = '\0';
|
||||
nsCAutoString proxyPath(szModule);
|
||||
|
||||
proxyPath += "\\";
|
||||
proxyPath += MAPI_PROXY_DLL_NAME;
|
||||
|
||||
h = LoadLibrary(proxyPath.get());
|
||||
if (h == NULL)
|
||||
return;
|
||||
|
||||
RegisterFunc = (ProxyServer *) GetProcAddress(h, "DllRegisterServer");
|
||||
if (RegisterFunc)
|
||||
RegisterFunc();
|
||||
|
||||
FreeLibrary(h);
|
||||
}
|
||||
|
||||
void UnRegisterProxy()
|
||||
{
|
||||
HINSTANCE h = NULL;
|
||||
ProxyServer *UnRegisterFunc = NULL;
|
||||
|
||||
char szModule[MAX_SIZE];
|
||||
char *pTemp = NULL;
|
||||
|
||||
HMODULE hModule = GetModuleHandle(NULL);
|
||||
DWORD dwResult = ::GetModuleFileName(hModule, szModule,
|
||||
sizeof(szModule)/sizeof(char));
|
||||
if (dwResult == 0)
|
||||
return;
|
||||
|
||||
pTemp = strrchr(szModule, '\\');
|
||||
if (pTemp == NULL)
|
||||
return;
|
||||
|
||||
*pTemp = '\0';
|
||||
nsCAutoString proxyPath(szModule);
|
||||
|
||||
proxyPath += "\\";
|
||||
proxyPath += MAPI_PROXY_DLL_NAME;
|
||||
|
||||
h = LoadLibrary(proxyPath.get());
|
||||
if (h == NULL)
|
||||
return;
|
||||
|
||||
UnRegisterFunc = (ProxyServer *) GetProcAddress(h, "DllUnregisterServer");
|
||||
if (UnRegisterFunc)
|
||||
UnRegisterFunc();
|
||||
|
||||
FreeLibrary(h);
|
||||
}
|
||||
|
||||
// Register the component in the registry.
|
||||
|
||||
HRESULT RegisterServer(const CLSID& clsid, // Class ID
|
||||
const char* szFriendlyName, // Friendly Name
|
||||
const char* szVerIndProgID, // Programmatic
|
||||
const char* szProgID) // IDs
|
||||
{
|
||||
HMODULE hModule = GetModuleHandle(NULL);
|
||||
char szModuleName[MAX_SIZE];
|
||||
char szCLSID[CLSID_STRING_SIZE];
|
||||
|
||||
nsCAutoString independentProgId(szVerIndProgID);
|
||||
nsCAutoString progId(szProgID);
|
||||
|
||||
DWORD dwResult = ::GetModuleFileName(hModule, szModuleName,
|
||||
sizeof(szModuleName)/sizeof(char));
|
||||
|
||||
if (dwResult == 0)
|
||||
return S_FALSE;
|
||||
|
||||
nsCAutoString moduleName(szModuleName);
|
||||
nsCAutoString registryKey("CLSID\\");
|
||||
|
||||
moduleName += MAPI_STARTUP_ARG;
|
||||
|
||||
// Convert the CLSID into a char.
|
||||
|
||||
if (!CLSIDtochar(clsid, szCLSID, sizeof(szCLSID)))
|
||||
return S_FALSE;
|
||||
registryKey += szCLSID;
|
||||
|
||||
// Add the CLSID to the registry.
|
||||
if (!setKeyAndValue(registryKey, NULL, szFriendlyName))
|
||||
return S_FALSE;
|
||||
|
||||
if (!setKeyAndValue(registryKey, "LocalServer32", moduleName.get()))
|
||||
return S_FALSE;
|
||||
|
||||
// Add the ProgID subkey under the CLSID key.
|
||||
if (!setKeyAndValue(registryKey, "ProgID", szProgID))
|
||||
return S_FALSE;
|
||||
|
||||
// Add the version-independent ProgID subkey under CLSID key.
|
||||
if (!setKeyAndValue(registryKey, "VersionIndependentProgID", szVerIndProgID))
|
||||
return S_FALSE;
|
||||
|
||||
// Add the version-independent ProgID subkey under HKEY_CLASSES_ROOT.
|
||||
if (!setKeyAndValue(independentProgId, NULL, szFriendlyName))
|
||||
return S_FALSE;
|
||||
if (!setKeyAndValue(independentProgId, "CLSID", szCLSID))
|
||||
return S_FALSE;
|
||||
if (!setKeyAndValue(independentProgId, "CurVer", szProgID))
|
||||
return S_FALSE;
|
||||
|
||||
// Add the versioned ProgID subkey under HKEY_CLASSES_ROOT.
|
||||
if (!setKeyAndValue(progId, NULL, szFriendlyName))
|
||||
return S_FALSE;
|
||||
if (!setKeyAndValue(progId, "CLSID", szCLSID))
|
||||
return S_FALSE;
|
||||
|
||||
RegisterProxy();
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
LONG UnregisterServer(const CLSID& clsid, // Class ID
|
||||
const char* szVerIndProgID, // Programmatic
|
||||
const char* szProgID) // IDs
|
||||
{
|
||||
LONG lResult = S_OK;
|
||||
|
||||
// Convert the CLSID into a char.
|
||||
|
||||
char szCLSID[CLSID_STRING_SIZE];
|
||||
if (!CLSIDtochar(clsid, szCLSID, sizeof(szCLSID)))
|
||||
return S_FALSE;
|
||||
|
||||
UnRegisterProxy();
|
||||
|
||||
nsCAutoString registryKey("CLSID\\");
|
||||
registryKey += szCLSID;
|
||||
|
||||
lResult = recursiveDeleteKey(HKEY_CLASSES_ROOT, registryKey.get());
|
||||
if (lResult == ERROR_SUCCESS || lResult == ERROR_FILE_NOT_FOUND)
|
||||
return lResult;
|
||||
|
||||
registryKey += "\\LocalServer32";
|
||||
|
||||
// Delete only the path for this server.
|
||||
|
||||
lResult = recursiveDeleteKey(HKEY_CLASSES_ROOT, registryKey.get());
|
||||
if (lResult != ERROR_SUCCESS && lResult != ERROR_FILE_NOT_FOUND)
|
||||
return lResult;
|
||||
|
||||
// Delete the version-independent ProgID Key.
|
||||
lResult = recursiveDeleteKey(HKEY_CLASSES_ROOT, szVerIndProgID);
|
||||
if (lResult != ERROR_SUCCESS && lResult != ERROR_FILE_NOT_FOUND)
|
||||
return lResult;
|
||||
|
||||
lResult = recursiveDeleteKey(HKEY_CLASSES_ROOT, szProgID);
|
||||
|
||||
return lResult;
|
||||
}
|
||||
56
mozilla/mailnews/mapi/mapihook/src/Registry.h
Normal file
@@ -0,0 +1,56 @@
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2001
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Krishna Mohan Khandrika <kkhandrika@netscape.com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef _REGISTRY_H_
|
||||
#define _REGISTRY_H_
|
||||
|
||||
#include <objbase.h>
|
||||
|
||||
// This function will register a component in the Registry.
|
||||
|
||||
HRESULT RegisterServer(const CLSID& clsid,
|
||||
const char* szFriendlyName,
|
||||
const char* szVerIndProgID,
|
||||
const char* szProgID) ;
|
||||
|
||||
// This function will unregister a component.
|
||||
|
||||
HRESULT UnregisterServer(const CLSID& clsid,
|
||||
const char* szVerIndProgID,
|
||||
const char* szProgID) ;
|
||||
|
||||
#endif
|
||||
107
mozilla/mailnews/mapi/mapihook/src/makefile.win
Normal file
@@ -0,0 +1,107 @@
|
||||
# ***** BEGIN LICENSE BLOCK *****
|
||||
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
#
|
||||
# The contents of this file are subject to the Mozilla Public License Version
|
||||
# 1.1 (the "License"); you may not use this file except in compliance with
|
||||
# the License. You may obtain a copy of the License at
|
||||
# http://www.mozilla.org/MPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
# for the specific language governing rights and limitations under the
|
||||
# License.
|
||||
#
|
||||
# The Original Code is mozilla.org code.
|
||||
#
|
||||
# The Initial Developer of the Original Code is
|
||||
# Netscape Communications Corporation.
|
||||
# Portions created by the Initial Developer are Copyright (C) 2001
|
||||
# the Initial Developer. All Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
# Srilatha Moturi <srilatha@netscape.com>
|
||||
#
|
||||
# Alternatively, the contents of this file may be used under the terms of
|
||||
# either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
# in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
# of those above. If you wish to allow use of your version of this file only
|
||||
# under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
# use your version of this file under the terms of the MPL, indicate your
|
||||
# decision by deleting the provisions above and replace them with the notice
|
||||
# and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
# the provisions above, a recipient may use your version of this file under
|
||||
# the terms of any one of the MPL, the GPL or the LGPL.
|
||||
#
|
||||
# ***** END LICENSE BLOCK *****
|
||||
|
||||
DEPTH=..\..\..\..
|
||||
|
||||
MODULE = msgMapi
|
||||
MAKE_OBJ_TYPE = DLL
|
||||
LIBRARY_NAME=$(MODULE)
|
||||
MODULE_NAME = $(MODULE)
|
||||
|
||||
REQUIRES = xpcom \
|
||||
string \
|
||||
MapiProxy \
|
||||
appshell \
|
||||
windowwatcher \
|
||||
dom \
|
||||
profile \
|
||||
msgbase \
|
||||
pref \
|
||||
msgbaseutil \
|
||||
msgcompo \
|
||||
mailnews \
|
||||
necko \
|
||||
intl \
|
||||
editor \
|
||||
msgdb \
|
||||
uriloader \
|
||||
appstartup \
|
||||
$(NULL)
|
||||
|
||||
include <$(DEPTH)\config\config.mak>
|
||||
############################################################################
|
||||
|
||||
LCFLAGS=-DUNICODE -D_UNICODE
|
||||
|
||||
|
||||
|
||||
OBJS= \
|
||||
..\build\$(OBJDIR)\msgMapi_i.obj \
|
||||
.\$(OBJDIR)\msgMapiFactory.obj \
|
||||
.\$(OBJDIR)\msgMapiHook.obj \
|
||||
.\$(OBJDIR)\msgMapiImp.obj \
|
||||
.\$(OBJDIR)\msgMapiMain.obj \
|
||||
.\$(OBJDIR)\msgMapiSupport.obj \
|
||||
.\$(OBJDIR)\nsMapiRegistry.obj \
|
||||
.\$(OBJDIR)\nsMapiRegistryUtils.obj \
|
||||
.\$(OBJDIR)\Registry.obj \
|
||||
$(NULL)
|
||||
|
||||
|
||||
|
||||
LLIBS= \
|
||||
$(DIST)\lib\xpcom.lib \
|
||||
$(DIST)\lib\msgbsutl.lib \
|
||||
$(LIBNSPR) \
|
||||
$(NULL)
|
||||
|
||||
WIN_LIBS= \
|
||||
ole32.lib \
|
||||
$(NULL)
|
||||
|
||||
EXPORTS= \
|
||||
msgMapiFactory.h \
|
||||
msgMapiHook.h \
|
||||
msgMapiImp.h \
|
||||
msgMapiMain.h \
|
||||
msgMapiSupport.h \
|
||||
nsMapiRegistry.h \
|
||||
nsMapiRegistryUtils.h \
|
||||
Registry.h \
|
||||
$(NULL)
|
||||
|
||||
include <$(DEPTH)\config\rules.mak>
|
||||
118
mozilla/mailnews/mapi/mapihook/src/msgMapiFactory.cpp
Normal file
@@ -0,0 +1,118 @@
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is Mozilla
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corp.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2001
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s): Krishna Mohan Khandrika (kkhandrika@netscape.com)
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#undef UNICODE
|
||||
#undef _UNICODE
|
||||
|
||||
#include "msgMapiFactory.h"
|
||||
#include "msgMapiImp.h"
|
||||
#include "msgMapi.h"
|
||||
|
||||
CMapiFactory ::CMapiFactory()
|
||||
: m_cRef(1)
|
||||
{
|
||||
}
|
||||
|
||||
CMapiFactory::~CMapiFactory()
|
||||
{
|
||||
}
|
||||
|
||||
STDMETHODIMP CMapiFactory::QueryInterface(const IID& aIid, void** aPpv)
|
||||
{
|
||||
if ((aIid == IID_IUnknown) || (aIid == IID_IClassFactory))
|
||||
{
|
||||
*aPpv = static_cast<IClassFactory*>(this);
|
||||
}
|
||||
else
|
||||
{
|
||||
*aPpv = nsnull;
|
||||
return E_NOINTERFACE;
|
||||
}
|
||||
reinterpret_cast<IUnknown*>(*aPpv)->AddRef();
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP_(ULONG) CMapiFactory::AddRef()
|
||||
{
|
||||
return (PR_AtomicIncrement(&m_cRef));
|
||||
}
|
||||
|
||||
STDMETHODIMP_(ULONG) CMapiFactory::Release()
|
||||
{
|
||||
PRInt32 temp;
|
||||
temp = PR_AtomicDecrement(&m_cRef);
|
||||
if (m_cRef == 0)
|
||||
{
|
||||
delete this;
|
||||
return 0;
|
||||
}
|
||||
|
||||
return temp;
|
||||
}
|
||||
|
||||
STDMETHODIMP CMapiFactory::CreateInstance(IUnknown* aUnknownOuter,
|
||||
const IID& aIid,
|
||||
void** aPpv)
|
||||
{
|
||||
// Cannot aggregate.
|
||||
|
||||
if (aUnknownOuter != nsnull)
|
||||
{
|
||||
return CLASS_E_NOAGGREGATION ;
|
||||
}
|
||||
|
||||
// Create component.
|
||||
|
||||
CMapiImp* pImp = new CMapiImp();
|
||||
if (pImp == nsnull)
|
||||
{
|
||||
return E_OUTOFMEMORY ;
|
||||
}
|
||||
|
||||
// Get the requested interface.
|
||||
HRESULT hr = pImp->QueryInterface(aIid, aPpv);
|
||||
|
||||
// Release the IUnknown pointer.
|
||||
// (If QueryInterface failed, component will delete itself.)
|
||||
|
||||
pImp->Release();
|
||||
return hr;
|
||||
}
|
||||
|
||||
STDMETHODIMP CMapiFactory::LockServer(PRBool aLock)
|
||||
{
|
||||
return S_OK ;
|
||||
}
|
||||
69
mozilla/mailnews/mapi/mapihook/src/msgMapiFactory.h
Normal file
@@ -0,0 +1,69 @@
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is Mozilla
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corp.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2001
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s): Krishna Mohan Khandrika (kkhandrika@netscape.com)
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef MSG_MAPI_FACTORY_H
|
||||
#define MSG_MAPI_FACTORY_H
|
||||
|
||||
#include <windows.h>
|
||||
#include <objbase.h>
|
||||
#include "nspr.h"
|
||||
|
||||
|
||||
class CMapiFactory : public IClassFactory
|
||||
{
|
||||
public :
|
||||
|
||||
// IUnknown
|
||||
|
||||
STDMETHODIMP QueryInterface (REFIID aIid, void** aPpv);
|
||||
STDMETHODIMP_(ULONG) AddRef(void);
|
||||
STDMETHODIMP_(ULONG) Release(void);
|
||||
|
||||
// IClassFactory
|
||||
|
||||
STDMETHODIMP CreateInstance (LPUNKNOWN aUnkOuter, REFIID aIid, void **aPpv);
|
||||
STDMETHODIMP LockServer (BOOL aLock);
|
||||
|
||||
CMapiFactory ();
|
||||
~CMapiFactory ();
|
||||
|
||||
private :
|
||||
|
||||
PRInt32 m_cRef;
|
||||
};
|
||||
|
||||
#endif // MSG_MAPI_FACTORY_H
|
||||
|
||||
777
mozilla/mailnews/mapi/mapihook/src/msgMapiHook.cpp
Normal file
@@ -0,0 +1,777 @@
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is Mozilla
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corp.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2001
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s): Krishna Mohan Khandrika (kkhandrika@netscape.com)
|
||||
* Contributor(s): Srilatha Moturi (srilatha@netscape.com)
|
||||
* Contributor(s): Rajiv Dayal (rdayal@netscape.com)
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#define MAPI_STARTUP_ARG "/MAPIStartUp"
|
||||
|
||||
#define MAPI_STARTUP_ARG "/MAPIStartUp"
|
||||
|
||||
#include <mapidefs.h>
|
||||
#include <mapi.h>
|
||||
#include <tchar.h>
|
||||
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIComponentManager.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsISupports.h"
|
||||
#include "nsIPromptService.h"
|
||||
#include "nsAppShellCIDs.h"
|
||||
#include "nsIDOMWindowInternal.h"
|
||||
#include "nsIAppShellService.h"
|
||||
#include "nsINativeAppSupport.h"
|
||||
#include "nsICmdLineService.h"
|
||||
#include "nsIProfileInternal.h"
|
||||
#include "nsIMsgAccountManager.h"
|
||||
#include "nsIDOMWindowInternal.h"
|
||||
#include "nsXPIDLString.h"
|
||||
#include "nsReadableUtils.h"
|
||||
#include "nsMsgBaseCID.h"
|
||||
#include "nsIStringBundle.h"
|
||||
#include "nsIPref.h"
|
||||
#include "nsString.h"
|
||||
|
||||
#include "nsIMsgAttachment.h"
|
||||
#include "nsIMsgCompFields.h"
|
||||
#include "nsIMsgComposeParams.h"
|
||||
#include "nsIMsgCompose.h"
|
||||
#include "nsMsgCompCID.h"
|
||||
#include "nsIMsgSend.h"
|
||||
#include "nsIProxyObjectManager.h"
|
||||
#include "nsIMsgComposeService.h"
|
||||
#include "nsProxiedService.h"
|
||||
#include "nsSpecialSystemDirectory.h"
|
||||
#include "nsMsgI18N.h"
|
||||
|
||||
#include "msgMapi.h"
|
||||
#include "msgMapiHook.h"
|
||||
#include "msgMapiSupport.h"
|
||||
#include "msgMapiMain.h"
|
||||
#include "nsNetUtil.h"
|
||||
|
||||
static NS_DEFINE_CID(kCmdLineServiceCID, NS_COMMANDLINE_SERVICE_CID);
|
||||
|
||||
class nsMAPISendListener : public nsIMsgSendListener
|
||||
{
|
||||
public:
|
||||
|
||||
virtual ~nsMAPISendListener() { }
|
||||
|
||||
// nsISupports interface
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
/* void OnStartSending (in string aMsgID, in PRUint32 aMsgSize); */
|
||||
NS_IMETHOD OnStartSending(const char *aMsgID, PRUint32 aMsgSize) { return NS_OK; }
|
||||
|
||||
/* void OnProgress (in string aMsgID, in PRUint32 aProgress, in PRUint32 aProgressMax); */
|
||||
NS_IMETHOD OnProgress(const char *aMsgID, PRUint32 aProgress, PRUint32 aProgressMax) { return NS_OK;}
|
||||
|
||||
/* void OnStatus (in string aMsgID, in wstring aMsg); */
|
||||
NS_IMETHOD OnStatus(const char *aMsgID, const PRUnichar *aMsg) { return NS_OK;}
|
||||
|
||||
/* void OnStopSending (in string aMsgID, in nsresult aStatus, in wstring aMsg, in nsIFileSpec returnFileSpec); */
|
||||
NS_IMETHOD OnStopSending(const char *aMsgID, nsresult aStatus, const PRUnichar *aMsg,
|
||||
nsIFileSpec *returnFileSpec) {
|
||||
m_done = PR_TRUE;
|
||||
HANDLE hEvent = CreateEvent (NULL, FALSE, FALSE, (LPCTSTR) MAPI_SENDCOMPLETE_EVENT) ;
|
||||
SetEvent (hEvent) ;
|
||||
CloseHandle (hEvent) ;
|
||||
return NS_OK ;
|
||||
}
|
||||
|
||||
/* void OnSendNotPerformed */
|
||||
NS_IMETHOD OnSendNotPerformed(const char *aMsgID, nsresult aStatus)
|
||||
{
|
||||
return OnStopSending(aMsgID, aStatus, nsnull, nsnull) ;
|
||||
}
|
||||
|
||||
/* void OnGetDraftFolderURI (); */
|
||||
NS_IMETHOD OnGetDraftFolderURI(const char *aFolderURI) {return NS_OK;}
|
||||
|
||||
static nsresult CreateMAPISendListener( nsIMsgSendListener **ppListener);
|
||||
|
||||
PRBool IsDone() { return m_done ; }
|
||||
|
||||
protected :
|
||||
nsMAPISendListener() {
|
||||
NS_INIT_REFCNT();
|
||||
m_done = PR_FALSE;
|
||||
}
|
||||
|
||||
PRBool m_done;
|
||||
};
|
||||
|
||||
|
||||
NS_IMPL_THREADSAFE_ISUPPORTS1(nsMAPISendListener, nsIMsgSendListener)
|
||||
|
||||
nsresult nsMAPISendListener::CreateMAPISendListener( nsIMsgSendListener **ppListener)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(ppListener) ;
|
||||
|
||||
*ppListener = new nsMAPISendListener();
|
||||
if (! *ppListener)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
NS_ADDREF(*ppListener);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
PRBool nsMapiHook::isMapiService = PR_FALSE;
|
||||
|
||||
PRBool nsMapiHook::Initialize()
|
||||
{
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsINativeAppSupport> native;
|
||||
|
||||
nsCOMPtr<nsICmdLineService> cmdLineArgs(do_GetService(kCmdLineServiceCID, &rv));
|
||||
if (NS_FAILED(rv)) return PR_FALSE;
|
||||
|
||||
nsCOMPtr<nsIAppShellService> appShell (do_GetService( "@mozilla.org/appshell/appShellService;1", &rv));
|
||||
if (NS_FAILED(rv)) return PR_FALSE;
|
||||
|
||||
rv = appShell->GetNativeAppSupport( getter_AddRefs( native ));
|
||||
if (NS_FAILED(rv)) return PR_FALSE;
|
||||
|
||||
rv = native->EnsureProfile(cmdLineArgs);
|
||||
if (NS_FAILED(rv)) return PR_FALSE;
|
||||
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
void nsMapiHook::CleanUp()
|
||||
{
|
||||
// This routine will be fully implemented in future
|
||||
// to cleanup mapi related stuff inside mozilla code.
|
||||
}
|
||||
|
||||
PRBool nsMapiHook::DisplayLoginDialog(PRBool aLogin, PRUnichar **aUsername, \
|
||||
PRUnichar **aPassword)
|
||||
{
|
||||
nsresult rv;
|
||||
PRBool btnResult = PR_FALSE;
|
||||
|
||||
nsCOMPtr<nsIAppShellService> appShell(do_GetService( "@mozilla.org/appshell/appShellService;1", &rv));
|
||||
if (NS_FAILED(rv) || !appShell) return PR_FALSE;
|
||||
|
||||
nsCOMPtr<nsIPromptService> dlgService(do_GetService("@mozilla.org/embedcomp/prompt-service;1", &rv));
|
||||
if (NS_SUCCEEDED(rv) && dlgService)
|
||||
{
|
||||
nsCOMPtr<nsIStringBundleService> bundleService(do_GetService(NS_STRINGBUNDLE_CONTRACTID, &rv));
|
||||
if (NS_FAILED(rv) || !bundleService) return PR_FALSE;
|
||||
|
||||
nsCOMPtr<nsIStringBundle> bundle;
|
||||
rv = bundleService->CreateBundle(MAPI_PROPERTIES_CHROME, getter_AddRefs(bundle));
|
||||
if (NS_FAILED(rv) || !bundle) return PR_FALSE;
|
||||
|
||||
nsCOMPtr<nsIStringBundle> brandBundle;
|
||||
rv = bundleService->CreateBundle(
|
||||
"chrome://global/locale/brand.properties",
|
||||
getter_AddRefs(brandBundle));
|
||||
if (NS_FAILED(rv)) return PR_FALSE;
|
||||
|
||||
nsXPIDLString brandName;
|
||||
rv = brandBundle->GetStringFromName(
|
||||
NS_LITERAL_STRING("brandShortName").get(),
|
||||
getter_Copies(brandName));
|
||||
if (NS_FAILED(rv)) return PR_FALSE;
|
||||
|
||||
nsXPIDLString loginTitle;
|
||||
const PRUnichar *brandStrings[] = { brandName.get() };
|
||||
NS_NAMED_LITERAL_STRING(loginTitlePropertyTag, "loginTitle");
|
||||
const PRUnichar *dTitlePropertyTag = loginTitlePropertyTag.get();
|
||||
rv = bundle->FormatStringFromName(dTitlePropertyTag, brandStrings, 1,
|
||||
getter_Copies(loginTitle));
|
||||
if (NS_FAILED(rv)) return PR_FALSE;
|
||||
|
||||
if (aLogin)
|
||||
{
|
||||
nsXPIDLString loginText;
|
||||
rv = bundle->GetStringFromName(NS_LITERAL_STRING("loginTextwithName").get(),
|
||||
getter_Copies(loginText));
|
||||
if (NS_FAILED(rv) || !loginText) return PR_FALSE;
|
||||
|
||||
|
||||
|
||||
rv = dlgService->PromptUsernameAndPassword(nsnull, loginTitle,
|
||||
loginText, aUsername, aPassword,
|
||||
nsnull, PR_FALSE, &btnResult);
|
||||
}
|
||||
else
|
||||
{
|
||||
//nsString loginString;
|
||||
nsXPIDLString loginText;
|
||||
const PRUnichar *userNameStrings[] = { *aUsername };
|
||||
|
||||
NS_NAMED_LITERAL_STRING(loginTextPropertyTag, "loginText");
|
||||
const PRUnichar *dpropertyTag = loginTextPropertyTag.get();
|
||||
rv = bundle->FormatStringFromName(dpropertyTag, userNameStrings, 1,
|
||||
getter_Copies(loginText));
|
||||
if (NS_FAILED(rv)) return PR_FALSE;
|
||||
|
||||
rv = dlgService->PromptPassword(nsnull, loginTitle, loginText,
|
||||
aPassword, nsnull, PR_FALSE, &btnResult);
|
||||
}
|
||||
}
|
||||
|
||||
return btnResult;
|
||||
}
|
||||
|
||||
PRBool nsMapiHook::VerifyUserName(const PRUnichar *aUsername, char **aIdKey)
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
if (aUsername == nsnull)
|
||||
return PR_FALSE;
|
||||
|
||||
nsCOMPtr<nsIMsgAccountManager> accountManager(do_GetService(NS_MSGACCOUNTMANAGER_CONTRACTID, &rv));
|
||||
if (NS_FAILED(rv)) return PR_FALSE;
|
||||
nsCOMPtr<nsISupportsArray> identities;
|
||||
rv = accountManager->GetAllIdentities(getter_AddRefs(identities));
|
||||
if (NS_FAILED(rv)) return PR_FALSE;
|
||||
PRUint32 numIndentities;
|
||||
identities->Count(&numIndentities);
|
||||
|
||||
for (PRUint32 i = 0; i < numIndentities; i++)
|
||||
{
|
||||
// convert supports->Identity
|
||||
nsCOMPtr<nsISupports> thisSupports;
|
||||
rv = identities->GetElementAt(i, getter_AddRefs(thisSupports));
|
||||
if (NS_FAILED(rv)) continue;
|
||||
nsCOMPtr<nsIMsgIdentity> thisIdentity(do_QueryInterface(thisSupports, &rv));
|
||||
if (NS_SUCCEEDED(rv) && thisIdentity)
|
||||
{
|
||||
nsXPIDLCString email;
|
||||
rv = thisIdentity->GetEmail(getter_Copies(email));
|
||||
if (NS_FAILED(rv)) continue;
|
||||
|
||||
// get the username from the email and compare with the username
|
||||
nsCAutoString aEmail(email.get());
|
||||
PRInt32 index = aEmail.FindChar('@');
|
||||
if (index != -1)
|
||||
aEmail.Truncate(index);
|
||||
|
||||
if (nsDependentString(aUsername) == NS_ConvertASCIItoUCS2(aEmail)) // == overloaded
|
||||
return NS_SUCCEEDED(thisIdentity->GetKey(aIdKey));
|
||||
}
|
||||
}
|
||||
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
PRBool
|
||||
nsMapiHook::IsBlindSendAllowed()
|
||||
{
|
||||
PRBool enabled = PR_FALSE;
|
||||
PRBool warn = PR_TRUE;
|
||||
nsCOMPtr<nsIPref> prefs = do_GetService(NS_PREF_CONTRACTID);
|
||||
if (prefs) {
|
||||
prefs->GetBoolPref(PREF_MAPI_WARN_PRIOR_TO_BLIND_SEND,&warn);
|
||||
prefs->GetBoolPref(PREF_MAPI_BLIND_SEND_ENABLED,&enabled);
|
||||
}
|
||||
if (!enabled)
|
||||
return PR_FALSE;
|
||||
|
||||
if (!warn)
|
||||
return PR_TRUE; // Everything is okay.
|
||||
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIStringBundleService> bundleService(do_GetService(NS_STRINGBUNDLE_CONTRACTID, &rv));
|
||||
if (NS_FAILED(rv) || !bundleService) return PR_FALSE;
|
||||
|
||||
nsCOMPtr<nsIStringBundle> bundle;
|
||||
rv = bundleService->CreateBundle(MAPI_PROPERTIES_CHROME, getter_AddRefs(bundle));
|
||||
if (NS_FAILED(rv) || !bundle) return PR_FALSE;
|
||||
|
||||
nsXPIDLString warningMsg;
|
||||
rv = bundle->GetStringFromName(NS_LITERAL_STRING("mapiBlindSendWarning").get(),
|
||||
getter_Copies(warningMsg));
|
||||
if (NS_FAILED(rv)) return PR_FALSE;
|
||||
|
||||
nsXPIDLString dontShowAgainMessage;
|
||||
rv = bundle->GetStringFromName(NS_LITERAL_STRING("mapiBlindSendDontShowAgain").get(),
|
||||
getter_Copies(dontShowAgainMessage));
|
||||
if (NS_FAILED(rv)) return PR_FALSE;
|
||||
|
||||
nsCOMPtr<nsIPromptService> dlgService(do_GetService("@mozilla.org/embedcomp/prompt-service;1", &rv));
|
||||
if (NS_FAILED(rv) || !dlgService) return PR_FALSE;
|
||||
|
||||
PRBool continueToWarn = PR_TRUE;
|
||||
PRBool okayToContinue = PR_FALSE;
|
||||
dlgService->ConfirmCheck(nsnull, nsnull, warningMsg, dontShowAgainMessage, &continueToWarn, &okayToContinue);
|
||||
|
||||
if (!continueToWarn && okayToContinue && prefs)
|
||||
prefs->SetBoolPref(PREF_MAPI_WARN_PRIOR_TO_BLIND_SEND,PR_FALSE);
|
||||
|
||||
return okayToContinue;
|
||||
|
||||
}
|
||||
|
||||
// this is used for Send without UI
|
||||
nsresult nsMapiHook::BlindSendMail (unsigned long aSession, nsIMsgCompFields * aCompFields)
|
||||
{
|
||||
nsresult rv = NS_OK ;
|
||||
|
||||
if (!IsBlindSendAllowed())
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
/** create nsIMsgComposeParams obj and other fields to populate it **/
|
||||
|
||||
// get parent window
|
||||
nsCOMPtr<nsIAppShellService> appService = do_GetService( "@mozilla.org/appshell/appShellService;1", &rv);
|
||||
if (NS_FAILED(rv)|| (!appService) ) return rv ;
|
||||
|
||||
nsCOMPtr<nsIDOMWindowInternal> hiddenWindow;
|
||||
rv = appService->GetHiddenDOMWindow(getter_AddRefs(hiddenWindow));
|
||||
|
||||
if ( NS_FAILED(rv) ) return rv ;
|
||||
|
||||
// smtp password and Logged in used IdKey from MapiConfig (session obj)
|
||||
nsMAPIConfiguration * pMapiConfig = nsMAPIConfiguration::GetMAPIConfiguration() ;
|
||||
if (!pMapiConfig) return NS_ERROR_FAILURE ; // get the singelton obj
|
||||
PRUnichar * password = pMapiConfig->GetPassword(aSession) ;
|
||||
// password
|
||||
nsCAutoString smtpPassword ;
|
||||
smtpPassword.AssignWithConversion (password) ;
|
||||
// Id key
|
||||
char * MsgIdKey = pMapiConfig->GetIdKey(aSession) ;
|
||||
|
||||
// get the MsgIdentity for the above key using AccountManager
|
||||
nsCOMPtr <nsIMsgAccountManager> accountManager = do_GetService (NS_MSGACCOUNTMANAGER_CONTRACTID) ;
|
||||
if (NS_FAILED(rv) || (!accountManager) ) return rv ;
|
||||
|
||||
nsCOMPtr <nsIMsgIdentity> pMsgId ;
|
||||
rv = accountManager->GetIdentity (MsgIdKey, getter_AddRefs(pMsgId)) ;
|
||||
if (NS_FAILED(rv) ) return rv ;
|
||||
|
||||
// create a send listener to get back the send status
|
||||
nsCOMPtr <nsIMsgSendListener> sendListener ;
|
||||
rv = nsMAPISendListener::CreateMAPISendListener(getter_AddRefs(sendListener)) ;
|
||||
if (NS_FAILED(rv) || (!sendListener) ) return rv;
|
||||
|
||||
// create the compose params object
|
||||
nsCOMPtr<nsIMsgComposeParams> pMsgComposeParams (do_CreateInstance(NS_MSGCOMPOSEPARAMS_CONTRACTID, &rv));
|
||||
if (NS_FAILED(rv) || (!pMsgComposeParams) ) return rv ;
|
||||
|
||||
// populate the compose params
|
||||
pMsgComposeParams->SetType(nsIMsgCompType::New);
|
||||
pMsgComposeParams->SetFormat(nsIMsgCompFormat::Default);
|
||||
pMsgComposeParams->SetIdentity(pMsgId);
|
||||
pMsgComposeParams->SetComposeFields(aCompFields);
|
||||
pMsgComposeParams->SetSendListener(sendListener) ;
|
||||
pMsgComposeParams->SetSmtpPassword(smtpPassword.get());
|
||||
|
||||
// create the nsIMsgCompose object to send the object
|
||||
nsCOMPtr<nsIMsgCompose> pMsgCompose (do_CreateInstance(NS_MSGCOMPOSE_CONTRACTID, &rv));
|
||||
if (NS_FAILED(rv) || (!pMsgCompose) ) return rv ;
|
||||
|
||||
/** initialize nsIMsgCompose, Send the message, wait for send completion response **/
|
||||
|
||||
rv = pMsgCompose->Initialize(hiddenWindow, pMsgComposeParams) ;
|
||||
if (NS_FAILED(rv)) return rv ;
|
||||
|
||||
pMsgCompose->SendMsg(nsIMsgSend::nsMsgDeliverNow, pMsgId, nsnull) ;
|
||||
if (NS_FAILED(rv)) return rv ;
|
||||
|
||||
// assign to interface pointer from nsCOMPtr to facilitate typecast below
|
||||
nsIMsgSendListener * pSendListener = sendListener ;
|
||||
|
||||
// we need to wait here to make sure that we return only after send is completed
|
||||
// so we will have a event loop here which will process the events till the Send IsDone.
|
||||
nsCOMPtr<nsIEventQueueService> pEventQService = do_GetService(NS_EVENTQUEUESERVICE_CONTRACTID, &rv);
|
||||
nsCOMPtr<nsIEventQueue> eventQueue;
|
||||
pEventQService->GetThreadEventQueue(NS_CURRENT_THREAD,getter_AddRefs(eventQueue));
|
||||
while ( !((nsMAPISendListener *) pSendListener)->IsDone() )
|
||||
eventQueue->ProcessPendingEvents();
|
||||
|
||||
return rv ;
|
||||
}
|
||||
|
||||
// this is used to populate comp fields with Unicode data
|
||||
nsresult nsMapiHook::PopulateCompFields(lpnsMapiMessage aMessage,
|
||||
nsIMsgCompFields * aCompFields)
|
||||
{
|
||||
nsresult rv = NS_OK ;
|
||||
|
||||
if (aMessage->lpOriginator)
|
||||
{
|
||||
PRUnichar * From = aMessage->lpOriginator->lpszAddress ;
|
||||
aCompFields->SetFrom (From) ;
|
||||
}
|
||||
|
||||
nsAutoString To ;
|
||||
nsAutoString Cc ;
|
||||
nsAutoString Bcc ;
|
||||
|
||||
nsAutoString Comma ;
|
||||
Comma.AssignWithConversion(",");
|
||||
|
||||
if (aMessage->lpRecips)
|
||||
{
|
||||
for (int i=0 ; i < (int) aMessage->nRecipCount ; i++)
|
||||
{
|
||||
if (aMessage->lpRecips[i].lpszAddress)
|
||||
{
|
||||
switch (aMessage->lpRecips[i].ulRecipClass)
|
||||
{
|
||||
case MAPI_TO :
|
||||
if (To.Length() > 0)
|
||||
To += Comma ;
|
||||
To += (PRUnichar *) aMessage->lpRecips[i].lpszAddress ;
|
||||
break ;
|
||||
|
||||
case MAPI_CC :
|
||||
if (Cc.Length() > 0)
|
||||
Cc += Comma ;
|
||||
Cc += (PRUnichar *) aMessage->lpRecips[i].lpszAddress ;
|
||||
break ;
|
||||
|
||||
case MAPI_BCC :
|
||||
if (Bcc.Length() > 0)
|
||||
Bcc += Comma ;
|
||||
Bcc += (PRUnichar *) aMessage->lpRecips[i].lpszAddress ;
|
||||
break ;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// set To, Cc, Bcc
|
||||
aCompFields->SetTo (To.get()) ;
|
||||
aCompFields->SetCc (Cc.get()) ;
|
||||
aCompFields->SetBcc (Bcc.get()) ;
|
||||
|
||||
// set subject
|
||||
if (aMessage->lpszSubject)
|
||||
{
|
||||
PRUnichar * Subject = aMessage->lpszSubject ;
|
||||
aCompFields->SetSubject(Subject) ;
|
||||
}
|
||||
|
||||
// handle attachments as File URL
|
||||
rv = HandleAttachments (aCompFields, aMessage->nFileCount, aMessage->lpFiles, PR_TRUE) ;
|
||||
if (NS_FAILED(rv)) return rv ;
|
||||
|
||||
// set body
|
||||
if (aMessage->lpszNoteText)
|
||||
{
|
||||
PRUnichar * Body = aMessage->lpszNoteText ;
|
||||
rv = aCompFields->SetBody(Body) ;
|
||||
}
|
||||
|
||||
#ifdef RAJIV_DEBUG
|
||||
// testing what all was set in CompFields
|
||||
printf ("To : %S \n", To.get()) ;
|
||||
printf ("CC : %S \n", Cc.get() ) ;
|
||||
printf ("BCC : %S \n", Bcc.get() ) ;
|
||||
#endif
|
||||
|
||||
return rv ;
|
||||
|
||||
}
|
||||
|
||||
nsresult nsMapiHook::HandleAttachments (nsIMsgCompFields * aCompFields, PRInt32 aFileCount,
|
||||
lpnsMapiFileDesc aFiles, BOOL aIsUnicode)
|
||||
{
|
||||
nsresult rv = NS_OK ;
|
||||
|
||||
nsCAutoString Attachments ;
|
||||
nsCAutoString TempFiles ;
|
||||
|
||||
nsCOMPtr <nsILocalFile> pFile = do_CreateInstance (NS_LOCAL_FILE_CONTRACTID, &rv) ;
|
||||
if (NS_FAILED(rv) || (!pFile) ) return rv ;
|
||||
|
||||
for (int i=0 ; i < aFileCount ; i++)
|
||||
{
|
||||
if (aFiles[i].lpszPathName)
|
||||
{
|
||||
// check if attachment exists
|
||||
if (aIsUnicode)
|
||||
pFile->InitWithUnicodePath (aFiles[i].lpszPathName) ;
|
||||
else
|
||||
pFile->InitWithPath ((char *) aFiles[i].lpszPathName) ;
|
||||
PRBool bExist ;
|
||||
rv = pFile->Exists(&bExist) ;
|
||||
if (NS_FAILED(rv) || (!bExist) ) return NS_ERROR_FILE_TARGET_DOES_NOT_EXIST ;
|
||||
|
||||
// create Msg attachment object
|
||||
nsCOMPtr<nsIMsgAttachment> attachment = do_CreateInstance(NS_MSGATTACHMENT_CONTRACTID, &rv);
|
||||
if (NS_FAILED(rv) || (!attachment) ) return rv ;
|
||||
|
||||
// set url
|
||||
nsXPIDLCString pURL ;
|
||||
NS_GetURLSpecFromFile(pFile, getter_Copies(pURL));
|
||||
attachment->SetUrl(pURL) ;
|
||||
|
||||
if (aFiles[i].lpszFileName)
|
||||
{
|
||||
if (! aIsUnicode)
|
||||
{
|
||||
nsAutoString realFileName ;
|
||||
realFileName.AssignWithConversion ((char *) aFiles[i].lpszFileName) ;
|
||||
attachment->SetName(realFileName.get()) ;
|
||||
// attachment->SetName( (nsDependentString(aFiles[i].lpszFileName)).get() );
|
||||
}
|
||||
else
|
||||
attachment->SetName(aFiles[i].lpszFileName) ;
|
||||
}
|
||||
|
||||
attachment->SetTemporary(PR_FALSE) ;
|
||||
|
||||
rv = aCompFields->AddAttachment (attachment);
|
||||
}
|
||||
}
|
||||
return rv ;
|
||||
}
|
||||
|
||||
|
||||
// this is used to convert non Unicode data and then populate comp fields
|
||||
nsresult nsMapiHook::PopulateCompFieldsWithConversion(lpnsMapiMessage aMessage,
|
||||
nsIMsgCompFields * aCompFields)
|
||||
{
|
||||
nsresult rv = NS_OK ;
|
||||
|
||||
if (aMessage->lpOriginator)
|
||||
{
|
||||
nsAutoString From ;
|
||||
From.AssignWithConversion((char *) aMessage->lpOriginator->lpszAddress);
|
||||
aCompFields->SetFrom (From.get()) ;
|
||||
}
|
||||
|
||||
nsAutoString To ;
|
||||
nsAutoString Cc ;
|
||||
nsAutoString Bcc ;
|
||||
|
||||
nsAutoString Comma ;
|
||||
Comma.AssignWithConversion(",");
|
||||
|
||||
if (aMessage->lpRecips)
|
||||
{
|
||||
for (int i=0 ; i < (int) aMessage->nRecipCount ; i++)
|
||||
{
|
||||
if (aMessage->lpRecips[i].lpszAddress)
|
||||
{
|
||||
switch (aMessage->lpRecips[i].ulRecipClass)
|
||||
{
|
||||
case MAPI_TO :
|
||||
if (To.Length() > 0)
|
||||
To += Comma ;
|
||||
To.AppendWithConversion ((char *) aMessage->lpRecips[i].lpszAddress);
|
||||
break ;
|
||||
|
||||
case MAPI_CC :
|
||||
if (Cc.Length() > 0)
|
||||
Cc += Comma ;
|
||||
Cc.AppendWithConversion ((char *) aMessage->lpRecips[i].lpszAddress);
|
||||
break ;
|
||||
|
||||
case MAPI_BCC :
|
||||
if (Bcc.Length() > 0)
|
||||
Bcc += Comma ;
|
||||
Bcc.AppendWithConversion ((char *) aMessage->lpRecips[i].lpszAddress) ;
|
||||
break ;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// set To, Cc, Bcc
|
||||
aCompFields->SetTo (To.get()) ;
|
||||
aCompFields->SetCc (Cc.get()) ;
|
||||
aCompFields->SetBcc (Bcc.get()) ;
|
||||
|
||||
nsCAutoString platformCharSet;
|
||||
// set subject
|
||||
if (aMessage->lpszSubject)
|
||||
{
|
||||
nsAutoString Subject ;
|
||||
if (platformCharSet.IsEmpty())
|
||||
platformCharSet.Assign(nsMsgI18NFileSystemCharset());
|
||||
rv = ConvertToUnicode(platformCharSet.get(), (char *) aMessage->lpszSubject, Subject);
|
||||
if (NS_FAILED(rv)) return rv ;
|
||||
aCompFields->SetSubject(Subject.get()) ;
|
||||
}
|
||||
|
||||
// handle attachments as File URL
|
||||
rv = HandleAttachments (aCompFields, aMessage->nFileCount, aMessage->lpFiles, PR_FALSE) ;
|
||||
if (NS_FAILED(rv)) return rv ;
|
||||
|
||||
// set body
|
||||
if (aMessage->lpszNoteText)
|
||||
{
|
||||
nsAutoString Body ;
|
||||
if (platformCharSet.IsEmpty())
|
||||
platformCharSet.Assign(nsMsgI18NFileSystemCharset());
|
||||
rv = ConvertToUnicode(platformCharSet.get(), (char *) aMessage->lpszNoteText, Body);
|
||||
if (NS_FAILED(rv)) return rv ;
|
||||
rv = aCompFields->SetBody(Body.get()) ;
|
||||
}
|
||||
|
||||
#ifdef RAJIV_DEBUG
|
||||
// testing what all was set in CompFields
|
||||
printf ("To : %S \n", To.get()) ;
|
||||
printf ("CC : %S \n", Cc.get() ) ;
|
||||
printf ("BCC : %S \n", Bcc.get() ) ;
|
||||
#endif
|
||||
|
||||
return rv ;
|
||||
}
|
||||
|
||||
// this is used to populate the docs as attachments in the Comp fields for Send Documents
|
||||
nsresult nsMapiHook::PopulateCompFieldsForSendDocs(nsIMsgCompFields * aCompFields, ULONG aFlags,
|
||||
PRUnichar * aDelimChar, PRUnichar * aFilePaths)
|
||||
{
|
||||
nsAutoString strDelimChars ;
|
||||
nsString strFilePaths;
|
||||
nsresult rv = NS_OK ;
|
||||
|
||||
if (aFlags & MAPI_UNICODE)
|
||||
{
|
||||
if (aDelimChar)
|
||||
strDelimChars.Assign (aDelimChar) ;
|
||||
if (aFilePaths)
|
||||
strFilePaths.Assign (aFilePaths) ;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (aDelimChar)
|
||||
strDelimChars.AssignWithConversion ((char*) aDelimChar) ;
|
||||
if (aFilePaths)
|
||||
strFilePaths.AssignWithConversion ((char *) aFilePaths) ;
|
||||
}
|
||||
|
||||
// check for comma in filename
|
||||
if (strDelimChars.Find (",") == kNotFound) // if comma is not in the delimiter specified by user
|
||||
{
|
||||
if (strFilePaths.Find(",") != kNotFound) // if comma found in filenames return error
|
||||
return NS_ERROR_FILE_INVALID_PATH ;
|
||||
}
|
||||
|
||||
nsCString Attachments ;
|
||||
|
||||
// only 1 file is to be sent, no delim specified
|
||||
if ((!strDelimChars.Length()) && (strFilePaths.Length()>0))
|
||||
{
|
||||
nsCOMPtr <nsILocalFile> pFile = do_CreateInstance (NS_LOCAL_FILE_CONTRACTID, &rv) ;
|
||||
if (NS_FAILED(rv) || (!pFile) ) return rv ;
|
||||
pFile->InitWithUnicodePath (strFilePaths.get()) ;
|
||||
|
||||
PRBool bExist ;
|
||||
rv = pFile->Exists(&bExist) ;
|
||||
if (NS_FAILED(rv) || (!bExist) ) return NS_ERROR_FILE_TARGET_DOES_NOT_EXIST ;
|
||||
|
||||
nsXPIDLCString pURL ;
|
||||
NS_GetURLSpecFromFile(pFile, getter_Copies(pURL));
|
||||
if (pURL)
|
||||
Attachments.Assign(pURL) ;
|
||||
|
||||
// set attachments for comp field and return
|
||||
rv = aCompFields->SetAttachments (Attachments.get());
|
||||
return rv ;
|
||||
}
|
||||
|
||||
// multiple files to be sent, delim specified
|
||||
nsCOMPtr <nsILocalFile> pFile = do_CreateInstance (NS_LOCAL_FILE_CONTRACTID, &rv) ;
|
||||
if (NS_FAILED(rv) || (!pFile) ) return rv ;
|
||||
PRInt32 offset = 0 ;
|
||||
PRInt32 FilePathsLen = strFilePaths.Length() ;
|
||||
if (FilePathsLen)
|
||||
{
|
||||
PRUnichar * newFilePaths = (PRUnichar *) strFilePaths.get() ;
|
||||
while (offset != kNotFound)
|
||||
{
|
||||
nsString RemainingPaths ;
|
||||
RemainingPaths.Assign(newFilePaths) ;
|
||||
offset = RemainingPaths.Find (strDelimChars) ;
|
||||
if (offset != kNotFound)
|
||||
{
|
||||
RemainingPaths.SetLength (offset) ;
|
||||
if ((offset + strDelimChars.Length()) < FilePathsLen)
|
||||
newFilePaths += offset + strDelimChars.Length() ;
|
||||
}
|
||||
|
||||
pFile->InitWithUnicodePath (RemainingPaths.get()) ;
|
||||
|
||||
#ifdef RAJIV_DEBUG
|
||||
printf ("File : %S \n", RemainingPaths.get()) ;
|
||||
#endif
|
||||
PRBool bExist ;
|
||||
rv = pFile->Exists(&bExist) ;
|
||||
if (NS_FAILED(rv) || (!bExist) ) return NS_ERROR_FILE_TARGET_DOES_NOT_EXIST ;
|
||||
|
||||
nsXPIDLCString pURL ;
|
||||
NS_GetURLSpecFromFile(pFile, getter_Copies(pURL));
|
||||
if (pURL)
|
||||
{
|
||||
if (Attachments.Length() > 0)
|
||||
Attachments.Append(",") ;
|
||||
Attachments.Append(pURL) ;
|
||||
}
|
||||
}
|
||||
rv = aCompFields->SetAttachments (Attachments.get());
|
||||
}
|
||||
|
||||
return rv ;
|
||||
}
|
||||
|
||||
// this used for Send with UI
|
||||
nsresult nsMapiHook::ShowComposerWindow (unsigned long aSession, nsIMsgCompFields * aCompFields)
|
||||
{
|
||||
nsresult rv = NS_OK ;
|
||||
|
||||
// create a send listener to get back the send status
|
||||
nsCOMPtr <nsIMsgSendListener> sendListener ;
|
||||
rv = nsMAPISendListener::CreateMAPISendListener(getter_AddRefs(sendListener)) ;
|
||||
if (NS_FAILED(rv) || (!sendListener) ) return rv ;
|
||||
|
||||
// create the compose params object
|
||||
nsCOMPtr<nsIMsgComposeParams> pMsgComposeParams (do_CreateInstance(NS_MSGCOMPOSEPARAMS_CONTRACTID, &rv));
|
||||
if (NS_FAILED(rv) || (!pMsgComposeParams) ) return rv ;
|
||||
|
||||
// populate the compose params
|
||||
pMsgComposeParams->SetType(nsIMsgCompType::New);
|
||||
pMsgComposeParams->SetFormat(nsIMsgCompFormat::Default);
|
||||
pMsgComposeParams->SetComposeFields(aCompFields);
|
||||
pMsgComposeParams->SetSendListener(sendListener) ;
|
||||
|
||||
/** get the nsIMsgComposeService object to open the compose window **/
|
||||
nsCOMPtr <nsIMsgComposeService> compService = do_GetService (NS_MSGCOMPOSESERVICE_CONTRACTID) ;
|
||||
if (NS_FAILED(rv)|| (!compService) ) return rv ;
|
||||
|
||||
rv = compService->OpenComposeWindowWithParams(nsnull, pMsgComposeParams) ;
|
||||
if (NS_FAILED(rv)) return rv ;
|
||||
|
||||
return rv ;
|
||||
}
|
||||
66
mozilla/mailnews/mapi/mapihook/src/msgMapiHook.h
Normal file
@@ -0,0 +1,66 @@
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is Mozilla
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corp.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2001
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s): Krishna Mohan Khandrika (kkhandrika@netscape.com)
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef MSG_MAPI_HOOK_H_
|
||||
#define MSG_MAPI_HOOK_H_
|
||||
|
||||
#include "prtypes.h"
|
||||
|
||||
class nsMapiHook
|
||||
{
|
||||
public :
|
||||
|
||||
static PRBool Initialize();
|
||||
static PRBool DisplayLoginDialog(PRBool aLogin, PRUnichar **aUsername,
|
||||
PRUnichar **aPassword);
|
||||
static PRBool VerifyUserName(const PRUnichar *aUsername, char **aIdKey);
|
||||
|
||||
static PRBool IsBlindSendAllowed () ;
|
||||
static nsresult BlindSendMail (unsigned long aSession, nsIMsgCompFields * aCompFields) ;
|
||||
static nsresult ShowComposerWindow (unsigned long aSession, nsIMsgCompFields * aCompFields) ;
|
||||
static nsresult PopulateCompFields(lpnsMapiMessage aMessage, nsIMsgCompFields * aCompFields) ;
|
||||
static nsresult PopulateCompFieldsWithConversion(lpnsMapiMessage aMessage,
|
||||
nsIMsgCompFields * aCompFields) ;
|
||||
static nsresult PopulateCompFieldsForSendDocs(nsIMsgCompFields * aCompFields,
|
||||
ULONG aFlags, LPTSTR aDelimChar, LPTSTR aFilePaths) ;
|
||||
static nsresult HandleAttachments (nsIMsgCompFields * aCompFields, PRInt32 aFileCount,
|
||||
lpnsMapiFileDesc aFiles, BOOL aIsUnicode) ;
|
||||
static void CleanUp();
|
||||
|
||||
static PRBool isMapiService;
|
||||
};
|
||||
|
||||
#endif // MSG_MAPI_HOOK_H_
|
||||
266
mozilla/mailnews/mapi/mapihook/src/msgMapiImp.cpp
Normal file
@@ -0,0 +1,266 @@
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is Mozilla
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corp.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2001
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s): Krishna Mohan Khandrika (kkhandrika@netscape.com)
|
||||
* Contributor(s): Rajiv Dayal (rdayal@netscape.com)
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include <mapidefs.h>
|
||||
#include <mapi.h>
|
||||
#include "msgMapi.h"
|
||||
#include "msgMapiImp.h"
|
||||
#include "msgMapiFactory.h"
|
||||
#include "msgMapiMain.h"
|
||||
|
||||
#include "nsMsgCompFields.h"
|
||||
#include "msgMapiHook.h"
|
||||
#include "nsString.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsISupports.h"
|
||||
#include "nsMsgCompCID.h"
|
||||
|
||||
|
||||
|
||||
CMapiImp::CMapiImp()
|
||||
: m_cRef(1)
|
||||
{
|
||||
m_Lock = PR_NewLock();
|
||||
}
|
||||
|
||||
CMapiImp::~CMapiImp()
|
||||
{
|
||||
if (m_Lock)
|
||||
PR_DestroyLock(m_Lock);
|
||||
}
|
||||
|
||||
STDMETHODIMP CMapiImp::QueryInterface(const IID& aIid, void** aPpv)
|
||||
{
|
||||
if (aIid == IID_IUnknown)
|
||||
{
|
||||
*aPpv = static_cast<nsIMapi*>(this);
|
||||
}
|
||||
else if (aIid == IID_nsIMapi)
|
||||
{
|
||||
*aPpv = static_cast<nsIMapi*>(this);
|
||||
}
|
||||
else
|
||||
{
|
||||
*aPpv = nsnull;
|
||||
return E_NOINTERFACE;
|
||||
}
|
||||
|
||||
reinterpret_cast<IUnknown*>(*aPpv)->AddRef();
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP_(ULONG) CMapiImp::AddRef()
|
||||
{
|
||||
return PR_AtomicIncrement(&m_cRef);
|
||||
}
|
||||
|
||||
STDMETHODIMP_(ULONG) CMapiImp::Release()
|
||||
{
|
||||
PRInt32 temp;
|
||||
temp = PR_AtomicDecrement(&m_cRef);
|
||||
if (m_cRef == 0)
|
||||
{
|
||||
delete this;
|
||||
return 0;
|
||||
}
|
||||
|
||||
return temp;
|
||||
}
|
||||
|
||||
STDMETHODIMP CMapiImp::IsValid()
|
||||
{
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP CMapiImp::IsValidSession(unsigned long aSession)
|
||||
{
|
||||
nsMAPIConfiguration *pConfig = nsMAPIConfiguration::GetMAPIConfiguration();
|
||||
if (pConfig && pConfig->IsSessionValid(aSession))
|
||||
return S_OK;
|
||||
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
STDMETHODIMP CMapiImp::Initialize()
|
||||
{
|
||||
HRESULT hr = E_FAIL;
|
||||
|
||||
if (!m_Lock)
|
||||
return E_FAIL;
|
||||
|
||||
PR_Lock(m_Lock);
|
||||
|
||||
// Initialize MAPI Configuration
|
||||
|
||||
nsMAPIConfiguration *pConfig = nsMAPIConfiguration::GetMAPIConfiguration();
|
||||
if (pConfig != nsnull)
|
||||
if (nsMapiHook::Initialize())
|
||||
hr = S_OK;
|
||||
|
||||
PR_Unlock(m_Lock);
|
||||
|
||||
return hr;
|
||||
}
|
||||
|
||||
STDMETHODIMP CMapiImp::Login(unsigned long aUIArg, LOGIN_PW_TYPE aLogin, LOGIN_PW_TYPE aPassWord,
|
||||
unsigned long aFlags, unsigned long *aSessionId)
|
||||
{
|
||||
HRESULT hr = E_FAIL;
|
||||
PRBool bNewSession = PR_FALSE;
|
||||
char *id_key = nsnull;
|
||||
|
||||
if (aFlags & MAPI_NEW_SESSION)
|
||||
bNewSession = PR_TRUE;
|
||||
|
||||
// Check For Profile Name
|
||||
|
||||
if (aLogin != nsnull && aLogin[0] != '\0')
|
||||
{
|
||||
if (nsMapiHook::VerifyUserName(aLogin, &id_key) == PR_FALSE)
|
||||
{
|
||||
*aSessionId = MAPI_E_LOGIN_FAILURE;
|
||||
return hr;
|
||||
}
|
||||
}
|
||||
|
||||
// finally register(create) the session.
|
||||
|
||||
PRUint32 nSession_Id;
|
||||
PRInt16 nResult = 0;
|
||||
|
||||
nsMAPIConfiguration *pConfig = nsMAPIConfiguration::GetMAPIConfiguration();
|
||||
if (pConfig != nsnull)
|
||||
nResult = pConfig->RegisterSession(aUIArg, aLogin, aPassWord,
|
||||
(aFlags & MAPI_FORCE_DOWNLOAD), bNewSession,
|
||||
&nSession_Id, id_key);
|
||||
|
||||
switch (nResult)
|
||||
{
|
||||
case -1 :
|
||||
{
|
||||
*aSessionId = MAPI_E_TOO_MANY_SESSIONS;
|
||||
return hr;
|
||||
}
|
||||
case 0 :
|
||||
{
|
||||
*aSessionId = MAPI_E_INSUFFICIENT_MEMORY;
|
||||
return hr;
|
||||
}
|
||||
default :
|
||||
{
|
||||
*aSessionId = nSession_Id;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP CMapiImp::SendMail( unsigned long aSession, lpnsMapiMessage aMessage,
|
||||
short aRecipCount, lpnsMapiRecipDesc aRecips , short aFileCount, lpnsMapiFileDesc aFiles ,
|
||||
unsigned long aFlags, unsigned long aReserved)
|
||||
{
|
||||
nsresult rv = NS_OK ;
|
||||
|
||||
// Assign the pointers in the aMessage struct to the array of Recips and Files
|
||||
// recieved here from MS COM. These are used in BlindSendMail and ShowCompWin fns
|
||||
aMessage->lpRecips = aRecips ;
|
||||
aMessage->lpFiles = aFiles ;
|
||||
|
||||
/** create nsIMsgCompFields obj and populate it **/
|
||||
nsCOMPtr<nsIMsgCompFields> pCompFields = do_CreateInstance(NS_MSGCOMPFIELDS_CONTRACTID, &rv) ;
|
||||
if (NS_FAILED(rv) || (!pCompFields) ) return MAPI_E_INSUFFICIENT_MEMORY ;
|
||||
|
||||
if (aFlags & MAPI_UNICODE)
|
||||
rv = nsMapiHook::PopulateCompFields(aMessage, pCompFields) ;
|
||||
else
|
||||
rv = nsMapiHook::PopulateCompFieldsWithConversion(aMessage, pCompFields) ;
|
||||
|
||||
if (NS_SUCCEEDED (rv))
|
||||
{
|
||||
// see flag to see if UI needs to be brought up
|
||||
if (!(aFlags & MAPI_DIALOG))
|
||||
{
|
||||
rv = nsMapiHook::BlindSendMail(aSession, pCompFields);
|
||||
}
|
||||
else
|
||||
{
|
||||
rv = nsMapiHook::ShowComposerWindow(aSession, pCompFields);
|
||||
}
|
||||
}
|
||||
|
||||
return nsMAPIConfiguration::GetMAPIErrorFromNSError (rv) ;
|
||||
}
|
||||
|
||||
|
||||
STDMETHODIMP CMapiImp::SendDocuments( unsigned long aSession, LPTSTR aDelimChar,
|
||||
LPTSTR aFilePaths, LPTSTR aFileNames, ULONG aFlags)
|
||||
{
|
||||
nsresult rv = NS_OK ;
|
||||
|
||||
/** create nsIMsgCompFields obj and populate it **/
|
||||
nsCOMPtr<nsIMsgCompFields> pCompFields = do_CreateInstance(NS_MSGCOMPFIELDS_CONTRACTID, &rv) ;
|
||||
if (NS_FAILED(rv) || (!pCompFields) ) return MAPI_E_INSUFFICIENT_MEMORY ;
|
||||
|
||||
if (aFilePaths)
|
||||
{
|
||||
rv = nsMapiHook::PopulateCompFieldsForSendDocs(pCompFields, aFlags, aDelimChar, aFilePaths) ;
|
||||
}
|
||||
|
||||
if (NS_SUCCEEDED (rv))
|
||||
rv = nsMapiHook::ShowComposerWindow(aSession, pCompFields);
|
||||
|
||||
return nsMAPIConfiguration::GetMAPIErrorFromNSError (rv) ;
|
||||
}
|
||||
|
||||
STDMETHODIMP CMapiImp::Logoff (unsigned long aSession)
|
||||
{
|
||||
nsMAPIConfiguration *pConfig = nsMAPIConfiguration::GetMAPIConfiguration();
|
||||
|
||||
if (pConfig->UnRegisterSession((PRUint32)aSession))
|
||||
return S_OK;
|
||||
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
STDMETHODIMP CMapiImp::CleanUp()
|
||||
{
|
||||
nsMapiHook::CleanUp();
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
||||
92
mozilla/mailnews/mapi/mapihook/src/msgMapiImp.h
Normal file
@@ -0,0 +1,92 @@
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is Mozilla
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corp.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2001
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s): Krishna Mohan Khandrika (kkhandrika@netscape.com)
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef MSG_MAPI_IMP_H
|
||||
#define MSG_MAPI_IMP_H
|
||||
|
||||
#include <windows.h>
|
||||
#include <mapi.h>
|
||||
#include "msgMapi.h"
|
||||
#include "nsXPIDLString.h"
|
||||
#include "nspr.h"
|
||||
|
||||
const CLSID CLSID_CMapiImp = {0x29f458be, 0x8866, 0x11d5, {0xa3, 0xdd, 0x0, 0xb0, 0xd0, 0xf3, 0xba, 0xa7}};
|
||||
|
||||
// this class implements the MS COM interface nsIMapi that provides the methods
|
||||
// called by mapi32.dll to perform the mail operations as specified by MAPI.
|
||||
// These class methods in turn use the Mozilla Mail XPCOM interfaces to do so.
|
||||
class CMapiImp : public nsIMapi
|
||||
{
|
||||
|
||||
public :
|
||||
|
||||
// IUnknown
|
||||
|
||||
STDMETHODIMP QueryInterface(const IID& aIid, void** aPpv);
|
||||
STDMETHODIMP_(ULONG) AddRef();
|
||||
STDMETHODIMP_(ULONG) Release();
|
||||
|
||||
// Interface INsMapi
|
||||
|
||||
STDMETHODIMP Login(unsigned long aUIArg, LOGIN_PW_TYPE aLogin,
|
||||
LOGIN_PW_TYPE aPassWord, unsigned long aFlags,
|
||||
unsigned long *aSessionId);
|
||||
|
||||
STDMETHODIMP SendMail( unsigned long aSession, lpnsMapiMessage aMessage,
|
||||
short aRecipCount, lpnsMapiRecipDesc aRecips ,
|
||||
short aFileCount, lpnsMapiFileDesc aFiles ,
|
||||
unsigned long aFlags, unsigned long aReserved) ;
|
||||
|
||||
STDMETHODIMP SendDocuments( unsigned long aSession, LPTSTR aDelimChar,
|
||||
LPTSTR aFilePaths, LPTSTR aFileNames, ULONG aFlags);
|
||||
|
||||
STDMETHODIMP Initialize();
|
||||
STDMETHODIMP IsValid();
|
||||
STDMETHODIMP IsValidSession(unsigned long aSession);
|
||||
|
||||
STDMETHODIMP Logoff (unsigned long aSession);
|
||||
STDMETHODIMP CleanUp();
|
||||
|
||||
CMapiImp();
|
||||
~CMapiImp();
|
||||
|
||||
private :
|
||||
|
||||
PRLock *m_Lock;
|
||||
PRInt32 m_cRef;
|
||||
};
|
||||
|
||||
#endif // MSG_MAPI_IMP_H
|
||||
376
mozilla/mailnews/mapi/mapihook/src/msgMapiMain.cpp
Normal file
@@ -0,0 +1,376 @@
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is Mozilla
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corp.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2001
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s): Krishna Mohan Khandrika (kkhandrika@netscape.com)
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include <mapidefs.h>
|
||||
#include <mapi.h>
|
||||
|
||||
#include "msgCore.h"
|
||||
#include "nsMsgComposeStringBundle.h"
|
||||
#include "msgMapiMain.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsCOMPtr.h"
|
||||
|
||||
// move to xpcom bug 81956.
|
||||
class nsPRUintKey : public nsHashKey {
|
||||
protected:
|
||||
PRUint32 mKey;
|
||||
public:
|
||||
nsPRUintKey(PRUint32 key) : mKey(key) {}
|
||||
|
||||
PRUint32 HashCode(void) const {
|
||||
return mKey;
|
||||
}
|
||||
|
||||
PRBool Equals(const nsHashKey *aKey) const {
|
||||
return mKey == ((const nsPRUintKey *) aKey)->mKey;
|
||||
}
|
||||
nsHashKey *Clone() const {
|
||||
return new nsPRUintKey(mKey);
|
||||
}
|
||||
PRUint32 GetValue() { return mKey; }
|
||||
};
|
||||
//
|
||||
|
||||
|
||||
nsMAPIConfiguration *nsMAPIConfiguration::m_pSelfRef = nsnull;
|
||||
PRUint32 nsMAPIConfiguration::session_generator = 0;
|
||||
PRUint32 nsMAPIConfiguration::sessionCount = 0;
|
||||
|
||||
nsMAPIConfiguration *nsMAPIConfiguration::GetMAPIConfiguration()
|
||||
{
|
||||
if (m_pSelfRef == nsnull)
|
||||
m_pSelfRef = new nsMAPIConfiguration();
|
||||
|
||||
return m_pSelfRef;
|
||||
}
|
||||
|
||||
nsMAPIConfiguration::nsMAPIConfiguration()
|
||||
: m_nMaxSessions(MAX_SESSIONS)
|
||||
{
|
||||
m_Lock = PR_NewLock();
|
||||
}
|
||||
|
||||
static PRBool
|
||||
FreeSessionMapEntries(nsHashKey *aKey, void *aData, void* aClosure)
|
||||
{
|
||||
nsMAPISession *pTemp = (nsMAPISession*) aData;
|
||||
if (pTemp)
|
||||
{
|
||||
delete pTemp;
|
||||
pTemp = nsnull;
|
||||
}
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
static PRBool
|
||||
FreeProfileMapEntries(nsHashKey *aKey, void *aData, void* aClosure)
|
||||
{
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
nsMAPIConfiguration::~nsMAPIConfiguration()
|
||||
{
|
||||
if (m_Lock)
|
||||
PR_DestroyLock(m_Lock);
|
||||
|
||||
m_SessionMap.Reset(FreeSessionMapEntries);
|
||||
m_ProfileMap.Reset(FreeProfileMapEntries);
|
||||
}
|
||||
|
||||
void nsMAPIConfiguration::OpenConfiguration()
|
||||
{
|
||||
// No. of max. sessions is set to MAX_SESSIONS. In future
|
||||
// if it is decided to have configuration (registry)
|
||||
// parameter, this function can be used to set the
|
||||
// max sessions;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
PRInt16 nsMAPIConfiguration::RegisterSession(PRUint32 aHwnd,
|
||||
const PRUnichar *aUserName, const PRUnichar *aPassword,
|
||||
PRBool aForceDownLoad, PRBool aNewSession,
|
||||
PRUint32 *aSession, char *aIdKey)
|
||||
{
|
||||
PRInt16 nResult = 0;
|
||||
PRUint32 n_SessionId = 0;
|
||||
|
||||
PR_Lock(m_Lock);
|
||||
|
||||
// Check whether max sessions is exceeded
|
||||
|
||||
if (sessionCount >= m_nMaxSessions)
|
||||
{
|
||||
PR_Unlock(m_Lock);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (aUserName != nsnull && aUserName[0] != '\0')
|
||||
{
|
||||
nsStringKey usernameKey(aUserName);
|
||||
n_SessionId = (PRUint32) m_ProfileMap.Get(&usernameKey);
|
||||
}
|
||||
|
||||
// try to share a session; if not create a session
|
||||
|
||||
if (n_SessionId > 0)
|
||||
{
|
||||
nsPRUintKey sessionKey(n_SessionId);
|
||||
nsMAPISession *pTemp = (nsMAPISession *)m_SessionMap.Get(&sessionKey);
|
||||
if (pTemp != nsnull)
|
||||
{
|
||||
pTemp->IncrementSession();
|
||||
*aSession = n_SessionId;
|
||||
nResult = 1;
|
||||
}
|
||||
}
|
||||
else if (aNewSession || n_SessionId == 0) // checking for n_SessionId is a concession
|
||||
{
|
||||
// create a new session ; if new session is specified OR there is no session
|
||||
nsMAPISession *pTemp = nsnull;
|
||||
pTemp = new nsMAPISession(aHwnd, aUserName,
|
||||
aPassword, aForceDownLoad, aIdKey);
|
||||
|
||||
if (pTemp != nsnull)
|
||||
{
|
||||
session_generator++;
|
||||
|
||||
// I don't think there will be (2 power 32) sessions alive
|
||||
// in a cycle. This is an assumption
|
||||
|
||||
if (session_generator == 0)
|
||||
session_generator++;
|
||||
|
||||
nsPRUintKey sessionKey(session_generator);
|
||||
m_SessionMap.Put(&sessionKey, pTemp);
|
||||
if (aUserName != nsnull && aUserName[0] != '\0')
|
||||
{
|
||||
nsStringKey usernameKey(aUserName);
|
||||
m_ProfileMap.Put(&usernameKey, (void*)session_generator);
|
||||
}
|
||||
|
||||
*aSession = session_generator;
|
||||
sessionCount++;
|
||||
nResult = 1;
|
||||
}
|
||||
}
|
||||
|
||||
PR_Unlock(m_Lock);
|
||||
return nResult;
|
||||
}
|
||||
|
||||
PRBool nsMAPIConfiguration::UnRegisterSession(PRUint32 aSessionID)
|
||||
{
|
||||
PRBool bResult = PR_FALSE;
|
||||
|
||||
PR_Lock(m_Lock);
|
||||
|
||||
if (aSessionID != 0)
|
||||
{
|
||||
nsPRUintKey sessionKey(aSessionID);
|
||||
nsMAPISession *pTemp = (nsMAPISession *)m_SessionMap.Get(&sessionKey);
|
||||
|
||||
if (pTemp != nsnull)
|
||||
{
|
||||
if (pTemp->DecrementSession() == 0)
|
||||
{
|
||||
if (pTemp->m_pProfileName.get() != nsnull)
|
||||
{
|
||||
nsStringKey stringKey(pTemp->m_pProfileName.get());
|
||||
m_ProfileMap.Remove(&stringKey);
|
||||
}
|
||||
m_SessionMap.Remove(&sessionKey);
|
||||
sessionCount--;
|
||||
bResult = PR_TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
PR_Unlock(m_Lock);
|
||||
return bResult;
|
||||
}
|
||||
|
||||
PRBool nsMAPIConfiguration::IsSessionValid(PRUint32 aSessionID)
|
||||
{
|
||||
if (aSessionID == 0)
|
||||
return PR_FALSE;
|
||||
|
||||
PRBool retValue = PR_FALSE;
|
||||
nsPRUintKey sessionKey(aSessionID);
|
||||
|
||||
PR_Lock(m_Lock);
|
||||
|
||||
retValue = m_SessionMap.Exists(&sessionKey);
|
||||
|
||||
PR_Unlock(m_Lock);
|
||||
|
||||
return retValue;
|
||||
}
|
||||
|
||||
|
||||
PRUnichar *nsMAPIConfiguration::GetPassword(PRUint32 aSessionID)
|
||||
{
|
||||
PRUnichar *pResult = nsnull;
|
||||
|
||||
PR_Lock(m_Lock);
|
||||
|
||||
if (aSessionID != 0)
|
||||
{
|
||||
nsPRUintKey sessionKey(aSessionID);
|
||||
nsMAPISession *pTemp = (nsMAPISession *)m_SessionMap.Get(&sessionKey);
|
||||
|
||||
if (pTemp)
|
||||
{
|
||||
pResult = pTemp->GetPassword();
|
||||
}
|
||||
}
|
||||
|
||||
PR_Unlock(m_Lock);
|
||||
|
||||
return pResult;
|
||||
}
|
||||
|
||||
char *nsMAPIConfiguration::GetIdKey(PRUint32 aSessionID)
|
||||
{
|
||||
char *pResult = nsnull;
|
||||
|
||||
PR_Lock(m_Lock);
|
||||
|
||||
if (aSessionID != 0)
|
||||
{
|
||||
nsPRUintKey sessionKey(aSessionID);
|
||||
nsMAPISession *pTemp = (nsMAPISession *)m_SessionMap.Get(&sessionKey);
|
||||
if (pTemp)
|
||||
{
|
||||
pResult = pTemp->GetIdKey();
|
||||
}
|
||||
}
|
||||
|
||||
PR_Unlock(m_Lock);
|
||||
return pResult;
|
||||
}
|
||||
|
||||
// util func
|
||||
HRESULT nsMAPIConfiguration::GetMAPIErrorFromNSError (nsresult res)
|
||||
{
|
||||
HRESULT hr = SUCCESS_SUCCESS ;
|
||||
|
||||
if (NS_SUCCEEDED (hr)) return hr ;
|
||||
|
||||
// if failure return the related MAPI failure code
|
||||
switch (res)
|
||||
{
|
||||
case NS_MSG_NO_RECIPIENTS :
|
||||
hr = MAPI_E_BAD_RECIPTYPE ;
|
||||
break ;
|
||||
case NS_ERROR_COULD_NOT_GET_USERS_MAIL_ADDRESS :
|
||||
hr = MAPI_E_INVALID_RECIPS ;
|
||||
break ;
|
||||
case NS_ERROR_COULD_NOT_LOGIN_TO_SMTP_SERVER :
|
||||
hr = MAPI_E_LOGIN_FAILURE ;
|
||||
break ;
|
||||
case NS_MSG_UNABLE_TO_OPEN_FILE :
|
||||
case NS_MSG_UNABLE_TO_OPEN_TMP_FILE :
|
||||
case NS_MSG_COULDNT_OPEN_FCC_FOLDER :
|
||||
case NS_ERROR_FILE_INVALID_PATH :
|
||||
hr = MAPI_E_ATTACHMENT_OPEN_FAILURE ;
|
||||
break ;
|
||||
case NS_ERROR_FILE_TARGET_DOES_NOT_EXIST :
|
||||
hr = MAPI_E_ATTACHMENT_NOT_FOUND ;
|
||||
break ;
|
||||
case NS_MSG_CANCELLING :
|
||||
hr = MAPI_E_USER_ABORT ;
|
||||
break ;
|
||||
case NS_MSG_ERROR_WRITING_FILE :
|
||||
case NS_MSG_UNABLE_TO_SAVE_TEMPLATE :
|
||||
case NS_MSG_UNABLE_TO_SAVE_DRAFT :
|
||||
hr = MAPI_E_ATTACHMENT_WRITE_FAILURE ;
|
||||
break ;
|
||||
default :
|
||||
hr = MAPI_E_FAILURE ;
|
||||
break ;
|
||||
}
|
||||
|
||||
return hr ;
|
||||
}
|
||||
|
||||
|
||||
nsMAPISession::nsMAPISession(PRUint32 aHwnd, const PRUnichar *aUserName,\
|
||||
const PRUnichar *aPassword, \
|
||||
PRBool aForceDownLoad, char *aKey)
|
||||
: m_bIsForcedDownLoad(aForceDownLoad),
|
||||
m_hAppHandle(aHwnd),
|
||||
m_nShared(1),
|
||||
m_pIdKey(aKey)
|
||||
{
|
||||
m_pProfileName.Assign(aUserName);
|
||||
m_pPassword.Assign(aPassword);
|
||||
}
|
||||
|
||||
nsMAPISession::~nsMAPISession()
|
||||
{
|
||||
if (m_pIdKey != nsnull)
|
||||
{
|
||||
delete [] m_pIdKey;
|
||||
m_pIdKey = nsnull;
|
||||
}
|
||||
}
|
||||
|
||||
PRUint32 nsMAPISession::IncrementSession()
|
||||
{
|
||||
return ++m_nShared;
|
||||
}
|
||||
|
||||
PRUint32 nsMAPISession::DecrementSession()
|
||||
{
|
||||
return --m_nShared;
|
||||
}
|
||||
|
||||
PRUint32 nsMAPISession::GetSessionCount()
|
||||
{
|
||||
return m_nShared;
|
||||
}
|
||||
|
||||
PRUnichar *nsMAPISession::GetPassword()
|
||||
{
|
||||
return (PRUnichar *)m_pPassword.get();
|
||||
}
|
||||
|
||||
char *nsMAPISession::GetIdKey()
|
||||
{
|
||||
return m_pIdKey;
|
||||
}
|
||||
|
||||
112
mozilla/mailnews/mapi/mapihook/src/msgMapiMain.h
Normal file
@@ -0,0 +1,112 @@
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is Mozilla
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corp.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2001
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s): Krishna Mohan Khandrika (kkhandrika@netscape.com)
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef MSG_MAPI_MAIN_H_
|
||||
#define NSG_MAPI_MAIN_H_
|
||||
|
||||
#define MAX_NAME_LEN 256
|
||||
#define MAX_PW_LEN 256
|
||||
#define MAX_SESSIONS 50
|
||||
#define MAPI_SENDCOMPLETE_EVENT "SendCompletionEvent"
|
||||
|
||||
#define MAPI_PROPERTIES_CHROME "chrome://messenger-mapi/locale/mapi.properties"
|
||||
#define PREF_MAPI_WARN_PRIOR_TO_BLIND_SEND "mapi.blind-send.warn"
|
||||
#define PREF_MAPI_BLIND_SEND_ENABLED "mapi.blind-send.enabled"
|
||||
|
||||
#include "nsXPIDLString.h"
|
||||
#include "nspr.h"
|
||||
#include "nsString.h"
|
||||
#include "nsHashtable.h"
|
||||
|
||||
class nsMAPIConfiguration
|
||||
{
|
||||
private :
|
||||
|
||||
static PRUint32 session_generator;
|
||||
static PRUint32 sessionCount;
|
||||
static nsMAPIConfiguration *m_pSelfRef;
|
||||
PRLock *m_Lock;
|
||||
PRUint32 m_nMaxSessions;
|
||||
|
||||
|
||||
nsHashtable m_ProfileMap;
|
||||
nsHashtable m_SessionMap;
|
||||
nsMAPIConfiguration();
|
||||
|
||||
public :
|
||||
static nsMAPIConfiguration *GetMAPIConfiguration();
|
||||
void OpenConfiguration();
|
||||
PRInt16 RegisterSession(PRUint32 aHwnd, const PRUnichar *aUserName, \
|
||||
const PRUnichar *aPassword, PRBool aForceDownLoad, \
|
||||
PRBool aNewSession, PRUint32 *aSession, char *aIdKey);
|
||||
PRBool IsSessionValid(PRUint32 aSessionID);
|
||||
PRBool UnRegisterSession(PRUint32 aSessionID);
|
||||
PRUnichar *GetPassword(PRUint32 aSessionID);
|
||||
char *GetIdKey(PRUint32 aSessionID);
|
||||
~nsMAPIConfiguration();
|
||||
|
||||
// a util func
|
||||
static HRESULT GetMAPIErrorFromNSError (nsresult res) ;
|
||||
};
|
||||
|
||||
class nsMAPISession
|
||||
{
|
||||
friend class nsMAPIConfiguration;
|
||||
|
||||
private :
|
||||
|
||||
PRBool m_bIsForcedDownLoad;
|
||||
PRBool m_bApp_or_Service;
|
||||
PRUint32 m_hAppHandle;
|
||||
PRUint32 m_nShared;
|
||||
char *m_pIdKey;
|
||||
nsString m_pProfileName;
|
||||
nsString m_pPassword;
|
||||
|
||||
public :
|
||||
|
||||
nsMAPISession(PRUint32 aHwnd, const PRUnichar *aUserName, \
|
||||
const PRUnichar *aPassword, \
|
||||
PRBool aForceDownLoad, char *aKey);
|
||||
PRUint32 IncrementSession();
|
||||
PRUint32 DecrementSession();
|
||||
PRUint32 GetSessionCount();
|
||||
PRUnichar *nsMAPISession::GetPassword();
|
||||
char *nsMAPISession::GetIdKey();
|
||||
~nsMAPISession();
|
||||
};
|
||||
|
||||
#endif // MSG_MAPI_MAIN_H_
|
||||
209
mozilla/mailnews/mapi/mapihook/src/msgMapiSupport.cpp
Normal file
@@ -0,0 +1,209 @@
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is Mozilla
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corp.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2001
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s): Krishna Mohan Khandrika (kkhandrika@netscape.com)
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
#include "nsCOMPtr.h"
|
||||
#include "objbase.h"
|
||||
#include "nsISupports.h"
|
||||
|
||||
#include "nsIGenericFactory.h"
|
||||
#include "nsIObserverService.h"
|
||||
#include "nsIAppStartupNotifier.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsIComponentManager.h"
|
||||
#include "nsICategoryManager.h"
|
||||
|
||||
#include "nsIPrefService.h"
|
||||
#include "nsIPrefBranch.h"
|
||||
#include "nsIPrefBranchInternal.h"
|
||||
|
||||
#include "msgMapiSupport.h"
|
||||
#include "nsMapiRegistryUtils.h"
|
||||
#include "nsMapiRegistry.h"
|
||||
#include "msgMapiImp.h"
|
||||
|
||||
/** Implementation of the nsIMapiSupport interface.
|
||||
* Use standard implementation of nsISupports stuff.
|
||||
*/
|
||||
|
||||
NS_IMPL_THREADSAFE_ISUPPORTS2(nsMapiSupport, nsIMapiSupport, nsIObserver);
|
||||
|
||||
static NS_METHOD nsMapiRegistrationProc(nsIComponentManager *aCompMgr,
|
||||
nsIFile *aPath, const char *registryLocation, const char *componentType,
|
||||
const nsModuleComponentInfo *info)
|
||||
{
|
||||
|
||||
nsresult rv;
|
||||
|
||||
nsCOMPtr<nsICategoryManager> categoryManager(do_GetService(NS_CATEGORYMANAGER_CONTRACTID, &rv));
|
||||
if (NS_SUCCEEDED(rv))
|
||||
rv = categoryManager->AddCategoryEntry(APPSTARTUP_CATEGORY, "Mapi Support",
|
||||
"service," NS_IMAPISUPPORT_CONTRACTID, PR_TRUE, PR_TRUE, nsnull);
|
||||
|
||||
return rv ;
|
||||
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMapiSupport::Observe(nsISupports *aSubject, const char *aTopic, const PRUnichar *aData)
|
||||
{
|
||||
nsresult rv = NS_OK ;
|
||||
|
||||
if (!nsCRT::strcmp(aTopic, "profile-after-change"))
|
||||
return InitializeMAPISupport();
|
||||
|
||||
if (!nsCRT::strcmp(aTopic, NS_XPCOM_SHUTDOWN_OBSERVER_ID))
|
||||
return ShutdownMAPISupport();
|
||||
|
||||
if (!nsCRT::strcmp(aTopic, NS_PREFBRANCH_PREFCHANGE_TOPIC_ID))
|
||||
{
|
||||
nsCOMPtr<nsIPrefBranch> prefs = do_QueryInterface(aSubject, &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
// which preference changed?
|
||||
if (!nsCRT::strcmp(MAILNEWS_ALLOW_DEFAULT_MAIL_CLIENT, NS_ConvertUCS2toUTF8(aData).get()))
|
||||
{
|
||||
PRBool bIsDefault = PR_FALSE ;
|
||||
rv = prefs->GetBoolPref(MAILNEWS_ALLOW_DEFAULT_MAIL_CLIENT, &bIsDefault);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
nsCOMPtr <nsIMapiRegistry> mapiRegistry = do_CreateInstance(NS_IMAPIREGISTRY_CONTRACTID, &rv) ;
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
return mapiRegistry->SetIsDefaultMailClient(bIsDefault) ;
|
||||
}
|
||||
return rv ;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIObserverService> observerService(do_GetService("@mozilla.org/observer-service;1", &rv));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
rv = observerService->AddObserver(this,"profile-after-change", PR_FALSE);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
rv = observerService->AddObserver(this, NS_XPCOM_SHUTDOWN_OBSERVER_ID, PR_FALSE);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsCOMPtr<nsIPrefService> prefs = do_GetService(NS_PREFSERVICE_CONTRACTID, &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsCOMPtr<nsIPrefBranchInternal> prefInternal = do_QueryInterface(prefs, &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
rv = prefInternal->AddObserver(MAILNEWS_ALLOW_DEFAULT_MAIL_CLIENT, this, PR_FALSE);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
||||
nsMapiSupport::nsMapiSupport()
|
||||
: m_dwRegister(0),
|
||||
m_nsMapiFactory(nsnull)
|
||||
{
|
||||
NS_INIT_ISUPPORTS();
|
||||
}
|
||||
|
||||
nsMapiSupport::~nsMapiSupport()
|
||||
{
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMapiSupport::InitializeMAPISupport()
|
||||
{
|
||||
::CoInitialize(nsnull) ;
|
||||
|
||||
if (m_nsMapiFactory == nsnull) // No Registering if already done. Sanity Check!!
|
||||
{
|
||||
m_nsMapiFactory = new CMapiFactory();
|
||||
|
||||
if (m_nsMapiFactory != nsnull)
|
||||
{
|
||||
HRESULT hr = ::CoRegisterClassObject(CLSID_CMapiImp, \
|
||||
m_nsMapiFactory, \
|
||||
CLSCTX_LOCAL_SERVER, \
|
||||
REGCLS_MULTIPLEUSE, \
|
||||
&m_dwRegister);
|
||||
|
||||
if (FAILED(hr))
|
||||
{
|
||||
m_nsMapiFactory->Release() ;
|
||||
m_nsMapiFactory = nsnull;
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMapiSupport::ShutdownMAPISupport()
|
||||
{
|
||||
if (m_dwRegister != 0)
|
||||
::CoRevokeClassObject(m_dwRegister);
|
||||
|
||||
if (m_nsMapiFactory != nsnull)
|
||||
{
|
||||
m_nsMapiFactory->Release();
|
||||
m_nsMapiFactory = nsnull;
|
||||
}
|
||||
|
||||
::CoUninitialize();
|
||||
|
||||
return NS_OK ;
|
||||
}
|
||||
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsMapiRegistry);
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsMapiSupport);
|
||||
|
||||
// The list of components we register
|
||||
static nsModuleComponentInfo components[] =
|
||||
{
|
||||
{
|
||||
NS_IMAPIREGISTRY_CLASSNAME,
|
||||
NS_IMAPIREGISTRY_CID,
|
||||
NS_IMAPIREGISTRY_CONTRACTID,
|
||||
nsMapiRegistryConstructor
|
||||
},
|
||||
|
||||
{
|
||||
NS_IMAPISUPPORT_CLASSNAME,
|
||||
NS_IMAPISUPPORT_CID,
|
||||
NS_IMAPISUPPORT_CONTRACTID,
|
||||
nsMapiSupportConstructor,
|
||||
nsMapiRegistrationProc,
|
||||
nsnull
|
||||
}
|
||||
};
|
||||
|
||||
NS_IMPL_NSGETMODULE(msgMapiModule, components);
|
||||
|
||||
66
mozilla/mailnews/mapi/mapihook/src/msgMapiSupport.h
Normal file
@@ -0,0 +1,66 @@
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is Mozilla
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
# Netscape Communications Corp.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2001
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s): Krishna Mohan Khandrika (kkhandrika@netscape.com)
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef MSG_MAPI_SUPPORT_H_
|
||||
#define MSG_MAPI_SUPPORT_H_
|
||||
|
||||
#include "nsIObserver.h"
|
||||
#include "nsIMapiSupport.h"
|
||||
#include "msgMapiFactory.h"
|
||||
|
||||
#define NS_IMAPISUPPORT_CID \
|
||||
{0x8967fed2, 0xc8bb, 0x11d5, \
|
||||
{ 0xa3, 0xe9, 0x00, 0xb0, 0xd0, 0xf3, 0xba, 0xa7 }}
|
||||
|
||||
class nsMapiSupport : public nsIMapiSupport,
|
||||
public nsIObserver
|
||||
{
|
||||
public :
|
||||
nsMapiSupport();
|
||||
~nsMapiSupport();
|
||||
|
||||
// Declare all interface methods we must implement.
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSIOBSERVER
|
||||
NS_DECL_NSIMAPISUPPORT
|
||||
|
||||
private :
|
||||
|
||||
DWORD m_dwRegister;
|
||||
CMapiFactory *m_nsMapiFactory;
|
||||
};
|
||||
|
||||
#endif // MSG_MAPI_SUPPORT_H_
|
||||
167
mozilla/mailnews/mapi/mapihook/src/nsMapiRegistry.cpp
Normal file
@@ -0,0 +1,167 @@
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2001
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Srilatha Moturi <srilatha@netscape.com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsXPIDLString.h"
|
||||
#include "nsIPromptService.h"
|
||||
#include "nsIProxyObjectManager.h"
|
||||
#include "nsProxiedService.h"
|
||||
|
||||
#include "nsMapiRegistryUtils.h"
|
||||
#include "nsMapiRegistry.h"
|
||||
|
||||
static NS_DEFINE_CID(kStringBundleServiceCID, NS_STRINGBUNDLESERVICE_CID);
|
||||
|
||||
/** Implementation of the nsIMapiRegistry interface.
|
||||
* Use standard implementation of nsISupports stuff.
|
||||
*/
|
||||
NS_IMPL_ISUPPORTS1(nsMapiRegistry, nsIMapiRegistry);
|
||||
|
||||
nsMapiRegistry::nsMapiRegistry() {
|
||||
NS_INIT_ISUPPORTS();
|
||||
m_ShowDialog = ! m_registryUtils.verifyRestrictedAccess();
|
||||
m_DefaultMailClient = m_registryUtils.IsDefaultMailClient();
|
||||
}
|
||||
|
||||
nsMapiRegistry::~nsMapiRegistry() {
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMapiRegistry::GetIsDefaultMailClient(PRBool * retval) {
|
||||
// we need to get the value from registry everytime
|
||||
// because the registry settings can be changed from
|
||||
// other mail applications.
|
||||
*retval = m_registryUtils.IsDefaultMailClient();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMapiRegistry::GetShowDialog(PRBool * retval) {
|
||||
*retval = m_ShowDialog;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMapiRegistry::SetIsDefaultMailClient(PRBool aIsDefaultMailClient)
|
||||
{
|
||||
nsresult rv = NS_OK ;
|
||||
|
||||
if (aIsDefaultMailClient)
|
||||
{
|
||||
rv = m_registryUtils.setDefaultMailClient();
|
||||
if (NS_SUCCEEDED(rv))
|
||||
m_DefaultMailClient = PR_TRUE;
|
||||
else
|
||||
m_registryUtils.ShowMapiErrorDialog();
|
||||
}
|
||||
else
|
||||
{
|
||||
rv = m_registryUtils.unsetDefaultMailClient();
|
||||
if (NS_SUCCEEDED(rv))
|
||||
m_DefaultMailClient = PR_FALSE;
|
||||
else
|
||||
m_registryUtils.ShowMapiErrorDialog();
|
||||
}
|
||||
|
||||
return rv ;
|
||||
}
|
||||
|
||||
/** This will bring up the dialog box only once per session and
|
||||
* only if the current app is not default Mail Client.
|
||||
* This also checks the registry if the registry key
|
||||
* showMapiDialog is set
|
||||
*/
|
||||
NS_IMETHODIMP
|
||||
nsMapiRegistry::ShowMailIntegrationDialog(nsIDOMWindow *aParentWindow) {
|
||||
nsresult rv;
|
||||
if (!m_ShowDialog || !m_registryUtils.getShowDialog()) return NS_OK;
|
||||
nsCOMPtr<nsIPromptService> promptService(do_GetService(
|
||||
"@mozilla.org/embedcomp/prompt-service;1", &rv));
|
||||
if (NS_SUCCEEDED(rv) && promptService)
|
||||
{
|
||||
nsCOMPtr<nsIStringBundle> bundle;
|
||||
rv = m_registryUtils.MakeMapiStringBundle (getter_AddRefs (bundle)) ;
|
||||
if (NS_FAILED(rv)) return NS_ERROR_FAILURE;
|
||||
|
||||
nsXPIDLString dialogTitle;
|
||||
const PRUnichar *brandStrings[] = { m_registryUtils.brandName() };
|
||||
NS_NAMED_LITERAL_STRING(dialogTitlePropertyTag, "dialogTitle");
|
||||
rv = bundle->FormatStringFromName(dialogTitlePropertyTag.get(),
|
||||
brandStrings, 1,
|
||||
getter_Copies(dialogTitle));
|
||||
if (NS_FAILED(rv)) return NS_ERROR_FAILURE;
|
||||
|
||||
nsXPIDLString dialogText;
|
||||
NS_NAMED_LITERAL_STRING(dialogTextPropertyTag, "dialogText");
|
||||
rv = bundle->FormatStringFromName(dialogTextPropertyTag.get(),
|
||||
brandStrings, 1,
|
||||
getter_Copies(dialogText));
|
||||
if (NS_FAILED(rv)) return NS_ERROR_FAILURE;
|
||||
|
||||
nsXPIDLString checkboxText;
|
||||
rv = bundle->GetStringFromName(
|
||||
NS_LITERAL_STRING("checkboxText").get(),
|
||||
getter_Copies(checkboxText));
|
||||
if (NS_FAILED(rv)) return NS_ERROR_FAILURE;
|
||||
|
||||
PRBool checkValue = PR_FALSE;
|
||||
PRInt32 buttonPressed = 0;
|
||||
rv = promptService->ConfirmEx(aParentWindow,
|
||||
dialogTitle,
|
||||
dialogText.get(),
|
||||
(nsIPromptService::BUTTON_TITLE_YES *
|
||||
nsIPromptService::BUTTON_POS_0) +
|
||||
(nsIPromptService::BUTTON_TITLE_NO *
|
||||
nsIPromptService::BUTTON_POS_1),
|
||||
nsnull,
|
||||
nsnull,
|
||||
nsnull,
|
||||
checkboxText,
|
||||
&checkValue,
|
||||
&buttonPressed);
|
||||
if (NS_FAILED(rv)) return NS_ERROR_FAILURE;
|
||||
rv = m_registryUtils.SetRegistryKey(HKEY_LOCAL_MACHINE, "Software\\Mozilla\\Desktop",
|
||||
"showMapiDialog", (checkValue) ? "0" : "1");
|
||||
if (NS_FAILED(rv)) return NS_ERROR_FAILURE;
|
||||
|
||||
m_ShowDialog = PR_FALSE;
|
||||
if (!buttonPressed)
|
||||
rv = SetIsDefaultMailClient(PR_TRUE) ; // SetDefaultMailClient();
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
76
mozilla/mailnews/mapi/mapihook/src/nsMapiRegistry.h
Normal file
@@ -0,0 +1,76 @@
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2001
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Srilatha Moturi <srilatha@netscape.com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef nsmapiregistry_h____
|
||||
#define nsmapiregistry_h____
|
||||
|
||||
#include "nsIMapiRegistry.h"
|
||||
|
||||
#ifndef MAX_BUF
|
||||
#define MAX_BUF 4096
|
||||
#endif
|
||||
|
||||
/* c5be14ba-4e0a-4eec-a1b8-04363761d63c */
|
||||
#define NS_IMAPIREGISTRY_CID \
|
||||
{ 0xc5be14ba, 0x4e0a, 0x4eec, {0xa1, 0xb8, 0x04, 0x36, 0x37, 0x61, 0xd6, 0x3c} }
|
||||
#define NS_IMAPIREGISTRY_CONTRACTID "@mozilla.org/mapiregistry;1"
|
||||
#define NS_IMAPIREGISTRY_CLASSNAME "Mozilla MAPI Registry"
|
||||
|
||||
#define MAILNEWS_ALLOW_DEFAULT_MAIL_CLIENT "mailnews.default_mail_client"
|
||||
|
||||
class nsMapiRegistry : public nsIMapiRegistry {
|
||||
public:
|
||||
// ctor/dtor
|
||||
nsMapiRegistry();
|
||||
virtual ~nsMapiRegistry();
|
||||
|
||||
// Declare all interface methods we must implement.
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSIMAPIREGISTRY
|
||||
|
||||
protected:
|
||||
|
||||
PRBool m_DefaultMailClient;
|
||||
PRBool m_ShowDialog;
|
||||
nsMapiRegistryUtils m_registryUtils ;
|
||||
|
||||
private:
|
||||
// Special member to handle initialization.
|
||||
PRBool mHaveBeenSet;
|
||||
}; // nsMapiRegistry
|
||||
|
||||
#endif // nsmapiregistry_h____
|
||||
743
mozilla/mailnews/mapi/mapihook/src/nsMapiRegistryUtils.cpp
Normal file
@@ -0,0 +1,743 @@
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2001
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Srilatha Moturi <srilatha@netscape.com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#undef UNICODE
|
||||
#undef _UNICODE
|
||||
|
||||
#include "nsIServiceManager.h"
|
||||
#include "msgMapiImp.h"
|
||||
#include "msgMapiMain.h"
|
||||
#include "nsMapiRegistryUtils.h"
|
||||
#include "nsString.h"
|
||||
#include "nsIStringBundle.h"
|
||||
#include "nsIPromptService.h"
|
||||
#include "nsXPIDLString.h"
|
||||
#include "nsSpecialSystemDirectory.h"
|
||||
#include "nsDirectoryService.h"
|
||||
#include "nsDirectoryServiceDefs.h"
|
||||
#include "nsAppDirectoryServiceDefs.h"
|
||||
#include "nsIPref.h"
|
||||
|
||||
static NS_DEFINE_CID(kStringBundleServiceCID, NS_STRINGBUNDLESERVICE_CID);
|
||||
|
||||
#define EXE_EXTENSION ".exe"
|
||||
#define USERAGENT_VERSION_PREF "general.useragent.misc"
|
||||
#define USERAGENT_VERSION_NS_PREF "general.useragent.vendorSub"
|
||||
#define USERAGENT_PREF_PREFIX "rv:"
|
||||
|
||||
nsMapiRegistryUtils::nsMapiRegistryUtils()
|
||||
{
|
||||
m_mapiStringBundle = nsnull ;
|
||||
}
|
||||
|
||||
const char * nsMapiRegistryUtils::thisApplication()
|
||||
{
|
||||
if (m_thisApp.IsEmpty()) {
|
||||
char buffer[MAX_PATH] = {0};
|
||||
DWORD len = ::GetModuleFileName(NULL, buffer, MAX_PATH);
|
||||
if (!len) return nsnull ;
|
||||
char shortPathBuf[MAX_PATH] = {0};
|
||||
len = ::GetShortPathName(buffer, shortPathBuf, MAX_PATH);
|
||||
if (!len) return nsnull ;
|
||||
m_thisApp = buffer;
|
||||
m_thisApp.ToUpperCase();
|
||||
}
|
||||
|
||||
return m_thisApp.get() ;
|
||||
}
|
||||
|
||||
const PRUnichar * nsMapiRegistryUtils::brandName()
|
||||
{
|
||||
nsresult rv;
|
||||
if (m_brand.IsEmpty()) {
|
||||
nsCOMPtr<nsIStringBundleService> bundleService(do_GetService(
|
||||
kStringBundleServiceCID, &rv));
|
||||
if (NS_SUCCEEDED(rv) && bundleService) {
|
||||
nsCOMPtr<nsIStringBundle> brandBundle;
|
||||
rv = bundleService->CreateBundle(
|
||||
"chrome://global/locale/brand.properties",
|
||||
getter_AddRefs(brandBundle));
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsXPIDLString brandName;
|
||||
rv = brandBundle->GetStringFromName(
|
||||
NS_LITERAL_STRING("brandShortName").get(),
|
||||
getter_Copies(brandName));
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
m_brand = brandName ;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return m_brand.get() ;
|
||||
}
|
||||
|
||||
const PRUnichar * nsMapiRegistryUtils::versionNo()
|
||||
{
|
||||
if (!m_versionNo.IsEmpty())
|
||||
return m_versionNo.get() ;
|
||||
|
||||
nsCOMPtr<nsIPref> prefs = do_GetService(NS_PREF_CONTRACTID);
|
||||
if (prefs) {
|
||||
nsXPIDLCString versionStr ;
|
||||
nsresult rv = prefs->GetCharPref(USERAGENT_VERSION_NS_PREF, getter_Copies(versionStr));
|
||||
if (NS_SUCCEEDED(rv) && versionStr)
|
||||
m_versionNo.AssignWithConversion (versionStr.get()) ;
|
||||
else {
|
||||
rv = prefs->GetCharPref(USERAGENT_VERSION_PREF, getter_Copies(versionStr));
|
||||
if (NS_SUCCEEDED(rv) && versionStr) {
|
||||
m_versionNo.AssignWithConversion (versionStr.get()) ;
|
||||
m_versionNo.StripChars (USERAGENT_PREF_PREFIX) ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return m_versionNo.get() ;
|
||||
}
|
||||
|
||||
|
||||
PRBool nsMapiRegistryUtils::verifyRestrictedAccess() {
|
||||
char subKey[] = "Software\\Mozilla - Test Key";
|
||||
PRBool result = PR_FALSE;
|
||||
DWORD dwDisp = 0;
|
||||
HKEY key;
|
||||
// Try to create/open a subkey under HKLM.
|
||||
DWORD rc = ::RegCreateKeyEx(HKEY_LOCAL_MACHINE,
|
||||
subKey,
|
||||
0,
|
||||
NULL,
|
||||
REG_OPTION_NON_VOLATILE,
|
||||
KEY_WRITE,
|
||||
NULL,
|
||||
&key,
|
||||
&dwDisp);
|
||||
|
||||
if (rc == ERROR_SUCCESS) {
|
||||
// Key was opened; first close it.
|
||||
::RegCloseKey(key);
|
||||
// Delete it if we just created it.
|
||||
switch(dwDisp) {
|
||||
case REG_CREATED_NEW_KEY:
|
||||
::RegDeleteKey(HKEY_LOCAL_MACHINE, subKey);
|
||||
break;
|
||||
case REG_OPENED_EXISTING_KEY:
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
// Can't create/open it; we don't have access.
|
||||
result = PR_TRUE;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
nsresult nsMapiRegistryUtils::SetRegistryKey(HKEY baseKey, const char * keyName,
|
||||
const char * valueName, char * value)
|
||||
{
|
||||
nsresult result = NS_ERROR_FAILURE;
|
||||
HKEY key;
|
||||
LONG rc = ::RegCreateKey(baseKey, keyName, &key);
|
||||
|
||||
if (rc == ERROR_SUCCESS) {
|
||||
rc = ::RegSetValueEx(key, valueName, NULL, REG_SZ,
|
||||
(LPBYTE)(const char*)value, strlen(value));
|
||||
if (rc == ERROR_SUCCESS) {
|
||||
result = NS_OK;
|
||||
}
|
||||
::RegCloseKey(key);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
nsresult nsMapiRegistryUtils::DeleteRegistryValue(HKEY baseKey, const char * keyName,
|
||||
const char * valueName)
|
||||
{
|
||||
nsresult result = NS_ERROR_FAILURE;
|
||||
HKEY key;
|
||||
LONG rc = ::RegOpenKey(baseKey, keyName, &key);
|
||||
|
||||
if (rc == ERROR_SUCCESS) {
|
||||
rc = ::RegDeleteValue(key, valueName);
|
||||
if (rc == ERROR_SUCCESS)
|
||||
result = NS_OK;
|
||||
::RegCloseKey(key);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
void nsMapiRegistryUtils::GetRegistryKey(HKEY baseKey, const char * keyName,
|
||||
const char * valueName, nsCAutoString & value)
|
||||
{
|
||||
HKEY key;
|
||||
LONG rc = ::RegOpenKey(baseKey, keyName, &key);
|
||||
if (rc == ERROR_SUCCESS) {
|
||||
char buffer[MAX_PATH] = {0};
|
||||
DWORD len = sizeof buffer;
|
||||
rc = ::RegQueryValueEx(key, valueName, NULL, NULL,
|
||||
(LPBYTE)buffer, &len);
|
||||
if (rc == ERROR_SUCCESS) {
|
||||
if (len)
|
||||
value = buffer;
|
||||
}
|
||||
::RegCloseKey(key);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
PRBool nsMapiRegistryUtils::IsDefaultMailClient()
|
||||
{
|
||||
if (!isSmartDll() && !isMozDll())
|
||||
return PR_FALSE;
|
||||
nsCAutoString name;
|
||||
GetRegistryKey(HKEY_LOCAL_MACHINE, "Software\\Clients\\Mail", "", name);
|
||||
if (!name.IsEmpty()) {
|
||||
nsCAutoString keyName("Software\\Clients\\Mail\\");
|
||||
keyName += name.get();
|
||||
keyName += "\\protocols\\mailto\\shell\\open\\command";
|
||||
|
||||
nsCAutoString result;
|
||||
GetRegistryKey(HKEY_LOCAL_MACHINE, keyName.get(), "", result);
|
||||
if (!result.IsEmpty()) {
|
||||
nsCAutoString strExtension;
|
||||
strExtension.Assign(EXE_EXTENSION);
|
||||
result.ToUpperCase();
|
||||
strExtension.ToUpperCase();
|
||||
PRInt32 index = result.RFind(strExtension.get());
|
||||
if (index != kNotFound) {
|
||||
result.Truncate(index + strExtension.Length());
|
||||
}
|
||||
nsCAutoString thisApp (thisApplication()) ;
|
||||
return (result == thisApp);
|
||||
}
|
||||
}
|
||||
return PR_FALSE;
|
||||
|
||||
}
|
||||
|
||||
nsresult nsMapiRegistryUtils::saveDefaultMailClient()
|
||||
{
|
||||
nsresult rv;
|
||||
nsCAutoString name ;
|
||||
GetRegistryKey(HKEY_LOCAL_MACHINE,"Software\\Clients\\Mail", "", name);
|
||||
if (!name.IsEmpty()) {
|
||||
rv = SetRegistryKey(HKEY_LOCAL_MACHINE,
|
||||
"Software\\Mozilla\\Desktop",
|
||||
"HKEY_LOCAL_MACHINE\\Software\\Clients\\Mail",
|
||||
(char *)name.get());
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsCAutoString keyName("Software\\Clients\\Mail\\");
|
||||
keyName += name.get();
|
||||
keyName += "\\protocols\\mailto\\shell\\open\\command";
|
||||
nsCAutoString appPath ;
|
||||
GetRegistryKey(HKEY_LOCAL_MACHINE, keyName.get(), "", appPath);
|
||||
if (!appPath.IsEmpty()) {
|
||||
nsCAutoString stringName("HKEY_LOCAL_MACHINE\\");
|
||||
stringName += keyName.get();
|
||||
rv = SetRegistryKey(HKEY_LOCAL_MACHINE,
|
||||
"Software\\Mozilla\\Desktop",
|
||||
stringName.get(), (char *)appPath.get());
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
rv = SetRegistryKey(HKEY_LOCAL_MACHINE,
|
||||
"Software\\Mozilla\\Desktop",
|
||||
"HKEY_LOCAL_MACHINE\\Software\\Clients\\Mail",
|
||||
"");
|
||||
return rv;
|
||||
}
|
||||
|
||||
nsresult nsMapiRegistryUtils::saveUserDefaultMailClient()
|
||||
{
|
||||
nsresult rv;
|
||||
nsCAutoString name ;
|
||||
GetRegistryKey(HKEY_CURRENT_USER,"Software\\Clients\\Mail", "", name);
|
||||
if (!name.IsEmpty()) {
|
||||
rv = SetRegistryKey(HKEY_LOCAL_MACHINE,
|
||||
"Software\\Mozilla\\Desktop",
|
||||
"HKEY_CURRENT_USER\\Software\\Clients\\Mail",
|
||||
(char *)name.get());
|
||||
}
|
||||
else {
|
||||
rv = SetRegistryKey(HKEY_LOCAL_MACHINE,
|
||||
"Software\\Mozilla\\Desktop",
|
||||
"HKEY_CURRENT_USER\\Software\\Clients\\Mail",
|
||||
"");
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check whether it is a smart dll or not. Smart dll is the one installed by
|
||||
* IE5 or Outlook Express which forwards the MAPI calls to the dll based on the
|
||||
* registry key setttings.
|
||||
* Returns TRUE if is a smart dll.
|
||||
*/
|
||||
|
||||
typedef HRESULT (FAR PASCAL GetOutlookVersionFunc)();
|
||||
PRBool nsMapiRegistryUtils::isSmartDll()
|
||||
{
|
||||
char buffer[MAX_PATH] = {0};
|
||||
if (GetSystemDirectory(buffer, sizeof(buffer)) == 0)
|
||||
return PR_FALSE;
|
||||
PL_strcatn(buffer, sizeof(buffer), "\\Mapi32.dll");
|
||||
|
||||
HINSTANCE hInst;
|
||||
GetOutlookVersionFunc *doesExist = nsnull;
|
||||
hInst = LoadLibrary(buffer);
|
||||
if (hInst == nsnull)
|
||||
return PR_FALSE;
|
||||
|
||||
doesExist = (GetOutlookVersionFunc *) GetProcAddress (hInst, "GetOutlookVersion");
|
||||
FreeLibrary(hInst);
|
||||
|
||||
return (doesExist != nsnull);
|
||||
}
|
||||
|
||||
typedef HRESULT (FAR PASCAL GetMapiDllVersion)();
|
||||
/**
|
||||
* Checks whether mapi32.dll is installed by this app.
|
||||
* Returns TRUE if it is.
|
||||
*/
|
||||
PRBool nsMapiRegistryUtils::isMozDll()
|
||||
{
|
||||
char buffer[MAX_PATH] = {0};
|
||||
if (GetSystemDirectory(buffer, sizeof(buffer)) == 0)
|
||||
return PR_FALSE;
|
||||
PL_strcatn(buffer, sizeof(buffer), "\\Mapi32.dll");
|
||||
|
||||
HINSTANCE hInst;
|
||||
GetMapiDllVersion *doesExist = nsnull;
|
||||
hInst = LoadLibrary(buffer);
|
||||
if (hInst == nsnull)
|
||||
return PR_FALSE;
|
||||
|
||||
doesExist = (GetMapiDllVersion *) GetProcAddress (hInst, "GetMapiDllVersion");
|
||||
FreeLibrary(hInst);
|
||||
|
||||
return (doesExist != nsnull);
|
||||
}
|
||||
|
||||
/** Renames Mapi32.dl in system directory to Mapi32_moz_bak.dll
|
||||
* copies the mozMapi32.dll from bin directory to the system directory
|
||||
*/
|
||||
nsresult nsMapiRegistryUtils::CopyMozMapiToWinSysDir()
|
||||
{
|
||||
nsresult rv;
|
||||
char buffer[MAX_PATH] = {0};
|
||||
if (GetSystemDirectory(buffer, sizeof(buffer)) == 0)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
nsCAutoString filePath(buffer);
|
||||
filePath.Append("\\Mapi32_moz_bak.dll");
|
||||
|
||||
nsCOMPtr<nsILocalFile> pCurrentMapiFile = do_CreateInstance (NS_LOCAL_FILE_CONTRACTID, &rv);
|
||||
if (NS_FAILED(rv) || !pCurrentMapiFile) return rv;
|
||||
pCurrentMapiFile->InitWithPath(filePath.get());
|
||||
|
||||
nsCOMPtr<nsIFile> pMozMapiFile;
|
||||
nsCOMPtr<nsIProperties> directoryService =
|
||||
do_GetService(NS_DIRECTORY_SERVICE_CONTRACTID, &rv);
|
||||
if (!directoryService) return NS_ERROR_FAILURE;
|
||||
rv = directoryService->Get(NS_OS_CURRENT_PROCESS_DIR,
|
||||
NS_GET_IID(nsIFile),
|
||||
getter_AddRefs(pMozMapiFile));
|
||||
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
pMozMapiFile->Append("mozMapi32.dll");
|
||||
|
||||
PRBool bExist;
|
||||
rv = pMozMapiFile->Exists(&bExist);
|
||||
if (NS_FAILED(rv) || !bExist) return rv;
|
||||
|
||||
rv = pCurrentMapiFile->Exists(&bExist);
|
||||
if (NS_SUCCEEDED(rv) && bExist)
|
||||
{
|
||||
rv = pCurrentMapiFile->Remove(PR_FALSE);
|
||||
}
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
filePath.Assign(buffer);
|
||||
filePath.Append("\\Mapi32.dll");
|
||||
pCurrentMapiFile->InitWithPath(filePath.get());
|
||||
rv = pCurrentMapiFile->Exists(&bExist);
|
||||
if (NS_SUCCEEDED(rv) && bExist)
|
||||
{
|
||||
rv = pCurrentMapiFile->MoveTo(nsnull, "Mapi32_moz_bak.dll");
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
nsCAutoString fullFilePath(buffer);
|
||||
fullFilePath.Append("\\Mapi32_moz_bak.dll");
|
||||
rv = SetRegistryKey(HKEY_LOCAL_MACHINE,
|
||||
"Software\\Mozilla\\Desktop",
|
||||
"Mapi_backup_dll",
|
||||
(char *)fullFilePath.get());
|
||||
if (NS_FAILED(rv)) {
|
||||
RestoreBackedUpMapiDll();
|
||||
return rv;
|
||||
}
|
||||
}
|
||||
|
||||
NS_NAMED_LITERAL_STRING(fileName, "Mapi32.dll");
|
||||
filePath.Assign(buffer);
|
||||
pCurrentMapiFile->InitWithPath(filePath.get());
|
||||
rv = pMozMapiFile->CopyToUnicode(pCurrentMapiFile, fileName.get());
|
||||
if (NS_FAILED(rv))
|
||||
RestoreBackedUpMapiDll();
|
||||
return rv;
|
||||
}
|
||||
|
||||
/** deletes the Mapi32.dll in system directory and renames Mapi32_moz_bak.dll
|
||||
* to Mapi32.dll
|
||||
*/
|
||||
nsresult nsMapiRegistryUtils::RestoreBackedUpMapiDll()
|
||||
{
|
||||
nsresult rv;
|
||||
char buffer[MAX_PATH] = {0};
|
||||
if (GetSystemDirectory(buffer, sizeof(buffer)) == 0)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
nsCAutoString filePath(buffer);
|
||||
nsCAutoString previousFileName(buffer);
|
||||
filePath.Append("\\Mapi32.dll");
|
||||
previousFileName.Append("\\Mapi32_moz_bak.dll");
|
||||
|
||||
nsCOMPtr <nsILocalFile> pCurrentMapiFile = do_CreateInstance(NS_LOCAL_FILE_CONTRACTID, &rv);
|
||||
if (NS_FAILED(rv) || !pCurrentMapiFile) return NS_ERROR_FAILURE;
|
||||
pCurrentMapiFile->InitWithPath(filePath.get());
|
||||
|
||||
nsCOMPtr<nsILocalFile> pPreviousMapiFile = do_CreateInstance (NS_LOCAL_FILE_CONTRACTID, &rv);
|
||||
if (NS_FAILED(rv) || !pPreviousMapiFile) return NS_ERROR_FAILURE;
|
||||
pPreviousMapiFile->InitWithPath(previousFileName.get());
|
||||
|
||||
PRBool bExist;
|
||||
rv = pCurrentMapiFile->Exists(&bExist);
|
||||
if (NS_SUCCEEDED(rv) && bExist) {
|
||||
rv = pCurrentMapiFile->Remove(PR_FALSE);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
}
|
||||
|
||||
rv = pPreviousMapiFile->Exists(&bExist);
|
||||
if (NS_SUCCEEDED(rv) && bExist)
|
||||
rv = pPreviousMapiFile->MoveTo(nsnull, "Mapi32.dll");
|
||||
if (NS_SUCCEEDED(rv))
|
||||
DeleteRegistryValue(HKEY_LOCAL_MACHINE,
|
||||
"Software\\Mozilla\\Desktop",
|
||||
"Mapi_backup_dll");
|
||||
return rv;
|
||||
}
|
||||
|
||||
/** Sets Mozilla as default Mail Client
|
||||
*/
|
||||
nsresult nsMapiRegistryUtils::setDefaultMailClient()
|
||||
{
|
||||
nsresult rv;
|
||||
nsresult mailKeySet=NS_ERROR_FAILURE;
|
||||
if (verifyRestrictedAccess()) return NS_ERROR_FAILURE;
|
||||
if (!isSmartDll()) {
|
||||
if (NS_FAILED(CopyMozMapiToWinSysDir())) return NS_ERROR_FAILURE;
|
||||
}
|
||||
rv = saveDefaultMailClient();
|
||||
if (NS_FAILED(saveUserDefaultMailClient()) ||
|
||||
NS_FAILED(rv)) return NS_ERROR_FAILURE;
|
||||
nsCAutoString keyName("Software\\Clients\\Mail\\");
|
||||
|
||||
nsCAutoString appName (NS_ConvertUCS2toUTF8(brandName()).get());
|
||||
if (!appName.IsEmpty()) {
|
||||
keyName.Append(appName.get());
|
||||
|
||||
nsCOMPtr<nsIStringBundle> bundle;
|
||||
rv = MakeMapiStringBundle (getter_AddRefs (bundle)) ;
|
||||
if (NS_FAILED(rv)) return NS_ERROR_FAILURE;
|
||||
|
||||
nsXPIDLString defaultMailTitle;
|
||||
const PRUnichar *keyValuePrefixStr[] = { brandName(), versionNo() };
|
||||
NS_NAMED_LITERAL_STRING(defaultMailTitleTag, "defaultMailDisplayTitle");
|
||||
rv = bundle->FormatStringFromName(defaultMailTitleTag.get(),
|
||||
keyValuePrefixStr, 2,
|
||||
getter_Copies(defaultMailTitle));
|
||||
if (NS_FAILED(rv)) return NS_ERROR_FAILURE;
|
||||
|
||||
rv = SetRegistryKey(HKEY_LOCAL_MACHINE,
|
||||
keyName.get(),
|
||||
"", NS_CONST_CAST(char *, NS_ConvertUCS2toUTF8(defaultMailTitle).get()) ) ;
|
||||
}
|
||||
else
|
||||
rv = NS_ERROR_FAILURE;
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsCAutoString thisApp (thisApplication()) ;
|
||||
if (NS_FAILED(rv)) return rv ;
|
||||
|
||||
nsCAutoString dllPath (thisApp) ;
|
||||
PRInt32 index = dllPath.RFind("\\");
|
||||
if (index != kNotFound)
|
||||
dllPath.Truncate(index + 1);
|
||||
dllPath += "mozMapi32.dll";
|
||||
rv = SetRegistryKey(HKEY_LOCAL_MACHINE,
|
||||
keyName.get(), "DLLPath",
|
||||
(char *)dllPath.get());
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
keyName.Append("\\protocols\\mailto");
|
||||
rv = SetRegistryKey(HKEY_LOCAL_MACHINE,
|
||||
keyName.get(),
|
||||
"", "URL:MailTo Protocol");
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsCAutoString appPath (thisApp);
|
||||
appPath += " \"%1\"";
|
||||
keyName.Append("\\shell\\open\\command");
|
||||
rv = SetRegistryKey(HKEY_LOCAL_MACHINE,
|
||||
keyName.get(),
|
||||
"", (char *)appPath.get());
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
rv = SetRegistryKey(HKEY_LOCAL_MACHINE,
|
||||
"Software\\Clients\\Mail",
|
||||
"", (char *)appName.get());
|
||||
}
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsCAutoString mailAppPath(thisApp);
|
||||
mailAppPath += " -mail";
|
||||
nsCAutoString appKeyName ("Software\\Clients\\Mail\\");
|
||||
appKeyName.Append(appName.get());
|
||||
appKeyName.Append("\\shell\\open\\command");
|
||||
rv = SetRegistryKey(HKEY_LOCAL_MACHINE,
|
||||
appKeyName.get(),
|
||||
"", (char *)mailAppPath.get());
|
||||
}
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsCAutoString iconPath(thisApp);
|
||||
iconPath += ",0";
|
||||
nsCAutoString iconKeyName ("Software\\Clients\\Mail\\");
|
||||
iconKeyName.Append(appName.get());
|
||||
iconKeyName.Append("\\DefaultIcon");
|
||||
mailKeySet = SetRegistryKey(HKEY_LOCAL_MACHINE,
|
||||
iconKeyName.get(),
|
||||
"", (char *)iconPath.get());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (NS_SUCCEEDED(mailKeySet)) {
|
||||
nsresult desktopKeySet = SetRegistryKey(HKEY_CURRENT_USER,
|
||||
"Software\\Clients\\Mail",
|
||||
"", (char *)appName.get());
|
||||
if (NS_SUCCEEDED(desktopKeySet)) {
|
||||
desktopKeySet = SetRegistryKey(HKEY_LOCAL_MACHINE,
|
||||
"Software\\Mozilla\\Desktop",
|
||||
"defaultMailHasBeenSet", "1");
|
||||
}
|
||||
::SendMessage(HWND_BROADCAST, WM_SETTINGCHANGE, 0,
|
||||
(LPARAM)"Software\\Clients\\Mail");
|
||||
RegisterServer(CLSID_CMapiImp, "Mozilla MAPI", "mozMapi", "mozMapi.1");
|
||||
return desktopKeySet;
|
||||
}
|
||||
|
||||
return mailKeySet;
|
||||
}
|
||||
|
||||
/** Removes Mozilla as the default Mail client and restores the previous setting
|
||||
*/
|
||||
nsresult nsMapiRegistryUtils::unsetDefaultMailClient() {
|
||||
nsresult result = NS_OK;
|
||||
nsresult mailKeySet = NS_ERROR_FAILURE;
|
||||
if (verifyRestrictedAccess()) return NS_ERROR_FAILURE;
|
||||
if (!isSmartDll()) {
|
||||
if (NS_FAILED(RestoreBackedUpMapiDll())) return NS_ERROR_FAILURE;
|
||||
}
|
||||
nsCAutoString name ;
|
||||
GetRegistryKey(HKEY_LOCAL_MACHINE, "Software\\Mozilla\\Desktop",
|
||||
"HKEY_LOCAL_MACHINE\\Software\\Clients\\Mail", name);
|
||||
nsCAutoString appName (NS_ConvertUCS2toUTF8(brandName()).get());
|
||||
|
||||
if (!name.IsEmpty() && !appName.IsEmpty() && name.Equals(appName)) {
|
||||
nsCAutoString keyName("HKEY_LOCAL_MACHINE\\Software\\Clients\\Mail\\");
|
||||
keyName.Append(appName.get());
|
||||
keyName.Append("\\protocols\\mailto\\shell\\open\\command");
|
||||
nsCAutoString appPath ;
|
||||
GetRegistryKey(HKEY_LOCAL_MACHINE, "Software\\Mozilla\\Desktop",
|
||||
keyName.get(), appPath);
|
||||
if (!appPath.IsEmpty()) {
|
||||
keyName.Assign("Software\\Clients\\Mail\\");
|
||||
keyName.Append(appName.get());
|
||||
keyName.Append("\\protocols\\mailto\\shell\\open\\command");
|
||||
result = SetRegistryKey(HKEY_LOCAL_MACHINE,
|
||||
keyName.get(),
|
||||
"", (char *)appPath.get());
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
PRInt32 index = appPath.RFind("\\");
|
||||
if (index != kNotFound)
|
||||
appPath.Truncate(index + 1);
|
||||
appPath += "mozMapi32.dll";
|
||||
keyName.Assign("Software\\Clients\\Mail\\");
|
||||
keyName.Append(appName.get());
|
||||
result = SetRegistryKey(HKEY_LOCAL_MACHINE,
|
||||
keyName.get(),
|
||||
"DLLPath", (char *) appPath.get());
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!name.IsEmpty()) {
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
mailKeySet = SetRegistryKey(HKEY_LOCAL_MACHINE,
|
||||
"Software\\Clients\\Mail",
|
||||
"", (char *)name.get());
|
||||
}
|
||||
}
|
||||
else
|
||||
mailKeySet = SetRegistryKey(HKEY_LOCAL_MACHINE,
|
||||
"Software\\Clients\\Mail",
|
||||
"", "");
|
||||
|
||||
if (NS_SUCCEEDED(mailKeySet)) {
|
||||
nsCAutoString userAppName ;
|
||||
GetRegistryKey(HKEY_LOCAL_MACHINE,
|
||||
"Software\\Mozilla\\Desktop",
|
||||
"HKEY_CURRENT_USER\\Software\\Clients\\Mail", userAppName);
|
||||
nsresult desktopKeySet = NS_OK;
|
||||
if (!userAppName.IsEmpty()) {
|
||||
desktopKeySet = SetRegistryKey(HKEY_CURRENT_USER,
|
||||
"Software\\Clients\\Mail",
|
||||
"", (char *)userAppName.get());
|
||||
}
|
||||
else {
|
||||
DeleteRegistryValue(HKEY_CURRENT_USER, "Software\\Clients\\Mail", "");
|
||||
}
|
||||
if (NS_SUCCEEDED(desktopKeySet)) {
|
||||
desktopKeySet = SetRegistryKey(HKEY_LOCAL_MACHINE,
|
||||
"Software\\Mozilla\\Desktop",
|
||||
"defaultMailHasBeenSet", "0");
|
||||
}
|
||||
::SendMessage(HWND_BROADCAST, WM_SETTINGCHANGE, 0,
|
||||
(LPARAM)"Software\\Clients\\Mail");
|
||||
UnregisterServer(CLSID_CMapiImp, "mozMapi", "mozMapi.1");
|
||||
return desktopKeySet;
|
||||
}
|
||||
return mailKeySet;
|
||||
}
|
||||
|
||||
/** Returns FALSE if showMapiDialog is set to 0.
|
||||
* Returns TRUE otherwise
|
||||
* Also returns TRUE if the Mozilla has been set as the default mail client
|
||||
* and some other application has changed that setting.
|
||||
* This function gets called only if the current app is not the default mail
|
||||
* client
|
||||
*/
|
||||
PRBool nsMapiRegistryUtils::getShowDialog() {
|
||||
PRBool rv = PR_FALSE;
|
||||
nsCAutoString showDialog ;
|
||||
GetRegistryKey(HKEY_LOCAL_MACHINE, "Software\\Mozilla\\Desktop",
|
||||
"showMapiDialog", showDialog);
|
||||
// if the user has not selected the checkbox, show dialog
|
||||
if (showDialog.IsEmpty() || showDialog.Equals("1"))
|
||||
rv = PR_TRUE;
|
||||
|
||||
if (!rv) {
|
||||
// even if the user has selected the checkbox
|
||||
// show it if some other application has changed the
|
||||
// default setting.
|
||||
nsCAutoString setMailDefault ;
|
||||
GetRegistryKey(HKEY_LOCAL_MACHINE,"Software\\Mozilla\\Desktop",
|
||||
"defaultMailHasBeenSet", setMailDefault);
|
||||
if (setMailDefault.Equals("1")) {
|
||||
// need to reset the defaultMailHasBeenSet to "0"
|
||||
// so that after the dialog is displayed once,
|
||||
// we do not keep displaying this dialog after the user has
|
||||
// selected the checkbox
|
||||
rv = SetRegistryKey(HKEY_LOCAL_MACHINE,
|
||||
"Software\\Mozilla\\Desktop",
|
||||
"defaultMailHasBeenSet", "0");
|
||||
rv = PR_TRUE;
|
||||
}
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
nsresult nsMapiRegistryUtils::MakeMapiStringBundle(nsIStringBundle ** aMapiStringBundle)
|
||||
{
|
||||
nsresult rv = NS_OK ;
|
||||
|
||||
if (m_mapiStringBundle)
|
||||
{
|
||||
*aMapiStringBundle = m_mapiStringBundle ;
|
||||
NS_ADDREF(*aMapiStringBundle);
|
||||
return rv ;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIStringBundleService> bundleService(do_GetService(
|
||||
kStringBundleServiceCID, &rv));
|
||||
if (NS_FAILED(rv) || !bundleService) return NS_ERROR_FAILURE;
|
||||
|
||||
rv = bundleService->CreateBundle(
|
||||
MAPI_PROPERTIES_CHROME,
|
||||
getter_AddRefs(m_mapiStringBundle));
|
||||
if (NS_FAILED(rv)) return NS_ERROR_FAILURE;
|
||||
|
||||
NS_ADDREF(*aMapiStringBundle = m_mapiStringBundle) ;
|
||||
|
||||
return rv ;
|
||||
}
|
||||
|
||||
nsresult nsMapiRegistryUtils::ShowMapiErrorDialog()
|
||||
{
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIPromptService> promptService(do_GetService(
|
||||
"@mozilla.org/embedcomp/prompt-service;1", &rv));
|
||||
if (NS_SUCCEEDED(rv) && promptService)
|
||||
{
|
||||
nsCOMPtr<nsIStringBundle> bundle;
|
||||
rv = MakeMapiStringBundle (getter_AddRefs (bundle)) ;
|
||||
if (NS_FAILED(rv)) return NS_ERROR_FAILURE;
|
||||
|
||||
nsXPIDLString dialogTitle;
|
||||
const PRUnichar *brandStrings[] = { brandName() };
|
||||
NS_NAMED_LITERAL_STRING(dialogTitlePropertyTag, "errorMessageTitle");
|
||||
rv = bundle->FormatStringFromName(dialogTitlePropertyTag.get(),
|
||||
brandStrings, 1,
|
||||
getter_Copies(dialogTitle));
|
||||
if (NS_FAILED(rv)) return NS_ERROR_FAILURE;
|
||||
|
||||
nsXPIDLString dialogText;
|
||||
NS_NAMED_LITERAL_STRING(dialogTextPropertyTag, "errorMessage");
|
||||
rv = bundle->FormatStringFromName(dialogTextPropertyTag.get(),
|
||||
brandStrings, 1,
|
||||
getter_Copies(dialogText));
|
||||
if (NS_FAILED(rv)) return NS_ERROR_FAILURE;
|
||||
|
||||
rv = promptService->Alert(nsnull, dialogTitle,
|
||||
dialogText);
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
112
mozilla/mailnews/mapi/mapihook/src/nsMapiRegistryUtils.h
Normal file
@@ -0,0 +1,112 @@
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2001
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Srilatha Moturi <srilatha@netscape.com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef nsmapiregistryutils_h____
|
||||
#define nsmapiregistryutils_h____
|
||||
|
||||
#include <windows.h>
|
||||
#include <string.h>
|
||||
#include <winreg.h>
|
||||
|
||||
#include "Registry.h"
|
||||
#include "nsString.h"
|
||||
#include "nsIStringBundle.h"
|
||||
|
||||
class nsMapiRegistryUtils
|
||||
{
|
||||
private :
|
||||
nsCAutoString m_thisApp ;
|
||||
nsAutoString m_brand ;
|
||||
nsAutoString m_versionNo ;
|
||||
|
||||
nsCOMPtr<nsIStringBundle> m_mapiStringBundle ;
|
||||
public :
|
||||
nsMapiRegistryUtils() ;
|
||||
|
||||
// returns TRUE if the Mapi32.dll is smart dll.
|
||||
PRBool isSmartDll();
|
||||
// returns TRUE if the Mapi32.dll is a Mozilla dll.
|
||||
PRBool isMozDll();
|
||||
|
||||
// Returns the (fully-qualified) name of this executable.
|
||||
const char * thisApplication() ;
|
||||
// This returns the brand name for this application
|
||||
const PRUnichar * brandName() ;
|
||||
// This returns the version no for this application
|
||||
const PRUnichar * versionNo() ;
|
||||
// verifyRestrictedAccess - Returns PR_TRUE if this user only has restricted access
|
||||
// to the registry keys we need to modify.
|
||||
PRBool verifyRestrictedAccess() ;
|
||||
|
||||
// set the Windows registry key
|
||||
nsresult SetRegistryKey(HKEY baseKey, const char * keyName,
|
||||
const char * valueName, char * value);
|
||||
// delete a registry key
|
||||
nsresult DeleteRegistryValue(HKEY baseKey, const char * keyName,
|
||||
const char * valueName);
|
||||
// get a Windows registry key
|
||||
void GetRegistryKey(HKEY baseKey, const char * keyName,
|
||||
const char * valueName, nsCAutoString & value) ;
|
||||
|
||||
// Returns TRUE if the current application is default mail client.
|
||||
PRBool IsDefaultMailClient();
|
||||
// Sets Mozilla as default Mail Client
|
||||
nsresult setDefaultMailClient() ;
|
||||
// Removes Mozilla as the default Mail client and restores the previous setting
|
||||
nsresult unsetDefaultMailClient() ;
|
||||
|
||||
// Saves the current setting of the default Mail Client in
|
||||
// HKEY_LOCAL_MACHINE\\Software\\Mozilla\\Desktop
|
||||
nsresult saveDefaultMailClient();
|
||||
// Saves the current user setting of the default Mail Client in
|
||||
// HKEY_LOCAL_MACHINE\\Software\\Mozilla\\Desktop
|
||||
nsresult saveUserDefaultMailClient();
|
||||
|
||||
nsresult CopyMozMapiToWinSysDir();
|
||||
nsresult RestoreBackedUpMapiDll();
|
||||
|
||||
// Returns FALSE if showMapiDialog is set to 0.
|
||||
PRBool getShowDialog() ;
|
||||
|
||||
// create a string bundle for MAPI messages
|
||||
nsresult MakeMapiStringBundle(nsIStringBundle ** aMapiStringBundle) ;
|
||||
// display an error dialog for MAPI messages
|
||||
nsresult ShowMapiErrorDialog() ;
|
||||
|
||||
} ;
|
||||
|
||||
#endif
|
||||
30
mozilla/mailnews/mapi/resources/content/contents.rdf
Normal file
@@ -0,0 +1,30 @@
|
||||
<?xml version="1.0"?>
|
||||
|
||||
<RDF:RDF xmlns:RDF="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:chrome="http://www.mozilla.org/rdf/chrome#">
|
||||
|
||||
<!-- list all the packages being supplied by this jar -->
|
||||
<RDF:Seq about="urn:mozilla:package:root">
|
||||
<RDF:li resource="urn:mozilla:package:messenger-mapi"/>
|
||||
</RDF:Seq>
|
||||
|
||||
<!-- package information -->
|
||||
<RDF:Description about="urn:mozilla:package:messenger-mapi"
|
||||
chrome:displayName="Messenger"
|
||||
chrome:author="mozilla.org"
|
||||
chrome:name="messenger-mapi"
|
||||
chrome:localeVersion="0.9.7"
|
||||
chrome:skinVersion="0.9.4">
|
||||
</RDF:Description>
|
||||
|
||||
<!-- overlay information -->
|
||||
<RDF:Seq about="urn:mozilla:overlays">
|
||||
<RDF:li resource="chrome://messenger/content/pref-mailnews.xul"/>
|
||||
</RDF:Seq>
|
||||
|
||||
<!-- mapi items for Mail And Newsgroups preferences pane -->
|
||||
<RDF:Seq about="chrome://messenger/content/pref-mailnews.xul">
|
||||
<RDF:li>chrome://messenger-mapi/content/pref-mailnewsOverlay.xul</RDF:li>
|
||||
</RDF:Seq>
|
||||
|
||||
</RDF:RDF>
|
||||
3
mozilla/mailnews/mapi/resources/content/jar.mn
Normal file
@@ -0,0 +1,3 @@
|
||||
messenger.jar:
|
||||
content/messenger-mapi/pref-mailnewsOverlay.xul
|
||||
content/messenger-mapi/contents.rdf
|
||||
29
mozilla/mailnews/mapi/resources/content/makefile.win
Normal file
@@ -0,0 +1,29 @@
|
||||
#!nmake
|
||||
#
|
||||
# The contents of this file are subject to the Mozilla Public
|
||||
# License Version 1.1 (the "License"); you may not use this file
|
||||
# except in compliance with the License. You may obtain a copy of
|
||||
# the License at http://www.mozilla.org/MPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS
|
||||
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
# implied. See the License for the specific language governing
|
||||
# rights and limitations under the License.
|
||||
#
|
||||
# The Original Code is mozilla.org code.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 2001 Netscape Communications Corporation. All
|
||||
# Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
# Srilatha Moturi <srilatha@netscape.com>
|
||||
#
|
||||
|
||||
DEPTH=..\..\..\..
|
||||
|
||||
include <$(DEPTH)\config\rules.mak>
|
||||
|
||||
chrome::
|
||||
$(REGCHROME) content messenger-mapi messenger.jar
|
||||
14
mozilla/mailnews/mapi/resources/content/overlays.rdf
Normal file
@@ -0,0 +1,14 @@
|
||||
<?xml version="1.0"?>
|
||||
<RDF:RDF xmlns:chrome="http://www.mozilla.org/rdf/chrome#"
|
||||
xmlns:RDF="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
|
||||
|
||||
<!-- mapi items for mailnews preferences -->
|
||||
<RDF:Seq about="urn:mozilla:overlays">
|
||||
<RDF:li resource="chrome://messenger/content/pref-mailnews.xul"/>
|
||||
</RDF:Seq>
|
||||
|
||||
<RDF:Seq about="chrome://messenger/content/pref-mailnews.xul">
|
||||
<RDF:li>chrome://messenger/content/pref-mailnewsOverlay.xul</RDF:li>
|
||||
</RDF:Seq>
|
||||
|
||||
</RDF:RDF>
|
||||
104
mozilla/mailnews/mapi/resources/content/pref-mailnewsOverlay.js
Normal file
@@ -0,0 +1,104 @@
|
||||
/*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 2001 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Srilatha Moturi <srilatha@netscape.com>
|
||||
*/
|
||||
|
||||
function mailnewsOverlayStartup() {
|
||||
mailnewsOverlayInit();
|
||||
parent.hPrefWindow.registerOKCallbackFunc(onOK);
|
||||
if (!("mapiPref" in parent)) {
|
||||
parent.mapiPref = new Object;
|
||||
parent.mapiPref.isDefaultMailClient =
|
||||
document.getElementById("mailnewsEnableMapi").checked;
|
||||
}
|
||||
else {
|
||||
// when we switch between different panes
|
||||
// set the checkbox based on the saved state
|
||||
var mailnewsEnableMapi = document.getElementById("mailnewsEnableMapi");
|
||||
if (parent.mapiPref.isDefaultMailClient)
|
||||
mailnewsEnableMapi.setAttribute("checked", "true");
|
||||
else
|
||||
mailnewsEnableMapi.setAttribute("checked", "false");
|
||||
}
|
||||
}
|
||||
|
||||
function mailnewsOverlayInit() {
|
||||
try {
|
||||
var mapiRegistry = Components.classes[ "@mozilla.org/mapiregistry;1" ].
|
||||
getService( Components.interfaces.nsIMapiRegistry );
|
||||
}
|
||||
catch(ex){
|
||||
mapiRegistry = null;
|
||||
}
|
||||
|
||||
const prefbase = "system.windows.lock_ui.";
|
||||
var mailnewsEnableMapi = document.getElementById("mailnewsEnableMapi");
|
||||
if (mapiRegistry) {
|
||||
// initialise preference component.
|
||||
// While the data is coming from the system registry, we use a set
|
||||
// of parallel preferences to indicate if the ui should be locked.
|
||||
try {
|
||||
var prefService = Components.classes["@mozilla.org/preferences-service;1"]
|
||||
.getService()
|
||||
.QueryInterface(Components.interfaces.nsIPrefService);
|
||||
var prefBranch = prefService.getBranch(prefbase);
|
||||
if (prefBranch && prefBranch.prefIsLocked("default_mail_client")) {
|
||||
if (prefBranch.getBoolPref("default_mail_client"))
|
||||
mapiRegistry.setDefaultMailClient();
|
||||
else
|
||||
mapiRegistry.unsetDefaultMailClient();
|
||||
mailnewsEnableMapi.setAttribute("disabled", "true");
|
||||
}
|
||||
}
|
||||
catch(ex) {}
|
||||
if (mapiRegistry.isDefaultMailClient)
|
||||
mailnewsEnableMapi.setAttribute("checked", "true");
|
||||
else
|
||||
mailnewsEnableMapi.setAttribute("checked", "false");
|
||||
}
|
||||
else
|
||||
mailnewsEnableMapi.setAttribute("disabled", "true");
|
||||
}
|
||||
|
||||
function onEnableMapi() {
|
||||
// save the state of the checkbox
|
||||
if ("mapiPref" in parent)
|
||||
parent.mapiPref.isDefaultMailClient =
|
||||
document.getElementById("mailnewsEnableMapi").checked;
|
||||
}
|
||||
|
||||
function onOK()
|
||||
{
|
||||
try {
|
||||
var mapiRegistry = Components.classes[ "@mozilla.org/mapiregistry;1" ].
|
||||
getService( Components.interfaces.nsIMapiRegistry );
|
||||
}
|
||||
catch(ex){
|
||||
mapiRegistry = null;
|
||||
}
|
||||
if (mapiRegistry &&
|
||||
("mapiPref" in parent) &&
|
||||
(mapiRegistry.isDefaultMailClient != parent.mapiPref.isDefaultMailClient)) {
|
||||
if (parent.mapiPref.isDefaultMailClient)
|
||||
mapiRegistry.setDefaultMailClient();
|
||||
else
|
||||
mapiRegistry.unsetDefaultMailClient();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
<?xml version="1.0"?>
|
||||
<!--
|
||||
The contents of this file are subject to the Mozilla Public
|
||||
License Version 1.1 (the "License"); you may not use this file
|
||||
except in compliance with the License. You may obtain a copy of
|
||||
the License at http://www.mozilla.org/MPL/
|
||||
|
||||
oftware distributed under the License is distributed on an "AS
|
||||
IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
implied. See the License for the specific language governing
|
||||
rights and limitations under the License.
|
||||
|
||||
The Original Code is mozilla.org code.
|
||||
The Initial Developer of the Original Code is Netscape
|
||||
Communications Corporation. Portions created by Netscape are
|
||||
Copyright (C) 2001 Netscape Communications Corporation. All
|
||||
Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
Srilatha Moturi <srilatha@netscape.com>
|
||||
-->
|
||||
|
||||
<!DOCTYPE window [
|
||||
<!ENTITY % brandDTD SYSTEM "chrome://global/locale/brand.dtd" >
|
||||
%brandDTD;
|
||||
<!ENTITY % prefMailnewsOverlayDTD SYSTEM "chrome://messenger-mapi/locale/pref-mailnewsOverlay.dtd" >
|
||||
%prefMailnewsOverlayDTD;
|
||||
]>
|
||||
<overlay id="prefMailnewsOverlay"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
|
||||
<script type="application/x-javascript">
|
||||
<![CDATA[
|
||||
_elementIDs.push("mailnewsEnableMapi");
|
||||
]]>
|
||||
</script>
|
||||
<script type="application/x-javascript" src="chrome://messenger-mapi/content/pref-mailnewsOverlay.js"/>
|
||||
<hbox autostretch="never" id="mapi">
|
||||
<checkbox id="mailnewsEnableMapi" label="&enableMapi.label;"
|
||||
accesskey="&enableMapi.accesskey;"
|
||||
preftype="bool" prefstring="mailnews.default_mail_client" prefattribute="checked"/>
|
||||
|
||||
</hbox>
|
||||
</overlay>
|
||||
23
mozilla/mailnews/mapi/resources/locale/en-US/contents.rdf
Normal file
@@ -0,0 +1,23 @@
|
||||
<?xml version="1.0"?>
|
||||
<RDF:RDF xmlns:RDF="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:chrome="http://www.mozilla.org/rdf/chrome#">
|
||||
|
||||
<!-- list all the skins being supplied by this package -->
|
||||
<RDF:Seq about="urn:mozilla:locale:root">
|
||||
<RDF:li resource="urn:mozilla:locale:en-US"/>
|
||||
</RDF:Seq>
|
||||
|
||||
<!-- locale information -->
|
||||
<RDF:Description about="urn:mozilla:locale:en-US">
|
||||
<chrome:packages>
|
||||
<RDF:Seq about="urn:mozilla:locale:en-US:packages">
|
||||
<RDF:li resource="urn:mozilla:locale:en-US:messenger-mapi"/>
|
||||
</RDF:Seq>
|
||||
</chrome:packages>
|
||||
</RDF:Description>
|
||||
|
||||
<!-- Version Information. State that we work only with major version of this
|
||||
package. -->
|
||||
<RDF:Description about="urn:mozilla:locale:en-US:messenger-mapi"
|
||||
chrome:localeVersion="0.9.7"/>
|
||||
</RDF:RDF>
|
||||
4
mozilla/mailnews/mapi/resources/locale/en-US/jar.mn
Normal file
@@ -0,0 +1,4 @@
|
||||
en-US.jar:
|
||||
locale/en-US/messenger-mapi/pref-mailnewsOverlay.dtd
|
||||
locale/en-US/messenger-mapi/mapi.properties
|
||||
locale/en-US/messenger-mapi/contents.rdf
|
||||
40
mozilla/mailnews/mapi/resources/locale/en-US/makefile.win
Normal file
@@ -0,0 +1,40 @@
|
||||
#!nmake
|
||||
#
|
||||
# The contents of this file are subject to the Mozilla Public
|
||||
# License Version 1.1 (the "License"); you may not use this file
|
||||
# except in compliance with the License. You may obtain a copy of
|
||||
# the License at http://www.mozilla.org/MPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS
|
||||
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
# implied. See the License for the specific language governing
|
||||
# rights and limitations under the License.
|
||||
#
|
||||
# The Original Code is mozilla.org code.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 2001 Netscape Communications Corporation. All
|
||||
# Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
# Srilatha Moturi <srilatha@netscape.com>
|
||||
#
|
||||
|
||||
DEPTH=..\..\..\..\..
|
||||
|
||||
|
||||
CHROME_DIR=locales\en-US
|
||||
CHROME_L10N_DIR=messenger\locale
|
||||
|
||||
CHROME_L10N = \
|
||||
.\pref-mailnewsOverlay.dtd \
|
||||
.\mapi.properties \
|
||||
.\contents.rdf \
|
||||
$(NULL)
|
||||
|
||||
include <$(DEPTH)\config\rules.mak>
|
||||
|
||||
chrome::
|
||||
$(REGCHROME) locale en-US/messenger-mapi en-US.jar
|
||||
|
||||
23
mozilla/mailnews/mapi/resources/locale/en-US/mapi.properties
Normal file
@@ -0,0 +1,23 @@
|
||||
# Mail Integration Dialog
|
||||
dialogTitle=%S Mail
|
||||
dialogText=Do you want to use %S as the default mail application?
|
||||
checkboxText=Do not display this dialog again
|
||||
|
||||
# MAPI Messages
|
||||
loginText=Please enter your password for %S:
|
||||
loginTextwithName=Please enter your username and password
|
||||
loginTitle=%S Mail
|
||||
PasswordTitle=%S Mail
|
||||
|
||||
# MAPI Error Messages
|
||||
errorMessage=%S Mail could not be set as the default mail application because a registry key could not be updated. Verify with your system administrator that you have write access to your system registry, and then try again.
|
||||
errorMessageTitle=%S Mail
|
||||
|
||||
# MAPI Security Messages
|
||||
mapiBlindSendWarning=Another application is attempting to send mail using your user profile. Are you sure you want to send mail?
|
||||
mapiBlindSendDontShowAgain=Warn me whenever other applications try to send mail from me
|
||||
|
||||
#Default Mail Display String
|
||||
# localization note, $1%S is the app name, $2%S is the version
|
||||
defaultMailDisplayTitle=%S %S Mail
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
<!ENTITY enableMapiTitle.label "When sending mail from other applications">
|
||||
<!ENTITY enableMapi.label "Use &vendorShortName; Mail as the default mail application.">
|
||||
<!ENTITY enableMapi.accesskey "u">
|
||||
28
mozilla/mailnews/mapi/resources/locale/makefile.win
Normal file
@@ -0,0 +1,28 @@
|
||||
#!nmake
|
||||
#
|
||||
# The contents of this file are subject to the Mozilla Public
|
||||
# License Version 1.1 (the "License"); you may not use this file
|
||||
# except in compliance with the License. You may obtain a copy of
|
||||
# the License at http://www.mozilla.org/MPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS
|
||||
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
# implied. See the License for the specific language governing
|
||||
# rights and limitations under the License.
|
||||
#
|
||||
# The Original Code is mozilla.org code.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 2001 Netscape Communications Corporation. All
|
||||
# Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
# Srilatha Moturi <srilatha@netscape.com>
|
||||
#
|
||||
|
||||
DEPTH=..\..\..\..
|
||||
|
||||
DIRS=en-US
|
||||
|
||||
include <$(DEPTH)\config\rules.mak>
|
||||
27
mozilla/mailnews/mapi/resources/makefile.win
Normal file
@@ -0,0 +1,27 @@
|
||||
#
|
||||
# The contents of this file are subject to the Mozilla Public
|
||||
# License Version 1.1 (the "License"); you may not use this file
|
||||
# except in compliance with the License. You may obtain a copy of
|
||||
# the License at http://www.mozilla.org/MPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS
|
||||
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
# implied. See the License for the specific language governing
|
||||
# rights and limitations under the License.
|
||||
#
|
||||
# The Original Code is mozilla.org code.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 2001 Netscape Communications Corporation. All
|
||||
# Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
# Srilatha Moturi <srilatha@netscape.com>
|
||||
#
|
||||
|
||||
DEPTH=..\..\..
|
||||
|
||||
DIRS=content locale
|
||||
|
||||
include <$(DEPTH)\config\rules.mak>
|
||||
@@ -1,419 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
Script Name: Full Featured PHP Browser/OS detection
|
||||
Author: Harald Hope, Website: http://tech.ratmachines.com/
|
||||
Script Source URI: http://tech.ratmachines.com/downloads/browser_detection.php
|
||||
Version 4.2.7
|
||||
Copyright (C) 04 March 2004
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
Lesser GPL license text:
|
||||
http://www.gnu.org/licenses/lgpl.txt
|
||||
|
||||
Coding conventions:
|
||||
http://cvs.sourceforge.net/viewcvs.py/phpbb/phpBB2/docs/codingstandards.htm?rev=1.3
|
||||
*/
|
||||
|
||||
/******************************************
|
||||
this is currently set to accept 9 parameters, although you can add as many as you want:
|
||||
1. safe - returns true/false, you can determine what makes the browser be safe lower down,
|
||||
currently it's set for ns4 and pre version 1 mozillas not being safe, plus all older browsers
|
||||
2. ie_version - tests to see what general IE it is, ie5x-6, ie4, or macIE, returns these values.
|
||||
3. moz_version - returns array of moz version, version number (includes full version, + etc), rv number (for math
|
||||
comparison), rv number (for full rv, including alpha and beta versions), and release date
|
||||
4. dom - returns true/false if it is a basic dom browser, ie >= 5, opera >= 5, all new mozillas, safaris, konquerors
|
||||
5. os - returns which os is being used
|
||||
6. os_number - returns windows versions, 95, 98, me, nt 4, nt 5 [windows 2000], nt 5.1 [windows xp],
|
||||
otherwise returns false
|
||||
7. browser - returns the browser name, in shorthand: ie, ie4, ie5x, op, moz, konq, saf, ns4
|
||||
8. number - returns the browser version number, if available, otherwise returns '' [not available]
|
||||
9. full - returns this array: $browser_name, $version_number, $ie_version, $dom_browser, $safe_browser, $os, $os_number
|
||||
*******************************************/
|
||||
|
||||
// main script, uses two other functions, which_os() and browser_version() as needed
|
||||
function browser_detection( $which_test ) {
|
||||
/*
|
||||
uncomment the global variable declaration if you want the variables to be available on a global level
|
||||
throughout your php page, make sure that php is configured to support the use of globals first!
|
||||
Use of globals should be avoided however, and they are not necessary with this script
|
||||
*/
|
||||
|
||||
/*global $dom_browser, $safe_browser, $browser_user_agent, $os, $browser_name, $ie_version,
|
||||
$version_number, $os_number, $b_repeat, $moz_version, $moz_version_number, $moz_rv, $moz_rv_full, $moz_release;*/
|
||||
|
||||
static $dom_browser, $safe_browser, $browser_user_agent, $os, $browser_name, $ie_version,
|
||||
$version_number, $os_number, $b_repeat, $moz_version, $moz_version_number, $moz_rv, $moz_rv_full, $moz_release;
|
||||
|
||||
/*
|
||||
this makes the test only run once no matter how many times you call it
|
||||
since all the variables are filled on the first run through, it's only a matter of returning the
|
||||
the right ones
|
||||
*/
|
||||
if ( !$b_repeat )
|
||||
{
|
||||
//initialize all variables with default values to prevent error
|
||||
$dom_browser = false;
|
||||
$safe_browser = false;
|
||||
$os = '';
|
||||
$os_number = '';
|
||||
$a_os_data = '';
|
||||
$browser_name = '';
|
||||
$version_number = '';
|
||||
$ie_version = '';
|
||||
$moz_version = '';
|
||||
$moz_version_number = '';
|
||||
$moz_rv = '';
|
||||
$moz_rv_full = '';
|
||||
$moz_release = '';
|
||||
|
||||
//make navigator user agent string lower case to make sure all versions get caught
|
||||
$browser_user_agent = strtolower( $_SERVER['HTTP_USER_AGENT'] );
|
||||
|
||||
$a_os_data = which_os( $browser_user_agent );// get os/number array
|
||||
$os = $a_os_data[0];// os name, abbreviated
|
||||
$os_number = $a_os_data[1];// os number if windows
|
||||
|
||||
/*
|
||||
pack the browser type array, in this order
|
||||
the order is important, because opera must be tested first, and ie4 tested for before ie general
|
||||
same for konqueror, then safari, then gecko, since safari navigator user agent id's with 'gecko' in string.
|
||||
note that $dom_browser is set for all modern dom browsers, this gives you a default to use.
|
||||
|
||||
array[0] = id string for useragent, array[1] is if dom capable, array[2] is working name for browser
|
||||
|
||||
Note: all browser strings are in lower case to match the strtolower output, this avoids possible detection
|
||||
errors
|
||||
*/
|
||||
$a_browser_types[] = array( 'opera', true, 'op' );
|
||||
$a_browser_types[] = array( 'msie', true, 'ie' );
|
||||
$a_browser_types[] = array( 'konqueror', true, 'konq' );
|
||||
$a_browser_types[] = array( 'safari', true, 'saf' );
|
||||
// covers Netscape 6-7, K-Meleon, Most linux versions
|
||||
// the 3 is for the rv: number, the release date is hardcoded
|
||||
$a_browser_types[] = array( 'gecko', true, 'moz' );
|
||||
// netscape 4 test: this has to be last or else ie or opera might register true
|
||||
$a_browser_types[] = array( 'mozilla/4', false, 'ns4' );
|
||||
$a_browser_types[] = array( 'lynx', false, 'lynx' );
|
||||
$a_browser_types[] = array( 'webtv', true, 'webtv' );
|
||||
// search engine spider bots:
|
||||
$a_browser_types[] = array( 'googlebot', false, 'google' );// google
|
||||
$a_browser_types[] = array( 'fast-webcrawler', false, 'fast' );// Fast AllTheWeb
|
||||
$a_browser_types[] = array( 'msnbot', false, 'msn' );// msn search
|
||||
$a_browser_types[] = array( 'scooter', false, 'scooter' );// altavista
|
||||
//$a_browser_types[] = array( '', false ); // browser array template
|
||||
|
||||
/*
|
||||
moz types array
|
||||
note the order, netscape6 must come before netscape, which is how netscape 7 id's itself.
|
||||
rv comes last in case it is plain old mozilla
|
||||
*/
|
||||
$moz_types = array( 'firebird', 'phoenix', 'firefox', 'galeon', 'k-meleon', 'camino', 'netscape6',
|
||||
'netscape', 'rv' );
|
||||
|
||||
/*
|
||||
run through the browser_types array, break if you hit a match, if no match, assume old browser
|
||||
or non dom browser, assigns false value to $b_success.
|
||||
*/
|
||||
for ($i = 0; $i < count($a_browser_types); $i++)
|
||||
{
|
||||
//unpacks browser array, assigns to variables
|
||||
$s_browser = $a_browser_types[$i][0];// text string to id browser from array
|
||||
$b_dom = $a_browser_types[$i][1];// hardcoded dom support from array
|
||||
$browser_name = $a_browser_types[$i][2];// working name for browser
|
||||
$b_success = false;
|
||||
|
||||
if (stristr($browser_user_agent, $s_browser))
|
||||
{
|
||||
// it defaults to true, will become false below if needed
|
||||
// this keeps it easier to keep track of what is safe, only explicit false assignment will make it false.
|
||||
$safe_browser = true;
|
||||
switch ( $browser_name )
|
||||
{
|
||||
case 'ns4':
|
||||
$safe_browser = false;
|
||||
break;
|
||||
case 'moz':
|
||||
/*
|
||||
note: The 'rv' test is not absolute since the rv number is very different on
|
||||
different versions, for example Galean doesn't use the same rv version as Mozilla,
|
||||
neither do later Netscapes, like 7.x. For more on this, read the full mozilla numbering
|
||||
conventions here:
|
||||
http://www.mozilla.org/releases/cvstags.html
|
||||
*/
|
||||
|
||||
// this will return alpha and beta version numbers, if present
|
||||
$moz_rv_full = browser_version( $browser_user_agent, 'rv' );
|
||||
// this slices them back off for math comparisons
|
||||
$moz_rv = substr( $moz_rv_full, 0, 3 );
|
||||
|
||||
// this is to pull out specific mozilla versions, firebird, netscape etc..
|
||||
for ( $i = 0; $i < count( $moz_types ); $i++ )
|
||||
{
|
||||
if ( stristr( $browser_user_agent, $moz_types[$i] ) )
|
||||
{
|
||||
$moz_version = $moz_types[$i];
|
||||
$moz_version_number = browser_version( $browser_user_agent, $moz_version );
|
||||
break;
|
||||
}
|
||||
}
|
||||
// this is necesary to protect against false id'ed moz'es and new moz'es.
|
||||
// this corrects for galeon, or any other moz browser without an rv number
|
||||
if ( !$moz_rv )
|
||||
{
|
||||
$moz_rv = substr( $moz_version_number, 0, 3 );
|
||||
$moz_rv_full = $moz_version_number;
|
||||
/*
|
||||
// you can use this instead if you are running php >= 4.2
|
||||
$moz_rv = floatval( $moz_version_number );
|
||||
$moz_rv_full = $moz_version_number;
|
||||
*/
|
||||
}
|
||||
// this corrects the version name in case it went to the default 'rv' for the test
|
||||
if ( $moz_version == 'rv' )
|
||||
{
|
||||
$moz_version = 'mozilla';
|
||||
}
|
||||
|
||||
//the moz version will be taken from the rv number, see notes above for rv problems
|
||||
$version_number = $moz_rv;
|
||||
// gets the actual release date, necessary if you need to do functionality tests
|
||||
$moz_release = browser_version( $browser_user_agent, 'gecko/' );
|
||||
/*
|
||||
Test for mozilla 0.9.x / netscape 6.x
|
||||
test your javascript/CSS to see if it works in these mozilla releases, if it does, just default it to:
|
||||
$safe_browser = true;
|
||||
*/
|
||||
if ( ( $moz_release < 20020400 ) || ( $moz_rv < 1 ) )
|
||||
{
|
||||
$safe_browser = false;
|
||||
}
|
||||
break;
|
||||
case 'ie':
|
||||
//$version_number = browser_version( $browser_user_agent, $s_browser, $substring_length );
|
||||
$version_number = browser_version( $browser_user_agent, $s_browser );
|
||||
if ( $os == 'mac' )
|
||||
{
|
||||
$ie_version = 'ieMac';
|
||||
}
|
||||
// this assigns a general ie id to the $ie_version variable
|
||||
if ( $version_number >= 5 )
|
||||
{
|
||||
$ie_version = 'ie5x';
|
||||
}
|
||||
elseif ( ( $version_number > 3 ) && $version_number < 5 )
|
||||
{
|
||||
$dom_browser = false;
|
||||
$ie_version = 'ie4';
|
||||
$safe_browser = true; // this depends on what you're using the script for, make sure this fits your needs
|
||||
}
|
||||
else
|
||||
{
|
||||
$ie_version = 'old';
|
||||
$safe_browser = false;
|
||||
}
|
||||
break;
|
||||
case 'op':
|
||||
//$version_number = browser_version( $browser_user_agent, $s_browser, $substring_length );
|
||||
$version_number = browser_version( $browser_user_agent, $s_browser );
|
||||
if ( $version_number < 5 )// opera 4 wasn't very useable.
|
||||
{
|
||||
$safe_browser = false;
|
||||
}
|
||||
break;
|
||||
case 'saf':
|
||||
//$version_number = browser_version( $browser_user_agent, $s_browser, $substring_length );
|
||||
$version_number = browser_version( $browser_user_agent, $s_browser );
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
$dom_browser = $b_dom;
|
||||
$b_success = true;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
//assigns defaults if the browser was not found in the loop test
|
||||
if ( !$b_success )
|
||||
{
|
||||
$safe_browser = false;
|
||||
$dom_browser = false;
|
||||
$browser_name = '';
|
||||
}
|
||||
// this ends the run through once if clause, set the boolean
|
||||
//to true so the function won't retest everything
|
||||
$b_repeat = true;
|
||||
}
|
||||
/*
|
||||
This is where you return values based on what parameter you used to call the function
|
||||
$which_test is the passed parameter in the initial browser_detection('os') for example call
|
||||
*/
|
||||
switch ( $which_test )
|
||||
{
|
||||
case 'safe':// returns true/false if your tests determine it's a safe browser
|
||||
// you can change the tests to determine what is a safeBrowser for your scripts
|
||||
// in this case sub rv 1 Mozillas and Netscape 4x's trigger the unsafe condition
|
||||
return $safe_browser;
|
||||
break;
|
||||
case 'ie_version': // returns iemac or ie5x
|
||||
return $ie_version;
|
||||
break;
|
||||
case 'moz_version':// returns array of all relevant moz information
|
||||
$moz_array = array( $moz_version, $moz_version_number, $moz_rv, $moz_rv_full, $moz_release );
|
||||
return $moz_array;
|
||||
break;
|
||||
case 'dom':// returns true/fale if a DOM capable browser
|
||||
return $dom_browser;
|
||||
break;
|
||||
case 'os':// returns os name
|
||||
return $os;
|
||||
break;
|
||||
case 'os_number':// returns os number if windows
|
||||
return $os_number;
|
||||
break;
|
||||
case 'browser':// returns browser name
|
||||
return $browser_name;
|
||||
break;
|
||||
case 'number':// returns browser number
|
||||
return $version_number;
|
||||
break;
|
||||
case 'full':// returns all relevant browser information in an array
|
||||
$full_array = array( $browser_name, $version_number, $ie_version, $dom_browser, $safe_browser, $os, $os_number );
|
||||
return $full_array;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// gets which os from the browser string
|
||||
function which_os ( $browser_string )
|
||||
{
|
||||
// initialize variables
|
||||
$os = '';
|
||||
$os_version = '';
|
||||
/*
|
||||
packs the os array
|
||||
use this order since some navigator user agents will put 'macintosh' in the navigator user agent string
|
||||
which would make the nt test register true
|
||||
*/
|
||||
$a_os = array('lin', 'mac', 'unix', 'sunos', 'bsd', 'nt', 'win');
|
||||
|
||||
//os tester
|
||||
for ($i = 0; $i < count($a_os); $i++)
|
||||
{
|
||||
//unpacks os array, assigns to variable
|
||||
$s_os = $a_os[$i];
|
||||
|
||||
//assign os to global os variable, os flag true on success
|
||||
if (stristr( $browser_string, $s_os ))
|
||||
{
|
||||
$os = $s_os;
|
||||
|
||||
switch ( $os )
|
||||
{
|
||||
case 'win':
|
||||
if ( strstr( $browser_string, '95' ) )
|
||||
{
|
||||
$os_version = '95';
|
||||
}
|
||||
elseif ( strstr( $browser_string, '98' ) )
|
||||
{
|
||||
$os_version = '98';
|
||||
}
|
||||
elseif ( strstr( $browser_string, 'me' ) )
|
||||
{
|
||||
$os_version = 'me';
|
||||
}
|
||||
elseif ( strstr( $browser_string, '2000' ) )// windows 2000, for opera ID
|
||||
{
|
||||
$os_version = '5.0';
|
||||
$os = 'nt';
|
||||
}
|
||||
elseif ( strstr( $browser_string, 'xp' ) )// windows 2000, for opera ID
|
||||
{
|
||||
$os_version = '5.1';
|
||||
$os = 'nt';
|
||||
}
|
||||
break;
|
||||
case 'nt':
|
||||
if ( strstr( $browser_string, 'nt 5.1' || strstr( $browser_string, 'xp' )) )// windows xp
|
||||
{
|
||||
$os_version = '5.1';//
|
||||
}
|
||||
elseif ( strstr( $browser_string, 'nt 5' ) || strstr( $browser_string, '2000' ) )// windows 2000
|
||||
{
|
||||
$os_version = '5.0';
|
||||
}
|
||||
elseif ( strstr( $browser_string, 'nt 4' ) )// nt 4
|
||||
{
|
||||
$os_version = '4';
|
||||
}
|
||||
elseif ( strstr( $browser_string, 'nt 3' ) )// nt 4
|
||||
{
|
||||
$os_version = '3';
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// pack the os data array for return to main function
|
||||
$os_data = array( $os, $os_version );
|
||||
return $os_data;
|
||||
}
|
||||
|
||||
// function returns browser number, gecko rv number, or gecko release date
|
||||
//function browser_version( $browser_user_agent, $search_string, $substring_length )
|
||||
function browser_version( $browser_user_agent, $search_string )
|
||||
{
|
||||
// 8 is the longest that will be required, handles release dates: 20020323; 0.8.0+
|
||||
$substring_length = 8;
|
||||
//initialize browser number, will return '' if not found
|
||||
$browser_number = '';
|
||||
|
||||
// use the passed parameter for $search_string
|
||||
// start the substring slice right after these moz search strings
|
||||
$start_pos = strpos( $browser_user_agent, $search_string ) + strlen( $search_string );
|
||||
|
||||
// this is just to get the release date, not other moz information
|
||||
if ( ( $search_string != 'gecko/' ) )
|
||||
{
|
||||
$start_pos++;
|
||||
}
|
||||
|
||||
// Initial trimming
|
||||
$browser_number = substr( $browser_user_agent, $start_pos, $substring_length );
|
||||
|
||||
// Find the space, ;, or parentheses that ends the number
|
||||
$browser_number = substr( $browser_number, 0, strcspn($browser_number, ' );') );
|
||||
|
||||
//make sure the returned value is actually the id number and not a string
|
||||
// otherwise return ''
|
||||
if ( !is_numeric( substr( $browser_number, 0, 1 ) ) )
|
||||
{
|
||||
$browser_number = '';
|
||||
}
|
||||
|
||||
return $browser_number;
|
||||
}
|
||||
|
||||
/*
|
||||
Here are some typical navigator.userAgent strings so you can see where the data comes from
|
||||
Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.5) Gecko/20031007 Firebird/0.7
|
||||
Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:0.9.4) Gecko/20011128 Netscape6/6.2.1
|
||||
*/
|
||||
?>
|
||||
@@ -1,73 +0,0 @@
|
||||
<?php
|
||||
// ***** BEGIN LICENSE BLOCK *****
|
||||
// Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
//
|
||||
// The contents of this file are subject to the Mozilla Public License Version
|
||||
// 1.1 (the "License"); you may not use this file except in compliance with
|
||||
// the License. You may obtain a copy of the License at
|
||||
// http://www.mozilla.org/MPL/
|
||||
//
|
||||
// Software distributed under the License is distributed on an "AS IS" basis,
|
||||
// WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
// for the specific language governing rights and limitations under the
|
||||
// License.
|
||||
//
|
||||
// The Original Code is Mozilla Update.
|
||||
//
|
||||
// The Initial Developer of the Original Code is
|
||||
// Chris "Wolf" Crews.
|
||||
// Portions created by the Initial Developer are Copyright (C) 2004
|
||||
// the Initial Developer. All Rights Reserved.
|
||||
//
|
||||
// Contributor(s):
|
||||
// Chris "Wolf" Crews <psychoticwolf@carolina.rr.com>
|
||||
//
|
||||
// Alternatively, the contents of this file may be used under the terms of
|
||||
// either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
// the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
// in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
// of those above. If you wish to allow use of your version of this file only
|
||||
// under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
// use your version of this file under the terms of the MPL, indicate your
|
||||
// decision by deleting the provisions above and replace them with the notice
|
||||
// and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
// the provisions above, a recipient may use your version of this file under
|
||||
// the terms of any one of the MPL, the GPL or the LGPL.
|
||||
//
|
||||
// ***** END LICENSE BLOCK *****
|
||||
|
||||
// Mozilla Update -- PHP Configuration File
|
||||
// All common PHP Variables/functions are defined here
|
||||
|
||||
//-- Site Timing :: Function and Start... --//
|
||||
function getmicrotime() {
|
||||
list($usec, $sec) = explode(" ", microtime());
|
||||
return ((float)$usec + (float)$sec);
|
||||
}
|
||||
$time_start = getmicrotime();
|
||||
|
||||
//-- Website Variables--//
|
||||
$websitepath = "/opt/update"; // Local Path to Site Files
|
||||
$sitehostname = "update.mozilla.org"; // DNS Hostname
|
||||
|
||||
//-- MySQL Server/Database Properties/Connection --//
|
||||
$mysqlServer="localhost";
|
||||
$mysqlData="update"; //MySQL Server Database Name
|
||||
$mysqlLogin=""; //MySQL Server UserName
|
||||
$mysqlPass=""; //MySQL Server Password
|
||||
|
||||
|
||||
$connection = mysql_connect("$mysqlServer","$mysqlLogin","$mysqlPass") or trigger_error("MySQL Error ".mysql_errno().": ".mysql_error()."", E_USER_ERROR);
|
||||
$db = mysql_select_db("$mysqlData", $connection) or trigger_error("MySQL Error ".mysql_errno().": ".mysql_error()."", E_USER_ERROR);
|
||||
|
||||
//-- Page Header & Footer --//
|
||||
$page_header = "$websitepath/core/inc_header.php";
|
||||
$page_footer = "$websitepath/core/inc_footer.php";
|
||||
|
||||
|
||||
//includes
|
||||
include"inc_guids.php"; // GUID Handler
|
||||
include"inc_global.php"; // Global Functions
|
||||
include"sessionconfig.php"; //Start Session
|
||||
|
||||
?>
|
||||
@@ -1,145 +0,0 @@
|
||||
<?php
|
||||
// ***** BEGIN LICENSE BLOCK *****
|
||||
// Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
//
|
||||
// The contents of this file are subject to the Mozilla Public License Version
|
||||
// 1.1 (the "License"); you may not use this file except in compliance with
|
||||
// the License. You may obtain a copy of the License at
|
||||
// http://www.mozilla.org/MPL/
|
||||
//
|
||||
// Software distributed under the License is distributed on an "AS IS" basis,
|
||||
// WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
// for the specific language governing rights and limitations under the
|
||||
// License.
|
||||
//
|
||||
// The Original Code is Mozilla Update.
|
||||
//
|
||||
// The Initial Developer of the Original Code is
|
||||
// Chris "Wolf" Crews.
|
||||
// Portions created by the Initial Developer are Copyright (C) 2004
|
||||
// the Initial Developer. All Rights Reserved.
|
||||
//
|
||||
// Contributor(s):
|
||||
// Chris "Wolf" Crews <psychoticwolf@carolina.rr.com>
|
||||
//
|
||||
// Alternatively, the contents of this file may be used under the terms of
|
||||
// either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
// the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
// in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
// of those above. If you wish to allow use of your version of this file only
|
||||
// under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
// use your version of this file under the terms of the MPL, indicate your
|
||||
// decision by deleting the provisions above and replace them with the notice
|
||||
// and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
// the provisions above, a recipient may use your version of this file under
|
||||
// the terms of any one of the MPL, the GPL or the LGPL.
|
||||
//
|
||||
// ***** END LICENSE BLOCK *****
|
||||
|
||||
//Various Sample User_Agents, uncomment to debug detection for one. :-)
|
||||
//$_SERVER["HTTP_USER_AGENT"] = "Mozilla/5.0 (Photon; U; QNX x86pc; en-US; rv:1.6a) Gecko/20030122";
|
||||
//$_SERVER["HTTP_USER_AGENT"] = "Mozilla/5.0 (BeOS; U; BeOS BePC; en-US; rv:1.4a) Gecko/20030305";
|
||||
//$_SERVER["HTTP_USER_AGENT"] = "Mozilla/5.0 (X11; U; SunOS i86pc; en-US; rv:1.7b) Gecko/20040302";
|
||||
//$_SERVER["HTTP_USER_AGENT"] = "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.6) Gecko/20040206 Lightninglizard/0.8";
|
||||
//$_SERVER["HTTP_USER_AGENT"] = "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7b) Gecko/20040322 Nuclearunicorn/0.8.0+ (Firefox/0.8.0+ rebrand)";
|
||||
//$_SERVER["HTTP_USER_AGENT"] = "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7) Gecko/20040626 Firefox/0.9";
|
||||
//$_SERVER["HTTP_USER_AGENT"] = "Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.7) Gecko/20040803 Firefox/0.9.3";
|
||||
//$_SERVER["HTTP_USER_AGENT"] = "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.2) Gecko/20040818 Firefox/0.9.1+";
|
||||
|
||||
include"browser_detection.php"; //Script that defines the browser_detection() function
|
||||
|
||||
$OS = browser_detection('os');
|
||||
$moz_array = browser_detection('moz_version');
|
||||
|
||||
//Turn $OS into something usable.
|
||||
if ( $moz_array[0] !== '' )
|
||||
{
|
||||
switch ( $OS )
|
||||
{
|
||||
case 'win':
|
||||
case 'nt':
|
||||
$OS = 'Windows';
|
||||
break;
|
||||
case 'lin':
|
||||
$OS = 'Linux';
|
||||
break;
|
||||
case 'solaris':
|
||||
case 'sunos':
|
||||
$OS = 'Solaris';
|
||||
break;
|
||||
case 'unix':
|
||||
case 'bsd':
|
||||
$OS = 'BSD';
|
||||
break;
|
||||
case 'mac':
|
||||
$OS = 'MacOSX';
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
//Print what it's found, debug item.
|
||||
//echo ( 'Your Mozilla product is ' . $moz_array[0] . ' ' . $moz_array[1] . ' running on '. $OS . ' ');
|
||||
|
||||
$application = $moz_array[0];
|
||||
$app_version = $moz_array[1];
|
||||
|
||||
// XXX hack for 10.1 security release -- we need to munge
|
||||
// versions to just check major.minor and ignore release/etc. bits
|
||||
if ($app_version == "0.10.1") {
|
||||
$app_version = "0.10";
|
||||
}
|
||||
|
||||
// XXX hack for 1.0RC1/1.0RC2 release. browser detection needs to be more customizeable per release. heh.
|
||||
// This changes the displayed UA, to the app.extensions.ver internal.
|
||||
if ($app_version == "1.0rc1" or $app_version == "1.0rc2") {
|
||||
$app_version = "1.0";
|
||||
}
|
||||
|
||||
} else {
|
||||
//If it's not a Mozilla product, then return nothing and let the default app code work..
|
||||
}
|
||||
|
||||
//----------------------------
|
||||
//Browser & OS Detection (Default Code)
|
||||
//----------------------------
|
||||
|
||||
//if (!$_GET["application"] or ($_GET["application"]==$application && $_GET["version"]==$moz_array[1])) {
|
||||
//$app_version = $moz_array[1]; //Set app_version from Detection
|
||||
//}
|
||||
|
||||
//Application
|
||||
if (!$application) { $application="firefox"; } //Default App is Firefox
|
||||
|
||||
//App_Version
|
||||
//if ($_GET["version"]) {$app_version = $_GET["version"]; }
|
||||
|
||||
if ($detection_force_version=="true") {$application=$_SESSION["application"];}
|
||||
//Get Max Version for App Specified
|
||||
$sql = "SELECT `major`,`minor`,`release`,`SubVer` FROM `t_applications` WHERE `AppName` = '$application' ORDER BY `major` DESC, `minor` DESC, `release` DESC, `SubVer` DESC";
|
||||
$sql_result = mysql_query($sql, $connection) or trigger_error("MySQL Error ".mysql_errno().": ".mysql_error()."", E_USER_NOTICE);
|
||||
$row = mysql_fetch_array($sql_result);
|
||||
$release = "$row[major].$row[minor]";
|
||||
if ($row["release"]) {$release = ".$release$row[release]";}
|
||||
$subver = $row["SubVer"];
|
||||
if ($subver !=="final") {$release="$release$subver";}
|
||||
|
||||
if (!$app_version OR $detection_force_version=="true") { $app_version = $release; }
|
||||
unset($release, $subver);
|
||||
|
||||
//OS
|
||||
if ($_GET["os"]) {$OS = $_GET["os"];} //If Defined, set.
|
||||
|
||||
// 1.0PR support
|
||||
if ($app_version=="1.0PR") {$app_version="0.10"; }
|
||||
|
||||
// 0.9.x branch support -- All non-branch (+) builds should be 0.9.
|
||||
if (strpos($app_version, "+")=== false AND strpos($app_version, "0.9")===0) { $app_version="0.9";}
|
||||
|
||||
|
||||
|
||||
//Register Browser Detection Values with the session
|
||||
if (!$_SESSION["application"]) { $_SESSION["application"] = $application; }
|
||||
if (!$_SESSION["app_version"]) { $_SESSION["app_version"] = $app_version; }
|
||||
if (!$_SESSION["app_os"]) { $_SESSION["app_os"] = $OS; }
|
||||
?>
|
||||
@@ -1,57 +0,0 @@
|
||||
<?php
|
||||
// ***** BEGIN LICENSE BLOCK *****
|
||||
// Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
//
|
||||
// The contents of this file are subject to the Mozilla Public License Version
|
||||
// 1.1 (the "License"); you may not use this file except in compliance with
|
||||
// the License. You may obtain a copy of the License at
|
||||
// http://www.mozilla.org/MPL/
|
||||
//
|
||||
// Software distributed under the License is distributed on an "AS IS" basis,
|
||||
// WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
// for the specific language governing rights and limitations under the
|
||||
// License.
|
||||
//
|
||||
// The Original Code is Mozilla Update.
|
||||
//
|
||||
// The Initial Developer of the Original Code is
|
||||
// Chris "Wolf" Crews.
|
||||
// Portions created by the Initial Developer are Copyright (C) 2004
|
||||
// the Initial Developer. All Rights Reserved.
|
||||
//
|
||||
// Contributor(s):
|
||||
// Chris "Wolf" Crews <psychoticwolf@carolina.rr.com>
|
||||
//
|
||||
// Alternatively, the contents of this file may be used under the terms of
|
||||
// either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
// the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
// in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
// of those above. If you wish to allow use of your version of this file only
|
||||
// under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
// use your version of this file under the terms of the MPL, indicate your
|
||||
// decision by deleting the provisions above and replace them with the notice
|
||||
// and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
// the provisions above, a recipient may use your version of this file under
|
||||
// the terms of any one of the MPL, the GPL or the LGPL.
|
||||
//
|
||||
// ***** END LICENSE BLOCK *****
|
||||
?>
|
||||
<!--Page Footer-->
|
||||
<?php
|
||||
//Site Timer Counter :: Debug-Mode Item Only
|
||||
$time_end = getmicrotime();
|
||||
//Returns in format: sss.mmmuuunnnppp ;-)
|
||||
// m = millisec, u=microsec, n=nansec, p=picosec
|
||||
$time = round($time_end - $time_start,"6");
|
||||
|
||||
echo"<DIV class=\"footer\">© 2004 <A HREF=\"http://www.mozilla.org\">The Mozilla Organization</A>"; if ($_SESSION["debug"]=="true") {echo" | Page Created in $time seconds"; } echo" | Terms of Use | Top</DIV>"; //Debug Time
|
||||
|
||||
if ($pos !== false) {
|
||||
echo"</div>\n";
|
||||
}
|
||||
if ($_SESSION["debug"]=="true") {
|
||||
print(session_id());
|
||||
echo"<PRE>";print_r($_SESSION); echo"</PRE><Br>\n";
|
||||
echo"Current application data: $application - $app_version - $OS ";
|
||||
}
|
||||
?>
|
||||
@@ -1,102 +0,0 @@
|
||||
<?php
|
||||
// ***** BEGIN LICENSE BLOCK *****
|
||||
// Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
//
|
||||
// The contents of this file are subject to the Mozilla Public License Version
|
||||
// 1.1 (the "License"); you may not use this file except in compliance with
|
||||
// the License. You may obtain a copy of the License at
|
||||
// http://www.mozilla.org/MPL/
|
||||
//
|
||||
// Software distributed under the License is distributed on an "AS IS" basis,
|
||||
// WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
// for the specific language governing rights and limitations under the
|
||||
// License.
|
||||
//
|
||||
// The Original Code is Mozilla Update.
|
||||
//
|
||||
// The Initial Developer of the Original Code is
|
||||
// Chris "Wolf" Crews.
|
||||
// Portions created by the Initial Developer are Copyright (C) 2004
|
||||
// the Initial Developer. All Rights Reserved.
|
||||
//
|
||||
// Contributor(s):
|
||||
// Chris "Wolf" Crews <psychoticwolf@carolina.rr.com>
|
||||
//
|
||||
// Alternatively, the contents of this file may be used under the terms of
|
||||
// either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
// the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
// in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
// of those above. If you wish to allow use of your version of this file only
|
||||
// under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
// use your version of this file under the terms of the MPL, indicate your
|
||||
// decision by deleting the provisions above and replace them with the notice
|
||||
// and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
// the provisions above, a recipient may use your version of this file under
|
||||
// the terms of any one of the MPL, the GPL or the LGPL.
|
||||
//
|
||||
// ***** END LICENSE BLOCK *****
|
||||
|
||||
//inc_global.php -- Stuff that needs to be done globally to all of Mozilla Update
|
||||
|
||||
//Cache Control Headers
|
||||
$expstr = gmdate("D, d M Y H:i:s", time() + 1800) . " GMT";
|
||||
header("Expires: $expstr");
|
||||
header("Cache-Control: public, pre-check=0, post-check=0, max-age=1800");
|
||||
|
||||
|
||||
//Attempt to fix Bug 246743 (strip_tags) and Bug 248242 (htmlentities)
|
||||
foreach ($_GET as $key => $val) {
|
||||
$_GET["$key"] = htmlentities(str_replace("\\","",strip_tags($_GET["$key"])));
|
||||
}
|
||||
|
||||
//Set Debug Mode session Variable
|
||||
if ($_GET["debug"]=="true") {$_SESSION["debug"]=$_GET["debug"]; } else if ($_GET["debug"]=="false") {unset($_SESSION["debug"]);}
|
||||
|
||||
// Bug 250596 Fixes for incoming $_GET variables.
|
||||
if ($_GET["application"]) {
|
||||
$_GET["application"] = strtolower($_GET["application"]);
|
||||
$sql = "SELECT AppID FROM `t_applications` WHERE `AppName` = '".ucwords(strtolower($_GET["application"]))."' LIMIT 1";
|
||||
$sql_result = mysql_query($sql, $connection) or trigger_error("MySQL Error ".mysql_errno().": ".mysql_error()."", E_USER_NOTICE);
|
||||
if (mysql_num_rows($sql_result)===0) {unset($_GET["application"]);}
|
||||
}
|
||||
|
||||
//if ($_GET["version"]) {
|
||||
//$sql = "SELECT AppID FROM `t_applications` WHERE `Release` = '$_GET[version]' LIMIT 1";
|
||||
// $sql_result = mysql_query($sql, $connection) or trigger_error("MySQL Error ".mysql_errno().": ".mysql_error()."", E_USER_NOTICE);
|
||||
// if (mysql_num_rows($sql_result)===0) {unset($_GET["application"]);}
|
||||
//}
|
||||
|
||||
if ($_GET["category"] AND $_GET["category"] !=="All"
|
||||
AND $_GET["category"] !=="Editors Pick" AND $_GET["category"] !=="Popular"
|
||||
AND $_GET["category"] !=="Top Rated" AND $_GET["category"] !=="Newest") {
|
||||
$sql = "SELECT CatName FROM `t_categories` WHERE `CatName` = '".ucwords(strtolower($_GET["category"]))."' LIMIT 1";
|
||||
$sql_result = mysql_query($sql, $connection) or trigger_error("MySQL Error ".mysql_errno().": ".mysql_error()."", E_USER_NOTICE);
|
||||
if (mysql_num_rows($sql_result)===0) {unset($_GET["category"]);}
|
||||
}
|
||||
|
||||
if (!is_numeric($_GET["id"])) { unset($_GET["id"]); }
|
||||
if (!is_numeric($_GET["vid"])) { unset($_GET["vid"]); }
|
||||
if (!is_numeric($_GET["pageid"])) { unset($_GET["pageid"]); }
|
||||
if (!is_numeric($_GET["numpg"])) { unset($_GET["numpg"]); }
|
||||
|
||||
// page_error() function
|
||||
|
||||
function page_error($reason, $custom_message) {
|
||||
global $page_header, $page_footer;
|
||||
echo"<TITLE>Mozilla Update :: Error</TITLE>\n";
|
||||
echo"<LINK REL=\"STYLESHEET\" TYPE=\"text/css\" HREF=\"/core/update.css\">\n";
|
||||
include"$page_header";
|
||||
|
||||
echo"<DIV class=\"contentbox\" style=\"border-color: #F00; width: 90%; margin: auto; min-height: 250px; margin-bottom: 5px\">\n";
|
||||
echo"<DIV class=\"boxheader\">Mozilla Update :: Error</DIV>\n";
|
||||
echo"<SPAN style=\"font-size: 12pt\">\n";
|
||||
echo"Mozilla Update has encountered an error and is unable to fulfill your request. Please try your request again later. If the
|
||||
problem continues, please contact the Mozilla Update staff. More information about the error may be found at the end of this
|
||||
message.<BR><BR>
|
||||
Error $reason: $custom_message<BR><BR>
|
||||
<A HREF=\"javascript:history.back()\">«« Go Back to Previous Page</A>";
|
||||
echo"</SPAN></DIV>\n";
|
||||
include"$page_footer";
|
||||
exit;
|
||||
}
|
||||
?>
|
||||
@@ -1,49 +0,0 @@
|
||||
<?php
|
||||
// ***** BEGIN LICENSE BLOCK *****
|
||||
// Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
//
|
||||
// The contents of this file are subject to the Mozilla Public License Version
|
||||
// 1.1 (the "License"); you may not use this file except in compliance with
|
||||
// the License. You may obtain a copy of the License at
|
||||
// http://www.mozilla.org/MPL/
|
||||
//
|
||||
// Software distributed under the License is distributed on an "AS IS" basis,
|
||||
// WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
// for the specific language governing rights and limitations under the
|
||||
// License.
|
||||
//
|
||||
// The Original Code is Mozilla Update.
|
||||
//
|
||||
// The Initial Developer of the Original Code is
|
||||
// Chris "Wolf" Crews.
|
||||
// Portions created by the Initial Developer are Copyright (C) 2004
|
||||
// the Initial Developer. All Rights Reserved.
|
||||
//
|
||||
// Contributor(s):
|
||||
// Chris "Wolf" Crews <psychoticwolf@carolina.rr.com>
|
||||
//
|
||||
// Alternatively, the contents of this file may be used under the terms of
|
||||
// either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
// the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
// in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
// of those above. If you wish to allow use of your version of this file only
|
||||
// under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
// use your version of this file under the terms of the MPL, indicate your
|
||||
// decision by deleting the provisions above and replace them with the notice
|
||||
// and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
// the provisions above, a recipient may use your version of this file under
|
||||
// the terms of any one of the MPL, the GPL or the LGPL.
|
||||
//
|
||||
// ***** END LICENSE BLOCK *****
|
||||
|
||||
//Reset GUIDs to something human-readable
|
||||
if ($_GET["application"]=="{ec8030f7-c20a-464f-9b0e-13a3a9e97384}") {
|
||||
$_GET["application"]="firefox";
|
||||
|
||||
} else if ($_GET["application"]=="{3550f703-e582-4d05-9a08-453d09bdfdc6}") {
|
||||
$_GET["application"]="thunderbird";
|
||||
|
||||
} else if ($_GET["application"]=="{86c18b42-e466-45a9-ae7a-9b95ba6f5640}") {
|
||||
$_GET["application"]="mozilla";
|
||||
}
|
||||
?>
|
||||
@@ -1,82 +0,0 @@
|
||||
<?php
|
||||
// ***** BEGIN LICENSE BLOCK *****
|
||||
// Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
//
|
||||
// The contents of this file are subject to the Mozilla Public License Version
|
||||
// 1.1 (the "License"); you may not use this file except in compliance with
|
||||
// the License. You may obtain a copy of the License at
|
||||
// http://www.mozilla.org/MPL/
|
||||
//
|
||||
// Software distributed under the License is distributed on an "AS IS" basis,
|
||||
// WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
// for the specific language governing rights and limitations under the
|
||||
// License.
|
||||
//
|
||||
// The Original Code is Mozilla Update.
|
||||
//
|
||||
// The Initial Developer of the Original Code is
|
||||
// Chris "Wolf" Crews.
|
||||
// Portions created by the Initial Developer are Copyright (C) 2004
|
||||
// the Initial Developer. All Rights Reserved.
|
||||
//
|
||||
// Contributor(s):
|
||||
// Chris "Wolf" Crews <psychoticwolf@carolina.rr.com>
|
||||
//
|
||||
// Alternatively, the contents of this file may be used under the terms of
|
||||
// either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
// the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
// in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
// of those above. If you wish to allow use of your version of this file only
|
||||
// under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
// use your version of this file under the terms of the MPL, indicate your
|
||||
// decision by deleting the provisions above and replace them with the notice
|
||||
// and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
// the provisions above, a recipient may use your version of this file under
|
||||
// the terms of any one of the MPL, the GPL or the LGPL.
|
||||
//
|
||||
// ***** END LICENSE BLOCK *****
|
||||
|
||||
$pos = strpos($_SERVER["REQUEST_URI"], "/admin");
|
||||
if ($pos !== false) {
|
||||
echo'<LINK REL="STYLESHEET" TYPE="text/css" HREF="/core/mozupdates.bak.css">';
|
||||
$application="login";
|
||||
}
|
||||
?>
|
||||
<DIV class="header">
|
||||
<?php //if ($_GET["application"]) {$application=$_GET["application"]; } else {$application="firefox"; } ?>
|
||||
<DIV class="logo"><IMG SRC="/images/<?php echo"$application"; ?>-cornerlogo.png" BORDER=0 ALT=""></DIV>
|
||||
<DIV class="header-top"><A HREF="/"><IMG SRC="/images/updatelogo.png" BORDER=0 HEIGHT=55 WIDTH=270 ALT="Mozilla Update"></A></DIV>
|
||||
<DIV class="tabbar">
|
||||
<A HREF="/?application=mozilla"><IMG SRC="/images/tab-mozilla<?php if ($application=="mozilla") {echo"-selected"; } ?>.png" BORDER=0 HEIGHT=20 WIDTH=98 ALT="[Mozilla] "></A><A HREF="/?application=firefox"><IMG SRC="/images/tab-firefox<?php if ($application=="firefox") {echo"-selected"; } ?>.png" BORDER=0 HEIGHT=20 WIDTH=98 ALT="[Firefox] "></A><A HREF="/?application=thunderbird"><IMG SRC="/images/tab-thunderbird<?php if ($application=="thunderbird") {echo"-selected"; } ?>.png" BORDER=0 HEIGHT=20 WIDTH=105 ALT="[Thunderbird] "></A><A HREF="/developercp.php"><IMG SRC="/images/tab-login<?php if ($application=="login") {echo"-selected"; } ?>.png" BORDER=0 HEIGHT=20 WIDTH=98 ALT="[Login]"></A>
|
||||
</DIV>
|
||||
</DIV>
|
||||
<DIV class="bar"></DIV>
|
||||
<DIV class="nav">
|
||||
<?php if ($application !=="login") { ?>
|
||||
<A HREF="/?application=<?php echo"$application"; ?>">Home</A>
|
||||
| <A HREF="/faq/?application=<?php echo"$application"; ?>">FAQ</A>
|
||||
<?php
|
||||
// Types
|
||||
$types = array("E"=>"Extensions","T"=>"Themes");
|
||||
foreach($types as $typeid => $typename) {
|
||||
echo" | <A HREF=\"/".strtolower($typename)."/?application=$application\">$typename</A>";
|
||||
}
|
||||
//echo"<BR>\n";
|
||||
|
||||
} else { echo" "; }
|
||||
?>
|
||||
</DIV>
|
||||
|
||||
<?php
|
||||
if ($pos !== false) {
|
||||
?>
|
||||
<?php if ($_SESSION["logoncheck"] =="YES" && $headerline !="none") { ?>
|
||||
<DIV class="adminheading">
|
||||
Welcome<?php echo" $_SESSION[name]"; ?>!
|
||||
<a href="usermanager.php?function=edituser&userid=<?php echo"$_SESSION[uid]"; ?>">Your Profile</a> | <A HREF="main.php">Home</A> |<A HREF="logout.php">Logout</A>
|
||||
<?php } ?>
|
||||
</DIV>
|
||||
<div id="mainContent">
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
@@ -1,103 +0,0 @@
|
||||
<?php
|
||||
// ***** BEGIN LICENSE BLOCK *****
|
||||
// Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
//
|
||||
// The contents of this file are subject to the Mozilla Public License Version
|
||||
// 1.1 (the "License"); you may not use this file except in compliance with
|
||||
// the License. You may obtain a copy of the License at
|
||||
// http://www.mozilla.org/MPL/
|
||||
//
|
||||
// Software distributed under the License is distributed on an "AS IS" basis,
|
||||
// WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
// for the specific language governing rights and limitations under the
|
||||
// License.
|
||||
//
|
||||
// The Original Code is Mozilla Update.
|
||||
//
|
||||
// The Initial Developer of the Original Code is
|
||||
// Chris "Wolf" Crews.
|
||||
// Portions created by the Initial Developer are Copyright (C) 2004
|
||||
// the Initial Developer. All Rights Reserved.
|
||||
//
|
||||
// Contributor(s):
|
||||
// Chris "Wolf" Crews <psychoticwolf@carolina.rr.com>
|
||||
//
|
||||
// Alternatively, the contents of this file may be used under the terms of
|
||||
// either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
// the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
// in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
// of those above. If you wish to allow use of your version of this file only
|
||||
// under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
// use your version of this file under the terms of the MPL, indicate your
|
||||
// decision by deleting the provisions above and replace them with the notice
|
||||
// and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
// the provisions above, a recipient may use your version of this file under
|
||||
// the terms of any one of the MPL, the GPL or the LGPL.
|
||||
//
|
||||
// ***** END LICENSE BLOCK *****
|
||||
|
||||
//Submit Review/Rating Feedback to Table
|
||||
require"../core/config.php";
|
||||
if (!$_POST[rating] && $_POST[rating] !=="0") {
|
||||
//No Rating Defined, send user back...
|
||||
$return_path="extensions/moreinfo.php?id=$_POST[id]&vid=$_POST[vid]&page=opinion&error=norating";
|
||||
header("Location: http://$_SERVER[HTTP_HOST]/$return_path");
|
||||
exit;
|
||||
}
|
||||
|
||||
if (!$_POST[comments]) {
|
||||
$_POST[comments]="NULL";
|
||||
} else {
|
||||
//Comments is not null, format comments and get default name/title.. if needed.
|
||||
$_POST["comments"]="'$_POST[comments]'";
|
||||
if (!$_POST[name]) {$_POST[name]=="Anonymous"; }
|
||||
if (!$_POST[title]) {$_POST[title]=="My Comments..."; }
|
||||
}
|
||||
|
||||
$_POST["name"] = strip_tags($_POST["name"]);
|
||||
$_POST["title"] = strip_tags($_POST["title"]);
|
||||
$_POST["comments"] = strip_tags($_POST["comments"]);
|
||||
|
||||
//Are we behind a proxy and given the IP via an alternate enviroment variable? If so, use it.
|
||||
if ($_SERVER["HTTP_X_FORWARDED_FOR"]) {
|
||||
$remote_addr = $_SERVER["HTTP_X_FORWARDED_FOR"];
|
||||
} else {
|
||||
$remote_addr = $_SERVER["REMOTE_ADDR"];
|
||||
}
|
||||
|
||||
$sql = "INSERT INTO `t_feedback` (`ID`, `CommentName`, `CommentVote`, `CommentTitle`, `CommentNote`, `CommentDate`, `commentip`) VALUES ('$_POST[id]', '$_POST[name]', '$_POST[rating]', '$_POST[title]', $_POST[comments], NOW(NULL), '$remote_addr');";
|
||||
$sql_result = mysql_query($sql, $connection) or trigger_error("MySQL Error ".mysql_errno().": ".mysql_error()."", E_USER_NOTICE);
|
||||
|
||||
|
||||
//Get Rating Data and Create $ratingarray
|
||||
$sql = "SELECT ID, CommentVote FROM `t_feedback` WHERE `ID` = '$_POST[id]' AND `CommentVote` IS NOT NULL AND `CommentNote` IS NOT NULL ORDER BY `CommentDate` ASC";
|
||||
$sql_result = mysql_query($sql, $connection) or trigger_error("MySQL Error ".mysql_errno().": ".mysql_error()."", E_USER_NOTICE);
|
||||
while ($row = mysql_fetch_array($sql_result)) {
|
||||
$ratingarray[$row[ID]][] = $row["CommentVote"];
|
||||
}
|
||||
|
||||
//Compile Rating Average
|
||||
$id = $_POST[id];
|
||||
if (!$ratingarray[$id]) {$ratingarray[$id] = array(); }
|
||||
$numratings = count($ratingarray[$id]);
|
||||
$sumratings = array_sum($ratingarray[$id]);
|
||||
if ($numratings>0) {
|
||||
$rating = round($sumratings/$numratings, 1);
|
||||
} else {
|
||||
$rating="0"; } //Default Rating
|
||||
|
||||
|
||||
$sql = "UPDATE `t_main` SET `Rating`='$rating' WHERE `ID`='$id' LIMIT 1";
|
||||
$sql_result = mysql_query($sql, $connection) or trigger_error("MySQL Error ".mysql_errno().": ".mysql_error()."", E_USER_NOTICE);
|
||||
|
||||
|
||||
if ($_POST["type"]=="E") {
|
||||
$type="extensions";
|
||||
} else if ($_POST["type"]=="T") {
|
||||
$type="themes";
|
||||
}
|
||||
|
||||
$return_path="$type/moreinfo.php?id=$_POST[id]&vid=$_POST[vid]&page=comments&action=postsuccessfull";
|
||||
header("Location: http://$sitehostname/$return_path");
|
||||
exit;
|
||||
?>
|
||||
@@ -1,94 +0,0 @@
|
||||
<?php
|
||||
// ***** BEGIN LICENSE BLOCK *****
|
||||
// Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
//
|
||||
// The contents of this file are subject to the Mozilla Public License Version
|
||||
// 1.1 (the "License"); you may not use this file except in compliance with
|
||||
// the License. You may obtain a copy of the License at
|
||||
// http://www.mozilla.org/MPL/
|
||||
//
|
||||
// Software distributed under the License is distributed on an "AS IS" basis,
|
||||
// WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
// for the specific language governing rights and limitations under the
|
||||
// License.
|
||||
//
|
||||
// The Original Code is Mozilla Update.
|
||||
//
|
||||
// The Initial Developer of the Original Code is
|
||||
// Chris "Wolf" Crews.
|
||||
// Portions created by the Initial Developer are Copyright (C) 2004
|
||||
// the Initial Developer. All Rights Reserved.
|
||||
//
|
||||
// Contributor(s):
|
||||
// Chris "Wolf" Crews <psychoticwolf@carolina.rr.com>
|
||||
//
|
||||
// Alternatively, the contents of this file may be used under the terms of
|
||||
// either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
// the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
// in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
// of those above. If you wish to allow use of your version of this file only
|
||||
// under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
// use your version of this file under the terms of the MPL, indicate your
|
||||
// decision by deleting the provisions above and replace them with the notice
|
||||
// and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
// the provisions above, a recipient may use your version of this file under
|
||||
// the terms of any one of the MPL, the GPL or the LGPL.
|
||||
//
|
||||
// ***** END LICENSE BLOCK *****
|
||||
|
||||
//session_name('sid');
|
||||
//session_name();
|
||||
//session_start();
|
||||
|
||||
if ($_GET["version"]=="auto-detect") {$_GET["version"]=""; unset($_SESSION["app_version"]);}//Clear Versioning in Session For AutoDetect
|
||||
if ($_GET["application"] AND $_GET["application"] != $_SESSION["application"]) {
|
||||
$_SESSION["application"] = $_GET["application"]; //Put the selected app into session. skip detection. ;-)
|
||||
unset($_SESSION["app_version"]);
|
||||
$detection_force_version = "true"; //Skip application checking, just fill in the version.
|
||||
}
|
||||
|
||||
//Get Browser Detection Data if it's not in the Session vars already
|
||||
if (!$_SESSION["application"] OR !$_SESSION["app_version"]) {
|
||||
include"inc_browserdetection.php";
|
||||
}
|
||||
|
||||
//Change OS Support for showlist.php
|
||||
switch ( $_GET["os"] )
|
||||
{
|
||||
case 'windows':
|
||||
$_GET["os"] = 'Windows';
|
||||
break;
|
||||
case 'linux':
|
||||
$_GET["os"] = 'Linux';
|
||||
break;
|
||||
case 'solaris':
|
||||
$_GET["os"] = 'Solaris';
|
||||
break;
|
||||
case 'bsd':
|
||||
$_GET["os"] = 'BSD';
|
||||
break;
|
||||
case 'macosx':
|
||||
$_GET["os"] = 'MacOSX';
|
||||
break;
|
||||
case 'all':
|
||||
$_GET["os"] = 'ALL';
|
||||
break;
|
||||
default:
|
||||
unset($_GET["os"]);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
if (($_GET["os"] and $_SESSION["app_os"]) AND $_GET["os"] !== $_SESSION["app_os"]) {
|
||||
$_SESSION["app_os"]=$_GET["os"];
|
||||
|
||||
}
|
||||
|
||||
//Got session data for browser/app detection, populate the variables
|
||||
$application = $_SESSION["application"];
|
||||
$app_version = $_SESSION["app_version"];
|
||||
$OS = $_SESSION["app_os"];
|
||||
|
||||
|
||||
if ($_GET["debug"]=="killappdata") { unset($_SESSION["application"],$_SESSION["app_version"]); }
|
||||
?>
|
||||
@@ -1,226 +0,0 @@
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is Mozilla Update.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Chris "Wolf" Crews.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2004
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Chris "Wolf" Crews <psychoticwolf@carolina.rr.com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
BODY {
|
||||
MARGIN: 0px 0px 5px; FONT-FAMILY: Arial; BACKGROUND-COLOR: #fff
|
||||
}
|
||||
A {
|
||||
COLOR: #00129c; TEXT-DECORATION: none
|
||||
}
|
||||
A:visited {
|
||||
COLOR: #00129c; TEXT-DECORATION: none
|
||||
}
|
||||
A:hover {
|
||||
COLOR: #fc5900
|
||||
}
|
||||
DIV.header {
|
||||
BACKGROUND-IMAGE: url(/images/header.png); BACKGROUND-REPEAT: repeat-x; HEIGHT: 77px
|
||||
}
|
||||
DIV.header-top {
|
||||
HEIGHT: 57px
|
||||
}
|
||||
DIV.logo {
|
||||
z-index: 1; position: absolute; right: 0px
|
||||
}
|
||||
DIV.tabbar {
|
||||
PADDING-LEFT: 26px; HEIGHT: 20px
|
||||
}
|
||||
|
||||
DIV.nav {
|
||||
BACKGROUND-IMAGE: url(/images/orangebar.png); background-repeat: repeat-x; PADDING-TOP: 3px; PADDING-LEFT: 10px; FONT-WEIGHT: bold; MARGIN-BOTTOM: 10px; COLOR: #fff; BACKGROUND-COLOR: #0F67C1; a:VISITED: #fff
|
||||
}
|
||||
DIV.nav A:visited {
|
||||
COLOR: #FFF;
|
||||
}
|
||||
DIV.nav A {
|
||||
COLOR: #fff
|
||||
}
|
||||
DIV.adminheading {
|
||||
FONT-WEIGHT: bold; FONT-SIZE: 10pt; MARGIN-RIGHT: 10px; HEIGHT: 25px; TEXT-ALIGN: right
|
||||
}
|
||||
.box {
|
||||
BORDER-RIGHT: #ccc 2px solid; PADDING-RIGHT: 5px; BORDER-TOP: #ccc 2px solid; PADDING-LEFT: 5px; FONT-WEIGHT: bold; FONT-SIZE: 14pt; MARGIN-BOTTOM: 15px; PADDING-BOTTOM: 5px; POSITION: relative; LEFT: 150px; BORDER-LEFT: #ccc 2px solid; WIDTH: 78%; PADDING-TOP: 5px; BORDER-BOTTOM: #ccc 2px solid; -moz-border-radius: 10px
|
||||
}
|
||||
.boxheader {
|
||||
MARGIN-BOTTOM: 6px; BORDER-BOTTOM: #000 1px solid
|
||||
}
|
||||
.boxcolumns {
|
||||
BORDER-RIGHT: #ccc 2px solid; PADDING-RIGHT: 2px; BORDER-TOP: #ccc 2px solid; PADDING-LEFT: 2px; FONT-SIZE: 12pt; MIN-HEIGHT: 200px; FLOAT: left; PADDING-BOTTOM: 2px; MARGIN-LEFT: 2px; BORDER-LEFT: #ccc 2px solid; WIDTH: 31%; PADDING-TOP: 2px; BORDER-BOTTOM: #ccc 2px solid; -moz-border-radius: 10px
|
||||
}
|
||||
DIV.sidelinks {
|
||||
BORDER-RIGHT: #ccc 2px solid; PADDING-RIGHT: 2px; BORDER-TOP: #ccc 2px solid; MARGIN-TOP: 10px; PADDING-LEFT: 2px; PADDING-BOTTOM: 2px; MARGIN-LEFT: 3px; BORDER-LEFT: #ccc 2px solid; WIDTH: 135px; PADDING-TOP: 2px; BORDER-BOTTOM: #ccc 2px solid; POSITION: absolute; -moz-border-radius: 10px
|
||||
}
|
||||
.sidebartitle {
|
||||
FONT-WEIGHT: bold
|
||||
}
|
||||
.sidebartext {
|
||||
MARGIN-LEFT: 4px
|
||||
}
|
||||
.updatebox {
|
||||
BORDER-RIGHT: #ccc 2px solid; PADDING-RIGHT: 5px; BORDER-TOP: #ccc 2px solid; MARGIN-TOP: 3px; PADDING-LEFT: 5px; FONT-WEIGHT: bold; FONT-SIZE: 14pt; MIN-HEIGHT: 200px; MARGIN-BOTTOM: 15px; PADDING-BOTTOM: 5px; MARGIN-LEFT: 1px; BORDER-LEFT: #ccc 2px solid; WIDTH: 230px; PADDING-TOP: 5px; BORDER-BOTTOM: #ccc 2px solid; POSITION: absolute; -moz-border-radius: 10px
|
||||
}
|
||||
.frontpagecontainer {
|
||||
MIN-HEIGHT: 150px; WIDTH: 100%
|
||||
}
|
||||
.contentbox {
|
||||
BORDER-RIGHT: #ccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #ccc 1px solid; PADDING-LEFT: 5px; FONT-WEIGHT: bold; FONT-SIZE: 14pt; PADDING-BOTTOM: 5px; MARGIN: 0px 5px 15px 0px; BORDER-LEFT: #ccc 1px solid; PADDING-TOP: 5px; BORDER-BOTTOM: #ccc 1px solid; -moz-border-radius: 10px
|
||||
}
|
||||
.contentcolumns {
|
||||
FLOAT: left; WIDTH: 48%
|
||||
}
|
||||
|
||||
#content {
|
||||
PADDING-LEFT: 5px; POSITION: relative; LEFT: 145px; WIDTH: 85%;
|
||||
}
|
||||
|
||||
DIV.item {
|
||||
BORDER-RIGHT: #ccc 2px solid; PADDING-RIGHT: 8px; BORDER-TOP: #ccc 2px solid; PADDING-LEFT: 8px; PADDING-BOTTOM: 0px; MARGIN: 0px auto 15px; BORDER-LEFT: #ccc 2px solid; WIDTH: 95%; PADDING-TOP: 8px; BORDER-BOTTOM: #ccc 2px solid; -moz-border-radius: 10px
|
||||
}
|
||||
#listnav {
|
||||
BORDER-RIGHT: #ccc 2px solid; PADDING-RIGHT: 6px; BORDER-TOP: #ccc 2px solid; PADDING-LEFT: 6px; FONT-WEIGHT: bold; FONT-SIZE: 10pt; PADDING-BOTTOM: 6px; MARGIN: 3px auto; BORDER-LEFT: #ccc 2px solid; WIDTH: 95%; PADDING-TOP: 6px; BORDER-BOTTOM: #ccc 2px solid; TEXT-ALIGN: left; -moz-border-radius: 10px
|
||||
}
|
||||
.listform {
|
||||
BORDER-RIGHT: #3d97c0 1px dotted; PADDING-RIGHT: 2px; BORDER-TOP: #3d97c0 1px dotted; PADDING-LEFT: 2px; PADDING-BOTTOM: 2px; MARGIN: 10px auto auto; BORDER-LEFT: #3d97c0 1px dotted; WIDTH: 90%; PADDING-TOP: 2px; BORDER-BOTTOM: #3d97c0 1px dotted; HEIGHT: 25px; BACKGROUND-COLOR: #d4e9f2; TEXT-ALIGN: center
|
||||
}
|
||||
.title A {
|
||||
COLOR: #fc5900
|
||||
}
|
||||
.title A:visited {
|
||||
COLOR: #fc5900
|
||||
}
|
||||
.liststars {
|
||||
FLOAT: right; WIDTH: 80px; HEIGHT: 20px
|
||||
}
|
||||
.listtitle {
|
||||
FONT-WEIGHT: bold; FONT-SIZE: 11pt
|
||||
}
|
||||
.itemtitle {
|
||||
FONT-WEIGHT: bold; FONT-SIZE: 14pt; MARGIN-BOTTOM: 10px; MARGIN-LEFT: 30px
|
||||
}
|
||||
.authorline {
|
||||
FONT-SIZE: 10pt; MARGIN-LEFT: 15px
|
||||
}
|
||||
.itemdescription {
|
||||
FONT-SIZE: 10pt
|
||||
}
|
||||
.iconbar {
|
||||
PADDING-RIGHT: 5px; FONT-WEIGHT: normal; FONT-SIZE: 9pt; FLOAT: right; WIDTH: 125px; HEIGHT: 34px; TEXT-ALIGN: left
|
||||
}
|
||||
.filesize {
|
||||
FONT-WEIGHT: bold; FONT-SIZE: 8pt
|
||||
}
|
||||
.smallfont {
|
||||
FONT-WEIGHT: bold; FONT-SIZE: 8pt
|
||||
}
|
||||
.baseline {
|
||||
BORDER-TOP: #ccc 1px solid; PADDING-LEFT: 10px; FONT-WEIGHT: bold; FONT-SIZE: 8pt; COLOR: #333
|
||||
}
|
||||
.noitems {
|
||||
FONT-WEIGHT: bold; FONT-SIZE: 12pt; HEIGHT: 60px; TEXT-ALIGN: center
|
||||
}
|
||||
.pagenum {
|
||||
FONT-SIZE: 9pt; FLOAT: right
|
||||
}
|
||||
DIV.tabbar {
|
||||
PADDING-RIGHT: 8px; PADDING-LEFT: 8px; PADDING-BOTTOM: 0px; MARGIN: 0px auto auto; WIDTH: 85%; PADDING-TOP: 0px; HEIGHT: 20px
|
||||
}
|
||||
DIV.tab {
|
||||
BORDER-RIGHT: #ccc 2px solid; PADDING-RIGHT: 3px; BORDER-TOP: #ccc 2px solid; PADDING-LEFT: 3px; FONT-SIZE: 11pt; FLOAT: left; MARGIN: 0px 3px; VERTICAL-ALIGN: middle; BORDER-LEFT: #ccc 2px solid; BORDER-BOTTOM: #ccc 2px solid; HEIGHT: 20px; BACKGROUND-COLOR: #ddd; TEXT-ALIGN: center; -moz-border-radius: 10px
|
||||
}
|
||||
.downloadbox {
|
||||
BORDER-RIGHT: #ccc 1px dotted; BORDER-TOP: #ccc 1px dotted; FONT-WEIGHT: bold; FLOAT: left; BORDER-LEFT: #ccc 1px dotted; BORDER-BOTTOM: #ccc 1px dotted; max-width: 395px;
|
||||
}
|
||||
.moreinfoinstall {
|
||||
MARGIN-LEFT: 18px; WIDTH: 250px; HEIGHT: 34px
|
||||
}
|
||||
.commentbox {
|
||||
BORDER-RIGHT: #ccc 1px solid; PADDING-RIGHT: 2px; BORDER-TOP: #ccc 1px solid; PADDING-LEFT: 5px; FONT-WEIGHT: bold; FONT-SIZE: 10pt; MIN-HEIGHT: 260px; PADDING-BOTTOM: 6px; MARGIN: auto 0px 5px auto; BORDER-LEFT: #ccc 1px solid; WIDTH: 50%; PADDING-TOP: 2px; BORDER-BOTTOM: #ccc 1px solid
|
||||
}
|
||||
.commenttitlebar {
|
||||
PADDING-LEFT: 0px; FONT-WEIGHT: bold; FONT-SIZE: 11pt; HEIGHT: 20px; BACKGROUND-COLOR: #eee
|
||||
}
|
||||
.commenttitle {
|
||||
PADDING-LEFT: 0px; FONT-WEIGHT: bold; FONT-SIZE: 11pt; POSITION: absolute
|
||||
}
|
||||
.commentfooter {
|
||||
PADDING-RIGHT: 5px; FONT-SIZE: 8pt; TEXT-ALIGN: right
|
||||
}
|
||||
.nocomment {
|
||||
MARGIN-LEFT: 30px
|
||||
}
|
||||
.mipageheading {
|
||||
BORDER-TOP: #ccc 1px solid; MARGIN-TOP: 5px; PADDING-LEFT: 4px; FONT-WEIGHT: bold; FONT-SIZE: 11pt; MARGIN-BOTTOM: 5px; COLOR: #333
|
||||
}
|
||||
.reviewbox {
|
||||
BORDER-RIGHT: #bbb 1px dotted; BORDER-TOP: #bbb 1px dotted; FONT-WEIGHT: bold; MARGIN: auto auto 10px; BORDER-LEFT: #bbb 1px dotted; WIDTH: 70%; BORDER-BOTTOM: #bbb 1px dotted
|
||||
};
|
||||
.opinionform {
|
||||
FONT-WEIGHT: bold; FONT-SIZE: 10pt; MARGIN: auto 30px; WIDTH: 80%; LINE-HEIGHT: 30px
|
||||
}
|
||||
.errorbox {
|
||||
BORDER-RIGHT: #f00 1px solid; PADDING-RIGHT: 3px; BORDER-TOP: #f00 1px solid; PADDING-LEFT: 3px; PADDING-BOTTOM: 3px; MARGIN: auto auto 20px; BORDER-LEFT: #f00 1px solid; WIDTH: 80%; PADDING-TOP: 3px; BORDER-BOTTOM: #f00 1px solid
|
||||
}
|
||||
.boxheader2 {
|
||||
BORDER-TOP: #2e64ff 4px solid; HEIGHT: 4px
|
||||
}
|
||||
.boldfont {
|
||||
FONT-WEIGHT: bold
|
||||
}
|
||||
.disabled {
|
||||
FONT-WEIGHT: bold; FONT-SIZE: 10pt; COLOR: #ccc; FONT-STYLE: italic
|
||||
}
|
||||
.emailactive {
|
||||
FONT-WEIGHT: bold; FONT-SIZE: 10pt; FONT-STYLE: italic
|
||||
}
|
||||
.profileitemdesc {
|
||||
FONT-WEIGHT: bold; FONT-SIZE: 10pt; MARGIN-BOTTOM: 4px; MARGIN-LEFT: 20px
|
||||
}
|
||||
.mailresult {
|
||||
FONT-WEIGHT: bold; FONT-SIZE: 14pt; MARGIN: auto; WIDTH: 650px; HEIGHT: 30px; TEXT-ALIGN: center
|
||||
}
|
||||
.faqtitle {
|
||||
FONT-WEIGHT: normal; FONT-SIZE: 24pt; COLOR: #0065CA; TEXT-ALIGN: center
|
||||
}
|
||||
.faqitemtitle {
|
||||
FONT-WEIGHT: bold; FONT-SIZE: 12pt
|
||||
}
|
||||
.faqitemtext {
|
||||
MARGIN-LEFT: 5px
|
||||
}
|
||||
.footer {
|
||||
PADDING-RIGHT: 30px; FONT-WEIGHT: bold; FONT-SIZE: 10pt; MARGIN-LEFT: 200px; TEXT-ALIGN: right
|
||||
}
|
||||
@@ -1,4 +0,0 @@
|
||||
The files contained in this directory are schema for the Mozilla Update MySQL Database.
|
||||
This directory does not have to be on the webserver for the site to function, in fact, it should not be.
|
||||
|
||||
Mozilla Update requires MySQL 4.0 or higher w/ InnoDB support.
|
||||
@@ -1,348 +0,0 @@
|
||||
# ***** BEGIN LICENSE BLOCK *****
|
||||
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
#
|
||||
# The contents of this file are subject to the Mozilla Public License Version
|
||||
# 1.1 (the "License"); you may not use this file except in compliance with
|
||||
# the License. You may obtain a copy of the License at
|
||||
# http:#www.mozilla.org/MPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
# for the specific language governing rights and limitations under the
|
||||
# License.
|
||||
#
|
||||
# The Original Code is Mozilla Update.
|
||||
#
|
||||
# The Initial Developer of the Original Code is
|
||||
# Chris "Wolf" Crews.
|
||||
# Portions created by the Initial Developer are Copyright (C) 2004
|
||||
# the Initial Developer. All Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
# Chris "Wolf" Crews <psychoticwolf@carolina.rr.com>
|
||||
# Alan Starr <alanjstarr@yahoo.com>
|
||||
#
|
||||
# Alternatively, the contents of this file may be used under the terms of
|
||||
# either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
# in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
# of those above. If you wish to allow use of your version of this file only
|
||||
# under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
# use your version of this file under the terms of the MPL, indicate your
|
||||
# decision by deleting the provisions above and replace them with the notice
|
||||
# and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
# the provisions above, a recipient may use your version of this file under
|
||||
# the terms of any one of the MPL, the GPL or the LGPL.
|
||||
#
|
||||
# ***** END LICENSE BLOCK *****
|
||||
|
||||
|
||||
-- phpMyAdmin SQL Dump
|
||||
-- version 2.6.0-rc1
|
||||
-- http://www.phpmyadmin.net
|
||||
--
|
||||
-- Host: localhost
|
||||
-- Generation Time: Sep 12, 2004 at 05:07 AM
|
||||
-- Server version: 4.0.18
|
||||
-- PHP Version: 4.3.8
|
||||
--
|
||||
-- Database: `mozillaupdate`
|
||||
--
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
--
|
||||
-- Table structure for table `t_applications`
|
||||
--
|
||||
|
||||
CREATE TABLE `t_applications` (
|
||||
`AppID` int(11) NOT NULL auto_increment,
|
||||
`AppName` varchar(30) NOT NULL default '',
|
||||
`Version` varchar(10) NOT NULL default '',
|
||||
`major` int(3) NOT NULL default '0',
|
||||
`minor` int(3) NOT NULL default '0',
|
||||
`release` int(3) NOT NULL default '0',
|
||||
`build` int(14) NOT NULL default '0',
|
||||
`SubVer` enum('a','b','final','','+') NOT NULL default 'final',
|
||||
`GUID` varchar(50) NOT NULL default '',
|
||||
PRIMARY KEY (`AppID`),
|
||||
KEY `AppName` (`AppName`)
|
||||
) TYPE=InnoDB PACK_KEYS=0 AUTO_INCREMENT=25 ;
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
--
|
||||
-- Table structure for table `t_approvallog`
|
||||
--
|
||||
|
||||
CREATE TABLE `t_approvallog` (
|
||||
`LogID` int(5) NOT NULL auto_increment,
|
||||
`ID` varchar(11) NOT NULL default '',
|
||||
`vID` varchar(11) NOT NULL default '',
|
||||
`UserID` varchar(11) NOT NULL default '',
|
||||
`action` varchar(255) NOT NULL default '',
|
||||
`date` datetime NOT NULL default '0000-00-00 00:00:00',
|
||||
`comments` text NOT NULL,
|
||||
PRIMARY KEY (`LogID`),
|
||||
KEY `ID` (`ID`),
|
||||
KEY `vID` (`vID`),
|
||||
KEY `UserID` (`UserID`),
|
||||
KEY `UserID_2` (`UserID`)
|
||||
) TYPE=InnoDB AUTO_INCREMENT=430 ;
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
--
|
||||
-- Table structure for table `t_authorxref`
|
||||
--
|
||||
|
||||
CREATE TABLE `t_authorxref` (
|
||||
`ID` int(11) NOT NULL default '0',
|
||||
`UserID` int(11) NOT NULL default '0',
|
||||
KEY `ID` (`ID`),
|
||||
KEY `UserID` (`UserID`)
|
||||
) TYPE=InnoDB;
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
--
|
||||
-- Table structure for table `t_categories`
|
||||
--
|
||||
|
||||
CREATE TABLE `t_categories` (
|
||||
`CategoryID` int(11) NOT NULL auto_increment,
|
||||
`CatName` varchar(30) NOT NULL default '',
|
||||
`CatDesc` varchar(100) NOT NULL default '',
|
||||
`CatType` enum('E','T','P') NOT NULL default 'E',
|
||||
PRIMARY KEY (`CategoryID`)
|
||||
) TYPE=InnoDB AUTO_INCREMENT=28 ;
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
--
|
||||
-- Table structure for table `t_categoryxref`
|
||||
--
|
||||
|
||||
CREATE TABLE `t_categoryxref` (
|
||||
`ID` int(11) NOT NULL default '0',
|
||||
`CategoryID` int(11) NOT NULL default '0',
|
||||
KEY `IDIndex` (`ID`,`CategoryID`),
|
||||
KEY `CategoryID` (`CategoryID`)
|
||||
) TYPE=InnoDB;
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
--
|
||||
-- Table structure for table `t_downloads`
|
||||
--
|
||||
|
||||
CREATE TABLE `t_downloads` (
|
||||
`dID` int(11) NOT NULL auto_increment,
|
||||
`ID` varchar(5) NOT NULL default '',
|
||||
`date` varchar(14) default NULL,
|
||||
`downloadcount` int(15) NOT NULL default '0',
|
||||
`vID` varchar(5) NOT NULL default '',
|
||||
`user_ip` varchar(15) NOT NULL default '',
|
||||
`user_agent` text NOT NULL,
|
||||
`type` enum('count','download') NOT NULL default 'download',
|
||||
PRIMARY KEY (`dID`)
|
||||
) TYPE=InnoDB PACK_KEYS=0 AUTO_INCREMENT=3 ;
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
--
|
||||
-- Table structure for table `t_faq`
|
||||
--
|
||||
|
||||
CREATE TABLE `t_faq` (
|
||||
`id` int(3) NOT NULL auto_increment,
|
||||
`index` varchar(5) NOT NULL default '1',
|
||||
`alias` varchar(12) NOT NULL default '',
|
||||
`title` varchar(150) NOT NULL default '',
|
||||
`text` text NOT NULL,
|
||||
`lastupdated` timestamp(14) NOT NULL,
|
||||
`active` enum('YES','NO') NOT NULL default 'YES',
|
||||
PRIMARY KEY (`id`)
|
||||
) TYPE=InnoDB PACK_KEYS=0 AUTO_INCREMENT=7 ;
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
--
|
||||
-- Table structure for table `t_feedback`
|
||||
--
|
||||
|
||||
CREATE TABLE `t_feedback` (
|
||||
`CommentID` int(11) NOT NULL auto_increment,
|
||||
`ID` int(11) NOT NULL default '0',
|
||||
`CommentName` varchar(100) default NULL,
|
||||
`CommentVote` enum('0','1','2','3','4','5') default NULL,
|
||||
`CommentTitle` varchar(75) NOT NULL default '',
|
||||
`CommentNote` text,
|
||||
`CommentDate` datetime NOT NULL default '0000-00-00 00:00:00',
|
||||
`commentip` varchar(15) NOT NULL default '',
|
||||
PRIMARY KEY (`CommentID`),
|
||||
KEY `ID` (`ID`)
|
||||
) TYPE=InnoDB PACK_KEYS=0 AUTO_INCREMENT=15487 ;
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
--
|
||||
-- Table structure for table `t_main`
|
||||
--
|
||||
|
||||
CREATE TABLE `t_main` (
|
||||
`ID` int(11) NOT NULL auto_increment,
|
||||
`GUID` varchar(50) NOT NULL default '',
|
||||
`Name` varchar(100) NOT NULL default '',
|
||||
`Type` enum('T','E','P') NOT NULL default 'T',
|
||||
`DateAdded` datetime NOT NULL default '0000-00-00 00:00:00',
|
||||
`DateUpdated` datetime NOT NULL default '0000-00-00 00:00:00',
|
||||
`Homepage` varchar(200) default NULL,
|
||||
`Description` varchar(255) NOT NULL default '',
|
||||
`Rating` varchar(4) NOT NULL default '0',
|
||||
`downloadcount` int(15) NOT NULL default '0',
|
||||
`TotalDownloads` int(18) NOT NULL default '0',
|
||||
PRIMARY KEY (`ID`),
|
||||
KEY `Type` (`Type`)
|
||||
) TYPE=InnoDB PACK_KEYS=0 AUTO_INCREMENT=218 ;
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
--
|
||||
-- Table structure for table `t_os`
|
||||
--
|
||||
|
||||
CREATE TABLE `t_os` (
|
||||
`OSID` int(11) NOT NULL auto_increment,
|
||||
`OSName` varchar(20) NOT NULL default '',
|
||||
PRIMARY KEY (`OSID`),
|
||||
UNIQUE KEY `OSName` (`OSName`)
|
||||
) TYPE=InnoDB AUTO_INCREMENT=7 ;
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
--
|
||||
-- Table structure for table `t_previews`
|
||||
--
|
||||
|
||||
CREATE TABLE `t_previews` (
|
||||
`PreviewID` int(11) NOT NULL auto_increment,
|
||||
`PreviewURI` varchar(200) NOT NULL default '',
|
||||
`vID` int(11) NOT NULL default '0',
|
||||
PRIMARY KEY (`PreviewID`),
|
||||
KEY `vID` (`vID`)
|
||||
) TYPE=InnoDB PACK_KEYS=0 AUTO_INCREMENT=24 ;
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
--
|
||||
-- Table structure for table `t_reviews`
|
||||
--
|
||||
|
||||
CREATE TABLE `t_reviews` (
|
||||
`rID` int(11) NOT NULL auto_increment,
|
||||
`ID` int(11) NOT NULL default '0',
|
||||
`AppID` int(11) NOT NULL default '0',
|
||||
`DateAdded` datetime NOT NULL default '0000-00-00 00:00:00',
|
||||
`AuthorID` int(11) NOT NULL default '0',
|
||||
`Title` varchar(60) NOT NULL default '',
|
||||
`Body` text,
|
||||
`pick` enum('YES','NO') NOT NULL default 'NO',
|
||||
`featured` enum('YES','NO') NOT NULL default 'NO',
|
||||
PRIMARY KEY (`rID`),
|
||||
KEY `ID` (`ID`),
|
||||
KEY `AppID` (`AppID`),
|
||||
KEY `AuthorID` (`AuthorID`)
|
||||
) TYPE=InnoDB PACK_KEYS=0 AUTO_INCREMENT=3 ;
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
--
|
||||
-- Table structure for table `t_userprofiles`
|
||||
--
|
||||
|
||||
CREATE TABLE `t_userprofiles` (
|
||||
`UserID` int(11) NOT NULL auto_increment,
|
||||
`UserName` varchar(100) NOT NULL default '',
|
||||
`UserEmail` varchar(100) NOT NULL default '',
|
||||
`UserWebsite` varchar(100) default NULL,
|
||||
`UserPass` varchar(200) NOT NULL default '',
|
||||
`UserMode` enum('A','E','U','D') NOT NULL default 'U',
|
||||
`UserTrusted` enum('TRUE','FALSE') NOT NULL default 'FALSE',
|
||||
`UserEmailHide` tinyint(1) NOT NULL default '1',
|
||||
PRIMARY KEY (`UserID`),
|
||||
UNIQUE KEY `UserEmail` (`UserEmail`)
|
||||
) TYPE=InnoDB PACK_KEYS=0 AUTO_INCREMENT=142 ;
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
--
|
||||
-- Table structure for table `t_version`
|
||||
--
|
||||
|
||||
CREATE TABLE `t_version` (
|
||||
`vID` int(11) NOT NULL auto_increment,
|
||||
`ID` int(11) NOT NULL default '0',
|
||||
`Version` varchar(30) NOT NULL default '0',
|
||||
`OSID` int(11) NOT NULL default '0',
|
||||
`AppID` int(11) NOT NULL default '0',
|
||||
`MinAppVer` varchar(10) NOT NULL default '',
|
||||
`MinAppVer_int` varchar(10) NOT NULL default '',
|
||||
`MaxAppVer` varchar(10) NOT NULL default '',
|
||||
`MaxAppVer_int` varchar(10) NOT NULL default '',
|
||||
`Size` int(11) NOT NULL default '0',
|
||||
`DateAdded` datetime NOT NULL default '0000-00-00 00:00:00',
|
||||
`DateUpdated` datetime NOT NULL default '0000-00-00 00:00:00',
|
||||
`URI` varchar(255) NOT NULL default '',
|
||||
`Notes` text,
|
||||
`approved` enum('YES','NO','?') NOT NULL default '?',
|
||||
PRIMARY KEY (`vID`),
|
||||
KEY `ID` (`ID`),
|
||||
KEY `AppID` (`AppID`),
|
||||
KEY `OSID` (`OSID`),
|
||||
KEY `Version` (`Version`)
|
||||
) TYPE=InnoDB PACK_KEYS=0 AUTO_INCREMENT=558 ;
|
||||
|
||||
--
|
||||
-- Constraints for dumped tables
|
||||
--
|
||||
|
||||
--
|
||||
-- Constraints for table `t_authorxref`
|
||||
--
|
||||
ALTER TABLE `t_authorxref`
|
||||
ADD CONSTRAINT `0_125` FOREIGN KEY (`ID`) REFERENCES `t_main` (`ID`) ON DELETE CASCADE ON UPDATE CASCADE,
|
||||
ADD CONSTRAINT `0_126` FOREIGN KEY (`UserID`) REFERENCES `t_userprofiles` (`UserID`) ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
--
|
||||
-- Constraints for table `t_categoryxref`
|
||||
--
|
||||
ALTER TABLE `t_categoryxref`
|
||||
ADD CONSTRAINT `0_128` FOREIGN KEY (`ID`) REFERENCES `t_main` (`ID`) ON DELETE CASCADE ON UPDATE CASCADE,
|
||||
ADD CONSTRAINT `0_129` FOREIGN KEY (`CategoryID`) REFERENCES `t_categories` (`CategoryID`) ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
--
|
||||
-- Constraints for table `t_feedback`
|
||||
--
|
||||
ALTER TABLE `t_feedback`
|
||||
ADD CONSTRAINT `0_131` FOREIGN KEY (`ID`) REFERENCES `t_main` (`ID`) ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
--
|
||||
-- Constraints for table `t_previews`
|
||||
--
|
||||
ALTER TABLE `t_previews`
|
||||
ADD CONSTRAINT `0_133` FOREIGN KEY (`vID`) REFERENCES `t_version` (`vID`) ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
--
|
||||
-- Constraints for table `t_reviews`
|
||||
--
|
||||
ALTER TABLE `t_reviews`
|
||||
ADD CONSTRAINT `0_135` FOREIGN KEY (`ID`) REFERENCES `t_main` (`ID`) ON DELETE CASCADE ON UPDATE CASCADE,
|
||||
ADD CONSTRAINT `0_136` FOREIGN KEY (`AppID`) REFERENCES `t_applications` (`AppID`) ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
--
|
||||
-- Constraints for table `t_version`
|
||||
--
|
||||
ALTER TABLE `t_version`
|
||||
ADD CONSTRAINT `0_139` FOREIGN KEY (`ID`) REFERENCES `t_main` (`ID`) ON DELETE CASCADE ON UPDATE CASCADE,
|
||||
ADD CONSTRAINT `0_140` FOREIGN KEY (`AppID`) REFERENCES `t_applications` (`AppID`) ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
@@ -1,77 +0,0 @@
|
||||
<?php
|
||||
// ***** BEGIN LICENSE BLOCK *****
|
||||
// Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
//
|
||||
// The contents of this file are subject to the Mozilla Public License Version
|
||||
// 1.1 (the "License"); you may not use this file except in compliance with
|
||||
// the License. You may obtain a copy of the License at
|
||||
// http://www.mozilla.org/MPL/
|
||||
//
|
||||
// Software distributed under the License is distributed on an "AS IS" basis,
|
||||
// WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
// for the specific language governing rights and limitations under the
|
||||
// License.
|
||||
//
|
||||
// The Original Code is Mozilla Update.
|
||||
//
|
||||
// The Initial Developer of the Original Code is
|
||||
// Chris "Wolf" Crews.
|
||||
// Portions created by the Initial Developer are Copyright (C) 2004
|
||||
// the Initial Developer. All Rights Reserved.
|
||||
//
|
||||
// Contributor(s):
|
||||
// Chris "Wolf" Crews <psychoticwolf@carolina.rr.com>
|
||||
//
|
||||
// Alternatively, the contents of this file may be used under the terms of
|
||||
// either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
// the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
// in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
// of those above. If you wish to allow use of your version of this file only
|
||||
// under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
// use your version of this file under the terms of the MPL, indicate your
|
||||
// decision by deleting the provisions above and replace them with the notice
|
||||
// and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
// the provisions above, a recipient may use your version of this file under
|
||||
// the terms of any one of the MPL, the GPL or the LGPL.
|
||||
//
|
||||
// ***** END LICENSE BLOCK *****
|
||||
?>
|
||||
<?php
|
||||
require"core/config.php";
|
||||
?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html401/loose.dtd">
|
||||
<html lang="EN" dir="ltr">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
||||
<meta http-equiv="Content-Language" content="en">
|
||||
<TITLE>Mozilla Update :: Developer Control Panel - Coming Soon</TITLE>
|
||||
|
||||
<LINK REL="STYLESHEET" TYPE="text/css" HREF="/core/update.css">
|
||||
</HEAD>
|
||||
<BODY>
|
||||
<?php
|
||||
$application="login";
|
||||
include"$page_header";
|
||||
?>
|
||||
<DIV class="faqtitle">Developer Control Panel - Coming Soon</DIV>
|
||||
|
||||
<DIV style="width: 75%; margin: auto; margin-top: 20px; border: 1px dotted #0065CA; padding: 5px">
|
||||
In the next version of Mozilla Update, Mozilla Update will have a new section for Extension/Theme authors to login to. This new section
|
||||
will give them the ability to manage their extensions and themes that're hosted on Mozilla Update themselves.<BR>
|
||||
<BR>
|
||||
Authors will have the ability to add a new extension or theme themselves, as well as adding new versions of that extension or theme,
|
||||
updating an existing listing (including being able to change the application-compatibility settings w/o needing a new file), and if
|
||||
they so desire, the ability to remove entirely an old version of an extension or theme or the entire listing.<BR>
|
||||
<BR>
|
||||
Other features that will be available include the capability of adding and managing preview images of their extension or theme,
|
||||
a developer comments feature, so they can easily communicate to end-users known problems with the extension/theme.
|
||||
<BR>
|
||||
</DIV>
|
||||
|
||||
<P>
|
||||
|
||||
<?php
|
||||
include"$page_footer";
|
||||
?>
|
||||
</BODY>
|
||||
</HTML>
|
||||
@@ -1,194 +0,0 @@
|
||||
<?php
|
||||
// ***** BEGIN LICENSE BLOCK *****
|
||||
// Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
//
|
||||
// The contents of this file are subject to the Mozilla Public License Version
|
||||
// 1.1 (the "License"); you may not use this file except in compliance with
|
||||
// the License. You may obtain a copy of the License at
|
||||
// http://www.mozilla.org/MPL/
|
||||
//
|
||||
// Software distributed under the License is distributed on an "AS IS" basis,
|
||||
// WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
// for the specific language governing rights and limitations under the
|
||||
// License.
|
||||
//
|
||||
// The Original Code is Mozilla Update.
|
||||
//
|
||||
// The Initial Developer of the Original Code is
|
||||
// Chris "Wolf" Crews.
|
||||
// Portions created by the Initial Developer are Copyright (C) 2004
|
||||
// the Initial Developer. All Rights Reserved.
|
||||
//
|
||||
// Contributor(s):
|
||||
// Chris "Wolf" Crews <psychoticwolf@carolina.rr.com>
|
||||
//
|
||||
// Alternatively, the contents of this file may be used under the terms of
|
||||
// either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
// the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
// in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
// of those above. If you wish to allow use of your version of this file only
|
||||
// under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
// use your version of this file under the terms of the MPL, indicate your
|
||||
// decision by deleting the provisions above and replace them with the notice
|
||||
// and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
// the provisions above, a recipient may use your version of this file under
|
||||
// the terms of any one of the MPL, the GPL or the LGPL.
|
||||
//
|
||||
// ***** END LICENSE BLOCK *****
|
||||
?>
|
||||
<?php
|
||||
require"../core/config.php";
|
||||
?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html401/loose.dtd">
|
||||
<html lang="EN" dir="ltr">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
||||
<meta http-equiv="Content-Language" content="en">
|
||||
<meta http-equiv="Content-Style-Type" content="text/css">
|
||||
|
||||
<?php
|
||||
//Bookmarking-Friendly Page Title
|
||||
$sql = "SELECT UserName FROM `t_userprofiles` WHERE UserID = '$_GET[id]' LIMIT 1";
|
||||
$sql_result = mysql_query($sql, $connection) or trigger_error("MySQL Error ".mysql_errno().": ".mysql_error()."", E_USER_NOTICE);
|
||||
if (mysql_num_rows($sql_result)===0) {
|
||||
$return = page_error("2","Author ID is Invalid or Missing.");
|
||||
exit;
|
||||
|
||||
}
|
||||
$row = mysql_fetch_array($sql_result);
|
||||
?>
|
||||
|
||||
<TITLE>Mozilla Update :: Extensions - Author Profile: <?php echo"$row[UserName]"; ?></TITLE>
|
||||
|
||||
<LINK REL="STYLESHEET" TYPE="text/css" HREF="/core/update.css">
|
||||
</HEAD>
|
||||
<BODY>
|
||||
<?php
|
||||
include"$page_header";
|
||||
|
||||
$type = "E";
|
||||
$category = $_GET["category"];
|
||||
include"inc_sidebar.php";
|
||||
?>
|
||||
<DIV id="content">
|
||||
<?php
|
||||
$userid = $_GET["id"];
|
||||
$sql = "SELECT * FROM `t_userprofiles` WHERE `UserID` = '$userid' LIMIT 1";
|
||||
$sql_result = mysql_query($sql, $connection) or trigger_error("MySQL Error ".mysql_errno().": ".mysql_error()."", E_USER_NOTICE);
|
||||
$row = mysql_fetch_array($sql_result);
|
||||
$userid = $row["UserID"];
|
||||
$username = $row["UserName"];
|
||||
$useremail = $row["UserEmail"];
|
||||
$userwebsite = $row["UserWebsite"];
|
||||
$userpass = $row["UserPass"];
|
||||
$userrole = $row["UserRole"];
|
||||
$useremailhide = $row["UserEmailHide"];
|
||||
?>
|
||||
<DIV class="item">
|
||||
<SPAN class="boldfont">Profile for <?php echo"$username"; ?></SPAN><BR>
|
||||
<DIV class="boxheader2"></DIV>
|
||||
<SPAN class="boldfont">Homepage:</SPAN> <?php
|
||||
if ($userwebsite) {echo"<A HREF=\"$userwebsite\" target=\"_blank\">$userwebsite</A>";
|
||||
} else {
|
||||
echo"<SPAN CLASS=\"disabled\">Not Available for this Author</SPAN>";
|
||||
}
|
||||
?><BR>
|
||||
<SPAN class="boldfont">E-Mail:</SPAN> <?php if ($useremailhide=="1") {
|
||||
echo"<SPAN class=\"disabled\">Not Disclosed by Author</SPAN>";
|
||||
} else {
|
||||
echo"<SPAN class=\"emailactive\">Contact this Author via the <A HREF=\"#email\">E-Mail form</A> below</SPAN>";
|
||||
}
|
||||
?>
|
||||
</DIV>
|
||||
<BR>
|
||||
<DIV class="item">
|
||||
<SPAN class="boldfont">All Extensions and Themes by <?php echo"$username"; ?></SPAN><BR>
|
||||
<DIV class="boxheader2"></DIV>
|
||||
<?php
|
||||
$sql = "SELECT TM.ID, TM.Type, TM.Name, TM.Description, TM.DateUpdated, TM.TotalDownloads, TU.UserEmail FROM `t_main` TM
|
||||
LEFT JOIN t_authorxref TAX ON TM.ID = TAX.ID
|
||||
INNER JOIN t_userprofiles TU ON TAX.UserID = TU.UserID
|
||||
WHERE TU.UserID = '$userid' AND TM.Type !='P'
|
||||
ORDER BY `Type` , `Name` ";
|
||||
$sql_result = mysql_query($sql, $connection) or trigger_error("MySQL Error ".mysql_errno().": ".mysql_error()."", E_USER_NOTICE);
|
||||
$numresults = mysql_num_rows($sql_result);
|
||||
while ($row = mysql_fetch_array($sql_result)) {
|
||||
|
||||
|
||||
$sql2 = "SELECT `vID`, `Version` FROM `t_version` WHERE `ID` = '$row[ID]' AND `approved` = 'YES' ORDER BY `Version` ASC LIMIT 1";
|
||||
$sql_result2 = mysql_query($sql2, $connection) or trigger_error("MySQL Error ".mysql_errno().": ".mysql_error()."", E_USER_NOTICE);
|
||||
while ($row2 = mysql_fetch_array($sql_result2)) {
|
||||
$vid = $row2["vID"];
|
||||
$version = $row2["Version"];
|
||||
|
||||
$v++;
|
||||
$id = $row["ID"];
|
||||
$type = $row["Type"];
|
||||
$name = $row["Name"];
|
||||
$dateadded = $row["DateAdded"];
|
||||
$dateupdated = $row["DateUpdated"];
|
||||
$homepage = $row["Homepage"];
|
||||
$description = $row["Description"];
|
||||
$authors = $row["UserEmail"];
|
||||
$downloadcount = $row["TotalDownloads"];
|
||||
|
||||
$day=substr($dateupdated,8,2); //get the day
|
||||
$month=substr($dateupdated,5,2); //get the month
|
||||
$year=substr($dateupdated,0,4); //get the year
|
||||
$hour=substr($dateupdated,11,2); //get the hour
|
||||
$minute=substr($dateupdated,14,2); //get the minute
|
||||
$second=substr($dateupdated,17,2); //get the sec
|
||||
$timestamp = strtotime("$year-$month-$day $hour:$minute:$second");
|
||||
$dateupdated = gmdate("F d, Y g:i:sa", $timestamp); //gmdate("F d, Y", $dutimestamp);
|
||||
|
||||
echo"<DIV CLASS=\"item\">";
|
||||
echo"<SPAN class=\"title itemtitle\" style=\"margin-left: 0px\"><A HREF=\"moreinfo.php?application=$application&id=$id\">$name</A></SPAN><BR>";
|
||||
echo"<DIV class=\"profileitemdesc\">$description</DIV>\n";
|
||||
echo"<DIV class=\"baseline\">Updated: $dateupdated | Downloads: $downloadcount</DIV>\n";
|
||||
|
||||
echo"</DIV>\n";
|
||||
echo"<BR>\n";
|
||||
}
|
||||
}
|
||||
if ($numresults=="0") {
|
||||
echo"<DIV class=\"noitems\">No Extensions or Themes in the Database for $username yet...</DIV>";
|
||||
}
|
||||
?>
|
||||
</DIV>
|
||||
<BR>
|
||||
<?php if ($useremailhide !=="1") { ?>
|
||||
<A NAME="email"></A>
|
||||
<DIV class="item">
|
||||
<SPAN class="boldfont">Send an E-Mail to <?php echo"$username"; ?></SPAN><BR>
|
||||
<DIV class="boxheader2"></DIV>
|
||||
<?php
|
||||
//SendMail Returned Message Section
|
||||
if ($_GET["mail"]) {
|
||||
$mail = $_GET["mail"];
|
||||
echo"<DIV class=\"mailresult\">";
|
||||
if ($mail=="successful") {
|
||||
echo"Your message has been sent successfully...";
|
||||
} else if ($mail=="unsuccessful") {
|
||||
echo"An error occured, your message was not sent... Please try again...";
|
||||
}
|
||||
echo"</DIV>\n";
|
||||
}
|
||||
?>
|
||||
<FORM NAME="sendmail" METHOD="POST" ACTION="sendmail.php">
|
||||
<INPUT NAME="senduserid" TYPE="HIDDEN" VALUE="<?php echo"$userid"; ?>">
|
||||
Your Name: <INPUT NAME="fromname" TYPE="TEXT" SIZE=40 MAXLENGTH=100> Email: <INPUT NAME="fromemail" TYPE="TEXT" SIZE=40 MAXLENGTH=100><BR>
|
||||
Subject: <INPUT NAME="subject" TYPE="TEXT" SIZE=40 MAXLENGTH=100><BR>
|
||||
Message:<BR>
|
||||
<CENTER><TEXTAREA NAME="body" ROWS=20 COLS=65></TEXTAREA><BR>
|
||||
<INPUT NAME="submit" TYPE="SUBMIT" VALUE="Send Message"> <INPUT NAME="reset" TYPE="RESET" VALUE="Reset Form"><BR>
|
||||
</CENTER>
|
||||
</FORM>
|
||||
</DIV>
|
||||
<BR>
|
||||
<?php } ?>
|
||||
</DIV>
|
||||
<?php
|
||||
include"$page_footer";
|
||||
?>
|
||||
</BODY>
|
||||
</HTML>
|
||||
@@ -1,88 +0,0 @@
|
||||
<?php
|
||||
// ***** BEGIN LICENSE BLOCK *****
|
||||
// Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
//
|
||||
// The contents of this file are subject to the Mozilla Public License Version
|
||||
// 1.1 (the "License"); you may not use this file except in compliance with
|
||||
// the License. You may obtain a copy of the License at
|
||||
// http://www.mozilla.org/MPL/
|
||||
//
|
||||
// Software distributed under the License is distributed on an "AS IS" basis,
|
||||
// WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
// for the specific language governing rights and limitations under the
|
||||
// License.
|
||||
//
|
||||
// The Original Code is Mozilla Update.
|
||||
//
|
||||
// The Initial Developer of the Original Code is
|
||||
// Chris "Wolf" Crews.
|
||||
// Portions created by the Initial Developer are Copyright (C) 2004
|
||||
// the Initial Developer. All Rights Reserved.
|
||||
//
|
||||
// Contributor(s):
|
||||
// Chris "Wolf" Crews <psychoticwolf@carolina.rr.com>
|
||||
//
|
||||
// Alternatively, the contents of this file may be used under the terms of
|
||||
// either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
// the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
// in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
// of those above. If you wish to allow use of your version of this file only
|
||||
// under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
// use your version of this file under the terms of the MPL, indicate your
|
||||
// decision by deleting the provisions above and replace them with the notice
|
||||
// and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
// the provisions above, a recipient may use your version of this file under
|
||||
// the terms of any one of the MPL, the GPL or the LGPL.
|
||||
//
|
||||
// ***** END LICENSE BLOCK *****
|
||||
?>
|
||||
<DIV class="sidelinks">
|
||||
<?php
|
||||
unset($typename);
|
||||
$types = array("E"=>"Extensions","T"=>"Themes","U"=>"Updates");
|
||||
$typename = $types["$type"];
|
||||
echo"<DIV CLASS=\"sidebartitle\">Categories:</DIV>\n";
|
||||
echo"<DIV class=\"sidebartext\">";
|
||||
if (!$category AND $index !="yes") {echo"<SPAN CLASS=\"title\">"; }
|
||||
echo"<SPAN class=\"sidebartitle\"><A HREF=\"showlist.php?application=$application&version=$app_version&numpg=$items_per_page&category=All\" TITLE=\"Show All ".ucwords($typename)." Alphabetically\">All</A></SPAN><BR>\n";
|
||||
if (!$category AND $index !="yes") {echo"</SPAN>"; }
|
||||
|
||||
// Object Categories
|
||||
$sql = "SELECT `CatName`,`CatDesc` FROM `t_categories` WHERE `CatType` = '$type' ORDER BY `CatName`";
|
||||
$sql_result = mysql_query($sql, $connection) or trigger_error("MySQL Error ".mysql_errno().": ".mysql_error()."", E_USER_NOTICE);
|
||||
while ($row = mysql_fetch_array($sql_result)) {
|
||||
$catname = $row["CatName"];
|
||||
$catdesc = $row["CatDesc"];
|
||||
if (strtolower($category) == strtolower($catname)) {echo"<SPAN CLASS=\"title\">"; }
|
||||
echo"<A HREF=\"showlist.php?application=$application&version=$app_version&numpg=$items_per_page&category=$catname\" TITLE=\"$catdesc\">$catname</A><BR>\n";
|
||||
if (strtolower($category) == strtolower($catname)) {echo"</SPAN>"; }
|
||||
}
|
||||
?>
|
||||
<BR>
|
||||
<?php
|
||||
$catname = "Editors Pick";
|
||||
$catdesc = ucwords($typename)." picked by the Mozilla Update Editors";
|
||||
if (strtolower($category) == strtolower($catname)) {echo"<SPAN CLASS=\"title\">"; }
|
||||
echo"<A HREF=\"showlist.php?application=$application&version=$app_version&numpg=$items_per_page&category=$catname\" TITLE=\"$catdesc\">Editor's Pick</A><BR>\n";
|
||||
if (strtolower($category) == strtolower($catname)) {echo"</SPAN>"; }
|
||||
|
||||
$catname = "Popular";
|
||||
$catdesc = ucwords($typename)." downloaded the most";
|
||||
if (strtolower($category) == strtolower($catname)) {echo"<SPAN CLASS=\"title\">"; }
|
||||
echo"<A HREF=\"showlist.php?application=$application&version=$app_version&numpg=$items_per_page&category=$catname\" TITLE=\"$catdesc\">$catname</A><BR>\n";
|
||||
if (strtolower($category) == strtolower($catname)) {echo"</SPAN>"; }
|
||||
|
||||
$catname = "Top Rated";
|
||||
$catdesc = ucwords($typename)." rated the highest";
|
||||
if (strtolower($category) == strtolower($catname)) {echo"<SPAN CLASS=\"title\">"; }
|
||||
echo"<A HREF=\"showlist.php?application=$application&version=$app_version&numpg=$items_per_page&category=$catname\" TITLE=\"$catdesc\">$catname</A><BR>\n";
|
||||
if (strtolower($category) == strtolower($catname)) {echo"</SPAN>"; }
|
||||
|
||||
$catname = "Newest";
|
||||
$catdesc = "Most recent ".ucwords($typename);
|
||||
if (strtolower($category) == strtolower($catname)) {echo"<SPAN CLASS=\"title\">"; }
|
||||
echo"<A HREF=\"showlist.php?application=$application&version=$app_version&numpg=$items_per_page&category=$catname\" TITLE=\"$catdesc\">$catname</A><BR>\n";
|
||||
if (strtolower($category) == strtolower($catname)) {echo"</SPAN>"; }
|
||||
?>
|
||||
</DIV>
|
||||
</DIV>
|
||||
@@ -1,229 +0,0 @@
|
||||
<?php
|
||||
// ***** BEGIN LICENSE BLOCK *****
|
||||
// Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
//
|
||||
// The contents of this file are subject to the Mozilla Public License Version
|
||||
// 1.1 (the "License"); you may not use this file except in compliance with
|
||||
// the License. You may obtain a copy of the License at
|
||||
// http://www.mozilla.org/MPL/
|
||||
//
|
||||
// Software distributed under the License is distributed on an "AS IS" basis,
|
||||
// WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
// for the specific language governing rights and limitations under the
|
||||
// License.
|
||||
//
|
||||
// The Original Code is Mozilla Update.
|
||||
//
|
||||
// The Initial Developer of the Original Code is
|
||||
// Chris "Wolf" Crews.
|
||||
// Portions created by the Initial Developer are Copyright (C) 2004
|
||||
// the Initial Developer. All Rights Reserved.
|
||||
//
|
||||
// Contributor(s):
|
||||
// Chris "Wolf" Crews <psychoticwolf@carolina.rr.com>
|
||||
//
|
||||
// Alternatively, the contents of this file may be used under the terms of
|
||||
// either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
// the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
// in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
// of those above. If you wish to allow use of your version of this file only
|
||||
// under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
// use your version of this file under the terms of the MPL, indicate your
|
||||
// decision by deleting the provisions above and replace them with the notice
|
||||
// and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
// the provisions above, a recipient may use your version of this file under
|
||||
// the terms of any one of the MPL, the GPL or the LGPL.
|
||||
//
|
||||
// ***** END LICENSE BLOCK *****
|
||||
?>
|
||||
<?php
|
||||
require"../core/config.php";
|
||||
?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html401/loose.dtd">
|
||||
<html lang="EN" dir="ltr">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
||||
<meta http-equiv="Content-Language" content="en">
|
||||
<meta http-equiv="Content-Style-Type" content="text/css">
|
||||
|
||||
<TITLE>Mozilla Update :: Extensions - Add Features to Mozilla Software</TITLE>
|
||||
|
||||
|
||||
<LINK REL="STYLESHEET" TYPE="text/css" HREF="/core/update.css">
|
||||
</HEAD>
|
||||
<BODY>
|
||||
<?php
|
||||
$type = "E";
|
||||
if ($_GET["application"]) {$application=$_GET["application"]; }
|
||||
include"$page_header";
|
||||
$index="yes";
|
||||
include"inc_sidebar.php";
|
||||
?>
|
||||
<DIV class="box">
|
||||
<DIV class="boxheader" style="width: 100%">What is an Extension?</DIV>
|
||||
<SPAN class="itemdescription">Extensions are small add-ons that add new functionality to <?php print(ucwords($application)); ?>.
|
||||
They can add anything from a toolbar button to a completely new feature. They allow the browser to be customized to fit the
|
||||
personal needs of each user if they need additional features<?php if ($application !=="mozilla") { ?>, while keeping <?php print(ucwords($application)); ?> small
|
||||
to download <?php } ?>.</SPAN>
|
||||
</DIV>
|
||||
|
||||
<DIV class="box">
|
||||
<DIV class="boxheader" style="width: 100%">Featured <?php print(ucwords($application)); ?> Extension</DIV>
|
||||
<?php
|
||||
$sql = "SELECT TR.ID, TM.Name, `Title`, TR.DateAdded, `Body`, `Type`, `pick` FROM `t_reviews` TR
|
||||
INNER JOIN t_main TM ON TR.ID = TM.ID
|
||||
INNER JOIN t_version TV ON TV.ID = TM.ID
|
||||
INNER JOIN t_applications TA ON TA.AppID = TV.AppID
|
||||
WHERE `Type` = '$type' AND `AppName` = '$application' AND `featured`='YES' ORDER BY `rID` DESC LIMIT 1";
|
||||
$sql_result = mysql_query($sql, $connection) or trigger_error("MySQL Error ".mysql_errno().": ".mysql_error()."", E_USER_NOTICE);
|
||||
while ($row = mysql_fetch_array($sql_result)) {
|
||||
$id = $row["ID"];
|
||||
$name = $row["Name"];
|
||||
$title = $row["Title"];
|
||||
$dateadded = $row["DateAdded"];
|
||||
$pick = $row["pick"];
|
||||
$body = $row["Body"];
|
||||
$bodylength = strlen($body);
|
||||
if ($bodylength>"250") {
|
||||
$body = substr($body,0,250);
|
||||
$body .= " <a href=\"moreinfo.php?id=$id&application=$application&page=staffreview\">[More...]</a>";
|
||||
|
||||
}
|
||||
|
||||
//Create Customizeable Timestamp
|
||||
$day=substr($dateadded,8,2); //get the day
|
||||
$month=substr($dateadded,5,2); //get the month
|
||||
$year=substr($dateadded,0,4); //get the year
|
||||
$hour=substr($dateadded,11,2); //get the hour
|
||||
$minute=substr($dateadded,14,2); //get the minute
|
||||
$second=substr($dateadded,17,2); //get the sec
|
||||
$timestamp = strtotime("$year-$month-$day $hour:$minute:$second");
|
||||
$date = gmdate("F, Y", $timestamp);
|
||||
|
||||
echo"<a href=\"moreinfo.php?id=$id\">$name</A> -- $title";
|
||||
if ($pick=="YES") {echo" - $date Editors Pick"; }
|
||||
echo"<BR>\n";
|
||||
echo"<SPAN class=\"itemdescription\">$body</SPAN><BR>\n";
|
||||
}
|
||||
?>
|
||||
</DIV>
|
||||
<?php
|
||||
//Temporary!! Current Version Array Code
|
||||
$currentver_array = array("firefox"=>"1.0", "thunderbird"=>"1.0", "mozilla"=>"1.7");
|
||||
$currentver_display_array = array("firefox"=>"1.0", "thunderbird"=>"1.0", "mozilla"=>"1.7.x");
|
||||
$currentver = $currentver_array[$application];
|
||||
$currentver_display = $currentver_display_array[$application];
|
||||
?>
|
||||
<DIV class="box" style="width: 80%; min-height: 200px; border: 0px">
|
||||
<DIV class="boxcolumns">
|
||||
<DIV class="boxheader"><A HREF="showlist.php?application=<?php echo"$application"; ?>&category=Popular">Most Popular</A>:</DIV>
|
||||
<?php
|
||||
$i=0;
|
||||
$sql = "SELECT TM.ID, TV.vID,TM.Name, TV.Version, TM.TotalDownloads, TM.downloadcount
|
||||
FROM `t_main` TM
|
||||
INNER JOIN t_version TV ON TM.ID = TV.ID
|
||||
INNER JOIN t_applications TA ON TV.AppID = TA.AppID
|
||||
WHERE `Type` = '$type' AND `AppName` = '$application' AND `minAppVer_int` <='$currentver' AND `maxAppVer_int` >= '$currentver' AND `downloadcount` > '0' AND `approved` = 'YES' ORDER BY `downloadcount` DESC ";
|
||||
$sql_result = mysql_query($sql, $connection) or trigger_error("MySQL Error ".mysql_errno().": ".mysql_error()."", E_USER_NOTICE);
|
||||
while ($row = mysql_fetch_array($sql_result)) {
|
||||
$i++;
|
||||
$id = $row["ID"];
|
||||
$vid = $row["vID"];
|
||||
$name = $row["Name"];
|
||||
$version = $row["Version"];
|
||||
$downloadcount = $row["downloadcount"];
|
||||
$totaldownloads = $row["TotalDownloads"];
|
||||
if ($lastname == $name) {$i--; continue; }
|
||||
echo"$i - <a href=\"moreinfo.php?application=$application&id=$id\">$name</a><br>\n";
|
||||
echo"<SPAN class=\"smallfont nocomment\">($downloadcount downloads)</SPAN><BR>\n";
|
||||
|
||||
$lastname = $name;
|
||||
if ($i >= "5") {break;}
|
||||
}
|
||||
?>
|
||||
<BR>
|
||||
</DIV>
|
||||
<DIV class="boxcolumns">
|
||||
<DIV class="boxheader"><A HREF="showlist.php?category=Top Rated">Top Rated</A>:</DIV>
|
||||
<?php
|
||||
$r=0;
|
||||
$usednames = array();
|
||||
$sql = "SELECT TM.ID, TV.vID, TM.Name, TV.Version, TM.Rating, TU.UserName
|
||||
FROM `t_main` TM
|
||||
INNER JOIN t_version TV ON TM.ID = TV.ID
|
||||
INNER JOIN t_applications TA ON TV.AppID = TA.AppID
|
||||
INNER JOIN t_authorxref TAX ON TAX.ID = TM.ID
|
||||
INNER JOIN t_userprofiles TU ON TU.UserID = TAX.UserID
|
||||
WHERE `Type` = '$type' AND `AppName` = '$application' AND `minAppVer_int` <='$currentver' AND `maxAppVer_int` >= '$currentver' AND `Rating` > '0' AND `approved` = 'YES' ORDER BY `Rating` DESC, `Name` ASC, `Version` DESC";
|
||||
$sql_result = mysql_query($sql, $connection) or trigger_error("MySQL Error ".mysql_errno().": ".mysql_error()."", E_USER_NOTICE);
|
||||
while ($row = mysql_fetch_array($sql_result)) {
|
||||
$r++; $s++;
|
||||
$id = $row["ID"];
|
||||
$vid = $row["vID"];
|
||||
$name = $row["Name"];
|
||||
$version = $row["Version"];
|
||||
$rating = $row["Rating"];
|
||||
$arraysearch = array_search("$name", $usednames);
|
||||
if ($arraysearch !== false AND $usedversions[$arraysearch]['version']<$version) {$r--; continue; } //
|
||||
echo"$r - <a href=\"moreinfo.php?application=$application&id=$id\">$name</a> ";
|
||||
|
||||
//$rating = round($rating);
|
||||
echo"<SPAN title=\"Rated: $rating of 5\" style=\"font-size: 8pt\">";
|
||||
for ($i = 1; $i <= floor($rating); $i++) {
|
||||
echo"<IMG SRC=\"/images/stars/star_icon.png\" BORDER=0 ALT=\""; if ($i==1) {echo"$rating of 5 stars";} echo"\">";
|
||||
}
|
||||
if ($rating>floor($rating)) {
|
||||
$val = ($rating-floor($rating))*10;
|
||||
echo"<IMG SRC=\"/images/stars/star_0$val.png\" BORDER=0 ALT=\"\">";
|
||||
$i++;
|
||||
}
|
||||
for ($i = $i; $i <= 5; $i++) {
|
||||
echo"<IMG SRC=\"/images/stars/graystar_icon.png\" BORDER=0 ALT=\""; if ($i==1) {echo"$rating of 5 stars";} echo"\">";
|
||||
}
|
||||
echo"</SPAN><br>\n";
|
||||
//echo"<SPAN class=\"smallfont nocomment\">By $author</SPAN><BR>\n";
|
||||
$usednames[$s] = $name;
|
||||
$usedversions[$s] = $version;
|
||||
if ($r >= "5") {break;}
|
||||
}
|
||||
unset($usednames, $usedversions, $r, $s, $i);
|
||||
?>
|
||||
</DIV>
|
||||
<DIV class="boxcolumns">
|
||||
<DIV class="boxheader"><A HREF="showlist.php?category=Newest">Most Recent</A>:</DIV>
|
||||
<?php
|
||||
$i=0;
|
||||
$sql = "SELECT TM.ID, TV.vID, TM.Name, TV.Version, TV.DateAdded
|
||||
FROM `t_main` TM
|
||||
INNER JOIN t_version TV ON TM.ID = TV.ID
|
||||
INNER JOIN t_applications TA ON TV.AppID = TA.AppID
|
||||
INNER JOIN t_os TOS ON TV.OSID = TOS.OSID
|
||||
WHERE `Type` = '$type' AND `AppName` = '$application' AND `minAppVer_int` <='$currentver' AND `maxAppVer_int` >= '$currentver' AND (`OSName` = '$_SESSION[app_os]' OR `OSName` = 'ALL') AND `approved` = 'YES' ORDER BY `DateAdded` DESC ";
|
||||
$sql_result = mysql_query($sql, $connection) or trigger_error("MySQL Error ".mysql_errno().": ".mysql_error()."", E_USER_NOTICE);
|
||||
while ($row = mysql_fetch_array($sql_result)) {
|
||||
$i++;
|
||||
$id = $row["ID"];
|
||||
$vid = $row["vID"];
|
||||
$name = $row["Name"];
|
||||
$version = $row["Version"];
|
||||
$dateadded = $row["DateAdded"];
|
||||
//Create Customizeable Datestamp
|
||||
$timestamp = strtotime("$dateadded");
|
||||
$dateadded = gmdate("F d, Y g:i:sa", $timestamp); // $dateupdated = gmdate("F d, Y g:i:sa T", $timestamp);
|
||||
|
||||
if ($lastname == $name) {$i--; continue; }
|
||||
echo"$i - <a href=\"moreinfo.php?application=$application&id=$id&vid=$vid\">$name $version</a><BR>\n";
|
||||
echo"<SPAN class=\"smallfont nocomment\">($dateadded)</SPAN><BR>\n";
|
||||
|
||||
$lastname = $name;
|
||||
if ($i >= "5") {break;}
|
||||
}
|
||||
?>
|
||||
</DIV>
|
||||
</DIV>
|
||||
<BR>
|
||||
<?php
|
||||
include"$page_footer";
|
||||
?>
|
||||
</BODY>
|
||||
</HTML>
|
||||
@@ -1,106 +0,0 @@
|
||||
<?php
|
||||
// ***** BEGIN LICENSE BLOCK *****
|
||||
// Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
//
|
||||
// The contents of this file are subject to the Mozilla Public License Version
|
||||
// 1.1 (the "License"); you may not use this file except in compliance with
|
||||
// the License. You may obtain a copy of the License at
|
||||
// http://www.mozilla.org/MPL/
|
||||
//
|
||||
// Software distributed under the License is distributed on an "AS IS" basis,
|
||||
// WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
// for the specific language governing rights and limitations under the
|
||||
// License.
|
||||
//
|
||||
// The Original Code is Mozilla Update.
|
||||
//
|
||||
// The Initial Developer of the Original Code is
|
||||
// Chris "Wolf" Crews.
|
||||
// Portions created by the Initial Developer are Copyright (C) 2004
|
||||
// the Initial Developer. All Rights Reserved.
|
||||
//
|
||||
// Contributor(s):
|
||||
// Chris "Wolf" Crews <psychoticwolf@carolina.rr.com>
|
||||
//
|
||||
// Alternatively, the contents of this file may be used under the terms of
|
||||
// either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
// the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
// in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
// of those above. If you wish to allow use of your version of this file only
|
||||
// under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
// use your version of this file under the terms of the MPL, indicate your
|
||||
// decision by deleting the provisions above and replace them with the notice
|
||||
// and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
// the provisions above, a recipient may use your version of this file under
|
||||
// the terms of any one of the MPL, the GPL or the LGPL.
|
||||
//
|
||||
// ***** END LICENSE BLOCK *****
|
||||
?>
|
||||
<?php
|
||||
require"../core/config.php";
|
||||
//Get Full Information for the file requested.
|
||||
$sql = "SELECT `URI` FROM `t_version` WHERE `ID`='$_GET[id]' AND `vID`='$_GET[vid]' LIMIT 1";
|
||||
$sql_result = mysql_query($sql, $connection) or trigger_error("MySQL Error ".mysql_errno().": ".mysql_error()."", E_USER_NOTICE);
|
||||
$row = mysql_fetch_array($sql_result);
|
||||
$uri=$row["URI"];
|
||||
|
||||
header("Location: $uri");
|
||||
exit;
|
||||
|
||||
//XXX This codepath sucks performance wise and has been disabled. See Bug 267822.
|
||||
|
||||
// New DownloadCount management Code..
|
||||
//Check for user, to see if they recently accessed this file (filters duplicate/triplicate+ requests in a short period).
|
||||
$maxlife = date("YmdHis", mktime(date("H"), date("i")-10, date("s"), date("m"), date("d"), date("Y")));
|
||||
$sql = "SELECT `dID` FROM `t_downloads` WHERE `ID`='$_GET[id]' AND `vID`='$_GET[vid]' AND `user_ip`='$_SERVER[REMOTE_ADDR]' AND `user_agent` = '$_SERVER[HTTP_USER_AGENT]' AND `date`>'$maxlife' AND `type`='download' LIMIT 1";
|
||||
$sql_result = mysql_query($sql, $connection) or trigger_error("MySQL Error ".mysql_errno().": ".mysql_error()."", E_USER_NOTICE);
|
||||
if (mysql_num_rows($sql_result)=="0") {
|
||||
//Insert a record of this download for the next 10 minutes anyway. :-)
|
||||
$today=date("YmdHis");
|
||||
$sql = "INSERT INTO `t_downloads` (`ID`,`date`,`vID`, `user_ip`, `user_agent`, `type`) VALUES ('$_GET[id]','$today','$_GET[vid]', '$_SERVER[REMOTE_ADDR]', '$_SERVER[HTTP_USER_AGENT]', 'download');";
|
||||
$sql_result = mysql_query($sql, $connection) or trigger_error("MySQL Error ".mysql_errno().": ".mysql_error()."", E_USER_NOTICE);
|
||||
|
||||
//Cleanup the Individual Downloads part of the table for old records
|
||||
$sql = "DELETE FROM `t_downloads` WHERE `date`<'$maxlife' AND `type`='download'";
|
||||
$sql_result = mysql_query($sql, $connection) or trigger_error("MySQL Error ".mysql_errno().": ".mysql_error()."", E_USER_NOTICE);
|
||||
|
||||
$today=date("Ymd")."000000";
|
||||
//Per day download tracking -- Record hits for this day in the record (if it doesn't exist create it)
|
||||
$sql = "SELECT `dID` FROM `t_downloads` WHERE `ID`='$_GET[id]' AND `date`='$today' AND `type`='count' LIMIT 1";
|
||||
$sql_result = mysql_query($sql, $connection) or trigger_error("MySQL Error ".mysql_errno().": ".mysql_error()."", E_USER_NOTICE);
|
||||
if (mysql_num_rows($sql_result)=="0") {
|
||||
$sql = "INSERT INTO `t_downloads` (`ID`,`date`,`downloadcount`,`type`) VALUES ('$_GET[id]','$today','1','count');";
|
||||
} else {
|
||||
$row = mysql_fetch_array($sql_result);
|
||||
$sql = "UPDATE `t_downloads` SET `downloadcount`=downloadcount+1 WHERE `dID`='$row[dID]' LIMIT 1";
|
||||
}
|
||||
$sql_result = mysql_query($sql, $connection) or trigger_error("MySQL Error ".mysql_errno().": ".mysql_error()."", E_USER_NOTICE);
|
||||
|
||||
|
||||
//Download Statistic Management Code
|
||||
// Maintain the last 7 days record count
|
||||
// This is also where the weekly w/e code would go. if that feature is ever created.
|
||||
$mindate = date("Ymd", mktime(0, 0, 0, date("m"), date("d")-7, date("Y")))."000000";
|
||||
$downloadcount="0";
|
||||
$sql = "SELECT `downloadcount` FROM `t_downloads` WHERE `ID`='$_GET[id]' AND `date`>='$mindate' AND `type`='count' ORDER BY `date` DESC";
|
||||
$sql_result = mysql_query($sql, $connection) or trigger_error("MySQL Error ".mysql_errno().": ".mysql_error()."", E_USER_NOTICE);
|
||||
while ($row = mysql_fetch_array($sql_result)) {
|
||||
$downloadcount = $downloadcount+$row["downloadcount"];
|
||||
}
|
||||
//Update the 7 day count in the main record.
|
||||
$sql = "UPDATE `t_main` SET `downloadcount`='$downloadcount' WHERE `ID`='$_GET[id]' LIMIT 1";
|
||||
$sql_result = mysql_query($sql, $connection) or trigger_error("MySQL Error ".mysql_errno().": ".mysql_error()."", E_USER_NOTICE);
|
||||
|
||||
//Update the total downloadcount in the main record.
|
||||
$sql = "UPDATE `t_main` SET `TotalDownloads`=TotalDownloads+1 WHERE `ID`='$_GET[id]' LIMIT 1";
|
||||
$sql_result = mysql_query($sql, $connection) or trigger_error("MySQL Error ".mysql_errno().": ".mysql_error()."", E_USER_NOTICE);
|
||||
|
||||
//Clean up the Counts per day for >8 days. (and in the future, compile the week/ending records for this data)
|
||||
$sql = "DELETE FROM `t_downloads` WHERE `ID`='$_GET[id]' AND `date`<'$mindate' AND `type`='count'";
|
||||
$sql_result = mysql_query($sql, $connection) or trigger_error("MySQL Error ".mysql_errno().": ".mysql_error()."", E_USER_NOTICE);
|
||||
|
||||
}
|
||||
|
||||
//Send User on their way to the file...
|
||||
header("Location: $uri")
|
||||
?>
|
||||
@@ -1,550 +0,0 @@
|
||||
<?php
|
||||
// ***** BEGIN LICENSE BLOCK *****
|
||||
// Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
//
|
||||
// The contents of this file are subject to the Mozilla Public License Version
|
||||
// 1.1 (the "License"); you may not use this file except in compliance with
|
||||
// the License. You may obtain a copy of the License at
|
||||
// http://www.mozilla.org/MPL/
|
||||
//
|
||||
// Software distributed under the License is distributed on an "AS IS" basis,
|
||||
// WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
// for the specific language governing rights and limitations under the
|
||||
// License.
|
||||
//
|
||||
// The Original Code is Mozilla Update.
|
||||
//
|
||||
// The Initial Developer of the Original Code is
|
||||
// Chris "Wolf" Crews.
|
||||
// Portions created by the Initial Developer are Copyright (C) 2004
|
||||
// the Initial Developer. All Rights Reserved.
|
||||
//
|
||||
// Contributor(s):
|
||||
// Chris "Wolf" Crews <psychoticwolf@carolina.rr.com>
|
||||
//
|
||||
// Alternatively, the contents of this file may be used under the terms of
|
||||
// either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
// the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
// in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
// of those above. If you wish to allow use of your version of this file only
|
||||
// under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
// use your version of this file under the terms of the MPL, indicate your
|
||||
// decision by deleting the provisions above and replace them with the notice
|
||||
// and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
// the provisions above, a recipient may use your version of this file under
|
||||
// the terms of any one of the MPL, the GPL or the LGPL.
|
||||
//
|
||||
// ***** END LICENSE BLOCK *****
|
||||
?>
|
||||
<?php
|
||||
require"../core/config.php";
|
||||
?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html401/loose.dtd">
|
||||
<html lang="EN" dir="ltr">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
||||
<meta http-equiv="Content-Language" content="en">
|
||||
<meta http-equiv="Content-Style-Type" content="text/css">
|
||||
|
||||
<?php
|
||||
//Bookmarking-Friendly Page Title
|
||||
$sql = "SELECT Name FROM `t_main` WHERE ID = '$_GET[id]' AND Type = 'E' LIMIT 1";
|
||||
$sql_result = mysql_query($sql, $connection) or trigger_error("MySQL Error ".mysql_errno().": ".mysql_error()."", E_USER_NOTICE);
|
||||
if (mysql_num_rows($sql_result)===0) {
|
||||
$return = page_error("1","Extension ID is Invalid or Missing.");
|
||||
exit;
|
||||
|
||||
}
|
||||
$row = mysql_fetch_array($sql_result);
|
||||
|
||||
//Page Titles
|
||||
$pagetitles = array("releases"=>"All Releases", "comments"=>"User Comments", "staffreview"=>"Editor Review", "opinion"=>" My Opinion");
|
||||
$pagetitle = $pagetitles[$_GET["page"]];
|
||||
?>
|
||||
|
||||
<TITLE>Mozilla Update :: Extensions -- More Info: <?php echo"$row[Name]"; if ($pagetitle) {echo" - $pagetitle"; } ?></TITLE>
|
||||
|
||||
<LINK REL="STYLESHEET" TYPE="text/css" HREF="/core/update.css">
|
||||
</HEAD>
|
||||
<BODY>
|
||||
<?php
|
||||
include"$page_header";
|
||||
$type = "E";
|
||||
$category=$_GET["category"];
|
||||
include"inc_sidebar.php";
|
||||
?>
|
||||
<DIV id="content">
|
||||
<?php
|
||||
//Get Author Data
|
||||
$sql2 = "SELECT TM.Name, TU.UserName, TU.UserID, TU.UserEmail FROM `t_main` TM
|
||||
LEFT JOIN t_authorxref TAX ON TM.ID = TAX.ID
|
||||
INNER JOIN t_userprofiles TU ON TAX.UserID = TU.UserID
|
||||
WHERE TM.ID = '$_GET[id]'
|
||||
ORDER BY `Type` , `Name` ASC ";
|
||||
$sql_result2 = mysql_query($sql2, $connection) or trigger_error("MySQL Error ".mysql_errno().": ".mysql_error()."", E_USER_NOTICE);
|
||||
while ($row2 = mysql_fetch_array($sql_result2)) {
|
||||
$authorarray[$row2[Name]][] = $row2["UserName"];
|
||||
$authorids[$row2[UserName]] = $row2["UserID"];
|
||||
}
|
||||
|
||||
|
||||
//Run Query and Create List
|
||||
$s = "0";
|
||||
$sql = "SELECT TM.ID, TM.Name, TM.DateAdded, TM.DateUpdated, TM.Homepage, TM.Description, TM.Rating, TV.vID, TV.Version, TV.MinAppVer, TV.MaxAppVer, TV.Size, TV.DateAdded AS VerDateAdded, TV.DateUpdated AS VerDateUpdated, TV.URI, TV.Notes, TM.TotalDownloads, TA.AppName, TOS.OSName, TP.PreviewURI
|
||||
FROM `t_main` TM
|
||||
INNER JOIN t_version TV ON TM.ID = TV.ID
|
||||
INNER JOIN t_applications TA ON TV.AppID = TA.AppID
|
||||
INNER JOIN t_os TOS ON TV.OSID = TOS.OSID
|
||||
LEFT JOIN t_previews TP ON TV.vID = TP.vID
|
||||
WHERE TM.ID = '$_GET[id]' AND `approved` = 'YES' ";
|
||||
if ($_GET["vid"]) { $sql .=" AND TV.vID = '$_GET[vid]' "; }
|
||||
$sql .= "ORDER BY `Name` , `Version` DESC LIMIT 1";
|
||||
$sql_result = mysql_query($sql, $connection) or trigger_error("MySQL Error ".mysql_errno().": ".mysql_error()."", E_USER_NOTICE);
|
||||
$row = mysql_fetch_array($sql_result);
|
||||
|
||||
|
||||
$v++;
|
||||
$id = $row["ID"];
|
||||
$type = $row["Type"];
|
||||
$name = $row["Name"];
|
||||
$dateadded = $row["DateAdded"];
|
||||
$dateupdated = $row["DateUpdated"];
|
||||
$homepage = $row["Homepage"];
|
||||
$description = $row["Description"];
|
||||
$rating = $row["Rating"];
|
||||
$authors = $authorarray[$name];
|
||||
$osname = $row["OSName"];
|
||||
|
||||
$vid = $row["vID"];
|
||||
if (!$_GET['vid']) {$_GET['vid']=$vid;}
|
||||
$appname = $row["AppName"];
|
||||
$minappver = $row["MinAppVer"];
|
||||
$maxappver = $row["MaxAppVer"];
|
||||
$verdateadded = $row["VerDateAdded"];
|
||||
$verdateupdated = $row["VerDateUpdated"];
|
||||
$filesize = $row["Size"];
|
||||
$notes = $row["Notes"];
|
||||
$version = $row["Version"];
|
||||
$uri = $row["URI"];
|
||||
$previewuri = $row["PreviewURI"];
|
||||
$downloadcount = $row["TotalDownloads"];
|
||||
|
||||
if ($VerDateAdded > $dateadded) {$dateadded = $VerDateAdded; }
|
||||
if ($VerDateUpdated > $dateupdated) {$dateupdated = $VerDateUpdated; }
|
||||
|
||||
|
||||
|
||||
//Turn Authors Array into readable string...
|
||||
$authorcount = count($authors);
|
||||
foreach ($authors as $author) {
|
||||
$userid = $authorids[$author];
|
||||
$n++;
|
||||
$authorstring .= "<A HREF=\"authorprofiles.php?application=$application&id=$userid\">$author</A>";
|
||||
if ($authorcount != $n) {$authorstring .=", "; }
|
||||
|
||||
}
|
||||
$authors = $authorstring;
|
||||
unset($authorstring, $n); // Clear used Vars..
|
||||
|
||||
//Create Customizeable Timestamp for DateAdded/DateUpdated
|
||||
$day=substr($dateadded,8,2); //get the day
|
||||
$month=substr($dateadded,5,2); //get the month
|
||||
$year=substr($dateadded,0,4); //get the year
|
||||
$hour=substr($dateadded,11,2); //get the hour
|
||||
$minute=substr($dateadded,14,2); //get the minute
|
||||
$second=substr($dateadded,17,2); //get the sec
|
||||
$datimestamp = strtotime("$year-$month-$day $hour:$minute:$second");
|
||||
|
||||
$day=substr($dateupdated,8,2); //get the day
|
||||
$month=substr($dateupdated,5,2); //get the month
|
||||
$year=substr($dateupdated,0,4); //get the year
|
||||
$hour=substr($dateupdated,11,2); //get the hour
|
||||
$minute=substr($dateupdated,14,2); //get the minute
|
||||
$second=substr($dateupdated,17,2); //get the sec
|
||||
$dutimestamp = strtotime("$year-$month-$day $hour:$minute:$second");
|
||||
|
||||
$dateadded = gmdate("F d, Y g:i:sa", $datimestamp); //gmdate("F d, Y", $datimestamp);
|
||||
$dateupdated = gmdate("F d, Y g:i:sa", $dutimestamp); //gmdate("F d, Y", $dutimestamp);
|
||||
|
||||
//Rating
|
||||
if (!$rating) { $rating="0"; }
|
||||
?>
|
||||
|
||||
|
||||
<DIV class="tabbar">
|
||||
<DIV class="tab"><A HREF="?<?php echo"application=$application&id=$id&vid=$vid"; ?>">More Info</A></DIV>
|
||||
<DIV class="tab"><A HREF="?<?php echo"application=$application&id=$id&vid=$vid&page=releases"; ?>">All Releases</A></DIV>
|
||||
<DIV class="tab"><A HREF="?<?php echo"application=$application&id=$id&vid=$vid&page=comments"; ?>">Comments</A></DIV>
|
||||
<DIV class="tab"><A HREF="?<?php echo"application=$application&id=$id&vid=$vid&page=staffreview"; ?>">Editor Review</A></DIV>
|
||||
<DIV class="tab"><A HREF="?<?php echo"application=$application&id=$id&vid=$vid&page=opinion"; ?>">My Opinion</A></DIV>
|
||||
</DIV>
|
||||
<?php
|
||||
echo"<DIV class=\"item\">\n";
|
||||
//echo"<DIV style=\"height: 100px\">"; //Why?!?
|
||||
if ($previewuri) {
|
||||
list($width, $height, $imagetype, $attr) = getimagesize("$websitepath"."$previewuri");
|
||||
|
||||
echo"<IMG SRC=\"$previewuri\" BORDER=0 HEIGHT=$height WIDTH=$width STYLE=\"float: right; padding-right: 5px\" ALT=\"$name preview\">";
|
||||
}
|
||||
|
||||
//Upper-Right Side Box
|
||||
echo"<DIV class=\"liststars\" title=\"$rating of 5 stars\" style=\"font-size: 8pt\"><A HREF=\"moreinfo.php?application=$application&id=$id&page=comments\">";
|
||||
for ($i = 1; $i <= floor($rating); $i++) {
|
||||
echo"<IMG SRC=\"/images/stars/star_icon.png\" BORDER=0 ALT=\""; if ($i==1) {echo"$rating of 5 stars";} echo"\">";
|
||||
}
|
||||
if ($rating>floor($rating)) {
|
||||
$val = ($rating-floor($rating))*10;
|
||||
echo"<IMG SRC=\"/images/stars/star_0$val.png\" BORDER=0 ALT=\"\">";
|
||||
$i++;
|
||||
}
|
||||
for ($i = $i; $i <= 5; $i++) {
|
||||
echo"<IMG SRC=\"/images/stars/graystar_icon.png\" BORDER=0 ALT=\""; if ($i==1) {echo"$rating of 5 stars";} echo"\">";
|
||||
}
|
||||
echo"</A></DIV>\n";
|
||||
|
||||
echo"<DIV class=\"itemtitle\">";
|
||||
echo"<SPAN class=\"title\"><A HREF=\"moreinfo.php?application=$application&id=$id&vid=$vid\">$name $version</A></SPAN><BR>";
|
||||
echo"<SPAN class=\"authorline\">By $authors</SPAN><br>";
|
||||
echo"</DIV>";
|
||||
|
||||
//Description & Version Notes
|
||||
echo"<SPAN class=\"itemdescription\">";
|
||||
echo"$description<BR>";
|
||||
if ($notes) {echo"$notes"; }
|
||||
echo"</SPAN>\n";
|
||||
|
||||
//echo"</DIV>\n";
|
||||
echo"<BR>\n\n";
|
||||
|
||||
$page = $_GET["page"];
|
||||
if (!$page or $page=="general") {
|
||||
?>
|
||||
<DIV class="downloadbox">
|
||||
<?php
|
||||
//Create DateStamp for Version Release Date ($verdateadded)
|
||||
$day=substr($verdateadded,8,2); //get the day
|
||||
$month=substr($verdateadded,5,2); //get the month
|
||||
$year=substr($verdateadded,0,4); //get the year
|
||||
$hour=substr($verdateadded,11,2); //get the hour
|
||||
$minute=substr($verdateadded,14,2); //get the minute
|
||||
$second=substr($verdateadded,17,2); //get the sec
|
||||
$timestamp = strtotime("$year-$month-$day $hour:$minute:$second");
|
||||
$verdateadded = gmdate("F d, Y", $timestamp);
|
||||
|
||||
//Calculate Download Time
|
||||
$speed = "56"; //In Kbit/s
|
||||
$speedinkb = "5.5"; //$speedinkb = $speed/8; //In KB/s
|
||||
$timeinsecs = round($filesize/$speedinkb);
|
||||
$time_minutes = floor($timeinsecs/60);
|
||||
$time_seconds = round($timeinsecs-($time_minutes*60),-1);
|
||||
$time_seconds = $time_seconds+2; //Compensate for mirror overhead
|
||||
|
||||
$time = "About ";
|
||||
if ($time_minutes>0) {
|
||||
$time .= "$time_minutes minutes ";
|
||||
}
|
||||
$time .="$time_seconds seconds";
|
||||
|
||||
$filename = basename($uri);
|
||||
|
||||
echo"
|
||||
<SPAN style=\"itemdescription\">Released on $verdateadded</SPAN><BR>
|
||||
|
||||
|
||||
<DIV class=\"moreinfoinstall\">";
|
||||
if ($appname=="Thunderbird") {
|
||||
echo"<A HREF=\"install.php/$filename?id=$id&vid=$vid\" TITLE=\"Download $name $version (Right-Click to Download)\"><IMG SRC=\"/images/download.png\" BORDER=0 HEIGHT=34 WIDTH=34 STYLE=\"float:left;\" ALT=\"\"> ( Download Now )</A><BR>";
|
||||
} else {
|
||||
echo"<A HREF=\"javascript:void(InstallTrigger.install({'$name $version':'$uri'}))\" TITLE=\"Install $name $version\"><IMG SRC=\"/images/download.png\" BORDER=0 HEIGHT=34 WIDTH=34 STYLE=\"float:left;\" ALT=\"\"> ( Install Now )</A><BR>";
|
||||
//echo"<A HREF=\"install.php/$filename?id=$id&vid=$vid\" TITLE=\"Install $name $version (Right-Click to Download)\"><IMG SRC=\"/images/download.png\" BORDER=0 HEIGHT=34 WIDTH=34 STYLE=\"float:left;\" ALT=\"\"> ( Install Now )</A><BR>";
|
||||
}
|
||||
echo"
|
||||
<SPAN class=\"filesize\"> $filesize KB, ($time @ $speed"."k)</SPAN></DIV>
|
||||
<BR>";
|
||||
if ($application=="thunderbird") {
|
||||
echo"<SPAN style=\"font-size: 10pt; color: #00F\">Extension Install Instructions for Thunderbird Users:</SPAN><BR>
|
||||
<SPAN style=\"font-size: 8pt;\">(1) Right-Click the link above and choose \"Save Link As...\" to Download and save the file to your hard disk.<BR>
|
||||
(2) In Mozilla Thunderbird, open the extension manager (Tools Menu/Extensions)<BR>
|
||||
(3) Click the Install button, and locate/select the file you downloaded and click \"OK\"</SPAN><BR>
|
||||
";
|
||||
}
|
||||
if ($homepage) {echo"<SPAN style=\"font-size:10pt\">Having a problem with this Extension? For Help and Technical Support, visit the <A HREF=\"$homepage\">Extension's Homepage</A>.</SPAN>";}
|
||||
|
||||
echo"<UL style=\"font-size:10pt\">";
|
||||
if ($homepage) {echo"<LI> <A HREF=\"$homepage\">Extension Home Page</A>"; }
|
||||
if ($appname !="Thunderbird") {echo"<LI> <a href=\"install.php/$filename?id=$id&vid=$vid\" TITLE=\"Right-click to Save\">Download Extension</A>"; }
|
||||
echo"<LI> <A HREF=\"moreinfo.php?application=$application&id=$id&vid=$vid&page=releases\">Other Versions</A>";
|
||||
?>
|
||||
</UL>
|
||||
</DIV>
|
||||
|
||||
<DIV class="commentbox">
|
||||
<DIV class="boxheader">User Comments:</DIV>
|
||||
<BR>
|
||||
<?php
|
||||
$sql = "SELECT CommentName, CommentTitle, CommentNote, CommentDate, CommentVote FROM `t_feedback` WHERE ID = '$_GET[id]' AND CommentNote IS NOT NULL ORDER BY `CommentDate` DESC LIMIT 1";
|
||||
$sql_result = mysql_query($sql, $connection) or trigger_error("MySQL Error ".mysql_errno().": ".mysql_error()."", E_USER_NOTICE);
|
||||
$num_results = mysql_num_rows($sql_result);
|
||||
while ($row = mysql_fetch_array($sql_result)) {
|
||||
$commentname = $row["CommentName"];
|
||||
$commenttitle = $row["CommentTitle"];
|
||||
$commentnotes = $row["CommentNote"];
|
||||
$commentdate = $row["CommentDate"];
|
||||
$rating = $row["CommentVote"];
|
||||
|
||||
//Create Customizeable Datestamp
|
||||
$day=substr($commentdate,8,2); //get the day
|
||||
$month=substr($commentdate,5,2); //get the month
|
||||
$year=substr($commentdate,0,4); //get the year
|
||||
$hour=substr($commentdate,11,2); //get the hour
|
||||
$minute=substr($commentdate,14,2); //get the minute
|
||||
$second=substr($commentdate,17,2); //get the sec
|
||||
$timestamp = strtotime("$year-$month-$day $hour:$minute:$second");
|
||||
$commentdate = gmdate("F d, Y g:ia", $timestamp);
|
||||
|
||||
echo"<DIV class=\"commenttitlebar\">";
|
||||
echo"<SPAN class=\"commenttitle\">$commenttitle</SPAN>";
|
||||
echo"<SPAN class=\"liststars\">";
|
||||
|
||||
for ($i = 1; $i <= $rating; $i++) {
|
||||
echo"<IMG SRC=\"/images/stars/star_icon.png\" BORDER=0 WIDTH=16 HEIGHT=16 ALT=\"*\">";
|
||||
}
|
||||
for ($i = $i; $i <= 5; $i++) {
|
||||
echo"<IMG SRC=\"/images/stars/graystar_icon.png\" BORDER=0 WIDTH=16 HEIGHT=16 ALT=\"\">";
|
||||
}
|
||||
echo"</SPAN>";
|
||||
echo"</DIV>";
|
||||
echo" By $commentname<BR>\n";
|
||||
echo" <BR>\n";
|
||||
echo"$commentnotes<BR>\n\n";
|
||||
echo" <BR>\n";
|
||||
echo"<DIV class=\"commentfooter\">\n";
|
||||
echo"$commentdate | <A HREF=\"moreinfo.php?application=$application&id=$id&vid=$vid&page=comments\">More Comments...</A> | <A HREF=\"moreinfo.php?id=$id&vid=$vid&category=$category&vid=$vid&page=opinion\">Rate It!</A>\n";
|
||||
echo"</DIV>\n";
|
||||
}
|
||||
|
||||
if ($num_results=="0") {
|
||||
echo"<DIV class=\"nocomment\">";
|
||||
echo"Nobody's Commented on this Extension Yet<BR>";
|
||||
echo"Be the First! <A HREF=\"moreinfo.php?application=$application&id=$id&vid=$vid&page=opinion\">Rate It!</A>";
|
||||
echo"</DIV>";
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
</DIV>
|
||||
|
||||
<?php
|
||||
} else if ($page=="releases") {
|
||||
|
||||
echo"<DIV class=\"mipageheading\">";
|
||||
echo"Recent Releases:<BR>";
|
||||
echo"</DIV>";
|
||||
|
||||
$sql = "SELECT TV.vID, TV.Version, TV.MinAppVer, TV.MaxAppVer, TV.Size, TV.URI, TV.Notes, TA.AppName, TOS.OSName
|
||||
FROM `t_version` TV
|
||||
INNER JOIN t_applications TA ON TV.AppID = TA.AppID
|
||||
INNER JOIN t_os TOS ON TV.OSID = TOS.OSID
|
||||
WHERE TV.ID = '$_GET[id]' AND `approved` = 'YES'
|
||||
ORDER BY `Version` DESC, `OSName` ASC
|
||||
LIMIT 0, 10";
|
||||
|
||||
$sql_result = mysql_query($sql, $connection) or trigger_error("MySQL Error ".mysql_errno().": ".mysql_error()."", E_USER_NOTICE);
|
||||
while ($row = mysql_fetch_array($sql_result)) {
|
||||
$vid = $row["vID"];
|
||||
$minappver = $row["MinAppVer"];
|
||||
$maxappver = $row["MaxAppVer"];
|
||||
$filesize = $row["Size"];
|
||||
$notes = $row["Notes"];
|
||||
$version = $row["Version"];
|
||||
$uri = $row["URI"];
|
||||
$osname = $row["OSName"];
|
||||
$appname = $row["AppName"];
|
||||
$filename = basename($uri);
|
||||
|
||||
echo"<DIV>"; //Open Version DIV
|
||||
|
||||
//Description & Version Notes
|
||||
echo"<SPAN class=\"itemdescription\">";
|
||||
echo"<SPAN class=\"listtitle\"><A HREF=\"moreinfo.php?application=$application&id=$id&vid=$vid\">Version $version</A></SPAN><br>\n";
|
||||
if ($notes) {echo"$notes"; }
|
||||
echo"</SPAN>\n";
|
||||
|
||||
//Icon Bar Modules
|
||||
echo"<DIV style=\"height: 34px\">";
|
||||
echo"<DIV class=\"iconbar\" style=\"width: 100px;\">";
|
||||
|
||||
if ($appname=="Thunderbird") {
|
||||
echo"<A HREF=\"install.php/$filename?id=$id&vid=$vid\"><IMG SRC=\"/images/download.png\" BORDER=0 HEIGHT=34 WIDTH=34 STYLE=\"float:left;\" TITLE=\"Install $name (Right-Click to Download)\" ALT=\"\">Download</A>";
|
||||
} else {
|
||||
echo"<A HREF=\"javascript:void(InstallTrigger.install({'$name $version':'$uri'}))\"><IMG SRC=\"/images/download.png\" BORDER=0 HEIGHT=34 WIDTH=34 STYLE=\"float:left;\" TITLE=\"Install $name (Right-Click to Download)\" ALT=\"\">Install</A>";
|
||||
}
|
||||
|
||||
echo"<BR><SPAN class=\"filesize\">Size: $filesize kb</SPAN></DIV>";
|
||||
//echo"<DIV class=\"iconbar\" style=\"width: 100px;\"><A HREF=\"install.php/$filename?id=$id&vid=$vid\"><IMG SRC=\"/images/download.png\" BORDER=0 HEIGHT=34 WIDTH=34 STYLE=\"float:left;\" TITLE=\"Install $name (Right-Click to Download)\" ALT=\"\">Install</A><BR><SPAN class=\"filesize\">Size: $filesize kb</SPAN></DIV>";
|
||||
echo"<DIV class=\"iconbar\"><IMG SRC=\"/images/".strtolower($appname)."_icon.png\" BORDER=0 HEIGHT=34 WIDTH=34 STYLE=\"float: left\" ALT=\"$appname\"> Works with:<BR> $minappver - $maxappver</DIV>";
|
||||
echo"<DIV class=\"iconbar\" style=\"width: 90px;\"><IMG SRC=\"/images/".strtolower($osname)."_icon.png\" BORDER=0 HEIGHT=34 WIDTH=34 STYLE=\"float: left\" ALT=\"\">OS:<BR>"; if($osname=="ALL") {echo"All OSes";} else {echo"$osname";} echo"</DIV>";
|
||||
echo"</DIV>";
|
||||
|
||||
echo"</DIV>";
|
||||
}
|
||||
|
||||
//End General Page
|
||||
} else if ($page=="comments") {
|
||||
//Comments/Ratings Page
|
||||
echo"<DIV class=\"mipageheading\">";
|
||||
echo"User Comments:<BR>";
|
||||
echo"</DIV>";
|
||||
$sql = "SELECT CommentName, CommentTitle, CommentNote, CommentDate, CommentVote FROM `t_feedback` WHERE ID = '$_GET[id]' AND CommentNote IS NOT NULL ORDER BY `CommentDate` ASC";
|
||||
$sql_result = mysql_query($sql, $connection) or trigger_error("MySQL Error ".mysql_errno().": ".mysql_error()."", E_USER_NOTICE);
|
||||
$num_results = mysql_num_rows($sql_result);
|
||||
while ($row = mysql_fetch_array($sql_result)) {
|
||||
$name = $row["CommentName"];
|
||||
$title = $row["CommentTitle"];
|
||||
$notes = $row["CommentNote"];
|
||||
$date = $row["CommentDate"];
|
||||
$rating = $row["CommentVote"];
|
||||
|
||||
echo"<DIV class=\"commenttitlebar\">";
|
||||
echo"<SPAN class=\"commenttitle\">$title</SPAN>";
|
||||
echo"<SPAN class=\"liststars\">";
|
||||
|
||||
for ($i = 1; $i <= $rating; $i++) {
|
||||
echo"<IMG SRC=\"/images/stars/star_icon.png\" BORDER=0 WIDTH=16 HEIGHT=16 ALT=\"*\">";
|
||||
}
|
||||
for ($i = $i; $i <= 5; $i++) {
|
||||
echo"<IMG SRC=\"/images/stars/graystar_icon.png\" BORDER=0 WIDTH=16 HEIGHT=16 ALT=\"\">";
|
||||
}
|
||||
echo"</SPAN>";
|
||||
echo"</DIV>";
|
||||
echo"$notes<BR>\n\n";
|
||||
|
||||
echo"<DIV class=\"commentfooter\">\n";
|
||||
echo"<SPAN style=\"padding-left: 30px; font-size: 8pt; font-weight: bold\">Posted on $date by $name</SPAN><br>";
|
||||
echo"</DIV>\n";
|
||||
}
|
||||
|
||||
if ($num_results=="0") {
|
||||
echo"<DIV class=\"nocomment\">";
|
||||
echo"Nobody has commented on this extension yet...<BR>
|
||||
Be the First!
|
||||
<A HREF=\"moreinfo.php?application=$application&id=$id&vid=$vid&page=opinion\">Leave your comments</A>...";
|
||||
echo"</DIV>\n";
|
||||
}
|
||||
|
||||
|
||||
echo"<DIV style=\"height: 5px;\"></DIV>";
|
||||
|
||||
} else if ($page=="staffreview") {
|
||||
//Staff/Editor Review Tab
|
||||
echo"<DIV class=\"mipageheading\">";
|
||||
echo"Editor Review:<BR>";
|
||||
echo"</DIV>";
|
||||
|
||||
echo"<DIV class=\"reviewbox\">\n";
|
||||
$sql = "SELECT TR.ID, `Title`, TR.DateAdded, `Body`, `Type`, `Pick`, TU.UserName FROM `t_reviews` TR
|
||||
INNER JOIN t_main TM ON TR.ID = TM.ID
|
||||
INNER JOIN t_userprofiles TU ON TR.AuthorID = TU.UserID
|
||||
WHERE `Type` = 'E' AND TR.ID = '$_GET[id]' ORDER BY `rID` DESC LIMIT 1";
|
||||
$sql_result = mysql_query($sql, $connection) or trigger_error("MySQL Error ".mysql_errno().": ".mysql_error()."", E_USER_NOTICE);
|
||||
$num_results = mysql_num_rows($sql_result);
|
||||
while ($row = mysql_fetch_array($sql_result)) {
|
||||
$id = $row["ID"];
|
||||
$title = $row["Title"];
|
||||
$dateadded = $row["DateAdded"];
|
||||
$body = $row["Body"];
|
||||
$pick = $row["Pick"];
|
||||
$username = $row["UserName"];
|
||||
|
||||
//Create Customizeable Timestamp
|
||||
// $day=substr($dateadded,8,2); //get the day
|
||||
// $month=substr($dateadded,5,2); //get the month
|
||||
// $year=substr($dateadded,0,4); //get the year
|
||||
// $hour=substr($dateadded,11,2); //get the hour
|
||||
// $minute=substr($dateadded,14,2); //get the minute
|
||||
// $second=substr($dateadded,17,2); //get the sec
|
||||
// $timestamp = strtotime("$year-$month-$day $hour:$minute:$second");
|
||||
$timestamp = strtotime("$dateadded");
|
||||
$date = gmdate("F, Y", $timestamp);
|
||||
$posteddate = date("F j Y, g:i:sa", $timestamp);
|
||||
|
||||
|
||||
echo"$title<br>\n";
|
||||
if ($pick=="YES") {echo"<SPAN class=\"itemdescription\"> $date Editors Pick<BR>\n"; }
|
||||
echo"<BR>\n";
|
||||
echo"$body</SPAN><BR>\n";
|
||||
echo"<DIV class=\"commentfooter\">Posted on $posteddate by $username</DIV>\n";
|
||||
}
|
||||
$typename = "extension";
|
||||
if ($num_results=="0") {
|
||||
echo"
|
||||
<SPAN style=\"font-weight: bold\">
|
||||
This $typename has not yet been reviewed.<BR><BR>
|
||||
|
||||
To see what other users think of this extension, view the <A HREF=\"moreinfo.php?application=$application&id=$id&page=comments\">User Comments...</A>
|
||||
</SPAN>
|
||||
";
|
||||
|
||||
|
||||
}
|
||||
echo"</DIV>\n";
|
||||
|
||||
} else if ($page=="opinion") {
|
||||
//My Opinion Tab
|
||||
echo"<DIV class=\"mipageheading\">";
|
||||
echo"Your Rating / Feedback:<BR>";
|
||||
echo"</DIV>";
|
||||
?>
|
||||
<?php
|
||||
if ($_GET["error"]=="norating") {
|
||||
echo"<DIV class=\"errorbox\">\n
|
||||
Your comment submission had the following error(s), please fix these errors and try again.<br>\n
|
||||
Rating field cannot be left blank.<br>\n
|
||||
</DIV>\n";
|
||||
}
|
||||
?>
|
||||
<DIV class="opinionform">
|
||||
<FORM NAME="opinon" METHOD="POST" ACTION="../core/postfeedback.php">
|
||||
<INPUT NAME="id" TYPE="HIDDEN" VALUE="<?php echo"$id"; ?>">
|
||||
<INPUT NAME="vid" TYPE="HIDDEN" VALUE="<?php echo"$vid"; ?>">
|
||||
<INPUT NAME="type" TYPE="HIDDEN" value="E">
|
||||
Your Name:<BR>
|
||||
<INPUT NAME="name" TYPE="TEXT" SIZE=30 MAXLENGTH=30><BR>
|
||||
|
||||
Rating:*<BR>
|
||||
<SELECT NAME="rating">
|
||||
<OPTION value="">Rating:
|
||||
<OPTION value="5">5 Stars
|
||||
<OPTION value="4">4 Stars
|
||||
<OPTION value="3">3 Stars
|
||||
<OPTION value="2">2 Stars
|
||||
<OPTION value="1">1 Star
|
||||
<OPTION value="0">0 Stars
|
||||
</SELECT><BR>
|
||||
|
||||
Title:<BR>
|
||||
<INPUT NAME="title" TYPE="TEXT" SIZE=30 MAXLENGTH=50><BR>
|
||||
|
||||
Review/Comments:<BR>
|
||||
<TEXTAREA NAME="comments" ROWS=5 COLS=55></TEXTAREA><BR>
|
||||
<SPAN class="smallfont">No Comment?<INPUT NAME="commententered" TYPE="CHECKBOX" VALUE="FALSE"></SPAN><BR>
|
||||
<INPUT NAME="submit" TYPE="SUBMIT" VALUE="Post"> <INPUT NAME="reset" TYPE="RESET" VALUE="Reset"><BR>
|
||||
<SPAN class="smallfont">* Required Fields</SPAN>
|
||||
</FORM>
|
||||
|
||||
</DIV>
|
||||
<?php
|
||||
} // End Pages
|
||||
echo"<DIV class=\"baseline\">";
|
||||
echo"Date Added: $dateadded | Last Updated: $dateupdated | ";
|
||||
echo"Total Downloads: $downloadcount<BR>";
|
||||
echo"</DIV>\n";
|
||||
echo"</DIV>\n";
|
||||
echo"<BR>\n";
|
||||
?>
|
||||
</DIV>
|
||||
<?php
|
||||
include"$page_footer";
|
||||
?>
|
||||
</BODY>
|
||||
</HTML>
|
||||
@@ -1,107 +0,0 @@
|
||||
<?php
|
||||
// ***** BEGIN LICENSE BLOCK *****
|
||||
// Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
//
|
||||
// The contents of this file are subject to the Mozilla Public License Version
|
||||
// 1.1 (the "License"); you may not use this file except in compliance with
|
||||
// the License. You may obtain a copy of the License at
|
||||
// http://www.mozilla.org/MPL/
|
||||
//
|
||||
// Software distributed under the License is distributed on an "AS IS" basis,
|
||||
// WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
// for the specific language governing rights and limitations under the
|
||||
// License.
|
||||
//
|
||||
// The Original Code is Mozilla Update.
|
||||
//
|
||||
// The Initial Developer of the Original Code is
|
||||
// Chris "Wolf" Crews.
|
||||
// Portions created by the Initial Developer are Copyright (C) 2004
|
||||
// the Initial Developer. All Rights Reserved.
|
||||
//
|
||||
// Contributor(s):
|
||||
// Chris "Wolf" Crews <psychoticwolf@carolina.rr.com>
|
||||
//
|
||||
// Alternatively, the contents of this file may be used under the terms of
|
||||
// either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
// the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
// in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
// of those above. If you wish to allow use of your version of this file only
|
||||
// under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
// use your version of this file under the terms of the MPL, indicate your
|
||||
// decision by deleting the provisions above and replace them with the notice
|
||||
// and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
// the provisions above, a recipient may use your version of this file under
|
||||
// the terms of any one of the MPL, the GPL or the LGPL.
|
||||
//
|
||||
// ***** END LICENSE BLOCK *****
|
||||
?>
|
||||
<?php
|
||||
//Mozilla Update Message System
|
||||
//Send Mail script...
|
||||
exit;
|
||||
require"../core/config.php";
|
||||
|
||||
if (!$_POST["senduserid"]) {
|
||||
exit("<B>Error: no valid user to e-mail, possible attempt to spam detected...</B>");
|
||||
}
|
||||
|
||||
//Get E-Mail Address from DB based on passed data..
|
||||
$sql = "SELECT `UserEmail` FROM `t_userprofiles` WHERE `UserID` = '$_POST[senduserid]' AND `UserEmailHide`='0' LIMIT 1";
|
||||
$sql_result = mysql_query($sql, $connection) or trigger_error("<FONT COLOR=\"#FF0000\"><B>MySQL Error ".mysql_errno().": ".mysql_error()."</B></FONT>", E_USER_NOTICE);
|
||||
$row = mysql_fetch_array($sql_result);
|
||||
$to_address=$row["UserEmail"];
|
||||
|
||||
|
||||
//All From_, To_, and subject variables are passed from the form
|
||||
// and do not need to be defined here.. unless debugging..
|
||||
|
||||
$from_name = $_POST["fromname"];
|
||||
$from_address = $_POST["fromemail"];
|
||||
$subject = $_POST["subject"];
|
||||
|
||||
//Anti-Abuse
|
||||
$findme = '@';
|
||||
$pos = strpos($to_address, $findme);
|
||||
|
||||
if ($pos === false) {
|
||||
//This isn't a valid e-mail address being passed...
|
||||
//Send the e-mail message to the $from_address, just for fun..
|
||||
$to_address = $from_address;
|
||||
}
|
||||
|
||||
$message = $_POST["body"];
|
||||
|
||||
//Message Footer (Auto-Appended to Messages sent using this form.
|
||||
$message .= "\n\n";
|
||||
$message .= "____________________________________\n";
|
||||
$message .= "Message sent through the Mozilla Update Message system.\n
|
||||
The system allows visitors to send you e-mail without revealing your e-mail address to them.
|
||||
If you no longer wish to receive e-mail from visitors, you may change your preferences online at http;//update.mozilla.org.\n";
|
||||
|
||||
|
||||
$headers .= "MIME-Version: 1.0\r\n";
|
||||
$headers .= "Content-type: text/plain; charset=iso-8859-1\r\n";
|
||||
$headers .= "From: ".$from_name." <".$from_address.">\r\n";
|
||||
$headers .= "Reply-To: ".$from_name." <".$from_address.">\r\n";
|
||||
$headers .= "X-Priority: 3\r\n";
|
||||
$headers .= "X-MSMail-Priority: Normal\r\n";
|
||||
$headers .= "X-Mailer: Mozilla Update Message System 1.0";
|
||||
|
||||
$mailstatus = mail($to_address, $subject, $message, $headers);
|
||||
|
||||
|
||||
|
||||
if ($mailstatus===FALSE) {
|
||||
//Message Unsuccessful
|
||||
$return_path="extensions/authorprofiles.php?id=$_POST[senduserid]&mail=unsuccessful";
|
||||
|
||||
} else if ($mailstatus===TRUE) {
|
||||
//Message Successful
|
||||
$return_path="extensions/authorprofiles.php?id=$_POST[senduserid]&mail=successful";
|
||||
|
||||
}
|
||||
header("Location: http://$_SERVER[HTTP_HOST]/$return_path#email");
|
||||
exit;
|
||||
|
||||
?>
|
||||
@@ -1,484 +0,0 @@
|
||||
<?php
|
||||
// ***** BEGIN LICENSE BLOCK *****
|
||||
// Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
//
|
||||
// The contents of this file are subject to the Mozilla Public License Version
|
||||
// 1.1 (the "License"); you may not use this file except in compliance with
|
||||
// the License. You may obtain a copy of the License at
|
||||
// http://www.mozilla.org/MPL/
|
||||
//
|
||||
// Software distributed under the License is distributed on an "AS IS" basis,
|
||||
// WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
// for the specific language governing rights and limitations under the
|
||||
// License.
|
||||
//
|
||||
// The Original Code is Mozilla Update.
|
||||
//
|
||||
// The Initial Developer of the Original Code is
|
||||
// Chris "Wolf" Crews.
|
||||
// Portions created by the Initial Developer are Copyright (C) 2004
|
||||
// the Initial Developer. All Rights Reserved.
|
||||
//
|
||||
// Contributor(s):
|
||||
// Chris "Wolf" Crews <psychoticwolf@carolina.rr.com>
|
||||
//
|
||||
// Alternatively, the contents of this file may be used under the terms of
|
||||
// either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
// the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
// in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
// of those above. If you wish to allow use of your version of this file only
|
||||
// under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
// use your version of this file under the terms of the MPL, indicate your
|
||||
// decision by deleting the provisions above and replace them with the notice
|
||||
// and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
// the provisions above, a recipient may use your version of this file under
|
||||
// the terms of any one of the MPL, the GPL or the LGPL.
|
||||
//
|
||||
// ***** END LICENSE BLOCK *****
|
||||
?>
|
||||
<?php
|
||||
require"../core/config.php";
|
||||
?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html401/loose.dtd">
|
||||
<html lang="EN" dir="ltr">
|
||||
<head>
|
||||
|
||||
<?php
|
||||
//----------------------------
|
||||
//Global General $_GET variables
|
||||
//----------------------------
|
||||
//Detection Override
|
||||
if ($_GET["version"]) {$app_version=$_GET["version"]; $_SESSION["app_version"]=$_GET["version"];}
|
||||
|
||||
if ($_GET["numpg"]) {$_SESSION["items_per_page"]=$_GET["numpg"]; }
|
||||
if ($_SESSION["items_per_page"]) {$items_per_page = $_SESSION["items_per_page"];} else {$items_per_page="10";}//Default Num per Page is 10
|
||||
|
||||
if ($_GET["category"]) { $_SESSION["category"] = $_GET["category"]; }
|
||||
if ($_SESSION["category"]) {$category = $_SESSION["category"];}
|
||||
if ($category=="All") {$category="";}
|
||||
|
||||
|
||||
if (!$_GET["pageid"]) {$pageid="1"; } else { $pageid = $_GET["pageid"]; } //Default PageID is 1
|
||||
$type="E"; //Default Type is E
|
||||
|
||||
unset($typename);
|
||||
$types = array("E"=>"Extensions","T"=>"Themes","U"=>"Updates");
|
||||
$typename = $types["$type"];
|
||||
|
||||
//RSS Autodiscovery Link Stuff
|
||||
switch ($_SESSION["category"]) {
|
||||
case "Newest":
|
||||
$rsslist = "newest";
|
||||
break;
|
||||
case "Popular":
|
||||
$rsslist = "popular";
|
||||
break;
|
||||
case "Top Rated":
|
||||
$rsslist = "rated";
|
||||
break;
|
||||
}
|
||||
|
||||
$rssfeed = "rss/?application=" . $application . "&type=" . $type . "&list=" . $rsslist;
|
||||
|
||||
if (!$category) {$categoryname = "All $typename"; } else {$categoryname = $category; }
|
||||
?>
|
||||
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
||||
<meta http-equiv="Content-Language" content="en">
|
||||
<meta http-equiv="Content-Style-Type" content="text/css">
|
||||
|
||||
<TITLE>Mozilla Update :: Extensions - List - <?php echo"$categoryname"; if ($pageid) {echo" - Page $pageid"; } ?></TITLE>
|
||||
<LINK REL="STYLESHEET" TYPE="text/css" HREF="/core/update.css">
|
||||
<?php
|
||||
if ($rsslist) {
|
||||
echo"<link rel=\"alternate\" type=\"application/rss+xml\" title=\"RSS\" href=\"http://$_SERVER[HTTP_HOST]/$rssfeed\">";
|
||||
}
|
||||
?>
|
||||
</HEAD>
|
||||
<BODY>
|
||||
<?php
|
||||
include"$page_header";
|
||||
|
||||
// -----------------------------------------------
|
||||
// Begin Content of the Page Here
|
||||
// -----------------------------------------------
|
||||
|
||||
include"inc_sidebar.php";
|
||||
|
||||
echo"<DIV id=\"content\">\n"; // Begin Content Area
|
||||
//Query for List Creation
|
||||
$s = "0";
|
||||
$startpoint = ($pageid-1)*$items_per_page;
|
||||
if ($category=="Editors Pick" or $category=="Newest" or $category=="Popular" or $category=="Top Rated") {
|
||||
if ($category =="Editors Pick") {
|
||||
$editorpick="true";
|
||||
} else if ($category =="Newest") {
|
||||
$orderby = "TV.DateAdded DESC, `Name` ASC";
|
||||
} else if ($category =="Popular") {
|
||||
$orderby = "TM.TotalDownloads DESC, `Name` ASC";
|
||||
} else if ($category =="Top Rated") {
|
||||
$orderby = "TM.Rating DESC, `Name` ASC";
|
||||
}
|
||||
$catname = $category;
|
||||
$category = "%";
|
||||
}
|
||||
if ($app_version=="0.10") {$app_version="0.95"; }
|
||||
$sql = "SELECT TM.ID, TM.Name, TM.DateAdded, TM.DateUpdated, TM.Homepage, TM.Description, TM.Rating, TM.TotalDownloads, TV.vID,
|
||||
SUBSTRING(MAX(CONCAT(LPAD(TV.Version, 6, '0'), TV.vID)), 7) AS MAXvID,
|
||||
MAX(TV.Version) AS Version,
|
||||
TA.AppName, TOS.OSName
|
||||
FROM `t_main` TM
|
||||
INNER JOIN t_version TV ON TM.ID = TV.ID
|
||||
INNER JOIN t_applications TA ON TV.AppID = TA.AppID
|
||||
INNER JOIN t_os TOS ON TV.OSID = TOS.OSID ";
|
||||
if ($category && $category !=="%") { $sql .="INNER JOIN t_categoryxref TCX ON TM.ID = TCX.ID
|
||||
INNER JOIN t_categories TC ON TCX.CategoryID = TC.CategoryID "; }
|
||||
if ($editorpick=="true") { $sql .="INNER JOIN t_reviews TR ON TM.ID = TR.ID "; }
|
||||
$sql .="WHERE Type = '$type' AND AppName = '$application' AND `approved` = 'YES' ";
|
||||
if ($editorpick=="true") { $sql .="AND TR.Pick = 'YES' "; }
|
||||
if ($category && $category !=="%") {$sql .="AND CatName LIKE '$category' ";}
|
||||
if ($app_version) { $sql .=" AND TV.MinAppVer_int <= '".strtolower($app_version)."' AND TV.MaxAppVer_int >= '".strtolower($app_version)."' ";}
|
||||
if ($OS) { $sql .=" AND (TOS.OSName = '$OS' OR TOS.OSName = 'All') "; }
|
||||
$sql .="GROUP BY `Name` ";
|
||||
if ($orderby) {
|
||||
$sql .="ORDER BY $orderby";
|
||||
} else {
|
||||
$sql .="ORDER BY `Name` , `Version` DESC ";
|
||||
}
|
||||
|
||||
$resultsquery = $sql;
|
||||
unset($sql);
|
||||
|
||||
//Get Total Results from Result Query & Populate Page Control Vars.
|
||||
$sql_result = mysql_query($resultsquery, $connection) or trigger_error("MySQL Error ".mysql_errno().": ".mysql_error()."", E_USER_NOTICE);
|
||||
$totalresults = mysql_num_rows($sql_result);
|
||||
|
||||
$num_pages = ceil($totalresults/$items_per_page); //Total # of Pages
|
||||
if ($pageid>$num_pages) {$pageid=$num_pages;} //Check PageId for Validity
|
||||
$startpoint = ($pageid-1)*$items_per_page;
|
||||
if ($startpoint<0) {$startpoint=0; $startitem=0;}
|
||||
$startitem = $startpoint+1;
|
||||
$enditem = $startpoint+$items_per_page;
|
||||
if ($totalresults=="0") {$startitem = "0"; }
|
||||
if ($enditem>$totalresults) {$enditem=$totalresults;} //Verify EndItem
|
||||
|
||||
|
||||
if ($_GET[nextnum]) {$startpoint = $_GET["nextnum"]; }
|
||||
//$resultsquery = str_replace("GROUP BY `Name` ", "", $resultsquery);
|
||||
$resultsquery .= " LIMIT $startpoint , $items_per_page"; //Append LIMIT clause to result query
|
||||
|
||||
if ($category=="%") {$category = $catname; unset($catname); }
|
||||
|
||||
//Now Showing Box
|
||||
echo"<DIV id=\"listnav\">";
|
||||
if (!$OS) {$OS="all";}
|
||||
if (!$category) {$categoryname="All"; } else {$categoryname = $category;}
|
||||
echo"<DIV class=\"pagenum\" "; if ($application!="mozilla") {echo" style=\"margin-right: 58%;\""; } echo">";
|
||||
$previd=$pageid-1;
|
||||
if ($previd >"0") {
|
||||
echo"<a href=\"?application=$application&version=$app_version&category=$category&numpg=$items_per_page&pageid=$previd\">« Previous</A> • ";
|
||||
}
|
||||
echo"Page $pageid of $num_pages";
|
||||
|
||||
$nextid=$pageid+1;
|
||||
if ($pageid <$num_pages) {
|
||||
echo" • <a href=\"?application=$application&version=$app_version&category=$category&numpg=$items_per_page&pageid=$nextid\">Next »</a>";
|
||||
}
|
||||
|
||||
echo"</DIV>\n";
|
||||
|
||||
echo"<SPAN class=\"listtitle\">".ucwords("$application $typename » $categoryname ")."</SPAN><br>";
|
||||
echo"".ucwords("$typename")." $startitem - $enditem of $totalresults";
|
||||
|
||||
|
||||
// Modify List Form
|
||||
|
||||
echo"<DIV class=\"listform\">";
|
||||
echo"<FORM NAME=\"listviews\" METHOD=\"GET\" ACTION=\"showlist.php\">\n";
|
||||
echo"<INPUT NAME=\"application\" TYPE=\"hidden\" VALUE=\"$application\">\n";
|
||||
//Items-Per-Page
|
||||
echo"Show/Page: ";
|
||||
$perpage = array("5","10","20","50");
|
||||
echo"<SELECT name=\"numpg\">";
|
||||
foreach ($perpage as $value) {
|
||||
echo"<OPTION value=\"$value\"";
|
||||
if ($items_per_page==$value) {echo" SELECTED"; }
|
||||
echo">$value</OPTION>";
|
||||
}
|
||||
echo"</SELECT>\n";
|
||||
|
||||
|
||||
// Operating Systems
|
||||
echo" OS: ";
|
||||
echo"<SELECT name=\"os\">\n";
|
||||
$sql = "SELECT `OSName` FROM `t_os` ORDER BY `OSName`";
|
||||
$sql_result = mysql_query($sql, $connection) or trigger_error("MySQL Error ".mysql_errno().": ".mysql_error()."", E_USER_NOTICE);
|
||||
while ($row = mysql_fetch_array($sql_result)) {
|
||||
$osname = $row["OSName"];
|
||||
echo"<OPTION value=\"".strtolower($osname)."\"";
|
||||
if (strtolower($OS) == strtolower($osname)) {echo" SELECTED";}
|
||||
echo">$osname</OPTION>";
|
||||
}
|
||||
echo"</SELECT>\n";
|
||||
|
||||
|
||||
//Versions of Application
|
||||
echo"Versions: ";
|
||||
echo"<SELECT name=\"version\">";
|
||||
if ($application != "thunderbird") {echo"<OPTION value=\"auto-detect\">Auto-Detect</OPTION>";}
|
||||
$app_orig = $application; //Store original to protect against possible corruption
|
||||
$sql = "SELECT `Version`, `major`, `minor`, `release`, `SubVer` FROM `t_applications` WHERE `AppName` = '$application' ORDER BY `major` DESC, `minor` DESC, `release` DESC, `SubVer` DESC";
|
||||
$sql_result = mysql_query($sql, $connection) or trigger_error("MySQL Error ".mysql_errno().": ".mysql_error()."", E_USER_NOTICE);
|
||||
while ($row = mysql_fetch_array($sql_result)) {
|
||||
$version = $row["Version"];
|
||||
$subver = $row["SubVer"];
|
||||
$release = "$row[major].$row[minor]";
|
||||
if ($row["release"]) {$release = ".$release$row[release]";}
|
||||
if ($app_version=="0.95") {$app_version="0.10"; }
|
||||
//Firesomething Support
|
||||
if ($application=="firefox") { if ($release == "0.7") {$application="firebird";} else {$application="firefox";} }
|
||||
|
||||
if ($subver !=="final") {$release="$release$subver";}
|
||||
echo"<OPTION value=\"$release\"";
|
||||
if ($app_version == $release) {echo" SELECTED"; }
|
||||
echo">".ucwords($application)." $version</OPTION>";
|
||||
|
||||
if ($app_version=="0.10") {$app_version="0.95"; }
|
||||
}
|
||||
$application = $app_orig; unset($app_orig);
|
||||
|
||||
|
||||
echo"</SELECT>\n";
|
||||
echo"<INPUT NAME=\"submit\" TYPE=\"SUBMIT\" VALUE=\"Update\">";
|
||||
echo"</FORM>";
|
||||
echo"</DIV>";
|
||||
|
||||
echo"</DIV>\n";
|
||||
|
||||
|
||||
//---------------------------------
|
||||
// Begin List
|
||||
//---------------------------------
|
||||
//Get Author Data and Create $authorarray and $authorids
|
||||
$sql = "SELECT TM.Name, TU.UserName, TU.UserID, TU.UserEmail FROM `t_main` TM
|
||||
LEFT JOIN t_authorxref TAX ON TM.ID = TAX.ID
|
||||
INNER JOIN t_userprofiles TU ON TAX.UserID = TU.UserID
|
||||
ORDER BY `Type` , `Name` ASC "; // TM.Type = 'E'
|
||||
$sql_result = mysql_query($sql, $connection) or trigger_error("MySQL Error ".mysql_errno().": ".mysql_error()."", E_USER_NOTICE);
|
||||
while ($row = mysql_fetch_array($sql_result)) {
|
||||
$authorarray[$row[Name]][] = $row["UserName"];
|
||||
$authorids[$row[UserName]] = $row["UserID"];
|
||||
}
|
||||
|
||||
//Assemble a display application version array
|
||||
$sql = "SELECT `Version`, `major`, `minor`, `release`, `SubVer` FROM `t_applications` WHERE `AppName`='$application' ORDER BY `major`,`minor`";
|
||||
$sql_result = mysql_query($sql, $connection) or trigger_error("MySQL Error ".mysql_errno().": ".mysql_error()."", E_USER_NOTICE);
|
||||
while ($row = mysql_fetch_array($sql_result)) {
|
||||
$version = $row["Version"];
|
||||
$subver = $row["SubVer"];
|
||||
$release = "$row[major].$row[minor]";
|
||||
if ($row["release"]) {$release = ".$release$row[release]";}
|
||||
if ($subver !=="final") {$release="$release$subver";}
|
||||
|
||||
$appvernames[$release] = $version;
|
||||
}
|
||||
|
||||
//Query to Generate List..
|
||||
$sql = "$resultsquery";
|
||||
$sql_result = mysql_query($sql, $connection) or trigger_error("MySQL Error ".mysql_errno().": ".mysql_error()."", E_USER_NOTICE);
|
||||
while ($row = mysql_fetch_array($sql_result)) {
|
||||
|
||||
$id = $row["ID"];
|
||||
$type = $row["Type"];
|
||||
$name = $row["Name"];
|
||||
$dateadded = $row["DateAdded"];
|
||||
$dateupdated = $row["DateUpdated"];
|
||||
$homepage = $row["Homepage"];
|
||||
$description = $row["Description"];
|
||||
$rating = $row["Rating"];
|
||||
$authors = $authorarray[$name];
|
||||
$osname = $row["OSName"];
|
||||
$appname = $row["AppName"];
|
||||
$downloadcount = $row["TotalDownloads"];
|
||||
|
||||
//Get Version Record for Referenced MAXvID from list query
|
||||
$sql2 = "SELECT TV.vID, TV.Version, TV.MinAppVer, TV.MaxAppVer, TV.Size, TV.DateAdded AS VerDateAdded, TV.DateUpdated AS VerDateUpdated, TV.URI, TV.Notes, TP.PreviewURI FROM `t_version` TV
|
||||
LEFT JOIN t_previews TP ON TV.vID = TP.vID
|
||||
INNER JOIN t_applications TA ON TV.AppID = TA.AppID
|
||||
INNER JOIN t_os TOS ON TV.OSID = TOS.OSID
|
||||
WHERE TV.ID = '$id' AND TV.Version = '$row[Version]' AND TA.AppName = '$appname' AND TOS.OSName = '$osname' LIMIT 1";
|
||||
$sql_result2 = mysql_query($sql2, $connection) or trigger_error("MySQL Error ".mysql_errno().": ".mysql_error()."", E_USER_NOTICE);
|
||||
$vid = $row[MAXvID];
|
||||
$row = mysql_fetch_array($sql_result2);
|
||||
|
||||
$vid = $row["vID"];
|
||||
if ($appvernames[$row["MinAppVer"]]) {$minappver = $appvernames[$row["MinAppVer"]]; } else { $minappver = $row["MinAppVer"]; }
|
||||
if ($appvernames[$row["MaxAppVer"]]) {$maxappver = $appvernames[$row["MaxAppVer"]]; } else { $maxappver = $row["MaxAppVer"]; }
|
||||
$VerDateAdded = $row["VerDateAdded"];
|
||||
$VerDateUpdated = $row["VerDateUpdated"];
|
||||
$filesize = $row["Size"];
|
||||
$notes = $row["Notes"];
|
||||
$version = $row["Version"];
|
||||
$uri = $row["URI"];
|
||||
$previewuri = $row["PreviewURI"];
|
||||
|
||||
$filename = basename($uri);
|
||||
|
||||
if ($VerDateAdded > $dateadded) {$dateadded = $VerDateAdded; }
|
||||
if ($VerDateUpdated > $dateupdated) {$dateupdated = $VerDateUpdated; }
|
||||
|
||||
//Turn Authors Array into readable string...
|
||||
$authorcount = count($authors);
|
||||
foreach ($authors as $author) {
|
||||
$userid = $authorids[$author];
|
||||
$n++;
|
||||
$authorstring .= "<A HREF=\"authorprofiles.php?application=$application&id=$userid\">$author</A>";
|
||||
if ($authorcount != $n) {$authorstring .=", "; }
|
||||
|
||||
}
|
||||
$authors = $authorstring;
|
||||
unset($authorstring, $n); // Clear used Vars..
|
||||
|
||||
//Create Customizeable Timestamp
|
||||
$day=substr($dateupdated,8,2); //get the day
|
||||
$month=substr($dateupdated,5,2); //get the month
|
||||
$year=substr($dateupdated,0,4); //get the year
|
||||
$hour=substr($dateupdated,11,2); //get the hour
|
||||
$minute=substr($dateupdated,14,2); //get the minute
|
||||
$second=substr($dateupdated,17,2); //get the sec
|
||||
$timestamp = strtotime("$year-$month-$day $hour:$minute:$second");
|
||||
$dateupdated = gmdate("F d, Y g:i:sa", $timestamp); //gmdate("F d, Y g:i:sa T", $timestamp);
|
||||
|
||||
|
||||
echo"<DIV class=\"item\">\n";
|
||||
//echo"<DIV style=\"height: 100px\">"; //Not sure why this is here, it caused text to flood out of the box though.
|
||||
|
||||
if ($previewuri) {
|
||||
list($width, $height, $type, $attr) = getimagesize("$websitepath"."$previewuri");
|
||||
|
||||
echo"<IMG SRC=\"$previewuri\" BORDER=0 HEIGHT=$height WIDTH=$width STYLE=\"float: right; padding-right: 5px\" ALT=\"$name preview\">";
|
||||
}
|
||||
|
||||
|
||||
//Upper-Right Side Box
|
||||
echo"<DIV class=\"liststars\" title=\"$rating of 5 stars\" style=\"font-size: 8pt\"><A HREF=\"moreinfo.php?application=$application&id=$id&page=comments\">";
|
||||
for ($i = 1; $i <= floor($rating); $i++) {
|
||||
echo"<IMG SRC=\"/images/stars/star_icon.png\" BORDER=0 ALT=\""; if ($i==1) {echo"$rating of 5 stars";} echo"\">";
|
||||
}
|
||||
if ($rating>floor($rating)) {
|
||||
$val = ($rating-floor($rating))*10;
|
||||
echo"<IMG SRC=\"/images/stars/star_0$val.png\" BORDER=0 ALT=\"\">";
|
||||
$i++;
|
||||
}
|
||||
for ($i = $i; $i <= 5; $i++) {
|
||||
echo"<IMG SRC=\"/images/stars/graystar_icon.png\" BORDER=0 ALT=\""; if ($i==1) {echo"$rating of 5 stars";} echo"\">";
|
||||
}
|
||||
echo"</A></DIV>\n";
|
||||
|
||||
|
||||
echo"<DIV class=\"itemtitle\">";
|
||||
echo"<SPAN class=\"title\"><A HREF=\"moreinfo.php?application=$application&id=$id&vid=$vid\">$name $version</A></SPAN><BR>";
|
||||
echo"<SPAN class=\"authorline\">By $authors</SPAN><br>";
|
||||
echo"</DIV>";
|
||||
|
||||
//Description & Version Notes
|
||||
echo"<SPAN class=\"itemdescription\">";
|
||||
echo"$description<BR>";
|
||||
if ($notes) {echo"$notes"; }
|
||||
echo"</SPAN>\n";
|
||||
echo"<BR>";
|
||||
//echo"</DIV>";
|
||||
|
||||
//Icon Bar Modules
|
||||
echo"<DIV style=\"height: 34px\">";
|
||||
echo"<DIV class=\"iconbar\" style=\"width: 104px;\">";
|
||||
if ($appname=="Thunderbird") {
|
||||
echo"<A HREF=\"moreinfo.php?application=$application&id=$id&vid=$vid\"><IMG SRC=\"/images/download.png\" BORDER=0 HEIGHT=34 WIDTH=34 STYLE=\"float:left;\" TITLE=\"More Info about $name\" ALT=\"\">More Info</A>";
|
||||
} else {
|
||||
//echo"<A HREF=\"install.php/$filename?id=$id&vid=$vid\"><IMG SRC=\"/images/download.png\" BORDER=0 HEIGHT=34 WIDTH=34 STYLE=\"float:left;\" TITLE=\"Install $name\" ALT=\"\">Install</A>";
|
||||
echo"<A HREF=\"javascript:void(InstallTrigger.install({'$name $version':'$uri'}))\"><IMG SRC=\"/images/download.png\" BORDER=0 HEIGHT=34 WIDTH=34 STYLE=\"float:left;\" TITLE=\"Install $name\" ALT=\"\">Install</A>";
|
||||
}
|
||||
echo"<BR><SPAN class=\"filesize\">Size: $filesize kb</SPAN></DIV>";
|
||||
if ($homepage) {echo"<DIV class=\"iconbar\" style=\"width: 98px;\"><A HREF=\"$homepage\"><IMG SRC=\"/images/home.png\" BORDER=0 HEIGHT=34 WIDTH=34 STYLE=\"float:left;\" TITLE=\"$name Homepage\" ALT=\"\">Homepage</A></DIV>";}
|
||||
echo"<DIV class=\"iconbar\"><IMG SRC=\"/images/".strtolower($appname)."_icon.png\" BORDER=0 HEIGHT=34 WIDTH=34 STYLE=\"float: left\" ALT=\"$appname\"> Works with:<BR> $minappver - $maxappver</DIV>";
|
||||
if($osname !=="ALL") { echo"<DIV class=\"iconbar\" style=\"width: 85px;\"><IMG SRC=\"/images/".strtolower($osname)."_icon.png\" BORDER=0 HEIGHT=34 WIDTH=34 STYLE=\"float: left\" ALT=\"\">OS:<BR>$osname</DIV>"; }
|
||||
echo"</DIV>";
|
||||
|
||||
echo"<DIV class=\"baseline\">Updated: $dateupdated | Total Downloads: $downloadcount<BR></DIV>\n";
|
||||
echo"</DIV>\n";
|
||||
|
||||
} //End While Loop
|
||||
if ($totalresults=="0") {
|
||||
echo"<DIV class=\"item noitems\">\n";
|
||||
echo"No extensions found in this category for ".ucwords($application).".\n";
|
||||
echo"</DIV>\n";
|
||||
|
||||
}
|
||||
?>
|
||||
|
||||
|
||||
|
||||
|
||||
<?php
|
||||
// Begin PHP Code for Dynamic Navbars
|
||||
if ($pageid <=$num_pages) {
|
||||
echo"<DIV id=\"listnav\">";
|
||||
|
||||
|
||||
echo"<DIV class=\"pagenum\">";
|
||||
$previd=$pageid-1;
|
||||
if ($previd >"0") {
|
||||
echo"<a href=\"?application=$application&version=$app_version&category=$category&numpg=$items_per_page&pageid=$previd\">« Previous</A> • ";
|
||||
}
|
||||
echo"Page $pageid of $num_pages";
|
||||
|
||||
|
||||
$nextid=$pageid+1;
|
||||
if ($pageid <$num_pages) {
|
||||
echo" • <a href=\"?application=$application&version=$app_version&category=$category&numpg=$items_per_page&pageid=$nextid\">Next »</a>";
|
||||
}
|
||||
echo"<BR>\n";
|
||||
|
||||
|
||||
//Skip to Page...
|
||||
if ($num_pages>1) {
|
||||
echo"Jump to: ";
|
||||
$pagesperpage=9; //Plus 1 by default..
|
||||
$i = 01;
|
||||
//Dynamic Starting Point
|
||||
if ($pageid>11) {
|
||||
$nextpage=$pageid-10;
|
||||
}
|
||||
$i=$nextpage;
|
||||
|
||||
//Dynamic Ending Point
|
||||
$maxpagesonpage=$pageid+$pagesperpage;
|
||||
//Page #s
|
||||
while ($i <= $maxpagesonpage && $i <= $num_pages) {
|
||||
|
||||
if ($i==$pageid) {
|
||||
echo"<SPAN style=\"color: #FF0000\">$i</SPAN> ";
|
||||
} else {
|
||||
echo"<A HREF=\"?application=$application&version=$app_version&category=$category&numpg=$items_per_page&pageid=$i\">$i</A> ";
|
||||
|
||||
}
|
||||
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
|
||||
echo"</DIV>\n";
|
||||
|
||||
echo"<SPAN class=\"listtitle\">".ucwords("$application $typename » $categoryname ")."</SPAN><br>";
|
||||
echo"".ucwords("$typename")." $startitem - $enditem of $totalresults";
|
||||
|
||||
echo"</DIV>\n";
|
||||
}
|
||||
|
||||
echo"</DIV>\n"; //End Content
|
||||
?>
|
||||
<?php
|
||||
include"$page_footer";
|
||||
?>
|
||||
</BODY>
|
||||
</HTML>
|
||||
@@ -1,75 +0,0 @@
|
||||
<?php
|
||||
// ***** BEGIN LICENSE BLOCK *****
|
||||
// Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
//
|
||||
// The contents of this file are subject to the Mozilla Public License Version
|
||||
// 1.1 (the "License"); you may not use this file except in compliance with
|
||||
// the License. You may obtain a copy of the License at
|
||||
// http://www.mozilla.org/MPL/
|
||||
//
|
||||
// Software distributed under the License is distributed on an "AS IS" basis,
|
||||
// WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
// for the specific language governing rights and limitations under the
|
||||
// License.
|
||||
//
|
||||
// The Original Code is Mozilla Update.
|
||||
//
|
||||
// The Initial Developer of the Original Code is
|
||||
// Chris "Wolf" Crews.
|
||||
// Portions created by the Initial Developer are Copyright (C) 2004
|
||||
// the Initial Developer. All Rights Reserved.
|
||||
//
|
||||
// Contributor(s):
|
||||
// Chris "Wolf" Crews <psychoticwolf@carolina.rr.com>
|
||||
//
|
||||
// Alternatively, the contents of this file may be used under the terms of
|
||||
// either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
// the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
// in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
// of those above. If you wish to allow use of your version of this file only
|
||||
// under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
// use your version of this file under the terms of the MPL, indicate your
|
||||
// decision by deleting the provisions above and replace them with the notice
|
||||
// and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
// the provisions above, a recipient may use your version of this file under
|
||||
// the terms of any one of the MPL, the GPL or the LGPL.
|
||||
//
|
||||
// ***** END LICENSE BLOCK *****
|
||||
?>
|
||||
<?php
|
||||
require"../core/config.php";
|
||||
?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html401/loose.dtd">
|
||||
<html lang="EN" dir="ltr">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
||||
<meta http-equiv="Content-Language" content="en">
|
||||
<TITLE>Mozilla Update :: Frequently Asked Questions</TITLE>
|
||||
|
||||
<LINK REL="STYLESHEET" TYPE="text/css" HREF="/core/update.css">
|
||||
</HEAD>
|
||||
<BODY>
|
||||
<?php
|
||||
include"$page_header";
|
||||
?>
|
||||
<DIV class="faqtitle">Frequently Asked Questions</DIV>
|
||||
|
||||
<?php
|
||||
$sql = "SELECT `title`, `text` FROM `t_faq` WHERE `active` = 'YES' ORDER BY `index` ASC, `title` ASC";
|
||||
$sql_result = mysql_query($sql, $connection) or trigger_error("MySQL Error ".mysql_errno().": ".mysql_error()."", E_USER_NOTICE);
|
||||
while ($row = mysql_fetch_array($sql_result)) {
|
||||
$title = $row["title"];
|
||||
$text = nl2br($row["text"]);
|
||||
|
||||
echo"<DIV class=\"item\">\n";
|
||||
echo"<DIV class=\"boxheader faqitemtitle\">$title</DIV>\n";
|
||||
echo"<DIV class=\"faqitemtext\">$text</DIV>\n";
|
||||
echo"</DIV>\n";
|
||||
}
|
||||
?>
|
||||
|
||||
<?php
|
||||
include"$page_footer";
|
||||
?>
|
||||
</BODY>
|
||||
</HTML>
|
||||
|
Before Width: | Height: | Size: 181 B |
|
Before Width: | Height: | Size: 1.9 KiB |
|
Before Width: | Height: | Size: 1.8 KiB |
|
Before Width: | Height: | Size: 29 KiB |
|
Before Width: | Height: | Size: 2.6 KiB |
|
Before Width: | Height: | Size: 1.3 KiB |
|
Before Width: | Height: | Size: 1.7 KiB |
|
Before Width: | Height: | Size: 1.5 KiB |
|
Before Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 11 KiB |
|
Before Width: | Height: | Size: 913 B |
|
Before Width: | Height: | Size: 242 B |
|
Before Width: | Height: | Size: 19 KiB |
|
Before Width: | Height: | Size: 16 KiB |
|
Before Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 484 B |
|
Before Width: | Height: | Size: 820 B |
|
Before Width: | Height: | Size: 616 B |
|
Before Width: | Height: | Size: 628 B |
|
Before Width: | Height: | Size: 654 B |
|
Before Width: | Height: | Size: 666 B |
|
Before Width: | Height: | Size: 692 B |
|
Before Width: | Height: | Size: 702 B |
|
Before Width: | Height: | Size: 706 B |
|
Before Width: | Height: | Size: 712 B |
|
Before Width: | Height: | Size: 726 B |
|
Before Width: | Height: | Size: 837 B |
|
Before Width: | Height: | Size: 2.3 KiB |
|
Before Width: | Height: | Size: 2.2 KiB |
|
Before Width: | Height: | Size: 2.2 KiB |
|
Before Width: | Height: | Size: 2.1 KiB |
|
Before Width: | Height: | Size: 2.3 KiB |
|
Before Width: | Height: | Size: 2.2 KiB |
|
Before Width: | Height: | Size: 2.5 KiB |
|
Before Width: | Height: | Size: 2.4 KiB |
|
Before Width: | Height: | Size: 34 KiB |
|
Before Width: | Height: | Size: 1.9 KiB |