function planche_wp_need_login() { require_once 'includes/Planche.php'; require_once 'includes/PlancheWPDB.php'; $Planche = new Planche(); $Planche->error('You need to login as administrator.'); exit; }
/** Sets up the WordPress Environment. */ require $dirname . '/wp-load.php'; $domains = trim(get_option('planche-cors')); $domains = preg_replace("/[\r\n]+/", ", ", $domains); if ($domains) { header('Access-Control-Allow-Origin: ' . $domains); } header('Access-Control-Allow-Credentials: true'); require_once '../includes/Planche.php'; require_once '../includes/PlancheWPDB.php'; $Planche = new Planche(); if (isset($_REQUEST['callback']) === true) { $Planche->setCallback($_REQUEST['callback']); } if (!is_user_logged_in()) { $Planche->error('Please, login admin'); exit; } if (isset($_REQUEST['cmd']) === false) { $Planche->error('Invalid request'); exit; } $cmd = json_decode(base64_decode($_REQUEST['cmd'])); if (!$cmd->db) { $db = DB_NAME; } else { $db = $cmd->db; } @$Planche->setDatabase($cmd->host, $cmd->user, $cmd->pass, $db); @$Planche->conn->select($db); // print_r($cmd->query);