commit
036939eea4
@ -97,29 +97,50 @@ class ShimmieApi extends Extension {
|
||||
|
||||
if($event->page_matches("api/shimmie/get_user")) {
|
||||
$query = $user->id;
|
||||
$type = "id";
|
||||
if($event->count_args() == 1) {
|
||||
$query = $event->get_arg(0);
|
||||
}
|
||||
if(isset($_GET['name'])) {
|
||||
$query = $_GET['name'];
|
||||
}
|
||||
if(isset($_GET['id'])) {
|
||||
elseif(isset($_GET['id'])) {
|
||||
$query = $_GET['id'];
|
||||
}
|
||||
elseif(isset($_GET['name'])) {
|
||||
$query = $_GET['name'];
|
||||
$type = "name";
|
||||
}
|
||||
|
||||
$all = $database->get_row(
|
||||
"SELECT id,name,joindate,class FROM users WHERE name=? OR id=?",
|
||||
array($_GET['name'], int_escape($_GET['id'])));
|
||||
"SELECT id,name,joindate,class FROM users WHERE ".$type."=?",
|
||||
array($query));
|
||||
|
||||
//FIXME?: For some weird reason, get_all seems to return twice. Unsetting second value to make things look nice..
|
||||
// - it returns data as eg array(0=>1234, 'id'=>1234, 1=>'bob', 'name'=>bob, ...);
|
||||
for($i=0; $i<4; $i++) unset($all[$i]);
|
||||
$all['uploadcount'] = Image::count_images(array("user_id=".$all['id']));
|
||||
$all['uploadperday'] = sprintf("%.1f", ($all['uploadcount'] / (((time() - strtotime($all['joindate'])) / 86400) + 1)));
|
||||
$all['commentcount'] = $database->get_one(
|
||||
"SELECT COUNT(*) AS count FROM comments WHERE owner_id=:owner_id",
|
||||
array("owner_id"=>$all['id']));
|
||||
$all['commentperday'] = sprintf("%.1f", ($all['commentcount'] / (((time() - strtotime($all['joindate'])) / 86400) + 1)));
|
||||
if(!empty($all)){
|
||||
//FIXME?: For some weird reason, get_all seems to return twice. Unsetting second value to make things look nice..
|
||||
// - it returns data as eg array(0=>1234, 'id'=>1234, 1=>'bob', 'name'=>bob, ...);
|
||||
for($i=0; $i<4; $i++) unset($all[$i]);
|
||||
$all['uploadcount'] = Image::count_images(array("user_id=".$all['id']));
|
||||
$all['commentcount'] = $database->get_one(
|
||||
"SELECT COUNT(*) AS count FROM comments WHERE owner_id=:owner_id",
|
||||
array("owner_id"=>$all['id']));
|
||||
|
||||
if(isset($_GET['recent'])){
|
||||
$recent = $database->get_all(
|
||||
"SELECT * FROM images WHERE owner_id=? ORDER BY id DESC LIMIT 0, 5",
|
||||
array($all['id']));
|
||||
|
||||
$i = 0;
|
||||
foreach($recent as $all['recentposts'][$i]){
|
||||
unset($all['recentposts'][$i]['owner_id']); //We already know the owners id..
|
||||
unset($all['recentposts'][$i]['owner_ip']);
|
||||
|
||||
for($x=0; $x<14; $x++) unset($all['recentposts'][$i][$x]);
|
||||
if(empty($all['recentposts'][$i]['author'])) unset($all['recentposts'][$i]['author']);
|
||||
if($all['recentposts'][$i]['notes'] > 0) $all['recentposts'][$i]['has_notes'] = "Y";
|
||||
else $all['recentposts'][$i]['has_notes'] = "N";
|
||||
unset($all['recentposts'][$i]['notes']);
|
||||
$i += 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
$page->set_data(json_encode($all));
|
||||
}
|
||||
}
|
||||
|
@ -27,6 +27,14 @@ class Tag_HistoryTheme extends Themelet {
|
||||
$setter = "<a href='".make_link("user/".url_escape($name))."'>".html_escape($name)."</a>$h_ip";
|
||||
|
||||
$selected = ($n == 2) ? " checked" : "";
|
||||
|
||||
$current_tags = explode(" ", $current_tags);
|
||||
$taglinks = array();
|
||||
foreach($current_tags as $tag){
|
||||
$taglinks[] = "<a href='".make_link("post/list/".$tag."/1")."'>".$tag."</a>";
|
||||
}
|
||||
$current_tags = implode(" ", $taglinks);
|
||||
|
||||
$history_list .= "
|
||||
<li>
|
||||
<input type='radio' name='revert' id='$current_id' value='$current_id'$selected>
|
||||
|
@ -1,10 +1,14 @@
|
||||
$(function() {
|
||||
var blocked_tags = ($.cookie("ui-blocked-tags") || $.cookie("blocked-tags") || "").split(" ");
|
||||
var themecheck = $(".thumb[data-tags~='tagme']").parent().attr('class');
|
||||
var needs_refresh = false;
|
||||
for(i in blocked_tags) {
|
||||
var tag = blocked_tags[i];
|
||||
if(tag) {
|
||||
$(".thumb[data-tags~='"+tag+"']").hide();
|
||||
if(themecheck == "thumbblock") {
|
||||
$(".thumb[data-tags~='tagme']").parent().height(0); //required for lite theme
|
||||
}
|
||||
needs_refresh = true;
|
||||
}
|
||||
}
|
||||
|
@ -70,7 +70,7 @@ a.tab:hover, a.tab:active, .tab-selected {
|
||||
-moz-border-radius:4px;
|
||||
-webkit-border-radius:4px;
|
||||
}
|
||||
.highlighted {
|
||||
.lazy{
|
||||
background:none repeat scroll 0 0 #CEDFF0;
|
||||
padding:4px;
|
||||
border:1px solid #C3D2E0;
|
||||
|
@ -6,28 +6,26 @@ class Themelet extends BaseThemelet {
|
||||
*/
|
||||
public function build_thumb_html(Image $image, $query=null) {
|
||||
global $config;
|
||||
$i_id = int_escape($image->id);
|
||||
$h_view_link = make_link("post/view/$i_id", $query);
|
||||
$i_id = (int) $image->id;
|
||||
$h_view_link = make_link('post/view/'.$i_id, $query);
|
||||
$h_thumb_link = $image->get_thumb_link();
|
||||
$h_tip = html_escape($image->get_tooltip());
|
||||
$h_tags = strtolower($image->get_tag_list());
|
||||
$base = get_base_href();
|
||||
|
||||
// If file is flash or svg then sets thumbnail to max size.
|
||||
if($image->ext == 'swf' || $image->ext == 'svg') {
|
||||
if($image->ext === 'swf' || $image->ext === 'svg'){
|
||||
$tsize = get_thumbnail_size($config->get_int('thumb_width'), $config->get_int('thumb_height'));
|
||||
}
|
||||
else {
|
||||
else{
|
||||
$tsize = get_thumbnail_size($image->width, $image->height);
|
||||
}
|
||||
|
||||
return "
|
||||
<center><div class='thumbblock'>
|
||||
|
||||
<a href='$h_view_link' style='position: relative; display: block; height: {$tsize[1]}px; width: {$tsize[0]}px;'>
|
||||
<img id='thumb_$i_id' title='$h_tip' alt='$h_tip' class='highlighted' style='height: {$tsize[1]}px; width: {$tsize[0]}px;' src='$h_thumb_link'>
|
||||
</a>
|
||||
|
||||
</div></center>
|
||||
";
|
||||
return '<center><div class="thumbblock">'.
|
||||
'<a href="'.$h_view_link.'" class="thumb" data-tags="'.$h_tags.'">'.
|
||||
'<img id="thumb_'.$i_id.'" title="'.$h_tip.'" alt="'.$h_tip.'" height="'.$tsize[1].'" width="'.$tsize[0].'" class="lazy" data-original="'.$h_thumb_link.'" src="'.$base.'/lib/static/grey.gif">'.
|
||||
'<noscript><img id="thumb_'.$i_id.'" title="'.$h_tip.'" alt="'.$h_tip.'" height="'.$tsize[1].'" width="'.$tsize[0].'" src="'.$h_thumb_link.'"></noscript>'.
|
||||
"</a></div></center>\n";
|
||||
}
|
||||
|
||||
|
||||
|
@ -13,7 +13,7 @@ class CustomViewImageTheme extends ViewImageTheme {
|
||||
$page->add_html_header("<meta property=\"og:url\" content=\"".make_http(make_link("post/view/{$image->id}"))."\">");
|
||||
$page->add_block(new Block("Navigation", $this->build_navigation($image), "left", 0));
|
||||
$page->add_block(new Block("Statistics", $this->build_stats($image), "left", 15));
|
||||
$page->add_block(new Block(null, $this->build_info($image, $editor_parts), "main", 10));
|
||||
$page->add_block(new Block(null, $this->build_info($image, $editor_parts), "main", 11));
|
||||
$page->add_block(new Block(null, $this->build_pin($image), "main", 11));
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user