コード例 #1
0
ファイル: misc.func.php プロジェクト: juliogallardo1326/proc
function fullDump(&$variable, $parents = '$var')
{
    if (!isset($variable)) {
        echo "<font color='#777777'>undefined</font>;<br>";
        return;
    }
    $var = $variable;
    if ($parents == '$var') {
        echo '<code><b>';
    }
    if (is_object($var)) {
        $type = 'obj';
        settype($var, 'array');
    } else {
        if (is_array($var)) {
            $type = 'arr';
        } else {
            $type = '';
        }
    }
    if (!empty($type)) {
        $num = count($var);
        echo '<font color="#007700">' . ($type == 'obj' ? 'Object' : 'Array') . " ({$num})</font>";
        echo '<br>';
        foreach ($var as $key => $val) {
            $key = htmlspecialchars($key);
            $kout = $type == 'obj' ? '->' . $key : "[<font color=#00bbbb>'{$key}'</font>]";
            echo '<font color="$0000ff">' . $parents . $kout . '</font> = ';
            echo fullDump($val, $parents . $kout);
        }
    } else {
        if (is_numeric($var)) {
            echo "<font color='#005f5f'>" . $var . "</font>;<br>";
        } elseif (is_string($var)) {
            echo "<font color='#777700'>\"" . htmlspecialchars($var) . "\"</font>;<br>";
        } elseif (is_bool($var)) {
            echo ($var ? 'true' : 'false') . ";<br>";
        } elseif (is_resource($var)) {
            echo "<font color='#aa0000'>::" . $var . "::</font>;<br>";
        } else {
            echo "'" . htmlspecialchars($var) . "';<br>";
        }
    }
    if ($type = 'obj') {
        settype($var, 'object');
    }
    if ($parents == '$var') {
        echo '</b></code><hr>';
    }
}
コード例 #2
0
ファイル: sendmail.php プロジェクト: juliogallardo1326/proc
 /**
  * Implements Mail::send() function using the sendmail
  * command-line binary.
  * 
  * @param mixed $recipients Either a comma-seperated list of recipients
  *              (RFC822 compliant), or an array of recipients,
  *              each RFC822 valid. This may contain recipients not
  *              specified in the headers, for Bcc:, resending
  *              messages, etc.
  *
  * @param array $headers The array of headers to send with the mail, in an
  *              associative array, where the array key is the
  *              header name (ie, 'Subject'), and the array value
  *              is the header value (ie, 'test'). The header
  *              produced from those values would be 'Subject:
  *              test'.
  *
  * @param string $body The full text of the message body, including any
  *               Mime parts, etc.
  *
  * @return mixed Returns true on success, or a PEAR_Error
  *               containing a descriptive error message on
  *               failure.
  * @access public
  */
 function send($recipients, $headers, $body)
 {
     if (isset($headers['To'])) {
         unset($headers['To']);
     }
     if (isset($headers['to'])) {
         unset($headers['to']);
     }
     $recipients = escapeShellCmd(implode(' ', $this->parseRecipients($recipients)));
     list($from, $text_headers) = $this->prepareHeaders($headers);
     if (!isset($from)) {
         return new PEAR_Error('No from address given.');
     } elseif (strstr($from, ' ') || strstr($from, ';') || strstr($from, '&') || strstr($from, '`')) {
         return new PEAR_Error('From address specified with dangerous characters.');
     }
     $result = 0;
     $command = $this->sendmail_path . (!empty($this->sendmail_args) ? ' ' . $this->sendmail_args : '') . " -f{$from} -- {$recipients}";
     fullDump($recipients);
     fullDump($command);
     if (@is_executable($this->sendmail_path)) {
         $from = escapeShellCmd($from);
         $mail = popen($command, 'w');
         fputs($mail, $text_headers);
         fputs($mail, $this->sep);
         // newline to end the headers section
         fputs($mail, $body);
         $result = pclose($mail) >> 8 & 0xff;
         // need to shift the pclose result to get the exit code
     } else {
         return new PEAR_Error('sendmail [' . $this->sendmail_path . '] not executable');
     }
     if ($result != 0) {
         return new PEAR_Error('sendmail returned error code ' . $result);
     }
     return true;
 }