<commit_before><!-- Copyright (c) Microsoft. All rights reserved. Licensed under the MIT license. See full license at the bottom of this file. -->

<?php
    //We store user name, id, and tokens in session variables
    session_start();
    require_once('RequestManager.php');
?>
<!DOCTYPE html>
<html>

<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <title>O365 Connect sample</title>

  <!-- Third party dependencies. -->
  <link rel="stylesheet" href="https://appsforoffice.microsoft.com/fabric/1.0/fabric.css">
  <link rel="stylesheet" href="https://appsforoffice.microsoft.com/fabric/1.0/fabric.components.css">
  
  <!-- App code. -->
  <link rel="stylesheet" href="styles.css">
  
</head>

<body class="ms-Grid">
  <div class="ms-Grid-row">
  <!-- App navigation bar markup. -->
  <div class="ms-NavBar">
    <ul class="ms-NavBar-items">
      <li class="navbar-header">Office 365 Connect sample</li>
      <li class="ms-NavBar-item ms-NavBar-item--right"><i class="ms-Icon ms-Icon--x"></i> Disconnect</li>
    </ul>
  </div>

  <!-- App main content markup. -->
  <form action="" method="post">
  <div class="ms-Grid-col ms-u-mdPush1 ms-u-md9 ms-u-lgPush1 ms-u-lg6">
    <div>
      <h2 class="ms-font-xxl ms-fontWeight-semibold">Hi, <?=$_SESSION['given_name']?>!</h2>
      <p class="ms-font-xl">You're now connected to Office 365. Click the mail icon below to send a message from your account using the Office 365 unified API. </p>
      <div class="ms-TextField">
        <input class="ms-TextField-field" name="recipient" value="<?=$_SESSION['unique_name']?>">
      </div>
      <div class="icon-holder">
        <button class="ms-Icon ms-Icon--mailSend big-icon"></button>
      </div>
      <div>
          <?php
              if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['recipient'])) {
                  RequestManager::sendMail($_POST['recipient']);
                  ?>
                  <p class="ms-font-m ms-fontColor-green">Successfully sent an email to <?=$_POST['recipient']?>!</p>
                  <?php
              }
          ?>
        
      </div>
      <div>
        <p class="ms-font-m ms-fontColor-redDark">Something went wrong, couldn't send an email.</p>        
      </div>
    </div>
  </div>
  </form>
</div>
</body>

</html>

<!--
O365-PHP-Unified-API-Connect, https://github.com/OfficeDev/O365-PHP-Unified-API-Connect
 
Copyright (c) Microsoft Corporation
All rights reserved. 
 
MIT License:
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
 
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
 <commit_msg>Removed error message in SendMail.php page. Error handling will be added in another branch<commit_after><!-- Copyright (c) Microsoft. All rights reserved. Licensed under the MIT license. See full license at the bottom of this file. -->

<?php
    //We store user name, id, and tokens in session variables
    session_start();
    require_once('RequestManager.php');
?>
<!DOCTYPE html>
<html>

<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <title>O365 Connect sample</title>

  <!-- Third party dependencies. -->
  <link rel="stylesheet" href="https://appsforoffice.microsoft.com/fabric/1.0/fabric.css">
  <link rel="stylesheet" href="https://appsforoffice.microsoft.com/fabric/1.0/fabric.components.css">
  
  <!-- App code. -->
  <link rel="stylesheet" href="styles.css">
  
</head>

<body class="ms-Grid">
  <div class="ms-Grid-row">
  <!-- App navigation bar markup. -->
  <div class="ms-NavBar">
    <ul class="ms-NavBar-items">
      <li class="navbar-header">Office 365 Connect sample</li>
      <li class="ms-NavBar-item ms-NavBar-item--right"><i class="ms-Icon ms-Icon--x"></i> Disconnect</li>
    </ul>
  </div>

  <!-- App main content markup. -->
  <form action="" method="post">
  <div class="ms-Grid-col ms-u-mdPush1 ms-u-md9 ms-u-lgPush1 ms-u-lg6">
    <div>
      <h2 class="ms-font-xxl ms-fontWeight-semibold">Hi, <?=$_SESSION['given_name']?>!</h2>
      <p class="ms-font-xl">You're now connected to Office 365. Click the mail icon below to send a message from your account using the Office 365 unified API. </p>
      <div class="ms-TextField">
        <input class="ms-TextField-field" name="recipient" value="<?=$_SESSION['unique_name']?>">
      </div>
      <div class="icon-holder">
        <button class="ms-Icon ms-Icon--mailSend big-icon"></button>
      </div>
      <div>
          <?php
              if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['recipient'])) {
                  RequestManager::sendMail($_POST['recipient']);
                  ?>
                  <p class="ms-font-m ms-fontColor-green">Successfully sent an email to <?=$_POST['recipient']?>!</p>
                  <?php
              }
          ?>
        
      </div>
      <div>
        <!--<p class="ms-font-m ms-fontColor-redDark">Something went wrong, couldn't send an email.</p>-->        
      </div>
    </div>
  </div>
  </form>
</div>
</body>

</html>

<!--
O365-PHP-Unified-API-Connect, https://github.com/OfficeDev/O365-PHP-Unified-API-Connect
 
Copyright (c) Microsoft Corporation
All rights reserved. 
 
MIT License:
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
 
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
 
{'fraction_non_alphanumeric': 0.15472365038560412, 'fraction_numerical': 0.009318766066838046, 'mean_word_length': 3.06331592689295, 'pattern_counts': {'":': 0, '<': 130, '<?xml version=': 0, '>': 128, 'https://': 6, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5955919', 'n_tokens_mistral': 1974, 'n_tokens_neox': 1858, 'n_words': 563}