Esempio n. 1
0
 public function APICrParse()
 {
     $postdata = file_get_contents("php://input");
     $request = json_decode($postdata, true);
     ob_start();
     $this->APICrParseInternal($request);
     $myStr = ob_get_contents();
     ob_end_clean();
     $cr = json_decode($myStr, true)['data'];
     //print_r($cr);
     //on vérifie si il est pas déjà en base
     $CRs = new CR($this->db);
     $CRs->load(array('hfr_post_id = ?', $cr['hfr_post_id']));
     if ($CRs->id) {
         header("HTTP/1.1 405 Not Found");
         echo 'CR déjà en base :) > <a target="_blank" href="/crotypedia/' . $CRs->id . '">voir sur le site</a>';
         exit;
     }
     $cr['content'] = $cr['content_raw'];
     $this->f3->set('cr', $cr);
     echo Template::instance()->render('cr/view.htm');
 }