Esempio n. 1
0
 private static function getAuthenticationCode(Client $client)
 {
     // TODO: Figure out why the callback URL (passed as the second
     // parameter) does not seem to matter here, but passing a non-empty
     // string causes the authentication process to not be initiated.
     $url = $client->getLoginUrl(array('wl.skydrive_update'), '');
     echo "Integration test suite started.\n\nPlease sign into your OneDrive account from this page and grant to the app all\nthe privileges requested:\n\n\t{$url}\n\nThis process will then resume, do not interrupt it.\n";
     $server = @socket_create_listen(self::PORT, 1);
     if (false === $server) {
         $message = socket_strerror(socket_last_error());
         throw new \Exception($message);
     }
     $socketRemote = @socket_accept($server);
     if (false === $socketRemote) {
         $message = socket_strerror(socket_last_error());
         socket_close($server);
         throw new \Exception($message);
     }
     $buffer = @socket_read($socketRemote, 4096, PHP_BINARY_READ);
     if (false === $buffer) {
         $message = socket_strerror(socket_last_error());
         socket_close($socketRemote);
         socket_close($server);
         throw new \Exception($message);
     }
     $size = @socket_write($socketRemote, implode("\r\n", array('HTTP/1.1 200 OK', 'Content-Type: text/html; charset=utf-8', '', '<!DOCTYPE html><h1>Thank you</h1><p>The integration test suite started running. You can close this window.</p>')));
     if (false === $size) {
         $message = socket_strerror(socket_last_error());
         socket_close($socketRemote);
         socket_close($server);
         throw new \Exception($message);
     }
     socket_close($socketRemote);
     socket_close($server);
     list($headers, $body) = explode("\r\n\r\n", $buffer);
     $headers = explode("\r\n", $headers);
     $request = $headers[0];
     if (1 !== preg_match('/^GET\\s+(.+)\\s+HTTP\\/1\\.1$/', $request, $matches)) {
         throw new \Exception('Unsupported HTTP request format');
     }
     $url = $matches[1];
     $components = parse_url($url);
     $query = $components['query'];
     $params = explode('&', $query);
     $query = array();
     array_map(function ($param) use(&$query) {
         list($key, $value) = explode('=', $param);
         $query[$key] = $value;
     }, $params);
     if (!array_key_exists('code', $query)) {
         throw new \Exception('Code is missing from the request. Did you log in successfully and granted all the privileges requested?');
     }
     return $query['code'];
 }
Esempio n. 2
0
<?php

require_once __DIR__ . '/../vendor/autoload.php';
use Krizalys\Onedrive\Client;
session_start();
try {
    if (!array_key_exists('onedrive.client.state', $_SESSION)) {
        throw new \Exception('onedrive.client.state undefined in session');
    }
    $onedrive = new Client(array('state' => $_SESSION['onedrive.client.state']));
    $recentDocs = $onedrive->fetchRecentDocs();
} catch (\Exception $e) {
    $recentDocs = null;
    $status = sprintf('<p class=bg-danger>Reason: <cite>%s</cite><p>', htmlspecialchars($e->getMessage()));
}
?>
<!DOCTYPE html>
<html lang=en dir=ltr>
    <head>
        <meta charset=utf-8>
        <title>Fetching the OneDrive recent documents – Demonstration of the OneDrive SDK for PHP</title>
        <link rel=stylesheet href=//ajax.aspnetcdn.com/ajax/bootstrap/3.2.0/css/bootstrap.min.css>
        <link rel=stylesheet href=//ajax.aspnetcdn.com/ajax/bootstrap/3.2.0/css/bootstrap-theme.min.css>
        <meta name=viewport content="width=device-width, initial-scale=1">
    </head>
    <body>
        <div class=container>
            <h1>Fetching the OneDrive recent documents</h1>
            <?php 
