Пример #1
0
    } else {
        echo ($html ? "<tr><td colspan='20' class='spikekill_note'>" : "") . "FATAL: RRDtool Command Failed.  Please insure your RRDtool install is valid!" . ($html ? "</td></tr>\n" : "\n");
    }
    exit(-12);
}
/* backup the rrdfile if requested */
if ($backup && !$dryrun) {
    if (copy($rrdfile, $bakfile)) {
        echo ($html ? "<tr><td colspan='20' class='spikekill_note'>" : "") . "NOTE: RRDfile '{$rrdfile}' backed up to '{$bakfile}'" . ($html ? "</td></tr>\n" : "\n");
    } else {
        echo ($html ? "<tr><td colspan='20' class='spikekill_note'>" : "") . "FATAL: RRDfile Backup of '{$rrdfile}' to '{$bakfile}' FAILED!" . ($html ? "</td></tr>\n" : "\n");
        exit(-13);
    }
}
/* process the xml file and remove all comments */
$output = removeComments($output);
/* Read all the rra's ds values and obtain the following pieces of information from each
   rra archive.

   * numsamples - The number of 'valid' non-nan samples
   * sumofsamples - The sum of all 'valid' samples.
   * average - The average of all samples
   * standard_deviation - The standard deviation of all samples
   * max_value - The maximum value of all samples
   * min_value - The minimum value of all samples
   * max_cutoff - Any value above this value will be set to the average.
   * min_cutoff - Any value lower than this value will be set to the average.

   This will end up being a n-dimensional array as follows:
   rra[x][ds#]['totalsamples'];
   rra[x][ds#]['numsamples'];
$xml = str_replace("%INFO/NAME%", $config['info']['name'], $xml);
$xml = str_replace("%INFO/URL%", $config['info']['url'], $xml);
$xml = str_replace("%INFO/DOMAIN%", $config['info']['domain'], $xml);
$xml = str_replace("%TTL%", $config['ttl'], $xml);
$xml = str_replace("%SERVER/SMTP/SSL_ON%", isOnOrOff($config['server']['smtp']['socket'] == "SSL"), $xml);
$xml = str_replace("%SERVER/IMAP/SSL_ON%", isOnOrOff($config['server']['imap']['socket'] == "SSL"), $xml);
$xml = str_replace("%SERVER/IMAP/DOMAIN_REQUIRED%", isOnOrOff($config['server']['domain_required']), $xml);
$xml = str_replace("%SERVER/SMTP/DOMAIN_REQUIRED%", isOnOrOff($config['server']['domain_required']), $xml);
$xml = str_replace("%SERVER/IMAP/HOST%", $config['server']['imap']['host'], $xml);
$xml = str_replace("%SERVER/IMAP/PORT%", $config['server']['imap']['port'], $xml);
$xml = str_replace("%SERVER/IMAP/SOCKET%", $config['server']['imap']['socket'], $xml);
$xml = str_replace("%SERVER/SMTP/HOST%", $config['server']['smtp']['host'], $xml);
$xml = str_replace("%SERVER/SMTP/PORT%", $config['server']['smtp']['port'], $xml);
$xml = str_replace("%SERVER/SMTP/SOCKET%", $config['server']['smtp']['socket'], $xml);
$xml = str_replace("%EMAIL%", getRequestEmail(), $xml);
$xml = removeComments($xml);
$xml = beautify($xml);
echo $xml;
function removeComments($xml)
{
    $pattern = '/<!--(.*)?-->/sU';
    return preg_replace($pattern, '', $xml);
}
function beautify($xml)
{
    $dom = new DOMDocument();
    $dom->preserveWhiteSpace = false;
    $dom->loadXML($xml);
    $dom->formatOutput = true;
    return $dom->saveXml();
}
Пример #3
0
require_once $mainframe->getPath('admin_html');
switch ($task) {
    case "new":
        editComment($option, 0);
        break;
    case "edit":
        editComment($option, $cid[0]);
        break;
    case 'editA':
        editComment($option, intval($id));
        break;
    case "save":
        saveComment($option);
        break;
    case "remove":
        removeComments($cid, $option);
        break;
    case "publish":
        publishComments($cid, 1, $option);
        break;
    case "unpublish":
        publishComments($cid, 0, $option);
        break;
    case "settings":
        showConfig($option);
        break;
    case "savesettings":
        $allow_comments_in_sections = implode(',', $_POST['mcselections']);
        saveConfig($option, $auto_publish_comments, $allow_anonymous_entries, $notify_new_entries, $allow_comments_in_sections, $comments_per_page, $admin_comments_length);
        break;
    default:
Пример #4
0
$ch = curl_init();
$timeout = 5;
// set to zero for no timeout
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
// spoofing FireFox 2.0
$useragent = $_SERVER['HTTP_USER_AGENT'];
// set user agent
curl_setopt($ch, CURLOPT_USERAGENT, $useragent);
// set the rest of your cURL options here
$contents = curl_exec($ch);
curl_close($ch);
// Decode from UTF-8
$contents = utf8_decode($contents);
$contents = removeComments($contents);
$contents = removeClassInfo($contents);
//-------------------------------------------------------------------------------------------
//Parse the Topicfile to find WikiLinks
//-------------------------------------------------------------------------------------------
$i = 0;
$link[0][0] = "";
echo "<map version=\"0.8.0\">\n";
#echo'<edge STYLE="bezier"/>\n';
$wikilink = 'http://' . $wiki . '/wiki/' . $topic;
$ttorg = substr($contents, 0, 500);
//echo 'TTROG: '.$ttorg;
$tooltip = createToolTipText($ttorg, 300);
//echo 'TT: '.$tooltip;
$topic = preg_replace("/[\n&]/", "%26", $topic);
$wikilink = preg_replace("/\n&/", "%26", $wikilink);