<commit_before>require 'php_serialize'
require 'mechanize'

class DiagramoPlugin::Diagram < Article

  settings_items :diagramo_id

  before_create :diagramo_create

  def self.short_description
    "Diagrama"
  end

  def self.description
    "Construa um diagrama com o Diagramo"
  end

  def to_html options = {}
    lambda do
      render 'content_viewer/diagramo_plugin/diagram'
    end
  end

  def author?
    self.user and self.user.id == self.author_id
  end

  def diagramo_uri
    if self.author?
      "#{EditorUrl}?diagramId=#{self.diagramo_id}&biscuit=#{diagramo_cookie}"
    else
      "#{ViewDiagramUrl}?diagramId=#{self.diagramo_id}"
    end
  end

  def user
    @user ||= User.current.person rescue nil
  end

  def diagramo_email
    "#{self.user.identifier}@#{self.profile.environment.default_hostname}"
  end
  def diagramo_password
    Digest::MD5.hexdigest self.user.identifier
  end

  protected

  # move to config file
  BaseUrl = "http://diagramas.blogoosfero.cc"
  AdminEmail = '<EMAIL>'
  AdminPassword = '<PASSWORD>'
<commit_msg>Fix admin user<commit_after>require 'php_serialize'
require 'mechanize'

class DiagramoPlugin::Diagram < Article

  settings_items :diagramo_id

  before_create :diagramo_create

  def self.short_description
    "Diagrama"
  end

  def self.description
    "Construa um diagrama com o Diagramo"
  end

  def to_html options = {}
    lambda do
      render 'content_viewer/diagramo_plugin/diagram'
    end
  end

  def author?
    self.user and self.user.id == self.author_id
  end

  def diagramo_uri
    if self.author?
      "#{EditorUrl}?diagramId=#{self.diagramo_id}&biscuit=#{diagramo_cookie}"
    else
      "#{ViewDiagramUrl}?diagramId=#{self.diagramo_id}"
    end
  end

  def user
    @user ||= User.current.person rescue nil
  end

  def diagramo_email
    "#{self.user.identifier}@#{self.profile.environment.default_hostname}"
  end
  def diagramo_password
    Digest::MD5.hexdigest self.user.identifier
  end

  protected

  # move to config file
  BaseUrl = "http://diagramas.blogoosfero.cc"
  AdminEmail = '<EMAIL>'
  AdminPassword = '<PASSWORD>'

{'fraction_non_alphanumeric': 0.09900990099009901, 'fraction_numerical': 0.000942951438000943, 'mean_word_length': 3.5831533477321815, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 7, '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': '3220441', 'n_tokens_mistral': 755, 'n_tokens_neox': 738, 'n_words': 154}