Esempio n. 1
0
include_once "includes/story.inc";
function story_render($id, $cid)
{
    global $theme, $user;
    $story = db_fetch_object(db_query("SELECT s.*, u.userid FROM stories s LEFT JOIN users u ON s.author = u.id WHERE s.id = '{$id}'"));
    if (story_visible($story)) {
        $theme->story($story, "[ <A HREF=\"story.php?op=reply&id={$id}&pid=0\">" . t("reply to this story") . "</A> ]");
        comment_render($id, $cid);
    } else {
        $theme->box(t("Warning message"), t("The story you requested is not available or does not exist."));
    }
}
switch ($op) {
    case t("Preview comment"):
        $theme->header();
        comment_preview(check_input($pid), check_input($id), $subject ? check_output($subject) : "", $comment ? check_output($comment) : "");
        $theme->footer();
        break;
    case t("Post comment"):
        comment_post(check_input($pid), check_input($id), check_input($subject), check_input($comment));
        $theme->header();
        story_render(check_input($id), check_input($cid));
        $theme->footer();
        break;
    case "reply":
        $theme->header();
        comment_reply(check_input($pid), check_input($id));
        $theme->footer();
        break;
    case t("Update settings"):
        comment_settings(check_input($mode), check_input($order), check_input($threshold));
Esempio n. 2
0
 /**
  * Form submission handler for the 'preview' action.
  *
  * @param $form
  *   An associative array containing the structure of the form.
  * @param $form_state
  *   The current state of the form.
  */
 public function preview(array &$form, FormStateInterface $form_state)
 {
     $comment_preview = comment_preview($this->entity, $form_state);
     $comment_preview['#title'] = $this->t('Preview comment');
     $form_state->set('comment_preview', $comment_preview);
     $form_state->setRebuild();
 }
Esempio n. 3
0
 /**
  * Form submission handler for the 'preview' action.
  *
  * @param $form
  *   An associative array containing the structure of the form.
  * @param $form_state
  *   A reference to a keyed array containing the current state of the form.
  */
 public function preview(array &$form, array &$form_state)
 {
     $comment = $this->entity;
     $form_state['comment_preview'] = comment_preview($comment, $form_state);
     $form_state['comment_preview']['#title'] = $this->t('Preview comment');
     $form_state['rebuild'] = TRUE;
 }