/** * Submits an HTTP POST to a reCAPTCHA server * @param string $host * @param string $path * @param array $data * @param int port * @return array response */ function _recaptcha_http_post($host, $path, $data, $port = 80) { $req = _recaptcha_qsencode($data); $request = new Request($host, $path, $port, true, true, 10); $request->setData($data); $request->setUserAgent('reCAPTCHA/PHP'); $request->skiplog(true); if (!($response = $request->send())) { trigger_error("Unable to reach reCAPCHA server."); } $response = explode("\r\n\r\n", $response, 2); return $response; }
} unset($files); krsort($sorted_files); // Sort to time order foreach ($sorted_files as $file) { $filename = basename($file); $type = preg_match('/^database/', $filename) ? 'database' : 'files'; $restore = preg_match('/^database_full|files/', $filename) ? '?_g=maintenance&node=index&restore=' . $filename . '#backup' : false; $existing_backups[] = array('filename' => $filename, 'delete_link' => '?_g=maintenance&node=index&delete=' . $filename . '#backup', 'download_link' => '?_g=maintenance&node=index&download=' . $filename . '#backup', 'restore_link' => $restore, 'type' => $type, 'warning' => $type == 'database' ? $lang['maintain']['restore_db_confirm'] : $lang['maintain']['restore_files_confirm'], 'size' => formatBytes(filesize($file), true)); } } $GLOBALS['smarty']->assign('EXISTING_BACKUPS', $existing_backups); ## Upgrade ## Check current version if ($request = new Request('www.cubecart.com', '/version-check/' . '2.3.22')) { $request->skiplog(true); $request->setMethod('get'); $request->cache(true); $request->setSSL(true); $request->setUserAgent('CubeCart'); $request->setData(array('version' => CC_VERSION)); if (($response = $request->send()) !== false) { if (version_compare(trim($response), CC_VERSION, '>')) { $GLOBALS['smarty']->assign('OUT_OF_DATE', sprintf($lang['dashboard']['error_version_update'], $response, CC_VERSION)); $GLOBALS['smarty']->assign('LATEST_VERSION', $response); $GLOBALS['smarty']->assign('UPGRADE_NOW', $lang['maintain']['upgrade_now']); $GLOBALS['smarty']->assign('FORCE', '0'); } else { $GLOBALS['smarty']->assign('LATEST_VERSION', CC_VERSION); $GLOBALS['smarty']->assign('UPGRADE_NOW', $lang['maintain']['force_upgrade']); $GLOBALS['smarty']->assign('FORCE', '1');