diff --git a/objects/configuration.php b/objects/configuration.php index d29c88c2b..1635d6715 100644 --- a/objects/configuration.php +++ b/objects/configuration.php @@ -1,430 +1,441 @@ load(); if (!empty($video_resolution)) { $this->video_resolution = $video_resolution; } } function load() { global $global; $sql = "SELECT * FROM configurations WHERE id = 1 LIMIT 1"; //echo $sql;exit; // add true because I was not getting the SMTP configuration on function setSiteSendMessage(&$mail) $res = sqlDAL::readSql($sql, "", array(), true); $result = sqlDAL::fetchAssoc($res); sqlDAL::close($res); if ($res && !empty($result)) { $config = $result; //var_dump($config);exit; foreach ($config as $key => $value) { $this->$key = $value; } } else { return false; } } function save() { global $global; if (!User::isAdmin()) { header('Content-Type: application/json'); die('{"error":"' . __("Permission denied") . '"}'); } $this->users_id = User::getId(); $sql = "UPDATE configurations SET " . "video_resolution = '{$this->video_resolution}'," . "webSiteTitle = '{$this->webSiteTitle}'," . "language = '{$this->language}'," . "contactEmail = '{$this->contactEmail}'," . "users_id = '{$this->users_id}', " . "authCanUploadVideos = '{$this->authCanUploadVideos}'," . "authCanViewChart = '{$this->authCanViewChart}'," . "authCanComment = '{$this->authCanComment}'," . "encoderURL = '{$global['mysqli']->real_escape_string($this->_getEncoderURL())}'," . "head = '{$global['mysqli']->real_escape_string($this->getHead())}'," . "adsense = '{$global['mysqli']->real_escape_string($this->getAdsense())}'," . "mode = '{$this->getMode()}'," . "logo = '{$global['mysqli']->real_escape_string($this->getLogo())}'," . "logo_small = '{$global['mysqli']->real_escape_string($this->getLogo_small())}'," . "disable_analytics = '{$this->getDisable_analytics()}'," . "disable_youtubeupload = '{$this->getDisable_youtubeupload()}'," . "allow_download = '{$this->getAllow_download()}'," . "session_timeout = '{$this->getSession_timeout()}'," . "autoplay = '{$this->getAutoplay()}'," . "theme = '{$global['mysqli']->real_escape_string($this->getTheme())}'," . "smtp = '{$this->getSmtp()}'," . "smtpAuth = '{$this->getSmtpAuth()}'," . "smtpSecure = '{$global['mysqli']->real_escape_string($this->getSmtpSecure())}'," . "smtpHost = '{$global['mysqli']->real_escape_string($this->getSmtpHost())}'," . "smtpUsername = '{$global['mysqli']->real_escape_string($this->getSmtpUsername())}'," . "smtpPort = '{$global['mysqli']->real_escape_string($this->getSmtpPort())}'," . "smtpPassword = '{$global['mysqli']->real_escape_string($this->getSmtpPassword())}'" . " WHERE id = 1"; return sqlDAL::writeSql($sql); } function getVideo_resolution() { return $this->video_resolution; } function getUsers_id() { return $this->users_id; } function getVersion() { if (empty($this->version)) { return " 0.1"; } return $this->version; } function getWebSiteTitle() { return $this->webSiteTitle; } function getLanguage() { if ($this->language == "en") { return "us"; } return $this->language; } function getContactEmail() { return $this->contactEmail; } function setVideo_resolution($video_resolution) { $this->video_resolution = $video_resolution; } function setWebSiteTitle($webSiteTitle) { $this->webSiteTitle = $webSiteTitle; } function setLanguage($language) { $this->language = $language; } function setContactEmail($contactEmail) { $this->contactEmail = $contactEmail; } function currentVersionLowerThen($version) { return version_compare($version, $this->getVersion()) > 0; } function currentVersionGreaterThen($version) { return version_compare($version, $this->getVersion()) < 0; } function currentVersionEqual($version) { return version_compare($version, $this->getVersion()) == 0; } function getAuthCanUploadVideos() { return $this->authCanUploadVideos; } function getAuthCanViewChart() { return $this->authCanViewChart; } function getAuthCanComment() { return $this->authCanComment; } function setAuthCanUploadVideos($authCanUploadVideos) { $this->authCanUploadVideos = $authCanUploadVideos; } function setAuthCanViewChart($authCanViewChart) { $this->authCanViewChart = $authCanViewChart; } function setAuthCanComment($authCanComment) { $this->authCanComment = $authCanComment; } function getHead() { return $this->head; } function getLogo($timestamp=false) { global $global; if (empty($this->logo)) { return "view/img/logo.png"; } $get = ""; $file = str_replace("?", "", $global['systemRootPath'].$this->logo); if($timestamp && file_exists($file)){ $get .= "?".filemtime($file); } return $this->logo.$get; } + function getFavicon() { + global $global; + $file = $global['systemRootPath']."videos/favicon.png"; + $url = "{$global['webSiteRootURL']}videos/favicon.png"; + if (!file_exists($file)) { + $file = $global['systemRootPath']."view/img/favicon.png"; + $url = "{$global['webSiteRootURL']}view/img/favicon.png"; + } + return $url."?". filectime($file); + } + function setHead($head) { $this->head = $head; } function setLogo($logo) { $this->logo = $logo; } function getLogo_small() { if (empty($this->logo_small)) { return "view/img/logo32.png"; } return $this->logo_small; } function setLogo_small($logo_small) { $this->logo_small = $logo_small; } function getAdsense() { return $this->adsense; } function setAdsense($adsense) { $this->adsense = $adsense; } function getMode() { if (empty($this->mode)) { return 'Youtube'; } return $this->mode; } function setMode($mode) { $this->mode = $mode; } // version 2.7 function getDisable_analytics() { return $this->disable_analytics; } function getDisable_youtubeupload() { return $this->disable_youtubeupload; } function getAllow_download() { return $this->allow_download; } function getSession_timeout() { return $this->session_timeout; } function setDisable_analytics($disable_analytics) { $this->disable_analytics = ($disable_analytics == 'true' || $disable_analytics == '1') ? 1 : 0; } function setDisable_youtubeupload($disable_youtubeupload) { $this->disable_youtubeupload = ($disable_youtubeupload == 'true' || $disable_youtubeupload == '1') ? 1 : 0; } function setAllow_download($allow_download) { $this->allow_download = ($allow_download == 'true' || $allow_download == '1') ? 1 : 0; } function setSession_timeout($session_timeout) { $this->session_timeout = $session_timeout; } function getAutoplay() { return intval($this->autoplay); } function setAutoplay($autoplay) { $this->autoplay = ($autoplay == 'true' || $autoplay == '1') ? 1 : 0; } // end version 2.7 static function rewriteConfigFile() { global $global, $mysqlHost, $mysqlUser, $mysqlPass, $mysqlDatabase; if(empty($global['salt'])){ $global['salt'] = uniqid(); } $content = "theme)) { return "default"; } return $this->theme; } function setTheme($theme) { $this->theme = $theme; } function getSmtp() { return intval($this->smtp); } function getSmtpAuth() { return intval($this->smtpAuth); } function getSmtpSecure() { return $this->smtpSecure; } function getSmtpHost() { return $this->smtpHost; } function getSmtpUsername() { return $this->smtpUsername; } function getSmtpPassword() { return $this->smtpPassword; } function setSmtp($smtp) { $this->smtp = ($smtp == 'true' || $smtp == '1') ? 1 : 0; } function setSmtpAuth($smtpAuth) { $this->smtpAuth = ($smtpAuth == 'true' || $smtpAuth == '1') ? 1 : 0; } function setSmtpSecure($smtpSecure) { $this->smtpSecure = $smtpSecure; } function setSmtpHost($smtpHost) { $this->smtpHost = $smtpHost; } function setSmtpUsername($smtpUsername) { $this->smtpUsername = $smtpUsername; } function setSmtpPassword($smtpPassword) { $this->smtpPassword = $smtpPassword; } function getSmtpPort() { return intval($this->smtpPort); } function setSmtpPort($smtpPort) { $this->smtpPort = intval($smtpPort); } function _getEncoderURL() { return $this->encoderURL; } function getEncoderURL() { global $advancedCustom; if(!empty($advancedCustom->useEncoderNetworkRecomendation) && !empty($advancedCustom->encoderNetwork)){ if (substr($advancedCustom->encoderNetwork, -1) !== '/') { $advancedCustom->encoderNetwork .= "/"; } $bestEncoder = json_decode(url_get_contents($advancedCustom->encoderNetwork."view/getBestEncoder.php")); if(!empty($bestEncoder->siteURL)){ $this->encoderURL = $bestEncoder->siteURL; } } if (empty($this->encoderURL)) { return "https://encoder.youphptube.com/"; } if (substr($this->encoderURL, -1) !== '/') { $this->encoderURL .= "/"; } return $this->encoderURL; } function setEncoderURL($encoderURL) { $this->encoderURL = $encoderURL; } } diff --git a/objects/configurationUpdate.json.php b/objects/configurationUpdate.json.php index bcd4b77dd..01f02be29 100644 --- a/objects/configurationUpdate.json.php +++ b/objects/configurationUpdate.json.php @@ -1,80 +1,99 @@ setContactEmail($_POST['contactEmail']); $config->setLanguage($_POST['language']); $config->setWebSiteTitle($_POST['webSiteTitle']); $config->setAuthCanComment($_POST['authCanComment']); $config->setAuthCanUploadVideos($_POST['authCanUploadVideos']); $config->setAuthCanViewChart($_POST['authCanViewChart']); if (empty($global['disableAdvancedConfigurations'])) { $config->setDisable_analytics($_POST['disable_analytics']); $config->setDisable_youtubeupload($_POST['disable_youtubeupload']); $config->setAllow_download($_POST['allow_download']); $config->setSession_timeout($_POST['session_timeout']); $config->setEncoderURL($_POST['encoder_url']); $config->setSmtp($_POST['smtp']); $config->setSmtpAuth($_POST['smtpAuth']); $config->setSmtpSecure($_POST['smtpSecure']); $config->setSmtpHost($_POST['smtpHost']); $config->setSmtpUsername($_POST['smtpUsername']); $config->setSmtpPassword($_POST['smtpPassword']); $config->setSmtpPort($_POST['smtpPort']); } $config->setHead($_POST['head']); $config->setAdsense($_POST['adsense']); $config->setMode('Youtube'); $config->setAutoplay($_POST['autoplay']); $config->setTheme($_POST['theme']); $imagePath = "videos/userPhoto/"; //Check write Access to Directory if (!file_exists($global['systemRootPath'] . $imagePath)) { mkdir($global['systemRootPath'] . $imagePath, 0755, true); } if (!is_writable($global['systemRootPath'] . $imagePath)) { $response = Array( "status" => 'error', "message" => 'No write Access' ); print json_encode($response); return; } $response = array(); if (!empty($_POST['logoImgBase64'])) { $fileData = base64DataToImage($_POST['logoImgBase64']); $fileName = 'logo.png'; $photoURL = $imagePath . $fileName; $bytes = file_put_contents($global['systemRootPath'] . $photoURL, $fileData); if ($bytes > 10) { $response = array( "status" => 'success', "url" => $global['systemRootPath'] . $photoURL ); $config->setLogo($photoURL); } else { $response = array( "status" => 'error', "msg" => 'We could not save logo', "url" => $global['systemRootPath'] . $photoURL ); } } +if (!empty($_POST['faviconBase64'])) { + $imagePath = "videos/"; + $fileData = base64DataToImage($_POST['faviconBase64']); + $fileName = 'favicon.png'; + $photoURL = $imagePath . $fileName; + $bytes = file_put_contents($global['systemRootPath'] . $photoURL, $fileData); + if ($bytes > 10) { + $response2 = array( + "status" => 'success', + "url" => $global['systemRootPath'] . $photoURL + ); + } else { + $response2 = array( + "status" => 'error', + "msg" => 'We could not save favicon', + "url" => $global['systemRootPath'] . $photoURL + ); + } +} -echo '{"status":"' . $config->save() . '", "respnseLogo": ' . json_encode($response) . '}'; +echo '{"status":"' . $config->save() . '", "respnseLogo": ' . json_encode($response) . ', "respnseFavicon": ' . json_encode($response2) . '}'; diff --git a/view/configurations_body.php b/view/configurations_body.php index f64473dd3..b55169586 100644 --- a/view/configurations_body.php +++ b/view/configurations_body.php @@ -1,752 +1,808 @@

getTheme(); if ($fileEx == $savedTheme) { ?>
" class="img-responsive img-radio">
$secondsTotal) { $percent = intval($secondsTotal / $secondsLimit * 100); } else { $percent = 100; } ?> and you have minutes of storage
% of your storage limit used
is Present
Your server is , you must install Apache
PHP is Present
Your PHP version is , you must install PHP 5.6.x or greater
Your videos directory is writable
Your videos directory must be writable
The video directory does not exists, YouPHPTube had no permition to create it, you must create it manualy!
sudo mkdir 

Then you can set the permissions.
sudo chmod -R 777 
Your post_max_size is
Your post_max_size is , it must be at least 100M
Edit the php.ini file
sudo nano 
Your upload_max_filesize is
Your upload_max_filesize is , it must be at least 100M
Edit the php.ini file
sudo nano 
- +
+
+ +
+
+ +
+ +
" class="form-control" type="text" value="getWebSiteTitle(); ?>" >
" class="form-control" type="text" value="getLanguage(); ?>" >
locale
" class="form-control" type="email" value="getContactEmail(); ?>" >
getAutoplay())) { echo "checked"; } ?> >
the sitemap file must be writable sudo chmod 777

