<?php require_once __DIR__ . '/bootstrap.php'; if (isset($_GET['json'])) { $last_id = isset($_GET['id']) && (int) $_GET['id'] > 0 ? (int) $_GET['id'] : 0; $api = new ShaarliApiClient(SHAARLI_API_URL); $rows = $api->latest(); $json = array(); $json['id'] = 0; $json['entries'] = array(); if ($rows != null) { $rows = array_reverse($rows); foreach ($rows as $row) { if ($row->id > $last_id) { $entry = array(); $content = array(); $content[] = '<div class="entry">'; $content[] = '<div class="entry-timestamp">' . date('d/m/Y H:i:s', strtotime($row->date)) . '</div>'; $content[] = '<a class="entry-shaarli" target="_blank" href="' . @$row->feed->link . '">'; $content[] = '<img class="favicon" src="' . get_favicon_url($row->feed->id) . '" />' . $row->feed->title . '</a> '; $content[] = '<a class="entry-title" target="_blank" href="' . $row->permalink . '">' . $row->title . '</a>'; $content[] = '<div class="entry-content">' . $row->content . '</div>'; $content[] = '</div>'; $entry['content'] = implode($content); unset($content); $json['entries'][] = $entry; } if ($row->id > $json['id']) { // Max id $json['id'] = $row->id; }
<?php require_once __DIR__ . '/bootstrap.php'; if (isset($_GET['q']) && !empty($_GET['q'])) { // Sanitize input // Source: http://ulyssesonline.com/2011/10/19/sanitize-your-input-in-php function sanitize($in) { return addslashes(htmlspecialchars(strip_tags(trim($in)))); } $searchterm = sanitize($_GET['q']); $api = new ShaarliApiClient(SHAARLI_API_URL); $entries = $api->search($searchterm); } include __DIR__ . '/includes/header.php'; include __DIR__ . '/includes/menu.php'; ?> <?php if (isset($entries)) { ?> <div style="float:right;"> <a class="btn btn-default" target="_blank" href="<?php echo SHAARLI_API_URL; ?> search?pretty=1&q=<?php echo $searchterm; ?> ">JSON</a> <a class="btn btn-default" target="_blank" href="<?php echo SHAARLI_API_URL;
<?php require_once __DIR__ . '/bootstrap.php'; if (isset($_GET['url']) && !empty($_GET['url'])) { $url = $_GET['url']; $api = new ShaarliApiClient(SHAARLI_API_URL); $entries = $api->discussion($url); } $layout = !isset($_GET['ajax']); if ($layout) { include __DIR__ . '/includes/header.php'; include __DIR__ . '/includes/menu.php'; } if (isset($entries)) { if (!empty($entries)) { ?> <div id="entries"> <div class="entry"> <a class="btn btn-default" href="./discussion.php?url=<?php echo htmlentities($entries[0]->permalink); ?> " title="Discussion permalink" style="float:right;"><span class="glyphicon glyphicon-link"></span></a> <h3 style="margin:0;"><?php echo $entries[0]->title; ?> </h3> <p><a target="_blank" href="<?php echo htmlentities($entries[0]->permalink); ?> " style="margin:0;"><?php echo htmlentities($entries[0]->permalink);
<?php require_once __DIR__ . '/bootstrap.php'; $api = new ShaarliApiClient(SHAARLI_API_URL); $feeds = $api->feeds(); shuffle($feeds); include __DIR__ . '/includes/header.php'; ?> <div style="float:right;"> <a class="btn btn-default" target="_blank" href="<?php echo SHAARLI_API_URL; ?> feeds?pretty=1">JSON</a> <a class="btn btn-default" target="_blank" href="<?php echo SHAARLI_API_URL; ?> feeds?format=opml">OPML</a> </div> <?php include __DIR__ . '/includes/menu.php'; ?> <h3>The Network (<?php echo count($feeds); ?> peoples)</h3> <?php foreach ($feeds as $feed) {
$content[] = '</ul>'; $content = implode($content); $feed_entry->title = 'Top du ' . date('d/m/Y', strtotime($data->date)); $feed_entry->content = $content; $feed_entry->date = $data->date; } $feed = array($feed_entry); create_rss($feed, array('title' => 'Shaarli River - Les liens les plus partagés')); exit; } /** * Top shared links - Page */ $intervals = array('12h' => 'Last 12h', '24h' => 'Last 24h', '48h' => 'Last 48h', '1month' => 'Last month', '3month' => 'Last 3 months', 'alltime' => 'Alltime'); $interval = isset($_GET['interval']) && isset($intervals[$_GET['interval']]) ? $_GET['interval'] : '24h'; $api = new ShaarliApiClient(SHAARLI_API_URL); $entries = $api->top(array('interval' => $interval)); $header_rss = './top.php?do=rss'; include __DIR__ . '/includes/header.php'; include __DIR__ . '/includes/menu.php'; ?> <div class="menu"> <?php foreach ($intervals as $key => $libelle) { ?> <a class="btn btn-<?php echo $key == $interval ? 'primary' : 'default'; ?> " href="./top.php?interval=<?php echo $key; ?>