Ejemplo n.º 1
0
 public static function setDebug($log, $tab = null)
 {
     if (intval($tab) > 0) {
         $tab = Player_Utils::getSeparator(self::getTab(), $tab);
     }
     $log = $tab . $log;
     if (self::getLog() == null) {
         self::setLog(Player_Utils::getSeparator('=', 70));
         self::setLog('DOWNLOAD LOG - ' . (Player_Utils::getInterface() ? 'PROMPT' : 'BROWSER'));
         self::setLog(date('d') . '/' . Player_Utils::getMonth(date('m'), array('UPP', 'CUT')) . '/' . date('Y') . ' - ' . date('h:i:s'));
         self::setLog(Player_Utils::getSeparator('=', 70));
         if (self::getDebug()) {
             echo self::getLog() . self::getBreakline();
         }
     }
     if (self::getDebug()) {
         echo $log . self::getBreakline();
     }
     self::setLog($log);
 }
Ejemplo n.º 2
0
 public static function &setXMLTag($xml, $key = 'xml', $params = null, $encoding = 'UTF-8')
 {
     if (is_numeric($key)) {
         $tag = $xml->createElement('item');
         $tag->setAttribute('id', $key);
     } else {
         $tag = $xml->createElement($key);
     }
     if (is_array($params)) {
         foreach ($params as $key => $value) {
             $child = self::setXMLTag($xml, $key, $value, $encoding);
             $tag->appendChild($child);
         }
     } else {
         $params = $params === true ? 'true' : $params;
         $params = $params === false ? 'false' : $params;
         $child = Player_Utils::setEncode($params);
         $tag->appendChild($xml->createTextNode($child));
     }
     return $tag;
 }
Ejemplo n.º 3
0
 /**
  * Sets installation.
  *
  * @return string
  */
 public function setInstall($connection, $validate)
 {
     $player = Player_Flags::getFlag('player');
     $user = Player_Flags::getFlag('user');
     $send = true;
     if ($connection->checkConnection($this->getEnvironment())) {
         if (isset($_GET['layout'])) {
             if ($_GET['layout'] == 'login') {
                 if (isset($_POST)) {
                     $post = array('login', 'password');
                     foreach ($post as $key => $value) {
                         if (!isset($_POST[$value])) {
                             $send = false;
                         }
                     }
                     if ($send) {
                         $params = array($user['login'] => $_POST['login'], $user['password'] => $_POST['password'], $player['code'] => $validate->getActivation(), $player['status'] => 1);
                         if ($this->__runInstall($connection, $validate, $params)) {
                             Player_Utils::redirect('download');
                         } else {
                             $this->layout->status = 'Connection error. Try again.';
                         }
                     }
                 }
             } else {
                 Player_Utils::redirect('login');
             }
         } else {
             Player_Utils::redirect('login');
         }
     }
 }
Ejemplo n.º 4
0
 public function setPictures()
 {
     Player_Debug::setStatus('Downloading images...');
     $library = $this->getLibraries();
     $media = Player_Flags::getFlag('playlist', 'media');
     $label = Player_Flags::getFlag('label');
     $path = Player_Flags::getFlag('path');
     $field = Player_Flags::getFlag('field');
     Player_Debug::setDebug('Listing images to download:');
     foreach ($library as $key => $value) {
         $lib = $path['library'] . $path['temp'];
         $file = Player_File::getFile($lib . $value);
         $feed = Player_Convert::getXML($file, $label['library']);
         if (isset($feed[$label['feed']])) {
             foreach ($feed[$label['feed']] as $k => $v) {
                 if (isset($v[$field['image']])) {
                     if (!empty($v[$field['image']])) {
                         $local = $path['picture'];
                         $temp = $path['picture'] . $path['temp'];
                         $filename = substr($v[$field['image']], strrpos($v[$field['image']], '/') + 1);
                         if (!file_exists($local . $filename)) {
                             Player_File::setDir($temp);
                             $i = 1;
                             do {
                                 $success = $this->loadFile($temp . $filename, $v[$field['image']], true);
                                 if ($success) {
                                     Player_Debug::setDebug('Download:' . Player_Debug::getTab() . '"' . $filename . '"', 1);
                                 } else {
                                     Player_Debug::setDebug('Trying download ' . $i++ . Player_Debug::getTab() . '"' . $filename . '"', 1);
                                     if ($i > 5) {
                                         Player_Debug::setDebug('Canceling download after ' . $i++ . ' failed tries.' . Player_Debug::getTab() . '"' . $filename . '"', 1);
                                         return false;
                                     }
                                 }
                                 $success = Player_Utils::setSwitch($success, true, false);
                             } while ($success);
                         }
                         $this->setPics($filename);
                     }
                 }
             }
         }
     }
     return true;
 }