diff --git a/.gitignore b/.gitignore index f1787a13..dcc6cf87 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,5 @@ # Add any directories, files, or patterns you don't want to be tracked by version control -api/application/vendor/ +api/application/vendor/* api/application/logs/* api/application/syslogs/* !api/application/logs/index.html diff --git a/api/application/config/customconfig_one.php b/api/application/config/customconfig_one.php index f02ded6c..cb102b94 100644 --- a/api/application/config/customconfig_one.php +++ b/api/application/config/customconfig_one.php @@ -14,7 +14,7 @@ YQIDAQAB * Increase this value as per requirement for production */ $config['token_timeout'] = 1; -$config['authorization_key'] = 'apollo123'; +$config['authorization_key'] = 'sparqvenba2018'; /* End of file jwt.php */ /* Location: ./application/config/jwt.php */ \ No newline at end of file diff --git a/api/application/config/database.php b/api/application/config/database.php index 46c04b27..f9915da7 100644 --- a/api/application/config/database.php +++ b/api/application/config/database.php @@ -70,10 +70,32 @@ defined('BASEPATH') OR exit('No direct script access allowed'); | The $query_builder variables lets you determine whether or not to load | the query builder class. */ -$active_group = 'default'; +$active_group = 'dev'; $query_builder = TRUE; -$db['default'] = array( +$db['dev'] = array( + 'dsn' => '', + 'hostname' => 'sine-edge-dev.cya6cheplup2.ap-south-1.rds.amazonaws.com', + 'username' => 'sparqdev_mas001', + 'password' => 'sparqvenba', + 'database' => 'sine_edge_dev', + 'dbdriver' => 'mysqli', + 'dbprefix' => '', + 'pconnect' => FALSE, + 'db_debug' => (ENVIRONMENT !== 'production'), + 'cache_on' => FALSE, + 'cachedir' => '', + 'char_set' => 'utf8', + 'dbcollat' => 'utf8_general_ci', + 'swap_pre' => '', + 'encrypt' => FALSE, + 'compress' => FALSE, + 'stricton' => FALSE, + 'failover' => array(), + 'save_queries' => TRUE +); + +$db['test'] = array( 'dsn' => '', 'hostname' => 'apollodec.com', 'username' => 'apollod4_DEV', @@ -94,3 +116,25 @@ $db['default'] = array( 'failover' => array(), 'save_queries' => TRUE ); + +$db['prod'] = array( + 'dsn' => '', + 'hostname' => 'apollodec.com', + 'username' => 'apollod4_DEV', + 'password' => 'apollo1234', + 'database' => 'apollod4_ApolloDECDev', + 'dbdriver' => 'mysqli', + 'dbprefix' => '', + 'pconnect' => FALSE, + 'db_debug' => (ENVIRONMENT !== 'production'), + 'cache_on' => FALSE, + 'cachedir' => '', + 'char_set' => 'utf8', + 'dbcollat' => 'utf8_general_ci', + 'swap_pre' => '', + 'encrypt' => FALSE, + 'compress' => FALSE, + 'stricton' => FALSE, + 'failover' => array(), + 'save_queries' => TRUE +); \ No newline at end of file diff --git a/api/application/controllers/Branch_Controller.php b/api/application/controllers/Branch_Controller.php index be198775..83e3b2c0 100644 --- a/api/application/controllers/Branch_Controller.php +++ b/api/application/controllers/Branch_Controller.php @@ -36,7 +36,9 @@ class Branch_Controller extends REST_Controller { // load the model $this->load->model('Branch_model', 'branch_model'); - $this->load->library('aws_s3'); + //$this->load->library('AWS_S3'); + //$this->load->library('AWS_SNS'); + $this->load->library('AWS_SES'); } /* * get branch details @@ -103,16 +105,18 @@ class Branch_Controller extends REST_Controller { /* STORE FILE TO S3*/ /* GET FILE FROM S3*/ - $res = $this->aws_s3->getSingleObjectInaBucket(); - //print_r($res); - //echo "\n\n\n\n\n
"; - //header("Content-Type:{$res['ContentType']}"); - header("Content-Disposition:attachment; filename='woodgrass1.jpg'"); + // $res = $this->aws_s3->getSingleObjectInaBucket(); + // //print_r($res); + // //echo "\n\n\n\n\n
"; + // //header("Content-Type:{$res['ContentType']}"); + // header("Content-Disposition:attachment; filename='woodgrass1.jpg'"); - echo $res['Body']; + // echo $res['Body']; /* GET FILE FROM S3*/ + echo "SNS"; + } public function testPDF_get() diff --git a/api/application/libraries/AWS_SES.php b/api/application/libraries/AWS_SES.php new file mode 100644 index 00000000..6dae5211 --- /dev/null +++ b/api/application/libraries/AWS_SES.php @@ -0,0 +1,90 @@ +'us-east-1','version'=>'latest','credentials' => array( + 'key' => 'AKIAJCUXIQE32HVETEOQ', + 'secret' => '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', + )); + public function __construct() + { + // Construct the parent class + //parent::__construct(); + + //echo "listAllBuckets"; + $this->SES = SesClient::factory($this->ses_properties); + $this->sendMail(); + + } + + public function sendMail() + { + $sender_email = 'velmurugan.s@venbainfotech.com'; + + // Replace these sample addresses with the addresses of your recipients. If + // your account is still in the sandbox, these addresses must be verified. + $recipient_emails = ['sanjeev.p@venbainfotech.com']; + + // Specify a configuration set. If you do not want to use a configuration + // set, comment the following variable, and the + // 'ConfigurationSetName' => $configuration_set argument below. + //$configuration_set = 'ConfigSet'; + + $subject = 'Amazon SES test (AWS SDK for PHP)'; + $plaintext_body = 'This email was sent with Amazon SES using the AWS SDK for PHP.' ; + $html_body = '

