if (isset($_POST['url']) === true && is_string($_POST['url']) === true && empty($_POST['url']) === false) { $url = (string) $_POST['url']; $md5 = md5($url); } elseif (isset($_POST['content']) === true && is_string($_POST['content']) === true && empty($_POST['content']) === false) { if (get_magic_quotes_gpc() === 1) { $_POST['content'] = stripslashes($_POST['content']); } $content = (string) $_POST['content']; $md5 = md5($content); } if ($md5 === null) { $response->sendCallError('URL ou contenu manquant'); } // Start print to PDF : get an older print if it exists try { $api_print = ApiPrint::retrieveByUserAndMd5($api_user, $md5); } catch (Exception $e) { $response->sendCallError('Impossible to get content'); } // New print... if ($api_print === null) { $api_print = new ApiPrint(); $api_print->setIdUser($api_user->getId()); if ($url !== null) { $api_print->setUrl($url); } elseif ($content !== null) { $api_print->setContent($content); } else { $response->sendDisastrousError('Logical error : no content, no url'); } $api_print->setMd5($md5);