Esempio n. 1
0
<?php

require 'inc.config.php';
user::check('logged in');
require 'inc.account.php';
$blogs = Blog::all($account);
$subscriptions = $db->select_fields('subscriptions', 'blog_id', array('user_id' => $account->id));
// SAVE
if (isset($_POST['feeds'])) {
    // delete old subscriptions
    $db->delete('subscriptions', array('user_id' => $account->id));
    // add new subscriptions
    $db->begin();
    foreach ($_POST['feeds'] as $blogId) {
        if (isset($blogs[$blogId])) {
            $db->insert('subscriptions', array('user_id' => $account->id, 'blog_id' => $blogId));
        }
    }
    $db->commit();
    user::success('Subscriptions saved!');
    redirect();
} else {
    if (isset($_GET['export'])) {
        header('Content-type: text/plain');
        header('Content-Disposition: attachment; filename="blogs.txt"');
        $blogs = $db->fetch('SELECT b.* FROM blogs b JOIN subscriptions s ON (b.id = s.blog_id AND s.user_id = ?)', array($account->id));
        foreach ($blogs as $blog) {
            echo $blog->feed . "\n";
        }
        exit;
    }
Esempio n. 2
0
 public function custom()
 {
     $this->load->model("blog/blog");
     return Blog::all();
 }
Esempio n. 3
0
<?php

$b = new Blog();
$u = new User();
$all = true;
$self = false;
if (isset($_GET['follow']) && $_GET['follow'] == true) {
    $blogs = $b->blogFromFollower($_COOKIE['username']);
    $all = false;
} else {
    $blogs = $b->all();
}
$follows = $u->follower($_COOKIE['username']);
?>
<div class="row">
    <div class="col-md-8">
        <h1 class="page-header">
            Twitts 
            <!-- <a href="http://localhost/Zipdrug/blog/follower"><small>Only Followers</small></a> -->
        </h1>
        <?php 
if ($all == false) {
    ?>
            <a href="http://localhost/Zipdrug/user/home"><span> Back to all</span></a>
        <?php 
} else {
    ?>
        <a href="http://localhost/Zipdrug/user/home?follow=true"><span> Click to Show only from follower</span></a>
        <?php 
}
foreach ($blogs as $blog) {