Exemple #1
0
use Dropplets\Actions;
use Dropplets\Settings;
use Dropplets\Layout;
use Dropplets\PostHelper;
/*-----------------------------------------------------------------------------------*/
/* User Machine
/*-----------------------------------------------------------------------------------*/
$login_error = null;
if (isset($_GET['action'])) {
    $action = $_GET['action'];
    switch ($action) {
        // Logging in.
        case 'login':
            // Password hashing via phpass.
            $hasher = new \Phpass\Hash();
            $settings = Settings::instance();
            $password = $settings->get('password');
            if (isset($_POST['password']) && $hasher->CheckPassword($_POST['password'], $password)) {
                $_SESSION['user'] = true;
                // Redirect if authenticated.
                header('Location: ' . './');
            } else {
                // Display error if not authenticated.
                $login_error = 'Nope, try again!';
            }
            break;
            // Logging out.
        // Logging out.
        case 'logout':
            session_unset();
            session_destroy();
Exemple #2
0
function get_footer()
{
    $settings = new Dropplets\Settings();
    $PAGINATION_ON_OFF = $settings->get('PAGINATION_ON_OFF');
    ?>
    <!-- jQuery & Required Scripts -->
    <script src="//code.jquery.com/jquery-1.10.2.min.js"></script>
    
    <?php 
    if (!IS_SINGLE && $PAGINATION_ON_OFF !== "off") {
        ?>
    <!-- Post Pagination -->
    <script>
        var infinite = true;
        var next_page = 2;
        var loading = false;
        var no_more_posts = false;
        $(function() {
            function load_next_page() {
                $.ajax({
                    url: "index.php?page=" + next_page,
                    beforeSend: function () {
                        $('body').append('<article class="loading-frame"><div class="row"><div class="one-quarter meta"></div><div class="three-quarters"><img src="./templates/<?php 
        echo ACTIVE_TEMPLATE;
        ?>
/loading.gif" alt="Loading"></div></div></article>');
                        $("body").animate({ scrollTop: $("body").scrollTop() + 250 }, 1000);
                    },
                    success: function (res) {
                        next_page++;
                        var result = $.parseHTML(res);
                        var articles = $(result).filter(function() {
                            return $(this).is('article');
                        });
                        if (articles.length < 2) {  //There's always one default article, so we should check if  < 2
                            $('.loading-frame').html('You\'ve reached the end of this list.');
                            no_more_posts = true;
                        }  else {
                            $('.loading-frame').remove();
                            $('body').append(articles);
                        }
                        loading = false;
                    },
                    error: function() {
                        $('.loading-frame').html('An error occurred while loading posts.');
                        //keep loading equal to false to avoid multiple loads. An error will require a manual refresh
                    }
                });
            }

            $(window).scroll(function() {
                var when_to_load = $(window).scrollTop() * 0.32;
                if (infinite && (loading != true && !no_more_posts) && $(window).scrollTop() + when_to_load > ($(document).height()- $(window).height() ) ) {
                    // Sometimes the scroll function may be called several times until the loading is set to true.
                    // So we need to set it as soon as possible
                    loading = true;
                    setTimeout(load_next_page,500);
                }
            });
        });
    </script>
    <?php 
    }
    ?>
    
    <!-- Dropplets Tools -->
    <?php 
    $tools = new Dropplets\Tools();
    echo $tools->showMenu();
    ?>
    
    <!-- User Footer Injection -->
    <?php 
    echo $settings->get('FOOTER_INJECT');
    ?>
    
    <!-- Plugin Footer Injection -->
    <?php 
    \Dropplets\Actions\Action::run('dp_footer');
}
Exemple #3
0
 public function __construct()
 {
     $this->settings = Settings::instance();
 }
Exemple #4
0
function get_header()
{
    $settings = Settings::instance();
    $blog_url = $settings->get('blog_url');
    ?>
    <!-- RSS Feed Links -->
    <link rel="alternate" type="application/rss+xml" title="Subscribe using RSS" href="<?php 
    echo BLOG_URL;
    ?>
rss" />
    <link rel="alternate" type="application/atom+xml" title="Subscribe using Atom" href="<?php 
    echo BLOG_URL;
    ?>
atom" />
    
    <!-- Dropplets Styles -->
    <link rel="stylesheet" href="<?php 
    echo $blog_url;
    ?>
/dropplets/style/style.css">
    <link rel="shortcut icon" href="<?php 
    echo $blog_url;
    ?>
/dropplets/style/images/favicon.png">

    <!-- User Header Injection -->
    <?php 
    //echo $settings->get('header_inject');
    ?>
    
    <!-- Plugin Header Injection -->
    <?php 
    \Dropplets\Actions\Action::run('dp_header');
}