<?php

# meta-name="RLSLOG"
# meta-desc="Stuff from rlslog.net"
# meta-author="rezmus"
# meta-date="2010-06-05"
# meta-version="0.1"
# meta-type="umsp"
# meta-url="http://forum.wdlxtv.com/viewtopic.php?f=49&t=734"
# meta-filename="rlslog.php"
# meta-id="rlslog"

$pluginInfo = array (
    'name'      => "RLSLOG",
    'desc'      => "Stuff from rlslog.net",
    'author'    => "rezmus",
    'date'      => "2010-06-05",
    'version'   => "0.1",
    'url'       => "http://forum.wdlxtv.com/viewtopic.php?f=49&t=734",
    'id'        => "rlslog",
);

# _DONT_RUN_CONFIG_ gets set by external scripts that just want to get the pluginInfo array via include() without running any code. Better solution?

if ( !defined('_DONT_RUN_CONFIG_') ) {
    include_once('/usr/share/umsp/funcs-config.php');

    $savedata = $_REQUEST['savedata'];
    if ($savedata == 1){ 
        if (isset($_POST['hotfilecookie'])) {
            _writeConfigSetting('HOTFILE_AUTH',$_POST['hotfilecookie']);
        }

        # Check for a form submit that changes the plugin status:
        if ( isset($_POST['pluginStatus']) ) {
            $writeResult = _writePluginStatus($pluginInfo['id'], $_POST['pluginStatus']);
        }
        echo '<center><h3>Configuration saved!</h3></center>';
    }

    # _configMainHTML generates a standard plugin dialog based on the pluginInfo array:
    $retHTML = _configMainHTML($pluginInfo);
    # Add additonal HTML or code here

    $retHTML .= '<center><form action="./config.php?savedata=1" method="post">';

    # generate button to enable/disable plugin
    $retHTML .= _pluginConfigureButton($pluginInfo['id']);

    $retHTML .= '  <h3>User Settings';
    $retHTML .= '    <label><br/>';
    $retHTML .= '    </label>';
    $retHTML .= '  </h3>';
    $retHTML .= '    <h5>HotFile cookie value:</h5>';
    $retHTML .= '    <input type="text" name="hotfilecookie" id="hotfilecookie" value="' . _getConfigSetting(HOTFILE_AUTH) . '" style="width:500px;"/>';
    $retHTML .= '    <h5>MegaShares cookie value:</h5>';
    $retHTML .= '    <input type="text" name="megasharescookie" id="megasharescookie" value="' . _getConfigSetting(MEGASHARES_AUTH) . '" style="width:500px;"/>';
    $retHTML .= '    <h5>Hotfile &amp; MegaShare cookie values can by found in firefox by right clicking when logged in,<br/>';
    $retHTML .= '    selecting page info, then looking for "view cookies" under one of the tabs.<br/>';
    $retHTML .= '    You are looking for the auth cookie, the value will be a long string of characters.</h5>';
    $retHTML .= '    <h5><input type="submit" name="submit" value="Save Configuration" /></h5>';
    $retHTML .= '</form></center>';

    # add end tags here, then print:
    $retHTML .= '</body>';
    $retHTML .= '</html>';
    echo $retHTML; 
}

?>
