Ejemplo n.º 1
0
/**
 * Build image check function to determine which Uploader sub-function to run based on the type of POST.
 *
 * @since 1.0
 */
function dynamik_images_check()
{
    if (!empty($_GET['fct'])) {
        switch ($_GET['fct']) {
            case 'upload':
                uploadimage();
                break;
            case 'rename':
                renameimage();
                break;
            case 'dorename':
                dorename();
                break;
            case 'delete':
                deleteimage();
                break;
            case 'dodelete':
                dodelete();
                break;
            case 'bulkdelete':
                @dobulkdelete();
                break;
        }
    }
}
Ejemplo n.º 2
0
function images()
{
    global $gallerymessage, $max_upload_image_size, $prefix;
    $out = "<h2>{$gallerymessage['7']}</h2>\n<hr />\n<div align=\"center\">\n";
    if ($_GET['do'] == "gallery" && $_GET['action'] == "delete" && $_GET['name'] != "") {
        $out .= deleteimage($_GET['name']);
    }
    if ($_GET['do'] == "gallery" && $_GET['action'] == "deletegal" && $_GET['name'] != "") {
        $galleryname = $_GET['name'];
        $out .= "<h4 style=\"color: red;\">" . $gallerymessage[3] . "{$galleryname}?</h4>\n";
        $out .= "<p>{$gallerymessage['4']}</p>\n";
        $out .= "<form method=\"post\" action=\"\">\n";
        $out .= "<input type=\"hidden\" name=\"name\" value=\"{$galleryname}\" />\n";
        $out .= "<input type=\"hidden\" name=\"submit\" value=\"Delete Gallery\" />\n";
        $out .= "<input type=\"submit\" name=\"aaa\" value=\"" . $gallerymessage[5] . "\" />\n";
        $out .= "</form>\n";
    }
    $out .= "<h3>{$gallerymessage['8']}</h3>\n";
    if ($maxfilesize == "") {
        $maxfilesize = 200000;
    }
    if ($thumbnailwidth == "") {
        $thumbnailwidth = 100;
    }
    if (file_exists("./addons/gallery/settings.php")) {
        require_once "./addons/gallery/settings.php";
    }
    $out .= "<form method=\"post\" action=\"\">\n";
    $out .= "<table><tr><td>{$gallerymessage['9']}&nbsp;</td><td><input type=\"text\" name=\"maxfilesize\" value=\"{$maxfilesize}\" /></td></tr>\n";
    $out .= "<tr><td>{$gallerymessage['10']}&nbsp;</td><td><input type=\"text\" name=\"thumbnailwidth\" value=\"{$thumbnailwidth}\" /></td></tr>\n";
    $out .= "<tr><td><input type=\"hidden\" name=\"submit\" value=\"Submit Settings\" /></td><td><input type=\"submit\" name=\"aaa\" value=\"{$gallerymessage['11']}\" /></td></tr>\n";
    $out .= "</table>\n</form>\n<hr />\n";
    $out .= "<form enctype=\"multipart/form-data\" method=\"post\" action=\"\">\n<fieldset style=\"border: 0;\">\n";
    $out .= "<h3>{$gallerymessage['58']}</h3>\n";
    $out .= "<input type=\"hidden\" name=\"MAX_FILE_SIZE\" value=\"{$maxfilesize}\" />\n";
    $out .= "<table>\n";
    $out .= "<tr><td>{$gallerymessage['60']}</td><td><input type=\"text\" name=\"imagename\" value=\"\" style=\"width: 100%\" /></td></tr>\n";
    $out .= "<tr><td>" . $gallerymessage[59] . ":</td><td><input name=\"uploadedfile\" type=\"file\" />\n</td></tr>\n";
    $out .= "<tr><td>" . $gallerymessage[61] . ":</td><td>";
    $out .= "<select name=\"gal\">\n";
    $folder = "./galeries";
    $files = filelist('/./', $folder, 1);
    foreach ($files as $file) {
        if ($file != ".." && $file != ".") {
            $out .= '<option value="' . $file . "\">" . $file . "&nbsp;</option>\n";
        }
    }
    $out .= "</select>\n</td></tr>\n";
    $out .= "<tr><td></td><td>";
    $out .= "<input type=\"hidden\" name=\"submit\" value=\"Upload image\" />";
    $out .= "<input type=\"submit\" name=\"aaa\" value=\"" . $gallerymessage[58] . "\" /></td>";
    $out .= "</tr>\n</table>\n</fieldset>\n</form>\n<hr /><h3>" . $gallerymessage[62] . "</h3>\n";
    $out .= "<form method=\"post\" action=\"\">\n<fieldset style=\"border: 0;\">\n";
    $out .= "<table>\n<tr><td>{$gallerymessage['117']}:</td>\n<td>";
    $out .= "<input name=\"galeryname\" type=\"text\" value=\"\" />\n</td></tr>\n";
    $out .= "<tr><td><input type=\"hidden\" name=\"submit\" value=\"Create Gallery\" /></td>\n<td>";
    $out .= "<input type=\"submit\" name=\"aa\" value=\"{$gallerymessage['62']}\" /></td>";
    $out .= "</tr></table>\n</fieldset>\n</form>\n<hr />\n";
    $out .= "<h3>" . $gallerymessage[148] . " " . $gallerymessage[176] . "</h3>\n";
    $files = filelist('/./', $folder, 1);
    $none = true;
    foreach ($files as $file) {
        if ($none) {
            $none = false;
            $out .= "<table>";
        }
        if ($file != ".." && $file != ".") {
            $out .= "<tr>";
            $out .= "<td><a href=\"" . $_SERVER["SCRIPT_NAME"] . "?do=gallery&amp;action=deletegal&amp;name={$file}\">";
            $out .= "<img src=\"./images/editdelete.png\" alt=\"delete\" title=\"Delete gallery {$file}\" align=\"left\" border=\"0\" /></a></td>";
            $out .= "<td>" . $file . "</td></tr>\n";
        }
    }
    if (!$none) {
        $out .= "</table>\n";
    }
    $out .= "<hr /><h3>" . $gallerymessage[148] . " " . $gallerymessage[38] . "</h3>\n";
    $out .= "<table>\n";
    $folder = "./galeries";
    $files = filelist('/./', $folder, 1);
    $gal = 0;
    foreach ($files as $file) {
        if ($gal == 0) {
            $out .= "\n<form method=\"post\" name=\"galery\" action=\"\">\n";
            $out .= "<select onchange=\"document.galery.submit();\" name=\"selectgal\">\n";
            $first = $file;
        }
        $gal++;
        $out .= "<option value=\"" . $file . "\"";
        if ($_POST['selectgal'] == $file) {
            $out .= " selected";
        }
        $out .= ">" . $file . "&nbsp;</option>\n";
    }
    if ($gal > 0) {
        $out .= "</select></form>\n<br /><br />\n";
        if ($_POST['selectgal'] != "") {
            $file = $_POST['selectgal'];
        } else {
            $file = $first;
        }
        $folder1 = "./galeries/" . $file;
        $file1 = filelist("/./", $folder1);
        foreach ($file1 as $fil) {
            $out .= "<tr><td><a href=\"" . $_SERVER["SCRIPT_NAME"] . "?do=gallery&amp;action=delete&amp;name={$folder1}/{$fil}\">";
            $out .= "<img src=\"./images/editdelete.png\" alt=\"delete\" title=\"Delete {$fil}\" align=\"left\" border=\"0\" /></a></td>";
            $thumb = createThumb($folder1 . "/" . $fil, "thumbs/", 100);
            if ($row = fetch_array(dbquery("SELECT * FROM " . $prefix . "images WHERE file=\"" . basename($thumb) . "\""))) {
                $filename = decode($row['name']);
            } else {
                $filename = $thumb;
            }
            $out .= "<td>{$filename}</td>";
            $out .= "<td align=\"center\" >";
            $out .= "<img src=\"thumbs/{$thumb}\"  alt=\"{$filename}\"  title=\"{$filename}\" /></td></tr>\n";
        }
    }
    $out .= "</table>\n";
    $out .= "</div>\n";
    return $out;
}