Beispiel #1
0
         Viewer::AddData("error_message", $error_message);
     }
 }
 // If Rated Up or Down
 if (isset($_POST["rate_plus"]) || isset($_POST["rate_minus"])) {
     $idea = Idea::GetById($id);
     if (empty($_POST["comment_text"])) {
         $error_message = I18n::L("Please fill comment text.");
     }
     if (empty($error_message)) {
         if (!Rate::Find($idea, User::$current)) {
             if (isset($_POST["rate_plus"])) {
                 Idea::RatePlus($idea, User::$current);
             }
             if (isset($_POST["rate_minus"])) {
                 Idea::RateMinus($idea, User::$current);
             }
             $comment = Comment::Add(Comment::Create($_POST["comment_text"], $idea, User::$current));
             $comment_lastnumber = sizeof(Comments::GetByIdea($idea));
             Notify::NotifyOfIdeaRate(User::GetById($idea->user_id), User::$current, $idea, $comment, isset($_POST["rate_plus"]));
             header("Location:" . PREFIX . "/idea?" . $idea->idea_id . "#comment_{$comment_lastnumber}");
             exit;
         } else {
             $error_message = "You already rated this idea.";
             Viewer::AddData("error_message", $error_message);
         }
     } else {
         Viewer::AddData("error_message", $error_message);
     }
     $action = "rate";
 }
Beispiel #2
0
         Viewer::AddData("error_message", $error_message);
     }
 }
 // If Rated Up or Down
 if (isset($_POST["rate_plus"]) || isset($_POST["rate_minus"])) {
     $idea = Idea::GetById($id);
     if (empty($_POST["comment_text"])) {
         $error_message = I18n::L("Please fill comment text.");
     }
     if (empty($error_message)) {
         if (!Rate::Find($idea, User::$current)) {
             if (isset($_POST["rate_plus"])) {
                 Idea::RatePlus($idea);
             }
             if (isset($_POST["rate_minus"])) {
                 Idea::RateMinus($idea);
             }
             $comment = Comment::Add(Comment::Create($_POST["comment_text"], $idea, User::$current));
             $comment_lastnumber = sizeof(Comments::GetByIdea($idea));
             Notify::NotifyOfIdeaRate(User::GetById($idea->user_id), User::$current, $idea, $comment, isset($_POST["rate_plus"]));
             header("Location:" . PREFIX . "/idea?" . $idea->idea_id . "#comment_{$comment_lastnumber}");
             exit;
         } else {
             $error_message = "You already rated this idea.";
             Viewer::AddData("error_message", $error_message);
         }
     } else {
         Viewer::AddData("error_message", $error_message);
     }
     $action = "rate";
 }