Kodi Community Forum

Full Version: MediaFrontPage - Web interface with widget type architecture to control multiple apps
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Install Windows 7 version of Uniform server (codenames Orion).

Copy all MFP's files to the web root folder usually htdocs or www.

Load the default-new-config.php file in Notepad and edit the settings to reflect your setup and save it as config.php.

Open XBMC and minimise it (to enable JSON Queries).

Then load http://localhost in your web browser and MFP should load.
I've been looking into editting the Config.php file directly on the server and found this.

It seems to work perfectly. Wink

I'm just trying to find a way to add it to MFP now. Perhaps a new widget with Links that open into a Module box like IMDB does from the Search widget to it...

Save this file as a PHP file and load it from your server.

Code:
<?php
$loadcontent = "config.php";
    if($_POST['save_file']) {
        $savecontent = stripslashes($_POST['savecontent']);
        $fp = @fopen($loadcontent, "w");
        if ($fp) {
            fwrite($fp, $savecontent);
            fclose($fp);
print '<a href='.$_SERVER[PHP_SELF].'>Refresh</a>';
print "<html><head><META http-equiv=\"refresh\" content=\"0;URL=$_SERVER[PHP_SELF]\"></head><body>";

}
}
    $fp = @fopen($loadcontent, "r");
        $loadcontent = fread($fp, filesize($loadcontent));
$lines = explode("\n", $loadcontent);
$count = count($lines);
        $loadcontent = htmlspecialchars($loadcontent);
        fclose($fp);
for ($a = 1; $a < $count+1; $a++) {
$line .= "$a\n";
}
?>
<form method=post action="<?=$_SERVER['PHP_SELF']?>">
  <table width="100%" valign="top" border="0" cellspacing="1" cellpadding="1">
    <tr>
    <td width="3%" align="right" valign="top"><pre style="text-align: right; padding: 4px; overflow: auto; border: 0px groove; font-size: 12px" name="lines" cols="4" rows="<?=$count+3;?>"><?=$line;?></pre></td>
    <td width="97%" align="left" valign="top">
    <textarea style="text-align: left; padding: 0px; overflow: auto; border: 1px groove; font-size: 12px" name="savecontent" cols="150" rows="<?=$count;?>" wrap="OFF"><?=$loadcontent?>
    </textarea></td>
  </tr>
</table>

<br>
<input type="submit" name="save_file" value="Save">    
</form>
DejaVu Wrote:I've been looking into editting the Config.php file directly on the server and found this.

It seems to work perfectly. Wink

I'm just trying to find a way to add it to MFP now. Perhaps a new widget with Links that open into a Module box like IMDB does from the Search widget to it...

Save this file as a PHP file and load it from your server.

Code:
<?php
$loadcontent = "config.php";
    if($_POST['save_file']) {
        $savecontent = stripslashes($_POST['savecontent']);
        $fp = @fopen($loadcontent, "w");
        if ($fp) {
            fwrite($fp, $savecontent);
            fclose($fp);
print '<a href='.$_SERVER[PHP_SELF].'>Refresh</a>';
print "<html><head><META http-equiv=\"refresh\" content=\"0;URL=$_SERVER[PHP_SELF]\"></head><body>";

}
}
    $fp = @fopen($loadcontent, "r");
        $loadcontent = fread($fp, filesize($loadcontent));
$lines = explode("\n", $loadcontent);
$count = count($lines);
        $loadcontent = htmlspecialchars($loadcontent);
        fclose($fp);
for ($a = 1; $a < $count+1; $a++) {
$line .= "$a\n";
}
?>
<form method=post action="<?=$_SERVER['PHP_SELF']?>">
  <table width="100%" valign="top" border="0" cellspacing="1" cellpadding="1">
    <tr>
    <td width="3%" align="right" valign="top"><pre style="text-align: right; padding: 4px; overflow: auto; border: 0px groove; font-size: 12px" name="lines" cols="4" rows="<?=$count+3;?>"><?=$line;?></pre></td>
    <td width="97%" align="left" valign="top">
    <textarea style="text-align: left; padding: 0px; overflow: auto; border: 1px groove; font-size: 12px" name="savecontent" cols="150" rows="<?=$count;?>" wrap="OFF"><?=$loadcontent?>
    </textarea></td>
  </tr>
</table>

<br>
<input type="submit" name="save_file" value="Save">    
</form>

That's kind of the idea I had, but I don't think it should be a widget. What we should do, in my opinion, is have it open in the first run and then automatically rename to config.php so that it's one more step the user can do straight from the browser. What do you reckon?
Been playing with making things look right/better -
Tell me what you think.

Login -
Image

Server Check -
Image
Looks the same even if it fails (Sizes do not shift about etc).
DejaVu Wrote:Been playing with making things look right/better -
Tell me what you think.

Login -
Image

Server Check -
Image
Looks the same even if it fails (Sizes do not shift about etc).

