1 | <?php |
||
2 | |||
3 | session_start(); |
||
4 | |||
5 | //============ Google Move Code ======================// |
||
6 | |||
7 | if ( isset( $_GET['album_download_directory'] ) ) { |
||
8 | $album_download_directory = $_GET['album_download_directory']; |
||
9 | $album_download_directory = '../'.$album_download_directory; |
||
10 | } else { |
||
11 | header('location:../index.php'); |
||
12 | } |
||
13 | |||
14 | require_once 'Zend/autooad.php'; |
||
15 | Zend_Loader::loadClass('Zend_Gdata_Photos'); |
||
0 ignored issues
–
show
|
|||
16 | //Zend_Loader::loadClass('Zend_Gdata_ClientLogin'); |
||
17 | Zend_Loader::loadClass('Zend_Gdata_AuthSub'); |
||
18 | |||
19 | |||
20 | function getAuthSubHttpClient() { |
||
21 | if ( isset( $_SESSION['google_session_token'] ) ) { |
||
22 | $client = Zend_Gdata_AuthSub::getHttpClient( $_SESSION['google_session_token'] ); |
||
0 ignored issues
–
show
The type
Zend_Gdata_AuthSub was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths ![]() |
|||
23 | return $client; |
||
24 | } |
||
25 | } |
||
26 | |||
27 | $gp = new Zend_Gdata_Photos(getAuthSubHttpClient(), "Google-DevelopersGuide-1.0"); |
||
0 ignored issues
–
show
The type
Zend_Gdata_Photos was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths ![]() |
|||
28 | $entry = new Zend_Gdata_Photos_AlbumEntry(); |
||
0 ignored issues
–
show
The type
Zend_Gdata_Photos_AlbumEntry was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths ![]() |
|||
29 | |||
30 | |||
31 | function add_new_album( $entry, $gp, $album_download_directory, $album_name ) { |
||
32 | $new_album_name = str_replace( " ", "_", $album_name ); |
||
33 | $new_album_name = $new_album_name.'_'.uniqid(); |
||
34 | |||
35 | $entry->setTitle( $gp->newTitle( $new_album_name ) ); |
||
36 | $entry->setSummary( $gp->newSummary("Album added by Facebook Album Challenge") ); |
||
37 | $gp->insertAlbumEntry( $entry ); |
||
38 | |||
39 | $path = $album_download_directory.$album_name; |
||
40 | if ( file_exists( $path ) ) { |
||
41 | $photos = scandir( $path ); |
||
42 | |||
43 | foreach ( $photos as $photo ) { |
||
44 | if ( $photo != "." && $photo != ".." ) { |
||
45 | $photo_path = $path.'/'.$photo; |
||
46 | add_new_photo_to_album( $gp, $photo_path, $new_album_name ); |
||
47 | } |
||
48 | } |
||
49 | } |
||
50 | } |
||
51 | |||
52 | function add_new_photo_to_album( $gp, $path, $new_album_name ) { |
||
53 | $user_name = "default"; |
||
54 | $file_name = $path; |
||
55 | $photo_name = "Photo added by Facebook Album Challenge"; |
||
56 | $photo_caption = "Photo added by Facebook Album Challenge"; |
||
57 | $photo_tags = "Photo, Facebook-Album-Challenge"; |
||
58 | |||
59 | $fd = $gp->newMediaFileSource( $file_name ); |
||
60 | $fd->setContentType("image/jpeg"); |
||
61 | |||
62 | // Create a PhotoEntry |
||
63 | $photo_entry = $gp->newPhotoEntry(); |
||
64 | |||
65 | $photo_entry->setMediaSource( $fd ); |
||
66 | $photo_entry->setTitle( $gp->newTitle( $photo_name ) ); |
||
67 | $photo_entry->setSummary( $gp->newSummary( $photo_caption ) ); |
||
68 | |||
69 | // add some tags |
||
70 | $photo_media = new Zend_Gdata_Media_Extension_MediaKeywords(); |
||
0 ignored issues
–
show
The type
Zend_Gdata_Media_Extension_MediaKeywords was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths ![]() |
|||
71 | $photo_media->setText( $photo_tags ); |
||
72 | $photo_entry->mediaGroup = new Zend_Gdata_Media_Extension_MediaGroup(); |
||
0 ignored issues
–
show
The type
Zend_Gdata_Media_Extension_MediaGroup was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths ![]() |
|||
73 | $photo_entry->mediaGroup->keywords = $photo_media; |
||
74 | |||
75 | // We use the AlbumQuery class to generate the URL for the album |
||
76 | $album_query = $gp->newAlbumQuery(); |
||
77 | |||
78 | $album_query->setUser( $user_name ); |
||
79 | //$albumQuery->setAlbumId($albumId); |
||
80 | $album_query->setAlbumName( $new_album_name ); |
||
81 | |||
82 | // We insert the photo, and the server returns the entry representing |
||
83 | // that photo after it is uploaded |
||
84 | //$insertedEntry = $gp->insertPhotoEntry( $photoEntry, $albumQuery->getQueryUrl() ); |
||
85 | $gp->insertPhotoEntry( $photo_entry, $album_query->getQueryUrl() ); |
||
86 | } |
||
87 | |||
88 | if ( isset( $album_download_directory ) ) { |
||
89 | if ( file_exists( $album_download_directory ) ) { |
||
90 | $album_names = scandir( $album_download_directory ); |
||
91 | |||
92 | foreach ( $album_names as $album_name ) { |
||
93 | if ( $album_name != "." && $album_name != "..") { |
||
94 | add_new_album( $entry, $gp, $album_download_directory, $album_name ); |
||
95 | } |
||
96 | } |
||
97 | |||
98 | $unlink_folder = rtrim( $album_download_directory, "/" ); |
||
99 | require_once('../unlink_directory.php'); |
||
100 | $unlink_directory = new unlink_directory(); |
||
101 | $unlink_directory->remove_directory( $unlink_folder ); |
||
102 | } |
||
103 | $response = 1; |
||
104 | } else { |
||
105 | $response = 0; |
||
106 | } |
||
107 | |||
108 | |||
109 | if ( isset( $_GET['ajax'] ) ) |
||
110 | echo $response; |
||
111 | else |
||
112 | header('location:../index.php?response='.$response); |
||
113 | |||
114 | |||
115 | ?> |
||
0 ignored issues
–
show
It is not recommended to use PHP's closing tag
?> in files other than templates.
Using a closing tag in PHP files that only contain PHP code is not recommended as you might accidentally add whitespace after the closing tag which would then be output by PHP. This can cause severe problems, for example headers cannot be sent anymore. A simple precaution is to leave off the closing tag as it is not required, and it also has no negative effects whatsoever. ![]() |
|||
116 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths