public static function on_download(Context $ctx) { zip::fromFolder($zipFile = os::path($ctx->config->getPath('main/tmpdir'), 'backup.zip'), MCMS_ROOT, realpath($ctx->config->getPath('main/tmpdir'))); $filename = $ctx->host() . '-' . date('YmdHi', time() - date('Z', time())) . '.zip'; header('Content-Type: application/zip'); header('Content-Length: ' . filesize($zipFile)); header('Content-Disposition: attachment; filename="' . $filename . '"'); readfile($zipFile); unlink($zipFile); die; }
public function find(Context $ctx, $realQuery) { $args = array(); $query = '/' . $realQuery; $prefix = strtoupper($ctx->method()) . '/'; $q = array($prefix . $query, $prefix . $ctx->host() . $query, $prefix . 'localhost' . $query); foreach ($q as $mask) { if (array_key_exists($mask, $this->static)) { return array($this->static[$mask], array()); } if (false !== ($tmp = $this->findre($mask))) { return $tmp; } } return false; }