public static function sendUaStat() { $access_id = TwigmoConnector::getAccessID('A'); if (!$access_id) { return; } $query = db_quote('FROM ?:twigmo_ua_stat WHERE month<?s LIMIT ?i', date('Y-m-1'), 100); $needToSend = db_get_array('SELECT *, ?s as access_id ' . $query, $access_id); if (!count($needToSend)) { return; } $responce = Http::post(TWG_UA_RULES_STAT, array('stat' => serialize($needToSend))); if ($responce == 'ok') { db_query('DELETE ' . $query); } }
fn_delete_notification('twigmo_upgrade'); } if (!fn_twg_is_updated()) { fn_set_notification('W', __('notice'), __('twgadmin_reinstall')); } $company_id = fn_twg_get_current_company_id(); $view = Registry::get('view'); $view->assign('default_logo', TwigmoImage::getDefaultLogoUrl($company_id)); $urls = TwigmoConnector::getMobileScriptsUrls(); $view->assign('favicon', $urls['favicon']); $view->assign('logo_object_id', $company_id * 10 + 1); $view->assign('favicon_object_id', $company_id * 10 + 2); $tw_register['version'] = TWIGMO_VERSION; $view->assign('tw_register', $tw_register); $view->assign('next_version_info', TwigmoUpgrade::getNextVersionInfo()); $view->assign('twg_is_connected', TwigmoConnector::anyFrontendIsConnected()); $stores = fn_twg_get_stores(); $platinum_stores = fn_twg_init_push_comment(fn_twg_filter_connected_platinum_stores($stores)); $view->assign('stores', $stores); $view->assign('platinum_stores', $platinum_stores); $view->assign('max_push_length', TwigmoConnector::MAX_PUSH_LENGTH); $view->assign('twg_all_stores_connected', TwigmoConnector::allStoresAreConnected($stores)); $view->assign('reset_pass_link', TwigmoConnector::getResetPassLink()); $admin_access_id = TwigmoConnector::getAccessID('A'); $view->assign('admin_access_id', $admin_access_id); $view->assign('is_disconnect_mode', isset($_REQUEST['disconnect']) && $admin_access_id); $view->assign('tw_settings', TwigmoSettings::get()); $view->assign('is_on_saas', fn_twg_is_on_saas()); $view->assign('connected_access_id', fn_twg_get_connected_access_id()); } }
/** * @param Boolean $display_service_notifications * @return Boolean */ public static function checkForUpgrade($display_service_notifications = true) { $is_upgradable = false; $user_have_upgrade_priveleges = isset($_SESSION['auth']) && $_SESSION['auth']['area'] == 'A' && !empty($_SESSION['auth']['user_id']) && fn_check_user_access($_SESSION['auth']['user_id'], 'upgrade_store'); if ($user_have_upgrade_priveleges) { $is_upgradable = !fn_twg_is_on_saas() && TwigmoConnector::checkUpdates(); TwigmoConnector::updateUARules(); if (TwigmoConnector::getAccessID('A')) { $connector = new TwigmoConnector(); $connector->updateConnections(); self::displayServiceNotifications(array('display_service_notifications' => $display_service_notifications, 'connector' => $connector)); } UserAgent::sendUaStat(); } return $is_upgradable; }
public function returnResponse($xml_root_node = 'data') { $this->addPaymentNotifications(); $notifications = fn_get_notifications(); // Clear all the user notifications $_SESSION['notifications'] = array(); $this->setMeta(empty($notifications) ? array() : array_values($notifications), 'notifications'); $this->setMeta(TwigmoConnector::getAccessID(), 'access_id'); $this->setMeta(TWIGMO_VERSION, 'twigmo_version'); $this->setMeta(PRODUCT_VERSION, 'cart_version'); $this->setMeta(PRODUCT_EDITION, 'cart_edition'); $this->setMeta($this->getPageUrl($_REQUEST), 'page_url'); $doc = $this->getAsDoc($this->format, $xml_root_node); self::showResponse($doc, $this->format); }