public static final function getBackupDir() { $_version = TwigmoUpgrade::getNextVersionInfo(); $version = $_version['next_version']; if (!$version) { return false; } return TWIGMO_UPGRADE_DIR . $version . '/'; }
function fn_twg_check_for_upgrade() { TwigmoUpgrade::checkForUpgrade(); }
/** * @return bool - if upgrade is available */ public static function checkUpdates() { $url = self::PROTOCOL . self::TWIGMO_SERVER . '/' . self::UPDATES_SCRIPT; $url .= '?store_version=' . PRODUCT_VERSION . '&twigmo_version=' . TWIGMO_VERSION; $version_info = json_decode(self::_httpRequest($url, null, 'GET', false), true); if (empty($version_info) or !isset($version_info['next_version'])) { fn_set_notification('W', self::_getLangVar('warning'), self::_getLangVar('twgadmin_curl_error')); return false; } if ($version_info['next_version'] and $version_info['next_version'] != TWIGMO_VERSION) { $link = 'addons.update&addon=twigmo&selected_section=twigmo_addon'; $msg = str_replace('[link]', fn_url($link), self::_getLangVar('twgadmin_text_updates_available')); fn_set_notification('W', self::_getLangVar('notice'), $msg, 'S', 'twigmo_upgrade'); fn_twg_save_version_info($version_info); return true; } $old_version_info = TwigmoUpgrade::getNextVersionInfo(); if ($old_version_info['next_version'] != $version_info['next_version']) { fn_twg_save_version_info($version_info); } return false; }
if (!empty($_REQUEST['selected_section']) and $_REQUEST['selected_section'] == 'twigmo_addon') { 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()); }
fn_install_addon('twigmo', false); $_SESSION['twigmo_upgrade'] = array('upgrade_dirs' => $upgrade_dirs, 'install_src_dir' => $install_src_dir); fn_stop_scroller(); echo '<br><br>'; fn_redirect('upgrade_center.upgrade_twigmo.step2'); } } if ($mode == 'upgrade_twigmo' and $action == 'step2' and isset($_SESSION['twigmo_upgrade']) && !fn_twg_is_on_saas()) { fn_start_scroller(); fn_echo(__('twgadmin_restore_settings') . '<br>'); fn_ftp_connect(Settings::instance()->getValues('Upgrade_center')); fn_echo('.'); $upgrade_dirs = $_SESSION['twigmo_upgrade']['upgrade_dirs']; fn_echo('.'); // Uninstal addon fn_uninstall_addon('twigmo', false); fn_echo('.'); // Install fn_install_addon('twigmo', false); fn_echo('.'); // Restore settings TwigmoUpgrade::restoreSettingsAndCSS($upgrade_dirs, $auth['user_id']); fn_echo('.'); // Clear template cache fn_rm(Registry::get('config.dir.cache_templates')); fn_echo('.'); fn_echo('<br><b>' . __('twgadmin_upgrade_completed') . '<b><br>'); unset($_SESSION['twigmo_upgrade']); fn_stop_scroller(); return array(CONTROLLER_STATUS_REDIRECT, 'addons.update?addon=twigmo'); }
/*************************************************************************** * * * (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 Twigmo\Upgrade\TwigmoUpgrade; use Twigmo\Core\TwigmoConnector; if ($mode == 'auth' && !fn_twg_is_on_saas()) { TwigmoUpgrade::checkForUpgrade(); } elseif ($mode == 'check_twigmo_for_upgrade') { header('Content-Type: image/png'); echo base64_decode('iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAlJJREFUeNqkUztoVEEUPfN5k7gf4q4J6yduxKDRQhBEUCQ2KbaJCiI2Wtgt0cJCUEGxshJs/EBSWCoWFhKxULtFDUYXBUFMjJFl1WVBVkX39/a9N96ZfbtuoYU4cLgz8+45986ZeUxrjf8ZMjfBTIxxjqzgyAiJpBT0Qf4ZXKDCGR4whhni/ZQ0ASE7mE4cH9qYGFYRpRhlciHATeyA1owQtFpurVgYbXwqmsKXJVU1AhlDrjerquU3IShREqkDhGRGbQrGVDQ9MkwCmbaAtAJJU9mQV1/4CFAMKh8QFB5Dv7kDXi2DE5kxe1xw1afIuqSd2/MK2DZN5ebcdbRe3QLqXyG3H4Vz+DbE1gNdsjG9DVjYDs03HrbtPr1iozbrwU3g46eBveeIyqAXZi0Zvt8V4F13w/PGTy1gxdQ8nMmrVhSPzgCll8Cuk9CxNcQlsuch+JtAkL8B/f4hWGobMDlNF5yCfnKJkvqBLQfhGTJBB0AQ9Aiw0AM9fw3IXQTuHmu/lJ0noCvL0NQFG9nTFfCJ7PcIuKZdIyCmKDGbB358Bgo5YO0O23bwZREsseG3gAeXABm+5FLnnjvDmlWvgDlRS5JujQr0tQVIsFpFyaSw14eMv5gZ2zd+RDZq0d6rMpUNoRdmT6lINX/v3U3yICuelYGJVUi7nh6NrxsaEPGoRD8ZphTgONSBA04QBIf2ghZvLL6oLBWX6/fPL+G5eR3p9RGkzo5h/+YYdkNjpXG347IfRgsfdHB8e/sdc9NlzJY9lI3AAIFKQvzjn0xyaPwSYACS4hG3ZjB6zgAAAABJRU5ErkJggg=='); TwigmoUpgrade::checkForUpgrade(); die; } elseif ($mode == 'update_twigmo_connection') { $connector = new TwigmoConnector(); if ($connector->updateConnections()) { $connector->displayServiceNotifications(); } }