<?php require_once __DIR__ . '/../onedrive-config.php'; require_once __DIR__ . '/../vendor/autoload.php'; session_start(); if (!array_key_exists('onedrive.client.state', $_SESSION)) { throw new Exception('onedrive.client.state undefined in session'); } $onedrive = new \Krizalys\Onedrive\Client(array('state' => $_SESSION['onedrive.client.state'])); $recentDocs = $onedrive->fetchShared(); ?> <!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> <p>The <code>Client::fetchShared</code> method returned:</p> <pre><?php print_r($recentDocs); ?> </pre> <p><a href=app.php>Back to the examples</a></p> </div> </body>
<?php require_once __DIR__ . '/../onedrive-config.php'; require_once __DIR__ . '/../vendor/autoload.php'; session_start(); if (!array_key_exists('onedrive.client.state', $_SESSION)) { throw new Exception('onedrive.client.state undefined in session'); } $onedrive = new \Krizalys\Onedrive\Client(array('state' => $_SESSION['onedrive.client.state'])); $cameraRoll = $onedrive->fetchCameraRoll(); ?> <!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> <p>The <code>Client::fetchCameraRoll</code> method returned:</p> <pre><?php print_r($cameraRoll); ?> </pre> <p><a href=app.php>Back to the examples</a></p> </div> </body>
<?php require_once __DIR__ . '/../onedrive-config.php'; require_once __DIR__ . '/../vendor/autoload.php'; session_start(); if (!array_key_exists('onedrive.client.state', $_SESSION)) { throw new Exception('onedrive.client.state undefined in session'); } $onedrive = new \Krizalys\Onedrive\Client(array('state' => $_SESSION['onedrive.client.state'])); if (!array_key_exists('name', $_GET)) { throw new Exception('name undefined in $_GET'); } $parentId = empty($_GET['parent_id']) ? null : $_GET['parent_id']; $name = $_GET['name']; $description = empty($_GET['description']) ? null : $_GET['description']; $parent = $onedrive->fetchObject($parentId); $folder = $parent->createFolder($name, $description); ?> <!DOCTYPE html> <html lang=en dir=ltr> <head> <meta charset=utf-8> <title>Creating 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> <h1>Creating a OneDrive folder</h1> <p class=bg-success>The folder <em><?php
<?php require_once __DIR__ . '/../onedrive-config.php'; require_once __DIR__ . '/../vendor/autoload.php'; session_start(); // Clears the session and restarts the whole authentication process $_SESSION = array(); // Instantiates a OneDrive client bound to your OneDrive application $onedrive = new \Krizalys\Onedrive\Client(array('client_id' => 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'), ONEDRIVE_CALLBACK_URI); // Persist the OneDrive client' state for next API requests $_SESSION['onedrive.client.state'] = $onedrive->getState(); ?> <!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> <div class=jumbotron> <p><a href="<?php echo htmlspecialchars($url); ?>
<?php require_once __DIR__ . '/../onedrive-config.php'; require_once __DIR__ . '/../vendor/autoload.php'; session_start(); if (!array_key_exists('onedrive.client.state', $_SESSION)) { throw new Exception('onedrive.client.state undefined in session'); } $onedrive = new \Krizalys\Onedrive\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']); ?> <!DOCTYPE html> <html lang=en dir=ltr> <head> <meta charset=utf-8> <title>Moving 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">
require_once __DIR__ . '/../onedrive-config.php'; require_once __DIR__ . '/../vendor/autoload.php'; // 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 \Krizalys\Onedrive\Client(array('client_id' => ONEDRIVE_CLIENT_ID, 'state' => $_SESSION['onedrive.client.state'])); // Obtain the token using the code received by the OneDrive API $onedrive->obtainAccessToken(ONEDRIVE_CLIENT_SECRET, $_GET['code']); // Persist the OneDrive client' state for next API requests $_SESSION['onedrive.client.state'] = $onedrive->getState(); ?> <!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> <meta name=viewport content="width=device-width, initial-scale=1"> </head> <body>
<?php require_once __DIR__ . '/../onedrive-config.php'; require_once __DIR__ . '/../vendor/autoload.php'; session_start(); if (!array_key_exists('onedrive.client.state', $_SESSION)) { throw new Exception('onedrive.client.state undefined in session'); } $onedrive = new \Krizalys\Onedrive\Client(array('state' => $_SESSION['onedrive.client.state'])); $publicDocs = $onedrive->fetchPublicDocs(); ?> <!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> <p>The <code>Client::fetchPublicDocs</code> method returned:</p> <pre><?php print_r($publicDocs); ?> </pre> <p><a href=app.php>Back to the examples</a></p> </div> </body>
<?php require_once __DIR__ . '/onedrive/onedrive-config.php'; require_once __DIR__ . '/vendor/autoload.php'; session_start(); if (!array_key_exists('onedrive.client.state', $_SESSION)) { throw new Exception('onedrive.client.state undefined in session'); } $onedrive = new \Krizalys\Onedrive\Client(array('state' => $_SESSION['onedrive.client.state'])); $root = $onedrive->fetchRoot(); $objects = $root->fetchObjects(); ?> <!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> <p>The <code>Client::fetchRoot</code> method returned the root from your OneDrive account.</p> <h2>Properties</h2> <pre><?php print_r($root->fetchProperties()); ?> </pre> <h2>Objects</h2>
<?php require_once __DIR__ . '/onedrive/onedrive-config.php'; require_once __DIR__ . '/vendor/autoload.php'; // 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 \Krizalys\Onedrive\Client(array('client_id' => ONEDRIVE_CLIENT_ID, 'state' => $_SESSION['onedrive.client.state'])); // Obtain the token using the code received by the OneDrive API $onedrive->obtainAccessToken(ONEDRIVE_CLIENT_SECRET, $_GET['code']); // Persist the OneDrive client' state for next API requests $_SESSION['onedrive.client.state'] = $onedrive->getState(); if (!is_null($onedrive->getAccessToken())) { $_SESSION['onedriveToken'] = $onedrive->getAccessToken(); //echo $_SESSION['onedriveToken']; } header("Location: http://localhost/gtc/index.php"); //die(); ?>
<?php require_once __DIR__ . '/../onedrive-config.php'; require_once __DIR__ . '/../vendor/autoload.php'; session_start(); if (!array_key_exists('onedrive.client.state', $_SESSION)) { throw new Exception('onedrive.client.state undefined in session'); } $onedrive = new \Krizalys\Onedrive\Client(array('state' => $_SESSION['onedrive.client.state'])); $recentDocs = $onedrive->fetchRecentDocs(); ?> <!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> <p>The <code>Client::fetchRecentDocuments</code> method returned:</p> <pre><?php print_r($recentDocs); ?> </pre> <p><a href=app.php>Back to the examples</a></p> </div> </body>
<?php require_once __DIR__ . '/../onedrive-config.php'; require_once __DIR__ . '/../vendor/autoload.php'; session_start(); if (!array_key_exists('onedrive.client.state', $_SESSION)) { throw new Exception('onedrive.client.state undefined in session'); } $onedrive = new \Krizalys\Onedrive\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); ?> <!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> <h1>Deleting a OneDrive object</h1> <p class=bg-success>The object <em><?php echo htmlspecialchars($id); ?> </em> has been deleted from your OneDrive account using the <code>Client::deleteObject</code> method.</p>
<?php require_once __DIR__ . '/../onedrive-config.php'; require_once __DIR__ . '/../vendor/autoload.php'; session_start(); if (!array_key_exists('onedrive.client.state', $_SESSION)) { throw new Exception('onedrive.client.state undefined in session'); } $onedrive = new \Krizalys\Onedrive\Client(array('state' => $_SESSION['onedrive.client.state'])); $docs = $onedrive->fetchDocs(); ?> <!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> <p>The <code>Client::fetchDocs</code> method returned:</p> <pre><?php print_r($docs); ?> </pre> <p><a href=app.php>Back to the examples</a></p> </div> </body>
<?php require_once __DIR__ . '/../onedrive-config.php'; require_once __DIR__ . '/../vendor/autoload.php'; session_start(); if (!array_key_exists('onedrive.client.state', $_SESSION)) { throw new Exception('onedrive.client.state undefined in session'); } $onedrive = new \Krizalys\Onedrive\Client(array('state' => $_SESSION['onedrive.client.state'])); $quota = $onedrive->fetchQuota(); ?> <!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> <p>The <code>Client::fetchQuota</code> method returned:</p> <pre><?php print_r($quota); ?> </pre> <p><a href=app.php>Back to the examples</a></p> </div> </body>
<?php require_once __DIR__ . '/../onedrive-config.php'; require_once __DIR__ . '/../vendor/autoload.php'; session_start(); if (!array_key_exists('id', $_GET)) { throw new Exception('id undefined in $_GET'); } if (!array_key_exists('onedrive.client.state', $_SESSION)) { throw new Exception('onedrive.client.state undefined in session'); } $onedrive = new \Krizalys\Onedrive\Client(array('state' => $_SESSION['onedrive.client.state'])); $id = $_GET['id']; $file = $onedrive->fetchObject($id); ?> <!DOCTYPE html> <html lang=en dir=ltr> <head> <meta charset=utf-8> <title>Fetching a OneDrive file – 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 a OneDrive file</h1> <p>The <code>Client::fetchObject</code> method returned the file <em><?php echo htmlspecialchars($id); ?> </em>.</p>
<?php require_once __DIR__ . '/../onedrive-config.php'; require_once __DIR__ . '/../vendor/autoload.php'; session_start(); if (!array_key_exists('onedrive.client.state', $_SESSION)) { throw new Exception('onedrive.client.state undefined in session'); } $onedrive = new \Krizalys\Onedrive\Client(array('state' => $_SESSION['onedrive.client.state'])); $id = empty($_GET['id']) ? null : $_GET['id']; $folder = $onedrive->fetchObject($id); $objects = $folder->fetchObjects(); ?> <!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> <h1>Fetching a OneDrive folder</h1> <p>The <code>Client::fetchObject</code> method returned the folder <em><?php echo htmlspecialchars($id); ?> </em> from your OneDrive account.</p> <h2>Properties</h2> <pre><?php
<?php require_once __DIR__ . '/../onedrive-config.php'; require_once __DIR__ . '/../vendor/autoload.php'; session_start(); if (!array_key_exists('onedrive.client.state', $_SESSION)) { throw new Exception('onedrive.client.state undefined in session'); } $onedrive = new \Krizalys\Onedrive\Client(array('state' => $_SESSION['onedrive.client.state'])); $pics = $onedrive->fetchPics(); ?> <!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> <p>The <code>Client::fetchPics</code> method returned:</p> <pre><?php print_r($pics); ?> </pre> <p><a href=app.php>Back to the examples</a></p> </div> </body>
<?php require_once __DIR__ . '/../onedrive-config.php'; require_once __DIR__ . '/../vendor/autoload.php'; session_start(); if (!array_key_exists('onedrive.client.state', $_SESSION)) { throw new Exception('onedrive.client.state undefined in session'); } $onedrive = new \Krizalys\Onedrive\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); ?> <!DOCTYPE html> <html lang=en dir=ltr> <head> <meta charset=utf-8> <title>Updating 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>