コード例 #1
0
ファイル: page_text.php プロジェクト: double-web/drawline
function list_options($array, $depth = 0)
{
    foreach ($array as $v) {
        ?>
                            <option value="<?php 
        echo $v['category_id'];
        ?>
" <?php 
        echo chkvar("page_category", $v['category_id']) ? 'selected' : (isset($content['content_category']) && $content['content_category'] == $v['category_id'] ? 'selected' : '');
        ?>
>
                                <?php 
        echo str_repeat("&nbsp;&nbsp;&nbsp;", $depth) . ($depth > 0 ? "&boxur;" : '') . " " . $v['category_title'];
        ?>
                            </option>
                            <?php 
        if (!empty($v['category_subcats'])) {
            $depth++;
            list_options($v['category_subcats'], $depth);
            $depth--;
        }
    }
}
コード例 #2
0
function chkvar($var, $val)
{
    $u = explode("/", $var);
    if (count($u) == 2) {
        switch (trim($u[0])) {
            case "post":
                return isset($_POST[$u[1]]) && $_POST[$u[1]] == $val ? true : false;
                break;
            case "get":
                return isset($_GET[$u[1]]) && $_GET[$u[1]] == $val ? true : false;
                break;
            case "request":
                return isset($_REQUEST[$u[1]]) && $_REQUEST[$u[1]] == $val ? true : false;
                break;
            case "server":
                return isset($_SERVER[$u[1]]) && $_SERVER[$u[1]] == $val ? true : false;
                break;
        }
        return false;
    } else {
        if (chkvar("post/" . $var, $val) === true) {
            return true;
        } elseif (chkvar("get/" . $var, $val) === true) {
            return true;
        } elseif (chkvar("request/" . $var, $val) === true) {
            return true;
        } elseif (chkvar("server/" . $var, $val) === true) {
            return true;
        } else {
            return false;
        }
    }
}