예제 #1
0
function rmmfAddImgs()
{
    global $db, $mc;
    define('_RMMF_LOCATION', '');
    $id = isset($_GET['id']) ? $_GET['id'] : 0;
    if ($id <= 0) {
        header('location: index.php');
        die;
    }
    include '../class/work.class.php';
    $work = new MFWork($id);
    if (!$work->getVar('found')) {
        redirect_header('index.php', 1, _MA_RMMF_ERRNOEXIST);
        die;
    }
    xoops_cp_header();
    echo "<script type='text/javascript'>\n\t\t\t<!--\n\t\t\t\tfunction decision(message, url){\n\t\t\t\t\tif(confirm(message)) location.href = url;\n\t\t\t\t}\n\t\t\t-->\n\t\t   </script>";
    rmmf_make_adminnav();
    $dir = rmmf_add_slash($mc['storedir']);
    $dir = rmmf_web_dir($dir);
    echo "<table class='outer' cellspacing='1'>\n\t\t\t<tr><th colspan='2'>" . _MA_RMMF_CURRIMAGES . "</th></tr>";
    $class = 'odd';
    foreach ($work->getVar('images') as $k => $v) {
        $class = $class == 'even' ? 'odd' : 'even';
        echo "<tr class='{$class}' align='center'>\n\t\t\t\t<td><img src='" . $dir . "ths/" . $v['archivo'] . "' border='0' /></td>\n\t\t\t\t<td><a href=\"javascript:decision('" . sprintf(_MA_RMMF_CONFIRM, $v['archivo']) . "','?op=delimg&amp;id={$id}&amp;img={$v['id_img']}')\">" . _MA_RMMF_DELETE . "</a></td></tr>";
    }
    if ($work->getVar('total_images') < $mc['imgnum']) {
        echo "<tr class='even' align='left'><form name='addimg' action='index.php?op=addimg' method='post' enctype='multipart/form-data'>\n\t\t\t\t<td colspan='2'>" . _MA_RMMF_ADDIMAGES . " \n\t\t\t\t<input type='file' name='archivo' size='45'>\n\t\t\t\t<input type='submit' name='sbt' value='" . _MA_RMMF_SEND . "' />\n\t\t\t\t<input type='hidden' name='id' value='{$id}' /></td></tr>";
    }
    echo "</table>";
    rmmf_make_footer();
    xoops_cp_footer();
}
예제 #2
0
/** 
 * Eliminamos una categoria
 */
function rmmfDelete()
{
    global $db;
    $id = isset($_GET['id']) ? $_GET['id'] : (isset($_POST['id']) ? $_POST['id'] : 0);
    $ok = isset($_POST['ok']) ? $_POST['ok'] : 0;
    $catego = isset($_POST['catego']) ? $_POST['catego'] : 0;
    if ($id <= 0) {
        header('location: categos.php');
        die;
    }
    include_once '../class/catego.class.php';
    $catego = new MFCategory($id);
    $pass = false;
    if ($catego->getWorksNumber() <= 0) {
        $ok = 1;
        $pass = true;
    }
    if ($ok) {
        if ($catego <= 0 && !$pass) {
            redirect_header('?op=del&amp;id=' . $id, 2, _MA_RMMF_SELECTCAT);
            die;
        }
        if (!$pass) {
            $db->queryF("UPDATE " . $db->prefix("rmmf_works") . " SET catego='{$catego}' WHERE catego='{$id}'");
        }
        $db->queryF("UPDATE " . $db->prefix("rmmf_categos") . " SET parent='0' WHERE parent='{$id}'");
        $db->queryF("DELETE FROM " . $db->prefix("rmmf_categos") . " WHERE id_cat='{$id}'");
        if ($db->error() != '') {
            redirect_header('categos.php', 2, sprintf(_MA_RMMF_ERRDB, $db->error()));
            die;
        } else {
            header('location: categos.php');
            die;
        }
    } else {
        xoops_cp_header();
        rmmf_make_adminnav();
        $result = array();
        $select = "<select name='catego'>\n\t\t\t\t<option value='0'>" . _MA_RMMF_SELECT . "</option>";
        rmmf_get_categos($result);
        foreach ($result as $k => $v) {
            $select .= "<option value='{$v['id_cat']}'>{$v['nombre']}</option>";
        }
        $select .= "</select>";
        echo "<div class='confirmMsg'><form name='frmDel' method='post' action='categos.php?op=del'>\n\t\t\t\t" . _MA_RMMF_SELECTCAT . "<br /><br />{$select}\n\t\t\t\t</form></div>";
        rmmf_make_footer();
        xoops_cp_footer();
    }
}