text:
<?php

namespace Google\AdsApi\Dfp\v201705;

/**
 * This file was generated from WSDL. DO NOT EDIT.
 */
class Network
{

    /**
     * @var int $id
     */
    protected $id = null;

    /**
     * @var string $displayName
     */
    protected $displayName = null;

    /**
     * @var string $networkCode
     */
    protected $networkCode = null;

    /**
     * @var string $propertyCode
     */
    protected $propertyCode = null;

    /**
     * @var string $timeZone
     */
    protected $timeZone = null;

    /**
     * @var string $currencyCode
     */
    protected $currencyCode = null;

    /**
     * @var string[] $secondaryCurrencyCodes
     */
    protected $secondaryCurrencyCodes = null;

    /**
     * @var string $effectiveRootAdUnitId
     */
    protected $effectiveRootAdUnitId = null;

    /**
     * @var boolean $isTest
     */
    protected $isTest = null;

    /**
     * @param int $id
     * @param string $displayName
     * @param string $networkCode
     * @param string $propertyCode
     * @param string $timeZone
     * @param string $currencyCode
     * @param string[] $secondaryCurrencyCodes
     * @param string $effectiveRootAdUnitId
     * @param boolean $isTest
     */
    public function __construct($id = null, $displayName = null, $networkCode = null, $propertyCode = null, $timeZone = null, $currencyCode = null, array $secondaryCurrencyCodes = null, $effectiveRootAdUnitId = null, $isTest = null)
    {
      $this->id = $id;
      $this->displayName = $displayName;
      $this->networkCode = $networkCode;
      $this->propertyCode = $propertyCode;
      $this->timeZone = $timeZone;
      $this->currencyCode = $currencyCode;
      $this->secondaryCurrencyCodes = $secondaryCurrencyCodes;
      $this->effectiveRootAdUnitId = $effectiveRootAdUnitId;
      $this->isTest = $isTest;
    }

    /**
     * @return int
     */
    public function getId()
    {
      return $this->id;
    }

    /**
     * @param int $id
     * @return \Google\AdsApi\Dfp\v201705\Network
     */
    public function setId($id)
    {
      $this->id = $id;
      return $this;
    }

    /**
     * @return string
     */
    public function getDisplayName()
    {
      return $this->displayName;
    }

    /**
     * @param string $displayName
     * @return \Google\AdsApi\Dfp\v201705\Network
     */
    public function setDisplayName($displayName)
    {
      $this->displayName = $displayName;
      return $this;
    }

    /**
     * @return string
     */
    public function getNetworkCode()
    {
      return $this->networkCode;
    }

    /**
     * @param string $networkCode
     * @return \Google\AdsApi\Dfp\v201705\Network
     */
    public function setNetworkCode($networkCode)
    {
      $this->networkCode = $networkCode;
      return $this;
    }

    /**
     * @return string
     */
    public function getPropertyCode()
    {
      return $this->propertyCode;
    }

    /**
     * @param string $propertyCode
     * @return \Google\AdsApi\Dfp\v201705\Network
     */
    public function setPropertyCode($propertyCode)
    {
      $this->propertyCode = $propertyCode;
      return $this;
    }

    /**
     * @return string
     */
    public function getTimeZone()
    {
      return $this->timeZone;
    }

    /**
     * @param string $timeZone
     * @return \Google\AdsApi\Dfp\v201705\Network
     */
    public function setTimeZone($timeZone)
    {
      $this->timeZone = $timeZone;
      return $this;
    }

    /**
     * @return string
     */
    public function getCurrencyCode()
    {
      return $this->currencyCode;
    }

    /**
     * @param string $currencyCode
     * @return \Google\AdsApi\Dfp\v201705\Network
     */
    public function setCurrencyCode($currencyCode)
    {
      $this->currencyCode = $currencyCode;
      return $this;
    }

    /**
     * @return string[]
     */
    public function getSecondaryCurrencyCodes()
    {
      return $this->secondaryCurrencyCodes;
    }

    /**
     * @param string[] $secondaryCurrencyCodes
     * @return \Google\AdsApi\Dfp\v201705\Network
     */
    public function setSecondaryCurrencyCodes(array $secondaryCurrencyCodes)
    {
      $this->secondaryCurrencyCodes = $secondaryCurrencyCodes;
      return $this;
    }

    /**
     * @return string
     */
    public function getEffectiveRootAdUnitId()
    {
      return $this->effectiveRootAdUnitId;
    }

    /**
     * @param string $effectiveRootAdUnitId
     * @return \Google\AdsApi\Dfp\v201705\Network
     */
    public function setEffectiveRootAdUnitId($effectiveRootAdUnitId)
    {
      $this->effectiveRootAdUnitId = $effectiveRootAdUnitId;
      return $this;
    }

    /**
     * @return boolean
     */
    public function getIsTest()
    {
      return $this->isTest;
    }

    /**
     * @param boolean $isTest
     * @return \Google\AdsApi\Dfp\v201705\Network
     */
    public function setIsTest($isTest)
    {
      $this->isTest = $isTest;
      return $this;
    }

}


text:
package com.yofc.odn.docprintor.service;

import java.util.List;
import java.util.Set;

import com.yofc.odn.docprintor.model.Contract;
import com.yofc.odn.docprintor.vo.SpecificationButterVO;
import com.yofc.odn.docprintor.vo.SpecificationSheatVO;
import com.yofc.odn.docprintor.vo.SpecificationTightVO;

public interface PrintSpecificationNumIdService {
	//蝶形的vo
	public Set<SpecificationButterVO> getPrintSpecificationNumId(int contractId);
	//户层的vo
	public Set<SpecificationSheatVO> getPrintSpecificationSheatVO(int contractId);
	//紧套的vo
	public Set<SpecificationTightVO> getPrintSpecificationTightVO(int contractId);
}

redpajama_set_name: RedPajamaGithub


text:
package cz.metacentrum.perun.core.impl.modules.attributes;

import cz.metacentrum.perun.core.api.Attribute;
import cz.metacentrum.perun.core.api.AttributeDefinition;
import cz.metacentrum.perun.core.api.AttributesManager;
import cz.metacentrum.perun.core.api.User;
import cz.metacentrum.perun.core.api.exceptions.InternalErrorException;
import cz.metacentrum.perun.core.api.exceptions.WrongAttributeAssignmentException;
import cz.metacentrum.perun.core.api.exceptions.WrongAttributeValueException;
import cz.metacentrum.perun.core.api.exceptions.WrongReferenceAttributeValueException;
import cz.metacentrum.perun.core.impl.PerunSessionImpl;
import cz.metacentrum.perun.core.impl.Utils;
import cz.metacentrum.perun.core.implApi.modules.attributes.UserAttributesModuleAbstract;
import cz.metacentrum.perun.core.implApi.modules.attributes.UserAttributesModuleImplApi;
import java.util.regex.Matcher;

/**
 *
 * @author Sona Mastrakova <sona.mastrakova@gmail.com>
 */
public class urn_perun_user_attribute_def_def_rootMailAliasesMail extends UserAttributesModuleAbstract implements UserAttributesModuleImplApi {

    public void checkAttributeValue(PerunSessionImpl sess, User user, Attribute attribute) throws InternalErrorException, WrongAttributeValueException, WrongAttributeAssignmentException, WrongReferenceAttributeValueException {
        String attributeValue = (String) attribute.getValue();

        Matcher emailMatcher = Utils.emailPattern.matcher(attributeValue);
        if (!emailMatcher.find()) {
            throw new WrongAttributeValueException(attribute, user, "Email is not in correct form.");
        }
    }

    public AttributeDefinition getAttributeDefinition() {
        AttributeDefinition attr = new AttributeDefinition();
        attr.setNamespace(AttributesManager.NS_USER_ATTR_DEF);
        attr.setFriendlyName("rootMailAliasesMail");
        attr.setDisplayName("Email for root mail aliases. If it's not set, preferred mail will be used instead.");
        attr.setType(String.class.getName());
        attr.setDescription("Email for root mail aliases. If it's not set, preferred mail will be used instead.");
        return attr;
    }
}


text:
FOUNDATION_EXPORT double Pods_AVScanner_TestsVersionNumber;
FOUNDATION_EXPORT const unsigned char Pods_AVScanner_TestsVersionString[];


