Changeset - r27:4d96cfceba10
[Not reviewed]
v0.7 default
0 2 0
Wolfgang Scherer (ws) - 13 years ago 2012-03-31 21:18:55
wolfgang.scherer@gmx.de
index.php: cut'n'paste error fixed.
2 files changed with 16 insertions and 2 deletions:
0 comments (0 inline, 0 general)
index.php
Show inline comments
 
@@ -415,97 +415,97 @@ if ($forward_active) {
 
    $active_checked = '';
 
}
 
$user_control[] = sprintf('<input type="checkbox" name="active" value="active"%s /><br />',
 
                          $active_checked);
 
$user_control = implode($user_control, "\n");
 
$trow[] = $user_control;
 

	
 
$form[] = sprintf('<tr><td style="text-align: center;">%s</td></tr>', implode($trow, '</td><td style="text-align: center;">'));
 
$form[] = '</table></div><br />';
 

	
 
$text_rows = 10;
 
// $text_rows = 3;                // |:debug:|
 

	
 
if ( !$x_wsv_raw )
 
{
 
    $form[] = sshl(get_text('automatic_mode'));
 

	
 
    // subject
 
    $form[] = sprintf('<span class="label">%s<sup>*</sup>:</span>', get_text('subject'));
 
    $form[] = (
 
        '<input type="text" name="subject" value="' . htmlspecialchars($vacation_subject, ENT_COMPAT, "UTF-8")
 
        .'" size="49" style="width: 440px;" /><br />');
 

	
 
    // message
 
    $form[] = sprintf('<span class="label">%s<sup>*</sup>:</span>', get_text('body'));
 
    $form[] = (
 
        '<textarea name="body" cols="56" rows="'.$text_rows.'"'
 
        .' style="vertical-align: top; width: 440px;">' . htmlspecialchars($vacation_body, ENT_NOQUOTES, "UTF-8") . '</textarea><br />');
 

	
 
    // actions
 
    $form[] = '<hr class="sep"/>';
 
    $form[] = '<span class="label">&nbsp;</span>';
 
    $form[] = sprintf('<input type="submit" name="save" value="%s" />', get_text('save'));
 
    //$form[] = ' ' . get_text('enable_encoding');
 
    $form[] = '<hr class="sep"/>';
 
}
 

	
 
if ($x_wsv_raw || $EXPERT_ENABLED)
 
{
 
    if ( $x_wsv_raw ) {
 
        $text_rows = 15;
 
    } else {
 
        $text_rows = 5;
 
    }
 
    $form[] = sshl(get_text('expert_mode'));
 
    // raw message
 
    $form[] = sprintf('<span class="label">%s<sup>*</sup>:</span>', get_text('message'));
 
    $form[] = (
 
        '<textarea name="body" cols="56" rows="'.$text_rows.'"'
 
        '<textarea name="message" cols="56" rows="'.$text_rows.'"'
 
        .' style="vertical-align: top; width: 440px;">' . htmlspecialchars($vacation_msg, ENT_NOQUOTES, "UTF-8") . '</textarea><br />');
 

	
 
    $form[] = '<span class="label">&nbsp;</span>';
 
    $form[] = (
 
        '<span style="display: inline-block; width: 440px; margin-top: 5px; font-size: 8pt;">'
 
        . get_text('explain_expert')
 
        .'</span><br />');
 

	
 
    $form[] = '<hr class="sep"/>';
 
    $form[] = '<span class="label">&nbsp;</span>';
 
    $form[] = sprintf('<input type="submit" name="raw" value="%s" />', get_text('save'));
 
    //$form[] = ' ' . get_text('disable_encoding');
 
    $form[] = '<hr class="sep"/>';
 

	
 
}
 

	
 
//$form[] = '<span class="label">&nbsp;</span>';
 
$form[] = (
 
    '<span style="display: inline-block; width: 550px;"><sup>*</sup>'
 
    . get_text('explain_subject')
 
    .'</span><br />');
 

	
 
// --------------------------------------------------
 
// |||:sec:||| Vacation History
 
// --------------------------------------------------
 

	
 
$vacation_list_cmd = sprintf(
 
    '%s -u %s %s %s -l', $SUDO_CMD, $user, $SUDO_OPT_H, $VACATION_CMD);
 
// echo ('<pre>'."\n");
 
// echo ($vacation_list_cmd);
 
// echo ('</pre>'."\n");
 
$vacation_ausgabe = popen ($vacation_list_cmd, 'r');
 
$vacation_list = stream_get_contents($vacation_ausgabe);
 
pclose($vacation_ausgabe);
 

	
 
