diff --git a/phpgwapi/inc/class.rssparser.inc.php b/phpgwapi/inc/class.rssparser.inc.php
index 936db5de5e..2546e41128 100644
--- a/phpgwapi/inc/class.rssparser.inc.php
+++ b/phpgwapi/inc/class.rssparser.inc.php
@@ -87,162 +87,188 @@
* This requires PHP's XML routines. You must configure PHP with --with-xml.
*/
+ function _rssparse_start_elem ($parser, $elem, $attrs)
+ {
+ switch($elem)
+ {
+ case 'CHANNEL':
+ $GLOBALS['_rss']->depth++;
+ $GLOBALS['_rss']->state[$GLOBALS['_rss']->depth] = 'channel';
+ $GLOBALS['_rss']->tmptitle[$GLOBALS['_rss']->depth] = '';
+ $GLOBALS['_rss']->tmplink[$GLOBALS['_rss']->depth] = '';
+ $GLOBALS['_rss']->tmpdesc[$GLOBALS['_rss']->depth] = '';
+ break;
+ case 'IMAGE':
+ $GLOBALS['_rss']->depth++;
+ $GLOBALS['_rss']->state[$GLOBALS['_rss']->depth] = 'image';
+ $GLOBALS['_rss']->tmptitle[$GLOBALS['_rss']->depth] = '';
+ $GLOBALS['_rss']->tmplink[$GLOBALS['_rss']->depth] = '';
+ $GLOBALS['_rss']->tmpdesc[$GLOBALS['_rss']->depth] = '';
+ $GLOBALS['_rss']->tmpurl[$GLOBALS['_rss']->depth] = '';
+ break;
+ case 'ITEM':
+ $GLOBALS['_rss']->depth++;
+ $GLOBALS['_rss']->state[$GLOBALS['_rss']->depth] = 'item';
+ $GLOBALS['_rss']->tmptitle[$GLOBALS['_rss']->depth] = '';
+ $GLOBALS['_rss']->tmplink[$GLOBALS['_rss']->depth] = '';
+ $GLOBALS['_rss']->tmpdesc[$GLOBALS['_rss']->depth] = '';
+ break;
+ case 'TITLE':
+ $GLOBALS['_rss']->depth++;
+ $GLOBALS['_rss']->state[$GLOBALS['_rss']->depth] = 'title';
+ break;
+ case 'LINK':
+ $GLOBALS['_rss']->depth++;
+ $GLOBALS['_rss']->state[$GLOBALS['_rss']->depth] = 'link';
+ break;
+ case 'DESCRIPTION':
+ $GLOBALS['_rss']->depth++;
+ $GLOBALS['_rss']->state[$GLOBALS['_rss']->depth] = 'desc';
+ break;
+ case 'URL':
+ $GLOBALS['_rss']->depth++;
+ $GLOBALS['_rss']->state[$GLOBALS['_rss']->depth] = 'url';
+ break;
+ }
+ }
-function _rssparse_start_elem ($parser, $elem, $attrs) {
- global $_rss;
+ function _rssparse_end_elem ($parser, $elem)
+ {
+ switch ($elem)
+ {
+ case 'CHANNEL':
+ $GLOBALS['_rss']->set_channel(
+ $GLOBALS['_rss']->tmptitle[$GLOBALS['_rss']->depth],
+ $GLOBALS['_rss']->tmplink[$GLOBALS['_rss']->depth],
+ $GLOBALS['_rss']->tmpdesc[$GLOBALS['_rss']->depth]
+ );
+ $GLOBALS['_rss']->depth--;
+ break;
+ case 'IMAGE':
+ $GLOBALS['_rss']->set_image(
+ $GLOBALS['_rss']->tmptitle[$GLOBALS['_rss']->depth],
+ $GLOBALS['_rss']->tmplink[$GLOBALS['_rss']->depth],
+ $GLOBALS['_rss']->tmpdesc[$GLOBALS['_rss']->depth],
+ $GLOBALS['_rss']->tmpurl[$GLOBALS['_rss']->depth]
+ );
+ $GLOBALS['_rss']->depth--;
+ break;
+ case 'ITEM':
+ $GLOBALS['_rss']->add_item(
+ $GLOBALS['_rss']->tmptitle[$GLOBALS['_rss']->depth],
+ $GLOBALS['_rss']->tmplink[$GLOBALS['_rss']->depth],
+ $GLOBALS['_rss']->tmpdesc[$GLOBALS['_rss']->depth]
+ );
+ $GLOBALS['_rss']->depth--;
+ break;
+ case 'TITLE':
+ $GLOBALS['_rss']->depth--;
+ break;
+ case 'LINK':
+ $GLOBALS['_rss']->depth--;
+ break;
+ case 'DESCRIPTION':
+ $GLOBALS['_rss']->depth--;
+ break;
+ case 'URL':
+ $GLOBALS['_rss']->depth--;
+ break;
+ }
+ }
- if ($elem == "CHANNEL") {
- $_rss->depth++;
- $_rss->state[$_rss->depth] = "channel";
- $_rss->tmptitle[$_rss->depth] = "";
- $_rss->tmplink[$_rss->depth] = "";
- $_rss->tmpdesc[$_rss->depth] = "";
- }
- else if ($elem == "IMAGE") {
- $_rss->depth++;
- $_rss->state[$_rss->depth] = "image";
- $_rss->tmptitle[$_rss->depth] = "";
- $_rss->tmplink[$_rss->depth] = "";
- $_rss->tmpdesc[$_rss->depth] = "";
- $_rss->tmpurl[$_rss->depth] = "";
- }
- else if ($elem == "ITEM") {
- $_rss->depth++;
- $_rss->state[$_rss->depth] = "item";
- $_rss->tmptitle[$_rss->depth] = "";
- $_rss->tmplink[$_rss->depth] = "";
- $_rss->tmpdesc[$_rss->depth] = "";
- }
- else if ($elem == "TITLE") {
- $_rss->depth++;
- $_rss->state[$_rss->depth] = "title";
- }
- else if ($elem == "LINK") {
- $_rss->depth++;
- $_rss->state[$_rss->depth] = "link";
- }
- else if ($elem == "DESCRIPTION") {
- $_rss->depth++;
- $_rss->state[$_rss->depth] = "desc";
- }
- else if ($elem == "URL") {
- $_rss->depth++;
- $_rss->state[$_rss->depth] = "url";
- }
-}
-
-function _rssparse_end_elem ($parser, $elem) {
- global $_rss;
+ function _rssparse_elem_data ($parser, $data)
+ {
+ switch ($GLOBALS['_rss']->state[$GLOBALS['_rss']->depth])
+ {
+ case 'title':
+ $GLOBALS['_rss']->tmptitle[($GLOBALS['_rss']->depth - 1)] .= $data;
+ break;
+ case 'link';
+ $GLOBALS['_rss']->tmplink[($GLOBALS['_rss']->depth - 1)] .= $data;
+ break;
+ case 'desc':
+ $GLOBALS['_rss']->tmpdesc[($GLOBALS['_rss']->depth - 1)] .= $data;
+ break;
+ case 'url':
+ $GLOBALS['_rss']->tmpurl[($GLOBALS['_rss']->depth - 1)] .= $data;
+ break;
+ }
+ }
- if ($elem == "CHANNEL") {
- $_rss->set_channel($_rss->tmptitle[$_rss->depth], $_rss->tmplink[$_rss->depth], $_rss->tmpdesc[$_rss->depth]);
- $_rss->depth--;
- }
- else if ($elem == "IMAGE") {
- $_rss->set_image($_rss->tmptitle[$_rss->depth], $_rss->tmplink[$_rss->depth], $_rss->tmpdesc[$_rss->depth], $_rss->tmpurl[$_rss->depth]);
- $_rss->depth--;
- }
- else if ($elem == "ITEM") {
- $_rss->add_item($_rss->tmptitle[$_rss->depth], $_rss->tmplink[$_rss->depth], $_rss->tmpdesc[$_rss->depth]);
- $_rss->depth--;
- }
- else if ($elem == "TITLE") {
- $_rss->depth--;
- }
- else if ($elem == "LINK") {
- $_rss->depth--;
- }
- else if ($elem == "DESCRIPTION") {
- $_rss->depth--;
- }
- else if ($elem == "URL") {
- $_rss->depth--;
- }
-}
-
-function _rssparse_elem_data ($parser, $data) {
- global $_rss;
+ class rssparser
+ {
+ var $title;
+ var $link;
+ var $desc;
+ var $items = array();
+ var $nitems;
+ var $image = array();
+ var $state = array();
+ var $tmptitle = array();
+ var $tmplink = array();
+ var $tmpdesc = array();
+ var $tmpurl = array();
+ var $depth;
- if ($_rss->state[$_rss->depth] == "title") {
- $_rss->tmptitle[($_rss->depth - 1)] .= $data;
- }
- else if ($_rss->state[$_rss->depth] == "link") {
- $_rss->tmplink[($_rss->depth - 1)] .= $data;
- }
- else if ($_rss->state[$_rss->depth] == "desc") {
- $_rss->tmpdesc[($_rss->depth - 1)] .= $data;
- }
- else if ($_rss->state[$_rss->depth] == "url") {
- $_rss->tmpurl[($_rss->depth - 1)] .= $data;
- }
-}
+ function rssparser()
+ {
+ $this->nitems = 0;
+ $this->depth = 0;
+ }
-class rssparser {
- var $title;
- var $link;
- var $desc;
- var $items = array();
- var $nitems;
- var $image = array();
- var $state = array();
- var $tmptitle = array();
- var $tmplink = array();
- var $tmpdesc = array();
- var $tmpurl = array();
- var $depth;
+ function set_channel($in_title, $in_link, $in_desc)
+ {
+ $this->title = $in_title;
+ $this->link = $in_link;
+ $this->desc = $in_desc;
+ }
- function rssparser() {
- $this->nitems = 0;
- $this->depth = 0;
- }
+ function set_image($in_title, $in_link, $in_desc, $in_url)
+ {
+ $this->image['title'] = $in_title;
+ $this->image['link'] = $in_link;
+ $this->image['desc'] = $in_desc;
+ $this->image['url'] = $in_url;
+ }
- function set_channel($in_title, $in_link, $in_desc) {
- $this->title = $in_title;
- $this->link = $in_link;
- $this->desc = $in_desc;
- }
+ function add_item($in_title, $in_link, $in_desc)
+ {
+ $this->items[$this->nitems]['title'] = $in_title;
+ $this->items[$this->nitems]['link'] = $in_link;
+ $this->items[$this->nitems]['desc'] = $in_desc;
+ $this->nitems++;
+ }
- function set_image($in_title, $in_link, $in_desc, $in_url) {
- $this->image["title"] = $in_title;
- $this->image["link"] = $in_link;
- $this->image["desc"] = $in_desc;
- $this->image["url"] = $in_url;
- }
+ function parse($fp)
+ {
+ $xml_parser = xml_parser_create();
- function add_item($in_title, $in_link, $in_desc) {
- $this->items[$this->nitems]["title"] = $in_title;
- $this->items[$this->nitems]["link"] = $in_link;
- $this->items[$this->nitems]["desc"] = $in_desc;
- $this->nitems++;
- }
+ xml_set_element_handler($xml_parser, '_rssparse_start_elem', '_rssparse_end_elem');
+ xml_set_character_data_handler($xml_parser, '_rssparse_elem_data');
- function parse($fp) {
- $xml_parser = xml_parser_create();
-
- xml_set_element_handler($xml_parser, "_rssparse_start_elem", "_rssparse_end_elem");
- xml_set_character_data_handler($xml_parser, "_rssparse_elem_data");
-
- while ($data = fread($fp, 4096)) {
- if (!xml_parse($xml_parser, $data, feof($fp))) {
- return 1;
- }
- }
-
- xml_parser_free($xml_parser);
-
- return 0;
- }
-}
+ while ($data = fread($fp, 4096))
+ {
+ if (!xml_parse($xml_parser, $data, feof($fp)))
+ {
+ return 1;
+ }
+ }
-function rssparse ($fp) {
- global $_rss;
+ xml_parser_free($xml_parser);
- $_rss = new rssparser();
+ return 0;
+ }
+ }
- if ($_rss->parse($fp)) {
- return 0;
- }
-
- return $_rss;
-}
-?>
\ No newline at end of file
+ function rssparse ($fp)
+ {
+ $GLOBALS['_rss'] = new rssparser();
+
+ if ($GLOBALS['_rss']->parse($fp))
+ {
+ return 0;
+ }
+
+ return $GLOBALS['_rss'];
+ }
+?>
diff --git a/phpgwapi/inc/class.utilities.inc.php b/phpgwapi/inc/class.utilities.inc.php
index 1e569ec4d7..26b1fb61d2 100644
--- a/phpgwapi/inc/class.utilities.inc.php
+++ b/phpgwapi/inc/class.utilities.inc.php
@@ -23,29 +23,31 @@
/* $Id$ */
- $d1 = strtolower(substr($phpgw_info["server"]["api_inc"],0,3));
- if($d1 == "htt" || $d1 == "ftp") {
- echo "Failed attempt to break in via an old Security Hole!
\n";
- exit;
- } unset($d1);
+ $d1 = strtolower(substr(PHPGW_API_INC,0,3));
+ if($d1 == 'htt' || $d1 == 'ftp')
+ {
+ echo 'Failed attempt to break in via an old Security Hole!
' . "\n";
+ exit;
+ }
+ unset($d1);
- class utilities
- {
- var $rssparser;
- var $clientsniffer;
- var $http;
- var $matrixview;
- var $menutree;
- var $sbox;
+ class utilities
+ {
+ var $rssparser;
+ var $clientsniffer;
+ var $http;
+ var $matrixview;
+ var $menutree;
+ var $sbox;
- function utilities_()
- {
-// $phpgw->rssparser = CreateObject("phpgwapi.rssparser");
-// $phpgw->clientsniffer = CreateObject("phpgwapi.clientsniffer");
-// $phpgw->http = CreateObject("phpgwapi.http");
- // $phpgw->matrixview = CreateObject("phpgwapi.matrixview");
- // $phpgw->menutree = CreateObject("phpgwapi.menutree");
- $phpgw->sbox = CreateObject("phpgwapi.portalbox");
- }
- }
+ function utilities_()
+ {
+ // $GLOBALS['phpgw']->rssparser = CreateObject("phpgwapi.rssparser");
+ // $GLOBALS['phpgw']->clientsniffer = CreateObject("phpgwapi.clientsniffer");
+ // $GLOBALS['phpgw']->http = CreateObject("phpgwapi.http");
+ // $GLOBALS['phpgw']->matrixview = CreateObject("phpgwapi.matrixview");
+ // $GLOBALS['phpgw']->menutree = CreateObject("phpgwapi.menutree");
+ $GLOBALS['phpgw']->sbox = CreateObject('phpgwapi.portalbox');
+ }
+ }
?>