AWS Amazon Simple Email Service Test Email

'. + '

This email was sent with '. + 'Amazon SES using the '. + 'AWS SDK for PHP.

'; + $char_set = 'UTF-8'; + + try { + $result = $this->SES->sendEmail([ + 'Destination' => [ + 'ToAddresses' => $recipient_emails, + ], + 'ReplyToAddresses' => [$sender_email], + 'Source' => $sender_email, + 'Message' => [ + 'Body' => [ + 'Html' => [ + 'Charset' => $char_set, + 'Data' => $html_body, + ], + 'Text' => [ + 'Charset' => $char_set, + 'Data' => $plaintext_body, + ], + ], + 'Subject' => [ + 'Charset' => $char_set, + 'Data' => $subject, + ], + ], + // If you aren't using a configuration set, comment or delete the + // following line + //'ConfigurationSetName' => $configuration_set, + ]); + $messageId = $result['MessageId']; + echo("Email sent! Message ID: $messageId"."\n"); + } catch (AwsException $e) { + // output error message if fails + echo $e->getMessage(); + echo("The email was not sent. Error message: ".$e->getAwsErrorMessage()."\n"); + echo "\n"; + } + } + + + +} + +?> \ No newline at end of file diff --git a/api/application/libraries/AWS_SNS.php b/api/application/libraries/AWS_SNS.php new file mode 100644 index 00000000..a89fb5bb --- /dev/null +++ b/api/application/libraries/AWS_SNS.php @@ -0,0 +1,66 @@ +'us-east-1','version'=>'latest','credentials' => array( + 'key' => 'AKIAJCUXIQE32HVETEOQ', + 'secret' => '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', + )); + public function __construct() + { + // Construct the parent class + //parent::__construct(); + + //echo "listAllBuckets"; + $this->sns = SnsClient::factory($this->sns_properties); + $this->sendSMS(); + + } + + public function sendSMS() + { + echo "SEND SMS CALLED"; + // $args = array( + // "SenderID" => "TEMP", + // "SMSType" => "Transactional", + // "Message" => "Hi Rajasekar this is from AWS SNS service.", + // "PhoneNumber" => "+917402014940" + // ); + + $args = array( + "MessageAttributes" => [ + 'AWS.SNS.SMS.SenderID' => [ + 'DataType' => 'String', + 'StringValue' => 'SPARQ' + ], + 'AWS.SNS.SMS.SMSType' => [ + 'DataType' => 'String', + 'StringValue' => 'Transactional' + ] + ], + "Message" => "Hi Rajasekar this is from AWS SNS service.", + "PhoneNumber" => "+917402014940" + ); + + $result = $this->sns->publish($args); + echo "
";
+		var_dump($result);
+		echo "
"; + } + + + + + + +} + +?> \ No newline at end of file