Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "mehedi-iitdu/core-component-repository",
"name": "isaacongoma/core-component-repository",
"description": "My awesome package",
"keywords": [
"mehedi-iitdu",
Expand All @@ -16,12 +16,11 @@
}
],
"require": {
"php": "^7.1",
"illuminate/support": "6.*",
"guzzlehttp/guzzle": "5.*|6.*"
"php": "^7.3|^7.4|^8.0",
"illuminate/support": "*"
},
"require-dev":{
"phpunit/phpunit" : "4.*",
"phpunit/phpunit" : "*",
"scrutinizer/ocular": "~1.1",
"satooshi/php-coveralls": "^0.7.0",
"mockery/mockery": ">=0.7.2",
Expand Down
74 changes: 59 additions & 15 deletions src/CoreComponentRepository.php
Original file line number Diff line number Diff line change
@@ -1,31 +1,75 @@
<?php

namespace MehediIitdu\CoreComponentRepository;
use App\Models\Addon;
use Cache;

class CoreComponentRepository
{
public static function instantiateShopRepository() {
$gate = "https://activeitzone.com/check/index.php/home/check_l/".$_SERVER['SERVER_NAME'];
$rn = self::serializeObjectResponse($gate);
self::finalizeRepository($rn);
// $url = $_SERVER['SERVER_NAME'];
// $gate = "http://206.189.81.181/check_activation/".$url;
// $rn = self::serializeObjectResponse($gate);
// self::finalizeRepository($rn);
}

protected static function serializeObjectResponse($zn) {
$stream = curl_init();
curl_setopt($stream, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($stream, CURLOPT_SSL_VERIFYHOST, 2);
curl_setopt($stream, CURLOPT_URL, $zn);
curl_setopt($stream, CURLOPT_HEADER, 0);
curl_setopt($stream, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($stream, CURLOPT_POST, 1);
$rn = curl_exec($stream);
curl_close($stream);
return $rn;
// $stream = curl_init();
// curl_setopt($stream, CURLOPT_URL, $zn);
// curl_setopt($stream, CURLOPT_HEADER, 0);
// curl_setopt($stream, CURLOPT_RETURNTRANSFER, 1);
// curl_setopt($stream, CURLOPT_POST, 1);
// $rn = curl_exec($stream);
// curl_close($stream);
// return $rn;
}

protected static function finalizeRepository($rn) {
if($rn != 'nice') {
return redirect('https://activeitzone.com/check/')->send();
// 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);
}

if(Cache::get($addon->unique_identifier.'-purchased', 'no') == 'no'){
// try {
// $gate = "https://activeitzone.com/activation/check/".$addon->unique_identifier."/".$addon->purchase_code;

// $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);
$rn = 'no';
if($rn == 'no') {
self::finalizeCache($addon);
Cache::rememberForever($addon->unique_identifier.'-purchased', function () {
return 'yes';
});
}
// 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();
}
}
2 changes: 1 addition & 1 deletion src/CoreComponentRepositoryServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public function boot()
// $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.php');
// $this->loadRoutesFrom(__DIR__.'/routes/web.php');

if ($this->app->runningInConsole()) {
$this->publishes([
Expand Down