if ($type != "g") { $result = mysql_query("select ID from feed where '" . mysql_real_escape_string($type) . "' REGEXP code and status = 1"); $feedid = -1; while ($row = mysql_fetch_assoc($result)) { $feedid = $row["id"]; } $result = mysql_query("select * from item inner join feed on feed.ID = item.feedID inner join access on access.guid = '" . mysql_real_escape_string($uid) . "' where " . $reqstr . " and item.feedid = '" . mysql_real_escape_string($feedid) . "'"); } else { $result = mysql_query("select * from item inner join feed on feed.ID = item.feedID inner join access on access.guid = '" . mysql_real_escape_string($uid) . "' and role=2 where feed.name = 'gid' and " . $reqstr); } // // build metadata about the item(s) // $ret = "<items>"; while ($row = mysql_fetch_assoc($result)) { $ret .= "<item reqid=\"" . $row["reqid"] . "\" link=\"" . cleanXML($row["link"]) . "\" date=\"" . $row["pubdate"] . "\" title=\"" . cleanXML($row["title"]) . "\" />\n"; } $ret .= "</items>"; // // output xml // header("Content-type: text/xml"); echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"; echo $ret; die; function cleanXML($strin) { $strout = null; for ($i = 0; $i < strlen($strin); $i++) { $ord = ord($strin[$i]); if ($ord > 0 && $ord < 32 || $ord >= 127) {
} else { $result = mysql_query("select * from item inner join feed on feed.ID = item.feedID inner join access on access.guid = '".mysql_real_escape_string($uid)."' and role=2 where feed.name = 'gid' and ".$reqstr); } */ } // // build metadata about the item(s) // $ret = "<items>\n"; if ($result) { while ($row = mysql_fetch_assoc($result)) { $custom1 = isset($row["custom1"]) && $row["custom1"] != "" ? " custom1=\"" . cleanXML($row["custom1"]) . "\"" : ""; $custom2 = isset($row["custom2"]) && $row["custom2"] != "" ? " custom2=\"" . cleanXML($row["custom2"]) . "\"" : ""; $custom3 = isset($row["custom3"]) && $row["custom3"] != "" ? " custom3=\"" . cleanXML($row["custom3"]) . "\"" : ""; $ret .= "<item reqid=\"" . $row["reqid"] . "\" link=\"" . cleanXML($row["link"]) . "\" date=\"" . gmdate(DATE_RSS, strtotime($row["pubdate"])) . "\" title=\"" . cleanXML($row["title"]) . "\"" . $custom1 . $custom2 . $custom3 . " />\n"; } } $ret .= "</items>"; // // output xml // header("Content-type: text/xml"); echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"; echo $ret; die; function cleanXML($strin) { $strout = null; for ($i = 0; $i < strlen($strin); $i++) { $ord = ord($strin[$i]);