Example #1
0
        <script type="text/javascript" src="<?php 
echo ZOTPRESS_PLUGIN_URL;
?>
js/jquery.livequery.min.js"></script>
    </head>
    
    <body><?php 
// START WITH ITEMS
if (isset($_GET['step']) && $_GET['step'] == "items") {
    $api_user_id = zp_get_api_user_id();
    //if (get_option('ZOTPRESS_PASSCODE') && isset($_GET['key']) && get_option('ZOTPRESS_PASSCODE') == $_GET['key'])
    //{
    // Get account
    //$_SESSION['zp_session'][$api_user_id]['zp_account'] = zp_get_account($wpdb, $api_user_id);
    // Set delete list
    update_option('ZOTPRESS_DELETE_' . $api_user_id, zp_get_local_items($wpdb, $api_user_id));
    // Set current sync time
    zp_set_update_time(date('Y-m-d'));
    // GET ITEM COUNT AND LOCAL ITEMS
    //$_SESSION['zp_session'][$api_user_id]['items']['zp_local_items'] = zp_get_local_items ($wpdb, $api_user_id);
    // Set up session item query vars
    //$_SESSION['zp_session'][$api_user_id]['items']['zp_items_to_add'] = array();
    //$_SESSION['zp_session'][$api_user_id]['items']['zp_items_to_update'] = array();
    //$_SESSION['zp_session'][$api_user_id]['items']['query_total_items_to_add'] = 0;
    // SYNC ITEMS
    ?>
<script type="text/javascript">
            
            jQuery(document).ready(function()
            {
                function zp_get_items (zp_plugin_url, api_user_id, zp_start)
echo ZOTPRESS_PLUGIN_URL;
?>
js/jquery.livequery.min.js"></script>
    </head>
    
    <body><?php 
// START WITH ITEMS
if (isset($_GET['step']) && $_GET['step'] == "items") {
    $api_user_id = zp_get_api_user_id();
    if (isset($_SESSION['zp_session'][$api_user_id]['key']) && isset($_GET['key']) && $_SESSION['zp_session'][$api_user_id]['key'] == $_GET['key']) {
        // Get account
        $_SESSION['zp_session'][$api_user_id]['zp_account'] = zp_get_account($wpdb, $api_user_id);
        // Set current sync time
        zp_set_update_time(date('Y-m-d'));
        // GET ITEM COUNT AND LOCAL ITEMS
        $_SESSION['zp_session'][$api_user_id]['items']['zp_local_items'] = zp_get_local_items($wpdb, $api_user_id);
        // Set up session item query vars
        $_SESSION['zp_session'][$api_user_id]['items']['zp_items_to_add'] = array();
        $_SESSION['zp_session'][$api_user_id]['items']['zp_items_to_update'] = array();
        $_SESSION['zp_session'][$api_user_id]['items']['query_total_items_to_add'] = 0;
        // SYNC ITEMS
        ?>
<script type="text/javascript">
            
            jQuery(document).ready(function()
            {
                function zp_get_items (zp_plugin_url, api_user_id, zp_key, zp_start)
                {
                    var zpXMLurl = zp_plugin_url + "lib/actions/actions.sync.php?api_user_id=" + api_user_id + "&key=" + zp_key + "&step=items&start=" + zp_start;
                    
                    jQuery.get( zpXMLurl, {}, function(xml)
Example #3
0
 // IMPORT
 if ($errorCheck == false) {
     // Setup
     $GLOBALS['zp_session'][$api_user_id]['items']['zp_items_to_add'] = array();
     $GLOBALS['zp_session'][$api_user_id]['items']['zp_items_to_update'] = array();
     $GLOBALS['zp_session'][$api_user_id]['items']['query_total_items_to_add'] = 0;
     $GLOBALS['zp_session'][$api_user_id]['collections']['zp_collections_to_update'] = array();
     $GLOBALS['zp_session'][$api_user_id]['collections']['zp_collections_to_add'] = array();
     $GLOBALS['zp_session'][$api_user_id]['collections']['query_total_collections_to_add'] = 0;
     $GLOBALS['zp_session'][$api_user_id]['tags']['zp_tags_to_update'] = array();
     $GLOBALS['zp_session'][$api_user_id]['tags']['zp_tags_to_add'] = array();
     $GLOBALS['zp_session'][$api_user_id]['tags']['query_total_tags_to_add'] = 0;
     // ITEMS
     if (isset($_GET['step']) && $_GET['step'] == "items") {
         global $wpdb;
         $GLOBALS['zp_session'][$api_user_id]['items']['zp_local_items'] = zp_get_local_items($wpdb, $api_user_id);
         $zp_continue = zp_get_server_items($wpdb, $api_user_id, $start);
         if ($zp_continue === true) {
             //if ($start % 200 == 0) // Save, then continue
             //{
             zp_save_synced_items($wpdb, $api_user_id, false);
             $xml = "<result success=\"true\" next=\"" . ($start + 50) . "\" saved=\"true\" />\n";
             //}
             //else // just continue
             //{
             //    $xml = "<result success=\"true\" next=\"" . ($start+50) . "\" />\n";
             //}
         } else {
             if ($zp_continue === false) {
                 //global $wpdb;
                 zp_save_synced_items($wpdb, $api_user_id);