<commit_before><?php
# PlomWiki plugin: EditConflict. Warn of / resolve editing conflicts.
# 
# Copyright 2010-2012 <NAME> / <http://www.plomlompom.de/>
# License: AGPLv3 or any later version. See file LICENSE for details.

$s = ReadStringsFile($plugin_strings_dir.'EditConflict', $s);

$hook_before_action = '
# Hook before page writing action is initiated.
if ($action == "Action_write" && $_GET["t"] == "page") {
  $s["css"] .= $s["css_edit"];
  $s["css"] .= $s["css_history"];

  # Page exists? Get most recent text and its hash.
  if (is_file($page_path)) {
    $s["EditConflict_TxtOther"] = file_get_contents($page_path);
    $hash_recent = hash("md5", $s["EditConflict_TxtOther"]); }

  # Page was deleted while you were editing? Assume "delete" text.
  else {
    $s["EditConflict_TxtOther"] = "delete";
    $hash_recent = ""; }

  # Most recent text and text from which your editing started differ?
  if ($_POST["hash_start"] != $hash_recent) {

    # Sanitize for comparison with sanitized text.
    $_POST["text"] = Sanitize($_POST["text"]);

    # Conflicting edits lead to same result? Inform via error message.
    if ($_POST["text"] == $s["EditConflict_TxtOther"])
      ErrorFail("EditConflict_ErrorSame");

    # Conflicting edit results? Resolve with Action_EditConflict().
    else {
      $s["EditConflict_TxtYours"] = $_POST["text"];<commit_msg>Hooking in EditConflict.php was wrong, created bugs. Fixed.<commit_after><?php
# PlomWiki plugin: EditConflict. Warn of / resolve editing conflicts.
# 
# Copyright 2010-2012 <NAME> / <http://www.plomlompom.de/>
# License: AGPLv3 or any later version. See file LICENSE for details.

$s = ReadStringsFile($plugin_strings_dir.'EditConflict', $s);

$hook_before_action .= '
# Hook before page writing action is initiated.
if ($action == "Action_write" && $_GET["t"] == "page") {
  $s["css"] .= $s["css_edit"];
  $s["css"] .= $s["css_history"];

  # Page exists? Get most recent text and its hash.
  if (is_file($page_path)) {
    $s["EditConflict_TxtOther"] = file_get_contents($page_path);
    $hash_recent = hash("md5", $s["EditConflict_TxtOther"]); }

  # Page was deleted while you were editing? Assume "delete" text.
  else {
    $s["EditConflict_TxtOther"] = "delete";
    $hash_recent = ""; }

  # Most recent text and text from which your editing started differ?
  if ($_POST["hash_start"] != $hash_recent) {

    # Sanitize for comparison with sanitized text.
    $_POST["text"] = Sanitize($_POST["text"]);

    # Conflicting edits lead to same result? Inform via error message.
    if ($_POST["text"] == $s["EditConflict_TxtOther"])
      ErrorFail("EditConflict_ErrorSame");

    # Conflicting edit results? Resolve with Action_EditConflict().
    else {
      $s["EditConflict_TxtYours"] = $_POST["text"];
{'fraction_non_alphanumeric': 0.15437207628643396, 'fraction_numerical': 0.007196833393306945, 'mean_word_length': 4.366795366795367, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '5347434', 'n_tokens_mistral': 938, 'n_tokens_neox': 891, 'n_words': 244}