示例#1
0
文件: index.php 项目: name3/cheng
ob_start();
session_start();
date_default_timezone_set('PRC');
require 'lib/helper.php';
require FrameFile::controller('init');
if (isset($force_redirect)) {
    // 强制跳转 这个在整站关闭的时候很有用
    $controller = $force_redirect;
}
$view = $controller;
if (!file_exists(FrameFile::controller($controller))) {
    $controller = 'default';
    // page 404
    include FrameFile::controller($controller);
    include smart_view($controller);
    exit;
}
// auto include if there exists css or js file same name with controller
if (file_exists(_css($controller))) {
    $page['styles'][] = $controller;
}
// execute controller
include FrameFile::controller($controller);
// view
$arr = explode('?', $view);
if (count($arr) == 2 && $arr[1] == 'master') {
    $content = $arr[0];
    $view = 'master';
}
include smart_view($view);
// 渲染 view
示例#2
0
文件: order.php 项目: name3/cheng
            }
        }
        $customer = $customer->id;
        // for next
        break;
    case 'Admin':
    case 'SuperAdmin':
        $factories = Factory::names();
        // get some divs
        if ($by_ajax && is_numeric($target) && preg_match('/get_.+_div/', $action)) {
            include FrameFile::controller('order.get_div');
            exit;
        }
        // 对订单的操作,通过表单post过来的
        if ($action && $by_post && is_numeric($target)) {
            include FrameFile::controller('order.control');
            exit;
        }
        list($customer, $username, $factory) = _get('customer', 'username', 'factory');
        $conds = array_merge($conds, compact('username', 'factory'));
        $page['styles'][] = 'admin';
        break;
    default:
        throw new Exception("unkown user type: {$user_type}");
        break;
}
$conds['customer'] = $customer;
$per_page = 50;
$total = Order::count($conds);
$paging = new Paginate($per_page, $total);
$paging->setCurPage(_get('p') ?: 1);
示例#3
0
文件: function.php 项目: name3/cheng
function smart_view($view, $default = 'default')
{
    if (is_mobile() && ($m = FrameFile::view('mobile/' . $view)) && file_exists($m)) {
        return $m;
    }
    if (($file = FrameFile::view($view)) && file_exists($file)) {
        return FrameFile::view($view);
    }
    throw new Exception("not exist {$file}");
}