public function write($newline = null) { if ($newline) { echo 'Current content: ', $this->content, ' with version ', self::VERSION, "\n"; } else { echo 'Current content: ', $this->content, ' with version ', self::VERSION; } } public function isClean() { return $this->content !== ''; } public function getContent() { return $this->content; } public function version() { return '0.0.1'; } public static function make($content) { $whiteboard = new static($content); return $whiteboard; } private function wipe() { } } $whiteboard = Whiteboard::make('sdfhsdhs'); // echo Whiteboard::version(), "\n";
} $uploadName = uniqid() . '.' . $ext; $test = move_uploaded_file($_FILES['boardPic']['tmp_name'], fileUpload . "/" . $uploadName); if (!$test) { $imgName = ""; } else { $imgName = fileUploadURLPath . "/" . $uploadName; } $size = getimagesize(fileUpload . "/" . $uploadName); $heightAdjust = $size[1]; } $db = $app->db; $newId = 0; $boardExists = 'false'; if (array_key_exists('boardName', $_POST)) { $testBoard = Whiteboard::getByName($_POST['boardName'], $user->id); if ($testBoard) { $boardExists = 'true'; } } if (array_key_exists('edit', $_POST) && is_numeric($_POST['edit']) && $testBoard) { if ($_POST['edit'] == $testBoard->id) { $boardExists = 'false'; } } if (array_key_exists('tempId', $_GET)) { if (!is_numeric($_GET['tempId'])) { die("bad id"); } $s = $db->prepare("update TempBoard set name=:n,brandImage=:b,backgroundColor=:c where id=:i and sessionId=:u"); $s->bindParam(':i', $_GET['tempId']);
<?php if ($user->id < 0) { die("need login!"); } ini_set("memory_limit", "64M"); if ($user->credit < priceExport) { die("not enough credits"); } $user->chargeCredits(priceExport); $boardId = $_POST['boardId']; $board = Whiteboard::getById($boardId); $im = $board->createPng(); if ($im) { header('Content-type: image/png'); imagepng($im); imagedestroy($im); exit; }
<?php if (!(array_key_exists('boardId', $_GET) && is_numeric($_GET['boardId']))) { die("invalid Board"); } $board = Whiteboard::getById($_GET['boardId']); if (!$board || $board->userId != $user->id) { die("invalid Board"); } if ($user->credit < priceBrandBoard) { header("Location: /purchase?err=priceBrandBoard"); exit; } if (array_key_exists('confirm', $_POST)) { $user->chargeCredits(priceBrandBoard); if ($board->expireDate < time()) { $s = $app->db->prepare("update DoodleBoard set expireDate = :t where id=:i"); $time = time() + 30 * 86400; } else { $s = $app->db->prepare("update DoodleBoard set expireDate = expireDate + :t where id=:i"); $time = 30 * 86400; } $s->bindParam(':t', $time); $s->bindParam(':i', $board->id); $s->execute(); header("Location: /dashboard?err=Reactivate"); exit; }
exit; } if ($uri[0] == 'new') { $s = $app->db->prepare("insert into DoodleBoard (timeCreated, schoolId) values (:t,:s)"); $s->bindParam(':t', time()); $s->bindParam(':s', $school->id); $s->execute(); $newId = $app->db->lastInsertId(); header('Location: /' . $newId); exit; } $board = null; if (is_numeric($uri[0])) { $board = Whiteboard::getBySchoolId($uri[0], $school->id); } else { $board = Whiteboard::getbySchoolName($uri[0], $school->id); } if ($board) { $roomId = $board->id; $board->brandImage = $school->bgImg; $board->backgroundColor = $school->bgColor; $color = randomColor(); $inviteText = $board->getNameUrl($school->domain . ".sneffel.com"); $embedText = $board->getEmbed(500, 500, $school->domain . ".sneffel.com"); if ($board->brandImage) { $size = getimagesize("./" . $board->brandImage); $heightAdjust = $size[1] + 25; } else { $heightAdjust = 25; } $controller = "subdomainBoard";
<?php $roomId = is_numeric($_GET["roomId"]) ? $_GET["roomId"] : 0; $replay = array_key_exists('replay', $_GET) ? 1 : 0; if ($school) { if ($school->expireDate < time()) { include "view/expiredSchool.phtml"; exit; } $board = Whiteboard::getBySchoolId($roomId, $school->id); } else { $board = Whiteboard::getById($roomId); } $embed = 1; if (!$board) { die("no board!"); } /*if(!$replay && $board->expireDate < time()) { include "view/expiredBoard.phtml"; exit; }*/ if ($board->backgroundColor) { if ($board->brandImage) { $size = getimagesize("./" . $board->brandImage); $heightAdjust = $size[1]; } else { $heightAdjust = 0; } } else { $board->name = "www.sneffel.com";
if ($user->id < 0) { setcookie("SignupRedirect", "boardCreator", time() + 3600); setcookie("SignupRedirectData", $_POST['boardId'], time() + 3600); header("Location:/signup?SignupRedirect=boardCreator"); } else { if ($user->credit < priceClaim) { header("Location: /purchase?err=priceClaim"); exit; } else { $controller = "boardCreatorStep2"; $boardId = $_POST['boardId']; } } break; case 'Yes - Create my whiteboard.': if ($user->credit < priceClaim) { header("Location: /purchase?err=priceClaim"); exit; } $user->chargeCredits(priceClaim); $s = $app->db->prepare("select name,brandImage, backgroundColor from TempBoard where id=:i"); $s->bindParam(':i', $_POST['boardId']); $s->execute(); $tb = $s->fetchObject(); $newBoard = Whiteboard::newBoard($tb->name, $user->id, 500, 500, $tb->brandImage, $tb->backgroundColor, time() + 6060606060606060.0 * 60 * 3); $controller = "boardCreatorFinish"; break; } } else { $boardName = array_key_exists('boardName', $_POST) ? $_POST['boardName'] : 'My New Whiteboard'; }