Example #1
0
			
			zp_get_tags_ajax( <?php 
                    echo "'" . ZOTPRESS_PLUGIN_URL . "', '" . $api_user_id;
                    ?>
', 0);
			
			<?php 
                    //global $Zotpress_update_version;
                    $wpdb->update($wpdb->prefix . "zotpress", array('version' => $GLOBALS['Zotpress_update_db_by_version']), array('api_user_id' => $api_user_id), array('%s'), array('%s'));
                } else {
                    if (isset($_GET['step']) && $_GET['step'] == "selective") {
                        // Check selected top level collections
                        if (isset($_GET['collections']) && preg_match("/[0-9a-zA-Z,]+/", $_GET['collections'])) {
                            $api_user_id = zp_get_api_user_id();
                            // Clear last import
                            zp_clear_last_import($wpdb, $api_user_id, "selective", $_GET['collections']);
                            // Import top level collections' data
                            $GLOBALS['zp_session'][$api_user_id]['collections']['query_params'] = array();
                            $GLOBALS['zp_session'][$api_user_id]['collections']['query_total_entries'] = 0;
                            foreach (explode(",", $_GET['collections']) as $zp_single_collection) {
                                zp_get_collections($wpdb, $api_user_id, 0, false, false, $zp_single_collection);
                            }
                            zp_save_collections($wpdb, $api_user_id, false, false);
                            ?>
					var zpCollections = '<?php 
                            echo $_GET['collections'];
                            ?>
';
					zpCollections = zpCollections.split(',');
					
					zp_get_items_ajax( <?php 
Example #2
0
        $xml .= "</errors>\n";
        $xml .= "</citation>\n";
    }
} else {
    if (isset($_GET['delete'])) {
        if (preg_match("/^[0-9]+\$/", $_GET['delete'])) {
            // Get api_user_id
            $api_user_id = $wpdb->get_var("SELECT api_user_id FROM " . $wpdb->prefix . "zotpress WHERE id='" . $_GET['delete'] . "'");
            // Delete account and items
            $wpdb->query("DELETE FROM " . $wpdb->prefix . "zotpress WHERE id='" . $_GET['delete'] . "'");
            //$wpdb->query("DELETE FROM ".$wpdb->prefix."zotpress_zoteroItems WHERE api_user_id='".$api_user_id."'");
            //$wpdb->query("DELETE FROM ".$wpdb->prefix."zotpress_zoteroCollections WHERE api_user_id='".$api_user_id."'");
            //$wpdb->query("DELETE FROM ".$wpdb->prefix."zotpress_zoteroTags WHERE api_user_id='".$api_user_id."'");
            zp_clear_last_import($wpdb, $api_user_id, "items");
            zp_clear_last_import($wpdb, $api_user_id, "collections");
            zp_clear_last_import($wpdb, $api_user_id, "tags");
            // Check if default account
            if (get_option("Zotpress_DefaultAccount") && get_option("Zotpress_DefaultAccount") == $api_user_id) {
                delete_option('Zotpress_DefaultAccount');
            }
            $wpdb->flush();
            unset($api_user_id);
            $total_accounts = $wpdb->get_var("SELECT COUNT(*) FROM " . $wpdb->prefix . "zotpress;");
            // Display success XML
            $xml .= "<result success='true' total_accounts='" . $total_accounts . "' />\n";
            $xml .= "<account id='" . str_replace("#", "", $_GET['delete']) . "' type='delete' />\n";
        } else {
            exit;
        }
    } else {
        if (isset($_GET['image']) && $_GET['image'] == "true") {