build_thumb moved to common utils
git-svn-id: file:///home/shish/svn/shimmie2/trunk@16 7f39781d-f577-437e-ae19-be835c7a54ca
This commit is contained in:
parent
c11a6484b8
commit
6e90eed812
2 changed files with 30 additions and 14 deletions
|
@ -116,7 +116,7 @@ class Index extends Extension {
|
||||||
for($j=0; $j<$width; $j++) {
|
for($j=0; $j<$width; $j++) {
|
||||||
$image = isset($images[$i*$width+$j]) ? $images[$i*$width+$j] : null;
|
$image = isset($images[$i*$width+$j]) ? $images[$i*$width+$j] : null;
|
||||||
if(!is_null($image)) {
|
if(!is_null($image)) {
|
||||||
$table .= $this->build_thumb($image, $query);
|
$table .= build_thumb($image, $query);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$table .= "\t<td> </td>\n";
|
$table .= "\t<td> </td>\n";
|
||||||
|
@ -128,16 +128,6 @@ class Index extends Extension {
|
||||||
|
|
||||||
return $table;
|
return $table;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function build_thumb($image, $query=null) {
|
|
||||||
global $config;
|
|
||||||
$h_view_link = make_link("post/view/{$image->id}", $query);
|
|
||||||
$h_tip = html_escape($image->get_tooltip());
|
|
||||||
$h_thumb_link = $image->get_thumb_link();
|
|
||||||
$tsize = get_thumbnail_size($image->width, $image->height);
|
|
||||||
return "<td><a href='$h_view_link'><img title='$h_tip' alt='$h_tip'
|
|
||||||
width='{$tsize[0]}' height='{$tsize[1]}' src='$h_thumb_link'></a></td>\n";
|
|
||||||
}
|
|
||||||
// }}}
|
// }}}
|
||||||
// rss {{{
|
// rss {{{
|
||||||
private function do_rss() {
|
private function do_rss() {
|
||||||
|
|
|
@ -91,13 +91,25 @@ function get_memory_limit() {
|
||||||
function bbcode2html($text) {
|
function bbcode2html($text) {
|
||||||
$text = trim($text);
|
$text = trim($text);
|
||||||
$text = html_escape($text);
|
$text = html_escape($text);
|
||||||
# $text = preg_replace("/\[b\](.*?)\[\/b\]/s", "<b>\\1</b>", $text);
|
$text = preg_replace("/\[b\](.*?)\[\/b\]/s", "<b>\\1</b>", $text);
|
||||||
# $text = preg_replace("/\[i\](.*?)\[\/i\]/s", "<i>\\1</i>", $text);
|
$text = preg_replace("/\[i\](.*?)\[\/i\]/s", "<i>\\1</i>", $text);
|
||||||
# $text = preg_replace("/\[u\](.*?)\[\/u\]/s", "<u>\\1</u>", $text);
|
$text = preg_replace("/\[u\](.*?)\[\/u\]/s", "<u>\\1</u>", $text);
|
||||||
|
$text = preg_replace("/\[\[(.*?)\]\]/s",
|
||||||
|
"<a href='".make_link("wiki/\\1")."'>\\1</a>", $text);
|
||||||
$text = str_replace("\n", "\n<br>", $text);
|
$text = str_replace("\n", "\n<br>", $text);
|
||||||
return $text;
|
return $text;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function strip_bbcode($text) {
|
||||||
|
$text = trim($text);
|
||||||
|
$text = html_escape($text);
|
||||||
|
$text = preg_replace("/\[b\](.*?)\[\/b\]/s", "\\1", $text);
|
||||||
|
$text = preg_replace("/\[i\](.*?)\[\/i\]/s", "\\1", $text);
|
||||||
|
$text = preg_replace("/\[u\](.*?)\[\/u\]/s", "\\1", $text);
|
||||||
|
$text = preg_replace("/\[\[(.*?)\]\]/s", "\\1", $text);
|
||||||
|
return $text;
|
||||||
|
}
|
||||||
|
|
||||||
function tag_explode($tags) {
|
function tag_explode($tags) {
|
||||||
if(is_string($tags)) {
|
if(is_string($tags)) {
|
||||||
$tags = explode(' ', $tags);
|
$tags = explode(' ', $tags);
|
||||||
|
@ -124,6 +136,9 @@ function tag_explode($tags) {
|
||||||
return $tag_array;
|
return $tag_array;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function sql_quote($text) {
|
||||||
|
return '"'.sql_escape($text).'"';
|
||||||
|
}
|
||||||
|
|
||||||
function get_thumbnail_size($orig_width, $orig_height) {
|
function get_thumbnail_size($orig_width, $orig_height) {
|
||||||
global $config;
|
global $config;
|
||||||
|
@ -142,6 +157,17 @@ function get_thumbnail_size($orig_width, $orig_height) {
|
||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function build_thumb($image, $query=null) {
|
||||||
|
global $config;
|
||||||
|
$h_view_link = make_link("post/view/{$image->id}", $query);
|
||||||
|
$h_tip = html_escape($image->get_tooltip());
|
||||||
|
$h_thumb_link = $image->get_thumb_link();
|
||||||
|
$tsize = get_thumbnail_size($image->width, $image->height);
|
||||||
|
return "<td><a href='$h_view_link'><img title='$h_tip' alt='$h_tip'
|
||||||
|
width='{$tsize[0]}' height='{$tsize[1]}' src='$h_thumb_link'></a></td>\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# $db is the connection object
|
# $db is the connection object
|
||||||
function CountExecs($db, $sql, $inputarray) {
|
function CountExecs($db, $sql, $inputarray) {
|
||||||
|
|
Reference in a new issue