Vanilla 1.1.10 is a product of Lussumo. More Information: Documentation, Community Support.
function get_caption_filename($row, $extension = true) {
// Check for caption, use this instead of filename if it exists!
if (!empty($row["caption"]) > 0) {
$picture_name = $row["caption"];
} else {
$picture_name = basename($row["path"]);
if ($extension === false) {
$picture_name = substr($picture_name, 0, -4);
}
}
return $picture_name;
}
} else if ($level == "picture") {
$pic = get_picture_by_id($id);
$album = $pic["parent_album"];
$rv = $config["baseurl"].$pic["path"];
}
} else if ($level == "picture") {
$pic = get_picture_by_id($id);
$album = get_album_by_id($pic["parent_album"]);
$collection = get_collection_by_id($pic["parent_collection"]);
$rv = $config['baseurl'].$collection['path'].'/'.$album['path'].'/'.sanitize_filename(get_caption_filename($pic, false))."/";
}
if (!empty($names["picture"])) {
$sql = "SELECT *
FROM `".TABLE_PREFIX."pictures`
WHERE `caption`='".mysql_real_escape_string($names["picture"])."'
AND `parent_album`=".intval($album["id"]);
$result = run_query($sql);
if (!empty($names["picture"])) {
$sql = "SELECT *
FROM `".TABLE_PREFIX."pictures`
WHERE `caption` LIKE '".mysql_real_escape_string($names["picture"])."'
AND `parent_album`=".intval($album["id"]);
$result = run_query($sql);
function sanitize_filename($str) {
// allow only alphanumeric characters, hyphen, [, ], dot in file names
// the rest will be replaced
$str = preg_replace(array("/['|\"]/", "/[^\w|\.|\-|\[|\]]/"), array("", "-"), $str);
return $str;
}
if (!empty($names["picture"])) {
$sql = "SELECT *
FROM `".TABLE_PREFIX."pictures`
WHERE `caption`='".mysql_real_escape_string($names["picture"])."'
AND `parent_album`=".intval($album["id"]);
$result = run_query($sql);
if (!empty($names["picture"])) {
$sql = "SELECT *
FROM `".TABLE_PREFIX."pictures`
WHERE `caption` LIKE '".mysql_real_escape_string(str_replace("-", "_", $names["picture"]))."'
AND `parent_album`=".intval($album["id"]);
$result = run_query($sql);
1 to 13 of 13