Add a lot
This commit is contained in:
1 parent
d9e043c468
commit
561bfbf475
34 files changed
+1692
-1055
No files matched your search
@@ -10,12 +10,15 @@ RewriteRule ^ - [L]
|
||||
# RewriteCond %{HTTP_HOST} ^eldotravo.fr$
|
||||
# RewriteRule ^(.*)$ http://www.eldotravo.fr/$1 [R=301,L,E=END:1]
|
||||
|
||||
# Redirection des fichiers static pour contact.sanchez-mathieu.dev
|
||||
RewriteCond %{HTTP_HOST} ^contact.sanchez-mathieu.dev$
|
||||
# Redirection des fichiers static pour contact.sanchez-mathieu.test
|
||||
RewriteCond %{HTTP_HOST} ^contact.sanchez-mathieu.test
|
||||
RewriteCond %{DOCUMENT_ROOT}/static%{REQUEST_URI} -f
|
||||
RewriteRule ^(.*)$ static/$1 [L,E=END:1]
|
||||
|
||||
# RewriteRule ^haute-garonne/toulouse/installation-entretien-climatisation /haute-garonne/toulouse/climatisation.php [L]
|
||||
# Redirection des fichiers static pour contact.sanchez-mathieu.fr
|
||||
RewriteCond %{HTTP_HOST} ^contact.sanchez-mathieu.fr
|
||||
RewriteCond %{DOCUMENT_ROOT}/static%{REQUEST_URI} -f
|
||||
RewriteRule ^(.*)$ static/$1 [L,E=END:1]
|
||||
|
||||
# Redirection de toutes les requêtes vers Index.php
|
||||
RewriteRule ^ index.php [L,E=END:1]
|
||||
@@ -35,7 +35,7 @@ if ( count( $pages ) > 1 && $pages[ count( $pages ) - 1 ] == '' ) {
|
||||
if ( $pages[0] == 'api' && isset( $pages[1] ) && preg_match( '#^([a-z]+)$#', $pages[1], $api1 ) && isset( $pages[2] ) && preg_match( '#^([a-z-]+)$#', $pages[2], $api2 ) ) {
|
||||
new APIRouter( $api1[0], $api2[0] );
|
||||
|
||||
} else if ( preg_match( '#^test\.dev$#', $_SERVER['SERVER_NAME'] ) ) {
|
||||
} else if ( preg_match( '#^contact.sanchez-mathieu\.test$#', $_SERVER[ 'SERVER_NAME' ] ) || preg_match( '#^contact.sanchez-mathieu\.fr#', $_SERVER[ 'SERVER_NAME' ] ) ) {
|
||||
new SiteRouter( $pages );
|
||||
} else {
|
||||
new Error( 404 );
|
||||
|
||||
@@ -0,0 +1,201 @@
|
||||
<?php
|
||||
|
||||
namespace CAUProject3Contact\API;
|
||||
|
||||
use CAUProject3Contact\Model\Contact;
|
||||
|
||||
class APIContact extends API {
|
||||
|
||||
private $declaredFunctions = [
|
||||
'insert' => [
|
||||
'method' => 'POST',
|
||||
'params' => [
|
||||
'firstName' => [
|
||||
'required' => true,
|
||||
'type' => 'string'
|
||||
],
|
||||
'lastName' => [
|
||||
'required' => true,
|
||||
'type' => 'string'
|
||||
],
|
||||
'surname' => [
|
||||
'required' => false,
|
||||
'type' => 'string'
|
||||
],
|
||||
'email' => [
|
||||
'required' => false,
|
||||
'type' => 'string'
|
||||
],
|
||||
'address' => [
|
||||
'required' => false,
|
||||
'type' => 'string'
|
||||
],
|
||||
'phoneNumber' => [
|
||||
'required' => false,
|
||||
'type' => 'string'
|
||||
],
|
||||
'birthday' => [
|
||||
'required' => false,
|
||||
'type' => 'string'
|
||||
],
|
||||
]
|
||||
],
|
||||
'delete' => [
|
||||
'method' => 'POST',
|
||||
'params' => [
|
||||
'id' => [
|
||||
'required' => true,
|
||||
'type' => 'int'
|
||||
]
|
||||
]
|
||||
],
|
||||
'get-contacts' => [
|
||||
'method' => 'GET',
|
||||
'params' => []
|
||||
],
|
||||
'update' => [
|
||||
'method' => 'POST',
|
||||
'params' => [
|
||||
'id' => [
|
||||
'required' => true,
|
||||
'type' => 'int'
|
||||
],
|
||||
'firstName' => [
|
||||
'required' => false,
|
||||
'type' => 'string'
|
||||
],
|
||||
'lastName' => [
|
||||
'required' => false,
|
||||
'type' => 'string'
|
||||
],
|
||||
'surname' => [
|
||||
'required' => false,
|
||||
'type' => 'string'
|
||||
],
|
||||
'email' => [
|
||||
'required' => false,
|
||||
'type' => 'string'
|
||||
],
|
||||
'address' => [
|
||||
'required' => false,
|
||||
'type' => 'string'
|
||||
],
|
||||
'phoneNumber' => [
|
||||
'required' => false,
|
||||
'type' => 'string'
|
||||
],
|
||||
'birthday' => [
|
||||
'required' => false,
|
||||
'type' => 'string'
|
||||
]
|
||||
]
|
||||
],
|
||||
'search' => [
|
||||
'method' => 'POST',
|
||||
'params' => [
|
||||
'query' => [
|
||||
'required' => true,
|
||||
'type' => 'string'
|
||||
]
|
||||
]
|
||||
]
|
||||
];
|
||||
|
||||
/**
|
||||
* APIContact constructor.
|
||||
*
|
||||
* @param array $declaredFunctions
|
||||
*/
|
||||
public function __construct() {
|
||||
parent::__construct( $this->declaredFunctions );
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getDeclaredFunctions() {
|
||||
return $this->declaredFunctions;
|
||||
}
|
||||
|
||||
public function insert( array $data ) {
|
||||
|
||||
$id = Contact::insertNewContact( $data[ "firstName" ], $data[ "lastName" ], $data[ "surname" ],
|
||||
$data[ "email" ], $data[ "address" ], $data[ "phoneNumber" ], $data[ "birthday" ] );
|
||||
|
||||
$this->returnJson( json_encode( [
|
||||
"status" => "success",
|
||||
"data" => [
|
||||
"id" => $id
|
||||
]
|
||||
] ) );
|
||||
}
|
||||
|
||||
public function delete( array $data ) {
|
||||
Contact::deleteContact( $data[ "id" ] );
|
||||
}
|
||||
|
||||
public function getContacts() {
|
||||
$this->returnJson( json_encode( [
|
||||
"contacts" => Contact::getAllContact()
|
||||
] ) );
|
||||
}
|
||||
|
||||
public function update( array $data ) {
|
||||
$contact = Contact::getById( $data[ "id" ] );
|
||||
|
||||
$newData = [];
|
||||
|
||||
if ( $data[ "firstName" ] !== null && $data[ "firstName" ] !== "" ) {
|
||||
$newData[ "first_name" ] = $data[ "firstName" ];
|
||||
}
|
||||
if ( $data[ "lastName" ] !== null && $data[ "lastName" ] !== "" ) {
|
||||
$newData[ "last_name" ] = $data[ "lastName" ];
|
||||
}
|
||||
if ( $data[ "surname" ] !== null && $data[ "surname" ] !== "" ) {
|
||||
$newData[ "surname" ] = $data[ "surname" ];
|
||||
}
|
||||
if ( $data[ "email" ] !== null && $data[ "email" ] !== "" ) {
|
||||
$newData[ "email" ] = $data[ "email" ];
|
||||
}
|
||||
if ( $data[ "address" ] !== null && $data[ "address" ] !== "" ) {
|
||||
$newData[ "address" ] = $data[ "address" ];
|
||||
}
|
||||
if ( $data[ "phoneNumber" ] !== null && $data[ "phoneNumber" ] !== "" ) {
|
||||
$newData[ "phone_number" ] = $data[ "phoneNumber" ];
|
||||
}
|
||||
if ( $data[ "birthday" ] !== null && $data[ "birthday" ] !== "" ) {
|
||||
$newData[ "birthday" ] = date( "Y-m-d", strtotime( $data[ "birthday" ] ) );
|
||||
}
|
||||
|
||||
$contact->updateContact( $newData );
|
||||
$this->returnJson( json_encode( $contact ) );
|
||||
}
|
||||
|
||||
public function search( array $data ) {
|
||||
if ( count_chars( $data[ "query" ] ) >= 3 ) {
|
||||
$result = Contact::search( $data[ "query" ] );
|
||||
if ( $result !== null ) {
|
||||
$this->returnJson( [
|
||||
"status" => "success",
|
||||
"code" => 200,
|
||||
"result" => $result,
|
||||
] );
|
||||
} else {
|
||||
$this->returnJson( [
|
||||
"status" => "error",
|
||||
"code" => 404,
|
||||
"message" => "Nothing find",
|
||||
] );
|
||||
}
|
||||
} else {
|
||||
$this->returnJson( [
|
||||
"status" => "error",
|
||||
"code" => 400,
|
||||
"message" => "Need at least 3 chars",
|
||||
] );
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -14,7 +14,8 @@ class APIError extends Controller {
|
||||
* @param string $publicMessage
|
||||
* @param string $code
|
||||
*/
|
||||
public function __construct( int $ErrCode = 500, string $devMessage = 'Erreur inconnue', string $publicMessage = 'Une erreur inconnue s\'est produite', string $code = '' ) {
|
||||
public function __construct( int $ErrCode = 500, string $devMessage = 'Erreur inconnue',
|
||||
string $publicMessage = 'Une erreur inconnue s\'est produite', string $code = '' ) {
|
||||
parent::__construct();
|
||||
|
||||
$tabCode = [
|
||||
@@ -78,7 +79,7 @@ class APIError extends Controller {
|
||||
];
|
||||
|
||||
header( 'Content-Type: application/json' );
|
||||
header( $_SERVER['SERVER_PROTOCOL'] . ' ' . $tabCode[ $ErrCode ]['label'] );
|
||||
header( $_SERVER[ 'SERVER_PROTOCOL' ] . ' ' . $tabCode[ $ErrCode ][ 'label' ] );
|
||||
echo json_encode( [
|
||||
'status' => 'echec',
|
||||
'msg' => $publicMessage,
|
||||
|
||||
+24
-24
@@ -24,7 +24,7 @@ class APIRouter {
|
||||
|
||||
//On vérifie que la classe appelée existe
|
||||
$fileName = 'API' . ucfirst( $file );
|
||||
if ( ! file_exists( 'src/API/' . $fileName . '.php' ) ) {
|
||||
if ( !file_exists( 'src/API/' . $fileName . '.php' ) ) {
|
||||
new APIError( 404 );
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ class APIRouter {
|
||||
$class = new $class( $action );
|
||||
|
||||
//On vérifie que l'action demandé est déclarée
|
||||
if ( ! array_key_exists( $action, $class->getDeclaredFunctions() ) ) {
|
||||
if ( !array_key_exists( $action, $class->getDeclaredFunctions() ) ) {
|
||||
new APIError( 404 );
|
||||
}
|
||||
|
||||
@@ -49,25 +49,25 @@ class APIRouter {
|
||||
$function = implode( '', $array ); //le nom de la fonction
|
||||
|
||||
//On vérifie que la fonction existe dans la classe
|
||||
if ( ! method_exists( $class, $function ) ) {
|
||||
if ( !method_exists( $class, $function ) ) {
|
||||
new APIError( 500, 'La fonction ' . $function . ' n\'existe pas dans la classe ' . get_class( $class ) );
|
||||
}
|
||||
|
||||
//On vérifie que la méthode d'envoie est référencée
|
||||
$method = $class->getDeclaredFunctions()[ $action ]['method'];
|
||||
if ( ! in_array( $method, self::HTTP_METHODS ) ) {
|
||||
$method = $class->getDeclaredFunctions()[ $action ][ 'method' ];
|
||||
if ( !in_array( $method, self::HTTP_METHODS ) ) {
|
||||
new APIError( 500, 'méthode http inconnue' );
|
||||
}
|
||||
|
||||
//On vérifie que la méthode requise et la mathode obtenue sont les même
|
||||
if ( $method != $_SERVER['REQUEST_METHOD'] ) {
|
||||
if ( $method != $_SERVER[ 'REQUEST_METHOD' ] ) {
|
||||
new APIError( 400, 'La méthode HTTP ne correspond pas à la méthode prévue' );
|
||||
}
|
||||
|
||||
//On met les paramètres dans le tableau $data
|
||||
$params = $class->getDeclaredFunctions()[ $action ]['params'];
|
||||
$params = $class->getDeclaredFunctions()[ $action ][ 'params' ];
|
||||
$data = [];
|
||||
if ( ! empty( $params ) ) {
|
||||
if ( !empty( $params ) ) {
|
||||
if ( $method == 'DELETE' || $method == 'PUT' ) {
|
||||
parse_str( file_get_contents( 'php://input' ), $data );
|
||||
} else if ( $method == 'POST' ) {
|
||||
@@ -78,47 +78,47 @@ class APIRouter {
|
||||
|
||||
//On boucle sur les paramètres de la doc de la fonction
|
||||
foreach ( $params as $p => $options ) {
|
||||
if ( ! isset( $options['required'] ) ) {
|
||||
$options['required'] = false;
|
||||
if ( !isset( $options[ 'required' ] ) ) {
|
||||
$options[ 'required' ] = false;
|
||||
}
|
||||
//Si le paramètre est obligatoire et qu'il est vide ou non fourni on lève une erreur 400 BAD REQUEST
|
||||
if ( $options['required'] && ( ! array_key_exists( $p, $data ) || ( empty( $data[ $p ] ) && $data[ $p ] != '0' ) ) ) {
|
||||
if ( $options[ 'required' ] && ( !array_key_exists( $p, $data ) || ( empty( $data[ $p ] ) && $data[ $p ] != '0' ) ) ) {
|
||||
$devMsg = 'Paramètre ' . $p . ' manquant';
|
||||
if ( isset( $options['devMsg'] ) ) {
|
||||
$devMsg = $options['devMsg'];
|
||||
if ( isset( $options[ 'devMsg' ] ) ) {
|
||||
$devMsg = $options[ 'devMsg' ];
|
||||
}
|
||||
$publicMsg = 'Des paramètres obligatoires ne sont pas envoyés ou sont vides';
|
||||
if ( isset( $options['publicMsg'] ) ) {
|
||||
$publicMsg = $options['publicMsg'];
|
||||
if ( isset( $options[ 'publicMsg' ] ) ) {
|
||||
$publicMsg = $options[ 'publicMsg' ];
|
||||
}
|
||||
$code = '';
|
||||
if ( isset( $options['code'] ) ) {
|
||||
$code = $options['code'];
|
||||
if ( isset( $options[ 'code' ] ) ) {
|
||||
$code = $options[ 'code' ];
|
||||
}
|
||||
new APIError( 400, $devMsg, $publicMsg, $code );
|
||||
}
|
||||
|
||||
//On vérifie que le type donné correspond au typage requis
|
||||
if ( isset( $options['type'] ) ) {
|
||||
if ( $options['type'] == 'int' ) {
|
||||
if ( isset( $options[ 'type' ] ) ) {
|
||||
if ( $options[ 'type' ] == 'int' ) {
|
||||
if ( ctype_digit( $data[ $p ] ) ) {
|
||||
$data[ $p ] = (int) $data[ $p ];
|
||||
$data[ $p ] = (int)$data[ $p ];
|
||||
} else {
|
||||
new APIError( 400, 'Le type donné ne correspond pas au type demandé pour le paramètre ' . $p . ' : string donné, ' . $options['type'] . ' requis' );
|
||||
new APIError( 400, 'Le type donné ne correspond pas au type demandé pour le paramètre ' . $p . ' : string donné, ' . $options[ 'type' ] . ' requis' );
|
||||
}
|
||||
} else if ( $options['type'] == 'bool' ) {
|
||||
} else if ( $options[ 'type' ] == 'bool' ) {
|
||||
if ( $data[ $p ] == 'true' || $data[ $p ] == '1' ) {
|
||||
$data[ $p ] = true;
|
||||
} else if ( $data[ $p ] == 'false' || $data[ $p ] == '0' ) {
|
||||
$data[ $p ] = false;
|
||||
} else {
|
||||
new APIError( 400, 'Le type donné ne correspond pas au type demandé pour le paramètre ' . $p . ' : string donné, ' . $options['type'] . ' requis' );
|
||||
new APIError( 400, 'Le type donné ne correspond pas au type demandé pour le paramètre ' . $p . ' : string donné, ' . $options[ 'type' ] . ' requis' );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Si un paramètre non obligatoire n'est pas donné par l'utilisateur on lui donne la valeur par défaut d'une chaine vide
|
||||
if ( ! array_key_exists( $p, $data ) ) {
|
||||
if ( !array_key_exists( $p, $data ) ) {
|
||||
$data[ $p ] = '';
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -18,7 +18,7 @@ class Autoloader {
|
||||
*/
|
||||
static function autoload( $class ) {
|
||||
if ( preg_match( '#^' . Config::NAMESPACE . '\\\(.+)$#', $class, $matches ) ) {
|
||||
require 'src/' . str_replace( '\\', '/', $matches[1] ) . '.php';
|
||||
require 'src/' . str_replace( '\\', '/', $matches[ 1 ] ) . '.php';
|
||||
}
|
||||
}
|
||||
}
|
||||
+3
-3
@@ -3,12 +3,12 @@
|
||||
namespace CAUProject3Contact;
|
||||
|
||||
class Config {
|
||||
const SITE_JS_VERSION = '1.00';
|
||||
const SITE_CSS_VERSION = '1.00';
|
||||
const SITE_JS_VERSION = '0.01';
|
||||
const SITE_CSS_VERSION = '0.01';
|
||||
|
||||
const TITLE_HEADER = 'Your contact';
|
||||
const DESCRIPTION_HEADER = 'Manage your contact easly';
|
||||
const NAMESPACE = 'CAUProject3Contact';
|
||||
|
||||
const FAVICON_PATH = '/img/favicon.png';
|
||||
const FAVICON_PATH = '/img/favicon.ico';
|
||||
}
|
||||
@@ -21,11 +21,11 @@ class ControllerSite {
|
||||
ob_start();
|
||||
extract( $this->data );
|
||||
|
||||
if ( empty( $this->head['title'] ) ) {
|
||||
$this->head['title'] = Config::TITLE_HEADER;
|
||||
if ( empty( $this->head[ 'title' ] ) ) {
|
||||
$this->head[ 'title' ] = Config::TITLE_HEADER;
|
||||
}
|
||||
if ( empty( $this->head['description'] ) ) {
|
||||
$this->head['description'] = Config::DESCRIPTION_HEADER;
|
||||
if ( empty( $this->head[ 'description' ] ) ) {
|
||||
$this->head[ 'description' ] = Config::DESCRIPTION_HEADER;
|
||||
}
|
||||
if ( $header ) {
|
||||
require 'src/View/Site/tpl/head.php';
|
||||
|
||||
@@ -75,22 +75,22 @@ class Error extends Controller {
|
||||
];
|
||||
|
||||
if ( isset( $tabCode[ $ErrCode ] ) ) {
|
||||
header( $_SERVER['SERVER_PROTOCOL'] . ' ' . $tabCode[ $ErrCode ]['label'] );
|
||||
if ( isset( $_SERVER['HTTP_X_REQUESTED_WITH'] ) && strtolower( $_SERVER['HTTP_X_REQUESTED_WITH'] ) == 'xmlhttprequest' ) {
|
||||
$this->throwError( $tabCode[ $ErrCode ]['msg'], 'Erreur_' . $ErrCode );
|
||||
header( $_SERVER[ 'SERVER_PROTOCOL' ] . ' ' . $tabCode[ $ErrCode ][ 'label' ] );
|
||||
if ( isset( $_SERVER[ 'HTTP_X_REQUESTED_WITH' ] ) && strtolower( $_SERVER[ 'HTTP_X_REQUESTED_WITH' ] ) == 'xmlhttprequest' ) {
|
||||
$this->throwError( $tabCode[ $ErrCode ][ 'msg' ], 'Erreur_' . $ErrCode );
|
||||
}
|
||||
$erreur = $tabCode[ $ErrCode ]['msg'];
|
||||
$erreur = $tabCode[ $ErrCode ][ 'msg' ];
|
||||
$this->addData( [ 'erreur' => $erreur ] );
|
||||
} else {
|
||||
header( $_SERVER['SERVER_PROTOCOL'] . ' ' . $tabCode[500]['label'] );
|
||||
if ( isset( $_SERVER['HTTP_X_REQUESTED_WITH'] ) && strtolower( $_SERVER['HTTP_X_REQUESTED_WITH'] ) == 'xmlhttprequest' ) {
|
||||
$this->throwError( $tabCode[500]['msg'], 'Erreur_500' );
|
||||
header( $_SERVER[ 'SERVER_PROTOCOL' ] . ' ' . $tabCode[ 500 ][ 'label' ] );
|
||||
if ( isset( $_SERVER[ 'HTTP_X_REQUESTED_WITH' ] ) && strtolower( $_SERVER[ 'HTTP_X_REQUESTED_WITH' ] ) == 'xmlhttprequest' ) {
|
||||
$this->throwError( $tabCode[ 500 ][ 'msg' ], 'Erreur_500' );
|
||||
}
|
||||
$erreur = $tabCode[500]['msg'];
|
||||
$erreur = $tabCode[ 500 ][ 'msg' ];
|
||||
$this->addData( [ 'erreur' => $erreur ] );
|
||||
}
|
||||
|
||||
if ( ! empty( $message ) ) {
|
||||
if ( !empty( $message ) ) {
|
||||
$this->addData( [ 'message' => $message ] );
|
||||
}
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
namespace CAUProject3Contact\Controller\Site;
|
||||
|
||||
use CAUProject3Contact\Controller\ControllerSite;
|
||||
use CAUProject3Contact\Model\Contact;
|
||||
|
||||
class Index extends ControllerSite {
|
||||
|
||||
@@ -12,14 +13,15 @@ class Index extends ControllerSite {
|
||||
public function __construct() {
|
||||
parent::__construct();
|
||||
|
||||
$this->addHead( [
|
||||
$this->addHead( [] );
|
||||
|
||||
$this->addFooter( [] );
|
||||
|
||||
$contacts = Contact::getAllContact();
|
||||
|
||||
$this->addData( [
|
||||
"contacts" => $contacts
|
||||
] );
|
||||
|
||||
$this->addFooter( [
|
||||
|
||||
] );
|
||||
|
||||
$this->addData( [] );
|
||||
$this->view();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -76,22 +76,22 @@ class SiteError extends ControllerSite {
|
||||
];
|
||||
|
||||
if ( isset( $tabCode[ $ErrCode ] ) ) {
|
||||
header( $_SERVER['SERVER_PROTOCOL'] . ' ' . $tabCode[ $ErrCode ]['label'] );
|
||||
if ( isset( $_SERVER['HTTP_X_REQUESTED_WITH'] ) && strtolower( $_SERVER['HTTP_X_REQUESTED_WITH'] ) == 'xmlhttprequest' ) {
|
||||
$this->throwError( 'Erreur ' . $tabCode[ $ErrCode ]['label'], 'Erreur_' . $ErrCode );
|
||||
header( $_SERVER[ 'SERVER_PROTOCOL' ] . ' ' . $tabCode[ $ErrCode ][ 'label' ] );
|
||||
if ( isset( $_SERVER[ 'HTTP_X_REQUESTED_WITH' ] ) && strtolower( $_SERVER[ 'HTTP_X_REQUESTED_WITH' ] ) == 'xmlhttprequest' ) {
|
||||
$this->throwError( 'Erreur ' . $tabCode[ $ErrCode ][ 'label' ], 'Erreur_' . $ErrCode );
|
||||
}
|
||||
$erreur = $tabCode[ $ErrCode ]['msg'];
|
||||
$erreur = $tabCode[ $ErrCode ][ 'msg' ];
|
||||
$this->addData( [ 'erreur' => $erreur ] );
|
||||
} else {
|
||||
header( $_SERVER['SERVER_PROTOCOL'] . ' ' . $tabCode[500]['label'] );
|
||||
if ( isset( $_SERVER['HTTP_X_REQUESTED_WITH'] ) && strtolower( $_SERVER['HTTP_X_REQUESTED_WITH'] ) == 'xmlhttprequest' ) {
|
||||
$this->throwError( 'Erreur ' . $tabCode[500]['label'], 'Erreur_500' );
|
||||
header( $_SERVER[ 'SERVER_PROTOCOL' ] . ' ' . $tabCode[ 500 ][ 'label' ] );
|
||||
if ( isset( $_SERVER[ 'HTTP_X_REQUESTED_WITH' ] ) && strtolower( $_SERVER[ 'HTTP_X_REQUESTED_WITH' ] ) == 'xmlhttprequest' ) {
|
||||
$this->throwError( 'Erreur ' . $tabCode[ 500 ][ 'label' ], 'Erreur_500' );
|
||||
}
|
||||
$erreur = $tabCode[500]['msg'];
|
||||
$erreur = $tabCode[ 500 ][ 'msg' ];
|
||||
$this->addData( [ 'erreur' => $erreur ] );
|
||||
}
|
||||
|
||||
if ( ! empty( $message ) ) {
|
||||
if ( !empty( $message ) ) {
|
||||
$this->addData( [ 'message' => $message ] );
|
||||
}
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ class SiteRouter {
|
||||
|
||||
set_error_handler( 'errorHandler' );
|
||||
|
||||
if ( $pages[0] == '' ) {
|
||||
if ( $pages[ 0 ] == '' ) {
|
||||
new Index();
|
||||
} else {
|
||||
new SiteError( 404 );
|
||||
|
||||
+12
-4
@@ -6,10 +6,18 @@ use Exception;
|
||||
use PDO;
|
||||
|
||||
class BDD {
|
||||
const SQL_SERVER = 'sql.sanchez-mathieu.fr'; // BDD Server
|
||||
const SQL_LOGIN = 'why7n0_contact'; // BDD Login
|
||||
const SQL_PASSWORD = 'fC3c87Gy'; // BDD Password
|
||||
const SQL_DB = 'why7n0_contact'; // BDD Name
|
||||
|
||||
// Server BDD
|
||||
// const SQL_SERVER = 'sql.sanchez-mathieu.fr'; // BDD Server
|
||||
// const SQL_LOGIN = 'why7n0_contact'; // BDD Login
|
||||
// const SQL_PASSWORD = 'fC3c87Gy'; // BDD Password
|
||||
// const SQL_DB = 'why7n0_contact'; // BDD Name
|
||||
|
||||
// Local BDD
|
||||
const SQL_SERVER = 'localhost'; // BDD Server
|
||||
const SQL_LOGIN = 'root'; // BDD Login
|
||||
const SQL_PASSWORD = ''; // BDD Password
|
||||
const SQL_DB = 'contact'; // BDD Name
|
||||
|
||||
private static $bdd;
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@ abstract class BDTables {
|
||||
// Ex : const ABONNEMENT = 'abonnement';
|
||||
|
||||
const LOGS = "logs";
|
||||
const CONTACT = "contact";
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,220 @@
|
||||
<?php
|
||||
|
||||
namespace CAUProject3Contact\Model;
|
||||
|
||||
class Contact {
|
||||
|
||||
public $id;
|
||||
public $firstName;
|
||||
public $lastName;
|
||||
public $surname;
|
||||
public $email;
|
||||
public $address;
|
||||
public $phoneNumber;
|
||||
public $birthday;
|
||||
|
||||
// Constructors
|
||||
|
||||
public function __construct( int $id = null, string $firstName = null, string $lastName = null,
|
||||
string $surname = null, string $email = null, string $address = null,
|
||||
string $phoneNumber = null, string $birthday = null ) {
|
||||
if ( $id === null || $firstName === null || $lastName === null ) {
|
||||
return;
|
||||
}
|
||||
$this->id = $id;
|
||||
$this->firstName = $firstName;
|
||||
$this->lastName = $lastName;
|
||||
$this->surname = $surname;
|
||||
$this->email = $email;
|
||||
$this->address = $address;
|
||||
$this->phoneNumber = $phoneNumber;
|
||||
$this->birthday = $birthday;
|
||||
}
|
||||
|
||||
public static function getById( int $id ) {
|
||||
$req = BDD::instance()->prepare( "SELECT * FROM " . BDTables::CONTACT .
|
||||
" WHERE `id` = :id" );
|
||||
$req->execute( [ "id" => $id ] );
|
||||
$d = $req->fetch();
|
||||
return new Contact( $d[ "id" ], $d[ "first_name" ], $d[ "last_name" ], $d[ "surname" ],
|
||||
$d[ "email" ], $d[ "address" ], $d[ "phone_number" ], $d[ "birthday" ] );
|
||||
}
|
||||
|
||||
// Getters
|
||||
|
||||
public static function insertNewContact( string $firstName, string $lastName, string $surname = null,
|
||||
string $email = null,
|
||||
string $address = null, string $phoneNumber = null,
|
||||
string $birthday = null ) {
|
||||
$data = [
|
||||
"first_name" => $firstName,
|
||||
"last_name" => $lastName,
|
||||
];
|
||||
if ( $surname !== null && $surname !== "" ) {
|
||||
$data[ "surname" ] = $surname;
|
||||
}
|
||||
if ( $email !== null && $email !== "" ) {
|
||||
$data[ "email" ] = $email;
|
||||
}
|
||||
if ( $address !== null && $address !== "" ) {
|
||||
$data[ "address" ] = $address;
|
||||
}
|
||||
if ( $phoneNumber !== null && $phoneNumber !== "" ) {
|
||||
$data[ "phone_number" ] = $phoneNumber;
|
||||
}
|
||||
if ( $birthday !== null && $birthday !== "" ) {
|
||||
$data[ "birthday" ] = date( "Y-m-d", strtotime( $birthday ) );
|
||||
}
|
||||
return Model::insert( BDTables::CONTACT, $data );
|
||||
}
|
||||
|
||||
public static function deleteContact( int $id ) {
|
||||
Model::delete( BDTables::CONTACT, [ "id" => $id ] );
|
||||
}
|
||||
|
||||
public static function getAllContact(): array {
|
||||
$contacts = [];
|
||||
$req = BDD::instance()->prepare( "SELECT * FROM " . BDTables::CONTACT );
|
||||
$req->execute();
|
||||
|
||||
foreach ( $req->fetchAll() as $c ) {
|
||||
$contacts[] = new Contact( $c[ "id" ], $c[ "first_name" ], $c[ "last_name" ], $c[ "surname" ],
|
||||
$c[ "email" ], $c[ "address" ], $c[ "phone_number" ], $c[ "birthday" ] );
|
||||
}
|
||||
return ( count( $contacts ) > 0 ? $contacts : null );
|
||||
}
|
||||
|
||||
public static function search( string $query ) {
|
||||
$result = [];
|
||||
$words = explode( " ", cleanString( $query ) );
|
||||
|
||||
$q1 = $q2 = $q3 = $q4 = "SELECT * FROM `" . BDTables::CONTACT . "` WHERE ";
|
||||
|
||||
$lastKey = endKey( $words );
|
||||
foreach ( $words as $key => $word ) {
|
||||
$normal = self::getQuerySearch( $word, [ "first_name", "last_name", "surname" ] );;
|
||||
$hard = self::getQuerySearch( $word, [ "email", "address", "phone_number" ] );
|
||||
$q1 .= $normal;
|
||||
$q2 .= $normal;
|
||||
$q3 .= $hard;
|
||||
$q4 .= $hard;
|
||||
if ( $key != $lastKey ) {
|
||||
$q1 .= " AND ";
|
||||
$q2 .= " OR ";
|
||||
$q3 .= " AND ";
|
||||
$q4 .= " OR ";
|
||||
}
|
||||
}
|
||||
|
||||
$req1 = BDD::instance()->prepare( $q1 );
|
||||
$req2 = BDD::instance()->prepare( $q2 );
|
||||
$req3 = BDD::instance()->prepare( $q3 );
|
||||
$req4 = BDD::instance()->prepare( $q4 );
|
||||
|
||||
$req1->execute();
|
||||
$req2->execute();
|
||||
$req3->execute();
|
||||
$req4->execute();
|
||||
|
||||
$tmp1 = $req1->fetchAll();
|
||||
$tmp2 = filterArrays( $tmp1, $req2->fetchAll() );
|
||||
$tmp3 = filterArrays( $tmp1, filterArrays( $tmp2, $req3->fetchAll() ) );
|
||||
$tmp4 = filterArrays( $tmp1, filterArrays( $tmp2, filterArrays( $tmp3, $req4->fetchAll() ) ) );
|
||||
|
||||
if ( count( $tmp1 ) > 0 || count( $tmp2 ) > 0 || count( $tmp3 ) > 0 || count( $tmp4 ) > 0 ) {
|
||||
$result[ "1" ] = ( count( $tmp1 ) > 0 ? $tmp1 : null );
|
||||
$result[ "2" ] = ( count( $tmp2 ) > 0 ? $tmp2 : null );
|
||||
$result[ "3" ] = ( count( $tmp3 ) > 0 ? $tmp3 : null );
|
||||
$result[ "4" ] = ( count( $tmp4 ) > 0 ? $tmp4 : null );
|
||||
return $result;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private static function getQuerySearch( string $word, array $fields ): string {
|
||||
$str = '';
|
||||
$i = 0;
|
||||
|
||||
foreach ( $fields as $field ) {
|
||||
if ( $i === 0 ) {
|
||||
$str .= "(";
|
||||
} else {
|
||||
$str .= " OR ";
|
||||
}
|
||||
$str .= "`" . $field . "` LIKE '%" . $word . "%'";
|
||||
$i++;
|
||||
}
|
||||
$str .= ')';
|
||||
return $str;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getFirstName(): string {
|
||||
return $this->firstName;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getLastName(): string {
|
||||
return $this->lastName;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getSurname() {
|
||||
return $this->surname;
|
||||
}
|
||||
|
||||
// Method
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getEmail() {
|
||||
return $this->email;
|
||||
}
|
||||
|
||||
// Static functions
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getAddress() {
|
||||
return $this->address;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getPhoneNumber() {
|
||||
return $this->phoneNumber;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getBirthday() {
|
||||
return $this->birthday;
|
||||
}
|
||||
|
||||
public function updateContact( array $data ) {
|
||||
foreach ( $data as $key => $value ) {
|
||||
$this->{$key} = $value;
|
||||
}
|
||||
Model::update( BDTables::CONTACT, $data, "id", $this->getId() );
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getId(): int {
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
+209
-209
File diff suppressed because it is too large.
Load diff
+3
-2
@@ -41,7 +41,8 @@ class Logs {
|
||||
* @param string|null $line
|
||||
* @param string|null $date
|
||||
*/
|
||||
public function __construct( int $id = null, string $level = null, string $message = null, string $file = null, string $line = null, string $date = null ) {
|
||||
public function __construct( int $id = null, string $level = null, string $message = null, string $file = null,
|
||||
string $line = null, string $date = null ) {
|
||||
if ( $id === null ) {
|
||||
return;
|
||||
}
|
||||
@@ -81,7 +82,7 @@ class Logs {
|
||||
$return = [];
|
||||
|
||||
foreach ( $req->fetchAll() as $l ) {
|
||||
$log = new Logs( $l['id'], $l['level'], $l['message'], $l['file'], $l['line'], $l['date'] );
|
||||
$log = new Logs( $l[ 'id' ], $l[ 'level' ], $l[ 'message' ], $l[ 'file' ], $l[ 'line' ], $l[ 'date' ] );
|
||||
$return[] = $log;
|
||||
}
|
||||
|
||||
|
||||
@@ -45,6 +45,22 @@ class Model {
|
||||
$req = BDD::instance()->prepare( $reqStr );
|
||||
$req->execute( $data );
|
||||
}
|
||||
|
||||
public static function delete( string $tableName, array $conditions ) {
|
||||
$reqStr = 'DELETE FROM ' . $tableName . ' WHERE ';
|
||||
$lastKey = endKey( $conditions );
|
||||
|
||||
foreach ( $conditions as $key => $value ) {
|
||||
$reqStr .= $key . ' = :' . $key;
|
||||
if ( $key != $lastKey ) {
|
||||
$reqStr .= ' AND ';
|
||||
}
|
||||
}
|
||||
|
||||
$req = BDD::instance()->prepare( $reqStr );
|
||||
$req->execute( $conditions );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
+38
-2
@@ -1,3 +1,39 @@
|
||||
<div>
|
||||
Bonjour 2
|
||||
<div class="section scrollspy">
|
||||
|
||||
<div class="row">
|
||||
<div class="col s12 main-container">
|
||||
<table class="highlight centered">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>First Name</th>
|
||||
<th>Last Name</th>
|
||||
<th>Surname</th>
|
||||
<th>Email</th>
|
||||
<th>Address</th>
|
||||
<th>Phone Number</th>
|
||||
<th>Birthday</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
foreach ( $contacts as $contact ) {
|
||||
echo "<tr>";
|
||||
echo " <td>" . $contact->getFirstName() . "</td>";
|
||||
echo " <td>" . $contact->getLastName() . "</td>";
|
||||
echo " <td>" . ( $contact->getSurname() ? $contact->getSurname() : "" ) . "</td>";
|
||||
echo " <td>" . ( $contact->getEmail() ? $contact->getEmail() : "" ) . "</td>";
|
||||
echo " <td>" . ( $contact->getAddress() ? $contact->getAddress() : "" ) . "</td>";
|
||||
echo " <td>" . ( $contact->getPhoneNumber() ? $contact->getPhoneNumber() : "" ) . "</td>";
|
||||
echo " <td>" . ( $contact->getBirthday() ? date( "Y-m-d", strtotime( $contact->getBirthday() ) ) : "" ) . "</td>";
|
||||
echo "</tr>";
|
||||
}
|
||||
?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
let contacts = <?= json_encode( $contacts ) ?>;
|
||||
</script>
|
||||
@@ -1,5 +1,32 @@
|
||||
<script src="/js/jquery-3.2.1.min.js"></script>
|
||||
<script src="/js/javascript.js?v=<?= CAUProject3Contact\Config::SITE_JS_VERSION ?>"></script>
|
||||
</div>
|
||||
</main>
|
||||
|
||||
<div id="modal" class="modal modal-fixed-footer">
|
||||
<div class="modal-content">
|
||||
<h4>Add new contact</h4>
|
||||
<p>Test</p>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<a class="waves-effect waves-green btn-flat">Validate</a>
|
||||
<a class="waves-effect waves-red btn-flat">Cancel</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<footer class="page-footer blue">
|
||||
<div class="footer-copyright">
|
||||
<div class="container">
|
||||
Made by <a class="blue-text text-lighten-3" target="_blank" href="https://www.sanchez-mathieu.fr">Mathieu
|
||||
Sanchez</a>
|
||||
</div>
|
||||
</div>
|
||||
</footer>
|
||||
|
||||
<script src="/js/jquery-3.3.1.min.js"></script>
|
||||
<script async src="/js/materialize.min.js"></script>
|
||||
|
||||
<script async src="/js/javascript.js?v=<?= CAUProject3Contact\Config::SITE_JS_VERSION ?>"></script>
|
||||
|
||||
<link href="/css/materialize.min.css" rel="stylesheet">
|
||||
<link href="/css/style.css?v=<?= CAUProject3Contact\Config::SITE_CSS_VERSION ?>" rel="stylesheet">
|
||||
|
||||
</body>
|
||||
|
||||
+42
-17
@@ -1,41 +1,66 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="fr">
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<link rel="manifest" href="/manifest.json">
|
||||
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1.0"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
|
||||
|
||||
<!-- <link rel="manifest" href="/manifest.json">-->
|
||||
|
||||
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||
<meta name="mobile-web-app-capable" content="yes">
|
||||
<meta name="apple-mobile-web-app-status-bar-style" id="status-bar" content="white-translucent">
|
||||
<meta name="format-detection" content="telephone=no">
|
||||
|
||||
<meta name="author" content="Eldotravo">
|
||||
<meta name="author" content="Mathieu Sanchez">
|
||||
|
||||
<title><?= $this->head['title'] ?></title>
|
||||
<meta name="description" content="<?= $this->head['description'] ?>">
|
||||
<title><?= $this->head[ 'title' ] ?></title>
|
||||
<meta name="description" content="<?= $this->head[ 'description' ] ?>">
|
||||
|
||||
<meta property="og:title" content="<?= $this->head['title'] ?>"/>
|
||||
<meta property="og:description" content="<?= $this->head['description'] ?>"/>
|
||||
<meta property="og:url" content="https://<?= $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'] ?>"/>
|
||||
<meta property="og:image" content="https://<?= $_SERVER['SERVER_NAME'] . \CAUProject3Contact\Config::FAVICON_PATH ?>"/>
|
||||
<meta property="og:title" content="<?= $this->head[ 'title' ] ?>"/>
|
||||
<meta property="og:description" content="<?= $this->head[ 'description' ] ?>"/>
|
||||
<meta property="og:url" content="https://<?= $_SERVER[ 'SERVER_NAME' ] . $_SERVER[ 'REQUEST_URI' ] ?>"/>
|
||||
<meta property="og:image"
|
||||
content="https://<?= $_SERVER[ 'SERVER_NAME' ] . \CAUProject3Contact\Config::FAVICON_PATH ?>"/>
|
||||
<!-- <meta property="fb:app_id" content="1000452166691027" /> -->
|
||||
|
||||
<link href='https://fonts.googleapis.com/css?family=Roboto:100,300,400,500,700%7CRoboto+Condensed:400,700%7CMaterial+Icons'
|
||||
rel='stylesheet' type='text/css'>
|
||||
|
||||
<link href="/css/theme.css?v=<?= CAUProject3Contact\Config::SITE_CSS_VERSION ?>" rel="stylesheet">
|
||||
<link href="/css/select2.css" rel="stylesheet">
|
||||
|
||||
<link rel="image_src" href="<?php \CAUProject3Contact\Config::FAVICON_PATH ?>"/>
|
||||
<link rel="icon" type="image/png" href="<?php \CAUProject3Contact\Config::FAVICON_PATH ?>"/>
|
||||
<link rel="image_src" href="<?= CAUProject3Contact\Config::FAVICON_PATH ?>"/>
|
||||
<link rel="icon" type="image/ico" href="<?= CAUProject3Contact\Config::FAVICON_PATH ?>"/>
|
||||
|
||||
<meta name="theme-color" content="#ffffff">
|
||||
|
||||
<?php if ( isset( $this->head['robotNoIndex'] ) && $this->head['robotNoIndex'] == true ) { ?>
|
||||
<?php if ( isset( $this->head[ 'robotNoIndex' ] ) && $this->head[ 'robotNoIndex' ] == true ) { ?>
|
||||
<meta name="robots" content="noindex"/>
|
||||
<?php } ?>
|
||||
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<nav class="blue" role="navigation">
|
||||
<div class="nav-wrapper container">
|
||||
<a id="logo-container" class="brand-logo">
|
||||
<img src="/img/logo.png" alt="Logo of Your Contact" height="64px"/>
|
||||
</a>
|
||||
|
||||
<ul class="right hide-on-med-and-down">
|
||||
<li>
|
||||
<a class="nav-search"><input type="text" placeholder="Search Contact" id="search" name="search"/></a>
|
||||
</li>
|
||||
<li data-position="bottom" data-tooltip="Add a new contact">
|
||||
<a class="nav-add"><img class="add-contacts" src="/img/add-contacts.png" alt="Add contact"></a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<!-- <ul id="nav-mobile" class="sidenav">-->
|
||||
<!-- <li><a href="#">Navbar Link</a></li>-->
|
||||
<!-- </ul>-->
|
||||
<!-- <a href="#" data-target="nav-mobile" class="sidenav-trigger"><i class="material-icons">menu</i></a>-->
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
<main>
|
||||
<div class="container">
|
||||
+60
-38
@@ -37,8 +37,8 @@ function formatURL( string $str, $encoding = 'utf-8' ) {
|
||||
//on passe tout en minuscule
|
||||
$str = strtolower( $str );
|
||||
|
||||
if ( substr( $str, - 1 ) == '_' ) {
|
||||
$str = substr( $str, 0, - 1 );
|
||||
if ( substr( $str, -1 ) == '_' ) {
|
||||
$str = substr( $str, 0, -1 );
|
||||
}
|
||||
|
||||
return $str;
|
||||
@@ -58,27 +58,27 @@ function formatURL( string $str, $encoding = 'utf-8' ) {
|
||||
function darkroom( $img, $to, $width = 0, $height = 0, $quality = 100, $useGD = true ) {
|
||||
|
||||
$dimensions = getimagesize( $img );
|
||||
$ratio = $dimensions[0] / $dimensions[1];
|
||||
$ratio = $dimensions[ 0 ] / $dimensions[ 1 ];
|
||||
|
||||
// Calcul des dimensions si 0 passé en paramètre
|
||||
if ( $width == 0 && $height == 0 ) {
|
||||
$width = $dimensions[0];
|
||||
$height = $dimensions[1];
|
||||
$width = $dimensions[ 0 ];
|
||||
$height = $dimensions[ 1 ];
|
||||
} else if ( $height == 0 ) {
|
||||
$height = round( $width / $ratio );
|
||||
} else if ( $width == 0 ) {
|
||||
$width = round( $height * $ratio );
|
||||
}
|
||||
|
||||
if ( $dimensions[0] > ( $width / $height ) * $dimensions[1] ) {
|
||||
if ( $dimensions[ 0 ] > ( $width / $height ) * $dimensions[ 1 ] ) {
|
||||
$dimY = $height;
|
||||
$dimX = round( $height * $dimensions[0] / $dimensions[1] );
|
||||
$dimX = round( $height * $dimensions[ 0 ] / $dimensions[ 1 ] );
|
||||
}
|
||||
if ( $dimensions[0] < ( $width / $height ) * $dimensions[1] ) {
|
||||
if ( $dimensions[ 0 ] < ( $width / $height ) * $dimensions[ 1 ] ) {
|
||||
$dimX = $width;
|
||||
$dimY = round( $width * $dimensions[1] / $dimensions[0] );
|
||||
$dimY = round( $width * $dimensions[ 1 ] / $dimensions[ 0 ] );
|
||||
}
|
||||
if ( $dimensions[0] == ( $width / $height ) * $dimensions[1] ) {
|
||||
if ( $dimensions[ 0 ] == ( $width / $height ) * $dimensions[ 1 ] ) {
|
||||
$dimX = $width;
|
||||
$dimY = $height;
|
||||
}
|
||||
@@ -98,7 +98,7 @@ function darkroom( $img, $to, $width = 0, $height = 0, $quality = 100, $useGD =
|
||||
$image = imagecreatefrompng( $img );
|
||||
break;
|
||||
}
|
||||
imagecopyresampled( $pattern, $image, 0, 0, 0, 0, $dimX, $dimY, $dimensions[0], $dimensions[1] );
|
||||
imagecopyresampled( $pattern, $image, 0, 0, 0, 0, $dimX, $dimY, $dimensions[ 0 ], $dimensions[ 1 ] );
|
||||
imagedestroy( $image );
|
||||
imagejpeg( $pattern, $to, $quality );
|
||||
|
||||
@@ -119,7 +119,7 @@ function darkroom( $img, $to, $width = 0, $height = 0, $quality = 100, $useGD =
|
||||
* @return bool|void
|
||||
*/
|
||||
function errorHandler( $errno, $errstr, $errfile, $errline ) {
|
||||
if ( ! ( error_reporting() & $errno ) ) {
|
||||
if ( !( error_reporting() & $errno ) ) {
|
||||
// Ce code d'erreur n'est pas inclus dans error_reporting()
|
||||
return;
|
||||
}
|
||||
@@ -141,7 +141,7 @@ function errorHandler( $errno, $errstr, $errfile, $errline ) {
|
||||
*/
|
||||
function getBrowser() {
|
||||
|
||||
$u_agent = $_SERVER['HTTP_USER_AGENT'];
|
||||
$u_agent = $_SERVER[ 'HTTP_USER_AGENT' ];
|
||||
$bname = 'Unknown';
|
||||
$platform = 'Unknown';
|
||||
$ub = "";
|
||||
@@ -162,7 +162,7 @@ function getBrowser() {
|
||||
}
|
||||
|
||||
// Next get the name of the useragent yes seperately and for good reason
|
||||
if ( preg_match( '/MSIE/i', $u_agent ) && ! preg_match( '/Opera/i', $u_agent ) ) {
|
||||
if ( preg_match( '/MSIE/i', $u_agent ) && !preg_match( '/Opera/i', $u_agent ) ) {
|
||||
$bname = 'Internet Explorer';
|
||||
$ub = "MSIE";
|
||||
} else if ( preg_match( '/Edge/i', $u_agent ) ) {
|
||||
@@ -192,22 +192,22 @@ function getBrowser() {
|
||||
// Added "|:"
|
||||
$known = array( 'Version', $ub, 'other' );
|
||||
$pattern = '#(?<browser>' . join( '|', $known ) . ')[/|: ]+(?<version>[0-9.|a-zA-Z.]*)#';
|
||||
if ( ! preg_match_all( $pattern, $u_agent, $matches ) ) {
|
||||
if ( !preg_match_all( $pattern, $u_agent, $matches ) ) {
|
||||
// we have no matching number just continue
|
||||
}
|
||||
|
||||
// see how many we have
|
||||
$i = count( $matches['browser'] );
|
||||
$i = count( $matches[ 'browser' ] );
|
||||
if ( $i != 1 ) {
|
||||
//we will have two since we are not using 'other' argument yet
|
||||
//see if version is before or after the name
|
||||
if ( strripos( $u_agent, "Version" ) < strripos( $u_agent, $ub ) ) {
|
||||
$version = $matches['version'][0];
|
||||
$version = $matches[ 'version' ][ 0 ];
|
||||
} else {
|
||||
$version = $matches['version'][1];
|
||||
$version = $matches[ 'version' ][ 1 ];
|
||||
}
|
||||
} else {
|
||||
$version = $matches['version'][0];
|
||||
$version = $matches[ 'version' ][ 0 ];
|
||||
}
|
||||
|
||||
// check if we have a number
|
||||
@@ -232,11 +232,11 @@ function getBrowser() {
|
||||
*/
|
||||
function getLimitWord( $string, $limit ) {
|
||||
$i = $limit;
|
||||
if ( ! isset( $string ) || empty( $string ) ) {
|
||||
if ( !isset( $string ) || empty( $string ) ) {
|
||||
return 0;
|
||||
}
|
||||
while ( $i > 0 && $string[ $i ] != ' ' ) {
|
||||
$i --;
|
||||
$i--;
|
||||
}
|
||||
|
||||
return $i;
|
||||
@@ -369,27 +369,18 @@ function rotateImage( string $file, int $angle, string $newName ) {
|
||||
* @return array
|
||||
* Clean toutes les strings dans array en récursif, et filtre pour n'avoir qu'un espaces entre chaque mot
|
||||
*/
|
||||
function cleanArray( array $data ) {
|
||||
if ( ! empty( $data ) ) {
|
||||
foreach ( $data as $key => $donnée ) {
|
||||
switch ( gettype( $donnée ) ) {
|
||||
function cleanArray( array $data ): array {
|
||||
if ( !empty( $data ) ) {
|
||||
foreach ( $data as $key => $value ) {
|
||||
switch ( gettype( $value ) ) {
|
||||
case 'string':
|
||||
if ( ! empty( $donnée ) ) {
|
||||
$new_string = '';
|
||||
foreach ( explode( ' ', trim( $donnée ) ) as $str ) {
|
||||
if ( ! empty( $str ) ) {
|
||||
if ( $new_string != '' ) {
|
||||
$new_string .= ' ';
|
||||
}
|
||||
$new_string .= $str;
|
||||
}
|
||||
}
|
||||
$data[ $key ] = $new_string;
|
||||
if ( !empty( $str ) ) {
|
||||
$data[ $key ] = cleanString( $value );
|
||||
}
|
||||
break;
|
||||
case 'array':
|
||||
if ( ! empty( $donnée ) ) {
|
||||
$data[ $key ] = cleanArray( $donnée );
|
||||
if ( !empty( $value ) ) {
|
||||
$data[ $key ] = cleanArray( $value );
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -399,6 +390,19 @@ function cleanArray( array $data ) {
|
||||
return $data;
|
||||
}
|
||||
|
||||
function cleanString( string $str ): string {
|
||||
$newStr = '';
|
||||
foreach ( explode( ' ', trim( $str ) ) as $word ) {
|
||||
if ( !empty( $word ) && $word != '' ) {
|
||||
if ( $newStr != '' ) {
|
||||
$newStr .= ' ';
|
||||
}
|
||||
$newStr .= $word;
|
||||
}
|
||||
}
|
||||
return $newStr;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $array
|
||||
*
|
||||
@@ -410,4 +414,22 @@ function endKey( $array ) {
|
||||
return key( $array );
|
||||
}
|
||||
|
||||
function filterArrays( $array1, $array2 ): array {
|
||||
$newArray = [];
|
||||
|
||||
foreach ( $array2 as $item2 ) {
|
||||
$add = true;
|
||||
foreach ( $array1 as $item1 ) {
|
||||
if ( $item2[ "id" ] == $item1[ "id" ] ) {
|
||||
$add = false;
|
||||
}
|
||||
}
|
||||
if ( $add ) {
|
||||
$newArray[] = $item2;
|
||||
}
|
||||
}
|
||||
|
||||
return $newArray;
|
||||
}
|
||||
|
||||
?>
|
||||
+626
-625
File diff suppressed because it is too large.
Load diff
+45
-45
@@ -253,14 +253,14 @@ class SMTP {
|
||||
);
|
||||
}
|
||||
// Verify we connected properly
|
||||
if ( ! is_resource( $this->smtp_conn ) ) {
|
||||
if ( !is_resource( $this->smtp_conn ) ) {
|
||||
$this->setError(
|
||||
'Failed to connect to server',
|
||||
$errno,
|
||||
$errstr
|
||||
);
|
||||
$this->edebug(
|
||||
'SMTP ERROR: ' . $this->error['error']
|
||||
'SMTP ERROR: ' . $this->error[ 'error' ]
|
||||
. ": $errstr ($errno)",
|
||||
self::DEBUG_CLIENT
|
||||
);
|
||||
@@ -293,7 +293,7 @@ class SMTP {
|
||||
public function connected() {
|
||||
if ( is_resource( $this->smtp_conn ) ) {
|
||||
$sock_status = stream_get_meta_data( $this->smtp_conn );
|
||||
if ( $sock_status['eof'] ) {
|
||||
if ( $sock_status[ 'eof' ] ) {
|
||||
// The socket is valid but we are not connected
|
||||
$this->edebug(
|
||||
'SMTP NOTICE: EOF caught while checking if connected',
|
||||
@@ -325,7 +325,7 @@ class SMTP {
|
||||
return;
|
||||
}
|
||||
//Avoid clash with built-in function names
|
||||
if ( ! in_array( $this->Debugoutput, array(
|
||||
if ( !in_array( $this->Debugoutput, array(
|
||||
'error_log',
|
||||
'html',
|
||||
'echo'
|
||||
@@ -390,7 +390,7 @@ class SMTP {
|
||||
*/
|
||||
protected function get_lines() {
|
||||
// If the connection is bad, give up straight away
|
||||
if ( ! is_resource( $this->smtp_conn ) ) {
|
||||
if ( !is_resource( $this->smtp_conn ) ) {
|
||||
return '';
|
||||
}
|
||||
$data = '';
|
||||
@@ -399,18 +399,18 @@ class SMTP {
|
||||
if ( $this->Timelimit > 0 ) {
|
||||
$endtime = time() + $this->Timelimit;
|
||||
}
|
||||
while ( is_resource( $this->smtp_conn ) && ! feof( $this->smtp_conn ) ) {
|
||||
while ( is_resource( $this->smtp_conn ) && !feof( $this->smtp_conn ) ) {
|
||||
$str = @fgets( $this->smtp_conn, 515 );
|
||||
$this->edebug( "SMTP -> get_lines(): \$data is \"$data\"", self::DEBUG_LOWLEVEL );
|
||||
$this->edebug( "SMTP -> get_lines(): \$str is \"$str\"", self::DEBUG_LOWLEVEL );
|
||||
$data .= $str;
|
||||
// If 4th character is a space, we are done reading, break the loop, micro-optimisation over strlen
|
||||
if ( ( isset( $str[3] ) and $str[3] == ' ' ) ) {
|
||||
if ( ( isset( $str[ 3 ] ) and $str[ 3 ] == ' ' ) ) {
|
||||
break;
|
||||
}
|
||||
// Timed-out? Log and break
|
||||
$info = stream_get_meta_data( $this->smtp_conn );
|
||||
if ( $info['timed_out'] ) {
|
||||
if ( $info[ 'timed_out' ] ) {
|
||||
$this->edebug(
|
||||
'SMTP -> get_lines(): timed-out (' . $this->Timeout . ' sec)',
|
||||
self::DEBUG_LOWLEVEL
|
||||
@@ -437,11 +437,11 @@ class SMTP {
|
||||
* @return boolean
|
||||
*/
|
||||
public function startTLS() {
|
||||
if ( ! $this->sendCommand( 'STARTTLS', 'STARTTLS', 220 ) ) {
|
||||
if ( !$this->sendCommand( 'STARTTLS', 'STARTTLS', 220 ) ) {
|
||||
return false;
|
||||
}
|
||||
// Begin encrypted connection
|
||||
if ( ! stream_socket_enable_crypto(
|
||||
if ( !stream_socket_enable_crypto(
|
||||
$this->smtp_conn,
|
||||
true,
|
||||
STREAM_CRYPTO_METHOD_TLS_CLIENT
|
||||
@@ -463,7 +463,7 @@ class SMTP {
|
||||
* @return boolean True on success.
|
||||
*/
|
||||
protected function sendCommand( $command, $commandstring, $expect ) {
|
||||
if ( ! $this->connected() ) {
|
||||
if ( !$this->connected() ) {
|
||||
$this->setError( "Called $command without being connected" );
|
||||
|
||||
return false;
|
||||
@@ -480,8 +480,8 @@ class SMTP {
|
||||
// Fetch SMTP code and possible error code explanation
|
||||
$matches = array();
|
||||
if ( preg_match( "/^([0-9]{3})[ -](?:([0-9]\\.[0-9]\\.[0-9]) )?/", $this->last_reply, $matches ) ) {
|
||||
$code = $matches[1];
|
||||
$code_ex = ( count( $matches ) > 2 ? $matches[2] : null );
|
||||
$code = $matches[ 1 ];
|
||||
$code_ex = ( count( $matches ) > 2 ? $matches[ 2 ] : null );
|
||||
// Cut off error code from each response line
|
||||
$detail = preg_replace(
|
||||
"/{$code}[ -]" . ( $code_ex ? str_replace( '.', '\\.', $code_ex ) . ' ' : '' ) . "/m",
|
||||
@@ -497,7 +497,7 @@ class SMTP {
|
||||
|
||||
$this->edebug( 'SERVER -> CLIENT: ' . $this->last_reply, self::DEBUG_SERVER );
|
||||
|
||||
if ( ! in_array( $code, (array) $expect ) ) {
|
||||
if ( !in_array( $code, (array)$expect ) ) {
|
||||
$this->setError(
|
||||
"$command command failed",
|
||||
$detail,
|
||||
@@ -505,7 +505,7 @@ class SMTP {
|
||||
$code_ex
|
||||
);
|
||||
$this->edebug(
|
||||
'SMTP ERROR: ' . $this->error['error'] . ': ' . $this->last_reply,
|
||||
'SMTP ERROR: ' . $this->error[ 'error' ] . ': ' . $this->last_reply,
|
||||
self::DEBUG_CLIENT
|
||||
);
|
||||
|
||||
@@ -553,7 +553,7 @@ class SMTP {
|
||||
$workstation = '',
|
||||
$OAuth = null
|
||||
) {
|
||||
if ( ! $this->server_caps ) {
|
||||
if ( !$this->server_caps ) {
|
||||
$this->setError( 'Authentication is not allowed before HELO/EHLO' );
|
||||
|
||||
return false;
|
||||
@@ -562,7 +562,7 @@ class SMTP {
|
||||
if ( array_key_exists( 'EHLO', $this->server_caps ) ) {
|
||||
// SMTP extensions are available. Let's try to find a proper authentication method
|
||||
|
||||
if ( ! array_key_exists( 'AUTH', $this->server_caps ) ) {
|
||||
if ( !array_key_exists( 'AUTH', $this->server_caps ) ) {
|
||||
$this->setError( 'Authentication is not allowed at this stage' );
|
||||
// 'at this stage' means that auth may be allowed after the stage changes
|
||||
// e.g. after STARTTLS
|
||||
@@ -571,13 +571,13 @@ class SMTP {
|
||||
|
||||
self::edebug( 'Auth method requested: ' . ( $authtype ? $authtype : 'UNKNOWN' ), self::DEBUG_LOWLEVEL );
|
||||
self::edebug(
|
||||
'Auth methods available on the server: ' . implode( ',', $this->server_caps['AUTH'] ),
|
||||
'Auth methods available on the server: ' . implode( ',', $this->server_caps[ 'AUTH' ] ),
|
||||
self::DEBUG_LOWLEVEL
|
||||
);
|
||||
|
||||
if ( empty( $authtype ) ) {
|
||||
foreach ( array( 'LOGIN', 'CRAM-MD5', 'NTLM', 'PLAIN', 'XOAUTH2' ) as $method ) {
|
||||
if ( in_array( $method, $this->server_caps['AUTH'] ) ) {
|
||||
if ( in_array( $method, $this->server_caps[ 'AUTH' ] ) ) {
|
||||
$authtype = $method;
|
||||
break;
|
||||
}
|
||||
@@ -590,7 +590,7 @@ class SMTP {
|
||||
self::edebug( 'Auth method selected: ' . $authtype, self::DEBUG_LOWLEVEL );
|
||||
}
|
||||
|
||||
if ( ! in_array( $authtype, $this->server_caps['AUTH'] ) ) {
|
||||
if ( !in_array( $authtype, $this->server_caps[ 'AUTH' ] ) ) {
|
||||
$this->setError( "The requested authentication method \"$authtype\" is not supported by the server" );
|
||||
|
||||
return false;
|
||||
@@ -601,11 +601,11 @@ class SMTP {
|
||||
switch ( $authtype ) {
|
||||
case 'PLAIN':
|
||||
// Start authentication
|
||||
if ( ! $this->sendCommand( 'AUTH', 'AUTH PLAIN', 334 ) ) {
|
||||
if ( !$this->sendCommand( 'AUTH', 'AUTH PLAIN', 334 ) ) {
|
||||
return false;
|
||||
}
|
||||
// Send encoded username and password
|
||||
if ( ! $this->sendCommand(
|
||||
if ( !$this->sendCommand(
|
||||
'User & Password',
|
||||
base64_encode( "\0" . $username . "\0" . $password ),
|
||||
235
|
||||
@@ -616,13 +616,13 @@ class SMTP {
|
||||
break;
|
||||
case 'LOGIN':
|
||||
// Start authentication
|
||||
if ( ! $this->sendCommand( 'AUTH', 'AUTH LOGIN', 334 ) ) {
|
||||
if ( !$this->sendCommand( 'AUTH', 'AUTH LOGIN', 334 ) ) {
|
||||
return false;
|
||||
}
|
||||
if ( ! $this->sendCommand( "Username", base64_encode( $username ), 334 ) ) {
|
||||
if ( !$this->sendCommand( "Username", base64_encode( $username ), 334 ) ) {
|
||||
return false;
|
||||
}
|
||||
if ( ! $this->sendCommand( "Password", base64_encode( $password ), 235 ) ) {
|
||||
if ( !$this->sendCommand( "Password", base64_encode( $password ), 235 ) ) {
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
@@ -635,7 +635,7 @@ class SMTP {
|
||||
$oauth = $OAuth->getOauth64();
|
||||
|
||||
// Start authentication
|
||||
if ( ! $this->sendCommand( 'AUTH', 'AUTH XOAUTH2 ' . $oauth, 235 ) ) {
|
||||
if ( !$this->sendCommand( 'AUTH', 'AUTH XOAUTH2 ' . $oauth, 235 ) ) {
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
@@ -652,11 +652,11 @@ class SMTP {
|
||||
$temp = new stdClass;
|
||||
$ntlm_client = new ntlm_sasl_client_class;
|
||||
//Check that functions are available
|
||||
if ( ! $ntlm_client->Initialize( $temp ) ) {
|
||||
if ( !$ntlm_client->Initialize( $temp ) ) {
|
||||
$this->setError( $temp->error );
|
||||
$this->edebug(
|
||||
'You need to enable some modules in your php.ini file: '
|
||||
. $this->error['error'],
|
||||
. $this->error[ 'error' ],
|
||||
self::DEBUG_CLIENT
|
||||
);
|
||||
|
||||
@@ -665,7 +665,7 @@ class SMTP {
|
||||
//msg1
|
||||
$msg1 = $ntlm_client->TypeMsg1( $realm, $workstation ); //msg1
|
||||
|
||||
if ( ! $this->sendCommand(
|
||||
if ( !$this->sendCommand(
|
||||
'AUTH NTLM',
|
||||
'AUTH NTLM ' . base64_encode( $msg1 ),
|
||||
334
|
||||
@@ -693,7 +693,7 @@ class SMTP {
|
||||
return $this->sendCommand( 'Username', base64_encode( $msg3 ), 235 );
|
||||
case 'CRAM-MD5':
|
||||
// Start authentication
|
||||
if ( ! $this->sendCommand( 'AUTH CRAM-MD5', 'AUTH CRAM-MD5', 334 ) ) {
|
||||
if ( !$this->sendCommand( 'AUTH CRAM-MD5', 'AUTH CRAM-MD5', 334 ) ) {
|
||||
return false;
|
||||
}
|
||||
// Get the challenge
|
||||
@@ -766,7 +766,7 @@ class SMTP {
|
||||
*/
|
||||
public function data( $msg_data ) {
|
||||
//This will use the standard timelimit
|
||||
if ( ! $this->sendCommand( 'DATA', 'DATA', 354 ) ) {
|
||||
if ( !$this->sendCommand( 'DATA', 'DATA', 354 ) ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -786,9 +786,9 @@ class SMTP {
|
||||
* process all lines before a blank line as headers.
|
||||
*/
|
||||
|
||||
$field = substr( $lines[0], 0, strpos( $lines[0], ':' ) );
|
||||
$field = substr( $lines[ 0 ], 0, strpos( $lines[ 0 ], ':' ) );
|
||||
$in_headers = false;
|
||||
if ( ! empty( $field ) && strpos( $field, ' ' ) === false ) {
|
||||
if ( !empty( $field ) && strpos( $field, ' ' ) === false ) {
|
||||
$in_headers = true;
|
||||
}
|
||||
|
||||
@@ -804,7 +804,7 @@ class SMTP {
|
||||
//so as to avoid breaking in the middle of a word
|
||||
$pos = strrpos( substr( $line, 0, self::MAX_LINE_LENGTH ), ' ' );
|
||||
//Deliberately matches both false and 0
|
||||
if ( ! $pos ) {
|
||||
if ( !$pos ) {
|
||||
//No nice break found, add a hard break
|
||||
$pos = self::MAX_LINE_LENGTH - 1;
|
||||
$lines_out[] = substr( $line, 0, $pos );
|
||||
@@ -825,7 +825,7 @@ class SMTP {
|
||||
//Send the lines to the server
|
||||
foreach ( $lines_out as $line_out ) {
|
||||
//RFC2821 section 4.5.2
|
||||
if ( ! empty( $line_out ) and $line_out[0] == '.' ) {
|
||||
if ( !empty( $line_out ) and $line_out[ 0 ] == '.' ) {
|
||||
$line_out = '.' . $line_out;
|
||||
}
|
||||
$this->client_send( $line_out . self::CRLF );
|
||||
@@ -857,7 +857,7 @@ class SMTP {
|
||||
*/
|
||||
public function hello( $host = '' ) {
|
||||
//Try extended hello first (RFC 2821)
|
||||
return (boolean) ( $this->sendHello( 'EHLO', $host ) or $this->sendHello( 'HELO', $host ) );
|
||||
return (boolean)( $this->sendHello( 'EHLO', $host ) or $this->sendHello( 'HELO', $host ) );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -901,18 +901,18 @@ class SMTP {
|
||||
continue;
|
||||
}
|
||||
$fields = explode( ' ', $s );
|
||||
if ( ! empty( $fields ) ) {
|
||||
if ( ! $n ) {
|
||||
if ( !empty( $fields ) ) {
|
||||
if ( !$n ) {
|
||||
$name = $type;
|
||||
$fields = $fields[0];
|
||||
$fields = $fields[ 0 ];
|
||||
} else {
|
||||
$name = array_shift( $fields );
|
||||
switch ( $name ) {
|
||||
case 'SIZE':
|
||||
$fields = ( $fields ? $fields[0] : 0 );
|
||||
$fields = ( $fields ? $fields[ 0 ] : 0 );
|
||||
break;
|
||||
case 'AUTH':
|
||||
if ( ! is_array( $fields ) ) {
|
||||
if ( !is_array( $fields ) ) {
|
||||
$fields = array();
|
||||
}
|
||||
break;
|
||||
@@ -1051,7 +1051,7 @@ class SMTP {
|
||||
*/
|
||||
public function turn() {
|
||||
$this->setError( 'The SMTP TURN command is not implemented' );
|
||||
$this->edebug( 'SMTP NOTICE: ' . $this->error['error'], self::DEBUG_CLIENT );
|
||||
$this->edebug( 'SMTP NOTICE: ' . $this->error[ 'error' ], self::DEBUG_CLIENT );
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -1113,16 +1113,16 @@ class SMTP {
|
||||
* @return mixed
|
||||
*/
|
||||
public function getServerExt( $name ) {
|
||||
if ( ! $this->server_caps ) {
|
||||
if ( !$this->server_caps ) {
|
||||
$this->setError( 'No HELO/EHLO was sent' );
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
// the tight logic knot ;)
|
||||
if ( ! array_key_exists( $name, $this->server_caps ) ) {
|
||||
if ( !array_key_exists( $name, $this->server_caps ) ) {
|
||||
if ( $name == 'HELO' ) {
|
||||
return $this->server_caps['EHLO'];
|
||||
return $this->server_caps[ 'EHLO' ];
|
||||
}
|
||||
if ( $name == 'EHLO' || array_key_exists( 'EHLO', $this->server_caps ) ) {
|
||||
return false;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//FR" "http://www.w3.org/TR/html4/loose.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
|
||||
</head>
|
||||
<body class="body" style="background-color: whitesmoke !important;padding: 40px 0;line-height: 22px;width: 100%;">
|
||||
<div class="contain"
|
||||
|
||||
Vendored
+13
@@ -0,0 +1,13 @@
|
||||
/*!
|
||||
* Materialize v1.0.0 (http://materializecss.com)
|
||||
* Copyright 2014-2017 Materialize
|
||||
* MIT License (https://raw.githubusercontent.com/Dogfalo/materialize/master/LICENSE)
|
||||
*/
|
||||
.materialize-red{background-color:#e51c23 !important}.materialize-red-text{color:#e51c23 !important}.materialize-red.lighten-5{background-color:#fdeaeb !important}.materialize-red-text.text-lighten-5{color:#fdeaeb !important}.materialize-red.lighten-4{background-color:#f8c1c3 !important}.materialize-red-text.text-lighten-4{color:#f8c1c3 !important}.materialize-red.lighten-3{background-color:#f3989b !important}.materialize-red-text.text-lighten-3{color:#f3989b !important}.materialize-red.lighten-2{background-color:#ee6e73 !important}.materialize-red-text.text-lighten-2{color:#ee6e73 !important}.materialize-red.lighten-1{background-color:#ea454b !important}.materialize-red-text.text-lighten-1{color:#ea454b !important}.materialize-red.darken-1{background-color:#d0181e !important}.materialize-red-text.text-darken-1{color:#d0181e !important}.materialize-red.darken-2{background-color:#b9151b !important}.materialize-red-text.text-darken-2{color:#b9151b !important}.materialize-red.darken-3{background-color:#a21318 !important}.materialize-red-text.text-darken-3{color:#a21318 !important}.materialize-red.darken-4{background-color:#8b1014 !important}.materialize-red-text.text-darken-4{color:#8b1014 !important}.red{background-color:#F44336 !important}.red-text{color:#F44336 !important}.red.lighten-5{background-color:#FFEBEE !important}.red-text.text-lighten-5{color:#FFEBEE !important}.red.lighten-4{background-color:#FFCDD2 !important}.red-text.text-lighten-4{color:#FFCDD2 !important}.red.lighten-3{background-color:#EF9A9A !important}.red-text.text-lighten-3{color:#EF9A9A !important}.red.lighten-2{background-color:#E57373 !important}.red-text.text-lighten-2{color:#E57373 !important}.red.lighten-1{background-color:#EF5350 !important}.red-text.text-lighten-1{color:#EF5350 !important}.red.darken-1{background-color:#E53935 !important}.red-text.text-darken-1{color:#E53935 !important}.red.darken-2{background-color:#D32F2F !important}.red-text.text-darken-2{color:#D32F2F !important}.red.darken-3{background-color:#C62828 !important}.red-text.text-darken-3{color:#C62828 !important}.red.darken-4{background-color:#B71C1C !important}.red-text.text-darken-4{color:#B71C1C !important}.red.accent-1{background-color:#FF8A80 !important}.red-text.text-accent-1{color:#FF8A80 !important}.red.accent-2{background-color:#FF5252 !important}.red-text.text-accent-2{color:#FF5252 !important}.red.accent-3{background-color:#FF1744 !important}.red-text.text-accent-3{color:#FF1744 !important}.red.accent-4{background-color:#D50000 !important}.red-text.text-accent-4{color:#D50000 !important}.pink{background-color:#e91e63 !important}.pink-text{color:#e91e63 !important}.pink.lighten-5{background-color:#fce4ec !important}.pink-text.text-lighten-5{color:#fce4ec !important}.pink.lighten-4{background-color:#f8bbd0 !important}.pink-text.text-lighten-4{color:#f8bbd0 !important}.pink.lighten-3{background-color:#f48fb1 !important}.pink-text.text-lighten-3{color:#f48fb1 !important}.pink.lighten-2{background-color:#f06292 !important}.pink-text.text-lighten-2{color:#f06292 !important}.pink.lighten-1{background-color:#ec407a !important}.pink-text.text-lighten-1{color:#ec407a !important}.pink.darken-1{background-color:#d81b60 !important}.pink-text.text-darken-1{color:#d81b60 !important}.pink.darken-2{background-color:#c2185b !important}.pink-text.text-darken-2{color:#c2185b !important}.pink.darken-3{background-color:#ad1457 !important}.pink-text.text-darken-3{color:#ad1457 !important}.pink.darken-4{background-color:#880e4f !important}.pink-text.text-darken-4{color:#880e4f !important}.pink.accent-1{background-color:#ff80ab !important}.pink-text.text-accent-1{color:#ff80ab !important}.pink.accent-2{background-color:#ff4081 !important}.pink-text.text-accent-2{color:#ff4081 !important}.pink.accent-3{background-color:#f50057 !important}.pink-text.text-accent-3{color:#f50057 !important}.pink.accent-4{background-color:#c51162 !important}.pink-text.text-accent-4{color:#c51162 !important}.purple{background-color:#9c27b0 !important}.purple-text{color:#9c27b0 !important}.purple.lighten-5{background-color:#f3e5f5 !important}.purple-text.text-lighten-5{color:#f3e5f5 !important}.purple.lighten-4{background-color:#e1bee7 !important}.purple-text.text-lighten-4{color:#e1bee7 !important}.purple.lighten-3{background-color:#ce93d8 !important}.purple-text.text-lighten-3{color:#ce93d8 !important}.purple.lighten-2{background-color:#ba68c8 !important}.purple-text.text-lighten-2{color:#ba68c8 !important}.purple.lighten-1{background-color:#ab47bc !important}.purple-text.text-lighten-1{color:#ab47bc !important}.purple.darken-1{background-color:#8e24aa !important}.purple-text.text-darken-1{color:#8e24aa !important}.purple.darken-2{background-color:#7b1fa2 !important}.purple-text.text-darken-2{color:#7b1fa2 !important}.purple.darken-3{background-color:#6a1b9a !important}.purple-text.text-darken-3{color:#6a1b9a !important}.purple.darken-4{background-color:#4a148c !important}.purple-text.text-darkeLine truncated
|
||||
* Waves v0.6.0
|
||||
* http://fian.my.id/Waves
|
||||
*
|
||||
* Copyright 2014 Alfiana E. Sibuea and other contributors
|
||||
* Released under the MIT license
|
||||
* https://github.com/fians/Waves/blob/master/LICENSE
|
||||
*/.waves-effect{position:relative;cursor:pointer;display:inline-block;overflow:hidden;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;-webkit-tap-highlight-color:transparent;vertical-align:middle;z-index:1;-webkit-transition:.3s ease-out;transition:.3s ease-out}.waves-effect .waves-ripple{position:absolute;border-radius:50%;width:20px;height:20px;margin-top:-10px;margin-left:-10px;opacity:0;background:rgba(0,0,0,0.2);-webkit-transition:all 0.7s ease-out;transition:all 0.7s ease-out;-webkit-transition-property:opacity, -webkit-transform;transition-property:opacity, -webkit-transform;transition-property:transform, opacity;transition-property:transform, opacity, -webkit-transform;-webkit-transform:scale(0);transform:scale(0);pointer-events:none}.waves-effect.waves-light .waves-ripple{background-color:rgba(255,255,255,0.45)}.waves-effect.waves-red .waves-ripple{background-color:rgba(244,67,54,0.7)}.waves-effect.waves-yellow .waves-ripple{background-color:rgba(255,235,59,0.7)}.waves-effect.waves-orange .waves-ripple{background-color:rgba(255,152,0,0.7)}.waves-effect.waves-purple .waves-ripple{background-color:rgba(156,39,176,0.7)}.waves-effect.waves-green .waves-ripple{background-color:rgba(76,175,80,0.7)}.waves-effect.waves-teal .waves-ripple{background-color:rgba(0,150,136,0.7)}.waves-effect input[type="button"],.waves-effect input[type="reset"],.waves-effect input[type="submit"]{border:0;font-style:normal;font-size:inherit;text-transform:inherit;background:none}.waves-effect img{position:relative;z-index:-1}.waves-notransition{-webkit-transition:none !important;transition:none !important}.waves-circle{-webkit-transform:translateZ(0);transform:translateZ(0);-webkit-mask-image:-webkit-radial-gradient(circle, white 100%, black 100%)}.waves-input-wrapper{border-radius:0.2em;vertical-align:bottom}.waves-input-wrapper .waves-button-input{position:relative;top:0;left:0;z-index:1}.waves-circle{text-align:center;width:2.5em;height:2.5em;line-height:2.5em;border-radius:50%;-webkit-mask-image:none}.waves-block{display:block}.waves-effect .waves-ripple{z-index:-1}.modal{display:none;position:fixed;left:0;right:0;background-color:#fafafa;padding:0;max-height:70%;width:55%;margin:auto;overflow-y:auto;border-radius:2px;will-change:top, opacity}.modal:focus{outline:none}@media only screen and (max-width: 992px){.modal{width:80%}}.modal h1,.modal h2,.modal h3,.modal h4{margin-top:0}.modal .modal-content{padding:24px}.modal .modal-close{cursor:pointer}.modal .modal-footer{border-radius:0 0 2px 2px;background-color:#fafafa;padding:4px 6px;height:56px;width:100%;text-align:right}.modal .modal-footer .btn,.modal .modal-footer .btn-large,.modal .modal-footer .btn-small,.modal .modal-footer .btn-flat{margin:6px 0}.modal-overlay{position:fixed;z-index:999;top:-25%;left:0;bottom:0;right:0;height:125%;width:100%;background:#000;display:none;will-change:opacity}.modal.modal-fixed-footer{padding:0;height:70%}.modal.modal-fixed-footer .modal-content{position:absolute;height:calc(100% - 56px);max-height:100%;width:100%;overflow-y:auto}.modal.modal-fixed-footer .modal-footer{border-top:1px solid rgba(0,0,0,0.1);position:absolute;bottom:0}.modal.bottom-sheet{top:auto;bottom:-100%;margin:0;width:100%;max-height:45%;border-radius:0;will-change:bottom, opacity}.collapsible{border-top:1px solid #ddd;border-right:1px solid #ddd;border-left:1px solid #ddd;margin:.5rem 0 1rem 0}.collapsible-header{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;cursor:pointer;-webkit-tap-highlight-color:transparent;line-height:1.5;padding:1rem;background-color:#fff;border-bottom:1px solid #ddd}.collapsible-header:focus{outline:0}.collapsible-header i{width:2rem;font-size:1.6rem;display:inline-block;text-align:center;margin-right:1rem}.keyboard-focused .collapsible-header:focus{background-color:#eee}.collapsible-body{display:none;border-bottom:1px solid #ddd;-webkit-box-sizing:border-box;box-sizing:border-box;padding:2rem}.sidenav .collapsible,.sidenav.fixed .collapsible{border:none;-webkit-box-shadow:none;box-shadow:none}.sidenav .collapsible li,.sidenav.fixed .collapsible li{padding:0}.sidenav .collapsible-header,.sidenav.fixed .collapsible-header{background-color:transparent;border:none;line-height:inherit;height:inherit;padding:0 16px}.sidenav .collapsible-header:hover,.sidenav.fixed .collapsible-header:hover{background-color:rgba(0,0,0,0.05)}.sidenav .collapsible-header i,.sidenav.fixed .collapsible-header i{line-height:inherit}.sidenav .collapsible-body,.sidenav.fixed .collapsible-body{border:0;background-color:#fff}.sidenav .collapsible-body li a,.sidenav.fixed .collapsible-body li a{padding:0 23.5px 0 31px}.collapsible.popout{border:none;-webkit-box-shadow:none;box-shadow:none}.collapsible.popout>li{-webkit-box-shadow:0 2px 5px 0 rgba(0,0,0,0.16),0 2px 10px 0 rgba(0,0,0,0.12);box-shadow:0 2px 5px 0 rgba(0,0,0,0.16),0 2px 10px 0 rgba(0,0,0,0.12);margin:0 24px;-webkit-transition:margin 0.35s cubLine truncated
|
||||
+24
-42
@@ -1,55 +1,37 @@
|
||||
html, body, div, span, applet, object, iframe,
|
||||
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
|
||||
a, abbr, acronym, address, big, cite, code,
|
||||
del, dfn, em, img, ins, kbd, q, s, samp,
|
||||
small, strike, sub, sup, tt, var,
|
||||
b, u, i, center,
|
||||
dl, dt, dd, ol, ul, li,
|
||||
fieldset, form, label, legend,
|
||||
table, caption, tbody, tfoot, thead, tr, th, td,
|
||||
article, aside, canvas, details, embed,
|
||||
figure, figcaption, footer, header, hgroup,
|
||||
menu, nav, output, ruby, section, summary,
|
||||
time, mark, audio, video {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
border: 0;
|
||||
font-size: 100%;
|
||||
font: inherit;
|
||||
vertical-align: baseline;
|
||||
main {
|
||||
background: #F1F1F1;
|
||||
}
|
||||
|
||||
/* HTML5 display-role reset for older browsers */
|
||||
article, aside, details, figcaption, figure,
|
||||
footer, header, hgroup, menu, nav, section {
|
||||
display: block;
|
||||
.nav-add {
|
||||
padding-top: 12px;
|
||||
height: 64px;
|
||||
}
|
||||
|
||||
body {
|
||||
line-height: 1;
|
||||
img.add-contacts {
|
||||
height: 40px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
ol, ul {
|
||||
list-style: none;
|
||||
.row .col.s12.main-container {
|
||||
background: #FFF;
|
||||
padding: 10px;
|
||||
border-radius: 5px;
|
||||
}
|
||||
|
||||
blockquote, q {
|
||||
quotes: none;
|
||||
#search {
|
||||
background: white;
|
||||
border: none;
|
||||
border-radius: 7px;
|
||||
height: 40px;
|
||||
width: 200px;
|
||||
transition: all 0.3s;
|
||||
padding-left: 10px;
|
||||
}
|
||||
|
||||
blockquote:before, blockquote:after,
|
||||
q:before, q:after {
|
||||
content: '';
|
||||
content: none;
|
||||
#search:hover {
|
||||
width: 350px;
|
||||
}
|
||||
|
||||
table {
|
||||
border-collapse: collapse;
|
||||
border-spacing: 0;
|
||||
}
|
||||
|
||||
* {
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
box-sizing: border-box;
|
||||
#search:focus {
|
||||
width: 500px;
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 1.2 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 4.2 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 9.6 KiB |
@@ -0,0 +1,74 @@
|
||||
let working = false;
|
||||
let lastQuery = null;
|
||||
|
||||
let displayContacts = (contacts) => {
|
||||
let tbody = $("table tbody");
|
||||
|
||||
for (let contact of contacts) {
|
||||
tbody.append(`
|
||||
<tr>
|
||||
<td>${(contact["first_name"] ? contact["first_name"] : (contact["firstName"] ? contact["firstName"] : ""))}</td>
|
||||
<td>${(contact["last_name"] ? contact["last_name"] : (contact["lastName"] ? contact["lastName"] : ""))}</td>
|
||||
<td>${(contact["surname"] ? contact["surname"] : "")}</td>
|
||||
<td>${(contact["email"] ? contact["email"] : "")}</td>
|
||||
<td>${(contact["address"] ? contact["address"] : "")}</td>
|
||||
<td>${(contact["phone_number"] ? contact["phone_number"] : (contact["phoneNumber"] ? contact["phoneNumber"] : ""))}</td>
|
||||
<td>${(contact["birthday"] ? new Date(contact["birthday"]).toLocaleDateString() : "")}</td>
|
||||
</tr>
|
||||
`);
|
||||
}
|
||||
};
|
||||
|
||||
$(document).ready(() => {
|
||||
|
||||
let modal = $('.modal');
|
||||
|
||||
modal.modal();
|
||||
|
||||
let search = (query) => {
|
||||
if (query.length >= 3) {
|
||||
working = true;
|
||||
$.ajax({
|
||||
url: "/api/contact/search",
|
||||
method: "POST",
|
||||
data: {
|
||||
query: query
|
||||
},
|
||||
success: function (data) {
|
||||
$("table tbody").empty();
|
||||
|
||||
for (let i = 0; i < 4; i++) {
|
||||
if (data && data.result && data.result[i.toString()] && data.result[i.toString()].length > 0) {
|
||||
displayContacts(data.result[i.toString()]);
|
||||
}
|
||||
}
|
||||
|
||||
working = false;
|
||||
},
|
||||
error: function (e) {
|
||||
working = false;
|
||||
}
|
||||
});
|
||||
} else {
|
||||
$("table tbody").empty();
|
||||
displayContacts(contacts);
|
||||
}
|
||||
};
|
||||
|
||||
$(document).on("input", "#search", () => {
|
||||
let query = $("#search").val();
|
||||
|
||||
if (!working) {
|
||||
search(query);
|
||||
} else {
|
||||
lastQuery = query;
|
||||
}
|
||||
});
|
||||
|
||||
$(document).on("click", ".add-contacts", () => {
|
||||
modal.open();
|
||||
});
|
||||
|
||||
$("[data-tooltip]").tooltip();
|
||||
|
||||
});
|
||||
Vendored
-4
@@ -1,4 +0,0 @@
|
||||
/*! jQuery v3.2.1 | (c) JS Foundation and other contributors | jquery.org/license */
|
||||
!function(a,b){"use strict";"object"==typeof module&&"object"==typeof module.exports?module.exports=a.document?b(a,!0):function(a){if(!a.document)throw new Error("jQuery requires a window with a document");return b(a)}:b(a)}("undefined"!=typeof window?window:this,function(a,b){"use strict";var c=[],d=a.document,e=Object.getPrototypeOf,f=c.slice,g=c.concat,h=c.push,i=c.indexOf,j={},k=j.toString,l=j.hasOwnProperty,m=l.toString,n=m.call(Object),o={};function p(a,b){b=b||d;var c=b.createElement("script");c.text=a,b.head.appendChild(c).parentNode.removeChild(c)}var q="3.2.1",r=function(a,b){return new r.fn.init(a,b)},s=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,t=/^-ms-/,u=/-([a-z])/g,v=function(a,b){return b.toUpperCase()};r.fn=r.prototype={jquery:q,constructor:r,length:0,toArray:function(){return f.call(this)},get:function(a){return null==a?f.call(this):a<0?this[a+this.length]:this[a]},pushStack:function(a){var b=r.merge(this.constructor(),a);return b.prevObject=this,b},each:function(a){return r.each(this,a)},map:function(a){return this.pushStack(r.map(this,function(b,c){return a.call(b,c,b)}))},slice:function(){return this.pushStack(f.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(a){var b=this.length,c=+a+(a<0?b:0);return this.pushStack(c>=0&&c<b?[this[c]]:[])},end:function(){return this.prevObject||this.constructor()},push:h,sort:c.sort,splice:c.splice},r.extend=r.fn.extend=function(){var a,b,c,d,e,f,g=arguments[0]||{},h=1,i=arguments.length,j=!1;for("boolean"==typeof g&&(j=g,g=arguments[h]||{},h++),"object"==typeof g||r.isFunction(g)||(g={}),h===i&&(g=this,h--);h<i;h++)if(null!=(a=arguments[h]))for(b in a)c=g[b],d=a[b],g!==d&&(j&&d&&(r.isPlainObject(d)||(e=Array.isArray(d)))?(e?(e=!1,f=c&&Array.isArray(c)?c:[]):f=c&&r.isPlainObject(c)?c:{},g[b]=r.extend(j,f,d)):void 0!==d&&(g[b]=d));return g},r.extend({expando:"jQuery"+(q+Math.random()).replace(/\D/g,""),isReady:!0,error:function(a){throw new Error(a)},noop:function(){},isFunction:function(a){return"function"===r.type(a)},isWindow:function(a){return null!=a&&a===a.window},isNumeric:function(a){var b=r.type(a);return("number"===b||"string"===b)&&!isNaN(a-parseFloat(a))},isPlainObject:function(a){var b,c;return!(!a||"[object Object]"!==k.call(a))&&(!(b=e(a))||(c=l.call(b,"constructor")&&b.constructor,"function"==typeof c&&m.call(c)===n))},isEmptyObject:function(a){var b;for(b in a)return!1;return!0},type:function(a){return null==a?a+"":"object"==typeof a||"function"==typeof a?j[k.call(a)]||"object":typeof a},globalEval:function(a){p(a)},camelCase:function(a){return a.replace(t,"ms-").replace(u,v)},each:function(a,b){var c,d=0;if(w(a)){for(c=a.length;d<c;d++)if(b.call(a[d],d,a[d])===!1)break}else for(d in a)if(b.call(a[d],d,a[d])===!1)break;return a},trim:function(a){return null==a?"":(a+"").replace(s,"")},makeArray:function(a,b){var c=b||[];return null!=a&&(w(Object(a))?r.merge(c,"string"==typeof a?[a]:a):h.call(c,a)),c},inArray:function(a,b,c){return null==b?-1:i.call(b,a,c)},merge:function(a,b){for(var c=+b.length,d=0,e=a.length;d<c;d++)a[e++]=b[d];return a.length=e,a},grep:function(a,b,c){for(var d,e=[],f=0,g=a.length,h=!c;f<g;f++)d=!b(a[f],f),d!==h&&e.push(a[f]);return e},map:function(a,b,c){var d,e,f=0,h=[];if(w(a))for(d=a.length;f<d;f++)e=b(a[f],f,c),null!=e&&h.push(e);else for(f in a)e=b(a[f],f,c),null!=e&&h.push(e);return g.apply([],h)},guid:1,proxy:function(a,b){var c,d,e;if("string"==typeof b&&(c=a[b],b=a,a=c),r.isFunction(a))return d=f.call(arguments,2),e=function(){return a.apply(b||this,d.concat(f.call(arguments)))},e.guid=a.guid=a.guid||r.guid++,e},now:Date.now,support:o}),"function"==typeof Symbol&&(r.fn[Symbol.iterator]=c[Symbol.iterator]),r.each("Boolean Number String Function Array Date RegExp Object Error Symbol".split(" "),function(a,b){j["[object "+b+"]"]=b.toLowerCase()});function w(a){var b=!!a&&"length"in a&&a.length,c=r.type(a);return"function"!==c&&!r.isWindow(a)&&("array"===c||0===b||"number"==typeof b&&b>0&&b-1 in a)}var x=function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u="sizzle"+1*new Date,v=a.document,w=0,x=0,y=ha(),z=ha(),A=ha(),B=function(a,b){return a===b&&(l=!0),0},C={}.hasOwnProperty,D=[],E=D.pop,F=D.push,G=D.push,H=D.slice,I=function(a,b){for(var c=0,d=a.length;c<d;c++)if(a[c]===b)return c;return-1},J="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",K="[\\x20\\t\\r\\n\\f]",L="(?:\\\\.|[\\w-]|[^\0-\\xa0])+",M="\\["+K+"*("+L+")(?:"+K+"*([*^$|!~]?=)"+K+"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|("+L+"))|)"+K+"*\\]",N=":("+L+")(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|"+M+")*)|.*)\\)|)",O=new RegExp(K+"+","g"),P=new RegExp("^"+K+"+|((?:^|[^\\\\])(?:\\\\.)*)"+K+"+$","g"),Q=new RegExp("^"+K+"*,"+K+"*"),R=new RegExp("^"+K+"*([>+~]|"+K+")"+K+"*"),S=new RegExp("="+K+"*([^\\]'\"]*?)"+K+"*\\]","g"),T=new RegExp(N),U=new RegExp("^"+L+"$"),V={IDLine truncated
|
||||
a.removeEventListener("load",S),r.ready()}"complete"===d.readyState||"loading"!==d.readyState&&!d.documentElement.doScroll?a.setTimeout(r.ready):(d.addEventListener("DOMContentLoaded",S),a.addEventListener("load",S));var T=function(a,b,c,d,e,f,g){var h=0,i=a.length,j=null==c;if("object"===r.type(c)){e=!0;for(h in c)T(a,b,h,c[h],!0,f,g)}else if(void 0!==d&&(e=!0,r.isFunction(d)||(g=!0),j&&(g?(b.call(a,d),b=null):(j=b,b=function(a,b,c){return j.call(r(a),c)})),b))for(;h<i;h++)b(a[h],c,g?d:d.call(a[h],h,b(a[h],c)));return e?a:j?b.call(a):i?b(a[0],c):f},U=function(a){return 1===a.nodeType||9===a.nodeType||!+a.nodeType};function V(){this.expando=r.expando+V.uid++}V.uid=1,V.prototype={cache:function(a){var b=a[this.expando];return b||(b={},U(a)&&(a.nodeType?a[this.expando]=b:Object.defineProperty(a,this.expando,{value:b,configurable:!0}))),b},set:function(a,b,c){var d,e=this.cache(a);if("string"==typeof b)e[r.camelCase(b)]=c;else for(d in b)e[r.camelCase(d)]=b[d];return e},get:function(a,b){return void 0===b?this.cache(a):a[this.expando]&&a[this.expando][r.camelCase(b)]},access:function(a,b,c){return void 0===b||b&&"string"==typeof b&&void 0===c?this.get(a,b):(this.set(a,b,c),void 0!==c?c:b)},remove:function(a,b){var c,d=a[this.expando];if(void 0!==d){if(void 0!==b){Array.isArray(b)?b=b.map(r.camelCase):(b=r.camelCase(b),b=b in d?[b]:b.match(L)||[]),c=b.length;while(c--)delete d[b[c]]}(void 0===b||r.isEmptyObject(d))&&(a.nodeType?a[this.expando]=void 0:delete a[this.expando])}},hasData:function(a){var b=a[this.expando];return void 0!==b&&!r.isEmptyObject(b)}};var W=new V,X=new V,Y=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,Z=/[A-Z]/g;function $(a){return"true"===a||"false"!==a&&("null"===a?null:a===+a+""?+a:Y.test(a)?JSON.parse(a):a)}function _(a,b,c){var d;if(void 0===c&&1===a.nodeType)if(d="data-"+b.replace(Z,"-$&").toLowerCase(),c=a.getAttribute(d),"string"==typeof c){try{c=$(c)}catch(e){}X.set(a,b,c)}else c=void 0;return c}r.extend({hasData:function(a){return X.hasData(a)||W.hasData(a)},data:function(a,b,c){return X.access(a,b,c)},removeData:function(a,b){X.remove(a,b)},_data:function(a,b,c){return W.access(a,b,c)},_removeData:function(a,b){W.remove(a,b)}}),r.fn.extend({data:function(a,b){var c,d,e,f=this[0],g=f&&f.attributes;if(void 0===a){if(this.length&&(e=X.get(f),1===f.nodeType&&!W.get(f,"hasDataAttrs"))){c=g.length;while(c--)g[c]&&(d=g[c].name,0===d.indexOf("data-")&&(d=r.camelCase(d.slice(5)),_(f,d,e[d])));W.set(f,"hasDataAttrs",!0)}return e}return"object"==typeof a?this.each(function(){X.set(this,a)}):T(this,function(b){var c;if(f&&void 0===b){if(c=X.get(f,a),void 0!==c)return c;if(c=_(f,a),void 0!==c)return c}else this.each(function(){X.set(this,a,b)})},null,b,arguments.length>1,null,!0)},removeData:function(a){return this.each(function(){X.remove(this,a)})}}),r.extend({queue:function(a,b,c){var d;if(a)return b=(b||"fx")+"queue",d=W.get(a,b),c&&(!d||Array.isArray(c)?d=W.access(a,b,r.makeArray(c)):d.push(c)),d||[]},dequeue:function(a,b){b=b||"fx";var c=r.queue(a,b),d=c.length,e=c.shift(),f=r._queueHooks(a,b),g=function(){r.dequeue(a,b)};"inprogress"===e&&(e=c.shift(),d--),e&&("fx"===b&&c.unshift("inprogress"),delete f.stop,e.call(a,g,f)),!d&&f&&f.empty.fire()},_queueHooks:function(a,b){var c=b+"queueHooks";return W.get(a,c)||W.access(a,c,{empty:r.Callbacks("once memory").add(function(){W.remove(a,[b+"queue",c])})})}}),r.fn.extend({queue:function(a,b){var c=2;return"string"!=typeof a&&(b=a,a="fx",c--),arguments.length<c?r.queue(this[0],a):void 0===b?this:this.each(function(){var c=r.queue(this,a,b);r._queueHooks(this,a),"fx"===a&&"inprogress"!==c[0]&&r.dequeue(this,a)})},dequeue:function(a){return this.each(function(){r.dequeue(this,a)})},clearQueue:function(a){return this.queue(a||"fx",[])},promise:function(a,b){var c,d=1,e=r.Deferred(),f=this,g=this.length,h=function(){--d||e.resolveWith(f,[f])};"string"!=typeof a&&(b=a,a=void 0),a=a||"fx";while(g--)c=W.get(f[g],a+"queueHooks"),c&&c.empty&&(d++,c.empty.add(h));return h(),e.promise(b)}});var aa=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,ba=new RegExp("^(?:([+-])=|)("+aa+")([a-z%]*)$","i"),ca=["Top","Right","Bottom","Left"],da=function(a,b){return a=b||a,"none"===a.style.display||""===a.style.display&&r.contains(a.ownerDocument,a)&&"none"===r.css(a,"display")},ea=function(a,b,c,d){var e,f,g={};for(f in b)g[f]=a.style[f],a.style[f]=b[f];e=c.apply(a,d||[]);for(f in b)a.style[f]=g[f];return e};function fa(a,b,c,d){var e,f=1,g=20,h=d?function(){return d.cur()}:function(){return r.css(a,b,"")},i=h(),j=c&&c[3]||(r.cssNumber[b]?"":"px"),k=(r.cssNumber[b]||"px"!==j&&+i)&&ba.exec(r.css(a,b));if(k&&k[3]!==j){j=j||k[3],c=c||[],k=+i||1;do f=f||".5",k/=f,r.style(a,b,k+j);while(f!==(f=h()/i)&&1!==f&&--g)}return c&&(k=+k||+i||0,e=c[1]?k+(c[1]+1)*c[2]:+c[2],d&&(d.unit=j,d.start=k,d.end=e)),e}var ga={};function ha(a){var b,c=a.ownerDocument,d=a.nodeName,e=ga[d];return e?e:(b=c.body.appendChild(c.createElement(d)),e=r.css(b,"display"),b.parentNode.removeChild(b),"none"===e&&(e=Line truncated
|
||||
null==d?void 0:d))},attrHooks:{type:{set:function(a,b){if(!o.radioValue&&"radio"===b&&B(a,"input")){var c=a.value;return a.setAttribute("type",b),c&&(a.value=c),b}}}},removeAttr:function(a,b){var c,d=0,e=b&&b.match(L);if(e&&1===a.nodeType)while(c=e[d++])a.removeAttribute(c)}}),lb={set:function(a,b,c){return b===!1?r.removeAttr(a,c):a.setAttribute(c,c),c}},r.each(r.expr.match.bool.source.match(/\w+/g),function(a,b){var c=mb[b]||r.find.attr;mb[b]=function(a,b,d){var e,f,g=b.toLowerCase();return d||(f=mb[g],mb[g]=e,e=null!=c(a,b,d)?g:null,mb[g]=f),e}});var nb=/^(?:input|select|textarea|button)$/i,ob=/^(?:a|area)$/i;r.fn.extend({prop:function(a,b){return T(this,r.prop,a,b,arguments.length>1)},removeProp:function(a){return this.each(function(){delete this[r.propFix[a]||a]})}}),r.extend({prop:function(a,b,c){var d,e,f=a.nodeType;if(3!==f&&8!==f&&2!==f)return 1===f&&r.isXMLDoc(a)||(b=r.propFix[b]||b,e=r.propHooks[b]),void 0!==c?e&&"set"in e&&void 0!==(d=e.set(a,c,b))?d:a[b]=c:e&&"get"in e&&null!==(d=e.get(a,b))?d:a[b]},propHooks:{tabIndex:{get:function(a){var b=r.find.attr(a,"tabindex");return b?parseInt(b,10):nb.test(a.nodeName)||ob.test(a.nodeName)&&a.href?0:-1}}},propFix:{"for":"htmlFor","class":"className"}}),o.optSelected||(r.propHooks.selected={get:function(a){var b=a.parentNode;return b&&b.parentNode&&b.parentNode.selectedIndex,null},set:function(a){var b=a.parentNode;b&&(b.selectedIndex,b.parentNode&&b.parentNode.selectedIndex)}}),r.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){r.propFix[this.toLowerCase()]=this});function pb(a){var b=a.match(L)||[];return b.join(" ")}function qb(a){return a.getAttribute&&a.getAttribute("class")||""}r.fn.extend({addClass:function(a){var b,c,d,e,f,g,h,i=0;if(r.isFunction(a))return this.each(function(b){r(this).addClass(a.call(this,b,qb(this)))});if("string"==typeof a&&a){b=a.match(L)||[];while(c=this[i++])if(e=qb(c),d=1===c.nodeType&&" "+pb(e)+" "){g=0;while(f=b[g++])d.indexOf(" "+f+" ")<0&&(d+=f+" ");h=pb(d),e!==h&&c.setAttribute("class",h)}}return this},removeClass:function(a){var b,c,d,e,f,g,h,i=0;if(r.isFunction(a))return this.each(function(b){r(this).removeClass(a.call(this,b,qb(this)))});if(!arguments.length)return this.attr("class","");if("string"==typeof a&&a){b=a.match(L)||[];while(c=this[i++])if(e=qb(c),d=1===c.nodeType&&" "+pb(e)+" "){g=0;while(f=b[g++])while(d.indexOf(" "+f+" ")>-1)d=d.replace(" "+f+" "," ");h=pb(d),e!==h&&c.setAttribute("class",h)}}return this},toggleClass:function(a,b){var c=typeof a;return"boolean"==typeof b&&"string"===c?b?this.addClass(a):this.removeClass(a):r.isFunction(a)?this.each(function(c){r(this).toggleClass(a.call(this,c,qb(this),b),b)}):this.each(function(){var b,d,e,f;if("string"===c){d=0,e=r(this),f=a.match(L)||[];while(b=f[d++])e.hasClass(b)?e.removeClass(b):e.addClass(b)}else void 0!==a&&"boolean"!==c||(b=qb(this),b&&W.set(this,"__className__",b),this.setAttribute&&this.setAttribute("class",b||a===!1?"":W.get(this,"__className__")||""))})},hasClass:function(a){var b,c,d=0;b=" "+a+" ";while(c=this[d++])if(1===c.nodeType&&(" "+pb(qb(c))+" ").indexOf(b)>-1)return!0;return!1}});var rb=/\r/g;r.fn.extend({val:function(a){var b,c,d,e=this[0];{if(arguments.length)return d=r.isFunction(a),this.each(function(c){var e;1===this.nodeType&&(e=d?a.call(this,c,r(this).val()):a,null==e?e="":"number"==typeof e?e+="":Array.isArray(e)&&(e=r.map(e,function(a){return null==a?"":a+""})),b=r.valHooks[this.type]||r.valHooks[this.nodeName.toLowerCase()],b&&"set"in b&&void 0!==b.set(this,e,"value")||(this.value=e))});if(e)return b=r.valHooks[e.type]||r.valHooks[e.nodeName.toLowerCase()],b&&"get"in b&&void 0!==(c=b.get(e,"value"))?c:(c=e.value,"string"==typeof c?c.replace(rb,""):null==c?"":c)}}}),r.extend({valHooks:{option:{get:function(a){var b=r.find.attr(a,"value");return null!=b?b:pb(r.text(a))}},select:{get:function(a){var b,c,d,e=a.options,f=a.selectedIndex,g="select-one"===a.type,h=g?null:[],i=g?f+1:e.length;for(d=f<0?i:g?f:0;d<i;d++)if(c=e[d],(c.selected||d===f)&&!c.disabled&&(!c.parentNode.disabled||!B(c.parentNode,"optgroup"))){if(b=r(c).val(),g)return b;h.push(b)}return h},set:function(a,b){var c,d,e=a.options,f=r.makeArray(b),g=e.length;while(g--)d=e[g],(d.selected=r.inArray(r.valHooks.option.get(d),f)>-1)&&(c=!0);return c||(a.selectedIndex=-1),f}}}}),r.each(["radio","checkbox"],function(){r.valHooks[this]={set:function(a,b){if(Array.isArray(b))return a.checked=r.inArray(r(a).val(),b)>-1}},o.checkOn||(r.valHooks[this].get=function(a){return null===a.getAttribute("value")?"on":a.value})});var sb=/^(?:focusinfocus|focusoutblur)$/;r.extend(r.event,{trigger:function(b,c,e,f){var g,h,i,j,k,m,n,o=[e||d],p=l.call(b,"type")?b.type:b,q=l.call(b,"namespace")?b.namespace.split("."):[];if(h=i=e=e||d,3!==e.nodeType&&8!==e.nodeType&&!sb.test(p+r.event.triggered)&&(p.indexOf(".")>-1&&(q=p.split("."),p=q.shift(),q.sort()),k=p.indexOf(":")<0&&"on"+p,b=b[r.expando]?bLine truncated
|
||||
Vendored
+2
@@ -0,0 +1,2 @@
|
||||
/*! jQuery v3.3.1 | (c) JS Foundation and other contributors | jquery.org/license */
|
||||
!function(e,t){"use strict";"object"==typeof module&&"object"==typeof module.exports?module.exports=e.document?t(e,!0):function(e){if(!e.document)throw new Error("jQuery requires a window with a document");return t(e)}:t(e)}("undefined"!=typeof window?window:this,function(e,t){"use strict";var n=[],r=e.document,i=Object.getPrototypeOf,o=n.slice,a=n.concat,s=n.push,u=n.indexOf,l={},c=l.toString,f=l.hasOwnProperty,p=f.toString,d=p.call(Object),h={},g=function e(t){return"function"==typeof t&&"number"!=typeof t.nodeType},y=function e(t){return null!=t&&t===t.window},v={type:!0,src:!0,noModule:!0};function m(e,t,n){var i,o=(t=t||r).createElement("script");if(o.text=e,n)for(i in v)n[i]&&(o[i]=n[i]);t.head.appendChild(o).parentNode.removeChild(o)}function x(e){return null==e?e+"":"object"==typeof e||"function"==typeof e?l[c.call(e)]||"object":typeof e}var b="3.3.1",w=function(e,t){return new w.fn.init(e,t)},T=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g;w.fn=w.prototype={jquery:"3.3.1",constructor:w,length:0,toArray:function(){return o.call(this)},get:function(e){return null==e?o.call(this):e<0?this[e+this.length]:this[e]},pushStack:function(e){var t=w.merge(this.constructor(),e);return t.prevObject=this,t},each:function(e){return w.each(this,e)},map:function(e){return this.pushStack(w.map(this,function(t,n){return e.call(t,n,t)}))},slice:function(){return this.pushStack(o.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(e){var t=this.length,n=+e+(e<0?t:0);return this.pushStack(n>=0&&n<t?[this[n]]:[])},end:function(){return this.prevObject||this.constructor()},push:s,sort:n.sort,splice:n.splice},w.extend=w.fn.extend=function(){var e,t,n,r,i,o,a=arguments[0]||{},s=1,u=arguments.length,l=!1;for("boolean"==typeof a&&(l=a,a=arguments[s]||{},s++),"object"==typeof a||g(a)||(a={}),s===u&&(a=this,s--);s<u;s++)if(null!=(e=arguments[s]))for(t in e)n=a[t],a!==(r=e[t])&&(l&&r&&(w.isPlainObject(r)||(i=Array.isArray(r)))?(i?(i=!1,o=n&&Array.isArray(n)?n:[]):o=n&&w.isPlainObject(n)?n:{},a[t]=w.extend(l,o,r)):void 0!==r&&(a[t]=r));return a},w.extend({expando:"jQuery"+("3.3.1"+Math.random()).replace(/\D/g,""),isReady:!0,error:function(e){throw new Error(e)},noop:function(){},isPlainObject:function(e){var t,n;return!(!e||"[object Object]"!==c.call(e))&&(!(t=i(e))||"function"==typeof(n=f.call(t,"constructor")&&t.constructor)&&p.call(n)===d)},isEmptyObject:function(e){var t;for(t in e)return!1;return!0},globalEval:function(e){m(e)},each:function(e,t){var n,r=0;if(C(e)){for(n=e.length;r<n;r++)if(!1===t.call(e[r],r,e[r]))break}else for(r in e)if(!1===t.call(e[r],r,e[r]))break;return e},trim:function(e){return null==e?"":(e+"").replace(T,"")},makeArray:function(e,t){var n=t||[];return null!=e&&(C(Object(e))?w.merge(n,"string"==typeof e?[e]:e):s.call(n,e)),n},inArray:function(e,t,n){return null==t?-1:u.call(t,e,n)},merge:function(e,t){for(var n=+t.length,r=0,i=e.length;r<n;r++)e[i++]=t[r];return e.length=i,e},grep:function(e,t,n){for(var r,i=[],o=0,a=e.length,s=!n;o<a;o++)(r=!t(e[o],o))!==s&&i.push(e[o]);return i},map:function(e,t,n){var r,i,o=0,s=[];if(C(e))for(r=e.length;o<r;o++)null!=(i=t(e[o],o,n))&&s.push(i);else for(o in e)null!=(i=t(e[o],o,n))&&s.push(i);return a.apply([],s)},guid:1,support:h}),"function"==typeof Symbol&&(w.fn[Symbol.iterator]=n[Symbol.iterator]),w.each("Boolean Number String Function Array Date RegExp Object Error Symbol".split(" "),function(e,t){l["[object "+t+"]"]=t.toLowerCase()});function C(e){var t=!!e&&"length"in e&&e.length,n=x(e);return!g(e)&&!y(e)&&("array"===n||0===t||"number"==typeof t&&t>0&&t-1 in e)}var E=function(e){var t,n,r,i,o,a,s,u,l,c,f,p,d,h,g,y,v,m,x,b="sizzle"+1*new Date,w=e.document,T=0,C=0,E=ae(),k=ae(),S=ae(),D=function(e,t){return e===t&&(f=!0),0},N={}.hasOwnProperty,A=[],j=A.pop,q=A.push,L=A.push,H=A.slice,O=function(e,t){for(var n=0,r=e.length;n<r;n++)if(e[n]===t)return n;return-1},P="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",M="[\\x20\\t\\r\\n\\f]",R="(?:\\\\.|[\\w-]|[^\0-\\xa0])+",I="\\["+M+"*("+R+")(?:"+M+"*([*^$|!~]?=)"+M+"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|("+R+"))|)"+M+"*\\]",W=":("+R+")(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|"+I+")*)|.*)\\)|)",$=new RegExp(M+"+","g"),B=new RegExp("^"+M+"+|((?:^|[^\\\\])(?:\\\\.)*)"+M+"+$","g"),F=new RegExp("^"+M+"*,"+M+"*"),_=new RegExp("^"+M+"*([>+~]|"+M+")"+M+"*"),z=new RegExp("="+M+"*([^\\]'\"]*?)"+M+"*\\]","g"),X=new RegExp(W),U=new RegExp("^"+R+"$"),V={ID:new RegExp("^#("+R+")"),CLASS:new RegExp("^\\.("+R+")"),TAG:new RegExp("^("+R+"|[*])"),ATTR:new RegExp("^"+I),PSEUDO:new RegExp("^"+W),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+M+"*(even|odd|(([+-]|)(\\d*)n|)"+M+"*(?:([+-]|)"+M+"*(\\d+)|))"+M+"*\\)|)","i"),bool:new RegExp("^(?:"+P+")$","i"),needsContext:new RegExp("^"+M+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)Line truncated
|
||||
Vendored
+6
@@ -0,0 +1,6 @@
|
||||
/*!
|
||||
* Materialize v1.0.0 (http://materializecss.com)
|
||||
* Copyright 2014-2017 Materialize
|
||||
* MIT License (https://raw.githubusercontent.com/Dogfalo/materialize/master/LICENSE)
|
||||
*/
|
||||
var _get=function t(e,i,n){null===e&&(e=Function.prototype);var s=Object.getOwnPropertyDescriptor(e,i);if(void 0===s){var o=Object.getPrototypeOf(e);return null===o?void 0:t(o,i,n)}if("value"in s)return s.value;var a=s.get;return void 0!==a?a.call(n):void 0},_createClass=function(){function n(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(t,e,i){return e&&n(t.prototype,e),i&&n(t,i),t}}();function _possibleConstructorReturn(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function _inherits(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}function _classCallCheck(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}window.cash=function(){var i,o=document,a=window,t=Array.prototype,r=t.slice,n=t.filter,s=t.push,e=function(){},h=function(t){return typeof t==typeof e&&t.call},d=function(t){return"string"==typeof t},l=/^#[\w-]*$/,u=/^\.[\w-]*$/,c=/<.+>/,p=/^\w+$/;function v(t,e){e=e||o;var i=u.test(t)?e.getElementsByClassName(t.slice(1)):p.test(t)?e.getElementsByTagName(t):e.querySelectorAll(t);return i}function f(t){if(!i){var e=(i=o.implementation.createHTMLDocument(null)).createElement("base");e.href=o.location.href,i.head.appendChild(e)}return i.body.innerHTML=t,i.body.childNodes}function m(t){"loading"!==o.readyState?t():o.addEventListener("DOMContentLoaded",t)}function g(t,e){if(!t)return this;if(t.cash&&t!==a)return t;var i,n=t,s=0;if(d(t))n=l.test(t)?o.getElementById(t.slice(1)):c.test(t)?f(t):v(t,e);else if(h(t))return m(t),this;if(!n)return this;if(n.nodeType||n===a)this[0]=n,this.length=1;else for(i=this.length=n.length;s<i;s++)this[s]=n[s];return this}function _(t,e){return new g(t,e)}var y=_.fn=_.prototype=g.prototype={cash:!0,length:0,push:s,splice:t.splice,map:t.map,init:g};function k(t,e){for(var i=t.length,n=0;n<i&&!1!==e.call(t[n],t[n],n,t);n++);}function b(t,e){var i=t&&(t.matches||t.webkitMatchesSelector||t.mozMatchesSelector||t.msMatchesSelector||t.oMatchesSelector);return!!i&&i.call(t,e)}function w(e){return d(e)?b:e.cash?function(t){return e.is(t)}:function(t,e){return t===e}}function C(t){return _(r.call(t).filter(function(t,e,i){return i.indexOf(t)===e}))}Object.defineProperty(y,"constructor",{value:_}),_.parseHTML=f,_.noop=e,_.isFunction=h,_.isString=d,_.extend=y.extend=function(t){t=t||{};var e=r.call(arguments),i=e.length,n=1;for(1===e.length&&(t=this,n=0);n<i;n++)if(e[n])for(var s in e[n])e[n].hasOwnProperty(s)&&(t[s]=e[n][s]);return t},_.extend({merge:function(t,e){for(var i=+e.length,n=t.length,s=0;s<i;n++,s++)t[n]=e[s];return t.length=n,t},each:k,matches:b,unique:C,isArray:Array.isArray,isNumeric:function(t){return!isNaN(parseFloat(t))&&isFinite(t)}});var E=_.uid="_cash"+Date.now();function M(t){return t[E]=t[E]||{}}function O(t,e,i){return M(t)[e]=i}function x(t,e){var i=M(t);return void 0===i[e]&&(i[e]=t.dataset?t.dataset[e]:_(t).attr("data-"+e)),i[e]}y.extend({data:function(e,i){if(d(e))return void 0===i?x(this[0],e):this.each(function(t){return O(t,e,i)});for(var t in e)this.data(t,e[t]);return this},removeData:function(s){return this.each(function(t){return i=s,void((n=M(e=t))?delete n[i]:e.dataset?delete e.dataset[i]:_(e).removeAttr("data-"+name));var e,i,n})}});var L=/\S+/g;function T(t){return d(t)&&t.match(L)}function $(t,e){return t.classList?t.classList.contains(e):new RegExp("(^| )"+e+"( |$)","gi").test(t.className)}function B(t,e,i){t.classList?t.classList.add(e):i.indexOf(" "+e+" ")&&(t.className+=" "+e)}function D(t,e){t.classList?t.classList.remove(e):t.className=t.className.replace(e,"")}y.extend({addClass:function(t){var n=T(t);return n?this.each(function(e){var i=" "+e.className+" ";k(n,function(t){B(e,t,i)})}):this},attr:function(e,i){if(e){if(d(e))return void 0===i?this[0]?this[0].getAttribute?this[0].getAttribute(e):this[0][e]:void 0:this.each(function(t){t.setAttribute?t.setAttribute(e,i):t[e]=i});for(var t in e)this.attr(t,e[t]);return this}},hasClass:function(t){var e=!1,i=T(t);return i&&i.length&&this.each(function(t){return!(e=$(t,i[0]))}),e},prop:function(e,i){if(d(e))return void 0===i?this[0][e]:this.each(function(t){t[e]=i});for(var t in e)this.prop(t,e[t]);return this},removeAttr:function(e){return this.each(function(t){t.removeAttribute?t.removeAttribute(e):delete t[e]})},removeClass:function(t){if(!arguments.length)return this.attr("class","");var i=T(t);return i?this.each(function(e){k(i,function(t){D(e,t)})}):this},removeProp:function(e){return this.each(function(t){delete t[e]})},toggleClass:function(t,e){if(void 0!==e)return this[e?"addClassLine truncated
|
||||
Reference in new issue
Block a user