Ejemplo n.º 1
0
function appendNewsNodeItems($newsNode, $newsitem)
{
    global $doc, $root;
    appendAttribute($doc, $newsNode, 'url', $newsitem['url']);
    appendAttribute($doc, $newsNode, 'id', $newsitem['id']);
    $sectionNode = appendElement($doc, $newsNode, 'section');
    appendTextNode($doc, $sectionNode, $newsitem['section']);
    $headlineNode = appendElement($doc, $newsNode, 'headline');
    appendTextNode($doc, $headlineNode, urldecode($newsitem['headline']));
    $summaryNode = appendElement($doc, $newsNode, 'summary');
    appendTextNode($doc, $summaryNode, urldecode($newsitem['summary']));
    $byNode = appendElement($doc, $newsNode, 'byline');
    appendTextNode($doc, $byNode, $newsitem['byline']);
    $updatedNode = appendElement($doc, $newsNode, 'updatedTime');
    appendTextNode($doc, $updatedNode, $newsitem['updatedTime']);
    $createdNode = appendElement($doc, $newsNode, 'createdTime');
    appendTextNode($doc, $createdNode, $newsitem['createdTime']);
    $pubNode = appendElement($doc, $newsNode, 'pubDate');
    appendTextNode($doc, $pubNode, $newsitem['pubDate']);
}
Ejemplo n.º 2
0
    while ($dbRow = $dbResult->fetch(PDO::FETCH_ASSOC)) {
        if ($firstRow) {
            $firstRow = false;
        } else {
            $maxIdList .= ", ";
        }
        $maxIdList .= $dbRow["max"];
    }
    $sql = "SELECT * FROM cl_callers " . "WHERE id IN (" . $maxIdList . ")" . "AND line <= {$numLines} " . "ORDER BY line";
} else {
    if ($allCallers) {
        $sql = "SELECT * FROM cl_callers " . "WHERE line <= {$numLines} " . "ORDER BY id DESC " . "LIMIT 100";
    } else {
        $sql = "SELECT * FROM cl_callers " . "WHERE online = 1 " . "  AND line <= {$numLines} " . "ORDER BY priority, id";
    }
}
clLog($sql);
$dbResult = $dbConn->query($sql);
while ($dbRow = $dbResult->fetch(PDO::FETCH_ASSOC)) {
    $callerEl = $respXML->createElement("caller");
    $callersEl->appendChild($callerEl);
    appendTextNode($respXML, $callerEl, "id", $dbRow["id"]);
    appendTextNode($respXML, $callerEl, "line", $dbRow["line"]);
    appendTextNode($respXML, $callerEl, "time", $dbRow["time"]);
    appendTextNode($respXML, $callerEl, "priority", $dbRow["priority"]);
    appendTextNode($respXML, $callerEl, "online", $dbRow["online"]);
    appendTextNode($respXML, $callerEl, "name", $dbRow["name"]);
    appendTextNode($respXML, $callerEl, "topic", $dbRow["topic"]);
}
$dbResult->closeCursor();
echo $respXML->saveXML();