1
0
Fork 0
mirror of https://github.com/DanielnetoDotCom/YouPHPTube synced 2025-10-03 01:39:24 +02:00

Refactor.

This commit is contained in:
Caleb Mazalevskis 2022-01-06 21:44:07 +08:00
parent 343eb5e2cc
commit 27a7925b98
No known key found for this signature in database
GPG key ID: 082E6BC1046FAB95
316 changed files with 54291 additions and 53534 deletions

156
.gitignore vendored
View file

@ -1,78 +1,78 @@
/.scannerwork/
/YouPHPTube.code-workspace
/git.php
/iptvsource_one_one.csv
/nbproject/
/nbproject/private/
/plugin/AD_Server_Promote_Videos/
/plugin/AWS_S3/
/plugin/AudioTrackSwitcher/
/plugin/AudioVisualizer/
/plugin/AutoShare/
/plugin/Backup/
/plugin/Blackblaze_B2/
/plugin/Bookmark/
/plugin/Chat2/
/plugin/CountryRedirect/
/plugin/CreateUserManager/
/plugin/Customize/
/plugin/DIY/
/plugin/DiskUploadQuota/
/plugin/FTPAutoImport/
/plugin/FTP_Storage/
/plugin/FlixHouse/
/plugin/GoogleAds_IMA/
/plugin/IPDirectConnect/
/plugin/IPTV/
/plugin/ImportFromOtherVideoPlatform/
/plugin/Layout/hamburguerMenu.php
/plugin/Layout/navBarLateral.php
/plugin/Layout/navbar.php
/plugin/Layout/timer.php
/plugin/LifeStreamLayout/
/plugin/LiveCountdownEvent/
/plugin/LiveOnlineUsers/
/plugin/LiveUsers/
/plugin/Livesearch/
/plugin/LoginLDAP/
/plugin/LoginLDAP_DYNA/
/plugin/MP4ThumbsAndGif/
/plugin/MP4ThumbsAndGifLocal/
/plugin/Notifications/
/plugin/PayPalToWatch/
/plugin/PayPerView/
/plugin/PayPerViewLive/
/plugin/PointsSystem/
/plugin/PromoteVideos/
/plugin/ReturnToLastPosition/
/plugin/SecondLife/
/plugin/SecondWatch/
/plugin/SecureVideosDirectory/
/plugin/SendRecordedToEncoder/
/plugin/SignUpAgreement/
/plugin/Subscription/
/plugin/SubtitleSwitcher/
/plugin/SupportAuthor/
/plugin/Tecorio/
/plugin/User_Controll/
/plugin/VideoDocuments/
/plugin/VideoHLS/
/plugin/VideoResolutionSwitcher/
/plugin/VideoSpeed/
/plugin/VideoThumbnails/
/plugin/Video_Location_Block/
/plugin/YPTStorage/
/plugin/YouPHPTV/
/plugin/ZoomMeetingRecorder/
/plugin/oncologytube/
/plugin/predefinedCategory/
/plugin/FansSubscriptions/
/videos/
*.zip
sitemap.xml
/plugin/WebRTCLiveCam/
/plugin/Wix/
/plugin/Live/standAloneFiles/WebRTCServer/configuration.php
/plugin/Fishr/
/plugin/JoshWho/
.DS_Store
/.scannerwork/
/YouPHPTube.code-workspace
/git.php
/iptvsource_one_one.csv
/nbproject/
/nbproject/private/
/plugin/AD_Server_Promote_Videos/
/plugin/AWS_S3/
/plugin/AudioTrackSwitcher/
/plugin/AudioVisualizer/
/plugin/AutoShare/
/plugin/Backup/
/plugin/Blackblaze_B2/
/plugin/Bookmark/
/plugin/Chat2/
/plugin/CountryRedirect/
/plugin/CreateUserManager/
/plugin/Customize/
/plugin/DIY/
/plugin/DiskUploadQuota/
/plugin/FTPAutoImport/
/plugin/FTP_Storage/
/plugin/FlixHouse/
/plugin/GoogleAds_IMA/
/plugin/IPDirectConnect/
/plugin/IPTV/
/plugin/ImportFromOtherVideoPlatform/
/plugin/Layout/hamburguerMenu.php
/plugin/Layout/navBarLateral.php
/plugin/Layout/navbar.php
/plugin/Layout/timer.php
/plugin/LifeStreamLayout/
/plugin/LiveCountdownEvent/
/plugin/LiveOnlineUsers/
/plugin/LiveUsers/
/plugin/Livesearch/
/plugin/LoginLDAP/
/plugin/LoginLDAP_DYNA/
/plugin/MP4ThumbsAndGif/
/plugin/MP4ThumbsAndGifLocal/
/plugin/Notifications/
/plugin/PayPalToWatch/
/plugin/PayPerView/
/plugin/PayPerViewLive/
/plugin/PointsSystem/
/plugin/PromoteVideos/
/plugin/ReturnToLastPosition/
/plugin/SecondLife/
/plugin/SecondWatch/
/plugin/SecureVideosDirectory/
/plugin/SendRecordedToEncoder/
/plugin/SignUpAgreement/
/plugin/Subscription/
/plugin/SubtitleSwitcher/
/plugin/SupportAuthor/
/plugin/Tecorio/
/plugin/User_Controll/
/plugin/VideoDocuments/
/plugin/VideoHLS/
/plugin/VideoResolutionSwitcher/
/plugin/VideoSpeed/
/plugin/VideoThumbnails/
/plugin/Video_Location_Block/
/plugin/YPTStorage/
/plugin/YouPHPTV/
/plugin/ZoomMeetingRecorder/
/plugin/oncologytube/
/plugin/predefinedCategory/
/plugin/FansSubscriptions/
/videos/
*.zip
sitemap.xml
/plugin/WebRTCLiveCam/
/plugin/Wix/
/plugin/Live/standAloneFiles/WebRTCServer/configuration.php
/plugin/Fishr/
/plugin/JoshWho/
.DS_Store

346
README.md
View file

@ -1,173 +1,173 @@
<img src="https://avideo.tube/website/assets/151/images/avideo_platform.png"/>
[![Minimum PHP Version](https://img.shields.io/badge/php-%3E%3D%207.3-8892BF.svg?style=flat-square)](https://php.net/)
[![GitHub release](https://img.shields.io/github/v/release/WWBN/AVideo)](https://github.com/WWBN/AVideo/releases)
## Audio Video Platform
AVideo is a term that means absolutely nothing, or anything video. Since it doesn't mean anything the brand simply is identifiable with audio video. AVideo Platform is an Audio and Video Platform or simply "A Video Platform".
* AVideo - Audio Video
* AVideo Platform - Audio Video Platform
* OAVP - Online Audio Video Platform
* OVP - Online Video Platform
AVideo Platform is distributed as SaaS at <a href="https://avideo.com">AVideo.com</a>, as an <a href="https://avideo.tube/AVideo_Enterprise">Enterprise Version</a>, and as an <a href="https://avideo.tube/AVideo_OpenSource">Open-Source Project</a>.
## AN AVideo Platform Instance
When we say a clone or copy of AVideo we mean an instance of AVideo Platform Enterprise or Open-Source and every instance of the AVideo Platform can be indexed as a network in the World Wide Broadcast Network Platform System.
### AVideo trademark is FREE to use
AVideo is a registered trademark owned by WWBN/PeachWiz (World Wide Broadcast Network) the media division of PeachWiz, Inc. and is freely distributable with any Enterprise or Open-Source AVideo Platform products provided by WWBN, and its permitted use is granted with GNU-GPL, CDDL open source licenses. <a href="https://avideo.tube/AVideo_OpenSource#OSAV">Open-Source License can be viewed in this link.</a>
* Word Mark: AVIDEO
* Translations: "AVideo" has no meaning in any foreign language.
* Description: "AVideo" constitutes Audio Video.
* Goods and Services: IC 009. US 021 023 026 036 038. G & S: Computer search engine software for searching online video content. FIRST USE: 20030602. FIRST USE IN COMMERCE: 20040112
* Standard Characters: Claimed
* Mark Drawing Code: (4) STANDARD CHARACTER MARK
* Trademark Search Facility Classification Code: LETS-1 A A single letter, multiples of a single letter or in combination with a design
* Serial Number: 77450549
* Registration Number: 3625659
#### About the project re-brand.
Originally the open-source version was offered as YouPHPTube, and marketed as a YouTube Clone (after the popular video sharing site), we decided to rebrand our open-source audio video platform project from YouPHPTube to <strong>AVideo Platform</strong> which constitutes <strong>Audio Video Platform</strong>. In some plugins, forks, versions, modules, APIs, documentation, file names, there may be or have been reference to <a href="https://youphp.tube/" target="_blank">youphptube</a>, <a href="https://youphp.tube/marketplace/" target="_blank">youphp.tube</a>, youtube clone, clone script, searchtube, adtube, showtube, searchmercials. WWBN owns <a href="//searchmercials.com">Searchmercials</a>, <a href="//searchtube.com">SearchTube</a>, AdTube, ShowTube, <a href="//avideo.com">AVideo</a>, <a href="//wwbn.com">WWBN</a> among other trademarks. All other trademarks and similarity to any referred to in any files, documents, wikis, plugins, code, modules, apis, integrations, technologies, links belong to their respective owners. Follow us on <a href="https://www.facebook.com/avideo/">Facebook</a>
#
# AVideo Platform Open-Source Project
## AVideo Platform Open-Source Consist of THREE main Areas:
<img src="https://avideo.tube/website/assets/151/images/svg/balancing.svg"/>
#### (Management/Encoding/Storage)
1. Management Project(s): <a href="http://git.avideo.tube/" class="" target="_blank">AVideo Platform</a>
1. Encoding Project(s): <a href="http://git-encoder.avideo.tube/" class="" target="_blank">AVideo Encoder</a> & <a href="http://git-encoder-network.avideo.tube/" class="" target="_blank">AVideo Encoder Network</a> (Optional)
1. Storage Project(s): <a href="http://git-storage.avideo.tube/" class="" target="_blank">AVideo Storage</a>
Management life cycle is as follows; media is managed at the platform at 1, media is then uploaded to a temporary storage to be encoded at 2, then stored for broadcast at 3, then distributed to devices at 1 to be consumed.
#### About AVideo Platform Open-Source
Some of the largest brands in the world use the AVideo Platform to manage and distribute their media assets. AVideo Platform open-source project has over 900 developers, and over 4000 AVideo Platform instances throughout the world. Because of the remarkable flexibility of the platform, each of our customers uses our platform in a slightly different way, to address their particular needs and deliver solid targeted value to their organization.
The AVideo Platform Plugin Design allows you to get exactly the solution that addresses your needs today, while ensuring that your Broadcast Network implementation can grow and expand with you as your needs evolve.
<div align="center"><img src="https://avideo.tube/website/assets/151/images/open_source_banner.png"/></div>
# Create Your Own Broadcast Network With AVideo Platform
## AVideo Platform Open-Source Solution enables you to create your own video sharing site. Join the AVideo Developer Community and get platform innovation details, bug fixes, and contribute the continued evolution of AVideo Platform.
## Along with this re-brand come a slew of value added benefits for all AVideo Platform instances.
* Each AVideo Platform clone is considered a broadcast network
* Each broadcast network is indexed in our World Wide Broadcast Network Platform System
* Each broadcast network can use our ad network
* Each broadcast network can use our Open Systems TV platform (Coming Soon)
* Each broadcast network has channels and each channel has programs <a href="https://github.com/WWBN/AVideo/wiki/AVideo-Platform-Channel-Programming-Documentation">Learn more</a>
And more to come in 2020. Our mission is to take your video sharing site to "The Next Level" Internet TV.
WWBN offers relevant and practical solutions, as well as valuable innovative technology, designed to increase the efficiency of advertising and broadcasting operations and maximize revenue opportunities for our customers and partners.
### WHERE WE DELIVER
PROFITABLE STRATEGIES - We provide companies with new business models that evolve around the delivery of video and other digital assets complementing their existing business offerings and adding to their revenues. These new ways of doing business include Turnkey application-integration with capabilities for managing, auditing, and disseminating digital content.
### To learn more about AVideo Platform visit the <a href="https://avideo.tube/" target="_blank">AVideo Platform Official Site</a>.
### To learn more about the history of the AVideo Paroject <a href="https://wwbn.com/AVideo_Platform" target="_blank">WWBN Project Page</a>
### To see a demo select one below.
* <a href="https://flix.avideo.com/" target="_blank">AVideo Platform Flix Demo</a>
- We provide you a AVideo Flix Style site sample. On this site you can subscribe (with real money on PayPal). this subscription will allow you to watch our private videos. There is an user that you can use to see how it works. user: test and pass: test.
* <a href="https://tutorials.avideo.com/" target="_blank">AVideo Platform Gallery Demo</a>
- We've provided a sample Video Gallery site, which is also our tutorials site. On this sample you can login, subscribe, like, dislike and comment. but you can not upload videos.
* <a href="http://demo.avideo.com/" target="_blank">AVideo Platform Full-Access Demo</a>
- We provide you a Demo site sample with full access to the admin account. You will need an admin password to upload and manage videos, it is by default. user: admin and pass: 123. Also there is a non admin user and password (Only for comments). user: test and pass: test.
# Notice:
### We highly recommend you keep your instance of AVideo Platform updated to the latest release. If you have updated your instance to version 8.0, your old plugins will not work, just download them again and you should be fine.
# First thing...
I would humbly like to thank God for giving me the necessary knowledge, motivation, resources and idea to be able to execute this project. Without God's permission this would never be possible.
**For of Him, and through Him, and to Him, are all things: to whom be glory for ever. Amen.**
`Apostle Paul in Romans 11:36`
## This Software must be used for Good, never Evil. It is expressly forbidden to use AVideo Platform Open-Source to build porn sites, violence, racism, terrorism, or anything else that affects human integrity or denigrates the image of anyone.
## Now you can read the rest...
## Important Information
> Streamer can be installed on any Server, including Windows, but the encoder and Livestream should work fine on any Linux distribution. However we recommend Ubuntu 20.04 without any kind of control panel.
> The problem with cPanel, Plesk, Webmin, VestaCP, etc. It's because we need full root access to install some libs, and maybe compile them. Another important point is that to make Livestream work, we need to compile Nginx and the control panels often prevent us from running the commands forcing the installation available only on your panel.
I don´t want to read I just want you to show me how to install!!
Ok, <a href="https://tutorials.avideo.com/video/streamer-and-encoder">check this out!</a>
For text-based tutorials and the manual, <a href="https://github.com/WWBN/AVideo/wiki/Admin-manual"> look here</a>.
There, you can find some hints for troubleshooting as well.
### AVideo Platform Mobile APP
<a href="https://play.google.com/store/apps/details?id=platform.avideo.com">Android</a>
## AVideo Platform Certified
#### Need Help With Installation or Plugins? Feel free to ask us for help from the AVideo Platform Certified developers.
<a href="https://youphp.tube/marketplace/">Daniel Neto</a>
# AVideo - Streamer
AVideo! is an video-sharing website, It is an open source solution that is freely available to everyone. With AVideo you can create your own video sharing site, AVideo will help you import and encode videos from other sites like Youtube, Vimeo, etc. and you can share directly on your website. In addition, you can use Facebook or Google login to register users on your site. The service was created in march 2017.
<div align="center">
<img src="https://avideo.tube/website/assets/151/images/who-we-are.jpg">
<a href="http://demo.avideo.com/" target="_blank">View Demo</a>
</div>
# AVideo - Encoder
Go get it <a href="https://github.com/WWBN/AVideo-Encoder" target="_blank">here</a>
<div align="center">
<img src="https://avideo.tube/website/assets/151/images/encoder_img.png">
<a href="https://encoder2.avideo.com/" target="_blank">View Public Encoder</a>
</div>
# Why do I need the Encoder?
You may want to install the encoder for a few reasons, such as, if you have a faster server than the public encoder server (which is likely to be the case), or if you'd like a private way of encoding your videos.
But, the installation is mandatory if you are using a private network. The public encoder will not have access to send the videos to your streamer site.
If your server does not have a public IP or uses an IP on some of these bands:
- 10.0.0.0/8
- 127.0.0.0/8 (Localhost)
- 172.16.0.0/12
- 192.168.0.0/16
Surely you need to install an encoder
# Server Requirements
In order for you to be able to run AVideo Platform, there are certain tools that need to be installed on your server. Don't worry, they are all FREE. To have a look at complete list of required tools, click the link below. https://github.com/WWBN/AVideo/wiki/AVideo-Platform-Hardware-Requirements
- PHP 7.3+
- MySQL 5.0+
- Apache web server 2.x (with mod_rewrite enabled)
## Docker local development
```bash
docker-compose up --build -d
```
# Roadmap
## Version 8.9
## Version 8.10
## Version 8.11
## git clone
After a git clone command run this
composer update --prefer-dist --ignore-platform-reqs
<img src="https://avideo.tube/website/assets/151/images/avideo_platform.png"/>
[![Minimum PHP Version](https://img.shields.io/badge/php-%3E%3D%207.3-8892BF.svg?style=flat-square)](https://php.net/)
[![GitHub release](https://img.shields.io/github/v/release/WWBN/AVideo)](https://github.com/WWBN/AVideo/releases)
## Audio Video Platform
AVideo is a term that means absolutely nothing, or anything video. Since it doesn't mean anything the brand simply is identifiable with audio video. AVideo Platform is an Audio and Video Platform or simply "A Video Platform".
* AVideo - Audio Video
* AVideo Platform - Audio Video Platform
* OAVP - Online Audio Video Platform
* OVP - Online Video Platform
AVideo Platform is distributed as SaaS at <a href="https://avideo.com">AVideo.com</a>, as an <a href="https://avideo.tube/AVideo_Enterprise">Enterprise Version</a>, and as an <a href="https://avideo.tube/AVideo_OpenSource">Open-Source Project</a>.
## AN AVideo Platform Instance
When we say a clone or copy of AVideo we mean an instance of AVideo Platform Enterprise or Open-Source and every instance of the AVideo Platform can be indexed as a network in the World Wide Broadcast Network Platform System.
### AVideo trademark is FREE to use
AVideo is a registered trademark owned by WWBN/PeachWiz (World Wide Broadcast Network) the media division of PeachWiz, Inc. and is freely distributable with any Enterprise or Open-Source AVideo Platform products provided by WWBN, and its permitted use is granted with GNU-GPL, CDDL open source licenses. <a href="https://avideo.tube/AVideo_OpenSource#OSAV">Open-Source License can be viewed in this link.</a>
* Word Mark: AVIDEO
* Translations: "AVideo" has no meaning in any foreign language.
* Description: "AVideo" constitutes Audio Video.
* Goods and Services: IC 009. US 021 023 026 036 038. G & S: Computer search engine software for searching online video content. FIRST USE: 20030602. FIRST USE IN COMMERCE: 20040112
* Standard Characters: Claimed
* Mark Drawing Code: (4) STANDARD CHARACTER MARK
* Trademark Search Facility Classification Code: LETS-1 A A single letter, multiples of a single letter or in combination with a design
* Serial Number: 77450549
* Registration Number: 3625659
#### About the project re-brand.
Originally the open-source version was offered as YouPHPTube, and marketed as a YouTube Clone (after the popular video sharing site), we decided to rebrand our open-source audio video platform project from YouPHPTube to <strong>AVideo Platform</strong> which constitutes <strong>Audio Video Platform</strong>. In some plugins, forks, versions, modules, APIs, documentation, file names, there may be or have been reference to <a href="https://youphp.tube/" target="_blank">youphptube</a>, <a href="https://youphp.tube/marketplace/" target="_blank">youphp.tube</a>, youtube clone, clone script, searchtube, adtube, showtube, searchmercials. WWBN owns <a href="//searchmercials.com">Searchmercials</a>, <a href="//searchtube.com">SearchTube</a>, AdTube, ShowTube, <a href="//avideo.com">AVideo</a>, <a href="//wwbn.com">WWBN</a> among other trademarks. All other trademarks and similarity to any referred to in any files, documents, wikis, plugins, code, modules, apis, integrations, technologies, links belong to their respective owners. Follow us on <a href="https://www.facebook.com/avideo/">Facebook</a>
#
# AVideo Platform Open-Source Project
## AVideo Platform Open-Source Consist of THREE main Areas:
<img src="https://avideo.tube/website/assets/151/images/svg/balancing.svg"/>
#### (Management/Encoding/Storage)
1. Management Project(s): <a href="http://git.avideo.tube/" class="" target="_blank">AVideo Platform</a>
1. Encoding Project(s): <a href="http://git-encoder.avideo.tube/" class="" target="_blank">AVideo Encoder</a> & <a href="http://git-encoder-network.avideo.tube/" class="" target="_blank">AVideo Encoder Network</a> (Optional)
1. Storage Project(s): <a href="http://git-storage.avideo.tube/" class="" target="_blank">AVideo Storage</a>
Management life cycle is as follows; media is managed at the platform at 1, media is then uploaded to a temporary storage to be encoded at 2, then stored for broadcast at 3, then distributed to devices at 1 to be consumed.
#### About AVideo Platform Open-Source
Some of the largest brands in the world use the AVideo Platform to manage and distribute their media assets. AVideo Platform open-source project has over 900 developers, and over 4000 AVideo Platform instances throughout the world. Because of the remarkable flexibility of the platform, each of our customers uses our platform in a slightly different way, to address their particular needs and deliver solid targeted value to their organization.
The AVideo Platform Plugin Design allows you to get exactly the solution that addresses your needs today, while ensuring that your Broadcast Network implementation can grow and expand with you as your needs evolve.
<div align="center"><img src="https://avideo.tube/website/assets/151/images/open_source_banner.png"/></div>
# Create Your Own Broadcast Network With AVideo Platform
## AVideo Platform Open-Source Solution enables you to create your own video sharing site. Join the AVideo Developer Community and get platform innovation details, bug fixes, and contribute the continued evolution of AVideo Platform.
## Along with this re-brand come a slew of value added benefits for all AVideo Platform instances.
* Each AVideo Platform clone is considered a broadcast network
* Each broadcast network is indexed in our World Wide Broadcast Network Platform System
* Each broadcast network can use our ad network
* Each broadcast network can use our Open Systems TV platform (Coming Soon)
* Each broadcast network has channels and each channel has programs <a href="https://github.com/WWBN/AVideo/wiki/AVideo-Platform-Channel-Programming-Documentation">Learn more</a>
And more to come in 2020. Our mission is to take your video sharing site to "The Next Level" Internet TV.
WWBN offers relevant and practical solutions, as well as valuable innovative technology, designed to increase the efficiency of advertising and broadcasting operations and maximize revenue opportunities for our customers and partners.
### WHERE WE DELIVER
PROFITABLE STRATEGIES - We provide companies with new business models that evolve around the delivery of video and other digital assets complementing their existing business offerings and adding to their revenues. These new ways of doing business include Turnkey application-integration with capabilities for managing, auditing, and disseminating digital content.
### To learn more about AVideo Platform visit the <a href="https://avideo.tube/" target="_blank">AVideo Platform Official Site</a>.
### To learn more about the history of the AVideo Paroject <a href="https://wwbn.com/AVideo_Platform" target="_blank">WWBN Project Page</a>
### To see a demo select one below.
* <a href="https://flix.avideo.com/" target="_blank">AVideo Platform Flix Demo</a>
- We provide you a AVideo Flix Style site sample. On this site you can subscribe (with real money on PayPal). this subscription will allow you to watch our private videos. There is an user that you can use to see how it works. user: test and pass: test.
* <a href="https://tutorials.avideo.com/" target="_blank">AVideo Platform Gallery Demo</a>
- We've provided a sample Video Gallery site, which is also our tutorials site. On this sample you can login, subscribe, like, dislike and comment. but you can not upload videos.
* <a href="http://demo.avideo.com/" target="_blank">AVideo Platform Full-Access Demo</a>
- We provide you a Demo site sample with full access to the admin account. You will need an admin password to upload and manage videos, it is by default. user: admin and pass: 123. Also there is a non admin user and password (Only for comments). user: test and pass: test.
# Notice:
### We highly recommend you keep your instance of AVideo Platform updated to the latest release. If you have updated your instance to version 8.0, your old plugins will not work, just download them again and you should be fine.
# First thing...
I would humbly like to thank God for giving me the necessary knowledge, motivation, resources and idea to be able to execute this project. Without God's permission this would never be possible.
**For of Him, and through Him, and to Him, are all things: to whom be glory for ever. Amen.**
`Apostle Paul in Romans 11:36`
## This Software must be used for Good, never Evil. It is expressly forbidden to use AVideo Platform Open-Source to build porn sites, violence, racism, terrorism, or anything else that affects human integrity or denigrates the image of anyone.
## Now you can read the rest...
## Important Information
> Streamer can be installed on any Server, including Windows, but the encoder and Livestream should work fine on any Linux distribution. However we recommend Ubuntu 20.04 without any kind of control panel.
> The problem with cPanel, Plesk, Webmin, VestaCP, etc. It's because we need full root access to install some libs, and maybe compile them. Another important point is that to make Livestream work, we need to compile Nginx and the control panels often prevent us from running the commands forcing the installation available only on your panel.
I don´t want to read I just want you to show me how to install!!
Ok, <a href="https://tutorials.avideo.com/video/streamer-and-encoder">check this out!</a>
For text-based tutorials and the manual, <a href="https://github.com/WWBN/AVideo/wiki/Admin-manual"> look here</a>.
There, you can find some hints for troubleshooting as well.
### AVideo Platform Mobile APP
<a href="https://play.google.com/store/apps/details?id=platform.avideo.com">Android</a>
## AVideo Platform Certified
#### Need Help With Installation or Plugins? Feel free to ask us for help from the AVideo Platform Certified developers.
<a href="https://youphp.tube/marketplace/">Daniel Neto</a>
# AVideo - Streamer
AVideo! is an video-sharing website, It is an open source solution that is freely available to everyone. With AVideo you can create your own video sharing site, AVideo will help you import and encode videos from other sites like Youtube, Vimeo, etc. and you can share directly on your website. In addition, you can use Facebook or Google login to register users on your site. The service was created in march 2017.
<div align="center">
<img src="https://avideo.tube/website/assets/151/images/who-we-are.jpg">
<a href="http://demo.avideo.com/" target="_blank">View Demo</a>
</div>
# AVideo - Encoder
Go get it <a href="https://github.com/WWBN/AVideo-Encoder" target="_blank">here</a>
<div align="center">
<img src="https://avideo.tube/website/assets/151/images/encoder_img.png">
<a href="https://encoder2.avideo.com/" target="_blank">View Public Encoder</a>
</div>
# Why do I need the Encoder?
You may want to install the encoder for a few reasons, such as, if you have a faster server than the public encoder server (which is likely to be the case), or if you'd like a private way of encoding your videos.
But, the installation is mandatory if you are using a private network. The public encoder will not have access to send the videos to your streamer site.
If your server does not have a public IP or uses an IP on some of these bands:
- 10.0.0.0/8
- 127.0.0.0/8 (Localhost)
- 172.16.0.0/12
- 192.168.0.0/16
Surely you need to install an encoder
# Server Requirements
In order for you to be able to run AVideo Platform, there are certain tools that need to be installed on your server. Don't worry, they are all FREE. To have a look at complete list of required tools, click the link below. https://github.com/WWBN/AVideo/wiki/AVideo-Platform-Hardware-Requirements
- PHP 7.3+
- MySQL 5.0+
- Apache web server 2.x (with mod_rewrite enabled)
## Docker local development
```bash
docker-compose up --build -d
```
# Roadmap
## Version 8.9
## Version 8.10
## Version 8.11
## git clone
After a git clone command run this
composer update --prefer-dist --ignore-platform-reqs

View file

@ -1,48 +1,47 @@
<div class="row">
<div class="col-lg-9">
<div class="panel panel-default">
<div class="panel-heading"><i class="fas fa-undo"></i> <?php echo __('Backup Files and Database'); ?> <div class="pull-right"><?php echo getPluginSwitch('Backup'); ?></div></div>
<div class="panel-body" style="overflow: hidden;">
<?php
if (AVideoPlugin::exists('Backup')) {
include $global['systemRootPath'] . 'plugin/Backup/backupEditor_head.php';
include $global['systemRootPath'] . 'plugin/Backup/backupEditor_body.php';
?>
<hr>
<div class="alert alert-info">
<i class="fas fa-info-circle"></i> <?php echo __('As a database increases in size full database backups take more time to complete, and require more storage space. Please be patient'); ?>
</div>
<?php
} else {
?>
<div class="alert alert-info">
<h2><i class="fas fa-undo"></i> <?php echo __('Prevent Data Loss'); ?></h2>
<?php echo __('Backing up your video files and databases, running test restores procedures on your backups, and storing copies of backups in a safe, off-site location protects you from potentially catastrophic data loss. Backing up is the only way to protect your data.'); ?>
<br> <?php echo __('We can help you with this task,'); ?>
<a class="btn btn-info btn-sm btn-xs" href="https://youphp.tube/marketplace/"><?php echo __('Buy our Backup Plugin Now'); ?></a>
</div>
<?php
}
?>
</div>
</div>
</div>
<div class="col-lg-3">
<div class="panel panel-default">
<div class="panel-heading"><i class="fa fa-clone"></i> Clone Site <div class="pull-right"><?php echo getPluginSwitch('CloneSite'); ?></div></div>
<div class="panel-body" style="overflow: hidden;">
<div class="alert alert-info">
<i class="fas fa-info-circle"></i> <?php echo __('This Plugin helps you to clone your video site, it is really helpful for backup routines, load balance, etc.'); ?><br>
<?php echo __('You May find some help how to use Clone Plugin'); ?> <a target="_blank" href="https://github.com/WWBN/AVideo/wiki/Clone-Site-Plugin" rel="noopener noreferrer"><?php echo __('here'); ?></a>
</div>
<?php
$filter = array(
'cloneSiteURL' => __('Place here the URL of the site you want to clone'));
echo createTable("CloneSite", $filter);
include $global['systemRootPath'] . 'plugin/CloneSite/pluginMenu.html';
?>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-lg-9">
<div class="panel panel-default">
<div class="panel-heading"><i class="fas fa-undo"></i> <?php echo __('Backup Files and Database'); ?> <div class="pull-right"><?php echo getPluginSwitch('Backup'); ?></div></div>
<div class="panel-body" style="overflow: hidden;">
<?php
if (AVideoPlugin::exists('Backup')) {
include $global['systemRootPath'] . 'plugin/Backup/backupEditor_head.php';
include $global['systemRootPath'] . 'plugin/Backup/backupEditor_body.php'; ?>
<hr>
<div class="alert alert-info">
<i class="fas fa-info-circle"></i> <?php echo __('As a database increases in size full database backups take more time to complete, and require more storage space. Please be patient'); ?>
</div>
<?php
} else {
?>
<div class="alert alert-info">
<h2><i class="fas fa-undo"></i> <?php echo __('Prevent Data Loss'); ?></h2>
<?php echo __('Backing up your video files and databases, running test restores procedures on your backups, and storing copies of backups in a safe, off-site location protects you from potentially catastrophic data loss. Backing up is the only way to protect your data.'); ?>
<br> <?php echo __('We can help you with this task,'); ?>
<a class="btn btn-info btn-sm btn-xs" href="https://youphp.tube/marketplace/"><?php echo __('Buy our Backup Plugin Now'); ?></a>
</div>
<?php
}
?>
</div>
</div>
</div>
<div class="col-lg-3">
<div class="panel panel-default">
<div class="panel-heading"><i class="fa fa-clone"></i> Clone Site <div class="pull-right"><?php echo getPluginSwitch('CloneSite'); ?></div></div>
<div class="panel-body" style="overflow: hidden;">
<div class="alert alert-info">
<i class="fas fa-info-circle"></i> <?php echo __('This Plugin helps you to clone your video site, it is really helpful for backup routines, load balance, etc.'); ?><br>
<?php echo __('You May find some help how to use Clone Plugin'); ?> <a target="_blank" href="https://github.com/WWBN/AVideo/wiki/Clone-Site-Plugin" rel="noopener noreferrer"><?php echo __('here'); ?></a>
</div>
<?php
$filter = [
'cloneSiteURL' => __('Place here the URL of the site you want to clone'), ];
echo createTable("CloneSite", $filter);
include $global['systemRootPath'] . 'plugin/CloneSite/pluginMenu.html';
?>
</div>
</div>
</div>
</div>

View file

@ -1,3 +1,3 @@
<?php
include './customize_settings_native.php';
include './customize_settings_plugin.php';
<?php
include './customize_settings_native.php';
include './customize_settings_plugin.php';

View file

@ -1,129 +1,129 @@
<link href="<?php echo getCDN(); ?>node_modules/croppie/croppie.css" rel="stylesheet" type="text/css"/>
<script src="<?php echo getCDN(); ?>node_modules/croppie/croppie.min.js" type="text/javascript"></script>
<div class="panel panel-default">
<div class="panel-heading"><?php echo __('Title and Logo'); ?> </div>
<div class="panel-body">
<form id="updateConfigForm">
<div class="row">
<div class="col-md-6">
<label class="col-md-4 control-label"><?php echo __("Web site title"); ?></label>
<div class="col-md-8 inputGroupContainer">
<div class="input-group">
<span class="input-group-addon"><i class="glyphicon glyphicon-globe"></i></span>
<input id="inputWebSiteTitle" placeholder="<?php echo __("Web site title"); ?>" class="form-control" type="text" value="<?php echo $config->getWebSiteTitle(); ?>" >
</div>
</div>
</div>
<div class="col-md-6">
<label class="col-md-4 control-label">
<?php echo __("Your Logo"); ?> (250x70)
</label>
<div class="col-md-8 ">
<div id="croppieLogo"></div>
<a id="logo-btn" class="btn btn-default btn-xs btn-block"><?php echo __("Upload a logo"); ?></a>
</div>
<input type="file" id="logo" value="Choose a Logo" accept="image/*" style="display: none;" />
</div>
</div>
<hr>
<div class="row">
<div class="col-md-12">
<button type="submit" class="btn btn-block btn-primary btn-lg" ><?php echo __("Save"); ?> <span class="fa fa-save"></span></button>
</div>
</div>
</form>
</div>
</div>
<script>
var logoCrop;
var logoSmallCrop;
var theme;
function readFile(input, c) {
console.log("read file");
if ($(input)[0].files && $(input)[0].files[0]) {
var reader = new FileReader();
reader.onload = function (e) {
c.croppie('bind', {
url: e.target.result
}).then(function () {
console.log('jQuery bind complete');
});
}
reader.readAsDataURL($(input)[0].files[0]);
} else {
avideoAlert("Sorry - you're browser doesn't support the FileReader API");
}
}
var logoImgBase64;
$(document).ready(function () {
// start croppie logo
$('#logo').on('change', function () {
readFile(this, logoCrop);
});
$('#logo-btn').on('click', function (ev) {
$('#logo').trigger("click");
});
$('#logo-result-btn').on('click', function (ev) {
logoCrop.croppie('result', {
type: 'canvas',
size: 'viewport'
}).then(function (resp) {
});
});
logoCrop = $('#croppieLogo').croppie({
url: '<?php echo $global['webSiteRootURL'], $config->getLogo(); ?>?'+Math.random(),
enableExif: true,
enforceBoundary: false,
mouseWheelZoom: false,
viewport: {
width: 250,
height: 70
},
boundary: {
width: 250,
height: 70
}
});
setTimeout(function () {
logoCrop.croppie('setZoom', 1);
}, 1000);
$('#updateConfigForm').submit(function (evt) {
evt.preventDefault();
modal.showPleaseWait();
$('#tabRegularLink').tab('show');
logoCrop.croppie('result', {
type: 'canvas',
size: 'viewport'
}).then(function (resp) {
logoImgBase64 = resp;
$.ajax({
url: '<?php echo $global['webSiteRootURL']; ?>admin/customize_settings_nativeUpdate.json.php',
data: {
"logoImgBase64": logoImgBase64,
"webSiteTitle": $('#inputWebSiteTitle').val(),
},
type: 'post',
success: function (response) {
if (response.status === "1") {
avideoAlert("<?php echo __("Congratulations!"); ?>", "<?php echo __("Your configurations has been updated!"); ?>", "success");
} else {
avideoAlert("<?php echo __("Sorry!"); ?>", "<?php echo __("Your configurations has NOT been updated!"); ?>", "error");
}
modal.hidePleaseWait();
}
});
});
});
});
</script>
<link href="<?php echo getCDN(); ?>node_modules/croppie/croppie.css" rel="stylesheet" type="text/css"/>
<script src="<?php echo getCDN(); ?>node_modules/croppie/croppie.min.js" type="text/javascript"></script>
<div class="panel panel-default">
<div class="panel-heading"><?php echo __('Title and Logo'); ?> </div>
<div class="panel-body">
<form id="updateConfigForm">
<div class="row">
<div class="col-md-6">
<label class="col-md-4 control-label"><?php echo __("Web site title"); ?></label>
<div class="col-md-8 inputGroupContainer">
<div class="input-group">
<span class="input-group-addon"><i class="glyphicon glyphicon-globe"></i></span>
<input id="inputWebSiteTitle" placeholder="<?php echo __("Web site title"); ?>" class="form-control" type="text" value="<?php echo $config->getWebSiteTitle(); ?>" >
</div>
</div>
</div>
<div class="col-md-6">
<label class="col-md-4 control-label">
<?php echo __("Your Logo"); ?> (250x70)
</label>
<div class="col-md-8 ">
<div id="croppieLogo"></div>
<a id="logo-btn" class="btn btn-default btn-xs btn-block"><?php echo __("Upload a logo"); ?></a>
</div>
<input type="file" id="logo" value="Choose a Logo" accept="image/*" style="display: none;" />
</div>
</div>
<hr>
<div class="row">
<div class="col-md-12">
<button type="submit" class="btn btn-block btn-primary btn-lg" ><?php echo __("Save"); ?> <span class="fa fa-save"></span></button>
</div>
</div>
</form>
</div>
</div>
<script>
var logoCrop;
var logoSmallCrop;
var theme;
function readFile(input, c) {
console.log("read file");
if ($(input)[0].files && $(input)[0].files[0]) {
var reader = new FileReader();
reader.onload = function (e) {
c.croppie('bind', {
url: e.target.result
}).then(function () {
console.log('jQuery bind complete');
});
}
reader.readAsDataURL($(input)[0].files[0]);
} else {
avideoAlert("Sorry - you're browser doesn't support the FileReader API");
}
}
var logoImgBase64;
$(document).ready(function () {
// start croppie logo
$('#logo').on('change', function () {
readFile(this, logoCrop);
});
$('#logo-btn').on('click', function (ev) {
$('#logo').trigger("click");
});
$('#logo-result-btn').on('click', function (ev) {
logoCrop.croppie('result', {
type: 'canvas',
size: 'viewport'
}).then(function (resp) {
});
});
logoCrop = $('#croppieLogo').croppie({
url: '<?php echo $global['webSiteRootURL'], $config->getLogo(); ?>?'+Math.random(),
enableExif: true,
enforceBoundary: false,
mouseWheelZoom: false,
viewport: {
width: 250,
height: 70
},
boundary: {
width: 250,
height: 70
}
});
setTimeout(function () {
logoCrop.croppie('setZoom', 1);
}, 1000);
$('#updateConfigForm').submit(function (evt) {
evt.preventDefault();
modal.showPleaseWait();
$('#tabRegularLink').tab('show');
logoCrop.croppie('result', {
type: 'canvas',
size: 'viewport'
}).then(function (resp) {
logoImgBase64 = resp;
$.ajax({
url: '<?php echo $global['webSiteRootURL']; ?>admin/customize_settings_nativeUpdate.json.php',
data: {
"logoImgBase64": logoImgBase64,
"webSiteTitle": $('#inputWebSiteTitle').val(),
},
type: 'post',
success: function (response) {
if (response.status === "1") {
avideoAlert("<?php echo __("Congratulations!"); ?>", "<?php echo __("Your configurations has been updated!"); ?>", "success");
} else {
avideoAlert("<?php echo __("Sorry!"); ?>", "<?php echo __("Your configurations has NOT been updated!"); ?>", "error");
}
modal.hidePleaseWait();
}
});
});
});
});
</script>

View file

@ -1,53 +1,53 @@
<?php
header('Content-Type: application/json');
global $global, $config;
if (!isset($global['systemRootPath'])) {
require_once '../videos/configuration.php';
}
require_once $global['systemRootPath'] . 'objects/user.php';
if (!User::isAdmin()) {
die('{"error":"' . __("Permission denied") . '"}');
}
require_once $global['systemRootPath'] . 'videos/configuration.php';
require_once $global['systemRootPath'] . 'objects/configuration.php';
require_once $global['systemRootPath'] . 'objects/functions.php';
$config = new Configuration();
$config->setWebSiteTitle($_POST['webSiteTitle']);
$imagePath = "videos/userPhoto/";
//Check write Access to Directory
if (!file_exists($global['systemRootPath'] . $imagePath)) {
mkdir($global['systemRootPath'] . $imagePath, 0755, true);
}
if (!is_writable($global['systemRootPath'] . $imagePath)) {
$response = Array(
"status" => 'error',
"message" => 'No write Access'
);
print json_encode($response);
return;
}
$response = array();
if (!empty($_POST['logoImgBase64'])) {
$fileData = base64DataToImage($_POST['logoImgBase64']);
$fileName = 'logo.png';
$photoURL = $imagePath . $fileName;
$bytes = file_put_contents($global['systemRootPath'] . $photoURL, $fileData);
if ($bytes > 10) {
$response = array(
"status" => 'success',
"url" => $global['systemRootPath'] . $photoURL
);
$config->setLogo($photoURL);
} else {
$response = array(
"status" => 'error',
"msg" => 'We could not save logo',
"url" => $global['systemRootPath'] . $photoURL
);
}
}
echo '{"status":"' . $config->save() . '", "respnseLogo": ' . json_encode($response) . '}';
<?php
header('Content-Type: application/json');
global $global, $config;
if (!isset($global['systemRootPath'])) {
require_once '../videos/configuration.php';
}
require_once $global['systemRootPath'] . 'objects/user.php';
if (!User::isAdmin()) {
die('{"error":"' . __("Permission denied") . '"}');
}
require_once $global['systemRootPath'] . 'videos/configuration.php';
require_once $global['systemRootPath'] . 'objects/configuration.php';
require_once $global['systemRootPath'] . 'objects/functions.php';
$config = new Configuration();
$config->setWebSiteTitle($_POST['webSiteTitle']);
$imagePath = "videos/userPhoto/";
//Check write Access to Directory
if (!file_exists($global['systemRootPath'] . $imagePath)) {
mkdir($global['systemRootPath'] . $imagePath, 0755, true);
}
if (!is_writable($global['systemRootPath'] . $imagePath)) {
$response = [
"status" => 'error',
"message" => 'No write Access',
];
print json_encode($response);
return;
}
$response = [];
if (!empty($_POST['logoImgBase64'])) {
$fileData = base64DataToImage($_POST['logoImgBase64']);
$fileName = 'logo.png';
$photoURL = $imagePath . $fileName;
$bytes = file_put_contents($global['systemRootPath'] . $photoURL, $fileData);
if ($bytes > 10) {
$response = [
"status" => 'success',
"url" => $global['systemRootPath'] . $photoURL,
];
$config->setLogo($photoURL);
} else {
$response = [
"status" => 'error',
"msg" => 'We could not save logo',
"url" => $global['systemRootPath'] . $photoURL,
];
}
}
echo '{"status":"' . $config->save() . '", "respnseLogo": ' . json_encode($response) . '}';

View file

@ -1,75 +1,73 @@
<link href="<?php echo getCDN(); ?>js/bootstrap3-wysiwyg/bootstrap3-wysihtml5.min.css" rel="stylesheet" type="text/css"/>
<div class="panel panel-default">
<div class="panel-heading"><?php echo __('Customize Footer, About and Meta Description'); ?> <div class="pull-right"><?php echo getPluginSwitch('Customize'); ?></div></div>
<div class="panel-body">
<?php
if (!AVideoPlugin::exists('Customize')) {
?>
<div class="alert alert-info">
<?php echo __('Truly customize your AVideo and create a more professional video sharing site experience for your visitors by removing or replacing the footer, about page and Meta Description with your own.'); ?>
<a class="btn btn-info btn-sm btn-xs" href="https://youphp.tube/marketplace/"><?php echo __('Buy the Customize plugin now'); ?></a>
</div>
<?php
return false;
} else {
require_once $global['systemRootPath'] . 'plugin/Customize/Objects/ExtraConfig.php';
$ec = new ExtraConfig();
?>
<div class="row">
<div class="col-md-12">
<form id="customizeForm">
<div class="form-group">
<label for="about" class="col-2 col-form-label">Text for About Page</label>
<div class="col-10">
<textarea id="about" placeholder="Enter the About text" style="width: 100%;"><?php echo $ec->getAbout(); ?></textarea>
</div>
</div>
<div class="form-group">
<label for="footer" class="col-2 col-form-label">Text for Footer</label>
<div class="col-10">
<textarea id="footer" placeholder="Enter the footer text" style="width: 100%;"><?php echo $ec->getFooter(); ?></textarea>
</div>
</div>
<div class="form-group">
<label for="description" class="col-2 col-form-label">MetaTag Description</label>
<div class="col-10">
<input class="form-control" type="text" placeholder="Description" id="description" value="<?php echo $ec->getDescription(); ?>">
</div>
</div>
<button type="submit" class="btn btn-success btn-block">Save</button>
</form>
</div>
</div>
<?php
}
?>
</div>
</div>
<script src="<?php echo getCDN(); ?>js/bootstrap3-wysiwyg/bootstrap3-wysihtml5.all.js" type="text/javascript"></script>
<script>
$(document).ready(function () {
$('#about, #footer').wysihtml5({toolbar: {
"html": true,
"color": true
}
});
$("#customizeForm").submit(function (event) {
event.preventDefault();
modal.showPleaseWait();
$.ajax({
url: '<?php echo $global['webSiteRootURL']; ?>plugin/Customize/page/editorSave.php',
data: {"about": $('#about').val(), "footer": $('#footer').val(), "description": $('#description').val()},
type: 'post',
success: function (response) {
modal.hidePleaseWait();
console.log(response);
}
});
});
});
</script>
<link href="<?php echo getCDN(); ?>js/bootstrap3-wysiwyg/bootstrap3-wysihtml5.min.css" rel="stylesheet" type="text/css"/>
<div class="panel panel-default">
<div class="panel-heading"><?php echo __('Customize Footer, About and Meta Description'); ?> <div class="pull-right"><?php echo getPluginSwitch('Customize'); ?></div></div>
<div class="panel-body">
<?php
if (!AVideoPlugin::exists('Customize')) {
?>
<div class="alert alert-info">
<?php echo __('Truly customize your AVideo and create a more professional video sharing site experience for your visitors by removing or replacing the footer, about page and Meta Description with your own.'); ?>
<a class="btn btn-info btn-sm btn-xs" href="https://youphp.tube/marketplace/"><?php echo __('Buy the Customize plugin now'); ?></a>
</div>
<?php
return false;
} else {
require_once $global['systemRootPath'] . 'plugin/Customize/Objects/ExtraConfig.php';
$ec = new ExtraConfig(); ?>
<div class="row">
<div class="col-md-12">
<form id="customizeForm">
<div class="form-group">
<label for="about" class="col-2 col-form-label">Text for About Page</label>
<div class="col-10">
<textarea id="about" placeholder="Enter the About text" style="width: 100%;"><?php echo $ec->getAbout(); ?></textarea>
</div>
</div>
<div class="form-group">
<label for="footer" class="col-2 col-form-label">Text for Footer</label>
<div class="col-10">
<textarea id="footer" placeholder="Enter the footer text" style="width: 100%;"><?php echo $ec->getFooter(); ?></textarea>
</div>
</div>
<div class="form-group">
<label for="description" class="col-2 col-form-label">MetaTag Description</label>
<div class="col-10">
<input class="form-control" type="text" placeholder="Description" id="description" value="<?php echo $ec->getDescription(); ?>">
</div>
</div>
<button type="submit" class="btn btn-success btn-block">Save</button>
</form>
</div>
</div>
<?php
}
?>
</div>
</div>
<script src="<?php echo getCDN(); ?>js/bootstrap3-wysiwyg/bootstrap3-wysihtml5.all.js" type="text/javascript"></script>
<script>
$(document).ready(function () {
$('#about, #footer').wysihtml5({toolbar: {
"html": true,
"color": true
}
});
$("#customizeForm").submit(function (event) {
event.preventDefault();
modal.showPleaseWait();
$.ajax({
url: '<?php echo $global['webSiteRootURL']; ?>plugin/Customize/page/editorSave.php',
data: {"about": $('#about').val(), "footer": $('#footer').val(), "description": $('#description').val()},
type: 'post',
success: function (response) {
modal.hidePleaseWait();
console.log(response);
}
});
});
});
</script>

View file

@ -1,20 +1,20 @@
<div class="panel panel-default">
<div class="panel-heading"><?php echo __('Customize Your site colors'); ?> <div class="pull-right"><?php echo getPluginSwitch('Customize'); ?></div></div>
<div class="panel-body" style="padding: 15px 30px;">
<?php
if (!AVideoPlugin::exists('Customize')) {
?>
<center>
<img src="<?php echo $global['webSiteRootURL'], "view/css/custom/customize.png"; ?>" class="img-responsive">
</center>
<div class="alert alert-info">
<?php echo __('Truly customize your AVideo and create a more professional video sharing site experience for your visitors by removing or replacing the footer, about page and Meta Description with your own.'); ?>
<a class="btn btn-info btn-sm btn-xs" href="https://youphp.tube/marketplace/"><?php echo __('Buy the Customize plugin now'); ?></a>
</div>
<?php
} else {
include '../plugin/Customize/page/colors.php';
}
?>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading"><?php echo __('Customize Your site colors'); ?> <div class="pull-right"><?php echo getPluginSwitch('Customize'); ?></div></div>
<div class="panel-body" style="padding: 15px 30px;">
<?php
if (!AVideoPlugin::exists('Customize')) {
?>
<center>
<img src="<?php echo $global['webSiteRootURL'], "view/css/custom/customize.png"; ?>" class="img-responsive">
</center>
<div class="alert alert-info">
<?php echo __('Truly customize your AVideo and create a more professional video sharing site experience for your visitors by removing or replacing the footer, about page and Meta Description with your own.'); ?>
<a class="btn btn-info btn-sm btn-xs" href="https://youphp.tube/marketplace/"><?php echo __('Buy the Customize plugin now'); ?></a>
</div>
<?php
} else {
include '../plugin/Customize/page/colors.php';
}
?>
</div>
</div>

View file

@ -1,327 +1,327 @@
<?php
$defaultSwitch = false;
$youtubeSwitch = Plugin::isEnabledByName('YouTube');
$gallerySwitch = Plugin::isEnabledByName('Gallery');
$netflixSwitch = Plugin::isEnabledByName('YouPHPFlix2');
$channelListSwitch = Plugin::isEnabledByName('FirstPageChannelList');
if (empty($netflixSwitch) && empty($gallerySwitch) && empty($youtubeSwitch) && empty($channelListSwitch)) {
$defaultSwitch = true;
}
$delay = 0.5;
?>
<div class="row">
<div class="col-sm-6 col-md-3 col-lg-3 <?php echo getCSSAnimationClassAndStyle('animate__flipInY', 'layout', $delay); ?>">
<div class="panel panel-default">
<div class="panel-heading">
Default
<div class="material-switch pull-right">
<input class="" data-toggle="toggle" type="checkbox" id="defaultSwitch" <?php echo $defaultSwitch ? "checked" : ""; ?>>
<label for="defaultSwitch" class="label-primary"></label>
</div>
</div>
<div class="panel-body">
<img src="<?php echo $global['webSiteRootURL']; ?>admin/img/default.jpg" class="img-responsive">
</div>
</div>
</div>
<div class="col-sm-6 col-md-3 col-lg-3 <?php echo getCSSAnimationClassAndStyle('animate__flipInY', 'layout', $delay); ?>">
<div class="panel panel-default">
<div class="panel-heading">
Netflix
<div class="material-switch pull-right">
<input class="" data-toggle="toggle" type="checkbox" id="netflixSwitch" <?php echo $netflixSwitch ? "checked" : ""; ?>>
<label for="netflixSwitch" class="label-primary"></label>
</div>
</div>
<div class="panel-body">
<img src="<?php echo $global['webSiteRootURL']; ?>admin/img/netflix.jpg" class="img-responsive img-radio">
</div>
</div>
</div>
<div class="clearfix hidden-md hidden-lg"></div>
<div class="col-sm-6 col-md-3 col-lg-3 <?php echo getCSSAnimationClassAndStyle('animate__flipInY', 'layout', $delay); ?>">
<div class="panel panel-default">
<div class="panel-heading">
Channel
<div class="material-switch pull-right">
<input class="" data-toggle="toggle" type="checkbox" id="channelListSwitch" <?php echo $channelListSwitch ? "checked" : ""; ?>>
<label for="channelListSwitch" class="label-primary"></label>
</div>
</div>
<div class="panel-body">
<img src="<?php echo $global['webSiteRootURL']; ?>admin/img/channel.png" class="img-responsive img-radio">
</div>
</div>
</div>
<div class="col-sm-6 col-md-3 col-lg-3 <?php echo getCSSAnimationClassAndStyle('animate__flipInY', 'layout', $delay); ?>">
<div class="panel panel-default">
<div class="panel-heading">
Gallery
<div class="material-switch pull-right">
<input class="" data-toggle="toggle" type="checkbox" id="gallerySwitch" <?php echo $gallerySwitch ? "checked" : ""; ?>>
<label for="gallerySwitch" class="label-primary"></label>
</div>
</div>
<div class="panel-body">
<img src="<?php echo $global['webSiteRootURL']; ?>admin/img/gallery.jpg" class="img-responsive">
</div>
</div>
</div>
</div>
<script>
function checkSwitch() {
var defaultSwitch = $('#defaultSwitch').is(":checked");
var netflixSwitch = $('#netflixSwitch').is(":checked");
var gallerySwitch = $('#gallerySwitch').is(":checked");
var youtubeSwitch = $('#youtubeSwitch').is(":checked");
var channelListSwitch = $('#channelListSwitch').is(":checked");
if (!defaultSwitch && !netflixSwitch && !gallerySwitch && !youtubeSwitch && !channelListSwitch) {
$('#netflixSwitch').prop('checked', false);
$('#gallerySwitch').prop('checked', false);
$('#youtubeSwitch').prop('checked', false);
$('#channelListSwitch').prop('checked', false);
$('#defaultSwitch').prop('checked', true);
}
}
$(document).ready(function () {
$('#defaultSwitch').change(function (e) {
if ($(this).is(":checked")) {
$('#netflixSwitch').prop('checked', false);
$('#gallerySwitch').prop('checked', false);
$('#youtubeSwitch').prop('checked', false);
$('#channelListSwitch').prop('checked', false);
}
checkSwitch();
modal.showPleaseWait();
$.ajax({
url: '<?php echo $global['webSiteRootURL']; ?>objects/pluginSwitch.json.php',
data: {"uuid": "a06505bf-3570-4b1f-977a-fd0e5cab205d", "name": "Gallery", "dir": "Gallery", "enable": false},
type: 'post',
success: function (response) {
$.ajax({
url: '<?php echo $global['webSiteRootURL']; ?>objects/pluginSwitch.json.php',
data: {"uuid": "e3a568e6-ef61-4dcc-aad0-0109e9be8e36", "name": "YouPHPFlix2", "dir": "YouPHPFlix2", "enable": false},
type: 'post',
success: function (response) {
$.ajax({
url: '<?php echo $global['webSiteRootURL']; ?>objects/pluginSwitch.json.php',
data: {"uuid": "youu05bf-3570-4b1f-977a-fd0e5cabtube", "name": "YouTube", "dir": "YouTube", "enable": false},
type: 'post',
success: function (response) {
$.ajax({
url: '<?php echo $global['webSiteRootURL']; ?>objects/pluginSwitch.json.php',
data: {"uuid": "channel-first-page-977a-fd0e5cab205d", "name": "FirstPageChannelList", "dir": "FirstPageChannelList", "enable": false},
type: 'post',
success: function (response) {
$.ajax({
url: '<?php echo $global['webSiteRootURL']; ?>admin/themeUpdate.json.php',
data: {"theme": 'default'},
type: 'post',
success: function (response) {
modal.hidePleaseWait();
}
});
}
});
}
});
}
});
}
});
});
$('#netflixSwitch').change(function (e) {
if ($(this).is(":checked")) {
$('#gallerySwitch').prop('checked', false);
$('#defaultSwitch').prop('checked', false);
$('#youtubeSwitch').prop('checked', false);
$('#channelListSwitch').prop('checked', false);
}
checkSwitch();
modal.showPleaseWait();
$.ajax({
url: '<?php echo $global['webSiteRootURL']; ?>objects/pluginSwitch.json.php',
data: {"uuid": "a06505bf-3570-4b1f-977a-fd0e5cab205d", "name": "Gallery", "dir": "Gallery", "enable": false},
type: 'post',
success: function (response) {
$.ajax({
url: '<?php echo $global['webSiteRootURL']; ?>objects/pluginSwitch.json.php',
data: {"uuid": "youu05bf-3570-4b1f-977a-fd0e5cabtube", "name": "YouTube", "dir": "YouTube", "enable": false},
type: 'post',
success: function (response) {
$.ajax({
url: '<?php echo $global['webSiteRootURL']; ?>objects/pluginSwitch.json.php',
data: {"uuid": "e3a568e6-ef61-4dcc-aad0-0109e9be8e36", "name": "YouPHPFlix2", "dir": "YouPHPFlix2", "enable": true},
type: 'post',
success: function (response) {
$.ajax({
url: '<?php echo $global['webSiteRootURL']; ?>objects/pluginSwitch.json.php',
data: {"uuid": "channel-first-page-977a-fd0e5cab205d", "name": "FirstPageChannelList", "dir": "FirstPageChannelList", "enable": false},
type: 'post',
success: function (response) {
$.ajax({
url: '<?php echo $global['webSiteRootURL']; ?>admin/themeUpdate.json.php',
data: {"theme": 'netflix'},
type: 'post',
success: function (response) {
modal.hidePleaseWait();
}
});
}
});
}
});
}
});
}
});
});
$('#gallerySwitch').change(function (e) {
if ($(this).is(":checked")) {
$('#netflixSwitch').prop('checked', false);
$('#defaultSwitch').prop('checked', false);
$('#youtubeSwitch').prop('checked', false);
$('#channelListSwitch').prop('checked', false);
}
checkSwitch();
modal.showPleaseWait();
$.ajax({
url: '<?php echo $global['webSiteRootURL']; ?>objects/pluginSwitch.json.php',
data: {"uuid": "a06505bf-3570-4b1f-977a-fd0e5cab205d", "name": "Gallery", "dir": "Gallery", "enable": true},
type: 'post',
success: function (response) {
$.ajax({
url: '<?php echo $global['webSiteRootURL']; ?>objects/pluginSwitch.json.php',
data: {"uuid": "youu05bf-3570-4b1f-977a-fd0e5cabtube", "name": "YouTube", "dir": "YouTube", "enable": false},
type: 'post',
success: function (response) {
$.ajax({
url: '<?php echo $global['webSiteRootURL']; ?>objects/pluginSwitch.json.php',
data: {"uuid": "e3a568e6-ef61-4dcc-aad0-0109e9be8e36", "name": "YouPHPFlix2", "dir": "YouPHPFlix2", "enable": false},
type: 'post',
success: function (response) {
$.ajax({
url: '<?php echo $global['webSiteRootURL']; ?>objects/pluginSwitch.json.php',
data: {"uuid": "channel-first-page-977a-fd0e5cab205d", "name": "FirstPageChannelList", "dir": "FirstPageChannelList", "enable": false},
type: 'post',
success: function (response) {
$.ajax({
url: '<?php echo $global['webSiteRootURL']; ?>admin/themeUpdate.json.php',
data: {"theme": 'default'},
type: 'post',
success: function (response) {
modal.hidePleaseWait();
}
});
}
});
}
});
}
});
}
});
});
$('#youtubeSwitch').change(function (e) {
if ($(this).is(":checked")) {
$('#gallerySwitch').prop('checked', false);
$('#defaultSwitch').prop('checked', false);
$('#netflixSwitch').prop('checked', false);
$('#channelListSwitch').prop('checked', false);
}
checkSwitch();
modal.showPleaseWait();
$.ajax({
url: '<?php echo $global['webSiteRootURL']; ?>objects/pluginSwitch.json.php',
data: {"uuid": "a06505bf-3570-4b1f-977a-fd0e5cab205d", "name": "Gallery", "dir": "Gallery", "enable": false},
type: 'post',
success: function (response) {
$.ajax({
url: '<?php echo $global['webSiteRootURL']; ?>objects/pluginSwitch.json.php',
data: {"uuid": "e3a568e6-ef61-4dcc-aad0-0109e9be8e36", "name": "YouPHPFlix2", "dir": "YouPHPFlix2", "enable": false},
type: 'post',
success: function (response) {
$.ajax({
url: '<?php echo $global['webSiteRootURL']; ?>objects/pluginSwitch.json.php',
data: {"uuid": "youu05bf-3570-4b1f-977a-fd0e5cabtube", "name": "YouTube", "dir": "YouTube", "enable": true},
type: 'post',
success: function (response) {
$.ajax({
url: '<?php echo $global['webSiteRootURL']; ?>objects/pluginSwitch.json.php',
data: {"uuid": "channel-first-page-977a-fd0e5cab205d", "name": "FirstPageChannelList", "dir": "FirstPageChannelList", "enable": false},
type: 'post',
success: function (response) {
$.ajax({
url: '<?php echo $global['webSiteRootURL']; ?>admin/themeUpdate.json.php',
data: {"theme": 'default'},
type: 'post',
success: function (response) {
modal.hidePleaseWait();
}
});
}
});
}
});
}
});
}
});
});
$('#channelListSwitch').change(function (e) {
if ($(this).is(":checked")) {
$('#gallerySwitch').prop('checked', false);
$('#defaultSwitch').prop('checked', false);
$('#netflixSwitch').prop('checked', false);
$('#youtubeSwitch').prop('checked', false);
}
checkSwitch();
modal.showPleaseWait();
$.ajax({
url: '<?php echo $global['webSiteRootURL']; ?>objects/pluginSwitch.json.php',
data: {"uuid": "a06505bf-3570-4b1f-977a-fd0e5cab205d", "name": "Gallery", "dir": "Gallery", "enable": false},
type: 'post',
success: function (response) {
$.ajax({
url: '<?php echo $global['webSiteRootURL']; ?>objects/pluginSwitch.json.php',
data: {"uuid": "e3a568e6-ef61-4dcc-aad0-0109e9be8e36", "name": "YouPHPFlix2", "dir": "YouPHPFlix2", "enable": false},
type: 'post',
success: function (response) {
$.ajax({
url: '<?php echo $global['webSiteRootURL']; ?>objects/pluginSwitch.json.php',
data: {"uuid": "youu05bf-3570-4b1f-977a-fd0e5cabtube", "name": "YouTube", "dir": "YouTube", "enable": false},
type: 'post',
success: function (response) {
$.ajax({
url: '<?php echo $global['webSiteRootURL']; ?>objects/pluginSwitch.json.php',
data: {"uuid": "channel-first-page-977a-fd0e5cab205d", "name": "FirstPageChannelList", "dir": "FirstPageChannelList", "enable": true},
type: 'post',
success: function (response) {
$.ajax({
url: '<?php echo $global['webSiteRootURL']; ?>admin/themeUpdate.json.php',
data: {"theme": 'default'},
type: 'post',
success: function (response) {
modal.hidePleaseWait();
}
});
}
});
}
});
}
});
}
});
});
});
</script>
<?php
$defaultSwitch = false;
$youtubeSwitch = Plugin::isEnabledByName('YouTube');
$gallerySwitch = Plugin::isEnabledByName('Gallery');
$netflixSwitch = Plugin::isEnabledByName('YouPHPFlix2');
$channelListSwitch = Plugin::isEnabledByName('FirstPageChannelList');
if (empty($netflixSwitch) && empty($gallerySwitch) && empty($youtubeSwitch) && empty($channelListSwitch)) {
$defaultSwitch = true;
}
$delay = 0.5;
?>
<div class="row">
<div class="col-sm-6 col-md-3 col-lg-3 <?php echo getCSSAnimationClassAndStyle('animate__flipInY', 'layout', $delay); ?>">
<div class="panel panel-default">
<div class="panel-heading">
Default
<div class="material-switch pull-right">
<input class="" data-toggle="toggle" type="checkbox" id="defaultSwitch" <?php echo $defaultSwitch ? "checked" : ""; ?>>
<label for="defaultSwitch" class="label-primary"></label>
</div>
</div>
<div class="panel-body">
<img src="<?php echo $global['webSiteRootURL']; ?>admin/img/default.jpg" class="img-responsive">
</div>
</div>
</div>
<div class="col-sm-6 col-md-3 col-lg-3 <?php echo getCSSAnimationClassAndStyle('animate__flipInY', 'layout', $delay); ?>">
<div class="panel panel-default">
<div class="panel-heading">
Netflix
<div class="material-switch pull-right">
<input class="" data-toggle="toggle" type="checkbox" id="netflixSwitch" <?php echo $netflixSwitch ? "checked" : ""; ?>>
<label for="netflixSwitch" class="label-primary"></label>
</div>
</div>
<div class="panel-body">
<img src="<?php echo $global['webSiteRootURL']; ?>admin/img/netflix.jpg" class="img-responsive img-radio">
</div>
</div>
</div>
<div class="clearfix hidden-md hidden-lg"></div>
<div class="col-sm-6 col-md-3 col-lg-3 <?php echo getCSSAnimationClassAndStyle('animate__flipInY', 'layout', $delay); ?>">
<div class="panel panel-default">
<div class="panel-heading">
Channel
<div class="material-switch pull-right">
<input class="" data-toggle="toggle" type="checkbox" id="channelListSwitch" <?php echo $channelListSwitch ? "checked" : ""; ?>>
<label for="channelListSwitch" class="label-primary"></label>
</div>
</div>
<div class="panel-body">
<img src="<?php echo $global['webSiteRootURL']; ?>admin/img/channel.png" class="img-responsive img-radio">
</div>
</div>
</div>
<div class="col-sm-6 col-md-3 col-lg-3 <?php echo getCSSAnimationClassAndStyle('animate__flipInY', 'layout', $delay); ?>">
<div class="panel panel-default">
<div class="panel-heading">
Gallery
<div class="material-switch pull-right">
<input class="" data-toggle="toggle" type="checkbox" id="gallerySwitch" <?php echo $gallerySwitch ? "checked" : ""; ?>>
<label for="gallerySwitch" class="label-primary"></label>
</div>
</div>
<div class="panel-body">
<img src="<?php echo $global['webSiteRootURL']; ?>admin/img/gallery.jpg" class="img-responsive">
</div>
</div>
</div>
</div>
<script>
function checkSwitch() {
var defaultSwitch = $('#defaultSwitch').is(":checked");
var netflixSwitch = $('#netflixSwitch').is(":checked");
var gallerySwitch = $('#gallerySwitch').is(":checked");
var youtubeSwitch = $('#youtubeSwitch').is(":checked");
var channelListSwitch = $('#channelListSwitch').is(":checked");
if (!defaultSwitch && !netflixSwitch && !gallerySwitch && !youtubeSwitch && !channelListSwitch) {
$('#netflixSwitch').prop('checked', false);
$('#gallerySwitch').prop('checked', false);
$('#youtubeSwitch').prop('checked', false);
$('#channelListSwitch').prop('checked', false);
$('#defaultSwitch').prop('checked', true);
}
}
$(document).ready(function () {
$('#defaultSwitch').change(function (e) {
if ($(this).is(":checked")) {
$('#netflixSwitch').prop('checked', false);
$('#gallerySwitch').prop('checked', false);
$('#youtubeSwitch').prop('checked', false);
$('#channelListSwitch').prop('checked', false);
}
checkSwitch();
modal.showPleaseWait();
$.ajax({
url: '<?php echo $global['webSiteRootURL']; ?>objects/pluginSwitch.json.php',
data: {"uuid": "a06505bf-3570-4b1f-977a-fd0e5cab205d", "name": "Gallery", "dir": "Gallery", "enable": false},
type: 'post',
success: function (response) {
$.ajax({
url: '<?php echo $global['webSiteRootURL']; ?>objects/pluginSwitch.json.php',
data: {"uuid": "e3a568e6-ef61-4dcc-aad0-0109e9be8e36", "name": "YouPHPFlix2", "dir": "YouPHPFlix2", "enable": false},
type: 'post',
success: function (response) {
$.ajax({
url: '<?php echo $global['webSiteRootURL']; ?>objects/pluginSwitch.json.php',
data: {"uuid": "youu05bf-3570-4b1f-977a-fd0e5cabtube", "name": "YouTube", "dir": "YouTube", "enable": false},
type: 'post',
success: function (response) {
$.ajax({
url: '<?php echo $global['webSiteRootURL']; ?>objects/pluginSwitch.json.php',
data: {"uuid": "channel-first-page-977a-fd0e5cab205d", "name": "FirstPageChannelList", "dir": "FirstPageChannelList", "enable": false},
type: 'post',
success: function (response) {
$.ajax({
url: '<?php echo $global['webSiteRootURL']; ?>admin/themeUpdate.json.php',
data: {"theme": 'default'},
type: 'post',
success: function (response) {
modal.hidePleaseWait();
}
});
}
});
}
});
}
});
}
});
});
$('#netflixSwitch').change(function (e) {
if ($(this).is(":checked")) {
$('#gallerySwitch').prop('checked', false);
$('#defaultSwitch').prop('checked', false);
$('#youtubeSwitch').prop('checked', false);
$('#channelListSwitch').prop('checked', false);
}
checkSwitch();
modal.showPleaseWait();
$.ajax({
url: '<?php echo $global['webSiteRootURL']; ?>objects/pluginSwitch.json.php',
data: {"uuid": "a06505bf-3570-4b1f-977a-fd0e5cab205d", "name": "Gallery", "dir": "Gallery", "enable": false},
type: 'post',
success: function (response) {
$.ajax({
url: '<?php echo $global['webSiteRootURL']; ?>objects/pluginSwitch.json.php',
data: {"uuid": "youu05bf-3570-4b1f-977a-fd0e5cabtube", "name": "YouTube", "dir": "YouTube", "enable": false},
type: 'post',
success: function (response) {
$.ajax({
url: '<?php echo $global['webSiteRootURL']; ?>objects/pluginSwitch.json.php',
data: {"uuid": "e3a568e6-ef61-4dcc-aad0-0109e9be8e36", "name": "YouPHPFlix2", "dir": "YouPHPFlix2", "enable": true},
type: 'post',
success: function (response) {
$.ajax({
url: '<?php echo $global['webSiteRootURL']; ?>objects/pluginSwitch.json.php',
data: {"uuid": "channel-first-page-977a-fd0e5cab205d", "name": "FirstPageChannelList", "dir": "FirstPageChannelList", "enable": false},
type: 'post',
success: function (response) {
$.ajax({
url: '<?php echo $global['webSiteRootURL']; ?>admin/themeUpdate.json.php',
data: {"theme": 'netflix'},
type: 'post',
success: function (response) {
modal.hidePleaseWait();
}
});
}
});
}
});
}
});
}
});
});
$('#gallerySwitch').change(function (e) {
if ($(this).is(":checked")) {
$('#netflixSwitch').prop('checked', false);
$('#defaultSwitch').prop('checked', false);
$('#youtubeSwitch').prop('checked', false);
$('#channelListSwitch').prop('checked', false);
}
checkSwitch();
modal.showPleaseWait();
$.ajax({
url: '<?php echo $global['webSiteRootURL']; ?>objects/pluginSwitch.json.php',
data: {"uuid": "a06505bf-3570-4b1f-977a-fd0e5cab205d", "name": "Gallery", "dir": "Gallery", "enable": true},
type: 'post',
success: function (response) {
$.ajax({
url: '<?php echo $global['webSiteRootURL']; ?>objects/pluginSwitch.json.php',
data: {"uuid": "youu05bf-3570-4b1f-977a-fd0e5cabtube", "name": "YouTube", "dir": "YouTube", "enable": false},
type: 'post',
success: function (response) {
$.ajax({
url: '<?php echo $global['webSiteRootURL']; ?>objects/pluginSwitch.json.php',
data: {"uuid": "e3a568e6-ef61-4dcc-aad0-0109e9be8e36", "name": "YouPHPFlix2", "dir": "YouPHPFlix2", "enable": false},
type: 'post',
success: function (response) {
$.ajax({
url: '<?php echo $global['webSiteRootURL']; ?>objects/pluginSwitch.json.php',
data: {"uuid": "channel-first-page-977a-fd0e5cab205d", "name": "FirstPageChannelList", "dir": "FirstPageChannelList", "enable": false},
type: 'post',
success: function (response) {
$.ajax({
url: '<?php echo $global['webSiteRootURL']; ?>admin/themeUpdate.json.php',
data: {"theme": 'default'},
type: 'post',
success: function (response) {
modal.hidePleaseWait();
}
});
}
});
}
});
}
});
}
});
});
$('#youtubeSwitch').change(function (e) {
if ($(this).is(":checked")) {
$('#gallerySwitch').prop('checked', false);
$('#defaultSwitch').prop('checked', false);
$('#netflixSwitch').prop('checked', false);
$('#channelListSwitch').prop('checked', false);
}
checkSwitch();
modal.showPleaseWait();
$.ajax({
url: '<?php echo $global['webSiteRootURL']; ?>objects/pluginSwitch.json.php',
data: {"uuid": "a06505bf-3570-4b1f-977a-fd0e5cab205d", "name": "Gallery", "dir": "Gallery", "enable": false},
type: 'post',
success: function (response) {
$.ajax({
url: '<?php echo $global['webSiteRootURL']; ?>objects/pluginSwitch.json.php',
data: {"uuid": "e3a568e6-ef61-4dcc-aad0-0109e9be8e36", "name": "YouPHPFlix2", "dir": "YouPHPFlix2", "enable": false},
type: 'post',
success: function (response) {
$.ajax({
url: '<?php echo $global['webSiteRootURL']; ?>objects/pluginSwitch.json.php',
data: {"uuid": "youu05bf-3570-4b1f-977a-fd0e5cabtube", "name": "YouTube", "dir": "YouTube", "enable": true},
type: 'post',
success: function (response) {
$.ajax({
url: '<?php echo $global['webSiteRootURL']; ?>objects/pluginSwitch.json.php',
data: {"uuid": "channel-first-page-977a-fd0e5cab205d", "name": "FirstPageChannelList", "dir": "FirstPageChannelList", "enable": false},
type: 'post',
success: function (response) {
$.ajax({
url: '<?php echo $global['webSiteRootURL']; ?>admin/themeUpdate.json.php',
data: {"theme": 'default'},
type: 'post',
success: function (response) {
modal.hidePleaseWait();
}
});
}
});
}
});
}
});
}
});
});
$('#channelListSwitch').change(function (e) {
if ($(this).is(":checked")) {
$('#gallerySwitch').prop('checked', false);
$('#defaultSwitch').prop('checked', false);
$('#netflixSwitch').prop('checked', false);
$('#youtubeSwitch').prop('checked', false);
}
checkSwitch();
modal.showPleaseWait();
$.ajax({
url: '<?php echo $global['webSiteRootURL']; ?>objects/pluginSwitch.json.php',
data: {"uuid": "a06505bf-3570-4b1f-977a-fd0e5cab205d", "name": "Gallery", "dir": "Gallery", "enable": false},
type: 'post',
success: function (response) {
$.ajax({
url: '<?php echo $global['webSiteRootURL']; ?>objects/pluginSwitch.json.php',
data: {"uuid": "e3a568e6-ef61-4dcc-aad0-0109e9be8e36", "name": "YouPHPFlix2", "dir": "YouPHPFlix2", "enable": false},
type: 'post',
success: function (response) {
$.ajax({
url: '<?php echo $global['webSiteRootURL']; ?>objects/pluginSwitch.json.php',
data: {"uuid": "youu05bf-3570-4b1f-977a-fd0e5cabtube", "name": "YouTube", "dir": "YouTube", "enable": false},
type: 'post',
success: function (response) {
$.ajax({
url: '<?php echo $global['webSiteRootURL']; ?>objects/pluginSwitch.json.php',
data: {"uuid": "channel-first-page-977a-fd0e5cab205d", "name": "FirstPageChannelList", "dir": "FirstPageChannelList", "enable": true},
type: 'post',
success: function (response) {
$.ajax({
url: '<?php echo $global['webSiteRootURL']; ?>admin/themeUpdate.json.php',
data: {"theme": 'default'},
type: 'post',
success: function (response) {
modal.hidePleaseWait();
}
});
}
});
}
});
}
});
}
});
});
});
</script>

View file

@ -1,72 +1,72 @@
<?php
$obj = AVideoPlugin::getObjectDataIfEnabled('PlayerSkins');
$dir = $global['systemRootPath'] . 'plugin/PlayerSkins/skins/';
$delay = 0.2;
?>
<div class="row">
<div class="col-xs-6 <?php echo getCSSAnimationClassAndStyle('animate__fadeInUp', 'player', $delay); ?>">
<div class="panel panel-default">
<div class="panel-heading">
Default
<div class="material-switch pull-right">
<input class="playerSwitch" data-toggle="toggle" type="checkbox" value="" id="themeSwitch" <?php echo (empty($obj) || empty($obj->skin)) ? "checked" : ""; ?>>
<label for="themeSwitch" class="label-primary"></label>
</div>
</div>
<div class="panel-body" style="padding: 0;">
<iframe fameBorder="0"
src="<?php echo $global['webSiteRootURL']; ?>plugin/PlayerSkins/playerSample.php"
style="width: 100%; height: 300px; border: 0;"></iframe>
</div>
</div>
</div>
<?php
foreach (glob($dir . '*.css') as $filename) {
//echo "$filename size " . filesize($filename) . "\n";
$file = basename($filename); // $file is set to "index.php"
$fileEx = basename($filename, ".css"); // $file is set to "index"
?>
<div class="col-xs-6 <?php echo getCSSAnimationClassAndStyle('animate__fadeInUp', 'player', $delay); ?>">
<div class="panel panel-default">
<div class="panel-heading">
<?php echo ucfirst($fileEx); ?>
<div class="material-switch pull-right">
<input class="playerSwitch" data-toggle="toggle" type="checkbox" value="<?php echo ($fileEx); ?>" id="themeSwitch<?php echo ($fileEx); ?>" <?php echo (!empty($obj) && $fileEx == $obj->skin) ? "checked" : ""; ?>>
<label for="themeSwitch<?php echo ($fileEx); ?>" class="label-primary"></label>
</div>
</div>
<div class="panel-body" style="padding: 0;">
<iframe fameBorder="0"
src="<?php echo $global['webSiteRootURL']; ?>plugin/PlayerSkins/playerSample.php?playerSkin=<?php echo ($fileEx); ?>"
style="width: 100%; height: 300px; border: 0;"></iframe>
</div>
</div>
</div>
<?php
}
?>
</div>
<script>
$(document).ready(function () {
$('.playerSwitch').change(function (e) {
modal.showPleaseWait();
$('.playerSwitch').not(this).prop('checked', false);
var skin = $(this).val();
$.ajax({
url: '<?php echo $global['webSiteRootURL']; ?>objects/pluginSwitch.json.php',
data: {"uuid": "e9a568e6-ef61-4dcc-aad0-0109e9be8e36", "name": "PlayerSkins", "dir": "PlayerSkins", "enable": true},
type: 'post',
success: function (response) {
$.ajax({
url: '<?php echo $global['webSiteRootURL']; ?>admin/playerUpdate.json.php',
data: {"skin": skin},
type: 'post',
success: function (response) {
modal.hidePleaseWait();
}
});
}
});
});
});
</script>
<?php
$obj = AVideoPlugin::getObjectDataIfEnabled('PlayerSkins');
$dir = $global['systemRootPath'] . 'plugin/PlayerSkins/skins/';
$delay = 0.2;
?>
<div class="row">
<div class="col-xs-6 <?php echo getCSSAnimationClassAndStyle('animate__fadeInUp', 'player', $delay); ?>">
<div class="panel panel-default">
<div class="panel-heading">
Default
<div class="material-switch pull-right">
<input class="playerSwitch" data-toggle="toggle" type="checkbox" value="" id="themeSwitch" <?php echo (empty($obj) || empty($obj->skin)) ? "checked" : ""; ?>>
<label for="themeSwitch" class="label-primary"></label>
</div>
</div>
<div class="panel-body" style="padding: 0;">
<iframe fameBorder="0"
src="<?php echo $global['webSiteRootURL']; ?>plugin/PlayerSkins/playerSample.php"
style="width: 100%; height: 300px; border: 0;"></iframe>
</div>
</div>
</div>
<?php
foreach (glob($dir . '*.css') as $filename) {
//echo "$filename size " . filesize($filename) . "\n";
$file = basename($filename); // $file is set to "index.php"
$fileEx = basename($filename, ".css"); // $file is set to "index"
?>
<div class="col-xs-6 <?php echo getCSSAnimationClassAndStyle('animate__fadeInUp', 'player', $delay); ?>">
<div class="panel panel-default">
<div class="panel-heading">
<?php echo ucfirst($fileEx); ?>
<div class="material-switch pull-right">
<input class="playerSwitch" data-toggle="toggle" type="checkbox" value="<?php echo($fileEx); ?>" id="themeSwitch<?php echo($fileEx); ?>" <?php echo (!empty($obj) && $fileEx == $obj->skin) ? "checked" : ""; ?>>
<label for="themeSwitch<?php echo($fileEx); ?>" class="label-primary"></label>
</div>
</div>
<div class="panel-body" style="padding: 0;">
<iframe fameBorder="0"
src="<?php echo $global['webSiteRootURL']; ?>plugin/PlayerSkins/playerSample.php?playerSkin=<?php echo($fileEx); ?>"
style="width: 100%; height: 300px; border: 0;"></iframe>
</div>
</div>
</div>
<?php
}
?>
</div>
<script>
$(document).ready(function () {
$('.playerSwitch').change(function (e) {
modal.showPleaseWait();
$('.playerSwitch').not(this).prop('checked', false);
var skin = $(this).val();
$.ajax({
url: '<?php echo $global['webSiteRootURL']; ?>objects/pluginSwitch.json.php',
data: {"uuid": "e9a568e6-ef61-4dcc-aad0-0109e9be8e36", "name": "PlayerSkins", "dir": "PlayerSkins", "enable": true},
type: 'post',
success: function (response) {
$.ajax({
url: '<?php echo $global['webSiteRootURL']; ?>admin/playerUpdate.json.php',
data: {"skin": skin},
type: 'post',
success: function (response) {
modal.hidePleaseWait();
}
});
}
});
});
});
</script>

View file

@ -1,54 +1,54 @@
<div class="row">
<?php
$savedTheme = $config->getTheme();
$delay = 0.2;
foreach (glob("{$global['systemRootPath']}view/css/custom/*.css") as $filename) {
//echo "$filename size " . filesize($filename) . "\n";
$file = basename($filename); // $file is set to "index.php"
$fileEx = basename($filename, ".css"); // $file is set to "index"
?>
<div class="col-xs-4 <?php echo getCSSAnimationClassAndStyle('animate__fadeInUp', 'themess', $delay); ?>">
<div class="panel panel-default">
<div class="panel-heading">
<?php echo ucfirst($fileEx); ?>
<div class="material-switch pull-right">
<input class="themeSwitch" data-toggle="toggle" type="checkbox" value="<?php echo ($fileEx); ?>" id="themeSwitch<?php echo ($fileEx); ?>" <?php echo ($fileEx == $savedTheme) ? "checked" : ""; ?>>
<label for="themeSwitch<?php echo ($fileEx); ?>" class="label-primary"></label>
</div>
</div>
<div class="panel-body">
<img src="<?php echo $global['webSiteRootURL'], "view/css/custom/", $fileEx, ".png"; ?>" class="img-responsive">
</div>
</div>
</div>
<?php
}
?>
</div>
<script>
function checkSwitch() {
var defaultSwitch = $('#defaultSwitch').is(":checked");
var netflixSwitch = $('#netflixSwitch').is(":checked");
var gallerySwitch = $('#gallerySwitch').is(":checked");
if (!defaultSwitch && !netflixSwitch && !gallerySwitch) {
$('#netflixSwitch').prop('checked', false);
$('#gallerySwitch').prop('checked', false);
$('#defaultSwitch').prop('checked', true);
}
}
$(document).ready(function () {
$('.themeSwitch').change(function (e) {
modal.showPleaseWait();
$('.themeSwitch').not(this).prop('checked', false);
$.ajax({
url: '<?php echo $global['webSiteRootURL']; ?>admin/themeUpdate.json.php',
data: {"theme": $(this).val()},
type: 'post',
success: function (response) {
modal.hidePleaseWait();
}
});
});
});
</script>
<div class="row">
<?php
$savedTheme = $config->getTheme();
$delay = 0.2;
foreach (glob("{$global['systemRootPath']}view/css/custom/*.css") as $filename) {
//echo "$filename size " . filesize($filename) . "\n";
$file = basename($filename); // $file is set to "index.php"
$fileEx = basename($filename, ".css"); // $file is set to "index"
?>
<div class="col-xs-4 <?php echo getCSSAnimationClassAndStyle('animate__fadeInUp', 'themess', $delay); ?>">
<div class="panel panel-default">
<div class="panel-heading">
<?php echo ucfirst($fileEx); ?>
<div class="material-switch pull-right">
<input class="themeSwitch" data-toggle="toggle" type="checkbox" value="<?php echo($fileEx); ?>" id="themeSwitch<?php echo($fileEx); ?>" <?php echo ($fileEx == $savedTheme) ? "checked" : ""; ?>>
<label for="themeSwitch<?php echo($fileEx); ?>" class="label-primary"></label>
</div>
</div>
<div class="panel-body">
<img src="<?php echo $global['webSiteRootURL'], "view/css/custom/", $fileEx, ".png"; ?>" class="img-responsive">
</div>
</div>
</div>
<?php
}
?>
</div>
<script>
function checkSwitch() {
var defaultSwitch = $('#defaultSwitch').is(":checked");
var netflixSwitch = $('#netflixSwitch').is(":checked");
var gallerySwitch = $('#gallerySwitch').is(":checked");
if (!defaultSwitch && !netflixSwitch && !gallerySwitch) {
$('#netflixSwitch').prop('checked', false);
$('#gallerySwitch').prop('checked', false);
$('#defaultSwitch').prop('checked', true);
}
}
$(document).ready(function () {
$('.themeSwitch').change(function (e) {
modal.showPleaseWait();
$('.themeSwitch').not(this).prop('checked', false);
$.ajax({
url: '<?php echo $global['webSiteRootURL']; ?>admin/themeUpdate.json.php',
data: {"theme": $(this).val()},
type: 'post',
success: function (response) {
modal.hidePleaseWait();
}
});
});
});
</script>

View file

@ -1,95 +1,95 @@
<?php
function createTable($pluginName, $filter = array())
{
$plugin = AVideoPlugin::getObjectData($pluginName);
if (empty($filter)) {
foreach ($plugin as $keyJson => $valueJson) {
$filter[$keyJson] = "&nbsp;";
}
}
//var_dump($filter);exit;
echo '<form class="adminOptionsForm">';
echo '<input type="hidden" value="' . $pluginName . '" name="pluginName"/>';
echo '<input type="hidden" value="' . implode("|", array_keys($filter)) . '" name="pluginsList"/>';
echo '<table class="table table-hover">';
$pluginsList = array();
if (!AVideoPlugin::exists($pluginName)) {
echo "<tr><td colspan='2'> ".__('Sorry you do not have the plugin')." </td></tr>";
} else {
if (!empty($plugin)) {
$form = jsonToFormElements($plugin, $filter);
//var_dump($form);
echo implode("", $form);
}
echo "<tr><td colspan='2'> <button class='btn btn-block btn-primary'><i class='fa fa-save'></i> ".__('Save')."</button> </td></tr>";
}
echo '</table></form>';
}
function jsonToFormElements($json, $filter = array())
{
//var_dump($json, $filter);exit;
$elements = array();
foreach ($json as $keyJson => $valueJson) {
if (!empty($filter) && empty($filter[$keyJson])) {
continue;
}
$label = "<label>{$keyJson}</label>";
$help = "";
if (!empty($filter[$keyJson])) {
$help = "<small class=\"form-text text-muted\">{$filter[$keyJson]}</small>";
}
$input = "";
if (is_object($valueJson)) {
if ($valueJson->type === 'textarea') {
$input = "<textarea class='form-control jsonElement' name='{$keyJson}' pluginType='object'>{$valueJson->value}</textarea>";
} elseif (is_array($valueJson->type)) {
$input = "<select class='form-control jsonElement' name='{$keyJson}' pluginType='object'>";
foreach ($valueJson->type as $key => $value) {
$select = "";
if ($valueJson->value == $key) {
$select = "selected";
}
$input .= "<option value='{$key}' {$select}>{$value}</option>";
}
$input .= "</select>";
} else {
if(!is_string($valueJson->type) || !is_string($valueJson->value)){
continue;
}
$input = "<input class='form-control jsonElement' name='{$keyJson}' "
. "pluginType='object' type='{$valueJson->type}' value='{$valueJson->value}'/>";
}
$elements[] = "<tr><td>{$label} </td><td>{$input}{$help}</td></tr>";
} elseif (is_bool($valueJson)) {
$id = uniqid();
$input = '<div class="material-switch">
<input data-toggle="toggle" type="checkbox" id="' . $keyJson . $id . '" name="' . $keyJson . '" value="1" ' . ($valueJson ? "checked" : "") . ' >
<label for="' . $keyJson . $id . '" class="label-primary"></label>
</div>';
$elements[] = "<tr><td>{$input}</td><td>{$label}<br>{$help}</td></tr>";
} else {
$input = "<input class='form-control jsonElement' name='{$keyJson}' type='text' value='{$valueJson}'/>";
$elements[] = "<tr><td>{$label} </td><td>{$input}{$help}</td></tr>";
}
}
return $elements;
}
function getPluginSwitch($pluginName)
{
if (!AVideoPlugin::exists($pluginName)) {
$input = '<a href="https://youphp.tube/marketplace/" class="btn btn-danger btn-sm btn-xs">'.__('Buy this plugin now').'</a>';
} else {
$plugin = AVideoPlugin::loadPluginIfEnabled($pluginName);
$pluginForced = AVideoPlugin::loadPlugin($pluginName);
$id = uniqid();
$uuid = $pluginForced->getUUID();
$input = '<div class="material-switch">
<input class="pluginSwitch" data-toggle="toggle" type="checkbox" id="' . $id . '" uuid="' . $uuid . '" name="' . $pluginName . '" value="1" ' . (!empty($plugin) ? "checked" : "") . ' >
<label for="' . $id . '" class="label-primary"></label>
</div>';
}
return $input;
}
<?php
function createTable($pluginName, $filter = [])
{
$plugin = AVideoPlugin::getObjectData($pluginName);
if (empty($filter)) {
foreach ($plugin as $keyJson => $valueJson) {
$filter[$keyJson] = "&nbsp;";
}
}
//var_dump($filter);exit;
echo '<form class="adminOptionsForm">';
echo '<input type="hidden" value="' . $pluginName . '" name="pluginName"/>';
echo '<input type="hidden" value="' . implode("|", array_keys($filter)) . '" name="pluginsList"/>';
echo '<table class="table table-hover">';
$pluginsList = [];
if (!AVideoPlugin::exists($pluginName)) {
echo "<tr><td colspan='2'> ".__('Sorry you do not have the plugin')." </td></tr>";
} else {
if (!empty($plugin)) {
$form = jsonToFormElements($plugin, $filter);
//var_dump($form);
echo implode("", $form);
}
echo "<tr><td colspan='2'> <button class='btn btn-block btn-primary'><i class='fa fa-save'></i> ".__('Save')."</button> </td></tr>";
}
echo '</table></form>';
}
function jsonToFormElements($json, $filter = [])
{
//var_dump($json, $filter);exit;
$elements = [];
foreach ($json as $keyJson => $valueJson) {
if (!empty($filter) && empty($filter[$keyJson])) {
continue;
}
$label = "<label>{$keyJson}</label>";
$help = '';
if (!empty($filter[$keyJson])) {
$help = "<small class=\"form-text text-muted\">{$filter[$keyJson]}</small>";
}
$input = '';
if (is_object($valueJson)) {
if ($valueJson->type === 'textarea') {
$input = "<textarea class='form-control jsonElement' name='{$keyJson}' pluginType='object'>{$valueJson->value}</textarea>";
} elseif (is_array($valueJson->type)) {
$input = "<select class='form-control jsonElement' name='{$keyJson}' pluginType='object'>";
foreach ($valueJson->type as $key => $value) {
$select = '';
if ($valueJson->value == $key) {
$select = "selected";
}
$input .= "<option value='{$key}' {$select}>{$value}</option>";
}
$input .= "</select>";
} else {
if (!is_string($valueJson->type) || !is_string($valueJson->value)) {
continue;
}
$input = "<input class='form-control jsonElement' name='{$keyJson}' "
. "pluginType='object' type='{$valueJson->type}' value='{$valueJson->value}'/>";
}
$elements[] = "<tr><td>{$label} </td><td>{$input}{$help}</td></tr>";
} elseif (is_bool($valueJson)) {
$id = uniqid();
$input = '<div class="material-switch">
<input data-toggle="toggle" type="checkbox" id="' . $keyJson . $id . '" name="' . $keyJson . '" value="1" ' . ($valueJson ? "checked" : "") . ' >
<label for="' . $keyJson . $id . '" class="label-primary"></label>
</div>';
$elements[] = "<tr><td>{$input}</td><td>{$label}<br>{$help}</td></tr>";
} else {
$input = "<input class='form-control jsonElement' name='{$keyJson}' type='text' value='{$valueJson}'/>";
$elements[] = "<tr><td>{$label} </td><td>{$input}{$help}</td></tr>";
}
}
return $elements;
}
function getPluginSwitch($pluginName)
{
if (!AVideoPlugin::exists($pluginName)) {
$input = '<a href="https://youphp.tube/marketplace/" class="btn btn-danger btn-sm btn-xs">'.__('Buy this plugin now').'</a>';
} else {
$plugin = AVideoPlugin::loadPluginIfEnabled($pluginName);
$pluginForced = AVideoPlugin::loadPlugin($pluginName);
$id = uniqid();
$uuid = $pluginForced->getUUID();
$input = '<div class="material-switch">
<input class="pluginSwitch" data-toggle="toggle" type="checkbox" id="' . $id . '" uuid="' . $uuid . '" name="' . $pluginName . '" value="1" ' . (!empty($plugin) ? "checked" : "") . ' >
<label for="' . $id . '" class="label-primary"></label>
</div>';
}
return $input;
}

View file

@ -1,27 +1,27 @@
<div class="row">
<div class="col-md-6">
<div class="panel panel-default">
<div class="panel-heading"><?php echo __('Users') ?></div>
<div class="panel-body"><?php include './general_settings_user.php'; ?></div>
</div>
</div>
<div class="col-md-6">
<div class="panel panel-default">
<div class="panel-heading"><?php echo __('Upload') ?></div>
<div class="panel-body"><?php include './general_settings_upload.php'; ?></div>
</div>
</div>
<div class="col-md-6">
<div class="panel panel-default">
<div class="panel-heading"><?php echo __('Encoder') ?></div>
<div class="panel-body"><?php include './general_settings_encoder.php'; ?></div>
</div>
</div>
<div class="col-md-6">
<div class="panel panel-default">
<div class="panel-heading"><?php echo __('Sign In/Up') ?></div>
<div class="panel-body"><?php include './general_settings_user.php'; ?></div>
</div>
</div>
</div>
<div class="row">
<div class="col-md-6">
<div class="panel panel-default">
<div class="panel-heading"><?php echo __('Users') ?></div>
<div class="panel-body"><?php include './general_settings_user.php'; ?></div>
</div>
</div>
<div class="col-md-6">
<div class="panel panel-default">
<div class="panel-heading"><?php echo __('Upload') ?></div>
<div class="panel-body"><?php include './general_settings_upload.php'; ?></div>
</div>
</div>
<div class="col-md-6">
<div class="panel panel-default">
<div class="panel-heading"><?php echo __('Encoder') ?></div>
<div class="panel-body"><?php include './general_settings_encoder.php'; ?></div>
</div>
</div>
<div class="col-md-6">
<div class="panel panel-default">
<div class="panel-heading"><?php echo __('Sign In/Up') ?></div>
<div class="panel-body"><?php include './general_settings_user.php'; ?></div>
</div>
</div>
</div>

View file

@ -1,11 +1,11 @@
<?php
$filter = array(
'useEncoderNetworkRecomendation' => __('Let the encoder network (If configured) choose what is the best encoder to use'),
'doNotShowEncoderResolutionLow' => __('Do not allow encode in Low resolution'),
'doNotShowEncoderResolutionSD' => __('Do not allow encode in SD resolution'),
'doNotShowEncoderResolutionHD' => __('Do not allow encode in HD resolution'),
'makeVideosInactiveAfterEncode' => __('Maybe you need to approve or check something on your video before make it public'),
'makeVideosUnlistedAfterEncode' => __('Maybe you need to approve or check something on your video before make it public')
);
createTable("CustomizeAdvanced", $filter);
<?php
$filter = [
'useEncoderNetworkRecomendation' => __('Let the encoder network (If configured) choose what is the best encoder to use'),
'doNotShowEncoderResolutionLow' => __('Do not allow encode in Low resolution'),
'doNotShowEncoderResolutionSD' => __('Do not allow encode in SD resolution'),
'doNotShowEncoderResolutionHD' => __('Do not allow encode in HD resolution'),
'makeVideosInactiveAfterEncode' => __('Maybe you need to approve or check something on your video before make it public'),
'makeVideosUnlistedAfterEncode' => __('Maybe you need to approve or check something on your video before make it public'),
];
createTable("CustomizeAdvanced", $filter);

View file

@ -1,10 +1,10 @@
<?php
$filter = array(
'encoderNetwork'=>'The <a target="_blank" href="https://github.com/WWBN/AVideo-Encoder-Network">Encoder Network</a> URL ',
'useEncoderNetworkRecomendation'=>__('Let the encoder network (if configured) choose what is the best encoder to use'),
'doNotShowUploadMP4Button'=>__('Users will not be able to directly upload, only use the encoder'),
'doNotShowImportMP4Button'=>__('Disable the option to import MP4 videos from your local (Server) storage'),
'doNotShowEncoderButton'=>__('Do not show the button to the encoder'),
'doNotShowEmbedButton'=>__('Check this if you will not use embed videos on your site')
);
createTable("CustomizeAdvanced", $filter);
<?php
$filter = [
'encoderNetwork' => 'The <a target="_blank" href="https://github.com/WWBN/AVideo-Encoder-Network">Encoder Network</a> URL ',
'useEncoderNetworkRecomendation' => __('Let the encoder network (if configured) choose what is the best encoder to use'),
'doNotShowUploadMP4Button' => __('Users will not be able to directly upload, only use the encoder'),
'doNotShowImportMP4Button' => __('Disable the option to import MP4 videos from your local (Server) storage'),
'doNotShowEncoderButton' => __('Do not show the button to the encoder'),
'doNotShowEmbedButton' => __('Check this if you will not use embed videos on your site'),
];
createTable("CustomizeAdvanced", $filter);

View file

@ -1,15 +1,15 @@
<?php
$filter = array(
'disableNativeSignUp'=>__('This is useful if you want to use our LDAP plugin or maybe only allow authentication from Social Networks'),
'disableNativeSignIn'=>__('This is useful if you want to use our LDAP plugin or maybe only allow authentication from Social Networks'),
'disablePersonalInfo'=>__('Disable the My Account personal info like: First and Last Name and address'),
'newUsersCanStream'=>__('Automatic allow new users to use your Livestream Platform'),
'doNotIndentifyByEmail'=>__('Do not show user\'s email on the site'),
'doNotIndentifyByName'=>__('Do not show user\'s name on the site'),
'doNotIndentifyByUserName'=>__('Do not show user\'s username on the site'),
'unverifiedEmailsCanNOTLogin'=>__('Users must verify their emails before login'),
'onlyVerifiedEmailCanUpload'=>__('Users must verify their emails before upload/submit videos'),
'sendVerificationMailAutomatic'=>__('After sign up we will automatic send a verification email'),
'userMustBeLoggedIn'=>__('Hide the website to non logged users')
);
createTable("CustomizeUser", $filter);
<?php
$filter = [
'disableNativeSignUp'=>__('This is useful if you want to use our LDAP plugin or maybe only allow authentication from Social Networks'),
'disableNativeSignIn'=>__('This is useful if you want to use our LDAP plugin or maybe only allow authentication from Social Networks'),
'disablePersonalInfo'=>__('Disable the My Account personal info like: First and Last Name and address'),
'newUsersCanStream'=>__('Automatic allow new users to use your Livestream Platform'),
'doNotIndentifyByEmail'=>__('Do not show user\'s email on the site'),
'doNotIndentifyByName'=>__('Do not show user\'s name on the site'),
'doNotIndentifyByUserName'=>__('Do not show user\'s username on the site'),
'unverifiedEmailsCanNOTLogin'=>__('Users must verify their emails before login'),
'onlyVerifiedEmailCanUpload'=>__('Users must verify their emails before upload/submit videos'),
'sendVerificationMailAutomatic'=>__('After sign up we will automatic send a verification email'),
'userMustBeLoggedIn'=>__('Hide the website to non logged users'),
];
createTable("CustomizeUser", $filter);

View file

@ -1,37 +1,37 @@
<?php
function _isAPPInstalled($appName) {
function _isAPPInstalled($appName)
{
$appName = preg_replace('/[^a-z0-9_-]/i', '', $appName);
return trim(shell_exec("which {$appName}"));
}
$phpExtensions = array();
$phpExtensions[] = array('pdo_mysql');
$phpExtensions[] = array('curl');
$phpExtensions[] = array('gd', 'Important to generate images');
$phpExtensions[] = array('xml', 'Important to get the live stats');
$phpExtensions[] = array('zip', 'Important handle HLS files');
$phpExtensions = [];
$phpExtensions[] = ['pdo_mysql'];
$phpExtensions[] = ['curl'];
$phpExtensions[] = ['gd', 'Important to generate images'];
$phpExtensions[] = ['xml', 'Important to get the live stats'];
$phpExtensions[] = ['zip', 'Important handle HLS files'];
// $phpExtensions[] = array('mbstring'); // I could not detect that
$apacheModules = array();
$apacheModules[] = array('mod_php');
$apacheModules[] = array('mod_xsendfile', 'https://github.com/WWBN/AVideo/wiki/Install-Apache-XSendFIle');
$apacheModules[] = array('mod_rewrite');
$apacheModules[] = array('mod_expires', 'Important for CDN and cache configuration');
$apacheModules[] = array('mod_headers', 'Important for CDN and cache configuration');
$apacheModules = [];
$apacheModules[] = ['mod_php'];
$apacheModules[] = ['mod_xsendfile', 'https://github.com/WWBN/AVideo/wiki/Install-Apache-XSendFIle'];
$apacheModules[] = ['mod_rewrite'];
$apacheModules[] = ['mod_expires', 'Important for CDN and cache configuration'];
$apacheModules[] = ['mod_headers', 'Important for CDN and cache configuration'];
$linuxApps = array();
$linuxApps[] = array('mysql');
$linuxApps[] = array('ffmpeg');
$linuxApps[] = array('git');
$linuxApps[] = array('exiftool');
$linuxApps[] = array('unzip');
$linuxApps[] = array('youtube-dl');
$linuxApps[] = array('sshpass', 'https://github.com/WWBN/AVideo/wiki/Clone-Site-Plugin#the-process-with-rsync-support-hls');
$linuxApps[] = array('apache2');
$linuxApps = [];
$linuxApps[] = ['mysql'];
$linuxApps[] = ['ffmpeg'];
$linuxApps[] = ['git'];
$linuxApps[] = ['exiftool'];
$linuxApps[] = ['unzip'];
$linuxApps[] = ['youtube-dl'];
$linuxApps[] = ['sshpass', 'https://github.com/WWBN/AVideo/wiki/Clone-Site-Plugin#the-process-with-rsync-support-hls'];
$linuxApps[] = ['apache2'];
$messages = array('Server' => array(), 'PHP' => array(), 'Apache' => array());
$messages = ['Server' => [], 'PHP' => [], 'Apache' => []];
$version = phpversion();
$phpMinVersion = '7.3.0';
if (strnatcmp($version, $phpMinVersion) >= 0) {
@ -46,7 +46,7 @@ foreach ($phpExtensions as $value) {
if (in_array($value[0], $extensions)) {
$messages['PHP'][] = $value[0];
} else {
$messages['PHP'][] = array($value[0], 'sudo apt-get install php-' . str_replace('_', '-', $value[0]) . ' -y && sudo /etc/init.d/apache2 restart');
$messages['PHP'][] = [$value[0], 'sudo apt-get install php-' . str_replace('_', '-', $value[0]) . ' -y && sudo /etc/init.d/apache2 restart'];
}
}
@ -54,10 +54,10 @@ foreach ($phpExtensions as $value) {
if (isset($_SERVER["HTTPS"])) {
$messages['Apache'][] = "HTTPS is enabled";
} else {
$messages['Apache'][] = array("HTTPS is not enabled", 'https://github.com/WWBN/AVideo/wiki/Why-use-HTTPS');
$messages['Apache'][] = ["HTTPS is not enabled", 'https://github.com/WWBN/AVideo/wiki/Why-use-HTTPS'];
}
if(function_exists('apache_get_modules')){
if (function_exists('apache_get_modules')) {
$mods = array_map('strtolower', apache_get_modules());
//var_dump($mods);
foreach ($apacheModules as $value) {
@ -74,13 +74,13 @@ if(function_exists('apache_get_modules')){
if ($found) {
$messages['Apache'][] = $found;
} else {
$messages['Apache'][] = array($value[0], @$value[1]);
$messages['Apache'][] = [$value[0], @$value[1]];
}
}
}
}else{
} else {
foreach ($apacheModules as $value) {
$messages['Apache'][] = array($value[0], 'We could not check your installed modules. We recommend you to use apache as a module NOT as a FPM');
$messages['Apache'][] = [$value[0], 'We could not check your installed modules. We recommend you to use apache as a module NOT as a FPM'];
}
}
@ -89,27 +89,27 @@ foreach ($linuxApps as $value) {
if (!empty($response)) {
$messages['Server'][] = "{$value[0]} is installed here {$response}";
} else {
$messages['Server'][] = array("{$value[0]} is NOT installed", @$value[1]);
$messages['Server'][] = ["{$value[0]} is NOT installed", @$value[1]];
}
}
$videosDir = getVideosDir();
if (is_writable($videosDir)) {
$messages['Server'][] = "{$videosDir} is writable";
} else {
$messages['Server'][] = array("{$videosDir} is NOT writable", 'sudo chmod -R 777 ' . $videosDir);
$messages['Server'][] = ["{$videosDir} is NOT writable", 'sudo chmod -R 777 ' . $videosDir];
}
if (is_writable($global['logfile'])) {
$messages['Server'][] = "Log file is writable";
} else {
$messages['Server'][] = array("{$global['logfile']} is NOT writable", 'sudo chmod -R 777 ' . $global['logfile']);
$messages['Server'][] = ["{$global['logfile']} is NOT writable", 'sudo chmod -R 777 ' . $global['logfile']];
}
$cacheDir = "{$videosDir}cache/";
if (is_writable($cacheDir)) {
$messages['Server'][] = "Cache is writable";
} else {
$messages['Server'][] = array("{$cacheDir} is NOT writable", 'sudo chmod -R 777 ' . $cacheDir);
$messages['Server'][] = ["{$cacheDir} is NOT writable", 'sudo chmod -R 777 ' . $cacheDir];
}
$_50GB = 53687091200;
@ -118,14 +118,14 @@ $df = disk_free_space("/");
if ($df > $_50GB) {
$messages['Server'][] = "You have enough free disk space " . humanFileSize($df);
} else {
$messages['Server'][] = array("Your disk is almost full, you have only " . humanFileSize($df) . ' free');
$messages['Server'][] = ["Your disk is almost full, you have only " . humanFileSize($df) . ' free'];
}
$dfVideos = disk_free_space($videosDir);
if ($dfVideos > $_50GB) {
$messages['Server'][] = "You have enough free disk space for the videos directory " . humanFileSize($dfVideos);
} else {
$messages['Server'][] = array("Your videos directory is almost full, you have only " . humanFileSize($dfVideos) . ' free');
$messages['Server'][] = ["Your videos directory is almost full, you have only " . humanFileSize($dfVideos) . ' free'];
}
@ -135,19 +135,19 @@ $verifyURL = addQueryStringParameter($verifyURL, 'screenshot', 1);
$result = url_get_contents($verifyURL, '', 5);
if (empty($result)) {
$messages['Server'][] = array("We could not verify your server from outside {$global['webSiteRootURL']}");
$messages['Server'][] = ["We could not verify your server from outside {$global['webSiteRootURL']}"];
} else {
$verified = json_decode($result);
if (!empty($verified->verified)) {
$messages['Server'][] = "Server Checked from outside: <br>" . implode('<br>', $verified->msg);
} else {
$messages['Server'][] = array("Something is wrong: ", implode('<br>', $verified->msg));
$messages['Server'][] = ["Something is wrong: ", implode('<br>', $verified->msg)];
}
/*
if(!empty($verified->screenshot)){
$messages['Server'][] = "<img src='$verified->screenshot' class='img img-responsive'>";
}
*
*
*/
}
?>
@ -181,18 +181,17 @@ if (empty($result)) {
<div class="alert alert-danger">
<i class="fas fa-times"></i> <?php
echo $value[0];
if (!empty($value[1])) {
if (preg_match('/^http/i', $value[1])) {
?>
if (!empty($value[1])) {
if (preg_match('/^http/i', $value[1])) {
?>
<a href="<?php echo $value[1]; ?>" class="btn btn-danger btn-xs btn-block" target="_blank"><i class="fas fa-hand-holding-medical"></i> </a>
<?php
} else {
?>
} else {
?>
<br><code><?php echo $value[1]; ?></code>
<?php
}
}
?>
}
} ?>
</div>
</div>
<?php
@ -201,8 +200,7 @@ if (empty($result)) {
<div class="col-lg-4 col-md-6 <?php echo getCSSAnimationClassAndStyle('animate__flipInX'); ?>">
<div class="alert alert-success">
<i class="fas fa-check"></i> <?php
echo $value;
?>
echo $value; ?>
</div>
</div>
<?php
@ -235,18 +233,17 @@ if (empty($result)) {
<div class="alert alert-danger">
<i class="fas fa-times"></i> <?php
echo $value[0];
if (!empty($value[1])) {
if (preg_match('/^http/i', $value[1])) {
?>
if (!empty($value[1])) {
if (preg_match('/^http/i', $value[1])) {
?>
<a href="<?php echo $value[1]; ?>" class="btn btn-danger btn-xs btn-block" target="_blank"><i class="fas fa-hand-holding-medical"></i> </a>
<?php
} else {
?>
} else {
?>
<br><code><?php echo $value[1]; ?></code>
<?php
}
}
?>
}
} ?>
</div>
</div>
<?php
@ -255,8 +252,7 @@ if (empty($result)) {
<div class="col-sm-12 <?php echo getCSSAnimationClassAndStyle('animate__flipInX'); ?>">
<div class="alert alert-success">
<i class="fas fa-check"></i> <?php
echo $value;
?>
echo $value; ?>
</div>
</div>
<?php
@ -283,18 +279,17 @@ if (empty($result)) {
<div class="alert alert-danger">
<i class="fas fa-times"></i> <?php
echo $value[0];
if (!empty($value[1])) {
if (preg_match('/^http/i', $value[1])) {
?>
if (!empty($value[1])) {
if (preg_match('/^http/i', $value[1])) {
?>
<a href="<?php echo $value[1]; ?>" class="btn btn-danger btn-xs btn-block" target="_blank"><i class="fas fa-hand-holding-medical"></i> </a>
<?php
} else {
?>
} else {
?>
<br><code><?php echo $value[1]; ?></code>
<?php
}
}
?>
}
} ?>
</div>
</div>
<?php
@ -303,8 +298,7 @@ if (empty($result)) {
<div class="col-sm-12 <?php echo getCSSAnimationClassAndStyle('animate__flipInX'); ?>">
<div class="alert alert-success">
<i class="fas fa-check"></i> <?php
echo $value;
?>
echo $value; ?>
</div>
</div>
<?php

View file

@ -1,382 +1,385 @@
<?php
$vars = array();
require_once '../videos/configuration.php';
require_once './functions.php';
if (!User::isAdmin()) {
header("Location: {$global['webSiteRootURL']}");
exit;
}
$isAdminPanel = 1;
class MenuAdmin {
public $title, $icon, $href, $active = false, $show = false, $itens = array(), $data_toggle, $data_target;
function __construct($title, $icon, $href = "", $data_toggle = "", $data_target = "") {
$this->title = $title;
$this->icon = $icon;
$this->href = $href;
$this->data_toggle = $data_toggle;
$this->data_target = $data_target;
if (!empty($href)) {
$fileName = basename($_SERVER["SCRIPT_NAME"]);
if ($href === $fileName) {
$this->active = true;
}
}
}
function addItem(MenuAdmin $menu) {
$this->itens[] = $menu;
if ($menu->active) {
$this->show = true;
}
}
}
$itens = array();
$menu = new MenuAdmin(__("Dashboard"), "fa fa-tachometer-alt", "dashboard");
$itens[] = $menu;
/*
$menu = new MenuAdmin(__("Premium Featrures"), "fas fa-star", "premium");
$itens[] = $menu;
*/
$menu = new MenuAdmin(__("Settings"), "fa fa-wrench");
$menu->addItem(new MenuAdmin(__("Remove Branding"), "far fa-edit", "customize_settings"));
$menu->addItem(new MenuAdmin(__("General Settings"), "fas fa-cog", "general_settings"));
$menu->addItem(new MenuAdmin(__("Site Settings"), "fas fa-sitemap", "site_settings"));
$menu->addItem(new MenuAdmin(__("Social Login Settings"), "fas fa-sign-in-alt", "socialLogin_settings"));
$menu->addItem(new MenuAdmin(__("S3, B2, FTP settings"), "fas fa-hdd", "storage_settings"));
$menu->addItem(new MenuAdmin(__("Payments Settings"), "far fa-money-bill-alt", "payments_settings"));
$itens[] = $menu;
$menu = new MenuAdmin(__("Contents"), "fas fa-list-ul");
$menu->addItem(new MenuAdmin(__("Videos"), "fas fa-play-circle", "videos"));
$menu->addItem(new MenuAdmin(__("Live Stuff"), "fas fa-broadcast-tower", "live"));
$menu->addItem(new MenuAdmin(__("Users"), "glyphicon glyphicon-user", "users"));
$menu->addItem(new MenuAdmin(__("Users Groups"), "fa fa-users", "usersGroups"));
$menu->addItem(new MenuAdmin(__("Categories"), "glyphicon glyphicon-list", "categories"));
$menu->addItem(new MenuAdmin(__("Backup"), "fas fa-undo-alt", "backup"));
$itens[] = $menu;
$menu = new MenuAdmin(__("Design"), "fas fa-pen-fancy");
$menu->addItem(new MenuAdmin(__("First Page Style"), "fas fa-columns", "design_first_page"));
$menu->addItem(new MenuAdmin(__("Player Skin"), "fas fa-play-circle", "design_player"));
$menu->addItem(new MenuAdmin(__("Themes"), "fas fa-palette", "design_themes"));
$menu->addItem(new MenuAdmin(__("Colors"), "fas fa-palette", "design_colors"));
//$menu->addItem(new MenuAdmin(__("Custom CSS"), "fab fa-css3-alt", "design_css"));
$itens[] = $menu;
$menu = new MenuAdmin(__("Monetize"), "fas fa-dollar-sign");
$menu->addItem(new MenuAdmin(__("Site Advertisement with VAST Video ads"), "fas fa-money-check-alt", "monetize_vast"));
$menu->addItem(new MenuAdmin(__("Pay User per Video View"), "far fa-money-bill-alt", "monetize_user"));
$menu->addItem(new MenuAdmin(__("Create Subscription Plans"), "fas fa-money-bill-alt", "monetize_subscription"));
//$menu->addItem(new MenuAdmin(__("Banner Script code"), "fas fa-money-check-alt", "advertisement_script"));
$itens[] = $menu;
/*
$menu = new MenuAdmin(__("Update Version"), "glyphicon glyphicon-refresh", "{$global['webSiteRootURL']}update/");
$itens[] = $menu;
*/
$menu = new MenuAdmin(__("Miscellaneous"), "fas fa-th");
$menu->addItem(new MenuAdmin(__("Plugins"), "fas fa-puzzle-piece", "plugins"));
$menu->addItem(new MenuAdmin(__("Email All Users"), "fas fa-mail-bulk", "mail_all_users"));
$itens[] = $menu;
$menu = new MenuAdmin(__("Health Check"), "fas fa-notes-medical", "health_check");
$itens[] = $menu;
$_GET['page'] = xss_esc(@$_GET['page']);
$includeHead = "";
$includeBody = "";
switch ($_GET['page']) {
case "backup":
$includeBody = $global['systemRootPath'] . 'admin/backup.php';
break;
case "premium":
$includeBody = $global['systemRootPath'] . 'admin/premium.php';
break;
case "design_first_page":
$includeBody = $global['systemRootPath'] . 'admin/design_first_page.php';
break;
case "design_themes":
$includeBody = $global['systemRootPath'] . 'admin/design_themes.php';
break;
case "design_colors":
$includeBody = $global['systemRootPath'] . 'admin/design_colors.php';
break;
case "design_player":
$includeBody = $global['systemRootPath'] . 'admin/design_player.php';
break;
case "customize_settings":
$includeBody = $global['systemRootPath'] . 'admin/customize_settings.php';
break;
case "storage_settings":
$includeBody = $global['systemRootPath'] . 'admin/storage_settings.php';
break;
case "general_settings":
$includeBody = $global['systemRootPath'] . 'admin/general_settings.php';
break;
case "payments_settings":
$includeBody = $global['systemRootPath'] . 'admin/payments_settings.php';
break;
case "socialLogin_settings":
$includeBody = $global['systemRootPath'] . 'admin/socialLogin_settings.php';
break;
case "site_settings":
$includeHead = $global['systemRootPath'] . 'view/configurations_head.php';
$includeBody = $global['systemRootPath'] . 'view/configurations_body.php';
break;
case "monetize_subscription":
$includeHead = $global['systemRootPath'] . 'plugin/Subscription/page/editor_head.php';
$includeBody = array();
$includeBody[] = $global['systemRootPath'] . 'plugin/Subscription/page/editor_body.php';
$includeBody[] = $global['systemRootPath'] . 'admin/monetize_subscription.php';
break;
case "monetize_vast":
$includeHead = $global['systemRootPath'] . 'plugin/AD_Server/index_head.php';
$includeBody = $global['systemRootPath'] . 'plugin/AD_Server/index_body.php';
break;
case "monetize_user":
$includeBody = $global['systemRootPath'] . 'admin/monetize_user.php';
break;
case "plugins":
$includeHead = $global['systemRootPath'] . 'view/managerPlugins_head.php';
$includeBody = $global['systemRootPath'] . 'view/managerPlugins_body.php';
break;
case "mail_all_users":
$includeBody = $global['systemRootPath'] . 'admin/mail_all_users.php';
break;
case "users":
$includeHead = $global['systemRootPath'] . 'view/managerUsers_head.php';
$includeBody = $global['systemRootPath'] . 'view/managerUsers_body.php';
break;
case "live":
$includeBody = $global['systemRootPath'] . 'admin/live.php';
break;
case "usersGroups":
$includeHead = $global['systemRootPath'] . 'view/managerUsersGroups_head.php';
$includeBody = $global['systemRootPath'] . 'view/managerUsersGroups_body.php';
break;
case "categories":
$includeHead = $global['systemRootPath'] . 'view/managerCategories_head.php';
$includeBody = $global['systemRootPath'] . 'view/managerCategories_body.php';
break;
case "videos":
$includeHead = $global['systemRootPath'] . 'view/managerVideos_head.php';
$includeBody = $global['systemRootPath'] . 'view/managerVideos_body.php';
break;
case "health_check":
$includeBody = $global['systemRootPath'] . 'admin/health_check.php';
break;
default :
$includeHead = $global['systemRootPath'] . 'view/charts_head.php';
$includeBody = $global['systemRootPath'] . 'view/charts_body.php';
break;
}
?>
<!DOCTYPE html>
<html lang="<?php echo $config->getLanguage(); ?>">
<head>
<?php
echo getHTMLTitle(__("Administration"));
?>
<?php
include $global['systemRootPath'] . 'view/include/head.php';
if (!empty($includeHead) && file_exists($includeHead)) {
echo "<!-- Include $includeHead -->";
include $includeHead;
echo "<!-- END Include $includeHead -->";
}
?>
<style>
@media (max-width: 767px) {
.affix {
position: static;
}
}
.leftMenu .panel-body {
padding: 0px;
}
.adminLeftMenu.panel-default i, .adminLeftMenu.panel-default{
-webkit-transition: opacity 0.5s ease-in-out;
-moz-transition: opacity 0.5s ease-in-out;
transition: opacity 0.5s ease-in-out;
}
.adminLeftMenu.panel-default i{
opacity: 0.2;
}
.adminLeftMenu:hover.panel-default i{
opacity: 1;
}
.adminLeftMenu.panel-default{
opacity: 0.6;
}
.adminLeftMenu:hover.panel-default{
opacity: 1;
}
</style>
</head>
<body class="<?php echo $global['bodyClass']; ?>">
<?php
include $global['systemRootPath'] . 'view/include/navbar.php';
?>
<div class="container-fluid">
<br>
<div class="row">
<div class=" col-lg-2 col-md-3 col-sm-3 fixed affix leftMenu">
<div class="panel-group" id="accordion">
<?php
$panel = 'panel-default';
if(empty($_REQUEST['page'])){
$panel = 'panel-primary';
}
foreach ($itens as $key => $value) {
$uid = uniqid();
$href = 'data-toggle="collapse" data-parent="#accordion" href="#collapse' . $uid . '"';
if (!empty($value->href)) {
$href = 'href="' . $global['webSiteRootURL'] . 'admin/?page=' . $value->href . '"';
}
if (!empty($_REQUEST['page']) && $_REQUEST['page'] == $value->href) {
$panel = 'panel-primary';
} else {
foreach ($value->itens as $key2 => $value2) {
if (!empty($_REQUEST['page']) && $_REQUEST['page'] === $value2->href) {
$panel = 'panel-primary';
}
}
}
?>
<div class="panel <?php echo $panel; ?> adminLeftMenu <?php echo getCSSAnimationClassAndStyle('animate__bounceInLeft', 'menu'); ?>">
<div class="panel-heading">
<h4 class="panel-title">
<a <?php echo $href; ?> >
<i class="<?php echo $value->icon; ?> "></i> <?php echo $value->title; ?>
</a>
</h4>
</div>
<?php
if (!empty($value->itens)) {
$in = "";
if (!empty($_GET['page'])) {
foreach ($value->itens as $search) {
if ($_GET['page'] === $search->href) {
$in = "in";
break;
}
}
}
?>
<div id="collapse<?php echo $uid; ?>" class="panel-collapse collapse <?php echo $in; ?>">
<div class="panel-body">
<table class="table">
<?php
$active = "";
if (empty($_GET['page'])) {
$active = "active";
}
foreach ($value->itens as $key2 => $value2) {
if (!empty($_GET['page']) && $_GET['page'] === $value2->href) {
$active = "active";
}
?>
<tr>
<td class="<?php echo $active; ?>">
<a href="<?php echo "{$global['webSiteRootURL']}admin/?page=" . $value2->href; ?>"><i class="<?php echo $value2->icon; ?>"></i> <?php echo $value2->title; ?></a>
</td>
</tr>
<?php
$active = "";
}
?>
</table>
</div>
</div>
<?php
}
?>
</div>
<?php
$panel = 'panel-default';
}
?>
</div>
</div>
<div class=" col-lg-10 col-md-9 col-sm-9 col-sm-offset-3 col-md-offset-3 col-lg-offset-2 ">
<?php
if (!empty($includeBody)) {
if (is_array($includeBody)) {
foreach ($includeBody as $value) {
if (file_exists($value)) {
include $value;
} else {
?>
<div class="alert alert-danger">
<?php echo __('Please forgive us for bothering you, but unfortunately you do not have this plugin yet. But do not hesitate to purchase it in our online store'); ?>
<a class="btn btn-danger" href="https://youphp.tube/marketplace/"><?php echo __('Plugin Store'); ?></a>
</div>
<?php
}
}
} else {
if (file_exists($includeBody)) {
include $includeBody;
} else {
?>
<div class="alert alert-danger">
<?php echo __('Please forgive us for bothering you, but unfortunately you do not have this plugin yet. But do not hesitate to purchase it in our online store'); ?>
<a class="btn btn-danger" href="https://youphp.tube/marketplace/"><?php echo __('Plugin Store'); ?></a>
</div>
<?php
}
}
}
?>
</div>
</div>
</div>
<?php
include_once $global['systemRootPath'] . 'view/include/footer.php';
?>
<script>
$(document).ready(function () {
$('.adminOptionsForm').submit(function (e) {
e.preventDefault();
modal.showPleaseWait();
$.ajax({
url: '<?php echo $global['webSiteRootURL']; ?>admin/save.json.php',
data: $(this).serialize(),
type: 'post',
success: function (response) {
modal.hidePleaseWait();
}
});
});
$('.pluginSwitch').change(function (e) {
modal.showPleaseWait();
$.ajax({
url: '<?php echo $global['webSiteRootURL']; ?>objects/pluginSwitch.json.php',
data: {"uuid": $(this).attr('uuid'), "name": $(this).attr('name'), "dir": $(this).attr('name'), "enable": $(this).is(":checked")},
type: 'post',
success: function (response) {
modal.hidePleaseWait();
}
});
});
});
</script>
</body>
</html>
<?php
$vars = [];
require_once '../videos/configuration.php';
require_once './functions.php';
if (!User::isAdmin()) {
header("Location: {$global['webSiteRootURL']}");
exit;
}
$isAdminPanel = 1;
class MenuAdmin
{
public $title;
public $icon;
public $href;
public $active = false;
public $show = false;
public $itens = [];
public $data_toggle;
public $data_target;
public function __construct($title, $icon, $href = "", $data_toggle = "", $data_target = "")
{
$this->title = $title;
$this->icon = $icon;
$this->href = $href;
$this->data_toggle = $data_toggle;
$this->data_target = $data_target;
if (!empty($href)) {
$fileName = basename($_SERVER["SCRIPT_NAME"]);
if ($href === $fileName) {
$this->active = true;
}
}
}
public function addItem(MenuAdmin $menu)
{
$this->itens[] = $menu;
if ($menu->active) {
$this->show = true;
}
}
}
$itens = [];
$menu = new MenuAdmin(__("Dashboard"), "fa fa-tachometer-alt", "dashboard");
$itens[] = $menu;
/*
$menu = new MenuAdmin(__("Premium Featrures"), "fas fa-star", "premium");
$itens[] = $menu;
*/
$menu = new MenuAdmin(__("Settings"), "fa fa-wrench");
$menu->addItem(new MenuAdmin(__("Remove Branding"), "far fa-edit", "customize_settings"));
$menu->addItem(new MenuAdmin(__("General Settings"), "fas fa-cog", "general_settings"));
$menu->addItem(new MenuAdmin(__("Site Settings"), "fas fa-sitemap", "site_settings"));
$menu->addItem(new MenuAdmin(__("Social Login Settings"), "fas fa-sign-in-alt", "socialLogin_settings"));
$menu->addItem(new MenuAdmin(__("S3, B2, FTP settings"), "fas fa-hdd", "storage_settings"));
$menu->addItem(new MenuAdmin(__("Payments Settings"), "far fa-money-bill-alt", "payments_settings"));
$itens[] = $menu;
$menu = new MenuAdmin(__("Contents"), "fas fa-list-ul");
$menu->addItem(new MenuAdmin(__("Videos"), "fas fa-play-circle", "videos"));
$menu->addItem(new MenuAdmin(__("Live Stuff"), "fas fa-broadcast-tower", "live"));
$menu->addItem(new MenuAdmin(__("Users"), "glyphicon glyphicon-user", "users"));
$menu->addItem(new MenuAdmin(__("Users Groups"), "fa fa-users", "usersGroups"));
$menu->addItem(new MenuAdmin(__("Categories"), "glyphicon glyphicon-list", "categories"));
$menu->addItem(new MenuAdmin(__("Backup"), "fas fa-undo-alt", "backup"));
$itens[] = $menu;
$menu = new MenuAdmin(__("Design"), "fas fa-pen-fancy");
$menu->addItem(new MenuAdmin(__("First Page Style"), "fas fa-columns", "design_first_page"));
$menu->addItem(new MenuAdmin(__("Player Skin"), "fas fa-play-circle", "design_player"));
$menu->addItem(new MenuAdmin(__("Themes"), "fas fa-palette", "design_themes"));
$menu->addItem(new MenuAdmin(__("Colors"), "fas fa-palette", "design_colors"));
//$menu->addItem(new MenuAdmin(__("Custom CSS"), "fab fa-css3-alt", "design_css"));
$itens[] = $menu;
$menu = new MenuAdmin(__("Monetize"), "fas fa-dollar-sign");
$menu->addItem(new MenuAdmin(__("Site Advertisement with VAST Video ads"), "fas fa-money-check-alt", "monetize_vast"));
$menu->addItem(new MenuAdmin(__("Pay User per Video View"), "far fa-money-bill-alt", "monetize_user"));
$menu->addItem(new MenuAdmin(__("Create Subscription Plans"), "fas fa-money-bill-alt", "monetize_subscription"));
//$menu->addItem(new MenuAdmin(__("Banner Script code"), "fas fa-money-check-alt", "advertisement_script"));
$itens[] = $menu;
/*
$menu = new MenuAdmin(__("Update Version"), "glyphicon glyphicon-refresh", "{$global['webSiteRootURL']}update/");
$itens[] = $menu;
*/
$menu = new MenuAdmin(__("Miscellaneous"), "fas fa-th");
$menu->addItem(new MenuAdmin(__("Plugins"), "fas fa-puzzle-piece", "plugins"));
$menu->addItem(new MenuAdmin(__("Email All Users"), "fas fa-mail-bulk", "mail_all_users"));
$itens[] = $menu;
$menu = new MenuAdmin(__("Health Check"), "fas fa-notes-medical", "health_check");
$itens[] = $menu;
$_GET['page'] = xss_esc(@$_GET['page']);
$includeHead = '';
$includeBody = '';
switch ($_GET['page']) {
case "backup":
$includeBody = $global['systemRootPath'] . 'admin/backup.php';
break;
case "premium":
$includeBody = $global['systemRootPath'] . 'admin/premium.php';
break;
case "design_first_page":
$includeBody = $global['systemRootPath'] . 'admin/design_first_page.php';
break;
case "design_themes":
$includeBody = $global['systemRootPath'] . 'admin/design_themes.php';
break;
case "design_colors":
$includeBody = $global['systemRootPath'] . 'admin/design_colors.php';
break;
case "design_player":
$includeBody = $global['systemRootPath'] . 'admin/design_player.php';
break;
case "customize_settings":
$includeBody = $global['systemRootPath'] . 'admin/customize_settings.php';
break;
case "storage_settings":
$includeBody = $global['systemRootPath'] . 'admin/storage_settings.php';
break;
case "general_settings":
$includeBody = $global['systemRootPath'] . 'admin/general_settings.php';
break;
case "payments_settings":
$includeBody = $global['systemRootPath'] . 'admin/payments_settings.php';
break;
case "socialLogin_settings":
$includeBody = $global['systemRootPath'] . 'admin/socialLogin_settings.php';
break;
case "site_settings":
$includeHead = $global['systemRootPath'] . 'view/configurations_head.php';
$includeBody = $global['systemRootPath'] . 'view/configurations_body.php';
break;
case "monetize_subscription":
$includeHead = $global['systemRootPath'] . 'plugin/Subscription/page/editor_head.php';
$includeBody = [];
$includeBody[] = $global['systemRootPath'] . 'plugin/Subscription/page/editor_body.php';
$includeBody[] = $global['systemRootPath'] . 'admin/monetize_subscription.php';
break;
case "monetize_vast":
$includeHead = $global['systemRootPath'] . 'plugin/AD_Server/index_head.php';
$includeBody = $global['systemRootPath'] . 'plugin/AD_Server/index_body.php';
break;
case "monetize_user":
$includeBody = $global['systemRootPath'] . 'admin/monetize_user.php';
break;
case "plugins":
$includeHead = $global['systemRootPath'] . 'view/managerPlugins_head.php';
$includeBody = $global['systemRootPath'] . 'view/managerPlugins_body.php';
break;
case "mail_all_users":
$includeBody = $global['systemRootPath'] . 'admin/mail_all_users.php';
break;
case "users":
$includeHead = $global['systemRootPath'] . 'view/managerUsers_head.php';
$includeBody = $global['systemRootPath'] . 'view/managerUsers_body.php';
break;
case "live":
$includeBody = $global['systemRootPath'] . 'admin/live.php';
break;
case "usersGroups":
$includeHead = $global['systemRootPath'] . 'view/managerUsersGroups_head.php';
$includeBody = $global['systemRootPath'] . 'view/managerUsersGroups_body.php';
break;
case "categories":
$includeHead = $global['systemRootPath'] . 'view/managerCategories_head.php';
$includeBody = $global['systemRootPath'] . 'view/managerCategories_body.php';
break;
case "videos":
$includeHead = $global['systemRootPath'] . 'view/managerVideos_head.php';
$includeBody = $global['systemRootPath'] . 'view/managerVideos_body.php';
break;
case "health_check":
$includeBody = $global['systemRootPath'] . 'admin/health_check.php';
break;
default:
$includeHead = $global['systemRootPath'] . 'view/charts_head.php';
$includeBody = $global['systemRootPath'] . 'view/charts_body.php';
break;
}
?>
<!DOCTYPE html>
<html lang="<?php echo $config->getLanguage(); ?>">
<head>
<?php
echo getHTMLTitle(__("Administration"));
?>
<?php
include $global['systemRootPath'] . 'view/include/head.php';
if (!empty($includeHead) && file_exists($includeHead)) {
echo "<!-- Include $includeHead -->";
include $includeHead;
echo "<!-- END Include $includeHead -->";
}
?>
<style>
@media (max-width: 767px) {
.affix {
position: static;
}
}
.leftMenu .panel-body {
padding: 0px;
}
.adminLeftMenu.panel-default i, .adminLeftMenu.panel-default{
-webkit-transition: opacity 0.5s ease-in-out;
-moz-transition: opacity 0.5s ease-in-out;
transition: opacity 0.5s ease-in-out;
}
.adminLeftMenu.panel-default i{
opacity: 0.2;
}
.adminLeftMenu:hover.panel-default i{
opacity: 1;
}
.adminLeftMenu.panel-default{
opacity: 0.6;
}
.adminLeftMenu:hover.panel-default{
opacity: 1;
}
</style>
</head>
<body class="<?php echo $global['bodyClass']; ?>">
<?php
include $global['systemRootPath'] . 'view/include/navbar.php';
?>
<div class="container-fluid">
<br>
<div class="row">
<div class=" col-lg-2 col-md-3 col-sm-3 fixed affix leftMenu">
<div class="panel-group" id="accordion">
<?php
$panel = 'panel-default';
if (empty($_REQUEST['page'])) {
$panel = 'panel-primary';
}
foreach ($itens as $key => $value) {
$uid = uniqid();
$href = 'data-toggle="collapse" data-parent="#accordion" href="#collapse' . $uid . '"';
if (!empty($value->href)) {
$href = 'href="' . $global['webSiteRootURL'] . 'admin/?page=' . $value->href . '"';
}
if (!empty($_REQUEST['page']) && $_REQUEST['page'] == $value->href) {
$panel = 'panel-primary';
} else {
foreach ($value->itens as $key2 => $value2) {
if (!empty($_REQUEST['page']) && $_REQUEST['page'] === $value2->href) {
$panel = 'panel-primary';
}
}
} ?>
<div class="panel <?php echo $panel; ?> adminLeftMenu <?php echo getCSSAnimationClassAndStyle('animate__bounceInLeft', 'menu'); ?>">
<div class="panel-heading">
<h4 class="panel-title">
<a <?php echo $href; ?> >
<i class="<?php echo $value->icon; ?> "></i> <?php echo $value->title; ?>
</a>
</h4>
</div>
<?php
if (!empty($value->itens)) {
$in = '';
if (!empty($_GET['page'])) {
foreach ($value->itens as $search) {
if ($_GET['page'] === $search->href) {
$in = "in";
break;
}
}
} ?>
<div id="collapse<?php echo $uid; ?>" class="panel-collapse collapse <?php echo $in; ?>">
<div class="panel-body">
<table class="table">
<?php
$active = '';
if (empty($_GET['page'])) {
$active = "active";
}
foreach ($value->itens as $key2 => $value2) {
if (!empty($_GET['page']) && $_GET['page'] === $value2->href) {
$active = "active";
} ?>
<tr>
<td class="<?php echo $active; ?>">
<a href="<?php echo "{$global['webSiteRootURL']}admin/?page=" . $value2->href; ?>"><i class="<?php echo $value2->icon; ?>"></i> <?php echo $value2->title; ?></a>
</td>
</tr>
<?php
$active = '';
} ?>
</table>
</div>
</div>
<?php
} ?>
</div>
<?php
$panel = 'panel-default';
}
?>
</div>
</div>
<div class=" col-lg-10 col-md-9 col-sm-9 col-sm-offset-3 col-md-offset-3 col-lg-offset-2 ">
<?php
if (!empty($includeBody)) {
if (is_array($includeBody)) {
foreach ($includeBody as $value) {
if (file_exists($value)) {
include $value;
} else {
?>
<div class="alert alert-danger">
<?php echo __('Please forgive us for bothering you, but unfortunately you do not have this plugin yet. But do not hesitate to purchase it in our online store'); ?>
<a class="btn btn-danger" href="https://youphp.tube/marketplace/"><?php echo __('Plugin Store'); ?></a>
</div>
<?php
}
}
} else {
if (file_exists($includeBody)) {
include $includeBody;
} else {
?>
<div class="alert alert-danger">
<?php echo __('Please forgive us for bothering you, but unfortunately you do not have this plugin yet. But do not hesitate to purchase it in our online store'); ?>
<a class="btn btn-danger" href="https://youphp.tube/marketplace/"><?php echo __('Plugin Store'); ?></a>
</div>
<?php
}
}
}
?>
</div>
</div>
</div>
<?php
include_once $global['systemRootPath'] . 'view/include/footer.php';
?>
<script>
$(document).ready(function () {
$('.adminOptionsForm').submit(function (e) {
e.preventDefault();
modal.showPleaseWait();
$.ajax({
url: '<?php echo $global['webSiteRootURL']; ?>admin/save.json.php',
data: $(this).serialize(),
type: 'post',
success: function (response) {
modal.hidePleaseWait();
}
});
});
$('.pluginSwitch').change(function (e) {
modal.showPleaseWait();
$.ajax({
url: '<?php echo $global['webSiteRootURL']; ?>objects/pluginSwitch.json.php',
data: {"uuid": $(this).attr('uuid'), "name": $(this).attr('name'), "dir": $(this).attr('name'), "enable": $(this).is(":checked")},
type: 'post',
success: function (response) {
modal.hidePleaseWait();
}
});
});
});
</script>
</body>
</html>

View file

@ -1,53 +1,49 @@
<div class="row">
<div class="col-md-6">
<div class="panel panel-default">
<div class="panel-heading"><?php echo __('Live') ?> <div class="pull-right"><?php echo getPluginSwitch('Live'); ?></div></div>
<div class="panel-body">
<?php
createTable("Live");
?>
</div>
</div>
</div>
<div class="col-md-6">
<div class="panel panel-default">
<div class="panel-heading"><?php echo __('Chat') ?> <div class="pull-right"><?php echo getPluginSwitch('Chat2'); ?></div></div>
<div class="panel-body">
<?php
createTable("Chat2");
?>
</div>
</div>
</div>
<div class="col-md-6">
<div class="panel panel-default">
<div class="panel-heading"><?php echo __('Live Users') ?> <div class="pull-right"><?php echo getPluginSwitch('LiveUsers'); ?></div></div>
<div class="panel-body">
<?php
$filter = array(
'doNotDisplayCounter' => 'It will collect usage info but will not display the counter on the live video');
createTable("LiveUsers",$filter);
?>
</div>
</div>
</div>
<div class="col-md-6">
<div class="panel panel-default">
<div class="panel-heading"><?php echo __('Live Links') ?> <div class="pull-right"><?php echo getPluginSwitch('LiveLinks'); ?></div></div>
<div class="panel-body">
<?php
createTable("LiveLinks");
?>
</div>
</div>
</div>
<div class="row">
<div class="col-md-6">
<div class="panel panel-default">
<div class="panel-heading"><?php echo __('Live') ?> <div class="pull-right"><?php echo getPluginSwitch('Live'); ?></div></div>
<div class="panel-body">
<?php
createTable("Live");
?>
</div>
</div>
</div>
<div class="col-md-6">
<div class="panel panel-default">
<div class="panel-heading"><?php echo __('Chat') ?> <div class="pull-right"><?php echo getPluginSwitch('Chat2'); ?></div></div>
<div class="panel-body">
<?php
createTable("Chat2");
?>
</div>
</div>
</div>
<div class="col-md-6">
<div class="panel panel-default">
<div class="panel-heading"><?php echo __('Live Users') ?> <div class="pull-right"><?php echo getPluginSwitch('LiveUsers'); ?></div></div>
<div class="panel-body">
<?php
$filter = [
'doNotDisplayCounter' => 'It will collect usage info but will not display the counter on the live video', ];
createTable("LiveUsers", $filter);
?>
</div>
</div>
</div>
<div class="col-md-6">
<div class="panel panel-default">
<div class="panel-heading"><?php echo __('Live Links') ?> <div class="pull-right"><?php echo getPluginSwitch('LiveLinks'); ?></div></div>
<div class="panel-body">
<?php
createTable("LiveLinks");
?>
</div>
</div>
</div>
</div>

View file

@ -1,78 +1,78 @@
<link href="<?php echo getCDN(); ?>view/js/bootstrap3-wysiwyg/bootstrap3-wysihtml5.min.css" rel="stylesheet" type="text/css"/>
<div class="panel panel-default">
<div class="panel-heading"><?php echo __("Email All Users"); ?></div>
<div class="panel-body">
<div class="row">
<label class="col-md-4" style="text-align: right;">
<?php echo __('Sent only to this email'); ?>:
</label>
<div class="col-md-8">
<input class="form-control" type="email" id="email" placeholder="test@email.com">
<small><?php echo __('Leave it blank to send to all users'); ?> <?php echo __('or user group selected below'); ?></small>
</div>
</div>
<div class="row">
<label class="col-md-4" style="text-align: right;">
<?php echo __('Filter users'); ?>:
</label>
<div class="col-md-8">
<label class="radio-inline"><input type="radio" name="userGroup" value="0" checked><?php echo __("All"); ?></label>
<?php
$userGroups = UserGroups::getAllUsersGroupsArray();
foreach ($userGroups as $key => $value) {
echo '<label class="radio-inline"><input type="radio" name="userGroup" value="' . $key . '">' . $value . '</label>';
}
?>
</div>
</div>
<hr>
<div class="row">
<div class="col-lg-12">
<textarea id="emailMessage" placeholder="<?php echo __("Enter text"); ?> ..." style="width: 100%;"></textarea>
</div>
</div>
<div class="row">
<div class="col-lg-12">
<button type="button" class="btn btn-success btn-block" id="sendSubscribeBtn">
<i class="fas fa-envelope-square"></i> <?php echo __("Send Email"); ?>
</button>
</div>
</div>
</div>
</div>
<script src="<?php echo getCDN(); ?>view/js/bootstrap3-wysiwyg/bootstrap3-wysihtml5.all.min.js" type="text/javascript"></script>
<script>
function notify() {
modal.showPleaseWait();
$.ajax({
url: '<?php echo $global['webSiteRootURL']; ?>objects/emailAllUsers.json.php',
method: 'POST',
data: {
'message': $('#emailMessage').val(),
'email': $('#email').val(),
'users_groups_id': $('input[name="userGroup"]:checked').val()
},
success: function (response) {
console.log(response);
if (response.error) {
avideoAlert("<?php echo __("Sorry!"); ?>", response.msg[0], "error");
} else {
avideoAlert("<?php echo __("Success"); ?>", "You have sent " + response.count + " emails", "success");
}
modal.hidePleaseWait();
}
});
}
$(document).ready(function () {
$('#emailMessage').wysihtml5();
$("#sendSubscribeBtn").click(function () {
notify();
});
});
</script>
<link href="<?php echo getCDN(); ?>view/js/bootstrap3-wysiwyg/bootstrap3-wysihtml5.min.css" rel="stylesheet" type="text/css"/>
<div class="panel panel-default">
<div class="panel-heading"><?php echo __("Email All Users"); ?></div>
<div class="panel-body">
<div class="row">
<label class="col-md-4" style="text-align: right;">
<?php echo __('Sent only to this email'); ?>:
</label>
<div class="col-md-8">
<input class="form-control" type="email" id="email" placeholder="test@email.com">
<small><?php echo __('Leave it blank to send to all users'); ?> <?php echo __('or user group selected below'); ?></small>
</div>
</div>
<div class="row">
<label class="col-md-4" style="text-align: right;">
<?php echo __('Filter users'); ?>:
</label>
<div class="col-md-8">
<label class="radio-inline"><input type="radio" name="userGroup" value="0" checked><?php echo __("All"); ?></label>
<?php
$userGroups = UserGroups::getAllUsersGroupsArray();
foreach ($userGroups as $key => $value) {
echo '<label class="radio-inline"><input type="radio" name="userGroup" value="' . $key . '">' . $value . '</label>';
}
?>
</div>
</div>
<hr>
<div class="row">
<div class="col-lg-12">
<textarea id="emailMessage" placeholder="<?php echo __("Enter text"); ?> ..." style="width: 100%;"></textarea>
</div>
</div>
<div class="row">
<div class="col-lg-12">
<button type="button" class="btn btn-success btn-block" id="sendSubscribeBtn">
<i class="fas fa-envelope-square"></i> <?php echo __("Send Email"); ?>
</button>
</div>
</div>
</div>
</div>
<script src="<?php echo getCDN(); ?>view/js/bootstrap3-wysiwyg/bootstrap3-wysihtml5.all.min.js" type="text/javascript"></script>
<script>
function notify() {
modal.showPleaseWait();
$.ajax({
url: '<?php echo $global['webSiteRootURL']; ?>objects/emailAllUsers.json.php',
method: 'POST',
data: {
'message': $('#emailMessage').val(),
'email': $('#email').val(),
'users_groups_id': $('input[name="userGroup"]:checked').val()
},
success: function (response) {
console.log(response);
if (response.error) {
avideoAlert("<?php echo __("Sorry!"); ?>", response.msg[0], "error");
} else {
avideoAlert("<?php echo __("Success"); ?>", "You have sent " + response.count + " emails", "success");
}
modal.hidePleaseWait();
}
});
}
$(document).ready(function () {
$('#emailMessage').wysihtml5();
$("#sendSubscribeBtn").click(function () {
notify();
});
});
</script>

View file

@ -1,16 +1,16 @@
<div class="row">
<div class="col-md-12">
<div class="panel panel-default">
<div class="panel-heading"><i class="fa fa-cog"></i> Subscription Configuration </div>
<div class="panel-body" style="overflow: hidden;">
<?php
$filter = array(
'displayTopBarSubscribeButton' => 'Show a button on the top to subscribe',
'displayLeftMenuSubscribeButton' => 'Show a button on the the left menu to subscribe',
'textSubscribe' => 'The button text label');
createTable("Subscription", $filter);
?>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="panel panel-default">
<div class="panel-heading"><i class="fa fa-cog"></i> Subscription Configuration </div>
<div class="panel-body" style="overflow: hidden;">
<?php
$filter = [
'displayTopBarSubscribeButton' => 'Show a button on the top to subscribe',
'displayLeftMenuSubscribeButton' => 'Show a button on the the left menu to subscribe',
'textSubscribe' => 'The button text label', ];
createTable("Subscription", $filter);
?>
</div>
</div>
</div>
</div>

View file

@ -1,34 +1,34 @@
<div class="row">
<div class="col-md-6">
<div class="panel panel-default">
<div class="panel-heading"><?php echo __('Monetize User') ?> <div class="pull-right"><?php echo getPluginSwitch('MonetizeUsers'); ?></div></div>
<div class="panel-body">
<?php
$filter = array(
'rewardPerView' => 'How much will your users receive per each video view',
'rewardOnlyLoggedUsersView' => 'Check this to allow only count rewards from logged users');
createTable("MonetizeUsers",$filter);
?>
</div>
</div>
</div>
<div class="col-md-6">
<div class="panel panel-default">
<div class="panel-heading"><?php echo __('Wallet') ?> <div class="pull-right"><?php echo getPluginSwitch('YPTWallet'); ?></div></div>
<div class="panel-body">
<?php
$filter = array(
'decimalPrecision' => 'Usually for USD we use 2, for cryptocurrencies we use more the 2',
'currency' => 'Australian Dollar = AUD, Brazilian Real = BRL, Canadian Dollar = CAD, Euro = EUR, U.S. Dollar = USD, etc',
'currency_symbol' => '$, R$, etc, the format will be {currency} {value} {currency_symbol} for example ($ 10.00 USD) or (R$ 10.00 BRL)',
'manualAddFundsTransferFromUserId' => 'When some one buy something on your web site, the wallet balance will be transferred to this user ID',
'enablePlugin_YPTWalletPayPal' => 'You need to enable it to be able to use PayPal to add funds on your wallet',
'enableManualWithdrawFundsPage' => 'Let users request withdraws from his wallet. the withdraw mus be done manually');
createTable("YPTWallet", $filter);
?>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-md-6">
<div class="panel panel-default">
<div class="panel-heading"><?php echo __('Monetize User') ?> <div class="pull-right"><?php echo getPluginSwitch('MonetizeUsers'); ?></div></div>
<div class="panel-body">
<?php
$filter = [
'rewardPerView' => 'How much will your users receive per each video view',
'rewardOnlyLoggedUsersView' => 'Check this to allow only count rewards from logged users', ];
createTable("MonetizeUsers", $filter);
?>
</div>
</div>
</div>
<div class="col-md-6">
<div class="panel panel-default">
<div class="panel-heading"><?php echo __('Wallet') ?> <div class="pull-right"><?php echo getPluginSwitch('YPTWallet'); ?></div></div>
<div class="panel-body">
<?php
$filter = [
'decimalPrecision' => 'Usually for USD we use 2, for cryptocurrencies we use more the 2',
'currency' => 'Australian Dollar = AUD, Brazilian Real = BRL, Canadian Dollar = CAD, Euro = EUR, U.S. Dollar = USD, etc',
'currency_symbol' => '$, R$, etc, the format will be {currency} {value} {currency_symbol} for example ($ 10.00 USD) or (R$ 10.00 BRL)',
'manualAddFundsTransferFromUserId' => 'When some one buy something on your web site, the wallet balance will be transferred to this user ID',
'enablePlugin_YPTWalletPayPal' => 'You need to enable it to be able to use PayPal to add funds on your wallet',
'enableManualWithdrawFundsPage' => 'Let users request withdraws from his wallet. the withdraw mus be done manually', ];
createTable("YPTWallet", $filter);
?>
</div>
</div>
</div>
</div>

View file

@ -1,29 +1,29 @@
<div class="row">
<div class="col-md-12">
<div class="panel panel-default">
<div class="panel-heading"><i class="fas fa-wallet"></i> <?php echo __('Wallet'); ?> <div class="pull-right"><?php echo getPluginSwitch('YPTWallet'); ?></div></div>
<div class="panel-body" style="overflow: hidden;">
<?php
$filter = array(
'decimalPrecision' => __('Usually for USD we use 2, for cryptocurrencies we use more the 2'),
'currency' => __('Australian Dollar = AUD, Brazilian Real = BRL, Canadian Dollar = CAD, Euro = EUR, U.S. Dollar = USD, etc'),
'currency_symbol' => __('$, R$, etc, the format will be {currency} {value} {currency_symbol} for example ($ 10.00 USD) or (R$ 10.00 BRL)'),
'manualAddFundsTransferFromUserId' => __('When some one buy something on your web site, the wallet balance will be transferred to this user ID'),
'enablePlugin_YPTWalletPayPal' => __('You need to enable it to be able to use PayPal to add funds on your wallet'),
'enableManualWithdrawFundsPage' => __('Let users request withdraws from his wallet. the withdraw mus be done manually'));
createTable("YPTWallet", $filter);
?>
</div>
</div>
</div>
<div class="col-md-12">
<div class="panel panel-default">
<div class="panel-heading"><i class="fab fa-paypal"></i> PayPal <div class="pull-right"><?php echo getPluginSwitch('PayPalYPT'); ?></div></div>
<div class="panel-body" style="overflow: hidden;">
<?php
createTable("PayPalYPT");
?>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="panel panel-default">
<div class="panel-heading"><i class="fas fa-wallet"></i> <?php echo __('Wallet'); ?> <div class="pull-right"><?php echo getPluginSwitch('YPTWallet'); ?></div></div>
<div class="panel-body" style="overflow: hidden;">
<?php
$filter = [
'decimalPrecision' => __('Usually for USD we use 2, for cryptocurrencies we use more the 2'),
'currency' => __('Australian Dollar = AUD, Brazilian Real = BRL, Canadian Dollar = CAD, Euro = EUR, U.S. Dollar = USD, etc'),
'currency_symbol' => __('$, R$, etc, the format will be {currency} {value} {currency_symbol} for example ($ 10.00 USD) or (R$ 10.00 BRL)'),
'manualAddFundsTransferFromUserId' => __('When some one buy something on your web site, the wallet balance will be transferred to this user ID'),
'enablePlugin_YPTWalletPayPal' => __('You need to enable it to be able to use PayPal to add funds on your wallet'),
'enableManualWithdrawFundsPage' => __('Let users request withdraws from his wallet. the withdraw mus be done manually'), ];
createTable("YPTWallet", $filter);
?>
</div>
</div>
</div>
<div class="col-md-12">
<div class="panel panel-default">
<div class="panel-heading"><i class="fab fa-paypal"></i> PayPal <div class="pull-right"><?php echo getPluginSwitch('PayPalYPT'); ?></div></div>
<div class="panel-body" style="overflow: hidden;">
<?php
createTable("PayPalYPT");
?>
</div>
</div>
</div>
</div>

View file

@ -1,25 +1,25 @@
<?php
header('Content-Type: application/json');
global $global, $config;
if (!isset($global['systemRootPath'])) {
require_once '../videos/configuration.php';
}
require_once $global['systemRootPath'] . 'objects/user.php';
if (!User::isAdmin()) {
die('{"error":"' . __("Permission denied") . '"}');
}
$pluginName = 'PlayerSkins';
$pluginDO = AVideoPlugin::getObjectData($pluginName);
$pluginDB = Plugin::getOrCreatePluginByName($pluginName, 'active');
$pluginDO->skin = $_POST['skin'];
$p = new Plugin($pluginDB['id']);
$p->setObject_data(json_encode($pluginDO));
$obj = new stdClass();
$obj->save = $p->save();
echo (json_encode($obj));
<?php
header('Content-Type: application/json');
global $global, $config;
if (!isset($global['systemRootPath'])) {
require_once '../videos/configuration.php';
}
require_once $global['systemRootPath'] . 'objects/user.php';
if (!User::isAdmin()) {
die('{"error":"' . __("Permission denied") . '"}');
}
$pluginName = 'PlayerSkins';
$pluginDO = AVideoPlugin::getObjectData($pluginName);
$pluginDB = Plugin::getOrCreatePluginByName($pluginName, 'active');
$pluginDO->skin = $_POST['skin'];
$p = new Plugin($pluginDB['id']);
$p->setObject_data(json_encode($pluginDO));
$obj = new stdClass();
$obj->save = $p->save();
echo(json_encode($obj));

View file

@ -1,39 +1,39 @@
<div class="row">
<div class="col-sm-6">
<div class="panel panel-default">
<div class="panel-heading"><?php echo __('CDN'); ?> </div>
<div class="panel-body">
</div>
</div>
</div>
<div class="col-sm-6">
<div class="panel panel-default">
<div class="panel-heading"><?php echo __('CDN Storage'); ?> </div>
<div class="panel-body">
</div>
</div>
</div>
<div class="col-sm-6">
<div class="panel panel-default">
<div class="panel-heading"><?php echo __('WebCam to Live'); ?> </div>
<div class="panel-body">
</div>
</div>
</div>
<div class="col-sm-6">
<div class="panel panel-default">
<div class="panel-heading"><?php echo __('Meet'); ?> </div>
<div class="panel-body">
</div>
</div>
</div>
</div>
<script>
$(document).ready(function () {
});
</script>
<div class="row">
<div class="col-sm-6">
<div class="panel panel-default">
<div class="panel-heading"><?php echo __('CDN'); ?> </div>
<div class="panel-body">
</div>
</div>
</div>
<div class="col-sm-6">
<div class="panel panel-default">
<div class="panel-heading"><?php echo __('CDN Storage'); ?> </div>
<div class="panel-body">
</div>
</div>
</div>
<div class="col-sm-6">
<div class="panel panel-default">
<div class="panel-heading"><?php echo __('WebCam to Live'); ?> </div>
<div class="panel-body">
</div>
</div>
</div>
<div class="col-sm-6">
<div class="panel panel-default">
<div class="panel-heading"><?php echo __('Meet'); ?> </div>
<div class="panel-body">
</div>
</div>
</div>
</div>
<script>
$(document).ready(function () {
});
</script>

View file

@ -1,48 +1,50 @@
<?php
header('Content-Type: application/json');
global $global, $config;
if (!isset($global['systemRootPath'])) {
require_once '../videos/configuration.php';
}
require_once $global['systemRootPath'] . 'objects/user.php';
if (!User::isAdmin()) {
die('{"error":"' . __("Permission denied") . '"}');
}
$pluginName = $_POST['pluginName'];
if (empty($_POST['pluginsList'])) {
unset($_POST['pluginsList']);
unset($_POST['pluginName']);
$pluginValues = $_POST;
} else {
$pluginsList = explode("|", $_POST['pluginsList']);
$pluginValues = array();
foreach ($pluginsList as $value) {
$pluginValues[$value] = empty($_POST[$value]) ? false : ($_POST[$value]==1||$_POST[$value]=="true"?true:$_POST[$value]);
}
}
$pluginDO = AVideoPlugin::getObjectData($pluginName);
$pluginDB = Plugin::getPluginByName($pluginName);
foreach ($pluginDO as $key => $value) {
if (isset($pluginValues[$key])) {
if (is_bool($pluginDO->$key)) {
$pluginDO->$key = empty($pluginValues[$key])?false:true;
} else {
//$pluginDO->$key = str_replace('"', '\\"', $pluginValues[$key]);
$pluginDO->$key = $pluginValues[$key];
}
}
}
$p = new Plugin($pluginDB['id']);
$p->setObject_data(json_encode($pluginDO));
$obj = new stdClass();
$obj->save = $p->save();
if ($obj->save === false) _error_log("[ERROR] Error saving plugin $pluginName data. Maybe plugin is not enabled?", AVideoLog::$ERROR);
echo (json_encode($obj));
<?php
header('Content-Type: application/json');
global $global, $config;
if (!isset($global['systemRootPath'])) {
require_once '../videos/configuration.php';
}
require_once $global['systemRootPath'] . 'objects/user.php';
if (!User::isAdmin()) {
die('{"error":"' . __("Permission denied") . '"}');
}
$pluginName = $_POST['pluginName'];
if (empty($_POST['pluginsList'])) {
unset($_POST['pluginsList']);
unset($_POST['pluginName']);
$pluginValues = $_POST;
} else {
$pluginsList = explode("|", $_POST['pluginsList']);
$pluginValues = [];
foreach ($pluginsList as $value) {
$pluginValues[$value] = empty($_POST[$value]) ? false : ($_POST[$value]==1||$_POST[$value]=="true" ? true : $_POST[$value]);
}
}
$pluginDO = AVideoPlugin::getObjectData($pluginName);
$pluginDB = Plugin::getPluginByName($pluginName);
foreach ($pluginDO as $key => $value) {
if (isset($pluginValues[$key])) {
if (is_bool($pluginDO->$key)) {
$pluginDO->$key = empty($pluginValues[$key]) ? false : true;
} else {
//$pluginDO->$key = str_replace('"', '\\"', $pluginValues[$key]);
$pluginDO->$key = $pluginValues[$key];
}
}
}
$p = new Plugin($pluginDB['id']);
$p->setObject_data(json_encode($pluginDO));
$obj = new stdClass();
$obj->save = $p->save();
if ($obj->save === false) {
_error_log("[ERROR] Error saving plugin $pluginName data. Maybe plugin is not enabled?", AVideoLog::$ERROR);
}
echo(json_encode($obj));

View file

@ -1,106 +1,106 @@
<div class="row">
<div class="col-md-6">
<div class="panel panel-default">
<div class="panel-heading"><i class="fa fa-cog"></i> <?php echo __('Customize options'); ?> <div class="pull-right"><?php echo getPluginSwitch('CustomizeAdvanced'); ?></div></div>
<div class="panel-body" style="overflow: hidden;">
<?php
$filter = array(
'disableNativeSignUp' => __('The form to signup will not exists'),
'disableNativeSignIn' => __('The regular form to signin will not exist, if you check this will only have social login or LDAP option'),
'userMustBeLoggedIn' => __('The site will display only a login form to un authenticated users'));
createTable("CustomizeUser", $filter);
?>
</div>
</div>
</div>
<div class="col-md-6">
<div class="panel panel-default">
<div class="panel-heading"><i class="fab fa-facebook-square"></i> Facebook <div class="pull-right"><?php echo getPluginSwitch('LoginFacebook'); ?></div></div>
<div class="panel-body" style="overflow: hidden;">
<?php
createTable("LoginFacebook");
?>
<small class="form-text text-muted">
<a href="https://developers.facebook.com/apps"><?php echo __('Get Facebook ID and Key'); ?></a><br>
<?php echo __('Valid OAuth redirect URIs'); ?>: <strong><?php echo $global['webSiteRootURL']; ?>objects/login.json.php?type=Facebook</strong><br>
<?php echo __('For mobile a Valid OAuth redirect URIs'); ?>: <strong><?php echo $global['webSiteRootURL']; ?>plugin/MobileManager/oauth2.php?type=Facebook</strong>
</small>
</div>
</div>
</div>
<div class="col-md-6">
<div class="panel panel-default">
<div class="panel-heading"><i class="fab fa-google-plus-g"></i> Google <div class="pull-right"><?php echo getPluginSwitch('LoginGoogle'); ?></div></div>
<div class="panel-body" style="overflow: hidden;">
<?php
createTable("LoginGoogle");
?>
<small class="form-text text-muted">
<a href="https://console.developers.google.com/apis/credentials"><?php echo __('Get Google ID and Key'); ?></a><br>
<?php echo __('Valid OAuth redirect URIs'); ?>: <strong><?php echo $global['webSiteRootURL']; ?>objects/login.json.php?type=Google</strong><br>
<?php echo __('For mobile a Valid OAuth redirect URIs'); ?>: <strong><?php echo $global['webSiteRootURL']; ?>plugin/MobileManager/oauth2.php?type=Google</strong>
</small>
</div>
</div>
</div>
<div class="col-md-6">
<div class="panel panel-default">
<div class="panel-heading"><i class="fab fa-linkedin"></i> Linkedin <div class="pull-right"><?php echo getPluginSwitch('LoginLinkedin'); ?></div></div>
<div class="panel-body" style="overflow: hidden;">
<?php
createTable("LoginLinkedin");
?>
<small class="form-text text-muted">
<a href="https://www.linkedin.com/secure/developer"><?php echo __('Get Linkedin ID and Key'); ?></a><br>
<?php echo __('Valid OAuth redirect URIs'); ?>: <strong><?php echo $global['webSiteRootURL']; ?>objects/login.json.php?type=Linkedin</strong><br>
<?php echo __('For mobile a Valid OAuth redirect URIs'); ?>: <strong><?php echo $global['webSiteRootURL']; ?>plugin/MobileManager/oauth2.php?type=Linkedin</strong>
</small>
</div>
</div>
</div>
<div class="col-md-6">
<div class="panel panel-default">
<div class="panel-heading"><i class="fab fa-twitter-square"></i> Twitter <div class="pull-right"><?php echo getPluginSwitch('LoginTwitter'); ?></div></div>
<div class="panel-body" style="overflow: hidden;">
<?php
createTable("LoginTwitter");
?>
<small class="form-text text-muted">
<a href="https://apps.twitter.com/"><?php echo __('Get Twitter ID and Key'); ?></a><br>
<?php echo __('Valid OAuth redirect URIs'); ?>: <strong><?php echo $global['webSiteRootURL']; ?>objects/login.json.php?type=Twitter</strong><br>
<?php echo __('For mobile a Valid OAuth redirect URIs'); ?>: <strong><?php echo $global['webSiteRootURL']; ?>plugin/MobileManager/oauth2.php?type=Twitter</strong>
</small>
</div>
</div>
</div>
<div class="col-md-6">
<div class="panel panel-default">
<div class="panel-heading"><i class="fab fa-yahoo"></i> Yahoo <div class="pull-right"><?php echo getPluginSwitch('LoginYahoo'); ?></div></div>
<div class="panel-body" style="overflow: hidden;">
<?php
createTable("LoginYahoo");
?>
<small class="form-text text-muted">
<a href="https://developer.yahoo.com/oauth2/guide/flows_authcode/"><?php echo __('Get Yahoo ID and Key'); ?></a><br>
<?php echo __('Valid OAuth redirect URIs'); ?>: <strong><?php echo $global['webSiteRootURL']; ?>objects/login.json.php?type=Yahoo</strong><br>
<?php echo __('For mobile a Valid OAuth redirect URIs'); ?>: <strong><?php echo $global['webSiteRootURL']; ?>plugin/MobileManager/oauth2.php?type=Yahoo</strong>
</small>
</div>
</div>
</div>
<div class="col-md-6">
<div class="panel panel-default">
<div class="panel-heading"><i class="fas fa-sign-in-alt"></i> LDAP <div class="pull-right"><?php echo getPluginSwitch('LoginLDAP'); ?></div></div>
<div class="panel-body" style="overflow: hidden;">
<?php
createTable("LoginLDAP");
?>
<small class="form-text text-muted">
<a href="https://github.com/WWBN/AVideo/wiki/Configure-LDAP-Plugin"><?php echo __('Help Page'); ?></a>
</small>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-md-6">
<div class="panel panel-default">
<div class="panel-heading"><i class="fa fa-cog"></i> <?php echo __('Customize options'); ?> <div class="pull-right"><?php echo getPluginSwitch('CustomizeAdvanced'); ?></div></div>
<div class="panel-body" style="overflow: hidden;">
<?php
$filter = [
'disableNativeSignUp' => __('The form to signup will not exists'),
'disableNativeSignIn' => __('The regular form to signin will not exist, if you check this will only have social login or LDAP option'),
'userMustBeLoggedIn' => __('The site will display only a login form to un authenticated users'), ];
createTable("CustomizeUser", $filter);
?>
</div>
</div>
</div>
<div class="col-md-6">
<div class="panel panel-default">
<div class="panel-heading"><i class="fab fa-facebook-square"></i> Facebook <div class="pull-right"><?php echo getPluginSwitch('LoginFacebook'); ?></div></div>
<div class="panel-body" style="overflow: hidden;">
<?php
createTable("LoginFacebook");
?>
<small class="form-text text-muted">
<a href="https://developers.facebook.com/apps"><?php echo __('Get Facebook ID and Key'); ?></a><br>
<?php echo __('Valid OAuth redirect URIs'); ?>: <strong><?php echo $global['webSiteRootURL']; ?>objects/login.json.php?type=Facebook</strong><br>
<?php echo __('For mobile a Valid OAuth redirect URIs'); ?>: <strong><?php echo $global['webSiteRootURL']; ?>plugin/MobileManager/oauth2.php?type=Facebook</strong>
</small>
</div>
</div>
</div>
<div class="col-md-6">
<div class="panel panel-default">
<div class="panel-heading"><i class="fab fa-google-plus-g"></i> Google <div class="pull-right"><?php echo getPluginSwitch('LoginGoogle'); ?></div></div>
<div class="panel-body" style="overflow: hidden;">
<?php
createTable("LoginGoogle");
?>
<small class="form-text text-muted">
<a href="https://console.developers.google.com/apis/credentials"><?php echo __('Get Google ID and Key'); ?></a><br>
<?php echo __('Valid OAuth redirect URIs'); ?>: <strong><?php echo $global['webSiteRootURL']; ?>objects/login.json.php?type=Google</strong><br>
<?php echo __('For mobile a Valid OAuth redirect URIs'); ?>: <strong><?php echo $global['webSiteRootURL']; ?>plugin/MobileManager/oauth2.php?type=Google</strong>
</small>
</div>
</div>
</div>
<div class="col-md-6">
<div class="panel panel-default">
<div class="panel-heading"><i class="fab fa-linkedin"></i> Linkedin <div class="pull-right"><?php echo getPluginSwitch('LoginLinkedin'); ?></div></div>
<div class="panel-body" style="overflow: hidden;">
<?php
createTable("LoginLinkedin");
?>
<small class="form-text text-muted">
<a href="https://www.linkedin.com/secure/developer"><?php echo __('Get Linkedin ID and Key'); ?></a><br>
<?php echo __('Valid OAuth redirect URIs'); ?>: <strong><?php echo $global['webSiteRootURL']; ?>objects/login.json.php?type=Linkedin</strong><br>
<?php echo __('For mobile a Valid OAuth redirect URIs'); ?>: <strong><?php echo $global['webSiteRootURL']; ?>plugin/MobileManager/oauth2.php?type=Linkedin</strong>
</small>
</div>
</div>
</div>
<div class="col-md-6">
<div class="panel panel-default">
<div class="panel-heading"><i class="fab fa-twitter-square"></i> Twitter <div class="pull-right"><?php echo getPluginSwitch('LoginTwitter'); ?></div></div>
<div class="panel-body" style="overflow: hidden;">
<?php
createTable("LoginTwitter");
?>
<small class="form-text text-muted">
<a href="https://apps.twitter.com/"><?php echo __('Get Twitter ID and Key'); ?></a><br>
<?php echo __('Valid OAuth redirect URIs'); ?>: <strong><?php echo $global['webSiteRootURL']; ?>objects/login.json.php?type=Twitter</strong><br>
<?php echo __('For mobile a Valid OAuth redirect URIs'); ?>: <strong><?php echo $global['webSiteRootURL']; ?>plugin/MobileManager/oauth2.php?type=Twitter</strong>
</small>
</div>
</div>
</div>
<div class="col-md-6">
<div class="panel panel-default">
<div class="panel-heading"><i class="fab fa-yahoo"></i> Yahoo <div class="pull-right"><?php echo getPluginSwitch('LoginYahoo'); ?></div></div>
<div class="panel-body" style="overflow: hidden;">
<?php
createTable("LoginYahoo");
?>
<small class="form-text text-muted">
<a href="https://developer.yahoo.com/oauth2/guide/flows_authcode/"><?php echo __('Get Yahoo ID and Key'); ?></a><br>
<?php echo __('Valid OAuth redirect URIs'); ?>: <strong><?php echo $global['webSiteRootURL']; ?>objects/login.json.php?type=Yahoo</strong><br>
<?php echo __('For mobile a Valid OAuth redirect URIs'); ?>: <strong><?php echo $global['webSiteRootURL']; ?>plugin/MobileManager/oauth2.php?type=Yahoo</strong>
</small>
</div>
</div>
</div>
<div class="col-md-6">
<div class="panel panel-default">
<div class="panel-heading"><i class="fas fa-sign-in-alt"></i> LDAP <div class="pull-right"><?php echo getPluginSwitch('LoginLDAP'); ?></div></div>
<div class="panel-body" style="overflow: hidden;">
<?php
createTable("LoginLDAP");
?>
<small class="form-text text-muted">
<a href="https://github.com/WWBN/AVideo/wiki/Configure-LDAP-Plugin"><?php echo __('Help Page'); ?></a>
</small>
</div>
</div>
</div>
</div>

View file

@ -1,32 +1,32 @@
<div class="row">
<div class="col-md-6">
<div class="panel panel-default">
<div class="panel-heading"><i class="fab fa-aws"></i> S3 Storage <div class="pull-right"><?php echo getPluginSwitch('AWS_S3'); ?></div></div>
<div class="panel-body" style="overflow: hidden;">
<?php
createTable("AWS_S3");
?>
</div>
</div>
</div>
<div class="col-md-6">
<div class="panel panel-default">
<div class="panel-heading"><i class="fas fa-hdd"></i> B2 Storage <div class="pull-right"><?php echo getPluginSwitch('Blackblaze_B2'); ?></div></div>
<div class="panel-body" style="overflow: hidden;">
<?php
createTable("Blackblaze_B2");
?>
</div>
</div>
</div>
<div class="col-md-12">
<div class="panel panel-default">
<div class="panel-heading"><i class="fas fa-hdd"></i> FTP <div class="pull-right"><?php echo getPluginSwitch('FTP_Storage'); ?></div></div>
<div class="panel-body" style="overflow: hidden;">
<?php
createTable("FTP_Storage");
?>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-md-6">
<div class="panel panel-default">
<div class="panel-heading"><i class="fab fa-aws"></i> S3 Storage <div class="pull-right"><?php echo getPluginSwitch('AWS_S3'); ?></div></div>
<div class="panel-body" style="overflow: hidden;">
<?php
createTable("AWS_S3");
?>
</div>
</div>
</div>
<div class="col-md-6">
<div class="panel panel-default">
<div class="panel-heading"><i class="fas fa-hdd"></i> B2 Storage <div class="pull-right"><?php echo getPluginSwitch('Blackblaze_B2'); ?></div></div>
<div class="panel-body" style="overflow: hidden;">
<?php
createTable("Blackblaze_B2");
?>
</div>
</div>
</div>
<div class="col-md-12">
<div class="panel panel-default">
<div class="panel-heading"><i class="fas fa-hdd"></i> FTP <div class="pull-right"><?php echo getPluginSwitch('FTP_Storage'); ?></div></div>
<div class="panel-body" style="overflow: hidden;">
<?php
createTable("FTP_Storage");
?>
</div>
</div>
</div>
</div>

View file

@ -1,15 +1,15 @@
<?php
header('Content-Type: application/json');
global $global, $config;
if (!isset($global['systemRootPath'])) {
require_once '../videos/configuration.php';
}
require_once $global['systemRootPath'] . 'objects/user.php';
if (!User::isAdmin()) {
die('{"error":"' . __("Permission denied") . '"}');
}
$config = new Configuration();
$config->setTheme($_POST['theme']);
echo '{"status":"' . $config->save() . '"}';
<?php
header('Content-Type: application/json');
global $global, $config;
if (!isset($global['systemRootPath'])) {
require_once '../videos/configuration.php';
}
require_once $global['systemRootPath'] . 'objects/user.php';
if (!User::isAdmin()) {
die('{"error":"' . __("Permission denied") . '"}');
}
$config = new Configuration();
$config->setTheme($_POST['theme']);
echo '{"status":"' . $config->save() . '"}';

View file

@ -1,47 +1,47 @@
{
"name": "wwbn/avideo",
"description": "Audio Video Platform",
"type": "project",
"config": {
"platform-check": false,
"vendor-dir": "vendor",
"platform": {
"php": "7.3"
}
},
"require": {
"php": "^7.3|^8",
"ext-curl": "*",
"ext-json": "*",
"chrisjean/php-ico": "^1.0",
"ezyang/htmlpurifier": "^4.13",
"google/apiclient": "^2.11",
"google/apiclient-services": "*",
"google/auth": "^1.14.3",
"guzzlehttp/guzzle": "^6.5",
"guzzlehttp/psr7": "^1.7",
"hybridauth/hybridauth": "^3.3",
"james-heinrich/getid3": "^1.9",
"monolog/monolog": "^1.17",
"phpmailer/phpmailer": "^6.2",
"psr/cache": "^1.0",
"psr/http-message": "^1.0",
"cboden/ratchet": "^0.4.3",
"ratchet/pawl": "^0.3.5",
"singpolyma/openpgp-php": "^0.5.0",
"aws/aws-sdk-php": "^3.180",
"gliterd/backblaze-b2": "^1.1",
"paypal/rest-api-sdk-php": "*",
"paypal/paypal-payouts-sdk": "^1.0",
"paypal/paypal-checkout-sdk": "^1.0",
"emojione/assets": "^4.5",
"mervick/emojionearea": "^3.4",
"emojione/emojione": "^4.5",
"abraham/twitteroauth": "^1.0",
"symfony/http-client": "^5.3",
"nyholm/psr7": "^1.4",
"norkunas/onesignal-php-api": "^2.7",
"stripe/stripe-php": "^7.97",
"symfony/translation": "^5.3"
}
}
{
"name": "wwbn/avideo",
"description": "Audio Video Platform",
"type": "project",
"config": {
"platform-check": false,
"vendor-dir": "vendor",
"platform": {
"php": "7.3"
}
},
"require": {
"php": "^7.3|^8",
"ext-curl": "*",
"ext-json": "*",
"chrisjean/php-ico": "^1.0",
"ezyang/htmlpurifier": "^4.13",
"google/apiclient": "^2.11",
"google/apiclient-services": "*",
"google/auth": "^1.14.3",
"guzzlehttp/guzzle": "^6.5",
"guzzlehttp/psr7": "^1.7",
"hybridauth/hybridauth": "^3.3",
"james-heinrich/getid3": "^1.9",
"monolog/monolog": "^1.17",
"phpmailer/phpmailer": "^6.2",
"psr/cache": "^1.0",
"psr/http-message": "^1.0",
"cboden/ratchet": "^0.4.3",
"ratchet/pawl": "^0.3.5",
"singpolyma/openpgp-php": "^0.5.0",
"aws/aws-sdk-php": "^3.180",
"gliterd/backblaze-b2": "^1.1",
"paypal/rest-api-sdk-php": "*",
"paypal/paypal-payouts-sdk": "^1.0",
"paypal/paypal-checkout-sdk": "^1.0",
"emojione/assets": "^4.5",
"mervick/emojionearea": "^3.4",
"emojione/emojione": "^4.5",
"abraham/twitteroauth": "^1.0",
"symfony/http-client": "^5.3",
"nyholm/psr7": "^1.4",
"norkunas/onesignal-php-api": "^2.7",
"stripe/stripe-php": "^7.97",
"symfony/translation": "^5.3"
}
}

View file

@ -1,54 +1,53 @@
<?php
//header("Content-Type: application/rss+xml; charset=UTF8");
require_once '../videos/configuration.php';
require_once '../objects/video.php';
$_POST['sort']["created"] = "DESC";
$_POST['current'] = 1;
$_REQUEST['rowCount'] = getRowCount();
$showOnlyLoggedUserVideos = false;
$title = $config->getWebSiteTitle();
$link = $global['webSiteRootURL'];
$logo = getCDN()."videos/userPhoto/logo.png";
$description = "";
$extraPluginFile = $global['systemRootPath'] . 'plugin/Customize/Objects/ExtraConfig.php';
if (file_exists($extraPluginFile) && AVideoPlugin::isEnabledByName("Customize")) {
require_once $extraPluginFile;
$ec = new ExtraConfig();
$description = $ec->getDescription();
}
if(!empty($_GET['channelName'])){
$user = User::getChannelOwner($_GET['channelName']);
$showOnlyLoggedUserVideos = $user['id'];
$title = User::getNameIdentificationById($user['id']);
$link = User::getChannelLink($user['id']);
$logo = User::getPhoto($user['id']);
}
$cacheName = "feedCache".json_encode($_GET);
$rows = ObjectYPT::getCache($cacheName, 0);
if(empty($rows)){
// send $_GET['catName'] to be able to filter by category
$rows = Video::getAllVideos("viewable", $showOnlyLoggedUserVideos);
ObjectYPT::setCache($cacheName, $rows);
}else{
$rows = object_to_array($rows);
}
if(!empty($_REQUEST['roku'])){
include $global['systemRootPath'] . 'feed/roku.json.php';
}else if(empty($_REQUEST['mrss'])){
include $global['systemRootPath'] . 'feed/rss.php';
}else{
include $global['systemRootPath'] . 'feed/mrss.php';
}
function feedText($text){
return str_replace(array('&&'), array('&'), str_replace(array('&','<','>'), array('&amp;','&lt;','&gt;'), (strip_tags(br2nl($text)))));
}
?>
<?php
//header("Content-Type: application/rss+xml; charset=UTF8");
require_once '../videos/configuration.php';
require_once '../objects/video.php';
$_POST['sort']["created"] = "DESC";
$_POST['current'] = 1;
$_REQUEST['rowCount'] = getRowCount();
$showOnlyLoggedUserVideos = false;
$title = $config->getWebSiteTitle();
$link = $global['webSiteRootURL'];
$logo = getCDN()."videos/userPhoto/logo.png";
$description = '';
$extraPluginFile = $global['systemRootPath'] . 'plugin/Customize/Objects/ExtraConfig.php';
if (file_exists($extraPluginFile) && AVideoPlugin::isEnabledByName("Customize")) {
require_once $extraPluginFile;
$ec = new ExtraConfig();
$description = $ec->getDescription();
}
if (!empty($_GET['channelName'])) {
$user = User::getChannelOwner($_GET['channelName']);
$showOnlyLoggedUserVideos = $user['id'];
$title = User::getNameIdentificationById($user['id']);
$link = User::getChannelLink($user['id']);
$logo = User::getPhoto($user['id']);
}
$cacheName = "feedCache".json_encode($_GET);
$rows = ObjectYPT::getCache($cacheName, 0);
if (empty($rows)) {
// send $_GET['catName'] to be able to filter by category
$rows = Video::getAllVideos("viewable", $showOnlyLoggedUserVideos);
ObjectYPT::setCache($cacheName, $rows);
} else {
$rows = object_to_array($rows);
}
if (!empty($_REQUEST['roku'])) {
include $global['systemRootPath'] . 'feed/roku.json.php';
} elseif (empty($_REQUEST['mrss'])) {
include $global['systemRootPath'] . 'feed/rss.php';
} else {
include $global['systemRootPath'] . 'feed/mrss.php';
}
function feedText($text)
{
return str_replace(['&&'], ['&'], str_replace(['&','<','>'], ['&amp;','&lt;','&gt;'], (strip_tags(br2nl($text)))));
}

View file

@ -1,85 +1,81 @@
<?php
//header('Content-Type: text/xml; charset=UTF8');
//header("Content-Type: application/rss+xml; charset=UTF8");
header("Content-Type: application/rss+xml;");
$cacheFeedName = "feedCacheMRSS" . json_encode($_REQUEST);
$lifetime = 43200;
$feed = ObjectYPT::getCache($cacheFeedName, $lifetime);
if (empty($feed)) {
ob_start();
echo'<?xml version="1.0" encoding="UTF-8"?>';
?>
<rss version="2.0" xmlns:media="http://search.yahoo.com/mrss/"
xmlns:georss="http://www.georss.org/georss"
xmlns:gml="http://www.opengis.net/gml">
<channel>
<title><?php echo feedText($title); ?></title>
<description><?php echo feedText($description); ?></description>
<link><?php echo $link; ?></link>
<image>
<title><?php echo feedText($title); ?></title>
<url><?php echo $logo; ?></url>
<link><?php echo $link; ?></link>
<width>144</width>
<height>40</height>
<description>AVideo version rss</description>
</image>
<?php
foreach ($rows as $row) {
$video = Video::getVideoFromFileName($row['filename']);
$files = getVideosURL($row['filename']);
$enclosure = "";
$videoSource = Video::getSourceFileURL($row['filename']);
if (empty($videoSource)) {
continue;
}
foreach ($files as $value) {
if ($value["type"] === "video" && file_exists($value['path'])) {
$path_parts = pathinfo($value['path']);
$value['mime'] = "video/{$path_parts['extension']}";
$value['size'] = filesize($value['path']);
// replace to validate
$value['url'] = str_replace("http://", "https://", $value['url']);
$enclosure = '<enclosure url="' . $value['url'] . '" length="' . $value['size'] . '" type="' . $value['mime'] . '" />';
break;
}
}
?>
<item>
<title><?php echo feedText($row['title']); ?></title>
<description><?php echo feedText($row['title']); ?></description>
<link> <?php echo Video::getLink($row['id'], $row['clean_title']); ?></link>
<?php echo $enclosure; ?>
<pubDate><?php echo date('r', strtotime($row['created'])); ?></pubDate>
<guid isPermaLink="true"><?php echo Video::getLinkToVideo($row['id'], $row['clean_title'], false, "permalink"); ?></guid>
<media:category><?php echo $row["category"]; ?></media:category>
<media:content url="<?php echo $videoSource; ?>" fileSize="<?php echo $video["filesize"]; ?>" bitrate="128"
type="<?php echo mime_content_type_per_filename($videoSource); ?>" expression="full"
duration="<?php echo durationToSeconds($row['duration']); ?>">
<media:title type="plain"><?php echo htmlspecialchars($row['title']); ?></media:title>
<media:description type="html"><![CDATA[<?php echo Video::htmlDescription($row['title']); ?>]]></media:description>
<media:thumbnail url="<?php echo Video::getPoster($row['id']); ?>" />
</media:content>
<media:embed url="<?php echo str_replace('&', '&amp;', Video::getLinkToVideo($row['id'], $row['clean_title'], true)); ?>"/>
<media:status state="active" />
</item>
<?php
}
?>
</channel>
</rss>
<?php
$feed = ob_get_contents();
ob_end_clean();
//var_dump($cacheFeedName, $feed);exit;
ObjectYPT::setCache($cacheFeedName, $feed);
//echo '<!-- NO cache -->';
}else{
//echo '<!-- cache -->';
}
if(!is_string($feed)){
$feed = json_encode($feed);
}
echo $feed;
?>
<?php
//header('Content-Type: text/xml; charset=UTF8');
//header("Content-Type: application/rss+xml; charset=UTF8");
header("Content-Type: application/rss+xml;");
$cacheFeedName = "feedCacheMRSS" . json_encode($_REQUEST);
$lifetime = 43200;
$feed = ObjectYPT::getCache($cacheFeedName, $lifetime);
if (empty($feed)) {
ob_start();
echo'<?xml version="1.0" encoding="UTF-8"?>'; ?>
<rss version="2.0" xmlns:media="http://search.yahoo.com/mrss/"
xmlns:georss="http://www.georss.org/georss"
xmlns:gml="http://www.opengis.net/gml">
<channel>
<title><?php echo feedText($title); ?></title>
<description><?php echo feedText($description); ?></description>
<link><?php echo $link; ?></link>
<image>
<title><?php echo feedText($title); ?></title>
<url><?php echo $logo; ?></url>
<link><?php echo $link; ?></link>
<width>144</width>
<height>40</height>
<description>AVideo version rss</description>
</image>
<?php
foreach ($rows as $row) {
$video = Video::getVideoFromFileName($row['filename']);
$files = getVideosURL($row['filename']);
$enclosure = '';
$videoSource = Video::getSourceFileURL($row['filename']);
if (empty($videoSource)) {
continue;
}
foreach ($files as $value) {
if ($value["type"] === "video" && file_exists($value['path'])) {
$path_parts = pathinfo($value['path']);
$value['mime'] = "video/{$path_parts['extension']}";
$value['size'] = filesize($value['path']);
// replace to validate
$value['url'] = str_replace("http://", "https://", $value['url']);
$enclosure = '<enclosure url="' . $value['url'] . '" length="' . $value['size'] . '" type="' . $value['mime'] . '" />';
break;
}
} ?>
<item>
<title><?php echo feedText($row['title']); ?></title>
<description><?php echo feedText($row['title']); ?></description>
<link> <?php echo Video::getLink($row['id'], $row['clean_title']); ?></link>
<?php echo $enclosure; ?>
<pubDate><?php echo date('r', strtotime($row['created'])); ?></pubDate>
<guid isPermaLink="true"><?php echo Video::getLinkToVideo($row['id'], $row['clean_title'], false, "permalink"); ?></guid>
<media:category><?php echo $row["category"]; ?></media:category>
<media:content url="<?php echo $videoSource; ?>" fileSize="<?php echo $video["filesize"]; ?>" bitrate="128"
type="<?php echo mime_content_type_per_filename($videoSource); ?>" expression="full"
duration="<?php echo durationToSeconds($row['duration']); ?>">
<media:title type="plain"><?php echo htmlspecialchars($row['title']); ?></media:title>
<media:description type="html"><![CDATA[<?php echo Video::htmlDescription($row['title']); ?>]]></media:description>
<media:thumbnail url="<?php echo Video::getPoster($row['id']); ?>" />
</media:content>
<media:embed url="<?php echo str_replace('&', '&amp;', Video::getLinkToVideo($row['id'], $row['clean_title'], true)); ?>"/>
<media:status state="active" />
</item>
<?php
} ?>
</channel>
</rss>
<?php
$feed = ob_get_contents();
ob_end_clean();
//var_dump($cacheFeedName, $feed);exit;
ObjectYPT::setCache($cacheFeedName, $feed);
//echo '<!-- NO cache -->';
} else {
//echo '<!-- cache -->';
}
if (!is_string($feed)) {
$feed = json_encode($feed);
}
echo $feed;

View file

@ -1,119 +1,117 @@
<?php
function rokuRating($avideoRating){
//('', 'g', 'pg', 'pg-13', 'r', 'nc-17', 'ma');
switch (strtolower($avideoRating)) {
case 'g':
return 'G';
break;
case 'pg':
return 'PG';
break;
case 'pg-13':
return 'PG13';
break;
case 'r':
return 'R';
break;
case 'nc-17':
return 'NC17';
break;
case 'ma':
return '18+';
break;
default:
return 'G';
break;
}
}
header('Content-Type: application/json');
$cacheFeedName = "feedCache_ROKU" . json_encode($_REQUEST);
$lifetime = 43200;
$output = ObjectYPT::getCache($cacheFeedName, $lifetime);
if (empty($output)) {
$obj = new stdClass();
$obj->providerName = $title;
$obj->language = "en";
$obj->lastUpdated = date('c');
$obj->movies = array();
$cacheName = "feedCache_ROKU_movies".json_encode($_REQUEST);
$movies = ObjectYPT::getCache($cacheName, 0);
if (empty($movies)) {
foreach ($rows as $row) {
$videoSource = Video::getSourceFileURL($row['filename']);
$videoResolution = Video::getResolutionFromFilename($videoSource);
//var_dump($videoSource);
if (empty($videoSource)) {
_error_log("Roku Empty video source {$row['id']}, {$row['clean_title']}, {$row['filename']}");
continue;
}
$movie = new stdClass();
$movie->id = 'video_'.$row['id'];
$movie->title = UTF8encode($row['title']);
$movie->longDescription = "=> " . _substr(strip_tags(br2nl(UTF8encode($row['description']))), 0, 490);
$movie->shortDescription = _substr($movie->longDescription, 0, 200);
$movie->thumbnail = Video::getRokuImage($row['id']);
$movie->tags = array(_substr(UTF8encode($row['category']), 0, 20));
$movie->genres = array("special");
$movie->releaseDate = date('c', strtotime($row['created']));
$movie->categories_id = $row['categories_id'];
$rrating = $row['rrating'];
if(!empty($rrating)){
$movie->rating = new stdClass();
$movie->rating->rating = rokuRating($rrating);
$movie->rating->ratingSource = 'MPAA';
}
$content = new stdClass();
$content->dateAdded = date('c', strtotime($row['created']));
$content->captions = array();
$content->duration = durationToSeconds($row['duration']);
$content->language = "en";
$content->adBreaks = array("00:00:00");
$video = new stdClass();
$video->url = $videoSource;
$video->quality = getResolutionTextRoku($videoResolution);
$video->videoType = Video::getVideoTypeText($row['filename']);
$content->videos = array($video);
$movie->content = $content;
$obj->movies[] = $movie;
}
ObjectYPT::setCache($cacheName, $obj->movies);
} else {
$obj->movies = $movies;
}
$itemIds = array();
foreach ($obj->movies as $value) {
$itemIds[] = $value->id;
}
$obj->playlists = array(array('name'=>'all', 'itemIds'=>$itemIds));
$obj->categories = array(array('name'=>'All', 'playlistName'=>'all', 'order'=>'most_recent'));
$output = _json_encode($obj, JSON_UNESCAPED_UNICODE);
if (empty($output) && json_last_error()) {
$output = json_encode(json_last_error_msg());
var_dump($obj);
}else{
ObjectYPT::setCache($cacheFeedName, $output);
}
}else{
//echo '<!-- cache -->';
}
if(!is_string($output)){
$output = json_encode($output);
}
die($output);
?>
<?php
function rokuRating($avideoRating)
{
//('', 'g', 'pg', 'pg-13', 'r', 'nc-17', 'ma');
switch (strtolower($avideoRating)) {
case 'g':
return 'G';
break;
case 'pg':
return 'PG';
break;
case 'pg-13':
return 'PG13';
break;
case 'r':
return 'R';
break;
case 'nc-17':
return 'NC17';
break;
case 'ma':
return '18+';
break;
default:
return 'G';
break;
}
}
header('Content-Type: application/json');
$cacheFeedName = "feedCache_ROKU" . json_encode($_REQUEST);
$lifetime = 43200;
$output = ObjectYPT::getCache($cacheFeedName, $lifetime);
if (empty($output)) {
$obj = new stdClass();
$obj->providerName = $title;
$obj->language = "en";
$obj->lastUpdated = date('c');
$obj->movies = [];
$cacheName = "feedCache_ROKU_movies".json_encode($_REQUEST);
$movies = ObjectYPT::getCache($cacheName, 0);
if (empty($movies)) {
foreach ($rows as $row) {
$videoSource = Video::getSourceFileURL($row['filename']);
$videoResolution = Video::getResolutionFromFilename($videoSource);
//var_dump($videoSource);
if (empty($videoSource)) {
_error_log("Roku Empty video source {$row['id']}, {$row['clean_title']}, {$row['filename']}");
continue;
}
$movie = new stdClass();
$movie->id = 'video_'.$row['id'];
$movie->title = UTF8encode($row['title']);
$movie->longDescription = "=> " . _substr(strip_tags(br2nl(UTF8encode($row['description']))), 0, 490);
$movie->shortDescription = _substr($movie->longDescription, 0, 200);
$movie->thumbnail = Video::getRokuImage($row['id']);
$movie->tags = [_substr(UTF8encode($row['category']), 0, 20)];
$movie->genres = ["special"];
$movie->releaseDate = date('c', strtotime($row['created']));
$movie->categories_id = $row['categories_id'];
$rrating = $row['rrating'];
if (!empty($rrating)) {
$movie->rating = new stdClass();
$movie->rating->rating = rokuRating($rrating);
$movie->rating->ratingSource = 'MPAA';
}
$content = new stdClass();
$content->dateAdded = date('c', strtotime($row['created']));
$content->captions = [];
$content->duration = durationToSeconds($row['duration']);
$content->language = "en";
$content->adBreaks = ["00:00:00"];
$video = new stdClass();
$video->url = $videoSource;
$video->quality = getResolutionTextRoku($videoResolution);
$video->videoType = Video::getVideoTypeText($row['filename']);
$content->videos = [$video];
$movie->content = $content;
$obj->movies[] = $movie;
}
ObjectYPT::setCache($cacheName, $obj->movies);
} else {
$obj->movies = $movies;
}
$itemIds = [];
foreach ($obj->movies as $value) {
$itemIds[] = $value->id;
}
$obj->playlists = [['name' => 'all', 'itemIds'=>$itemIds]];
$obj->categories = [['name' => 'All', 'playlistName' => 'all', 'order' => 'most_recent']];
$output = _json_encode($obj, JSON_UNESCAPED_UNICODE);
if (empty($output) && json_last_error()) {
$output = json_encode(json_last_error_msg());
var_dump($obj);
} else {
ObjectYPT::setCache($cacheFeedName, $output);
}
} else {
//echo '<!-- cache -->';
}
if (!is_string($output)) {
$output = json_encode($output);
}
die($output);

View file

@ -1,73 +1,70 @@
<?php
header('Content-Type: text/xml; charset=UTF8');
$cacheFeedName = "feedCacheRSS" . json_encode($_REQUEST);
$lifetime = 43200;
$feed = ObjectYPT::getCache($cacheFeedName, $lifetime);
if (empty($feed)) {
ob_start();
echo'<?xml version="1.0" encoding="UTF-8"?>'
?>
<rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/"
xmlns:wfw="http://wellformedweb.org/CommentAPI/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:atom="http://www.w3.org/2005/Atom"
xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
xmlns:slash="http://purl.org/rss/1.0/modules/slash/">
<channel>
<atom:link href="<?php echo $global['webSiteRootURL'] . ltrim($_SERVER["REQUEST_URI"], "/"); ?>" rel="self" type="application/rss+xml" />
<title><?php echo feedText($title); ?></title>
<description><?php echo feedText($description); ?></description>
<link><?php echo $link; ?></link>
<sy:updatePeriod>hourly</sy:updatePeriod>
<sy:updateFrequency>1</sy:updateFrequency>
<image>
<title><?php echo feedText($title); ?></title>
<url><?php echo $logo; ?></url>
<link><?php echo $link; ?></link>
<width>144</width>
<height>40</height>
<description>AVideo version rss</description>
</image>
<?php
foreach ($rows as $row) {
$files = getVideosURL($row['filename']);
$enclosure = "";
foreach ($files as $value) {
if ($value["type"] === "video" && file_exists($value['path'])) {
$path_parts = pathinfo($value['path']);
$value['mime'] = "video/{$path_parts['extension']}";
$value['size'] = filesize($value['path']);
// replace to validate
$value['url'] = str_replace("http://", "https://", $value['url']);
$enclosure = '<enclosure url="' . $value['url'] . '" length="' . $value['size'] . '" type="' . $value['mime'] . '" />';
break;
}
}
?>
<item>
<title><?php echo feedText($row['title']); ?></title>
<description><?php echo feedText($row['description']); ?></description>
<link> <?php echo Video::getLink($row['id'], $row['clean_title']); ?></link>
<?php echo $enclosure; ?>
<pubDate><?php echo date('r', strtotime($row['created'])); ?></pubDate>
<guid><?php echo Video::getLinkToVideo($row['id'], $row['clean_title'], false, "permalink"); ?></guid>
</item>
<?php
}
?>
</channel>
</rss>
<?php
$feed = ob_get_contents();
ob_end_clean();
ObjectYPT::setCache($cacheFeedName, $feed);
}else{
//echo '<!-- cache -->';
}
if(!is_string($feed)){
$feed = json_encode($feed);
}
echo $feed;
?>
<?php
header('Content-Type: text/xml; charset=UTF8');
$cacheFeedName = "feedCacheRSS" . json_encode($_REQUEST);
$lifetime = 43200;
$feed = ObjectYPT::getCache($cacheFeedName, $lifetime);
if (empty($feed)) {
ob_start();
echo'<?xml version="1.0" encoding="UTF-8"?>'
?>
<rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/"
xmlns:wfw="http://wellformedweb.org/CommentAPI/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:atom="http://www.w3.org/2005/Atom"
xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
xmlns:slash="http://purl.org/rss/1.0/modules/slash/">
<channel>
<atom:link href="<?php echo $global['webSiteRootURL'] . ltrim($_SERVER["REQUEST_URI"], "/"); ?>" rel="self" type="application/rss+xml" />
<title><?php echo feedText($title); ?></title>
<description><?php echo feedText($description); ?></description>
<link><?php echo $link; ?></link>
<sy:updatePeriod>hourly</sy:updatePeriod>
<sy:updateFrequency>1</sy:updateFrequency>
<image>
<title><?php echo feedText($title); ?></title>
<url><?php echo $logo; ?></url>
<link><?php echo $link; ?></link>
<width>144</width>
<height>40</height>
<description>AVideo version rss</description>
</image>
<?php
foreach ($rows as $row) {
$files = getVideosURL($row['filename']);
$enclosure = '';
foreach ($files as $value) {
if ($value["type"] === "video" && file_exists($value['path'])) {
$path_parts = pathinfo($value['path']);
$value['mime'] = "video/{$path_parts['extension']}";
$value['size'] = filesize($value['path']);
// replace to validate
$value['url'] = str_replace("http://", "https://", $value['url']);
$enclosure = '<enclosure url="' . $value['url'] . '" length="' . $value['size'] . '" type="' . $value['mime'] . '" />';
break;
}
} ?>
<item>
<title><?php echo feedText($row['title']); ?></title>
<description><?php echo feedText($row['description']); ?></description>
<link> <?php echo Video::getLink($row['id'], $row['clean_title']); ?></link>
<?php echo $enclosure; ?>
<pubDate><?php echo date('r', strtotime($row['created'])); ?></pubDate>
<guid><?php echo Video::getLinkToVideo($row['id'], $row['clean_title'], false, "permalink"); ?></guid>
</item>
<?php
} ?>
</channel>
</rss>
<?php
$feed = ob_get_contents();
ob_end_clean();
ObjectYPT::setCache($cacheFeedName, $feed);
} else {
//echo '<!-- cache -->';
}
if (!is_string($feed)) {
$feed = json_encode($feed);
}
echo $feed;

View file

@ -1,20 +1,19 @@
<?php
header('Content-Type: application/json');
$cmd = "git log -1";
exec($cmd . " 2>&1", $output, $return_val);
$obj = new stdClass();
$obj->output = $output;
foreach ($output as $value){
preg_match("/Date:(.*)/i", $value, $match);
if(!empty($match[1])){
$obj->date = strtotime($match[1]);
$obj->dateString = trim($match[1]);
$obj->dateMySQL = date("Y-m-d H:i:s", $obj->date);
}
}
echo json_encode($obj);
<?php
header('Content-Type: application/json');
$cmd = "git log -1";
exec($cmd . " 2>&1", $output, $return_val);
$obj = new stdClass();
$obj->output = $output;
foreach ($output as $value) {
preg_match("/Date:(.*)/i", $value, $match);
if (!empty($match[1])) {
$obj->date = strtotime($match[1]);
$obj->dateString = trim($match[1]);
$obj->dateMySQL = date("Y-m-d H:i:s", $obj->date);
}
}
echo json_encode($obj);

232
index.php
View file

@ -1,116 +1,116 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title><?php echo __("Error Page"); ?></title>
<link href="view/bootstrap/css/bootstrap.css" rel="stylesheet" type="text/css" />
<style>
body {
margin: 0;
padding: 0;
background: #e7ecf0;
font-family: Arial, Helvetica, sans-serif;
}
* {
margin: 0;
padding: 0;
}
p {
font-size: 12px;
color: #373737;
font-family: Arial, Helvetica, sans-serif;
line-height: 18px;
}
p a {
color: #218bdc;
font-size: 12px;
text-decoration: none;
}
a {
outline: none;
}
.f-left {
float: left;
}
.f-right {
float: right;
}
.clear {
clear: both;
overflow: hidden;
}
#block_error {
width: 1000px;
height: 700px;
border: 1px solid #cccccc;
margin: 72px auto 0;
-moz-border-radius: 4px;
-webkit-border-radius: 4px;
border-radius: 4px;
background: #fff url(https://tutorials.avideo.com/view/img/transparent1px.png) no-repeat 0 51px;
}
#block_error div {
padding: 10px 40px 0 186px;
}
#block_error div h2 {
color: #218bdc;
font-size: 24px;
display: block;
padding: 0 0 14px 0;
border-bottom: 1px solid #cccccc;
margin-bottom: 12px;
font-weight: normal;
}
img {
max-height: 50px;
margin: 10px 0 0 5px;
}
</style>
</head>
<body marginwidth="0" marginheight="0">
<div id="block_error">
<img src="view/img/logo.png" class="img img-responsive center-block"/>
<div>
<h2><?php echo __("Error. Oops you've encountered an error"); ?></h2>
<p>
<?php echo __("It appears that either something went wrong or the mod rewrite configration is not correct."); ?><br />
</p>
<p><b><?php echo __("If you don't use apache, just let .htaccess stay or create a empty file - then this check will pass."); ?></b></p>
<p><?php echo __("We need to allow Apache to read .htaccess files located under the "); echo getcwd(); echo __(" directory."); ?>
<?php echo __("You can do this by editing the Apache configuration file:"); ?></p>
<p>
<?php echo __("Find the section <code>"); echo htmlentities("<directory /var/www/html>"); echo __("</code> and change <b>AllowOverride None</b> to <b>AllowOverride All</b>"); ?>
</p>
<p><pre><code>sudo nano /etc/apache2/apache2.conf</code></pre></p>
<p>
<?php echo __("After editing the above file your code should be like this:"); ?>
</p>
<p><pre><code><?php echo htmlentities("<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>"); ?></code></pre></p>
<p><?php echo __("In order to use mod_rewrite you can type the following command in the terminal:</p>"); ?>
<p><pre><code>sudo a2enmod rewrite</code></pre></p>
<p><?php echo __("Restart apache2 after"); ?></p>
<p><pre><code>sudo /etc/init.d/apache2 restart</code></pre></p>
<p><?php echo __("or"); ?></p>
<p><pre><code>sudo service apache2 restart</code></pre></p>
</div>
</div>
</body>
</html>
<?php
function __($text){
return $text;
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<title><?php echo __("Error Page"); ?></title>
<link href="view/bootstrap/css/bootstrap.css" rel="stylesheet" type="text/css" />
<style>
body {
margin: 0;
padding: 0;
background: #e7ecf0;
font-family: Arial, Helvetica, sans-serif;
}
* {
margin: 0;
padding: 0;
}
p {
font-size: 12px;
color: #373737;
font-family: Arial, Helvetica, sans-serif;
line-height: 18px;
}
p a {
color: #218bdc;
font-size: 12px;
text-decoration: none;
}
a {
outline: none;
}
.f-left {
float: left;
}
.f-right {
float: right;
}
.clear {
clear: both;
overflow: hidden;
}
#block_error {
width: 1000px;
height: 700px;
border: 1px solid #cccccc;
margin: 72px auto 0;
-moz-border-radius: 4px;
-webkit-border-radius: 4px;
border-radius: 4px;
background: #fff url(https://tutorials.avideo.com/view/img/transparent1px.png) no-repeat 0 51px;
}
#block_error div {
padding: 10px 40px 0 186px;
}
#block_error div h2 {
color: #218bdc;
font-size: 24px;
display: block;
padding: 0 0 14px 0;
border-bottom: 1px solid #cccccc;
margin-bottom: 12px;
font-weight: normal;
}
img {
max-height: 50px;
margin: 10px 0 0 5px;
}
</style>
</head>
<body marginwidth="0" marginheight="0">
<div id="block_error">
<img src="view/img/logo.png" class="img img-responsive center-block"/>
<div>
<h2><?php echo __("Error. Oops you've encountered an error"); ?></h2>
<p>
<?php echo __("It appears that either something went wrong or the mod rewrite configration is not correct."); ?><br />
</p>
<p><b><?php echo __("If you don't use apache, just let .htaccess stay or create a empty file - then this check will pass."); ?></b></p>
<p><?php echo __("We need to allow Apache to read .htaccess files located under the "); echo getcwd(); echo __(" directory."); ?>
<?php echo __("You can do this by editing the Apache configuration file:"); ?></p>
<p>
<?php echo __("Find the section <code>"); echo htmlentities("<directory /var/www/html>"); echo __("</code> and change <b>AllowOverride None</b> to <b>AllowOverride All</b>"); ?>
</p>
<p><pre><code>sudo nano /etc/apache2/apache2.conf</code></pre></p>
<p>
<?php echo __("After editing the above file your code should be like this:"); ?>
</p>
<p><pre><code><?php echo htmlentities("<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>"); ?></code></pre></p>
<p><?php echo __("In order to use mod_rewrite you can type the following command in the terminal:</p>"); ?>
<p><pre><code>sudo a2enmod rewrite</code></pre></p>
<p><?php echo __("Restart apache2 after"); ?></p>
<p><pre><code>sudo /etc/init.d/apache2 restart</code></pre></p>
<p><?php echo __("or"); ?></p>
<p><pre><code>sudo service apache2 restart</code></pre></p>
</div>
</div>
</body>
</html>
<?php
function __($text)
{
return $text;
}

View file

@ -1,240 +1,241 @@
<?php
if (file_exists("../videos/configuration.php")) {
error_log("Can not create configuration again: ". json_encode($_SERVER));
exit;
}
$installationVersion = "11.5";
error_log("Installation: ".__LINE__." ". json_encode($_POST));
header('Content-Type: application/json');
$obj = new stdClass();
$obj->post = $_POST;
if (!file_exists($_POST['systemRootPath'] . "index.php")) {
$obj->error = "Your system path to application ({$_POST['systemRootPath']}) is wrong";
echo json_encode($obj);
exit;
}
error_log("Installation: ".__LINE__);
$mysqli = @new mysqli($_POST['databaseHost'], $_POST['databaseUser'], $_POST['databasePass'], "", $_POST['databasePort']);
/*
* This is the "official" OO way to do it,
* BUT $connect_error was broken until PHP 5.2.9 and 5.3.0.
*/
if ($mysqli->connect_error) {
$obj->error = ('Connect Error (' . $mysqli->connect_errno . ') ' . $mysqli->connect_error);
echo json_encode($obj);
exit;
}
error_log("Installation: ".__LINE__);
if ($_POST['createTables'] == 2) {
$sql = "CREATE DATABASE IF NOT EXISTS {$_POST['databaseName']}";
if ($mysqli->query($sql) !== TRUE) {
$obj->error = "Error creating database: " . $mysqli->error;
echo json_encode($obj);
exit;
}
}
$mysqli->select_db($_POST['databaseName']);
error_log("Installation: ".__LINE__);
/*
$cmd = "mysql -h {$_POST['databaseHost']} -u {$_POST['databaseUser']} -p {$_POST['databasePass']} {$_POST['databaseName']} < {$_POST['systemRootPath']}install/database.sql";
exec("{$cmd} 2>&1", $output, $return_val);
if ($return_val !== 0) {
$obj->error = "Error on command: {$cmd}";
echo json_encode($obj);
exit;
}
*/
error_log("Installation: ".__LINE__);
if ($_POST['createTables'] > 0) {
error_log("Installation: ".__LINE__);
// Temporary variable, used to store current query
$templine = '';
$installFile = "{$_POST['systemRootPath']}install/database.sql";
if(!file_exists($installFile)){
$obj->error = "File Not found {$installFile}";
echo json_encode($obj);
exit;
}
error_log("Installation: ".__LINE__);
// Read in entire file
$lines = file($installFile);
if(empty($lines)){
$obj->error = "File is empty {$installFile}";
echo json_encode($obj);
exit;
}
error_log("Installation: ".__LINE__);
// Loop through each line
$obj->error = "";
foreach ($lines as $line) {
// Skip it if it's a comment
if (substr($line, 0, 2) == '--' || $line == '')
continue;
// Add this line to the current segment
$templine .= $line;
// If it has a semicolon at the end, it's the end of the query
if (substr(trim($line), -1, 1) == ';') {
// Perform the query
//error_log("Installation: ".$templine);
if (!$mysqli->query($templine)) {
error_log("Installation: SQL ERROR ".$mysqli->error);
$obj->error = ('Error performing query \'<strong>' . $templine . '\': ' . $mysqli->error . '<br /><br />');
}
// Reset temp variable to empty
$templine = '';
}
}
error_log("Installation: ".__LINE__);
}
error_log("Installation: ".__LINE__);
$sql = "DELETE FROM users WHERE id = 1 ";
if ($mysqli->query($sql) !== TRUE) {
$obj->error = "Error deleting user: " . $mysqli->error;
echo json_encode($obj);
exit;
}
error_log("Installation: ".__LINE__);
$sql = "INSERT INTO users (id, user, email, password, created, modified, isAdmin) VALUES (1, 'admin', '" . $_POST['contactEmail'] . "', '" . md5($_POST['systemAdminPass']) . "', now(), now(), true)";
if ($mysqli->query($sql) !== TRUE) {
$obj->error = "Error creating admin user: " . $mysqli->error;
echo json_encode($obj);
exit;
}
error_log("Installation: ".__LINE__);
$sql = "DELETE FROM categories WHERE id = 1 ";
if ($mysqli->query($sql) !== TRUE) {
$obj->error = "Error deleting category: " . $mysqli->error;
echo json_encode($obj);
exit;
}
error_log("Installation: ".__LINE__);
$sql = "INSERT INTO categories (id, name, clean_name, description, created, modified) VALUES (1, 'Default', 'default','', now(), now())";
if ($mysqli->query($sql) !== TRUE) {
$obj->error = "Error creating category: " . $mysqli->error;
echo json_encode($obj);
exit;
}
error_log("Installation: ".__LINE__);
$sql = "DELETE FROM configurations WHERE id = 1 ";
if ($mysqli->query($sql) !== TRUE) {
$obj->error = "Error deleting configuration: " . $mysqli->error;
echo json_encode($obj);
exit;
}
error_log("Installation: ".__LINE__);
$encoder = 'https://encoder1.avideo.com/';
if(is_dir("{$_POST['systemRootPath']}Encoder")){
$encoder = "{$_POST['webSiteRootURL']}Encoder/";
}
$sql = "INSERT INTO configurations (id, video_resolution, users_id, version, webSiteTitle, language, contactEmail, encoderURL, created, modified) "
. " VALUES "
. " (1, '858:480', 1,'{$installationVersion}', '{$_POST['webSiteTitle']}', '{$_POST['mainLanguage']}', '{$_POST['contactEmail']}', '{$encoder}', now(), now())";
if ($mysqli->query($sql) !== TRUE) {
$obj->error = "Error creating configuration: " . $mysqli->error;
echo json_encode($obj);
exit;
}
error_log("Installation: ".__LINE__);
$sql = "INSERT INTO `plugins` VALUES (NULL, 'a06505bf-3570-4b1f-977a-fd0e5cab205d', 'active', now(), now(), '', 'Gallery', 'Gallery', '1.0');";
if ($mysqli->query($sql) !== TRUE) {
$obj->error = "Error enabling Gallery Plugin: " . $mysqli->error;
echo json_encode($obj);
exit;
}
error_log("Installation: ".__LINE__);
$mysqli->close();
if(empty($_POST['salt'])){
$_POST['salt'] = uniqid();
}
$content = "<?php
\$global['configurationVersion'] = 3.1;
\$global['disableAdvancedConfigurations'] = 0;
\$global['videoStorageLimitMinutes'] = 0;
\$global['disableTimeFix'] = 0;
\$global['logfile'] = '{$_POST['systemRootPath']}videos/avideo.log';
if(!empty(\$_SERVER['SERVER_NAME']) && \$_SERVER['SERVER_NAME']!=='localhost' && !filter_var(\$_SERVER['SERVER_NAME'], FILTER_VALIDATE_IP)) {
// get the subdirectory, if exists
\$file = str_replace(\"\\\\\", \"/\", __FILE__);
\$subDir = str_replace(array(\$_SERVER[\"DOCUMENT_ROOT\"], 'videos/configuration.php'), array('',''), \$file);
\$global['webSiteRootURL'] = \"http\".(!empty(\$_SERVER['HTTPS'])?\"s\":\"\").\"://\".\$_SERVER['SERVER_NAME'].\$subDir;
}else{
\$global['webSiteRootURL'] = '{$_POST['webSiteRootURL']}';
}
\$global['systemRootPath'] = '{$_POST['systemRootPath']}';
\$global['salt'] = '{$_POST['salt']}';
\$global['disableTimeFix'] = 0;
\$global['enableDDOSprotection'] = 1;
\$global['ddosMaxConnections'] = 40;
\$global['ddosSecondTimeout'] = 5;
\$global['strictDDOSprotection'] = 0;
\$global['noDebug'] = 0;
\$global['webSiteRootPath'] = '';
if(empty(\$global['webSiteRootPath'])){
preg_match('/https?:\/\/[^\/]+(.*)/i', \$global['webSiteRootURL'], \$matches);
if(!empty(\$matches[1])){
\$global['webSiteRootPath'] = \$matches[1];
}
}
if(empty(\$global['webSiteRootPath'])){
die('Please configure your webSiteRootPath');
}
\$mysqlHost = '{$_POST['databaseHost']}';
\$mysqlPort = '{$_POST['databasePort']}';
\$mysqlUser = '{$_POST['databaseUser']}';
\$mysqlPass = '{$_POST['databasePass']}';
\$mysqlDatabase = '{$_POST['databaseName']}';
//\$global['stopBotsList'] = array('bot','spider','rouwler','Nuclei','MegaIndex','NetSystemsResearch','CensysInspect','slurp','crawler','curl','fetch','loader');
//\$global['stopBotsWhiteList'] = array('google','bing','yahoo','yandex','twitter');
/**
* Do NOT change from here
*/
require_once \$global['systemRootPath'].'objects/include_config.php';
";
error_log("Installation: ".__LINE__);
$fp = fopen($_POST['systemRootPath'] . "videos/configuration.php", "wb");
fwrite($fp, $content);
fclose($fp);
error_log("Installation: ".__LINE__);
/*
//copy the 100% progress sample file to be used when the uploaded file is already encoded in the MP4 or WBM formats
exec("cp {$_POST['systemRootPath']}install/FinishedProgressSample.* {$_POST['systemRootPath']}videos/", $output, $return_val);
if ($return_val !== 0) {
$obj->error = "Error copying the encoding progress sample files. Check whether the directory {$_POST['systemRootPath']}videos/ exists and the process have permission";
echo json_encode($obj);
exit;
}
*/
error_log("Installation: ".__LINE__);
$obj->success = true;
echo json_encode($obj);
error_log("Installation: ".__LINE__);
<?php
if (file_exists("../videos/configuration.php")) {
error_log("Can not create configuration again: ". json_encode($_SERVER));
exit;
}
$installationVersion = "11.5";
error_log("Installation: ".__LINE__." ". json_encode($_POST));
header('Content-Type: application/json');
$obj = new stdClass();
$obj->post = $_POST;
if (!file_exists($_POST['systemRootPath'] . "index.php")) {
$obj->error = "Your system path to application ({$_POST['systemRootPath']}) is wrong";
echo json_encode($obj);
exit;
}
error_log("Installation: ".__LINE__);
$mysqli = @new mysqli($_POST['databaseHost'], $_POST['databaseUser'], $_POST['databasePass'], "", $_POST['databasePort']);
/*
* This is the "official" OO way to do it,
* BUT $connect_error was broken until PHP 5.2.9 and 5.3.0.
*/
if ($mysqli->connect_error) {
$obj->error = ('Connect Error (' . $mysqli->connect_errno . ') ' . $mysqli->connect_error);
echo json_encode($obj);
exit;
}
error_log("Installation: ".__LINE__);
if ($_POST['createTables'] == 2) {
$sql = "CREATE DATABASE IF NOT EXISTS {$_POST['databaseName']}";
if ($mysqli->query($sql) !== true) {
$obj->error = "Error creating database: " . $mysqli->error;
echo json_encode($obj);
exit;
}
}
$mysqli->select_db($_POST['databaseName']);
error_log("Installation: ".__LINE__);
/*
$cmd = "mysql -h {$_POST['databaseHost']} -u {$_POST['databaseUser']} -p {$_POST['databasePass']} {$_POST['databaseName']} < {$_POST['systemRootPath']}install/database.sql";
exec("{$cmd} 2>&1", $output, $return_val);
if ($return_val !== 0) {
$obj->error = "Error on command: {$cmd}";
echo json_encode($obj);
exit;
}
*/
error_log("Installation: ".__LINE__);
if ($_POST['createTables'] > 0) {
error_log("Installation: ".__LINE__);
// Temporary variable, used to store current query
$templine = '';
$installFile = "{$_POST['systemRootPath']}install/database.sql";
if (!file_exists($installFile)) {
$obj->error = "File Not found {$installFile}";
echo json_encode($obj);
exit;
}
error_log("Installation: ".__LINE__);
// Read in entire file
$lines = file($installFile);
if (empty($lines)) {
$obj->error = "File is empty {$installFile}";
echo json_encode($obj);
exit;
}
error_log("Installation: ".__LINE__);
// Loop through each line
$obj->error = '';
foreach ($lines as $line) {
// Skip it if it's a comment
if (substr($line, 0, 2) == '--' || $line == '') {
continue;
}
// Add this line to the current segment
$templine .= $line;
// If it has a semicolon at the end, it's the end of the query
if (substr(trim($line), -1, 1) == ';') {
// Perform the query
//error_log("Installation: ".$templine);
if (!$mysqli->query($templine)) {
error_log("Installation: SQL ERROR ".$mysqli->error);
$obj->error = ('Error performing query \'<strong>' . $templine . '\': ' . $mysqli->error . '<br /><br />');
}
// Reset temp variable to empty
$templine = '';
}
}
error_log("Installation: ".__LINE__);
}
error_log("Installation: ".__LINE__);
$sql = "DELETE FROM users WHERE id = 1 ";
if ($mysqli->query($sql) !== true) {
$obj->error = "Error deleting user: " . $mysqli->error;
echo json_encode($obj);
exit;
}
error_log("Installation: ".__LINE__);
$sql = "INSERT INTO users (id, user, email, password, created, modified, isAdmin) VALUES (1, 'admin', '" . $_POST['contactEmail'] . "', '" . md5($_POST['systemAdminPass']) . "', now(), now(), true)";
if ($mysqli->query($sql) !== true) {
$obj->error = "Error creating admin user: " . $mysqli->error;
echo json_encode($obj);
exit;
}
error_log("Installation: ".__LINE__);
$sql = "DELETE FROM categories WHERE id = 1 ";
if ($mysqli->query($sql) !== true) {
$obj->error = "Error deleting category: " . $mysqli->error;
echo json_encode($obj);
exit;
}
error_log("Installation: ".__LINE__);
$sql = "INSERT INTO categories (id, name, clean_name, description, created, modified) VALUES (1, 'Default', 'default','', now(), now())";
if ($mysqli->query($sql) !== true) {
$obj->error = "Error creating category: " . $mysqli->error;
echo json_encode($obj);
exit;
}
error_log("Installation: ".__LINE__);
$sql = "DELETE FROM configurations WHERE id = 1 ";
if ($mysqli->query($sql) !== true) {
$obj->error = "Error deleting configuration: " . $mysqli->error;
echo json_encode($obj);
exit;
}
error_log("Installation: ".__LINE__);
$encoder = 'https://encoder1.avideo.com/';
if (is_dir("{$_POST['systemRootPath']}Encoder")) {
$encoder = "{$_POST['webSiteRootURL']}Encoder/";
}
$sql = "INSERT INTO configurations (id, video_resolution, users_id, version, webSiteTitle, language, contactEmail, encoderURL, created, modified) "
. " VALUES "
. " (1, '858:480', 1,'{$installationVersion}', '{$_POST['webSiteTitle']}', '{$_POST['mainLanguage']}', '{$_POST['contactEmail']}', '{$encoder}', now(), now())";
if ($mysqli->query($sql) !== true) {
$obj->error = "Error creating configuration: " . $mysqli->error;
echo json_encode($obj);
exit;
}
error_log("Installation: ".__LINE__);
$sql = "INSERT INTO `plugins` VALUES (NULL, 'a06505bf-3570-4b1f-977a-fd0e5cab205d', 'active', now(), now(), '', 'Gallery', 'Gallery', '1.0');";
if ($mysqli->query($sql) !== true) {
$obj->error = "Error enabling Gallery Plugin: " . $mysqli->error;
echo json_encode($obj);
exit;
}
error_log("Installation: ".__LINE__);
$mysqli->close();
if (empty($_POST['salt'])) {
$_POST['salt'] = uniqid();
}
$content = "<?php
\$global['configurationVersion'] = 3.1;
\$global['disableAdvancedConfigurations'] = 0;
\$global['videoStorageLimitMinutes'] = 0;
\$global['disableTimeFix'] = 0;
\$global['logfile'] = '{$_POST['systemRootPath']}videos/avideo.log';
if(!empty(\$_SERVER['SERVER_NAME']) && \$_SERVER['SERVER_NAME']!=='localhost' && !filter_var(\$_SERVER['SERVER_NAME'], FILTER_VALIDATE_IP)) {
// get the subdirectory, if exists
\$file = str_replace(\"\\\\\", \"/\", __FILE__);
\$subDir = str_replace(array(\$_SERVER[\"DOCUMENT_ROOT\"], 'videos/configuration.php'), array('',''), \$file);
\$global['webSiteRootURL'] = \"http\".(!empty(\$_SERVER['HTTPS'])?\"s\":\"\").\"://\".\$_SERVER['SERVER_NAME'].\$subDir;
}else{
\$global['webSiteRootURL'] = '{$_POST['webSiteRootURL']}';
}
\$global['systemRootPath'] = '{$_POST['systemRootPath']}';
\$global['salt'] = '{$_POST['salt']}';
\$global['disableTimeFix'] = 0;
\$global['enableDDOSprotection'] = 1;
\$global['ddosMaxConnections'] = 40;
\$global['ddosSecondTimeout'] = 5;
\$global['strictDDOSprotection'] = 0;
\$global['noDebug'] = 0;
\$global['webSiteRootPath'] = '';
if(empty(\$global['webSiteRootPath'])){
preg_match('/https?:\/\/[^\/]+(.*)/i', \$global['webSiteRootURL'], \$matches);
if(!empty(\$matches[1])){
\$global['webSiteRootPath'] = \$matches[1];
}
}
if(empty(\$global['webSiteRootPath'])){
die('Please configure your webSiteRootPath');
}
\$mysqlHost = '{$_POST['databaseHost']}';
\$mysqlPort = '{$_POST['databasePort']}';
\$mysqlUser = '{$_POST['databaseUser']}';
\$mysqlPass = '{$_POST['databasePass']}';
\$mysqlDatabase = '{$_POST['databaseName']}';
//\$global['stopBotsList'] = array('bot','spider','rouwler','Nuclei','MegaIndex','NetSystemsResearch','CensysInspect','slurp','crawler','curl','fetch','loader');
//\$global['stopBotsWhiteList'] = array('google','bing','yahoo','yandex','twitter');
/**
* Do NOT change from here
*/
require_once \$global['systemRootPath'].'objects/include_config.php';
";
error_log("Installation: ".__LINE__);
$fp = fopen($_POST['systemRootPath'] . "videos/configuration.php", "wb");
fwrite($fp, $content);
fclose($fp);
error_log("Installation: ".__LINE__);
/*
//copy the 100% progress sample file to be used when the uploaded file is already encoded in the MP4 or WBM formats
exec("cp {$_POST['systemRootPath']}install/FinishedProgressSample.* {$_POST['systemRootPath']}videos/", $output, $return_val);
if ($return_val !== 0) {
$obj->error = "Error copying the encoding progress sample files. Check whether the directory {$_POST['systemRootPath']}videos/ exists and the process have permission";
echo json_encode($obj);
exit;
}
*/
error_log("Installation: ".__LINE__);
$obj->success = true;
echo json_encode($obj);
error_log("Installation: ".__LINE__);

File diff suppressed because it is too large Load diff

View file

@ -1,85 +1,83 @@
<?php
//streamer config
require_once '../videos/configuration.php';
if (!isCommandLineInterface()) {
return die('Command Line only');
}
$doNotDeleteFilesList = array('configuration.php', 'favicon.ico', 'favicon.png', 'avideo.log', 'PayPal.log', 'socketPID.log', 'logo.png', 'logoOverlay.png');
$lockFilename = '.move_v1.lock';
$path = getVideosDir();
$files = array_diff(scandir($path), array('.', '..'));
echo "*** Total filenames " . count($files) . "\n";
foreach ($files as $key => $value) {
$dir = "{$path}{$value}";
if (!is_dir($dir)) {
$bname = basename($dir);
if (in_array($bname, $doNotDeleteFilesList) || preg_match('/configuration\./i', $bname)) {
unset($files[$key]);
} else {
$filename = Video::getCleanFilenameFromFile($dir);
$video = Video::getVideoFromFileName($filename, true);
if (!empty($video)) {
//echo "+++ Video FOUND for filename {$filename} ".PHP_EOL;
unset($files[$key]);
} else {
$files[$key] = array($value, $dir);
//echo "*** Video NOT found for filename {$filename} ".PHP_EOL;
}
}
continue;
}
$file = "{$dir}" . DIRECTORY_SEPARATOR . "{$lockFilename}";
if (file_exists($file)) {
$filename = Video::getCleanFilenameFromFile($dir);
$video = Video::getVideoFromFileName($filename, true);
if (!empty($video)) {
//echo "+++ Video FOUND for filename {$filename} ".PHP_EOL;
unset($files[$key]);
} else {
$files[$key] = array($value, $dir);
//echo "*** Video NOT found for filename {$filename} ".PHP_EOL;
}
} else {
//echo "*** Lock file does not exists {$file} ".PHP_EOL;
unset($files[$key]);
}
}
$total = count($files);
echo "*** Total filenames " . $total . " Will be deleted\n";
if (empty($total)) {
exit;
}
$totalSize = 0;
foreach ($files as $key => $value) {
$size = getDirSize($value[1]);
$totalSize += $size;
echo "{$value[0]} => $value[1] " . (humanFileSize($size)) . " \n";
}
echo "*** Confirm Delete Them (" . humanFileSize($totalSize) . ")? y/n: ";
ob_flush();
$confirm = trim(readline(""));
if (!empty($confirm) && strtolower($confirm) === 'y') {
foreach ($files as $key => $value) {
if (is_dir($value[1])) {
rrmdir($value[1]);
if (is_dir($value[1])) {
echo "$value[1] Directory Deleted \n";
} else {
echo "$value[1] Directory Could Not be Deleted \n";
}
} else
if (unlink($value[1])) {
echo "$value[1] Deleted \n";
} else {
echo "$value[1] Could Not be Deleted \n";
}
}
}
<?php
//streamer config
require_once '../videos/configuration.php';
if (!isCommandLineInterface()) {
return die('Command Line only');
}
$doNotDeleteFilesList = ['configuration.php', 'favicon.ico', 'favicon.png', 'avideo.log', 'PayPal.log', 'socketPID.log', 'logo.png', 'logoOverlay.png'];
$lockFilename = '.move_v1.lock';
$path = getVideosDir();
$files = array_diff(scandir($path), ['.', '..']);
echo "*** Total filenames " . count($files) . "\n";
foreach ($files as $key => $value) {
$dir = "{$path}{$value}";
if (!is_dir($dir)) {
$bname = basename($dir);
if (in_array($bname, $doNotDeleteFilesList) || preg_match('/configuration\./i', $bname)) {
unset($files[$key]);
} else {
$filename = Video::getCleanFilenameFromFile($dir);
$video = Video::getVideoFromFileName($filename, true);
if (!empty($video)) {
//echo "+++ Video FOUND for filename {$filename} ".PHP_EOL;
unset($files[$key]);
} else {
$files[$key] = [$value, $dir];
//echo "*** Video NOT found for filename {$filename} ".PHP_EOL;
}
}
continue;
}
$file = "{$dir}" . DIRECTORY_SEPARATOR . "{$lockFilename}";
if (file_exists($file)) {
$filename = Video::getCleanFilenameFromFile($dir);
$video = Video::getVideoFromFileName($filename, true);
if (!empty($video)) {
//echo "+++ Video FOUND for filename {$filename} ".PHP_EOL;
unset($files[$key]);
} else {
$files[$key] = [$value, $dir];
//echo "*** Video NOT found for filename {$filename} ".PHP_EOL;
}
} else {
//echo "*** Lock file does not exists {$file} ".PHP_EOL;
unset($files[$key]);
}
}
$total = count($files);
echo "*** Total filenames " . $total . " Will be deleted\n";
if (empty($total)) {
exit;
}
$totalSize = 0;
foreach ($files as $key => $value) {
$size = getDirSize($value[1]);
$totalSize += $size;
echo "{$value[0]} => $value[1] " . (humanFileSize($size)) . " \n";
}
echo "*** Confirm Delete Them (" . humanFileSize($totalSize) . ")? y/n: ";
ob_flush();
$confirm = trim(readline(""));
if (!empty($confirm) && strtolower($confirm) === 'y') {
foreach ($files as $key => $value) {
if (is_dir($value[1])) {
rrmdir($value[1]);
if (is_dir($value[1])) {
echo "$value[1] Directory Deleted \n";
} else {
echo "$value[1] Directory Could Not be Deleted \n";
}
} elseif (unlink($value[1])) {
echo "$value[1] Deleted \n";
} else {
echo "$value[1] Could Not be Deleted \n";
}
}
}

View file

@ -1,112 +1,110 @@
<?php
//streamer config
require_once '../videos/configuration.php';
if (!isCommandLineInterface()) {
return die('Command Line only');
}
$p = AVideoPlugin::loadPluginIfEnabled('YPTStorage');
if (empty($p)) {
return die('YPTStorage plugin disabled');
}
$fileExtensions = array('jpg', 'gif', 'mp4', 'webm', 'tgz');
$files = array();
//foreach (glob("../videos/*.{" . implode(",", $fileExtensions) . "}", GLOB_BRACE) as $filename) {
foreach (glob("../videos/*", GLOB_BRACE) as $filename) {
$base = basename($filename);
if (is_dir($filename)) {
if (strpos($base, "_YPTuniqid_") !== false) {
$files[$base] = array($base, $filename);
}
} else {
$baseName = explode("_portrait", $base);
if (!empty($baseName[1])) {
$files[$base] = array($baseName[0], $filename);
} else {
$baseName = explode("_thumbs", $base);
if (!empty($baseName[1])) {
$files[$base] = array($baseName[0], $filename);
} else {
$types = array('_HD', '_Low', '_SD');
$notFound = true;
foreach ($types as $value) {
$baseName = explode($value, $base);
if (!empty($baseName[1])) {
$files[$base] = array($baseName[0], $filename);
$notFound = false;
}
}
if ($notFound) {
foreach ($fileExtensions as $value) {
if (strpos($base, ".$value") === false) {
continue;
}
$baseName = str_replace("." . $value, "", $base);
if (!empty($baseName[1])) {
if (!in_array($baseName, $files)) {
$files[$base] = array($baseName, $filename);
}
}
}
}
}
}
}
}
echo "*** Total filenames " . count($files) . "\n";
$max = 10;
$count = 0;
$countExecuted = 0;
$checkedFiles = array();
foreach ($files as $key => $value) {
if (!empty($checkedFiles[$value[0]])) {
continue;
}
$checkedFiles[$value[0]] = array(true);
$getUsageFromFilename = YPTStorage::getUsageFromFilename($value[0]);
$checkedFiles[$value[0]][] = $getUsageFromFilename;
if ($getUsageFromFilename < 200000) {
//echo "Local file is too small, probably transfered already or is a directory (HLS) \n";
continue;
}
$video = Video::getVideoFromFileName($value[0], true);
if (!empty($video)) {
$sites_id = $video['sites_id'];
if ($sites_id > 0) {
$count++;
if ($count > $max) {
exit;
}
echo "{$count}: Local file videos_id = {$video['id']} {$video['title']}=> $getUsageFromFilename " . humanFileSize($getUsageFromFilename) . "\n";
$source_size = YPTStorage::getFileSize($video['id'], -1);
$destination_size = YPTStorage::getFileSize($video['id'], $sites_id);
if (!empty($destination_size) && $destination_size > 5000000 && $source_size <= $destination_size) {
$countExecuted++;
if ($countExecuted > $max) {
exit;
}
YPTStorage::createDummy($video['id']);
$tgzFile = $global['systemRootPath'] . "videos/{$video['filename']}.tgz";
if(file_exists($tgzFile)){
unlink($tgzFile);
}
echo "****** File size is the same videos_id = {$video['id']} {$sites_id} [$source_size!==$destination_size][" . humanFileSize($source_size) . "!==" . humanFileSize($destination_size) . "]\n";
//exit;
} else if($source_sizee > 5000000){
echo "----- ERROR File size is NOT the same videos_id and it's supposed to be on the storage = {$video['id']} {$sites_id} [$source_size!==$destination_size][" . humanFileSize($source_size) . "!==" . humanFileSize($destination_size) . "]\n";
} else if($source_sizee > 5000000){
echo "+++++ All seems fine with video {$video['id']} {$sites_id} [$source_size!==$destination_size][" . humanFileSize($source_size) . "!==" . humanFileSize($destination_size) . "]\n";
}
} else {
//echo "The video_id {$video['id']} ({$video['title']}) is not hosted on the storage\n";
}
}
}
<?php
//streamer config
require_once '../videos/configuration.php';
if (!isCommandLineInterface()) {
return die('Command Line only');
}
$p = AVideoPlugin::loadPluginIfEnabled('YPTStorage');
if (empty($p)) {
return die('YPTStorage plugin disabled');
}
$fileExtensions = ['jpg', 'gif', 'mp4', 'webm', 'tgz'];
$files = [];
//foreach (glob("../videos/*.{" . implode(",", $fileExtensions) . "}", GLOB_BRACE) as $filename) {
foreach (glob("../videos/*", GLOB_BRACE) as $filename) {
$base = basename($filename);
if (is_dir($filename)) {
if (strpos($base, "_YPTuniqid_") !== false) {
$files[$base] = [$base, $filename];
}
} else {
$baseName = explode("_portrait", $base);
if (!empty($baseName[1])) {
$files[$base] = [$baseName[0], $filename];
} else {
$baseName = explode("_thumbs", $base);
if (!empty($baseName[1])) {
$files[$base] = [$baseName[0], $filename];
} else {
$types = ['_HD', '_Low', '_SD'];
$notFound = true;
foreach ($types as $value) {
$baseName = explode($value, $base);
if (!empty($baseName[1])) {
$files[$base] = [$baseName[0], $filename];
$notFound = false;
}
}
if ($notFound) {
foreach ($fileExtensions as $value) {
if (strpos($base, ".$value") === false) {
continue;
}
$baseName = str_replace("." . $value, "", $base);
if (!empty($baseName[1])) {
if (!in_array($baseName, $files)) {
$files[$base] = [$baseName, $filename];
}
}
}
}
}
}
}
}
echo "*** Total filenames " . count($files) . "\n";
$max = 10;
$count = 0;
$countExecuted = 0;
$checkedFiles = [];
foreach ($files as $key => $value) {
if (!empty($checkedFiles[$value[0]])) {
continue;
}
$checkedFiles[$value[0]] = [true];
$getUsageFromFilename = YPTStorage::getUsageFromFilename($value[0]);
$checkedFiles[$value[0]][] = $getUsageFromFilename;
if ($getUsageFromFilename < 200000) {
//echo "Local file is too small, probably transfered already or is a directory (HLS) \n";
continue;
}
$video = Video::getVideoFromFileName($value[0], true);
if (!empty($video)) {
$sites_id = $video['sites_id'];
if ($sites_id > 0) {
$count++;
if ($count > $max) {
exit;
}
echo "{$count}: Local file videos_id = {$video['id']} {$video['title']}=> $getUsageFromFilename " . humanFileSize($getUsageFromFilename) . "\n";
$source_size = YPTStorage::getFileSize($video['id'], -1);
$destination_size = YPTStorage::getFileSize($video['id'], $sites_id);
if (!empty($destination_size) && $destination_size > 5000000 && $source_size <= $destination_size) {
$countExecuted++;
if ($countExecuted > $max) {
exit;
}
YPTStorage::createDummy($video['id']);
$tgzFile = $global['systemRootPath'] . "videos/{$video['filename']}.tgz";
if (file_exists($tgzFile)) {
unlink($tgzFile);
}
echo "****** File size is the same videos_id = {$video['id']} {$sites_id} [$source_size!==$destination_size][" . humanFileSize($source_size) . "!==" . humanFileSize($destination_size) . "]\n";
//exit;
} elseif ($source_sizee > 5000000) {
echo "----- ERROR File size is NOT the same videos_id and it's supposed to be on the storage = {$video['id']} {$sites_id} [$source_size!==$destination_size][" . humanFileSize($source_size) . "!==" . humanFileSize($destination_size) . "]\n";
} elseif ($source_sizee > 5000000) {
echo "+++++ All seems fine with video {$video['id']} {$sites_id} [$source_size!==$destination_size][" . humanFileSize($source_size) . "!==" . humanFileSize($destination_size) . "]\n";
}
} else {
//echo "The video_id {$video['id']} ({$video['title']}) is not hosted on the storage\n";
}
}
}

View file

@ -1,26 +1,25 @@
<?php
//streamer config
require_once '../videos/configuration.php';
ob_end_flush();
if (!isCommandLineInterface()) {
return die('Command Line only');
}
$path = getVideosDir();
$files = array_diff(scandir($path), array('.', '..'));
foreach ($files as $value) {
$dir = "{$path}{$value}";
if (is_dir($dir)) {
$files2 = array_diff(scandir($dir), array('.', '..'));
foreach ($files2 as $value2) {
$ext = pathinfo($value2, PATHINFO_EXTENSION);
if($ext=='tgz'){
$file = "{$dir}/{$value2}";
echo $file.' '. humanFileSize(filesize($file)).PHP_EOL;
unlink($file);
}
}
}
}
<?php
//streamer config
require_once '../videos/configuration.php';
ob_end_flush();
if (!isCommandLineInterface()) {
return die('Command Line only');
}
$path = getVideosDir();
$files = array_diff(scandir($path), ['.', '..']);
foreach ($files as $value) {
$dir = "{$path}{$value}";
if (is_dir($dir)) {
$files2 = array_diff(scandir($dir), ['.', '..']);
foreach ($files2 as $value2) {
$ext = pathinfo($value2, PATHINFO_EXTENSION);
if ($ext=='tgz') {
$file = "{$dir}/{$value2}";
echo $file.' '. humanFileSize(filesize($file)).PHP_EOL;
unlink($file);
}
}
}
}

View file

@ -1,34 +1,33 @@
<?php
//streamer config
require_once '../videos/configuration.php';
require_once $global['systemRootPath'] . 'objects/video.php';
if (!isCommandLineInterface()) {
return die('Command Line only');
}
ob_end_flush();
$checkIfIsCorrupted = intval(@$argv[1]);
echo "checkIfIsCorrupted = $checkIfIsCorrupted".PHP_EOL;
$users_ids = array();
$sql = "SELECT * FROM videos ";
$res = sqlDAL::readSql($sql);
$fullData = sqlDAL::fetchAllAssoc($res);
$total = count($fullData);
sqlDAL::close($res);
$rows = array();
if ($res != false) {
$count = 0;
foreach ($fullData as $key => $row) {
$count++;
$filename = $row['filename'];
$totalDeleted = Video::deleteThumbs($filename, true, $checkIfIsCorrupted);
if($totalDeleted){
echo "{$total}/{$count} Thumbs deleted ($totalDeleted) from {$row['title']}".PHP_EOL;
}else{
echo "{$total}/{$count} Thumbs NOT deleted from {$row['title']}".PHP_EOL;
}
}
} else {
die($sql . '\nError : (' . $global['mysqli']->errno . ') ' . $global['mysqli']->error);
}
<?php
//streamer config
require_once '../videos/configuration.php';
require_once $global['systemRootPath'] . 'objects/video.php';
if (!isCommandLineInterface()) {
return die('Command Line only');
}
ob_end_flush();
$checkIfIsCorrupted = intval(@$argv[1]);
echo "checkIfIsCorrupted = $checkIfIsCorrupted".PHP_EOL;
$users_ids = [];
$sql = "SELECT * FROM videos ";
$res = sqlDAL::readSql($sql);
$fullData = sqlDAL::fetchAllAssoc($res);
$total = count($fullData);
sqlDAL::close($res);
$rows = [];
if ($res != false) {
$count = 0;
foreach ($fullData as $key => $row) {
$count++;
$filename = $row['filename'];
$totalDeleted = Video::deleteThumbs($filename, true, $checkIfIsCorrupted);
if ($totalDeleted) {
echo "{$total}/{$count} Thumbs deleted ($totalDeleted) from {$row['title']}".PHP_EOL;
} else {
echo "{$total}/{$count} Thumbs NOT deleted from {$row['title']}".PHP_EOL;
}
}
} else {
die($sql . '\nError : (' . $global['mysqli']->errno . ') ' . $global['mysqli']->error);
}

View file

@ -1,43 +1,42 @@
<?php
//streamer config
require_once '../videos/configuration.php';
require_once $global['systemRootPath'] . 'objects/playlist.php';
if (!isCommandLineInterface()) {
return die('Command Line only');
}
ob_end_flush();
$sql = "select * FROM users";
$res = sqlDAL::readSql($sql);
$fullData = sqlDAL::fetchAllAssoc($res);
sqlDAL::close($res);
$rows = array();
$count = array('NoPermanent'=>0, 'NoDynamic'=>0, 'Deleted'=>0);
if ($res != false) {
foreach ($fullData as $key => $row) {
$rowsUser = UserGroups::getUserGroups($row['id']);
if(empty($rowsUser)){
//echo "This user has no permanent usergroups".PHP_EOL;
$count['NoPermanent']++;
}else{
$user = new User($row['id'], $row['user'], $row['password']);
$user->login(true, false, true);
$user_groups_id = AVideoPlugin::getDynamicUserGroupsId($row['id']);
if(empty($user_groups_id)){
//echo "This user has no dynamic usergroups".PHP_EOL;
$count['NoDynamic']++;
}else{
echo "found dynamic usergroups from users_id={$row['id']} user={$row['user']} usergroups=". implode(',', $user_groups_id).PHP_EOL;
$sqlUG = "DELETE FROM users_has_users_groups WHERE users_id = ? AND users_groups_id IN (". implode(',', $user_groups_id).")";
sqlDAL::writeSql($sqlUG, "i", array($row['id']));
$count['Deleted']++;
}
}
}
} else {
die($sql . '\nError : (' . $global['mysqli']->errno . ') ' . $global['mysqli']->error);
}
echo "Finish, ". json_encode($count);
<?php
//streamer config
require_once '../videos/configuration.php';
require_once $global['systemRootPath'] . 'objects/playlist.php';
if (!isCommandLineInterface()) {
return die('Command Line only');
}
ob_end_flush();
$sql = "select * FROM users";
$res = sqlDAL::readSql($sql);
$fullData = sqlDAL::fetchAllAssoc($res);
sqlDAL::close($res);
$rows = [];
$count = ['NoPermanent'=>0, 'NoDynamic'=>0, 'Deleted'=>0];
if ($res != false) {
foreach ($fullData as $key => $row) {
$rowsUser = UserGroups::getUserGroups($row['id']);
if (empty($rowsUser)) {
//echo "This user has no permanent usergroups".PHP_EOL;
$count['NoPermanent']++;
} else {
$user = new User($row['id'], $row['user'], $row['password']);
$user->login(true, false, true);
$user_groups_id = AVideoPlugin::getDynamicUserGroupsId($row['id']);
if (empty($user_groups_id)) {
//echo "This user has no dynamic usergroups".PHP_EOL;
$count['NoDynamic']++;
} else {
echo "found dynamic usergroups from users_id={$row['id']} user={$row['user']} usergroups=". implode(',', $user_groups_id).PHP_EOL;
$sqlUG = "DELETE FROM users_has_users_groups WHERE users_id = ? AND users_groups_id IN (". implode(',', $user_groups_id).")";
sqlDAL::writeSql($sqlUG, "i", [$row['id']]);
$count['Deleted']++;
}
}
}
} else {
die($sql . '\nError : (' . $global['mysqli']->errno . ') ' . $global['mysqli']->error);
}
echo "Finish, ". json_encode($count);

View file

@ -1,97 +1,98 @@
<?php
//streamer config
require_once '../videos/configuration.php';
if (!isCommandLineInterface()) {
return die('Command Line only');
}
$global['limitForUnlimitedVideos'] = -1;
$videos = video::getAllVideosLight("", false, true);
$count = 0;
foreach ($videos as $value) {
$count++;
echo "\n Start ($count) ******\n";
if ($value['type'] != 'video') {
echo "\nType ({$value['type']}) is not a video: " . $value['title'];
echo "\n End ($count) ******\n";
ob_flush();
continue;
}
echo "\nStart: " . $value['title'];
ob_flush();
$videoFileName = $value['filename'];
$destination = Video::getPathToFile("{$videoFileName}.webp");
if (!file_exists($destination)) {
echo "\nGet webp";
ob_flush();
$videosURL = getFirstVideoURL($videoFileName);
$videoPath = getFirstVideoPath($videoFileName);
$duration = (Video::getItemDurationSeconds(Video::getDurationFromFile($videoPath)) / 2);
if (!empty($videosURL)) {
$url = $videosURL;
$context = stream_context_create([
'ssl' => [
'verify_peer' => false,
'verify_peer_name' => false,
],
]);
$file_headers = @get_headers($url, 0, $context);
if (!$file_headers || $file_headers[0] == 'HTTP/1.1 404 Not Found') {
echo "\nGet webp not found {$url}";
ob_flush();
continue;
} else {
$url = $config->getEncoderURL() . "getImageMP4/" . base64_encode($url) . "/webp/{$duration}";
$image = url_get_contents($url);
file_put_contents($destination, $image);
}
} else {
echo "\nVideo URL empty";
ob_flush();
}
echo "\nGet done";
ob_flush();
} else {
echo "\nFile exists: " . $value['title'] . " {$destination}";
ob_flush();
}
echo "\nFinish: " . $value['title'];
echo "\n******\n";
ob_flush();
}
function getFirstVideoURL($videoFileName) {
$types = array('', '_Low', '_SD', '_HD');
$videosList = getVideosURL($videoFileName);
if (!empty($videosList['m3u8']["url"])) {
return $videosList['m3u8']["url"];
}
foreach ($types as $value) {
if (!empty($videosList['mp4' . $value]["url"])) {
return $videosList['mp4' . $value]["url"];
} else if (!empty($videosList['webm' . $value]["url"])) {
return $videosList['webm' . $value]["url"];
}
}
return false;
}
function getFirstVideoPath($videoFileName) {
$types = array('', '_Low', '_SD', '_HD');
$videosList = getVideosURL($videoFileName);
if (!empty($videosList['m3u8']["path"])) {
return $videosList['m3u8']["path"];
}
foreach ($types as $value) {
if (!empty($videosList['mp4' . $value]["path"])) {
return $videosList['mp4' . $value]["path"];
} else if (!empty($videosList['webm' . $value]["path"])) {
return $videosList['webm' . $value]["path"];
}
}
return false;
}
<?php
//streamer config
require_once '../videos/configuration.php';
if (!isCommandLineInterface()) {
return die('Command Line only');
}
$global['limitForUnlimitedVideos'] = -1;
$videos = video::getAllVideosLight("", false, true);
$count = 0;
foreach ($videos as $value) {
$count++;
echo "\n Start ($count) ******\n";
if ($value['type'] != 'video') {
echo "\nType ({$value['type']}) is not a video: " . $value['title'];
echo "\n End ($count) ******\n";
ob_flush();
continue;
}
echo "\nStart: " . $value['title'];
ob_flush();
$videoFileName = $value['filename'];
$destination = Video::getPathToFile("{$videoFileName}.webp");
if (!file_exists($destination)) {
echo "\nGet webp";
ob_flush();
$videosURL = getFirstVideoURL($videoFileName);
$videoPath = getFirstVideoPath($videoFileName);
$duration = (Video::getItemDurationSeconds(Video::getDurationFromFile($videoPath)) / 2);
if (!empty($videosURL)) {
$url = $videosURL;
$context = stream_context_create([
'ssl' => [
'verify_peer' => false,
'verify_peer_name' => false,
],
]);
$file_headers = @get_headers($url, 0, $context);
if (!$file_headers || $file_headers[0] == 'HTTP/1.1 404 Not Found') {
echo "\nGet webp not found {$url}";
ob_flush();
continue;
} else {
$url = $config->getEncoderURL() . "getImageMP4/" . base64_encode($url) . "/webp/{$duration}";
$image = url_get_contents($url);
file_put_contents($destination, $image);
}
} else {
echo "\nVideo URL empty";
ob_flush();
}
echo "\nGet done";
ob_flush();
} else {
echo "\nFile exists: " . $value['title'] . " {$destination}";
ob_flush();
}
echo "\nFinish: " . $value['title'];
echo "\n******\n";
ob_flush();
}
function getFirstVideoURL($videoFileName)
{
$types = ['', '_Low', '_SD', '_HD'];
$videosList = getVideosURL($videoFileName);
if (!empty($videosList['m3u8']["url"])) {
return $videosList['m3u8']["url"];
}
foreach ($types as $value) {
if (!empty($videosList['mp4' . $value]["url"])) {
return $videosList['mp4' . $value]["url"];
} elseif (!empty($videosList['webm' . $value]["url"])) {
return $videosList['webm' . $value]["url"];
}
}
return false;
}
function getFirstVideoPath($videoFileName)
{
$types = ['', '_Low', '_SD', '_HD'];
$videosList = getVideosURL($videoFileName);
if (!empty($videosList['m3u8']["path"])) {
return $videosList['m3u8']["path"];
}
foreach ($types as $value) {
if (!empty($videosList['mp4' . $value]["path"])) {
return $videosList['mp4' . $value]["path"];
} elseif (!empty($videosList['webm' . $value]["path"])) {
return $videosList['webm' . $value]["path"];
}
}
return false;
}

View file

@ -1,363 +1,350 @@
<?php
require_once '../objects/functions.php';
require_once '../locale/function.php';
//var_dump($_SERVER);exit;
?>
<!DOCTYPE html>
<html lang="en">
<head>
<title>Install AVideo</title>
<script src="../node_modules/jquery/dist/jquery.min.js" type="text/javascript"></script>
<link rel="icon" href="../view/img/favicon.png">
<link href="../view/bootstrap/css/bootstrap.min.css" rel="stylesheet" type="text/css"/>
<link href="../view/bootstrap/bootstrapSelectPicker/css/bootstrap-select.min.css" rel="stylesheet" type="text/css"/>
<link href="../node_modules/@fortawesome/fontawesome-free/css/all.min.css" rel="stylesheet" type="text/css"/>
<link href="../view/css/flagstrap/css/flags.css" rel="stylesheet" type="text/css"/>
<style>
.bootstrap-select{
width: 100% !important;
}
</style>
</head>
<body>
<?php
if (file_exists('../videos/configuration.php')) {
require_once '../videos/configuration.php';
?>
<div class="container">
<h3 class="alert alert-success">
<span class="glyphicon glyphicon-ok-circle"></span>
Your system is installed, remove the <code><?php echo $global['systemRootPath']; ?>install</code> directory to continue
<hr>
<a href="<?php echo $global['webSiteRootURL']; ?>" class="btn btn-success btn-lg center-block">Go to the main page</a>
</h3>
</div>
<?php
} else {
?>
<div class="container">
<img src="../view/img/logo.png" alt="Logo" class="img img-responsive center-block"/>
<div class="row">
<div class="col-md-4">
<div class="panel panel-default">
<div class="panel-heading"><i class="fas fa-tasks"></i> Check list</div>
<div class="panel-body">
<?php
if (isApache()) {
?>
<div class="alert alert-success">
<span class="glyphicon glyphicon-check"></span>
<strong><?php echo $_SERVER['SERVER_SOFTWARE']; ?> is Present</strong>
</div>
<?php
} else {
?>
<div class="alert alert-danger">
<span class="glyphicon glyphicon-unchecked"></span>
<strong>Your server is <?php echo $_SERVER['SERVER_SOFTWARE']; ?>, you must install Apache</strong>
</div>
<?php
}
?>
<?php
if (isPHP('7.3')) {
?>
<div class="alert alert-success">
<span class="glyphicon glyphicon-check"></span>
<strong>PHP <?php echo PHP_VERSION; ?> is present.</strong>
</div>
<?php
} else {
?>
<div class="alert alert-warning">
<span class="glyphicon glyphicon-exclamation-sign"></span>
<strong>Your PHP version is <?php echo PHP_VERSION; ?>. PHP 7.3 or newer is required.</strong>
</div>
<?php
}
?>
<?php
if (checkVideosDir()) {
?>
<div class="alert alert-success">
<span class="glyphicon glyphicon-check"></span>
<strong>Your videos directory is writable</strong>
</div>
<?php
} else {
?>
<div class="alert alert-danger">
<span class="glyphicon glyphicon-unchecked"></span>
<strong>Your videos directory must be writable</strong>
<details>
<?php
$dir = getPathToApplication() . "videos";
if (!file_exists($dir)) {
?>
The video directory does not exists, AVideo had no permition to create it, you must create it manualy!
<br>
<pre><code>sudo mkdir <?php echo $dir; ?></code></pre>
<?php
}
?>
<br>
Then you can set the permissions (www-data means apache user).
<br>
<pre><code>sudo chown www-data:www-data <?php echo $dir; ?> && sudo chmod 755 <?php echo $dir; ?> </code></pre>
</details>
</div>
<?php
}
$pathToPHPini = php_ini_loaded_file();
if (empty($pathToPHPini)) {
$pathToPHPini = "/etc/php/7.0/cli/php.ini";
}
?>
<?php
if (check_post_max_size()) {
?>
<div class="alert alert-success">
<span class="glyphicon glyphicon-check"></span>
<strong>Your post_max_size is <?php echo ini_get('post_max_size'); ?></strong>
</div>
<?php
} else {
?>
<div class="alert alert-danger">
<span class="glyphicon glyphicon-unchecked"></span>
<strong>Your post_max_size is <?php echo ini_get('post_max_size'); ?>, it must be at least 100M</strong>
<details>
Edit the <code>php.ini</code> file
<br>
<pre><code>sudo nano <?php echo $pathToPHPini; ?></code></pre>
</details>
</div>
<?php
}
?>
<?php
if (check_upload_max_filesize()) {
?>
<div class="alert alert-success">
<span class="glyphicon glyphicon-check"></span>
<strong>Your upload_max_filesize is <?php echo ini_get('upload_max_filesize'); ?></strong>
</div>
<?php
} else {
?>
<div class="alert alert-danger">
<span class="glyphicon glyphicon-unchecked"></span>
<strong>Your upload_max_filesize is <?php echo ini_get('upload_max_filesize'); ?>, it must be at least 100M</strong>
<details>
Edit the <code>php.ini</code> file
<br>
<pre><code>sudo nano <?php echo $pathToPHPini; ?></code></pre>
</details>
</div>
<?php
}
?>
</div>
</div>
</div>
<form id="configurationForm">
<div class="col-md-4">
<div class="panel panel-default">
<div class="panel-heading"><i class="fas fa-play-circle"></i> Site Configuration</div>
<div class="panel-body">
<div class="form-group">
<label for="webSiteRootURL">Your Site URL</label>
<input type="text" class="form-control" id="webSiteRootURL" placeholder="Enter your URL (http://yoursite.com)" value="<?php echo getURLToApplication(); ?>" required="required">
</div>
<div class="form-group">
<label for="systemRootPath">System Path to Application</label>
<input type="text" class="form-control" id="systemRootPath" placeholder="System Path to Application (/var/www/[application_path])" value="<?php echo getPathToApplication(); ?>" required="required">
</div>
<div class="row">
<div class="form-group col-md-8">
<label for="webSiteTitle">Title of your Web Site</label>
<input type="text" class="form-control" id="webSiteTitle" placeholder="Enter the title of your Web Site" value="AVideo" required="required">
</div>
<div class="form-group col-md-4">
<label for="mainLanguage">Language</label><br>
<select class="selectpicker" id="mainLanguage">
<?php
global $global;
include_once '../objects/bcp47.php';
$dir = "../locale/";
$flags = array();
if ($handle = opendir($dir)) {
while (false !== ($entry = readdir($handle))) {
if ($entry != '.' && $entry != '..' && $entry != 'index.php' && $entry != 'function.php' && $entry != 'save.php') {
$flags[] = str_replace('.php', '', $entry);
}
}
closedir($handle);
}
sort($flags);
foreach ($flags as $flag) {
//var_dump($global['bcp47'][$flag]);
$fileEx = $global['bcp47'][$flag]['flag'];
echo "<option data-content='<span class=\"flagstrap-icon flagstrap-$fileEx\"></span> {$global['bcp47'][$flag]['label']}' value=\"$fileEx\" " . (('us' == $fileEx) ? " selected" : "") . ">{$global['bcp47'][$flag]['label']}</option>";
}
?>
</select>
</div>
</div>
<div class="form-group">
<label for="contactEmail">Contact E-mail</label>
<input type="email" class="form-control" id="contactEmail" placeholder="Enter e-mail contact of your Web Site" required="required">
</div>
<div class="form-group">
<label for="systemAdminPass">System Admin password</label>
<?php
getInputPassword("systemAdminPass", 'class="form-control" required="required"', __("Enter System Admin password"));
?>
</div>
<div class="form-group">
<label for="confirmSystemAdminPass">Confirm System Admin password</label>
<?php
getInputPassword("confirmSystemAdminPass", 'class="form-control" required="required"', __("Confirm System Admin password"));
?>
</div>
</div>
</div>
</div>
<div class="col-md-4">
<div class="panel panel-default">
<div class="panel-heading"><i class="fas fa-database"></i> Database</div>
<div class="panel-body">
<div class="form-group">
<label for="databaseHost">Database Host</label>
<input type="text" class="form-control" id="databaseHost" placeholder="Enter Database Host" value="localhost" required="required">
</div>
<div class="form-group">
<label for="databasePort">Database Port</label>
<input type="text" class="form-control" id="databasePort" placeholder="Enter Database Port" value="3306" required="required">
</div>
<div class="form-group">
<label for="databaseUser">Database User</label>
<input type="text" class="form-control" id="databaseUser" placeholder="Enter Database User" value="root" required="required">
</div>
<div class="form-group">
<label for="databasePass">Database Password</label>
<?php
getInputPassword("databasePass", 'class="form-control"', __("Enter Database Password"));
?>
</div>
<div class="form-group">
<label for="databaseName">Database Name</label>
<input type="text" class="form-control" id="databaseName" placeholder="Enter Database Name" value="aVideo" required="required">
</div>
<div class="form-group">
<label for="createTables">Do you want to create database and tables?</label><br>
<select class="selectpicker" id="createTables">
<option value="2">Create database and tables</option>
<option value="1">Create only tables (Do not create database)</option>
<option value="0">Do not create any, I will import the script manually</option>
</select>
</div>
</div>
</div>
</div>
<div class="col-md-12">
<button type="submit" class="btn btn-primary btn-block"><i class="fas fa-cogs"></i> Install now</button>
</div>
</form>
</div>
</div>
<?php } ?>
<script src="../view/bootstrap/js/bootstrap.min.js" type="text/javascript"></script>
<script src="../view/css/flagstrap/js/jquery.flagstrap.min.js" type="text/javascript"></script>
<script src="../view/bootstrap/bootstrapSelectPicker/js/bootstrap-select.min.js" type="text/javascript"></script>
<script src="../node_modules/sweetalert/dist/sweetalert.min.js" type="text/javascript"></script>
<script src="../view/js/jquery.lazy/jquery.lazy.min.js" type="text/javascript"></script>
<script src="../view/js/jquery.lazy/jquery.lazy.plugins.min.js" type="text/javascript"></script>
<script src="../view/js/js-cookie/js.cookie.js" type="text/javascript"></script>
<script src="../view/js/script.js" type="text/javascript"></script>
<script>
$(function () {
$('.selectpicker').selectpicker();
$('#configurationForm').submit(function (evt) {
evt.preventDefault();
var systemAdminPass = $('#systemAdminPass').val();
var confirmSystemAdminPass = $('#confirmSystemAdminPass').val();
if (!systemAdminPass) {
avideoAlert("Sorry!", "Your System Admin Password can not be blank!", "error");
return false;
}
if (systemAdminPass != confirmSystemAdminPass) {
avideoAlert("Sorry!", "Your System Admin Password must be confirmed!", "error");
return false;
}
modal.showPleaseWait();
var webSiteRootURL = $('#webSiteRootURL').val();
var systemRootPath = $('#systemRootPath').val();
var webSiteTitle = $('#webSiteTitle').val();
var databaseHost = $('#databaseHost').val();
var databasePort = $('#databasePort').val();
var databaseUser = $('#databaseUser').val();
var databasePass = $('#databasePass').val();
var databaseName = $('#databaseName').val();
var mainLanguage = $('#mainLanguage').val();
var contactEmail = $('#contactEmail').val();
var createTables = $('#createTables').val();
$.ajax({
url: webSiteRootURL + 'install/checkConfiguration.php',
data: {
webSiteRootURL: webSiteRootURL,
systemRootPath: systemRootPath,
webSiteTitle: webSiteTitle,
databaseHost: databaseHost,
databasePort: databasePort,
databaseUser: databaseUser,
databasePass: databasePass,
databaseName: databaseName,
mainLanguage: mainLanguage,
systemAdminPass: systemAdminPass,
contactEmail: contactEmail,
createTables: createTables
},
type: 'post',
success: function (response) {
modal.hidePleaseWait();
if (response.error) {
avideoAlert("Sorry!", response.error, "error");
} else {
avideoAlert("Congratulations!", response.error, "success");
window.location.reload(false);
}
},
error: function (xhr, ajaxOptions, thrownError) {
modal.hidePleaseWait();
if (xhr.status == 404) {
avideoAlert("Sorry!", "Your Site URL is wrong!", "error");
} else {
avideoAlert("Sorry!", "Unknow error!", "error");
}
}
});
});
});
</script>
</body>
</html>
<?php
require_once '../objects/functions.php';
require_once '../locale/function.php';
//var_dump($_SERVER);exit;
?>
<!DOCTYPE html>
<html lang="en">
<head>
<title>Install AVideo</title>
<script src="../node_modules/jquery/dist/jquery.min.js" type="text/javascript"></script>
<link rel="icon" href="../view/img/favicon.png">
<link href="../view/bootstrap/css/bootstrap.min.css" rel="stylesheet" type="text/css"/>
<link href="../view/bootstrap/bootstrapSelectPicker/css/bootstrap-select.min.css" rel="stylesheet" type="text/css"/>
<link href="../node_modules/@fortawesome/fontawesome-free/css/all.min.css" rel="stylesheet" type="text/css"/>
<link href="../view/css/flagstrap/css/flags.css" rel="stylesheet" type="text/css"/>
<style>
.bootstrap-select{
width: 100% !important;
}
</style>
</head>
<body>
<?php
if (file_exists('../videos/configuration.php')) {
require_once '../videos/configuration.php'; ?>
<div class="container">
<h3 class="alert alert-success">
<span class="glyphicon glyphicon-ok-circle"></span>
Your system is installed, remove the <code><?php echo $global['systemRootPath']; ?>install</code> directory to continue
<hr>
<a href="<?php echo $global['webSiteRootURL']; ?>" class="btn btn-success btn-lg center-block">Go to the main page</a>
</h3>
</div>
<?php
} else {
?>
<div class="container">
<img src="../view/img/logo.png" alt="Logo" class="img img-responsive center-block"/>
<div class="row">
<div class="col-md-4">
<div class="panel panel-default">
<div class="panel-heading"><i class="fas fa-tasks"></i> Check list</div>
<div class="panel-body">
<?php
if (isApache()) {
?>
<div class="alert alert-success">
<span class="glyphicon glyphicon-check"></span>
<strong><?php echo $_SERVER['SERVER_SOFTWARE']; ?> is Present</strong>
</div>
<?php
} else {
?>
<div class="alert alert-danger">
<span class="glyphicon glyphicon-unchecked"></span>
<strong>Your server is <?php echo $_SERVER['SERVER_SOFTWARE']; ?>, you must install Apache</strong>
</div>
<?php
} ?>
<?php
if (isPHP('7.3')) {
?>
<div class="alert alert-success">
<span class="glyphicon glyphicon-check"></span>
<strong>PHP <?php echo PHP_VERSION; ?> is present.</strong>
</div>
<?php
} else {
?>
<div class="alert alert-warning">
<span class="glyphicon glyphicon-exclamation-sign"></span>
<strong>Your PHP version is <?php echo PHP_VERSION; ?>. PHP 7.3 or newer is required.</strong>
</div>
<?php
} ?>
<?php
if (checkVideosDir()) {
?>
<div class="alert alert-success">
<span class="glyphicon glyphicon-check"></span>
<strong>Your videos directory is writable</strong>
</div>
<?php
} else {
?>
<div class="alert alert-danger">
<span class="glyphicon glyphicon-unchecked"></span>
<strong>Your videos directory must be writable</strong>
<details>
<?php
$dir = getPathToApplication() . "videos";
if (!file_exists($dir)) {
?>
The video directory does not exists, AVideo had no permition to create it, you must create it manualy!
<br>
<pre><code>sudo mkdir <?php echo $dir; ?></code></pre>
<?php
} ?>
<br>
Then you can set the permissions (www-data means apache user).
<br>
<pre><code>sudo chown www-data:www-data <?php echo $dir; ?> && sudo chmod 755 <?php echo $dir; ?> </code></pre>
</details>
</div>
<?php
}
$pathToPHPini = php_ini_loaded_file();
if (empty($pathToPHPini)) {
$pathToPHPini = "/etc/php/7.0/cli/php.ini";
} ?>
<?php
if (check_post_max_size()) {
?>
<div class="alert alert-success">
<span class="glyphicon glyphicon-check"></span>
<strong>Your post_max_size is <?php echo ini_get('post_max_size'); ?></strong>
</div>
<?php
} else {
?>
<div class="alert alert-danger">
<span class="glyphicon glyphicon-unchecked"></span>
<strong>Your post_max_size is <?php echo ini_get('post_max_size'); ?>, it must be at least 100M</strong>
<details>
Edit the <code>php.ini</code> file
<br>
<pre><code>sudo nano <?php echo $pathToPHPini; ?></code></pre>
</details>
</div>
<?php
} ?>
<?php
if (check_upload_max_filesize()) {
?>
<div class="alert alert-success">
<span class="glyphicon glyphicon-check"></span>
<strong>Your upload_max_filesize is <?php echo ini_get('upload_max_filesize'); ?></strong>
</div>
<?php
} else {
?>
<div class="alert alert-danger">
<span class="glyphicon glyphicon-unchecked"></span>
<strong>Your upload_max_filesize is <?php echo ini_get('upload_max_filesize'); ?>, it must be at least 100M</strong>
<details>
Edit the <code>php.ini</code> file
<br>
<pre><code>sudo nano <?php echo $pathToPHPini; ?></code></pre>
</details>
</div>
<?php
} ?>
</div>
</div>
</div>
<form id="configurationForm">
<div class="col-md-4">
<div class="panel panel-default">
<div class="panel-heading"><i class="fas fa-play-circle"></i> Site Configuration</div>
<div class="panel-body">
<div class="form-group">
<label for="webSiteRootURL">Your Site URL</label>
<input type="text" class="form-control" id="webSiteRootURL" placeholder="Enter your URL (http://yoursite.com)" value="<?php echo getURLToApplication(); ?>" required="required">
</div>
<div class="form-group">
<label for="systemRootPath">System Path to Application</label>
<input type="text" class="form-control" id="systemRootPath" placeholder="System Path to Application (/var/www/[application_path])" value="<?php echo getPathToApplication(); ?>" required="required">
</div>
<div class="row">
<div class="form-group col-md-8">
<label for="webSiteTitle">Title of your Web Site</label>
<input type="text" class="form-control" id="webSiteTitle" placeholder="Enter the title of your Web Site" value="AVideo" required="required">
</div>
<div class="form-group col-md-4">
<label for="mainLanguage">Language</label><br>
<select class="selectpicker" id="mainLanguage">
<?php
global $global;
include_once '../objects/bcp47.php';
$dir = "../locale/";
$flags = [];
if ($handle = opendir($dir)) {
while (false !== ($entry = readdir($handle))) {
if ($entry != '.' && $entry != '..' && $entry != 'index.php' && $entry != 'function.php' && $entry != 'save.php') {
$flags[] = str_replace('.php', '', $entry);
}
}
closedir($handle);
}
sort($flags);
foreach ($flags as $flag) {
//var_dump($global['bcp47'][$flag]);
$fileEx = $global['bcp47'][$flag]['flag'];
echo "<option data-content='<span class=\"flagstrap-icon flagstrap-$fileEx\"></span> {$global['bcp47'][$flag]['label']}' value=\"$fileEx\" " . (('us' == $fileEx) ? " selected" : "") . ">{$global['bcp47'][$flag]['label']}</option>";
} ?>
</select>
</div>
</div>
<div class="form-group">
<label for="contactEmail">Contact E-mail</label>
<input type="email" class="form-control" id="contactEmail" placeholder="Enter e-mail contact of your Web Site" required="required">
</div>
<div class="form-group">
<label for="systemAdminPass">System Admin password</label>
<?php
getInputPassword("systemAdminPass", 'class="form-control" required="required"', __("Enter System Admin password")); ?>
</div>
<div class="form-group">
<label for="confirmSystemAdminPass">Confirm System Admin password</label>
<?php
getInputPassword("confirmSystemAdminPass", 'class="form-control" required="required"', __("Confirm System Admin password")); ?>
</div>
</div>
</div>
</div>
<div class="col-md-4">
<div class="panel panel-default">
<div class="panel-heading"><i class="fas fa-database"></i> Database</div>
<div class="panel-body">
<div class="form-group">
<label for="databaseHost">Database Host</label>
<input type="text" class="form-control" id="databaseHost" placeholder="Enter Database Host" value="localhost" required="required">
</div>
<div class="form-group">
<label for="databasePort">Database Port</label>
<input type="text" class="form-control" id="databasePort" placeholder="Enter Database Port" value="3306" required="required">
</div>
<div class="form-group">
<label for="databaseUser">Database User</label>
<input type="text" class="form-control" id="databaseUser" placeholder="Enter Database User" value="root" required="required">
</div>
<div class="form-group">
<label for="databasePass">Database Password</label>
<?php
getInputPassword("databasePass", 'class="form-control"', __("Enter Database Password")); ?>
</div>
<div class="form-group">
<label for="databaseName">Database Name</label>
<input type="text" class="form-control" id="databaseName" placeholder="Enter Database Name" value="aVideo" required="required">
</div>
<div class="form-group">
<label for="createTables">Do you want to create database and tables?</label><br>
<select class="selectpicker" id="createTables">
<option value="2">Create database and tables</option>
<option value="1">Create only tables (Do not create database)</option>
<option value="0">Do not create any, I will import the script manually</option>
</select>
</div>
</div>
</div>
</div>
<div class="col-md-12">
<button type="submit" class="btn btn-primary btn-block"><i class="fas fa-cogs"></i> Install now</button>
</div>
</form>
</div>
</div>
<?php
} ?>
<script src="../view/bootstrap/js/bootstrap.min.js" type="text/javascript"></script>
<script src="../view/css/flagstrap/js/jquery.flagstrap.min.js" type="text/javascript"></script>
<script src="../view/bootstrap/bootstrapSelectPicker/js/bootstrap-select.min.js" type="text/javascript"></script>
<script src="../node_modules/sweetalert/dist/sweetalert.min.js" type="text/javascript"></script>
<script src="../view/js/jquery.lazy/jquery.lazy.min.js" type="text/javascript"></script>
<script src="../view/js/jquery.lazy/jquery.lazy.plugins.min.js" type="text/javascript"></script>
<script src="../view/js/js-cookie/js.cookie.js" type="text/javascript"></script>
<script src="../view/js/script.js" type="text/javascript"></script>
<script>
$(function () {
$('.selectpicker').selectpicker();
$('#configurationForm').submit(function (evt) {
evt.preventDefault();
var systemAdminPass = $('#systemAdminPass').val();
var confirmSystemAdminPass = $('#confirmSystemAdminPass').val();
if (!systemAdminPass) {
avideoAlert("Sorry!", "Your System Admin Password can not be blank!", "error");
return false;
}
if (systemAdminPass != confirmSystemAdminPass) {
avideoAlert("Sorry!", "Your System Admin Password must be confirmed!", "error");
return false;
}
modal.showPleaseWait();
var webSiteRootURL = $('#webSiteRootURL').val();
var systemRootPath = $('#systemRootPath').val();
var webSiteTitle = $('#webSiteTitle').val();
var databaseHost = $('#databaseHost').val();
var databasePort = $('#databasePort').val();
var databaseUser = $('#databaseUser').val();
var databasePass = $('#databasePass').val();
var databaseName = $('#databaseName').val();
var mainLanguage = $('#mainLanguage').val();
var contactEmail = $('#contactEmail').val();
var createTables = $('#createTables').val();
$.ajax({
url: webSiteRootURL + 'install/checkConfiguration.php',
data: {
webSiteRootURL: webSiteRootURL,
systemRootPath: systemRootPath,
webSiteTitle: webSiteTitle,
databaseHost: databaseHost,
databasePort: databasePort,
databaseUser: databaseUser,
databasePass: databasePass,
databaseName: databaseName,
mainLanguage: mainLanguage,
systemAdminPass: systemAdminPass,
contactEmail: contactEmail,
createTables: createTables
},
type: 'post',
success: function (response) {
modal.hidePleaseWait();
if (response.error) {
avideoAlert("Sorry!", response.error, "error");
} else {
avideoAlert("Congratulations!", response.error, "success");
window.location.reload(false);
}
},
error: function (xhr, ajaxOptions, thrownError) {
modal.hidePleaseWait();
if (xhr.status == 404) {
avideoAlert("Sorry!", "Your Site URL is wrong!", "error");
} else {
avideoAlert("Sorry!", "Unknow error!", "error");
}
}
});
});
});
</script>
</body>
</html>

View file

@ -1,59 +1,58 @@
<?php
require_once '../objects/functions.php';
if (!isCommandLineInterface()) {
die('Command Line only');
}
if (file_exists("../videos/configuration.php")) {
die("Can not create configuration again: " . json_encode($_SERVER));
}
$databaseUser = "youphptube";
$databasePass = "youphptube";
if (version_compare(phpversion(), '7.2', '<')) {
$databaseUser = "root";
}
$webSiteRootURL = @$argv[1];
$webSiteRootURL = preg_replace("/[^0-9a-z._\/:-]/i", "", trim($webSiteRootURL));
$databaseUser = empty($argv[2])?$databaseUser:$argv[2];
$databasePass = empty($argv[3])?$databasePass:$argv[3];
$systemAdminPass = empty($argv[4])?"123":$argv[4];
$contactEmail = empty($argv[5])?"undefined@youremail.com":$argv[5];
if (!filter_var($webSiteRootURL, FILTER_VALIDATE_URL)) {
if (!empty($webSiteRootURL)) {
echo "Invalid Site URL ({$webSiteRootURL})\n";
}
echo "Enter Site URL\n";
@ob_flush();
$webSiteRootURL = trim(readline(""));
if (!filter_var($webSiteRootURL, FILTER_VALIDATE_URL)) {
die("Invalid Site URL ({$webSiteRootURL})\n");
}
}
$webSiteRootURL = rtrim($webSiteRootURL, '/') . '/';
$_POST['systemRootPath'] = str_replace("install", "", getcwd());
if(!is_dir($_POST['systemRootPath'])){
$_POST['systemRootPath'] = "/var/www/html/YouPHPTube/";
if(!is_dir($_POST['systemRootPath'])){
$_POST['systemRootPath'] = "/var/www/html/AVideo/";
}
}
$_POST['databaseHost'] = "localhost";
$_POST['databaseUser'] = $databaseUser;
$_POST['databasePass'] = $databasePass;
$_POST['databasePort'] = "3306";
$_POST['databaseName'] = "AVideo_". preg_replace("/[^0-9a-z]/i", "", parse_url($webSiteRootURL, PHP_URL_HOST));
$_POST['createTables'] = 2;
$_POST['contactEmail'] = $contactEmail;
$_POST['systemAdminPass'] = $systemAdminPass;
$_POST['mainLanguage'] = "en";
$_POST['webSiteTitle'] = "AVideo";
$_POST['webSiteRootURL'] = $webSiteRootURL;
include './checkConfiguration.php';
<?php
require_once '../objects/functions.php';
if (!isCommandLineInterface()) {
die('Command Line only');
}
if (file_exists("../videos/configuration.php")) {
die("Can not create configuration again: " . json_encode($_SERVER));
}
$databaseUser = "youphptube";
$databasePass = "youphptube";
if (version_compare(phpversion(), '7.2', '<')) {
$databaseUser = "root";
}
$webSiteRootURL = @$argv[1];
$webSiteRootURL = preg_replace("/[^0-9a-z._\/:-]/i", "", trim($webSiteRootURL));
$databaseUser = empty($argv[2]) ? $databaseUser : $argv[2];
$databasePass = empty($argv[3]) ? $databasePass : $argv[3];
$systemAdminPass = empty($argv[4]) ? "123" : $argv[4];
$contactEmail = empty($argv[5]) ? "undefined@youremail.com" : $argv[5];
if (!filter_var($webSiteRootURL, FILTER_VALIDATE_URL)) {
if (!empty($webSiteRootURL)) {
echo "Invalid Site URL ({$webSiteRootURL})\n";
}
echo "Enter Site URL\n";
@ob_flush();
$webSiteRootURL = trim(readline(""));
if (!filter_var($webSiteRootURL, FILTER_VALIDATE_URL)) {
die("Invalid Site URL ({$webSiteRootURL})\n");
}
}
$webSiteRootURL = rtrim($webSiteRootURL, '/') . '/';
$_POST['systemRootPath'] = str_replace("install", "", getcwd());
if (!is_dir($_POST['systemRootPath'])) {
$_POST['systemRootPath'] = "/var/www/html/YouPHPTube/";
if (!is_dir($_POST['systemRootPath'])) {
$_POST['systemRootPath'] = "/var/www/html/AVideo/";
}
}
$_POST['databaseHost'] = "localhost";
$_POST['databaseUser'] = $databaseUser;
$_POST['databasePass'] = $databasePass;
$_POST['databasePort'] = "3306";
$_POST['databaseName'] = "AVideo_". preg_replace("/[^0-9a-z]/i", "", parse_url($webSiteRootURL, PHP_URL_HOST));
$_POST['createTables'] = 2;
$_POST['contactEmail'] = $contactEmail;
$_POST['systemAdminPass'] = $systemAdminPass;
$_POST['mainLanguage'] = "en";
$_POST['webSiteTitle'] = "AVideo";
$_POST['webSiteRootURL'] = $webSiteRootURL;
include './checkConfiguration.php';

View file

@ -1,145 +1,148 @@
<?php
//streamer config
require_once '../videos/configuration.php';
if (!isCommandLineInterface()) {
return die('Command Line only');
}
function _rsearch($folder, $pattern) {
$dir = new RecursiveDirectoryIterator($folder);
$ite = new RecursiveIteratorIterator($dir);
$files = new RegexIterator($ite, $pattern, RegexIterator::GET_MATCH);
$fileList = array();
foreach ($files as $file) {
foreach ($file as $key => $value) {
$file[$key] = "{$folder}{$dir}/{$value}";
}
$fileList = array_merge($fileList, $file);
}
usort($fileList,
function($a, $b) {
return preg_match('/SendRecordedToEncoder/', $a) ? 1 : 0;
}
);
return $fileList;
}
$option = intval(@$argv[1]);
if (empty($option)) {
echo "1 - Install tables and enable plugins\n";
echo "2 - Install tables only\n";
echo "3 - Enable plugins only\n";
echo "4 - Update plugins only\n";
echo "Choose an option: ";
ob_flush();
$option = trim(readline(""));
}
if ($option == 1 || $option == 2) {
$files = _rsearch("{$global['systemRootPath']}plugin/", "/install\/install.sql$/i");
$templine = '';
$global['mysqli']->begin_transaction();
$totalFiles = count($files);
$countFiles = 0;
foreach ($files as $value) {
$countFiles++;
$lines = file($value);
$totalLines = count($lines);
$countLines = 0;
foreach ($lines as $line) {
$countLines++;
if (substr($line, 0, 2) == '--' || $line == '')
continue;
$templine .= $line;
if (substr(trim($line), -1, 1) == ';') {
if (!$global['mysqli']->query($templine)) {
echo ($value . ' Error performing query \'<strong>' . $templine . '\': ' . $global['mysqli']->error . '<br /><br />');
die(json_encode($obj));
} else {
echo "[{$countFiles}/{$totalFiles}][{$countLines}/{$totalLines}] Success performing query from $value\n";
}
$templine = '';
}
}
}
$global['mysqli']->commit();
}
if ($option == 1 || $option == 3) {
$EnablePlugins = array(
array('1apicbec-91db-4357-bb10-ee08b0913778', 'API', 'API'),
array('6daca392-7b14-44fb-aa33-51cba620d92e', 'CookieAlert', 'CookieAlert'),
array('55a4fa56-8a30-48d4-a0fb-8aa6b3f69033', 'CustomizeAdvanced', 'CustomizeAdvanced'),
array('55a4fa56-8a30-48d4-a0fb-8aa6b3fuser3', 'CustomizeUser', 'CustomizeUser'),
array('a06505bf-3570-4b1f-977a-fd0e5cab205d', 'Gallery', 'Gallery'),
array('e06b161c-cbd0-4c1d-a484-71018efa2f35', 'Live', 'Live'),
array('5310b394-b54f-48ab-9049-995df4d95239', 'NextButton', 'NextButton'),
array('plist12345-370-4b1f-977a-fd0e5cabtube', 'Programs', 'PlayLists'),
array('b5e223db-785b-4436-8f7b-f297860c9be0', 'ReportVideo', 'ReportVideo'),
array('f7596843-51b1-47a0-8bb1-b4ad91f87d6b', 'TheaterButton', 'TheaterButton'),
array('45432a78-d0c6-47f3-8ac4-8fd05f507386', 'User_Location', 'User_Location'),
array('4c1f4f76-b336-4ddc-a4de-184efe715c09', 'MobileManager', 'MobileManager'),
array('52chata2-3f14-49db-958e-15ccb1a07f0e', 'Chat2', 'Chat2'),
array('cf145581-7d5e-4bb6-8c12-48fc37c0630d', 'LiveUsers', 'LiveUsers'),
array('996c9afb-b90e-40ca-90cb-934856180bb9', 'MP4ThumbsAndGif', 'MP4ThumbsAndGif'),
array('eb6e2808-d876-4488-94cb-2448a6b14e0b', 'SendRecordedToEncoder', 'SendRecordedToEncoder'),
array('f2hls8c6-9359-4cc1-809f-fac32c8a4333', 'VideoHLS', 'VideoHLS'),
array('4b9142c0-f0c3-42be-8fe5-a4775111239c', 'VideoResolutionSwitcher', 'VideoResolutionSwitcher'),
array('28e74f9a-a2ef-4644-86f0-40234ae7c1b5', 'VideoThumbnails', 'VideoThumbnails'),
array('meet225-3807-4167-ba81-0509dd280e06', 'Meet', 'Meet'),
array('YPTSocket-5ee8405eaaa16', 'YPTSocket', 'YPTSocket'),
array('Scheduler-5ee8405eaaa16', 'Scheduler', 'Scheduler')
);
foreach ($EnablePlugins as $value) {
if ($plugin = Plugin::getOrCreatePluginByName($value[2], 'active')) {
echo "Success enable plugin ($value[2]) " . $plugin['name'] . "\n";
} else {
echo "ERROR enable plugin ($value[2]) \n";
}
}
}
if ($option == 4) {
echo "Searching for {$global['systemRootPath']}plugin/[plugin]/install/install.sql" . PHP_EOL;
$files = _rsearch("{$global['systemRootPath']}plugin/", "/install\/install.sql$/i");
$templine = '';
foreach ($files as $value) {
if (preg_match("/User_Location/", $value)) {
continue;
}
if (preg_match("/Customize/", $value)) {
continue;
}
echo "Checking tables from {$value}" . PHP_EOL;
$lines = file($value);
foreach ($lines as $line) {
if (substr($line, 0, 2) == '--' || $line == '')
continue;
$templine .= $line;
if (substr(trim($line), -1, 1) == ';') {
if (!$global['mysqli']->query($templine)) {
echo ($value . ' Error performing query \'<strong>' . $templine . '\': ' . $global['mysqli']->error . '<br /><br />');
//die(json_encode($obj));
} else {
echo "Success performing query from $value\n";
}
$templine = '';
}
}
}
$plugins = Plugin::getAvailablePlugins();
foreach ($plugins as $value) {
$p = AVideoPlugin::loadPlugin($value->dir);
if (empty($p)) {
continue;
}
$currentVersion = $p->getPluginVersion();
if (AVideoPlugin::updatePlugin($value->dir)) {
$p = AVideoPlugin::loadPlugin($value->dir, true);
$newVersion = $p->getPluginVersion();
echo "{$value->dir} updated FROM {$currentVersion} TO {$newVersion}" . PHP_EOL;
}
}
}
echo "Option {$option} finished \n";
<?php
//streamer config
require_once '../videos/configuration.php';
if (!isCommandLineInterface()) {
return die('Command Line only');
}
function _rsearch($folder, $pattern)
{
$dir = new RecursiveDirectoryIterator($folder);
$ite = new RecursiveIteratorIterator($dir);
$files = new RegexIterator($ite, $pattern, RegexIterator::GET_MATCH);
$fileList = [];
foreach ($files as $file) {
foreach ($file as $key => $value) {
$file[$key] = "{$folder}{$dir}/{$value}";
}
$fileList = array_merge($fileList, $file);
}
usort(
$fileList,
function ($a, $b) {
return preg_match('/SendRecordedToEncoder/', $a) ? 1 : 0;
}
);
return $fileList;
}
$option = intval(@$argv[1]);
if (empty($option)) {
echo "1 - Install tables and enable plugins\n";
echo "2 - Install tables only\n";
echo "3 - Enable plugins only\n";
echo "4 - Update plugins only\n";
echo "Choose an option: ";
ob_flush();
$option = trim(readline(""));
}
if ($option == 1 || $option == 2) {
$files = _rsearch("{$global['systemRootPath']}plugin/", "/install\/install.sql$/i");
$templine = '';
$global['mysqli']->begin_transaction();
$totalFiles = count($files);
$countFiles = 0;
foreach ($files as $value) {
$countFiles++;
$lines = file($value);
$totalLines = count($lines);
$countLines = 0;
foreach ($lines as $line) {
$countLines++;
if (substr($line, 0, 2) == '--' || $line == '') {
continue;
}
$templine .= $line;
if (substr(trim($line), -1, 1) == ';') {
if (!$global['mysqli']->query($templine)) {
echo($value . ' Error performing query \'<strong>' . $templine . '\': ' . $global['mysqli']->error . '<br /><br />');
die(json_encode($obj));
} else {
echo "[{$countFiles}/{$totalFiles}][{$countLines}/{$totalLines}] Success performing query from $value\n";
}
$templine = '';
}
}
}
$global['mysqli']->commit();
}
if ($option == 1 || $option == 3) {
$EnablePlugins = [
['1apicbec-91db-4357-bb10-ee08b0913778', 'API', 'API'],
['6daca392-7b14-44fb-aa33-51cba620d92e', 'CookieAlert', 'CookieAlert'],
['55a4fa56-8a30-48d4-a0fb-8aa6b3f69033', 'CustomizeAdvanced', 'CustomizeAdvanced'],
['55a4fa56-8a30-48d4-a0fb-8aa6b3fuser3', 'CustomizeUser', 'CustomizeUser'],
['a06505bf-3570-4b1f-977a-fd0e5cab205d', 'Gallery', 'Gallery'],
['e06b161c-cbd0-4c1d-a484-71018efa2f35', 'Live', 'Live'],
['5310b394-b54f-48ab-9049-995df4d95239', 'NextButton', 'NextButton'],
['plist12345-370-4b1f-977a-fd0e5cabtube', 'Programs', 'PlayLists'],
['b5e223db-785b-4436-8f7b-f297860c9be0', 'ReportVideo', 'ReportVideo'],
['f7596843-51b1-47a0-8bb1-b4ad91f87d6b', 'TheaterButton', 'TheaterButton'],
['45432a78-d0c6-47f3-8ac4-8fd05f507386', 'User_Location', 'User_Location'],
['4c1f4f76-b336-4ddc-a4de-184efe715c09', 'MobileManager', 'MobileManager'],
['52chata2-3f14-49db-958e-15ccb1a07f0e', 'Chat2', 'Chat2'],
['cf145581-7d5e-4bb6-8c12-48fc37c0630d', 'LiveUsers', 'LiveUsers'],
['996c9afb-b90e-40ca-90cb-934856180bb9', 'MP4ThumbsAndGif', 'MP4ThumbsAndGif'],
['eb6e2808-d876-4488-94cb-2448a6b14e0b', 'SendRecordedToEncoder', 'SendRecordedToEncoder'],
['f2hls8c6-9359-4cc1-809f-fac32c8a4333', 'VideoHLS', 'VideoHLS'],
['4b9142c0-f0c3-42be-8fe5-a4775111239c', 'VideoResolutionSwitcher', 'VideoResolutionSwitcher'],
['28e74f9a-a2ef-4644-86f0-40234ae7c1b5', 'VideoThumbnails', 'VideoThumbnails'],
['meet225-3807-4167-ba81-0509dd280e06', 'Meet', 'Meet'],
['YPTSocket-5ee8405eaaa16', 'YPTSocket', 'YPTSocket'],
['Scheduler-5ee8405eaaa16', 'Scheduler', 'Scheduler'],
];
foreach ($EnablePlugins as $value) {
if ($plugin = Plugin::getOrCreatePluginByName($value[2], 'active')) {
echo "Success enable plugin ($value[2]) " . $plugin['name'] . "\n";
} else {
echo "ERROR enable plugin ($value[2]) \n";
}
}
}
if ($option == 4) {
echo "Searching for {$global['systemRootPath']}plugin/[plugin]/install/install.sql" . PHP_EOL;
$files = _rsearch("{$global['systemRootPath']}plugin/", "/install\/install.sql$/i");
$templine = '';
foreach ($files as $value) {
if (preg_match("/User_Location/", $value)) {
continue;
}
if (preg_match("/Customize/", $value)) {
continue;
}
echo "Checking tables from {$value}" . PHP_EOL;
$lines = file($value);
foreach ($lines as $line) {
if (substr($line, 0, 2) == '--' || $line == '') {
continue;
}
$templine .= $line;
if (substr(trim($line), -1, 1) == ';') {
if (!$global['mysqli']->query($templine)) {
echo($value . ' Error performing query \'<strong>' . $templine . '\': ' . $global['mysqli']->error . '<br /><br />');
//die(json_encode($obj));
} else {
echo "Success performing query from $value\n";
}
$templine = '';
}
}
}
$plugins = Plugin::getAvailablePlugins();
foreach ($plugins as $value) {
$p = AVideoPlugin::loadPlugin($value->dir);
if (empty($p)) {
continue;
}
$currentVersion = $p->getPluginVersion();
if (AVideoPlugin::updatePlugin($value->dir)) {
$p = AVideoPlugin::loadPlugin($value->dir, true);
$newVersion = $p->getPluginVersion();
echo "{$value->dir} updated FROM {$currentVersion} TO {$newVersion}" . PHP_EOL;
}
}
}
echo "Option {$option} finished \n";

View file

@ -1,34 +1,29 @@
<?php
//streamer config
require_once '../videos/configuration.php';
if (!isCommandLineInterface()) {
return die('Command Line only');
}
AVideoPlugin::loadPlugin("Live");
$channelName = $global['mysqli']->real_escape_string($channelName);
$sql = "SELECT lt.*, u.* FROM users u LEFT JOIN live_transmitions lt ON users_id = u.id "
. " WHERE canStream = 1 AND status = 'a' ORDER BY public DESC LIMIT 20";
$res = sqlDAL::readSql($sql);
$users = sqlDAL::fetchAllAssoc($res);
sqlDAL::close($res);
if ($res != false) {
foreach ($users as $row) {
echo "-----------------------------------".PHP_EOL;
if(!empty($row['public'])){
echo "PUBLIC ";
}
echo "{$row['id']} - {$row['user']} ".PHP_EOL;
echo Live::getServer() . "?p=" . $row['password'] . "/" . $row['key'].PHP_EOL;
echo Live::getLinkToLiveFromUsers_id($row['id']).PHP_EOL;
echo "-----------------------------------".PHP_EOL;
}
}
die();
<?php
//streamer config
require_once '../videos/configuration.php';
if (!isCommandLineInterface()) {
return die('Command Line only');
}
AVideoPlugin::loadPlugin("Live");
$channelName = $global['mysqli']->real_escape_string($channelName);
$sql = "SELECT lt.*, u.* FROM users u LEFT JOIN live_transmitions lt ON users_id = u.id "
. " WHERE canStream = 1 AND status = 'a' ORDER BY public DESC LIMIT 20";
$res = sqlDAL::readSql($sql);
$users = sqlDAL::fetchAllAssoc($res);
sqlDAL::close($res);
if ($res != false) {
foreach ($users as $row) {
echo "-----------------------------------".PHP_EOL;
if (!empty($row['public'])) {
echo "PUBLIC ";
}
echo "{$row['id']} - {$row['user']} ".PHP_EOL;
echo Live::getServer() . "?p=" . $row['password'] . "/" . $row['key'].PHP_EOL;
echo Live::getLinkToLiveFromUsers_id($row['id']).PHP_EOL;
echo "-----------------------------------".PHP_EOL;
}
}
die();

View file

@ -1,36 +1,32 @@
<?php
//streamer config
require_once '../videos/configuration.php';
if(!isCommandLineInterface()){
return die('Command Line only');
}
echo "Enter the username or press enter to skip:";
echo "\n";
ob_flush();
$userName = trim(readline(""));
if(!empty($userName)){
$user = new User(0, $userName, false);
if(!empty($user->getBdId())){
$sql = "UPDATE users SET isAdmin = 1, status = 'a' where id = ".$user->getBdId();
$insert_row = sqlDAL::writeSql($sql);
if($insert_row){
echo "Your user {$userName} is admin now";
echo "\n";
die();
}
}else{
echo "User ({$userName}) Not found";
echo "\n";
die();
}
}
echo "Bye";
echo "\n";
die();
<?php
//streamer config
require_once '../videos/configuration.php';
if (!isCommandLineInterface()) {
return die('Command Line only');
}
echo "Enter the username or press enter to skip:";
echo "\n";
ob_flush();
$userName = trim(readline(""));
if (!empty($userName)) {
$user = new User(0, $userName, false);
if (!empty($user->getBdId())) {
$sql = "UPDATE users SET isAdmin = 1, status = 'a' where id = ".$user->getBdId();
$insert_row = sqlDAL::writeSql($sql);
if ($insert_row) {
echo "Your user {$userName} is admin now";
echo "\n";
die();
}
} else {
echo "User ({$userName}) Not found";
echo "\n";
die();
}
}
echo "Bye";
echo "\n";
die();

View file

@ -1,14 +1,13 @@
<?php
//streamer config
require_once '../videos/configuration.php';
if (!isCommandLineInterface()) {
return die('Command Line only');
}
$obj = AVideoPlugin::getDataObject('Live');
$result = !LiveTransmitionHistory::finishALL();
var_dump($result);
<?php
//streamer config
require_once '../videos/configuration.php';
if (!isCommandLineInterface()) {
return die('Command Line only');
}
$obj = AVideoPlugin::getDataObject('Live');
$result = !LiveTransmitionHistory::finishALL();
var_dump($result);

View file

@ -1,66 +1,64 @@
<?php
//streamer config
require_once '../videos/configuration.php';
if (!isCommandLineInterface()) {
return die('Command Line only');
}
set_time_limit(1800);
ini_set('max_execution_time', 1800);
$global['rowCount'] = $global['limitForUnlimitedVideos'] = 999999;
$path = getVideosDir();
$total = Video::getTotalVideos("", false, true, true, false, false);
$videos = Video::getAllVideosLight("", false, true, false);
$count = 0;
$isStorage = isAnyStorageEnabled();
foreach ($videos as $value) {
$count++;
$basename = "{$path}{$value['filename']}";
echo " {$count}/{$total} Searching {$basename} ".PHP_EOL;
$glob = glob("{$basename}*");
$totalItems = count($glob);
if($totalItems){
echo "Creating dir {$basename} " . PHP_EOL;
make_path(addLastSlash($basename));
}
echo "Found total of {$totalItems} items " . PHP_EOL;
$dirname = $basename.DIRECTORY_SEPARATOR;
$countItems = 0;
foreach ($glob as $file) {
$countItems++;
echo "[$countItems/$totalItems] Process file {$file} " . PHP_EOL;
if (is_dir($file)) {
if(!$isStorage && !Video::isNewVideoFilename($move['oldDir'])){
//echo $file.PHP_EOL;
$move = Video::updateDirectoryFilename($file);
echo "-->".PHP_EOL." {$count}/{$total} move directory {$move['oldDir']} to {$move['newDir']} ".PHP_EOL."<--" . PHP_EOL . PHP_EOL;
}else{
echo " We will not rename directory {$file} ".PHP_EOL;
}
continue;
}
$filename = basename($file);
$newname = Video::getPathToFile($filename);
$renamed = rename($file, $newname);
if($renamed){
echo "{$count}/{$total} moved $filename to $newname" . PHP_EOL;
}else{
echo "{$count}/{$total} fail to move $filename to $newname" . PHP_EOL;
}
}
ob_flush();
}
echo PHP_EOL." Deleting cache ... ";
ObjectYPT::deleteALLCache();
$videosDir = Video::getStoragePath();
exec("chown -R www-data:www-data {$videosDir}");
exec("chmod -R 755 {$videosDir}");
echo PHP_EOL." Done! ".PHP_EOL;
die();
<?php
//streamer config
require_once '../videos/configuration.php';
if (!isCommandLineInterface()) {
return die('Command Line only');
}
set_time_limit(1800);
ini_set('max_execution_time', 1800);
$global['rowCount'] = $global['limitForUnlimitedVideos'] = 999999;
$path = getVideosDir();
$total = Video::getTotalVideos("", false, true, true, false, false);
$videos = Video::getAllVideosLight("", false, true, false);
$count = 0;
$isStorage = isAnyStorageEnabled();
foreach ($videos as $value) {
$count++;
$basename = "{$path}{$value['filename']}";
echo " {$count}/{$total} Searching {$basename} ".PHP_EOL;
$glob = glob("{$basename}*");
$totalItems = count($glob);
if ($totalItems) {
echo "Creating dir {$basename} " . PHP_EOL;
make_path(addLastSlash($basename));
}
echo "Found total of {$totalItems} items " . PHP_EOL;
$dirname = $basename.DIRECTORY_SEPARATOR;
$countItems = 0;
foreach ($glob as $file) {
$countItems++;
echo "[$countItems/$totalItems] Process file {$file} " . PHP_EOL;
if (is_dir($file)) {
if (!$isStorage && !Video::isNewVideoFilename($move['oldDir'])) {
//echo $file.PHP_EOL;
$move = Video::updateDirectoryFilename($file);
echo "-->".PHP_EOL." {$count}/{$total} move directory {$move['oldDir']} to {$move['newDir']} ".PHP_EOL."<--" . PHP_EOL . PHP_EOL;
} else {
echo " We will not rename directory {$file} ".PHP_EOL;
}
continue;
}
$filename = basename($file);
$newname = Video::getPathToFile($filename);
$renamed = rename($file, $newname);
if ($renamed) {
echo "{$count}/{$total} moved $filename to $newname" . PHP_EOL;
} else {
echo "{$count}/{$total} fail to move $filename to $newname" . PHP_EOL;
}
}
ob_flush();
}
echo PHP_EOL." Deleting cache ... ";
ObjectYPT::deleteALLCache();
$videosDir = Video::getStoragePath();
exec("chown -R www-data:www-data {$videosDir}");
exec("chmod -R 755 {$videosDir}");
echo PHP_EOL." Done! ".PHP_EOL;
die();

View file

@ -1,58 +1,56 @@
<?php
//streamer config
require_once '../videos/configuration.php';
if (!isCommandLineInterface()) {
return die('Command Line only');
}
set_time_limit(300);
ini_set('max_execution_time', 300);
$global['rowCount'] = $global['limitForUnlimitedVideos'] = 999999;
$path = getVideosDir();
$logFile = $global['logfile'];
echo "Open $logFile" . PHP_EOL;
$handle = fopen($logFile, "r");
$pattern = '/Video::updateDirectoryFilename video folder renamed from \[olddir=(.+)\] \[newdir=(.+)\]/';
if ($handle) {
while (($line = fgets($handle)) !== false) {
if (preg_match($pattern, $line, $matches)) {
//var_dump($matches);
if(!is_dir($matches[2])){
continue;
}
$glob = glob("{$matches[1]}*");
$totalItems = count($glob);
echo "Found total of {$totalItems} items " . PHP_EOL;
$countItems = 0;
foreach ($glob as $file) {
if(is_dir($file)){
continue;
}
$pathInfo = pathinfo($file);
$sourceFilename = Video::getCleanFilenameFromFile($file);
$filename = Video::getCleanFilenameFromFile($matches[2]);
$basename = str_replace($sourceFilename, $filename, $pathInfo['basename']);
$destinationFile = "{$matches[2]}{$basename}";
//var_dump($pathInfo, $basename,$filename, $sourceFilename, $destinationFile);
$countItems++;
echo "[$countItems/$totalItems] move file {$file} to {$destinationFile}" . PHP_EOL;
rename($file, $destinationFile);
}
}
// process the line read.
}
fclose($handle);
} else {
// error opening the file.
}
<?php
//streamer config
require_once '../videos/configuration.php';
if (!isCommandLineInterface()) {
return die('Command Line only');
}
set_time_limit(300);
ini_set('max_execution_time', 300);
$global['rowCount'] = $global['limitForUnlimitedVideos'] = 999999;
$path = getVideosDir();
$logFile = $global['logfile'];
echo "Open $logFile" . PHP_EOL;
$handle = fopen($logFile, "r");
$pattern = '/Video::updateDirectoryFilename video folder renamed from \[olddir=(.+)\] \[newdir=(.+)\]/';
if ($handle) {
while (($line = fgets($handle)) !== false) {
if (preg_match($pattern, $line, $matches)) {
//var_dump($matches);
if (!is_dir($matches[2])) {
continue;
}
$glob = glob("{$matches[1]}*");
$totalItems = count($glob);
echo "Found total of {$totalItems} items " . PHP_EOL;
$countItems = 0;
foreach ($glob as $file) {
if (is_dir($file)) {
continue;
}
$pathInfo = pathinfo($file);
$sourceFilename = Video::getCleanFilenameFromFile($file);
$filename = Video::getCleanFilenameFromFile($matches[2]);
$basename = str_replace($sourceFilename, $filename, $pathInfo['basename']);
$destinationFile = "{$matches[2]}{$basename}";
//var_dump($pathInfo, $basename,$filename, $sourceFilename, $destinationFile);
$countItems++;
echo "[$countItems/$totalItems] move file {$file} to {$destinationFile}" . PHP_EOL;
rename($file, $destinationFile);
}
}
// process the line read.
}
fclose($handle);
} else {
// error opening the file.
}

View file

@ -1,73 +1,72 @@
<?php
//streamer config
require_once '../videos/configuration.php';
if (!isCommandLineInterface()) {
return die('Command Line only');
}
$fileExtensions = array('mp4', 'webm', 'm3u8');
$files = array();
//foreach (glob("../videos/*.{" . implode(",", $fileExtensions) . "}", GLOB_BRACE) as $filename) {
foreach (glob("../videos/*", GLOB_BRACE) as $filename) {
$base = basename($filename);
if (is_dir($filename)) {
if (strpos($base, "_YPTuniqid_") !== false) {
$files[$base] = array($base, $filename);
}
} else {
$types = array('_HD', '_Low', '_SD');
$notFound = true;
foreach ($types as $value) {
$baseName = explode($value, $base);
if (!empty($baseName[1])) {
$files[$base] = array($baseName[0], $filename);
$notFound = false;
}
}
if ($notFound) {
foreach ($fileExtensions as $value) {
if (strpos($base, ".$value") === false) {
continue;
}
$baseName = str_replace("." . $value, "", $base);
if (!empty($baseName[1])) {
if (!in_array($baseName, $files)) {
$files[$base] = array($baseName, $filename);
}
}
}
}
}
}
$total = count($files);
echo "*** Total filenames " . $total . "\n";
foreach ($files as $key => $value) {
$video = Video::getVideoFromFileName($value[0], true);
if (!empty($video)) {
unset($files[$key]);
}
}
echo "*** Total filenames " . $total . " Will be created\n";
echo "*** Confirm Create Them? y/n: ";
ob_flush();
$confirm = trim(readline(""));
if (!empty($confirm) && strtolower($confirm) === 'y') {
$count = 0;
foreach ($files as $key => $value) {
$count++;
$title = "Video recovered: ".date("Y-m-d H:i:s", filectime($value[1]));
$video = new Video($title, $value[0]);
$video->setStatus(Video::$statusActive);
$video->setUsers_id(1);
if($video->save(false, true)){
echo "{$count}/{$total} {$title} created\n";
}else{
echo "{$count}/{$total} ERROR on create video {$title}\n";
}
}
}
<?php
//streamer config
require_once '../videos/configuration.php';
if (!isCommandLineInterface()) {
return die('Command Line only');
}
$fileExtensions = ['mp4', 'webm', 'm3u8'];
$files = [];
//foreach (glob("../videos/*.{" . implode(",", $fileExtensions) . "}", GLOB_BRACE) as $filename) {
foreach (glob("../videos/*", GLOB_BRACE) as $filename) {
$base = basename($filename);
if (is_dir($filename)) {
if (strpos($base, "_YPTuniqid_") !== false) {
$files[$base] = [$base, $filename];
}
} else {
$types = ['_HD', '_Low', '_SD'];
$notFound = true;
foreach ($types as $value) {
$baseName = explode($value, $base);
if (!empty($baseName[1])) {
$files[$base] = [$baseName[0], $filename];
$notFound = false;
}
}
if ($notFound) {
foreach ($fileExtensions as $value) {
if (strpos($base, ".$value") === false) {
continue;
}
$baseName = str_replace("." . $value, "", $base);
if (!empty($baseName[1])) {
if (!in_array($baseName, $files)) {
$files[$base] = [$baseName, $filename];
}
}
}
}
}
}
$total = count($files);
echo "*** Total filenames " . $total . "\n";
foreach ($files as $key => $value) {
$video = Video::getVideoFromFileName($value[0], true);
if (!empty($video)) {
unset($files[$key]);
}
}
echo "*** Total filenames " . $total . " Will be created\n";
echo "*** Confirm Create Them? y/n: ";
ob_flush();
$confirm = trim(readline(""));
if (!empty($confirm) && strtolower($confirm) === 'y') {
$count = 0;
foreach ($files as $key => $value) {
$count++;
$title = "Video recovered: ".date("Y-m-d H:i:s", filectime($value[1]));
$video = new Video($title, $value[0]);
$video->setStatus(Video::$statusActive);
$video->setUsers_id(1);
if ($video->save(false, true)) {
echo "{$count}/{$total} {$title} created\n";
} else {
echo "{$count}/{$total} ERROR on create video {$title}\n";
}
}
}

View file

@ -1,65 +1,60 @@
<?php
//streamer config
require_once '../videos/configuration.php';
if (!isCommandLineInterface()) {
return die('Command Line only');
}
$userName = trim(@$argv[1]);
$password = trim(@$argv[2]);
if (empty($userName) || empty($password)) {
echo "Enter the username or press enter to skip:";
echo "\n";
ob_flush();
$userName = trim(readline(""));
if (!empty($userName)) {
$user = new User(0, $userName, false);
if (!empty($user->getBdId())) {
echo "Enter a new password for the user {$userName} or press enter to skip:";
echo "\n";
ob_flush();
$password = trim(readline(""));
if (!empty($password)) {
echo "Confirm the new password for the user {$userName}:";
echo "\n";
ob_flush();
$password2 = trim(readline(""));
if ($password === $password2) {
$user->setPassword($password);
if ($user->save()) {
echo "Your new password was saved";
echo "\n";
die();
}
} else {
echo "The passwords do not match";
echo "\n";
die();
}
}
} else {
echo "User ({$userName}) Not found";
echo "\n";
die();
}
}
} else {
$user = new User(0, $userName, false);
$user->setPassword($password);
if ($user->save()) {
echo "Your new password was saved";
echo "\n";
die();
}
}
echo "Bye";
echo "\n";
die();
<?php
//streamer config
require_once '../videos/configuration.php';
if (!isCommandLineInterface()) {
return die('Command Line only');
}
$userName = trim(@$argv[1]);
$password = trim(@$argv[2]);
if (empty($userName) || empty($password)) {
echo "Enter the username or press enter to skip:";
echo "\n";
ob_flush();
$userName = trim(readline(""));
if (!empty($userName)) {
$user = new User(0, $userName, false);
if (!empty($user->getBdId())) {
echo "Enter a new password for the user {$userName} or press enter to skip:";
echo "\n";
ob_flush();
$password = trim(readline(""));
if (!empty($password)) {
echo "Confirm the new password for the user {$userName}:";
echo "\n";
ob_flush();
$password2 = trim(readline(""));
if ($password === $password2) {
$user->setPassword($password);
if ($user->save()) {
echo "Your new password was saved";
echo "\n";
die();
}
} else {
echo "The passwords do not match";
echo "\n";
die();
}
}
} else {
echo "User ({$userName}) Not found";
echo "\n";
die();
}
}
} else {
$user = new User(0, $userName, false);
$user->setPassword($password);
if ($user->save()) {
echo "Your new password was saved";
echo "\n";
die();
}
}
echo "Bye";
echo "\n";
die();

View file

@ -1,16 +1,15 @@
<?php
//streamer config
require_once '../videos/configuration.php';
require_once $global['systemRootPath'] . 'objects/playlist.php';
if (!isCommandLineInterface()) {
return die('Command Line only');
}
echo "Start delete statistics" . PHP_EOL;
$sql = "delete FROM videos_statistics where id > 0";
sqlDAL::writeSql($sql);
echo "Finish delete statistics" . PHP_EOL;
<?php
//streamer config
require_once '../videos/configuration.php';
require_once $global['systemRootPath'] . 'objects/playlist.php';
if (!isCommandLineInterface()) {
return die('Command Line only');
}
echo "Start delete statistics" . PHP_EOL;
$sql = "delete FROM videos_statistics where id > 0";
sqlDAL::writeSql($sql);
echo "Finish delete statistics" . PHP_EOL;

View file

@ -1,78 +1,76 @@
<?php
//streamer config
require_once '../videos/configuration.php';
require_once $global['systemRootPath'] . 'objects/playlist.php';
if (!isCommandLineInterface()) {
return die('Command Line only');
}
$users_ids = array();
$sql = "SELECT distinct(users_id) as users_id FROM playlists ";
$res = sqlDAL::readSql($sql);
$fullData = sqlDAL::fetchAllAssoc($res);
sqlDAL::close($res);
$rows = array();
if ($res != false) {
foreach ($fullData as $key => $row) {
$users_ids[] = $row['users_id'];
}
} else {
die($sql . '\nError : (' . $global['mysqli']->errno . ') ' . $global['mysqli']->error);
}
foreach ($users_ids as $user_id) {
echo "Process user_id = {$user_id} favorite\n";
ob_flush();
$sql = "SELECT * FROM playlists WHERE users_id = {$user_id} AND status = 'favorite' ORDER BY created ";
$res = sqlDAL::readSql($sql);
$fullData = sqlDAL::fetchAllAssoc($res);
sqlDAL::close($res);
$rows = array();
if ($res != false) {
foreach ($fullData as $key => $row) {
if ($key === 0) {
continue;
}
if(!empty(PlayList::getVideosIDFromPlaylistLight($row['id']))){
continue;
}
$sql = "DELETE FROM playlists ";
$sql .= " WHERE id = ?";
echo $sql." = {$row['id']}\n";
ob_flush();
sqlDAL::writeSql($sql, "i", array($row['id']));
}
} else {
die($sql . '\nError : (' . $global['mysqli']->errno . ') ' . $global['mysqli']->error);
}
echo "Process user_id = {$user_id} watch_later\n";
ob_flush();
$sql = "SELECT * FROM playlists WHERE users_id = {$user_id} AND status = 'watch_later' ORDER BY created ";
$res = sqlDAL::readSql($sql);
$fullData = sqlDAL::fetchAllAssoc($res);
sqlDAL::close($res);
$rows = array();
if ($res != false) {
foreach ($fullData as $key => $row) {
if ($key === 0) {
continue;
}
$sql = "DELETE FROM playlists ";
$sql .= " WHERE id = ?";
echo $sql." = {$row['id']}\n";
ob_flush();
sqlDAL::writeSql($sql, "i", array($row['id']));
}
} else {
die($sql . '\nError : (' . $global['mysqli']->errno . ') ' . $global['mysqli']->error);
}
}
<?php
//streamer config
require_once '../videos/configuration.php';
require_once $global['systemRootPath'] . 'objects/playlist.php';
if (!isCommandLineInterface()) {
return die('Command Line only');
}
$users_ids = [];
$sql = "SELECT distinct(users_id) as users_id FROM playlists ";
$res = sqlDAL::readSql($sql);
$fullData = sqlDAL::fetchAllAssoc($res);
sqlDAL::close($res);
$rows = [];
if ($res != false) {
foreach ($fullData as $key => $row) {
$users_ids[] = $row['users_id'];
}
} else {
die($sql . '\nError : (' . $global['mysqli']->errno . ') ' . $global['mysqli']->error);
}
foreach ($users_ids as $user_id) {
echo "Process user_id = {$user_id} favorite\n";
ob_flush();
$sql = "SELECT * FROM playlists WHERE users_id = {$user_id} AND status = 'favorite' ORDER BY created ";
$res = sqlDAL::readSql($sql);
$fullData = sqlDAL::fetchAllAssoc($res);
sqlDAL::close($res);
$rows = [];
if ($res != false) {
foreach ($fullData as $key => $row) {
if ($key === 0) {
continue;
}
if (!empty(PlayList::getVideosIDFromPlaylistLight($row['id']))) {
continue;
}
$sql = "DELETE FROM playlists ";
$sql .= " WHERE id = ?";
echo $sql." = {$row['id']}\n";
ob_flush();
sqlDAL::writeSql($sql, "i", [$row['id']]);
}
} else {
die($sql . '\nError : (' . $global['mysqli']->errno . ') ' . $global['mysqli']->error);
}
echo "Process user_id = {$user_id} watch_later\n";
ob_flush();
$sql = "SELECT * FROM playlists WHERE users_id = {$user_id} AND status = 'watch_later' ORDER BY created ";
$res = sqlDAL::readSql($sql);
$fullData = sqlDAL::fetchAllAssoc($res);
sqlDAL::close($res);
$rows = [];
if ($res != false) {
foreach ($fullData as $key => $row) {
if ($key === 0) {
continue;
}
$sql = "DELETE FROM playlists ";
$sql .= " WHERE id = ?";
echo $sql." = {$row['id']}\n";
ob_flush();
sqlDAL::writeSql($sql, "i", [$row['id']]);
}
} else {
die($sql . '\nError : (' . $global['mysqli']->errno . ') ' . $global['mysqli']->error);
}
}

View file

@ -1,62 +1,61 @@
<?php
//streamer config
require_once '../videos/configuration.php';
require_once $global['systemRootPath'] . 'objects/playlist.php';
if (!isCommandLineInterface()) {
return die('Command Line only');
}
echo "Start fixing statistics" . PHP_EOL;
$session_id = array();
$sql = "SELECT distinct(session_id) as session_id FROM videos_statistics ";
$res = sqlDAL::readSql($sql);
$fullData = sqlDAL::fetchAllAssoc($res);
sqlDAL::close($res);
$rows = array();
if ($res != false) {
foreach ($fullData as $key => $row) {
$session_id[] = $row['session_id'];
}
} else {
die($sql . '\nError : (' . $global['mysqli']->errno . ') ' . $global['mysqli']->error);
}
foreach ($session_id as $id) {
echo "Process session_id = {$id}\n";
ob_flush();
$sql = "SELECT distinct(videos_id) as videos_id FROM videos_statistics WHERE session_id = '{$id}'";
echo $sql . PHP_EOL;
$res = sqlDAL::readSql($sql);
$fullData = sqlDAL::fetchAllAssoc($res);
sqlDAL::close($res);
$rows = array();
if ($res != false) {
foreach ($fullData as $row) {
$sql2 = "SELECT id FROM videos_statistics WHERE videos_id = {$row['videos_id']} AND session_id = '{$id}' ORDER BY `when` DESC LIMIT 1";
echo $sql . PHP_EOL;
$res2 = sqlDAL::readSql($sql2);
$fullData2 = sqlDAL::fetchAllAssoc($res2);
sqlDAL::close($res2);
if ($res != false) {
foreach ($fullData2 as $key2 => $row2) {
$sql = "DELETE FROM videos_statistics ";
$sql .= " WHERE videos_id = {$row['videos_id']} AND session_id = '{$id}' AND id != {$row2['id']} ";
echo $sql . PHP_EOL;
ob_flush();
sqlDAL::writeSql($sql);
}
} else {
die($sql . '\nError : (' . $global['mysqli']->errno . ') ' . $global['mysqli']->error);
}
}
} else {
die($sql . '\nError : (' . $global['mysqli']->errno . ') ' . $global['mysqli']->error);
}
}
echo "Finish fixing statistics" . PHP_EOL;
<?php
//streamer config
require_once '../videos/configuration.php';
require_once $global['systemRootPath'] . 'objects/playlist.php';
if (!isCommandLineInterface()) {
return die('Command Line only');
}
echo "Start fixing statistics" . PHP_EOL;
$session_id = [];
$sql = "SELECT distinct(session_id) as session_id FROM videos_statistics ";
$res = sqlDAL::readSql($sql);
$fullData = sqlDAL::fetchAllAssoc($res);
sqlDAL::close($res);
$rows = [];
if ($res != false) {
foreach ($fullData as $key => $row) {
$session_id[] = $row['session_id'];
}
} else {
die($sql . '\nError : (' . $global['mysqli']->errno . ') ' . $global['mysqli']->error);
}
foreach ($session_id as $id) {
echo "Process session_id = {$id}\n";
ob_flush();
$sql = "SELECT distinct(videos_id) as videos_id FROM videos_statistics WHERE session_id = '{$id}'";
echo $sql . PHP_EOL;
$res = sqlDAL::readSql($sql);
$fullData = sqlDAL::fetchAllAssoc($res);
sqlDAL::close($res);
$rows = [];
if ($res != false) {
foreach ($fullData as $row) {
$sql2 = "SELECT id FROM videos_statistics WHERE videos_id = {$row['videos_id']} AND session_id = '{$id}' ORDER BY `when` DESC LIMIT 1";
echo $sql . PHP_EOL;
$res2 = sqlDAL::readSql($sql2);
$fullData2 = sqlDAL::fetchAllAssoc($res2);
sqlDAL::close($res2);
if ($res != false) {
foreach ($fullData2 as $key2 => $row2) {
$sql = "DELETE FROM videos_statistics ";
$sql .= " WHERE videos_id = {$row['videos_id']} AND session_id = '{$id}' AND id != {$row2['id']} ";
echo $sql . PHP_EOL;
ob_flush();
sqlDAL::writeSql($sql);
}
} else {
die($sql . '\nError : (' . $global['mysqli']->errno . ') ' . $global['mysqli']->error);
}
}
} else {
die($sql . '\nError : (' . $global['mysqli']->errno . ') ' . $global['mysqli']->error);
}
}
echo "Finish fixing statistics" . PHP_EOL;

View file

@ -1,39 +1,38 @@
<?php
//streamer config
require_once '../videos/configuration.php';
require_once $global['systemRootPath'] . 'objects/playlist.php';
if (!isCommandLineInterface()) {
return die('Command Line only');
}
echo "1 - Reset all plugins Parameters\n";
echo "2 - Reset CustomizeUser Plugin Parameters only\n";
echo "3 - Reset all plugins (Will also inactivate the plugins)\n";
echo "Choose an option: ";
ob_flush();
$option = trim(readline(""));
exec("rm -R ".Video::getStoragePath()."cache/*");
if ($option == 1) {
$sql = "UPDATE plugins ";
$sql .= " SET object_data = '' WHERE id > 0";
sqlDAL::writeSql($sql);
echo "* Reset all plugins Parameters DONE\n";
ob_flush();
} else if ($option == 2) {
$sql = "UPDATE plugins ";
$sql .= " SET object_data = '' WHERE name = 'CustomizeUser'";
sqlDAL::writeSql($sql);
echo "* Reset CustomizeUser Plugin Parameters only DONE\n";
ob_flush();
} else if ($option == 3) {
$sql = "DELETE FROM plugins ";
$sql .= " WHERE id > 0";
sqlDAL::writeSql($sql);
echo "* Reset all plugins (All plugins inactivated) DONE\n";
ob_flush();
}else{
echo "Bye\n";
}
<?php
//streamer config
require_once '../videos/configuration.php';
require_once $global['systemRootPath'] . 'objects/playlist.php';
if (!isCommandLineInterface()) {
return die('Command Line only');
}
echo "1 - Reset all plugins Parameters\n";
echo "2 - Reset CustomizeUser Plugin Parameters only\n";
echo "3 - Reset all plugins (Will also inactivate the plugins)\n";
echo "Choose an option: ";
ob_flush();
$option = trim(readline(""));
exec("rm -R ".Video::getStoragePath()."cache/*");
if ($option == 1) {
$sql = "UPDATE plugins ";
$sql .= " SET object_data = '' WHERE id > 0";
sqlDAL::writeSql($sql);
echo "* Reset all plugins Parameters DONE\n";
ob_flush();
} elseif ($option == 2) {
$sql = "UPDATE plugins ";
$sql .= " SET object_data = '' WHERE name = 'CustomizeUser'";
sqlDAL::writeSql($sql);
echo "* Reset CustomizeUser Plugin Parameters only DONE\n";
ob_flush();
} elseif ($option == 3) {
$sql = "DELETE FROM plugins ";
$sql .= " WHERE id > 0";
sqlDAL::writeSql($sql);
echo "* Reset all plugins (All plugins inactivated) DONE\n";
ob_flush();
} else {
echo "Bye\n";
}

View file

@ -1,50 +1,49 @@
<?php
//streamer config
require_once '../videos/configuration.php';
if (!isCommandLineInterface()) {
return die('Command Line only');
}
ob_end_flush();
set_time_limit(300);
ini_set('max_execution_time', 300);
$global['rowCount'] = $global['limitForUnlimitedVideos'] = 999999;
$path = getVideosDir();
$total = Video::getTotalVideos("", false, true, true, false, false);
$videos = Video::getAllVideosLight("", false, true, false);
echo "Path: {$path}" . PHP_EOL;
$sites_id_to_check = array();
foreach ($videos as $value) {
if ($value['status'] !== Video::$statusBrokenMissingFiles) {
continue;
}
$sites_id_to_check[] = $value['id'];
echo "{$key}/{$total} added to move {$global['webSiteRootURL']}v/{$value['id']} {$value['title']}" . PHP_EOL;
}
$total = count($sites_id_to_check);
foreach ($sites_id_to_check as $key => $value) {
if(!empty($index) && $key<$index){
continue;
}
$video = new Video('', '', $value);
$filename = $video->getFilename();
echo "{$key}/{$total} Start check {$filename} " . PHP_EOL;
if(Video::isMediaFileMissing($filename)){
$sources = getVideosURL_V2($filename);
echo "{$key}/{$total} is missing ". json_encode($sources) . PHP_EOL;
}else{
$video->setStatus(Video::$statusActive);
echo "{$key}/{$total} is set to active " . PHP_EOL;
}
}
echo PHP_EOL . " Done! " . PHP_EOL;
die();
<?php
//streamer config
require_once '../videos/configuration.php';
if (!isCommandLineInterface()) {
return die('Command Line only');
}
ob_end_flush();
set_time_limit(300);
ini_set('max_execution_time', 300);
$global['rowCount'] = $global['limitForUnlimitedVideos'] = 999999;
$path = getVideosDir();
$total = Video::getTotalVideos("", false, true, true, false, false);
$videos = Video::getAllVideosLight("", false, true, false);
echo "Path: {$path}" . PHP_EOL;
$sites_id_to_check = [];
foreach ($videos as $value) {
if ($value['status'] !== Video::$statusBrokenMissingFiles) {
continue;
}
$sites_id_to_check[] = $value['id'];
echo "{$key}/{$total} added to move {$global['webSiteRootURL']}v/{$value['id']} {$value['title']}" . PHP_EOL;
}
$total = count($sites_id_to_check);
foreach ($sites_id_to_check as $key => $value) {
if (!empty($index) && $key<$index) {
continue;
}
$video = new Video('', '', $value);
$filename = $video->getFilename();
echo "{$key}/{$total} Start check {$filename} " . PHP_EOL;
if (Video::isMediaFileMissing($filename)) {
$sources = getVideosURL_V2($filename);
echo "{$key}/{$total} is missing ". json_encode($sources) . PHP_EOL;
} else {
$video->setStatus(Video::$statusActive);
echo "{$key}/{$total} is set to active " . PHP_EOL;
}
}
echo PHP_EOL . " Done! " . PHP_EOL;
die();

View file

@ -1,13 +1,12 @@
<?php
//streamer config
require_once '../videos/configuration.php';
AVideoPlugin::loadPlugin('YPTStorage');
if (!isCommandLineInterface()) {
return die('Command Line only');
}
error_reporting(E_ALL);
ini_set('display_errors', '1');
$filename = '_YPTuniqid_5f80cfc9990a82.31784835';
$size = YPTStorage::getUsageFromFilename($filename);
var_dump($size, humanFileSize($size));
<?php
//streamer config
require_once '../videos/configuration.php';
AVideoPlugin::loadPlugin('YPTStorage');
if (!isCommandLineInterface()) {
return die('Command Line only');
}
error_reporting(E_ALL);
ini_set('display_errors', '1');
$filename = '_YPTuniqid_5f80cfc9990a82.31784835';
$size = YPTStorage::getUsageFromFilename($filename);
var_dump($size, humanFileSize($size));

View file

@ -1,23 +1,19 @@
<?php
//streamer config
require_once '../videos/configuration.php';
if(!isCommandLineInterface()){
return die('Command Line only');
}
$global['rowCount'] = 99999;
$total = Video::getTotalVideos("",false, true, true, false, false);
$videos = Video::getAllVideosLight("", false, true, false);
$count = 0;
foreach ($videos as $value){
$count++;
$updated = Video::updateFilesize($value['id']);
echo "{$count}/{$total} (".($updated?"success":"fail").") [{$value['id']}] {$value['title']}".PHP_EOL;
ob_flush();
}
die();
<?php
//streamer config
require_once '../videos/configuration.php';
if (!isCommandLineInterface()) {
return die('Command Line only');
}
$global['rowCount'] = 99999;
$total = Video::getTotalVideos("", false, true, true, false, false);
$videos = Video::getAllVideosLight("", false, true, false);
$count = 0;
foreach ($videos as $value) {
$count++;
$updated = Video::updateFilesize($value['id']);
echo "{$count}/{$total} (".($updated ? "success" : "fail").") [{$value['id']}] {$value['title']}".PHP_EOL;
ob_flush();
}
die();

View file

@ -1,44 +1,41 @@
<?php
//streamer config
require_once '../videos/configuration.php';
if(!isCommandLineInterface()){
return die('Command Line only');
}
echo "Enter the new Streamer URL or press enter to skip:";
echo "\n";
ob_flush();
$streamerURL = trim(readline(""));
if(!empty($streamerURL)){
if (substr($streamerURL, -1) !== '/') {
$streamerURL.="/";
}
$global['webSiteRootURL'] = $streamerURL;
echo "Rewrite Streamer Config File\n";
// change the streamer config file
Configuration::rewriteConfigFile();
echo "Rewrite Streamer Config File - DONE\n";
}
$encoderConfigFile = "{$global['systemRootPath']}Encoder/videos/configuration.php";
echo "Checking encoder in {$encoderConfigFile}\n";
if(file_exists($encoderConfigFile)){
echo "Encoder found in {$encoderConfigFile}\n";
require_once $encoderConfigFile;
// change the encoder database for admin user
echo "Encoder Update configurations set allowedStreamersURL\n";
$sql = "update configurations set allowedStreamersURL = '{$streamerURL}';";
$global['mysqli']->query($sql);
echo "Encoder Update streamers set siteURL\n";
$sql = "update streamers set siteURL = '{$streamerURL}';";
$global['mysqli']->query($sql);
// change the encoder config file
}else{
echo "Encoder not found in {$encoderConfigFile}\n";
}
<?php
//streamer config
require_once '../videos/configuration.php';
if (!isCommandLineInterface()) {
return die('Command Line only');
}
echo "Enter the new Streamer URL or press enter to skip:";
echo "\n";
ob_flush();
$streamerURL = trim(readline(""));
if (!empty($streamerURL)) {
if (substr($streamerURL, -1) !== '/') {
$streamerURL.="/";
}
$global['webSiteRootURL'] = $streamerURL;
echo "Rewrite Streamer Config File\n";
// change the streamer config file
Configuration::rewriteConfigFile();
echo "Rewrite Streamer Config File - DONE\n";
}
$encoderConfigFile = "{$global['systemRootPath']}Encoder/videos/configuration.php";
echo "Checking encoder in {$encoderConfigFile}\n";
if (file_exists($encoderConfigFile)) {
echo "Encoder found in {$encoderConfigFile}\n";
require_once $encoderConfigFile;
// change the encoder database for admin user
echo "Encoder Update configurations set allowedStreamersURL\n";
$sql = "update configurations set allowedStreamersURL = '{$streamerURL}';";
$global['mysqli']->query($sql);
echo "Encoder Update streamers set siteURL\n";
$sql = "update streamers set siteURL = '{$streamerURL}';";
$global['mysqli']->query($sql);
// change the encoder config file
} else {
echo "Encoder not found in {$encoderConfigFile}\n";
}

View file

@ -1,62 +1,62 @@
<?php
//streamer config
require_once '../videos/configuration.php';
if (!isCommandLineInterface()) {
return die('Command Line only');
}
ob_end_flush();
set_time_limit(300);
ini_set('max_execution_time', 300);
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
function currentVersionLowerThen($currentversion, $oldversion) {
return version_compare($currentversion, $oldversion) > 0;
}
$updateDir = $global['systemRootPath'] . "updatedb/";
$currentVersion = $config->getVersion();
echo "Searching on ({$updateDir}) for updates greater then {$currentVersion}" . PHP_EOL;
global $global;
$files1 = scandir($updateDir);
$updateFiles = array();
foreach ($files1 as $value) {
preg_match("/updateDb.v([0-9.]*).sql/", $value, $match);
if (!empty($match)) {
if (currentVersionLowerThen($match[1], $currentVersion)) {
$updateFiles[] = array('filename' => $match[0], 'version' => $match[1]);
}
}
}
if (empty($updateFiles)) {
echo "No new update files found on ({$updateDir})" . PHP_EOL;
}else{
echo "Found ".count($updateDir)." updats" . PHP_EOL;
}
foreach ($updateFiles as $value) {
echo "Updating version " . $value['version'] . PHP_EOL;
$lines = file("{$updateDir}{$value['filename']}");
foreach ($lines as $line) {
if (substr($line, 0, 2) == '--' || $line == '')
continue;
$templine .= $line;
if (substr(trim($line), -1, 1) == ';') {
if (!$global['mysqli']->query($templine)) {
echo ('Error performing query ' . $templine . ': ' . $global['mysqli']->error . PHP_EOL);
//exit;
}
$templine = '';
}
}
}
echo PHP_EOL . " Done! " . PHP_EOL;
die();
<?php
//streamer config
require_once '../videos/configuration.php';
if (!isCommandLineInterface()) {
return die('Command Line only');
}
ob_end_flush();
set_time_limit(300);
ini_set('max_execution_time', 300);
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
function currentVersionLowerThen($currentversion, $oldversion)
{
return version_compare($currentversion, $oldversion) > 0;
}
$updateDir = $global['systemRootPath'] . "updatedb/";
$currentVersion = $config->getVersion();
echo "Searching on ({$updateDir}) for updates greater then {$currentVersion}" . PHP_EOL;
global $global;
$files1 = scandir($updateDir);
$updateFiles = [];
foreach ($files1 as $value) {
preg_match("/updateDb.v([0-9.]*).sql/", $value, $match);
if (!empty($match)) {
if (currentVersionLowerThen($match[1], $currentVersion)) {
$updateFiles[] = ['filename' => $match[0], 'version' => $match[1]];
}
}
}
if (empty($updateFiles)) {
echo "No new update files found on ({$updateDir})" . PHP_EOL;
} else {
echo "Found ".count($updateDir)." updats" . PHP_EOL;
}
foreach ($updateFiles as $value) {
echo "Updating version " . $value['version'] . PHP_EOL;
$lines = file("{$updateDir}{$value['filename']}");
foreach ($lines as $line) {
if (substr($line, 0, 2) == '--' || $line == '') {
continue;
}
$templine .= $line;
if (substr(trim($line), -1, 1) == ';') {
if (!$global['mysqli']->query($templine)) {
echo('Error performing query ' . $templine . ': ' . $global['mysqli']->error . PHP_EOL);
//exit;
}
$templine = '';
}
}
}
echo PHP_EOL . " Done! " . PHP_EOL;
die();

View file

@ -1,55 +1,55 @@
<?php
global $global, $config;
if (!isset($global['systemRootPath'])) {
require_once '../videos/configuration.php';
}
require_once $global['systemRootPath'] . 'objects/bootGrid.php';
require_once $global['systemRootPath'] . 'objects/user.php';
class Channel
{
public static function getChannels($activeOnly = true, $FIND_IN_SET = "")
{
global $global;
$sql = "SELECT u.*, "
. " (SELECT count(v.id) FROM videos v where v.users_id = u.id) as total_videos "
. " FROM users u "
. " HAVING total_videos > 0 ";
if ($activeOnly) {
$sql .= " AND u.status = 'a' ";
}
$sql .= BootGrid::getSqlFromPost(array('user', 'about', 'channelName', 'u.name', 'u.email'), "", "", false, $FIND_IN_SET);
$res = sqlDAL::readSql($sql);
$fullResult = sqlDAL::fetchAllAssoc($res);
sqlDAL::close($res);
$subscribe = array();
if ($res != false) {
foreach ($fullResult as $row) {
$row = cleanUpRowFromDatabase($row);
$subscribe[] = $row;
}
} else {
$subscribe = false;
die($sql . '\nError : (' . $global['mysqli']->errno . ') ' . $global['mysqli']->error);
}
return $subscribe;
}
public static function getTotalChannels($activeOnly=true)
{
global $global;
$sql = "SELECT count(*) as total "
. " FROM users u "
. " WHERE (SELECT count(v.id) FROM videos v where v.users_id = u.id) > 0 ";
if ($activeOnly) {
$sql .= " AND u.status = 'a' ";
}
$sql .= BootGrid::getSqlFromPost(array('user', 'about'));
$res = sqlDAL::readSql($sql);
$data = sqlDAL::fetchAssoc($res);
sqlDAL::close($res);
return $res ? intval($data['total']) : 0;
}
}
<?php
global $global, $config;
if (!isset($global['systemRootPath'])) {
require_once '../videos/configuration.php';
}
require_once $global['systemRootPath'] . 'objects/bootGrid.php';
require_once $global['systemRootPath'] . 'objects/user.php';
class Channel
{
public static function getChannels($activeOnly = true, $FIND_IN_SET = "")
{
global $global;
$sql = "SELECT u.*, "
. " (SELECT count(v.id) FROM videos v where v.users_id = u.id) as total_videos "
. " FROM users u "
. " HAVING total_videos > 0 ";
if ($activeOnly) {
$sql .= " AND u.status = 'a' ";
}
$sql .= BootGrid::getSqlFromPost(['user', 'about', 'channelName', 'u.name', 'u.email'], "", "", false, $FIND_IN_SET);
$res = sqlDAL::readSql($sql);
$fullResult = sqlDAL::fetchAllAssoc($res);
sqlDAL::close($res);
$subscribe = [];
if ($res != false) {
foreach ($fullResult as $row) {
$row = cleanUpRowFromDatabase($row);
$subscribe[] = $row;
}
} else {
$subscribe = false;
die($sql . '\nError : (' . $global['mysqli']->errno . ') ' . $global['mysqli']->error);
}
return $subscribe;
}
public static function getTotalChannels($activeOnly=true)
{
global $global;
$sql = "SELECT count(*) as total "
. " FROM users u "
. " WHERE (SELECT count(v.id) FROM videos v where v.users_id = u.id) > 0 ";
if ($activeOnly) {
$sql .= " AND u.status = 'a' ";
}
$sql .= BootGrid::getSqlFromPost(['user', 'about']);
$res = sqlDAL::readSql($sql);
$data = sqlDAL::fetchAssoc($res);
sqlDAL::close($res);
return $res ? intval($data['total']) : 0;
}
}

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load diff

View file

@ -1,223 +1,224 @@
<?php
header('Access-Control-Allow-Origin: *');
header('Content-Type: application/json');
$obj = new stdClass();
$obj->error = true;
global $global, $config;
if (!isset($global['systemRootPath'])) {
require_once '../videos/configuration.php';
}
if (empty($_POST)) {
$obj->msg = __("Your POST data is empty, maybe your video file is too big for the host");
_error_log($obj->msg);
die(json_encode($obj));
}
_error_log("aVideoEncoder.json: start");
if (empty($_POST['format']) || !in_array($_POST['format'], $global['allowedExtension'])) {
_error_log("aVideoEncoder.json: Extension not allowed File " . __FILE__ . ": " . json_encode($_POST));
die();
}
if(!isset($_REQUEST['encodedPass'])){
$_REQUEST['encodedPass'] = 1;
}
useVideoHashOrLogin();
if (!User::canUpload()) {
_error_log("aVideoEncoder.json: Permission denied to receive a file: " . json_encode($_REQUEST));
$obj->msg = __("Permission denied to receive a file: ") . json_encode($_POST);
_error_log($obj->msg);
die(json_encode($obj));
}
if (!empty($_POST['videos_id']) && !Video::canEdit($_POST['videos_id'])) {
_error_log("aVideoEncoder.json: Permission denied to edit a video: " . json_encode($_POST));
$obj->msg = __("Permission denied to edit a video: ") . json_encode($_POST);
_error_log($obj->msg);
die(json_encode($obj));
}
_error_log("aVideoEncoder.json: start to receive: " . json_encode($_POST));
// check if there is en video id if yes update if is not create a new one
$video = new Video("", "", @$_POST['videos_id']);
if(!empty($video->getId()) && !empty($_REQUEST['first_request'])){
_error_log("aVideoEncoder.json: There is a new video to replace the existing one, we will delete the current files videos_id = ".$video->getId());
$video->removeVideoFiles();
}
$obj->video_id = @$_POST['videos_id'];
$title = $video->getTitle();
$description = $video->getDescription();
if (empty($title) && !empty($_POST['title'])) {
$title = $video->setTitle($_POST['title']);
} elseif (empty($title)) {
$video->setTitle("Automatic Title");
}
if (empty($description)) {
$video->setDescription($_POST['description']);
}
if(!empty($_REQUEST['duration'])){
$duration = $video->getDuration();
if(empty($duration) || $duration === 'EE:EE:EE'){
$video->setDuration($_REQUEST['duration']);
}
}
$status = $video->setAutoStatus();
$video->setVideoDownloadedLink($_POST['videoDownloadedLink']);
_error_log("aVideoEncoder.json: Encoder receiving post " . json_encode($_POST));
//_error_log(print_r($_POST, true));
if (preg_match("/(mp3|wav|ogg)$/i", $_POST['format'])) {
$type = 'audio';
$video->setType($type);
} elseif (preg_match("/(mp4|webm|zip)$/i", $_POST['format'])) {
$type = 'video';
$video->setType($type);
}
$videoFileName = $video->getFilename();
if (empty($videoFileName)) {
$paths = Video::getNewVideoFilename();
$filename = $paths['filename'];
$videoFileName = $video->setFilename($videoFileName);
}
$paths = Video::getPaths($videoFileName, true);
$destination_local = "{$paths['path']}{$videoFileName}";
if (!empty($_FILES)) {
_error_log("aVideoEncoder.json: Files " . json_encode($_FILES));
} else {
_error_log("aVideoEncoder.json: Files EMPTY");
if (!empty($_REQUEST['downloadURL'])) {
$_FILES['video']['tmp_name'] = downloadVideoFromDownloadURL($_REQUEST['downloadURL']);
if (empty($_FILES['video']['tmp_name'])) {
_error_log("aVideoEncoder.json: ******** Download ERROR " . $_REQUEST['downloadURL']);
}
}
}
if (!empty($_FILES['video']['error'])) {
$phpFileUploadErrors = array(
0 => 'There is no error, the file uploaded with success',
1 => 'The uploaded file exceeds the upload_max_filesize directive in php.ini',
2 => 'The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form',
3 => 'The uploaded file was only partially uploaded',
4 => 'No file was uploaded',
6 => 'Missing a temporary folder',
7 => 'Failed to write file to disk.',
8 => 'A PHP extension stopped the file upload.',
);
_error_log("aVideoEncoder.json: ******** Files ERROR " . $phpFileUploadErrors[$_FILES['video']['error']]);
if (!empty($_POST['downloadURL'])) {
$_FILES['video']['tmp_name'] = downloadVideoFromDownloadURL($_POST['downloadURL']);
}
}
if (empty($_FILES['video']['tmp_name']) && !empty($_POST['chunkFile'])) {
$_FILES['video']['tmp_name'] = $_POST['chunkFile'];
}
// get video file from encoder
if (!empty($_FILES['video']['tmp_name'])) {
$resolution = "";
if (!empty($_POST['resolution'])) {
$resolution = "_{$_POST['resolution']}";
}
$filename = "{$videoFileName}{$resolution}.{$_POST['format']}";
$fsize = filesize($_FILES['video']['tmp_name']);
_error_log("aVideoEncoder.json: receiving video upload to {$filename} filesize=" . ($fsize) . " (" . humanFileSize($fsize) . ")" . json_encode($_FILES));
$destinationFile = decideMoveUploadedToVideos($_FILES['video']['tmp_name'], $filename);
} else {
// set encoding
$video->setStatus(Video::$statusEncoding);
}
if (!empty($_FILES['image']['tmp_name']) && !file_exists("{$destination_local}.jpg")) {
if (!move_uploaded_file($_FILES['image']['tmp_name'], "{$destination_local}.jpg")) {
$obj->msg = print_r(sprintf(__("Could not move image file [%s.jpg]"), $destination_local), true);
_error_log("aVideoEncoder.json: " . $obj->msg);
die(json_encode($obj));
}
}
if (!empty($_FILES['gifimage']['tmp_name']) && !file_exists("{$destination_local}.gif")) {
if (!move_uploaded_file($_FILES['gifimage']['tmp_name'], "{$destination_local}.gif")) {
$obj->msg = print_r(sprintf(__("Could not move gif image file [%s.gif]"), $destination_local), true);
_error_log("aVideoEncoder.json: " . $obj->msg);
die(json_encode($obj));
}
}
if (!empty($_POST['encoderURL'])) {
$video->setEncoderURL($_POST['encoderURL']);
}
if (!empty($_POST['categories_id'])) {
$video->setCategories_id($_POST['categories_id']);
}
$video_id = $video->save();
$video->updateDurationIfNeed();
$video->updateHLSDurationIfNeed();
if (!empty($_POST['usergroups_id'])) {
if (!is_array($_POST['usergroups_id'])) {
$_POST['usergroups_id'] = array($_POST['usergroups_id']);
}
UserGroups::updateVideoGroups($video_id, $_POST['usergroups_id']);
}
$obj->error = false;
$obj->video_id = $video_id;
$v = new Video('', '', $video_id);
$obj->video_id_hash = $v->getVideoIdHash();
_error_log("aVideoEncoder.json: Files Received for video {$video_id}: " . $video->getTitle());
if(!empty($destinationFile)){
if(file_exists($destinationFile)){
_error_log("aVideoEncoder.json: Success $destinationFile ");
}else{
_error_log("aVideoEncoder.json: ERROR $destinationFile ");
}
}
die(json_encode($obj));
/*
_error_log(print_r($_POST, true));
_error_log(print_r($_FILES, true));
var_dump($_POST, $_FILES);
*/
function downloadVideoFromDownloadURL($downloadURL){
global $global;
_error_log("aVideoEncoder.json: Try to download " . $downloadURL);
$file = url_get_contents($_POST['downloadURL']);
$strlen = strlen($file);
if ($strlen<20000) {
//it is not a video
return false;
}
_error_log("aVideoEncoder.json: Got the download " . $downloadURL . ' '. humanFileSize($strlen));
if ($file) {
$_FILES['video']['name'] = basename($downloadURL);
$temp = Video::getStoragePath()."cache/tmpFile/" . $_FILES['video']['name'];
make_path($temp);
$bytesSaved = file_put_contents($temp, $file);
if($bytesSaved){
_error_log("aVideoEncoder.json: saved " . $temp . ' '. humanFileSize($bytesSaved));
return $temp;
}else{
_error_log("aVideoEncoder.json: ERROR on save file " . $temp );
}
}
return false;
}
<?php
header('Access-Control-Allow-Origin: *');
header('Content-Type: application/json');
$obj = new stdClass();
$obj->error = true;
global $global, $config;
if (!isset($global['systemRootPath'])) {
require_once '../videos/configuration.php';
}
if (empty($_POST)) {
$obj->msg = __("Your POST data is empty, maybe your video file is too big for the host");
_error_log($obj->msg);
die(json_encode($obj));
}
_error_log("aVideoEncoder.json: start");
if (empty($_POST['format']) || !in_array($_POST['format'], $global['allowedExtension'])) {
_error_log("aVideoEncoder.json: Extension not allowed File " . __FILE__ . ": " . json_encode($_POST));
die();
}
if (!isset($_REQUEST['encodedPass'])) {
$_REQUEST['encodedPass'] = 1;
}
useVideoHashOrLogin();
if (!User::canUpload()) {
_error_log("aVideoEncoder.json: Permission denied to receive a file: " . json_encode($_REQUEST));
$obj->msg = __("Permission denied to receive a file: ") . json_encode($_POST);
_error_log($obj->msg);
die(json_encode($obj));
}
if (!empty($_POST['videos_id']) && !Video::canEdit($_POST['videos_id'])) {
_error_log("aVideoEncoder.json: Permission denied to edit a video: " . json_encode($_POST));
$obj->msg = __("Permission denied to edit a video: ") . json_encode($_POST);
_error_log($obj->msg);
die(json_encode($obj));
}
_error_log("aVideoEncoder.json: start to receive: " . json_encode($_POST));
// check if there is en video id if yes update if is not create a new one
$video = new Video("", "", @$_POST['videos_id']);
if (!empty($video->getId()) && !empty($_REQUEST['first_request'])) {
_error_log("aVideoEncoder.json: There is a new video to replace the existing one, we will delete the current files videos_id = ".$video->getId());
$video->removeVideoFiles();
}
$obj->video_id = @$_POST['videos_id'];
$title = $video->getTitle();
$description = $video->getDescription();
if (empty($title) && !empty($_POST['title'])) {
$title = $video->setTitle($_POST['title']);
} elseif (empty($title)) {
$video->setTitle("Automatic Title");
}
if (empty($description)) {
$video->setDescription($_POST['description']);
}
if (!empty($_REQUEST['duration'])) {
$duration = $video->getDuration();
if (empty($duration) || $duration === 'EE:EE:EE') {
$video->setDuration($_REQUEST['duration']);
}
}
$status = $video->setAutoStatus();
$video->setVideoDownloadedLink($_POST['videoDownloadedLink']);
_error_log("aVideoEncoder.json: Encoder receiving post " . json_encode($_POST));
//_error_log(print_r($_POST, true));
if (preg_match("/(mp3|wav|ogg)$/i", $_POST['format'])) {
$type = 'audio';
$video->setType($type);
} elseif (preg_match("/(mp4|webm|zip)$/i", $_POST['format'])) {
$type = 'video';
$video->setType($type);
}
$videoFileName = $video->getFilename();
if (empty($videoFileName)) {
$paths = Video::getNewVideoFilename();
$filename = $paths['filename'];
$videoFileName = $video->setFilename($videoFileName);
}
$paths = Video::getPaths($videoFileName, true);
$destination_local = "{$paths['path']}{$videoFileName}";
if (!empty($_FILES)) {
_error_log("aVideoEncoder.json: Files " . json_encode($_FILES));
} else {
_error_log("aVideoEncoder.json: Files EMPTY");
if (!empty($_REQUEST['downloadURL'])) {
$_FILES['video']['tmp_name'] = downloadVideoFromDownloadURL($_REQUEST['downloadURL']);
if (empty($_FILES['video']['tmp_name'])) {
_error_log("aVideoEncoder.json: ******** Download ERROR " . $_REQUEST['downloadURL']);
}
}
}
if (!empty($_FILES['video']['error'])) {
$phpFileUploadErrors = [
0 => 'There is no error, the file uploaded with success',
1 => 'The uploaded file exceeds the upload_max_filesize directive in php.ini',
2 => 'The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form',
3 => 'The uploaded file was only partially uploaded',
4 => 'No file was uploaded',
6 => 'Missing a temporary folder',
7 => 'Failed to write file to disk.',
8 => 'A PHP extension stopped the file upload.',
];
_error_log("aVideoEncoder.json: ******** Files ERROR " . $phpFileUploadErrors[$_FILES['video']['error']]);
if (!empty($_POST['downloadURL'])) {
$_FILES['video']['tmp_name'] = downloadVideoFromDownloadURL($_POST['downloadURL']);
}
}
if (empty($_FILES['video']['tmp_name']) && !empty($_POST['chunkFile'])) {
$_FILES['video']['tmp_name'] = $_POST['chunkFile'];
}
// get video file from encoder
if (!empty($_FILES['video']['tmp_name'])) {
$resolution = '';
if (!empty($_POST['resolution'])) {
$resolution = "_{$_POST['resolution']}";
}
$filename = "{$videoFileName}{$resolution}.{$_POST['format']}";
$fsize = filesize($_FILES['video']['tmp_name']);
_error_log("aVideoEncoder.json: receiving video upload to {$filename} filesize=" . ($fsize) . " (" . humanFileSize($fsize) . ")" . json_encode($_FILES));
$destinationFile = decideMoveUploadedToVideos($_FILES['video']['tmp_name'], $filename);
} else {
// set encoding
$video->setStatus(Video::$statusEncoding);
}
if (!empty($_FILES['image']['tmp_name']) && !file_exists("{$destination_local}.jpg")) {
if (!move_uploaded_file($_FILES['image']['tmp_name'], "{$destination_local}.jpg")) {
$obj->msg = print_r(sprintf(__("Could not move image file [%s.jpg]"), $destination_local), true);
_error_log("aVideoEncoder.json: " . $obj->msg);
die(json_encode($obj));
}
}
if (!empty($_FILES['gifimage']['tmp_name']) && !file_exists("{$destination_local}.gif")) {
if (!move_uploaded_file($_FILES['gifimage']['tmp_name'], "{$destination_local}.gif")) {
$obj->msg = print_r(sprintf(__("Could not move gif image file [%s.gif]"), $destination_local), true);
_error_log("aVideoEncoder.json: " . $obj->msg);
die(json_encode($obj));
}
}
if (!empty($_POST['encoderURL'])) {
$video->setEncoderURL($_POST['encoderURL']);
}
if (!empty($_POST['categories_id'])) {
$video->setCategories_id($_POST['categories_id']);
}
$video_id = $video->save();
$video->updateDurationIfNeed();
$video->updateHLSDurationIfNeed();
if (!empty($_POST['usergroups_id'])) {
if (!is_array($_POST['usergroups_id'])) {
$_POST['usergroups_id'] = [$_POST['usergroups_id']];
}
UserGroups::updateVideoGroups($video_id, $_POST['usergroups_id']);
}
$obj->error = false;
$obj->video_id = $video_id;
$v = new Video('', '', $video_id);
$obj->video_id_hash = $v->getVideoIdHash();
_error_log("aVideoEncoder.json: Files Received for video {$video_id}: " . $video->getTitle());
if (!empty($destinationFile)) {
if (file_exists($destinationFile)) {
_error_log("aVideoEncoder.json: Success $destinationFile ");
} else {
_error_log("aVideoEncoder.json: ERROR $destinationFile ");
}
}
die(json_encode($obj));
/*
_error_log(print_r($_POST, true));
_error_log(print_r($_FILES, true));
var_dump($_POST, $_FILES);
*/
function downloadVideoFromDownloadURL($downloadURL)
{
global $global;
_error_log("aVideoEncoder.json: Try to download " . $downloadURL);
$file = url_get_contents($_POST['downloadURL']);
$strlen = strlen($file);
if ($strlen<20000) {
//it is not a video
return false;
}
_error_log("aVideoEncoder.json: Got the download " . $downloadURL . ' '. humanFileSize($strlen));
if ($file) {
$_FILES['video']['name'] = basename($downloadURL);
$temp = Video::getStoragePath()."cache/tmpFile/" . $_FILES['video']['name'];
make_path($temp);
$bytesSaved = file_put_contents($temp, $file);
if ($bytesSaved) {
_error_log("aVideoEncoder.json: saved " . $temp . ' '. humanFileSize($bytesSaved));
return $temp;
} else {
_error_log("aVideoEncoder.json: ERROR on save file " . $temp);
}
}
return false;
}

View file

@ -1,25 +1,25 @@
<?php
header('Access-Control-Allow-Origin: *');
header('Content-Type: application/json');
$obj = new stdClass();
$obj->file = tempnam(sys_get_temp_dir(), 'YTPChunk_');
$putdata = fopen("php://input", "r");
$fp = fopen($obj->file, "w");
error_log("aVideoEncoderChunk.json.php: start {$obj->file} ");
while ($data = fread($putdata, 1024 * 1024))
fwrite($fp, $data);
fclose($fp);
fclose($putdata);
sleep(1);
$obj->filesize = filesize($obj->file);
$json = json_encode($obj);
error_log("aVideoEncoderChunk.json.php: {$json} ");
die($json);
<?php
header('Access-Control-Allow-Origin: *');
header('Content-Type: application/json');
$obj = new stdClass();
$obj->file = tempnam(sys_get_temp_dir(), 'YTPChunk_');
$putdata = fopen("php://input", "r");
$fp = fopen($obj->file, "w");
error_log("aVideoEncoderChunk.json.php: start {$obj->file} ");
while ($data = fread($putdata, 1024 * 1024)) {
fwrite($fp, $data);
}
fclose($fp);
fclose($putdata);
sleep(1);
$obj->filesize = filesize($obj->file);
$json = json_encode($obj);
error_log("aVideoEncoderChunk.json.php: {$json} ");
die($json);

View file

@ -1,72 +1,71 @@
<?php
header('Access-Control-Allow-Origin: *');
header('Content-Type: application/json');
$obj = new stdClass();
$obj->error = true;
global $global, $config;
if(!isset($global['systemRootPath'])){
require_once '../videos/configuration.php';
}
require_once $global['systemRootPath'] . 'objects/user.php';
require_once $global['systemRootPath'] . 'objects/video.php';
$_POST['videos_id'] = intval($_POST['videos_id']);
if (empty($_POST)) {
$obj->msg = __("Your POST data is empty, maybe your video file is too big for the host");
_error_log($obj->msg);
die(json_encode($obj));
}
useVideoHashOrLogin();
if (!User::canUpload()) {
$obj->msg = __("Permission denied to Notify Done: ") . print_r($_POST, true);
_error_log($obj->msg);
die(json_encode($obj));
}
if(!Video::canEdit($_POST['videos_id'])){
$obj->msg = __("Permission denied to edit a video: ") . print_r($_POST, true);
_error_log($obj->msg);
die(json_encode($obj));
}
Video::clearCache($_POST['videos_id']);
// check if there is en video id if yes update if is not create a new one
$video = new Video("", "", $_POST['videos_id']);
$obj->video_id = $_POST['videos_id'];
$video->setAutoStatus(Video::$statusActive);
$video_id = $video->save();
$video = new Video("", "", $video_id);
if($video->getType() == 'audio' && AVideoPlugin::isEnabledByName('MP4ThumbsAndGif')){
$videoFileName = $video->getFilename();
MP4ThumbsAndGif::getImage($videoFileName, 'jpg', $video_id);
Video::deleteThumbs($videoFileName);
Video::deleteGifAndWebp($videoFileName);
}
$obj->error = false;
$obj->video_id = $video_id;
Video::updateFilesize($video_id);
// delete original files if any
$originalFilePath = Video::getStoragePath()."original_" . $video->getFilename();
if(file_exists($originalFilePath)){
unlink($originalFilePath);
}
_error_log("Video is done notified {$video_id}: " . $video->getTitle());
Video::clearCache($video_id);
AVideoPlugin::onEncoderNotifyIsDone($video_id);
AVideoPlugin::afterNewVideo($video_id);
die(json_encode($obj));
/*
_error_log(print_r($_POST, true));
_error_log(print_r($_FILES, true));
var_dump($_POST, $_FILES);
*/
<?php
header('Access-Control-Allow-Origin: *');
header('Content-Type: application/json');
$obj = new stdClass();
$obj->error = true;
global $global, $config;
if (!isset($global['systemRootPath'])) {
require_once '../videos/configuration.php';
}
require_once $global['systemRootPath'] . 'objects/user.php';
require_once $global['systemRootPath'] . 'objects/video.php';
$_POST['videos_id'] = intval($_POST['videos_id']);
if (empty($_POST)) {
$obj->msg = __("Your POST data is empty, maybe your video file is too big for the host");
_error_log($obj->msg);
die(json_encode($obj));
}
useVideoHashOrLogin();
if (!User::canUpload()) {
$obj->msg = __("Permission denied to Notify Done: ") . print_r($_POST, true);
_error_log($obj->msg);
die(json_encode($obj));
}
if (!Video::canEdit($_POST['videos_id'])) {
$obj->msg = __("Permission denied to edit a video: ") . print_r($_POST, true);
_error_log($obj->msg);
die(json_encode($obj));
}
Video::clearCache($_POST['videos_id']);
// check if there is en video id if yes update if is not create a new one
$video = new Video("", "", $_POST['videos_id']);
$obj->video_id = $_POST['videos_id'];
$video->setAutoStatus(Video::$statusActive);
$video_id = $video->save();
$video = new Video("", "", $video_id);
if ($video->getType() == 'audio' && AVideoPlugin::isEnabledByName('MP4ThumbsAndGif')) {
$videoFileName = $video->getFilename();
MP4ThumbsAndGif::getImage($videoFileName, 'jpg', $video_id);
Video::deleteThumbs($videoFileName);
Video::deleteGifAndWebp($videoFileName);
}
$obj->error = false;
$obj->video_id = $video_id;
Video::updateFilesize($video_id);
// delete original files if any
$originalFilePath = Video::getStoragePath()."original_" . $video->getFilename();
if (file_exists($originalFilePath)) {
unlink($originalFilePath);
}
_error_log("Video is done notified {$video_id}: " . $video->getTitle());
Video::clearCache($video_id);
AVideoPlugin::onEncoderNotifyIsDone($video_id);
AVideoPlugin::afterNewVideo($video_id);
die(json_encode($obj));
/*
_error_log(print_r($_POST, true));
_error_log(print_r($_FILES, true));
var_dump($_POST, $_FILES);
*/

View file

@ -1,180 +1,179 @@
<?php
header('Access-Control-Allow-Origin: *');
header('Content-Type: application/json');
$obj = new stdClass();
$obj->error = true;
global $global, $config;
if (!isset($global['systemRootPath'])) {
require_once '../videos/configuration.php';
}
/*
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
*/
if (empty($_POST)) {
$obj->msg = __("Your POST data is empty, maybe your video file is too big for the host");
_error_log("ReceiveImage: " . $obj->msg);
die(json_encode($obj));
}
useVideoHashOrLogin();
if (!User::canUpload()) {
$obj->msg = __("Permission denied to receive a file: " . json_encode($_POST));
_error_log("ReceiveImage: " . $obj->msg);
die(json_encode($obj));
}
if (!Video::canEdit($_POST['videos_id'])) {
$obj->msg = __("Permission denied to edit a video: " . json_encode($_POST));
_error_log("ReceiveImage: " . $obj->msg);
die(json_encode($obj));
}
_error_log("ReceiveImage: Start receiving image " . json_encode($_FILES) . "" . json_encode($_POST));
// check if there is en video id if yes update if is not create a new one
$video = new Video("", "", $_POST['videos_id']);
$obj->video_id = $_POST['videos_id'];
$videoFileName = $video->getFilename();
$paths = Video::getPaths($videoFileName, true);
$destination_local = "{$paths['path']}{$videoFileName}";
_error_log("ReceiveImage: videoFilename = [$videoFileName] destination_local = {$destination_local} Encoder receiving post " . json_encode($_FILES));
$obj->jpgDest = "{$destination_local}.jpg";
if(!empty($_REQUEST['downloadURL_image']) ){
$content = url_get_contents($_REQUEST['downloadURL_image']);
$obj->jpgDestSize = _file_put_contents($obj->jpgDest, $content);
_error_log("ReceiveImage: download {$_REQUEST['downloadURL_image']} to {$obj->jpgDest} ". humanFileSize($obj->jpgDestSize));
} else if (!empty($_FILES['image']['tmp_name']) && (!empty($_REQUEST['update_video_id']) || !file_exists($obj->jpgDest) || filesize($obj->jpgDest) === 42342)) {
if (!move_uploaded_file($_FILES['image']['tmp_name'], $obj->jpgDest)) {
if(!rename($_FILES['image']['tmp_name'], $obj->jpgDest)){
if(!copy($_FILES['image']['tmp_name'], $obj->jpgDest)){
if(!file_exists($_FILES['image']['tmp_name'])){
$obj->msg = print_r(sprintf(__("Could not move image file because it does not exits %s => [%s]"), $_FILES['image']['tmp_name'], $obj->jpgDest), true);
}else{
$obj->msg = print_r(sprintf(__("Could not move image file %s => [%s]"), $_FILES['image']['tmp_name'], $obj->jpgDest), true);
}
_error_log("ReceiveImage: " . $obj->msg);
die(json_encode($obj));
}
}
} else {
$obj->jpgDestSize = humanFileSize(filesize($obj->jpgDest));
}
} else {
if (empty($_FILES['image']['tmp_name'])) {
_error_log("ReceiveImage: empty \$_FILES['image']['tmp_name'] " . json_encode($_FILES));
}
if (file_exists($obj->jpgDest)) {
_error_log("ReceiveImage: File already exists " . $obj->jpgDest);
if (filesize($obj->jpgDest) !== 42342) {
_error_log("ReceiveImage: file is not an error image " . filesize($obj->jpgDest));
}
}
}
if(!empty($_REQUEST['downloadURL_spectrumimage']) ){
$content = url_get_contents($_REQUEST['downloadURL_spectrumimage']);
$obj->jpgSpectrumDestSize = _file_put_contents($obj->jpgSpectrumDest, $content);
_error_log("ReceiveImage: download {$_REQUEST['downloadURL_spectrumimage']} {$obj->jpgDestSize}");
} else if (!empty($_FILES['spectrumimage']['tmp_name'])) {
$obj->jpgSpectrumDest = "{$destination_local}_spectrum.jpg";
if ((!empty($_REQUEST['update_video_id']) || !file_exists($obj->jpgSpectrumDest) || filesize($obj->jpgSpectrumDest) === 42342)) {
if (!move_uploaded_file($_FILES['spectrumimage']['tmp_name'], $obj->jpgSpectrumDest)) {
$obj->msg = print_r(sprintf(__("Could not move image file [%s.jpg]"), $destination_local), true);
_error_log("ReceiveImage: " . $obj->msg);
die(json_encode($obj));
} else {
$obj->jpgSpectrumDestSize = humanFileSize(filesize($obj->jpgSpectrumDest));
}
} else {
if (empty($_FILES['spectrumimage']['tmp_name'])) {
_error_log("ReceiveImage: empty \$_FILES['spectrumimage']['tmp_name'] " . json_encode($_FILES));
}
if (file_exists($obj->jpgSpectrumDest)) {
_error_log("ReceiveImage: File already exists " . $obj->jpgDest);
if (filesize($obj->jpgSpectrumDestSize) !== 42342) {
_error_log("ReceiveImage: file is not an error image " . filesize($obj->jpgDest));
}
}
}
}
$obj->gifDest = "{$destination_local}.gif";
if(!empty($_REQUEST['downloadURL_gifimage']) ){
$content = url_get_contents($_REQUEST['downloadURL_gifimage']);
$obj->gifDestSize = file_put_contents($obj->gifDest, $content);
_error_log("ReceiveImage: download {$_REQUEST['downloadURL_gifimage']} {$obj->gifDestSize}");
} else if (!empty($_FILES['gifimage']['tmp_name']) && (!empty($_REQUEST['update_video_id']) || !file_exists($obj->gifDest) || filesize($obj->gifDest) === 2095341)) {
if (!move_uploaded_file($_FILES['gifimage']['tmp_name'], $obj->gifDest)) {
$obj->msg = print_r(sprintf(__("Could not move gif image file [%s.gif]"), $destination_local), true);
_error_log("ReceiveImage: " . $obj->msg);
die(json_encode($obj));
} else {
$obj->gifDestSize = humanFileSize(filesize($obj->gifDest));
}
} else {
if (empty($_FILES['gifimage']['tmp_name'])) {
_error_log("ReceiveImage: empty \$_FILES['gifimage']['tmp_name'] " . json_encode($_FILES));
}
if (file_exists($obj->gifDest)) {
_error_log("ReceiveImage: File already exists " . $obj->gifDest);
if (filesize($obj->gifDest) !== 42342) {
_error_log("ReceiveImage: file is not an error image " . filesize($obj->gifDest));
}
}
}
$obj->webpDest = "{$destination_local}.webp";
if(!empty($_REQUEST['downloadURL_webpimage']) ){
$content = url_get_contents($_REQUEST['downloadURL_webpimage']);
$obj->webpDestSize = file_put_contents($obj->webpDest, $content);
_error_log("ReceiveImage: download {$_REQUEST['downloadURL_webpimage']} {$obj->webpDestSize}");
} else if (!empty($_FILES['webpimage']['tmp_name']) && (!empty($_REQUEST['update_video_id']) || !file_exists($obj->webpDest) || filesize($obj->webpDest) === 2095341)) {
if (!move_uploaded_file($_FILES['webpimage']['tmp_name'], $obj->webpDest)) {
$obj->msg = print_r(sprintf(__("Could not move webp image file [%s.webp]"), $destination_local), true);
_error_log("ReceiveImage: " . $obj->msg);
die(json_encode($obj));
} else {
$obj->webpDestSize = humanFileSize(filesize($obj->webpDest));
}
} else {
if (empty($_FILES['webpimage']['tmp_name'])) {
_error_log("ReceiveImage: empty \$_FILES['webpimage']['tmp_name'] " . json_encode($_FILES));
}
if (file_exists($obj->webpDest)) {
_error_log("ReceiveImage: File already exists " . $obj->webpDest);
if (filesize($obj->webpDest) !== 42342) {
_error_log("ReceiveImage: file is not an error image " . filesize($obj->webpDest));
}
}
}
if (!empty($_REQUEST['duration'])) {
$duration = $video->getDuration();
if (empty($duration) || $duration === 'EE:EE:EE') {
$video->setDuration($_REQUEST['duration']);
}
}
$videos_id = $video->save();
Video::clearCache($videos_id);
AVideoPlugin::onEncoderReceiveImage($videos_id);
$obj->error = false;
$obj->video_id = $videos_id;
$v = new Video('', '', $videos_id);
$obj->video_id_hash = $v->getVideoIdHash();
$json = json_encode($obj);
_error_log("ReceiveImage: Files Received for video {$videos_id}: " . $video->getTitle() . " {$json}");
die($json);
/*
_error_log(json_encode($_POST));
_error_log(json_encode($_FILES));
var_dump($_POST, $_FILES);
*/
<?php
header('Access-Control-Allow-Origin: *');
header('Content-Type: application/json');
$obj = new stdClass();
$obj->error = true;
global $global, $config;
if (!isset($global['systemRootPath'])) {
require_once '../videos/configuration.php';
}
/*
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
*/
if (empty($_POST)) {
$obj->msg = __("Your POST data is empty, maybe your video file is too big for the host");
_error_log("ReceiveImage: " . $obj->msg);
die(json_encode($obj));
}
useVideoHashOrLogin();
if (!User::canUpload()) {
$obj->msg = __("Permission denied to receive a file: " . json_encode($_POST));
_error_log("ReceiveImage: " . $obj->msg);
die(json_encode($obj));
}
if (!Video::canEdit($_POST['videos_id'])) {
$obj->msg = __("Permission denied to edit a video: " . json_encode($_POST));
_error_log("ReceiveImage: " . $obj->msg);
die(json_encode($obj));
}
_error_log("ReceiveImage: Start receiving image " . json_encode($_FILES) . "" . json_encode($_POST));
// check if there is en video id if yes update if is not create a new one
$video = new Video("", "", $_POST['videos_id']);
$obj->video_id = $_POST['videos_id'];
$videoFileName = $video->getFilename();
$paths = Video::getPaths($videoFileName, true);
$destination_local = "{$paths['path']}{$videoFileName}";
_error_log("ReceiveImage: videoFilename = [$videoFileName] destination_local = {$destination_local} Encoder receiving post " . json_encode($_FILES));
$obj->jpgDest = "{$destination_local}.jpg";
if (!empty($_REQUEST['downloadURL_image'])) {
$content = url_get_contents($_REQUEST['downloadURL_image']);
$obj->jpgDestSize = _file_put_contents($obj->jpgDest, $content);
_error_log("ReceiveImage: download {$_REQUEST['downloadURL_image']} to {$obj->jpgDest} ". humanFileSize($obj->jpgDestSize));
} elseif (!empty($_FILES['image']['tmp_name']) && (!empty($_REQUEST['update_video_id']) || !file_exists($obj->jpgDest) || filesize($obj->jpgDest) === 42342)) {
if (!move_uploaded_file($_FILES['image']['tmp_name'], $obj->jpgDest)) {
if (!rename($_FILES['image']['tmp_name'], $obj->jpgDest)) {
if (!copy($_FILES['image']['tmp_name'], $obj->jpgDest)) {
if (!file_exists($_FILES['image']['tmp_name'])) {
$obj->msg = print_r(sprintf(__("Could not move image file because it does not exits %s => [%s]"), $_FILES['image']['tmp_name'], $obj->jpgDest), true);
} else {
$obj->msg = print_r(sprintf(__("Could not move image file %s => [%s]"), $_FILES['image']['tmp_name'], $obj->jpgDest), true);
}
_error_log("ReceiveImage: " . $obj->msg);
die(json_encode($obj));
}
}
} else {
$obj->jpgDestSize = humanFileSize(filesize($obj->jpgDest));
}
} else {
if (empty($_FILES['image']['tmp_name'])) {
_error_log("ReceiveImage: empty \$_FILES['image']['tmp_name'] " . json_encode($_FILES));
}
if (file_exists($obj->jpgDest)) {
_error_log("ReceiveImage: File already exists " . $obj->jpgDest);
if (filesize($obj->jpgDest) !== 42342) {
_error_log("ReceiveImage: file is not an error image " . filesize($obj->jpgDest));
}
}
}
if (!empty($_REQUEST['downloadURL_spectrumimage'])) {
$content = url_get_contents($_REQUEST['downloadURL_spectrumimage']);
$obj->jpgSpectrumDestSize = _file_put_contents($obj->jpgSpectrumDest, $content);
_error_log("ReceiveImage: download {$_REQUEST['downloadURL_spectrumimage']} {$obj->jpgDestSize}");
} elseif (!empty($_FILES['spectrumimage']['tmp_name'])) {
$obj->jpgSpectrumDest = "{$destination_local}_spectrum.jpg";
if ((!empty($_REQUEST['update_video_id']) || !file_exists($obj->jpgSpectrumDest) || filesize($obj->jpgSpectrumDest) === 42342)) {
if (!move_uploaded_file($_FILES['spectrumimage']['tmp_name'], $obj->jpgSpectrumDest)) {
$obj->msg = print_r(sprintf(__("Could not move image file [%s.jpg]"), $destination_local), true);
_error_log("ReceiveImage: " . $obj->msg);
die(json_encode($obj));
} else {
$obj->jpgSpectrumDestSize = humanFileSize(filesize($obj->jpgSpectrumDest));
}
} else {
if (empty($_FILES['spectrumimage']['tmp_name'])) {
_error_log("ReceiveImage: empty \$_FILES['spectrumimage']['tmp_name'] " . json_encode($_FILES));
}
if (file_exists($obj->jpgSpectrumDest)) {
_error_log("ReceiveImage: File already exists " . $obj->jpgDest);
if (filesize($obj->jpgSpectrumDestSize) !== 42342) {
_error_log("ReceiveImage: file is not an error image " . filesize($obj->jpgDest));
}
}
}
}
$obj->gifDest = "{$destination_local}.gif";
if (!empty($_REQUEST['downloadURL_gifimage'])) {
$content = url_get_contents($_REQUEST['downloadURL_gifimage']);
$obj->gifDestSize = file_put_contents($obj->gifDest, $content);
_error_log("ReceiveImage: download {$_REQUEST['downloadURL_gifimage']} {$obj->gifDestSize}");
} elseif (!empty($_FILES['gifimage']['tmp_name']) && (!empty($_REQUEST['update_video_id']) || !file_exists($obj->gifDest) || filesize($obj->gifDest) === 2095341)) {
if (!move_uploaded_file($_FILES['gifimage']['tmp_name'], $obj->gifDest)) {
$obj->msg = print_r(sprintf(__("Could not move gif image file [%s.gif]"), $destination_local), true);
_error_log("ReceiveImage: " . $obj->msg);
die(json_encode($obj));
} else {
$obj->gifDestSize = humanFileSize(filesize($obj->gifDest));
}
} else {
if (empty($_FILES['gifimage']['tmp_name'])) {
_error_log("ReceiveImage: empty \$_FILES['gifimage']['tmp_name'] " . json_encode($_FILES));
}
if (file_exists($obj->gifDest)) {
_error_log("ReceiveImage: File already exists " . $obj->gifDest);
if (filesize($obj->gifDest) !== 42342) {
_error_log("ReceiveImage: file is not an error image " . filesize($obj->gifDest));
}
}
}
$obj->webpDest = "{$destination_local}.webp";
if (!empty($_REQUEST['downloadURL_webpimage'])) {
$content = url_get_contents($_REQUEST['downloadURL_webpimage']);
$obj->webpDestSize = file_put_contents($obj->webpDest, $content);
_error_log("ReceiveImage: download {$_REQUEST['downloadURL_webpimage']} {$obj->webpDestSize}");
} elseif (!empty($_FILES['webpimage']['tmp_name']) && (!empty($_REQUEST['update_video_id']) || !file_exists($obj->webpDest) || filesize($obj->webpDest) === 2095341)) {
if (!move_uploaded_file($_FILES['webpimage']['tmp_name'], $obj->webpDest)) {
$obj->msg = print_r(sprintf(__("Could not move webp image file [%s.webp]"), $destination_local), true);
_error_log("ReceiveImage: " . $obj->msg);
die(json_encode($obj));
} else {
$obj->webpDestSize = humanFileSize(filesize($obj->webpDest));
}
} else {
if (empty($_FILES['webpimage']['tmp_name'])) {
_error_log("ReceiveImage: empty \$_FILES['webpimage']['tmp_name'] " . json_encode($_FILES));
}
if (file_exists($obj->webpDest)) {
_error_log("ReceiveImage: File already exists " . $obj->webpDest);
if (filesize($obj->webpDest) !== 42342) {
_error_log("ReceiveImage: file is not an error image " . filesize($obj->webpDest));
}
}
}
if (!empty($_REQUEST['duration'])) {
$duration = $video->getDuration();
if (empty($duration) || $duration === 'EE:EE:EE') {
$video->setDuration($_REQUEST['duration']);
}
}
$videos_id = $video->save();
Video::clearCache($videos_id);
AVideoPlugin::onEncoderReceiveImage($videos_id);
$obj->error = false;
$obj->video_id = $videos_id;
$v = new Video('', '', $videos_id);
$obj->video_id_hash = $v->getVideoIdHash();
$json = json_encode($obj);
_error_log("ReceiveImage: Files Received for video {$videos_id}: " . $video->getTitle() . " {$json}");
die($json);
/*
_error_log(json_encode($_POST));
_error_log(json_encode($_FILES));
var_dump($_POST, $_FILES);
*/

View file

@ -1,183 +1,179 @@
<?php
header('Content-Type: application/json');
$obj = new stdClass();
$obj->error = true;
global $global, $config;
if (!isset($global['systemRootPath'])) {
require_once '../videos/configuration.php';
}
require_once $global['systemRootPath'] . 'objects/user.php';
require_once $global['systemRootPath'] . 'objects/video.php';
if (!User::canUpload()) {
$obj->msg = __("Permission denied");
die(json_encode($obj));
}
// A list of permitted file extensions
$allowed = array('mp4', 'avi', 'mov', 'mkv', 'flv', 'mp3', 'm4a', 'wav', 'm4v', 'webm', 'wmv');
if (isset($_FILES['upl']) && $_FILES['upl']['error'] == 0) {
$updateVideoGroups = false;
//echo "Success: \$_FILES OK\n";
$extension = pathinfo($_FILES['upl']['name'], PATHINFO_EXTENSION);
if (!in_array(strtolower($extension), $allowed)) {
//echo '{"status":"error", "msg":"File extension error [' . $_FILES['upl']['name'] . '], we allow only (' . implode(",", $allowed) . ')"}';
status(["status" => "error"
, "msg" => "File extension error (" . $_FILES['upl']['name'] . "), we allow only (" . implode(",", $allowed) . ")"]);
exit;
}
//echo "Success: file extension OK\n";
//chack if is an audio
$type = "video";
if (strcasecmp($extension, 'mp3') == 0 || strcasecmp($extension, 'wav') == 0 || strcasecmp($extension, 'm4a') == 0) {
$type = 'audio';
}
//var_dump($extension, $type);exit;
require_once $global['systemRootPath'] . 'objects/video.php';
//echo "Starting Get Duration\n";
$duration = Video::getDurationFromFile($_FILES['upl']['tmp_name']);
// check if can upload video (about time limit storage)
if (!empty($global['videoStorageLimitMinutes'])) {
$maxDuration = $global['videoStorageLimitMinutes'] * 60;
$currentStorageUsage = getSecondsTotalVideosLength();
$thisFile = parseDurationToSeconds($duration);
$limitAfterThisFile = $currentStorageUsage + $thisFile;
if ($maxDuration < $limitAfterThisFile) {
status(["status" => "error", "msg" => "Sorry, your storage limit has run out."
. "<br>[Max Duration: {$maxDuration} Seconds]"
. "<br>[Current Srotage Usage: {$currentStorageUsage} Seconds]"
. "<br>[This File Duration: {$thisFile} Seconds]"
. "<br>[Limit after this file: {$limitAfterThisFile} Seconds]", "type" => '$_FILES Limit Error']);
if (!empty($_FILES['upl']['videoId'])) {
$video = new Video("", "", $_FILES['upl']['videoId']);
$video->delete();
}
exit;
}
}
$path_parts = pathinfo($_FILES['upl']['name']);
if (empty($path_parts['extension']) || !in_array(strtolower($path_parts['extension']), $global['allowedExtension'])) {
_error_log("Extension not allowed File " . __FILE__ . ": " . json_encode($path_parts));
die();
}
$mainName = preg_replace("/[^A-Za-z0-9]/", "", cleanString($path_parts['filename']));
$paths = Video::getNewVideoFilename();
$filename = $paths['filename'];
$originalFilePath = Video::getStoragePath()."original_" . $filename;
$video = new Video(preg_replace("/_+/", " ", $path_parts['filename']), $filename, @$_FILES['upl']['videoId']);
$video->setDuration($duration);
if ($type == 'audio') {
$video->setType($type);
} else {
$video->setType("video");
}
$video->setStatus(Video::$statusEncoding);
/*
* set visibility for private videos
*/
if (array_key_exists('videoGroups', $_FILES['upl'])) {
$video->setVideoGroups($_FILES['upl']['videoGroups']);
$updateVideoGroups = true;
}
/*
* set description (if given)
*/
if (!empty($_FILES['upl']['description'])) {
$video->setDescription($_FILES['upl']['description']);
}
/*
* set title (if given)
*/
if (!empty($_FILES['upl']['title'])) {
$video->setTitle($_FILES['upl']['title']);
$video->setClean_title($_FILES['upl']['title']);
} else {
/**
* Make a better title and clean title
*/
$videoNewTitle = $video->getTitle();
$titleParts = explode("YPTuniqid", $videoNewTitle);
$video->setTitle($titleParts[0]);
$video->setClean_title($titleParts[0]);
}
$id = $video->save($updateVideoGroups);
/**
* Copy, rename or move original file
*
* copy: used from command line when -c option is included
* rename: used with files which were downloaded directly into the videos directory (from other media sites)
* move: default, used with uploaded files
*/
if (array_key_exists('copyOriginalFile', $_FILES['upl'])) {
if (!copy($_FILES['upl']['tmp_name'], $originalFilePath)) {
die("Error on copy(" . $_FILES['upl']['tmp_name'] . ", " . $originalFilePath . ")");
}
} elseif (array_key_exists('dontMoveUploadedFile', $_FILES['upl'])) {
if (!rename($_FILES['upl']['tmp_name'], $originalFilePath)) {
die("Error on rename(" . $_FILES['upl']['tmp_name'] . ", " . $originalFilePath . ")");
}
} elseif (!move_uploaded_file($_FILES['upl']['tmp_name'], $originalFilePath)) {
if (!rename($_FILES['upl']['tmp_name'], $originalFilePath)) {
die("Error on move_uploaded_file(" . $_FILES['upl']['tmp_name'] . ", " . $originalFilePath . ")");
}
}
$video = new Video('', '', $id);
// send to encoder
$queue = array();
$postFields = array();
if ($video->getType() == 'video') {
if (AVideoPlugin::isEnabledByName("VideoHLS")) {
$postFields['inputAutoHLS'] = 1;
}else{
$postFields['inputLow'] = 1;
$postFields['inputSD'] = 1;
$postFields['inputHD'] = 1;
if (!empty($_FILES['upl']['webm']))
$postFields['webm'] = 1;
}
} else {
$postFields['audioOnly'] = 1;
$postFields['spectrum'] = 1;
}
if (!empty($_FILES['upl']['override_status']))
$postFields['override_status'] = $_FILES['upl']['override_status'];
if (!empty($_FILES['upl']['update_video_id']))
$postFields['update_video_id'] = $_FILES['upl']['update_video_id'];
$queue[] = $video->queue($postFields);
//exec("/usr/bin/php -f videoEncoder.php {$_FILES['upl']['tmp_name']} {$filename} 1> Video::getStoragePath()."{$filename}_progress.txt 2>&1", $output, $return_val);
//var_dump($output, $return_val);
//echo '{"status":"success", "msg":"Your video (' . $filename . ') is encoding <br> ' . $cmd . '", "filename":"' . $filename . '", "duration":"' . $duration . '"}';
status(["status" => "success"
, "msg" => "Your video ($filename) is queue"
, "filename" => "$filename"
, "duration" => "$duration"
, "queue" => json_encode($queue)]);
//exit;
} else {
//echo '{"status":"error", "msg":' . json_encode($_FILES) . ', "type":"$_FILES Error"}';
status(["status" => "error", "msg" => print_r($_FILES, true), "type" => '$_FILES Error']);
//exit;
}
<?php
header('Content-Type: application/json');
$obj = new stdClass();
$obj->error = true;
global $global, $config;
if (!isset($global['systemRootPath'])) {
require_once '../videos/configuration.php';
}
require_once $global['systemRootPath'] . 'objects/user.php';
require_once $global['systemRootPath'] . 'objects/video.php';
if (!User::canUpload()) {
$obj->msg = __("Permission denied");
die(json_encode($obj));
}
// A list of permitted file extensions
$allowed = ['mp4', 'avi', 'mov', 'mkv', 'flv', 'mp3', 'm4a', 'wav', 'm4v', 'webm', 'wmv'];
if (isset($_FILES['upl']) && $_FILES['upl']['error'] == 0) {
$updateVideoGroups = false;
//echo "Success: \$_FILES OK\n";
$extension = pathinfo($_FILES['upl']['name'], PATHINFO_EXTENSION);
if (!in_array(strtolower($extension), $allowed)) {
//echo '{"status":"error", "msg":"File extension error [' . $_FILES['upl']['name'] . '], we allow only (' . implode(",", $allowed) . ')"}';
status(["status" => "error", "msg" => "File extension error (" . $_FILES['upl']['name'] . "), we allow only (" . implode(",", $allowed) . ")"]);
exit;
}
//echo "Success: file extension OK\n";
//chack if is an audio
$type = "video";
if (strcasecmp($extension, 'mp3') == 0 || strcasecmp($extension, 'wav') == 0 || strcasecmp($extension, 'm4a') == 0) {
$type = 'audio';
}
//var_dump($extension, $type);exit;
require_once $global['systemRootPath'] . 'objects/video.php';
//echo "Starting Get Duration\n";
$duration = Video::getDurationFromFile($_FILES['upl']['tmp_name']);
// check if can upload video (about time limit storage)
if (!empty($global['videoStorageLimitMinutes'])) {
$maxDuration = $global['videoStorageLimitMinutes'] * 60;
$currentStorageUsage = getSecondsTotalVideosLength();
$thisFile = parseDurationToSeconds($duration);
$limitAfterThisFile = $currentStorageUsage + $thisFile;
if ($maxDuration < $limitAfterThisFile) {
status(["status" => "error", "msg" => "Sorry, your storage limit has run out."
. "<br>[Max Duration: {$maxDuration} Seconds]"
. "<br>[Current Srotage Usage: {$currentStorageUsage} Seconds]"
. "<br>[This File Duration: {$thisFile} Seconds]"
. "<br>[Limit after this file: {$limitAfterThisFile} Seconds]", "type" => '$_FILES Limit Error', ]);
if (!empty($_FILES['upl']['videoId'])) {
$video = new Video("", "", $_FILES['upl']['videoId']);
$video->delete();
}
exit;
}
}
$path_parts = pathinfo($_FILES['upl']['name']);
if (empty($path_parts['extension']) || !in_array(strtolower($path_parts['extension']), $global['allowedExtension'])) {
_error_log("Extension not allowed File " . __FILE__ . ": " . json_encode($path_parts));
die();
}
$mainName = preg_replace("/[^A-Za-z0-9]/", "", cleanString($path_parts['filename']));
$paths = Video::getNewVideoFilename();
$filename = $paths['filename'];
$originalFilePath = Video::getStoragePath()."original_" . $filename;
$video = new Video(preg_replace("/_+/", " ", $path_parts['filename']), $filename, @$_FILES['upl']['videoId']);
$video->setDuration($duration);
if ($type == 'audio') {
$video->setType($type);
} else {
$video->setType("video");
}
$video->setStatus(Video::$statusEncoding);
/*
* set visibility for private videos
*/
if (array_key_exists('videoGroups', $_FILES['upl'])) {
$video->setVideoGroups($_FILES['upl']['videoGroups']);
$updateVideoGroups = true;
}
/*
* set description (if given)
*/
if (!empty($_FILES['upl']['description'])) {
$video->setDescription($_FILES['upl']['description']);
}
/*
* set title (if given)
*/
if (!empty($_FILES['upl']['title'])) {
$video->setTitle($_FILES['upl']['title']);
$video->setClean_title($_FILES['upl']['title']);
} else {
/**
* Make a better title and clean title
*/
$videoNewTitle = $video->getTitle();
$titleParts = explode("YPTuniqid", $videoNewTitle);
$video->setTitle($titleParts[0]);
$video->setClean_title($titleParts[0]);
}
$id = $video->save($updateVideoGroups);
/**
* Copy, rename or move original file
*
* copy: used from command line when -c option is included
* rename: used with files which were downloaded directly into the videos directory (from other media sites)
* move: default, used with uploaded files
*/
if (array_key_exists('copyOriginalFile', $_FILES['upl'])) {
if (!copy($_FILES['upl']['tmp_name'], $originalFilePath)) {
die("Error on copy(" . $_FILES['upl']['tmp_name'] . ", " . $originalFilePath . ")");
}
} elseif (array_key_exists('dontMoveUploadedFile', $_FILES['upl'])) {
if (!rename($_FILES['upl']['tmp_name'], $originalFilePath)) {
die("Error on rename(" . $_FILES['upl']['tmp_name'] . ", " . $originalFilePath . ")");
}
} elseif (!move_uploaded_file($_FILES['upl']['tmp_name'], $originalFilePath)) {
if (!rename($_FILES['upl']['tmp_name'], $originalFilePath)) {
die("Error on move_uploaded_file(" . $_FILES['upl']['tmp_name'] . ", " . $originalFilePath . ")");
}
}
$video = new Video('', '', $id);
// send to encoder
$queue = [];
$postFields = [];
if ($video->getType() == 'video') {
if (AVideoPlugin::isEnabledByName("VideoHLS")) {
$postFields['inputAutoHLS'] = 1;
} else {
$postFields['inputLow'] = 1;
$postFields['inputSD'] = 1;
$postFields['inputHD'] = 1;
if (!empty($_FILES['upl']['webm'])) {
$postFields['webm'] = 1;
}
}
} else {
$postFields['audioOnly'] = 1;
$postFields['spectrum'] = 1;
}
if (!empty($_FILES['upl']['override_status'])) {
$postFields['override_status'] = $_FILES['upl']['override_status'];
}
if (!empty($_FILES['upl']['update_video_id'])) {
$postFields['update_video_id'] = $_FILES['upl']['update_video_id'];
}
$queue[] = $video->queue($postFields);
//exec("/usr/bin/php -f videoEncoder.php {$_FILES['upl']['tmp_name']} {$filename} 1> Video::getStoragePath()."{$filename}_progress.txt 2>&1", $output, $return_val);
//var_dump($output, $return_val);
//echo '{"status":"success", "msg":"Your video (' . $filename . ') is encoding <br> ' . $cmd . '", "filename":"' . $filename . '", "duration":"' . $duration . '"}';
status(["status" => "success", "msg" => "Your video ($filename) is queue", "filename" => "$filename", "duration" => "$duration", "queue" => json_encode($queue)]);
//exit;
} else {
//echo '{"status":"error", "msg":' . json_encode($_FILES) . ', "type":"$_FILES Error"}';
status(["status" => "error", "msg" => print_r($_FILES, true), "type" => '$_FILES Error']);
//exit;
}

View file

@ -1,7 +1,5 @@
<?php
ini_set('error_log', '../videos/avideo.js.log');
if(!empty($_GET['error'])){
error_log("[aEC] ".$_GET['error']);
}
?>
<?php
ini_set('error_log', '../videos/avideo.js.log');
if (!empty($_GET['error'])) {
error_log("[aEC] ".$_GET['error']);
}

View file

@ -1,4 +1,2 @@
<?php
require_once __DIR__ . '/../vendor/autoload.php';

View file

@ -1,459 +1,458 @@
<?php
/**
* These are just the language codes, not regions. This means it only lists en, not en-US, en-CA etc.
* @see http://www.iana.org/assignments/language-subtag-registry
*/
$global['langs_codes'] = array(
array('value'=>'af_NA','label'=>'Afrikaans (Namibia)', 'flag'=>'na'),
array('value'=>'af_ZA','label'=>'Afrikaans (South Africa)', 'flag'=>'za'),
array('value'=>'af','label'=>'Afrikaans', 'flag'=>'af'),
array('value'=>'ak_GH','label'=>'Akan (Ghana)', 'flag'=>'gh'),
array('value'=>'ak','label'=>'Akan', 'flag'=>'ak'),
array('value'=>'sq_AL','label'=>'Albanian (Albania)', 'flag'=>'al'),
array('value'=>'sq','label'=>'Albanian', 'flag'=>'sq'),
array('value'=>'am_ET','label'=>'Amharic (Ethiopia)', 'flag'=>'et'),
array('value'=>'am','label'=>'Amharic', 'flag'=>'am'),
array('value'=>'ar_DZ','label'=>'Arabic (Algeria)', 'flag'=>'dz'),
array('value'=>'ar_BH','label'=>'Arabic (Bahrain)', 'flag'=>'bh'),
array('value'=>'ar_EG','label'=>'Arabic (Egypt)', 'flag'=>'eg'),
array('value'=>'ar_IQ','label'=>'Arabic (Iraq)', 'flag'=>'iq'),
array('value'=>'ar_JO','label'=>'Arabic (Jordan)', 'flag'=>'jo'),
array('value'=>'ar_KW','label'=>'Arabic (Kuwait)', 'flag'=>'kw'),
array('value'=>'ar_LB','label'=>'Arabic (Lebanon)', 'flag'=>'lb'),
array('value'=>'ar_LY','label'=>'Arabic (Libya)', 'flag'=>'ly'),
array('value'=>'ar_MA','label'=>'Arabic (Morocco)', 'flag'=>'ma'),
array('value'=>'ar_OM','label'=>'Arabic (Oman)', 'flag'=>'om'),
array('value'=>'ar_QA','label'=>'Arabic (Qatar)', 'flag'=>'qa'),
array('value'=>'ar_SA','label'=>'Arabic (Saudi Arabia)', 'flag'=>'sa'),
array('value'=>'ar_SD','label'=>'Arabic (Sudan)', 'flag'=>'sd'),
array('value'=>'ar_SY','label'=>'Arabic (Syria)', 'flag'=>'sy'),
array('value'=>'ar_TN','label'=>'Arabic (Tunisia)', 'flag'=>'tn'),
array('value'=>'ar_AE','label'=>'Arabic (United Arab Emirates)', 'flag'=>'ae'),
array('value'=>'ar_YE','label'=>'Arabic (Yemen)', 'flag'=>'ye'),
array('value'=>'ar','label'=>'Arabic', 'flag'=>'ar'),
array('value'=>'hy_AM','label'=>'Armenian (Armenia)', 'flag'=>'am'),
array('value'=>'hy','label'=>'Armenian', 'flag'=>'hy'),
array('value'=>'as_IN','label'=>'Assamese (India)', 'flag'=>'in'),
array('value'=>'as','label'=>'Assamese', 'flag'=>'as'),
array('value'=>'asa_TZ','label'=>'Asu (Tanzania)', 'flag'=>'tz'),
array('value'=>'asa','label'=>'Asu', 'flag'=>'asa'),
array('value'=>'az_Cyrl','label'=>'Azerbaijani (Cyrillic)', 'flag'=>'cyrl'),
array('value'=>'az_Cyrl_AZ','label'=>'Azerbaijani (Cyrillic, Azerbaijan)', 'flag'=>'az'),
array('value'=>'az_Latn','label'=>'Azerbaijani (Latin)', 'flag'=>'latn'),
array('value'=>'az_Latn_AZ','label'=>'Azerbaijani (Latin, Azerbaijan)', 'flag'=>'az'),
array('value'=>'az','label'=>'Azerbaijani', 'flag'=>'az'),
array('value'=>'bm_ML','label'=>'Bambara (Mali)', 'flag'=>'ml'),
array('value'=>'bm','label'=>'Bambara', 'flag'=>'bm'),
array('value'=>'eu_ES','label'=>'Basque (Spain)', 'flag'=>'es'),
array('value'=>'eu','label'=>'Basque', 'flag'=>'eu'),
array('value'=>'be_BY','label'=>'Belarusian (Belarus)', 'flag'=>'by'),
array('value'=>'be','label'=>'Belarusian', 'flag'=>'be'),
array('value'=>'bem_ZM','label'=>'Bemba (Zambia)', 'flag'=>'zm'),
array('value'=>'bem','label'=>'Bemba', 'flag'=>'bem'),
array('value'=>'bez_TZ','label'=>'Bena (Tanzania)', 'flag'=>'tz'),
array('value'=>'bez','label'=>'Bena', 'flag'=>'bez'),
array('value'=>'bn_BD','label'=>'Bengali (Bangladesh)', 'flag'=>'bd'),
array('value'=>'bn_IN','label'=>'Bengali (India)', 'flag'=>'in'),
array('value'=>'bn','label'=>'Bengali', 'flag'=>'bn'),
array('value'=>'bs_BA','label'=>'Bosnian (Bosnia and Herzegovina)', 'flag'=>'ba'),
array('value'=>'bs','label'=>'Bosnian', 'flag'=>'bs'),
array('value'=>'bg_BG','label'=>'Bulgarian (Bulgaria)', 'flag'=>'bg'),
array('value'=>'bg','label'=>'Bulgarian', 'flag'=>'bg'),
array('value'=>'my_MM','label'=>'Burmese (Myanmar [Burma])', 'flag'=>'mm'),
array('value'=>'my','label'=>'Burmese', 'flag'=>'my'),
array('value'=>'yue_Hant_HK','label'=>'Cantonese (Traditional, Hong Kong SAR China)', 'flag'=>'hk'),
array('value'=>'ca_ES','label'=>'Catalan (Spain)', 'flag'=>'es'),
array('value'=>'ca','label'=>'Catalan', 'flag'=>'ca'),
array('value'=>'tzm_Latn','label'=>'Central Morocco Tamazight (Latin)', 'flag'=>'latn'),
array('value'=>'tzm_Latn_MA','label'=>'Central Morocco Tamazight (Latin, Morocco)', 'flag'=>'ma'),
array('value'=>'tzm','label'=>'Central Morocco Tamazight', 'flag'=>'tzm'),
array('value'=>'chr_US','label'=>'Cherokee (United States)', 'flag'=>'us'),
array('value'=>'chr','label'=>'Cherokee', 'flag'=>'chr'),
array('value'=>'cgg_UG','label'=>'Chiga (Uganda)', 'flag'=>'ug'),
array('value'=>'cgg','label'=>'Chiga', 'flag'=>'cgg'),
array('value'=>'zh_Hans','label'=>'Chinese (Simplified Han)', 'flag'=>'hans'),
array('value'=>'zh_Hans_CN','label'=>'Chinese (Simplified Han, China)', 'flag'=>'cn'),
array('value'=>'zh_Hans_HK','label'=>'Chinese (Simplified Han, Hong Kong SAR China)', 'flag'=>'hk'),
array('value'=>'zh_Hans_MO','label'=>'Chinese (Simplified Han, Macau SAR China)', 'flag'=>'mo'),
array('value'=>'zh_Hans_SG','label'=>'Chinese (Simplified Han, Singapore)', 'flag'=>'sg'),
array('value'=>'zh_Hant','label'=>'Chinese (Traditional Han)', 'flag'=>'hant'),
array('value'=>'zh_Hant_HK','label'=>'Chinese (Traditional Han, Hong Kong SAR China)', 'flag'=>'hk'),
array('value'=>'zh_Hant_MO','label'=>'Chinese (Traditional Han, Macau SAR China)', 'flag'=>'mo'),
array('value'=>'zh_Hant_TW','label'=>'Chinese (Traditional Han, Taiwan)', 'flag'=>'tw'),
array('value'=>'zh','label'=>'Chinese', 'flag'=>'cn'),
array('value'=>'kw_GB','label'=>'Cornish (United Kingdom)', 'flag'=>'gb'),
array('value'=>'kw','label'=>'Cornish', 'flag'=>'kw'),
array('value'=>'hr_HR','label'=>'Croatian (Croatia)', 'flag'=>'hr'),
array('value'=>'hr','label'=>'Croatian', 'flag'=>'hr'),
array('value'=>'cs_CZ','label'=>'Czech (Czech Republic)', 'flag'=>'cz'),
array('value'=>'cs','label'=>'Czech', 'flag'=>'cz'),
array('value'=>'da_DK','label'=>'Danish (Denmark)', 'flag'=>'dk'),
array('value'=>'da','label'=>'Danish', 'flag'=>'da'),
array('value'=>'nl_BE','label'=>'Dutch (Belgium)', 'flag'=>'be'),
array('value'=>'nl_NL','label'=>'Dutch (Netherlands)', 'flag'=>'nl'),
array('value'=>'nl','label'=>'Dutch', 'flag'=>'nl'),
array('value'=>'ebu_KE','label'=>'Embu (Kenya)', 'flag'=>'ke'),
array('value'=>'ebu','label'=>'Embu', 'flag'=>'ebu'),
array('value'=>'en_US','label'=>'English (United States)', 'flag'=>'us'),
array('value'=>'en_GB','label'=>'English (United Kingdom)', 'flag'=>'gb'),
array('value'=>'en_AS','label'=>'English (American Samoa)', 'flag'=>'as'),
array('value'=>'en_AU','label'=>'English (Australia)', 'flag'=>'au'),
array('value'=>'en_BE','label'=>'English (Belgium)', 'flag'=>'be'),
array('value'=>'en_BZ','label'=>'English (Belize)', 'flag'=>'bz'),
array('value'=>'en_BW','label'=>'English (Botswana)', 'flag'=>'bw'),
array('value'=>'en_CA','label'=>'English (Canada)', 'flag'=>'ca'),
array('value'=>'en_GU','label'=>'English (Guam)', 'flag'=>'gu'),
array('value'=>'en_HK','label'=>'English (Hong Kong SAR China)', 'flag'=>'hk'),
array('value'=>'en_IN','label'=>'English (India)', 'flag'=>'in'),
array('value'=>'en_IE','label'=>'English (Ireland)', 'flag'=>'ie'),
array('value'=>'en_IL','label'=>'English (Israel)', 'flag'=>'il'),
array('value'=>'en_JM','label'=>'English (Jamaica)', 'flag'=>'jm'),
array('value'=>'en_MT','label'=>'English (Malta)', 'flag'=>'mt'),
array('value'=>'en_MH','label'=>'English (Marshall Islands)', 'flag'=>'mh'),
array('value'=>'en_MU','label'=>'English (Mauritius)', 'flag'=>'mu'),
array('value'=>'en_NA','label'=>'English (Namibia)', 'flag'=>'na'),
array('value'=>'en_NZ','label'=>'English (New Zealand)', 'flag'=>'nz'),
array('value'=>'en_MP','label'=>'English (Northern Mariana Islands)', 'flag'=>'mp'),
array('value'=>'en_PK','label'=>'English (Pakistan)', 'flag'=>'pk'),
array('value'=>'en_PH','label'=>'English (Philippines)', 'flag'=>'ph'),
array('value'=>'en_SG','label'=>'English (Singapore)', 'flag'=>'sg'),
array('value'=>'en_ZA','label'=>'English (South Africa)', 'flag'=>'za'),
array('value'=>'en_TT','label'=>'English (Trinidad and Tobago)', 'flag'=>'tt'),
array('value'=>'en_UM','label'=>'English (U.S. Minor Outlying Islands)', 'flag'=>'um'),
array('value'=>'en_VI','label'=>'English (U.S. Virgin Islands)', 'flag'=>'vi'),
array('value'=>'en_ZW','label'=>'English (Zimbabwe)', 'flag'=>'zw'),
array('value'=>'en','label'=>'English', 'flag'=>'us'),
array('value'=>'eo','label'=>'Esperanto', 'flag'=>'eo'),
array('value'=>'et_EE','label'=>'Estonian (Estonia)', 'flag'=>'ee'),
array('value'=>'et','label'=>'Estonian', 'flag'=>'et'),
array('value'=>'ee_GH','label'=>'Ewe (Ghana)', 'flag'=>'gh'),
array('value'=>'ee_TG','label'=>'Ewe (Togo)', 'flag'=>'tg'),
array('value'=>'ee','label'=>'Ewe', 'flag'=>'ee'),
array('value'=>'fo_FO','label'=>'Faroese (Faroe Islands)', 'flag'=>'fo'),
array('value'=>'fo','label'=>'Faroese', 'flag'=>'fo'),
array('value'=>'fil_PH','label'=>'Filipino (Philippines)', 'flag'=>'ph'),
array('value'=>'fil','label'=>'Filipino', 'flag'=>'fil'),
array('value'=>'fi_FI','label'=>'Finnish (Finland)', 'flag'=>'fi'),
array('value'=>'fi','label'=>'Finnish', 'flag'=>'fi'),
array('value'=>'fr_BE','label'=>'French (Belgium)', 'flag'=>'be'),
array('value'=>'fr_BJ','label'=>'French (Benin)', 'flag'=>'bj'),
array('value'=>'fr_BF','label'=>'French (Burkina Faso)', 'flag'=>'bf'),
array('value'=>'fr_BI','label'=>'French (Burundi)', 'flag'=>'bi'),
array('value'=>'fr_CM','label'=>'French (Cameroon)', 'flag'=>'cm'),
array('value'=>'fr_CA','label'=>'French (Canada)', 'flag'=>'ca'),
array('value'=>'fr_CF','label'=>'French (Central African Republic)', 'flag'=>'cf'),
array('value'=>'fr_TD','label'=>'French (Chad)', 'flag'=>'td'),
array('value'=>'fr_KM','label'=>'French (Comoros)', 'flag'=>'km'),
array('value'=>'fr_CG','label'=>'French (Congo - Brazzaville)', 'flag'=>'cg'),
array('value'=>'fr_CD','label'=>'French (Congo - Kinshasa)', 'flag'=>'cd'),
array('value'=>'fr_CI','label'=>'French (Côte dIvoire)', 'flag'=>'ci'),
array('value'=>'fr_DJ','label'=>'French (Djibouti)', 'flag'=>'dj'),
array('value'=>'fr_GQ','label'=>'French (Equatorial Guinea)', 'flag'=>'gq'),
array('value'=>'fr_FR','label'=>'French (France)', 'flag'=>'fr'),
array('value'=>'fr_GA','label'=>'French (Gabon)', 'flag'=>'ga'),
array('value'=>'fr_GP','label'=>'French (Guadeloupe)', 'flag'=>'gp'),
array('value'=>'fr_GN','label'=>'French (Guinea)', 'flag'=>'gn'),
array('value'=>'fr_LU','label'=>'French (Luxembourg)', 'flag'=>'lu'),
array('value'=>'fr_MG','label'=>'French (Madagascar)', 'flag'=>'mg'),
array('value'=>'fr_ML','label'=>'French (Mali)', 'flag'=>'ml'),
array('value'=>'fr_MQ','label'=>'French (Martinique)', 'flag'=>'mq'),
array('value'=>'fr_MC','label'=>'French (Monaco)', 'flag'=>'mc'),
array('value'=>'fr_NE','label'=>'French (Niger)', 'flag'=>'ne'),
array('value'=>'fr_RW','label'=>'French (Rwanda)', 'flag'=>'rw'),
array('value'=>'fr_RE','label'=>'French (Réunion)', 'flag'=>'re'),
array('value'=>'fr_BL','label'=>'French (Saint Barthélemy)', 'flag'=>'bl'),
array('value'=>'fr_MF','label'=>'French (Saint Martin)', 'flag'=>'mf'),
array('value'=>'fr_SN','label'=>'French (Senegal)', 'flag'=>'sn'),
array('value'=>'fr_CH','label'=>'French (Switzerland)', 'flag'=>'ch'),
array('value'=>'fr_TG','label'=>'French (Togo)', 'flag'=>'tg'),
array('value'=>'fr','label'=>'French', 'flag'=>'fr'),
array('value'=>'ff_SN','label'=>'Fulah (Senegal)', 'flag'=>'sn'),
array('value'=>'ff','label'=>'Fulah', 'flag'=>'ff'),
array('value'=>'gl_ES','label'=>'Galician (Spain)', 'flag'=>'es'),
array('value'=>'gl','label'=>'Galician', 'flag'=>'gl'),
array('value'=>'lg_UG','label'=>'Ganda (Uganda)', 'flag'=>'ug'),
array('value'=>'lg','label'=>'Ganda', 'flag'=>'lg'),
array('value'=>'ka_GE','label'=>'Georgian (Georgia)', 'flag'=>'ge'),
array('value'=>'ka','label'=>'Georgian', 'flag'=>'ka'),
array('value'=>'de_AT','label'=>'German (Austria)', 'flag'=>'at'),
array('value'=>'de_BE','label'=>'German (Belgium)', 'flag'=>'be'),
array('value'=>'de_DE','label'=>'German (Germany)', 'flag'=>'de'),
array('value'=>'de_LI','label'=>'German (Liechtenstein)', 'flag'=>'li'),
array('value'=>'de_LU','label'=>'German (Luxembourg)', 'flag'=>'lu'),
array('value'=>'de_CH','label'=>'German (Switzerland)', 'flag'=>'ch'),
array('value'=>'de','label'=>'German', 'flag'=>'de'),
array('value'=>'el_CY','label'=>'Greek (Cyprus)', 'flag'=>'cy'),
array('value'=>'el_GR','label'=>'Greek (Greece)', 'flag'=>'gr'),
array('value'=>'el','label'=>'Greek', 'flag'=>'gr'),
array('value'=>'gu_IN','label'=>'Gujarati (India)', 'flag'=>'in'),
array('value'=>'gu','label'=>'Gujarati', 'flag'=>'gu'),
array('value'=>'guz_KE','label'=>'Gusii (Kenya)', 'flag'=>'ke'),
array('value'=>'guz','label'=>'Gusii', 'flag'=>'guz'),
array('value'=>'ha_Latn','label'=>'Hausa (Latin)', 'flag'=>'latn'),
array('value'=>'ha_Latn_GH','label'=>'Hausa (Latin, Ghana)', 'flag'=>'gh'),
array('value'=>'ha_Latn_NE','label'=>'Hausa (Latin, Niger)', 'flag'=>'ne'),
array('value'=>'ha_Latn_NG','label'=>'Hausa (Latin, Nigeria)', 'flag'=>'ng'),
array('value'=>'ha','label'=>'Hausa', 'flag'=>'ha'),
array('value'=>'haw_US','label'=>'Hawaiian (United States)', 'flag'=>'us'),
array('value'=>'haw','label'=>'Hawaiian', 'flag'=>'haw'),
array('value'=>'he_IL','label'=>'Hebrew (Israel)', 'flag'=>'il'),
array('value'=>'he','label'=>'Hebrew', 'flag'=>'il'),
array('value'=>'hi_IN','label'=>'Hindi (India)', 'flag'=>'in'),
array('value'=>'hi','label'=>'Hindi', 'flag'=>'hi'),
array('value'=>'hu_HU','label'=>'Hungarian (Hungary)', 'flag'=>'hu'),
array('value'=>'hu','label'=>'Hungarian', 'flag'=>'hu'),
array('value'=>'is_IS','label'=>'Icelandic (Iceland)', 'flag'=>'is'),
array('value'=>'is','label'=>'Icelandic', 'flag'=>'is'),
array('value'=>'ig_NG','label'=>'Igbo (Nigeria)', 'flag'=>'ng'),
array('value'=>'ig','label'=>'Igbo', 'flag'=>'ig'),
array('value'=>'id_ID','label'=>'Indonesian (Indonesia)', 'flag'=>'id'),
array('value'=>'id','label'=>'Indonesian', 'flag'=>'id'),
array('value'=>'ga_IE','label'=>'Irish (Ireland)', 'flag'=>'ie'),
array('value'=>'ga','label'=>'Irish', 'flag'=>'ga'),
array('value'=>'it_IT','label'=>'Italian (Italy)', 'flag'=>'it'),
array('value'=>'it_CH','label'=>'Italian (Switzerland)', 'flag'=>'ch'),
array('value'=>'it','label'=>'Italian', 'flag'=>'it'),
array('value'=>'ja_JP','label'=>'Japanese (Japan)', 'flag'=>'jp'),
array('value'=>'ja','label'=>'Japanese', 'flag'=>'ja'),
array('value'=>'kea_CV','label'=>'Kabuverdianu (Cape Verde)', 'flag'=>'cv'),
array('value'=>'kea','label'=>'Kabuverdianu', 'flag'=>'kea'),
array('value'=>'kab_DZ','label'=>'Kabyle (Algeria)', 'flag'=>'dz'),
array('value'=>'kab','label'=>'Kabyle', 'flag'=>'kab'),
array('value'=>'kl_GL','label'=>'Kalaallisut (Greenland)', 'flag'=>'gl'),
array('value'=>'kl','label'=>'Kalaallisut', 'flag'=>'kl'),
array('value'=>'kln_KE','label'=>'Kalenjin (Kenya)', 'flag'=>'ke'),
array('value'=>'kln','label'=>'Kalenjin', 'flag'=>'kln'),
array('value'=>'kam_KE','label'=>'Kamba (Kenya)', 'flag'=>'ke'),
array('value'=>'kam','label'=>'Kamba', 'flag'=>'kam'),
array('value'=>'kn_IN','label'=>'Kannada (India)', 'flag'=>'in'),
array('value'=>'kn','label'=>'Kannada', 'flag'=>'kn'),
array('value'=>'kk_Cyrl','label'=>'Kazakh (Cyrillic)', 'flag'=>'cyrl'),
array('value'=>'kk_Cyrl_KZ','label'=>'Kazakh (Cyrillic, Kazakhstan)', 'flag'=>'kz'),
array('value'=>'kk','label'=>'Kazakh', 'flag'=>'kk'),
array('value'=>'km_KH','label'=>'Khmer (Cambodia)', 'flag'=>'kh'),
array('value'=>'km','label'=>'Khmer', 'flag'=>'km'),
array('value'=>'ki_KE','label'=>'Kikuyu (Kenya)', 'flag'=>'ke'),
array('value'=>'ki','label'=>'Kikuyu', 'flag'=>'ki'),
array('value'=>'rw_RW','label'=>'Kinyarwanda (Rwanda)', 'flag'=>'rw'),
array('value'=>'rw','label'=>'Kinyarwanda', 'flag'=>'rw'),
array('value'=>'kok_IN','label'=>'Konkani (India)', 'flag'=>'in'),
array('value'=>'kok','label'=>'Konkani', 'flag'=>'kok'),
array('value'=>'ko_KR','label'=>'Korean (South Korea)', 'flag'=>'kr'),
array('value'=>'ko','label'=>'Korean', 'flag'=>'ko'),
array('value'=>'khq_ML','label'=>'Koyra Chiini (Mali)', 'flag'=>'ml'),
array('value'=>'khq','label'=>'Koyra Chiini', 'flag'=>'khq'),
array('value'=>'ses_ML','label'=>'Koyraboro Senni (Mali)', 'flag'=>'ml'),
array('value'=>'ses','label'=>'Koyraboro Senni', 'flag'=>'ses'),
array('value'=>'lag_TZ','label'=>'Langi (Tanzania)', 'flag'=>'tz'),
array('value'=>'lag','label'=>'Langi', 'flag'=>'lag'),
array('value'=>'lv_LV','label'=>'Latvian (Latvia)', 'flag'=>'lv'),
array('value'=>'lv','label'=>'Latvian', 'flag'=>'lv'),
array('value'=>'lt_LT','label'=>'Lithuanian (Lithuania)', 'flag'=>'lt'),
array('value'=>'lt','label'=>'Lithuanian', 'flag'=>'lt'),
array('value'=>'luo_KE','label'=>'Luo (Kenya)', 'flag'=>'ke'),
array('value'=>'luo','label'=>'Luo', 'flag'=>'luo'),
array('value'=>'luy_KE','label'=>'Luyia (Kenya)', 'flag'=>'ke'),
array('value'=>'luy','label'=>'Luyia', 'flag'=>'luy'),
array('value'=>'mk_MK','label'=>'Macedonian (Macedonia)', 'flag'=>'mk'),
array('value'=>'mk','label'=>'Macedonian', 'flag'=>'mk'),
array('value'=>'jmc_TZ','label'=>'Machame (Tanzania)', 'flag'=>'tz'),
array('value'=>'jmc','label'=>'Machame', 'flag'=>'jmc'),
array('value'=>'kde_TZ','label'=>'Makonde (Tanzania)', 'flag'=>'tz'),
array('value'=>'kde','label'=>'Makonde', 'flag'=>'kde'),
array('value'=>'mg_MG','label'=>'Malagasy (Madagascar)', 'flag'=>'mg'),
array('value'=>'mg','label'=>'Malagasy', 'flag'=>'mg'),
array('value'=>'ms_BN','label'=>'Malay (Brunei)', 'flag'=>'bn'),
array('value'=>'ms_MY','label'=>'Malay (Malaysia)', 'flag'=>'my'),
array('value'=>'ms','label'=>'Malay', 'flag'=>'ms'),
array('value'=>'ml_IN','label'=>'Malayalam (India)', 'flag'=>'in'),
array('value'=>'ml','label'=>'Malayalam', 'flag'=>'ml'),
array('value'=>'mt_MT','label'=>'Maltese (Malta)', 'flag'=>'mt'),
array('value'=>'mt','label'=>'Maltese', 'flag'=>'mt'),
array('value'=>'gv_GB','label'=>'Manx (United Kingdom)', 'flag'=>'gb'),
array('value'=>'gv','label'=>'Manx', 'flag'=>'gv'),
array('value'=>'mr_IN','label'=>'Marathi (India)', 'flag'=>'in'),
array('value'=>'mr','label'=>'Marathi', 'flag'=>'mr'),
array('value'=>'mas_KE','label'=>'Masai (Kenya)', 'flag'=>'ke'),
array('value'=>'mas_TZ','label'=>'Masai (Tanzania)', 'flag'=>'tz'),
array('value'=>'mas','label'=>'Masai', 'flag'=>'mas'),
array('value'=>'mer_KE','label'=>'Meru (Kenya)', 'flag'=>'ke'),
array('value'=>'mer','label'=>'Meru', 'flag'=>'mer'),
array('value'=>'mfe_MU','label'=>'Morisyen (Mauritius)', 'flag'=>'mu'),
array('value'=>'mfe','label'=>'Morisyen', 'flag'=>'mfe'),
array('value'=>'naq_NA','label'=>'Nama (Namibia)', 'flag'=>'na'),
array('value'=>'naq','label'=>'Nama', 'flag'=>'naq'),
array('value'=>'ne_IN','label'=>'Nepali (India)', 'flag'=>'in'),
array('value'=>'ne_NP','label'=>'Nepali (Nepal)', 'flag'=>'np'),
array('value'=>'ne','label'=>'Nepali', 'flag'=>'ne'),
array('value'=>'nd_ZW','label'=>'North Ndebele (Zimbabwe)', 'flag'=>'zw'),
array('value'=>'nd','label'=>'North Ndebele', 'flag'=>'nd'),
array('value'=>'nb_NO','label'=>'Norwegian Bokmål (Norway)', 'flag'=>'no'),
array('value'=>'nb','label'=>'Norwegian Bokmål', 'flag'=>'nb'),
array('value'=>'nn_NO','label'=>'Norwegian Nynorsk (Norway)', 'flag'=>'no'),
array('value'=>'nn','label'=>'Norwegian Nynorsk', 'flag'=>'nn'),
array('value'=>'nyn_UG','label'=>'Nyankole (Uganda)', 'flag'=>'ug'),
array('value'=>'nyn','label'=>'Nyankole', 'flag'=>'nyn'),
array('value'=>'or_IN','label'=>'Oriya (India)', 'flag'=>'in'),
array('value'=>'or','label'=>'Oriya', 'flag'=>'or'),
array('value'=>'om_ET','label'=>'Oromo (Ethiopia)', 'flag'=>'et'),
array('value'=>'om_KE','label'=>'Oromo (Kenya)', 'flag'=>'ke'),
array('value'=>'om','label'=>'Oromo', 'flag'=>'om'),
array('value'=>'ps_AF','label'=>'Pashto (Afghanistan)', 'flag'=>'af'),
array('value'=>'ps','label'=>'Pashto', 'flag'=>'ps'),
array('value'=>'fa_AF','label'=>'Persian (Afghanistan)', 'flag'=>'af'),
array('value'=>'fa_IR','label'=>'Persian (Iran)', 'flag'=>'ir'),
array('value'=>'fa','label'=>'Persian', 'flag'=>'fa'),
array('value'=>'pl_PL','label'=>'Polish (Poland)', 'flag'=>'pl'),
array('value'=>'pl','label'=>'Polish', 'flag'=>'pl'),
array('value'=>'pt_BR','label'=>'Portuguese (Brazil)', 'flag'=>'br'),
array('value'=>'pt_GW','label'=>'Portuguese (Guinea-Bissau)', 'flag'=>'gw'),
array('value'=>'pt_MZ','label'=>'Portuguese (Mozambique)', 'flag'=>'mz'),
array('value'=>'pt_PT','label'=>'Portuguese (Portugal)', 'flag'=>'pt'),
array('value'=>'pt','label'=>'Portuguese', 'flag'=>'pt'),
array('value'=>'pa_Arab','label'=>'Punjabi (Arabic)', 'flag'=>'arab'),
array('value'=>'pa_Arab_PK','label'=>'Punjabi (Arabic, Pakistan)', 'flag'=>'pk'),
array('value'=>'pa_Guru','label'=>'Punjabi (Gurmukhi)', 'flag'=>'guru'),
array('value'=>'pa_Guru_IN','label'=>'Punjabi (Gurmukhi, India)', 'flag'=>'in'),
array('value'=>'pa','label'=>'Punjabi', 'flag'=>'pa'),
array('value'=>'ro_MD','label'=>'Romanian (Moldova)', 'flag'=>'md'),
array('value'=>'ro_RO','label'=>'Romanian (Romania)', 'flag'=>'ro'),
array('value'=>'ro','label'=>'Romanian', 'flag'=>'ro'),
array('value'=>'rm_CH','label'=>'Romansh (Switzerland)', 'flag'=>'ch'),
array('value'=>'rm','label'=>'Romansh', 'flag'=>'rm'),
array('value'=>'rof_TZ','label'=>'Rombo (Tanzania)', 'flag'=>'tz'),
array('value'=>'rof','label'=>'Rombo', 'flag'=>'rof'),
array('value'=>'ru_MD','label'=>'Russian (Moldova)', 'flag'=>'md'),
array('value'=>'ru_RU','label'=>'Russian (Russia)', 'flag'=>'ru'),
array('value'=>'ru_UA','label'=>'Russian (Ukraine)', 'flag'=>'ua'),
array('value'=>'ru','label'=>'Russian', 'flag'=>'ru'),
array('value'=>'rwk_TZ','label'=>'Rwa (Tanzania)', 'flag'=>'tz'),
array('value'=>'rwk','label'=>'Rwa', 'flag'=>'rwk'),
array('value'=>'saq_KE','label'=>'Samburu (Kenya)', 'flag'=>'ke'),
array('value'=>'saq','label'=>'Samburu', 'flag'=>'saq'),
array('value'=>'sg_CF','label'=>'Sango (Central African Republic)', 'flag'=>'cf'),
array('value'=>'sg','label'=>'Sango', 'flag'=>'sg'),
array('value'=>'seh_MZ','label'=>'Sena (Mozambique)', 'flag'=>'mz'),
array('value'=>'seh','label'=>'Sena', 'flag'=>'seh'),
array('value'=>'sr_Cyrl','label'=>'Serbian (Cyrillic)', 'flag'=>'cyrl'),
array('value'=>'sr_Cyrl_BA','label'=>'Serbian (Cyrillic, Bosnia and Herzegovina)', 'flag'=>'ba'),
array('value'=>'sr_Cyrl_ME','label'=>'Serbian (Cyrillic, Montenegro)', 'flag'=>'me'),
array('value'=>'sr_Cyrl_RS','label'=>'Serbian (Cyrillic, Serbia)', 'flag'=>'rs'),
array('value'=>'sr_Latn','label'=>'Serbian (Latin)', 'flag'=>'latn'),
array('value'=>'sr_Latn_BA','label'=>'Serbian (Latin, Bosnia and Herzegovina)', 'flag'=>'ba'),
array('value'=>'sr_Latn_ME','label'=>'Serbian (Latin, Montenegro)', 'flag'=>'me'),
array('value'=>'sr_Latn_RS','label'=>'Serbian (Latin, Serbia)', 'flag'=>'rs'),
array('value'=>'sr','label'=>'Serbian', 'flag'=>'sr'),
array('value'=>'sn_ZW','label'=>'Shona (Zimbabwe)', 'flag'=>'zw'),
array('value'=>'sn','label'=>'Shona', 'flag'=>'sn'),
array('value'=>'ii_CN','label'=>'Sichuan Yi (China)', 'flag'=>'cn'),
array('value'=>'ii','label'=>'Sichuan Yi', 'flag'=>'ii'),
array('value'=>'si_LK','label'=>'Sinhala (Sri Lanka)', 'flag'=>'lk'),
array('value'=>'si','label'=>'Sinhala', 'flag'=>'si'),
array('value'=>'sk_SK','label'=>'Slovak (Slovakia)', 'flag'=>'sk'),
array('value'=>'sk','label'=>'Slovak', 'flag'=>'sk'),
array('value'=>'sl_SI','label'=>'Slovenian (Slovenia)', 'flag'=>'si'),
array('value'=>'sl','label'=>'Slovenian', 'flag'=>'sl'),
array('value'=>'xog_UG','label'=>'Soga (Uganda)', 'flag'=>'ug'),
array('value'=>'xog','label'=>'Soga', 'flag'=>'xog'),
array('value'=>'so_DJ','label'=>'Somali (Djibouti)', 'flag'=>'dj'),
array('value'=>'so_ET','label'=>'Somali (Ethiopia)', 'flag'=>'et'),
array('value'=>'so_KE','label'=>'Somali (Kenya)', 'flag'=>'ke'),
array('value'=>'so_SO','label'=>'Somali (Somalia)', 'flag'=>'so'),
array('value'=>'so','label'=>'Somali', 'flag'=>'so'),
array('value'=>'es_AR','label'=>'Spanish (Argentina)', 'flag'=>'ar'),
array('value'=>'es_BO','label'=>'Spanish (Bolivia)', 'flag'=>'bo'),
array('value'=>'es_CL','label'=>'Spanish (Chile)', 'flag'=>'cl'),
array('value'=>'es_CO','label'=>'Spanish (Colombia)', 'flag'=>'co'),
array('value'=>'es_CR','label'=>'Spanish (Costa Rica)', 'flag'=>'cr'),
array('value'=>'es_DO','label'=>'Spanish (Dominican Republic)', 'flag'=>'do'),
array('value'=>'es_EC','label'=>'Spanish (Ecuador)', 'flag'=>'ec'),
array('value'=>'es_SV','label'=>'Spanish (El Salvador)', 'flag'=>'sv'),
array('value'=>'es_GQ','label'=>'Spanish (Equatorial Guinea)', 'flag'=>'gq'),
array('value'=>'es_GT','label'=>'Spanish (Guatemala)', 'flag'=>'gt'),
array('value'=>'es_HN','label'=>'Spanish (Honduras)', 'flag'=>'hn'),
array('value'=>'es_419','label'=>'Spanish (Latin America)', 'flag'=>'419'),
array('value'=>'es_MX','label'=>'Spanish (Mexico)', 'flag'=>'mx'),
array('value'=>'es_NI','label'=>'Spanish (Nicaragua)', 'flag'=>'ni'),
array('value'=>'es_PA','label'=>'Spanish (Panama)', 'flag'=>'pa'),
array('value'=>'es_PY','label'=>'Spanish (Paraguay)', 'flag'=>'py'),
array('value'=>'es_PE','label'=>'Spanish (Peru)', 'flag'=>'pe'),
array('value'=>'es_PR','label'=>'Spanish (Puerto Rico)', 'flag'=>'pr'),
array('value'=>'es_ES','label'=>'Spanish (Spain)', 'flag'=>'es'),
//array('value'=>'es_US','label'=>'Spanish (United States)', 'flag'=>'us'),
array('value'=>'es_UY','label'=>'Spanish (Uruguay)', 'flag'=>'uy'),
array('value'=>'es_VE','label'=>'Spanish (Venezuela)', 'flag'=>'ve'),
array('value'=>'es','label'=>'Spanish', 'flag'=>'es'),
array('value'=>'sw_KE','label'=>'Swahili (Kenya)', 'flag'=>'ke'),
array('value'=>'sw_TZ','label'=>'Swahili (Tanzania)', 'flag'=>'tz'),
array('value'=>'sw','label'=>'Swahili', 'flag'=>'sw'),
array('value'=>'sv_FI','label'=>'Swedish (Finland)', 'flag'=>'fi'),
array('value'=>'sv_SE','label'=>'Swedish (Sweden)', 'flag'=>'se'),
array('value'=>'sv','label'=>'Swedish', 'flag'=>'sv'),
array('value'=>'gsw_CH','label'=>'Swiss German (Switzerland)', 'flag'=>'ch'),
array('value'=>'gsw','label'=>'Swiss German', 'flag'=>'gsw'),
array('value'=>'shi_Latn','label'=>'Tachelhit (Latin)', 'flag'=>'latn'),
array('value'=>'shi_Latn_MA','label'=>'Tachelhit (Latin, Morocco)', 'flag'=>'ma'),
array('value'=>'shi_Tfng','label'=>'Tachelhit (Tifinagh)', 'flag'=>'tfng'),
array('value'=>'shi_Tfng_MA','label'=>'Tachelhit (Tifinagh, Morocco)', 'flag'=>'ma'),
array('value'=>'shi','label'=>'Tachelhit', 'flag'=>'shi'),
array('value'=>'dav_KE','label'=>'Taita (Kenya)', 'flag'=>'ke'),
array('value'=>'dav','label'=>'Taita', 'flag'=>'dav'),
array('value'=>'ta_IN','label'=>'Tamil (India)', 'flag'=>'in'),
array('value'=>'ta_LK','label'=>'Tamil (Sri Lanka)', 'flag'=>'lk'),
array('value'=>'ta','label'=>'Tamil', 'flag'=>'ta'),
array('value'=>'te_IN','label'=>'Telugu (India)', 'flag'=>'in'),
array('value'=>'te','label'=>'Telugu', 'flag'=>'te'),
array('value'=>'teo_KE','label'=>'Teso (Kenya)', 'flag'=>'ke'),
array('value'=>'teo_UG','label'=>'Teso (Uganda)', 'flag'=>'ug'),
array('value'=>'teo','label'=>'Teso', 'flag'=>'teo'),
array('value'=>'th_TH','label'=>'Thai (Thailand)', 'flag'=>'th'),
array('value'=>'th','label'=>'Thai', 'flag'=>'th'),
array('value'=>'bo_CN','label'=>'Tibetan (China)', 'flag'=>'cn'),
array('value'=>'bo_IN','label'=>'Tibetan (India)', 'flag'=>'in'),
array('value'=>'bo','label'=>'Tibetan', 'flag'=>'bo'),
array('value'=>'ti_ER','label'=>'Tigrinya (Eritrea)', 'flag'=>'er'),
array('value'=>'ti_ET','label'=>'Tigrinya (Ethiopia)', 'flag'=>'et'),
array('value'=>'ti','label'=>'Tigrinya', 'flag'=>'ti'),
array('value'=>'to_TO','label'=>'Tonga (Tonga)', 'flag'=>'to'),
array('value'=>'to','label'=>'Tonga', 'flag'=>'to'),
array('value'=>'tr_TR','label'=>'Turkish (Turkey)', 'flag'=>'tr'),
array('value'=>'tr','label'=>'Turkish', 'flag'=>'tr'),
array('value'=>'uk_UA','label'=>'Ukrainian (Ukraine)', 'flag'=>'ua'),
array('value'=>'uk','label'=>'Ukrainian', 'flag'=>'uk'),
array('value'=>'ur_IN','label'=>'Urdu (India)', 'flag'=>'in'),
array('value'=>'ur_PK','label'=>'Urdu (Pakistan)', 'flag'=>'pk'),
array('value'=>'ur','label'=>'Urdu', 'flag'=>'ur'),
array('value'=>'uz_Arab','label'=>'Uzbek (Arabic)', 'flag'=>'arab'),
array('value'=>'uz_Arab_AF','label'=>'Uzbek (Arabic, Afghanistan)', 'flag'=>'af'),
array('value'=>'uz_Cyrl','label'=>'Uzbek (Cyrillic)', 'flag'=>'cyrl'),
array('value'=>'uz_Cyrl_UZ','label'=>'Uzbek (Cyrillic, Uzbekistan)', 'flag'=>'uz'),
array('value'=>'uz_Latn','label'=>'Uzbek (Latin)', 'flag'=>'latn'),
array('value'=>'uz_Latn_UZ','label'=>'Uzbek (Latin, Uzbekistan)', 'flag'=>'uz'),
array('value'=>'uz','label'=>'Uzbek', 'flag'=>'uz'),
array('value'=>'vi_VN','label'=>'Vietnamese (Vietnam)', 'flag'=>'vn'),
array('value'=>'vi','label'=>'Vietnamese', 'flag'=>'vi'),
array('value'=>'vun_TZ','label'=>'Vunjo (Tanzania)', 'flag'=>'tz'),
array('value'=>'vun','label'=>'Vunjo', 'flag'=>'vun'),
array('value'=>'cy_GB','label'=>'Welsh (United Kingdom)', 'flag'=>'gb'),
array('value'=>'cy','label'=>'Welsh', 'flag'=>'cy'),
array('value'=>'yo_NG','label'=>'Yoruba (Nigeria)', 'flag'=>'ng'),
array('value'=>'yo','label'=>'Yoruba', 'flag'=>'yo'),
array('value'=>'zu_ZA','label'=>'Zulu (South Africa)', 'flag'=>'za'),
array('value'=>'zu','label'=>'Zulu', 'flag'=>'zu')
);
$global['bcp47'] = array();
$global['langs_codes_values'] = array();
$global['langs_codes_values_withdot'] = array();
foreach ($global['langs_codes'] as $value) {
$global['bcp47'][$value['value']] = $value;
$global['flag2Lang'][$value['flag']] = $value['value'];
$global['langs_codes_values'][] = $value['value'];
$global['langs_codes_values_withdot'][] = '.'.$value['value'];
}
$global['flag2Lang']['en'] = 'en_US';
$global['flag2Lang']['us'] = 'en_US';
$global['js_availableLangs'] = 'var availableLangs = ' . json_encode($global['langs_codes']) . ';';
<?php
/**
* These are just the language codes, not regions. This means it only lists en, not en-US, en-CA etc.
* @see http://www.iana.org/assignments/language-subtag-registry
*/
$global['langs_codes'] = [
['value' => 'af_NA','label' => 'Afrikaans (Namibia)', 'flag' => 'na'],
['value' => 'af_ZA','label' => 'Afrikaans (South Africa)', 'flag' => 'za'],
['value' => 'af','label' => 'Afrikaans', 'flag' => 'af'],
['value' => 'ak_GH','label' => 'Akan (Ghana)', 'flag' => 'gh'],
['value' => 'ak','label' => 'Akan', 'flag' => 'ak'],
['value' => 'sq_AL','label' => 'Albanian (Albania)', 'flag' => 'al'],
['value' => 'sq','label' => 'Albanian', 'flag' => 'sq'],
['value' => 'am_ET','label' => 'Amharic (Ethiopia)', 'flag' => 'et'],
['value' => 'am','label' => 'Amharic', 'flag' => 'am'],
['value' => 'ar_DZ','label' => 'Arabic (Algeria)', 'flag' => 'dz'],
['value' => 'ar_BH','label' => 'Arabic (Bahrain)', 'flag' => 'bh'],
['value' => 'ar_EG','label' => 'Arabic (Egypt)', 'flag' => 'eg'],
['value' => 'ar_IQ','label' => 'Arabic (Iraq)', 'flag' => 'iq'],
['value' => 'ar_JO','label' => 'Arabic (Jordan)', 'flag' => 'jo'],
['value' => 'ar_KW','label' => 'Arabic (Kuwait)', 'flag' => 'kw'],
['value' => 'ar_LB','label' => 'Arabic (Lebanon)', 'flag' => 'lb'],
['value' => 'ar_LY','label' => 'Arabic (Libya)', 'flag' => 'ly'],
['value' => 'ar_MA','label' => 'Arabic (Morocco)', 'flag' => 'ma'],
['value' => 'ar_OM','label' => 'Arabic (Oman)', 'flag' => 'om'],
['value' => 'ar_QA','label' => 'Arabic (Qatar)', 'flag' => 'qa'],
['value' => 'ar_SA','label' => 'Arabic (Saudi Arabia)', 'flag' => 'sa'],
['value' => 'ar_SD','label' => 'Arabic (Sudan)', 'flag' => 'sd'],
['value' => 'ar_SY','label' => 'Arabic (Syria)', 'flag' => 'sy'],
['value' => 'ar_TN','label' => 'Arabic (Tunisia)', 'flag' => 'tn'],
['value' => 'ar_AE','label' => 'Arabic (United Arab Emirates)', 'flag' => 'ae'],
['value' => 'ar_YE','label' => 'Arabic (Yemen)', 'flag' => 'ye'],
['value' => 'ar','label' => 'Arabic', 'flag' => 'ar'],
['value' => 'hy_AM','label' => 'Armenian (Armenia)', 'flag' => 'am'],
['value' => 'hy','label' => 'Armenian', 'flag' => 'hy'],
['value' => 'as_IN','label' => 'Assamese (India)', 'flag' => 'in'],
['value' => 'as','label' => 'Assamese', 'flag' => 'as'],
['value' => 'asa_TZ','label' => 'Asu (Tanzania)', 'flag' => 'tz'],
['value' => 'asa','label' => 'Asu', 'flag' => 'asa'],
['value' => 'az_Cyrl','label' => 'Azerbaijani (Cyrillic)', 'flag' => 'cyrl'],
['value' => 'az_Cyrl_AZ','label' => 'Azerbaijani (Cyrillic, Azerbaijan)', 'flag' => 'az'],
['value' => 'az_Latn','label' => 'Azerbaijani (Latin)', 'flag' => 'latn'],
['value' => 'az_Latn_AZ','label' => 'Azerbaijani (Latin, Azerbaijan)', 'flag' => 'az'],
['value' => 'az','label' => 'Azerbaijani', 'flag' => 'az'],
['value' => 'bm_ML','label' => 'Bambara (Mali)', 'flag' => 'ml'],
['value' => 'bm','label' => 'Bambara', 'flag' => 'bm'],
['value' => 'eu_ES','label' => 'Basque (Spain)', 'flag' => 'es'],
['value' => 'eu','label' => 'Basque', 'flag' => 'eu'],
['value' => 'be_BY','label' => 'Belarusian (Belarus)', 'flag' => 'by'],
['value' => 'be','label' => 'Belarusian', 'flag' => 'be'],
['value' => 'bem_ZM','label' => 'Bemba (Zambia)', 'flag' => 'zm'],
['value' => 'bem','label' => 'Bemba', 'flag' => 'bem'],
['value' => 'bez_TZ','label' => 'Bena (Tanzania)', 'flag' => 'tz'],
['value' => 'bez','label' => 'Bena', 'flag' => 'bez'],
['value' => 'bn_BD','label' => 'Bengali (Bangladesh)', 'flag' => 'bd'],
['value' => 'bn_IN','label' => 'Bengali (India)', 'flag' => 'in'],
['value' => 'bn','label' => 'Bengali', 'flag' => 'bn'],
['value' => 'bs_BA','label' => 'Bosnian (Bosnia and Herzegovina)', 'flag' => 'ba'],
['value' => 'bs','label' => 'Bosnian', 'flag' => 'bs'],
['value' => 'bg_BG','label' => 'Bulgarian (Bulgaria)', 'flag' => 'bg'],
['value' => 'bg','label' => 'Bulgarian', 'flag' => 'bg'],
['value' => 'my_MM','label' => 'Burmese (Myanmar [Burma])', 'flag' => 'mm'],
['value' => 'my','label' => 'Burmese', 'flag' => 'my'],
['value' => 'yue_Hant_HK','label' => 'Cantonese (Traditional, Hong Kong SAR China)', 'flag' => 'hk'],
['value' => 'ca_ES','label' => 'Catalan (Spain)', 'flag' => 'es'],
['value' => 'ca','label' => 'Catalan', 'flag' => 'ca'],
['value' => 'tzm_Latn','label' => 'Central Morocco Tamazight (Latin)', 'flag' => 'latn'],
['value' => 'tzm_Latn_MA','label' => 'Central Morocco Tamazight (Latin, Morocco)', 'flag' => 'ma'],
['value' => 'tzm','label' => 'Central Morocco Tamazight', 'flag' => 'tzm'],
['value' => 'chr_US','label' => 'Cherokee (United States)', 'flag' => 'us'],
['value' => 'chr','label' => 'Cherokee', 'flag' => 'chr'],
['value' => 'cgg_UG','label' => 'Chiga (Uganda)', 'flag' => 'ug'],
['value' => 'cgg','label' => 'Chiga', 'flag' => 'cgg'],
['value' => 'zh_Hans','label' => 'Chinese (Simplified Han)', 'flag' => 'hans'],
['value' => 'zh_Hans_CN','label' => 'Chinese (Simplified Han, China)', 'flag' => 'cn'],
['value' => 'zh_Hans_HK','label' => 'Chinese (Simplified Han, Hong Kong SAR China)', 'flag' => 'hk'],
['value' => 'zh_Hans_MO','label' => 'Chinese (Simplified Han, Macau SAR China)', 'flag' => 'mo'],
['value' => 'zh_Hans_SG','label' => 'Chinese (Simplified Han, Singapore)', 'flag' => 'sg'],
['value' => 'zh_Hant','label' => 'Chinese (Traditional Han)', 'flag' => 'hant'],
['value' => 'zh_Hant_HK','label' => 'Chinese (Traditional Han, Hong Kong SAR China)', 'flag' => 'hk'],
['value' => 'zh_Hant_MO','label' => 'Chinese (Traditional Han, Macau SAR China)', 'flag' => 'mo'],
['value' => 'zh_Hant_TW','label' => 'Chinese (Traditional Han, Taiwan)', 'flag' => 'tw'],
['value' => 'zh','label' => 'Chinese', 'flag' => 'cn'],
['value' => 'kw_GB','label' => 'Cornish (United Kingdom)', 'flag' => 'gb'],
['value' => 'kw','label' => 'Cornish', 'flag' => 'kw'],
['value' => 'hr_HR','label' => 'Croatian (Croatia)', 'flag' => 'hr'],
['value' => 'hr','label' => 'Croatian', 'flag' => 'hr'],
['value' => 'cs_CZ','label' => 'Czech (Czech Republic)', 'flag' => 'cz'],
['value' => 'cs','label' => 'Czech', 'flag' => 'cz'],
['value' => 'da_DK','label' => 'Danish (Denmark)', 'flag' => 'dk'],
['value' => 'da','label' => 'Danish', 'flag' => 'da'],
['value' => 'nl_BE','label' => 'Dutch (Belgium)', 'flag' => 'be'],
['value' => 'nl_NL','label' => 'Dutch (Netherlands)', 'flag' => 'nl'],
['value' => 'nl','label' => 'Dutch', 'flag' => 'nl'],
['value' => 'ebu_KE','label' => 'Embu (Kenya)', 'flag' => 'ke'],
['value' => 'ebu','label' => 'Embu', 'flag' => 'ebu'],
['value' => 'en_US','label' => 'English (United States)', 'flag' => 'us'],
['value' => 'en_GB','label' => 'English (United Kingdom)', 'flag' => 'gb'],
['value' => 'en_AS','label' => 'English (American Samoa)', 'flag' => 'as'],
['value' => 'en_AU','label' => 'English (Australia)', 'flag' => 'au'],
['value' => 'en_BE','label' => 'English (Belgium)', 'flag' => 'be'],
['value' => 'en_BZ','label' => 'English (Belize)', 'flag' => 'bz'],
['value' => 'en_BW','label' => 'English (Botswana)', 'flag' => 'bw'],
['value' => 'en_CA','label' => 'English (Canada)', 'flag' => 'ca'],
['value' => 'en_GU','label' => 'English (Guam)', 'flag' => 'gu'],
['value' => 'en_HK','label' => 'English (Hong Kong SAR China)', 'flag' => 'hk'],
['value' => 'en_IN','label' => 'English (India)', 'flag' => 'in'],
['value' => 'en_IE','label' => 'English (Ireland)', 'flag' => 'ie'],
['value' => 'en_IL','label' => 'English (Israel)', 'flag' => 'il'],
['value' => 'en_JM','label' => 'English (Jamaica)', 'flag' => 'jm'],
['value' => 'en_MT','label' => 'English (Malta)', 'flag' => 'mt'],
['value' => 'en_MH','label' => 'English (Marshall Islands)', 'flag' => 'mh'],
['value' => 'en_MU','label' => 'English (Mauritius)', 'flag' => 'mu'],
['value' => 'en_NA','label' => 'English (Namibia)', 'flag' => 'na'],
['value' => 'en_NZ','label' => 'English (New Zealand)', 'flag' => 'nz'],
['value' => 'en_MP','label' => 'English (Northern Mariana Islands)', 'flag' => 'mp'],
['value' => 'en_PK','label' => 'English (Pakistan)', 'flag' => 'pk'],
['value' => 'en_PH','label' => 'English (Philippines)', 'flag' => 'ph'],
['value' => 'en_SG','label' => 'English (Singapore)', 'flag' => 'sg'],
['value' => 'en_ZA','label' => 'English (South Africa)', 'flag' => 'za'],
['value' => 'en_TT','label' => 'English (Trinidad and Tobago)', 'flag' => 'tt'],
['value' => 'en_UM','label' => 'English (U.S. Minor Outlying Islands)', 'flag' => 'um'],
['value' => 'en_VI','label' => 'English (U.S. Virgin Islands)', 'flag' => 'vi'],
['value' => 'en_ZW','label' => 'English (Zimbabwe)', 'flag' => 'zw'],
['value' => 'en','label' => 'English', 'flag' => 'us'],
['value' => 'eo','label' => 'Esperanto', 'flag' => 'eo'],
['value' => 'et_EE','label' => 'Estonian (Estonia)', 'flag' => 'ee'],
['value' => 'et','label' => 'Estonian', 'flag' => 'et'],
['value' => 'ee_GH','label' => 'Ewe (Ghana)', 'flag' => 'gh'],
['value' => 'ee_TG','label' => 'Ewe (Togo)', 'flag' => 'tg'],
['value' => 'ee','label' => 'Ewe', 'flag' => 'ee'],
['value' => 'fo_FO','label' => 'Faroese (Faroe Islands)', 'flag' => 'fo'],
['value' => 'fo','label' => 'Faroese', 'flag' => 'fo'],
['value' => 'fil_PH','label' => 'Filipino (Philippines)', 'flag' => 'ph'],
['value' => 'fil','label' => 'Filipino', 'flag' => 'fil'],
['value' => 'fi_FI','label' => 'Finnish (Finland)', 'flag' => 'fi'],
['value' => 'fi','label' => 'Finnish', 'flag' => 'fi'],
['value' => 'fr_BE','label' => 'French (Belgium)', 'flag' => 'be'],
['value' => 'fr_BJ','label' => 'French (Benin)', 'flag' => 'bj'],
['value' => 'fr_BF','label' => 'French (Burkina Faso)', 'flag' => 'bf'],
['value' => 'fr_BI','label' => 'French (Burundi)', 'flag' => 'bi'],
['value' => 'fr_CM','label' => 'French (Cameroon)', 'flag' => 'cm'],
['value' => 'fr_CA','label' => 'French (Canada)', 'flag' => 'ca'],
['value' => 'fr_CF','label' => 'French (Central African Republic)', 'flag' => 'cf'],
['value' => 'fr_TD','label' => 'French (Chad)', 'flag' => 'td'],
['value' => 'fr_KM','label' => 'French (Comoros)', 'flag' => 'km'],
['value' => 'fr_CG','label' => 'French (Congo - Brazzaville)', 'flag' => 'cg'],
['value' => 'fr_CD','label' => 'French (Congo - Kinshasa)', 'flag' => 'cd'],
['value' => 'fr_CI','label' => 'French (Côte dIvoire)', 'flag' => 'ci'],
['value' => 'fr_DJ','label' => 'French (Djibouti)', 'flag' => 'dj'],
['value' => 'fr_GQ','label' => 'French (Equatorial Guinea)', 'flag' => 'gq'],
['value' => 'fr_FR','label' => 'French (France)', 'flag' => 'fr'],
['value' => 'fr_GA','label' => 'French (Gabon)', 'flag' => 'ga'],
['value' => 'fr_GP','label' => 'French (Guadeloupe)', 'flag' => 'gp'],
['value' => 'fr_GN','label' => 'French (Guinea)', 'flag' => 'gn'],
['value' => 'fr_LU','label' => 'French (Luxembourg)', 'flag' => 'lu'],
['value' => 'fr_MG','label' => 'French (Madagascar)', 'flag' => 'mg'],
['value' => 'fr_ML','label' => 'French (Mali)', 'flag' => 'ml'],
['value' => 'fr_MQ','label' => 'French (Martinique)', 'flag' => 'mq'],
['value' => 'fr_MC','label' => 'French (Monaco)', 'flag' => 'mc'],
['value' => 'fr_NE','label' => 'French (Niger)', 'flag' => 'ne'],
['value' => 'fr_RW','label' => 'French (Rwanda)', 'flag' => 'rw'],
['value' => 'fr_RE','label' => 'French (Réunion)', 'flag' => 're'],
['value' => 'fr_BL','label' => 'French (Saint Barthélemy)', 'flag' => 'bl'],
['value' => 'fr_MF','label' => 'French (Saint Martin)', 'flag' => 'mf'],
['value' => 'fr_SN','label' => 'French (Senegal)', 'flag' => 'sn'],
['value' => 'fr_CH','label' => 'French (Switzerland)', 'flag' => 'ch'],
['value' => 'fr_TG','label' => 'French (Togo)', 'flag' => 'tg'],
['value' => 'fr','label' => 'French', 'flag' => 'fr'],
['value' => 'ff_SN','label' => 'Fulah (Senegal)', 'flag' => 'sn'],
['value' => 'ff','label' => 'Fulah', 'flag' => 'ff'],
['value' => 'gl_ES','label' => 'Galician (Spain)', 'flag' => 'es'],
['value' => 'gl','label' => 'Galician', 'flag' => 'gl'],
['value' => 'lg_UG','label' => 'Ganda (Uganda)', 'flag' => 'ug'],
['value' => 'lg','label' => 'Ganda', 'flag' => 'lg'],
['value' => 'ka_GE','label' => 'Georgian (Georgia)', 'flag' => 'ge'],
['value' => 'ka','label' => 'Georgian', 'flag' => 'ka'],
['value' => 'de_AT','label' => 'German (Austria)', 'flag' => 'at'],
['value' => 'de_BE','label' => 'German (Belgium)', 'flag' => 'be'],
['value' => 'de_DE','label' => 'German (Germany)', 'flag' => 'de'],
['value' => 'de_LI','label' => 'German (Liechtenstein)', 'flag' => 'li'],
['value' => 'de_LU','label' => 'German (Luxembourg)', 'flag' => 'lu'],
['value' => 'de_CH','label' => 'German (Switzerland)', 'flag' => 'ch'],
['value' => 'de','label' => 'German', 'flag' => 'de'],
['value' => 'el_CY','label' => 'Greek (Cyprus)', 'flag' => 'cy'],
['value' => 'el_GR','label' => 'Greek (Greece)', 'flag' => 'gr'],
['value' => 'el','label' => 'Greek', 'flag' => 'gr'],
['value' => 'gu_IN','label' => 'Gujarati (India)', 'flag' => 'in'],
['value' => 'gu','label' => 'Gujarati', 'flag' => 'gu'],
['value' => 'guz_KE','label' => 'Gusii (Kenya)', 'flag' => 'ke'],
['value' => 'guz','label' => 'Gusii', 'flag' => 'guz'],
['value' => 'ha_Latn','label' => 'Hausa (Latin)', 'flag' => 'latn'],
['value' => 'ha_Latn_GH','label' => 'Hausa (Latin, Ghana)', 'flag' => 'gh'],
['value' => 'ha_Latn_NE','label' => 'Hausa (Latin, Niger)', 'flag' => 'ne'],
['value' => 'ha_Latn_NG','label' => 'Hausa (Latin, Nigeria)', 'flag' => 'ng'],
['value' => 'ha','label' => 'Hausa', 'flag' => 'ha'],
['value' => 'haw_US','label' => 'Hawaiian (United States)', 'flag' => 'us'],
['value' => 'haw','label' => 'Hawaiian', 'flag' => 'haw'],
['value' => 'he_IL','label' => 'Hebrew (Israel)', 'flag' => 'il'],
['value' => 'he','label' => 'Hebrew', 'flag' => 'il'],
['value' => 'hi_IN','label' => 'Hindi (India)', 'flag' => 'in'],
['value' => 'hi','label' => 'Hindi', 'flag' => 'hi'],
['value' => 'hu_HU','label' => 'Hungarian (Hungary)', 'flag' => 'hu'],
['value' => 'hu','label' => 'Hungarian', 'flag' => 'hu'],
['value' => 'is_IS','label' => 'Icelandic (Iceland)', 'flag' => 'is'],
['value' => 'is','label' => 'Icelandic', 'flag' => 'is'],
['value' => 'ig_NG','label' => 'Igbo (Nigeria)', 'flag' => 'ng'],
['value' => 'ig','label' => 'Igbo', 'flag' => 'ig'],
['value' => 'id_ID','label' => 'Indonesian (Indonesia)', 'flag' => 'id'],
['value' => 'id','label' => 'Indonesian', 'flag' => 'id'],
['value' => 'ga_IE','label' => 'Irish (Ireland)', 'flag' => 'ie'],
['value' => 'ga','label' => 'Irish', 'flag' => 'ga'],
['value' => 'it_IT','label' => 'Italian (Italy)', 'flag' => 'it'],
['value' => 'it_CH','label' => 'Italian (Switzerland)', 'flag' => 'ch'],
['value' => 'it','label' => 'Italian', 'flag' => 'it'],
['value' => 'ja_JP','label' => 'Japanese (Japan)', 'flag' => 'jp'],
['value' => 'ja','label' => 'Japanese', 'flag' => 'ja'],
['value' => 'kea_CV','label' => 'Kabuverdianu (Cape Verde)', 'flag' => 'cv'],
['value' => 'kea','label' => 'Kabuverdianu', 'flag' => 'kea'],
['value' => 'kab_DZ','label' => 'Kabyle (Algeria)', 'flag' => 'dz'],
['value' => 'kab','label' => 'Kabyle', 'flag' => 'kab'],
['value' => 'kl_GL','label' => 'Kalaallisut (Greenland)', 'flag' => 'gl'],
['value' => 'kl','label' => 'Kalaallisut', 'flag' => 'kl'],
['value' => 'kln_KE','label' => 'Kalenjin (Kenya)', 'flag' => 'ke'],
['value' => 'kln','label' => 'Kalenjin', 'flag' => 'kln'],
['value' => 'kam_KE','label' => 'Kamba (Kenya)', 'flag' => 'ke'],
['value' => 'kam','label' => 'Kamba', 'flag' => 'kam'],
['value' => 'kn_IN','label' => 'Kannada (India)', 'flag' => 'in'],
['value' => 'kn','label' => 'Kannada', 'flag' => 'kn'],
['value' => 'kk_Cyrl','label' => 'Kazakh (Cyrillic)', 'flag' => 'cyrl'],
['value' => 'kk_Cyrl_KZ','label' => 'Kazakh (Cyrillic, Kazakhstan)', 'flag' => 'kz'],
['value' => 'kk','label' => 'Kazakh', 'flag' => 'kk'],
['value' => 'km_KH','label' => 'Khmer (Cambodia)', 'flag' => 'kh'],
['value' => 'km','label' => 'Khmer', 'flag' => 'km'],
['value' => 'ki_KE','label' => 'Kikuyu (Kenya)', 'flag' => 'ke'],
['value' => 'ki','label' => 'Kikuyu', 'flag' => 'ki'],
['value' => 'rw_RW','label' => 'Kinyarwanda (Rwanda)', 'flag' => 'rw'],
['value' => 'rw','label' => 'Kinyarwanda', 'flag' => 'rw'],
['value' => 'kok_IN','label' => 'Konkani (India)', 'flag' => 'in'],
['value' => 'kok','label' => 'Konkani', 'flag' => 'kok'],
['value' => 'ko_KR','label' => 'Korean (South Korea)', 'flag' => 'kr'],
['value' => 'ko','label' => 'Korean', 'flag' => 'ko'],
['value' => 'khq_ML','label' => 'Koyra Chiini (Mali)', 'flag' => 'ml'],
['value' => 'khq','label' => 'Koyra Chiini', 'flag' => 'khq'],
['value' => 'ses_ML','label' => 'Koyraboro Senni (Mali)', 'flag' => 'ml'],
['value' => 'ses','label' => 'Koyraboro Senni', 'flag' => 'ses'],
['value' => 'lag_TZ','label' => 'Langi (Tanzania)', 'flag' => 'tz'],
['value' => 'lag','label' => 'Langi', 'flag' => 'lag'],
['value' => 'lv_LV','label' => 'Latvian (Latvia)', 'flag' => 'lv'],
['value' => 'lv','label' => 'Latvian', 'flag' => 'lv'],
['value' => 'lt_LT','label' => 'Lithuanian (Lithuania)', 'flag' => 'lt'],
['value' => 'lt','label' => 'Lithuanian', 'flag' => 'lt'],
['value' => 'luo_KE','label' => 'Luo (Kenya)', 'flag' => 'ke'],
['value' => 'luo','label' => 'Luo', 'flag' => 'luo'],
['value' => 'luy_KE','label' => 'Luyia (Kenya)', 'flag' => 'ke'],
['value' => 'luy','label' => 'Luyia', 'flag' => 'luy'],
['value' => 'mk_MK','label' => 'Macedonian (Macedonia)', 'flag' => 'mk'],
['value' => 'mk','label' => 'Macedonian', 'flag' => 'mk'],
['value' => 'jmc_TZ','label' => 'Machame (Tanzania)', 'flag' => 'tz'],
['value' => 'jmc','label' => 'Machame', 'flag' => 'jmc'],
['value' => 'kde_TZ','label' => 'Makonde (Tanzania)', 'flag' => 'tz'],
['value' => 'kde','label' => 'Makonde', 'flag' => 'kde'],
['value' => 'mg_MG','label' => 'Malagasy (Madagascar)', 'flag' => 'mg'],
['value' => 'mg','label' => 'Malagasy', 'flag' => 'mg'],
['value' => 'ms_BN','label' => 'Malay (Brunei)', 'flag' => 'bn'],
['value' => 'ms_MY','label' => 'Malay (Malaysia)', 'flag' => 'my'],
['value' => 'ms','label' => 'Malay', 'flag' => 'ms'],
['value' => 'ml_IN','label' => 'Malayalam (India)', 'flag' => 'in'],
['value' => 'ml','label' => 'Malayalam', 'flag' => 'ml'],
['value' => 'mt_MT','label' => 'Maltese (Malta)', 'flag' => 'mt'],
['value' => 'mt','label' => 'Maltese', 'flag' => 'mt'],
['value' => 'gv_GB','label' => 'Manx (United Kingdom)', 'flag' => 'gb'],
['value' => 'gv','label' => 'Manx', 'flag' => 'gv'],
['value' => 'mr_IN','label' => 'Marathi (India)', 'flag' => 'in'],
['value' => 'mr','label' => 'Marathi', 'flag' => 'mr'],
['value' => 'mas_KE','label' => 'Masai (Kenya)', 'flag' => 'ke'],
['value' => 'mas_TZ','label' => 'Masai (Tanzania)', 'flag' => 'tz'],
['value' => 'mas','label' => 'Masai', 'flag' => 'mas'],
['value' => 'mer_KE','label' => 'Meru (Kenya)', 'flag' => 'ke'],
['value' => 'mer','label' => 'Meru', 'flag' => 'mer'],
['value' => 'mfe_MU','label' => 'Morisyen (Mauritius)', 'flag' => 'mu'],
['value' => 'mfe','label' => 'Morisyen', 'flag' => 'mfe'],
['value' => 'naq_NA','label' => 'Nama (Namibia)', 'flag' => 'na'],
['value' => 'naq','label' => 'Nama', 'flag' => 'naq'],
['value' => 'ne_IN','label' => 'Nepali (India)', 'flag' => 'in'],
['value' => 'ne_NP','label' => 'Nepali (Nepal)', 'flag' => 'np'],
['value' => 'ne','label' => 'Nepali', 'flag' => 'ne'],
['value' => 'nd_ZW','label' => 'North Ndebele (Zimbabwe)', 'flag' => 'zw'],
['value' => 'nd','label' => 'North Ndebele', 'flag' => 'nd'],
['value' => 'nb_NO','label' => 'Norwegian Bokmål (Norway)', 'flag' => 'no'],
['value' => 'nb','label' => 'Norwegian Bokmål', 'flag' => 'nb'],
['value' => 'nn_NO','label' => 'Norwegian Nynorsk (Norway)', 'flag' => 'no'],
['value' => 'nn','label' => 'Norwegian Nynorsk', 'flag' => 'nn'],
['value' => 'nyn_UG','label' => 'Nyankole (Uganda)', 'flag' => 'ug'],
['value' => 'nyn','label' => 'Nyankole', 'flag' => 'nyn'],
['value' => 'or_IN','label' => 'Oriya (India)', 'flag' => 'in'],
['value' => 'or','label' => 'Oriya', 'flag' => 'or'],
['value' => 'om_ET','label' => 'Oromo (Ethiopia)', 'flag' => 'et'],
['value' => 'om_KE','label' => 'Oromo (Kenya)', 'flag' => 'ke'],
['value' => 'om','label' => 'Oromo', 'flag' => 'om'],
['value' => 'ps_AF','label' => 'Pashto (Afghanistan)', 'flag' => 'af'],
['value' => 'ps','label' => 'Pashto', 'flag' => 'ps'],
['value' => 'fa_AF','label' => 'Persian (Afghanistan)', 'flag' => 'af'],
['value' => 'fa_IR','label' => 'Persian (Iran)', 'flag' => 'ir'],
['value' => 'fa','label' => 'Persian', 'flag' => 'fa'],
['value' => 'pl_PL','label' => 'Polish (Poland)', 'flag' => 'pl'],
['value' => 'pl','label' => 'Polish', 'flag' => 'pl'],
['value' => 'pt_BR','label' => 'Portuguese (Brazil)', 'flag' => 'br'],
['value' => 'pt_GW','label' => 'Portuguese (Guinea-Bissau)', 'flag' => 'gw'],
['value' => 'pt_MZ','label' => 'Portuguese (Mozambique)', 'flag' => 'mz'],
['value' => 'pt_PT','label' => 'Portuguese (Portugal)', 'flag' => 'pt'],
['value' => 'pt','label' => 'Portuguese', 'flag' => 'pt'],
['value' => 'pa_Arab','label' => 'Punjabi (Arabic)', 'flag' => 'arab'],
['value' => 'pa_Arab_PK','label' => 'Punjabi (Arabic, Pakistan)', 'flag' => 'pk'],
['value' => 'pa_Guru','label' => 'Punjabi (Gurmukhi)', 'flag' => 'guru'],
['value' => 'pa_Guru_IN','label' => 'Punjabi (Gurmukhi, India)', 'flag' => 'in'],
['value' => 'pa','label' => 'Punjabi', 'flag' => 'pa'],
['value' => 'ro_MD','label' => 'Romanian (Moldova)', 'flag' => 'md'],
['value' => 'ro_RO','label' => 'Romanian (Romania)', 'flag' => 'ro'],
['value' => 'ro','label' => 'Romanian', 'flag' => 'ro'],
['value' => 'rm_CH','label' => 'Romansh (Switzerland)', 'flag' => 'ch'],
['value' => 'rm','label' => 'Romansh', 'flag' => 'rm'],
['value' => 'rof_TZ','label' => 'Rombo (Tanzania)', 'flag' => 'tz'],
['value' => 'rof','label' => 'Rombo', 'flag' => 'rof'],
['value' => 'ru_MD','label' => 'Russian (Moldova)', 'flag' => 'md'],
['value' => 'ru_RU','label' => 'Russian (Russia)', 'flag' => 'ru'],
['value' => 'ru_UA','label' => 'Russian (Ukraine)', 'flag' => 'ua'],
['value' => 'ru','label' => 'Russian', 'flag' => 'ru'],
['value' => 'rwk_TZ','label' => 'Rwa (Tanzania)', 'flag' => 'tz'],
['value' => 'rwk','label' => 'Rwa', 'flag' => 'rwk'],
['value' => 'saq_KE','label' => 'Samburu (Kenya)', 'flag' => 'ke'],
['value' => 'saq','label' => 'Samburu', 'flag' => 'saq'],
['value' => 'sg_CF','label' => 'Sango (Central African Republic)', 'flag' => 'cf'],
['value' => 'sg','label' => 'Sango', 'flag' => 'sg'],
['value' => 'seh_MZ','label' => 'Sena (Mozambique)', 'flag' => 'mz'],
['value' => 'seh','label' => 'Sena', 'flag' => 'seh'],
['value' => 'sr_Cyrl','label' => 'Serbian (Cyrillic)', 'flag' => 'cyrl'],
['value' => 'sr_Cyrl_BA','label' => 'Serbian (Cyrillic, Bosnia and Herzegovina)', 'flag' => 'ba'],
['value' => 'sr_Cyrl_ME','label' => 'Serbian (Cyrillic, Montenegro)', 'flag' => 'me'],
['value' => 'sr_Cyrl_RS','label' => 'Serbian (Cyrillic, Serbia)', 'flag' => 'rs'],
['value' => 'sr_Latn','label' => 'Serbian (Latin)', 'flag' => 'latn'],
['value' => 'sr_Latn_BA','label' => 'Serbian (Latin, Bosnia and Herzegovina)', 'flag' => 'ba'],
['value' => 'sr_Latn_ME','label' => 'Serbian (Latin, Montenegro)', 'flag' => 'me'],
['value' => 'sr_Latn_RS','label' => 'Serbian (Latin, Serbia)', 'flag' => 'rs'],
['value' => 'sr','label' => 'Serbian', 'flag' => 'sr'],
['value' => 'sn_ZW','label' => 'Shona (Zimbabwe)', 'flag' => 'zw'],
['value' => 'sn','label' => 'Shona', 'flag' => 'sn'],
['value' => 'ii_CN','label' => 'Sichuan Yi (China)', 'flag' => 'cn'],
['value' => 'ii','label' => 'Sichuan Yi', 'flag' => 'ii'],
['value' => 'si_LK','label' => 'Sinhala (Sri Lanka)', 'flag' => 'lk'],
['value' => 'si','label' => 'Sinhala', 'flag' => 'si'],
['value' => 'sk_SK','label' => 'Slovak (Slovakia)', 'flag' => 'sk'],
['value' => 'sk','label' => 'Slovak', 'flag' => 'sk'],
['value' => 'sl_SI','label' => 'Slovenian (Slovenia)', 'flag' => 'si'],
['value' => 'sl','label' => 'Slovenian', 'flag' => 'sl'],
['value' => 'xog_UG','label' => 'Soga (Uganda)', 'flag' => 'ug'],
['value' => 'xog','label' => 'Soga', 'flag' => 'xog'],
['value' => 'so_DJ','label' => 'Somali (Djibouti)', 'flag' => 'dj'],
['value' => 'so_ET','label' => 'Somali (Ethiopia)', 'flag' => 'et'],
['value' => 'so_KE','label' => 'Somali (Kenya)', 'flag' => 'ke'],
['value' => 'so_SO','label' => 'Somali (Somalia)', 'flag' => 'so'],
['value' => 'so','label' => 'Somali', 'flag' => 'so'],
['value' => 'es_AR','label' => 'Spanish (Argentina)', 'flag' => 'ar'],
['value' => 'es_BO','label' => 'Spanish (Bolivia)', 'flag' => 'bo'],
['value' => 'es_CL','label' => 'Spanish (Chile)', 'flag' => 'cl'],
['value' => 'es_CO','label' => 'Spanish (Colombia)', 'flag' => 'co'],
['value' => 'es_CR','label' => 'Spanish (Costa Rica)', 'flag' => 'cr'],
['value' => 'es_DO','label' => 'Spanish (Dominican Republic)', 'flag' => 'do'],
['value' => 'es_EC','label' => 'Spanish (Ecuador)', 'flag' => 'ec'],
['value' => 'es_SV','label' => 'Spanish (El Salvador)', 'flag' => 'sv'],
['value' => 'es_GQ','label' => 'Spanish (Equatorial Guinea)', 'flag' => 'gq'],
['value' => 'es_GT','label' => 'Spanish (Guatemala)', 'flag' => 'gt'],
['value' => 'es_HN','label' => 'Spanish (Honduras)', 'flag' => 'hn'],
['value' => 'es_419','label' => 'Spanish (Latin America)', 'flag' => '419'],
['value' => 'es_MX','label' => 'Spanish (Mexico)', 'flag' => 'mx'],
['value' => 'es_NI','label' => 'Spanish (Nicaragua)', 'flag' => 'ni'],
['value' => 'es_PA','label' => 'Spanish (Panama)', 'flag' => 'pa'],
['value' => 'es_PY','label' => 'Spanish (Paraguay)', 'flag' => 'py'],
['value' => 'es_PE','label' => 'Spanish (Peru)', 'flag' => 'pe'],
['value' => 'es_PR','label' => 'Spanish (Puerto Rico)', 'flag' => 'pr'],
['value' => 'es_ES','label' => 'Spanish (Spain)', 'flag' => 'es'],
//array('value' => 'es_US','label' => 'Spanish (United States)', 'flag' => 'us'),
['value' => 'es_UY','label' => 'Spanish (Uruguay)', 'flag' => 'uy'],
['value' => 'es_VE','label' => 'Spanish (Venezuela)', 'flag' => 've'],
['value' => 'es','label' => 'Spanish', 'flag' => 'es'],
['value' => 'sw_KE','label' => 'Swahili (Kenya)', 'flag' => 'ke'],
['value' => 'sw_TZ','label' => 'Swahili (Tanzania)', 'flag' => 'tz'],
['value' => 'sw','label' => 'Swahili', 'flag' => 'sw'],
['value' => 'sv_FI','label' => 'Swedish (Finland)', 'flag' => 'fi'],
['value' => 'sv_SE','label' => 'Swedish (Sweden)', 'flag' => 'se'],
['value' => 'sv','label' => 'Swedish', 'flag' => 'sv'],
['value' => 'gsw_CH','label' => 'Swiss German (Switzerland)', 'flag' => 'ch'],
['value' => 'gsw','label' => 'Swiss German', 'flag' => 'gsw'],
['value' => 'shi_Latn','label' => 'Tachelhit (Latin)', 'flag' => 'latn'],
['value' => 'shi_Latn_MA','label' => 'Tachelhit (Latin, Morocco)', 'flag' => 'ma'],
['value' => 'shi_Tfng','label' => 'Tachelhit (Tifinagh)', 'flag' => 'tfng'],
['value' => 'shi_Tfng_MA','label' => 'Tachelhit (Tifinagh, Morocco)', 'flag' => 'ma'],
['value' => 'shi','label' => 'Tachelhit', 'flag' => 'shi'],
['value' => 'dav_KE','label' => 'Taita (Kenya)', 'flag' => 'ke'],
['value' => 'dav','label' => 'Taita', 'flag' => 'dav'],
['value' => 'ta_IN','label' => 'Tamil (India)', 'flag' => 'in'],
['value' => 'ta_LK','label' => 'Tamil (Sri Lanka)', 'flag' => 'lk'],
['value' => 'ta','label' => 'Tamil', 'flag' => 'ta'],
['value' => 'te_IN','label' => 'Telugu (India)', 'flag' => 'in'],
['value' => 'te','label' => 'Telugu', 'flag' => 'te'],
['value' => 'teo_KE','label' => 'Teso (Kenya)', 'flag' => 'ke'],
['value' => 'teo_UG','label' => 'Teso (Uganda)', 'flag' => 'ug'],
['value' => 'teo','label' => 'Teso', 'flag' => 'teo'],
['value' => 'th_TH','label' => 'Thai (Thailand)', 'flag' => 'th'],
['value' => 'th','label' => 'Thai', 'flag' => 'th'],
['value' => 'bo_CN','label' => 'Tibetan (China)', 'flag' => 'cn'],
['value' => 'bo_IN','label' => 'Tibetan (India)', 'flag' => 'in'],
['value' => 'bo','label' => 'Tibetan', 'flag' => 'bo'],
['value' => 'ti_ER','label' => 'Tigrinya (Eritrea)', 'flag' => 'er'],
['value' => 'ti_ET','label' => 'Tigrinya (Ethiopia)', 'flag' => 'et'],
['value' => 'ti','label' => 'Tigrinya', 'flag' => 'ti'],
['value' => 'to_TO','label' => 'Tonga (Tonga)', 'flag' => 'to'],
['value' => 'to','label' => 'Tonga', 'flag' => 'to'],
['value' => 'tr_TR','label' => 'Turkish (Turkey)', 'flag' => 'tr'],
['value' => 'tr','label' => 'Turkish', 'flag' => 'tr'],
['value' => 'uk_UA','label' => 'Ukrainian (Ukraine)', 'flag' => 'ua'],
['value' => 'uk','label' => 'Ukrainian', 'flag' => 'uk'],
['value' => 'ur_IN','label' => 'Urdu (India)', 'flag' => 'in'],
['value' => 'ur_PK','label' => 'Urdu (Pakistan)', 'flag' => 'pk'],
['value' => 'ur','label' => 'Urdu', 'flag' => 'ur'],
['value' => 'uz_Arab','label' => 'Uzbek (Arabic)', 'flag' => 'arab'],
['value' => 'uz_Arab_AF','label' => 'Uzbek (Arabic, Afghanistan)', 'flag' => 'af'],
['value' => 'uz_Cyrl','label' => 'Uzbek (Cyrillic)', 'flag' => 'cyrl'],
['value' => 'uz_Cyrl_UZ','label' => 'Uzbek (Cyrillic, Uzbekistan)', 'flag' => 'uz'],
['value' => 'uz_Latn','label' => 'Uzbek (Latin)', 'flag' => 'latn'],
['value' => 'uz_Latn_UZ','label' => 'Uzbek (Latin, Uzbekistan)', 'flag' => 'uz'],
['value' => 'uz','label' => 'Uzbek', 'flag' => 'uz'],
['value' => 'vi_VN','label' => 'Vietnamese (Vietnam)', 'flag' => 'vn'],
['value' => 'vi','label' => 'Vietnamese', 'flag' => 'vi'],
['value' => 'vun_TZ','label' => 'Vunjo (Tanzania)', 'flag' => 'tz'],
['value' => 'vun','label' => 'Vunjo', 'flag' => 'vun'],
['value' => 'cy_GB','label' => 'Welsh (United Kingdom)', 'flag' => 'gb'],
['value' => 'cy','label' => 'Welsh', 'flag' => 'cy'],
['value' => 'yo_NG','label' => 'Yoruba (Nigeria)', 'flag' => 'ng'],
['value' => 'yo','label' => 'Yoruba', 'flag' => 'yo'],
['value' => 'zu_ZA','label' => 'Zulu (South Africa)', 'flag' => 'za'],
['value' => 'zu','label' => 'Zulu', 'flag' => 'zu']
];
$global['bcp47'] = [];
$global['langs_codes_values'] = [];
$global['langs_codes_values_withdot'] = [];
foreach ($global['langs_codes'] as $value) {
$global['bcp47'][$value['value']] = $value;
$global['flag2Lang'][$value['flag']] = $value['value'];
$global['langs_codes_values'][] = $value['value'];
$global['langs_codes_values_withdot'][] = '.' . $value['value'];
}
$global['flag2Lang']['en'] = 'en_US';
$global['flag2Lang']['us'] = 'en_US';
$global['js_availableLangs'] = 'var availableLangs = ' . json_encode($global['langs_codes']) . ';';

View file

@ -1,88 +1,89 @@
<?php
class BootGrid {
static function getSqlFromPost($searchFieldsNames = array(), $keyPrefix = "", $alternativeOrderBy = "", $doNotSearch=false, $FIND_IN_SET = "") {
if(empty($doNotSearch)){
$sql = self::getSqlSearchFromPost($searchFieldsNames);
}else{
$sql = "";
}
if(empty($_POST['sort']) && !empty($_GET['order'][0]['dir'])){
$index = intval($_GET['order'][0]['column']);
$_GET['columns'][$index]['data'];
$_POST['sort'][$_GET['columns'][$index]['data']] = $_GET['order'][0]['dir'];
}
if(!empty($FIND_IN_SET)){
$sql .= " ORDER BY FIND_IN_SET({$FIND_IN_SET}) DESC ";
}else if (!empty($_POST['sort'])) {
$orderBy = array();
foreach ($_POST['sort'] as $key => $value) {
$direction = "ASC";
if(strtoupper($value)==="DESC"){
$direction = "DESC";
}
$key = preg_replace("/[^A-Za-z0-9._ ]/", '', $key);
if($key=='order'){
$key = '`order`';
}
$orderBy[] = " {$keyPrefix}{$key} {$direction} ";
}
$sql .= " ORDER BY ".implode(",", $orderBy);
} else {
$sql .= $alternativeOrderBy;
}
$rowCount = getRowCount();
$current = getCurrentPage();
$currentP = ($current-1)*$rowCount;
if($rowCount>0){
$sql .= " LIMIT $currentP, {$rowCount} ";
}
return $sql;
}
static function getSqlSearchFromPost($searchFieldsNames = array(), $connection = "AND") {
$sql = "";
if (!empty($_GET['searchPhrase'])) {
$_POST['searchPhrase'] = $_GET['searchPhrase'];
} else if (!empty($_GET['search']['value'])) {
$_POST['searchPhrase'] = $_GET['search']['value'];
}else if (!empty($_GET['q'])) {
$_POST['searchPhrase'] = $_GET['q'];
}
if(!empty($_POST['searchPhrase'])){
global $global;
$search = $global['mysqli']->real_escape_string(xss_esc($_POST['searchPhrase']));
$search = str_replace('&quot;', '"', $search);
$like = array();
foreach ($searchFieldsNames as $value) {
if(preg_match('/description/', $value)){
//$like[] = " {$value} regexp '\\b{$search}\\b' ";// not sure why was using regexp
$like[] = " {$value} LIKE '%{$search}%' ";
}else{
$like[] = " {$value} LIKE '%{$search}%' ";
}
// for accent insensitive
if(preg_match('/description/', $value)){
$like[] = " CONVERT(CAST({$value} as BINARY) USING utf8) regexp '\\b{$search}\\b' ";
//$like[] = " CONVERT(CAST({$value} as BINARY) USING utf8) LIKE '%{$search}%' ";
}else{
$like[] = " CONVERT(CAST({$value} as BINARY) USING utf8) LIKE '%{$search}%' ";
}
}
if(!empty($like)){
$sql .= " {$connection} (". implode(" OR ", $like).")";
}else{
$sql .= " {$connection} 1=1 ";
}
}
return $sql;
}
}
<?php
class BootGrid
{
public static function getSqlFromPost($searchFieldsNames = [], $keyPrefix = "", $alternativeOrderBy = "", $doNotSearch=false, $FIND_IN_SET = "")
{
if (empty($doNotSearch)) {
$sql = self::getSqlSearchFromPost($searchFieldsNames);
} else {
$sql = '';
}
if (empty($_POST['sort']) && !empty($_GET['order'][0]['dir'])) {
$index = intval($_GET['order'][0]['column']);
$_GET['columns'][$index]['data'];
$_POST['sort'][$_GET['columns'][$index]['data']] = $_GET['order'][0]['dir'];
}
if (!empty($FIND_IN_SET)) {
$sql .= " ORDER BY FIND_IN_SET({$FIND_IN_SET}) DESC ";
} elseif (!empty($_POST['sort'])) {
$orderBy = [];
foreach ($_POST['sort'] as $key => $value) {
$direction = "ASC";
if (strtoupper($value)==="DESC") {
$direction = "DESC";
}
$key = preg_replace("/[^A-Za-z0-9._ ]/", '', $key);
if ($key=='order') {
$key = '`order`';
}
$orderBy[] = " {$keyPrefix}{$key} {$direction} ";
}
$sql .= " ORDER BY ".implode(",", $orderBy);
} else {
$sql .= $alternativeOrderBy;
}
$rowCount = getRowCount();
$current = getCurrentPage();
$currentP = ($current-1)*$rowCount;
if ($rowCount>0) {
$sql .= " LIMIT $currentP, {$rowCount} ";
}
return $sql;
}
public static function getSqlSearchFromPost($searchFieldsNames = [], $connection = "AND")
{
$sql = '';
if (!empty($_GET['searchPhrase'])) {
$_POST['searchPhrase'] = $_GET['searchPhrase'];
} elseif (!empty($_GET['search']['value'])) {
$_POST['searchPhrase'] = $_GET['search']['value'];
} elseif (!empty($_GET['q'])) {
$_POST['searchPhrase'] = $_GET['q'];
}
if (!empty($_POST['searchPhrase'])) {
global $global;
$search = $global['mysqli']->real_escape_string(xss_esc($_POST['searchPhrase']));
$search = str_replace('&quot;', '"', $search);
$like = [];
foreach ($searchFieldsNames as $value) {
if (preg_match('/description/', $value)) {
//$like[] = " {$value} regexp '\\b{$search}\\b' ";// not sure why was using regexp
$like[] = " {$value} LIKE '%{$search}%' ";
} else {
$like[] = " {$value} LIKE '%{$search}%' ";
}
// for accent insensitive
if (preg_match('/description/', $value)) {
$like[] = " CONVERT(CAST({$value} as BINARY) USING utf8) regexp '\\b{$search}\\b' ";
//$like[] = " CONVERT(CAST({$value} as BINARY) USING utf8) LIKE '%{$search}%' ";
} else {
$like[] = " CONVERT(CAST({$value} as BINARY) USING utf8) LIKE '%{$search}%' ";
}
}
if (!empty($like)) {
$sql .= " {$connection} (". implode(" OR ", $like).")";
} else {
$sql .= " {$connection} 1=1 ";
}
}
return $sql;
}
}

View file

@ -1,68 +1,74 @@
<?php
global $global, $config;
if(!isset($global['systemRootPath'])){
require_once '../videos/configuration.php';
}
class Captcha{
private $largura, $altura, $tamanho_fonte, $quantidade_letras;
function __construct($largura, $altura, $tamanho_fonte, $quantidade_letras) {
$this->largura = $largura;
$this->altura = $altura;
$this->tamanho_fonte = $tamanho_fonte;
$this->quantidade_letras = $quantidade_letras;
}
public function getCaptchaImage() {
global $global;
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
$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';
$palavra = substr(str_shuffle($letters), 0, ($this->quantidade_letras));
if(User::isAdmin()){
$palavra = "admin";
}
_session_start();
$_SESSION["palavra"] = $palavra; // atribui para a sessao a palavra gerada
//_error_log("getCaptchaImage: ".$palavra." - session_name ". session_name()." session_id: ". session_id());
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
}
imagejpeg($imagem); // gera a imagem
imagedestroy($imagem); // limpa a imagem da memoria
//_error_log("getCaptchaImage _SESSION[palavra] = ($_SESSION[palavra]) - session_name ". session_name()." session_id: ". session_id());
}
static public function validation($word) {
if(User::isAdmin()){
return true;
}
_session_start();
if(empty($_SESSION["palavra"])){
_error_log("Captcha validation Error: you type ({$word}) and session is empty - session_name ". session_name()." session_id: ". session_id());
return false;
}
$validation = (strcasecmp($word, $_SESSION["palavra"]) == 0);
if(!$validation){
_error_log("Captcha validation Error: you type ({$word}) and session is ({$_SESSION["palavra"]})- session_name ". session_name()." session_id: ". session_id());
}
return $validation;
}
}
<?php
global $global, $config;
if (!isset($global['systemRootPath'])) {
require_once '../videos/configuration.php';
}
class Captcha
{
private $largura;
private $altura;
private $tamanho_fonte;
private $quantidade_letras;
public function __construct($largura, $altura, $tamanho_fonte, $quantidade_letras)
{
$this->largura = $largura;
$this->altura = $altura;
$this->tamanho_fonte = $tamanho_fonte;
$this->quantidade_letras = $quantidade_letras;
}
public function getCaptchaImage()
{
global $global;
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
$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';
$palavra = substr(str_shuffle($letters), 0, ($this->quantidade_letras));
if (User::isAdmin()) {
$palavra = "admin";
}
_session_start();
$_SESSION["palavra"] = $palavra; // atribui para a sessao a palavra gerada
//_error_log("getCaptchaImage: ".$palavra." - session_name ". session_name()." session_id: ". session_id());
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
}
imagejpeg($imagem); // gera a imagem
imagedestroy($imagem); // limpa a imagem da memoria
//_error_log("getCaptchaImage _SESSION[palavra] = ($_SESSION[palavra]) - session_name ". session_name()." session_id: ". session_id());
}
public static function validation($word)
{
if (User::isAdmin()) {
return true;
}
_session_start();
if (empty($_SESSION["palavra"])) {
_error_log("Captcha validation Error: you type ({$word}) and session is empty - session_name ". session_name()." session_id: ". session_id());
return false;
}
$validation = (strcasecmp($word, $_SESSION["palavra"]) == 0);
if (!$validation) {
_error_log("Captcha validation Error: you type ({$word}) and session is ({$_SESSION["palavra"]})- session_name ". session_name()." session_id: ". session_id());
}
return $validation;
}
}

View file

@ -1,42 +1,42 @@
<?php
error_reporting(0);
global $global, $config;
if (!isset($global['systemRootPath'])) {
require_once '../videos/configuration.php';
}
require_once $global['systemRootPath'] . 'objects/category.php';
header('Access-Control-Allow-Origin: *');
header('Content-Type: application/json');
$_REQUEST['rowCount'] = getRowCount(1000);
$_REQUEST['current'] = getCurrentPage();
$categories = Category::getAllCategories(true);
$total = Category::getTotalCategories(true);
//$breaks = array('<br />', '<br>', '<br/>');
foreach ($categories as $key => $value) {
$categories[$key]['iconHtml'] = "<span class='$value[iconClass]'></span>";
//$categories[$key]['description'] = str_ireplace($breaks, "\r\n", $value['description']);
/*
$sql = "SELECT * FROM `category_type_cache` WHERE categoryId = ?";
$res = sqlDAL::readSql($sql,"i",array($value['id']));
$catTypeCache = sqlDAL::fetchAssoc($res);
sqlDAL::close($res);
if($catTypeCache!=false){
if($catTypeCache['manualSet']=="0"){
$categories[$key]['type'] = "3";
} else {
$categories[$key]['type'] = $catTypeCache['type'];
}
} else {
$categories[$key]['type'] = "3";
}
*
*/
}
if (empty($_POST['sort']) && empty($_GET['sort'])) {
array_multisort(array_column($categories, 'hierarchyAndName'), SORT_ASC, $categories);
}
echo '{ "current": '.getCurrentPage().',"rowCount": '.getRowCount().', "total": '.$total.', "rows":'. _json_encode($categories).'}';
<?php
error_reporting(0);
global $global, $config;
if (!isset($global['systemRootPath'])) {
require_once '../videos/configuration.php';
}
require_once $global['systemRootPath'] . 'objects/category.php';
header('Access-Control-Allow-Origin: *');
header('Content-Type: application/json');
$_REQUEST['rowCount'] = getRowCount(1000);
$_REQUEST['current'] = getCurrentPage();
$categories = Category::getAllCategories(true);
$total = Category::getTotalCategories(true);
//$breaks = array('<br />', '<br>', '<br/>');
foreach ($categories as $key => $value) {
$categories[$key]['iconHtml'] = "<span class='$value[iconClass]'></span>";
//$categories[$key]['description'] = str_ireplace($breaks, "\r\n", $value['description']);
/*
$sql = "SELECT * FROM `category_type_cache` WHERE categoryId = ?";
$res = sqlDAL::readSql($sql,"i",array($value['id']));
$catTypeCache = sqlDAL::fetchAssoc($res);
sqlDAL::close($res);
if($catTypeCache!=false){
if($catTypeCache['manualSet']=="0"){
$categories[$key]['type'] = "3";
} else {
$categories[$key]['type'] = $catTypeCache['type'];
}
} else {
$categories[$key]['type'] = "3";
}
*
*/
}
if (empty($_POST['sort']) && empty($_GET['sort'])) {
array_multisort(array_column($categories, 'hierarchyAndName'), SORT_ASC, $categories);
}
echo '{ "current": '.getCurrentPage().',"rowCount": '.getRowCount().', "total": '.$total.', "rows":'. _json_encode($categories).'}';

File diff suppressed because it is too large Load diff

View file

@ -1,48 +1,48 @@
<?php
error_reporting(0);
header('Content-Type: application/json');
global $global, $config;
if(!isset($global['systemRootPath'])){
require_once '../videos/configuration.php';
}
require_once $global['systemRootPath'] . 'objects/user.php';
require_once $global['systemRootPath'] . 'objects/category.php';
$obj = new stdClass();
$obj->error = true;
$obj->msg = true;
$obj->categories_id = 0;
$obj->image1 = 0;
$obj->image2 = 0;
if(!Category::canCreateCategory()){
$obj->msg = __("Permission denied");
die(json_encode($obj));
}
$objCat = new Category(intval(@$_POST['id']));
$objCat->setName($_POST['name']);
$objCat->setClean_name($_POST['clean_name']);
$objCat->setDescription($_POST['description']);
$objCat->setIconClass($_POST['iconClass']);
//$objCat->setNextVideoOrder($_POST['nextVideoOrder']);
$objCat->setSuggested($_POST['suggested']);
$objCat->setParentId($_POST['parentId']);
$objCat->setPrivate($_POST['private']);
$objCat->setAllow_download($_POST['allow_download']);
$objCat->setOrder($_POST['order']);
$obj->categories_id = $objCat->save();
//$objCat->setType($_POST['type'],$id);
if(!empty($obj->categories_id)){
$obj->error = false;
$path = Category::getCategoryPhotoPath($obj->categories_id);
$obj->image1 = saveCroppieImage($path['path'], "image1");
$obj->image1P = $path['path'];
$path = Category::getCategoryBackgroundPath($obj->categories_id);
$obj->image2 = saveCroppieImage($path['path'], "image2");
$obj->image2P = $path['path'];
}
die(json_encode($obj));
<?php
error_reporting(0);
header('Content-Type: application/json');
global $global, $config;
if (!isset($global['systemRootPath'])) {
require_once '../videos/configuration.php';
}
require_once $global['systemRootPath'] . 'objects/user.php';
require_once $global['systemRootPath'] . 'objects/category.php';
$obj = new stdClass();
$obj->error = true;
$obj->msg = true;
$obj->categories_id = 0;
$obj->image1 = 0;
$obj->image2 = 0;
if (!Category::canCreateCategory()) {
$obj->msg = __("Permission denied");
die(json_encode($obj));
}
$objCat = new Category(intval(@$_POST['id']));
$objCat->setName($_POST['name']);
$objCat->setClean_name($_POST['clean_name']);
$objCat->setDescription($_POST['description']);
$objCat->setIconClass($_POST['iconClass']);
//$objCat->setNextVideoOrder($_POST['nextVideoOrder']);
$objCat->setSuggested($_POST['suggested']);
$objCat->setParentId($_POST['parentId']);
$objCat->setPrivate($_POST['private']);
$objCat->setAllow_download($_POST['allow_download']);
$objCat->setOrder($_POST['order']);
$obj->categories_id = $objCat->save();
//$objCat->setType($_POST['type'],$id);
if (!empty($obj->categories_id)) {
$obj->error = false;
$path = Category::getCategoryPhotoPath($obj->categories_id);
$obj->image1 = saveCroppieImage($path['path'], "image1");
$obj->image1P = $path['path'];
$path = Category::getCategoryBackgroundPath($obj->categories_id);
$obj->image2 = saveCroppieImage($path['path'], "image2");
$obj->image2P = $path['path'];
}
die(json_encode($obj));

View file

@ -1,14 +1,14 @@
<?php
header('Content-Type: application/json');
global $global, $config;
if(!isset($global['systemRootPath'])){
require_once '../videos/configuration.php';
}
require_once $global['systemRootPath'] . 'objects/user.php';
require_once $global['systemRootPath'] . 'objects/category.php';
if(!Category::canCreateCategory()){
die('{"error":"'.__("Permission denied").'"}');
}
require_once 'category.php';
$obj = new Category($_POST['id']);
echo '{"status":"'.$obj->delete().'"}';
<?php
header('Content-Type: application/json');
global $global, $config;
if (!isset($global['systemRootPath'])) {
require_once '../videos/configuration.php';
}
require_once $global['systemRootPath'] . 'objects/user.php';
require_once $global['systemRootPath'] . 'objects/category.php';
if (!Category::canCreateCategory()) {
die('{"error":"'.__("Permission denied").'"}');
}
require_once 'category.php';
$obj = new Category($_POST['id']);
echo '{"status":"'.$obj->delete().'"}';

View file

@ -1,359 +1,359 @@
<?php
global $global, $config;
if (!isset($global['systemRootPath'])) {
require_once '../videos/configuration.php';
}
require_once $global['systemRootPath'] . 'objects/bootGrid.php';
require_once $global['systemRootPath'] . 'objects/user.php';
require_once $global['systemRootPath'] . 'objects/video.php';
class Comment
{
protected $id;
protected $comment;
protected $videos_id;
protected $users_id;
protected $comments_id_pai;
public function __construct($comment, $videos_id, $id = 0)
{
if (empty($id)) {
// get the comment data from comment
$this->comment = xss_esc($comment);
$this->videos_id = $videos_id;
$this->users_id = User::getId();
} else {
// get data from id
$this->load($id);
}
}
public function getId()
{
return $this->id;
}
public function setComments_id_pai($comments_id_pai)
{
$this->comments_id_pai = $comments_id_pai;
}
public function getComments_id_pai()
{
return $this->comments_id_pai;
}
public function getUsers_id()
{
return $this->users_id;
}
public function setComment($comment)
{
$this->comment = xss_esc($comment);
}
public function getVideos_id()
{
return $this->videos_id;
}
private function load($id)
{
$row = $this->getComment($id);
if (empty($row)) {
return false;
}
foreach ($row as $key => $value) {
$this->$key = $value;
}
return true;
}
public function save()
{
global $global;
if (!User::isLogged()) {
header('Content-Type: application/json');
die('{"error":"'.__("Permission denied").'"}');
}
//$this->comment = htmlentities($this->comment);
$this->comment = $global['mysqli']->real_escape_string($this->comment);
if (empty($this->comment)) {
return false;
}
if (empty($this->comments_id_pai)) {
$this->comments_id_pai = 'NULL';
}
if (empty($this->videos_id) && !empty($this->comments_id_pai)) {
$comment = new Comment("", 0, $this->comments_id_pai);
$this->videos_id = $comment->getVideos_id();
}
if (!empty($this->id)) {
if (!self::userCanAdminComment($this->id)) {
return false;
}
$sql = "UPDATE comments SET "
. " comment = ?, modified = now() WHERE id = ?";
$resp = sqlDAL::writeSql($sql, "si", array(xss_esc($this->comment),$this->id));
} else {
$id = User::getId();
$sql = "INSERT INTO comments ( comment,users_id, videos_id, comments_id_pai, created, modified) VALUES "
. " (?, ?, ?, {$this->comments_id_pai}, now(), now())";
$resp = sqlDAL::writeSql($sql, "sii", array(xss_esc($this->comment),$id,$this->videos_id));
}
if ((empty($resp))&&($global['mysqli']->errno!=0)) {
die('Error (comment save) : (' . $global['mysqli']->errno . ') ' . $global['mysqli']->error);
}
if (empty($this->id)) {
// log_error("note: insert_id works? ".$global['mysqli']->insert_id); // success!
$id = $global['mysqli']->insert_id;
$this->id = $id;
} else {
$id = $this->id;
}
if (empty($this->comments_id_pai) || $this->comments_id_pai== 'NULL') {
AVideoPlugin::afterNewComment($this->id);
} else {
AVideoPlugin::afterNewResponse($this->id);
}
return $resp;
}
public function delete()
{
if (!self::userCanAdminComment($this->id)) {
return false;
}
global $global;
if (!empty($this->id)) {
$sql = "DELETE FROM comments WHERE id = ?";
} else {
return false;
}
return sqlDAL::writeSql($sql, "i", array($this->id));
}
private function getComment($id)
{
global $global;
$id = intval($id);
$sql = "SELECT * FROM comments WHERE id = ? LIMIT 1";
$res = sqlDAL::readSql($sql, "i", array($id));
$result = sqlDAL::fetchAssoc($res);
sqlDAL::close($res);
return ($res!=false) ? $result : false;
}
public static function getAllComments($videoId = 0, $comments_id_pai = 'NULL')
{
global $global;
$format = "";
$values = array();
$sql = "SELECT c.*, u.name as name, u.user as user, "
. " (SELECT count(id) FROM comments_likes as l where l.comments_id = c.id AND `like` = 1 ) as likes, "
. " (SELECT count(id) FROM comments_likes as l where l.comments_id = c.id AND `like` = -1 ) as dislikes ";
if (User::isLogged()) {
$sql .= ", (SELECT `like` FROM comments_likes as l where l.comments_id = c.id AND users_id = ? ) as myVote ";
$format .= "i";
$values[]=User::getId();
} else {
$sql .= ", 0 as myVote ";
}
$sql .= " FROM comments c LEFT JOIN users as u ON u.id = users_id LEFT JOIN videos as v ON v.id = videos_id WHERE 1=1 ";
if (!empty($videoId)) {
$sql .= " AND videos_id = ? ";
$format .= "i";
$values[] = $videoId;
} elseif (!Permissions::canAdminComment() && empty($comments_id_pai)) {
if (!User::isLogged()) {
die("can not see comments");
}
$users_id = User::getId();
$sql .= " AND (v.users_id = ? OR c.users_id = ?) ";
$format .= "ii";
$values[]=$users_id;
$values[]=$users_id;
}
if ($comments_id_pai==='NULL' || empty($comments_id_pai)) {
$sql .= " AND (comments_id_pai IS NULL ";
if (empty($videoId) && User::isLogged()) {
$users_id = User::getId();
$sql .= " OR c.users_id = ? ";
$format .= "i";
$values[]=$users_id;
}
$sql .= ") ";
} else {
$sql .= " AND comments_id_pai = ? ";
$format .= "s";
$values[]=$comments_id_pai;
}
$sql .= BootGrid::getSqlFromPost(array('name'));
$res = sqlDAL::readSql($sql, $format, $values);
$allData = sqlDAL::fetchAllAssoc($res);
sqlDAL::close($res);
$comment = array();
if ($res!=false) {
foreach ($allData as $row) {
$row = cleanUpRowFromDatabase($row);
$row['comment'] = str_replace('\n', "\n", $row['comment']);
$row['commentPlain'] = xss_esc_back($row['comment']);
$row['commentHTML'] = nl2br($row['commentPlain']);
$comment[] = $row;
}
//$comment = $res->fetch_all(MYSQLI_ASSOC);
} else {
$comment = false;
die($sql.'\nError : (' . $global['mysqli']->errno . ') ' . $global['mysqli']->error);
}
return $comment;
}
public static function getTotalComments($videoId = 0, $comments_id_pai = 'NULL', $video_owner_users_id=0)
{
global $global;
$format = "";
$values = array();
$sql = "SELECT c.id FROM comments c LEFT JOIN users as u ON u.id = users_id LEFT JOIN videos as v ON v.id = videos_id WHERE 1=1 ";
if (!empty($videoId)) {
$sql .= " AND videos_id = ? ";
$format .= "i";
$values[] = $videoId;
} elseif (!Permissions::canAdminComment() && empty($comments_id_pai)) {
if (!User::isLogged()) {
die("can not see comments");
}
$users_id = User::getId();
$sql .= " AND (v.users_id = ? OR c.users_id = ?) ";
$format .= "ii";
$values[] = $users_id;
$values[] = $users_id;
}
if ($comments_id_pai==='NULL' || empty($comments_id_pai)) {
$sql .= " AND (comments_id_pai IS NULL ";
if (empty($videoId) && User::isLogged()) {
$users_id = User::getId();
$sql .= " OR c.users_id = ? ";
$format .= "i";
$values[] = $users_id;
}
$sql .= ") ";
} else {
$sql .= " AND comments_id_pai = ? ";
$format .= "s";
$values[] = $comments_id_pai;
}
if (!empty($video_owner_users_id)) {
$sql .= " AND v.users_id = ? ";
$format .= "i";
$values[] = $video_owner_users_id;
}
$sql .= BootGrid::getSqlSearchFromPost(array('name'));
$res = sqlDAL::readSql($sql, $format, $values);
$countRow = sqlDAL::num_rows($res);
sqlDAL::close($res);
return $countRow;
}
public static function userCanAdminComment($comments_id)
{
if (!User::isLogged()) {
return false;
}
if (Permissions::canAdminComment()) {
return true;
}
$obj = new Comment("", 0, $comments_id);
if ($obj->users_id == User::getId()) {
return true;
}
$video = new Video("", "", $obj->videos_id);
if ($video->getUsers_id() == User::getId()) {
return true;
}
return false;
}
public static function userCanEditComment($comments_id)
{
if (!User::isLogged()) {
return false;
}
if (Permissions::canAdminComment()) {
return true;
}
$obj = new Comment("", 0, $comments_id);
if ($obj->users_id == User::getId()) {
return true;
}
return false;
}
public static function getTotalCommentsThumbsUpFromUser($users_id, $startDate, $endDate)
{
global $global;
$sql = "SELECT id from comments WHERE users_id = ?";
$res = sqlDAL::readSql($sql, "i", array($users_id));
$fullData = sqlDAL::fetchAllAssoc($res);
sqlDAL::close($res);
$r = array('thumbsUp'=>0, 'thumbsDown'=>0 );
if ($res!=false) {
foreach ($fullData as $row) {
$format = "i";
$values = array($row['id']);
$sql = "SELECT id from comments_likes WHERE comments_id = ? AND `like` = 1 ";
if (!empty($startDate)) {
$sql .= " AND `created` >= ? ";
$format .= "s";
$values[] = $startDate;
}
if (!empty($endDate)) {
$sql .= " AND `created` <= ? ";
$format .= "s";
$values[] = $endDate;
}
$res = sqlDAL::readSql($sql, $format, $values);
$countRow = sqlDAL::num_rows($res);
sqlDAL::close($res);
$r['thumbsUp']+=$countRow;
$format = "i";
$values = array($row['id']);
$sql = "SELECT id from comments_likes WHERE comments_id = ? AND `like` = -1 ";
if (!empty($startDate)) {
$sql .= " AND `created` >= ? ";
$format .= "s";
$values[] = $startDate;
}
if (!empty($endDate)) {
$sql .= " AND `created` <= ? ";
$format .= "s";
$values[] = $endDate;
}
$res = sqlDAL::readSql($sql, $format, $values);
$countRow = sqlDAL::num_rows($res);
sqlDAL::close($res);
$r['thumbsDown']+=$countRow;
}
}
return $r;
}
}
<?php
global $global, $config;
if (!isset($global['systemRootPath'])) {
require_once '../videos/configuration.php';
}
require_once $global['systemRootPath'] . 'objects/bootGrid.php';
require_once $global['systemRootPath'] . 'objects/user.php';
require_once $global['systemRootPath'] . 'objects/video.php';
class Comment
{
protected $id;
protected $comment;
protected $videos_id;
protected $users_id;
protected $comments_id_pai;
public function __construct($comment, $videos_id, $id = 0)
{
if (empty($id)) {
// get the comment data from comment
$this->comment = xss_esc($comment);
$this->videos_id = $videos_id;
$this->users_id = User::getId();
} else {
// get data from id
$this->load($id);
}
}
public function getId()
{
return $this->id;
}
public function setComments_id_pai($comments_id_pai)
{
$this->comments_id_pai = $comments_id_pai;
}
public function getComments_id_pai()
{
return $this->comments_id_pai;
}
public function getUsers_id()
{
return $this->users_id;
}
public function setComment($comment)
{
$this->comment = xss_esc($comment);
}
public function getVideos_id()
{
return $this->videos_id;
}
private function load($id)
{
$row = $this->getComment($id);
if (empty($row)) {
return false;
}
foreach ($row as $key => $value) {
$this->$key = $value;
}
return true;
}
public function save()
{
global $global;
if (!User::isLogged()) {
header('Content-Type: application/json');
die('{"error":"'.__("Permission denied").'"}');
}
//$this->comment = htmlentities($this->comment);
$this->comment = $global['mysqli']->real_escape_string($this->comment);
if (empty($this->comment)) {
return false;
}
if (empty($this->comments_id_pai)) {
$this->comments_id_pai = 'NULL';
}
if (empty($this->videos_id) && !empty($this->comments_id_pai)) {
$comment = new Comment("", 0, $this->comments_id_pai);
$this->videos_id = $comment->getVideos_id();
}
if (!empty($this->id)) {
if (!self::userCanAdminComment($this->id)) {
return false;
}
$sql = "UPDATE comments SET "
. " comment = ?, modified = now() WHERE id = ?";
$resp = sqlDAL::writeSql($sql, "si", [xss_esc($this->comment),$this->id]);
} else {
$id = User::getId();
$sql = "INSERT INTO comments ( comment,users_id, videos_id, comments_id_pai, created, modified) VALUES "
. " (?, ?, ?, {$this->comments_id_pai}, now(), now())";
$resp = sqlDAL::writeSql($sql, "sii", [xss_esc($this->comment),$id,$this->videos_id]);
}
if ((empty($resp))&&($global['mysqli']->errno!=0)) {
die('Error (comment save) : (' . $global['mysqli']->errno . ') ' . $global['mysqli']->error);
}
if (empty($this->id)) {
// log_error("note: insert_id works? ".$global['mysqli']->insert_id); // success!
$id = $global['mysqli']->insert_id;
$this->id = $id;
} else {
$id = $this->id;
}
if (empty($this->comments_id_pai) || $this->comments_id_pai== 'NULL') {
AVideoPlugin::afterNewComment($this->id);
} else {
AVideoPlugin::afterNewResponse($this->id);
}
return $resp;
}
public function delete()
{
if (!self::userCanAdminComment($this->id)) {
return false;
}
global $global;
if (!empty($this->id)) {
$sql = "DELETE FROM comments WHERE id = ?";
} else {
return false;
}
return sqlDAL::writeSql($sql, "i", [$this->id]);
}
private function getComment($id)
{
global $global;
$id = intval($id);
$sql = "SELECT * FROM comments WHERE id = ? LIMIT 1";
$res = sqlDAL::readSql($sql, "i", [$id]);
$result = sqlDAL::fetchAssoc($res);
sqlDAL::close($res);
return ($res!=false) ? $result : false;
}
public static function getAllComments($videoId = 0, $comments_id_pai = 'NULL')
{
global $global;
$format = '';
$values = [];
$sql = "SELECT c.*, u.name as name, u.user as user, "
. " (SELECT count(id) FROM comments_likes as l where l.comments_id = c.id AND `like` = 1 ) as likes, "
. " (SELECT count(id) FROM comments_likes as l where l.comments_id = c.id AND `like` = -1 ) as dislikes ";
if (User::isLogged()) {
$sql .= ", (SELECT `like` FROM comments_likes as l where l.comments_id = c.id AND users_id = ? ) as myVote ";
$format .= "i";
$values[]=User::getId();
} else {
$sql .= ", 0 as myVote ";
}
$sql .= " FROM comments c LEFT JOIN users as u ON u.id = users_id LEFT JOIN videos as v ON v.id = videos_id WHERE 1=1 ";
if (!empty($videoId)) {
$sql .= " AND videos_id = ? ";
$format .= "i";
$values[] = $videoId;
} elseif (!Permissions::canAdminComment() && empty($comments_id_pai)) {
if (!User::isLogged()) {
die("can not see comments");
}
$users_id = User::getId();
$sql .= " AND (v.users_id = ? OR c.users_id = ?) ";
$format .= "ii";
$values[]=$users_id;
$values[]=$users_id;
}
if ($comments_id_pai==='NULL' || empty($comments_id_pai)) {
$sql .= " AND (comments_id_pai IS NULL ";
if (empty($videoId) && User::isLogged()) {
$users_id = User::getId();
$sql .= " OR c.users_id = ? ";
$format .= "i";
$values[]=$users_id;
}
$sql .= ") ";
} else {
$sql .= " AND comments_id_pai = ? ";
$format .= "s";
$values[]=$comments_id_pai;
}
$sql .= BootGrid::getSqlFromPost(['name']);
$res = sqlDAL::readSql($sql, $format, $values);
$allData = sqlDAL::fetchAllAssoc($res);
sqlDAL::close($res);
$comment = [];
if ($res!=false) {
foreach ($allData as $row) {
$row = cleanUpRowFromDatabase($row);
$row['comment'] = str_replace('\n', "\n", $row['comment']);
$row['commentPlain'] = xss_esc_back($row['comment']);
$row['commentHTML'] = nl2br($row['commentPlain']);
$comment[] = $row;
}
//$comment = $res->fetch_all(MYSQLI_ASSOC);
} else {
$comment = false;
die($sql.'\nError : (' . $global['mysqli']->errno . ') ' . $global['mysqli']->error);
}
return $comment;
}
public static function getTotalComments($videoId = 0, $comments_id_pai = 'NULL', $video_owner_users_id=0)
{
global $global;
$format = '';
$values = [];
$sql = "SELECT c.id FROM comments c LEFT JOIN users as u ON u.id = users_id LEFT JOIN videos as v ON v.id = videos_id WHERE 1=1 ";
if (!empty($videoId)) {
$sql .= " AND videos_id = ? ";
$format .= "i";
$values[] = $videoId;
} elseif (!Permissions::canAdminComment() && empty($comments_id_pai)) {
if (!User::isLogged()) {
die("can not see comments");
}
$users_id = User::getId();
$sql .= " AND (v.users_id = ? OR c.users_id = ?) ";
$format .= "ii";
$values[] = $users_id;
$values[] = $users_id;
}
if ($comments_id_pai==='NULL' || empty($comments_id_pai)) {
$sql .= " AND (comments_id_pai IS NULL ";
if (empty($videoId) && User::isLogged()) {
$users_id = User::getId();
$sql .= " OR c.users_id = ? ";
$format .= "i";
$values[] = $users_id;
}
$sql .= ") ";
} else {
$sql .= " AND comments_id_pai = ? ";
$format .= "s";
$values[] = $comments_id_pai;
}
if (!empty($video_owner_users_id)) {
$sql .= " AND v.users_id = ? ";
$format .= "i";
$values[] = $video_owner_users_id;
}
$sql .= BootGrid::getSqlSearchFromPost(['name']);
$res = sqlDAL::readSql($sql, $format, $values);
$countRow = sqlDAL::num_rows($res);
sqlDAL::close($res);
return $countRow;
}
public static function userCanAdminComment($comments_id)
{
if (!User::isLogged()) {
return false;
}
if (Permissions::canAdminComment()) {
return true;
}
$obj = new Comment("", 0, $comments_id);
if ($obj->users_id == User::getId()) {
return true;
}
$video = new Video("", "", $obj->videos_id);
if ($video->getUsers_id() == User::getId()) {
return true;
}
return false;
}
public static function userCanEditComment($comments_id)
{
if (!User::isLogged()) {
return false;
}
if (Permissions::canAdminComment()) {
return true;
}
$obj = new Comment("", 0, $comments_id);
if ($obj->users_id == User::getId()) {
return true;
}
return false;
}
public static function getTotalCommentsThumbsUpFromUser($users_id, $startDate, $endDate)
{
global $global;
$sql = "SELECT id from comments WHERE users_id = ?";
$res = sqlDAL::readSql($sql, "i", [$users_id]);
$fullData = sqlDAL::fetchAllAssoc($res);
sqlDAL::close($res);
$r = ['thumbsUp'=>0, 'thumbsDown'=>0 ];
if ($res!=false) {
foreach ($fullData as $row) {
$format = "i";
$values = [$row['id']];
$sql = "SELECT id from comments_likes WHERE comments_id = ? AND `like` = 1 ";
if (!empty($startDate)) {
$sql .= " AND `created` >= ? ";
$format .= "s";
$values[] = $startDate;
}
if (!empty($endDate)) {
$sql .= " AND `created` <= ? ";
$format .= "s";
$values[] = $endDate;
}
$res = sqlDAL::readSql($sql, $format, $values);
$countRow = sqlDAL::num_rows($res);
sqlDAL::close($res);
$r['thumbsUp']+=$countRow;
$format = "i";
$values = [$row['id']];
$sql = "SELECT id from comments_likes WHERE comments_id = ? AND `like` = -1 ";
if (!empty($startDate)) {
$sql .= " AND `created` >= ? ";
$format .= "s";
$values[] = $startDate;
}
if (!empty($endDate)) {
$sql .= " AND `created` <= ? ";
$format .= "s";
$values[] = $endDate;
}
$res = sqlDAL::readSql($sql, $format, $values);
$countRow = sqlDAL::num_rows($res);
sqlDAL::close($res);
$r['thumbsDown']+=$countRow;
}
}
return $r;
}
}

View file

@ -1,128 +1,129 @@
<?php
header('Access-Control-Allow-Origin: *');
header("Access-Control-Allow-Headers: Content-Type");
header('Content-Type: application/json');
global $global, $config;
if(!isset($global['systemRootPath'])){
require_once '../videos/configuration.php';
}
$_REQUEST['comments_id'] = intval(@$_REQUEST['comments_id']);
require_once $global['systemRootPath'] . 'objects/user.php';
require_once $global['systemRootPath'] . 'objects/functions.php';
// gettig the mobile submited value
$inputJSON = url_get_contents('php://input');
$input = _json_decode($inputJSON, TRUE); //convert JSON into array
unset($_REQUEST["redirectUri"]);
if(!empty($input) && empty($_REQUEST)){
foreach ($input as $key => $value) {
$_REQUEST[$key]=$value;
}
}
if(!empty($_REQUEST['user']) && !empty($_REQUEST['pass'])){
$user = new User(0, $_REQUEST['user'], $_REQUEST['pass']);
$user->login(false, true);
}
$obj = new stdClass();
$obj->error = true;
$obj->msg = '';
if (!User::canComment()) {
$obj->msg = __("Permission denied");
die(json_encode($obj));
}
function isCommentASpam($comment, $videos_id){
$comment = trim($comment);
$obj = new stdClass();
$obj->error = true;
$obj->msg = '';
$obj->time = time();
if(empty($comment)){
$obj->msg = __('Comment is empty');
return $obj;
}
if(empty($videos_id)){
$obj->msg = __('Video is empty');
return $obj;
}
_session_start();
if(!isset($_SESSION['comments'])){
$_SESSION['comments'] = array();
}
// you can only comment each 5 seconds
$rest = $_SESSION['comments']['_avideo_last_comment'] - ($obj->time-5);
if($rest>0){
$obj->msg = __('You just comment something, please wait to comment again').', '.$rest.' '.__('Seconds');
return $obj;
}
// if you already comment 3 times or more on the same video you must wait 30 seconds
if($_SESSION['comments']['_avideo_count_comments_'.$videos_id]>3){
$rest = $_SESSION['comments']['_avideo_last_comment'] - ($obj->time-30);
if($rest>0){
$obj->msg = __('You just comment something, please wait to comment again').', '.$rest.' '.__('Seconds');
return $obj;
}
}
$index = preg_replace('/[^0-9a-z]/i', '', $comment);
$obj->index = $index;
// you can only repeat the comment (equal or similar) each 60 seconds
if(!empty($_SESSION['comments'][$index])){
$rest = $_SESSION['comments'][$index]->time - ($obj->time-60);
if($rest>0){
$obj->msg = __('You just comment something similar, please wait to comment again').', '.$rest.' '.__('Seconds');
return $obj;
}
}
if(empty($_SESSION['comments']['_avideo_count_comments_'.$videos_id])){
$_SESSION['comments']['_avideo_count_comments_'.$videos_id] = 1;
}else{
$_SESSION['comments']['_avideo_count_comments_'.$videos_id]++;
}
$_SESSION['comments']['_avideo_last_comment'] = $obj->time;
$obj->error = false;
$_SESSION['comments'][$index] = $obj;
return $obj;
}
require_once 'comment.php';
if(empty($_REQUEST['video']) && !empty($_REQUEST['comments_id'])){
$c = new Comment('', '', $_REQUEST['comments_id']);
$_REQUEST['video'] = $c->getVideos_id();
}
$isSpam = isCommentASpam($_REQUEST['comment'], $_REQUEST['video']);
if($isSpam->error){
$obj->msg = $isSpam->msg;
die(json_encode($obj));
}
if(!empty($_REQUEST['id'])){
$_REQUEST['id'] = intval($_REQUEST['id']);
if(Comment::userCanEditComment($_REQUEST['id'])){
$objC = new Comment("", 0, $_REQUEST['id']);
$objC->setComment($_REQUEST['comment']);
}
}else{
$objC = new Comment($_REQUEST['comment'], $_REQUEST['video']);
$objC->setComments_id_pai($_REQUEST['comments_id']);
}
$obj->comments_id = $objC->save();
if(!empty($obj->comments_id)){
$obj->error = false;
$obj->msg = __("Your comment has been saved!");
}else{
$obj->msg = __("Your comment has NOT been saved!");
}
die(json_encode($obj));
<?php
header('Access-Control-Allow-Origin: *');
header("Access-Control-Allow-Headers: Content-Type");
header('Content-Type: application/json');
global $global, $config;
if (!isset($global['systemRootPath'])) {
require_once '../videos/configuration.php';
}
$_REQUEST['comments_id'] = intval(@$_REQUEST['comments_id']);
require_once $global['systemRootPath'] . 'objects/user.php';
require_once $global['systemRootPath'] . 'objects/functions.php';
// gettig the mobile submited value
$inputJSON = url_get_contents('php://input');
$input = _json_decode($inputJSON, true); //convert JSON into array
unset($_REQUEST["redirectUri"]);
if (!empty($input) && empty($_REQUEST)) {
foreach ($input as $key => $value) {
$_REQUEST[$key]=$value;
}
}
if (!empty($_REQUEST['user']) && !empty($_REQUEST['pass'])) {
$user = new User(0, $_REQUEST['user'], $_REQUEST['pass']);
$user->login(false, true);
}
$obj = new stdClass();
$obj->error = true;
$obj->msg = '';
if (!User::canComment()) {
$obj->msg = __("Permission denied");
die(json_encode($obj));
}
function isCommentASpam($comment, $videos_id)
{
$comment = trim($comment);
$obj = new stdClass();
$obj->error = true;
$obj->msg = '';
$obj->time = time();
if (empty($comment)) {
$obj->msg = __('Comment is empty');
return $obj;
}
if (empty($videos_id)) {
$obj->msg = __('Video is empty');
return $obj;
}
_session_start();
if (!isset($_SESSION['comments'])) {
$_SESSION['comments'] = [];
}
// you can only comment each 5 seconds
$rest = $_SESSION['comments']['_avideo_last_comment'] - ($obj->time-5);
if ($rest>0) {
$obj->msg = __('You just comment something, please wait to comment again').', '.$rest.' '.__('Seconds');
return $obj;
}
// if you already comment 3 times or more on the same video you must wait 30 seconds
if ($_SESSION['comments']['_avideo_count_comments_'.$videos_id]>3) {
$rest = $_SESSION['comments']['_avideo_last_comment'] - ($obj->time-30);
if ($rest>0) {
$obj->msg = __('You just comment something, please wait to comment again').', '.$rest.' '.__('Seconds');
return $obj;
}
}
$index = preg_replace('/[^0-9a-z]/i', '', $comment);
$obj->index = $index;
// you can only repeat the comment (equal or similar) each 60 seconds
if (!empty($_SESSION['comments'][$index])) {
$rest = $_SESSION['comments'][$index]->time - ($obj->time-60);
if ($rest>0) {
$obj->msg = __('You just comment something similar, please wait to comment again').', '.$rest.' '.__('Seconds');
return $obj;
}
}
if (empty($_SESSION['comments']['_avideo_count_comments_'.$videos_id])) {
$_SESSION['comments']['_avideo_count_comments_'.$videos_id] = 1;
} else {
$_SESSION['comments']['_avideo_count_comments_'.$videos_id]++;
}
$_SESSION['comments']['_avideo_last_comment'] = $obj->time;
$obj->error = false;
$_SESSION['comments'][$index] = $obj;
return $obj;
}
require_once 'comment.php';
if (empty($_REQUEST['video']) && !empty($_REQUEST['comments_id'])) {
$c = new Comment('', '', $_REQUEST['comments_id']);
$_REQUEST['video'] = $c->getVideos_id();
}
$isSpam = isCommentASpam($_REQUEST['comment'], $_REQUEST['video']);
if ($isSpam->error) {
$obj->msg = $isSpam->msg;
die(json_encode($obj));
}
if (!empty($_REQUEST['id'])) {
$_REQUEST['id'] = intval($_REQUEST['id']);
if (Comment::userCanEditComment($_REQUEST['id'])) {
$objC = new Comment("", 0, $_REQUEST['id']);
$objC->setComment($_REQUEST['comment']);
}
} else {
$objC = new Comment($_REQUEST['comment'], $_REQUEST['video']);
$objC->setComments_id_pai($_REQUEST['comments_id']);
}
$obj->comments_id = $objC->save();
if (!empty($obj->comments_id)) {
$obj->error = false;
$obj->msg = __("Your comment has been saved!");
} else {
$obj->msg = __("Your comment has NOT been saved!");
}
die(json_encode($obj));

View file

@ -1,14 +1,14 @@
<?php
header('Content-Type: application/json');
global $global, $config;
if(!isset($global['systemRootPath'])){
require_once '../videos/configuration.php';
}
require_once $global['systemRootPath'] . 'objects/user.php';
require_once $global['systemRootPath'] . 'objects/comment.php';
if (empty($_POST['id'])) {
die('{"error":"'.__("ID can not be empty").'"}');
}
require_once 'category.php';
$obj = new Comment("", 0, $_POST['id']);
echo '{"status":"'.$obj->delete().'"}';
<?php
header('Content-Type: application/json');
global $global, $config;
if (!isset($global['systemRootPath'])) {
require_once '../videos/configuration.php';
}
require_once $global['systemRootPath'] . 'objects/user.php';
require_once $global['systemRootPath'] . 'objects/comment.php';
if (empty($_POST['id'])) {
die('{"error":"'.__("ID can not be empty").'"}');
}
require_once 'category.php';
$obj = new Comment("", 0, $_POST['id']);
echo '{"status":"'.$obj->delete().'"}';

View file

@ -1,31 +1,32 @@
<?php
global $global, $config;
if (!isset($global['systemRootPath'])) {
$global['systemRootPath'] = '../';
}
require_once $global['systemRootPath'] . 'objects/comment.php';
require_once $global['systemRootPath'] . 'objects/user.php';
require_once $global['systemRootPath'] . 'objects/video.php';
require_once $global['systemRootPath'] . 'objects/functions.php';
header('Content-Type: application/json');
$comments = Comment::getAllComments($_GET['video_id'], @$_POST['comments_id']);
$total = Comment::getTotalComments($_GET['video_id'], @$_POST['comments_id']);
function fixCommentText($subject){
$search = array('\n');
$replace = array("<br/>");
return stripslashes(str_replace($search, $replace, $subject));
}
foreach ($comments as $key => $value) {
$name = User::getNameIdentificationById($value['users_id']);
$comments[$key]['comment'] = '<div class="pull-left"><img src="'.User::getPhoto($value['users_id']).'" alt="User Photo" class="img img-responsive img-circle" style="max-width: 50px;"/></div><div class="commentDetails"><div class="commenterName"><strong><a href="'.User::getChannelLink($value['users_id']).'">'.$name.'</a></strong> <small>'.humanTiming(strtotime($value['created'])).'</small></div>'. fixCommentText(textToLink($value['commentHTML'])).'</div>';
$comments[$key]['total_replies'] = Comment::getTotalComments($_GET['video_id'], $comments[$key]['id']);
$comments[$key]['video'] = Video::getVideo($comments[$key]['videos_id']);
unset($comments[$key]['video']['description']);
$comments[$key]['poster'] = Video::getImageFromFilename($comments[$key]['video']['filename']);
$comments[$key]['userCanAdminComment'] = Comment::userCanAdminComment($comments[$key]['id']);
$comments[$key]['userCanEditComment'] = Comment::userCanEditComment($comments[$key]['id']);
}
echo '{ "current": '. getCurrentPage().',"rowCount": '. getRowCount().', "total": '.$total.', "rows":'. json_encode($comments).'}';
<?php
global $global, $config;
if (!isset($global['systemRootPath'])) {
$global['systemRootPath'] = '../';
}
require_once $global['systemRootPath'] . 'objects/comment.php';
require_once $global['systemRootPath'] . 'objects/user.php';
require_once $global['systemRootPath'] . 'objects/video.php';
require_once $global['systemRootPath'] . 'objects/functions.php';
header('Content-Type: application/json');
$comments = Comment::getAllComments($_GET['video_id'], @$_POST['comments_id']);
$total = Comment::getTotalComments($_GET['video_id'], @$_POST['comments_id']);
function fixCommentText($subject)
{
$search = ['\n'];
$replace = ["<br/>"];
return stripslashes(str_replace($search, $replace, $subject));
}
foreach ($comments as $key => $value) {
$name = User::getNameIdentificationById($value['users_id']);
$comments[$key]['comment'] = '<div class="pull-left"><img src="'.User::getPhoto($value['users_id']).'" alt="User Photo" class="img img-responsive img-circle" style="max-width: 50px;"/></div><div class="commentDetails"><div class="commenterName"><strong><a href="'.User::getChannelLink($value['users_id']).'">'.$name.'</a></strong> <small>'.humanTiming(strtotime($value['created'])).'</small></div>'. fixCommentText(textToLink($value['commentHTML'])).'</div>';
$comments[$key]['total_replies'] = Comment::getTotalComments($_GET['video_id'], $comments[$key]['id']);
$comments[$key]['video'] = Video::getVideo($comments[$key]['videos_id']);
unset($comments[$key]['video']['description']);
$comments[$key]['poster'] = Video::getImageFromFilename($comments[$key]['video']['filename']);
$comments[$key]['userCanAdminComment'] = Comment::userCanAdminComment($comments[$key]['id']);
$comments[$key]['userCanEditComment'] = Comment::userCanEditComment($comments[$key]['id']);
}
echo '{ "current": '. getCurrentPage().',"rowCount": '. getRowCount().', "total": '.$total.', "rows":'. json_encode($comments).'}';

View file

@ -1,6 +1,6 @@
<?php
global $global, $config;
if(!isset($global['systemRootPath'])){
if (!isset($global['systemRootPath'])) {
require_once '../videos/configuration.php';
}
require_once $global['systemRootPath'] . 'objects/like.php';
@ -8,11 +8,11 @@ require_once $global['systemRootPath'] . 'objects/user.php';
require_once $global['systemRootPath'] . 'objects/comments_like.php';
header('Content-Type: application/json');
if(!empty($_GET['user']) && !empty($_GET['pass'])){
if (!empty($_GET['user']) && !empty($_GET['pass'])) {
$user = new User(0, $_GET['user'], $_GET['pass']);
$user->login(false, true);
}
if(empty($_POST['comments_id']) && !empty($_GET['comments_id'])){
if (empty($_POST['comments_id']) && !empty($_GET['comments_id'])) {
$_POST['comments_id'] = $_GET['comments_id'];
}

View file

@ -1,163 +1,163 @@
<?php
global $global, $config;
if (!isset($global['systemRootPath'])) {
require_once '../videos/configuration.php';
}
require_once $global['systemRootPath'] . 'objects/user.php';
class CommentsLike
{
private $id;
private $like;
private $comments_id;
private $users_id;
public function __construct($like, $comments_id)
{
if (!User::isLogged()) {
header('Content-Type: application/json');
die('{"error":"'.__("Permission denied").'"}');
}
$this->comments_id = $comments_id;
$this->users_id = User::getId();
$this->load();
// if click again in the same vote, remove the vote
if ($this->like == $like) {
$like = 0;
}
$this->setLike($like);
$this->save();
}
private function setLike($like)
{
$like = intval($like);
if (!in_array($like, array(0,1,-1))) {
$like = 0;
}
$this->like = $like;
}
private function load()
{
$like = $this->getLike();
if (empty($like)) {
return false;
}
foreach ($like as $key => $value) {
$this->$key = $value;
}
}
private function getLike()
{
global $global;
if (empty($this->users_id) || empty($this->comments_id)) {
header('Content-Type: application/json');
die('{"error":"You must have user and videos set to get a like"}');
}
$sql = "SELECT * FROM comments_likes WHERE users_id = ? AND comments_id = ? LIMIT 1";
$res = sqlDAL::readSql($sql, "ii", array($this->users_id,$this->comments_id));
$result = sqlDAL::fetchAssoc($res);
sqlDAL::close($res);
return ($res) ? $result : false;
}
private function save()
{
global $global;
if (!User::isLogged()) {
header('Content-Type: application/json');
die('{"error":"'.__("Permission denied").'"}');
}
$formats = "";
$values = array();
if (!empty($this->id)) {
$sql = "UPDATE comments_likes SET `like` = ?, modified = now() WHERE id = ?";
$formats = "ii";
$values = array($this->like,$this->id);
} else {
$sql = "INSERT INTO comments_likes ( `like`,users_id, comments_id, created, modified) VALUES (?, ?, ?, now(), now())";
$formats = "iii";
$values = array($this->like,$this->users_id,$this->comments_id);
}
return sqlDAL::writeSql($sql, $formats, $values);
}
public static function getLikes($comments_id)
{
global $global;
$obj = new stdClass();
$obj->comments_id = $comments_id;
$obj->likes = 0;
$obj->dislikes = 0;
$obj->myVote = self::getMyVote($comments_id);
$sql = "SELECT count(*) as total FROM comments_likes WHERE comments_id = ? AND `like` = 1 "; // like
$res = sqlDAL::readSql($sql, "i", array($comments_id));
$result = sqlDAL::fetchAssoc($res);
sqlDAL::close($res);
if (!$res) {
die($sql . '\nError : (' . $global['mysqli']->errno . ') ' . $global['mysqli']->error);
}
$obj->likes = intval($result['total']);
$sql = "SELECT count(*) as total FROM comments_likes WHERE comments_id = ? AND `like` = -1 "; // dislike
$res = sqlDAL::readSql($sql, "i", array($comments_id));
$result = sqlDAL::fetchAssoc($res);
sqlDAL::close($res);
if (!$res) {
die($sql.'\nError : (' . $global['mysqli']->errno . ') ' . $global['mysqli']->error);
}
$obj->dislikes = intval($result['total']);
return $obj;
}
public static function getTotalLikes()
{
global $global;
$obj = new stdClass();
$obj->likes = 0;
$obj->dislikes = 0;
$sql = "SELECT count(*) as total FROM comments_likes WHERE `like` = 1 "; // like
$res = sqlDAL::readSql($sql);
$result = sqlDAL::fetchAssoc($res);
sqlDAL::close($res);
if (!$res) {
die($sql . '\nError : (' . $global['mysqli']->errno . ') ' . $global['mysqli']->error);
}
$obj->likes = intval($result['total']);
$sql = "SELECT count(*) as total FROM comments_likes WHERE `like` = -1 "; // dislike
$res = sqlDAL::readSql($sql);
$result = sqlDAL::fetchAssoc($res);
sqlDAL::close($res);
if (!$res) {
die($sql.'\nError : (' . $global['mysqli']->errno . ') ' . $global['mysqli']->error);
}
$obj->dislikes = intval($result['total']);
return $obj;
}
public static function getMyVote($comments_id)
{
global $global;
if (!User::isLogged()) {
return 0;
}
$id = User::getId();
$sql = "SELECT `like` FROM comments_likes WHERE comments_id = ? AND users_id = ? "; // like
$res = sqlDAL::readSql($sql, "ii", array($comments_id,$id));
$result = sqlDAL::fetchAssoc($res);
sqlDAL::close($res);
if (!empty($result)) {
return intval($result['like']);
}
return 0;
}
}
<?php
global $global, $config;
if (!isset($global['systemRootPath'])) {
require_once '../videos/configuration.php';
}
require_once $global['systemRootPath'] . 'objects/user.php';
class CommentsLike
{
private $id;
private $like;
private $comments_id;
private $users_id;
public function __construct($like, $comments_id)
{
if (!User::isLogged()) {
header('Content-Type: application/json');
die('{"error":"'.__("Permission denied").'"}');
}
$this->comments_id = $comments_id;
$this->users_id = User::getId();
$this->load();
// if click again in the same vote, remove the vote
if ($this->like == $like) {
$like = 0;
}
$this->setLike($like);
$this->save();
}
private function setLike($like)
{
$like = intval($like);
if (!in_array($like, [0,1,-1])) {
$like = 0;
}
$this->like = $like;
}
private function load()
{
$like = $this->getLike();
if (empty($like)) {
return false;
}
foreach ($like as $key => $value) {
$this->$key = $value;
}
}
private function getLike()
{
global $global;
if (empty($this->users_id) || empty($this->comments_id)) {
header('Content-Type: application/json');
die('{"error":"You must have user and videos set to get a like"}');
}
$sql = "SELECT * FROM comments_likes WHERE users_id = ? AND comments_id = ? LIMIT 1";
$res = sqlDAL::readSql($sql, "ii", [$this->users_id,$this->comments_id]);
$result = sqlDAL::fetchAssoc($res);
sqlDAL::close($res);
return ($res) ? $result : false;
}
private function save()
{
global $global;
if (!User::isLogged()) {
header('Content-Type: application/json');
die('{"error":"'.__("Permission denied").'"}');
}
$formats = '';
$values = [];
if (!empty($this->id)) {
$sql = "UPDATE comments_likes SET `like` = ?, modified = now() WHERE id = ?";
$formats = "ii";
$values = [$this->like,$this->id];
} else {
$sql = "INSERT INTO comments_likes ( `like`,users_id, comments_id, created, modified) VALUES (?, ?, ?, now(), now())";
$formats = "iii";
$values = [$this->like,$this->users_id,$this->comments_id];
}
return sqlDAL::writeSql($sql, $formats, $values);
}
public static function getLikes($comments_id)
{
global $global;
$obj = new stdClass();
$obj->comments_id = $comments_id;
$obj->likes = 0;
$obj->dislikes = 0;
$obj->myVote = self::getMyVote($comments_id);
$sql = "SELECT count(*) as total FROM comments_likes WHERE comments_id = ? AND `like` = 1 "; // like
$res = sqlDAL::readSql($sql, "i", [$comments_id]);
$result = sqlDAL::fetchAssoc($res);
sqlDAL::close($res);
if (!$res) {
die($sql . '\nError : (' . $global['mysqli']->errno . ') ' . $global['mysqli']->error);
}
$obj->likes = intval($result['total']);
$sql = "SELECT count(*) as total FROM comments_likes WHERE comments_id = ? AND `like` = -1 "; // dislike
$res = sqlDAL::readSql($sql, "i", [$comments_id]);
$result = sqlDAL::fetchAssoc($res);
sqlDAL::close($res);
if (!$res) {
die($sql.'\nError : (' . $global['mysqli']->errno . ') ' . $global['mysqli']->error);
}
$obj->dislikes = intval($result['total']);
return $obj;
}
public static function getTotalLikes()
{
global $global;
$obj = new stdClass();
$obj->likes = 0;
$obj->dislikes = 0;
$sql = "SELECT count(*) as total FROM comments_likes WHERE `like` = 1 "; // like
$res = sqlDAL::readSql($sql);
$result = sqlDAL::fetchAssoc($res);
sqlDAL::close($res);
if (!$res) {
die($sql . '\nError : (' . $global['mysqli']->errno . ') ' . $global['mysqli']->error);
}
$obj->likes = intval($result['total']);
$sql = "SELECT count(*) as total FROM comments_likes WHERE `like` = -1 "; // dislike
$res = sqlDAL::readSql($sql);
$result = sqlDAL::fetchAssoc($res);
sqlDAL::close($res);
if (!$res) {
die($sql.'\nError : (' . $global['mysqli']->errno . ') ' . $global['mysqli']->error);
}
$obj->dislikes = intval($result['total']);
return $obj;
}
public static function getMyVote($comments_id)
{
global $global;
if (!User::isLogged()) {
return 0;
}
$id = User::getId();
$sql = "SELECT `like` FROM comments_likes WHERE comments_id = ? AND users_id = ? "; // like
$res = sqlDAL::readSql($sql, "ii", [$comments_id,$id]);
$result = sqlDAL::fetchAssoc($res);
sqlDAL::close($res);
if (!empty($result)) {
return intval($result['like']);
}
return 0;
}
}

File diff suppressed because it is too large Load diff

View file

@ -1,27 +1,27 @@
<?php
header('Content-Type: application/json');
global $global, $config;
if(!isset($global['systemRootPath'])){
require_once '../videos/configuration.php';
}
$obj = new stdClass();
$obj->error = true;
$obj->msg = "";
$obj->clearCache = false;
$obj->deleteALLCache = false;
$obj->deleteAllSessionCache = false;
$_SESSION['user']['sessionCache']['getAllCategoriesClearCache'] = 1;
if (!Permissions::canClearCache() || !empty($_REQUEST['sessionOnly'])) {
$obj->deleteAllSessionCache = ObjectYPT::deleteAllSessionCache();
}else{
if(!empty($_REQUEST['FirstPage'])){
$obj->firstPageCache = clearCache(true);
}else{
$obj->clearCache = clearCache();
$obj->deleteALLCache = ObjectYPT::deleteALLCache();
}
}
$obj->error = false;
die(json_encode($obj));
<?php
header('Content-Type: application/json');
global $global, $config;
if (!isset($global['systemRootPath'])) {
require_once '../videos/configuration.php';
}
$obj = new stdClass();
$obj->error = true;
$obj->msg = '';
$obj->clearCache = false;
$obj->deleteALLCache = false;
$obj->deleteAllSessionCache = false;
$_SESSION['user']['sessionCache']['getAllCategoriesClearCache'] = 1;
if (!Permissions::canClearCache() || !empty($_REQUEST['sessionOnly'])) {
$obj->deleteAllSessionCache = ObjectYPT::deleteAllSessionCache();
} else {
if (!empty($_REQUEST['FirstPage'])) {
$obj->firstPageCache = clearCache(true);
} else {
$obj->clearCache = clearCache();
$obj->deleteALLCache = ObjectYPT::deleteALLCache();
}
}
$obj->error = false;
die(json_encode($obj));

View file

@ -1,32 +1,31 @@
<?php
//header("Content-type: text/xml");
header('Content-Type: application/json');
global $global, $config;
if (!isset($global['systemRootPath'])) {
require_once '../videos/configuration.php';
}
require_once $global['systemRootPath'] . 'objects/user.php';
require_once $global['systemRootPath'] . 'objects/category.php';
$obj = new stdClass();
$obj->error = true;
$obj->msg = "";
if (!Permissions::canGenerateSiteMap()) {
$obj->msg = __("Permission denied");
die(json_encode($obj));
}
$sitemap = siteMap();
if(empty($sitemap)){
$obj->msg = "Sitemap content is empty";
die(json_encode($obj));
}
$name = "sitemap.xml";
ObjectYPT::setCache($name, $sitemap);
$obj->error = false;
die(json_encode($obj));
<?php
//header("Content-type: text/xml");
header('Content-Type: application/json');
global $global, $config;
if (!isset($global['systemRootPath'])) {
require_once '../videos/configuration.php';
}
require_once $global['systemRootPath'] . 'objects/user.php';
require_once $global['systemRootPath'] . 'objects/category.php';
$obj = new stdClass();
$obj->error = true;
$obj->msg = '';
if (!Permissions::canGenerateSiteMap()) {
$obj->msg = __("Permission denied");
die(json_encode($obj));
}
$sitemap = siteMap();
if (empty($sitemap)) {
$obj->msg = "Sitemap content is empty";
die(json_encode($obj));
}
$name = "sitemap.xml";
ObjectYPT::setCache($name, $sitemap);
$obj->error = false;
die(json_encode($obj));

View file

@ -1,114 +1,114 @@
<?php
require_once __DIR__ . DIRECTORY_SEPARATOR . 'autoload.php';
header('Content-Type: application/json');
global $global, $config;
if (!isset($global['systemRootPath'])) {
require_once '../videos/configuration.php';
}
require_once $global['systemRootPath'] . 'objects/user.php';
if (!User::isAdmin()) {
die('{"error":"' . __("Permission denied") . '"}');
}
require_once $global['systemRootPath'] . 'videos/configuration.php';
require_once $global['systemRootPath'] . 'objects/configuration.php';
require_once $global['systemRootPath'] . 'objects/functions.php';
$config = new Configuration();
$config->setContactEmail($_POST['contactEmail']);
$config->setLanguage($_POST['language']);
$config->setWebSiteTitle($_POST['webSiteTitle']);
$config->setAuthCanComment($_POST['authCanComment']);
$config->setAuthCanUploadVideos($_POST['authCanUploadVideos']);
$config->setAuthCanViewChart($_POST['authCanViewChart']);
if (empty($global['disableAdvancedConfigurations'])) {
$config->setDisable_analytics($_POST['disable_analytics']);
$config->setDisable_youtubeupload($_POST['disable_youtubeupload']);
$config->setAllow_download($_POST['allow_download']);
$config->setSession_timeout($_POST['session_timeout']);
$config->setEncoderURL($_POST['encoder_url']);
$config->setSmtp($_POST['smtp']);
$config->setSmtpAuth($_POST['smtpAuth']);
$config->setSmtpSecure($_POST['smtpSecure']);
$config->setSmtpHost($_POST['smtpHost']);
$config->setSmtpUsername($_POST['smtpUsername']);
$config->setSmtpPassword($_POST['smtpPassword']);
$config->setSmtpPort($_POST['smtpPort']);
}
$config->setHead($_POST['head']);
$config->setAdsense($_POST['adsense']);
$config->setMode('Youtube');
$config->setAutoplay($_POST['autoplay']);
$config->setTheme($_POST['theme']);
$imagePath = "videos/userPhoto/";
//Check write Access to Directory
if (!file_exists($global['systemRootPath'] . $imagePath)) {
mkdir($global['systemRootPath'] . $imagePath, 0755, true);
}
/*
if (!is_writable($global['systemRootPath'] . $imagePath)) {
$response = array(
"status" => 'error',
"message" => 'No write Access'
);
print json_encode($response);
return;
}
*
*/
$response = array();
if (!empty($_POST['logoImgBase64'])) {
$fileData = base64DataToImage($_POST['logoImgBase64']);
$fileName = 'logo.png';
$photoURL = $imagePath . $fileName;
$bytes = file_put_contents($global['systemRootPath'] . $photoURL, $fileData);
if ($bytes > 10) {
$response = array(
"status" => 'success',
"url" => $global['systemRootPath'] . $photoURL
);
$config->setLogo($photoURL);
} else {
$response = array(
"status" => 'error',
"msg" => 'We could not save logo',
"url" => $global['systemRootPath'] . $photoURL
);
}
}
if (!empty($_POST['faviconBase64'])) {
$imagePath = "videos/";
$fileData = base64DataToImage($_POST['faviconBase64']);
$fileName = 'favicon.png';
$photoURL = $imagePath . $fileName;
$bytes = file_put_contents($global['systemRootPath'] . $photoURL, $fileData);
if ($bytes > 10) {
$response2 = array(
"status" => 'success',
"url" => $global['systemRootPath'] . $photoURL
);
$sizes = array(
array(16, 16),
array(24, 24),
array(32, 32),
array(48, 48),
array(144, 144)
);
$ico_lib = new PHP_ICO($global['systemRootPath'] . $photoURL, $sizes);
$ico_lib->save_ico($global['systemRootPath'] . $imagePath.'favicon.ico');
} else {
$response2 = array(
"status" => 'error',
"msg" => 'We could not save favicon',
"url" => $global['systemRootPath'] . $photoURL
);
}
}
echo '{"status":"' . $config->save() . '", "respnseLogo": ' . json_encode($response) . ', "respnseFavicon": ' . json_encode($response2) . '}';
<?php
require_once __DIR__ . DIRECTORY_SEPARATOR . 'autoload.php';
header('Content-Type: application/json');
global $global, $config;
if (!isset($global['systemRootPath'])) {
require_once '../videos/configuration.php';
}
require_once $global['systemRootPath'] . 'objects/user.php';
if (!User::isAdmin()) {
die('{"error":"' . __("Permission denied") . '"}');
}
require_once $global['systemRootPath'] . 'videos/configuration.php';
require_once $global['systemRootPath'] . 'objects/configuration.php';
require_once $global['systemRootPath'] . 'objects/functions.php';
$config = new Configuration();
$config->setContactEmail($_POST['contactEmail']);
$config->setLanguage($_POST['language']);
$config->setWebSiteTitle($_POST['webSiteTitle']);
$config->setAuthCanComment($_POST['authCanComment']);
$config->setAuthCanUploadVideos($_POST['authCanUploadVideos']);
$config->setAuthCanViewChart($_POST['authCanViewChart']);
if (empty($global['disableAdvancedConfigurations'])) {
$config->setDisable_analytics($_POST['disable_analytics']);
$config->setDisable_youtubeupload($_POST['disable_youtubeupload']);
$config->setAllow_download($_POST['allow_download']);
$config->setSession_timeout($_POST['session_timeout']);
$config->setEncoderURL($_POST['encoder_url']);
$config->setSmtp($_POST['smtp']);
$config->setSmtpAuth($_POST['smtpAuth']);
$config->setSmtpSecure($_POST['smtpSecure']);
$config->setSmtpHost($_POST['smtpHost']);
$config->setSmtpUsername($_POST['smtpUsername']);
$config->setSmtpPassword($_POST['smtpPassword']);
$config->setSmtpPort($_POST['smtpPort']);
}
$config->setHead($_POST['head']);
$config->setAdsense($_POST['adsense']);
$config->setMode('Youtube');
$config->setAutoplay($_POST['autoplay']);
$config->setTheme($_POST['theme']);
$imagePath = "videos/userPhoto/";
//Check write Access to Directory
if (!file_exists($global['systemRootPath'] . $imagePath)) {
mkdir($global['systemRootPath'] . $imagePath, 0755, true);
}
/*
if (!is_writable($global['systemRootPath'] . $imagePath)) {
$response = array(
"status" => 'error',
"message" => 'No write Access'
);
print json_encode($response);
return;
}
*
*/
$response = [];
if (!empty($_POST['logoImgBase64'])) {
$fileData = base64DataToImage($_POST['logoImgBase64']);
$fileName = 'logo.png';
$photoURL = $imagePath . $fileName;
$bytes = file_put_contents($global['systemRootPath'] . $photoURL, $fileData);
if ($bytes > 10) {
$response = [
"status" => 'success',
"url" => $global['systemRootPath'] . $photoURL,
];
$config->setLogo($photoURL);
} else {
$response = [
"status" => 'error',
"msg" => 'We could not save logo',
"url" => $global['systemRootPath'] . $photoURL,
];
}
}
if (!empty($_POST['faviconBase64'])) {
$imagePath = "videos/";
$fileData = base64DataToImage($_POST['faviconBase64']);
$fileName = 'favicon.png';
$photoURL = $imagePath . $fileName;
$bytes = file_put_contents($global['systemRootPath'] . $photoURL, $fileData);
if ($bytes > 10) {
$response2 = [
"status" => 'success',
"url" => $global['systemRootPath'] . $photoURL,
];
$sizes = [
[16, 16],
[24, 24],
[32, 32],
[48, 48],
[144, 144],
];
$ico_lib = new PHP_ICO($global['systemRootPath'] . $photoURL, $sizes);
$ico_lib->save_ico($global['systemRootPath'] . $imagePath.'favicon.ico');
} else {
$response2 = [
"status" => 'error',
"msg" => 'We could not save favicon',
"url" => $global['systemRootPath'] . $photoURL,
];
}
}
echo '{"status":"' . $config->save() . '", "respnseLogo": ' . json_encode($response) . ', "respnseFavicon": ' . json_encode($response2) . '}';

View file

@ -1,71 +1,71 @@
<?php
require_once __DIR__ . DIRECTORY_SEPARATOR . 'autoload.php';
global $global, $config;
if (!isset($global['systemRootPath'])) {
require_once '../videos/configuration.php';
}
require_once $global['systemRootPath'] . 'objects/user.php';
if (!User::isAdmin()) {
header("Location: {$global['webSiteRootURL']}?error=" . __("You can not do this"));
exit;
}
header('Content-Type: application/json');
if (empty($_POST['email'])) {
if (!empty($_REQUEST['users_groups_id'])) {
$users = User::getAllUsersFromUsergroup(
$_REQUEST['users_groups_id'],
false,
array('name', 'email', 'user', 'channelName', 'about'),
'a'
);
} else {
$users = User::getAllUsers(
false,
array('name', 'email', 'user', 'channelName', 'about'),
'a'
);
}
} else {
$users[0]["email"] = $_POST['email'];
}
// send 100 emails at a time
$mailsLimit = 100;
$obj = new stdClass();
$obj->error = false;
$obj->msg = array();
//Create a new PHPMailer instance
$mail = new \PHPMailer\PHPMailer\PHPMailer;
setSiteSendMessage($mail);
//Set who the message is to be sent from
$mail->setFrom($config->getContactEmail());
$mail->Subject = 'Message From Site ' . $config->getWebSiteTitle();
$mail->msgHTML($_POST['message']);
$count = 0;
$currentCount = 0;
foreach ($users as $value) {
if ($count % $mailsLimit === 0) {
if ($count !== 0) {
if (!$mail->send()) {
$obj->error = true;
$obj->msg[] = __("Message could not be sent") . " " . $mail->ErrorInfo;
}
$mail->ClearAddresses();
$mail->ClearCCs();
$mail->ClearBCCs();
$currentCount = 0;
}
}
$mail->addBCC($value["email"]);
$count++;
$currentCount++;
}
if ($currentCount && !$mail->send()) {
$obj->error = true;
$obj->msg[] = __("Message could not be sent") . " " . $mail->ErrorInfo;
}
$obj->count = $count;
echo json_encode($obj);
<?php
require_once __DIR__ . DIRECTORY_SEPARATOR . 'autoload.php';
global $global, $config;
if (!isset($global['systemRootPath'])) {
require_once '../videos/configuration.php';
}
require_once $global['systemRootPath'] . 'objects/user.php';
if (!User::isAdmin()) {
header("Location: {$global['webSiteRootURL']}?error=" . __("You can not do this"));
exit;
}
header('Content-Type: application/json');
if (empty($_POST['email'])) {
if (!empty($_REQUEST['users_groups_id'])) {
$users = User::getAllUsersFromUsergroup(
$_REQUEST['users_groups_id'],
false,
['name', 'email', 'user', 'channelName', 'about'],
'a'
);
} else {
$users = User::getAllUsers(
false,
['name', 'email', 'user', 'channelName', 'about'],
'a'
);
}
} else {
$users[0]["email"] = $_POST['email'];
}
// send 100 emails at a time
$mailsLimit = 100;
$obj = new stdClass();
$obj->error = false;
$obj->msg = [];
//Create a new PHPMailer instance
$mail = new \PHPMailer\PHPMailer\PHPMailer();
setSiteSendMessage($mail);
//Set who the message is to be sent from
$mail->setFrom($config->getContactEmail());
$mail->Subject = 'Message From Site ' . $config->getWebSiteTitle();
$mail->msgHTML($_POST['message']);
$count = 0;
$currentCount = 0;
foreach ($users as $value) {
if ($count % $mailsLimit === 0) {
if ($count !== 0) {
if (!$mail->send()) {
$obj->error = true;
$obj->msg[] = __("Message could not be sent") . " " . $mail->ErrorInfo;
}
$mail->ClearAddresses();
$mail->ClearCCs();
$mail->ClearBCCs();
$currentCount = 0;
}
}
$mail->addBCC($value["email"]);
$count++;
$currentCount++;
}
if ($currentCount && !$mail->send()) {
$obj->error = true;
$obj->msg[] = __("Message could not be sent") . " " . $mail->ErrorInfo;
}
$obj->count = $count;
echo json_encode($obj);

File diff suppressed because it is too large Load diff

View file

@ -1,70 +1,70 @@
<?php
global $croppieFilesAdded;
if (empty($croppieFilesAdded)) {
?>
<link href="<?php echo getCDN(); ?>node_modules/croppie/croppie.css" rel="stylesheet" type="text/css"/>
<script src="<?php echo getCDN(); ?>node_modules/croppie/croppie.min.js" type="text/javascript"></script>
<?php
}
$croppieFilesAdded = 1;
?>
<div class="croppieDiv" objectName="uploadCrop<?php echo $uid; ?>">
<div class="col-md-12 ">
<div id="croppie<?php echo $uid; ?>" style="min-height: <?php echo $boundaryHeight+40; ?>px;"></div>
<div class="btn-group btn-group-justified" role="group">
<a id="upload-btn<?php echo $uid; ?>" class="btn btn-primary"><i class="fa fa-upload"></i> <?php echo $buttonTitle; ?></a>
<a id="delete-btn<?php echo $uid; ?>" class="btn btn-danger"><i class="fa fa-trash"></i> <?php echo __('Delete'); ?></a>
</div>
</div>
<div class="col-md-12 ">
<input type="file" id="upload<?php echo $uid; ?>" value="Choose a file" accept="image/*" style="display:none;" />
</div>
</div>
<script>
var uploadCrop<?php echo $uid; ?>;
function createCroppie<?php echo $uid; ?>(imageURL) {
console.log('createCroppie');
uploadCrop<?php echo $uid; ?> = $('#croppie<?php echo $uid; ?>').croppie({
//url: imageURL,
//enableExif: true,
//enforceBoundary: true,
mouseWheelZoom: false,
viewport: {
width: <?php echo $viewportWidth; ?>,
height: <?php echo $viewportHeight; ?>
},
boundary: {
width: <?php echo $boundaryWidth; ?>,
height: <?php echo $boundaryHeight; ?>
}
});
$('#upload<?php echo $uid; ?>').off('change');
$('#upload<?php echo $uid; ?>').on('change', function () {
readFileCroppie(this, uploadCrop<?php echo $uid; ?>);
});
$('#upload-btn<?php echo $uid; ?>').off('click');
$('#upload-btn<?php echo $uid; ?>').on('click', function (ev) {
$('#upload<?php echo $uid; ?>').trigger("click");
});
$('#delete-btn<?php echo $uid; ?>').off('click');
$('#delete-btn<?php echo $uid; ?>').on('click', function (ev) {
restartCroppie<?php echo $uid; ?>('<?php echo getImageTransparent1pxURL(); ?>');
});
$('#croppie<?php echo $uid; ?>').croppie('bind', {url: addGetParam(imageURL, 'cache', Math.random())}).then(function () {
$('#croppie<?php echo $uid; ?>').croppie('setZoom', <?php echo $zoom; ?>)
});
}
function restartCroppie<?php echo $uid; ?>(imageURL) {
console.log("restartCroppie<?php echo $uid; ?>", imageURL);
$('#croppie<?php echo $uid; ?>').croppie('destroy');
setTimeout(function () {
createCroppie<?php echo $uid; ?>(imageURL);
}, 1000);
}
</script>
<?php
global $croppieFilesAdded;
if (empty($croppieFilesAdded)) {
?>
<link href="<?php echo getCDN(); ?>node_modules/croppie/croppie.css" rel="stylesheet" type="text/css"/>
<script src="<?php echo getCDN(); ?>node_modules/croppie/croppie.min.js" type="text/javascript"></script>
<?php
}
$croppieFilesAdded = 1;
?>
<div class="croppieDiv" objectName="uploadCrop<?php echo $uid; ?>">
<div class="col-md-12 ">
<div id="croppie<?php echo $uid; ?>" style="min-height: <?php echo $boundaryHeight+40; ?>px;"></div>
<div class="btn-group btn-group-justified" role="group">
<a id="upload-btn<?php echo $uid; ?>" class="btn btn-primary"><i class="fa fa-upload"></i> <?php echo $buttonTitle; ?></a>
<a id="delete-btn<?php echo $uid; ?>" class="btn btn-danger"><i class="fa fa-trash"></i> <?php echo __('Delete'); ?></a>
</div>
</div>
<div class="col-md-12 ">
<input type="file" id="upload<?php echo $uid; ?>" value="Choose a file" accept="image/*" style="display:none;" />
</div>
</div>
<script>
var uploadCrop<?php echo $uid; ?>;
function createCroppie<?php echo $uid; ?>(imageURL) {
console.log('createCroppie');
uploadCrop<?php echo $uid; ?> = $('#croppie<?php echo $uid; ?>').croppie({
//url: imageURL,
//enableExif: true,
//enforceBoundary: true,
mouseWheelZoom: false,
viewport: {
width: <?php echo $viewportWidth; ?>,
height: <?php echo $viewportHeight; ?>
},
boundary: {
width: <?php echo $boundaryWidth; ?>,
height: <?php echo $boundaryHeight; ?>
}
});
$('#upload<?php echo $uid; ?>').off('change');
$('#upload<?php echo $uid; ?>').on('change', function () {
readFileCroppie(this, uploadCrop<?php echo $uid; ?>);
});
$('#upload-btn<?php echo $uid; ?>').off('click');
$('#upload-btn<?php echo $uid; ?>').on('click', function (ev) {
$('#upload<?php echo $uid; ?>').trigger("click");
});
$('#delete-btn<?php echo $uid; ?>').off('click');
$('#delete-btn<?php echo $uid; ?>').on('click', function (ev) {
restartCroppie<?php echo $uid; ?>('<?php echo getImageTransparent1pxURL(); ?>');
});
$('#croppie<?php echo $uid; ?>').croppie('bind', {url: addGetParam(imageURL, 'cache', Math.random())}).then(function () {
$('#croppie<?php echo $uid; ?>').croppie('setZoom', <?php echo $zoom; ?>)
});
}
function restartCroppie<?php echo $uid; ?>(imageURL) {
console.log("restartCroppie<?php echo $uid; ?>", imageURL);
$('#croppie<?php echo $uid; ?>').croppie('destroy');
setTimeout(function () {
createCroppie<?php echo $uid; ?>(imageURL);
}, 1000);
}
</script>

View file

@ -1,29 +1,29 @@
<?php
$getDiskUsage = getDiskUsage();
?>
<div class="clearfix" style="margin: 10px 12px;">
<div class="progress" style="margin: 2px;">
<div class="progress-bar progress-bar-success" role="progressbar" style="width:<?php echo $getDiskUsage->videos_dir_used_percentage; ?>%">
<?php echo $getDiskUsage->videos_dir_used_percentage; ?>%
</div>
<div class="progress-bar progress-bar-warning" role="progressbar" style="width:<?php echo $getDiskUsage->disk_used_percentage - $getDiskUsage->videos_dir_used_percentage; ?>%">
<?php echo $getDiskUsage->disk_used_percentage - $getDiskUsage->videos_dir_used_percentage; ?>%
</div>
<div class="progress-bar progress-bar-default" role="progressbar" style="width:<?php echo $getDiskUsage->disk_free_space_percentage; ?>%">
<?php echo $getDiskUsage->disk_free_space_percentage; ?>%
</div>
</div>
<div class="label label-success">
<?php echo __("Videos Directory"); ?>: <?php echo $getDiskUsage->videos_dir_human; ?> (<?php echo $getDiskUsage->videos_dir_used_percentage; ?>%)
</div>
<div class="label label-warning">
<?php echo __("Other Files"); ?>: <?php echo $getDiskUsage->disk_used_human; ?> (<?php echo $getDiskUsage->disk_used_percentage - $getDiskUsage->videos_dir_used_percentage; ?>%)
</div>
<div class="label label-primary">
<?php echo __("Free Space"); ?>: <?php echo $getDiskUsage->disk_free_space_human; ?> (<?php echo $getDiskUsage->disk_free_space_percentage; ?>%)
</div>
</div>
<?php
if ($getDiskUsage->disk_free_space_percentage < 15 && $getDiskUsage->disk_free_space < 53687091200) { // 53687091200 = 50 GB
echo "<script>$(document).ready(function () {avideoToastWarning('Your Disk is almost Full, you have only <strong>{$getDiskUsage->disk_free_space_percentage}%</strong> free <br> ({$getDiskUsage->disk_free_space_human})');});</script>";
}
<?php
$getDiskUsage = getDiskUsage();
?>
<div class="clearfix" style="margin: 10px 12px;">
<div class="progress" style="margin: 2px;">
<div class="progress-bar progress-bar-success" role="progressbar" style="width:<?php echo $getDiskUsage->videos_dir_used_percentage; ?>%">
<?php echo $getDiskUsage->videos_dir_used_percentage; ?>%
</div>
<div class="progress-bar progress-bar-warning" role="progressbar" style="width:<?php echo $getDiskUsage->disk_used_percentage - $getDiskUsage->videos_dir_used_percentage; ?>%">
<?php echo $getDiskUsage->disk_used_percentage - $getDiskUsage->videos_dir_used_percentage; ?>%
</div>
<div class="progress-bar progress-bar-default" role="progressbar" style="width:<?php echo $getDiskUsage->disk_free_space_percentage; ?>%">
<?php echo $getDiskUsage->disk_free_space_percentage; ?>%
</div>
</div>
<div class="label label-success">
<?php echo __("Videos Directory"); ?>: <?php echo $getDiskUsage->videos_dir_human; ?> (<?php echo $getDiskUsage->videos_dir_used_percentage; ?>%)
</div>
<div class="label label-warning">
<?php echo __("Other Files"); ?>: <?php echo $getDiskUsage->disk_used_human; ?> (<?php echo $getDiskUsage->disk_used_percentage - $getDiskUsage->videos_dir_used_percentage; ?>%)
</div>
<div class="label label-primary">
<?php echo __("Free Space"); ?>: <?php echo $getDiskUsage->disk_free_space_human; ?> (<?php echo $getDiskUsage->disk_free_space_percentage; ?>%)
</div>
</div>
<?php
if ($getDiskUsage->disk_free_space_percentage < 15 && $getDiskUsage->disk_free_space < 53687091200) { // 53687091200 = 50 GB
echo "<script>$(document).ready(function () {avideoToastWarning('Your Disk is almost Full, you have only <strong>{$getDiskUsage->disk_free_space_percentage}%</strong> free <br> ({$getDiskUsage->disk_free_space_human})');});</script>";
}

View file

@ -1,138 +1,136 @@
<?php
echo PHP_EOL."<!-- OpenGraph -->".PHP_EOL;
if (empty($videos_id)) {
echo PHP_EOL."<!-- OpenGraph no video id -->".PHP_EOL;
if (!empty($_GET['videoName'])) {
echo PHP_EOL."<!-- OpenGraph videoName {$_GET['videoName']} -->".PHP_EOL;
$video = Video::getVideoFromCleanTitle($_GET['videoName']);
}
} else {
echo PHP_EOL."<!-- OpenGraph videos_id {$videos_id} -->".PHP_EOL;
$video = Video::getVideoLight($videos_id);
}
if (empty($video)) {
echo PHP_EOL."<!-- OpenGraph no video -->".PHP_EOL;
return false;
}
$videos_id = $video['id'];
$source = Video::getSourceFile($video['filename']);
$imgw = 1024;
$imgh = 768;
if (($video['type'] !== "audio") && ($video['type'] !== "linkAudio") && !empty($source['url'])) {
$img = $source['url'];
$data = getimgsize($source['path']);
$imgw = $data[0];
$imgh = $data[1];
} else if ($video['type'] == "audio") {
$img = getCDN()."view/img/audio_wave.jpg";
}
$type = 'video';
if ($video['type'] === 'pdf') {
$type = 'pdf';
}
if ($video['type'] === 'article') {
$type = 'article';
}
$images = Video::getImageFromFilename($video['filename'], $type);
if (!empty($images->posterPortrait) && basename($images->posterPortrait) !== 'notfound_portrait.jpg' && basename($images->posterPortrait) !== 'pdf_portrait.png' && basename($images->posterPortrait) !== 'article_portrait.png') {
$img = $images->posterPortrait;
$data = getimgsize($images->posterPortraitPath);
$imgw = $data[0];
$imgh = $data[1];
} else {
$img = $images->poster;
}
$twitter_site = $advancedCustom->twitter_site;
$title = _substr(html2plainText($video['title']), 0,55);
$description = _substr(html2plainText($video['description']), 0,155);
$ogURL = Video::getLinkToVideo($videos_id);
?>
<link rel="image_src" href="<?php echo $img; ?>" />
<meta property="og:image" content="<?php echo $img; ?>" />
<meta property="og:image:secure_url" content="<?php echo $img; ?>" />
<meta property="og:image:type" content="image/jpeg" />
<meta property="og:image:width" content="<?php echo $imgw; ?>" />
<meta property="og:image:height" content="<?php echo $imgh; ?>" />
<meta property="fb:app_id" content="774958212660408" />
<meta property="og:title" content="<?php echo $title; ?>" />
<meta property="og:description" content="<?php echo $description; ?>" />
<meta property="og:url" content="<?php echo $ogURL; ?>" />
<meta property="og:type" content="video.other" />
<link rel="canonical" href="<?php echo $ogURL; ?>" />
<?php
$source = Video::getHigestResolution($video['filename']);
if(empty($source['url'])){
if(CustomizeUser::canDownloadVideos()){
echo "<!-- you cannot download videos we will not share the video source file -->";
}
if(empty($source['url'])){
echo "<!-- we could not get the MP4 source file -->";
}
}else{
$source['url'] = str_replace(".m3u8", ".m3u8.mp4", $source['url']);
}
if (!AVideoPlugin::isEnabledByName("SecureVideosDirectory") && !empty($source['url'])) {
?>
<meta property="og:video" content="<?php echo $source['url']; ?>" />
<meta property="og:video:secure_url" content="<?php echo $source['url']; ?>" />
<meta property="og:video:type" content="video/mp4" />
<meta property="og:video:width" content="<?php echo $imgw; ?>" />
<meta property="og:video:height" content="<?php echo $imgh; ?>" />
<?php
} else {
if(AVideoPlugin::isEnabledByName("SecureVideosDirectory")){
echo "<!-- SecureVideosDirectory plugin is enabled we will not share the video source file -->";
}
if(empty($source['url'])){
echo "<!-- we could not get the source file -->";
}
?>
<meta property="og:video" content="<?php echo Video::getLinkToVideo($videos_id); ?>" />
<meta property="og:video:secure_url" content="<?php echo Video::getLinkToVideo($videos_id); ?>" />
<?php
}
?>
<meta property="video:duration" content="<?php echo Video::getItemDurationSeconds($video['duration']); ?>" />
<meta property="duration" content="<?php echo Video::getItemDurationSeconds($video['duration']); ?>" />
<!-- Twitter cards -->
<?php
if (!empty($advancedCustom->twitter_player)) {
if (!AVideoPlugin::isEnabledByName("SecureVideosDirectory") && !empty($source['url'])) {
?>
<meta name="twitter:card" content="player" />
<meta name="twitter:player" content=<?php echo Video::getLinkToVideo($videos_id, $video['clean_title'], true); ?>" />
<meta name="twitter:player:width" content="<?php echo $imgw; ?>" />
<meta name="twitter:player:height" content="<?php echo $imgh; ?>" />
<meta name="twitter:player:stream" content="<?php echo $source['url']; ?>" />
<meta name="twitter:player:stream:content_type" content="video/mp4" />
<?php
} else {
?>
<meta name="twitter:card" content="player" />
<meta name="twitter:player" content="<?php echo Video::getLinkToVideo($videos_id, $video['clean_title'], true); ?>" />
<meta name="twitter:player:width" content="480" />
<meta name="twitter:player:height" content="480" />
<?php
}
} else {
if (!empty($advancedCustom->twitter_summary_large_image)) {
?>
<meta name="twitter:card" content="summary_large_image" />
<?php
} else {
?>
<meta name="twitter:card" content="summary" />
<?php
}
}
?>
<meta name="twitter:site" content="<?php echo $twitter_site; ?>" />
<meta name="twitter:url" content="<?php echo Video::getLinkToVideo($videos_id); ?>"/>
<meta name="twitter:title" content="<?php echo $title; ?>"/>
<meta name="twitter:description" content="<?php echo $description; ?>"/>
<meta name="twitter:image" content="<?php echo $img; ?>"/>
<?php
<?php
echo PHP_EOL."<!-- OpenGraph -->".PHP_EOL;
if (empty($videos_id)) {
echo PHP_EOL."<!-- OpenGraph no video id -->".PHP_EOL;
if (!empty($_GET['videoName'])) {
echo PHP_EOL."<!-- OpenGraph videoName {$_GET['videoName']} -->".PHP_EOL;
$video = Video::getVideoFromCleanTitle($_GET['videoName']);
}
} else {
echo PHP_EOL."<!-- OpenGraph videos_id {$videos_id} -->".PHP_EOL;
$video = Video::getVideoLight($videos_id);
}
if (empty($video)) {
echo PHP_EOL."<!-- OpenGraph no video -->".PHP_EOL;
return false;
}
$videos_id = $video['id'];
$source = Video::getSourceFile($video['filename']);
$imgw = 1024;
$imgh = 768;
if (($video['type'] !== "audio") && ($video['type'] !== "linkAudio") && !empty($source['url'])) {
$img = $source['url'];
$data = getimgsize($source['path']);
$imgw = $data[0];
$imgh = $data[1];
} elseif ($video['type'] == "audio") {
$img = getCDN()."view/img/audio_wave.jpg";
}
$type = 'video';
if ($video['type'] === 'pdf') {
$type = 'pdf';
}
if ($video['type'] === 'article') {
$type = 'article';
}
$images = Video::getImageFromFilename($video['filename'], $type);
if (!empty($images->posterPortrait) && basename($images->posterPortrait) !== 'notfound_portrait.jpg' && basename($images->posterPortrait) !== 'pdf_portrait.png' && basename($images->posterPortrait) !== 'article_portrait.png') {
$img = $images->posterPortrait;
$data = getimgsize($images->posterPortraitPath);
$imgw = $data[0];
$imgh = $data[1];
} else {
$img = $images->poster;
}
$twitter_site = $advancedCustom->twitter_site;
$title = _substr(html2plainText($video['title']), 0, 55);
$description = _substr(html2plainText($video['description']), 0, 155);
$ogURL = Video::getLinkToVideo($videos_id);
?>
<link rel="image_src" href="<?php echo $img; ?>" />
<meta property="og:image" content="<?php echo $img; ?>" />
<meta property="og:image:secure_url" content="<?php echo $img; ?>" />
<meta property="og:image:type" content="image/jpeg" />
<meta property="og:image:width" content="<?php echo $imgw; ?>" />
<meta property="og:image:height" content="<?php echo $imgh; ?>" />
<meta property="fb:app_id" content="774958212660408" />
<meta property="og:title" content="<?php echo $title; ?>" />
<meta property="og:description" content="<?php echo $description; ?>" />
<meta property="og:url" content="<?php echo $ogURL; ?>" />
<meta property="og:type" content="video.other" />
<link rel="canonical" href="<?php echo $ogURL; ?>" />
<?php
$source = Video::getHigestResolution($video['filename']);
if (empty($source['url'])) {
if (CustomizeUser::canDownloadVideos()) {
echo "<!-- you cannot download videos we will not share the video source file -->";
}
if (empty($source['url'])) {
echo "<!-- we could not get the MP4 source file -->";
}
} else {
$source['url'] = str_replace(".m3u8", ".m3u8.mp4", $source['url']);
}
if (!AVideoPlugin::isEnabledByName("SecureVideosDirectory") && !empty($source['url'])) {
?>
<meta property="og:video" content="<?php echo $source['url']; ?>" />
<meta property="og:video:secure_url" content="<?php echo $source['url']; ?>" />
<meta property="og:video:type" content="video/mp4" />
<meta property="og:video:width" content="<?php echo $imgw; ?>" />
<meta property="og:video:height" content="<?php echo $imgh; ?>" />
<?php
} else {
if (AVideoPlugin::isEnabledByName("SecureVideosDirectory")) {
echo "<!-- SecureVideosDirectory plugin is enabled we will not share the video source file -->";
}
if (empty($source['url'])) {
echo "<!-- we could not get the source file -->";
} ?>
<meta property="og:video" content="<?php echo Video::getLinkToVideo($videos_id); ?>" />
<meta property="og:video:secure_url" content="<?php echo Video::getLinkToVideo($videos_id); ?>" />
<?php
}
?>
<meta property="video:duration" content="<?php echo Video::getItemDurationSeconds($video['duration']); ?>" />
<meta property="duration" content="<?php echo Video::getItemDurationSeconds($video['duration']); ?>" />
<!-- Twitter cards -->
<?php
if (!empty($advancedCustom->twitter_player)) {
if (!AVideoPlugin::isEnabledByName("SecureVideosDirectory") && !empty($source['url'])) {
?>
<meta name="twitter:card" content="player" />
<meta name="twitter:player" content=<?php echo Video::getLinkToVideo($videos_id, $video['clean_title'], true); ?>" />
<meta name="twitter:player:width" content="<?php echo $imgw; ?>" />
<meta name="twitter:player:height" content="<?php echo $imgh; ?>" />
<meta name="twitter:player:stream" content="<?php echo $source['url']; ?>" />
<meta name="twitter:player:stream:content_type" content="video/mp4" />
<?php
} else {
?>
<meta name="twitter:card" content="player" />
<meta name="twitter:player" content="<?php echo Video::getLinkToVideo($videos_id, $video['clean_title'], true); ?>" />
<meta name="twitter:player:width" content="480" />
<meta name="twitter:player:height" content="480" />
<?php
}
} else {
if (!empty($advancedCustom->twitter_summary_large_image)) {
?>
<meta name="twitter:card" content="summary_large_image" />
<?php
} else {
?>
<meta name="twitter:card" content="summary" />
<?php
}
}
?>
<meta name="twitter:site" content="<?php echo $twitter_site; ?>" />
<meta name="twitter:url" content="<?php echo Video::getLinkToVideo($videos_id); ?>"/>
<meta name="twitter:title" content="<?php echo $title; ?>"/>
<meta name="twitter:description" content="<?php echo $description; ?>"/>
<meta name="twitter:image" content="<?php echo $img; ?>"/>
<?php

View file

@ -1,72 +1,72 @@
<div class="scroller-status$uid">
<div class="infinite-scroll-request loader-ellips text-center">
<i class="fas fa-spinner fa-pulse text-muted"></i>
</div>
</div>
<center>
<button class="btn btn-xs btn-default" style="border: none; background: transparent;" id="loadInfiniteScrollButton$uid"> More </button>
</center>
<script src="$webSiteRootURLnode_modules/infinite-scroll/dist/infinite-scroll.pkgd.min.js" type="text/javascript"></script>
<script>
var $container$uid;
$(function () {
loadInfiniteScrool$uid();
});
/*
*
document.addEventListener('scroll', function (e) {
var scrollPosition = window.pageYOffset;
var windowSize = window.innerHeight;
var bodyHeight = document.body.offsetHeight;
var distance = bodyHeight - (scrollPosition + windowSize);
//console.log('infiniteScroll ', distance, windowSize, distance < windowSize);
if (distance < windowSize) {
$container$uid.infiniteScroll('loadNextPage');
}
});*/
var append_infiniteScroll_timout;
function loadInfiniteScrool$uid() {
if (typeof $('$infinityScrollAppendIntoSelector').infiniteScroll !== 'funciton') {
$container$uid = $('$infinityScrollAppendIntoSelector').infiniteScroll({
path: '.pagination__next$uid',
append: '$infinityScrollGetFromSelector',
status: '.scroller-status$uid',
hideNav: '.infiniteScrollPagination$uid',
debug: false,
prefill: true,
history: false,
checkLastPage: false,
button: '#loadInfiniteScrollButton$uid'
});
$container$uid.on('scrollThreshold.infiniteScroll', function (event) {
//console.log('infiniteScroll Scroll at bottom');
});
$container$uid.on('request.infiniteScroll', function (event, path, fetchPromise) {
//console.log(`infiniteScroll Loading page: ${path}`);
});
let infScroll = $container$uid.data('infiniteScroll');
$container$uid.on('load.infiniteScroll', function (event, body, path, response) {
//console.log(`infiniteScroll Loaded: ${path}`, `Status: ${response.status}`, `Current page: ${infScroll.pageIndex}`, `${infScroll.loadCount} pages loaded`);
});
$container$uid.on('append.infiniteScroll', function (event, body, path, items, response) {
//console.log(`infiniteScroll Appended ${items.length} items on ${path}`, body);
clearTimeout(append_infiniteScroll_timout);
append_infiniteScroll_timout = setTimeout(function () {
lazyImage();
avideoSocket();
}, 1000);
});
$container$uid.on('error.infiniteScroll', function (event, error, path, response) {
//console.error(`infiniteScroll Could not load: ${path}. ${error}`);
});
$container$uid.on('last.infiniteScroll', function (event, body, path) {
//console.log(`infiniteScroll Last page hit on ${path}`, body, event);
});
$container$uid.on('history.infiniteScroll', function (event, title, path) {
//console.log(`infiniteScroll History changed to: ${path}`);
});
}
}
</script>
<div class="scroller-status$uid">
<div class="infinite-scroll-request loader-ellips text-center">
<i class="fas fa-spinner fa-pulse text-muted"></i>
</div>
</div>
<center>
<button class="btn btn-xs btn-default" style="border: none; background: transparent;" id="loadInfiniteScrollButton$uid"> More </button>
</center>
<script src="$webSiteRootURLnode_modules/infinite-scroll/dist/infinite-scroll.pkgd.min.js" type="text/javascript"></script>
<script>
var $container$uid;
$(function () {
loadInfiniteScrool$uid();
});
/*
*
document.addEventListener('scroll', function (e) {
var scrollPosition = window.pageYOffset;
var windowSize = window.innerHeight;
var bodyHeight = document.body.offsetHeight;
var distance = bodyHeight - (scrollPosition + windowSize);
//console.log('infiniteScroll ', distance, windowSize, distance < windowSize);
if (distance < windowSize) {
$container$uid.infiniteScroll('loadNextPage');
}
});*/
var append_infiniteScroll_timout;
function loadInfiniteScrool$uid() {
if (typeof $('$infinityScrollAppendIntoSelector').infiniteScroll !== 'funciton') {
$container$uid = $('$infinityScrollAppendIntoSelector').infiniteScroll({
path: '.pagination__next$uid',
append: '$infinityScrollGetFromSelector',
status: '.scroller-status$uid',
hideNav: '.infiniteScrollPagination$uid',
debug: false,
prefill: true,
history: false,
checkLastPage: false,
button: '#loadInfiniteScrollButton$uid'
});
$container$uid.on('scrollThreshold.infiniteScroll', function (event) {
//console.log('infiniteScroll Scroll at bottom');
});
$container$uid.on('request.infiniteScroll', function (event, path, fetchPromise) {
//console.log(`infiniteScroll Loading page: ${path}`);
});
let infScroll = $container$uid.data('infiniteScroll');
$container$uid.on('load.infiniteScroll', function (event, body, path, response) {
//console.log(`infiniteScroll Loaded: ${path}`, `Status: ${response.status}`, `Current page: ${infScroll.pageIndex}`, `${infScroll.loadCount} pages loaded`);
});
$container$uid.on('append.infiniteScroll', function (event, body, path, items, response) {
//console.log(`infiniteScroll Appended ${items.length} items on ${path}`, body);
clearTimeout(append_infiniteScroll_timout);
append_infiniteScroll_timout = setTimeout(function () {
lazyImage();
avideoSocket();
}, 1000);
});
$container$uid.on('error.infiniteScroll', function (event, error, path, response) {
//console.error(`infiniteScroll Could not load: ${path}. ${error}`);
});
$container$uid.on('last.infiniteScroll', function (event, body, path) {
//console.log(`infiniteScroll Last page hit on ${path}`, body, event);
});
$container$uid.on('history.infiniteScroll', function (event, title, path) {
//console.log(`infiniteScroll History changed to: ${path}`);
});
}
}
</script>

View file

@ -1,202 +1,197 @@
<?php
$objSecure = AVideoPlugin::getObjectDataIfEnabled('SecureVideosDirectory');
$search = array('{permaLink}','{imgSRC}','{title}', '{embedURL}', '{videoLengthInSeconds}');
$replace = array($permaLink,$img,$title, $embedURL, $videoLengthInSeconds);
?>
<div class="<?php echo $class; ?>" id="shareDiv">
<div class="tabbable-panel">
<div class="tabbable-line text-muted">
<ul class="nav nav-tabs">
<li class="nav-item">
<a class="nav-link " href="#tabShare" data-toggle="tab">
<span class="fa fa-share"></span>
<?php echo __("Share"); ?>
</a>
</li>
<?php
if (empty($objSecure->disableEmbedMode)) {
?>
<li class="nav-item">
<a class="nav-link " href="#tabEmbed" data-toggle="tab">
<span class="fa fa-code"></span>
<?php echo __("Share Code"); ?>
</a>
</li>
<?php
}
if (empty($advancedCustom->disableEmailSharing)) {
?>
<li class="nav-item">
<a class="nav-link" href="#tabEmail" data-toggle="tab">
<span class="fa fa-envelope"></span>
<?php echo __("E-mail"); ?>
</a>
</li>
<?php
}
if (!empty($permaLink) && $permaLink !== $URLFriendly) {
?>
<li class="nav-item">
<a class="nav-link" href="#tabPermaLink" data-toggle="tab">
<span class="fa fa-link"></span>
<?php echo __("Permanent Link"); ?>
</a>
</li>
<?php
}
?>
</ul>
<div class="tab-content clearfix">
<div class="tab-pane active" id="tabShare">
<?php
$url = $permaLink;
//$title = urlencode($title);
include $global['systemRootPath'] . 'view/include/social.php';
$type = 'animate__flipInX';
$loaderSequenceName = uniqid();
?>
</div>
<div class="tab-pane" id="tabEmbed">
<h4><i class="fas fa-share-square"></i> <?php echo __("Embed"); ?> (Iframe): <?php getButtontCopyToClipboard('textAreaEmbed'); ?></h4>
<textarea class="form-control <?php echo getCSSAnimationClassAndStyle($type, $loaderSequenceName); ?> min-width: 100%" rows="5" id="textAreaEmbed" readonly="readonly"><?php
$code = str_replace($search, $replace, $advancedCustom->embedCodeTemplate);
echo htmlentities($code);
?>
</textarea>
<h4><i class="fas fa-share-square"></i> <?php echo __("Embed"); ?> (Object): <?php getButtontCopyToClipboard('textAreaEmbedObject'); ?></h4>
<textarea class="form-control <?php echo getCSSAnimationClassAndStyle($type, $loaderSequenceName); ?> min-width: 100%" rows="5" id="textAreaEmbedObject" readonly="readonly"><?php
$code = str_replace($search, $replace, $advancedCustom->embedCodeTemplateObject);
echo htmlentities($code);
?>
</textarea>
<h4><i class="fas fa-share-square"></i> <?php echo __("Link"); ?> (HTML): <?php getButtontCopyToClipboard('textAreaHTML'); ?></h4>
<textarea class="form-control <?php echo getCSSAnimationClassAndStyle($type, $loaderSequenceName); ?> min-width: 100%" rows="5" id="textAreaHTML" readonly="readonly"><?php
$code = str_replace($search, $replace, $advancedCustom->htmlCodeTemplate);
echo htmlentities($code);
?>
</textarea>
<h4><i class="fas fa-share-square"></i> <?php echo __("Link"); ?> (BBCode): <?php getButtontCopyToClipboard('textAreaBBCode'); ?></h4>
<textarea class="form-control <?php echo getCSSAnimationClassAndStyle($type, $loaderSequenceName); ?> min-width: 100%" rows="5" id="textAreaBBCode" readonly="readonly"><?php
$code = str_replace($search, $replace, $advancedCustom->BBCodeTemplate);
echo htmlentities($code);
?>
</textarea>
</div>
<?php
if (empty($advancedCustom->disableEmailSharing)) {
$loaderSequenceName = uniqid();
?>
<div class="tab-pane" id="tabEmail">
<?php if (!User::isLogged()) { ?>
<strong>
<a href="<?php echo $global['webSiteRootURL']; ?>user"><?php echo __("Sign in now!"); ?></a>
</strong>
<?php } else { ?>
<form class="well form-horizontal" action="<?php echo $global['webSiteRootURL']; ?>sendEmail" method="post" id="contact_form">
<fieldset>
<!-- Text input-->
<div class="form-group <?php echo getCSSAnimationClassAndStyle($type, $loaderSequenceName); ?>">
<label class="col-md-4 control-label"><?php echo __("E-mail"); ?></label>
<div class="col-md-8 inputGroupContainer">
<div class="input-group">
<span class="input-group-addon"><i class="glyphicon glyphicon-envelope"></i></span>
<input name="email" placeholder="<?php echo __("E-mail Address"); ?>" class="form-control" type="text">
</div>
</div>
</div>
<!-- Text area -->
<div class="form-group <?php echo getCSSAnimationClassAndStyle($type, $loaderSequenceName); ?>">
<label class="col-md-4 control-label"><?php echo __("Message"); ?></label>
<div class="col-md-8 inputGroupContainer">
<div class="input-group">
<span class="input-group-addon"><i class="glyphicon glyphicon-pencil"></i></span>
<textarea class="form-control" name="comment" placeholder="<?php echo __("Message"); ?>"><?php echo __("I would like to share this video with you:"); ?> <?php echo $URLFriendly; ?></textarea>
</div>
</div>
</div>
<div class="form-group <?php echo getCSSAnimationClassAndStyle($type, $loaderSequenceName); ?>">
<label class="col-md-4 control-label"><?php echo __("Type the code"); ?></label>
<div class="col-md-8 inputGroupContainer">
<div class="input-group">
<span class="input-group-addon"><img src="<?php echo $global['webSiteRootURL']; ?>captcha?<?php echo time(); ?>" id="captcha"></span>
<span class="input-group-addon"><span class="btn btn-xs btn-success" id="btnReloadCapcha"><span class="glyphicon glyphicon-refresh"></span></span></span>
<input name="captcha" placeholder="<?php echo __("Type the code"); ?>" class="form-control" type="text" style="height: 60px;" maxlength="5" id="captchaText">
</div>
</div>
</div>
<!-- Button -->
<div class="form-group <?php echo getCSSAnimationClassAndStyle($type, $loaderSequenceName); ?>">
<label class="col-md-4 control-label"></label>
<div class="col-md-8">
<button type="submit" class="btn btn-primary" ><?php echo __("Send"); ?> <span class="glyphicon glyphicon-send"></span></button>
</div>
</div>
</fieldset>
</form>
<script>
$(document).ready(function () {
$('#btnReloadCapcha').click(function () {
$('#captcha').attr('src', '<?php echo $global['webSiteRootURL']; ?>captcha?' + Math.random());
$('#captchaText').val('');
});
$('#contact_form').submit(function (evt) {
evt.preventDefault();
modal.showPleaseWait();
$.ajax({
url: '<?php echo $global['webSiteRootURL']; ?>objects/sendEmail.json.php',
data: $('#contact_form').serializeArray(),
type: 'post',
success: function (response) {
modal.hidePleaseWait();
if (!response.error) {
avideoAlert("<?php echo __("Congratulations!"); ?>", "<?php echo __("Your message has been sent!"); ?>", "success");
} else {
avideoAlert("<?php echo __("Your message could not be sent!"); ?>", response.error, "error");
}
$('#btnReloadCapcha').trigger('click');
}
});
return false;
});
});
</script>
<?php } ?>
</div>
<?php
}
if (!empty($permaLink) && $permaLink !== $URLFriendly) {
$loaderSequenceName = uniqid();
?>
<div class="tab-pane" id="tabPermaLink">
<div class="form-group <?php echo getCSSAnimationClassAndStyle($type, $loaderSequenceName); ?>">
<label class="control-label"><?php echo __("Permanent Link") ?></label>
<?php
getInputCopyToClipboard('linkPermanent', $permaLink);
?>
</div>
<div class="form-group <?php echo getCSSAnimationClassAndStyle($type, $loaderSequenceName); ?>">
<label class="control-label"><?php echo __("URL Friendly") ?> (SEO)</label>
<?php
getInputCopyToClipboard('linkFriendly', $URLFriendly);
?>
</div>
<div class="form-group <?php echo getCSSAnimationClassAndStyle($type, $loaderSequenceName); ?>">
<label class="control-label"><?php echo __("Current Time") ?> (SEO)</label>
<?php
getInputCopyToClipboard('linkCurrentTime', $URLFriendly);
?>
</div>
</div>
<?php
}
?>
</div>
</div>
</div>
</div>
<?php
$objSecure = AVideoPlugin::getObjectDataIfEnabled('SecureVideosDirectory');
$search = ['{permaLink}','{imgSRC}','{title}', '{embedURL}', '{videoLengthInSeconds}'];
$replace = [$permaLink,$img,$title, $embedURL, $videoLengthInSeconds];
?>
<div class="<?php echo $class; ?>" id="shareDiv">
<div class="tabbable-panel">
<div class="tabbable-line text-muted">
<ul class="nav nav-tabs">
<li class="nav-item">
<a class="nav-link " href="#tabShare" data-toggle="tab">
<span class="fa fa-share"></span>
<?php echo __("Share"); ?>
</a>
</li>
<?php
if (empty($objSecure->disableEmbedMode)) {
?>
<li class="nav-item">
<a class="nav-link " href="#tabEmbed" data-toggle="tab">
<span class="fa fa-code"></span>
<?php echo __("Share Code"); ?>
</a>
</li>
<?php
}
if (empty($advancedCustom->disableEmailSharing)) {
?>
<li class="nav-item">
<a class="nav-link" href="#tabEmail" data-toggle="tab">
<span class="fa fa-envelope"></span>
<?php echo __("E-mail"); ?>
</a>
</li>
<?php
}
if (!empty($permaLink) && $permaLink !== $URLFriendly) {
?>
<li class="nav-item">
<a class="nav-link" href="#tabPermaLink" data-toggle="tab">
<span class="fa fa-link"></span>
<?php echo __("Permanent Link"); ?>
</a>
</li>
<?php
}
?>
</ul>
<div class="tab-content clearfix">
<div class="tab-pane active" id="tabShare">
<?php
$url = $permaLink;
//$title = urlencode($title);
include $global['systemRootPath'] . 'view/include/social.php';
$type = 'animate__flipInX';
$loaderSequenceName = uniqid();
?>
</div>
<div class="tab-pane" id="tabEmbed">
<h4><i class="fas fa-share-square"></i> <?php echo __("Embed"); ?> (Iframe): <?php getButtontCopyToClipboard('textAreaEmbed'); ?></h4>
<textarea class="form-control <?php echo getCSSAnimationClassAndStyle($type, $loaderSequenceName); ?> min-width: 100%" rows="5" id="textAreaEmbed" readonly="readonly"><?php
$code = str_replace($search, $replace, $advancedCustom->embedCodeTemplate);
echo htmlentities($code);
?>
</textarea>
<h4><i class="fas fa-share-square"></i> <?php echo __("Embed"); ?> (Object): <?php getButtontCopyToClipboard('textAreaEmbedObject'); ?></h4>
<textarea class="form-control <?php echo getCSSAnimationClassAndStyle($type, $loaderSequenceName); ?> min-width: 100%" rows="5" id="textAreaEmbedObject" readonly="readonly"><?php
$code = str_replace($search, $replace, $advancedCustom->embedCodeTemplateObject);
echo htmlentities($code);
?>
</textarea>
<h4><i class="fas fa-share-square"></i> <?php echo __("Link"); ?> (HTML): <?php getButtontCopyToClipboard('textAreaHTML'); ?></h4>
<textarea class="form-control <?php echo getCSSAnimationClassAndStyle($type, $loaderSequenceName); ?> min-width: 100%" rows="5" id="textAreaHTML" readonly="readonly"><?php
$code = str_replace($search, $replace, $advancedCustom->htmlCodeTemplate);
echo htmlentities($code);
?>
</textarea>
<h4><i class="fas fa-share-square"></i> <?php echo __("Link"); ?> (BBCode): <?php getButtontCopyToClipboard('textAreaBBCode'); ?></h4>
<textarea class="form-control <?php echo getCSSAnimationClassAndStyle($type, $loaderSequenceName); ?> min-width: 100%" rows="5" id="textAreaBBCode" readonly="readonly"><?php
$code = str_replace($search, $replace, $advancedCustom->BBCodeTemplate);
echo htmlentities($code);
?>
</textarea>
</div>
<?php
if (empty($advancedCustom->disableEmailSharing)) {
$loaderSequenceName = uniqid(); ?>
<div class="tab-pane" id="tabEmail">
<?php if (!User::isLogged()) { ?>
<strong>
<a href="<?php echo $global['webSiteRootURL']; ?>user"><?php echo __("Sign in now!"); ?></a>
</strong>
<?php } else { ?>
<form class="well form-horizontal" action="<?php echo $global['webSiteRootURL']; ?>sendEmail" method="post" id="contact_form">
<fieldset>
<!-- Text input-->
<div class="form-group <?php echo getCSSAnimationClassAndStyle($type, $loaderSequenceName); ?>">
<label class="col-md-4 control-label"><?php echo __("E-mail"); ?></label>
<div class="col-md-8 inputGroupContainer">
<div class="input-group">
<span class="input-group-addon"><i class="glyphicon glyphicon-envelope"></i></span>
<input name="email" placeholder="<?php echo __("E-mail Address"); ?>" class="form-control" type="text">
</div>
</div>
</div>
<!-- Text area -->
<div class="form-group <?php echo getCSSAnimationClassAndStyle($type, $loaderSequenceName); ?>">
<label class="col-md-4 control-label"><?php echo __("Message"); ?></label>
<div class="col-md-8 inputGroupContainer">
<div class="input-group">
<span class="input-group-addon"><i class="glyphicon glyphicon-pencil"></i></span>
<textarea class="form-control" name="comment" placeholder="<?php echo __("Message"); ?>"><?php echo __("I would like to share this video with you:"); ?> <?php echo $URLFriendly; ?></textarea>
</div>
</div>
</div>
<div class="form-group <?php echo getCSSAnimationClassAndStyle($type, $loaderSequenceName); ?>">
<label class="col-md-4 control-label"><?php echo __("Type the code"); ?></label>
<div class="col-md-8 inputGroupContainer">
<div class="input-group">
<span class="input-group-addon"><img src="<?php echo $global['webSiteRootURL']; ?>captcha?<?php echo time(); ?>" id="captcha"></span>
<span class="input-group-addon"><span class="btn btn-xs btn-success" id="btnReloadCapcha"><span class="glyphicon glyphicon-refresh"></span></span></span>
<input name="captcha" placeholder="<?php echo __("Type the code"); ?>" class="form-control" type="text" style="height: 60px;" maxlength="5" id="captchaText">
</div>
</div>
</div>
<!-- Button -->
<div class="form-group <?php echo getCSSAnimationClassAndStyle($type, $loaderSequenceName); ?>">
<label class="col-md-4 control-label"></label>
<div class="col-md-8">
<button type="submit" class="btn btn-primary" ><?php echo __("Send"); ?> <span class="glyphicon glyphicon-send"></span></button>
</div>
</div>
</fieldset>
</form>
<script>
$(document).ready(function () {
$('#btnReloadCapcha').click(function () {
$('#captcha').attr('src', '<?php echo $global['webSiteRootURL']; ?>captcha?' + Math.random());
$('#captchaText').val('');
});
$('#contact_form').submit(function (evt) {
evt.preventDefault();
modal.showPleaseWait();
$.ajax({
url: '<?php echo $global['webSiteRootURL']; ?>objects/sendEmail.json.php',
data: $('#contact_form').serializeArray(),
type: 'post',
success: function (response) {
modal.hidePleaseWait();
if (!response.error) {
avideoAlert("<?php echo __("Congratulations!"); ?>", "<?php echo __("Your message has been sent!"); ?>", "success");
} else {
avideoAlert("<?php echo __("Your message could not be sent!"); ?>", response.error, "error");
}
$('#btnReloadCapcha').trigger('click');
}
});
return false;
});
});
</script>
<?php } ?>
</div>
<?php
}
if (!empty($permaLink) && $permaLink !== $URLFriendly) {
$loaderSequenceName = uniqid(); ?>
<div class="tab-pane" id="tabPermaLink">
<div class="form-group <?php echo getCSSAnimationClassAndStyle($type, $loaderSequenceName); ?>">
<label class="control-label"><?php echo __("Permanent Link") ?></label>
<?php
getInputCopyToClipboard('linkPermanent', $permaLink); ?>
</div>
<div class="form-group <?php echo getCSSAnimationClassAndStyle($type, $loaderSequenceName); ?>">
<label class="control-label"><?php echo __("URL Friendly") ?> (SEO)</label>
<?php
getInputCopyToClipboard('linkFriendly', $URLFriendly); ?>
</div>
<div class="form-group <?php echo getCSSAnimationClassAndStyle($type, $loaderSequenceName); ?>">
<label class="control-label"><?php echo __("Current Time") ?> (SEO)</label>
<?php
getInputCopyToClipboard('linkCurrentTime', $URLFriendly); ?>
</div>
</div>
<?php
}
?>
</div>
</div>
</div>
</div>

View file

@ -1,86 +1,82 @@
<?php
global $videos_id;
echo PHP_EOL."<!-- OpenGraph for the Site -->".PHP_EOL;
if ($users_id = isChannel()) {
echo PHP_EOL."<!-- OpenGraph channel -->".PHP_EOL;
$imgw = 200;
$imgh = 200;
$img = User::getOGImage($users_id);
$title = User::getNameIdentificationById($users_id);
$url = User::getChannelLink($users_id);
?>
<meta property="og:type" content="profile" />
<meta property="profile:username" content="<?php echo $title; ?>" />
<?php
} else if (!empty($_GET['catName'])) {
$imgw = 200;
$imgh = 200;
$category = Category::getCategoryByName($_GET['catName']);
$img = Category::getOGImage($category['id']);
$title = html2plainText($category['name']);
$url = Category::getCategoryLinkFromName($_GET['catName']);
echo PHP_EOL."<!-- OpenGraph not video -->".PHP_EOL;
?>
<meta property="og:type" content="website" />
<meta property="og:site_name" content="<?php echo $title; ?>">
<?php
} else if (!isVideo() && empty($videos_id)) {
$imgw = 200;
$imgh = 200;
$img = Configuration::getOGImage();
$title = html2plainText($config->getWebSiteTitle());
$url = $global['webSiteRootURL'];
echo PHP_EOL."<!-- OpenGraph not video -->".PHP_EOL;
?>
<meta property="og:type" content="website" />
<meta property="og:site_name" content="<?php echo $title; ?>">
<?php
} else {
return false;
}
if(empty($customizePluginDescription)){
if(AVideoPlugin::isEnabledByName('Customize')){
$ec = new ExtraConfig();
$customizePluginDescription = $ec->getDescription();
}
}
$description = $title;
if(!empty($customizePluginDescription)){
$description = $customizePluginDescription;
}else
if(!empty($metaDescription)){
$description = $metaDescription;
}
?>
<link rel="image_src" href="<?php echo $img; ?>" />
<meta property="og:image" content="<?php echo $img; ?>" />
<meta property="og:image:url" content="<?php echo $img; ?>" />
<meta property="og:image:secure_url" content="<?php echo $img; ?>" />
<meta property="og:image:type" content="image/jpeg" />
<meta property="og:image:width" content="<?php echo $imgw; ?>" />
<meta property="og:image:height" content="<?php echo $imgh; ?>" />
<meta property="fb:app_id" content="774958212660408" />
<meta property="og:title" content="<?php echo $title; ?>" />
<meta property="og:description" content="<?php echo $description; ?>" />
<meta property="og:url" content="<?php echo $url; ?>" />
<link rel="canonical" href="<?php echo $url; ?>" />
<?php
if (!empty($advancedCustom->twitter_summary_large_image)) {
?>
<meta name="twitter:card" content="summary_large_image" />
<?php
} else {
?>
<meta name="twitter:card" content="summary" />
<?php
}
?>
<meta name="twitter:url" content="<?php echo $global['webSiteRootURL']; ?>"/>
<meta name="twitter:title" content="<?php echo $title; ?>"/>
<meta name="twitter:description" content="<?php echo $title; ?>"/>
<?php
global $videos_id;
echo PHP_EOL."<!-- OpenGraph for the Site -->".PHP_EOL;
if ($users_id = isChannel()) {
echo PHP_EOL."<!-- OpenGraph channel -->".PHP_EOL;
$imgw = 200;
$imgh = 200;
$img = User::getOGImage($users_id);
$title = User::getNameIdentificationById($users_id);
$url = User::getChannelLink($users_id); ?>
<meta property="og:type" content="profile" />
<meta property="profile:username" content="<?php echo $title; ?>" />
<?php
} elseif (!empty($_GET['catName'])) {
$imgw = 200;
$imgh = 200;
$category = Category::getCategoryByName($_GET['catName']);
$img = Category::getOGImage($category['id']);
$title = html2plainText($category['name']);
$url = Category::getCategoryLinkFromName($_GET['catName']);
echo PHP_EOL."<!-- OpenGraph not video -->".PHP_EOL; ?>
<meta property="og:type" content="website" />
<meta property="og:site_name" content="<?php echo $title; ?>">
<?php
} elseif (!isVideo() && empty($videos_id)) {
$imgw = 200;
$imgh = 200;
$img = Configuration::getOGImage();
$title = html2plainText($config->getWebSiteTitle());
$url = $global['webSiteRootURL'];
echo PHP_EOL."<!-- OpenGraph not video -->".PHP_EOL; ?>
<meta property="og:type" content="website" />
<meta property="og:site_name" content="<?php echo $title; ?>">
<?php
} else {
return false;
}
if (empty($customizePluginDescription)) {
if (AVideoPlugin::isEnabledByName('Customize')) {
$ec = new ExtraConfig();
$customizePluginDescription = $ec->getDescription();
}
}
$description = $title;
if (!empty($customizePluginDescription)) {
$description = $customizePluginDescription;
} elseif (!empty($metaDescription)) {
$description = $metaDescription;
}
?>
<link rel="image_src" href="<?php echo $img; ?>" />
<meta property="og:image" content="<?php echo $img; ?>" />
<meta property="og:image:url" content="<?php echo $img; ?>" />
<meta property="og:image:secure_url" content="<?php echo $img; ?>" />
<meta property="og:image:type" content="image/jpeg" />
<meta property="og:image:width" content="<?php echo $imgw; ?>" />
<meta property="og:image:height" content="<?php echo $imgh; ?>" />
<meta property="fb:app_id" content="774958212660408" />
<meta property="og:title" content="<?php echo $title; ?>" />
<meta property="og:description" content="<?php echo $description; ?>" />
<meta property="og:url" content="<?php echo $url; ?>" />
<link rel="canonical" href="<?php echo $url; ?>" />
<?php
if (!empty($advancedCustom->twitter_summary_large_image)) {
?>
<meta name="twitter:card" content="summary_large_image" />
<?php
} else {
?>
<meta name="twitter:card" content="summary" />
<?php
}
?>
<meta name="twitter:url" content="<?php echo $global['webSiteRootURL']; ?>"/>
<meta name="twitter:title" content="<?php echo $title; ?>"/>
<meta name="twitter:description" content="<?php echo $title; ?>"/>
<meta name="twitter:image" content="<?php echo $img; ?>"/>

File diff suppressed because it is too large Load diff

View file

@ -1,83 +1,80 @@
<?php
if (empty($advancedCustom->disableHTMLDescription)) {
global $tinyMCELibs;
if (empty($tinyMCELibs)) {
$tinyMCELibs = 1;
?>
<script type="text/javascript" src="<?php echo getURL('node_modules/tinymce/tinymce.min.js'); ?>"></script>
<style>.tox-statusbar__branding{display:none !important;}</style>
<?php
}
?>
<script>
<?php
if ($simpleMode) {
?>
function images_upload_handler(blobInfo, success, failure) {
avideoToastError('Image upload disabled');
}
var tinyMCEplugins = 'code print preview autolink fullscreen link hr pagebreak nonbreaking anchor wordcount help ';
var tinyMCEtoolbar = 'fullscreen | styleselect align bold italic strikethrough underline | link | numlist bullist | removeformat | code';
var tinyMCEmenubar = '';
<?php
} else {
?>
function images_upload_handler(blobInfo, success, failure) {
var xhr, formData;
var timeOuttime = 0;
if (!videos_id) {
$('#inputTitle').val("Article automatically booked");
saveVideo(false);
timeOuttime = 5;
}
setTimeout(function () {
xhr = new XMLHttpRequest();
xhr.withCredentials = false;
xhr.open('POST', webSiteRootURL + 'objects/uploadArticleImage.php?video_id=' + videos_id);
xhr.onload = function () {
var json;
if (xhr.status != 200) {
failure('HTTP Error: ' + xhr.status);
return;
}
json = xhr.responseText;
json = JSON.parse(json);
if (json.error === false && json.url) {
success(json.url);
} else if (json.msg) {
avideoAlertError(json.msg);
} else {
avideoAlertError("<?php echo __("Unknown Error!"); ?>");
}
};
formData = new FormData();
formData.append('file_data', blobInfo.blob(), blobInfo.filename());
xhr.send(formData);
}, timeOuttime);
}
var tinyMCEplugins = 'code print preview searchreplace autolink directionality visualblocks visualchars fullscreen image link media codesample table charmap hr pagebreak nonbreaking anchor toc insertdatetime advlist lists wordcount imagetools textpattern help ';
var tinyMCEtoolbar = 'fullscreen | formatselect | bold italic strikethrough | link image media pageembed | numlist bullist | removeformat | addcomment';
var tinyMCEmenubar = 'edit insert view format table tools help';
<?php
}
?>
tinymce.init({
language: "<?php echo ($_SESSION['language'] == 'en_US') ? 'us' : $_SESSION['language']; ?>",
language_url: '<?php echo getURL('node_modules/tinymce-langs/langs/' . (($_SESSION['language'] == 'en_US') ? 'us' : $_SESSION['language']) . '.js'); ?>',
selector: '#<?php echo $id; ?>', // change this value according to your HTML
plugins: tinyMCEplugins,
//toolbar: 'fullscreen | formatselect | bold italic strikethrough forecolor backcolor permanentpen formatpainter | link image media pageembed | alignleft aligncenter alignright alignjustify | numlist bullist outdent indent | removeformat | addcomment',
toolbar: tinyMCEtoolbar,
menubar: tinyMCEmenubar, // remove 'file' menu as it's useless in our context
height: 400,
convert_urls: false,
mobile: {
theme: 'silver'
},
images_upload_handler: images_upload_handler
});
</script>
<?php
}
<?php
if (empty($advancedCustom->disableHTMLDescription)) {
global $tinyMCELibs;
if (empty($tinyMCELibs)) {
$tinyMCELibs = 1; ?>
<script type="text/javascript" src="<?php echo getURL('node_modules/tinymce/tinymce.min.js'); ?>"></script>
<style>.tox-statusbar__branding{display:none !important;}</style>
<?php
} ?>
<script>
<?php
if ($simpleMode) {
?>
function images_upload_handler(blobInfo, success, failure) {
avideoToastError('Image upload disabled');
}
var tinyMCEplugins = 'code print preview autolink fullscreen link hr pagebreak nonbreaking anchor wordcount help ';
var tinyMCEtoolbar = 'fullscreen | styleselect align bold italic strikethrough underline | link | numlist bullist | removeformat | code';
var tinyMCEmenubar = '';
<?php
} else {
?>
function images_upload_handler(blobInfo, success, failure) {
var xhr, formData;
var timeOuttime = 0;
if (!videos_id) {
$('#inputTitle').val("Article automatically booked");
saveVideo(false);
timeOuttime = 5;
}
setTimeout(function () {
xhr = new XMLHttpRequest();
xhr.withCredentials = false;
xhr.open('POST', webSiteRootURL + 'objects/uploadArticleImage.php?video_id=' + videos_id);
xhr.onload = function () {
var json;
if (xhr.status != 200) {
failure('HTTP Error: ' + xhr.status);
return;
}
json = xhr.responseText;
json = JSON.parse(json);
if (json.error === false && json.url) {
success(json.url);
} else if (json.msg) {
avideoAlertError(json.msg);
} else {
avideoAlertError("<?php echo __("Unknown Error!"); ?>");
}
};
formData = new FormData();
formData.append('file_data', blobInfo.blob(), blobInfo.filename());
xhr.send(formData);
}, timeOuttime);
}
var tinyMCEplugins = 'code print preview searchreplace autolink directionality visualblocks visualchars fullscreen image link media codesample table charmap hr pagebreak nonbreaking anchor toc insertdatetime advlist lists wordcount imagetools textpattern help ';
var tinyMCEtoolbar = 'fullscreen | formatselect | bold italic strikethrough | link image media pageembed | numlist bullist | removeformat | addcomment';
var tinyMCEmenubar = 'edit insert view format table tools help';
<?php
} ?>
tinymce.init({
language: "<?php echo ($_SESSION['language'] == 'en_US') ? 'us' : $_SESSION['language']; ?>",
language_url: '<?php echo getURL('node_modules/tinymce-langs/langs/' . (($_SESSION['language'] == 'en_US') ? 'us' : $_SESSION['language']) . '.js'); ?>',
selector: '#<?php echo $id; ?>', // change this value according to your HTML
plugins: tinyMCEplugins,
//toolbar: 'fullscreen | formatselect | bold italic strikethrough forecolor backcolor permanentpen formatpainter | link image media pageembed | alignleft aligncenter alignright alignjustify | numlist bullist outdent indent | removeformat | addcomment',
toolbar: tinyMCEtoolbar,
menubar: tinyMCEmenubar, // remove 'file' menu as it's useless in our context
height: 400,
convert_urls: false,
mobile: {
theme: 'silver'
},
images_upload_handler: images_upload_handler
});
</script>
<?php
}

Some files were not shown because too many files have changed in this diff Show more