Merge pull request #100 from dixy/patch-1
Use fetch_assoc instead of fetch_array
This commit is contained in:
commit
7de8b3074c
@ -146,7 +146,7 @@ function getAlbum($albumID) {
|
|||||||
$result = $database->query($query);
|
$result = $database->query($query);
|
||||||
$previousPhotoID = "";
|
$previousPhotoID = "";
|
||||||
$i = 0;
|
$i = 0;
|
||||||
while($row = $result->fetch_array()) {
|
while($row = $result->fetch_assoc()) {
|
||||||
|
|
||||||
$return['content'][$row['id']]['id'] = $row['id'];
|
$return['content'][$row['id']]['id'] = $row['id'];
|
||||||
$return['content'][$row['id']]['title'] = $row['title'];
|
$return['content'][$row['id']]['title'] = $row['title'];
|
||||||
|
@ -47,7 +47,7 @@ function search($term) {
|
|||||||
|
|
||||||
// Photos
|
// Photos
|
||||||
$result = $database->query("SELECT id, title, tags, sysdate, public, star, album, thumbUrl FROM lychee_photos WHERE title like '%$term%' OR description like '%$term%' OR tags like '%$term%';");
|
$result = $database->query("SELECT id, title, tags, sysdate, public, star, album, thumbUrl FROM lychee_photos WHERE title like '%$term%' OR description like '%$term%' OR tags like '%$term%';");
|
||||||
while($row = $result->fetch_array()) {
|
while($row = $result->fetch_assoc()) {
|
||||||
$return['photos'][$row['id']] = $row;
|
$return['photos'][$row['id']] = $row;
|
||||||
$return['photos'][$row['id']]['sysdate'] = date('d F Y', strtotime($row['sysdate']));
|
$return['photos'][$row['id']]['sysdate'] = date('d F Y', strtotime($row['sysdate']));
|
||||||
}
|
}
|
||||||
|
@ -15,14 +15,14 @@ function getPhoto($photoID, $albumID) {
|
|||||||
|
|
||||||
$query = "SELECT * FROM lychee_photos WHERE id = '$photoID' LIMIT 1;";
|
$query = "SELECT * FROM lychee_photos WHERE id = '$photoID' LIMIT 1;";
|
||||||
$result = $database->query($query);
|
$result = $database->query($query);
|
||||||
$return = $result->fetch_array();
|
$return = $result->fetch_assoc();
|
||||||
|
|
||||||
if ($albumID!='false') {
|
if ($albumID!='false') {
|
||||||
|
|
||||||
if ($return['album']!=0) {
|
if ($return['album']!=0) {
|
||||||
|
|
||||||
$result = $database->query("SELECT public FROM lychee_albums WHERE id = '" . $return['album'] . "';");
|
$result = $database->query("SELECT public FROM lychee_albums WHERE id = '" . $return['album'] . "';");
|
||||||
$return_album = $result->fetch_array();
|
$return_album = $result->fetch_assoc();
|
||||||
if ($return_album['public']=="1") $return['public'] = "2";
|
if ($return_album['public']=="1") $return['public'] = "2";
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -36,11 +36,6 @@ function getPhoto($photoID, $albumID) {
|
|||||||
|
|
||||||
unset($return['album_public']);
|
unset($return['album_public']);
|
||||||
|
|
||||||
// Remove unused items
|
|
||||||
foreach ($return as $key => $value) {
|
|
||||||
if (is_int($key)) unset($return[$key]);
|
|
||||||
}
|
|
||||||
|
|
||||||
return $return;
|
return $return;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user