Example #1
0
/**
 * @author  ryan <*****@*****.**>
 */
function _init()
{
    $config = $GLOBALS['config'];
    Sdb::setConfig($config['db']);
    // login
    $GLOBALS['user'] = $user = User::loggingUser();
    // but the var here should be long such as $logging_user
    if ($user === false) {
        $has_login = false;
    } else {
        $has_login = true;
    }
    $GLOBALS['has_login'] = $has_login;
    // login check
    $controller = $GLOBALS['controller'];
    if (in_array($controller, $config['login_page']) && !$has_login) {
        redirect("login?back={$controller}/{$target}");
    }
    $GLOBALS['nav'] = $navs = build_nav($config['navs']['admin']);
    $page['description'] = $config['description'];
    $page['keywords'] = $config['keywords'];
}
Example #2
0
function build_nav($tree, $url_params)
{
    // Remove Index
    unset($tree['index']);
    $url_path = url_path();
    $html = '<ul class="nav nav-list">';
    foreach ($tree as $key => $val) {
        // Active Tree Node
        if (isset($url_params[0]) && $url_params[0] == $val['clean']) {
            array_shift($url_params);
            // Final Node
            if ($url_path == RFC3986UrlEncode($val['url'])) {
                $html .= '<li class="active">';
            } else {
                $html .= '<li class="open">';
            }
        } else {
            $html .= '<li>';
        }
        if ($val['type'] == 'folder') {
            $html .= '<a href="#" class="aj-nav folder">' . $val['name'] . '</a>';
            $html .= build_nav($val['tree'], $url_params);
        } else {
            $html .= '<a href="' . $val['url'] . '">' . $val['name'] . '</a>';
        }
        $html .= '</li>';
    }
    $html .= '</ul>';
    return $html;
}
    exit;
}
if (isset($_GET["graph3"])) {
    graph3();
    exit;
}
if (isset($_GET["table1"])) {
    table1();
    exit;
}
if (isset($_GET["table2"])) {
    table2();
    exit;
}
if (isset($_GET["build-nav"])) {
    build_nav();
    exit;
}
if (isset($_GET["stats-dahsboard-title"])) {
    stats_dahsboard_title();
    exit;
}
if (isset($_GET["build-chronology"])) {
    build_chronology_table();
    exit;
}
if (isset($_GET["build-identity"])) {
    build_identity();
    exit;
}
if (isset($_GET["build-websites"])) {
Example #4
0
            </div>

            <div class="row-fluid columns content">
                <div class="left-column article-tree span3">
                    <!-- For Mobile -->
                    <div class="responsive-collapse">
                        <button type="button" class="btn btn-sidebar" id="menu-spinner-button">
                            <span class="icon-bar"></span>
                            <span class="icon-bar"></span>
                            <span class="icon-bar"></span>
                        </button>
                    </div>
                    <div id="sub-nav-collapse" class="sub-nav-collapse">
                        <!-- Navigation -->
                        <?php 
    echo build_nav($tree, $url_params);
    ?>

                        <?php 
    if (!empty($options['links']) || !empty($options['twitter'])) {
        ?>
                            <div class="well well-sidebar">
                                <!-- Links -->
                                <?php 
        foreach ($options['links'] as $name => $url) {
            ?>
                                    <a href="<?php 
            echo $url;
            ?>
" target="_blank"><?php 
            echo $name;
Example #5
0
			</div>

			<div class="row-fluid columns content">
				<div class="left-column article-tree span3">
					<!-- For Mobile -->
					<div class="responsive-collapse">
						<button type="button" class="btn btn-sidebar" data-toggle="collapse" data-target="#sub-nav-collapse">
					        <span class="icon-bar"></span>
					        <span class="icon-bar"></span>
					        <span class="icon-bar"></span>
					    </button>
					</div>
					<div id="sub-nav-collapse" class="collapse in">
						<!-- Navigation -->
						<?php 
    echo build_nav($tree);
    ?>

						<?php 
    if (!empty($options['links']) || !empty($options['twitter'])) {
        ?>
							<div class="well well-sidebar">
								<!-- Links -->
								<?php 
        foreach ($options['links'] as $name => $url) {
            ?>
									<a href="<?php 
            echo $url;
            ?>
" target="_blank"><?php 
            echo $name;
Example #6
0
File: init.php Project: name3/cheng
} else {
    $has_login = true;
    $user_type = $user->type;
    $type = strtolower($user_type);
    // $type is a temp var
    ${$type} = $user->instance();
    switch ($user_type) {
        case 'Customer':
            $cart = $customer->cart();
            break;
        case 'Admin':
        case 'SuperAdmin':
            $page['styles'][] = 'admin';
            break;
        default:
            throw new Exception('unrecognize type: ' . $user_type);
            break;
    }
}
// login check
if (in_array($controller, $config['controllers_need_login']) && !$has_login) {
    redirect("login?back={$controller}/{$target}");
}
// sometimes, ? will came, so trim it
$request_uri = reset(explode('?', $_SERVER['REQUEST_URI']));
// build nav array
if ($has_login) {
    $navs = build_nav($config['navs'][strtolower($user_type)]);
}
$page['description'] = 'PHP Tiny Frame 很小很小的 PHP 框架';
$page['keywords'] = array('PHP', '开源', '框架', 'MVC');
        $exif = exif_read_data('images/' . $item, 0, true);
        echo '<li><a class="show" href="#section-' . $count_nav . '">' . $exif[IFD0][Title] . '</a></li>';
    }
    echo '</ul></div>';
}
?>

<?php 
include 'header.php';
?>
<body>

	<div class="container">
		
	<?php 
build_nav($files);
?>
	<?php 
include 'content.php';
?>
   
	
	</div>
	
<?php 
include 'footer.php';
?>
	
</body>
</html>