示例#1
0
function vacation_read(array &$data)
{
    $rcmail = rcmail::get_instance();
    $email = escapeshellcmd($data['email']);
    $cmd = "sudo /opt/psa/bin/autoresponder -i -mail {$email}";
    exec($cmd . ' 2>&1', $output, $returnvalue);
    if ($returnvalue !== 0) {
        $stroutput = implode(' ', $output);
        raise_error(array('code' => 600, 'type' => 'php', 'file' => __FILE__, 'line' => __LINE__, 'message' => "Vacation plugin: Unable to execute {$cmd} ({$stroutput}, {$returnvalue})"), true, false);
        return PLUGIN_ERROR_CONNECT;
    }
    $status = parse_output($output, "Status");
    if ($status == "true") {
        $data['vacation_enable'] = true;
    }
    $data['vacation_subject'] = parse_output($output, "Answer with subj:");
    $data['vacation_message'] = parse_output($output, "Answer text:");
    $data['vacation_forwarder'] = parse_output($output, "Forward request:");
    /*
        Fields not currently used by Plesk:
    	$data['vacation_start']
    	$data['vacation_end']
    	$data['vacation_keepcopyininbox']
    */
    return PLUGIN_SUCCESS;
}
示例#2
0
function osc_parse_mime_decode_output(&$obj, &$parts)
{
    if (!empty($obj->parts)) {
        for ($i = 0; $i < count($obj->parts); $i++) {
            if (isset($obj->parts[$i]->parts) && count($obj->parts[$i]->parts) > 0) {
                osc_parse_mime_decode_output($obj->parts[$i], $parts);
            } else {
                parse_output($obj->parts[$i], $parts, $i);
            }
        }
    } elseif (isset($obj->body)) {
        $ctype = $obj->ctype_primary . '/' . $obj->ctype_secondary;
        switch ($ctype) {
            case 'text/plain':
                if (!empty($obj->disposition) and $obj->disposition == 'attachment') {
                    $parts['attachments'][] = $obj->body;
                } else {
                    $parts['text'][] = $obj->body;
                }
                break;
            case 'text/html':
                if (!empty($obj->disposition) and $obj->disposition == 'attachment') {
                    $parts['attachments'][] = $obj->body;
                } else {
                    $parts['html'][] = $obj->body;
                }
                break;
            default:
                $parts['attachments'][] = $obj->body;
                break;
        }
    }
}
示例#3
0
文件: edit.php 项目: bitweaver/irlist
function parse_output(&$obj, &$parts, $i)
{
    if (!empty($obj->parts)) {
        for ($i = 0; $i < count($obj->parts); $i++) {
            parse_output($obj->parts[$i], $parts, $i);
        }
    } else {
        $ctype = $obj->ctype_primary . '/' . $obj->ctype_secondary;
        switch ($ctype) {
            case 'application/x-tikiwiki':
                $aux["body"] = $obj->body;
                $ccc = $obj->headers["content-type"];
                $items = split(';', $ccc);
                foreach ($items as $item) {
                    $portions = split('=', $item);
                    if (isset($portions[0]) && isset($portions[1])) {
                        $aux[trim($portions[0])] = trim($portions[1]);
                    }
                }
                $parts[] = $aux;
        }
    }
}
示例#4
0
/**
 * @param $obj
 * @param $parts
 * @param $i
 */
function parse_output(&$obj, &$parts, $i)
{
    if (!empty($obj['parts'])) {
        foreach ($obj['parts'] as $index => $part) {
            parse_output($part, $parts, $index);
        }
    } elseif ($obj['type'] === 'application/x-tikiwiki') {
        $aux["body"] = $obj['body'];
        $ccc = $obj['header']["content-type"];
        $items = explode(';', $ccc);
        foreach ($items as $item) {
            $portions = explode('=', $item);
            if (isset($portions[0]) && isset($portions[1])) {
                $aux[trim($portions[0])] = trim($portions[1]);
            }
        }
        $parts[] = $aux;
    }
}
示例#5
0
            if ($retval || !$result || sizeof($output) < 30) {
                if ($progress) {
                    echo ".";
                }
                if ($includefailures) {
                    $final[$protocols[$i]][$ciphersuite]["result"] = false;
                    if (isset($error)) {
                        $final[$protocols[$i]][$ciphersuite]["error"] = $error;
                    }
                }
                $connectsuccess = false;
            } else {
                if ($progress) {
                    echo "Y";
                }
                $parsed = parse_output($output);
                $parsed["result"] = true;
                $final[$protocols[$i]][$parsed["ciphersuite"]] = $parsed;
                $connectsuccess = true;
            }
        } while ($connectsuccess);
        if ($progress) {
            echo "\n";
        }
    }
}
if ($pretty) {
    echo json_encode($final, JSON_PRETTY_PRINT) . "\n";
} else {
    echo json_encode($final) . "\n";
}
示例#6
0
function parse_output(&$obj, &$parts)
{
    if (!empty($obj->parts)) {
        for ($i = 0; $i < count($obj->parts); $i++) {
            parse_output($obj->parts[$i], $parts);
        }
    } else {
        $ctype = $obj->ctype_primary . '/' . $obj->ctype_secondary;
        $ctype = strtolower($ctype);
        switch ($ctype) {
            case 'text/plain':
                if (!empty($obj->disposition) and $obj->disposition == 'attachment') {
                    $parts['attachments'][] = array('data' => $obj->body, 'filename' => $obj->d_parameters['filename'], 'filename2' => $obj->ctype_parameters['name'], 'type' => $obj->ctype_primary, 'encoding' => $obj->headers['content-transfer-encoding']);
                } else {
                    $parts['text'][] = $obj->body;
                }
                break;
            case 'text/html':
                if (!empty($obj->disposition) and $obj->disposition == 'attachment') {
                    $parts['attachments'][] = array('data' => $obj->body, 'filename' => $obj->d_parameters['filename'], 'filename2' => $obj->ctype_parameters['name'], 'type' => $obj->ctype_primary, 'encoding' => $obj->headers['content-transfer-encoding']);
                } else {
                    $parts['html'][] = $obj->body;
                }
                break;
            default:
                $parts['attachments'][] = array('data' => $obj->body, 'filename' => $obj->d_parameters['filename'], 'filename2' => $obj->ctype_parameters['name'], 'type' => $obj->ctype_primary, 'headers' => $obj->headers);
        }
    }
    $parts['headers'] = $obj->headers;
}
function parse_output(&$obj, &$parts, $i)
{
    if (!empty($obj['parts'])) {
        for ($i = 0; $i < count($obj['parts']); $i++) {
            parse_output($obj['parts'][$i], $parts, $i);
        }
    } else {
        switch ($obj['type']) {
            case 'application/x-tikiwiki':
                $aux["body"] = $obj['body'];
                $ccc = $obj['header']["content-type"];
                $items = split(';', $ccc);
                foreach ($items as $item) {
                    $portions = split('=', $item);
                    if (isset($portions[0]) && isset($portions[1])) {
                        $aux[trim($portions[0])] = trim($portions[1]);
                    }
                }
                $parts[] = $aux;
        }
    }
}
function get_calendar_events($cal_url)
{
    $events1 = curl_download($cal_url);
    $events2 = parse_output($events1);
    $events3 = parse_events($events2);
    $events4 = remove_colors($events3);
    $events5 = remove_whitespace($events4);
    $events6 = get_key_values($events5);
    get_json_cal_events($events6);
}