text:
class StripeOauth < Struct.new( :user )

  def oauth_url( params )
    url = client.authorize_url( {
      scope: 'read_write',
      stripe_landing: 'login',
      stripe_user: {
        email: user.email
      }
    }.merge( params ) )

    # Make a request to this URL by hand before
    # redirecting the user there. This way we
    # can handle errors (other than access_denied, which
    # could come later).
    # See https://stripe.com/docs/connect/reference#get-authorize-errors
    begin
      response = RestClient.get url
      # If the request was successful, then we're all good to return
      # this URL.

    rescue => e
      # On the other hand, if the request failed, then
      # we can't send them to connect.
      json = JSON.parse(e.response.body) rescue nil
      if json && json['error']
        case json['error']

        # The application is configured incorrectly and
        # does not have the right Redirect URI
        when 'invalid_redirect_uri'
          return nil, <<-EOF
            Redirect URI is not setup correctly.
            Please see the README.
          EOF

        # Something else horrible happened? Network is down,
        # Stripe API is broken?...
        else
          return [ nil, params[:error_description] ]

        end
      end

      # If there was some problem parsing the body
      # or there's no 'error' parameter, then something
      # _really_ went wrong. So just blow up here.
      return [ nil, "Unable to connect to Stripe. #{e.message}" ]
    end

    [ url, nil ]
  end

  # Upon redirection back to this app, we'll have
  # a 'code' that we can use to get the access token
  # and other details about our connected user.
  # See app/controllers/users_controller.rb#confirm for counterpart.
  def verify!( code )
    data = client.get_token( code, {
      headers: {
        'Authorization' => "Bearer #{Rails.application.secrets.stripe_secret_key}"
      }
    } )

    user.stripe_user_id = data.params['stripe_user_id']
    user.stripe_account_type = 'oauth'
    user.publishable_key = data.params['stripe_publishable_key']
    user.secret_key = data.token
    user.currency = default_currency

    user.save!
  end

  # Deauthorize the user. Straight-forward enough.
  # See app/controllers/users_controller.rb#deauthorize for counterpart.
  def deauthorize!
    response = RestClient.post(
      'https://connect.stripe.com/oauth/deauthorize',
      { client_id: Rails.application.secrets.stripe_client_id,
        stripe_user_id: user.stripe_user_id },
      { 'Authorization' => "Bearer #{Rails.application.secrets.stripe_secret_key}" }
    )
    user_id = JSON.parse( response.body )['stripe_user_id']

    deauthorized if response.code == 200 && user_id == user.stripe_user_id
  end

  # The actual deauthorization on our side consists
  # of 'forgetting' the now-invalid user_id, API keys, etc.
  # Used here in #deauthorize! as well as in the webhook handler:
  # app/controllers/hooks_controller.rb#stripe
  def deauthorized
    user.update_attributes(
      stripe_user_id: nil,
      secret_key: nil,
      publishable_key: nil,
      currency: nil
    )
  end

  private

  # Get the default currency of the connected user.
  # All transactions will use this currency.
  def default_currency
    Stripe::Account.retrieve( user.stripe_user_id, user.secret_key ).default_currency
  end

  # A simple OAuth2 client we can use to generate a URL
  # to redirect the user to as well as get an access token.
  # Used in #oauth_url and #verify!
  def client
    @client ||= OAuth2::Client.new(
      Rails.application.secrets.stripe_client_id,
      Rails.application.secrets.stripe_secret_key,
      {
        site: 'https://connect.stripe.com',
        authorize_url: '/oauth/authorize',
        token_url: '/oauth/token'
      }
    ).auth_code
  end

end


text:
package com.sem4ikt.uni.recipefinderchatbot.activity;

import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.ProgressBar;
import android.widget.TextView;
import android.widget.Toast;

import com.sem4ikt.uni.recipefinderchatbot.R;
import com.sem4ikt.uni.recipefinderchatbot.database.Authentication;
import com.sem4ikt.uni.recipefinderchatbot.model.LoginUserModel;
import com.sem4ikt.uni.recipefinderchatbot.presenter.LoginPresenter;
import com.sem4ikt.uni.recipefinderchatbot.presenter.interfaces.ILoginPresenter;
import com.sem4ikt.uni.recipefinderchatbot.view.ILoginView;

/**
 * Created by mathiaslykkepedersen on 16/03/2017.
 */

public class LoginActivity extends AppCompatActivity implements ILoginView, View.OnClickListener {

    Button loginButton, resetButton, signUpButton;
    EditText emailField, passwordField, confirmPassField;
    ILoginPresenter loginPresenter;
    ProgressBar progressBar;

    // Used to allow back checks
    LoginView state;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        // Set content view
        setContentView(R.layout.login);

        onPresentView(LoginView.LOGIN);

        // Set button listeners
        loginButton = (Button) findViewById(R.id.sign_in_button);
        resetButton = (Button) findViewById(R.id.reset_password_button);
        signUpButton = (Button) findViewById(R.id.sign_up_button);
        progressBar = (ProgressBar) findViewById(R.id.login_progress);

        TextView noAccountTextView = (TextView) findViewById(R.id.sign_up_text_action);
        TextView forPassTextView = (TextView) findViewById(R.id.forgot_password_text_action);

        forPassTextView.setOnClickListener(this);
        noAccountTextView.setOnClickListener(this);
        loginButton.setOnClickListener(this);
        resetButton.setOnClickListener(this);
        signUpButton.setOnClickListener(this);

        loginPresenter = new LoginPresenter(this, new Authentication(), new LoginUserModel());
    }

    @Override
    public void onClick(View view) {
        switch (view.getId()){

            case R.id.sign_in_button:
                loginPresenter.doLogin(emailField.getText().toString(), passwordField.getText().toString());

                break;

            case R.id.reset_password_button:
                loginPresenter.doForgotPassword(emailField.getText().toString());
                break;

            case R.id.sign_up_button:
                loginPresenter.doCreateUser(emailField.getText().toString(), passwordField.getText().toString(), confirmPassField.getText().toString());
                break;

            case R.id.sign_up_text_action:
                loginPresenter.showLayout(LoginView.SIGN_UP);
                break;

            case R.id.forgot_password_text_action:
                loginPresenter.showLayout(LoginView.FORGOT_PASSWORD);
                break;

            default:
                break;
        }
    }

    @Override
    public void onLogin(boolean isSuccessful) {

        if (isSuccessful) {
            // Show menu
            Intent intent = new Intent(this, MainActivity.class);

            startActivity(intent);

            // Kill this activity
            finish();
        } else {
            loginPresenter.doToast("Sign In Failed - Try correct credentials");
        }
    }

    @Override
    public void onRegister(boolean isSuccessful) {

        if (isSuccessful) {
            loginPresenter.doToast("Registration Successful - Please check your email to confirm");
        } else {
            loginPresenter.doToast("Registration Failed - Please verify your network connection");
        }
    }

    @Override
    public void onPassForgot(boolean isSuccessful) {

        if (isSuccessful) {
            loginPresenter.doToast("Reset Password Successful - Please check your email to reset it");
        } else {
            loginPresenter.doToast("Reset Password Failed - Please verify your network connection");
        }

    }

    @Override
    public void onPresentView(LoginView v) {

        switch (v) {

            case LOGIN:
                state = LoginView.LOGIN;
                passwordField = (EditText) findViewById(R.id.login_password);
                emailField = (EditText) findViewById(R.id.login_email);
                break;

            case SIGN_UP:
                state = LoginView.SIGN_UP;
                passwordField = (EditText) findViewById(R.id.password_signup);
                emailField = (EditText) findViewById(R.id.email_signup);
                confirmPassField = (EditText) findViewById(R.id.password_signup_confirm);
                break;

            case FORGOT_PASSWORD:
                state = LoginView.FORGOT_PASSWORD;
                emailField = (EditText) findViewById(R.id.email_reset);
                passwordField = null;
                break;

            default:
                state = null;
                emailField = null;
                passwordField = null;
                confirmPassField = null;
                break;
        }

        LinearLayout linearLayout1 = (LinearLayout) findViewById(R.id.email_login_form);
        LinearLayout linearLayout2 = (LinearLayout) findViewById(R.id.email_signup_form);
        LinearLayout linearLayout3 = (LinearLayout) findViewById(R.id.password_reset_form);

        linearLayout1.setVisibility((v == LoginView.LOGIN ? View.VISIBLE : View.GONE));
        linearLayout2.setVisibility((v == LoginView.SIGN_UP ? View.VISIBLE : View.GONE));
        linearLayout3.setVisibility((v == LoginView.FORGOT_PASSWORD ? View.VISIBLE : View.GONE));
    }

    @Override
    public void onShowToast(String text) {
        Toast toast = Toast.makeText(getApplicationContext(), text, Toast.LENGTH_LONG);
        toast.show();
    }

    @Override
    public void onClearText() {

        if (emailField != null)
            emailField.getText().clear();

        if (passwordField != null)
            passwordField.getText().clear();
    }

    @Override
    public void onSetProgressVisibility(boolean visible) {

        if (visible) {
            progressBar.setVisibility(View.VISIBLE);
        } else {
            progressBar.setVisibility(View.GONE);
        }

    }

    @Override
    public void onBackPressed() {
        loginPresenter.doBack(state);
    }

    @Override
    public void onFinish() {
        finish();
    }

    public enum LoginView {LOGIN, SIGN_UP, FORGOT_PASSWORD}
}


text:
"""
Tests for miscellaneous regresessions.
"""

def test_Sources_import():
    from pycldf import Sources


text:
<!DOCTYPE html>

      <title>Kaku Q & A</title>
      <meta charset="utf-8">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<meta name="description" content="Kaku is the next generation music player supports many different platform like YouTube, Vimeo ... etc. With it, you can listen to any music you like in different platform with just one single click, so simple to use !">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta property="og:title" content="Kaku - Next generation music player">
<meta property="og:type" content="website">
<meta property="og:fb:app_id" content="1516640965257997">
<meta property="og:url" content="http://kaku.rocks">
<meta property="og:image" content="http://kaku.rocks/public/img/logo.png">
<meta property="og:description" content="Kaku is the next generation music player supports many different platform like YouTube, Vimeo ... etc. With it, you can listen to any music you like in different platform with just one single click, so simple to use !">

      <link rel="shortcut icon" type="image/png" href="../favicon.ico">
<link rel="apple-touch-icon" href="../public/img/logo.png">
<link rel="stylesheet" type="text/css" href="http://fonts.googleapis.com/css?family=Exo+2">
<link rel="stylesheet" type="text/css" href="../public/vendor/bootstrap/dist/css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="../public/vendor/components-font-awesome/css/font-awesome.min.css">
<link rel="stylesheet" type="text/css" href="../public/vendor/github-markdown-css/github-markdown.css">
<link rel="stylesheet" type="text/css" href="../public/css/global.css">
<link rel="stylesheet" type="text/css" href="../public/css/docs.css">

	  <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-collapse" aria-expanded="false">
		Toggle navigation

	  </button>
	  Kaku

		  <button class="btn btn-link navbar-btn">
			Tweet
		  </button>

		  Download

All Downloads

AUR package for Arch Linux

GitHub

Follow our Facebook

Q & A

English Tutorial

中文教學

By EragonJ |  | Logo is designed by Peko


text:
#ifndef MA_INPUT_H
#define MA_INPUT_H

/** \file maInput.h
  \brief MeshAdapt user configuration
  \details Usually, users of MeshAdapt need to tweak its behavior slightly
           from the default configuration. For this purpose, the ma::Input
           object is the fully configurable way to interact with MeshAdapt.
           Users should call one of the configure functions in this file,
           then edit the options in the resulting ma::Input object,
           then give this object to the adapt function. */