I like it! Perfect MFP styling.
gugahoi Wrote:That's kind of the idea I had, but I don't think it should be a widget. What we should do, in my opinion, is have it open in the first run and then automatically rename to config.php so that it's one more step the user can do straight from the browser. What do you reckon?

Yeah, open in a iframe under the the server check when it passes - make it look nice as per above!

Top idea. Click Save and it redirects to index.php
DejaVu Wrote:Install Windows 7 version of Uniform server (codenames Orion).

Copy all MFP's files to the web root folder usually htdocs or www.

Load the default-new-config.php file in Notepad and edit the settings to reflect your setup and save it as config.php.

Open XBMC and minimise it (to enable JSON Queries).

Then load http://localhost in your web browser and MFP should load.


thanks for the info...
I have made a mock-up, that does not actually work with redirecting etc.
It's a fixed page at the moment, but I think you'll get the idea...

If the server check passes, the bottom part appears automatically. It can be a hidden DIV perhaps that appears once the settings are verified. So far, the one I have, does let me save the file, but only to the filename it originally is at the moment (default-config.php).

Image

If you think these can be used, give me a shout and I'll post them. At the moment, using the widget.css to style these did not work so they are hard coded. But I think that will be fine seeing as it's the original colors. Wink
I just noticed my NZBMatrix RSS feeds are no longer working. RSS feeds from other sites are loading in the RSS widget just fine, but with NZB Matrix I get errors like:
Code:
Warning: DOMDocument::load(): Document is empty in http://rss.nzbmatrix.com/rss.php?subcat=41, line: 1 in /var/www/html/mfp/widgets/wRSS.php on line 142 Warning: DOMDocument::load(): Start tag expected, '<' not found in http://rss.nzbmatrix.com/rss.php?subcat=41, line: 1 in /var/www/html/mfp/widgets/wRSS.php on line 142

Error: Unable to determine feed type.

Need to determine if this problem is on my end or if NZBMatrix changed.
SleepyP Wrote:I just noticed my NZBMatrix RSS feeds are no longer working. RSS feeds from other sites are loading in the RSS widget just fine, but with NZB Matrix I get errors like:
Code:
Warning: DOMDocument::load(): Document is empty in http://rss.nzbmatrix.com/rss.php?subcat=41, line: 1 in /var/www/html/mfp/widgets/wRSS.php on line 142 Warning: DOMDocument::load(): Start tag expected, '<' not found in http://rss.nzbmatrix.com/rss.php?subcat=41, line: 1 in /var/www/html/mfp/widgets/wRSS.php on line 142

Error: Unable to determine feed type.

Need to determine if this problem is on my end or if NZBMatrix changed.

