HomeHelpTrac

source: tags/6.1/media_gallery.php @ 10242

Revision 10242, 5.0 KB checked in by Alexander Trofimov, 3 years ago (diff)

dolphin 6.1.5, initial commit

Line 
1<?php
2
3/***************************************************************************
4*                            Dolphin Smart Community Builder
5*                              -----------------
6*     begin                : Mon Mar 23 2006
7*     copyright            : (C) 2006 BoonEx Group
8*     website              : http://www.boonex.com/
9* This file is part of Dolphin - Smart Community Builder
10*
11* Dolphin is free software. This work is licensed under a Creative Commons Attribution 3.0 License.
12* http://creativecommons.org/licenses/by/3.0/
13*
14* Dolphin is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
15* without even the implied warranty of  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
16* See the Creative Commons Attribution 3.0 License for more details.
17* You should have received a copy of the Creative Commons Attribution 3.0 License along with Dolphin,
18* see license.txt file; if not, write to marketing@boonex.com
19***************************************************************************/
20
21require_once( 'inc/header.inc.php' );
22require_once( BX_DIRECTORY_PATH_INC . 'design.inc.php' );
23require_once( BX_DIRECTORY_PATH_INC . 'profiles.inc.php' );
24require_once( BX_DIRECTORY_PATH_INC . 'utils.inc.php' );
25require_once( BX_DIRECTORY_PATH_ROOT . 'profilePhotos.php' );
26require_once( BX_DIRECTORY_PATH_CLASSES . 'BxDolMedia.php' );
27
28
29// --------------- page variables and login
30
31$img_num = $pic_num;
32
33$_page['name_index']    = 62;
34$_page['css_name']      = 'upload_media.css';
35
36
37if ( !( $logged['admin'] = member_auth( 1, false ) ) )
38{
39    if ( !( $logged['member'] = member_auth( 0, false ) ) )
40    {
41        if ( !( $logged['aff'] = member_auth( 2, false )) )
42        {
43            $logged['moderator'] = member_auth( 3, false );
44        }
45    }
46}
47
48
49$_page['header'] = _t( "_MEDIA_GALLERY_H" );
50$_page['header_text'] = _t( "_MEDIA_GALLERY_H" );
51
52// --------------- GET/POST actions
53
54$ID = (int)$_REQUEST['ID'];
55$member['ID'] = (int)$_COOKIE['memberID'];
56
57$_ni = $_page['name_index'];
58$_page_cont[$_ni]['page_main_code'] = getPageMainCode();
59
60// --------------- [END] page components
61
62PageCode();
63
64// --------------- page components functions
65
66function getPageMainCode()
67{
68    global $oTemplConfig;
69    $ret = '';
70
71    $aPhotoConf = array();
72    $aPhotoConf['profileID'] = (int)$_REQUEST['ID'];
73    $aPhotoConf['visitorID'] = (int)$_COOKIE['memberID'];
74    $aPhotoConf['isOwner'] = ( $aPhotoConf['profileID'] == $aPhotoConf['visitorID'] ) ? true : false;
75
76    $check_res = checkAction( $aPhotoConf['visitorID'], ACTION_ID_USE_GALLERY );
77    if ( $check_res[CHECK_ACTION_RESULT] != CHECK_ACTION_RESULT_ALLOWED )
78    {
79        $ret = '
80            <table width="100%" cellpadding="4" cellspacing="4" border="0">
81                <tr>
82                    <td align="center">' . $check_res[CHECK_ACTION_MESSAGE] . '</td>
83                </tr>
84            </table>';
85        return $ret;
86    }
87
88    $oMedia = new BxDolMedia();
89    $oMedia -> iProfileID = $aPhotoConf['profileID'];
90    $oMedia -> sMediaType =  (isset($_REQUEST['show'])) ? $_REQUEST['show'] : 'video';
91    $oMedia -> BxDolMedia();
92    $oMedia -> getActiveMediaArray();
93   
94    $ret .= ProfileDetails( $oMedia -> iProfileID );
95    $ret .= '<div class="clear_both"></div>';
96   
97    if( $oTemplConfig -> customize['media_gallery']['showMediaTabs'] )
98    {
99        $ret .= '<div class="choiseBlock">';
100            $ret .= getMediaTabs( $oMedia -> sMediaType, $oMedia -> aMediaConfig );
101        $ret .= '</div>';
102    }
103   
104    //print_r( $oMedia -> aMedia);
105    $i = 1;
106    foreach( $oMedia -> aMedia as $aValue )
107    {
108        $ret .= '<div class="mediaBlock">';
109            $ret .= '<div class="mediaTitleVA">';
110                $ret .= process_line_output($aValue['med_title'] );
111            $ret .= '</div>' . "\n";
112            $ret .= '<div class="mediaActions">';
113                $ret .= '<span>';
114                    $ret .= '<a href="' . $oMedia -> getMediaLink( $aValue ) . '">';
115                        $ret .= _t('_download');
116                    $ret .= '</a>';
117                $ret .= '</span>';
118                /*
119                $ret .= '<span>';
120                    $ret .= '<a href="' . $_SERVER['PHP_SELF'] . '?show=' . $oMedia -> sMediaType . '&amp;action=delete&amp;mediaID=' . $aValue['med_id'] . '">';
121                        $ret .= _t('_delete');
122                    $ret .= '</a>';
123                $ret .= '</span>';
124                */
125            $ret .= '</div>' . "\n";
126        $ret .= '</div>' . "\n";
127
128        if( $i >= $oMedia -> aMediaConfig['max'][$oMedia -> sMediaType] )
129        {
130            break;
131        }
132        $i ++;
133    }
134    $ret .= '';
135
136    return  $ret;
137}
138
139function getMediaTabs( $show = 'video', $aMediaConf )
140{
141    $aItems = array( 'audio', 'video' );
142/*
143    echo '<hr>';
144    print_r($aMediaConf);
145    echo '<hr>';
146    */
147    foreach( $aItems as $sItem )
148    {
149        if( $aMediaConf['enable'][$sItem] )
150        {
151            if( $sItem == $show )
152            {
153                $ret .= '<div class="item">';
154                    $ret .= '<div class="active">';
155                        $ret .= _t('_' . $sItem . '');
156                    $ret .= '</div>';
157                $ret .= '</div>';
158            }
159            else
160            {
161                $ret .= '<div class="item">';
162                    $ret .= '<div class="passive" onmouseover="this.className=\'hover\'" onmouseout="this.className=\'passive\'">';
163                        $ret .= '<a href="' . $_SERVER['PHP_SELF'] . '?ID=' . $aMediaConf['profile']['ID'] . '&amp;show=' . $sItem . '">' . _t('_' . $sItem . '') . '</a>';
164                    $ret .= '</div>';
165                $ret .= '</div>';
166            }
167        }
168        else
169        {
170            $ret .= '';
171        }
172    }
173
174    return $ret;
175}
176
177
178?>
Note: See TracBrowser for help on using the repository browser.