uiconfig.php
author Dan
Fri, 12 Jun 2009 13:50:13 -0400
changeset 78 08f8a72b1f7b
parent 71 8663af0e27c7
permissions -rw-r--r--
Added Offline Mode - automatically turned on and off based on connectivity to server. Version bumped to 0.1a5.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
50
1b4288399b1f Added graphical configuration, at this point only for the grey theme but others will follow soon. (This has been nearly done for two weeks or more but was on hold due to the bugs with multithreading)
Dan
parents:
diff changeset
     1
<?php
1b4288399b1f Added graphical configuration, at this point only for the grey theme but others will follow soon. (This has been nearly done for two weeks or more but was on hold due to the bugs with multithreading)
Dan
parents:
diff changeset
     2
1b4288399b1f Added graphical configuration, at this point only for the grey theme but others will follow soon. (This has been nearly done for two weeks or more but was on hold due to the bugs with multithreading)
Dan
parents:
diff changeset
     3
/**
1b4288399b1f Added graphical configuration, at this point only for the grey theme but others will follow soon. (This has been nearly done for two weeks or more but was on hold due to the bugs with multithreading)
Dan
parents:
diff changeset
     4
 * Greyhound - real web management for Amarok
1b4288399b1f Added graphical configuration, at this point only for the grey theme but others will follow soon. (This has been nearly done for two weeks or more but was on hold due to the bugs with multithreading)
Dan
parents:
diff changeset
     5
 * Copyright (C) 2008 Dan Fuhry
1b4288399b1f Added graphical configuration, at this point only for the grey theme but others will follow soon. (This has been nearly done for two weeks or more but was on hold due to the bugs with multithreading)
Dan
parents:
diff changeset
     6
 *
1b4288399b1f Added graphical configuration, at this point only for the grey theme but others will follow soon. (This has been nearly done for two weeks or more but was on hold due to the bugs with multithreading)
Dan
parents:
diff changeset
     7
 * This program is Free Software; you can redistribute and/or modify it under the terms of the GNU General Public License
1b4288399b1f Added graphical configuration, at this point only for the grey theme but others will follow soon. (This has been nearly done for two weeks or more but was on hold due to the bugs with multithreading)
Dan
parents:
diff changeset
     8
 * as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
1b4288399b1f Added graphical configuration, at this point only for the grey theme but others will follow soon. (This has been nearly done for two weeks or more but was on hold due to the bugs with multithreading)
Dan
parents:
diff changeset
     9
 *
1b4288399b1f Added graphical configuration, at this point only for the grey theme but others will follow soon. (This has been nearly done for two weeks or more but was on hold due to the bugs with multithreading)
Dan
parents:
diff changeset
    10
 * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
1b4288399b1f Added graphical configuration, at this point only for the grey theme but others will follow soon. (This has been nearly done for two weeks or more but was on hold due to the bugs with multithreading)
Dan
parents:
diff changeset
    11
 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for details.
1b4288399b1f Added graphical configuration, at this point only for the grey theme but others will follow soon. (This has been nearly done for two weeks or more but was on hold due to the bugs with multithreading)
Dan
parents:
diff changeset
    12
 */
1b4288399b1f Added graphical configuration, at this point only for the grey theme but others will follow soon. (This has been nearly done for two weeks or more but was on hold due to the bugs with multithreading)
Dan
parents:
diff changeset
    13
1b4288399b1f Added graphical configuration, at this point only for the grey theme but others will follow soon. (This has been nearly done for two weeks or more but was on hold due to the bugs with multithreading)
Dan
parents:
diff changeset
    14
// rebooting doesn't work at this point
1b4288399b1f Added graphical configuration, at this point only for the grey theme but others will follow soon. (This has been nearly done for two weeks or more but was on hold due to the bugs with multithreading)
Dan
parents:
diff changeset
    15
define('REBOOT_SUPPORT', false);
1b4288399b1f Added graphical configuration, at this point only for the grey theme but others will follow soon. (This has been nearly done for two weeks or more but was on hold due to the bugs with multithreading)
Dan
parents:
diff changeset
    16
1b4288399b1f Added graphical configuration, at this point only for the grey theme but others will follow soon. (This has been nearly done for two weeks or more but was on hold due to the bugs with multithreading)
Dan
parents:
diff changeset
    17
