'unrated' rating
This commit is contained in:
parent
0ff11d71ed
commit
cffbaac039
@ -55,7 +55,7 @@ class Ratings implements Extension {
|
|||||||
$privs = array();
|
$privs = array();
|
||||||
$privs['Safe Only'] = 's';
|
$privs['Safe Only'] = 's';
|
||||||
$privs['Safe and Questionable'] = 'sq';
|
$privs['Safe and Questionable'] = 'sq';
|
||||||
$privs['All'] = 'sqe';
|
$privs['All'] = 'sqeu';
|
||||||
|
|
||||||
$sb = new SetupBlock("Image Ratings");
|
$sb = new SetupBlock("Image Ratings");
|
||||||
$sb->add_choice_option("ext_rating_anon_privs", $privs, "Anonymous: ");
|
$sb->add_choice_option("ext_rating_anon_privs", $privs, "Anonymous: ");
|
||||||
@ -98,7 +98,7 @@ class Ratings implements Extension {
|
|||||||
|
|
||||||
private function no_rating_query($context) {
|
private function no_rating_query($context) {
|
||||||
foreach($context as $term) {
|
foreach($context as $term) {
|
||||||
if(preg_match("/rating=([sqe]+)/", $term)) {
|
if(preg_match("/^rating=([sqeu]+)$/", $term)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -110,14 +110,20 @@ class Ratings implements Extension {
|
|||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
if($config->get_int("ext_ratings2_version") < 1) {
|
if($config->get_int("ext_ratings2_version") < 1) {
|
||||||
$database->Execute("ALTER TABLE images ADD COLUMN rating ENUM('s', 'q', 'e') NOT NULL DEFAULT 'q'");
|
$database->Execute("ALTER TABLE images ADD COLUMN rating CHAR(1) NOT NULL DEFAULT 'u'");
|
||||||
$config->set_int("ext_ratings2_version", 1);
|
$database->Execute("CREATE INDEX images__rating ON images(rating)");
|
||||||
|
$config->set_int("ext_ratings2_version", 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
if($config->get_int("ext_ratings2_version") < 2) {
|
if($config->get_int("ext_ratings2_version") < 2) {
|
||||||
$database->Execute("CREATE INDEX images__rating ON images(rating)");
|
$database->Execute("CREATE INDEX images__rating ON images(rating)");
|
||||||
$config->set_int("ext_ratings2_version", 2);
|
$config->set_int("ext_ratings2_version", 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if($config->get_int("ext_ratings2_version") < 3) {
|
||||||
|
$database->Execute("ALTER TABLE images CHANGE rating rating CHAR(1) NOT NULL DEFAULT 'u'");
|
||||||
|
$config->set_int("ext_ratings2_version", 3);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private function set_rating($image_id, $rating) {
|
private function set_rating($image_id, $rating) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user