max_stars_repo_path
stringlengths
4
223
max_stars_repo_name
stringlengths
6
113
max_stars_count
int64
0
39.9k
id
stringlengths
1
8
content
stringlengths
5
1.04M
score
float64
0.34
1
label
stringclasses
3 values
index.php
The-Actual-Damien/ordinerf-SIPWebDialer
13
4
<?php /* COLOR */ // ANTHRACITE //$color2 = "#2c3e50"; //$color1 = "#34495E"; //RED //$color2 = "#c0392b"; //$color1 = "#e74c3c"; // GREEN //$color2 = "#27ae60"; //$color1 = "#2ecc71"; // TURQUOISE //$color1 = "#16a085"; //$color2 = "#1abc9c"; // ORANGE //$color2 = "#f39c12"; //$color1 = "#e67e22"; // BLUE $color1 = "#2980b9"; $color2 = "#3498db"; // NOIR AND Turquoise //$color1 = "#393A3C"; //$color2 = "#1abc9c"; // ANTHRACITE 2 //$color2 = "#1E8BC3"; //$color1 = "#34495E"; ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <title>SIP DIALER</title> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <link href="./assets/css/font-awesome.css" rel="stylesheet" /> <link href='http://fonts.googleapis.com/css?family=Roboto:300,100,700' rel='stylesheet' type='text/css' /> <link href="assets/css/bootstrap.css" rel="stylesheet"> <link href="assets/css/webdialer.css" rel="stylesheet"> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script> <script src="./assets/js/jssip.js" ></script> <script src="./assets/js/vibrate.jquery.js"></script> <!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries --> <!--[if lt IE 9]> <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script> <script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script> <![endif]--> <style> input[placeholder], [placeholder], *[placeholder] { color:#ecf0f1 !important; } ::-webkit-input-placeholder { /* WebKit browsers */ color:#ecf0f1 !important; } :-moz-placeholder { /* Mozilla Firefox 4 to 18 */ color:#ecf0f1 !important; } ::-moz-placeholder { /* Mozilla Firefox 19+ */ color:#ecf0f1 !important; } :-ms-input-placeholder { /* Internet Explorer 10+ */ color:#ecf0f1 !important; } input:focus, textarea:focus, button:active { box-shadow: 0 0 1px #ecf0f1 !important; } a:hover{ text-decoration:none; } *:focus { outline: 0 !important; } .btn-noir { padding:10px; background-image:none !important; -webkit-box-shadow:none !important; background-color:<?php print $color1;?> !important; background-position:initial initial; background-repeat:initial initial; height:64px; width:64px; margin-right:10px; margin-left:10px; border: 1px solid <?php print $color2;?>; -webkit-box-shadow:0 0 13px <?php print $color2;?> !important; -moz-box-shadow:0 0 13px <?php print $color2;?> !important; box-shadow:0 0 13px <?php print $color2;?> !important; border-radius:35px; } .btn-noir span { color:#FFF; font-family:Roboto; text-shadow:#000000 1px 1px 0; } </style> </head> <body style="background-color:<?php print $color1;?>;"> <div class="site-wrapper"> <div class="site-wrapper-inner"> <div class="cover-container"> <div class="masthead clearfix"> <div class="inner" style="padding: 30px 0"> <h3 class="masthead-brand">SIP DIALER</h3> <ul class="nav masthead-nav" style="margin:0;"> <li class="active"><a href="#"><i class="icon-phone"></i> Calls</a></li> <li><a href="#"><i class="icon-comments"></i> Messages</a></li> </ul> </div> </div> <div style="position:relative;" class="REGISTERVIEW VIEW" > <h3>Welcome</h3> <p>Please enter your desired number / name:<br /></p> <input style="color:#FFF;background-color:<?php print $color1;?>;box-shadow:none;-webkit-box-shadow:none;-webkit-transition:none;text-align:center;font-size:20px;height:30px;padding:10px;border-radius:3px;border:1px solid <?php print $color2;?>;" type="text" name="login" id="login" placeholder="Login" value=""/><br /> </p> <p> <button style="font-weight:700;font-size:18px;padding:10px 20px;" class="register btn btn-lg">REGISTER</button> </p> <br /> </div> <div style="position:relative;display:none;" class="CALLOUTVIEW VIEW" > <h3><span class="to">Calling </span></h3> <h4 style="font-size:80px;"><i class="icon-phone"></i></h4> <button style="font-weight:700;font-size:18px;padding:10px 20px;" class="hangup btn-danger btn btn-lg">HANGUP</button> <br /> <br /> <br /> </div> <div style="position:relative;display:none;" class="CALLINVIEW VIEW" > <h3><span class="from"></span></h3> <h4 style="font-size:80px;" class="vibreur"><i class="icon-phone"></i></h4> <button style="font-weight:700;font-size:18px;padding:10px 20px;" class="answer btn-success btn btn-lg">ANSWER</button> <button style="font-weight:700;font-size:18px;padding:10px 20px;" class="refuse btn-danger btn btn-lg">REFUSE</button> <button style="display:none;font-weight:700;font-size:18px;padding:10px 20px;" class="hangup btn-danger btn btn-lg">HANGUP</button> <br /> <br /> <br /> </div> <div class="DIALVIEW" style="display:none;position:relative;"> <input id="number2dial" style="text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);font-size:24px;background-color:<?php print $color1;?>;box-shadow:none;-webkit-box-shadow:none;-webkit-transition:none;text-align:center;height:30px;padding:10px;border-radius:3px;border:1px solid <?php print $color2;?>;width:230px;margin-bottom:20px;color:#FFF;" type="text" name="dial" value=""/> <br /> <button class="digit btn-inverse btn btn-noir"> <span style="font-size: 20px; font-weight: 700;">1</span><br/> </button> <button class="digit btn-inverse btn btn-noir"> <span style="font-size: 20px; font-weight: 700;">2</span><br/> <span style="color: #bdc3c7; font-size: 10px; font-weight: 700;">ABC</span> </button> <button class="digit btn-inverse btn btn-noir"> <span style="font-size: 20px; font-weight: 700;">3</span><br/> <span style="color: #bdc3c7; font-size: 10px; font-weight: 700;">DEF</span> </button> <br> <br> <button class="digit btn-inverse btn btn-noir"> <span style="font-size: 20px; font-weight: 700;">4</span><br/> <span style="color: #bdc3c7; font-size: 10px; font-weight: 700;">GHI</span> </button> <button class="digit btn-inverse btn btn-noir"> <span style="font-size: 20px; font-weight: 700;">5</span><br/> <span style="color: #bdc3c7; font-size: 10px; font-weight: 700;">JKL</span> </button> <button class="digit btn-inverse btn btn-noir"> <span style="font-size: 20px; font-weight: 700;">6</span><br/> <span style="color: #bdc3c7; font-size: 10px; font-weight: 700;">MNO</span> </button> <br> <br> <button class="digit btn-inverse btn btn-noir"> <span style="font-size: 20px; font-weight: 700;">7</span><br/> <span style="color: #bdc3c7; font-size: 10px; font-weight: 700;">PQRS</span> </button> <button class="digit btn-inverse btn btn-noir"> <span style="font-size: 20px; font-weight: 700;">8</span><br/> <span style="color: #bdc3c7; font-size: 10px; font-weight: 700;">TUV</span> </button> <button class="digit btn-inverse btn btn-noir"> <span style="font-size: 20px; font-weight: 700;">9</span><br/> <span style="color: #bdc3c7; font-size: 10px; font-weight: 700;">WYYZ</span> </button> <br> <br> <button class="digit btn-inverse btn btn-noir"> <span style="font-size: 20px; font-weight: 700;">*</span><br/> </button> <button class="digit btn-inverse btn btn-noir"> <span style="font-size: 20px; font-weight: 700;">0</span><br/> </button> <button class="digit btn-inverse btn btn-noir"> <span style="font-size: 20px; font-weight: 700;">#</span><br/> </button> <br><br> <button style="font-weight:700;font-size:18px;padding:10px 20px;width:230px;" class="call btn-success btn"><i class="icon-phone"></i> CALL</button> </div> <!-- Audios --> <audio id="audio_remote" autoplay="autoplay" /> <audio id="ring" autoplay="autoplay" loop="true"/> </div> </div> </div> <div style="position:absolute;left:0;margin:0;padding:2px 0;border-radius:0px;border:0px;top:0;width:100%;" class="alert alert-danger"> <span class="inforegister" >Please Login...</span> <span class="infocall"></span> </div> <script> $('#clickplay').click(function(){ }); <!-- SIP --> var SIP; var rtcSession; var CALLING = 0; var REGISTERED = 0; // VIBREUR $('.vibreur').jrumble({ x: 0, y: 0, rotation: 5 }); // PRESS DIGITS $('.digit').click(function(){ if ( CALLING == 1) { DTMF( $(this).find('span').html() ); //rtcSession.sendDTMF( $(this).find('span').html()); }else{ $('#number2dial').val( $('#number2dial').val() + $(this).find('span').html() ) ; } }); // REGISTER $('.register').click(function(){ var configuration = { 'ws_servers': 'ws://sipi.fr:5066', 'uri': 'sip:'+$('#login').val()+'@sipi.fr', 'password': '*', 'display_name': "'"+$('#login').val()+"'", 'trace_sip': true }; SIP = new JsSIP.UA(configuration); SIP.start(); SIP.register(); Event(); }); // UNREGISTER $('.unregister').click(function(){ SIP.unregister(); }); // SEND MESSAGE $('.sendbtn').click(function(){ sendMessage( $('#call').val() ); }); //HANGUP $('.hangup').click(function(){ if( rtcSession ){ rtcSession.terminate(); $('.VIEW').delay(500).fadeOut(); $('.DIALVIEW').delay(500).fadeIn(); $('.call').show(); } }); //REFUSE $('.refuse').click(function(){ if( rtcSession ){ rtcSession.terminate(); $('#ring').attr('src' , '' ); $('.VIEW').delay(500).fadeOut(); $('.DIALVIEW').delay(500).fadeIn(); $('.call').show(); } }); // ANSWER $('.answer').click(function(){ if( rtcSession ){ var options = { 'mediaConstraints': { audio: true, video: false } }; rtcSession.answer( options ); $('.vibreur').trigger('stopRumble'); $('#ring').attr('src' , '' ); if (rtcSession.getRemoteStreams().length > 0) { $('#audio_remote').attr('src' , window.URL.createObjectURL(rtcSession.getRemoteStreams()[0]) ); } $('.answer').hide(); $('.refuse').hide(); $('.CALLINVIEW .hangup').fadeIn(); } }); // DIAL WITH ENTER $(document).keypress(function(e) { if (REGISTERED==1 && e.which == 13 && CALLING == 0) { if( $('#number2dial').val() != "" ){ CALLING = 1; $('.call').hide(); Invite( $('#number2dial').val() ); } } }); $('.call').click(function(){ if (REGISTERED==1 && CALLING == 0) { if( $('#number2dial').val() != "" ){ CALLING = 1; $('.call').hide(); Invite( $('#number2dial').val() ); } } }); // EVENTS function Event(){ SIP.on('registered', function(e){ $('.inforegister').html("Registered as <b>"+$('#login').val()+"</b>" ).parent().removeClass('alert-danger').addClass('alert-info'); $(".VIEW").fadeOut(); REGISTERED = 1; $(".DIALVIEW").delay(500).fadeIn(); }); SIP.on('unregistered', function(e){ $('.inforegister').html("Unregistered").parent().addClass('alert-danger').removeClass('alert-info'); $(".DIALVIEW").hide(); $('.VIEW').fadeOut(); REGISTERED = 0; $('.REGISTERVIEW').delay(500).fadeIn(); }); SIP.on('registrationFailed', function(e){ $('.inforegister').html("Fail to Register").parent().removeClass('alert-info').addClass('alert-danger'); REGISTERED = 0; $('.VIEW').fadeOut(); $('.REGISTERVIEW').delay(500).fadeIn(); }); SIP.on('newMessage', function(e){ alert('Nouveau message recu'); }); SIP.on('connected', function(e){}); SIP.on('disconnected', function(e){ $('.inforegister').html("Server Unavailable").parent().removeClass('alert-info').addClass('alert-danger'); }); SIP.on('newRTCSession', function(e){ console.log(e); if(rtcSession){ e.data.session.terminate(); return false; }else{ if( e.data.originator == "remote" ){ $('#ring').attr('src' , 'assets/sounds/ring.wav' ); rtcSession = e.data.session; $('.VIEW').fadeOut(); // DISPLAY CORRECTS BUTTONS $('.answer').show(); $('.refuse').show(); $('.CALLINVIEW .hangup').hide(); $('.from').html("Incoming Call from "+rtcSession.remote_identity.display_name); $('.vibreur').trigger('startRumble'); $('.CALLINVIEW').delay(500).fadeIn(); CALLING = 1; rtcSession.on('failed', function(e) { $('.infocall').html('- Call ended '); $('.to').html("Call Ended"); $('.VIEW').fadeOut(); $('.DIALVIEW').delay(500).fadeIn(); $('.call').show(); CALLING = 0; rtcSession = null; }); rtcSession.on('ended', function(e) { $('.infocall').html('- Call ended '); $('.to').html("Call Ended"); $('.VIEW').fadeOut(); $('.DIALVIEW').delay(500).fadeIn(); $('.call').show(); CALLING = 0; rtcSession = null; }); }else if( e.data.originator == "local" ){ $('.VIEW').fadeOut(); $('.CALLOUTVIEW').delay(500).fadeIn(); } } }); } /* ****************************** SEND DTMF ****************************** */ function DTMF( tone ){ var options = { 'duration': 160, 'extraHeaders': [ 'X-Foo: foo' ], 'eventHandlers': { 'succeeded': function(e){}, 'failed': function(e){} } }; //var dtmf = new JsSIP.RTCSession.DTMF( SIP ); rtcSession.sendDTMF(tone, options); } /* ****************************** SEND INVITE ****************************** */ function Invite( ext ){ $('.to').html("Calling "+ext+"..."); var eventHandlers = { 'progress': function(e){ CALLING = 1; $('.infocall').html('- Call is in progress'); $('.to').html("Ringing... ("+ext+")"); }, 'failed': function(e){ $('.infocall').html('- Call failed '+ e.data.cause); $('.VIEW').delay(2000).fadeOut(); $('.DIALVIEW').delay(500).fadeIn(); $('.call').show(); $('.to').html('Not Found'); CALLING = 0; rtcSession = null; }, 'ended': function(e){ if( e.data.cause != "undefined" ){ e.data.cause = ""; } $('.infocall').html('- Call ended '+ e.data.cause); $('.to').html("Call Ended"); $('.VIEW').fadeOut(); $('.DIALVIEW').fadeIn(); $('.call').show(); CALLING = 0; rtcSession = null; }, 'started': function(e){ rtcSession = e.sender; CALLING = 1; $('.to').html("Call with "+ext); $('.infocall').html('- Calling '+ext+'...'); if (rtcSession.getRemoteStreams().length > 0) { $('#audio_remote').attr('src' , window.URL.createObjectURL(rtcSession.getRemoteStreams()[0]) ); } } }; var options = { 'eventHandlers': eventHandlers, 'extraHeaders': [ 'X-FROM: WEB' ], 'mediaConstraints': {'audio': true, 'video': false} }; // SIP CALL SIP.call('sip:'+ext+'@<EMAIL>', options); } /* ****************************** // SIP MESSAGE ****************************** */ function sendMessage( text , uri){ var eventHandlers = { 'succeeded': function(e){ /* Your code here */ }, 'failed': function(e){ /* Your code here */ } }; var options = { 'eventHandlers': eventHandlers }; SIP.sendMessage(uri, text, options); } </script> </body> </html>
0.976563
high
app/Models/Subscription.php
sunjindeng/laytobe
0
20
<gh_stars>0 <?php namespace App\Models; class Subscription extends Model { public function Channels(){ return $this->hasMany(Channels::class); } }
0.902344
high
module-5/server/AuthMiddleware.php
ericmann/notes-tutorial
0
36
<filename>module-5/server/AuthMiddleware.php <?php declare(strict_types=1); namespace Notes\Module5; use League\Route\Http\Exception\ForbiddenException; use Psr\Http\Message\ResponseInterface; use Psr\Http\Message\ServerRequestInterface; use Psr\Http\Server\MiddlewareInterface; use Psr\Http\Server\RequestHandlerInterface; class AuthMiddleware implements MiddlewareInterface { public function process(ServerRequestInterface $request, RequestHandlerInterface $handler) : ResponseInterface { if (Server::authenticate($request)) { return $handler->handle($request); } $authorization = $request->getHeader('authorization')[0]; $authParts = explode(' ', $authorization); if ($authParts[0] === 'Bearer') { session_id($authParts[1]); session_start(); if (!empty($_SESSION['userId'])) { return $handler->handle($request); } } throw new ForbiddenException(); } }
0.980469
high
tests/units/classes/asserters/adapter.php
idetinkin/atoum
14
52
<reponame>idetinkin/atoum<filename>tests/units/classes/asserters/adapter.php <?php namespace mageekguy\atoum\tests\units\asserters; use mageekguy\atoum; use mageekguy\atoum\asserter; use mageekguy\atoum\test; use mageekguy\atoum\tools\variable; require_once __DIR__ . '/../../runner.php'; class adapter extends atoum\test { public function testClass() { $this->testedClass->extends(atoum\asserter::class); } public function test__construct() { $this ->given($this->newTestedInstance) ->then ->object($this->testedInstance->getGenerator())->isEqualTo(new atoum\asserter\generator()) ->object($this->testedInstance->getLocale())->isEqualTo(new atoum\locale()) ->object($this->testedInstance->getAnalyzer())->isEqualTo(new atoum\tools\variable\analyzer()) ->variable($this->testedInstance->getAdapter())->isNull() ->variable($this->testedInstance->getCall())->isEqualTo(new test\adapter\call()) ->given($this->newTestedInstance($generator = new atoum\asserter\generator(), $analyzer = new variable\analyzer(), $locale = new atoum\locale())) ->then ->object($this->testedInstance->getGenerator())->isIdenticalTo($generator) ->object($this->testedInstance->getAnalyzer())->isEqualTo($analyzer) ->object($this->testedInstance->getLocale())->isIdenticalTo($locale) ->variable($this->testedInstance->getAdapter())->isNull() ->variable($this->testedInstance->getCall())->isEqualTo(new test\adapter\call()) ; } public function testSetWith() { $this ->given( $this->newTestedInstance($generator = new asserter\generator()) ->setLocale($locale = new \mock\atoum\locale()) ->setAnalyzer($analyzer = new \mock\atoum\tools\variable\analyzer()) ) ->if( $this->calling($locale)->_ = $notAnAdapter = uniqid(), $this->calling($analyzer)->getTypeOf = $type = uniqid() ) ->then ->exception(function () use (& $value) { $this->testedInstance->setWith($value = uniqid()); }) ->isInstanceOf(atoum\asserter\exception::class) ->hasMessage($notAnAdapter) ->mock($locale)->call('_')->withArguments('%s is not a test adapter', $type)->once ->mock($analyzer)->call('getTypeOf')->withArguments($value)->once ->string($this->testedInstance->getAdapter())->isEqualTo($value) ->object($this->testedInstance->setWith($adapter = new test\adapter()))->isTestedInstance ->object($this->testedInstance->getAdapter())->isIdenticalTo($adapter) ; } public function testReset() { $this ->if($this->newTestedInstance(new asserter\generator())) ->then ->variable($this->testedInstance->getAdapter())->isNull() ->object($this->testedInstance->reset())->isTestedInstance ->variable($this->testedInstance->getAdapter())->isNull() ->if($this->testedInstance->setWith($adapter = new atoum\test\adapter())) ->then ->object($this->testedInstance->getAdapter())->isIdenticalTo($adapter) ->sizeOf($adapter->getCalls())->isZero() ->object($this->testedInstance->reset())->isTestedInstance ->object($this->testedInstance->getAdapter())->isIdenticalTo($adapter) ->sizeOf($adapter->getCalls())->isZero() ->if($adapter->md5(uniqid())) ->then ->object($this->testedInstance->getAdapter())->isIdenticalTo($adapter) ->sizeOf($adapter->getCalls())->isEqualTo(1) ->object($this->testedInstance->reset())->isTestedInstance ->object($this->testedInstance->getAdapter())->isIdenticalTo($adapter) ->sizeOf($adapter->getCalls())->isZero() ; } public function testCall() { $this ->mockGenerator->orphanize('asserterFail') ->if($this->newTestedInstance(new \mock\mageekguy\atoum\asserter\generator())) ->then ->exception(function () { $this->testedInstance->call(uniqid()); }) ->isInstanceOf(atoum\asserters\adapter\exceptions\logic::class) ->hasMessage('Adapter is undefined') ->if($this->testedInstance->setWith($adapter = new test\adapter())) ->then ->object($this->testedInstance->call($function = uniqid()))->isTestedInstance ->object($this->testedInstance->getCall())->isEqualTo(new test\adapter\call($function)) ->if($this->testedInstance->withArguments()) ->then ->object($this->testedInstance->getCall())->isEqualTo(new test\adapter\call($function, [])) ->object($this->testedInstance->disableEvaluationChecking()->call($function = uniqid()))->isTestedInstance ->object($this->testedInstance->getCall())->isEqualTo(new test\adapter\call($function)) ; } public function testWithArguments() { $this ->mockGenerator->orphanize('asserterFail') ->if($this->newTestedInstance(new \mock\mageekguy\atoum\asserter\generator())) ->then ->exception(function () { $this->testedInstance->withArguments(uniqid()); }) ->isInstanceOf(atoum\asserters\adapter\exceptions\logic::class) ->hasMessage('Adapter is undefined') ->if($this->testedInstance->setWith($adapter = new test\adapter())) ->then ->exception(function () { $this->testedInstance->withArguments(uniqid()); }) ->isInstanceOf(atoum\asserters\adapter\exceptions\logic::class) ->hasMessage('Call is undefined') ->if($this->testedInstance->call($function = uniqid())) ->then ->object($this->testedInstance->withArguments())->isTestedInstance ->object($this->testedInstance->getCall())->isEqualTo(new test\adapter\call($function, [])) ->object($this->testedInstance->withArguments($arg1 = uniqid()))->isTestedInstance ->object($this->testedInstance->getCall())->isEqualTo(new test\adapter\call($function, [$arg1])) ->object($this->testedInstance->disableEvaluationChecking()->withArguments($arg1 = uniqid(), $arg2 = uniqid()))->isTestedInstance ->object($this->testedInstance->getCall())->isEqualTo(new test\adapter\call($function, [$arg1, $arg2])) ; } public function testWithAnyArguments() { $this ->mockGenerator->orphanize('asserterFail') ->if($this->newTestedInstance(new \mock\mageekguy\atoum\asserter\generator())) ->then ->exception(function () { $this->testedInstance->withArguments(uniqid()); }) ->isInstanceOf(atoum\asserters\adapter\exceptions\logic::class) ->hasMessage('Adapter is undefined') ->if($this->testedInstance->setWith($adapter = new test\adapter())) ->then ->exception(function () { $this->testedInstance->withArguments(uniqid()); }) ->isInstanceOf(atoum\asserters\adapter\exceptions\logic::class) ->hasMessage('Call is undefined') ->if($this->testedInstance->call($function = uniqid())) ->then ->object($this->testedInstance->getCall())->isEqualTo(new test\adapter\call($function)) ->object($this->testedInstance->withAnyArguments())->isTestedInstance ->object($this->testedInstance->getCall())->isEqualTo(new test\adapter\call($function)) ->if($this->testedInstance->disableEvaluationChecking()->withArguments($arg = uniqid())) ->then ->object($this->testedInstance->getCall())->isEqualTo(new test\adapter\call($function, [$arg])) ->object($this->testedInstance->withAnyArguments())->isTestedInstance ->object($this->testedInstance->getCall())->isEqualTo(new test\adapter\call($function)) ; } public function testWithoutAnyArgument() { $this ->mockGenerator->orphanize('asserterFail') ->if($this->newTestedInstance(new \mock\mageekguy\atoum\asserter\generator())) ->then ->exception(function () { $this->testedInstance->withoutAnyArgument(); }) ->isInstanceOf(atoum\asserters\adapter\exceptions\logic::class) ->hasMessage('Adapter is undefined') ->if($this->testedInstance->setWith($adapter = new test\adapter())) ->then ->exception(function () { $this->testedInstance->withoutAnyArgument(); }) ->isInstanceOf(atoum\asserters\adapter\exceptions\logic::class) ->hasMessage('Call is undefined') ->if($this->testedInstance->call($function = uniqid())) ->then ->object($this->testedInstance->disableEvaluationChecking()->withoutAnyArgument())->isTestedInstance ->object($this->testedInstance->getCall())->isEqualTo(new test\adapter\call($function, [])) ; } public function testOnce() { $this ->if($this->newTestedInstance($generator = new asserter\generator())) ->then ->exception(function () { $this->testedInstance->once(); }) ->isInstanceOf(atoum\asserters\adapter\exceptions\logic::class) ->hasMessage('Adapter is undefined') ->exception(function () { $this->testedInstance->once; }) ->isInstanceOf(atoum\asserters\adapter\exceptions\logic::class) ->hasMessage('Adapter is undefined') ->exception(function () { $this->testedInstance->oNCE; }) ->isInstanceOf(atoum\asserters\adapter\exceptions\logic::class) ->hasMessage('Adapter is undefined') ->if($this->testedInstance->setWith($adapter = new \mock\atoum\test\adapter())) ->then ->exception(function () { $this->testedInstance->once(); }) ->isInstanceOf(atoum\asserters\adapter\exceptions\logic::class) ->hasMessage('Call is undefined') ->exception(function () { $this->testedInstance->once; }) ->isInstanceOf(atoum\asserters\adapter\exceptions\logic::class) ->hasMessage('Call is undefined') ->exception(function () { $this->testedInstance->oNCE; }) ->isInstanceOf(atoum\asserters\adapter\exceptions\logic::class) ->hasMessage('Call is undefined') ->if( $this->testedInstance ->call(uniqid()) ->setCall($call = new \mock\atoum\test\adapter\call()) ->setLocale($locale = new \mock\atoum\locale()), $this->calling($adapter)->getCalls = $calls = new \mock\atoum\test\adapter\calls(), $this->calling($calls)->count = 0, $this->calling($call)->__toString = $callAsString = uniqid(), $this->calling($locale)->__ = $notCalled = uniqid() ) ->then ->exception(function () { $this->testedInstance->once(); }) ->isInstanceOf(atoum\asserter\exception::class) ->hasMessage($notCalled) ->mock($locale)->call('__')->withArguments('%s is called %d time instead of %d', '%s is called %d times instead of %d', 0, $callAsString, 0, 1)->once ->exception(function () { $this->testedInstance->once; }) ->isInstanceOf(atoum\asserter\exception::class) ->hasMessage($notCalled) ->mock($locale)->call('__')->withArguments('%s is called %d time instead of %d', '%s is called %d times instead of %d', 0, $callAsString, 0, 1)->twice ->exception(function () { $this->testedInstance->OncE; }) ->isInstanceOf(atoum\asserter\exception::class) ->hasMessage($notCalled) ->mock($locale)->call('__')->withArguments('%s is called %d time instead of %d', '%s is called %d times instead of %d', 0, $callAsString, 0, 1)->thrice ->exception(function () use (& $failMessage) { $this->testedInstance->once($failMessage = uniqid()); }) ->isInstanceOf(atoum\asserter\exception::class) ->hasMessage($failMessage) ->if($this->calling($calls)->count = 1) ->then ->object($this->testedInstance->once())->isTestedInstance ->object($this->testedInstance->once)->isTestedInstance ->object($this->testedInstance->oNCE)->isTestedInstance ->if( $this->calling($calls)->count = $count = rand(2, PHP_INT_MAX), $this->calling($adapter)->getCallsEqualTo = $callsEqualTo = new \mock\atoum\test\adapter\calls(), $this->calling($callsEqualTo)->count = rand(1, PHP_INT_MAX), $this->calling($callsEqualTo)->__toString = $callsEqualToAsString = uniqid() ) ->then ->exception(function () { $this->testedInstance->once(); }) ->isInstanceOf(atoum\asserter\exception::class) ->hasMessage($notCalled . PHP_EOL . $callsEqualTo) ->mock($locale)->call('__')->withArguments('%s is called %d time instead of %d', '%s is called %d times instead of %d', $count, $callAsString, $count, 1)->once ->exception(function () { $this->testedInstance->once; }) ->isInstanceOf(atoum\asserter\exception::class) ->hasMessage($notCalled . PHP_EOL . $callsEqualTo) ->mock($locale)->call('__')->withArguments('%s is called %d time instead of %d', '%s is called %d times instead of %d', $count, $callAsString, $count, 1)->twice ->exception(function () { $this->testedInstance->OncE; }) ->isInstanceOf(atoum\asserter\exception::class) ->hasMessage($notCalled . PHP_EOL . $callsEqualTo) ->mock($locale)->call('__')->withArguments('%s is called %d time instead of %d', '%s is called %d times instead of %d', $count, $callAsString, $count, 1)->thrice ->exception(function () use (& $failMessage) { $this->testedInstance->once($failMessage = uniqid()); }) ->isInstanceOf(atoum\asserter\exception::class) ->hasMessage($failMessage) ; } public function testTwice() { $this ->if($this->newTestedInstance($generator = new asserter\generator())) ->then ->exception(function () { $this->testedInstance->twice(); }) ->isInstanceOf(atoum\asserters\adapter\exceptions\logic::class) ->hasMessage('Adapter is undefined') ->exception(function () { $this->testedInstance->twice; }) ->isInstanceOf(atoum\asserters\adapter\exceptions\logic::class) ->hasMessage('Adapter is undefined') ->exception(function () { $this->testedInstance->TWICe; }) ->isInstanceOf(atoum\asserters\adapter\exceptions\logic::class) ->hasMessage('Adapter is undefined') ->if($this->testedInstance->setWith($adapter = new \mock\atoum\test\adapter())) ->then ->exception(function () { $this->testedInstance->twice(); }) ->isInstanceOf(atoum\asserters\adapter\exceptions\logic::class) ->hasMessage('Call is undefined') ->exception(function () { $this->testedInstance->twice; }) ->isInstanceOf(atoum\asserters\adapter\exceptions\logic::class) ->hasMessage('Call is undefined') ->exception(function () { $this->testedInstance->twICE; }) ->isInstanceOf(atoum\asserters\adapter\exceptions\logic::class) ->hasMessage('Call is undefined') ->if( $this->testedInstance ->call(uniqid()) ->setCall($call = new \mock\atoum\test\adapter\call()) ->setLocale($locale = new \mock\atoum\locale()), $this->calling($adapter)->getCalls = $calls = new \mock\atoum\test\adapter\calls(), $this->calling($calls)->count = 0, $this->calling($call)->__toString = $callAsString = uniqid(), $this->calling($locale)->__ = $notCalled = uniqid() ) ->then ->exception(function () { $this->testedInstance->twice(); }) ->isInstanceOf(atoum\asserter\exception::class) ->hasMessage($notCalled) ->mock($locale)->call('__')->withArguments('%s is called %d time instead of %d', '%s is called %d times instead of %d', 0, $callAsString, 0, 2)->once ->exception(function () { $this->testedInstance->twice; }) ->isInstanceOf(atoum\asserter\exception::class) ->hasMessage($notCalled) ->mock($locale)->call('__')->withArguments('%s is called %d time instead of %d', '%s is called %d times instead of %d', 0, $callAsString, 0, 2)->twice ->exception(function () { $this->testedInstance->TWICe; }) ->isInstanceOf(atoum\asserter\exception::class) ->hasMessage($notCalled) ->mock($locale)->call('__')->withArguments('%s is called %d time instead of %d', '%s is called %d times instead of %d', 0, $callAsString, 0, 2)->thrice ->exception(function () use (& $failMessage) { $this->testedInstance->twice($failMessage = uniqid()); }) ->isInstanceOf(atoum\asserter\exception::class) ->hasMessage($failMessage) ->if( $this->calling($calls)->count = 1, $this->calling($adapter)->getCallsEqualTo = $callsEqualTo = new \mock\atoum\test\adapter\calls(), $this->calling($callsEqualTo)->count = 1, $this->calling($callsEqualTo)->__toString = $callsEqualToAsString = uniqid() ) ->then ->exception(function () { $this->testedInstance->twice(); }) ->isInstanceOf(atoum\asserter\exception::class) ->hasMessage($notCalled . PHP_EOL . $callsEqualTo) ->mock($locale)->call('__')->withArguments('%s is called %d time instead of %d', '%s is called %d times instead of %d', 1, $callAsString, 1, 2)->once ->exception(function () { $this->testedInstance->twice; }) ->isInstanceOf(atoum\asserter\exception::class) ->hasMessage($notCalled . PHP_EOL . $callsEqualTo) ->mock($locale)->call('__')->withArguments('%s is called %d time instead of %d', '%s is called %d times instead of %d', 1, $callAsString, 1, 2)->twice ->exception(function () { $this->testedInstance->TWICe; }) ->isInstanceOf(atoum\asserter\exception::class) ->hasMessage($notCalled . PHP_EOL . $callsEqualTo) ->mock($locale)->call('__')->withArguments('%s is called %d time instead of %d', '%s is called %d times instead of %d', 1, $callAsString, 1, 2)->thrice ->exception(function () use (& $failMessage) { $this->testedInstance->twice($failMessage = uniqid()); }) ->isInstanceOf(atoum\asserter\exception::class) ->hasMessage($failMessage) ->if($this->calling($calls)->count = 2) ->then ->object($this->testedInstance->twice())->isTestedInstance ->object($this->testedInstance->twice)->isTestedInstance ->object($this->testedInstance->TWICe)->isTestedInstance ->if( $this->calling($calls)->count = $count = rand(3, PHP_INT_MAX), $this->calling($adapter)->getCallsEqualTo = $callsEqualTo = new \mock\atoum\test\adapter\calls(), $this->calling($callsEqualTo)->count = rand(1, PHP_INT_MAX), $this->calling($callsEqualTo)->__toString = $callsEqualToAsString = uniqid() ) ->then ->exception(function () { $this->testedInstance->twice(); }) ->isInstanceOf(atoum\asserter\exception::class) ->hasMessage($notCalled . PHP_EOL . $callsEqualTo) ->mock($locale)->call('__')->withArguments('%s is called %d time instead of %d', '%s is called %d times instead of %d', $count, $callAsString, $count, 2)->once ->exception(function () { $this->testedInstance->twice; }) ->isInstanceOf(atoum\asserter\exception::class) ->hasMessage($notCalled . PHP_EOL . $callsEqualTo) ->mock($locale)->call('__')->withArguments('%s is called %d time instead of %d', '%s is called %d times instead of %d', $count, $callAsString, $count, 2)->twice ->exception(function () { $this->testedInstance->TWICe; }) ->isInstanceOf(atoum\asserter\exception::class) ->hasMessage($notCalled . PHP_EOL . $callsEqualTo) ->mock($locale)->call('__')->withArguments('%s is called %d time instead of %d', '%s is called %d times instead of %d', $count, $callAsString, $count, 2)->thrice ->exception(function () use (& $failMessage) { $this->testedInstance->once($failMessage = uniqid()); }) ->isInstanceOf(atoum\asserter\exception::class) ->hasMessage($failMessage) ; } public function testThrice() { $this ->if($this->newTestedInstance($generator = new asserter\generator())) ->then ->exception(function () { $this->testedInstance->thrice(); }) ->isInstanceOf(atoum\asserters\adapter\exceptions\logic::class) ->hasMessage('Adapter is undefined') ->exception(function () { $this->testedInstance->thrice; }) ->isInstanceOf(atoum\asserters\adapter\exceptions\logic::class) ->hasMessage('Adapter is undefined') ->exception(function () { $this->testedInstance->tHRICe; }) ->isInstanceOf(atoum\asserters\adapter\exceptions\logic::class) ->hasMessage('Adapter is undefined') ->if($this->testedInstance->setWith($adapter = new \mock\atoum\test\adapter())) ->then ->exception(function () { $this->testedInstance->thrice(); }) ->isInstanceOf(atoum\asserters\adapter\exceptions\logic::class) ->hasMessage('Call is undefined') ->exception(function () { $this->testedInstance->thrice; }) ->isInstanceOf(atoum\asserters\adapter\exceptions\logic::class) ->hasMessage('Call is undefined') ->exception(function () { $this->testedInstance->thRICE; }) ->isInstanceOf(atoum\asserters\adapter\exceptions\logic::class) ->hasMessage('Call is undefined') ->if( $this->testedInstance ->call(uniqid()) ->setCall($call = new \mock\atoum\test\adapter\call()) ->setLocale($locale = new \mock\atoum\locale()), $this->calling($adapter)->getCalls = $calls = new \mock\atoum\test\adapter\calls(), $this->calling($calls)->count = 0, $this->calling($call)->__toString = $callAsString = uniqid(), $this->calling($locale)->__ = $notCalled = uniqid() ) ->then ->exception(function () { $this->testedInstance->thrice(); }) ->isInstanceOf(atoum\asserter\exception::class) ->hasMessage($notCalled) ->mock($locale)->call('__')->withArguments('%s is called %d time instead of %d', '%s is called %d times instead of %d', 0, $callAsString, 0, 3)->once ->exception(function () { $this->testedInstance->thrice; }) ->isInstanceOf(atoum\asserter\exception::class) ->hasMessage($notCalled) ->mock($locale)->call('__')->withArguments('%s is called %d time instead of %d', '%s is called %d times instead of %d', 0, $callAsString, 0, 3)->twice ->exception(function () { $this->testedInstance->THRIce; }) ->isInstanceOf(atoum\asserter\exception::class) ->hasMessage($notCalled) ->mock($locale)->call('__')->withArguments('%s is called %d time instead of %d', '%s is called %d times instead of %d', 0, $callAsString, 0, 3)->thrice ->exception(function () use (& $failMessage) { $this->testedInstance->thrice($failMessage = uniqid()); }) ->isInstanceOf(atoum\asserter\exception::class) ->hasMessage($failMessage) ->if( $this->calling($calls)->count = $count = rand(1, 2), $this->calling($adapter)->getCallsEqualTo = $callsEqualTo = new \mock\atoum\test\adapter\calls(), $this->calling($callsEqualTo)->count = $count, $this->calling($callsEqualTo)->__toString = $callsEqualToAsString = uniqid() ) ->then ->exception(function () { $this->testedInstance->thrice(); }) ->isInstanceOf(atoum\asserter\exception::class) ->hasMessage($notCalled . PHP_EOL . $callsEqualTo) ->mock($locale)->call('__')->withArguments('%s is called %d time instead of %d', '%s is called %d times instead of %d', $count, $callAsString, $count, 3)->once ->exception(function () { $this->testedInstance->thrice; }) ->isInstanceOf(atoum\asserter\exception::class) ->hasMessage($notCalled . PHP_EOL . $callsEqualTo) ->mock($locale)->call('__')->withArguments('%s is called %d time instead of %d', '%s is called %d times instead of %d', $count, $callAsString, $count, 3)->twice ->exception(function () { $this->testedInstance->tHRICe; }) ->isInstanceOf(atoum\asserter\exception::class) ->hasMessage($notCalled . PHP_EOL . $callsEqualTo) ->mock($locale)->call('__')->withArguments('%s is called %d time instead of %d', '%s is called %d times instead of %d', $count, $callAsString, $count, 3)->thrice ->exception(function () use (& $failMessage) { $this->testedInstance->thrice($failMessage = uniqid()); }) ->isInstanceOf(atoum\asserter\exception::class) ->hasMessage($failMessage) ->if($this->calling($calls)->count = 3) ->then ->object($this->testedInstance->thrice())->isTestedInstance ->object($this->testedInstance->thrice)->isTestedInstance ->object($this->testedInstance->THRIcE)->isTestedInstance ->if( $this->calling($calls)->count = $count = rand(3, PHP_INT_MAX), $this->calling($adapter)->getCallsEqualTo = $callsEqualTo = new \mock\atoum\test\adapter\calls(), $this->calling($callsEqualTo)->count = $count, $this->calling($callsEqualTo)->__toString = $callsEqualToAsString = uniqid() ) ->then ->exception(function () { $this->testedInstance->thrice(); }) ->isInstanceOf(atoum\asserter\exception::class) ->hasMessage($notCalled . PHP_EOL . $callsEqualTo) ->mock($locale)->call('__')->withArguments('%s is called %d time instead of %d', '%s is called %d times instead of %d', $count, $callAsString, $count, 3)->once ->exception(function () { $this->testedInstance->thrice; }) ->isInstanceOf(atoum\asserter\exception::class) ->hasMessage($notCalled . PHP_EOL . $callsEqualTo) ->mock($locale)->call('__')->withArguments('%s is called %d time instead of %d', '%s is called %d times instead of %d', $count, $callAsString, $count, 3)->twice ->exception(function () { $this->testedInstance->tHRICe; }) ->isInstanceOf(atoum\asserter\exception::class) ->hasMessage($notCalled . PHP_EOL . $callsEqualTo) ->mock($locale)->call('__')->withArguments('%s is called %d time instead of %d', '%s is called %d times instead of %d', $count, $callAsString, $count, 3)->thrice ->exception(function () use (& $failMessage) { $this->testedInstance->thrice($failMessage = uniqid()); }) ->isInstanceOf(atoum\asserter\exception::class) ->hasMessage($failMessage) ; } public function testAtLeastOnce() { $this ->if($this->newTestedInstance($generator = new asserter\generator())) ->then ->exception(function () { $this->testedInstance->atLeastOnce(); }) ->isInstanceOf(atoum\asserters\adapter\exceptions\logic::class) ->hasMessage('Adapter is undefined') ->exception(function () { $this->testedInstance->atLeastOnce; }) ->isInstanceOf(atoum\asserters\adapter\exceptions\logic::class) ->hasMessage('Adapter is undefined') ->exception(function () { $this->testedInstance->atLEASToNce; }) ->isInstanceOf(atoum\asserters\adapter\exceptions\logic::class) ->hasMessage('Adapter is undefined') ->if($this->testedInstance->setWith($adapter = new \mock\atoum\test\adapter())) ->then ->exception(function () { $this->testedInstance->atLeastOnce(); }) ->isInstanceOf(atoum\asserters\adapter\exceptions\logic::class) ->hasMessage('Call is undefined') ->exception(function () { $this->testedInstance->atLeastOnce; }) ->isInstanceOf(atoum\asserters\adapter\exceptions\logic::class) ->hasMessage('Call is undefined') ->exception(function () { $this->testedInstance->atLeASTonce; }) ->isInstanceOf(atoum\asserters\adapter\exceptions\logic::class) ->hasMessage('Call is undefined') ->if( $this->testedInstance ->call(uniqid()) ->setCall($call = new \mock\atoum\test\adapter\call()) ->setLocale($locale = new \mock\atoum\locale()), $this->calling($adapter)->getCalls = $calls = new \mock\atoum\test\adapter\calls(), $this->calling($calls)->count = 0, $this->calling($call)->__toString = $callAsString = uniqid(), $this->calling($locale)->_ = $notCalled = uniqid() ) ->then ->exception(function () { $this->testedInstance->atLeastOnce(); }) ->isInstanceOf(atoum\asserter\exception::class) ->hasMessage($notCalled) ->mock($locale)->call('_')->withArguments('%s is called 0 time', $callAsString)->once ->exception(function () { $this->testedInstance->atLeastOnce; }) ->isInstanceOf(atoum\asserter\exception::class) ->hasMessage($notCalled) ->mock($locale)->call('_')->withArguments('%s is called 0 time', $callAsString)->twice ->exception(function () { $this->testedInstance->atLEASToNCE; }) ->isInstanceOf(atoum\asserter\exception::class) ->hasMessage($notCalled) ->mock($locale)->call('_')->withArguments('%s is called 0 time', $callAsString)->thrice ->exception(function () use (& $failMessage) { $this->testedInstance->atLeastOnce($failMessage = uniqid()); }) ->isInstanceOf(atoum\asserter\exception::class) ->hasMessage($failMessage) ->if($this->calling($calls)->count = rand(1, PHP_INT_MAX)) ->then ->object($this->testedInstance->atLeastOnce())->isTestedInstance ->object($this->testedInstance->atLeastOnce)->isTestedInstance ->object($this->testedInstance->atLEASToNCe)->isTestedInstance ; } public function testExactly() { $this ->if($this->newTestedInstance($generator = new asserter\generator())) ->then ->exception(function () { $this->testedInstance->exactly(2); }) ->isInstanceOf(atoum\asserters\adapter\exceptions\logic::class) ->hasMessage('Adapter is undefined') ->if($this->testedInstance->setWith($adapter = new \mock\atoum\test\adapter())) ->then ->exception(function () { $this->testedInstance->exactly(2); }) ->isInstanceOf(atoum\asserters\adapter\exceptions\logic::class) ->hasMessage('Call is undefined') ->if( $this->testedInstance ->call(uniqid()) ->setCall($call = new \mock\atoum\test\adapter\call()) ->setLocale($locale = new \mock\atoum\locale()), $this->calling($adapter)->getCalls = $calls = new \mock\atoum\test\adapter\calls(), $this->calling($calls)->count = 0, $this->calling($call)->__toString = $callAsString = uniqid(), $this->calling($locale)->__ = $notCalled = uniqid() ) ->then ->exception(function () use (& $callNumber) { $this->testedInstance->exactly($callNumber = rand(1, PHP_INT_MAX)); }) ->isInstanceOf(atoum\asserter\exception::class) ->hasMessage($notCalled) ->mock($locale)->call('__')->withArguments('%s is called %d time instead of %d', '%s is called %d times instead of %d', 0, $callAsString, 0, $callNumber)->once ->exception(function () use (& $callNumber, & $failMessage) { $this->testedInstance->exactly($callNumber = rand(1, PHP_INT_MAX), $failMessage = uniqid()); }) ->isInstanceOf(atoum\asserter\exception::class) ->hasMessage($failMessage) ->object($this->testedInstance->exactly(0))->isTestedInstance ->if( $this->calling($calls)->count = $count = rand(1, PHP_INT_MAX), $this->calling($adapter)->getCallsEqualTo = $callsEqualTo = new \mock\atoum\test\adapter\calls(), $this->calling($callsEqualTo)->count = $count, $this->calling($callsEqualTo)->__toString = $callsEqualToAsString = uniqid() ) ->then ->exception(function () { $this->testedInstance->exactly(0); }) ->isInstanceOf(atoum\asserter\exception::class) ->hasMessage($notCalled . PHP_EOL . $callsEqualToAsString) ->mock($locale)->call('__')->withArguments('%s is called %d time instead of %d', '%s is called %d times instead of %d', $count, $callAsString, $count, 0)->once ->exception(function () use (& $failMessage) { $this->testedInstance->exactly(0, $failMessage = uniqid()); }) ->isInstanceOf(atoum\asserter\exception::class) ->hasMessage($failMessage) ->object($this->testedInstance->exactly($count))->isTestedInstance ; } public function testNever() { $this ->if($this->newTestedInstance($generator = new asserter\generator())) ->then ->exception(function () { $this->testedInstance->never(); }) ->isInstanceOf(atoum\asserters\adapter\exceptions\logic::class) ->hasMessage('Adapter is undefined') ->exception(function () { $this->testedInstance->never; }) ->isInstanceOf(atoum\asserters\adapter\exceptions\logic::class) ->hasMessage('Adapter is undefined') ->if($this->testedInstance->setWith($adapter = new \mock\atoum\test\adapter())) ->then ->exception(function () { $this->testedInstance->never(); }) ->isInstanceOf(atoum\asserters\adapter\exceptions\logic::class) ->hasMessage('Call is undefined') ->exception(function () { $this->testedInstance->never; }) ->isInstanceOf(atoum\asserters\adapter\exceptions\logic::class) ->hasMessage('Call is undefined') ->if( $this->testedInstance ->call(uniqid()) ->setCall($call = new \mock\atoum\test\adapter\call()) ->setLocale($locale = new \mock\atoum\locale()), $this->calling($adapter)->getCalls = $calls = new \mock\atoum\test\adapter\calls(), $this->calling($calls)->count = $count = rand(1, PHP_INT_MAX), $this->calling($call)->__toString = $callAsString = uniqid(), $this->calling($locale)->__ = $wasCalled = uniqid() ) ->then ->exception(function () use (& $callNumber) { $this->testedInstance->never(); }) ->isInstanceOf(atoum\asserter\exception::class) ->hasMessage($wasCalled) ->mock($locale)->call('__')->withArguments('%s is called %d time instead of %d', '%s is called %d times instead of %d', $count, $callAsString, $count, 0)->once ->exception(function () use (& $callNumber) { $this->testedInstance->never; }) ->isInstanceOf(atoum\asserter\exception::class) ->hasMessage($wasCalled) ->mock($locale)->call('__')->withArguments('%s is called %d time instead of %d', '%s is called %d times instead of %d', $count, $callAsString, $count, 0)->twice ->exception(function () use (& $callNumber) { $this->testedInstance->NEvEr; }) ->isInstanceOf(atoum\asserter\exception::class) ->hasMessage($wasCalled) ->mock($locale)->call('__')->withArguments('%s is called %d time instead of %d', '%s is called %d times instead of %d', $count, $callAsString, $count, 0)->thrice ->exception(function () use (& $failMessage) { $this->testedInstance->never($failMessage = uniqid()); }) ->isInstanceOf(atoum\asserter\exception::class) ->hasMessage($failMessage) ->if($this->calling($calls)->count = 0) ->then ->object($this->testedInstance->never())->isTestedInstance ->object($this->testedInstance->never)->isTestedInstance ->object($this->testedInstance->nEVER)->isTestedInstance ; } public function testBefore() { $this ->given( $asserter = $this->newTestedInstance($generator = new atoum\asserter\generator()), $adapter = new test\adapter(), $adapter->shouldBeCallBefore = uniqid(), $asserter->setWith($adapter), $beforeAsserter = $this->newTestedInstance(new atoum\asserter\generator()), $beforeAdapter = new test\adapter(), $beforeAdapter->wasCalledAfter = uniqid(), $beforeAsserter->setWith($beforeAdapter), $asserter->call('shouldBeCallBefore')->before($beforeAsserter->call('wasCalledAfter')) ) ->if( $adapter->shouldBeCallBefore(), $beforeAdapter->wasCalledAfter() ) ->then ->object($asserter->once())->isIdenticalTo($asserter) ->if( $adapter->resetCalls(), $beforeAdapter->resetCalls(), $beforeAdapter->wasCalledAfter(), $adapter->shouldBeCallBefore() ) ->then ->exception(function () use ($asserter) { $asserter->once(); }) ->isInstanceOf(atoum\asserter\exception::class) ->hasMessage(sprintf($generator->getLocale()->_('%s is not called before %s'), $asserter->getCall(), $beforeAsserter->getCall())) ->if( $adapter->resetCalls(), $beforeAdapter->resetCalls(), $beforeAdapter->wasCalledAfter(), $beforeAdapter->wasCalledAfter(), $adapter->shouldBeCallBefore() ) ->then ->exception(function () use ($asserter) { $asserter->once(); }) ->isInstanceOf(atoum\asserter\exception::class) ->hasMessage(sprintf($generator->getLocale()->_('%s is not called before %s'), $asserter->getCall(), $beforeAsserter->getCall())) ->if( $adapter->resetCalls(), $beforeAdapter->resetCalls(), $adapter->shouldBeCallBefore(), $beforeAdapter->wasCalledAfter(), $beforeAdapter->wasCalledAfter(), $adapter->shouldBeCallBefore() ) ->then ->object($asserter->once())->isIdenticalTo($asserter) ->exception(function () use ($asserter) { $asserter->twice(); }) ->isInstanceOf(atoum\asserter\exception::class) ->hasMessage(sprintf($generator->getLocale()->_('%s is called 1 time instead of 2 before %s'), $asserter->getCall(), $beforeAsserter->getCall())) ->if( $adapter->resetCalls(), $beforeAdapter->resetCalls(), $adapter->shouldBeCallBefore(), $beforeAdapter->wasCalledAfter(), $adapter->shouldBeCallBefore(), $beforeAdapter->wasCalledAfter() ) ->then ->exception(function () use ($asserter) { $asserter->once(); }) ->if( $adapter->resetCalls(), $beforeAdapter->resetCalls(), $adapter->shouldBeCallBefore(), $beforeAdapter->wasCalledAfter(), $beforeAdapter->wasCalledAfter() ) ->then ->object($asserter->once())->isIdenticalTo($asserter) ->if( $adapter->resetCalls(), $beforeAdapter->resetCalls(), $adapter->shouldBeCallBefore(), $adapter->shouldBeCallBefore(), $beforeAdapter->wasCalledAfter(), $beforeAdapter->wasCalledAfter() ) ->then ->object($asserter->twice())->isIdenticalTo($asserter) ; } public function testAfter() { $this ->given( $asserter = $this->newTestedInstance($generator = new atoum\asserter\generator()), $adapter = new test\adapter(), $adapter->shouldBeCallafter = uniqid(), $asserter->setWith($adapter), $afterAsserter = $this->newTestedInstance(new atoum\asserter\generator()), $afterAdapter = new test\adapter(), $afterAdapter->wasCalledBefore = uniqid(), $afterAsserter->setWith($afterAdapter), $asserter->call('shouldBeCallAfter')->after($afterAsserter->call('wasCalledBefore')), $afterAdapter->wasCalledBefore(), $adapter->shouldBeCallAfter() ) ->then ->object($asserter->once())->isIdenticalTo($asserter) ->if( $adapter->resetCalls(), $afterAdapter->resetCalls(), $adapter->shouldBeCallAfter(), $afterAdapter->wasCalledBefore() ) ->then ->exception(function () use ($asserter) { $asserter->once(); }) ->isInstanceOf(atoum\asserter\exception::class) ->hasMessage(sprintf($generator->getLocale()->_('%s is not called after %s'), $asserter->getCall(), $afterAsserter->getCall())) ->if( $adapter->resetCalls(), $afterAdapter->resetCalls(), $adapter->shouldBeCallAfter(), $adapter->shouldBeCallAfter(), $afterAdapter->wasCalledBefore() ) ->then ->exception(function () use ($asserter) { $asserter->once(); }) ->isInstanceOf(atoum\asserter\exception::class) ->hasMessage(sprintf($generator->getLocale()->_('%s is not called after %s'), $asserter->getCall(), $afterAsserter->getCall())) ->if( $adapter->resetCalls(), $afterAdapter->resetCalls(), $adapter->shouldBeCallAfter(), $afterAdapter->wasCalledBefore(), $adapter->shouldBeCallAfter() ) ->then ->object($asserter->once())->isIdenticalTo($asserter) ->exception(function () use ($asserter) { $asserter->twice(); }) ->isInstanceOf(atoum\asserter\exception::class) ->hasMessage(sprintf($generator->getLocale()->_('%s is called 1 time instead of 2 after %s'), $asserter->getCall(), $afterAsserter->getCall())) ->if( $adapter->resetCalls(), $afterAdapter->resetCalls(), $afterAdapter->wasCalledBefore(), $adapter->shouldBeCallAfter(), $afterAdapter->wasCalledBefore(), $adapter->shouldBeCallAfter() ) ->then ->object($asserter->twice())->isIdenticalTo($asserter) ->if( $adapter->resetCalls(), $afterAdapter->resetCalls(), $afterAdapter->wasCalledBefore(), $adapter->shouldBeCallAfter(), $afterAdapter->wasCalledBefore() ) ->then ->object($asserter->once())->isIdenticalTo($asserter) ->if( $adapter->resetCalls(), $afterAdapter->resetCalls(), $afterAdapter->wasCalledBefore(), $adapter->shouldBeCallAfter(), $afterAdapter->wasCalledBefore(), $adapter->shouldBeCallAfter() ) ->then ->object($asserter->twice())->isIdenticalTo($asserter) ->if( $adapter->resetCalls(), $afterAdapter->resetCalls(), $afterAdapter->wasCalledBefore(), $adapter->shouldBeCallAfter(), $adapter->shouldBeCallAfter(), $afterAdapter->wasCalledBefore() ) ->then ->object($asserter->twice())->isIdenticalTo($asserter) ->if( $adapter->resetCalls(), $afterAdapter->resetCalls(), $afterAdapter->wasCalledBefore(), $afterAdapter->wasCalledBefore(), $adapter->shouldBeCallAfter() ) ->then ->object($asserter->once())->isIdenticalTo($asserter) ; } }
0.996094
high
W8D3/DB_wrapper_ses.php
Denis-dizi/PHP2020
1
68
<gh_stars>1-10 <?php namespace DB; //(1:28:) use mysqli; class DB { private static $connection; private static $dbname = "shop-i"; private static function openConnection() { $dbhost = "localhost:3306"; $dbuser = "root"; $dbpass = ""; // $dbname = "shop-i"; static::$connection = new mysqli($dbhost, $dbuser, $dbpass, static::$dbname); if (static::$connection->connect_error) { die("Connection failed: " . static::$connection->connect_error); } } private static function closeConnection() { static::$connection->close(); static::$connection = null; } public static function run($sql) { if (!static::$connection) { static::openConnection(); } $response = static::$connection->query($sql); if ($response === TRUE) { $response = static::$connection->insert_id; } if (static::$connection->error) { die("SQL error: " . static::$connection->error . "</br>"); } else { return $response; } static::closeConnection(); } public static function getArrayResult($sql) { $response = self::run($sql);; $response = $response->num_rows > 0 ? $response->fetch_all(MYSQLI_ASSOC) : []; return json_encode($response); } public static function setDbName($dbname) { static::$dbname = $dbname; } }
0.992188
high
upgrade/files/9.0.0.RC1-9.0.0.RC2/files/template/scripts/BxBaseSearchExtended.php
flexsocialbox/una
173
84
<?php defined('BX_DOL') or die('hack attempt'); /** * Copyright (c) UNA, Inc - https://una.io * MIT License - https://opensource.org/licenses/MIT * * @defgroup UnaBaseView UNA Base Representation Classes * @{ */ /** * Extended Search objects representation. * * @see BxDolSearchExtended */ class BxBaseSearchExtended extends BxDolSearchExtended { protected $_sFormClassName; protected $_sFormClassPath; protected $_oForm; protected $_oTemplate; public function __construct ($aObject, $oTemplate = null) { parent::__construct ($aObject); if ($oTemplate) $this->_oTemplate = $oTemplate; else $this->_oTemplate = BxDolTemplate::getInstance(); $this->_sFormClassName = ''; $this->_sFormClassPath = ''; $this->_oForm = null; } public function getForm() { if(!$this->isEnabled()) return ''; $oForm = $this->prepareForm(); return $oForm->getCode(); } public function getResults() { if(!$this->isEnabled()) return ''; $oForm = $this->prepareForm(); if(!$oForm->isSubmittedAndValid()) return ''; $oContentInfo = BxDolContentInfo::getObjectInstance($this->_aObject['object_content_info']); if(!$oContentInfo) return ''; $aParams = array(); foreach($this->_aObject['fields'] as $aField) { $sValue = $oForm->getCleanValue($aField['name']); if(empty($sValue)) continue; $aParams[$aField['name']] = array( 'type' => $aField['search_type'], 'value' => $sValue, 'operator' => $aField['search_operator'] ); } if(empty($aParams) || !is_array($aParams)) return ''; $aResults = false; bx_alert('search', 'get_data', 0, false, array('object' => $this->_aObject, 'search_params' => $aParams, 'search_results' => &$aResults)); if($aResults === false) $aResults = $oContentInfo->getSearchResultExtended($aParams); if(empty($aResults) || !is_array($aResults)) return ''; $sResults = ''; foreach($aResults as $iId) $sResults .= $oContentInfo->getContentSearchResultUnit($iId); return $sResults; } protected function &prepareForm() { if(!empty($this->_oForm) && $this->_oForm instanceof BxDolForm) return $this->_oForm; $sForm = 'sys_search_extended_' . $this->_sObject; $sFormSubmit = 'search' . $this->_sObject; $aForm = array( 'form_attrs' => array( 'id' => $sForm, 'name' => $sForm, 'action' => '', 'method' => 'post' ), 'params' => array( 'db' => array( 'table' => '', 'key' => '', 'uri' => '', 'uri_title' => '', 'submit_name' => $sFormSubmit ), ), 'inputs' => array() ); foreach ($this->_aObject['fields'] as $aField) { if((int)$aField['active'] == 0) continue; if(in_array($aField['search_type'], array('checkbox_set', 'select_multiple')) && isset($aField['values'][''])) unset($aField['values']['']); $aForm['inputs'][$aField['name']] = array( 'type' => $aField['search_type'], 'name' => $aField['name'], 'caption' => _t($aField['caption']), 'values' => $aField['values'], 'value' => $aField['search_value'], 'db' => array( 'pass' => '<PASSWORD>' ) ); } $aForm['inputs']['search'] = array( 'type' => 'submit', 'name' => $sFormSubmit, 'value' => _t('_Search') ); $sClass = 'BxTemplSearchExtendedForm'; if(!empty($this->_sFormClassName)) { $sClass = $this->_sFormClassName; if(!empty($this->_sFormClassPath)) require_once(BX_DIRECTORY_PATH_ROOT . $this->_sFormClassPath); } $this->_oForm = new $sClass($aForm, $this->_oTemplate); $this->_oForm->initChecker(); return $this->_oForm; } } /** @} */
0.996094
high
tests/quadratus/Model/QPaie/TranchesSiBulTest.php
webeweb/core-library
2
100
<reponame>webeweb/core-library <?php /* * This file is part of the core-library package. * * (c) 2018 WEBEWEB * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace WBW\Library\Quadratus\Tests\Model\QPaie; use DateTime; use Exception; use WBW\Library\Quadratus\Model\QPaie\TranchesSiBul; use WBW\Library\Quadratus\Tests\AbstractTestCase; /** * Tranches si bul test. * * @author webeweb <https://github.com/webeweb/> * @package WBW\Library\Quadratus\Tests\Model\QPaie */ class TranchesSiBulTest extends AbstractTestCase { /** * Tests the setBrutAlSansSi() method. * * @return void */ public function testSetBrutAlSansSi(): void { $obj = new TranchesSiBul(); $obj->setBrutAlSansSi(10.092018); $this->assertEquals(10.092018, $obj->getBrutAlSansSi()); } /** * Tests the setCumBrutAlSansSi() method. * * @return void */ public function testSetCumBrutAlSansSi(): void { $obj = new TranchesSiBul(); $obj->setCumBrutAlSansSi(10.092018); $this->assertEquals(10.092018, $obj->getCumBrutAlSansSi()); } /** * Tests the setCumTotSi() method. * * @return void */ public function testSetCumTotSi(): void { $obj = new TranchesSiBul(); $obj->setCumTotSi(10.092018); $this->assertEquals(10.092018, $obj->getCumTotSi()); } /** * Tests the setCumTranche2SansSi() method. * * @return void */ public function testSetCumTranche2SansSi(): void { $obj = new TranchesSiBul(); $obj->setCumTranche2SansSi(10.092018); $this->assertEquals(10.092018, $obj->getCumTranche2SansSi()); } /** * Tests the setCumTranche2Si() method. * * @return void */ public function testSetCumTranche2Si(): void { $obj = new TranchesSiBul(); $obj->setCumTranche2Si(10.092018); $this->assertEquals(10.092018, $obj->getCumTranche2Si()); } /** * Tests the setCumTrancheASansSi() method. * * @return void */ public function testSetCumTrancheASansSi(): void { $obj = new TranchesSiBul(); $obj->setCumTrancheASansSi(10.092018); $this->assertEquals(10.092018, $obj->getCumTrancheASansSi()); } /** * Tests the setCumTrancheAsi() method. * * @return void */ public function testSetCumTrancheAsi(): void { $obj = new TranchesSiBul(); $obj->setCumTrancheAsi(10.092018); $this->assertEquals(10.092018, $obj->getCumTrancheAsi()); } /** * Tests the setCumTrancheBSansSi() method. * * @return void */ public function testSetCumTrancheBSansSi(): void { $obj = new TranchesSiBul(); $obj->setCumTrancheBSansSi(10.092018); $this->assertEquals(10.092018, $obj->getCumTrancheBSansSi()); } /** * Tests the setCumTrancheBsi() method. * * @return void */ public function testSetCumTrancheBsi(): void { $obj = new TranchesSiBul(); $obj->setCumTrancheBsi(10.092018); $this->assertEquals(10.092018, $obj->getCumTrancheBsi()); } /** * Tests the setCumTrancheCSansSi() method. * * @return void */ public function testSetCumTrancheCSansSi(): void { $obj = new TranchesSiBul(); $obj->setCumTrancheCSansSi(10.092018); $this->assertEquals(10.092018, $obj->getCumTrancheCSansSi()); } /** * Tests the setCumTrancheCsi() method. * * @return void */ public function testSetCumTrancheCsi(): void { $obj = new TranchesSiBul(); $obj->setCumTrancheCsi(10.092018); $this->assertEquals(10.092018, $obj->getCumTrancheCsi()); } /** * Tests the setCumTrancheD1SansSi() method. * * @return void */ public function testSetCumTrancheD1SansSi(): void { $obj = new TranchesSiBul(); $obj->setCumTrancheD1SansSi(10.092018); $this->assertEquals(10.092018, $obj->getCumTrancheD1SansSi()); } /** * Tests the setCumTrancheDSansSi() method. * * @return void */ public function testSetCumTrancheDSansSi(): void { $obj = new TranchesSiBul(); $obj->setCumTrancheDSansSi(10.092018); $this->assertEquals(10.092018, $obj->getCumTrancheDSansSi()); } /** * Tests the setIndicePeriode() method. * * @return void */ public function testSetIndicePeriode(): void { $obj = new TranchesSiBul(); $obj->setIndicePeriode(10); $this->assertEquals(10, $obj->getIndicePeriode()); } /** * Tests the setNumeroEmploye() method. * * @return void */ public function testSetNumeroEmploye(): void { $obj = new TranchesSiBul(); $obj->setNumeroEmploye("numeroEmploye"); $this->assertEquals("numeroEmploye", $obj->getNumeroEmploye()); } /** * Tests the setPeriode() method. * * @return void * @throws Exception Throws an exception if an error occurs. */ public function testSetPeriode(): void { // Set a Date/time mock. $periode = new DateTime("2018-09-10"); $obj = new TranchesSiBul(); $obj->setPeriode($periode); $this->assertSame($periode, $obj->getPeriode()); } /** * Tests the setTotSi() method. * * @return void */ public function testSetTotSi(): void { $obj = new TranchesSiBul(); $obj->setTotSi(10.092018); $this->assertEquals(10.092018, $obj->getTotSi()); } /** * Tests the setTranche2SansSi() method. * * @return void */ public function testSetTranche2SansSi(): void { $obj = new TranchesSiBul(); $obj->setTranche2SansSi(10.092018); $this->assertEquals(10.092018, $obj->getTranche2SansSi()); } /** * Tests the setTranche2Si() method. * * @return void */ public function testSetTranche2Si(): void { $obj = new TranchesSiBul(); $obj->setTranche2Si(10.092018); $this->assertEquals(10.092018, $obj->getTranche2Si()); } /** * Tests the setTrancheASansSi() method. * * @return void */ public function testSetTrancheASansSi(): void { $obj = new TranchesSiBul(); $obj->setTrancheASansSi(10.092018); $this->assertEquals(10.092018, $obj->getTrancheASansSi()); } /** * Tests the setTrancheAsi() method. * * @return void */ public function testSetTrancheAsi(): void { $obj = new TranchesSiBul(); $obj->setTrancheAsi(10.092018); $this->assertEquals(10.092018, $obj->getTrancheAsi()); } /** * Tests the setTrancheBSansSi() method. * * @return void */ public function testSetTrancheBSansSi(): void { $obj = new TranchesSiBul(); $obj->setTrancheBSansSi(10.092018); $this->assertEquals(10.092018, $obj->getTrancheBSansSi()); } /** * Tests the setTrancheBsi() method. * * @return void */ public function testSetTrancheBsi(): void { $obj = new TranchesSiBul(); $obj->setTrancheBsi(10.092018); $this->assertEquals(10.092018, $obj->getTrancheBsi()); } /** * Tests the setTrancheCSansSi() method. * * @return void */ public function testSetTrancheCSansSi(): void { $obj = new TranchesSiBul(); $obj->setTrancheCSansSi(10.092018); $this->assertEquals(10.092018, $obj->getTrancheCSansSi()); } /** * Tests the setTrancheCsi() method. * * @return void */ public function testSetTrancheCsi(): void { $obj = new TranchesSiBul(); $obj->setTrancheCsi(10.092018); $this->assertEquals(10.092018, $obj->getTrancheCsi()); } /** * Tests the setTrancheD1SansSi() method. * * @return void */ public function testSetTrancheD1SansSi(): void { $obj = new TranchesSiBul(); $obj->setTrancheD1SansSi(10.092018); $this->assertEquals(10.092018, $obj->getTrancheD1SansSi()); } /** * Tests the setTrancheDSansSi() method. * * @return void */ public function testSetTrancheDSansSi(): void { $obj = new TranchesSiBul(); $obj->setTrancheDSansSi(10.092018); $this->assertEquals(10.092018, $obj->getTrancheDSansSi()); } /** * Tests the __construct() method. * * @return void */ public function test__construct(): void { $obj = new TranchesSiBul(); $this->assertNull($obj->getBrutAlSansSi()); $this->assertNull($obj->getCumBrutAlSansSi()); $this->assertNull($obj->getCumTotSi()); $this->assertNull($obj->getCumTranche2Si()); $this->assertNull($obj->getCumTranche2SansSi()); $this->assertNull($obj->getCumTrancheAsi()); $this->assertNull($obj->getCumTrancheASansSi()); $this->assertNull($obj->getCumTrancheBsi()); $this->assertNull($obj->getCumTrancheBSansSi()); $this->assertNull($obj->getCumTrancheCsi()); $this->assertNull($obj->getCumTrancheCSansSi()); $this->assertNull($obj->getCumTrancheD1SansSi()); $this->assertNull($obj->getCumTrancheDSansSi()); $this->assertNull($obj->getIndicePeriode()); $this->assertNull($obj->getNumeroEmploye()); $this->assertNull($obj->getPeriode()); $this->assertNull($obj->getTotSi()); $this->assertNull($obj->getTranche2Si()); $this->assertNull($obj->getTranche2SansSi()); $this->assertNull($obj->getTrancheAsi()); $this->assertNull($obj->getTrancheASansSi()); $this->assertNull($obj->getTrancheBsi()); $this->assertNull($obj->getTrancheBSansSi()); $this->assertNull($obj->getTrancheCsi()); $this->assertNull($obj->getTrancheCSansSi()); $this->assertNull($obj->getTrancheD1SansSi()); $this->assertNull($obj->getTrancheDSansSi()); } }
0.992188
high
application/views/register.php
sandy912/Mona
0
116
<?php $this->load->view('header'); ?> <header class="masthead mobile-panel"> <div class="container"> <div class="row"> <div class="register-panel register"> <center> <img src="<?php echo base_url('img/icon.png') ?>" style="width: 80px;" /> </center> <div class="register-banner"> </div> <div class="panel-heading"> <h3 class="panel-title"> <center>Apply For Monacoin Airdrop</center> </h3> </div> <div class="panel-body"> <?php $error_msg=$this->session->flashdata('error_msg'); if($error_msg){ ?> <div class="alert alert-danger"> <?php echo $error_msg; ?> </div> <?php } ?> <form role="form" method="post" action="<?php echo base_url('user/register_user'); ?>" > <label class="has-float-label"> <input id="user_name" name="user_name" type="text" placeholder="<NAME>" pattern="^[a-zA-Z][a-zA-Z0-9 ]{1,20}$" title="Enter your name" required/> <span>Full Name</span> </label> <label class="has-float-label"> <input id="user_email" name="user_email" type="email" placeholder="<EMAIL>" required/> <span>Email Address</span> </label> <div> You must follow <a href="https://t.me/CoinFirefly" target="_blank">Monacoin</a> on Telegram and stay untill airdrop to receive 20 MONA coins.<br /> </div> <label class="has-float-label"> <input id="user_telegram" name="user_telegram" type="text" placeholder="@johndoe" required/> <span>Telegram username</span> </label> <div> You must follow <a href="https://twitter.com/CoinFirefly" target="_blank">Monacoin</a> on Twitter and retweet pinned post to receive 30 MONA coins.<br /> </div> <label class="has-float-label"> <input id="user_twitter" name="user_twitter" type="text" placeholder="@johndoe" pattern="^[A-Za-z0-9_\.@]{1,25}$" title="Enter twitter username. eg: @xxxxxx" required/> <span>Twitter username</span> </label> <div> You must subscribe to <a href="https://twitter.com/CoinFirefly" target="_blank">Monacoin</a> on youtube and press the bell icon to receive 30 MONA coins.<br /> </div> <label class="has-float-label"> <input id="user_youtube" name="user_youtube" type="text" placeholder="https://www.youtube.com/john.doe.106" required/> <span>Youtube profile name/link</span> </label> <div> You must follow <a href="https://www.facebook.com/fireflycoin/" target="_blank">Monacoin</a> on Instagram to receive 20 MONA coins.<br /> </div> <label class="has-float-label"> <input id="user_instagram" name="user_instagram" type="text" placeholder="john_doe" required/> <span>Instagram username</span> </label> <label class="has-float-label"> <input type="password" id="user_password" name="user_password" placeholder="••••••••" pattern=".{8,30}" required/> <span>Password</span> </label> <label class="input-checkbox">I hereby acknowledge that I followed Monacoin on <a href="https://t.me/CoinFirefly" target="_blank">Telegram</a>, <a href="https://twitter.com/CoinFirefly" target="_blank">Twitter</a>, <a href="https://www.facebook.com/fireflycoin/" target="_blank">Youtube</a> and <a href="" target="_blank">Instagram</a>. <input type="checkbox" required=""> <span class="checkmark"></span> </label> <script src='https://www.google.com/recaptcha/api.js'></script> <div class="capchaenclose"> <div class="g-recaptcha" data-sitekey="<KEY>"></div></div><br> <input class="btn btn-outline btn-xl text-center" type="submit" value="Apply Now" name="register" /> </form> <center>Already applied?<br><a href="<?php echo base_url('user/login'); ?>">Login here</a></center> <style> @media (min-width:360px ) { .capchaenclose { padding-left: 35px; } } </style> </div> </div> </div> </div> </div> </header> <?php $this->load->view('footer'); ?>
0.953125
high
app/Http/Controllers/PageController.php
kaangmus/web-profile
0
132
<?php namespace App\Http\Controllers; use TCG\Voyager\Models\Page; use Illuminate\Http\Request; class PageController extends Controller { public function index() { return view('pages.index', [ 'pages' => Page::paginate(9) ]); } public function show(Page $page) { return view('pages.show', compact('page')); } public function bySlug($slug) { return view('pages.show', [ 'page' => Page::where('slug', $slug)->first() ]); } }
0.78125
high
app/Utils/ContactUtil.php
samuelerwardi/restaurant
0
148
<?php namespace App\Utils; use App\Contact; use App\CustomerGroup; class ContactUtil { /** * Returns Walk In Customer for a Business * * @param int $business_id * * @return array/false */ public function getWalkInCustomer($business_id) { $contact = Contact::where('type', 'customer') ->where('business_id', $business_id) ->where('is_default', 1) ->select(['id', 'name']) ->first() ->toArray(); if (!empty($contact)) { return $contact; } else { return false; } } /** * Returns the customer group * * @param int $business_id * @param int $customer_id * * @return array */ public function getCustomerGroup($business_id, $customer_id) { $cg = []; if (empty($customer_id)) { return $cg; } $contact = Contact::leftjoin('customer_groups as CG', 'contacts.customer_group_id', 'CG.id') ->where('contacts.id', $customer_id) ->where('contacts.business_id', $business_id) ->select('CG.*') ->first(); return $contact; } }
0.992188
high
admin/lista-registrados.php
Gilberto-Felipe/GdlWebCamp
0
164
<reponame>Gilberto-Felipe/GdlWebCamp<filename>admin/lista-registrados.php <?php include_once 'funciones/sesiones.php'; if($_SESSION['nivel'] == 0) { die('No permitido'); } include_once 'funciones/funciones.php'; include_once 'templates/header.php'; include_once 'templates/barra.php'; include_once 'templates/navegacion.php'; ?> <!-- Content Wrapper. Contains page content --> <div class="content-wrapper"> <!-- Content Header (Page header) --> <section class="content-header"> <h1> Lista de personas registradas <small></small> </h1> </section> <!-- Main content --> <section class="content"> <div class="row"> <div class="col-xs-12"> <div class="box"> <div class="box-header"> <h3 class="box-title">Maneja las personas registradas</h3> </div> <!-- /.box-header --> <div class="box-body"> <table id="registros" class="table table-bordered table-striped"> <thead> <tr> <th>Nombre</th> <th>Email</th> <th>Fecha registro</th> <th>Artículos</th> <th>Talleres</th> <th>Regalo</th> <th>Compra</th> <th>Acciones</th> </tr> </thead> <tbody> <?php try { $sql = "SELECT registrados.*, regalos.nombre_regalo FROM registrados "; $sql .= "JOIN regalos "; $sql .= "ON registrados.regalo = regalos.id_regalo "; // echo $sql; // para ver la sentencia sql $resultado = $conn->query($sql); } catch (\Exception $e) { $error = $e->getMessage(); echo $error; } // pruebo con echo "<pre>"; var_dump($registrados); echo "</pre>"; while ( $registrado = $resultado->fetch_assoc() ) { ?> <tr> <td> <?php echo $registrado['nombre_registrado'] . " " . $registrado['apellido_registrado']; echo "<br>"; $pagado = $registrado['pagado']; if ($pagado) { echo '<span class="badge bg-green">Pagado</span>'; }else { echo '<span class="badge bg-red">No ha pagado</span>'; } ?> </td> <td><?php echo $registrado['email_registrado']; ?></td> <td><?php echo $registrado['fecha_registro']; ?></td> <td> <?php $articulos = json_decode($registrado['pases_articulos'], true); $arreglo_articulos = array( 'un_dia' => 'Pase un día', 'pase_completo' => 'Pase Completo', 'pase_2días' => 'Pase 2 días', 'camisas' => 'Camisas', 'etiquetas' => 'Etiquetas' ); foreach ($articulos as $llave => $articulo){ if(isset($articulo["cantidad"])){ if($articulo["cantidad"] != ""){ echo $articulo["cantidad"] . " " . $arreglo_articulos[$llave]."<br>"; } } else{ echo $articulo . " " . $arreglo_articulos[$llave]."<br>"; } } ?> </td> <td> <?php $eventos_resultado = $registrado['talleres_registrados']; $talleres = json_decode($eventos_resultado, true); $talleres = implode("', '", $talleres['eventos']); $sql_talleres = "SELECT nombre_evento, fecha_evento, hora_evento FROM eventos WHERE clave IN ('$talleres') OR evento_id IN ('$talleres') "; //echo $sql_talleres; $resultado_talleres = $conn->query($sql_talleres); while ($eventos = $resultado_talleres->fetch_assoc()) { echo $eventos['nombre_evento'] . " " . $eventos['fecha_evento'] . " " . $eventos['hora_evento'] . "<br>"; } ?> </td> <td><?php echo $registrado['nombre_regalo']; ?></td> <td>$ <?php echo $registrado['total_pagado']; ?></td> <td> <a href="editar-registro.php?id=<?php echo $registrado['id_registrado']; ?>" class="btn bg-orange btn-flat margin"> <i class="fa fa-pencil"></i> </a> <a href="#" data-id="<?php echo $registrado['id_registrado']; ?>" data-tipo="registrado" class="btn bg-maroon btn-flat margin borrar-registro"> <i class="fa fa-trash"></i> </a> </td> </tr> <?php } ?> </tbody> <tfoot> <tr> <th>Nombre</th> <th>Icono</th> <th>Acciones</th> </tr> </tfoot> </table> </div> <!-- /.box-body --> </div> <!-- /.box --> </div> <!-- /.col --> </div> <!-- /.row --> </section> <!-- /.content --> </div> <!-- /.content-wrapper --> <?php include_once 'templates/footer.php'; ?>
0.949219
high
resources/views/pages/sms/sms_App_v.blade.php
Vo-Van-Hau/fanthbol_platform
0
180
@extends('layouts.sms.index') @section('sms_App_v') <div class="SMS_APP_Container"> <div class="SMS_APP_Wrapper"> @include('components.sms.header_v') @include('components.sms.main_v') </div> </div> @endsection
0.578125
low
application/views/admin/promoted/transactions.php
stanislavgitrepo/stanislav-store-app
1
196
<gh_stars>1-10 <?php defined('BASEPATH') OR exit('No direct script access allowed'); ?> <div class="box"> <div class="box-header with-border"> <h3 class="box-title"><?php echo $title; ?></h3> </div><!-- /.box-header --> <div class="box-body"> <div class="row"> <!-- include message block --> <div class="col-sm-12"> <?php $this->load->view('admin/includes/_messages'); ?> </div> </div> <div class="row"> <div class="col-sm-12"> <div class="table-responsive"> <table class="table table-bordered table-striped" role="grid"> <?php $this->load->view('admin/promoted/_filter_transactions'); ?> <thead> <tr role="row"> <th><?php echo trans('id'); ?></th> <th><?php echo trans('payment_method'); ?></th> <th><?php echo trans('payment_id'); ?></th> <th><?php echo trans('user'); ?></th> <th><?php echo trans('product_id'); ?></th> <th><?php echo trans('currency'); ?></th> <th><?php echo trans('payment_amount'); ?></th> <th><?php echo trans('payment_status'); ?></th> <th><?php echo trans('purchased_plan'); ?></th> <th><?php echo trans('ip_address'); ?></th> <th><?php echo trans('date'); ?></th> <th class="max-width-120"><?php echo trans('options'); ?></th> </tr> </thead> <tbody> <?php foreach ($transactions as $item): ?> <tr> <td><?php echo $item->id; ?></td> <td> <?php if ($item->payment_method == "Bank Transfer") { echo trans("bank_transfer"); } else { echo $item->payment_method; } ?> </td> <td><?php echo $item->payment_id; ?></td> <td> <?php $user = get_user($item->user_id); if (!empty($user)):?> <div class="table-orders-user"> <a href="<?php echo base_url(); ?>profile/<?php echo $user->slug; ?>" target="_blank"> <?php echo html_escape($user->username); ?> </a> </div> <?php endif; ?> </td> <td><?php echo $item->product_id; ?></td> <td><?php echo $item->currency; ?></td> <td><?php echo $item->payment_amount; ?></td> <td><?php echo $item->payment_status; ?></td> <td><?php echo $item->purchased_plan; ?></td> <td><?php echo $item->ip_address; ?></td> <td><?php echo $item->created_at; ?></td> <td> <div class="dropdown"> <button class="btn bg-purple dropdown-toggle btn-select-option" type="button" data-toggle="dropdown"><?php echo trans('select_option'); ?> <span class="caret"></span> </button> <ul class="dropdown-menu options-dropdown"> <?php $product = get_product($item->product_id); if (!empty($product)): if ($product->is_promoted != 1): ?> <li> <a href="javascript:void(0)" onclick="$('#day_count_product_id').val('<?php echo html_escape($item->product_id); ?>');" data-toggle="modal" data-target="#myModal"><i class="fa fa-plus option-icon"></i><?php echo trans('add_product_to_promoted'); ?></a> </li> <?php endif; endif; ?> <li> <a href="javascript:void(0)" onclick="delete_item('product_admin_controller/delete_promoted_transaction_post','<?php echo $item->id; ?>','<?php echo trans("confirm_delete"); ?>');"><i class="fa fa-trash option-icon"></i><?php echo trans('delete'); ?></a> </li> </ul> </div> </td> </tr> <?php endforeach; ?> </tbody> </table> <?php if (empty($transactions)): ?> <p class="text-center"> <?php echo trans("no_records_found"); ?> </p> <?php endif; ?> <div class="col-sm-12 table-ft"> <div class="row"> <div class="pull-right"> <?php echo $this->pagination->create_links(); ?> </div> </div> </div> </div> </div> </div> </div><!-- /.box-body --> </div> <!-- Modal --> <div id="myModal" class="modal fade" role="dialog"> <div class="modal-dialog"> <!-- Modal content--> <div class="modal-content"> <?php echo form_open('product_admin_controller/add_remove_promoted_products'); ?> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal">&times;</button> <h4 class="modal-title"><?php echo trans('add_to_promoted'); ?></h4> </div> <div class="modal-body"> <div class="form-group"> <label><?php echo trans('day_count'); ?></label> <input type="hidden" class="form-control" name="product_id" id="day_count_product_id" value=""> <input type="hidden" class="form-control" name="is_ajax" value="0"> <input type="number" class="form-control" name="day_count" placeholder="<?php echo trans('day_count'); ?>" value="1" min="1" <?php echo ($rtl == true) ? 'dir="rtl"' : ''; ?>"> </div> </div> <div class="modal-footer"> <button type="submit" class="btn btn-success"><?php echo trans("submit"); ?></button> <button type="button" class="btn btn-danger" data-dismiss="modal"><?php echo trans("close"); ?></button> </div> <?php echo form_close(); ?><!-- form end --> </div> </div> </div>
0.980469
high
frontend/manages/clients/ClientShow.php
eagle7410/yii-bank
0
212
<filename>frontend/manages/clients/ClientShow.php <?php namespace frontend\manages\clients; use common\models\Clients; use common\models\User; use yii\db\Exception; /** * Class ClientShow * @package frontend\manages\clients */ class ClientShow { /** * @var User */ private $modelUser = null; /** * ClientShow constructor. */ public function __construct() { $this->modelUser = User::find() ->alias('u') ->select('username, email, u.id') ->joinWith([ 'client' => function ($q) { $q->alias('c') ->select('c.id, personal_number, name, middle_name, surname, user_id') ->one(); } ]) ->where('u.id = :user', [ ':user' => \Yii::$app->user->id ]) ->one(); $this->modelUser->setScenario(User::SCENARIO_CLIENT); if ($this->modelUser->client) { $this->modelUser->client->setScenario(Clients::SCENARIO_CLIENT); } } public function load($data) { if (!$this->modelUser->load($data)) { return false; } if ($this->modelUser->client) { return $this->modelUser->client->load($data); } return true; } public function save() { if (!$this->modelUser->validate()) { \Yii::error('Not valid ' . "\n Errors user:\n" . print_r($this->modelUser->errors, true) , __METHOD__); return false; } if ($this->modelUser->client && !$this->modelUser->client->validate()) { \Yii::error('Not valid ' . "\n Errors client:\n" . print_r($this->modelUser->client->errors, true) , __METHOD__); return false; } if (!empty($this->modelUser->newPassword)) { $this->modelUser->setPassword($this->modelUser->newPassword); $this->modelUser->generateAuthKey(); } $transaction = \Yii::$app->db->beginTransaction(); try { if (!$this->modelUser->save()) { throw new Exception("No update user \n" . print_r($this->modelUser->attributes, true) . "\n Errors:\n" . print_r($this->modelUser->errors, true) ); } if ($this->modelUser->client && !$this->modelUser->client->save()) { throw new Exception("No update client \n" . print_r($this->modelUser->client->attributes, true) . "\n Errors:\n" . print_r($this->modelUser->client->errors, true) ); } $transaction->commit(); return true; } catch (\Exception $e) { \Yii::error($e->getMessage(), __METHOD__); \Yii::error($e->getTraceAsString(), __METHOD__ .'::trace'); $transaction->rollBack(); return false; } } /** * @return ClientShowData */ public function getData() { return new ClientShowData($this->modelUser); } }
0.996094
high
resources/views/admin/posts/create.blade.php
dediosgre/blog2.0
0
228
@extends('adminlte::page') @section('title', 'Dashboard') @section('content_header') <h1>Crear Nuevo Post</h1> @stop @section('content') <div class="card"> <div class="card-body"> {!! Form::open(['route' => 'admin.posts.store', 'autocomplete' => 'off', 'files'=>true]) !!} @include('admin.posts.partials.form') {!! Form::submit('Crear Post', ['class'=>'btn btn-primary']) !!} {!! Form::close() !!} </div> </div> @stop @section('css') <style> .image-wrapper{ position: relative; padding-bottom: 56.25%; } .image-wrapper img{ position: absolute; object-fit: cover; width: 100%; height: 100%; } </style> @stop @section('js') <script src="{{asset('vendor/jQuery-Plugin-stringToSlug-1.3/jquery.stringToSlug.min.js')}}"></script> <script src="https://cdn.ckeditor.com/ckeditor5/24.0.0/classic/ckeditor.js"></script> <script> $(document).ready( function() { $("#name").stringToSlug({ setEvents: 'keyup keydown blur', getPut: '#slug', space: '-' }); }); ClassicEditor .create( document.querySelector( '#extract' ) ) .catch( error => { console.error( error ); } ); ClassicEditor .create( document.querySelector( '#body' ) ) .catch( error => { console.error( error ); } ); //Cambiar imagen document.getElementById("file").addEventListener('change', cambiarImagen); function cambiarImagen(event){ var file = event.target.files[0]; var reader = new FileReader(); reader.onload = (event) => { document.getElementById("picture").setAttribute('src', event.target.result); }; reader.readAsDataURL(file); } </script> @endsection
0.988281
high
resources/views/vendor/adminlte/partials/navbar/menu-item.blade.php
alhamdibahri/absensi-with-face-detection
14
244
<gh_stars>10-100 @inject('menuItemHelper', 'JeroenNoten\LaravelAdminLte\Helpers\MenuItemHelper') @if ($menuItemHelper->isSearchBar($item)) {{-- Search form --}} @include('adminlte::partials.navbar.menu-item-search-form') @elseif ($menuItemHelper->isSubmenu($item)) {{-- Dropdown menu --}} @include('adminlte::partials.navbar.menu-item-dropdown-menu') @elseif ($menuItemHelper->isLink($item)) {{-- Link --}} @include('adminlte::partials.navbar.menu-item-link') @endif
0.644531
high
src/CacheInvalidator.php
XWB/FOSHttpCache
0
260
<?php /* * This file is part of the FOSHttpCache package. * * (c) FriendsOfSymfony <http://friendsofsymfony.github.com/> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace FOS\HttpCache; use FOS\HttpCache\Exception\ExceptionCollection; use FOS\HttpCache\Exception\InvalidArgumentException; use FOS\HttpCache\Exception\ProxyResponseException; use FOS\HttpCache\Exception\ProxyUnreachableException; use FOS\HttpCache\Exception\UnsupportedProxyOperationException; use FOS\HttpCache\ProxyClient\Invalidation\BanCapable; use FOS\HttpCache\ProxyClient\Invalidation\ClearCapable; use FOS\HttpCache\ProxyClient\Invalidation\PurgeCapable; use FOS\HttpCache\ProxyClient\Invalidation\RefreshCapable; use FOS\HttpCache\ProxyClient\Invalidation\TagCapable; use FOS\HttpCache\ProxyClient\ProxyClient; use FOS\HttpCache\ProxyClient\Symfony; use Symfony\Component\EventDispatcher\EventDispatcher; use Symfony\Component\EventDispatcher\EventDispatcherInterface; use Symfony\Component\EventDispatcher\LegacyEventDispatcherProxy; use Toflar\Psr6HttpCacheStore\Psr6Store; /** * Manages HTTP cache invalidation. * * @author <NAME> <<EMAIL>> * @author <NAME> <<EMAIL>> * @author <NAME> <<EMAIL>> */ class CacheInvalidator { /** * Value to check support of invalidatePath operation. */ const PATH = 'path'; /** * Value to check support of refreshPath operation. */ const REFRESH = 'refresh'; /** * Value to check support of invalidate and invalidateRegex operations. */ const INVALIDATE = 'invalidate'; /** * Value to check support of invalidateTags operation. */ const TAGS = 'tags'; /** * Value to check support of clearCache operation. */ const CLEAR = 'clear'; /** * @var ProxyClient */ private $cache; /** * @var EventDispatcherInterface */ private $eventDispatcher; /** * Constructor. * * @param ProxyClient $cache HTTP cache */ public function __construct(ProxyClient $cache) { $this->cache = $cache; } /** * Check whether this invalidator instance supports the specified * operation. * * Support for PATH means invalidatePath will work, REFRESH means * refreshPath works, TAGS means that invalidateTags works and * INVALIDATE is for the invalidate and invalidateRegex methods. * * @param string $operation one of the class constants * * @return bool * * @throws InvalidArgumentException */ public function supports($operation) { switch ($operation) { case self::PATH: return $this->cache instanceof PurgeCapable; case self::REFRESH: return $this->cache instanceof RefreshCapable; case self::INVALIDATE: return $this->cache instanceof BanCapable; case self::TAGS: $supports = $this->cache instanceof TagCapable; if ($supports && $this->cache instanceof Symfony) { return class_exists(Psr6Store::class); } return $supports; case self::CLEAR: return $this->cache instanceof ClearCapable; default: throw new InvalidArgumentException('Unknown operation '.$operation); } } /** * Set event dispatcher - may only be called once. * * @param EventDispatcherInterface $eventDispatcher * * @throws \Exception when trying to override the event dispatcher */ public function setEventDispatcher(EventDispatcherInterface $eventDispatcher) { if ($this->eventDispatcher) { // if you want to set a custom event dispatcher, do so right after instantiating // the invalidator. throw new \Exception('You may not change the event dispatcher once it is set.'); } $this->eventDispatcher = $eventDispatcher; } /** * Get the event dispatcher used by the cache invalidator. * * @return EventDispatcherInterface */ public function getEventDispatcher() { if (!$this->eventDispatcher) { if (class_exists(LegacyEventDispatcherProxy::class)) { $this->eventDispatcher = LegacyEventDispatcherProxy::decorate(new EventDispatcher()); } else { $this->eventDispatcher = new EventDispatcher(); } } return $this->eventDispatcher; } /** * Invalidate a path or URL. * * @param string $path Path or URL * @param array $headers HTTP headers (optional) * * @throws UnsupportedProxyOperationException * * @return $this */ public function invalidatePath($path, array $headers = []) { if (!$this->cache instanceof PurgeCapable) { throw UnsupportedProxyOperationException::cacheDoesNotImplement('PURGE'); } $this->cache->purge($path, $headers); return $this; } /** * Refresh a path or URL. * * @param string $path Path or URL * @param array $headers HTTP headers (optional) * * @see RefreshCapable::refresh() * * @throws UnsupportedProxyOperationException * * @return $this */ public function refreshPath($path, array $headers = []) { if (!$this->cache instanceof RefreshCapable) { throw UnsupportedProxyOperationException::cacheDoesNotImplement('REFRESH'); } $this->cache->refresh($path, $headers); return $this; } /** * Invalidate all cached objects matching the provided HTTP headers. * * Each header is a a POSIX regular expression, for example * ['X-Host' => '^(www\.)?(this|that)\.com$'] * * @see BanCapable::ban() * * @param array $headers HTTP headers that path must match to be banned * * @throws UnsupportedProxyOperationException If HTTP cache does not support BAN requests * * @return $this */ public function invalidate(array $headers) { if (!$this->cache instanceof BanCapable) { throw UnsupportedProxyOperationException::cacheDoesNotImplement('BAN'); } $this->cache->ban($headers); return $this; } /** * Remove/Expire cache objects based on cache tags. * * @see TagCapable::tags() * * @param array $tags Tags that should be removed/expired from the cache * * @throws UnsupportedProxyOperationException If HTTP cache does not support Tags invalidation * * @return $this */ public function invalidateTags(array $tags) { if (!$this->cache instanceof TagCapable) { throw UnsupportedProxyOperationException::cacheDoesNotImplement('Tags'); } $this->cache->invalidateTags($tags); return $this; } /** * Invalidate URLs based on a regular expression for the URI, an optional * content type and optional limit to certain hosts. * * The hosts parameter can either be a regular expression, e.g. * '^(www\.)?(this|that)\.com$' or an array of exact host names, e.g. * ['example.com', 'other.net']. If the parameter is empty, all hosts * are matched. * * @see BanCapable::banPath() * * @param string $path Regular expression pattern for URI to * invalidate * @param string $contentType Regular expression pattern for the content * type to limit banning, for instance 'text' * @param array|string $hosts Regular expression of a host name or list of * exact host names to limit banning * * @throws UnsupportedProxyOperationException If HTTP cache does not support BAN requests * * @return $this */ public function invalidateRegex($path, $contentType = null, $hosts = null) { if (!$this->cache instanceof BanCapable) { throw UnsupportedProxyOperationException::cacheDoesNotImplement('BAN'); } $this->cache->banPath($path, $contentType, $hosts); return $this; } /** * Clear the cache completely. * * @throws UnsupportedProxyOperationException if HTTP cache does not support clearing the cache completely * * @return $this */ public function clearCache() { if (!$this->cache instanceof ClearCapable) { throw UnsupportedProxyOperationException::cacheDoesNotImplement('CLEAR'); } $this->cache->clear(); return $this; } /** * Send all pending invalidation requests. * * @return int the number of cache invalidations performed per caching server * * @throws ExceptionCollection if any errors occurred during flush */ public function flush() { try { return $this->cache->flush(); } catch (ExceptionCollection $exceptions) { foreach ($exceptions as $exception) { $event = new Event(); $event->setException($exception); if ($exception instanceof ProxyResponseException) { $this->getEventDispatcher()->dispatch(Events::PROXY_RESPONSE_ERROR, $event); } elseif ($exception instanceof ProxyUnreachableException) { $this->getEventDispatcher()->dispatch(Events::PROXY_UNREACHABLE_ERROR, $event); } } throw $exceptions; } } }
0.996094
high
Modules/Attendance/Entities/ImportSummary.php
sohelahr/asdc_institute
0
276
<filename>Modules/Attendance/Entities/ImportSummary.php <?php namespace Modules\Attendance\Entities; use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Factories\HasFactory; class ImportSummary extends Model { protected $table = "import_summaries"; protected $fillable = [ 'id', 'original_file', 'total_record', 'failed_record', 'failed_transaction_file', 'success_record', 'success_transaction_file', 'status', 'created_at', 'updated_at' ]; }
0.972656
high
src/InstagramBasicFeed.php
dubaifilm/laravel-instagram-basic-feed
0
292
<?php namespace ChillPills\InstagramBasicFeed; use EspressoDev\InstagramBasicDisplay\InstagramBasicDisplay; use Illuminate\Support\Facades\Cache; class InstagramBasicFeed { protected $medias; protected $instagramBasicDisplay; protected $userMedia; public static $cacheKey; public function __construct() { $accessToken = config('instagram-basic-feed.access_token'); $this->instagramBasicDisplay = new InstagramBasicDisplay($accessToken); $this->userMedia = null; $this->medias = []; self::$cacheKey = config('instagram-basic-feed.cache_key'); $this->medias = Cache::get(InstagramFeedCrawler::$cacheKey, []); } public function getUserMedias() { return $this->medias; } public function getUserMediasWithHashtag($hashtag) { if (empty($hashtag)) { return $this->getUserMedias(); } $mediaMatch = []; foreach ($this->medias as $media) { if (isset($media->caption) && strpos($media->caption, $hashtag) !== false) { $mediaMatch[] = $media; } } return $mediaMatch; } public function getUserMedia($before = null, $after = null) { if ($this->userMedia == null) { $this->userMedia = $this->instagramBasicDisplay->getUserMedia('me', 0, $before, $after); } return $this->userMedia; } public function getAllUserMedias() { if (count($this->medias)) { return $this->medias; } $before = null; do { $this->userMedia = $this->getUserMedia($before); $this->medias = array_merge($this->medias, $this->userMedia->data); if (isset($this->userMedia->paging->cursors->before) && $before != $this->userMedia->paging->cursors->before) { $before = $this->userMedia->paging->cursors->before; } else { $before = null; } } while ($before != null); $this->removeDuplicatePosts(); return $this->medias; } protected function removeDuplicatePosts() { $finalMedias = []; foreach ($this->medias as $media) { if (! array_key_exists($media->id, $finalMedias)) { $finalMedias[$media->id] = $media; } } $this->medias = $finalMedias; } public function fetchNewFeed() { $this->medias = $this->getAllUserMedias(); $this->storeNewFeedInCache(); return $this->medias; } protected function storeNewFeedInCache() { Cache::put(self::$cacheKey, $this->medias); } }
0.996094
high
resources/views/pages/property/featured.blade.php
SnergyNode/afmaaj-property
0
308
<reponame>SnergyNode/afmaaj-property <!-- Featured Property --> <div class="sidebar-widgets"> <h4>Featured Property</h4> <div class="sidebar-property-slide"> @foreach($properties as $prop) <!-- Single Property --> <div class="single-items"> <div class="property-listing property-1"> <div class="listing-img-wrapper"> <a href="{{ route('property.info', $prop->unid) }}"> <img src="{{ url($prop->single_pic()) }}" class="img-fluid mx-auto" alt="" /> </a> <span class="property-type">Book</span> </div> <div class="listing-content"> <div class="listing-detail-wrapper"> <div class="listing-short-detail"> <h4 class="listing-name">{{ $prop->name }}</h4> <span class="listing-location"><i class="ti-location-pin"></i>{{ $prop->located->name }}</span> </div> <div class="list-author"> <a href="#"><img src="{{ url('img/logo.png') }}" class="img-fluid img-circle avater-30" alt=""></a> </div> </div> <div class="listing-features-info"> <ul> <li><strong>Bed:</strong>{{ $prop->bedroom }}</li> <li><strong>Bath:</strong>{{ $prop->toilet }}</li> <li><strong>Type:</strong>{{ $prop->type }}</li> </ul> </div> <div class="listing-footer-wrapper"> <div class="listing-price"> <h4 class="list-pr">{{ $prop->price }}</h4> </div> <div class="listing-detail-btn"> <a href="{{ route('property.info', $prop->unid) }}" class="more-btn">More Info</a> </div> </div> </div> </div> </div> @endforeach </div> </div>
0.945313
high
vendor/fideloper/proxy/src/TrustProxies.php
savic993/mobileshopns
0
324
<?php namespace Fideloper\Proxy; use Closure; use Illuminate\Http\Request; use Illuminate\Contracts\Config\Repository; class TrustProxies { /** * The config repository instance. * * @var \Illuminate\Contracts\Config\Repository */ protected $config; /** * The trusted proxies for the application. * * @var array */ protected $proxies; /** * The proxy header mappings. * * @var array */ protected $headers; /** * Create a new trusted proxies middleware instance. * * @param \Illuminate\Contracts\Config\Repository $config */ public function __construct(Repository $config) { $this->config = $config; } /** * Handle an incoming request. * * @param \Illuminate\Http\Request $request * @param \Closure $next * * @throws \Symfony\Component\HttpKernel\Exception\HttpException * * @return mixed */ public function handle(Request $request, Closure $next) { $request::setTrustedProxies([], $this->getTrustedHeaderNames()); // Reset trusted proxies between requests $this->setTrustedProxyIpAddresses($request); return $next($request); } /** * Sets the trusted proxies on the request to the value of trustedproxy.proxies * * @param \Illuminate\Http\Request $request */ protected function setTrustedProxyIpAddresses(Request $request) { $trustedIps = $this->proxies ?: $this->config->get('trustedproxy.proxies'); // Only trust specific IP addresses if (is_array($trustedIps)) { return $this->setTrustedProxyIpAddressesToSpecificIps($request, $trustedIps); } // Trust any IP address that calls us // `**` for backwards compatibility, but is depreciated if ($trustedIps === '*' || $trustedIps === '**') { return $this->setTrustedProxyIpAddressesToTheCallingIp($request); } } /** * Specify the IP addresses to trust explicitly. * * @param \Illuminate\Http\Request $request * @param array $trustedIps */ private function setTrustedProxyIpAddressesToSpecificIps(Request $request, $trustedIps) { $request->setTrustedProxies((array) $trustedIps, $this->getTrustedHeaderNames()); } /** * Set the trusted proxy to be the IP address calling this servers * * @param \Illuminate\Http\Request $request */ private function setTrustedProxyIpAddressesToTheCallingIp(Request $request) { $request->setTrustedProxies([$request->server->get('REMOTE_ADDR')], $this->getTrustedHeaderNames()); } /** * Retrieve trusted header name(s), falling back to defaults if config not set. * * @return array */ protected function getTrustedHeaderNames() { return $this->headers ?: $this->config->get('trustedproxy.headers'); } }
0.996094
high
resources/views/components/input-error.blade.php
mosdraev/blog-app
0
340
<gh_stars>0 @props(['errors']) @if ($errors->any()) @php echo $errors->first($attributes->get('name'), '<p class="text-md text-red-600 text-red-600">:message</p>') @endphp @endif
0.816406
high
app/Http/Controllers/ProgramController.php
ilhamtuut/trustme
0
356
<reponame>ilhamtuut/trustme<filename>app/Http/Controllers/ProgramController.php <?php namespace App\Http\Controllers; use DB; use Mail; use Response; use App\Role; use App\User; use App\Price; use App\Wallet; use App\Balance; use App\Program; use App\Setting; use App\Package; use App\Downline; use App\BonusPasif; use App\Composition; use App\BonusActive; use App\LogActivity; use App\LevelSponsor; use App\BackupPassword; use App\Transaction; use App\HistoryTransaction; use Illuminate\Support\Str; use Illuminate\Http\Request; use Ixudra\Curl\Facades\Curl; use Illuminate\Support\Facades\Auth; use Illuminate\Support\Facades\Hash; use Illuminate\Support\Facades\Crypt; use Illuminate\Support\Facades\Validator; use Illuminate\Pagination\LengthAwarePaginator; use Intervention\Image\ImageManagerStatic as Image; use Illuminate\Validation\Factory as ValidatonFactory; class ProgramController extends Controller { /** * Create a new controller instance. * * @return void */ public function __construct(ValidatonFactory $factory) { $this->middleware('auth'); $this->middleware('user-online'); $factory->extend( 'greater_than', function ($attribute, $value, $parameters, $validator) { if($value >= 500){ return true; } }, 'The amount must be greater than 500' ); $factory->extend( 'multiple', function ($attribute, $value, $parameters) { if ($value%500 == 0 ){ return true; } }, 'The amount must be a multiple of 500' ); } /** * Show the application dashboard. * * @return \Illuminate\Http\Response */ // Status Program 0 = Jalan, 1 = Selesai, 2 = Stop Bonus // Capital 0 = disactive, 1 = active public function index(Request $request) { $packages = Package::orderBy('amount','asc')->get(); $downline = Auth::user() ->childs() ->where('username','not like','%~%') ->doesntHave('program') ->get(); $composition = Composition::where('name','like','Register%')->get(); $price = Price::where('status',0)->first()->price; return view('backend.program.index',compact('packages','downline','composition','price')); } public function by_admin(Request $request) { $packages = Package::orderBy('amount','asc')->get(); return view('backend.program.register_admin',compact('packages')); } public function register(Request $request) { $this->validate($request, [ 'amount'=>'required|numeric|gte:10', 'wallet'=>'required', 'security_password'=>'<PASSWORD>' ]); $wallet = $request->wallet; $password = $request->security_password; $package_id = 1; $package = Package::find($package_id); $amount = $request->amount; $max = $package->max_profit; $max_profit = $amount * $max; $user = Auth::user(); $user_id = $user->id; $hasPassword = Hash::check($password,$user->trx_password); if($hasPassword){ $benar = false; $income = $user->balance()->where('description','Register Wallet')->first(); $credit = $user->balance()->where('description','Trustme Coin')->first(); if($wallet == 1){ $composition = Composition::where('name','Register 1')->first(); $s_register = $amount * $composition->one; $s_dinasty = $amount * $composition->two; if($s_register <= $income->balance){ $benar = true; } }elseif($wallet == 2){ $price = Price::where('status',0)->first()->price; $composition = Composition::where('name','Register 2')->first(); $s_register = $amount * $composition->one; $s_dinasty = ($amount * $composition->two) / $price; if($s_register <= $income->balance && $s_dinasty <= $credit->balance){ $benar = true; } } if($benar){ $new = true; $run_package = true; $cek_program = Program::where('user_id',$user_id)->orderBy('id','desc')->first(); if($cek_program){ $new = false; $current_package = $cek_program->package_id; if($package_id < $current_package){ $run_package = false; $request->session()->flash('failed', 'Failed, Package must be more than the current package'); } } if($run_package){ $program = Program::create([ 'user_id' => $user_id, 'package_id' => $package->id, 'amount' => $amount, 'register' => $s_register, 'dinasty' => $s_dinasty, 'max_profit' => $max_profit, 'status' => 0, 'registered_by' => $user_id, 'description' => 'Investment '.number_format($amount) ]); if($s_register > 0){ $income->balance = $income->balance - $s_register; $income->save(); HistoryTransaction::create([ 'balance_id'=>$income->id, 'from_id'=>$user_id, 'to_id'=>1, 'amount'=> $s_register, 'description'=> 'Investment '.number_format($amount), 'status'=> 1, 'type'=> 'OUT' ]); $income_admin = Balance::where(['user_id'=>1,'description'=>'Register Wallet'])->first(); $income_admin->balance = $income_admin->balance + $s_register; $income_admin->save(); HistoryTransaction::create([ 'balance_id'=>$income_admin->id, 'from_id'=>$user_id, 'to_id'=>1, 'amount'=> $s_register, 'description'=> 'Investment '.number_format($amount).' from '.ucfirst($user->username), 'status'=> 1, 'type'=> 'IN' ]); } if($s_dinasty > 0){ $credit->balance = $credit->balance - $s_dinasty; $credit->save(); HistoryTransaction::create([ 'balance_id'=>$credit->id, 'from_id'=>$user_id, 'to_id'=>1, 'amount'=> $s_dinasty, 'description'=> 'Investment '.number_format($amount), 'status'=> 1, 'type'=> 'OUT' ]); $credit_admin = Balance::where(['user_id'=>1,'description'=>'Trustme Coin'])->first(); $credit_admin->balance = $credit_admin->balance + $s_dinasty; $credit_admin->save(); HistoryTransaction::create([ 'balance_id'=>$credit_admin->id, 'from_id'=>$user_id, 'to_id'=>1, 'amount'=> $s_dinasty, 'description'=> 'Investment '.number_format($amount).' from '.ucfirst($user->username), 'status'=> 1, 'type'=> 'IN' ]); } $this->bonus_sponsor($user_id,$amount); $request->session()->flash('success', 'Successfully, Investment '.number_format($amount)); } }else{ $request->session()->flash('failed', 'Failed, You do not have enough funds to Investment'); } }else { $request->session()->flash('failed', 'Failed, security password is wrong.'); } return redirect()->back(); } public function register_add_member(Request $request) { $this->validate($request, [ 'amount'=>'required|numeric|gte:10', 'wallet'=>'required', 'name' => 'required|string|max:255', 'username' => 'required|unique:users,username|alpha_num|max:17', 'phone_number' => 'required|string|unique:users,phone_number', 'email' => 'required|string|email|unique:users,email', 'password' => '<PASSWORD>', 'security_password' => '<PASSWORD>', ]); $myPlan = Auth::user()->program()->first(); if($myPlan){ $wallet = $request->wallet; $password = $request->security_password; $package_id = 1; $package = Package::find($package_id); $amount = $request->amount; $max = $package->max_profit; $max_profit = $amount * $max; $user = Auth::user(); $benar = false; $income = $user->balance()->where('description','Register Wallet')->first(); $credit = $user->balance()->where('description','Trustme Coin')->first(); if($wallet == 1){ $composition = Composition::where('name','Register 1')->first(); $s_register = $amount * $composition->one; $s_dinasty = $amount * $composition->two; if($s_register <= $income->balance){ $benar = true; } }elseif($wallet == 2){ $price = Price::where('status',0)->first()->price; $composition = Composition::where('name','Register 2')->first(); $s_register = $amount * $composition->one; $s_dinasty = $amount * $composition->two / $price; if($s_register <= $income->balance && $s_dinasty <= $credit->balance){ $benar = true; } } if($benar){ $data = $input = $request->all(); $new_user = User::create([ 'parent_id' => Auth::id(), 'name' => $data['name'], 'username' => $data['username'], 'phone_number' => $data['phone_number'], 'email' => $data['email'], 'password' => <PASSWORD>($data['password']), 'trx_password' => <PASSWORD>($data['<PASSWORD>']), 'status' => 1, 'is_verified' => 1 ]); $new_user->roles()->attach(1); BackupPassword::create([ 'user_id' => $new_user->id, 'password' => $data['password'], 'trx_password' => $data['<PASSWORD>'] ]); Balance::create([ 'user_id' => $new_user->id, 'balance' => 0, 'status' => 1, 'description' => 'USD Wallet' ]); Balance::create([ 'user_id' => $new_user->id, 'balance' => 0, 'status' => 1, 'description' => 'Trustme Coin' ]); Balance::create([ 'user_id' => $new_user->id, 'balance' => 0, 'status' => 1, 'description' => 'Register Wallet' ]); Balance::create([ 'user_id' => $user->id, 'balance' => 0, 'status' => 1, 'description' => 'Spartan Coin' ]); $this->saveDownline($new_user->id, Auth::id()); $user_id = $new_user->id; $program = Program::create([ 'user_id' => $user_id, 'package_id' => $package->id, 'amount' => $amount, 'register' => $s_register, 'dinasty' => $s_dinasty, 'max_profit' => $max_profit, 'status' => 0, 'registered_by' => Auth::id(), 'description' => 'Investment '.number_format($amount) ]); if($s_register > 0){ $income->balance = $income->balance - $s_register; $income->save(); HistoryTransaction::create([ 'balance_id'=>$income->id, 'from_id'=>$user_id, 'to_id'=>1, 'amount'=> $s_register, 'description'=> 'Investment '.number_format($amount).' to '.ucfirst($new_user->username), 'status'=> 1, 'type'=> 'OUT' ]); $income_admin = Balance::where(['user_id'=>1,'description'=>'Register Wallet'])->first(); $income_admin->balance = $income_admin->balance + $s_register; $income_admin->save(); HistoryTransaction::create([ 'balance_id'=>$income_admin->id, 'from_id'=>$user_id, 'to_id'=>1, 'amount'=> $s_register, 'description'=> 'Investment '.number_format($amount).' from '.ucfirst($user->username).' to '.ucfirst($new_user->username), 'status'=> 1, 'type'=> 'IN' ]); } if($s_dinasty > 0){ $credit->balance = $credit->balance - $s_dinasty; $credit->save(); HistoryTransaction::create([ 'balance_id'=>$credit->id, 'from_id'=>$user_id, 'to_id'=>1, 'amount'=> $s_dinasty, 'description'=> 'Purchase Plan '.$package->name.' to '.ucfirst($new_user->username), 'status'=> 1, 'type'=> 'OUT' ]); $credit_admin = Balance::where(['user_id'=>1,'description'=>'Trustme Coin'])->first(); $credit_admin->balance = $credit_admin->balance + $s_dinasty; $credit_admin->save(); HistoryTransaction::create([ 'balance_id'=>$credit_admin->id, 'from_id'=>$user_id, 'to_id'=>1, 'amount'=> $s_dinasty, 'description'=> 'Purchase Plan '.$package->name.' from '.ucfirst($user->username).' to '.ucfirst($new_user->username), 'status'=> 1, 'type'=> 'IN' ]); } $this->bonus_sponsor($user_id,$amount); $request->session()->flash('success', 'Successfully Purchase Package to '.ucfirst($new_user->username)); }else{ $request->session()->flash('failed', 'Failed, You do not have enough funds to Purchase Package'); } }else{ $request->session()->flash('failed', 'Failed, Please buy the package first to add members.'); } return redirect()->back(); } public function register_byadmin(Request $request) { $this->validate($request, [ 'amount'=>'required|numeric|gte:10', 'username'=>'required', 'security_password'=>'<PASSWORD>' ]); $package_id = 1; $password = $request->security_password; $username = $request->username; $package = Package::find($package_id); $amount = $request->amount; $max = $package->max_profit; $max_profit = $amount * $max; $users = Auth::user(); $hasPassword = Hash::check($password,$users->trx_password); if($hasPassword){ $user = User::where('username',$username)->first(); if($user){ $wallet = Auth::user()->balance()->where('description','Register Wallet')->first(); if($amount <= $wallet->balance){ $upline = User::with('program')->has('program')->where('id',$user->parent_id)->first(); if($upline){ $check = Program::where(['user_id'=>$user->id,'registered_by'=>0])->first(); if(is_null($check)){ Program::create([ 'user_id' => $user->id, 'package_id' => $package->id, 'amount' => $amount, 'register' => $amount, 'dinasty' => 0, 'max_profit' => $max_profit, 'status' => 2, 'registered_by' => 0, 'description' => 'Investment '.number_format($amount) ]); $wallet->balance = $wallet->balance - $amount; $wallet->save(); HistoryTransaction::create([ 'balance_id'=> $wallet->id, 'from_id'=> Auth::user()->id, 'to_id'=> 1, 'amount'=> $amount, 'description'=> 'Investment '.number_format($amount).' to '.ucfirst($username), 'status'=> 1, 'type'=> 'OUT' ]); $wallet_admin = Balance::where(['user_id'=>1,'description'=>'Register Wallet'])->first(); $wallet_admin->balance = $wallet_admin->balance + $amount; $wallet_admin->save(); HistoryTransaction::create([ 'balance_id' => $wallet_admin->id, 'from_id' => Auth::user()->id, 'to_id' => 1, 'amount' => $amount, 'description' => 'Investment '.number_format($amount).' from '.ucfirst($username), 'status' => 1, 'type' => 'IN' ]); $request->session()->flash('success', 'Successfully, Investment '.number_format($amount).' for '.$username); }else{ $request->session()->flash('failed', 'Failed, Investment only once.'); } }else{ $request->session()->flash('failed', 'Failed, Referal has not yet registered package'); } }else{ $request->session()->flash('failed', 'Failed, Register Wallet not enough to register package.'); } }else{ $request->session()->flash('failed', 'Failed, Username not found.'); } }else { $request->session()->flash('failed', 'Failed, security password is wrong.'); } return redirect()->back(); } public function bonus_sponsor($user_id,$amount) { $uplines = Downline::whereNotIn('user_id',[1,2])->where('downline_id',$user_id)->limit(12)->get(); foreach ($uplines as $key => $value) { $levelSponsor = ++$key; $upline_id = $value->user_id; $cek_program = Program::where(['user_id'=>$upline_id]) ->whereIn('status',[0,2])->orderBy('id','desc')->first(); if($cek_program){ // $percent = 0; // $nameLevel = ''; $percentSponsor = LevelSponsor::where('id',$levelSponsor)->first(); if($percentSponsor){ $percent = $percentSponsor->percent; $nameLevel = $percentSponsor->name; $composition = Composition::where('name','Bonus Active')->first(); $bonus = $amount * $percent; $user = User::find($upline_id); $max300 = $user->is_max($bonus); if($max300['max_profit']){ $bonus = $max300['bonus']; if($bonus > 0){ $lost = $max300['lost']; BonusActive::create([ 'user_id' => $upline_id, 'from_id' => $user_id, 'amount' => $amount, 'percent' => $percent, 'bonus' => $bonus, 'lost' => $lost, 'status' => 1, 'description' => 'Bonus Sponsor '.$nameLevel ]); $bonus_satu = $bonus * $composition->one; if($bonus_satu > 0){ $wallet_a1 = Balance::where(['user_id' => 1, 'description' => 'USD Wallet'])->first(); $wallet_a1->balance = $wallet_a1->balance - $bonus_satu; $wallet_a1->save(); $history = HistoryTransaction::create([ 'balance_id'=> $wallet_a1->id, 'from_id'=> 1, 'to_id'=> $upline_id, 'amount'=> $bonus_satu, 'description'=> 'Bonus Sponsor '.$nameLevel.' USD Wallet to '.ucfirst($user->username), 'status'=> 1, 'type'=> 'OUT' ]); $wallet_satu = $user->balance()->where('description','USD Wallet')->first(); $wallet_satu->balance = $wallet_satu->balance + $bonus_satu; $wallet_satu->save(); $history = HistoryTransaction::create([ 'balance_id'=> $wallet_satu->id, 'from_id'=> $user_id, 'to_id'=> $upline_id, 'amount'=> $bonus_satu, 'description'=> 'Bonus Sponsor '.$nameLevel.' USD Wallet', 'status'=> 1, 'type'=> 'IN' ]); } } } } } } } public function profit_capital(Request $request,$type,$desc,$id) { $program = Program::find($id); if($type == 'profit'){ if($desc == 'run'){ $status = 0; $activity = 'Running Profit Username '.ucfirst($program->user->username); }elseif($desc == 'stop'){ $status = 2; $activity = 'Stop Profit Username '.ucfirst($program->user->username); } $program->status = $status; } $program->save(); LogActivity::create([ 'user_id' => Auth::user()->id, 'activity' => $activity.' with Program ID => '.$id, 'status' => 1 ]); $request->session()->flash('success', 'Successfully, '.$activity); return Response::json(['success'=>1]); } public function history(Request $request) { $data = Auth::user()->program() ->orderBy('id','desc') ->paginate(20); $total = Auth::user()->program() ->sum('amount'); $total_max = Auth::user()->program() ->sum('max_profit'); return view('backend.program.history',compact('data','total','total_max'))->with('i', (request()->input('page', 1) - 1) * 20); } public function list_program(Request $request,$regby) { $search = $request->search; $status = $request->status; $from_date = str_replace('/', '-', $request->from_date); $to_date = str_replace('/', '-', $request->to_date); if($from_date && $to_date){ $from = date('Y-m-d',strtotime($from_date)); $to = date('Y-m-d',strtotime($to_date)); }else{ $from = date('Y-m-d',strtotime('01/01/2018')); $to = date('Y-m-d'); $from_date = '01/01/2018'; $to_date = date('d/m/Y'); } $by = '!='; $active = 'list_package_member'; if($regby == 'admin'){ $by = '='; $active = 'list_package_admin'; } $whereIn = [0,1,2]; if($status == 1){ $whereIn = [0]; }elseif($status == 2){ $whereIn = [1]; }elseif($status == 3){ $whereIn = [2]; } $data = Program::where('user_id','!=',2) ->when($search, function ($query) use ($search){ $query->whereHas('user', function ($cari) use ($search){ $cari->where('users.username','like','%$search%'); }); }) ->when($status, function ($query) use ($whereIn){ $query->whereHas('receiver', function ($cari) use ($whereIn){ $cari->whereIn('receivers.status',$whereIn); }); }) ->where('registered_by',$by,0) ->whereDate('created_at','>=',$from) ->whereDate('created_at','<=',$to) ->orderBy('id','desc') ->paginate(20); $total_usd = Program::where('user_id','!=',2) ->when($search, function ($query) use ($search){ $query->whereHas('user', function ($cari) use ($search){ $cari->where('users.username','like','%$search%'); }); }) ->when($status, function ($query) use ($whereIn){ $query->whereHas('receiver', function ($cari) use ($whereIn){ $cari->whereIn('receivers.status',$whereIn); }); }) ->where('registered_by',$by,0) ->whereDate('created_at','>=',$from) ->whereDate('created_at','<=',$to) ->sum('amount'); $total_profit = Program::where('user_id','!=',2) ->when($search, function ($query) use ($search){ $query->whereHas('user', function ($cari) use ($search){ $cari->where('users.username','like','%$search%'); }); }) ->when($status, function ($query) use ($whereIn){ $query->whereHas('receiver', function ($cari) use ($whereIn){ $cari->whereIn('receivers.status',$whereIn); }); }) ->where('registered_by',$by,0) ->whereDate('created_at','>=',$from) ->whereDate('created_at','<=',$to) ->sum('max_profit'); $hal = 'member'; return view('backend.program.list_program',compact('data','from_date','to_date','search','total_usd','hal','regby','active','status','total_profit'))->with('i', (request()->input('page', 1) - 1) * 20); } public function generateCode() { return substr(str_shuffle(str_repeat('0123456789',10)),0,3); } public function saveDownline($user_id, $upline_id) { $upline = $upline_id; Downline::create([ 'user_id' => $upline, 'downline_id' => $user_id, 'status' => 1 ]); for($i = 1; $i <= 5000; $i++){ $upline = $this->downlines($upline,$user_id); if(is_null($upline)){ break; }else{ $upline = $upline; } } } public function downlines($upline_id,$user_id) { $check_downline = Downline::where('downline_id',$upline_id)->orderBy('id','asc')->first(); if($check_downline){ $upline = $check_downline->user_id; Downline::create([ 'user_id' => $upline, 'downline_id' => $user_id, 'status' => 1 ]); }else{ $upline = null; } return $upline; } }
0.996094
high
resources/views/backend/layouts/partials/footer.blade.php
srmiltonkhan/UserRoleManagement
0
372
<!-- footer area start--> <footer> <div class="footer-area"> <p>© Copyright 2018. All right reserved. Template by <a href="https://colorlib.com/wp/">Colorlib</a>.</p> </div> </footer> <!-- footer area end-->
0.65625
high
web/src/classes/Page/PageSession/PageSessionEdit.php
DavidSouthgate/omcrs-web
1
388
<?php class PageSessionEdit extends PageSession { public static function question($sessionIdentifier) { $config = Flight::get("config"); header("Location: " . $config["baseUrl"] . "session/$sessionIdentifier/edit/"); die(); } public static function edit($sessionIdentifier) { /** * Setup basic session variables (Type hinting below to avoid IDE error messages) * @var $templates League\Plates\Engine * @var $data array * @var $config array * @var $user User * @var $mysqli mysqli * @var $session Session */ extract(self::setup($sessionIdentifier)); // Add to session history DatabaseSessionHistory::insert($user, $session, $mysqli); // Setup Page breadcrumbs $breadcrumbs = new Breadcrumb(); $breadcrumbs->addItem($config["title"], $config["baseUrl"]); $breadcrumbs->addItem("Sessions", $config["baseUrl"]."session/"); $breadcrumbs->addItem(($session->getTitle() ? $session->getTitle() : "Session") . " (#$sessionIdentifier) " . "Edit"); $sessionID = DatabaseSessionIdentifier::loadSessionID($sessionIdentifier, $mysqli); // Load questions from the database $questions = DatabaseSessionQuestion::loadSessionQuestions($sessionID, $mysqli); $data["session"] = $session; $data["questions"] = $questions; $data["breadcrumbs"] = $breadcrumbs; $data["user"] = $user; echo $templates->render("session/edit/edit", $data); } public static function ajax($sessionIdentifier) { /** * Setup basic session variables (Type hinting below to avoid IDE error messages) * @var $templates League\Plates\Engine * @var $data array * @var $config array * @var $user User * @var $mysqli mysqli * @var $session Session */ extract(self::setup($sessionIdentifier)); $sessionID = DatabaseSessionIdentifier::loadSessionID($sessionIdentifier, $mysqli); // Load questions from the database $questions = DatabaseSessionQuestion::loadSessionQuestions($sessionID, $mysqli); $data["session"] = $session; $data["questions"] = $questions; echo $templates->render("session/edit/questions/list", $data); } /** * Loads basic variables ensuring correct permissions. (I.e. User is logged in and that they can edit this session) * @param $sessionIdentifier * @return array */ protected static function setup($sessionIdentifier) { $templates = Flight::get("templates"); $data = Flight::get("data"); $config = Flight::get("config"); // Ensure the user is logged in $user = Page::ensureUserLoggedIn($config); // Connect to database $databaseConnect = Flight::get("databaseConnect"); $mysqli = $databaseConnect(); $sessionID = DatabaseSessionIdentifier::loadSessionID($sessionIdentifier, $mysqli); // If invalid session identifier, display 404 if($sessionID === null) { PageError::error404(); die(); } // Loads the session $session = DatabaseSession::loadSession($sessionID, $mysqli); $session->setSessionIdentifier($sessionIdentifier); // If this session does not exist or the user cannot edit this session, go home if($session==null || !$session->checkIfUserCanEdit($user)) { header("Location: " . $config["baseUrl"]); die(); } return [ "templates" => $templates, "data" => $data, "config" => $config, "user" => $user, "mysqli" => $mysqli, "session" => $session, ]; } }
0.996094
high
app/Http/Controllers/AtdController.php
icodetheworld/MCA
0
404
<filename>app/Http/Controllers/AtdController.php<gh_stars>0 <?php namespace App\Http\Controllers; use Illuminate\Http\Request; use DB; use Carbon\carbon; class AtdController extends Controller { public function index(){ $data=DB::table('room')->orderby('class')->get(); return view('admin.attendance.all')->with('data',$data); } public function class(Request $request){ $data=DB::table('students')->where('room',$request->input('class'))->get(); $date=$request->input('date'); $check=DB::table('atd_room')->where('room_id',$request->input('class'))->where('day',$request->input('date'))->first(); if($check==null) return view('admin.attendance.add')->with('data',$data)->with('date',$date)->with('state','add')->with('room',$request->input('class')); else{ $atd=DB::table('attendance')->where('day',$request->input('date'))->where('room',$request->input('class'))->get(); return view('admin.attendance.add')->with('data',$atd)->with('date',$date)->with('state','edit')->with('room',$request->input('class')); } } public function add(Request $request){ $data=DB::table('students')->where('room',$request->input('class'))->get(); $date=$request->input('date'); $state=$request->input('state'); $room=$request->input('class'); if($state=='add'){ DB::transaction(function() use($room,$date,$data,$request){ DB::table('atd_room')->insert([ 'room_id' => $request->input('class'), 'day' => $date, ]); foreach($data as $item){ DB::table('attendance')->insert([ 'stud_id' => $item->id, 'state' => $request->input($item->id), 'day' => $request->input('date'), 'room' => $room, ]); } }); return redirect('/attendance'); }elseif($state=='edit'){ DB::transaction(function() use($room,$date,$data,$request){ foreach($data as $item){ DB::table('attendance')->where('stud_id',$item->id)->where('day',$date)->where('room',$room)->update([ 'state' => $request->input($item->id) ]);} }); return redirect('/attendance'); }else{ echo "error"; } } public function view_all(){ $data=DB::table('room')->orderby('class')->get(); $abs=DB::table('attendance')->where('state','on')->where('day',Carbon::now()->toDateString())->orderby('room')->get(); return view('admin.attendance.class')->with('stat',1)->with('data',$data)->with('abs',$abs); } public function view(Request $request){ $start = new Carbon('first day of this month'); $data=DB::table('attendance')->where('room',$request->input('class'))->where('day',$request->input('date'))->where('state','on')->get(); return view('admin.attendance.class')->with('stat',0)->with('data',$data)->with('date',$request->input('date'))->with('room',$request->input('class')); } public function sms(){ $abs=DB::table('attendance')->where('state','on')->where('sms',0)->where('day',Carbon::now()->toDateString())->orderby('room')->get(); foreach($abs as $item){ DB::transaction(function() use($item){ $stud=DB::table('students')->where('id',$item->stud_id)->first(); $name=$stud->f_name.' '.$stud->l_name; $date=Carbon::now()->toDateString(); $phone=$stud->phone; $message=$name.' is absent for the day '.$date.'. Thank you '; $url='http://www.way2sms.com/api/v1/sendCampaign/?apikey=F0V1JHSDJVKWXXO3498MA9TYCG7AZHPM&secret=4UVZVBT0CU9286U9&usetype=prod&senderid=CEMSED&phone='.urlencode($phone).'&message='.urlencode($message); $json = file_get_contents($url); $object=json_decode($json); if($object->code=='200 OK') { DB::table('attendance')->where('id',$item->id)->update([ 'sms' => '1', ]); DB::table('settings')->where('field','sms_bal')->update([ 'value' => $object->balacne, ]); } }); } return back(); } public function bday(){ $t=Carbon::now()->toDateString(); $day=date('d',strtotime($t)); $month=date('m',strtotime($t)); $data=DB::table('bday')->where('day',$day)->where('month',$month)->get(); foreach($data as $item) { DB::transaction(function() use($item){ $message='Happy Birthday '.$item->name; $url='http://www.way2sms.com/api/v1/sendCampaign/?apikey=F0V1JHSDJVKWXXO3498MA9TYCG7AZHPM&secret=4UVZVBT0CU9286U9&usetype=prod&senderid=CEMSED&phone='.urlencode($item->phone).'&message='.urlencode($message); $json = file_get_contents($url); $object=json_decode($json); if($object->code=='200 OK'){ DB::table('bday')->where('id',$item->id)->update([ 'wished' => Carbon::now()->toDateTimeString(), ]); echo "success"; DB::table('settings')->where('field','sms_bal')->update([ 'value' => $object->balacne, ]); } }); } } }
0.988281
high
app/Admin/Actions/Post/OrderRefundAction.php
zhouhaogoal123/sanmu-newshop
125
420
<?php namespace App\Admin\Actions\Post; use App\Enums\OrderShipStatusEnum; use App\Enums\OrderStatusEnum; use App\Models\Order; use App\Models\User; use Encore\Admin\Actions\RowAction; use Illuminate\Database\Eloquent\Model; use Illuminate\Http\Request; use Yansongda\Pay\Pay; class OrderRefundAction extends RowAction { public $name = '退款'; public function handle(Order $order, Request $request) { // 订单必须申请支付了,才可才可以退款 if ($order->status != OrderStatusEnum::APPLY_REFUND) { return $this->response()->error('订单当前状态禁止退款'); } $pay = Pay::alipay(config('pay.ali')); // 退款数据 $refundData = [ 'out_trade_no' => $order->no, 'trade_no' => $order->pay_no, 'refund_amount' => $order->pay_amount, 'refund_reason' => '正常退款', ]; try { // 将订单状态改为退款 $response = $pay->refund($refundData); $order->pay_refund_fee = $response->get('refund_fee'); $order->pay_trade_no = $response->get('trade_no'); $order->status = OrderStatusEnum::REFUND; $order->save(); } catch (\Exception $e) { // 调用异常的处理 // abort(500, $e->getMessage()); return $this->response()->error('服务器异常,请稍后再试'); } return $this->response()->success('退款成功.')->refresh(); } public function dialog() { $this->confirm('退款会直接把钱退回到支付账户,是否继续'); } }
0.96875
high
resources/views/about.blade.php
jingling0101/website
0
436
<filename>resources/views/about.blade.php<gh_stars>0 <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>{{ $website['name'] }}</title> <meta name="keywords" content="{{ $website['key_words'] }}"/> <meta name="description" content="{{ $website['meta_description'] }}"/> <link type="text/css" href="./css/reset.css" rel="stylesheet"> <link type="text/css" href="./css/index.css" rel="stylesheet"> <link type="text/css" href="./css/about.css" rel="stylesheet"> <!--<link type="text/css" href="./css/swiper-3.4.2.min.css" rel="stylesheet">--> </head> <body> <div class="header-wrapper"> <div class="header-t"> <div class="logo"><img height="150" width="150" src="/img/logo.png" /></div> <div class="nav"> <ul class="nav-list"> <li><a href="index">首页</a></li> <li><a href="products">施工设备</a></li> <li><a href="news">工程案例</a></li> <li><a href="about">关于我们</a></li> </ul> </div> </div> </div> <div class="qq"> <a target="_blank" href="http://wpa.qq.com/msgrd?v=3&uin=621019457&site=qq&menu=yes"><img border="0" src="http://wpa.qq.com/pa?p=2:621019457:53" alt="业务咨询"/></a> </div> <div class="pic"> <img width="100%" height="100%" src="/img/pro/banner1.jpg"/> </div> <div class="all-width h-b-120 tel"> <div></div> </div> <div class="clear"></div> <div class="main-wrapper"> <div class="us"> <div class="us-div us-l"> <img class="us-img" height="300px" src="../img/pro/news1.jpg"> </div> <div class="us-div us-con us-r"> <p class="us-title"><span class="p-red us-red">关于我们</span> / about</p> <p> {{ $website['about_us'] }} </p> </div> </div> <div class="us"> <div class="us-div us-con ps-r"> <p class="us-title"><span class="p-red us-red">承接</span> / service</p> <p> {{ $website['about_ser'] }} </p> </div> <div class="us-div ps-l"> <img class="ps-img" height="300px" src="../img/pro/news2.jpg"> </div> </div> <div class="clear"></div> </div> @include('footer.footer') </body> <script src="//cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script> <script src="//cdn.bootcss.com/jquery-easing/1.4.1/jquery.easing.min.js"></script> <script> var usl = $('.us-l'); var usr = $('.us-r'); var psl = $('.ps-l'); var psr = $('.ps-r'); var conL = $('.contact-l'); var conC = $('.contact-c'); var conR = $('.contact-r'); moveEle(conR); moveEle2(conC, conL); moveEle2(usl, usr); moveEle(psl); setTimeout("moveEle(psr)", 600); function moveEle(ele) { if ($(window).scrollTop() + $(window).height() >= ele.offset().top) { ele.animate({left: '0px', opacity: '1'}, 1200, 'easeInOutBack', function () { console.log('11') }); } } function moveEle2(ele, ele2) { if ($(window).scrollTop() + $(window).height() >= ele.offset().top) { ele.animate({left: '0px', opacity: '1'}, 800, 'easeInOutBack', function () { ele2.show(); moveEle(ele2); }); } } function moveEle3(ele, ele2, ele3) { if ($(window).scrollTop() + $(window).height() >= ele.offset().top) { ele.animate({left: '0px', opacity: '1'}, 800, 'easeInOutBounce', function () { ele2.animate({left: '0px', opacity: '1'}, 800, 'easeInOutBounce', function () { ele3.animate({left: '0px', opacity: '1'}, 800, 'easeInOutBounce', function () { }); }); }); } } $(window).scroll(function () { moveEle2(usl, usr); moveEle(psl); moveEle(conR); moveEle2(conC, conL); setTimeout("moveEle(psr)", 600); }) </script> </html>
0.941406
high
app/yellowpage/controllers/SearchController.php
leonlaf66/househub
0
452
<?php namespace module\yellowpage\controllers; use WS; use module\core\models as coreModel; class SearchController extends \yii\web\Controller { const SORT_VAR = 'sort'; const CITY_FILTER_VAR = 'city'; public function actionResult($type=null, $city=null, $sort=null, $dir='') { $collection = \models\YellowPage::find() ->where([ 'area_id' => WS::$app->area->id ]); if($type) { $typeId = intval($type); $collection->innerJoinWith([ 'type'=>function($query) use($typeId) { $query->where('type_id='.$typeId); } ]); } if($city) { $cityId = intval($city); $collection->innerJoinWith([ 'city'=>function($query) use($cityId) { $query->where('city_id='.$cityId); } ]); } $collection->distinct(); if($sort) { $dir = $dir === '1' ? 'ASC' : 'DESC'; switch ($sort) { case 'comments': $collection->orderBy('comments '.$dir); break; case 'rating': $collection->orderBy('rating '.$dir); break; case 'hits': $collection->orderBy('hits '.$dir); break; default: $collection->orderBy('weight '.$dir); break; } } $pages = new \yii\data\Pagination([ 'totalCount' =>$collection->count(), 'defaultPageSize'=>10, 'pageSizeLimit'=>false ]); $collection = $collection->offset($pages->offset)->limit($pages->limit)->all(); return $this->render('result.phtml', [ 'yellowPageCollection'=>$collection, 'pages'=>$pages, 'city'=>$city, 'sort'=>$sort ]); } public function createTypeUrl($typeId) { return \WS::$app->urlManager->createUrl(['/yellowpage/search/', 'type'=>$typeId]); } public function createViewUrl($id) { return \WS::$app->urlManager->createUrl(['/yellowpage/default/view', 'id'=>$id]); } public function createItemUrl($id) { return ''; } }
0.980469
high
app/View/Elements/tableLog.ctp
fabiang/internal-ldap-based-phonebook
6
468
<filename>app/View/Elements/tableLog.ctp <?php /** * This file is the view file of the application. Used for render * table of logs * * InternalPhonebook: Internal phone book based on content of Active Directory. * @copyright Copyright 2017-2019, <NAME>. * @license https://opensource.org/licenses/mit-license.php MIT License * @package app.View.Elements */ if (!isset($logs)) { $logs = []; } if (!isset($groupActions)) { $groupActions = []; } if (!isset($fieldsLabel)) { $fieldsLabel = []; } if (!isset($fieldsConfig)) { $fieldsConfig = []; } ?> <div class="table-responsive table-filter"> <?php echo $this->Filter->openFilterForm(true); ?> <table class="table table-hover table-striped table-condensed"> <thead> <?php $formInputs = [ 'Log.id' => [ 'label' => 'ID', 'disabled' => true, 'class-header' => 'action', 'not-use-input' => true ], 'User.' . CAKE_LDAP_LDAP_ATTRIBUTE_NAME => [ 'label' => __('Name of administrator'), 'class-header' => 'fit', 'style' => 'min-width: 180px' ], 'Employee.' . CAKE_LDAP_LDAP_ATTRIBUTE_NAME => [ 'label' => __('Name of employee'), 'class-header' => 'fit', 'style' => 'min-width: 180px' ], 'Log.data' => [ 'label' => __('Data of log'), 'disabled' => true ], 'Log.created' => [ 'label' => __('Created'), 'class-header' => 'fit', 'style' => 'min-width: 150px' ], ]; echo $this->Filter->createFilterForm($formInputs, null, true); ?> </thead> <?php if (!empty($logs)) : ?> <tfoot> <?php echo $this->Filter->createGroupActionControls($formInputs, $groupActions, true); ?> </tfoot> <?php endif; ?> <tbody> <?php foreach ($logs as $log) { $tableRow = []; $logData = $this->Html->tag('span', $this->Html->tag( 'strong', __('Data of log record is broken'), ['class' => 'text-danger'] )); $actions = $this->ViewExtension->buttonLink( 'fas fa-undo-alt', 'btn-warning', ['controller' => 'logs', 'action' => 'restore', $log['Log']['id']], [ 'title' => __('Restore data from log'), 'action-type' => 'confirm-post', 'data-confirm-msg' => __('Are you sure you wish to restore this data from log?') ] ) . $this->ViewExtension->buttonLink( 'fas fa-trash-alt', 'btn-danger', ['controller' => 'logs', 'action' => 'delete', $log['Log']['id']], [ 'title' => __('Delete record of log'), 'action-type' => 'confirm-post', 'data-confirm-msg' => __('Are you sure you wish to delete this record of log?') ] ); if (is_array($log['Log']['data'])) { $logData = $this->Html->div( null, $this->Html->div( 'pull-right', $this->ViewExtension->popupModalLink( '[+]', ['controller' => 'logs', 'action' => 'view', $log['Log']['id']] ) ) . $this->Html->div( 'pull-left', $this->Deferred->getDeferredInfo( $log['Log']['data']['changed']['EmployeeEdit'], [], $fieldsLabel, $fieldsConfig ) ) ); } $tableRow[] = [$this->Filter->createFilterRowCheckbox('Log.id', $log['Log']['id']), ['class' => 'action text-center']]; $tableRow[] = $this->ViewExtension->showEmpty( $log['User']['id'], $this->element('CakeLdap.infoEmployeeShort', ['employee' => ['Employee' => $log['User']]]) ); $tableRow[] = $this->element('CakeLdap.infoEmployeeShort', ['employee' => $log]); $tableRow[] = $logData; $tableRow[] = [ $this->ViewExtension->timeAgo($log['Log']['created']), ['class' => 'text-nowrap text-center'] ]; $tableRow[] = [$this->ViewExtension->showEmpty($actions), ['class' => 'action text-center']]; echo $this->Html->tableCells([$tableRow]); } ?> </tbody> </table> <?php echo $this->Filter->closeFilterForm(); echo $this->Html->div('confirm-form-block', $this->fetch('confirm-form')); ?> </div> <?php echo $this->ViewExtension->buttonsPaging();
0.984375
high
app/Models/Eng/HighTank.php
hlongjuice/stseafood
0
484
<reponame>hlongjuice/stseafood <?php namespace App\Models\Eng; use Illuminate\Database\Eloquent\Model; class HighTank extends Model { protected $table="eng_high_tank"; protected $fillable=['date','time_record','real_time_record','level','pump']; }
0.878906
high
README.md exists but content is empty. Use the Edit dataset card button to edit it.
Downloads last month
0
Edit dataset card