summaryrefslogtreecommitdiffstats
path: root/phpfspot.class.php
diff options
context:
space:
mode:
Diffstat (limited to 'phpfspot.class.php')
-rw-r--r--phpfspot.class.php71
1 files changed, 48 insertions, 23 deletions
diff --git a/phpfspot.class.php b/phpfspot.class.php
index f3f78a7..b82efa5 100644
--- a/phpfspot.class.php
+++ b/phpfspot.class.php
@@ -428,7 +428,7 @@ class PHPFSPOT {
else
{
$result = $this->db->db_query("
- SELECT id,name
+ SELECT id as id,name as name
FROM tags
ORDER BY sort_priority ASC
");
@@ -481,23 +481,40 @@ class PHPFSPOT {
/* ~ F-Spot version 0.3.x */
if($this->dbver < 9) {
$query_str = "
- SELECT p.id, p.name, p.time, p.directory_path, p.description
- FROM photos p
+ SELECT
+ p.id as id,
+ p.name as name,
+ p.time as time,
+ p.directory_path as directory_path,
+ p.description as description
+ FROM
+ photos p
";
}
else {
/* till F-Spot version 0.4.1 */
if($this->dbver < 11) {
$query_str = "
- SELECT p.id, p.uri, p.time, p.description
- FROM photos p
+ SELECT
+ p.id as id,
+ p.uri as uri,
+ p.time as time,
+ p.description as description
+ FROM
+ photos p
";
}
else {
/* rating value got introduced */
$query_str = "
- SELECT p.id, p.uri, p.time, p.description, p.rating
- FROM photos p
+ SELECT
+ p.id as id,
+ p.uri as uri,
+ p.time as time,
+ p.description as description,
+ p.rating as rating
+ FROM
+ photos p
";
}
}
@@ -1192,7 +1209,7 @@ class PHPFSPOT {
* @return array
*/
public function getPhotoSelection()
- {
+ {
$matched_photos = Array();
$additional_where_cond = "";
@@ -1258,8 +1275,10 @@ class PHPFSPOT {
/* return a search result */
if(isset($_SESSION['searchfor_tag']) && $_SESSION['searchfor_tag'] != '') {
$query_str = "
- SELECT DISTINCT pt1.photo_id
- FROM photo_tags pt1
+ SELECT DISTINCT
+ pt1.photo_id as photo_id
+ FROM
+ photo_tags pt1
INNER JOIN photo_tags pt2
ON pt1.photo_id=pt2.photo_id
INNER JOIN tags t
@@ -1297,8 +1316,10 @@ class PHPFSPOT {
/* photo has to match at least on of the selected tags */
if($_SESSION['tag_condition'] == 'or') {
$query_str = "
- SELECT DISTINCT pt1.photo_id
- FROM photo_tags pt1
+ SELECT DISTINCT
+ pt1.photo_id as photo_id
+ FROM
+ photo_tags pt1
INNER JOIN photo_tags pt2
ON pt1.photo_id=pt2.photo_id
INNER JOIN tags t
@@ -1336,8 +1357,10 @@ class PHPFSPOT {
*/
$query_str = "
- SELECT DISTINCT pt1.photo_id
- FROM photo_tags pt1
+ SELECT DISTINCT
+ pt1.photo_id as photo_id
+ FROM
+ photo_tags pt1
";
if(isset($this->cfg->show_tags) && !empty($this->cfg->show_tags)) {
@@ -1384,8 +1407,10 @@ class PHPFSPOT {
/* return all available photos */
$query_str = "
- SELECT DISTINCT p.id
- FROM photos p
+ SELECT DISTINCT
+ p.id as id
+ FROM
+ photos p
LEFT JOIN photo_tags pt
ON p.id=pt.photo_id
LEFT JOIN tags t
@@ -2440,7 +2465,7 @@ class PHPFSPOT {
private function get_photo_tags($idx)
{
$result = $this->db->db_query("
- SELECT t.id, t.name
+ SELECT t.id as id, t.name as name
FROM tags t
INNER JOIN photo_tags pt
ON t.id=pt.tag_id
@@ -3107,7 +3132,7 @@ class PHPFSPOT {
$all = Array();
$query_str = "
- SELECT p.id
+ SELECT p.id as id
FROM photos p
";
@@ -3171,7 +3196,7 @@ class PHPFSPOT {
else {
$query_str = "
SELECT
- p.id
+ p.id as id
FROM
photos p
INNER JOIN photo_tags pt
@@ -3504,14 +3529,14 @@ class PHPFSPOT {
$to_delete = Array();
$result = $this->cfg_db->db_query("
- SELECT img_idx
+ SELECT img_idx as img_idx
FROM images
ORDER BY img_idx ASC
");
while($row = $this->cfg_db->db_fetch_object($result)) {
if(!$this->db->db_fetchSingleRow("
- SELECT id
+ SELECT id as id
FROM photos
WHERE id='". $row['img_idx'] ."'")) {
@@ -3590,7 +3615,7 @@ class PHPFSPOT {
public function get_tag_name($idx)
{
if($result = $this->db->db_fetchSingleRow("
- SELECT name
+ SELECT name as name
FROM tags
WHERE
id LIKE '". $idx ."'")) {
@@ -3697,7 +3722,7 @@ class PHPFSPOT {
public function get_db_version()
{
if($row = $this->cfg_db->db_fetchSingleRow("
- SELECT meta_value
+ SELECT meta_value as meta_value
FROM
meta
WHERE