Exemple #1
0
function content_element_handler($ns_url, $prefix, $elt_name, &$attrs, &$children, &$retval, &$context)
{
    $parent = $context[count($context) - 1]['name'];
    switch ($elt_name) {
        case "encoded":
            /* In practice, only RSS files[1] use the Content
             * module (since Atom already has a <content>
             * element), so we'll just set the parent's 'content'.
             *
             * [1] So does RDF, actually, but it's specially
             * crafted to look like RSS.
             */
            // XXX - Make sure $chldren is a string?
            # Clean up HTML
            run_hooks("clean-html", array(&$children));
            $retval['content'] =& $children;
            // XXX - AFAIK <content:encoded> is only used in RSS
            // feeds, to provide the body of an article (i.e.
            // inside an <item>).
            run_hooks("body", array("content", &$children, &$context));
            break;
        default:
            //		echo "Warning: unknown \"content:\" element: [$elt_name]\n";
            break;
    }
    return true;
}
Exemple #2
0
if ($feed_info['nickname'] != "") {
    ?>
  <tr>
    <th>Nickname</th>
    <td><?php 
    echo $feed_info['nickname'];
    ?>
  </tr>
<?php 
}
?>

<?php 
if ($feed_info['description'] != "") {
    $description = $feed_info['description'];
    run_hooks("clean-html", array(&$description));
    ?>
  <tr>
    <th>Description</th>
    <td><?php 
    echo $description;
    ?>
</td>
  </tr>
<?php 
}
?>

  <tr>
    <th>Site URL</th>
    <td><span class="url"><a href="<?php 
Exemple #3
0
function show_form($feed_id)
{
    // We've already established above that $feed_id is numeric
    $feed = db_get_feed($feed_id);
    if ($feed === NULL) {
        abort("No such feed: {$feed_id}");
    }
    // Figure out which groups this feed is in.
    $groups = group_tree(TRUE);
    mark_groups($feed_id, $groups);
    $feed_opts = db_get_feed_options($feed['id']);
    ########################################
    echo '<', '?xml version="1.0" encoding="UTF-8"?', ">\n";
    ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
	"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<title>NewsBite: Editing <?php 
    echo htmlspecialchars($feed['title']);
    ?>
</title>
<link rel="stylesheet" type="text/css" href="css/style.css" media="all" />
<link rel="stylesheet" type="text/css" href="css/editfeed.css" media="all" />
<meta name="theme-color" content="#8080c0" />
</head>
<body id="edit-feed">

<?php 
    /* XXX - Links to get back to interesting places, like feed list */
    ?>
<h1>Editing feed <?php 
    echo htmlspecialchars($feed['title']);
    ?>
</h1>

<form name="edit-feed" method="post" action="editfeed.php">
<?php 
    /* Feed ID */
    ?>
<input type="hidden" name="id" value="<?php 
    echo $feed['id'];
    ?>
"/>
<input type="hidden" name="command" value="update"/>

<table id="show-feed">
<?php 
    /* XXX - Is it worth displaying the feed ID? */
    ?>
  <tr>
    <th>ID</th>
    <td><?php 
    echo $feed['id'];
    ?>
</td>
  </tr>

  <tr>
    <th>Title</th>
    <td><?php 
    echo htmlspecialchars($feed['title']);
    ?>
</td>
  </tr>

  <tr>
    <th>Subtitle</th>
    <td><?php 
    echo $feed['subtitle'] ? htmlspecialchars($feed['subtitle']) : "&nbsp;";
    ?>
</td>
  </tr>

<?php 
    /* User-settable nickname */
    ?>
  <tr>
    <th>Nickname</th>
    <td>
      <input type="text" name="nickname" value="<?php 
    echo $feed['nickname'];
    ?>
"/>
    </td>
  </tr>

<?php 
    /* XXX - There should be a button or something to try to
     * auto-discover the feed URL from the site URL. Presumably the way
     * to do this is to fetch the site URL and check for "link
     * rel=alternate", where the MIME type is RSS or Atom.
     *
     * However, I'm not sure this can be done in JavaScript: we can't
     * just fetch an arbitrary URL.
     */
    ?>
  <tr>
    <th>Site URL</th>
    <td>
      <input type="text" name="url" value="<?php 
    echo $feed['url'];
    ?>
"/>
    </td>
  </tr>

  <tr>
    <th>Feed URL</th>
    <td>
      <input type="text" name="feed_url" value="<?php 
    echo $feed['feed_url'];
    ?>
"/>
    </td>
  </tr>

  <tr>
    <th>Description</th>
    <td>
      <div><?php 
    # Sanitize description before displaying it.
    $description = $feed['description'];
    run_hooks("clean-html", array(&$description));
    echo $description;
    ?>
</div>
    </td>
  </tr>

<?php 
    /* XXX - Probably not worth displaying this */
    ?>
  <tr>
    <th>Last update</th>
    <td><?php 
    echo $feed['last_update'];
    ?>
</td>
  </tr>

  <tr>
    <th>Image</th>
    <td>
<?php 
    if (isset($feed['image'])) {
        ?>
        <img src="<?php 
        echo $feed['image'];
        ?>
"/>
<?php 
    } else {
        ?>
        No image.
<?php 
    }
    ?>
    </td>
  </tr>

  <tr>
    <th>Groups</th>
    <td>
<?php 
    if (isset($groups['members']) && count($groups['members']) > 0) {
        echo "<ul>";
        foreach ($groups['members'] as $g) {
            if ($g['id'] < 0) {
                html_group_list($g);
            }
        }
        echo "</ul>";
    }
    ?>
    </td>
  </tr>

  <tr>
    <th>Active</th>
    <td>
      <input type="checkbox" name="active"
	<?php 
    if ($feed['active']) {
        echo ' checked="checked"';
    }
    ?>
      />
    </td>
  </tr>

  <tr>
    <th>Username</th>
    <td>
      <input type="text" name="username" value="<?php 
    echo $feed['username'];
    ?>
" autocomplete="off"/>
    </td>
  </tr>

  <tr>
    <th>Password</th>
    <td>
      <input type="password" name="password" value="<?php 
    echo $feed['passwd'];
    ?>
" autocomplete="off"/>
    </td>
  </tr>

  <tr>
    <th class="section-title" colspan="0">Options</th>
  </tr>
<?php 
    if (count($feed_opts) > 0) {
        foreach ($feed_opts as $opt => $value) {
            ?>
    <tr>
      <th><?php 
            echo $opt;
            ?>
</th>
      <td><input type="number"
		name="opt_<?php 
            echo $opt;
            ?>
"
		value="<?php 
            echo $feed_opts[$opt];
            ?>
" /></td>
    </tr>
<?php 
        }
    }
    ?>
</table>

<input type="reset" value="Clear changes"/>
<input type="submit" name="change" value="Apply changes"/>
</form>

</body>
</html>
<?php 
    ########################################
}