Example #1
0
         $_REQUEST['func'] = 'update';
         // break;
     } else {
         unset($_POST['func']);
         $id = $pm->postNewContent($_POST);
         if ($id) {
             $message = "Content create.";
         } else {
             $message = "Content NOT created. Try again in a few minutes.";
         }
         echo json_encode(array("id" => $id, "message" => $message));
         break;
     }
 case 'update':
     unset($_POST['func']);
     $id = $pm->updateContent($_POST);
     if ($id) {
         $message = "Content updated.";
     } else {
         $message = "Content NOT updated. Try again in a few minutes.";
     }
     echo json_encode(array("id" => $id, "message" => $message));
     break;
 case 'delete':
     unset($_POST['func']);
     if ($pm->deleteContent((int) $_POST['id'])) {
         $message = "Content deleted.";
         $pass = true;
     } else {
         $message = "Content NOT deleted. Try again in a few minutes.";
         $pass = false;