#include "maMesh.h"
#include "maSize.h"
#include "maSolutionTransfer.h"

namespace ma {

class ShapeHandler;
class Adapt;

typedef ShapeHandler* (*ShapeHandlerFunction)(Adapt* a);

/** \brief User configuration for a MeshAdapt run */
class Input
{
  public:
    ~Input();
    Mesh* mesh;
    SizeField* sizeField;
    bool ownsSizeField;
    SolutionTransfer* solutionTransfer;
    bool ownsSolutionTransfer;
    ShapeHandlerFunction shapeHandler;
/** \brief number of refine/coarsen iterations to run (default 3) */
    int maximumIterations;
/** \brief whether to perform the collapse step */
    bool shouldCoarsen;
/** \brief whether to snap new vertices to the model surface
    \details requires modeler support, see gmi_can_eval */
    bool shouldSnap;
/** \brief whether to transfer parametric coordinates
  \details requires modeler support, see gmi_reparam */
    bool shouldTransferParametric;
/** \brief whether to update matched entity info (limited support) */
    bool shouldHandleMatching;
/** \brief whether to run shape correction (default true) */
    bool shouldFixShape;
/** \brief whether to adapt if it makes local quality worse (default false) */
    bool shouldForceAdaptation;
/** \brief whether to print the worst shape quality */
    bool shouldPrintQuality;
/** \brief minimum desired mean ratio cubed for simplex elements
   \details a different measure is used for curved elements */
    double goodQuality;
/** \brief minimum valid mean ratio cubed for simplex elements (default 1e-10)
   \details used to define inside-out tetrahedra.
   a different measure is used for curved elements */
    double validQuality;
/** \brief imbalance target for all load balancing tools (default 1.10) */
    double maximumImbalance;
/** \brief whether to run zoltan predictive load balancing (default false) */
    bool shouldRunPreZoltan;
/** \brief whether to run parma predictive load balancing (default false) */
    bool shouldRunPreParma;
/** \brief whether to run zoltan during adaptation (default false) */
    bool shouldRunMidZoltan;
/** \brief whether to run parma during adaptation (default false)*/
    bool shouldRunMidParma;
/** \brief whether to run zoltan after adapting (default false) */
    bool shouldRunPostZoltan;
/** \brief whether to run parma after adapting (default false) */
    bool shouldRunPostParma;
/** \brief the ratio between longest and shortest edges that differentiates a
   "short edge" element from a "large angle" element. */
    double maximumEdgeRatio;
/** \brief whether to tetrahedronize the boundary layer (default false)  */
    bool shouldTurnLayerToTets;
/** \brief whether to tetrahedronize abnormal pyramids (default false) */
    bool shouldCleanupLayer;
/** \brief whether to allow layer refinement (default false) */
    bool shouldRefineLayer;
/** \brief whether to allow layer coarsening (default false) */
    bool shouldCoarsenLayer;
/** \brief set to true during UR to get splits in the normal direction */
    bool splitAllLayerEdges;
};

/** \brief generate a configuration based on an anisotropic function.
 \param s if non-zero, use that to transfer all fields. otherwise,
          transfer any associated fields with default algorithms */
Input* configure(
    Mesh* m,
    AnisotropicFunction* f,
    SolutionTransfer* s=0);
/** \brief generate a configuration based on an isotropic function
 \param s if non-zero, use that to transfer all fields. otherwise,
          transfer any associated fields with default algorithms */
Input* configure(
    Mesh* m,
    IsotropicFunction* f,
    SolutionTransfer* s=0);
/** \brief generate a configuration based on anisotropic fields
 \param sizes a vector field of desired element sizes along the
              axes of the anisotropic frame
 \param frames a matrix field containing anisotropic frames
               for each vertex
 \param s if non-zero, use that to transfer all fields. otherwise,
          transfer any associated fields with default algorithms */
Input* configure(
    Mesh* m,
    apf::Field* sizes,
    apf::Field* frames,
    SolutionTransfer* s=0);
/** \brief generate a configuration based on an isotropic field
 \param size a scalar field of desired element size
 \param s if non-zero, use that to transfer all fields. otherwise,
          transfer any associated fields with default algorithms */
Input* configure(
    Mesh* m,
    apf::Field* size,
    SolutionTransfer* s=0);

/** \brief generate a uniform refinement configuration */
Input* configureUniformRefine(Mesh* m, int n=1, SolutionTransfer* s=0);
/** \brief generate a matched uniform refinement configuration */
Input* configureMatching(Mesh* m, int n=1, SolutionTransfer* s=0);
/** \brief generate a no-op configuration */
Input* configureIdentity(Mesh* m, SizeField* f=0, SolutionTransfer* s=0);

/** \brief used internally, but users can call this if they want */
void validateInput(Input* in);

}

#endif


text:
if [[ $EUID -ne 0 ]]; then
   echo "################################################################################"
   echo "#                This script must be run as root (sudo -s)                     #"
   echo "################################################################################"
   exit
fi
clear
echo "################################################################################"
echo "#                                                                              #"
echo "#                                    SETUP                                     #"
echo "#                                                                              #"
echo "#          Repository : https://github.com/thomasbnt/setup-ubuntu1604          #"
echo "#  Software list : https://github.com/thomasbnt/setup-ubuntu1604#software-list #"
echo "#                                                                              #"
echo "#                                                                              #"
echo "#                                                                              #"
echo "################################################################################"
echo ""
echo -n "# Do you want to install the software? Y/N or CTRL+C :  "
read answer
if [ "$answer" = "y" ] || [ "$answer" = "Y"  ] || [ "$answer" = "Yes"  ] || [ "$answer" = "yes"  ] || [ "$answer" = "YES" ]; then
    echo ""
    echo ""
    echo "# Installing.."
    apt-get update -y
    apt-get install curl -y
    apt-get install git -y
    apt-get install gimp -y
    apt-get install easytag -y
    apt-get install sshpass
    snap install gravit-designer
    add-apt-repository ppa:snwh/pulp
    apt-add-repository ppa:brightbox/ruby-ng
    add-apt-repository ppa:peek-developers/stable
    add-apt-repository ppa:videolan/stable-daily
    apt-add-repository ppa:brightbox/ruby-ng
    curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add -
    echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
    apt-get update -y
    apt-get install software-properties-common
    apt-get install paper-gtk-theme -y
    apt-get install paper-icon-theme -y
    apt-get install unity-tweak-tool -y
    apt-get install openvpn -y
    apt-get install network-manager-openvpn -y
    apt-get install network-manager-openvpn-gnome -y
    apt-get install filezilla -y
    apt-get install ruby2.3 ruby2.3-dev
    apt-get install ruby-bundler
    apt-get install build-essential patch ruby-dev zlib1g-dev liblzma-dev
    apt-get install chromium-browser -y
    apt-get install -f -y
    apt-get install peek
    apt-get install vlc
    curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
    "Installing NodeJS"
    apt-get install nodejs -y
    "Installing Yarn"
    apt-get install yarn -y
    "Installing WebServer"
    apt-get install apache2 php mysql-server libapache2-mod-php php-mysql -y
    apt-get install php-curl php-gd php-intl php-json php-mbstring php-mcrypt php-xml php-zip php7.0-mbstring php-gettext -y
    apt-get install phpmyadmin
    echo "# Active PhpMyAdmin" >> /etc/apache2/apache2.conf
    echo "Include /etc/phpmyadmin/apache.conf" >> /etc/apache2/apache2.conf
    sudo service apache2 restart
    echo "Editing DNS to CloudFlare (File : scripts/dns_cloudflare.sh)"
    bash ./scripts/dns_cloudflare.sh
    echo "Setup Wallpaper random from Unsplash (File : scripts/wallpaper_unsplash.sh)"
    bash ./scripts/wallpaper_unsplash.sh
    echo "Creating .ssh folder"
    mkdir ~/home/$USER/.ssh
    echo "Disabling Guest login.."
    mkdir -p /etc/lightdm/lightdm.conf.d
    touch /etc/lightdm/lightdm.conf.d/50-disable-guest.conf
    echo "[SeatDefaults]" >> /etc/lightdm/lightdm.conf.d/50-disable-guest.conf
    echo "allow-guest=false" >> /etc/lightdm/lightdm.conf.d/50-disable-guest.conf
    echo "# Finished ! Please restart. "

elif [ "$answer" = "n" ] || [ "$answer" = "N" ] || [ "$answer" = "No"  ] || [ "$answer" = "no"  ] || [ "$answer" = "NO" ]; then
    echo ""
    echo "# Hum okay. :door:"
else
    echo "# Error. Yes or No."
fi


text:
<?php
namespace Chamilo\Core\Menu\Table\Item;

use Chamilo\Core\Menu\Manager;
use Chamilo\Libraries\Format\Table\Extension\DataClassTable\DataClassTable;
use Chamilo\Libraries\Format\Table\FormAction\TableFormAction;
use Chamilo\Libraries\Format\Table\FormAction\TableFormActions;
use Chamilo\Libraries\Format\Table\Interfaces\TableFormActionsSupport;
use Chamilo\Libraries\Platform\Translation;
use Chamilo\Libraries\Utilities\Utilities;

/**
 *
 * @package Chamilo\Core\Menu\Table\Item
 * @author Hans De Bisschop <hans.de.bisschop@ehb.be>
 * @author Magali Gillard <magali.gillard@ehb.be>
 * @author Eduard Vossen <eduard.vossen@ehb.be>
 */
class ItemBrowserTable extends DataClassTable implements TableFormActionsSupport
{
    const TABLE_IDENTIFIER = Manager::PARAM_ITEM;

    public function get_implemented_form_actions()
    {
        $actions = new TableFormActions(__NAMESPACE__, self::TABLE_IDENTIFIER);
        $actions->add_form_action(
            new TableFormAction(
                $this->get_component()->get_url(array(Manager::PARAM_ACTION => Manager::ACTION_DELETE)),
                Translation::get('RemoveSelected', null, Utilities::COMMON_LIBRARIES)));
        return $actions;
    }
}


