Ajout des templates de vue
This commit is contained in:
parent
30fcb9d07b
commit
fa585c660a
54 changed files with 4484 additions and 71 deletions
48
app/Http/Controllers/EnterCodeController.php
Normal file
48
app/Http/Controllers/EnterCodeController.php
Normal file
|
|
@ -0,0 +1,48 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
|
use App\Models\CodesEAN;
|
||||||
|
use App\Models\Prizes;
|
||||||
|
use App\Models\Settings;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
|
class EnterCodeController extends Controller
|
||||||
|
{
|
||||||
|
public function index() {
|
||||||
|
$settings = Settings::find(1)->select('use_ean_codes')->first();
|
||||||
|
return view('front.basic.enter-code', compact('settings'));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function participate(Request $request) {
|
||||||
|
$code = $request->code;
|
||||||
|
$settings = Settings::select('use_ean_codes')->first();
|
||||||
|
if ($settings->use_ean_codes) {
|
||||||
|
$codeEan = $request->code_ean;
|
||||||
|
$eanExist = CodesEAN::where('code', $codeEan)->count();
|
||||||
|
if ($eanExist === 0) {
|
||||||
|
return redirect()->back()->withErrors('Le code EAN entré est incorrect, veuillez réessayer.');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$gagne = false;
|
||||||
|
// TODO : Traitement du code, instant gagnant etc
|
||||||
|
if ($gagne) {
|
||||||
|
// TODO : Retourne à la page du lot, ajouté le fait de donné l'id du lot avec
|
||||||
|
return redirect()->route('gagne');
|
||||||
|
} else {
|
||||||
|
// Page perdu si jeu non 100% gagnant, reduction sinon
|
||||||
|
$perdant = false;
|
||||||
|
$nbDefaultPrize = Prizes::where('is_default', 1)->count();
|
||||||
|
if ($nbDefaultPrize === 0 ) {
|
||||||
|
$perdant = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($perdant) {
|
||||||
|
return redirect()->route('perdu');
|
||||||
|
} else {
|
||||||
|
// TODO : Retourner la page de réduction avec la bonne réduction
|
||||||
|
return redirect()->route('reduction');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
14
app/Http/Controllers/GainsController.php
Normal file
14
app/Http/Controllers/GainsController.php
Normal file
|
|
@ -0,0 +1,14 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
|
use App\Models\Prizes;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
|
class GainsController extends Controller
|
||||||
|
{
|
||||||
|
public function index() {
|
||||||
|
$prizes = Prizes::all();
|
||||||
|
return view('front.basic.gains', compact('prizes'));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -6,7 +6,8 @@ use Illuminate\Http\Request;
|
||||||
|
|
||||||
class HomeController extends Controller
|
class HomeController extends Controller
|
||||||
{
|
{
|
||||||
public function home() {
|
public function home()
|
||||||
|
{
|
||||||
return view('front.basic.home');
|
return view('front.basic.home');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
14
app/Http/Controllers/HowToPlayController.php
Normal file
14
app/Http/Controllers/HowToPlayController.php
Normal file
|
|
@ -0,0 +1,14 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
|
use App\Models\Prizes;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
|
class HowToPlayController extends Controller
|
||||||
|
{
|
||||||
|
public function index() {
|
||||||
|
$prizes = Prizes::all();
|
||||||
|
return view('front.basic.how-to-play', compact('prizes'));
|
||||||
|
}
|
||||||
|
}
|
||||||
66
app/Http/Controllers/LoginController.php
Normal file
66
app/Http/Controllers/LoginController.php
Normal file
|
|
@ -0,0 +1,66 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Support\Facades\Auth;
|
||||||
|
use App\Providers\RouteServiceProvider;
|
||||||
|
use App\User;
|
||||||
|
use CPCConnection;
|
||||||
|
use Exception;
|
||||||
|
|
||||||
|
class LoginController extends Controller
|
||||||
|
{
|
||||||
|
|
||||||
|
public function __construct() {
|
||||||
|
$this->middleware('guest')->except('logout');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function index() {
|
||||||
|
return view('front.basic.login');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function authenticate(Request $request)
|
||||||
|
{
|
||||||
|
$email = $request->email;
|
||||||
|
$password = $request->password;
|
||||||
|
$remember = $request->remember !== null ? true : false;
|
||||||
|
|
||||||
|
$userLocal = User::where('email', $email)->first();
|
||||||
|
|
||||||
|
if ($userLocal) {
|
||||||
|
if ($userLocal->role !== 1) {
|
||||||
|
try {
|
||||||
|
$cpcConnect = new CPCConnection(config('crm.CRM_PLATOS_WSDL'), config('crm.WS_SERVCE_LOGIN'), config('crm.WS_SERVCE_PASSWORD'));
|
||||||
|
$cpcConnect->connect();
|
||||||
|
try {
|
||||||
|
// ---- Authentification du user
|
||||||
|
$cpcConnect->authenticateUser ($email, $password);
|
||||||
|
} catch (Exception $e) {
|
||||||
|
return redirect()->back()->withInput($request->only("email", "password"))->withErrors("Email ou mot de passe incorrect.");
|
||||||
|
}
|
||||||
|
} catch (Exception $e) {
|
||||||
|
return redirect()->back()->withInput($request->only("email", "password"))->withErrors("La connexion est impossible pour le moment, veuillez réessayer plus tard.");
|
||||||
|
die();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Auth::attempt(["email" => $email, "password" => $password], $remember)) {
|
||||||
|
if ($userLocal->role === 1)
|
||||||
|
return redirect()->route('bo.dashboard');
|
||||||
|
return redirect()->route('home');
|
||||||
|
} else {
|
||||||
|
return redirect()->back()->withInput($request->only('email', 'remember'))->withErrors('Les identifiants entrés sont incorrects.');
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return redirect()->back()->withInput($request->only('email', 'remember'))->withErrors('Les identifiants entrés sont incorrects.');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public function logout() {
|
||||||
|
Auth::logout();
|
||||||
|
return redirect()->route('home');
|
||||||
|
}
|
||||||
|
}
|
||||||
12
app/Http/Controllers/LooseController.php
Normal file
12
app/Http/Controllers/LooseController.php
Normal file
|
|
@ -0,0 +1,12 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
|
class LooseController extends Controller
|
||||||
|
{
|
||||||
|
public function index() {
|
||||||
|
return view('front.basic.loose');
|
||||||
|
}
|
||||||
|
}
|
||||||
20
app/Http/Controllers/PrizeWinController.php
Normal file
20
app/Http/Controllers/PrizeWinController.php
Normal file
|
|
@ -0,0 +1,20 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
|
use App\Models\Prizes;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
|
class PrizeWinController extends Controller
|
||||||
|
{
|
||||||
|
public function index(Request $request) {
|
||||||
|
$prizeId = $request->prize;
|
||||||
|
$prize = Prizes::findOrFail($prizeId);
|
||||||
|
// TODO : Check que le participant à bien gagné avant de renvoyé la vue, sinon 404
|
||||||
|
return view('front.basic.' . $prize->gain_view->file_name);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function reduction(Request $request) {
|
||||||
|
return view('front.basic.reduction');
|
||||||
|
}
|
||||||
|
}
|
||||||
123
app/Http/Controllers/RegisterController.php
Normal file
123
app/Http/Controllers/RegisterController.php
Normal file
|
|
@ -0,0 +1,123 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use App\Providers\RouteServiceProvider;
|
||||||
|
use App\User;
|
||||||
|
use Carbon\Carbon;
|
||||||
|
use CPCConnection;
|
||||||
|
use CPCUser;
|
||||||
|
use Exception;
|
||||||
|
use Illuminate\Foundation\Auth\RegistersUsers;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Support\Facades\Auth;
|
||||||
|
use Illuminate\Support\Facades\Hash;
|
||||||
|
use Illuminate\Support\Str;
|
||||||
|
use Illuminate\Support\Facades\Mail;
|
||||||
|
|
||||||
|
class RegisterController extends Controller
|
||||||
|
{
|
||||||
|
use RegistersUsers;
|
||||||
|
|
||||||
|
protected $redirectTo = RouteServiceProvider::HOME;
|
||||||
|
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
$this->middleware('guest');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function index() {
|
||||||
|
return view('front.basic.register-crm');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function register(Request $request) {
|
||||||
|
|
||||||
|
$civility = $request->civility;
|
||||||
|
$lastname = filter_var($request->lastname, FILTER_SANITIZE_STRING);
|
||||||
|
$firstname = filter_var($request->firstname, FILTER_SANITIZE_STRING);
|
||||||
|
$birthDate = $request->birth_date;
|
||||||
|
$email = filter_var($request->email, FILTER_SANITIZE_EMAIL);
|
||||||
|
$username = filter_var($request->username, FILTER_SANITIZE_STRING);
|
||||||
|
$password = $request->password;
|
||||||
|
$address = filter_var($request->address, FILTER_SANITIZE_STRING);
|
||||||
|
$address2 = $request->address2 !== null ? filter_var($request->address2, FILTER_SANITIZE_STRING) : null;
|
||||||
|
$town = filter_var($request->town, FILTER_SANITIZE_STRING);
|
||||||
|
$postalCode = filter_var($request->postal_code, FILTER_SANITIZE_STRING);
|
||||||
|
$country = filter_var($request->country, FILTER_SANITIZE_STRING);
|
||||||
|
$news = $request->news !== null ? 1 : 0;
|
||||||
|
$tokenMail = Str::uuid();
|
||||||
|
$request->validate([
|
||||||
|
'lastname' => 'required|string|max:255',
|
||||||
|
'firstname' => 'required|string|max:255',
|
||||||
|
'birth_date' => 'required|date|before_or_equal:' . Carbon::now()->subYear(18)->toDateString(),
|
||||||
|
'email' => 'required|string|email|max:255|unique:users',
|
||||||
|
'username' => 'required|string|min:3|max:255',
|
||||||
|
'password' => 'required|string|min:8|confirmed',
|
||||||
|
'address' => 'required|string|max:255',
|
||||||
|
'address2' => 'max:255',
|
||||||
|
'town' => 'required|string|max:255',
|
||||||
|
'postal_code' => 'required|string|max:255',
|
||||||
|
'country' => 'required|string|max:255',
|
||||||
|
]);
|
||||||
|
|
||||||
|
$crmId = null;
|
||||||
|
|
||||||
|
try {
|
||||||
|
$cpcConnect = new CPCConnection(config('crm.CRM_PLATOS_WSDL'), config('crm.WS_SERVCE_LOGIN'), config('crm.WS_SERVCE_PASSWORD'));
|
||||||
|
$cpcConnect->connect();
|
||||||
|
|
||||||
|
try {
|
||||||
|
$oCrmUser = new CPCUser();
|
||||||
|
$oCrmUser->zCivilite = $civility;
|
||||||
|
$oCrmUser->zNom = $lastname ;
|
||||||
|
$oCrmUser->zPrenom = $firstname ;
|
||||||
|
$oCrmUser->zDateNaissance = $birthDate;
|
||||||
|
$oCrmUser->zVille = $town ;
|
||||||
|
$oCrmUser->zCodePostal = $postalCode ;
|
||||||
|
$oCrmUser->addField ("pays", FIELDTYPE_TEXT, "", $country);
|
||||||
|
$oCrmUser->zLogin = $email ;
|
||||||
|
$oCrmUser->zEmail = $email;
|
||||||
|
$oCrmUser->zPassword = $password;
|
||||||
|
if($news == 1) $oCrmUser->iInscritNewLetter = $news ;
|
||||||
|
$oCrmUser->iId = $cpcConnect->createUser($oCrmUser, 0);
|
||||||
|
$crmId = $oCrmUser->iId;
|
||||||
|
// TODO : Envoi de mail pour confirmation
|
||||||
|
|
||||||
|
} catch (Exception $e) {
|
||||||
|
return redirect()->back()
|
||||||
|
->withInput($request->only("lastname","firstname","birth_date","email","username", "address", "address2", "town", "postal_code", "country"))
|
||||||
|
->withErrors("Un compte utilisateur est déjà associé à votre email. Modifiez votre email ou connectez vous avec ce compte.");
|
||||||
|
}
|
||||||
|
} catch (Exception $e) {
|
||||||
|
return redirect()->back()
|
||||||
|
->withInput($request->only("lastname","firstname","birth_date","email","username", "address", "address2", "town", "postal_code", "country"))
|
||||||
|
->withErrors("Une erreur est survenue, merci de recommencer.");
|
||||||
|
}
|
||||||
|
|
||||||
|
User::create([
|
||||||
|
'crm_id' => $crmId,
|
||||||
|
'civility' => $civility,
|
||||||
|
'firstname' => $firstname,
|
||||||
|
'lastname' => $lastname,
|
||||||
|
'birth_date' => $birthDate,
|
||||||
|
'email' => $email,
|
||||||
|
'username' => $username,
|
||||||
|
'password' => Hash::make($password),
|
||||||
|
'address' => $address,
|
||||||
|
'address2' => $address2,
|
||||||
|
'town' => $town,
|
||||||
|
'postal_code' => $postalCode,
|
||||||
|
'country' => $country,
|
||||||
|
'email_verify_token' => $tokenMail,
|
||||||
|
]);
|
||||||
|
|
||||||
|
$credentials = $request->only('email', 'password');
|
||||||
|
|
||||||
|
if (Auth::attempt($credentials)) {
|
||||||
|
return redirect()->route('home');
|
||||||
|
}
|
||||||
|
|
||||||
|
return redirect()->route('home');
|
||||||
|
}
|
||||||
|
}
|
||||||
21
app/Http/Controllers/VerificationController.php
Normal file
21
app/Http/Controllers/VerificationController.php
Normal file
|
|
@ -0,0 +1,21 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers\Auth;
|
||||||
|
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use App\User;
|
||||||
|
|
||||||
|
class VerificationController extends Controller
|
||||||
|
{
|
||||||
|
public function verifEmail($token) {
|
||||||
|
// TODO : Vérification email
|
||||||
|
$user = User::where('email_verify_token', $token)->first();
|
||||||
|
if ($user != null) {
|
||||||
|
$user->email_verified_at = now();
|
||||||
|
$user->save();
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -30,22 +30,17 @@ class GainViewController extends Controller
|
||||||
public function saveDatas(Request $request) {
|
public function saveDatas(Request $request) {
|
||||||
$gv = $request->gainViews;
|
$gv = $request->gainViews;
|
||||||
|
|
||||||
try {
|
for ($i = 0; $i < count($gv); $i++) {
|
||||||
for ($i = 0; $i < count($gv); $i++) {
|
if (isset($gv[$i]["id"])) {
|
||||||
if (isset($gv[$i]["id"])) {
|
$g = GainView::findOrFail($gv[$i]["id"]);
|
||||||
$g = GainView::findOrFail($gv[$i]["id"]);
|
$g->name = $gv[$i]["name"];
|
||||||
$g->name = $gv[$i]["name"];
|
$g->file_name = $gv[$i]["file_name"];
|
||||||
$g->file_name = $gv[$i]["file_name"];
|
$g->slug_route = $gv[$i]["slug_route"];
|
||||||
$g->slug_route = $gv[$i]["slug_route"];
|
$g->save();
|
||||||
$g->save();
|
} else {
|
||||||
} else {
|
$g = GainView::updateOrCreate(['name' => $gv[$i]["name"], 'file_name' => $gv[$i]["file_name"], 'slug_route' => $gv[$i]["slug_route"]]);
|
||||||
$g = GainView::updateOrCreate(['name' => $gv[$i]["name"], 'file_name' => $gv[$i]["file_name"], 'slug_route' => $gv[$i]["slug_route"]]);
|
$gv[$i]["id"] = $g->id;
|
||||||
$gv[$i]["id"] = $g->id;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} catch (Exception $e) {
|
|
||||||
// TODO : Retour erreur correct
|
|
||||||
$e->getTraceAsString();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return $gv;
|
return $gv;
|
||||||
|
|
|
||||||
|
|
@ -41,7 +41,6 @@ class InstantWinController extends Controller
|
||||||
|
|
||||||
$begin = new \DateTime( $start_date );
|
$begin = new \DateTime( $start_date );
|
||||||
$end = new \DateTime( $end_date );
|
$end = new \DateTime( $end_date );
|
||||||
$end = $end->modify( '+1 day' );
|
|
||||||
$interval = new \DateInterval('P1D');
|
$interval = new \DateInterval('P1D');
|
||||||
$daterange = new \DatePeriod($begin, $interval ,$end);
|
$daterange = new \DatePeriod($begin, $interval ,$end);
|
||||||
$dateGlobal = [];
|
$dateGlobal = [];
|
||||||
|
|
|
||||||
|
|
@ -59,6 +59,7 @@ class Kernel extends HttpKernel
|
||||||
'cache.headers' => \Illuminate\Http\Middleware\SetCacheHeaders::class,
|
'cache.headers' => \Illuminate\Http\Middleware\SetCacheHeaders::class,
|
||||||
'can' => \Illuminate\Auth\Middleware\Authorize::class,
|
'can' => \Illuminate\Auth\Middleware\Authorize::class,
|
||||||
'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class,
|
'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class,
|
||||||
|
'is-admin' => \App\Http\Middleware\isAdmin::class,
|
||||||
'password.confirm' => \Illuminate\Auth\Middleware\RequirePassword::class,
|
'password.confirm' => \Illuminate\Auth\Middleware\RequirePassword::class,
|
||||||
'signed' => \Illuminate\Routing\Middleware\ValidateSignature::class,
|
'signed' => \Illuminate\Routing\Middleware\ValidateSignature::class,
|
||||||
'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class,
|
'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class,
|
||||||
|
|
|
||||||
24
app/Http/Middleware/isAdmin.php
Normal file
24
app/Http/Middleware/isAdmin.php
Normal file
|
|
@ -0,0 +1,24 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Middleware;
|
||||||
|
|
||||||
|
use Closure;
|
||||||
|
use Illuminate\Support\Facades\Auth;
|
||||||
|
|
||||||
|
class isAdmin
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Handle an incoming request.
|
||||||
|
*
|
||||||
|
* @param \Illuminate\Http\Request $request
|
||||||
|
* @param \Closure $next
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function handle($request, Closure $next)
|
||||||
|
{
|
||||||
|
$role = Auth::user()->role;
|
||||||
|
if ($role === 1)
|
||||||
|
return $next($request);
|
||||||
|
abort(404, "Cette page n'existe pas.");
|
||||||
|
}
|
||||||
|
}
|
||||||
34
app/Mail/VerifyEmail.php
Normal file
34
app/Mail/VerifyEmail.php
Normal file
|
|
@ -0,0 +1,34 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Mail;
|
||||||
|
|
||||||
|
use Illuminate\Bus\Queueable;
|
||||||
|
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||||
|
use Illuminate\Mail\Mailable;
|
||||||
|
use Illuminate\Queue\SerializesModels;
|
||||||
|
|
||||||
|
class VerifyEmail extends Mailable
|
||||||
|
{
|
||||||
|
use Queueable, SerializesModels;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new message instance.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Build the message.
|
||||||
|
*
|
||||||
|
* @return $this
|
||||||
|
*/
|
||||||
|
public function build()
|
||||||
|
{
|
||||||
|
// TODO : Faire le mailable pour vérifier l'inscription
|
||||||
|
return $this->view('view.name');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -2,6 +2,8 @@
|
||||||
|
|
||||||
namespace App\Providers;
|
namespace App\Providers;
|
||||||
|
|
||||||
|
use App\Models\Settings;
|
||||||
|
use Illuminate\Support\Facades\View;
|
||||||
use Illuminate\Support\ServiceProvider;
|
use Illuminate\Support\ServiceProvider;
|
||||||
|
|
||||||
class AppServiceProvider extends ServiceProvider
|
class AppServiceProvider extends ServiceProvider
|
||||||
|
|
@ -23,6 +25,8 @@ class AppServiceProvider extends ServiceProvider
|
||||||
*/
|
*/
|
||||||
public function boot()
|
public function boot()
|
||||||
{
|
{
|
||||||
//
|
// On ramène le nom du jeu et le nom de la société sur toute les pages
|
||||||
|
$settingsGlobal = Settings::find(1)->select('name', 'company')->first();
|
||||||
|
View::share('settingsGlobal', $settingsGlobal);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ class RouteServiceProvider extends ServiceProvider
|
||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
public const HOME = '/home';
|
public const HOME = '/';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Define your route model bindings, pattern filters, etc.
|
* Define your route model bindings, pattern filters, etc.
|
||||||
|
|
|
||||||
16
app/User.php
16
app/User.php
|
|
@ -16,7 +16,21 @@ class User extends Authenticatable
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
protected $fillable = [
|
protected $fillable = [
|
||||||
'name', 'email', 'password',
|
'crm_id',
|
||||||
|
'civility',
|
||||||
|
'firstname',
|
||||||
|
'lastname',
|
||||||
|
'birth_date',
|
||||||
|
'email',
|
||||||
|
'username',
|
||||||
|
'password',
|
||||||
|
'address',
|
||||||
|
'address2',
|
||||||
|
'town',
|
||||||
|
'postal_code',
|
||||||
|
'country',
|
||||||
|
'email_verify_token',
|
||||||
|
'email_verified'
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,8 @@
|
||||||
"fruitcake/laravel-cors": "^2.0",
|
"fruitcake/laravel-cors": "^2.0",
|
||||||
"guzzlehttp/guzzle": "^6.3",
|
"guzzlehttp/guzzle": "^6.3",
|
||||||
"laravel/framework": "^7.24",
|
"laravel/framework": "^7.24",
|
||||||
"laravel/tinker": "^2.0"
|
"laravel/tinker": "^2.0",
|
||||||
|
"laravel/ui": "2.4"
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"facade/ignition": "^2.0",
|
"facade/ignition": "^2.0",
|
||||||
|
|
@ -38,7 +39,8 @@
|
||||||
},
|
},
|
||||||
"classmap": [
|
"classmap": [
|
||||||
"database/seeds",
|
"database/seeds",
|
||||||
"database/factories"
|
"database/factories",
|
||||||
|
"ldccrm_client"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"autoload-dev": {
|
"autoload-dev": {
|
||||||
|
|
|
||||||
|
|
@ -70,11 +70,6 @@ return [
|
||||||
'driver' => 'eloquent',
|
'driver' => 'eloquent',
|
||||||
'model' => App\User::class,
|
'model' => App\User::class,
|
||||||
],
|
],
|
||||||
|
|
||||||
// 'users' => [
|
|
||||||
// 'driver' => 'database',
|
|
||||||
// 'table' => 'users',
|
|
||||||
// ],
|
|
||||||
],
|
],
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
||||||
9
config/crm.php
Normal file
9
config/crm.php
Normal file
|
|
@ -0,0 +1,9 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
return [
|
||||||
|
|
||||||
|
'CRM_PLATOS_WSDL' => env('CRM_PLATOS_WSDL'),
|
||||||
|
'WS_SERVCE_LOGIN' => env('WS_SERVCE_LOGIN'),
|
||||||
|
'WS_SERVCE_PASSWORD' => env('WS_SERVCE_PASSWORD'),
|
||||||
|
|
||||||
|
];
|
||||||
|
|
@ -15,10 +15,22 @@ class CreateUsersTable extends Migration
|
||||||
{
|
{
|
||||||
Schema::create('users', function (Blueprint $table) {
|
Schema::create('users', function (Blueprint $table) {
|
||||||
$table->id();
|
$table->id();
|
||||||
$table->string('name');
|
$table->integer('crm_id')->nullable();
|
||||||
|
$table->integer('civility');
|
||||||
|
$table->string('firstname');
|
||||||
|
$table->string('lastname');
|
||||||
|
$table->date('birth_date');
|
||||||
$table->string('email')->unique();
|
$table->string('email')->unique();
|
||||||
$table->timestamp('email_verified_at')->nullable();
|
$table->string('username');
|
||||||
$table->string('password');
|
$table->string('password');
|
||||||
|
$table->string('address');
|
||||||
|
$table->string('address2')->nullable();
|
||||||
|
$table->string('town');
|
||||||
|
$table->string('postal_code');
|
||||||
|
$table->string('country');
|
||||||
|
$table->string('email_verify_token');
|
||||||
|
$table->boolean('email_verified')->default(0);
|
||||||
|
$table->integer('role')->default(2);
|
||||||
$table->rememberToken();
|
$table->rememberToken();
|
||||||
$table->timestamps();
|
$table->timestamps();
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,44 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
class CreateParticipation extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
Schema::create('participation', function (Blueprint $table) {
|
||||||
|
$table->id();
|
||||||
|
$table->foreignId('user_id')->constrained('users');
|
||||||
|
$table->foreignId('prize_id')->constrained('prizes');
|
||||||
|
$table->string('address')->nullable();
|
||||||
|
$table->string('address2')->nullable();
|
||||||
|
$table->string('town')->nullable();
|
||||||
|
$table->string('postal_code')->nullable();
|
||||||
|
$table->string('country')->nullable();
|
||||||
|
$table->string('phone')->nullable();
|
||||||
|
$table->string('sticker')->nullable();
|
||||||
|
$table->string('ticker')->nullable();
|
||||||
|
$table->string('barcode')->nullable();
|
||||||
|
$table->string('browser');
|
||||||
|
$table->string('device');
|
||||||
|
$table->timestamps();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('participation');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -13,5 +13,6 @@ class DatabaseSeeder extends Seeder
|
||||||
{
|
{
|
||||||
$this->call(SettingsSeeder::class);
|
$this->call(SettingsSeeder::class);
|
||||||
$this->call(ContentSeeder::class);
|
$this->call(ContentSeeder::class);
|
||||||
|
$this->call(UserSeeder::class);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
33
database/seeds/UserSeeder.php
Normal file
33
database/seeds/UserSeeder.php
Normal file
|
|
@ -0,0 +1,33 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
use App\User;
|
||||||
|
use Illuminate\Database\Seeder;
|
||||||
|
use Illuminate\Support\Facades\Hash;
|
||||||
|
|
||||||
|
class UserSeeder extends Seeder
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the database seeds.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function run()
|
||||||
|
{
|
||||||
|
$user = new User();
|
||||||
|
$user->civility = 1;
|
||||||
|
$user->firstname = "Romain";
|
||||||
|
$user->lastname = "Bonhomme";
|
||||||
|
$user->birth_date = now();
|
||||||
|
$user->email = "romain.bonhomme@ldc.fr";
|
||||||
|
$user->username = "RomainB";
|
||||||
|
$user->password = Hash::make("@v1tZ!r_24cA");
|
||||||
|
$user->address = "-";
|
||||||
|
$user->town = "Le Mans";
|
||||||
|
$user->postal_code = "72000";
|
||||||
|
$user->country = "France";
|
||||||
|
$user->email_verify_token = "-";
|
||||||
|
$user->email_verified = 1;
|
||||||
|
$user->role = 1;
|
||||||
|
$user->save();
|
||||||
|
}
|
||||||
|
}
|
||||||
199
ldccrm_client/CPCBon.class.php
Normal file
199
ldccrm_client/CPCBon.class.php
Normal file
|
|
@ -0,0 +1,199 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
include_once ('datatypes.inc.php') ;
|
||||||
|
include_once ('errors.inc.php') ;
|
||||||
|
include_once ('pi_barcode.php') ;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Classe faisant abstraction d'un Bon de reduction
|
||||||
|
*
|
||||||
|
* @package PlatosClient
|
||||||
|
* @name CPCBon
|
||||||
|
*/
|
||||||
|
class CPCBon
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var int
|
||||||
|
* @access public
|
||||||
|
*/
|
||||||
|
public $iId ;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string
|
||||||
|
* @access public
|
||||||
|
*/
|
||||||
|
public $zTypeBon ;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string
|
||||||
|
* @access public
|
||||||
|
*/
|
||||||
|
public $zMontant ;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string
|
||||||
|
* @access public
|
||||||
|
*/
|
||||||
|
public $zEan13 ;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string
|
||||||
|
* @access public
|
||||||
|
*/
|
||||||
|
public $zDebutValidite ;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string
|
||||||
|
* @access public
|
||||||
|
*/
|
||||||
|
public $zFinValidite ;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string
|
||||||
|
* @access public
|
||||||
|
*/
|
||||||
|
public $zNomMarque ;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string
|
||||||
|
* @access public
|
||||||
|
*/
|
||||||
|
public $zAdresseMarque ;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string
|
||||||
|
* @access public
|
||||||
|
*/
|
||||||
|
public $zRcsMarque ;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string
|
||||||
|
* @access public
|
||||||
|
*/
|
||||||
|
public $zConditionValidite ;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string
|
||||||
|
* @access public
|
||||||
|
*/
|
||||||
|
public $zListeProduits ;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string
|
||||||
|
* @access public
|
||||||
|
*/
|
||||||
|
public $zLimitationGeographique ;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var int
|
||||||
|
* @access public
|
||||||
|
*/
|
||||||
|
public $iNombreBons ;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string
|
||||||
|
* @access public
|
||||||
|
*/
|
||||||
|
public $zEan128 ;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var int
|
||||||
|
* @access public
|
||||||
|
*/
|
||||||
|
public $iBonId ;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Vérification code barre pour l'EAN 128
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public function checkEAN128Code ()
|
||||||
|
{
|
||||||
|
if ($this->zEan128 == "")
|
||||||
|
{
|
||||||
|
throw new Exception ("Code EAN 128 vide") ;
|
||||||
|
}
|
||||||
|
return true ;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Génération du code barre pour l'EAN 128
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public function printEAN128BarCode ($_iWidth = 300, $_iHeight = 40)
|
||||||
|
{
|
||||||
|
if ($this->zEan128 != "")
|
||||||
|
{
|
||||||
|
$oCode = new CBCEan128 ($_iWidth, $_iHeight) ;
|
||||||
|
$oCode->parseHumanReadableString ($this->zEan128) ;
|
||||||
|
$oCode->showBarcodeImage () ;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
throw new Exception ("Code EAN 128 vide") ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Vérification du code pour l'EAN 13 de l'opération
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public function checkEAN13Code ()
|
||||||
|
{
|
||||||
|
if ($this->zEan13 != "")
|
||||||
|
{
|
||||||
|
|
||||||
|
$oCode = new pi_barcode () ;
|
||||||
|
$oCode->setType ("EAN") ;
|
||||||
|
$oCode->setCode ($this->zEan13) ;
|
||||||
|
|
||||||
|
$oCode->checkCode () ;
|
||||||
|
|
||||||
|
if ($oCode->TYPE == "ERR")
|
||||||
|
{
|
||||||
|
throw new Exception ($oCode->FULLCODE) ;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
throw new Exception ("Code EAN 128 vide") ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Génération du code barre pour l'EAN 13 de l'opération
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public function printEAN13BarCode ($_iWidth = 125, $_iHeight = 40)
|
||||||
|
{
|
||||||
|
if ($this->zEan13 != "")
|
||||||
|
{
|
||||||
|
|
||||||
|
$oCode = new pi_barcode () ;
|
||||||
|
$oCode->setType ("EAN") ;
|
||||||
|
$oCode->setSize ($_iHeight, $_iWidth) ;
|
||||||
|
$oCode->setCode ($this->zEan13) ;
|
||||||
|
|
||||||
|
$oCode->checkCode () ;
|
||||||
|
|
||||||
|
if ($oCode->TYPE == "ERR")
|
||||||
|
{
|
||||||
|
throw new Exception ($oCode->FULLCODE) ;
|
||||||
|
}
|
||||||
|
|
||||||
|
$oCode->showBarcodeImage () ;
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
throw new Exception ("Code EAN 128 vide") ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
1061
ldccrm_client/CPCConnection.class.php
Normal file
1061
ldccrm_client/CPCConnection.class.php
Normal file
File diff suppressed because it is too large
Load diff
520
ldccrm_client/CPCUser.class.php
Normal file
520
ldccrm_client/CPCUser.class.php
Normal file
|
|
@ -0,0 +1,520 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
include_once ('CPCUserField.class.php') ;
|
||||||
|
include_once ('emailValidation.php') ;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Classe faisant abstraction d'un utilisateur
|
||||||
|
*
|
||||||
|
* @package PlatosClient
|
||||||
|
* @name CPCUser
|
||||||
|
*/
|
||||||
|
class CPCUser
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var int Identifiant unique de l'utilisateur
|
||||||
|
* @access public
|
||||||
|
*/
|
||||||
|
public $iId ;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string Email de l'utilisateur
|
||||||
|
* @access public
|
||||||
|
*/
|
||||||
|
public $zEmail ;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string Login de l'utilisateur
|
||||||
|
* @access public
|
||||||
|
*/
|
||||||
|
public $zLogin ;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string Mot de passe de l'utilisateur
|
||||||
|
* @access public
|
||||||
|
*/
|
||||||
|
public $zPassword ;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string HashCode de l'utilisateur (En lecture seulement)
|
||||||
|
* @access public
|
||||||
|
*/
|
||||||
|
public $zHashCode ;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string Code du langage utilis? par de l'utilisateur
|
||||||
|
* @access public
|
||||||
|
*/
|
||||||
|
public $zLanguageCode ;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string Civilit? de l'utilisateur
|
||||||
|
* @access public
|
||||||
|
*/
|
||||||
|
public $zCivilite ;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string Nom de l'utilisateur
|
||||||
|
* @access public
|
||||||
|
*/
|
||||||
|
public $zNom ;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string Pr?nom de l'utilisateur
|
||||||
|
* @access public
|
||||||
|
*/
|
||||||
|
public $zPrenom ;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string La date de naissance de l'utilisateur
|
||||||
|
* @access public
|
||||||
|
*/
|
||||||
|
public $zDateNaissance ;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string 1ere adr?sse de l'utilisateur
|
||||||
|
* @access public
|
||||||
|
*/
|
||||||
|
public $zAdresse1 ;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string 2e adr?sse de l'utilisateur
|
||||||
|
* @access public
|
||||||
|
*/
|
||||||
|
public $zAdresse2 ;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string Code postal de l'utilisateur
|
||||||
|
* @access public
|
||||||
|
*/
|
||||||
|
public $zCodePostal ;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string ville de l'utilisateur
|
||||||
|
* @access public
|
||||||
|
*/
|
||||||
|
public $zVille ;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var boolean Inscription au newLetter de l'utilisateur
|
||||||
|
* @access public
|
||||||
|
*/
|
||||||
|
public $iInscritNewLetter ;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string ean128 l'utilisateur
|
||||||
|
* @access public
|
||||||
|
*/
|
||||||
|
public $zEan128 ;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var array Tableau contenant les champs dynamiques valu<EFBFBD>s de l'utilisateur
|
||||||
|
* @access private
|
||||||
|
*/
|
||||||
|
private $toFields ;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var array Tableau contenant les champs dynamiques de l'utilisateur
|
||||||
|
* @access private
|
||||||
|
*/
|
||||||
|
private $toFieldsConfig ;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var array Tableau contenant les services correspondant
|
||||||
|
* @access private
|
||||||
|
*/
|
||||||
|
private $toServices ;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructeur
|
||||||
|
*
|
||||||
|
* @param int $_iId Identifiant de l'utilisateur
|
||||||
|
*/
|
||||||
|
public function __construct ($_iId = 0)
|
||||||
|
{
|
||||||
|
$this->iId = $_iId ;
|
||||||
|
$this->zEmail = "" ;
|
||||||
|
$this->zLogin = "" ;
|
||||||
|
$this->zPassword = "" ;
|
||||||
|
$this->zHashCode = "" ;
|
||||||
|
$this->zLanguageCode = "" ;
|
||||||
|
|
||||||
|
$this->zCivilite = "" ;
|
||||||
|
$this->zNom = "" ;
|
||||||
|
$this->zPrenom = "" ;
|
||||||
|
$this->zDateNaissance = "" ;
|
||||||
|
$this->zAdresse1 = "" ;
|
||||||
|
$this->zAdresse2 = "" ;
|
||||||
|
$this->zVille = "" ;
|
||||||
|
$this->zCodePostal = 0 ;
|
||||||
|
$this->iInscritNewLetter = 0 ;
|
||||||
|
$this->zEan128 = "" ;
|
||||||
|
|
||||||
|
$this->toFields = array () ;
|
||||||
|
$this->toFieldsConfig = array () ;
|
||||||
|
$this->toServices = array () ;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Liste les champs dynamiques d?finis par cet utilisateur
|
||||||
|
*
|
||||||
|
* @return array Liste des codes des champs d?finis par l'utilisateur
|
||||||
|
*/
|
||||||
|
public function getDynamicFieldsList ()
|
||||||
|
{
|
||||||
|
if ( isset ($this->toFields) )
|
||||||
|
{
|
||||||
|
return array_keys ($this->toFields) ;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return 0 ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Ajoute un nouveau champ dans l'utilisateur
|
||||||
|
*
|
||||||
|
* @param string $_zFieldCode Code du champ
|
||||||
|
* @param int $_iFieldType Type du champ
|
||||||
|
* @param string $_zFieldPattern Motif de v?rification du champ
|
||||||
|
* @param string $_zFieldValue Valeur du champ
|
||||||
|
*/
|
||||||
|
public function addField ($_zFieldCode, $_iFieldType = FIELDTYPE_TEXT, $_zFieldPattern = "", $_zFieldValue = "")
|
||||||
|
{
|
||||||
|
$oNewField = new CPCUserField ($_zFieldCode, $_iFieldType, $_zFieldPattern, $_zFieldValue) ;
|
||||||
|
$this->toFields[$_zFieldCode] = $oNewField ;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Ajoute un nouveau champ dans l'utilisateur
|
||||||
|
*
|
||||||
|
* @param string $_zFieldCode Code du champ
|
||||||
|
* @param string $_zFieldValue Valeur du champ
|
||||||
|
*/
|
||||||
|
public function setField ($_zFieldCode, $_zFieldValue = 0)
|
||||||
|
{
|
||||||
|
if (!array_key_exists ($_zFieldCode, $this->toFields))
|
||||||
|
{
|
||||||
|
$this->addField ($_zFieldCode) ;
|
||||||
|
}
|
||||||
|
$this->toFields[$_zFieldCode]->zValue = $_zFieldValue ;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* R<EFBFBD>cup<EFBFBD>re la valeur d'un champ dynamique utilisateur
|
||||||
|
*
|
||||||
|
* @param string $_zFieldCode Code du champ
|
||||||
|
* @return string Valeur du champ ou FALSE si champ inexsitant
|
||||||
|
*/
|
||||||
|
public function getField ($_zFieldCode)
|
||||||
|
{
|
||||||
|
$zRet = false ;
|
||||||
|
if (array_key_exists ($_zFieldCode, $this->toFields))
|
||||||
|
{
|
||||||
|
$zRet = $this->toFields[$_zFieldCode]->zValue ;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return null ;
|
||||||
|
}
|
||||||
|
return $zRet ;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* V?rificaion de la conformit? interne du champs
|
||||||
|
*
|
||||||
|
* @return bool R?sultat de la v?rification de conformit?
|
||||||
|
*/
|
||||||
|
public function check ()
|
||||||
|
{
|
||||||
|
|
||||||
|
$bRet = true ;
|
||||||
|
|
||||||
|
if (!$this->checkEmailFormat ($this->zEmail))
|
||||||
|
{
|
||||||
|
$bRet = false ;
|
||||||
|
throw new Exception ("Format d'Email invalide : [" . $this->zEmail . "]") ;
|
||||||
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
$this->checkEmailOnMX ($this->zEmail) ;
|
||||||
|
}
|
||||||
|
catch (Exception $_eInvalideMail)
|
||||||
|
{
|
||||||
|
$bRet = false ;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($bRet)
|
||||||
|
{
|
||||||
|
foreach ($this->toFields as $oField)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
$bRet = $bRet && $oField->check();
|
||||||
|
}
|
||||||
|
catch (Exception $_oException)
|
||||||
|
{
|
||||||
|
$bRet = false ;
|
||||||
|
throw new Exception ($_oException->getMessage ()) ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $bRet ;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fonction de v?rification d'un email
|
||||||
|
*
|
||||||
|
* @param string $_zInputEmail l'Adresse email ? v?rifier
|
||||||
|
* @return bool R?sultat de la v?rification du format
|
||||||
|
*/
|
||||||
|
public function checkEmailOnMX ($_zInputEmail, $_zLocalUser = "root", $_zLocalHost = "localhost")
|
||||||
|
{
|
||||||
|
|
||||||
|
$bRes = true ;
|
||||||
|
|
||||||
|
/*
|
||||||
|
if (isset ($_zInputEmail))
|
||||||
|
{
|
||||||
|
|
||||||
|
$oEmailValidator = new email_validation_class () ;
|
||||||
|
|
||||||
|
$oEmailValidator->timeout = 5 ;
|
||||||
|
$oEmailValidator->data_timeout = 0 ;
|
||||||
|
$oEmailValidator->localuser = $_zLocalUser ;
|
||||||
|
$oEmailValidator->localhost = $_zLocalHost ;
|
||||||
|
$oEmailValidator->debug = 0 ;
|
||||||
|
$oEmailValidator->html_debug = 0 ;
|
||||||
|
$oEmailValidator->exclude_address = "" ;
|
||||||
|
|
||||||
|
if (!$oEmailValidator->ValidateEmailBox ($_zInputEmail))
|
||||||
|
{
|
||||||
|
$bRes = false ;
|
||||||
|
throw new Exception ("Email non reconnu par le serveur : [" . $_zInputEmail . "]") ;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
return $bRes ;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fonction de v?rification du format d'un email
|
||||||
|
*
|
||||||
|
* @param string $_zInputEmail l'Adresse email ? v?rifier
|
||||||
|
* @return bool R?sultat de la v?rification du format
|
||||||
|
*/
|
||||||
|
public function checkEmailFormat ($_zInputEmail)
|
||||||
|
{
|
||||||
|
$zPattern2 = "/^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,})$/i" ;
|
||||||
|
$bRet = (preg_match ($zPattern2, $_zInputEmail)) ;
|
||||||
|
return $bRet ;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Liste les champs dynamiques d<EFBFBD>finis par la configuration de l'utilisateur
|
||||||
|
*
|
||||||
|
* @return array Liste des codes des champs par la configuration de l'utilisateur
|
||||||
|
*/
|
||||||
|
public function getFieldsConfig ()
|
||||||
|
{
|
||||||
|
if (isset ($this->toFieldsConfig))
|
||||||
|
{
|
||||||
|
$toResults = array_keys ($this->toFieldsConfig) ;
|
||||||
|
if (count ($toResults) > 0)
|
||||||
|
{
|
||||||
|
return $toResults ;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return null ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return null ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Liste des services correspondant <EFBFBD> l'utilisateur
|
||||||
|
*
|
||||||
|
* @return array Liste des services
|
||||||
|
*/
|
||||||
|
public function getAllServicesCorresponding ()
|
||||||
|
{
|
||||||
|
if (isset ($this->toServices))
|
||||||
|
{
|
||||||
|
$toResults = $this->toServices ;
|
||||||
|
if (count ($toResults) > 0)
|
||||||
|
{
|
||||||
|
return $toResults ;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return null ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return null ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fonction d'ajout d'une configuration de champs
|
||||||
|
*
|
||||||
|
* @param string $_zFieldCode
|
||||||
|
* @param CPlatosFieldConfig $_oFieldConfig ;
|
||||||
|
*/
|
||||||
|
public function addFieldConfig ($_zFieldCode, $_oFieldConfig)
|
||||||
|
{
|
||||||
|
$oNewFieldConfig = new CPCFieldConfig () ;
|
||||||
|
$oNewFieldConfig->zFieldId = $_oFieldConfig->zFieldId ;
|
||||||
|
$oNewFieldConfig->iFieldType = $_oFieldConfig->iFieldType ;
|
||||||
|
$oNewFieldConfig->zLabel = $_oFieldConfig->zLabel ;
|
||||||
|
foreach ($_oFieldConfig->toAttributes as $oAttr)
|
||||||
|
{
|
||||||
|
$oNewAttr = new CPCFieldAttribute () ;
|
||||||
|
$oNewAttr->iId = $oAttr->iId ;
|
||||||
|
$oNewAttr->zLabel = $oAttr->zLabel ;
|
||||||
|
array_push ($oNewFieldConfig->toAttributes, $oNewAttr) ;
|
||||||
|
}
|
||||||
|
$this->toFieldsConfig[$_zFieldCode] = $oNewFieldConfig ;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* R<EFBFBD>cup<EFBFBD>ration du lib<EFBFBD>ll<EFBFBD> d'un champ
|
||||||
|
*
|
||||||
|
* @param string $_zFieldCode
|
||||||
|
* @return string|null Type du champ
|
||||||
|
*/
|
||||||
|
public function getFieldLabel ($_zFieldCode)
|
||||||
|
{
|
||||||
|
if (array_key_exists ($_zFieldCode, $this->toFieldsConfig))
|
||||||
|
{
|
||||||
|
return $this->toFieldsConfig[$_zFieldCode]->zLabel ;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return null ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* R<EFBFBD>cup<EFBFBD>ration du type d'un champ
|
||||||
|
*
|
||||||
|
* @param string $_zFieldCode
|
||||||
|
* @return int|null Type du champ
|
||||||
|
*/
|
||||||
|
public function getFieldType ($_zFieldCode)
|
||||||
|
{
|
||||||
|
if (array_key_exists ($_zFieldCode, $this->toFieldsConfig))
|
||||||
|
{
|
||||||
|
return $this->toFieldsConfig[$_zFieldCode]->iFieldType ;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return null ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* R<EFBFBD>cup<EFBFBD>ration du type d'un champ
|
||||||
|
*
|
||||||
|
* @param string $_zFieldCode
|
||||||
|
* @return array|null Type du champ
|
||||||
|
*/
|
||||||
|
public function getFieldAttributes ($_zFieldCode)
|
||||||
|
{
|
||||||
|
if (array_key_exists ($_zFieldCode, $this->toFieldsConfig))
|
||||||
|
{
|
||||||
|
$tzResults = array () ;
|
||||||
|
foreach ($this->toFieldsConfig[$_zFieldCode]->toAttributes as $oAttr)
|
||||||
|
{
|
||||||
|
$tzResults[$oAttr->iId] = $oAttr->zLabel ;
|
||||||
|
}
|
||||||
|
return $tzResults ;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return null ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fonction d'ajout des services correspondants
|
||||||
|
*
|
||||||
|
* @param CPlatosServices $_oServices
|
||||||
|
*/
|
||||||
|
public function addServiceCorresponding ($_oServices)
|
||||||
|
{
|
||||||
|
$oServices = new CPCServices () ;
|
||||||
|
$oServices->iServiceId = $_oServices->iServiceId ;
|
||||||
|
$oServices->zServiceName = $_oServices->zServiceName ;
|
||||||
|
|
||||||
|
array_push ($this->toServices, $oServices) ;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Recuperation des champs
|
||||||
|
* @return array Liste des champs
|
||||||
|
*/
|
||||||
|
public function getFields ()
|
||||||
|
{
|
||||||
|
return $this->toFields ;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Classe faisant d'une valeur autoris<EFBFBD> pour un champs
|
||||||
|
*/
|
||||||
|
class CPCFieldAttribute
|
||||||
|
{
|
||||||
|
public $iId ;
|
||||||
|
public $zLabel ;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Classe faisant abstraction d'une liste de valeur autoris<EFBFBD> pour un champs (Type liste)
|
||||||
|
*/
|
||||||
|
class CPCFieldConfig
|
||||||
|
{
|
||||||
|
public $zFieldId ;
|
||||||
|
public $iFieldType ;
|
||||||
|
public $zLabel ;
|
||||||
|
public $zPattern ;
|
||||||
|
public $toAttributes = array () ;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Classe faisant abstraction d'un service
|
||||||
|
*/
|
||||||
|
class CPCServices
|
||||||
|
{
|
||||||
|
|
||||||
|
public $iServiceId ;
|
||||||
|
public $zServiceName ;
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
95
ldccrm_client/CPCUserField.class.php
Normal file
95
ldccrm_client/CPCUserField.class.php
Normal file
|
|
@ -0,0 +1,95 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
include_once ('datatypes.inc.php') ;
|
||||||
|
include_once ('errors.inc.php') ;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Classe faisant abstraction d'un champ utilisateur
|
||||||
|
*
|
||||||
|
* @package PlatosClient
|
||||||
|
* @name CPCUserField
|
||||||
|
*/
|
||||||
|
class CPCUserField
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string Code interne du champ utilisateur
|
||||||
|
* @access public
|
||||||
|
*/
|
||||||
|
public $zCode ;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string Lib<EFBFBD>ll<EFBFBD> du champ utilisateur
|
||||||
|
* @access public
|
||||||
|
*/
|
||||||
|
public $zLabel ;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var int Type du champs
|
||||||
|
* @access public
|
||||||
|
*/
|
||||||
|
public $iType ;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string Motif de v<EFBFBD>rification du champ sous forme d'expression r<EFBFBD>guli<EFBFBD>re
|
||||||
|
* @access public
|
||||||
|
*/
|
||||||
|
public $zPattern ;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string Valeur du champ
|
||||||
|
* @access public
|
||||||
|
*/
|
||||||
|
public $zValue ;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructeur
|
||||||
|
*
|
||||||
|
* @param string $_zCode Code du champs tel que fourni dans PARAGAS
|
||||||
|
* @param int $_iType Type du champs
|
||||||
|
* @param string $_zPattern Motif du champs pour son validation dans la m<EFBFBD>thode check
|
||||||
|
* @param string $_zValue Valeur du champs
|
||||||
|
*/
|
||||||
|
public function __construct ($_zCode, $_iType = FIELDTYPE_TEXT, $_zPattern = "", $_zValue = "")
|
||||||
|
{
|
||||||
|
$this->zCode = $_zCode ;
|
||||||
|
$this->iType = $_iType ;
|
||||||
|
$this->zPattern = $_zPattern ;
|
||||||
|
$this->zValue = $_zValue ;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* V<EFBFBD>rificaion de la conformit<EFBFBD> interne du champs
|
||||||
|
*
|
||||||
|
* @return bool R<EFBFBD>sultat de la v<EFBFBD>rification de conformit<EFBFBD>
|
||||||
|
*/
|
||||||
|
public function check ()
|
||||||
|
{
|
||||||
|
$bRet = true ;
|
||||||
|
if (preg_match ("/^[a-zA-Z0-9_]+$/", $this->zCode) === false)
|
||||||
|
{
|
||||||
|
$bRet = false ;
|
||||||
|
throw new Exception ("[FIELD : " . $this->zCode . "] >> Code de champ incorrect : [" . $this->zCode . "]") ;
|
||||||
|
}
|
||||||
|
if (trim ($this->zPattern) != "")
|
||||||
|
{
|
||||||
|
if (ereg ($this->zPattern, $this->zValue) === false)
|
||||||
|
{
|
||||||
|
$bRet = false ;
|
||||||
|
throw new Exception ("[FIELD : " . $this->zCode . "] >> Valeur de champ incorrect par rapport au motif") ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ($this->iType == FIELDTYPE_LIST)
|
||||||
|
{
|
||||||
|
if (ereg ("^[0-9]+$", $this->zValue) === false)
|
||||||
|
{
|
||||||
|
$bRet = false ;
|
||||||
|
throw new Exception ("[FIELD : " . $this->zCode . "] >> Valeur de champ incorrect pour un type LISTE") ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $bRet ;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
43
ldccrm_client/datatypes.inc.php
Normal file
43
ldccrm_client/datatypes.inc.php
Normal file
|
|
@ -0,0 +1,43 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Fichier de définition des type de données et autres constantes
|
||||||
|
*
|
||||||
|
* @package PlatosClient
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Type de champs Texte libre
|
||||||
|
*/
|
||||||
|
define ("FIELDTYPE_TEXT", 1) ;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Type de champs Liste
|
||||||
|
*/
|
||||||
|
define ("FIELDTYPE_LIST", 2) ;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Type de champs radio
|
||||||
|
*/
|
||||||
|
define ("FIELDTYPE_RADIO", 3) ;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Type de champs case à cocher
|
||||||
|
*/
|
||||||
|
define ("FIELDTYPE_CHECKBOX", 4) ;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Type de champs zone de texte
|
||||||
|
*/
|
||||||
|
define ("FIELDTYPE_TEXTAREA", 5) ;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Création d'utilisateur sans fiablisation Email
|
||||||
|
*/
|
||||||
|
define ("CREATION_MODE_WITHOUT_CONFIRMATION_EMAIL", 0) ;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Création d'utilisateur avec fiablisation Email
|
||||||
|
*/
|
||||||
|
define ("CREATION_MODE_WITH_CONFIRMATION_EMAIL", 1) ;
|
||||||
|
|
||||||
|
?>
|
||||||
206
ldccrm_client/emailValidation.php
Normal file
206
ldccrm_client/emailValidation.php
Normal file
|
|
@ -0,0 +1,206 @@
|
||||||
|
<?php
|
||||||
|
/*
|
||||||
|
* email_validation.php
|
||||||
|
*
|
||||||
|
* @(#) $Header: /home/mlemos/cvsroot/emailvalidation/email_validation.php,v 1.19 2003/09/03 22:43:11 mlemos Exp $
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
class email_validation_class
|
||||||
|
{
|
||||||
|
var $email_regular_expression="^([-!#\$%&'*+./0-9=?A-Z^_`a-z{|}~])+@([-!#\$%&'*+/0-9=?A-Z^_`a-z{|}~]+\\.)+[a-zA-Z]{2,6}\$";
|
||||||
|
var $timeout=0;
|
||||||
|
var $data_timeout=0;
|
||||||
|
var $localhost="";
|
||||||
|
var $localuser="";
|
||||||
|
var $debug=0;
|
||||||
|
var $html_debug=0;
|
||||||
|
var $exclude_address="";
|
||||||
|
var $getmxrr="GetMXRR";
|
||||||
|
|
||||||
|
var $next_token="";
|
||||||
|
|
||||||
|
Function Tokenize($string,$separator="")
|
||||||
|
{
|
||||||
|
if(!strcmp($separator,""))
|
||||||
|
{
|
||||||
|
$separator=$string;
|
||||||
|
$string=$this->next_token;
|
||||||
|
}
|
||||||
|
for($character=0;$character<strlen($separator);$character++)
|
||||||
|
{
|
||||||
|
if(GetType($position=strpos($string,$separator[$character]))=="integer")
|
||||||
|
$found=(IsSet($found) ? min($found,$position) : $position);
|
||||||
|
}
|
||||||
|
if(IsSet($found))
|
||||||
|
{
|
||||||
|
$this->next_token=substr($string,$found+1);
|
||||||
|
return(substr($string,0,$found));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$this->next_token="";
|
||||||
|
return($string);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Function OutputDebug($message)
|
||||||
|
{
|
||||||
|
$message.="\n";
|
||||||
|
if($this->html_debug)
|
||||||
|
$message=str_replace("\n","<br />\n",HtmlEntities($message));
|
||||||
|
echo $message;
|
||||||
|
flush();
|
||||||
|
}
|
||||||
|
|
||||||
|
Function GetLine($connection)
|
||||||
|
{
|
||||||
|
for($line="";;)
|
||||||
|
{
|
||||||
|
if(feof($connection))
|
||||||
|
return(0);
|
||||||
|
$line.=fgets($connection,100);
|
||||||
|
$length=strlen($line);
|
||||||
|
if($length>=2
|
||||||
|
&& substr($line,$length-2,2)=="\r\n")
|
||||||
|
{
|
||||||
|
$line=substr($line,0,$length-2);
|
||||||
|
if($this->debug)
|
||||||
|
$this->OutputDebug("S $line");
|
||||||
|
return($line);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Function PutLine($connection,$line)
|
||||||
|
{
|
||||||
|
if($this->debug)
|
||||||
|
$this->OutputDebug("C $line");
|
||||||
|
return(fputs($connection,"$line\r\n"));
|
||||||
|
}
|
||||||
|
|
||||||
|
Function ValidateEmailAddress($email)
|
||||||
|
{
|
||||||
|
return(eregi($this->email_regular_expression,$email)!=0);
|
||||||
|
}
|
||||||
|
|
||||||
|
Function ValidateEmailHost($email,&$hosts)
|
||||||
|
{
|
||||||
|
if(!$this->ValidateEmailAddress($email))
|
||||||
|
return(0);
|
||||||
|
$user=$this->Tokenize($email,"@");
|
||||||
|
$domain=$this->Tokenize("");
|
||||||
|
$hosts=$weights=array();
|
||||||
|
$getmxrr=$this->getmxrr;
|
||||||
|
if(function_exists($getmxrr)
|
||||||
|
&& $getmxrr($domain,$hosts,$weights))
|
||||||
|
{
|
||||||
|
$mxhosts=array();
|
||||||
|
for($host=0;$host<count($hosts);$host++)
|
||||||
|
$mxhosts[$weights[$host]]=$hosts[$host];
|
||||||
|
KSort($mxhosts);
|
||||||
|
for(Reset($mxhosts),$host=0;$host<count($mxhosts);Next($mxhosts),$host++)
|
||||||
|
$hosts[$host]=$mxhosts[Key($mxhosts)];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if(strcmp($ip=@gethostbyname($domain),$domain)
|
||||||
|
&& (strlen($this->exclude_address)==0
|
||||||
|
|| strcmp(@gethostbyname($this->exclude_address),$ip)))
|
||||||
|
$hosts[]=$domain;
|
||||||
|
}
|
||||||
|
return(count($hosts)!=0);
|
||||||
|
}
|
||||||
|
|
||||||
|
Function VerifyResultLines($connection,$code)
|
||||||
|
{
|
||||||
|
while(($line=$this->GetLine($connection)))
|
||||||
|
{
|
||||||
|
if(!strcmp($this->Tokenize($line," "),$code))
|
||||||
|
return(1);
|
||||||
|
if(strcmp($this->Tokenize($line,"-"),$code))
|
||||||
|
return(0);
|
||||||
|
}
|
||||||
|
return(-1);
|
||||||
|
}
|
||||||
|
|
||||||
|
Function ValidateEmailBox($email)
|
||||||
|
{
|
||||||
|
if(!$this->ValidateEmailHost($email,$hosts))
|
||||||
|
return(0);
|
||||||
|
if(!strcmp($localhost=$this->localhost,"")
|
||||||
|
&& !strcmp($localhost=getenv("SERVER_NAME"),"")
|
||||||
|
&& !strcmp($localhost=getenv("HOST"),""))
|
||||||
|
$localhost="localhost";
|
||||||
|
if(!strcmp($localuser=$this->localuser,"")
|
||||||
|
&& !strcmp($localuser=getenv("USERNAME"),"")
|
||||||
|
&& !strcmp($localuser=getenv("USER"),""))
|
||||||
|
$localuser="root";
|
||||||
|
for($host=0;$host<count($hosts);$host++)
|
||||||
|
{
|
||||||
|
$domain=$hosts[$host];
|
||||||
|
if(ereg('^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$',$domain))
|
||||||
|
$ip=$domain;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if($this->debug)
|
||||||
|
$this->OutputDebug("Resolving host name \"".$hosts[$host]."\"...");
|
||||||
|
if(!strcmp($ip=@gethostbyname($domain),$domain))
|
||||||
|
{
|
||||||
|
if($this->debug)
|
||||||
|
$this->OutputDebug("Could not resolve host name \"".$hosts[$host]."\".");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(strlen($this->exclude_address)
|
||||||
|
&& !strcmp(@gethostbyname($this->exclude_address),$ip))
|
||||||
|
{
|
||||||
|
if($this->debug)
|
||||||
|
$this->OutputDebug("Host address of \"".$hosts[$host]."\" is the exclude address");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if($this->debug)
|
||||||
|
$this->OutputDebug("Connecting to host address \"".$ip."\"...");
|
||||||
|
if(($connection=($this->timeout ? @fsockopen($ip,25,$errno,$error,$this->timeout) : @fsockopen($ip,25))))
|
||||||
|
{
|
||||||
|
$timeout=($this->data_timeout ? $this->data_timeout : $this->timeout);
|
||||||
|
if($timeout
|
||||||
|
&& function_exists("socket_set_timeout"))
|
||||||
|
socket_set_timeout($connection,$timeout,0);
|
||||||
|
if($this->debug)
|
||||||
|
$this->OutputDebug("Connected.");
|
||||||
|
if($this->VerifyResultLines($connection,"220")>0
|
||||||
|
&& $this->PutLine($connection,"HELO $localhost")
|
||||||
|
&& $this->VerifyResultLines($connection,"250")>0
|
||||||
|
&& $this->PutLine($connection,"MAIL FROM: <$localuser@$localhost>")
|
||||||
|
&& $this->VerifyResultLines($connection,"250")>0
|
||||||
|
&& $this->PutLine($connection,"RCPT TO: <$email>")
|
||||||
|
&& ($result=$this->VerifyResultLines($connection,"250"))>=0)
|
||||||
|
{
|
||||||
|
if($result
|
||||||
|
&& $this->PutLine($connection,"DATA"))
|
||||||
|
$result=($this->VerifyResultLines($connection,"354")!=0);
|
||||||
|
if($this->debug)
|
||||||
|
$this->OutputDebug("This host states that the address is ".($result ? "" : "not ")."valid.");
|
||||||
|
fclose($connection);
|
||||||
|
if($this->debug)
|
||||||
|
$this->OutputDebug("Disconnected.");
|
||||||
|
return($result);
|
||||||
|
}
|
||||||
|
if($this->debug)
|
||||||
|
$this->OutputDebug("Unable to validate the address with this host.");
|
||||||
|
fclose($connection);
|
||||||
|
if($this->debug)
|
||||||
|
$this->OutputDebug("Disconnected.");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if($this->debug)
|
||||||
|
$this->OutputDebug("Failed.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return(-1);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
?>
|
||||||
53
ldccrm_client/errors.inc.php
Normal file
53
ldccrm_client/errors.inc.php
Normal file
|
|
@ -0,0 +1,53 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Fichier de définition des Codes d'erreurs
|
||||||
|
*
|
||||||
|
* @package PlatosClient
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Login déjà utilisé
|
||||||
|
*/
|
||||||
|
define ("ERR_CRM_ALREADY_USED_LOGIN", -1001) ;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adresse email déjà utilisée
|
||||||
|
*/
|
||||||
|
define ("ERR_CRM_ALREADY_USED_EMAIL", -1002) ;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Informations utilisateurs incomplètes
|
||||||
|
*/
|
||||||
|
define ("ERR_CRM_INCOMPLETE_USERINFOS", -1003) ;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Utilisateur inconnu du système
|
||||||
|
*/
|
||||||
|
define ("ERR_CRM_UNKNOWN_USER", -1004) ;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Erreur d'authentification de l'utilisateur
|
||||||
|
*/
|
||||||
|
define ("ERR_CRM_AUTHENTICATION_FAILED", -1005) ;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Informations utilisateurs non conformes
|
||||||
|
*/
|
||||||
|
define ("ERR_CRM_NONCOMFORM_USERINFOS", -1006) ;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Service inconnu
|
||||||
|
*/
|
||||||
|
define ("ERR_SYS_UNKNOWN_SERVICE", -1101) ;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Permission non suffisante pour appeler le Webservice sollicitée
|
||||||
|
*/
|
||||||
|
define ("ERR_SYS_PERMISSION_DENIED", -1102) ;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Erreurs globale
|
||||||
|
*/
|
||||||
|
define ("ERR_DB_GENERIC_FAILURE", -1201) ;
|
||||||
|
|
||||||
|
?>
|
||||||
1290
ldccrm_client/pi_barcode.php
Normal file
1290
ldccrm_client/pi_barcode.php
Normal file
File diff suppressed because it is too large
Load diff
3
ldccrm_client/platosclient.lib.php
Normal file
3
ldccrm_client/platosclient.lib.php
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
<?php
|
||||||
|
include_once (JELIX_APP_PATH . "modules/crm/classes/ldccrm_client/" . 'CPCConnection.class.php') ;
|
||||||
|
?>
|
||||||
|
|
@ -13,12 +13,15 @@
|
||||||
"axios": "^0.19",
|
"axios": "^0.19",
|
||||||
"bootstrap": "^4.0.0",
|
"bootstrap": "^4.0.0",
|
||||||
"cross-env": "^7.0",
|
"cross-env": "^7.0",
|
||||||
|
"jquery": "^3.2",
|
||||||
"laravel-mix": "^5.0.1",
|
"laravel-mix": "^5.0.1",
|
||||||
"lodash": "^4.17.19",
|
"lodash": "^4.17.19",
|
||||||
"resolve-url-loader": "^3.1.2",
|
"popper.js": "^1.12",
|
||||||
"sass": "^1.15.2",
|
"resolve-url-loader": "^2.3.1",
|
||||||
|
"sass": "^1.20.1",
|
||||||
"sass-loader": "^8.0.0",
|
"sass-loader": "^8.0.0",
|
||||||
"vue-template-compiler": "^2.6.12"
|
"vue": "^2.5.17",
|
||||||
|
"vue-template-compiler": "^2.6.10"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"jquery": "^3.5.1",
|
"jquery": "^3.5.1",
|
||||||
|
|
|
||||||
13
resources/js/app.js
vendored
13
resources/js/app.js
vendored
|
|
@ -8,10 +8,6 @@ require('./bootstrap');
|
||||||
|
|
||||||
window.Vue = require('vue');
|
window.Vue = require('vue');
|
||||||
|
|
||||||
import Clipboard from 'v-clipboard'
|
|
||||||
|
|
||||||
Vue.use(Clipboard);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The following block of code may be used to automatically register your
|
* The following block of code may be used to automatically register your
|
||||||
* Vue components. It will recursively scan this directory for the Vue
|
* Vue components. It will recursively scan this directory for the Vue
|
||||||
|
|
@ -23,14 +19,7 @@ Vue.use(Clipboard);
|
||||||
// const files = require.context('./', true, /\.vue$/i)
|
// const files = require.context('./', true, /\.vue$/i)
|
||||||
// files.keys().map(key => Vue.component(key.split('/').pop().split('.')[0], files(key).default))
|
// files.keys().map(key => Vue.component(key.split('/').pop().split('.')[0], files(key).default))
|
||||||
|
|
||||||
Vue.component('win-notification', require('./components/WinNotification.vue').default);
|
Vue.component('example-component', require('./components/ExampleComponent.vue').default);
|
||||||
Vue.component('gain-views', require('./components/GainViews.vue').default);
|
|
||||||
Vue.component('prizes', require('./components/Prizes.vue').default);
|
|
||||||
Vue.component('instant-win', require('./components/InstantWin.vue').default);
|
|
||||||
Vue.component('codes-ean', require('./components/CodesEAN.vue').default);
|
|
||||||
Vue.component('banned-ip', require('./components/BannedIP.vue').default);
|
|
||||||
Vue.component('faq-themes', require('./components/FaqThemes.vue').default);
|
|
||||||
Vue.component('faq-questions', require('./components/FaqQuestions.vue').default);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Next, we will create a fresh Vue application instance and attach it to
|
* Next, we will create a fresh Vue application instance and attach it to
|
||||||
|
|
|
||||||
23
resources/js/components/ExampleComponent.vue
Normal file
23
resources/js/components/ExampleComponent.vue
Normal file
|
|
@ -0,0 +1,23 @@
|
||||||
|
<template>
|
||||||
|
<div class="container">
|
||||||
|
<div class="row justify-content-center">
|
||||||
|
<div class="col-md-8">
|
||||||
|
<div class="card">
|
||||||
|
<div class="card-header">Example Component</div>
|
||||||
|
|
||||||
|
<div class="card-body">
|
||||||
|
I'm an example component.
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
mounted() {
|
||||||
|
console.log('Component mounted.')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
@ -5,7 +5,6 @@
|
||||||
<div class="col-md-3">
|
<div class="col-md-3">
|
||||||
Lots
|
Lots
|
||||||
</div>
|
</div>
|
||||||
<!-- TODO ? Message sauvegarde et suppression en toast ? -->
|
|
||||||
<div class="col-md-6 text-center">
|
<div class="col-md-6 text-center">
|
||||||
<transition name="fade">
|
<transition name="fade">
|
||||||
<span v-show="processing">
|
<span v-show="processing">
|
||||||
|
|
@ -98,7 +97,6 @@
|
||||||
</td>
|
</td>
|
||||||
<td class="align-middle">
|
<td class="align-middle">
|
||||||
<input type="file" accept="application/pdf" name="pdf_winning_proof" v-on:change="handleFileUpload(index)">
|
<input type="file" accept="application/pdf" name="pdf_winning_proof" v-on:change="handleFileUpload(index)">
|
||||||
<!-- TODO ? Mettre un embed du fichier ? A voir -->
|
|
||||||
<span v-if="item.pdf_winning_proof != null">Fichier actuel : <span class="badge badge-primary">{{item.pdf_winning_proof}}</span></span>
|
<span v-if="item.pdf_winning_proof != null">Fichier actuel : <span class="badge badge-primary">{{item.pdf_winning_proof}}</span></span>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
@ -178,7 +176,6 @@
|
||||||
if (!files.length)
|
if (!files.length)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// File[0] car on le récupère toujours de l'event au dessus
|
|
||||||
this.pdf_winning_proof[index] = files[0];
|
this.pdf_winning_proof[index] = files[0];
|
||||||
|
|
||||||
if (!this.pdf_winning_proof[index]) {
|
if (!this.pdf_winning_proof[index]) {
|
||||||
|
|
|
||||||
5
resources/sass/_variables.scss
vendored
5
resources/sass/_variables.scss
vendored
|
|
@ -17,8 +17,3 @@ $yellow: #ffed4a;
|
||||||
$green: #38c172;
|
$green: #38c172;
|
||||||
$teal: #4dc0b5;
|
$teal: #4dc0b5;
|
||||||
$cyan: #6cb2eb;
|
$cyan: #6cb2eb;
|
||||||
// Theme
|
|
||||||
$theme-colors: (
|
|
||||||
"primary": #3176C4,
|
|
||||||
"secondary": #E7374B
|
|
||||||
);
|
|
||||||
|
|
|
||||||
3
resources/sass/app.scss
vendored
3
resources/sass/app.scss
vendored
|
|
@ -6,6 +6,3 @@
|
||||||
|
|
||||||
// Bootstrap
|
// Bootstrap
|
||||||
@import '~bootstrap/scss/bootstrap';
|
@import '~bootstrap/scss/bootstrap';
|
||||||
|
|
||||||
// Style custom
|
|
||||||
@import 'app_custom';
|
|
||||||
|
|
|
||||||
24
resources/views/front/basic/enter-code.blade.php
Normal file
24
resources/views/front/basic/enter-code.blade.php
Normal file
|
|
@ -0,0 +1,24 @@
|
||||||
|
@extends('front.basic.layout')
|
||||||
|
|
||||||
|
@section('title', 'Saisie du code')
|
||||||
|
|
||||||
|
@section('content')
|
||||||
|
<p>Code EAN actif ? {{$settings->use_ean_codes === 1 ? 'Oui' : 'Non'}}</p>
|
||||||
|
@if ($errors->any())
|
||||||
|
<div class="alert alert-danger">
|
||||||
|
<ul>
|
||||||
|
@foreach ($errors->all() as $error)
|
||||||
|
<li>{{ $error }}</li>
|
||||||
|
@endforeach
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
|
<form method="POST" action="{{route('participate')}}">
|
||||||
|
@csrf
|
||||||
|
@if ($settings->use_ean_codes === 1)
|
||||||
|
<input type="text" name="code_ean" required placeholder="Code EAN *">
|
||||||
|
@endif
|
||||||
|
<input type="text" name="code" maxlength="8" size="8" placeholder="Code unique *" required>
|
||||||
|
<button type="submit" class="btn btn-success">Envoyer</button>
|
||||||
|
</form>
|
||||||
|
@endsection
|
||||||
7
resources/views/front/basic/gain1.blade.php
Normal file
7
resources/views/front/basic/gain1.blade.php
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
@extends('front.basic.layout')
|
||||||
|
|
||||||
|
@section('title', 'BRAVO !')
|
||||||
|
|
||||||
|
@section('content')
|
||||||
|
<p>C'est gagné !</p>
|
||||||
|
@endsection
|
||||||
35
resources/views/front/basic/gains.blade.php
Normal file
35
resources/views/front/basic/gains.blade.php
Normal file
|
|
@ -0,0 +1,35 @@
|
||||||
|
@extends('front.basic.layout')
|
||||||
|
|
||||||
|
@section('title', 'Les gains')
|
||||||
|
|
||||||
|
@section('content')
|
||||||
|
<p>Lots (valeur à 0 ou 1 : 0 = faux, 1 = vrai) :</p>
|
||||||
|
<table class="table table-border">
|
||||||
|
<thead class="thead-light">
|
||||||
|
<th scope="col">ID Arcadia</th>
|
||||||
|
<th scope="col">Label singulier</th>
|
||||||
|
<th scope="col">Label pluriel</th>
|
||||||
|
<th scope="col">Quantité</th>
|
||||||
|
<th scope="col">Notification activé</th>
|
||||||
|
<th scope="col">Formulaire suppl.</th>
|
||||||
|
<th scope="col">ID mail Arcadia</th>
|
||||||
|
<th scope="col">Pdf preuve de gain</th>
|
||||||
|
<th scope="col">Lot par défaut</th>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
@foreach ($prizes as $p)
|
||||||
|
<tr>
|
||||||
|
<td>{{$p->arcadia_id}}</td>
|
||||||
|
<td>{{$p->label_one}}</td>
|
||||||
|
<td>{{$p->label_many}}</td>
|
||||||
|
<td>{{$p->quantity}}</td>
|
||||||
|
<td>{{$p->notifications}}</td>
|
||||||
|
<td>{{$p->additional_form}}</td>
|
||||||
|
<td>{{$p->arcadia_mail_id}}</td>
|
||||||
|
<td><span class="badge badge-info">{{$p->pdf_winning_proof}}</span></td>
|
||||||
|
<td>{{$p->is_default}}</td>
|
||||||
|
</tr>
|
||||||
|
@endforeach
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
@endsection
|
||||||
|
|
@ -3,5 +3,13 @@
|
||||||
@section('title', 'Accueil')
|
@section('title', 'Accueil')
|
||||||
|
|
||||||
@section('content')
|
@section('content')
|
||||||
<p>Accueil, aucune variable pour le moment</p>
|
<p>Société : {{$settingsGlobal->company}} et nom du jeu : {{$settingsGlobal->name}}</p>
|
||||||
|
<p>
|
||||||
|
Test pour gain :
|
||||||
|
<form method="POST" action="{{route('gagne')}}">
|
||||||
|
@csrf
|
||||||
|
<input type="number" name="prize" class="form-control col-md-2" required>
|
||||||
|
<button type="submit" class="btn btn-success">Tester</button>
|
||||||
|
</form>
|
||||||
|
</p>
|
||||||
@endsection
|
@endsection
|
||||||
|
|
|
||||||
35
resources/views/front/basic/how-to-play.blade.php
Normal file
35
resources/views/front/basic/how-to-play.blade.php
Normal file
|
|
@ -0,0 +1,35 @@
|
||||||
|
@extends('front.basic.layout')
|
||||||
|
|
||||||
|
@section('title', 'Comment jouer')
|
||||||
|
|
||||||
|
@section('content')
|
||||||
|
<p>Lots (valeur à 0 ou 1 : 0 = faux, 1 = vrai) :</p>
|
||||||
|
<table class="table table-border">
|
||||||
|
<thead class="thead-light">
|
||||||
|
<th scope="col">ID Arcadia</th>
|
||||||
|
<th scope="col">Label singulier</th>
|
||||||
|
<th scope="col">Label pluriel</th>
|
||||||
|
<th scope="col">Quantité</th>
|
||||||
|
<th scope="col">Notification activé</th>
|
||||||
|
<th scope="col">Formulaire suppl.</th>
|
||||||
|
<th scope="col">ID mail Arcadia</th>
|
||||||
|
<th scope="col">Pdf preuve de gain</th>
|
||||||
|
<th scope="col">Lot par défaut</th>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
@foreach ($prizes as $p)
|
||||||
|
<tr>
|
||||||
|
<td>{{$p->arcadia_id}}</td>
|
||||||
|
<td>{{$p->label_one}}</td>
|
||||||
|
<td>{{$p->label_many}}</td>
|
||||||
|
<td>{{$p->quantity}}</td>
|
||||||
|
<td>{{$p->notifications}}</td>
|
||||||
|
<td>{{$p->additional_form}}</td>
|
||||||
|
<td>{{$p->arcadia_mail_id}}</td>
|
||||||
|
<td><span class="badge badge-info">{{$p->pdf_winning_proof}}</span></td>
|
||||||
|
<td>{{$p->is_default}}</td>
|
||||||
|
</tr>
|
||||||
|
@endforeach
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
@endsection
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}">
|
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}">
|
||||||
<head>
|
<head>
|
||||||
<title>@yield('title') - {{ config('app.name', 'Laravel') }}</title>
|
<title>@yield('title') - {{$settingsGlobal->name}}</title>
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
<meta name="csrf-token" content="{{ csrf_token() }}">
|
<meta name="csrf-token" content="{{ csrf_token() }}">
|
||||||
|
|
@ -22,10 +22,11 @@
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
<div id="app">
|
<div id="app">
|
||||||
|
{{-- Header --}}
|
||||||
<nav class="navbar navbar-expand-md navbar-light bg-white shadow-sm">
|
<nav class="navbar navbar-expand-md navbar-light bg-white shadow-sm">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<a class="navbar-brand" href="{{ url('/') }}">
|
<a class="navbar-brand" href="{{ url('/') }}">
|
||||||
{{ config('app.name', 'Laravel') }}
|
{{$settingsGlobal->name}}
|
||||||
</a>
|
</a>
|
||||||
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="{{ __('Toggle navigation') }}">
|
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="{{ __('Toggle navigation') }}">
|
||||||
<span class="navbar-toggler-icon"></span>
|
<span class="navbar-toggler-icon"></span>
|
||||||
|
|
@ -42,7 +43,7 @@
|
||||||
<!-- Authentication Links -->
|
<!-- Authentication Links -->
|
||||||
@guest
|
@guest
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a class="nav-link" href="#">Connexion</a>
|
<a class="nav-link" href="{{route('login')}}">Connexion</a>
|
||||||
</li>
|
</li>
|
||||||
@else
|
@else
|
||||||
<li class="nav-item dropdown">
|
<li class="nav-item dropdown">
|
||||||
|
|
@ -57,7 +58,7 @@
|
||||||
Déconnexion
|
Déconnexion
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
<form id="logout-form" action="#" method="POST" style="display: none;">
|
<form id="logout-form" action="{{route('logout')}}" method="POST" style="display: none;">
|
||||||
@csrf
|
@csrf
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -67,9 +68,21 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</nav>
|
</nav>
|
||||||
|
{{-- Fin du header --}}
|
||||||
|
{{-- Contenu --}}
|
||||||
|
<div class="container">
|
||||||
|
@yield('content')
|
||||||
|
</div>
|
||||||
|
{{-- Fin du contenu --}}
|
||||||
|
{{-- Footer --}}
|
||||||
|
<footer>
|
||||||
|
<div class="text-center">
|
||||||
|
Footer {{$settingsGlobal->company}}
|
||||||
|
</div>
|
||||||
|
</footer>
|
||||||
|
{{-- Fin du footer --}}
|
||||||
</div>
|
</div>
|
||||||
<div class="container">
|
<script src="{{ asset('js/app.js') }}"></script>
|
||||||
@yield('content')
|
@yield('scripts')
|
||||||
</div>
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
||||||
74
resources/views/front/basic/login.blade.php
Normal file
74
resources/views/front/basic/login.blade.php
Normal file
|
|
@ -0,0 +1,74 @@
|
||||||
|
@extends('front.basic.layout')
|
||||||
|
|
||||||
|
@section('title', 'Connexion')
|
||||||
|
|
||||||
|
@section('content')
|
||||||
|
<div class="container">
|
||||||
|
<div class="row justify-content-center">
|
||||||
|
<div class="col-md-8">
|
||||||
|
<div class="card">
|
||||||
|
<div class="card-header">{{ __('Login') }}</div>
|
||||||
|
|
||||||
|
<div class="card-body">
|
||||||
|
<form method="POST" action="{{ route('authenticate') }}">
|
||||||
|
@csrf
|
||||||
|
@if ($errors->any())
|
||||||
|
<div class="alert alert-danger">
|
||||||
|
<ul>
|
||||||
|
@foreach ($errors->all() as $error)
|
||||||
|
<li>{{ $error }}</li>
|
||||||
|
@endforeach
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
|
|
||||||
|
<div class="form-group row">
|
||||||
|
<label for="email" class="col-md-4 col-form-label text-md-right">{{ __('E-Mail Address') }}</label>
|
||||||
|
|
||||||
|
<div class="col-md-6">
|
||||||
|
<input id="email" type="email" class="form-control @error('email') is-invalid @enderror" name="email" value="{{ old('email') }}" required autocomplete="email" autofocus>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group row">
|
||||||
|
<label for="password" class="col-md-4 col-form-label text-md-right">{{ __('Password') }}</label>
|
||||||
|
|
||||||
|
<div class="col-md-6">
|
||||||
|
<input id="password" type="password" class="form-control @error('password') is-invalid @enderror" name="password" required autocomplete="current-password">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group row">
|
||||||
|
<div class="col-md-6 offset-md-4">
|
||||||
|
<div class="form-check">
|
||||||
|
<input class="form-check-input" type="checkbox" name="remember" id="remember" {{ old('remember') ? 'checked' : '' }}>
|
||||||
|
|
||||||
|
<label class="form-check-label" for="remember">
|
||||||
|
{{ __('Remember Me') }}
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group row mb-0">
|
||||||
|
<div class="col-md-8 offset-md-4">
|
||||||
|
<button type="submit" class="btn btn-primary">
|
||||||
|
{{ __('Login') }}
|
||||||
|
</button>
|
||||||
|
<a href="{{route('inscription')}}" class="btn btn-primary">Inscription</a>
|
||||||
|
|
||||||
|
@if (Route::has('password.request'))
|
||||||
|
<a class="btn btn-link" href="{{ route('password.request') }}">
|
||||||
|
{{ __('Forgot Your Password?') }}
|
||||||
|
</a>
|
||||||
|
@endif
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
@endsection
|
||||||
|
|
||||||
5
resources/views/front/basic/loose.blade.php
Normal file
5
resources/views/front/basic/loose.blade.php
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
@extends('front.basic.layout')
|
||||||
|
|
||||||
|
@section('content')
|
||||||
|
<p>C'est perdu</p>
|
||||||
|
@endsection
|
||||||
8
resources/views/front/basic/reduction.blade.php
Normal file
8
resources/views/front/basic/reduction.blade.php
Normal file
|
|
@ -0,0 +1,8 @@
|
||||||
|
@extends('front.basic.layout')
|
||||||
|
|
||||||
|
@section('title', 'Réduction')
|
||||||
|
|
||||||
|
@section('content')
|
||||||
|
<p>Gain d'une réduction</p>
|
||||||
|
<p><a class="btn btn-success" href="{{route('saisir-code')}}">Rejouer !</a>
|
||||||
|
@endsection
|
||||||
100
resources/views/front/basic/register-crm.blade.php
Normal file
100
resources/views/front/basic/register-crm.blade.php
Normal file
|
|
@ -0,0 +1,100 @@
|
||||||
|
@extends('front.basic.layout')
|
||||||
|
|
||||||
|
@section('title', 'Connexion')
|
||||||
|
|
||||||
|
@section('content')
|
||||||
|
<div class="container">
|
||||||
|
<div class="row justify-content-center">
|
||||||
|
<div class="col-md-8">
|
||||||
|
<div class="card">
|
||||||
|
<div class="card-header">Inscription</div>
|
||||||
|
|
||||||
|
<div class="card-body">
|
||||||
|
@if ($errors->any())
|
||||||
|
<div class="alert alert-danger">
|
||||||
|
<ul>
|
||||||
|
@foreach ($errors->all() as $error)
|
||||||
|
<li>{{ $error }}</li>
|
||||||
|
@endforeach
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
|
<form method="POST" action="{{ route('register') }}">
|
||||||
|
@csrf
|
||||||
|
<div class="form-group row">
|
||||||
|
<label class="col-md-6 col-form-label">Civilité <span class="required-asterisk">*</span></label>
|
||||||
|
<select name="civility" class="custom-select col-md-6">
|
||||||
|
<option value="1">Mr</option>
|
||||||
|
<option value="2">Mme</option>
|
||||||
|
<option value="3">Mlle</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<div class="form-group row">
|
||||||
|
<label class="col-md-6 col-form-label">Nom <span class="required-asterisk">*</span></label>
|
||||||
|
<input type="text" name="lastname" class="form-control col-md-6" placeholder="Nom" required>
|
||||||
|
</div>
|
||||||
|
<div class="form-group row">
|
||||||
|
<label class="col-md-6 col-form-label">Prénom <span class="required-asterisk">*</span></label>
|
||||||
|
<input type="text" name="firstname" class="form-control col-md-6" placeholder="Prénom" required>
|
||||||
|
</div>
|
||||||
|
<div class="form-group row">
|
||||||
|
<label class="col-md-6 col-form-label">Date de naissance <span class="required-asterisk">*</span></label>
|
||||||
|
<input type="date" name="birth_date" class="form-control col-md-6" placeholder="Date de naissance" required>
|
||||||
|
</div>
|
||||||
|
<div class="form-group row">
|
||||||
|
<label class="col-md-6 col-form-label">Email <span class="required-asterisk">*</span></label>
|
||||||
|
<input type="text" name="email" class="form-control col-md-6" placeholder="Email" required>
|
||||||
|
</div>
|
||||||
|
<div class="form-group row">
|
||||||
|
<label class="col-md-6 col-form-label">Nom d'utilisateur <span class="required-asterisk">*</span></label>
|
||||||
|
<input type="text" name="username" class="form-control col-md-6" placeholder="Nom d'utilisateur" required>
|
||||||
|
</div>
|
||||||
|
<div class="form-group row">
|
||||||
|
<label class="col-md-6 col-form-label">Mot de passe <span class="required-asterisk">*</span></label>
|
||||||
|
<input type="password" name="password" class="form-control col-md-6" placeholder="Mot de passe" required>
|
||||||
|
</div>
|
||||||
|
<div class="form-group row">
|
||||||
|
<label class="col-md-6 col-form-label">Confirmer le mot de passe <span class="required-asterisk">*</span></label>
|
||||||
|
<input id="password-confirm" type="password" class="form-control col-md-6"
|
||||||
|
name="password_confirmation" required autocomplete="new-password" placeholder="Confirmer le mot de passe">
|
||||||
|
</div>
|
||||||
|
<div class="form-group row">
|
||||||
|
<label class="col-md-6 col-form-label">Adresse <span class="required-asterisk">*</span></label>
|
||||||
|
<input type="text" name="address" class="form-control col-md-6" placeholder="Adresse" required>
|
||||||
|
</div>
|
||||||
|
<div class="form-group row">
|
||||||
|
<label class="col-md-6 col-form-label">Adresse complémentaire</label>
|
||||||
|
<input type="text" name="address2" class="form-control col-md-6" placeholder="Adresse complémentaire">
|
||||||
|
</div>
|
||||||
|
<div class="form-group row">
|
||||||
|
<label class="col-md-6 col-form-label">Ville <span class="required-asterisk">*</span></label>
|
||||||
|
<input type="text" name="town" class="form-control col-md-6" placeholder="Ville" required>
|
||||||
|
</div>
|
||||||
|
<div class="form-group row">
|
||||||
|
<label class="col-md-6 col-form-label">Code postal <span class="required-asterisk">*</span></label>
|
||||||
|
<input type="text" name="postal_code" class="form-control col-md-6" placeholder="Code postal" required>
|
||||||
|
</div>
|
||||||
|
<div class="form-group row">
|
||||||
|
<label class="col-md-6 col-form-label">Pays <span class="required-asterisk">*</span></label>
|
||||||
|
<input type="text" name="country" class="form-control col-md-6" placeholder="Pays" required>
|
||||||
|
</div>
|
||||||
|
<div class="form-group text-center">
|
||||||
|
<label class="col-form-label">
|
||||||
|
<input type="checkbox" name="news" class="form-checkbox">
|
||||||
|
Je souhaitre m'inscrire à la newsletter {{$settingsGlobal->name}}
|
||||||
|
</label><br/>
|
||||||
|
<label class="col-form-label">
|
||||||
|
<input type="checkbox" name="reglement" class="form-checkbox" required>
|
||||||
|
J'ai lu et j'accepte le <a href="{{route('reglement')}}">règlement</a>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
<div class="text-center">
|
||||||
|
<button type="submit" class="btn btn-primary">Valider</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
@endsection
|
||||||
28
resources/views/front/basic/verify.blade.php
Normal file
28
resources/views/front/basic/verify.blade.php
Normal file
|
|
@ -0,0 +1,28 @@
|
||||||
|
@extends('front.basic.layout')
|
||||||
|
|
||||||
|
@section('content')
|
||||||
|
<div class="container">
|
||||||
|
<div class="row justify-content-center">
|
||||||
|
<div class="col-md-8">
|
||||||
|
<div class="card">
|
||||||
|
<div class="card-header">{{ __('Verify Your Email Address') }}</div>
|
||||||
|
|
||||||
|
<div class="card-body">
|
||||||
|
@if (session('resent'))
|
||||||
|
<div class="alert alert-success" role="alert">
|
||||||
|
{{ __('A fresh verification link has been sent to your email address.') }}
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
|
|
||||||
|
{{ __('Before proceeding, please check your email for a verification link.') }}
|
||||||
|
{{ __('If you did not receive the email') }},
|
||||||
|
<form class="d-inline" method="POST" action="{{ route('verification.resend') }}">
|
||||||
|
@csrf
|
||||||
|
<button type="submit" class="btn btn-link p-0 m-0 align-baseline">{{ __('click here to request another') }}</button>.
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
@endsection
|
||||||
23
resources/views/home.blade.php
Normal file
23
resources/views/home.blade.php
Normal file
|
|
@ -0,0 +1,23 @@
|
||||||
|
@extends('layouts.app')
|
||||||
|
|
||||||
|
@section('content')
|
||||||
|
<div class="container">
|
||||||
|
<div class="row justify-content-center">
|
||||||
|
<div class="col-md-8">
|
||||||
|
<div class="card">
|
||||||
|
<div class="card-header">{{ __('Dashboard') }}</div>
|
||||||
|
|
||||||
|
<div class="card-body">
|
||||||
|
@if (session('status'))
|
||||||
|
<div class="alert alert-success" role="alert">
|
||||||
|
{{ session('status') }}
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
|
|
||||||
|
{{ __('You are logged in!') }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
@endsection
|
||||||
80
resources/views/layouts/app.blade.php
Normal file
80
resources/views/layouts/app.blade.php
Normal file
|
|
@ -0,0 +1,80 @@
|
||||||
|
<!doctype html>
|
||||||
|
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
|
|
||||||
|
<!-- CSRF Token -->
|
||||||
|
<meta name="csrf-token" content="{{ csrf_token() }}">
|
||||||
|
|
||||||
|
<title>{{ config('app.name', 'Laravel') }}</title>
|
||||||
|
|
||||||
|
<!-- Scripts -->
|
||||||
|
<script src="{{ asset('js/app.js') }}" defer></script>
|
||||||
|
|
||||||
|
<!-- Fonts -->
|
||||||
|
<link rel="dns-prefetch" href="//fonts.gstatic.com">
|
||||||
|
<link href="https://fonts.googleapis.com/css?family=Nunito" rel="stylesheet">
|
||||||
|
|
||||||
|
<!-- Styles -->
|
||||||
|
<link href="{{ asset('css/app.css') }}" rel="stylesheet">
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div id="app">
|
||||||
|
<nav class="navbar navbar-expand-md navbar-light bg-white shadow-sm">
|
||||||
|
<div class="container">
|
||||||
|
<a class="navbar-brand" href="{{ url('/') }}">
|
||||||
|
{{ config('app.name', 'Laravel') }}
|
||||||
|
</a>
|
||||||
|
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="{{ __('Toggle navigation') }}">
|
||||||
|
<span class="navbar-toggler-icon"></span>
|
||||||
|
</button>
|
||||||
|
|
||||||
|
<div class="collapse navbar-collapse" id="navbarSupportedContent">
|
||||||
|
<!-- Left Side Of Navbar -->
|
||||||
|
<ul class="navbar-nav mr-auto">
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<!-- Right Side Of Navbar -->
|
||||||
|
<ul class="navbar-nav ml-auto">
|
||||||
|
<!-- Authentication Links -->
|
||||||
|
@guest
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" href="{{ route('login') }}">{{ __('Login') }}</a>
|
||||||
|
</li>
|
||||||
|
@if (Route::has('register'))
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" href="{{ route('register') }}">{{ __('Register') }}</a>
|
||||||
|
</li>
|
||||||
|
@endif
|
||||||
|
@else
|
||||||
|
<li class="nav-item dropdown">
|
||||||
|
<a id="navbarDropdown" class="nav-link dropdown-toggle" href="#" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" v-pre>
|
||||||
|
{{ Auth::user()->name }}
|
||||||
|
</a>
|
||||||
|
|
||||||
|
<div class="dropdown-menu dropdown-menu-right" aria-labelledby="navbarDropdown">
|
||||||
|
<a class="dropdown-item" href="{{ route('logout') }}"
|
||||||
|
onclick="event.preventDefault();
|
||||||
|
document.getElementById('logout-form').submit();">
|
||||||
|
{{ __('Logout') }}
|
||||||
|
</a>
|
||||||
|
|
||||||
|
<form id="logout-form" action="{{ route('logout') }}" method="POST" class="d-none">
|
||||||
|
@csrf
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
@endguest
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</nav>
|
||||||
|
|
||||||
|
<main class="py-4">
|
||||||
|
@yield('content')
|
||||||
|
</main>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
|
@ -45,11 +45,7 @@
|
||||||
<!-- Right Side Of Navbar -->
|
<!-- Right Side Of Navbar -->
|
||||||
<ul class="navbar-nav ml-auto">
|
<ul class="navbar-nav ml-auto">
|
||||||
<!-- Authentication Links -->
|
<!-- Authentication Links -->
|
||||||
@guest
|
@auth
|
||||||
<li class="nav-item">
|
|
||||||
<a class="nav-link" href="#">Connexion</a>
|
|
||||||
</li>
|
|
||||||
@else
|
|
||||||
<li class="nav-item dropdown">
|
<li class="nav-item dropdown">
|
||||||
<a id="navbarDropdown" class="nav-link dropdown-toggle" href="#" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" v-pre>
|
<a id="navbarDropdown" class="nav-link dropdown-toggle" href="#" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" v-pre>
|
||||||
Bonjour {{ Auth::user()->firstname }} <span class="caret"></span>
|
Bonjour {{ Auth::user()->firstname }} <span class="caret"></span>
|
||||||
|
|
@ -62,7 +58,7 @@
|
||||||
Déconnexion
|
Déconnexion
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
<form id="logout-form" action="#" method="POST" style="display: none;">
|
<form id="logout-form" action="{{route('logout')}}" method="POST" style="display: none;">
|
||||||
@csrf
|
@csrf
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ use Illuminate\Support\Facades\Route;
|
||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// Page font
|
// Front
|
||||||
Route::get('/', 'HomeController@home')->name('home');
|
Route::get('/', 'HomeController@home')->name('home');
|
||||||
Route::get('/teaser', 'TeaserController@index')->name('teaser');
|
Route::get('/teaser', 'TeaserController@index')->name('teaser');
|
||||||
Route::get('/reglement', 'ViewContentController@reglement')->name('reglement');
|
Route::get('/reglement', 'ViewContentController@reglement')->name('reglement');
|
||||||
|
|
@ -21,11 +21,28 @@ Route::get('/charte', 'ViewContentController@charte')->name('charte');
|
||||||
Route::get('/legals', 'ViewContentController@legals')->name('legals');
|
Route::get('/legals', 'ViewContentController@legals')->name('legals');
|
||||||
Route::get('/end', 'EndPageController@index')->name('end');
|
Route::get('/end', 'EndPageController@index')->name('end');
|
||||||
Route::get('/faq', 'FAQController@index')->name('faq');
|
Route::get('/faq', 'FAQController@index')->name('faq');
|
||||||
|
Route::get('/comment-jouer', 'HowToPlayController@index')->name('comment-jouer');
|
||||||
|
Route::get('/les-gains', 'GainsController@index')->name('les-gains');
|
||||||
|
|
||||||
|
// Front nécessitant d'être connecté
|
||||||
|
Route::get('/saisir-code', 'EnterCodeController@index')->name('saisir-code')->middleware('auth');
|
||||||
|
Route::post('/saisir-code', 'PrizeWinController@index')->name('gagne')->middleware('auth');
|
||||||
|
Route::get('/perdu', 'LooseController@index')->name('perdu')->middleware('auth');
|
||||||
|
Route::post('/participate', 'EnterCodeController@participate')->name('participate')->middleware('auth');
|
||||||
|
Route::get('/reduction', 'PrizeWinController@reduction')->name('reduction')->middleware('auth');
|
||||||
|
|
||||||
|
// Authentification
|
||||||
|
Route::get('/login', 'LoginController@index')->name('login');
|
||||||
|
Route::post('/authenticate', 'LoginController@authenticate')->name('authenticate');
|
||||||
|
Route::post('/logout', 'LoginController@logout')->name('logout');
|
||||||
|
Route::get('/inscription', 'RegisterController@index')->name('inscription');
|
||||||
|
Route::post('/register', 'RegisterController@register')->name('register');
|
||||||
|
|
||||||
|
// BO
|
||||||
Route::namespace('Bo')
|
Route::namespace('Bo')
|
||||||
->prefix('bo')
|
->prefix('bo')
|
||||||
->name('bo.')
|
->name('bo.')
|
||||||
// ->middleware(['auth', 'is-admin'])
|
->middleware(['auth', 'is-admin'])
|
||||||
->group(function () {
|
->group(function () {
|
||||||
Route::get('/', 'DashboardController@index')->name('dashboard');
|
Route::get('/', 'DashboardController@index')->name('dashboard');
|
||||||
// Réglages
|
// Réglages
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue