Exemplo n.º 1
0
        if ($string == "HTTP_USER_AGENT" && isset($_SERVER['HTTP_USER_AGENT'])) {
            $content['env'] = $content['env'] . str_pad("BROWSER", 15, " ", STR_PAD_LEFT) . ": " . $_SERVER['HTTP_USER_AGENT'] . "\n";
        }
        if ($string == "HTTP_REFERER" && isset($_SERVER['HTTP_REFERER'])) {
            $content['env'] = $content['env'] . str_pad("REFERER", 15, " ", STR_PAD_LEFT) . ": " . $_SERVER['HTTP_REFERER'] . "\n";
        }
    }
}
/**
 * Send the $_POST variables
 */
if (!isset($realname) && isset($name)) {
    $realname = $name;
}
if (isset($realname) && isset($email_bad_array)) {
    $realname = preg_match_replace($email_bad_array, '', $realname);
}
$content["text"] = stripslashes($contentArray["text"]) . $content['env'];
$content["html"] = stripslashes($contentArray["html"]) . $content['env'];
$content['csv'] = $contentArray['csv'] . ',' . str_replace("\n", "\t", $contentArray['csv']);
// send email to the recipient
if (!isset($realname)) {
    $realname = '';
}
if ($useAsAutoResponder === false) {
    // if $useAsAutoResponder is true, an email to $recipient is not needed
    $OK = mail_it($content, $subject, $email, $realname, $recipient, true);
    if ($OK !== false && isset($_POST['flash_sent'])) {
        echo $_POST['flash_sent'];
    } elseif (isset($_POST['flash_sent'])) {
        echo 'sent=failed';
Exemplo n.º 2
0
 protected function partial_replace($element)
 {
     if (($name = $element->name) === null) {
         $message = __METHOD__ . "() template name is null.";
         throw new Sabel_Exception_Runtime($message);
     }
     $retval = "";
     if (($assign = $element->assign) === null) {
         $retval = '<?php echo $this->partial("' . $name . '") ?>';
     } else {
         $fmt = '<?php echo $this->partial("%s", %s) ?>';
         $assign = preg_match_replace("/'.*[^\\\\]'/U", ",", "_%CMM%_", $assign);
         $assigns = explode(",", $assign);
         if (strpos($assigns[0], ":") === false) {
             $retval = sprintf($fmt, $name, $assigns[0]);
         } else {
             $buf = "";
             foreach ($assigns as $hash) {
                 list($key, $val) = explode(":", $hash, 2);
                 $buf[] = "'" . trim($key) . "' => {$val}";
             }
             $assign = "array(" . implode(", ", $buf) . ")";
             $retval = sprintf($fmt, $name, $assign);
         }
         $retval = str_replace("_%CMM%_", ",", $retval);
     }
     return $retval;
 }
Exemplo n.º 3
0
 /**
  * Remove the parameter and its value from the URI string,
  * by reference
  *
  * If the parameter cannot be found, the URI is left unchanged.
  * Note that this expects and produces URIs in the form as returned by
  * {@see getRelativeUri_entities()}.  It operates on a URI without
  * entities, too, but the result will probably not be correct.
  * @param   string    $uri              The URI, by reference
  * @param   string    $parameter_name   The name of the parameter
  * @return  string                      The former parameter value,
  *                                      or the empty string
  */
 static function stripUriParam(&$uri, $parameter_name)
 {
     $match = array();
     //DBG::log("Html::stripUriParam(".contrexx_raw2xhtml($uri).", ".contrexx_raw2xhtml($parameter_name)."): Entered");
     // Match the parameter *WITH* equal sign and value (possibly empty)
     $uri = preg_match_replace('/(?<=\\?|\\&amp;|\\&(?!amp;))' . preg_quote($parameter_name, '/') . '\\=([^&]*)' . '(?:\\&amp;|\\&(?!amp;)|$)/', '', $uri, $match);
     // Match the parameter *WITHOUT* equal sign and value
     $uri = preg_match_replace('/(?<=\\?|\\&amp;|\\&(?!amp;))' . preg_quote($parameter_name, '/') . '(?:\\&amp;|\\&(?!amp;)|$)/', '$1', $uri);
     //echo("Html::stripUriParam(".contrexx_raw2xhtml($uri).", ".contrexx_raw2xhtml($parameter_name)."): regex ".contrexx_raw2xhtml($re)."<br />");
     // Remove trailing '?', '&', or '&amp;'.
     // At least one of those will be left over when the last parameter
     // was removed from the URI!
     $uri = preg_replace('/(?:\\?|\\&amp;|\\&(?!amp;))*$/', '', $uri);
     //echo("Html::stripUriParam(".contrexx_raw2xhtml($uri).", ".contrexx_raw2xhtml($parameter_name)."): stripped $count times ".var_export($match, true)."<br />");
     if (empty($match[1])) {
         return '';
     }
     return $match[1];
 }