if (null !== $status) {
    echo $status;
Esempio n. 3
0
<?php

require_once __DIR__ . '/../vendor/autoload.php';
use Krizalys\Onedrive\Client;
session_start();
try {
    if (!array_key_exists('onedrive.client.state', $_SESSION)) {
        throw new \Exception('onedrive.client.state undefined in session');
    }
    $onedrive = new Client(array('state' => $_SESSION['onedrive.client.state']));
    $recentDocs = $onedrive->fetchShared();
} catch (\Exception $e) {
    $recentDocs = null;
    $status = sprintf('<p class=bg-danger>Reason: <cite>%s</cite><p>', htmlspecialchars($e->getMessage()));
}
?>
<!DOCTYPE html>
<html lang=en dir=ltr>
    <head>
        <meta charset=utf-8>
        <title>Fetching the OneDrive shared objects – Demonstration of the OneDrive SDK for PHP</title>
        <link rel=stylesheet href=//ajax.aspnetcdn.com/ajax/bootstrap/3.2.0/css/bootstrap.min.css>
        <link rel=stylesheet href=//ajax.aspnetcdn.com/ajax/bootstrap/3.2.0/css/bootstrap-theme.min.css>
        <meta name=viewport content="width=device-width, initial-scale=1">
    </head>
    <body>
        <div class=container>
            <h1>Fetching the OneDrive shared objects</h1>
            <?php 
if (null !== $status) {
    echo $status;
<?php

require_once __DIR__ . '/../vendor/autoload.php';
use Krizalys\Onedrive\Client;
session_start();
try {
    if (!array_key_exists('onedrive.client.state', $_SESSION)) {
        throw new \Exception('onedrive.client.state undefined in session');
    }
    $onedrive = new Client(array('state' => $_SESSION['onedrive.client.state']));
    if (!array_key_exists('id', $_GET)) {
        throw new \Exception('id undefined in $_GET');
    }
    $properties = array();
    if (!empty($_GET['name'])) {
        $properties['name'] = $_GET['name'];
    }
    if (!empty($_GET['description'])) {
        $properties['description'] = $_GET['description'];
    }
    $id = $_GET['id'];
    $onedrive->updateObject($id, $properties);
    $status = sprintf('<p class=bg-success>The object <em>%s</em> has been updated in your OneDrive account using the <code>Client::updateObject</code> method.</p>', htmlspecialchars($id));
} catch (\Exception $e) {
    $status = sprintf('<p class=bg-danger>The object <em>%s</em> has <strong>not</strong> been updated in your OneDrive account using the <code>Client::updateObject</code> method. Reason: <cite>%s</cite></p>', htmlspecialchars($id), htmlspecialchars($e->getMessage()));
}
?>
<!DOCTYPE html>
<html lang=en dir=ltr>
    <head>
        <meta charset=utf-8>
Esempio n. 5
0
<?php

require_once __DIR__ . '/../vendor/autoload.php';
use Krizalys\Onedrive\Client;
session_start();
try {
    if (!array_key_exists('onedrive.client.state', $_SESSION)) {
        throw new \Exception('onedrive.client.state undefined in session');
    }
    $onedrive = new Client(array('state' => $_SESSION['onedrive.client.state']));
    $docs = $onedrive->fetchDocs();
} catch (\Exception $e) {
    $docs = null;
    $status = sprintf('<p class=bg-danger>Reason: <cite>%s</cite><p>', htmlspecialchars($e->getMessage()));
}
?>
<!DOCTYPE html>
<html lang=en dir=ltr>
    <head>
        <meta charset=utf-8>
        <title>Fetching the OneDrive documents – Demonstration of the OneDrive SDK for PHP</title>
        <link rel=stylesheet href=//ajax.aspnetcdn.com/ajax/bootstrap/3.2.0/css/bootstrap.min.css>
        <link rel=stylesheet href=//ajax.aspnetcdn.com/ajax/bootstrap/3.2.0/css/bootstrap-theme.min.css>
        <meta name=viewport content="width=device-width, initial-scale=1">
    </head>
    <body>
        <div class=container>
            <h1>Fetching the OneDrive documents</h1>
            <?php 
if (null !== $status) {
    echo $status;
Esempio n. 6
0
require_once __DIR__ . '/../vendor/autoload.php';
use Krizalys\Onedrive\Client;
try {
    // If we don't have a code in the query string (meaning that the user did
    // not log in successfully or did not grant privileges requested), we cannot
    // proceed in obtaining an access token.
    if (!array_key_exists('code', $_GET)) {
        throw new \Exception('code undefined in $_GET');
    }
    session_start();
    // Attempt to load the OneDrive client' state persisted from the previous
    // request.
    if (!array_key_exists('onedrive.client.state', $_SESSION)) {
        throw new \Exception('onedrive.client.state undefined in $_SESSION');
    }
    $onedrive = new Client(array('client_id' => $config['ONEDRIVE_CLIENT_ID'], 'state' => $_SESSION['onedrive.client.state']));
    // Obtain the token using the code received by the OneDrive API.
    $onedrive->obtainAccessToken($config['ONEDRIVE_CLIENT_SECRET'], $_GET['code']);
    // Persist the OneDrive client' state for next API requests.
    $_SESSION['onedrive.client.state'] = $onedrive->getState();
} catch (\Exception $e) {
    $status = sprintf('<p>Reason: <cite>%s</cite></p>', htmlspecialchars($e->getMessage()));
}
?>
<!DOCTYPE html>
<html lang=en dir=ltr>
    <head>
        <meta charset=utf-8>
        <title>Authentication complete – Demonstration of the OneDrive SDK for PHP</title>
        <link rel=stylesheet href=//ajax.aspnetcdn.com/ajax/bootstrap/3.2.0/css/bootstrap.min.css>
        <link rel=stylesheet href=//ajax.aspnetcdn.com/ajax/bootstrap/3.2.0/css/bootstrap-theme.min.css>
Esempio n. 7
0
<?php

require_once __DIR__ . '/../vendor/autoload.php';
use Krizalys\Onedrive\Client;
session_start();
try {
    if (!array_key_exists('onedrive.client.state', $_SESSION)) {
        throw new \Exception('onedrive.client.state undefined in session');
    }
    $onedrive = new Client(array('state' => $_SESSION['onedrive.client.state']));
    if (!array_key_exists('id', $_GET)) {
        throw new \Exception('id undefined in $_GET');
    }
    $properties = array();
    if (!empty($_GET['id'])) {
        $properties['id'] = $_GET['id'];
    }
    if (!empty($_GET['destination_id'])) {
        $properties['destination_id'] = $_GET['destination_id'];
    }
    $id = $_GET['id'];
    $file = $onedrive->fetchObject($id);
    if ($file->isFolder()) {
        throw new \Exception('OneDrive does not support copying folders');
    }
    $file->copy($_GET['destination_id']);
    $status = sprintf('<p class=bg-success>The file <em>%s</em> has been copied using the <code>File::copy</code> method.</p>', htmlspecialchars($id));
} catch (\Exception $e) {
    $status = sprintf('<p class=bg-danger>The file <em>%s</em> has <strong>not</strong> been copied using the <code>File::copy</code> method. Reason: <cite>%s</cite></p>', htmlspecialchars($id), htmlspecialchars($e->getMessage()));
}
?>
Esempio n. 8
0
<?php

require_once __DIR__ . '/../vendor/autoload.php';
use Krizalys\Onedrive\Client;
session_start();
try {
    if (!array_key_exists('onedrive.client.state', $_SESSION)) {
        throw new \Exception('onedrive.client.state undefined in session');
    }
    $onedrive = new Client(array('state' => $_SESSION['onedrive.client.state']));
    $pics = $onedrive->fetchPics();
} catch (\Exception $e) {
    $pics = null;
    $status = sprintf('<p class=bg-danger>Reason: <cite>%s</cite><p>', htmlspecialchars($e->getMessage()));
}
?>
<!DOCTYPE html>
<html lang=en dir=ltr>
    <head>
        <meta charset=utf-8>
        <title>Fetching the OneDrive pictures – Demonstration of the OneDrive SDK for PHP</title>
        <link rel=stylesheet href=//ajax.aspnetcdn.com/ajax/bootstrap/3.2.0/css/bootstrap.min.css>
        <link rel=stylesheet href=//ajax.aspnetcdn.com/ajax/bootstrap/3.2.0/css/bootstrap-theme.min.css>
        <meta name=viewport content="width=device-width, initial-scale=1">
    </head>
    <body>
        <div class=container>
            <h1>Fetching the OneDrive pictures</h1>
            <?php 
if (null !== $status) {
    echo $status;
Esempio n. 9
0
<?php

require_once __DIR__ . '/../vendor/autoload.php';
use Krizalys\Onedrive\Client;
session_start();
try {
    if (!array_key_exists('onedrive.client.state', $_SESSION)) {
        throw new \Exception('onedrive.client.state undefined in session');
    }
    $onedrive = new Client(array('state' => $_SESSION['onedrive.client.state']));
    if (!array_key_exists('id', $_GET)) {
        throw new \Exception('id undefined in $_GET');
    }
    $properties = array();
    if (!empty($_GET['id'])) {
        $properties['id'] = $_GET['id'];
    }
    if (!empty($_GET['destination_id'])) {
        $properties['destination_id'] = $_GET['destination_id'];
    }
    $id = $_GET['id'];
    $object = $onedrive->fetchObject($_GET['id']);
    $object->move($_GET['destination_id']);
    $status = sprintf('<p class=bg-success>The object <em>%s</em> has been moved in your OneDrive account using the <code>Object::move</code> method.</p>', htmlspecialchars($id));
} catch (\Exception $e) {
    $status = sprintf('<p class=bg-danger>The object <em>%s</em> has <strong>not</strong> been moved in your OneDrive account using the <code>Object::move</code> method. Reason: <cite>%s</cite></p>', htmlspecialchars($id));
}
?>
<!DOCTYPE html>
<html lang=en dir=ltr>
    <head>
Esempio n. 10
0
<?php

require_once __DIR__ . '/../vendor/autoload.php';
use Krizalys\Onedrive\Client;
session_start();
try {
    if (!array_key_exists('onedrive.client.state', $_SESSION)) {
        throw new \Exception('onedrive.client.state undefined in session');
    }
    $onedrive = new Client(array('state' => $_SESSION['onedrive.client.state']));
    $root = $onedrive->fetchRoot();
    $objects = $root->fetchObjects();
} catch (\Exception $e) {
    $root = null;
    $objects = null;
    $status = sprintf('<p class=bg-danger>Reason: <cite>%s</cite><p>', htmlspecialchars($e->getMessage()));
}
?>
<!DOCTYPE html>
<html lang=en dir=ltr>
    <head>
        <meta charset=utf-8>
        <title>Fetching the OneDrive root – Demonstration of the OneDrive SDK for PHP</title>
        <link rel=stylesheet href=//ajax.aspnetcdn.com/ajax/bootstrap/3.2.0/css/bootstrap.min.css>
        <link rel=stylesheet href=//ajax.aspnetcdn.com/ajax/bootstrap/3.2.0/css/bootstrap-theme.min.css>
        <meta name=viewport content="width=device-width, initial-scale=1">
    </head>
    <body>
        <div class=container>
            <h1>Fetching the OneDrive root</h1>
            <?php 
Esempio n. 11
0
<?php

require_once __DIR__ . '/../vendor/autoload.php';
use Krizalys\Onedrive\Client;
session_start();
try {
    if (!array_key_exists('onedrive.client.state', $_SESSION)) {
        throw new \Exception('onedrive.client.state undefined in session');
    }
    $onedrive = new Client(array('state' => $_SESSION['onedrive.client.state']));
    if (!array_key_exists('id', $_GET)) {
        throw new \Exception('id undefined in $_GET');
    }
    $id = $_GET['id'];
    $onedrive->deleteObject($id);
    $status = sprintf('<p class=bg-success>The object <em>%s</em> has been deleted from your OneDrive account using the <code>Client::deleteObject</code> method.</p>', htmlspecialchars($id));
} catch (\Exception $e) {
    $status = sprintf('<p class=bg-danger>The object <em>%s</em> has <strong>not</strong> been deleted from your OneDrive account using the <code>Client::deleteObject</code> method. Reason: <cite>%s</cite></p>', htmlspecialchars($id), htmlspecialchars($e->getMessage()));
}
?>
<!DOCTYPE html>
<html lang=en dir=ltr>
    <head>
        <meta charset=utf-8>
        <title>Deleting a OneDrive object – Demonstration of the OneDrive SDK for PHP</title>
        <link rel=stylesheet href=//ajax.aspnetcdn.com/ajax/bootstrap/3.2.0/css/bootstrap.min.css>
        <link rel=stylesheet href=//ajax.aspnetcdn.com/ajax/bootstrap/3.2.0/css/bootstrap-theme.min.css>
        <meta name=viewport content="width=device-width, initial-scale=1">
    </head>
    <body>
        <div class=container>
Esempio n. 12
0
<?php

require_once __DIR__ . '/../vendor/autoload.php';
use Krizalys\Onedrive\Client;
session_start();
try {
    if (!array_key_exists('onedrive.client.state', $_SESSION)) {
        throw new \Exception('onedrive.client.state undefined in session');
    }
    $onedrive = new Client(array('state' => $_SESSION['onedrive.client.state']));
    $quota = $onedrive->fetchQuota();
} catch (\Exception $e) {
    $quota = null;
    $status = sprintf('<p class=bg-danger>Reason: <cite>%s</cite><p>', htmlspecialchars($e->getMessage()));
}
?>
<!DOCTYPE html>
<html lang=en dir=ltr>
    <head>
        <meta charset=utf-8>
        <title>Fetching the OneDrive quota – Demonstration of the OneDrive SDK for PHP</title>
        <link rel=stylesheet href=//ajax.aspnetcdn.com/ajax/bootstrap/3.2.0/css/bootstrap.min.css>
        <link rel=stylesheet href=//ajax.aspnetcdn.com/ajax/bootstrap/3.2.0/css/bootstrap-theme.min.css>
        <meta name=viewport content="width=device-width, initial-scale=1">
    </head>
    <body>
        <div class=container>
            <h1>Fetching the OneDrive quota</h1>
            <?php 
if (null !== $status) {
    echo $status;
Esempio n. 13
0
<?php

require_once __DIR__ . '/../vendor/autoload.php';
use Krizalys\Onedrive\Client;
session_start();
try {
    if (!array_key_exists('onedrive.client.state', $_SESSION)) {
        throw new \Exception('onedrive.client.state undefined in session');
    }
    $onedrive = new Client(array('state' => $_SESSION['onedrive.client.state']));
    $cameraRoll = $onedrive->fetchCameraRoll();
} catch (\Exception $e) {
    $cameraRoll = null;
    $status = sprintf('<p class=bg-danger>Reason: <cite>%s</cite><p>', htmlspecialchars($e->getMessage()));
}
?>
<!DOCTYPE html>
<html lang=en dir=ltr>
    <head>
        <meta charset=utf-8>
        <title>Fetching the OneDrive camera roll – Demonstration of the OneDrive SDK for PHP</title>
        <link rel=stylesheet href=//ajax.aspnetcdn.com/ajax/bootstrap/3.2.0/css/bootstrap.min.css>
        <link rel=stylesheet href=//ajax.aspnetcdn.com/ajax/bootstrap/3.2.0/css/bootstrap-theme.min.css>
        <meta name=viewport content="width=device-width, initial-scale=1">
    </head>
    <body>
        <div class=container>
            <h1>Fetching the OneDrive camera roll</h1>
            <?php 
if (null !== $status) {
    echo $status;
Esempio n. 14
0
<?php

$config = (include __DIR__ . '/../config.php') or die('Configuration file not found');
require_once __DIR__ . '/../vendor/autoload.php';
use Krizalys\Onedrive\Client;
try {
    // Instantiates a OneDrive client bound to your OneDrive application.
    $onedrive = new Client(array('client_id' => $config['ONEDRIVE_CLIENT_ID']));
    // Gets a log in URL with sufficient privileges from the OneDrive API.
    $url = $onedrive->getLogInUrl(array('wl.signin', 'wl.basic', 'wl.contacts_skydrive', 'wl.skydrive_update'), $config['ONEDRIVE_CALLBACK_URI']);
    session_start();
    // Persist the OneDrive client' state for next API requests.
    $_SESSION = array('onedrive.client.state' => $onedrive->getState());
} catch (\Exception $e) {
    $status = sprintf('<p>Reason: <cite>%s</cite></p>', htmlspecialchars($e->getMesssage()));
    $url = null;
}
?>
<!DOCTYPE html>
<html lang=en dir=ltr>
    <head>
        <meta charset=utf-8>
        <title>Demonstration of the OneDrive SDK for PHP</title>
        <link rel=stylesheet href=//ajax.aspnetcdn.com/ajax/bootstrap/3.2.0/css/bootstrap.min.css>
        <link rel=stylesheet href=//ajax.aspnetcdn.com/ajax/bootstrap/3.2.0/css/bootstrap-theme.min.css>
        <meta name=viewport content="width=device-width, initial-scale=1">
        <meta name=description content="This website provides a live demonstration of the OneDrive SDK for PHP, by Krizalys. See krizalys.com for more details.">
    </head>
    <body>
        <div class=container>
            <h1>Demonstration of the OneDrive SDK for PHP</h1>
Esempio n. 15
0
<?php

require_once __DIR__ . '/../vendor/autoload.php';
use Krizalys\Onedrive\Client;
session_start();
try {
    if (!array_key_exists('onedrive.client.state', $_SESSION)) {
        throw new \Exception('onedrive.client.state undefined in session');
    }
    $onedrive = new Client(array('state' => $_SESSION['onedrive.client.state']));
    $publicDocs = $onedrive->fetchPublicDocs();
} catch (\Exception $e) {
    $publicDocs = null;
    $status = sprintf('<p class=bg-danger>Reason: <cite>%s</cite><p>', htmlspecialchars($e->getMessage()));
}
?>
<!DOCTYPE html>
<html lang=en dir=ltr>
    <head>
        <meta charset=utf-8>
        <title>Fetching the OneDrive public documents – Demonstration of the OneDrive SDK for PHP</title>
        <link rel=stylesheet href=//ajax.aspnetcdn.com/ajax/bootstrap/3.2.0/css/bootstrap.min.css>
        <link rel=stylesheet href=//ajax.aspnetcdn.com/ajax/bootstrap/3.2.0/css/bootstrap-theme.min.css>
        <meta name=viewport content="width=device-width, initial-scale=1">
    </head>
    <body>
        <div class=container>
            <h1>Fetching the OneDrive public documents</h1>
            <?php 
if (null !== $status) {
    echo $status;
Esempio n. 16
0
 public function testLogShouldCallOnceLoggerLogWithExpectedArguments()
 {
     $logger = m::mock('Psr\\Log\\LoggerInterface');
     $logger->shouldReceive('log')->once()->with(123, 'Test record', array('key' => 'value'));
     $client = new Client(array('logger' => $logger));
     $client->log(123, 'Test record', array('key' => 'value'));
 }
Esempio n. 17
0
<?php

require_once __DIR__ . '/../vendor/autoload.php';
use Krizalys\Onedrive\Client;
session_start();
try {
    if (!array_key_exists('onedrive.client.state', $_SESSION)) {
        throw new \Exception('onedrive.client.state undefined in session');
    }
    $onedrive = new Client(array('state' => $_SESSION['onedrive.client.state']));
    $id = empty($_GET['id']) ? null : $_GET['id'];
    $folder = $onedrive->fetchObject($id);
    $objects = $folder->fetchObjects();
    $status = null;
} catch (\Exception $e) {
    $folder = null;
    $objects = null;
    $status = sprintf('<p class=bg-danger>Reason: <cite>%s</cite><p>', htmlspecialchars($e->getMessage()));
}
?>
<!DOCTYPE html>
<html lang=en dir=ltr>
    <head>
        <meta charset=utf-8>
        <title>Fetching a OneDrive folder – Demonstration of the OneDrive SDK for PHP</title>
        <link rel=stylesheet href=//ajax.aspnetcdn.com/ajax/bootstrap/3.2.0/css/bootstrap.min.css>
        <link rel=stylesheet href=//ajax.aspnetcdn.com/ajax/bootstrap/3.2.0/css/bootstrap-theme.min.css>
        <meta name=viewport content="width=device-width, initial-scale=1">
    </head>
    <body>
        <div class=container>
Esempio n. 18
0
<?php

require_once __DIR__ . '/../vendor/autoload.php';
use Krizalys\Onedrive\Client;
session_start();
try {
    if (!array_key_exists('onedrive.client.state', $_SESSION)) {
        throw new \Exception('onedrive.client.state undefined in session');
    }
    $onedrive = new Client(array('state' => $_SESSION['onedrive.client.state']));
    if (!array_key_exists('name', $_GET)) {
        throw new \Exception('name undefined in $_GET');
    }
    if (!array_key_exists('content', $_GET)) {
        throw new \Exception('content undefined in $_GET');
    }
    $options = array_key_exists('name_conflict_behavior', $_GET) ? array('name_conflict_behavior' => $_GET['name_conflict_behavior']) : array();
    $parentId = empty($_GET['parent_id']) ? null : $_GET['parent_id'];
    $name = $_GET['name'];
    $parent = $onedrive->fetchObject($parentId);
    $file = $parent->createFile($name, $_GET['content'], $options);
    $status = sprintf('<p class=bg-success>The file <em>%s</em> has been created using the <code>Object::createFile</code> method.</p>', htmlspecialchars($name));
} catch (\Exception $e) {
    $file = null;
    $status = sprintf('<p class=bg-danger>The file <em>%s</em> has <strong>not</strong> been created using the <code>Object::createFile</code> method. Reason: <cite>%s</cite></p>', htmlspecialchars($name), $e->getMessage());
}
?>
<!DOCTYPE html>
<html lang=en dir=ltr>
    <head>
        <meta charset=utf-8>