root/afridex/plugins/Flutter/ajax/canvas-management_ajax.php @ 21

Revision 21, 1.3 kB (checked in by admin, 18 years ago)
Line 
1<?php
2
3if(isset($_SERVER['HTTP_X_REQUESTED_WITH']) && $_SERVER ['HTTP_X_REQUESTED_WITH']  == 'XMLHttpRequest') {
4        require( dirname(__FILE__) . '/../../../../wp-config.php' );
5        if (!(is_user_logged_in() && current_user_can('edit_posts')))
6                die("Athentication failed!");
7
8       
9        global $wpdb, $canvas;
10       
11        if(isset($_GET["delete"])) canvas_delete_block($_GET["delete"]);
12        if(isset($_GET["duplicate"])) canvas_create_management_block(canvas_duplicate_block($_GET["duplicate"]),' style="display: none"');
13       
14        if($_GET["update"] == 'all') {
15                $blocks = $wpdb->get_results("SELECT * FROM ".$canvas->main." WHERE theme = '".get_option('template')."' ORDER BY module_title");
16                $delete_button = get_option('canvas_allow_deletion');
17                foreach($blocks as $block) {
18                        // Get module name
19                        include_once('RCCWP_CustomWriteModule.php');
20                        $customWriteModule = RCCWP_CustomWriteModule::Get($block->module_id);
21                        $block->module_name = $customWriteModule->name;
22
23                        canvas_create_management_block($block,'',$delete_button);
24                }
25        }
26        if(isset($_POST["rename"]) && $_POST["rename"] == 'true') {
27                $module_title = urldecode($_POST["value"]);
28                $block_id = str_replace('title_','',$_POST["id"]);
29                $wpdb->query("UPDATE ".$canvas->main." SET module_title='$module_title' WHERE block_id='$block_id'");
30                echo $module_title;
31        }
32}
33?>
Note: See TracBrowser for help on using the browser.