function greyhound_config($httpd, $socket)
1b4288399b1f Added graphical configuration, at this point only for the grey theme but others will follow soon. (This has been nearly done for two weeks or more but was on hold due to the bugs with multithreading)
Dan
parents:
diff changeset
    18
{
1b4288399b1f Added graphical configuration, at this point only for the grey theme but others will follow soon. (This has been nearly done for two weeks or more but was on hold due to the bugs with multithreading)
Dan
parents:
diff changeset
    19
  global $use_auth;
1b4288399b1f Added graphical configuration, at this point only for the grey theme but others will follow soon. (This has been nearly done for two weeks or more but was on hold due to the bugs with multithreading)
Dan
parents:
diff changeset
    20
  
1b4288399b1f Added graphical configuration, at this point only for the grey theme but others will follow soon. (This has been nearly done for two weeks or more but was on hold due to the bugs with multithreading)
Dan
parents:
diff changeset
    21
  // validate the session
1b4288399b1f Added graphical configuration, at this point only for the grey theme but others will follow soon. (This has been nearly done for two weeks or more but was on hold due to the bugs with multithreading)
Dan
parents:
diff changeset
    22
  if ( !session_check() )
1b4288399b1f Added graphical configuration, at this point only for the grey theme but others will follow soon. (This has been nearly done for two weeks or more but was on hold due to the bugs with multithreading)
Dan
parents:
diff changeset
    23
  {
1b4288399b1f Added graphical configuration, at this point only for the grey theme but others will follow soon. (This has been nearly done for two weeks or more but was on hold due to the bugs with multithreading)
Dan
parents:
diff changeset
    24
    $httpd->header('HTTP/1.1 307 Temporary Redirect');
1b4288399b1f Added graphical configuration, at this point only for the grey theme but others will follow soon. (This has been nearly done for two weeks or more but was on hold due to the bugs with multithreading)
Dan
parents:
diff changeset
    25
    $httpd->header('Location: /login');
1b4288399b1f Added graphical configuration, at this point only for the grey theme but others will follow soon. (This has been nearly done for two weeks or more but was on hold due to the bugs with multithreading)
Dan
parents:
diff changeset
    26
    
1b4288399b1f Added graphical configuration, at this point only for the grey theme but others will follow soon. (This has been nearly done for two weeks or more but was on hold due to the bugs with multithreading)
Dan
parents:
diff changeset
    27
    return;
1b4288399b1f Added graphical configuration, at this point only for the grey theme but others will follow soon. (This has been nearly done for two weeks or more but was on hold due to the bugs with multithreading)
Dan
parents:
diff changeset
    28
  }
1b4288399b1f Added graphical configuration, at this point only for the grey theme but others will follow soon. (This has been nearly done for two weeks or more but was on hold due to the bugs with multithreading)
Dan
parents:
diff changeset
    29
  
1b4288399b1f Added graphical configuration, at this point only for the grey theme but others will follow soon. (This has been nearly done for two weeks or more but was on hold due to the bugs with multithreading)
Dan
parents:
diff changeset
    30
  $tried = false;
1b4288399b1f Added graphical configuration, at this point only for the grey theme but others will follow soon. (This has been nearly done for two weeks or more but was on hold due to the bugs with multithreading)
Dan
parents:
diff changeset
    31
  $success = false;
1b4288399b1f Added graphical configuration, at this point only for the grey theme but others will follow soon. (This has been nearly done for two weeks or more but was on hold due to the bugs with multithreading)
Dan
parents:
diff changeset
    32
  $needpass = false;
1b4288399b1f Added graphical configuration, at this point only for the grey theme but others will follow soon. (This has been nearly done for two weeks or more but was on hold due to the bugs with multithreading)
Dan
parents:
diff changeset
    33
  $error = false;
1b4288399b1f Added graphical configuration, at this point only for the grey theme but others will follow soon. (This has been nearly done for two weeks or more but was on hold due to the bugs with multithreading)
Dan
parents:
diff changeset
    34
  
1b4288399b1f Added graphical configuration, at this point only for the grey theme but others will follow soon. (This has been nearly done for two weeks or more but was on hold due to the bugs with multithreading)
Dan
parents:
diff changeset
    35
  // if a config password is set, make sure it matches.
1b4288399b1f Added graphical configuration, at this point only for the grey theme but others will follow soon. (This has been nearly done for two weeks or more but was on hold due to the bugs with multithreading)
Dan
parents:
diff changeset
    36
  $authed = false;
1b4288399b1f Added graphical configuration, at this point only for the grey theme but others will follow soon. (This has been nearly done for two weeks or more but was on hold due to the bugs with multithreading)
Dan
parents:
diff changeset
    37
  if ( empty($GLOBALS['configpass']) )
1b4288399b1f Added graphical configuration, at this point only for the grey theme but others will follow soon. (This has been nearly done for two weeks or more but was on hold due to the bugs with multithreading)
Dan
parents:
diff changeset
    38
  {
1b4288399b1f Added graphical configuration, at this point only for the grey theme but others will follow soon. (This has been nearly done for two weeks or more but was on hold due to the bugs with multithreading)
Dan
parents:
diff changeset
    39
    $authed = true;
1b4288399b1f Added graphical configuration, at this point only for the grey theme but others will follow soon. (This has been nearly done for two weeks or more but was on hold due to the bugs with multithreading)
Dan
parents:
diff changeset
    40
  }
1b4288399b1f Added graphical configuration, at this point only for the grey theme but others will follow soon. (This has been nearly done for two weeks or more but was on hold due to the bugs with multithreading)
Dan
parents:
diff changeset
    41
  else
1b4288399b1f Added graphical configuration, at this point only for the grey theme but others will follow soon. (This has been nearly done for two weeks or more but was on hold due to the bugs with multithreading)
Dan
parents:
diff changeset
    42
  {
1b4288399b1f Added graphical configuration, at this point only for the grey theme but others will follow soon. (This has been nearly done for two weeks or more but was on hold due to the bugs with multithreading)
Dan
parents:
diff changeset
    43
    $needpass = true;
1b4288399b1f Added graphical configuration, at this point only for the grey theme but others will follow soon. (This has been nearly done for two weeks or more but was on hold due to the bugs with multithreading)
Dan
parents:
diff changeset
    44
    if ( isset($_POST['configpass']) && sha1($_POST['configpass']) === $GLOBALS['configpass'] )
1b4288399b1f Added graphical configuration, at this point only for the grey theme but others will follow soon. (This has been nearly done for two weeks or more but was on hold due to the bugs with multithreading)
Dan
parents:
diff changeset
    45
    {
1b4288399b1f Added graphical configuration, at this point only for the grey theme but others will follow soon. (This has been nearly done for two weeks or more but was on hold due to the bugs with multithreading)
Dan
parents:
diff changeset
    46
      $authed = true;
1b4288399b1f Added graphical configuration, at this point only for the grey theme but others will follow soon. (This has been nearly done for two weeks or more but was on hold due to the bugs with multithreading)
Dan
parents:
diff changeset
    47
      $tried = true;
1b4288399b1f Added graphical configuration, at this point only for the grey theme but others will follow soon. (This has been nearly done for two weeks or more but was on hold due to the bugs with multithreading)
Dan
parents:
diff changeset
    48
    }
1b4288399b1f Added graphical configuration, at this point only for the grey theme but others will follow soon. (This has been nearly done for two weeks or more but was on hold due to the bugs with multithreading)
Dan
parents:
diff changeset
    49
    else if ( isset($_POST['configpass']) )
1b4288399b1f Added graphical configuration, at this point only for the grey theme but others will follow soon. (This has been nearly done for two weeks or more but was on hold due to the bugs with multithreading)
Dan
parents:
diff changeset
    50
    {
1b4288399b1f Added graphical configuration, at this point only for the grey theme but others will follow soon. (This has been nearly done for two weeks or more but was on hold due to the bugs with multithreading)
Dan
parents:
diff changeset
    51
      $error = 'You didn\'t enter the right configuration password, so the changes weren\'t saved.';
1b4288399b1f Added graphical configuration, at this point only for the grey theme but others will follow soon. (This has been nearly done for two weeks or more but was on hold due to the bugs with multithreading)
Dan
parents:
diff changeset
    52
      $tried = true;
1b4288399b1f Added graphical configuration, at this point only for the grey theme but others will follow soon. (This has been nearly done for two weeks or more but was on hold due to the bugs with multithreading)
Dan
parents:
diff changeset
    53
    }
1b4288399b1f Added graphical configuration, at this point only for the grey theme but others will follow soon. (This has been nearly done for two weeks or more but was on hold due to the bugs with multithreading)
Dan
parents:
diff changeset
    54
  }
1b4288399b1f Added graphical configuration, at this point only for the grey theme but others will follow soon. (This has been nearly done for two weeks or more but was on hold due to the bugs with multithreading)
Dan
parents:
diff changeset
    55
  
1b4288399b1f Added graphical configuration, at this point only for the grey theme but others will follow soon. (This has been nearly done for two weeks or more but was on hold due to the bugs with multithreading)
Dan
parents:
diff changeset
    56
  if ( $authed && isset($_POST['submit']) )
1b4288399b1f Added graphical configuration, at this point only for the grey theme but others will follow soon. (This has been nearly done for two weeks or more but was on hold due to the bugs with multithreading)
Dan
parents:
diff changeset
    57
  {
71
8663af0e27c7 A little more work on reboot support. Still not enabled, but should work eventually.
Dan
parents: 64
diff changeset
    58
    $tried = true;
50
1b4288399b1f Added graphical configuration, at this point only for the grey theme but others will follow soon. (This has been nearly done for two weeks or more but was on hold due to the bugs with multithreading)
Dan
parents:
diff changeset
    59
    $need_reboot = ( isset($_POST['public']) !== $GLOBALS['public'] ||
71
8663af0e27c7 A little more work on reboot support. Still not enabled, but should work eventually.
Dan
parents: 64
diff changeset
    60
                     isset($_POST['ipv6']) !== $GLOBALS['enable_ipv6'] ||
50
1b4288399b1f Added graphical configuration, at this point only for the grey theme but others will follow soon. (This has been nearly done for two weeks or more but was on hold due to the bugs with multithreading)
Dan
parents:
diff changeset
    61
                     isset($_POST['allow_fork']) !== $GLOBALS['allow_fork']);
1b4288399b1f Added graphical configuration, at this point only for the grey theme but others will follow soon. (This has been nearly done for two weeks or more but was on hold due to the bugs with multithreading)
Dan
parents:
diff changeset
    62
    
1b4288399b1f Added graphical configuration, at this point only for the grey theme but others will follow soon. (This has been nearly done for two weeks or more but was on hold due to the bugs with multithreading)
Dan
parents:
diff changeset
    63
    // compile the new config file
1b4288399b1f Added graphical configuration, at this point only for the grey theme but others will follow soon. (This has been nearly done for two weeks or more but was on hold due to the bugs with multithreading)
Dan
parents:
diff changeset
    64
    $public = ( isset($_POST['public']) ) ? 'true' : 'false';
1b4288399b1f Added graphical configuration, at this point only for the grey theme but others will follow soon. (This has been nearly done for two weeks or more but was on hold due to the bugs with multithreading)
Dan
parents:
diff changeset
    65
    $allowcontrol = ( isset($_POST['allowcontrol']) ) ? 'true' : 'false';
1b4288399b1f Added graphical configuration, at this point only for the grey theme but others will follow soon. (This has been nearly done for two weeks or more but was on hold due to the bugs with multithreading)
Dan
parents:
diff changeset
    66
    $allow_fork = ( isset($_POST['allow_fork']) ) ? 'true' : 'false';
1b4288399b1f Added graphical configuration, at this point only for the grey theme but others will follow soon. (This has been nearly done for two weeks or more but was on hold due to the bugs with multithreading)
Dan
parents:
diff changeset
    67
    $use_auth = ( isset($_POST['use_auth']) ) ? 'true' : 'false';
71
8663af0e27c7 A little more work on reboot support. Still not enabled, but should work eventually.
Dan
parents: 64
diff changeset
    68
    $ipv6_settings = ( isset($_POST['ipv6']) ) ? '$GLOBALS[\'enable_ipv4\'] = false;
8663af0e27c7 A little more work on reboot support. Still not enabled, but should work eventually.
Dan
parents: 64
diff changeset
    69
$GLOBALS[\'enable_ipv6\'] = true;' : '$GLOBALS[\'enable_ipv4\'] = true;
8663af0e27c7 A little more work on reboot support. Still not enabled, but should work eventually.
Dan
parents: 64
diff changeset
    70
$GLOBALS[\'enable_ipv6\'] = false;';
8663af0e27c7 A little more work on reboot support. Still not enabled, but should work eventually.
Dan
parents: 64
diff changeset
    71
    $GLOBALS['enable_ipv6'] = isset($_POST['ipv6']);
50
1b4288399b1f Added graphical configuration, at this point only for the grey theme but others will follow soon. (This has been nearly done for two weeks or more but was on hold due to the bugs with multithreading)
Dan
parents:
diff changeset
    72
    
1b4288399b1f Added graphical configuration, at this point only for the grey theme but others will follow soon. (This has been nearly done for two weeks or more but was on hold due to the bugs with multithreading)
Dan
parents:
diff changeset
    73
    // for auth_data, we're going to merge the data from POST with the current auth_data array.
1b4288399b1f Added graphical configuration, at this point only for the grey theme but others will follow soon. (This has been nearly done for two weeks or more but was on hold due to the bugs with multithreading)
Dan
parents:
diff changeset
    74
    $auth_data = $GLOBALS['auth_data'];
1b4288399b1f Added graphical configuration, at this point only for the grey theme but others will follow soon. (This has been nearly done for two weeks or more but was on hold due to the bugs with multithreading)
Dan
parents:
diff changeset
    75
    $auth_changed = false;
71
8663af0e27c7 A little more work on reboot support. Still not enabled, but should work eventually.
Dan
parents: 64
diff changeset
    76
    if ( isset($_POST['users']) )
50
1b4288399b1f Added graphical configuration, at this point only for the grey theme but others will follow soon. (This has been nearly done for two weeks or more but was on hold due to the bugs with multithreading)
Dan
parents:
diff changeset
    77
    {
71
8663af0e27c7 A little more work on reboot support. Still not enabled, but should work eventually.
Dan
parents: 64
diff changeset
    78
      foreach ( $auth_data as $user => $pass )
50
1b4288399b1f Added graphical configuration, at this point only for the grey theme but others will follow soon. (This has been nearly done for two weeks or more but was on hold due to the bugs with multithreading)
Dan
parents:
diff changeset
    79
      {
71
8663af0e27c7 A little more work on reboot support. Still not enabled, but should work eventually.
Dan
parents: 64
diff changeset
    80
        if ( !in_array($user, $_POST['users']) )
8663af0e27c7 A little more work on reboot support. Still not enabled, but should work eventually.
Dan
parents: 64
diff changeset
    81
        {
8663af0e27c7 A little more work on reboot support. Still not enabled, but should work eventually.
Dan
parents: 64
diff changeset
    82
          $auth_changed = true;
8663af0e27c7 A little more work on reboot support. Still not enabled, but should work eventually.
Dan
parents: 64
diff changeset
    83
          unset($auth_data[$user]);
8663af0e27c7 A little more work on reboot support. Still not enabled, but should work eventually.
Dan
parents: 64
diff changeset
    84
        }
8663af0e27c7 A little more work on reboot support. Still not enabled, but should work eventually.
Dan
parents: 64
diff changeset
    85
      }
8663af0e27c7 A little more work on reboot support. Still not enabled, but should work eventually.
Dan
parents: 64
diff changeset
    86
    }
8663af0e27c7 A little more work on reboot support. Still not enabled, but should work eventually.
Dan
parents: 64
diff changeset
    87
    else
8663af0e27c7 A little more work on reboot support. Still not enabled, but should work eventually.
Dan
parents: 64
diff changeset
    88
    {
8663af0e27c7 A little more work on reboot support. Still not enabled, but should work eventually.
Dan
parents: 64
diff changeset
    89
      if ( !empty($auth_data) )
8663af0e27c7 A little more work on reboot support. Still not enabled, but should work eventually.
Dan
parents: 64
diff changeset
    90
      {
8663af0e27c7 A little more work on reboot support. Still not enabled, but should work eventually.
Dan
parents: 64
diff changeset
    91
        $auth_data = array();
50
1b4288399b1f Added graphical configuration, at this point only for the grey theme but others will follow soon. (This has been nearly done for two weeks or more but was on hold due to the bugs with multithreading)
Dan
parents:
diff changeset
    92
        $auth_changed = true;
78
08f8a72b1f7b Added Offline Mode - automatically turned on and off based on connectivity to server. Version bumped to 0.1a5.
Dan
parents: 71
diff changeset
    93
        $use_auth = false;
71
8663af0e27c7 A little more work on reboot support. Still not enabled, but should work eventually.
Dan
parents: 64
diff changeset
    94
      } 
50
1b4288399b1f Added graphical configuration, at this point only for the grey theme but others will follow soon. (This has been nearly done for two weeks or more but was on hold due to the bugs with multithreading)
Dan
parents:
diff changeset
    95
    }
1b4288399b1f Added graphical configuration, at this point only for the grey theme but others will follow soon. (This has been nearly done for two weeks or more but was on hold due to the bugs with multithreading)
Dan
parents:
diff changeset
    96
    if ( isset($_POST['users_add']) )
1b4288399b1f Added graphical configuration, at this point only for the grey theme but others will follow soon. (This has been nearly done for two weeks or more but was on hold due to the bugs with multithreading)
Dan
parents:
diff changeset
    97
    {
1b4288399b1f Added graphical configuration, at this point only for the grey theme but others will follow soon. (This has been nearly done for two weeks or more but was on hold due to the bugs with multithreading)
Dan
parents:
diff changeset
    98
      foreach ( $_POST['users_add'] as $user => $pass )
1b4288399b1f Added graphical configuration, at this point only for the grey theme but others will follow soon. (This has been nearly done for two weeks or more but was on hold due to the bugs with multithreading)
Dan
parents:
diff changeset
    99
      {
1b4288399b1f Added graphical configuration, at this point only for the grey theme but others will follow soon. (This has been nearly done for two weeks or more but was on hold due to the bugs with multithreading)
Dan
parents:
diff changeset
   100
        $auth_changed = true;
1b4288399b1f Added graphical configuration, at this point only for the grey theme but others will follow soon. (This has been nearly done for two weeks or more but was on hold due to the bugs with multithreading)
Dan
parents:
diff changeset
   101
        $auth_data[$user] = $pass;
1b4288399b1f Added graphical configuration, at this point only for the grey theme but others will follow soon. (This has been nearly done for two weeks or more but was on hold due to the bugs with multithreading)
Dan
parents:
diff changeset
   102
      }
1b4288399b1f Added graphical configuration, at this point only for the grey theme but others will follow soon. (This has been nearly done for two weeks or more but was on hold due to the bugs with multithreading)
Dan
parents:
diff changeset
   103
    }
1b4288399b1f Added graphical configuration, at this point only for the grey theme but others will follow soon. (This has been nearly done for two weeks or more but was on hold due to the bugs with multithreading)
Dan
parents:
diff changeset
   104
    $auth_data = var_export_string($auth_data);
1b4288399b1f Added graphical configuration, at this point only for the grey theme but others will follow soon. (This has been nearly done for two weeks or more but was on hold due to the bugs with multithreading)
Dan
parents:
diff changeset
   105
    
71
8663af0e27c7 A little more work on reboot support. Still not enabled, but should work eventually.
Dan
parents: 64
diff changeset
   106
    $new_configpass = ( isset($_POST['newconfigpass']) && is_string($_POST['newconfigpass']) && $_POST['newconfigpass'] != '____________________' ) ? sha1($_POST['newconfigpass']) : $GLOBALS['configpass'];
8663af0e27c7 A little more work on reboot support. Still not enabled, but should work eventually.
Dan
parents: 64
diff changeset
   107
    if ( isset($_POST['newconfigpass']) && $_POST['newconfigpass'] === true )
8663af0e27c7 A little more work on reboot support. Still not enabled, but should work eventually.
Dan
parents: 64
diff changeset
   108
      $new_configpass = '';
8663af0e27c7 A little more work on reboot support. Still not enabled, but should work eventually.
Dan
parents: 64
diff changeset
   109
    
8663af0e27c7 A little more work on reboot support. Still not enabled, but should work eventually.
Dan
parents: 64
diff changeset
   110
    $needpass = ( $new_configpass != '' );
50
1b4288399b1f Added graphical configuration, at this point only for the grey theme but others will follow soon. (This has been nearly done for two weeks or more but was on hold due to the bugs with multithreading)
Dan
parents:
diff changeset
   111
    
1b4288399b1f Added graphical configuration, at this point only for the grey theme but others will follow soon. (This has been nearly done for two weeks or more but was on hold due to the bugs with multithreading)
Dan
parents:
diff changeset
   112
    $config_file = <<<EOF
1b4288399b1f Added graphical configuration, at this point only for the grey theme but others will follow soon. (This has been nearly done for two weeks or more but was on hold due to the bugs with multithreading)
Dan
parents:
diff changeset
   113
<?php
1b4288399b1f Added graphical configuration, at this point only for the grey theme but others will follow soon. (This has been nearly done for two weeks or more but was on hold due to the bugs with multithreading)
Dan
parents:
diff changeset
   114
1b4288399b1f Added graphical configuration, at this point only for the grey theme but others will follow soon. (This has been nearly done for two weeks or more but was on hold due to the bugs with multithreading)
Dan
parents:
diff changeset
   115
//
1b4288399b1f Added graphical configuration, at this point only for the grey theme but others will follow soon. (This has been nearly done for two weeks or more but was on hold due to the bugs with multithreading)
Dan
parents:
diff changeset
   116
// GREYHOUND CONFIGURATION
1b4288399b1f Added graphical configuration, at this point only for the grey theme but others will follow soon. (This has been nearly done for two weeks or more but was on hold due to the bugs with multithreading)
Dan
parents:
diff changeset
   117
//
1b4288399b1f Added graphical configuration, at this point only for the grey theme but others will follow soon. (This has been nearly done for two weeks or more but was on hold due to the bugs with multithreading)
Dan
parents:
diff changeset
   118
1b4288399b1f Added graphical configuration, at this point only for the grey theme but others will follow soon. (This has been nearly done for two weeks or more but was on hold due to the bugs with multithreading)
Dan
parents:
diff changeset
   119
// Listen on all interfaces. If this is false, it will only listen on
1b4288399b1f Added graphical configuration, at this point only for the grey theme but others will follow soon. (This has been nearly done for two weeks or more but was on hold due to the bugs with multithreading)
Dan
parents:
diff changeset
   120
// 127.0.0.1 (the loopback interface)
1b4288399b1f Added graphical configuration, at this point only for the grey theme but others will follow soon. (This has been nearly done for two weeks or more but was on hold due to the bugs with multithreading)
Dan
parents:
diff changeset
   121
\$GLOBALS['public'] = $public;
1b4288399b1f Added graphical configuration, at this point only for the grey theme but others will follow soon. (This has been nearly done for two weeks or more but was on hold due to the bugs with multithreading)
Dan
parents:
diff changeset
   122
1b4288399b1f Added graphical configuration, at this point only for the grey theme but others will follow soon. (This has been nearly done for two weeks or more but was on hold due to the bugs with multithreading)
Dan
parents:
diff changeset
   123
// Allow control of playback. By default this is turned on but if you
1b4288399b1f Added graphical configuration, at this point only for the grey theme but others will follow soon. (This has been nearly done for two weeks or more but was on hold due to the bugs with multithreading)
Dan
parents:
diff changeset
   124
// set this to false, it will only display the playlist.
1b4288399b1f Added graphical configuration, at this point only for the grey theme but others will follow soon. (This has been nearly done for two weeks or more but was on hold due to the bugs with multithreading)
Dan
parents:
diff changeset
   125
\$GLOBALS['allowcontrol'] = $allowcontrol;
1b4288399b1f Added graphical configuration, at this point only for the grey theme but others will follow soon. (This has been nearly done for two weeks or more but was on hold due to the bugs with multithreading)
Dan
parents:
diff changeset
   126
1b4288399b1f Added graphical configuration, at this point only for the grey theme but others will follow soon. (This has been nearly done for two weeks or more but was on hold due to the bugs with multithreading)
Dan
parents:
diff changeset
   127
// The default theme. This should be a name of a directory in ./themes.
1b4288399b1f Added graphical configuration, at this point only for the grey theme but others will follow soon. (This has been nearly done for two weeks or more but was on hold due to the bugs with multithreading)
Dan
parents:
diff changeset
   128
\$GLOBALS['theme'] = 'grey';
1b4288399b1f Added graphical configuration, at this point only for the grey theme but others will follow soon. (This has been nearly done for two weeks or more but was on hold due to the bugs with multithreading)
Dan
parents:
diff changeset
   129
1b4288399b1f Added graphical configuration, at this point only for the grey theme but others will follow soon. (This has been nearly done for two weeks or more but was on hold due to the bugs with multithreading)
Dan
parents:
diff changeset
   130
// Allow forking when an HTTP request is received. This has advantages
1b4288399b1f Added graphical configuration, at this point only for the grey theme but others will follow soon. (This has been nearly done for two weeks or more but was on hold due to the bugs with multithreading)
Dan
parents:
diff changeset
   131
// and disadvantages. If this experimental option is enabled, it will
1b4288399b1f Added graphical configuration, at this point only for the grey theme but others will follow soon. (This has been nearly done for two weeks or more but was on hold due to the bugs with multithreading)
Dan
parents:
diff changeset
   132
// result in faster responses and load times but more memory usage.
1b4288399b1f Added graphical configuration, at this point only for the grey theme but others will follow soon. (This has been nearly done for two weeks or more but was on hold due to the bugs with multithreading)
Dan
parents:
diff changeset
   133
\$GLOBALS['allow_fork'] = $allow_fork;
1b4288399b1f Added graphical configuration, at this point only for the grey theme but others will follow soon. (This has been nearly done for two weeks or more but was on hold due to the bugs with multithreading)
Dan
parents:
diff changeset
   134
1b4288399b1f Added graphical configuration, at this point only for the grey theme but others will follow soon. (This has been nearly done for two weeks or more but was on hold due to the bugs with multithreading)
Dan
parents:
diff changeset
   135
// set to true to enable authentication
1b4288399b1f Added graphical configuration, at this point only for the grey theme but others will follow soon. (This has been nearly done for two weeks or more but was on hold due to the bugs with multithreading)
Dan
parents:
diff changeset
   136
// this uses cookies, so make sure they're enabled in your browser
1b4288399b1f Added graphical configuration, at this point only for the grey theme but others will follow soon. (This has been nearly done for two weeks or more but was on hold due to the bugs with multithreading)
Dan
parents:
diff changeset
   137
\$GLOBALS['use_auth'] = $use_auth;
1b4288399b1f Added graphical configuration, at this point only for the grey theme but others will follow soon. (This has been nearly done for two weeks or more but was on hold due to the bugs with multithreading)
Dan
parents:
diff changeset
   138
1b4288399b1f Added graphical configuration, at this point only for the grey theme but others will follow soon. (This has been nearly done for two weeks or more but was on hold due to the bugs with multithreading)
Dan
parents:
diff changeset
   139
// valid users and passwords
1b4288399b1f Added graphical configuration, at this point only for the grey theme but others will follow soon. (This has been nearly done for two weeks or more but was on hold due to the bugs with multithreading)
Dan
parents:
diff changeset
   140
\$GLOBALS['auth_data'] = $auth_data;
1b4288399b1f Added graphical configuration, at this point only for the grey theme but others will follow soon. (This has been nearly done for two weeks or more but was on hold due to the bugs with multithreading)
Dan
parents:
diff changeset
   141
1b4288399b1f Added graphical configuration, at this point only for the grey theme but others will follow soon. (This has been nearly done for two weeks or more but was on hold due to the bugs with multithreading)
Dan
parents:
diff changeset
   142
// password for site configuration
1b4288399b1f Added graphical configuration, at this point only for the grey theme but others will follow soon. (This has been nearly done for two weeks or more but was on hold due to the bugs with multithreading)
Dan
parents:
diff changeset
   143
\$GLOBALS['configpass'] = '$new_configpass';
1b4288399b1f Added graphical configuration, at this point only for the grey theme but others will follow soon. (This has been nearly done for two weeks or more but was on hold due to the bugs with multithreading)
Dan
parents:
diff changeset
   144
71
8663af0e27c7 A little more work on reboot support. Still not enabled, but should work eventually.
Dan
parents: 64
diff changeset
   145
// IPv4 and IPv6
8663af0e27c7 A little more work on reboot support. Still not enabled, but should work eventually.
Dan
parents: 64
diff changeset
   146
$ipv6_settings
8663af0e27c7 A little more work on reboot support. Still not enabled, but should work eventually.
Dan
parents: 64
diff changeset
   147
50
1b4288399b1f Added graphical configuration, at this point only for the grey theme but others will follow soon. (This has been nearly done for two weeks or more but was on hold due to the bugs with multithreading)
Dan
parents:
diff changeset
   148
EOF;
1b4288399b1f Added graphical configuration, at this point only for the grey theme but others will follow soon. (This has been nearly done for two weeks or more but was on hold due to the bugs with multithreading)
Dan
parents:
diff changeset
   149
    $error = 'Couldn\'t write to the config file (./greyhound-config.php).';
1b4288399b1f Added graphical configuration, at this point only for the grey theme but others will follow soon. (This has been nearly done for two weeks or more but was on hold due to the bugs with multithreading)
Dan
parents:
diff changeset
   150
    
1b4288399b1f Added graphical configuration, at this point only for the grey theme but others will follow soon. (This has been nearly done for two weeks or more but was on hold due to the bugs with multithreading)
Dan
parents:
diff changeset
   151
    $fp = @fopen('./greyhound-config.php', 'w');
1b4288399b1f Added graphical configuration, at this point only for the grey theme but others will follow soon. (This has been nearly done for two weeks or more but was on hold due to the bugs with multithreading)
Dan
parents:
diff changeset
   152
    if ( $fp )
1b4288399b1f Added graphical configuration, at this point only for the grey theme but others will follow soon. (This has been nearly done for two weeks or more but was on hold due to the bugs with multithreading)
Dan
parents:
diff changeset
   153
    {
1b4288399b1f Added graphical configuration, at this point only for the grey theme but others will follow soon. (This has been nearly done for two weeks or more but was on hold due to the bugs with multithreading)
Dan
parents:
diff changeset
   154
      fwrite($fp, $config_file);
1b4288399b1f Added graphical configuration, at this point only for the grey theme but others will follow soon. (This has been nearly done for two weeks or more but was on hold due to the bugs with multithreading)
Dan
parents:
diff changeset
   155
      fclose($fp);
1b4288399b1f Added graphical configuration, at this point only for the grey theme but others will follow soon. (This has been nearly done for two weeks or more but was on hold due to the bugs with multithreading)
Dan
parents:
diff changeset
   156
      
1b4288399b1f Added graphical configuration, at this point only for the grey theme but others will follow soon. (This has been nearly done for two weeks or more but was on hold due to the bugs with multithreading)
Dan
parents:
diff changeset
   157
      $passblurb = $auth_changed ? "\n<small>If you changed your own password, you've been logged out so you'll need to log back in again.</small>" : '';
1b4288399b1f Added graphical configuration, at this point only for the grey theme but others will follow soon. (This has been nearly done for two weeks or more but was on hold due to the bugs with multithreading)
Dan
parents:
diff changeset
   158
      if ( REBOOT_SUPPORT )
1b4288399b1f Added graphical configuration, at this point only for the grey theme but others will follow soon. (This has been nearly done for two weeks or more but was on hold due to the bugs with multithreading)
Dan
parents:
diff changeset
   159
      {
1b4288399b1f Added graphical configuration, at this point only for the grey theme but others will follow soon. (This has been nearly done for two weeks or more but was on hold due to the bugs with multithreading)
Dan
parents:
diff changeset
   160
        $rebootblurb = $need_reboot ? "\n<small>Since you changed some core configuration values, the Greyhound server has been restarted.</small>\n<small>If Greyhound doesn't respond, wait 20 seconds and then restart it using Amarok's script manager.</small>" : '';
1b4288399b1f Added graphical configuration, at this point only for the grey theme but others will follow soon. (This has been nearly done for two weeks or more but was on hold due to the bugs with multithreading)
Dan
parents:
diff changeset
   161
      }
1b4288399b1f Added graphical configuration, at this point only for the grey theme but others will follow soon. (This has been nearly done for two weeks or more but was on hold due to the bugs with multithreading)
Dan
parents:
diff changeset
   162
      else
1b4288399b1f Added graphical configuration, at this point only for the grey theme but others will follow soon. (This has been nearly done for two weeks or more but was on hold due to the bugs with multithreading)
Dan
parents:
diff changeset
   163
      {
71
8663af0e27c7 A little more work on reboot support. Still not enabled, but should work eventually.
Dan
parents: 64
diff changeset
   164
        $rebootblurb = $need_reboot ? "\n<small>Please restart Greyhound using Amarok's script manager for public IP, multithreading, and IPv6 options to take effect.</small>" : '';
50
1b4288399b1f Added graphical configuration, at this point only for the grey theme but others will follow soon. (This has been nearly done for two weeks or more but was on hold due to the bugs with multithreading)
Dan
parents:
diff changeset
   165
      }
1b4288399b1f Added graphical configuration, at this point only for the grey theme but others will follow soon. (This has been nearly done for two weeks or more but was on hold due to the bugs with multithreading)
Dan
parents:
diff changeset
   166
      $success = "Configuration changes successful.{$passblurb}{$rebootblurb}";
71
8663af0e27c7 A little more work on reboot support. Still not enabled, but should work eventually.
Dan
parents: 64
diff changeset
   167
      if ( $httpd->threader->is_child() )
8663af0e27c7 A little more work on reboot support. Still not enabled, but should work eventually.
Dan
parents: 64
diff changeset
   168
      {
8663af0e27c7 A little more work on reboot support. Still not enabled, but should work eventually.
Dan
parents: 64
diff changeset
   169
        $httpd->threader->ipc_send(array('action' => 'reloadconfig', 'propagate' => true));
8663af0e27c7 A little more work on reboot support. Still not enabled, but should work eventually.
Dan
parents: 64
diff changeset
   170
      }
8663af0e27c7 A little more work on reboot support. Still not enabled, but should work eventually.
Dan
parents: 64
diff changeset
   171
      else
8663af0e27c7 A little more work on reboot support. Still not enabled, but should work eventually.
Dan
parents: 64
diff changeset
   172
      {
8663af0e27c7 A little more work on reboot support. Still not enabled, but should work eventually.
Dan
parents: 64
diff changeset
   173
        grey_reload_config();
8663af0e27c7 A little more work on reboot support. Still not enabled, but should work eventually.
Dan
parents: 64
diff changeset
   174
      }
50
1b4288399b1f Added graphical configuration, at this point only for the grey theme but others will follow soon. (This has been nearly done for two weeks or more but was on hold due to the bugs with multithreading)
Dan
parents:
diff changeset
   175
      
1b4288399b1f Added graphical configuration, at this point only for the grey theme but others will follow soon. (This has been nearly done for two weeks or more but was on hold due to the bugs with multithreading)
Dan
parents:
diff changeset
   176
      if ( $need_reboot && REBOOT_SUPPORT )
1b4288399b1f Added graphical configuration, at this point only for the grey theme but others will follow soon. (This has been nearly done for two weeks or more but was on hold due to the bugs with multithreading)
Dan
parents:
diff changeset
   177
      {
71
8663af0e27c7 A little more work on reboot support. Still not enabled, but should work eventually.
Dan
parents: 64
diff changeset
   178
        if ( $GLOBALS['enable_ipv6'] )
8663af0e27c7 A little more work on reboot support. Still not enabled, but should work eventually.
Dan
parents: 64
diff changeset
   179
        {
8663af0e27c7 A little more work on reboot support. Still not enabled, but should work eventually.
Dan
parents: 64
diff changeset
   180
          $addr = isset($_POST['public']) ? '::' : '::1';
8663af0e27c7 A little more work on reboot support. Still not enabled, but should work eventually.
Dan
parents: 64
diff changeset
   181
        }
8663af0e27c7 A little more work on reboot support. Still not enabled, but should work eventually.
Dan
parents: 64
diff changeset
   182
        else
8663af0e27c7 A little more work on reboot support. Still not enabled, but should work eventually.
Dan
parents: 64
diff changeset
   183
        {
8663af0e27c7 A little more work on reboot support. Still not enabled, but should work eventually.
Dan
parents: 64
diff changeset
   184
          $addr = isset($_POST['public']) ? '0.0.0.0' : '127.0.0.1';
8663af0e27c7 A little more work on reboot support. Still not enabled, but should work eventually.
Dan
parents: 64
diff changeset
   185
        }
8663af0e27c7 A little more work on reboot support. Still not enabled, but should work eventually.
Dan
parents: 64
diff changeset
   186
        $fork = isset($_POST['allow_fork']);
50
1b4288399b1f Added graphical configuration, at this point only for the grey theme but others will follow soon. (This has been nearly done for two weeks or more but was on hold due to the bugs with multithreading)
Dan
parents:
diff changeset
   187
        $httpd->reboot($addr, null, $fork);
1b4288399b1f Added graphical configuration, at this point only for the grey theme but others will follow soon. (This has been nearly done for two weeks or more but was on hold due to the bugs with multithreading)
Dan
parents:
diff changeset
   188
      }
1b4288399b1f Added graphical configuration, at this point only for the grey theme but others will follow soon. (This has been nearly done for two weeks or more but was on hold due to the bugs with multithreading)
Dan
parents:
diff changeset
   189
    }
1b4288399b1f Added graphical configuration, at this point only for the grey theme but others will follow soon. (This has been nearly done for two weeks or more but was on hold due to the bugs with multithreading)
Dan
parents:
diff changeset
   190
  }
1b4288399b1f Added graphical configuration, at this point only for the grey theme but others will follow soon. (This has been nearly done for two weeks or more but was on hold due to the bugs with multithreading)
Dan
parents:
diff changeset
   191
  
78
08f8a72b1f7b Added Offline Mode - automatically turned on and off based on connectivity to server. Version bumped to 0.1a5.
Dan
parents: 71
diff changeset
   192
  $message = false;
08f8a72b1f7b Added Offline Mode - automatically turned on and off based on connectivity to server. Version bumped to 0.1a5.
Dan
parents: 71
diff changeset
   193
  
08f8a72b1f7b Added Offline Mode - automatically turned on and off based on connectivity to server. Version bumped to 0.1a5.
Dan
parents: 71
diff changeset
   194
  // Rebuild options
08f8a72b1f7b Added Offline Mode - automatically turned on and off based on connectivity to server. Version bumped to 0.1a5.
Dan
parents: 71
diff changeset
   195
  $pathinfo = @substr(@substr($_SERVER['REQUEST_URI'], 1), @strpos(@substr($_SERVER['REQUEST_URI'], 1), '/')+1);
08f8a72b1f7b Added Offline Mode - automatically turned on and off based on connectivity to server. Version bumped to 0.1a5.
Dan
parents: 71
diff changeset
   196
  switch($pathinfo)
08f8a72b1f7b Added Offline Mode - automatically turned on and off based on connectivity to server. Version bumped to 0.1a5.
Dan
parents: 71
diff changeset
   197
  {
08f8a72b1f7b Added Offline Mode - automatically turned on and off based on connectivity to server. Version bumped to 0.1a5.
Dan
parents: 71
diff changeset
   198
    case 'rebuild/artwork':
08f8a72b1f7b Added Offline Mode - automatically turned on and off based on connectivity to server. Version bumped to 0.1a5.
Dan
parents: 71
diff changeset
   199
      global $amarok_home;
08f8a72b1f7b Added Offline Mode - automatically turned on and off based on connectivity to server. Version bumped to 0.1a5.
Dan
parents: 71
diff changeset
   200
      $artwork_dir = "$amarok_home/albumcovers";
08f8a72b1f7b Added Offline Mode - automatically turned on and off based on connectivity to server. Version bumped to 0.1a5.
Dan
parents: 71
diff changeset
   201
      
08f8a72b1f7b Added Offline Mode - automatically turned on and off based on connectivity to server. Version bumped to 0.1a5.
Dan
parents: 71
diff changeset
   202
      if ( $dp = opendir($artwork_dir) )
08f8a72b1f7b Added Offline Mode - automatically turned on and off based on connectivity to server. Version bumped to 0.1a5.
Dan
parents: 71
diff changeset
   203
      {
08f8a72b1f7b Added Offline Mode - automatically turned on and off based on connectivity to server. Version bumped to 0.1a5.
Dan
parents: 71
diff changeset
   204
        while ( $dh = @readdir($dp) )
08f8a72b1f7b Added Offline Mode - automatically turned on and off based on connectivity to server. Version bumped to 0.1a5.
Dan
parents: 71
diff changeset
   205
        {
08f8a72b1f7b Added Offline Mode - automatically turned on and off based on connectivity to server. Version bumped to 0.1a5.
Dan
parents: 71
diff changeset
   206
          if ( preg_match('/^collage_[0-9]+\.(?:map|png)$/', $dh) )
08f8a72b1f7b Added Offline Mode - automatically turned on and off based on connectivity to server. Version bumped to 0.1a5.
Dan
parents: 71
diff changeset
   207
          {
08f8a72b1f7b Added Offline Mode - automatically turned on and off based on connectivity to server. Version bumped to 0.1a5.
Dan
parents: 71
diff changeset
   208
            unlink("$artwork_dir/$dh");
08f8a72b1f7b Added Offline Mode - automatically turned on and off based on connectivity to server. Version bumped to 0.1a5.
Dan
parents: 71
diff changeset
   209
          }
08f8a72b1f7b Added Offline Mode - automatically turned on and off based on connectivity to server. Version bumped to 0.1a5.
Dan
parents: 71
diff changeset
   210
        }
08f8a72b1f7b Added Offline Mode - automatically turned on and off based on connectivity to server. Version bumped to 0.1a5.
Dan
parents: 71
diff changeset
   211
        closedir($dp);
08f8a72b1f7b Added Offline Mode - automatically turned on and off based on connectivity to server. Version bumped to 0.1a5.
Dan
parents: 71
diff changeset
   212
      }
08f8a72b1f7b Added Offline Mode - automatically turned on and off based on connectivity to server. Version bumped to 0.1a5.
Dan
parents: 71
diff changeset
   213
      
08f8a72b1f7b Added Offline Mode - automatically turned on and off based on connectivity to server. Version bumped to 0.1a5.
Dan
parents: 71
diff changeset
   214
      $message = 'Successfully cleared album art cache';
08f8a72b1f7b Added Offline Mode - automatically turned on and off based on connectivity to server. Version bumped to 0.1a5.
Dan
parents: 71
diff changeset
   215
      break;
08f8a72b1f7b Added Offline Mode - automatically turned on and off based on connectivity to server. Version bumped to 0.1a5.
Dan
parents: 71
diff changeset
   216
    case 'rebuild/playlist':
08f8a72b1f7b Added Offline Mode - automatically turned on and off based on connectivity to server. Version bumped to 0.1a5.
Dan
parents: 71
diff changeset
   217
      rebuild_playlist(true);
08f8a72b1f7b Added Offline Mode - automatically turned on and off based on connectivity to server. Version bumped to 0.1a5.
Dan
parents: 71
diff changeset
   218
      $message = 'Successfully rebuilt playlist cache';
08f8a72b1f7b Added Offline Mode - automatically turned on and off based on connectivity to server. Version bumped to 0.1a5.
Dan
parents: 71
diff changeset
   219
      break;
08f8a72b1f7b Added Offline Mode - automatically turned on and off based on connectivity to server. Version bumped to 0.1a5.
Dan
parents: 71
diff changeset
   220
  }
08f8a72b1f7b Added Offline Mode - automatically turned on and off based on connectivity to server. Version bumped to 0.1a5.
Dan
parents: 71
diff changeset
   221
  
50
1b4288399b1f Added graphical configuration, at this point only for the grey theme but others will follow soon. (This has been nearly done for two weeks or more but was on hold due to the bugs with multithreading)
Dan
parents:
diff changeset
   222
  global $theme;
1b4288399b1f Added graphical configuration, at this point only for the grey theme but others will follow soon. (This has been nearly done for two weeks or more but was on hold due to the bugs with multithreading)
Dan
parents:
diff changeset
   223
  $iphone = ( ( strpos($_SERVER['HTTP_USER_AGENT'], 'iPhone') ||
1b4288399b1f Added graphical configuration, at this point only for the grey theme but others will follow soon. (This has been nearly done for two weeks or more but was on hold due to the bugs with multithreading)
Dan
parents:
diff changeset
   224
       strpos($_SERVER['HTTP_USER_AGENT'], 'iPod') ||
1b4288399b1f Added graphical configuration, at this point only for the grey theme but others will follow soon. (This has been nearly done for two weeks or more but was on hold due to the bugs with multithreading)
Dan
parents:
diff changeset
   225
       strpos($_SERVER['HTTP_USER_AGENT'], 'BlackBerry') ||
1b4288399b1f Added graphical configuration, at this point only for the grey theme but others will follow soon. (This has been nearly done for two weeks or more but was on hold due to the bugs with multithreading)
Dan
parents:
diff changeset
   226
       isset($_GET['m']) )
1b4288399b1f Added graphical configuration, at this point only for the grey theme but others will follow soon. (This has been nearly done for two weeks or more but was on hold due to the bugs with multithreading)
Dan
parents:
diff changeset
   227
       && !isset($_GET['f'])
1b4288399b1f Added graphical configuration, at this point only for the grey theme but others will follow soon. (This has been nearly done for two weeks or more but was on hold due to the bugs with multithreading)
Dan
parents:
diff changeset
   228
       );
1b4288399b1f Added graphical configuration, at this point only for the grey theme but others will follow soon. (This has been nearly done for two weeks or more but was on hold due to the bugs with multithreading)
Dan
parents:
diff changeset
   229
  $theme_id = ( $iphone ) ? 'iphone' : $theme;
78
08f8a72b1f7b Added Offline Mode - automatically turned on and off based on connectivity to server. Version bumped to 0.1a5.
Dan
parents: 71
diff changeset
   230
  
50
1b4288399b1f Added graphical configuration, at this point only for the grey theme but others will follow soon. (This has been nearly done for two weeks or more but was on hold due to the bugs with multithreading)
Dan
parents:
diff changeset
   231
  $smarty = load_theme($theme_id);
1b4288399b1f Added graphical configuration, at this point only for the grey theme but others will follow soon. (This has been nearly done for two weeks or more but was on hold due to the bugs with multithreading)
Dan
parents:
diff changeset
   232
  $smarty->assign('theme', $theme_id);
1b4288399b1f Added graphical configuration, at this point only for the grey theme but others will follow soon. (This has been nearly done for two weeks or more but was on hold due to the bugs with multithreading)
Dan
parents:
diff changeset
   233
  $smarty->assign('greyhound_version', GREY_VERSION);
1b4288399b1f Added graphical configuration, at this point only for the grey theme but others will follow soon. (This has been nearly done for two weeks or more but was on hold due to the bugs with multithreading)
Dan
parents:
diff changeset
   234
  $smarty->assign('tried', $tried);
1b4288399b1f Added graphical configuration, at this point only for the grey theme but others will follow soon. (This has been nearly done for two weeks or more but was on hold due to the bugs with multithreading)
Dan
parents:
diff changeset
   235
  $smarty->assign('success', $success);
78
08f8a72b1f7b Added Offline Mode - automatically turned on and off based on connectivity to server. Version bumped to 0.1a5.
Dan
parents: 71
diff changeset
   236
  $smarty->assign('message', $message);
50
1b4288399b1f Added graphical configuration, at this point only for the grey theme but others will follow soon. (This has been nearly done for two weeks or more but was on hold due to the bugs with multithreading)
Dan
parents:
diff changeset
   237
  $smarty->assign('needpass', $needpass);
1b4288399b1f Added graphical configuration, at this point only for the grey theme but others will follow soon. (This has been nearly done for two weeks or more but was on hold due to the bugs with multithreading)
Dan
parents:
diff changeset
   238
  $smarty->assign('use_auth', $use_auth);
1b4288399b1f Added graphical configuration, at this point only for the grey theme but others will follow soon. (This has been nearly done for two weeks or more but was on hold due to the bugs with multithreading)
Dan
parents:
diff changeset
   239
  $smarty->assign('public', $GLOBALS['public']);
71
8663af0e27c7 A little more work on reboot support. Still not enabled, but should work eventually.
Dan
parents: 64
diff changeset
   240
  $smarty->assign('ipv6', $GLOBALS['enable_ipv6']);
50
1b4288399b1f Added graphical configuration, at this point only for the grey theme but others will follow soon. (This has been nearly done for two weeks or more but was on hold due to the bugs with multithreading)
Dan
parents:
diff changeset
   241
  $smarty->assign('allowcontrol', $GLOBALS['allowcontrol']);
1b4288399b1f Added graphical configuration, at this point only for the grey theme but others will follow soon. (This has been nearly done for two weeks or more but was on hold due to the bugs with multithreading)
Dan
parents:
diff changeset
   242
  $smarty->assign('allow_fork', $GLOBALS['allow_fork']);
1b4288399b1f Added graphical configuration, at this point only for the grey theme but others will follow soon. (This has been nearly done for two weeks or more but was on hold due to the bugs with multithreading)
Dan
parents:
diff changeset
   243
  $smarty->assign('use_auth', $GLOBALS['use_auth']);
1b4288399b1f Added graphical configuration, at this point only for the grey theme but others will follow soon. (This has been nearly done for two weeks or more but was on hold due to the bugs with multithreading)
Dan
parents:
diff changeset
   244
  $smarty->assign('users', $GLOBALS['auth_data']);
71
8663af0e27c7 A little more work on reboot support. Still not enabled, but should work eventually.
Dan
parents: 64
diff changeset
   245
  $smarty->assign('reboot_support', REBOOT_SUPPORT);
50
1b4288399b1f Added graphical configuration, at this point only for the grey theme but others will follow soon. (This has been nearly done for two weeks or more but was on hold due to the bugs with multithreading)
Dan
parents:
diff changeset
   246
  $smarty->assign('error', $error);
1b4288399b1f Added graphical configuration, at this point only for the grey theme but others will follow soon. (This has been nearly done for two weeks or more but was on hold due to the bugs with multithreading)
Dan
parents:
diff changeset
   247
  $smarty->display('config.tpl');
1b4288399b1f Added graphical configuration, at this point only for the grey theme but others will follow soon. (This has been nearly done for two weeks or more but was on hold due to the bugs with multithreading)
Dan
parents:
diff changeset
   248
}