Subversion-Projekte lars-tiefland.content-management

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
1 lars 1
<?php
2
 
3
    /**
4
     * @package   Content-management
5
     * @author    Webagentur Niewerth <tiefland@weban.de>
6
     * @copyright 2011 Webagentur Niewerth
7
     * @license   propietary http://www.weban.de
8
     * @version   $Rev: 769 $
9
     * @filesource
10
     *
11
     */
12
 
13
    /**
14
     *
15
     * @package   Content-management
16
     * @author    Webagentur Niewerth <tiefland@weban.de>
17
     * @copyright 2011 Webagentur Niewerth
18
     */
19
 
20
    // SVN: $Id: getImages.php 769 2011-10-28 07:51:49Z tiefland $
21
 
22
    require_once "../toolbox/common.php";
23
 
24
    $folder = Weban_Utils::clean_global_input( "folder", "get" );
25
    $a_id=Weban_Utils::clean_global_input("a_id","get","int");
26
    $start_folder = $webs["verzeichnis"] . "/images/upload/";
27
    $real_folder = $start_folder;
28
    if ( $folder )
29
    {
30
        $folder .= "/";
31
        $real_folder .= $folder;
32
    }
33
    if ( !file_exists( $real_folder ) )
34
    {
35
        mkdir( $real_folder, 0755, true );
36
    }
37
    $dh = opendir( $real_folder );
38
    while ( $entry = readdir( $dh ) )
39
    {
40
        if ( $entry == "." || !is_dir( $real_folder . $entry ) || in_array( $entry,
41
            array( "kl", "mini", "gr" ) ) )
42
        {
43
            continue;
44
        } elseif ( $entry == ".." )
45
        {
46
            $f_array = explode( "/", $folder );
47
            unset( $f_array[count( $f_array ) - 2], $f_array[count( $f_array ) -
48
                1] );
49
            $ret[] = $f_array[count( $f_array ) - 2];
50
        } elseif ( $folder )
51
        {
52
            $ret[] = $folder . $entry;
53
        }
54
        else
55
        {
56
            $ret[] = $entry;
57
        }
58
    }
59
    $images = getImages( $folder );
60
    $GLOBALS["ui"]->assign( "a_id", $a_id );
61
    $GLOBALS["ui"]->assign( "images", $images );
62
    $GLOBALS["ui"]->assign( "folders", $ret );
63
    $GLOBALS["ui"]->display( "get_images.tpl" );
64
 
65
    function getImages( $folder )
66
    {
67
        global $webs, $site_full;
68
        $sql = "SELECT
69
                *
70
            FROM
71
                bilder
72
            WHERE
73
                folder='$folder'
74
        ";
75
        $res = mysql_query( $sql );
76
        while ( $row = mysql_fetch_assoc( $res ) )
77
        {
78
            $row["url"] = "http://www.$site_full/images/upload/" . $row["folder"] .
79
                $row["name"];
80
            $row["url_mini"] = "http://www.$site_full/images/upload/" . $row["folder"] .
81
                "mini/" . $row["name"];
82
            $row["path_mini"] = $webs["verzeichnis"] . "/images/upload/" . $row["folder"] .
83
                "mini/" . $row["name"];
84
            $row["path"] = $webs["verzeichnis"] . "/images/upload/" . $row["folder"] .
85
                $row["name"];
86
            $row["size"] = filesize( $row["path"] );
87
            $row["img_size"] = GetImageSize( $row["path"] );
88
            $ret[] = $row;
89
        }
90
        return $ret;
91
    }
92
?>