[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Phpgroupware-cvs] phpsysinfo/includes XPath.class.php, NONE, 1.1.2.1 co
From: |
Dave Hall <address@hidden> |
Subject: |
[Phpgroupware-cvs] phpsysinfo/includes XPath.class.php, NONE, 1.1.2.1 common_functions.php, NONE, 1.1.2.1 system_footer.php, 1.1.1.1, 1.1.1.1.4.1 system_header.php, 1.1.1.1, 1.1.1.1.4.1 class.Template.inc.php, 1.1.1.1, NONE |
Date: |
Sat, 01 Nov 2003 22:08:29 +0000 |
Update of /cvsroot/phpgroupware/phpsysinfo/includes
In directory subversions:/tmp/cvs-serv22972/includes
Modified Files:
Tag: Version-0_9_16-branch
system_footer.php system_header.php
Added Files:
Tag: Version-0_9_16-branch
XPath.class.php common_functions.php
Removed Files:
Tag: Version-0_9_16-branch
class.Template.inc.php
Log Message:
upstream update with a few little mods
--- NEW FILE: common_functions.php ---
<?php
//
// phpSysInfo - A PHP System Information Script
// http://phpsysinfo.sourceforge.net/
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
//
// $Id: common_functions.php,v 1.1.2.1 2003/11/01 22:08:27 skwashd Exp $
// HTML/XML Comment
function created_by () {
global $VERSION;
return "<!--\n\tCreated By: phpSysInfo -
$VERSION\n\thttp://phpsysinfo.sourceforge.net/\n-->\n\n";
}
// So that stupid warnings do not appear when we stats files that do not exist.
error_reporting(5);
// print out the bar graph
function create_bargraph ($percent, $a, $b, $type = "") {
if ($percent == 0) {
return '<img height="' . BAR_HEIGHT . '" src="templates/' .
TEMPLATE_SET . '/images/bar_left.gif" alt="">'
. '<img src="templates/' . TEMPLATE_SET .
'/images/bar_middle.gif" height="' . BAR_HEIGHT . '" width="1" alt="">'
. '<img src="templates/' . TEMPLATE_SET . '/images/bar_right.gif"
height="' . BAR_HEIGHT . '" alt="">';
} else if (($percent < 90) || ($type == "iso9660")) {
return '<img height="' . BAR_HEIGHT . '" src="templates/' .
TEMPLATE_SET . '/images/bar_left.gif" alt="">'
. '<img src="templates/' . TEMPLATE_SET .
'/images/bar_middle.gif" height="' . BAR_HEIGHT . '" width="' . ($a * $b) . '"
alt="">'
. '<img height="' . BAR_HEIGHT . '" src="templates/' .
TEMPLATE_SET . '/images/bar_right.gif" alt="">';
} else {
return '<img height="' . BAR_HEIGHT . '" src="templates/' .
TEMPLATE_SET . '/images/redbar_left.gif" alt="">'
. '<img src="templates/' . TEMPLATE_SET .
'/images/redbar_middle.gif" height="' . BAR_HEIGHT . '" width="' . ($a * $b) .
'" alt="">'
. '<img height="' . BAR_HEIGHT . '" src="templates/' .
TEMPLATE_SET . '/images/redbar_right.gif" alt="">';
}
}
// Find a system program. Do path checking
function find_program ($program) {
$path = array('/bin', '/sbin', '/usr/bin', '/usr/sbin', '/usr/local/bin',
'/usr/local/sbin');
while ($this_path = current($path)) {
if (is_executable("$this_path/$program")) {
return "$this_path/$program";
}
next($path);
}
return;
}
// Execute a system program. return a trim()'d result.
// does very crude pipe checking. you need ' | ' for it to work
// ie $program = execute_program('netstat', '-anp | grep LIST');
// NOT $program = execute_program('netstat', '-anp|grep LIST');
function execute_program ($program, $args = '') {
$buffer = '';
$program = find_program($program);
if (!$program) { return; }
// see if we've gotten a |, if we have we need to do patch checking on the
cmd
if ($args) {
$args_list = split(' ', $args);
for ($i = 0; $i < count($args_list); $i++) {
if ($args_list[$i] == '|') {
$cmd = $args_list[$i + 1];
$new_cmd = find_program($cmd);
$args = ereg_replace("\| $cmd", "| $new_cmd", $args);
}
}
}
// we've finally got a good cmd line.. execute it
if ($fp = popen("$program $args", 'r')) {
while (!feof($fp)) {
$buffer .= fgets($fp, 4096);
}
return trim($buffer);
}
}
// A helper function, when passed a number representing KB,
// and optionally the number of decimal places required,
// it returns a formated number string, with unit identifier.
function format_bytesize ($kbytes, $dec_places = 2) {
global $text;
$spacer = ' ';
if ($kbytes > 1048576) {
$result = sprintf('%.' . $dec_places . 'f', $kbytes / 1048576);
$result .= $spacer.$text['gb'];
} elseif ($kbytes > 1024) {
$result = sprintf('%.' . $dec_places . 'f', $kbytes / 1024);
$result .= $spacer.$text['mb'];
} else {
$result = sprintf('%.' . $dec_places . 'f', $kbytes);
$result .= $spacer.$text['kb'];
}
return $result;
}
?>
Index: system_header.php
===================================================================
RCS file: /cvsroot/phpgroupware/phpsysinfo/includes/system_header.php,v
retrieving revision 1.1.1.1
retrieving revision 1.1.1.1.4.1
diff -C2 -d -r1.1.1.1 -r1.1.1.1.4.1
*** system_header.php 17 Jun 2001 17:56:54 -0000 1.1.1.1
--- system_header.php 1 Nov 2003 22:08:27 -0000 1.1.1.1.4.1
***************
*** 22,50 ****
header("Cache-Control: no-cache, must-revalidate");
if (!isset($charset)) { $charset='iso-8859-1'; }
! header('Content-Type: text/html; charset='.$charset);
! ?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
- <head>
- <title><?php echo $text['title']; ?></title>
-
<?php
! if (isset($refresh) && ($refresh = intval($refresh))) {
! echo "\t<meta http-equiv=\"Refresh\" content=\"$refresh\">\n";
! }
?>
! <style type="text/css">
! a {text-decoration: none;}
! </style>
<?php
if (file_exists("templates/$template/$template.css")) {
! echo '<link rel="STYLESHEET" type="text/css" href="templates/';
! echo $template.'/'.$template;
! echo '.css">'."\n";
}
?>
--- 22,54 ----
header("Cache-Control: no-cache, must-revalidate");
if (!isset($charset)) { $charset='iso-8859-1'; }
! header('Content-Type: text/html; charset=' . $charset);
! // our text direction (for hebrew)
! if (!$text_dir) {
! $text_dir = 'ltr';
! }
+ // timestamp
+ $timestamp = strftime ("%b %d %Y %H:%M:%S", time());
+
+ ?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<?php
! echo created_by();
?>
! <head>
! <title><?php echo $text['title']; echo " -- ($timestamp)"; ?></title>
<?php
+ if (isset($refresh) && ($refresh = intval($refresh))) {
+ echo " <meta http-equiv=\"Refresh\" content=\"$refresh\">\n";
+ }
if (file_exists("templates/$template/$template.css")) {
! echo ' <link rel="STYLESHEET" type="text/css" href="templates/';
! echo $template . '/' . $template;
! echo ".css\">";
}
?>
***************
*** 52,76 ****
</head>
! <?php
! echo '<body';
!
! if (isset($bgcolor)) {
! echo ' bgcolor="' . $bgcolor . '"';
! } else {
! echo ' bgcolor="#ffffff"';
! }
!
! if (isset($fontcolor)) {
! echo ' text="' . $fontcolor . '"';
! }
!
! if (isset($linkcolor)) {
! echo ' link="' . $linkcolor . '"';
! }
!
! if (isset($vlinkcolor)) {
! echo ' vlink="' . $vlinkcolor . '"';
! }
!
! echo ">\n";
?>
--- 56,64 ----
</head>
! <?php
! if (file_exists("templates/$template/images/$template" . "_background.gif")) {
! echo '<body background="templates/' . $template . '/images/' . $template .
'_background.gif" dir="' . $text_dir . '">';
! } else {
! echo "<body dir=$text_dir>";
! }
?>
--- class.Template.inc.php DELETED ---
--- NEW FILE: XPath.class.php ---
<?php
/**
* Php.XPath
*
*
+======================================================================================================+
* | A php class for searching an XML document using XPath, and making
modifications using a DOM
* | style API. Does not require the DOM XML PHP library.
* |
*
+======================================================================================================+
* | What Is XPath:
* | --------------
* | - "What SQL is for a rational database, XPath is for an XML document." --
Sam Blum
* | - "The primary purpose of XPath is to address parts of an XML document. In
support of this
* | primary purpose, it also provides basic facilities for manipulting it."
-- W3C
* |
* | XPath in action and a very nice intro is under:
* | http://www.zvon.org/xxl/XPathTutorial/General/examples.html
* | Specs Can be found under:
* | http://www.w3.org/TR/xpath W3C XPath Recommendation
[...4710 lines suppressed...]
_title("Insert some additional XML below <AAA>:");
$xPath->reindexNodeTree();
$xPath->insertChild('/AAA[1]/BBB[1]', '<BB> Step 1. Insert new node </BB>',
$shiftRight=TRUE, $afterText=TRUE);
$xPath->insertChild('/AAA[1]/BBB[1]', '<BB> Step 2. Insert new node </BB>',
$shiftRight=FALSE, $afterText=TRUE);
$xPath->insertChild('/AAA[1]/BBB[1]', '<BB> Step 3. Insert new node </BB>',
$shiftRight=FALSE, $afterText=FALSE);
echo $xPath->exportAsHtml();
_title("Replace the last <BB> node with new XML:");
$xPath->reindexNodeTree();
$xPath->replaceChild('/AAA[1]/BB[last()]', '<DDD> Replaced last BB </DDD>',
$afterText=FALSE);
echo $xPath->exportAsHtml();
_title("Replace second <BB> node with normal text");
$xPath->reindexNodeTree();
$xPath->replaceChildByData('/AAA[1]/BB[2]', '"Some new text"',
$afterText=FALSE);
echo $xPath->exportAsHtml();
}
?>
Index: system_footer.php
===================================================================
RCS file: /cvsroot/phpgroupware/phpsysinfo/includes/system_footer.php,v
retrieving revision 1.1.1.1
retrieving revision 1.1.1.1.4.1
diff -C2 -d -r1.1.1.1 -r1.1.1.1.4.1
*** system_footer.php 17 Jun 2001 17:56:54 -0000 1.1.1.1
--- system_footer.php 1 Nov 2003 22:08:27 -0000 1.1.1.1.4.1
***************
*** 27,40 ****
$dir = opendir('templates/');
! while (($file = readdir($dir))!==false) {
if ($file != 'CVS' && $file != '.' && $file != '..') {
! if ($template == $file) {
! $update_form .= "\t\t<option value=\"$file\"
SELECTED>$file</option>\n";
! } else {
! $update_form .= "\t\t<option value=\"$file\">$file</option>\n";
}
}
}
closedir($dir);
$update_form .= "\t</select>\n";
--- 27,48 ----
$dir = opendir('templates/');
! while (($file = readdir($dir))!=false) {
if ($file != 'CVS' && $file != '.' && $file != '..') {
! $update_form .= "\t\t<option value=\"$file\"";
! if ($template == $file && !$random) {
! $update_form .= " SELECTED";
}
+ $update_form .= ">$file</option>\n";
}
}
closedir($dir);
+
+ // auto select the random template, if we're set to random
+ $update_form .= "\t\t<option value=\"random\"";
+ if ($random) {
+ $update_form .= " SELECTED";
+ }
+ $update_form .= ">random</option>\n";
+
$update_form .= "\t</select>\n";
***************
*** 44,48 ****
$dir = opendir('includes/lang/');
! while (($file = readdir($dir))!==false) {
if ($file != 'CVS' && $file != '.' && $file != '..') {
$file = ereg_replace('.php', '', $file);
--- 52,56 ----
$dir = opendir('includes/lang/');
! while (($file = readdir($dir)) != false) {
if ($file != 'CVS' && $file != '.' && $file != '..') {
$file = ereg_replace('.php', '', $file);
***************
*** 58,62 ****
$update_form .= "\t</select>\n"
! . "\t<input type=\"submit\" value=\"" . $text['submit']."\">\n"
. "</form>\n";
--- 66,70 ----
$update_form .= "\t</select>\n"
! . "\t<input type=\"submit\" value=\"" . $text['submit'] .
"\">\n"
. "</form>\n";
***************
*** 67,71 ****
<hr>
! <?echo $text['created']?> <a
href="http://phpsysinfo.sourceforge.net">phpSysInfo 1.7</a>
</body>
</html>
--- 75,79 ----
<hr>
! <?php echo $text['created']; ?> <a
href="http://phpsysinfo.sourceforge.net">phpSysInfo - <?php echo $VERSION ?></a>
</body>
</html>
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Phpgroupware-cvs] phpsysinfo/includes XPath.class.php, NONE, 1.1.2.1 common_functions.php, NONE, 1.1.2.1 system_footer.php, 1.1.1.1, 1.1.1.1.4.1 system_header.php, 1.1.1.1, 1.1.1.1.4.1 class.Template.inc.php, 1.1.1.1, NONE,
Dave Hall <address@hidden> <=