/** * @desc Elimina pantallas de la base de datos **/ function deleteScreens() { global $xoopsModule, $util; $ids = isset($_REQUEST['id']) ? $_REQUEST['id'] : 0; $item = isset($_REQUEST['item']) ? intval($_REQUEST['item']) : 0; $ok = isset($_POST['ok']) ? intval($_POST['ok']) : 0; //Verificamos que el software sea válido if ($item <= 0) { redirectMsg('./screens.php', _AS_DT_ERR_ITEMVALID, 1); die; } //Verificamos que el software exista $sw = new DTSoftware($item); if ($sw->isNew()) { redirectMsg('./screens.php', _AS_DT_ERR_ITEMEXIST, 1); die; } //Verificamos si nos proporcionaron alguna pantalla if (!is_array($ids) && $ids <= 0) { redirectMsg('./screens.php?item=' . $item, _AS_DT_NOTSCREEN, 1); die; } $num = 0; if (!is_array($ids)) { $scr = new DTScreenshot($ids); $ids = array($ids); $num = 1; } if ($ok) { if (!$util->validateToken()) { redirectMsg('./screens.php?item=' . $item, _AS_DT_SESSINVALID, 1); die; } $errors = ''; foreach ($ids as $k) { //Verificamos si pantalla es válida if ($k <= 0) { $errors .= sprintf(_AS_DT_ERRSCVAL, $k); continue; } //Verificamos que la pantalla exista $sc = new DTScreenshot($k); if ($sc->isNew()) { $errors .= sprintf(_AS_DT_ERRSCEX, $k); continue; } if (!$sc->delete()) { $errors .= sprintf(_AS_DT_ERRSCDEL, $k); } } if ($errors != '') { redirectMsg('./screens.php?item=' . $item, _AS_DT_ERRORS . $errors, 1); die; } else { redirectMsg('./screens.php?item=' . $item, _AS_DT_DBOK, 0); die; } } else { optionsBar($sw); xoops_cp_location("<a href='./'>" . $xoopsModule->name() . "</a> » <a href='./items.php'>" . _AS_DT_SW . "</a> » " . _AS_DT_DELETESCREEN); xoops_cp_header(); $hiddens['ok'] = 1; $hiddens['id[]'] = $ids; $hiddens['item'] = $item; $hiddens['op'] = 'delete'; $buttons['sbt']['type'] = 'submit'; $buttons['sbt']['value'] = _DELETE; $buttons['cancel']['type'] = 'button'; $buttons['cancel']['value'] = _CANCEL; $buttons['cancel']['extra'] = 'onclick="window.location=\'screens.php?item=' . $item . '\';"'; $util->msgBox($hiddens, 'screens.php', ($num ? sprintf(_AS_DT_DELETECONF, $scr->title()) : _AS_DT_DELCONF) . '<br /><br />' . _AS_DT_ALLPERM, XOOPS_ALERT_ICON, $buttons, true, '400px'); xoops_cp_footer(); } }
function dt_delete_screen() { global $xoopsSecurity, $xoopsConfig, $xoopsModule, $xoopsUser; $rmf = RMFunctions::get(); $xoopsModule = $rmf->load_module('dtransport'); include_once '../../../include/cp_header.php'; $func = new DTFunctions(); if (!$xoopsSecurity->check()) { $func->dt_send_message(__('Session token not valid!', 'dtransport'), 1, 0); } $id = rmc_server_var($_POST, 'id', 0); $sc = new DTScreenshot($id); if ($sc->isNew()) { $func->dt_send_message(__('Specified screenshot does not exists!', 'dtransport'), 1, 1); } if (!$sc->delete()) { $func->dt_send_message(__('Screenshot could not be deleted!', 'dtransport') . '<br />' . $sc->errors(), 1, 1); } $ret = array('id' => $sc->id()); $func->dt_send_message($ret, 0, 1); }
public function delete() { //Eliminamos las relaciones con etiquetas $sql = "DELETE FROM " . $this->db->prefix('dtrans_softtag') . " WHERE id_soft=" . $this->id(); $result = $this->db->queryF($sql); if (!$result) { return false; } //Eliminar caracteristicas $sql = "DELETE FROM " . $this->db->prefix('dtrans_features') . " WHERE id_soft=" . $this->id(); $result = $this->db->queryF($sql); if (!$result) { return false; } //Eliminar pantallas $sql = "SELECT * FROM " . $this->db->prefix('dtrans_screens') . " WHERE id_soft=" . $this->id(); $result = $this->db->queryF($sql); while ($rows = $this->db->fetchArray($result)) { $sc = new DTScreenshot(); $sc->assignVars($rows); $sc->delete(); } //Eliminar Archivos $sql = "SELECT * FROM " . $this->db->prefix('dtrans_files') . " WHERE id_soft=" . $this->id(); $result = $this->db->queryF($sql); while ($rows = $this->db->fetchArray($result)) { $file = new DTFile(); $file->assignVars($rows); $file->delete($this); } //Eliminar Logs $sql = "DELETE FROM " . $this->db->prefix('dtrans_logs') . " WHERE id_soft=" . $this->id(); $result = $this->db->queryF($sql); if (!$result) { return false; } //Eliminar grupo $sql = "DELETE FROM " . $this->db->prefix('dtrans_groups') . " WHERE id_soft=" . $this->id(); $result = $this->db->queryF($sql); if (!$result) { return false; } //Eliminar relación de licencias $sql = "DELETE FROM " . $this->db->prefix('dtrans_licsoft') . " WHERE id_soft=" . $this->id(); $result = $this->db->queryF($sql); if (!$result) { return false; } //Eliminar relación de plataformas $sql = "DELETE FROM " . $this->db->prefix('dtrans_platsoft') . " WHERE id_soft=" . $this->id(); $result = $this->db->queryF($sql); if (!$result) { return false; } //Eliminar alerta $sql = "DELETE FROM " . $this->db->prefix('dtrans_alerts') . " WHERE id_soft=" . $this->id(); $result = $this->db->queryF($sql); if (!$result) { return false; } return $this->deleteFromTable(); }
/** * @desc Elmina las pantallas de la base de datos **/ function dt_delete_screen() { global $mc, $item, $screen, $tpl, $xoopsTpl; $sc = new DTScreenshot($screen); if ($sc->isNew()) { redirect_header(DT_URL . ($mc['permalinks'] ? '/cp/screens/' . $item->id() : '/?p=cpanel&action=screens&id=' . $item->id()), 1, __('Specified screenshot is not valid!', 'dtransport')); } if (!$sc->delete()) { redirect_header(DT_URL . ($mc['permalinks'] ? '/cp/screens/' . $item->id() : '/?p=cpanel&action=screens&id=' . $item->id()), 1, __('Screenshot could not be deleted! Please try again.', 'dtransport')); } redirect_header(DT_URL . ($mc['permalinks'] ? '/cp/screens/' . $item->id() : '/?p=cpanel&action=screens&id=' . $item->id()), 1, __('Screenshot deleted successfully!', 'dtransport')); }