mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-19 19:52:48 +00:00
vmail.cgi updates (bug #2686)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@4140 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -120,7 +120,7 @@ sub check_login()
|
|||||||
|
|
||||||
# db variables are present. Use db for authentication.
|
# db variables are present. Use db for authentication.
|
||||||
my $dbh = DBI->connect("DBI:mysql:$dbname:$dbhost",$dbuser,$dbpass);
|
my $dbh = DBI->connect("DBI:mysql:$dbname:$dbhost",$dbuser,$dbpass);
|
||||||
my $sth = $dbh->prepare(qq{select fullname,context from users where mailbox='$mbox' and password='$pass' and context='$context'});
|
my $sth = $dbh->prepare(qq{select fullname,context from voicemail where mailbox='$mbox' and password='$pass' and context='$context'});
|
||||||
$sth->execute();
|
$sth->execute();
|
||||||
if (($fullname, $category) = $sth->fetchrow_array()) {;
|
if (($fullname, $category) = $sth->fetchrow_array()) {;
|
||||||
return ($fullname ? $fullname : "Extension $mbox in $context",$category);
|
return ($fullname ? $fullname : "Extension $mbox in $context",$category);
|
||||||
@@ -184,7 +184,7 @@ sub validmailbox()
|
|||||||
|
|
||||||
# db variables are present. Use db for authentication.
|
# db variables are present. Use db for authentication.
|
||||||
my $dbh = DBI->connect("DBI:mysql:$dbname:$dbhost",$dbuser,$dbpass);
|
my $dbh = DBI->connect("DBI:mysql:$dbname:$dbhost",$dbuser,$dbpass);
|
||||||
my $sth = $dbh->prepare(qq{select fullname,context from users where mailbox='$mbox' and password='$pass' and context='$context'});
|
my $sth = $dbh->prepare(qq{select fullname,context from voicemail where mailbox='$mbox' and password='$pass' and context='$context'});
|
||||||
$sth->execute();
|
$sth->execute();
|
||||||
if (($fullname, $category) = $sth->fetchrow_array()) {;
|
if (($fullname, $category) = $sth->fetchrow_array()) {;
|
||||||
return ($fullname ? $fullname : "unknown", $category);
|
return ($fullname ? $fullname : "unknown", $category);
|
||||||
@@ -242,7 +242,7 @@ sub mailbox_options()
|
|||||||
|
|
||||||
# db variables are present. Use db for authentication.
|
# db variables are present. Use db for authentication.
|
||||||
my $dbh = DBI->connect("DBI:mysql:$dbname:$dbhost",$dbuser,$dbpass);
|
my $dbh = DBI->connect("DBI:mysql:$dbname:$dbhost",$dbuser,$dbpass);
|
||||||
my $sth = $dbh->prepare(qq{select mailbox,fullname,context from users where context='$context' order by mailbox});
|
my $sth = $dbh->prepare(qq{select mailbox,fullname,context from voicemail where context='$context' order by mailbox});
|
||||||
$sth->execute();
|
$sth->execute();
|
||||||
while (($mailbox, $fullname, $category) = $sth->fetchrow_array()) {
|
while (($mailbox, $fullname, $category) = $sth->fetchrow_array()) {
|
||||||
$text = $mailbox;
|
$text = $mailbox;
|
||||||
@@ -719,6 +719,8 @@ sub message_rename()
|
|||||||
}
|
}
|
||||||
|
|
||||||
my $path = "/var/spool/asterisk/voicemail/$context/$mbox/$newfolder";
|
my $path = "/var/spool/asterisk/voicemail/$context/$mbox/$newfolder";
|
||||||
|
$path =~ /^(.*)$/;
|
||||||
|
$path = $1;
|
||||||
mkdir $path, 0770;
|
mkdir $path, 0770;
|
||||||
my $path = "/var/spool/asterisk/voicemail/$context/$mbox/$oldfolder";
|
my $path = "/var/spool/asterisk/voicemail/$context/$mbox/$oldfolder";
|
||||||
opendir(DIR, $path) || die("Unable to open directory\n");
|
opendir(DIR, $path) || die("Unable to open directory\n");
|
||||||
@@ -742,6 +744,10 @@ sub file_copy()
|
|||||||
my ($orig, $new) = @_;
|
my ($orig, $new) = @_;
|
||||||
my $res;
|
my $res;
|
||||||
my $data;
|
my $data;
|
||||||
|
$orig =~ /^(.*)$/;
|
||||||
|
$orig = $1;
|
||||||
|
$new =~ /^(.*)$/;
|
||||||
|
$new = $1;
|
||||||
open(IN, "<$orig") || die("Unable to open '$orig'\n");
|
open(IN, "<$orig") || die("Unable to open '$orig'\n");
|
||||||
open(OUT, ">$new") || DIE("Unable to open '$new'\n");
|
open(OUT, ">$new") || DIE("Unable to open '$new'\n");
|
||||||
while(($res = sysread(IN, $data, 4096)) > 0) {
|
while(($res = sysread(IN, $data, 4096)) > 0) {
|
||||||
@@ -788,8 +794,12 @@ sub message_copy()
|
|||||||
}
|
}
|
||||||
|
|
||||||
my $path = "/var/spool/asterisk/voicemail/$context/$newmbox";
|
my $path = "/var/spool/asterisk/voicemail/$context/$newmbox";
|
||||||
|
$path =~ /^(.*)$/;
|
||||||
|
$path = $1;
|
||||||
mkdir $path, 0770;
|
mkdir $path, 0770;
|
||||||
my $path = "/var/spool/asterisk/voicemail/$context/$newmbox/INBOX";
|
my $path = "/var/spool/asterisk/voicemail/$context/$newmbox/INBOX";
|
||||||
|
$path =~ /^(.*)$/;
|
||||||
|
$path = $1;
|
||||||
mkdir $path, 0770;
|
mkdir $path, 0770;
|
||||||
my $path = "/var/spool/asterisk/voicemail/$context/$mbox/$oldfolder";
|
my $path = "/var/spool/asterisk/voicemail/$context/$mbox/$oldfolder";
|
||||||
opendir(DIR, $path) || die("Unable to open directory\n");
|
opendir(DIR, $path) || die("Unable to open directory\n");
|
||||||
|
Reference in New Issue
Block a user