}
                    ++$ord;
                }
                $sql .= '';
                DB::query($sql);
            }
            // message
            $done = isset($last) ? $last + 1 : count($done);
            $message = _formMessage($done === $total ? 1 : 2, sprintf($_lang['admin.content.manageimgs.upload.msg'], $done, $total));
            break;
    }
}
/* ---  odstraneni obrazku  --- */
if (isset($_GET['del']) && _xsrfCheck(true) && $continue) {
    $del = intval($_GET['del']);
    _tmpGalStorageCleanOnDel('id=' . $del . ' AND home=' . $g);
    DB::query("DELETE FROM `" . _mysql_prefix . "-images` WHERE id=" . $del . " AND home=" . $g);
    if (DB::affectedRows() === 1) {
        $message = _formMessage(1, $_lang['global.done']);
    }
}
/* ---  vystup  --- */
if ($continue) {
    $output .= "\n<a href='index.php?p=content-editgallery&amp;id=" . $g . "' class='backlink'>&lt; návrat zpět</a>\n<h1>" . $_lang['admin.content.manageimgs.title'] . "</h1>\n<p class='bborder'>" . str_replace("*galtitle*", $galdata['title'], $_lang['admin.content.manageimgs.p']) . "</p>\n\n" . $message . "\n\n<script type='text/javascript'>\n/* <![CDATA[ */\n\$(document).ready(function(){\n    \$('.hs_fieldset').each(function(){\n        var fieldset = this;\n        var link = \$(fieldset).find('legend > a').get(0);\n        var form = \$(fieldset).children('form');\n        \$(form).hide();\n        \$(link).click(function(){\n            \$(form).slideToggle('fast');\n\n            return false;\n        });\n    });\n});\n/* ]]> */\n</script>\n\n<fieldset>\n<legend>" . $_lang['admin.content.manageimgs.upload'] . "</legend>\n<form action='index.php?p=content-manageimgs&amp;g=" . $g . "' method='post' enctype='multipart/form-data'>\n    <p>" . sprintf($_lang['admin.content.manageimgs.upload.text'], _galuploadresize_w, _galuploadresize_h) . "</p>\n    <input type='hidden' name='xaction' value='7' />\n    <div id='fmanFiles'><input type='file' name='uf0[]' multiple='multiple' />&nbsp;&nbsp;<a href='#' onclick='return _sysFmanAddFile();'>" . $_lang['admin.fman.upload.addfile'] . "</a></div>\n    <div class='hr'><hr /></div>\n    <p>\n        <input type='submit' value='" . $_lang['admin.content.manageimgs.upload.submit'] . "' />" . (($uplimit = _getUploadLimit(true)) !== null ? " &nbsp;<small>" . $_lang['global.uploadlimit'] . ": <em>" . _getUploadLimit() . "MB</em>, " . $_lang['global.uploadext'] . ": <em>" . implode(', ', SL::$imageExt) . "</em></small>" : '') . "<br />\n        <label><input type='checkbox' value='1' name='moveords' checked='checked' /> " . $_lang['admin.content.manageimgs.moveords'] . "</label>\n    </p>\n" . _xsrfProtect() . "</form>\n</fieldset>\n\n<fieldset class='hs_fieldset'>\n<legend><a href='#'>" . $_lang['admin.content.manageimgs.insert'] . "</a> &nbsp;<small>(" . $_lang['admin.content.manageimgs.insert.tip'] . ")</small></legend>\n<form action='index.php?p=content-manageimgs&amp;g=" . $g . "' method='post' name='addform' onsubmit='_sysGalTransferPath(this);'>\n<input type='hidden' name='xaction' value='1' />\n\n<table>\n<tr class='valign-top'>\n\n<td>\n    <table>\n    <tr>\n    <td class='rpad'><strong>" . $_lang['admin.content.form.title'] . "</strong></td>\n    <td><input type='text' name='title' class='inputmedium' maxlength='64' /></td>\n    </tr>\n\n    <tr>\n    <td class='rpad'><strong>" . $_lang['admin.content.form.ord'] . "</strong></td>\n    <td><input type='text' name='ord' class='inputsmall' disabled='disabled' />&nbsp;&nbsp;<label><input type='checkbox' name='moveords' value='1' checked='checked' onclick=\"_sysDisableField(this.checked, 'addform', 'ord');\" /> " . $_lang['admin.content.manageimgs.moveords'] . "</label></td>\n    </tr>\n\n    <tr>\n    <td class='rpad'><strong>" . $_lang['admin.content.manageimgs.prev'] . "</strong></td>\n    <td><input type='text' name='prev' class='inputsmall' disabled='disabled' />&nbsp;&nbsp;<label><input type='checkbox' name='autoprev' value='1' checked='checked' onclick=\"_sysDisableField(this.checked, 'addform', 'prev');\" /> " . $_lang['admin.content.manageimgs.autoprev'] . "</label></td>\n    </tr>\n\n    <tr>\n    <td class='rpad'><strong>" . $_lang['admin.content.manageimgs.full'] . "</strong></td>\n    <td><input type='text' name='full' class='inputmedium' /></td>\n    </tr>\n\n    <tr>\n    <td></td>\n    <td><input type='submit' value='" . $_lang['global.insert'] . "' /></td>\n    </tr>\n\n    </table>\n</td>\n\n<td>\n" . (_loginright_adminfman ? "<div id='gallery-browser'>\n    " . (!isset($_GET['browserpath']) ? "<a href='#' onclick=\"return _sysGalBrowse('" . urlencode(_upload_dir) . (_loginright_adminfmanlimit ? _loginname . '%2F' : '') . "');\"><img src='images/icons/loupe.png' alt='browse' class='icon' />" . $_lang['admin.content.manageimgs.insert.browser.link'] . "</a>" : "<script type='text/javascript'>_sysGalBrowse('" . _htmlStr($_GET['browserpath']) . "');</script>") . "\n</div>" : '') . "\n</td>\n\n</tr>\n</table>\n\n" . _xsrfProtect() . "</form>\n</fieldset>\n\n";
    // strankovani
    $paging = _resultPaging("index.php?p=content-manageimgs&amp;g=" . $g, $galdata['var2'], "images", "home=" . $g);
    $s = $paging[2];
    $output .= "\n<fieldset>\n<legend>" . $_lang['admin.content.manageimgs.current'] . "</legend>\n<form action='index.php?p=content-manageimgs&amp;g=" . $g . "&amp;page=" . $s . "' method='post' name='editform'>\n<input type='hidden' name='xaction' value='4' />\n\n<input type='submit' value='" . $_lang['admin.content.manageimgs.savechanges'] . "' class='gallery-savebutton' />\n" . $paging[0] . "\n<div class='cleaner'></div>";
    // vypis obrazku
    $images = DB::query("SELECT * FROM `" . _mysql_prefix . "-images` WHERE home=" . $g . " ORDER BY ord " . $paging[1]);
    $images_forms = array();
         if ($item['home1'] != -1 and $item['home3'] == $id) {
             DB::query("UPDATE `" . _mysql_prefix . "-articles` SET home3=-1 WHERE id=" . $item['id']);
             continue;
         }
         // 3->x
     }
     break;
     // prispevky v knihach
 // prispevky v knihach
 case 3:
     DB::query("DELETE FROM `" . _mysql_prefix . "-posts` WHERE type=3 AND home=" . $id);
     break;
     // obrazky v galerii
 // obrazky v galerii
 case 5:
     _tmpGalStorageCleanOnDel('home=' . $id);
     DB::query("DELETE FROM `" . _mysql_prefix . "-images` WHERE home=" . $id);
     @rmdir(_indexroot . 'pictures/galleries/' . $id . '/');
     break;
     // polozky v rozcestniku
 // polozky v rozcestniku
 case 7:
     $rquery = DB::query("SELECT id,ord FROM `" . _mysql_prefix . "-root` WHERE intersection=" . $id);
     while ($item = DB::row($rquery)) {
         DB::query("UPDATE `" . _mysql_prefix . "-root` SET intersection=-1,ord=" . ($query['ord'] . "." . intval($item['ord'])) . " WHERE id=" . $item['id']);
     }
     break;
     // prispevky ve forech
 // prispevky ve forech
 case 8:
     DB::query("DELETE FROM `" . _mysql_prefix . "-posts` WHERE type=5 AND home=" . $id);