$xoopsDB->queryF($sql) or redirect_header($_SERVER['PHP_SELF'], 10, mysql_error()); } /*-----------執行動作判斷區----------*/ include_once $GLOBALS['xoops']->path('/modules/system/include/functions.php'); $op = system_CleanVars($_REQUEST, 'op', '', 'string'); $sn = system_CleanVars($_REQUEST, 'sn', 0, 'int'); $csn = system_CleanVars($_REQUEST, 'csn', 0, 'int'); switch ($op) { case "good": update_tad_gallery_good($sn, '1'); header("location: view.php?sn={$sn}#photo{$sn}"); break; case "good_del": update_tad_gallery_good($sn, '0'); header("location: view.php?sn={$sn}#photo{$sn}"); break; case "delete_tad_gallery": $csn = delete_tad_gallery($sn); mk_rss_xml(); mk_rss_xml($csn); header("location: index.php?csn={$csn}"); break; default: view_pic($sn); break; } /*-----------秀出結果區--------------*/ $xoopsTpl->assign("toolbar", toolbar_bootstrap($interface_menu)); $xoopsTpl->assign("bootstrap", get_bootstrap()); include_once XOOPS_ROOT_PATH . '/include/comment_view.php'; include_once XOOPS_ROOT_PATH . '/footer.php';
function delete_tad_gallery_cate($csn = "") { global $xoopsDB; //先找出底下所有相片 $sql = "select sn from " . $xoopsDB->prefix("tad_gallery") . " where csn='{$csn}'"; $result = $xoopsDB->query($sql) or redirect_header($_SERVER['PHP_SELF'], 3, mysql_error()); while (list($sn) = $xoopsDB->fetchRow($result)) { delete_tad_gallery($sn); } //找出底下分類,並將分類的所屬分類清空 $sql = "update " . $xoopsDB->prefix("tad_gallery_cate") . " set of_csn='' where of_csn='{$csn}'"; $xoopsDB->queryF($sql) or redirect_header($_SERVER['PHP_SELF'], 3, mysql_error()); //刪除之 $sql = "delete from " . $xoopsDB->prefix("tad_gallery_cate") . " where csn='{$csn}'"; $xoopsDB->queryF($sql) or redirect_header($_SERVER['PHP_SELF'], 3, mysql_error()); //刪掉RSS $rss_filename = _TADGAL_UP_FILE_DIR . "photos{$csn}.rss"; unlink($rss_filename); }
function batch_del() { global $xoopsDB; foreach ($_POST['pic'] as $sn) { delete_tad_gallery($sn); } }