Merge branch 'master' into speed_tweaks
This commit is contained in:
@ -106,18 +106,26 @@ class Image {
|
||||
|
||||
/**
|
||||
* Search for an array of images
|
||||
*
|
||||
* @retval Array
|
||||
*/
|
||||
public static function find_images($start, $limit, $tags=array()) {
|
||||
public static function find_images(/*int*/ $start, /*int*/ $limit, $tags=array()) {
|
||||
assert(is_numeric($start));
|
||||
assert(is_numeric($limit));
|
||||
assert(is_array($tags));
|
||||
global $database;
|
||||
global $database, $user;
|
||||
|
||||
$images = array();
|
||||
|
||||
if($start < 0) $start = 0;
|
||||
if($limit < 1) $limit = 1;
|
||||
|
||||
if(SPEED_HAX) {
|
||||
if(!$user->can("big_search") and count($tags) > 3) {
|
||||
die("Anonymous users may only search for up to 3 tags at a time"); // FIXME: throw an exception?
|
||||
}
|
||||
}
|
||||
|
||||
$querylet = Image::build_search_querylet($tags);
|
||||
$querylet->append(new Querylet("ORDER BY images.id DESC LIMIT :limit OFFSET :offset", array("limit"=>$limit, "offset"=>$start)));
|
||||
#var_dump($querylet->sql); var_dump($querylet->variables);
|
||||
@ -377,7 +385,7 @@ class Image {
|
||||
/**
|
||||
* Set the image's source URL
|
||||
*/
|
||||
public function set_source($source) {
|
||||
public function set_source(/*string*/ $source) {
|
||||
global $database;
|
||||
if(empty($source)) $source = null;
|
||||
if($source != $this->source) {
|
||||
@ -386,7 +394,10 @@ class Image {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Check if the image is locked.
|
||||
* @retval bool
|
||||
*/
|
||||
public function is_locked() {
|
||||
return ($this->locked === true || $this->locked == "Y" || $this->locked == "t");
|
||||
}
|
||||
|
Reference in New Issue
Block a user