Cleanups.

Remove default 192.168.42.42/32 allow.
Restore missing app/fax/resources/functions/parse_attachments.php to satisfy pre-existing include
Fix so sql in voicemail app works if var undefined.  Warning: don't know if non Mariadb's like cast(...) .
Cleanup close in event socket.
This commit is contained in:
Harry G. Coin
2016-04-25 22:16:19 -05:00
parent b9285e81fe
commit cc553a70c5
4 changed files with 51 additions and 6 deletions

View File

@@ -48,9 +48,6 @@
else {
$xml_string = "<configuration name=\"acl.conf\" description=\"Network Lists\">\n";
$xml_string .= " <network-lists>\n";
$xml_string .= " <list name=\"lan\" default=\"allow\">\n";
$xml_string .= " <node type=\"allow\" cidr=\"192.168.42.42/32\"/>\n";
$xml_string .= " </list>\n";
$xml_string .= " <list name=\"domains\" default=\"deny\">\n";
$xml_string .= " <node type=\"allow\" domain=\"".$_SESSION['domain_name']."\"/>\n";
$xml_string .= " </list>\n";

View File

@@ -0,0 +1,48 @@
<?php
function parse_attachments($connection, $message_number, $option = '') {
$attachments = array();
$structure = imap_fetchstructure($connection, $message_number, $option);
if(isset($structure->parts) && count($structure->parts)) {
for($i = 0; $i < count($structure->parts); $i++) {
if($structure->parts[$i]->ifdparameters) {
foreach($structure->parts[$i]->dparameters as $object) {
if(strtolower($object->attribute) == 'filename') {
$attachments[$i]['is_attachment'] = true;
$attachments[$i]['filename'] = $object->value;
}
}
}
if($structure->parts[$i]->ifparameters) {
foreach($structure->parts[$i]->parameters as $object) {
if(strtolower($object->attribute) == 'name') {
$attachments[$i]['is_attachment'] = true;
$attachments[$i]['name'] = $object->value;
}
}
}
if($attachments[$i]['is_attachment']) {
$attachments[$i]['attachment'] = imap_fetchbody($connection, $message_number, $i+1, $option);
if($structure->parts[$i]->encoding == 3) { // 3 = BASE64
$attachments[$i]['attachment'] = base64_decode($attachments[$i]['attachment']);
$attachments[$i]['size'] = strlen($attachments[$i]['attachment']);
}
elseif($structure->parts[$i]->encoding == 4) { // 4 = QUOTED-PRINTABLE
$attachments[$i]['attachment'] = quoted_printable_decode($attachments[$i]['attachment']);
$attachments[$i]['size'] = strlen($attachments[$i]['attachment']);
}
}
unset($attachments[$i]['is_attachment']);
}
}
return array_values($attachments); //reindex
}
?>

View File

@@ -116,10 +116,10 @@ else {
//get the list
$sql = str_replace('count(*) as num_rows', '*', $sql);
if (strlen($order_by) > 0) {
$sql .= ($order_by == 'voicemail_id') ? "order by voicemail_id ".$order." " : "order by ".$order_by." ".$order." ";
$sql .= ($order_by == 'voicemail_id') ? "order by cast(voicemail_id as int) ".$order." " : "order by ".$order_by." ".$order." ";
}
else {
$sql .= "order by voicemail_id asc ";
$sql .= "order by cast(voicemail_id as int) asc ";
}
$sql .= "limit ".$rows_per_page." offset ".$offset." ";
$prep_statement = $db->prepare(check_sql($sql));

View File

@@ -164,7 +164,7 @@ class event_socket {
public function close() {
if ($this->fp) {
fclose($fp->fp);
fclose($this->fp);
$this->fp = false;
}
}