Файл: system/AJAX/php/avatar_photos_list.php
Строк: 26
<?php
FOREACH (ARRAY('config', 'connect', 'users') AS $connect) {
INCLUDE_ONCE ("../../../system/connections/global/$connect.php");
}
ACCESS('users');
IF (!EMPTY(HTTP_X_REQUESTED_WITH) && STRTOLOWER(HTTP_X_REQUESTED_WITH) == 'xmlhttprequest' || !EMPTY(HTTP_X_REQUESTED_WITH) && STRTOLOWER(HTTP_X_REQUESTED_WITH) == 'XMLHttpRequest'){
$countView = INTVAL(POST('count_add')); // количество записей, получаемых за один раз
$startIndex = INTVAL(POST('count_show')); // с какой записи начать выборку
$data = DB::GET_STRING_ALL("SELECT * FROM `PHOTOS` WHERE `USER_ID` = '".$user['ID']."' ORDER BY `TIME` DESC LIMIT ".$startIndex.", ".$countView."");
WHILE ($list = $data->FETCH()){
$photo[] = $list;
}
IF (EMPTY($photo)){
ECHO JSON_ENCODE(ARRAY(
'result' => 'finish'
));
}ELSE{
$html = NULL;
FOREACH($photo AS $onePhoto){
$html .= "<li class='photos-wrapper-avatar'>
<a href='/id".$user['ID']."?avatar_upgrade=".$onePhoto['ID']."' class='photos-avatar'>
<span class='avatar-choose'><i class='fa fa-plus fa-lg'></i></span>
<img src='/photo/150x150/{$onePhoto['ID_DIR']}/{$onePhoto['ID']}/' style='max-width: 100%; position: absolute;'>
</a></li>";
}
ECHO JSON_ENCODE(ARRAY(
'result' => 'success',
'html' => $html
));
}
}ELSE{
REDIRECT('/index');
}
?>