if (!empty ($vacation_list)) {
 
    $form[] = shl(get_text('reply_history'));
 
    // $form[] = '<hr class="sep"/>';
 
    $form[] = '<pre>';
 
    $form[] = $vacation_list;
 
    $form[] = '</pre>';
 
    $form[] = '<hr class="sep"/>';
 
    $form[] = '<span class="label">&nbsp;</span>';
 
    $form[] = sprintf('<input type="submit" name="delete" value="%s" /><br />', get_text('delete'));
 
    if ($is_admin) {
 
        $form[] = ('<hr class="sep"/>');
 
    }
 
} else {
lib/util.php
Show inline comments
 
@@ -253,98 +253,112 @@ function error_msg($message)
 
// |||:sec:||| vaccation(1) message
 
// --------------------------------------------------
 

	
 
// 2.2. Header Fields
 
//    Header fields are lines beginning with a field name, followed by a
 
//    colon (":"), followed by a field body, and terminated by CRLF.  A
 
//    field name MUST be composed of printable US-ASCII characters (i.e.,
 
//    characters that have values between 33 and 126, inclusive), except
 
//    colon.  A field body may be composed of printable US-ASCII characters
 
//    as well as the space (SP, ASCII value 32) and horizontal tab (HTAB,
 
//    ASCII value 9) characters (together known as the white space
 
//    characters, WSP).  A field body MUST NOT include CR and LF except
 
//    when used in "folding" and "unfolding", as described in section
 
//    2.2.3.  All field bodies MUST conform to the syntax described in
 
//    sections 3 and 4 of this specification.
 

	
 
function message_split($message)
 
{
 
    $lines = explode("\n", ltrim($message));
 
    $headers = Array();
 
    $body = '';
 
    $check_from = True;
 
    $current_field = '';
 
    while (True) {
 
        $line = array_shift($lines);
 
        $tline = trim($line);
 
        if (empty($tline)) {
 
            break;
 
        }
 
        if ($check_from) {
 
            $check_from = False;
 
            if ( preg_match('/^From /', $line) ) {
 
                continue;
 
            }
 
        }
 
        $matches = Array();
 
        if ( preg_match('/(^[!-~]+):/', $line, $matches)) {
 
            $current_field = strtolower($matches[1]);
 
            $headers[$current_field] = $line;
 
            continue;
 
        }
 
        if (!empty($current_field))
 
        {
 
            $headers[$current_field] .= "\n" . $line;
 
            continue;
 
        }
 
        $headers[] = $line;
 
    }
 
    $body = implode($lines, "\n");
 

	
 
    $body = implode($lines, "\n");
 
    global $_debug;
 
    if ( $_debug ) {
 
        echo "<pre>\n";
 
        echo "--------------------------------------------------\n";
 
        echo "headers\n";
 
        echo "--------------------------------------------------\n";
 
        var_dump($headers);
 
        echo "--------------------------------------------------\n";
 
        echo "body\n";
 
        echo "--------------------------------------------------\n";
 
        var_dump($body);
 
        echo "</pre>\n";
 
    }
 

	
 
    return Array($headers, $body);
 
}
 

	
 
function message_join($headers, $body)
 
{
 
    return sprintf("%s\n\n%s", implode($headers, "\n"), $body);
 
}
 

	
 
function header_set(&$headers, $header)
 
{
 
    $matches = Array();
 
    if (preg_match('/^([!-~]+):/', $header, $matches)) {
 
        $headers[$matches[1]] = trim($header);
 
    }
 
}
 

	
 
function header_field_body(&$headers, $field_name)
 
{
 
    if (array_key_exists($field_name, $headers)) {
 
        $field = $headers[$field_name];
 
        $field_body = preg_replace('/^[^:]+: */', '', $field);
 
    } else {
 
        $field_body = '';
 
    }
 
    return $field_body;
 
}
 

	
 
function header_clean(&$headers)
 
{
 
    global $HEADER_REMOVE;
 
    $clean_headers = Array();
 
    foreach ($headers as $field_name => $field) {
 
        if ( substr($field_name, 0 , 2) == 'x-' )
 
        {
 
            continue;
 
        }
 
        if (in_array($field_name, $HEADER_REMOVE))
 
        {
 
            continue;
 
        }
 
        $clean_headers[$field_name] = $field;
 
    }
 
    return $clean_headers;
 
}
 

	
 
if (!function_exists("quoted_printable_encode")) {
 
    // only available with PHP >= 5.3.0
 
    if (function_exists("imap_8bit")) {
0 comments (0 inline, 0 general)