git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@2315
7612ce4b-ef26-0410-bec9-
ea0150e637f0
distributed in packages. Conf.pl now also reports when saving fails.
- Attachment hooks now also allow specification of generic rules like
text/* which will be used when no specific rule is available.
distributed in packages. Conf.pl now also reports when saving fails.
- Attachment hooks now also allow specification of generic rules like
text/* which will be used when no specific rule is available.
- - Fixed conf.pl to preserve any value $addrbook_dsn may have when it
- rewrites the config.php
+ - conf.pl can now configure database backed address books.
Version 1.2.4 -- 25 January 2002
--------------------------------
Version 1.2.4 -- 25 January 2002
--------------------------------
print "R Return to Main Menu\n";
} elsif ($menu == 9) {
print $WHT."Database\n".$NRM;
print "R Return to Main Menu\n";
} elsif ($menu == 9) {
print $WHT."Database\n".$NRM;
- print "1. DSN for Address Book : $WHT$addrbook_dsn$NRM\n";
+ print "1. DSN for Address Book : $WHT$addrbook_dsn$NRM\n";
+ print "2. Table for Address Book : $WHT$addrbook_table$NRM\n";
print "\n";
print "S Save data\n";
print "R Return to Main Menu\n";
print "\n";
print "S Save data\n";
print "R Return to Main Menu\n";
if ($command =~ /^[0-9]+/) { @plugins = command81(); }
elsif ($command eq "a") { command8s(); }
} elsif ($menu == 9) {
if ($command =~ /^[0-9]+/) { @plugins = command81(); }
elsif ($command eq "a") { command8s(); }
} elsif ($menu == 9) {
- if ($command == 1) { $addrbook_dsn = command91(); }
+ if ($command == 1) { $addrbook_dsn = command91(); }
+ elsif ($command == 2) { $addrbook_table = command92(); }
+sub command92 {
+ print "This is the name of the table you want to store the address book\n";
+ print "data in, it defaults to 'address'\n";
+ print "\n";
+ print "[$WHT$addrbook_table$NRM]: $WHT";
+ $new_table = <STDIN>;
+ if ($new_table eq "\n") {
+ $new_table = $addrbook_table;
+ } else {
+ $new_table =~ s/[\r|\n]//g;
+ }
+ return $new_table;
+}
+
sub save_data {
$tab = " ";
if(open (CF, ">config.php"))
sub save_data {
$tab = " ";
if(open (CF, ">config.php"))
- print CF "global \$addrbook_dsn;\n";
- print CF "\$addrbook_dsn = '$addrbook_dsn';\n\n";
+ print CF "\nglobal \$addrbook_dsn, \$addrbook_table;\n";
+ print CF "\$addrbook_dsn = '$addrbook_dsn';\n";
+ print CF "\$addrbook_table = '$addrbook_table';\n\n";
print CF "/**\n";
print CF " * Make sure there are no characters after the PHP closing\n";
print CF "/**\n";
print CF " * Make sure there are no characters after the PHP closing\n";
* Database-driven private addressbooks
* DSN (Data Source Name) for a database where the private
* addressbooks are stored. See doc/db-backend.txt for more info.
* Database-driven private addressbooks
* DSN (Data Source Name) for a database where the private
* addressbooks are stored. See doc/db-backend.txt for more info.
- * If it is not defined, the addressbooks are stored in files
+ * If it is not set, the addressbooks are stored in files
* in the data dir.
* The DSN is in the format: mysql://user:pass@hostname/dbname
* in the data dir.
* The DSN is in the format: mysql://user:pass@hostname/dbname
+ * The table is the name of the table to use within the
+ * specified database.
+global $addrbook_dsn, $addrbook_table;
+$addrbook_table = 'address';
/**
* Users may search their addressbook via either a plain HTML or Javascript
/**
* Users may search their addressbook via either a plain HTML or Javascript
-Next, edit config/config.php and add a DSN (Data Source Name) for the
-database. It should look something like:
+Next, edit your configuration so that the address book DSN (Data Source
+Name) is specified, this can be done using either conf.pl or via the
+administration plugin. The DSN should look something like:
$addrbook_dsn = 'mysql://squirreluser:sqpassword@localhost/squirrelmail';
$addrbook_dsn = 'mysql://squirreluser:sqpassword@localhost/squirrelmail';
*/
function addressbook_init($showerr = true, $onlylocal = false) {
global $data_dir, $username, $ldap_server, $address_book_global_filename;
*/
function addressbook_init($showerr = true, $onlylocal = false) {
global $data_dir, $username, $ldap_server, $address_book_global_filename;
+ global $addrbook_dsn, $addrbook_table;
/* Create a new addressbook object */
$abook = new AddressBook;
/* Create a new addressbook object */
$abook = new AddressBook;
*/
if (isset($addrbook_dsn) && !empty($addrbook_dsn)) {
/* Database */
*/
if (isset($addrbook_dsn) && !empty($addrbook_dsn)) {
/* Database */
+ if (!isset($addrbook_table) || isempty($addrbook_table)) {
+ $addrbook_table = 'address';
+ }
$r = $abook->add_backend('database', Array('dsn' => $addrbook_dsn,
'owner' => $username,
$r = $abook->add_backend('database', Array('dsn' => $addrbook_dsn,
'owner' => $username,
- 'table' => 'address'));
+ 'table' => $addrbook_table));
if (!$r && $showerr) {
echo _("Error initializing addressbook database.");
exit;
if (!$r && $showerr) {
echo _("Error initializing addressbook database.");
exit;
'$addrbook_dsn' => array( 'name' => _("Address book DSN"),
'type' => SMOPT_TYPE_STRING,
'size' => 40 ),
'$addrbook_dsn' => array( 'name' => _("Address book DSN"),
'type' => SMOPT_TYPE_STRING,
'size' => 40 ),
+ '$addrbook_table' => array( 'name' => _("Address book table"),
+ 'type' => SMOPT_TYPE_STRING,
+ 'size' => 40 ),
/* --------------------------------------------------------*/
'Group7' => array( 'name' => _("Themes"),
'type' => SMOPT_TYPE_TITLE ),
/* --------------------------------------------------------*/
'Group7' => array( 'name' => _("Themes"),
'type' => SMOPT_TYPE_TITLE ),
-?>
\ No newline at end of file