コード例 #1
0
ファイル: category.php プロジェクト: trabisdementia/publisher
 /**
  * delete a category from the database
  *
  * @param object $category reference to the category to delete
  * @param bool   $force
  *
  * @return bool FALSE if failed.
  */
 public function delete(&$category, $force = false)
 {
     // Deleting this category ITEMs
     $criteria = new Criteria('categoryid', $category->categoryid());
     $this->publisher->getHandler('item')->deleteAll($criteria);
     unset($criteria);
     // Deleting the sub categories
     $subcats =& $this->getCategories(0, 0, $category->categoryid());
     foreach ($subcats as $subcat) {
         $this->delete($subcat);
     }
     if (!parent::delete($category, $force)) {
         $category->setErrors('An error while deleting.');
         return false;
     }
     $moduleId = $this->publisher->getModule()->getVar('mid');
     xoops_groupperm_deletebymoditem($moduleId, 'category_read', $category->categoryid());
     xoops_groupperm_deletebymoditem($moduleId, 'item_submit', $category->categoryid());
     xoops_groupperm_deletebymoditem($moduleId, 'category_moderation', $category->categoryid());
     return true;
 }
コード例 #2
0
ファイル: category.php プロジェクト: trabisdementia/xuups
 /**
  * delete a category from the database
  *
  * @param object $category reference to the category to delete
  * @param bool $force
  * @return bool FALSE if failed.
  */
 function delete(&$category, $force = false)
 {
     if (strtolower(get_class($category)) != 'sfcategory') {
         return false;
     }
     // Deleting the FAQs
     $faq_handler = new sfFaqHandler($this->db);
     if (!$faq_handler->deleteAll(new Criteria('categoryid', $category->categoryid()))) {
         return false;
     }
     // Deleteing the sub categories
     $subcats =& $this->getCategories(0, 0, $category->categoryid());
     foreach ($subcats as $subcat) {
         $this->delete($subcat);
     }
     $sql = sprintf("DELETE FROM %s WHERE categoryid = %u", $this->db->prefix("smartfaq_categories"), $category->getVar('categoryid'));
     $smartModule =& sf_getModuleInfo();
     $module_id = $smartModule->getVar('mid');
     if (false != $force) {
         $result = $this->db->queryF($sql);
     } else {
         $result = $this->db->query($sql);
     }
     xoops_groupperm_deletebymoditem($module_id, "category_read", $category->categoryid());
     //xoops_groupperm_deletebymoditem ($module_id, "category_admin", $categoryObj->categoryid());
     if (!$result) {
         return false;
     }
     return true;
 }
コード例 #3
0
ファイル: item.php プロジェクト: severnaya99/Sg-2010
 /**
  * delete an item from the database
  *
  * @param object $item reference to the ITEM to delete
  * @param bool $force
  * @return bool FALSE if failed.
  */
 function delete(&$item, $force = false)
 {
     $hModule =& xoops_gethandler('module');
     $smartModule =& $hModule->getByDirname('smartsection');
     $module_id = $smartModule->getVar('mid');
     if (strtolower(get_class($item)) != 'smartsectionitem') {
         return false;
     }
     // Deleting the files
     global $smartsection_file_handler;
     if (!$smartsection_file_handler->deleteItemFiles($item)) {
         $item->setErrors('An error while deleting a file.');
     }
     $sql = sprintf("DELETE FROM %s WHERE itemid = %u", $this->db->prefix("smartsection_items"), $item->itemid());
     if (false != $force) {
         $result = $this->db->queryF($sql);
     } else {
         $result = $this->db->query($sql);
     }
     if (!$result) {
         $item->setErrors('An error while deleting.');
         return false;
     }
     xoops_groupperm_deletebymoditem($module_id, "item_read", $item->itemid());
     return true;
 }
