예제 #1
0
파일: data.php 프로젝트: dmitriz/Platform
function Broadcast_agreement_response_data()
{
    $streamName = is_array($_REQUEST['streamName']) ? implode('/', $_REQUEST['streamName']) : $_REQUEST['streamName'];
    if (!isset(Broadcast::$cache['agreement'])) {
        $user = Users::loggedInUser(true);
        $agreement = new Broadcast_Agreement();
        $agreement->userId = $user->id;
        $agreement->publisherId = $_REQUEST['publisherId'];
        $agreement->streamName = $_REQUEST['streamName'];
        if ($agreement->retrieve()) {
            Broadcast::$cache['agreement'] = $agreement;
        } else {
            Broadcast::$cache['agreement'] = false;
        }
    }
    $agreed = !empty(Broadcast::$cache['agreement']);
    return compact('agreed');
}
예제 #2
0
파일: put.php 프로젝트: dmitriz/Platform
function Broadcast_agreement_put()
{
    $user = Users::loggedInUser(true);
    foreach (array('publisherId', 'streamName') as $field) {
        if (empty($_REQUEST[$field])) {
            throw new Q_Exception_RequiredField(compact('field'));
        }
    }
    $streamName = is_array($_REQUEST['streamName']) ? implode('/', $_REQUEST['streamName']) : $_REQUEST['streamName'];
    $agreement = new Broadcast_Agreement();
    $agreement->userId = $user->id;
    $agreement->publisherId = $_REQUEST['publisherId'];
    $agreement->streamName = $streamName;
    $agreement->platform = 'facebook';
    $agreement->details_json = '';
    if (!$agreement->retrieve()) {
        $agreement->save();
    }
    Broadcast::$cache['agreement'] = $agreement;
}