Subversion-Projekte lars-tiefland.content-management

Revision

Blame | Letzte Änderung | Log anzeigen | RSS feed

<?php

    /**
     * @package   Content-management
     * @author    Webagentur Niewerth <tiefland@weban.de>
     * @copyright 2011 Webagentur Niewerth
     * @license   propietary http://www.weban.de
     * @version   $Rev: 769 $
     * @filesource
     * 
     */

    /**
     * 
     * @package   Content-management
     * @author    Webagentur Niewerth <tiefland@weban.de>
     * @copyright 2011 Webagentur Niewerth
     */

    // SVN: $Id: getImages.php 769 2011-10-28 07:51:49Z tiefland $

    require_once "../toolbox/common.php";

    $folder = Weban_Utils::clean_global_input( "folder", "get" );
    $a_id=Weban_Utils::clean_global_input("a_id","get","int");
    $start_folder = $webs["verzeichnis"] . "/images/upload/";
    $real_folder = $start_folder;
    if ( $folder )
    {
        $folder .= "/";
        $real_folder .= $folder;
    }
    if ( !file_exists( $real_folder ) )
    {
        mkdir( $real_folder, 0755, true );
    }
    $dh = opendir( $real_folder );
    while ( $entry = readdir( $dh ) )
    {
        if ( $entry == "." || !is_dir( $real_folder . $entry ) || in_array( $entry,
            array( "kl", "mini", "gr" ) ) )
        {
            continue;
        } elseif ( $entry == ".." )
        {
            $f_array = explode( "/", $folder );
            unset( $f_array[count( $f_array ) - 2], $f_array[count( $f_array ) -
                1] );
            $ret[] = $f_array[count( $f_array ) - 2];
        } elseif ( $folder )
        {
            $ret[] = $folder . $entry;
        }
        else
        {
            $ret[] = $entry;
        }
    }
    $images = getImages( $folder );
    $GLOBALS["ui"]->assign( "a_id", $a_id );
    $GLOBALS["ui"]->assign( "images", $images );
    $GLOBALS["ui"]->assign( "folders", $ret );
    $GLOBALS["ui"]->display( "get_images.tpl" );

    function getImages( $folder )
    {
        global $webs, $site_full;
        $sql = "SELECT
                *
            FROM
                bilder
            WHERE
                folder='$folder'
        ";
        $res = mysql_query( $sql );
        while ( $row = mysql_fetch_assoc( $res ) )
        {
            $row["url"] = "http://www.$site_full/images/upload/" . $row["folder"] .
                $row["name"];
            $row["url_mini"] = "http://www.$site_full/images/upload/" . $row["folder"] .
                "mini/" . $row["name"];
            $row["path_mini"] = $webs["verzeichnis"] . "/images/upload/" . $row["folder"] .
                "mini/" . $row["name"];
            $row["path"] = $webs["verzeichnis"] . "/images/upload/" . $row["folder"] .
                $row["name"];
            $row["size"] = filesize( $row["path"] );
            $row["img_size"] = GetImageSize( $row["path"] );
            $ret[] = $row;
        }
        return $ret;
    }
?>