Пример #1
0
 /**
  * Sets the player activation code and writes in the .activation filename.
  *
  * @return string
  */
 public function setActivation()
 {
     $code = $this->_setCode();
     Player_File::setFile($this->_filename, $code, true);
     $this->_activation = $code;
     return $this->_activation;
 }
Пример #2
0
 /**
  * Write a .ini file.
  *
  * @param  array $params array
  * @param  string $filename null
  * @param  string $level -1
  * @return mixed
  */
 public static function setIni($params = array(), $filename = null, $level = -1)
 {
     if ($params && $filename) {
         $return = '';
         $level++;
         foreach ($params as $key => $value) {
             if (is_array($value)) {
                 if (count($value) > 1) {
                     $return .= self::setIni($value, $filename, $level);
                 } else {
                     $return .= $key . ' = "' . self::setIni($value, $filename, $level) . '"' . PHP_EOL;
                 }
             } else {
                 if (is_int($value)) {
                     $return .= $key . ' = "' . $value . '"' . PHP_EOL;
                 } else {
                     $return .= $key . ' = "' . $value . '"' . PHP_EOL;
                 }
             }
         }
         if ($level == 0) {
             $return = Player_File::setFile($filename, $return, true);
         }
         return $return;
     }
     return false;
 }
Пример #3
0
 /**
  * Run installation.
  *
  * @return string
  */
 private function __runInstall($connection, $validate, $params = null)
 {
     $url = Player_Flags::getFlag('url');
     $status = Player_Flags::getFlag('status');
     $player = Player_Flags::getFlag('player');
     $label = Player_Flags::getFlag('label');
     $login = $connection->loadConnection($this->getEnvironment(), $url['login'], $params);
     if ($login) {
         $xml = Player_Convert::getXML($login, $label['config']);
         if (isset($xml[$status['active']])) {
             if (intval($xml[$status['active']]) == 1) {
                 Player_File::setFile($this->getConfigFile(), $login, true);
                 return true;
             }
         }
     }
     return false;
 }
Пример #4
0
 public static function setClear()
 {
     $path = Player_Flags::getFlag('path');
     $files = Player_Flags::getFlag('files', 'refresh');
     $filename = $path['config'] . $files['file'];
     if (Player_File::setFile($filename)) {
         return true;
     }
     return false;
 }
Пример #5
0
 /**
  * Load a File from any server
  * 
  * Sets and gets the validation of the player
  *
  * @param  string $path null
  * @param  array $params null
  * @return array
  */
 public function loadFile($filename = null, $path = null, $overwrite = false)
 {
     if ($this->checkConnection()) {
         $url = $path;
         $curl = curl_init();
         $options = array(CURLOPT_RETURNTRANSFER => true, CURLOPT_FOLLOWLOCATION => true, CURLOPT_URL => $url);
         $proxy = new Player_Connect_Proxy();
         if (is_array($proxy::getProxy())) {
             $options[CURLOPT_HTTPPROXYTUNNEL] = true;
             $options[CURLOPT_PROXY] = $proxy::$server;
             $options[CURLOPT_PROXYPORT] = $proxy::$port;
         }
         curl_setopt_array($curl, $options);
         $return = curl_exec($curl);
         $error = curl_errno($curl);
         $code = curl_getinfo($curl, CURLINFO_HTTP_CODE);
         $size = curl_getinfo($curl, CURLINFO_CONTENT_LENGTH_DOWNLOAD);
         $total = curl_getinfo($curl, CURLINFO_SIZE_DOWNLOAD);
         curl_close($curl);
         if ($error == 0) {
             if ($code < 400) {
                 if ($size === $total) {
                     if (Player_File::setFile($filename, $return, $overwrite)) {
                         return true;
                     }
                 }
             }
         }
     } else {
         return false;
     }
 }
Пример #6
0
 public function setLoop($campaigns = null, $medias = null)
 {
     $loop = $this->getLoop();
     $media = Player_Flags::getFlag('playlist', 'media');
     $files = Player_Flags::getFlag('files', 'loop');
     $label = Player_Flags::getFlag('label', 'loop');
     $path = Player_Flags::getFlag('path');
     if (isset($loop[$campaigns][$medias])) {
         $loop[$campaigns][$medias][$media['status']] = false;
     }
     $file = Player_Convert::setXML($label, $loop);
     if (Player_File::setFile($path['config'] . $files['file'], $file, true)) {
         return true;
     }
     return false;
 }
Пример #7
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;
 }