@@ -125,28 +125,28 @@ discard block |
||
125 | 125 | } |
126 | 126 | |
127 | 127 | /** |
128 | - * Retrieve the array of all configuration options |
|
129 | - * |
|
130 | - * @return array |
|
131 | - */ |
|
132 | - public function getConfig() |
|
133 | - { |
|
134 | - return $this->config; |
|
135 | - } |
|
136 | - |
|
137 | - /** |
|
138 | - * Set the stream context for the TCP connection to the server |
|
128 | + * Retrieve the array of all configuration options |
|
139 | 129 | * |
140 | - * Can accept either a pre-existing stream context resource, or an array |
|
141 | - * of stream options, similar to the options array passed to the |
|
142 | - * stream_context_create() PHP function. In such case a new stream context |
|
143 | - * will be created using the passed options. |
|
144 | - * |
|
145 | - * @since Zend Framework 1.9 |
|
146 | - * |
|
147 | - * @param mixed $context Stream context or array of context options |
|
148 | - * @return Zend_Http_Client_Adapter_Socket |
|
130 | + * @return array |
|
149 | 131 | */ |
132 | + public function getConfig() |
|
133 | + { |
|
134 | + return $this->config; |
|
135 | + } |
|
136 | + |
|
137 | + /** |
|
138 | + * Set the stream context for the TCP connection to the server |
|
139 | + * |
|
140 | + * Can accept either a pre-existing stream context resource, or an array |
|
141 | + * of stream options, similar to the options array passed to the |
|
142 | + * stream_context_create() PHP function. In such case a new stream context |
|
143 | + * will be created using the passed options. |
|
144 | + * |
|
145 | + * @since Zend Framework 1.9 |
|
146 | + * |
|
147 | + * @param mixed $context Stream context or array of context options |
|
148 | + * @return Zend_Http_Client_Adapter_Socket |
|
149 | + */ |
|
150 | 150 | public function setStreamContext($context) |
151 | 151 | { |
152 | 152 | if (is_resource($context) && get_resource_type($context) == 'stream-context') { |
@@ -223,11 +223,11 @@ discard block |
||
223 | 223 | if ($this->config['persistent']) $flags |= STREAM_CLIENT_PERSISTENT; |
224 | 224 | |
225 | 225 | $this->socket = @stream_socket_client($host . ':' . $port, |
226 | - $errno, |
|
227 | - $errstr, |
|
228 | - (int) $this->config['timeout'], |
|
229 | - $flags, |
|
230 | - $context); |
|
226 | + $errno, |
|
227 | + $errstr, |
|
228 | + (int) $this->config['timeout'], |
|
229 | + $flags, |
|
230 | + $context); |
|
231 | 231 | |
232 | 232 | if (! $this->socket) { |
233 | 233 | $this->close(); |
@@ -382,9 +382,9 @@ discard block |
||
382 | 382 | |
383 | 383 | if($this->out_stream) { |
384 | 384 | if(stream_copy_to_stream($this->socket, $this->out_stream, $read_to - $current_pos) == 0) { |
385 | - $this->_checkSocketReadTimeout(); |
|
386 | - break; |
|
387 | - } |
|
385 | + $this->_checkSocketReadTimeout(); |
|
386 | + break; |
|
387 | + } |
|
388 | 388 | } else { |
389 | 389 | $line = @fread($this->socket, $read_to - $current_pos); |
390 | 390 | if ($line === false || strlen($line) === 0) { |
@@ -429,15 +429,15 @@ discard block |
||
429 | 429 | $chunk = ''; |
430 | 430 | |
431 | 431 | for ($read_to = $current_pos + $contentLength; |
432 | - $read_to > $current_pos; |
|
433 | - $current_pos = ftell($this->socket)) { |
|
434 | - |
|
435 | - if($this->out_stream) { |
|
436 | - if(@stream_copy_to_stream($this->socket, $this->out_stream, $read_to - $current_pos) == 0) { |
|
437 | - $this->_checkSocketReadTimeout(); |
|
438 | - break; |
|
439 | - } |
|
440 | - } else { |
|
432 | + $read_to > $current_pos; |
|
433 | + $current_pos = ftell($this->socket)) { |
|
434 | + |
|
435 | + if($this->out_stream) { |
|
436 | + if(@stream_copy_to_stream($this->socket, $this->out_stream, $read_to - $current_pos) == 0) { |
|
437 | + $this->_checkSocketReadTimeout(); |
|
438 | + break; |
|
439 | + } |
|
440 | + } else { |
|
441 | 441 | $chunk = @fread($this->socket, $read_to - $current_pos); |
442 | 442 | if ($chunk === false || strlen($chunk) === 0) { |
443 | 443 | $this->_checkSocketReadTimeout(); |
@@ -457,9 +457,9 @@ discard block |
||
457 | 457 | do { |
458 | 458 | if($this->out_stream) { |
459 | 459 | if(@stream_copy_to_stream($this->socket, $this->out_stream) == 0) { |
460 | - $this->_checkSocketReadTimeout(); |
|
461 | - break; |
|
462 | - } |
|
460 | + $this->_checkSocketReadTimeout(); |
|
461 | + break; |
|
462 | + } |
|
463 | 463 | } else { |
464 | 464 | $buff = @fread($this->socket, 8192); |
465 | 465 | if ($buff === false || strlen($buff) === 0) { |
@@ -165,14 +165,14 @@ |
||
165 | 165 | } |
166 | 166 | |
167 | 167 | /** |
168 | - * Retrieve the array of all configuration options |
|
169 | - * |
|
170 | - * @return array |
|
171 | - */ |
|
172 | - public function getConfig() |
|
173 | - { |
|
174 | - return $this->_config; |
|
175 | - } |
|
168 | + * Retrieve the array of all configuration options |
|
169 | + * |
|
170 | + * @return array |
|
171 | + */ |
|
172 | + public function getConfig() |
|
173 | + { |
|
174 | + return $this->_config; |
|
175 | + } |
|
176 | 176 | |
177 | 177 | /** |
178 | 178 | * Direct setter for cURL adapter related options. |
@@ -244,7 +244,7 @@ |
||
244 | 244 | ) |
245 | 245 | { |
246 | 246 | $request = "CONNECT $host:$port HTTP/$http_ver\r\n" . |
247 | - "Host: " . $this->config['proxy_host'] . "\r\n"; |
|
247 | + "Host: " . $this->config['proxy_host'] . "\r\n"; |
|
248 | 248 | |
249 | 249 | // Process provided headers, including important ones to CONNECT request |
250 | 250 | foreach ($headers as $k => $v) { |
@@ -213,7 +213,7 @@ |
||
213 | 213 | */ |
214 | 214 | public function addResponse($response) |
215 | 215 | { |
216 | - if ($response instanceof Zend_Http_Response) { |
|
216 | + if ($response instanceof Zend_Http_Response) { |
|
217 | 217 | $response = $response->asString("\r\n"); |
218 | 218 | } |
219 | 219 |
@@ -694,8 +694,8 @@ discard block |
||
694 | 694 | $this->cookiejar->addCookie($cookie); |
695 | 695 | } elseif (is_string($cookie) && $value !== null) { |
696 | 696 | $cookie = Zend_Http_Cookie::fromString("{$cookie}={$value}", |
697 | - $this->uri, |
|
698 | - $this->config['encodecookies']); |
|
697 | + $this->uri, |
|
698 | + $this->config['encodecookies']); |
|
699 | 699 | $this->cookiejar->addCookie($cookie); |
700 | 700 | } |
701 | 701 | } else { |
@@ -984,7 +984,7 @@ discard block |
||
984 | 984 | if(!is_string($this->_stream_name)) { |
985 | 985 | // If name is not given, create temp name |
986 | 986 | $this->_stream_name = tempnam(isset($this->config['stream_tmp_dir'])?$this->config['stream_tmp_dir']:sys_get_temp_dir(), |
987 | - 'Zend_Http_Client'); |
|
987 | + 'Zend_Http_Client'); |
|
988 | 988 | } |
989 | 989 | |
990 | 990 | if (false === ($fp = @fopen($this->_stream_name, "w+b"))) { |
@@ -1030,9 +1030,9 @@ discard block |
||
1030 | 1030 | $uri = clone $this->uri; |
1031 | 1031 | if (! empty($this->paramsGet)) { |
1032 | 1032 | $query = $uri->getQuery(); |
1033 | - if (! empty($query)) { |
|
1034 | - $query .= '&'; |
|
1035 | - } |
|
1033 | + if (! empty($query)) { |
|
1034 | + $query .= '&'; |
|
1035 | + } |
|
1036 | 1036 | $query .= http_build_query($this->paramsGet, null, '&'); |
1037 | 1037 | if ($this->config['rfc3986_strict']) { |
1038 | 1038 | $query = str_replace('+', '%20', $query); |
@@ -966,7 +966,7 @@ |
||
966 | 966 | if ($options instanceof Zend_Config) { |
967 | 967 | $options = $options->toArray(); |
968 | 968 | } else if (!is_array($options)) { |
969 | - $temp = array(); |
|
969 | + $temp = array(); |
|
970 | 970 | |
971 | 971 | $options = func_get_args(); |
972 | 972 | $temp['allow'] = array_shift($options); |
@@ -64,7 +64,7 @@ |
||
64 | 64 | if ($options instanceof Zend_Config) { |
65 | 65 | $options = $options->toArray(); |
66 | 66 | } else if (!is_array($options)) { |
67 | - $temp = array(); |
|
67 | + $temp = array(); |
|
68 | 68 | $options = func_get_args(); |
69 | 69 | $temp['allowipv6'] = array_shift($options); |
70 | 70 | if (!empty($options)) { |
@@ -5,10 +5,10 @@ discard block |
||
5 | 5 | //============ Google Move Code ======================// |
6 | 6 | |
7 | 7 | if ( isset( $_GET['album_download_directory'] ) ) { |
8 | - $album_download_directory = $_GET['album_download_directory']; |
|
9 | - $album_download_directory = '../'.$album_download_directory; |
|
8 | + $album_download_directory = $_GET['album_download_directory']; |
|
9 | + $album_download_directory = '../'.$album_download_directory; |
|
10 | 10 | } else { |
11 | - header('location:../index.php'); |
|
11 | + header('location:../index.php'); |
|
12 | 12 | } |
13 | 13 | |
14 | 14 | require_once 'Zend/Loader.php'; |
@@ -18,10 +18,10 @@ discard block |
||
18 | 18 | |
19 | 19 | |
20 | 20 | function getAuthSubHttpClient() { |
21 | - if ( isset( $_SESSION['google_session_token'] ) ) { |
|
22 | - $client = Zend_Gdata_AuthSub::getHttpClient( $_SESSION['google_session_token'] ); |
|
23 | - return $client; |
|
24 | - } |
|
21 | + if ( isset( $_SESSION['google_session_token'] ) ) { |
|
22 | + $client = Zend_Gdata_AuthSub::getHttpClient( $_SESSION['google_session_token'] ); |
|
23 | + return $client; |
|
24 | + } |
|
25 | 25 | } |
26 | 26 | |
27 | 27 | $gp = new Zend_Gdata_Photos(getAuthSubHttpClient(), "Google-DevelopersGuide-1.0"); |
@@ -29,87 +29,87 @@ discard block |
||
29 | 29 | |
30 | 30 | |
31 | 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 | - } |
|
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 | 50 | } |
51 | 51 | |
52 | 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(); |
|
71 | - $photo_media->setText( $photo_tags ); |
|
72 | - $photo_entry->mediaGroup = new Zend_Gdata_Media_Extension_MediaGroup(); |
|
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() ); |
|
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(); |
|
71 | + $photo_media->setText( $photo_tags ); |
|
72 | + $photo_entry->mediaGroup = new Zend_Gdata_Media_Extension_MediaGroup(); |
|
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 | 86 | } |
87 | 87 | |
88 | 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; |
|
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 | 104 | } else { |
105 | - $response = 0; |
|
105 | + $response = 0; |
|
106 | 106 | } |
107 | 107 | |
108 | 108 | |
109 | 109 | if ( isset( $_GET['ajax'] ) ) |
110 | - echo $response; |
|
110 | + echo $response; |
|
111 | 111 | else |
112 | - header('location:../index.php?response='.$response); |
|
112 | + header('location:../index.php?response='.$response); |
|
113 | 113 | |
114 | 114 | |
115 | 115 | ?> |
@@ -8,15 +8,15 @@ discard block |
||
8 | 8 | Zend_Loader::loadClass('Zend_Gdata_AuthSub'); |
9 | 9 | |
10 | 10 | if ( isset( $_GET['token'] ) ) { |
11 | - $_SESSION['google_session_token'] = Zend_Gdata_AuthSub::getAuthSubSessionToken( $_GET['token'] ); |
|
11 | + $_SESSION['google_session_token'] = Zend_Gdata_AuthSub::getAuthSubSessionToken( $_GET['token'] ); |
|
12 | 12 | |
13 | - $params = ""; |
|
14 | - foreach($_GET as $key => $value){ |
|
15 | - $params = $params . $key . '=' . $value . '&'; |
|
16 | - } |
|
17 | - //$params = $params . 'ajax='; |
|
18 | - $params = rtrim( $params, '&' ); |
|
19 | - header("location:../download_album.php?".$params); |
|
13 | + $params = ""; |
|
14 | + foreach($_GET as $key => $value){ |
|
15 | + $params = $params . $key . '=' . $value . '&'; |
|
16 | + } |
|
17 | + //$params = $params . 'ajax='; |
|
18 | + $params = rtrim( $params, '&' ); |
|
19 | + header("location:../download_album.php?".$params); |
|
20 | 20 | } |
21 | 21 | |
22 | 22 | ?> |
@@ -59,38 +59,38 @@ discard block |
||
59 | 59 | |
60 | 60 | <div class="container"> |
61 | 61 | <?php |
62 | - //============ Google Move Code ======================// |
|
62 | + //============ Google Move Code ======================// |
|
63 | 63 | |
64 | - function getCurrentUrl() { |
|
65 | - global $_SERVER; |
|
64 | + function getCurrentUrl() { |
|
65 | + global $_SERVER; |
|
66 | 66 | |
67 | - $php_request_uri = htmlentities(substr($_SERVER['REQUEST_URI'], 0, |
|
68 | - strcspn($_SERVER['REQUEST_URI'], "\n\r")), ENT_QUOTES); |
|
67 | + $php_request_uri = htmlentities(substr($_SERVER['REQUEST_URI'], 0, |
|
68 | + strcspn($_SERVER['REQUEST_URI'], "\n\r")), ENT_QUOTES); |
|
69 | 69 | |
70 | - if (isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on') { |
|
71 | - $protocol = 'https://'; |
|
72 | - } else { |
|
73 | - $protocol = 'http://'; |
|
74 | - } |
|
75 | - $host = $_SERVER['HTTP_HOST']; |
|
76 | - if ($_SERVER['SERVER_PORT'] != '' && |
|
77 | - (($protocol == 'http://' && $_SERVER['SERVER_PORT'] != '80') || |
|
78 | - ($protocol == 'https://' && $_SERVER['SERVER_PORT'] != '443'))) { |
|
79 | - $port = ':' . $_SERVER['SERVER_PORT']; |
|
80 | - } else { |
|
81 | - $port = ''; |
|
82 | - } |
|
83 | - return $protocol . $host . $port . $php_request_uri; |
|
84 | - } |
|
70 | + if (isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on') { |
|
71 | + $protocol = 'https://'; |
|
72 | + } else { |
|
73 | + $protocol = 'http://'; |
|
74 | + } |
|
75 | + $host = $_SERVER['HTTP_HOST']; |
|
76 | + if ($_SERVER['SERVER_PORT'] != '' && |
|
77 | + (($protocol == 'http://' && $_SERVER['SERVER_PORT'] != '80') || |
|
78 | + ($protocol == 'https://' && $_SERVER['SERVER_PORT'] != '443'))) { |
|
79 | + $port = ':' . $_SERVER['SERVER_PORT']; |
|
80 | + } else { |
|
81 | + $port = ''; |
|
82 | + } |
|
83 | + return $protocol . $host . $port . $php_request_uri; |
|
84 | + } |
|
85 | 85 | |
86 | - function getAuthSubUrl() { |
|
87 | - $next = getCurrentUrl(); |
|
88 | - $scope = 'http://picasaweb.google.com/data'; |
|
89 | - $secure = 0; |
|
90 | - $session = 1; |
|
91 | - return Zend_Gdata_AuthSub::getAuthSubTokenUri($next, $scope, $secure, $session); |
|
92 | - } |
|
93 | - ?> |
|
86 | + function getAuthSubUrl() { |
|
87 | + $next = getCurrentUrl(); |
|
88 | + $scope = 'http://picasaweb.google.com/data'; |
|
89 | + $secure = 0; |
|
90 | + $session = 1; |
|
91 | + return Zend_Gdata_AuthSub::getAuthSubTokenUri($next, $scope, $secure, $session); |
|
92 | + } |
|
93 | + ?> |
|
94 | 94 | |
95 | 95 | <div id="login-div" class="row"> |
96 | 96 | <a id="login-link" class="btn btn-danger btn-lg" href="<?php echo getAuthSubUrl();?>"> |