Example #1
0
$query = $database->query($sql);
if ($query->numRows()) {
    while ($result = $query->fetchRow()) {
        // Falls es das Vorschaubild noch nicht gibt:
        //Chio Start
        $bildfilename = $result['file_name'];
        $file = $pathToFolder . $bildfilename;
        if (!is_file(DirectoryHandler::DecodePath($file))) {
            $deletesql = 'DELETE FROM ' . TABLE_PREFIX . 'mod_foldergallery_files WHERE id=' . $result['id'];
            $database->query($deletesql);
            continue;
        }
        $file = $pathToFolder . $bildfilename;
        $thumb = $pathToThumb . $bildfilename;
        if (!is_file(DirectoryHandler::DecodePath($thumb))) {
            FG_createThumb($file, $bildfilename, $pathToThumb, $settings['tbSettings']);
        }
        //Chio Ende
        $bilder[] = array('id' => $result['id'], 'file_name' => $bildfilename, 'caption' => $result['caption'], 'thumb_link' => $urlToThumb . $bildfilename);
    }
} else {
    // Diese Kategorie enthält noch keine Bilder
    $error['noimages'] = 1;
}
//Template
$t = new Template(dirname(__FILE__) . '/templates', 'remove');
$t->set_file('modify_cat', 'modify_cat.htt');
// clear the comment-block, if present
$t->set_block('modify_cat', 'CommentDoc');
$t->clear_var('CommentDoc');
// set other blocks
Example #2
0
    exit;
}
// Move the image and create the thumb:
$handle = new upload($_FILES['Filedata']['tmp_name']);
if ($handle->uploaded) {
    // Save the image in the right categorie
    $handle->file_new_name_body = $filename;
    $handle->file_new_name_ext = $extension;
    $handle->process(DirectoryHandler::DecodePath($categoriePath));
    if (!$handle->processed) {
        echo DirectoryHandler::DecodePath($categoriePath);
        exit;
    }
    $handle->clean();
    // Create the thumb
    $success = FG_createThumb($categoriePath . $filename . '.' . $extension, $filename . '.' . $extension, $categoriePath . 'fg-thumbs/', $settings['tbSettings']);
    if (!$success) {
        exit;
    }
} else {
    exit;
}
// get DB infos
$sql = 'SELECT position FROM `' . TABLE_PREFIX . 'mod_foldergallery_files` WHERE `parent_id`= ' . $cat_id . ' ORDER BY `position` DESC LIMIT 1;';
$query = $database->query($sql);
$result = $query->fetchRow();
$newPosition = $result['position'] + 1;
//Insert to db
$sql = 'INSERT INTO `' . TABLE_PREFIX . 'mod_foldergallery_files` (`parent_id`, `file_name`, `position`) VALUES ( \'' . $cat_id . '\' , \'' . $filename . '.' . $extension . '\' , \'' . $newPosition . '\');';
$query = $database->query($sql);
$sql = 'SELECT id FROM `' . TABLE_PREFIX . 'mod_foldergallery_files` WHERE `parent_id` = ' . $cat_id . ' AND `position` = ' . $newPosition . ';';