--- /dev/null
+<?php
+/* ***** BEGIN LICENSE BLOCK *****
+ *
+ * The contents of this file are subject to Austrian copyright reegulations
+ * ("Urheberrecht"); you may not use this file except in compliance with
+ * those laws.
+ * This contents and any derived work, if it gets distributed in any way,
+ * is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND,
+ * either express or implied.
+ *
+ * The Original Code is KaiRo's extended DOM document classes.
+ *
+ * The Initial Developer of the Original Code is
+ * KaiRo - Robert Kaiser.
+ * Portions created by the Initial Developer are Copyright (C) 2010
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s): Robert Kaiser <kairo@kairo.at>
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+class ExtendedDocument extends DOMDocument {
+ // ExtendedDocument PHP class
+ // this extends the general PHP DOM Document class to simplify some usual constructs
+ //
+ // function __construct([$version], [$encoding])
+ // CONSTRUCTOR
+ // construct a new DOM Document that uses our element definitions
+ //
+ // private $xmheader
+ // the default XML header
+ //
+ // private $xhtmldtype
+ // the XHTML doctype to use by default
+ //
+ // function appendElement($name, [$value])
+ // appends a DOMDocument::createElement() as a child of this document (see there for params)
+ // returns the new child
+ //
+ // function appendElementXML($name, $xmldata)
+ // appends a DOMDocument::createElement() with the given name as a child of this document,
+ // with an ExtendedDocument::createXMLFragment() of the given XML data inside
+ // returns the new child
+ //
+ // function appendLink($target, [$value])
+ // appends an ExtendedDocument::createElementLink() as a child of this document (see there for params)
+ // returns the new child
+ //
+ // function appendFormDiv($action, $method, $name)
+ // appends an ExtendedDocument::createElementForm() as a child of this document (see there for params)
+ // returns an HTML <div> that is a child of the new child
+ //
+ // function appendInputHidden($name, $value)
+ // appends an ExtendedDocument::createElementInputHidden() as a child of this document (see there for params)
+ // returns the new child
+ //
+ // function appendInputText($name, $maxlength, $size, [$id], [$value])
+ // appends an ExtendedDocument::createElementInputText() as a child of this document (see there for params)
+ // returns the new child
+ //
+ // function appendInputRadio($name, $id, $value, $checked)
+ // appends an ExtendedDocument::createElementInputRadio() as a child of this document (see there for params)
+ // returns the new child
+ //
+ // function appendInputCheckbox($name, $id, $value, $checked)
+ // appends an ExtendedDocument::createElementInputCheckbox() as a child of this document (see there for params)
+ // returns the new child
+ //
+ // function appendInputSubmit($value)
+ // appends an ExtendedDocument::createElementInputSubmit() as a child of this document (see there for params)
+ // returns the new child
+ //
+ // function appendTextArea($name, $columns, $rows, [$id], [$value])
+ // appends an ExtendedDocument::createElementTextArea() as a child of this document (see there for params)
+ // returns the new child
+ //
+ // function appendElementSelect($name, [$id], [$options], [$default])
+ // appends an ExtendedDocument::createElementSelect() as a child of this document (see there for params)
+ // returns the new child
+ //
+ // function appendElementOption($key, $desc, [$selected])
+ // appends an ExtendedDocument::createElementOption() as a child of this document (see there for params)
+ // returns the new child
+ //
+ // function appendLabel($for_id, $value)
+ // appends an ExtendedDocument::createElementLabel() as a child of this document (see there for params)
+ // returns the new child
+ //
+ // function appendText($text)
+ // appends a DOMDocument::createTextNode() as a child of this document (see there for params)
+ // returns the new child
+ //
+ // function appendHTMLMarkup($htmldata, [$parentNode])
+ // appends a representation of the HTML data as children of the given parent node, by default this document
+ // NO return value!
+ //
+ // function appendXMLMarkup($xmldata, [$parentNode])
+ // appends a representation of the XML data as children of the given parent node, by default this document
+ // NO return value!
+ //
+ // function appendJSElement($jsdata)
+ // appends an ExtendedDocument::createElementJS() as a child of this document (see there for params)
+ // NO return value!
+ //
+ // function appendCOMElement($module, $attributes)
+ // appends an ExtendedDocument::createCOMElement() as a child of this document (see there for params)
+ // returns the new child
+ //
+ // function createElementLink($target, [$value])
+ // returns an ExtendedElement that is an HTML <a> with the given target (href) and (optional) value
+ //
+ // function createElementForm($action, $method, $name)
+ // returns an ExtendedElement that is an HTML <div> that is a child of an HTML <form>
+ // with the given action, method, and name
+ //
+ // function createElementInputHidden($name, $value)
+ // returns an ExtendedElement that is an HTML <input> of type 'hidden' with the given name and value
+ //
+ // function createElementInputText($name, $maxlength, $size, [$id], [$value])
+ // returns an ExtendedElement that is an HTML <input> of type 'text' with the given name, maxlength, size,
+ // and optionally id and value
+ //
+ // function createElementInputRadio($name, $id, $value, $checked)
+ // returns an ExtendedElement that is an HTML <input> of type 'radio' with the given name, id, value and
+ // checked state
+ //
+ // function createElementInputCheckbox($name, $id, $value, $checked)
+ // returns an ExtendedElement that is an HTML <input> of type 'checkbox' with the given name, id, value and
+ // checked state
+ //
+ // function createElementInputSubmit($value)
+ // returns an ExtendedElement that is an HTML <input> of type 'submit' with the given name and value
+ //
+ // function createElementTextArea($name, $columns, $rows, [$id], [$value])
+ // returns an ExtendedElement that is an HTML <textarea> with the given name, columns, rows,
+ // and optionally id and value
+ //
+ // function createElementSelect($name, [$id], [$options], [$default])
+ // returns an ExtendedElement that is an HTML <select> with the given name, and optionally id,
+ // array of options (key => description) and key of the by-default selected entry
+ //
+ // function createElementOption($key, $desc, [$selected])
+ // returns an ExtendedElement that is an HTML <option> with the given key (value) and description (content)
+ // and optionally bool that tells if the entry is selected
+ //
+ // function createElementLabel($for_id, $value)
+ // returns an ExtendedElement that is an HTML <label> with the given 'for' and value
+ //
+ // function createElementJS($jsdata)
+ // returns an ExtendedElement that is an HTML <script> of JavaScript type with the JS data inside
+ //
+ // function createCOMElement($module, $attributes)
+ // returns an ExtendedElement that is in COM_NS namespace, with the given module as name and the
+ // given name=>value array as attributes
+
+ function __construct($version = '1.0', $encoding = 'utf-8') {
+ // make sure the default DOMDocument constructor runs
+ parent::__construct($version, $encoding);
+ $this->registerNodeClass('DOMElement', 'ExtendedElement');
+ $this->registerNodeClass('DOMDocumentFragment', 'ExtendedDocumentFragment');
+ }
+
+ function appendElement($name, $value = '') {
+ return $this->appendChild($this->createElement($name, $value));
+ }
+ function appendElementXML($name, $xmldata) {
+ $aelem = $this->appendChild($this->createElement($name));
+ $aelem->appendXMLMarkup($xmldata);
+ //$aelem->appendChild($this->createXMLFragment($xmldata));
+ return $aelem;
+ }
+ function appendLink($target, $value = '') {
+ return $this->appendChild($this->createElementLink($target, $value));
+ }
+ function appendFormDiv($action, $method, $name) {
+ $formelem = $this->appendChild($this->createElementForm($action, $method, $name));
+ return $formelem->appendElement('div');
+ }
+ function appendInputHidden($name, $value) {
+ return $this->appendChild($this->createElementInputHidden($name, $value));
+ }
+ function appendInputText($name, $maxlength, $size, $id = null, $value = null) {
+ return $this->appendChild($this->createElementInputText($name, $maxlength, $size, $id, $value));
+ }
+ function appendInputRadio($name, $id, $value, $checked) {
+ return $this->appendChild($this->createElementInputRadio($name, $id, $value, $checked));
+ }
+ function appendInputCheckbox($name, $id, $value, $checked) {
+ return $this->appendChild($this->createElementInputCheckbox($name, $id, $value, $checked));
+ }
+ function appendInputSubmit($value) {
+ return $this->appendChild($this->createElementInputSubmit($value));
+ }
+ function appendTextArea($name, $columns, $rows, $id = null, $value = null) {
+ return $this->appendChild($this->createElementTextArea($name, $columns, $rows, $id, $value));
+ }
+ function appendElementSelect($name, $id = null, $options = array(), $default = null) {
+ return $this->appendChild($this->createElementSelect($name, $id, $options, $default));
+ }
+ function appendElementOption($key, $desc, $selected = false) {
+ return $this->appendChild($this->createElementOption($key, $desc, $selected));
+ }
+ function appendLabel($for_id, $value) {
+ return $this->appendChild($this->createElementLabel($for_id, $value));
+ }
+ function appendText($text) {
+ return $this->appendChild($this->createTextNode($text));
+ }
+ function appendJSElement($jsdata) {
+ $this->appendChild($this->createElementJS($jsdata));
+ }
+ function appendCOMElement($module, $attributes) {
+ $this->appendChild($this->ownerDocument->createCOMElement($module, $attributes));
+ }
+
+ function appendHTMLMarkup($htmldata, $parentNode = null) {
+ if (is_null($parentNode)) { $parentNode =& $this; }
+ // XXX: just a workaround for now!
+ $parentNode->appendChild($this->createCDATASection($htmldata));
+ }
+
+ function appendXMLMarkup($xmldata, $parentNode = null) {
+ if (is_null($parentNode)) { $parentNode =& $this; }
+ $tmpdoc = new ExtendedDocument;
+ $tmpxml = '<?xml version="1.0" encoding="utf-8"?>'."\n";
+ $tmpxml .= '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">'."\n";
+ $tmpxml .= '<root>'.$xmldata.'</root>';
+ $tmpdoc->loadXML($tmpxml);
+ foreach ($tmpdoc->getElementsByTagName('root')->item(0)->childNodes as $child) {
+ $parentNode->appendChild($this->importNode($child, true));
+ }
+ }
+
+ function createElementLink($target, $value = '') {
+ $link = $this->createElement('a', $value);
+ $link->setAttribute('href', $target); // XXX: take care of & etc. in links
+ return $link;
+ }
+
+ function createElementForm($action, $method, $name) {
+ $formelem = $this->createElement('form');
+ $formelem->setAttribute('action', $action);
+ $formelem->setAttribute('method', $method);
+ $formelem->setAttribute('name', $name);
+ return $formelem;
+ }
+
+ function createElementInputHidden($name, $value) {
+ $hidden = $this->createElement('input');
+ $hidden->setAttribute('type', 'hidden');
+ $hidden->setAttribute('name', $name);
+ $hidden->setAttribute('value', $value);
+ return $hidden;
+ }
+
+ function createElementInputText($name, $maxlength, $size, $id = null, $value = null) {
+ $txfield = $this->createElement('input');
+ $txfield->setAttribute('type', 'text');
+ if (!is_null($id)) { $txfield->setAttribute('id', $id); }
+ $txfield->setAttribute('name', $name);
+ $txfield->setAttribute('maxlength', $maxlength);
+ $txfield->setAttribute('size', $size);
+ if (!is_null($value)) { $txfield->setAttribute('value', $value); }
+ return $txfield;
+ }
+
+ function createElementInputRadio($name, $id, $value, $checked) {
+ $radio = $this->createElement('input');
+ $radio->setAttribute('type', 'radio');
+ $radio->setAttribute('name', $name);
+ $radio->setAttribute('id', $id);
+ $radio->setAttribute('value', $value);
+ if ($checked) { $radio->setAttribute('checked', ''); }
+ return $radio;
+ }
+
+ function createElementInputCheckbox($name, $id, $value, $checked) {
+ $cbox = $this->createElement('input');
+ $cbox->setAttribute('type', 'checkbox');
+ $cbox->setAttribute('name', $name);
+ $cbox->setAttribute('id', $id);
+ $cbox->setAttribute('value', $value);
+ if ($checked) { $cbox->setAttribute('checked', ''); }
+ return $cbox;
+ }
+
+ function createElementInputSubmit($value) {
+ $submitbtn = $this->createElement('input');
+ $submitbtn->setAttribute('type', 'submit');
+ $submitbtn->setAttribute('value', $value);
+ return $submitbtn;
+ }
+
+ function createElementTextArea($name, $columns, $rows, $id = null, $value = null) {
+ $txtarea = $this->createElement('textarea', $value);
+ $txtarea->setAttribute('name', $name);
+ $txtarea->setAttribute('cols', $columns);
+ $txtarea->setAttribute('rows', $rows);
+ if (!is_null($id)) { $txtarea->setAttribute('id', $id); }
+ return $txtarea;
+ }
+
+ function createElementSelect($name, $id = null, $options = array(), $default = null) {
+ $select = $this->createElement('select');
+ $select->setAttribute('name', $name);
+ if (!is_null($id)) { $select->setAttribute('id', $id); }
+ foreach ($options as $key => $desc) {
+ $select->appendElementOption($key, $desc, ($key == $default));
+ }
+ return $select;
+ }
+
+ function createElementOption($key, $desc, $selected = false) {
+ $option = $this->createElement('option', $desc);
+ $option->setAttribute('value', $key);
+ if ($selected) { $option->setAttribute('selected', ''); }
+ return $option;
+ }
+
+ function createElementLabel($for_id, $value) {
+ $label = $this->createElement('label', $value);
+ $label->setAttribute('for', $for_id);
+ return $label;
+ }
+
+ function createElementJS($jsdata) {
+ $jselem = $this->createElement('script');
+ $jselem->setAttribute('type', 'text/javascript');
+ $jselem->appendChild($this->createCDATASection($jsdata));
+ return $jselem;
+ }
+
+ function createCOMElement($module, $attributes) {
+ $com_elem = $this->createElementNS(COM_NS, $module);
+ if (is_array($attributes) && count($attributes)) {
+ foreach ($attributes as $name=>$value) {
+ $com_elem->setAttribute($name, $value);
+ }
+ }
+ return $com_elem;
+ }
+}
+
+class ExtendedElement extends DOMElement {
+ // ExtendedElement PHP class
+ // this extends the general PHP DOM Element class to simplify some usual constructs
+ //
+ // function appendElement($name, [$value])
+ // appends a DOMDocument::createElement() as a child of this element (see there for params)
+ // returns the new child
+ //
+ // function appendElementXML($name, $xmldata)
+ // appends a DOMDocument::createElement() with the given name as a child of this element,
+ // with an ExtendedDocument::createXMLFragment() of the given XML data inside
+ // returns the new child
+ //
+ // function appendLink($target, [$value])
+ // appends an ExtendedDocument::createElementLink() as a child of this element (see there for params)
+ // returns the new child
+ //
+ // function appendFormDiv($action, $method, $name)
+ // appends an ExtendedDocument::createElementForm() as a child of this element (see there for params)
+ // returns an HTML <div> that is a child of the new child
+ //
+ // function appendInputHidden($name, $value)
+ // appends an ExtendedDocument::createElementInputHidden() as a child of this element (see there for params)
+ // returns the new child
+ //
+ // function appendInputText($name, $maxlength, $size, [$id], [$value])
+ // appends an ExtendedDocument::createElementInputText() as a child of this element (see there for params)
+ // returns the new child
+ //
+ // function appendInputRadio($name, $id, $value, $checked)
+ // appends an ExtendedDocument::createElementInputRadio() as a child of this element (see there for params)
+ // returns the new child
+ //
+ // function appendInputCheckbox($name, $id, $value, $checked)
+ // appends an ExtendedDocument::createElementInputCheckbox() as a child of this element (see there for params)
+ // returns the new child
+ //
+ // function appendInputSubmit($value)
+ // appends an ExtendedDocument::createElementInputSubmit() as a child of this element (see there for params)
+ // returns the new child
+ //
+ // function appendTextArea($name, $columns, $rows, [$id], [$value])
+ // appends an ExtendedDocument::createElementTextArea() as a child of this element (see there for params)
+ // returns the new child
+ //
+ // function appendElementSelect($name, [$id], [$options], [$default])
+ // appends an ExtendedDocument::createElementSelect() as a child of this element (see there for params)
+ // returns the new child
+ //
+ // function appendElementOption($key, $desc, [$selected])
+ // appends an ExtendedDocument::createElementOption() as a child of this element (see there for params)
+ // returns the new child
+ //
+ // function appendLabel($for_id, $value)
+ // appends an ExtendedDocument::createElementLabel() as a child of this element (see there for params)
+ // returns the new child
+ //
+ // function appendText($text)
+ // appends a DOMDocument::createTextNode() as a child of this element (see there for params)
+ // returns the new child
+ //
+ // function appendHTMLMarkup($htmldata)
+ // appends a representation of the HTML data as children of this element
+ // NO return value!
+ //
+ // function appendXMLMarkup($xmldata)
+ // appends a representation of the XML data as children of this element
+ // NO return value!
+ //
+ // function appendJSElement($jsdata)
+ // appends an ExtendedDocument::createElementJS() as a child of this element (see there for params)
+ // NO return value!
+ //
+ // function appendCOMElement($module, $attributes)
+ // appends an ExtendedDocument::createCOMElement() as a child of this element (see there for params)
+ // returns the new child
+
+ function appendElement($name, $value = '') {
+ return $this->appendChild($this->ownerDocument->createElement($name, $value));
+ }
+ function appendElementXML($name, $xmldata) {
+ $aelem = $this->appendChild($this->ownerDocument->createElement($name));
+ $aelem->appendXMLMarkup($xmldata);
+ return $aelem;
+ }
+ function appendLink($target, $value = '') {
+ return $this->appendChild($this->ownerDocument->createElementLink($target, $value));
+ }
+ function appendFormDiv($action, $method, $name) {
+ $formelem = $this->appendChild($this->ownerDocument->createElementForm($action, $method, $name));
+ return $formelem->appendElement('div');
+ }
+ function appendInputHidden($name, $value) {
+ return $this->appendChild($this->ownerDocument->createElementInputHidden($name, $value));
+ }
+ function appendInputText($name, $maxlength, $size, $id = null, $value = null) {
+ return $this->appendChild($this->ownerDocument->createElementInputText($name, $maxlength, $size, $id, $value));
+ }
+ function appendInputRadio($name, $id, $value, $checked) {
+ return $this->appendChild($this->ownerDocument->createElementInputRadio($name, $id, $value, $checked));
+ }
+ function appendInputCheckbox($name, $id, $value, $checked) {
+ return $this->appendChild($this->ownerDocument->createElementInputCheckbox($name, $id, $value, $checked));
+ }
+ function appendInputSubmit($value) {
+ return $this->appendChild($this->ownerDocument->createElementInputSubmit($value));
+ }
+ function appendTextArea($name, $columns, $rows, $id = null, $value = null) {
+ return $this->appendChild($this->ownerDocument->createElementTextArea($name, $columns, $rows, $id, $value));
+ }
+ function appendElementSelect($name, $id = null, $options = array(), $default = null) {
+ return $this->appendChild($this->ownerDocument->createElementSelect($name, $id, $options, $default));
+ }
+ function appendElementOption($key, $desc, $selected = false) {
+ return $this->appendChild($this->ownerDocument->createElementOption($key, $desc, $selected));
+ }
+ function appendLabel($for_id, $value) {
+ return $this->appendChild($this->ownerDocument->createElementLabel($for_id, $value));
+ }
+ function appendText($text) {
+ return $this->appendChild($this->ownerDocument->createTextNode($text));
+ }
+ function appendHTMLMarkup($htmldata) {
+ $this->ownerDocument->appendHTMLMarkup($htmldata, $this);
+ }
+ function appendXMLMarkup($xmldata) {
+ $this->ownerDocument->appendXMLMarkup($xmldata, $this);
+ }
+ function appendJSElement($jsdata) {
+ $this->appendChild($this->ownerDocument->createElementJS($jsdata));
+ }
+ function appendCOMElement($module, $attributes) {
+ $this->appendChild($this->ownerDocument->createCOMElement($module, $attributes));
+ }
+}
+
+class ExtendedDocumentFragment extends DOMDocumentFragment {
+ // ExtendedDocumentFragment PHP class
+ // this extends the general PHP DOM Document Fragment class to simplify some usual constructs
+ //
+ // function appendElement($name, [$value])
+ // appends a DOMDocument::createElement() as a child of this fragment (see there for params)
+ // returns the new child
+ //
+ // function appendElementXML($name, $xmldata)
+ // appends a DOMDocument::createElement() with the given name as a child of this fragment,
+ // with an ExtendedDocument::createXMLFragment() of the given XML data inside
+ // returns the new child
+ //
+ // function appendLink($target, [$value])
+ // appends an ExtendedDocument::createElementLink() as a child of this fragment (see there for params)
+ // returns the new child
+ //
+ // function appendFormDiv($action, $method, $name)
+ // appends an ExtendedDocument::createElementForm() as a child of this fragment (see there for params)
+ // returns an HTML <div> that is a child of the new child
+ //
+ // function appendInputHidden($name, $value)
+ // appends an ExtendedDocument::createElementInputHidden() as a child of this fragment (see there for params)
+ // returns the new child
+ //
+ // function appendInputText($name, $maxlength, $size, [$id], [$value])
+ // appends an ExtendedDocument::createElementInputText() as a child of this fragment (see there for params)
+ // returns the new child
+ //
+ // function appendInputRadio($name, $id, $value, $checked)
+ // appends an ExtendedDocument::createElementInputRadio() as a child of this fragment (see there for params)
+ // returns the new child
+ //
+ // function appendInputCheckbox($name, $id, $value, $checked)
+ // appends an ExtendedDocument::createElementInputCheckbox() as a child of this fragment (see there for params)
+ // returns the new child
+ //
+ // function appendInputSubmit($value)
+ // appends an ExtendedDocument::createElementInputSubmit() as a child of this fragment (see there for params)
+ // returns the new child
+ //
+ // function appendTextArea($name, $columns, $rows, [$id], [$value])
+ // appends an ExtendedDocument::createElementTextArea() as a child of this fragment (see there for params)
+ // returns the new child
+ //
+ // function appendElementSelect($name, [$id], [$options], [$default])
+ // appends an ExtendedDocument::createElementSelect() as a child of this fragment (see there for params)
+ // returns the new child
+ //
+ // function appendElementOption($key, $desc, [$selected])
+ // appends an ExtendedDocument::createElementOption() as a child of this fragment (see there for params)
+ // returns the new child
+ //
+ // function appendLabel($for_id, $value)
+ // appends an ExtendedDocument::createElementLabel() as a child of this fragment (see there for params)
+ // returns the new child
+ //
+ // function appendText($text)
+ // appends a DOMDocument::createTextNode() as a child of this fragment (see there for params)
+ // returns the new child
+ //
+ // function appendHTMLMarkup($htmldata)
+ // appends a representation of the HTML data as children of this fragment
+ // NO return value!
+ //
+ // function appendXMLMarkup($xmldata)
+ // appends a representation of the XML data as children of this fragment
+ // NO return value!
+ //
+ // function appendJSElement($jsdata)
+ // appends an ExtendedDocument::createElementJS() as a child of this fragment (see there for params)
+ // NO return value!
+ //
+ // function appendCOMElement($module, $attributes)
+ // appends an ExtendedDocument::createCOMElement() as a child of this fragment (see there for params)
+ // returns the new child
+
+ function appendElement($name, $value = '') {
+ return $this->appendChild($this->ownerDocument->createElement($name, $value));
+ }
+ function appendElementXML($name, $xmldata) {
+ $aelem = $this->appendChild($this->ownerDocument->createElement($name));
+ $aelem->appendXMLMarkup($xmldata);
+ return $aelem;
+ }
+ function appendLink($target, $value = '') {
+ return $this->appendChild($this->ownerDocument->createElementLink($target, $value));
+ }
+ function appendFormDiv($action, $method, $name) {
+ $formelem = $this->appendChild($this->ownerDocument->createElementForm($action, $method, $name));
+ return $formelem->appendElement('div');
+ }
+ function appendInputHidden($name, $value) {
+ return $this->appendChild($this->ownerDocument->createElementInputHidden($name, $value));
+ }
+ function appendInputText($name, $maxlength, $size, $id = null, $value = null) {
+ return $this->appendChild($this->ownerDocument->createElementInputText($name, $maxlength, $size, $id, $value));
+ }
+ function appendInputRadio($name, $id, $value, $checked) {
+ return $this->appendChild($this->ownerDocument->createElementInputRadio($name, $id, $value, $checked));
+ }
+ function appendInputCheckbox($name, $id, $value, $checked) {
+ return $this->appendChild($this->ownerDocument->createElementInputCheckbox($name, $id, $value, $checked));
+ }
+ function appendInputSubmit($value) {
+ return $this->appendChild($this->ownerDocument->createElementInputSubmit($value));
+ }
+ function appendTextArea($name, $columns, $rows, $id = null, $value = null) {
+ return $this->appendChild($this->ownerDocument->createElementTextArea($name, $columns, $rows, $id, $value));
+ }
+ function appendElementSelect($name, $id = null, $options = array(), $default = null) {
+ return $this->appendChild($this->ownerDocument->createElementSelect($name, $id, $options, $default));
+ }
+ function appendElementOption($key, $desc, $selected = false) {
+ return $this->appendChild($this->ownerDocument->createElementOption($key, $desc, $selected));
+ }
+ function appendLabel($for_id, $value) {
+ return $this->appendChild($this->ownerDocument->createElementLabel($for_id, $value));
+ }
+ function appendText($text) {
+ return $this->appendChild($this->ownerDocument->createTextNode($text));
+ }
+ function appendHTMLMarkup($htmldata) {
+ $this->ownerDocument->appendHTMLMarkup($htmldata, $this);
+ }
+ function appendXMLMarkup($xmldata) {
+ $this->ownerDocument->appendXMLMarkup($xmldata, $this);
+ }
+ function appendJSElement($jsdata) {
+ $this->appendChild($this->ownerDocument->createElementJS($jsdata));
+ }
+ function appendCOMElement($module, $attributes) {
+ $this->appendChild($this->ownerDocument->createCOMElement($module, $attributes));
+ }
+}
+?>
// public function addHeaderAddress($hname, $email, [$name])
// add an address header to the mail, possibly with both name and mail parts
//
+ // public function setCharset($newcharset)
+ // set charset for this mail
+ //
// public function addMailText($textpart)
// add some text to the mail
//
// public function addAttachment($aname, $acontent, [$atype])
// add an attachment to the mail, use given file name, content and MIME type (defaults to application/octet-stream)
//
+ // public function getAddresses([$addrtype])
+ // returns an array of all addresses this mail gets sent to
+ // fields: email, name, addrtype
+ // addrtype is one of to/cc/bcc
+ // the $addrtype parameter is a comma-separated list of such types, default: all of them
+ //
// public function send()
// really send the mail
//
$this->headers[] = array('name' => $hname, 'content' => $hcontent);
}
+ public function setCharset($newcharset) { $this->charset = $newcharset; }
+
public function addMailText($textpart) { $this->mailtext .= $textpart; }
public function addAttachment($aname, $acontent, $atype = 'application/octet-stream') {
$this->attachments[] = array('name' => $aname, 'content' => $acontent, 'type' => $atype);
}
+ public function getAddresses($addrtype = null) {
+ // returns all addresses this mail gets sent to
+ if (!is_array($addrtype)) {
+ if (strlen($addrtype)) { $addrtype = explode(',', strtolower($addrtype)); }
+ else { $addrtype = array('to','cc','bcc'); }
+ }
+ $mailaddresses = array();
+
+ if (in_array('to', $addrtype)) {
+ foreach ($this->recipients as $address) {
+ if (strlen(@$address['mail'])) {
+ $mailaddresses[] = array('mail'=>$address['mail'],
+ 'name'=>strlen($address['name'])?$address['name']:'',
+ 'addrtype'=>'to');
+ }
+ }
+ }
+ if (in_array('cc', $addrtype)) {
+ foreach ($this->cc as $address) {
+ if (strlen(@$address['mail'])) {
+ $mailaddresses[] = array('mail'=>$address['mail'],
+ 'name'=>strlen($address['name'])?$address['name']:'',
+ 'addrtype'=>'cc');
+ }
+ }
+ }
+ if (in_array('bcc', $addrtype)) {
+ foreach ($this->bcc as $address) {
+ if (strlen(@$address['mail'])) {
+ $mailaddresses[] = array('mail'=>$address['mail'],
+ 'name'=>strlen($address['name'])?$address['name']:'',
+ 'addrtype'=>'bcc');
+ }
+ }
+ }
+
+ return $mailaddresses;
+ }
+
public function send() {
global $util;
$mtxt = '';
if (count($this->recipients)) {
$recpt = '';
foreach ($this->recipients as $address) {
- if (strlen($address['name'])) { $recpt .= $this->mimeencode($address['name'], true).' <'.$address['mail'].'>,'; }
- else { $recpt .= $address['mail'].','; }
+ if (strlen(@$address['mail'])) {
+ if (strlen($address['name'])) { $recpt .= $this->mimeencode($address['name'], true).' <'.$address['mail'].'>,'; }
+ else { $recpt .= $address['mail'].','; }
+ }
}
$recpt = preg_replace('/,$/', '', $recpt);
}
+ if (!strlen($recpt)) {
+ return null;
+ }
if (count($this->cc)) {
$adrs = '';
foreach ($this->cc as $address) {
}
return $mText;
}
-
-
}
?>
// else it's the configuration for this one RRD
// currently only a config array is supported, XML config is planned
//
+ // private $rrdtool_bin
+ // RRDtool binary to use
+ //
// private $rrd_file
// RRD file name
//
// private function text_quote($text)
// return a quoted/escaped text for use in rrdtool commandline text fields
+ private $rrdtool_bin = '/usr/bin/rrdtool';
+
private $rrd_file = null;
private $basename = null;
private $basedir = null;
function __construct($rrdconfig, $conf_id = null) {
// ***** init RRD stat module *****
$this->mod_textdomain = 'class_rrdstat';
- $mod_charset = 'iso-8859-15';
+ $mod_charset = 'utf-8';
bindtextdomain($this->mod_textdomain, class_exists('baseutils')?baseutils::getDir('locale'):'locale/');
bind_textdomain_codeset($this->mod_textdomain, $mod_charset);
$iinfo = isset($complete_conf[$conf_id])?$complete_conf[$conf_id]:array();
if (isset($complete_conf['*'])) {
$iinfo = (array)$iinfo + (array)$complete_conf['*'];
- if (isset($complete_conf['*']['graph'])) { $iinfo['graph'] = (array)$iinfo['graph'] + (array)$complete_conf['*']['graph']; }
- if (isset($complete_conf['*']['page'])) { $iinfo['page'] = (array)$iinfo['page'] + (array)$complete_conf['*']['page']; }
+ if (isset($complete_conf['*']['graph'])) {
+ $iinfo['graph'] = (array)$iinfo['graph'] + (array)$complete_conf['*']['graph'];
+ }
+ if (isset($complete_conf['*']['page'])) {
+ $iinfo['page'] = (array)$iinfo['page'] + (array)$complete_conf['*']['page'];
+ }
}
}
else {
}
- // MRTG-style RRD "database", see http://people.ee.ethz.ch/~oetiker/webtools/rrdtool/tut/rrdtutorial.en.html
+ // MRTG-style RRD "database", see http://oss.oetiker.ch/rrdtool/tut/rrdtutorial.en.html
//
// archives (RRAs):
// 600 samples of 5 minutes (2 days and 2 hours)
// return RRDtool version
static $version;
if (!isset($version)) {
- $create_cmd = 'rrdtool --version';
+ $create_cmd = $this->rrdtool_bin.' --version';
$return = `$create_cmd 2>&1`;
if (strpos($return, 'ERROR') !== false) {
trigger_error($this->rrd_file.' - rrd version error: '.$return, E_USER_WARNING);
// create RRD file
// compose create command
- $create_cmd = 'rrdtool create '.$this->rrd_file.' --step '.$this->rrd_step;
+ $create_cmd = $this->rrdtool_bin.' create '.$this->rrd_file.' --step '.$this->rrd_step;
foreach ($this->rrd_fields as $ds) {
if (!isset($ds['type'])) { $ds['type'] = 'COUNTER'; }
if (!isset($ds['heartbeat'])) { $ds['heartbeat'] = 2*$this->rrd_step; }
array_walk($upvals, $walkfunc);
$return = null;
if (count($upvals)) {
- $update_cmd = 'rrdtool update '.$this->rrd_file.($key_names?' --template '.implode(':', array_keys($upvals)):'').' N:'.implode(':', $upvals);
+ $update_cmd = $this->rrdtool_bin.' update '.$this->rrd_file
+ .($key_names?' --template '.implode(':', array_keys($upvals)):'').' N:'.implode(':', $upvals);
$return = `$update_cmd 2>&1`;
}
public function fetch($cf = 'AVERAGE', $resolution = null, $start = null, $end = null) {
// fetch data from a RRD
- if (!in_array($this->status, array('ok','readonly'))) { trigger_error('Error: rrd status is '.$this->status, E_USER_WARNING); return false; }
+ if (!in_array($this->status, array('ok','readonly'))) {
+ trigger_error('Error: rrd status is '.$this->status, E_USER_WARNING); return false;
+ }
if (!in_array($cf, array('AVERAGE','MIN','MAX','LAST'))) { $cf = 'AVERAGE'; }
if (!is_numeric($resolution)) { $resolution = $this->rrd_step; }
elseif ($start < 0) { $start += $end; }
$start = intval($start/$resolution)*$resolution;
- $fetch_cmd = 'rrdtool fetch '.$this->rrd_file.' '.$cf.' --resolution '.$resolution.' --start '.$start.' --end '.$end;
+ $fetch_cmd = $this->rrdtool_bin.' fetch '.$this->rrd_file.' '.$cf.' --resolution '.$resolution
+ .' --start '.$start.' --end '.$end;
$return = `$fetch_cmd 2>&1`;
if (strpos($return, 'ERROR') !== false) {
// fetch time of last update in this RRD file
static $last_update;
if (!isset($last_update) && in_array($this->status, array('ok','readonly'))) {
- $last_cmd = 'rrdtool last '.$this->rrd_file;
+ $last_cmd = $this->rrdtool_bin.' last '.$this->rrd_file;
$return = trim(`$last_cmd 2>&1`);
$last_update = is_numeric($return)?$return:null;
}
// create a RRD graph
static $gColors;
if (!isset($gColors)) {
- $gColors = array('#00CC00','#0000FF','#000000','#FF0000','#00FF00','#FFFF00','#FF00FF','#00FFFF','#808080','#800000','#008000','#000080','#808000','#800080','#008080','#C0C0C0');
+ $gColors = array('#00CC00','#0000FF','#000000','#FF0000','#00FF00','#FFFF00','#FF00FF','#00FFFF',
+ '#808080','#800000','#008000','#000080','#808000','#800080','#008080','#C0C0C0');
}
- if (!in_array($this->status, array('ok','readonly','graphonly'))) { trigger_error('Error: rrd status is '.$this->status, E_USER_WARNING); return false; }
+ if (!in_array($this->status, array('ok','readonly','graphonly'))) {
+ trigger_error('Error: rrd status is '.$this->status, E_USER_WARNING); return false;
+ }
// assemble configuration
$gconf = (array)$extra;
foreach ($grow_def as $key=>$erow) {
if (isset($erow['name']) && strlen($erow['name'])) {
if (!isset($erow['scale']) && isset($gconf['scale'])) { $erow['scale'] = $gconf['scale']; }
- if (!isset($erow['scale_time_src']) && isset($gconf['scale_time_src'])) { $erow['scale_time_src'] = $gconf['scale_time_src']; }
- if (!isset($erow['scale_time_tgt']) && isset($gconf['scale_time_tgt'])) { $erow['scale_time_tgt'] = $gconf['scale_time_tgt']; }
+ if (!isset($erow['scale_time_src']) && isset($gconf['scale_time_src'])) {
+ $erow['scale_time_src'] = $gconf['scale_time_src'];
+ }
+ if (!isset($erow['scale_time_tgt']) && isset($gconf['scale_time_tgt'])) {
+ $erow['scale_time_tgt'] = $gconf['scale_time_tgt'];
+ }
foreach (array('scale_time_src','scale_time_tgt') as $st) {
if (!isset($erow[$st]) || !is_numeric($erow[$st])) {
switch (@$erow[$st]) {
}
if (isset($crow['cf'])) {
if ($this->rrd_version() >= '1.2') {
- $graphrows[] = array('dType'=>'VDEF', 'name'=>$srow['name'].'_'.$crow['cf'], 'rpn_expr'=>$srow['name'].','.$crow['cf']);
+ $graphrows[] = array('dType'=>'VDEF', 'name'=>$srow['name'].'_'.$crow['cf'],
+ 'rpn_expr'=>$srow['name'].','.$crow['cf']);
}
}
elseif (isset($crow['rpn_expr'])) {
$textprefix = isset($grow['desc'])?$grow['desc']:(isset($grow['legend'])?$grow['legend']:$grow['name']);
if ($this->rrd_version() >= '1.2') {
$graphrows[] = array('dType'=>'VDEF', 'name'=>'_'.$grow['name'].'__max', 'rpn_expr'=>$grow['name'].',MAXIMUM');
- $specialrows[] = array('sType'=>'PRINT', 'name'=>'_'.$grow['name'].'__max', 'text'=>$textprefix.'|'.dgettext($td, 'Maximum').'|%.2lf%s');
+ $specialrows[] = array('sType'=>'PRINT', 'name'=>'_'.$grow['name'].'__max',
+ 'text'=>$textprefix.'|'.dgettext($td, 'Maximum').'|%.2lf%s');
$graphrows[] = array('dType'=>'VDEF', 'name'=>'_'.$grow['name'].'__avg', 'rpn_expr'=>$grow['name'].',AVERAGE');
- $specialrows[] = array('sType'=>'PRINT', 'name'=>'_'.$grow['name'].'__avg', 'text'=>$textprefix.'|'.dgettext($td, 'Average').'|%.2lf%s');
+ $specialrows[] = array('sType'=>'PRINT', 'name'=>'_'.$grow['name'].'__avg',
+ 'text'=>$textprefix.'|'.dgettext($td, 'Average').'|%.2lf%s');
$graphrows[] = array('dType'=>'VDEF', 'name'=>'_'.$grow['name'].'__last', 'rpn_expr'=>$grow['name'].',LAST');
- $specialrows[] = array('sType'=>'PRINT', 'name'=>'_'.$grow['name'].'__last', 'text'=>$textprefix.'|'.dgettext($td, 'Current').'|%.2lf%s');
+ $specialrows[] = array('sType'=>'PRINT', 'name'=>'_'.$grow['name'].'__last',
+ 'text'=>$textprefix.'|'.dgettext($td, 'Current').'|%.2lf%s');
}
else {
- $specialrows[] = array('sType'=>'PRINT', 'name'=>$grow['name'], 'cf'=>'MAX', 'text'=>$textprefix.'|'.dgettext($td, 'Maximum').'|%.2lf%s');
- $specialrows[] = array('sType'=>'PRINT', 'name'=>$grow['name'], 'cf'=>'AVERAGE', 'text'=>$textprefix.'|'.dgettext($td, 'Average').'|%.2lf%s');
- $specialrows[] = array('sType'=>'PRINT', 'name'=>$grow['name'], 'cf'=>'LAST', 'text'=>$textprefix.'|'.dgettext($td, 'Current').'|%.2lf%s');
+ $specialrows[] = array('sType'=>'PRINT', 'name'=>$grow['name'], 'cf'=>'MAX',
+ 'text'=>$textprefix.'|'.dgettext($td, 'Maximum').'|%.2lf%s');
+ $specialrows[] = array('sType'=>'PRINT', 'name'=>$grow['name'], 'cf'=>'AVERAGE',
+ 'text'=>$textprefix.'|'.dgettext($td, 'Average').'|%.2lf%s');
+ $specialrows[] = array('sType'=>'PRINT', 'name'=>$grow['name'], 'cf'=>'LAST',
+ 'text'=>$textprefix.'|'.dgettext($td, 'Current').'|%.2lf%s');
}
}
}
$addSpecial .= ':'.$this->text_quote($srow['text']);
}
- $graph_cmd = 'rrdtool graph '.str_replace('*', '\*', $fname.$gOpts.$gDefs.$gGraphs.$addSpecial);
+ $graph_cmd = $this->rrdtool_bin.' graph '.str_replace('*', '\*', $fname.$gOpts.$gDefs.$gGraphs.$addSpecial);
$return = `$graph_cmd 2>&1`;
if (strpos($return, 'ERROR') !== false) {
$out .= '<body>'."\n";
$out .= '<h1>'.$ptitle.'</h1>'."\n";
- if (isset($pconf['text_intro']) && strlen($pconf['text_intro'])) { $out .= '<p class="intro">'.$pconf['text_intro'].'</p>'; }
+ if (isset($pconf['text_intro']) && strlen($pconf['text_intro'])) {
+ $out .= '<p class="intro">'.$pconf['text_intro'].'</p>';
+ }
$stats = $this->h_page_statsArray($pconf);
$s_ptitle = $this->config_all[$sname]['page']['title_page'];
}
else {
- $s_ptitle = isset($s_psub)?sprintf(dgettext($td, '%s (%s) statistics'), $sname, $s_psub):sprintf(dgettext($td, '%s statistics'), $sname);
+ $s_ptitle = isset($s_psub)
+ ?sprintf(dgettext($td, '%s (%s) statistics'), $sname, $s_psub)
+ :sprintf(dgettext($td, '%s statistics'), $sname);
}
if (!isset($pconf['hide_titles']) || !$pconf['hide_titles']) {
$out .= '<h2>'.$s_ptitle.'</h2>'."\n";
$out .= '<a href="'.$sURL.'">';
$out .= '<img src="'.$gURL.'"';
$out .= ' alt="'.$s_rrd->basename.(!is_null($g_sub)?' - '.$g_sub:'').' - '.$tframe.'" class="rrdgraph"';
- if (isset($gmeta['width']) && isset($gmeta['height'])) { $out .= ' style="width:'.$gmeta['width'].'px;height:'.$gmeta['height'].'px;"'; }
+ if (isset($gmeta['width']) && isset($gmeta['height'])) {
+ $out .= ' style="width:'.$gmeta['width'].'px;height:'.$gmeta['height'].'px;"';
+ }
$out .= '></a>'."\n";
}
else {
$out .= '<body>'."\n";
$out .= '<h1>'.$ptitle.'</h1>'."\n";
- if (isset($pconf['text_intro']) && strlen($pconf['text_intro'])) { $out .= '<p class="intro">'.$pconf['text_intro'].'</p>'."\n"; }
+ if (isset($pconf['text_intro']) && strlen($pconf['text_intro'])) {
+ $out .= '<p class="intro">'.$pconf['text_intro'].'</p>'."\n";
+ }
if (!isset($pconf['show_update']) || $pconf['show_update']) {
$out .= '<p class="last_up">';
if (is_null($this->last_update())) { $up_time = dgettext($td, 'unknown'); }
$out .= '<h2>'.$gtitle[$tframe].'</h2>'."\n";
$out .= '<img src="'.$gURL.'"';
$out .= ' alt="'.$this->basename.(!is_null($g_sub)?' - '.$g_sub:'').' - '.$tframe.'" class="rrdgraph"';
- if (isset($gmeta['width']) && isset($gmeta['height'])) { $out .= ' style="width:'.$gmeta['width'].'px;height:'.$gmeta['height'].'px;"'; }
+ if (isset($gmeta['width']) && isset($gmeta['height'])) {
+ $out .= ' style="width:'.$gmeta['width'].'px;height:'.$gmeta['height'].'px;"';
+ }
$out .= '>'."\n";
- $colorize_data = (isset($pconf['data_colorize']) && $pconf['data_colorize']) || (!isset($pconf['data_colorize']) && $gmeta['default_colorize']);
+ $colorize_data = (isset($pconf['data_colorize']) && $pconf['data_colorize']) ||
+ (!isset($pconf['data_colorize']) && $gmeta['default_colorize']);
if (isset($gmeta['data']) && count($gmeta['data'])) {
$out .= '<table class="gdata">'."\n";
foreach ($gmeta['data'] as $field=>$gdata) {
// return generic page footer
$out = '<p class="footer">';
$out .= sprintf(dgettext($this->mod_textdomain, 'Statistics created with %s using a library created by %s.'),
- '<a href="http://people.ee.ethz.ch/~oetiker/webtools/rrdtool/">RRDtool</a>',
+ '<a href="http://oss.oetiker.ch/rrdtool/">RRDtool</a>',
'<a href="http://www.kairo.at/">KaiRo.at</a>');
$out .= '</p>'."\n";
return $out;
*
* The Initial Developer of the Original Code is
* KaiRo - Robert Kaiser.
- * Portions created by the Initial Developer are Copyright (C) 2003
+ * Portions created by the Initial Developer are Copyright (C) 2003-2007
* the Initial Developer. All Rights Reserved.
*
* Contributor(s): Robert Kaiser <kairo@kairo.at>
// public function getGeckoDate()
// returns the Gecko date for Gecko-based browsers, null for others
//
+ // public function getGeckoTime()
+ // returns the Gecko build date/time as a unix epoch time number for Gecko-based browsers, null for others
+ //
// *** functions for compat to older versions of this class ***
//
// public function isns()
// get UA brand and version
$this->brand = 'Unknown'; $this->version = null;
// find reasonable defaults
- if (preg_match('|([0-9a-zA-Z\.:()_ -]+)/([0-9a-zA-Z\._+-]+)|', $this->uastring, $regs)) {
+ if (preg_match('|([0-9a-zA-Z\.:()_ -]+)/(\d[0-9a-zA-Z\._+-]*)|', $this->uastring, $regs)) {
$this->brand = trim($regs[1]);
$this->version = $regs[2];
}
- elseif (preg_match('|^([a-zA-Z\._ -]+)[_ -][vV]?([0-9][0-9a-zA-Z\.+]+)|', $this->uastring, $regs)) {
+ elseif (preg_match('|^([a-zA-Z\._ -]+)[_ -][vV]?(\d[0-9a-zA-Z\.+]*)|', $this->uastring, $regs)) {
$this->brand = trim($regs[1]);
$this->version = $regs[2];
}
- elseif (preg_match('|^([a-zA-Z\._ -]+)|', $this->uastring, $regs)) {
+ elseif (preg_match('|^([0-9a-zA-Z\._ -]+)|', $this->uastring, $regs)) {
$this->brand = trim($regs[1]);
$this->version = null;
}
$this->bot = (strpos(strtolower($this->brand), 'bot') !== false)
|| (strpos(strtolower($this->brand), 'crawler') !== false)
- || (strpos(strtolower($this->brand), 'spider') !== false);
+ || (strpos(strtolower($this->brand), 'spider') !== false)
+ || (strpos(strtolower($this->brand), 'search') !== false)
+ || (strpos(strtolower($this->brand), 'seek') !== false);
// search for any real and/or special UAs
if (preg_match('|Netscape6/([0-9a-zA-Z\.+]+)|', $this->uastring, $regs)) {
$this->version = $regs[1];
$this->bot = false;
}
+ elseif (preg_match('|Navigator/([0-9a-zA-Z\.+]+)|', $this->uastring, $regs)) {
+ $this->brand = 'Netscape';
+ $this->version = $regs[1];
+ $this->bot = false;
+ }
elseif (preg_match('|Chimera/([0-9a-zA-Z\.+]+)|', $this->uastring, $regs)) {
$this->brand = 'Chimera';
$this->version = $regs[1];
$this->version = $regs[1];
$this->bot = false;
}
- elseif (preg_match('|Firefox/([0-9a-zA-Z\.+]+)|', $this->uastring, $regs)) {
- $this->brand = 'Firefox';
- $this->version = $regs[1];
- $this->bot = false;
- }
elseif (preg_match('|SeaMonkey/([0-9a-zA-Z\.+]+)|', $this->uastring, $regs)) {
$this->brand = 'SeaMonkey';
$this->version = $regs[1];
$this->bot = false;
}
elseif (preg_match('|Iceape/([0-9a-zA-Z\.+]+)|i', $this->uastring, $regs)) {
- $this->brand = 'IceApe';
+ $this->brand = 'IceApe'; // Debian-rebranded SeaMonkey
$this->version = $regs[1];
$this->bot = false;
}
elseif (preg_match('|Iceweasel/([0-9a-zA-Z\.+]+)|i', $this->uastring, $regs)) {
- $this->brand = 'IceWeasel';
+ $this->brand = 'IceWeasel'; // Debian-rebranded Firefox
+ $this->version = $regs[1];
+ $this->bot = false;
+ }
+ elseif (preg_match('|Icedove/([0-9a-zA-Z\.+]+)|i', $this->uastring, $regs)) {
+ $this->brand = 'IceDove'; // Debian-rebranded Thunderbird
+ $this->version = $regs[1];
+ $this->bot = false;
+ }
+ elseif (preg_match('|BonEcho/([0-9a-zA-Z\.+]+)|i', $this->uastring, $regs)) {
+ $this->brand = 'Bon Echo'; // Firefox 2.0 code name
+ $this->version = $regs[1];
+ $this->bot = false;
+ }
+ elseif (preg_match('|GranParadiso/([0-9a-zA-Z\.+]+)|i', $this->uastring, $regs)) {
+ $this->brand = 'Gran Paradiso'; // Firefox 3.0 code name
+ $this->version = $regs[1];
+ $this->bot = false;
+ }
+ elseif (preg_match('|Shiretoko/([0-9a-zA-Z\.+]+)|i', $this->uastring, $regs)) {
+ $this->brand = 'Shiretoko'; // Firefox 3.5 code name
+ $this->version = $regs[1];
+ $this->bot = false;
+ }
+ elseif (preg_match('|Namoroka/([0-9a-zA-Z\.+]+)|i', $this->uastring, $regs)) {
+ $this->brand = 'Namoroka'; // Firefox 3.6 code name
+ $this->version = $regs[1];
+ $this->bot = false;
+ }
+ elseif (preg_match('|Lorentz/([0-9a-zA-Z\.+]+)|i', $this->uastring, $regs)) {
+ $this->brand = 'Lorentz'; // Firefox 3.6 (with OOPP) code name
+ $this->version = $regs[1];
+ $this->bot = false;
+ }
+ elseif (preg_match('|Minefield/([0-9a-zA-Z\.+]+)|i', $this->uastring, $regs)) {
+ $this->brand = 'Minefield'; // Firefox development nightly code name
+ $this->version = $regs[1];
+ $this->bot = false;
+ }
+ elseif (preg_match('|PmWFx/([0-9a-zA-Z\.+]+)|i', $this->uastring, $regs)) {
+ $this->brand = 'PmW-Firefox';
+ $this->version = $regs[1];
+ $this->bot = false;
+ }
+ elseif (preg_match('|BeZillaBrowser/([0-9a-zA-Z\.+]+)|i', $this->uastring, $regs)) {
+ $this->brand = 'BeZillaBrowser';
+ $this->version = $regs[1];
+ $this->bot = false;
+ }
+ elseif (preg_match('|Songbird/([0-9a-zA-Z\.+]+)|i', $this->uastring, $regs)) {
+ $this->brand = 'Songbird';
+ $this->version = $regs[1];
+ $this->bot = false;
+ }
+ elseif (preg_match('|Lanikai/([0-9a-zA-Z\.+]+)|i', $this->uastring, $regs)) {
+ $this->brand = 'Lanikai'; // Thunderbird 3.1 code name
+ $this->version = $regs[1];
+ $this->bot = false;
+ }
+ elseif (preg_match('|Shredder/([0-9a-zA-Z\.+]+)|i', $this->uastring, $regs)) {
+ $this->brand = 'Shredder'; // Thunderbird development nightly code name
+ $this->version = $regs[1];
+ $this->bot = false;
+ }
+ elseif (preg_match('|prism/([0-9a-zA-Z\.+]+)|i', $this->uastring, $regs)) {
+ $this->brand = 'Prism';
+ $this->version = $regs[1];
+ $this->bot = false;
+ }
+ elseif (preg_match('|Minimo/([0-9a-zA-Z\.+]+)|i', $this->uastring, $regs)) {
+ $this->brand = 'Minimo';
+ $this->version = $regs[1];
+ $this->bot = false;
+ }
+ elseif (preg_match('|Fennec/([0-9a-zA-Z\.+]+)|i', $this->uastring, $regs)) {
+ $this->brand = 'Fennec'; // Firefox mobile code name
$this->version = $regs[1];
$this->bot = false;
}
$this->version = $regs[1];
$this->bot = false;
}
- elseif (preg_match('|rv:([0-9a-zA-Z\.+]+)|', $this->uastring, $regs) &&
- strstr($this->uastring, "Mozilla/") && strstr($this->uastring, "Gecko/")) {
- $this->brand = 'Mozilla';
+ elseif (preg_match('|Tablet browser ([0-9a-zA-Z\.+]+)|', $this->uastring, $regs)) {
+ $this->brand = 'microB';
$this->version = $regs[1];
$this->bot = false;
}
- elseif (preg_match('|m([0-9]+)\)|', $this->uastring, $regs) &&
- strstr($this->uastring, "Mozilla/") && strstr($this->uastring, "Gecko/")) {
- $this->brand = 'Mozilla';
- $this->version = 'M'.$regs[1];
+ elseif (preg_match('|Maemo Browser ([0-9a-zA-Z\.+]+)|', $this->uastring, $regs)) {
+ $this->brand = 'microB';
+ $this->version = $regs[1];
$this->bot = false;
}
elseif (preg_match('|Opera\/([^\(]+) \(.*; Opera Mini; |', $this->uastring, $regs)) {
$this->version = $regs[1];
$this->bot = false;
}
+ elseif (preg_match('|Chrome/([0-9a-zA-Z\.+]+)|', $this->uastring, $regs)) {
+ $this->brand = 'Chrome';
+ $this->version = $regs[1];
+ $this->bot = false;
+ }
elseif (preg_match('|Safari/([0-9a-zA-Z\.+]+)|', $this->uastring, $regs)) {
$this->brand = 'Safari';
- $this->version = $regs[1];
+ if (preg_match('|Version/([0-9a-zA-Z\.+]+)|', $this->uastring, $vregs)) {
+ $this->version = $vregs[1];
+ }
+ else {
+ $this->version = '('.$regs[1].')';
+ }
$this->bot = false;
}
elseif (preg_match('|AppleWebKit/([0-9a-zA-Z\.+]+)|', $this->uastring, $regs)) {
$this->version = $regs[1];
$this->bot = false;
}
+ elseif (preg_match('|Spinn3r ([0-9a-zA-Z\.+]+)|', $this->uastring, $regs)) { /* looks like Gecko! */
+ $this->brand = 'Spinn3r';
+ $this->version = $regs[1];
+ $this->bot = true;
+ }
+ elseif (preg_match('|Butterfly/([0-9a-zA-Z\.+]+)|', $this->uastring, $regs)) { /* looks like Gecko! */
+ $this->brand = 'Butterfly';
+ $this->version = $regs[1];
+ $this->bot = true;
+ }
+ elseif (preg_match('|Googlebot/([0-9a-zA-Z\.+]+)|', $this->uastring, $regs)) { /* looks like Gecko! */
+ $this->brand = 'Googlebot';
+ $this->version = $regs[1];
+ $this->bot = true;
+ }
+ elseif (preg_match('|Firefox/([0-9a-zA-Z\.+]+)|', $this->uastring, $regs)) {
+ $this->brand = 'Firefox';
+ $this->version = $regs[1];
+ $this->bot = false;
+ }
+ elseif (preg_match('|Thunderbird/([0-9a-zA-Z\.+]+)|i', $this->uastring, $regs)) {
+ $this->brand = 'Thunderbird';
+ $this->version = $regs[1];
+ $this->bot = false;
+ }
+ elseif (preg_match('|rv:([0-9a-zA-Z\.+]+)|', $this->uastring, $regs) &&
+ strstr($this->uastring, "Mozilla/") && strstr($this->uastring, "Gecko/")) {
+ $this->brand = 'Mozilla';
+ $this->version = $regs[1];
+ $this->bot = false;
+ }
+ elseif (preg_match('|m([0-9]+)\)|', $this->uastring, $regs) &&
+ strstr($this->uastring, "Mozilla/") && strstr($this->uastring, "Gecko/")) {
+ $this->brand = 'Mozilla';
+ $this->version = 'M'.$regs[1];
+ $this->bot = false;
+ }
+ elseif (preg_match('|Baiduspider|i', $this->uastring)) {
+ $this->brand = 'BaiDuSpider';
+ $this->version = null;
+ $this->bot = true;
+ }
+ elseif (preg_match('|YodaoBot-Mobile/([0-9a-zA-Z\.+]+)|', $this->uastring, $regs)) { /* looks like Gecko! */
+ $this->brand = 'YodaoBot-Mobile';
+ $this->version = $regs[1];
+ $this->bot = true;
+ }
+ elseif (preg_match('|Googlebot-Mobile/([0-9a-zA-Z\.+]+)|', $this->uastring, $regs)) { /* looks like Gecko! */
+ $this->brand = 'Googlebot-Mobile';
+ $this->version = $regs[1];
+ $this->bot = true;
+ }
+ elseif (preg_match('|FASTMobileCrawl/([0-9a-zA-Z\.+]+)|', $this->uastring, $regs)) { /* looks like Gecko! */
+ $this->brand = 'FASTMobileCrawl';
+ $this->version = $regs[1];
+ $this->bot = true;
+ }
elseif (preg_match('|MSFrontPage/([0-9a-zA-Z\.+]+)|', $this->uastring, $regs)) {
$this->brand = 'Microsoft FrontPage';
$this->version = $regs[1];
$this->version = $regs[1];
$this->bot = false;
}
+ elseif (preg_match('|Browser/Obigo-([0-9A-Z]+/[0-9a-zA-Z\.+]+)|', $this->uastring, $regs)) {
+ $this->brand = 'Obigo';
+ $this->version = $regs[1];
+ $this->bot = false;
+ }
elseif (preg_match('|Nokia([0-9a-zA-Z]+/[0-9a-zA-Z\.+]+)|', $this->uastring, $regs)) {
$this->brand = 'Nokia';
$this->version = $regs[1];
$this->version = $regs[1];
$this->bot = false;
}
+ elseif (preg_match('|NewsFox/([0-9a-zA-Z\.+]+)|', $this->uastring, $regs)) {
+ $this->brand = 'NewsFox';
+ $this->version = $regs[1];
+ $this->bot = false;
+ }
+ elseif (preg_match('|rdfbot/([0-9a-zA-Z\.+]+)|', $this->uastring, $regs)) {
+ $this->brand = 'rdfbot';
+ $this->version = $regs[1];
+ $this->bot = false;
+ }
elseif (preg_match('|IBM-WebExplorer-DLL/v([0-9a-zA-Z\.+]+)|', $this->uastring, $regs)) {
$this->brand = 'WebExplorer';
$this->version = $regs[1];
$this->version = $regs[1];
$this->bot = false;
}
- elseif (preg_match('|wget[/ ]([0-9a-zA-Z\.+]+)|i', $this->uastring, $regs)) {
- $this->brand = 'wget';
- $this->version = $regs[1];
- $this->bot = false;
- }
elseif (preg_match('|WinHttp.WinHttpRequest.([0-9\.]+)|i', $this->uastring, $regs)) {
$this->brand = 'WinHttpRequest';
$this->version = $regs[1];
$this->version = $regs[1];
$this->bot = true;
}
- elseif (preg_match('|Googlebot/?([0-9a-zA-Z\.+]+)?|', $this->uastring, $regs)) {
- $this->brand = 'Googlebot';
- $this->version = $regs[1];
- $this->bot = true;
- }
elseif (preg_match('|Ask Jeeves/([0-9a-zA-Z\.+]+)|', $this->uastring, $regs)) {
$this->brand = 'Ask Jeeves';
$this->version = $regs[1];
$this->version = $regs[1];
$this->bot = true;
}
- elseif (preg_match('|([0-9a-zA-Z\.+]+bot)/([0-9a-zA-Z\.+]+)|i', $this->uastring, $regs)) {
+ elseif (preg_match('|heritrix([0-9a-zA-Z\.+-]+)|', $this->uastring, $regs)) {
+ $this->brand = 'Heritrix';
+ $this->version = str_replace('-', '.', $regs[1]);
+ $this->bot = true;
+ }
+ elseif (preg_match('|SBSearch/([0-9a-zA-Z\.+]+)|', $this->uastring, $regs)) {
+ $this->brand = 'SBSearch';
+ $this->version = $regs[1];
+ $this->bot = true;
+ }
+ elseif (preg_match('|Powermarks/([0-9a-zA-Z\.+]+)|', $this->uastring, $regs)) {
+ $this->brand = 'Powermarks';
+ $this->version = $regs[1];
+ $this->bot = true;
+ }
+ elseif (preg_match('|TopBlogsInfo/([0-9a-zA-Z\.+]+)|', $this->uastring, $regs)) {
+ $this->brand = 'TopBlogsInfo';
+ $this->version = $regs[1];
+ $this->bot = true;
+ }
+ elseif (preg_match('|picmole/([0-9a-zA-Z\.+]+)|', $this->uastring, $regs)) {
+ $this->brand = 'picmole';
+ $this->version = $regs[1];
+ $this->bot = true;
+ }
+ elseif (preg_match('|([0-9a-zA-Z\._+-]+bot)/([0-9a-zA-Z\.+]+)|i', $this->uastring, $regs)) {
$this->brand = $regs[1];
$this->version = $regs[2];
$this->bot = true;
$this->version = $regs[1];
$this->bot = true;
}
- elseif (preg_match('|Powermarks/([0-9a-zA-Z\.+]+)|', $this->uastring, $regs)) {
- $this->brand = 'Powermarks';
- $this->version = $regs[1];
- $this->bot = true;
- }
elseif (preg_match('|Gulper Web Bot ([0-9a-zA-Z\.+]+)|', $this->uastring, $regs)) {
$this->brand = 'Gulper Web Bot';
$this->version = $regs[1];
$this->version = $regs[1];
$this->bot = true;
}
+ elseif (preg_match('|Advista Crawler ([0-9a-zA-Z\.+]+)|', $this->uastring, $regs)) {
+ $this->brand = 'HTTrack';
+ $this->version = $regs[1];
+ $this->bot = true;
+ }
+ elseif (preg_match('|Seznam screenshot-generator ([0-9a-zA-Z\.+]+)|', $this->uastring, $regs)) {
+ $this->brand = 'Seznam screenshot-generator';
+ $this->version = $regs[1];
+ $this->bot = true;
+ }
+ elseif (preg_match('|Yahoo! SearchMonkey ([0-9a-zA-Z\.+]+)|', $this->uastring, $regs)) {
+ $this->brand = 'Yahoo! SearchMonkey';
+ $this->version = $regs[1];
+ $this->bot = true;
+ }
+ elseif (preg_match('|Yahoo Pipes ([0-9a-zA-Z\.+]+)|', $this->uastring, $regs)) {
+ $this->brand = 'Yahoo! Pipes';
+ $this->version = $regs[1];
+ $this->bot = true;
+ }
+ elseif (preg_match('|Firebat ([0-9a-zA-Z\.+]+)|', $this->uastring, $regs)) {
+ $this->brand = 'Firebat';
+ $this->version = $regs[1];
+ $this->bot = true;
+ }
elseif (preg_match('|Twiceler-([0-9a-zA-Z\.+]+)|', $this->uastring, $regs)) {
$this->brand = 'Twiceler';
$this->version = $regs[1];
$this->bot = true;
}
+ elseif (preg_match('|Nu_?tch-([0-9a-zA-Z\.+]+)|', $this->uastring, $regs)) {
+ $this->brand = 'Nutch';
+ $this->version = $regs[1];
+ $this->bot = true;
+ }
elseif (preg_match('|Microsoft URL Control - ([0-9a-zA-Z\.+]+)|', $this->uastring, $regs)) {
$this->brand = 'Microsoft URL Control';
$this->version = $regs[1];
$this->version = null;
$this->bot = true;
}
+ elseif (preg_match('|ICCrawler|i', $this->uastring, $regs)) {
+ $this->brand = 'ICCrawler';
+ $this->version = null;
+ $this->bot = true;
+ }
+ elseif (preg_match('|KaloogaBot|', $this->uastring, $regs)) {
+ $this->brand = 'KaloogaBot';
+ $this->version = null;
+ $this->bot = true;
+ }
+ elseif (preg_match('|ScoutJet|', $this->uastring, $regs)) {
+ $this->brand = 'ScoutJet';
+ $this->version = null;
+ $this->bot = true;
+ }
elseif (preg_match('|http://www.livedir.net|', $this->uastring, $regs)) {
$this->brand = 'livedir.net';
$this->version = null;
$this->version = null;
$this->bot = true;
}
+ elseif (preg_match('|newstin.com|', $this->uastring, $regs)) {
+ $this->brand = 'newstin.com';
+ $this->version = null;
+ $this->bot = true;
+ }
elseif (preg_match('|http://www.almaden.ibm.com/cs/crawler|', $this->uastring)) {
$this->brand = 'almaden crawler';
$this->version = null;
$this->version = null;
$this->bot = true;
}
- elseif (preg_match('|sitecheck.internetseer.com|', $this->uastring)) {
- $this->brand = 'internetseer';
- $this->version = null;
- $this->bot = true;
- }
elseif (preg_match('|Really Gmane.org\'s favicon grabber|', $this->uastring)) {
$this->brand = 'Really Gmane.org\'s favicon grabber';
$this->version = null;
$this->version = null;
$this->bot = true;
}
- elseif (preg_match('|42_HAL|', $this->uastring)) {
- $this->brand = '42_HAL';
- $this->version = null;
- $this->bot = true;
- }
- elseif (preg_match('|Baiduspider|i', $this->uastring)) {
- $this->brand = 'BaiDuSpider';
- $this->version = null;
- $this->bot = true;
- }
elseif (preg_match('|Indy Library|', $this->uastring)) {
$this->brand = 'Indy Library';
$this->version = null;
$this->version = '1.0';
$this->bot = false;
}
+ elseif (preg_match('|MSIE 7\.0.+Trident/4.0|', $this->uastring, $regs)) {
+ $this->brand = 'Microsoft Internet Explorer';
+ $this->version = "8.0";
+ $this->bot = false;
+ }
+ elseif (preg_match('|MSIE 7\.0.+Trident/5.0|', $this->uastring, $regs)) {
+ $this->brand = 'Microsoft Internet Explorer';
+ $this->version = "9.0";
+ $this->bot = false;
+ }
elseif (preg_match('|MSIE ([0-9a-zA-Z\.+]+)|', $this->uastring, $regs)) {
$this->brand = 'Microsoft Internet Explorer';
$this->version = $regs[1];
$this->bot = false;
}
- $botArray = array('Scooter','Spinne','Vagabondo','Firefly','Scrubby','NG','Pompos','Szukacz','ASPseek',
+ $botArray = array('Scooter','Spinne','Vagabondo','Firefly','Scrubby','NG','Pompos','Szukacz','Schmozilla','42_HAL',
'NetResearchServer','LinkWalker','Zeus','W3C_Validator','ZyBorg','Ask Jeeves','ia_archiver',
'PingALink Monitoring Services','IlTrovatore-Setaccio','Nutch','Mercator','search.ch',
- 'appie','larbin','NutchCVS','ObjectsSearch','Webchat','Mediapartners-Google','Schmozilla',
- 'FavOrg','findlinks','DataCha0s','ichiro','Francis','','','','','','','');
+ 'appie','larbin','NutchCVS','Webchat','Mediapartners-Google','sitecheck.internetseer.com',
+ 'FavOrg','findlinks','DataCha0s','ichiro','Francis','CoralWebPrx','DoCoMo','Ocelli','Sogou Video',
+ 'Yandex','Yeti','Austronaut-URL-Checker');
if (in_array($this->brand, $botArray)) {
$this->bot = true;
if (!isset($this->uadata['engine'])) {
$this->uadata['engine'] = 'unknown';
$this->uadata['geckodate'] = null;
- if (preg_match('|Gecko/([0-9]+)|', $this->uastring, $regs)) {
- $this->uadata['engine'] = 'gecko';
- $this->uadata['geckodate'] = $regs[1];
- }
- elseif ((strpos($this->brand, 'Internet Explorer') !== false) || (strpos($this->brand, 'FrontPage') !== false)) {
- if ((strpos(strtolower($this->uastring), 'mac') !== false) && (intval($this->getVersion()) >= 5)) {
- $this->uadata['engine'] = 'tasman';
+ if (!$this->bot) {
+ if (preg_match('|Gecko/([0-9]+)|', $this->uastring, $regs) && (strpos($this->brand, 'Opera') === false)) {
+ $this->uadata['engine'] = 'gecko';
+ $this->uadata['geckodate'] = $regs[1];
}
- else {
- $this->uadata['engine'] = 'trident';
+ elseif ((strpos($this->brand, 'Internet Explorer') !== false) || (strpos($this->brand, 'FrontPage') !== false)) {
+ if ((strpos(strtolower($this->uastring), 'mac') !== false) && (intval($this->getVersion()) >= 5)) {
+ $this->uadata['engine'] = 'tasman';
+ }
+ else {
+ $this->uadata['engine'] = 'trident';
+ }
}
- }
- elseif ((strpos($this->brand, 'Konqueror') !== false) || (strpos($this->brand, 'Safari') !== false) ||
- (strpos($this->brand, 'Shiira') !== false) ||
- (strpos($this->brand, 'AppleWebKit') !== false) || (strpos($this->brand, 'OmniWeb') !== false)) {
- $this->uadata['engine'] = 'khtml';
- }
- elseif (strpos($this->brand, 'Netscape') !== false) {
- // non-Gecko Netscape browsers
- if (intval($this->version) <= 4) {
- $this->uadata['engine'] = 'nscp';
+ elseif ((strpos($this->brand, 'Konqueror') !== false) || (strpos($this->uastring, 'WebKit/') !== false) ||
+ (strpos($this->brand, 'OmniWeb') !== false)) {
+ $this->uadata['engine'] = 'khtml';
}
- elseif (strpos($this->uastring, 'MSIE') !== false) {
+ elseif (strpos($this->brand, 'Netscape') !== false) {
+ // non-Gecko Netscape browsers
+ if (intval($this->version) <= 4) {
+ $this->uadata['engine'] = 'nscp';
+ }
+ elseif (strpos($this->uastring, 'MSIE') !== false) {
+ $this->uadata['engine'] = 'trident';
+ }
+ }
+ elseif (strpos($this->brand, 'Opera') !== false) {
+ $this->uadata['engine'] = 'presto';
+ }
+ elseif (strpos($this->brand, 'Dillo') !== false) {
+ $this->uadata['engine'] = 'gzilla';
+ }
+ elseif ((strpos($this->brand, 'ELinks') !== false) || (strpos($this->brand, 'Links') !== false)) {
+ $this->uadata['engine'] = 'links';
+ }
+ elseif ((strpos($this->brand, 'Lynx') !== false)) {
+ $this->uadata['engine'] = 'lynx';
+ }
+ elseif ((strpos($this->brand, 'ICEbrowser') !== false) || (strpos($this->brand, 'ICE Browser') !== false)) {
+ $this->uadata['engine'] = 'icestorm';
+ }
+ elseif ((strpos($this->brand, 'PlayStation') !== false) || (strpos($this->brand, 'NetFront') !== false)) {
+ $this->uadata['engine'] = 'netfront';
+ }
+ elseif ((strpos($this->brand, 'Avant') !== false) || (strpos($this->brand, 'Crazy Browser') !== false) ||
+ (strpos($this->brand, 'AOL') !== false) || (strpos($this->brand, 'MSN') !== false) ||
+ (strpos($this->brand, 'MyIE2') !== false) || (strpos($this->brand, 'Maxthon') !== false)) {
$this->uadata['engine'] = 'trident';
}
- }
- elseif (strpos($this->brand, 'Opera') !== false) {
- $this->uadata['engine'] = 'presto';
- }
- elseif (strpos($this->brand, 'Dillo') !== false) {
- $this->uadata['engine'] = 'gzilla';
- }
- elseif ((strpos($this->brand, 'ELinks') !== false) || (strpos($this->brand, 'Links') !== false)) {
- $this->uadata['engine'] = 'links';
- }
- elseif ((strpos($this->brand, 'ICEbrowser') !== false) || (strpos($this->brand, 'ICE Browser') !== false)) {
- $this->uadata['engine'] = 'icestorm';
- }
- elseif ((strpos($this->brand, 'PlayStation') !== false) || (strpos($this->brand, 'NetFront') !== false)) {
- $this->uadata['engine'] = 'netfront';
- }
- elseif ((strpos($this->brand, 'Avant') !== false) || (strpos($this->brand, 'Crazy Browser') !== false) ||
- (strpos($this->brand, 'AOL') !== false) || (strpos($this->brand, 'MSN') !== false) ||
- (strpos($this->brand, 'MyIE2') !== false) || (strpos($this->brand, 'Maxthon') !== false)) {
- $this->uadata['engine'] = 'trident';
- }
- elseif (strpos($this->brand, 'Galeon') !== false) {
- $this->uadata['engine'] = 'gecko';
- }
- elseif (strpos($this->brand, 'WebPro') !== false) {
- $this->uadata['engine'] = 'nscp';
+ elseif (strpos($this->brand, 'Galeon') !== false) {
+ $this->uadata['engine'] = 'gecko';
+ }
+ elseif (strpos($this->brand, 'WebPro') !== false) {
+ $this->uadata['engine'] = 'nscp';
+ }
}
}
return $this->uadata['engine'];
public function getOS() {
if (!isset($this->uadata['os'])) {
$this->uadata['os'] = null;
- if ($this->hasEngine('gecko')) {
- if (preg_match('|Mozilla/5.0 \(([^;]+); [^;]+; ([^;]+); ([^;]+); rv:([^\);]+)(; [^\)]+)?\)|', $this->uastring, $regs)) {
- $this->uadata['os'] = $regs[2];
- $this->uadata['lang'] = (strpos($regs[3],'chrome://')===false)?$regs[3]:null;
- $this->uadata['eng_version'] = $regs[4];
+ if (!$this->bot) {
+ if ($this->hasEngine('gecko')) {
+ if (preg_match('|Mozilla/5.0 \(([^;]+); [^;]+; ([^;]+); ([^;]+); ([^;]+); rv:([^\);]+)(; [^\)]+)?\)|', $this->uastring, $regs)) {
+ $this->uadata['os'] = $regs[2].' ('.$regs[3].')';
+ $this->uadata['lang'] = (strpos($regs[4],'chrome://')===false)?$regs[4]:null;
+ $this->uadata['eng_version'] = $regs[5];
+ }
+ elseif (preg_match('|Mozilla/5.0 \(([^;]+); [^;]+; ([^;]+); ([^;]+); rv:([^\);]+)(; [^\)]+)?\)|', $this->uastring, $regs)) {
+ $this->uadata['os'] = $regs[2];
+ $this->uadata['lang'] = (strpos($regs[3],'chrome://')===false)?$regs[3]:null;
+ $this->uadata['eng_version'] = $regs[4];
+ }
+ elseif (preg_match('|Mozilla/5.0 \(([^;]+); [^;]; ([^;]+); rv:([^\);]+)(; [^\)]+)?\)|', $this->uastring, $regs)) {
+ $this->uadata['os'] = $regs[2];
+ $this->uadata['lang'] = null;
+ $this->uadata['eng_version'] = $regs[3];
+ }
+ elseif (preg_match('|Mozilla/5.0 \(([^;]+); ([^;]+); ([^;]+); rv:([^\);]+)(; [^\)]+)?\)|', $this->uastring, $regs)) {
+ $this->uadata['os'] = $regs[2];
+ $this->uadata['lang'] = (strpos($regs[3],'chrome://')===false)?$regs[3]:null;
+ $this->uadata['eng_version'] = $regs[4];
+ }
+ elseif (preg_match('|Mozilla/5.0 \(([^;]+); [^;]; ([^;]+); ([^;]+); m([^\);]+)\)|', $this->uastring, $regs)) {
+ $this->uadata['os'] = $regs[2];
+ $this->uadata['lang'] = $regs[3];
+ $this->uadata['eng_version'] = 'M'.$regs[4];
+ }
+ elseif (preg_match('|Mozilla/5.0 \(([^;]+); [^;]; ([^;]+); m([^\);]+)\)|', $this->uastring, $regs)) {
+ $this->uadata['os'] = $regs[1];
+ $this->uadata['lang'] = $regs[2];
+ $this->uadata['eng_version'] = 'M'.$regs[3];
+ }
+ elseif (preg_match('|Mozilla/5.0 \(([^;]+); [^;]; ([^;]+); ([^\);]+)\)|', $this->uastring, $regs)) {
+ $this->uadata['os'] = $regs[2];
+ $this->uadata['lang'] = $regs[3];
+ $this->uadata['eng_version'] = null;
+ }
+ elseif (preg_match('|Mozilla/5.0 \(([^;]+); ([^;]+); rv:([^\);]+)\)|', $this->uastring, $regs)) {
+ $this->uadata['os'] = $regs[2];
+ $this->uadata['lang'] = null;
+ $this->uadata['eng_version'] = $regs[3];
+ }
+ elseif (preg_match('|Mozilla/5.0 \(([^;]+); [^;]+; ([^\);]+)\)|', $this->uastring, $regs)) {
+ $this->uadata['os'] = $regs[2];
+ $this->uadata['lang'] = null;
+ $this->uadata['eng_version'] = null;
+ }
+ elseif (preg_match('|Mozilla/5.0 \(([^;]+); rv:([^\);]+)\)|', $this->uastring, $regs)) {
+ $this->uadata['os'] = $regs[1];
+ $this->uadata['lang'] = null;
+ $this->uadata['eng_version'] = $regs[2];
+ }
+ elseif (preg_match('|Mozilla/5.0 Galeon/[^\(]+ \(([^;]+); ([^;]+);[^\)]+\)|', $this->uastring, $regs)) {
+ $this->uadata['os'] = $regs[2];
+ $this->uadata['lang'] = null;
+ $this->uadata['eng_version'] = null;
+ }
+ elseif (preg_match('|Debian/|', $this->uastring, $regs)) {
+ $this->uadata['os'] = 'Debian Linux';
+ $this->uadata['lang'] = null;
+ $this->uadata['eng_version'] = null;
+ }
}
- elseif (preg_match('|Mozilla/5.0 \(([^;]+); [^;]+; ([^;]+); rv:([^\);]+)(; [^\)]+)?\)|', $this->uastring, $regs)) {
- $this->uadata['os'] = $regs[2];
- $this->uadata['lang'] = null;
- $this->uadata['eng_version'] = $regs[3];
- }
- elseif (preg_match('|Mozilla/5.0 \(([^;]+); [^;]+; ([^;]+); ([^;]+); m([^\);]+)\)|', $this->uastring, $regs)) {
- $this->uadata['os'] = $regs[2];
- $this->uadata['lang'] = $regs[3];
- $this->uadata['eng_version'] = 'M'.$regs[4];
- }
- elseif (preg_match('|Mozilla/5.0 \(([^;]+); [^;]+; ([^;]+); m([^\);]+)\)|', $this->uastring, $regs)) {
- $this->uadata['os'] = $regs[1];
- $this->uadata['lang'] = $regs[2];
- $this->uadata['eng_version'] = 'M'.$regs[3];
- }
- elseif (preg_match('|Mozilla/5.0 \(([^;]+); [^;]+; ([^;]+); ([^\);]+)\)|', $this->uastring, $regs)) {
- $this->uadata['os'] = $regs[2];
- $this->uadata['lang'] = $regs[3];
- $this->uadata['eng_version'] = null;
+ elseif ($this->hasEngine('trident') || $this->hasEngine('tasman')) {
+ if (preg_match('/Mozilla\/[^\(]+ \(compatible *; MSIE [^;]+[^\)]*; ?((?:Mac|Win)[^;]+); ?(Win64|WOW64)[^\)]*Trident\/([^;\)]+)[^\)]*\)/i', $this->uastring, $regs)) {
+ $this->uadata['eng_version'] = $regs[3];
+ $this->uadata['os'] = $regs[1].' ('.$regs[2].')';
+ $this->uadata['lang'] = null;
+ }
+ elseif (preg_match('/Mozilla\/[^\(]+ \(compatible *; MSIE [^;]+[^\)]*; ?((?:Mac|Win)[^;]+); ?[^\)]*Trident\/([^;\)]+)[^\)]*\)/i', $this->uastring, $regs)) {
+ $this->uadata['eng_version'] = $regs[2];
+ $this->uadata['os'] = $regs[1];
+ $this->uadata['lang'] = null;
+ }
+ elseif (preg_match('/Mozilla\/[^\(]+ \(compatible *; MSP?IE ([^;]+)[^\)]*; ?((?:Mac|Win)[^;]+); ?(Win64|WOW64)[^\)]*\)/i', $this->uastring, $regs)) {
+ $this->uadata['eng_version'] = (strpos($this->uastring,'MSPIE')!==false)?null:"ie".$regs[1];
+ $this->uadata['os'] = $regs[2].' ('.$regs[3].')';
+ $this->uadata['lang'] = null;
+ }
+ elseif (preg_match('/Mozilla\/[^\(]+ \(compatible *; MSP?IE ([^;]+)[^\)]*; ?((?:Mac|Win)[^;]+)[^\)]*\)/i', $this->uastring, $regs)) {
+ $this->uadata['eng_version'] = (strpos($this->uastring,'MSPIE')!==false)?null:"ie".$regs[1];
+ $this->uadata['os'] = $regs[2];
+ $this->uadata['lang'] = null;
+ }
+ elseif (preg_match('/Mozilla\/[^\(]+ \(compatible *; MSIE ([^;]+)[^\)]*\)/i', $this->uastring, $regs)) {
+ $this->uadata['eng_version'] = "ie".$regs[1];
+ $this->uadata['os'] = null;
+ $this->uadata['lang'] = null;
+ }
+ elseif (preg_match('/Microsoft Internet Explorer\/[^\s]+ \(((?:Mac|Win)[^;\)]+)\)/i', $this->uastring, $regs)) {
+ $this->uadata['eng_version'] = "ie".$this->getVersion();
+ $this->uadata['os'] = $regs[1];
+ $this->uadata['lang'] = null;
+ }
+ elseif (preg_match('/Microsoft Pocket Internet Explorer\/[^\s]+/i', $this->uastring, $regs)) {
+ $this->uadata['eng_version'] = null;
+ $this->uadata['os'] = 'Windows CE';
+ $this->uadata['lang'] = null;
+ }
}
- elseif (preg_match('|Mozilla/5.0 \(([^;]+); ([^;]+); rv:([^\);]+)\)|', $this->uastring, $regs)) {
- $this->uadata['os'] = $regs[2];
- $this->uadata['lang'] = null;
- $this->uadata['eng_version'] = $regs[3];
+ elseif ($this->hasEngine('khtml')) {
+ if (preg_match('/Mozilla\/[^\(]+ \(compatible; Konqueror\/([^;]+); ([^;]+); ([^;]+); ([^;]+); ([^\);]+)\)(?: KHTML\/([0-9a-zA-Z\.+]+))?/i', $this->uastring, $regs)) {
+ $this->uadata['eng_version'] = strlen($regs[6])?$regs[6]:$regs[1];
+ $this->uadata['os'] = $regs[2];
+ $this->uadata['lang'] = $regs[5];
+ }
+ elseif (preg_match('/Mozilla\/[^\(]+ \(compatible; Konqueror\/([^;]+); ([^\);]+)[^\)]*\)(?: KHTML\/([0-9a-zA-Z\.+]+))?/i', $this->uastring, $regs)) {
+ $this->uadata['eng_version'] = strlen($regs[3])?$regs[3]:$regs[1];
+ $this->uadata['os'] = $regs[2];
+ $this->uadata['lang'] = null;
+ }
+ elseif (preg_match('|Mozilla/5.0 \(([^;]+); U; ([^;]+); ([^\);]+)\)|', $this->uastring, $regs)) {
+ if (strpos($regs[3], '/') !== false) {
+ $this->uadata['os'] = $regs[1];
+ $this->uadata['lang'] = null;
+ }
+ else {
+ $this->uadata['os'] = $regs[2];
+ $this->uadata['lang'] = $regs[3];
+ }
+ $this->uadata['eng_version'] = null;
+ }
+ elseif (preg_match('|Mozilla/5.0 \(([^;]+); U; ([^\);]+)\)|', $this->uastring, $regs)) {
+ $this->uadata['os'] = $regs[1];
+ $this->uadata['lang'] = $regs[2];
+ $this->uadata['eng_version'] = null;
+ }
+ elseif (preg_match('/Mozilla\/[^\(]+ \(compatible; [^;]+; ([^\);]+)\)/i', $this->uastring, $regs)) {
+ $this->uadata['os'] = $regs[1];
+ $this->uadata['lang'] = null;
+ $this->uadata['eng_version'] = null;
+ }
+ elseif (preg_match('/Midori\/[^\(]+ \((?:X11; )?([^;]+); U; ([^\)]+)\) WebKit/i', $this->uastring, $regs)) {
+ $this->uadata['eng_version'] = null;
+ $this->uadata['os'] = $regs[1];
+ $this->uadata['lang'] = $regs[2];
+ }
}
- elseif (preg_match('|Mozilla/5.0 \(([^;]+); [^;]+; ([^\);]+)\)|', $this->uastring, $regs)) {
- $this->uadata['os'] = $regs[2];
- $this->uadata['lang'] = null;
- $this->uadata['eng_version'] = null;
+ elseif ($this->hasEngine('presto')) {
+ // Opera < 8
+ if (preg_match('/Opera\/[^\(]+ \((?:X11; )?([^;]+)[^\)]+\) +\[([a-z_-]+)\]/i', $this->uastring, $regs)) {
+ $this->uadata['eng_version'] = $this->getVersion();
+ $this->uadata['os'] = $regs[1];
+ $this->uadata['lang'] = $regs[2];
+ }
+ elseif (preg_match('/Mozilla\/[^\(]+ \(compatible; MSIE [^;]+; (?:X11; )?([^;\)]+)[^\)]*\) Opera [^ ]+\s+\[([a-z_-]+)\]/i', $this->uastring, $regs)) {
+ $this->uadata['eng_version'] = $this->getVersion();
+ $this->uadata['os'] = $regs[1];
+ $this->uadata['lang'] = $regs[2];
+ }
+ elseif (preg_match('/Mozilla\/[^\(]+ \((?:X11; )?([^;]+);.+\) Opera [^ ]+\s+\[([a-z_-]+)\]/i', $this->uastring, $regs)) {
+ $this->uadata['eng_version'] = $this->getVersion();
+ $this->uadata['os'] = $regs[1];
+ $this->uadata['lang'] = $regs[2];
+ }
+ // Opera mini
+ elseif (preg_match('/Opera\/([^\(]+) \((?:X11; )?([^;]+); Opera Mini; ([a-z_-]+); /i', $this->uastring, $regs)) {
+ $this->uadata['eng_version'] = null;
+ $this->uadata['os'] = $regs[2];
+ $this->uadata['lang'] = $regs[3];
+ }
+ elseif (preg_match('/Opera\/([^\(]+) \((?:X11; )?([^;]+); Opera Mini\/[^;]+; ([a-z_-]+); /i', $this->uastring, $regs)) {
+ $this->uadata['eng_version'] = $regs[1];
+ $this->uadata['os'] = $regs[2];
+ $this->uadata['lang'] = $regs[3];
+ }
+ // Opera >= 8
+ elseif (preg_match('/Opera\/[^\(]+ \((?:X11; )?([^;]+); [^\)]+; ([a-z_-]+)\)/i', $this->uastring, $regs)) {
+ $this->uadata['eng_version'] = $this->getVersion();
+ $this->uadata['os'] = $regs[1];
+ $this->uadata['lang'] = $regs[2];
+ }
+ elseif (preg_match('/Mozilla\/[^\(]+ \(compatible; MSIE [^;]+; (?:X11; )?([^;]+); ([a-z_-]+)\) Opera [^ ]+/i', $this->uastring, $regs)) {
+ $this->uadata['eng_version'] = $this->getVersion();
+ $this->uadata['os'] = $regs[1];
+ $this->uadata['lang'] = $regs[2];
+ }
+ elseif (preg_match('/Mozilla\/[^\(]+ \((?:X11; )?([^;]+);.+; ([a-z_-]+)\) Opera [^ ]+/i', $this->uastring, $regs)) {
+ $this->uadata['eng_version'] = $this->getVersion();
+ $this->uadata['os'] = $regs[1];
+ $this->uadata['lang'] = $regs[2];
+ }
+ // Opera 9 Firefox-spoofing
+ elseif (preg_match('/Mozilla\/[^\(]+ \((?:X11; )?([^;]+);.+; ([a-z_-]+); rv:([^\);]+)\) Gecko\/\d+ Firefox\/[0-9a-zA-Z\.+]+ Opera [^ ]+/i', $this->uastring, $regs)) {
+ $this->uadata['eng_version'] = $this->getVersion();
+ $this->uadata['os'] = $regs[1];
+ $this->uadata['lang'] = $regs[2];
+ }
}
- elseif (preg_match('|Mozilla/5.0 Galeon/[^\(]+ \(([^;]+); ([^;]+);[^\)]+\)|', $this->uastring, $regs)) {
- $this->uadata['os'] = $regs[2];
- $this->uadata['lang'] = null;
- $this->uadata['eng_version'] = null;
- }
- elseif (preg_match('|Debian/|', $this->uastring, $regs)) {
- $this->uadata['os'] = 'Debian Linux';
- $this->uadata['lang'] = null;
- $this->uadata['eng_version'] = null;
- }
- }
- elseif ($this->hasEngine('trident') || $this->hasEngine('tasman')) {
- if (preg_match('/Mozilla\/[^\(]+ \(compatible *; MSP?IE ([^;]+)[^\)]*; ?((?:Mac|Win)[^;]+)[^\)]*\)/i', $this->uastring, $regs)) {
- $this->uadata['eng_version'] = (strpos($this->uastring,'MSPIE')!==false)?null:$regs[1];
- $this->uadata['os'] = $regs[2];
- $this->uadata['lang'] = null;
- }
- elseif (preg_match('/Mozilla\/[^\(]+ \(compatible *; MSIE ([^;]+)[^\)]*\)/i', $this->uastring, $regs)) {
- $this->uadata['eng_version'] = $regs[1];
- $this->uadata['os'] = null;
- $this->uadata['lang'] = null;
+ elseif ($this->hasEngine('nscp')) {
+ if (preg_match('/Mozilla\/([0-9a-zA-Z\.+]+) (?:\[([a-z_-]+)\][^\(]+)?\(X11; [^;]+; ([^\)]+)\)/i', $this->uastring, $regs)) {
+ $this->uadata['eng_version'] = $regs[1];
+ $this->uadata['os'] = $regs[3];
+ $this->uadata['lang'] = $regs[2];
+ }
+ elseif (preg_match('/Mozilla\/([0-9a-zA-Z\.+]+) (?:\[([a-z_-]+)\][^\(]+)?\(([^;]+);[^\)]+\)/i', $this->uastring, $regs)) {
+ $this->uadata['eng_version'] = $regs[1];
+ $this->uadata['os'] = $regs[3];
+ $this->uadata['lang'] = $regs[2];
+ }
+ elseif (preg_match('/Mozilla\/([0-9a-zA-Z\.+]+)[^\(]+\(([^;]+);[^\)]+\)/i', $this->uastring, $regs)) {
+ $this->uadata['eng_version'] = $regs[1];
+ $this->uadata['os'] = $regs[2];
+ $this->uadata['lang'] = null;
+ }
}
- elseif (preg_match('/Microsoft Internet Explorer\/[^\s]+ \(((?:Mac|Win)[^;\)]+)\)/i', $this->uastring, $regs)) {
+ elseif ($this->hasEngine('gzilla')) {
$this->uadata['eng_version'] = $this->getVersion();
- $this->uadata['os'] = $regs[1];
- $this->uadata['lang'] = null;
- }
- elseif (preg_match('/Microsoft Pocket Internet Explorer\/[^\s]+/i', $this->uastring, $regs)) {
- $this->uadata['eng_version'] = null;
- $this->uadata['os'] = 'Windows CE';
- $this->uadata['lang'] = null;
- }
- }
- elseif ($this->hasEngine('khtml')) {
- if (preg_match('/Mozilla\/[^\(]+ \(compatible; Konqueror\/([^;]+); ([^;]+); ([^;]+); ([^;]+); ([^\);]+)\)(?: KHTML\/([0-9a-zA-Z\.+]+))?/i', $this->uastring, $regs)) {
- $this->uadata['eng_version'] = strlen($regs[6])?$regs[6]:$regs[1];
- $this->uadata['os'] = $regs[2];
- $this->uadata['lang'] = $regs[5];
- }
- elseif (preg_match('/Mozilla\/[^\(]+ \(compatible; Konqueror\/([^;]+); ([^\);]+)[^\)]*\)(?: KHTML\/([0-9a-zA-Z\.+]+))?/i', $this->uastring, $regs)) {
- $this->uadata['eng_version'] = strlen($regs[3])?$regs[3]:$regs[1];
- $this->uadata['os'] = $regs[2];
- $this->uadata['lang'] = null;
- }
- elseif (preg_match('|Mozilla/5.0 \(([^;]+); U; ([^;]+); ([^\);]+)\)|', $this->uastring, $regs)) {
- $this->uadata['os'] = $regs[2];
- $this->uadata['lang'] = $regs[3];
- $this->uadata['eng_version'] = null;
- }
- elseif (preg_match('|Mozilla/5.0 \(([^;]+); U; ([^\);]+)\)|', $this->uastring, $regs)) {
- $this->uadata['os'] = $regs[1];
- $this->uadata['lang'] = $regs[2];
- $this->uadata['eng_version'] = null;
- }
- elseif (preg_match('/Mozilla\/[^\(]+ \(compatible; [^;]+; ([^\);]+)\)/i', $this->uastring, $regs)) {
- $this->uadata['os'] = $regs[1];
+ $this->uadata['os'] = null;
$this->uadata['lang'] = null;
- $this->uadata['eng_version'] = null;
}
- }
- elseif ($this->hasEngine('presto')) {
- // Opera < 8
- if (preg_match('/Opera\/[^\(]+ \((?:X11; )?([^;]+)[^\)]+\) +\[([a-z_-]+)\]/i', $this->uastring, $regs)) {
- $this->uadata['eng_version'] = $this->getVersion();
- $this->uadata['os'] = $regs[1];
- $this->uadata['lang'] = $regs[2];
- }
- elseif (preg_match('/Mozilla\/[^\(]+ \(compatible; MSIE [^;]+; (?:X11; )?([^;\)]+)[^\)]*\) Opera [^ ]+ +\[([a-z_-]+)\]/i', $this->uastring, $regs)) {
- $this->uadata['eng_version'] = $this->getVersion();
- $this->uadata['os'] = $regs[1];
- $this->uadata['lang'] = $regs[2];
+ elseif ($this->hasEngine('links')) {
+ if (preg_match('/E?Links[^\(]+\([^;]+; ([^;]+)[^\)]+\)/i', $this->uastring, $regs)) {
+ $this->uadata['eng_version'] = null;
+ $this->uadata['os'] = $regs[1];
+ $this->uadata['lang'] = null;
+ }
}
- elseif (preg_match('/Mozilla\/[^\(]+ \((?:X11; )?([^;]+);.+\) Opera [^ ]+ \[([a-z_-]+)\]/i', $this->uastring, $regs)) {
+ elseif ($this->hasEngine('lynx')) {
$this->uadata['eng_version'] = $this->getVersion();
- $this->uadata['os'] = $regs[1];
- $this->uadata['lang'] = $regs[2];
- }
- // Opera mini
- elseif (preg_match('/Opera\/([^\(]+) \((?:X11; )?([^;]+); Opera Mini; ([a-z_-]+); /i', $this->uastring, $regs)) {
- $this->uadata['eng_version'] = null;
- $this->uadata['os'] = $regs[2];
- $this->uadata['lang'] = $regs[3];
- }
- elseif (preg_match('/Opera\/([^\(]+) \((?:X11; )?([^;]+); Opera Mini\/[^;]+; ([a-z_-]+); /i', $this->uastring, $regs)) {
- $this->uadata['eng_version'] = $regs[1];
- $this->uadata['os'] = $regs[2];
- $this->uadata['lang'] = $regs[3];
- }
- // Opera >= 8
- elseif (preg_match('/Opera\/[^\(]+ \((?:X11; )?([^;]+); [^\)]+; ([a-z_-]+)\)/i', $this->uastring, $regs)) {
- $this->uadata['eng_version'] = $this->getVersion();
- $this->uadata['os'] = $regs[1];
- $this->uadata['lang'] = $regs[2];
- }
- elseif (preg_match('/Mozilla\/[^\(]+ \(compatible; MSIE [^;]+; (?:X11; )?([^;]+); ([a-z_-]+)\) Opera [^ ]+/i', $this->uastring, $regs)) {
- $this->uadata['eng_version'] = $this->getVersion();
- $this->uadata['os'] = $regs[1];
- $this->uadata['lang'] = $regs[2];
- }
- elseif (preg_match('/Mozilla\/[^\(]+ \((?:X11; )?([^;]+);.+; ([a-z_-]+)\) Opera [^ ]+/i', $this->uastring, $regs)) {
- $this->uadata['eng_version'] = $this->getVersion();
- $this->uadata['os'] = $regs[1];
- $this->uadata['lang'] = $regs[2];
- }
- }
- elseif ($this->hasEngine('nscp')) {
- if (preg_match('/Mozilla\/([0-9a-zA-Z\.+]+) (?:\[([a-z_-]+)\][^\(]+)?\(X11; [^;]+; ([^\)]+)\)/i', $this->uastring, $regs)) {
- $this->uadata['eng_version'] = $regs[1];
- $this->uadata['os'] = $regs[3];
- $this->uadata['lang'] = $regs[2];
- }
- elseif (preg_match('/Mozilla\/([0-9a-zA-Z\.+]+) (?:\[([a-z_-]+)\][^\(]+)?\(([^;]+);[^\)]+\)/i', $this->uastring, $regs)) {
- $this->uadata['eng_version'] = $regs[1];
- $this->uadata['os'] = $regs[3];
- $this->uadata['lang'] = $regs[2];
- }
- elseif (preg_match('/Mozilla\/([0-9a-zA-Z\.+]+)[^\(]+\(([^;]+);[^\)]+\)/i', $this->uastring, $regs)) {
- $this->uadata['eng_version'] = $regs[1];
- $this->uadata['os'] = $regs[2];
+ $this->uadata['os'] = null;
$this->uadata['lang'] = null;
}
- }
- elseif ($this->hasEngine('gzilla')) {
- $this->uadata['eng_version'] = $this->getVersion();
- $this->uadata['os'] = null;
- $this->uadata['lang'] = null;
- }
- elseif ($this->hasEngine('links')) {
- if (preg_match('/E?Links[^\(]+\([^;]+; ([^;]+)[^\)]+\)/i', $this->uastring, $regs)) {
- $this->uadata['eng_version'] = null;
- $this->uadata['os'] = $regs[1];
- $this->uadata['lang'] = null;
+ elseif ($this->hasEngine('icestorm')) {
+ if (preg_match('/ICE Browser\/v?([0-9a-zA-Z\._+]+) \(Java [^;]+; ([^\)]+)\)/i', $this->uastring, $regs)) {
+ $this->uadata['eng_version'] = str_replace('_', '.', $regs[1]);
+ $this->uadata['os'] = $regs[2];
+ $this->uadata['lang'] = null;
+ }
+ elseif (preg_match('/Mozilla\/[^\(]+ \((?:X11; )?([^;]+);.+; ([a-z_-]+)\).* ICEbrowser\/([0-9a-zA-Z\._+]+)/i', $this->uastring, $regs)) {
+ $this->uadata['eng_version'] = $regs[3];
+ $this->uadata['os'] = $regs[1];
+ $this->uadata['lang'] = $regs[2];
+ }
}
- }
- elseif ($this->hasEngine('icestorm')) {
- if (preg_match('/ICE Browser\/v?([0-9a-zA-Z\._+]+) \(Java [^;]+; ([^\)]+)\)/i', $this->uastring, $regs)) {
- $this->uadata['eng_version'] = str_replace('_', '.', $regs[1]);
- $this->uadata['os'] = $regs[2];
+ else {
+ $this->uadata['eng_version'] = null;
$this->uadata['lang'] = null;
+ if (preg_match('/AmigaOS/i', $this->uastring, $regs)) {
+ $this->uadata['os'] = 'AmigaOS';
+ }
+ if (preg_match('/Commodore 64/i', $this->uastring, $regs)) {
+ $this->uadata['os'] = 'Commodore 64';
+ }
+ elseif (preg_match('/curl\/[^\(]+\(([^\);]+)/i', $this->uastring, $regs)) {
+ $this->uadata['os'] = $regs[1];
+ }
+ elseif (preg_match('/NCSA[_ ]Mosaic\/[^\(]+\((?:.*;)?([^\);]+)/i', $this->uastring, $regs)) {
+ $this->uadata['os'] = trim($regs[1]);
+ }
+ elseif (preg_match('/iCab.*(Mac[^\);]+).*?\)/i', $this->uastring, $regs)) {
+ $this->uadata['os'] = trim($regs[1]);
+ }
+ elseif (preg_match('/SymbianOS\/([^ ]+)/i', $this->uastring, $regs)) {
+ $this->uadata['os'] = 'SymbianOS '.$regs[1];
+ }
}
- elseif (preg_match('/Mozilla\/[^\(]+ \((?:X11; )?([^;]+);.+; ([a-z_-]+)\).* ICEbrowser\/([0-9a-zA-Z\._+]+)/i', $this->uastring, $regs)) {
- $this->uadata['eng_version'] = $regs[3];
- $this->uadata['os'] = $regs[1];
- $this->uadata['lang'] = $regs[2];
- }
- }
- else {
- $this->uadata['eng_version'] = null;
- $this->uadata['lang'] = null;
- if (preg_match('/AmigaOS/i', $this->uastring, $regs)) {
- $this->uadata['os'] = 'AmigaOS';
- }
- if (preg_match('/Commodore 64/i', $this->uastring, $regs)) {
- $this->uadata['os'] = 'Commodore 64';
- }
- elseif (preg_match('/curl\/[^\(]+\(([^\);]+)/i', $this->uastring, $regs)) {
- $this->uadata['os'] = $regs[1];
- }
- elseif (preg_match('/NCSA[_ ]Mosaic\/[^\(]+\((?:.*;)?([^\);]+)/i', $this->uastring, $regs)) {
- $this->uadata['os'] = trim($regs[1]);
- }
- elseif (preg_match('/iCab.*(Mac[^\);]+).*?\)/i', $this->uastring, $regs)) {
- $this->uadata['os'] = trim($regs[1]);
- }
- elseif (preg_match('/SymbianOS\/([^ ]+)/i', $this->uastring, $regs)) {
- $this->uadata['os'] = 'SymbianOS '.$regs[1];
- }
- }
- if ($this->uadata['os'] == 'Win 9x 4.90') { $this->uadata['os'] = 'Windows ME'; }
- elseif ($this->uadata['os'] == 'WinNT4.0') { $this->uadata['os'] = 'Windows NT 4.0'; }
- elseif ($this->uadata['os'] == 'Windows NT 5.0') { $this->uadata['os'] = 'Windows 2000'; }
- elseif ($this->uadata['os'] == 'Windows NT 5.1') { $this->uadata['os'] = 'Windows XP'; }
- elseif ($this->uadata['os'] == 'Windows NT 5.2') { $this->uadata['os'] = 'Windows 2003'; }
- elseif ($this->uadata['os'] == 'Windows NT 5.2 x64') { $this->uadata['os'] = 'Windows 2003 (64bit)'; }
- elseif ($this->uadata['os'] == 'Windows NT 6.0') { $this->uadata['os'] = 'Windows Vista'; }
- elseif ($this->uadata['os'] == 'Win95') { $this->uadata['os'] = 'Windows 95'; }
- elseif ($this->uadata['os'] == 'Win98') { $this->uadata['os'] = 'Windows 98'; }
- elseif ($this->uadata['os'] == 'WinNT') { $this->uadata['os'] = 'Windows NT'; }
- elseif ($this->uadata['os'] == 'Win32') { $this->uadata['os'] = 'Windows (32bit)'; }
- elseif ($this->uadata['os'] == 'Win64') { $this->uadata['os'] = 'Windows (64bit)'; }
- elseif (preg_match('/Mac ?OS ?X/i',$this->uadata['os'])) { $this->uadata['os'] = 'MacOS X'; }
- elseif (preg_match('/Mac_P(ower|)PC/i',$this->uadata['os'])) { $this->uadata['os'] = 'MacOS'; }
- elseif (strpos($this->uadata['os'], 'darwin') !== false) { $this->uadata['os'] = 'MacOS X'; }
- elseif (strpos($this->uadata['os'], 'Darwin') !== false) { $this->uadata['os'] = 'MacOS X'; }
- elseif (strpos($this->uadata['os'], 'apple') !== false) { $this->uadata['os'] = 'MacOS'; }
- elseif (strpos($this->uadata['os'], 'Macintosh') !== false) { $this->uadata['os'] = 'MacOS'; }
- elseif (strpos($this->uadata['os'], 'linux') !== false) { $this->uadata['os'] = 'Linux'; }
+ if ($this->uadata['os'] == 'Win 9x 4.90') { $this->uadata['os'] = 'Windows ME'; }
+ elseif ($this->uadata['os'] == 'WinNT4.0') { $this->uadata['os'] = 'Windows NT 4.0'; }
+ elseif ($this->uadata['os'] == 'Windows NT 5.0') { $this->uadata['os'] = 'Windows 2000'; }
+ elseif ($this->uadata['os'] == 'Windows NT 5.1') { $this->uadata['os'] = 'Windows XP'; }
+ elseif ($this->uadata['os'] == 'Windows NT 5.1 (Win64)') { $this->uadata['os'] = 'Windows XP (64bit)'; }
+ elseif ($this->uadata['os'] == 'Windows NT 5.1 (WOW64)') { $this->uadata['os'] = 'Windows XP (64bit)'; }
+ elseif ($this->uadata['os'] == 'Windows NT 5.2') { $this->uadata['os'] = 'Windows 2003'; }
+ elseif ($this->uadata['os'] == 'Windows NT 5.2 x64') { $this->uadata['os'] = 'Windows 2003 (64bit)'; }
+ elseif ($this->uadata['os'] == 'Windows NT 5.2 (Win64)') { $this->uadata['os'] = 'Windows 2003 (64bit)'; }
+ elseif ($this->uadata['os'] == 'Windows NT 5.2 (WOW64)') { $this->uadata['os'] = 'Windows 2003 (64bit)'; }
+ elseif ($this->uadata['os'] == 'Windows NT 6.0') { $this->uadata['os'] = 'Windows Vista'; }
+ elseif ($this->uadata['os'] == 'Windows NT 6.0 (Win64)') { $this->uadata['os'] = 'Windows Vista (64bit)'; }
+ elseif ($this->uadata['os'] == 'Windows NT 6.0 (WOW64)') { $this->uadata['os'] = 'Windows Vista (64bit)'; }
+ elseif ($this->uadata['os'] == 'Windows NT 6.1') { $this->uadata['os'] = 'Windows 7'; }
+ elseif ($this->uadata['os'] == 'Windows NT 6.1 (Win64)') { $this->uadata['os'] = 'Windows 7 (64bit)'; }
+ elseif ($this->uadata['os'] == 'Windows NT 6.1 (WOW64)') { $this->uadata['os'] = 'Windows 7 (64bit)'; }
+ elseif ($this->uadata['os'] == 'Win95') { $this->uadata['os'] = 'Windows 95'; }
+ elseif ($this->uadata['os'] == 'Win98') { $this->uadata['os'] = 'Windows 98'; }
+ elseif ($this->uadata['os'] == 'WinNT') { $this->uadata['os'] = 'Windows NT'; }
+ elseif ($this->uadata['os'] == 'Win32') { $this->uadata['os'] = 'Windows (32bit)'; }
+ elseif ($this->uadata['os'] == 'Win64') { $this->uadata['os'] = 'Windows (64bit)'; }
+ elseif (preg_match('/Mac ?OS ?X/i',$this->uadata['os'])) { $this->uadata['os'] = 'MacOS X'; }
+ elseif (preg_match('/Mac_P(ower|)PC/i',$this->uadata['os'])) { $this->uadata['os'] = 'MacOS'; }
+ elseif (strpos($this->uadata['os'], 'darwin') !== false) { $this->uadata['os'] = 'MacOS X'; }
+ elseif (strpos($this->uadata['os'], 'Darwin') !== false) { $this->uadata['os'] = 'MacOS X'; }
+ elseif (strpos($this->uadata['os'], 'apple') !== false) { $this->uadata['os'] = 'MacOS'; }
+ elseif (strpos($this->uadata['os'], 'Macintosh') !== false) { $this->uadata['os'] = 'MacOS'; }
+ elseif (strpos($this->uadata['os'], 'linux') !== false) { $this->uadata['os'] = 'Linux'; }
+ elseif (preg_match('/SymbianOS[\/ ]([0-9a-zA-Z\._+]+)/i', $this->uastring, $regs)) { $this->uadata['os'] = 'SymbianOS '.$regs[1]; }
+ elseif (preg_match('/Symbian ?OS/i',$this->uadata['os'])) { $this->uadata['os'] = 'SymbianOS'; }
- if (strpos($this->uadata['os'], 'Win') !== false) { $this->uadata['platform'] = 'Windows'; }
- elseif (strpos($this->uadata['os'], 'Mac') !== false) { $this->uadata['platform'] = 'Macintosh'; }
- elseif (strpos($this->uadata['os'], 'Linux') !== false) { $this->uadata['platform'] = 'Linux'; }
- elseif (strpos($this->uadata['os'], 'Solaris') !== false) { $this->uadata['platform'] = 'Solaris'; }
- elseif (strpos($this->uadata['os'], 'SunOS') !== false) { $this->uadata['platform'] = 'Solaris'; }
- elseif (strpos($this->uadata['os'], 'BeOS') !== false) { $this->uadata['platform'] = 'BeOS'; }
- elseif (strpos($this->uadata['os'], 'FreeBSD') !== false) { $this->uadata['platform'] = 'FreeBSD'; }
- elseif (strpos($this->uadata['os'], 'OpenBSD') !== false) { $this->uadata['platform'] = 'OpenBSD'; }
- elseif (strpos($this->uadata['os'], 'NetBSD') !== false) { $this->uadata['platform'] = 'NetBSD'; }
- elseif (strpos($this->uadata['os'], 'AIX') !== false) { $this->uadata['platform'] = 'AIX'; }
- elseif (strpos($this->uadata['os'], 'IRIX') !== false) { $this->uadata['platform'] = 'IRIX'; }
- elseif (strpos($this->uadata['os'], 'HP-UX') !== false) { $this->uadata['platform'] = 'HP-UX'; }
- elseif (strpos($this->uadata['os'], 'AmigaOS') !== false) { $this->uadata['platform'] = 'Amiga'; }
- elseif (strpos($this->uadata['os'], 'Commodore 64') !== false) { $this->uadata['platform'] = 'C64'; }
- elseif (strpos($this->uadata['os'], 'OpenVMS') !== false) { $this->uadata['platform'] = 'OpenVMS'; }
- elseif (strpos($this->uadata['os'], 'Warp') !== false) { $this->uadata['platform'] = 'OS/2'; }
- elseif (strpos($this->uadata['os'], 'SymbianOS') !== false) { $this->uadata['platform'] = 'SymbianOS'; }
- elseif (strpos($this->uadata['os'], 'CYGWIN') !== false) { $this->uadata['platform'] = 'Windows'; }
- else { $this->uadata['platform'] = $this->uadata['os']; }
+ if (strpos($this->uadata['os'], 'Win') !== false) { $this->uadata['platform'] = 'Windows'; }
+ elseif (strpos($this->uadata['os'], 'Mac') !== false) { $this->uadata['platform'] = 'Macintosh'; }
+ elseif (strpos($this->uadata['os'], 'Linux') !== false) { $this->uadata['platform'] = 'Linux'; }
+ elseif (strpos($this->uadata['os'], 'Solaris') !== false) { $this->uadata['platform'] = 'Solaris'; }
+ elseif (strpos($this->uadata['os'], 'SunOS') !== false) { $this->uadata['platform'] = 'Solaris'; }
+ elseif (strpos($this->uadata['os'], 'BeOS') !== false) { $this->uadata['platform'] = 'BeOS'; }
+ elseif (strpos($this->uadata['os'], 'BePC') !== false) { $this->uadata['platform'] = 'BeOS'; }
+ elseif (strpos($this->uadata['os'], 'FreeBSD') !== false) { $this->uadata['platform'] = 'FreeBSD'; }
+ elseif (strpos($this->uadata['os'], 'OpenBSD') !== false) { $this->uadata['platform'] = 'OpenBSD'; }
+ elseif (strpos($this->uadata['os'], 'NetBSD') !== false) { $this->uadata['platform'] = 'NetBSD'; }
+ elseif (strpos($this->uadata['os'], 'AIX') !== false) { $this->uadata['platform'] = 'AIX'; }
+ elseif (strpos($this->uadata['os'], 'IRIX') !== false) { $this->uadata['platform'] = 'IRIX'; }
+ elseif (strpos($this->uadata['os'], 'HP-UX') !== false) { $this->uadata['platform'] = 'HP-UX'; }
+ elseif (strpos($this->uadata['os'], 'AmigaOS') !== false) { $this->uadata['platform'] = 'Amiga'; }
+ elseif (strpos($this->uadata['os'], 'webOS') !== false) { $this->uadata['platform'] = 'webOS'; }
+ elseif (strpos($this->uadata['os'], 'Commodore 64') !== false) { $this->uadata['platform'] = 'C64'; }
+ elseif (strpos($this->uadata['os'], 'OpenVMS') !== false) { $this->uadata['platform'] = 'OpenVMS'; }
+ elseif (strpos($this->uadata['os'], 'Warp') !== false) { $this->uadata['platform'] = 'OS/2'; }
+ elseif (strpos($this->uadata['os'], 'OS/2') !== false) { $this->uadata['platform'] = 'OS/2'; }
+ elseif (strpos($this->uadata['os'], 'SymbianOS') !== false) { $this->uadata['platform'] = 'SymbianOS'; }
+ elseif (strpos($this->uadata['os'], 'Gameboy') !== false) { $this->uadata['platform'] = 'Nintendo'; }
+ elseif (strpos($this->uadata['os'], 'Wii') !== false) { $this->uadata['platform'] = 'Nintendo'; }
+ elseif (strpos($this->uadata['os'], 'Nintendo') !== false) { $this->uadata['platform'] = 'Nintendo'; }
+ elseif (strpos($this->uadata['os'], 'J2ME') !== false) { $this->uadata['platform'] = 'Java'; }
+ elseif (strpos($this->uadata['os'], 'CYGWIN') !== false) { $this->uadata['platform'] = 'Windows'; }
+ elseif (strpos($this->uadata['os'], 'mingw') !== false) { $this->uadata['platform'] = 'Windows'; }
+ else { $this->uadata['platform'] = $this->uadata['os']; }
- $this->uadata['lang'] = str_replace('_', '-', $this->uadata['lang']);
+ $this->uadata['lang'] = str_replace('_', '-', $this->uadata['lang']);
+ }
}
return $this->uadata['os'];
}
return $this->uadata['geckodate'];
}
+ public function getGeckoTime() {
+ if (!isset($this->uadata['geckotime'])) {
+ $this->uadata['geckotime'] = null;
+ if (!is_null($this->getGeckoDate())) {
+ $use_time = (strlen($this->getGeckoDate()) > 8);
+ $gd_str = substr($this->getGeckoDate(),0,4).'-'.substr($this->getGeckoDate(),4,2).'-'.substr($this->getGeckoDate(),6,2);
+ if ($use_time) {
+ $gd_str .= substr($this->getGeckoDate(),8,2).':00';
+ $old_tz = date_default_timezone_get();
+ date_default_timezone_set("America/Los_Angeles");
+ }
+ $this->uadata['geckotime'] = strtotime($gd_str);
+ if ($use_time) { date_default_timezone_set($old_tz); }
+ }
+ }
+ return $this->uadata['geckotime'];
+ }
+
public function isBot() { return $this->bot; }
public function isns() {
--- /dev/null
+*.rrd
+graphs
--- /dev/null
+rrd-stat.php
\ No newline at end of file
$rrd_info['index']['hidden'] = true;
$rrd_info['overview']['page']['type'] = 'overview';
-$rrd_info['overview']['page']['index_ids'] = 'cpu,load,hd,mem|pct,eth0,eth1,connect,loopback,process,rrdup,ping.gateway,ping.hirsch,temp,sensors.fan,sensors.power|relpct';
+$rrd_info['overview']['page']['index_ids'] = 'cpu,load,mem,rrdup';
$rrd_info['overview']['page']['scan_config'] = false;
$rrd_info['overview']['page']['text_intro'] = 'Go to the <a href="?stat=index">index page</a> for a full list of all available statistics';
// $rrd_info['overview']['hidden'] = true;
$rrd_info['cpu']['graph']['fix_scale_y'] = true;
// $rrd_info['cpu']['graph']['force_recreate'] = true;
-$rrd_info['cpu0'] = $rrd_info['cpu'];
-$rrd_info['cpu0']['file'] = 'system.cpu0.rrd';
-$rrd_info['cpu0']['update'] =
- 'function {
- $sdata = file("/proc/stat"); $udata = array();
- foreach ($sdata as $sline) {
- if (preg_match("/^\s*cpu0\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)/", $sline, $regs)) {
- $udata = array("user"=>$regs[1],"nice"=>$regs[2],"system"=>$regs[3],"idle"=>$regs[4],
- "iowait"=>$regs[5],"irq"=>$regs[6],"softirq"=>$regs[7],"total"=>array_sum($regs));
- }
- }
- return $udata;
- }';
-
-$rrd_info['cpu1'] = $rrd_info['cpu'];
-$rrd_info['cpu1']['file'] = 'system.cpu1.rrd';
-$rrd_info['cpu1']['update'] =
- 'function {
- $sdata = file("/proc/stat"); $udata = array();
- foreach ($sdata as $sline) {
- if (preg_match("/^\s*cpu1\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)/", $sline, $regs)) {
- $udata = array("user"=>$regs[1],"nice"=>$regs[2],"system"=>$regs[3],"idle"=>$regs[4],
- "iowait"=>$regs[5],"irq"=>$regs[6],"softirq"=>$regs[7],"total"=>array_sum($regs));
- }
- }
- return $udata;
- }';
-
$rrd_info['mem']['file'] = 'system.mem.rrd';
$rrd_info['mem']['auto-update'] = true;
$rrd_info['mem']['fields'][] = array('name' => 'total', 'type' => 'GAUGE', 'heartbeat' => 600, 'min' => 'U', 'max' => 'U');
// $rrd_info['load']['graph']['force_recreate'] = true;
$rrd_info['load']['page']['data_colorize'] = true;
-$rrd_info['hd']['graph-only'] = true;
-$rrd_info['hd']['graph']['rows'][] = array('name'=>'root_used', 'dsname'=>'used', 'dsfile'=>'hd.root.rrd', 'gType'=>'',);
-$rrd_info['hd']['graph']['rows'][] = array('name'=>'root_total', 'dsname'=>'total', 'dsfile'=>'hd.root.rrd', 'gType'=>'');
-$rrd_info['hd']['graph']['rows'][] = array('name'=>'home_used', 'dsname'=>'used', 'dsfile'=>'hd.home.rrd', 'gType'=>'',);
-$rrd_info['hd']['graph']['rows'][] = array('name'=>'home_total', 'dsname'=>'total', 'dsfile'=>'hd.home.rrd', 'gType'=>'');
-$rrd_info['hd']['graph']['rows'][] = array('name'=>'backup_used', 'dsname'=>'used', 'dsfile'=>'hd.backup.rrd', 'gType'=>'',);
-$rrd_info['hd']['graph']['rows'][] = array('name'=>'backup_total', 'dsname'=>'total', 'dsfile'=>'hd.backup.rrd', 'gType'=>'');
-$rrd_info['hd']['graph']['rows'][] = array('name'=>'daten_used', 'dsname'=>'used', 'dsfile'=>'hd.daten.rrd', 'gType'=>'',);
-$rrd_info['hd']['graph']['rows'][] = array('name'=>'daten_total', 'dsname'=>'total', 'dsfile'=>'hd.daten.rrd', 'gType'=>'');
-$rrd_info['hd']['graph']['rows'][] = array('name'=>'media_used', 'dsname'=>'used', 'dsfile'=>'hd.media.rrd', 'gType'=>'',);
-$rrd_info['hd']['graph']['rows'][] = array('name'=>'media_total', 'dsname'=>'total', 'dsfile'=>'hd.media.rrd', 'gType'=>'');
-$rrd_info['hd']['graph']['rows'][] = array('name'=>'mozilla_used', 'dsname'=>'used', 'dsfile'=>'hd.mozilla.rrd', 'gType'=>'',);
-$rrd_info['hd']['graph']['rows'][] = array('name'=>'mozilla_total', 'dsname'=>'total', 'dsfile'=>'hd.mozilla.rrd', 'gType'=>'');
-$rrd_info['hd']['graph']['rows'][] = array('name'=>'temp_used', 'dsname'=>'used', 'dsfile'=>'hd.temp.rrd', 'gType'=>'',);
-$rrd_info['hd']['graph']['rows'][] = array('name'=>'temp_total', 'dsname'=>'total', 'dsfile'=>'hd.temp.rrd', 'gType'=>'');
-$rrd_info['hd']['graph']['rows'][] = array('name'=>'trans_used', 'dsname'=>'used', 'dsfile'=>'hd.trans.rrd', 'gType'=>'',);
-$rrd_info['hd']['graph']['rows'][] = array('name'=>'trans_total', 'dsname'=>'total', 'dsfile'=>'hd.trans.rrd', 'gType'=>'');
-$rrd_info['hd']['graph']['rows'][] = array('name'=>'video_used', 'dsname'=>'used', 'dsfile'=>'hd.video.rrd', 'gType'=>'',);
-$rrd_info['hd']['graph']['rows'][] = array('name'=>'video_total', 'dsname'=>'total', 'dsfile'=>'hd.video.rrd', 'gType'=>'');
-$rrd_info['hd']['graph']['rows'][] = array('name'=>'root_old_used', 'dsname'=>'used', 'dsfile'=>'hd.root_old.rrd', 'gType'=>'',);
-$rrd_info['hd']['graph']['rows'][] = array('name'=>'root_old_total', 'dsname'=>'total', 'dsfile'=>'hd.root_old.rrd', 'gType'=>'');
-$rrd_info['hd']['graph']['rows'][] = array('name'=>'win32sys_used', 'dsname'=>'used', 'dsfile'=>'hd.win32sys.rrd', 'gType'=>'',);
-$rrd_info['hd']['graph']['rows'][] = array('name'=>'win32sys_total', 'dsname'=>'total', 'dsfile'=>'hd.win32sys.rrd', 'gType'=>'');
-$rrd_info['hd']['graph']['rows'][] = array('name'=>'win1_used', 'dsname'=>'used', 'dsfile'=>'hd.win1.rrd', 'gType'=>'',);
-$rrd_info['hd']['graph']['rows'][] = array('name'=>'win1_total', 'dsname'=>'total', 'dsfile'=>'hd.win1.rrd', 'gType'=>'');
-$rrd_info['hd']['graph']['rows'][] = array('name'=>'win2_used', 'dsname'=>'used', 'dsfile'=>'hd.win2.rrd', 'gType'=>'',);
-$rrd_info['hd']['graph']['rows'][] = array('name'=>'win2_total', 'dsname'=>'total', 'dsfile'=>'hd.win2.rrd', 'gType'=>'');
-$rrd_info['hd']['graph']['rows'][] = array('dType'=>'CDEF', 'name'=>'root', 'rpn_expr'=>'root_used,root_total,/,100,*', 'gType'=>'LINE1', 'color'=>'#0000FF', 'legend'=>'Root');
-$rrd_info['hd']['graph']['rows'][] = array('dType'=>'CDEF', 'name'=>'home', 'rpn_expr'=>'home_used,home_total,/,100,*', 'gType'=>'LINE1', 'color'=>'#008000', 'legend'=>'Home');
-$rrd_info['hd']['graph']['rows'][] = array('dType'=>'CDEF', 'name'=>'backup', 'rpn_expr'=>'backup_used,backup_total,/,100,*', 'gType'=>'LINE1', 'color'=>'#CCCC00', 'legend'=>'Backup');
-$rrd_info['hd']['graph']['rows'][] = array('dType'=>'CDEF', 'name'=>'daten', 'rpn_expr'=>'daten_used,daten_total,/,100,*', 'gType'=>'LINE1', 'color'=>'#0080FF', 'legend'=>'Daten');
-$rrd_info['hd']['graph']['rows'][] = array('dType'=>'CDEF', 'name'=>'media', 'rpn_expr'=>'media_used,media_total,/,100,*', 'gType'=>'LINE1', 'color'=>'#FF6000', 'legend'=>'Media');
-$rrd_info['hd']['graph']['rows'][] = array('dType'=>'CDEF', 'name'=>'mozilla', 'rpn_expr'=>'mozilla_used,mozilla_total,/,100,*', 'gType'=>'LINE1', 'color'=>'#FF0000', 'legend'=>'Mozilla');
-$rrd_info['hd']['graph']['rows'][] = array('dType'=>'CDEF', 'name'=>'temp', 'rpn_expr'=>'temp_used,temp_total,/,100,*', 'gType'=>'LINE1', 'color'=>'#000000', 'legend'=>'Temp');
-$rrd_info['hd']['graph']['rows'][] = array('dType'=>'CDEF', 'name'=>'trans', 'rpn_expr'=>'trans_used,trans_total,/,100,*', 'gType'=>'LINE1', 'color'=>'#808080', 'legend'=>'Trans');
-$rrd_info['hd']['graph']['rows'][] = array('dType'=>'CDEF', 'name'=>'video', 'rpn_expr'=>'video_used,video_total,/,100,*', 'gType'=>'LINE1', 'color'=>'#808000', 'legend'=>'Video');
-$rrd_info['hd']['graph']['rows'][] = array('dType'=>'CDEF', 'name'=>'root_old', 'rpn_expr'=>'root_old_used,root_old_total,/,100,*', 'gType'=>'LINE1', 'color'=>'#CCCCCC', 'legend'=>'Old Root');
-$rrd_info['hd']['graph']['rows'][] = array('dType'=>'CDEF', 'name'=>'win32sys', 'rpn_expr'=>'win32sys_used,win32sys_total,/,100,*', 'gType'=>'LINE1', 'color'=>'#00CC00', 'legend'=>'Old Win98');
-$rrd_info['hd']['graph']['rows'][] = array('dType'=>'CDEF', 'name'=>'win1', 'rpn_expr'=>'win1_used,win1_total,/,100,*', 'gType'=>'LINE1', 'color'=>'#FF00CC', 'legend'=>'Win 1');
-$rrd_info['hd']['graph']['rows'][] = array('dType'=>'CDEF', 'name'=>'win2', 'rpn_expr'=>'win2_used,win2_total,/,100,*', 'gType'=>'LINE1', 'color'=>'#FF80CC', 'legend'=>'Win 2');
-// $rrd_info['hd.root']['graph']['units_length'] = 4;
-$rrd_info['hd']['graph']['label_y'] = '% Used';
-$rrd_info['hd']['graph']['units_exponent'] = 0;
-$rrd_info['hd']['graph']['units_length'] = 4;
-$rrd_info['hd']['graph']['min_y'] = 0;
-$rrd_info['hd']['graph']['max_y'] = 100;
-$rrd_info['hd']['graph']['fix_scale_y'] = true;
-// $rrd_info['hd']['graph']['force_recreate'] = true;
-$rrd_info['hd']['page']['show_update'] = false;
-
-$rrd_info['hd.root']['file'] = 'hd.root.rrd';
-$rrd_info['hd.root']['auto-update'] = true;
-$rrd_info['hd.root']['fields'][] = array('name' => 'used', 'type' => 'GAUGE', 'heartbeat' => 600, 'min' => 'U', 'max' => 'U');
-$rrd_info['hd.root']['fields'][] = array('name' => 'total', 'type' => 'GAUGE', 'heartbeat' => 600, 'min' => 'U', 'max' => 'U');
-$rrd_info['hd.root']['update'] =
- 'function {
- $sdata = explode("\n", `/bin/df -k -l`); $udata = array();
- foreach ($sdata as $sline) {
- if (preg_match("/(\d+)\s+(\d+)\s+\d+\s+\d+%\s+\/$/", $sline, $regs)) {
- $udata = array("total"=>$regs[1], "used"=>$regs[2]);
- }
- }
- return $udata;
- }';
-$rrd_info['hd.root']['graph']['rows'][] = array('name'=>'used', 'gType'=>'AREA', 'color'=>'#00CC00', 'legend'=>'Used');
-$rrd_info['hd.root']['graph']['rows'][] = array('name'=>'total', 'gType'=>'LINE1', 'color'=>'#808080', 'legend'=>'Available');
-// $rrd_info['hd.root']['graph']['units_length'] = 4;
-$rrd_info['hd.root']['graph']['label_y'] = 'Bytes';
-$rrd_info['hd.root']['graph']['units_binary'] = true;
-$rrd_info['hd.root']['graph']['scale'] = 1024;
-$rrd_info['hd.root']['graph']['min_y'] = 0;
-// $rrd_info['hd.root']['graph']['force_recreate'] = true;
-
-$rrd_info['hd.home'] = $rrd_info['hd.root'];
-$rrd_info['hd.home']['file'] = 'hd.home.rrd';
-$rrd_info['hd.home']['update'] =
- 'function {
- $sdata = explode("\n", `/bin/df -k -l`); $udata = array();
- foreach ($sdata as $sline) {
- if (preg_match("/(\d+)\s+(\d+)\s+\d+\s+\d+%\s+\/home$/", $sline, $regs)) {
- $udata = array("total"=>$regs[1], "used"=>$regs[2]);
- }
- }
- return $udata;
- }';
-// $rrd_info['hd.home']['graph']['force_recreate'] = true;
-
-$rrd_info['hd.backup'] = $rrd_info['hd.home'];
-$rrd_info['hd.backup']['file'] = 'hd.backup.rrd';
-$rrd_info['hd.backup']['update'] =
- 'function {
- $sdata = explode("\n", `/bin/df -k -l`); $udata = array();
- foreach ($sdata as $sline) {
- if (preg_match("/(\d+)\s+(\d+)\s+\d+\s+\d+%\s+\/mnt\/backup$/", $sline, $regs)) {
- $udata = array("total"=>$regs[1], "used"=>$regs[2]);
- }
- }
- return $udata;
- }';
-// $rrd_info['hd.backup']['graph']['force_recreate'] = true;
-
-$rrd_info['hd.backup-x'] = $rrd_info['hd.home'];
-$rrd_info['hd.backup-x']['file'] = 'hd.backup-x.rrd';
-$rrd_info['hd.backup-x']['update'] =
- 'print("L\nL");';
-// $rrd_info['hd.backup-x']['graph']['force_recreate'] = true;
-
-$rrd_info['hd.boot_old'] = $rrd_info['hd.home'];
-$rrd_info['hd.boot_old']['file'] = 'hd.boot_old.rrd';
-$rrd_info['hd.boot_old']['update'] =
- 'function {
- $sdata = explode("\n", `/bin/df -k -l`); $udata = array();
- foreach ($sdata as $sline) {
- if (preg_match("/(\d+)\s+(\d+)\s+\d+\s+\d+%\s+\/mnt\/boot_old$/", $sline, $regs)) {
- $udata = array("total"=>$regs[1], "used"=>$regs[2]);
- }
- }
- return $udata;
- }';
-// $rrd_info['hd.boot_old']['graph']['force_recreate'] = true;
-
-$rrd_info['hd.daten'] = $rrd_info['hd.home'];
-$rrd_info['hd.daten']['file'] = 'hd.daten.rrd';
-$rrd_info['hd.daten']['update'] =
- 'function {
- $sdata = explode("\n", `/bin/df -k -l`); $udata = array();
- foreach ($sdata as $sline) {
- if (preg_match("/(\d+)\s+(\d+)\s+\d+\s+\d+%\s+\/mnt\/daten$/", $sline, $regs)) {
- $udata = array("total"=>$regs[1], "used"=>$regs[2]);
- }
- }
- return $udata;
- }';
-// $rrd_info['hd.daten']['graph']['force_recreate'] = true;
-
-$rrd_info['hd.media'] = $rrd_info['hd.home'];
-$rrd_info['hd.media']['file'] = 'hd.media.rrd';
-$rrd_info['hd.media']['update'] =
- 'function {
- $sdata = explode("\n", `/bin/df -k -l`); $udata = array();
- foreach ($sdata as $sline) {
- if (preg_match("/(\d+)\s+(\d+)\s+\d+\s+\d+%\s+\/mnt\/media$/", $sline, $regs)) {
- $udata = array("total"=>$regs[1], "used"=>$regs[2]);
- }
- }
- return $udata;
- }';
-// $rrd_info['hd.media']['graph']['force_recreate'] = true;
-
-$rrd_info['hd.mozilla'] = $rrd_info['hd.home'];
-$rrd_info['hd.mozilla']['file'] = 'hd.mozilla.rrd';
-$rrd_info['hd.mozilla']['update'] =
- 'function {
- $sdata = explode("\n", `/bin/df -k -l`); $udata = array();
- foreach ($sdata as $sline) {
- if (preg_match("/(\d+)\s+(\d+)\s+\d+\s+\d+%\s+\/mnt\/mozilla$/", $sline, $regs)) {
- $udata = array("total"=>$regs[1], "used"=>$regs[2]);
- }
- }
- return $udata;
- }';
-// $rrd_info['hd.mozilla']['graph']['force_recreate'] = true;
-
-$rrd_info['hd.root_old'] = $rrd_info['hd.home'];
-$rrd_info['hd.root_old']['file'] = 'hd.root_old.rrd';
-$rrd_info['hd.root_old']['update'] =
- 'function {
- $sdata = explode("\n", `/bin/df -k -l`); $udata = array();
- foreach ($sdata as $sline) {
- if (preg_match("/(\d+)\s+(\d+)\s+\d+\s+\d+%\s+\/mnt\/root_old$/", $sline, $regs)) {
- $udata = array("total"=>$regs[1], "used"=>$regs[2]);
- }
- }
- return $udata;
- }';
-// $rrd_info['hd.root_old']['graph']['force_recreate'] = true;
-
-$rrd_info['hd.temp'] = $rrd_info['hd.home'];
-$rrd_info['hd.temp']['file'] = 'hd.temp.rrd';
-$rrd_info['hd.temp']['update'] =
- 'function {
- $sdata = explode("\n", `/bin/df -k -l`); $udata = array();
- foreach ($sdata as $sline) {
- if (preg_match("/(\d+)\s+(\d+)\s+\d+\s+\d+%\s+\/mnt\/temp$/", $sline, $regs)) {
- $udata = array("total"=>$regs[1], "used"=>$regs[2]);
- }
- }
- return $udata;
- }';
-// $rrd_info['hd.temp']['graph']['force_recreate'] = true;
-
-$rrd_info['hd.trans'] = $rrd_info['hd.home'];
-$rrd_info['hd.trans']['file'] = 'hd.trans.rrd';
-$rrd_info['hd.trans']['update'] =
- 'function {
- $sdata = explode("\n", `/bin/df -k -l`); $udata = array();
- foreach ($sdata as $sline) {
- if (preg_match("/(\d+)\s+(\d+)\s+\d+\s+\d+%\s+\/mnt\/trans$/", $sline, $regs)) {
- $udata = array("total"=>$regs[1], "used"=>$regs[2]);
- }
- }
- return $udata;
- }';
-// $rrd_info['hd.trans']['graph']['force_recreate'] = true;
-
-$rrd_info['hd.video'] = $rrd_info['hd.home'];
-$rrd_info['hd.video']['file'] = 'hd.video.rrd';
-$rrd_info['hd.video']['update'] =
- 'function {
- $sdata = explode("\n", `/bin/df -k -l`); $udata = array();
- foreach ($sdata as $sline) {
- if (preg_match("/(\d+)\s+(\d+)\s+\d+\s+\d+%\s+\/mnt\/video$/", $sline, $regs)) {
- $udata = array("total"=>$regs[1], "used"=>$regs[2]);
- }
- }
- return $udata;
- }';
-// $rrd_info['hd.video']['graph']['force_recreate'] = true;
-
-$rrd_info['hd.win1'] = $rrd_info['hd.home'];
-$rrd_info['hd.win1']['file'] = 'hd.win1.rrd';
-$rrd_info['hd.win1']['update'] =
- 'function {
- $sdata = explode("\n", `/bin/df -k -l`); $udata = array();
- foreach ($sdata as $sline) {
- if (preg_match("/(\d+)\s+(\d+)\s+\d+\s+\d+%\s+\/mnt\/win1$/", $sline, $regs)) {
- $udata = array("total"=>$regs[1], "used"=>$regs[2]);
- }
- }
- return $udata;
- }';
-// $rrd_info['hd.win1']['graph']['force_recreate'] = true;
-
-$rrd_info['hd.win2'] = $rrd_info['hd.home'];
-$rrd_info['hd.win2']['file'] = 'hd.win2.rrd';
-$rrd_info['hd.win2']['update'] =
- 'function {
- $sdata = explode("\n", `/bin/df -k -l`); $udata = array();
- foreach ($sdata as $sline) {
- if (preg_match("/(\d+)\s+(\d+)\s+\d+\s+\d+%\s+\/mnt\/win2$/", $sline, $regs)) {
- $udata = array("total"=>$regs[1], "used"=>$regs[2]);
- }
- }
- return $udata;
- }';
-// $rrd_info['hd.win2']['graph']['force_recreate'] = true;
-
-$rrd_info['hd.win32sys'] = $rrd_info['hd.root'];
-$rrd_info['hd.win32sys']['file'] = 'hd.win32sys.rrd';
-$rrd_info['hd.win32sys']['update'] =
- 'function {
- $sdata = explode("\n", `/bin/df -k -l`); $udata = array();
- foreach ($sdata as $sline) {
- if (preg_match("/(\d+)\s+(\d+)\s+\d+\s+\d+%\s+\/mnt\/win32sys$/", $sline, $regs)) {
- $udata = array("total"=>$regs[1], "used"=>$regs[2]);
- }
- }
- return $udata;
- }';
-// $rrd_info['hd.win32sys']['graph']['force_recreate'] = true;
-
-$rrd_info['hd.old.root'] = $rrd_info['hd.root'];
-$rrd_info['hd.old.root']['file'] = 'hd.old.root.rrd';
-$rrd_info['hd.old.root']['update'] =
- 'function {
- $sdata = explode("\n", `/bin/df -k -l`); $udata = array();
- foreach ($sdata as $sline) {
- if (preg_match("/(\d+)\s+(\d+)\s+\d+\s+\d+%\s+\/mnt\/old\/root$/", $sline, $regs)) {
- $udata = array("total"=>$regs[1], "used"=>$regs[2]);
- }
- }
- return $udata;
- }';
-// $rrd_info['hd.old.root']['graph']['force_recreate'] = true;
-
-$rrd_info['hd.old.home'] = $rrd_info['hd.root'];
-$rrd_info['hd.old.home']['file'] = 'hd.old.home.rrd';
-$rrd_info['hd.old.home']['update'] =
- 'function {
- $sdata = explode("\n", `/bin/df -k -l`); $udata = array();
- foreach ($sdata as $sline) {
- if (preg_match("/(\d+)\s+(\d+)\s+\d+\s+\d+%\s+\/mnt\/old\/home$/", $sline, $regs)) {
- $udata = array("total"=>$regs[1], "used"=>$regs[2]);
- }
- }
- return $udata;
- }';
-// $rrd_info['hd.old.home']['graph']['force_recreate'] = true;
-
-$rrd_info['hd.old.backup'] = $rrd_info['hd.home'];
-$rrd_info['hd.old.backup']['file'] = 'hd.old.backup.rrd';
-$rrd_info['hd.old.backup']['update'] =
- 'function {
- $sdata = explode("\n", `/bin/df -k -l`); $udata = array();
- foreach ($sdata as $sline) {
- if (preg_match("/(\d+)\s+(\d+)\s+\d+\s+\d+%\s+\/mnt\/old\/backup$/", $sline, $regs)) {
- $udata = array("total"=>$regs[1], "used"=>$regs[2]);
- }
- }
- return $udata;
- }';
-// $rrd_info['hd.old.backup']['graph']['force_recreate'] = true;
-
-$rrd_info['hd.backup-x'] = $rrd_info['hd.home'];
-$rrd_info['hd.backup-x']['file'] = 'hd.backup-x.rrd';
-$rrd_info['hd.backup-x']['update'] =
- 'print("L\nL");';
-// $rrd_info['hd.backup-x']['graph']['force_recreate'] = true;
-
-$rrd_info['hd.old.boot_old'] = $rrd_info['hd.home'];
-$rrd_info['hd.old.boot_old']['file'] = 'hd.old.boot_old.rrd';
-$rrd_info['hd.old.boot_old']['update'] =
- 'function {
- $sdata = explode("\n", `/bin/df -k -l`); $udata = array();
- foreach ($sdata as $sline) {
- if (preg_match("/(\d+)\s+(\d+)\s+\d+\s+\d+%\s+\/mnt\/old\/boot_old$/", $sline, $regs)) {
- $udata = array("total"=>$regs[1], "used"=>$regs[2]);
- }
- }
- return $udata;
- }';
-// $rrd_info['hd.old.boot_old']['graph']['force_recreate'] = true;
-
-$rrd_info['hd.old.daten'] = $rrd_info['hd.home'];
-$rrd_info['hd.old.daten']['file'] = 'hd.old.daten.rrd';
-$rrd_info['hd.old.daten']['update'] =
- 'function {
- $sdata = explode("\n", `/bin/df -k -l`); $udata = array();
- foreach ($sdata as $sline) {
- if (preg_match("/(\d+)\s+(\d+)\s+\d+\s+\d+%\s+\/mnt\/old\/daten$/", $sline, $regs)) {
- $udata = array("total"=>$regs[1], "used"=>$regs[2]);
- }
- }
- return $udata;
- }';
-// $rrd_info['hd.old.daten']['graph']['force_recreate'] = true;
-
-$rrd_info['hd.old.media'] = $rrd_info['hd.home'];
-$rrd_info['hd.old.media']['file'] = 'hd.old.media.rrd';
-$rrd_info['hd.old.media']['update'] =
- 'function {
- $sdata = explode("\n", `/bin/df -k -l`); $udata = array();
- foreach ($sdata as $sline) {
- if (preg_match("/(\d+)\s+(\d+)\s+\d+\s+\d+%\s+\/mnt\/old\/media$/", $sline, $regs)) {
- $udata = array("total"=>$regs[1], "used"=>$regs[2]);
- }
- }
- return $udata;
- }';
-// $rrd_info['hd.old.media']['graph']['force_recreate'] = true;
-
-$rrd_info['hd.old.mozilla'] = $rrd_info['hd.home'];
-$rrd_info['hd.old.mozilla']['file'] = 'hd.old.mozilla.rrd';
-$rrd_info['hd.old.mozilla']['update'] =
- 'function {
- $sdata = explode("\n", `/bin/df -k -l`); $udata = array();
- foreach ($sdata as $sline) {
- if (preg_match("/(\d+)\s+(\d+)\s+\d+\s+\d+%\s+\/mnt\/old\/mozilla$/", $sline, $regs)) {
- $udata = array("total"=>$regs[1], "used"=>$regs[2]);
- }
- }
- return $udata;
- }';
-// $rrd_info['hd.old.mozilla']['graph']['force_recreate'] = true;
-
-$rrd_info['hd.old.root_old'] = $rrd_info['hd.home'];
-$rrd_info['hd.old.root_old']['file'] = 'hd.old.root_old.rrd';
-$rrd_info['hd.old.root_old']['update'] =
- 'function {
- $sdata = explode("\n", `/bin/df -k -l`); $udata = array();
- foreach ($sdata as $sline) {
- if (preg_match("/(\d+)\s+(\d+)\s+\d+\s+\d+%\s+\/mnt\/old\/root_old$/", $sline, $regs)) {
- $udata = array("total"=>$regs[1], "used"=>$regs[2]);
- }
- }
- return $udata;
- }';
-// $rrd_info['hd.old.root_old']['graph']['force_recreate'] = true;
-
-$rrd_info['hd.old.temp'] = $rrd_info['hd.home'];
-$rrd_info['hd.old.temp']['file'] = 'hd.old.temp.rrd';
-$rrd_info['hd.old.temp']['update'] =
- 'function {
- $sdata = explode("\n", `/bin/df -k -l`); $udata = array();
- foreach ($sdata as $sline) {
- if (preg_match("/(\d+)\s+(\d+)\s+\d+\s+\d+%\s+\/mnt\/old\/temp$/", $sline, $regs)) {
- $udata = array("total"=>$regs[1], "used"=>$regs[2]);
- }
- }
- return $udata;
- }';
-// $rrd_info['hd.old.temp']['graph']['force_recreate'] = true;
-
-$rrd_info['hd.old.trans'] = $rrd_info['hd.home'];
-$rrd_info['hd.old.trans']['file'] = 'hd.old.trans.rrd';
-$rrd_info['hd.old.trans']['update'] =
- 'function {
- $sdata = explode("\n", `/bin/df -k -l`); $udata = array();
- foreach ($sdata as $sline) {
- if (preg_match("/(\d+)\s+(\d+)\s+\d+\s+\d+%\s+\/mnt\/old\/trans$/", $sline, $regs)) {
- $udata = array("total"=>$regs[1], "used"=>$regs[2]);
- }
- }
- return $udata;
- }';
-// $rrd_info['hd.old.trans']['graph']['force_recreate'] = true;
-
-$rrd_info['hd.old.video'] = $rrd_info['hd.home'];
-$rrd_info['hd.old.video']['file'] = 'hd.old.video.rrd';
-$rrd_info['hd.old.video']['update'] =
- 'function {
- $sdata = explode("\n", `/bin/df -k -l`); $udata = array();
- foreach ($sdata as $sline) {
- if (preg_match("/(\d+)\s+(\d+)\s+\d+\s+\d+%\s+\/mnt\/old\/video$/", $sline, $regs)) {
- $udata = array("total"=>$regs[1], "used"=>$regs[2]);
- }
- }
- return $udata;
- }';
-// $rrd_info['hd.old.video']['graph']['force_recreate'] = true;
-
-$rrd_info['hd.old.win1'] = $rrd_info['hd.home'];
-$rrd_info['hd.old.win1']['file'] = 'hd.old.win1.rrd';
-$rrd_info['hd.old.win1']['update'] =
- 'function {
- $sdata = explode("\n", `/bin/df -k -l`); $udata = array();
- foreach ($sdata as $sline) {
- if (preg_match("/(\d+)\s+(\d+)\s+\d+\s+\d+%\s+\/mnt\/old\/win1$/", $sline, $regs)) {
- $udata = array("total"=>$regs[1], "used"=>$regs[2]);
- }
- }
- return $udata;
- }';
-// $rrd_info['hd.old.win1']['graph']['force_recreate'] = true;
-
-$rrd_info['hd.old.win2'] = $rrd_info['hd.home'];
-$rrd_info['hd.old.win2']['file'] = 'hd.old.win2.rrd';
-$rrd_info['hd.old.win2']['update'] =
- 'function {
- $sdata = explode("\n", `/bin/df -k -l`); $udata = array();
- foreach ($sdata as $sline) {
- if (preg_match("/(\d+)\s+(\d+)\s+\d+\s+\d+%\s+\/mnt\/old\/win2$/", $sline, $regs)) {
- $udata = array("total"=>$regs[1], "used"=>$regs[2]);
- }
- }
- return $udata;
- }';
-// $rrd_info['hd.old.win2']['graph']['force_recreate'] = true;
-
-$rrd_info['hd.old.win32sys'] = $rrd_info['hd.root'];
-$rrd_info['hd.old.win32sys']['file'] = 'hd.old.win32sys.rrd';
-$rrd_info['hd.old.win32sys']['update'] =
- 'function {
- $sdata = explode("\n", `/bin/df -k -l`); $udata = array();
- foreach ($sdata as $sline) {
- if (preg_match("/(\d+)\s+(\d+)\s+\d+\s+\d+%\s+\/mnt\/old\/win32sys$/", $sline, $regs)) {
- $udata = array("total"=>$regs[1], "used"=>$regs[2]);
- }
- }
- return $udata;
- }';
-// $rrd_info['hd.old.win32sys']['graph']['force_recreate'] = true;
-
-$rrd_info['hdd.temp']['file'] = 'hdd.temp.rrd';
-$rrd_info['hdd.temp']['auto-update'] = true;
-$rrd_info['hdd.temp']['fields'][] = array('name' => 'ibm30', 'type' => 'GAUGE', 'heartbeat' => 600, 'min' => 'U', 'max' => 'U');
-$rrd_info['hdd.temp']['fields'][] = array('name' => 'hit160', 'type' => 'GAUGE', 'heartbeat' => 600, 'min' => 'U', 'max' => 'U');
-$rrd_info['hdd.temp']['fields'][] = array('name' => 'sg320', 'type' => 'GAUGE', 'heartbeat' => 600, 'min' => 'U', 'max' => 'U');
-$rrd_info['hdd.temp']['update'] =
- 'function {
- $sdata = explode("\n", `hddtemp /dev/sda /dev/hda /dev/hdb`);
- $udata = array("ibm30"=>null,"hit160"=>null,"sg320"=>null);
- foreach ($sdata as $sline) {
- if (preg_match("/IBM-DTLA-307030:\s+([+-]?[\d\.]+)\s*.C/", $sline, $regs)) { $udata["ibm30"] = $regs[1]; }
- elseif (preg_match("/HDS722516VLAT80:\s+([+-]?[\d\.]+)\s*.C/", $sline, $regs)) { $udata["hit160"] = $regs[1]; }
- elseif (preg_match("/ST3320620AS:\s+([+-]?[\d\.]+)\s*.C/", $sline, $regs)) { $udata["sg320"] = $regs[1]; }
- }
- return $udata;
- }';
-$rrd_info['hdd.temp']['graph']['rows'][] = array('name'=>'ibm30', 'gType'=>'LINE1', 'color'=>'#808080', 'legend'=>'IBM 30 GB');
-$rrd_info['hdd.temp']['graph']['rows'][] = array('name'=>'hit160', 'gType'=>'LINE1', 'color'=>'#FF0000', 'legend'=>'Hitachi 160 GB');
-$rrd_info['hdd.temp']['graph']['rows'][] = array('name'=>'sg320', 'gType'=>'LINE1', 'color'=>'#FF8000', 'legend'=>'Seagate 320 GB');
-$rrd_info['hdd.temp']['graph']['units_length'] = 4;
-$rrd_info['hdd.temp']['graph']['label_y'] = '°C';
-// $rrd_info['hdd.temp']['graph']['max_y'] = 13;
-// $rrd_info['hdd.temp']['graph']['min_y'] = -13;
-
-$rrd_info['video.temp']['file'] = 'video.temp.rrd';
-$rrd_info['video.temp']['auto-update'] = true;
-$rrd_info['video.temp']['fields'][] = array('name' => 'gpu_core_temp', 'type' => 'GAUGE', 'heartbeat' => 600, 'min' => 'U', 'max' => 'U');
-$rrd_info['video.temp']['fields'][] = array('name' => 'gpu_temp', 'type' => 'GAUGE', 'heartbeat' => 600, 'min' => 'U', 'max' => 'U');
-$rrd_info['video.temp']['update'] =
- 'function {
- $udata = array("gpu_core_temp"=>null,"gpu_temp"=>null);
- $sdata = explode("\n", `nvidia-settings --query GPUCoreTemp 2>&1`);
- foreach ($sdata as $sline) {
- if (preg_match("/Attribute .GPUCoreTemp.+:\s+([+-]?[\d\.]+)\./", $sline, $regs)) {
- $udata["gpu_core_temp"] = $regs[1];
- }
- }
- $sdata = explode("\n", `nvclock -T`);
- foreach ($sdata as $sline) {
- if (preg_match("/GPU temperature:\s+([+-]?[\d\.]+)C/", $sline, $regs)) {
- $udata["gpu_temp"] = $regs[1];
- }
- }
- return $udata;
- }';
-$rrd_info['video.temp']['graph']['rows'][] = array('name'=>'gpu_core_temp', 'gType'=>'LINE1', 'color'=>'#808080', 'legend'=>'GPU Core Temp');
-$rrd_info['video.temp']['graph']['rows'][] = array('name'=>'gpu_temp', 'gType'=>'LINE1', 'color'=>'#FF8080', 'legend'=>'GPU Temp');
-$rrd_info['video.temp']['graph']['units_length'] = 4;
-$rrd_info['video.temp']['graph']['label_y'] = '°C';
-// $rrd_info['video.temp']['graph']['max_y'] = 13;
-// $rrd_info['video.temp']['graph']['min_y'] = -13;
-
-// SNMP interfaces
-$rrd_info['eth0']['file'] = 'net.eth0.rrd';
-$rrd_info['eth0']['auto-update'] = true;
-$rrd_info['eth0']['fields'][] = array('name'=>'incoming', 'type'=>'COUNTER',
- 'heartbeat'=>600, 'min'=>'U', 'max'=>'U', 'update'=>'snmp-if:eth0:in', 'legend'=>'Incoming');
-$rrd_info['eth0']['fields'][] = array('name'=>'outgoing', 'type'=>'COUNTER',
- 'heartbeat'=>600, 'min'=>'U', 'max'=>'U', 'update'=>'snmp-if:eth0:out', 'legend'=>'Outgoing');
-$rrd_info['eth0']['graph']['label_y'] = 'Bytes per second';
-
-$rrd_info['eth1']['file'] = 'net.eth1.rrd';
-$rrd_info['eth1']['auto-update'] = true;
-$rrd_info['eth1']['fields'][] = array('name'=>'incoming', 'type'=>'COUNTER',
- 'heartbeat'=>600, 'min'=>'U', 'max'=>'U', 'update'=>'snmp-if:eth1:in', 'legend'=>'Incoming');
-$rrd_info['eth1']['fields'][] = array('name'=>'outgoing', 'type'=>'COUNTER',
- 'heartbeat'=>600, 'min'=>'U', 'max'=>'U', 'update'=>'snmp-if:eth1:out', 'legend'=>'Outgoing');
-$rrd_info['eth1']['graph']['label_y'] = 'Bytes per second';
-// $rrd_info['eth1']['graph']['force_recreate'] = true;
-
-$rrd_info['loopback']['file'] = 'net.loopback.rrd';
-$rrd_info['loopback']['auto-update'] = true;
-$rrd_info['loopback']['fields'][] = array('name'=>'incoming', 'type'=>'COUNTER',
- 'heartbeat'=>600, 'min'=>'U', 'max'=>'U', 'update'=>'snmp-if:lo:in', 'legend'=>'Incoming');
-$rrd_info['loopback']['fields'][] = array('name'=>'outgoing', 'type'=>'COUNTER',
- 'heartbeat'=>600, 'min'=>'U', 'max'=>'U', 'update'=>'snmp-if:lo:out', 'legend'=>'Outgoing');
-$rrd_info['loopback']['graph']['label_y'] = 'Bytes per second';
-
-$rrd_info['connect']['file'] = 'net.connect.rrd';
-$rrd_info['connect']['auto-update'] = true;
-$rrd_info['connect']['fields'][] = array('name' => 'listen', 'type' => 'GAUGE', 'heartbeat' => 600, 'min' => 'U', 'max' => 'U');
-$rrd_info['connect']['fields'][] = array('name' => 'run_http', 'type' => 'GAUGE', 'heartbeat' => 600, 'min' => 'U', 'max' => 'U');
-$rrd_info['connect']['fields'][] = array('name' => 'run_other', 'type' => 'GAUGE', 'heartbeat' => 600, 'min' => 'U', 'max' => 'U');
-$rrd_info['connect']['fields'][] = array('name' => 'rest_http', 'type' => 'GAUGE', 'heartbeat' => 600, 'min' => 'U', 'max' => 'U');
-$rrd_info['connect']['fields'][] = array('name' => 'rest_other', 'type' => 'GAUGE', 'heartbeat' => 600, 'min' => 'U', 'max' => 'U');
-$rrd_info['connect']['fields'][] = array('name' => 'udp', 'type' => 'GAUGE', 'heartbeat' => 600, 'min' => 'U', 'max' => 'U');
-$rrd_info['connect']['update'] =
- 'function {
- $sdata = explode("\n", `LANG=C /bin/netstat -n -a`);
- $udata = array("listen"=>0,"run_http"=>0,"run_other"=>0,"rest_http"=>0,"rest_other"=>0,"udp"=>0);
- foreach ($sdata as $sline) {
- if (substr($sline, 0, 3) == "tcp") {
- if (preg_match("/LISTEN\s*$/", $sline)) { $udata["listen"]++; }
- elseif (preg_match("/:80\s+[\d\.:*]+\s+ESTABLISHED\s*/", $sline)) { $udata["run_http"]++; }
- elseif (preg_match("/^tcp\s+\d+\s+\d+\s+[\d\.]+:80/", $sline)) { $udata["rest_http"]++; }
- elseif (preg_match("/ESTABLISHED\s*$/", $sline)) { $udata["run_other"]++; }
- else { $udata["rest_other"]++; }
- }
- elseif (substr($sline, 0, 3) == "udp") { $udata["udp"]++; }
- }
- return $udata;
- }';
-$rrd_info['connect']['graph']['rows'][] = array('name'=>'listen', 'gType'=>'AREA', 'color'=>'#CCCCCC',
- 'legend'=>'LISTEN', 'legend_long'=>'LISTEN-Verbindungen');
-$rrd_info['connect']['graph']['rows'][] = array('name'=>'run_http', 'gType'=>'AREA', 'color'=>'#0000FF',
- 'legend'=>'HTTPconn', 'legend_long'=>'Aktive HTTP-Verbindungen', 'stack'=>true);
-$rrd_info['connect']['graph']['rows'][] = array('name'=>'rest_http', 'gType'=>'AREA', 'color'=>'#8080FF',
- 'legend'=>'HTTPwait', 'legend_long'=>'Wartende HTTP-Verbindungen', 'stack'=>true);
-$rrd_info['connect']['graph']['rows'][] = array('name'=>'run_other', 'gType'=>'AREA', 'color'=>'#FF0000',
- 'legend'=>'TCPconn', 'legend_long'=>'Aktive TCP-Verbindungen (außer HTTP)', 'stack'=>true);
-$rrd_info['connect']['graph']['rows'][] = array('name'=>'rest_other', 'gType'=>'AREA', 'color'=>'#FF8080',
- 'legend'=>'TCPwait', 'legend_long'=>'Wartende TCP-Verbindungen (außer HTTP)', 'stack'=>true);
-$rrd_info['connect']['graph']['rows'][] = array('name'=>'udp', 'gType'=>'AREA', 'color'=>'#00CC00',
- 'legend'=>'UDP', 'legend_long'=>'UDP-Verbindungen', 'stack'=>true);
-$rrd_info['connect']['graph']['units_length'] = 4;
-$rrd_info['connect']['graph']['label_y'] = 'Network Sockets';
-$rrd_info['connect']['graph']['min_y'] = 0;
-// $rrd_info['connect']['graph']['force_recreate'] = true;
-
-$rrd_info['process']['file'] = 'system.process.rrd';
-$rrd_info['process']['auto-update'] = true;
-$rrd_info['process']['fields'][] = array('name' => 'ps_httpd', 'type' => 'GAUGE', 'heartbeat' => 600, 'min' => 'U', 'max' => 'U');
-$rrd_info['process']['fields'][] = array('name' => 'ps_other', 'type' => 'GAUGE', 'heartbeat' => 600, 'min' => 'U', 'max' => 'U');
-$rrd_info['process']['fields'][] = array('name' => 'psnum', 'type' => 'DERIVE', 'heartbeat' => 600, 'min' => 0, 'max' => 'U');
-$rrd_info['process']['update'] =
- 'function {
- $sdata = explode("\n", `LANG=C /bin/ps -e`);
- $udata = array("ps_httpd"=>0,"ps_other"=>0);
- foreach ($sdata as $sline) {
- if (strpos($sline, "httpd2-prefork")) { $udata["ps_httpd"]++; }
- else { $udata["ps_other"]++; }
- }
- $udata["psnum"] = posix_getpid();
- return $udata;
- }';
-$rrd_info['process']['graph']['rows'][] = array('name'=>'ps_httpd', 'gType'=>'AREA', 'color'=>'#0000FF', 'legend'=>'HTTP');
-$rrd_info['process']['graph']['rows'][] = array('name'=>'ps_other', 'gType'=>'AREA', 'color'=>'#FF0000', 'legend'=>'other', 'stack'=>true);
-$rrd_info['process']['graph']['rows'][] = array('name'=>'psnum', 'scale'=>3.6, 'gType'=>'LINE1', 'color'=>'#00CC00', 'legend'=>'k ps/hour');
-$rrd_info['process']['graph']['label_y'] = 'Processes';
-$rrd_info['process']['graph']['min_y'] = 0;
-// $rrd_info['process']['graph']['force_recreate'] = true;
-$rrd_info['process']['graph.ps']['rows'][] = array('name'=>'ps_httpd', 'gType'=>'AREA', 'color'=>'#0000FF', 'legend'=>'HTTP');
-$rrd_info['process']['graph.ps']['rows'][] = array('name'=>'ps_other', 'gType'=>'AREA', 'color'=>'#FF0000', 'legend'=>'other', 'stack'=>true);
-$rrd_info['process']['graph.ps']['label_y'] = 'Processes';
-$rrd_info['process']['graph.ps']['min_y'] = 0;
-// $rrd_info['process']['graph.ps']['force_recreate'] = true;
-$rrd_info['process']['page.ps']['graph_sub'] = 'ps';
-$rrd_info['process']['graph.pi']['rows'][] = array('name'=>'psnum', 'scale'=>3600, 'gType'=>'LINE1', 'color'=>'#000000', 'legend'=>'started processes per hour');
-$rrd_info['process']['graph.pi']['label_y'] = '';
-$rrd_info['process']['graph.pi']['min_y'] = 0;
-// $rrd_info['process']['graph.pi']['force_recreate'] = true;
-$rrd_info['process']['page.pi']['graph_sub'] = 'pi';
-
-$rrd_info['temp']['graph-only'] = true;
-$rrd_info['temp']['graph']['rows'][] = array('name'=>'cpu_temp', 'dsfile'=>'sensors.temp.rrd', 'gType'=>'LINE1',
- 'color'=>'#0000FF', 'legend'=>'CPU');
-$rrd_info['temp']['graph']['rows'][] = array('name'=>'mb_temp', 'dsfile'=>'sensors.temp.rrd', 'gType'=>'LINE1',
- 'color'=>'#008000', 'legend'=>'MB');
-$rrd_info['temp']['graph']['rows'][] = array('name'=>'gpu_temp', 'dsfile'=>'video.temp.rrd', 'gType'=>'LINE1',
- 'color'=>'#0080FF', 'legend'=>'GPU');
-$rrd_info['temp']['graph']['rows'][] = array('name'=>'ibm30', 'dsfile'=>'hdd.temp.rrd', 'gType'=>'LINE1',
- 'color'=>'#808080', 'legend'=>'HD/IBM30');
-$rrd_info['temp']['graph']['rows'][] = array('name'=>'hit160', 'dsfile'=>'hdd.temp.rrd', 'gType'=>'LINE1',
- 'color'=>'#FF0000', 'legend'=>'HD/HITACHI160');
-$rrd_info['temp']['graph']['rows'][] = array('name'=>'sg320', 'dsfile'=>'hdd.temp.rrd', 'gType'=>'LINE1',
- 'color'=>'#FF8000', 'legend'=>'HD/Seagate320');
-$rrd_info['temp']['graph']['label_y'] = '°C';
-$rrd_info['temp']['graph']['units_exponent'] = 0;
-$rrd_info['temp']['graph']['units_length'] = 4;
-//$rrd_info['temp']['graph']['min_y'] = 0;
-//$rrd_info['temp']['graph']['max_y'] = 100;
-//$rrd_info['temp']['graph']['fix_scale_y'] = true;
-// $rrd_info['temp']['graph']['force_recreate'] = true;
-$rrd_info['temp']['page']['show_update'] = false;
-
-$rrd_info['ping.gateway']['file'] = 'net.ping.gateway.rrd';
-$rrd_info['ping.gateway']['auto-update'] = true;
-$rrd_info['ping.gateway']['fields'][] = array('name' => 'single_min', 'type' => 'GAUGE', 'heartbeat' => 600, 'min' => 0, 'max' => 'U');
-$rrd_info['ping.gateway']['fields'][] = array('name' => 'single_avg', 'type' => 'GAUGE', 'heartbeat' => 600, 'min' => 0, 'max' => 'U');
-$rrd_info['ping.gateway']['fields'][] = array('name' => 'single_max', 'type' => 'GAUGE', 'heartbeat' => 600, 'min' => 0, 'max' => 'U');
-$rrd_info['ping.gateway']['fields'][] = array('name' => 'single_loss', 'type' => 'GAUGE', 'heartbeat' => 600, 'min' => 0, 'max' => 100);
-$rrd_info['ping.gateway']['fields'][] = array('name' => 'flood_min', 'type' => 'GAUGE', 'heartbeat' => 600, 'min' => 0, 'max' => 'U');
-$rrd_info['ping.gateway']['fields'][] = array('name' => 'flood_avg', 'type' => 'GAUGE', 'heartbeat' => 600, 'min' => 0, 'max' => 'U');
-$rrd_info['ping.gateway']['fields'][] = array('name' => 'flood_max', 'type' => 'GAUGE', 'heartbeat' => 600, 'min' => 0, 'max' => 'U');
-$rrd_info['ping.gateway']['fields'][] = array('name' => 'flood_loss', 'type' => 'GAUGE', 'heartbeat' => 600, 'min' => 0, 'max' => 100);
-$rrd_info['ping.gateway']['update'] =
- 'function {
- $pinghost = "83.65.88.1"; $pingnum = 20;
- $sdata = array();
- $sdata["single"] = explode("\n", `LANG=C /bin/ping -q -c $pingnum -w 90 $pinghost 2>/dev/null`);
- $sdata["flood"] = explode("\n", `LANG=C /bin/ping -qf -c $pingnum -w 30 $pinghost 2>/dev/null`);
- $udata = array("single_min"=>0,"single_avg"=>0,"single_max"=>0,"single_loss"=>100,
- "flood_min"=>0,"flood_avg"=>0,"flood_max"=>0,"flood_loss"=>100);
- foreach (array("single","flood") as $mode) {
- foreach ($sdata[$mode] as $sline) {
- if (preg_match("/(\d+)% (?:packet )?loss/", $sline, $regs)) { $udata[$mode."_loss"] = $regs[1]; }
- elseif (preg_match("/min\/avg\/max(?:\/mdev)? = ([\d\.]+)\/([\d\.]+)\/([\d\.]+)(?:\/[\d\.]+)? ms/", $sline, $regs)) {
- $udata[$mode."_min"] = $regs[1]/1000; $udata[$mode."_avg"] = $regs[2]/1000; $udata[$mode."_max"] = $regs[3]/1000;
- }
- }
- }
- return $udata;
- }';
-$rrd_info['ping.gateway']['graph']['rows'][] = array('name'=>'flood_min', 'gType'=>'LINE1', 'color'=>'#80FF80', 'legend'=>'f:min/max', 'desc'=>'f:min');
-$rrd_info['ping.gateway']['graph']['rows'][] = array('name'=>'flood_max', 'gType'=>'LINE1', 'color'=>'#80FF80', 'desc'=>'f:max');
-$rrd_info['ping.gateway']['graph']['rows'][] = array('name'=>'single_min', 'gType'=>'LINE1', 'color'=>'#CCCCFF', 'legend'=>'s:min/max', 'desc'=>'s:min');
-$rrd_info['ping.gateway']['graph']['rows'][] = array('name'=>'single_max', 'gType'=>'LINE1', 'color'=>'#CCCCFF', 'desc'=>'s:max');
-$rrd_info['ping.gateway']['graph']['rows'][] = array('name'=>'flood_avg', 'gType'=>'LINE1', 'color'=>'#008000', 'legend'=>'f:avg');
-$rrd_info['ping.gateway']['graph']['rows'][] = array('name'=>'single_avg', 'gType'=>'LINE1', 'color'=>'#0000FF', 'legend'=>'s:avg');
-$rrd_info['ping.gateway']['graph']['rows'][] = array('name'=>'flood_loss', 'scale'=>0.001, 'gType'=>'LINE1', 'color'=>'#000000', 'legend'=>'f:mloss');
-$rrd_info['ping.gateway']['graph']['rows'][] = array('name'=>'single_loss', 'scale'=>0.001, 'gType'=>'LINE1', 'color'=>'#FF0000', 'legend'=>'s:mloss');
-$rrd_info['ping.gateway']['graph']['label_y'] = 'Seconds';
-$rrd_info['ping.gateway']['graph']['min_y'] = 0;
-// $rrd_info['ping.gateway']['graph']['force_recreate'] = true;
-$rrd_info['ping.gateway']['page']['text_intro'] = 'Alternate graphs: <a href="?stat=ping.gateway">totals</a>, <a href="?stat=ping.gateway&sub=avg">averages</a>.';
-$rrd_info['ping.gateway']['graph.avg']['rows'][] = array('name'=>'flood_avg', 'gType'=>'LINE1', 'color'=>'#008000',
- 'legend'=>'f:avg', 'legend_long'=>'Flood ping: average time (of 20 parallel pings)');
-$rrd_info['ping.gateway']['graph.avg']['rows'][] = array('name'=>'single_avg', 'gType'=>'LINE1', 'color'=>'#0000FF',
- 'legend'=>'s:avg', 'legend_long'=>'Single ping: average time (of 20 sequential pings, 1s gap)');
-$rrd_info['ping.gateway']['graph.avg']['rows'][] = array('name'=>'flood_loss', 'scale'=>0.001, 'gType'=>'LINE1', 'color'=>'#000000',
- 'legend'=>'f:mloss', 'legend_long'=>'Flood ping: packet loss (percent of 20 parallel pings)');
-$rrd_info['ping.gateway']['graph.avg']['rows'][] = array('name'=>'single_loss', 'scale'=>0.001, 'gType'=>'LINE1', 'color'=>'#FF0000',
- 'legend'=>'s:mloss', 'legend_long'=>'Single ping: packet loss (percent of 20 sequential pings, 1s gap)');
-$rrd_info['ping.gateway']['graph']['label_y'] = 'Seconds';
-$rrd_info['ping.gateway']['graph']['min_y'] = 0;
-$rrd_info['ping.gateway']['page.avg']['graph_sub'] = 'avg';
-
-$rrd_info['ping.hirsch'] = $rrd_info['ping.gateway'];
-$rrd_info['ping.hirsch']['file'] = 'net.ping.hirsch.rrd';
-$rrd_info['ping.hirsch']['update'] =
- 'function {
- $pinghost = "server.hirsch.sth.ac.at"; $pingnum = 20;
- $sdata = array();
- $sdata["single"] = explode("\n", `LANG=C /bin/ping -q -c $pingnum -w 90 $pinghost 2>/dev/null`);
- $sdata["flood"] = explode("\n", `LANG=C /bin/ping -qf -c $pingnum -w 30 $pinghost 2>/dev/null`);
- $udata = array("single_min"=>0,"single_avg"=>0,"single_max"=>0,"single_loss"=>100,
- "flood_min"=>0,"flood_avg"=>0,"flood_max"=>0,"flood_loss"=>100);
- foreach (array("single","flood") as $mode) {
- foreach ($sdata[$mode] as $sline) {
- if (preg_match("/(\d+)% (?:packet )?loss/", $sline, $regs)) { $udata[$mode."_loss"] = $regs[1]; }
- elseif (preg_match("/min\/avg\/max(?:\/mdev)? = ([\d\.]+)\/([\d\.]+)\/([\d\.]+)(?:\/[\d\.]+)? ms/", $sline, $regs)) {
- $udata[$mode."_min"] = $regs[1]/1000; $udata[$mode."_avg"] = $regs[2]/1000; $udata[$mode."_max"] = $regs[3]/1000;
- }
- }
- }
- return $udata;
- }';
-// $rrd_info['ping.hirsch']['graph']['force_recreate'] = true;
-$rrd_info['ping.hirsch']['page']['text_intro'] = 'Alternate graphs: <a href="?stat=ping.hirsch">totals</a>, <a href="?stat=ping.hirsch&sub=avg">averages</a>.';
-
-// mainboard sensors
-/*
-$rrd_info['sensors.power']['file'] = 'sensors.power.rrd';
-$rrd_info['sensors.power']['auto-update'] = true;
-$rrd_info['sensors.power']['fields'][] = array('name' => 'vid', 'type' => 'GAUGE', 'heartbeat' => 600, 'min' => 'U', 'max' => 'U');
-$rrd_info['sensors.power']['fields'][] = array('name' => 'vcore1', 'type' => 'GAUGE', 'heartbeat' => 600, 'min' => 'U', 'max' => 'U');
-$rrd_info['sensors.power']['fields'][] = array('name' => 'p3x3v', 'type' => 'GAUGE', 'heartbeat' => 600, 'min' => 'U', 'max' => 'U');
-$rrd_info['sensors.power']['fields'][] = array('name' => 'p5v', 'type' => 'GAUGE', 'heartbeat' => 600, 'min' => 'U', 'max' => 'U');
-$rrd_info['sensors.power']['fields'][] = array('name' => 'p12v', 'type' => 'GAUGE', 'heartbeat' => 600, 'min' => 'U', 'max' => 'U');
-$rrd_info['sensors.power']['fields'][] = array('name' => 'm12v', 'type' => 'GAUGE', 'heartbeat' => 600, 'min' => 'U', 'max' => 'U');
-$rrd_info['sensors.power']['fields'][] = array('name' => 'm5v', 'type' => 'GAUGE', 'heartbeat' => 600, 'min' => 'U', 'max' => 'U');
-$rrd_info['sensors.power']['update'] =
- 'function {
- $sdata = explode("\n", `/usr/bin/sensors -A asb100-*`);
- $udata = array("vid"=>null,"vcore1"=>null,"p3x3v"=>null,
- "p5v"=>null,"p12v"=>null,"m12v"=>null,"m5v"=>null);
- foreach ($sdata as $sline) {
- if (preg_match("/^vid:\s+([+-]?[\d\.]+) V/", $sline, $regs)) { $udata["vid"] = $regs[1]; }
- elseif (preg_match("/^VCore 1:\s+([+-]?[\d\.]+) V/", $sline, $regs)) { $udata["vcore1"] = $regs[1]; }
- elseif (preg_match("/^\+3.3V:\s+([+-]?[\d\.]+) V/", $sline, $regs)) { $udata["p3x3v"] = $regs[1]; }
- elseif (preg_match("/^\+5V:\s+([+-]?[\d\.]+) V/", $sline, $regs)) { $udata["p5v"] = $regs[1]; }
- elseif (preg_match("/^\+12V:\s+([+-]?[\d\.]+) V/", $sline, $regs)) { $udata["p12v"] = $regs[1]; }
- elseif (preg_match("/^-12V:\s+([+-]?[\d\.]+) V/", $sline, $regs)) { $udata["m12v"] = $regs[1]; }
- elseif (preg_match("/^-5V:\s+([+-]?[\d\.]+) V/", $sline, $regs)) { $udata["m5v"] = $regs[1]; }
- }
- return $udata;
- }';
-$rrd_info['sensors.power']['graph']['rows'][] = array('name'=>'vid', 'gType'=>'LINE1', 'color'=>'#808080', 'legend'=>'VID');
-$rrd_info['sensors.power']['graph']['rows'][] = array('name'=>'vcore1', 'gType'=>'LINE1', 'color'=>'#FF0000', 'legend'=>'VCore 1');
-$rrd_info['sensors.power']['graph']['rows'][] = array('name'=>'p12v', 'gType'=>'LINE1', 'color'=>'#0000FF', 'legend'=>'+12V');
-$rrd_info['sensors.power']['graph']['rows'][] = array('name'=>'p5v', 'gType'=>'LINE1', 'color'=>'#008000', 'legend'=>'+5V');
-$rrd_info['sensors.power']['graph']['rows'][] = array('name'=>'p3x3v', 'gType'=>'LINE1', 'color'=>'#000000', 'legend'=>'+3.3V');
-$rrd_info['sensors.power']['graph']['rows'][] = array('name'=>'m5v', 'gType'=>'LINE1', 'color'=>'#00CC00', 'legend'=>'-5V');
-$rrd_info['sensors.power']['graph']['rows'][] = array('name'=>'m12v', 'gType'=>'LINE1', 'color'=>'#8080FF', 'legend'=>'-12V');
-$rrd_info['sensors.power']['graph']['units_length'] = 4;
-$rrd_info['sensors.power']['graph']['label_y'] = 'Volt';
-$rrd_info['sensors.power']['graph']['max_y'] = 13;
-$rrd_info['sensors.power']['graph']['min_y'] = -13;
-// $rrd_info['sensors.power']['graph']['force_recreate'] = true;
-$rrd_info['sensors.power']['graph.rel']['rows'][] = array('name'=>'vid', 'gType'=>'');
-$rrd_info['sensors.power']['graph.rel']['rows'][] = array('name'=>'vcore1_tmp', 'dsname'=>'vcore1', 'gType'=>'');
-$rrd_info['sensors.power']['graph.rel']['rows'][] = array('name'=>'p12v_tmp', 'dsname'=>'p12v', 'gType'=>'');
-$rrd_info['sensors.power']['graph.rel']['rows'][] = array('name'=>'p5v_tmp', 'dsname'=>'p5v', 'gType'=>'');
-$rrd_info['sensors.power']['graph.rel']['rows'][] = array('name'=>'p3x3v_tmp', 'dsname'=>'p3x3v', 'gType'=>'');
-$rrd_info['sensors.power']['graph.rel']['rows'][] = array('name'=>'m5v_tmp', 'dsname'=>'m5v', 'gType'=>'');
-$rrd_info['sensors.power']['graph.rel']['rows'][] = array('name'=>'m12v_tmp', 'dsname'=>'m12v', 'gType'=>'');
-$rrd_info['sensors.power']['graph.rel']['rows'][] = array('dType'=>'CDEF', 'name'=>'vcore1', 'rpn_expr'=>'vcore1_tmp,vid,-', 'gType'=>'LINE1', 'color'=>'#FF0000', 'legend'=>'VCore 1');
-$rrd_info['sensors.power']['graph.rel']['rows'][] = array('dType'=>'CDEF', 'name'=>'p3x3v', 'rpn_expr'=>'p3x3v_tmp,3.3,-', 'gType'=>'LINE1', 'color'=>'#000000', 'legend'=>'+3.3V');
-$rrd_info['sensors.power']['graph.rel']['rows'][] = array('dType'=>'CDEF', 'name'=>'p5v', 'rpn_expr'=>'p5v_tmp,5,-', 'gType'=>'LINE1', 'color'=>'#008000', 'legend'=>'+5V');
-$rrd_info['sensors.power']['graph.rel']['rows'][] = array('dType'=>'CDEF', 'name'=>'p12v', 'rpn_expr'=>'p12v_tmp,12,-', 'gType'=>'LINE1', 'color'=>'#0000FF', 'legend'=>'+12V');
-$rrd_info['sensors.power']['graph.rel']['rows'][] = array('dType'=>'CDEF', 'name'=>'m12v', 'rpn_expr'=>'m12v_tmp,12,+', 'gType'=>'LINE1', 'color'=>'#8080FF', 'legend'=>'-12V');
-$rrd_info['sensors.power']['graph.rel']['rows'][] = array('dType'=>'CDEF', 'name'=>'m5v', 'rpn_expr'=>'m5v_tmp,5,+', 'gType'=>'LINE1', 'color'=>'#00CC00', 'legend'=>'-5V');
-$rrd_info['sensors.power']['graph.rel']['units_length'] = 5;
-$rrd_info['sensors.power']['graph.rel']['units_exponent'] = 0;
-$rrd_info['sensors.power']['graph.rel']['label_y'] = 'Volts (diff)';
-$rrd_info['sensors.power']['graph.rel']['max_y'] = +0.3;
-$rrd_info['sensors.power']['graph.rel']['min_y'] = -0.7;
-// $rrd_info['sensors.power']['graph.rel']['force_recreate'] = true;
-$rrd_info['sensors.power']['page.rel']['graph_sub'] = 'rel';
-$rrd_info['sensors.power']['graph.relpct']['rows'][] = array('name'=>'vid', 'gType'=>'');
-$rrd_info['sensors.power']['graph.relpct']['rows'][] = array('name'=>'vcore1_tmp', 'dsname'=>'vcore1', 'gType'=>'');
-$rrd_info['sensors.power']['graph.relpct']['rows'][] = array('name'=>'p12v_tmp', 'dsname'=>'p12v', 'gType'=>'');
-$rrd_info['sensors.power']['graph.relpct']['rows'][] = array('name'=>'p5v_tmp', 'dsname'=>'p5v', 'gType'=>'');
-$rrd_info['sensors.power']['graph.relpct']['rows'][] = array('name'=>'p3x3v_tmp', 'dsname'=>'p3x3v', 'gType'=>'');
-$rrd_info['sensors.power']['graph.relpct']['rows'][] = array('name'=>'m5v_tmp', 'dsname'=>'m5v', 'gType'=>'');
-$rrd_info['sensors.power']['graph.relpct']['rows'][] = array('name'=>'m12v_tmp', 'dsname'=>'m12v', 'gType'=>'');
-$rrd_info['sensors.power']['graph.relpct']['rows'][] = array('dType'=>'CDEF', 'name'=>'vcore1', 'rpn_expr'=>'vcore1_tmp,vid,-,vid,/,100,*', 'gType'=>'LINE1', 'color'=>'#FF0000', 'legend'=>'VCore 1');
-$rrd_info['sensors.power']['graph.relpct']['rows'][] = array('dType'=>'CDEF', 'name'=>'p3x3v', 'rpn_expr'=>'p3x3v_tmp,3.3,-,3.3,/,100,*', 'gType'=>'LINE1', 'color'=>'#000000', 'legend'=>'+3.3V');
-$rrd_info['sensors.power']['graph.relpct']['rows'][] = array('dType'=>'CDEF', 'name'=>'p5v', 'rpn_expr'=>'p5v_tmp,5,-,5,/,100,*', 'gType'=>'LINE1', 'color'=>'#008000', 'legend'=>'+5V');
-$rrd_info['sensors.power']['graph.relpct']['rows'][] = array('dType'=>'CDEF', 'name'=>'p12v', 'rpn_expr'=>'p12v_tmp,12,-,12,/,100,*', 'gType'=>'LINE1', 'color'=>'#0000FF', 'legend'=>'+12V');
-$rrd_info['sensors.power']['graph.relpct']['rows'][] = array('dType'=>'CDEF', 'name'=>'m12v', 'rpn_expr'=>'m12v_tmp,12,+,12,/,100,*', 'gType'=>'LINE1', 'color'=>'#8080FF', 'legend'=>'-12V');
-$rrd_info['sensors.power']['graph.relpct']['rows'][] = array('dType'=>'CDEF', 'name'=>'m5v', 'rpn_expr'=>'m5v_tmp,5,+,5,/,100,*', 'gType'=>'LINE1', 'color'=>'#00CC00', 'legend'=>'-5V');
-$rrd_info['sensors.power']['graph.relpct']['units_length'] = 5;
-$rrd_info['sensors.power']['graph.relpct']['units_exponent'] = 0;
-$rrd_info['sensors.power']['graph.relpct']['label_y'] = 'diff%';
-$rrd_info['sensors.power']['graph.relpct']['max_y'] = +2;
-$rrd_info['sensors.power']['graph.relpct']['min_y'] = -6;
-// $rrd_info['sensors.power']['graph.relpct']['force_recreate'] = true;
-$rrd_info['sensors.power']['page.relpct']['graph_sub'] = 'relpct';
-
-$rrd_info['sensors.fan']['file'] = 'sensors.fan.rrd';
-$rrd_info['sensors.fan']['auto-update'] = true;
-$rrd_info['sensors.fan']['fields'][] = array('name' => 'cpu_fan', 'type' => 'GAUGE', 'heartbeat' => 600, 'min' => 'U', 'max' => 'U');
-$rrd_info['sensors.fan']['fields'][] = array('name' => 'chassis_fan', 'type' => 'GAUGE', 'heartbeat' => 600, 'min' => 'U', 'max' => 'U');
-$rrd_info['sensors.fan']['fields'][] = array('name' => 'power_fan', 'type' => 'GAUGE', 'heartbeat' => 600, 'min' => 'U', 'max' => 'U');
-$rrd_info['sensors.fan']['update'] =
- 'function {
- $sdata = explode("\n", str_replace(":\n", ": ", `/usr/bin/sensors -A asb100-*`));
- $udata = array("cpu_fan"=>null,"chassis_fan"=>null,"power_fan"=>null);
- foreach ($sdata as $sline) {
- if (preg_match("/^CPU Fan:\s+([+-]?\d+) RPM/", $sline, $regs)) { $udata["cpu_fan"] = $regs[1]; }
- elseif (preg_match("/^Chassis Fan:\s+([+-]?\d+) RPM/", $sline, $regs)) { $udata["chassis_fan"] = $regs[1]; }
- elseif (preg_match("/^Power Fan:\s+([+-]?\d+) RPM/", $sline, $regs)) { $udata["power_fan"] = $regs[1]; }
- }
- return $udata;
- }';
-$rrd_info['sensors.fan']['graph']['rows'][] = array('name'=>'cpu_fan', 'gType'=>'LINE1', 'color'=>'#0000FF', 'legend'=>'CPU Fan');
-$rrd_info['sensors.fan']['graph']['rows'][] = array('name'=>'chassis_fan', 'gType'=>'LINE1', 'color'=>'#00CC00', 'legend'=>'GPU Fan');
-$rrd_info['sensors.fan']['graph']['label_y'] = 'Rotations/min';
-$rrd_info['sensors.fan']['graph']['max_y'] = 6500;
-$rrd_info['sensors.fan']['graph']['min_y'] = 2000;
-// $rrd_info['sensors.fan']['graph']['force_recreate'] = true;
-
-$rrd_info['sensors.temp']['file'] = 'sensors.temp.rrd';
-$rrd_info['sensors.temp']['auto-update'] = true;
-$rrd_info['sensors.temp']['fields'][] = array('name' => 'cpu_temp', 'type' => 'GAUGE', 'heartbeat' => 600, 'min' => 'U', 'max' => 'U');
-$rrd_info['sensors.temp']['fields'][] = array('name' => 'mb_temp', 'type' => 'GAUGE', 'heartbeat' => 600, 'min' => 'U', 'max' => 'U');
-$rrd_info['sensors.temp']['fields'][] = array('name' => 'power_temp', 'type' => 'GAUGE', 'heartbeat' => 600, 'min' => 'U', 'max' => 'U');
-$rrd_info['sensors.temp']['update'] =
- 'function {
- $sdata = explode("\n", `/usr/bin/sensors -A asb100-*`);
- $udata = array("cpu_temp"=>null,"mb_temp"=>null,"power_temp"=>null);
- foreach ($sdata as $sline) {
- if (preg_match("/^CPU Temp:\s+([+-]?[\d\.]+).+?C/i", $sline, $regs)) { $udata["cpu_temp"] = $regs[1]; }
- elseif (preg_match("/^MB Temp:\s+([+-]?[\d\.]+).+?C/i", $sline, $regs)) { $udata["mb_temp"] = $regs[1]; }
- elseif (preg_match("/^Power Temp:\s+([+-]?[\d\.]+).+?C/i", $sline, $regs)) { $udata["power_temp"] = $regs[1]; }
- }
- return $udata;
- }';
-$rrd_info['sensors.temp']['graph']['rows'][] = array('name'=>'cpu_temp', 'gType'=>'LINE1', 'color'=>'#0000FF', 'legend'=>'CPU Temp');
-$rrd_info['sensors.temp']['graph']['rows'][] = array('name'=>'mb_temp', 'gType'=>'LINE1', 'color'=>'#008000', 'legend'=>'MB Temp');
-$rrd_info['sensors.temp']['graph']['label_y'] = '°C';
-$rrd_info['sensors.temp']['graph']['max_y'] = 55;
-$rrd_info['sensors.temp']['graph']['min_y'] = 30;
-// $rrd_info['sensors.temp']['graph']['force_recreate'] = true;
-*/
-
/* !!! be sure to call this one _last_ of all auto-update rrd stats */
$rrd_info['rrdup']['file'] = 'test.rrdup.rrd';
// $rrd_info['rrdup']['auto-update'] = true;
$rrd_info['rrdup']['graph']['min_y'] = 0;
// $rrd_info['rrdup']['graph']['force_recreate'] = true;
-// ***** MRTG-based graphs *****
-$rrd_info['mrtg.system.ram']['graph']['units_binary'] = true;
-$rrd_info['mrtg.system.ram']['graph']['scale'] = 1024;
-$rrd_info['mrtg.system.ram']['graph']['force_recreate'] = true;
-
-$rrd_info['mrtg.system.load']['graph']['scale'] = 0.001;
-$rrd_info['mrtg.system.load']['graph']['force_recreate'] = true;
-
?>
<?php
+date_default_timezone_set("Europe/Vienna");
$myfile = $_SERVER['SCRIPT_FILENAME'];
while (is_link($myfile)) { $myfile = readlink($myfile); }
if (getcwd() != dirname($myfile)) {
}
include_once('rrdstat.php-class');
-include_once('rrd-config.inc.php');
+
+$rrd_config_file = 'rrd-config/'.php_uname('n').'.inc.php';
+if (!file_exists($rrd_config_file)) { $rrd_config_file = 'rrd-config.inc.php'; }
+include_once($rrd_config_file);
// view stats
$sname = isset($_GET['stat'])?$_GET['stat']:null;
<?php
+date_default_timezone_set("Europe/Vienna");
$myfile = $_SERVER['SCRIPT_FILENAME'];
while (is_link($myfile)) { $myfile = readlink($myfile); }
if (getcwd() != dirname($myfile)) {
}
include_once('rrdstat.php-class');
-include_once('rrd-config.inc.php');
+
+$rrd_config_file = 'rrd-config/'.php_uname('n').'.inc.php';
+if (!file_exists($rrd_config_file)) { $rrd_config_file = 'rrd-config.inc.php'; }
+include_once($rrd_config_file);
if (php_sapi_name() == 'cli') {
// automated updates
<?php
+date_default_timezone_set("Europe/Vienna");
$myfile = $_SERVER['SCRIPT_FILENAME'];
while (is_link($myfile)) { $myfile = readlink($myfile); }
if (getcwd() != dirname($myfile)) {
}
include_once('rrdstat.php-class');
-include_once('rrd-config.inc.php');
+
+$rrd_config_file = 'rrd-config/'.php_uname('n').'.inc.php';
+if (!file_exists($rrd_config_file)) { $rrd_config_file = 'rrd-config.inc.php'; }
+include_once($rrd_config_file);
if (php_sapi_name() == 'cli') {
// automated updates
+++ /dev/null
-<?php
-/* ***** BEGIN LICENSE BLOCK *****
- *
- * The contents of this file are subject to Austrian copyright reegulations
- * ("Urheberrecht"); you may not use this file except in compliance with
- * those laws.
- * This contents and any derived work, if it gets distributed in any way,
- * is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND,
- * either express or implied.
- *
- * The Original Code is KaiRo's RRD statistics class.
- *
- * The Initial Developer of the Original Code is
- * KaiRo - Robert Kaiser.
- * Portions created by the Initial Developer are Copyright (C) 2005-2006
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s): Robert Kaiser <kairo@kairo.at>
- *
- * ***** END LICENSE BLOCK ***** */
-
-class rrdstat {
- // rrdstat PHP class
- // rrdtool statistics functions
- //
- // function __construct($rrdconfig, [$conf_id])
- // CONSTRUCTOR
- // if $conf_id is set, $rrdconfig is a total configuration set
- // else it's the configuration for this one RRD
- // currently only a config array is supported, XML config is planned
- //
- // private $rrd_file
- // RRD file name
- //
- // private $basename
- // base name for this RRD (usually file name without .rrd)
- //
- // private $basedir
- // base directory for this RRD (with a trailing slash)
- // note that $rrd_file usually includes that path as well, but graph directory gets based on this value
- //
- // private $config_all
- // complete, raw configuration array set
- //
- // private $config_raw
- // configuration array set for current RRD
- //
- // private $config_graph
- // configuration array set for default graph in this RRD
- //
- // private $config_page
- // configuration array set for default page in this RRD
- //
- // private $rrd_fields
- // definition of this RRD's fields
- //
- // private $rra_base
- // definition of this RRD's base RRAs
- //
- // private $rrd_step
- // basic stepping of this RRD in seconds (default: 300)
- //
- // private $rra_add_max
- // should RRAs for MAX be added for every base RRA? (bool, default: true)
- //
- // private $status
- // status of the RRD (unused/ok/readonly/graphonly)
- // note that most functions require certain status values
- // (e.g. update only works if status is ok, graph for ok/readonly/graphonly)
- //
- // private $mod_textdomain
- // GNU gettext domain for this module
- //
- // private function set_def($rrdconfig, [$conf_id])
- // set definitions based on given configuration
- // [intended for internal use, called by the constructor]
- //
- // public function rrd_version() {
- // get RRDtool version string
- //
- // public function create()
- // create RRD file according to set config
- //
- // public function update([$upArray])
- // feed new data into RRD (either use given array of values or use auto-update info from config)
- //
- // public function fetch([$cf] = 'AVERAGE', $resolution = null, $start = null, $end = null)
- // fetch data from the defined RRD
- // using given consolidation function [default is AVERAGE],
- // resolution (seconds, default is the RRD's stepping),
- // start and end times (unix epoch, defaults are the RRD's last update time)
- //
- // public function last_update()
- // fetch time of last update in this RRD file
- //
- // public function graph([$timeframe], [$sub], [$extra])
- // create a RRD graph (and return all meta info in a flat string)
- // for given timeframe (day [default]/week/month/year),
- // sub-graph ID (if given) and extra config options (if given)
- //
- // public function graph_plus([$timeframe], [$sub], [$extra])
- // create a RRD graph (see above) and return meta info as a ready-to-use array
- //
- // public function page([$sub], [$page_extras], [$graph_extras])
- // create a (HTML) page and return it in a string
- // for given sub-page ID (if given, default is a simple HTML page)
- // and extra page and graph config options (if given)
- //
- // public function simple_html([$sub], [$page_extras], [$graph_extras])
- // create a simple (MRTG-like) HTML page and return it in a string
- // XXX: this is here temporarily for compat only, it's preferred to use page()!
- //
- // private function page_index($pconf)
- // create a bare, very simple index list HTML page and return it in a string
- // using given page config options
- // [intended for internal use, called by page()]
- //
- // private function page_overview($pconf, [$graph_extras])
- // create an overview HTML page (including graphs) and return it in a string
- // using given page config options and extra graph options (if given)
- // [intended for internal use, called by page()]
- //
- // private function page_simple($pconf, [$graph_extras])
- // create a simple (MRTG-like) HTML page and return it in a string
- // using given page config options and extra graph options (if given)
- // [intended for internal use, called by page()]
- //
- // private function h_page_statsArray($pconf)
- // return array of stats to list on a page, using given page config options
- // [intended for internal use, called by page_*()]
- //
- // private function h_page_footer()
- // return generic page footer
- // [intended for internal use, called by page_*()]
- //
- // private function text_quote($text)
- // return a quoted/escaped text for use in rrdtool commandline text fields
-
- private $rrd_file = null;
- private $basename = null;
- private $basedir = null;
-
- private $config_all = null;
- private $config_raw = null;
- private $config_graph = null;
- private $config_page = null;
-
- private $rrd_fields = array();
- private $rra_base = array();
- private $rrd_step = 300;
- private $rra_add_max = true;
-
- private $status = 'unused';
-
- private $mod_textdomain;
-
- function __construct($rrdconfig, $conf_id = null) {
- // ***** init RRD stat module *****
- $this->mod_textdomain = 'class_rrdstat';
- $mod_charset = 'iso-8859-15';
-
- bindtextdomain($this->mod_textdomain, class_exists('baseutils')?baseutils::getDir('locale'):'locale/');
- bind_textdomain_codeset($this->mod_textdomain, $mod_charset);
-
- $this->set_def($rrdconfig, $conf_id);
-
- if (($this->status == 'unused') && !is_null($this->rrd_file)) {
- if (!is_writeable($this->rrd_file)) {
- if (!file_exists($this->rrd_file)) {
- if (@touch($this->rrd_file)) { $this->create(); }
- else { trigger_error('RRD file can not be created', E_USER_WARNING); }
- }
- else {
- if (is_readable($this->rrd_file)) { $this->status = 'readonly'; }
- else { trigger_error('RRD file is not readable', E_USER_WARNING); }
- }
- }
- else {
- $this->status = 'ok';
- }
- }
- }
-
- private function set_def($rrdconfig, $conf_id = null) {
- if (is_array($rrdconfig)) {
- // we have an array in the format we like to have
- $complete_conf =& $rrdconfig;
- }
- else {
- // we have something else (XML data?), try to generate the iinfo aray from it
- $complete_conf =& $rrdconfig;
- }
-
- if (!is_null($conf_id)) {
- $iinfo = isset($complete_conf[$conf_id])?$complete_conf[$conf_id]:array();
- if (isset($complete_conf['*'])) {
- $iinfo = (array)$iinfo + (array)$complete_conf['*'];
- if (isset($complete_conf['*']['graph'])) { $iinfo['graph'] = (array)$iinfo['graph'] + (array)$complete_conf['*']['graph']; }
- if (isset($complete_conf['*']['page'])) { $iinfo['page'] = (array)$iinfo['page'] + (array)$complete_conf['*']['page']; }
- }
- }
- else {
- $iinfo = $complete_conf;
- }
-
- if (isset($iinfo['path']) && strlen($iinfo['path'])) {
- $this->basedir = $iinfo['path'];
- if (substr($this->basedir, -1) != '/') { $this->basedir .= '/'; }
- }
-
- if (isset($iinfo['graph-only']) && $iinfo['graph-only'] && !is_null($conf_id)) {
- $this->basename = $conf_id;
- $this->status = 'graphonly';
- }
- elseif (isset($iinfo['file'])) {
- $this->rrd_file = (($iinfo['file']{0} != '/')?$this->basedir:'').$iinfo['file'];
- $this->basename = basename((substr($this->rrd_file, -4) == '.rrd')?substr($this->rrd_file, 0, -4):$this->rrd_file);
- }
- elseif (!is_null($conf_id) && file_exists($conf_id.'.rrd')) {
- $this->rrd_file = (($iinfo['file']{0} != '/')?$this->basedir:'').$conf_id.'.rrd';
- $this->basename = $conf_id;
- }
- else {
- $this->basename = !is_null($conf_id)?$conf_id:'xxx.unknown';
- }
-
- if (!is_null($this->rrd_file)) {
- // fields (data sources, DS)
- // name - DS name
- // type - one of COUNTER, GAUGE, DERIVE, ABSOLUTE
- // heartbeat - if no sample recieved for that time, store UNKNOWN
- // min - U (unconstrained) or minimum value
- // max - U (unconstrained) or maximum value
- // update - this string will be fed into eval() for updating this field
- if (isset($iinfo['fields']) && is_array($iinfo['fields'])) {
- $this->rrd_fields = $iinfo['fields'];
- }
- else {
- $this->rrd_fields[] = array('name' => 'ds0', 'type' => 'COUNTER', 'heartbeat' => 600, 'min' => 'U', 'max' => 'U');
- $this->rrd_fields[] = array('name' => 'ds1', 'type' => 'COUNTER', 'heartbeat' => 600, 'min' => 'U', 'max' => 'U');
- }
-
-
- // MRTG-style RRD "database", see http://people.ee.ethz.ch/~oetiker/webtools/rrdtool/tut/rrdtutorial.en.html
- //
- // archives (RRAs):
- // 600 samples of 5 minutes (2 days and 2 hours)
- // 700 samples of 30 minutes (2 days and 2 hours, plus 12.5 days)
- // 775 samples of 2 hours (above + 50 days)
- // 797 samples of 1 day (above + 732 days, rounded up to 797)
-
- $this->rrd_step = isset($iinfo['rrd_step'])?$iinfo['rrd_step']:300;
-
- if (isset($iinfo['rra_base']) && is_array($iinfo['rra_base'])) {
- $this->rra_base = $iinfo['rra_base'];
- }
- else {
- $this->rra_base[] = array('step' => 1, 'rows' => 600);
- $this->rra_base[] = array('step' => 6, 'rows' => 700);
- $this->rra_base[] = array('step' => 24, 'rows' => 775);
- $this->rra_base[] = array('step' => 288, 'rows' => 797);
- }
-
- $this->rra_add_max = isset($iinfo['rra_add_max'])?$iinfo['rra_add_max']:true;
- }
-
- if (isset($iinfo['graph'])) { $this->config_graph = $iinfo['graph']; }
- if (isset($iinfo['page'])) { $this->config_page = $iinfo['page']; }
- $this->config_raw = $iinfo;
- $this->config_all = $complete_conf;
- }
-
- public function rrd_version() {
- // return RRDtool version
- static $version;
- if (!isset($version)) {
- $create_cmd = 'rrdtool --version';
- $return = `$create_cmd 2>&1`;
- if (strpos($return, 'ERROR') !== false) {
- trigger_error($this->rrd_file.' - rrd version error: '.$return, E_USER_WARNING);
- }
-
- if (preg_match('/^\s*RRDtool ([\d\.]+)\s+/', $return, $regs)) {
- $version = $regs[1];
- }
- else {
- $version = '0.0';
- }
- }
- return $version;
- }
-
- public function create() {
- // create RRD file
-
- // compose create command
- $create_cmd = 'rrdtool create '.$this->rrd_file.' --step '.$this->rrd_step;
- foreach ($this->rrd_fields as $ds) {
- if (!isset($ds['type'])) { $ds['type'] = 'COUNTER'; }
- if (!isset($ds['heartbeat'])) { $ds['heartbeat'] = 2*$this->rrd_step; }
- if (!isset($ds['min'])) { $ds['min'] = 'U'; }
- if (!isset($ds['max'])) { $ds['max'] = 'U'; }
- $create_cmd .= ' DS:'.$ds['name'].':'.$ds['type'].':'.$ds['heartbeat'].':'.$ds['min'].':'.$ds['max'];
- }
- foreach ($this->rra_base as $rra) {
- if (!isset($rra['cf'])) { $rra['cf'] = 'AVERAGE'; }
- if (!isset($rra['xff'])) { $rra['xff'] = 0.5; }
- if (!isset($rra['step'])) { $rra['step'] = 1; }
- if (!isset($rra['rows'])) { $rra['rows'] = 600; }
- $create_cmd .= ' RRA:'.$rra['cf'].':'.$rra['xff'].':'.$rra['step'].':'.$rra['rows'];
- }
- if ($this->rra_add_max) {
- foreach ($this->rra_base as $rra) {
- if (!isset($rra['cf'])) {
- // only rows that have no CF set will be looked at here
- $rra['cf'] = 'MAX';
- if (!isset($rra['xff'])) { $rra['xff'] = 0.5; }
- if (!isset($rra['step'])) { $rra['step'] = 1; }
- if (!isset($rra['rows'])) { $rra['rows'] = 600; }
- $create_cmd .= ' RRA:'.$rra['cf'].':'.$rra['xff'].':'.$rra['step'].':'.$rra['rows'];
- }
- }
- }
- $return = `$create_cmd 2>&1`;
- if (strpos($return, 'ERROR') !== false) {
- trigger_error($this->rrd_file.' - rrd create error: '.$return, E_USER_WARNING);
- }
- else { $this->status = 'ok'; }
- }
-
- public function update($upArray = null) {
- // feed new data into RRD
- if ($this->status != 'ok') { trigger_error('Cannot update non-writeable file', E_USER_WARNING); return false; }
- $upvals = array();
- if (isset($this->config_raw['update'])) {
- if (preg_match('/^\s*function\s+{(.*)}\s*$/is', $this->config_raw['update'], $regs)) {
- $upfunc = create_function('', $regs[1]);
- $upvals = $upfunc();
- }
- else {
- $evalcode = $this->config_raw['update'];
- if (!is_null($evalcode)) {
- ob_start();
- eval($evalcode);
- $ret = ob_get_contents();
- if (strlen($ret)) { $upvals = explode("\n", $ret); }
- ob_end_clean();
- }
- }
- }
- else {
- foreach ($this->rrd_fields as $ds) {
- if (is_array($upArray) && isset($upArray[$ds['name']])) { $val = $upArray[$ds['name']]; }
- elseif (isset($ds['update'])) {
- $val = null; $evalcode = null;
- if (substr($ds['update'], 0, 4) == 'val:') {
- $evalcode = 'function { return trim('.substr($ds['update'], 4).')); }';
- }
- elseif (substr($ds['update'], 0, 8) == 'snmp-if:') {
- $snmphost = 'localhost'; $snmpcomm = 'public';
- list($nix, $ifname, $valtype) = explode(':', $ds['update'], 3);
- $iflist = explode("\n", `snmpwalk -v2c -c $snmpcomm $snmphost interfaces.ifTable.ifEntry.ifDescr`);
- $ifnr = null;
- foreach ($iflist as $ifdesc) {
- if (preg_match('/ifDescr\.(\d+) = STRING: '.$ifname.'/', $ifdesc, $regs)) { $ifnr = $regs[1]; }
- }
- $oid = null;
- if ($valtype == 'in') { $oid = '1.3.6.1.2.1.2.2.1.10.'.$ifnr; }
- elseif ($valtype == 'out') { $oid = '1.3.6.1.2.1.2.2.1.16.'.$ifnr; }
- if (!is_null($ifnr) && !is_null($oid)) {
- $evalcode = 'function { return trim(substr(strrchr(`snmpget -v2c -c '.$snmpcomm.' '.$snmphost.' '.$oid.'`,":"),1)); }';
- }
- }
- else { $evalcode = $ds['update']; }
- if (preg_match('/^\s*function\s+{(.*)}\s*$/is', $evalcode, $regs)) {
- $upfunc = create_function('', $regs[1]);
- $val = $upfunc();
- }
- elseif (!is_null($evalcode)) {
- ob_start();
- eval($evalcode);
- $val = ob_get_contents();
- ob_end_clean();
- }
- }
- else { $val = null; }
- $upvals[$ds['name']] = $val;
- }
- }
- $key_names = (!is_numeric(array_shift(array_keys($upvals))));
- if (in_array('L', $upvals, true)) {
- // for at least one value, we need to set the same as the last recorded value
- $fvals = $this->fetch();
- $rowids = array_shift($fvals);
- $lastvals = array_shift($fvals);
- foreach (array_keys($upvals, 'L') as $akey) {
- $upvals[$akey] = $key_names?$lastvals[$akey]:$lastvals[$rowids[$akey]];
- }
- }
- $walkfunc = create_function('&$val,$key', '$val = is_numeric(trim($val))?trim($val):"U";');
- array_walk($upvals, $walkfunc);
- $return = null;
- if (count($upvals)) {
- $update_cmd = 'rrdtool update '.$this->rrd_file.($key_names?' --template '.implode(':', array_keys($upvals)):'').' N:'.implode(':', $upvals);
- $return = `$update_cmd 2>&1`;
- }
-
- if (strpos($return, 'ERROR') !== false) {
- trigger_error($this->rrd_file.' - rrd update error: '.$return, E_USER_WARNING);
- $success = false;
- }
- else { $success = true; }
- return $success;
- }
-
- public function fetch($cf = 'AVERAGE', $resolution = null, $start = null, $end = null) {
- // fetch data from a RRD
- if (!in_array($this->status, array('ok','readonly'))) { trigger_error('Error: rrd status is '.$this->status, E_USER_WARNING); return false; }
-
- if (!in_array($cf, array('AVERAGE','MIN','MAX','LAST'))) { $cf = 'AVERAGE'; }
- if (!is_numeric($resolution)) { $resolution = $this->rrd_step; }
- if (!is_numeric($end)) { $end = $this->last_update(); }
- elseif ($end < 0) { $end += $this->last_update(); }
- $end = intval($end/$resolution)*$resolution;
- if (!is_numeric($start)) { $start = $end; }
- elseif ($start < 0) { $start += $end; }
- $start = intval($start/$resolution)*$resolution;
-
- $fetch_cmd = 'rrdtool fetch '.$this->rrd_file.' '.$cf.' --resolution '.$resolution.' --start '.$start.' --end '.$end;
- $return = `$fetch_cmd 2>&1`;
-
- if (strpos($return, 'ERROR') !== false) {
- trigger_error($this->rrd_file.' - rrd fetch error: '.$return, E_USER_WARNING);
- $fresult = false;
- }
- else {
- $fresult = array();
- $rows = explode("\n", $return);
- $fields = preg_split('/\s+/', array_shift($rows));
- if (array_shift($fields) == 'timestamp') {
- $fresult[0] = $fields;
- foreach ($rows as $row) {
- if (strlen(trim($row))) {
- $rvals = preg_split('/\s+/', $row);
- $rtime = str_replace(':', '', array_shift($rvals));
- $rv_array = array();
- foreach ($rvals as $key=>$rval) {
- $rv_array[$fields[$key]] = ($rval=='nan')?null:floatval($rval);
- }
- $fresult[$rtime] = $rv_array;
- }
- }
- }
- }
- return $fresult;
- }
-
- public function last_update() {
- // fetch time of last update in this RRD file
- static $last_update;
- if (!isset($last_update) && in_array($this->status, array('ok','readonly'))) {
- $last_cmd = 'rrdtool last '.$this->rrd_file;
- $return = trim(`$last_cmd 2>&1`);
- $last_update = is_numeric($return)?$return:null;
- }
- return isset($last_update)?$last_update:null;
- }
-
- public function graph($timeframe = 'day', $sub = null, $extra = null) {
- // create a RRD graph
- static $gColors;
- if (!isset($gColors)) {
- $gColors = array('#00CC00','#0000FF','#000000','#FF0000','#00FF00','#FFFF00','#FF00FF','#00FFFF','#808080','#800000','#008000','#000080','#808000','#800080','#008080','#C0C0C0');
- }
-
- if (!in_array($this->status, array('ok','readonly','graphonly'))) { trigger_error('Error: rrd status is '.$this->status, E_USER_WARNING); return false; }
-
- // assemble configuration
- $gconf = (array)$extra;
- if (!is_null($sub) && is_array($this->config_raw['graph.'.$sub])) {
- $gconf = $gconf + $this->config_raw['graph.'.$sub];
- }
- $gconf = $gconf + (array)$this->config_graph;
-
- if (isset($gconf['format']) && ($gconf['format'] == 'SVG')) {
- $format = $gconf['format']; $fmt_ext = '.svg';
- }
- elseif (isset($gconf['format']) && ($gconf['format'] == 'EPS')) {
- $format = $gconf['format']; $fmt_ext = '.eps';
- }
- elseif (isset($gconf['format']) && ($gconf['format'] == 'PDF')) {
- $format = $gconf['format']; $fmt_ext = '.pdf';
- }
- else {
- $format = 'PNG'; $fmt_ext = '.png';
- }
-
- if (isset($gconf['filename'])) { $fname = $gconf['filename']; }
- else { $fname = $this->basename.(is_null($sub)?'':'-%s').'-%t%f'; }
- $fname = str_replace('%s', strval($sub), $fname);
- $fname = str_replace('%t', $timeframe, $fname);
- $fname = str_replace('%f', $fmt_ext, $fname);
- if (substr($fname, -strlen($fmt_ext)) != $fmt_ext) { $fname .= $fmt_ext; }
- if (isset($gconf['path']) && ($fname{0} != '/')) { $fname = $gconf['path'].'/'.$fname; }
- if ($fname{0} != '/') { $fname = $this->basedir.$fname; }
- $fname = str_replace('//', '/', $fname);
-
- $graphrows = array(); $specialrows = array(); $gC = 0;
- $gDefs = ''; $gGraphs = ''; $addSpecial = '';
-
- // the default size for the graph area has a width of 400px, so use 400 slices by default
- if ($timeframe == 'day') {
- $slice = isset($gconf['slice'])?$gconf['slice']:300; // 5 minutes
- $duration = isset($gconf['duration'])?$gconf['duration']:400*$slice; // 33.33 hours
- // vertical lines at day borders
- $addSpecial .= ' VRULE:'.strtotime(date('Y-m-d')).'#FF0000';
- $addSpecial .= ' VRULE:'.strtotime(date('Y-m-d').' -1 day').'#FF0000';
- if (!isset($gconf['grid_x'])) { $gconf['grid_x'] = 'HOUR:1:HOUR:6:HOUR:2:0:%-H'; }
- }
- elseif ($timeframe == 'week') {
- $slice = isset($gconf['slice'])?$gconf['slice']:1800; // 30 minutes
- $duration = isset($gconf['duration'])?$gconf['duration']:400*$slice; // 8.33 days
- // vertical lines at week borders
- $addSpecial .= ' VRULE:'.strtotime(date('Y-m-d').' '.(-date('w')+1).' day').'#FF0000';
- $addSpecial .= ' VRULE:'.strtotime(date('Y-m-d').' '.(-date('w')-6).' day').'#FF0000';
- }
- elseif ($timeframe == 'month') {
- $slice = isset($gconf['slice'])?$gconf['slice']:7200; // 2 hours
- $duration = isset($gconf['duration'])?$gconf['duration']:400*$slice; // 33.33 days
- // vertical lines at month borders
- $addSpecial .= ' VRULE:'.strtotime(date('Y-m-01')).'#FF0000';
- $addSpecial .= ' VRULE:'.strtotime(date('Y-m-01').' -1 month').'#FF0000';
- }
- elseif ($timeframe == 'year') {
- $slice = isset($gconf['slice'])?$gconf['slice']:86400; // 1 day
- $duration = isset($gconf['duration'])?$gconf['duration']:400*$slice; // 400 days
- // vertical lines at month borders
- $addSpecial .= ' VRULE:'.strtotime(date('Y-01-01 12:00:00')).'#FF0000';
- $addSpecial .= ' VRULE:'.strtotime(date('Y-01-01 12:00:00').' -1 year').'#FF0000';
- }
- else {
- $duration = isset($gconf['duration'])?$gconf['duration']:$this->rrd_step*500; // 500 steps
- $slice = isset($gconf['slice'])?$gconf['slice']:$this->rrd_step; // whatever our step is
- }
-
- $use_gcrows = (isset($gconf['rows']) && count($gconf['rows']));
- if ($use_gcrows) { $grow_def =& $gconf['rows']; }
- else { $grow_def =& $this->rrd_fields; }
- foreach ($grow_def as $key=>$erow) {
- if (isset($erow['name']) && strlen($erow['name'])) {
- if (!isset($erow['scale']) && isset($gconf['scale'])) { $erow['scale'] = $gconf['scale']; }
- if (!isset($erow['scale_time_src']) && isset($gconf['scale_time_src'])) { $erow['scale_time_src'] = $gconf['scale_time_src']; }
- if (!isset($erow['scale_time_tgt']) && isset($gconf['scale_time_tgt'])) { $erow['scale_time_tgt'] = $gconf['scale_time_tgt']; }
- foreach (array('scale_time_src','scale_time_tgt') as $st) {
- if (!isset($erow[$st]) || !is_numeric($erow[$st])) {
- switch (@$erow[$st]) {
- case 'dyn':
- case 'auto':
- $erow[$st] = $slice;
- break;
- case 'day':
- $erow[$st] = 24*3600;
- break;
- case '2hr':
- case '2hours':
- $erow[$st] = 7200;
- break;
- case 'hr':
- case 'hour':
- $erow[$st] = 3600;
- break;
- case '30min':
- $erow[$st] = 1800;
- break;
- case '5min':
- $erow[$st] = 300;
- break;
- case 'min':
- $erow[$st] = 60;
- break;
- case 's':
- case 'sec':
- default:
- $erow[$st] = 1;
- break;
- }
- }
- }
- $scale_time_factor = $erow['scale_time_tgt']/$erow['scale_time_src'];
- if ($scale_time_factor != 1) { $erow['scale'] = (isset($erow['scale'])?$erow['scale']:1)*$scale_time_factor; }
- $grow = array();
- $grow['dType'] = ($use_gcrows && isset($erow['dType']))?$erow['dType']:'DEF';
- $grow['name'] = $erow['name'].(isset($erow['scale'])?'_tmp':'');
- if ($grow['dType'] == 'DEF') {
- $grow['dsname'] = ($use_gcrows && isset($erow['dsname']))?$erow['dsname']:$erow['name'];
- if ($use_gcrows && isset($erow['dsfile'])) { $grow['dsfile'] = $erow['dsfile']; }
- $grow['cf'] = ($use_gcrows && isset($erow['cf']))?$erow['cf']:'AVERAGE';
- }
- else {
- $grow['rpn_expr'] = isset($erow['rpn_expr'])?$erow['rpn_expr']:'0';
- }
- if (isset($erow['scale'])) {
- $graphrows[] = $grow;
- $grow = array();
- $grow['dType'] = 'CDEF';
- $grow['name'] = $erow['name'];
- $grow['rpn_expr'] = $erow['name'].'_tmp,'.$erow['scale'].',*';
- }
- if ($use_gcrows) { $grow['gType'] = isset($erow['gType'])?$erow['gType']:'LINE1'; }
- else { $grow['gType'] = ((count($grow_def)==2) && ($key==0))?'AREA':'LINE1'; }
- $grow['color'] = isset($erow['color'])?$erow['color']:$gColors[$gC++];
- $grow['color_bg'] = isset($erow['color_bg'])?$erow['color_bg']:'';
- if ($gC >= count($gColors)) { $gC = 0; }
- if (isset($erow['legend'])) {
- $grow['legend'] = $erow['legend'];
- if (!isset($gconf['show_legend'])) { $gconf['show_legend'] = true; }
- }
- if (isset($erow['stack'])) { $grow['stack'] = ($erow['stack'] == true); }
- if (isset($erow['desc'])) { $grow['desc'] = $erow['desc']; }
- if (isset($erow['legend_long'])) { $grow['legend_long'] = $erow['legend_long']; }
- $graphrows[] = $grow;
- }
- }
-
- if (isset($gconf['special']) && count($gconf['special'])) {
- foreach ($gconf['special'] as $crow) {
- $srow = array();
- $srow['sType'] = isset($crow['sType'])?$crow['sType']:'COMMENT';
- if ($grow['sType'] != 'COMMENT') {
- // XXX: use line below and remove cf var once we have rrdtol 1.2
- if ($this->rrd_version() >= '1.2') {
- $srow['name'] = $crow['name'].(isset($crow['cf'])?'_'.$crow['cf']:'');
- }
- else {
- $srow['name'] = $crow['name'];
- $srow['cf'] = isset($crow['cf'])?$crow['cf']:'AVERAGE';
- }
- if (isset($crow['cf'])) {
- if ($this->rrd_version() >= '1.2') {
- $graphrows[] = array('dType'=>'VDEF', 'name'=>$srow['name'].'_'.$crow['cf'], 'rpn_expr'=>$srow['name'].','.$crow['cf']);
- }
- }
- elseif (isset($crow['rpn_expr'])) {
- if ($this->rrd_version() >= '1.2') {
- $graphrows[] = array('dType'=>'VDEF', 'name'=>$srow['name'], 'rpn_expr'=>$crow['rpn_expr']);
- }
- }
- }
- $srow['text'] = isset($crow['text'])?$crow['text']:'';
- $specialrows[] = $srow;
- }
- }
- else {
- $td = $this->mod_textdomain;
- foreach ($graphrows as $grow) {
- if (isset($grow['gType']) && strlen($grow['gType'])) {
- $textprefix = isset($grow['desc'])?$grow['desc']:(isset($grow['legend'])?$grow['legend']:$grow['name']);
- if ($this->rrd_version() >= '1.2') {
- $graphrows[] = array('dType'=>'VDEF', 'name'=>'_'.$grow['name'].'__max', 'rpn_expr'=>$grow['name'].',MAXIMUM');
- $specialrows[] = array('sType'=>'PRINT', 'name'=>'_'.$grow['name'].'__max', 'text'=>$textprefix.'|'.dgettext($td, 'Maximum').'|%.2lf%s');
- $graphrows[] = array('dType'=>'VDEF', 'name'=>'_'.$grow['name'].'__avg', 'rpn_expr'=>$grow['name'].',AVERAGE');
- $specialrows[] = array('sType'=>'PRINT', 'name'=>'_'.$grow['name'].'__avg', 'text'=>$textprefix.'|'.dgettext($td, 'Average').'|%.2lf%s');
- $graphrows[] = array('dType'=>'VDEF', 'name'=>'_'.$grow['name'].'__last', 'rpn_expr'=>$grow['name'].',LAST');
- $specialrows[] = array('sType'=>'PRINT', 'name'=>'_'.$grow['name'].'__last', 'text'=>$textprefix.'|'.dgettext($td, 'Current').'|%.2lf%s');
- }
- else {
- $specialrows[] = array('sType'=>'PRINT', 'name'=>$grow['name'], 'cf'=>'MAX', 'text'=>$textprefix.'|'.dgettext($td, 'Maximum').'|%.2lf%s');
- $specialrows[] = array('sType'=>'PRINT', 'name'=>$grow['name'], 'cf'=>'AVERAGE', 'text'=>$textprefix.'|'.dgettext($td, 'Average').'|%.2lf%s');
- $specialrows[] = array('sType'=>'PRINT', 'name'=>$grow['name'], 'cf'=>'LAST', 'text'=>$textprefix.'|'.dgettext($td, 'Current').'|%.2lf%s');
- }
- }
- }
- }
-
- $endtime = isset($gconf['time_end'])?$gconf['time_end']:(is_numeric($this->last_update())?$this->last_update():time());
- $gOpts = ' --start '.($endtime-$duration).' --end '.$endtime.' --step '.$slice;
- if (isset($gconf['label_top'])) { $gOpts .= ' --title '.$this->text_quote($gconf['label_top']); }
- if (isset($gconf['label_y'])) { $gOpts .= ' --vertical-label '.$this->text_quote($gconf['label_y']); }
- if (isset($gconf['width'])) { $gOpts .= ' --width '.$gconf['width']; }
- if (isset($gconf['height'])) { $gOpts .= ' --height '.$gconf['height'];
- if (($gconf['height'] <= 32) && isset($gconf['thumb']) && ($gconf['thumb'])) { $gOpts .= ' --only-graph'; }
- }
- if (!isset($gconf['show_legend']) || (!$gconf['show_legend'])) { $gOpts .= ' --no-legend'; }
- if (isset($gconf['logarithmic']) && $gconf['logarithmic']) { $gOpts .= ' --logarithmic'; }
- if (isset($gconf['min_y'])) { $gOpts .= ' --lower-limit '.$gconf['min_y']; }
- if (isset($gconf['max_y'])) { $gOpts .= ' --upper-limit '.$gconf['max_y']; }
- if (isset($gconf['fix_scale_y']) && $gconf['fix_scale_y']) { $gOpts .= ' --rigid'; }
- if (isset($gconf['grid_x'])) { $gOpts .= ' --x-grid '.$gconf['grid_x']; }
- if (isset($gconf['grid_y'])) { $gOpts .= ' --y-grid '.$gconf['grid_y']; }
- if (isset($gconf['gridfit']) && (!$gconf['gridfit'])) { $gOpts .= ' --no-gridfit'; }
- if (isset($gconf['calc_scale_y']) && $gconf['calc_scale_y']) { $gOpts .= ' --alt-autoscale'; }
- if (isset($gconf['calc_max_y']) && $gconf['calc_max_y']) { $gOpts .= ' --alt-autoscale-max'; }
- if (isset($gconf['units_exponent'])) { $gOpts .= ' --units-exponent '.$gconf['units_exponent']; }
- if (isset($gconf['units_length'])) { $gOpts .= ' --units-length '.$gconf['units_length']; }
- if (($this->rrd_version() < '1.2') || !count($specialrows)) {
- // lazy graphics omit all print reporting in RRDtool 1.2!
- // --> so don't use them there when we want to print stuff
- if (!isset($gconf['force_recreate']) || (!$gconf['force_recreate'])) { $gOpts .= ' --lazy'; }
- }
- if (isset($gconf['force_color']) && is_array($gconf['force_color'])) {
- foreach ($gconf['force_color'] as $ctag=>$cval) { $gOpts .= ' --color '.$ctag.$cval; }
- }
- if (isset($gconf['force_font']) && is_array($gconf['force_font'])) {
- foreach ($gconf['force_font'] as $ctag=>$cval) { $gOpts .= ' --font '.$ctag.$cval; }
- }
- if (isset($gconf['units_binary']) && $gconf['units_binary']) { $gOpts .= ' --base 1024'; }
-
- foreach ($graphrows as $grow) {
- if (isset($grow['dType']) && strlen($grow['dType'])) {
- $gDefs .= ' '.$grow['dType'].':'.$grow['name'].'=';
- if ($grow['dType'] == 'DEF') {
- $gDefs .= isset($grow['dsfile'])?$grow['dsfile']:$this->rrd_file;
- $gDefs .= ':'.$grow['dsname'].':'.$grow['cf'];
- }
- else { $gDefs .= $grow['rpn_expr']; }
- }
- if (isset($grow['gType']) && strlen($grow['gType'])) {
- // XXX: change from STACK type to STACK flag once we have rrdtool 1.2
- if ($this->rrd_version() < '1.2') {
- // rrdtool 1.0 only know STACK type
- if (isset($grow['stack']) && $grow['stack']) { $grow['gType'] = 'STACK'; }
- }
- $gGraphs .= ' '.$grow['gType'].':'.$grow['name'].$grow['color'];
- if (isset($grow['legend'])) { $gGraphs .= ':'.$this->text_quote($grow['legend']); }
- if ($this->rrd_version() >= '1.2') {
- // rrdtool 1.2 and above have STACK flag
- if (isset($grow['stack']) && $grow['stack']) { $gGraphs .= ':STACK'; }
- }
- }
- }
-
- foreach ($specialrows as $srow) {
- $addSpecial .= ' '.$srow['sType'];
- if ($this->rrd_version() >= '1.2') {
- $addSpecial .= (($srow['sType']!='COMMENT')?':'.$srow['name']:'');
- }
- else {
- $addSpecial .= (($srow['sType']!='COMMENT')?':'.$srow['name'].':'.$srow['cf']:'');
- }
- $addSpecial .= ':'.$this->text_quote($srow['text']);
- }
-
- $graph_cmd = 'rrdtool graph '.str_replace('*', '\*', $fname.$gOpts.$gDefs.$gGraphs.$addSpecial);
- $return = `$graph_cmd 2>&1`;
-
- if (strpos($return, 'ERROR') !== false) {
- trigger_error($this->rrd_file.' - rrd graph error: '.$return, E_USER_WARNING);
- $return = 'command:'.$graph_cmd."\n\n".$return;
- }
- if (0) {
- // debug output
- $return = 'command:'.$graph_cmd."\n\n".$return;
- }
- $legendlines = '';
- foreach ($graphrows as $grow) {
- $legendline = isset($grow['desc'])?$grow['desc']:(isset($grow['legend'])?$grow['legend']:$grow['name']);
- $legendline .= '|'.@$grow['color'];
- $legendline .= '|'.(isset($grow['color_bg'])?$grow['color_bg']:'');
- $legendline .= '|'.(isset($grow['legend_long'])?$grow['legend_long']:'');
- $legendlines .= 'legend:'.$legendline."\n";
- }
- $return = 'file:'.$fname."\n".$legendlines.$return;
- return $return;
- }
-
- public function graph_plus($timeframe = 'day', $sub = null, $extra = null) {
- // create a RRD graph and return meta info as a ready-to-use array
- $gmeta = array('filename'=>null,'legends_long'=>false,'default_colorize'=>false);
- $ret = $this->graph($timeframe, $sub, $extra);
- if (0) {
- // debug output
- $gmeta['ret'] = $ret;
- }
- $grout = explode("\n", $ret);
- foreach ($grout as $gline) {
- if (preg_match('/^command:(.+)$/', $gline, $regs)) {
- $gmeta['graph_cmd'] = $regs[1];
- }
- elseif (preg_match('/^file:(.+)$/', $gline, $regs)) {
- $gmeta['filename'] = $regs[1];
- }
- elseif (preg_match('/^legend:([^\|]+)\|([^|]*)\|([^\|]*)\|(.*)$/', $gline, $regs)) {
- $gmeta['legend'][$regs[1]] = array('color'=>$regs[2], 'color_bg'=>$regs[3], 'desc_long'=>$regs[4]);
- if (strlen($regs[4])) { $gmeta['legends_long'] = true; }
- if (strlen($regs[3]) || strlen($regs[4])) { $gmeta['default_colorize'] = true; }
- }
- elseif (preg_match('/^(\d+)x(\d+)$/', $gline, $regs)) {
- $gmeta['width'] = $regs[1]; $gmeta['height'] = $regs[2];
- }
- elseif (preg_match('/^([^\|]+)\|([^|]+)\|([^\|]*)$/', $gline, $regs)) {
- $gmeta['data'][$regs[1]][$regs[2]] = $regs[3];
- }
- elseif (preg_match('/^([^\|]+)\|([^\|]*)$/', $gline, $regs)) {
- $gmeta['var'][$regs[1]] = $regs[2];
- }
- elseif (strlen(trim($gline))) {
- $gmeta['info'][] = $gline;
- }
- }
- if (is_null($gmeta['filename'])) {
- $gmeta['filename'] = $this->basename.(!is_null($sub)?'-'.$sub:'').'-'.$timeframe.'.png';
- }
- return $gmeta;
- }
-
- public function page($sub = null, $page_extras = null, $graph_extras = null) {
- // create a (HTML) page and return it in a string
-
- // assemble configuration
- $pconf = (array)$page_extras;
- if (!is_null($sub) && is_array($this->config_raw['page.'.$sub])) {
- $pconf = $pconf + $this->config_raw['page.'.$sub];
- }
- $pconf = $pconf + (array)$this->config_page;
-
- $return = null;
- switch (@$pconf['type']) {
- case 'index':
- $return = $this->page_index($pconf);
- break;
- case 'overview':
- $return = $this->page_overview($pconf, $graph_extras);
- break;
- case 'simple':
- default:
- $return = $this->page_simple($pconf, $graph_extras);
- break;
- }
- return $return;
- }
-
- public function simple_html($sub = null, $page_extras = null, $graph_extras = null) {
- // create a simple (MRTG-like) HTML page and return it in a string
- // XXX: this is here temporarily for compat only, it's preferred to use page()!
- trigger_error(__CLASS__.'::'.__METHOD__.' is deprecated, use page() instead.', E_USER_NOTICE);
-
- // assemble configuration
- $pconf = (array)$page_extras;
- if (!is_null($sub) && is_array($this->config_raw['page.'.$sub])) {
- $pconf = $pconf + $this->config_raw['page.'.$sub];
- }
- $pconf = $pconf + (array)$this->config_page;
-
- return $this->page_simple($pconf, $graph_extras);
- }
-
- private function page_index($pconf) {
- // create a bare, very simple index list HTML page and return it in a string
- $td = $this->mod_textdomain;
- $ptitle = isset($pconf['title_page'])?$pconf['title_page']:dgettext($td, 'RRD statistics index');
-
- $out = '<html><head>'."\n";
- $out .= '<title>'.$ptitle.'</title>'."\n";
- $out .= '<style type="text/css">'."\n";
- if (isset($pconf['style_base'])) { $out .= $pconf['style_base']; }
- else {
- $out .= 'h1 { font-weight: bold; font-size: 1.5em; }'."\n";
- $out .= '.footer { font-size: 0.75em; margin: 0.5em 0; }'."\n";
- $out .= 'li.scanfile { font-style: italic; }'."\n";
- }
- if (isset($pconf['style'])) { $out .= $pconf['style']; }
- $out .= '</style>'."\n";
- $out .= '</head>'."\n";
- $out .= '<body>'."\n";
-
- $out .= '<h1>'.$ptitle.'</h1>'."\n";
- if (isset($pconf['text_intro']) && strlen($pconf['text_intro'])) {
- $out .= '<p class="intro">'.$pconf['text_intro'].'</p>'."\n";
- }
- elseif (!isset($pconf['text_intro'])) {
- $out .= '<p class="intro">'.dgettext($td, 'The following RRD stats are available:').'</p>'."\n";
- }
-
- $stats = $this->h_page_statsArray($pconf);
-
- if (isset($pconf['stats_url'])) { $sURL_base = $pconf['stats_url']; }
- else { $sURL_base = '?stat=%i%a'; }
-
- if (isset($pconf['stats_url_add'])) { $sURL_add = $pconf['stats_url_add']; }
- else { $sURL_add = '&sub=%s'; }
-
- $out .= '<ul class="indexlist">'."\n";
- foreach ($stats as $stat) {
- $out .= '<li'.(isset($stat['class'])?' class="'.$stat['class'].'"':'').'>';
- $sURL = str_replace('%i', $stat['name'], $sURL_base);
- $sURL = str_replace('%a', '', $sURL);
- $sURL = str_replace('%s', '', $sURL);
- $out .= '<a href="'.$sURL.'">'.$stat['name'].'</a>';
- if (isset($stat['sub']) && count($stat['sub'])) {
- $sprt = array();
- foreach ($stat['sub'] as $ssub) {
- $sURL = str_replace('%i', $stat['name'], $sURL_base);
- $sURL = str_replace('%a', $sURL_add, $sURL);
- $sURL = str_replace('%s', $ssub, $sURL);
- $sprt[] = '<a href="'.$sURL.'">'.$ssub.'</a>';
- }
- $out .= ' <span="subs">('.implode(', ', $sprt).')</span>';
- }
- $out .= '</li>'."\n";
- }
- $out .= '</ul>'."\n";
-
- $out .= $this->h_page_footer();
- $out .= '</body></html>'."\n";
- return $out;
- }
-
- private function page_overview($pconf, $graph_extras = null) {
- // create an overview HTML page (including graphs) and return it in a string
- $td = $this->mod_textdomain;
- $ptitle = isset($pconf['title_page'])?$pconf['title_page']:dgettext($td, 'RRD statistics overview');
-
- $out = '<html><head>'."\n";
- $out .= '<title>'.$ptitle.'</title>'."\n";
- $out .= '<style type="text/css">'."\n";
- if (isset($pconf['style_base'])) { $out .= $pconf['style_base']; }
- else {
- $out .= 'h1 { font-weight: bold; font-size: 1.5em; }'."\n";
- $out .= 'h2 { font-weight: bold; font-size: 1em; margin: 0.5em 0; }'."\n";
- $out .= '.footer { font-size: 0.75em; margin: 0.5em 0; }'."\n";
- $out .= 'img.rrdgraph { border: none; }'."\n";
- }
- if (isset($pconf['style'])) { $out .= $pconf['style']; }
- $out .= '</style>'."\n";
- $out .= '</head>'."\n";
- $out .= '<body>'."\n";
-
- $out .= '<h1>'.$ptitle.'</h1>'."\n";
- if (isset($pconf['text_intro']) && strlen($pconf['text_intro'])) { $out .= '<p class="intro">'.$pconf['text_intro'].'</p>'; }
-
- $stats = $this->h_page_statsArray($pconf);
-
- if (isset($pconf['stats_url'])) { $sURL_base = $pconf['stats_url']; }
- else { $sURL_base = '?stat=%i%a'; }
-
- if (isset($pconf['stats_url_add'])) { $sURL_add = $pconf['stats_url_add']; }
- else { $sURL_add = '&sub=%s'; }
-
- $num_rows = is_numeric($pconf['num_rows'])?$pconf['num_rows']:2;
- $num_cols = ceil(count($stats)/$num_rows);
-
- $out .= '<table class="overview">'."\n";
- for ($col = 0; $col < $num_cols; $col++) {
- $out .= '<tr>'."\n";
- for ($row = 0; $row < $num_rows; $row++) {
- $idx = $col * $num_rows + $row;
- $out .= '<td>'."\n";
- if ($idx < count($stats)) {
- @list($sname, $s_psub) = explode('|', $stats[$idx]['name'], 2);
- $s_psname = 'page'.(isset($s_psub)?'.'.$s_psub:'');
- $g_sub = @$this->config_all[$sname][$s_psname]['graph_sub'];
-
- if (isset($this->config_all[$sname][$s_psname]['title_page'])) {
- $s_ptitle = $this->config_all[$sname][$s_psname]['title_page'];
- }
- elseif (isset($this->config_all[$sname]['page']['title_page'])) {
- $s_ptitle = $this->config_all[$sname]['page']['title_page'];
- }
- else {
- $s_ptitle = isset($s_psub)?sprintf(dgettext($td, '%s (%s) statistics'), $sname, $s_psub):sprintf(dgettext($td, '%s statistics'), $sname);
- }
- if (!isset($pconf['hide_titles']) || !$pconf['hide_titles']) {
- $out .= '<h2>'.$s_ptitle.'</h2>'."\n";
- }
-
- $s_rrd = new rrdstat($this->config_all, $sname);
- if (in_array($s_rrd->status, array('ok','readonly','graphonly'))) {
- $tframe = isset($pconf['graph_timeframe'])?$pconf['graph_timeframe']:'day';
- $gmeta = $s_rrd->graph_plus($tframe, $g_sub);
- if (isset($pconf['graph_url'])) {
- $gURL = $pconf['graph_url'];
- $gURL = str_replace('%f', basename($gmeta['filename']), $gURL);
- $gURL = str_replace('%p', $gmeta['filename'], $gURL);
- if (substr($gURL, -1) == '/') { $gURL .= $gmeta['filename']; }
- }
- else {
- $gURL = $gmeta['filename'];
- }
- $sURL = str_replace('%i', $sname, $sURL_base);
- $sURL = str_replace('%a', isset($s_psub)?$sURL_add:'', $sURL);
- $sURL = str_replace('%s', isset($s_psub)?$s_psub:'', $sURL);
- $out .= '<a href="'.$sURL.'">';
- $out .= '<img src="'.$gURL.'"';
- $out .= ' alt="'.$s_rrd->basename.(!is_null($g_sub)?' - '.$g_sub:'').' - '.$tframe.'" class="rrdgraph"';
- if (isset($gmeta['width']) && isset($gmeta['height'])) { $out .= ' style="width:'.$gmeta['width'].'px;height:'.$gmeta['height'].'px;"'; }
- $out .= '></a>'."\n";
- }
- else {
- $out .= sprintf(dgettext($td, 'RRD error: status is "%s"'), $s_rrd->status)."\n";
- }
- }
- else {
- $out .= ' ';
- }
- $out .= '</td>'."\n";
- }
- $out .= '</tr>'."\n";
- }
- $out .= '</table>'."\n";
-
- $out .= $this->h_page_footer();
- $out .= '</body></html>'."\n";
- return $out;
- }
-
- private function page_simple($pconf, $graph_extras = null) {
- // create a simple (MRTG-like) HTML page and return it in a string
- $td = $this->mod_textdomain;
-
- $ptitle = isset($pconf['title_page'])?$pconf['title_page']:sprintf(dgettext($td, '%s - RRD statistics'),$this->basename);
- $gtitle = array();
- $gtitle['day'] = isset($pconf['title_day'])?$pconf['title_day']:dgettext($td, 'Day overview (scaling 5 minutes)');
- $gtitle['week'] = isset($pconf['title_week'])?$pconf['title_week']:dgettext($td, 'Week overview (scaling 30 minutes)');
- $gtitle['month'] = isset($pconf['title_month'])?$pconf['title_month']:dgettext($td, 'Month overview (scaling 2 hours)');
- $gtitle['year'] = isset($pconf['title_year'])?$pconf['title_year']:dgettext($td, 'Year overview (scaling 1 day)');
- $ltitle = isset($pconf['title_legend'])?$pconf['title_legend']:dgettext($td, 'Legend:');
-
- $out = '<html><head>'."\n";
- $out .= '<title>'.$ptitle.'</title>'."\n";
- $out .= '<style type="text/css">'."\n";
- if (isset($pconf['style_base'])) { $out .= $pconf['style_base']; }
- else {
- $out .= 'h1 { font-weight: bold; font-size: 1.5em; }'."\n";
- $out .= 'h2 { font-weight: bold; font-size: 1em; }'."\n";
- $out .= '.gdata, .gvar, .ginfo { font-size: 0.75em; margin: 0.5em 0; }'."\n";
- $out .= 'table.gdata, table.legend { border: 1px solid gray; border-collapse: collapse; }'."\n";
- $out .= 'table.gdata td, table.gdata th, '."\n";
- $out .= 'table.legend td, table.legend th { border: 1px solid gray; padding: 0.1em 0.2em; }'."\n";
- $out .= 'div.legend { font-size: 0.75em; margin: 0.5em 0; }'."\n";
- $out .= 'div.legend p { margin: 0; }'."\n";
- $out .= '.footer { font-size: 0.75em; margin: 0.5em 0; }'."\n";
- }
- if (isset($pconf['style'])) { $out .= $pconf['style']; }
- $out .= '</style>'."\n";
- $out .= '</head>'."\n";
- $out .= '<body>'."\n";
-
- $out .= '<h1>'.$ptitle.'</h1>'."\n";
- if (isset($pconf['text_intro']) && strlen($pconf['text_intro'])) { $out .= '<p class="intro">'.$pconf['text_intro'].'</p>'."\n"; }
- if (!isset($pconf['show_update']) || $pconf['show_update']) {
- $out .= '<p class="last_up">';
- if (is_null($this->last_update())) { $up_time = dgettext($td, 'unknown'); }
- elseif (class_exists('baseutils')) { $up_time = baseutils::dateFormat($this->last_update(), 'short'); }
- else { $up_time = date('Y-m-d H:i:s', $this->last_update()); }
- $out .= sprintf(dgettext($td, 'Last Update: %s'), $up_time);
- $out .= '</p>'."\n";
- }
-
- $g_sub = isset($pconf['graph_sub'])?$pconf['graph_sub']:null;
- if (in_array($this->status, array('ok','readonly','graphonly'))) {
- foreach (array('day','week','month','year') as $tframe) {
- $gmeta = $this->graph_plus($tframe, $g_sub, $graph_extras);
- if (isset($pconf['graph_url'])) {
- $gURL = $pconf['graph_url'];
- $gURL = str_replace('%f', basename($gmeta['filename']), $gURL);
- $gURL = str_replace('%p', $gmeta['filename'], $gURL);
- if (substr($gURL, -1) == '/') { $gURL .= $gmeta['filename']; }
- }
- else {
- $gURL = $gmeta['filename'];
- }
- $out .= '<div class="'.$tframe.'">'."\n";
- if (0) {
- // debug output
- ob_start();
- print_r($gmeta);
- $buffer = ob_get_contents();
- ob_end_clean();
- $out .= '<p>'.nl2br($buffer).'</p>';
- }
- $out .= '<h2>'.$gtitle[$tframe].'</h2>'."\n";
- $out .= '<img src="'.$gURL.'"';
- $out .= ' alt="'.$this->basename.(!is_null($g_sub)?' - '.$g_sub:'').' - '.$tframe.'" class="rrdgraph"';
- if (isset($gmeta['width']) && isset($gmeta['height'])) { $out .= ' style="width:'.$gmeta['width'].'px;height:'.$gmeta['height'].'px;"'; }
- $out .= '>'."\n";
- $colorize_data = (isset($pconf['data_colorize']) && $pconf['data_colorize']) || (!isset($pconf['data_colorize']) && $gmeta['default_colorize']);
- if (isset($gmeta['data']) && count($gmeta['data'])) {
- $out .= '<table class="gdata">'."\n";
- foreach ($gmeta['data'] as $field=>$gdata) {
- $out .= '<tr><th';
- if ($colorize_data && isset($gmeta['legend'][$field])) {
- $out .= ' style="color:'.$gmeta['legend'][$field]['color'].';';
- if (strlen($gmeta['legend'][$field]['color_bg'])) {
- $out .= 'background-color:'.$gmeta['legend'][$field]['color_bg'].';';
- }
- $out .= '"';
- }
- $out .= '>'.$field.'</th>';
- foreach ($gdata as $gkey=>$gval) {
- $out .= '<td><span class="gkey">'.$gkey.': </span>'.$gval.'</td>';
- }
- $out .= '</tr>'."\n";
- }
- $out .= '</table>'."\n";
- }
- if (isset($gmeta['var']) && count($gmeta['var'])) {
- foreach ($gmeta['var'] as $gkey=>$gval) {
- $out .= '<p class="gvar"><span class="gkey">'.$gkey.': </span>'.$gval.'</p>'."\n";
- }
- }
- if (isset($gmeta['info']) && count($gmeta['info'])) {
- foreach ($gmeta['info'] as $gval) {
- $out .= '<p class="ginfo">'.$gval.'</p>'."\n";
- }
- }
- $out .= '</div>'."\n";
- }
- if ($gmeta['legends_long'] && (!isset($pconf['show_legend']) || $pconf['show_legend'])) {
- $out .= '<div class="legend">'."\n";
- $out .= '<p>'.$ltitle.'</p>'."\n";
- $out .= '<table class="legend">'."\n";
- foreach ($gmeta['legend'] as $field=>$legend) {
- if (strlen($legend['desc_long'])) {
- $out .= '<tr><th';
- if ($colorize_data && isset($gmeta['legend'][$field])) {
- $out .= ' style="color:'.$gmeta['legend'][$field]['color'].';';
- if (strlen($gmeta['legend'][$field]['color_bg'])) {
- $out .= 'background-color:'.$gmeta['legend'][$field]['color_bg'].';';
- }
- $out .= '"';
- }
- $out .= '>'.$field.'</th>';
- $out .= '<td>'.$legend['desc_long'].'</td>';
- $out .= '</tr>'."\n";
- }
- }
- $out .= '</table>'."\n";
- $out .= '</div>'."\n";
- }
- }
- else {
- $out .= sprintf(dgettext($td, 'RRD error: status is "%s"'), $this->status)."\n";
- }
-
- $out .= $this->h_page_footer();
- $out .= '</body></html>'."\n";
- return $out;
- }
-
- private function h_page_statsArray($pconf) {
- // return array of stats to list on a page
- $stats = array();
- $snames = array(); $s_exclude = array(); $sfiles = array();
- if (isset($pconf['index_ids'])) {
- foreach (explode(',', $pconf['index_ids']) as $iid) {
- if ($iid{0} == '-') { $s_exclude[] = substr($iid, 1); }
- else { $snames[] = $iid; }
- }
- }
- if (!isset($pconf['scan_config']) || $pconf['scan_config']) {
- foreach ($this->config_all as $iname=>$rinfo) {
- if (($iname != '*') && !(isset($rinfo['hidden']) && $rinfo['hidden']) &&
- !(in_array($iname, $snames)) && !(in_array($iname, $s_exclude))) {
- $snames[] = $iname;
- }
- }
- }
- foreach ($snames as $iname) {
- $newstat = array('name'=>$iname);
- $sfiles[] = isset($this->config_all[$iname]['file'])?$this->config_all[$iname]['file']:$iname.'.rrd';
- if (is_array($this->config_all[$iname])) {
- foreach ($this->config_all[$iname] as $key=>$val) {
- if (substr($key, 0, 5) == 'page.') { $newstat['sub'][] = substr($key, 5); }
- }
- }
- $stats[] = $newstat;
- }
- if (isset($pconf['scan_files']) && $pconf['scan_files']) {
- $rrdfiles = glob('*.rrd');
- foreach ($rrdfiles as $rrdfile) {
- $iname = (substr($rrdfile, -4) == '.rrd')?substr($rrdfile, 0, -4):$rrdfile;
- if (!in_array($rrdfile, $sfiles) && !(in_array($iname, $s_exclude))) {
- $stats[] = array('name'=>$iname, 'class'=>'scanfile');
- }
- }
- }
- return $stats;
- }
-
- private function h_page_footer() {
- // return generic page footer
- $out = '<p class="footer">';
- $out .= sprintf(dgettext($this->mod_textdomain, 'Statistics created with %s using a library created by %s.'),
- '<a href="http://people.ee.ethz.ch/~oetiker/webtools/rrdtool/">RRDtool</a>',
- '<a href="http://www.kairo.at/">KaiRo.at</a>');
- $out .= '</p>'."\n";
- return $out;
- }
-
- private function text_quote($text) {
- $trans = array('"' => '\"', ':' => '\:');
- $qtext = '"'.strtr($text, $trans).'"';
- return $qtext;
- }
-}
-?>
--- /dev/null
+../../include/classes/rrdstat.php-class
\ No newline at end of file
# collection of some known User Agent Strings:
# see also:
-# http://www.pgts.com.au/pgtsj/pgtsj0208c.html http://www.psychedelix.com/agents/index.shtml http://en.wikipedia.org/wiki/User_agent
+# http://www.pgts.com.au/pgtsj/pgtsj0208c.html http://www.psychedelix.com/agents/index.shtml http://en.wikipedia.org/wiki/User_agent http://useragentstring.com/pages/useragentstring.php
Mozilla/5.0 (X11; U; Linux i686; de-AT; rv:1.3b) Gecko/20030114
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.0rc3) Gecko/20020523
Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.1) Gecko/20021005
Mozilla/5.0 (X11; Slackware; Linux i686; en-US; rv:1.7) Gecko/20040618
Mozilla/5.0 (X11; U; Linux i686; rv:1.7.7) Gecko/20050414
Mozilla/5.0 (X11; U; Linux i686; de-AT; rv:1.6; f33eed1469017fe8b64dc7f3261eb135;) Gecko/20040113
-Mozilla/5.0 (X11; U; SunOS i86pc; en-US; rv:1.7.5) Gecko/20050101 Firefox/1.0
-Mozilla/5.0 (Gameboy Color; U; Gameboy OS 2005; de-DE) Gecko/20041107 Firefox/1.0
-Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.7.5) Gecko/20041111 Firefox/1.0
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7) Gecko/20040618 MultiZilla/1.6.2.1d
Mozilla/5.0 (Linux; U; de, DE, de_DE@euro; m18) Gecko/20001010
Mozilla/5.0 (Windows; U; Win 9x 4.90; de-DE; m18) Gecko/20010131 Netscape6/6.01
Mozilla/5.0 (Windows; U; Windows NT 5.1; de-DE; rv:1.0.1) Gecko/20020823 Netscape/7.0
+Mozilla/5.0 (Windows; U; Win 9x 4.90; en-US; rv:1.8.1.5pre) Gecko/20070604 Firefox/2.0.0.4 Navigator/9.0b1
Mozilla/5.0 (Windows; U; Win 9x 4.90; en-US; rv:1.3a) Gecko/20021207 Phoenix/0.5
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4b) Gecko/20030516 Mozilla Firebird/0.6
Mozilla/5.0 (Windows; U; WinNT4.0; en-US; rv:1.5a) Gecko/20030728 Mozilla Firebird/0.6.1
Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7a) Gecko/20040216 Firefox/0.8.0+
Mozilla/5.0 (BeOS; U; BeOS BePC; en-US; rv:1.7b) Gecko/20040228 Firefox/0.8.0+ (Mozilla/4.7 [en] (Win95; I))
Mozilla/5.0 (Windows; U; Windows NT 5.1; rv:1.7.3) Gecko/20041001 Firefox/0.10.1
+Mozilla/5.0 (X11; U; SunOS i86pc; en-US; rv:1.7.5) Gecko/20050101 Firefox/1.0
+Mozilla/5.0 (Gameboy Color; U; Gameboy OS 2005; de-DE) Gecko/20041107 Firefox/1.0
+Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.7.5) Gecko/20041111 Firefox/1.0
Mozilla/5.0 (X11; Linux i686; rv:1.7.5) Gecko/20041108 Firefox/1.0
Mozilla/5.0 (X11; U; Linux i686; chrome://navigator/locale/navigator.properties; rv:1.7.5) Gecko/20041107 Firefox/1.0
+Mozilla/5.0 (Windows; Windows NT 5.1; en-US; rv:1.9.2a1pre) Gecko/20090402 Firefox/3.6a1pre
Mozilla/5.0 (Windows; U; Windows NT 5.1; rv:1.7.5) Gecko/20041217 Firefox/1.0.4
+Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9a6pre) Gecko/20070702 Minefield/3.0a6pre
+Mozilla/5.0 (Windows NT 5.2; rv:2.0.1) Gecko/20100101 Firefox/4.0.1
+Mozilla/5.0 (Windows NT 6.1; rv:2.0.1) Gecko/20100101 Firefox/4.0.1
+Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:2.0.1) Gecko/20100101 Firefox/4.0.1
+Mozilla/5.0 (Windows NT 6.1; WOW64; rv:2.0.1) Gecko/20100101 Firefox/4.0.1
+Mozilla/5.0 (WindowsCE 6.0; rv:2.0.1) Gecko/20100101 Firefox/4.0.1
+Mozilla/5.0 (Windows NT 6.0; rv:2.0b6pre) Gecko/20100907 Firefox/4.0b6pre
+Mozilla/5.0 (Macintosh; Intel Mac OS X 10.5; rv:2.0.1) Gecko/20100101 Firefox/4.0.1
+Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:2.0.1) Gecko/20100101 Firefox/4.0.1
+Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:2.0b6pre) Gecko/20100907 Firefox/4.0b6pre
+Mozilla/5.0 (X11; Linux i686; rv:2.0.1) Gecko/20100101 Firefox/4.0.1
+Mozilla/5.0 (X11; Linux x86_64; rv:2.0.1) Gecko/20100101 Firefox/4.0.1
+Mozilla/5.0 (X11; Linux i686 on x86_64; rv:2.0.1) Gecko/20100101 Firefox/4.0.1
+Mozilla/5.0 (X11; Linux i686; rv:2.0b6pre) Gecko/20100907 Firefox/4.0b6pre
+Mozilla/5.0 (Android; Linux armv7l; rv:2.0.1) Gecko/20100101 Firefox/4.0.1 Fennec/2.0.1
+Mozilla/5.0 (Android; Linux armv7l; rv:2.0b6pre) Gecko/20100907 Firefox/4.0b6pre Fennec/2.0b1pre
+Mozilla/5.0 (Maemo; Linux armv7l; rv:2.0.1) Gecko/20100101 Firefox/4.0.1 Fennec/2.0.1
+Mozilla/5.0 (X11; Linux armv7l; rv:2.0.1) Gecko/20100101 Firefox/4.0.1 Fennec/2.0.1
+Mozilla/5.0 (X11; Linux i686; rv:2.0.1) Gecko/20100101 Firefox/4.0.1 Fennec/2.0.1
+Mozilla/5.0 (X11; Linux i686 on x86_64; rv:2.0.1) Gecko/20100101 Firefox/4.0.1 Fennec/2.0.1
+Mozilla/5.0 (X11; Linux i686; rv:2.0b6pre) Gecko/20100907 Firefox/4.0b6pre Fennec/2.0b1pre
+Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:2.0.1) Gecko/20100101 Firefox/4.0.1 Camino/2.1.1
+Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:2.0b6pre) Gecko/20100907 Firefox/4.0b6pre Camino/2.1a1pre
+Mozilla/5.0 (Windows; Windows NT 6.0; rv:2.0b3pre) Gecko/20100707 Minefield/4.0b3pre
+Mozilla/5.0 (Windows NT 6.1; rv:2.0b4pre) Gecko/20100806 Firefox/4.0b4pre
+Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.22pre) Gecko/20090415 BonEcho/2.0.0.22pre (.NET CLR 3.5.30729)
+Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.15pre) Gecko/2009090911 GranParadiso/3.0.15pre (.NET CLR 3.5.30729)
+Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.4pre) Gecko/20090923 Shiretoko/3.5.4pre
+Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.2a2pre) Gecko/20090917 Namoroka/3.6a2pre
+Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.3pre) Gecko/20100403 Lorentz/3.6.3plugin2pre (.NET CLR 4.0.20506)
+Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9a9pre) Gecko/2007110108 prism/0.8
+Mozilla/5.0 (Windows; U; Windows NT 6.1; de; rv:1.9.1.4pre) Gecko/20090928 Lightning/1.0pre Shredder/3.0pre
+Mozilla/5.0 (Windows; U; Windows NT 6.1; WOW64; en-US; rv:1.9.3a5pre) Gecko/20100514 Lanikai/3.1b1
+Mozilla/5.0 (Windows; U; Windows NT 5.1; de; rv:1.8.1.19) Gecko/20081209 Thunderbird/2.0.0.19 Mnenhy/0.7.5.0
+Mozilla/5.0 (Windows; U; Windows NT 5.1; es-ES; rv:1.9.1.7) Gecko/20100111 Icedove/3.0.1 ThunderBrowse/3.2.8.1
Mozilla/5.0 (X11; U; Linux i686; de-AT; rv:1.8b2) Gecko/20050324 SeaMonkey/1.0a
+Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9a6pre) Gecko/20070628 Firefox/2.0.0.4 SeaMonkey/2.0a1pre PrivatelyFakedUA/0.0
+Mozilla/5.0 (X11; Linux i686; de; rv:2.0b2pre) Gecko/20100719 NOT Firefox/4.0b2pre SeaMonkey/2.1a3pre
+Mozilla/5.0 (Windows NT 6.1; WOW64; rv:2.0b4pre) Gecko/20100807 Lightning/1.1a1pre SeaMonkey/2.1a3pre
+Mozilla/5.0 (X11; Linux i686 on x86_64; rv:2.0b5pre) Gecko/20100831 Firefox/4.0b5pre SeaMonkey/2.1b1pre
Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en-US; rv:1.0.1) Gecko/20021109 Chimera/0.6+
Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.7b) Gecko/20040302 Camino/0.7+
+Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en; rv:1.8.1.5) Gecko/20070614 Camino/1.6 (like Firefox/2.0.0.4)
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.5) Gecko/20031016 K-Meleon/0.8.1
Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.7.13) Gecko/20050610 K-Meleon/0.9
+Mozilla/5.0 (X11; U; Linux i686; ru; rv:1.9.0.11) Gecko/2009061613 Songbird/1.3.0a (20090624013030)
Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en-US; rv:1.0.1) Gecko/20020730 AOL/7.0
Mozilla/5.0 (Windows; U; Windows CE 4.21; rv:1.8b4) Gecko/20050720 Minimo/0.007
+Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.2a1pre) Gecko/20090317 Fennec/1.0b1
+Mozilla/5.0 (X11; U; Linux armv7l; en-US; rv:1.9.2b1pre) Gecko/20090924 Fennec/1.0b4pre
+Mozilla/5.0 (BeOS; U; Haiku BePC; en-US; rv:1.8.1.22pre) Gecko/20090908 BeZillaBrowser/2.0.0.22pre
+Mozilla/5.0 (OS/2; U; Warp 4.5; en-US; rv:1.8.1.21) Gecko/20090410 PmWFx/2.0.0.21
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.0.7) Gecko/20061031 Firefox/1.5.0.7 Flock/0.7.7
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1) Gecko/20061024 Iceweasel/2.0 (Debian-2.0+dfsg-1)
+Mozilla/5.0 (X11; U; Linux armv6l; en-GB; rv:1.9a6pre) Gecko/20071128 Firefox/3.0a1 Tablet browser 0.2.2 RX-34+RX-44_2008SE_2.2007.48-9
+Mozilla/5.0 (X11; U; Linux armv6l; en-US; rv:1.9a6pre) Gecko/20070926 Firefox/3.0a1 Tablet browser 0.1.22 RX-34+RX-44_OSSO1.1_0.2007.39-13
+Mozilla/5.0 (X11; U; Linux armv7l; gb-GB; rv:1.9.2a1pre) Gecko/20090814 Firefox/3.5 Maemo Browser 1.3.11.1 RX-51
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.5) Gecko/20031019 Epiphany/1.0.6
+Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.7.6) Gecko/20050317 Firefox/1.0.4 Epiphany/1.6.3
Mozilla/5.0 (X11; U; Linux x86_64; en-GB; rv:1.8.0.4) Gecko/20060608 Ubuntu/dapper-security Epiphany/2.14
+Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.10) Gecko/20060410 Firefox/1.0.8 Galeon/1.3.21
Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.6) Gecko/20040402 Galeon/1.3.14
Mozilla/5.0 (X11; U; Linux i686) Gecko/20040319 Galeon/1.3.7
Mozilla/5.0 Galeon/1.2.7 (X11; Linux i686; U;) Gecko/20021204
Mozilla/4.0 (compatible ; MSIE 6.0; Windows NT 5.1)
Mozilla/4.0 (compatible; MSIE 5.5; Windows 98; Win 9x 4.90; T312461)
Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; YPC 3.0.1; .NET CLR 1.1.4322; .NET CLR 2.0.50727)
+Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; Win64; x64; .NET CLR 2.0.50727; SLCC1; Media Center PC 5.0; .NET CLR 3.0.04506)
+Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; MDDC)
+Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; Trident/4.0)
+Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; Trident/5.0)
+Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)
+Mozilla/4.0 (compatible; MSIE 7.0; Windows Phone OS 7.0; Trident/3.1; IEMobile/7.0; DeviceManufacturer;DeviceModel)
Mozilla/4.0 (compatible; MSIE 4.01; Windows CE; Smartphone; 176x220)
Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; Hotbar 4.5.1.0; MSN 6.1; MSNbMSFT; MSNmen-au; MSNc00; v5m)
Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322; MSN 9.0;MSN 9.1; MSNbVZ02; MSNmen-us; MSNcOTH; MPLUS)
Mozilla/5.0 (compatible; Konqueror/3.2; OpenBSD) (KHTML, like Gecko)
Mozilla/5.0 (compatible; Konqueror/3.4; Linux) KHTML/3.4.0 (like Gecko)
Mozilla/5.0 (compatible; Konqueror/3.3; Linux; X11; i686; es, en_US) KHTML/3.3.2 (like Gecko)
+Mozilla/5.0 (Windows; U; Windows NT 5.1; de) AppleWebKit/522.13.1 (KHTML, like Gecko) Version/3.0.2 Safari/522.13.1
Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en) AppleWebKit/51 (like Gecko) Safari/51
Mozilla/4.0 (compatible; MSIE 5.12; Mac_PowerPC) OmniWeb/4.1.1-v424.6
Mozilla/4.5 (compatible; OmniWeb/4.1.1-v423; Mac_PowerPC)
Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en-US) AppleWebKit/85 (KHTML, like Gecko) OmniWeb/v540
Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en-US) AppleWebKit/125.4 (KHTML, like Gecko, Safari) OmniWeb/v563.51
Mozilla/5.0 (Macintosh; U; PPC Mac OS X; de-de) AppleWebKit/418 (KHTML, like Gecko) Shiira/1.2.2 Safari/125
+Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/525.13 (KHTML, like Gecko) Chrome/0.2.149.27 Safari/525.13
+Mozilla/5.0 (SymbianOS/9.4; U; Series60/5.0 Nokia5800d-1/21.0.025; Profile/MIDP-2.1 Configuration/CLDC-1.1 ) AppleWebKit/413 (KHTML, like Gecko) Safari/413
Mozilla/5.0 (SymbianOS/9.1; U; en-us) AppleWebKit/413 (KHTML, like Gecko) Safari/413
+Mozilla/5.0 (webOS/1.1; U; en-US) AppleWebKit/525.27.1 (KHTML, like Gecko) Version/1.0 Safari/525.27.1 Pre/1.0
+Midori/0.1.9 (X11; Linux i686; U; en-us) WebKit/532+
+Mozilla/5.0 (X11; U; Linux x86_64; cs-cz) AppleWebKit/531.2+ (KHTML, like Gecko) Safari/531.2+ Epiphany/2.27.91 SUSE/2.27.91-1.2
Opera/5.12 (Windows 2000; U) [de]
Mozilla/4.0 (compatible; MSIE 5.0; Windows XP) Opera 6.05 [ja]
Mozilla/4.0 (compatible; MSIE 6.0; X11; Linux i586) Opera 7.23 [en]
Mozilla/4.0 (compatible; MSIE 6.0; Mac_PowerPC Mac OS X; en) Opera 8.0
Opera/8.00 (Windows NT 5.1; U; en)
Opera/8.01 (X11; Linux i686; U; de)
+Opera/9.30 (Nintendo Wii; U; ; 3642; en)
Mozilla/5.0 (X11; Linux i686; U; en) Opera 8.01
+Mozilla/5.0 (Windows NT 5.2; U; cs; rv:1.8.0) Gecko/20060728 Firefox/1.5.0 Opera 9.20
Mozilla/4.0 (compatible; MSIE 5.0; Mac_PowerPC) Opera 6.0 [de]
+Mozilla/5.0 (X11; Linux i686; U) Opera 7.54 [de]
Mozilla/4.1 (compatible; MSIE 5.0; Symbian OS; Nokia 6600;423) Opera 6.10 [de]
Mozilla/4.0 (compatible; MSIE 6.0; Symbian OS; Nokia 6630/4.03.38; 6937) Opera 8.50 [es]
Mozilla/4.0 (compatible; MSIE 6.0; ; Linux armv5tejl; U) Opera 8.02 [en_US] Maemo browser 0.4.31 N770/SU-18
Opera/9.00 (Wii; U; ; 1038-58; Wii Shop Channel/1.0; en)
Opera/8.01 (J2ME/MIDP; Opera Mini/2.0.4509/1316; fi; U; ssr)
Opera/2.0.3920 (J2ME/MIDP; Opera Mini; en; U; ssr)
+Opera/9.60 (J2ME/MIDP; Opera Mini/4.2.14881Mod.by.Handler/960; U; en) Presto/2.2.0
Mozilla/4.75 [de] (Win98; U)
Mozilla/1.6 [en] (Windows NT 5.1; U)
Mozilla/1.0 (CP/M; 8-bit .NET)
Links (2.1pre14; FreeBSD 4.9-RELEASE i386; x)
Links (2.1pre15; CYGWIN_NT-5.0 1.3.1(0.38/3/2) i686; x)
Links (1.00pre12; Linux 2.6.10-grsec i686; 139x54) (Debian pkg 0.99+1.00pre12-1)
+Lynx/2.8.4rel.1 libwww-FM/2.14 SSL-MM/1.4.1 OpenSSL/0.9.6g
Mozilla/5.0 (compatible; iCab 2.9.8; Macintosh; U, PPC; Mac OS X)
iCab/2.9.8 (Macintosh; U; PPC)
Mozilla/4.5 (compatible; iCab 2.9.8; Macintosh; U; PPC)
-Lynx/2.8.4rel.1 libwww-FM/2.14 SSL-MM/1.4.1 OpenSSL/0.9.6g
+Evolution/2.26; Evolution-RSS/0.1.2
NCSA_Mosaic/2.0 (Windows 3.1)
NCSA_Mosaic/1.0 (X11; FreeBSD 1.2.0 i286) via proxy gateway CERN-HTTPD/1.0
NCSA Mosaic/2-7-6 (X11;OpenVMS V7.2 VAX)
LWP::Simple/5.79
PHP/4.2.3
w3m/0.5.1
+BlackBerry8120/4.3.0 Profile/MIDP-2.0 Configuration/CLDC-1.1 VendorID/135
SonyEricssonK700i/R2AE SEMC-Browser/4.0.3 Profile/MIDP-2.0 Configuration/CLDC-1.1 UP.Link/6.2.3.15.0 (Google WAP Proxy/1.0)
SonyEricssonT610/R201 Profile/MIDP-1.0 Configuration/CLDC-1.0 (Google WAP Proxy/1.0)
Nokia3510i/1.0 (04.01) Profile/MIDP-1.0 Configuration/CLDC-1.0 UP.Link/5.1.1.5a (Google WAP Proxy/1.0)
Nokia6630/1.0 (3.45.113) SymbianOS/8.0 Series60/2.6 Profile/MIDP-2.0 Configuration/CLDC-1.1 (Google WAP Proxy/1.0)
SIE-C60/12 UP.Browser/6.1.0.5.c.6 (GUI) MMP/1.0 (Google WAP Proxy/1.0)
OPWV-SDK/62 UP.Browser/6.2.2.1.208 (GUI) MMP/2.0
+Vodafone/1.0/LG-HB620T/V10a Browser/Obigo-Q05A/3.12 MMS/LG-MMS-V1.0/1.2 Java/ASVM/1.1 Profile/MIDP-2.1 Configuration/CLDC-1.1
Mozilla/4.0 (MobilePhone MM-8300/US/1.0) NetFront/3.1 MMP/2.0
-Mozilla/4.0 (MobilePhone SCP-5500/US/1.0) NetFront/3.0 MMP/2.0 FAKE (compatible; Googlebot/2.1; +http://www.google.com/bot.html)
Samsung-SPHA920 AU-MIC-A920/2.0 MMP/2.0
MOT-E398/0E.20.59R MIB/2.2.1 Profile/MIDP-2.0 Configuration/CLDC-1.0
Mozilla/4.0 (compatible; 240x320) IXI/Q05A2.4
Mozilla/4.0 (compatible; AvantGo 6.0; FreeBSD)
curl/7.7.2 (powerpc-apple-darwin6.0) libcurl 7.7.2 (OpenSSL 0.9.6b)
curl/7.10.6 (i386-redhat-linux-gnu) libcurl/7.10.6 OpenSSL/0.9.7a ipv6 zlib/1.2.0.7
+curl/7.19.3 (i586-pc-mingw32msvc) libcurl/7.19.3 zlib/1.2.3
amaya/8.3 libwww/5.4.0
Python-urllib/1.15
w3m/0.3.1
Mozilla/4.0 (compatible; BorderManager 3.0)
Mozilla/5.0 WebWasher 3.4
Mozilla/5.0 (SaferSurf) Firefox 1.5
+# feed readers:
+Akregator/1.5.1; syndication SUSE
+Bloglines/3.1 (http://www.bloglines.com; 1 subscriber)
+Liferea/1.7.1-svn (Linux; en_US.UTF-8; http://liferea.sf.net/)
+LiveJournal.com (webmaster@livejournal.com; for http://www.livejournal.com/users/kairo_at/; 1 readers)
+Feedfetcher-Google; (+http://www.google.com/feedfetcher.html; 1 subscribers; feed-id=1257454742140558029)
+FeedDemon/3.0 (http://www.feeddemon.com/; Microsoft Windows XP)
+FeedHub FeedDiscovery/1.0 (http://www.feedhub.com)
+FeedHub FeedFetcher/1.0 (http://www.feedhub.com)
+FeedHub MetaDataFetcher/1.0 (http://www.feedhub.com)
+Feed43 Proxy/1.0 (www.feed43.com) Feed4
+Mozilla/5.0 NewsFox/1.0.5.2
+NetNewsWire/3.2b28 (Mac OS X; http://www.newsgator.com/Individuals/NetNewsWire/)
+newsbeuter/0.9.1 (Linux 2.6.26-2-686; i686; http://synflood.at/newsbeuter.html) libcurl/7.18.2 GnuTLS/2.4.2 zlib/1.2.3.3 libidn/1.8
+NewsGator/2.0 Bot (http://www.newsgator.com)
+NewsGatorOnline/2.0 (http://www.newsgator.com; 2 subscribers)
+OutlookConnector/1.9 (TmstmpExt)
+rdfbot/1.0 (rdfbotsupport AT rediffmailpro DOT com)
+RssBandit/1.8.0.870 (.NET CLR 2.0.50727.3082; WinNT 5.1.2600 Service Pack 3; http://www.rssbandit.org)
+RSSOwl/2.0.0.200903042053 (Windows; U; en)
+The MultiZilla Feed Reader/Viewer
+UniversalFeedParser/4.2-pre-293-svn +http://feedparser.org/
+WordPress/2.7
+GreatNews/1.0
# search bots:
W3C_Validator/1.305.2.12 libwww-perl/5.64
Scooter/3.3
Spinne/2.0 med_AH
Vagabondo/2.0 MT (webagent at wise-guys dot nl)
TurnitinBot/1.5 ( ">http://www.turnitin.com/robot/crawlerinfo.html)
+TurnitinBot/2.1 (http://www.turnitin.com/robot/crawlerinfo.html)
FAST-WebCrawler/3.x Multimedia (mm dash crawler at fast dot no)
Firefly/1.0 (compatible; Mozilla 4.0; MSIE 5.5)
Googlebot/2.1 (+ ">http://www.googlebot.com/bot.html)
Googlebot (+http://www.google.com/bot.html)
+Googlebot-Image/1.0
Scrubby/2.2 ( ">http://www.scrubtheweb.com/)
psbot/0.1 (+ ">http://www.picsearch.com/bot.html)
NutchCVS/0.06-dev (Nutch; http://www.nutch.org/docs/en/bot.html; nutch-agent@lists.sourceforge.net)
Gigabot/2.0
Mediapartners-Google/2.1
Schmozilla/v9.14 Platinum
+Austronaut-URL-Checker/0.1 by ThScho
OmniExplorer_Bot/1.07 (+http://www.omni-explorer.com) Internet Categorizer
findlinks/0.926 (+http://wortschatz.uni-leipzig.de/findlinks/)
DataCha0s/2.0
Amfibibot/0.07 (Amfibi Robot; http://www.amfibi.com; agent@amfibi.com)
aipbot/1.0 (aipbot; http://www.aipbot.com; aipbot@aipbot.com)
+CoralWebPrx/0.1.20 (See http://coralcdn.org/)
+DoCoMo/1.0/N505i/c20/TB/W20H10 (compatible; RFCrawler-Mobile/1.0; +http://www.rfms.jp/crawler.html)
+ichiro/3.0 (http://help.goo.ne.jp/door/crawler.html)
+Jyxobot/1
+OOZBOT/0.20 ( http://www.setooz.com/oozbot.html ; agentname at setooz dot_com )
+Ocelli/1.4 (http://www.globalspec.com/Ocelli)
+SeznamBot/2.0 (+http://fulltext.sblog.cz/robot/)
+Sogou Video /3.0(+http://www.sogou.com/docs/help/webmasters.htm#07)
+Snapbot/1.0 (Snap Shots, +http://www.snap.com)
+Yandex/1.01.001 (compatible; Win16; I)
+Yeti/1.0 (NHN Corp.; http://help.naver.com/robots/)
+Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.2.1; aggregator:Spinn3r (Spinn3r 3.1); http://spinn3r.com/robot) Gecko/20021130
+Mozilla/5.0 (compatible; Butterfly/1.0; +http://labs.topsy.com/butterfly.html) Gecko/2009032608 Firefox/3.0.8
Mozilla/4.0 compatible ZyBorg/1.0 Daily Refresh Beta-d03 (wn.zyborg@looksmart.net;
Mozilla/2.0 (compatible; Ask Jeeves/Teoma)
Mozilla/5.0 (Slurp/si; slurp@inktomi.com; ">http://www.inktomi.com/slurp.html)
Mozilla/4.0 (compatible; Arachmo)
Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.)
Mozilla/5.0 (compatible; heritrix/1.12.0 +http://www.accelobot.com)
+Mozilla/5.0 (compatible; heritrix1-10-0;+http://www.webintegration.at)
Mozilla/2.0 compatible; Check&Get 1.14 (Windows NT)
Mozilla/3.0 (compatible; WebCapture 2.0; Auto; Windows)
Mozilla/3.0 (compatible; WebMon 1.0.11; Windows XP)
Mozilla/4.0 (compatible; Powermarks/3.5; Windows 95/98/2000/NT)
Mozilla/3.0 (compatible; Linkman)
+Mozilla/5.0 (compatible; arste.info_bot/1.1; +http://www.arste.info)
+Mozilla/5.0 (compatible; askpeter_bot/5.1; +http://www.askpeter.info)
+Mozilla/5.0 (compatible; Feedtrace-bot/0.2; bot@feedtrace.com)
Mozilla/5.0 (Sage)
Mozilla/5.0 (compatible; http://www.livedir.net)
Mozilla/4.0 (WebClipping.com)
Mozilla/5.0 (compatible; Yoono; http://www.yoono.com/)
Mozilla/3.0 (compatible; Indy Library)
Mozilla/5.0 (compatible; Google Desktop)
+Mozilla/5.0 (compatible; iCcrawler - iCjobs Stellenangebote Jobs; http://www.icjobs.de)
+Mozilla/5.0 (compatible; KaloogaBot; http://www.kalooga.com/info.html?page=crawler)
+Mozilla/5.0 (compatible; SecretSerachEngineLabs.com-SBSearch/0.9; http://www.secretsearchenginelabs.com/secret-web-crawler.php)
+Mozilla/5.0 (compatible; ScoutJet; +http://www.scoutjet.com/)
+Mozilla/5.0 (compatible; seexie.com_bot/4.1; +http://www.seexie.com)
+Mozilla/5.0 (compatible; Seznam screenshot-generator 2.0; +http://fulltext.sblog.cz/screenshot/)
+Mozilla/5.0 (compatible; TopBlogsInfo/2.0; +topblogsinfo@gmail.com)
+Mozilla/5.0 (compatible; Yahoo! SearchMonkey 1.0; http://developer.yahoo.com/searchmonkey/useragent)
+Mozilla/5.0 (compatible;archive.org_bot/1.7.0; Archive-It; +http://www.archive-it.org)
+Mozilla/5.0 (compatible;picmole/1.0 +http://www.picmole.com)
+Mozilla/5.0 (X11; compatible; crawler@newstin.com; HTTPClient 3.1)
+Mozilla/4.0 (MobilePhone SCP-5500/US/1.0) NetFront/3.0 MMP/2.0 FAKE (compatible; Googlebot/2.1; +http://www.google.com/bot.html)
+Nokia6681/1.0 (2.30.0) Series60/2.6 Profile/MIDP-2.0 Configuration/CLDC-1.1 (compatible; baiduspider; +http://www.baidu.com/search/spider.html)
+Nokia3650/1.0 SymbianOS/6.1 Series60/1.2 Profile/MIDP-1.0 Configuration/CLDC-1.0/ (compatible; YodaoBot-Mobile/1.0; http://www.youdao.com/help/webmaster/spider/; )
+NokiaN70/. FASTMobileCrawl/6.6 Profile/MIDP-2.0 Configuration/CLDC-1.1
+SAMSUNG-SGH-E250/1.0 Profile/MIDP-2.0 Configuration/CLDC-1.1 UP.Browser/6.2.3.3.c.1.101 (GUI) MMP/2.0 (compatible; Googlebot-Mobile/2.1; +http://www.google.com/bot.html)
PingALink Monitoring Services 1.0 (http://www.pingalink.com)
IlTrovatore-Setaccio (+ ">http://www.iltrovatore.it)
Mercator-2.0
appie 1.1 (www.walhello.com)
larbin_2.6.2 (larbin2.6.2@unspecified.mail)
OWR_Crawler 0.1
+ISC Systems iRc Search 2.1
+NASA Search 1.0
search.ch V1.4.2 (spiderman@search.ch;
WebFilter Robot 1.0
WWWeasel Robot v1.00 (http://wwweasel.de)
+Advista Crawler 2.02
+Yahoo Pipes 1.0
+DevCore Search Engine 0.0.4 http://devcore.eu.org/search/
+Firebat 2.9.1 (http://lms.virtual-presence.org)
+GiNDev/Nutch-0.9 (Germanistik im Netz; http://www.germanistik-im-netz.de/gin-www-search/gin-www-search-about.html; D dot Eichner at ub dot uni-frankfurt dot de)
+Nutch/Nutch-0.8.1 (Nutch; Nutch; Nutch)
+Iceweasel2.0.0.16/Nutch-1.0 (Webbrowser; http://iceweasel.com; info@iceweasel.com)
+nu_tch-princeton/Nu_tch-1.0-dev (princeton crawler for cass project; http://www.cs.princeton.edu/cass/; zhewang a_t cs ddot princeton dot edu)
+larbin_2.6.3 larbin2.6.3@unspecified.mail
2.0_AC-Plug - http://www.iOpus.com
Openfind data gatherer, Openbot/3.0+(robot-response@openfind.com.tw;+
+MSRBOT (http://research.microsoft.com/research/sv/msrbot)
+MLBot (www.metadatalabs.com/mlbot)
+ICCrawler - ICjobs (http://www.icjobs.de/bot.htm)
+ICC-Crawler/2.0 (Mozilla-compatible; ; http://kc.nict.go.jp/project1/crawl.html)
Baiduspider+(+http://www.baidu.com/search/spider.htm)
+BaiduImagespider+(+http://www.baidu.jp/spider/)
BaiDuSpider
+Sosospider+(+http://help.soso.com/webspider.htm)
+Sosoimagespider+(+http://help.soso.com/soso-image-spider.htm)
+Cityreview Robot (+http://www.cityreview.org/crawler/)
+Speedy Spider (http://www.entireweb.com/about/search_tech/speedy_spider/)
LinkWalker
+yacybot (amd64 Linux 2.6.28-15-generic; java 1.6.0_16; Europe/de) http://yacy.net/bot.html
+webcrawler (compatible; heritrix/1.14.3 ++http://www.onb.ac.at/about/webarchivierung.htm)
Internet Explorer 5.5
Mozilla/4.0 (compatible; B-l-i-t-z-B-O-T)
+LargeSmall Crawler (LargeSmall; http://onespot.com; info@onespot.com)
B l i t z B O T @ t r i c u s . n e t (Mozilla compatible)
sitecheck.internetseer.com (For more info see: ">http://sitecheck.internetseer.com)
-http://www.almaden.ibm.com/cs/crawler [c01]
+http://www.almaden.ibm.com/cs/crawler   [c01]
ia_archiver
+ia_archiver (+http://www.alexa.com/site/help/webmasters; crawler@alexa.com)
Nutch
NutchCVS
Mozilla
$wrapper->pgtop("KaiRo's Browser-Test");
+// set default time zone - right now, always the one the server is in!
+date_default_timezone_set('Europe/Vienna');
+
$httpvars = $util->getHTTPvars();
if (strlen($httpvars["ua"])) {
$ua = new userAgent($httpvars["ua"]);
print("<br>The operating system is reported as "<b>".$ua->getOS()."</b>"\n");
print("<br>The system platform is reported as "<b>".$ua->getPlatform()."</b>"\n");
print("<br>The browser language is reported as "<b>".$ua->getLanguage()."</b>"\n");
-if ($ua->hasEngine('gecko')) { print("<br>The Gecko date is reported as "<b>".$ua->getGeckoDate()."</b>"\n"); }
+if ($ua->hasEngine('gecko')) {
+ print("<br>The Gecko date is reported as "<b>".$ua->getGeckoDate()."</b>"\n");
+ print("<br>The full Gecko date/time is reported as "<b>".date('r',$ua->getGeckoTime())."</b>"\n");
+}
print("<br><br>I conclude this must be <b>".$ua->getBrand()." ".$ua->getVersion()."</b>\n");
print("<br>This is <b>".($ua->isBot()?"an":"no")."</b> automated robot.\n");