diff --git a/contrib/shimmie_api/main.php b/contrib/shimmie_api/main.php index e7ddc59e..da65a2d6 100644 --- a/contrib/shimmie_api/main.php +++ b/contrib/shimmie_api/main.php @@ -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)); } } diff --git a/contrib/tag_history/theme.php b/contrib/tag_history/theme.php index e88a2b81..eaa8761e 100644 --- a/contrib/tag_history/theme.php +++ b/contrib/tag_history/theme.php @@ -27,6 +27,14 @@ class Tag_HistoryTheme extends Themelet { $setter = "".html_escape($name)."$h_ip"; $selected = ($n == 2) ? " checked" : ""; + + $current_tags = explode(" ", $current_tags); + $taglinks = array(); + foreach($current_tags as $tag){ + $taglinks[] = "".$tag.""; + } + $current_tags = implode(" ", $taglinks); + $history_list .= "
  • diff --git a/ext/index/script.js b/ext/index/script.js index 61a840f9..459118fb 100644 --- a/ext/index/script.js +++ b/ext/index/script.js @@ -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; } } diff --git a/themes/lite/style.css b/themes/lite/style.css index 1560e7d0..fe519214 100644 --- a/themes/lite/style.css +++ b/themes/lite/style.css @@ -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; diff --git a/themes/lite/themelet.class.php b/themes/lite/themelet.class.php index 8afa7754..3633860b 100644 --- a/themes/lite/themelet.class.php +++ b/themes/lite/themelet.class.php @@ -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 " -
    - - - $h_tip - - -
    - "; + return '
    \n"; } diff --git a/themes/lite/view.theme.php b/themes/lite/view.theme.php index 1d075041..f54d45b1 100644 --- a/themes/lite/view.theme.php +++ b/themes/lite/view.theme.php @@ -13,7 +13,7 @@ class CustomViewImageTheme extends ViewImageTheme { $page->add_html_header("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)); }