コード例 #1
0
ファイル: sourlib.php プロジェクト: ultramookie/sour-reader
function showFeed($feedid, $action = "unread", $catid = 0)
{
    if (preg_match("/^read\$/", $action)) {
        $pullstatus = " status='N' or status='R' ";
    } else {
        $pullstatus = " status='N' ";
    }
    if (preg_match("/^all\$/", $feedid)) {
        $query = "select id, title, date_format(pubDate, '%H:%i') as time, date_format(pubDate, '%m%d%y') as date from main where {$pullstatus} order by pubDate DESC";
        $feedname = "all";
    } elseif (preg_match("/^saved\$/", $feedid)) {
        $query = "select id, title, date_format(pubDate, '%H:%i') as time, date_format(pubDate, '%m%d%y') as date from main where status='S' order by pubDate DESC";
        $feedname = "saved";
    } elseif (preg_match("/^category\$/", $feedid)) {
        $query = "select catname from categories where catid='{$catid}'";
        $result = mysql_query($query);
        $row = mysql_fetch_array($result);
        $catname = $row['catname'];
        $query = "select id, title, date_format(pubDate, '%H:%i') as time, date_format(pubDate, '%m.%d.%y') as date from main,feeds,categories where feeds.feedcat='{$catid}' and main.status='N' and categories.catid='{$catid}' and feeds.feedid=main.feedid order by pubDate DESC";
        $feedname = "{$catname}";
    } else {
        $query = "select id, title, date_format(pubDate, '%H:%i') as time, date_format(pubDate, '%m.%d.%y') as date from main where feedid='{$feedid}' and ({$pullstatus}) order by pubDate DESC";
        $fnquery = "select feedname from feeds where feedid='{$feedid}'";
        $fnresult = mysql_query($fnquery);
        $fnrow = mysql_fetch_array($fnresult);
        $feedname = $fnrow['feedname'];
    }
    $result = mysql_query($query);
    $lightdark = "containerlight";
    echo "<h2 class=\"feedname\">{$feedname}</h2>";
    while ($row = mysql_fetch_array($result)) {
        $id = $row['id'];
        $title = $row['title'];
        $time = $row['time'];
        $date = $row['date'];
        if (preg_match("/^containerlight\$/", $lightdark)) {
            $lightdark = "containerdark";
        } else {
            $lightdark = "containerlight";
        }
        if ($catid > 0) {
            $realfeedid = getFeedID($id);
            $realfeedname = getFeedName($realfeedid);
            $title = $title . " [ <i>" . $realfeedname . "</i> ] ";
        }
        print "<div class=\"{$lightdark}\"><div class=\"left-element\"><a href=\"showentry.php?id={$id}&catid={$catid}\">{$title}</a></div><div class=\"right-element\">{$time} &#149; {$date}</div></div>";
    }
}
コード例 #2
0
ファイル: feed.php プロジェクト: haxelsson/emoncms
 function view_processList($input, $inputProcessList)
 {
     $out = "<table class='catlist'><tr><th>Order</th><th>Process</th><th>Arg</th><th>Actions:</th></tr>";
     $i = 0;
     if ($inputProcessList) {
         foreach ($inputProcessList as $inputProcess) {
             $processid = $inputProcess[0];
             // Process id
             $argA = $inputProcess[1];
             if ($processid == 1) {
                 $processDescription = "Log to feed: ";
                 $argA = getFeedName($argA);
             }
             if ($processid == 2) {
                 $processDescription = "x ";
             }
             if ($processid == 3) {
                 $processDescription = "+ ";
             }
             if ($processid == 4) {
                 $processDescription = "Power to kWh: ";
                 $argA = getFeedName($argA);
             }
             if ($processid == 5) {
                 $processDescription = "to kWhd: ";
                 $argA = getFeedName($argA);
             }
             if ($processid == 6) {
                 $processDescription = "x input: ";
                 $argA = getInputName($argA);
             }
             if ($processid == 7) {
                 $processDescription = "count on time/day: ";
                 $argA = getInputName($argA);
             }
             if ($processid == 8) {
                 $processDescription = "kwhinc to kWhd: ";
                 $argA = getFeedName($argA);
             }
             $i++;
             $out .= "<tr class='d" . ($i & 1) . "' >";
             $out .= "<td>" . $i . "</td><td>" . $processDescription . "</td><td>" . $argA . "</td>";
             $out .= "<td><button type='button'>Edit</button><button type='button'>Del</button></td></tr>";
         }
     }
     $out .= '<tr><td>New</td><td>
     <form action="view" method="post">
     <input type="hidden" name="form" value="2">
     <input type="hidden" name="input" value="' . $input . '">
     <select class="processSelect" name="sel">
     <option value="1">log</option>
     <option value="2">x</option>
     <option value="3">+</option>
     <option value="4">Power to kWh</option>
     <option value="5">Power to kWh/d</option>
     <option value="6">x input</option>
     <option value="7">count on time</option>
     <option value="8">kwhinc2kwhd</option>
     </select></td>
     <td><input type="text" name="arg" class="processBox" style="width:100px;" /></td>
     <td><input type="submit" value="add" /></form</td>
     </tr></table>';
     return $out;
 }