コード例 #1
0
ファイル: apms.lib.php プロジェクト: peb317/gbamn
function apms_add_tag($it_id, $it_tag, $it_time, $bo_table = '', $wr_id = '')
{
    global $g5;
    $arr = array();
    // 기존 태그 삭제
    apms_delete_tag($it_id, $bo_table, $wr_id);
    //카운팅이 0 또는 음수인 태그 삭제
    sql_query("delete from {$g5['apms_tag']} where cnt <= '0'");
    //태그정리
    $it_tag = apms_check_tag($it_tag);
    if (!$it_tag) {
        return;
    }
    //태그등록
    $tags = explode(',', $it_tag);
    foreach ($tags as $tag) {
        $row = sql_fetch("select id from {$g5['apms_tag']} where tag = '{$tag}' ");
        if ($row['id']) {
            $tag_id = $row['id'];
            sql_query("update {$g5['apms_tag']} set cnt = cnt + 1, lastdate='" . G5_TIME_YMDHIS . "' where id='{$tag_id}'");
        } else {
            //색인 만들기
            list($type, $idx) = apms_chosung($tag);
            sql_query("insert into {$g5['apms_tag']} set type = '{$type}', idx = '{$idx}', tag='" . addslashes($tag) . "', cnt=1, regdate='" . G5_TIME_YMDHIS . "', lastdate='" . G5_TIME_YMDHIS . "'");
            $tag_id = sql_insert_id();
        }
        sql_query("insert into {$g5['apms_tag_log']} set it_id = '{$it_id}', bo_table = '{$bo_table}', wr_id = '{$wr_id}', tag_id = '{$tag_id}', tag = '" . addslashes($tag) . "', regdate = '" . G5_TIME_YMDHIS . "', it_time = '{$it_time}'");
    }
}
コード例 #2
0
ファイル: itemlistupdate.php プロジェクト: peb317/gbamn
 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);
 }