GithubHelp home page GithubHelp logo

mythtv / mythweb Goto Github PK

View Code? Open in Web Editor NEW
98.0 98.0 73.0 14.17 MB

The official MythTV mythweb repository

License: Other

PHP 72.20% JavaScript 7.67% CSS 18.33% Perl 1.68% Dockerfile 0.12% Hack 0.01%

mythweb's Introduction

build Coverity scan GitHub issues GitHub pull requests GitHub top language

Welcome to MythTV

mythweb's People

Contributors

amessina avatar amlopezalonso avatar beirdo avatar campbsb avatar cbovy avatar cpinkham avatar daniel-kristjansson avatar dblain avatar dekarl avatar dhaber avatar ex-nerd avatar fgouget avatar jannau avatar jmusits avatar josejuan05 avatar jpoet avatar kormoc avatar linuxdude42 avatar mkbloke avatar nigelpearson avatar rkulagowski avatar sphery avatar stichnot avatar stuarta avatar stuartm avatar wagnerrp avatar wofferl avatar yasij avatar yianniv avatar yunosh avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mythweb's Issues

Error thrown when trying to create new recording schedule in tv/detail/

If I search for a program, find it, look at the detail and set it to record, the following error is thrown:

  error type:  Warning
error string:  !!NoTrans: Use of undefined constant Math - assumed 'Math' (this will throw an Error in a future version of PHP)!!
    filename:  modules/tv/classes/Schedule.php
  error line:  295

Fix url encoding of sort links in column titles

I've discovered a small bug in MythWeb fixes/31 that is also present in master and older branches.

Resolved in pull request #47.

If I perform the following navigation on MythWeb:

  • Click "Searches" heading
  • Click "Movies, 3½ Stars or more" link
  • Click "Title" colummn heading

The results returned are no longer filtered by the canned search (Movies, 3½ Stars or more) and if a lot of programs are available in the results it could blow up with: Fatal error: Allowed memory size of <num> bytes exhausted.

The reason for the issue is that the canned search in the sort link is not encoded correctly. The application then fails to recognise the canned search in search.php and discards it; if (empty($Canned_Searches[$search_name])) ...

The page tv/searches has the following link:

<a href="tv/search/canned%3AMovies%2C%203%26frac12%3B%20Stars%20or%20more">

The page tv/search/canned%3AMovies%2C 3%26frac12%3B Stars or more has the following link:

<a href="tv/search/canned:Movies, 3&frac12; Stars or more?sortby=title">

it should be:

<a href="tv/search/canned%3AMovies%2C%203%26frac12%3B%20Stars%20or%20more?sortby=title">

The root cause is the use of PATH_INFO when building the link in includes/sorting.php. PATH_INFO has been previously decoded and is not reencoded on output. An alternative way would be to use REQUEST_URI as that has not been decoded.

Unable to open mythweb if mythmusic has never been used

The PHP docs report:

As of PHP 8.1.0, the default setting is MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT. Previously, it was MYSQLI_REPORT_OFF.

This is breaking MythWeb from starting if you don't use mythmusic as the init check now throws this:

PHP Fatal error:  Uncaught mysqli_sql_exception: Table 'mythconverg.music_songs' doesn't exist in
 /usr/share/mythweb/classes/Database/Query/mysqlicompat.php:68
Stack trace:
#0 /usr/share/mythweb/classes/Database/Query/mysqlicompat.php(68): mysqli_query()
#1 /usr/share/mythweb/classes/Database.php(263): Database_Query_mysqlicompat->execute()
#2 /usr/share/mythweb/classes/Database.php(326): Database->query()
#3 /usr/share/mythweb/modules/music/init.php(15): Database->query_col()
#4 /usr/share/mythweb/classes/Modules.php(30): require_once('...')
#5 /usr/share/mythweb/classes/Modules.php(50): Modules::load()
#6 /usr/share/mythweb/mythweb.php(30): Modules::getModule()

Initially I was thinking you could switch to looking up if the table existed in the information_schema which would solve these checks in the init modules however it wouldn't solve this case where the user's custom SQL needs to be attempted and the result reported back.

