/**
     * Sets the first download to done.
     *
     * @return boolean
     */
    public function setDownload($connection)
    {
        if ($connection->checkConnection($this->getEnvironment())) {
            $session = new Player_Session('download');
            if (isset($_GET['layout'])) {
                if ($_GET['layout'] == 'download') {
                    if ($session->getSession('download') == 0) {
                        $files = Player_Flags::getFlag('files', 'download');
                        $path = Player_Flags::getFlag('path');
                        $filename = $path['config'] . $files['file'];
                        $download = '"' . REAL_PATH . DIRECTORY_SEPARATOR . 'download.php"';
                        $params = <<<HEREDOC
START /MIN /HIGH php -f {$download} EXIT
HEREDOC;
                        Player_File::setFile($filename, $params, true);
                        $shell = new COM('WScript.Shell');
                        $shell->Run($filename, 0, false);
                        Player_Debug::setStatus('Starting download...', false, false, true);
                        $session->setSession('download', 1);
                        Player_Utils::redirect('download');
                    }
                } else {
                    Player_Utils::redirect('download');
                }
            } else {
                Player_Utils::redirect('download');
            }
        }
    }
Beispiel #2
0
 public function setDownload()
 {
     Player_Debug::setDebug('Saving settings...');
     Player_Debug::setStatus('Finishing download...');
     $path = Player_Flags::getFlag('path');
     $files = Player_Flags::getFlag('files');
     $label = Player_Flags::getFlag('label');
     $status = Player_Flags::getFlag('status');
     $file = Player_File::getFile($path['config'] . $files['config']['file']);
     $xml = Player_Convert::getXML($file, $label['config']);
     $xml[$status['download']] = 1;
     $file = Player_Convert::setXML($label['config'], $xml);
     if (Player_File::setFile($path['config'] . $files['config']['file'], $file, true)) {
         if (file_exists($path['config'] . $files['download']['file'])) {
             if (Player_File::unsetFile($path['config'] . $files['download']['file'])) {
                 return true;
             } else {
                 return false;
             }
         }
         return true;
     }
     return false;
 }