text:
Queriable "Secondary Storage" Data
==================================
It is said that the primary use case for object stores is to serve as secondary
storage. With the increasing amount of data being gathered and analysed
(have someone said IoT?) much of this data will make it to secondary storage.

Being kept on secondary storage does not mean that the data does not
need to be queriable anymore: A recent identified trend may be searched
for in older data that was moved to secondary storage. Storlets allow an
efficient and simple querying of data that resides in Swift.

Another closely related use case is that of aggregation. It is a well
known practice to aggregate data as it gets older. Storlets can serve
as 'in place' data aggregators.

Below are more concrete use cases that fall under the definition of
efficient queriable secondary storage data.

Pushing down SQL filtering from Spark
-------------------------------------
Apache Spark is a most popular analytics engine that has  multiple plugins for various types of analytics workloads.
In addition Spark can work with various backend storage systems, with Swift being one of them.
Spark SQL is a Spark plugin that allows to analyse structured data. At the heart of Spark SQL there is an SQL
engine called "Catalyst". Given an SQL query "Catalyst" identifies the filtering part of it. Thus, the filtering
part can be pushed down to a Storlet. The idea was presented in the Tokyo Openstack summit, and can
be viewed in [1]_.

Analysis over binary data
-------------------------
Analytics is typically done over textual data. In some cases that data is embedded in a
binary format. Storlets can be used to extract the textual data from the binary object, thus
saving the need to download it prior to extraction.
One such example is exif metadata in jpegs. This ideas was presented in the Paris Openstack summit,
and can be viewed in [2]_.

.. [1] https://www.youtube.com/watch?v=v9KCh--6Zw8
.. [2] https://www.youtube.com/watch?v=7tqMT0arV2k


text:
#ifndef PERA_VARIABLE_HPP
#define PERA_VARIABLE_HPP

#include <cstdint>
#include <cassert>
#include <cmath>
#include <iostream>
#include <string>
#include <type_traits>
#include <vector>
#include <map>
#include <initializer_list>
#include <typeinfo>
#include <bitset>
#include <functional>
#include <memory>

#include <pera/Variant.hpp>

#ifndef PERA_VARIABLE
#define PERA_VARIABLE
namespace pera { namespace pera_variable_1 {
    class Variable;

    namespace detail
    {
        bool compare_variable_function(const Variable&, const Variable&);

        struct compare_variable
        {
            inline bool operator()(const Variable& lhs, const Variable& rhs) const noexcept
            {
                return compare_variable_function(lhs,rhs);
            }
        };

        template<typename T>
        struct has_function_operator
        {
            template<typename U, typename E> struct SFINAE {};
            template<typename U> static char Test(SFINAE<U, decltype(&U::operator())>*);
            template<typename U> static int Test(...);
            static const bool value = sizeof(Test<T>(0)) == sizeof(char);
        };
    }

    class Variable
    {
        public:
            typedef bool Bool;
            typedef char Char;
            typedef uintmax_t Natural;
            typedef intmax_t Integer;
            typedef long double Double;
            typedef std::string String;
            typedef std::map<Variable,Variable,detail::compare_variable> Map;
            typedef std::function<Variable()> Function;

            template<typename Type>
            using FunctionTemplate = std::function<Type>;

        private:
            typedef pera::Variant<void, Bool, Char, Natural, Integer, Double, String, Map, Function> Value;

            Value value;

            template <typename Type>
            struct function_traits: function_traits<decltype(&Type::operator())>{};

            template <typename ClassType, typename ReturnType, typename... Args>
            struct function_traits<ReturnType(ClassType::*)(Args...) const>
            {
                static constexpr std::size_t arity = sizeof...(Args);

                typedef ReturnType result_type;

                template<std::size_t i>
                struct arg
                {
                    typedef typename std::tuple_element<i, std::tuple<Args...>>::type type;
                };
            };

            template<typename Type>
            typename std::enable_if<std::is_same<typename std::remove_reference<Type>::type,Bool>::value,void>::type
            inline construct(Type&& byte)
            {
                this->value = (Bool)byte;
            }

            template<typename Type>
            typename std::enable_if<std::is_same<typename std::remove_reference<Type>::type,Char>::value,void>::type
            inline construct(Type&& byte)
            {
                this->value = (Char)byte;
            }

            template<typename Type>
            typename std::enable_if<std::is_integral<typename std::remove_reference<Type>::type>::value && std::is_signed<typename std::remove_reference<Type>::type>::value && !std::is_same<typename std::remove_reference<Type>::type,Char>::value,void>::type
            inline construct(Type&& signed_int)
            {
                this->value = (Integer)signed_int;
            }

            template<typename Type>
            typename std::enable_if<std::is_integral<typename std::remove_reference<Type>::type>::value && std::is_unsigned<typename std::remove_reference<Type>::type>::value && !std::is_same<typename std::remove_reference<Type>::type,Char>::value && !std::is_same<typename std::remove_reference<Type>::type,Bool>::value,void>::type
            inline construct(Type&& unsigned_int)
            {
                this->value = (Natural)unsigned_int;
            }

            template<typename Type>
            typename std::enable_if<std::is_floating_point<typename std::remove_reference<Type>::type>::value,void>::type
            inline construct(Type&& floating_point)
            {
                this->value = (Double)floating_point;
            }

            template<typename Type>
            typename std::enable_if<std::is_convertible<Type,String>::value,void>::type
            inline construct(Type&& string)
            {
                this->value = (String)string;
            }

            template<typename Type>
            typename std::enable_if<std::is_convertible<Type,Map>::value,void>::type
            inline construct(Type&& array)
            {
                this->value = (Map)array;
            }

            template<typename FunctionType, typename Type>
            inline auto to_function(Type&& function) -> std::function<FunctionType>
            {
                return function;
            }

            template<int... ints>
            struct sequence{};

            template<int... ints>
            struct make_sequence{};

            template<int first, int... ints>
            struct make_sequence<first, ints...>: make_sequence<first-1, first, ints...>{};

            template<int... ints>
            struct make_sequence<0, ints...>{typedef sequence<0, ints...> type;};

            template<typename Type, int... ints>
            typename std::enable_if<std::is_same<typename function_traits<Type>::result_type,void>::value && (function_traits<Type>::arity == 0),void>::type
            inline construct_maybe_void_lambda_function(Type&& void_function, sequence<ints...> seq)
            {
                this->value = (Function)[void_function](){void_function();return 0;};
            }

            template<typename Type, int... ints>
            typename std::enable_if<std::is_same<typename function_traits<Type>::result_type,void>::value && (function_traits<Type>::arity > 0),void>::type
            inline construct_maybe_void_lambda_function(Type&& void_function, sequence<ints...> seq)
            {
                auto function = (FunctionTemplate<Variable(typename function_traits<Type>::template arg<ints>::type...)>)
                [void_function](typename function_traits<Type>::template arg<ints>::type... args){void_function(args...);return 0;};
                this->value = *(Function*)&function;
            }

            template<typename Type, int... ints>
            typename std::enable_if<!std::is_same<typename function_traits<Type>::result_type,void>::value && (function_traits<Type>::arity == 0),void>::type
            inline construct_maybe_void_lambda_function(Type&& function, sequence<ints...> seq)
            {
                this->value = (Function)function;
            }

            template<typename Type, int... ints>
            typename std::enable_if<!std::is_same<typename function_traits<Type>::result_type,void>::value && (function_traits<Type>::arity > 0),void>::type
            inline construct_maybe_void_lambda_function(Type&& function, sequence<ints...> seq)
            {
                auto temp_function = (FunctionTemplate<Variable(typename function_traits<Type>::template arg<ints>::type...)>)function;
                this->value = *(Function*)&temp_function;
            }

            template<typename Type>
            void inline construct_lambda_function(Type&& function)
            {
                static constexpr std::size_t arity = function_traits<Type>::arity;
                this->construct_maybe_void_lambda_function(std::move(function),typename make_sequence<arity==0?arity:arity-1>::type());
            }

            template<typename Type>
            typename std::enable_if<detail::has_function_operator<typename std::remove_reference<Type>::type>::value,void>::type
            inline construct(Type&& function)
            {
                this->construct_lambda_function(std::move(function));
            }

            template<int... ints>
            void
            inline construct_maybe_void_function(std::function<void()> void_function, sequence<ints...> seq)
            {
                this->value = (Function)[void_function](){void_function();return Variable();};
            }

            template<typename... Args, int... ints>
            typename std::enable_if<(sizeof...(Args) > 0),void>::type
            inline construct_maybe_void_function(std::function<void(Args...)> void_function, sequence<ints...> seq)
            {
                auto function = (FunctionTemplate<Variable(Args...)>)[void_function](Args... args){void_function(args...);return Variable();};
                this->value = *(Function*)&function;
            }

            template<typename ReturnType, int... ints>
            void
            inline construct_maybe_void_function(std::function<ReturnType()> function, sequence<ints...> seq)
            {
                this->value = (Function)function;
            }

            template<typename ReturnType, typename... Args, int... ints>
            typename std::enable_if<(sizeof...(Args) > 0),void>::type
            inline construct_maybe_void_function(std::function<ReturnType(Args...)> function, sequence<ints...> seq)
            {
                auto temp_function = (FunctionTemplate<Variable(Args...)>)function;
                this->value = *(Function*)&temp_function;
            }

            template<typename ReturnType, typename... Args>
            void inline construct_function(std::function<ReturnType(Args...)>&& function)
            {
                static constexpr std::size_t arity = sizeof...(Args);
                this->construct_maybe_void_function(std::move(function),typename make_sequence<arity==0?arity:arity-1>::type());
            }

            template<typename Type>
            typename std::enable_if<std::is_convertible<typename std::remove_reference<Type>::type,std::function<typename std::remove_reference<Type>::type>>::value,void>::type
            inline construct(Type&& function)
            {
                this->construct_function((std::function<typename std::remove_reference<Type>::type>)function);
            }

