1
0
Fork 0
mirror of https://github.com/DanielnetoDotCom/YouPHPTube synced 2025-10-03 09:49:28 +02:00

Remove unecessary mysql_connect

This commit is contained in:
Daniel Neto 2025-04-13 16:49:35 -03:00
parent 8e24038533
commit f3d50e60e0
7 changed files with 45 additions and 45 deletions

View file

@ -1282,7 +1282,7 @@ if (!class_exists('Video')) {
$videosArrayId = VideoTags::getAllVideosIdFromTagsId($_GET['tags_id']); $videosArrayId = VideoTags::getAllVideosIdFromTagsId($_GET['tags_id']);
} }
} }
_mysql_connect(); //_mysql_connect();
$sql = "SELECT STRAIGHT_JOIN u.*, u.externalOptions as userExternalOptions, v.*, " $sql = "SELECT STRAIGHT_JOIN u.*, u.externalOptions as userExternalOptions, v.*, "
. " nv.title as next_title," . " nv.title as next_title,"
. " nv.clean_title as next_clean_title," . " nv.clean_title as next_clean_title,"

View file

@ -1856,7 +1856,7 @@ class AVideoPlugin
public static function onUserSocketConnect() public static function onUserSocketConnect()
{ {
_mysql_connect(); //_mysql_connect();
$plugins = Plugin::getAllEnabled(); $plugins = Plugin::getAllEnabled();
foreach ($plugins as $value) { foreach ($plugins as $value) {
self::YPTstart(); self::YPTstart();
@ -1871,7 +1871,7 @@ class AVideoPlugin
public static function onUserSocketDisconnect() public static function onUserSocketDisconnect()
{ {
_mysql_connect(); //_mysql_connect();
$plugins = Plugin::getAllEnabled(); $plugins = Plugin::getAllEnabled();
foreach ($plugins as $value) { foreach ($plugins as $value) {
self::YPTstart(); self::YPTstart();

View file

@ -282,7 +282,7 @@ class CDNStorage
public static function setSite($videos_id, $isOnTheStorage) public static function setSite($videos_id, $isOnTheStorage)
{ {
_mysql_connect(); //_mysql_connect();
$v = new Video('', '', $videos_id); $v = new Video('', '', $videos_id);
if ($isOnTheStorage) { if ($isOnTheStorage) {
$site = self::getOrCreateSite(); $site = self::getOrCreateSite();

View file

@ -232,7 +232,7 @@ class LiveTransmition extends ObjectYPT {
public static function getFromDbByUserName($userName) { public static function getFromDbByUserName($userName) {
global $global; global $global;
_mysql_connect(); //_mysql_connect();
$sql = "SELECT * FROM users WHERE user = ? LIMIT 1"; $sql = "SELECT * FROM users WHERE user = ? LIMIT 1";
$res = sqlDAL::readSql($sql, "s", [$userName]); $res = sqlDAL::readSql($sql, "s", [$userName]);
$data = sqlDAL::fetchAssoc($res); $data = sqlDAL::fetchAssoc($res);
@ -252,7 +252,7 @@ class LiveTransmition extends ObjectYPT {
public static function getFromDbByChannelName($channelName, $allowOnlineIndex = false) { public static function getFromDbByChannelName($channelName, $allowOnlineIndex = false) {
global $global; global $global;
_mysql_connect(); //_mysql_connect();
$sql = "SELECT * FROM users WHERE channelName = ? LIMIT 1"; $sql = "SELECT * FROM users WHERE channelName = ? LIMIT 1";
$res = sqlDAL::readSql($sql, "s", [$channelName]); $res = sqlDAL::readSql($sql, "s", [$channelName]);
$data = sqlDAL::fetchAssoc($res); $data = sqlDAL::fetchAssoc($res);

View file

@ -76,7 +76,7 @@ class LiveLinks extends PluginAbstract {
static function getAllActive($future = false, $activeOnly = true, $notStarted = false, $users_id=0, $categories_id=0) { static function getAllActive($future = false, $activeOnly = true, $notStarted = false, $users_id=0, $categories_id=0) {
global $global; global $global;
_mysql_connect(); //_mysql_connect();
$sql = "SELECT * FROM LiveLinks WHERE 1=1 "; $sql = "SELECT * FROM LiveLinks WHERE 1=1 ";
if (!empty($future)) { if (!empty($future)) {
@ -101,11 +101,11 @@ class LiveLinks extends PluginAbstract {
$sql .= " ORDER BY start_php_time"; $sql .= " ORDER BY start_php_time";
//echo $sql;//exit; //echo $sql;//exit;
/** /**
* *
* @var array $global * @var array $global
* @var object $global['mysqli'] * @var object $global['mysqli']
*/ */
$res = $global['mysqli']->query($sql); $res = $global['mysqli']->query($sql);
$rows = array(); $rows = array();
@ -146,13 +146,13 @@ class LiveLinks extends PluginAbstract {
} }
/** /**
* *
* @return string array(array("key"=>'live key', "users"=>false, "name"=>$userName, "user"=>$user, "photo"=>$photo, "UserPhoto"=>$UserPhoto, "title"=>'')); * @return string array(array("key"=>'live key', "users"=>false, "name"=>$userName, "user"=>$user, "photo"=>$photo, "UserPhoto"=>$UserPhoto, "title"=>''));
*/ */
public function getLiveApplicationArray() { public function getLiveApplicationArray() {
global $global; global $global;
$liveUsers = AVideoPlugin::isEnabledByName('LiveUsers'); $liveUsers = AVideoPlugin::isEnabledByName('LiveUsers');
$rows = LiveLinks::getAllActive(true, true); $rows = LiveLinks::getAllActive(true, true);
$array = array(); $array = array();
foreach ($rows as $value) { foreach ($rows as $value) {
@ -165,10 +165,10 @@ class LiveLinks extends PluginAbstract {
continue; continue;
} }
} }
$label = ($liveUsers ? getLiveUsersLabelLiveLinks($value['id']) : ''); $label = ($liveUsers ? getLiveUsersLabelLiveLinks($value['id']) : '');
//var_dump( self::getPosterToLiveFromId($value['id']),$value['id'] );exit; //var_dump( self::getPosterToLiveFromId($value['id']),$value['id'] );exit;
$_array = array( $_array = array(
'users_id'=>$value['users_id'], 'users_id'=>$value['users_id'],
'title'=>$value['title'], 'title'=>$value['title'],
@ -183,7 +183,7 @@ class LiveLinks extends PluginAbstract {
'class'=>'', 'class'=>'',
'description'=>$value['description'] 'description'=>$value['description']
); );
$row = Live::getLiveApplicationModelArray($_array); $row = Live::getLiveApplicationModelArray($_array);
//var_dump($row);exit; //var_dump($row);exit;
$row['categories_id'] = $value['categories_id']; $row['categories_id'] = $value['categories_id'];
@ -194,7 +194,7 @@ class LiveLinks extends PluginAbstract {
$row['expires'] = strtotime($row['end_date_my_timezone']); $row['expires'] = strtotime($row['end_date_my_timezone']);
$row['isRebroadcast'] = !empty($value['isRebroadcast']); $row['isRebroadcast'] = !empty($value['isRebroadcast']);
$array[] = $row; $array[] = $row;
} }
//var_dump($rows, $array);exit; //var_dump($rows, $array);exit;
return $array; return $array;
@ -437,7 +437,7 @@ class LiveLinks extends PluginAbstract {
if (empty($user_groups_ids)) { if (empty($user_groups_ids)) {
return true; return true;
} }
if (empty($users_id)) { if (empty($users_id)) {
return false; return false;
} }
@ -474,14 +474,14 @@ class LiveLinks extends PluginAbstract {
$t['description'] = @$video->description; $t['description'] = @$video->description;
return $t; return $t;
} }
public static function getMediaSession($id) { public static function getMediaSession($id) {
$ll = new LiveLinksTable($id); $ll = new LiveLinksTable($id);
if(empty($ll->getUsers_id())){ if(empty($ll->getUsers_id())){
return false; return false;
} }
$posters = array(); $posters = array();
//var_dump($posters);exit; //var_dump($posters);exit;
$category = Category::getCategory($ll->getCategories_id()); $category = Category::getCategory($ll->getCategories_id());
@ -491,14 +491,14 @@ class LiveLinks extends PluginAbstract {
$MediaMetadata->artist = User::getNameIdentificationById($ll->getUsers_id()); $MediaMetadata->artist = User::getNameIdentificationById($ll->getUsers_id());
$MediaMetadata->album = $category['name']; $MediaMetadata->album = $category['name'];
$MediaMetadata->artwork = array(); $MediaMetadata->artwork = array();
$poster = LiveLinks::getImage($id); $poster = LiveLinks::getImage($id);
$MediaMetadata->artwork[] = array('src' => $poster, 'sizes' => "512x512", 'type' => 'image/jpg'); $MediaMetadata->artwork[] = array('src' => $poster, 'sizes' => "512x512", 'type' => 'image/jpg');
/* /*
foreach ($posters as $key => $value) { foreach ($posters as $key => $value) {
$MediaMetadata->artwork[] = array('src' => $value['url'], 'sizes' => "{$key}x{$key}", 'type' => 'image/jpg'); $MediaMetadata->artwork[] = array('src' => $value['url'], 'sizes' => "{$key}x{$key}", 'type' => 'image/jpg');
} }
* *
*/ */
return $MediaMetadata; return $MediaMetadata;
} }

View file

@ -5,7 +5,7 @@ require_once dirname(__FILE__) . '/../../../objects/bootGrid.php';
require_once dirname(__FILE__) . '/../../../objects/user.php'; require_once dirname(__FILE__) . '/../../../objects/user.php';
class Menu extends ObjectYPT { class Menu extends ObjectYPT {
static $typeLeftMenu = 1; static $typeLeftMenu = 1;
static $typeTopMenu = 2; static $typeTopMenu = 2;
static $typeActionMenu = 3; static $typeActionMenu = 3;
@ -18,14 +18,14 @@ class Menu extends ObjectYPT {
static $typeMobileTabMenuInABrowser = 10; static $typeMobileTabMenuInABrowser = 10;
static $typeMobileLeftMenuInABrowser = 11; static $typeMobileLeftMenuInABrowser = 11;
static $typeFloatMenu = 12; static $typeFloatMenu = 12;
static $typeName = array( static $typeName = array(
1=>'Left', 1=>'Left',
2=>'Top', 2=>'Top',
3=>'Action', 3=>'Action',
4=>'Action Per Video', 4=>'Action Per Video',
5=>'Action Per Video For Logged Users Only', 5=>'Action Per Video For Logged Users Only',
6=>'Action Per Video For Users That can Watch Video', 6=>'Action Per Video For Users That can Watch Video',
7=>'Action Per Video For Users That can NOT Watch Video', 7=>'Action Per Video For Users That can NOT Watch Video',
8=>'Mobile Tab Menu', 8=>'Mobile Tab Menu',
9=>'Mobile Left Menu', 9=>'Mobile Left Menu',
@ -42,7 +42,7 @@ class Menu extends ObjectYPT {
static function getTableName() { static function getTableName() {
return 'topMenu'; return 'topMenu';
} }
function setMenuName($menuName) { function setMenuName($menuName) {
$this->menuName = $menuName; $this->menuName = $menuName;
} }
@ -70,15 +70,15 @@ class Menu extends ObjectYPT {
function setType($type) { function setType($type) {
$this->type = $type; $this->type = $type;
} }
function setIcon($icon) { function setIcon($icon) {
$this->icon = $icon; $this->icon = $icon;
} }
function setmenuSeoUrl($menuSeoUrl){ function setmenuSeoUrl($menuSeoUrl){
$this->menuSeoUrl=$menuSeoUrl; $this->menuSeoUrl=$menuSeoUrl;
} }
static function getAllActive($type=false) { static function getAllActive($type=false) {
global $global; global $global;
if(empty($global)){ if(empty($global)){
@ -89,17 +89,17 @@ class Menu extends ObjectYPT {
$sql .= " AND type = $type "; $sql .= " AND type = $type ";
} }
$sql .= " ORDER BY menu_order "; $sql .= " ORDER BY menu_order ";
_mysql_connect(); //_mysql_connect();
$res = $global['mysqli']->query($sql); $res = $global['mysqli']->query($sql);
$rows = array(); $rows = array();
if ($res) { if ($res) {
while ($row = $res->fetch_assoc()) { while ($row = $res->fetch_assoc()) {
$rows[] = $row; $rows[] = $row;
} }
} }
return $rows; return $rows;
} }
function save() { function save() {
global $global; global $global;
if(empty($this->menuName)){ if(empty($this->menuName)){
@ -111,14 +111,14 @@ class Menu extends ObjectYPT {
if(empty($this->users_groups_id)){ if(empty($this->users_groups_id)){
$this->users_groups_id = 'null'; $this->users_groups_id = 'null';
} }
if(empty($this->menu_order)){ if(empty($this->menu_order)){
$this->menu_order = 0; $this->menu_order = 0;
} }
if(empty($this->status)){ if(empty($this->status)){
$this->status = "active"; $this->status = "active";
} }
if(empty($this->position)){ if(empty($this->position)){
$this->position = "right"; $this->position = "right";
} }
@ -128,11 +128,11 @@ class Menu extends ObjectYPT {
if(empty($this->menuSeoUrl)){ if(empty($this->menuSeoUrl)){
$this->menuSeoUrl=$this->menuName; $this->menuSeoUrl=$this->menuName;
} }
$this->menuSeoUrl=(preg_replace('/[^a-z0-9]+/', '_', strtolower($this->menuSeoUrl))); $this->menuSeoUrl=(preg_replace('/[^a-z0-9]+/', '_', strtolower($this->menuSeoUrl)));
return parent::save(); return parent::save();
} }
} }

View file

@ -102,7 +102,7 @@ function getTotalViewsLive_key($live_key) {
return false; return false;
} }
$live_key = object_to_array($live_key); $live_key = object_to_array($live_key);
_mysql_connect(); //_mysql_connect();
$liveUsersEnabled = \AVideoPlugin::isEnabledByName("LiveUsers"); $liveUsersEnabled = \AVideoPlugin::isEnabledByName("LiveUsers");
if ($liveUsersEnabled) { if ($liveUsersEnabled) {
$liveUsers = new \LiveOnlineUsers(0); $liveUsers = new \LiveOnlineUsers(0);