コード例 #1
0
ファイル: setup.php プロジェクト: prolin99/mobile_view
function setup_form($config = "")
{
    $xoopsModulesConfig = get_xoopsModulesConfig();
    foreach ($config as $i => $set) {
        eval("\$title={$set['title']};");
        eval("\$description={$set['description']};");
        $input = "";
        $col_name = $set['name'];
        $value = empty($xoopsModulesConfig[$col_name]) ? $set['default'] : $xoopsModulesConfig[$col_name];
        if ($set['formtype'] == "textbox") {
            $input = "<input type='text' name='setup[{$col_name}]' value='{$value}' style='width:100%;'>";
        } elseif ($set['formtype'] == "select") {
            if (is_array($set['options'])) {
                $options = "";
                foreach ($set['options'] as $val => $key) {
                    $selected = $value == $key ? "selected" : "";
                    $options .= "<option value='{$key}' {$selected}>{$val}</option>";
                }
            }
            $input = "<select name='setup[{$col_name}]'>{$options}</select>";
        } elseif ($set['formtype'] == "textarea") {
            $input = "<textarea name='setup[{$col_name}]' style='width:100%;height:60px;'>{$value}</textarea>";
        }
        $data .= "<tr><td><b>{$title}</b>\r\n    <div>{$description}</div></td><td>{$input}</td></tr>";
    }
    $main = "<form action='{$_SERVER['PHP_SELF']}' method='post'>\r\n  <table>\r\n  {$data}\r\n  </table>\r\n  <p align='center'>\r\n  <input type='hidden' name='op' value='save_config'>\r\n  <input type='submit' value='儲存設定'>\r\n  </p>\r\n  </form>";
    return $main;
}
コード例 #2
0
ファイル: tool_php.php プロジェクト: prolin99/mobile_view
<?php

session_start();
include_once "mainfile.php";
include_once XOOPS_ROOT_PATH . "/language/{$xoopsConfig['language']}/modinfo.php";
include_once XOOPS_ROOT_PATH . "/xoops_version.php";
include_once XOOPS_ROOT_PATH . "/language/{$xoopsConfig['language']}/main.php";
include_once XOOPS_ROOT_PATH . "/common/default_language.php";
include_once XOOPS_ROOT_PATH . "/common/class/xoopsModule.php";
include_once XOOPS_ROOT_PATH . "/common/class/xoopsDB.php";
include_once XOOPS_ROOT_PATH . "/common/class/textsanitizer.php";
$xoopsModule = new xoopsModule();
$xoopsDB = new xoopsDB();
$xoopsModuleConfig = get_xoopsModulesConfig();
if (empty($xoopsModuleConfig)) {
    $xoopsModuleConfig = mkXoopsModuleConfig($modversion);
}
if ($_REQUEST['op'] == "login_chk") {
    login_chk($_POST['login_id'], $_POST['login_pass']);
    header("location:" . XOOPS_URL . "/index.php");
} elseif ($_REQUEST['op'] == "logout") {
    logout();
}
$module_login = isAdmin() ? "<a href='" . XOOPS_URL . "/admin/index.php'>後台管理</a> | <a href='" . XOOPS_URL . "/common/setup.php'>偏好設定</a>" : login_form();
$module_title = empty($xoopsModuleConfig['fp_title']) ? $modversion['name'] : $xoopsModuleConfig['fp_title'];
$module_url = XOOPS_URL;
//判斷是否為管理員
function isAdmin()
{
    if ($_SESSION['login_id'] == ADMIN_ID and $_SESSION['login_pass'] == ADMIN_PASSWD) {
        return true;