Example #1
0
$db = "storytelling_platform";
$storyID = findStoryID($storyID, $userID);
if ($functionName == "drawLines") {
    drawLines($storyID);
} else {
    if ($functionName == "drawNodes") {
        drawNodes($storyID);
    } else {
        if ($functionName == "reorderNodes") {
            reorderNodes($localhost, $user, $pw, $db, $storyID);
        } else {
            if ($functionName == "maxChildren") {
                maxChildren($storyID);
            } else {
                if ($functionName == "addNewNode") {
                    addNewNode($localhost, $user, $pw, $db, $storyID);
                } else {
                    if ($functionName == "deleteNode") {
                        deleteNode($localhost, $user, $pw, $db, $storyID);
                    } else {
                        if ($functionName == "isFirstNode") {
                            isFirstNode($storyID);
                        } else {
                            if ($functionName == "moveBranch") {
                                moveBranch($storyID);
                            } else {
                                if ($functionName == "reorderBranches") {
                                    reorderBranches($localhost, $user, $pw, $db, $storyID);
                                } else {
                                    if ($functionName == "addNodeAsChild") {
                                        addNodeAsChild($localhost, $user, $pw, $db, $storyID);
Example #2
0
             }
             imagecopyresampled($resized_img, $new_img, 0, 0, 0, 0, $newwidth, $newheight, $width, $height);
             if (!imagejpeg($resized_img, "./../images/questions/" . $safename)) {
                 echo json_encode(array("status" => 601, "message" => "Image Write Error. Contact System Administrator."));
                 exit(1);
             }
             imagedestroy($resized_img);
             imagedestroy($new_img);
             $questionHTML = "<img src='" . $_SERVER['PHP_SELF'] . "/../../images/questions/" . $safename . "' />";
         } else {
             echo json_encode(array("status" => 601, "message" => "You can upload only Image files"));
         }
     }
     //get question details and update the database
     if ($execute) {
         if (addNewNode($questionHTML, _POST("posX"), _POST("posY"))) {
             echo json_encode(array("status" => 600, "message" => "Successfully Added a new node", "posX" => intval(_POST("posX")), "posY" => intval(_POST("posY")), "nodeId" => intval(mysql_insert_id())));
         } else {
             echo json_encode(array("status" => 601, "message" => "Unable to add a new node"));
         }
     } else {
         echo json_encode(array("status" => 601, "message" => "Unable to add , \$exec fail"));
     }
     break;
 case "removeNode":
     //delete question from the database and remove all paths attached to it
     if (removeNode(_POST('level'))) {
         echo json_encode(array("status" => 600, "message" => "Successfully Removed Node"));
     } else {
         echo json_encode(array("status" => 601, "message" => "Unable to remove Node"));
     }