Commit 5226c756 by Aan Choesni Herlingga

updater

parent 4164b4c1
......@@ -38,4 +38,33 @@ class InseoHelper
return $full;
}
public static function inseoencrypt($str, $kunci = 'asd')
{
$hasil = '';
for ($i = 0; $i < strlen($str); ++$i) {
$karakter = substr($str, $i, 1);
$kuncikarakter = substr($kunci, ($i % strlen($kunci)) - 1, 1);
$karakter = chr(ord($karakter) + ord($kuncikarakter));
$hasil .= $karakter;
}
return urlencode(base64_encode($hasil));
}
public static function inseodecrypt($str, $kunci = 'asd')
{
$str = base64_decode(urldecode($str));
$hasil = '';
for ($i = 0; $i < strlen($str); ++$i) {
$karakter = substr($str, $i, 1);
$kuncikarakter = substr($kunci, ($i % strlen($kunci)) - 1, 1);
$karakter = chr(ord($karakter) - ord($kuncikarakter));
$hasil .= $karakter;
}
return $hasil;
}
}
<?php
namespace App\Http\Controllers\Webprofile\Backend;
use App\Helpers\InseoHelper;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
class UpdateController extends Controller
{
public function index()
{
return view('webprofile.backend.update.index');
}
public function update(Request $request)
{
$username = env('GIT_USERNAME', 'lorem');
$password = InseoHelper::inseodecrypt(env('GIT_PASSWORD', 'lorem'), env('ENCRYPT_KEY', 'lorem'));
$repository = env('GIT_REPOSITORY', 'lorem');
$command = 'git pull http://'.$username.':'.$password.'@'.$repository.' master';
$data = $request->tokenkey;
$line = 'Token Tidak Valid';
if ($data == env('TOKEN_KEY', 'lorem')) {
$line = null;
$result = array();
exec($command, $result);
foreach ($result as $line) {
$line."\n";
}
if ($line == null) {
$line = 'Whoops something when wrong!! Check your username and password';
}
}
$data = [
'data' => $line,
];
return view('webprofile.backend.update.result', $data);
}
}
@extends('webprofile.backend.layouts.master')
@section('assets')
<link rel="stylesheet" href="{!! asset('backend/js/datatables.net-bs/css/dataTables.bootstrap.min.css') !!}">
<meta name="csrf-token" content="{{ csrf_token() }}">
@endsection
@section('title')
Update Engine Website
@stop
@section('breadcrumbs')
<li><a href="{{ url('dashboard') }}">@lang('label.dashboard')</a></li>
<li class="active">@lang('feature.slider')</li>
@stop
@section('content')
<!-- page start-->
<div class="row">
<div class="col-lg-12">
<!-- START DEFAULT DATATABLE -->
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">Update Engine Website</h3>
<ul class="panel-controls">
<li><a href="#" class="panel-collapse"><span class="fa fa-angle-down"></span></a></li>
</ul>
</div>
<div class="panel-body">
{!! Form::open(['url' => route('update.now'), 'method' => 'POST', 'id' => 'update', 'class' => 'form-horizontal']) !!}
{!! csrf_field() !!}
{{ Form::hidden('tokenkey', '1p12p23t35147u51n62373s854970') }}
<button type="submit" class="btn btn-info" style="margin: 0cm 0px 0cm 10px;">Update</button>
{!! Form::close() !!}
</div>
</div>
<!-- END DEFAULT DATATABLE -->
</div>
</div>
<!-- page end-->
@stop
@section('script')
<script src="{!!asset('backend/js/datatables.net/js/jquery.dataTables.min.js') !!}"></script>
<script src="{!!asset('backend/js/datatables.net-bs/js/dataTables.bootstrap.min.js') !!}"></script>
<script src="{{ url('backend/assets/plugins/jquery-datatable/buttons/dataTables.buttons.min.js') }}"></script>
<script src="{{ url('backend/assets/plugins/jquery-datatable/buttons/buttons.bootstrap4.min.js') }}"></script>
<script src="{{ url('backend/assets/plugins/jquery-datatable/buttons/buttons.colVis.min.js') }}"></script>
<script src="{{ url('backend/assets/plugins/jquery-datatable/buttons/buttons.html5.min.js') }}"></script>
<script src="{{ url('backend/assets/plugins/jquery-datatable/buttons/buttons.print.min.js') }}"></script>
<script>
var url = "{{ route('sliders.index') }}";
</script>
{{ Html::script('js/master/slider.js') }}
@stop
@extends('webprofile.backend.layouts.master')
@section('assets')
<link rel="stylesheet" href="{!! asset('backend/js/datatables.net-bs/css/dataTables.bootstrap.min.css') !!}">
<meta name="csrf-token" content="{{ csrf_token() }}">
@endsection
@section('title')
Update Engine Website
@stop
@section('breadcrumbs')
<li><a href="{{ url('dashboard') }}">@lang('label.dashboard')</a></li>
<li class="active">@lang('feature.slider')</li>
@stop
@section('content')
<!-- page start-->
<div class="row">
<div class="col-lg-12">
<!-- START DEFAULT DATATABLE -->
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">Update Engine Website</h3>
<ul class="panel-controls">
<li><a href="#" class="panel-collapse"><span class="fa fa-angle-down"></span></a></li>
</ul>
</div>
<div class="panel-body">
{!! Form::open(['url' => route('update.now'), 'method' => 'POST', 'id' => 'update', 'class' => 'form-horizontal']) !!}
{!! csrf_field() !!}
{{ Form::hidden('tokenkey', '1p12p23t35147u51n62373s854970') }}
<button type="submit" class="btn btn-info" style="margin: 0cm 0px 0cm 10px;">Update</button>
{!! Form::close() !!}
<div style="padding-left: 10px; padding-top: 15px;">
{{ $data }}
</div>
</div>
</div>
<!-- END DEFAULT DATATABLE -->
</div>
</div>
<!-- page end-->
@stop
@section('script')
<script src="{!!asset('backend/js/datatables.net/js/jquery.dataTables.min.js') !!}"></script>
<script src="{!!asset('backend/js/datatables.net-bs/js/dataTables.bootstrap.min.js') !!}"></script>
<script src="{{ url('backend/assets/plugins/jquery-datatable/buttons/dataTables.buttons.min.js') }}"></script>
<script src="{{ url('backend/assets/plugins/jquery-datatable/buttons/buttons.bootstrap4.min.js') }}"></script>
<script src="{{ url('backend/assets/plugins/jquery-datatable/buttons/buttons.colVis.min.js') }}"></script>
<script src="{{ url('backend/assets/plugins/jquery-datatable/buttons/buttons.html5.min.js') }}"></script>
<script src="{{ url('backend/assets/plugins/jquery-datatable/buttons/buttons.print.min.js') }}"></script>
<script>
var url = "{{ route('sliders.index') }}";
</script>
{{ Html::script('js/master/slider.js') }}
@stop
......@@ -7,6 +7,9 @@ Route::group(['middleware' => 'auth'], function () {
Route::patch('users_status/{id}', 'UserController@status')->name('user.status');
});
Route::get('update', 'Webprofile\Backend\UpdateController@index')->name('update');
Route::post('update', 'Webprofile\Backend\UpdateController@update')->name('update.now');
});
Route::group(['middleware' => 'role:admin|editor'], function () {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment