001.
<?php
002.
003.
004.
005.
debug_backtrace() ||
die
(
'Direct access not permitted'
);
006.
007.
008.
$action
= (isset(
$_GET
[
'action'
])) ? htmlentities(
$_GET
[
'action'
], ENT_QUOTES,
'UTF-8'
) :
''
;
009.
010.
if
(
$action
!=
''
&& defined(
'PMS_DEMO'
) && PMS_DEMO == 1){
011.
$action
=
''
;
012.
$_SESSION
[
'msg_error'
][] =
'This action is disabled in the demo mode'
;
013.
}
014.
015.
016.
$_SESSION
[
'module_referer'
] = MODULE;
017.
$csrf_token
= pms_get_token(
'list'
);
018.
019.
$from_time
= time();
020.
$to_time
= time()+(86400*31);
021.
022.
$from_date
=
gmdate
(
'Y/m/d'
,
$from_time
);
023.
$to_date
=
gmdate
(
'Y/m/d'
,
$to_time
);
024.
025.
if
(isset(
$_POST
[
'from_date'
]))
$from_date
= htmlentities(
$_POST
[
'from_date'
], ENT_QUOTES,
'UTF-8'
);
026.
if
(isset(
$_POST
[
'to_date'
]))
$to_date
= htmlentities(
$_POST
[
'to_date'
], ENT_QUOTES,
'UTF-8'
);
027.
028.
029.
030.
$id
= (isset(
$_GET
[
'id'
]) &&
is_numeric
(
$_GET
[
'id'
])) ?
$_GET
[
'id'
] : 0;
031.
032.
033.
if
(isset(
$_GET
[
'offset'
]) &&
is_numeric
(
$_GET
[
'offset'
]))
$offset
=
$_GET
[
'offset'
];
034.
elseif
(isset(
$_SESSION
[
'offset'
]) && isset(
$_SESSION
[
'module_referer'
]) &&
$_SESSION
[
'module_referer'
] == MODULE)
$offset
=
$_SESSION
[
'offset'
];
035.
else
$offset
= 0;
036.
037.
038.
if
(isset(
$_GET
[
'limit'
]) &&
is_numeric
(
$_GET
[
'limit'
])){
039.
$limit
=
$_GET
[
'limit'
];
040.
$offset
= 0;
041.
}
042.
elseif
(isset(
$_SESSION
[
'limit'
]) && isset(
$_SESSION
[
'module_referer'
]) &&
$_SESSION
[
'module_referer'
] == MODULE)
$limit
=
$_SESSION
[
'limit'
];
043.
else
$limit
= 20;
044.
045.
$_SESSION
[
'limit'
] =
$limit
;
046.
047.
$_SESSION
[
'offset'
] =
$offset
;
048.
049.
050.
require_once
(SYSBASE.PMS_ADMIN_FOLDER.
'/includes/fn_list.php'
);
051.
052.
if
(
$pms_db
!== false){
053.
054.
$cols
= getCols();
055.
$filters
= getFilters(
$pms_db
);
056.
if
(
is_null
(
$cols
))
$cols
=
array
();
057.
if
(
is_null
(
$filters
))
$filters
=
array
();
058.
$total
= 0;
059.
$total_page
= 0;
060.
$q_search
=
''
;
061.
$result_lang
= false;
062.
$total_lang
= 1;
063.
$result
= false;
064.
$referer
= DIR.
'index.php?view=list'
;
065.
066.
067.
if
(isset(
$_GET
[
'order'
]))
$order
= htmlentities(
$_GET
[
'order'
], ENT_QUOTES,
'UTF-8'
);
068.
elseif
(isset(
$_SESSION
[
'order'
]) &&
$_SESSION
[
'order'
] !=
''
&& isset(
$_SESSION
[
'module_referer'
]) &&
$_SESSION
[
'module_referer'
] == MODULE)
$order
=
$_SESSION
[
'order'
];
069.
else
$order
= getOrder();
070.
071.
if
(isset(
$_GET
[
'sort'
]))
$sort
= htmlentities(
$_GET
[
'sort'
], ENT_QUOTES,
'UTF-8'
);
072.
elseif
(isset(
$_SESSION
[
'sort'
]) &&
$_SESSION
[
'sort'
] !=
''
&& isset(
$_SESSION
[
'module_referer'
]) &&
$_SESSION
[
'module_referer'
] == MODULE)
$sort
=
$_SESSION
[
'sort'
];
073.
else
$sort
=
'asc'
;
074.
075.
$sort
= (
strtolower
(
substr
(
$order
, -5)) ==
' desc'
) ?
'desc'
:
'asc'
;
076.
$order
= trim(
str_ireplace
(
$sort
,
''
,
$order
));
077.
078.
$sort_class
= (
$sort
==
'asc'
) ?
'up'
:
'down'
;
079.
080.
$_SESSION
[
'order'
] =
$order
;
081.
$_SESSION
[
'sort'
] =
$sort
;
082.
083.
$rsort
= (
$sort
==
'asc'
) ?
'desc'
:
'asc'
;
084.
085.
086.
if
(MULTILINGUAL){
087.
$result_lang
=
$pms_db
->query(
'SELECT id, title FROM pm_lang WHERE id != '
.PMS_DEFAULT_LANG.
' AND checked = 1'
);
088.
if
(
$result_lang
!== false)
089.
$total_lang
=
$pms_db
->last_row_count();
090.
}
091.
092.
093.
if
(isset(
$_SESSION
[
'module_referer'
]) &&
$_SESSION
[
'module_referer'
] !== MODULE){
094.
unset(
$_SESSION
[
'filters'
]);
095.
unset(
$_SESSION
[
'q_search'
]);
096.
}
097.
if
(isset(
$_POST
[
'search'
])){
098.
foreach
(
$filters
as
$filter
){
099.
$fieldName
=
$filter
->getName();
100.
$value
= (isset(
$_POST
[
$fieldName
])) ? htmlentities(
$_POST
[
$fieldName
], ENT_QUOTES,
'UTF-8'
) :
''
;
101.
$filter
->setValue(
$value
);
102.
}
103.
$q_search
= htmlentities(
$_POST
[
'q_search'
], ENT_QUOTES,
'UTF-8'
);
104.
$_SESSION
[
'filters'
] = serialize(
$filters
);
105.
$_SESSION
[
'q_search'
] =
$q_search
;
106.
$offset
= 0;
107.
$_SESSION
[
'offset'
] =
$offset
;
108.
}
else
{
109.
if
(isset(
$_SESSION
[
'filters'
]))
$filters
= unserialize(
$_SESSION
[
'filters'
]);
110.
if
(isset(
$_SESSION
[
'q_search'
]))
$q_search
=
$_SESSION
[
'q_search'
];
111.
}
112.
113.
114.
$condition
=
''
;
115.
116.
if
(MULTILINGUAL)
$condition
.=
' lang = '
.PMS_DEFAULT_LANG;
117.
118.
foreach
(
$filters
as
$filter
){
119.
$fieldName
=
$filter
->getName();
120.
$fieldValue
=
$filter
->getValue();
121.
if
(
$fieldValue
!=
''
){
122.
if
(
$condition
!=
''
)
$condition
.=
' AND'
;
123.
$condition
.=
' '
.
$fieldName
.
' = '
.
$pms_db
->quote(
$fieldValue
);
124.
}
125.
}
126.
127.
if
(!in_array(
$_SESSION
[
'user'
][
'type'
],
array
(
'administrator'
,
'manager'
,
'editor'
)) && pms_db_column_exists(
$pms_db
,
'pm_'
.MODULE,
'users'
)){
128.
if
(
$condition
!=
''
)
$condition
.=
' AND'
;
129.
$condition
.=
' users REGEXP \'(^|,)'
.
$_SESSION
[
'user'
][
'id'
].
'(,|$)\''
;
130.
}
131.
132.
$tmp_order
=
$order
;
133.
if
(!
empty
(
$tmp_order
))
$tmp_order
=
'`'
.
str_replace
(
', '
,
'`, `'
,
$tmp_order
).
'`'
;
134.
$tmp_order
.=
' '
.
$sort
;
135.
136.
$query_search
= pms_db_getRequestSelect(
$pms_db
,
'pm_'
.MODULE, getSearchFieldsList(
$cols
),
$q_search
,
$condition
,
$tmp_order
);
137.
138.
$result_total
=
$pms_db
->query(
$query_search
);
139.
if
(
$result_total
!== false)
140.
$total
=
$pms_db
->last_row_count();
141.
142.
if
(
$limit
> 0)
$query_search
.=
' LIMIT '
.
$limit
.
' OFFSET '
.
$offset
;
143.
144.
$result
=
$pms_db
->query(
$query_search
);
145.
if
(
$result
!== false)
146.
$total_page
=
$pms_db
->last_row_count();
147.
148.
if
(
empty
(
$_SESSION
[
'msg_error'
])){
149.
if
(in_array(
'edit'
,
$permissions
) || in_array(
'all'
,
$permissions
)){
150.
151.
152.
if
(
$action
==
'define_main'
&&
$id
> 0 && pms_check_token(
$referer
,
'list'
,
'get'
))
153.
define_main(
$pms_db
,
'pm_'
.MODULE,
$id
, 1);
154.
155.
if
(
$action
==
'remove_main'
&&
$id
> 0 && pms_check_token(
$referer
,
'list'
,
'get'
))
156.
define_main(
$pms_db
,
'pm_'
.MODULE,
$id
, 0);
157.
158.
159.
if
(
$action
==
'display_home'
&&
$id
> 0 && pms_check_token(
$referer
,
'list'
,
'get'
))
160.
display_home(
$pms_db
,
'pm_'
.MODULE,
$id
, 1);
161.
162.
if
(
$action
==
'remove_home'
&&
$id
> 0 && pms_check_token(
$referer
,
'list'
,
'get'
))
163.
display_home(
$pms_db
,
'pm_'
.MODULE,
$id
, 0);
164.
165.
if
(
$action
==
'display_home_multi'
&& isset(
$_POST
[
'multiple_item'
]) && pms_check_token(
$referer
,
'list'
,
'get'
))
166.
display_home_multi(
$pms_db
,
'pm_'
.MODULE, 1,
$_POST
[
'multiple_item'
]);
167.
168.
if
(
$action
==
'remove_home_multi'
&& isset(
$_POST
[
'multiple_item'
]) && pms_check_token(
$referer
,
'list'
,
'get'
))
169.
display_home_multi(
$pms_db
,
'pm_'
.MODULE, 0,
$_POST
[
'multiple_item'
]);
170.
171.
172.
if
(
$action
==
'check'
&&
$id
> 0 && pms_check_token(
$referer
,
'list'
,
'get'
))
173.
check(
$pms_db
,
'pm_'
.MODULE,
$id
, 1);
174.
175.
if
(
$action
==
'uncheck'
&&
$id
> 0 && pms_check_token(
$referer
,
'list'
,
'get'
))
176.
check(
$pms_db
,
'pm_'
.MODULE,
$id
, 2);
177.
178.
if
(
$action
==
'archive'
&&
$id
> 0 && pms_check_token(
$referer
,
'list'
,
'get'
))
179.
check(
$pms_db
,
'pm_'
.MODULE,
$id
, 3);
180.
181.
if
(
$action
==
'check_multi'
&& isset(
$_POST
[
'multiple_item'
]) && pms_check_token(
$referer
,
'list'
,
'get'
))
182.
check_multi(
$pms_db
,
'pm_'
.MODULE, 1,
$_POST
[
'multiple_item'
]);
183.
184.
if
(
$action
==
'uncheck_multi'
&& isset(
$_POST
[
'multiple_item'
]) && pms_check_token(
$referer
,
'list'
,
'get'
))
185.
check_multi(
$pms_db
,
'pm_'
.MODULE, 2,
$_POST
[
'multiple_item'
]);
186.
187.
if
(
$action
==
'archive_multi'
&& isset(
$_POST
[
'multiple_item'
]) && pms_check_token(
$referer
,
'list'
,
'get'
))
188.
check_multi(
$pms_db
,
'pm_'
.MODULE, 3,
$_POST
[
'multiple_item'
]);
189.
}
190.
191.
if
(in_array(
'delete'
,
$permissions
) || in_array(
'all'
,
$permissions
)){
192.
193.
194.
if
(
$action
==
'delete'
&&
$id
> 0 && pms_check_token(
$referer
,
'list'
,
'get'
))
195.
delete_item(
$pms_db
,
$id
);
196.
197.
if
(
$action
==
'delete_multi'
&& isset(
$_POST
[
'multiple_item'
]) && pms_check_token(
$referer
,
'list'
,
'get'
))
198.
delete_multi(
$pms_db
,
$_POST
[
'multiple_item'
]);
199.
}
200.
201.
if
(in_array(
'all'
,
$permissions
)){
202.
203.
204.
if
(MULTILINGUAL && isset(
$_POST
[
'complete_lang'
]) && isset(
$_POST
[
'languages'
]) && pms_check_token(
$referer
,
'list'
,
'post'
)){
205.
foreach
(
$_POST
[
'languages'
]
as
$id_lang
){
206.
complete_lang_module(
$pms_db
,
'pm_'
.MODULE,
$id_lang
);
207.
if
(NB_FILES > 0) complete_lang_module(
$pms_db
,
'pm_'
.MODULE.
'_file'
,
$id_lang
, true);
208.
}
209.
}
210.
}
211.
}
212.
}
213.
214.
$_SESSION
[
'module_referer'
] = MODULE;
215.
$csrf_token
= pms_get_token(
'list'
); ?>
216.
<!DOCTYPE html>
217.
<head>
218.
<?php
include
(SYSBASE.PMS_ADMIN_FOLDER.
'/includes/inc_header_list.php'
); ?>
219.
<link rel=
"stylesheet"
href=
"<?php echo DOCBASE.PMS_ADMIN_FOLDER.'/css/pms.css'; ?>"
>
220.
221.
<script>
222.
$(
function
(){
223.
$(
'#from_picker, #start_picker'
).datepicker({
224.
dateFormat:
'yy/mm/dd'
,
225.
226.
onClose:
function
(selectedDate, instance){
227.
if
(selectedDate !=
''
) {
228.
var
relPicker = $(
'#'
+$(this).attr(
'rel'
));
229.
relPicker.datepicker(
'option'
,
'minDate'
, selectedDate);
230.
var
date
= $.datepicker.parseDate(instance.settings.dateFormat, selectedDate, instance.settings);
231.
date
.setMonth(
date
.getMonth() + 1);
232.
relPicker.datepicker(
'option'
,
'minDate'
, selectedDate);
233.
relPicker.datepicker(
'option'
,
'maxDate'
,
date
);
234.
}
235.
}
236.
});
237.
$(
'#to_picker, #end_picker'
).datepicker({
238.
dateFormat:
'yy/mm/dd'
,
239.
defaultDate:
'+1w'
,
240.
onClose:
function
(selectedDate){
241.
var
relPicker = $(
'#'
+$(this).attr(
'rel'
));
242.
relPicker.datepicker(
'option'
,
'maxDate'
, selectedDate);
243.
}
244.
});
245.
<?php
246.
if
(isset(
$field_notice
) && !
empty
(
$field_notice
))
247.
foreach
(
$field_notice
as
$field
=>
$notice
)
echo
'$(\'.field-notice[rel="'
.
$field
.
'"]\').html(\''
.
$notice
.
'\').fadeIn(\'slow\').parent().addClass(\'alert alert-danger\');'
.
"\n"
; ?>
248.
});
249.
</script>
250.
</head>
251.
<body>
252.
<div id=
"wrapper"
>
253.
<?php
include
(SYSBASE.PMS_ADMIN_FOLDER.
'/includes/inc_top.php'
); ?>
254.
<div id=
"page-wrapper"
>
255.
<form id=
"form"
action=
"index.php?view=list"
method=
"post"
class
=
"ajax-form"
>
256.
<div
class
=
"page-header"
>
257.
<div
class
=
"container-fluid"
>
258.
<div
class
=
"row"
>
259.
<div
class
=
"col-md-12 clearfix"
>
260.
<h1
class
=
"pull-left"
><i
class
=
"fas fa-fw fa-<?php echo ICON; ?>"
></i> <?php
echo
TITLE_ELEMENT; ?></h1>
261.
<div
class
=
"pull-left text-right"
>
262.
263.
<?php
264.
if
(in_array(
'add'
,
$permissions
) || in_array(
'all'
,
$permissions
)){ ?>
265.
<a href=
"index.php?view=form&id=0"
class
=
"btn btn-primary mt15 mb15"
>
266.
<i
class
=
"fas fa-fw fa-plus-circle"
></i> <?php
echo
$pms_texts
[
'NEW'
]; ?>
267.
</a>
268.
<?php
269.
}
270.
if
(
is_file
(
'custom_nav.php'
))
include
(
'custom_nav.php'
); ?>
271.
</div>
272.
</div>
273.
</div>
274.
</div>
275.
</div>
276.
<div
class
=
"container-fluid"
>
277.
<div
class
=
"alert-container"
>
278.
<div
class
=
"alert alert-success alert-dismissable"
></div>
279.
<div
class
=
"alert alert-warning alert-dismissable"
></div>
280.
<div
class
=
"alert alert-danger alert-dismissable"
></div>
281.
</div>
282.
<?php
283.
if
(
$pms_db
!== false){
284.
if
(!in_array(
'no_access'
,
$permissions
)){ ?>
285.
<input type=
"hidden"
name=
"csrf_token"
value=
"<?php echo $csrf_token; ?>"
/>
286.
<div
class
=
"panel panel-default"
>
287.
<div
class
=
"panel-heading form-inline clearfix"
>
288.
<div
class
=
"row"
>
289.
<div
class
=
"col-md-6 text-left"
>
290.
<div
class
=
"form-inline"
>
291.
<input type=
"text"
name=
"q_search"
value=
"<?php echo $q_search; ?>"
class
=
"form-control input-sm"
placeholder=
" <?php echo $pms_texts['SEARCH']; ?>..."
/>
292.
293.
294.
<div
class
=
"col-md-12 form-inline"
>
295.
<div
class
=
"form-group"
>
296.
<label
class
=
"sr-only"
for
=
"from"
></label>
297.
<div
class
=
"input-group"
>
298.
<div
class
=
"input-group-addon"
><i
class
=
"fas fa-fw fa-calendar"
></i> <?php
echo
$pms_texts
[
'FROM_DATE'
]; ?></div>
299.
<input type=
"text"
class
=
"form-control datepicker"
id=
"from_picker"
rel=
"to_picker"
name=
"from_date"
value=
"<?php echo $from_date; ?>"
>
300.
</div>
301.
<div
class
=
"field-notice"
rel=
"from_date"
></div>
302.
</div>
303.
<div
class
=
"form-group"
>
304.
<div
class
=
"input-group"
>
305.
<div
class
=
"input-group-addon"
><i
class
=
"fas fa-fw fa-calendar"
></i> <?php
echo
$pms_texts
[
'TO_DATE'
]; ?></div>
306.
<input type=
"text"
class
=
"form-control datepicker"
id=
"to_picker"
rel=
"from_picker"
name=
"to_date"
value=
"<?php echo $to_date; ?>"
>
307.
</div>
308.
<div
class
=
"field-notice"
rel=
"to_date"
></div>
309.
</div>
310.
311.
312.
313.
<?php displayFilters(
$filters
); ?>
314.
<button
class
=
"btn btn-default btn-sm"
type=
"submit"
id=
"search"
name=
"search"
><i
class
=
"fas fa-fw fa-search"
></i> <?php
echo
$pms_texts
[
'SEARCH'
]; ?></button>
315.
</div>
316.
</div>
317.
318.
<div
class
=
"col-md-6 text-right"
>
319.
<div
class
=
"input-group"
>
320.
<div
class
=
"input-group-addon"
><i
class
=
"fas fa-fw fa-th-list"
></i> <?php
echo
$pms_texts
[
'DISPLAY'
]; ?></div>
321.
<select
class
=
"select-url form-control input-sm"
>
322.
<?php
323.
echo
(
$limit
!= 20) ?
'<option value="index.php?view=list&limit=20">20</option>'
:
'<option selected="selected">20</option>'
;
324.
echo
(
$limit
!= 50) ?
'<option value="index.php?view=list&limit=50">50</option>'
:
'<option selected="selected">50</option>'
;
325.
echo
(
$limit
!= 100) ?
'<option value="index.php?view=list&limit=100">100</option>'
:
'<option selected="selected">100</option>'
; ?>
326.
</select>
327.
</div>
328.
<?php
329.
if
(
$limit
> 0){
330.
$nb_pages
=
ceil
(
$total
/
$limit
);
331.
if
(
$nb_pages
> 1){ ?>
332.
<div
class
=
"input-group"
>
333.
<div
class
=
"input-group-addon"
><?php
echo
$pms_texts
[
'PAGE'
]; ?></div>
334.
<select
class
=
"select-url form-control input-sm"
>
335.
<?php
336.
337.
for
(
$i
= 1;
$i
<=
$nb_pages
;
$i
++){
338.
$offset2
= (
$i
-1)*
$limit
;
339.
340.
if
(
$offset2
==
$offset
)
341.
echo
'<option value="" selected="selected">'
.
$i
.
'</option>'
;
342.
else
343.
echo
'<option value="index.php?view=list&offset='
.
$offset2
.
'">'
.
$i
.
'</option>'
;
344.
} ?>
345.
</select>
346.
</div>
347.
<?php
348.
}
349.
} ?>
350.
</div>
351.
</div>
352.
</div>
353.
<div
class
=
"panel-body"
>
354.
<div
class
=
"table-responsive"
>
355.
<table
class
=
"table table-hover table-striped"
id=
"listing_base"
>
356.
<thead>
357.
<tr
class
=
"nodrop nodrag"
>
358.
<th width=
"80"
>
359.
<?php
360.
if
(RANKING){ ?>
361.
<a href=
"index.php?view=list&order=rank&sort=<?php echo ($order == 'rank') ? $rsort : 'asc'; ?>"
>
362.
# <i
class
=
"fas fa-fw fa-sort<?php if($order == 'rank') echo '-'.$sort_class; ?>"
></i>
363.
</a>
364.
<?php
365.
} ?>
366.
</th>
367.
<th width=
"70"
>
368.
<a href=
"index.php?view=list&order=id&sort=<?php echo ($order == 'id') ? $rsort : 'asc'; ?>"
>
369.
ID <i
class
=
"fas fa-fw fa-sort<?php if($order == 'id') echo '-'.$sort_class; ?>"
></i>
370.
</a>
371.
</th>
372.
<?php
373.
if
(NB_FILES > 0)
echo
'<th width="160">'
.
$pms_texts
[
'IMAGE'
].
'</th>'
;
374.
foreach
(
$cols
as
$col
){ ?>
375.
<th>
376.
<a href=
"index.php?view=list&order=<?php echo $col->getName(); ?>&sort=<?php echo ($order == $col->getName()) ? $rsort : 'asc'; ?>"
>
377.
<?php
echo
$col
->getLabel(); ?>
378.
<i
class
=
"fas fa-fw fa-sort<?php if($order == $col->getName()) echo '-'.$sort_class; ?>"
></i>
379.
</a>
380.
</th>
381.
<?php
382.
}
383.
if
(
count
(
$cols
) == 0){
384.
$type_module
=
'file'
;
385.
if
(NB_FILES > 0){ ?>
386.
<th><?php
echo
$pms_texts
[
'FILE'
]; ?></th>
387.
<th><?php
echo
$pms_texts
[
'LABEL'
]; ?></th>
388.
<?php
389.
}
390.
}
391.
if
(DATES){ ?>
392.
<th width=
"160"
>
393.
<a href=
"index.php?view=list&order=add_date&sort=<?php echo ($order == 'add_date') ? $rsort : 'asc'; ?>"
>
394.
<?php
echo
$pms_texts
[
'ADDED_ON'
]; ?> <i
class
=
"fas fa-fw fa-sort<?php if($order == 'add_date') echo '-'.$sort_class; ?>"
></i>
395.
</a>
396.
</th>
397.
<th width=
"160"
>
398.
<a href=
"index.php?view=list&order=edit_date&sort=<?php echo ($order == 'edit_date') ? $rsort : 'asc'; ?>"
>
399.
<?php
echo
$pms_texts
[
'UPDATED_ON'
]; ?> <i
class
=
"fas fa-fw fa-sort<?php if($order == 'edit_date') echo '-'.$sort_class; ?>"
></i>
400.
</a>
401.
</th>
402.
<?php
403.
}
404.
if
(MAIN){ ?>
405.
<th width=
"100"
>
406.
<a href=
"index.php?view=list&order=main&sort=<?php echo ($order == 'main') ? $rsort : 'asc'; ?>"
>
407.
<?php
echo
$pms_texts
[
'MAIN'
]; ?> <i
class
=
"fas fa-fw fa-sort<?php if($order == 'main') echo '-'.$sort_class; ?>"
></i>
408.
</a>
409.
</th>
410.
<?php
411.
}
412.
if
(HOME){ ?>
413.
<th width=
"100"
>
414.
<a href=
"index.php?view=list&order=home&sort=<?php echo ($order == 'home') ? $rsort : 'asc'; ?>"
>
415.
<?php
echo
$pms_texts
[
'HOME'
]; ?> <i
class
=
"fas fa-fw fa-sort<?php if($order == 'home') echo '-'.$sort_class; ?>"
></i>
416.
</a>
417.
</th>
418.
<?php
419.
}
420.
if
(VALIDATION){ ?>
421.
<th width=
"100"
>
422.
<a href=
"index.php?view=list&order=checked&sort=<?php echo ($order == 'checked') ? $rsort : 'asc'; ?>"
>
423.
<?php
echo
$pms_texts
[
'STATUS'
]; ?> <i
class
=
"fas fa-fw fa-sort<?php if($order == 'checked') echo '-'.$sort_class; ?>"
></i>
424.
</a>
425.
</th>
426.
<?php
427.
} ?>
428.
<th width=
"140"
><?php
echo
$pms_texts
[
'ACTIONS'
]; ?></th>
429.
</tr>
430.
</thead>
431.
<tbody>
432.
<?php
433.
if
(
$result
!== false){
434.
435.
if
(NB_FILES > 0){
436.
$query_img
=
'SELECT * FROM pm_'
.MODULE.
'_file WHERE type = \'image\' AND id_item = :id AND file != \'\''
;
437.
if
(MULTILINGUAL)
$query_img
.=
' AND lang = '
.PMS_DEFAULT_LANG;
438.
$query_img
.=
' ORDER BY `rank` LIMIT 1'
;
439.
$result_img
=
$pms_db
->prepare(
$query_img
);
440.
$result_img
->bindParam(
':id'
,
$id
);
441.
442.
$query_pdf
=
'SELECT * FROM pm_'
.MODULE.
'_file WHERE type = \'other\' AND id_item = :id AND file LIKE \'%.pdf\''
;
443.
if
(MULTILINGUAL)
$query_pdf
.=
' AND lang = '
.PMS_DEFAULT_LANG;
444.
$query_pdf
.=
' ORDER BY `rank` LIMIT 1'
;
445.
$result_pdf
=
$pms_db
->prepare(
$query_pdf
);
446.
$result_pdf
->bindParam(
':id'
,
$id
);
447.
}
448.
449.
foreach
(
$result
as
$i
=>
$row
){
450.
451.
$id
=
$row
[
'id'
];
452.
$cols
= getColsValues(
$pms_db
,
$row
,
$i
,
$cols
);
453.
454.
if
(isset(
$preview_path
)) unset(
$preview_path
); ?>
455.
456.
<tr id=
"item_<?php echo $id ?>"
>
457.
458.
<td
class
=
"text-left"
>
459.
<input type=
"checkbox"
class
=
"checkitem"
name=
"multiple_item[]"
value=
"<?php echo $id; ?>"
/>
460.
<?php
if
(RANKING)
echo
$row
[
'rank'
]; ?>
461.
</td>
462.
463.
<td
class
=
"text-center"
><?php
echo
$id
; ?></td>
464.
465.
<?php
466.
if
(NB_FILES > 0){
467.
if
(
$result_img
->execute() !== false &&
$pms_db
->last_row_count() > 0){
468.
$row_img
=
$result_img
->fetch();
469.
470.
$filename_img
=
$row_img
[
'file'
];
471.
$id_img_file
=
$row_img
[
'id'
];
472.
$label
=
$row_img
[
'label'
];
473.
474.
$big_path
=
'medias/'
.MODULE.
'/big/'
.
$id_img_file
.
'/'
.
$filename_img
;
475.
$medium_path
=
'medias/'
.MODULE.
'/medium/'
.
$id_img_file
.
'/'
.
$filename_img
;
476.
$small_path
=
'medias/'
.MODULE.
'/small/'
.
$id_img_file
.
'/'
.
$filename_img
;
477.
478.
if
(RESIZING == 0 &&
is_file
(SYSBASE.
$big_path
))
$preview_path
=
$big_path
;
479.
elseif
(RESIZING == 1 &&
is_file
(SYSBASE.
$medium_path
))
$preview_path
=
$medium_path
;
480.
elseif
(
is_file
(SYSBASE.
$small_path
))
$preview_path
=
$small_path
;
481.
elseif
(
is_file
(SYSBASE.
$medium_path
))
$preview_path
=
$medium_path
;
482.
elseif
(
is_file
(SYSBASE.
$big_path
))
$preview_path
=
$big_path
;
483.
else
$preview_path
=
''
;
484.
485.
if
(
is_file
(SYSBASE.
$big_path
))
$zoom_path
=
$big_path
;
486.
elseif
(
is_file
(SYSBASE.
$medium_path
))
$zoom_path
=
$medium_path
;
487.
elseif
(
is_file
(SYSBASE.
$small_path
))
$zoom_path
=
$small_path
;
488.
else
$zoom_path
=
''
;
489.
} ?>
490.
491.
<td
class
=
"text-center wrap-img"
>
492.
<?php
493.
if
(isset(
$preview_path
) &&
is_file
(SYSBASE.
$preview_path
)){
494.
495.
$max_w
= 160;
496.
$max_h
= 36;
497.
$dim
=
getimagesize
(SYSBASE.
$preview_path
);
498.
$w
=
$dim
[0];
499.
$h
=
$dim
[1]; ?>
500.
501.
<a href=
"<?php echo DOCBASE.$zoom_path; ?>"
class
=
"image-link"
rel=
"<?php echo DOCBASE.$zoom_path; ?>"
>
502.
<?php
503.
if
(
$w
<
$max_w
&&
$h
<
$max_h
){
504.
$new_dim
= pms_getNewSize(
$w
,
$h
,
$max_w
,
$max_h
);
505.
506.
$new_w
=
$new_dim
[0];
507.
$new_h
=
$new_dim
[1];
508.
509.
$margin_w
=
round
((
$max_w
-
$new_w
)/2);
510.
$margin_h
=
round
((
$max_h
-
$new_h
)/2);
511.
512.
echo
'<img src="'
.DOCBASE.
$preview_path
.
'" width="'
.
$new_w
.
'" height="'
.
$new_h
.
'" style="margin:'
.
$margin_h
.
'px '
.
$margin_w
.
'px;">'
;
513.
514.
}
elseif
((
$w
/
$max_w
) > (
$h
/
$max_h
))
515.
echo
'<img src="'
.DOCBASE.
$preview_path
.
'" height="'
.
$max_h
.
'" style="margin: 0px -'
.
ceil
((((
$w
*
$max_h
)/
$h
)/2)-(
$max_w
/2)).
'px;">'
;
516.
else
517.
echo
'<img src="'
.DOCBASE.
$preview_path
.
'" width="'
.
$max_w
.
'" style="margin: -'
.
ceil
((((
$h
*
$max_w
)/
$w
)/2)-(
$max_h
/2)).
'px 0px;">'
; ?>
518.
</a>
519.
<?php
520.
} ?>
521.
</td>
522.
<?php
523.
}
524.
if
(isset(
$type_module
) &&
$type_module
==
'file'
){
525.
526.
$query_file
=
'SELECT * FROM pm_'
.MODULE.
'_file WHERE id_item = '
.
$id
;
527.
if
(MULTILINGUAL)
$query_file
.=
' AND lang = '
.PMS_DEFAULT_LANG;
528.
$query_file
.=
' ORDER BY `rank` LIMIT 1'
;
529.
$result_file
=
$pms_db
->query(
$query_file
);
530.
531.
if
(
$result_file
!== false &&
$pms_db
->last_row_count() > 0){
532.
$row_file
=
$result_file
->fetch();
533.
534.
$label
=
$row_file
[
'label'
];
535.
$filename
=
$row_file
[
'file'
];
536.
}
else
{
537.
$label
=
''
;
538.
$filename
=
''
;
539.
}
540.
echo
'<td>'
.
$filename
.
'</td>'
;
541.
echo
'<td>'
.
$label
.
'</td>'
;
542.
}
543.
foreach
(
$cols
as
$col
){
544.
echo
'<td'
;
545.
$type
=
$col
->
getType
();
546.
if
(
$type
==
'date'
||
$type
==
'date'
)
echo
' class="text-center"'
;
547.
if
(
$type
==
'price'
)
echo
' class="text-right"'
;
548.
echo
'>'
.
$col
->getValue(
$i
).
'</td>'
;
549.
}
550.
if
(DATES){
551.
$add_date
= (
is_null
(
$row
[
'add_date'
])) ?
'-'
:
strftime
(PMS_DATE_FORMAT.
' '
.PMS_TIME_FORMAT,
$row
[
'add_date'
]);
552.
$edit_date
= (
is_null
(
$row
[
'edit_date'
])) ?
'-'
:
strftime
(PMS_DATE_FORMAT.
' '
.PMS_TIME_FORMAT,
$row
[
'edit_date'
]); ?>
553.
<td
class
=
"text-center"
>
554.
<?php
echo
$add_date
; ?>
555.
</td>
556.
<td
class
=
"text-center"
>
557.
<?php
echo
$edit_date
; ?>
558.
</td>
559.
<?php
560.
}
561.
if
(MAIN){
562.
$main
=
$row
[
'main'
]; ?>
563.
<td
class
=
"text-center"
>
564.
<?php
565.
if
(
$main
== 0){
566.
if
((in_array(
'publish'
,
$permissions
) || in_array(
'all'
,
$permissions
))){ ?>
567.
<a
class
=
"tips"
href=
"index.php?view=list&id=<?php echo $id; ?>&csrf_token=<?php echo $csrf_token; ?>&action=define_main"
title=
"<?php echo $pms_texts['DEFINE_MAIN']; ?>"
><i
class
=
"fas fa-fw fa-star text-muted"
></i></a>
568.
<?php
569.
}
else
{ ?>
570.
<i
class
=
"fas fa-fw fa-star text-muted"
></i>
571.
<?php
572.
}
573.
}
elseif
(
$main
== 1){ ?>
574.
<i
class
=
"fas fa-fw fa-star text-primary"
></i>
575.
<?php
576.
} ?>
577.
</td>
578.
<?php
579.
}
580.
if
(HOME){
581.
$home
=
$row
[
'home'
]; ?>
582.
<td
class
=
"text-center"
>
583.
<?php
584.
if
(
$home
== 0){
585.
if
((in_array(
'publish'
,
$permissions
) || in_array(
'all'
,
$permissions
))){ ?>
586.
<a
class
=
"tips"
href=
"index.php?view=list&id=<?php echo $id; ?>&csrf_token=<?php echo $csrf_token; ?>&action=display_home"
title=
"<?php echo $pms_texts['SHOW_HOMEPAGE']; ?>"
><i
class
=
"fas fa-fw fa-home text-danger"
></i></a>
587.
<?php
588.
}
else
{ ?>
589.
<i
class
=
"fas fa-fw fa-home text-danger"
></i>
590.
<?php
591.
}
592.
}
elseif
(
$home
== 1){
593.
if
((in_array(
'publish'
,
$permissions
) || in_array(
'all'
,
$permissions
))){ ?>
594.
<a
class
=
"tips"
href=
"index.php?view=list&id=<?php echo $id; ?>&csrf_token=<?php echo $csrf_token; ?>&action=remove_home"
title=
"<?php echo $pms_texts['REMOVE_HOMEPAGE']; ?>"
><i
class
=
"fas fa-fw fa-home text-success"
></i></a>
595.
<?php
596.
}
else
{ ?>
597.
<i
class
=
"fas fa-fw fa-home text-success"
></i>
598.
<?php
599.
}
600.
} ?>
601.
</td>
602.
<?php
603.
}
604.
if
(VALIDATION){
605.
$checked
=
$row
[
'checked'
]; ?>
606.
<td
class
=
"text-center"
>
607.
<?php
608.
if
(
$checked
== 0)
echo
'<span class="label label-warning">'
.
$pms_texts
[
'AWAITING'
].
'</span>'
;
609.
elseif
(
$checked
== 1)
echo
'<span class="label label-success">'
.
$pms_texts
[
'PUBLISHED'
].
'</span>'
;
610.
elseif
(
$checked
== 2)
echo
'<span class="label label-danger">'
.
$pms_texts
[
'NOT_PUBLISHED'
].
'</span>'
;
611.
elseif
(
$checked
== 3)
echo
'<span class="label label-default">'
.
$pms_texts
[
'ARCHIVED'
].
'</span>'
; ?>
612.
</td>
613.
<?php
614.
} ?>
615.
<td
class
=
"text-center"
>
616.
<?php
617.
if
(NB_FILES > 0){
618.
if
(
$result_pdf
->execute() !== false &&
$pms_db
->last_row_count() > 0){
619.
$row_file
=
$result_pdf
->fetch();
620.
621.
$filename
=
$row_file
[
'file'
];
622.
$id_file
=
$row_file
[
'id'
];
623.
$label
=
$row_file
[
'label'
];
624.
625.
$file_path
= DOCBASE.
'medias/'
.MODULE.
'/other/'
.
$id_file
.
'/'
.
$filename
; ?>
626.
627.
<a
class
=
"tips"
href=
"<?php echo $file_path; ?>"
title=
"<?php echo $filename; ?>"
target=
"_blank"
><i
class
=
"far fa-fw fa-file-pdf text-danger"
></i></a>
628.
<?php
629.
}
630.
}
631.
if
(VALIDATION && (in_array(
'publish'
,
$permissions
) || in_array(
'all'
,
$permissions
))){
632.
if
(
$checked
== 0){ ?>
633.
<a
class
=
"tips"
href=
"index.php?view=list&id=<?php echo $id; ?>&csrf_token=<?php echo $csrf_token; ?>&action=check"
title=
"<?php echo $pms_texts['PUBLISH']; ?>"
><i
class
=
"fas fa-fw fa-check text-success"
></i></a>
634.
<a
class
=
"tips"
href=
"index.php?view=list&id=<?php echo $id; ?>&csrf_token=<?php echo $csrf_token; ?>&action=uncheck"
title=
"<?php echo $pms_texts['UNPUBLISH']; ?>"
><i
class
=
"fas fa-fw fa-ban text-danger"
></i></a>
635.
<a
class
=
"tips"
href=
"index.php?view=list&id=<?php echo $id; ?>&csrf_token=<?php echo $csrf_token; ?>&action=archive"
title=
"<?php echo $pms_texts['ARCHIVE']; ?>"
><i
class
=
"fas fa-fw fa-archive text-warning"
></i></a>
636.
<?php
637.
}
elseif
(
$checked
== 1){ ?>
638.
<i
class
=
"fas fa-fw fa-check text-muted"
></i>
639.
<a
class
=
"tips"
href=
"index.php?view=list&id=<?php echo $id; ?>&csrf_token=<?php echo $csrf_token; ?>&action=uncheck"
title=
"<?php echo $pms_texts['UNPUBLISH']; ?>"
><i
class
=
"fas fa-fw fa-ban text-danger"
></i></a>
640.
<a
class
=
"tips"
href=
"index.php?view=list&id=<?php echo $id; ?>&csrf_token=<?php echo $csrf_token; ?>&action=archive"
title=
"<?php echo $pms_texts['ARCHIVE']; ?>"
><i
class
=
"fas fa-fw fa-archive text-warning"
></i></a>
641.
<?php
642.
}
elseif
(
$checked
== 2){ ?>
643.
<a
class
=
"tips"
href=
"index.php?view=list&id=<?php echo $id; ?>&csrf_token=<?php echo $csrf_token; ?>&action=check"
title=
"<?php echo $pms_texts['PUBLISH']; ?>"
><i
class
=
"fas fa-fw fa-check text-success"
></i></a>
644.
<i
class
=
"fas fa-fw fa-ban text-muted"
></i>
645.
<a
class
=
"tips"
href=
"index.php?view=list&id=<?php echo $id; ?>&csrf_token=<?php echo $csrf_token; ?>&action=archive"
title=
"<?php echo $pms_texts['ARCHIVE']; ?>"
><i
class
=
"fas fa-fw fa-archive text-warning"
></i></a>
646.
<?php
647.
}
elseif
(
$checked
== 3){ ?>
648.
<a
class
=
"tips"
href=
"index.php?view=list&id=<?php echo $id; ?>&csrf_token=<?php echo $csrf_token; ?>&action=check"
title=
"<?php echo $pms_texts['PUBLISH']; ?>"
><i
class
=
"fas fa-fw fa-check text-success"
></i></a>
649.
<a
class
=
"tips"
href=
"index.php?view=list&id=<?php echo $id; ?>&csrf_token=<?php echo $csrf_token; ?>&action=uncheck"
title=
"<?php echo $pms_texts['UNPUBLISH']; ?>"
><i
class
=
"fas fa-fw fa-ban text-danger"
></i></a>
650.
<i
class
=
"fas fa-fw fa-archive text-muted"
></i>
651.
<?php
652.
}
653.
}
654.
if
(in_array(
'edit'
,
$permissions
) || in_array(
'all'
,
$permissions
) || in_array(
'view'
,
$permissions
)){ ?>
655.
<a
class
=
"tips"
href=
"index.php?view=form&id=<?php echo $id; ?>"
title=
"<?php echo $pms_texts['EDIT']; ?>"
><i
class
=
"fas fa-fw fa-edit"
></i></a>
656.
<?php
657.
}
658.
if
(in_array(
'delete'
,
$permissions
) || in_array(
'all'
,
$permissions
)){ ?>
659.
<a
class
=
"tips"
href=
"javascript:if(confirm('<?php echo $pms_texts['DELETE_CONFIRM2']; ?>')) window.location = 'index.php?view=list&id=<?php echo $id; ?>&csrf_token=<?php echo $csrf_token; ?>&action=delete';"
title=
"<?php echo $pms_texts['DELETE']; ?>"
><i
class
=
"fas fa-fw fa-trash-alt text-danger"
></i></a>
660.
<?php
661.
} ?>
662.
</td>
663.
</tr>
664.
<?php
665.
}
666.
} ?>
667.
</tbody>
668.
</table>
669.
</div>
670.
<?php
671.
if
(
$total
== 0){ ?>
672.
<div
class
=
"text-center mt20 mb20"
>- <?php
echo
$pms_texts
[
'NO_ELEMENT'
]; ?> -</div>
673.
<?php
674.
} ?>
675.
</div>
676.
<div
class
=
"panel-footer form-inline clearfix"
>
677.
<div
class
=
"row"
>
678.
<div
class
=
"col-md-6 text-left"
>
679.
<?php
680.
if
(
$total
> 0){ ?>
681.
<input type=
"checkbox"
class
=
"selectall"
/>
682.
<?php
echo
$pms_texts
[
'SELECT_ALL'
]; ?>
683.
<select name=
"multiple_actions"
class
=
"form-control input-sm"
>
684.
<option value=
""
>- <?php
echo
$pms_texts
[
'ACTIONS'
]; ?> -</option>
685.
<?php
686.
if
(in_array(
'publish'
,
$permissions
) || in_array(
'all'
,
$permissions
)){
687.
if
(VALIDATION){ ?>
688.
<option value=
"check_multi"
><?php
echo
$pms_texts
[
'PUBLISH'
]; ?></option>
689.
<option value=
"uncheck_multi"
><?php
echo
$pms_texts
[
'UNPUBLISH'
]; ?></option>
690.
<?php
691.
}
692.
if
(HOME){ ?>
693.
<option value=
"display_home_multi"
><?php
echo
$pms_texts
[
'SHOW_HOMEPAGE'
]; ?></option>
694.
<option value=
"remove_home_multi"
><?php
echo
$pms_texts
[
'REMOVE_HOMEPAGE'
]; ?></option>
695.
<?php
696.
}
697.
}
698.
if
(in_array(
'delete'
,
$permissions
) || in_array(
'all'
,
$permissions
)){ ?>
699.
<option value=
"delete_multi"
><?php
echo
$pms_texts
[
'DELETE'
]; ?></option>
700.
<?php
701.
} ?>
702.
</select>
703.
<?php
704.
} ?>
705.
</div>
706.
<div
class
=
"col-md-6 text-right"
>
707.
<div
class
=
"input-group"
>
708.
<div
class
=
"input-group-addon"
><i
class
=
"fas fa-fw fa-th-list"
></i> <?php
echo
$pms_texts
[
'DISPLAY'
]; ?></div>
709.
<select
class
=
"select-url form-control input-sm"
>
710.
<?php
711.
echo
(
$limit
!= 20) ?
'<option value="index.php?view=list&limit=20">20</option>'
:
'<option selected="selected">20</option>'
;
712.
echo
(
$limit
!= 50) ?
'<option value="index.php?view=list&limit=50">50</option>'
:
'<option selected="selected">50</option>'
;
713.
echo
(
$limit
!= 100) ?
'<option value="index.php?view=list&limit=100">100</option>'
:
'<option selected="selected">100</option>'
; ?>
714.
</select>
715.
</div>
716.
717.
<?php
718.
if
(
$limit
> 0){
719.
$nb_pages
=
ceil
(
$total
/
$limit
);
720.
if
(
$nb_pages
> 1){ ?>
721.
<div
class
=
"input-group"
>
722.
<div
class
=
"input-group-addon"
><?php
echo
$pms_texts
[
'PAGE'
]; ?></div>
723.
<select
class
=
"select-url form-control input-sm"
>
724.
<?php
725.
726.
for
(
$i
= 1;
$i
<=
$nb_pages
;
$i
++){
727.
$offset2
= (
$i
-1)*
$limit
;
728.
729.
if
(
$offset2
==
$offset
)
730.
echo
'<option value="" selected="selected">'
.
$i
.
'</option>'
;
731.
else
732.
echo
'<option value="index.php?view=list&offset='
.
$offset2
.
'">'
.
$i
.
'</option>'
;
733.
} ?>
734.
</select>
735.
</div>
736.
<?php
737.
}
738.
} ?>
739.
</div>
740.
</div>
741.
</div>
742.
</div>
743.
<?php
744.
if
(in_array(
'all'
,
$permissions
)){
745.
if
(
$pms_db
!= false && MULTILINGUAL &&
$total_lang
> 0){ ?>
746.
<div
class
=
"well"
>
747.
<div id=
"translation"
>
748.
<p><?php
echo
$pms_texts
[
'COMPLETE_LANGUAGE'
]; ?></p>
749.
<?php
750.
foreach
(
$result_lang
as
$row_lang
){
751.
$id_lang
=
$row_lang
[
'id'
];
752.
$title_lang
=
$row_lang
[
'title'
]; ?>
753.
754.
<input type=
"checkbox"
name=
"languages[]"
value=
"<?php echo $id_lang; ?>"
>
755.
<?php
756.
$result_img_lang
=
$pms_db
->query(
'SELECT * FROM pm_lang_file WHERE id_item = '
.
$id_lang
.
' AND type = \'image\' AND file != \'\' ORDER BY `rank` LIMIT 1'
);
757.
if
(
$result_img_lang
!== false &&
$pms_db
->last_row_count() > 0){
758.
$row_img_lang
=
$result_img_lang
->fetch();
759.
760.
$id_img_lang
=
$row_img_lang
[
'id'
];
761.
$file_img_lang
=
$row_img_lang
[
'file'
];
762.
763.
if
(
is_file
(SYSBASE.
'medias/lang/big/'
.
$id_img_lang
.
'/'
.
$file_img_lang
))
764.
echo
'<img src="'
.DOCBASE.
'medias/lang/big/'
.
$id_img_lang
.
'/'
.
$file_img_lang
.
'" alt="" border="0" class="flag"> '
;
765.
}
766.
echo
$title_lang
.
'<br>'
;
767.
} ?>
768.
<button type=
"submit"
name=
"complete_lang"
class
=
"btn btn-default mt10"
data-toggle=
"tooltip"
data-placement=
"right"
title=
"<?php echo $pms_texts['COMPLETE_LANG_NOTICE']; ?>"
><i
class
=
"fas fa-fw fa-magic"
></i> <?php
echo
$pms_texts
[
'APPLY_LANGUAGE'
]; ?></button>
769.
</div>
770.
</div>
771.
<?php
772.
}
773.
}
774.
if
(
is_file
(
'custom_list.php'
))
include
(
'custom_list.php'
); ?>
775.
<?php
776.
}
else
echo
'<p>'
.
$pms_texts
[
'ACCESS_DENIED'
].
'</p>'
;
777.
} ?>
778.
</div>
779.
</form>
780.
</div>
781.
</div>
782.
</body>
783.
</html>
784.
<?php
785.
$_SESSION
[
'redirect'
] = false;
786.
$_SESSION
[
'msg_error'
] =
array
();
787.
$_SESSION
[
'msg_success'
] =
array
();
788.
$_SESSION
[
'msg_notice'
] =
array
(); ?>