Warning: chmod(): Operation not permitted in /var/www/hopeinstoughton_www/wp-content/plugins/simple-universal-google-analytics/main.php on line 8 [0] in function chmod in /var/www/hopeinstoughton_www/wp-content/plugins/simple-universal-google-analytics/main.php on line 8 [1] in function include_once in /var/www/hopeinstoughton_www/wp-settings.php on line 560 [2] in function require_once in /var/www/hopeinstoughton_www/wp-config.php on line 85 [3] in function require_once in /var/www/hopeinstoughton_www/wp-load.php on line 50 [4] in function require_once in /var/www/hopeinstoughton_www/wp-blog-header.php on line 13 [5] in function require in /var/www/hopeinstoughton_www/index.php on line 17
| Server IP : 94.177.8.99 / Your IP : 216.73.217.165 Web Server : Apache/2.4.58 (Ubuntu) System : Linux aries 6.8.0-134-generic #134-Ubuntu SMP PREEMPT_DYNAMIC Fri Jun 26 18:43:11 UTC 2026 x86_64 User : www-data ( 33) PHP Version : 8.1.34 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /var/www/hopeinstoughton_vote/modules/googleVideo/ |
Upload File : |
<?php
namespace modules\googleVideo;
use \Google\Client;
use \Google\Service\Drive;
// class_alias(FileList::class, 'Google_Service_Drive_FileList');
require_once HOME . '/vendor/autoload.php';
class main extends \moduleMain {
use \modules\output\traits {
\modules\output\traits::__construct as __ConstructOutput;
}
use \modules\input\traits {
\modules\input\traits::__construct as __ConstructInput;
}
public function __construct() {
parent::__construct(__DIR__);
$this->__ConstructOutput();
$this->__ConstructInput();
}
public function Activate() {
}
protected function getGoogleClient() {
$scope[] = 'https://www.googleapis.com/auth/gmail.send';
$client = new \Google\Client();
$client->setAuthConfig(HOME . '/storage/' . $this->settings['keyfile']);
$client->useApplicationDefaultCredentials();
$client->addScope(Drive::DRIVE);
$client->setApplicationName('drivestuff'); // change app name whenever scope permissions change for Domain-wide Delegation
// $address = mailparse_rfc822_parse_addresses($this->settings['useraccount']);
// $myaddress = strtolower($address[0]['address']);
// $client->setSubject($myaddress);
return $client;
}
final function test() {
$client = $this->getGoogleClient();
$service = new Drive($client);
$file_id = $name = $mime = NULL;
$size = 0;
try{
$optParams = array(
'corpora' => 'drive',
'pageSize' => 10,
'driveId' => '0AAquU7LujXYfUk9PVA', // this is from the URL of sharedDrive homeFolder
'fields' => 'files(id,name,size)',
'q' => "name = '0b440025.mp4'",
'orderBy' => 'name',
'supportsAllDrives' => True,
'includeItemsFromAllDrives' => True,
);
$results = $service->files->listFiles($optParams);
$files = $results->getFiles();
if (!empty($files)) {
$file_id = $files[0]->id;
$size = intval($files[0]->size);
$name = $files[0]->getName();
}
}
catch(\Exception $e) {
header('Content-type: text/plain');
// TODO(developer) - handle error appropriately
echo 'Message: ' .$e->getMessage();
}
if ($file_id) {
header('Content-type: text/plain');
$param = [
'alt' => 'media', // file contents
'headers' => [
'Range' => '0=1024000',
],
];
// $response = $service->files->get($file_id, $param );
// $content = $response->getBody()->getContents();
$content = '';
echo "$file_id, $name, $mine, $size\n" . strlen($content);
//var_dump($response);
exit;
} else {
header('Content-type: text/plain');
die("Not found.");
}
}
}
/*
$response = $service->files->get($file_id, [ 'supportsAllDrives' => TRUE ]); // metadata
$url = $response->getWebContentLink(); // only for binary content - not video
$downloadURL = $item->getDownloadUrl();
$key = file_get_contents("WHERE YOUR GOOGLE KEY FILE IS.p12");
if (!$key)
return null;
$email = "WHAT IS THE EMAIL PROVIDED BY GOOGLE";
$cred = new Google_Auth_AssertionCredentials($email, array(Google_Service_Drive::DRIVE), $key);
$this->client->setAssertionCredentials($cred);
$cred->sub = $email;
$request = new Google_Http_Request($downloadURL, 'GET', null, null);
$httpRequest = $this->client->getAuth()->authenticatedRequest($request);
if ($httpRequest->getResponseHttpCode() == 200) {
*/