function _photos_filter_process in Album Photos 6.2
Same name and namespace in other branches
- 8.5 photos.module \_photos_filter_process()
- 8.4 photos.module \_photos_filter_process()
- 7.3 photos.module \_photos_filter_process()
- 6.0.x photos.module \_photos_filter_process()
1 string reference to '_photos_filter_process'
File
- ./
photos.module, line 1620
Code
function _photos_filter_process($mat) {
if ($mat[1] == 'image' || $mat[1] == 'album') {
$algin = array(
'left' => 'photos_filter_left',
'right' => 'photos_filter_right',
'center' => 'photos_filter_center',
);
$array = explode('|', $mat[2]);
if (is_array($array)) {
foreach ($array as $setting) {
$t = explode('=', $setting);
$set[$t[0]] = $t[1];
}
}
$set['link'] = 1;
if ($set['id']) {
if (preg_match('/[^\\d,]/i', $set['id'])) {
return;
}
else {
if (!strstr($set['id'], ',')) {
if ($mat[1] == 'image') {
$value = photos_get_info($set['id'], 0, $set);
}
else {
$album = db_fetch_object(db_query('SELECT p.pid, p.fid FROM {x_album} p WHERE pid = %d', $set['id']));
if ($album->pid) {
if ($set['limit'] && intval($set['limit']) == $set['limit']) {
$limit = $set['limit'] > 10 ? 10 : $set['limit'];
$result = db_query_range('SELECT f.fid, f.filepath, f.filename FROM {files} f INNER JOIN {x_image} p ON f.fid = p.fid WHERE p.pid = %d ORDER BY f.fid DESC', $album->pid, 0, $limit);
while ($image = db_fetch_array($result)) {
$value .= photos_get_info(0, $image, $set);
}
}
else {
if ($album->fid) {
$set['link'] = 0;
$set['href'] = 'photos/album/' . $album->pid;
$value = photos_get_info($album->fid, 0, $set);
}
else {
$set['link'] = 0;
$set['href'] = 'photos/album/' . $album->pid;
$image = db_fetch_array(db_query_range('SELECT f.fid, f.filepath, f.filename FROM {files} f INNER JOIN {x_image} p ON f.fid = p.fid WHERE p.pid = %d ORDER BY f.fid DESC', $album->pid, 0, 1));
$value = photos_get_info(0, $image, $set);
}
}
}
}
}
else {
if ($mat[1] == 'image') {
$result = db_query('SELECT fid, filepath, filename FROM {files} WHERE fid IN (' . $set['id'] . ')');
while ($image = db_fetch_array($result)) {
$value .= photos_get_info(0, $image, $set);
}
}
}
}
if ($value) {
$output = $algin[$set['algin']] ? '<div class="' . $algin[$set['algin']] . '">' : '';
$output .= $value;
$output .= $algin[$set['algin']] ? '</div>' : '';
return $output;
}
}
}
}