Subiendo proyecto completo sin restricciones de git ignore

This commit is contained in:
Jose Sanchez
2023-08-17 11:44:02 -04:00
parent a0d4f5ba3b
commit 20f1c60600
19921 changed files with 2509159 additions and 45 deletions

View File

@@ -0,0 +1,82 @@
<?php
namespace MehediIitdu\CoreComponentRepository;
use App\Models\Addon;
use Cache;
class CoreComponentRepository
{
public static function instantiateShopRepository() {
$data['url'] = $_SERVER['SERVER_NAME'];
$request_data_json = json_encode($data);
$gate = "https://activation.activeitzone.com/check_activation";
$rn = self::serializeObjectResponse($gate, $request_data_json);
self::finalizeRepository($rn);
}
protected static function serializeObjectResponse($zn, $request_data_json) {
$header = array(
'Content-Type:application/json'
);
$stream = curl_init();
curl_setopt($stream, CURLOPT_URL, $zn);
curl_setopt($stream, CURLOPT_HTTPHEADER, $header);
curl_setopt($stream, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($stream, CURLOPT_RETURNTRANSFER, true);
curl_setopt($stream, CURLOPT_POSTFIELDS, $request_data_json);
curl_setopt($stream, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($stream, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4);
$rn = curl_exec($stream);
curl_close($stream);
return $rn;
}
protected static function finalizeRepository($rn) {
if($rn == "bad" && env('DEMO_MODE') != 'On') {
return redirect('https://activeitzone.com/activation/')->send();
}
}
public static function initializeCache() {
foreach(Addon::all() as $addon){
if ($addon->purchase_code == null) {
self::finalizeCache($addon);
}
$item_name = get_setting('item_name') ?? 'ecommerce';
if(Cache::get($addon->unique_identifier.'-purchased', 'no') == 'no'){
try {
$gate = "https://activeitzone.com/activation/addon_check/".$addon->unique_identifier."/".$addon->purchase_code."/".$item_name;
$stream = curl_init();
curl_setopt($stream, CURLOPT_URL, $gate);
curl_setopt($stream, CURLOPT_HEADER, 0);
curl_setopt($stream, CURLOPT_RETURNTRANSFER, 1);
$rn = curl_exec($stream);
curl_close($stream);
if($rn == 'no') {
self::finalizeCache($addon);
}
else{
Cache::rememberForever($addon->unique_identifier.'-purchased', function () {
return 'yes';
});
}
} catch (\Exception $e) {
}
}
}
}
public static function finalizeCache($addon){
$addon->activated = 0;
$addon->save();
flash('Please reinstall '.$addon->name.' using valid purchase code')->warning();
return redirect()->route('addons.index')->send();
}
}

View File

@@ -0,0 +1,21 @@
<?php
namespace MehediIitdu\CoreComponentRepository;
use Illuminate\Support\Facades\Facade;
/**
* @see \MehediIitdu\CoreComponentRepository\Skeleton\SkeletonClass
*/
class CoreComponentRepositoryFacade extends Facade
{
/**
* Get the registered name of the component.
*
* @return string
*/
protected static function getFacadeAccessor()
{
return 'core-component-repository';
}
}

View File

@@ -0,0 +1,60 @@
<?php
namespace MehediIitdu\CoreComponentRepository;
use Illuminate\Support\ServiceProvider;
class CoreComponentRepositoryServiceProvider extends ServiceProvider
{
/**
* Bootstrap the application services.
*/
public function boot()
{
/*
* Optional methods to load your package assets
*/
// $this->loadTranslationsFrom(__DIR__.'/../resources/lang', 'core-component-repository');
// $this->loadViewsFrom(__DIR__.'/../resources/views', 'core-component-repository');
// $this->loadMigrationsFrom(__DIR__.'/../database/migrations');
// $this->loadRoutesFrom(__DIR__.'/routes/web.php');
if ($this->app->runningInConsole()) {
$this->publishes([
__DIR__.'/../config/config.php' => config_path('core-component-repository.php'),
], 'config');
// Publishing the views.
/*$this->publishes([
__DIR__.'/../resources/views' => resource_path('views/vendor/core-component-repository'),
], 'views');*/
// Publishing assets.
/*$this->publishes([
__DIR__.'/../resources/assets' => public_path('vendor/core-component-repository'),
], 'assets');*/
// Publishing the translation files.
/*$this->publishes([
__DIR__.'/../resources/lang' => resource_path('lang/vendor/core-component-repository'),
], 'lang');*/
// Registering package commands.
// $this->commands([]);
}
}
/**
* Register the application services.
*/
public function register()
{
// Automatically apply the package configuration
$this->mergeConfigFrom(__DIR__.'/../config/config.php', 'core-component-repository');
// Register the main class to use with the facade
$this->app->singleton('core-component-repository', function () {
return new CoreComponentRepository;
});
}
}