Пример #1
0
 public function setConfig()
 {
     $environment = $this->getEnvironment();
     $url = Player_Flags::getFlag('url');
     $player = Player_Flags::getFlag('player');
     $user = Player_Flags::getFlag('user');
     $status = Player_Flags::getFlag('status');
     $label = Player_Flags::getFlag('label');
     $files = Player_Flags::getFlag('files');
     $path = Player_Flags::getFlag('path');
     $xml = $this->getConfig();
     if ($xml) {
         Player_Debug::setStatus('Downloading settings...', false, true);
         $params = array($player['id'] => $xml[$player['id']], $user['login'] => $xml[$user['login']]);
         Player_Debug::setDebug('Verifying updates...');
         $config = $this->loadConnection($environment, $url['config'], $params);
         if ($config) {
             Player_File::copyFile($path['config'] . $files['playlist']['file'], $path['config'] . $files['playlist']['temp'], true);
             Player_File::copyFile($path['config'] . $files['loop']['file'], $path['config'] . $files['loop']['temp'], true);
             Player_Debug::setDebug('Saving updates...');
             $array = Player_Convert::getXML($config, $label['config']);
             $array[$status['download']] = $this->_options[$status['download']];
             $config = Player_Convert::setXML($label['config'], $array);
             if (Player_File::setFile($this->getConfigFile(), $config, true)) {
                 return $this->_options = $array;
             }
         }
     }
     return false;
 }