Exemple #1
0
$isExternalTransaction = true;
// reset $_FILES
$_FILES = $files = null;
// adjust value
$post['title'] = addslashes($post['title']);
$post['content'] = addslashes($post['content']);
// update db
$dbUpdateResult = (require_once __DIR__ . '/../' . $this->set['skin'] . '/transaction_' . $method . '.php');
// include func
require_once 'func.php';
// move data file_tmp to file
if ($dbUpdateResult['state'] == 'success') {
    // set article_srl
    $article_srl = (int) $post['article_srl'];
    // get article json
    $article_json = getArticleJSON($article_srl);
    $new_article_json = $article_json;
    // move file_tmp to file data
    $thumnail_srl = fileUpload($post, $article_srl, $article_json['thumnail']['srl']);
    // upload thumnail image
    if ($post['thumnail_image']) {
        // load file module
        if (file_exists(__GOOSE_PWD__ . $article_json['thumnail']['url'])) {
            unlink(__GOOSE_PWD__ . $article_json['thumnail']['url']);
        }
        // upload
        $thumnailUrl = uploadThumnail($_POST['thumnail_image']);
        // set json
        $new_article_json['thumnail']['srl'] = $thumnail_srl;
        $new_article_json['thumnail']['url'] = $thumnailUrl;
        $thumnailUploaded = true;
Exemple #2
0
<?php

if (!defined('__GOOSE__')) {
    exit;
}
// include func
require_once 'func.php';
// set json
$article_json = getArticleJSON($post['article_srl']);
// update db
$dbUpdateResult = (require_once __DIR__ . '/../' . $this->set['skin'] . '/transaction_' . $method . '.php');
// remove attach files
if ($dbUpdateResult['state'] == 'success') {
    // remove thumnail image
    if ($article_json['thumnail']['url'] and file_exists(__GOOSE_PWD__ . $article_json['thumnail']['url'])) {
        unlink(__GOOSE_PWD__ . $article_json['thumnail']['url']);
    }
}
// return
return $dbUpdateResult;