Exemple #1
0
function fb_ajax_handler()
{
    if (!isset($_POST['action']) || $_POST['action'] != 'fotobook') {
        return false;
    }
    // handle hide/unhide requests
    if (isset($_POST['hide'])) {
        fb_toggle_album_hiding($_POST['hide']);
        echo 'success';
    } elseif (isset($_POST['order'])) {
        fb_update_album_order($_POST['order']);
        echo 'success';
    } elseif (isset($_POST['reset_order'])) {
        fb_reset_album_order();
        echo 'The albums have been ordered by their modification date.';
    } elseif (isset($_POST['remove_all'])) {
        fb_remove_all();
        echo 'All albums have been removed.';
    } elseif (isset($_POST['progress'])) {
        echo round(get_option('fb_update_progress'));
    } elseif (isset($_POST['update'])) {
        $facebook = new FacebookAPI();
        if ($facebook->link_active()) {
            $facebook->update_albums();
            echo $facebook->msg;
        } else {
            echo 'There are no accounts linked to Fotobook.';
        }
    } elseif (isset($_POST['albums_list'])) {
        fb_display_manage_list($_POST['message']);
    }
    exit;
}
Exemple #2
0
<?php

define('WP_USE_THEMES', false);
require '../../../wp-blog-header.php';
// handle cron request
if (isset($_GET['update']) && isset($_GET['secret']) && $_GET['secret'] == get_option('fb_secret')) {
    echo 'Updating Fotobook (be patient)...';
    ob_flush();
    flush();
    $facebook = new FacebookAPI();
    if ($facebook->link_active()) {
        $facebook->update_albums();
    }
    echo 'Done';
} else {
    echo 'Invalid URL';
}