コード例 #4
0
ファイル: index.php プロジェクト: severnaya99/Sg-2010
function delTopic()
{
    if (!isset($_REQUEST['topic_id']) || $_REQUEST['topic_id'] == 0) {
        redirect_header('index.php?op=topicsmanager', 3, _AMS_AM_NOTOPICSELECTED);
    }
    global $xoopsDB, $xoopsModule;
    if (!isset($_POST['ok'])) {
        echo "<h4>" . _AMS_AM_CONFIG . "</h4>";
        $xt = new XoopsTopic($xoopsDB->prefix("ams_topics"), intval($_GET['topic_id']));
        xoops_confirm(array('op' => 'delTopic', 'topic_id' => intval($_GET['topic_id']), 'ok' => 1), 'index.php', _AMS_AM_WAYSYWTDTTAL . '<br />' . $xt->topic_title('S'));
    } else {
        $xt = new XoopsTopic($xoopsDB->prefix("ams_topics"), intval($_POST['topic_id']));
        // get all subtopics under the specified topic
        $topic_arr = $xt->getAllChildTopics();
        array_push($topic_arr, $xt);
        foreach ($topic_arr as $eachtopic) {
            // get all stories in each topic
            $story_arr = AmsStory::getByTopic($eachtopic->topic_id());
            foreach ($story_arr as $eachstory) {
                if (false != $eachstory->delete()) {
                    xoops_comment_delete($xoopsModule->getVar('mid'), $eachstory->storyid());
                    xoops_notification_deletebyitem($xoopsModule->getVar('mid'), 'story', $eachstory->storyid());
                }
            }
            // all stories for each topic is deleted, now delete the topic data
            $eachtopic->delete();
            // Delete also the notifications and permissions
            xoops_notification_deletebyitem($xoopsModule->getVar('mid'), 'category', $eachtopic->topic_id);
            xoops_groupperm_deletebymoditem($xoopsModule->getVar('mid'), 'ams_approve', $eachtopic->topic_id);
            xoops_groupperm_deletebymoditem($xoopsModule->getVar('mid'), 'ams_submit', $eachtopic->topic_id);
            xoops_groupperm_deletebymoditem($xoopsModule->getVar('mid'), 'ams_view', $eachtopic->topic_id);
        }
        redirect_header('index.php?op=topicsmanager', 1, _AMS_AM_DBUPDATED);
        exit;
    }
}
コード例 #5
0
ファイル: index.php プロジェクト: severnaya99/Sg-2010
function delTopic()
{
    global $xoopsDB, $xoopsModule;
    if (!isset($_POST['ok'])) {
        xoops_cp_header();
        echo '<h4>' . _AM_CONFIG . '</h4>';
        $xt = new XoopsTopic($xoopsDB->prefix('topics'), intval($_GET['topic_id']));
        xoops_confirm(array('op' => 'delTopic', 'topic_id' => intval($_GET['topic_id']), 'ok' => 1), 'index.php', _AM_WAYSYWTDTTAL . '<br />' . $xt->topic_title('S'));
    } else {
        xoops_cp_header();
        $xt = new XoopsTopic($xoopsDB->prefix('topics'), intval($_POST['topic_id']));
        if (isset($_SESSION['items_count'])) {
            $_SESSION['items_count'] = -1;
        }
        // get all subtopics under the specified topic
        $topic_arr = $xt->getAllChildTopics();
        array_push($topic_arr, $xt);
        foreach ($topic_arr as $eachtopic) {
            // get all stories in each topic
            $story_arr = NewsStory::getByTopic($eachtopic->topic_id());
            foreach ($story_arr as $eachstory) {
                if (false != $eachstory->delete()) {
                    xoops_comment_delete($xoopsModule->getVar('mid'), $eachstory->storyid());
                    xoops_notification_deletebyitem($xoopsModule->getVar('mid'), 'story', $eachstory->storyid());
                }
            }
            // all stories for each topic is deleted, now delete the topic data
            $eachtopic->delete();
            // Delete also the notifications and permissions
            xoops_notification_deletebyitem($xoopsModule->getVar('mid'), 'category', $eachtopic->topic_id);
            xoops_groupperm_deletebymoditem($xoopsModule->getVar('mid'), 'news_approve', $eachtopic->topic_id);
            xoops_groupperm_deletebymoditem($xoopsModule->getVar('mid'), 'news_submit', $eachtopic->topic_id);
            xoops_groupperm_deletebymoditem($xoopsModule->getVar('mid'), 'news_view', $eachtopic->topic_id);
        }
        news_updateCache();
        redirect_header('index.php?op=topicsmanager', 1, _AM_DBUPDATED);
        exit;
    }
}
コード例 #6
0
ファイル: index.php プロジェクト: amjadtbssm/website
    $sform->addElement($create_tray);
    $sform->display();
    unset($hidden);
}
switch ($op) {
    case "mod":
        xoops_cp_header();
        adminmenu(_AM_CHANADMIN, $extra = '');
        $CID = isset($HTTP_POST_VARS['CID']) ? $HTTP_POST_VARS['CID'] : $CID;
        edittopic($CID);
        break;
    case "del":
        global $xoopsUser, $xoopsUser, $xoopsConfig, $xoopsDB;
        if ($confirm) {
            $xoopsDB->query("DELETE FROM " . $xoopsDB->prefix("wfschannel") . " WHERE CID = {$CID}");
            xoops_groupperm_deletebymoditem($xoopsModule->getVar('mid'), '', $CID);
            xoops_comment_delete($xoopsModule->getVar('mid'), $CID);
            redirect_header("index.php", 1, sprintf(_AM_CHANISDELETED, $pagetitle));
            exit;
        } else {
            $CID = isset($HTTP_POST_VARS['CID']) ? $HTTP_POST_VARS['CID'] : $CID;
            $result = $xoopsDB->query("SELECT CID, pagetitle FROM " . $xoopsDB->prefix("wfschannel") . " ");
            if ($xoopsDB->getRowsNum($result) == 1) {
                redirect_header("index.php", 3, _AM_CANNOTDELETELASTONE);
                exit;
            }
            $result = $xoopsDB->query("SELECT CID, pagetitle FROM " . $xoopsDB->prefix("wfschannel") . " WHERE CID = {$CID}");
            list($CID, $pagetitle) = $xoopsDB->fetchrow($result);
            xoops_cp_header();
            echo "<table width='100%' border='0' cellpadding = '2' cellspacing='1' class = 'confirmMsg'><tr><td class='confirmMsg'>";
            echo "<div class='confirmMsg'>";
コード例 #7
0
ファイル: faq.php プロジェクト: trabisdementia/xuups
 /**
  * delete an FAQ from the database
  *
  * @param object $faq reference to the FAQ to delete
  * @param bool $force
  * @return bool FALSE if failed.
  */
 function delete(&$faq, $force = false)
 {
     $smartModule =& sf_getModuleInfo();
     $module_id = $smartModule->getVar('mid');
     if (strtolower(get_class($faq)) != 'sffaq') {
         return false;
     }
     // Deleting the answers
     $answer_handler = new sfAnswerHandler($this->db);
     if (!$answer_handler->deleteFaqAnswers($faq)) {
         // error msg...
         echo "error while deleteing an answer";
     }
     $sql = sprintf("DELETE FROM %s WHERE faqid = %u", $this->db->prefix("smartfaq_faq"), $faq->getVar('faqid'));
     if (false != $force) {
         $result = $this->db->queryF($sql);
     } else {
         $result = $this->db->query($sql);
     }
     if (!$result) {
         return false;
     }
     xoops_groupperm_deletebymoditem($module_id, "item_read", $faq->faqid());
     return true;
 }
コード例 #8
0
ファイル: category.php プロジェクト: severnaya99/Sg-2010
 /**
  * delete a category from the database
  *
  * @param object $category reference to the category to delete
  * @param bool $force
  * @return bool FALSE if failed.
  */
 function delete(&$category, $force = false)
 {
     if (strtolower(get_class($category)) != 'smartsectioncategory') {
         return false;
     }
     // Deleting the ITEMs
     global $smartsection_item_handler;
     $items =& $smartsection_item_handler->getItems(0, 0, -1, $category->categoryid());
     if ($items) {
         foreach ($items as $item) {
             $smartsection_item_handler->delete($item);
         }
     }
     // Deleteing the sub categories
     $subcats =& $this->getCategories(0, 0, $category->categoryid());
     foreach ($subcats as $subcat) {
         $this->delete($subcat);
     }
     $sql = sprintf("DELETE FROM %s WHERE categoryid = %u", $this->db->prefix("smartsection_categories"), $category->getVar('categoryid'));
     $hModule =& xoops_gethandler('module');
     $smartModule =& $hModule->getByDirname('smartsection');
     $module_id = $smartModule->getVar('mid');
     if (false != $force) {
         $result = $this->db->queryF($sql);
     } else {
         $result = $this->db->query($sql);
     }
     xoops_groupperm_deletebymoditem($module_id, "category_read", $category->categoryid());
     xoops_groupperm_deletebymoditem($module_id, "item_submit", $category->categoryid());
     //xoops_groupperm_deletebymoditem ($module_id, "category_admin", $categoryObj->categoryid());
     if (!$result) {
         return false;
     }
     return true;
 }
コード例 #9
0
function deletegenre($del = 0)
{
    global $xoopsDB;
    if (isset($_POST['del']) && $_POST['del'] == 1) {
        $sql1 = "\r\n\t\tDELETE \r\n\t\tFROM " . $xoopsDB->prefix('debaser_genre') . " \r\n\t\tWHERE genretitle=" . $xoopsDB->quoteString($_POST['genrecat']) . " ";
        $sql2 = "\r\n\t\tDELETE \r\n\t\tFROM " . $xoopsDB->prefix('debaser_files') . " \r\n\t\tWHERE genre=" . $xoopsDB->quoteString($_POST['genrecat']) . " ";
        $sql3 = "SELECT filename \r\n\t\tFROM " . $xoopsDB->prefix('debaser_files') . " \r\n\t\tWHERE genreid=" . $xoopsDB->quoteString($_POST['genrecat']) . " ";
        $result3 = $xoopsDB->query($sql3);
        if ($xoopsDB->query($sql1) && $xoopsDB->query($sql2)) {
            while (list($filename) = $xoopsDB->fetchRow($result3)) {
                @unlink(XOOPS_ROOT_PATH . '/modules/debaser/upload/' . $filename);
                xoops_groupperm_deletebymoditem($xoopsModule->getVar('mid'), 'WF3DownCatPerm', $genreid);
            }
            redirect_header('index.php', 2, $_POST['genrecat'] . _AM_DEBASER_DELETED);
        } else {
            redirect_header('index.php', 2, $_POST['genrecat'] . _AM_DEBASER_NOTDELETED);
        }
        exit;
    } else {
        echo "<h4>" . _AM_DEBASER_GENREADMIN . "</h4>";
        xoops_confirm(array('genreid' => $_GET['genreid'], 'genrecat' => $_GET['genrecat'], 'del' => 1), 'category.php?op=deletegenre', _AM_DEBASER_SUREDELETEGENRE);
    }
    //xoops_notification_deletebyitem($xoopsModule->getVar('mid'), 'song', $_POST['mpegid']);
    //xoops_notification_deletebyitem($xoopsModule->getVar('mid'), 'category', $_POST['genrecat']);
}