//------------------------------------------------------------------------ //------------------------------------------------------------------------ require_once 'Import.php'; require_once Import::$uber_src_path . "server/werm/services/videoOrganizer/VideoOrganizer.php"; require_once Import::$uber_src_path . "server/werm/services/Account_v0.php"; require_once Import::$uber_src_path . "server/ricardo_garcia/YouTube.php"; //------------------------------------------------------------------------ Account_v0::chk(); //------------------------------------------------------------------------ $chk = array('bool' => true); //------------------------------------------------------------------------ if (!isset($_GET['v']) && !isset($_GET['l'])) { $chk['bool'] = false; } else { if (isset($_GET['v'])) { $obj = new VideoOrganizer(); $chk = $obj->getLinks($_GET['v']); } } //------------------------------------------------------------------------ //if (!$chk['bool']) header("Location: http://".Constants::PREFFIX.'Modules/videoOrganizer_v0/'); ?> <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>videoOrganizer_v0</title> <!--===============================================================--> <link rel="stylesheet" type="text/css" href="global/css/index.css"/> <link rel="stylesheet" type="text/css" href="<?php echo Import::absolute();
public function archive() { //---------------------------------------------------------- //init var //---------------------------------------------------------- /*$chk = array("bool" => true, "func" => $this->traceID.": archive"); $dirArray = array(); $myDirectory; $num = 1; //---------------------------------------------------------- $myDirectory = opendir($this->newVideoRelPath); //---------------------------------------------------------- $this->move($this->newVideoRelPath, $this->newVideoRelPath, " ", "_"); //---------------------------------------------------------- $this->move($this->newThumbRelPath, $this->newThumbRelPath, " ", "_"); //---------------------------------------------------------- while($entryName = readdir($myDirectory)) { if (stristr($entryName, '.mp4')) { $num ++; $hash = $this->getHash("videos", $num); array_push($dirArray, array( 'title' => $entryName, 'orig_title' => $entryName, 'hash' => $hash, 'mp4' => $this->str_lreplace(".mp4", "_".$hash.".mp4", $entryName), 'thumbnail_url' => $thumbnail_url = $this->str_lreplace(".mp4", "_".$hash.".png", $entryName) )); rename($this->newVideoRelPath.$entryName, $this->newVideoRelPath.$this->str_lreplace(".mp4", "_".$hash.".mp4", $entryName)); rename($this->newThumbRelPath.$this->str_lreplace(".mp4", ".png", $entryName), $this->newThumbRelPath.$thumbnail_url); } } $chk = $this->_insertContents($dirArray);*/ $chk = array("bool" => true, "func" => $this->traceID . ": archive"); $dirArray = array(); $myDirectory; $num = 1; //---------------------------------------------------------- //---------------------------------------------------------- //$this->move($this->newVideoRelPath, $this->newVideoRelPath, " ", "_"); //---------------------------------------------------------- //$this->move($this->newThumbRelPath, $this->newThumbRelPath, " ", "_"); //---------------------------------------------------------- $videoOrganizer = new VideoOrganizer(); //---------------------------------------------------------- $this->videos = array(); $myDirectory = opendir($this->newVideoRelPath); while ($entryName = readdir($myDirectory)) { array_push($this->videos, $entryName); } closedir($myDirectory); //---------------------------------------------------------- $this->thumbs = array(); $myDirectory = opendir($this->newThumbRelPath); while ($entryName = readdir($myDirectory)) { array_push($this->thumbs, $entryName); } closedir($myDirectory); //---------------------------------------------------------- foreach ($this->videos as $entryName) { if (stristr($entryName, '.mp4')) { $thumbnail_name = $this->str_lreplace(".mp4", ".png", $entryName); //$thumb = (file_exists($this->newThumbRelPath.$thumbnail_name)) ? $videoOrganizer->insertFile($thumbnail_name) : NULL; $thumb_name = $this->getThumb($this->getFileName($entryName)); $thumb = file_exists($this->newThumbRelPath . $thumb_name) ? $videoOrganizer->insertFile($thumb_name) : NULL; //$thumb = (!is_null($thumb)) ? $videoOrganizer->insertFile($thumbnail_name) : NULL; $video = $videoOrganizer->insertFile($entryName); $arr = array('title' => $entryName, 'mp4' => $video['insert_id'], 'images_id' => is_null($thumb) ? $thumb : $thumb['insert_id']); //krumo(array($this->newVideoRelPath.$entryName, $this->videoRelPath.$entryName)); //krumo(array($this->newThumbRelPath.$thumbnail_name, $this->thumbRelPath.$thumbnail_name)); rename($this->newVideoRelPath . $entryName, $this->videoRelPath . $entryName); if (!is_null($thumb)) { rename($this->newThumbRelPath . $thumb_name, $this->thumbRelPath . $thumb_name); } $chk = $videoOrganizer->toServerFromUpload($arr); krumo($chk); } } return $chk; }
<?php include 'top_base.php'; //------------------------------------------------------------------------ $chk = array('bool' => true); //------------------------------------------------------------------------ if (!isset($_GET['v']) && !isset($_GET['l'])) { $chk['bool'] = false; } else { if (isset($_GET['l'])) { $obj = new VideoOrganizer(); $chk = $obj->getPlaylistVideos(array('hash' => $_GET['l'])); } else { if (isset($_GET['v'])) { $obj = new VideoOrganizer(); $chk = $obj->getLinks(array("my_id" => $_GET['v'], "videoNotExist" => true)); } } } //------------------------------------------------------------------------ //if (!$chk['bool']) header("Location: http://".Constants::PREFFIX.'Modules/current/videoOrganizer_v0/'); ?> <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>videoOrganizer_v0</title> <!--===============================================================--> <?php include "base.php"; ?>