Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Tenzing
/
pdf-customizer
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
9d6ab613
authored
2016-07-19 16:16:26 -0400
by
Jeff Balicki
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
save pdf to google
1 parent
3176882e
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
359 additions
and
10 deletions
app/Http/Controllers/ApiController.php
app/Http/Controllers/AuthenticateController.php
app/Http/Controllers/GoogledriveuploadpdfController.php
app/Http/routes.php
composer.json
composer.lock
app/Http/Controllers/ApiController.php
View file @
9d6ab61
...
...
@@ -141,7 +141,8 @@ class ApiController extends Controller
$pdf
=
$pdf
->
pdf
(
$pdfId
);
$response
=
$pdfId
;
$statusCode
=
200
;
$UploaqdPdf
=
new
GoogledriveuploadpdfController
();
$UploaqdPdf
=
$UploaqdPdf
->
google_drive_upload
(
$folder
,
'new_'
.
$fileClean
);
return
Response
::
json
(
$response
,
$statusCode
);
...
...
app/Http/Controllers/AuthenticateController.php
View file @
9d6ab61
<?php
namespace
App\Http\Controllers
;
use
JWTAuth
;
use
Tymon\JWTAuth\Exceptions\JWTException
;
//
use Tymon\JWTAuth\Exceptions\JWTException;
use
Illuminate\Http\Request
;
use
App\User
;
...
...
app/Http/Controllers/GoogledriveuploadpdfController.php
0 → 100755
View file @
9d6ab61
<?php
namespace
App\Http\Controllers
;
use
Illuminate\Http\Request
;
use
App\Http\Requests
;
use
App\Http\Controllers
;
use
App\pdfModel
;
use
URL
;
use
Storage
;
use
Response
;
use
File
;
Use
PDF
;
use
Illuminate\Support\Facades\Input
;
use
Intervention\Image\Facades\Image
;
use
Illuminate\Support\Facades\Facade
;
use
League\Flysystem\Filesystem
;
use
Curl\Curl
;
use
Google_Client
;
use
Google_Service_Drive
;
use
Imagick
;
class
GoogledriveuploadpdfController
extends
Controller
{
public
function
google_drive_upload
(
$folder
,
$filename
)
{
$pdffile
=
new
FileEntryController
();
$pdfFile
=
$pdffile
->
getPDF
(
$folder
,
$filename
);
$client
=
new
\Google_Client
();
$client
->
setScopes
(
array
(
'https://www.googleapis.com/auth/drive.file'
));
$client
->
setClientId
(
'2147483647'
);
$client
->
setClientSecret
(
'qmUMAi09SU4wU4R3uOkvsiwK'
);
$client
->
setRedirectUri
(
'http://pdf-customizer.synapsus.co/auth/google/callback'
);
$dr_service
=
new
\Google_Service_Drive
(
$client
);
$file
=
new
\Google_Service_Drive_DriveFile
();
$mimetype
=
'application/pdf'
;
$uploadType
=
'media'
;
$filetitle
=
$filename
;
//$filedescription = 'Taskew ' . $model['discussion_title'];
$datetime
=
date
(
'd-m-y-h:s'
);
$file
->
setTitle
(
$datetime
.
$filetitle
);
//$file->setDescription($filedescription);
$file
->
setMimeType
(
$mimetype
);
$data
=
$pdfFile
;
$createdFile
=
$dr_service
->
files
->
insert
(
$file
,
array
(
'data'
=>
$data
,
'mimeType'
=>
$mimetype
,
//text/plain',
'uploadType'
=>
$uploadType
));
}
public
function
handleProviderCallback
()
{
return
Redirect
::
to
(
'home'
);
}
}
\ No newline at end of file
app/Http/routes.php
View file @
9d6ab61
...
...
@@ -51,3 +51,6 @@ Route::get('fileentry/getPDF/{folder}/{filename}', 'FileEntryController@getPDF'
Route
::
post
(
'fileentry/add'
,[
'as'
=>
'addentry'
,
'uses'
=>
'FileEntryController@add'
]);
Route
::
get
(
'api/googlePdfUpload/{folder}/{filename}'
,
'GoogledriveuploadpdfController@google_drive_upload'
);
Route
::
get
(
'auth/google/callback'
,
'GoogledriveuploadpdfController@handleGoogleCallback'
);
\ No newline at end of file
...
...
composer.json
View file @
9d6ab61
...
...
@@ -12,10 +12,11 @@
"barryvdh/laravel-snappy"
:
"^0.3.0"
,
"vsmoraes/laravel-pdf"
:
"^1.0"
,
"php-curl-class/php-curl-class"
:
"^4.11"
,
"ext-PDO"
:
"^7.0"
,
"ext-pdo_pgsql"
:
"^7.0"
,
"slim/pdo"
:
"^1.9"
,
"doctrine/dbal"
:
"^2.5"
"doctrine/dbal"
:
"^2.5"
,
"tymon/jwt-auth"
:
"^0.5.9"
,
"google/apiclient"
:
"1.1.1"
},
...
...
composer.lock
View file @
9d6ab61
...
...
@@ -4,8 +4,8 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"This file is @generated automatically"
],
"hash": "
bd5acf06527a71243b4914e1b34144ac
",
"content-hash": "
e5b082b079774eaef01edacb786fcf23
",
"hash": "
987cf4cbb0eb835825ebafb157a36f30
",
"content-hash": "
7a41d7f13395ea0a3d0ae6e2c9c2d8f7
",
"packages": [
{
"name": "barryvdh/laravel-snappy",
...
...
@@ -657,6 +657,48 @@
"time": "2015-12-07 04:07:13"
},
{
"name": "google/apiclient",
"version": "1.1.1",
"source": {
"type": "git",
"url": "https://github.com/google/google-api-php-client.git",
"reference": "f985b38158efe4c55c90b90443311f792c919a59"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/google/google-api-php-client/zipball/f985b38158efe4c55c90b90443311f792c919a59",
"reference": "f985b38158efe4c55c90b90443311f792c919a59",
"shasum": ""
},
"require": {
"php": ">=5.2.1"
},
"require-dev": {
"phpunit/phpunit": "3.7.*"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.1.x-dev"
}
},
"autoload": {
"classmap": [
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"Apache-2.0"
],
"description": "Client library for Google APIs",
"homepage": "http://developers.google.com/api-client-library/php",
"keywords": [
"google"
],
"time": "2014-11-20 10:13:43"
},
{
"name": "itbz/fpdf",
"version": "1.7.2",
"source": {
...
...
@@ -1231,6 +1273,56 @@
"time": "2016-01-26 21:23:30"
},
{
"name": "namshi/jose",
"version": "5.0.2",
"source": {
"type": "git",
"url": "https://github.com/namshi/jose.git",
"reference": "8c7eba486f74c014ea1d8faedafe5109a31ea95b"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/namshi/jose/zipball/8c7eba486f74c014ea1d8faedafe5109a31ea95b",
"reference": "8c7eba486f74c014ea1d8faedafe5109a31ea95b",
"shasum": ""
},
"require": {
"lib-openssl": "*",
"php": ">=5.3.3",
"phpseclib/phpseclib": "~0.3"
},
"require-dev": {
"phpunit/phpunit": "~4.5",
"satooshi/php-coveralls": "dev-master"
},
"type": "library",
"autoload": {
"psr-0": {
"Namshi\\JOSE": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Alessandro Nadalin",
"email": "alessandro.nadalin@gmail.com"
}
],
"description": "JSON Object Signing and Encryption library for PHP.",
"keywords": [
"JSON Web Signature",
"JSON Web Token",
"JWS",
"json",
"jwt",
"token"
],
"time": "2015-06-29 05:41:44"
},
{
"name": "nesbot/carbon",
"version": "1.21.0",
"source": {
...
...
@@ -1467,6 +1559,104 @@
"time": "2016-03-09 00:50:07"
},
{
"name": "phpseclib/phpseclib",
"version": "0.3.10",
"source": {
"type": "git",
"url": "https://github.com/phpseclib/phpseclib.git",
"reference": "d15bba1edcc7c89e09cc74c5d961317a8b947bf4"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/phpseclib/phpseclib/zipball/d15bba1edcc7c89e09cc74c5d961317a8b947bf4",
"reference": "d15bba1edcc7c89e09cc74c5d961317a8b947bf4",
"shasum": ""
},
"require": {
"php": ">=5.0.0"
},
"require-dev": {
"phing/phing": "~2.7",
"phpunit/phpunit": "~4.0",
"sami/sami": "~2.0",
"squizlabs/php_codesniffer": "~1.5"
},
"suggest": {
"ext-gmp": "Install the GMP (GNU Multiple Precision) extension in order to speed up arbitrary precision integer arithmetic operations.",
"ext-mcrypt": "Install the Mcrypt extension in order to speed up a wide variety of cryptographic operations.",
"pear-pear/PHP_Compat": "Install PHP_Compat to get phpseclib working on PHP < 4.3.3."
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "0.3-dev"
}
},
"autoload": {
"psr-0": {
"Crypt": "phpseclib/",
"File": "phpseclib/",
"Math": "phpseclib/",
"Net": "phpseclib/",
"System": "phpseclib/"
},
"files": [
"phpseclib/Crypt/Random.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"include-path": [
"phpseclib/"
],
"license": [
"MIT"
],
"authors": [
{
"name": "Jim Wigginton",
"email": "terrafrost@php.net",
"role": "Lead Developer"
},
{
"name": "Patrick Monnerat",
"email": "pm@datasphere.ch",
"role": "Developer"
},
{
"name": "Andreas Fischer",
"email": "bantu@phpbb.com",
"role": "Developer"
},
{
"name": "Hans-Jürgen Petrich",
"email": "petrich@tronic-media.com",
"role": "Developer"
}
],
"description": "PHP Secure Communications Library - Pure-PHP implementations of RSA, AES, SSH2, SFTP, X.509 etc.",
"homepage": "http://phpseclib.sourceforge.net",
"keywords": [
"BigInteger",
"aes",
"asn.1",
"asn1",
"blowfish",
"crypto",
"cryptography",
"encryption",
"rsa",
"security",
"sftp",
"signature",
"signing",
"ssh",
"twofish",
"x.509",
"x509"
],
"time": "2015-01-28 21:50:33"
},
{
"name": "psr/log",
"version": "1.0.0",
"source": {
...
...
@@ -2455,6 +2645,69 @@
"time": "2016-03-10 10:34:12"
},
{
"name": "tymon/jwt-auth",
"version": "0.5.9",
"source": {
"type": "git",
"url": "https://github.com/tymondesigns/jwt-auth.git",
"reference": "18b2add90de2315d549664b4d4a062db07e8b080"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/tymondesigns/jwt-auth/zipball/18b2add90de2315d549664b4d4a062db07e8b080",
"reference": "18b2add90de2315d549664b4d4a062db07e8b080",
"shasum": ""
},
"require": {
"illuminate/http": "~5.0",
"illuminate/support": "~5.0",
"namshi/jose": "5.0.*",
"nesbot/carbon": "~1.0",
"php": ">=5.4.0"
},
"require-dev": {
"illuminate/auth": "~5.0",
"illuminate/console": "~5.0",
"illuminate/database": "~5.0",
"mockery/mockery": "0.9.*",
"phpunit/phpunit": "4.*"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-develop": "0.5-dev"
}
},
"autoload": {
"psr-4": {
"Tymon\\JWTAuth\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Sean Tymon",
"email": "tymon148@gmail.com",
"homepage": "http://tymondesigns.com",
"role": "Developer"
}
],
"description": "JSON Web Token Authentication for Laravel 4 and 5",
"homepage": "https://github.com/tymondesigns/jwt-auth",
"keywords": [
"Authentication",
"JSON Web Token",
"auth",
"jwt",
"laravel",
"tymon"
],
"time": "2016-02-18 09:22:36"
},
{
"name": "vlucas/phpdotenv",
"version": "v2.2.0",
"source": {
...
...
@@ -3871,9 +4124,7 @@
"prefer-stable": false,
"prefer-lowest": false,
"platform": {
"php": ">=5.5.9",
"ext-pdo": "^7.0",
"ext-pdo_pgsql": "^7.0"
"php": ">=5.5.9"
},
"platform-dev": []
}
...
...
Please
register
or
sign in
to post a comment