Exemple #1
0
 if ($w == "d") {
     if (!$is_admin) {
         $sql = " select count(*) as cnt from {$g5['g5_shop_item_use_table']} where mb_id = '{$member['mb_id']}' and is_id = '{$is_id}' ";
         $row = sql_fetch($sql);
         if (!$row['cnt']) {
             if ($move) {
                 alert("자신의 글만 삭제하실 수 있습니다.");
             } else {
                 apms_alert("1|자신의 글만 삭제하실 수 있습니다.");
             }
         }
     }
     // 에디터로 첨부된 이미지 삭제
     $sql = " select is_content from {$g5['g5_shop_item_use_table']} where is_id = '{$is_id}' and md5(concat(is_id,is_time,is_ip)) = '{$hash}' ";
     $row = sql_fetch($sql);
     $imgs = get_editor_image($row['is_content']);
     for ($i = 0; $i < count($imgs[1]); $i++) {
         $p = parse_url($imgs[1][$i]);
         if (strpos($p['path'], "/data/") != 0) {
             $data_path = preg_replace("/^\\/.*\\/data/", "/data", $p['path']);
         } else {
             $data_path = $p['path'];
         }
         $destfile = G5_PATH . $data_path;
         if (is_file($destfile)) {
             @unlink($destfile);
         }
     }
     $sql = " delete from {$g5['g5_shop_item_use_table']} where is_id = '{$is_id}' and md5(concat(is_id,is_time,is_ip)) = '{$hash}' ";
     sql_query($sql);
     //$alert_msg = "0|삭제 하셨습니다.";
function get_view_thumbnail($contents, $thumb_width = 0)
{
    global $board, $config;
    if (!$thumb_width) {
        $thumb_width = $board['bo_image_width'];
    }
    // $contents 중 img 태그 추출
    $matches = get_editor_image($contents, true);
    if (empty($matches)) {
        return $contents;
    }
    for ($i = 0; $i < count($matches[1]); $i++) {
        $img = $matches[1][$i];
        preg_match("/src=[\\'\"]?([^>\\'\"]+[^>\\'\"]+)/i", $img, $m);
        $src = $m[1];
        preg_match("/style=[\"\\']?([^\"\\'>]+)/i", $img, $m);
        $style = $m[1];
        preg_match("/width:\\s*(\\d+)px/", $style, $m);
        $width = $m[1];
        preg_match("/height:\\s*(\\d+)px/", $style, $m);
        $height = $m[1];
        preg_match("/alt=[\"\\']?([^\"\\']*)[\"\\']?/", $img, $m);
        $alt = get_text($m[1]);
        // 이미지 path 구함
        $p = parse_url($src);
        if (strpos($p['path'], '/' . G5_DATA_DIR . '/') != 0) {
            $data_path = preg_replace('/^\\/.*\\/' . G5_DATA_DIR . '/', '/' . G5_DATA_DIR, $p['path']);
        } else {
            $data_path = $p['path'];
        }
        $srcfile = G5_PATH . $data_path;
        if (is_file($srcfile)) {
            $size = @getimagesize($srcfile);
            if (empty($size)) {
                continue;
            }
            // jpg 이면 exif 체크
            if ($size[2] == 2 && function_exists('exif_read_data')) {
                $degree = 0;
                $exif = @exif_read_data($srcfile);
                if (!empty($exif['Orientation'])) {
                    switch ($exif['Orientation']) {
                        case 8:
                            $degree = 90;
                            break;
                        case 3:
                            $degree = 180;
                            break;
                        case 6:
                            $degree = -90;
                            break;
                    }
                    // 세로사진의 경우 가로, 세로 값 바꿈
                    if ($degree == 90 || $degree == -90) {
                        $tmp = $size;
                        $size[0] = $tmp[1];
                        $size[1] = $tmp[0];
                    }
                }
            }
            // 원본 width가 thumb_width보다 작다면
            if ($size[0] <= $thumb_width) {
                continue;
            }
            // Animated GIF 체크
            $is_animated = false;
            if ($size[2] == 1) {
                $is_animated = is_animated_gif($srcfile);
            }
            // 썸네일 높이
            $thumb_height = round($thumb_width * $size[1] / $size[0]);
            $filename = basename($srcfile);
            $filepath = dirname($srcfile);
            // 썸네일 생성
            if (!$is_animated) {
                $thumb_file = thumbnail($filename, $filepath, $filepath, $thumb_width, $thumb_height, false);
            } else {
                $thumb_file = $filename;
            }
            if (!$thumb_file) {
                continue;
            }
            if ($width) {
                $thumb_tag = '<img src="' . G5_URL . str_replace($filename, $thumb_file, $data_path) . '" alt="' . $alt . '" width="' . $width . '" height="' . $height . '"/>';
            } else {
                $thumb_tag = '<img src="' . G5_URL . str_replace($filename, $thumb_file, $data_path) . '" alt="' . $alt . '"/>';
            }
            // $img_tag에 editor 경로가 있으면 원본보기 링크 추가
            $img_tag = $matches[0][$i];
            if (strpos($img_tag, G5_DATA_DIR . '/' . G5_EDITOR_DIR) && preg_match("/\\.({$config['cf_image_extension']})\$/i", $filename)) {
                $imgurl = str_replace(G5_URL, "", $src);
                $thumb_tag = '<a href="' . G5_BBS_URL . '/view_image.php?fn=' . urlencode($imgurl) . '" target="_blank" class="view_image">' . $thumb_tag . '</a>';
            }
            $contents = str_replace($img_tag, $thumb_tag, $contents);
        }
    }
    return $contents;
}
Exemple #3
0
 $sql = " select iq_question, iq_answer from {$g5['g5_shop_item_qa_table']} where iq_id = '{$iq_id}' and md5(concat(iq_id,iq_time,iq_ip)) = '{$hash}' ";
 $row = sql_fetch($sql);
 $imgs = get_editor_image($row['iq_question']);
 for ($i = 0; $i < count($imgs[1]); $i++) {
     $p = parse_url($imgs[1][$i]);
     if (strpos($p['path'], "/data/") != 0) {
         $data_path = preg_replace("/^\\/.*\\/data/", "/data", $p['path']);
     } else {
         $data_path = $p['path'];
     }
     $destfile = G5_PATH . $data_path;
     if (is_file($destfile)) {
         @unlink($destfile);
     }
 }
 $imgs = get_editor_image($row['iq_answer']);
 for ($i = 0; $i < count($imgs[1]); $i++) {
     $p = parse_url($imgs[1][$i]);
     if (strpos($p['path'], "/data/") != 0) {
         $data_path = preg_replace("/^\\/.*\\/data/", "/data", $p['path']);
     } else {
         $data_path = $p['path'];
     }
     $destfile = G5_PATH . $data_path;
     if (is_file($destfile)) {
         @unlink($destfile);
     }
 }
 $sql = " delete from {$g5['g5_shop_item_qa_table']} where iq_id = '{$iq_id}' and md5(concat(iq_id,iq_time,iq_ip)) = '{$hash}' ";
 sql_query($sql);
 //$alert_msg = '0|삭제 하셨습니다.';
Exemple #4
0
function apms_editor_image($content, $mode = '')
{
    if (!$content) {
        return;
    }
    if ($mode == 'move') {
        return $content;
    }
    // 이동은 처리하지 않음
    $imgs = get_editor_image($content, false);
    for ($i = 0; $i < count($imgs[1]); $i++) {
        // 이미지 path 구함
        $imgurl = @parse_url($imgs[1][$i]);
        $destfile = $_SERVER['DOCUMENT_ROOT'] . $imgurl['path'];
        if (is_file($destfile)) {
            if ($mode == 'copy') {
                //다른이름으로 복사
                $ym = date('ym', G5_SERVER_TIME);
                $data_dir = G5_DATA_PATH . '/editor/' . $ym;
                $data_url = G5_DATA_URL . '/editor/' . $ym;
                if (!is_dir($data_dir)) {
                    @mkdir($data_dir, G5_DIR_PERMISSION);
                    @chmod($data_dir, G5_DIR_PERMISSION);
                }
                $filename = basename($destfile);
                $chars_array = array_merge(range(0, 9), range('a', 'z'), range('A', 'Z'));
                shuffle($chars_array);
                $shuffle = implode('', $chars_array);
                $file_name = abs(ip2long($_SERVER['REMOTE_ADDR'])) . '_' . substr($shuffle, 0, 8) . '_' . replace_filename($filename);
                $save_file = sprintf('%s/%s', $data_dir, $file_name);
                $save_url = sprintf('%s/%s', $data_url, $file_name);
                @copy($destfile, $save_file);
                @chmod($save_file, G5_FILE_PERMISSION);
                $content = str_replace($imgs[1][$i], $save_url, $content);
            } else {
                //이미지 삭제
                @chmod($destfile, G5_FILE_PERMISSION);
                @unlink($destfile);
            }
        }
    }
    return $mode == 'copy' ? $content : '';
}
Exemple #5
0
function get_itemuselist_thumbnail($it_id, $contents, $thumb_width, $thumb_height, $is_create = false, $is_crop = true, $crop_mode = 'center', $is_sharpen = true, $um_value = '80/0.5/3')
{
    global $g5, $config;
    $img = $filename = $alt = "";
    if ($contents) {
        $matches = get_editor_image($contents, false);
        for ($i = 0; $i < count($matches[1]); $i++) {
            // 이미지 path 구함
            $p = parse_url($matches[1][$i]);
            if (strpos($p['path'], '/' . G5_DATA_DIR . '/') != 0) {
                $data_path = preg_replace('/^\\/.*\\/' . G5_DATA_DIR . '/', '/' . G5_DATA_DIR, $p['path']);
            } else {
                $data_path = $p['path'];
            }
            $srcfile = G5_PATH . $data_path;
            if (preg_match("/\\.({$config['cf_image_extension']})\$/i", $srcfile) && is_file($srcfile)) {
                $size = @getimagesize($srcfile);
                if (empty($size)) {
                    continue;
                }
                $filename = basename($srcfile);
                $filepath = dirname($srcfile);
                preg_match("/alt=[\"\\']?([^\"\\']*)[\"\\']?/", $matches[0][$i], $malt);
                $alt = get_text($malt[1]);
                break;
            }
        }
        if ($filename) {
            $thumb = thumbnail($filename, $filepath, $filepath, $thumb_width, $thumb_height, $is_create, $is_crop, $crop_mode, $is_sharpen, $um_value);
            if ($thumb) {
                $src = G5_URL . str_replace($filename, $thumb, $data_path);
                $img = '<img src="' . $src . '" width="' . $thumb_width . '" height="' . $thumb_height . '" alt="' . $alt . '">';
            }
        }
    }
    if (!$img) {
        $img = get_it_image($it_id, $thumb_width, $thumb_height);
    }
    return $img;
}
Exemple #6
0
        } else {
            $src_path = $p['path'];
        }
        $srcfile = G5_PATH . $src_path;
        $dstfile = preg_replace("/\\.([^\\.]+)\$/", "_" . $new_it_id . ".\\1", $srcfile);
        if (is_file($srcfile)) {
            copy($srcfile, $dstfile);
            $newfile = preg_replace("/\\.([^\\.]+)\$/", "_" . $new_it_id . ".\\1", $matchs[1][$i]);
            $cp['it_explan'] = str_replace($matchs[1][$i], $newfile, $cp['it_explan']);
        }
    }
    $sql = " update {$g5['g5_shop_item_table']} set it_explan = '" . addslashes($cp['it_explan']) . "' where it_id = '{$new_it_id}' ";
    sql_query($sql);
}
if ($cp['it_mobile_explan']) {
    $matchs = get_editor_image($cp['it_mobile_explan'], false);
    // 파일의 경로를 얻어 복사
    for ($i = 0; $i < count($matchs[1]); $i++) {
        $p = parse_url($matchs[1][$i]);
        if (strpos($p['path'], "/data/") != 0) {
            $src_path = preg_replace("/^\\/.*\\/data/", "/data", $p['path']);
        } else {
            $src_path = $p['path'];
        }
        $srcfile = G5_PATH . $src_path;
        $dstfile = preg_replace("/\\.([^\\.]+)\$/", "_" . $new_it_id . ".\\1", $srcfile);
        if (is_file($srcfile)) {
            copy($srcfile, $dstfile);
            $newfile = preg_replace("/\\.([^\\.]+)\$/", "_" . $new_it_id . ".\\1", $matchs[1][$i]);
            $cp['it_mobile_explan'] = str_replace($matchs[1][$i], $newfile, $cp['it_mobile_explan']);
        }
    $respond['wr_mb_id'] = $wr['mb_id'];
    if ($_POST['anonymous'] == 'y') {
        $anonymous = true;
    }
    $eb->respond($respond);
}
// 업로드된 파일 정보 가져오기
$result = sql_query(" select * from {$g5['board_file_table']} where bo_table = '{$bo_table}' and wr_id = '{$wr_id}' ");
for ($i = 0; $row = sql_fetch_array($result); $i++) {
    if (!preg_match("/.(gif|jpg|jpeg|png)\$/i", $row['bf_file'])) {
        continue;
    }
    $wr_image['bf'][$i] = "/data/file/{$bo_table}/" . $row['bf_file'];
}
// 내용중의 링크 이미지 정보 가져오기
$matches = get_editor_image(stripslashes($wr_content), false);
if ($matches[1]) {
    foreach ($matches[1] as $k => $image) {
        $p = parse_url($image);
        $host = preg_replace("/www\\./i", "", $p['host']);
        $_host = preg_replace("/www\\./i", "", $_SERVER['HTTP_HOST']);
        $ex_url = '';
        if ($host != $_host) {
            $ex_url = "http://" . $host;
        }
        $wr_image['url'][$k] = $ex_url . $p['path'];
    }
}
if ($wr_image) {
    $wr_image = serialize($wr_image);
}
Exemple #8
0
function delete_editor_thumbnail($contents)
{
    if (!$contents) {
        return;
    }
    // $contents 중 img 태그 추출
    $matchs = get_editor_image($contents);
    if (!$matchs) {
        return;
    }
    for ($i = 0; $i < count($matchs[1]); $i++) {
        // 이미지 path 구함
        $imgurl = parse_url($matchs[1][$i]);
        $srcfile = $_SERVER['DOCUMENT_ROOT'] . $imgurl['path'];
        $filename = preg_replace("/\\.[^\\.]+\$/i", "", basename($srcfile));
        $filepath = dirname($srcfile);
        $files = glob($filepath . '/thumb-' . $filename . '*');
        if (is_array($files)) {
            foreach ($files as $filename) {
                unlink($filename);
            }
        }
    }
}
Exemple #9
0
function apms_it_write_thumbnail($it_id, $wr_content, $thumb_width, $thumb_height, $is_create = false, $is_crop = true, $crop_mode = 'center', $is_sharpen = true, $um_value = '80/0.5/3')
{
    global $g5, $config;
    $filename = $alt = "";
    $matches = get_editor_image($wr_content, false);
    $limg = array();
    $lalt = array();
    for ($i = 0; $i < count($matches[1]); $i++) {
        // 이미지 path 구함
        $p = @parse_url($matches[1][$i]);
        if (strpos($p['path'], '/' . G5_DATA_DIR . '/') != 0) {
            $data_path = preg_replace('/^\\/.*\\/' . G5_DATA_DIR . '/', '/' . G5_DATA_DIR, $p['path']);
        } else {
            $data_path = $p['path'];
        }
        $srcfile = G5_PATH . $data_path;
        //if(preg_match("/\.({$config['cf_image_extension']})$/i", $srcfile)) {
        if (is_file($srcfile)) {
            $size = @getimagesize($srcfile);
            if (empty($size)) {
                continue;
            }
            $fileurl = $matches[1][$i];
            preg_match("/alt=[\"\\']?([^\"\\']*)[\"\\']?/", $matches[0][$i], $malt);
            $alt = get_text($malt[1]);
            break;
        } else {
            $limg[] = $matches[1][$i];
            preg_match("/alt=[\"\\']?([^\"\\']*)[\"\\']?/", $matches[0][$i], $malt);
            $lalt[] = get_text($malt[1]);
        }
        //}
    }
    if (!$filename) {
        //본문동영상 이미지 체크
        if (preg_match_all("/{동영상\\:([^}]*)}/is", $wr_content, $match)) {
            $match_cnt = count($match[1]);
            for ($i = 0; $i < $match_cnt; $i++) {
                $video = apms_video_info(trim(strip_tags($match[1][$i])));
                if (!$video['type']) {
                    continue;
                }
                $srcfile = apms_video_img($video['video_url'], $video['vid'], $video['type']);
                if (!$srcfile || $srcfile == 'none') {
                    continue;
                }
                $size = @getimagesize($srcfile);
                if (empty($size)) {
                    continue;
                }
                $fileurl = str_replace(G5_PATH, G5_URL, $srcfile);
                break;
            }
        }
    }
    if (!$filename) {
        //기타
        //링크
        if (count($limg) > 0) {
            $thumb = array('is_thumb' => false, 'src' => $limg[0], 'alt' => $lalt[0], 'org' => $limg[0], 'height' => '');
            return $thumb;
        }
        //상품
        $edt = false;
        $it = apms_it($it_id);
        $thumb = apms_it_thumbnail($it, $thumb_width, $thumb_height, $is_create, $is_crop, $crop_mode, $is_sharpen, $um_value);
        if (!$thumb['src']) {
            $thumb = array('is_thumb' => false, 'src' => '', 'alt' => '', 'org' => '', 'height' => '');
        }
        return $thumb;
    }
    $thumb = apms_thumbnail($fileurl, $thumb_width, $thumb_height, $is_create, $is_crop, $crop_mode, $is_sharpen, $um_value);
    $thumb['is_thumb'] = true;
    $thumb['alt'] = $alt;
    $thumb['org'] = $fileurl;
    return $thumb;
}
Exemple #10
0
function get_view_thumbnail($contents, $thumb_width = 0)
{
    global $board, $config;
    if (!$thumb_width) {
        $thumb_width = $board['bo_image_width'];
    }
    // $contents 중 img 태그 추출
    $matches = get_editor_image($contents, true);
    if (empty($matches)) {
        return $contents;
    }
    // Exif
    $exif = array();
    $is_exif = isset($board['as_exif']) && $board['as_exif'] ? true : false;
    // Lightbox
    $is_lightbox = false;
    if (isset($board['as_lightbox']) && $board['as_lightbox']) {
        $is_lightbox = true;
        apms_script('lightbox');
    }
    for ($i = 0; $i < count($matches[1]); $i++) {
        $img_tag = $matches[0][$i];
        $img = $matches[1][$i];
        preg_match("/src=[\\'\"]?([^>\\'\"]+[^>\\'\"]+)/i", $img, $m);
        $src = $m[1];
        preg_match("/style=[\"\\']?([^\"\\'>]+)/i", $img, $m);
        $style = $m[1];
        preg_match("/width:\\s*(\\d+)px/", $style, $m);
        $width = $m[1];
        preg_match("/height:\\s*(\\d+)px/", $style, $m);
        $height = $m[1];
        preg_match("/alt=[\"\\']?([^\"\\']*)[\"\\']?/", $img, $m);
        $alt = get_text($m[1]);
        preg_match("/link=[\"\\']?([^\"\\']*)[\"\\']?/", $img, $m);
        // APMS 추가
        $link = get_text($m[1]);
        preg_match("/align=[\"\\']?([^\"\\']*)[\"\\']?/", $img, $m);
        // APMS 추가
        $align = get_text($m[1]);
        $align = $align ? ' align="' . $align . '" ' : '';
        preg_match("/class=[\"\\']?([^\"\\']*)[\"\\']?/", $img, $m);
        // APMS 추가
        $class = get_text($m[1]);
        $class = $class ? ' ' . $align : '';
        // 이미지 path 구함
        $p = @parse_url($src);
        if (strpos($p['path'], '/' . G5_DATA_DIR . '/') != 0) {
            $data_path = preg_replace('/^\\/.*\\/' . G5_DATA_DIR . '/', '/' . G5_DATA_DIR, $p['path']);
        } else {
            $data_path = $p['path'];
        }
        $srcfile = G5_PATH . $data_path;
        $itemprop = $i == 0 ? ' itemprop="image" content="' . $src . '"' : '';
        if (is_file($srcfile)) {
            $size = @getimagesize($srcfile);
            if (empty($size)) {
                continue;
            }
            // jpg 이면 exif 체크
            if ($size[2] == 2 && function_exists('exif_read_data')) {
                $degree = 0;
                $exif = @exif_read_data($srcfile);
                if (!empty($exif['Orientation'])) {
                    switch ($exif['Orientation']) {
                        case 8:
                            $degree = 90;
                            break;
                        case 3:
                            $degree = 180;
                            break;
                        case 6:
                            $degree = -90;
                            break;
                    }
                    // 세로사진의 경우 가로, 세로 값 바꿈
                    if ($degree == 90 || $degree == -90) {
                        $tmp = $size;
                        $size[0] = $tmp[1];
                        $size[1] = $tmp[0];
                    }
                }
            }
            // 원본 width가 thumb_width보다 작다면 썸네일생성 안함
            if ($size[0] <= $thumb_width) {
                if ($width) {
                    $thumb_tag = '<img' . $itemprop . ' src="' . $src . '" alt="' . $alt . '" width="' . $width . '" height="' . $height . '"' . $align . ' class="img-tag' . $class . '"/>';
                } else {
                    $thumb_tag = '<img' . $itemprop . ' src="' . $src . '" alt="' . $alt . '"' . $align . ' class="img-tag' . $class . '"/>';
                }
                // $img_tag에 editor 경로가 있으면 원본보기 링크 추가
                if (!$link && (strpos($img_tag, G5_DATA_DIR . '/' . G5_EDITOR_DIR) || strpos($img_tag, G5_DATA_DIR . '/file')) && preg_match("/\\.({$config['cf_image_extension']})\$/i", basename($srcfile))) {
                    if ($is_lightbox) {
                        $caption = $alt ? ' data-title="' . $alt . '"' : '';
                        $thumb_tag = '<a href="' . $src . '" data-lightbox="view-lightbox"' . $caption . ' target="_blank">' . $thumb_tag . '</a>';
                    } else {
                        $thumb_tag = '<a href="' . G5_BBS_URL . '/view_image.php?fn=' . urlencode(str_replace(G5_URL, "", $src)) . '" target="_blank" class="view_image">' . $thumb_tag . '</a>';
                    }
                }
                // Exif 정보출력
                if ($is_exif) {
                    $img_exif = apms_get_view_exif($exif);
                    if ($img_exif) {
                        $thumb_tag = '<div class="img-exif">' . PHP_EOL . $thumb_tag . PHP_EOL . '<div class="exif-data">' . PHP_EOL . '<ul>' . PHP_EOL . $img_exif . PHP_EOL . '</ul>' . PHP_EOL . '</div>' . PHP_EOL . '</div>' . PHP_EOL;
                    }
                }
                $contents = str_replace($img_tag, $thumb_tag, $contents);
                unset($exif);
                continue;
            }
            // Animated GIF 체크
            $is_animated = false;
            if ($size[2] == 1) {
                $is_animated = is_animated_gif($srcfile);
            }
            // 썸네일 높이
            $thumb_height = round($thumb_width * $size[1] / $size[0]);
            $filename = basename($srcfile);
            $filepath = dirname($srcfile);
            // 썸네일 생성
            if (!$is_animated) {
                $thumb_file = thumbnail($filename, $filepath, $filepath, $thumb_width, $thumb_height, false);
            } else {
                $thumb_file = $filename;
            }
            if (!$thumb_file) {
                continue;
            }
            if ($width) {
                $thumb_tag = '<img' . $itemprop . ' src="' . G5_URL . str_replace($filename, $thumb_file, $data_path) . '" alt="' . $alt . '" width="' . $width . '" height="' . $height . '"' . $align . ' class="img-tag' . $class . '"/>';
            } else {
                $thumb_tag = '<img' . $itemprop . ' src="' . G5_URL . str_replace($filename, $thumb_file, $data_path) . '" alt="' . $alt . '"' . $align . ' class="img-tag' . $class . '"/>';
            }
            // $img_tag에 editor 경로가 있으면 원본보기 링크 추가
            if (!$link && preg_match("/\\.({$config['cf_image_extension']})\$/i", $filename)) {
                if ($is_lightbox) {
                    $caption = $alt ? ' data-title="' . $alt . '"' : '';
                    $thumb_tag = '<a href="' . $src . '" data-lightbox="view-lightbox"' . $caption . ' target="_blank">' . $thumb_tag . '</a>';
                } else {
                    if (strpos($img_tag, G5_DATA_DIR . '/' . G5_EDITOR_DIR) || strpos($img_tag, G5_DATA_DIR . '/file')) {
                        $thumb_tag = '<a href="' . G5_BBS_URL . '/view_image.php?fn=' . urlencode(str_replace(G5_URL, "", $src)) . '" target="_blank" class="view_image">' . $thumb_tag . '</a>';
                    } else {
                        $thumb_tag = '<a href="' . G5_BBS_URL . '/view_img.php?img=' . urlencode($src) . '" target="_blank" class="view_image">' . $thumb_tag . '</a>';
                    }
                }
            }
            // Exif 정보출력
            if ($is_exif) {
                $img_exif = apms_get_view_exif($exif);
                if ($img_exif) {
                    $thumb_tag = '<div class="img-exif">' . PHP_EOL . $thumb_tag . PHP_EOL . '<div class="exif-data">' . PHP_EOL . '<ul>' . PHP_EOL . $img_exif . PHP_EOL . '</ul>' . PHP_EOL . '</div>' . PHP_EOL . '</div>' . PHP_EOL;
                }
            }
            $contents = str_replace($img_tag, $thumb_tag, $contents);
            unset($exif);
        } else {
            if (preg_match("/\\.({$config['cf_image_extension']})\$/i", basename($src))) {
                $thumb_tag = '<img' . $itemprop . ' src="' . $src . '" alt="' . $alt . '"' . $align . ' class="img-tag' . $class . '"/>';
                if (!$link) {
                    if ($is_lightbox) {
                        $caption = $alt ? ' data-title="' . $alt . '"' : '';
                        $thumb_tag = '<a href="' . $src . '" data-lightbox="view-lightbox"' . $caption . ' target="_blank">' . $thumb_tag . '</a>';
                    } else {
                        $thumb_tag = '<a href="' . G5_BBS_URL . '/view_img.php?img=' . urlencode($src) . '" target="_blank" class="view_image">' . $thumb_tag . '</a>';
                    }
                }
                $contents = str_replace($img_tag, $thumb_tag, $contents);
            }
        }
    }
    return $contents;
}
Exemple #11
0
 function myshop_item_delete($it_id)
 {
     global $g5, $is_auth;
     //거래내역이 있으면 그냥 통과
     if (!$is_auth) {
         $ct = sql_fetch(" select it_id from {$g5['g5_shop_cart_table']} where it_id = '{$it_id}' and od_id <> '' and ct_status != '쇼핑' ");
         if ($ct['it_id']) {
             return;
         }
     }
     //삭제시작
     $sql = " select it_explan, it_mobile_explan, it_img1, it_img2, it_img3, it_img4, it_img5, it_img6, it_img7, it_img8, it_img9, it_img10\n\t\t\t\t\tfrom {$g5['g5_shop_item_table']} where it_id = '{$it_id}' ";
     $it = sql_fetch($sql);
     // 상품 이미지 삭제
     $dir_list = array();
     for ($i = 1; $i <= 10; $i++) {
         $file = G5_DATA_PATH . '/item/' . $it['it_img' . $i];
         if (is_file($file) && $it['it_img' . $i]) {
             @unlink($file);
             $dir = dirname($file);
             delete_item_thumbnail($dir, basename($file));
             if (!in_array($dir, $dir_list)) {
                 $dir_list[] = $dir;
             }
         }
     }
     // 이미지디렉토리 삭제
     //for($i=0; $i<count($dir_list); $i++) {
     //    if(is_dir($dir_list[$i]))
     //        rmdir($dir_list[$i]);
     //}
     // 상, 하단 이미지 삭제
     @unlink(G5_DATA_PATH . "/item/{$it_id}" . "_h");
     @unlink(G5_DATA_PATH . "/item/{$it_id}" . "_t");
     // 장바구니 삭제
     sql_query(" delete from {$g5['g5_shop_cart_table']} where it_id = '{$it_id}' and ct_status = '쇼핑' ");
     // 이벤트삭제
     sql_query(" delete from {$g5['g5_shop_event_item_table']} where it_id = '{$it_id}' ");
     // 사용후기삭제
     sql_query(" delete from {$g5['g5_shop_item_use_table']} where it_id = '{$it_id}' ");
     // 상품문의삭제
     sql_query(" delete from {$g5['g5_shop_item_qa_table']} where it_id = '{$it_id}' ");
     // 관련상품삭제
     sql_query(" delete from {$g5['g5_shop_item_relation_table']} where it_id = '{$it_id}' or it_id2 = '{$it_id}' ");
     // 옵션삭제
     sql_query(" delete from {$g5['g5_shop_item_option_table']} where it_id = '{$it_id}' ");
     //------------------------------------------------------------------------
     // HTML 내용에서 에디터에 올라간 이미지의 경로를 얻어 삭제함
     //------------------------------------------------------------------------
     $imgs = get_editor_image($it['it_explan'], false);
     for ($i = 0; $i < count($imgs[1]); $i++) {
         $p = parse_url($imgs[1][$i]);
         if (strpos($p['path'], "/data/") != 0) {
             $data_path = preg_replace("/^\\/.*\\/data/", "/data", $p['path']);
         } else {
             $data_path = $p['path'];
         }
         $destfile = G5_PATH . $data_path;
         if (is_file($destfile)) {
             @unlink($destfile);
         }
     }
     $imgs = get_editor_image($it['it_mobile_explan'], false);
     for ($i = 0; $i < count($imgs[1]); $i++) {
         $p = parse_url($imgs[1][$i]);
         if (strpos($p['path'], "/data/") != 0) {
             $data_path = preg_replace("/^\\/.*\\/data/", "/data", $p['path']);
         } else {
             $data_path = $p['path'];
         }
         $destfile = G5_PATH . $data_path;
         if (is_file($destfile)) {
             @unlink($destfile);
         }
     }
     //------------------------------------------------------------------------
     // 상품 삭제
     sql_query(" delete from {$g5['g5_shop_item_table']} where it_id = '{$it_id}' ");
     // 댓글삭제
     apms_delete_comment($it_id);
     // 태그삭제
     apms_delete_tag($it_id);
     // 파일삭제
     apms_delete_file('item', $it_id);
     // 폴더삭제
     apms_delete_dir($it_id);
 }
Exemple #12
0
            if (is_file($page_file)) {
                include_once $page_file;
            } else {
                echo '<br><br><p align="center">준비중 입니다.</p><br><br>';
            }
        } else {
            echo '<br><br><p align="center">존재하지 않는 페이지입니다.</p><br><br>';
        }
    }
    $page_content = ob_get_contents();
    ob_end_clean();
    $page_content = str_replace("./", $page_url . "/", $page_content);
}
// SEO
$seo_page_desc = apms_cut_text($page_content, 200);
$matches = get_editor_image($page_content, false);
$seo_page_img = $matches[1][0];
// 페이지스킨
$page_skin = $at['pskin'];
$page_skin_path = G5_SKIN_PATH . '/page/' . $page_skin;
$page_skin_url = G5_SKIN_URL . '/page/' . $page_skin;
include_once './_head.php';
if (G5_IS_MOBILE) {
    echo '<div class="page-wrap font-14">' . PHP_EOL;
} else {
    echo '<div class="page-wrap">' . PHP_EOL;
}
if ($page_skin && is_file($page_skin_path . '/page.skin.php')) {
    include_once $page_skin_path . '/page.skin.php';
} else {
    if ($header_skin) {