コード例 #1
0
ファイル: _pb_og.php プロジェクト: JosephsPlace/PccBay
function pb_og($call = null, $data = null)
{
    $openGraphPages = array('feed', 'products', 'questions', 'discussions', 'comments', 'tags', 'users', 'images', 'notify', 'smartsearch');
    $return = null;
    if ($call == 'token') {
        if ($data === null) {
            $data = OG_APP;
        }
        $data = explode(':', $data);
        $return = pb_graph_token($data[0], $data[1]);
    }
    if ($call == 'access_token') {
        $data = explode(':', $data);
        $token = pb_time('token:' . $data[0], array('expire' => $data[1], 'key' => md5($data[1])));
        $return = array('token' => $token, 'expire' => $data[1], 'key' => md5($data[1]));
    }
    if ($call == 'site') {
        $return = domain($data);
    }
    if (in_array($call, $openGraphPages)) {
        $return = pb_og_fgc($call, 'q=' . $data);
    }
    return $return;
}
コード例 #2
0
function pb_is_image($get_string)
{
    $get_string = explode('?', $get_string);
    parse_str($get_string[1], $params);
    $safe_image = str_replace('safe_image=', '', $params['safe_image']);
    $url_string = explode(':', $safe_image);
    if (isset($url_string[0]) && isset($url_string[1]) && isset($url_string[2])) {
        $remoteImage = $_SERVER['DOCUMENT_ROOT'] . '/' . pb_encrypt_decrypt('decrypt', $url_string[2]) . '' . $url_string[0] . '/' . $url_string[1];
        $confirm = pb_time('token:check', array('key' => md5(pb_encrypt_decrypt('decrypt', $url_string[2])), 'token' => $params['day_code']));
        if (file_exists($remoteImage) && $confirm) {
            return true;
        }
    }
}
コード例 #3
0
ファイル: i.php プロジェクト: JosephsPlace/PccBay
<?php

include_once $_SERVER['DOCUMENT_ROOT'] . DOCUMENT_ROOT_EXT . '/includes/php/_pb_min_functions.php';
if (!isset($_GET['day_code'])) {
    header('Content-Type: application/json');
    print 'day_code required.';
    exit;
}
if (!isset($_GET['safe_image'])) {
    header('Content-Type: application/json');
    print 'Image Key required.';
    exit;
}
$url_string = explode(':', $_GET['safe_image']);
$remoteImage = $_SERVER['DOCUMENT_ROOT'] . DOCUMENT_ROOT_EXT . '' . pb_encrypt_decrypt('decrypt', $url_string[2]) . '' . $url_string[0] . '/' . $url_string[1];
$confirm = pb_time('token:check', array('key' => md5(pb_encrypt_decrypt('decrypt', $url_string[2])), 'token' => $_GET['day_code']));
if (file_exists($remoteImage) && $confirm) {
    $ext = pathinfo($remoteImage, PATHINFO_EXTENSION);
    header('Content-Type: image/' . $ext);
    print file_get_contents($remoteImage);
} elseif (file_exists($remoteImage) && !$confirm) {
    header('Content-Type: application/json');
    print "This image has expired.";
} else {
    header('Content-Type: image/jpeg');
    print file_get_contents($_SERVER['DOCUMENT_ROOT'] . DOCUMENT_ROOT_EXT . '/images/interior-images/placeholder.jpg');
}
コード例 #4
0
ファイル: accessToken.php プロジェクト: JosephsPlace/PccBay
<?php

if (!empty($_GET['app_id'])) {
    $app_id = $_GET['app_id'] or '';
    $secret = $_GET['secret'] or '';
    include_once "../includes/php/_db-config.php";
    $sql = "SELECT * FROM pb_developers WHERE app_id='{$app_id}' AND secret='{$secret}'";
    $conn = new mysqli($servername, $username, $password, $dbname);
    if ($conn->connect_error) {
        die("Connection failed: " . $conn->connect_error);
    }
    $result = $conn->query($sql);
    if ($result->num_rows > 0) {
        while ($val = $result->fetch_assoc()) {
            $accessToken = '';
            include_once 'accessToken-algorithm.php';
            $r = array('token' => $accessToken, 'expir' => date("F j, Y") . ', 12:00:00 pm', 'user' => $val['user'], 'perm' => $val['permissions'], 'data' => $val['user_data']);
            print json_encode($r, 128);
        }
    } else {
        print json_encode(array('Access Blocked'), 128);
    }
    $conn->close();
} elseif (!empty($_GET['access_token'])) {
    $token = $_GET['access_token'] . '==';
    print pb_time('token:check', array('token' => $token));
} else {
    print json_encode(array('Access Blocked'), 128);
}