$theme = Theme::load($themeID); // validate the theme if (empty($theme)) { $json = array('error' => 'That theme does not exist.'); exit(json_encode($json)); } // save the new theme $user->setThemeID($theme->getID()); $user->save(); // send us back Session::setMessage("Theme changed."); $json = array('success' => '1'); echo json_encode($json); } elseif ($action == 'notification') { $notificationType = Filter::alphanum($_POST['notificationType']); $notificationValue = Filter::alphanum($_POST['notificationValue']); // convert checkbox value to database-friendly 1 or 0 $value = $notificationValue == 'notify' ? 1 : 0; // figure out which User setter to use based on notification type switch ($notificationType) { case 'chkCommentTaskLeading': $user->setNotifyCommentTaskLeading($value); break; case 'chkEditTaskJoined': $user->setNotifyEditTaskAccepted($value); break; case 'chkCommentTaskJoined': $user->setNotifyCommentTaskAccepted($value); break; case 'chkCommentTaskUpdate': $user->setNotifyCommentTaskUpdate($value);
/** * Return only alpha and digits chars * * @param $value * @return mixed * * @deprecated See JBZoo\Utils\Filter */ public static function alphaDigets($value) { return Filter::alphanum($value); }
//Format Deadline, if empty or an invalid date is given, default to a week from today if (!empty($line[3])) { $deadline = strtotime($line[3]); if ($deadline == false) { $deadline = strtotime("+1 week"); $deadline = date("Y-m-d H:i:s", $deadline); } else { $deadline = date("Y-m-d H:i:s", $deadline); } } else { $deadline = strtotime("+1 week"); $deadline = date("Y-m-d H:i:s", $deadline); } //Format Leader, if empty or an invalid name is given, don't enter in anyone if (!empty($line[4])) { $leaderId = User::loadByUsername(Filter::alphanum($line[4])); //***need to change with Chloe's updated user filter*** if (empty($leaderId)) { $leaderId = Session::getUserID(); } } else { //$leaderId = NULL; $leaderId = Session::getUserID(); } } //Create Task Record $title = Filter::text($line[0]); $description = Filter::text(iconv(mb_detect_encoding($line[1], mb_detect_order(), true), "UTF-8", $line[1])); $task = new Task(array('creator_id' => Session::getUserID(), 'leader_id' => $leaderId, 'project_id' => $projectId, 'title' => $title, 'description' => $description, 'status' => 1, 'deadline' => $deadline, 'num_needed' => $numberOfPeople)); array_push($taskArray, $task); //Increment row in file
<?php require_once "../../global.php"; $inviteID = Filter::numeric($_POST['inviteID']); $invite = Invitation::load($inviteID); $response = Filter::alphanum($_POST['response']); if ($response == 'accept') { // add the user to the project if ($invite->getTrusted()) { $relationship = ProjectUser::TRUSTED; } else { $relationship = ProjectUser::MEMBER; } $pu = new ProjectUser(array('project_id' => $invite->getProjectID(), 'user_id' => $invite->getInviteeID(), 'relationship' => $relationship)); $pu->save(); // update the invite $invite->setResponse(Invitation::ACCEPTED); $invite->setDateResponded(date("Y-m-d H:i:s")); $invite->save(); // prep for logging $eventTypeID = 'accept_member_invitation'; $successMsg = 'You accepted the invitation.'; } else { // update the invite $invite->setResponse(Invitation::DECLINED); $invite->setDateResponded(date("Y-m-d H:i:s")); $invite->save(); // prep for logging $eventTypeID = 'decline_member_invitation'; $successMsg = 'You declined the invitation.'; }