Example #1
0
include '../301.php';
include_once $_SERVER['DOCUMENT_ROOT'] . '/casarover/application/controllers/check_admin_login_action.php';
include_once $_SERVER['DOCUMENT_ROOT'] . '/casarover/application/models/AttachmentDao.php';
?>
<body>
<div id="container">
    <!-- nav bar start -->
    <?php 
include 'navigator.php';
?>
    <input type="hidden" id="page" value="system"/>
    <!-- nav bar end -->

    <div style="margin-left: 100px; margin-right: 100px;">
        <?php 
$dao = new AttachmentDao();
$photoFolder = $_SERVER['DOCUMENT_ROOT'] . "/photo";
$delFolder = $_SERVER['DOCUMENT_ROOT'] . "/photo/deleted";
if (!file_exists($delFolder)) {
    mkdir($delFolder);
}
$files = scandir($photoFolder);
$delFiles = array();
foreach ($files as $file) {
    if ($file != '.' && $file != '..' && $file != 'deleted') {
        $result = $dao->getByFile($file);
        if (mysql_num_rows($result) == 0) {
            echo $file;
            echo '<br/>';
            $originFile = $photoFolder . '/' . $file;
            $newFile = $delFolder . '/' . $file;
/**
 * This file is for the user's information management after he/she is logged in via QQ.
 * Generally, the process will check whether exists in the database or not,
 * not exists: will create a new user and store in database;
 * exists: will get the existing user.
 * Finally, put the user infomation into session/cookie.
 * @author Ye_WD
 * @2015-12-16
 */
$openid = $_POST["openid"];
$nickname = $_POST["nickname"];
$gender = $_POST["gender"];
$filepath = $_POST["filepath"];
$access_token = $_POST["access_token"];
$userDao = new UserDao();
$attachmentDao = new AttachmentDao();
$sessionController = new SessionController();
$user_row = $userDao->getByQQOpenid($openid);
// 用户第一次登陆
if (empty($user_row)) {
    $userId = $userDao->addQQUser($openid, $nickname, $gender);
    if (!$userId) {
        db_error("储存QQ用户信息失败!");
    }
    $attachmentId = $attachmentDao->addSimple($filepath);
    if (!$attachmentId) {
        db_error("存储图片附件失败!");
    }
    if (!$userDao->addPhoto($userId, $attachmentId)) {
        db_error("存储用户头像失败!");
    }
<?php

include_once $_SERVER['DOCUMENT_ROOT'] . '/casarover/application/models/AttachmentDao.php';
include_once 'WechatArticle.php';
include_once 'WechatArticleDao.php';
$waDao = new WechatArticleDao();
$aDao = new AttachmentDao();
$a_id = $_POST['attachment_id'];
$wa_id = $_POST['id'];
$type = $_POST['type'];
$series = $_POST['series'];
if (empty($series)) {
    $series = 0;
}
$filepath = $_GET['filepath'];
$wa = new WechatArticle($wa_id, $a_id, $_POST['title'], $_POST['brief'], $_POST['address'], $type, $series, $_POST['deleted']);
$update_attachemnt = false;
if ($a_id) {
    $attachment_row = $aDao->getById($a_id);
    if ($attachment_row['filepath'] != $filepath) {
        // 更新了图片
        $update_attachemnt = true;
    }
} else {
    // 无图片
    $update_attachemnt = true;
}
if ($update_attachemnt) {
    $a_id = $aDao->addSimple($filepath);
    if (!$a_id) {
        echo '数据库添加图片失败!' . '</br>' . mysql_error();
Example #4
0
    <script src="http://cdn.bootcss.com/html5shiv/3.7.2/html5shiv.min.js"></script>
    <script src="http://cdn.bootcss.com/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
    <script src="//cdn.bootcss.com/jquery/2.1.1/jquery.min.js"></script>
    <script src="../assets/js/integration/jquery.flexslider-min.js" type="text/javascript"></script>
    <script src="../assets/js/home.js" type="text/javascript"></script>
    <script src="../assets/js/vue.js" type="text/javascript"></script>
    <script src="../assets/js/casaseries.js" type="text/javascript"></script>
</head>
<body>
<?php 
include_once $_SERVER['DOCUMENT_ROOT'] . '/casarover/application/models/AttachmentDao.php';
include_once 'WechatArticle.php';
include_once 'WechatArticleDao.php';
$waDao = new WechatArticleDao();
$aDao = new AttachmentDao();
$type = $_GET['type'];
$series = $_GET['series'];
if (empty($type)) {
    // Default display list is 民宿风采
    $type = 2;
}
if (empty($series)) {
    // Now just "探庐系列 " has submenu.
    if ($type == 1) {
        $series = 1;
    } else {
        $series = 0;
    }
}
$article_rows = $waDao->getByType($type, $series);
include_once $_SERVER['DOCUMENT_ROOT'] . '/casarover/application/common/common_tools.php';
include_once $_SERVER['DOCUMENT_ROOT'] . '/casarover/application/models/TagDao.php';
include_once $_SERVER['DOCUMENT_ROOT'] . '/casarover/application/models/CasaTagDao.php';
include_once $_SERVER['DOCUMENT_ROOT'] . '/casarover/application/models/CasaDao.php';
include_once $_SERVER['DOCUMENT_ROOT'] . '/casarover/application/models/CasaTagDao.php';
include_once $_SERVER['DOCUMENT_ROOT'] . '/casarover/application/models/AttachmentDao.php';
include_once $_SERVER['DOCUMENT_ROOT'] . '/casarover/application/models/AreaDao.php';
include_once $_SERVER['DOCUMENT_ROOT'] . '/casarover/application/models/ContentDao.php';
include_once $_SERVER['DOCUMENT_ROOT'] . '/casarover/application/models/ContentAttachmentDao.php';
include_once $_SERVER['DOCUMENT_ROOT'] . '/casarover/application/services/CasaService.php';
include_once $_SERVER['DOCUMENT_ROOT'] . '/casarover/application/services/ContentService.php';
$casa_JSON_str = remove_slash($_REQUEST['casa_JSON_str']);
$casa = json_decode($casa_JSON_str);
$casaDao = new CasaDao();
$areaDao = new AreaDao();
$attachmentDao = new AttachmentDao();
$tagDao = new TagDao();
$casaTagDao = new CasaTagDao();
$contentDao = new ContentDao();
$contentAttachmentDao = new ContentAttachmentDao();
$casaService = new CasaService();
$contentService = new ContentService();
mysql_query('START TRANSACTION') or die(mysql_error());
$mode = 'edit';
if (empty($casa->id)) {
    $mode = 'add';
}
/** 1.添加基础民宿 */
if (!empty($casa->name) && !empty($casa->code) && !empty($casa->area)) {
    $casa_id = $casaDao->addOrUpdateSimple($casa->name, $casa->code, $casa->link, $casa->area, $casa->id);
    if (!$casa_id) {