<commit_before><?php
/**
 *  Copyright (c) Microsoft. All rights reserved. Licensed under the MIT license.
 *  See full license at the bottom of this file.
 * 
 *  PHP version 5
 *
 *  @category Code_Sample
 *  @package  O365-PHP-Unified-API-Connect
 *  @author   <NAME> <<EMAIL>>
 *  @license  MIT License
 *  @link     http://GitHub.com/OfficeDev/O365-PHP-Unified-API-Connect
 */
 
/*! 
    @abstract User is directed to this page after the web app gets tokens.
              The page offers UI to send a welcome email to the specified account. 
 */
 
//We store user name, id, and tokens in session variables
if (session_status() == PHP_SESSION_NONE)
{
    session_start();
}
require_once 'MailManager.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" onclick="window.location.href='Disconnect.php'"><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>
        <button class="ms-Button">
                <span class="ms-Button-label">Send mail</span>
        </button>
        <div>
            <?php
                // The user clicked the "Send mail" button 
                if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['recipient']))
                {
                    try
                    {
                        MailManager::sendWelcomeMail($_POST['recipient']);
            ?>
                        <p class="ms-font-m ms-fontColor-green">Successfully sent an email to <?=$_POST['recipient']?>!</p>
            <?php
                    } 
                    catch (RuntimeException $e) 
                    {
            ?>
                        <p class="ms-font-m ms-fontColor-redDark">Something went wrong, couldn't send an email.</p>
            <?php            
                    }
            
                }
            ?>
        
        </div>
    </div>
    </div>
    </form>
</div>
</body>

</html>
<?php
// *********************************************************
//
// 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.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
// *********************************************************    
?><commit_msg>Took care of SendMail.php style errors and warnings<commit_after><?php
/**
 *  Copyright (c) Microsoft. All rights reserved. Licensed under the MIT license.
 *  See full license at the bottom of this file.
 * 
 *  PHP version 5
 *
 *  @category Code_Sample
 *  @package  O365-PHP-Unified-API-Connect
 *  @author   <NAME> <<EMAIL>>
 *  @license  MIT License
 *  @link     http://GitHub.com/OfficeDev/O365-PHP-Unified-API-Connect
 */
 
/*! 
    @abstract User is directed to this page after the web app gets tokens.
              The page offers UI to send a welcome email to the specified account. 
 */
 
//We store user name, id, and tokens in session variables
if (session_status() == PHP_SESSION_NONE) {
    session_start();
}
require_once 'MailManager.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" 
            onclick="window.location.href='Disconnect.php'">
            <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, <?php echo $_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="<?php echo $_SESSION['unique_name']; ?>"
        >
        </div>
        <button class="ms-Button">
                <span class="ms-Button-label">Send mail</span>
        </button>
        <div>
            <?php
                // The user clicked the "Send mail" button 
            if ($_SERVER['REQUEST_METHOD'] === 'POST'
                && isset($_POST['recipient'])
            ) {
                try
                {
                    MailManager::sendWelcomeMail($_POST['recipient']);
            ?>
                        <p 
                            class="ms-font-m ms-fontColor-green">
                            Successfully sent an email to 
                            <?php echo $_POST['recipient']; ?>!
                        </p>
            <?php
                } 
                catch (RuntimeException $e) 
                {
            ?>
                        <p 
                            class="ms-font-m ms-fontColor-redDark">
                            Something went wrong, couldn't send an email.
                        </p>
            <?php            
                }
            }
            ?>
        
        </div>
    </div>
    </div>
    </form>
</div>
</body>

</html>
<?php
// *********************************************************
//
// 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.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
// *********************************************************    
?>
{'fraction_non_alphanumeric': 0.15262991462000633, 'fraction_numerical': 0.0075893327711605355, 'mean_word_length': 2.196765498652291, 'pattern_counts': {'":': 0, '<': 131, '<?xml version=': 0, '>': 131, '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': '7101470', 'n_tokens_mistral': 2781, 'n_tokens_neox': 2581, 'n_words': 834}