Options:

  1. Restore previous behaviour by running mysqli_report(MYSQLI_REPORT_OFF); somewhere high up (eg. on connect)
  2. Add try...catch around the mysqli_query call and handle based on the $db->fatal_errors setting
  3. Remove the enable/disable fatal_errors functionality completely and handle the exceptions locally as required.

Happy to help with a pull request once an option is decided on,

RFE: Display people in priority order when displaying program details

RFE: Display people in priority order when displaying program details

With MythTV commit bf47572d56 (Include actor roles in cast info) the credits table now maintains the order received from a XMLTV feed(1). The following proposed patch returns the credits in the order specified for display purposes. Because an actor may play multiple characters in certain shows, only return an actor's name once.

diff --git a/modules/tv/classes/Program.php b/modules/tv/classes/Program.php
index 1de5c777..519a8b14 100644
--- a/modules/tv/classes/Program.php
+++ b/modules/tv/classes/Program.php
@@ -565,12 +565,13 @@ class Program extends MythBase {
     // No cached value -- load it
         if (!isset($this->credits[$role][$add_search_links])) {
         // Get the credits for the requested role
-            $result = $db->query('SELECT people.name
+            $result = $db->query('SELECT UNIQUE(people.name)
                                      FROM credits, people
                                     WHERE credits.person    = people.person
                                       AND credits.role      = ?
                                       AND credits.chanid    = ?
-                                      AND credits.starttime = FROM_UNIXTIME(?)',
+                                      AND credits.starttime = FROM_UNIXTIME(?)
+                                      ORDER BY credits.priority',
                                    $role,
                                    $this->chanid,
                                    $this->starttime

(1) All compliant XMLTV grabbers, per the DTD, are expected to provide the credits in order of billing (to the best of their ability).

Add support for PHP 8.x

Of course it's well known that MythWeb doesn't support PHP 8.x. In response to this I've seen comments suggesting that pull requests would be considered. I've worked through all of the issues I've identified and created pull request #62. MythWeb is now working for me on 8.0 and I believe it will also work on 8.1. Please consider my pull request.

Numerous errors in PHP8.0

Seems the use of some deprecated functions is breaking Mythweb from working in PHP8.0

errors.php - line 50 - assert_options(ASSERT_QUIET_EVAL, 1); [Deprecated Function
cleanup.php - line 50 - if (get_magic_quotes_gpc()) { [Deprecated Function]

Thats as far as i've gone. I may try and fix on my own and post changes back over the holidays. not sure if someone else is already undertaking this effort. Obviously PHP 7.4 is supported for a long time yet so thats the best workaround for this issue.

Accessing any recording schedule with lite template results in warning

If I access tv/detail?recordid=... when using the lite template mythweb displays an error.

  error type:  Warning
error string:  !!NoTrans: Attempt to modify property 'recgroup' of non-object!!
    filename:  .../modules/tv/classes/Schedule.php
  error line:  631

This is because the called to recgroup_select incorrectly reference recgroup.

Reference configuration for caddy2 server

I've created a Caddyfile to enable using Caddy2 as the web server, and thought I would share. I'd suggest adding this as mythweb.conf.caddy.

# The Caddyfile is an easy way to configure your Caddy web server.
#
# Unless the file starts with a global options block, the first
# uncommented line is always the address of your site.
#
# To use your own domain name (with automatic HTTPS), first make
# sure your domain's A/AAAA DNS records are properly pointed to
# this machine's public IP, then replace ":80" below with your
# domain name.

# Global options https://caddyserver.com/docs/caddyfile/options
{
	auto_https off
	admin off
	log {
		output file /var/log/caddy/caddy.log {
			roll_size 50
			roll_keep 5
			roll_keep_for 2d
		}
		format console
		level INFO
		#level   DEBUG
	}
}

:8080 {
	# Set this path to your site's directory.
	root * /usr/share/caddy/mythweb

	# Add trailing slash for directory requests
	@canonicalPath {
		file {path}/mythweb.php
		not path */
	}
	redir @canonicalPath {path}/ 308

	# Enable the static file server.
	file_server

	# rewrite rules
	@myth_do_nothing {
		path_regexp myth_do_nothing_reg ^/(css|data|images|js|themes|skins|[a-z_]+\.(php|pl)).*
	}
	@myth_perl {
		path_regexp myth_perl_reg ^/(pl(/.*)?)$
	}
	@myth_php {
		path_regexp myth_php_reg ^/(.+)$
	}
	handle @myth_do_nothing {
		#do nothing but keep other handlers from running
		#rewrite @myth_do_nothing {http.regexp.myth_do_nothing_reg.0}
	}
	handle @myth_perl {
		rewrite @myth_perl /mythweb.pl/{http.regexp.myth_perl_reg.1}
	}
	handle @myth_php {
		rewrite @myth_php /mythweb.php/{http.regexp.myth_php_reg.1}
	}
	handle * {
		rewrite * mythweb.php
	}

	# Proxy PHP files to the FastCGI responder
	@phpFiles path *.php*
	reverse_proxy @phpFiles unix//run/php/php7.4-fpm.sock {
		transport fastcgi {
			split .php
			env db_server localhost
			env db_name mythconverg
			env db_login mythtv
			env db_password mythtv
		}
	}
}

# Refer to the Caddy docs for more information:
# https://caddyserver.com/docs/caddyfile 

Add default sort order to tv/schedules

When a user navigates to /tv/schedules the very first time the results aren't ordered. I believe that it would be good for them to be ordered by title on first.

Suggested fix in pull request #48.

Exists in master, fixes/31, fixes/30 and maybe others.

upgrade to 22.04 from 20.04 breaks mythweb

Not sure exactly what is wrong and I've almost certainly "fixed" it badly....but.

After doing the release upgrade I was getting this when attempting to access mythweb on the mother in laws PC.

PHP Fatal error:  Uncaught Error: Undefined constant "modules_path" in
/usr/share/mythtv/mythweb/includes/class_autoload.php:19\nStack trace:\n#0
/usr/share/mythtv/mythweb/classes/Translate.php(16): autoload()\n#1
/usr/share/mythtv/mythweb/includes/class_autoload.php(18): include_once('...')\n#2 [internal function]: autoload()\n#3 /usr/share/mythtv/mythweb/includes/errors.php(116): class_exists()\n#4 [internal function]: error_handler()\n#5
/usr/share/mythtv/mythweb/includes/php_version_check.php(20): trigger_error()\n#6
/usr/share/mythtv/mythweb/includes/init.php(33): require_once('...')\n#7
/usr/share/mythtv/mythweb/mythweb.php(20): require_once('...')\n#8 {main}\n  thrown in
/usr/share/mythtv/mythweb/includes/class_autoload.php on line 19

It looks like it's running the class_autoload before it has run the defines that well define modules_path.

My "fix" for it was to edit /usr/share/mythtv/mythweb/includes/init.php
At the start of the file is

// Attempt to load up firephp if installed on the server
    @include_once('FirePHPCore/fb.php');

    require_once 'includes/errors.php';
// Lazy load the classes...
    require_once 'includes/class_autoload.php';

I changed this to

// Attempt to load up firephp if installed on the server
    @include_once('FirePHPCore/fb.php');

    require_once 'includes/errors.php';

//these should be loaded before running the class autoloader, it may be better placing these requires there as it is the bit that requires it but other things here will probably also need it
    require_once 'includes/utils.php';
    require_once 'includes/defines.php';

// Lazy load the classes...
    require_once 'includes/class_autoload.php';

and it seems to work.

I'm putting this here rather than a pull in hopes google finds it and hence others do too if they need it. Also I'm at my mother in laws place over xmas and getting all that chooching would be a giant pain. Sorry to whomever picks this one up.

Update required for mythweb_id cookie (SameSite attribute)

Changes are coming in browsers relating to cookies that either do not specify SameSite or set SameSite=None on cookies.

Firefox can now show:

Cookie “mythweb_id” will be soon rejected because it has the “SameSite” attribute set to “None” or an invalid value, without the “secure” attribute. To know more about the “SameSite“ attribute, read https://developer.mozilla.org/docs/Web/HTTP/Headers/Set-Cookie/SameSite

in the console.

For further information, you can also refer to:

https://hacks.mozilla.org/2020/08/changes-to-samesite-cookie-behavior/
https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie/SameSite#fixing_common_warnings

One option is to specify the Secure attribute with the cookie when SameSite=None, the others are to specify either SameSite=Lax or SameSite=Strict. The former will only work for HTTPS connections, while the latter two will work for both HTTP and HTTPS connections. Given that I believe there is no requirement for a setting of either None or Lax, it seems easiest to implement Strict, which should allow folks to use either HTTP or HTTPS on their servers without problems and without additional code to determine which is in use (as would apply if SameSite=None and the Secure attribute were used).

I will submit a PR for this.

Typo in js/table_sort.js

There is a typo on js/table_sort.js.

this.callback_presort(table_id, heder_index);

should be

this.callback_presort(table_id, header_index);

I haven't spent time working out what this does, and whether the fix breaks something. But it's clearly a mistake.

Easy fix created in pull request #49.

stream_raw: "isn't numeric" error

I see a lot of:

Argument "" isn't numeric in numeric lt (<) at /usr/share/mythtv/mythweb/modules/stream/stream_raw.pl line 123

in my logs when Firefox doesn't use the optional end range in the range header (so the range is just 12345-). A small addition to check for '' before the numeric will fix this. Will create a PR now and link to this issue.

Cheers.

Cleanup PHP warnings and errors

https://code.mythtv.org/trac/ticket/13638

Attached is the first round of patches I first referenced on the forums. The intention is to clear up all of the PHP notices/warnings to make compatibility changes for future PHP versions easier to find. Right now, mythweb runs with an error_reporting() level that hides some potential flaws, along with things that may change from notices/deprecation warnings to errors in future PHP versions. I've only done patches for the default theme to give people an idea of what these changes entail. Obviously with this many changes, maintaining backwards compatibility with the supported -fixes branches can be a bit tricky, so I wanted to gauge expectations on these changes.

I've also attached a few patches for the PHP bindings under the mythtv branch itself.

A notice about the "odd" looking patch in modules/music/mp3act_functions.php where I removed the $db->escape() wrapper. That method automatically adds quotes to the result, which means that when $pl['playlist_songs'] has more than one ID in its comma separated list, it becomes something like "... IN ('1234,4567')", which is wrong. Since I don't see an escape() function that doesn't add the single quotes and the column should only contain numbers or commas, we simply strip anything else to avoid SQL injection.

mythweb not working with master backend on IPV6

  • Platform: Linux localhost 5.13.12-200.fc34.x86_64 # 1 SMP Wed Aug 18 13:27:18 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux

  • MythTV version: fixes/31

  • Package version: Fedora 19.158.20210629git0680b37c68.fc34

  • Component: mythweb

What steps will reproduce the bug?

  1. Stop backend
  2. In mythtv-setup, set master backend address to an IPV6 address (I tried both loopback and link local from the drop down)
  3. Start backend
  4. Open mythweb and the errors below will appear

How often does it reproduce? Is there a required condition?

Everytime

What is the expected behaviour?

Mythweb connects to backend

What do you see instead?

Mythweb reports it can not connect:

Error

Unable to connect to the master backend at ::1:6543.
Is it running?
Error

Unable to connect to the master backend at [fe80::xxxx:xxxx:xxxx:xxxx]:6543 (hostname: fe80::::xxxx:xxxx:xxxx:xxxx).
Is it running?

Additional information

Correct paths to apple-touch-icons

Probably nobody uses these, hence why they have been wrong for so long, but while I'm making minor fixes...

img/ => img/apple-touch-icons/

Mythweb still uses the setting 'MasterServerIP' albeit obsolete

On a fresh install, I get an empty page of the page mythweb/status, like http://localhost/mythweb/status/
Visiting the source of that page, I find this statement when retrieving http://localhost/mythweb/status

<div id="content_wrapper">
<!-- Obtained from:  http://:6544 -->

</div>

This is caused by mythweb using the obsolete setting of MasterServerIP in
https://github.com/MythTV/mythweb/blob/92f0f9bc6d15f6d6534e5d5e40bdddbb6f431254/modules/status/handler.php#L14C81-L14C81

    $masterhost = preg_replace('@(.*?:.*)@', "[$1]", setting('MasterServerIP'));

Within MythTV, the function GetMasterServerIP wthin MythTV now retuns the evaluation of

https://github.com/MythTV/mythtv/blob/c909c36018eec4dc570b9a5d67592850c76c40ac/mythtv/libs/libmythbase/mythcorecontext.cpp#L962
which shows that MasterServerIP is not a static setting setting anymore.

I found multiple usages of ´MasterServerIP` within mythweb, please eveluate every occurrence.

mythweb max_input_vars bug and fix

  • Platform: Linux mythbuntu 5.4.0-65-generic MythTV/mythtv#73-Ubuntu SMP Mon Jan 18 17:25:17 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
  • MythTV version: fixes/31 (v31.0+fixes.202101081714.016630a35c-ubuntu20.04.1)
  • Package version: mythbuntu-ubuntu-31-focal.list
  • Component: mythbackend mythweb

What steps will reproduce the bug?

Mythweb, Settings, Channel Info. Selecting commfree on some channels and going to end of page and pressing save.

How often does it reproduce? Is there a required condition?

Reproduce everytime.

What is the expected behaviour?

comfree setting should stay enabled after pressing save.

What do you see instead?

Screen refreshes and shows the page but with an error message.
"Warning: Unknown: Input variables exceeded 1000. To increase the limit change max_input_vars in php.ini. in Unknown on line 0"
"The fix is insert php_value max_input_vars 10000 in /etc/apache2/sites-available/mythweb.conf in the section with the other php config settings."
This is from https://forum.mythtv.org/viewtopic.php?f=6&t=3788&p=18206&hilit=max_input_vars#p18206 by JeffDwork.

RFE: Display people in priority order when displaying program details

In a follow up to #40 and #71, here is a code fragment that is mysql/mariadb complaint (test on all known/current supported mysql/mariadb versions without requiring sql_mode overrides).

Given that mythweb has a very short future lifetime, it is not clear if this a worthwhile patch, but it is now available if needed....

As I am about to delete my mythweb fork, and that means a PR would get auto deleted, this is inline.

diff --git a/modules/tv/classes/Program.php b/modules/tv/classes/Program.php
index d84a3d9f..a5d4ca77 100644
--- a/modules/tv/classes/Program.php
+++ b/modules/tv/classes/Program.php
@@ -556,9 +556,10 @@ class Program extends MythBase {
     public function has_credits() {
         global $db;
         return $db->query_col('SELECT COUNT(people.name)
-                                 FROM credits, people
-                                WHERE credits.person    = people.person
-                                  AND credits.chanid    = ?
+                                 FROM credits
+                            LEFT JOIN people
+                                   ON credits.person    = people.person
+                                WHERE credits.chanid    = ?
                                   AND credits.starttime = FROM_UNIXTIME(?)',
                               $this->chanid,
                               $this->starttime
@@ -573,13 +574,17 @@ class Program extends MythBase {
     // No cached value -- load it
         if (!isset($this->credits[$role][$add_search_links])) {
         // Get the credits for the requested role
-            $result = $db->query('SELECT DISTINCT people.name
-                                     FROM credits, people
-                                    WHERE credits.person    = people.person
-                                      AND credits.role      = ?
-                                      AND credits.chanid    = ?
-                                      AND credits.starttime = FROM_UNIXTIME(?)
-                                      ORDER BY credits.priority',
+            $result = $db->query('SELECT p.name
+                                    FROM (
+                                              SELECT DISTINCT people.name, credits.priority
+                                                FROM credits
+                                           LEFT JOIN people
+                                                  ON credits.person    = people.person
+                                               WHERE credits.role      = ?
+                                                 AND credits.chanid    = ?
+                                                 AND credits.starttime = FROM_UNIXTIME(?)
+                                            ORDER BY credits.priority
+                                         ) p',
                                    $role,
                                    $this->chanid,
                                    $this->starttime

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.