Пример #1
0
	OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
	SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
	INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
	CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
	ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
	POSSIBILITY OF SUCH DAMAGE.
*/
require "guiconfig.inc";
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
    Session::start();
    if ($_POST['username'] === $config['system']['username'] && $_POST['password'] === $config['system']['password']) {
        Session::initAdmin();
        header('Location: index.php');
        exit;
    } else {
        $users = system_get_user_list();
        foreach ($users as $userk => $userv) {
            $password = crypt($_POST['password'], $userv['password']);
            if ($_POST['username'] === $userv['name'] && $password === $userv['password']) {
                // Check if it is a local user
                if (FALSE === ($cnid = array_search_ex($userv['uid'], $config['access']['user'], "id"))) {
                    break;
                }
                // Is user allowed to access the user portal?
                if (!isset($config['access']['user'][$cnid]['userportal'])) {
                    break;
                }
                Session::initUser($userv['uid'], $userv['name']);
                header('Location: index.php');
                exit;
            }
Пример #2
0
?>
					<?php 
html_checkbox("allowfilecreation", gettext("Allow new files"), $pconfig['allowfilecreation'] ? true : false, gettext("Allow new files to be created."), gettext("By default, only already existing files can be uploaded."), false);
?>
					<?php 
html_separator();
?>
					<?php 
html_titleline(gettext("Advanced settings"));
?>
					<?php 
html_inputbox("port", gettext("Port"), $pconfig['port'], gettext("The port to listen to. The default is to listen to the tftp port specified in /etc/services."), false, 5);
?>
					<?php 
$a_user = array();
foreach (system_get_user_list() as $userk => $userv) {
    $a_user[$userk] = htmlspecialchars($userk);
}
?>
					<?php 
html_combobox("username", gettext("Username"), $pconfig['username'], $a_user, gettext("Specifies the username which the service will run as."), false);
?>
					<?php 
html_inputbox("umask", gettext("umask"), $pconfig['umask'], gettext("Sets the umask for newly created files to the specified value. The default is zero (anyone can read or write)."), false, 4);
?>
					<?php 
html_inputbox("timeout", gettext("Timeout"), $pconfig['timeout'], gettext("Determine the default timeout, in microseconds, before the first packet is retransmitted. The default is 1000000 (1 second)."), false, 10);
?>
					<?php 
html_inputbox("maxblocksize", gettext("Max. block size"), $pconfig['maxblocksize'], gettext("Specifies the maximum permitted block size. The permitted range for this parameter is from 512 to 65464."), false, 5);
?>
	ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
	POSSIBILITY OF SUCH DAMAGE.
*/
require "auth.inc";
require "guiconfig.inc";
$uuid = $_GET['uuid'];
if (isset($_POST['uuid'])) {
    $uuid = $_POST['uuid'];
}
$pgtitle = array(gettext("Access"), gettext("Users"), isset($uuid) ? gettext("Edit") : gettext("Add"));
if (!is_array($config['access']['user'])) {
    $config['access']['user'] = array();
}
array_sort_key($config['access']['user'], "login");
$a_user =& $config['access']['user'];
$a_user_system = system_get_user_list();
$a_group = system_get_group_list();
if (isset($uuid) && FALSE !== ($cnid = array_search_ex($uuid, $a_user, "uuid"))) {
    $pconfig['uuid'] = $a_user[$cnid]['uuid'];
    $pconfig['login'] = $a_user[$cnid]['login'];
    $pconfig['fullname'] = $a_user[$cnid]['fullname'];
    $pconfig['password'] = $a_user[$cnid]['password'];
    $pconfig['passwordconf'] = $pconfig['password'];
    $pconfig['userid'] = $a_user[$cnid]['id'];
    $pconfig['primarygroup'] = $a_user[$cnid]['primarygroup'];
    $pconfig['group'] = $a_user[$cnid]['group'];
    $pconfig['shell'] = $a_user[$cnid]['shell'];
    $pconfig['homedir'] = $a_user[$cnid]['homedir'];
    $pconfig['userportal'] = isset($a_user[$cnid]['userportal']);
} else {
    $pconfig['uuid'] = uuid();