| @@ -3,8 +3,6 @@ | ||
| 3 | 3 | namespace App\Http\Controllers\Api; | 
| 4 | 4 | |
| 5 | 5 | use Illuminate\Http\Request; | 
| 6 | - | |
| 7 | -use App\Http\Requests; | |
| 8 | 6 | use App\Http\Controllers\Controller; | 
| 9 | 7 | use Exception; | 
| 10 | 8 | use App\Model\Order\Order; | 
| @@ -22,7 +22,7 @@ | ||
| 22 | 22 | $orders = new Order(); | 
| 23 | 23 |              $order = $orders->where('domain',$domain)->first(); | 
| 24 | 24 |              if($order){ | 
| 25 | - $result = "success"; | |
| 25 | + $result = "success"; | |
| 26 | 26 | } | 
| 27 | 27 |              return response()->json(compact('result')); | 
| 28 | 28 |          } catch (Exception $ex) { | 
| @@ -11,17 +11,17 @@ | ||
| 11 | 11 | |
| 12 | 12 | class ApiController extends Controller | 
| 13 | 13 |  { | 
| 14 | -    public function checkDomain(Request $request){ | |
| 15 | -        try{ | |
| 14 | +    public function checkDomain(Request $request) { | |
| 15 | +        try { | |
| 16 | 16 | $result = "fails"; | 
| 17 | 17 |              $domain = $request->input('url'); | 
| 18 | 18 | |
| 19 | 19 |              if (ends_with($domain, '/')) { | 
| 20 | - $domain = substr_replace($domain,"", -1, 1); | |
| 20 | + $domain = substr_replace($domain, "", -1, 1); | |
| 21 | 21 | } | 
| 22 | 22 | $orders = new Order(); | 
| 23 | -            $order = $orders->where('domain',$domain)->first(); | |
| 24 | -            if($order){ | |
| 23 | +            $order = $orders->where('domain', $domain)->first(); | |
| 24 | +            if ($order) { | |
| 25 | 25 | $result = "success"; | 
| 26 | 26 | } | 
| 27 | 27 |              return response()->json(compact('result')); | 
| @@ -316,6 +316,9 @@ discard block | ||
| 316 | 316 | } | 
| 317 | 317 | } | 
| 318 | 318 | |
| 319 | + /** | |
| 320 | + * @param string $result | |
| 321 | + */ | |
| 319 | 322 |      public function submit($result, $url) { | 
| 320 | 323 | echo "<form action=$url method=post name=redirect>"; | 
| 321 | 324 | echo '<input type=hidden name=_token value=csrf_token()/>'; | 
| @@ -390,6 +393,9 @@ discard block | ||
| 390 | 393 | } | 
| 391 | 394 | } | 
| 392 | 395 | |
| 396 | + /** | |
| 397 | + * @param string $data | |
| 398 | + */ | |
| 393 | 399 |      public static function encryptByPublicKey($data) { | 
| 394 | 400 | $path = storage_path() . DIRECTORY_SEPARATOR . 'app' . DIRECTORY_SEPARATOR . 'public.key'; | 
| 395 | 401 | //dd($path); | 
| @@ -57,7 +57,7 @@ discard block | ||
| 57 | 57 | } | 
| 58 | 58 | |
| 59 | 59 | echo "<form action=$url method=post name=redirect >"; | 
| 60 | - echo '<input type=hidden name=_token value=' . csrf_token() . '>'; | |
| 60 | + echo '<input type=hidden name=_token value='.csrf_token().'>'; | |
| 61 | 61 | echo "<input type=hidden name=value value=$version />"; | 
| 62 | 62 | echo '</form>'; | 
| 63 | 63 | echo"<script language='javascript'>document.redirect.submit();</script>"; | 
| @@ -128,7 +128,7 @@ discard block | ||
| 128 | 128 |          try { | 
| 129 | 129 |              //$encrypted = p¥Ùn¿olÓ¥9)OÞݸÔvh§=Ìtt1rkC‰É§%YœfÐS\BâkHW€mùÌØg¹+VŠ¥²?áÙ{/<¶¡£e¡ˆr°(V)Öíàr„Ž]K9¤ÿÖ¡Åmž”üÈoò״µºŽ06¼e€rœ['4çhH¾ö:¨œ–S„œ¦,|¤ÇqÂrÈŸd+ml‡ uötφûóŽ&›áyÙ(ÆŒÁ$‘¥±Zj*îàÒöL‘ˆD†aÉö_§è¶°·V„Þú]%ÅR*B=žéršæñ*i+á±èç|c¹ÑߟF$; | 
| 130 | 130 | // Get the private Key | 
| 131 | -            $path = storage_path('app' . DIRECTORY_SEPARATOR . 'private.key'); | |
| 131 | +            $path = storage_path('app'.DIRECTORY_SEPARATOR.'private.key'); | |
| 132 | 132 | $key_content = file_get_contents($path); | 
| 133 | 133 |              if (!$privateKey = openssl_pkey_get_private($key_content)) { | 
| 134 | 134 |                  die('Private Key failed'); | 
| @@ -153,7 +153,7 @@ discard block | ||
| 153 | 153 | // Uncompress the unencrypted data. | 
| 154 | 154 | $output = gzuncompress($output); | 
| 155 | 155 | dd($output); | 
| 156 | - echo '<br /><br /> Unencrypted Data: ' . $output; | |
| 156 | + echo '<br /><br /> Unencrypted Data: '.$output; | |
| 157 | 157 |          } catch (Exception $ex) { | 
| 158 | 158 | dd($ex); | 
| 159 | 159 | } | 
| @@ -165,7 +165,7 @@ discard block | ||
| 165 | 165 | $envelope = $encrypted->envelope; | 
| 166 | 166 | $input = base64_decode($sealed_data); | 
| 167 | 167 | $einput = base64_decode($envelope); | 
| 168 | -        $path = storage_path('app' . DIRECTORY_SEPARATOR . 'private.key'); | |
| 168 | +        $path = storage_path('app'.DIRECTORY_SEPARATOR.'private.key'); | |
| 169 | 169 | $key_content = file_get_contents($path); | 
| 170 | 170 | $private_key = openssl_get_privatekey($key_content); | 
| 171 | 171 | $plaintext = NULL; | 
| @@ -319,7 +319,7 @@ discard block | ||
| 319 | 319 |      public function submit($result, $url) { | 
| 320 | 320 | echo "<form action=$url method=post name=redirect>"; | 
| 321 | 321 | echo '<input type=hidden name=_token value=csrf_token()/>'; | 
| 322 | - echo "<input type=hidden name=result value=" . $result . "/>"; | |
| 322 | + echo "<input type=hidden name=result value=".$result."/>"; | |
| 323 | 323 | echo '</form>'; | 
| 324 | 324 | echo"<script language='javascript'>document.redirect.submit();</script>"; | 
| 325 | 325 | } | 
| @@ -391,7 +391,7 @@ discard block | ||
| 391 | 391 | } | 
| 392 | 392 | |
| 393 | 393 |      public static function encryptByPublicKey($data) { | 
| 394 | - $path = storage_path() . DIRECTORY_SEPARATOR . 'app' . DIRECTORY_SEPARATOR . 'public.key'; | |
| 394 | + $path = storage_path().DIRECTORY_SEPARATOR.'app'.DIRECTORY_SEPARATOR.'public.key'; | |
| 395 | 395 | //dd($path); | 
| 396 | 396 | $key_content = file_get_contents($path); | 
| 397 | 397 | $public_key = openssl_get_publickey($key_content); | 
| @@ -749,10 +749,4 @@ | ||
| 749 | 749 | } | 
| 750 | 750 | |
| 751 | 751 |      public function renew($orderid){ | 
| 752 | - //$sub = $this->subscription($orderid); | |
| 753 | -        return url('my-orders'); | |
| 754 | - } | |
| 755 | - | |
| 756 | -======= | |
| 757 | ->>>>>>> origin/master | |
| 758 | -} | |
| 752 | + //$sub = $this->subscription($orderid | |
| 759 | 753 | \ No newline at end of file | 
| @@ -749,10 +749,4 @@ | ||
| 749 | 749 | } | 
| 750 | 750 | |
| 751 | 751 |      public function renew($orderid){ | 
| 752 | - //$sub = $this->subscription($orderid); | |
| 753 | -        return url('my-orders'); | |
| 754 | - } | |
| 755 | - | |
| 756 | -======= | |
| 757 | ->>>>>>> origin/master | |
| 758 | -} | |
| 752 | + //$sub = $this->subscription($orderid | |
| 759 | 753 | \ No newline at end of file | 
| @@ -749,10 +749,4 @@ | ||
| 749 | 749 | } | 
| 750 | 750 | |
| 751 | 751 |      public function renew($orderid){ | 
| 752 | - //$sub = $this->subscription($orderid); | |
| 753 | -        return url('my-orders'); | |
| 754 | - } | |
| 755 | - | |
| 756 | -======= | |
| 757 | ->>>>>>> origin/master | |
| 758 | -} | |
| 752 | + //$sub = $this->subscription($orderid | |
| 759 | 753 | \ No newline at end of file | 
| @@ -749,10 +749,4 @@ | ||
| 749 | 749 | } | 
| 750 | 750 | |
| 751 | 751 |      public function renew($orderid){ | 
| 752 | - //$sub = $this->subscription($orderid); | |
| 753 | -        return url('my-orders'); | |
| 754 | - } | |
| 755 | - | |
| 756 | -======= | |
| 757 | ->>>>>>> origin/master | |
| 758 | -} | |
| 752 | + //$sub = $this->subscription($orderid | |
| 759 | 753 | \ No newline at end of file | 
| @@ -105,11 +105,11 @@ discard block | ||
| 105 | 105 |          //return \Datatable::query($this->order->select('id', 'created_at', 'client', | 
| 106 | 106 | //'price_override', 'order_status', 'number', 'serial_key')) | 
| 107 | 107 | return \Datatable::Collection($query->get()) | 
| 108 | -                        ->addColumn('#', function ($model) { | |
| 108 | +                        ->addColumn('#', function($model) { | |
| 109 | 109 | return "<input type='checkbox' value=".$model->id.' name=select[] id=check>'; | 
| 110 | 110 | }) | 
| 111 | 111 |                          ->showColumns('created_at') | 
| 112 | -                        ->addColumn('client', function ($model) { | |
| 112 | +                        ->addColumn('client', function($model) { | |
| 113 | 113 |                              $user = $this->user->where('id', $model->client)->first(); | 
| 114 | 114 | $first = $user->first_name; | 
| 115 | 115 | $last = $user->last_name; | 
| @@ -118,7 +118,7 @@ discard block | ||
| 118 | 118 |                              return '<a href='.url('clients/'.$id).'>'.ucfirst($first).' '.ucfirst($last).'<a>'; | 
| 119 | 119 | }) | 
| 120 | 120 |                          ->showColumns('number', 'price_override', 'order_status') | 
| 121 | -                        ->addColumn('ends_at', function ($model) { | |
| 121 | +                        ->addColumn('ends_at', function($model) { | |
| 122 | 122 | $end = '--'; | 
| 123 | 123 | $ends = $model->subscription()->first(); | 
| 124 | 124 |                              if ($ends) { | 
| @@ -131,7 +131,7 @@ discard block | ||
| 131 | 131 | |
| 132 | 132 | return $end; | 
| 133 | 133 | }) | 
| 134 | -                        ->addColumn('action', function ($model) { | |
| 134 | +                        ->addColumn('action', function($model) { | |
| 135 | 135 | $sub = $model->subscription()->first(); | 
| 136 | 136 | $status = $this->checkInvoiceStatusByOrderId($model->id); | 
| 137 | 137 | $url = ''; | 
| @@ -683,7 +683,7 @@ discard block | ||
| 683 | 683 | $subject = $template->name; | 
| 684 | 684 | $data = $template->data; | 
| 685 | 685 | $replace = [ | 
| 686 | - 'name' => $user->first_name . ' ' . $user->last_name, | |
| 686 | + 'name' => $user->first_name.' '.$user->last_name, | |
| 687 | 687 | 'downloadurl' => $downloadurl, | 
| 688 | 688 | 'invoiceurl' => $invoiceurl, | 
| 689 | 689 | 'product'=>$product, | 
| @@ -733,7 +733,7 @@ discard block | ||
| 733 | 733 | |
| 734 | 734 | return $product; | 
| 735 | 735 | } | 
| 736 | -<<<<<<< HEAD | |
| 736 | +<< << <<< HEAD | |
| 737 | 737 | |
| 738 | 738 |      public function subscription($orderid){ | 
| 739 | 739 |          $sub = $this->subscription->where('order_id',$orderid)->first(); | 
| @@ -749,10 +749,4 @@ discard block | ||
| 749 | 749 | } | 
| 750 | 750 | |
| 751 | 751 |      public function renew($orderid){ | 
| 752 | - //$sub = $this->subscription($orderid); | |
| 753 | -        return url('my-orders'); | |
| 754 | - } | |
| 755 | - | |
| 756 | -======= | |
| 757 | ->>>>>>> origin/master | |
| 758 | -} | |
| 752 | + //$sub = $this->subscription($orderid | |
| 759 | 753 | \ No newline at end of file | 
| @@ -749,10 +749,4 @@ | ||
| 749 | 749 | } | 
| 750 | 750 | |
| 751 | 751 |      public function renew($orderid){ | 
| 752 | - //$sub = $this->subscription($orderid); | |
| 753 | -        return url('my-orders'); | |
| 754 | - } | |
| 755 | - | |
| 756 | -======= | |
| 757 | ->>>>>>> origin/master | |
| 758 | -} | |
| 752 | + //$sub = $this->subscription($orderid | |
| 759 | 753 | \ No newline at end of file | 
| @@ -749,10 +749,4 @@ | ||
| 749 | 749 | } | 
| 750 | 750 | |
| 751 | 751 |      public function renew($orderid){ | 
| 752 | - //$sub = $this->subscription($orderid); | |
| 753 | -        return url('my-orders'); | |
| 754 | - } | |
| 755 | - | |
| 756 | -======= | |
| 757 | ->>>>>>> origin/master | |
| 758 | -} | |
| 752 | + //$sub = $this->subscription($orderid | |
| 759 | 753 | \ No newline at end of file | 
| @@ -292,7 +292,7 @@ | ||
| 292 | 292 |      { | 
| 293 | 293 |          try { | 
| 294 | 294 | $release = $this->latestRelese($owner, $repo); | 
| 295 | -            if(key_exists('tag_name', $release)){ | |
| 295 | +            if (key_exists('tag_name', $release)) { | |
| 296 | 296 | return $release['tag_name']; | 
| 297 | 297 | } | 
| 298 | 298 | return NULL; | 
| @@ -45,7 +45,7 @@ discard block | ||
| 45 | 45 | $sub = $this->sub | 
| 46 | 46 |                  ->where('ends_at', '!=', '0000-00-00 00:00:00') | 
| 47 | 47 |                  ->whereNotNull('ends_at') | 
| 48 | -                ->whereBetween('ends_at', [$plus29days,$plus31days]); | |
| 48 | +                ->whereBetween('ends_at', [$plus29days, $plus31days]); | |
| 49 | 49 | //dd($sub->get()); | 
| 50 | 50 | |
| 51 | 51 | return $sub; | 
| @@ -458,7 +458,7 @@ discard block | ||
| 458 | 458 | $templates = new \App\Model\Common\Template(); | 
| 459 | 459 | $temp_id = $setting->subscription_going_to_end; | 
| 460 | 460 | //dd($setting); | 
| 461 | -        if($end<date('Y-m-d H:m:i')){ | |
| 461 | +        if ($end < date('Y-m-d H:m:i')) { | |
| 462 | 462 | $temp_id = $setting->subscription_over; | 
| 463 | 463 | } | 
| 464 | 464 | //dd($temp_id); | 
| @@ -356,12 +356,12 @@ | ||
| 356 | 356 | * Api | 
| 357 | 357 | */ | 
| 358 | 358 | |
| 359 | -Route::group(['prefix'=>'api'],function(){ | |
| 359 | +Route::group(['prefix'=>'api'], function() { | |
| 360 | 360 | /** | 
| 361 | 361 | * Unautherised requests | 
| 362 | 362 | */ | 
| 363 | 363 | |
| 364 | -    Route::get('check-url','Api\ApiController@checkDomain'); | |
| 364 | +    Route::get('check-url', 'Api\ApiController@checkDomain'); | |
| 365 | 365 | |
| 366 | 366 | }); | 
| 367 | 367 | |
| @@ -67,8 +67,8 @@ | ||
| 67 | 67 | } | 
| 68 | 68 | |
| 69 | 69 |      public function plan(){ | 
| 70 | - $plan = $this->planRelation()->first(); | |
| 71 | - return $plan; | |
| 70 | + $plan = $this->planRelation()->first(); | |
| 71 | + return $plan; | |
| 72 | 72 | } | 
| 73 | 73 | |
| 74 | 74 | } | 
| @@ -10,7 +10,7 @@ discard block | ||
| 10 | 10 | protected $fillable = ['name', 'description', 'type', 'group', 'file', 'image', 'require_domain', 'category', | 
| 11 | 11 | 'stock_control', 'stock_qty', 'sort_order', 'tax_apply', 'retired', 'hidden', 'multiple_qty', 'auto_terminate', | 
| 12 | 12 | 'setup_order_placed', 'setup_first_payment', 'setup_accept_manually', 'no_auto_setup', 'shoping_cart_link', 'process_url', 'github_owner', 'github_repository', | 
| 13 | - 'deny_after_subscription', 'version', 'parent', 'subscription',]; | |
| 13 | + 'deny_after_subscription', 'version', 'parent', 'subscription', ]; | |
| 14 | 14 | |
| 15 | 15 |      public function order() { | 
| 16 | 16 |          return $this->hasMany('App\Model\Order\Order'); | 
| @@ -63,11 +63,11 @@ discard block | ||
| 63 | 63 | |
| 64 | 64 |      public function planRelation() { | 
| 65 | 65 | $related = "App\Model\Payment\Plan"; | 
| 66 | - return $this->hasMany($related,'product'); | |
| 66 | + return $this->hasMany($related, 'product'); | |
| 67 | 67 | } | 
| 68 | 68 | |
| 69 | -    public function plan(){ | |
| 70 | - $plan = $this->planRelation()->first(); | |
| 69 | +    public function plan() { | |
| 70 | + $plan = $this->planRelation()->first(); | |
| 71 | 71 | return $plan; | 
| 72 | 72 | } | 
| 73 | 73 | |