1
0
Fork 0
mirror of https://github.com/DanielnetoDotCom/YouPHPTube synced 2025-10-03 17:59:55 +02:00
Improves PHP code style normalisation to reduce inconsistency, refactors
and simplifies some PHP code, slightly beautifies some CSS code.
This commit is contained in:
Caleb Mazalevskis 2017-09-16 16:40:55 +08:00
parent a6ad438fc5
commit 40ecbd28d4
93 changed files with 986 additions and 1056 deletions

View file

@ -1,5 +1,5 @@
<?php <?php
if(empty($config)){ if (empty($config)) {
return true; return true;
} }
if (empty($_SESSION['language'])) { if (empty($_SESSION['language'])) {
@ -39,7 +39,7 @@ function getEnabledLangs() {
global $global; global $global;
$dir = "{$global['systemRootPath']}locale"; $dir = "{$global['systemRootPath']}locale";
$flags = array(); $flags = array();
if(empty($global['dont_show_us_flag'])){ if (empty($global['dont_show_us_flag'])) {
$flags[] = 'us'; $flags[] = 'us';
} }
if ($handle = opendir($dir)) { if ($handle = opendir($dir)) {
@ -56,5 +56,7 @@ function getEnabledLangs() {
function textToLink($string) { function textToLink($string) {
return preg_replace( return preg_replace(
"~[[:alpha:]]+://[^<>[:space:]'\"]+[[:alnum:]/]~", "<a href=\"\\0\">\\0</a>", $string); "~[[:alpha:]]+://[^<>[:space:]'\"]+[[:alnum:]/]~", "<a href=\"\\0\">\\0</a>",
$string
);
} }

View file

@ -1,5 +1,4 @@
<?php <?php
abstract class Object{ abstract class Object{
abstract static protected function getTableName(); abstract static protected function getTableName();
@ -16,7 +15,6 @@ abstract class Object{
return true; return true;
} }
function __construct($id) { function __construct($id) {
if (!empty($id)) { if (!empty($id)) {
// get data from id // get data from id
@ -55,7 +53,6 @@ abstract class Object{
return $rows; return $rows;
} }
static function getTotal() { static function getTotal() {
//will receive //will receive
//current=1&rowCount=10&sort[sender]=asc&searchPhrase= //current=1&rowCount=10&sort[sender]=asc&searchPhrase=
@ -74,20 +71,20 @@ abstract class Object{
static function getSqlFromPost() { static function getSqlFromPost() {
$sql = self::getSqlSearchFromPost(); $sql = self::getSqlSearchFromPost();
if(!empty($_POST['sort'])){ if (!empty($_POST['sort'])) {
$orderBy = array(); $orderBy = array();
foreach ($_POST['sort'] as $key => $value) { foreach ($_POST['sort'] as $key => $value) {
$orderBy[] = " {$key} {$value} "; $orderBy[] = " {$key} {$value} ";
} }
$sql .= " ORDER BY ".implode(",", $orderBy); $sql .= " ORDER BY ".implode(",", $orderBy);
}else{ } else {
//$sql .= " ORDER BY CREATED DESC "; //$sql .= " ORDER BY CREATED DESC ";
} }
if(!empty($_POST['rowCount']) && !empty($_POST['current']) && $_POST['rowCount']>0){ if (!empty($_POST['rowCount']) && !empty($_POST['current']) && $_POST['rowCount']>0) {
$current = ($_POST['current']-1)*$_POST['rowCount']; $current = ($_POST['current']-1)*$_POST['rowCount'];
$sql .= " LIMIT $current, {$_POST['rowCount']} "; $sql .= " LIMIT $current, {$_POST['rowCount']} ";
}else{ } else {
$_POST['current'] = 0; $_POST['current'] = 0;
$_POST['rowCount'] = 0; $_POST['rowCount'] = 0;
$sql .= " LIMIT 12 "; $sql .= " LIMIT 12 ";
@ -97,10 +94,10 @@ abstract class Object{
static function getSqlSearchFromPost() { static function getSqlSearchFromPost() {
$sql = ""; $sql = "";
if(!empty($_POST['searchPhrase'])){ if (!empty($_POST['searchPhrase'])) {
$_GET['q'] = $_POST['searchPhrase']; $_GET['q'] = $_POST['searchPhrase'];
} }
if(!empty($_GET['q'])){ if (!empty($_GET['q'])) {
global $global; global $global;
$search = $global['mysqli']->real_escape_string($_GET['q']); $search = $global['mysqli']->real_escape_string($_GET['q']);
@ -119,18 +116,18 @@ abstract class Object{
return $sql; return $sql;
} }
function save(){ function save() {
global $global; global $global;
$fieldsName = $this->getAllFields(); $fieldsName = $this->getAllFields();
if (!empty($this->id)) { if (!empty($this->id)) {
$sql = "UPDATE ".static::getTableName()." SET "; $sql = "UPDATE ".static::getTableName()." SET ";
$fields = array(); $fields = array();
foreach ($fieldsName as $value) { foreach ($fieldsName as $value) {
if(strtolower($value) == 'created' ){ if (strtolower($value) == 'created') {
// do nothing // do nothing
}else if(strtolower($value) == 'modified' ){ } elseif (strtolower($value) == 'modified') {
$fields[] = " {$value} = now() "; $fields[] = " {$value} = now() ";
}else { } else {
$fields[] = " {$value} = '{$this->$value}' "; $fields[] = " {$value} = '{$this->$value}' ";
} }
} }
@ -141,11 +138,11 @@ abstract class Object{
$sql .= implode(",", $fieldsName). " )"; $sql .= implode(",", $fieldsName). " )";
$fields = array(); $fields = array();
foreach ($fieldsName as $value) { foreach ($fieldsName as $value) {
if(strtolower($value) == 'created' || strtolower($value) == 'modified' ){ if (strtolower($value) == 'created' || strtolower($value) == 'modified') {
$fields[] = " now() "; $fields[] = " now() ";
}else if(!isset($this->$value)){ } elseif (!isset($this->$value)) {
$fields[] = " NULL "; $fields[] = " NULL ";
}else{ } else {
$fields[] = " '{$this->$value}' "; $fields[] = " '{$this->$value}' ";
} }
} }
@ -166,7 +163,7 @@ abstract class Object{
} }
} }
private function getAllFields(){ private function getAllFields() {
global $global, $mysqlDatabase; global $global, $mysqlDatabase;
$sql = "SELECT COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_SCHEMA = '{$mysqlDatabase}' AND TABLE_NAME = '".static::getTableName()."'"; $sql = "SELECT COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_SCHEMA = '{$mysqlDatabase}' AND TABLE_NAME = '".static::getTableName()."'";
@ -182,4 +179,3 @@ abstract class Object{
return $rows; return $rows;
} }
} }

View file

@ -1,17 +1,16 @@
<?php <?php
class BootGrid { class BootGrid {
static function getSqlFromPost($searchFieldsNames = array(), $keyPrefix = "") { static function getSqlFromPost($searchFieldsNames = array(), $keyPrefix = "") {
$sql = self::getSqlSearchFromPost($searchFieldsNames); $sql = self::getSqlSearchFromPost($searchFieldsNames);
if(!empty($_POST['sort'])){ if (!empty($_POST['sort'])) {
$orderBy = array(); $orderBy = array();
foreach ($_POST['sort'] as $key => $value) { foreach ($_POST['sort'] as $key => $value) {
$orderBy[] = " {$keyPrefix}{$key} {$value} "; $orderBy[] = " {$keyPrefix}{$key} {$value} ";
} }
$sql .= " ORDER BY ".implode(",", $orderBy); $sql .= " ORDER BY ".implode(",", $orderBy);
}else{ } else {
//$sql .= " ORDER BY CREATED DESC "; //$sql .= " ORDER BY CREATED DESC ";
} }
@ -45,6 +44,4 @@ class BootGrid {
return $sql; return $sql;
} }
} }

View file

@ -1,9 +1,8 @@
<?php <?php
if (empty($global['systemRootPath'])) {
if(empty($global['systemRootPath'])){ $global['systemRootPath'] = '../';
$global['systemRootPath'] = "../";
} }
require_once $global['systemRootPath'].'videos/configuration.php'; require_once $global['systemRootPath'] . 'videos/configuration.php';
class Captcha{ class Captcha{
private $largura, $altura, $tamanho_fonte, $quantidade_letras; private $largura, $altura, $tamanho_fonte, $quantidade_letras;
@ -18,36 +17,40 @@ class Captcha{
} }
public function getCaptchaImage(){ public function getCaptchaImage() {
global $global; global $global;
header("Content-type: image/jpeg"); header('Content-type: image/jpeg');
$imagem = imagecreate($this->largura,$this->altura); // define a largura e a altura da imagem $imagem = imagecreate($this->largura,$this->altura); // define a largura e a altura da imagem
$fonte = $global['systemRootPath'] . "objects/monof55.ttf"; //voce deve ter essa ou outra fonte de sua preferencia em sua pasta $fonte = $global['systemRootPath'] . 'objects/monof55.ttf'; //voce deve ter essa ou outra fonte de sua preferencia em sua pasta
$preto = imagecolorallocate($imagem,0,0,0); // define a cor preta $preto = imagecolorallocate($imagem, 0, 0, 0); // define a cor preta
$branco = imagecolorallocate($imagem,255,255,255); // define a cor branca $branco = imagecolorallocate($imagem, 255, 255, 255); // define a cor branca
// define a palavra conforme a quantidade de letras definidas no parametro $quantidade_letras // define a palavra conforme a quantidade de letras definidas no parametro $quantidade_letras
//$letters = "AaBbCcDdEeFfGgHhIiJjKkLlMmNnPpQqRrSsTtUuVvYyXxWwZz23456789"; //$letters = 'AaBbCcDdEeFfGgHhIiJjKkLlMmNnPpQqRrSsTtUuVvYyXxWwZz23456789';
$letters = "AaBbCcDdEeFfGgHhIiJjKkLlMmNnPpQqRrSsTtUuVvYyXxWwZz23456789"; $letters = 'AaBbCcDdEeFfGgHhIiJjKkLlMmNnPpQqRrSsTtUuVvYyXxWwZz23456789';
$palavra = substr(str_shuffle($letters),0,($this->quantidade_letras)); $palavra = substr(str_shuffle($letters), 0, ($this->quantidade_letras));
$_SESSION["palavra"] = $palavra; // atribui para a sessao a palavra gerada $_SESSION["palavra"] = $palavra; // atribui para a sessao a palavra gerada
for($i = 1; $i <= $this->quantidade_letras; $i++){ for ($i = 1; $i <= $this->quantidade_letras; $i++) {
imagettftext($imagem,$this->tamanho_fonte,rand(-10,10),($this->tamanho_fonte*$i),($this->tamanho_fonte + 10),$branco,$fonte,substr($palavra,($i-1),1)); // atribui as letras a imagem imagettftext(
$imagem,
$this->tamanho_fonte,
rand(-10, 10),
($this->tamanho_fonte*$i),
($this->tamanho_fonte + 10),
$branco,
$fonte,
substr($palavra, ($i - 1), 1)
); // atribui as letras a imagem
} }
imagejpeg($imagem); // gera a imagem imagejpeg($imagem); // gera a imagem
imagedestroy($imagem); // limpa a imagem da memoria imagedestroy($imagem); // limpa a imagem da memoria
} }
static public function validation($word){ static public function validation($word) {
if (session_status() == PHP_SESSION_NONE) { if (session_status() == PHP_SESSION_NONE) {
session_start(); session_start();
} }
if (strcasecmp($word, $_SESSION["palavra"])==0){ return (strcasecmp($word, $_SESSION["palavra"]) == 0);
return true;
}else{
return false;
}
} }
} }

View file

@ -1,5 +1,4 @@
<?php <?php
require_once 'category.php'; require_once 'category.php';
header('Content-Type: application/json'); header('Content-Type: application/json');
$categories = Category::getAllCategories(); $categories = Category::getAllCategories();

View file

@ -1,7 +1,6 @@
<?php <?php
if (empty($global['systemRootPath'])) { if (empty($global['systemRootPath'])) {
$global['systemRootPath'] = "../"; $global['systemRootPath'] = '../';
} }
require_once $global['systemRootPath'] . 'videos/configuration.php'; require_once $global['systemRootPath'] . 'videos/configuration.php';
require_once $global['systemRootPath'] . 'objects/bootGrid.php'; require_once $global['systemRootPath'] . 'objects/bootGrid.php';
@ -23,7 +22,7 @@ class Category {
$this->clean_name = $clean_name; $this->clean_name = $clean_name;
} }
function __construct($id, $name = "") { function __construct($id, $name = '') {
if (empty($id)) { if (empty($id)) {
// get the category data from category and pass // get the category data from category and pass
$this->name = $name; $this->name = $name;
@ -87,12 +86,7 @@ class Category {
$id = intval($id); $id = intval($id);
$sql = "SELECT * FROM categories WHERE id = $id LIMIT 1"; $sql = "SELECT * FROM categories WHERE id = $id LIMIT 1";
$res = $global['mysqli']->query($sql); $res = $global['mysqli']->query($sql);
if ($res) { return ($res) ? $res->fetch_assoc() : false;
$category = $res->fetch_assoc();
} else {
$category = false;
}
return $category;
} }
static function getAllCategories() { static function getAllCategories() {
@ -118,12 +112,10 @@ class Category {
static function getTotalCategories() { static function getTotalCategories() {
global $global; global $global;
$sql = "SELECT id FROM categories WHERE 1=1 "; $sql = "SELECT id FROM categories WHERE 1=1 ";
$sql .= BootGrid::getSqlSearchFromPost(array('name')); $sql .= BootGrid::getSqlSearchFromPost(array('name'));
$res = $global['mysqli']->query($sql); $res = $global['mysqli']->query($sql);
return $res->num_rows; return $res->num_rows;
} }

View file

@ -1,10 +1,9 @@
<?php <?php
header('Content-Type: application/json'); header('Content-Type: application/json');
if(empty($global['systemRootPath'])){ if (empty($global['systemRootPath'])) {
$global['systemRootPath'] = "../"; $global['systemRootPath'] = '../';
} }
require_once $global['systemRootPath'].'videos/configuration.php'; require_once $global['systemRootPath'] . 'videos/configuration.php';
require_once $global['systemRootPath'] . 'objects/user.php'; require_once $global['systemRootPath'] . 'objects/user.php';
if (!User::isAdmin()) { if (!User::isAdmin()) {
die('{"error":"'.__("Permission denied").'"}'); die('{"error":"'.__("Permission denied").'"}');

View file

@ -1,7 +1,7 @@
<?php <?php
header('Content-Type: application/json'); header('Content-Type: application/json');
if(empty($global['systemRootPath'])){ if (empty($global['systemRootPath'])) {
$global['systemRootPath'] = "../"; $global['systemRootPath'] = '../';
} }
require_once $global['systemRootPath'].'videos/configuration.php'; require_once $global['systemRootPath'].'videos/configuration.php';
require_once $global['systemRootPath'] . 'objects/user.php'; require_once $global['systemRootPath'] . 'objects/user.php';

View file

@ -1,30 +1,30 @@
<?php <?php
if(empty($global['systemRootPath'])){ if (empty($global['systemRootPath'])) {
$global['systemRootPath'] = "../"; $global['systemRootPath'] = '../';
} }
require_once $global['systemRootPath'].'videos/configuration.php'; require_once $global['systemRootPath'] . 'videos/configuration.php';
require_once $global['systemRootPath'].'objects/bootGrid.php'; require_once $global['systemRootPath'] . 'objects/bootGrid.php';
require_once $global['systemRootPath'].'objects/user.php'; require_once $global['systemRootPath'] . 'objects/user.php';
class Comment{ class Comment {
private $id; private $id;
private $comment; private $comment;
private $videos_id; private $videos_id;
private $users_id; private $users_id;
function __construct($comment, $videos_id, $id=0) { function __construct($comment, $videos_id, $id = 0) {
if(empty($id)){ if (empty($id)) {
// get the comment data from comment // get the comment data from comment
$this->comment = $comment; $this->comment = $comment;
$this->videos_id = $videos_id; $this->videos_id = $videos_id;
$this->users_id = User::getId(); $this->users_id = User::getId();
}else{ } else {
// get data from id // get data from id
$this->load($id); $this->load($id);
} }
} }
private function load($id){ private function load($id) {
$comment = $this->getComment($id); $comment = $this->getComment($id);
$this->id = $comment['id']; $this->id = $comment['id'];
$this->comment = $comment['comment']; $this->comment = $comment['comment'];
@ -32,7 +32,7 @@ class Comment{
$this->users_id = $comment['user_id']; $this->users_id = $comment['user_id'];
} }
function save(){ function save() {
global $global; global $global;
if(!User::isLogged()){ if(!User::isLogged()){
header('Content-Type: application/json'); header('Content-Type: application/json');
@ -40,9 +40,9 @@ class Comment{
} }
$this->comment = htmlentities($this->comment); $this->comment = htmlentities($this->comment);
$this->comment = $global['mysqli']->real_escape_string($this->comment); $this->comment = $global['mysqli']->real_escape_string($this->comment);
if(!empty($this->id)){ if (!empty($this->id)) {
$sql = "UPDATE comments SET comment = '{$this->comment}', modified = now() WHERE id = {$this->id}"; $sql = "UPDATE comments SET comment = '{$this->comment}', modified = now() WHERE id = {$this->id}";
}else{ } else {
$id = User::getId(); $id = User::getId();
$sql = "INSERT INTO comments ( comment,users_id, videos_id, created, modified) VALUES ('{$this->comment}', {$id}, {$this->videos_id}, now(), now())"; $sql = "INSERT INTO comments ( comment,users_id, videos_id, created, modified) VALUES ('{$this->comment}', {$id}, {$this->videos_id}, now(), now())";
} }
@ -54,19 +54,19 @@ class Comment{
} }
function delete(){ function delete() {
if(!User::isAdmin()){ if(!User::isAdmin()){
return false; return false;
} }
global $global; global $global;
if(!empty($this->id)){ if (!empty($this->id)) {
$sql = "DELETE FROM comments WHERE id = {$this->id}"; $sql = "DELETE FROM comments WHERE id = {$this->id}";
}else{ } else {
return false; return false;
} }
$resp = $global['mysqli']->query($sql); $resp = $global['mysqli']->query($sql);
if(empty($resp)){ if (empty($resp)) {
die('Error : (' . $global['mysqli']->errno . ') ' . $global['mysqli']->error); die('Error : (' . $global['mysqli']->errno . ') ' . $global['mysqli']->error);
} }
return $resp; return $resp;
@ -77,19 +77,14 @@ class Comment{
$id = intval($id); $id = intval($id);
$sql = "SELECT * FROM comments WHERE id = $id LIMIT 1"; $sql = "SELECT * FROM comments WHERE id = $id LIMIT 1";
$res = $global['mysqli']->query($sql); $res = $global['mysqli']->query($sql);
if ($res) { return ($res) ? $res->fetch_assoc() : false;
$comment = $res->fetch_assoc();
} else {
$comment = false;
}
return $comment;
} }
static function getAllComments($videoId=0){ static function getAllComments($videoId = 0) {
global $global; global $global;
$sql = "SELECT c.*, u.name as name, u.user as user FROM comments c LEFT JOIN users as u ON u.id = users_id WHERE 1=1 "; $sql = "SELECT c.*, u.name as name, u.user as user FROM comments c LEFT JOIN users as u ON u.id = users_id WHERE 1=1 ";
if(!empty($videoId)){ if (!empty($videoId)) {
$sql .= " AND videos_id = {$videoId} "; $sql .= " AND videos_id = {$videoId} ";
} }
@ -109,21 +104,18 @@ class Comment{
return $comment; return $comment;
} }
static function getTotalComments($videoId=0){ static function getTotalComments($videoId = 0) {
global $global; global $global;
$sql = "SELECT id FROM comments WHERE 1=1 "; $sql = "SELECT id FROM comments WHERE 1=1 ";
if(!empty($videoId)){ if (!empty($videoId)) {
$sql .= " AND videos_id = {$videoId} "; $sql .= " AND videos_id = {$videoId} ";
} }
$sql .= BootGrid::getSqlSearchFromPost(array('name')); $sql .= BootGrid::getSqlSearchFromPost(array('name'));
$res = $global['mysqli']->query($sql); $res = $global['mysqli']->query($sql);
return $res->num_rows; return $res->num_rows;
} }
} }

View file

@ -1,9 +1,9 @@
<?php <?php
header('Content-Type: application/json'); header('Content-Type: application/json');
if(empty($global['systemRootPath'])){ if (empty($global['systemRootPath'])) {
$global['systemRootPath'] = "../"; $global['systemRootPath'] = '../';
} }
require_once $global['systemRootPath'].'videos/configuration.php'; require_once $global['systemRootPath'] . 'videos/configuration.php';
require_once $global['systemRootPath'] . 'objects/user.php'; require_once $global['systemRootPath'] . 'objects/user.php';
if (!User::canComment()) { if (!User::canComment()) {
die('{"error":"'.__("Permission denied").'"}'); die('{"error":"'.__("Permission denied").'"}');

View file

@ -11,5 +11,4 @@ foreach ($comments as $key => $value) {
$comments[$key]['comment'] = '<div class="pull-left"><img src="'.User::getPhoto($value['users_id']).'" alt="" class="img img-responsive img-circle" style="max-width: 50px;"/></div><div class="commentDetails"><div class="commenterName"><strong>'.$name.'</strong> <small>'.humanTiming(strtotime($value['created'])).'</small></div>'. nl2br(textToLink($value['comment'])).'</div>'; $comments[$key]['comment'] = '<div class="pull-left"><img src="'.User::getPhoto($value['users_id']).'" alt="" class="img img-responsive img-circle" style="max-width: 50px;"/></div><div class="commentDetails"><div class="commenterName"><strong>'.$name.'</strong> <small>'.humanTiming(strtotime($value['created'])).'</small></div>'. nl2br(textToLink($value['comment'])).'</div>';
} }
echo '{ "current": '.$_POST['current'].',"rowCount": '.$_POST['rowCount'].', "total": '.$total.', "rows":'. json_encode($comments).'}'; echo '{ "current": '.$_POST['current'].',"rowCount": '.$_POST['rowCount'].', "total": '.$total.', "rows":'. json_encode($comments).'}';

View file

@ -1,7 +1,6 @@
<?php <?php
if (empty($global['systemRootPath'])) { if (empty($global['systemRootPath'])) {
$global['systemRootPath'] = "../"; $global['systemRootPath'] = '../';
} }
require_once $global['systemRootPath'] . 'videos/configuration.php'; require_once $global['systemRootPath'] . 'videos/configuration.php';
require_once $global['systemRootPath'] . 'objects/user.php'; require_once $global['systemRootPath'] . 'objects/user.php';

View file

@ -2,7 +2,7 @@
header('Content-Type: application/json'); header('Content-Type: application/json');
if (empty($global['systemRootPath'])) { if (empty($global['systemRootPath'])) {
$global['systemRootPath'] = "../"; $global['systemRootPath'] = '../';
} }
require_once $global['systemRootPath'] . 'objects/user.php'; require_once $global['systemRootPath'] . 'objects/user.php';
if (!User::isAdmin()) { if (!User::isAdmin()) {

View file

@ -1,5 +1,4 @@
<?php <?php
// Returns a file size limit in bytes based on the PHP upload_max_filesize // Returns a file size limit in bytes based on the PHP upload_max_filesize
// and post_max_size // and post_max_size
function file_upload_max_size() { function file_upload_max_size() {

View file

@ -1,11 +1,10 @@
<?php <?php
require_once 'captcha.php'; require_once 'captcha.php';
$largura = empty($_GET["l"])?120:$_GET["l"]; // recebe a largura $largura = empty($_GET['l']) ? 120 : $_GET['l']; // recebe a largura
$altura = empty($_GET["a"])?40:$_GET["a"]; // recebe a altura $altura = empty($_GET['a']) ? 40 : $_GET['a']; // recebe a altura
$tamanho_fonte = empty($_GET["tf"])?18:$_GET["tf"]; // recebe o tamanho da fonte $tamanho_fonte = empty($_GET['tf']) ? 18 : $_GET['tf']; // recebe o tamanho da fonte
$quantidade_letras = empty($_GET["ql"])?5:$_GET["ql"]; // recebe a quantidade de letras que o captcha terá $quantidade_letras = empty($_GET['ql']) ? 5 : $_GET['ql']; // recebe a quantidade de letras que o captcha terá
$capcha = new Captcha($largura, $altura, $tamanho_fonte, $quantidade_letras); $capcha = new Captcha($largura, $altura, $tamanho_fonte, $quantidade_letras);
$capcha->getCaptchaImage(); $capcha->getCaptchaImage();
?>

View file

@ -3,7 +3,6 @@ ini_set('error_log', $global['systemRootPath'].'videos/youphptube.log');
global $global; global $global;
global $config; global $config;
$global['mysqli'] = new mysqli($mysqlHost, $mysqlUser,$mysqlPass,$mysqlDatabase,@$mysqlPort); $global['mysqli'] = new mysqli($mysqlHost, $mysqlUser,$mysqlPass,$mysqlDatabase,@$mysqlPort);
$now = new DateTime(); $now = new DateTime();
@ -19,7 +18,7 @@ require_once $global['systemRootPath'] . 'objects/configuration.php';
$config = new Configuration(); $config = new Configuration();
// for update config from old versions // for update config from old versions
if(function_exists("getAllFlags")){ if (function_exists("getAllFlags")) {
Configuration::rewriteConfigFile(); Configuration::rewriteConfigFile();
} }

View file

@ -1,10 +1,10 @@
<?php <?php
if(empty($global['systemRootPath'])){ if (empty($global['systemRootPath'])) {
$global['systemRootPath'] = "../"; $global['systemRootPath'] = '../';
} }
require_once $global['systemRootPath'].'videos/configuration.php'; require_once $global['systemRootPath'].'videos/configuration.php';
require_once $global['systemRootPath'].'objects/user.php'; require_once $global['systemRootPath'].'objects/user.php';
class Like{ class Like {
private $id; private $id;
private $like; private $like;
private $videos_id; private $videos_id;
@ -19,7 +19,7 @@ class Like{
$this->users_id = User::getId(); $this->users_id = User::getId();
$this->load(); $this->load();
// if click again in the same vote, remove the vote // if click again in the same vote, remove the vote
if($this->like == $like){ if ($this->like == $like) {
$like = 0; $like = 0;
} }
$this->setLike($like); $this->setLike($like);
@ -34,10 +34,11 @@ class Like{
$this->like = $like; $this->like = $like;
} }
private function load(){ private function load() {
$like = $this->getLike(); $like = $this->getLike();
if (empty($like)) if (empty($like)) {
return false; return false;
}
foreach ($like as $key => $value) { foreach ($like as $key => $value) {
$this->$key = $value; $this->$key = $value;
} }
@ -45,39 +46,35 @@ class Like{
private function getLike() { private function getLike() {
global $global; global $global;
if(empty($this->users_id) || empty($this->videos_id)){ if (empty($this->users_id) || empty($this->videos_id)) {
header('Content-Type: application/json'); header('Content-Type: application/json');
die('{"error":"You must have user and videos set to get a like"}'); die('{"error":"You must have user and videos set to get a like"}');
} }
$sql = "SELECT * FROM likes WHERE users_id = $this->users_id AND videos_id = $this->videos_id LIMIT 1"; $sql = "SELECT * FROM likes WHERE users_id = $this->users_id AND videos_id = $this->videos_id LIMIT 1";
$res = $global['mysqli']->query($sql); $res = $global['mysqli']->query($sql);
if ($res) { return ($res) ? $res->fetch_assoc() : false;
return $res->fetch_assoc();
} else {
return false;
}
} }
private function save(){ private function save() {
global $global; global $global;
if(!User::isLogged()){ if(!User::isLogged()){
header('Content-Type: application/json'); header('Content-Type: application/json');
die('{"error":"'.__("Permission denied").'"}'); die('{"error":"'.__("Permission denied").'"}');
} }
if(!empty($this->id)){ if (!empty($this->id)) {
$sql = "UPDATE likes SET `like` = '{$this->like}', modified = now() WHERE id = {$this->id}"; $sql = "UPDATE likes SET `like` = '{$this->like}', modified = now() WHERE id = {$this->id}";
}else{ } else {
$sql = "INSERT INTO likes ( `like`,users_id, videos_id, created, modified) VALUES ('{$this->like}', {$this->users_id}, {$this->videos_id}, now(), now())"; $sql = "INSERT INTO likes ( `like`,users_id, videos_id, created, modified) VALUES ('{$this->like}', {$this->users_id}, {$this->videos_id}, now(), now())";
} }
//echo $sql;exit; //echo $sql;exit;
$resp = $global['mysqli']->query($sql); $resp = $global['mysqli']->query($sql);
if(empty($resp)){ if (empty($resp)) {
die('Error : (' . $global['mysqli']->errno . ') ' . $global['mysqli']->error); die('Error : (' . $global['mysqli']->errno . ') ' . $global['mysqli']->error);
} }
return $resp; return $resp;
} }
static function getLikes($videos_id){ static function getLikes($videos_id) {
global $global; global $global;
$obj = new stdClass(); $obj = new stdClass();
@ -88,37 +85,34 @@ class Like{
$sql = "SELECT count(*) as total FROM likes WHERE videos_id = {$videos_id} AND `like` = 1 "; // like $sql = "SELECT count(*) as total FROM likes WHERE videos_id = {$videos_id} AND `like` = 1 "; // like
$res = $global['mysqli']->query($sql); $res = $global['mysqli']->query($sql);
if ($res) { if (!$res) {
$row = $res->fetch_assoc(); die($sql . '\nError : (' . $global['mysqli']->errno . ') ' . $global['mysqli']->error);
$obj->likes = intval($row['total']);
} else {
die($sql.'\nError : (' . $global['mysqli']->errno . ') ' . $global['mysqli']->error);
} }
$row = $res->fetch_assoc();
$obj->likes = intval($row['total']);
$sql = "SELECT count(*) as total FROM likes WHERE videos_id = {$videos_id} AND `like` = -1 "; // dislike $sql = "SELECT count(*) as total FROM likes WHERE videos_id = {$videos_id} AND `like` = -1 "; // dislike
$res = $global['mysqli']->query($sql); $res = $global['mysqli']->query($sql);
if ($res) { if (!$res) {
$row = $res->fetch_assoc();
$obj->dislikes = intval($row['total']);
} else {
die($sql.'\nError : (' . $global['mysqli']->errno . ') ' . $global['mysqli']->error); die($sql.'\nError : (' . $global['mysqli']->errno . ') ' . $global['mysqli']->error);
} }
$row = $res->fetch_assoc();
$obj->dislikes = intval($row['total']);
return $obj; return $obj;
} }
static function getMyVote($videos_id){ static function getMyVote($videos_id) {
global $global; global $global;
if(!User::isLogged()){ if (!User::isLogged()) {
return 0; return 0;
} }
$id = User::getId(); $id = User::getId();
$sql = "SELECT `like` FROM likes WHERE videos_id = {$videos_id} AND users_id = {$id} "; // like $sql = "SELECT `like` FROM likes WHERE videos_id = {$videos_id} AND users_id = {$id} "; // like
$res = $global['mysqli']->query($sql); $res = $global['mysqli']->query($sql);
if($row = $res->fetch_assoc()){ if ($row = $res->fetch_assoc()) {
return intval($row['like']); return intval($row['like']);
}else{
return 0;
} }
return 0;
} }
} }

View file

@ -1,7 +1,7 @@
<?php <?php
header('Content-Type: application/json'); header('Content-Type: application/json');
if (empty($global['systemRootPath'])) { if (empty($global['systemRootPath'])) {
$global['systemRootPath'] = "../"; $global['systemRootPath'] = '../';
} }
require_once $global['systemRootPath'] . 'videos/configuration.php'; require_once $global['systemRootPath'] . 'videos/configuration.php';
require_once $global['systemRootPath'] . 'objects/hybridauth/autoload.php'; require_once $global['systemRootPath'] . 'objects/hybridauth/autoload.php';

View file

@ -1,6 +1,6 @@
<?php <?php
if(empty($global['systemRootPath'])){ if (empty($global['systemRootPath'])) {
$global['systemRootPath'] = "../"; $global['systemRootPath'] = '../';
} }
require_once $global['systemRootPath'].'videos/configuration.php'; require_once $global['systemRootPath'].'videos/configuration.php';
require_once $global['systemRootPath'] . 'objects/user.php'; require_once $global['systemRootPath'] . 'objects/user.php';

View file

@ -1,13 +1,12 @@
<?php <?php
class Main {
class Main{
/** /**
* receive a YYYY-MM-DD * receive a YYYY-MM-DD
* @param type $brDate * @param type $brDate
* @return String dd/mm/yyyy * @return String dd/mm/yyyy
*/ */
static public function dateMySQLToBrString($mySqlDate) { static public function dateMySQLToBrString($mySqlDate) {
$parts = explode("-", $mySqlDate); $parts = explode('-', $mySqlDate);
//switch month and day //switch month and day
if (empty($parts[2])) { if (empty($parts[2])) {
return $mySqlDate; return $mySqlDate;

View file

@ -2,7 +2,7 @@
require_once '../videos/configuration.php'; require_once '../videos/configuration.php';
require_once $global['systemRootPath'] . 'objects/user.php'; require_once $global['systemRootPath'] . 'objects/user.php';
if(!User::canUpload()){ if (!User::canUpload()) {
header("Location: {$global['webSiteRootURL']}?error=" . __("You can not notify")); header("Location: {$global['webSiteRootURL']}?error=" . __("You can not notify"));
exit; exit;
} }
@ -40,5 +40,4 @@ if (!$mail->send()) {
$obj->success = __("Message sent"); $obj->success = __("Message sent");
} }
echo json_encode($obj); echo json_encode($obj);

View file

@ -1,9 +1,9 @@
<?php <?php
header('Content-Type: application/json'); header('Content-Type: application/json');
if(empty($global['systemRootPath'])){ if (empty($global['systemRootPath'])) {
$global['systemRootPath'] = "../"; $global['systemRootPath'] = '../';
} }
require_once $global['systemRootPath'].'videos/configuration.php'; require_once $global['systemRootPath'] . 'videos/configuration.php';
require_once $global['systemRootPath'] . 'objects/user.php'; require_once $global['systemRootPath'] . 'objects/user.php';
require_once $global['systemRootPath'] . 'objects/playlist.php'; require_once $global['systemRootPath'] . 'objects/playlist.php';
if (!User::isLogged()) { if (!User::isLogged()) {

View file

@ -1,7 +1,6 @@
<?php <?php
if (empty($global['systemRootPath'])) { if (empty($global['systemRootPath'])) {
$global['systemRootPath'] = "../"; $global['systemRootPath'] = '../';
} }
require_once $global['systemRootPath'] . 'videos/configuration.php'; require_once $global['systemRootPath'] . 'videos/configuration.php';
require_once $global['systemRootPath'] . 'objects/user.php'; require_once $global['systemRootPath'] . 'objects/user.php';

View file

@ -1,16 +1,16 @@
<?php <?php
header('Content-Type: application/json'); header('Content-Type: application/json');
if(empty($global['systemRootPath'])){ if (empty($global['systemRootPath'])) {
$global['systemRootPath'] = "../"; $global['systemRootPath'] = '../';
} }
require_once $global['systemRootPath'].'videos/configuration.php'; require_once $global['systemRootPath'] . 'videos/configuration.php';
require_once $global['systemRootPath'] . 'objects/user.php'; require_once $global['systemRootPath'] . 'objects/user.php';
require_once $global['systemRootPath'] . 'objects/playlist.php'; require_once $global['systemRootPath'] . 'objects/playlist.php';
if (!User::isLogged()) { if (!User::isLogged()) {
die('{"error":"'.__("Permission denied").'"}'); die('{"error":"'.__("Permission denied").'"}');
} }
if(empty($_POST['name'])){ if (empty($_POST['name'])) {
die('{"error":"'.__("Name can't be blank").'"}'); die('{"error":"'.__("Name can't be blank").'"}');
} }
$obj = new PlayList(@$_POST['id']); $obj = new PlayList(@$_POST['id']);

View file

@ -1,9 +1,9 @@
<?php <?php
header('Content-Type: application/json'); header('Content-Type: application/json');
if(empty($global['systemRootPath'])){ if (empty($global['systemRootPath'])) {
$global['systemRootPath'] = "../"; $global['systemRootPath'] = '../';
} }
require_once $global['systemRootPath'].'videos/configuration.php'; require_once $global['systemRootPath'] . 'videos/configuration.php';
require_once $global['systemRootPath'] . 'objects/user.php'; require_once $global['systemRootPath'] . 'objects/user.php';
require_once $global['systemRootPath'] . 'objects/playlist.php'; require_once $global['systemRootPath'] . 'objects/playlist.php';
if (!User::isLogged()) { if (!User::isLogged()) {

View file

@ -1,9 +1,9 @@
<?php <?php
header('Content-Type: application/json'); header('Content-Type: application/json');
if(empty($global['systemRootPath'])){ if (empty($global['systemRootPath'])) {
$global['systemRootPath'] = "../"; $global['systemRootPath'] = '../';
} }
require_once $global['systemRootPath'].'videos/configuration.php'; require_once $global['systemRootPath'] . 'videos/configuration.php';
require_once $global['systemRootPath'] . 'objects/user.php'; require_once $global['systemRootPath'] . 'objects/user.php';
require_once $global['systemRootPath'] . 'objects/playlist.php'; require_once $global['systemRootPath'] . 'objects/playlist.php';
if (!User::isLogged()) { if (!User::isLogged()) {

View file

@ -1,9 +1,9 @@
<?php <?php
header('Content-Type: application/json'); header('Content-Type: application/json');
if(empty($global['systemRootPath'])){ if (empty($global['systemRootPath'])) {
$global['systemRootPath'] = "../"; $global['systemRootPath'] = '../';
} }
require_once $global['systemRootPath'].'videos/configuration.php'; require_once $global['systemRootPath'] . 'videos/configuration.php';
require_once $global['systemRootPath'] . 'objects/user.php'; require_once $global['systemRootPath'] . 'objects/user.php';
require_once $global['systemRootPath'] . 'objects/playlist.php'; require_once $global['systemRootPath'] . 'objects/playlist.php';
if (!User::isLogged()) { if (!User::isLogged()) {

View file

@ -1,6 +1,6 @@
<?php <?php
if (empty($global['systemRootPath'])) { if (empty($global['systemRootPath'])) {
$global['systemRootPath'] = "../"; $global['systemRootPath'] = '../';
} }
require_once $global['systemRootPath'] . 'videos/configuration.php'; require_once $global['systemRootPath'] . 'videos/configuration.php';
require_once 'functions.php'; require_once 'functions.php';

View file

@ -1,15 +1,14 @@
<?php <?php
require_once 'subscribe.php'; require_once 'subscribe.php';
header('Content-Type: application/json'); header('Content-Type: application/json');
$obj = new stdClass(); $obj = new stdClass();
$obj->error = ""; $obj->error = "";
$obj->subscribe = ""; $obj->subscribe = "";
if(empty($_POST['email'])){ if (empty($_POST['email'])) {
$obj->error = __("Email can not be blank"); $obj->error = __("Email can not be blank");
die(json_encode($obj)); die(json_encode($obj));
} }
if(empty($_POST['user_id'])){ if (empty($_POST['user_id'])) {
$obj->error = __("User can not be blank"); $obj->error = __("User can not be blank");
die(json_encode($obj)); die(json_encode($obj));
} }

View file

@ -1,7 +1,6 @@
<?php <?php
if (empty($global['systemRootPath'])) { if (empty($global['systemRootPath'])) {
$global['systemRootPath'] = "../"; $global['systemRootPath'] = '../';
} }
require_once $global['systemRootPath'] . 'videos/configuration.php'; require_once $global['systemRootPath'] . 'videos/configuration.php';
require_once $global['systemRootPath'] . 'objects/bootGrid.php'; require_once $global['systemRootPath'] . 'objects/bootGrid.php';

View file

@ -1,14 +1,13 @@
<?php <?php
require_once 'subscribe.php'; require_once 'subscribe.php';
if(!User::isLogged()){ if (!User::isLogged()) {
return false; return false;
} }
header('Content-Type: application/json'); header('Content-Type: application/json');
$user_id = User::getId(); $user_id = User::getId();
// if admin bring all subscribers // if admin bring all subscribers
if(User::isAdmin()){ if (User::isAdmin()) {
$user_id = ""; $user_id = "";
} }
$Subscribes = Subscribe::getAllSubscribes($user_id); $Subscribes = Subscribe::getAllSubscribes($user_id);

View file

@ -8,7 +8,7 @@ require_once $global['systemRootPath'] . 'objects/video.php';
$obj = new stdClass(); $obj = new stdClass();
$obj->error = true; $obj->error = true;
if (!User::canUpload()) { if (!User::canUpload()) {
$obj->msg = "Only logged users can file_dataoad"; $obj->msg = 'Only logged users can file_dataoad';
die(json_encode($obj)); die(json_encode($obj));
} }
header('Content-Type: application/json'); header('Content-Type: application/json');

View file

@ -1,7 +1,6 @@
<?php <?php
if (empty($global['systemRootPath'])) { if (empty($global['systemRootPath'])) {
$global['systemRootPath'] = "../"; $global['systemRootPath'] = '../';
} }
require_once $global['systemRootPath'] . 'videos/configuration.php'; require_once $global['systemRootPath'] . 'videos/configuration.php';
require_once $global['systemRootPath'] . 'objects/bootGrid.php'; require_once $global['systemRootPath'] . 'objects/bootGrid.php';
@ -121,11 +120,10 @@ class User {
if (!empty($user)) { if (!empty($user)) {
$photo = $user['photoURL']; $photo = $user['photoURL'];
} }
} else if (self::isLogged()) { } elseif (self::isLogged()) {
$photo = $_SESSION['user']['photoURL']; $photo = $_SESSION['user']['photoURL'];
} }
if(preg_match("/videos\/userPhoto\/.*/", $photo)){ if (preg_match("/videos\/userPhoto\/.*/", $photo)) {
$photo = $global['webSiteRootURL'].$photo; $photo = $global['webSiteRootURL'].$photo;
} }
if (empty($photo)) { if (empty($photo)) {
@ -167,7 +165,7 @@ class User {
} else { } else {
$id = $this->id; $id = $this->id;
} }
if($updateUserGroups){ if ($updateUserGroups) {
require_once './userGroups.php'; require_once './userGroups.php';
// update the user groups // update the user groups
UserGroups::updateUserGroups($id, $this->userGroups); UserGroups::updateUserGroups($id, $this->userGroups);
@ -241,12 +239,12 @@ class User {
$user = $global['mysqli']->real_escape_string($user); $user = $global['mysqli']->real_escape_string($user);
$sql = "SELECT * FROM users WHERE user = '$user' "; $sql = "SELECT * FROM users WHERE user = '$user' ";
if($mustBeactive){ if ($mustBeactive) {
$sql .= " AND status = 'a' "; $sql .= " AND status = 'a' ";
} }
if ($pass !== false) { if ($pass !== false) {
if(!$encodedPass || $encodedPass === 'false'){ if (!$encodedPass || $encodedPass === 'false') {
$pass = md5($pass); $pass = md5($pass);
} }
$sql .= " AND password = '$pass' "; $sql .= " AND password = '$pass' ";
@ -446,7 +444,7 @@ class User {
} }
function setUserGroups($userGroups) { function setUserGroups($userGroups) {
if(is_array($userGroups)){ if (is_array($userGroups)) {
$this->userGroups = $userGroups; $this->userGroups = $userGroups;
} }
} }
@ -468,24 +466,24 @@ class User {
static function getTags($user_id){ static function getTags($user_id){
$user = new User($user_id); $user = new User($user_id);
$tags = array(); $tags = array();
if($user->getIsAdmin()){ if ($user->getIsAdmin()) {
$obj = new stdClass(); $obj = new stdClass();
$obj->type = "info"; $obj->type = "info";
$obj->text = __("Admin"); $obj->text = __("Admin");
$tags[] = $obj; $tags[] = $obj;
}else{ } else {
$obj = new stdClass(); $obj = new stdClass();
$obj->type = "default"; $obj->type = "default";
$obj->text = __("Regular User"); $obj->text = __("Regular User");
$tags[] = $obj; $tags[] = $obj;
} }
if($user->getStatus() == "a"){ if ($user->getStatus() == "a") {
$obj = new stdClass(); $obj = new stdClass();
$obj->type = "success"; $obj->type = "success";
$obj->text = __("Active"); $obj->text = __("Active");
$tags[] = $obj; $tags[] = $obj;
}else{ } else {
$obj = new stdClass(); $obj = new stdClass();
$obj->type = "danger"; $obj->type = "danger";
$obj->text = __("Inactive"); $obj->text = __("Inactive");
@ -506,7 +504,7 @@ class User {
} }
function getBackgroundURL() { function getBackgroundURL() {
if(empty($this->backgroundURL)){ if (empty($this->backgroundURL)) {
$this->backgroundURL = "view/img/background.png"; $this->backgroundURL = "view/img/background.png";
} }
return $this->backgroundURL; return $this->backgroundURL;
@ -516,6 +514,4 @@ class User {
$this->backgroundURL = strip_tags($backgroundURL); $this->backgroundURL = strip_tags($backgroundURL);
} }
} }

View file

@ -1,9 +1,9 @@
<?php <?php
header('Content-Type: application/json'); header('Content-Type: application/json');
if(empty($global['systemRootPath'])){ if (empty($global['systemRootPath'])) {
$global['systemRootPath'] = "../"; $global['systemRootPath'] = '../';
} }
require_once $global['systemRootPath'].'videos/configuration.php'; require_once $global['systemRootPath'] . 'videos/configuration.php';
require_once $global['systemRootPath'] . 'objects/user.php'; require_once $global['systemRootPath'] . 'objects/user.php';
if (!User::isAdmin()) { if (!User::isAdmin()) {
die('{"error":"'.__("Permission denied").'"}'); die('{"error":"'.__("Permission denied").'"}');

View file

@ -1,19 +1,19 @@
<?php <?php
header('Content-Type: application/json'); header('Content-Type: application/json');
if(empty($global['systemRootPath'])){ if (empty($global['systemRootPath'])) {
$global['systemRootPath'] = "../"; $global['systemRootPath'] = '../';
} }
require_once $global['systemRootPath'].'videos/configuration.php'; require_once $global['systemRootPath'] . 'videos/configuration.php';
require_once $global['systemRootPath'] . 'objects/user.php'; require_once $global['systemRootPath'] . 'objects/user.php';
// check if user already exists // check if user already exists
$userCheck = new User(0, $_POST['user'], false); $userCheck = new User(0, $_POST['user'], false);
$obj = new stdClass(); $obj = new stdClass();
if(!empty($userCheck->getBdId())){ if (!empty($userCheck->getBdId())) {
$obj->error = __("User already exists"); $obj->error = __("User already exists");
die(json_encode($obj)); die(json_encode($obj));
} }
if(empty($_POST['user']) || empty($_POST['pass']) || empty($_POST['email']) || empty($_POST['name'])){ if (empty($_POST['user']) || empty($_POST['pass']) || empty($_POST['email']) || empty($_POST['name'])) {
$obj->error = __("You must fill all fields"); $obj->error = __("You must fill all fields");
die(json_encode($obj)); die(json_encode($obj));
} }

View file

@ -1,9 +1,9 @@
<?php <?php
header('Content-Type: application/json'); header('Content-Type: application/json');
if(empty($global['systemRootPath'])){ if (empty($global['systemRootPath'])) {
$global['systemRootPath'] = "../"; $global['systemRootPath'] = '../';
} }
require_once $global['systemRootPath'].'videos/configuration.php'; require_once $global['systemRootPath'] . 'videos/configuration.php';
require_once $global['systemRootPath'] . 'objects/user.php'; require_once $global['systemRootPath'] . 'objects/user.php';
require_once $global['systemRootPath'] . 'objects/userGroups.php'; require_once $global['systemRootPath'] . 'objects/userGroups.php';
if (!User::isAdmin() || empty($_POST['id'])) { if (!User::isAdmin() || empty($_POST['id'])) {

View file

@ -1,5 +1,4 @@
<?php <?php
require_once 'userGroups.php.php'; require_once 'userGroups.php.php';
header('Content-Type: application/json'); header('Content-Type: application/json');
$rows = UserGroups::getAllUsersGroups(); $rows = UserGroups::getAllUsersGroups();

View file

@ -1,7 +1,6 @@
<?php <?php
if (empty($global['systemRootPath'])) { if (empty($global['systemRootPath'])) {
$global['systemRootPath'] = "../"; $global['systemRootPath'] = '../';
} }
require_once $global['systemRootPath'] . 'videos/configuration.php'; require_once $global['systemRootPath'] . 'videos/configuration.php';
require_once $global['systemRootPath'] . 'objects/bootGrid.php'; require_once $global['systemRootPath'] . 'objects/bootGrid.php';
@ -141,7 +140,7 @@ class UserGroups {
if (!User::isAdmin()) { if (!User::isAdmin()) {
return false; return false;
} }
if(!is_array($array_groups_id)){ if (!is_array($array_groups_id)) {
return false; return false;
} }
self::deleteGroupsFromUser($users_id); self::deleteGroupsFromUser($users_id);
@ -157,14 +156,14 @@ class UserGroups {
return true; return true;
} }
static function getUserGroups($users_id){ static function getUserGroups($users_id) {
global $global; global $global;
$result = $global['mysqli']->query("SHOW TABLES LIKE 'users_has_users_groups'"); $result = $global['mysqli']->query("SHOW TABLES LIKE 'users_has_users_groups'");
if (empty($result->num_rows)) { if (empty($result->num_rows)) {
$_GET['error'] = "You need to <a href='{$global['webSiteRootURL']}update'>update your system to ver 2.3</a>"; $_GET['error'] = "You need to <a href='{$global['webSiteRootURL']}update'>update your system to ver 2.3</a>";
return array(); return array();
} }
if(empty($users_id)){ if (empty($users_id)) {
return array(); return array();
} }
$sql = "SELECT * FROM users_has_users_groups" $sql = "SELECT * FROM users_has_users_groups"
@ -206,11 +205,11 @@ class UserGroups {
// for videos // for videos
static function updateVideoGroups($videos_id, $array_groups_id){ static function updateVideoGroups($videos_id, $array_groups_id) {
if (!User::canUpload()) { if (!User::canUpload()) {
return false; return false;
} }
if(!is_array($array_groups_id)){ if (!is_array($array_groups_id)) {
return false; return false;
} }
self::deleteGroupsFromVideo($videos_id); self::deleteGroupsFromVideo($videos_id);
@ -225,15 +224,15 @@ class UserGroups {
return true; return true;
} }
static function getVideoGroups($videos_id){ static function getVideoGroups($videos_id) {
global $global; global $global;
//check if table exists if not you need to update //check if table exists if not you need to update
$res = $global['mysqli']->query('select 1 from `videos_group_view` LIMIT 1'); $res = $global['mysqli']->query('select 1 from `videos_group_view` LIMIT 1');
if(!$res){ if (!$res) {
if(User::isAdmin()){ if (User::isAdmin()) {
$_GET['error'] = "You need to Update YouPHPTube to version 2.3 <a href='{$global['webSiteRootURL']}update/'>Click here</a>"; $_GET['error'] = "You need to Update YouPHPTube to version 2.3 <a href='{$global['webSiteRootURL']}update/'>Click here</a>";
} }
return array(); return array();
} }
$sql = "SELECT * FROM videos_group_view as v " $sql = "SELECT * FROM videos_group_view as v "

View file

@ -1,10 +1,9 @@
<?php <?php
header('Content-Type: application/json'); header('Content-Type: application/json');
if(empty($global['systemRootPath'])){ if (empty($global['systemRootPath'])) {
$global['systemRootPath'] = "../"; $global['systemRootPath'] = '../';
} }
require_once $global['systemRootPath'].'videos/configuration.php'; require_once $global['systemRootPath'] . 'videos/configuration.php';
require_once $global['systemRootPath'] . 'objects/user.php'; require_once $global['systemRootPath'] . 'objects/user.php';
if (!User::isAdmin()) { if (!User::isAdmin()) {
die('{"error":"'.__("Permission denied").'"}'); die('{"error":"'.__("Permission denied").'"}');

View file

@ -1,9 +1,9 @@
<?php <?php
header('Content-Type: application/json'); header('Content-Type: application/json');
if(empty($global['systemRootPath'])){ if (empty($global['systemRootPath'])) {
$global['systemRootPath'] = "../"; $global['systemRootPath'] = '../';
} }
require_once $global['systemRootPath'].'videos/configuration.php'; require_once $global['systemRootPath'] . 'videos/configuration.php';
require_once $global['systemRootPath'] . 'objects/user.php'; require_once $global['systemRootPath'] . 'objects/user.php';
if (!User::isAdmin() || empty($_POST['id'])) { if (!User::isAdmin() || empty($_POST['id'])) {
die('{"error":"'.__("Permission denied").'"}'); die('{"error":"'.__("Permission denied").'"}');

View file

@ -1,6 +1,6 @@
<?php <?php
if (empty($global['systemRootPath'])) { if (empty($global['systemRootPath'])) {
$global['systemRootPath'] = "../"; $global['systemRootPath'] = '../';
} }
require_once $global['systemRootPath'] . 'videos/configuration.php'; require_once $global['systemRootPath'] . 'videos/configuration.php';
require_once $global['systemRootPath'] . 'objects/user.php'; require_once $global['systemRootPath'] . 'objects/user.php';
@ -69,11 +69,11 @@ if (!(!empty($_GET['user']) && !empty($_GET['recoverpass']))) {
<div class="container"> <div class="container">
<?php <?php
if($user->getRecoverPass() != $_GET['recoverpass']){ if ($user->getRecoverPass() != $_GET['recoverpass']) {
?> ?>
<div class="alert alert-danger"><?php echo __("The recover pass does not match!"); ?></div> <div class="alert alert-danger"><?php echo __("The recover pass does not match!"); ?></div>
<?php <?php
}else{ } else {
?> ?>
<form class="well form-horizontal" action=" " method="post" id="recoverPassForm"> <form class="well form-horizontal" action=" " method="post" id="recoverPassForm">
<fieldset> <fieldset>

View file

@ -1,7 +1,7 @@
<?php <?php
header('Content-Type: application/json'); header('Content-Type: application/json');
if (empty($global['systemRootPath'])) { if (empty($global['systemRootPath'])) {
$global['systemRootPath'] = "../"; $global['systemRootPath'] = '../';
} }
require_once $global['systemRootPath'] . 'videos/configuration.php'; require_once $global['systemRootPath'] . 'videos/configuration.php';
require_once $global['systemRootPath'] . 'objects/user.php'; require_once $global['systemRootPath'] . 'objects/user.php';
@ -11,19 +11,19 @@ if (empty($_POST['user']) || empty($_POST['recoverPassword']) || empty($_POST['n
die(json_encode($obj)); die(json_encode($obj));
} }
$user = new User(0, $_POST['user'], false); $user = new User(0, $_POST['user'], false);
if(empty($user)){ if (empty($user)) {
$obj->error = __("User not found"); $obj->error = __("User not found");
die(json_encode($obj)); die(json_encode($obj));
}else if($user->getRecoverPass() !== $_POST['recoverPassword']){ } elseif ($user->getRecoverPass() !== $_POST['recoverPassword']) {
$obj->error = __("Recover password does not match"); $obj->error = __("Recover password does not match");
die(json_encode($obj)); die(json_encode($obj));
}else if($_POST['newPassword']!==$_POST['newPasswordConfirm']){ } elseif ($_POST['newPassword'] !== $_POST['newPasswordConfirm']) {
$obj->error = __("Confirmation password does not match"); $obj->error = __("Confirmation password does not match");
die(json_encode($obj)); die(json_encode($obj));
}else{ } else {
$user->setPassword($_POST['newPassword']); $user->setPassword($_POST['newPassword']);
$user->setRecoverPass(""); $user->setRecoverPass("");
if($user->save()){ if ($user->save()) {
$obj->success = __("Your Password has been set"); $obj->success = __("Your Password has been set");
die(json_encode($obj)); die(json_encode($obj));
} }

View file

@ -1,7 +1,7 @@
<?php <?php
header('Content-Type: application/json'); header('Content-Type: application/json');
if (empty($global['systemRootPath'])) { if (empty($global['systemRootPath'])) {
$global['systemRootPath'] = "../"; $global['systemRootPath'] = '../';
} }
require_once $global['systemRootPath'] . 'videos/configuration.php'; require_once $global['systemRootPath'] . 'videos/configuration.php';
require_once $global['systemRootPath'] . 'objects/user.php'; require_once $global['systemRootPath'] . 'objects/user.php';
@ -31,12 +31,12 @@ $fileData = base64DataToImage($_POST['imgBase64']);
$fileName = 'background'. User::getId().'.png'; $fileName = 'background'. User::getId().'.png';
$photoURL = $imagePath.$fileName; $photoURL = $imagePath.$fileName;
$bytes = file_put_contents($global['systemRootPath'].$photoURL, $fileData); $bytes = file_put_contents($global['systemRootPath'].$photoURL, $fileData);
if($bytes){ if ($bytes) {
$response = array( $response = array(
"status" => 'success', "status" => 'success',
"url" => $global['systemRootPath'].$photoURL "url" => $global['systemRootPath'].$photoURL
); );
}else{ } else {
$response = array( $response = array(
"status" => 'error', "status" => 'error',
"msg" => 'We could not save this file', "msg" => 'We could not save this file',
@ -49,4 +49,3 @@ $user->setBackgroundURL($photoURL);
$user->save(); $user->save();
User::updateSessionInfo(); User::updateSessionInfo();
print json_encode($response); print json_encode($response);
?>

View file

@ -1,8 +1,7 @@
<?php <?php
header('Content-Type: application/json'); header('Content-Type: application/json');
if (empty($global['systemRootPath'])) { if (empty($global['systemRootPath'])) {
$global['systemRootPath'] = "../"; $global['systemRootPath'] = '../';
} }
require_once $global['systemRootPath'] . 'videos/configuration.php'; require_once $global['systemRootPath'] . 'videos/configuration.php';
require_once $global['systemRootPath'] . 'objects/user.php'; require_once $global['systemRootPath'] . 'objects/user.php';
@ -32,12 +31,12 @@ $fileData = base64DataToImage($_POST['imgBase64']);
$fileName = 'photo'. User::getId().'.png'; $fileName = 'photo'. User::getId().'.png';
$photoURL = $imagePath.$fileName; $photoURL = $imagePath.$fileName;
$bytes = file_put_contents($global['systemRootPath'].$photoURL, $fileData); $bytes = file_put_contents($global['systemRootPath'].$photoURL, $fileData);
if($bytes){ if ($bytes) {
$response = array( $response = array(
"status" => 'success', "status" => 'success',
"url" => $global['systemRootPath'].$photoURL "url" => $global['systemRootPath'].$photoURL
); );
}else{ } else {
$response = array( $response = array(
"status" => 'error', "status" => 'error',
"msg" => 'We could not save this file', "msg" => 'We could not save this file',
@ -50,4 +49,3 @@ $user->setPhotoURL($photoURL);
$user->save(); $user->save();
User::updateSessionInfo(); User::updateSessionInfo();
print json_encode($response); print json_encode($response);
?>

View file

@ -1,7 +1,7 @@
<?php <?php
header('Content-Type: application/json'); header('Content-Type: application/json');
if(empty($global['systemRootPath'])){ if (empty($global['systemRootPath'])) {
$global['systemRootPath'] = "../"; $global['systemRootPath'] = '../';
} }
require_once $global['systemRootPath'].'videos/configuration.php'; require_once $global['systemRootPath'].'videos/configuration.php';
require_once $global['systemRootPath'] . 'objects/user.php'; require_once $global['systemRootPath'] . 'objects/user.php';

View file

@ -1,9 +1,8 @@
<?php <?php
if (empty($global['systemRootPath'])) {
if(empty($global['systemRootPath'])){ $global['systemRootPath'] = '../';
$global['systemRootPath'] = "../";
} }
require_once $global['systemRootPath'].'videos/configuration.php'; require_once $global['systemRootPath'] . 'videos/configuration.php';
require_once $global['systemRootPath'] . 'objects/user.php'; require_once $global['systemRootPath'] . 'objects/user.php';
header('Content-Type: application/json'); header('Content-Type: application/json');
$users = User::getAllUsers(); $users = User::getAllUsers();

View file

@ -1,7 +1,6 @@
<?php <?php
if (empty($global['systemRootPath'])) {
if(empty($global['systemRootPath'])){ $global['systemRootPath'] = '../';
$global['systemRootPath'] = "../";
} }
require_once $global['systemRootPath'].'videos/configuration.php'; require_once $global['systemRootPath'].'videos/configuration.php';
require_once $global['systemRootPath'] . 'objects/userGroups.php'; require_once $global['systemRootPath'] . 'objects/userGroups.php';

View file

@ -273,10 +273,10 @@ class Video {
$sql .= " AND v.status IN ('" . implode("','", Video::getViewableStatus()) . "')"; $sql .= " AND v.status IN ('" . implode("','", Video::getViewableStatus()) . "')";
if ($status == "viewableNotAd") { if ($status == "viewableNotAd") {
$sql .= " having videoAdsCount = 0 "; $sql .= " having videoAdsCount = 0 ";
} else if ($status == "viewableAd") { } elseif ($status == "viewableAd") {
$sql .= " having videoAdsCount > 0 "; $sql .= " having videoAdsCount > 0 ";
} }
} else if (!empty($status)) { } elseif (!empty($status)) {
$sql .= " AND v.status = '{$status}'"; $sql .= " AND v.status = '{$status}'";
} }
@ -285,16 +285,20 @@ class Video {
} }
if (!empty($id)) { if (!empty($id)) {
$sql .= " AND v.id = $id "; $sql .= " AND v.id = $id ";
} else if (empty($random) && !empty($_GET['videoName'])) { } elseif (empty($random) && !empty($_GET['videoName'])) {
$sql .= " AND clean_title = '{$_GET['videoName']}' "; $sql .= " AND clean_title = '{$_GET['videoName']}' ";
} else if (!empty($random)) { } elseif (!empty($random)) {
$sql .= " AND v.id != {$random} "; $sql .= " AND v.id != {$random} ";
$sql .= " ORDER BY RAND() "; $sql .= " ORDER BY RAND() ";
} else { } else {
$sql .= " ORDER BY v.Created DESC "; $sql .= " ORDER BY v.Created DESC ";
} }
$sql .= " LIMIT 1"; $sql .= " LIMIT 1";
//if(!empty($random))echo "<hr>".$sql; /*
if (!empty($random)) {
echo '<hr />'.$sql;
}
*/
$res = $global['mysqli']->query($sql); $res = $global['mysqli']->query($sql);
if ($res) { if ($res) {
require_once 'userGroups.php'; require_once 'userGroups.php';
@ -355,15 +359,15 @@ class Video {
$sql .= " AND v.status IN ('" . implode("','", Video::getViewableStatus()) . "')"; $sql .= " AND v.status IN ('" . implode("','", Video::getViewableStatus()) . "')";
if ($status == "viewableNotAd") { if ($status == "viewableNotAd") {
$sql .= " having videoAdsCount = 0 "; $sql .= " having videoAdsCount = 0 ";
} else if ($status == "viewableAd") { } elseif ($status == "viewableAd") {
$sql .= " having videoAdsCount > 0 "; $sql .= " having videoAdsCount > 0 ";
} }
} else if (!empty($status)) { } elseif (!empty($status)) {
$sql .= " AND v.status = '{$status}'"; $sql .= " AND v.status = '{$status}'";
} }
if ($showOnlyLoggedUserVideos === true && !User::isAdmin()) { if ($showOnlyLoggedUserVideos === true && !User::isAdmin()) {
$sql .= " AND v.users_id = '" . User::getId() . "'"; $sql .= " AND v.users_id = '" . User::getId() . "'";
} else if (!empty($showOnlyLoggedUserVideos)) { } elseif (!empty($showOnlyLoggedUserVideos)) {
$sql .= " AND v.users_id = {$showOnlyLoggedUserVideos}"; $sql .= " AND v.users_id = {$showOnlyLoggedUserVideos}";
} }
@ -421,15 +425,15 @@ class Video {
$sql .= " AND v.status IN ('" . implode("','", Video::getViewableStatus()) . "')"; $sql .= " AND v.status IN ('" . implode("','", Video::getViewableStatus()) . "')";
if ($status == "viewableNotAd") { if ($status == "viewableNotAd") {
$sql .= " having videoAdsCount = 0 "; $sql .= " having videoAdsCount = 0 ";
} else if ($status == "viewableAd") { } elseif ($status == "viewableAd") {
$sql .= " having videoAdsCount > 0 "; $sql .= " having videoAdsCount > 0 ";
} }
} else if (!empty($status)) { } elseif (!empty($status)) {
$sql .= " AND status = '{$status}'"; $sql .= " AND status = '{$status}'";
} }
if ($showOnlyLoggedUserVideos === true && !User::isAdmin()) { if ($showOnlyLoggedUserVideos === true && !User::isAdmin()) {
$sql .= " AND v.users_id = '" . User::getId() . "'"; $sql .= " AND v.users_id = '" . User::getId() . "'";
} else if (is_int($showOnlyLoggedUserVideos)) { } elseif (is_int($showOnlyLoggedUserVideos)) {
$sql .= " AND v.users_id = {$showOnlyLoggedUserVideos}"; $sql .= " AND v.users_id = {$showOnlyLoggedUserVideos}";
} }
if (!empty($_GET['catName'])) { if (!empty($_GET['catName'])) {
@ -622,28 +626,27 @@ class Video {
return "00:00:00"; return "00:00:00";
} else { } else {
$duration = $durationParts[0]; $duration = $durationParts[0];
$durationParts = explode(":", $duration); $durationParts = explode(':', $duration);
if(count($durationParts) == 1){ if (count($durationParts) == 1) {
return "0:00:".static::addZero($durationParts[0]); return '0:00:'.static::addZero($durationParts[0]);
}else if(count($durationParts)==2){ } elseif (count($durationParts) == 2) {
return "0:".static::addZero($durationParts[0]).":".static::addZero($durationParts[1]); return '0:'.static::addZero($durationParts[0]).':'.static::addZero($durationParts[1]);
} }
return $duration; return $duration;
} }
} }
static private function addZero($str){ static private function addZero($str) {
if(intval($str) < 10){ if (intval($str) < 10) {
return "0".intval($str); return '0'.intval($str);
}else{
return $str;
} }
return $str;
} }
static function getItemPropDuration($duration = "") { static function getItemPropDuration($duration = '') {
$duration = static::getCleanDuration($duration); $duration = static::getCleanDuration($duration);
$parts = explode(":", $duration); $parts = explode(':', $duration);
return "PT" . intval($parts[0]) . "H" . intval($parts[1]) . "M" . intval($parts[2]) . "S"; return 'PT' . intval($parts[0]) . 'H' . intval($parts[1]) . 'M' . intval($parts[2]) . 'S';
} }

View file

@ -1,9 +1,9 @@
<?php <?php
header('Content-Type: application/json'); header('Content-Type: application/json');
if(empty($global['systemRootPath'])){ if (empty($global['systemRootPath'])) {
$global['systemRootPath'] = "../"; $global['systemRootPath'] = '../';
} }
require_once $global['systemRootPath'].'videos/configuration.php'; require_once $global['systemRootPath'] . 'videos/configuration.php';
require_once $global['systemRootPath'] . 'objects/user.php'; require_once $global['systemRootPath'] . 'objects/user.php';
if (!User::canUpload() || empty($_POST['id'])) { if (!User::canUpload() || empty($_POST['id'])) {
die('{"error":"'.__("Permission denied").'"}'); die('{"error":"'.__("Permission denied").'"}');

View file

@ -1,7 +1,7 @@
<?php <?php
header('Content-Type: application/json'); header('Content-Type: application/json');
if(empty($global['systemRootPath'])){ if (empty($global['systemRootPath'])) {
$global['systemRootPath'] = "../"; $global['systemRootPath'] = '../';
} }
require_once $global['systemRootPath'].'videos/configuration.php'; require_once $global['systemRootPath'].'videos/configuration.php';
require_once $global['systemRootPath'] . 'objects/user.php'; require_once $global['systemRootPath'] . 'objects/user.php';

View file

@ -1,9 +1,7 @@
<?php <?php
header('Content-Type: application/json'); header('Content-Type: application/json');
if (empty($global['systemRootPath'])) { if (empty($global['systemRootPath'])) {
$global['systemRootPath'] = "../"; $global['systemRootPath'] = '../';
} }
require_once $global['systemRootPath'] . 'videos/configuration.php'; require_once $global['systemRootPath'] . 'videos/configuration.php';
require_once $global['systemRootPath'] . 'objects/user.php'; require_once $global['systemRootPath'] . 'objects/user.php';
@ -45,4 +43,3 @@ if (file_exists($fileName)) {
$obj2->message = __("The original file for this video does not exists anymore"); $obj2->message = __("The original file for this video does not exists anymore");
echo json_encode($obj2); echo json_encode($obj2);
} }

View file

@ -1,7 +1,7 @@
<?php <?php
header('Content-Type: application/json'); header('Content-Type: application/json');
if(empty($global['systemRootPath'])){ if (empty($global['systemRootPath'])) {
$global['systemRootPath'] = "../"; $global['systemRootPath'] = '../';
} }
require_once $global['systemRootPath'].'videos/configuration.php'; require_once $global['systemRootPath'].'videos/configuration.php';
require_once $global['systemRootPath'] . 'objects/user.php'; require_once $global['systemRootPath'] . 'objects/user.php';

View file

@ -1,8 +1,7 @@
<?php <?php
header('Content-Type: application/json'); header('Content-Type: application/json');
if (empty($global['systemRootPath'])) {
if(empty($global['systemRootPath'])){ $global['systemRootPath'] = '../';
$global['systemRootPath'] = "../";
} }
require_once $global['systemRootPath'] .'videos/configuration.php'; require_once $global['systemRootPath'] .'videos/configuration.php';
require_once $global['systemRootPath'] . 'objects/user.php'; require_once $global['systemRootPath'] . 'objects/user.php';

View file

@ -1,9 +1,9 @@
<?php <?php
header('Content-Type: application/json'); header('Content-Type: application/json');
if(empty($global['systemRootPath'])){ if (empty($global['systemRootPath'])) {
$global['systemRootPath'] = "../"; $global['systemRootPath'] = '../';
} }
require_once $global['systemRootPath'].'videos/configuration.php'; require_once $global['systemRootPath'] . 'videos/configuration.php';
require_once $global['systemRootPath'] . 'objects/user.php'; require_once $global['systemRootPath'] . 'objects/user.php';
if (!User::isAdmin() || empty($_POST['id'])) { if (!User::isAdmin() || empty($_POST['id'])) {
die('{"error":"'.__("Permission denied").'"}'); die('{"error":"'.__("Permission denied").'"}');

View file

@ -54,15 +54,15 @@ class Video_ad {
header('Content-Type: application/json'); header('Content-Type: application/json');
die('{"error":"' . __("Permission denied") . '"}'); die('{"error":"' . __("Permission denied") . '"}');
} }
if(empty($this->starts)){ if (empty($this->starts)) {
$this->starts = date("Y-m-d h:i:s"); $this->starts = date('Y-m-d h:i:s');
} }
if (empty($this->ad_title)) { if (empty($this->ad_title)) {
return false; return false;
} }
if(empty($this->finish)){ if (empty($this->finish)) {
$finish = "NULL"; $finish = "NULL";
}else{ } else {
$finish = "'{$this->finish}'"; $finish = "'{$this->finish}'";
} }

View file

@ -1,9 +1,9 @@
<?php <?php
header('Content-Type: application/json'); header('Content-Type: application/json');
if(empty($global['systemRootPath'])){ if (empty($global['systemRootPath'])) {
$global['systemRootPath'] = "../"; $global['systemRootPath'] = '../';
} }
require_once $global['systemRootPath'].'videos/configuration.php'; require_once $global['systemRootPath'] . 'videos/configuration.php';
require_once $global['systemRootPath'] . 'objects/user.php'; require_once $global['systemRootPath'] . 'objects/user.php';
require 'video_ad.php'; require 'video_ad.php';
Video_ad::clickLog($_GET['video_ads_logs_id']); Video_ad::clickLog($_GET['video_ads_logs_id']);

View file

@ -1,9 +1,9 @@
<?php <?php
header('Content-Type: application/json'); header('Content-Type: application/json');
if(empty($global['systemRootPath'])){ if (empty($global['systemRootPath'])) {
$global['systemRootPath'] = "../"; $global['systemRootPath'] = '../';
} }
require_once $global['systemRootPath'].'videos/configuration.php'; require_once $global['systemRootPath'] . 'videos/configuration.php';
require_once $global['systemRootPath'] . 'objects/user.php'; require_once $global['systemRootPath'] . 'objects/user.php';
if (!User::isAdmin() || empty($_POST['id'])) { if (!User::isAdmin() || empty($_POST['id'])) {
die('{"error":"'.__("Permission denied").'"}'); die('{"error":"'.__("Permission denied").'"}');

View file

@ -1,15 +1,15 @@
<?php <?php
header('Content-Type: application/json'); header('Content-Type: application/json');
if(empty($global['systemRootPath'])){ if (empty($global['systemRootPath'])) {
$global['systemRootPath'] = "../"; $global['systemRootPath'] = '../';
} }
require_once $global['systemRootPath'].'videos/configuration.php'; require_once $global['systemRootPath'] . 'videos/configuration.php';
require_once $global['systemRootPath'] . 'objects/user.php'; require_once $global['systemRootPath'] . 'objects/user.php';
if (!User::isAdmin() || empty($_POST['id'])) { if (!User::isAdmin() || empty($_POST['id'])) {
die('{"error":"'.__("Permission denied").'"}'); die('{"error":"'.__("Permission denied").'"}');
} }
require 'video_ad.php'; require 'video_ad.php';
$va = new Video_ad("", "", "", "", $_POST['id']); $va = new Video_ad('', '', '', '', $_POST['id']);
$va->setAd_title($_POST["title"]); $va->setAd_title($_POST["title"]);
$va->setStarts($_POST["starts"]); $va->setStarts($_POST["starts"]);
$va->setFinish($_POST["finish"]); $va->setFinish($_POST["finish"]);

View file

@ -1,7 +1,6 @@
<?php <?php
if (empty($global['systemRootPath'])) { if (empty($global['systemRootPath'])) {
$global['systemRootPath'] = "../"; $global['systemRootPath'] = '../';
} }
require_once $global['systemRootPath'] . 'videos/configuration.php'; require_once $global['systemRootPath'] . 'videos/configuration.php';
require_once $global['systemRootPath'] . 'objects/bootGrid.php'; require_once $global['systemRootPath'] . 'objects/bootGrid.php';

View file

@ -4,11 +4,11 @@ require_once 'video.php';
require_once $global['systemRootPath'] . 'objects/functions.php'; require_once $global['systemRootPath'] . 'objects/functions.php';
header('Content-Type: application/json'); header('Content-Type: application/json');
$showOnlyLoggedUserVideos = true; $showOnlyLoggedUserVideos = true;
if(User::isAdmin()){ if (User::isAdmin()) {
$showOnlyLoggedUserVideos = false; $showOnlyLoggedUserVideos = false;
} }
$videos = Video::getAllVideos("", $showOnlyLoggedUserVideos, true); $videos = Video::getAllVideos('', $showOnlyLoggedUserVideos, true);
$total = Video::getTotalVideos("", $showOnlyLoggedUserVideos, true); $total = Video::getTotalVideos('', $showOnlyLoggedUserVideos, true);
foreach ($videos as $key => $value) { foreach ($videos as $key => $value) {
$name = empty($value['name'])?$value['user']:$value['name']; $name = empty($value['name'])?$value['user']:$value['name'];
//$categories[$key]['comment'] = " <div class=\"commenterName\"><strong>{$name}</strong><div class=\"date sub-text\">{$value['created']}</div></div><div class=\"commentText\">". nl2br($value['comment'])."</div>"; //$categories[$key]['comment'] = " <div class=\"commenterName\"><strong>{$name}</strong><div class=\"date sub-text\">{$value['created']}</div></div><div class=\"commentText\">". nl2br($value['comment'])."</div>";

View file

@ -29,9 +29,9 @@ if (!User::canUpload()) {
$video = new Video("", "", @$_POST['videos_id']); $video = new Video("", "", @$_POST['videos_id']);
$obj->video_id = @$_POST['videos_id']; $obj->video_id = @$_POST['videos_id'];
$title = $video->getTitle(); $title = $video->getTitle();
if(empty($title) && !empty($_POST['title'])){ if (empty($title) && !empty($_POST['title'])) {
$title = $video->setTitle($_POST['title']); $title = $video->setTitle($_POST['title']);
}else if(empty($title)){ } elseif (empty($title)) {
$video->setTitle("Automatic Title"); $video->setTitle("Automatic Title");
} }
$video->setDuration($_POST['duration']); $video->setDuration($_POST['duration']);
@ -40,10 +40,10 @@ $video->setStatus('a');
$video->setVideoDownloadedLink($_POST['videoDownloadedLink']); $video->setVideoDownloadedLink($_POST['videoDownloadedLink']);
if(preg_match("/(mp3|wav|ogg)$/i", $_POST['format'])){ if (preg_match("/(mp3|wav|ogg)$/i", $_POST['format'])) {
$type = 'audio'; $type = 'audio';
$video->setType($type); $video->setType($type);
}else if(preg_match("/(mp4|webm)$/i", $_POST['format'])){ } elseif (preg_match("/(mp4|webm)$/i", $_POST['format'])) {
$type = 'video'; $type = 'video';
$video->setType($type); $video->setType($type);
} }
@ -74,8 +74,8 @@ if(!empty($_FILES['image']['tmp_name']) && !file_exists("{$destination}.jpg")){
die(json_encode($obj)); die(json_encode($obj));
} }
} }
if(!empty($_FILES['gifimage']['tmp_name']) && !file_exists("{$destination}.gif")){ if (!empty($_FILES['gifimage']['tmp_name']) && !file_exists("{$destination}.gif")) {
if(!move_uploaded_file ($_FILES['gifimage']['tmp_name'] , "{$destination}.gif")){ if (!move_uploaded_file ($_FILES['gifimage']['tmp_name'] , "{$destination}.gif")) {
$obj->msg = __("Could not move gif image file [{$destination}.gif]"); $obj->msg = __("Could not move gif image file [{$destination}.gif]");
error_log($obj->msg); error_log($obj->msg);
die(json_encode($obj)); die(json_encode($obj));
@ -90,12 +90,7 @@ error_log("Files Received for video {$video_id}: ".$video->getTitle());
die(json_encode($obj)); die(json_encode($obj));
/* /*
error_log(print_r($_POST, true)); error_log(print_r($_POST, true));
error_log(print_r($_FILES, true)); error_log(print_r($_FILES, true));
var_dump($_POST, $_FILES); var_dump($_POST, $_FILES);
*/ */

View file

@ -2,10 +2,10 @@
header('Content-Type: application/json'); header('Content-Type: application/json');
$obj = new stdClass(); $obj = new stdClass();
$obj->error = true; $obj->error = true;
if(empty($global['systemRootPath'])){ if (empty($global['systemRootPath'])) {
$global['systemRootPath'] = "../"; $global['systemRootPath'] = '../';
} }
require_once $global['systemRootPath'].'videos/configuration.php'; require_once $global['systemRootPath'] . 'videos/configuration.php';
require_once $global['systemRootPath'] . 'objects/user.php'; require_once $global['systemRootPath'] . 'objects/user.php';
require_once $global['systemRootPath'] . 'objects/video.php'; require_once $global['systemRootPath'] . 'objects/video.php';
@ -114,32 +114,32 @@ if (isset($_FILES['upl']) && $_FILES['upl']['error'] == 0) {
if (!copy($_FILES['upl']['tmp_name'], "{$global['systemRootPath']}videos/original_" . $filename)) { if (!copy($_FILES['upl']['tmp_name'], "{$global['systemRootPath']}videos/original_" . $filename)) {
die("Error on copy(" . $_FILES['upl']['tmp_name'] . ", " . "{$global['systemRootPath']}videos/original_" . $filename . ")"); die("Error on copy(" . $_FILES['upl']['tmp_name'] . ", " . "{$global['systemRootPath']}videos/original_" . $filename . ")");
} }
} else if (array_key_exists('dontMoveUploadedFile', $_FILES['upl'])) { } elseif (array_key_exists('dontMoveUploadedFile', $_FILES['upl'])) {
if (!rename($_FILES['upl']['tmp_name'], "{$global['systemRootPath']}videos/original_" . $filename)) { if (!rename($_FILES['upl']['tmp_name'], "{$global['systemRootPath']}videos/original_" . $filename)) {
die("Error on rename(" . $_FILES['upl']['tmp_name'] . ", " . "{$global['systemRootPath']}videos/original_" . $filename . ")"); die("Error on rename(" . $_FILES['upl']['tmp_name'] . ", " . "{$global['systemRootPath']}videos/original_" . $filename . ")");
} }
} else if (!move_uploaded_file($_FILES['upl']['tmp_name'], "{$global['systemRootPath']}videos/original_" . $filename)) { } elseif (!move_uploaded_file($_FILES['upl']['tmp_name'], "{$global['systemRootPath']}videos/original_" . $filename)) {
die("Error on move_uploaded_file(" . $_FILES['upl']['tmp_name'] . ", " . "{$global['systemRootPath']}videos/original_" . $filename . ")"); die("Error on move_uploaded_file(" . $_FILES['upl']['tmp_name'] . ", " . "{$global['systemRootPath']}videos/original_" . $filename . ")");
} }
$video = new Video("", "", $id); $video = new Video('', '', $id);
// send to encoder // send to encoder
$queue = array(); $queue = array();
if($video->getType() == 'video'){ if ($video->getType() == 'video') {
if($config->getEncode_mp4()){ if ($config->getEncode_mp4()) {
$queue[] = $video->queue("mp4"); $queue[] = $video->queue("mp4");
} }
if($config->getEncode_webm()){ if ($config->getEncode_webm()) {
$queue[] = $video->queue("webm"); $queue[] = $video->queue("webm");
} }
}else if($config->getEncode_mp3spectrum()){ } elseif ($config->getEncode_mp3spectrum()) {
if($config->getEncode_mp4()){ if ($config->getEncode_mp4()) {
$queue[] = $video->queue("mp4_spectrum"); $queue[] = $video->queue("mp4_spectrum");
} }
if($config->getEncode_webm()){ if ($config->getEncode_webm()) {
$queue[] = $video->queue("webm_spectrum"); $queue[] = $video->queue("webm_spectrum");
} }
}else{ } else {
$queue[] = $video->queue("mp3"); $queue[] = $video->queue("mp3");
$queue[] = $video->queue("ogg"); $queue[] = $video->queue("ogg");
} }
@ -159,8 +159,3 @@ if (isset($_FILES['upl']) && $_FILES['upl']['error'] == 0) {
//echo '{"status":"error", "msg":' . json_encode($_FILES) . ', "type":"$_FILES Error"}'; //echo '{"status":"error", "msg":' . json_encode($_FILES) . ', "type":"$_FILES Error"}';
status(["status" => "error", "msg" => print_r($_FILES,true), "type" => '$_FILES Error']); status(["status" => "error", "msg" => print_r($_FILES,true), "type" => '$_FILES Error']);
exit; exit;

View file

@ -126,4 +126,3 @@ if ($client->getAccessToken()) {
} }
echo json_encode($obj); echo json_encode($obj);
?>

View file

@ -86,7 +86,7 @@ require_once $global['systemRootPath'] . 'objects/functions.php';
$file = basename($filename); // $file is set to "index.php" $file = basename($filename); // $file is set to "index.php"
$fileEx = basename($filename, ".css"); // $file is set to "index" $fileEx = basename($filename, ".css"); // $file is set to "index"
$savedTheme = $config->getTheme(); $savedTheme = $config->getTheme();
if($fileEx == $savedTheme){ if ($fileEx == $savedTheme) {
?> ?>
<script> <script>
$(document).ready(function () { $(document).ready(function () {

View file

@ -1,5 +1,5 @@
*{ * {
font-family: Roboto,arial,sans-serif; font-family: Roboto, arial, sans-serif;
font-size: 12px; font-size: 12px;
} }
html, html,
@ -9,16 +9,13 @@ body {
body { body {
padding-top: 60px; padding-top: 60px;
} }
.nopadding { .nopadding {
padding: 0 !important; padding: 0 !important;
margin: 0 !important; margin: 0 !important;
} }
.videoLink .duration {
.videoLink .duration{
position: absolute; position: absolute;
background: rgba(0,0, 0, 0.6)!important; background: rgba(0, 0, 0, 0.6)!important;
padding: 2px; padding: 2px;
color: #FFF; color: #FFF;
bottom: 5px; bottom: 5px;
@ -26,53 +23,51 @@ body {
font-size: 0.9em; font-size: 0.9em;
border-radius: 5px; border-radius: 5px;
} }
.videoLink .glyphicon-play-circle{ .videoLink .glyphicon-play-circle {
transition: all 0.3s ease-in-out; transition: all 0.3s ease-in-out;
top: 50%; top: 50%;
left: 50%; left: 50%;
margin: -25px 0 0 -25px; margin: -25px 0 0 -25px;
position: absolute; position: absolute;
color: rgba(255,255, 255, 0.3)!important; color: rgba(255, 255, 255, 0.3)!important;
font-size: 50px; font-size: 50px;
} }
.videoLink div {
.videoLink div{
transition: all 0.3s ease-in-out; transition: all 0.3s ease-in-out;
font-size: 1em; font-size: 1em;
} }
.videoLink div.details, .videoLink div.details div{ .videoLink div.details,
.videoLink div.details div {
font-size: 0.9em; font-size: 0.9em;
} }
.gallery:hover .glyphicon-play-circle,
.gallery:hover .glyphicon-play-circle, .videoLink:hover .glyphicon-play-circle{ .videoLink:hover .glyphicon-play-circle {
color: rgba(255,255, 255, 0.6)!important; color: rgba(255, 255, 255, 0.6)!important;
} }
.bottom-border {
.bottom-border{
border-bottom: 2px solid #F2F2F2; border-bottom: 2px solid #F2F2F2;
margin: 0; margin: 0;
padding: 5px; padding: 5px;
} }
h1,
h1,h2,h3,h4{ h2,
h3,
h4 {
margin: 5px; margin: 5px;
padding: 5px; padding: 5px;
} }
h1 {
h1{
font-size: 20px; font-size: 20px;
} }
h2{ h2 {
font-size: 18px; font-size: 18px;
} }
h3{ h3 {
font-size: 16px; font-size: 16px;
} }
h4{ h4 {
font-size: 14px; font-size: 14px;
} }
footer { footer {
color: #444; color: #444;
padding: 25px; padding: 25px;
@ -83,7 +78,7 @@ footer {
} }
footer .btn-outline:hover, footer .btn-outline:hover,
footer .btn-outline:focus, footer .btn-outline:focus,
footer .btn-outline:active{ footer .btn-outline:active {
color: #444; color: #444;
background: white; background: white;
border: solid 2px white; border: solid 2px white;
@ -97,20 +92,18 @@ footer .btn-outline {
} }
/* for main video */ /* for main video */
.video-content { .video-content {
flex:0 1 100%; flex: 0 1 100%;
height:50%; height: 50%;
display:flex; display: flex;
justify-content:flex-start; justify-content: flex-start;
} }
.main-video{ .main-video {
background-color: #000; background-color: #000;
margin-bottom: 10px; margin-bottom: 10px;
} }
/* end for main video */ /* end for main video */
.form-compact .form-control { .form-compact .form-control {
position: relative; position: relative;
height: auto; height: auto;
@ -124,16 +117,17 @@ footer .btn-outline {
border-radius: 0; border-radius: 0;
margin-bottom: -1px; margin-bottom: -1px;
} }
.form-compact input.first, .form-compact select.first { .form-compact input.first,
.form-compact select.first {
border-top-left-radius: 5px; border-top-left-radius: 5px;
border-top-right-radius: 5px; border-top-right-radius: 5px;
} }
.form-compact input.last, .form-compact select.last { .form-compact input.last,
.form-compact select.last {
border-bottom-left-radius: 5px; border-bottom-left-radius: 5px;
border-bottom-right-radius: 5px; border-bottom-right-radius: 5px;
margin-bottom: 10px; margin-bottom: 10px;
} }
@media (max-width: 767px) { @media (max-width: 767px) {
.navbar-form { .navbar-form {
padding: 0; padding: 0;
@ -142,17 +136,17 @@ footer .btn-outline {
/* Comments */ /* Comments */
.commenterName small { .commenterName small {
font-family:verdana; font-family: verdana;
font-size:0.9em; font-size: 0.9em;
} }
.commenterName { .commenterName {
margin-right:5px; margin-right: 5px;
} }
.commentText { .commentText {
clear: both; clear: both;
} }
.commentDetails { .commentDetails {
margin:0 0 0 60px; margin: 0 0 0 60px;
} }
/* End Comments */ /* End Comments */
@ -175,17 +169,21 @@ footer .btn-outline {
border: 0; border: 0;
margin-right: 0; margin-right: 0;
} }
.tabbable-line > .nav-tabs > li.open, .tabbable-line > .nav-tabs > li:hover { .tabbable-line > .nav-tabs > li.open,
.tabbable-line > .nav-tabs > li:hover {
border-bottom: 4px solid #fbcdcf; border-bottom: 4px solid #fbcdcf;
} }
.tabbable-line > .nav-tabs > li.open > a, .tabbable-line > .nav-tabs > li:hover > a { .tabbable-line > .nav-tabs > li.open > a,
.tabbable-line > .nav-tabs > li:hover > a {
border: 0; border: 0;
background: none !important; background: none !important;
} }
.tabbable-line > .nav-tabs > li.open > a > i, .tabbable-line > .nav-tabs > li:hover > a > i { .tabbable-line > .nav-tabs > li.open > a > i,
.tabbable-line > .nav-tabs > li:hover > a > i {
color: #a6a6a6; color: #a6a6a6;
} }
.tabbable-line > .nav-tabs > li.open .dropdown-menu, .tabbable-line > .nav-tabs > li:hover .dropdown-menu { .tabbable-line > .nav-tabs > li.open .dropdown-menu,
.tabbable-line > .nav-tabs > li:hover .dropdown-menu {
margin-top: 0px; margin-top: 0px;
} }
.tabbable-line > .nav-tabs > li.active { .tabbable-line > .nav-tabs > li.active {
@ -213,40 +211,35 @@ footer .btn-outline {
.nowrapCell td { .nowrapCell td {
white-space: normal !important; white-space: normal !important;
} }
.watch8-action-buttons {
.watch8-action-buttons{
padding: 5px 10px 0 10px; padding: 5px 10px 0 10px;
margin: 5px 0 0 0; margin: 5px 0 0 0;
border-top: 2px solid #F2F2F2; border-top: 2px solid #F2F2F2;
} }
.bgWhite{ .bgWhite {
margin: 0 0 10px; margin: 0 0 10px;
border: 0; border: 0;
box-shadow: 0 1px 2px rgba(0,0,0,.1); box-shadow: 0 1px 2px rgba(0, 0, 0, .1);
-moz-box-sizing: border-box; -moz-box-sizing: border-box;
box-sizing: border-box; box-sizing: border-box;
padding: 10px; padding: 10px;
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
} }
.no-outline {
.no-outline{
border: 0; border: 0;
} }
.no-outline:focus, .no-outline:focus,
.no-outline:active, .no-outline:active,
.no-outline:hover{ .no-outline:hover {
background-color: transparent; background-color: transparent;
color: #000; color: #000;
} }
#showMore {
#showMore{
padding: 20px; padding: 20px;
margin: 10px; margin: 10px;
border-top: 2px solid #F2F2F2; border-top: 2px solid #F2F2F2;
} }
.watch-view-count { .watch-view-count {
line-height: 24px; line-height: 24px;
max-height: 24px; max-height: 24px;
@ -256,11 +249,12 @@ footer .btn-outline {
padding: -5px; padding: -5px;
border-bottom: 2px solid #167ac6; border-bottom: 2px solid #167ac6;
} }
#likeBtn.myVote span,
#likeBtn.myVote span, #likeBtn.myVote small { #likeBtn.myVote small {
color: #167ac6; color: #167ac6;
} }
#dislikeBtn.myVote span, #dislikeBtn.myVote small { #dislikeBtn.myVote span,
#dislikeBtn.myVote small {
color: #444; color: #444;
} }
@ -268,14 +262,12 @@ footer .btn-outline {
.material-switch > input[type="checkbox"] { .material-switch > input[type="checkbox"] {
display: none; display: none;
} }
.material-switch > label { .material-switch > label {
cursor: pointer; cursor: pointer;
height: 0px; height: 0px;
position: relative; position: relative;
width: 40px; width: 40px;
} }
.material-switch > label::before { .material-switch > label::before {
background: rgb(0, 0, 0); background: rgb(0, 0, 0);
box-shadow: inset 0px 0px 10px rgba(0, 0, 0, 0.5); box-shadow: inset 0px 0px 10px rgba(0, 0, 0, 0.5);
@ -283,7 +275,7 @@ footer .btn-outline {
content: ''; content: '';
height: 16px; height: 16px;
margin-top: -8px; margin-top: -8px;
position:absolute; position: absolute;
opacity: 0.3; opacity: 0.3;
transition: all 0.4s ease-in-out; transition: all 0.4s ease-in-out;
width: 40px; width: 40px;
@ -311,7 +303,6 @@ footer .btn-outline {
} }
/* fancy checkbox end */ /* fancy checkbox end */
.label.fix-width { .label.fix-width {
min-width: 130px !important; min-width: 130px !important;
display: inline-block !important; display: inline-block !important;
@ -324,21 +315,22 @@ footer .btn-outline {
text-align: right; text-align: right;
border-top-right-radius: 0; border-top-right-radius: 0;
border-bottom-right-radius: 0; border-bottom-right-radius: 0;
border-top-left-radius: 0.25em;; border-top-left-radius: 0.25em;
border-bottom-left-radius: 0.25em;; ;
border-bottom-left-radius: 0.25em;
;
} }
.popover-content,
.popover-content, .popover-title, .popover{ .popover-title,
color:#333 !important; .popover {
color: #333 !important;
} }
.videosDetails {
.videosDetails{
padding-left: 20px; padding-left: 20px;
} }
.divMainVideo .duration {
.divMainVideo .duration{
position: absolute; position: absolute;
background: rgba(0,0, 0, 0.6)!important; background: rgba(0, 0, 0, 0.6)!important;
padding: 3px; padding: 3px;
color: #FFF; color: #FFF;
bottom: 5px; bottom: 5px;
@ -346,10 +338,9 @@ footer .btn-outline {
font-size: 0.9em; font-size: 0.9em;
border-radius: 5px; border-radius: 5px;
} }
.gallery .duration {
.gallery .duration{
position: absolute; position: absolute;
background: rgba(0,0, 0, 0.6)!important; background: rgba(0, 0, 0, 0.6)!important;
padding: 3px; padding: 3px;
color: #FFF; color: #FFF;
top: 5px; top: 5px;
@ -357,96 +348,111 @@ footer .btn-outline {
font-size: 0.9em; font-size: 0.9em;
border-radius: 5px; border-radius: 5px;
} }
.gallery h2,
.gallery h2, .videosDetails .title{ .videosDetails .title {
font-size: 1em; font-size: 1em;
margin: 0; margin: 0;
padding: 0; padding: 0;
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
display: -webkit-box; display: -webkit-box;
line-height: 16px; /* fallback */ line-height: 16px; /* fallback */
max-height: 32px; /* fallback */ max-height: 32px; /* fallback */
min-height: 32px; /* fallback */ min-height: 32px; /* fallback */
-webkit-line-clamp: 2; /* number of lines to show */ -webkit-line-clamp: 2; /* number of lines to show */
-webkit-box-orient: vertical; -webkit-box-orient: vertical;
} }
.gallery .watch-view-count {
.gallery .watch-view-count{
font-size: 0.8em; font-size: 0.8em;
font-weight: normal; font-weight: normal;
border: 0; border: 0;
margin: 0; margin: 0;
padding: 0; padding: 0;
} }
.galleryVideo {
.galleryVideo{
overflow: hidden; overflow: hidden;
height: 190px; height: 190px;
border-bottom: solid 1px #EEE; border-bottom: solid 1px #EEE;
margin-bottom: 10px; margin-bottom: 10px;
} }
.galleryVideo .group { .galleryVideo .group {
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
} }
.autoplay span span {
.autoplay span span{
margin: 0 5px; margin: 0 5px;
font-weight: bold; font-weight: bold;
} }
img.rotate90,
img.rotate-270 {
transform: rotate(90deg);
-ms-transform: rotate(90deg);
/* IE 9 */
-moz-transform: rotate(90deg);
/* Firefox */
img.rotate90, img.rotate-270{ -webkit-transform: rotate(90deg);
transform:rotate(90deg); /* Safari and Chrome */
-ms-transform:rotate(90deg); /* IE 9 */
-moz-transform:rotate(90deg); /* Firefox */
-webkit-transform:rotate(90deg); /* Safari and Chrome */
-o-transform:rotate(90deg); /* Opera */
}
img.rotate180, img.rotate-180{
transform:rotate(180deg);
-ms-transform:rotate(180deg); /* IE 9 */
-moz-transform:rotate(180deg); /* Firefox */
-webkit-transform:rotate(180deg); /* Safari and Chrome */
-o-transform:rotate(180deg); /* Opera */
}
img.rotate270, img.rotate-90{
transform:rotate(270deg);
-ms-transform:rotate(270deg); /* IE 9 */
-moz-transform:rotate(270deg); /* Firefox */
-webkit-transform:rotate(270deg); /* Safari and Chrome */
-o-transform:rotate(270deg); /* Opera */
}
.subscribeButton{ -o-transform: rotate(90deg);
/* Opera */
}
img.rotate180,
img.rotate-180 {
transform: rotate(180deg);
-ms-transform: rotate(180deg);
/* IE 9 */
-moz-transform: rotate(180deg);
/* Firefox */
-webkit-transform: rotate(180deg);
/* Safari and Chrome */
-o-transform: rotate(180deg);
/* Opera */
}
img.rotate270,
img.rotate-90 {
transform: rotate(270deg);
-ms-transform: rotate(270deg);
/* IE 9 */
-moz-transform: rotate(270deg);
/* Firefox */
-webkit-transform: rotate(270deg);
/* Safari and Chrome */
-o-transform: rotate(270deg);
/* Opera */
}
.subscribeButton {
background-color: #e62117; background-color: #e62117;
color: #FFF; color: #FFF;
} }
.subscribeButton:hover, .subscribeButton:active, .subscribeButton:focus{ .subscribeButton:hover,
.subscribeButton:active,
.subscribeButton:focus {
background-color: #CC0000; background-color: #CC0000;
color: #FFF; color: #FFF;
} }
.subscribeButton span:before { .subscribeButton span:before {
content: "\f16a"; content: "\f16a";
} }
.subscribeButton.subscribed {
.subscribeButton.subscribed{
background-color: #DDD; background-color: #DDD;
color: #777; color: #777;
} }
.subscribeButton.subscribed span:before { .subscribeButton.subscribed span:before {
content: "\f00c"; content: "\f00c";
} }
.subscribeButton.subscribed:hover span:before { .subscribeButton.subscribed:hover span:before {
content: "\f057"; content: "\f057";
} }
.profileBg {
.profileBg{
padding: 20px; padding: 20px;
min-height: 200px; min-height: 200px;
margin: 10px 0; margin: 10px 0;
@ -455,16 +461,14 @@ img.rotate270, img.rotate-90{
-o-background-size: cover; -o-background-size: cover;
background-size: cover; background-size: cover;
} }
#sidebar {
#sidebar{
width: 300px; width: 300px;
position: absolute; position: absolute;
top: 0; top: 0;
height: 100vh; height: 100vh;
margin-top: 55px; margin-top: 55px;
} }
#sideBarContainer{ #sideBarContainer {
overflow-y: auto; overflow-y: auto;
position: absolute; position: absolute;
left: 0; left: 0;
@ -472,7 +476,7 @@ img.rotate270, img.rotate-90{
height: 100%; height: 100%;
width: 100%; width: 100%;
} }
#sideBarContainer ul{ #sideBarContainer ul {
margin-bottom: 150px; margin-bottom: 150px;
} }
.navbar-brand { .navbar-brand {
@ -483,15 +487,14 @@ img.rotate270, img.rotate-90{
.navbar-brand>img { .navbar-brand>img {
width: 120px; width: 120px;
} }
.list-inline { .list-inline {
display: flex; display: flex;
justify-content: left; justify-content: left;
} }
footer ul.list-inline{ footer ul.list-inline {
justify-content: center; justify-content: center;
} }
footer ul.list-inline li{ footer ul.list-inline li {
justify-content: center; justify-content: center;
align-items: center; align-items: center;
} }
@ -504,57 +507,54 @@ nav ul.items-container {
padding: 0px; padding: 0px;
} }
nav ul.items-container, nav ul.items-container,
nav ul.items-container li{ nav ul.items-container li {
list-style: none; list-style: none;
} }
nav ul.items-container li:first-child{ nav ul.items-container li:first-child {
flex: 1; flex: 1;
display: flex; display: flex;
} }
nav ul.items-container li:first-child ul.left-side{ nav ul.items-container li:first-child ul.left-side {
display: flex; display: flex;
align-items: center align-items: center
} }
nav ul.items-container li:last-child{ nav ul.items-container li:last-child {
margin-right: 20px; margin-right: 20px;
} }
nav ul.items-container li ul.right-menus { nav ul.items-container li ul.right-menus {
display: flex; display: flex;
flex-direction: row; flex-direction: row;
} }
nav ul.items-container li ul.right-menus li{ nav ul.items-container li ul.right-menus li {
margin-left: 20px; margin-left: 20px;
} }
/** header **/ /** header **/
.navbar .container {
.navbar .container{
padding: 0 2px; padding: 0 2px;
align-items: center; align-items: center;
} }
.list-inline > li { .list-inline > li {
display: flex; display: flex;
} }
.navbar .list-inline{ .navbar .list-inline {
margin: 0; margin: 0;
display: flex; display: flex;
align-items: center; align-items: center;
} }
/* Play List */ /* Play List */
.playlistList{ .playlistList {
height: 400px; height: 400px;
overflow: hidden; overflow: hidden;
} }
.playlistList .nav {
.playlistList .nav{
overflow-y: auto; overflow-y: auto;
position: absolute; position: absolute;
top: 0; top: 0;
height: 100%; height: 100%;
overflow-x: hidden; overflow-x: hidden;
} }
.playlist-nav .navbar { .playlist-nav .navbar {
padding: 0; padding: 0;
max-height: none; max-height: none;
@ -574,7 +574,7 @@ nav ul.items-container li ul.right-menus li{
} }
/* End Play List */ /* End Play List */
.floatVideo{ .floatVideo {
position: fixed !important; position: fixed !important;
width: 550px; width: 550px;
top: 70px; top: 70px;
@ -582,15 +582,15 @@ nav ul.items-container li ul.right-menus li{
z-index: 100; z-index: 100;
overflow: visible; overflow: visible;
} }
.floatVideo #main-video{ .floatVideo #main-video {
-webkit-box-shadow: 2px 0px 19px 2px rgba(0,0,0,1); -webkit-box-shadow: 2px 0px 19px 2px rgba(0, 0, 0, 1);
-moz-box-shadow: 2px 0px 19px 2px rgba(0,0,0,1); -moz-box-shadow: 2px 0px 19px 2px rgba(0, 0, 0, 1);
box-shadow: 2px 0px 19px 2px rgba(0,0,0,1); box-shadow: 2px 0px 19px 2px rgba(0, 0, 0, 1);
-webkit-border-radius: 5px; -webkit-border-radius: 5px;
-moz-border-radius: 5px; -moz-border-radius: 5px;
border-radius: 5px; border-radius: 5px;
} }
#floatButtons{ #floatButtons {
z-index: 110; z-index: 110;
position: absolute; position: absolute;
right: -10px; right: -10px;
@ -598,21 +598,21 @@ nav ul.items-container li ul.right-menus li{
} }
#floatButtons .btn-outline:hover, #floatButtons .btn-outline:hover,
#floatButtons .btn-outline:focus, #floatButtons .btn-outline:focus,
#floatButtons .btn-outline:active{ #floatButtons .btn-outline:active {
color: rgba(255,255,255,1); color: rgba(255, 255, 255, 1);
background-color: rgba(0,0,0,0.5); background-color: rgba(0, 0, 0, 0.5);
} }
#floatButtons .btn-outline { #floatButtons .btn-outline {
color: rgba(255,255,255,0.3); color: rgba(255, 255, 255, 0.3);
background-color: rgba(0,0,0,0.1); background-color: rgba(0, 0, 0, 0.1);
transition: all 0.3s ease-in-out; transition: all 0.3s ease-in-out;
border-radius: 10px; border-radius: 10px;
} }
#videoContainer {
#videoContainer{ overflow: visible;
overflow: visible; background: black;
background: black;
} }
/** video manager progress bar */ /** video manager progress bar */
.progress { .progress {
position: relative; position: relative;
@ -632,7 +632,6 @@ nav ul.items-container li ul.right-menus li{
font-weight: 800; font-weight: 800;
padding: 3px 10px 2px; padding: 3px 10px 2px;
} }
.loader { .loader {
border: 5px solid #f3f3f3; /* Light grey */ border: 5px solid #f3f3f3; /* Light grey */
border-top: 5px solid #3498db; /* Blue */ border-top: 5px solid #3498db; /* Blue */
@ -641,57 +640,58 @@ nav ul.items-container li ul.right-menus li{
height: 30px; height: 30px;
animation: spin 2s linear infinite; animation: spin 2s linear infinite;
} }
@keyframes spin { @keyframes spin {
0% { transform: rotate(0deg); } 0% {
100% { transform: rotate(360deg); } transform: rotate(0deg);
}
100% {
transform: rotate(360deg);
}
} }
@media (max-width: 1200px) { @media (max-width: 1200px) {
.floatVideo{ .floatVideo {
width: 500px; width: 500px;
} }
.galleryVideo{ .galleryVideo {
height: 195px; height: 195px;
} }
} }
@media (max-width: 992px) { @media (max-width: 992px) {
.floatVideo{ .floatVideo {
width: 450px; width: 450px;
} }
.galleryVideo{ .galleryVideo {
height: 220px; height: 220px;
} }
} }
@media (max-width: 850px) { @media (max-width: 850px) {
.galleryVideo{ .galleryVideo {
height: 180px; height: 180px;
} }
} }
@media (max-width: 768px) { @media (max-width: 768px) {
.galleryVideo{ .galleryVideo {
height: 290px; height: 290px;
} }
} }
@media (max-width: 650px) { @media (max-width: 650px) {
.galleryVideo{ .galleryVideo {
height: 250px; height: 250px;
} }
} }
@media (max-width: 500px) { @media (max-width: 500px) {
.floatVideo{ .floatVideo {
width: 380px; width: 380px;
} }
.galleryVideo{ .galleryVideo {
height: 200px; height: 200px;
} }
} }
@media (max-width: 400px) { @media (max-width: 400px) {
.floatVideo{ .floatVideo {
width: 320px; width: 320px;
} }
.galleryVideo{ .galleryVideo {
height: 180px; height: 180px;
} }
} }

View file

@ -1,10 +1,16 @@
.video-js .vjs-control-bar { .video-js .vjs-control-bar {
background: -moz-linear-gradient(top, rgba(0,0,0,0) 0%, rgba(0,0,0,0.65) 100%); /* FF3.6-15 */ background: -moz-linear-gradient(top, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 0.65) 100%);
background: -webkit-linear-gradient(top, rgba(0,0,0,0) 0%,rgba(0,0,0,0.65) 100%); /* Chrome10-25,Safari5.1-6 */ /* FF3.6-15 */
background: linear-gradient(to bottom, rgba(0,0,0,0) 0%,rgba(0,0,0,0.65) 100%); /* W3C, IE10+, FF16+, Chrome26+, Opera12+, Safari7+ */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#00000000', endColorstr='#a6000000',GradientType=0 ); /* IE6-9 */
}
background: -webkit-linear-gradient(top, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 0.65) 100%);
/* Chrome10-25,Safari5.1-6 */
background: linear-gradient(to bottom, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 0.65) 100%);
/* W3C, IE10+, FF16+, Chrome26+, Opera12+, Safari7+ */
filter: progid: DXImageTransform.Microsoft.gradient( startColorstr='#00000000', endColorstr='#a6000000', GradientType=0);
/* IE6-9 */
}
.video-js .vjs-play-progress { .video-js .vjs-play-progress {
color: #f12b24; color: #f12b24;
background-color: #f12b24; background-color: #f12b24;
@ -12,7 +18,6 @@ filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#00000000', e
.video-js:hover .vjs-play-progress { .video-js:hover .vjs-play-progress {
font-size: 1em !important; font-size: 1em !important;
} }
.video-js .vjs-big-play-button { .video-js .vjs-big-play-button {
height: 1.5em; height: 1.5em;
width: 1.5em; width: 1.5em;
@ -20,106 +25,95 @@ filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#00000000', e
-moz-border-radius: 3em; -moz-border-radius: 3em;
border-radius: 3em; border-radius: 3em;
background-color: rgba(200, 200, 200, 0.1); background-color: rgba(200, 200, 200, 0.1);
-webkit-transition: all 0.4s; -webkit-transition: all 0.4s;
-moz-transition: all 0.4s; -moz-transition: all 0.4s;
-o-transition: all 0.4s; -o-transition: all 0.4s;
transition: all 0.4s; transition: all 0.4s;
} }
.video-js:hover .vjs-big-play-button, .video-js:hover .vjs-big-play-button,
.video-js .vjs-big-play-button:focus { .video-js .vjs-big-play-button:focus {
background-color: rgba(200, 200, 200, 0.3); background-color: rgba(200, 200, 200, 0.3);
-webkit-transition: all 0.4s; -webkit-transition: all 0.4s;
-moz-transition: all 0.4s; -moz-transition: all 0.4s;
-o-transition: all 0.4s; -o-transition: all 0.4s;
transition: all 0.4s; transition: all 0.4s;
} }
.video-js .vjs-mouse-display:after,
.video-js .vjs-mouse-display:after, .video-js .vjs-play-progress:after, .video-js .vjs-time-tooltip{ .video-js .vjs-play-progress:after,
.video-js .vjs-time-tooltip {
background: rgba(0,0, 0, 0.6)!important; background: rgba(0, 0, 0, 0.6)!important;
padding: 2px; padding: 2px;
color: #FFF; color: #FFF;
font-size: 12px !important; font-size: 12px !important;
} }
.video-js .vjs-load-progress { .video-js .vjs-load-progress {
background-color: rgba(159,159,159,.8); background-color: rgba(159, 159, 159, .8);
} }
.video-js .vjs-slider-horizontal { .video-js .vjs-slider-horizontal {
background-color: rgba(159,159,159,.3); background-color: rgba(159, 159, 159, .3);
} }
.vjs-rotate90 { .vjs-rotate90 {
rotate: 90; rotate: 90;
zoom: 1.0; zoom: 1.0;
} }
/* Ad Elements */ /* Ad Elements */
#adUrl{ #adUrl {
color: #DDD; color: #DDD;
position: absolute; position: absolute;
left: 0; left: 0;
top: 80%; top: 80%;
padding: 10px; padding: 10px;
font-size: 12px; font-size: 12px;
text-shadow: -1px 0 #333, 0 1px #333, 1px 0 #333, 0 -1px #333, 0 0 0.3em black; text-shadow: -1px 0 #333, 0 1px #333, 1px 0 #333, 0 -1px #333, 0 0 0.3em black;
white-space: nowrap; white-space: nowrap;
} }
#adUrl a{ #adUrl a {
color: #DDD; color: #DDD;
} }
#adUrl a:hover{ #adUrl a:hover {
color: #FFF; color: #FFF;
text-decoration: underline; text-decoration: underline;
} }
#adButton{ #adButton {
background-color: rgba(0, 0, 0, 0.7); background-color: rgba(0, 0, 0, 0.7);
-webkit-transition: all 0.4s; -webkit-transition: all 0.4s;
-moz-transition: all 0.4s; -moz-transition: all 0.4s;
-o-transition: all 0.4s; -o-transition: all 0.4s;
transition: all 0.4s; transition: all 0.4s;
color: #FFF; color: #FFF;
border: 1px solid #888; border: 1px solid #888;
position: absolute; position: absolute;
right: 0; right: 0;
top: 70%; top: 70%;
padding: 10px; padding: 10px;
font-size: 16px; font-size: 16px;
} }
#adButton:hover{ #adButton:hover {
background-color: rgba(0, 0, 0, 0.9); background-color: rgba(0, 0, 0, 0.9);
border: 1px solid #DDD; border: 1px solid #DDD;
} }
.adControl {
.adControl{
display: none; display: none;
} }
.ad .video-js .vjs-play-progress { .ad .video-js .vjs-play-progress {
color: #FC0; color: #FC0;
background-color: #FC0; background-color: #FC0;
} }
.ad .vjs-progress-control * {
.ad .vjs-progress-control *{
pointer-events: none !important; pointer-events: none !important;
} }
.ad .adControl {
.ad .adControl{
display: block; display: block;
} }
/* End Ad Elements */ /* End Ad Elements */
.img-portrait { .img-portrait {
transform: scale(0.56) rotate(90deg); transform: scale(0.56) rotate(90deg);
} }
.embed-responsive-9by16 { .embed-responsive-9by16 {
padding-bottom: 100%; padding-bottom: 100%;
} }
.video-js.vjs-9-16 { .video-js.vjs-9-16 {
padding-top: 100%; padding-top: 100%;
} }

View file

@ -1,5 +1,3 @@
/*========================= /*=========================
Icons Icons
================= */ ================= */
@ -16,76 +14,77 @@ ul.social-network li {
margin: 0 5px; margin: 0 5px;
} }
/* footer social icons */ /* footer social icons */
.social-network a.icoRss:hover { .social-network a.icoRss:hover {
background-color: #F56505; background-color: #F56505;
} }
.social-network a.icoFacebook:hover { .social-network a.icoFacebook:hover {
background-color:#3B5998; background-color: #3B5998;
} }
.social-network a.icoTwitter:hover { .social-network a.icoTwitter:hover {
background-color:#33ccff; background-color: #33ccff;
} }
.social-network a.icoGoogle:hover { .social-network a.icoGoogle:hover {
background-color:#BD3518; background-color: #BD3518;
} }
.social-network a.icoVimeo:hover { .social-network a.icoVimeo:hover {
background-color:#0590B8; background-color: #0590B8;
} }
.social-network a.icoLinkedin:hover { .social-network a.icoLinkedin:hover {
background-color:#007bb7; background-color: #007bb7;
} }
.social-network a.icoRss:hover i, .social-network a.icoFacebook:hover i, .social-network a.icoTwitter:hover i, .social-network a.icoRss:hover i,
.social-network a.icoGoogle:hover i, .social-network a.icoVimeo:hover i, .social-network a.icoLinkedin:hover i { .social-network a.icoFacebook:hover i,
color:#fff; .social-network a.icoTwitter:hover i,
.social-network a.icoGoogle:hover i,
.social-network a.icoVimeo:hover i,
.social-network a.icoLinkedin:hover i {
color: #fff;
} }
a.socialIcon:hover, .socialHoverClass { a.socialIcon:hover,
color:#44BCDD; .socialHoverClass {
color: #44BCDD;
} }
.social-circle li a { .social-circle li a {
display:inline-block; display: inline-block;
position:relative; position: relative;
margin:0 auto 0 auto; margin: 0 auto 0 auto;
-moz-border-radius:50%; -moz-border-radius: 50%;
-webkit-border-radius:50%; -webkit-border-radius: 50%;
border-radius:50%; border-radius: 50%;
text-align:center; text-align: center;
width: 30px; width: 30px;
height: 30px; height: 30px;
font-size:15px; font-size: 15px;
} }
.social-circle li i { .social-circle li i {
margin:0; margin: 0;
line-height:30px; line-height: 30px;
text-align: center; text-align: center;
} }
.social-circle li a:hover i,
.social-circle li a:hover i, .triggeredHover { .triggeredHover {
-moz-transform: rotate(360deg); -moz-transform: rotate(360deg);
-webkit-transform: rotate(360deg); -webkit-transform: rotate(360deg);
-ms--transform: rotate(360deg); -ms--transform: rotate(360deg);
transform: rotate(360deg); transform: rotate(360deg);
-webkit-transition: all 0.2s; -webkit-transition: all 0.2s;
-moz-transition: all 0.2s; -moz-transition: all 0.2s;
-o-transition: all 0.2s; -o-transition: all 0.2s;
-ms-transition: all 0.2s; -ms-transition: all 0.2s;
transition: all 0.2s; transition: all 0.2s;
} }
.social-circle i { .social-circle i {
color: #fff; color: #fff;
-webkit-transition: all 0.8s; -webkit-transition: all 0.8s;
-moz-transition: all 0.8s; -moz-transition: all 0.8s;
-o-transition: all 0.8s; -o-transition: all 0.8s;
-ms-transition: all 0.8s; -ms-transition: all 0.8s;
transition: all 0.8s; transition: all 0.8s;
}.social-circle a {
background-color: #D3D3D3;
} }
#shareDiv,
.social-circle a { #shareDiv .tabbable-panel {
background-color: #D3D3D3;
}
#shareDiv, #shareDiv .tabbable-panel{
border-width: 0; border-width: 0;
} }

View file

@ -18,7 +18,7 @@
var webSiteRootURL = '<?php echo $global['webSiteRootURL']; ?>'; var webSiteRootURL = '<?php echo $global['webSiteRootURL']; ?>';
</script> </script>
<?php <?php
if(!$config->getDisable_analytics()){ if (!$config->getDisable_analytics()) {
?> ?>
<script> <script>
// YouPHPTube Analytics // YouPHPTube Analytics

View file

@ -29,10 +29,9 @@ $playlistVideos = PlayList::getVideosFromPlaylist($playlist_id);
foreach ($playlistVideos as $value) { foreach ($playlistVideos as $value) {
$class = ""; $class = "";
$indicator = $count+1; $indicator = $count+1;
if($count==$playlist_index){ if ($count==$playlist_index) {
$class .= " active"; $class .= " active";
$indicator = '<span class="fa fa-play text-danger"></span>'; $indicator = '<span class="fa fa-play text-danger"></span>';
} }
?> ?>
<li class="<?php echo $class; ?>"> <li class="<?php echo $class; ?>">

View file

@ -29,33 +29,33 @@ foreach ($files as $value) {
break; break;
} }
} }
if($obj->orphan){ if ($obj->orphan) {
if(!empty($_GET['delete'])){ if (!empty($_GET['delete'])) {
$file = $dir.$obj->dirFilename; $file = $dir.$obj->dirFilename;
unlink($file); unlink($file);
}else{ } else {
$arrayOrphan[] = $obj; $arrayOrphan[] = $obj;
} }
}else{ } else {
$arrayNotOrphan[] = $obj; $arrayNotOrphan[] = $obj;
} }
$array[] = $obj; $array[] = $obj;
/* /*
$file = "{$global['systemRootPath']}videos/original_{$video['filename']}"; $file = "{$global['systemRootPath']}videos/original_{$video['filename']}";
if(file_exists($file)){ if (file_exists($file)) {
unlink($file); unlink($file);
} }
$file = "{$global['systemRootPath']}videos/{$video['filename']}.{$value}"; $file = "{$global['systemRootPath']}videos/{$video['filename']}.{$value}";
if(file_exists($file)){ if (file_exists($file)) {
unlink($file); unlink($file);
} }
$file = "{$global['systemRootPath']}videos/{$video['filename']}_progress_{$value}.txt"; $file = "{$global['systemRootPath']}videos/{$video['filename']}_progress_{$value}.txt";
if(file_exists($file)){ if (file_exists($file)) {
unlink($file); unlink($file);
} }
$file = "{$global['systemRootPath']}videos/{$video['filename']}.jpg"; $file = "{$global['systemRootPath']}videos/{$video['filename']}.jpg";
if(file_exists($file)){ if (file_exists($file)) {
unlink($file); unlink($file);
} }
* */ * */
} }
@ -63,7 +63,7 @@ foreach ($files as $value) {
function getMainName($filename) { function getMainName($filename) {
preg_match("/([a-z0-9_]{1,}(\.[a-z0-9_]{5,})?)(\.[a-z0-9]{0,4})?$/i", $filename, $matches); preg_match("/([a-z0-9_]{1,}(\.[a-z0-9_]{5,})?)(\.[a-z0-9]{0,4})?$/i", $filename, $matches);
$parts = explode("_progress_", $matches[1]); $parts = explode("_progress_", $matches[1]);
if(preg_match("/original_.*/", $parts[0])){ if (preg_match("/original_.*/", $parts[0])) {
$parts = explode("original_", $parts[0]); $parts = explode("original_", $parts[0]);
return $parts[1]; return $parts[1];
} }
@ -86,14 +86,14 @@ function getMainName($filename) {
<div class="container"> <div class="container">
<?php <?php
if(empty($arrayOrphan)){ if (empty($arrayOrphan)) {
?> ?>
<h1 class="alert alert-success"> <h1 class="alert alert-success">
<?php echo __("You dont have any orphan file"); ?> <?php echo __("You dont have any orphan file"); ?>
</h1> </h1>
<?php <?php
}else{ } else {
?> ?>
<ul class="list-group"> <ul class="list-group">
<a href="#" id="deleteAll" class="list-group-item list-group-item-danger"><?php echo __("Delete All Orphans Files"); ?> <span class="badge"><?php echo count($arrayOrphan); ?></span> </a> <a href="#" id="deleteAll" class="list-group-item list-group-item-danger"><?php echo __("Delete All Orphans Files"); ?> <span class="badge"><?php echo count($arrayOrphan); ?></span> </a>

View file

@ -2,7 +2,7 @@
require_once '../videos/configuration.php'; require_once '../videos/configuration.php';
require_once $global['systemRootPath'] . 'objects/video.php'; require_once $global['systemRootPath'] . 'objects/video.php';
$video = Video::getVideo(); $video = Video::getVideo();
if(empty($video)){ if (empty($video)) {
die(__("Video not found")); die(__("Video not found"));
} }