1
0
Fork 0
mirror of https://github.com/DanielnetoDotCom/YouPHPTube synced 2025-10-03 09:49:28 +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

@ -56,5 +56,7 @@ function getEnabledLangs() {
function textToLink($string) {
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
abstract class Object{
abstract static protected function getTableName();
@ -16,7 +15,6 @@ abstract class Object{
return true;
}
function __construct($id) {
if (!empty($id)) {
// get data from id
@ -55,7 +53,6 @@ abstract class Object{
return $rows;
}
static function getTotal() {
//will receive
//current=1&rowCount=10&sort[sender]=asc&searchPhrase=
@ -182,4 +179,3 @@ abstract class Object{
return $rows;
}
}

View file

@ -1,5 +1,4 @@
<?php
class BootGrid {
static function getSqlFromPost($searchFieldsNames = array(), $keyPrefix = "") {
@ -45,6 +44,4 @@ class BootGrid {
return $sql;
}
}

View file

@ -1,7 +1,6 @@
<?php
if (empty($global['systemRootPath'])) {
$global['systemRootPath'] = "../";
$global['systemRootPath'] = '../';
}
require_once $global['systemRootPath'] . 'videos/configuration.php';
class Captcha{
@ -20,19 +19,28 @@ class Captcha{
public function getCaptchaImage() {
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
$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
$branco = imagecolorallocate($imagem, 255, 255, 255); // define a cor branca
// 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));
$_SESSION["palavra"] = $palavra; // atribui para a sessao a palavra gerada
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
imagedestroy($imagem); // limpa a imagem da memoria
@ -42,12 +50,7 @@ class Captcha{
if (session_status() == PHP_SESSION_NONE) {
session_start();
}
if (strcasecmp($word, $_SESSION["palavra"])==0){
return true;
}else{
return false;
}
return (strcasecmp($word, $_SESSION["palavra"]) == 0);
}
}

View file

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

View file

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

View file

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

View file

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

View file

@ -1,6 +1,6 @@
<?php
if (empty($global['systemRootPath'])) {
$global['systemRootPath'] = "../";
$global['systemRootPath'] = '../';
}
require_once $global['systemRootPath'] . 'videos/configuration.php';
require_once $global['systemRootPath'] . 'objects/bootGrid.php';
@ -77,12 +77,7 @@ class Comment{
$id = intval($id);
$sql = "SELECT * FROM comments WHERE id = $id LIMIT 1";
$res = $global['mysqli']->query($sql);
if ($res) {
$comment = $res->fetch_assoc();
} else {
$comment = false;
}
return $comment;
return ($res) ? $res->fetch_assoc() : false;
}
static function getAllComments($videoId = 0) {
@ -116,14 +111,11 @@ class Comment{
if (!empty($videoId)) {
$sql .= " AND videos_id = {$videoId} ";
}
$sql .= BootGrid::getSqlSearchFromPost(array('name'));
$res = $global['mysqli']->query($sql);
return $res->num_rows;
}
}

View file

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

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>';
}
echo '{ "current": '.$_POST['current'].',"rowCount": '.$_POST['rowCount'].', "total": '.$total.', "rows":'. json_encode($comments).'}';

View file

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

View file

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

View file

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

View file

@ -1,11 +1,10 @@
<?php
require_once 'captcha.php';
$largura = empty($_GET["l"])?120:$_GET["l"]; // recebe a largura
$altura = empty($_GET["a"])?40:$_GET["a"]; // recebe a altura
$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á
$largura = empty($_GET['l']) ? 120 : $_GET['l']; // recebe a largura
$altura = empty($_GET['a']) ? 40 : $_GET['a']; // recebe a altura
$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á
$capcha = new Captcha($largura, $altura, $tamanho_fonte, $quantidade_letras);
$capcha->getCaptchaImage();
?>

View file

@ -3,7 +3,6 @@ ini_set('error_log', $global['systemRootPath'].'videos/youphptube.log');
global $global;
global $config;
$global['mysqli'] = new mysqli($mysqlHost, $mysqlUser,$mysqlPass,$mysqlDatabase,@$mysqlPort);
$now = new DateTime();

View file

@ -1,6 +1,6 @@
<?php
if (empty($global['systemRootPath'])) {
$global['systemRootPath'] = "../";
$global['systemRootPath'] = '../';
}
require_once $global['systemRootPath'].'videos/configuration.php';
require_once $global['systemRootPath'].'objects/user.php';
@ -36,8 +36,9 @@ class Like{
private function load() {
$like = $this->getLike();
if (empty($like))
if (empty($like)) {
return false;
}
foreach ($like as $key => $value) {
$this->$key = $value;
}
@ -51,11 +52,7 @@ class Like{
}
$sql = "SELECT * FROM likes WHERE users_id = $this->users_id AND videos_id = $this->videos_id LIMIT 1";
$res = $global['mysqli']->query($sql);
if ($res) {
return $res->fetch_assoc();
} else {
return false;
}
return ($res) ? $res->fetch_assoc() : false;
}
private function save() {
@ -88,21 +85,19 @@ class Like{
$sql = "SELECT count(*) as total FROM likes WHERE videos_id = {$videos_id} AND `like` = 1 "; // like
$res = $global['mysqli']->query($sql);
if ($res) {
$row = $res->fetch_assoc();
$obj->likes = intval($row['total']);
} else {
if (!$res) {
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
$res = $global['mysqli']->query($sql);
if ($res) {
$row = $res->fetch_assoc();
$obj->dislikes = intval($row['total']);
} else {
if (!$res) {
die($sql.'\nError : (' . $global['mysqli']->errno . ') ' . $global['mysqli']->error);
}
$row = $res->fetch_assoc();
$obj->dislikes = intval($row['total']);
return $obj;
}
@ -116,9 +111,8 @@ class Like{
$res = $global['mysqli']->query($sql);
if ($row = $res->fetch_assoc()) {
return intval($row['like']);
}else{
return 0;
}
return 0;
}
}

View file

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

View file

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

View file

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

View file

@ -40,5 +40,4 @@ if (!$mail->send()) {
$obj->success = __("Message sent");
}
echo json_encode($obj);

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -1,5 +1,4 @@
<?php
require_once 'subscribe.php';
header('Content-Type: application/json');
$obj = new stdClass();

View file

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

View file

@ -1,5 +1,4 @@
<?php
require_once 'subscribe.php';
if (!User::isLogged()) {
return false;

View file

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

View file

@ -1,7 +1,6 @@
<?php
if (empty($global['systemRootPath'])) {
$global['systemRootPath'] = "../";
$global['systemRootPath'] = '../';
}
require_once $global['systemRootPath'] . 'videos/configuration.php';
require_once $global['systemRootPath'] . 'objects/bootGrid.php';
@ -123,7 +122,6 @@ class User {
}
} elseif (self::isLogged()) {
$photo = $_SESSION['user']['photoURL'];
}
if (preg_match("/videos\/userPhoto\/.*/", $photo)) {
$photo = $global['webSiteRootURL'].$photo;
@ -516,6 +514,4 @@ class User {
$this->backgroundURL = strip_tags($backgroundURL);
}
}

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -1,7 +1,7 @@
<?php
header('Content-Type: application/json');
if (empty($global['systemRootPath'])) {
$global['systemRootPath'] = "../";
$global['systemRootPath'] = '../';
}
require_once $global['systemRootPath'] . 'videos/configuration.php';
require_once $global['systemRootPath'] . 'objects/user.php';
@ -49,4 +49,3 @@ $user->setBackgroundURL($photoURL);
$user->save();
User::updateSessionInfo();
print json_encode($response);
?>

View file

@ -1,8 +1,7 @@
<?php
header('Content-Type: application/json');
if (empty($global['systemRootPath'])) {
$global['systemRootPath'] = "../";
$global['systemRootPath'] = '../';
}
require_once $global['systemRootPath'] . 'videos/configuration.php';
require_once $global['systemRootPath'] . 'objects/user.php';
@ -50,4 +49,3 @@ $user->setPhotoURL($photoURL);
$user->save();
User::updateSessionInfo();
print json_encode($response);
?>

View file

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

View file

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

View file

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

View file

@ -294,7 +294,11 @@ class Video {
$sql .= " ORDER BY v.Created DESC ";
}
$sql .= " LIMIT 1";
//if(!empty($random))echo "<hr>".$sql;
/*
if (!empty($random)) {
echo '<hr />'.$sql;
}
*/
$res = $global['mysqli']->query($sql);
if ($res) {
require_once 'userGroups.php';
@ -622,11 +626,11 @@ class Video {
return "00:00:00";
} else {
$duration = $durationParts[0];
$durationParts = explode(":", $duration);
$durationParts = explode(':', $duration);
if (count($durationParts) == 1) {
return "0:00:".static::addZero($durationParts[0]);
return '0:00:'.static::addZero($durationParts[0]);
} 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;
}
@ -634,16 +638,15 @@ class Video {
static private function addZero($str) {
if (intval($str) < 10) {
return "0".intval($str);
}else{
return '0'.intval($str);
}
return $str;
}
}
static function getItemPropDuration($duration = "") {
static function getItemPropDuration($duration = '') {
$duration = static::getCleanDuration($duration);
$parts = explode(":", $duration);
return "PT" . intval($parts[0]) . "H" . intval($parts[1]) . "M" . intval($parts[2]) . "S";
$parts = explode(':', $duration);
return 'PT' . intval($parts[0]) . 'H' . intval($parts[1]) . 'M' . intval($parts[2]) . 'S';
}

View file

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

View file

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

View file

@ -1,9 +1,7 @@
<?php
header('Content-Type: application/json');
if (empty($global['systemRootPath'])) {
$global['systemRootPath'] = "../";
$global['systemRootPath'] = '../';
}
require_once $global['systemRootPath'] . 'videos/configuration.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");
echo json_encode($obj2);
}

View file

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

View file

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

View file

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

View file

@ -55,7 +55,7 @@ class Video_ad {
die('{"error":"' . __("Permission denied") . '"}');
}
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)) {
return false;

View file

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

View file

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

View file

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

View file

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

View file

@ -7,8 +7,8 @@ $showOnlyLoggedUserVideos = true;
if (User::isAdmin()) {
$showOnlyLoggedUserVideos = false;
}
$videos = Video::getAllVideos("", $showOnlyLoggedUserVideos, true);
$total = Video::getTotalVideos("", $showOnlyLoggedUserVideos, true);
$videos = Video::getAllVideos('', $showOnlyLoggedUserVideos, true);
$total = Video::getTotalVideos('', $showOnlyLoggedUserVideos, true);
foreach ($videos as $key => $value) {
$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>";

View file

@ -90,12 +90,7 @@ error_log("Files Received for video {$video_id}: ".$video->getTitle());
die(json_encode($obj));
/*
error_log(print_r($_POST, true));
error_log(print_r($_FILES, true));
var_dump($_POST, $_FILES);
*/

View file

@ -3,7 +3,7 @@ header('Content-Type: application/json');
$obj = new stdClass();
$obj->error = true;
if (empty($global['systemRootPath'])) {
$global['systemRootPath'] = "../";
$global['systemRootPath'] = '../';
}
require_once $global['systemRootPath'] . 'videos/configuration.php';
require_once $global['systemRootPath'] . 'objects/user.php';
@ -122,7 +122,7 @@ if (isset($_FILES['upl']) && $_FILES['upl']['error'] == 0) {
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
$queue = array();
if ($video->getType() == 'video') {
@ -159,8 +159,3 @@ if (isset($_FILES['upl']) && $_FILES['upl']['error'] == 0) {
//echo '{"status":"error", "msg":' . json_encode($_FILES) . ', "type":"$_FILES Error"}';
status(["status" => "error", "msg" => print_r($_FILES,true), "type" => '$_FILES Error']);
exit;

View file

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

View file

@ -9,13 +9,10 @@ body {
body {
padding-top: 60px;
}
.nopadding {
padding: 0 !important;
margin: 0 !important;
}
.videoLink .duration {
position: absolute;
background: rgba(0, 0, 0, 0.6)!important;
@ -35,31 +32,30 @@ body {
color: rgba(255, 255, 255, 0.3)!important;
font-size: 50px;
}
.videoLink div {
transition: all 0.3s ease-in-out;
font-size: 1em;
}
.videoLink div.details, .videoLink div.details div{
.videoLink div.details,
.videoLink div.details div {
font-size: 0.9em;
}
.gallery:hover .glyphicon-play-circle, .videoLink:hover .glyphicon-play-circle{
.gallery:hover .glyphicon-play-circle,
.videoLink:hover .glyphicon-play-circle {
color: rgba(255, 255, 255, 0.6)!important;
}
.bottom-border {
border-bottom: 2px solid #F2F2F2;
margin: 0;
padding: 5px;
}
h1,h2,h3,h4{
h1,
h2,
h3,
h4 {
margin: 5px;
padding: 5px;
}
h1 {
font-size: 20px;
}
@ -72,7 +68,6 @@ h3{
h4 {
font-size: 14px;
}
footer {
color: #444;
padding: 25px;
@ -97,7 +92,6 @@ footer .btn-outline {
}
/* for main video */
.video-content {
flex: 0 1 100%;
height: 50%;
@ -110,7 +104,6 @@ footer .btn-outline {
}
/* end for main video */
.form-compact .form-control {
position: relative;
height: auto;
@ -124,16 +117,17 @@ footer .btn-outline {
border-radius: 0;
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-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-right-radius: 5px;
margin-bottom: 10px;
}
@media (max-width: 767px) {
.navbar-form {
padding: 0;
@ -175,17 +169,21 @@ footer .btn-outline {
border: 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;
}
.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;
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;
}
.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;
}
.tabbable-line > .nav-tabs > li.active {
@ -213,7 +211,6 @@ footer .btn-outline {
.nowrapCell td {
white-space: normal !important;
}
.watch8-action-buttons {
padding: 5px 10px 0 10px;
margin: 5px 0 0 0;
@ -229,24 +226,20 @@ footer .btn-outline {
overflow: hidden;
text-overflow: ellipsis;
}
.no-outline {
border: 0;
}
.no-outline:focus,
.no-outline:active,
.no-outline:hover {
background-color: transparent;
color: #000;
}
#showMore {
padding: 20px;
margin: 10px;
border-top: 2px solid #F2F2F2;
}
.watch-view-count {
line-height: 24px;
max-height: 24px;
@ -256,11 +249,12 @@ footer .btn-outline {
padding: -5px;
border-bottom: 2px solid #167ac6;
}
#likeBtn.myVote span, #likeBtn.myVote small {
#likeBtn.myVote span,
#likeBtn.myVote small {
color: #167ac6;
}
#dislikeBtn.myVote span, #dislikeBtn.myVote small {
#dislikeBtn.myVote span,
#dislikeBtn.myVote small {
color: #444;
}
@ -268,14 +262,12 @@ footer .btn-outline {
.material-switch > input[type="checkbox"] {
display: none;
}
.material-switch > label {
cursor: pointer;
height: 0px;
position: relative;
width: 40px;
}
.material-switch > label::before {
background: rgb(0, 0, 0);
box-shadow: inset 0px 0px 10px rgba(0, 0, 0, 0.5);
@ -311,7 +303,6 @@ footer .btn-outline {
}
/* fancy checkbox end */
.label.fix-width {
min-width: 130px !important;
display: inline-block !important;
@ -324,18 +315,19 @@ footer .btn-outline {
text-align: right;
border-top-right-radius: 0;
border-bottom-right-radius: 0;
border-top-left-radius: 0.25em;;
border-bottom-left-radius: 0.25em;;
border-top-left-radius: 0.25em;
;
border-bottom-left-radius: 0.25em;
;
}
.popover-content, .popover-title, .popover{
.popover-content,
.popover-title,
.popover {
color: #333 !important;
}
.videosDetails {
padding-left: 20px;
}
.divMainVideo .duration {
position: absolute;
background: rgba(0, 0, 0, 0.6)!important;
@ -346,7 +338,6 @@ footer .btn-outline {
font-size: 0.9em;
border-radius: 5px;
}
.gallery .duration {
position: absolute;
background: rgba(0, 0, 0, 0.6)!important;
@ -357,8 +348,8 @@ footer .btn-outline {
font-size: 0.9em;
border-radius: 5px;
}
.gallery h2, .videosDetails .title{
.gallery h2,
.videosDetails .title {
font-size: 1em;
margin: 0;
padding: 0;
@ -369,9 +360,9 @@ footer .btn-outline {
max-height: 32px; /* fallback */
min-height: 32px; /* fallback */
-webkit-line-clamp: 2; /* number of lines to show */
-webkit-box-orient: vertical;
}
.gallery .watch-view-count {
font-size: 0.8em;
font-weight: normal;
@ -379,73 +370,88 @@ footer .btn-outline {
margin: 0;
padding: 0;
}
.galleryVideo {
overflow: hidden;
height: 190px;
border-bottom: solid 1px #EEE;
margin-bottom: 10px;
}
.galleryVideo .group {
overflow: hidden;
text-overflow: ellipsis;
}
.autoplay span span {
margin: 0 5px;
font-weight: bold;
}
img.rotate90, img.rotate-270{
img.rotate90,
img.rotate-270 {
transform: rotate(90deg);
-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 */
}
-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 {
background-color: #e62117;
color: #FFF;
}
.subscribeButton:hover, .subscribeButton:active, .subscribeButton:focus{
.subscribeButton:hover,
.subscribeButton:active,
.subscribeButton:focus {
background-color: #CC0000;
color: #FFF;
}
.subscribeButton span:before {
content: "\f16a";
}
.subscribeButton.subscribed {
background-color: #DDD;
color: #777;
}
.subscribeButton.subscribed span:before {
content: "\f00c";
}
.subscribeButton.subscribed:hover span:before {
content: "\f057";
}
.profileBg {
padding: 20px;
min-height: 200px;
@ -455,8 +461,6 @@ img.rotate270, img.rotate-90{
-o-background-size: cover;
background-size: cover;
}
#sidebar {
width: 300px;
position: absolute;
@ -483,7 +487,6 @@ img.rotate270, img.rotate-90{
.navbar-brand>img {
width: 120px;
}
.list-inline {
display: flex;
justify-content: left;
@ -518,7 +521,6 @@ nav ul.items-container li:first-child ul.left-side{
nav ul.items-container li:last-child {
margin-right: 20px;
}
nav ul.items-container li ul.right-menus {
display: flex;
flex-direction: row;
@ -528,7 +530,6 @@ nav ul.items-container li ul.right-menus li{
}
/** header **/
.navbar .container {
padding: 0 2px;
align-items: center;
@ -541,12 +542,12 @@ nav ul.items-container li ul.right-menus li{
display: flex;
align-items: center;
}
/* Play List */
.playlistList {
height: 400px;
overflow: hidden;
}
.playlistList .nav {
overflow-y: auto;
position: absolute;
@ -554,7 +555,6 @@ nav ul.items-container li ul.right-menus li{
height: 100%;
overflow-x: hidden;
}
.playlist-nav .navbar {
padding: 0;
max-height: none;
@ -608,11 +608,11 @@ nav ul.items-container li ul.right-menus li{
transition: all 0.3s ease-in-out;
border-radius: 10px;
}
#videoContainer {
overflow: visible;
background: black;
}
/** video manager progress bar */
.progress {
position: relative;
@ -632,7 +632,6 @@ nav ul.items-container li ul.right-menus li{
font-weight: 800;
padding: 3px 10px 2px;
}
.loader {
border: 5px solid #f3f3f3; /* Light grey */
border-top: 5px solid #3498db; /* Blue */
@ -641,12 +640,14 @@ nav ul.items-container li ul.right-menus li{
height: 30px;
animation: spin 2s linear infinite;
}
@keyframes spin {
0% { transform: rotate(0deg); }
100% { transform: rotate(360deg); }
0% {
transform: rotate(0deg);
}
100% {
transform: rotate(360deg);
}
}
@media (max-width: 1200px) {
.floatVideo {
width: 500px;
@ -663,7 +664,6 @@ nav ul.items-container li ul.right-menus li{
height: 220px;
}
}
@media (max-width: 850px) {
.galleryVideo {
height: 180px;

View file

@ -1,10 +1,16 @@
.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: -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 */
}
background: -moz-linear-gradient(top, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 0.65) 100%);
/* FF3.6-15 */
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 {
color: #f12b24;
background-color: #f12b24;
@ -12,7 +18,6 @@ filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#00000000', e
.video-js:hover .vjs-play-progress {
font-size: 1em !important;
}
.video-js .vjs-big-play-button {
height: 1.5em;
width: 1.5em;
@ -25,7 +30,6 @@ filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#00000000', e
-o-transition: all 0.4s;
transition: all 0.4s;
}
.video-js:hover .vjs-big-play-button,
.video-js .vjs-big-play-button:focus {
background-color: rgba(200, 200, 200, 0.3);
@ -34,24 +38,20 @@ filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#00000000', e
-o-transition: all 0.4s;
transition: all 0.4s;
}
.video-js .vjs-mouse-display:after, .video-js .vjs-play-progress:after, .video-js .vjs-time-tooltip{
.video-js .vjs-mouse-display:after,
.video-js .vjs-play-progress:after,
.video-js .vjs-time-tooltip {
background: rgba(0, 0, 0, 0.6)!important;
padding: 2px;
color: #FFF;
font-size: 12px !important;
}
.video-js .vjs-load-progress {
background-color: rgba(159, 159, 159, .8);
}
.video-js .vjs-slider-horizontal {
background-color: rgba(159, 159, 159, .3);
}
.vjs-rotate90 {
rotate: 90;
zoom: 1.0;
@ -93,30 +93,24 @@ filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#00000000', e
background-color: rgba(0, 0, 0, 0.9);
border: 1px solid #DDD;
}
.adControl {
display: none;
}
.ad .video-js .vjs-play-progress {
color: #FC0;
background-color: #FC0;
}
.ad .vjs-progress-control * {
pointer-events: none !important;
}
.ad .adControl {
display: block;
}
/* End Ad Elements */
.img-portrait {
transform: scale(0.56) rotate(90deg);
}
.embed-responsive-9by16 {
padding-bottom: 100%;
}

View file

@ -1,5 +1,3 @@
/*=========================
Icons
================= */
@ -16,7 +14,6 @@ ul.social-network li {
margin: 0 5px;
}
/* footer social icons */
.social-network a.icoRss:hover {
background-color: #F56505;
@ -36,14 +33,18 @@ ul.social-network li {
.social-network a.icoLinkedin:hover {
background-color: #007bb7;
}
.social-network a.icoRss:hover i, .social-network a.icoFacebook:hover i, .social-network a.icoTwitter:hover i,
.social-network a.icoGoogle:hover i, .social-network a.icoVimeo:hover i, .social-network a.icoLinkedin:hover i {
.social-network a.icoRss:hover i,
.social-network a.icoFacebook:hover i,
.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,
.socialHoverClass {
color: #44BCDD;
}
.social-circle li a {
display: inline-block;
position: relative;
@ -61,8 +62,8 @@ a.socialIcon:hover, .socialHoverClass {
line-height: 30px;
text-align: center;
}
.social-circle li a:hover i, .triggeredHover {
.social-circle li a:hover i,
.triggeredHover {
-moz-transform: rotate(360deg);
-webkit-transform: rotate(360deg);
-ms--transform: rotate(360deg);
@ -80,12 +81,10 @@ a.socialIcon:hover, .socialHoverClass {
-o-transition: all 0.8s;
-ms-transition: all 0.8s;
transition: all 0.8s;
}
.social-circle a {
}.social-circle a {
background-color: #D3D3D3;
}
#shareDiv, #shareDiv .tabbable-panel{
#shareDiv,
#shareDiv .tabbable-panel {
border-width: 0;
}

View file

@ -32,7 +32,6 @@ $playlistVideos = PlayList::getVideosFromPlaylist($playlist_id);
if ($count==$playlist_index) {
$class .= " active";
$indicator = '<span class="fa fa-play text-danger"></span>';
}
?>
<li class="<?php echo $class; ?>">