Changeset 2310 for plugins/topWriter
- Timestamp:
- 06/06/10 01:53:09 (13 years ago)
- Location:
- plugins/topWriter
- Files:
-
- 1 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
plugins/topWriter/_admin.php
r1942 r2310 3 3 # This file is part of topWriter, a plugin for Dotclear 2. 4 4 # 5 # Copyright (c) 2009 JC Denis and contributors5 # Copyright (c) 2009-2010 JC Denis and contributors 6 6 # jcdenis@gdwd.com 7 7 # -
plugins/topWriter/_define.php
r1942 r2310 3 3 # This file is part of topWriter, a plugin for Dotclear 2. 4 4 # 5 # Copyright (c) 2009 JC Denis and contributors5 # Copyright (c) 2009-2010 JC Denis and contributors 6 6 # jcdenis@gdwd.com 7 7 # … … 17 17 /* Description*/ "Widgets to list users who write more posts or comments", 18 18 /* Author */ "JC Denis", 19 /* Version */ '0. 2',19 /* Version */ '0.3', 20 20 /* Permissions */ 'admin' 21 21 ); 22 /* date */ #20 09081022 /* date */ #20100605 23 23 ?> -
plugins/topWriter/_public.php
r1942 r2310 3 3 # This file is part of topWriter, a plugin for Dotclear 2. 4 4 # 5 # Copyright (c) 2009 JC Denis and contributors5 # Copyright (c) 2009-2010 JC Denis and contributors 6 6 # jcdenis@gdwd.com 7 7 # -
plugins/topWriter/_widgets.php
r1942 r2310 3 3 # This file is part of topWriter, a plugin for Dotclear 2. 4 4 # 5 # Copyright (c) 2009 JC Denis and contributors5 # Copyright (c) 2009-2010 JC Denis and contributors 6 6 # jcdenis@gdwd.com 7 7 # … … 52 52 { 53 53 global $core; 54 54 55 55 if ($w->homeonly && $core->url->type != 'default') return; 56 56 57 57 $req = 58 58 'SELECT COUNT(*) AS count, comment_email '. … … 62 62 'AND post_status=1 AND comment_status=1 '. 63 63 self::period('comment_dt',$w->period); 64 65 if ($w->exclude) { 64 65 if ($w->exclude) 66 { 66 67 $req .= 67 68 'AND comment_email NOT IN ('. … … 72 73 ' GROUP BY U.user_email) '; 73 74 } 74 75 75 76 $req .= 76 77 'GROUP BY comment_email '. … … 79 80 80 81 $rs = $core->con->select($req); 81 82 82 83 if ($rs->isEmpty()) return; 83 84 84 85 $content = ''; 85 86 $i = 0; 86 while($rs->fetch()){ 87 while($rs->fetch()) 88 { 87 89 $user = $core->con->select( 88 "SELECT * FROM ".$core->prefix."comment WHERE comment_email='".$rs->comment_email."' " 90 "SELECT * FROM ".$core->prefix."comment ". 91 "WHERE comment_email='".$rs->comment_email."' ". 92 'ORDER BY comment_dt DESC' 89 93 ); 90 94 91 95 if (!$user->comment_author) continue; 92 96 93 97 $i++; 94 98 $rank = '<span class="topcomments-rank">'.$i.'</span>'; 95 96 if ($user->comment_site) { 99 100 if ($user->comment_site) 101 { 97 102 $author = '<a href="'.$user->comment_site.'" title="'. 98 103 __('Author link').'">'.$user->comment_author.'</a>'; 99 104 } 100 105 else 106 { 101 107 $author = $user->comment_author; 102 108 } 109 $author = '<span class="topcomments-author">'.$author.'</span>'; 110 103 111 if ($rs->count == 0) 112 { 104 113 $count = __('no comment'); 105 114 } 106 115 elseif ($rs->count == 1) 116 { 107 117 $count = __('one comment'); 108 118 } 109 119 else 120 { 110 121 $count = sprintf(__('%s comments'),$rs->count); 111 122 } 123 112 124 $content .= '<li>'.str_replace( 113 125 array('%rank%','%author%','%count%'), … … 116 128 ).'</li>'; 117 129 } 118 130 119 131 if ($i < 1) return; 120 132 121 133 return 122 134 '<div class="topcomments">'. … … 125 137 '</div>'; 126 138 } 127 139 128 140 public static function topPost($w) 129 141 { 130 142 global $core; 131 143 132 144 if ($w->homeonly && $core->url->type != 'default') return; 133 145 134 146 $rs = $core->con->select( 135 147 'SELECT COUNT(*) AS count, U.user_id '. … … 142 154 'ORDER BY count '.($w->sort == 'asc' ? 'ASC' : 'DESC').', U.user_id ASC '. 143 155 $core->con->limit(abs((integer) $w->limit))); 144 156 145 157 if ($rs->isEmpty()) return; 146 158 147 159 $content = ''; 148 160 $i = 0; 149 while($rs->fetch()){ 161 while($rs->fetch()) 162 { 150 163 $user = $core->con->select( 151 164 "SELECT * FROM ".$core->prefix."user WHERE user_id='".$rs->user_id."' " 152 165 ); 153 166 154 167 $author = dcUtils::getUserCN($user->user_id,$user->user_name, 155 168 $user->user_firstname,$user->user_displayname); 156 169 157 170 if (empty($author)) continue; 158 171 159 172 $i++; 160 173 $rank = '<span class="topentries-rank">'.$i.'</span>'; 161 162 if ($core->blog->settings->authormode_active) { 174 175 $core->blog->settings->addNamespace('authormode'); 176 if ($core->blog->settings->authormode->authormode_active) 177 { 163 178 $author = '<a href="'. 164 179 $core->blog->url.$core->url->getBase("author").'/'.$user->user_id.'" '. 165 180 'title="'.__('Author posts').'">'.$author.'</a>'; 166 181 } 167 elseif ($user->user_url) { 182 elseif ($user->user_url) 183 { 168 184 $author = '<a href="'.$user->user_url.'" title="'. 169 185 __('Author link').'">'.$author.'</a>'; 170 186 } 171 187 $author = '<span class="topentries-author">'.$author.'</span>'; 188 172 189 if ($rs->count == 0) 190 { 173 191 $count = __('no post'); 174 192 } 175 193 elseif ($rs->count == 1) 194 { 176 195 $count = __('one post'); 177 196 } 178 197 else 198 { 179 199 $count = sprintf(__('%s posts'),$rs->count); 180 200 } 201 181 202 $content .= '<li>'.str_replace( 182 203 array('%rank%','%author%','%count%'), … … 185 206 ).'</li>'; 186 207 } 187 208 188 209 if ($i < 1) return; 189 210 190 211 return 191 212 '<div class="topentries">'. … … 194 215 '</div>'; 195 216 } 196 217 197 218 private static function period($t,$p) 198 219 {
Note: See TracChangeset
for help on using the changeset viewer.