PHP is shit. MySQL is also shit.
This commit is contained in:
parent
b57a2d2121
commit
e9fedb570a
@ -113,6 +113,15 @@ class TagList implements Extension {
|
|||||||
return $config->get_int('tags_min');
|
return $config->get_int('tags_min');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function get_starts_with() {
|
||||||
|
if(isset($_GET['starts_with'])) {
|
||||||
|
return $_GET['starts_with'];
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
}
|
||||||
// }}}
|
// }}}
|
||||||
// maps {{{
|
// maps {{{
|
||||||
private function build_navigation() {
|
private function build_navigation() {
|
||||||
@ -129,7 +138,7 @@ class TagList implements Extension {
|
|||||||
global $database;
|
global $database;
|
||||||
|
|
||||||
$tags_min = $this->get_tags_min();
|
$tags_min = $this->get_tags_min();
|
||||||
$starts_with = @$_GET['starts_with'] || "a";
|
$starts_with = $this->get_starts_with();
|
||||||
$cache_key = "data/tag_cloud-"+md5($tags_min + $starts_with)+".html";
|
$cache_key = "data/tag_cloud-"+md5($tags_min + $starts_with)+".html";
|
||||||
if(file_exists($cache_key)) {return file_get_contents($cache_key);}
|
if(file_exists($cache_key)) {return file_get_contents($cache_key);}
|
||||||
|
|
||||||
@ -139,9 +148,9 @@ class TagList implements Extension {
|
|||||||
FLOOR(LOG(2.7, LOG(2.7, count - :tags_min + 1)+1)*1.5*100)/100 AS scaled
|
FLOOR(LOG(2.7, LOG(2.7, count - :tags_min + 1)+1)*1.5*100)/100 AS scaled
|
||||||
FROM tags
|
FROM tags
|
||||||
WHERE count >= :tags_min
|
WHERE count >= :tags_min
|
||||||
AND tag ILIKE :starts_with
|
AND tag LIKE :starts_with
|
||||||
ORDER BY tag
|
ORDER BY tag
|
||||||
", array("tags_min"=>$tags_min, "starts_with"=>$starts_with+"%"));
|
", array("tags_min"=>$tags_min, "starts_with"=>$starts_with));
|
||||||
|
|
||||||
$html = "";
|
$html = "";
|
||||||
foreach($tag_data as $row) {
|
foreach($tag_data as $row) {
|
||||||
@ -162,7 +171,7 @@ class TagList implements Extension {
|
|||||||
global $database;
|
global $database;
|
||||||
|
|
||||||
$tags_min = $this->get_tags_min();
|
$tags_min = $this->get_tags_min();
|
||||||
$starts_with = @$_GET['starts_with'] || "a";
|
$starts_with = $this->get_starts_with();
|
||||||
$cache_key = "data/tag_alpha-"+md5($tags_min + $starts_with)+".html";
|
$cache_key = "data/tag_alpha-"+md5($tags_min + $starts_with)+".html";
|
||||||
if(file_exists($cache_key)) {return file_get_contents($cache_key);}
|
if(file_exists($cache_key)) {return file_get_contents($cache_key);}
|
||||||
|
|
||||||
@ -170,9 +179,9 @@ class TagList implements Extension {
|
|||||||
SELECT tag, count
|
SELECT tag, count
|
||||||
FROM tags
|
FROM tags
|
||||||
WHERE count >= :tags_min
|
WHERE count >= :tags_min
|
||||||
AND tag ILIKE :starts_with
|
AND tag LIKE :starts_with
|
||||||
ORDER BY tag
|
ORDER BY tag
|
||||||
", array("tags_min"=>$tags_min, "starts_with"=>$starts_with+"%"));
|
", array("tags_min"=>$tags_min, "starts_with"=>$starts_with));
|
||||||
|
|
||||||
$html = "";
|
$html = "";
|
||||||
$lastLetter = "";
|
$lastLetter = "";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user