public function addcerti() { $braintree_cse = $stripe_publishable_key = $url = $timezone = $website_title = $s3_bucket = $twillo_account_sid = $twillo_auth_token = $twillo_number = $default_payment = $stripe_secret_key = $braintree_environment = $braintree_merchant_id = $braintree_public_key = $braintree_private_key = $customer_certy_url = $customer_certy_pass = $customer_certy_type = $provider_certy_url = $provider_certy_pass = $provider_certy_type = $gcm_browser_key = $key_provider = $key_user = $key_taxi = $key_trip = $key_currency = $total_trip = $cancelled_trip = $total_payment = $completed_trip = $card_payment = $credit_payment = $key_ref_pre = $android_client_app_url = $android_provider_app_url = $ios_client_app_url = $ios_provider_app_url = NULL; $is_certy_change = 0; $braintree_environment = Config::get('app.braintree_environment'); $braintree_merchant_id = Config::get('app.braintree_merchant_id'); $braintree_public_key = Config::get('app.braintree_public_key'); $braintree_private_key = Config::get('app.braintree_private_key'); $braintree_cse = Config::get('app.braintree_cse'); $twillo_account_sid = Config::get('app.twillo_account_sid'); $twillo_auth_token = Config::get('app.twillo_auth_token'); $twillo_number = Config::get('app.twillo_number'); $timezone = Config::get('app.timezone'); $stripe_publishable_key = Config::get('app.stripe_publishable_key'); $url = Config::get('app.url'); $website_title = Config::get('app.website_title'); $s3_bucket = Config::get('app.s3_bucket'); $default_payment = Config::get('app.default_payment'); $stripe_secret_key = Config::get('app.stripe_secret_key'); $mail_driver = Config::get('mail.driver'); $email_name = Config::get('mail.from.name'); $email_address = Config::get('mail.from.address'); $mandrill_secret = Config::get('services.mandrill.secret'); $host = Config::get('mail.host'); /* DEVICE PUSH NOTIFICATION DETAILS */ $customer_certy_url = Config::get('app.customer_certy_url'); $customer_certy_pass = Config::get('app.customer_certy_pass'); $customer_certy_type = Config::get('app.customer_certy_type'); $provider_certy_url = Config::get('app.provider_certy_url'); $provider_certy_pass = Config::get('app.provider_certy_pass'); $provider_certy_type = Config::get('app.provider_certy_type'); $gcm_browser_key = Config::get('app.gcm_browser_key'); /* DEVICE PUSH NOTIFICATION DETAILS END */ $install = array('braintree_environment' => $braintree_environment, 'braintree_merchant_id' => $braintree_merchant_id, 'braintree_public_key' => $braintree_public_key, 'braintree_private_key' => $braintree_private_key, 'braintree_cse' => $braintree_cse, 'twillo_account_sid' => $twillo_account_sid, 'twillo_auth_token' => $twillo_auth_token, 'twillo_number' => $twillo_number, 'stripe_publishable_key' => $stripe_publishable_key, 'stripe_secret_key' => $stripe_secret_key, 'mail_driver' => $mail_driver, 'email_address' => $email_address, 'email_name' => $email_name, 'mandrill_secret' => $mandrill_secret, 'default_payment' => $default_payment, 'customer_certy_url' => $customer_certy_url, 'customer_certy_pass' => $customer_certy_pass, 'customer_certy_type' => $customer_certy_type, 'provider_certy_url' => $provider_certy_url, 'provider_certy_pass' => $provider_certy_pass, 'provider_certy_type' => $provider_certy_type, 'gcm_browser_key' => $gcm_browser_key); $count = 0; // apple user if (Input::hasFile('user_certi_a') && Input::has('user_pass_a') && Input::has('cert_type_a')) { // Upload File $certy_password_client = $customer_certy_pass = trim(Input::get('user_pass_a')); $customer_certy_type = Input::get('cert_type_a'); if ($customer_certy_type) { $client_certy_type = "ssl"; } else { $client_certy_type = "sandboxSsl"; } $file_name = "Client_certy"; $ext = Input::file('user_certi_a')->getClientOriginalExtension(); if ($ext == "PEM" || $ext == "pem") { /* Input::file('user_certi_a')->move(app_path() . "/ios_push/iph_cert/", $file_name . "." . $ext); */ Input::file('user_certi_a')->move(public_path() . "/apps/ios_push/iph_cert", $file_name . "." . $ext); /* chmod(app_path() . "/ios_push/iph_cert/" . $file_name . "." . $ext, 0777); */ $local_url = $file_name . "." . $ext; // Upload to S3 if (Config::get('app.s3_bucket') != "") { $s3 = App::make('aws')->get('s3'); $pic = $s3->putObject(array('Bucket' => Config::get('app.s3_bucket'), 'Key' => $file_name, 'SourceFile' => app_path() . "/ios_push/iph_cert/" . $local_url)); $s3->putObjectAcl(array('Bucket' => Config::get('app.s3_bucket'), 'Key' => $file_name, 'ACL' => 'public-read')); $customer_certy_url = $s3->getObjectUrl(Config::get('app.s3_bucket'), $file_name); } else { /* $customer_certy_url = app_path() . '/ios_push/iph_cert/' . $local_url; */ /* $customer_certy_url = rtrim(asset_url(), 'public') . 'app/ios_push/iph_cert/' . $local_url; */ } $customer_certy_url = asset_url() . '/apps/ios_push/iph_cert/' . $local_url; /* if (isset($theme->logo)) { $icon = asset_url() . '/uploads/' . $theme->logo; unlink_image($icon); } $theme->logo = $local_url; */ $update_client_certy = "<?php\n\n//session_start();\n\n//require_once 'database.php';\n//error_reporting(false);\n\nclass Apns {\n\n public \$ctx;\n public \$fp;\n private \$ssl = 'ssl://gateway.push.apple.com:2195';\n private \$passphrase = '" . $certy_password_client . "';\n private \$sandboxCertificate = 'iph_cert/Client_certy.pem';\n private \$sandboxSsl = 'ssl://gateway.sandbox.push.apple.com:2195';\n private \$sandboxFeedback = 'ssl://feedback.sandbox.push.apple.com:2196';\n private \$message = 'ManagerMaster';\n\n private function getCertificatePath() {\n return asset_url() . '/apps/ios_push/' . \$this->sandboxCertificate;\n }\n\n public function __construct() {\n \$this->initialize_apns();\n }\n\n public function initialize_apns() {\n try {\n \$this->ctx = stream_context_create();\n\n //stream_context_set_option(\$ctx, 'ssl', 'cafile', 'entrust_2048_ca.cer');\n stream_context_set_option(\$this->ctx, 'ssl', 'local_cert', \$this->getCertificatePath());\n stream_context_set_option(\$this->ctx, 'ssl', 'passphrase', \$this->passphrase); // use this if you are using a passphrase\n // Open a connection to the APNS servers\n \$this->fp = stream_socket_client(\$this->" . $client_certy_type . ", \$err, \$errstr, 60, STREAM_CLIENT_CONNECT | STREAM_CLIENT_PERSISTENT, \$this->ctx);\n\n if (\$this->fp) {\n Log::info('Successfully connected to server of APNS');\n //echo 'Successfully connected to server of APNS ckUberForXOwner.pem';\n } else {\n Log::error('Error in connection while trying to connect to APNS');\n //echo 'Error in connection while trying to connect to APNS ckUberForXOwner.pem';\n }\n } catch (Exception \$e) {\n Log::error(\$e);\n }\n }\n\n public function send_notification(\$devices, \$message) {\n try {\n \$errCounter = 0;\n \$payload = json_encode(array('aps' => \$message));\n \$result = 0;\n \$bodyError = '';\n foreach (\$devices as \$key => \$value) {\n \$msg = chr(0) . pack('n', 32) . pack('H*', str_replace(' ', '', \$value)) . pack('n', (strlen(\$payload))) . \$payload;\n \$result = fwrite(\$this->fp, \$msg);\n \$bodyError .= 'result: ' . \$result . ', devicetoken: ' . \$value;\n if (!\$result) {\n \$errCounter = \$errCounter + 1;\n }\n }\n\t\t\t//echo 'Result :- '.\$result;\n if (\$result) {\n Log::info('Delivered Message to APNS' . PHP_EOL);\n //echo 'Delivered Message to APNS' . PHP_EOL;\n \$bool_result = true;\n } else {\n Log::info('Could not Deliver Message to APNS' . PHP_EOL);\n //echo 'Could not Deliver Message to APNS' . PHP_EOL;\n \$bool_result = false;\n }\n\n fclose(\$this->fp);\n return \$bool_result;\n } catch (Exception \$e) {\n Log::error(\$e);\n }\n }\n\n}\n"; $t = file_put_contents(app_path() . '/ios_push/apns.php', $update_client_certy); /* chmod(app_path() . '/ios_push/apns.php', 0777); */ $is_certy_change++; } else { return Redirect::to('/admin/settings/installation?success=3')->with('install', $install); } } if (Input::hasFile('prov_certi_a') && Input::has('prov_pass_a') && Input::has('cert_type_a')) { $certy_password_driver = $provider_certy_pass = trim(Input::get('prov_pass_a')); $provider_certy_type = Input::get('cert_type_a'); if ($provider_certy_type) { $driver_certy_type = "ssl"; } else { $driver_certy_type = "sandboxSsl"; } // Upload File $file_name = "Walker_certy"; $ext = Input::file('prov_certi_a')->getClientOriginalExtension(); if ($ext == "PEM" || $ext == "pem") { /* Input::file('prov_certi_a')->move(app_path() . "/ios_push/walker/iph_cert/", $file_name . "." . $ext); */ Input::file('prov_certi_a')->move(public_path() . "/apps/ios_push/walker/iph_cert", $file_name . "." . $ext); $local_url = $file_name . "." . $ext; /* chmod(app_path() . "/ios_push/walker/iph_cert/" . $file_name . "." . $ext, 0777); */ // Upload to S3 if (Config::get('app.s3_bucket') != "") { $s3 = App::make('aws')->get('s3'); $pic = $s3->putObject(array('Bucket' => Config::get('app.s3_bucket'), 'Key' => $file_name, 'SourceFile' => app_path() . "/ios_push/walker/iph_cert/" . $local_url)); $s3->putObjectAcl(array('Bucket' => Config::get('app.s3_bucket'), 'Key' => $file_name, 'ACL' => 'public-read')); $provider_certy_url = $s3->getObjectUrl(Config::get('app.s3_bucket'), $file_name); } else { /* $provider_certy_url = app_path() . '/ios_push/walker/iph_cert/' . $local_url; */ /* $provider_certy_url = rtrim(asset_url(), 'public') . 'app/ios_push/walker/iph_cert/' . $local_url; */ } $provider_certy_url = asset_url() . '/apps/ios_push/walker/iph_cert/' . $local_url; /* if (isset($theme->logo)) { $icon = asset_url() . '/uploads/' . $theme->logo; unlink_image($icon); } $theme->logo = $local_url; */ $update_client_certy = "<?php\n\n//session_start();\n\n//require_once 'database.php';\n//error_reporting(false);\n\nclass Apns {\n\n public \$ctx;\n public \$fp;\n private \$ssl = 'ssl://gateway.push.apple.com:2195';\n private \$passphrase = '" . $certy_password_driver . "';\n private \$sandboxCertificate = 'walker/iph_cert/Walker_certy.pem';\n private \$sandboxSsl = 'ssl://gateway.sandbox.push.apple.com:2195';\n private \$sandboxFeedback = 'ssl://feedback.sandbox.push.apple.com:2196';\n private \$message = 'ManagerMaster';\n\n private function getCertificatePath() {\n return asset_url() . '/apps/ios_push/' . \$this->sandboxCertificate;\n }\n\n public function __construct() {\n \$this->initialize_apns();\n }\n\n public function initialize_apns() {\n try {\n \$this->ctx = stream_context_create();\n\n //stream_context_set_option(\$ctx, 'ssl', 'cafile', 'entrust_2048_ca.cer');\n stream_context_set_option(\$this->ctx, 'ssl', 'local_cert', \$this->getCertificatePath());\n stream_context_set_option(\$this->ctx, 'ssl', 'passphrase', \$this->passphrase); // use this if you are using a passphrase\n // Open a connection to the APNS servers\n \$this->fp = stream_socket_client(\$this->" . $driver_certy_type . ", \$err, \$errstr, 60, STREAM_CLIENT_CONNECT | STREAM_CLIENT_PERSISTENT, \$this->ctx);\n\n if (\$this->fp) {\n Log::info('Successfully connected to server of APNS');\n /*echo 'Successfully connected to server of APNS ckUberForXProvider.pem';*/\n } else {\n Log::error('Error in connection while trying to connect to APNS');\n /*echo 'Error in connection while trying to connect to APNS ckUberForXProvider.pem';*/\n }\n } catch (Exception \$e) {\n Log::error(\$e);\n }\n }\n\n public function send_notification(\$devices, \$message) {\n try {\n \$errCounter = 0;\n \$payload = json_encode(array('aps' => \$message));\n \$result = 0;\n \$bodyError = '';\n\t\t\t/*print_r(\$devices);*/\n foreach (\$devices as \$key => \$value) {\n\t\t\t\t/*echo \$value;*/\n \$msg = chr(0) . pack('n', 32) . pack('H*', str_replace(' ', '', \$value)) . pack('n', (strlen(\$payload))) . \$payload;\n \$result = fwrite(\$this->fp, \$msg);\n \$bodyError .= 'result: ' . \$result . ', devicetoken: ' . \$value;\n if (!\$result) {\n \$errCounter = \$errCounter + 1;\n }\n }\n\t\t\t/*echo 'Result :- '.\$result;*/\n if (\$result) {\n Log::info('Delivered Message to APNS' . PHP_EOL);\n /*echo 'Delivered Message to APNS' . PHP_EOL;*/\n \$bool_result = true;\n } else {\n Log::info('Could not Deliver Message to APNS' . PHP_EOL);\n /*echo 'Could not Deliver Message to APNS' . PHP_EOL;*/\n \$bool_result = false;\n }\n\n fclose(\$this->fp);\n return \$bool_result;\n } catch (Exception \$e) {\n Log::error(\$e);\n }\n }\n\n}\n"; $t = file_put_contents(app_path() . '/ios_push/walker/apns.php', $update_client_certy); /* chmod(app_path() . '/ios_push/walker/apns.php', 0777); */ $is_certy_change++; } else { return Redirect::to('/admin/settings/installation?success=3')->with('install', $install); } } if (Input::has('gcm_key')) { /* "AIzaSyAKe3XmUV93WvHJvII4Qzpf0R052mxb0KI" */ $app_gcm_key = $gcm_browser_key = trim(Input::get('gcm_key')); if ($app_gcm_key != "") { $update_client_certy = "<?php\n\n/*array(\n 'GOOGLE_API_KEY' => '" . $app_gcm_key . "',\n);*/\n/*\n * To change this template, choose Tools | Templates\n * and open the template in the editor.\n */\n\n/**\n * Description of GCM\n *\n * @author Ravi Tamada\n */\ndefine('GOOGLE_API_KEY', '" . $app_gcm_key . "');\n/*define('GOOGLE_API_KEY', 'AIzaSyAKe3XmUV93WvHJvII4Qzpf0R052mxb0KI');*/\n/*define('GOOGLE_API_KEY', 'AIzaSyC0JjF-O72-gUvUmUm_dsHHvG5o3aWosp8');*/\n\nclass GCM {\n\n //put your code here\n // constructor\n function __construct() {\n\n }\n\n /**\n * Sending Push Notification\n */\n public function send_notification(\$registatoin_ids, \$message) {\n // include config\n include_once 'const.php';\n /* include_once 'config.php'; */\n // Set POST variables\n \$url = 'https://android.googleapis.com/gcm/send';\n\n \$fields = array(\n 'registration_ids' => \$registatoin_ids,\n 'data' => \$message,\n );\n\n \$headers = array(\n 'Authorization: key=' . GOOGLE_API_KEY,\n 'Content-Type: application/json'\n );\n // Open connection\n \$ch = curl_init();\n\n // Set the url, number of POST vars, POST data\n curl_setopt(\$ch, CURLOPT_URL, \$url);\n\n curl_setopt(\$ch, CURLOPT_POST, true);\n curl_setopt(\$ch, CURLOPT_HTTPHEADER, \$headers);\n curl_setopt(\$ch, CURLOPT_RETURNTRANSFER, true);\n\n // Disabling SSL Certificate support temporarly\n curl_setopt(\$ch, CURLOPT_SSL_VERIFYPEER, false);\n curl_setopt(\$ch, CURLOPT_POSTFIELDS, json_encode(\$fields));\n\n // Execute post\n \$result = curl_exec(\$ch);\n if (\$result === FALSE) {\n //die('Curl failed: ' . curl_error(\$ch));\n Log::error('Curl failed: ' . curl_error(\$ch));\n }\n else{\n //echo \$result;\n Log::error(\$result);\n }\n\n // Close connection\n /*curl_close(\$ch);\n echo \$result/*.'\n\n'.json_encode(\$fields); */\n }\n\n}\n?>\n"; $t = file_put_contents(app_path() . '/gcm/GCM_1.php', $update_client_certy); $is_certy_change++; } else { return Redirect::to('/admin/settings/installation?success=4')->with('install', $install); } } /* if (Input::hasFile('user_certi_a')) { $certi_user_a = Certificates::where('client', 'apple')->where('user_type', 0)->where('file_type', 'certificate')->where('type', Input::get('cert_type_a'))->first(); if ($certi_user_a != NULL) { //user $path = $certi_user_a->name; Log::info($path); $filename = basename($path); Log::info($filename); if (file_exists($path)) { try { unlink(public_path() . "/apps/ios_push/iph_cert/" . $filename); } catch (Exception $e) { } } $key = Certificates::where('client', 'apple')->where('user_type', 0)->where('file_type', 'certificate')->first(); } else { $key = new Certificates(); $key->client = 'apple'; $key->type = Input::get('cert_type_a'); $key->user_type = 0; $key->file_type = 'certificate'; } // upload image $file_name = time(); $file_name .= rand(); $file_name = sha1($file_name); Log::info(Input::file('user_certi_a')); $ext = Input::file('user_certi_a')->getClientOriginalExtension(); Input::file('user_certi_a')->move(public_path() . "/apps/ios_push/iph_cert", $file_name . "." . $ext); $local_url = $file_name . "." . $ext; // Upload to S3 if (Config::get('app.s3_bucket') != "") { $s3 = App::make('aws')->get('s3'); $pic = $s3->putObject(array( 'Bucket' => Config::get('app.s3_bucket'), 'Key' => $file_name, 'SourceFile' => public_path() . "/apps/ios_push/iph_cert/" . $local_url, )); $s3->putObjectAcl(array( 'Bucket' => Config::get('app.s3_bucket'), 'Key' => $file_name, 'ACL' => 'public-read' )); $s3_url = $s3->getObjectUrl(Config::get('app.s3_bucket'), $file_name); } Log::info('path = ' . print_r($local_url, true)); $key->name = $local_url; $count = $count + 1; $key->save(); } // User passphrase file. if (Input::has('user_pass_a')) { $user_key_db = Certificates::where('client', 'apple')->where('user_type', 0)->where('file_type', 'passphrase')->where('type', Input::get('cert_type_a'))->first(); if ($user_key_db == NULL) { $key = new Certificates(); $key->client = 'apple'; $key->type = Input::get('cert_type_a'); $key->user_type = 0; $key->file_type = 'passphrase'; } else { $key = Certificates::where('client', 'apple')->where('user_type', 0)->where('file_type', 'passphrase')->first(); } $key->name = Input::get('user_pass_a'); $count = $count + 1; $key->save(); } // apple provider if (Input::hasFile('prov_certi_a')) { $certi_prov_a = Certificates::where('client', 'apple')->where('user_type', 1)->where('file_type', 'certificate')->where('type', Input::get('cert_type_a'))->first(); if ($certi_prov_a != NULL) { //user $path = $certi_prov_a->name; Log::info($path); $filename = basename($path); Log::info($filename); try { unlink(public_path() . "/apps/ios_push/walker/iph_cert/" . $filename); } catch (Exception $e) { } $key = Certificates::where('client', 'apple')->where('user_type', 1)->where('file_type', 'certificate')->first(); } else { $key = new Certificates(); $key->client = 'apple'; $key->type = Input::get('cert_type_a'); $key->user_type = 1; $key->file_type = 'certificate'; } // upload image $file_name = time(); $file_name .= rand(); $file_name = sha1($file_name); $ext = Input::file('prov_certi_a')->getClientOriginalExtension(); Input::file('prov_certi_a')->move(public_path() . "/apps/ios_push/walker/iph_cert", $file_name . "." . $ext); $local_url = $file_name . "." . $ext; // Upload to S3 if (Config::get('app.s3_bucket') != "") { $s3 = App::make('aws')->get('s3'); $pic = $s3->putObject(array( 'Bucket' => Config::get('app.s3_bucket'), 'Key' => $file_name, 'SourceFile' => public_path() . "/apps/ios_push/walker/iph_cert/" . $local_url, )); $s3->putObjectAcl(array( 'Bucket' => Config::get('app.s3_bucket'), 'Key' => $file_name, 'ACL' => 'public-read' )); } Log::info('path = ' . print_r($local_url, true)); $key->name = $local_url; $count = $count + 1; $key->save(); } // Provider passphrase file. if (Input::has('prov_pass_a')) { $user_key_db = Certificates::where('client', 'apple')->where('user_type', 1)->where('file_type', 'passphrase')->where('type', Input::get('cert_type_a'))->first(); if ($user_key_db == NULL) { $key = new Certificates(); $key->client = 'apple'; $key->type = Input::get('cert_type_a'); $key->user_type = 1; $key->file_type = 'passphrase'; } else { $key = Certificates::where('client', 'apple')->where('user_type', 1)->where('file_type', 'passphrase')->first(); } $key->name = Input::get('prov_pass_a'); $count = $count + 1; $key->save(); } // gcm key file. if (Input::has('gcm_key')) { $gcm_key_db = Certificates::where('client', 'gcm')->first(); if ($gcm_key_db == NULL) { $key = new Certificates(); $key->client = 'gcm'; $key->type = Input::get('cert_type_a'); $key->user_type = 0; $key->file_type = 'browser_key'; } else { $key = Certificates::where('client', 'gcm')->first(); } $key->name = Input::get('gcm_key'); $count = $count + 1; $key->save(); } Log::info("count = " . print_r($count, true)); $cert_def = Input::get('cert_default'); $certa = Certificates::where('client', 'apple')->get(); foreach ($certa as $ca) { $def = Certificates::where('id', $ca->id)->first(); $def->default = 0; $def->save(); } $certs = Certificates::where('client', 'apple')->where('type', $cert_def)->get(); foreach ($certs as $defc) { $def = Certificates::where('id', $defc->id)->first(); Log::info('def = ' . print_r($def, true)); $def->default = 1; $def->save(); } */ $android_client_app_url = NULL; if (Input::has('android_client_app_url')) { $android_client_app_url = Input::get('android_client_app_url'); } $android_provider_app_url = NULL; if (Input::has('android_provider_app_url')) { $android_provider_app_url = Input::get('android_provider_app_url'); } $ios_client_app_url = NULL; if (Input::has('ios_client_app_url')) { $ios_client_app_url = Input::get('ios_client_app_url'); } $ios_provider_app_url = NULL; if (Input::has('ios_provider_app_url')) { $ios_provider_app_url = Input::get('ios_provider_app_url'); } $appfile = fopen(app_path() . "/config/app.php", "w") or die("Unable to open file!"); /* $appfile_config = generate_app_config($braintree_cse, $stripe_publishable_key, $url, $timezone, $website_title, $s3_bucket, $twillo_account_sid, $twillo_auth_token, $twillo_number, $default_payment, $stripe_secret_key, $braintree_environment, $braintree_merchant_id, $braintree_public_key, $braintree_private_key, $customer_certy_url, $customer_certy_pass, $customer_certy_type, $provider_certy_url, $provider_certy_pass, $provider_certy_type, $gcm_browser_key, $android_client_app_url, $android_provider_app_url, $ios_client_app_url, $ios_provider_app_url); */ $appfile_config = generate_app_config($braintree_cse, $stripe_publishable_key, $url, $timezone, $website_title, $s3_bucket, $twillo_account_sid, $twillo_auth_token, $twillo_number, $default_payment, $stripe_secret_key, $braintree_environment, $braintree_merchant_id, $braintree_public_key, $braintree_private_key, $customer_certy_url, $customer_certy_pass, $customer_certy_type, $provider_certy_url, $provider_certy_pass, $provider_certy_type, $gcm_browser_key, $key_provider, $key_user, $key_taxi, $key_trip, $key_currency, $total_trip, $cancelled_trip, $total_payment, $completed_trip, $card_payment, $credit_payment, $key_ref_pre, $android_client_app_url, $android_provider_app_url, $ios_client_app_url, $ios_provider_app_url); fwrite($appfile, $appfile_config); fclose($appfile); $install = array('braintree_environment' => $braintree_environment, 'braintree_merchant_id' => $braintree_merchant_id, 'braintree_public_key' => $braintree_public_key, 'braintree_private_key' => $braintree_private_key, 'braintree_cse' => $braintree_cse, 'twillo_account_sid' => $twillo_account_sid, 'twillo_auth_token' => $twillo_auth_token, 'twillo_number' => $twillo_number, 'stripe_publishable_key' => $stripe_publishable_key, 'stripe_secret_key' => $stripe_secret_key, 'mail_driver' => $mail_driver, 'email_address' => $email_address, 'email_name' => $email_name, 'mandrill_secret' => $mandrill_secret, 'default_payment' => $default_payment, 'customer_certy_url' => $customer_certy_url, 'customer_certy_pass' => $customer_certy_pass, 'customer_certy_type' => $customer_certy_type, 'provider_certy_url' => $provider_certy_url, 'provider_certy_pass' => $provider_certy_pass, 'provider_certy_type' => $provider_certy_type, 'gcm_browser_key' => $gcm_browser_key); /* echo asset_url(); echo "<br>"; echo $provider_certy_url; echo $customer_certy_url; */ if ($is_certy_change > 0) { return Redirect::to('/admin/settings/installation?success=1')->with('install', $install); } else { return Redirect::to('/admin/settings/installation?success=5')->with('install', $install); } }
public function finish_install() { // Modifying Database Config $host = Session::get('host'); $username = Session::get('username'); $password = Session::get('password'); $database = Session::get('database'); $dbfile = fopen(app_path() . "/config/database.php", "w") or die("Unable to open file!"); $dbfile_config = generate_db_config($host, $username, $password, $database); fwrite($dbfile, $dbfile_config); fclose($dbfile); // Modifying App Config File $url = Session::get('url'); $website_title = Session::get('website_title'); $timezone = Session::get('timezone'); $twillo_account_sid = Session::get('twillo_account_sid'); $twillo_auth_token = Session::get('twillo_auth_token'); $twillo_number = Session::get('twillo_number'); $default_payment = Session::get('default_payment'); $default_storage = Session::get('default_storage'); if ($default_payment == 'stripe') { $stripe_secret_key = Session::get('stripe_secret_key'); $stripe_publishable_key = Session::get('stripe_publishable_key'); $braintree_environment = ''; $braintree_merchant_id = ''; $braintree_public_key = ''; $braintree_private_key = ''; $braintree_cse = ''; } else { $stripe_secret_key = ''; $stripe_publishable_key = ''; $braintree_environment = Session::get('braintree_environment'); $braintree_merchant_id = Session::get('braintree_merchant_id'); $braintree_public_key = Session::get('braintree_public_key'); $braintree_private_key = Session::get('braintree_private_key'); $braintree_cse = Session::get('braintree_cse'); } if ($default_storage == 2) { $s3_bucket = Session::get('s3_bucket'); } else { $s3_bucket = ''; } $appfile = fopen(app_path() . "/config/app.php", "w") or die("Unable to open file!"); $appfile_config = generate_app_config($braintree_cse, $stripe_publishable_key, $url, $timezone, $website_title, $s3_bucket, $twillo_account_sid, $twillo_auth_token, $twillo_number, $default_payment, $stripe_secret_key, $braintree_environment, $braintree_merchant_id, $braintree_public_key, $braintree_private_key); fwrite($appfile, $appfile_config); fclose($appfile); // Importing Database $re = mysqli_connect($host, $username, $password, $database); $result = mysqli_query($re, "SHOW TABLES FROM {$database}"); if (!$result) { import_db($username, $password, $host, $database); } // Modifying Mail Config File $mail_driver = Session::get('mail_driver'); $email_name = Session::get('email_name'); $email_address = Session::get('email_address'); $mandrill_secret = Session::get('mandrill_secret'); $mailfile = fopen(app_path() . "/config/mail.php", "w") or die("Unable to open file!"); $mailfile_config = generate_mail_config($host, $mail_driver, $email_name, $email_address); fwrite($mailfile, $mailfile_config); fclose($mailfile); if ($mail_driver == 'mandrill') { $mandrill_username = Input::get('mandrill_username'); $servicesfile = fopen(app_path() . "/config/services.php", "w") or die("Unable to open file!"); $servicesfile_config = generate_services_config($mandrill_secret, $mandrill_username); fwrite($servicesfile, $servicesfile_config); fclose($servicesfile); } return View::make("installer.step7"); }