No regular expressions were active.
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 . 'ad
min.inc.ph
p');
|
|
3 |
|
require_on
ce(BX_DIRE
CTORY_PATH
_INC . 'ad
min.inc.ph
p');
|
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 . 'pr
ofiles.inc
.php' );
|
|
5 |
|
require_on
ce(BX_DIRE
CTORY_PATH
_INC . 'pr
ofiles.inc
.php' );
|
6 |
|
require_on
ce(BX_DIRE
CTORY_PATH
_INC . 'ut
ils.inc.ph
p' );
|
|
6 |
|
require_on
ce(BX_DIRE
CTORY_PATH
_INC . 'ut
ils.inc.ph
p' );
|
7 |
|
require_on
ce(BX_DIRE
CTORY_PATH
_INC . 'ta
gs.inc.php
' );
|
|
7 |
|
require_on
ce(BX_DIRE
CTORY_PATH
_INC . 'ta
gs.inc.php
' );
|
8 |
|
|
|
8 |
|
|
9 |
|
/*
|
|
9 |
|
/*
|
10 |
|
* class f
or Events
|
|
10 |
|
* class f
or Events
|
11 |
|
*/
|
|
11 |
|
*/
|
12 |
|
class BxDo
lArticles
{
|
|
12 |
|
class BxDo
lArticles
{
|
13 |
|
|
|
13 |
|
|
14 |
|
//admi
n mode, ca
n All acti
ons
|
|
14 |
|
//admi
n mode, ca
n All acti
ons
|
15 |
|
var $b
AdminMode;
|
|
15 |
|
var $b
AdminMode;
|
16 |
|
|
|
16 |
|
|
17 |
|
var $s
CurrBrowse
dFile;
|
|
17 |
|
var $s
CurrBrowse
dFile;
|
18 |
|
|
|
18 |
|
|
19 |
|
var $i
VisitorID;
|
|
19 |
|
var $i
VisitorID;
|
20 |
|
|
|
20 |
|
|
21 |
|
var $s
Url;
|
|
21 |
|
var $s
Url;
|
22 |
|
|
|
22 |
|
|
23 |
|
//cons
tructor
|
|
23 |
|
//cons
tructor
|
24 |
|
function
BxDolArtic
les(
$
bAdminM
o
d
e
,
$sCurrBrow
sedFile=''
)
{
|
|
24 |
|
function
BxDolArtic
les(
$
l
o
gg
e
d
,
$sCurrBrow
sedFile=''
)
{
|
25 |
|
gl
obal $site
;
|
|
25 |
|
gl
obal $site
;
|
26 |
|
$this->bAd
minMode
=
$
bA
dmin
Mod
e;
|
|
26 |
|
|
|
|
27 |
|
$this->bAd
minMode
=
$
logged['a
dmin
']
?
true
:
fals
e;
|
27 |
|
$t
his->iVisi
torID = (i
nt)$_COOKI
E['memberI
D'];
|
|
28 |
|
$t
his->iVisi
torID = (i
nt)$_COOKI
E['memberI
D'];
|
28 |
|
$t
his->sCurr
BrowsedFil
e = ($sCur
rBrowsedFi
le=='') ?
$_SERVER['
PHP_SELF']
: $sCurrB
rowsedFile
;
|
|
29 |
|
$t
his->sCurr
BrowsedFil
e = ($sCur
rBrowsedFi
le=='') ?
$_SERVER['
PHP_SELF']
: $sCurrB
rowsedFile
;
|
29 |
|
|
|
30 |
|
|
30 |
|
if
( $logged[
'admin'] )
{
|
|
31 |
|
if
( $this->b
AdminMode
) {
|
31 |
|
$this->s
Url = $sit
e['url_adm
in'];
|
|
32 |
|
$this->s
Url = $sit
e['url_adm
in'];
|
32 |
|
}
else {
|
|
33 |
|
}
else {
|
33 |
|
$this->s
Url = $sit
e['url'];
|
|
34 |
|
$this->s
Url = $sit
e['url'];
|
34 |
|
}
|
|
35 |
|
}
|
35 |
|
}
|
|
36 |
|
}
|
36 |
|
|
|
37 |
|
|
37 |
|
/**
|
|
38 |
|
/**
|
38 |
|
*
|
|
39 |
|
*
|
39 |
|
*
|
|
40 |
|
*
|
40 |
|
* @pa
ram
|
|
41 |
|
* @pa
ram
|
41 |
|
* @re
turn HTML
presentati
on of data
|
|
42 |
|
* @re
turn HTML
presentati
on of data
|
42 |
|
*/
|
|
43 |
|
*/
|
43 |
|
function
getArticle
sCateg
i
riesList(
$resurs
=
false
)
{
|
|
44 |
|
function
getArticle
sCateg
o
riesList(
$resurs
=
false
)
{
|
44 |
|
gl
obal $site
;
|
|
45 |
|
gl
obal $site
;
|
45 |
|
gl
obal $logg
ed;
|
|
|
46 |
|
gl
obal $sUrl
;
|
|
46 |
|
gl
obal $sUrl
;
|
47 |
|
|
|
47 |
|
|
48 |
|
$s
AddCategor
yC = _t('_
Add Catego
ry');
|
|
48 |
|
$s
AddCategor
yC = _t('_
Add Catego
ry');
|
49 |
|
$s
AddNewArti
cleC = _t(
'_Add New
Article');
|
|
49 |
|
$s
AddNewArti
cleC = _t(
'_Add New
Article');
|
50 |
|
$s
EditC = _t
('_Edit');
|
|
50 |
|
$s
EditC = _t
('_Edit');
|
51 |
|
$s
DeleteC =
_t('_Delet
e');
|
|
51 |
|
$s
DeleteC =
_t('_Delet
e');
|
52 |
|
$s
SureC = _t
('_are you
sure?');
|
|
52 |
|
$s
SureC = _t
('_are you
sure?');
|
53 |
|
|
|
53 |
|
|
54 |
|
$s
CategQuery
= "
|
|
54 |
|
$s
CategQuery
= "
|
55 |
|
SELE
CT
|
|
55 |
|
SELE
CT
|
56 |
|
`Categ
oryID`,
|
|
56 |
|
`Categ
oryID`,
|
57 |
|
`Categ
oryName`,
|
|
57 |
|
`Categ
oryName`,
|
58 |
|
`Categ
oryDescrip
tion`
|
|
58 |
|
`Categ
oryDescrip
tion`
|
59 |
|
FROM
|
|
59 |
|
FROM
|
60 |
|
`Artic
lesCategor
y`
|
|
60 |
|
`Artic
lesCategor
y`
|
61 |
|
ORDE
R BY `Cate
goryID` AS
C
|
|
61 |
|
ORDE
R BY `Cate
goryID` AS
C
|
62 |
|
";
|
|
62 |
|
";
|
63 |
|
$r
Category =
db_res( $
sCategQuer
y );
|
|
63 |
|
$r
Category =
db_res( $
sCategQuer
y );
|
64 |
|
|
|
64 |
|
|
65 |
|
if
( $resurs
) {
|
|
65 |
|
if
( $resurs
) {
|
66 |
|
return $
rCategory;
|
|
66 |
|
return $
rCategory;
|
67 |
|
}
else {
|
|
67 |
|
}
else {
|
68 |
|
$ret = '
';
|
|
68 |
|
$ret = '
';
|
69 |
|
|
|
69 |
|
|
70 |
|
if( $log
ged['admin
'] ) {
|
|
70 |
|
$sAction
s = '';
|
|
|
71 |
|
if( $thi
s->bAdminM
ode ) {
|
|
|
72 |
|
$sAc
tions .= <
<<EOF
|
|
|
73 |
|
<a href="{
$this->sUr
l}articles
.php?actio
n=addcateg
ory">{$sAd
dCategoryC
}</a> 
;
|
|
|
74 |
|
EOF;
|
|
|
75 |
|
}
|
|
|
76 |
|
if ($thi
s->bAdminM
ode || $th
is->iVisit
orID) {
|
71 |
|
$ret
.= <<<EOF
|
|
77 |
|
$ret .=
<<<EOF
|
72 |
|
<div class
="addLink"
>
|
|
78 |
|
<div class
="addLink"
>
|
73 |
|
<a hre
f="{$site[
'url_admin
']}article
s.php?acti
on=addcate
gory">{$sA
ddCategory
C}</a>&nbs
p;
|
|
79 |
|
{$sAct
ions}
|
74 |
|
<a
href="{$
si
t
e['u
rl
_admin']
}articles.
php?action
=addarticl
e">{$sAddN
ewArticleC
}</a>
|
|
80 |
|
<a
href="{$
t
his->sU
rl
}articles.
php?action
=addarticl
e">{$sAddN
ewArticleC
}</a>
|
75 |
|
</div>
|
|
81 |
|
</div>
|
76 |
|
EOF;
|
|
82 |
|
EOF;
|
77 |
|
}
|
|
83 |
|
}
|
78 |
|
|
|
|
79 |
|
$i = '';
|
|
84 |
|
$i = '';
|
80 |
|
while ($
aCategory
= mysql_fe
tch_assoc(
$rCategor
y )) {
|
|
85 |
|
while ($
aCategory
= mysql_fe
tch_assoc(
$rCategor
y )) {
|
81 |
|
if (
($i%2) ==
0 ) {
|
|
86 |
|
if (
($i%2) ==
0 ) {
|
82 |
|
$sStyleAdd
= '1';
|
|
87 |
|
$sStyleAdd
= '1';
|
83 |
|
} el
se {
|
|
88 |
|
} el
se {
|
84 |
|
$sStyleAdd
= '2';
|
|
89 |
|
$sStyleAdd
= '2';
|
85 |
|
}
|
|
90 |
|
}
|
86 |
|
|
|
91 |
|
|
87 |
|
$sCa
tegoryName
= process
_line_outp
ut( $aCate
gory['Cate
goryName']
);
|
|
92 |
|
$sCa
tegoryName
= process
_line_outp
ut( $aCate
gory['Cate
goryName']
);
|
88 |
|
$sCa
tegoryDesc
ription =
process_ht
ml_output(
$aCategor
y['Categor
yDescripti
on'] );
|
|
93 |
|
$sCa
tegoryDesc
ription =
process_ht
ml_output(
$aCategor
y['Categor
yDescripti
on'] );
|
|
|
94 |
|
$sCa
tegUrl = $
this->getA
rticleCatU
rl($aCateg
ory['Categ
oryID']);
|
|
|
95 |
|
|
89 |
|
$sAd
minActions
= '';
|
|
96 |
|
$sAd
minActions
= '';
|
90 |
|
if(
$logged['a
dmin'] ) {
|
|
97 |
|
if(
$this->bAd
minMode) {
|
91 |
|
$sAdminAct
ions .= <<
<EOF
|
|
98 |
|
$sAdminAct
ions .= <<
<EOF
|
92 |
|
<div class
="category
Edit">
|
|
99 |
|
<div class
="category
Edit">
|
93 |
|
<a hre
f="{$sUrl}
articles.p
hp?catID={
$aCategory
['Category
ID']}&
action=cat
egoryedit"
>{$sEditC}
</a>
|
|
100 |
|
<a hre
f="{$sUrl}
articles.p
hp?catID={
$aCategory
['Category
ID']}&
action=cat
egoryedit"
>{$sEditC}
</a>
|
94 |
|
<a hre
f="{$sUrl}
articles.p
hp?catID={
$aCategory
['Category
ID']}&
action=cat
egorydelet
e" onclick
="javascri
pt: return
confirm('
Do you rea
ly want to
delete ca
tegory {$a
Category['
CategoryNa
me']} and
all its ar
ticles ')"
>{$sDelete
C}</a>
|
|
101 |
|
<a hre
f="{$sUrl}
articles.p
hp?catID={
$aCategory
['Category
ID']}&
action=cat
egorydelet
e" onclick
="javascri
pt: return
confirm('
Do you rea
ly want to
delete ca
tegory {$a
Category['
CategoryNa
me']} and
all its ar
ticles ')"
>{$sDelete
C}</a>
|
95 |
|
</div>
|
|
102 |
|
</div>
|
96 |
|
EOF;
|
|
103 |
|
EOF;
|
97 |
|
}
|
|
104 |
|
}
|
98 |
|
|
|
105 |
|
|
99 |
|
$ret
.= <<<EOF
|
|
106 |
|
$ret
.= <<<EOF
|
100 |
|
<div class
="category
Block{$sSt
yleAdd}">
|
|
107 |
|
<div class
="category
Block{$sSt
yleAdd}">
|
101 |
|
<div c
lass="cate
goryCaptio
n">
|
|
108 |
|
<div c
lass="cate
goryCaptio
n">
|
102 |
|
<a
href="{$s
Url}articl
es.php?cat
ID={$aCate
gory['
Categ
o
r
yID']
}
&actio
n=viewcate
gory
">{$sCateg
oryName}</
a>
|
|
109 |
|
<a
href="{$s
Categ
U
r
l
}
">{$sCateg
oryName}</
a>
|
103 |
|
</div>
|
|
110 |
|
</div>
|
104 |
|
<div c
lass="clea
r_both"></
div>
|
|
111 |
|
<div c
lass="clea
r_both"></
div>
|
105 |
|
<div c
lass="cate
goryDescri
ption">
|
|
112 |
|
<div c
lass="cate
goryDescri
ption">
|
106 |
|
{$
sCategoryD
escription
}
|
|
113 |
|
{$
sCategoryD
escription
}
|
107 |
|
</div>
|
|
114 |
|
</div>
|
108 |
|
{$sAdm
inActions}
|
|
115 |
|
{$sAdm
inActions}
|
109 |
|
</div>
|
|
116 |
|
</div>
|
110 |
|
EOF;
|
|
117 |
|
EOF;
|
111 |
|
|
|
118 |
|
|
112 |
|
$i++
;
|
|
119 |
|
$i++
;
|
113 |
|
}
|
|
120 |
|
}
|
114 |
|
return $
ret;
|
|
121 |
|
return $
ret;
|
115 |
|
}
|
|
122 |
|
}
|
116 |
|
}
|
|
123 |
|
}
|
117 |
|
|
|
124 |
|
|
118 |
|
functi
on getArti
clesList(
$iCategory
ID ) {
|
|
125 |
|
functi
on getArti
clesList(
$iCategory
ID ) {
|
119 |
|
gl
obal $sUrl
;
|
|
126 |
|
gl
obal $sUrl
;
|
120 |
|
gl
obal $site
;
|
|
127 |
|
gl
obal $site
;
|
121 |
|
gl
obal $logg
ed;
|
|
|
122 |
|
gl
obal $shor
t_date_for
mat;
|
|
128 |
|
gl
obal $shor
t_date_for
mat;
|
123 |
|
|
|
129 |
|
|
124 |
|
$s
ArticlesC
= _t('_Art
icles');
|
|
130 |
|
$s
ArticlesC
= _t('_Art
icles');
|
125 |
|
$s
EditC = _t
('_Edit');
|
|
131 |
|
$s
EditC = _t
('_Edit');
|
126 |
|
$s
DeleteC =
_t('_Delet
e');
|
|
132 |
|
$s
DeleteC =
_t('_Delet
e');
|
127 |
|
$s
SureC = _t
('_are you
sure?');
|
|
133 |
|
$s
SureC = _t
('_are you
sure?');
|
128 |
|
|
|
134 |
|
|
129 |
|
$i
CategoryID
= (int)$i
CategoryID
;
|
|
135 |
|
$i
CategoryID
= (int)$i
CategoryID
;
|
130 |
|
if
( !(int)$i
CategoryID
) {
|
|
136 |
|
if
( !(int)$i
CategoryID
) {
|
131 |
|
return '
';
|
|
137 |
|
return '
';
|
132 |
|
}
else {
|
|
138 |
|
}
else {
|
133 |
|
$sCatego
ryQuery =
"
|
|
139 |
|
$sCatego
ryQuery =
"
|
134 |
|
SELECT `Ca
tegoryName
`, `Catego
ryDescript
ion`
|
|
140 |
|
SELECT `Ca
tegoryName
`, `Catego
ryDescript
ion`
|
135 |
|
FROM `Arti
clesCatego
ry`
|
|
141 |
|
FROM `Arti
clesCatego
ry`
|
136 |
|
WHERE `Cat
egoryID` =
'{$iCateg
oryID}'
|
|
142 |
|
WHERE `Cat
egoryID` =
'{$iCateg
oryID}'
|
137 |
|
LIMIT 1;
|
|
143 |
|
LIMIT 1;
|
138 |
|
";
|
|
144 |
|
";
|
139 |
|
$aCatego
ry = db_ar
r( $sCateg
oryQuery )
;
|
|
145 |
|
$aCatego
ry = db_ar
r( $sCateg
oryQuery )
;
|
140 |
|
}
|
|
146 |
|
}
|
141 |
|
|
|
147 |
|
|
142 |
|
$s
ArticlesQu
ery = "
|
|
148 |
|
$s
ArticlesQu
ery = "
|
143 |
|
SELECT
`Title`,
`Text`,
DATE_FORMA
T(
`Date`,
'{$short_d
ate_format
}'
)
AS
Date,
`ArticlesI
D`,
`ArticleFl
ag`
|
|
149 |
|
SELECT
`Title`,
`Text`,
DATE_FORMA
T(
`Date`,
'{$short_d
ate_format
}'
)
AS
Date,
`ArticlesI
D`,
`ArticleFl
ag`
,
`ownerID`
|
144 |
|
FROM `Arti
cles`
|
|
150 |
|
FROM `Arti
cles`
|
145 |
|
WHERE `Cat
egoryID` =
'{$iCateg
oryID}'
|
|
151 |
|
WHERE `Cat
egoryID` =
'{$iCateg
oryID}'
|
146 |
|
";
|
|
152 |
|
";
|
147 |
|
$r
Articles =
db_res( $
sArticlesQ
uery );
|
|
153 |
|
$r
Articles =
db_res( $
sArticlesQ
uery );
|
148 |
|
|
|
154 |
|
|
149 |
|
$s
CategoryNa
me = proce
ss_line_ou
tput( $aCa
tegory['Ca
tegoryName
'] );
|
|
155 |
|
$s
CategoryNa
me = proce
ss_line_ou
tput( $aCa
tegory['Ca
tegoryName
'] );
|
150 |
|
$s
CategoryDe
scription
= process_
text_outpu
t( $aCateg
ory['Categ
oryDescrip
tion'] );
|
|
156 |
|
$s
CategoryDe
scription
= process_
text_outpu
t( $aCateg
ory['Categ
oryDescrip
tion'] );
|
151 |
|
|
|
157 |
|
|
152 |
|
|
|
158 |
|
|
153 |
|
$r
et = <<<EO
F
|
|
159 |
|
$r
et = <<<EO
F
|
154 |
|
<div class
="navigati
onLinks">
|
|
160 |
|
<div class
="navigati
onLinks">
|
155 |
|
<span>
<a href="{
$sUrl}arti
cles.php">
{$sArticle
sC}</a></s
pan>
|
|
161 |
|
<span>
<a href="{
$sUrl}arti
cles.php">
{$sArticle
sC}</a></s
pan>
|
156 |
|
<span>
></span
>
|
|
162 |
|
<span>
></span
>
|
157 |
|
<span>
{$sCategor
yName}</sp
an>
|
|
163 |
|
<span>
{$sCategor
yName}</sp
an>
|
158 |
|
</div>
|
|
164 |
|
</div>
|
159 |
|
<div class
="category
Header">
|
|
165 |
|
<div class
="category
Header">
|
160 |
|
<div c
lass="artC
aption">{$
sCategoryN
ame}</div>
|
|
166 |
|
<div c
lass="artC
aption">{$
sCategoryN
ame}</div>
|
161 |
|
<div>
|
|
167 |
|
<div>
|
162 |
|
{$
sCategoryD
escription
}
|
|
168 |
|
{$
sCategoryD
escription
}
|
163 |
|
</div>
|
|
169 |
|
</div>
|
164 |
|
</div>
|
|
170 |
|
</div>
|
165 |
|
EOF;
|
|
171 |
|
EOF;
|
166 |
|
|
|
172 |
|
|
167 |
|
$i
= '';
|
|
173 |
|
$i
= '';
|
168 |
|
wh
ile ( $aAr
ticles = m
ysql_fetch
_assoc( $r
Articles )
) {
|
|
174 |
|
wh
ile ( $aAr
ticles = m
ysql_fetch
_assoc( $r
Articles )
) {
|
169 |
|
if ( ($i
%2) == 0 )
{
|
|
175 |
|
if ( ($i
%2) == 0 )
{
|
170 |
|
$sSt
yleAdd = '
1';
|
|
176 |
|
$sSt
yleAdd = '
1';
|
171 |
|
} else {
|
|
177 |
|
} else {
|
172 |
|
$sSt
yleAdd = '
2';
|
|
178 |
|
$sSt
yleAdd = '
2';
|
173 |
|
}
|
|
179 |
|
}
|
174 |
|
|
|
180 |
|
|
|
|
181 |
|
$sArticl
eUrl = $th
is->getArt
icleUrl($a
Articles['
ArticlesID
']);
|
175 |
|
$sArticl
eTitle = p
rocess_lin
e_output(
$aArticles
['Title']
);
|
|
182 |
|
$sArticl
eTitle = p
rocess_lin
e_output(
$aArticles
['Title']
);
|
176 |
|
|
|
183 |
|
|
177 |
|
$sArticl
eText = ''
;
|
|
184 |
|
$sArticl
eText = ''
;
|
178 |
|
if( $aAr
ticles['Ar
ticleFlag'
] == 'HTML
' ) {
|
|
185 |
|
if( $aAr
ticles['Ar
ticleFlag'
] == 'HTML
' ) {
|
179 |
|
$sAr
ticleText
= process_
html_outpu
t( strmaxt
extlen( st
rip_tags($
aArticles[
'Text']),
200 ) ) .
"\n";
|
|
186 |
|
$sAr
ticleText
= process_
html_outpu
t( strmaxt
extlen( st
rip_tags($
aArticles[
'Text']),
200 ) ) .
"\n";
|
180 |
|
} else {
|
|
187 |
|
} else {
|
181 |
|
$sAr
ticleText
= strmaxte
xtlen( $aA
rticles['T
ext'], 200
);
|
|
188 |
|
$sAr
ticleText
= strmaxte
xtlen( $aA
rticles['T
ext'], 200
);
|
182 |
|
//$s
ArticleTex
t = proces
s_text_out
put( strma
xtextlen(
$aArticles
['Text'],
200 ) ) .
"\n";
|
|
189 |
|
//$s
ArticleTex
t = proces
s_text_out
put( strma
xtextlen(
$aArticles
['Text'],
200 ) ) .
"\n";
|
183 |
|
}
|
|
190 |
|
}
|
184 |
|
|
|
191 |
|
|
185 |
|
$sAdminA
ctions = '
';
|
|
192 |
|
$sAdminA
ctions = '
';
|
186 |
|
if( $log
ged['admin
'] ) {
|
|
193 |
|
if( $thi
s->bAdminM
ode || ($a
Articles['
ownerID']
!= 0 && $a
Articles['
ownerID']
== $this->
iVisitorID
)) {
|
187 |
|
$sAd
minActions
.= <<<EOF
|
|
194 |
|
$sAd
minActions
.= <<<EOF
|
188 |
|
<div class
="category
Edit">
|
|
195 |
|
<div class
="category
Edit">
|
189 |
|
<a
href="{$
si
t
e['u
rl
_admin']
}articles.
php?articl
eID={$aArt
icles['Art
iclesID']}
&actio
n=editarti
cle">{$sEd
itC}</a>&n
bsp;
|
|
196 |
|
<a
href="{$
t
his->sU
rl
}articles.
php?articl
eID={$aArt
icles['Art
iclesID']}
&actio
n=editarti
cle">{$sEd
itC}</a>&n
bsp;
|
190 |
|
<a
href="{$
si
t
e['u
rl
_admin']
}articles.
php?articl
eID={$aArt
icles['Art
iclesID']}
&actio
n=deletear
ticle"
onclick="j
avascript:
return
confirm('{
$sSureC}')
">{$sDelet
eC}</a>
|
|
197 |
|
<a
href="{$
t
his->sU
rl
}articles.
php?articl
eID={$aArt
icles['Art
iclesID']}
&actio
n=deletear
ticle"
onclick="j
avascript:
return
confirm('{
$sSureC}')
">{$sDelet
eC}</a>
|
191 |
|
</div>
|
|
198 |
|
</div>
|
192 |
|
EOF;
|
|
199 |
|
EOF;
|
193 |
|
}
|
|
200 |
|
}
|
194 |
|
|
|
201 |
|
|
195 |
|
$ret .=
<<<EOF
|
|
202 |
|
$ret .=
<<<EOF
|
196 |
|
<div class
="articleB
lock{$sSty
leAdd}">
|
|
203 |
|
<div class
="articleB
lock{$sSty
leAdd}">
|
197 |
|
<div c
lass="titl
e">
|
|
204 |
|
<div c
lass="titl
e">
|
198 |
|
<a
href="{$s
Url}articl
es.php?art
icleID={$a
Article
s['A
r
tic
l
esID']
}
&actio
n=viewarti
cle
">{$sArtic
leTitle}</
a>
|
|
205 |
|
<a
href="{$s
Article
U
r
l
}
">{$sArtic
leTitle}</
a>
|
199 |
|
</div>
|
|
206 |
|
</div>
|
200 |
|
<div c
lass="date
">{$aArtic
les['Date'
]}</div>
|
|
207 |
|
<div c
lass="date
">{$aArtic
les['Date'
]}</div>
|
201 |
|
<div c
lass="prev
iew">
|
|
208 |
|
<div c
lass="prev
iew">
|
202 |
|
{$
sArticleTe
xt}
|
|
209 |
|
{$
sArticleTe
xt}
|
203 |
|
</div>
|
|
210 |
|
</div>
|
204 |
|
{$sAdm
inActions}
|
|
211 |
|
{$sAdm
inActions}
|
205 |
|
</div>
|
|
212 |
|
</div>
|
206 |
|
EOF;
|
|
213 |
|
EOF;
|
207 |
|
$i++;
|
|
214 |
|
$i++;
|
208 |
|
}
|
|
215 |
|
}
|
209 |
|
re
turn $ret;
|
|
216 |
|
re
turn $ret;
|
210 |
|
}
|
|
217 |
|
}
|
211 |
|
|
|
218 |
|
|
212 |
|
functi
on getArti
cle( $iArt
icleID ) {
|
|
219 |
|
functi
on getArti
cle( $iArt
icleID ) {
|
213 |
|
gl
obal $shor
t_date_for
mat;
|
|
220 |
|
gl
obal $shor
t_date_for
mat;
|
214 |
|
|
|
221 |
|
|
215 |
|
$s
ArticlesC
= _t('_Art
icles');
|
|
222 |
|
$s
ArticlesC
= _t('_Art
icles');
|
216 |
|
|
|
223 |
|
|
217 |
|
if
( !(int)$i
ArticleID
) {
|
|
224 |
|
if
( !(int)$i
ArticleID
) {
|
218 |
|
return '
';
|
|
225 |
|
return '
';
|
219 |
|
}
else {
|
|
226 |
|
}
else {
|
220 |
|
$sArticl
eQuery = "
|
|
227 |
|
$sArticl
eQuery = "
|
221 |
|
SELECT `Ti
tle`, `Tex
t`, `Artic
les`.`Cate
goryID`, D
ATE_FORMAT
( `Date`,
'{$short_d
ate_format
}' ) AS Da
te,
|
|
228 |
|
SELECT `Ti
tle`, `Tex
t`, `Artic
les`.`Cate
goryID`, D
ATE_FORMAT
( `Date`,
'{$short_d
ate_format
}' ) AS Da
te,
|
222 |
|
`ArticlesI
D`,
`CategoryN
ame`,
`ArticleFl
ag`
|
|
229 |
|
`ArticlesI
D`,
`CategoryN
ame`,
`ArticleFl
ag`
,
`ownerID`
|
223 |
|
FROM `Arti
cles`
|
|
230 |
|
FROM `Arti
cles`
|
224 |
|
INNER JOIN
`Articles
Category`
ON `Articl
es`.`Categ
oryID` = `
ArticlesCa
tegory`.`C
ategoryID`
|
|
231 |
|
INNER JOIN
`Articles
Category`
ON `Articl
es`.`Categ
oryID` = `
ArticlesCa
tegory`.`C
ategoryID`
|
225 |
|
WHERE `Art
iclesID` =
'{$iArtic
leID}'
|
|
232 |
|
WHERE `Art
iclesID` =
'{$iArtic
leID}'
|
226 |
|
LIMIT 1;
|
|
233 |
|
LIMIT 1;
|
227 |
|
";
|
|
234 |
|
";
|
228 |
|
}
|
|
235 |
|
}
|
229 |
|
$a
Article =
db_arr( $s
ArticleQue
ry );
|
|
236 |
|
$a
Article =
db_arr( $s
ArticleQue
ry );
|
230 |
|
|
|
237 |
|
|
231 |
|
$s
CategoryNa
me = proce
ss_line_ou
tput( $aAr
ticle['Cat
egoryName'
] );
|
|
238 |
|
$s
CategoryNa
me = proce
ss_line_ou
tput( $aAr
ticle['Cat
egoryName'
] );
|
232 |
|
$s
Title = pr
ocess_line
_output( $
aArticle['
Title']);
|
|
239 |
|
$s
Title = pr
ocess_line
_output( $
aArticle['
Title']);
|
233 |
|
$s
Text = '';
|
|
240 |
|
$s
Text = '';
|
234 |
|
if
( $aArticl
e['Article
Flag'] ==
'HTML' ) {
|
|
241 |
|
if
( $aArticl
e['Article
Flag'] ==
'HTML' ) {
|
235 |
|
$sText =
process_h
tml_output
( $aArticl
e['Text']
) . "\n";
|
|
242 |
|
$sText =
process_h
tml_output
( $aArticl
e['Text']
) . "\n";
|
236 |
|
}
else {
|
|
243 |
|
}
else {
|
237 |
|
$sText =
process_t
ext_output
( $aArticl
e['Text']
) . "\n";
|
|
244 |
|
$sText =
process_t
ext_output
( $aArticl
e['Text']
) . "\n";
|
238 |
|
}
|
|
245 |
|
}
|
239 |
|
|
|
246 |
|
|
240 |
|
$ret =
<<<EOF
|
|
247 |
|
$ret =
<<<EOF
|
241 |
|
<div class
="navigati
onLinks">
|
|
248 |
|
<div class
="navigati
onLinks">
|
242 |
|
<span>
<a href="a
rticles.ph
p">{$sArti
clesC}</a>
</span>
|
|
249 |
|
<span>
<a href="a
rticles.ph
p">{$sArti
clesC}</a>
</span>
|
243 |
|
<span>
></span
>
|
|
250 |
|
<span>
></span
>
|
244 |
|
<span>
<a href="a
rticles.ph
p?catID={$
aArticle['
CategoryID
']}&ac
tion=viewc
ategory">{
$sCategory
Name}</a><
/span>
|
|
251 |
|
<span>
<a href="a
rticles.ph
p?catID={$
aArticle['
CategoryID
']}&ac
tion=viewc
ategory">{
$sCategory
Name}</a><
/span>
|
245 |
|
<span>
></span
>
|
|
252 |
|
<span>
></span
>
|
246 |
|
<span>
{$sTitle}<
/span>
|
|
253 |
|
<span>
{$sTitle}<
/span>
|
247 |
|
</div>
|
|
254 |
|
</div>
|
248 |
|
<div class
="articleB
lock">
|
|
255 |
|
<div class
="articleB
lock">
|
249 |
|
<div c
lass="main
Title">{$s
Title}</di
v>
|
|
256 |
|
<div c
lass="main
Title">{$s
Title}</di
v>
|
250 |
|
<div c
lass="date
">{$aArtic
le['Date']
}</div>
|
|
257 |
|
<div c
lass="date
">{$aArtic
le['Date']
}</div>
|
251 |
|
<div>{
$sText}</d
iv>
|
|
258 |
|
<div>{
$sText}</d
iv>
|
252 |
|
</div>
|
|
259 |
|
</div>
|
253 |
|
EOF;
|
|
260 |
|
EOF;
|
254 |
|
re
turn $ret;
|
|
261 |
|
re
turn $ret;
|
255 |
|
}
|
|
262 |
|
}
|
256 |
|
|
|
263 |
|
|
257 |
|
functi
on getArti
clesCatego
ryEditForm
( $iCatego
ryID = ''
) {
|
|
264 |
|
functi
on getArti
clesCatego
ryEditForm
( $iCatego
ryID = ''
) {
|
258 |
|
gl
obal $site
;
|
|
265 |
|
gl
obal $site
;
|
259 |
|
|
|
266 |
|
|
260 |
|
$s
ArticlesC
= _t('_Art
icles');
|
|
267 |
|
$s
ArticlesC
= _t('_Art
icles');
|
261 |
|
$s
CategoryCa
ptionC = _
t('_Catego
ry Caption
');
|
|
268 |
|
$s
CategoryCa
ptionC = _
t('_Catego
ry Caption
');
|
262 |
|
$s
CategoryDe
scriptionC
= _t('_ca
tegory_des
cription')
;
|
|
269 |
|
$s
CategoryDe
scriptionC
= _t('_ca
tegory_des
cription')
;
|
263 |
|
|
|
270 |
|
|
264 |
|
$r
et = '';
|
|
271 |
|
$r
et = '';
|
265 |
|
|
|
272 |
|
|
266 |
|
if
( (int)$iC
ategoryID
) {
|
|
273 |
|
if
( (int)$iC
ategoryID
) {
|
267 |
|
$sEditCa
tegoryQuer
y = "
|
|
274 |
|
$sEditCa
tegoryQuer
y = "
|
268 |
|
SELE
CT `Catego
ryID`, `Ca
tegoryName
`, `Catego
ryDescript
ion`
|
|
275 |
|
SELE
CT `Catego
ryID`, `Ca
tegoryName
`, `Catego
ryDescript
ion`
|
269 |
|
FROM
`Articles
Category`
|
|
276 |
|
FROM
`Articles
Category`
|
270 |
|
WHER
E `Categor
yID` = '{$
iCategoryI
D}'
|
|
277 |
|
WHER
E `Categor
yID` = '{$
iCategoryI
D}'
|
271 |
|
LIMI
T 1;
|
|
278 |
|
LIMI
T 1;
|
272 |
|
";
|
|
279 |
|
";
|
273 |
|
$aCatego
ry = db_ar
r( $sEditC
ategoryQue
ry );
|
|
280 |
|
$aCatego
ry = db_ar
r( $sEditC
ategoryQue
ry );
|
274 |
|
}
|
|
281 |
|
}
|
275 |
|
|
|
282 |
|
|
276 |
|
$r
et .= <<<E
OF
|
|
283 |
|
$r
et .= <<<E
OF
|
277 |
|
<div class
="navigati
onLinks">
|
|
284 |
|
<div class
="navigati
onLinks">
|
278 |
|
<span>
<a href="a
rticles.ph
p">{$sArti
clesC}</a>
</span>
|
|
285 |
|
<span>
<a href="a
rticles.ph
p">{$sArti
clesC}</a>
</span>
|
279 |
|
</div>
|
|
286 |
|
</div>
|
280 |
|
EOF;
|
|
287 |
|
EOF;
|
281 |
|
|
|
288 |
|
|
282 |
|
$r
et .= <<<E
OF
|
|
289 |
|
$r
et .= <<<E
OF
|
283 |
|
<script ty
pe="text/j
avascript"
>
|
|
290 |
|
<script ty
pe="text/j
avascript"
>
|
284 |
|
function c
heckForm()
{
|
|
291 |
|
function c
heckForm()
{
|
285 |
|
var el
;
|
|
292 |
|
var el
;
|
286 |
|
var ha
sErr = fal
se;
|
|
293 |
|
var ha
sErr = fal
se;
|
287 |
|
var fi
ld = "";
|
|
294 |
|
var fi
ld = "";
|
288 |
|
|
|
295 |
|
|
289 |
|
el = d
ocument.ge
tElementBy
Id("captio
n");
|
|
296 |
|
el = d
ocument.ge
tElementBy
Id("captio
n");
|
290 |
|
if( el
.value.len
gth < 3 )
{
|
|
297 |
|
if( el
.value.len
gth < 3 )
{
|
291 |
|
el
.style.bac
kgroundCol
or = "pink
";
|
|
298 |
|
el
.style.bac
kgroundCol
or = "pink
";
|
292 |
|
ha
sErr = tru
e;
|
|
299 |
|
ha
sErr = tru
e;
|
293 |
|
fild
+=
"
\n
Category
Title
";
|
|
300 |
|
fild
+=
"
Category
Title
";
|
294 |
|
} else
{
|
|
301 |
|
} else
{
|
295 |
|
el
.style.bac
kgroundCol
or = "#fff
";
|
|
302 |
|
el
.style.bac
kgroundCol
or = "#fff
";
|
296 |
|
}
|
|
303 |
|
}
|
297 |
|
|
|
304 |
|
|
298 |
|
el = d
ocument.ge
tElementBy
Id("descri
ption");
|
|
305 |
|
el = d
ocument.ge
tElementBy
Id("descri
ption");
|
299 |
|
if( el
.value.len
gth < 3 )
{
|
|
306 |
|
if( el
.value.len
gth < 3 )
{
|
300 |
|
el
.style.bac
kgroundCol
or = "pink
";
|
|
307 |
|
el
.style.bac
kgroundCol
or = "pink
";
|
301 |
|
ha
sErr = tru
e;
|
|
308 |
|
ha
sErr = tru
e;
|
302 |
|
fild
+=
"
\n
Category
Descriptio
n";
|
|
309 |
|
fild
+=
"
Category
Descriptio
n";
|
303 |
|
} else
{
|
|
310 |
|
} else
{
|
304 |
|
el
.style.bac
kgroundCol
or = "#fff
";
|
|
311 |
|
el
.style.bac
kgroundCol
or = "#fff
";
|
305 |
|
}
|
|
312 |
|
}
|
306 |
|
|
|
313 |
|
|
307 |
|
if (ha
sErr) {
|
|
314 |
|
if (ha
sErr) {
|
308 |
|
al
ert( "Plea
se fill ne
xt fields
first!" +
fild )
|
|
315 |
|
al
ert( "Plea
se fill ne
xt fields
first!" +
fild )
|
309 |
|
re
turn false
;
|
|
316 |
|
re
turn false
;
|
310 |
|
} else
{
|
|
317 |
|
} else
{
|
311 |
|
re
turn true;
|
|
318 |
|
re
turn true;
|
312 |
|
}
|
|
319 |
|
}
|
313 |
|
}
|
|
320 |
|
}
|
314 |
|
</script>
|
|
321 |
|
</script>
|
315 |
|
EOF;
|
|
322 |
|
EOF;
|
316 |
|
|
|
323 |
|
|
317 |
|
$s
FormInputs
= '';
|
|
324 |
|
$s
FormInputs
= '';
|
318 |
|
if
( (int)$iC
ategoryID
) {
|
|
325 |
|
if
( (int)$iC
ategoryID
) {
|
319 |
|
$sFormIn
puts .= '<
input type
="hidden"
name="edit
_category"
value="tr
ue" />' .
"\n";
|
|
326 |
|
$sFormIn
puts .= '<
input type
="hidden"
name="edit
_category"
value="tr
ue" />' .
"\n";
|
320 |
|
$sFormIn
puts .= '<
input type
="hidden"
name="cate
goryID" va
lue="' . $
iCategoryI
D . '" />'
. "\n";
|
|
327 |
|
$sFormIn
puts .= '<
input type
="hidden"
name="cate
goryID" va
lue="' . $
iCategoryI
D . '" />'
. "\n";
|
321 |
|
}
else {
|
|
328 |
|
}
else {
|
322 |
|
$sFormIn
puts .= '<
input type
="hidden"
name="add_
category"
value="tru
e" />' . "
\n";
|
|
329 |
|
$sFormIn
puts .= '<
input type
="hidden"
name="add_
category"
value="tru
e" />' . "
\n";
|
323 |
|
}
|
|
330 |
|
}
|
324 |
|
|
|
331 |
|
|
325 |
|
$s
CategoryNa
me = proce
ss_line_ou
tput( $aCa
tegory['Ca
tegoryName
'] );
|
|
332 |
|
$s
CategoryNa
me = proce
ss_line_ou
tput( $aCa
tegory['Ca
tegoryName
'] );
|
326 |
|
$s
CategoryDe
scription
= process_
text_outpu
t( $aCateg
ory['Categ
oryDescrip
tion'] );
|
|
333 |
|
$s
CategoryDe
scription
= process_
text_outpu
t( $aCateg
ory['Categ
oryDescrip
tion'] );
|
327 |
|
|
|
334 |
|
|
328 |
|
$r
et .= <<<E
OF
|
|
335 |
|
$r
et .= <<<E
OF
|
329 |
|
<div class
="articles
FormBlock"
>
|
|
336 |
|
<div class
="articles
FormBlock"
>
|
330 |
|
<form
method="po
st"
action="{$
si
t
e['u
rl
_admin']
}articles.
php"
onsubmit="
return
checkForm(
);">
|
|
337 |
|
<form
method="po
st"
action="{$
t
his->sU
rl
}articles.
php"
onsubmit="
return
checkForm(
);">
|
331 |
|
<d
iv>{$sCate
goryCaptio
nC}</div>
|
|
338 |
|
<d
iv>{$sCate
goryCaptio
nC}</div>
|
332 |
|
<d
iv>
|
|
339 |
|
<d
iv>
|
333 |
|
<input t
ype="text"
name="cap
tion" id="
caption" c
lass="catC
aption" va
lue="{$sCa
tegoryName
}" />
|
|
340 |
|
<input t
ype="text"
name="cap
tion" id="
caption" c
lass="catC
aption" va
lue="{$sCa
tegoryName
}" />
|
334 |
|
</
div>
|
|
341 |
|
</
div>
|
335 |
|
<d
iv>{$sCate
goryDescri
ptionC}</d
iv>
|
|
342 |
|
<d
iv>{$sCate
goryDescri
ptionC}</d
iv>
|
336 |
|
<d
iv>
|
|
343 |
|
<d
iv>
|
337 |
|
<textare
a name="de
scription"
id="desc
ription" c
lass="catD
esc">{$sCa
tegoryDesc
ription}</
textarea>
|
|
344 |
|
<textare
a name="de
scription"
id="desc
ription" c
lass="catD
esc">{$sCa
tegoryDesc
ription}</
textarea>
|
338 |
|
</
div>
|
|
345 |
|
</
div>
|
339 |
|
<d
iv>
|
|
346 |
|
<d
iv>
|
340 |
|
<input t
ype="submi
t" value="
Submit">
|
|
347 |
|
<input t
ype="submi
t" value="
Submit">
|
341 |
|
{$sFormI
nputs}
|
|
348 |
|
{$sFormI
nputs}
|
342 |
|
</
div>
|
|
349 |
|
</
div>
|
343 |
|
</form
>
|
|
350 |
|
</form
>
|
344 |
|
</div>
|
|
351 |
|
</div>
|
345 |
|
EOF;
|
|
352 |
|
EOF;
|
346 |
|
|
|
353 |
|
|
347 |
|
re
turn $ret;
|
|
354 |
|
re
turn $ret;
|
348 |
|
}
|
|
355 |
|
}
|
349 |
|
|
|
356 |
|
|
350 |
|
functi
on getArti
cleEditFor
m( $iArtic
leID = ''
) {
|
|
357 |
|
functi
on getArti
cleEditFor
m( $iArtic
leID = ''
) {
|
351 |
|
gl
obal $site
;
|
|
|
352 |
|
gl
obal $site
;
|
|
|
353 |
|
|
|
|
354 |
|
$s
EditArticl
eC = _t('_
Edit Artic
le');
|
|
358 |
|
$s
EditArticl
eC = _t('_
Edit Artic
le');
|
355 |
|
$s
ArticlesC
= _t('_Art
icles');
|
|
359 |
|
$s
ArticlesC
= _t('_Art
icles');
|
356 |
|
$s
ArticleC =
_t('_Arti
cle');
|
|
360 |
|
$s
ArticleC =
_t('_Arti
cle');
|
357 |
|
$s
ArticleTit
leC = _t('
_Article T
itle');
|
|
361 |
|
$s
ArticleTit
leC = _t('
_Article T
itle');
|
358 |
|
$s
SelectCate
goryC = _t
('_Select
Category')
;
|
|
362 |
|
$s
SelectCate
goryC = _t
('_Select
Category')
;
|
359 |
|
$s
PrintAsC =
_t('_Prin
t As');
|
|
363 |
|
$s
PrintAsC =
_t('_Prin
t As');
|
360 |
|
|
|
364 |
|
|
361 |
|
$rCatories
=
$this->get
ArticlesCa
teg
i
riesList(
true
);
|
|
365 |
|
$rCatories
=
$this->get
ArticlesCa
teg
o
riesList(
true
);
|
362 |
|
|
|
366 |
|
|
363 |
|
if
( (int)$iA
rticleID )
{
|
|
367 |
|
if
( (int)$iA
rticleID )
{
|
364 |
|
$article
Query = "
|
|
368 |
|
$article
Query = "
|
365 |
|
SELE
CT `Articl
es`.`Artic
lesID`, `A
rticles`.`
CategoryID
`, `Articl
es`.`Date`
,
|
|
369 |
|
SELE
CT `Articl
es`.`Artic
lesID`, `A
rticles`.`
CategoryID
`, `Articl
es`.`Date`
,
|
366 |
|
`Artic
les`.`Titl
e`, `Artic
les`.`Text
`, `Articl
es`.`Artic
leFlag`, `
ArticlesCa
tegory`.`C
ategoryNam
e`
|
|
370 |
|
`Artic
les`.`Titl
e`, `Artic
les`.`Text
`, `Articl
es`.`Artic
leFlag`, `
ArticlesCa
tegory`.`C
ategoryNam
e`
|
367 |
|
FROM
`Articles
`
|
|
371 |
|
FROM
`Articles
`
|
368 |
|
INNE
R JOIN `Ar
ticlesCate
gory` ON
`ArticlesC
ategory`.`
CategoryID
` = `Artic
les`.`Cate
goryID`
|
|
372 |
|
INNE
R JOIN `Ar
ticlesCate
gory` ON
`ArticlesC
ategory`.`
CategoryID
` = `Artic
les`.`Cate
goryID`
|
369 |
|
WHER
E `Article
s`.`Articl
esID` = '{
$iArticleI
D}';
|
|
373 |
|
WHER
E `Article
s`.`Articl
esID` = '{
$iArticleI
D}';
|
370 |
|
";
|
|
374 |
|
";
|
371 |
|
$aArticl
e = db_arr
( $article
Query );
|
|
375 |
|
$aArticl
e = db_arr
( $article
Query );
|
372 |
|
}
|
|
376 |
|
}
|
373 |
|
|
|
377 |
|
|
374 |
|
$s
CategoryNa
meAd = '';
|
|
378 |
|
$s
CategoryNa
meAd = '';
|
375 |
|
if
( $iArticl
eID && str
len( $aArt
icle['Cate
goryName']
) ) {
|
|
379 |
|
if
( $iArticl
eID && str
len( $aArt
icle['Cate
goryName']
) ) {
|
376 |
|
$sCatego
ryNameAd =
<<<EOF
|
|
380 |
|
$sCatego
ryNameAd =
<<<EOF
|
377 |
|
<span>>
</span>
|
|
381 |
|
<span>>
</span>
|
378 |
|
<span><a
href="{$
si
t
e['u
rl
_admin']
}articles.
php?catID=
{$aArticle
['Category
ID']}&
action=vie
wcategory"
>{$aArticl
e['Categor
yName']}</
a></span>
|
|
382 |
|
<span><a
href="{$
t
his->sU
rl
}articles.
php?catID=
{$aArticle
['Category
ID']}&
action=vie
wcategory"
>{$aArticl
e['Categor
yName']}</
a></span>
|
379 |
|
<span>>
</span>
|
|
383 |
|
<span>>
</span>
|
380 |
|
<span>{$sE
ditArticle
C}</span>
|
|
384 |
|
<span>{$sE
ditArticle
C}</span>
|
381 |
|
EOF;
|
|
385 |
|
EOF;
|
382 |
|
}
|
|
386 |
|
}
|
383 |
|
|
|
387 |
|
|
384 |
|
$s
RetCateg =
'';
|
|
388 |
|
$s
RetCateg =
'';
|
385 |
|
wh
ile ( $aCa
tegory = m
ysql_fetch
_assoc( $r
Catories )
) {
|
|
389 |
|
wh
ile ( $aCa
tegory = m
ysql_fetch
_assoc( $r
Catories )
) {
|
386 |
|
if( $aAr
ticle['Cat
egoryID']
== $aCateg
ory['Categ
oryID'] )
{
|
|
390 |
|
if( $aAr
ticle['Cat
egoryID']
== $aCateg
ory['Categ
oryID'] )
{
|
387 |
|
$sSe
lectedCate
gory = ' s
elected="s
elected"';
|
|
391 |
|
$sSe
lectedCate
gory = ' s
elected="s
elected"';
|
388 |
|
} else {
|
|
392 |
|
} else {
|
389 |
|
$sSe
lectedCate
gory = '';
|
|
393 |
|
$sSe
lectedCate
gory = '';
|
390 |
|
}
|
|
394 |
|
}
|
391 |
|
$sRetCat
eg .= '<op
tion value
="' . $aCa
tegory['Ca
tegoryID']
. '"' . $
sSelectedC
ategory .
'>' . proc
ess_line_o
utput( str
maxtextlen
( $aCatego
ry['Catego
ryName'],
50 ) ) . '
</option>'
. "\n";
|
|
395 |
|
$sRetCat
eg .= '<op
tion value
="' . $aCa
tegory['Ca
tegoryID']
. '"' . $
sSelectedC
ategory .
'>' . proc
ess_line_o
utput( str
maxtextlen
( $aCatego
ry['Catego
ryName'],
50 ) ) . '
</option>'
. "\n";
|
392 |
|
}
|
|
396 |
|
}
|
393 |
|
|
|
397 |
|
|
394 |
|
$s
ArticleAct
ions = '';
|
|
398 |
|
$s
ArticleAct
ions = '';
|
395 |
|
if
( (int)$iA
rticleID )
{
|
|
399 |
|
if
( (int)$iA
rticleID )
{
|
396 |
|
$sArticl
eActions .
= '<input
type="hidd
en" name="
edit_artic
le" value=
"true" />'
. "\n";
|
|
400 |
|
$sArticl
eActions .
= '<input
type="hidd
en" name="
edit_artic
le" value=
"true" />'
. "\n";
|
397 |
|
$sArticl
eActions .
= '<input
type="hidd
en" name="
articleID"
value="'
. $iArticl
eID . '" /
>' . "\n";
|
|
401 |
|
$sArticl
eActions .
= '<input
type="hidd
en" name="
articleID"
value="'
. $iArticl
eID . '" /
>' . "\n";
|
398 |
|
}
else {
|
|
402 |
|
}
else {
|
399 |
|
$sArticl
eActions .
= '<input
type="hidd
en" name="
add_articl
e" value="
true" />'
. "\n";
|
|
403 |
|
$sArticl
eActions .
= '<input
type="hidd
en" name="
add_articl
e" value="
true" />'
. "\n";
|
400 |
|
}
|
|
404 |
|
}
|
401 |
|
|
|
405 |
|
|
402 |
|
$s
Title = pr
ocess_line
_output( $
aArticle['
Title'] );
|
|
406 |
|
$s
Title = pr
ocess_line
_output( $
aArticle['
Title'] );
|
403 |
|
|
|
407 |
|
|
404 |
|
$t
extSelecte
d = ( $aAr
ticle['Art
icleFlag']
== 'Text'
) ? ' sel
ected="sel
ected"' :
'';
|
|
408 |
|
$t
extSelecte
d = ( $aAr
ticle['Art
icleFlag']
== 'Text'
) ? ' sel
ected="sel
ected"' :
'';
|
405 |
|
$h
tmlSelecte
d = ( $aAr
ticle['Art
icleFlag']
== 'HTML'
) ? ' sel
ected="sel
ected"' :
'';
|
|
409 |
|
$h
tmlSelecte
d = ( $aAr
ticle['Art
icleFlag']
== 'HTML'
) ? ' sel
ected="sel
ected"' :
'';
|
406 |
|
|
|
410 |
|
|
407 |
|
$r
et = <<<EO
F
|
|
411 |
|
$r
et = <<<EO
F
|
408 |
|
<div class
="navigati
onLinks">
|
|
412 |
|
<div class
="navigati
onLinks">
|
409 |
|
<span><a
href="{$
si
t
e['u
rl
_admin']
}articles.
php">{$sAr
ticlesC}</
a></span>
|
|
413 |
|
<span><a
href="{$
t
his->sU
rl
}articles.
php">{$sAr
ticlesC}</
a></span>
|
410 |
|
{$sCat
egoryNameA
d}
|
|
414 |
|
{$sCat
egoryNameA
d}
|
411 |
|
</div>
|
|
415 |
|
</div>
|
412 |
|
|
|
416 |
|
|
413 |
|
<script ty
pe="text/j
avascript"
>
|
|
417 |
|
<script ty
pe="text/j
avascript"
>
|
414 |
|
function c
heckForm()
{
|
|
418 |
|
function c
heckForm()
{
|
415 |
|
var el
;
|
|
419 |
|
var el
;
|
416 |
|
var ha
sErr = fal
se;
|
|
420 |
|
var ha
sErr = fal
se;
|
417 |
|
var fi
ld = "";
|
|
421 |
|
var fi
ld = "";
|
418 |
|
el = d
ocument.ge
tElementBy
Id("articl
eTitle");
|
|
422 |
|
el = d
ocument.ge
tElementBy
Id("articl
eTitle");
|
419 |
|
if( el
.value.len
gth < 3 )
{
|
|
423 |
|
if( el
.value.len
gth < 3 )
{
|
420 |
|
el
.style.bac
kgroundCol
or = "pink
";
|
|
424 |
|
el
.style.bac
kgroundCol
or = "pink
";
|
421 |
|
ha
sErr = tru
e;
|
|
425 |
|
ha
sErr = tru
e;
|
422 |
|
fild
+=
"
\n
Article
Title";
|
|
426 |
|
fild
+=
"
Article
Title";
|
423 |
|
} else
{
|
|
427 |
|
} else
{
|
424 |
|
el
.style.bac
kgroundCol
or = "#fff
";
|
|
428 |
|
el
.style.bac
kgroundCol
or = "#fff
";
|
425 |
|
}
|
|
429 |
|
}
|
426 |
|
|
|
430 |
|
|
427 |
|
el = d
ocument.ge
tElementBy
Id("articl
eBody");
|
|
431 |
|
el = d
ocument.ge
tElementBy
Id("articl
eBody");
|
428 |
|
if( el
.value.len
gth < 3 )
{
|
|
432 |
|
if( el
.value.len
gth < 3 )
{
|
429 |
|
if
(typeof t
inyMCE !=
'undefined
') {//here
Tiny
|
|
433 |
|
if
(typeof t
inyMCE !=
'undefined
') {//here
Tiny
|
430 |
|
if( tiny
MCE.select
edElement.
innerHTML.
length < 3
) {
|
|
434 |
|
if( tiny
MCE.select
edElement.
innerHTML.
length < 3
) {
|
431 |
|
el.s
tyle.backg
roundColor
= "pink";
|
|
435 |
|
el.s
tyle.backg
roundColor
= "pink";
|
432 |
|
hasE
rr = true;
|
|
436 |
|
hasE
rr = true;
|
433 |
|
fild
+=
"
\n
Article
text";
|
|
437 |
|
fild
+=
"
Article
text";
|
434 |
|
} else {
|
|
438 |
|
} else {
|
435 |
|
el.s
tyle.backg
roundColor
= "#fff";
|
|
439 |
|
el.s
tyle.backg
roundColor
= "#fff";
|
436 |
|
}
|
|
440 |
|
}
|
437 |
|
}
|
|
441 |
|
}
|
438 |
|
} else
{
|
|
442 |
|
} else
{
|
439 |
|
el
.style.bac
kgroundCol
or = "#fff
";
|
|
443 |
|
el
.style.bac
kgroundCol
or = "#fff
";
|
440 |
|
}
|
|
444 |
|
}
|
441 |
|
|
|
445 |
|
|
442 |
|
el = d
ocument.ge
tElementBy
Id("catego
ryID");
|
|
446 |
|
el = d
ocument.ge
tElementBy
Id("catego
ryID");
|
443 |
|
if( el
.value.len
gth < 1 )
{
|
|
447 |
|
if( el
.value.len
gth < 1 )
{
|
444 |
|
el
.style.bac
kgroundCol
or = "pink
";
|
|
448 |
|
el
.style.bac
kgroundCol
or = "pink
";
|
445 |
|
ha
sErr = tru
e;
|
|
449 |
|
ha
sErr = tru
e;
|
446 |
|
fild
+=
"
\n
Category
";
|
|
450 |
|
fild
+=
"
Category
";
|
447 |
|
} else
{
|
|
451 |
|
} else
{
|
448 |
|
el
.style.bac
kgroundCol
or = "#fff
";
|
|
452 |
|
el
.style.bac
kgroundCol
or = "#fff
";
|
449 |
|
}
|
|
453 |
|
}
|
450 |
|
|
|
454 |
|
|
451 |
|
el = d
ocument.ge
tElementBy
Id("flag")
;
|
|
455 |
|
el = d
ocument.ge
tElementBy
Id("flag")
;
|
452 |
|
if( el
.value.len
gth < 1 )
{
|
|
456 |
|
if( el
.value.len
gth < 1 )
{
|
453 |
|
el
.style.bac
kgroundCol
or = "pink
";
|
|
457 |
|
el
.style.bac
kgroundCol
or = "pink
";
|
454 |
|
ha
sErr = tru
e;
|
|
458 |
|
ha
sErr = tru
e;
|
455 |
|
fild
+=
"
\n
Text
type
";
|
|
459 |
|
fild
+=
"
Text
type
";
|
456 |
|
} else
{
|
|
460 |
|
} else
{
|
457 |
|
el
.style.bac
kgroundCol
or = "#fff
";
|
|
461 |
|
el
.style.bac
kgroundCol
or = "#fff
";
|
458 |
|
}
|
|
462 |
|
}
|
459 |
|
|
|
463 |
|
|
460 |
|
if (ha
sErr) {
|
|
464 |
|
if (ha
sErr) {
|
461 |
|
al
ert( "Plea
se fill ne
xt fields
first!" +
fild )
|
|
465 |
|
al
ert( "Plea
se fill ne
xt fields
first!" +
fild )
|
462 |
|
re
turn false
;
|
|
466 |
|
re
turn false
;
|
463 |
|
} else
{
|
|
467 |
|
} else
{
|
464 |
|
re
turn true;
|
|
468 |
|
re
turn true;
|
465 |
|
}
|
|
469 |
|
}
|
466 |
|
}
|
|
470 |
|
}
|
467 |
|
</script>
|
|
471 |
|
</script>
|
468 |
|
|
|
472 |
|
|
469 |
|
<div class
="articles
FormBlock"
>
|
|
473 |
|
<div class
="articles
FormBlock"
>
|
470 |
|
<form
method="po
st"
action="{$
si
t
e['u
rl
_admin']
}articles.
php"
onsubmit="
return
checkForm(
);">
|
|
474 |
|
<form
method="po
st"
action="{$
t
his->sU
rl
}articles.
php"
onsubmit="
return
checkForm(
);">
|
471 |
|
<d
iv>{$sArti
cleTitleC}
</div>
|
|
475 |
|
<d
iv>{$sArti
cleTitleC}
</div>
|
472 |
|
<d
iv>
|
|
476 |
|
<d
iv>
|
473 |
|
<input t
ype="text"
name="tit
le" id="ar
ticleTitle
" class="c
atCaption"
value="{$
sTitle}" /
>
|
|
477 |
|
<input t
ype="text"
name="tit
le" id="ar
ticleTitle
" class="c
atCaption"
value="{$
sTitle}" /
>
|
474 |
|
</
div>
|
|
478 |
|
</
div>
|
475 |
|
<d
iv>{$sArti
cleC}</div
>
|
|
479 |
|
<d
iv>{$sArti
cleC}</div
>
|
476 |
|
<d
iv style="
margin-bot
tom:7px;">
|
|
480 |
|
<d
iv style="
margin-bot
tom:7px;">
|
477 |
|
<textarea
name="arti
cle"
id="articl
eBody"
class="
articl">{$
aArticle['
Text']}</t
extarea>
|
|
481 |
|
<textarea
name="arti
cle"
id="articl
eBody"
class="
classfieds
TextArea
articl">{$
aArticle['
Text']}</t
extarea>
|
478 |
|
</
div>
|
|
482 |
|
</
div>
|
479 |
|
<d
iv style="
margin-bot
tom:7px;">
|
|
483 |
|
<d
iv style="
margin-bot
tom:7px;">
|
480 |
|
<select
name="cate
goryID" id
="category
ID">
|
|
484 |
|
<select
name="cate
goryID" id
="category
ID">
|
481 |
|
<opt
ion value=
"">{$sSele
ctCategory
C}</option
>
|
|
485 |
|
<opt
ion value=
"">{$sSele
ctCategory
C}</option
>
|
482 |
|
{$sR
etCateg}
|
|
486 |
|
{$sR
etCateg}
|
483 |
|
</select
>
|
|
487 |
|
</select
>
|
484 |
|
</
div>
|
|
488 |
|
</
div>
|
485 |
|
<d
iv style="
margin-bot
tom:7px;">
|
|
489 |
|
<d
iv style="
margin-bot
tom:7px;">
|
486 |
|
<input t
ype="hidde
n" name="f
lag" value
="HTML" />
|
|
490 |
|
<input t
ype="hidde
n" name="f
lag" value
="HTML" />
|
487 |
|
<!-- <se
lect name=
"flag" id=
"flag">
|
|
491 |
|
<!-- <se
lect name=
"flag" id=
"flag">
|
488 |
|
<opt
ion value=
"">{$sPrin
tAsC}</opt
ion>
|
|
492 |
|
<opt
ion value=
"">{$sPrin
tAsC}</opt
ion>
|
489 |
|
<opt
ion value=
"Text"{$te
xtSelected
}>Text</op
tion>
|
|
493 |
|
<opt
ion value=
"Text"{$te
xtSelected
}>Text</op
tion>
|
490 |
|
<opt
ion value=
"HTML"{$ht
mlSelected
}>HTML</op
tion>
|
|
494 |
|
<opt
ion value=
"HTML"{$ht
mlSelected
}>HTML</op
tion>
|
491 |
|
</select
> -->
|
|
495 |
|
</select
> -->
|
492 |
|
</
div>
|
|
496 |
|
</
div>
|
493 |
|
<d
iv>
|
|
497 |
|
<d
iv>
|
494 |
|
<input t
ype="submi
t" value="
Submit">
|
|
498 |
|
<input t
ype="submi
t" value="
Submit">
|
495 |
|
{$sArtic
leActions}
|
|
499 |
|
{$sArtic
leActions}
|
496 |
|
</
div>
|
|
500 |
|
</
div>
|
497 |
|
</form
>
|
|
501 |
|
</form
>
|
498 |
|
</div>
|
|
502 |
|
</div>
|
499 |
|
EOF;
|
|
503 |
|
EOF;
|
500 |
|
re
turn $ret;
|
|
504 |
|
re
turn $ret;
|
501 |
|
}
|
|
505 |
|
}
|
502 |
|
|
|
506 |
|
|
503 |
|
functi
on deleteC
ategory( $
iCategoryI
D ) {
|
|
507 |
|
functi
on deleteC
ategory( $
iCategoryI
D ) {
|
504 |
|
gl
obal $logg
ed;
|
|
|
505 |
|
|
|
508 |
|
|
506 |
|
$sADS
=
_t('_Artic
les
D
eleted
S
uccessfull
y');
|
|
509 |
|
$sADS
=
_t('_Artic
les
were
d
eleted
s
uccessfull
y');
|
507 |
|
$s
ADF = _t('
_Articles
are not de
leted');
|
|
510 |
|
$s
ADF = _t('
_Articles
are not de
leted');
|
508 |
|
$sCDS
=
_t('_
C
ategory
D
eleted
Successful
ly
');
|
|
511 |
|
$sCDS
=
_t('_
c
ategory
_d
eleted
');
|
509 |
|
$sCDF
=
_t('_
C
ategory
are
not
delete
d');
|
|
512 |
|
$sCDF
=
_t('_
c
ategory
_
delete
_faile
d');
|
510 |
|
|
|
513 |
|
|
511 |
|
$s
RetVal = _
t('_Error
Occured');
|
|
514 |
|
$s
RetVal = _
t('_Error
Occured');
|
512 |
|
if
( $logged[
'admin'] )
{
|
|
515 |
|
if
( $this->b
AdminMode
) {
|
513 |
|
$sCatego
ryDeleteQu
ery = "DEL
ETE FROM `
ArticlesCa
tegory` WH
ERE `Categ
oryID` = '
{$iCategor
yID}' LIMI
T 1;";
|
|
516 |
|
$sCatego
ryDeleteQu
ery = "DEL
ETE FROM `
ArticlesCa
tegory` WH
ERE `Categ
oryID` = '
{$iCategor
yID}' LIMI
T 1;";
|
514 |
|
$sCatego
riesArticl
esDeleteQu
ery = "DEL
ETE FROM `
Articles`
WHERE `Cat
egoryID` =
'{$iCateg
oryID}';";
|
|
517 |
|
$sCatego
riesArticl
esDeleteQu
ery = "DEL
ETE FROM `
Articles`
WHERE `Cat
egoryID` =
'{$iCateg
oryID}';";
|
515 |
|
|
|
518 |
|
|
516 |
|
if( db_r
es( $sCate
goriesArti
clesDelete
Query ) )
{
|
|
519 |
|
if( db_r
es( $sCate
goriesArti
clesDelete
Query ) )
{
|
517 |
|
$sRe
tVal = $sA
DS;
|
|
520 |
|
$sRe
tVal = $sA
DS;
|
518 |
|
} else {
|
|
521 |
|
} else {
|
519 |
|
$sRe
tVal = $sA
DF;
|
|
522 |
|
$sRe
tVal = $sA
DF;
|
520 |
|
}
|
|
523 |
|
}
|
521 |
|
|
|
524 |
|
|
522 |
|
if( db_r
es( $sCate
goryDelete
Query ) )
{
|
|
525 |
|
if( db_r
es( $sCate
goryDelete
Query ) )
{
|
523 |
|
$sRe
tVal = $sC
DS;
|
|
526 |
|
$sRe
tVal = $sC
DS;
|
524 |
|
} else {
|
|
527 |
|
} else {
|
525 |
|
$sRe
tVal = $sC
DF;
|
|
528 |
|
$sRe
tVal = $sC
DF;
|
526 |
|
}
|
|
529 |
|
}
|
527 |
|
}
else {
|
|
530 |
|
}
else {
|
528 |
|
}
|
|
531 |
|
}
|
529 |
|
re
turn MsgBo
x($sRetVal
);
|
|
532 |
|
re
turn MsgBo
x($sRetVal
);
|
530 |
|
}
|
|
533 |
|
}
|
531 |
|
|
|
534 |
|
|
532 |
|
functi
on deleteA
rticle( $i
ArticleID
) {
|
|
535 |
|
functi
on deleteA
rticle( $i
ArticleID
) {
|
533 |
|
gl
obal $logg
ed;
|
|
|
534 |
|
|
|
536 |
|
|
535 |
|
$sADS
=
_t('_Artic
le
D
eleted
S
uccessfull
y');
|
|
537 |
|
$sADS
=
_t('_Artic
le
was
d
eleted
s
uccessfull
y');
|
536 |
|
$sADF
=
_t('_Artic
le
a
re
not
deleted');
|
|
538 |
|
$sADF
=
_t('_Artic
le
w
a
s
not
deleted');
|
537 |
|
|
|
539 |
|
|
538 |
|
$s
RetVal = _
t('_Error
Occured');
|
|
540 |
|
$s
RetVal = _
t('_Error
Occured');
|
539 |
|
if
( $logged[
'admin'] )
{
|
|
541 |
|
if
( $this->b
AdminMode
)
|
540 |
|
$sArticleD
eleteQuery
=
"DELETE
FROM
`Articles`
WHERE
`ArticlesI
D`
=
'{$iArticl
eID}'
;
";
|
|
542 |
|
$sArticleD
eleteQuery
=
"DELETE
FROM
`Articles`
WHERE
`ArticlesI
D`
=
'{$iArticl
eID}'
";
|
541 |
|
if(
db_res(
$sArticleD
eleteQuery
)
)
{
|
|
543 |
|
el
se
|
|
|
544 |
|
$sArticl
eDeleteQue
ry = "DELE
TE FROM `A
rticles` W
HERE `Arti
clesID` =
'{$iArticl
eID}' AND
`ownerID`=
'{$this->i
VisitorID}
'";
|
|
|
545 |
|
|
|
|
546 |
|
if(
db_res(
$sArticleD
eleteQuery
)
)
|
542 |
|
$sRe
tVal = $sA
DS;
|
|
547 |
|
$sRetVal
= $sADS;
|
543 |
|
}
else
{
|
|
548 |
|
else
|
544 |
|
$sRe
tVal = $sA
DF;
|
|
549 |
|
$sRetVal
= $sADF;
|
545 |
|
}
|
|
550 |
|
|
546 |
|
}
else {
|
|
|
547 |
|
}
|
|
|
548 |
|
re
turn MsgBo
x($sRetVal
);
|
|
551 |
|
re
turn MsgBo
x($sRetVal
);
|
549 |
|
}
|
|
552 |
|
}
|
550 |
|
|
|
553 |
|
|
551 |
|
functi
on ActionA
ddUpdateEl
ements() {
|
|
554 |
|
functi
on ActionA
ddUpdateEl
ements() {
|
552 |
|
$s
ActionText
= '';
|
|
555 |
|
$s
ActionText
= '';
|
553 |
|
if
( $_POST['
add_catego
ry'] ) {
|
|
556 |
|
if
( $_POST['
add_catego
ry'] ) {
|
554 |
|
$sCatego
rySubject
= process_
db_input(
$_POST['ca
ption'] );
|
|
557 |
|
$sCatego
rySubject
= process_
db_input(
$_POST['ca
ption'] );
|
555 |
|
$sCatego
ryDesc = p
rocess_db_
input( $_P
OST['descr
iption'] )
;
|
|
558 |
|
$sCatego
ryDesc = p
rocess_db_
input( $_P
OST['descr
iption'] )
;
|
|
|
559 |
|
$sCatego
ryUri = ur
iGenerate(
process_db
_input( $s
CategorySu
bject ), '
ArticlesCa
tegory', '
CategoryUr
i', 255);
|
556 |
|
|
|
560 |
|
|
557 |
|
$sAddQuery
=
"INSERT
INTO
`ArticlesC
ategory`
SET
`CategoryN
ame`
=
'{$sCatego
rySubject}
',
`CategoryD
escription
`
=
'{$sCatego
ryDesc}'
;
";
|
|
561 |
|
$sAddQuery
=
"INSERT
INTO
`ArticlesC
ategory`
SET
`CategoryN
ame`
=
'{$sCatego
rySubject}
',
`CategoryD
escription
`
=
'{$sCatego
ryDesc}'
,
`CategoryU
ri`='{$sCa
tegoryUri}
'
";
|
558 |
|
if ($sCa
tegorySubj
ect=='' ||
$sCategor
yDesc=='')
{
|
|
562 |
|
if ($sCa
tegorySubj
ect=='' ||
$sCategor
yDesc=='')
{
|
559 |
|
$sAc
tionText =
'Category
didn\'t a
dd';
|
|
563 |
|
$sAc
tionText =
'Category
didn\'t a
dd';
|
560 |
|
}
|
|
564 |
|
}
|
561 |
|
elseif(
db_res( $s
AddQuery )
) {
|
|
565 |
|
elseif(
db_res( $s
AddQuery )
) {
|
562 |
|
$sAc
tionText =
'Category
Added';
|
|
566 |
|
$sAc
tionText =
'Category
Added';
|
563 |
|
} else {
|
|
567 |
|
} else {
|
564 |
|
$sAc
tionText =
'Category
didn\'t a
dd';
|
|
568 |
|
$sAc
tionText =
'Category
didn\'t a
dd';
|
565 |
|
}
|
|
569 |
|
}
|
566 |
|
}
elseif( $_
POST['edit
_category'
] ) {
|
|
570 |
|
}
elseif( $_
POST['edit
_category'
] ) {
|
567 |
|
$sCatego
rySubject
= process_
db_input(
$_POST['ca
ption'] );
|
|
571 |
|
$sCatego
rySubject
= process_
db_input(
$_POST['ca
ption'] );
|
568 |
|
$sCatego
ryDesc = p
rocess_db_
input( $_P
OST['descr
iption'] )
;
|
|
572 |
|
$sCatego
ryDesc = p
rocess_db_
input( $_P
OST['descr
iption'] )
;
|
569 |
|
$iCatego
ryID = (in
t)$_POST['
categoryID
'];
|
|
573 |
|
$iCatego
ryID = (in
t)$_POST['
categoryID
'];
|
570 |
|
|
|
574 |
|
|
571 |
|
$sAddQue
ry = "UPDA
TE `Articl
esCategory
` SET `Cat
egoryName`
= '{$sCat
egorySubje
ct}', `Cat
egoryDescr
iption` =
'{$sCatego
ryDesc}' W
HERE `Cate
goryID` =
'{$iCatego
ryID}' LIM
IT 1;";
|
|
575 |
|
$sAddQue
ry = "UPDA
TE `Articl
esCategory
` SET `Cat
egoryName`
= '{$sCat
egorySubje
ct}', `Cat
egoryDescr
iption` =
'{$sCatego
ryDesc}' W
HERE `Cate
goryID` =
'{$iCatego
ryID}' LIM
IT 1;";
|
572 |
|
if ($sCa
tegorySubj
ect=='' ||
$sCategor
yDesc=='')
{
|
|
576 |
|
if ($sCa
tegorySubj
ect=='' ||
$sCategor
yDesc=='')
{
|
573 |
|
$sAc
tionText =
'Category
didn\'t a
dd';
|
|
577 |
|
$sAc
tionText =
'Category
didn\'t a
dd';
|
574 |
|
}
|
|
578 |
|
}
|
575 |
|
elseif(
db_res( $s
AddQuery )
) {
|
|
579 |
|
elseif(
db_res( $s
AddQuery )
) {
|
576 |
|
$sAc
tionText =
'Category
Udated';
|
|
580 |
|
$sAc
tionText =
'Category
Udated';
|
577 |
|
} else {
|
|
581 |
|
} else {
|
578 |
|
$sAc
tionText =
'Category
didn\'t u
pdated';
|
|
582 |
|
$sAc
tionText =
'Category
didn\'t u
pdated';
|
579 |
|
}
|
|
583 |
|
}
|
580 |
|
}
elseif( $_
POST['add_
article']
) {
|
|
584 |
|
}
elseif( $_
POST['add_
article']
) {
|
581 |
|
$sArticl
eTitle = p
rocess_db_
input( $_P
OST['title
'] );
|
|
585 |
|
$sArticl
eTitle = p
rocess_db_
input( $_P
OST['title
'] );
|
582 |
|
$sArticl
e = proces
s_db_input
( $_POST['
article']
);
|
|
586 |
|
$sArticl
e = proces
s_db_input
( $_POST['
article']
);
|
583 |
|
$iCatego
ryID = (in
t)$_POST['
categoryID
'];
|
|
587 |
|
$iCatego
ryID = (in
t)$_POST['
categoryID
'];
|
584 |
|
if( $_PO
ST['flag']
== 'HTML'
) {
|
|
588 |
|
if( $_PO
ST['flag']
== 'HTML'
) {
|
585 |
|
$sFl
ag = 'HTML
';
|
|
589 |
|
$sFl
ag = 'HTML
';
|
586 |
|
} else {
|
|
590 |
|
} else {
|
587 |
|
$sFl
ag = 'Text
';
|
|
591 |
|
$sFl
ag = 'Text
';
|
588 |
|
}
|
|
592 |
|
}
|
589 |
|
|
|
593 |
|
|
590 |
|
$sAddQuery
=
"INSERT
INTO
`Articles`
SET
`Title`
=
'{$sArticl
eTitle}',
`Text`
=
'{$sArticl
e}',
`CategoryI
D`
=
'{$iCatego
ryID}',
`Date`
=
NOW(),
`ArticleFl
ag`
=
'{$sFlag}'
;
";
|
|
594 |
|
$sArticl
eUri = uri
Generate($
sArticleTi
tle, 'Arti
cles', 'Ti
tle', 100)
;
|
|
|
595 |
|
|
|
|
596 |
|
$sOwner
= $this->b
AdminMode
? "" : ",
`ownerID`
= '{$this-
>iVisitorI
D}'";
|
|
|
597 |
|
$sAddQuery
=
"INSERT
INTO
`Articles`
SET
`Title`
=
'{$sArticl
eTitle}',
`Text`
=
'{$sArticl
e}',
`CategoryI
D`
=
'{$iCatego
ryID}',
`Date`
=
NOW(),
`ArticleFl
ag`
=
'{$sFlag}'
,
`ArticleUr
i`='{$sArt
icleUri}'
$sOwner
";
|
591 |
|
if ($sAr
ticleTitle
=='' || $s
Article=='
') {
|
|
598 |
|
if ($sAr
ticleTitle
=='' || $s
Article=='
') {
|
592 |
|
$sAc
tionText =
'Article
Not Added'
;
|
|
599 |
|
$sAc
tionText =
'Article
Not Added'
;
|
593 |
|
}
|
|
600 |
|
}
|
594 |
|
elseif(
db_res( $s
AddQuery )
) {
|
|
601 |
|
elseif(
db_res( $s
AddQuery )
) {
|
595 |
|
$sAc
tionText =
'Article
Added';
|
|
602 |
|
$sAc
tionText =
'Article
Added';
|
596 |
|
} else {
|
|
603 |
|
} else {
|
597 |
|
$sAc
tionText =
'Article
Not Added'
;
|
|
604 |
|
$sAc
tionText =
'Article
Not Added'
;
|
598 |
|
}
|
|
605 |
|
}
|
599 |
|
}
elseif( $_
POST['edit
_article']
) {
|
|
606 |
|
}
elseif( $_
POST['edit
_article']
) {
|
600 |
|
$sArticl
eTitle = p
rocess_db_
input( $_P
OST['title
'] );
|
|
607 |
|
$sArticl
eTitle = p
rocess_db_
input( $_P
OST['title
'] );
|
601 |
|
$sArticl
e = proces
s_db_input
( $_POST['
article']
);
|
|
608 |
|
$sArticl
e = proces
s_db_input
( $_POST['
article']
);
|
602 |
|
$iCatego
ryID = (in
t)$_POST['
categoryID
'];
|
|
609 |
|
$iCatego
ryID = (in
t)$_POST['
categoryID
'];
|
603 |
|
$iArticl
eID = (int
)$_POST['a
rticleID']
;
|
|
610 |
|
$iArticl
eID = (int
)$_POST['a
rticleID']
;
|
|
|
611 |
|
$sArticl
eUri = uri
Generate($
sArticleTi
tle, 'Arti
cles', 'Ti
tle', 100)
;
|
604 |
|
if( $_PO
ST['flag']
== 'HTML'
) {
|
|
612 |
|
if( $_PO
ST['flag']
== 'HTML'
) {
|
605 |
|
$sFl
ag = 'HTML
';
|
|
613 |
|
$sFl
ag = 'HTML
';
|
606 |
|
} else {
|
|
614 |
|
} else {
|
607 |
|
$sFl
ag = 'Text
';
|
|
615 |
|
$sFl
ag = 'Text
';
|
608 |
|
}
|
|
616 |
|
}
|
609 |
|
|
|
617 |
|
|
610 |
|
$sAddQuery
=
"UPDATE
`Articles`
SET
`Title`
=
'{$sArticl
eTitle}',
`Text`
=
'{$sArticl
e}',
`CategoryI
D`
=
'{$iCatego
ryID}',
`Date`
=
NOW(),
`ArticleFl
ag`
=
'{$sFlag}'
WHERE
`ArticlesI
D`
=
'{$iArticl
eID}'
;
";
|
|
618 |
|
if ($thi
s->bAdminM
ode) {
|
|
|
619 |
|
$sOw
ner = ", `
ownerID`='
0'";
|
|
|
620 |
|
$sOw
nerCond =
"";
|
|
|
621 |
|
}
|
|
|
622 |
|
else {
|
|
|
623 |
|
$sOw
ner = ", `
ownerID`='
{$this->iV
isitorID}'
";
|
|
|
624 |
|
$sOw
nerCond =
" AND `own
erID`='{$t
his->iVisi
torID}'";
|
|
|
625 |
|
}
|
|
|
626 |
|
$sAddQuery
=
"UPDATE
`Articles`
SET
`Title`
=
'{$sArticl
eTitle}',
`Text`
=
'{$sArticl
e}',
`CategoryI
D`
=
'{$iCatego
ryID}',
`Date`
=
NOW(),
`ArticleFl
ag`
=
'{$sFlag}'
,
`ArticleUr
i`='{$sArt
icleUri}'
$sOwner
WHERE
`ArticlesI
D`
=
'{$iArticl
eID}'
$sOwnerCon
d
";
|
611 |
|
if ($sAr
ticleTitle
=='' || $s
Article=='
') {
|
|
627 |
|
if ($sAr
ticleTitle
=='' || $s
Article=='
') {
|
612 |
|
$sAc
tionText =
'Article
Updated';
|
|
628 |
|
$sAc
tionText =
'Article
Updated';
|
613 |
|
}
|
|
629 |
|
}
|
614 |
|
elseif(
db_res( $s
AddQuery )
) {
|
|
630 |
|
elseif(
db_res( $s
AddQuery )
) {
|
615 |
|
$sAc
tionText =
'Article
Updated';
|
|
631 |
|
$sAc
tionText =
'Article
Updated';
|
616 |
|
} else {
|
|
632 |
|
} else {
|
617 |
|
$sAc
tionText =
'Article
Not Update
d';
|
|
633 |
|
$sAc
tionText =
'Article
Not Update
d';
|
618 |
|
}
|
|
634 |
|
}
|
619 |
|
}
|
|
635 |
|
}
|
620 |
|
re
turn ($sAc
tionText!=
'') ? MsgB
ox($sActio
nText) : '
';
|
|
636 |
|
re
turn ($sAc
tionText!=
'') ? MsgB
ox($sActio
nText) : '
';
|
621 |
|
}
|
|
637 |
|
}
|
|
|
638 |
|
|
|
|
639 |
|
functi
on getArti
cleIdByUri
($sName)
|
|
|
640 |
|
{
|
|
|
641 |
|
$s
Name = pro
cess_db_in
put($sName
);
|
|
|
642 |
|
re
turn db_v
alue( "SEL
ECT `Artic
lesID` FRO
M `Article
s` WHERE `
ArticleUri
` = '$sNam
e'" );
|
|
|
643 |
|
}
|
|
|
644 |
|
|
|
|
645 |
|
functi
on getArti
cleCatIdBy
Uri($sName
)
|
|
|
646 |
|
{
|
|
|
647 |
|
$s
Name = pro
cess_db_in
put($sName
);
|
|
|
648 |
|
re
turn db_v
alue( "SEL
ECT `Categ
oryID` FRO
M `Article
sCategory`
WHERE `Ca
tegoryUri`
= '$sName
'" );
|
|
|
649 |
|
}
|
|
|
650 |
|
|
|
|
651 |
|
functi
on getArti
cleUrl($iA
rticleId)
|
|
|
652 |
|
{
|
|
|
653 |
|
gl
obal $sUrl
;
|
|
|
654 |
|
|
|
|
655 |
|
$i
ArticleId
= (int)$iA
rticleId;
|
|
|
656 |
|
if
($this->i
sPermalink
Enabled()
&& $this->
bAdminMode
== false)
{
|
|
|
657 |
|
$sArticl
eUri = db_
value("SEL
ECT `Artic
leUri` FRO
M `Article
s` WHERE `
ArticlesID
`='{$iArti
cleId}'");
|
|
|
658 |
|
$sLinkUr
l = $sUrl.
'articles/
entry/'.$s
ArticleUri
;
|
|
|
659 |
|
}
|
|
|
660 |
|
el
se
|
|
|
661 |
|
$sLinkUr
l = $sUrl.
'articles.
php?action
=viewartic
le&article
ID='.$iArt
icleId;
|
|
|
662 |
|
|
|
|
663 |
|
re
turn $sLin
kUrl;
|
|
|
664 |
|
}
|
|
|
665 |
|
|
|
|
666 |
|
functi
on getArti
cleCatUrl(
$iCategory
Id)
|
|
|
667 |
|
{
|
|
|
668 |
|
gl
obal $sUrl
;
|
|
|
669 |
|
|
|
|
670 |
|
$i
ArticleId
= (int)$iA
rticleId;
|
|
|
671 |
|
if
($this->i
sPermalink
Enabled()
&& $this->
bAdminMode
== false)
{
|
|
|
672 |
|
$sCatego
ryUri = db
_value("SE
LECT `Cate
goryUri` F
ROM `Artic
lesCategor
y` WHERE `
CategoryID
`='{$iCate
goryId}'")
;
|
|
|
673 |
|
$sLinkUr
l = $sUrl.
'articles/
category/'
.$sCategor
yUri;
|
|
|
674 |
|
}
|
|
|
675 |
|
el
se
|
|
|
676 |
|
$sLinkUr
l = $sUrl.
'articles.
php?action
=viewcateg
ory&catID=
'.$iCatego
ryId;
|
|
|
677 |
|
|
|
|
678 |
|
re
turn $sLin
kUrl;
|
|
|
679 |
|
}
|
|
|
680 |
|
|
|
|
681 |
|
functi
on isPerma
linkEnable
d()
|
|
|
682 |
|
{
|
|
|
683 |
|
re
turn isset
($this->_i
sPermalink
Enabled) ?
$this->_i
sPermalink
Enabled :
($this->_i
sPermalink
Enabled =
(getParam(
'permalink
s_articles
') == 'on'
));
|
|
|
684 |
|
}
|
|
|
685 |
|
|
|
|
686 |
|
functi
on getArti
clesResour
ce($iLimit
= 1)
|
|
|
687 |
|
{
|
|
|
688 |
|
$i
Limit = (i
nt)$iLimit
;
|
|
|
689 |
|
|
|
|
690 |
|
$s
Query = "
|
|
|
691 |
|
SE
LECT
|
|
|
692 |
|
`Article
sID`,
|
|
|
693 |
|
`Article
s`.`Catego
ryID`,
|
|
|
694 |
|
`Date`,
|
|
|
695 |
|
`Title`,
|
|
|
696 |
|
`Text`,
|
|
|
697 |
|
`Categor
yName`,
|
|
|
698 |
|
`ownerID
`
|
|
|
699 |
|
FR
OM `Articl
es`
|
|
|
700 |
|
IN
NER JOIN `
ArticlesCa
tegory` US
ING( `Cate
goryID` )
|
|
|
701 |
|
OR
DER BY `Da
te` DESC
|
|
|
702 |
|
LI
MIT $iLimi
t
|
|
|
703 |
|
";
|
|
|
704 |
|
|
|
|
705 |
|
$r
Articles =
db_res($s
Query);
|
|
|
706 |
|
|
|
|
707 |
|
re
turn $rArt
icles;
|
|
|
708 |
|
}
|
|
|
709 |
|
|
622 |
|
}
|
|
710 |
|
}
|
623 |
|
|
|
711 |
|
|
624 |
|
?>
|
|
712 |
|
?>
|