            template<typename Type>
            typename std::enable_if<std::is_integral<Type>::value,Type>::type
            inline convert() const
            {
                if(this->value.type() == this->value.type<Integer>())
                {
                    return (Integer)this->value;
                }
                else if(this->value.type() == this->value.type<Natural>())
                {
                    return (Natural)this->value;
                }
                else if(this->value.type() == this->value.type<Char>())
                {
                    return (Char)this->value;
                }
                else if(this->value.type() == this->value.type<Bool>())
                {
                    return (Bool)this->value;
                }
                else
                {
                    assert("Variable cannot be converted to given type, as it is not currently storing an integral type. This is a fatal error!");
                    return -1;
                }
            }

            template<typename Type>
            typename std::enable_if<std::is_floating_point<Type>::value,Type>::type
            inline convert() const
            {
                return (Double)this->value;
            }

            template<typename Type>
            typename std::enable_if<std::is_convertible<String,Type>::value,Type>::type
            inline convert() const
            {
                return (String)this->value;
            }

            template<typename Type>
            typename std::enable_if<std::is_same<Type,Map>::value,Type>::type
            inline convert() const
            {
                return (Map)this->value;
            }

            template<typename Type>
            typename std::enable_if<std::is_convertible<const char*,Type>::value && !std::is_convertible<std::string,Type>::value && !std::is_same<Type,Bool>::value,Type>::type
            inline convert() const
            {
                return ((std::string)this->value).c_str();
            }

            Map inline static make_array_from_initializer_list(std::initializer_list<Variable>&& other)
            {
                Map temp;
                Natural size = 0;
                for(auto&& element: other)
                {
                    temp.insert(std::make_pair(size++,element));
                }
                return std::move(temp);
            }

        public:
            inline bool is_integral() const noexcept
            {
                return this->value.is<Integer>() || this->value.is<Natural>() || this->value.is<Char>() || this->value.is<Bool>();
            }

            inline bool is_bool() const noexcept
            {
                return this->value.is<Bool>();
            }

            inline bool is_integer() const noexcept
            {
                return this->value.is<Integer>() || this->value.is<Natural>();
            }

            inline bool is_signed_integer() const noexcept
            {
                return this->value.is<Integer>();
            }

            inline bool is_unsigned_integer() const noexcept
            {
                return this->value.is<Natural>();
            }

            inline bool is_char() const noexcept
            {
                return this->value.is<Char>();
            }

            inline bool is_string() const noexcept
            {
                return this->value.is<String>();
            }

            inline bool is_array() const noexcept
            {
                return this->value.is<Map>();
            }

            inline bool is_multiline_in_output() const noexcept
            {
                return this->value.is<Map>();
            }

            inline bool is_function() const noexcept
            {
                return this->value.is<Function>();
            }

            Variable() : value((Natural)0)
            {

            }

            ~Variable()
            {

            }

            template<typename Type>
            Variable(Type&& other) : value((Natural)0)
            {
                this->construct(std::forward<Type>(other));
            }

            Variable(Variable& other) : value(other.value)
            {

            }

            Variable(const Variable& other) : value(other.value)
            {

            }

            Variable(Variable&& other) : value(other.value)
            {

            }

            Variable(std::initializer_list<Variable>&& other) : value(this->make_array_from_initializer_list(std::forward<std::initializer_list<Variable>>(other)))
            {

            }

            Variable& operator = (const Variable& other)
            {
                this->value = other.value;
                return *this;
            }

            Variable& operator = (Variable&& other)
            {
                other.value.swap(this->value);
                return *this;
            }

            template<typename Integral>
            typename std::enable_if<std::is_integral<Integral>::value,Variable>::type
            operator [] (Integral index) const
            {
                if(this->is_string())
                {
                    return (Variable)(Char)this->operator String ()[index];
                }
                else if(this->is_array())
                {
                    return this->operator Map ()[index];
                }
                else if(this->is_signed_integer())
                {
                    return std::bitset<sizeof(Integer)*8>(this->operator Integer ())[index].operator bool ();
                }
                else if(this->is_unsigned_integer())
                {
                    return std::bitset<sizeof(Natural)*8>(this->operator Natural ())[index].operator bool ();
                }
                else if(this->is_char())
                {
                    return std::bitset<sizeof(Char)*8>(this->operator Char ())[index].operator bool ();
                }
            }

            template<typename Integral>
            typename std::enable_if<std::is_integral<Integral>::value,Variable&>::type
            operator [] (Integral index)
            {
                if(this->is_array())
                {
                    return this->value.get<Map>()[index];
                }
            }

            template<typename Other>
            typename std::enable_if<!std::is_integral<Other>::value,Variable>::type
            operator [] (Other index) const
            {
                if(this->is_array())
                {
                    return this->operator Map ()[index];
                }
            }

            template<typename Other>
            typename std::enable_if<!std::is_integral<Other>::value,Variable&>::type
            operator [] (Other index)
            {
                if(this->is_array())
                {
                    return this->value.get<Map>()[index];
                }
            }

            template<typename... Args>
            Variable operator () (Args... args)
            {
                Function function = (Function)this->value;
                return (*(FunctionTemplate<Variable(Args...)>*)(&function))(args...);
            }

            template<typename Type>
            explicit operator Type () const
            {
                return this->convert<Type>();
            }

            std::size_t size() const noexcept
            {
                return this->value.size();
            }

            std::uint64_t hash() const noexcept
            {
                std::uint64_t hash;
                if(this->size() <= sizeof(std::uint64_t))
                {
                    hash = *(std::uint64_t*)&this->value;
                }
                else
                {
                    hash = 14695981039346656037ul;
                    void* data = (void*)&this->value;
                    std::size_t size = this->size();
                    for(std::uint64_t i = 0; i < size; i++)
                    {
                        hash ^= (std::uint64_t)((std::uint8_t*)data)[i];
                        hash *= 1099511628211ul;
                    }
                }
                return hash;
            }
    };

    namespace detail
    {
        bool compare_variable_function(const Variable& lhs, const Variable& rhs)
        {
            return lhs.hash() < rhs.hash();
        }
    }

    typedef Variable var;
    typedef const Variable let;
} using pera_variable_1::Variable; using pera_variable_1::var; using pera_variable_1::let; }
#endif // PERA_VARIABLE

#endif // PERA_VARIABLE_HPP


text:
require 'cucumber/platform'
require 'cucumber/term/ansicolor'