: https://encoder.youphptube.com/ or
getDisable_analytics())) { echo "checked"; } ?> aria-describedby="disable_analyticsHelp">
getDisable_youtubeupload())) { echo "checked"; } ?> >
getAllow_download())) { echo "checked"; } ?> aria-describedby="allow_downloadHelp">

Email Configuration

If you are not sure how to configure your email, please try this help - +
getSmtp())) { echo "checked"; } ?> >
getSmtpAuth())) { echo "checked"; } ?> >

For Google Analytics code: https://analytics.google.com
Leave blank for native code
Google AD Sense and any other Ads provider are moved to the plugins'>ADs plugin
\ No newline at end of file diff --git a/view/img/favicon.png b/view/img/favicon.png index 112c03370..593d3ea28 100644 Binary files a/view/img/favicon.png and b/view/img/favicon.png differ diff --git a/view/include/head.php b/view/include/head.php index d6e620879..8da3f3533 100644 --- a/view/include/head.php +++ b/view/include/head.php @@ -1,114 +1,114 @@ getDescription(); } $theme = $config->getTheme(); ?> - + getDisable_analytics()) { ?> getHead(); echo $head; if (!empty($video['users_id'])) { if (!empty($video)) { $userAnalytics = new User($video['users_id']); echo $userAnalytics->getAnalytics(); unset($userAnalytics); } } ?> diff --git a/view/videoEmbeded.php b/view/videoEmbeded.php index f1a289855..df5e078ea 100644 --- a/view/videoEmbeded.php +++ b/view/videoEmbeded.php @@ -1,425 +1,425 @@ login(false, true); } if (!empty($_GET['v'])) { $video = Video::getVideo($_GET['v'], "viewable", false, false, false, true); } else if (!empty($_GET['videoName'])) { $video = Video::getVideoFromCleanTitle($_GET['videoName']); } Video::unsetAddView($video['id']); if (empty($video)) { die("Video not found"); } YouPHPTubePlugin::getModeYouTube($video['id']); $customizedAdvanced = YouPHPTubePlugin::getObjectDataIfEnabled('CustomizeAdvanced'); $objSecure = YouPHPTubePlugin::loadPluginIfEnabled('SecureVideosDirectory'); if (!empty($objSecure)) { $objSecure->verifyEmbedSecurity(); } $imgw = 1280; $imgh = 720; if ($video['type'] !== "pdf") { $source = Video::getSourceFile($video['filename']); $img = $source['url']; $data = getimgsize($source['path']); $imgw = $data[0]; $imgh = $data[1]; } else if (($video['type'] !== "audio") && ($video['type'] !== "linkAudio")) { $source = Video::getSourceFile($video['filename']); $img = $source['url']; $data = getimgsize($source['path']); $imgw = $data[0]; $imgh = $data[1]; } else { $img = "{$global['webSiteRootURL']}view/img/audio_wave.jpg"; } $images = Video::getImageFromFilename($video['filename']); $poster = $images->poster; if (!empty($images->posterPortrait)) { $img = $images->posterPortrait; $data = getimgsize($source['path']); $imgw = $data[0]; $imgh = $data[1]; } require_once $global['systemRootPath'] . 'plugin/YouPHPTubePlugin.php'; /* * Swap aspect ratio for rotated (vvs) videos if ($video['rotation'] === "90" || $video['rotation'] === "270") { $embedResponsiveClass = "embed-responsive-9by16"; $vjsClass = "vjs-9-16"; } else { $embedResponsiveClass = "embed-responsive-16by9"; $vjsClass = "vjs-16-9"; } */ $vjsClass = ""; $obj = new Video("", "", $video['id']); $resp = $obj->addView(); if (($video['type'] !== "audio") && ($video['type'] !== "linkAudio")) { $poster = "{$global['webSiteRootURL']}videos/{$video['filename']}.jpg"; } else { $poster = "{$global['webSiteRootURL']}view/img/audio_wave.jpg"; } //https://.../vEmbed/527?modestbranding=1&showinfo=0&autoplay=1&controls=0&loop=1&mute=1&t=0 $modestbranding = false; $autoplay = false; $controls = "controls"; $loop = ""; $mute = ""; $objectFit = ""; $t = 0; if (isset($_GET['modestbranding']) && $_GET['modestbranding'] == "1") { $modestbranding = true; } if (!empty($_GET['autoplay']) || $config->getAutoplay()) { $autoplay = true; } if (isset($_GET['controls']) && $_GET['controls'] == "0") { $controls = ""; } if (!empty($_GET['loop'])) { $loop = "loop"; } if (!empty($_GET['mute'])) { $mute = 'muted="muted"'; } if (!empty($_GET['objectFit'])) { $objectFit = 'object-fit: ' . $_GET['objectFit']; } if (!empty($_GET['t'])) { $t = intval($_GET['t']); } else if (!empty($video['progress']['lastVideoTime'])) { $t = intval($video['progress']['lastVideoTime']); } else if (!empty($video['externalOptions']->videoStartSeconds)) { $t = parseDurationToSeconds($video['externalOptions']->videoStartSeconds); }$sources = getVideosURLPDF($video['filename']); ?> - + <?php echo $config->getWebSiteTitle(); ?> :: <?php echo $video['title']; ?> " /> - getWebSiteTitle(); ?>" /> " />