Beispiel #1
0
 static function start()
 {
     load_control($GLOBALS["control"]);
     $control = ucfirst($GLOBALS["control"]) . "Control";
     if (!class_exists($control)) {
         Umsg("控制器类不存在" . $control);
     }
     $instance = new $control();
     $action = $GLOBALS["action"];
     if (!method_exists($instance, $action)) {
         Umsg("ACTION不存在" . $action);
     }
     $instance->{$action}();
 }
Beispiel #2
0
 function add_albulm()
 {
     if (!$_POST) {
         Umsg("添加相册失败");
     }
     $data = $_POST;
     $time = time();
     $data["add_time"] = $time;
     $rs = daocall("admin", "add_albulm", array($data));
     if (!$rs) {
         Umsg("添加相册失败");
     }
     $pic_data = array();
     $pic_data["albulm_id"] = $rs;
     $pic_data["pic_name"] = "albulm" . $rs . "_cover";
     $pic_data["pic_desc"] = "albulm" . $rs . "_cover";
     $pic_data["belong_to"] = $_POST["belong_to"];
     $pic_data["is_cover"] = 1;
     $pic_data["add_time"] = $time;
     $rs = modcall("admin", "upload_pic", array($_FILES, $pic_data));
     if ($rs) {
         Umsg("添加相册成功");
     }
     Umsg("添加相册失败");
 }
Beispiel #3
0
function load_view($__file, $__data = null, $__print = true)
{
    !defined("__OUTVIEW__") && define("__OUTVIEW__", 1);
    if (!is_null($__data)) {
        if (is_array($__data)) {
            foreach ($__data as $__key => $__value) {
                if (!isset(${$__key})) {
                    ${$__key} = $__value;
                }
            }
        } else {
            if (is_object($__data)) {
                $__data = get_object_vars($__data);
            } else {
                trigger_error(__FUNCTION__ . ' 函数的第2个参数必须是数组或者类', E_USER_NOTICE);
            }
        }
    }
    $file = UPATH . "/app/view/" . $__file . ".view.php";
    if (!file_exists($file)) {
        Umsg("视图不存在");
    }
    ob_start();
    require_once $file;
    $__ob_content = ob_get_contents();
    ob_end_clean();
    if ($__print) {
        if (isset($GLOBALS["cookie"]) && $GLOBALS["cookie"]) {
            header('P3P:CP="IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT"');
            //header('P3P: CP="NOI DEV PSA PSD IVA PVD OTP OUR OTR IND OTC"');
            foreach ($GLOBALS["cookie"] as $cn => $cv) {
                @setcookie($cn, $cv["value"], $cv["expire"], $cv["path"], $cv["domain"]);
            }
        }
        unset($GLOBALS["cookie"]);
        header("Content-type:text/html;charset=utf-8");
        echo $__ob_content;
    } else {
        return $__ob_content;
    }
}