Esempio n. 1
0
            $keywords[] = $keyword2;
        }
        if ($keyword3 != "") {
            $keywords[] = $keyword3;
        }
        if (sizeof($keywords) >= 1) {
            _generate_search_images($source, $keywords[0], True);
            $search_text = "(All) " . $keywords[0];
            for ($x = 1; $x < sizeof($keywords); $x++) {
                __query("TRUNCATE TABLE exhibit_" . $target, "", "");
                _generate_search_comparison($source, $keywords[$x], $target);
                $temp_table = $target;
                $target = $source;
                $source = $temp_table;
                $search_text .= ", " . $keywords[$x];
            }
        }
        // source will always contain final results due to for loop.
        $search_query = "SELECT * FROM exhibit_" . $source . " WHERE " . _user_permissions($__user['Username'], 'query') . " GROUP BY ImageID, iPhotoLibraryID LIMIT 1000";
        _display_search($search_query, $search_text);
        __query("DROP TABLE exhibit_" . $source, "", "");
        __query("DROP TABLE exhibit_" . $target, "", "");
    }
} elseif ($roll and $library) {
    _display_images($roll, $library, $__user['Username']);
} else {
    _display_rolls($__user['Username']);
}
_page_section("search.png", "Search for photos");
_draw_search_key();
_page_footer();
Esempio n. 2
0
function _display_rolls($username)
{
    global $__dbc;
    global $number_of_columns;
    global $image_src;
    global $rating;
    global $table_format;
    $query = "SELECT exhibit_Rolls.*, exhibit_Permissions.GroupID AS GroupID, " . "exhibit_Permissions.Public AS Public " . "FROM exhibit_Rolls LEFT JOIN exhibit_Permissions ON " . "(exhibit_Rolls.iPhotoLibraryID=exhibit_Permissions.iPhotoLibraryID AND" . " exhibit_Rolls.RollID=exhibit_Permissions.RollID) WHERE " . _user_permissions($username, 'query') . " ORDER BY RollDate DESC";
    $sql_results = __query($query, "", "");
    $process_results = array();
    echo $table_format;
    while ($row = mysql_fetch_array($sql_results)) {
        $query = "select GUID, ThumbPath from exhibit_Images where " . "iPhotoLibraryID = " . $row['iPhotoLibraryID'] . " AND " . "ImageID = " . $row['KeyPhoto'];
        $image = mysql_fetch_array(__query($query, "", ""));
        $image_thumb = $row['iPhotoLibraryID'] . $image["GUID"] . 'T.' . _find_file_extension($image["ThumbPath"]);
        $photo_count = "<span class=\"exhibitcontent\">" . $row["PhotoCount"];
        if ($row["PhotoCount"] == 1) {
            $photo_count .= " photo</span>";
        } else {
            $photo_count .= " photos</span>";
        }
        $process_results[] = array("<a href=\"http://www.example.com" . $_SERVER[PHP_SELF] . "?library=" . $row["iPhotoLibraryID"] . "&roll=" . $row["RollID"] . "\">" . "<img border=\"0\" class=\"exhibit\" src=\"" . $image_src . $image_thumb . "\" /></a>", "<span class=\"exhibitcontent\">" . $row["RollName"] . "</span>", "<span class=\"exhibitcontent\">" . $row["RollDate"] . "</span>", $photo_count);
        if (count($process_results) == $number_of_columns) {
            _print_row($process_results);
            unset($process_results);
            $process_results = array();
        }
    }
    if (count($process_results) != 0) {
        _print_row($process_results);
    }
    echo "\n\t\t\t\t\t</table>\n";
}