No regular expressions were active.
1 |
|
<?php
|
|
1 |
|
<?php
|
2 |
|
|
|
2 |
|
|
3 |
|
require_on
ce( BX_DIR
ECTORY_PAT
H_CLASSES
. 'BxDolMe
diaQuery.p
hp');
|
|
3 |
|
require_on
ce( BX_DIR
ECTORY_PAT
H_CLASSES
. 'BxDolMe
diaQuery.p
hp');
|
4 |
|
require_on
ce( BX_DIR
ECTORY_PAT
H_CLASSES
. 'BxDolPr
ofile.php'
);
|
|
4 |
|
require_on
ce( BX_DIR
ECTORY_PAT
H_CLASSES
. 'BxDolPr
ofile.php'
);
|
5 |
|
require_on
ce( BX_DIR
ECTORY_PAT
H_CLASSES
. "BxDolVo
ting.php"
);
|
|
5 |
|
require_on
ce( BX_DIR
ECTORY_PAT
H_CLASSES
. "BxDolVo
ting.php"
);
|
6 |
|
|
|
6 |
|
|
7 |
|
class BxDo
lMedia ext
ends BxDol
Mistake
|
|
7 |
|
class BxDo
lMedia ext
ends BxDol
Mistake
|
8 |
|
{
|
|
8 |
|
{
|
9 |
|
var $s
MediaType;
|
|
9 |
|
var $s
MediaType;
|
10 |
|
var $i
ProfileID;
|
|
10 |
|
var $i
ProfileID;
|
11 |
|
var $a
MediaConfi
g;
|
|
11 |
|
var $a
MediaConfi
g;
|
12 |
|
|
|
12 |
|
|
13 |
|
var $s
MediaDir;
|
|
13 |
|
var $s
MediaDir;
|
14 |
|
var $s
MediaUrl;
|
|
14 |
|
var $s
MediaUrl;
|
15 |
|
|
|
15 |
|
|
16 |
|
var $a
Media;
|
|
16 |
|
var $a
Media;
|
17 |
|
var $i
MediaCount
;
|
|
17 |
|
var $i
MediaCount
;
|
18 |
|
|
|
18 |
|
|
19 |
|
var $o
MediaQuery
;
|
|
19 |
|
var $o
MediaQuery
;
|
20 |
|
|
|
20 |
|
|
21 |
|
var $s
SupportedE
xt;
|
|
21 |
|
var $s
SupportedE
xt;
|
22 |
|
|
|
22 |
|
|
23 |
|
var $o
DolVoting
= NULL;
|
|
23 |
|
var $o
DolVoting
= NULL;
|
24 |
|
|
|
24 |
|
|
25 |
|
functi
on BxDolMe
dia()
|
|
25 |
|
functi
on BxDolMe
dia()
|
26 |
|
{
|
|
26 |
|
{
|
27 |
|
$t
his -> oMe
diaQuery =
new BxDol
MediaQuery
();
|
|
27 |
|
$t
his -> oMe
diaQuery =
new BxDol
MediaQuery
();
|
28 |
|
$t
his -> aMe
diaConfig
= $this ->
getMediaC
onfigArray
();
|
|
28 |
|
$t
his -> aMe
diaConfig
= $this ->
getMediaC
onfigArray
();
|
29 |
|
|
|
29 |
|
|
30 |
|
$t
his -> sMe
diaDir = $
this -> aM
ediaConfig
['dir'][$t
his -> sMe
diaType] .
$this ->
iProfileID
. '/';
|
|
30 |
|
$t
his -> sMe
diaDir = $
this -> aM
ediaConfig
['dir'][$t
his -> sMe
diaType] .
$this ->
iProfileID
. '/';
|
31 |
|
$t
his -> sMe
diaUrl = $
this -> aM
ediaConfig
['url'][$t
his -> sMe
diaType] .
$this ->
iProfileID
. '/';
|
|
31 |
|
$t
his -> sMe
diaUrl = $
this -> aM
ediaConfig
['url'][$t
his -> sMe
diaType] .
$this ->
iProfileID
. '/';
|
32 |
|
|
|
32 |
|
|
33 |
|
$t
his -> oDo
lVoting =
new BxDolV
oting ('me
dia', 0, 0
);
|
|
33 |
|
$t
his -> oDo
lVoting =
new BxDolV
oting ('me
dia', 0, 0
);
|
34 |
|
}
|
|
34 |
|
}
|
35 |
|
|
|
35 |
|
|
36 |
|
functi
on getMedi
aArray()
|
|
36 |
|
functi
on getMedi
aArray()
|
37 |
|
{
|
|
37 |
|
{
|
38 |
|
$a
Media = $t
his -> oMe
diaQuery -
> getMedia
Array( $th
is -> iPro
fileID, $t
his -> sMe
diaType,
$this -> o
DolVoting)
;
|
|
38 |
|
$a
Media = $t
his -> oMe
diaQuery -
> getMedia
Array( $th
is -> iPro
fileID, $t
his -> sMe
diaType,
$this -> o
DolVoting)
;
|
39 |
|
$t
his -> aMe
dia = $thi
s -> valid
ateMediaAr
ray( $aMed
ia );
|
|
39 |
|
$t
his -> aMe
dia = $thi
s -> valid
ateMediaAr
ray( $aMed
ia );
|
40 |
|
$t
his -> iMe
diaCount =
count( $t
his -> aMe
dia );
|
|
40 |
|
$t
his -> iMe
diaCount =
count( $t
his -> aMe
dia );
|
41 |
|
}
|
|
41 |
|
}
|
42 |
|
|
|
42 |
|
|
43 |
|
functi
on getActi
veMediaArr
ay()
|
|
43 |
|
functi
on getActi
veMediaArr
ay()
|
44 |
|
{
|
|
44 |
|
{
|
45 |
|
$a
Media = $t
his -> oMe
diaQuery -
> getActiv
eMediaArra
y( $this -
> iProfile
ID, $this
-> sMediaT
ype, $thi
s -> oDolV
oting );
|
|
45 |
|
$a
Media = $t
his -> oMe
diaQuery -
> getActiv
eMediaArra
y( $this -
> iProfile
ID, $this
-> sMediaT
ype, $thi
s -> oDolV
oting );
|
46 |
|
$t
his -> aMe
dia = $thi
s -> valid
ateMediaAr
ray( $aMed
ia );
|
|
46 |
|
$t
his -> aMe
dia = $thi
s -> valid
ateMediaAr
ray( $aMed
ia );
|
47 |
|
$t
his -> iMe
diaCount =
count( $t
his -> aMe
dia );
|
|
47 |
|
$t
his -> iMe
diaCount =
count( $t
his -> aMe
dia );
|
48 |
|
}
|
|
48 |
|
}
|
49 |
|
|
|
49 |
|
|
50 |
|
functi
on validat
eMediaArra
y( &$aMedi
a )
|
|
50 |
|
functi
on validat
eMediaArra
y( &$aMedi
a )
|
51 |
|
{
|
|
51 |
|
{
|
52 |
|
fo
reach($aMe
dia as $iK
ey => $aVa
lue)
|
|
52 |
|
fo
reach($aMe
dia as $iK
ey => $aVa
lue)
|
53 |
|
{
|
|
53 |
|
{
|
54 |
|
$sMediaF
ile = $thi
s -> sMedi
aDir . $aV
alue['med_
file'];
|
|
54 |
|
$sMediaF
ile = $thi
s -> sMedi
aDir . $aV
alue['med_
file'];
|
55 |
|
if( !ext
FileExists
( $sMediaF
ile ) )
|
|
55 |
|
if( !ext
FileExists
( $sMediaF
ile ) )
|
56 |
|
unse
t( $aMedia
[$iKey]);
|
|
56 |
|
unse
t( $aMedia
[$iKey]);
|
57 |
|
}
|
|
57 |
|
}
|
58 |
|
|
|
58 |
|
|
59 |
|
re
turn array
_values( $
aMedia );
|
|
59 |
|
re
turn array
_values( $
aMedia );
|
60 |
|
}
|
|
60 |
|
}
|
61 |
|
|
|
61 |
|
|
62 |
|
functi
on getMedi
aPage()
|
|
62 |
|
functi
on getMedi
aPage()
|
63 |
|
{
|
|
63 |
|
{
|
64 |
|
gl
obal $dir;
|
|
|
65 |
|
gl
obal $tmpl
;
|
|
64 |
|
gl
obal $tmpl
;
|
66 |
|
|
|
65 |
|
|
67 |
|
re
quire_once
( BX_DIREC
TORY_PATH_
INC . 'pro
files.inc.
php' );
|
|
66 |
|
re
quire_once
( BX_DIREC
TORY_PATH_
INC . 'pro
files.inc.
php' );
|
68 |
|
$t
his -> get
MediaArray
();
|
|
67 |
|
$t
his -> get
MediaArray
();
|
69 |
|
|
|
68 |
|
|
70 |
|
$r
et = '<div
class="cl
ear_both">
</div>';
|
|
69 |
|
$r
et = '<div
class="cl
ear_both">
</div>';
|
71 |
|
|
|
70 |
|
|
72 |
|
$tmplBlock
=
file_get_c
ontents(
"
{$dir['roo
t']}
templates/
tmpl_{$tmp
l}/media_p
age_block.
html"
);
|
|
71 |
|
$tmplBlock
=
file_get_c
ontents(
BX_DIRECTO
RY_PATH_RO
OT
.
"
templates/
tmpl_{$tmp
l}/media_p
age_block.
html"
);
|
73 |
|
|
|
72 |
|
|
74 |
|
$i
= 1;
|
|
73 |
|
$i
= 1;
|
75 |
|
fo
reach($thi
s -> aMedi
a as $aVal
ue )
|
|
74 |
|
fo
reach($thi
s -> aMedi
a as $aVal
ue )
|
76 |
|
{
|
|
75 |
|
{
|
77 |
|
$block =
$tmplBloc
k;
|
|
76 |
|
$block =
$tmplBloc
k;
|
78 |
|
|
|
77 |
|
|
79 |
|
$aReplac
e['media_t
itle'] = p
rocess_lin
e_output(
$aValue['m
ed_title']
);
|
|
78 |
|
$aReplac
e['media_t
itle'] = p
rocess_lin
e_output(
$aValue['m
ed_title']
);
|
80 |
|
$aReplac
e['media_i
con'] = '
<img src="
'.getTempl
ateIcon( $
this -> sM
ediaType .
'.jpg' ).
'" />';
|
|
79 |
|
$aReplac
e['media_i
con'] = '
<img src="
'.getTempl
ateIcon( $
this -> sM
ediaType .
'.jpg' ).
'" />';
|
81 |
|
$aReplac
e['nicknam
e'] = '
';
|
|
80 |
|
$aReplac
e['nicknam
e'] = '
';
|
82 |
|
$aReplac
e['downloa
d'] = '
<a href="'
. $this -
> getMedia
Link( $aVa
lue ) . '"
>'._t('_do
wnload').'
</a>';
|
|
81 |
|
$aReplac
e['downloa
d'] = '
<a href="'
. $this -
> getMedia
Link( $aVa
lue ) . '"
>'._t('_do
wnload').'
</a>';
|
83 |
|
$aReplac
e['delete'
] = '
<a href="'
. $_SERVE
R['PHP_SEL
F'] . '?sh
ow=' . $th
is -> sMed
iaType . '
&actio
n=delete&a
mp;mediaID
='.
|
|
82 |
|
$aReplac
e['delete'
] = '
<a href="'
. $_SERVE
R['PHP_SEL
F'] . '?sh
ow=' . $th
is -> sMed
iaType . '
&actio
n=delete&a
mp;mediaID
='.
|
84 |
|
$aVa
lue['med_i
d'] . '" o
nclick="re
turn confi
rm(\''._t(
'_are you
sure?').'\
');">'._t(
'_delete')
.'</a>';
|
|
83 |
|
$aVa
lue['med_i
d'] . '" o
nclick="re
turn confi
rm(\''._t(
'_are you
sure?').'\
');">'._t(
'_delete')
.'</a>';
|
85 |
|
|
|
84 |
|
|
86 |
|
foreach(
$aReplace
as $key =
> $val )
|
|
85 |
|
foreach(
$aReplace
as $key =
> $val )
|
87 |
|
$blo
ck = str_r
eplace( "_
_{$key}__"
, $val, $b
lock );
|
|
86 |
|
$blo
ck = str_r
eplace( "_
_{$key}__"
, $val, $b
lock );
|
88 |
|
|
|
87 |
|
|
89 |
|
$ret .=
$block;
|
|
88 |
|
$ret .=
$block;
|
90 |
|
|
|
89 |
|
|
91 |
|
if( $i++
>= $this
-> aMediaC
onfig['max
'][$this -
> sMediaTy
pe] )
|
|
90 |
|
if( $i++
>= $this
-> aMediaC
onfig['max
'][$this -
> sMediaTy
pe] )
|
92 |
|
brea
k;
|
|
91 |
|
brea
k;
|
93 |
|
}
|
|
92 |
|
}
|
94 |
|
$r
et .= '<di
v class="c
lear_both"
></div>';
|
|
93 |
|
$r
et .= '<di
v class="c
lear_both"
></div>';
|
95 |
|
|
|
94 |
|
|
96 |
|
re
turn $ret;
|
|
95 |
|
re
turn $ret;
|
97 |
|
}
|
|
96 |
|
}
|
98 |
|
|
|
97 |
|
|
99 |
|
functi
on getMedi
aLink( $aM
edia )
|
|
98 |
|
functi
on getMedi
aLink( $aM
edia )
|
100 |
|
{
|
|
99 |
|
{
|
101 |
|
$s
File = $th
is -> aMed
iaConfig['
dir']['tmp
'] . $aMed
ia['med_fi
le'];
|
|
100 |
|
$s
File = $th
is -> aMed
iaConfig['
dir']['tmp
'] . $aMed
ia['med_fi
le'];
|
102 |
|
|
|
101 |
|
|
103 |
|
if
( extFileE
xists( $sF
ile ) )
|
|
102 |
|
if
( extFileE
xists( $sF
ile ) )
|
104 |
|
return $
this -> aM
ediaConfig
['site']['
tmp'] . $a
Media['med
_file'];
|
|
103 |
|
return $
this -> aM
ediaConfig
['site']['
tmp'] . $a
Media['med
_file'];
|
105 |
|
el
se
|
|
104 |
|
el
se
|
106 |
|
if( copy
($this ->
sMediaDir
. $aMedia[
'med_file'
], $sFile
) )
|
|
105 |
|
if( copy
($this ->
sMediaDir
. $aMedia[
'med_file'
], $sFile
) )
|
107 |
|
retu
rn $this -
> aMediaCo
nfig['site
']['tmp']
. $aMedia[
'med_file'
];
|
|
106 |
|
retu
rn $this -
> aMediaCo
nfig['site
']['tmp']
. $aMedia[
'med_file'
];
|
108 |
|
|
|
107 |
|
|
109 |
|
re
turn false
;
|
|
108 |
|
re
turn false
;
|
110 |
|
}
|
|
109 |
|
}
|
111 |
|
|
|
110 |
|
|
112 |
|
functi
on uploadM
edia()
|
|
111 |
|
functi
on uploadM
edia()
|
113 |
|
{
|
|
112 |
|
{
|
114 |
|
|
|
113 |
|
|
115 |
|
$s
MediaDir =
$this ->
getProfile
MediaDir()
;
|
|
114 |
|
$s
MediaDir =
$this ->
getProfile
MediaDir()
;
|
116 |
|
if
( !$sMedia
Dir )
|
|
115 |
|
if
( !$sMedia
Dir )
|
117 |
|
return '
failed to
open profi
le directo
ry';
|
|
116 |
|
return '
failed to
open profi
le directo
ry';
|
118 |
|
|
|
117 |
|
|
119 |
|
$a
SupoortedE
xt = split
(',', strt
olower($th
is -> sSup
portedExt)
);
|
|
118 |
|
$a
SupoortedE
xt = split
(',', strt
olower($th
is -> sSup
portedExt)
);
|
120 |
|
$s
FileName =
time();
|
|
119 |
|
$s
FileName =
time();
|
121 |
|
$a
Ext = path
info( $_FI
LES[$this
-> sMediaT
ype]['name
'] );
|
|
120 |
|
$a
Ext = path
info( $_FI
LES[$this
-> sMediaT
ype]['name
'] );
|
122 |
|
$e
xt = strto
lower( $aE
xt['extens
ion'] );
|
|
121 |
|
$e
xt = strto
lower( $aE
xt['extens
ion'] );
|
123 |
|
|
|
122 |
|
|
124 |
|
//
print_r( $
_FILES);
|
|
123 |
|
//
print_r( $
_FILES);
|
125 |
|
|
|
124 |
|
|
126 |
|
if
( ( 0 == $
_FILES[$th
is -> sMed
iaType]['e
rror'] ) )
|
|
125 |
|
if
( ( 0 == $
_FILES[$th
is -> sMed
iaType]['e
rror'] ) )
|
127 |
|
{
|
|
126 |
|
{
|
128 |
|
$iMaxFil
eSize = (
( ( $this
-> aMediaC
onfig['max
'][$this -
> sMediaTy
pe . 'File
'] ) * 102
4 ) * 1024
);
|
|
127 |
|
$iMaxFil
eSize = (
( ( $this
-> aMediaC
onfig['max
'][$this -
> sMediaTy
pe . 'File
'] ) * 102
4 ) * 1024
);
|
129 |
|
if( $iMa
xFileSize
>= $_FILES
[$this ->
sMediaType
]['size']
)
|
|
128 |
|
if( $iMa
xFileSize
>= $_FILES
[$this ->
sMediaType
]['size']
)
|
130 |
|
{
|
|
129 |
|
{
|
131 |
|
if(
in_array(
$ext, $aSu
poortedExt
) )
|
|
130 |
|
if(
in_array(
$ext, $aSu
poortedExt
) )
|
132 |
|
{
|
|
131 |
|
{
|
133 |
|
if( move_u
ploaded_fi
le($_FILES
[$this ->
sMediaType
]['tmp_nam
e'], $sMed
iaDir . $s
FileName .
'.' . $ex
t ) )
|
|
132 |
|
if( move_u
ploaded_fi
le($_FILES
[$this ->
sMediaType
]['tmp_nam
e'], $sMed
iaDir . $s
FileName .
'.' . $ex
t ) )
|
134 |
|
{
|
|
133 |
|
{
|
135 |
|
$sFile
Title = pr
ocess_db_i
nput( html
specialcha
rs_adv($_P
OST['title
'] ));
|
|
134 |
|
$sFile
Title = pr
ocess_db_i
nput( html
specialcha
rs_adv($_P
OST['title
'] ));
|
136 |
|
if( $t
his -> oMe
diaQuery -
> insertMe
dia( $this
-> iProfi
leID, $thi
s -> sMedi
aType, $sF
ileName .
'.' . $ext
, $sFileTi
tle ) )
|
|
135 |
|
if( $t
his -> oMe
diaQuery -
> insertMe
dia( $this
-> iProfi
leID, $thi
s -> sMedi
aType, $sF
ileName .
'.' . $ext
, $sFileTi
tle ) )
|
137 |
|
$r
et .= 'fai
le success
fully uplo
aded <br>'
;
|
|
136 |
|
$r
et .= 'fai
le success
fully uplo
aded <br>'
;
|
138 |
|
}
|
|
137 |
|
}
|
139 |
|
else
|
|
138 |
|
else
|
140 |
|
$ret .
= 'failed
to upload
file <br>'
;
|
|
139 |
|
$ret .
= 'failed
to upload
file <br>'
;
|
141 |
|
}
|
|
140 |
|
}
|
142 |
|
else
|
|
141 |
|
else
|
143 |
|
$ret .= 'y
ou tried t
o upload n
ot support
ed format
<br>';
|
|
142 |
|
$ret .= 'y
ou tried t
o upload n
ot support
ed format
<br>';
|
144 |
|
}
|
|
143 |
|
}
|
145 |
|
else
|
|
144 |
|
else
|
146 |
|
$ret
.= 'file
to big <br
>';
|
|
145 |
|
$ret
.= 'file
to big <br
>';
|
147 |
|
}
|
|
146 |
|
}
|
148 |
|
el
se
|
|
147 |
|
el
se
|
149 |
|
$ret .=
'you have
an error w
hile uploa
ding the f
ile <br>';
|
|
148 |
|
$ret .=
'you have
an error w
hile uploa
ding the f
ile <br>';
|
150 |
|
|
|
149 |
|
|
151 |
|
re
turn $ret;
|
|
150 |
|
re
turn $ret;
|
152 |
|
}
|
|
151 |
|
}
|
153 |
|
|
|
152 |
|
|
154 |
|
functi
on insertM
ediaToDb(
$sFileName
)
|
|
153 |
|
functi
on insertM
ediaToDb(
$sFileName
)
|
155 |
|
{
|
|
154 |
|
{
|
156 |
|
$s
MediaType
= process_
db_input($
this -> sM
ediaType);
|
|
155 |
|
$sFileTitl
e
=
process_
p
a
s
s_
d
ata
(
$_POST['ti
tle']
)
;
|
157 |
|
$s
FileName =
process_d
b_input( $
sFileName
);
|
|
|
158 |
|
$sFileTitl
e
=
process_
db_in
p
ut(
htmlspeci
a
lchar
s_
a
d
v
($_POST['t
itle'])
)
;
|
|
|
159 |
|
|
|
156 |
|
|
160 |
|
$s
Status = g
etParam("a
utoApprova
l_Photo")
== 'on' ?
'active' :
'passive'
;
|
|
157 |
|
$s
Status = g
etParam("a
utoApprova
l_Photo")
== 'on' ?
'active' :
'passive'
;
|
161 |
|
$iResult
=
$this
->
oMediaQuer
y
->
insertMedi
a(
$this
->
iProfileID
,
$
sMediaType
,
$sFileName
,
$sFileTitl
e,
$sStatus
);
|
|
158 |
|
$iResult
=
$this
->
oMediaQuer
y
->
insertMedi
a(
$this
->
iProfileID
,
$
this
->
sMediaType
,
$sFileName
,
$sFileTitl
e,
$sStatus
);
|
162 |
|
|
|
159 |
|
|
163 |
|
if
( 0 < $iRe
sult )
|
|
160 |
|
if
( 0 < $iRe
sult )
|
164 |
|
{
|
|
161 |
|
{
|
165 |
|
if (getP
aram("auto
Approval_i
fPhoto") !
= 'on' )
|
|
162 |
|
if (getP
aram("auto
Approval_i
fPhoto") !
= 'on' )
|
166 |
|
{
|
|
163 |
|
{
|
167 |
|
$sql
Query = "U
PDATE `Pro
files` set
`Status`=
'Approval'
WHERE `ID
`={$this -
> iProfile
ID}";
|
|
164 |
|
$sql
Query = "U
PDATE `Pro
files` set
`Status`=
'Approval'
WHERE `ID
`={$this -
> iProfile
ID}";
|
168 |
|
db_r
es($sqlQue
ry);
|
|
165 |
|
db_r
es($sqlQue
ry);
|
169 |
|
crea
teUserData
File( $thi
s -> iProf
ileID );
|
|
166 |
|
crea
teUserData
File( $thi
s -> iProf
ileID );
|
170 |
|
repa
rseObjTags
( 'profile
', $this -
> iProfile
ID );
|
|
167 |
|
repa
rseObjTags
( 'profile
', $this -
> iProfile
ID );
|
171 |
|
}
|
|
168 |
|
}
|
172 |
|
return t
rue;
|
|
169 |
|
return t
rue;
|
173 |
|
}
|
|
170 |
|
}
|
174 |
|
el
se
|
|
171 |
|
el
se
|
175 |
|
{
|
|
172 |
|
{
|
176 |
|
return f
alse;
|
|
173 |
|
return f
alse;
|
177 |
|
}
|
|
174 |
|
}
|
178 |
|
}
|
|
175 |
|
}
|
179 |
|
|
|
176 |
|
|
180 |
|
functi
on deleteM
edia( $iMe
diaID )
|
|
177 |
|
functi
on deleteM
edia( $iMe
diaID )
|
181 |
|
{
|
|
178 |
|
{
|
182 |
|
$a
MediaFile
= $this ->
getElemen
tArrayByID
( $iMediaI
D );
|
|
179 |
|
$a
MediaFile
= $this ->
getElemen
tArrayByID
( $iMediaI
D );
|
183 |
|
|
|
180 |
|
|
184 |
|
$t
his -> oMe
diaQuery -
> deleteMe
dia( $this
-> iProfi
leID, $aMe
diaFile['m
ed_id'], $
this -> sM
ediaType )
;
|
|
181 |
|
$t
his -> oMe
diaQuery -
> deleteMe
dia( $this
-> iProfi
leID, $aMe
diaFile['m
ed_id'], $
this -> sM
ediaType )
;
|
185 |
|
|
|
182 |
|
|
186 |
|
$s
FileSrc =
$this -> s
MediaDir .
$aMediaFi
le['med_fi
le'];
|
|
183 |
|
$s
FileSrc =
$this -> s
MediaDir .
$aMediaFi
le['med_fi
le'];
|
187 |
|
@u
nlink($sFi
leSrc);
|
|
184 |
|
@u
nlink($sFi
leSrc);
|
188 |
|
}
|
|
185 |
|
}
|
189 |
|
|
|
186 |
|
|
190 |
|
functi
on getProf
ileMediaDi
r()
|
|
187 |
|
functi
on getProf
ileMediaDi
r()
|
191 |
|
{
|
|
188 |
|
{
|
192 |
|
if
( extDirEx
ists( $thi
s -> sMedi
aDir ) )
|
|
189 |
|
if
( extDirEx
ists( $thi
s -> sMedi
aDir ) )
|
193 |
|
{
|
|
190 |
|
{
|
194 |
|
return $
this -> sM
ediaDir;
|
|
191 |
|
return $
this -> sM
ediaDir;
|
195 |
|
}
|
|
192 |
|
}
|
196 |
|
el
se
|
|
193 |
|
el
se
|
197 |
|
{
|
|
194 |
|
{
|
198 |
|
if( mkdi
r( $this -
> sMediaDi
r ) )
|
|
195 |
|
if( mkdi
r( $this -
> sMediaDi
r ) )
|
199 |
|
{
|
|
196 |
|
{
|
200 |
|
chmo
d ($this -
> sMediaDi
r, 0777);
|
|
197 |
|
chmo
d ($this -
> sMediaDi
r, 0777);
|
201 |
|
retu
rn $this -
> sMediaDi
r;
|
|
198 |
|
retu
rn $this -
> sMediaDi
r;
|
202 |
|
}
|
|
199 |
|
}
|
203 |
|
}
|
|
200 |
|
}
|
204 |
|
|
|
201 |
|
|
205 |
|
re
turn false
;
|
|
202 |
|
re
turn false
;
|
206 |
|
}
|
|
203 |
|
}
|
207 |
|
|
|
204 |
|
|
208 |
|
functi
on getElem
entArrayBy
ID( $iMedi
aID )
|
|
205 |
|
functi
on getElem
entArrayBy
ID( $iMedi
aID )
|
209 |
|
{
|
|
206 |
|
{
|
210 |
|
fo
reach($thi
s -> aMedi
a as $aVal
ue)
|
|
207 |
|
fo
reach($thi
s -> aMedi
a as $aVal
ue)
|
211 |
|
{
|
|
208 |
|
{
|
212 |
|
if( $iMe
diaID == $
aValue['me
d_id'] )
|
|
209 |
|
if( $iMe
diaID == $
aValue['me
d_id'] )
|
213 |
|
{
|
|
210 |
|
{
|
214 |
|
retu
rn $aValue
;
|
|
211 |
|
retu
rn $aValue
;
|
215 |
|
}
|
|
212 |
|
}
|
216 |
|
}
|
|
213 |
|
}
|
217 |
|
}
|
|
214 |
|
}
|
218 |
|
|
|
215 |
|
|
219 |
|
functi
on getRati
ng( $iSum,
$iCount )
|
|
216 |
|
functi
on getRati
ng( $iSum,
$iCount )
|
220 |
|
{
|
|
217 |
|
{
|
221 |
|
$i
PossibleMa
x = $this
-> aMediaC
onfig['max
']['voting
'] * $iCou
nt;
|
|
218 |
|
$i
PossibleMa
x = $this
-> aMediaC
onfig['max
']['voting
'] * $iCou
nt;
|
222 |
|
$i
PossibleMi
n = $this
-> aMediaC
onfig['min
']['voting
'] * $iCou
nt;
|
|
219 |
|
$i
PossibleMi
n = $this
-> aMediaC
onfig['min
']['voting
'] * $iCou
nt;
|
223 |
|
|
|
220 |
|
|
224 |
|
if
( !$iSum |
| !$iCount
)
|
|
221 |
|
if
( !$iSum |
| !$iCount
)
|
225 |
|
{
|
|
222 |
|
{
|
226 |
|
return 0
;
|
|
223 |
|
return 0
;
|
227 |
|
}
|
|
224 |
|
}
|
228 |
|
|
|
225 |
|
|
229 |
|
$i
MediaRate
= $iSum *
100 / $iPo
ssibleMax;
|
|
226 |
|
$i
MediaRate
= $iSum *
100 / $iPo
ssibleMax;
|
230 |
|
$i
MediaRate
= round( $
iMediaRate
);
|
|
227 |
|
$i
MediaRate
= round( $
iMediaRate
);
|
231 |
|
re
turn $iMed
iaRate;
|
|
228 |
|
re
turn $iMed
iaRate;
|
232 |
|
}
|
|
229 |
|
}
|
233 |
|
|
|
230 |
|
|
234 |
|
functi
on getMedi
aConfigArr
ay()
|
|
231 |
|
functi
on getMedi
aConfigArr
ay()
|
235 |
|
{
|
|
232 |
|
{
|
236 |
|
gl
obal $site
, $dir;
|
|
233 |
|
gl
obal $site
, $dir;
|
237 |
|
gl
obal $max_
voting_mar
k;
|
|
234 |
|
gl
obal $max_
voting_mar
k;
|
238 |
|
gl
obal $min_
voting_mar
k;
|
|
235 |
|
gl
obal $min_
voting_mar
k;
|
239 |
|
gl
obal $max_
voting_per
iod;
|
|
236 |
|
gl
obal $max_
voting_per
iod;
|
240 |
|
|
|
237 |
|
|
241 |
|
gl
obal $max_
icon_width
;
|
|
238 |
|
gl
obal $max_
icon_width
;
|
242 |
|
gl
obal $max_
icon_heigh
t;
|
|
239 |
|
gl
obal $max_
icon_heigh
t;
|
243 |
|
gl
obal $max_
thumb_widt
h;
|
|
240 |
|
gl
obal $max_
thumb_widt
h;
|
244 |
|
gl
obal $max_
thumb_heig
ht;
|
|
241 |
|
gl
obal $max_
thumb_heig
ht;
|
245 |
|
gl
obal $max_
photo_widt
h;
|
|
242 |
|
gl
obal $max_
photo_widt
h;
|
246 |
|
gl
obal $max_
photo_heig
ht;
|
|
243 |
|
gl
obal $max_
photo_heig
ht;
|
247 |
|
|
|
244 |
|
|
248 |
|
gl
obal $max_
photo_file
s;
|
|
245 |
|
gl
obal $max_
photo_file
s;
|
249 |
|
gl
obal $max_
photo_size
;
|
|
246 |
|
gl
obal $max_
photo_size
;
|
250 |
|
gl
obal $max_
media_titl
e;
|
|
247 |
|
gl
obal $max_
media_titl
e;
|
251 |
|
gl
obal $min_
media_titl
e;
|
|
248 |
|
gl
obal $min_
media_titl
e;
|
252 |
|
|
|
249 |
|
|
253 |
|
|
|
250 |
|
|
254 |
|
$a
MediaConfi
g = array(
);
|
|
251 |
|
$a
MediaConfi
g = array(
);
|
255 |
|
|
|
252 |
|
|
256 |
|
$a
MediaConfi
g['enable'
]['photo']
= 1;
|
|
253 |
|
$a
MediaConfi
g['enable'
]['photo']
= 1;
|
257 |
|
|
|
254 |
|
|
258 |
|
$a
MediaConfi
g['profile
']['ID'] =
(int)$thi
s -> iProf
ileID;
|
|
255 |
|
$a
MediaConfi
g['profile
']['ID'] =
(int)$thi
s -> iProf
ileID;
|
259 |
|
$a
MediaConfi
g['url']['
site'] = $
site['url'
];
|
|
256 |
|
$a
MediaConfi
g['url']['
site'] = $
site['url'
];
|
260 |
|
$a
MediaConfi
g['url']['
media'] =
$aMediaCon
fig['url']
['site'] .
'upload_m
edia.php';
|
|
257 |
|
$a
MediaConfi
g['url']['
media'] =
$aMediaCon
fig['url']
['site'] .
'upload_m
edia.php';
|
261 |
|
$a
MediaConfi
g['max']['
mediaTitle
'] = (int)
$max_media
_title ? $
max_media_
title : 15
0; //Max n
umbers of
chars in m
edia title
|
|
258 |
|
$a
MediaConfi
g['max']['
mediaTitle
'] = (int)
$max_media
_title ? $
max_media_
title : 15
0; //Max n
umbers of
chars in m
edia title
|
262 |
|
$a
MediaConfi
g['min']['
mediaTitle
'] = (int)
$min_media
_title ? $
min_media_
title : 3;
//Min num
bers of ch
ars in med
ia title
|
|
259 |
|
$a
MediaConfi
g['min']['
mediaTitle
'] = (int)
$min_media
_title ? $
min_media_
title : 3;
//Min num
bers of ch
ars in med
ia title
|
263 |
|
$a
MediaConfi
g['enable'
]['voting'
] = true;
|
|
260 |
|
$a
MediaConfi
g['enable'
]['voting'
] = true;
|
264 |
|
if
( $aMediaC
onfig['ena
ble']['vot
ing'] )
|
|
261 |
|
if
( $aMediaC
onfig['ena
ble']['vot
ing'] )
|
265 |
|
{
|
|
262 |
|
{
|
266 |
|
$aMediaC
onfig['min
']['voting
'] = (int)
$min_votin
g_mark ? (
int)$min_v
oting_mark
: 1;
|
|
263 |
|
$aMediaC
onfig['min
']['voting
'] = (int)
$min_votin
g_mark ? (
int)$min_v
oting_mark
: 1;
|
267 |
|
$aMediaC
onfig['max
']['voting
'] = (int)
$max_votin
g_mark ? (
int)$max_v
oting_mark
: 5;
|
|
264 |
|
$aMediaC
onfig['max
']['voting
'] = (int)
$max_votin
g_mark ? (
int)$max_v
oting_mark
: 5;
|
268 |
|
$aMediaC
onfig['max
']['voting
Period'] =
(int)$max
_voting_pe
riod ? (in
t)$max_vot
ing_period
: 24; //i
n hours
|
|
265 |
|
$aMediaC
onfig['max
']['voting
Period'] =
(int)$max
_voting_pe
riod ? (in
t)$max_vot
ing_period
: 24; //i
n hours
|
269 |
|
}
|
|
266 |
|
}
|
270 |
|
$a
MediaConfi
g['dir']['
tmp'] = $d
ir['tmp'];
|
|
267 |
|
$a
MediaConfi
g['dir']['
tmp'] = $d
ir['tmp'];
|
271 |
|
|
|
268 |
|
|
272 |
|
sw
itch( $thi
s -> sMedi
aType )
|
|
269 |
|
sw
itch( $thi
s -> sMedi
aType )
|
273 |
|
{
|
|
270 |
|
{
|
274 |
|
case 'ph
oto':
|
|
271 |
|
case 'ph
oto':
|
275 |
|
$aMe
diaConfig[
'size']['i
conWidth']
= (int)$m
ax_icon_wi
dth ? (int
)$max_icon
_width : 4
5;
|
|
272 |
|
$aMe
diaConfig[
'size']['i
conWidth']
= (int)$m
ax_icon_wi
dth ? (int
)$max_icon
_width : 4
5;
|
276 |
|
$aMe
diaConfig[
'size']['i
conHeight'
] = (int)$
max_icon_h
eight ? (i
nt)$max_ic
on_height
: 45;
|
|
273 |
|
$aMe
diaConfig[
'size']['i
conHeight'
] = (int)$
max_icon_h
eight ? (i
nt)$max_ic
on_height
: 45;
|
277 |
|
$aMe
diaConfig[
'size']['t
humbWidth'
] = (int)$
max_thumb_
width ? (i
nt)$max_th
umb_width
: 110;
|
|
274 |
|
$aMe
diaConfig[
'size']['t
humbWidth'
] = (int)$
max_thumb_
width ? (i
nt)$max_th
umb_width
: 110;
|
278 |
|
$aMe
diaConfig[
'size']['t
humbHeight
'] = (int)
$max_thumb
_height ?
(int)$max_
thumb_heig
ht : 110;
|
|
275 |
|
$aMe
diaConfig[
'size']['t
humbHeight
'] = (int)
$max_thumb
_height ?
(int)$max_
thumb_heig
ht : 110;
|
279 |
|
$aMe
diaConfig[
'size']['p
hotoWidth'
] = (int)$
max_photo_
width ? (i
nt)$max_ph
oto_width
: 400;
|
|
276 |
|
$aMe
diaConfig[
'size']['p
hotoWidth'
] = (int)$
max_photo_
width ? (i
nt)$max_ph
oto_width
: 400;
|
280 |
|
$aMe
diaConfig[
'size']['p
hotoHeight
'] = (int)
$max_photo
_height ?
(int)$max_
photo_heig
ht : 400;
|
|
277 |
|
$aMe
diaConfig[
'size']['p
hotoHeight
'] = (int)
$max_photo
_height ?
(int)$max_
photo_heig
ht : 400;
|
281 |
|
$aMe
diaConfig[
'dir']['ph
oto'] = $d
ir['profil
eImage'];
|
|
278 |
|
$aMe
diaConfig[
'dir']['ph
oto'] = $d
ir['profil
eImage'];
|
282 |
|
$aMe
diaConfig[
'url']['ph
oto'] = $s
ite['profi
leImage'];
|
|
279 |
|
$aMe
diaConfig[
'url']['ph
oto'] = $s
ite['profi
leImage'];
|
283 |
|
$aMe
diaConfig[
'max']['ph
oto'] = (i
nt)$max_ph
oto_files
? (int)$ma
x_photo_fi
les : 20;
// Max num
ber of pho
tos
|
|
280 |
|
$aMe
diaConfig[
'max']['ph
oto'] = (i
nt)$max_ph
oto_files
? (int)$ma
x_photo_fi
les : 20;
// Max num
ber of pho
tos
|
284 |
|
$aMe
diaConfig[
'max']['ph
otoFile']
= $max_pho
to_size *
1024 * 102
4; // in M
B
|
|
281 |
|
$aMe
diaConfig[
'max']['ph
otoFile']
= $max_pho
to_size *
1024 * 102
4; // in M
B
|
285 |
|
break;
|
|
282 |
|
break;
|
286 |
|
}
|
|
283 |
|
}
|
287 |
|
|
|
284 |
|
|
288 |
|
$a
MediaConfi
g['site']
= $site;
|
|
285 |
|
$a
MediaConfi
g['site']
= $site;
|
289 |
|
|
|
286 |
|
|
290 |
|
re
turn $aMed
iaConfig;
|
|
287 |
|
re
turn $aMed
iaConfig;
|
291 |
|
}
|
|
288 |
|
}
|
292 |
|
|
|
289 |
|
|
293 |
|
|
|
290 |
|
|
294 |
|
}
|
|
291 |
|
}
|
295 |
|
|
|
292 |
|
|
296 |
|
?>
|
|
293 |
|
?>
|