Revision: 1171
http://mrbs.svn.sourceforge.net/mrbs/?rev=1171&view=rev
Author: cimorrison
Date: 2009-08-11 12:33:38 +0000 (Tue, 11 Aug 2009)
Log Message:
-----------
- Changed the constants in systemdefaults.inc.php to variables, as constants
can only be defined once, meaning they cannot be redefined in config.inc.php
(IS_XHTML should remain a constant though as that is not intended to be
redefined in config.inc.php)
- Resolved the Catch-22 (reported by Thomas Bleher on the mailing list) which
prevented language settings from being defined in config.inc.php
Modified Paths:
--------------
mrbs/trunk/web/config.inc.php
mrbs/trunk/web/del_entry.php
mrbs/trunk/web/edit_entry_handler.php
mrbs/trunk/web/functions_mail.inc
mrbs/trunk/web/language.inc
mrbs/trunk/web/systemdefaults.inc.php
mrbs/trunk/web/theme.inc
Modified: mrbs/trunk/web/config.inc.php
===================================================================
--- mrbs/trunk/web/config.inc.php 2009-08-05 22:36:05 UTC (rev 1170)
+++ mrbs/trunk/web/config.inc.php 2009-08-11 12:33:38 UTC (rev 1171)
@@ -43,5 +43,41 @@
/* Add lines from systemdefaults.inc.php here to change the default
configuration. Do _NOT_ modify systemdefaults.inc.php. */
+
+
+
+
+// This next section must come at the end of the config file - ie after any
+// language and mail settings, as the definitions are used in the included file
+require_once "language.inc";
+
+/*************
+ * Entry Types
+ *************/
+
+// This array maps entry type codes (letters A through J) into descriptions.
+//
+// Each type has a color which is defined in the array $color_types in the
Themes
+// directory - just edit whichever include file corresponds to the theme you
+// have chosen in the config settings. (The default is default.inc,
unsurprisingly!)
+//
+// The value for each type is a short (one word is best) description of the
+// type. The values must be escaped for HTML output ("R&D").
+// Please leave I and E alone for compatibility.
+// If a type's entry is unset or empty, that type is not defined; it will not
+// be shown in the day view color-key, and not offered in the type selector
+// for new or edited entries.
+
+// $typel["A"] = "A";
+// $typel["B"] = "B";
+// $typel["C"] = "C";
+// $typel["D"] = "D";
+$typel["E"] = get_vocab("external");
+// $typel["F"] = "F";
+// $typel["G"] = "G";
+// $typel["H"] = "H";
+$typel["I"] = get_vocab("internal");
+// $typel["J"] = "J";
+
?>
Modified: mrbs/trunk/web/del_entry.php
===================================================================
--- mrbs/trunk/web/del_entry.php 2009-08-05 22:36:05 UTC (rev 1170)
+++ mrbs/trunk/web/del_entry.php 2009-08-11 12:33:38 UTC (rev 1171)
@@ -37,7 +37,7 @@
$year = strftime("%Y", $info["start_time"]);
$area = mrbsGetRoomArea($info["room_id"]);
- if (MAIL_ADMIN_ON_DELETE)
+ if ($mail_settings['admin_on_delete'])
{
require_once "functions_mail.inc";
// Gather all fields values for use in emails.
@@ -49,7 +49,7 @@
if ($result)
{
// Send a mail to the Administrator
- (MAIL_ADMIN_ON_DELETE) ? $result = notifyAdminOnDelete($mail_previous) :
'';
+ ($mail_settings['admin_on_delete']) ? $result =
notifyAdminOnDelete($mail_previous) : '';
Header("Location: $returl");
exit();
}
Modified: mrbs/trunk/web/edit_entry_handler.php
===================================================================
--- mrbs/trunk/web/edit_entry_handler.php 2009-08-05 22:36:05 UTC (rev
1170)
+++ mrbs/trunk/web/edit_entry_handler.php 2009-08-11 12:33:38 UTC (rev
1171)
@@ -441,20 +441,20 @@
isset($rep_num_weeks) ?
$rep_num_weeks : 0,
$isprivate);
// Send a mail to the Administrator
- if (MAIL_ADMIN_ON_BOOKINGS or MAIL_AREA_ADMIN_ON_BOOKINGS or
- MAIL_ROOM_ADMIN_ON_BOOKINGS or MAIL_BOOKER)
+ if ($mail_settings['admin_on_bookings'] or
$mail_settings['area_admin_on_bookings'] or
+ $mail_settings['room_admin_on_bookings'] or $mail_settings['booker'])
{
require_once "functions_mail.inc";
// Send a mail only if this a new entry, or if this is an
// edited entry but we have to send mail on every change,
// and if mrbsCreateRepeatingEntrys is successful
- if ( ( (isset($id) && MAIL_ADMIN_ALL) or !isset($id) ) &&
+ if ( ( (isset($id) && $mail_settings['admin_all']) or !isset($id) ) &&
(0 != $new_id) )
{
// Get room name and area name. Would be better to avoid
// a database access just for that. Ran only if we need
// details
- if (MAIL_DETAILS)
+ if ($mail_settings['details'])
{
$sql = "SELECT r.id AS room_id, r.room_name, r.area_id,
a.area_name ";
$sql .= "FROM $tbl_room r, $tbl_area a ";
@@ -499,19 +499,19 @@
$isprivate);
// Send a mail to the Administrator
- if (MAIL_ADMIN_ON_BOOKINGS or MAIL_AREA_ADMIN_ON_BOOKINGS or
- MAIL_ROOM_ADMIN_ON_BOOKINGS or MAIL_BOOKER)
+ if ($mail_settings['admin_on_bookings'] or
$mail_settings['area_admin_on_bookings'] or
+ $mail_settings['room_admin_on_bookings'] or $mail_settings['booker'])
{
require_once "functions_mail.inc";
// Send a mail only if this a new entry, or if this is an
// edited entry but we have to send mail on every change,
// and if mrbsCreateRepeatingEntrys is successful
- if ( ( (isset($id) && MAIL_ADMIN_ALL) or !isset($id) ) && (0 !=
$new_id) )
+ if ( ( (isset($id) && $mail_settings['admin_all']) or !isset($id) ) &&
(0 != $new_id) )
{
// Get room name and are name. Would be better to avoid
// a database access just for that. Ran only if we need
// details.
- if (MAIL_DETAILS)
+ if ($mail_settings['details'])
{
$sql = "SELECT r.id AS room_id, r.room_name, r.area_id,
a.area_name ";
$sql .= "FROM $tbl_room r, $tbl_area a ";
Modified: mrbs/trunk/web/functions_mail.inc
===================================================================
--- mrbs/trunk/web/functions_mail.inc 2009-08-05 22:36:05 UTC (rev 1170)
+++ mrbs/trunk/web/functions_mail.inc 2009-08-11 12:33:38 UTC (rev 1171)
@@ -150,12 +150,13 @@
global $rep_opt, $rep_num_weeks;
global $tbl_room, $tbl_area, $tbl_entry, $tbl_users, $tbl_repeat;
global $mail_previous, $auth;
+ global $mail_settings;
//
$recipients = '';
$id_table = ($rep_type > 0) ? "rep" : "e";
- (MAIL_ADMIN_ON_BOOKINGS) ? $recipients = MAIL_RECIPIENTS : '';
- if (MAIL_AREA_ADMIN_ON_BOOKINGS)
+ ($mail_settings['admin_on_bookings']) ? $recipients =
$mail_settings['recipients'] : '';
+ if ($mail_settings['area_admin_on_bookings'])
{
// Look for list of area admins emails addresses
if ($new_entry)
@@ -195,7 +196,7 @@
}
}
}
- if (MAIL_ROOM_ADMIN_ON_BOOKINGS)
+ if ($mail_settings['room_admin_on_bookings'])
{
// Look for list of room admins emails addresses
if ($new_entry)
@@ -235,7 +236,7 @@
}
}
}
- if (MAIL_BOOKER)
+ if ($mail_settings['booker'])
{
if ('db' == $auth['type'])
{
@@ -270,8 +271,8 @@
}
if ('' != $create_by)
{
- $recipients .= str_replace(MAIL_USERNAME_SUFFIX, '',
- $create_by) . MAIL_DOMAIN;
+ $recipients .= str_replace($mail_settings['username_suffix'], '',
+ $create_by) . $mail_settings['domain'];
}
}
else
@@ -282,8 +283,8 @@
}
if ('' != $mail_previous['createdby'])
{
- $recipients .= str_replace(MAIL_USERNAME_SUFFIX, '',
- $mail_previous['createdby']) .
MAIL_DOMAIN;
+ $recipients .= str_replace($mail_settings['username_suffix'], '',
+ $mail_previous['createdby']) .
$mail_settings['domain'];
}
}
}
@@ -319,7 +320,7 @@
}
$body .= "\n";
// Displays/don't displays entry details
- if (MAIL_DETAILS)
+ if ($mail_settings['details'])
{
$body .= "\n" . get_mail_vocab("namebooker") . ": ";
$body .= compareEntries(convertToMailCharset($name),
@@ -489,7 +490,7 @@
$subject,
$body,
get_mail_charset(),
- MAIL_CC);
+ $mail_settings['cc']);
return $result;
}
@@ -505,10 +506,11 @@
function notifyAdminOnDelete($mail_previous)
{
global $typel, $enable_periods, $auth, $tbl_users;
+ global $mail_settings;
//
$recipients = '';
- (MAIL_ADMIN_ON_BOOKINGS) ? $recipients = MAIL_RECIPIENTS : '';
- if (MAIL_AREA_ADMIN_ON_BOOKINGS)
+ ($mail_settings['admin_on_bookings']) ? $recipients =
$mail_settings['recipients'] : '';
+ if ($mail_settings['area_admin_on_bookings'])
{
if ( !empty($recipients) && ('' != $mail_previous['area_admin_email']) )
{
@@ -519,7 +521,7 @@
$recipients .= $mail_previous['area_admin_email'];
}
}
- if (MAIL_ROOM_ADMIN_ON_BOOKINGS)
+ if ($mail_settings['room_admin_on_bookings'])
{
if ( !empty($recipients) && ('' != $mail_previous['room_admin_email']) )
{
@@ -530,7 +532,7 @@
$recipients .= $mail_previous['room_admin_email'];
}
}
- if (MAIL_BOOKER)
+ if ($mail_settings['booker'])
{
if ('db' == $auth['type'])
{
@@ -563,8 +565,8 @@
}
if ('' != $mail_previous['createdby'])
{
- $recipients .= str_replace(MAIL_USERNAME_SUFFIX, '',
- $mail_previous['createdby']) . MAIL_DOMAIN;
+ $recipients .= str_replace($mail_settings['username_suffix'], '',
+ $mail_previous['createdby']) .
$mail_settings['domain'];
}
}
}
@@ -634,7 +636,7 @@
}
$body .= "\n";
// End of mail details
- $result = sendMail($recipients, $subject, $body, get_mail_charset(),
MAIL_CC);
+ $result = sendMail($recipients, $subject, $body, get_mail_charset(),
$mail_settings['cc']);
return $result;
}
@@ -906,14 +908,24 @@
* @param string $password smtp server password
* @return bool TRUE or PEAR error object if fails
*/
-function sendMail($recipients, $subject, $body, $charset = 'us-ascii',
- $cc = NULL, $bcc = NULL, $from = MAIL_FROM, $backend = MAIL_ADMIN_BACKEND,
- $sendmail_path = SENDMAIL_PATH, $sendmail_args = SENDMAIL_ARGS,
- $host = SMTP_HOST, $port = SMTP_PORT, $auth = SMTP_AUTH,
- $username = SMTP_USERNAME, $password = SMTP_PASSWORD)
+function sendMail($recipients, $subject, $body,
+ $charset = 'us-ascii', $cc = NULL, $bcc = NULL)
{
require_once "Mail.php";
+ global $mail_settings, $sendmail_settings, $smtp_settings;
+
+ // Set up configuration settings
+ $from = $mail_settings['from'];
+ $backend = $mail_settings['admin_backend'];
+ $sendmail_path = $sendmail_settings['path'];
+ $sendmail_args = $sendmail_settings['args'];
+ $host = $smtp_settings['host'];
+ $port = $smtp_settings['port'];
+ $auth = $smtp_settings['auth'];
+ $username = $smtp_settings['username'];
+ $password = $smtp_settings['password'];
+
$params = array(); // to avoid an undefined variable message
// Headers part
Modified: mrbs/trunk/web/language.inc
===================================================================
--- mrbs/trunk/web/language.inc 2009-08-05 22:36:05 UTC (rev 1170)
+++ mrbs/trunk/web/language.inc 2009-08-11 12:33:38 UTC (rev 1171)
@@ -329,11 +329,11 @@
// Language token handling
// Get first default set of language tokens for emails.
-if (MAIL_ADMIN_ON_BOOKINGS or MAIL_AREA_ADMIN_ON_BOOKINGS or
- MAIL_ROOM_ADMIN_ON_BOOKINGS or MAIL_BOOKER)
+if ($mail_settings['admin_on_bookings'] or
$mail_settings['area_admin_on_bookings'] or
+ $mail_settings['room_admin_on_bookings'] or $mail_settings['booker'])
{
include "lang." . $default_language_tokens;
- include "lang." . MAIL_ADMIN_LANG;
+ include "lang." . $mail_settings['admin_lang'];
$mail_vocab = $vocab;
unset ($vocab);
}
Modified: mrbs/trunk/web/systemdefaults.inc.php
===================================================================
--- mrbs/trunk/web/systemdefaults.inc.php 2009-08-05 22:36:05 UTC (rev
1170)
+++ mrbs/trunk/web/systemdefaults.inc.php 2009-08-11 12:33:38 UTC (rev
1171)
@@ -59,7 +59,7 @@
* Site identification information
*********************************/
$mrbs_admin = "Your Administrator";
-$mrbs_admin_email = "[email protected]";
+$mrbs_admin_email = "[email protected]"; // NOTE: there are more email
addresses in $mail_settings below
// The company name is mandatory. It is used in the header and also for
email notifications.
// The company logo, additional information and URL are all optional.
@@ -548,61 +548,61 @@
// Set to TRUE if you want to be notified when entries are booked. Default is
// FALSE
-define ("MAIL_ADMIN_ON_BOOKINGS", FALSE);
+$mail_settings['admin_on_bookings'] = FALSE;
// Set to TRUE if you want AREA ADMIN to be notified when entries are booked.
// Default is FALSE. Area admin emails are set in room_area admin page.
-define ("MAIL_AREA_ADMIN_ON_BOOKINGS", FALSE);
+$mail_settings['area_admin_on_bookings'] = FALSE;
// Set to TRUE if you want ROOM ADMIN to be notified when entries are booked.
// Default is FALSE. Room admin emails are set in room_area admin page.
-define ("MAIL_ROOM_ADMIN_ON_BOOKINGS", FALSE);
+$mail_settings['room_admin_on_bookings'] = FALSE;
// Set to TRUE if you want ADMIN to be notified when entries are deleted. Email
// will be sent to mrbs admin, area admin and room admin as per above settings,
-// as well as to booker if MAIL_BOOKER is TRUE (see below).
-define ("MAIL_ADMIN_ON_DELETE", FALSE);
+// as well as to booker if 'booker' is TRUE (see below).
+$mail_settings['admin_on_delete'] = FALSE;
// Set to TRUE if you want to be notified on every change (i.e, on new entries)
// but also each time they are edited. Default is FALSE (only new entries)
-define ("MAIL_ADMIN_ALL", FALSE);
+$mail_settings['admin_all'] = FALSE;
// Set to TRUE is you want to show entry details in email, otherwise only a
// link to view_entry is provided. Irrelevant for deleted entries. Default is
// FALSE.
-define ("MAIL_DETAILS", FALSE);
+$mail_settings['details'] = FALSE;
// Set to TRUE if you want BOOKER to receive a copy of his entries as well any
-// changes (depends of MAIL_ADMIN_ALL, see below). Default is FALSE. To know
+// changes (depends on 'admin_all', see below). Default is FALSE. To know
// how to set mrbs to send emails to users/bookers, see INSTALL.
-define ("MAIL_BOOKER", FALSE);
+$mail_settings['booker'] = FALSE;
-// If MAIL_BOOKER is set to TRUE (see above) and you use an authentication
+// If 'booker' is set to TRUE (see above) and you use an authentication
// scheme other than 'auth_db', you need to provide the mail domain that will
// be appended to the username to produce a valid email address (ie.
// "@domain.com").
-define ("MAIL_DOMAIN", '');
+$mail_settings['domain'] = '';
-// If you use MAIL_DOMAIN above and username returned by mrbs contains extra
+// If you use $mail_settings['domain'] above and username returned by mrbs
contains extra
// strings appended like domain name ('username.domain'), you need to provide
// this extra string here so that it will be removed from the username.
-define ("MAIL_USERNAME_SUFFIX", '');
+$mail_settings['username_suffix'] = '';
-// Set the name of the Backend used to transport your mails. Either "mail",
-// "smtp" or "sendmail". Default is 'mail'. See INSTALL for more details.
-define ("MAIL_ADMIN_BACKEND", "mail");
+// Set the name of the Backend used to transport your mails. Either 'mail',
+// 'smtp' or 'sendmail'. Default is 'mail'. See INSTALL for more details.
+$mail_settings['admin_backend'] = 'mail';
/*******************
* Sendmail settings
*/
// Set the path of the Sendmail program (only used with "sendmail" backend).
-// Default is "/usr/bin/sendmail"
-define ("SENDMAIL_PATH", "/usr/bin/sendmail");
+// Default is '/usr/bin/sendmail'
+$sendmail_settings['path'] = '/usr/bin/sendmail';
// Set additional Sendmail parameters (only used with "sendmail" backend).
-// (example "-t -i"). Default is ""
-define ("SENDMAIL_ARGS", '');
+// (example "-t -i"). Default is ''
+$sendmail_settings['args'] = '';
/*******************
* SMTP settings
@@ -610,19 +610,19 @@
// Set smtp server to connect. Default is 'localhost' (only used with "smtp"
// backend).
-define ("SMTP_HOST", "localhost");
+$smtp_settings['host'] = 'localhost';
// Set smtp port to connect. Default is '25' (only used with "smtp" backend).
-define ("SMTP_PORT", 25);
+$smtp_settings['port'] = 25;
// Set whether or not to use SMTP authentication. Default is 'FALSE'
-define ("SMTP_AUTH", FALSE);
+$smtp_settings['auth'] = FALSE;
-// Set the username to use for SMTP authentication. Default is ""
-define ("SMTP_USERNAME", '');
+// Set the username to use for SMTP authentication. Default is ''
+$smtp_settings['username'] = '';
-// Set the password to use for SMTP authentication. Default is ""
-define ("SMTP_PASSWORD", '');
+// Set the password to use for SMTP authentication. Default is ''
+$smtp_settings['password'] = '';
/**********************
* Miscellaneous settings
@@ -630,22 +630,22 @@
// Set the language used for emails (choose an available lang.* file).
// Default is 'en'.
-define ("MAIL_ADMIN_LANG", 'en');
+$mail_settings['admin_lang'] = 'en';
-// Set the email address of the From field. Default is $mrbs_admin_email
-define ("MAIL_FROM", $mrbs_admin_email);
+// Set the email address of the From field. Default is '[email protected]'
+$mail_settings['from'] = '[email protected]';
-// Set the recipient email. Default is $mrbs_admin_email. You can define
+// Set the recipient email. Default is '[email protected]'. You can define
// more than one recipient like this "[email protected],[email protected]"
-define ("MAIL_RECIPIENTS", $mrbs_admin_email);
+$mail_settings['recipients'] = '[email protected]';
// Set email address of the Carbon Copy field. Default is ''. You can define
-// more than one recipient (see MAIL_RECIPIENTS)
-define ("MAIL_CC", '');
+// more than one recipient (see 'recipients')
+$mail_settings['cc'] = '';
/**********
* Language
- *&********/
+ **********/
// Set this to 1 to use UTF-8 in all pages and in the database, otherwise
// text gets entered in the database in different encodings, dependent
@@ -675,9 +675,6 @@
// use "_fr"
$faqfilelang = "";
-// This next require must be done after the definitions above, as the
definitions
-// are used in the included file
-require_once "language.inc";
/*************
* Entry Types
@@ -685,6 +682,11 @@
// This array maps entry type codes (letters A through J) into descriptions.
//
+// This is a basic default array which ensures there are at least some types
defined.
+// The proper type definitions should be made in config.inc.php: they have to
go there
+// because they use get_vocab which requires language.inc which uses settings
which might
+// be made in config.inc.php.
+//
// Each type has a color which is defined in the array $color_types in the
Themes
// directory - just edit whichever include file corresponds to the theme you
// have chosen in the config settings. (The default is default.inc,
unsurprisingly!)
@@ -700,11 +702,11 @@
// $typel["B"] = "B";
// $typel["C"] = "C";
// $typel["D"] = "D";
-$typel["E"] = get_vocab("external");
+$typel["E"] = "E";
// $typel["F"] = "F";
// $typel["G"] = "G";
// $typel["H"] = "H";
-$typel["I"] = get_vocab("internal");
+$typel["I"] = "I";
// $typel["J"] = "J";
Modified: mrbs/trunk/web/theme.inc
===================================================================
--- mrbs/trunk/web/theme.inc 2009-08-05 22:36:05 UTC (rev 1170)
+++ mrbs/trunk/web/theme.inc 2009-08-11 12:33:38 UTC (rev 1171)
@@ -5,6 +5,7 @@
// Gets the styling appropriate to the theme. If there isn't a styling file
// present for the theme then the default styling is used.
+require_once "systemdefaults.inc.php";
require_once "config.inc.php";
require_once "Themes/default/styling.inc";
@include_once "Themes/$theme/styling.inc"; // overwrite the default with the
specified styling if it exists
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now. http://p.sf.net/sfu/bobj-july
_______________________________________________
Mrbs-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mrbs-commits