40. File Comparison Report

Produced on Wed Jun 18 08:01:45 2008 UTC. This report uses XHTML and CSS2, and is best viewed with a reasonably standards compliant browser such as the latest version of Firefox or Internet Explorer. For optimum results when printing this report, use landscape orientation and enable printing of background images and colours in your browser.

40.1 Files compared

# Location File Last Modified
1 Dolphin-v.6.1.1\inc\classes BxDolSharedMedia.php Sun May 11 13:17:00 2008 UTC
2 Dolphin-v.6.1.2\inc\classes BxDolSharedMedia.php Tue Jun 10 05:45:23 2008 UTC

40.2 Comparison summary

Description Between
Files 1 and 2
Text Blocks Lines
Unchanged 10 2534
Changed 6 14
Inserted 3 6
Removed 0 0

40.3 Comparison options

Whitespace All differences in whitespace within lines are ignored
Character case Differences in character case are significant
Line endings Differences in line endings (CR and LF characters) are ignored
CR/LF characters Not shown in the comparison detail

40.4 Active regular expressions

No regular expressions were active.

40.5 Comparison detail

1   <?   1   <?
2   require_on ce(BX_DIRE CTORY_PATH _INC . 'he ader.inc.p hp' );   2   require_on ce(BX_DIRE CTORY_PATH _INC . 'he ader.inc.p hp' );
3   require_on ce(BX_DIRE CTORY_PATH _INC . 'db .inc.php') ;   3   require_on ce(BX_DIRE CTORY_PATH _INC . 'db .inc.php') ;
4   require_on ce(BX_DIRE CTORY_PATH _INC . 'de sign.inc.p hp');   4   require_on ce(BX_DIRE CTORY_PATH _INC . 'de sign.inc.p hp');
5   require_on ce(BX_DIRE CTORY_PATH _INC . 'ut ils.inc.ph p');   5   require_on ce(BX_DIRE CTORY_PATH _INC . 'ut ils.inc.ph p');
6   require_on ce(BX_DIRE CTORY_PATH _ROOT . "t emplates/t mpl_{$tmpl }/scripts/ BxTemplVot ingView.ph p" );   6   require_on ce(BX_DIRE CTORY_PATH _ROOT . "t emplates/t mpl_{$tmpl }/scripts/ BxTemplVot ingView.ph p" );
7   require_on ce(BX_DIRE CTORY_PATH _ROOT . "t emplates/t mpl_{$tmpl }/scripts/ BxTemplCmt sView.php"  );   7   require_on ce(BX_DIRE CTORY_PATH _ROOT . "t emplates/t mpl_{$tmpl }/scripts/ BxTemplCmt sView.php"  );
8     8  
9   class BxDo lSharedMed ia {   9   class BxDo lSharedMed ia {
10          10       
11       // can  be music,  photo, vi deo   11       // can  be music,  photo, vi deo
12       var $s Type;   12       var $s Type;
13     13  
14       // nam e of css f ile   14       // nam e of css f ile
15       var $s CssName;   15       var $s CssName;
16          16       
17       // vie wer ID   17       // vie wer ID
18       var $i Viewer;   18       var $i Viewer;
19       // vie wer passwo rd   19       // vie wer passwo rd
20       var $s ViewerPass ;   20       var $s ViewerPass ;
21          21       
22       // con fig dir ar ray - copy  of global  $dir arra y   22       // con fig dir ar ray - copy  of global  $dir arra y
23       var $a ConfigDir;   23       var $a ConfigDir;
24          24       
25       // con fig site a rray - cop y of globa l $dir arr ay   25       // con fig site a rray - cop y of globa l $dir arr ay
26       var $a ConfigSite ;   26       var $a ConfigSite ;
27          27       
28       // pat h to media  files   28       // pat h to media  files
29       var $s FilesPath;   29       var $s FilesPath;
30          30       
31       // URL  to media  files   31       // URL  to media  files
32       var $s FilesUrl;   32       var $s FilesUrl;
33          33       
34       // per malink par ametername   34       // per malink par ametername
35       var $s PrLinkPar;   35       var $s PrLinkPar;
36          36       
37       // nam e of secti on's main  table   37       // nam e of secti on's main  table
38       var $s MainTable;   38       var $s MainTable;
39          39       
40       // nam e of main  table's fi elds   40       // nam e of main  table's fi elds
41       var $a TableField s;   41       var $a TableField s;
42          42       
43       // nam e of comme nts table   43       // nam e of comme nts table
44       var $s CommentsTa ble;   44       var $s CommentsTa ble;
45          45       
46       // nam e of favor ite table   46       // nam e of favor ite table
47       var $s FavoriteTa ble;   47       var $s FavoriteTa ble;
48          48       
49       // act ions array   49       // act ions array
50       var $a MainAction s = array(   50       var $a MainAction s = array(
51           'F ave'  => a rray('icon '=>'action _fave.gif' ,  'link'= >'javascri pt:void(0) ;', 'onCli ck'=>'acti on=favorit e__fileID_ _'),   51           'F ave'  => a rray('icon '=>'action _fave.gif' ,  'link'= >'javascri pt:void(0) ;', 'onCli ck'=>'acti on=favorit e__fileID_ _'),
52           'S hare' => a rray('icon '=>'action _share.gif ', 'link'= >'javascri pt:void(0) ;', 'onCli ck'=>'acti on=share__ fileID____ fileUrl__' ),   52           'S hare' => a rray('icon '=>'action _share.gif ', 'link'= >'javascri pt:void(0) ;', 'onCli ck'=>'acti on=share__ fileID____ fileUrl__' ),
53           'R eport'=> a rray('icon '=>'action _report.gi f','link'= >'javascri pt:void(0) ;', 'onCli ck'=>'acti on=report_ _fileID___ _fileUrl__ ')   53           'R eport'=> a rray('icon '=>'action _report.gi f','link'= >'javascri pt:void(0) ;', 'onCli ck'=>'acti on=report_ _fileID___ _fileUrl__ ')
54       );   54       );
55          55       
56       // add on actions  array   56       // add on actions  array
57       var $a AddActions ;   57       var $a AddActions ;
58          58       
59       // mem bership ac tion for v iew file   59       // mem bership ac tion for v iew file
60       var $s ViewAction Name;   60       var $s ViewAction Name;
61          61       
62       // arr ay of edit ed fields   62       // arr ay of edit ed fields
63       var $a Info;   63       var $a Info;
64          64       
65       /*   65       /*
66           co nstructor   66           co nstructor
67           *  @param str ing $sMedi aType - ty pe of appl ication   67           *  @param str ing $sMedi aType - ty pe of appl ication
68           *  @param aSi te $iFile    - ID of  a file   68           *  @param aSi te $iFile    - ID of  a file
69           *  @param int  $iFile -  ID of a fi le   69           *  @param int  $iFile -  ID of a fi le
70           *  @param int  $iFile -  ID of a fi le     70           *  @param int  $iFile -  ID of a fi le  
71           *  @return ar ray   71           *  @return ar ray
72       */   72       */
73          73       
74       functi on BxDolSh aredMedia( $sMediaTyp e, &$aSite , &$aDir,  &$aMember)  {   74       functi on BxDolSh aredMedia( $sMediaTyp e, &$aSite , &$aDir,  &$aMember)  {
75           $s MediaType  = process_ db_input($ sMediaType );   75           $s MediaType  = process_ db_input($ sMediaType );
76           $s Name = ucf irst($sMed iaType);   76           $s Name = ucf irst($sMed iaType);
77              77           
78           $t his->aConf igSite = $ aSite;   78           $t his->aConf igSite = $ aSite;
79           $t his->aConf igDir  = $ aDir;   79           $t his->aConf igDir  = $ aDir;
80     80  
81           $t his->sType        = $ sMediaType ;   81           $t his->sType        = $ sMediaType ;
82           $t his->sCssN ame    = ' view'.$sNa me.'.css';   82           $t his->sCssN ame    = ' view'.$sNa me.'.css';
83           $t his->iView er     = ( int)$aMemb er['ID'];   83           $t his->iView er     = ( int)$aMemb er['ID'];
84           $t his->sView erPass = $ aMember['P assword'];   84           $t his->sView erPass = $ aMember['P assword'];
85              85           
86           $t his->sComm entsTable  = 'CmtsSha red'.$sNam e;   86           $t his->sComm entsTable  = 'CmtsSha red'.$sNam e;
87           $t his->sFavo riteTable  = 'share'. $sName.'Fa vorites';   87           $t his->sFavo riteTable  = 'share'. $sName.'Fa vorites';
88              88           
89           $t his->aEdit Info = arr ay('medPro fId'=>'',  'medTitle' =>'Title',  'medTags' =>'Tags',  'medDesc'= >'Descript ion', 'med Uri'=>'');   89           $t his->aEdit Info = arr ay('medPro fId'=>'',  'medTitle' =>'Title',  'medTags' =>'Tags',  'medDesc'= >'Descript ion', 'med Uri'=>'');
90     90  
91              91           
92           sw itch($sMed iaType) {   92           sw itch($sMed iaType) {
93                case 'ph oto':   93                case 'ph oto':
94                    $thi s->sPrLink Par = 'per malinks_ga llery_phot os';   94                    $thi s->sPrLink Par = 'per malinks_ga llery_phot os';
95                    $thi s->sFilesP ath = $thi s->aConfig Dir['shari ngImages'] ;   95                    $thi s->sFilesP ath = $thi s->aConfig Dir['shari ngImages'] ;
96                    $thi s->sFilesU rl  = $thi s->aConfig Site['shar ingImages' ];   96                    $thi s->sFilesU rl  = $thi s->aConfig Site['shar ingImages' ];
97                    $thi s->sMainTa ble = 'sha rePhotoFil es';   97                    $thi s->sMainTa ble = 'sha rePhotoFil es';
98                       98                    
99                    $thi s->sViewAc tionName =  ACTION_ID _VIEW_GALL ERY_PHOTO;   99                    $thi s->sViewAc tionName =  ACTION_ID _VIEW_GALL ERY_PHOTO;
100                       100                    
101                    $thi s->aTableF ields = ar ray(   101                    $thi s->aTableF ields = ar ray(
102                         'medID'     => 'medID ',   102                         'medID'     => 'medID ',
103                         'medProfId '=> 'medPr ofId',   103                         'medProfId '=> 'medPr ofId',
104                         'medExt'    => 'medEx t',   104                         'medExt'    => 'medEx t',
105                         'medTitle'  => 'medTi tle',   105                         'medTitle'  => 'medTi tle',
106                         'medUri'    => 'medUr i',   106                         'medUri'    => 'medUr i',
107                         'medDesc'   => 'medDe sc',   107                         'medDesc'   => 'medDe sc',
108                         'medTags'   => 'medTa gs',   108                         'medTags'   => 'medTa gs',
109                         'medDate'   => 'medDa te',   109                         'medDate'   => 'medDa te',
110                         'medViews'  => 'medVi ews',   110                         'medViews'  => 'medVi ews',
111                         'Approved'  => 'Appro ved'   111                         'Approved'  => 'Appro ved'
112                    );   112                    );
113                       113                    
114                    $thi s->aAddAct ions = arr ay(   114                    $thi s->aAddAct ions = arr ay(
115                         'Original_ Size'=>arr ay( 'icon' =>'action_ download.g if','link' =>$this->s FilesUrl.' __file__', 'onClick'= >'', 'add'  => 'targe t="_blank" ')   115                         'Original_ Size'=>arr ay( 'icon' =>'action_ download.g if','link' =>$this->s FilesUrl.' __file__', 'onClick'= >'', 'add'  => 'targe t="_blank" ')
116                    );   116                    );
117                       117                    
118                    brea k;   118                    brea k;
119                       119                    
120                case 'mu sic':   120                case 'mu sic':
121                    $thi s->sPrLink Par = 'per malinks_ga llery_musi c';   121                    $thi s->sPrLink Par = 'per malinks_ga llery_musi c';
122                    $sAd dPath          = 'ray /modules/m usic/files /';   122                    $sAd dPath          = 'ray /modules/m usic/files /';
123                    $thi s->sFilesP ath = BX_D IRECTORY_P ATH_ROOT .  $sAddPath ;   123                    $thi s->sFilesP ath = BX_D IRECTORY_P ATH_ROOT .  $sAddPath ;
124                    $thi s->sFilesU rl  = $thi s->aConfig Site['url' ] . $sAddP ath;   124                    $thi s->sFilesU rl  = $thi s->aConfig Site['url' ] . $sAddP ath;
125                    $thi s->sMainTa ble = 'Ray MusicFiles ';   125                    $thi s->sMainTa ble = 'Ray MusicFiles ';
126                       126                    
127                    $thi s->sViewAc tionName =  ACTION_ID _VIEW_GALL ERY_MUSIC;   127                    $thi s->sViewAc tionName =  ACTION_ID _VIEW_GALL ERY_MUSIC;
128                           128                        
129                    $thi s->aTableF ields = ar ray(   129                    $thi s->aTableF ields = ar ray(
130                         'medID'     => 'ID',   130                         'medID'     => 'ID',
131                         'medProfId '=> 'Owner ',   131                         'medProfId '=> 'Owner ',
132                         'medTitle'  => 'Title ',   132                         'medTitle'  => 'Title ',
133                         'medUri'    => 'Uri',   133                         'medUri'    => 'Uri',
134                         'medDesc'   => 'Descr iption',   134                         'medDesc'   => 'Descr iption',
135                         'medTags'   => 'Tags' ,   135                         'medTags'   => 'Tags' ,
136                         'medDate'   => 'Date' ,   136                         'medDate'   => 'Date' ,
137                         'medViews'  => 'Liste ns',   137                         'medViews'  => 'Liste ns',
138                         'Approved'  => 'Appro ved'   138                         'Approved'  => 'Appro ved'
139                    );   139                    );
140                       140                    
141                    brea k;     141                    brea k;  
142                   142                
143                case 'vi deo':   143                case 'vi deo':
144                    $thi s->sPrLink Par = 'per malinks_ga llery_vide os';   144                    $thi s->sPrLink Par = 'per malinks_ga llery_vide os';
145                    $sAd dPath          = 'ray /modules/m ovie/files /';   145                    $sAd dPath          = 'ray /modules/m ovie/files /';
146                    $thi s->sFilesP ath = BX_D IRECTORY_P ATH_ROOT .  $sAddPath ;   146                    $thi s->sFilesP ath = BX_D IRECTORY_P ATH_ROOT .  $sAddPath ;
147                    $thi s->sFilesU rl  = $thi s->aConfig Site['url' ] . $sAddP ath;   147                    $thi s->sFilesU rl  = $thi s->aConfig Site['url' ] . $sAddP ath;
148                    $thi s->sMainTa ble = 'Ray MovieFiles ';   148                    $thi s->sMainTa ble = 'Ray MovieFiles ';
149     149  
150                    $thi s->sViewAc tionName =  ACTION_ID _VIEW_GALL ERY_VIDEO;   150                    $thi s->sViewAc tionName =  ACTION_ID _VIEW_GALL ERY_VIDEO;
151                       151                    
152                    $thi s->aTableF ields = ar ray(   152                    $thi s->aTableF ields = ar ray(
153                         'medID'     => 'ID',   153                         'medID'     => 'ID',
154                         'medProfId '=> 'Owner ',   154                         'medProfId '=> 'Owner ',
155                         'medTitle'  => 'Title ',   155                         'medTitle'  => 'Title ',
156                         'medUri'    => 'Uri',   156                         'medUri'    => 'Uri',
157                         'medDesc'   => 'Descr iption',   157                         'medDesc'   => 'Descr iption',
158                         'medTags'   => 'Tags' ,   158                         'medTags'   => 'Tags' ,
159                         'medDate'   => 'Date' ,   159                         'medDate'   => 'Date' ,
160                         'medViews'  => 'Views ',   160                         'medViews'  => 'Views ',
161                         'Approved'  => 'Appro ved'   161                         'Approved'  => 'Appro ved'
162                    );   162                    );
163                       163                    
164                    brea k;     164                    brea k;  
165           }   165           }
166       }   166       }
167          167       
168       /*   168       /*
169           Ge t info abo ut file fr om corresp onding med ia table   169           Ge t info abo ut file fr om corresp onding med ia table
170           *  @param int  $iFile -  ID of a fi le   170           *  @param int  $iFile -  ID of a fi le
171           *  @return ar ray $aFile   171           *  @return ar ray $aFile
172       */   172       */
173          173       
174       functi on getFile Info($iFil e) {   174       functi on getFile Info($iFil e) {
175           $i File = (in t)$iFile;   175           $i File = (in t)$iFile;
176              176           
177           $s qlQuery =  "SELECT ";   177           $s qlQuery =  "SELECT ";
178           fo reach ($th is->aTable Fields as  $sKey=>$sV al) {   178           fo reach ($th is->aTable Fields as  $sKey=>$sV al) {
179                $sqlQuer y .= "`{$t his->sMain Table}`.`$ sVal` as ` $sKey`, ";   179                $sqlQuer y .= "`{$t his->sMain Table}`.`$ sVal` as ` $sKey`, ";
180           }   180           }
181              181           
182           $s qlQuery .=  "    182           $s qlQuery .=  " 
183                    COUN T(`share1` .`{$this-> aTableFiel ds['medID' ]}`) as `m edCount`,    183                    COUN T(`share1` .`{$this-> aTableFiel ds['medID' ]}`) as `m edCount`, 
184                    `Pro files`.`Ni ckName`   184                    `Pro files`.`Ni ckName`
185                FROM `{$ this->sMai nTable}`   185                FROM `{$ this->sMai nTable}`
186                LEFT JOI N `{$this- >sMainTabl e}` as `sh are1` USIN G (`{$this ->aTableFi elds['medP rofId']}`)   186                LEFT JOI N `{$this- >sMainTabl e}` as `sh are1` USIN G (`{$this ->aTableFi elds['medP rofId']}`)
187                INNER JO IN `Profil es` ON `Pr ofiles`.`I D`=`{$this ->sMainTab le}`.`{$th is->aTable Fields['me dProfId']} `   187                INNER JO IN `Profil es` ON `Pr ofiles`.`I D`=`{$this ->sMainTab le}`.`{$th is->aTable Fields['me dProfId']} `
188                WHERE `{ $this->sMa inTable}`. `{$this->a TableField s['medID'] }` = $iFil e   188                WHERE `{ $this->sMa inTable}`. `{$this->a TableField s['medID'] }` = $iFil e
189                GROUP BY  `share1`. `{$this->a TableField s['medProf Id']}`   189                GROUP BY  `share1`. `{$this->a TableField s['medProf Id']}`
190                ";   190                ";
191              191           
192           $a File = db_ arr($sqlQu ery);    192           $a File = db_ arr($sqlQu ery); 
193              193           
194           re turn $aFil e;   194           re turn $aFil e;
195       }   195       }
196          196       
197       /*   197       /*
198           Sh ow media f ile   198           Sh ow media f ile
199           *  @param int  $iFile -  ID of a fi le   199           *  @param int  $iFile -  ID of a fi le
200           *  @return st ring $sCod e - html o utput   200           *  @return st ring $sCod e - html o utput
201       */   201       */
202          202       
203       functi on showFil e($iFile)  {   203       functi on showFil e($iFile)  {
204           $i File = (in t)$iFile;   204           $i File = (in t)$iFile;
205           $s Code = '';   205           $s Code = '';
206              206           
207           sw itch ($thi s->sType)  {   207           sw itch ($thi s->sType)  {
208                case 'ph oto':   208                case 'ph oto':
209                    $aFi le  = $thi s->getFile Info($iFil e);   209                    $aFi le  = $thi s->getFile Info($iFil e);
210                    $sIm age = $thi s->sFilesU rl.$iFile. '_m.'.$aFi le[$this-> aTableFiel ds['medExt ']];   210                    $sIm age = $thi s->sFilesU rl.$iFile. '_m.'.$aFi le[$this-> aTableFiel ds['medExt ']];
211                    $sCo de  = '<di v id="view File" styl e="backgro und-image:  url(\''.$ sImage.'\' )">&nbsp;< /div>';   211                    $sCo de  = '<di v id="view File" styl e="backgro und-image:  url(\''.$ sImage.'\' )">&nbsp;< /div>';
212                    brea k;   212                    brea k;
213                case 'mu sic':   213                case 'mu sic':
214                    $sCo de  = '<di v class="v iewFile" s tyle="text -align:cen ter;">'.ge tApplicati onContent( 'music','p layer',arr ay('id'=>$ iFile,'pas sword'=>$t his->sView erPass,'vI d'=>$this- >iViewer,' song'=>'tr ue'),true) .'</div>';   214                    $sCo de  = '<di v class="v iewFile" s tyle="text -align:cen ter;">'.ge tApplicati onContent( 'music','p layer',arr ay('id'=>$ iFile,'pas sword'=>$t his->sView erPass,'vI d'=>$this- >iViewer,' song'=>'tr ue'),true) .'</div>';
215                    brea k;   215                    brea k;
216                case 'vi deo':   216                case 'vi deo':
217                    $sCo de  = '<di v class="v iewFile" s tyle="text -align:cen ter;">'.ge tApplicati onContent( 'movie','p layer',arr ay('id' =>  $iFile, ' file' => ' true'),tru e).'</div> ';   217                    $sCo de  = '<di v class="v iewFile" s tyle="text -align:cen ter;">'.ge tApplicati onContent( 'movie','p layer',arr ay('id' =>  $iFile, ' file' => ' true'),tru e).'</div> ';
218                    brea k;   218                    brea k;
219           }   219           }
220              220           
221           re turn $sCod e;   221           re turn $sCod e;
222       }   222       }
223          223       
224       /*   224       /*
225           Sh ow file in fo block   225           Sh ow file in fo block
226           *  @param arr ay aFile -  file info  array   226           *  @param arr ay aFile -  file info  array
227           *  @return st ring $sCod e - html o utput   227           *  @return st ring $sCod e - html o utput
228       */   228       */
229          229       
230       functi on showFil eInfo($aFi le) {   230       functi on showFil eInfo($aFi le) {
231           $s Title = st rlen($aFil e['medTitl e']) > 0 ?  $aFile['m edTitle']  : _t("_Unt itled");   231           $s Title = st rlen($aFil e['medTitl e']) > 0 ?  $aFile['m edTitle']  : _t("_Unt itled");
232           $i Time  = de fineTimeIn terval($aF ile['medDa te']);   232           $i Time  = de fineTimeIn terval($aF ile['medDa te']);
233              233           
234           $s NumberAlt  = _t("_Vie ws");   234           $s NumberAlt  = _t("_Vie ws");
235              235           
236           sw itch ($thi s->sType)  {   236           sw itch ($thi s->sType)  {
237                case 'ph oto':   237                case 'ph oto':
238                    $sVi ew = _t("_ Photos");   238                    $sVi ew = _t("_ Photos");
239                     $sEmbedCod e   =  
$this->sFi lesUrl.$aF ile['medID '].'.'.$aF ile['medEx t']
;
  239                     $sEmbedCod e   =   '<img   src="'. $this->sFi lesUrl.$aF ile['medID '].'.'.$aF ile['medEx t'] .'">' ;
240                    brea k;   240                    brea k;
241                case 'mu sic':   241                case 'mu sic':
242                    $sVi ew = _t("_ Music file s");   242                    $sVi ew = _t("_ Music file s");
243                    $sNu mberAlt =  _t("_Playb acks");   243                    $sNu mberAlt =  _t("_Playb acks");
244                    $sEm bedCode =  getEmbedCo de('music' , 'player' , array('i d'=>$aFile ['medID'], 'song'=>'t rue'));   244                    $sEm bedCode =  getEmbedCo de('music' , 'player' , array('i d'=>$aFile ['medID'], 'song'=>'t rue'));
245                    brea k;   245                    brea k;
246                case 'vi deo':   246                case 'vi deo':
247                    $sVi ew = _t("_ Videos");   247                    $sVi ew = _t("_ Videos");
248                    $sEm bedCode =  getEmbedCo de('movie' , 'player' , array('f ile'=>$aFi le['medID' ]));   248                    $sEm bedCode =  getEmbedCo de('movie' , 'player' , array('f ile'=>$aFi le['medID' ]));
249                    brea k;   249                    brea k;
250           }   250           }
251              251           
252              252           
253           if  ($aFile[' medCount']  - 1 > 0)   253           if  ($aFile[' medCount']  - 1 > 0)
254                $sLinkMo re = '<a h ref="'.$th is->getMor eFilesUrl( $aFile['me dProfId'],  $aFile['N ickName']) .'">'.$aFi le['medCou nt'].'</a> ';   254                $sLinkMo re = '<a h ref="'.$th is->getMor eFilesUrl( $aFile['me dProfId'],  $aFile['N ickName']) .'">'.$aFi le['medCou nt'].'</a> ';
255           el se   255           el se
256                $sLinkMo re = $aFil e['medCoun t'];   256                $sLinkMo re = $aFil e['medCoun t'];
257           ob _start();   257           ob _start();
258           ?>   258           ?>
259           <d iv id="vid eoInfo">   259           <d iv id="vid eoInfo">
260                <div id= "fileTop">   260                <div id= "fileTop">
261                    <div  class="fi leTitle">< ?=$sTitle? ></div>   261                    <div  class="fi leTitle">< ?=$sTitle? ></div>
262                    <div  class="us erPic">   262                    <div  class="us erPic">
263                         <?=get_mem ber_icon($ aFile['med ProfId'],' left')?>   263                         <?=get_mem ber_icon($ aFile['med ProfId'],' left')?>
264                    </di v>   264                    </di v>
265                    <div  class="fi leUserInfo ">   265                    <div  class="fi leUserInfo ">
266                         <a href="< ?=getProfi leLink($aF ile['medPr ofId'])?>" ><?=$aFile ['NickName ']?></a>   266                         <a href="< ?=getProfi leLink($aF ile['medPr ofId'])?>" ><?=$aFile ['NickName ']?></a>
267                    </di v>   267                    </di v>
268                    <div >   268                    <div >
269                         <?=$sView? >: <b><?=$ sLinkMore? ></b>   269                         <?=$sView? >: <b><?=$ sLinkMore? ></b>
270                    </di v>   270                    </di v>
271                </div>   271                </div>
272                <div cla ss="clear_ both"></di v>   272                <div cla ss="clear_ both"></di v>
273                <div id= "serviceIn fo">   273                <div id= "serviceIn fo">
274                    <div >   274                    <div >
275                         <?=_t("_Ad ded")?>: < b><?=defin eTimeInter val($aFile ['medDate' ])?></b>   275                         <?=_t("_Ad ded")?>: < b><?=defin eTimeInter val($aFile ['medDate' ])?></b>
276                    </di v>   276                    </di v>
277                    <div >   277                    <div >
278                         <?=$sNumbe rAlt?>: <? =$aFile['m edViews']? >   278                         <?=$sNumbe rAlt?>: <? =$aFile['m edViews']? >
279                    </di v>   279                    </di v>
280                    <div >   280                    <div >
281                         <?=_t("_UR L")?>:    281                         <?=_t("_UR L")?>: 
282                         <input typ e="text" o nClick="th is.focus() ; this.sel ect();" re adonly="tr ue" value= "<?=$this- >getFileUr l($aFile[' medID'], $ aFile['med Uri'])?>"/ >   282                         <input typ e="text" o nClick="th is.focus() ; this.sel ect();" re adonly="tr ue" value= "<?=$this- >getFileUr l($aFile[' medID'], $ aFile['med Uri'])?>"/ >
283                    </di v>   283                    </di v>
284                    <div >   284                    <div >
285                         <?=_t("_Em bed")?>:    285                         <?=_t("_Em bed")?>: 
286                         <input typ e="text" o nClick="th is.focus() ; this.sel ect();" re adonly="tr ue" value= "<?=htmlsp ecialchars ($sEmbedCo de)?>"/>   286                         <input typ e="text" o nClick="th is.focus() ; this.sel ect();" re adonly="tr ue" value= "<?=htmlsp ecialchars ($sEmbedCo de)?>"/>
287                    </di v>   287                    </di v>
288                    <div >   288                    <div >
289                         <?=_t("_Ta gs")?>:    289                         <?=_t("_Ta gs")?>: 
290                         <?=$this-> getTagLink s($aFile[' medTags']) ?>   290                         <?=$this-> getTagLink s($aFile[' medTags']) ?>
291                    </di v>   291                    </di v>
292                    <div >   292                    <div >
293                         <?=_t("_De scriptionM edia")?>:    293                         <?=_t("_De scriptionM edia")?>: 
294                         <?=$aFile[ 'medDesc'] ?>   294                         <?=$aFile[ 'medDesc'] ?>
295                    </di v>   295                    </di v>
296                </div>   296                </div>
297           </ div>   297           </ div>
298           <?   298           <?
299           $s Code = ob_ get_clean( );   299           $s Code = ob_ get_clean( );
300              300           
301           re turn $sCod e;   301           re turn $sCod e;
302       }   302       }
303          303       
304       /*   304       /*
305           Pe rmalink ch eckin   305           Pe rmalink ch eckin
306           *  @return tr ue of fals e   306           *  @return tr ue of fals e
307       */   307       */
308          308       
309       functi on isPerma linkEnable d() {   309       functi on isPerma linkEnable d() {
310           re turn isset ($this->_i sPermalink Enabled) ?  $this->_i sPermalink Enabled :  ($this->_i sPermalink Enabled =  (getParam( $this->sPr LinkPar) = = 'on'));   310           re turn isset ($this->_i sPermalink Enabled) ?  $this->_i sPermalink Enabled :  ($this->_i sPermalink Enabled =  (getParam( $this->sPr LinkPar) = = 'on'));
311       }   311       }
312          312       
313       /*   313       /*
314           Ge t media fi le URL   314           Ge t media fi le URL
315           *  @param int  $iFileId  - ID of fi le   315           *  @param int  $iFileId  - ID of fi le
316           *  @param str ing $sFile Uri - Uri  of file   316           *  @param str ing $sFile Uri - Uri  of file
317           *  @return st ring $sLin k - full U RL of file  page   317           *  @return st ring $sLin k - full U RL of file  page
318       */   318       */
319          319       
320       functi on getFile Url($iFile Id, $sFile Uri) {   320       functi on getFile Url($iFile Id, $sFile Uri) {
321           if  ($this->i sPermalink Enabled())   321           if  ($this->i sPermalink Enabled())
322                $sLink =  $this->sT ype.'/gall ery/'.$sFi leUri;   322                $sLink =  $this->sT ype.'/gall ery/'.$sFi leUri;
323           el se   323           el se
324                $sLink =  'view'.uc first($thi s->sType). '.php?file ID='.$iFil eId;   324                $sLink =  'view'.uc first($thi s->sType). '.php?file ID='.$iFil eId;
325     325  
326           re turn $GLOB ALS['site' ]['url'].$ sLink;   326           re turn $GLOB ALS['site' ]['url'].$ sLink;
327       }   327       }
328          328       
329        /*   329        /*
330           Ge t more fil e from thi s user URL   330           Ge t more fil e from thi s user URL
331           *  @param int  $iUserId  - user ID   331           *  @param int  $iUserId  - user ID
332           *  @param str ing $sNick Name - fie l NickName   332           *  @param str ing $sNick Name - fie l NickName
333           *  @return st ring $sLin kMoreUrl -  full URL  of file pa ge   333           *  @return st ring $sLin kMoreUrl -  full URL  of file pa ge
334       */   334       */
335     335  
336       functi on getMore FilesUrl($ iUserId, $ sNickName)  {   336       functi on getMore FilesUrl($ iUserId, $ sNickName)  {
337           if  ($this->i sPermalink Enabled())   337           if  ($this->i sPermalink Enabled())
338                $sLinkMo reUrl = $t his->sType .'/gallery /all/'.$sN ickName;   338                $sLinkMo reUrl = $t his->sType .'/gallery /all/'.$sN ickName;
339           el se   339           el se
340                $sLinkMo reUrl = 'b rowse'.ucf irst($this ->sType).' .php?userI D='.$iUser Id;   340                $sLinkMo reUrl = 'b rowse'.ucf irst($this ->sType).' .php?userI D='.$iUser Id;
341          341       
342           re turn $sLin kMoreUrl;   342           re turn $sLin kMoreUrl;
343       }   343       }
344          344       
345       /*   345       /*
346           Ge t tags URL   346           Ge t tags URL
347           *  @param str ing $sTagL ist - all  tags of fi le   347           *  @param str ing $sTagL ist - all  tags of fi le
348           *  @param str ing $sNick Name - fie l NickName   348           *  @param str ing $sNick Name - fie l NickName
349           *  @return st ring $sLin kMoreUrl -  full URL  of file pa ge   349           *  @return st ring $sLin kMoreUrl -  full URL  of file pa ge
350       */   350       */
351          351       
352       functi on getTagL inks($sTag List) {   352       functi on getTagL inks($sTag List) {
353           if  (strlen($ sTagList))  {   353           if  (strlen($ sTagList))  {
354                $aTags =  explode('  ', $sTagL ist);   354                $aTags =  explode('  ', $sTagL ist);
355                foreach  ($aTags as  $iKey =>  $sVal) {   355                foreach  ($aTags as  $iKey =>  $sVal) {
356                    $sVa l   = trim ($sVal,',' );   356                    $sVa l   = trim ($sVal,',' );
357                    $sLi nk = $this ->isPermal inkEnabled () ? $this ->sType.'/ gallery_ta g/'.$sVal  : 'browse' .ucfirst($ this->sTyp e).'.php?t ag='.$sVal ;   357                    $sLi nk = $this ->isPermal inkEnabled () ? $this ->sType.'/ gallery_ta g/'.$sVal  : 'browse' .ucfirst($ this->sTyp e).'.php?t ag='.$sVal ;
358                    $sCo de .= '<a  href="'.$G LOBALS['si te']['url' ].$sLink.' ">'.$sVal. '</a> ';   358                    $sCo de .= '<a  href="'.$G LOBALS['si te']['url' ].$sLink.' ">'.$sVal. '</a> ';
359                }   359                }
360           }   360           }
361              361           
362           re turn $sCod e;   362           re turn $sCod e;
363       }   363       }
364          364       
365       /*    365       /* 
366           Sh ow rate se ction   366           Sh ow rate se ction
367           *  @param int  $iFile -  file ID   367           *  @param int  $iFile -  file ID
368           *  return $sC ode - html  output   368           *  return $sC ode - html  output
369              369           
370       */   370       */
371          371       
372       functi on showRat eSection($ iFile) {   372       functi on showRat eSection($ iFile) {
373           $s Code = '<c enter>' .  _t('_Galle ry video r ating is n ot enabled ') . '</ce nter>';   373           $s Code = '<c enter>' .  _t('_Galle ry video r ating is n ot enabled ') . '</ce nter>';
374          374       
375           $o VotingView  = new BxT emplVoting View ('g'. $this->sTy pe, (int)$ iFile);   375           $o VotingView  = new BxT emplVoting View ('g'. $this->sTy pe, (int)$ iFile);
376           if ( $oVoting View->isEn abled())   376           if ( $oVoting View->isEn abled())
377                $sCode =  $oVotingV iew->getBi gVoting () ;   377                $sCode =  $oVotingV iew->getBi gVoting () ;
378     378  
379           re turn $sCod e;   379           re turn $sCod e;
380       }   380       }
381          381       
382       /*   382       /*
383           Sh ow another  latest fi les from u ser   383           Sh ow another  latest fi les from u ser
384           *  @param arr ay $aFile  - current  file info   384           *  @param arr ay $aFile  - current  file info
385           *  return $sC ode - html  output   385           *  return $sC ode - html  output
386       */   386       */
387     387  
388       functi on showLat estFiles($ aFile) {   388       functi on showLat estFiles($ aFile) {
389           $i Limit  = 2 ;   389           $i Limit  = 2 ;
390           $s Code   = ' ';   390           $s Code   = ' ';
391           $s qlBody = ' ';   391           $s qlBody = ' ';
392     392  
393           $s NumberAlt  = _t("_Vie ws");   393           $s NumberAlt  = _t("_Vie ws");
394              394           
395           $s HeadTempl  = '<div cl ass="lastF ilesPic">   395           $s HeadTempl  = '<div cl ass="lastF ilesPic">
396                                 <a  href="__l ink__">__i mage__</a>   396                                 <a  href="__l ink__">__i mage__</a>
397                            </div>' ;   397                            </div>' ;
398              398           
399              399           
400           sw itch ($thi s->sType)  {   400           sw itch ($thi s->sType)  {
401                case 'ph oto':   401                case 'ph oto':
402                    $sMo reFilesAlt  = _t("_Se e all phot os of this  user");   402                    $sMo reFilesAlt  = _t("_Se e all phot os of this  user");
403                    $sHe adTempl =  '<a href=" __link__"> __image__< /a>';   403                    $sHe adTempl =  '<a href=" __link__"> __image__< /a>';
404                    $sIm age = '<im g class="l astFilesPi c"   404                    $sIm age = '<im g class="l astFilesPi c"
405                     sty le="backgr ound-image : url(\''. $this->sFi lesUrl.'__ image__\') ;" src="'. getTemplat eIcon( 'sp acer.gif'  ) . '" />' ;   405                     sty le="backgr ound-image : url(\''. $this->sFi lesUrl.'__ image__\') ;" src="'. getTemplat eIcon( 'sp acer.gif'  ) . '" />' ;
406                    brea k;   406                    brea k;
407                case 'mu sic':   407                case 'mu sic':
408                    $sMo reFilesAlt  = _t("_Se e all musi c of this  user");   408                    $sMo reFilesAlt  = _t("_Se e all musi c of this  user");
409                    $sNu mberAlt     = _t("_Pl aybacks");   409                    $sNu mberAlt     = _t("_Pl aybacks");
410                    $sIm age = '<im g src="'.$ this->aCon figSite['i mages'].'m usic.png"> ';   410                    $sIm age = '<im g src="'.$ this->aCon figSite['i mages'].'m usic.png"> ';
411                    brea k;   411                    brea k;
412                case 'vi deo':   412                case 'vi deo':
413                    $sMo reFilesAlt  = _t("_Se e all vide os of this  user");   413                    $sMo reFilesAlt  = _t("_Se e all vide os of this  user");
414                    $sIm age = '<im g src="'.$ this->sFil esUrl.'__i mage___sma ll.jpg">';   414                    $sIm age = '<im g src="'.$ this->sFil esUrl.'__i mage___sma ll.jpg">';
415                    brea k;   415                    brea k;
416           }   416           }
417              417           
418           if  ($aFile[' medCount']  - 1 > $iL imit)   418           if  ($aFile[' medCount']  - 1 > $iL imit)
419                $sLinkMo re = '<a h ref="'.$th is->getMor eFilesUrl( $aFile['me dProfId'],  $aFile['N ickName']) .'">'.$sMo reFilesAlt .'</a>';   419                $sLinkMo re = '<a h ref="'.$th is->getMor eFilesUrl( $aFile['me dProfId'],  $aFile['N ickName']) .'">'.$sMo reFilesAlt .'</a>';
420              420           
421           fo reach ($th is->aTable Fields as  $sKey => $ sVal) {   421           fo reach ($th is->aTable Fields as  $sKey => $ sVal) {
422                $sqlBody  .= "`{$th is->sMainT able}`.`$s Val` as `$ sKey`,";   422                $sqlBody  .= "`{$th is->sMainT able}`.`$s Val` as `$ sKey`,";
423           }   423           }
424           $s qlQuery =  "SELECT ". rtrim($sql Body, ',') ." FROM `{ $this->sMa inTable}`   424           $s qlQuery =  "SELECT ". rtrim($sql Body, ',') ." FROM `{ $this->sMa inTable}`
425                WHERE `{ $this->aTa bleFields[ 'medID']}` <>{$aFile[ 'medID']}    425                WHERE `{ $this->aTa bleFields[ 'medID']}` <>{$aFile[ 'medID']} 
426                  AND `{ $this->aTa bleFields[ 'medProfId ']}`={$aFi le['medPro fId']}   426                  AND `{ $this->aTa bleFields[ 'medProfId ']}`={$aFi le['medPro fId']}
427                  AND `{ $this->aTa bleFields[ 'Approved' ]}`='true'   427                  AND `{ $this->aTa bleFields[ 'Approved' ]}`='true'
428                ORDER BY  `{$this-> aTableFiel ds['medDat e']}` DESC   428                ORDER BY  `{$this-> aTableFiel ds['medDat e']}` DESC
429                LIMIT $i Limit   429                LIMIT $i Limit
430                ";   430                ";
431              431           
432           $r Last = db_ res($sqlQu ery);   432           $r Last = db_ res($sqlQu ery);
433              433           
434           wh ile ($aLas t = mysql_ fetch_asso c($rLast))  {   434           wh ile ($aLas t = mysql_ fetch_asso c($rLast))  {
435                $sImageP att  = iss et($aLast[ 'medExt'])  ? $aLast[ 'medID'].' _t.'.$aLas t['medExt' ] : $aLast ['medID']  ;   435                $sImageP att  = iss et($aLast[ 'medExt'])  ? $aLast[ 'medID'].' _t.'.$aLas t['medExt' ] : $aLast ['medID']  ;
436                $sImageB lock = str _replace(' __image__' , $sImageP att, $sIma ge);   436                $sImageB lock = str _replace(' __image__' , $sImageP att, $sIma ge);
437                $sFileUr l = $this- >getFileUr l($aLast[' medID'], $ aLast['med Uri']);   437                $sFileUr l = $this- >getFileUr l($aLast[' medID'], $ aLast['med Uri']);
438                   438                
439                $sHead =  str_repla ce('__link __', $sFil eUrl, $sHe adTempl);   439                $sHead =  str_repla ce('__link __', $sFil eUrl, $sHe adTempl);
440                $sHead =  str_repla ce('__imag e__', $sIm ageBlock,  $sHead);   440                $sHead =  str_repla ce('__imag e__', $sIm ageBlock,  $sHead);
441                   441                
442                $sTitle  = strlen($ aLast['med Title']) >  0 ? $aLas t['medTitl e'] : _t(" _Untitled" );   442                $sTitle  = strlen($ aLast['med Title']) >  0 ? $aLas t['medTitl e'] : _t(" _Untitled" );
443                $oVoting View = new  BxTemplVo tingView ( 'g'.$this- >sType, $a Last['medI D']);   443                $oVoting View = new  BxTemplVo tingView ( 'g'.$this- >sType, $a Last['medI D']);
444                   444                
445                if( $oVo tingView-> isEnabled( ) ) {   445                if( $oVo tingView-> isEnabled( ) ) {
446                    $sRa te = $oVot ingView->g etSmallVot ing(0);   446                    $sRa te = $oVot ingView->g etSmallVot ing(0);
447                    $sSh owRate = ' <div class ="galleryR ate">'. $s Rate . '</ div>';   447                    $sSh owRate = ' <div class ="galleryR ate">'. $s Rate . '</ div>';
448                }   448                }
449                ob_start ();   449                ob_start ();
450                ?>   450                ?>
451                <div cla ss="lastFi leUnit">   451                <div cla ss="lastFi leUnit">
452                    <?=$ sHead?>   452                    <?=$ sHead?>
453                    <div >   453                    <div >
454                         <a href="< ?=$sFileUr l?>"><b><? =$sTitle?> </b></a>   454                         <a href="< ?=$sFileUr l?>"><b><? =$sTitle?> </b></a>
455                    </di v>   455                    </di v>
456                    <div ><?=_t("_A dded")?>:  <b><?=defi neTimeInte rval($aLas t['medDate '])?></b>< /div>   456                    <div ><?=_t("_A dded")?>:  <b><?=defi neTimeInte rval($aLas t['medDate '])?></b>< /div>
457                    <div ><?=$sNumb erAlt?>: < ?=$aLast[' medViews'] ?></div>   457                    <div ><?=$sNumb erAlt?>: < ?=$aLast[' medViews'] ?></div>
458                    <?=$ sShowRate? >   458                    <?=$ sShowRate? >
459                </div>   459                </div>
460                <div cla ss="clear_ both"></di v>   460                <div cla ss="clear_ both"></di v>
461                <?   461                <?
462                $sCode . = ob_get_c lean();   462                $sCode . = ob_get_c lean();
463           }   463           }
464           $s Code .= '< div class= "lastFiles Link">'.$s LinkMore.' </div>';   464           $s Code .= '< div class= "lastFiles Link">'.$s LinkMore.' </div>';
465              465           
466           re turn $sCod e;   466           re turn $sCod e;
467       }   467       }
468          468       
469       /*   469       /*
470           Sh ow fiel ac tion list   470           Sh ow fiel ac tion list
471           *  @param arr ay $aFile  - current  file info   471           *  @param arr ay $aFile  - current  file info
472           *  return $sC ode - html  output   472           *  return $sC ode - html  output
473       */   473       */
474          474       
475       functi on showAct ionList($a File) {   475       functi on showAct ionList($a File) {
476           if  ($this->i Viewer) {   476           if  ($this->i Viewer) {
477                if ($thi s->sType = ='photo')   477                if ($thi s->sType = ='photo')
478                         $this->aAd dActions[' Original_S ize']['lin k'] = str_ replace('_ _file__',  $aFile['me dID'].'.'. $aFile['me dExt'], $t his->aAddA ctions['Or iginal_Siz e']['link' ]);   478                         $this->aAd dActions[' Original_S ize']['lin k'] = str_ replace('_ _file__',  $aFile['me dID'].'.'. $aFile['me dExt'], $t his->aAddA ctions['Or iginal_Siz e']['link' ]);
479                   479                
480                if ($aFi le['medPro fId'] == $ this->iVie wer) {   480                if ($aFi le['medPro fId'] == $ this->iVie wer) {
481                    $aOt herActions  = array(   481                    $aOt herActions  = array(
482                         'Edit'=>ar ray('icon' =>'edit.gi f', 'link' =>'javascr ipt:void(0 );', 'onCl ick'=>'act ion=edit__ fileID__')   482                         'Edit'=>ar ray('icon' =>'edit.gi f', 'link' =>'javascr ipt:void(0 );', 'onCl ick'=>'act ion=edit__ fileID__')
483                    );   483                    );
484                }   484                }
485                $aAction s = is_arr ay($this-> aAddAction s) ? array _merge($th is->aMainA ctions, $t his->aAddA ctions) :  $this->aMa inActions;   485                $aAction s = is_arr ay($this-> aAddAction s) ? array _merge($th is->aMainA ctions, $t his->aAddA ctions) :  $this->aMa inActions;
486                $aAction s = is_arr ay($aOther Actions)      ? array _merge($aA ctions, $a OtherActio ns) : $aAc tions;   486                $aAction s = is_arr ay($aOther Actions)      ? array _merge($aA ctions, $a OtherActio ns) : $aAc tions;
487                   487                
488                $sOnClic kTempl = " javascript : window.o pen( '{$th is->aConfi gSite['url ']}mediaAc tions.php? {action}',  'photo',  'width=500 , height=3 80, menuba r=no,statu s=no,resiz able=yes,s crollbars= yes,toolba r=no,locat ion=no' ); ";   488                $sOnClic kTempl = " javascript : window.o pen( '{$th is->aConfi gSite['url ']}mediaAc tions.php? {action}',  'photo',  'width=500 , height=3 80, menuba r=no,statu s=no,resiz able=yes,s crollbars= yes,toolba r=no,locat ion=no' ); ";
489                $sCode =  '<div id= "actionLis t">';   489                $sCode =  '<div id= "actionLis t">';
490                foreach  ($aActions  as $sKey  => $aVal)  {   490                foreach  ($aActions  as $sKey  => $aVal)  {
491                    $sTa rget  = is set($aVal[ 'add']) ?  $aVal['add '] : '';   491                    $sTa rget  = is set($aVal[ 'add']) ?  $aVal['add '] : '';
492                    $sOn Click = st rlen($aVal ['onClick' ]) > 0 ? ' onclick="'  . str_rep lace('{act ion}', $aV al['onClic k'], $sOnC lickTempl)  . '"' : ' ' ;   492                    $sOn Click = st rlen($aVal ['onClick' ]) > 0 ? ' onclick="'  . str_rep lace('{act ion}', $aV al['onClic k'], $sOnC lickTempl)  . '"' : ' ' ;
493                       493                    
494                    $sOn Click = st r_replace( '__fileID_ _',  '&amp ;fileID='. $aFile['me dID'].'&am p;type='.$ this->sTyp e, $sOnCli ck);   494                    $sOn Click = st r_replace( '__fileID_ _',  '&amp ;fileID='. $aFile['me dID'].'&am p;type='.$ this->sTyp e, $sOnCli ck);
495                    $sOn Click = st r_replace( '__fileUrl __', '&amp ;fileUrl=' .urlencode ($this->ge tFileUrl($ aFile['med ID'], $aFi le['medUri '])), $sOn Click);   495                    $sOn Click = st r_replace( '__fileUrl __', '&amp ;fileUrl=' .urlencode ($this->ge tFileUrl($ aFile['med ID'], $aFi le['medUri '])), $sOn Click);
496                       496                    
497                    $sCo de .= '<di v><img src ="'.$this- >aConfigSi te['icons' ].$aVal['i con'].'" a lt="'._t(' _'.$sKey). '" /><a hr ef="'.$aVa l['link']. '" '.$sTar get.' '.$s OnClick.'> '._t('_'.$ sKey).'</a ></div>';   497                    $sCo de .= '<di v><img src ="'.$this- >aConfigSi te['icons' ].$aVal['i con'].'" a lt="'._t(' _'.$sKey). '" /><a hr ef="'.$aVa l['link']. '" '.$sTar get.' '.$s OnClick.'> '._t('_'.$ sKey).'</a ></div>';
498                }   498                }
499                $sCode . = '</div>< div class= "clear_bot h"></div>' ;   499                $sCode . = '</div>< div class= "clear_bot h"></div>' ;
500                   500                
501                return $ sCode;   501                return $ sCode;
502           }   502           }
503       }   503       }
504          504       
505       /*   505       /*
506           Ge t several  files info   506           Ge t several  files info
507           *  @param arr ay aCond -  array of  MySQL part s   507           *  @param arr ay aCond -  array of  MySQL part s
508           *  @param arr ay aManage  (if exist s) - array  of exact  fields   508           *  @param arr ay aManage  (if exist s) - array  of exact  fields
509           *  @return re source rDa ta   509           *  @return re source rDa ta
510       */   510       */
511          511       
512       functi on getFile sList($aCo nd = array (), $aMana ge = array ()) {   512       functi on getFile sList($aCo nd = array (), $aMana ge = array ()) {
513           if  (empty($a Manage))   513           if  (empty($a Manage))
514                $aList =  array('me dID', 'med ProfId', ' medTitle',  'medUri',  'medDate' , 'medView s', 'medEx t');   514                $aList =  array('me dID', 'med ProfId', ' medTitle',  'medUri',  'medDate' , 'medView s', 'medEx t');
515           el se   515           el se
516                $aList =  $aManage;   516                $aList =  $aManage;
517     517  
518           $s qlTempl =  "SELECT __ main__ __r ate_fields __ __from_ _ __main_j oin__ __ra te_join__  __where__  __order__  __limit__" ;   518           $s qlTempl =  "SELECT __ main__ __r ate_fields __ __from_ _ __main_j oin__ __ra te_join__  __where__  __order__  __limit__" ;
519              519           
520           $a Sql = arra y(   520           $a Sql = arra y(
521                    '__m ain__'=>''   521                    '__m ain__'=>''
522                    '__r ate_fields __'=>'',   522                    '__r ate_fields __'=>'',
523                    '__f rom__'=>'' ,   523                    '__f rom__'=>'' ,
524                    '__m ain_join__ '=>'',   524                    '__m ain_join__ '=>'',
525                    '__r ate_join__ '=>'',   525                    '__r ate_join__ '=>'',
526                    '__w here__'=>' ',   526                    '__w here__'=>' ',
527                    '__o rder__'=>' ',   527                    '__o rder__'=>' ',
528                    '__l imit__'=>' '   528                    '__l imit__'=>' '
529                );   529                );
530     530  
531              531           
532           fo reach ($aL ist as $sV al) {   532           fo reach ($aL ist as $sV al) {
533                $aSql['_ _main__']  .= key_exi sts($sVal,  $this->aT ableFields ) ? "`{$th is->sMainT able}`.`{$ this->aTab leFields[$ sVal]}` as  `$sVal`,  " : "";   533                $aSql['_ _main__']  .= key_exi sts($sVal,  $this->aT ableFields ) ? "`{$th is->sMainT able}`.`{$ this->aTab leFields[$ sVal]}` as  `$sVal`,  " : "";
534           }   534           }
535           $a Sql['__mai n__'] .= ' `Profiles` .`NickName `';   535           $a Sql['__mai n__'] .= ' `Profiles` .`NickName `';
536              536           
537           if  (isset($a Cond['rate Fields'])  && isset($ aCond['rat eJoin']))  {   537           if  (isset($a Cond['rate Fields'])  && isset($ aCond['rat eJoin']))  {
538                $aSql['_ _rate_fiel ds__'] = $ aCond['rat eFields'];   538                $aSql['_ _rate_fiel ds__'] = $ aCond['rat eFields'];
539                $aSql['_ _rate_join __']   = $ aCond['rat eJoin'];   539                $aSql['_ _rate_join __']   = $ aCond['rat eJoin'];
540           }   540           }
541           $a Sql['__fro m__']       = "FROM ` {$this->sM ainTable}` ";   541           $a Sql['__fro m__']       = "FROM ` {$this->sM ainTable}` ";
542           $a Sql['__mai n_join__']  = "LEFT J OIN `Profi les` ON `P rofiles`.` ID` = `{$t his->sMain Table}`.{$ this->aTab leFields[' medProfId' ]}";   542           $a Sql['__mai n_join__']  = "LEFT J OIN `Profi les` ON `P rofiles`.` ID` = `{$t his->sMain Table}`.{$ this->aTab leFields[' medProfId' ]}";
543           if  (isset($a Cond['sqlW here']))    543           if  (isset($a Cond['sqlW here'])) 
544                $aSql['_ _where__']  = $aCond[ 'sqlWhere' ];   544                $aSql['_ _where__']  = $aCond[ 'sqlWhere' ];
545           if  (isset($a Cond['sqlO rder']))   545           if  (isset($a Cond['sqlO rder']))
546                $aSql['_ _order__']  = $aCond[ 'sqlOrder' ];   546                $aSql['_ _order__']  = $aCond[ 'sqlOrder' ];
547           if  ($aCond[' sqlLimit'] )   547           if  ($aCond[' sqlLimit'] )
548                $aSql['_ _limit__']  = $aCond[ 'sqlLimit' ];   548                $aSql['_ _limit__']  = $aCond[ 'sqlLimit' ];
549                   549                
550           $a Keys    =  array_keys ($aSql);   550           $a Keys    =  array_keys ($aSql);
551           $s qlQuery =  str_replac e($aKeys,  $aSql, $sq lTempl);   551           $s qlQuery =  str_replac e($aKeys,  $aSql, $sq lTempl);
552   //      ec ho "<br/>$ sqlQuery";   552   //      ec ho "<br/>$ sqlQuery";
553           $r Data = db_ res($sqlQu ery);   553           $r Data = db_ res($sqlQu ery);
554     554  
555           re turn $rDat a;   555           re turn $rDat a;
556       }   556       }
557          557       
558       /*   558       /*
559           Sh ow 1 file  in browse   559           Sh ow 1 file  in browse
560           *  @param arr ay $aData  - info arr ay about   560           *  @param arr ay $aData  - info arr ay about
561           *  @param boo lean $bAdm in - admin  mode   561           *  @param boo lean $bAdm in - admin  mode
562           *  @return @s Code - htm l output   562           *  @return @s Code - htm l output
563       */   563       */
564          564       
565       functi on showBro wseUnit($a Data, $bAd min = fals e) {   565       functi on showBro wseUnit($a Data, $bAd min = fals e) {
566           $s Href  = $t his->getFi leUrl($aDa ta['medID' ], $aData[ 'medUri']) ;   566           $s Href  = $t his->getFi leUrl($aDa ta['medID' ], $aData[ 'medUri']) ;
567           $s Title = st rlen($aDat a['medTitl e']) > 0 ?  $aData['m edTitle']  : _t("_Unt itled");   567           $s Title = st rlen($aDat a['medTitl e']) > 0 ?  $aData['m edTitle']  : _t("_Unt itled");
568           $s Views = _t ('_Views') ;   568           $s Views = _t ('_Views') ;
569     569  
570           $s ActionLink s = $this- >iViewer = = $aData[' medProfId' ] ? '<div> <a href="j avascript:  void(0);"   570           $s ActionLink s = $this- >iViewer = = $aData[' medProfId' ] ? '<div> <a href="j avascript:  void(0);"
571                             onClic k="window. open(\''.$ this->aCon figSite['u rl'].'medi aActions.p hp?fileID= '.$aData[' medID'].'& amp;action =edit&amp; type='.$th is->sType. '\',    571                             onClic k="window. open(\''.$ this->aCon figSite['u rl'].'medi aActions.p hp?fileID= '.$aData[' medID'].'& amp;action =edit&amp; type='.$th is->sType. '\', 
572                             \'phot o\', \'wid th=500, he ight=380,  menubar=no ,status=no ,resizable =yes,scrol lbars=yes, toolbar=no ,location= no\');">'   572                             \'phot o\', \'wid th=500, he ight=380,  menubar=no ,status=no ,resizable =yes,scrol lbars=yes, toolbar=no ,location= no\');">'
573                         ._t("_Edit ").'</a></ div><div>< a href="'. $_SERVER[' PHP_SELF'] .'?action= del&fileID ='.$aData[ 'medID'].' "   573                         ._t("_Edit ").'</a></ div><div>< a href="'. $_SERVER[' PHP_SELF'] .'?action= del&fileID ='.$aData[ 'medID'].' "
574                onClick= "return co nfirm( \'' ._t("_are  you sure?" ).'\');">' ._t("_Dele te").'</a> </div>' :  '' ;   574                onClick= "return co nfirm( \'' ._t("_are  you sure?" ).'\');">' ._t("_Dele te").'</a> </div>' :  '' ;
575              575           
576           if  (!$bAdmin ) {   576           if  (!$bAdmin ) {
577                $oVoting View = new  BxTemplVo tingView ( 'g'.$this- >sType, $a Data['medI D']);   577                $oVoting View = new  BxTemplVo tingView ( 'g'.$this- >sType, $a Data['medI D']);
578                if( $oVo tingView-> isEnabled( )) {   578                if( $oVo tingView-> isEnabled( )) {
579                    $sRa te = $oVot ingView->g etSmallVot ing (0);   579                    $sRa te = $oVot ingView->g etSmallVot ing (0);
580                    $sSh owRate = ' <div class ="galleryR ate">'. $s Rate . '</ div>';   580                    $sSh owRate = ' <div class ="galleryR ate">'. $s Rate . '</ div>';
581                }   581                }
582                $sProfLi nk = '<div  class="ad dInfo">'._ t("_By").' : <a href= "'.getProf ileLink($a Data['medP rofId']).' ">'.$aData ['NickName '].'</a></ div>';   582                $sProfLi nk = '<div  class="ad dInfo">'._ t("_By").' : <a href= "'.getProf ileLink($a Data['medP rofId']).' ">'.$aData ['NickName '].'</a></ div>';
583                $sCheck     = '';   583                $sCheck     = '';
584           }   584           }
585           el se {   585           el se {
586                $sShowRa te = '';   586                $sShowRa te = '';
587                $sStyle     = isset ($aData['A pproved'])  && $aData ['Approved '] == 'tru e' ? ' sty le="border : 2px soli d #00CC00; "' : ' sty le="border : 2px soli d #CC0000; "';   587                $sStyle     = isset ($aData['A pproved'])  && $aData ['Approved '] == 'tru e' ? ' sty le="border : 2px soli d #00CC00; "' : ' sty le="border : 2px soli d #CC0000; "';
588                $sProfLi nk = '<div >'._t("_By ").': <a h ref="'.$th is->aConfi gSite['url '].'pedit. php?ID='.$ aData['med ProfId'].' ">'.$aData ['NickName '].'</a></ div>';   588                $sProfLi nk = '<div >'._t("_By ").': <a h ref="'.$th is->aConfi gSite['url '].'pedit. php?ID='.$ aData['med ProfId'].' ">'.$aData ['NickName '].'</a></ div>';
589                $sCheck     = '<div  class="br owseCheckb ox"><input  type="che ckbox" nam e="Check[] " value="' .$aData['m edID'].'"  id="ch'.$a Data['medI D'].'"></d iv>';   589                $sCheck     = '<div  class="br owseCheckb ox"><input  type="che ckbox" nam e="Check[] " value="' .$aData['m edID'].'"  id="ch'.$a Data['medI D'].'"></d iv>';
590           }   590           }
591           sw itch ($thi s->sType)  {   591           sw itch ($thi s->sType)  {
592                case 'ph oto':   592                case 'ph oto':
593                    $sIm g   = $thi s->sFilesU rl.$aData[ 'medID'].' _t.'.$aDat a['medExt' ];   593                    $sIm g   = $thi s->sFilesU rl.$aData[ 'medID'].' _t.'.$aDat a['medExt' ];
594                    $sIm age = '<di v class="l astFilesPi c" style=" background -image: ur l(\''.$sIm g.'\');">   594                    $sIm age = '<di v class="l astFilesPi c" style=" background -image: ur l(\''.$sIm g.'\');">
595                           <a href= "'.$sHref. '"><img sr c="'.$this ->aConfigS ite['image s'].'space r.gif" wid th="110" h eight="110 "></a></di v>';   595                           <a href= "'.$sHref. '"><img sr c="'.$this ->aConfigS ite['image s'].'space r.gif" wid th="110" h eight="110 "></a></di v>';
596                    brea k;   596                    brea k;
597                case 'mu sic':   597                case 'mu sic':
598                    $sIm age = '<di v class="l astFilesPi c"><a href ="'.$sHref .'"><img s rc="'.$thi s->aConfig Site['imag es'].'musi c.png"></a ></div>';   598                    $sIm age = '<di v class="l astFilesPi c"><a href ="'.$sHref .'"><img s rc="'.$thi s->aConfig Site['imag es'].'musi c.png"></a ></div>';
599                    brea k;   599                    brea k;
600                case 'vi deo':   600                case 'vi deo':
601                    $sIm age = '<di v class="l astFilesPi c"><a href ="'.$sHref .'"><img s rc="'.$thi s->sFilesU rl.$aData[ 'medID'].' _small.jpg "></a></di v>';   601                    $sIm age = '<di v class="l astFilesPi c"><a href ="'.$sHref .'"><img s rc="'.$thi s->sFilesU rl.$aData[ 'medID'].' _small.jpg "></a></di v>';
602                    brea k;   602                    brea k;
603           }   603           }
604              604           
605           ob _start();   605           ob _start();
606           ?>   606           ?>
607           <d iv class=" browseUnit "<?=$sStyl e?>>   607           <d iv class=" browseUnit "<?=$sStyl e?>>
608                <?=$sChe ck?>   608                <?=$sChe ck?>
609                <?=$sIma ge?>   609                <?=$sIma ge?>
610                <div cla ss="addInf o">   610                <div cla ss="addInf o">
611                    <a h ref="<?=$s Href?>"><b ><?=$sTitl e?></b></a >   611                    <a h ref="<?=$s Href?>"><b ><?=$sTitl e?></b></a >
612                </div>   612                </div>
613                <?=$sPro fLink?>   613                <?=$sPro fLink?>
614                <div cla ss="addInf o"><?=_t(" _Added")?> : <b><?=de fineTimeIn terval($aD ata['medDa te'])?></b ></div>   614                <div cla ss="addInf o"><?=_t(" _Added")?> : <b><?=de fineTimeIn terval($aD ata['medDa te'])?></b ></div>
615                <div cla ss="addInf o"><?=$sVi ews?>: <b> <?=$aData[ 'medViews' ]?></b></d iv>   615                <div cla ss="addInf o"><?=$sVi ews?>: <b> <?=$aData[ 'medViews' ]?></b></d iv>
616                <?=$sSho wRate.$sAc tionLinks? >   616                <?=$sSho wRate.$sAc tionLinks? >
617           </ div>   617           </ div>
618           <?   618           <?
619           $s Code = ob_ get_clean( );   619           $s Code = ob_ get_clean( );
620              620           
621           re turn $sCod e;   621           re turn $sCod e;
622       }   622       }
623          623       
624       /*   624       /*
625           Sh ow paginat ion for cu rrent brow se page   625           Sh ow paginat ion for cu rrent brow se page
626           *  @param int  $iTotalPa ges - numb er of tota l elements   626           *  @param int  $iTotalPa ges - numb er of tota l elements
627           *  @param int  $iCurPage     - numb er of curr ent browse  page   627           *  @param int  $iCurPage     - numb er of curr ent browse  page
628           *  @param int  $iPerPage     - numb er of tota l elements   628           *  @param int  $iPerPage     - numb er of tota l elements
629           *  @param boo lean $bAdm in  - admi n mode   629           *  @param boo lean $bAdm in  - admi n mode
630              630           
631           *  return $sC ode - html  output   631           *  return $sC ode - html  output
632       */   632       */
633          633       
634       functi on showPag ination($i TotalPages , $iCurPag e, $iPerPa ge = 10, $ bAdmin = f alse) {   634       functi on showPag ination($i TotalPages , $iCurPag e, $iPerPa ge = 10, $ bAdmin = f alse) {
635           $s MainUrl =  '';   635           $s MainUrl =  '';
636           $i TotalPages  = (int)$i TotalPages ;   636           $i TotalPages  = (int)$i TotalPages ;
637           $i CurPage     = (int)$i CurPage;   637           $i CurPage     = (int)$i CurPage;
638           $i PerPage     = (int)$i PerPage;   638           $i PerPage     = (int)$i PerPage;
639              639           
640           $b LinkMode =  $this->is PermalinkE nabled() ?  true : fa lse;   640           $b LinkMode =  $this->is PermalinkE nabled() ?  true : fa lse;
641           $b LinkMode =  $bAdmin ?  false : $ bLinkMode;   641           $b LinkMode =  $bAdmin ?  false : $ bLinkMode;
642           if  ($iTotalP ages > 1)  {   642           if  ($iTotalP ages > 1)  {
643                if ($bLi nkMode) {   643                if ($bLi nkMode) {
644                         $sMainUrl  = $this->s Type.'/all ';   644                         $sMainUrl  = $this->s Type.'/all ';
645                           645                        
646                         $aFields =  array( 'o wnerName',  'tag', 'r ate' );   646                         $aFields =  array( 'o wnerName',  'tag', 'r ate' );
647                   647                
648                         foreach ($ aFields as  $field) {   648                         foreach ($ aFields as  $field) {
649                             if( is set( $_GET [$field] )  ) {   649                             if( is set( $_GET [$field] )  ) {
650                                 $s Param = ht mlentities ( process_ pass_data(  $_GET[$fi eld] ));   650                                 $s Param = ht mlentities ( process_ pass_data(  $_GET[$fi eld] ));
651                                 sw itch ($fie ld) {   651                                 sw itch ($fie ld) {
652                                      case 'ow nerName':   652                                      case 'ow nerName':
653                                          $sMa inUrl = $t his->sType .'/gallery /all/'.$sP aram;   653                                          $sMa inUrl = $t his->sType .'/gallery /all/'.$sP aram;
654                                          brea k;   654                                          brea k;
655                                      case 'ta g':   655                                      case 'ta g':
656                                          $sMa inUrl = $t his->sType .'/gallery _tag/'.$sP aram;   656                                          $sMa inUrl = $t his->sType .'/gallery _tag/'.$sP aram;
657                                          brea k;   657                                          brea k;
658                                      case 'ra te':   658                                      case 'ra te':
659                                          $sMa inUrl = $t his->sType .'/gallery _top';   659                                          $sMa inUrl = $t his->sType .'/gallery _top';
660                                          brea k;   660                                          brea k;
661                                 }   661                                 }
662                             }   662                             }
663                         }   663                         }
664                         $sMainUrl  = $GLOBALS ['site'][' url'].$sMa inUrl;   664                         $sMainUrl  = $GLOBALS ['site'][' url'].$sMa inUrl;
665                         $sReloc =  "'$sMainUr l/' + this .value + ' /$iCurPage '";   665                         $sReloc =  "'$sMainUr l/'+this.v alue+'/$iC urPage'";
666                         $sLinkTemp l = $sMain Url ."/$iP erPage/{pa ge}";   666                         $sLinkTemp l = $sMain Url ."/$iP erPage/{pa ge}";
667                }   667                }
668                else {   668                else {
669                    $sRe quest = $_ SERVER['PH P_SELF'] .  '?';   669                    $sRe quest = $_ SERVER['PH P_SELF'] .  '?';
670              670           
671                    $aFi elds = arr ay('userID ', 'tag',  'rate');   671                    $aFi elds = arr ay('userID ', 'tag',  'rate');
672                    if ( $bAdmin) {   672                    if ( $bAdmin) {
673                         $aFields[]  = 'type';                 673                         $aFields[]  = 'type';              
674                    }   674                    }
675                    fore ach( $aFie lds as $fi eld ) {   675                    fore ach( $aFie lds as $fi eld ) {
676                         if (isset(  $_GET[$fi eld]))    676                         if (isset(  $_GET[$fi eld])) 
677                              $sRequest   .=   "& amp; {$field}="   .   htmlentiti es(   process_pa ss_data(   $_GET[$fie ld]   )   );   677                              $sRequest   .=   "&
{$field}="   .   htmlentiti es(   process_pa ss_data(   $_GET[$fie ld]   )   );
678                    }   678                    }
679                     $sReloc   =   "'$sReques t& amp; page=$iCur Page& amp; per_page='   +   this.value ";   679                     $sReloc   =   "'$sReques t&
page=$iCur Page&
per_page=' +this.valu e";
680                     $sLinkTemp l   =   $sRequest   .   "& amp; page={page }& amp; per_page=$ iPerPage";   680                     $sLinkTemp l   =   $sRequest   .   "&
page={page }&
per_page=$ iPerPage";
681                }   681                }
682                       682                    
683                $sPagina tion = '<d iv style=" text-align : center;  position:  relative;  margin: 10 px 0px;">' ._t("_Resu lts per pa ge").':   683                $sPagina tion = '<d iv style=" text-align : center;  position:  relative;  margin: 10 px 0px;">' ._t("_Resu lts per pa ge").':
684                         <select   name="per_ page"   onchange=" window.loc ation='   .  
$sReloc  
.   ';">
  684                         <select   name="per_ page"   onchange=" window.loc ation='   .   htmlspecia lchars(   $sReloc   )   .   ';">
685                             <optio n value="1 0"' . ( $i PerPage ==  10 ? ' se lected="se lected"' :  '' ) . '> 10</option >   685                             <optio n value="1 0"' . ( $i PerPage ==  10 ? ' se lected="se lected"' :  '' ) . '> 10</option >
686                             <optio n value="2 0"' . ( $i PerPage ==  20 ? ' se lected="se lected"' :  '' ) . '> 20</option >   686                             <optio n value="2 0"' . ( $i PerPage ==  20 ? ' se lected="se lected"' :  '' ) . '> 20</option >
687                             <optio n value="5 0"' . ( $i PerPage ==  50 ? ' se lected="se lected"' :  '' ) . '> 50</option >   687                             <optio n value="5 0"' . ( $i PerPage ==  50 ? ' se lected="se lected"' :  '' ) . '> 50</option >
688                             <optio n value="1 00"' . ( $ iPerPage = = 100 ? '  selected=" selected"'  : '' ) .  '>100</opt ion>   688                             <optio n value="1 00"' . ( $ iPerPage = = 100 ? '  selected=" selected"'  : '' ) .  '>100</opt ion>
689                         </select>< /div>';   689                         </select>< /div>';
690                       690                    
691                $sPagina tion .= ge nPaginatio n( $iTotal Pages, $iC urPage, $s LinkTempl  );   691                $sPagina tion .= ge nPaginatio n( $iTotal Pages, $iC urPage, $s LinkTempl  );
692           }   692           }
693           el se   693           el se
694                return ' ';   694                return ' ';
695           re turn $sPag ination;   695           re turn $sPag ination;
696       }   696       }
697          697       
698       /*   698       /*
699           Ge t list of  media file s for file s   699           Ge t list of  media file s for file s
700           *  @param int  $iUser -  user ID   700           *  @param int  $iUser -  user ID
701           *  @ return s tring $sCo de - html  output   701           *  @ return s tring $sCo de - html  output
702       */   702       */
703          703       
704       functi on getBloc kCode_Shar edMedia($i User = 0)  {   704       functi on getBloc kCode_Shar edMedia($i User = 0)  {
705           $i User   = ( int)$iUser ;   705           $i User   = ( int)$iUser ;
706              706           
707           $a Manage = a rray('medI D','medExt ','medTitl e','medUri ');   707           $a Manage = a rray('medI D','medExt ','medTitl e','medUri ');
708              708           
709           $m ax_num = ( int)getPar am("top_ph otos_max_n um");   709           $m ax_num = ( int)getPar am("top_ph otos_max_n um");
710           $m ode    = p rocess_db_ input( get Param("top _photos_mo de") );   710           $m ode    = p rocess_db_ input( get Param("top _photos_mo de") );
711              711           
712           $m ode = $_GE T['sh_'.$t his->sType .'Mode'];   712           $m ode = $_GE T['sh_'.$t his->sType .'Mode'];
713           if ( $mode !=  'rand' &&  $mode !=  'top' && $ mode != 'l ast')   713           if ( $mode !=  'rand' &&  $mode !=  'top' && $ mode != 'l ast')
714                $mode =  'last';   714                $mode =  'last';
715              715           
716           $a Cond['sqlW here'] = "  WHERE `{$ this->aTab leFields[' Approved'] }`='true'" ;   716           $a Cond['sqlW here'] = "  WHERE `{$ this->aTab leFields[' Approved'] }`='true'" ;
717              717           
718           if  ($iUser ! = 0)   718           if  ($iUser ! = 0)
719                $aCond[' sqlWhere']  .= " AND  `{$this->a TableField s['medProf Id']}`='$i User'";   719                $aCond[' sqlWhere']  .= " AND  `{$this->a TableField s['medProf Id']}`='$i User'";
720              720           
721           $s qlFrom = "  FROM `{$t his->sMain Table}`";   721           $s qlFrom = "  FROM `{$t his->sMain Table}`";
722              722           
723           $a DBTopMenu  = array();   723           $a DBTopMenu  = array();
724            f oreach (ar ray( 'last ', 'top',  'rand' ) a s $myMode)  {   724            f oreach (ar ray( 'last ', 'top',  'rand' ) a s $myMode)  {
725              switch ( $ myMode ) {   725              switch ( $ myMode ) {
726               case 'las t':   726               case 'las t':
727                if( $mod e == $myMo de )   727                if( $mod e == $myMo de )
728                 $aCond[ 'sqlOrder' ] = "   728                 $aCond[ 'sqlOrder' ] = "
729                    ORDE R BY `{$th is->aTable Fields['me dDate']}`  DESC";   729                    ORDE R BY `{$th is->aTable Fields['me dDate']}`  DESC";
730                 $modeTi tle = '_La test';   730                 $modeTi tle = '_La test';
731                 break;   731                 break;
732               case 'ran d':   732               case 'ran d':
733                if( $mod e == $myMo de )   733                if( $mod e == $myMo de )
734                 $aCond[ 'sqlOrder' ] = "   734                 $aCond[ 'sqlOrder' ] = "
735                    ORDE R BY RAND( )";   735                    ORDE R BY RAND( )";
736                 $modeTi tle = '_Ra ndom';   736                 $modeTi tle = '_Ra ndom';
737                 break;   737                 break;
738               case 'top ':   738               case 'top ':
739                if( $mod e == $myMo de ) {   739                if( $mod e == $myMo de ) {
740                    $oVo tingView =  new BxTem plVotingVi ew ('g'.$t his->sType , 0, 0);   740                    $oVo tingView =  new BxTem plVotingVi ew ('g'.$t his->sType , 0, 0);
741                    $aSq l        =  $oVotingV iew->getSq lParts('`' .$this->sM ainTable.' `', '`'.$t his->aTabl eFields['m edID'].'`' );   741                    $aSq l        =  $oVotingV iew->getSq lParts('`' .$this->sM ainTable.' `', '`'.$t his->aTabl eFields['m edID'].'`' );
742                    $sHo w        =  "DESC";   742                    $sHo w        =  "DESC";
743                    $aCo nd['sqlOrd er']   = $ oVotingVie w->isEnabl ed() ? "OR DER BY `vo ting_rate`  $sHow, `v oting_coun t` $sHow,  `{$this->a TableField s['medDate ']}` $sHow " : $aCond ['sqlOrder '] ;   743                    $aCo nd['sqlOrd er']   = $ oVotingVie w->isEnabl ed() ? "OR DER BY `vo ting_rate`  $sHow, `v oting_coun t` $sHow,  `{$this->a TableField s['medDate ']}` $sHow " : $aCond ['sqlOrder '] ;
744                    $aCo nd['rateFi elds'] = $ aSql['fiel ds'];   744                    $aCo nd['rateFi elds'] = $ aSql['fiel ds'];
745                    $aCo nd['rateJo in']   = $ aSql['join '];   745                    $aCo nd['rateJo in']   = $ aSql['join '];
746                    $sql From .= $a Sql['join' ];   746                    $sql From .= $a Sql['join' ];
747                }   747                }
748                $modeTit le = '_Top ';   748                $modeTit le = '_Top ';
749                break;   749                break;
750              }   750              }
751                if( base name( $_SE RVER['PHP_ SELF'] ) = = 'rewrite _name.php'  || basena me( $_SERV ER['PHP_SE LF'] ) ==  'profile.p hp' )   751                if( base name( $_SE RVER['PHP_ SELF'] ) = = 'rewrite _name.php'  || basena me( $_SERV ER['PHP_SE LF'] ) ==  'profile.p hp' )
752                    $sLi nk = "prof ile.php?ID ={$iUser}& ";   752                    $sLi nk = "prof ile.php?ID ={$iUser}& ";
753                else   753                else
754                    $sLi nk  = "{$_ SERVER['PH P_SELF']}? ";   754                    $sLi nk  = "{$_ SERVER['PH P_SELF']}? ";
755                    $sLi nk .= "sh_ ".$this->s Type."Mode =$myMode";   755                    $sLi nk .= "sh_ ".$this->s Type."Mode =$myMode";
756                   756                
757                $aDBTopM enu[$modeT itle] = ar ray('href'  => $sLink , 'dynamic ' => true,  'active'  => ( $myMo de == $mod e ));   757                $aDBTopM enu[$modeT itle] = ar ray('href'  => $sLink , 'dynamic ' => true,  'active'  => ( $myMo de == $mod e ));
758            }   758            }
759               759            
760           $a Num = db_a rr( "SELEC T COUNT(`$ this->sMai nTable`.`{ $this->aTa bleFields[ 'medID']}` ) $sqlFrom  {$aCond[' sqlWhere'] }" );   760           $a Num = db_a rr( "SELEC T COUNT(`$ this->sMai nTable`.`{ $this->aTa bleFields[ 'medID']}` ) $sqlFrom  {$aCond[' sqlWhere'] }" );
761           $n um = (int) $aNum[0];   761           $n um = (int) $aNum[0];
762              762           
763           $r et = '';   763           $r et = '';
764           if ( $num ) {   764           if ( $num ) {
765                $pages =  ceil( $nu m / $max_n um );   765                $pages =  ceil( $nu m / $max_n um );
766                $page =  (int)$_GET ['page'];   766                $page =  (int)$_GET ['page'];
767                   767                
768                if( $pag e < 1 or $ mode == 'r and' )   768                if( $pag e < 1 or $ mode == 'r and' )
769                    $pag e = 1;   769                    $pag e = 1;
770                if( $pag e > $pages  )   770                if( $pag e > $pages  )
771                    $pag e = $pages ;   771                    $pag e = $pages ;
772                   772                
773                $sqlLimi tFrom = (  $page - 1  ) * $max_n um;   773                $sqlLimi tFrom = (  $page - 1  ) * $max_n um;
774                $aCond[' sqlLimit']  = "LIMIT  $sqlLimitF rom, $max_ num";   774                $aCond[' sqlLimit']  = "LIMIT  $sqlLimitF rom, $max_ num";
775               775            
776            $ rData = $t his->getFi lesList($a Cond, $aMa nage);   776            $ rData = $t his->getFi lesList($a Cond, $aMa nage);
777                    777                 
778            $ ret .= '<d iv class=" clear_both "></div>';   778            $ ret .= '<d iv class=" clear_both "></div>';
779            $ iCounter =  1;   779            $ iCounter =  1;
780            $ sAddon = ' ';   780            $ sAddon = ' ';
781            w hile ($aDa ta = mysql _fetch_arr ay($rData) ) {   781            w hile ($aDa ta = mysql _fetch_arr ay($rData) ) {
782                $sTitle  = strlen($ aData['med Title']) >  0 ? $aDat a['medTitl e'] : _t(" _Untitled" );       782                $sTitle  = strlen($ aData['med Title']) >  0 ? $aDat a['medTitl e'] : _t(" _Untitled" );    
783                $sHref   = $this->g etFileUrl( $aData['me dID'], $aD ata['medUr i']);   783                $sHref   = $this->g etFileUrl( $aData['me dID'], $aD ata['medUr i']);
784                   784                
785                $oVoting View = new  BxTemplVo tingView ( 'g'.$this- >sType, $a Data['medI D']);   785                $oVoting View = new  BxTemplVo tingView ( 'g'.$this- >sType, $a Data['medI D']);
786                if( $oVo tingView-> isEnabled( )) {   786                if( $oVo tingView-> isEnabled( )) {
787                    $sRa te = $oVot ingView->g etSmallVot ing (0);   787                    $sRa te = $oVot ingView->g etSmallVot ing (0);
788                    $sSh owRate = ' <div class ="galleryR ate">'. $s Rate . '</ div>';   788                    $sSh owRate = ' <div class ="galleryR ate">'. $s Rate . '</ div>';
789                }   789                }
790                switch ( $this->sTy pe) {   790                switch ( $this->sTy pe) {
791                    case  'photo':   791                    case  'photo':
792                         $sImage =  $this->sFi lesUrl.$aD ata['medID '].'_t.'.$ aData['med Ext'];   792                         $sImage =  $this->sFi lesUrl.$aD ata['medID '].'_t.'.$ aData['med Ext'];
793                         $sPic = '< div class= "lastFiles Pic" style ="backgrou nd-image:  url(\''.$s Image.'\') ;">   793                         $sPic = '< div class= "lastFiles Pic" style ="backgrou nd-image:  url(\''.$s Image.'\') ;">
794                           <a href= "'.$sHref. '"><img sr c="'.$this ->aConfigS ite['image s'].'space r.gif" alt ="" width= "110" heig ht="110">< /a></div>< div class= "clear_bot h"></div>' ;   794                           <a href= "'.$sHref. '"><img sr c="'.$this ->aConfigS ite['image s'].'space r.gif" alt ="" width= "110" heig ht="110">< /a></div>< div class= "clear_bot h"></div>' ;
795                         break;   795                         break;
796                    case  'music':   796                    case  'music':
797                         $sPic = '< div class= "lastMusic Pic"><a hr ef="'.$sHr ef.'"><img  src="'.$t his->aConf igSite['im ages'].'mu sic.png">< /a></div>' ;   797                         $sPic = '< div class= "lastMusic Pic"><a hr ef="'.$sHr ef.'"><img  src="'.$t his->aConf igSite['im ages'].'mu sic.png">< /a></div>' ;
798                         break;   798                         break;
799                    case  'video':   799                    case  'video':
800                         $sPic = '< div class= "lastVideo Pic"><a hr ef="'.$sHr ef.'"><img  src="'.$t his->sFile sUrl.$aDat a['medID'] .'.jpg" wi dth="112px " height=" 80px"></a> </div>';   800                         $sPic = '< div class= "lastVideo Pic"><a hr ef="'.$sHr ef.'"><img  src="'.$t his->sFile sUrl.$aDat a['medID'] .'.jpg" wi dth="112px " height=" 80px"></a> </div>';
801                         break;   801                         break;
802                }   802                }
803                   803                
804                   804                
805                $ret .=  '<div clas s="sharePh otosConten t_1">';   805                $ret .=  '<div clas s="sharePh otosConten t_1">';
806                $ret .=  $sPic.'<di v class="s hareMediaA dd"><a hre f="'.$sHre f.'">'.$sT itle.'</a> </div>'.$s ShowRate.' </div>';   806                $ret .=  $sPic.'<di v class="s hareMediaA dd"><a hre f="'.$sHre f.'">'.$sT itle.'</a> </div>'.$s ShowRate.' </div>';
807            }   807            }
808               808            
809            $ ret .= '<d iv class=" clear_both "></div>';   809            $ ret .= '<d iv class=" clear_both "></div>';
810               810            
811            $ aDBBottomM enu = arra y();   811            $ aDBBottomM enu = arra y();
812               812            
    813            $ sUserAddon  = ($iUser  > 0) ? "& amp;ID={$i User}" : ' ';
813            i f( $pages  > 1 ) {   814            i f( $pages  > 1 ) {
814                if( $pag e > 1 ) {   815                if( $pag e > 1 ) {
815                    $pre vPage = $p age - 1;   816                    $pre vPage = $p age - 1;
816                     $aDBBottom Menu[   _t('_Back' )   ]   =   array(   'href'   =>   "{$_SERVER ['PHP_SELF ']}?sh_".$ this->sTyp e."Mode=$m ode&amp;pa ge=$prevPa ge
",   'dynamic'   =>   true,   'class'   =>   'backMembe rs'   );
  817                     $aDBBottom Menu[   _t('_Back' )   ]   =   array(   'href'   =>   "{$_SERVER ['PHP_SELF ']}?sh_".$ this->sTyp e."Mode=$m ode&amp;pa ge=$prevPa ge {$sUserAdd on} ",   'dynamic'   =>   true,   'class'   =>   'backMembe rs'   );
817                }   818                }
818                       819                    
819                if( $pag e < $pages  ) {   820                if( $pag e < $pages  ) {
820                    $nex tPage = $p age + 1;   821                    $nex tPage = $p age + 1;
821                     $aDBBottom Menu[   _t('_Next' )   ]   =   array(   'href'   =>   "{$_SERVER ['PHP_SELF ']}?sh_".$ this->sTyp e."Mode=$m ode&amp;pa ge=$nextPa ge
",   'dynamic'   =>   true,   'class'   =>   'moreMembe rs'   );
  822                     $aDBBottom Menu[   _t('_Next' )   ]   =   array(   'href'   =>   "{$_SERVER ['PHP_SELF ']}?sh_".$ this->sTyp e."Mode=$m ode&amp;pa ge=$nextPa ge {$sUserAdd on} ",   'dynamic'   =>   true,   'class'   =>   'moreMembe rs'   );
822                }   823                }
    824                if ($iUs er != 0) {
    825                    $sAl lUrl = $th is->isPerm alinkEnabl ed() ? $th is->aConfi gSite['url '].$this-> sType.'/ga llery/all/ '. getNick Name($iUse r) : $this ->aConfigS ite['url'] .'browse'. ucfirst($t his->sType ).'.php?us erID='.$iU ser;      
    826                }
    827                else
823                $sAllUrl  = $this-> isPermalin kEnabled()  ? $this-> aConfigSit e['url'].$ this->sTyp e.'/all/10 /1' : $thi s->aConfig Site['url' ].'browse' .ucfirst($ this->sTyp e).'.php';   828                    $sAl lUrl = $th is->isPerm alinkEnabl ed() ? $th is->aConfi gSite['url '].$this-> sType.'/al l/10/1' :  $this->aCo nfigSite[' url'].'bro wse'.ucfir st($this-> sType).'.p hp';
    829                
824                $aDBBott omMenu[ _t ('_View Al l') ] = ar ray( 'href ' => "$sAl lUrl", 'cl ass' => 'v iewAllMemb ers' );    830                $aDBBott omMenu[ _t ('_View Al l') ] = ar ray( 'href ' => "$sAl lUrl", 'cl ass' => 'v iewAllMemb ers' ); 
825           }   831           }
826        }   832        }
827          833       
828        retur n array( $ ret, $aDBT opMenu, $a DBBottomMe nu );   834        retur n array( $ ret, $aDBT opMenu, $a DBBottomMe nu );
829       }   835       }
830          836       
831       //---- ---------- ---------- ---------- ---------  actions -- ---------- ---------- ---------- ---------- -//   837       //---- ---------- ---------- ---------- ---------  actions -- ---------- ---------- ---------- ---------- -//
832          838       
833       /*   839       /*
834           De lete file,  his strin g in DB an d all his  child file s   840           De lete file,  his strin g in DB an d all his  child file s
835           *  @param int  iFile - f ile ID   841           *  @param int  iFile - f ile ID
836           *  @param arr ay $logged  - array o f login   842           *  @param arr ay $logged  - array o f login
837       */   843       */
838          844       
839       functi on deleteM edia($iFil e, $logged  = array() ) {   845       functi on deleteM edia($iFil e, $logged  = array() ) {
840           $i File = (in t)$iFile;   846           $i File = (in t)$iFile;
841           $s qlQuery  =  "SELECT ` {$this->aT ableFields ['medProfI d']}`";   847           $s qlQuery  =  "SELECT ` {$this->aT ableFields ['medProfI d']}`";
842           $s qlQuery .=  isset($th is->aTable Fields['me dExt']) ?  ", `{$this ->aTableFi elds['medE xt']}`" :  "";   848           $s qlQuery .=  isset($th is->aTable Fields['me dExt']) ?  ", `{$this ->aTableFi elds['medE xt']}`" :  "";
843           $s qlQuery .=  "FROM `{$ this->sMai nTable}` W HERE `{$th is->aTable Fields['me dID']}`=$i File";   849           $s qlQuery .=  "FROM `{$ this->sMai nTable}` W HERE `{$th is->aTable Fields['me dID']}`=$i File";
844              850           
845           $a File = db_ arr($sqlQu ery);   851           $a File = db_ arr($sqlQu ery);
846           if  (!$aFile)   852           if  (!$aFile)
847                return f alse;   853                return f alse;
848     854  
849           if  ($logged[ 'admin'])  {   855           if  ($logged[ 'admin'])  {
850           }   856           }
851           el seif ($log ged['membe r']) {   857           el seif ($log ged['membe r']) {
852                $iMember ID = (int) $_COOKIE[' memberID'] ;   858                $iMember ID = (int) $_COOKIE[' memberID'] ;
853                   859                
854                if ($aFi le[$this-> aTableFiel ds['medPro fId']] !=  $iMemberID )   860                if ($aFi le[$this-> aTableFiel ds['medPro fId']] !=  $iMemberID )
855                    retu rn false;   861                    retu rn false;
856           }   862           }
857           el se   863           el se
858                return f alse;   864                return f alse;
859              865           
860           sw itch ($thi s->sType)  {   866           sw itch ($thi s->sType)  {
861                case 'ph oto':   867                case 'ph oto':
862                    $aFN ame[] = $i File . '.' .$aFile['m edExt'];   868                    $aFN ame[] = $i File . '.' .$aFile['m edExt'];
863                    $aFN ame[] = $i File.'_t.' .$aFile['m edExt'];   869                    $aFN ame[] = $i File.'_t.' .$aFile['m edExt'];
864                    $aFN ame[] = $i File.'_m.' .$aFile['m edExt'];   870                    $aFN ame[] = $i File.'_m.' .$aFile['m edExt'];
865                    $sCm tsName = ' sharedPhot o';   871                    $sCm tsName = ' sharedPhot o';
866                    brea k;   872                    brea k;
867                case 'mu sic':   873                case 'mu sic':
868                    $aFN ame[] = $i File.'.mp3 ';   874                    $aFN ame[] = $i File.'.mp3 ';
869                    $sCm tsName = ' sharedMusi c';   875                    $sCm tsName = ' sharedMusi c';
870                    brea k;   876                    brea k;
871                case 'vi deo':   877                case 'vi deo':
872                    $aFN ame[] = $i File.'.flv ';   878                    $aFN ame[] = $i File.'.flv ';
873                    $aFN ame[] = $i File.'.mpg ';   879                    $aFN ame[] = $i File.'.mpg ';
874                    $aFN ame[] = $i File.'.jpg ';   880                    $aFN ame[] = $i File.'.jpg ';
875                    $aFN ame[] = $i File.'_sma ll.jpg';   881                    $aFN ame[] = $i File.'_sma ll.jpg';
876                    $sCm tsName = ' sharedVide o';   882                    $sCm tsName = ' sharedVide o';
877                    brea k;         883                    brea k;      
878           }   884           }
879           fo reach($aFN ame as $sV al) {   885           fo reach($aFN ame as $sV al) {
880                $sFilePa th = $this ->sFilesPa th.$sVal;   886                $sFilePa th = $this ->sFilesPa th.$sVal;
881                @unlink( $sFilePath );   887                @unlink( $sFilePath );
882           }   888           }
883           db _res("DELE TE FROM `{ $this->sMa inTable}`  WHERE `{$t his->aTabl eFields['m edID']}`=$ iFile");   889           db _res("DELE TE FROM `{ $this->sMa inTable}`  WHERE `{$t his->aTabl eFields['m edID']}`=$ iFile");
884          890       
885           re parseObjTa gs( $this- >sType, $i File );   891           re parseObjTa gs( $this- >sType, $i File );
886              892           
887           $o Voting = n ew BxDolVo ting ('g'. $this->sTy pe, 0, 0);   893           $o Voting = n ew BxDolVo ting ('g'. $this->sTy pe, 0, 0);
888           $o Voting->de leteVoting s($iFile);   894           $o Voting->de leteVoting s($iFile);
889     895  
890           $o Cmts = new  BxDolCmts ($sCmtsNam e, $iFile) ;   896           $o Cmts = new  BxDolCmts ($sCmtsNam e, $iFile) ;
891           $o Cmts->onOb jectDelete ();   897           $o Cmts->onOb jectDelete ();
892              898           
893           he ader('Loca tion:' . $ _SERVER["H TTP_REFERE R"]);   899           he ader('Loca tion:' . $ _SERVER["H TTP_REFERE R"]);
894       }   900       }
895          901       
896       /*   902       /*
897           Ap proved med ia by admi n   903           Ap proved med ia by admi n
898           *  @param int  iFile - f ile ID   904           *  @param int  iFile - f ile ID
899       */   905       */
900          906       
901       functi on approve Media($iFi le) {   907       functi on approve Media($iFi le) {
902           $i File = (in t)$iFile;   908           $i File = (in t)$iFile;
903           $s qlQuery =  "UPDATE `{ $this->sMa inTable}`  SET `{$thi s->aTableF ields['App roved']}`  = IF(`{$th is->aTable Fields['Ap proved']}` ='true','f alse','tru e') WHERE  `{$this->a TableField s['medID'] }`='$iFile '";   909           $s qlQuery =  "UPDATE `{ $this->sMa inTable}`  SET `{$thi s->aTableF ields['App roved']}`  = IF(`{$th is->aTable Fields['Ap proved']}` ='true','f alse','tru e') WHERE  `{$this->a TableField s['medID'] }`='$iFile '";
904           db _res($sqlQ uery);   910           db _res($sqlQ uery);
905           he ader('Loca tion:' . $ _SERVER["H TTP_REFERE R"]);   911           he ader('Loca tion:' . $ _SERVER["H TTP_REFERE R"]);
906       }   912       }
907          913       
908       /*   914       /*
909           Ge t favorite  files con diton   915           Ge t favorite  files con diton
910           *  @param int  $iMember  - view ID   916           *  @param int  $iMember  - view ID
911           *  @return $s qlQuery -  sqlQuery a ddon   917           *  @return $s qlQuery -  sqlQuery a ddon
912       */   918       */
913          919       
914       functi on getFavo riteCondit ion($iMemb er) {   920       functi on getFavo riteCondit ion($iMemb er) {
915           $i Member  =  (int)$iMem ber;   921           $i Member  =  (int)$iMem ber;
916           $s qlQuery =  "SELECT `m edID` FROM  `{$this-> sFavoriteT able}` WHE RE `userID `=$iMember ";   922           $s qlQuery =  "SELECT `m edID` FROM  `{$this-> sFavoriteT able}` WHE RE `userID `=$iMember ";
917           $r List = db_ res($sqlQu ery);   923           $r List = db_ res($sqlQu ery);
918           wh ile ($aLis t = mysql_ fetch_row( $rList)) {   924           wh ile ($aLis t = mysql_ fetch_row( $rList)) {
919                $sParam  .= $aList[ 0] . ',';   925                $sParam  .= $aList[ 0] . ',';
920           }   926           }
921           $s Res = " AN D `{$this- >sMainTabl e}`.`{$thi s->aTableF ields['med ID']}` IN( ";   927           $s Res = " AN D `{$this- >sMainTabl e}`.`{$thi s->aTableF ields['med ID']}` IN( ";
922           if  (strlen($ sParam) >  0)   928           if  (strlen($ sParam) >  0)
923                $sRes =  $sRes.trim ($sParam,' ,').')';   929                $sRes =  $sRes.trim ($sParam,' ,').')';
924           el se   930           el se
925                $sRes =  ' AND 0';   931                $sRes =  ' AND 0';
926     932  
927           re turn $sRes ;   933           re turn $sRes ;
928       }   934       }
929          935       
930       /*   936       /*
931           De lete all u ser's file  in curren t media ga llery   937           De lete all u ser's file  in curren t media ga llery
932           *  @param int  $iMember  - view ID   938           *  @param int  $iMember  - view ID
933           *  @param arr ay $logged  - array o f logins   939           *  @param arr ay $logged  - array o f logins
934       */   940       */
935          941       
936       functi on deleteU serGallery ($iUser, $ logged) {   942       functi on deleteU serGallery ($iUser, $ logged) {
937           $i User = (in t)$iUser;   943           $i User = (in t)$iUser;
938           $s qlQuery =  "SELECT `{ $this->aTa bleFields[ 'medID']}`  from `{$t his->sMain Table}` WH ERE `{$thi s->aTableF ields['med ProfId']}` =$iUser";   944           $s qlQuery =  "SELECT `{ $this->aTa bleFields[ 'medID']}`  from `{$t his->sMain Table}` WH ERE `{$thi s->aTableF ields['med ProfId']}` =$iUser";
939           $r Files = db _res($sqlQ uery);   945           $r Files = db _res($sqlQ uery);
940           wh ile ($aFil e = mysql_ fetch_asso c($rFiles) ) {   946           wh ile ($aFil e = mysql_ fetch_asso c($rFiles) ) {
941                $this->d eleteMedia ($aFile[$t his->aTabl eFields['m edID']], $ logged);   947                $this->d eleteMedia ($aFile[$t his->aTabl eFields['m edID']], $ logged);
942                $oCmts =  new BxDol Cmts('shar ed'.ucfirs t($this->s Type), $iF ile);   948                $oCmts =  new BxDol Cmts('shar ed'.ucfirs t($this->s Type), $iF ile);
943                $oCmts-> onObjectDe lete();   949                $oCmts-> onObjectDe lete();
944           }   950           }
945       }   951       }
946          952       
947       /*   953       /*
948           Ad d file to  favorite l ist   954           Ad d file to  favorite l ist
949           *  @param int  $iFile -  file ID   955           *  @param int  $iFile -  file ID
950           *  @return $s Code - htm l output   956           *  @return $s Code - htm l output
951       */   957       */
952          958       
953       functi on addToFa vorites($i File) {   959       functi on addToFa vorites($i File) {
954           $i File =(int )$iFile;   960           $i File =(int )$iFile;
955           if  ($iFile)  {   961           if  ($iFile)  {
956                $sqlQuer y = "SELEC T * FROM ` {$this->sF avoriteTab le}` WHERE  `medID`=' $iFile' AN D `userID` ='{$this-> iViewer}'" ;   962                $sqlQuer y = "SELEC T * FROM ` {$this->sF avoriteTab le}` WHERE  `medID`=' $iFile' AN D `userID` ='{$this-> iViewer}'" ;
957                $aCheck  = db_arr($ sqlQuery);   963                $aCheck  = db_arr($ sqlQuery);
958                if ($aCh eck)   964                if ($aCh eck)
959                    $sCo de = '<div  class="me diaInfo">' ._t('_File  already i s favorite ').'</div> ';   965                    $sCo de = '<div  class="me diaInfo">' ._t('_File  already i s favorite ').'</div> ';
960                else {   966                else {
961                    $sql Query = "I NSERT INTO  `{$this-> sFavoriteT able}` (`m edID`,`use rID`,`favD ate`) VALU ES('$iFile ','{$this- >iViewer}' ,NOW())";   967                    $sql Query = "I NSERT INTO  `{$this-> sFavoriteT able}` (`m edID`,`use rID`,`favD ate`) VALU ES('$iFile ','{$this- >iViewer}' ,NOW())";
962                    db_r es($sqlQue ry);   968                    db_r es($sqlQue ry);
963                    $sCo de = '<div  class="me diaInfo">' ._t("_File  was added  to favori te").'</di v>';   969                    $sCo de = '<div  class="me diaInfo">' ._t("_File  was added  to favori te").'</di v>';
964                }   970                }
965           }   971           }
966              972           
967           re turn $sCod e;   973           re turn $sCod e;
968       }   974       }
969          975       
970       /*   976       /*
971           Se nd file in fo   977           Se nd file in fo
972           *  @param int  $iFile -  file ID   978           *  @param int  $iFile -  file ID
973           *  @param str ing $sEmai l - email( s)   979           *  @param str ing $sEmai l - email( s)
974           *  @param str ing $sMess age - mess age   980           *  @param str ing $sMess age - mess age
975           *  @param str ing $sUrl  - link to  file   981           *  @param str ing $sUrl  - link to  file
976       */   982       */
977          983       
978       functi on sendFil eInfo($iFi le, $sEmai l, $sMessa ge, $sUrl)  {     984       functi on sendFil eInfo($iFi le, $sEmai l, $sMessa ge, $sUrl)  {  
979           $a User = get ProfileInf o($this->i Viewer);   985           $a User = get ProfileInf o($this->i Viewer);
980           $s Url  = url decode($sU rl);   986           $s Url  = url decode($sU rl);
981              987           
982           $s MailHeader         =  "From: {$t his->aConf igSite['ti tle']} <{$ this->aCon figSite['e mail_notif y']}>";   988           $s MailHeader         =  "From: {$t his->aConf igSite['ti tle']} <{$ this->aCon figSite['e mail_notif y']}>";
983           $s MailParame ters    =  "-f{$this- >aConfigSi te['email_ notify']}" ;   989           $s MailParame ters    =  "-f{$this- >aConfigSi te['email_ notify']}" ;
984              990           
985           $s MailHeader  = "MIME-V ersion: 1. 0\r\n" . " Content-ty pe: text/h tml; chars et=UTF-8\r \n" . $sMa ilHeader;   991           $s MailHeader  = "MIME-V ersion: 1. 0\r\n" . " Content-ty pe: text/h tml; chars et=UTF-8\r \n" . $sMa ilHeader;
986           $s MailSubjec t = $aUser ['NickName '].' share d a Photo  with you';   992           $s MailSubjec t = $aUser ['NickName '].' share d a Photo  with you';
987              993           
988           $s MailBody     = "Hello ,\n   994           $s MailBody     = "Hello ,\n
989                         {$aUser['N ickName']}  shared a  {$this->sT ype} with  you: <a hr ef=\"$sUrl \">See it< /a>\n   995                         {$aUser['N ickName']}  shared a  {$this->sT ype} with  you: <a hr ef=\"$sUrl \">See it< /a>\n
990                         $sMessage\ n   996                         $sMessage\ n
991                         Regards";   997                         Regards";
992              998           
993           $a Emails = e xplode("," , $sEmail) ;   999           $a Emails = e xplode("," , $sEmail) ;
994           fo reach ($aE mails as $ iKey => $s Mail) {   1000           fo reach ($aE mails as $ iKey => $s Mail) {
995                $sMail =  trim($sMa il);   1001                $sMail =  trim($sMa il);
996                $iSendin gResult =  mail( $sMa il, $sMail Subject, n l2br($sMai lBody), $s MailHeader , $sMailPa rameters ) ;   1002                $iSendin gResult =  mail( $sMa il, $sMail Subject, n l2br($sMai lBody), $s MailHeader , $sMailPa rameters ) ;
997           if  ($iSendin gResult)   1003           if  ($iSendin gResult)
998                $sCode =  '<div cla ss="mediaI nfo">'._t( "_File inf o was sent ").'</div> ';   1004                $sCode =  '<div cla ss="mediaI nfo">'._t( "_File inf o was sent ").'</div> ';
999           }   1005           }
1000              1006           
1001           re turn $sCod e;   1007           re turn $sCod e;
1002       }   1008       }
1003          1009       
1004       /*   1010       /*
1005           Sh ow submit  form   1011           Sh ow submit  form
1006           *  @param arr ay $aActio ns - array  of all ac tion varia ble   1012           *  @param arr ay $aActio ns - array  of all ac tion varia ble
1007           *  @return $s Code - htm l output   1013           *  @return $s Code - htm l output
1008       */   1014       */
1009          1015       
1010       functi on showSub mitForm($a Action) {   1016       functi on showSub mitForm($a Action) {
1011           $i File = (in t)$aAction ['fileID'] ;   1017           $i File = (in t)$aAction ['fileID'] ;
1012           $s Action = h tmlspecial chars_adv( $aAction[' action']);   1018           $s Action = h tmlspecial chars_adv( $aAction[' action']);
1013           if  ($iFile & & strlen($ sAction) >  0) {   1019           if  ($iFile & & strlen($ sAction) >  0) {
1014                switch ( $sAction)  {   1020                switch ( $sAction)  {
1015                    case  'share' :     1021                    case  'share' :  
1016                         $sAddr  =  '<div>'._t ("_Enter e mail(s)"). ':</div><d iv><input  type="text " size="40 " name="em ail"></div >';   1022                         $sAddr  =  '<div>'._t ("_Enter e mail(s)"). ':</div><d iv><input  type="text " size="40 " name="em ail"></div >';
1017                         $sSites =  '<div styl e="margin- top:10px;  margin-bot tom:10px;" >'.$this-> getSitesAr ray($aActi on['fileUr l']).'</di v>';   1023                         $sSites =  '<div styl e="margin- top:10px;  margin-bot tom:10px;" >'.$this-> getSitesAr ray($aActi on['fileUr l']).'</di v>';
1018                         break;   1024                         break;
1019                    case  'report':     1025                    case  'report':  
1020                         $sAddr  =  '<input ty pe="hidden " name="em ail" value ="'.$this- >aConfigSi te['email_ notify'].' ">';   1026                         $sAddr  =  '<input ty pe="hidden " name="em ail" value ="'.$this- >aConfigSi te['email_ notify'].' ">';
1021                         $sSites =  '';   1027                         $sSites =  '';
1022                         break;   1028                         break;
1023                }   1029                }
1024                   1030                
1025                ob_start ();   1031                ob_start ();
1026                ?>   1032                ?>
1027                <div cla ss="mediaI nfo">   1033                <div cla ss="mediaI nfo">
1028                    <for m name="su bmitAction " method=" post" acti on="<?=$_S ERVER['PHP _SELF']?>" >   1034                    <for m name="su bmitAction " method=" post" acti on="<?=$_S ERVER['PHP _SELF']?>" >
1029                         <input typ e="hidden"  name="typ e" value=" <?=$this-> sType?>">    1035                         <input typ e="hidden"  name="typ e" value=" <?=$this-> sType?>"> 
1030                         <input typ e="hidden"  name="fil eID" value ="<?=$iFil e?>">   1036                         <input typ e="hidden"  name="fil eID" value ="<?=$iFil e?>">
1031                         <input typ e="hidden"  name="fil eUrl" valu e="<?=$aAc tion['file Url']?>">   1037                         <input typ e="hidden"  name="fil eUrl" valu e="<?=$aAc tion['file Url']?>">
1032                         <?=$sAddr. $sSites?>   1038                         <?=$sAddr. $sSites?>
1033                         <div><?=_t ("_Message  text")?>< /div>   1039                         <div><?=_t ("_Message  text")?>< /div>
1034                         <div><text area cols= "30" rows= "10" name= "messageTe xt"></text area></div >   1040                         <div><text area cols= "30" rows= "10" name= "messageTe xt"></text area></div >
1035                         <div><inpu t type="su bmit" size ="15" name ="send" va lue="Send" >   1041                         <div><inpu t type="su bmit" size ="15" name ="send" va lue="Send" >
1036                         <input typ e="reset"  size="15"  name="send " value="R eset"></di v>   1042                         <input typ e="reset"  size="15"  name="send " value="R eset"></di v>
1037                    </fo rm>   1043                    </fo rm>
1038                </div>     1044                </div>  
1039                <?   1045                <?
1040                $sCode =  ob_get_cl ean();   1046                $sCode =  ob_get_cl ean();
1041           }   1047           }
1042           re turn $sCod e;   1048           re turn $sCod e;
1043       }   1049       }
1044          1050       
1045       /*   1051       /*
1046           Ge t shared s ites array   1052           Ge t shared s ites array
1047           *  @param str ing $sLink  - file en code URL   1053           *  @param str ing $sLink  - file en code URL
1048           *  @return st ring $sCod e - html o utput   1054           *  @return st ring $sCod e - html o utput
1049       */   1055       */
1050          1056       
1051       functi on getSite sArray($sL ink) {   1057       functi on getSite sArray($sL ink) {
1052           $s Link = htm lentities( ($sLink));   1058           $s Link = htm lentities( ($sLink));
1053           $a Sites = ar ray(   1059           $a Sites = ar ray(
1054                array(   1060                array(
1055                'image'= >'digg.png ',   1061                'image'= >'digg.png ',
1056                'link'=> 'http://di gg.com/sub mit?phase= 2&url='.$s Link   1062                'link'=> 'http://di gg.com/sub mit?phase= 2&url='.$s Link
1057                ),   1063                ),
1058                array(   1064                array(
1059                'image'= >'deliciou s.png',   1065                'image'= >'deliciou s.png',
1060                'link' = >'http://d el.icio.us /post?url= '.$sLink   1066                'link' = >'http://d el.icio.us /post?url= '.$sLink
1061                ),   1067                ),
1062                array(   1068                array(
1063                'image'= >'blinklis t.png',   1069                'image'= >'blinklis t.png',
1064                'link' = >'http://w ww.blinkli st.com/ind ex.php?Act ion=Blink/ addblink.p hp&amp;Url ='.$sLink   1070                'link' = >'http://w ww.blinkli st.com/ind ex.php?Act ion=Blink/ addblink.p hp&amp;Url ='.$sLink
1065                ),   1071                ),
1066                array(   1072                array(
1067                'image'= >'furl.png ',   1073                'image'= >'furl.png ',
1068                'link' = >'http://w ww.furl.ne t/storeIt. jsp?u='.$s Link   1074                'link' = >'http://w ww.furl.ne t/storeIt. jsp?u='.$s Link
1069                ),   1075                ),
1070                array(   1076                array(
1071                'image'= >'netscape .gif',   1077                'image'= >'netscape .gif',
1072                'link' = >'http://w ww.netscap e.com/subm it/?U='.$s Link   1078                'link' = >'http://w ww.netscap e.com/subm it/?U='.$s Link
1073                ),   1079                ),
1074                array(   1080                array(
1075                'image'= >'newsvine .png',   1081                'image'= >'newsvine .png',
1076                'link' = >'http://w ww.newsvin e.com/_too ls/seed&sa ve?u='.$sL ink   1082                'link' = >'http://w ww.newsvin e.com/_too ls/seed&sa ve?u='.$sL ink
1077                ),   1083                ),
1078                array(   1084                array(
1079                'image'= >'reddit.p ng',   1085                'image'= >'reddit.p ng',
1080                'link' = >'http://r eddit.com/ submit?url ='.$sLink   1086                'link' = >'http://r eddit.com/ submit?url ='.$sLink
1081                ),   1087                ),
1082                array(   1088                array(
1083                'image'= >'shadows. png',   1089                'image'= >'shadows. png',
1084                'link' = >'http://w ww.shadows .com/featu res/tcr.ht m?url='.$s Link   1090                'link' = >'http://w ww.shadows .com/featu res/tcr.ht m?url='.$s Link
1085                ),   1091                ),
1086                array(   1092                array(
1087                'image'= >'slashdot .png',   1093                'image'= >'slashdot .png',
1088                'link' = >'http://s lashdot.or g/bookmark .pl?url='. $sLink   1094                'link' = >'http://s lashdot.or g/bookmark .pl?url='. $sLink
1089                ),   1095                ),
1090                array(   1096                array(
1091                'image'= >'sphere.p ng',   1097                'image'= >'sphere.p ng',
1092                'link' = >'http://w ww.sphere. com/search ?q=spherei t:'.$sLink   1098                'link' = >'http://w ww.sphere. com/search ?q=spherei t:'.$sLink
1093                ),   1099                ),
1094                array(   1100                array(
1095                'image'= >'stumbleu pon.png',   1101                'image'= >'stumbleu pon.png',
1096                'link' = >'http://w ww.stumble upon.com/u rl/http'.$ sLink   1102                'link' = >'http://w ww.stumble upon.com/u rl/http'.$ sLink
1097                ),   1103                ),
1098                array(   1104                array(
1099                'image'= >'technora ti.png',   1105                'image'= >'technora ti.png',
1100                'link' = >'http://t echnorati. com/faves? add='.$sLi nk   1106                'link' = >'http://t echnorati. com/faves? add='.$sLi nk
1101                )   1107                )
1102           );   1108           );
1103           $s Link = '<a  href="{Li nk}"><div  class="sha reLink" st yle="backg round-imag e:url(\'{I mage}\')"> </div></a> ';   1109           $s Link = '<a  href="{Li nk}"><div  class="sha reLink" st yle="backg round-imag e:url(\'{I mage}\')"> </div></a> ';
1104          1110       
1105           fo reach ($aS ites as $i Key =>$aVa l) {   1111           fo reach ($aS ites as $i Key =>$aVa l) {
1106                $sLinkCu r = str_re place('{Im age}', get TemplateIc on($aVal[' image']),$ sLink);   1112                $sLinkCu r = str_re place('{Im age}', get TemplateIc on($aVal[' image']),$ sLink);
1107                $sLinkCu r = str_re place('{Li nk}', $aVa l['link'], $sLinkCur) ;   1113                $sLinkCu r = str_re place('{Li nk}', $aVa l['link'], $sLinkCur) ;
1108                $sCode    .= $sLink Cur;   1114                $sCode    .= $sLink Cur;
1109           }   1115           }
1110           $s Code .= '< div class= "clear_bot h"></div>' ;   1116           $s Code .= '< div class= "clear_bot h"></div>' ;
1111              1117           
1112           re turn $sCod e;   1118           re turn $sCod e;
1113       }   1119       }
1114          1120       
1115       /*   1121       /*
1116           Ge t array of  sql parts , total pa ges, curre nt page, p er page   1122           Ge t array of  sql parts , total pa ges, curre nt page, p er page
1117           *  @param arr ay $logged  - array o f logins   1123           *  @param arr ay $logged  - array o f logins
1118           *  @return ar ray('query '(sql quer y),'total'  (totalpag es), 'per_ page' (in  1 page), ' cur_page'  (current p age num))   1124           *  @return ar ray('query '(sql quer y),'total'  (totalpag es), 'per_ page' (in  1 page), ' cur_page'  (current p age num))
1119       */   1125       */
1120          1126       
1121       functi on getCond itionArray ($logged)  {   1127       functi on getCond itionArray ($logged)  {
1122           $a Where = ar ray();   1128           $a Where = ar ray();
1123           $a Where[] =  '1';   1129           $a Where[] =  '1';
1124              1130           
1125           $i User = 0;   1131           $i User = 0;
1126              1132           
1127           if  (isset($_ GET['owner Name'])) {   1133           if  (isset($_ GET['owner Name'])) {
1128                $sName =  process_d b_input($_ GET['owner Name']);   1134                $sName =  process_d b_input($_ GET['owner Name']);
1129                $iUser =  (int)db_v alue("SELE CT `ID` FR OM `Profil es` WHERE  `NickName` ='$sName'" );   1135                $iUser =  (int)db_v alue("SELE CT `ID` FR OM `Profil es` WHERE  `NickName` ='$sName'" );
1130           }   1136           }
1131           el seif (isse t($_GET['u serID']))   1137           el seif (isse t($_GET['u serID']))
1132                $iUser =  (int)$_GE T['userID' ];   1138                $iUser =  (int)$_GE T['userID' ];
1133              1139           
1134           if  ($iUser)   1140           if  ($iUser)
1135                $aWhere[ ] = "`{$th is->sMainT able}`.`{$ this->aTab leFields[' medProfId' ]}`=$iUser ";      1141                $aWhere[ ] = "`{$th is->sMainT able}`.`{$ this->aTab leFields[' medProfId' ]}`=$iUser ";   
1136              1142           
1137           if  (isset($_ GET['tag'] )) {   1143           if  (isset($_ GET['tag'] )) {
1138                $sTag =  htmlspecia lchars_adv ($_GET['ta g']);   1144                $sTag =  htmlspecia lchars_adv ($_GET['ta g']);
1139                $aWhere[ ] = "`{$th is->sMainT able}`.`{$ this->aTab leFields[' medTags']} ` like '%$ sTag%'";   1145                $aWhere[ ] = "`{$th is->sMainT able}`.`{$ this->aTab leFields[' medTags']} ` like '%$ sTag%'";
1140           }   1146           }
1141              1147           
1142           if  (isset($_ GET['actio n'])) {   1148           if  (isset($_ GET['actio n'])) {
1143                $sAct =  htmlspecia lchars_adv ($_GET['ac tion']);   1149                $sAct =  htmlspecia lchars_adv ($_GET['ac tion']);
1144                switch ( $sAct) {   1150                switch ( $sAct) {
1145                    case  'fav':   1151                    case  'fav':
1146                         $sAddon =  $this->get FavoriteCo ndition($t his->iView er);   1152                         $sAddon =  $this->get FavoriteCo ndition($t his->iView er);
1147                         break;   1153                         break;
1148                    case  'del':   1154                    case  'del':
1149                         $sAddon =  '';   1155                         $sAddon =  '';
1150                         if (isset( $_GET['fil eID']))    1156                         if (isset( $_GET['fil eID'])) 
1151                             $this- >deleteMed ia($_GET[' fileID'],  $logged);   1157                             $this- >deleteMed ia($_GET[' fileID'],  $logged);
1152                         break;     1158                         break;  
1153                }   1159                }
1154           }   1160           }
1155              1161           
1156           $a SqlQuery[' sqlWhere']  = "WHERE  " . implod e( ' AND ' , $aWhere  ).$sAddon. " AND `App roved`= 't rue'";   1162           $a SqlQuery[' sqlWhere']  = "WHERE  " . implod e( ' AND ' , $aWhere  ).$sAddon. " AND `App roved`= 't rue'";
1157              1163           
1158           $i TotalNum =  db_value(  "SELECT C OUNT( * )  FROM `{$th is->sMainT able}` {$a SqlQuery[' sqlWhere'] }" );   1164           $i TotalNum =  db_value(  "SELECT C OUNT( * )  FROM `{$th is->sMainT able}` {$a SqlQuery[' sqlWhere'] }" );
1159           if  (!$iTotal Num)   1165           if  (!$iTotal Num)
1160                return f alse;   1166                return f alse;
1161              1167           
1162           $i PerPage =  (int)$_GET ['per_page '];   1168           $i PerPage =  (int)$_GET ['per_page '];
1163           if  (!$iPerPa ge)   1169           if  (!$iPerPa ge)
1164                $iPerPag e = 10;   1170                $iPerPag e = 10;
1165              1171           
1166           $i TotalPages  = ceil( $ iTotalNum  / $iPerPag e );   1172           $i TotalPages  = ceil( $ iTotalNum  / $iPerPag e );
1167              1173           
1168           $i CurPage =  (int)$_GET ['page'];   1174           $i CurPage =  (int)$_GET ['page'];
1169              1175           
1170           if  ($iCurPag e > $iTota lPages)   1176           if  ($iCurPag e > $iTota lPages)
1171                $iCurPag e = $iTota lPages;   1177                $iCurPag e = $iTota lPages;
1172              1178           
1173           if  ($iCurPag e < 1)   1179           if  ($iCurPag e < 1)
1174                $iCurPag e = 1;   1180                $iCurPag e = 1;
1175              1181           
1176           $s LimitFrom  = ( $iCurP age - 1 )  * $iPerPag e;   1182           $s LimitFrom  = ( $iCurP age - 1 )  * $iPerPag e;
1177           $a SqlQuery[' sqlLimit']  = "LIMIT  $sLimitFro m, $iPerPa ge";   1183           $a SqlQuery[' sqlLimit']  = "LIMIT  $sLimitFro m, $iPerPa ge";
1178              1184           
1179           $a SqlQuery[' sqlOrder']  = 'ORDER  BY `medDat e` DESC';   1185           $a SqlQuery[' sqlOrder']  = 'ORDER  BY `medDat e` DESC';
1180              1186           
1181           if  (isset($_ GET['rate' ])) {   1187           if  (isset($_ GET['rate' ])) {
1182                $oVoting View = new  BxTemplVo tingView ( 'g'.$this- >sType, 0,  0);   1188                $oVoting View = new  BxTemplVo tingView ( 'g'.$this- >sType, 0,  0);
1183                   1189                
1184                $aSql         = $oV otingView- >getSqlPar ts('`'.$th is->sMainT able.'`',  '`'.$this- >aTableFie lds['medID '].'`');   1190                $aSql         = $oV otingView- >getSqlPar ts('`'.$th is->sMainT able.'`',  '`'.$this- >aTableFie lds['medID '].'`');
1185                $sHow         = $_G ET['rate']  == 'top'  ? "DESC" :  "ASC";   1191                $sHow         = $_G ET['rate']  == 'top'  ? "DESC" :  "ASC";
1186                $aSqlQue ry['sqlOrd er']   = $ oVotingVie w->isEnabl ed() ? "OR DER BY `vo ting_rate`  $sHow, `v oting_coun t` $sHow,  `medDate`  $sHow" : $ aSqlQuery[ 'sqlOrder' ] ;   1192                $aSqlQue ry['sqlOrd er']   = $ oVotingVie w->isEnabl ed() ? "OR DER BY `vo ting_rate`  $sHow, `v oting_coun t` $sHow,  `medDate`  $sHow" : $ aSqlQuery[ 'sqlOrder' ] ;
1187                $aSqlQue ry['rateFi elds']  =  $aSql['fie lds'];   1193                $aSqlQue ry['rateFi elds']  =  $aSql['fie lds'];
1188                $aSqlQue ry['rateJo in']    =  $aSql['joi n'];   1194                $aSqlQue ry['rateJo in']    =  $aSql['joi n'];
1189           }   1195           }
1190              1196           
1191           re turn array ('query'=> $aSqlQuery , 'total'= >$iTotalPa ges, 'per_ page'=>$iP erPage, 'c ur_page'=> $iCurPage) ;   1197           re turn array ('query'=> $aSqlQuery , 'total'= >$iTotalPa ges, 'per_ page'=>$iP erPage, 'c ur_page'=> $iCurPage) ;
1192       }   1198       }
1193          1199       
1194       /*    1200       /* 
1195           Di splay medi a edit for m   1201           Di splay medi a edit for m
1196           *  @param int  $iFile -  file ID   1202           *  @param int  $iFile -  file ID
1197           *  @return st ring $sCod e - html o utput   1203           *  @return st ring $sCod e - html o utput
1198       */          1204       */       
1199          1205       
1200       functi on display MediaEditF orm($iFile ) {   1206       functi on display MediaEditF orm($iFile ) {
1201           $i File = (in t)$iFile;    1207           $i File = (in t)$iFile; 
1202              1208           
1203           $s qlQuery =  "SELECT ";   1209           $s qlQuery =  "SELECT ";
1204              1210           
1205           $s Templ = '< div>__Key_ _</div>';   1211           $s Templ = '< div>__Key_ _</div>';
1206           $s Line = '';   1212           $s Line = '';
1207              1213           
1208           fo reach ($th is->aEditI nfo as $sK ey => $sVa l) {   1214           fo reach ($th is->aEditI nfo as $sK ey => $sVa l) {
1209                $sqlQuer y .= "`{$t his->aTabl eFields[$s Key]}`,";   1215                $sqlQuer y .= "`{$t his->aTabl eFields[$s Key]}`,";
1210                if ($sKe y != 'medP rofId' &&  $sKey != ' medUri') {   1216                if ($sKe y != 'medP rofId' &&  $sKey != ' medUri') {
1211                    $sHe ad  = str_ replace('_ _Key__', _ t('_'.$sVa l), $sTemp l);   1217                    $sHe ad  = str_ replace('_ _Key__', _ t('_'.$sVa l), $sTemp l);
1212                    $sPa tt  = $sKe y != 'medD esc' ? '<i nput type= "text" siz e="40" nam e="'.$sKey .'" value= "'.$sKey.' Val"/>' :  '<textarea  cols="30"  rows="10"  name="'.$ sKey.'">'. $sKey.'Val </textarea >' ;   1218                    $sPa tt  = $sKe y != 'medD esc' ? '<i nput type= "text" siz e="40" nam e="'.$sKey .'" value= "'.$sKey.' Val"/>' :  '<textarea  cols="30"  rows="10"  name="'.$ sKey.'">'. $sKey.'Val </textarea >' ;
1213                    $sMa in  = str_ replace('_ _Key__', $ sPatt, $sT empl);   1219                    $sMa in  = str_ replace('_ _Key__', $ sPatt, $sT empl);
1214                    $sLi ne .= $sHe ad.$sMain;   1220                    $sLi ne .= $sHe ad.$sMain;
1215                }      1221                }   
1216           }   1222           }
1217              1223           
1218           $s qlQuery =  trim($sqlQ uery, ',') . "FROM `{ $this->sMa inTable}`  WHERE `{$t his->aTabl eFields['m edID']}`=' $iFile'";   1224           $s qlQuery =  trim($sqlQ uery, ',') . "FROM `{ $this->sMa inTable}`  WHERE `{$t his->aTabl eFields['m edID']}`=' $iFile'";
1219              1225           
1220           $a Data = db_ arr($sqlQu ery);   1226           $a Data = db_ arr($sqlQu ery);
1221              1227           
1222           if  ($aData[$ this->aTab leFields[' medProfId' ]] != $thi s->iViewer )   1228           if  ($aData[$ this->aTab leFields[' medProfId' ]] != $thi s->iViewer )
1223                exit;   1229                exit;
1224          1230       
1225           fo reach ($th is->aEditI nfo as $sK ey => $sVa l)   1231           fo reach ($th is->aEditI nfo as $sK ey => $sVa l)
1226                $sLine =  str_repla ce($sKey.' Val', $aDa ta[$this-> aTableFiel ds[$sKey]] , $sLine);   1232                $sLine =  str_repla ce($sKey.' Val', $aDa ta[$this-> aTableFiel ds[$sKey]] , $sLine);
1227          1233       
1228           ob _start();   1234           ob _start();
1229           ?>   1235           ?>
1230           <d iv class=" mediaInfo" >   1236           <d iv class=" mediaInfo" >
1231                   1237                
1232           <i frame name ="Edit" st yle="displ ay: none;" ></iframe>   1238           <i frame name ="Edit" st yle="displ ay: none;" ></iframe>
1233                    <for m target=" Edit" name ="submitAc tion" meth od="post"  action="<? =$_SERVER[ 'PHP_SELF' ]?>">   1239                    <for m target=" Edit" name ="submitAc tion" meth od="post"  action="<? =$_SERVER[ 'PHP_SELF' ]?>">
1234                    <?=$ sLine?>   1240                    <?=$ sLine?>
1235                    <div ><input ty pe="submit " size="15 " name="sa ve" value= "<?=_t('_S ave Change s')?>">   1241                    <div ><input ty pe="submit " size="15 " name="sa ve" value= "<?=_t('_S ave Change s')?>">
1236                    <inp ut type="r eset" size ="15" name ="send" va lue="Reset "></div>   1242                    <inp ut type="r eset" size ="15" name ="send" va lue="Reset "></div>
1237                    <inp ut type="h idden" nam e="type" v alue="<?=$ this->sTyp e?>">    1243                    <inp ut type="h idden" nam e="type" v alue="<?=$ this->sTyp e?>"> 
1238                    <inp ut type="h idden" nam e="fileID"  value="<? =$iFile?>" >   1244                    <inp ut type="h idden" nam e="fileID"  value="<? =$iFile?>" >
1239                    <inp ut type="h idden" nam e="mediaAc tion" valu e="edit">   1245                    <inp ut type="h idden" nam e="mediaAc tion" valu e="edit">
1240                </form>   1246                </form>
1241           </ div>   1247           </ div>
1242           <?   1248           <?
1243           $s Code = ob_ get_clean( );   1249           $s Code = ob_ get_clean( );
1244              1250           
1245           re turn $sCod e;   1251           re turn $sCod e;
1246       }   1252       }
1247          1253       
1248       /*   1254       /*
1249           Sa ve content  of media  file   1255           Sa ve content  of media  file
1250           *  @param int  $iFile -  file ID   1256           *  @param int  $iFile -  file ID
1251       */   1257       */
1252          1258       
1253       functi on saveCha nges($iFil e) {   1259       functi on saveCha nges($iFil e) {
1254           $i File = (in t)$iFile;   1260           $i File = (in t)$iFile;
1255              1261           
1256           $s qlQuery =  "UPDATE `$ this->sMai nTable` SE T ";   1262           $s qlQuery =  "UPDATE `$ this->sMai nTable` SE T ";
1257           fo reach ($th is->aEditI nfo as $sK ey => $sVa l) {   1263           fo reach ($th is->aEditI nfo as $sK ey => $sVa l) {
1258                switch ( $sKey) {   1264                switch ( $sKey) {
1259                    case  'medProfI d': break;   1265                    case  'medProfI d': break;
1260                    case  'medUri'  : break;   1266                    case  'medUri'  : break;
1261                    defa ult:    1267                    defa ult: 
1262                         $sInput     = process _db_input( $_POST[$sK ey]);   1268                         $sInput     = process _db_input( $_POST[$sK ey]);
1263                         $sqlQuery  .= "`{$thi s->aTableF ields[$sKe y]}` = '$s Input',";   1269                         $sqlQuery  .= "`{$thi s->aTableF ields[$sKe y]}` = '$s Input',";
1264                }   1270                }
1265           }       1271           }    
1266          1272       
1267           $s qlQuery =  rtrim($sql Query,',') ." WHERE ` {$this->aT ableFields ['medID']} ` = '$iFil e' AND `{$ this->aTab leFields[' medProfId' ]}`='{$thi s->iViewer }'";   1273           $s qlQuery =  rtrim($sql Query,',') ." WHERE ` {$this->aT ableFields ['medID']} ` = '$iFil e' AND `{$ this->aTab leFields[' medProfId' ]}`='{$thi s->iViewer }'";
1268           db _res($sqlQ uery);   1274           db _res($sqlQ uery);
1269           if  (!mysql_a ffected_ro ws())   1275           if  (!mysql_a ffected_ro ws())
1270                exit;   1276                exit;
1271       }   1277       }
1272   }   1278   }
1273     1279  
1274   ?>   1280   ?>