if Cucumber::WINDOWS_MRI
  unless ENV['ANSICON']
    STDERR.puts %{*** WARNING: You must use ANSICON 1.31 or higher (https://github.com/adoxa/ansicon/) to get coloured output on Windows}
    Cucumber::Term::ANSIColor.coloring = false
  end
end

Cucumber::Term::ANSIColor.coloring = false if !STDOUT.tty? && !ENV.has_key?("AUTOTEST")

module Cucumber
  module Formatter
    # Defines aliases for coloured output. You don't invoke any methods from this
    # module directly, but you can change the output colours by defining
    # a <tt>CUCUMBER_COLORS</tt> variable in your shell, very much like how you can
    # tweak the familiar POSIX command <tt>ls</tt> with
    # $LSCOLORS/$LS_COLORS
    #
    # The colours that you can change are:
    #
    # * <tt>undefined</tt>     - defaults to <tt>yellow</tt>
    # * <tt>pending</tt>       - defaults to <tt>yellow</tt>
    # * <tt>pending_param</tt> - defaults to <tt>yellow,bold</tt>
    # * <tt>failed</tt>        - defaults to <tt>red</tt>
    # * <tt>failed_param</tt>  - defaults to <tt>red,bold</tt>
    # * <tt>passed</tt>        - defaults to <tt>green</tt>
    # * <tt>passed_param</tt>  - defaults to <tt>green,bold</tt>
    # * <tt>outline</tt>       - defaults to <tt>cyan</tt>
    # * <tt>outline_param</tt> - defaults to <tt>cyan,bold</tt>
    # * <tt>skipped</tt>       - defaults to <tt>cyan</tt>
    # * <tt>skipped_param</tt> - defaults to <tt>cyan,bold</tt>
    # * <tt>comment</tt>       - defaults to <tt>grey</tt>
    # * <tt>tag</tt>           - defaults to <tt>cyan</tt>
    #
    # For instance, if your shell has a black background and a green font (like the
    # "Homebrew" settings for OS X' Terminal.app), you may want to override passed
    # steps to be white instead of green.
    #
    # Although not listed, you can also use <tt>grey</tt>.
    #
    # Examples: (On Windows, use SET instead of export.)
    #
    #   export CUCUMBER_COLORS="passed=white"
    #   export CUCUMBER_COLORS="passed=white,bold:passed_param=white,bold,underline"
    #
    # To see what colours and effects are available, just run this in your shell:
    #
    #   ruby -e "require 'rubygems'; require 'term/ansicolor'; puts Cucumber::Term::ANSIColor.attributes"
    #
    module ANSIColor
      include Cucumber::Term::ANSIColor

      ALIASES = Hash.new do |h,k|
        if k.to_s =~ /(.*)_param/
          h[$1] + ',bold'
        end
      end.merge({
        'undefined' => 'yellow',
        'pending'   => 'yellow',
        'failed'    => 'red',
        'passed'    => 'green',
        'outline'   => 'cyan',
        'skipped'   => 'cyan',
        'comment'   => 'grey',
        'tag'       => 'cyan'
      })

      if ENV['CUCUMBER_COLORS'] # Example: export CUCUMBER_COLORS="passed=red:failed=yellow"
        ENV['CUCUMBER_COLORS'].split(':').each do |pair|
          a = pair.split('=')
          ALIASES[a[0]] = a[1]
        end
      end

      # Eval to define the color-named methods required by Term::ANSIColor.
      #
      # Examples:
      #
      #   def failed(string=nil, &proc)
      #     red(string, &proc)
      #   end
      #
      #   def failed_param(string=nil, &proc)
      #     red(bold(string, &proc)) + red
      #   end
      ALIASES.each_key do |method_name|
        unless method_name =~ /.*_param/
          code = <<-EOF
          def #{method_name}(string=nil, &proc)
            #{ALIASES[method_name].split(",").join("(") + "(string, &proc" + ")" * ALIASES[method_name].split(",").length}
          end
          # This resets the colour to the non-param colour
          def #{method_name}_param(string=nil, &proc)
            #{ALIASES[method_name+'_param'].split(",").join("(") + "(string, &proc" + ")" * ALIASES[method_name+'_param'].split(",").length} + #{ALIASES[method_name].split(",").join(' + ')}
          end
          EOF
          eval(code)
        end
      end

      def self.define_grey #:nodoc:
        begin
          gem 'genki-ruby-terminfo'
          require 'terminfo'
          case TermInfo.default_object.tigetnum("colors")
          when 0
            raise "Your terminal doesn't support colours."
          when 1
            ::Cucumber::Term::ANSIColor.coloring = false
            alias grey white
          when 2..8
            alias grey white
          else
            define_real_grey
          end
        rescue Exception => e
          if e.class.name == 'TermInfo::TermInfoError'
            STDERR.puts "*** WARNING ***"
            STDERR.puts "You have the genki-ruby-terminfo gem installed, but you haven't set your TERM variable."
            STDERR.puts "Try setting it to TERM=xterm-256color to get grey colour in output."
            STDERR.puts "\n"
            alias grey white
          else
            define_real_grey
          end
        end
      end

      def self.define_real_grey #:nodoc:
        def grey(string) #:nodoc:
          if ::Cucumber::Term::ANSIColor.coloring?
            "\e[90m#{string}\e[0m"
          else
            string
          end
        end
      end

      define_grey

      def cukes(n)
        ("(::) " * n).strip
      end

      def green_cukes(n)
        blink(green(cukes(n)))
      end

      def red_cukes(n)
        blink(red(cukes(n)))
      end

      def yellow_cukes(n)
        blink(yellow(cukes(n)))
      end
    end
  end
end


text:
mojom
====

mojom.dart files will appear here after running the generate script (see the
top-level documentation for this package).


text:
#region license
// Sqloogle
// Copyright 2013-2017 Dale Newman
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//       http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#endregion
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using Sqloogle.Libs.DBDiff.Schema.Attributes;
using Sqloogle.Libs.DBDiff.Schema.Model;
using Sqloogle.Libs.DBDiff.Schema.SqlServer2005.Options;

namespace Sqloogle.Libs.DBDiff.Schema.SqlServer2005.Model
{
    public class Database : SQLServerSchemaBase, IDatabase
    {
        private readonly List<DatabaseChangeStatus> _changesOptions;
        private DatabaseInfo _info;

        public Database() : base(null, Enums.ObjectType.Database)
        {
            AllObjects = new SearchSchemaBase();
            _changesOptions = new List<DatabaseChangeStatus>();
            Dependencies = new Dependencies();
            TablesTypes = new SchemaList<TableType, Database>(this, AllObjects);
            UserTypes = new SchemaList<UserDataType, Database>(this, AllObjects);
            XmlSchemas = new SchemaList<XMLSchema, Database>(this, AllObjects);
            Schemas = new SchemaList<Schema, Database>(this, AllObjects);
            Procedures = new SchemaList<StoreProcedure, Database>(this, AllObjects);
            CLRProcedures = new SchemaList<CLRStoreProcedure, Database>(this, AllObjects);
            CLRFunctions = new SchemaList<CLRFunction, Database>(this, AllObjects);
            FileGroups = new SchemaList<FileGroup, Database>(this);
            Rules = new SchemaList<Rule, Database>(this, AllObjects);
            DDLTriggers = new SchemaList<Trigger, Database>(this, AllObjects);
            Synonyms = new SchemaList<Synonym, Database>(this, AllObjects);
            Assemblies = new SchemaList<Assembly, Database>(this, AllObjects);
            Views = new SchemaList<View, Database>(this, AllObjects);
            Users = new SchemaList<User, Database>(this, AllObjects);
            FullText = new SchemaList<FullText, Database>(this, AllObjects);
            Functions = new SchemaList<Function, Database>(this, AllObjects);
            PartitionFunctions = new SchemaList<PartitionFunction, Database>(this, AllObjects);
            PartitionSchemes = new SchemaList<PartitionScheme, Database>(this, AllObjects);
            Roles = new SchemaList<Role, Database>(this);
            Tables = new SchemaList<Table, Database>(this, AllObjects);
            Defaults = new SchemaList<Default, Database>(this, AllObjects);
            ActionMessage = new SqlAction(this);
        }

        internal SearchSchemaBase AllObjects { get; private set; }

        [ShowItem("Full Text Catalog", "FullText")]
        public SchemaList<FullText, Database> FullText { get; private set; }

        [ShowItem("Table Type", "Table")]
        public SchemaList<TableType, Database> TablesTypes { get; private set; }

        [ShowItem("Partition Scheme", "PartitionScheme")]
        public SchemaList<PartitionScheme, Database> PartitionSchemes { get; private set; }

        [ShowItem("Partition Functions", "PartitionFunction")]
        public SchemaList<PartitionFunction, Database> PartitionFunctions { get; private set; }

        [ShowItem("Defaults")]
        public SchemaList<Default, Database> Defaults { get; private set; }

        [ShowItem("Roles", "Rol")]
        public SchemaList<Role, Database> Roles { get; private set; }

        [ShowItem("Functions", "Function", true)]
        public SchemaList<Function, Database> Functions { get; private set; }

        [ShowItem("Users", "User")]
        public SchemaList<User, Database> Users { get; private set; }

        [ShowItem("Views", "View", true)]
        public SchemaList<View, Database> Views { get; private set; }

        [ShowItem("Assemblies", "Assembly")]
        public SchemaList<Assembly, Database> Assemblies { get; private set; }

        [ShowItem("Synonyms")]
        public SchemaList<Synonym, Database> Synonyms { get; private set; }

        [ShowItem("DLL Triggers")]
        public SchemaList<Trigger, Database> DDLTriggers { get; private set; }

        [ShowItem("File Groups")]
        public SchemaList<FileGroup, Database> FileGroups { get; private set; }

        [ShowItem("Rules")]
        public SchemaList<Rule, Database> Rules { get; private set; }

        [ShowItem("Store Procedures", "Procedure", true)]
        public SchemaList<StoreProcedure, Database> Procedures { get; private set; }

        [ShowItem("CLR Store Procedures", "CLRProcedure", true)]
        public SchemaList<CLRStoreProcedure, Database> CLRProcedures { get; private set; }

        [ShowItem("CLR Functions", "CLRFunction", true)]
        public SchemaList<CLRFunction, Database> CLRFunctions { get; private set; }

        [ShowItem("Schemas", "Schema")]
        public SchemaList<Schema, Database> Schemas { get; private set; }

        [ShowItem("XML Schemas", "XMLSchema")]
        public SchemaList<XMLSchema, Database> XmlSchemas { get; private set; }

        [ShowItem("Tables", "Table")]
        public SchemaList<Table, Database> Tables { get; private set; }

        [ShowItem("User Types", "UDT")]
        public SchemaList<UserDataType, Database> UserTypes { get; private set; }

        public SqlOption Options { get; set; }

        public DatabaseInfo Info
        {
            get { return _info; }
            set { _info = value; }
        }

        public DatabaseInfo SourceInfo
        {
            get;
            set;
        }

        /// <summary>
        /// Coleccion de dependencias de constraints.
        /// </summary>
        internal Dependencies Dependencies { get; set; }

        private List<DatabaseChangeStatus> ChangesOptions
        {
            get { return _changesOptions; }
        }

        #region IDatabase Members

        public override ISchemaBase Clone(ISchemaBase parent)
        {
            //Get a list of all of the objects that are SchemaLists, so that we can clone them all.
            var item = new Database() { AllObjects = this.AllObjects };

            var explicitProperties = (from properties in this.GetType().GetProperties(BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Public)
                                      where properties.PropertyType.GetInterface(typeof(DBDiff.Schema.Model.ISchemaList<Code, Database>).Name) != null
                                      select properties).ToList();

            foreach (var property in explicitProperties)
            {
                object value = property.GetValue(this, null);

                //Clone the value
                value = value.GetType().GetMethod("Clone").Invoke(value, new object[] { this });

                //Set the value to the cloned object
                property.SetValue(item, value, null);
            }

            return item;
        }

        public SqlAction ActionMessage { get; private set; }

        public Boolean IsCaseSensity
        {
            get
            {
                bool isCS = false;
                if (!String.IsNullOrEmpty(_info.Collation))
                    isCS = _info.Collation.IndexOf("_CS_") != -1;

                if (Options.Comparison.CaseSensityType == SqlOptionComparison.CaseSensityOptions.Automatic)
                    return isCS;
                if (Options.Comparison.CaseSensityType == SqlOptionComparison.CaseSensityOptions.CaseSensity)
                    return true;
                if (Options.Comparison.CaseSensityType == SqlOptionComparison.CaseSensityOptions.CaseInsensity)
                    return false;

                return false;
            }
        }

        public override string ToSql()
        {
            string sql = "";
            sql += FileGroups.ToSql();
            sql += Schemas.ToSql();
            sql += XmlSchemas.ToSql();
            sql += Rules.ToSql();
            sql += UserTypes.ToSql();
            sql += Assemblies.ToSql();
            sql += Tables.ToSql();
            sql += Functions.ToSql();
            sql += Procedures.ToSql();
            sql += CLRProcedures.ToSql();
            sql += CLRFunctions.ToSql();
            sql += DDLTriggers.ToSql();
            sql += Synonyms.ToSql();
            sql += Views.ToSql();
            sql += Users.ToSql();
            sql += PartitionFunctions.ToSql();
            sql += FullText.ToSql();
            return sql;
        }

        /*public List<ISchemaBase> FindAllByColumn(String ColumnName)
        {
            this.t
        }*/

        public override SQLScriptList ToSqlDiff()
        {
			return ToSqlDiff(new List<ISchemaBase>());
		}
        public override SQLScriptList ToSqlDiff(List<ISchemaBase> schemas)
        {
            var isAzure10 = this.Info.Version == DatabaseInfo.VersionTypeEnum.SQLServerAzure10;

            var listDiff = new SQLScriptList();
            listDiff.Add(new SQLScript(String.Format(@"/*

    Open DBDiff {0}
    http://opendbiff.codeplex.com/

    Script created by {1}\{2} on {3} at {4}.

    Created on:  {5}
    Source:      {6} on {7}
    Destination: {8} on {9}

*/

",
                System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString(),
                Environment.UserDomainName,
                Environment.UserName,
                DateTime.Now.ToShortDateString(),
                DateTime.Now.ToLongTimeString(),
                Environment.MachineName,
                SourceInfo != null ? SourceInfo.Database : "Uknown",
                SourceInfo != null ? SourceInfo.Server : "Uknown",
                Info != null ? Info.Database : "Uknown",
                Info != null ? Info.Server : "Uknown",
                0), 0, Enums.ScripActionType.None));
            if (!isAzure10)
            {
                listDiff.Add("USE [" + Name + "]\r\nGO\r\n\r\n", 0, Enums.ScripActionType.UseDatabase);
                listDiff.AddRange(Assemblies.ToSqlDiff(schemas));
                listDiff.AddRange(UserTypes.ToSqlDiff(schemas));
            }
			listDiff.AddRange(TablesTypes.ToSqlDiff(schemas));
			listDiff.AddRange(Tables.ToSqlDiff(schemas));
			listDiff.AddRange(Rules.ToSqlDiff(schemas));
			listDiff.AddRange(Schemas.ToSqlDiff(schemas));
			listDiff.AddRange(XmlSchemas.ToSqlDiff(schemas));
			listDiff.AddRange(Procedures.ToSqlDiff(schemas));
            if (!isAzure10)
            {
                listDiff.AddRange(CLRProcedures.ToSqlDiff(schemas));
                listDiff.AddRange(CLRFunctions.ToSqlDiff(schemas));
                listDiff.AddRange(FileGroups.ToSqlDiff(schemas));
            }
			listDiff.AddRange(DDLTriggers.ToSqlDiff(schemas));
			listDiff.AddRange(Synonyms.ToSqlDiff(schemas));
			listDiff.AddRange(Views.ToSqlDiff(schemas));
			listDiff.AddRange(Users.ToSqlDiff(schemas));
			listDiff.AddRange(Functions.ToSqlDiff(schemas));
			listDiff.AddRange(Roles.ToSqlDiff(schemas));
			listDiff.AddRange(PartitionFunctions.ToSqlDiff(schemas));
			listDiff.AddRange(PartitionSchemes.ToSqlDiff(schemas));
            if (!isAzure10)
            {
                listDiff.AddRange(FullText.ToSqlDiff(schemas));
            }
            return listDiff;
        }

        public override string ToSqlDrop()
        {
            return "";
        }

        public override string ToSqlAdd()
        {
            return "";
        }

        #endregion

        public ISchemaBase Find(int id)
        {
            try
            {
                string full = AllObjects.GetFullName(id);
                return Find(full);
            }
            catch
            {
                return null;
            }
        }

        public ISchemaBase Find(String _FullName)
        {
            try
            {
                Enums.ObjectType type = AllObjects.GetType(_FullName);
                string parentName = "";

                switch (type)
                {
                    case Enums.ObjectType.Table:
                        return Tables[_FullName];
                    case Enums.ObjectType.StoreProcedure:
                        return Procedures[_FullName];
                    case Enums.ObjectType.Function:
                        return Functions[_FullName];
                    case Enums.ObjectType.View:
                        return Views[_FullName];
                    case Enums.ObjectType.Assembly:
                        return Assemblies[_FullName];
                    case Enums.ObjectType.UserDataType:
                        return UserTypes[_FullName];
                    case Enums.ObjectType.TableType:
                        return TablesTypes[_FullName];
                    case Enums.ObjectType.XMLSchema:
                        return XmlSchemas[_FullName];
                    case Enums.ObjectType.CLRStoreProcedure:
                        return CLRProcedures[_FullName];
                    case Enums.ObjectType.CLRFunction:
                        return CLRFunctions[_FullName];
                    case Enums.ObjectType.Synonym:
                        return Synonyms[_FullName];
                    case Enums.ObjectType.FullText:
                        return FullText[_FullName];
                    case Enums.ObjectType.Rule:
                        return Rules[_FullName];
                    case Enums.ObjectType.PartitionFunction:
                        return PartitionFunctions[_FullName];
                    case Enums.ObjectType.PartitionScheme:
                        return PartitionSchemes[_FullName];
                    case Enums.ObjectType.Role:
                        return Roles[_FullName];
                    case Enums.ObjectType.Schema:
                        return Schemas[_FullName];
                    case Enums.ObjectType.Constraint:
                        parentName = AllObjects.GetParentName(_FullName);
                        return Tables[parentName].Constraints[_FullName];
                    case Enums.ObjectType.Index:
                        parentName = AllObjects.GetParentName(_FullName);
                        type = AllObjects.GetType(parentName);
                        if (type == Enums.ObjectType.Table)
                            return Tables[parentName].Indexes[_FullName];
                        return Views[parentName].Indexes[_FullName];
                    case Enums.ObjectType.Trigger:
                        parentName = AllObjects.GetParentName(_FullName);
                        type = AllObjects.GetType(parentName);
                        if (type == Enums.ObjectType.Table)
                            return Tables[parentName].Triggers[_FullName];
                        return Views[parentName].Triggers[_FullName];
                    case Enums.ObjectType.CLRTrigger:
                        parentName = AllObjects.GetParentName(_FullName);
                        type = AllObjects.GetType(parentName);
                        if (type == Enums.ObjectType.Table)
                            return Tables[parentName].CLRTriggers[_FullName];
                        return Views[parentName].CLRTriggers[_FullName];
                }
                return null;
            }
            catch
            {
                return null;
            }
        }

        /*private SQLScriptList CleanScripts(SQLScriptList listDiff)
        {
            SQLScriptList alters = listDiff.FindAlter();
            for (int j = 0; j < alters.Count; j++)
            {
                //alters[j].
            }
            return null;
        }*/

        public void BuildDependency()
        {
            ISchemaBase schema;
            var indexes = new List<Index>();
            var constraints = new List<Constraint>();

            Tables.ForEach(item => indexes.AddRange(item.Indexes));
            Views.ForEach(item => indexes.AddRange(item.Indexes));
            Tables.ForEach(item => constraints.AddRange(item.Constraints));

            foreach (Index index in indexes)
            {
                schema = index.Parent;
                foreach (IndexColumn icolumn in index.Columns)
                {
                    Dependencies.Add(this, schema.Id, icolumn.Id, schema.Id, icolumn.DataTypeId, index);
                }
            }

            foreach (Constraint con in constraints)
            {
                schema = con.Parent;
                if (con.Type != Constraint.ConstraintType.Check)
                {
                    foreach (ConstraintColumn ccolumn in con.Columns)
                    {
                        Dependencies.Add(this, schema.Id, ccolumn.Id, schema.Id, ccolumn.DataTypeId, con);
                        if (con.Type == Constraint.ConstraintType.ForeignKey)
                        {
                            Dependencies.Add(this, con.RelationalTableId, ccolumn.ColumnRelationalId, schema.Id,
                                             ccolumn.ColumnRelationalDataTypeId, con);
                        }
                        else
                        {
                            if (
                                ((Table) schema).FullTextIndex.Exists(
                                    item => { return item.Index.Equals(con.Name); }))
                            {
                                Dependencies.Add(this, schema.Id, 0, schema.Id, 0, con);
                            }
                        }
                    }
                }
                else
                    Dependencies.Add(this, schema.Id, 0, schema.Id, 0, con);
            }
        }

        #region Nested type: DatabaseChangeStatus

        private enum DatabaseChangeStatus
        {
            AlterChangeTracking = 1,
            AlterCollation = 2
        }

        #endregion
    }
}


text:
FROM blacklabelops/rust-server

RUN apt-get update && \
    apt-get install -y --no-install-recommends \
    vim && \
    rm -rf /var/lib/apt/lists/*

# Setup restart support (for update automation)
ADD restart_app/ /restart_app/
WORKDIR /restart_app
RUN npm install

COPY docker-entrypoint.sh /
ENTRYPOINT ["/docker-entrypoint.sh"]
WORKDIR /steamcmd/rust
CMD ["rust"]


text:
<?php defined('BX_DOL') or die('hack attempt');

class BxNtfsDb extends BxBaseModNotificationsDb
{
    protected $_sTableEvt2Usr;

    /*
     * Constructor.
     */
    function __construct(&$oConfig)
    {
        parent::__construct($oConfig);

        $this->_aDeliveryTypes = array(
            BX_BASE_MOD_NTFS_DTYPE_SITE,
            BX_BASE_MOD_NTFS_DTYPE_EMAIL,
            BX_BASE_MOD_NTFS_DTYPE_PUSH
        );

        $this->_sTableEvt2Usr = $this->_sPrefix . 'events2users';
    }

    public function markAsRead($iUserId, $iEventId)
    {
    	$sSql = $this->prepare("REPLACE `" . $this->_sTableEvt2Usr . "` SET `user_id`=?, `event_id`=?", $iUserId, $iEventId);
    	return (int)$this->query($sSql) > 0;
    }

    public function getLastRead($iUserId)
    {
        return (int)$this->getOne("SELECT `event_id` FROM `" . $this->_sTableEvt2Usr . "` WHERE `user_id`=:user_id LIMIT 1", array(
            'user_id' => (int)$iUserId
        ));
    }

    protected function _getSqlPartsEvents($aParams)
    {
        list($sMethod, $sSelectClause, $sJoinClause, $sWhereClause, $sOrderClause, $sLimitClause) = parent::_getSqlPartsEvents($aParams);

        switch($aParams['browse']) {
            case 'list':
                if(!empty($aParams['count_only'])) {
                    $sMethod = 'getOne';
                    $sSelectClause = 'COUNT(DISTINCT `' . $this->_sTable . '`.`id`)';
                }
                else if(in_array($aParams['type'], array(BX_BASE_MOD_NTFS_TYPE_CONNECTIONS, BX_NTFS_TYPE_OBJECT_OWNER_AND_CONNECTIONS)))
                    $sSelectClause  = 'DISTINCT ' . $sSelectClause;

                break;
        }

        $sJoinClause .= " INNER JOIN `{$this->_sTableSettings}` ON `{$this->_sTableHandlers}`.`id`=`{$this->_sTableSettings}`.`handler_id` AND `{$this->_sTableSettings}`.`delivery`='" . BX_BASE_MOD_NTFS_DTYPE_SITE . "' AND `{$this->_sTableSettings}`.`active`='1'";
        $sJoinClause .= "LEFT JOIN `{$this->_sTableSettings2Users}` ON `{$this->_sTableSettings}`.`id`=`{$this->_sTableSettings2Users}`.`setting_id` ";

        return array($sMethod, $sSelectClause, $sJoinClause, $sWhereClause, $sOrderClause, $sLimitClause);
    }

    protected function _getSqlPartsEventsList($aParams)
    {
        $sJoinClause = $sWhereClause = "";

        if(isset($aParams['active']))
            $sWhereClause .= $this->prepareAsString("AND `{$this->_sTable}`.`active`=? ", (int)$aParams['active']);

        //--- Apply modules or handlers filter
        $sWhereModuleFilter = '';
        if(!empty($aParams['modules']) && is_array($aParams['modules']))
            $sWhereModuleFilter = "AND `" . $this->_sTable . "`.`type` IN (" . $this->implode_escape($aParams['modules']) . ") ";

        if($sWhereModuleFilter == '') {
            $aHidden = $this->_oConfig->getHandlersHidden();
            $sWhereModuleFilter = !empty($aHidden) && is_array($aHidden) ? "AND `" . $this->_sTableHandlers . "`.`id` NOT IN (" . $this->implode_escape($aHidden) . ") " : "";
        }

        if($sWhereModuleFilter != '')
            $sWhereClause .= $sWhereModuleFilter;

        //--- Check flag 'New'
        if(!empty($aParams['new']) && !empty($aParams['owner_id']))
            $sWhereClause .= $this->prepareAsString("AND `{$this->_sTable}`.`id`>? ", $this->getLastRead((int)$aParams['owner_id']));

        //--- Check type
        if(!empty($aParams['owner_id']))
            switch($aParams['type']) {
                case BX_BASE_MOD_NTFS_TYPE_OWNER:
                    $sWhereClause .= $this->prepareAsString("AND `{$this->_sTable}`.`owner_id`=? ", $aParams['owner_id']);
                    break;

                case BX_BASE_MOD_NTFS_TYPE_OBJECT_OWNER:
                    $sWhereClause .= $this->prepareAsString("AND `{$this->_sTable}`.`owner_id`<>`{$this->_sTable}`.`object_owner_id` AND `{$this->_sTable}`.`object_owner_id`=? ", $aParams['owner_id']);
                    $sWhereClause .= $this->prepareAsString("AND `{$this->_sTableSettings}`.`type`=? AND `{$this->_sTableSettings}`.`active`='1' AND (ISNULL(`{$this->_sTableSettings2Users}`.`active`) OR `{$this->_sTableSettings2Users}`.`active`='1') ", BX_NTFS_STYPE_PERSONAL);
                    break;

                case BX_BASE_MOD_NTFS_TYPE_CONNECTIONS:
                    $oConnection = BxDolConnection::getObjectInstance($this->_oConfig->getObject('conn_subscriptions'));
                    $aQueryParts = $oConnection->getConnectedContentAsSQLParts($this->_sPrefix . "events", 'owner_id', $aParams['owner_id']);
                    if(empty($aQueryParts) || !is_array($aQueryParts) || empty($aQueryParts['join']))
                        break;

                    $sJoinClause .= " LEFT JOIN `sys_profiles` AS `tsp` ON `{$this->_sTable}`.`owner_id`=`tsp`.`id` " . $aQueryParts['join'];

                    if(!empty($aQueryParts['fields']['added']))
                        $sWhereClause .= "AND `{$this->_sTable}`.`date` > " . $aQueryParts['fields']['added'];

                    list($aModulesProfiles, $aModulesContexts) = $this->_oConfig->getProfileBasedModules();
                    $sWhereClause .= $this->prepareAsString("AND ((`{$this->_sTableSettings}`.`type`=? AND `tsp`.`type` IN (" . $this->implode_escape($aModulesProfiles) . ")) || (`{$this->_sTableSettings}`.`type`=? AND `tsp`.`type` IN (" . $this->implode_escape($aModulesContexts) . "))) ", BX_NTFS_STYPE_FOLLOW_MEMBER, BX_NTFS_STYPE_FOLLOW_CONTEXT);
                    break;

                case BX_NTFS_TYPE_OBJECT_OWNER_AND_CONNECTIONS:
                    $sWhereClauseObjectOwner = $this->prepareAsString("`{$this->_sTable}`.`owner_id` <> `{$this->_sTable}`.`object_owner_id` AND `{$this->_sTable}`.`object_owner_id`=? ", $aParams['owner_id']);
                    $sWhereClauseObjectOwner .= $this->prepareAsString("AND `{$this->_sTableSettings}`.`type`=?", BX_NTFS_STYPE_PERSONAL);

                    $sWhereClauseConnections = '0';
                    $oConnection = BxDolConnection::getObjectInstance($this->_oConfig->getObject('conn_subscriptions'));
                    $aQueryParts = $oConnection->getConnectedContentAsSQLPartsExt($this->_sTable, 'owner_id', $aParams['owner_id']);
                    if(!empty($aQueryParts) && is_array($aQueryParts) && !empty($aQueryParts['join'])) {
                        $sJoinClause .= " LEFT JOIN `sys_profiles` AS `tsp` ON `{$this->_sTable}`.`owner_id`=`tsp`.`id`";
                        $sJoinClause .= " LEFT JOIN `" . $aQueryParts['join']['table'] . "` AS `" . $aQueryParts['join']['table_alias'] . "` ON (" . $aQueryParts['join']['condition'] . ")";

                        $sWhereClauseConnections = "NOT ISNULL(`c`.`content`) ";
                        if(!empty($aQueryParts['fields']['added']))
                            $sWhereClauseConnections .= "AND `{$this->_sTable}`.`date` > `" . $aQueryParts['fields']['added']['table_alias'] . "`.`" . $aQueryParts['fields']['added']['name'] . "` ";

                        list($aModulesProfiles, $aModulesContexts) = $this->_oConfig->getProfileBasedModules();
                        $sWhereClauseConnections .= $this->prepareAsString("AND ((`{$this->_sTableSettings}`.`type`=? AND `tsp`.`type` IN (" . $this->implode_escape($aModulesProfiles) . ")) || (`{$this->_sTableSettings}`.`type`=? AND `tsp`.`type` IN (" . $this->implode_escape($aModulesContexts) . "))) ", BX_NTFS_STYPE_FOLLOW_MEMBER, BX_NTFS_STYPE_FOLLOW_CONTEXT);
                    }

                    $sWhereClause .= "AND ((" . $sWhereClauseObjectOwner . ") || (" . $sWhereClauseConnections . ")) AND `{$this->_sTableSettings}`.`active`='1' AND (ISNULL(`{$this->_sTableSettings2Users}`.`active`) OR `{$this->_sTableSettings2Users}`.`active`='1') ";
                    break;
            }

        return array($sJoinClause, $sWhereClause);
    }
}

/** @} */


text:
alter table user_contacts rename to user_phone_contacts;
drop index idx_user_contacts_owner_user_id_is_deleted;
alter table user_phone_contacts drop constraint user_contacts_pkey;
alter table user_phone_contacts add primary key (owner_user_id, contact_user_id);

create table user_contacts (
   owner_user_id int not null,
   contact_user_id int not null,
   name varchar(255),
   access_salt varchar(255) not null,
   is_deleted boolean not null default false,
   primary key (owner_user_id, contact_user_id)
);
create INDEX idx_user_contacts_owner_user_id_is_deleted on user_contacts(owner_user_id, is_deleted);

alter table user_phone_contacts inherit user_contacts;

create table user_email_contacts (
    email varchar(255),
    primary key(owner_user_id, contact_user_id)
) inherits(user_contacts);


text:
<?php

    // Checa se classe ja existe antes de defini-la
    if (!class_exists('Connection')):

    /**
     *
     * Classe PDO para Conexão com Banco de Dados.
     * Usa informações da Classe Abstrata System (Arquivo de Configuração), criada a partir da instalação, para fazer a conexão
     *
     * @version 1.0
     * @author Yan Gabriel da Silva Machado <yangsmachado@gmail.com>
     *
     */
    final class Connection extends PDO {
        private $handle = null;

        /**
         *
         * @var $dsn String
         * @var $user String Usuario do Banco de Dados
         * @var $password String Senha do Banco de dados
         */
        public function __construct (string $dsn = '', string $user = '', string $password = '') {
            if ($this->handle == null) {
                try {
                    if (empty($dsn) || empty($user) || empty($password)) {
                        if (class_exists('System')) {
                            $dsn = System::CONFIG['database']['dsn'];
                            $user = System::CONFIG['mysql']['user'];
                            $password = System::CONFIG['mysql']['password'];
                        }
                    }

                    $this->handle = parent::__construct($dsn, $user, $password, []);
                } catch (PDOException $e) {
                    die($e->getMessage());
                }
            } else {
                die('Erro Interno.
Por favor, entre em contato com o Administrador do Sistema.');
            }
        }

        public function __destruct() {
            $this->handle = null;
        }
    }

    endif;