// Constructor
function abook_database($param) {
- $this->sname = _('Personal address book');
+ $this->sname = _("Personal address book");
if(is_array($param)) {
if(empty($param['dsn']) ||
$dbh = DB::connect($this->dsn, true);
if(DB::isError($dbh) || DB::isWarning($dbh))
- return $this->set_error(sprintf(_('Database error: %s'),
+ return $this->set_error(sprintf(_("Database error: %s"),
DB::errorMessage($dbh)));
$this->dbh = $dbh;
$res = $this->dbh->query($query);
if(DB::isError($res))
- return $this->set_error(sprintf(_('Database error: %s'),
+ return $this->set_error(sprintf(_("Database error: %s"),
DB::errorMessage($res)));
while ($row = $res->fetchRow(DB_FETCHMODE_ASSOC)) {
$res = $this->dbh->query($query);
if(DB::isError($res))
- return $this->set_error(sprintf(_('Database error: %s'),
+ return $this->set_error(sprintf(_("Database error: %s"),
DB::errorMessage($res)));
if ($row = $res->fetchRow(DB_FETCHMODE_ASSOC)) {
$res = $this->dbh->query($query);
if(DB::isError($res))
- return $this->set_error(sprintf(_('Database error: %s'),
+ return $this->set_error(sprintf(_("Database error: %s"),
DB::errorMessage($res)));
while ($row = $res->fetchRow(DB_FETCHMODE_ASSOC)) {
// Add address
function add($userdata) {
if(!$this->writeable)
- return $this->set_error(_('Addressbook is read-only'));
+ return $this->set_error(_("Addressbook is read-only"));
if(!$this->open())
return false;
// See if user exist already
$ret = $this->lookup($userdata['nickname']);
if(!empty($ret))
- return $this->set_error(sprintf(_('User \'%s\' already exist'),
+ return $this->set_error(sprintf(_((User \'%s\' already exist"),
$ret['nickname']));
// Create query
if($r == DB_OK) return true;
// Fail
- return $this->set_error(sprintf(_('Database error: %s'),
+ return $this->set_error(sprintf(_("Database error: %s"),
DB::errorMessage($r)));
}
// Delete address
function remove($alias) {
if(!$this->writeable)
- return $this->set_error(_('Addressbook is read-only'));
+ return $this->set_error(_("Addressbook is read-only"));
if(!$this->open())
return false;
if($r == DB_OK) return true;
// Fail
- return $this->set_error(sprintf(_('Database error: %s'),
+ return $this->set_error(sprintf(_("Database error: %s"),
DB::errorMessage($r)));
}
// Modify address
function modify($alias, $userdata) {
if(!$this->writeable)
- return $this->set_error(_('Addressbook is read-only'));
+ return $this->set_error(_("Addressbook is read-only"));
if(!$this->open())
return false;
// See if user exist
$ret = $this->lookup($alias);
if(empty($ret))
- return $this->set_error(sprintf(_('User \'%s\' does not exist'),
+ return $this->set_error(sprintf(_("User '%s' does not exist"),
$alias));
// Create query
if($r == DB_OK) return true;
// Fail
- return $this->set_error(sprintf(_('Database error: %s'),
+ return $this->set_error(sprintf(_("Database error: %s"),
DB::errorMessage($r)));
}
} // End of class abook_database
// Constructor
function abook_local_file($param) {
- $this->sname = _('Personal address book');
+ $this->sname = _("Personal address book");
$this->umask = Umask();
if(is_array($param)) {
return $this->set_error('Invalid parameters');
if(!is_string($param['filename']))
return $this->set_error($param['filename'] . ': '.
- _('Not a file name'));
+ _("Not a file name"));
$this->filename = $param['filename'];
// Check that new file exitsts
if((!(file_exists($file) && is_readable($file))) && !$create)
- return $this->set_error("$file: " . _('No such file or directory'));
+ return $this->set_error("$file: " . _("No such file or directory"));
// Close old file, if any
if($this->filehandle) $this->close();
$this->filename = $file;
$this->writeable = false;
} else {
- return $this->set_error("$file: " . _('Open failed'));
+ return $this->set_error("$file: " . _("Open failed"));
}
}
function overwrite($rows) {
$newfh = @fopen($this->filename, 'w');
if(!$newfh)
- return $this->set_error("$file: " . _('Open failed'));
+ return $this->set_error("$file: " . _("Open failed"));
for($i = 0 ; $i < sizeof($rows) ; $i++) {
if(is_array($rows[$i]))
// Add address
function add($userdata) {
if(!$this->writeable)
- return $this->set_error(_('Addressbook is read-only'));
+ return $this->set_error(_("Addressbook is read-only"));
// See if user exist already
$ret = $this->lookup($userdata['nickname']);
if(!empty($ret))
- return $this->set_error(sprintf(_('User \'%s\' already exist'),
+ return $this->set_error(sprintf(_("User '%s' already exist"),
$ret['nickname']));
// Here is the data to write
// Reopen file, just to be sure
$this->open(true);
if(!$this->writeable)
- return $this->set_error(_('Addressbook is read-only'));
+ return $this->set_error(_("Addressbook is read-only"));
// Lock the file
if(!$this->lock())
- return $this->set_error(_('Could not lock datafile'));
+ return $this->set_error(_("Could not lock datafile"));
// Write
$r = fwrite($this->filehandle, $data);
if($r > 0) return true;
// Fail
- $this->set_error(_('Write to addressbook failed'));
+ $this->set_error(_("Write to addressbook failed"));
return false;
}
// Delete address
function remove($alias) {
if(!$this->writeable)
- return $this->set_error(_('Addressbook is read-only'));
+ return $this->set_error(_("Addressbook is read-only"));
// Lock the file to make sure we're the only process working
// on it.
if(!$this->lock())
- return $this->set_error(_('Could not lock datafile'));
+ return $this->set_error(_("Could not lock datafile"));
// Read file into memory, ignoring nicknames to delete
$this->open();
// Modify address
function modify($alias, $userdata) {
if(!$this->writeable)
- return $this->set_error(_('Addressbook is read-only'));
+ return $this->set_error(_("Addressbook is read-only"));
// See if user exist
$ret = $this->lookup($alias);
if(empty($ret))
- return $this->set_error(sprintf(_('User \'%s\' does not exist'),
+ return $this->set_error(sprintf(_("User '%s' does not exist"),
$alias));
// Lock the file to make sure we're the only process working
// on it.
if(!$this->lock())
- return $this->set_error(_('Could not lock datafile'));
+ return $this->set_error(_("Could not lock datafile"));
// Read file into memory, modifying the data for the
// user identifyed by $alias
$header = new small_header;
if ($sent == true)
- $header->from = (trim($to) != '')? $to : _('(only Cc/Bcc)');
+ $header->from = (trim($to) != '')? $to : _("(only Cc/Bcc)");
else
$header->from = $from;
$body .= "<TABLE WIDTH=100% CELLSPACING=0 CELLPADDING=2 BORDER=0 BGCOLOR=\"$color[0]\"><TR>\n";
$body .= "<TH ALIGN=\"left\" BGCOLOR=\"$color[9]\"><B>\n";
- $body .= _('Attachments') . ':';
+ $body .= _("Attachments") . ':';
$body .= "</B></TH></TR><TR><TD>\n";
$body .= "<TABLE CELLSPACING=0 CELLPADDING=1 BORDER=0>\n";
"../src/download.php?startMessage=$startMessage&passed_id=$id&mailbox=$urlMailbox&passed_ent_id=$ent";
if ($where && $what)
$DefaultLink .= '&where=' . urlencode($where) . '&what=' . urlencode($what);
- $Links['download link']['text'] = _('download');
+ $Links['download link']['text'] = _("download");
$Links['download link']['href'] =
"../src/download.php?absolute_dl=true&passed_id=$id&mailbox=$urlMailbox&passed_ent_id=$ent";
$ImageURL = '';