Exemplo n.º 1
0
     exit;
 }
 // Run the Content Track Handler
 $contentTrack = new ContentTrack($contentID, Me::$id);
 switch ($_POST['type']) {
     case "boost":
         $contentTrack->voteUp();
         break;
     case "nooch":
         $success = false;
         $noochCount = 0;
         if ($authorID != Me::$id) {
             // Check if the user has already triple nooched
             $noochCount = Database::selectValue("SELECT nooch FROM content_tracking_users WHERE uni_id=? AND content_id=? LIMIT 1", array(Me::$id, $contentID));
             if ($noochCount !== false and $noochCount < 3) {
                 if ($success = Credits::chargeInstant(Me::$id, 0.15, "Assigned a Nooch")) {
                     $contentTrack->nooch();
                     $noochCount++;
                 }
             }
         }
         echo json_encode(array("content_id" => $contentID, "nooch_count" => (int) $noochCount, "nooch_success" => $success));
         exit;
     case "tip":
         if (!isset($_POST['amount'])) {
             echo 'false';
             exit;
         }
         // Prepare Values
         $_POST['amount'] = (double) $_POST['amount'];
         $pass = $_POST['amount'] >= 0.1 ? true : false;