function deleteComunity($fnum)
{
    //글을 삭제하기전 하위테이블인 댓글테이블의 해당 글의 댓글 삭제
    deleteReply($fnum);
    //글을 삭제하기전 하위테이블인 첨부파일테이블의 해당 글의 첨부파일 삭제
    deleteAttach($fnum);
    $query = "DELETE FROM freeboard WHERE ";
    $query .= "fnum=" . strval($fnum);
    SQL_CON($query);
}
Пример #2
0
 function delmessage()
 {
     //checkPerm('view');
     $lang =& DoceboLanguage::createInstance('message', 'lms');
     $out = $GLOBALS['page'];
     $out->setWorkingZone('content');
     $um =& UrlManager::getInstance("message");
     $from = importVar('out');
     if (isset($_GET['confirm'])) {
         $re = true;
         $del_query = "\r\n\t\t\tUPDATE %adm_message_user\r\n\t\t\tSET deleted = '" . _OPERATION_SUCCESSFUL . "'\r\n\t\t\tWHERE idUser='******' AND idMessage = '" . (int) $_GET['id_message'] . "'";
         if (!$this->db->query($del_query)) {
             if ($from === 'out') {
                 Util::jump_to($um->getUrl('&active_tab=outbox&result=err'));
             }
             Util::jump_to($um->getUrl('&active_tab=inbox&result=err'));
             //Util::jump_to($um->getUrl(( $from == 'out' ? '&active_tab=outbox' : '').'&result=err'));
         }
         $query = "\r\n\t\t\tSELECT idMessage\r\n\t\t\tFROM %adm_message_user\r\n\t\t\tWHERE idMessage = '" . (int) $_GET['id_message'] . "'";
         if (!$this->db->num_rows($this->db->query($query))) {
             list($attach) = $this->db->fetch_row($this->db->query("\r\n\t\t\t\tSELECT attach\r\n\t\t\t\tFROM %adm_message\r\n\t\t\t\tWHERE idMessage = '" . $_GET['id_message'] . "'"));
             if ($attach != '') {
                 if (!deleteAttach($attach)) {
                     if ($from === 'out') {
                         Util::jump_to($um->getUrl('&active_tab=outbox&result=err'));
                     }
                     Util::jump_to($um->getUrl('&active_tab=inbox&result=err'));
                     //Util::jump_to($um->getUrl(( $from == 'out' ? '&active_tab=outbox' : '').'&result=err'));
                 }
             }
             if (!$this->db->query("\r\n\t\t\t\tDELETE FROM %adm_message_user\r\n\t\t\t\tWHERE idMessage = '" . $_GET['id_message'] . "'")) {
                 if ($from === 'out') {
                     Util::jump_to($um->getUrl('&active_tab=outbox&result=err'));
                 }
                 Util::jump_to($um->getUrl('&active_tab=inbox&result=err'));
                 //Util::jump_to($um->getUrl(( $from == 'out' ? '&active_tab=outbox' : '').'&result=err'));
             }
             if (!$this->db->query("\r\n\t\t\t\tDELETE FROM %adm_message\r\n\t\t\t\tWHERE idMessage = '" . $_GET['id_message'] . "'")) {
                 if ($from === 'out') {
                     Util::jump_to($um->getUrl('&active_tab=outbox&result=err'));
                 }
                 Util::jump_to($um->getUrl('&active_tab=inbox&result=err'));
                 //Util::jump_to($um->getUrl(( $from == 'out' ? '&active_tab=outbox' : '').'&result=err'));
             }
         }
         $_filter = importVar('msg_course_filter');
         if ($_filter != '' && $_filter != false) {
             $add_filter = "&msg_course_filter=" . $_filter;
         } else {
             $add_filter = '';
         }
         if ($from === 'out') {
             Util::jump_to($um->getUrl('&active_tab=outbox&result=ok_del' . $add_filter));
         }
         Util::jump_to($um->getUrl('&active_tab=inbox&result=ok_del' . $add_filter));
         //Util::jump_to($um->getUrl(( $from == 'out' ? '&active_tab=outbox' : '').'&result=ok_del'));
     } else {
         list($title) = $this->db->fetch_row($this->db->query("\r\n\t\t\tSELECT title\r\n\t\t\tFROM %adm_message\r\n\t\t\tWHERE idMessage = '" . $_GET['id_message'] . "'"));
         $page_title = array($um->getUrl($from == 'out' ? '&active_tab=outbox' : '') => Lang::t('_MESSAGES'), Lang::t('_DEL'));
         $_filter = importVar('msg_course_filter');
         $add_filter = '';
         if ($_filter != '' && $_filter != false) {
             $add_filter = "&msg_course_filter=" . $_filter;
         }
         $output = "";
         $output .= $this->messageGetTitleArea($page_title, 'message') . '<div class="std_block">' . getDeleteUi(Lang::t('_AREYOUSURE'), '<span>' . Lang::t('_TITLE') . ' : </span> "' . $title, true, $um->getUrl('op=delmessage&id_message=' . $_GET['id_message'] . ($from == 'out' ? '&out=out' : '') . '&confirm=1' . $add_filter), $um->getUrl($from == 'out' ? '&active_tab=outbox' : '')) . '</div>';
         cout($output, 'content');
     }
 }