Пример #1
0
<?php

// For IE to support headers if chat is installed on different domain
header('P3P: CP="NOI ADM DEV COM NAV OUR STP"');
$referer = '';
$dynamic_url = '';
$identifier = '';
$tpl = erLhcoreClassTemplate::getInstance('lhbrowseoffer/widget.tpl.php');
$invitationHash = (string) $Params['user_parameters']['hash'];
$invitation = erLhAbstractModelBrowseOfferInvitation::getList(array('filter' => array('hash' => $invitationHash)));
if (!empty($invitation)) {
    $invite = array_shift($invitation);
    $tpl->set('invite', $invite);
    $Result['content'] = $tpl->fetch();
    $Result['pagelayout'] = 'widget';
    $Result['dynamic_height'] = true;
    $Result['dynamic_height_message'] = 'lhc_sizing_browseoffer';
    $Result['dynamic_height_append'] = 10;
    $Result['pagelayout_css_append'] = 'embed-widget';
} else {
    exit;
}
Пример #2
0
<?php

header('P3P: CP="NOI ADM DEV COM NAV OUR STP"');
header('Content-type: text/javascript');
header('Expires: Sat, 26 Jul 1997 05:00:00 GMT');
header('Last-Modified: ' . gmdate('D, d M Y H:i:s', time() + 60 * 60 * 8) . ' GMT');
header('Cache-Control: no-store, no-cache, must-revalidate');
header('Cache-Control: post-check=0, pre-check=0', false);
header('Pragma: no-cache');
$validUnits = array('pixels' => 'px', 'percents' => '%');
$referer = isset($_GET['r']) ? rawurldecode($_GET['r']) : '';
$location = isset($_GET['l']) ? rawurldecode($_GET['l']) : '';
$ignorable_ip = erLhcoreClassModelChatConfig::fetch('ignorable_ip')->current_value;
if ($ignorable_ip == '' || !erLhcoreClassIPDetect::isIgnored(erLhcoreClassIPDetect::getIP(), explode(',', $ignorable_ip))) {
    $matched = erLhAbstractModelBrowseOfferInvitation::processInvitation(array('l' => $location, 'r' => $referer, 'identifier' => (string) $Params['user_parameters_unordered']['identifier']));
    if ($matched !== false) {
        $tpl = erLhcoreClassTemplate::getInstance('lhbrowseoffer/getstatus.tpl.php');
        $tpl->set('size', $matched->width > 0 ? $matched->width : (!is_null($Params['user_parameters_unordered']['size']) && (int) $Params['user_parameters_unordered']['size'] >= 0 ? (int) $Params['user_parameters_unordered']['size'] : 450));
        $tpl->set('size_height', $matched->height > 0 ? $matched->height : !is_null($Params['user_parameters_unordered']['height']) && (int) $Params['user_parameters_unordered']['height'] >= 0 ? (int) $Params['user_parameters_unordered']['height'] : 450);
        $tpl->set('units', key_exists((string) $matched->unit, $validUnits) ? $validUnits[$matched->unit] : (key_exists((string) $Params['user_parameters_unordered']['units'], $validUnits) ? $validUnits[(string) $Params['user_parameters_unordered']['units']] : 'px'));
        $tpl->set('invite', $matched);
        $tpl->set('showoverlay', (string) $Params['user_parameters_unordered']['showoverlay'] == 'true' ? true : false);
        $tpl->set('canreopen', (string) $Params['user_parameters_unordered']['canreopen'] == 'true' ? true : false);
        $tpl->set('timeout', !is_null($Params['user_parameters_unordered']['timeout']) && (int) $Params['user_parameters_unordered']['timeout'] > 0 ? (int) $Params['user_parameters_unordered']['timeout'] : false);
        echo $tpl->fetch();
    }
}
exit;