/** * Fetch a list of updates * * @return array */ function fetch_updates() { global $localParameters; $version = file_get_contents(__DIR__ . '/app/version.txt'); try { // Generate a unique instance ID for the site $instanceId = hash('sha1', $localParameters['secret_key'] . 'Mautic' . $localParameters['db_driver']); $data = ['application' => 'Mautic', 'version' => $version, 'phpVersion' => PHP_VERSION, 'dbDriver' => $localParameters['db_driver'], 'serverOs' => php_uname('s') . ' ' . php_uname('r'), 'instanceId' => $instanceId, 'installSource' => isset($localParameters['install_source']) ? $localParameters['install_source'] : 'Mautic']; make_request('https://updates.mautic.org/stats/send', 'post', $data); } catch (\Exception $exception) { // Not so concerned about failures here, move along } // Get the update data try { $appData = ['appVersion' => $version, 'phpVersion' => PHP_VERSION, 'stability' => isset($localParameters['update_stability']) ? $localParameters['update_stability'] : 'stable']; $data = make_request('https://updates.mautic.org/index.php?option=com_mauticdownload&task=checkUpdates', 'post', $appData); $update = json_decode($data); // Check if this version is up to date if ($update->latest_version || version_compare($version, $update->version, 'ge')) { return [false, 'Up to date!']; } // Fetch the package try { download_package($update->package); } catch (\Exception $e) { return [false, "Could not automatically download the package. Please download {$update->package}, place it in the same directory as this upgrade script, and try again."]; } return [true, $update->version]; } catch (\Exception $exception) { return [false, $exception->getMessage()]; } }
{ $i = file_get_contents(ZYWX_APPCAN."/plugin/getDownload.action?app_key=$appkey&pt=iPhone"); $i = explode('|', $i); preg_match('/\/(\d+)\//s', $i[1], $match); if($match[1]) { $appid = $match[1]; zywx_save_cache('cache.dat', $appid); } } $wap_down_url = "http://app.tx100.com/$appid/index.html"; $two_code_url = ZYWX_PROXY.'/index.php?m=qrcode&d='.$wap_down_url.'&e=H&s=6'; $two_dimensional_code_url=grap_Image($two_code_url); $iphone_download_url = download_package('iPhone'); $android_download_url = download_package('Android'); $smarty->assign('wap_down_url',$wap_down_url); $smarty->assign('two_dimensional_code_url',$two_dimensional_code_url); $smarty->assign('iphone_download_url',$iphone_download_url); $smarty->assign('android_download_url',$android_download_url); $smarty->display('client.html'); function zywx_load_cache($cache_file = 'cache.dat') { if(file_exists($cache_file)) { return file_get_contents($cache_file); } else {