Beispiel #1
0
/**
 * file manager center start
 *
 * @since 1.2.1
 * @deprecated 2.0.0
 *
 * @package Redaxscript
 * @category Modules
 * @author Henry Ruhs
 */
function file_manager_center_start()
{
    if (LOGGED_IN == TOKEN && FIRST_PARAMETER == 'admin' && SECOND_PARAMETER == 'file-manager') {
        if (THIRD_PARAMETER == 'upload') {
            file_manager_upload(FILE_MANAGER_DIRECTORY);
        } else {
            if (THIRD_PARAMETER == 'delete') {
                if (TOKEN_PARAMETER == '') {
                    $error = l('token_incorrect');
                } else {
                    /* file manager directory object */
                    $file_manager_directory = new Redaxscript\Directory(FILE_MANAGER_DIRECTORY);
                    $file_manager_directory_string = $file_manager_directory->get(ID_PARAMETER);
                    /* remove related children */
                    $file_manager_directory->remove($file_manager_directory_string);
                }
            }
        }
        /* handle error */
        if ($error) {
            notification(l('error_occurred'), $error, l('back'), 'admin/file-manager');
        } else {
            file_manager(FILE_MANAGER_DIRECTORY);
        }
    }
}
Beispiel #2
0
/**
 * gallery
 *
 * @since 2.0.2
 * @deprecated 2.0.0
 *
 * @package Redaxscript
 * @category Modules
 * @author Henry Ruhs
 *
 * @param string $directory
 * @param array $options
 * @param string $command
 */
function gallery($directory = '', $options = '', $command = '')
{
    global $gallery_counter;
    /* define option variables */
    if (is_array($options)) {
        foreach ($options as $key => $value) {
            $key = 'option_' . $key;
            ${$key} = $value;
        }
    } else {
        if ($options === 'build' || $options === 'delete') {
            $command = $options;
        }
    }
    /* gallery directory object */
    $gallery_directory = new Redaxscript\Directory();
    $gallery_directory->init($directory, 'thumbs');
    $gallery_directory_array = $gallery_directory->getArray();
    /* reverse order */
    if ($option_order == 'desc') {
        $gallery_directory_array = array_reverse($gallery_directory_array);
    }
    /* delete gallery thumbs directory */
    if ($command == 'delete') {
        $gallery_directory->remove('thumbs');
    } else {
        /* collect gallery */
        $gallery_total = count($gallery_directory_array);
        $gallery_id = str_replace('/', '_', $directory) . '_' . ++$gallery_counter;
        if ($gallery_total) {
            foreach ($gallery_directory_array as $value) {
                $path = $directory . '/' . $value;
                $thumb_route = $directory . '/thumbs/' . $value;
                /* build thumb */
                if (file_exists($thumb_route) == '' || $command == 'build') {
                    gallery_build_thumb($value, $directory, $options);
                }
                if (file_exists($thumb_route)) {
                    /* read exif data */
                    $image_data = exif_read_data($path);
                    if ($image_data) {
                        $image_artist = $image_data['Artist'];
                        $image_datetime = $image_data['DateTime'];
                        if ($image_datetime) {
                            $image_date = date(s('date'), strtotime($image_datetime));
                        } else {
                            $image_date = '';
                        }
                        $image_description = $image_data['ImageDescription'];
                    }
                    /* build data string */
                    $data_string = 'data-counter="' . ++$image_counter . '" data-total="' . $gallery_total . '" data-id="' . $gallery_id . '"';
                    if ($image_artist) {
                        $data_string .= ' data-artist="' . $image_artist . '"';
                    }
                    if ($image_date) {
                        $data_string .= ' data-date="' . $image_date . '"';
                    }
                    if ($image_description) {
                        $data_string .= ' data-description="' . $image_description . '"';
                        $alt_string = ' alt="' . $image_description . '"';
                    } else {
                        $alt_string = ' alt="' . str_replace('_', ' ', pathinfo($value, PATHINFO_FILENAME)) . '"';
                    }
                    /* collect image output */
                    $image = '<img src="' . $thumb_route . '" class="image image_gallery"' . $alt_string . ' />';
                    $output .= '<li class="item_gallery">' . anchor_element('', '', 'link_gallery', $image, $path, $image_description, $data_string) . '</li>';
                }
            }
            /* collect list output */
            if ($output) {
                $output = '<ul id="' . $gallery_id . '" class="js_list_gallery list_gallery ' . $gallery_id . ' clearfix">' . $output . '</ul>';
                echo $output;
            }
        } else {
            $gallery_directory->remove('thumbs');
        }
    }
}