use Twigmo\Core\TwigmoConnector; use Twigmo\Core\TwigmoSettings; $action = isset($_REQUEST['action']) ? $_REQUEST['action'] : ''; if ($action == 'check.admin' || $action == 'check.customer') { $connector = new TwigmoConnector(); $connect_till = TwigmoSettings::get('connect_till'); if (!$connect_till or TIME > $connect_till) { $connector->onError('Connection timeout'); } $request = $connector->parseResponse($_REQUEST['data']); if (empty($request['data']) or empty($request['data']['url'])) { $connector->onError(); } // Request is ok - check url if ($action == 'check.admin') { if ($request['data']['url'] != $connector->getAdminUrl()) { $connector->onError('Wrong admin url'); } } else { $stores = fn_twg_get_stores(); $store = reset($stores); $my_url = $connector->getCustomerUrl($store); if ($request['data']['url'] != $my_url) { $connector->onError('Wrong customer url'); } } $connector->respond(array('result' => 'ok')); } elseif ($action == 'repo.updated') { $connector = new TwigmoConnector(); $stores = fn_twg_get_stores(); $store = reset($stores);
* (c) 2004 Vladimir V. Kalynyak, Alexey V. Vinokurov, Ilya M. Shalnev * * * * This is commercial software, only users who have purchased a valid * * license and accept to the terms of the License Agreement can install * * and use this program. * * * **************************************************************************** * PLEASE READ THE FULL TEXT OF THE SOFTWARE LICENSE AGREEMENT IN THE * * "copyright.txt" FILE PROVIDED WITH THIS DISTRIBUTION PACKAGE. * ****************************************************************************/ if (!defined('BOOTSTRAP')) { die('Access denied'); } use Tygh\Registry; use Twigmo\Core\TwigmoConnector; require_once Registry::get('config.dir.addons') . 'twigmo/Twigmo/Core/phpqrcode/qrlib.php'; if ($mode == 'show_qr') { $access_id = fn_twg_get_connected_access_id($auth); if (!$access_id) { die; } $user_info = Registry::get('user_info'); $login = Registry::get('settings.General.use_email_as_login') == 'N' ? $user_info['user_login'] : $user_info['email']; // outputs image directly into browser, as PNG stream $url = TwigmoConnector::getAdminUrl(false); QRcode::png($url . '_' . $login . '_' . $access_id); die; } elseif ($mode == 'view') { $view = fn_twg_get_view_object(); $view->assign('connected_access_id', fn_twg_get_connected_access_id($auth)); }