<?php include '../../base.php'; if (!Yike\AccessControl::roleAllow(array(Yike\AccessControl::USER))) { $json['status'] = 0; $json['message'] = "请登陆"; } else { $json['status'] = 0; $id = intval($_REQUEST['id']); $unuse = Model\OwnedThing::findUnuse($id); if ($unuse) { if ($unuse->ownner->user_id == CURRENT_YIKE) { //只能删除自己的物品 $unuse->softDelete(); $json['status'] = 1; $json['message'] = "删除成功"; } else { $json['message'] = "无权限删除该物品"; } } else { $json['message'] = "该物品已经被删除"; } } echo json_encode($json);
<?php include_once '../../base.php'; if (!Yike\AccessControl::roleAllow(array(Yike\AccessControl::USER))) { //检查权限 header('HTTP/1.1 403 Forbidden'); header("location: /app/user/login.php"); exit; } $msgs = Model\Message::findUserMsg(); $myUnuses = Model\OwnedThing::myUnuseThing(10); $myRequires = Model\DemandThing::myRequireThing(10); $statuses = Model\Status::all(); ?> <!DOCTYPE html > <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>用户中心</title> <?php echo View\Home::$styles . "\n"; echo View\Home::addStyle("user/index.css"); ?> <style> </style> </head> <body> <?php echo View\Home::getNav();
/* if( !Yike\AccessControl::roleAllow(array(Yike\AccessControl::USER)) ){ //检查权限 header('HTTP/1.1 403 Forbidden'); header("location: /app/user/login.php"); exit; } */ if (!isset($_GET['id'])) { header('HTTP/1.1 404 Not Found'); exit; } $id = intval($_GET['id']); $user = Model\User::findUser($id); if (!$user) { header('HTTP/1.1 404 Not Found'); exit; } $unuses = Model\OwnedThing::userUnuseThings($id, 10); $requires = Model\DemandThing::userRequireThings($id, 10); ?> <!DOCTYPE html > <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title><?php echo $user->user_name; ?> 的空间</title> <?php echo View\Home::$styles . "\n"; echo View\Home::addStyle("user/user.css"); ?> </head>
<?php include_once '../../base.php'; if (Yike\AccessControl::roleAllow(array(Yike\AccessControl::USER))) { //检查权限 $data = array_map("trim", $_REQUEST); $json['status'] = 0; if (Model\Catalogue::exists(intval($data['cat']))) { //检查分类是否存在 $ownthing = new Model\OwnedThing(); $ownthing->init(array('ownthing_name' => strip_tags($data['thingtitle']), 'ownthing_details' => $data['thingdetail'], 'catalogue_id' => $data['cat'], 'ownthing_pic' => strip_tags($data['cover']), 'ownthing_money' => intval($data['money']))); $result = $ownthing->save(); if ($result) { $json['status'] = 1; $json['message'] = "物品 {$ownthing->ownthing_name} 发布成功。"; } else { $json['message'] = "保存失败,请重试。"; } } else { $json['message'] = "分类选择错误哦~"; } } else { $json['status'] = 0; $json['message'] = "你无权限进行此操作"; } echo json_encode($json);
<?php include '../base.php'; if (!isset($_POST['keyword'])) { header("location: /app/user/index.php"); exit; } $keyword = strip_tags($_REQUEST['keyword']); //过滤标签 $unuses = Model\OwnedThing::search($keyword); $requires = Model\DemandThing::search($keyword); $users = Model\User::search($keyword); ?> <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>查找 <?php echo $keyword; ?> </title> <?php echo View\Home::$styles . "\n"; ?> </head> <body> <?php echo View\Home::getNav(); ?> <div class="accordion" id="searchResult" style="width: 800px; margin: 0 auto; ">