TEst pull via sh
This commit is contained in:
1
helper/shell-gitpull.sh
Normal file
1
helper/shell-gitpull.sh
Normal file
@ -0,0 +1 @@
|
|||||||
|
cd .. && git pull origin master
|
@ -24,6 +24,16 @@ return [
|
|||||||
],
|
],
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
|
'srcpull' => [
|
||||||
|
'type' => Literal::class,
|
||||||
|
'options' => [
|
||||||
|
'route' => '/pull',
|
||||||
|
'defaults' => [
|
||||||
|
'controller' => Controller\IndexController::class,
|
||||||
|
'action' => 'pull',
|
||||||
|
],
|
||||||
|
],
|
||||||
|
],
|
||||||
'contact' => [
|
'contact' => [
|
||||||
'type' => Literal::class,
|
'type' => Literal::class,
|
||||||
'options' => [
|
'options' => [
|
||||||
|
@ -16,7 +16,26 @@ use PHPMailer\PHPMailer\Exception;
|
|||||||
class IndexController extends AbstractActionController
|
class IndexController extends AbstractActionController
|
||||||
{
|
{
|
||||||
public function indexAction()
|
public function indexAction()
|
||||||
{ $view = new ViewModel();
|
{
|
||||||
|
$view = new ViewModel();
|
||||||
|
$view->setTerminal(true);
|
||||||
|
return $view;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function pullAction()
|
||||||
|
{
|
||||||
|
$view = new JsonModel();
|
||||||
|
$old_path = getcwd();
|
||||||
|
|
||||||
|
var_dump($old_path);
|
||||||
|
var_dump($old_path.'/helper');
|
||||||
|
|
||||||
|
chdir($old_path.'/helper' );
|
||||||
|
//make sure to make the shell file executeable first before running the shell_exec function
|
||||||
|
$output = shell_exec('./shell-gitpull.sh');
|
||||||
|
var_dump($output);
|
||||||
|
echo $output;
|
||||||
|
die;
|
||||||
$view->setTerminal(true);
|
$view->setTerminal(true);
|
||||||
return $view;
|
return $view;
|
||||||
}
|
}
|
||||||
@ -29,62 +48,62 @@ class IndexController extends AbstractActionController
|
|||||||
$isEnvoye = FALSE;
|
$isEnvoye = FALSE;
|
||||||
ini_set('SMTP', 'smtp.free.fr');
|
ini_set('SMTP', 'smtp.free.fr');
|
||||||
|
|
||||||
if(isset($_POST['name']) && isset($_POST['email']) && isset($_POST['subject']) && isset($_POST['message'])){
|
if (isset($_POST['name']) && isset($_POST['email']) && isset($_POST['subject']) && isset($_POST['message'])) {
|
||||||
$name = $_POST['name'];
|
$name = $_POST['name'];
|
||||||
$email = $_POST['email'];
|
$email = $_POST['email'];
|
||||||
$subject = $_POST['subject'];
|
$subject = $_POST['subject'];
|
||||||
$message = nl2br($_POST['message']);
|
$message = nl2br($_POST['message']);
|
||||||
$to = "nicolas.riault@gmail.com";
|
$to = "nicolas.riault@gmail.com";
|
||||||
$from = $email;
|
$from = $email;
|
||||||
$message_format = '<b>Nom:</b> '.$name.' <br><b>Email:</b> '.$email.' <p>'.$message.'</p>';
|
$message_format = '<b>Nom:</b> ' . $name . ' <br><b>Email:</b> ' . $email . ' <p>' . $message . '</p>';
|
||||||
$headers = "From: $from\n";
|
$headers = "From: $from\n";
|
||||||
$headers .= "MIME-Version: 1.0\n";
|
$headers .= "MIME-Version: 1.0\n";
|
||||||
$headers .= "content-type: text/html; charset=iso-8859-1\n";
|
$headers .= "content-type: text/html; charset=iso-8859-1\n";
|
||||||
if(mail($to, $subject, $message_format, $headers)){
|
if (mail($to, $subject, $message_format, $headers)) {
|
||||||
$retMessage = "Le mail est envoyé.";
|
$retMessage = "Le mail est envoyé.";
|
||||||
$isEnvoye = TRUE;
|
$isEnvoye = TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* if(isset($_POST['name']) && isset($_POST['email']) && isset($_POST['subject']) && isset($_POST['message'])){
|
/* if(isset($_POST['name']) && isset($_POST['email']) && isset($_POST['subject']) && isset($_POST['message'])){
|
||||||
$name = $_POST['name'];
|
$name = $_POST['name'];
|
||||||
$email = $_POST['email'];
|
$email = $_POST['email'];
|
||||||
$subject = $_POST['subject'];
|
$subject = $_POST['subject'];
|
||||||
$message = nl2br($_POST['message']);
|
$message = nl2br($_POST['message']);
|
||||||
$to = "nicolas.riault@gmail.com";
|
$to = "nicolas.riault@gmail.com";
|
||||||
$from = $email;
|
$from = $email;
|
||||||
$message_format = '<b>Nom:</b> '.$name.' <br><b>Email:</b> '.$email.' <p>'.$message.'</p>';
|
$message_format = '<b>Nom:</b> '.$name.' <br><b>Email:</b> '.$email.' <p>'.$message.'</p>';
|
||||||
|
|
||||||
$mail = new PHPMailer(); // Passing `true` enables exceptions
|
$mail = new PHPMailer(); // Passing `true` enables exceptions
|
||||||
try {
|
try {
|
||||||
//Server settings // Enable verbose debug output
|
//Server settings // Enable verbose debug output
|
||||||
$mail->isSMTP(); // Set mailer to use SMTP
|
$mail->isSMTP(); // Set mailer to use SMTP
|
||||||
$mail->Host = 'smtp.gmail.com'; // Specify main and backup SMTP servers
|
$mail->Host = 'smtp.gmail.com'; // Specify main and backup SMTP servers
|
||||||
$mail->SMTPAuth = true; // Enable SMTP authentication
|
$mail->SMTPAuth = true; // Enable SMTP authentication
|
||||||
$mail->Username = $to; // SMTP username
|
$mail->Username = $to; // SMTP username
|
||||||
$mail->Password = 'Dpz9jou99'; // SMTP password
|
$mail->Password = 'Dpz9jou99'; // SMTP password
|
||||||
$mail->SMTPSecure = 'tls'; // Enable TLS encryption, `ssl` also accepted
|
$mail->SMTPSecure = 'tls'; // Enable TLS encryption, `ssl` also accepted
|
||||||
$mail->Port = 587; // TCP port to connect to
|
$mail->Port = 587; // TCP port to connect to
|
||||||
|
|
||||||
//Recipients
|
//Recipients
|
||||||
$mail->setFrom($from, 'Mailer');
|
$mail->setFrom($from, 'Mailer');
|
||||||
$mail->addReplyTo($to, 'Nicolas Riault');
|
$mail->addReplyTo($to, 'Nicolas Riault');
|
||||||
|
|
||||||
//Content
|
//Content
|
||||||
$mail->isHTML(true); // Set email format to HTML
|
$mail->isHTML(true); // Set email format to HTML
|
||||||
$mail->Subject = $subject;
|
$mail->Subject = $subject;
|
||||||
$mail->Body = $message_format;
|
$mail->Body = $message_format;
|
||||||
|
|
||||||
$mail->send();
|
$mail->send();
|
||||||
$retMessage = "Le mail est envoyé.";
|
$retMessage = "Le mail est envoyé.";
|
||||||
$isEnvoye = TRUE;
|
$isEnvoye = TRUE;
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
|
|
||||||
$retMessage = "Le server n'a pas pu envoyer le message." . $mail->ErrorInfo;
|
$retMessage = "Le server n'a pas pu envoyer le message." . $mail->ErrorInfo;
|
||||||
$isEnvoye = FALSE;
|
$isEnvoye = FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
$result = array(
|
$result = array(
|
||||||
'result' => array(
|
'result' => array(
|
||||||
'content' => array(
|
'content' => array(
|
||||||
|
Reference in New Issue
Block a user