Add support for view-only mode.
[patchfork.git] / player / config.php
index da8e021..7b74547 100644 (file)
 
        $title = "";
        @ob_start();
+       $need_rw = true;
        require_once("../inc/base.php");
        require_once("../lang/master.php");
+       header("Content-Type: text/html; charset=UTF-8");
 ?>
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
 <html>
                $config = simplexml_load_string("<?xml version='1.0' ?>\n<root>\n</root>\n");
        }
        if(isset($_POST['submit'])) {
-               $vars = array( 'mpd_host', 'mpd_port', 'mpd_pass', 'login_pass', 'update_delay', 
-                               'metadata_disable', 'theme', 'stop_button', 'shout_url', 'pagination', 'lang');
+               $vars = array( 'mpd_host', 'mpd_port', 'mpd_pass', 'login_pass', 'ro_pass', 'update_delay', 
+                               'metadata_disable', 'theme', 'stop_button', 'shout_url', 'pagination', 'lang',
+                               'aws_keyid', 'aws_secret');
                foreach ($vars as $var) {
                        $add = "";
                        if(isset($_POST[$var])&&trim($_POST[$var])!="") 
                                        $add = 0;
                                else $add = intval($add);
                        }
-                       else if($var=="login_pass"&&strlen($add)>0) {
+                       else if(($var=="login_pass" || $var == "ro_pass") &&strlen($add)>0) {
                                if($add== HASH_PASS)
                                        continue;
                                $add = generate_hash($add);
                        }
+                       else if ($var=='aws_secret') {
+                               if ($add == HASH_PASS)
+                                       continue;
+                       }
 
                        
                        if(isset($config->$var)) {
        }
 
 ?>' name='login_pass' /></td></tr>
+       <tr><td><?php echo m("View-only password (optional):");?>
+       </td><td><input type='password' title='<?php echo m("If you want to allow users to view and listen, but not modify, specify a view-only password here");?>' value='<?php 
+       
+       $pass = get_config('ro_pass', '');
+       if(substr($pass,0, 4)=="sha:") {
+               echo HASH_PASS;
+       }
+       else {
+               echo htmlspecialchars($pass);
+       }
+
+?>' name='ro_pass' /></td></tr>
 <tr><td><?php echo m("Theme:");?> </td>
 <td>
 <select name='theme'>
 $themes = get_available_themes();
 $ctheme = get_config("theme", "default");
 foreach($themes as $theme) {
+       if ($theme == "mini")
+               continue;
        echo "\n<option value='$theme' ";
        if($theme==$ctheme)
                echo "selected='selected' ";
@@ -265,9 +286,18 @@ for($i=0; $i<$length;$i++) {
 <tr><td>&nbsp;</td><td><input type='checkbox' disabled='disabled' checked='checked' id='tnode_2' /> <label for='tnode_2'> Time</label></td></tr>
 </table>
 <h2>Metadata</h2>
-<p><?php echo m("Configuration for retrieving metadata. This requires that the machine pitchfork is running on can access the internet."); ?></p>
+<p><?php echo m("Configuration for retrieving metadata. This requires that the machine Patchfork is running on can access the internet. ".
+                "In order to use this feature, you must now have an Amazon AWS account; to get one, <a href=\"http://aws.amazon.com\">visit aws.amazon.com</a>. ".
+                "Then, get an <a href=\"https://aws-portal.amazon.com/gp/aws/developer/account/index.html?ie=UTF8&action=access-key\">access key</a>, and fill in the details below."); ?></p>
 <table>
 <tr><td><?php echo m("Disable metadata:"); ?> </td><td><input type='checkbox' <?php echo get_checkbox_from_config('metadata_disable') ?> name='metadata_disable' /></td></tr>
+<tr><td><?php echo m("Amazon Access Key ID:"); ?></td><td><input type='text' width='20' value='<?php echo htmlspecialchars(get_config('aws_keyid', '')) ?>' name='aws_keyid' /></td></tr>
+<tr><td><?php echo m("Amazon Secret Access Key:"); ?></td><td><input type='password' width='40' value='<?
+       $pass = get_config('aws_secret', '');
+       if(strlen($pass) != 0) {
+               echo HASH_PASS;
+       }
+       ?>' name='aws_secret' /></td></tr>
 </table>
 <h2><?php echo m("Shoutcast integration"); ?></h2>
 <p>
This page took 0.023317 seconds and 4 git commands to generate.