functioning

This commit is contained in:
Shish 2012-02-09 15:17:11 +00:00
parent f9c1f8229c
commit 6e8970b15d

View File

@ -65,7 +65,6 @@ class ViewImageTheme extends Themelet {
$owner = $image->get_owner(); $owner = $image->get_owner();
$h_owner = html_escape($owner->name); $h_owner = html_escape($owner->name);
$h_ip = html_escape($image->owner_ip); $h_ip = html_escape($image->owner_ip);
$h_source = html_escape($image->source);
$i_owner_id = int_escape($owner->id); $i_owner_id = int_escape($owner->id);
$h_date = autodate($image->posted); $h_date = autodate($image->posted);
@ -75,26 +74,30 @@ class ViewImageTheme extends Themelet {
if($user->can("view_ip")) { if($user->can("view_ip")) {
$html .= " ($h_ip)"; $html .= " ($h_ip)";
} }
if(!is_null($image->source)) { $html .= $this->format_source($image->source);
if(substr($image->source, 0, 7) == "http://" || substr($image->source, 0, 8) == "https://") {
$html .= " (<a href='$h_source'>source</a>)";
}
else {
$html .= " (<a href='http://$h_source'>source</a>)";
}
}
$html .= $this->build_image_editor($image, $editor_parts); $html .= $this->build_image_editor($image, $editor_parts);
return $html; return $html;
} }
private function format_source($source) {
if(!is_null($source)) {
$h_source = html_escape($source);
if(startsWith($source, "http://") || startsWith($source, "https://")) {
return " (<a href='$h_source'>source</a>)";
}
else {
return " (<a href='http://$h_source'>source</a>)";
}
}
return "";
}
protected function build_image_editor(Image $image, $editor_parts) { protected function build_image_editor(Image $image, $editor_parts) {
if(count($editor_parts) == 0) return ($image->is_locked() ? "<br>[Image Locked]" : ""); if(count($editor_parts) == 0) return ($image->is_locked() ? "<br>[Image Locked]" : "");
$html = " $html = make_form(make_link("post/set"))."
<div id='imgdata'>
".make_form(make_link("post/set"))."
<input type='hidden' name='image_id' value='{$image->id}'> <input type='hidden' name='image_id' value='{$image->id}'>
<table style='width: 500px;'> <table style='width: 500px;'>
"; ";
@ -105,8 +108,6 @@ class ViewImageTheme extends Themelet {
<tr><td colspan='2'><input type='submit' value='Set'></td></tr> <tr><td colspan='2'><input type='submit' value='Set'></td></tr>
</table> </table>
</form> </form>
<br>
</div>
"; ";
return $html; return $html;
} }