<commit_before><?php

include "includes/common.inc";

if (variable_get(dev_timing, 0)) timer_start();

function node_render($node) {
  global $id, $cid, $op, $moderate, $pid, $subject, $comment, $theme, $mode, $order, $threshold, $PHP_SELF;

  if ($node->comment) {
    switch($op) {
      case t("Preview comment"):
        $theme->header();
        comment_preview(check_input($pid), check_input($id), $subject, $comment);
        $theme->footer();
        break;
      case t("Post comment"):
        comment_post(check_input($pid), check_input($id), check_input($subject), check_input($comment));
        $theme->header();
        node_view($node);
        comment_render($id, $cid);
        $theme->footer();
        break;
      case t("Add comment"):
        $theme->header();
        comment_reply(check_input($cid), check_input($id));
        $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));
        $theme->header();
        node_view($node);
        comment_render($id, $cid);
        $theme->footer();
        break;
      case t("Moderate comments"):
        comment_moderate($moderate);
        $theme->header();
        node_view($node);
        comment_render($id, $cid);
        $theme->footer();
        break;
      default:
        $theme->header();
        node_view($node);
        comment_render($id, $cid);
        $theme->footer();
    }
  }
  else {
    $theme->header();
    node_view($node);
    $theme->footer();
  }
}

function node_failure() {
  global $theme;
  $theme->header();
  $theme->box(t("Not found"), t("The node you are looking for does not exist yet or is no longer accessible:") ."<UL><LI><A HREF=\"search.php\">". t("search node") ."</A></LI><LI><A HREF=\"submit.php\">". t("add node") ."</A></LI></UL>\n");
  $theme->footer();
}

function node_history($node) {
  global $status;
  if ($node->status == $status[expired] || $node->status == $status[posted]) {
    $output .= "<DT><B>". format_date($node->timestamp) ." by ". format_username($node->userid) .":</B></DT><DD>". check_output($node->log, 1) ."<P></DD>";
  }
  if ($node->pid) {
    $output .= node_history(node_get_object("nid", $node->pid));
  }
  return $output;
}

$number = ($title ? db_result(db_query("SELECT COUNT(nid) FROM node WHERE title = '$title' AND status = $status[posted]")) : 1);

if ($number > 1) {
  $result = db_query("SELECT n.*, u.userid FROM node n LEFT JOIN users u ON n.author = u.id WHERE n.title = '$title'");

  while ($node = db_fetch_object($result)) {
    if (node_visible($node)) {
      $output .= "<P><B><A HREF=\"node.php?id=$node->nid\">". check_output($node->title) ."</A></B><BR><SMALL>$node->type - ". format_username($node->userid) ." - ". format_date($node->timestamp, "small") ."</SMALL></P>";
    }
  }

  $theme->header();
  $theme->box(t("Result"), $output);
  $theme->footer();
}
elseif ($number) {
  $node = ($title ? node_get_object(title, check_input($title)) : node_get_object(nid, check_input($id)));
  if ($node && node_visible($node)) {
    switch ($op) {
      case "history":
        $theme->header();
        $theme->box(t("History"), node_control($node) ."<DL>". node_history($node) ."</DL>");
        $theme->footer();
        break;
      default:
        user_rehash();
        node_render($node);
    }
  }
  else {
    node_failure();
  }
}
else {
  node_failure();
}

if (variable_get(dev_timing, 0)) timer_print();

?><commit_msg>Fixes  - Changed include "includes/common.inc"; to include_once    "includes/common.inc"; Including the common file more than once will    cause bad things.<commit_after><?php

include_once "includes/common.inc";

if (variable_get(dev_timing, 0)) timer_start();

function node_render($node) {
  global $id, $cid, $op, $moderate, $pid, $subject, $comment, $theme, $mode, $order, $threshold, $PHP_SELF;

  if ($node->comment) {
    switch($op) {
      case t("Preview comment"):
        $theme->header();
        comment_preview(check_input($pid), check_input($id), $subject, $comment);
        $theme->footer();
        break;
      case t("Post comment"):
        comment_post(check_input($pid), check_input($id), check_input($subject), check_input($comment));
        $theme->header();
        node_view($node);
        comment_render($id, $cid);
        $theme->footer();
        break;
      case t("Add comment"):
        $theme->header();
        comment_reply(check_input($cid), check_input($id));
        $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));
        $theme->header();
        node_view($node);
        comment_render($id, $cid);
        $theme->footer();
        break;
      case t("Moderate comments"):
        comment_moderate($moderate);
        $theme->header();
        node_view($node);
        comment_render($id, $cid);
        $theme->footer();
        break;
      default:
        $theme->header();
        node_view($node);
        comment_render($id, $cid);
        $theme->footer();
    }
  }
  else {
    $theme->header();
    node_view($node);
    $theme->footer();
  }
}

function node_failure() {
  global $theme;
  $theme->header();
  $theme->box(t("Not found"), t("The node you are looking for does not exist yet or is no longer accessible:") ."<UL><LI><A HREF=\"search.php\">". t("search node") ."</A></LI><LI><A HREF=\"submit.php\">". t("add node") ."</A></LI></UL>\n");
  $theme->footer();
}

function node_history($node) {
  global $status;
  if ($node->status == $status[expired] || $node->status == $status[posted]) {
    $output .= "<DT><B>". format_date($node->timestamp) ." by ". format_username($node->userid) .":</B></DT><DD>". check_output($node->log, 1) ."<P></DD>";
  }
  if ($node->pid) {
    $output .= node_history(node_get_object("nid", $node->pid));
  }
  return $output;
}

$number = ($title ? db_result(db_query("SELECT COUNT(nid) FROM node WHERE title = '$title' AND status = $status[posted]")) : 1);

if ($number > 1) {
  $result = db_query("SELECT n.*, u.userid FROM node n LEFT JOIN users u ON n.author = u.id WHERE n.title = '$title'");

  while ($node = db_fetch_object($result)) {
    if (node_visible($node)) {
      $output .= "<P><B><A HREF=\"node.php?id=$node->nid\">". check_output($node->title) ."</A></B><BR><SMALL>$node->type - ". format_username($node->userid) ." - ". format_date($node->timestamp, "small") ."</SMALL></P>";
    }
  }

  $theme->header();
  $theme->box(t("Result"), $output);
  $theme->footer();
}
elseif ($number) {
  $node = ($title ? node_get_object(title, check_input($title)) : node_get_object(nid, check_input($id)));
  if ($node && node_visible($node)) {
    switch ($op) {
      case "history":
        $theme->header();
        $theme->box(t("History"), node_control($node) ."<DL>". node_history($node) ."</DL>");
        $theme->footer();
        break;
      default:
        user_rehash();
        node_render($node);
    }
  }
  else {
    node_failure();
  }
}
else {
  node_failure();
}

if (variable_get(dev_timing, 0)) timer_print();

?>
{'fraction_non_alphanumeric': 0.2099195710455764, 'fraction_numerical': 0.0013404825737265416, 'mean_word_length': 3.149610678531702, 'pattern_counts': {'":': 6, '<': 61, '<?xml version=': 0, '>': 139, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3965361', 'n_tokens_mistral': 2475, 'n_tokens_neox': 2460, 'n_words': 491}