I am getting a similar issue with couchpotato at the moment I think. If you go to that address (http://rss.nzbmatrix.com/rss.php?subcat=41) it loads a blank page rather than an rss feed. Not sure whether its broken or they have changed it.

EDIT:
http://nzbmatrix.com/forums.php?action=v...341&page=1
http://nzbmatrix.info/
http://www.nzbmatrix.info =
NZBMatrix RSS: Offline

Wink

I've been trying with no luck to get the authentication working. If I put nothing, it says "Bad Credentials. Try Again".

If I put the details in my config.php, it reloads the login.php with no errors? I think a redirect is busted. I also noticed that there are some variable name changes going on depending on what version you use. I have $AUTH_ON (set to true), $AUTH_USER and $AUTH_PASS.

Any clues?

Perhaps this bit in the index.php??
Code:
<?php
    //Authentication check
    require_once('config.php');
    if ($AUTH_ON && (!isset($_SESSION['loggedin']) || !$_SESSION['loggedin']))
        {
            header('Location: login.php');
            exit;
        }
?>

Is an 'else' or 'else if' statement not required here? Remember, I'm a coding Mong!!
DejaVu Wrote:I've been trying with no luck to get the authentication working. If I put nothing, it says "Bad Credentials. Try Again".

If I put the details in my config.php, it reloads the login.php with no errors? I think a redirect is busted. I also noticed that there are some variable name changes going on depending on what version you use. I have $AUTH_ON (set to true), $AUTH_USER and $AUTH_PASS.

Any clues?

If you put nothing, what's the point of having authentication? It will probably fail if username and pass are empty.

There are no variable name changes from what I see. Just download mikie's repo and use it without modifying the code. It should work.

There might be a couple of things I would change but he is still developing it so it can still change. Having said that, Authentication should be working tho.

Quote:Is an 'else' or 'else if' statement not required here? Remember, I'm a coding Mong!!

No 'else' required. The else case is the rest of the page.


Care to post how you styled servercheck and login pages? Or are you still working on them?
gugahoi Wrote:If you put nothing, what's the point of having authentication? It will probably fail if username and pass are empty.
Putting the wrong information and nothing, it does fail. If I put the correct information, the Login page just reloads again. I shall try redownloading it from his Repo

gugahoi Wrote:There are no variable name changes from what I see. Just download mikie's repo and use it without modifying the code. It should work.
The varialbe '$authsecured' in auth.php is defined in the config.php. I thought it have been changed to '$AUTH_ON'. I will try and redownload it.

gugahoi Wrote:Care to post how you styled servercheck and login pages? Or are you still working on them?
Only to get it working correctly, I will post the entire thing once it's working. Smile
CoinTos Wrote:My solution, let the server decide.
Code:
$GLOBAL_IP = $_SERVER["HTTP_HOST"];

Thank you for pointing me to this, it solved a lot of issues. My main problem has been my router I think though and the solution seems to be a telnet command:
natloopback

I haven't tried it yet, but that seems to be the thing stopping me from getting a few things working.
I'll report back later when I have had a play with it.
I sussed I was being a bit thick with the secure business. Apologise!

Here's the skinned version of the login files I have made.
I also changed the challenge page to load inside the widget too instead of the bland white page it throws you to.

login.php
Code:
<html>
<head>
<title>Media Center</title>
<link rel="shortcut icon" href="favicon.ico" />
<link rel="stylesheet" type="text/css" href="css/front.css" />
<style type="text/css">
.widget {
    border:1px solid black;
    -moz-border-radius:6px 6px 6px 6px;
    border-radius:6px 6px 6px 6px;
    margin:0px 0px;
    box-shadow: 3px 3px 3px #000;
    background:#2C2D32;
}
.widget-head {
    -moz-border-radius:6px 6px 0px 0px;
    border-radius:6px 6px 0px 0px;
    background:#3d3d3d;
    border-bottom:1px solid black;
    width: 100%;
    height: 30px;
    line-height: 30px;
    font-weight:bold;
}
</style>

<?php
if (file_exists('firstrun.php')){header('Location: servercheck.php');}
echo "<center><br><br><br>";
echo "<form action=\"auth.php\" method=\"post\">";
echo "<table class=\"widget\" width=259 cellpadding=0 cellspacing=0 id=1>";
echo "<tr style=\"cursor: move; \">";
echo "<td align=center colspan=2 height=25><div class=\"widget-head\">MediaFrontPage Authentication</div></td>";
echo "<tr>";
echo "<td align=right><br>&nbsp; &nbsp;Username:</td>";
echo "<td align=center>";
echo "<br><input type='text' name=\"user\" size=15 />";
echo "</td>";
echo "<tr>";
echo "<td align=right>&nbsp; &nbsp;Password:</td>";
echo "<td align=center>";
echo "<input type='password' name=\"password\" size=15 />";
echo "</td>";
echo "<tr>";
echo "<td align=center colspan=2>&nbsp;</td>";
echo "<tr>";
echo "<td align=center colspan=2>";
echo "<input type='submit' value='Log in' /><br><br>";
echo "</td>";
echo "</table>";
echo "</form>";
echo "</center>";
?>
</head>
</html>

auth.php
Code:
<html>
<head>
<title>Media Center</title>
<link rel="shortcut icon" href="favicon.ico" />
<link rel="stylesheet" type="text/css" href="css/front.css" />
<style type="text/css">
.widget {
    border:1px solid black;
    -moz-border-radius:6px 6px 6px 6px;
    border-radius:6px 6px 6px 6px;
    margin:0px 0px;
    box-shadow: 3px 3px 3px #000;
    background:#2C2D32;
}
.widget-head {
    -moz-border-radius:6px 6px 0px 0px;
    border-radius:6px 6px 0px 0px;
    background:#3d3d3d;
    border-bottom:1px solid black;
    width: 100%;
    height: 30px;
    line-height: 30px;
    font-weight:bold;
}
</style>
<?php
require_once("config.php");
If (!$authsecured) {
    header('Location: index.php');
    exit;
}
if (isset($_POST['user']) && isset($_POST['password'])) {
    if ($_POST['user']==$authusername && $_POST['password']==$authpassword) {
        // OK
        $_SESSION['loggedin'] = true;
        header('Location: index.php');
        exit;
    } else {
echo "<center><br><br><br>";
echo "<form action=\"auth.php\" method=\"post\">";
echo "<table class=\"widget\" width=259 cellpadding=0 cellspacing=0 id=1>";
echo "<tr style=cursor: move;>";
echo "<td align=center height=25><div class=\"widget-head\">MediaFrontPage Authentication</div></td>";
echo "<tr>";
echo "<td align=center height=25><br>Invalid Username and/or Password.</td>";
echo "<tr>";
echo "<td align=center height=25>&nbsp; &nbsp;</td>";
echo "<tr>";
echo "<td align=center height=25>Please try again.</td>";
echo "<tr>";
echo "<td align=center height=25>";
echo "<input type=\"button\" value=\"<< Back\" onclick=\"history.go(-1);return false;\" /><br><br>";
echo "</td>";
echo "</table>";
echo "</form>";
echo "</center>";
    }
} else {
    // not logging in
    header('Location: login.php');
    exit;
}
?>