max_stars_repo_path
stringlengths 4
223
| max_stars_repo_name
stringlengths 6
110
| max_stars_count
int64 0
36.6k
| id
stringlengths 2
8
| content
stringlengths 8
1.03M
| score
float64 0.34
1
| label
stringclasses 3
values |
---|---|---|---|---|---|---|
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/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 |
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/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 |
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 |
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 |
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 |
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 |
src/Models/Helper/URLs.php | googleshokry/Glib | 0 | 548 | <?php
/**
* Created by PhpStorm.
* User: EngShokry
* Date: 6/6/18
* Time: 10:54 AM
*/
namespace Glib\Models\Helper;
use Glib\Models\BaseModel;
use Glib\Models\Contracts\Slugable;
class URLs
{
private $module;
private $slug;
public function __construct($module, $slug = null)
{
if (is_string($module) && !is_null($slug)) {
$this->$module = $module;
$this->slug = $slug;
} elseif ($module instanceof BaseModel && $module instanceof Slugable) {
$this->$module = str_plural($module->getTable());
$this->slug = $module->getSlug();
}
}
public function frontUrl()
{
return route("front.$this->module.details", ["slug" => $this->slug]);
}
} | 0.921875 | high |
resources/views/jobs/show.blade.php | mirkomilicic6/JobFinder | 0 | 612 | <reponame>mirkomilicic6/JobFinder
@extends('layouts.main')
@section('content')
<div class="album text-muted">
<div class="container">
@if(Session::has('message'))
<div class="alert alert-success">{{Session::get('message')}}</div>
@endif
@if(Session::has('err_message'))
<div class="alert alert-danger">{{Session::get('err_message')}}</div>
@endif
@if(isset($errors)&&count($errors)>0)
<div class="alert alert-danger">
<ul>
@foreach($errors->all() as $error)
<li>{{$error}}</li>
@endforeach
</ul>
</div>
@endif
<div class="row" id="app">
<div class="title" style="margin-top: 20px;">
<h2>{{$job->title}}</h2>
</div>
<img src="{{asset('hero-job-image.jpg')}}" style="width: 100%; border-radius: 5px;">
<div class="col-lg-8">
<div class="p-4 mb-8 bg-white">
<!-- icon-book mr-3-->
<h3 class="h5 text-black mb-3">Description <a href="#"data-toggle="modal" data-target="#exampleModal1"><i class="fa fa-envelope-square" style="font-size: 25px;float:right;color:green;"> Share job</i></a></h3>
<p> {{$job->description}}.</p>
</div>
<div class="p-4 mb-8 bg-white">
<!--icon-align-left mr-3-->
<h3 class="h5 text-black mb-3">Roles and Responsibilities</h3>
<p>{{$job->roles}} .</p>
</div>
<div class="p-4 mb-8 bg-white">
<h3 class="h5 text-black mb-3">Number of vacancy</h3>
<p>{{$job->number_of_vacancy }} </p>
</div>
<div class="p-4 mb-8 bg-white">
<h3 class="h5 text-black mb-3">Experience</h3>
<p>{{$job->experience}} years</p>
</div>
<div class="p-4 mb-8 bg-white">
<h3 class="h5 text-black mb-3">Gender</h3>
<p>{{$job->gender}} </p>
</div>
<div class="p-4 mb-8 bg-white">
<h3 class="h5 text-black mb-3">Salary</h3>
<p>{{$job->salary}}</p>
</div>
</div>
<div class="col-md-4 p-4 site-section bg-light">
<h3 class="h5 text-black mb-3 text-center"><b>Short Info</b></h3>
<p><b>Company name: </b>{{$job->company->company_name}}</p>
<p><b>Address: </b>{{$job->address}}</p>
<p><b>Employment Type: </b>{{$job->type}}</p>
<p><b>Position: </b>{{$job->position}}</p>
<p><b>Posted: </b>{{$job->created_at->diffForHumans()}}</p>
<p><b>Last date to apply: </b>{{ date('F d, Y', strtotime($job->last_date)) }}</p>
<p><a href="{{route('company.index',[$job->company->id,$job->company->slug])}}" class="btn btn-warning" style="width: 100%;">Visit Company Page</a></p>
<p>
@if(Auth::check()&&Auth::user()->user_type=='seeker')
@if(!$job->checkApplication())
<apply-component :jobid={{ $job->id }}></apply-component>
@endif
<br>
<favourite-component :jobid={{ $job->id }} :favourited={{ $job->checkSaved()?'true':'false' }}></favourite-component>
@endif
</p>
</div>
</div>
<div class="row mt-4">
<div class="col-md-12">
<div class="card">
<div class="card-header">Related jobs</div>
<div class="card-body">
<div class="row">
@foreach($jobRecommendations as $jobRecommendation)
<div class="col-md-4">
<div class="card" style="width: 18rem;">
<div class="card-body">
<p class="badge badge-success">{{$jobRecommendation->type}}</p>
<h5 class="card-title">{{$jobRecommendation->position}}</h5>
<p class="card-text">{{str_limit($jobRecommendation->description,90)}}
<center> <a href="{{route('jobs.show',[$jobRecommendation->id,$jobRecommendation->slug])}}" class="btn btn-success">Apply</a></center>
</div>
</div>
</div>
@endforeach
</div>
</div>
</div>
</div>
</div>
<!-- Modal -->
<div class="modal fade" id="exampleModal1" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel">Send this job to your friend</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<form action="{{ route('mail') }}" method="POST">@csrf
<div class="modal-body">
<input type="hidden" name="job_id" value="{{$job->id}}">
<input type="hidden" name="job_slug" value="{{$job->slug}}">
<div class="form-goup">
<label>Your name:</label>
<input type="text" name="your_name" class="form-control" required="">
</div>
<div class="form-goup">
<label>Your email:</label>
<input type="email" name="your_email" class="form-control" required="">
</div>
<div class="form-goup">
<label>Friend name:</label>
<input type="text" name="friend_name" class="form-control" required="">
</div>
<div class="form-goup">
<label>Friend email:</label>
<input type="email" name="friend_email" class="form-control" required="">
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
<button type="submit" class="btn btn-primary">Mail this job</button>
</div>
</form>
</div>
</div>
</div>
<br>
<br>
<br>
</div>
</div>
@endsection
{{--
<h3>Related jobs:</h3> <br>
@foreach($jobRecommendations as $jobRecommendation)
<div class="col-md-3">
<div class="card" style="width: 18rem;">
<div class="card-header">{{ __('My saved jobs') }}</div>
<div class="card-body">
<p class="badge badge-success">{{$jobRecommendation->type}}</p>
<h5 class="card-title">{{$jobRecommendation->position}}</h5>
<p class="card-text">{{str_limit($jobRecommendation->description,90)}}
<center> <a href="{{route('jobs.show',[$jobRecommendation->id,$jobRecommendation->slug])}}" class="btn btn-success">Apply</a></center>
</div>
</div>
</div>
@endforeach
--}}
| 0.894531 | high |
sphp/php/Sphp/Apps/Contact/ContactDataMailer.php | samhol/SPHP-framework | 1 | 676 | <reponame>samhol/SPHP-framework
<?php
/**
* SPHPlayground Framework (http://playgound.samiholck.com/)
*
* @link https://github.com/samhol/SPHP-framework for the source repository
* @copyright Copyright (c) 2007-2019 <NAME> <<EMAIL>>
* @license https://opensource.org/licenses/MIT The MIT License
*/
namespace Sphp\Apps\Contact;
use Laminas\Mail\Transport\Sendmail;
use Laminas\Mail\Address;
use Laminas\Mail\AddressList;
use Laminas\Mail\Message;
use Laminas\Mime\Message as MimeMessage;
use Laminas\Mime\Mime;
use Laminas\Mime\Part as MimePart;
use Sphp\Exceptions\InvalidArgumentException;
use Sphp\Html\Lists\Ul;
use Sphp\Html\Navigation\A;
/**
* Description of ContactDataMailer
*
* @author <NAME> <<EMAIL>>
* @license https://opensource.org/licenses/MIT MIT License
* @link https://github.com/samhol/SPHP-framework Github repository
* @filesource
*/
class ContactDataMailer {
/**
* @var string
*/
private $sender;
/**
* @var string[]
*/
private $receivers;
/**
* @var Sendmail
*/
private $mailer;
/**
* @var Address
*/
private $from;
/**
* @var AddressList
*/
private $to;
/**
* @var AddressList
*/
private $replyTo;
/**
* Constructs a new instance
*
* @param string $autoSender
* @param string[] $receivers
*/
public function __construct(iterable $autoSender = null, iterable $receivers = null) {
$this->sender = $autoSender;
$this->receivers = $receivers;
$this->from;
$this->to = new AddressList();
$this->mailer = new Sendmail();
}
public function __destruct() {
unset($this->mailer);
}
public function setFrom(string $email, string $name = null) {
$this->from = new Address($email, $name);
return $this;
}
public function addTo(string $email, string $name = null) {
$this->to->add(new Address($email, $name));
return $this;
}
public function addReplyTo(string $email, string $name = null) {
if ($this->replyTo === null) {
$this->replyTo = new AddressList();
}
$this->replyTo->add(new Address($email, $name));
return $this;
}
protected function createMessage(): Message {
$message = new Message();
$message->setFrom($this->from);
$message->setTo($this->to);
if ($this->replyTo !== null) {
$message->setReplyTo($this->replyTo);
}
$message->setEncoding('UTF-8');
return $message;
}
/**
*
* @param DataObject $data
* @return $this for a fluent interface
*/
public function sendMessage(DataObject $data) {
$message = $this->createMessage();
if ($data->email !== null) {
$message->setReplyTo(new Address($data->email, $data->name));
}
$message->setSubject('Yhteydenotto lomakkeen välityksellä')
->setBody($this->createMailBody($data));
$contentTypeHeader = $message->getHeaders()->get('Content-Type');
$contentTypeHeader->setType('multipart/alternative');
if (!$message->isValid()) {
throw new InvalidArgumentException('Invalid contact data');
}
$this->mailer->send($message);
return $this;
}
/**
*
* @param DataObject $data
* @return $this for a fluent interface
*/
public function replyTo(DataObject $data) {
$this->getMessage()->setFrom($this->sender);
$this->getMessage()->addTo($data->getReceiver());
$this->getMessage()->setSubject("Thank you for your message");
$this->getMessage()->setBody('I <strong>will get back to you as soon as possible</strong>');
$this->getMessage()->setEncoding('UTF-8');
$this->send();
return $this;
}
protected function createMailBody(DataObject $data): MimeMessage {
$body = new MimeMessage();
$body->setParts([$this->createMailBodyText($data), $this->createMailBodyHtml($data)]);
return $body;
}
/**
*
* @param DataObject $data
* @return MimePart mail body as plain text
*/
protected function createMailBodyText(DataObject $data): MimePart {
$text = "Viestin lähettäjän yhteystiedot\n";
//$text .= "\nHUOM: Vastaa aina asiakkaan sähköpostiin äläkä lomakkeeseen!!\n";
$text .= " Nimi: {$data['name']}\n";
$text .= " Sähköpostiosoite: {$data->email}\n";
if ($data->phone !== null) {
$text .= " Puhelinnumero: {$data->phone}\n";
}
if ($data->message !== null) {
$text .= "-----\n";
$text .= "Viesti:\n\n {$data->message}\n";
}
$mime = new MimePart($text);
$mime->type = Mime::TYPE_TEXT;
$mime->charset = 'utf-8';
$mime->encoding = Mime::ENCODING_QUOTEDPRINTABLE;
return $mime;
}
/**
*
* @param DataObject $data
* @return MimePart mail body as HTML
*/
protected function createMailBodyHtml(DataObject $data): MimePart {
$mailBody = '<html><body>';
$mailBody .= "<h1>Viestin tiedot</h1>";
$mailBody .= '<h2>Viestin lähettäjän yhteystiedot</h2>';
$mailBody .= $this->personToHtml($data);
if ($data->message !== null) {
$mailBody .= '<h2>Viesti</h2>';
$mailBody .= "<pre>$data->message</pre>";
}
$mailBody .= '</body></html>';
$html = new MimePart($mailBody);
$html->setType(Mime::TYPE_HTML);
$html->setCharset('utf-8');
$html->setEncoding(Mime::ENCODING_QUOTEDPRINTABLE);
return $html;
}
/**
*
* @param DataObject $data
* @return string personal data as HTML
*/
protected function personToHtml(DataObject $data): string {
$ul = new Ul;
$ul->addCssClass('form-data');
$ul->append("<strong>Nimi:</strong> $data->name");
$emailLink = new A("mailto:$data->email", $data->email);
$ul->append("<strong>Sähköpostiosoite:</strong> $emailLink");
if ($data->phone !== null) {
$phoneLink = new A("tel:$data->phone", $data->phone);
$ul->append("<strong>Puhelinnumero:</strong> $phoneLink");
}
return $ul->getHtml();
}
}
| 0.996094 | high |
read.php | study-hary-id/UsersManagement | 0 | 740 | <?php
// Initialize the session.
session_start();
// Check if the user is logged in, if not then redirect to login page.
if (!isset($_SESSION["loggedin"]) || $_SESSION["loggedin"] !== true) {
header("location: login.php");
exit;
}
// Check existence of id parameter before processing further
if (isset($_GET["id"]) && !empty(trim($_GET["id"]))) {
// Include config file
require_once "config.php";
// Prepare a select statement
$sql = "SELECT * FROM users WHERE id = ?";
if ($stmt = mysqli_prepare($link, $sql)) {
// Bind variables to the prepared statement as parameters
mysqli_stmt_bind_param($stmt, "i", $param_id);
// Set parameters
$param_id = trim($_GET["id"]);
// Attempt to execute the prepared statement
if (mysqli_stmt_execute($stmt)) {
$result = mysqli_stmt_get_result($stmt);
if (mysqli_num_rows($result) == 1) {
/* Fetch result row as an associative array. Since the result set
contains only one row, we don't need to use while loop */
$row = mysqli_fetch_array($result, MYSQLI_ASSOC);
// Retrieve individual field value
$email = $row["email"];
$username = $row["username"];
$full_name = $row["full_name"];
$address = $row["address"];
$salary = $row["salary"];
$phone_number = $row["phone_number"];
} else {
// URL doesn't match with the database. Redirect to error page
header("location: error.php");
exit();
}
} else{
echo "Oops! Something went wrong. Please try again later.";
}
// Close statement
mysqli_stmt_close($stmt);
}
// Close connection
mysqli_close($link);
} else{
// URL doesn't contain id parameter. Redirect to error page
header("location: error.php");
exit();
}
require_once "header.php";
?>
<body>
<div class="container">
<h1 class="my-5 text-center">View Record</h1>
<div class="card-deck mb-3">
<div class="card mb-4 shadow-sm">
<div class="card-header text-center">
<h4 class="my-0 font-weight-normal">
User Details - <?php echo $row["id"] ?>
</h4>
</div>
<div class="card-body">
<div class="form-row">
<div class="col-sm form-group">
<label>Username</label>
<p><b><?php echo $username; ?></b></p>
</div>
<div class="col-sm form-group">
<label>Fullname</label>
<p><b><?php echo $full_name; ?></b></p>
</div>
</div>
<div class="form-row">
<div class="col-sm form-group">
<label>Email</label>
<p><b><?php echo $email; ?></b></p>
</div>
<div class="col-sm form-group">
<label>Address</label>
<p><b><?php echo $address; ?></b></p>
</div>
</div>
<div class="form-row">
<div class="col-sm form-group">
<label>Salary</label>
<p><b><?php echo $salary; ?></b></p>
</div>
<div class="col-sm form-group">
<label>Phone Number</label>
<p><b><?php echo $phone_number; ?></b></p>
</div>
</div>
<p class="text-center">
<a
href="welcome.php"
class="btn btn-block btn-outline-primary"
>Back</a>
</p>
</div>
</div>
</div>
</div>
</body>
</html> | 0.988281 | high |
tests/model/ImageTest.php | ntd/sapphire | 3 | 804 | <reponame>ntd/sapphire
<?php
/**
* @package framework
* @subpackage tests
*/
class ImageTest extends SapphireTest {
protected static $fixture_file = 'ImageTest.yml';
protected $origBackend;
public function setUp() {
if(get_class($this) == "ImageTest") $this->skipTest = true;
parent::setUp();
$this->origBackend = Image::get_backend();
if($this->skipTest)
return;
if(!file_exists(ASSETS_PATH)) mkdir(ASSETS_PATH);
// Create a test folders for each of the fixture references
$folderIDs = $this->allFixtureIDs('Folder');
foreach($folderIDs as $folderID) {
$folder = DataObject::get_by_id('Folder', $folderID);
if(!file_exists(BASE_PATH."/$folder->Filename")) mkdir(BASE_PATH."/$folder->Filename");
}
// Copy test images for each of the fixture references
$imageIDs = $this->allFixtureIDs('Image');
foreach($imageIDs as $imageID) {
$image = DataObject::get_by_id('Image', $imageID);
$filePath = BASE_PATH."/$image->Filename";
$sourcePath = str_replace('assets/ImageTest/', 'framework/tests/model/testimages/', $filePath);
if(!file_exists($filePath)) {
if (!copy($sourcePath, $filePath)) user_error('Failed to copy test images', E_USER_ERROR);
}
}
}
public function tearDown() {
if($this->origBackend) Image::set_backend($this->origBackend);
// Remove the test files that we've created
$fileIDs = $this->allFixtureIDs('Image');
foreach($fileIDs as $fileID) {
$file = DataObject::get_by_id('Image', $fileID);
if($file && file_exists(BASE_PATH."/$file->Filename")) unlink(BASE_PATH."/$file->Filename");
}
// Remove the test folders that we've created
$folderIDs = $this->allFixtureIDs('Folder');
foreach($folderIDs as $folderID) {
$folder = DataObject::get_by_id('Folder', $folderID);
if($folder && file_exists(BASE_PATH."/$folder->Filename")) {
Filesystem::removeFolder(BASE_PATH."/$folder->Filename");
}
if($folder && file_exists(BASE_PATH."/".$folder->Filename."_resampled")) {
Filesystem::removeFolder(BASE_PATH."/".$folder->Filename."_resampled");
}
}
parent::tearDown();
}
public function testGetTagWithTitle() {
$image = $this->objFromFixture('Image', 'imageWithTitle');
$expected = '<img src="' . Director::baseUrl()
. 'assets/ImageTest/test_image.png" alt="This is a image Title" />';
$actual = $image->getTag();
$this->assertEquals($expected, $actual);
}
public function testGetTagWithoutTitle() {
$image = $this->objFromFixture('Image', 'imageWithoutTitle');
$expected = '<img src="' . Director::baseUrl() . 'assets/ImageTest/test_image.png" alt="test_image" />';
$actual = $image->getTag();
$this->assertEquals($expected, $actual);
}
public function testGetTagWithoutTitleContainingDots() {
$image = $this->objFromFixture('Image', 'imageWithoutTitleContainingDots');
$expected = '<img src="' . Director::baseUrl()
. 'assets/ImageTest/test.image.with.dots.png" alt="test.image.with.dots" />';
$actual = $image->getTag();
$this->assertEquals($expected, $actual);
}
/**
* Tests that multiple image manipulations may be performed on a single Image
*/
public function testMultipleGenerateManipulationCalls() {
$image = $this->objFromFixture('Image', 'imageWithoutTitle');
$imageFirst = $image->ScaleWidth(200);
$this->assertNotNull($imageFirst);
$expected = 200;
$actual = $imageFirst->getWidth();
$this->assertEquals($expected, $actual);
$imageSecond = $imageFirst->setHeight(100);
$this->assertNotNull($imageSecond);
$expected = 100;
$actual = $imageSecond->getHeight();
$this->assertEquals($expected, $actual);
}
/**
* Tests that image manipulations that do not affect the resulting dimensions
* of the output image do not resample the file.
*/
public function testReluctanceToResampling() {
$image = $this->objFromFixture('Image', 'imageWithoutTitle');
$this->assertTrue($image->isSize(300, 300));
// Set width to 300 pixels
$imageScaleWidth = $image->ScaleWidth(300);
$this->assertEquals($imageScaleWidth->getWidth(), 300);
$this->assertEquals($image->Filename, $imageScaleWidth->Filename);
// Set height to 300 pixels
$imageScaleHeight = $image->ScaleHeight(300);
$this->assertEquals($imageScaleHeight->getHeight(), 300);
$this->assertEquals($image->Filename, $imageScaleHeight->Filename);
// Crop image to 300 x 300
$imageCropped = $image->Fill(300, 300);
$this->assertTrue($imageCropped->isSize(300, 300));
$this->assertEquals($image->Filename, $imageCropped->Filename);
// Resize (padded) to 300 x 300
$imageSized = $image->Pad(300, 300);
$this->assertTrue($imageSized->isSize(300, 300));
$this->assertEquals($image->Filename, $imageSized->Filename);
// Padded image 300 x 300 (same as above)
$imagePadded = $image->Pad(300, 300);
$this->assertTrue($imagePadded->isSize(300, 300));
$this->assertEquals($image->Filename, $imagePadded->Filename);
// Resized (stretched) to 300 x 300
$imageStretched = $image->ResizedImage(300, 300);
$this->assertTrue($imageStretched->isSize(300, 300));
$this->assertEquals($image->Filename, $imageStretched->Filename);
// Fit (various options)
$imageFit = $image->Fit(300, 600);
$this->assertTrue($imageFit->isSize(300, 300));
$this->assertEquals($image->Filename, $imageFit->Filename);
$imageFit = $image->Fit(600, 300);
$this->assertTrue($imageFit->isSize(300, 300));
$this->assertEquals($image->Filename, $imageFit->Filename);
$imageFit = $image->Fit(300, 300);
$this->assertTrue($imageFit->isSize(300, 300));
$this->assertEquals($image->Filename, $imageFit->Filename);
}
/**
* Tests that image manipulations that do not affect the resulting dimensions
* of the output image resample the file when force_resample is set to true.
*/
public function testForceResample() {
$image = $this->objFromFixture('Image', 'imageWithoutTitle');
$this->assertTrue($image->isSize(300, 300));
$origForceResample = Config::inst()->get('Image', 'force_resample');
Config::inst()->update('Image', 'force_resample', true);
// Set width to 300 pixels
$imageScaleWidth = $image->ScaleWidth(300);
$this->assertEquals($imageScaleWidth->getWidth(), 300);
$this->assertNotEquals($image->Filename, $imageScaleWidth->Filename);
// Set height to 300 pixels
$imageScaleHeight = $image->ScaleHeight(300);
$this->assertEquals($imageScaleHeight->getHeight(), 300);
$this->assertNotEquals($image->Filename, $imageScaleHeight->Filename);
// Crop image to 300 x 300
$imageCropped = $image->Fill(300, 300);
$this->assertTrue($imageCropped->isSize(300, 300));
$this->assertNotEquals($image->Filename, $imageCropped->Filename);
// Resize (padded) to 300 x 300
$imageSized = $image->Pad(300, 300);
$this->assertTrue($imageSized->isSize(300, 300));
$this->assertNotEquals($image->Filename, $imageSized->Filename);
// Padded image 300 x 300 (same as above)
$imagePadded = $image->Pad(300, 300);
$this->assertTrue($imagePadded->isSize(300, 300));
$this->assertNotEquals($image->Filename, $imagePadded->Filename);
// Resized (stretched) to 300 x 300
$imageStretched = $image->ResizedImage(300, 300);
$this->assertTrue($imageStretched->isSize(300, 300));
$this->assertNotEquals($image->Filename, $imageStretched->Filename);
// Fit (various options)
$imageFit = $image->Fit(300, 600);
$this->assertTrue($imageFit->isSize(300, 300));
$this->assertNotEquals($image->Filename, $imageFit->Filename);
$imageFit = $image->Fit(600, 300);
$this->assertTrue($imageFit->isSize(300, 300));
$this->assertNotEquals($image->Filename, $imageFit->Filename);
$imageFit = $image->Fit(300, 300);
$this->assertTrue($imageFit->isSize(300, 300));
$this->assertNotEquals($image->Filename, $imageFit->Filename);
Config::inst()->update('Image', 'force_resample', $origForceResample);
}
public function testImageResize() {
$image = $this->objFromFixture('Image', 'imageWithoutTitle');
$this->assertTrue($image->isSize(300, 300));
// Test normal resize
$resized = $image->Pad(150, 100);
$this->assertTrue($resized->isSize(150, 100));
// Test cropped resize
$cropped = $image->Fill(100, 200);
$this->assertTrue($cropped->isSize(100, 200));
// Test padded resize
$padded = $image->Pad(200, 100);
$this->assertTrue($padded->isSize(200, 100));
// Test Fit
$ratio = $image->Fit(80, 160);
$this->assertTrue($ratio->isSize(80, 80));
// Test FitMax
$fitMaxDn = $image->FitMax(200, 100);
$this->assertTrue($fitMaxDn->isSize(100, 100));
$fitMaxUp = $image->FitMax(500, 400);
$this->assertTrue($fitMaxUp->isSize(300, 300));
//Test ScaleMax
$scaleMaxWDn = $image->ScaleMaxWidth(200);
$this->assertTrue($scaleMaxWDn->isSize(200, 200));
$scaleMaxWUp = $image->ScaleMaxWidth(400);
$this->assertTrue($scaleMaxWUp->isSize(300, 300));
$scaleMaxHDn = $image->ScaleMaxHeight(200);
$this->assertTrue($scaleMaxHDn->isSize(200, 200));
$scaleMaxHUp = $image->ScaleMaxHeight(400);
$this->assertTrue($scaleMaxHUp->isSize(300, 300));
// Test FillMax
$cropMaxDn = $image->FillMax(200, 100);
$this->assertTrue($cropMaxDn->isSize(200, 100));
$cropMaxUp = $image->FillMax(400, 200);
$this->assertTrue($cropMaxUp->isSize(300, 150));
// Test Clip
$clipWDn = $image->CropWidth(200);
$this->assertTrue($clipWDn->isSize(200, 300));
$clipWUp = $image->CropWidth(400);
$this->assertTrue($clipWUp->isSize(300, 300));
$clipHDn = $image->CropHeight(200);
$this->assertTrue($clipHDn->isSize(300, 200));
$clipHUp = $image->CropHeight(400);
$this->assertTrue($clipHUp->isSize(300, 300));
}
/**
* @expectedException InvalidArgumentException
*/
public function testGenerateImageWithInvalidParameters() {
$image = $this->objFromFixture('Image', 'imageWithoutTitle');
$image->setHeight('String');
$image->Pad(600,600,'XXXXXX');
}
public function testCacheFilename() {
$image = $this->objFromFixture('Image', 'imageWithoutTitle');
$imageFirst = $image->Pad(200,200,'CCCCCC');
$imageFilename = $imageFirst->getFullPath();
// Encoding of the arguments is duplicated from cacheFilename
$neededPart = 'Pad' . base64_encode(json_encode(array(200,200,'CCCCCC')));
$this->assertContains($neededPart, $imageFilename, 'Filename for cached image is correctly generated');
}
public function testMultipleGenerateManipulationCalls_Regeneration() {
$image = $this->objFromFixture('Image', 'imageWithoutTitle');
$folder = new SS_FileFinder();
$imageFirst = $image->Pad(200,200);
$this->assertNotNull($imageFirst);
$expected = 200;
$actual = $imageFirst->getWidth();
$this->assertEquals($expected, $actual);
$imageSecond = $imageFirst->setHeight(100);
$this->assertNotNull($imageSecond);
$expected = 100;
$actual = $imageSecond->getHeight();
$this->assertEquals($expected, $actual);
$imageThird = $imageSecond->Pad(600,600,'0F0F0F');
// Encoding of the arguments is duplicated from cacheFilename
$argumentString = base64_encode(json_encode(array(600,600,'0F0F0F')));
$this->assertNotNull($imageThird);
$this->assertContains($argumentString, $imageThird->getFullPath(),
'Image contains background color for padded resizement');
$imageThirdPath = $imageThird->getFullPath();
$filesInFolder = $folder->find(dirname($imageThirdPath));
$this->assertEquals(3, count($filesInFolder),
'Image folder contains only the expected number of images before regeneration');
$hash = md5_file($imageThirdPath);
$this->assertEquals(3, $image->regenerateFormattedImages(),
'Cached images were regenerated in the right number');
$this->assertEquals($hash, md5_file($imageThirdPath), 'Regeneration of third image is correct');
/* Check that no other images exist, to ensure that the regeneration did not create other images */
$this->assertEquals($filesInFolder, $folder->find(dirname($imageThirdPath)),
'Image folder contains only the expected image files after regeneration');
}
public function testRegenerateImages() {
$image = $this->objFromFixture('Image', 'imageWithMetacharacters');
$image_generated = $image->ScaleWidth(200);
$p = $image_generated->getFullPath();
$this->assertTrue(file_exists($p), 'Resized image exists after creation call');
$this->assertEquals(1, $image->regenerateFormattedImages(), 'Cached images were regenerated correct');
$this->assertEquals($image_generated->getWidth(), 200,
'Resized image has correct width after regeneration call');
$this->assertTrue(file_exists($p), 'Resized image exists after regeneration call');
}
/**
* Tests that cached images are regenerated properly after a cached file is renamed with new arguments
* ToDo: This doesn't seem like something that is worth testing - what is the point of this?
*/
public function testRegenerateImagesWithRenaming() {
$image = $this->objFromFixture('Image', 'imageWithMetacharacters');
$image_generated = $image->ScaleWidth(200);
$p = $image_generated->getFullPath();
$this->assertTrue(file_exists($p), 'Resized image exists after creation call');
// Encoding of the arguments is duplicated from cacheFilename
$oldArgumentString = base64_encode(json_encode(array(200)));
$newArgumentString = base64_encode(json_encode(array(300)));
$newPath = str_replace($oldArgumentString, $newArgumentString, $p);
$newRelative = str_replace($oldArgumentString, $newArgumentString, $image_generated->getFileName());
rename($p, $newPath);
$this->assertFalse(file_exists($p), 'Resized image does not exist at old path after renaming');
$this->assertTrue(file_exists($newPath), 'Resized image exists at new path after renaming');
$this->assertEquals(1, $image->regenerateFormattedImages(),
'Cached images were regenerated in the right number');
$image_generated_2 = new Image_Cached($newRelative);
$this->assertEquals(300, $image_generated_2->getWidth(), 'Cached image was regenerated with correct width');
}
public function testGeneratedImageDeletion() {
$image = $this->objFromFixture('Image', 'imageWithMetacharacters');
$image_generated = $image->ScaleWidth(200);
$p = $image_generated->getFullPath();
$this->assertTrue(file_exists($p), 'Resized image exists after creation call');
$numDeleted = $image->deleteFormattedImages();
$this->assertEquals(1, $numDeleted, 'Expected one image to be deleted, but deleted ' . $numDeleted . ' images');
$this->assertFalse(file_exists($p), 'Resized image not existing after deletion call');
}
/**
* Tests that generated images with multiple image manipulations are all deleted
*/
public function testMultipleGenerateManipulationCallsImageDeletion() {
$image = $this->objFromFixture('Image', 'imageWithMetacharacters');
$firstImage = $image->ScaleWidth(200);
$firstImagePath = $firstImage->getFullPath();
$this->assertTrue(file_exists($firstImagePath));
$secondImage = $firstImage->ScaleHeight(100);
$secondImagePath = $secondImage->getFullPath();
$this->assertTrue(file_exists($secondImagePath));
$image->deleteFormattedImages();
$this->assertFalse(file_exists($firstImagePath));
$this->assertFalse(file_exists($secondImagePath));
}
/**
* Tests path properties of cached images with multiple image manipulations
*/
public function testPathPropertiesCachedImage() {
$image = $this->objFromFixture('Image', 'imageWithMetacharacters');
$firstImage = $image->ScaleWidth(200);
$firstImagePath = $firstImage->getRelativePath();
$this->assertEquals($firstImagePath, $firstImage->Filename);
$secondImage = $firstImage->ScaleHeight(100);
$secondImagePath = $secondImage->getRelativePath();
$this->assertEquals($secondImagePath, $secondImage->Filename);
}
/**
* Test all generate methods
*/
public function testGenerateMethods() {
$image = $this->objFromFixture('Image', 'imageWithoutTitle');
$generateMethods = $this->getGenerateMethods();
// test each generate method
foreach ($generateMethods as $method) {
$generatedImage = $image->$method(333, 333, 'FFFFFF');
$this->assertFileExists(
$generatedImage->getFullPath(),
'Formatted ' . $method . ' image exists'
);
}
}
/**
* Test deleteFormattedImages() against all generate methods
*/
public function testDeleteFormattedImages() {
$image = $this->objFromFixture('Image', 'imageWithoutTitle');
$generateMethods = $this->getGenerateMethods();
// get paths for each generate method
$paths = array();
foreach ($generateMethods as $method) {
$generatedImage = $image->$method(333, 333, 'FFFFFF');
$paths[$method] = $generatedImage->getFullPath();
}
// delete formatted images
$image->deleteFormattedImages();
// test that all formatted images are deleted
foreach ($paths as $method => $path) {
$this->assertFalse(
file_exists($path),
'Formatted ' . $method . ' image does not exist'
);
}
}
/**
* @param bool $custom include methods added dynamically at runtime
* @return array
*/
protected function getGenerateMethods($custom = true) {
$generateMethods = array();
$methodNames = Image::create()->allMethodNames($custom);
foreach ($methodNames as $methodName) {
if (substr($methodName, 0, 8) == 'generate' && $methodName != 'generateformattedimage') {
$format = substr($methodName, 8);
$generateMethods[] = $format;
}
}
return $generateMethods;
}
}
| 0.996094 | high |
prestashop/vendor/league/tactician/src/Handler/MethodNameInflector/HandleClassNameWithoutSuffixInflector.php | rubycouzcedric/folio | 2 | 868 | <?php
namespace League\Tactician\Handler\MethodNameInflector;
/**
* Returns a method name that is handle + the last portion of the class name
* but also without a given suffix, typically "Command". This allows you to
* handle multiple commands on a single object but with slightly less annoying
* method names.
*
* The string removal is case sensitive.
*
* Examples:
* - \CompleteTaskCommand => $handler->handleCompleteTask()
* - \My\App\DoThingCommand => $handler->handleDoThing()
*/
class HandleClassNameWithoutSuffixInflector extends HandleClassNameInflector
{
/**
* @var string
*/
private $suffix;
/**
* @var int
*/
private $suffixLength;
/**
* @param string $suffix The string to remove from end of each class name
*/
public function __construct($suffix = 'Command')
{
$this->suffix = $suffix;
$this->suffixLength = strlen($suffix);
}
/**
* @param object $command
* @param object $commandHandler
* @return string
*/
public function inflect($command, $commandHandler)
{
$methodName = parent::inflect($command, $commandHandler);
if (substr($methodName, $this->suffixLength * -1) !== $this->suffix) {
return $methodName;
}
return substr($methodName, 0, strlen($methodName) - $this->suffixLength);
}
}
| 0.992188 | high |
resources/views/components/sidebar.blade.php | ICKillerGH/hechicerahindu | 0 | 932 | <div {{ $attributes->merge(['class' => 'w-full h-full overflow-x-hidden overflow-y-auto'])->only('class') }}>
@if (isset($header))
<div class="h-16">
{{ $header }}
</div>
@endif
{{ $slot }}
</div>
| 0.96875 | high |
application/admin/model/Userip.php | tensHugo/xiadmin | 2 | 996 | <reponame>tensHugo/xiadmin<filename>application/admin/model/Userip.php
<?php
namespace app\admin\model;
use think\Model;
class Userip extends Model
{
protected $table = 'userip';
protected $id = 'id';
protected $username = 'username';
protected $ip = 'ip';
protected $time = 'time';
}
?> | 0.960938 | high |
functions.php | loay/fbLogin | 0 | 1060 | <?php
require 'dbconfig.php';
function checkuser($fuid,$funame,$ffname,$femail){
$check = mysql_query("select * from Users where Fuid='{$fuid}'");
$check = mysql_num_rows($check);
if (empty($check)) { // if new user . Insert a new record
$query = "INSERT INTO Users (Fuid,Funame,Ffname,username) VALUES ('{$fuid}','{$funame}','{$ffname}','{$femail}')";
mysql_query($query);
} else { // If Returned user . update the user record
$query = "UPDATE Users SET Funame='{$funame}', Ffname='{$ffname}', username='{$femail}' where Fuid='{$fuid}'";
mysql_query($query);
}
}?>
| 0.507813 | high |
src/Reflinks/MetadataParserChain.php | Amorymeltzer/refill | 0 | 1124 | <?php
/*
Copyright (c) 2014, <NAME>
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/*
Metadata parser chain
*/
namespace Reflinks;
use Reflinks\Exceptions\MetadataParserException;
use Reflinks\Exceptions\NoSuchMetadataParserException;
use Reflinks\Exceptions\ErroneousMetadataParserException;
class MetadataParserChain {
private $chain = array();
function __construct( array $chain = array() ) {
foreach ( $chain as $parser ) {
$this->append( $parser );
}
}
public function append( $parser ) {
if ( is_subclass_of( $parser, "MetadataParser" ) ) {
$this->chain[] = $parser;
return true;
} elseif ( is_string( $parser ) ) {
// The autoloader doesn't automatically resolve the namespace here, so...
if ( strpos( $parser, '\\' ) ) { // absolute namespace
$class = $parser;
} else { // Let's assume it's under Reflinks\
$class = '\\Reflinks\\MetadataParsers\\' . $parser;
}
if ( class_exists( $class ) ) {
$this->chain[] = new $class();
return true;
} else {
throw new NoSuchMetadataParserException( $class );
}
} else {
throw new ErroneousMetadataParserException();
}
}
public function parse( \DOMDocument $dom, Metadata $baseMetadata = null ) {
if ( $baseMetadata ) {
$result = $baseMetadata;
} else {
$result = new Metadata();
}
foreach ( $this->chain as $parser ) {
$parser->chain( $dom, $result );
}
return $result;
}
}
| 0.996094 | high |
lib/model/MlmProductPurchaseHistory.php | maplecempire/theone-maxim | 1 | 1188 | <filename>lib/model/MlmProductPurchaseHistory.php<gh_stars>1-10
<?php
/**
* Subclass for representing a row from the 'mlm_product_purchase_history' table.
*
*
*
* @package lib.model
*/
class MlmProductPurchaseHistory extends BaseMlmProductPurchaseHistory
{
}
| 0.691406 | low |
resources/lang/en/common.php | danmichaelo/alma-newbooks-db | 4 | 1252 | <gh_stars>1-10
<?php
return [
'delete' => 'Delete',
];
| 0.550781 | low |
spec/Controller/ClientIndexControllerSpec.php | sgomez/simplesamlphp-module-oidc | 0 | 1316 | <?php
/*
* This file is part of the simplesamlphp-module-oidc.
*
* (c) <NAME> <<EMAIL>>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace spec\SimpleSAML\Modules\OpenIDConnect\Controller;
use PhpSpec\ObjectBehavior;
use Psr\Http\Message\UriInterface;
use SimpleSAML\Modules\OpenIDConnect\Controller\ClientIndexController;
use SimpleSAML\Modules\OpenIDConnect\Factories\TemplateFactory;
use SimpleSAML\Modules\OpenIDConnect\Repositories\ClientRepository;
use Zend\Diactoros\ServerRequest;
class ClientIndexControllerSpec extends ObjectBehavior
{
public function let(
ClientRepository $clientRepository,
TemplateFactory $templateFactory,
ServerRequest $request,
UriInterface $uri
) {
$_SERVER['REQUEST_URI'] = '/';
\SimpleSAML_Configuration::loadFromArray([], '', 'simplesaml');
$request->getUri()->willReturn($uri);
$uri->getPath()->willReturn('/');
$this->beConstructedWith($clientRepository, $templateFactory);
}
public function it_is_initializable()
{
$this->shouldHaveType(ClientIndexController::class);
}
public function it_shows_client_index(
ServerRequest $request,
\SimpleSAML_XHTML_Template $template,
TemplateFactory $templateFactory,
ClientRepository $clientRepository
) {
$clientRepository->findAll()->shouldBeCalled()->willReturn([]);
$templateFactory->render('oidc:clients/index.twig', ['clients' => []])->shouldBeCalled()->willReturn($template);
$this->__invoke($request)->shouldBe($template);
}
}
| 0.996094 | high |
test/class/controller/Controller_BannerTest.php | siteforever/SiteForeverCMS | 1 | 1380 | <?php
//require_once 'class/controller/banner.php';
use Module\Banner\Controller\BannerController;
/**
* Test class for Controller_Banner.
* Generated by PHPUnit on 2012-04-24 at 00:50:46.
*/
class Controller_BannerTest extends PHPUnit_Framework_TestCase
{
/**
* Tears down the fixture, for example, closes a network connection.
* This method is called after a test is executed.
*/
protected function tearDown()
{
}
/**
* Инициализация
*/
public function testInit()
{
}
/**
* Главная страница
*/
public function testIndexAction()
{
}
/**
* Админка
*/
public function testAdminAction()
{
}
/**
* Редирект
*/
public function testRedirectBannerAction()
{
}
/**
* Сохранить категорию
*/
public function testSaveCatAction()
{
}
/**
* Удалить категорию
*/
public function testDelCatAction()
{
}
/**
* Удалить баннер
*/
public function testDelAction()
{
}
/**
* Категория
*/
public function testCatAction()
{
}
/**
* Правка баннера
*/
public function testEditAction()
{
}
}
| 0.644531 | low |
resources/template/products/table-products.php | brunof19d/mechanical-workshop-system | 0 | 1444 | <reponame>brunof19d/mechanical-workshop-system<filename>resources/template/products/table-products.php
<?php require_once __DIR__ . '/../../includes/header.php';
/**
* @var \App\View\Products\TableProducts $categories
* @var \App\Entity\Product\CategoryProduct $category
* @var \App\View\Products\TableProducts $products
* @var \App\Entity\Product\Product $product
*/
?>
<h4 class="text-center mb-5">Tabela com todos os produtos registrado do sistema</h4>
<form method="GET" action="/table-filter">
<div class="d-flex align-items-center">
<label for="category">Filtar por categorias:</label>
<select class="form-control w-50 mr-3 ml-2" id="category" name="category">
<option selected disabled>Escolha uma categoria...</option>
<?php foreach ($categories as $category): ?>
<option value="<?= $category->getIdCategory(); ?>">
<?= $category->getNameCategory(); ?>
</option>
<?php endforeach; ?>
</select>
<button class="btn btn-default " type="submit">Aplicar filtro</button>
</div>
</form>
<div class="form-group mt-3">
<input type="text" id="filter-table" class="form-control border-dark" placeholder="Digite o nome do produto">
</div>
<table class="table table-bordered table-striped table-responsive-xl border w-100">
<thead>
<tr>
<th>Nome Produto</th>
<th>Categoria</th>
<th>Preço unitario</th>
</tr>
</thead>
<tbody>
<?php foreach ($products as $product): ?>
<tr class="client">
<td><?= $product->getNameProduct(); ?></td>
<td><?= $product->getCategory()->getNameCategory(); ?></td>
<td><b class="mr-1">R$</b><?= $product->getValue(); ?></td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<?php require_once __DIR__ . '/../../includes/footer.php'; ?>
| 0.964844 | high |
lib/commercetools-import/src/Models/Common/PaymentKeyReferenceCollection.php | dbrumann/commercetools-sdk-php-v2 | 0 | 1508 | <?php
declare(strict_types=1);
/**
* This file has been auto generated
* Do not change it.
*/
namespace Commercetools\Import\Models\Common;
use Commercetools\Exception\InvalidArgumentException;
use Commercetools\Import\Models\Common\KeyReferenceCollection;
use stdClass;
/**
* @extends KeyReferenceCollection<PaymentKeyReference>
* @method PaymentKeyReference current()
* @method PaymentKeyReference at($offset)
*/
class PaymentKeyReferenceCollection extends KeyReferenceCollection
{
/**
* @psalm-assert PaymentKeyReference $value
* @psalm-param PaymentKeyReference|stdClass $value
* @throws InvalidArgumentException
*
* @return PaymentKeyReferenceCollection
*/
public function add($value)
{
if (!$value instanceof PaymentKeyReference) {
throw new InvalidArgumentException();
}
$this->store($value);
return $this;
}
/**
* @psalm-return callable(int):?PaymentKeyReference
*/
protected function mapper()
{
return function (int $index): ?PaymentKeyReference {
$data = $this->get($index);
if ($data instanceof stdClass) {
/** @var PaymentKeyReference $data */
$data = PaymentKeyReferenceModel::of($data);
$this->set($data, $index);
}
return $data;
};
}
}
| 0.996094 | high |
app/Http/Requests/StoreClient.php | bonfanteandre/free-gym | 0 | 1572 | <?php
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class StoreClient extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
'name' => 'required',
'email' => 'required|email',
'phone' => 'required',
'document' => 'required|unique:clients',
'sex' => 'required',
'birth' => 'required',
'address' => 'required',
'city' => 'required',
'state' => 'required',
'zipcode' => 'required',
'plan_id' => 'required'
];
}
protected function prepareForValidation()
{
$this->merge([
'phone' => preg_replace('/\D/', '', $this->phone),
'document' => preg_replace('/\D/', '', $this->document),
'zipcode' => preg_replace('/\D/', '', $this->zipcode)
]);
}
public function messages()
{
return [
'required' => 'O campo :attribute é obrigatório',
'email' => 'O campo :attribute deve ser um endereço de e-mail válido',
'unique' => 'O campo :attribute já está sendo utilizado em outro cliente',
'min' => 'O campo :attribute deve possuir no mínimo :min caracteres'
];
}
}
| 0.992188 | high |
_src/Lesson07/demo3/app/views/contacts/index.php | paullewallencom/php-978-1-7895-3568-6 | 9 | 1636 | <reponame>paullewallencom/php-978-1-7895-3568-6<filename>_src/Lesson07/demo3/app/views/contacts/index.php<gh_stars>1-10
<?php
if (isset($records)) {
foreach ($records as $row) {
echo $row->name.'<br>';
}
}
| 0.609375 | low |
pattern/utility/ratio/base.php | gazjoy/sturdy-dollop | 33 | 1700 | <div class="u-ratio u-fill-neutral-light cc-pattern-width-sm">
<img src="<?php echo getUrl('build/img/placeholder/300x300.jpg'); ?>" />
</div>
| 0.941406 | low |
tests/Unit/Ldap/DomainConnectorTest.php | DirectoryTree/Scout | 9 | 1764 | <?php
namespace Tests\Unit\Ldap;
use Mockery as m;
use Carbon\Carbon;
use Tests\TestCase;
use App\LdapDomain;
use LdapRecord\Container;
use LdapRecord\Connection;
use LdapRecord\Configuration\DomainConfiguration;
use App\Ldap\Connectors\DomainConnector;
use Illuminate\Foundation\Testing\RefreshDatabase;
class DomainConnectorTest extends TestCase
{
use RefreshDatabase;
public function test_connection_is_retrieved_from_container()
{
$domain = factory(LdapDomain::class)->create();
$conn = new Connection();
Container::getInstance()->add($conn, $domain->getLdapConnectionName());
$this->assertEquals($conn, DomainConnector::on($domain)->getConnection());
}
public function test_successful_connections_update_domain_status()
{
/** @var LdapDomain $domain */
$domain = factory(LdapDomain::class)->create();
$conn = m::mock(Connection::class);
Container::getInstance()->add($conn, $domain->getLdapConnectionName());
$conn->shouldReceive('isConnected')->once()->andReturnFalse();
$conn->shouldReceive('connect')->once();
$config = new DomainConfiguration($domain->getLdapConnectionAttributes());
$conn->shouldReceive('getConfiguration')->once()->andReturn($config);
DomainConnector::on($domain)->connect();
$domain = $domain->fresh();
$this->assertInstanceOf(Carbon::class, $domain->attempted_at);
$this->assertEquals($domain->status, LdapDomain::STATUS_ONLINE);
}
}
| 0.996094 | high |
src/Results/AutograspResult.php | SeverusWell/amap | 19 | 1828 | <gh_stars>10-100
<?php
/**
* Created by PhpStorm.
* User: li
* Date: 2017/12/8
* Time: 18:22
*/
namespace Reprover\Amap\Results;
use Reprover\Amap\Support\Result;
//抓路服务,仅适用于企业
class AutoGraspResult extends Result
{
protected function setData()
{
return $this->original->roads;
}
} | 0.519531 | medium |
flashcards/pages/learn/matching.php | allikins34/QuizKnows | 0 | 1892 | <reponame>allikins34/QuizKnows
<?php
error_reporting(0);
// Created by Gillian
// Edited by Steven
// Edited by Kristi
// Edited by Gillian: connection statements
require($_SERVER['DOCUMENT_ROOT'] . '/flashcards/core/app.php');
require(APP_ROOT_DIR .'/fragments/header.php');
require APP_ROOT_DIR."/pages/auth.php";
require(APP_ROOT_DIR. "/pages/connectuser.php");
?>
<!DOCTYPE html>
<html lang="en">
<meta charset="UTF-8">
<title>Multiple Choice - Learn</title>
<meta name="viewport" content="width=device-width,initial-scale=1">
<link rel="stylesheet" href="../styleindex.css">
<head>
<script>
src="https://code.jquery.com/jquery-3.6.0.min.js"
integrity="<KEY>
crossorigin="anonymous"></script>
</script>
<script src="script.js"></script>
</head>
</div>
</div>
<h1>Matching</h1>
<body>
<form method="POST">
<div id = "shee">
<input type="text" name="set_id" placeholder="Enter Set ID">
<input type="submit">
</div>
<br>
</form>
<div id="question1">
</div>
<div id="question2">
</div>
<div id="question3">
</div>
<div id="question4">
</div>
<br>
<div id="wordBankSeperator">
<br>
Word Bank
<br>
<br>
</div>
<div id="wordBank">
</div>
<br>
<div id="answer1">
1:<input type="text" name="answer1"></input>
</div>
<div id="answer2">
2:<input type="text" name="answer2"></input>
</div>
<div id="answer3">
3:<input type="text" name="answer3"></input>
</div>
<div id="answer4">
4:<input type="text" name="answer4"></input>
</div>
<br>
<div id="correctNot1">
</div>
<div id="correctNot2">
</div>
<div id="correctNot3">
</div>
<div id="correctNot4">
</div>
<br>
<div name="buttons">
<button onclick="checkCorrect()">Check Answer</button>
<button onclick="nextQuestion()">Next Question</button>
</div>
<?php
$sql = "SELECT question, answer FROM card WHERE subject_id=?";
if ($stmt = mysqli_prepare($dbc, $sql))
{
mysqli_stmt_bind_param($stmt, "i", $subject);
$subject =$_POST["set_id"];
mysqli_stmt_execute($stmt);
mysqli_stmt_store_result($stmt);
mysqli_stmt_bind_result($stmt, $question, $answer);
}
$question_array= Array();
$answer_array=Array();
while ($stmt->fetch())
{
$question_array[]=$question;
$answer_array[]=$answer;
}
?>
<spacer type="horizontal" width="1000" height="1000"> ♢ Meet <NAME>izKnow's diamond.</spacer>
<script>
var br=document.createElement("BR");
var checker=false;
var iter=0;
var questions=<?php echo json_encode($question_array);?>;
var answers=<?php echo json_encode($answer_array);?>;
document.getElementById('question1').innerHTML = questions[iter];
document.getElementById('question2').innerHTML = questions[iter+1];
document.getElementById('question3').innerHTML = questions[iter+2];
document.getElementById('question4').innerHTML = questions[iter+3];
var scramble=[answers[iter], answers[iter+1], answers[iter+2], answers[iter+3]];
shuffle(scramble);
document.getElementById('wordBank').innerHTML=scramble[0] +"<br>"+ scramble[1] + "<br>" +scramble[2]+ "<br>"+ scramble[3];
function shuffle(array) {
for (let i = array.length - 1; i > 0; i--) {
let j = Math.floor(Math.random() * (i + 1));
[array[i], array[j]] = [array[j], array[i]];
}
}
function checkCorrect()
{
var correctAnswer1=document.getElementsByName("answer1")[0].value;
var correctAnswer2=document.getElementsByName("answer2")[0].value;
var correctAnswer3=document.getElementsByName("answer3")[0].value;
var correctAnswer4=document.getElementsByName("answer4")[0].value;
var userAnswer=answers[iter];
if(correctAnswer1 == userAnswer)
{
correctAnswer1=true
}
else
{
correctAnswer1=false
}
userAnswer=answers[iter+1]
if(correctAnswer2 == userAnswer)
{
correctAnswer2=true
}
else
{
correctAnswer2=false
}
userAnswer=answers[iter+2]
if(correctAnswer3 == userAnswer)
{
correctAnswer3=true
}
else
{
correctAnswer3=false
}
userAnswer=answers[iter+3]
if(correctAnswer4 == userAnswer)
{
correctAnswer4=true
}
else
{
correctAnswer4=false
}
document.getElementById('correctNot1').innerHTML = "";
document.getElementById('correctNot2').innerHTML = "";
document.getElementById('correctNot3').innerHTML = "";
document.getElementById('correctNot4').innerHTML = "";
// if (correctAnswer1==true)
// {
// document.getElementById('correctNot').append("Answer 1 is correct");
// }
//
// if (correctAnswer2==true)
// {
// document.getElementById('correctNot').append(br);
// document.getElementById('correctNot').append("Answer 2 is correct");
// }
//
// if (correctAnswer3==true)
// {
// document.getElementById('correctNot').append(br);
// document.getElementById('correctNot').append("Answer 3 is correct");
// }
//
// if (correctAnswer4==true)
// {
// document.getElementById('correctNot').append(br);
// document.getElementById('correctNot').append("Answer 4 is correct");
// }
if (correctAnswer1==true && correctAnswer2==true && correctAnswer3==true && correctAnswer4==true)
{
document.getElementById('correctNot1').innerHTML="All answers correct"
document.getElementById('correctNot2').innerHTML=""
document.getElementById('correctNot3').innerHTML=""
document.getElementById('correctNot4').innerHTML=""
}
else
{
document.getElementById('correctNot1').innerHTML = (`Answer 1 is ${(correctAnswer1) ? "correct" : "incorrect"}`);
document.getElementById('correctNot2').append(`Answer 2 is ${(correctAnswer2) ? "correct" : "incorrect"}`);
document.getElementById('correctNot3').append(`Answer 3 is ${(correctAnswer3) ? "correct" : "incorrect"}`);
document.getElementById('correctNot4').append(`Answer 4 is ${(correctAnswer4) ? "correct" : "incorrect"}`);
}
correctAnswer1=false;
correctAnswer2=false;
correctAnswer3=false;
correctAnswer4=false;
}
function nextQuestion() {
iter+=4;
var qLength = questions.length;
document.getElementById('correctNot1').innerHTML=""
document.getElementById('correctNot2').innerHTML=""
document.getElementById('correctNot3').innerHTML=""
document.getElementById('correctNot4').innerHTML=""
if (checker==true) {
document.getElementById('question1').innerHTML = "End of matching quiz";
document.getElementById('question2').innerHTML = "";
document.getElementById('question3').innerHTML = "";
document.getElementById('question4').innerHTML = "";
document.getElementById('answer1').innerHTML = "";
document.getElementById('answer2').innerHTML = "";
document.getElementById('answer3').innerHTML = "";
document.getElementById('answer4').innerHTML = "";
document.getElementById('wordBank').innerHTML="";
document.getElementById('wordBankSeperator').innerHTML="";
console.log("sixth case" + iter + " "+ qLength);
checker=false;
}
if (iter+4 <= qLength)
{
document.getElementById('question1').innerHTML = questions[iter];
document.getElementById('question2').innerHTML = questions[iter + 1];
document.getElementById('question3').innerHTML = questions[iter + 2];
document.getElementById('question4').innerHTML = questions[iter + 3];
scramble=[answers[iter], answers[iter+1], answers[iter+2], answers[iter+3]];
shuffle(scramble);
document.getElementById('wordBank').innerHTML=scramble[0] +"<br>"+ scramble[1] + "<br>" +scramble[2]+ "<br>"+ scramble[3];
console.log("first case" + iter + " "+ qLength);
if (iter+4 == qLength)
{
checker=true;
}
}
else if (iter+3 == qLength)
{
document.getElementById('question1').innerHTML = questions[iter];
document.getElementById('question2').innerHTML = questions[iter + 1];
document.getElementById('question3').innerHTML = questions[iter + 2];
document.getElementById('question4').innerHTML = "";
document.getElementById('answer4').innerHTML="";
scramble=[answers[iter], answers[iter+1], answers[iter+2]];
shuffle(scramble);
document.getElementById('wordBank').innerHTML=scramble[0] +"<br>"+ scramble[1] + "<br>" +scramble[2];
iter+=3;
checker=true;
console.log("second case" + iter + " "+ qLength);
}
else if (iter+2 == qLength) {
document.getElementById('question1').innerHTML = questions[iter];
document.getElementById('question2').innerHTML = questions[iter + 1];
document.getElementById('question3').innerHTML = "";
document.getElementById('question4').innerHTML = "";
document.getElementById('answer3').innerHTML="";
document.getElementById('answer4').innerHTML="";
scramble=[answers[iter], answers[iter+1]];
shuffle(scramble);
document.getElementById('wordBank').innerHTML=scramble[0] +"<br>"+ scramble[1];
iter+=2;
console.log("third case" + iter + " "+ qLength);
checker=true;
}
else if (iter+1 == qLength) {
document.getElementById('question1').innerHTML = questions[iter];
document.getElementById('question2').innerHTML = "";
document.getElementById('question3').innerHTML = "";
document.getElementById('question4').innerHTML = "";
document.getElementById('answer2').innerHTML = "";
document.getElementById('answer3').innerHTML = "";
document.getElementById('answer4').innerHTML = "";
document.getElementById('wordBank').innerHTML=answers[iter];
iter+=1;
console.log("foruth case" + iter + " "+ qLength);
checker=true
}
}
document.onload(iter=0);
</script>
<style>
#wordBankSeperator
{
border: solid black 1px;
text-align:center;
background-color: black;
width: 250px;
font-family: "Times New Roman", Times, serif;
font-size: 20px;
color: white;
}
#question1
{
border: solid black 1px;
text-align:center;
background-color: white;
width: 250px;
font-family: "Times New Roman", Times, serif;
font-size: 20px;
color: black;
}
#question2
{
border: solid white 1px;
text-align:center;
background-color: black;
width: 250px;
font-family: "Times New Roman", Times, serif;
font-size: 20px;
color: white;
}
#question3
{
border: solid black 1px;
text-align:center;
background-color: white;
width: 250px;
font-family: "Times New Roman", Times, serif;
font-size: 20px;
color: black;
}
#question4
{
border: solid white 1px;
text-align:center;
background-color: black;
width: 250px;
font-family: "Times New Roman", Times, serif;
font-size: 20px;
color: white;
}
#correctNot1
{
text-align:center;
background-color: white;
width: 250px;
font-family: "Times New Roman", Times, serif;
font-size: 20px;
color: black;
}
#correctNot2
{
text-align:center;
background-color: black;
width: 250px;
font-family: "Times New Roman", Times, serif;
font-size: 20px;
color: white;
}
#correctNot3
{
text-align:center;
background-color: white;
width: 250px;
font-family: "Times New Roman", Times, serif;
font-size: 20px;
color: black;
}
#correctNot4
{
text-align:center;
background-color: black;
width: 250px;
font-family: "Times New Roman", Times, serif;
font-size: 20px;
color: white;
}
#wordBank
{
text-align: center;
width: 250px;
background-color: white;
color: black;
border: solid white 1px;
}
#answer1
{
}
</style>
| 0.558594 | low |
resources/views/devices/qrcode.blade.php | rezafahlevi-TIUIR/WAGateway | 0 | 1956 | @extends('layouts.header')
@section('contents')
<title>WaGateway - Add Devices</title>
<div class="container-fluid">
<div class="d-sm-flex align-items-center justify-content-between mb-4">
<h1 class="h3 mb-0 text-gray-800">Add Devices</h1>
</div>
<div class="row">
<div class="col-12">
<div class="col-md-4 grid-margin stretch-card">
<div class="card">
<div class="card-body">
<form class="forms-sample" method="post" action="">
<div class="form-group row">
<label for="exampleInputUsername2" class="col-sm-3 col-form-label">Device Name <br> <span
style="color:red"> </span></label>
<div class="col-sm-9">
<input type="text" class="form-control" name="device_name"
id="exampleInputUsername2" placeholder="ex : Device A" value="">
</div>
</div>
<a href="{{ route('add_devices') }}" class="btn btn-primary btn-lg active btn-sm"
role="button" aria-pressed="true">Simpan</a>
</form>
</div>
</div>
</div>
</div>
</div>
@endsection
| 0.972656 | high |
src/Browser/GoogleChrome/PathResolver.php | dbrekelmans/release-action-test-source | 0 | 2020 | <gh_stars>0
<?php
declare(strict_types=1);
namespace DBrekelmans\BrowserDriverInstaller\Browser\GoogleChrome;
use DBrekelmans\BrowserDriverInstaller\Browser\BrowserName;
use DBrekelmans\BrowserDriverInstaller\Browser\PathResolver as PathResolverInterface;
use DBrekelmans\BrowserDriverInstaller\Exception\NotImplemented;
use DBrekelmans\BrowserDriverInstaller\OperatingSystem\OperatingSystem;
use function Safe\sprintf;
final class PathResolver implements PathResolverInterface
{
/**
* @throws NotImplemented
*/
public function from(OperatingSystem $operatingSystem) : string
{
if ($operatingSystem->equals(OperatingSystem::LINUX())) {
// TODO: command -v google-chrome
return 'google-chrome';
}
if ($operatingSystem->equals(OperatingSystem::MACOS())) {
// TODO: check if file exists
return '/Applications/Google\ Chrome.app';
}
if ($operatingSystem->equals(OperatingSystem::WINDOWS())) {
// phpcs:ignore TODO: (Get-Item (Get-ItemProperty 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\chrome.exe').'(Default)').VersionInfo
return 'C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe';
}
throw NotImplemented::feature(sprintf('Resolving path on %s', $operatingSystem->getValue()));
}
public function supports(BrowserName $browserName) : bool
{
return $browserName->equals(BrowserName::GOOGLE_CHROME());
}
}
| 0.996094 | high |
model/Connection.php | Graves-/SICECUI | 0 | 2084 | <?php
class Connection
{
public function ConectarBD()
{
$DBServer = 'localhost';
$DBUser = 'root';
$DBPass = '<PASSWORD>';
$DBName = 'sicecui';
$conn = new mysqli($DBServer, $DBUser, $DBPass, $DBName);
// check connection
if ($conn->connect_error) {
trigger_error('Database connection failed: ' . $conn->connect_error, E_USER_ERROR);
}
return $conn;
}
public function SelectQuery($sql, $con)
{
$rs=$con->query($sql);
if($rs === false) {
trigger_error('Wrong SQL: ' . $sql . ' Error: ' . $con->error, E_USER_ERROR);
} else {
$rows_returned = $rs->num_rows;
}
$rs->data_seek(0);
return $rs;
}
public function InsertQuery($sql, $con)
{
if($con->query($sql) === false) {
trigger_error('Wrong SQL: ' . $sql . ' Error: ' . $con->error, E_USER_ERROR);
return false;
} else {
return true;
}
}
}
?>
| 0.957031 | high |
app/View/Elements/originCityTable2.ctp | RYOSKATE/cakephp | 0 | 2148 | <style type="text/css">
<!--
th {text-align: right;}
-->
</style>
<?php $ori = array(
1=>'o1',
2=>'o12',
3=>'o2',
4=>'o13',
5=>'o123',
6=>'o23',
7=>'o3',
);
$oriColor = array(
0 => '#C869FF',//紫
1 => '#6BCDFF',//水
2 => '#71FD5E',//緑
3 => '#FECA61',//黄
4 => '#FA6565',//赤
5 => '#000000',//黒
6 => '#DDDDDD',//灰
);
$layer = array(
0=>__('アプリケーション(APP)'),
1=>__('アプリケーションフレームワーク(FW)'),
2=>__('ライブラリ(外部OSS)'),
3=>__('Android Runtinme(SYSTEM)'),
4=>__('HWライブラリ'),
5=>__('Kernel'),
//5=>__('Kernel/ドライバ/ブードローダー'),
6=>__('Others'),
);
$metricsSum = array(0,0,0,0,0,0,0,0);
?>
<table class="table table-condensed" id ="table">
<thead>
<tr>
<th align="left"><?php echo __('機能レイヤ');?></th>
<?php
for($i=1;$i<=7;++$i)
{?>
<th align="right"><?php echo $ori[$i];?></th>
<?php
}?>
<th align="left"><?php echo __('合計値');?></th>
</tr>
</thead>
<tbody>
<?php
for($i=0;$i<=6;++$i)//レイヤー
{
?>
<tr>
<td bgcolor=<?php echo $oriColor[$i];?>>
<?php if($i==5){?>
<font color="white">
<?php }?>
<?php echo $layer[$i];?>
<?php if($i==5){?>
</font>
<?php }?>
</td>
<?php
$leyarSum = 0;
for($j=1;$j<=7;++$j)//由来
{
?><td align="right"><?php
if($data)
{
$value = $data[$j]['layerHeight'][$i];
$metricsSum[$j] += $value;
$leyarSum += $value;
echo $value;
}
?>
</td>
<?php
}
?>
<td align="right"><?php echo $leyarSum;?>
</td>
</tr>
<?php
}
?>
<tr>
<td><?php echo __('メトリクス合計値');?></td>
<?php
$leyarSum = 0;
for($j=1;$j<=7;++$j)//由来
{
?><td align="right"><?php
$leyarSum += $metricsSum[$j];
echo $metricsSum[$j];
?>
</td>
<?php
}
?>
<td align="right"><?php echo $leyarSum;?>
</tr>
<tr>
<td><?php echo __('合計ファイル数');?></td>
<?php
$leyarSum = 0;
for($j=1;$j<=7;++$j)//由来
{
?><td align="right"><?php
if($data)
{
$leyarSum += $data[$j]['numOfFiles'];
echo $data[$j]['numOfFiles'];
}
?>
</td>
<?php
}
?>
<td align="right"><?php echo $leyarSum;?>
</tr>
</tbody>
</table> | 0.886719 | high |
app/Http/Controllers/Dashboard/InsuranceCompanyController.php | ShowmanAh/Medical_Centers | 0 | 2212 | <?php
namespace App\Http\Controllers\Dashboard;
use Illuminate\Http\Request;
use App\Models\InsuranceCompany;
use App\Http\Controllers\Controller;
use App\Http\Requests\InsuranceCompanyRequest;
class InsuranceCompanyController extends Controller
{
private $view = 'dashboard.insurance.';
public function index(){
$insurances = InsuranceCompany::paginate(paginate_number);
//dd($specializations);
return view($this->view . 'index', compact('insurances'));
}
public function create(){
return view($this->view . 'create');
}
public function store(InsuranceCompanyRequest $request){
//dd($request->all());
try {
InsuranceCompany::create($request->except(['_token']));
return redirect()->route('admin.insurance')->with(['success'=> 'تم الحفظ بنجاح']);
} catch (\Exception $ex) {
return redirect()->route('admin.insurance')->with(['error'=> 'هناك خطا فى البيانات']);
}
}
public function edit($id){
$insurance = InsuranceCompany::find($id);
if(!$insurance){
return redirect()->route('admin.insurance')->with(['error' => 'لايوجد هذا التخصص']);
}
return view($this->view . 'edit', compact('insurance'));
}
public function update(InsuranceCompanyRequest $request, $id){
try {
$insurance = InsuranceCompany::find($id);
if(!$insurance){
return redirect()->route('admin.insurance.edit', $id)->with(['error' => 'لايوجد هذا التخصص']);
}
$insurance->update($request->except(['_token']));
return redirect()->route('admin.insurance')->with(['success'=> 'تم التعديل بنجاح']);
} catch (\Exception $ex) {
return redirect()->route('admin.insurance')->with(['error'=> 'هناك خطا فى البيانات']);
}
}
public function destroy($id){
try {
$insurance = InsuranceCompany::find($id);
if(!$insurance){
return redirect()->route('admin.insurance')->with(['error' => 'لايوجد هذا التخصص']);
}
$insurance->delete();
return redirect()->route('admin.insurance')->with(['success'=> 'تم الحذف بنجاح']);
} catch (\Exception $ex) {
return redirect()->route('admin.insurance')->with(['error'=> 'هناك خطا فى البيانات']);
}
}
}
| 0.976563 | high |
database/migrations/2020_11_16_070507_create_employee_memberships_table.php | abdulrohimdev/genius-api | 0 | 2276 | <?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateEmployeeMembershipsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('employee_memberships', function (Blueprint $table) {
$table->id();
$table->string('employee_id',30);
$table->string('membership_code',30);
$table->string('membership_name')->nullable();
$table->date('begin_effective');
$table->date('last_effective');
$table->string('description')->nullable();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('employee_memberships');
}
}
| 0.988281 | high |
src/Extend/ForumAttributes.php | maicol07/mason | 0 | 2340 | <filename>src/Extend/ForumAttributes.php
<?php
namespace RaafiRivero\Mason\Extend;
use RaafiRivero\Mason\Api\Serializers\FieldSerializer;
use RaafiRivero\Mason\Repositories\FieldRepository;
use RaafiRivero\Mason\Api\Serializers\ByTagSerializer;
use RaafiRivero\Mason\Repositories\ByTagRepository;
use Flarum\Api\Controller\ShowForumController;
use Flarum\Api\Event\Serializing;
use Flarum\Api\Event\WillGetData;
use Flarum\Api\Event\WillSerializeData;
use Flarum\Api\Serializer\ForumSerializer;
use Flarum\Event\GetApiRelationship;
use Flarum\Extend\ExtenderInterface;
use Flarum\Extension\Extension;
use Flarum\Settings\SettingsRepositoryInterface;
use Illuminate\Contracts\Container\Container;
class ForumAttributes implements ExtenderInterface
{
public function extend(Container $container, Extension $extension = null)
{
$container['events']->listen(WillSerializeData::class, [$this, 'loadRelationship']);
$container['events']->listen(GetApiRelationship::class, [$this, 'serializer']);
$container['events']->listen(WillGetData::class, [$this, 'includes']);
$container['events']->listen(Serializing::class, [$this, 'attributes']);
}
public function loadRelationship(WillSerializeData $event)
{
/**
* @var $fields FieldRepository
*/
$fields = app(FieldRepository::class);
if ($event->isController(ShowForumController::class)) {
// Fields need to be pre-loaded for the discussion composer, and also to be able to show empty fields on discussions
// We first try the permissions the users are most likely to have
if ($event->actor->can('raafirivero.mason.see-other-fields') || $event->actor->can('raafirivero.mason.fill-fields') || $event->actor->can('raafirivero.mason.see-own-fields')) {
$event->data['raafiriveroMasonFields'] = $fields->all();
} else {
// Fill empty set. Without this, installs with visible notices will get "Undefined index: raafiriveroMasonFields"
$event->data['raafiriveroMasonFields'] = [];
}
}
}
public function serializer(GetApiRelationship $event)
{
if ($event->isRelationship(ForumSerializer::class, 'raafiriveroMasonFields')) {
return $event->serializer->hasMany($event->model, FieldSerializer::class, 'raafiriveroMasonFields');
}
if ($event->isRelationship(ByTagSerializer::class, 'raafiriveroMasonByTags')) {
return $event->serializer->hasMany($event->model, ByTagSerializer::class, 'raafiriveroMasonByTags');
}
}
public function includes(WillGetData $event)
{
if ($event->controller->serializer === ForumSerializer::class) {
$event->addInclude('raafiriveroMasonFields');
$event->addInclude('raafiriveroMasonByTags');
$event->addInclude('raafiriveroMasonFields.suggested_answers');
}
}
public function attributes(Serializing $event)
{
if ($event->isSerializer(ForumSerializer::class)) {
/**
* @var $settings SettingsRepositoryInterface
*/
$settings = app(SettingsRepositoryInterface::class);
$canFill = $event->actor->can('raafirivero.mason.fill-fields');
$canSeeSome = $event->actor->can('raafirivero.mason.see-other-fields') || $event->actor->can('raafirivero.mason.see-own-fields');
if ($canFill || $canSeeSome) {
$event->attributes['raafirivero.mason.fields-section-title'] = $settings->get('raafirivero.mason.fields-section-title', '');
$event->attributes['raafirivero.mason.column-count'] = (int) $settings->get('raafirivero.mason.column-count', 1);
$event->attributes['raafirivero.mason.by-tag'] = (bool) $settings->get('raafirivero.mason.by-tag', false);
}
if ($canFill) {
$event->attributes['raafirivero.mason.labels-as-placeholders'] = (bool) $settings->get('raafirivero.mason.labels-as-placeholders', false);
$event->attributes['raafirivero.mason.tags-as-fields'] = (bool) $settings->get('raafirivero.mason.tags-as-fields', false);
$event->attributes['raafirivero.mason.tags-field-name'] = $settings->get('raafirivero.mason.tags-field-name', '');
}
if ($canSeeSome) {
$event->attributes['raafirivero.mason.fields-in-hero'] = (bool) $settings->get('raafirivero.mason.fields-in-hero', false);
$event->attributes['raafirivero.mason.hide-empty-fields-section'] = (bool) $settings->get('raafirivero.mason.hide-empty-fields-section', false);
}
$event->attributes['canFillRaafiRiveroMasonFields'] = $canFill;
}
}
}
| 0.996094 | high |
resources/views/template.blade.php | falihnaufal17/MEKO | 1 | 2404 | <reponame>falihnaufal17/MEKO
<!DOCTYPE html>
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, shrink-to-fit=no">
<title>MEKO - Reservation Resto Appp</title>
<link rel="icon" type="image/x-icon" href="assets/img/favicon.ico"/>
<!-- BEGIN GLOBAL MANDATORY STYLES -->
<link href="assets/css/loader.css" rel="stylesheet" type="text/css" />
<link href='https://fonts.googleapis.com/css?family=Open+Sans:400,600,700' rel='stylesheet' type='text/css'>
<link href="bootstrap/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
<link href="assets/css/plugins.css" rel="stylesheet" type="text/css" />
<!-- END GLOBAL MANDATORY STYLES -->
<!-- BEGIN PAGE LEVEL PLUGINS/CUSTOM STYLES -->
<link rel="stylesheet" type="text/css" href="plugins/table/datatable/datatables.css">
{{-- <link rel="stylesheet" type="text/css" href="plugins/table/datatable/custom_dt_zero_config.css"> --}}
<link rel="stylesheet" type="text/css" href="plugins/table/datatable/custom_dt_customer.css">
<link href="assets/css/default-dashboard/style.css" rel="stylesheet" type="text/css" />
<link href="plugins/animate/animate.css" rel="stylesheet" type="text/css" />
<link href="assets/css/modals/component.css" rel="stylesheet" type="text/css" />
<script src="plugins/sweetalerts/promise-polyfill.js"></script>
<link href="plugins/sweetalerts/sweetalert2.min.css" rel="stylesheet" type="text/css" />
<link href="scss/validation.css" rel="stylesheet"/>
<link href="plugins/dropzone/dropzone.min.css" rel="stylesheet" type="text/css" />
<link href="plugins/dropzone/basic.min.css" rel="stylesheet" type="text/css" />
<link href="plugins/file-upload/file-upload-with-preview.css" rel="stylesheet" type="text/css" />
<!-- END PAGE LEVEL PLUGINS/CUSTOM STYLES -->
@yield('style')
</head>
<body class="antialiased">
<input type="hidden" value="{{env('APP_URL')}}" name="base_url">
<!-- BEGIN NAVBAR -->
<header class="desktop-nav header navbar fixed-top">
<div class="nav-logo mr-sm-5 ml-sm-4">
<a href="javascript:void(0);" class="nav-link sidebarCollapse d-inline-block mr-sm-5" data-placement="bottom">
<i class="flaticon-menu-line-3"></i>
</a>
</div>
<ul class="navbar-nav flex-row ml-lg-auto">
<li class="nav-item dropdown user-profile-dropdown pl-4 pr-lg-0 pr-2 ml-lg-2 mr-lg-4 align-self-center">
<a href="javascript:void(0);" class="nav-link dropdown-toggle user">
<div class="user-profile d-lg-block d-none">
<img src="assets/img/90x90.jpg" id="logged-pict-nav" alt="admin-profile" class="img-fluid">
</div>
<i class="flaticon-user-7 d-lg-none d-block"></i>
</a>
</li>
</ul>
</header>
<!-- END NAVBAR -->
<!-- BEGIN MAIN CONTAINER -->
<div class="main-container" id="container">
<div class="overlay"></div>
<div class="ps-overlay"></div>
<div class="search-overlay"></div>
<!-- BEGIN MODERN -->
<div class="modernSidebar-nav header navbar">
<div class="">
<nav id="modernSidebar">
<ul class="menu-categories pl-0 m-0" id="topAccordion">
<li class="menu">
<a href="/admin/dashboard">
<div class="">
<i class="flaticon-computer-6"></i>
<span>Dashboard</span>
</div>
</a>
</li>
<li class="menu">
<a href="/admin/table">
<div class="">
<i class="flaticon-desk-chair"></i>
<span>Table</span>
</div>
</a>
</li>
<li class="menu">
<a href="/admin/menu">
<div class="">
<i class="flaticon-cutlery-1"></i>
<span>Menu</span>
</div>
</a>
</li>
<li class="menu">
<a href="/admin/employee">
<div class="">
<i class="flaticon-employees"></i>
<span>Employee</span>
</div>
</a>
</li>
<li class="menu">
<a href="#pages">
<div class="">
<i class="flaticon-bill"></i>
<span>Order</span>
</div>
</a>
</li>
</ul>
</nav>
</div>
</div>
<!-- END MODERN -->
<!-- BEGIN CONTENT PART -->
<div id="content" class="main-content">
<div id="eq-loader">
<div class="eq-loader-div">
<div class="eq-loading dual-loader mx-auto mb-5"></div>
</div>
</div>
<div class="container">
@yield('content')
<div class="md-overlay"></div>
</div>
</div>
<!-- END CONTENT PART -->
</div>
<!-- END MAIN CONTAINER -->
<!-- BEGIN PROFILE SIDEBAR -->
<aside class="profile-sidebar text-center">
<div class="profile-content profile-content-scroll">
<div class="usr-profile">
<img src="assets/img/90x90.jpg" id="logged-pict" class="img-fluid">
</div>
<p class="user-name mt-4 mb-4 text-capitalize" id="logged-name"><NAME></p>
<div class="user-links text-left">
<ul class="list-unstyled">
<li><a href="apps_mailbox.html"><i class="flaticon-mail-22"></i> Inbox</a></li>
<li><a href="user_profile.html"><i class="flaticon-user-11"></i> My Profile</a></li>
<li><a href="#" onclick="logout()"><i class="flaticon-power-off"></i> Logout</a></li>
</ul>
</div>
</div>
</aside>
<!-- BEGIN PROFILE SIDEBAR -->
<!-- BEGIN FOOTER -->
<footer class="footer-section theme-footer">
<div class="footer-section-1 sidebar-theme">
</div>
<div class="footer-section-2 container-fluid">
<div class="row">
<div class="col">
<ul class="list-inline mb-0 d-flex justify-content-between">
<li class="list-inline-item mr-3">
<p class="bottom-footer">© <?php echo date('Y') ?> <a target="_blank" href="https://designreset.com/equation">MEKO</a></p>
</li>
<li class="list-inline-item align-self-center">
<div class="scrollTop"><i class="flaticon-up-arrow-fill-1"></i></div>
</li>
</ul>
</div>
</div>
</div>
</footer>
<!-- END FOOTER -->
</body>
<!-- BEGIN GLOBAL MANDATORY SCRIPTS -->
<script src="assets/js/libs/jquery-3.1.1.min.js"></script>
<script src="bootstrap/js/popper.min.js"></script>
<script src="bootstrap/js/bootstrap.min.js"></script>
<script src="plugins/scrollbar/jquery.mCustomScrollbar.concat.min.js"></script>
<script src="plugins/blockui/jquery.blockUI.min.js"></script>
<script src="assets/js/app.js"></script>
<script>
$(document).ready(function() {
App.init();
});
</script>
<script src="plugins/table/datatable/datatables.js"></script>
<script src="assets/js/custom.js"></script>
<script src="assets/js/default-dashboard/default-custom.js"></script>
<script src="assets/js/modal/classie.js"></script>
<script src="assets/js/modal/modalEffects.js"></script>
<script src="plugins/sweetalerts/sweetalert2.min.js"></script>
<script src="plugins/dropzone/dropzone.min.js"></script>
<script src="plugins/dropzone/custom-dropzone.js"></script>
<script src="plugins/file-upload/file-upload-with-preview.js"></script>
<script>
let base_url = $('input[name=base_url]').val()
let profile = JSON.parse(localStorage.getItem('profile'))
function logout() {
localStorage.clear()
window.location.href = "/admin/login"
}
if(profile.image != null){
document.querySelector('#logged-pict').src = profile.image
document.querySelector('#logged-pict-nav').src = profile.image
}else{
document.querySelector('#logged-pict').src = "assets/img/90x90.jpg"
document.querySelector('#logged-pict-nav').src = "assets/img/90x90.jpg"
}
document.querySelector('#logged-name').innerHTML = profile.name
</script>
<script src="js/helper.js"></script>
<script src="assets/js/loader.js"></script>
@yield('script')
<!-- END GLOBAL MANDATORY SCRIPTS -->
</html>
| 0.957031 | high |
test/Petrovich/Petrovich/Ruleset/SingleCase/PrepositionalFemaleTest.php | medrobotex/petrovich-php | 0 | 2468 | <?php
namespace StaticallTest\Petrovich\Petrovich\Ruleset\SingleCase;
use StaticallTest\Petrovich\Petrovich\Ruleset\SingleCaseHelper;
use Staticall\Petrovich\Petrovich\Ruleset;
class PrepositionalFemaleTest extends SingleCaseHelper
{
const THIS_CASE = Ruleset::CASE_PREPOSITIONAL;
const THIS_GENDER = Ruleset::GENDER_FEMALE;
public function testNoExceptionsNoSuffixes()
{
$this->runTestNoExceptionsNoSuffixes(
'Тест',
'Тест',
static::THIS_CASE,
static::THIS_GENDER
);
}
public function testHasExceptionsGenderWrong1NoSuffixes()
{
$this->runTestHasExceptionsGenderWrong1NoSuffixes(
'Тест',
'Тест',
static::THIS_CASE,
static::THIS_GENDER
);
}
public function testHasExceptionsGenderWrong2NoSuffixes()
{
$this->runTestHasExceptionsGenderWrong2NoSuffixes(
'Тест',
'Тест',
static::THIS_CASE,
static::THIS_GENDER
);
}
public function testHasExceptionsCorrectGenderNoSuffixes()
{
$this->runTestHasExceptionsCorrectGenderNoSuffixes(
'Тест',
'Теьве',
static::THIS_CASE,
static::THIS_GENDER
);
}
public function testHasExceptionsCorrectGenderAfterIncorrectNoSuffixes()
{
$this->runTestHasExceptionsCorrectGenderAfterIncorrectNoSuffixes(
'Тест',
'Теьве',
static::THIS_CASE,
static::THIS_GENDER
);
}
public function testHasExceptionsAndSuffixes()
{
$this->runTestHasExceptionsAndSuffixes(
'Тест',
'Теьве',
static::THIS_CASE,
static::THIS_GENDER
);
}
public function testHasExceptionsAndSuffixesReverseOrder()
{
$this->runTestHasExceptionsAndSuffixesReverseOrder(
'Тест',
'Теьве',
static::THIS_CASE,
static::THIS_GENDER
);
}
public function testNoExceptionsHasSuffixes()
{
$this->runTestNoExceptionsHasSuffixes(
'Тест',
'Теьве',
static::THIS_CASE,
static::THIS_GENDER
);
}
public function testNoExceptionsHasSuffixesDotMod()
{
$this->runTestNoExceptionsHasSuffixesDotMod(
'Тест',
'Тест',
static::THIS_CASE,
static::THIS_GENDER
);
}
public function testIncorrectInputShouldReturnInput()
{
$this->runTestIncorrectInputShouldReturnInput(
'Неизвестно',
'Тест',
'Неизвестно',
static::THIS_CASE,
static::THIS_GENDER
);
}
}
| 0.988281 | high |
src/Elcodi/CartBundle/ElcodiCartEvents.php | pborreli/elcodi | 0 | 2532 | <?php
/**
* This file is part of the Elcodi package.
*
* Copyright (c) 2014 Elcodi.com
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
* @author ##author_placeholder
* @version ##version_placeholder##
*/
namespace Elcodi\CartBundle;
/**
* Core Events related with all core entities
*/
class ElcodiCartEvents
{
/**
* Cart events
*/
/**
* Cart check events
*/
/**
* This event is dispatched before the Cart is checked by the bundle
*
* event.name : cart.precheck
* event.class : CartPreCheckEvent
*/
const CART_PRECHECK = 'cart.precheck';
/**
* This event is dispatched when the Cart is checked by the bundle
*
* event.name : cart.oncheck
* event.class : CartOnCheckEvent
*/
const CART_ONCHECK = 'cart.oncheck';
/**
* This event is dispatched after the Cart is checked by the bundle
*
* event.name : cart.postcheck
* event.class : CartPostCheckEvent
*/
const CART_POSTCHECK = 'cart.postcheck';
/**
* Cart load events
*/
/**
* This event is dispatched before the Cart is loaded
*
* event.name : cart.preload
* event.class : CartPreLoadEvent
*/
const CART_PRELOAD = 'cart.preload';
/**
* This event is dispatched when the Cart is loaded
*
* event.name : cart.onload
* event.class : CartOnLoadEvent
*/
const CART_ONLOAD = 'cart.onload';
/**
* This event is dispatched after the Cart is loaded
*
* event.name : cart.postload
* event.class : CartPostLoadEvent
*/
const CART_POSTLOAD = 'cart.postload';
/**
* Order events
*/
/**
* Order created events
*/
/**
* This event is dispatched before an order is created
*
* event.name : order.precreated
* event.class : OrderPreCreatedEvent
*/
const ORDER_PRECREATED = 'order.precreated';
/**
* This event is dispatched when an order is created
*
* event.name : order.oncreated
* event.class : OrderOnCreatedEvent
*/
const ORDER_ONCREATED = 'order.oncreated';
/**
* This event is dispatched after an order is created
*
* event.name : order.postcreated
* event.class : OrderPostCreatedEvent
*/
const ORDER_POSTCREATED = 'order.postcreated';
/**
* Orderline created events
*/
/**
* This event is dispatched before an orderline is created
*
* event.name : orderline.precreated
* event.class : OrderLinePreCreatedEvent
*/
const ORDERLINE_PRECREATED = 'orderline.precreated';
/**
* This event is dispatched when an orderline is created
*
* event.name : orderline.oncreated
* event.class : OrderLineOnCreatedEvent
*/
const ORDERLINE_ONCREATED = 'orderline.oncreated';
/**
* This event is dispatched after an orderline is created
*
* event.name : orderline.postcreated
* event.class : OrderLinePostCreatedEvent
*/
const ORDERLINE_POSTCREATED = 'orderline.postcreated';
/**
* Order State change events
*/
/**
* This event is dispatched each time a new order state is added
*
* This event has, as first parameter an OrderChangedStatusEvent object
* having current Order object, last and current OrderHistoryObject
*
* event.name : orderstate.change
* event.class : OrderStatePreChangeEvent
*
*/
const ORDER_STATE_PRECHANGE = 'orderstate.prechange';
/**
* This event is dispatched each time a new order state is added
*
* This event has, as first parameter an OrderChangedStatusEvent object
* having current Order object, last and current OrderHistoryObject
*
* event.name : orderstate.onchange
* event.class : OrderStatePostChangeEvent
*
*/
const ORDER_STATE_POSTCHANGE = 'orderstate.postchange';
/**
* OrderLine State change events
*/
/**
* This event is dispatched before a new orderline state is added
*
* This event has, as first parameter an OrderLinePreChangedStatusEvent
* object having current OrderLine object, last and current
* OrderLineHistoryObject and last and current stats
*
* event.name : orderlinestate.prechange
* event.class : OrderLineStatePreChangeEvent
*
*/
const ORDERLINE_STATE_PRECHANGE = 'orderlinestate.prechange';
/**
* This event is dispatched before a new orderline state is added
*
* This event has, as first parameter an OrderLinePreChangedStatusEvent
* object having current OrderLine object, last and current
* OrderLineHistoryObject and last and current stats
*
* event.name : orderlinestate.postchange
* event.class : OrderLineStatePostChangeEvent
*
*/
const ORDERLINE_STATE_POSTCHANGE = 'orderlinestate.postchange';
}
| 0.996094 | high |
tests/Zend/Service/DeveloperGarden/BaseUserServiceTest.php | tomasfejfar/zf1 | 2 | 2596 | <?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to <EMAIL> so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Service_DeveloperGarden
* @subpackage UnitTests
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id$
*/
if (!defined('PHPUnit_MAIN_METHOD')) {
define('PHPUnit_MAIN_METHOD', 'Zend_Service_DeveloperGarden_BaseUserServiceTest::main');
}
/**
* @see Zend_Service_DeveloperGarden_BaseUserService
*/
require_once 'Zend/Service/DeveloperGarden/BaseUserService.php';
/**
* Zend_Service_DeveloperGarden test case
*
* @category Zend
* @package Zend_Service_DeveloperGarden
* @subpackage UnitTests
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id$
*/
class Zend_Service_DeveloperGarden_BaseUserServiceTest extends PHPUnit_Framework_TestCase
{
/**
* @todo add more tests for the ClientAbstract
*/
/**
* @var Zend_Service_DeveloperGarden_BaseUserService_Mock
*/
protected $_service = null;
protected $_limit = 10;
public static function main()
{
$suite = new PHPUnit_Framework_TestSuite(__CLASS__);
PHPUnit_TextUI_TestRunner::run($suite);
}
public function setUp()
{
if (!defined('TESTS_ZEND_SERVICE_DEVELOPERGARDEN_ONLINE_ENABLED') ||
TESTS_ZEND_SERVICE_DEVELOPERGARDEN_ONLINE_ENABLED !== true) {
$this->markTestSkipped('TESTS_ZEND_SERVICE_DEVELOPERGARDEN_ONLINE_ENABLED is not enabled');
}
if (!defined('TESTS_ZEND_SERVICE_DEVELOPERGARDEN_ONLINE_LOGIN')) {
define('TESTS_ZEND_SERVICE_DEVELOPERGARDEN_ONLINE_LOGIN', 'Unknown');
}
if (!defined('TESTS_ZEND_SERVICE_DEVELOPERGARDEN_ONLINE_PASSWORD')) {
define('TESTS_ZEND_SERVICE_DEVELOPERGARDEN_ONLINE_PASSWORD', 'Unknown');
}
$config = array(
'username' => TESTS_ZEND_SERVICE_DEVELOPERGARDEN_ONLINE_LOGIN,
'password' => <PASSWORD>,
);
$this->service = new Zend_Service_DeveloperGarden_BaseUserService_Mock($config);
}
public function testSmsQuotaSandbox()
{
$resp = $this->service->getSmsQuotaInformation(Zend_Service_DeveloperGarden_BaseUserService_Mock::ENV_SANDBOX);
$this->assertTrue($resp->isValid());
$this->assertFalse($resp->hasError());
}
public function testSmsQuotaProduction()
{
$resp = $this->service->getSmsQuotaInformation(Zend_Service_DeveloperGarden_BaseUserService_Mock::ENV_PRODUCTION);
$this->assertTrue($resp->isValid());
$this->assertFalse($resp->hasError());
}
public function testVoiceCallQuotaSandbox()
{
$resp = $this->service->getVoiceCallQuotaInformation(Zend_Service_DeveloperGarden_BaseUserService_Mock::ENV_SANDBOX);
$this->assertTrue($resp->isValid());
$this->assertFalse($resp->hasError());
}
public function testVoiceCallQuotaProduction()
{
$resp = $this->service->getVoiceCallQuotaInformation(Zend_Service_DeveloperGarden_BaseUserService_Mock::ENV_PRODUCTION);
$this->assertTrue($resp->isValid());
$this->assertFalse($resp->hasError());
}
public function testConfernceCallQuotaSandbox()
{
$resp = $this->service->getConfernceCallQuotaInformation(Zend_Service_DeveloperGarden_BaseUserService_Mock::ENV_SANDBOX);
$this->assertTrue($resp->isValid());
$this->assertFalse($resp->hasError());
}
public function testConfernceCallQuotaProduction()
{
$resp = $this->service->getConfernceCallQuotaInformation(Zend_Service_DeveloperGarden_BaseUserService_Mock::ENV_PRODUCTION);
$this->assertTrue($resp->isValid());
$this->assertFalse($resp->hasError());
}
public function testLocalSearchQuotaSandbox()
{
$resp = $this->service->getLocalSearchQuotaInformation(Zend_Service_DeveloperGarden_BaseUserService_Mock::ENV_SANDBOX);
$this->assertTrue($resp->isValid());
$this->assertFalse($resp->hasError());
}
public function testLocalSearchQuotaProduction()
{
$resp = $this->service->getLocalSearchQuotaInformation(Zend_Service_DeveloperGarden_BaseUserService_Mock::ENV_PRODUCTION);
$this->assertTrue($resp->isValid());
$this->assertFalse($resp->hasError());
}
public function testIPLocationQuotaSandbox()
{
$resp = $this->service->getIPLocationQuotaInformation(Zend_Service_DeveloperGarden_BaseUserService_Mock::ENV_SANDBOX);
$this->assertTrue($resp->isValid());
$this->assertFalse($resp->hasError());
}
public function testIPLocationQuotaProduction()
{
$resp = $this->service->getIPLocationQuotaInformation(Zend_Service_DeveloperGarden_BaseUserService_Mock::ENV_PRODUCTION);
$this->assertTrue($resp->isValid());
$this->assertFalse($resp->hasError());
}
public function testChangeSmsQuotaPoolProduction()
{
$this->service->changeSmsQuotaPool($this->_limit, Zend_Service_DeveloperGarden_BaseUserService_Mock::ENV_PRODUCTION);
}
public function testChangeSmsQuotaPoolSandbox()
{
$this->service->changeSmsQuotaPool($this->_limit, Zend_Service_DeveloperGarden_BaseUserService_Mock::ENV_SANDBOX);
}
public function testChangeVoiceCallQuotaPoolProduction()
{
$this->service->changeVoiceCallQuotaPool($this->_limit, Zend_Service_DeveloperGarden_BaseUserService_Mock::ENV_PRODUCTION);
}
public function testChangeVoiceCallQuotaPoolSandbox()
{
$this->service->changeVoiceCallQuotaPool($this->_limit, Zend_Service_DeveloperGarden_BaseUserService_Mock::ENV_SANDBOX);
}
public function testChangeIPLocationQuotaPoolProduction()
{
$this->service->changeIPLocationQuotaPool($this->_limit, Zend_Service_DeveloperGarden_BaseUserService_Mock::ENV_PRODUCTION);
}
public function testChangeIPLocationQuotaPoolSandbox()
{
$this->service->changeIPLocationQuotaPool($this->_limit, Zend_Service_DeveloperGarden_BaseUserService_Mock::ENV_SANDBOX);
}
public function testChangeConferenceCallQuotaPoolProduction()
{
$this->service->changeConferenceCallQuotaPool($this->_limit, Zend_Service_DeveloperGarden_BaseUserService_Mock::ENV_PRODUCTION);
}
public function testChangeConferenceCallQuotaPoolSandbox()
{
$this->service->changeConferenceCallQuotaPool($this->_limit, Zend_Service_DeveloperGarden_BaseUserService_Mock::ENV_SANDBOX);
}
public function testChangeLocalSearchQuotaPoolProduction()
{
$this->service->changeLocalSearchQuotaPool($this->_limit, Zend_Service_DeveloperGarden_BaseUserService_Mock::ENV_PRODUCTION);
}
public function testChangeLocalSearchQuotaPoolSandbox()
{
$this->service->changeLocalSearchQuotaPool($this->_limit, Zend_Service_DeveloperGarden_BaseUserService_Mock::ENV_SANDBOX);
}
public function testAccountBalance()
{
$result = $this->service->getAccountBalance();
$this->assertEquals('0000', $result->getErrorCode());
$this->assertType('array', $result->Account);
}
public function testAccountBalanceLoop()
{
$result = $this->service->getAccountBalance();
$this->assertEquals('0000', $result->getErrorCode());
$this->assertType('array', $result->Account);
foreach ($result->Account as $k => $v) {
$this->assertType(
'Zend_Service_DeveloperGarden_BaseUserService_AccountBalance',
$v
);
$this->assertType('string', $v->getAccount());
$this->assertType('integer', $v->getCredits());
}
}
}
class Zend_Service_DeveloperGarden_BaseUserService_Mock
extends Zend_Service_DeveloperGarden_BaseUserService
{
/**
* returns the correct module string
*
* @param string $module
* @param integer $environment
* @return string
*/
public function getBuildModuleString($module, $environment)
{
return $this->_buildModuleString($module, $environment);
}
public function checkModuleId($moduleId)
{
return $this->_checkModuleId($moduleId);
}
public function buildModuleString($module, $environment)
{
return $this->_buildModuleString($module, $environment);
}
}
if (PHPUnit_MAIN_METHOD == 'Zend_Service_DeveloperGarden_BaseUserServiceTest::main') {
Zend_Service_DeveloperGarden_BaseUserServiceTest::main();
}
| 0.996094 | high |
resources/views/services/big_data_analytics.blade.php | AlexSlayton/FulcrumPoint | 0 | 2660 | <reponame>AlexSlayton/FulcrumPoint<gh_stars>0
@extends ('layouts.master')
@section ('content')
<header class="serviceHero">
<div class="col-lg-12 serviceTopStyle">
<h1 class="section-heading">Big Data Analytics</h1>
</div>
</header>
<section>
<div class="container">
<div class="row">
<div class="col-lg-12 text-left">
<h3>Analytics & Data Intelligence</h3>
<p>We will help your team transform raw data into actionable intelligence. With a proven rapid approach to building data warehouses, reporting solutions, and transactional systems that interact with data, we can deliver valuable solutions quickly, just as we’ve done for over 1500 companies world wide.</p>
<br>
<h3>Hadoop Consulting & Development</h3>
<ul>
<li>Interactive Business Analytics</li>
<li>Search & Recommendation Engines</li>
<li>Data Mining, Data Aggregation, and Data Quality</li>
<li>Data Integration - web services and custom API</li>
<li>Algorithm Development for custom processes</li>
<li>Develop and re-engineering of business processes using Map-Reduce and NoSQL</li>
<li>Data and Spatial Visualization</li>
<li>Cluster Grams and History Flows</li>
<li>Forecasting and Predictive Analytics</li>
<li>Scoring, Pattern Search, and Rules Discovery</li>
<li>Data Integration with ERP and applications</li>
</ul>
<br>
<h3>Hadoop Design, Architecture, and Services</h3>
<ul>
<li>Technology Assessment</li>
<li>Architecture Strategy, Design, Roadmap</li>
<li>Proof of Value with Prototyping Development using Hadoop Tools</li>
<li>Performance and Scalability with Hadoop Cluster Deployments (HDFS)</li>
<li>Automation for Deployments, Administration, and Performance Monitoring</li>
<li>Implementation, Customization, and Optimization of Hadoop (Cloudera or Hortonworks)</li>
<li>Integration with RDBMS and BI Tools</li>
<li>Implementation Services on Hadoop ecosystem (Ambari, HBase, Hive, Sqoop, Pig, and etc.)</li>
</ul>
</div>
</div>
</div>
</section>
<section class="sectionColor">
<div class="jumbotron">
<div class="connectMain">
<div class="col-lg-12 text-center sr-contact">
<i class="fa fa-4x fa-envelope text-primary sr-icons" aria-hidden="true"></i>
<h2 class="section-heading">Let's Connect Today</h2>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque vel porta purus. Aliquam in elit quis neque fringilla mollis quis quis lacus. Proin ac dapibus felis, hendrerit semper purus. </p>
<div class="viewMoreBtn">
<a class="btn btn-primary btn-xl sr-button" style="color: white; box-shadow: none;" href="/contact">Contact</a>
</div>
</div>
</div>
</div>
</section>
@endsection | 0.933594 | high |
config/koneksi.php | didiksazali/perpustakaan | 0 | 2724 | <?php
$host = "localhost";
$user = "root";
$password = "";
$database = "perpustakaan";
$today = date("Y-m-d");
$now = strtotime($today);
$aweek = date("Y-m-j", strtotime("+7 day", $now));
$koneksi = mysqli_connect($host, $user, $password, $database);
if (mysqli_connect_errno($koneksi)) {
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
?>
| 0.789063 | low |
application/views/admin_layout/login.php | HariKishoreP/Mahendra | 0 | 2788 | <reponame>HariKishoreP/Mahendra<filename>application/views/admin_layout/login.php
<!DOCTYPE html>
<html lang="en">
<!-- Mirrored from themes.startbootstrap.com/flex-admin-v1.2/login.html by HTTrack Website Copier/3.x [XR&CO'2014], Tue, 01 Sep 2015 07:01:56 GMT -->
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="">
<meta name="author" content="">
<title>99 Right Deals :: Admin Login</title>
<!-- PAGE LEVEL PLUGIN STYLES -->
<!-- THEME STYLES -->
<link href="<?php echo base_url(); ?>admin_template_files/css/bootstrap1.min.css" rel="stylesheet">
<link href="<?php echo base_url(); ?>admin_template_files/css/loginstyle.css" rel="stylesheet">
</head>
<body class="login">
<div class="container">
<div class="row">
<div class="col-md-4 col-md-offset-4">
<div class="login-banner text-center">
<h1><i class="fa fa-gears"></i>99 Right Deals</h1>
</div>
<div class="portlet portlet-green">
<div class="portlet-heading login-heading">
<div class="portlet-title">
<h4><strong>Login to Classifieds</strong>
</h4>
</div>
<div class="clearfix"></div>
</div>
<div class="portlet-body">
<form accept-charset="UTF-8" role="form" method='post' action="">
<fieldset>
<?php $this->load->view("admin/success_error");?>
<div class="form-group">
<input class="form-control" placeholder="E-mail" name="email" type="email" value="<?php echo set_value('email');?>">
<?php echo form_error('email');?>
</div>
<div class="form-group">
<input class="form-control" placeholder="Password" name="password" type="password" value="">
<?php echo form_error('password');?>
</div>
<!--
<div class="checkbox">
<label>
<input name="remember" type="checkbox" value="Remember Me">Remember Me
</label>
</div>
-->
<br>
<input type="submit" class="btn btn-lg btn-green btn-block" value="Sign In" name='sign_in'/>
</fieldset>
<br>
<p class="small">
<a href="#">Forgot your password?</a>
</p>
</form>
</div>
</div>
</div>
</div>
</div>
<!-- GLOBAL SCRIPTS -->
<script src="<?php echo $this->config->item('admin_assets_url');?>js/jquery.min.js"></script>
<script src="<?php echo $this->config->item('admin_assets_url');?>js/plugins/bootstrap/bootstrap.min.js"></script>
<script src="<?php echo $this->config->item('admin_assets_url');?>js/plugins/slimscroll/jquery.slimscroll.min.js"></script>
<!-- HISRC Retina Images -->
<script src="<?php echo $this->config->item('admin_assets_url');?>js/plugins/hisrc/hisrc.js"></script>
<!-- PAGE LEVEL PLUGIN SCRIPTS -->
<!-- THEME SCRIPTS -->
<script src="<?php echo $this->config->item('admin_assets_url');?>js/flex.js"></script>
<script>
$(function(){
/* Not to allow special characters for email */
$('input[type="email"]').keyup(function()
{
var yourInput = $(this).val();
re = /[` ~!#$%^&*()|+\-=?;:'",<>\{\}\[\]\\\/]/gi;
var isSplChar = re.test(yourInput);
if(isSplChar)
{
var no_spl_char = yourInput.replace(/[` ~!#$%^&*()|+\-=?;:'",<>\{\}\[\]\\\/]/gi, '');
$(this).val(no_spl_char);
}
});
});
</script>
</body>
<!-- Mirrored from themes.startbootstrap.com/flex-admin-v1.2/login.html by HTTrack Website Copier/3.x [XR&CO'2014], Tue, 01 Sep 2015 07:01:56 GMT -->
</html>
| 0.707031 | high |
src/Domain/Response/Getnet/ResponseFactory.php | d-rafael-santos/payment-api | 0 | 2852 | <?php
/**
* Criado por: <NAME>
* Data: 27/10/2020
* Hora: 10 : 35
*/
declare(strict_types=1);
namespace Mercatus\PaymentApi\Domain\Response\Getnet;
use JsonException;
use Mercatus\PaymentApi\Domain\Response\Getnet\Exceptions\UnexpectedResponseException;
use Mercatus\PaymentApi\Domain\ResponseInterface;
class ResponseFactory
{
/**
* @param string $json
* @return ResponseInterface
* @throws UnexpectedResponseException
*/
public static function createFromJsonString(string $json): ResponseInterface
{
try {
$array = json_decode($json, true, 512, JSON_THROW_ON_ERROR);
} catch (JsonException $e) {
throw new UnexpectedResponseException("$json não é um json válido", 400);
}
if (isset($array['status']) && $array['status'] === 'APPROVED') {
$message = 'Aprovado';
return new SuccessResponse($message, $json);
}
if (isset($array['message'])) {
return new FailureResponse((int) $array['status_code'], $array['message'], $json);
}
throw new UnexpectedResponseException('Não foi possível criar um ResponseInterface com o json' . $json);
}
}
| 0.992188 | high |
application/views/datos/editar.php | MonoKu2014/iso | 0 | 2916 | <reponame>MonoKu2014/iso
<div class="container-fluid">
<ol class="breadcrumb">
<li><a href="<?= base_url();?>panel">Dashboard</a></li>
<li>Parámetros</li>
<li>Indicadores</li>
<li><a href="<?= base_url();?>datos">Datos</a></li>
<li class="active">Editar</li>
</ol>
<div class="row">
<div class="col-lg-12">
<h2 class="page-header">
Editar Dato
<a href="<?= base_url(); ?>datos" class="btn btn-default pull-right">
<i class="fa fa-chevron-left"></i> Volver
</a>
</h2>
</div>
</div>
<div class="row">
<div class="col-lg-12">
<form method="post" action="<?= base_url(); ?>datos/guardar_edicion" class="form">
<div class="row">
<div class="col-xs-12 col-lg-10 col-lg-offset-1">
<p><em>Todos los campos marcados con (*) son de caracter obligatorio</em></p>
<p id="message"></p>
<input type="hidden" name="dato_id" value="<?= $dato->dato_id; ?>">
<div class="col-xs-12 col-sm-6 col-md-3 bg-info information">
Código (*)
</div>
<div class="col-xs-12 col-sm-6 col-md-9">
<div class="form-group">
<input type="text" name="codigo" data-validate="string" class="form-control required" placeholder="Código" required value="<?= $dato->dato_codigo; ?>">
</div>
</div>
<div class="col-xs-12 col-sm-6 col-md-3 bg-info information">
Área (*)
</div>
<div class="col-xs-12 col-sm-6 col-md-9">
<div class="form-group">
<select class="form-control required" name="area" required data-validate="number" id="area">
<option value="">Seleccione área...</option>
<?php foreach ($areas as $a): ?>
<option <?php if($dato->area_fk == $a->area_id){ echo 'selected'; } ?> value="<?= $a->area_id; ?>"><?= $a->area; ?></option>
<?php endforeach ?>
</select>
</div>
</div>
<div class="col-xs-12 col-sm-6 col-md-3 bg-info information">
Sección (*)
</div>
<div class="col-xs-12 col-sm-6 col-md-9">
<div class="form-group">
<select class="form-control required" name="seccion" required data-validate="number" id="seccion">
<option value="<?= $dato->seccion_fk; ?>"><?= $dato->seccion; ?></option>
</select>
</div>
</div>
<div class="col-xs-12 col-sm-6 col-md-3 bg-info information">
Proceso (*)
</div>
<div class="col-xs-12 col-sm-6 col-md-9">
<div class="form-group">
<select class="form-control required" name="proceso" required data-validate="number" id="proceso">
<option value="<?= $dato->proceso_fk; ?>"><?= $dato->proceso_nombre; ?></option>
</select>
</div>
</div>
<div class="col-xs-12 col-sm-6 col-md-3 bg-info information">
Nombre del dato (*)
</div>
<div class="col-xs-12 col-sm-6 col-md-9">
<div class="form-group">
<input type="text" name="nombre" data-validate="string" class="form-control required" placeholder="Nombre del dato" required value="<?= $dato->dato_nombre; ?>">
</div>
</div>
<div class="col-xs-12 col-sm-6 col-md-3 bg-info information">
Tipo de dato (*)
</div>
<div class="col-xs-12 col-sm-6 col-md-9">
<div class="form-group">
<select class="form-control required" name="tipo" required data-validate="number" id="tipo">
<option value="">Seleccione tipo de dato...</option>
<?php foreach ($tipos_datos as $t): ?>
<option <?php if($dato->tipo_dato_fk == $t->tipo_dato_id){ echo 'selected'; } ?> value="<?= $t->tipo_dato_id; ?>"><?= $t->tipo_dato; ?></option>
<?php endforeach ?>
</select>
</div>
</div>
<div class="row">
<div class="col-xs-12 col-sm-6 col-md-12">
<button type="submit" class="btn btn-success save">Guardar</button>
<a href="<?= base_url(); ?>datos" class="btn btn-default">Cancelar</a>
</div>
</div>
</div>
</div>
</form>
</div>
</div>
</div>
<script>
$('#area').on('change', function(){
var area = $(this).val();
$('#proceso').empty().html('<option value="">Seleccione proceso...</option>');
$.get(_URL + 'ajax/secciones_por_area/' + area, function(data){
$('#seccion').html(data);
});
});
$('#seccion').on('change', function(){
var seccion = $(this).val();
$.get(_URL + 'ajax/procesos_por_seccion/' + seccion, function(data){
$('#proceso').html(data);
});
});
</script> | 0.90625 | high |
application/third_party/PHPEpp/Protocols/EPP/eppExtensions/sidn-ext-epp-1.0/eppRequests/sidnEppCreateContactRequest.php | aasiimweDataCare/dev_epp | 0 | 2980 | <filename>application/third_party/PHPEpp/Protocols/EPP/eppExtensions/sidn-ext-epp-1.0/eppRequests/sidnEppCreateContactRequest.php
<?php
namespace Metaregistrar\EPP;
/*
<extension>
<sidn-ext-epp:ext>
<sidn-ext-epp:create>
<sidn-ext-epp:contact>
<sidn-ext-epp:legalForm>BV</sidn-ext-epp:legalForm>
<sidn-ext-epp:legalFormRegNo>8764654.0</sidn-ext-epp:legalFormRegNo>
</sidn-ext-epp:contact>
</sidn-ext-epp:create>
</sidn-ext-epp:ext>
</extension>
*/
class sidnEppCreateContactRequest extends eppCreateContactRequest {
function __construct($createinfo) {
parent::__construct($createinfo);
if ($createinfo instanceof eppContact) {
$this->addSidnExtension($createinfo);
}
$this->addSessionId();
}
private function addSidnExtension(eppContact $contact) {
$postal = $contact->getPostalInfo(0);
if (strlen($postal->getOrganisationName())) {
$legalform = 'ANDERS';
} else {
$legalform= 'PERSOON';
}
$sidnext = $this->createElement('sidn-ext-epp:ext');
$create = $this->createElement('sidn-ext-epp:create');
$contact = $this->createElement('sidn-ext-epp:contact');
$contact->appendChild($this->createElement('sidn-ext-epp:legalForm', $legalform));
#$contact->appendChild($this->createElement('sidn-ext-epp:legalFormRegNo','8764654.0'));
$create->appendChild($contact);
$sidnext->appendChild($create);
$this->getExtension()->appendChild($sidnext);
}
} | 0.980469 | high |
module/User/src/Entity/RequestState.php | shilpabharamanaik/shilpazend3Fisdap | 0 | 3044 | <?php namespace User\Entity;
use Doctrine\ORM\Mapping\Column;
use Doctrine\ORM\Mapping\Entity;
use Doctrine\ORM\Mapping\GeneratedValue;
use Doctrine\ORM\Mapping\Id;
use Doctrine\ORM\Mapping\Table;
/**
* Request State
*
* @Entity
* @Table(name="fisdap2_request_state")
*/
class RequestState extends EntityBaseClass
{
/**
* @var integer
* @Id
* @Column(type="integer")
* @GeneratedValue
*/
protected $id;
/**
* @var string
* @Column(type="string")
*/
protected $name;
/**
* @var string
* @Column(type="string")
*/
protected $action;
}
| 0.988281 | high |
End of preview. Expand
in Dataset Viewer.
README.md exists but content is empty.
Use the Edit dataset card button to edit it.
- Downloads last month
- 0