Index: trunk/extensions/WikiForum/WikiForum.i18n.php |
— | — | @@ -0,0 +1,320 @@ |
| 2 | +<?php |
| 3 | +/** |
| 4 | + * Internationalisation file for WikiForum extension. |
| 5 | + * |
| 6 | + * @file |
| 7 | + * @ingroup Extensions |
| 8 | + */ |
| 9 | + |
| 10 | +$messages = array(); |
| 11 | + |
| 12 | +/** English |
| 13 | + * @author Michael Chlebek |
| 14 | + * @author Jack Phoenix <jack@countervandalism.net> |
| 15 | + */ |
| 16 | +$messages['en'] = array( |
| 17 | + 'wikiforum-desc' => '[[Special:WikiForum|Forum]] extension for MediaWiki', |
| 18 | + 'wikiforum' => 'Discussion board', |
| 19 | + |
| 20 | + // Configuration variables -- do not translate! |
| 21 | + 'wikiforum-day-definition-new' => '3', // a thread is considered new for this many days |
| 22 | + 'wikiforum-max-threads-per-page' => '20', // number of threads which shall be shown per page on a forum |
| 23 | + 'wikiforum-max-replies-per-page' => '10', // number of replies which shall be shown per page on a thread |
| 24 | + |
| 25 | + 'wikiforum-anonymous' => 'Anonymous', |
| 26 | + 'wikiforum-announcement-only-description' => 'Announcement forum (only moderators can add threads)', |
| 27 | + 'wikiforum-by' => '$1<br />by $2', // $1 is a timestamp (time and date), $2 is a username |
| 28 | + 'wikiforum-description' => 'Description:', |
| 29 | + 'wikiforum-forum-is-empty' => 'This forum is currently empty. |
| 30 | +Please contact a forum administrator to have some categories and forums added.', |
| 31 | + 'wikiforum-forum-name' => 'Forum $1', // $1 is the name of a forum |
| 32 | + 'wikiforum-name' => 'Name:', |
| 33 | + 'wikiforum-preview' => 'Preview', |
| 34 | + 'wikiforum-preview-with-title' => 'Preview: $1', |
| 35 | + 'wikiforum-save' => 'Save', // button text |
| 36 | + 'wikiforum-error-search' => 'Search error', |
| 37 | + 'wikiforum-error-search-missing-query' => 'You must supply a term to search for!', |
| 38 | + 'wikiforum-search-hits' => 'Found {{PLURAL:$1|one hit|$1 hits}}', |
| 39 | + 'wikiforum-search-thread' => 'Thread: $1', |
| 40 | + 'wikiforum-thread-deleted' => 'thread deleted', |
| 41 | + 'wikiforum-topic-name' => 'Forum - $1', |
| 42 | + 'wikiforum-updates' => 'Newly updated forums', |
| 43 | + |
| 44 | + 'wikiforum-write-thread' => 'New topic', |
| 45 | + 'wikiforum-replies' => 'Replies', |
| 46 | + 'wikiforum-views' => 'Views', |
| 47 | + 'wikiforum-thread' => 'Thread', |
| 48 | + 'wikiforum-threads' => 'Threads', |
| 49 | + 'wikiforum-latest-reply' => 'Latest reply', |
| 50 | + 'wikiforum-latest-thread' => 'Latest thread', |
| 51 | + 'wikiforum-forum' => 'Forum: $1 > $2', |
| 52 | + 'wikiforum-overview' => 'Overview', |
| 53 | + 'wikiforum-pages' => 'Pages:', // followed by pagination links, like [01] [02] etc. |
| 54 | + 'wikiforum-thread-closed' => 'Thread closed', |
| 55 | + 'wikiforum-new-thread' => 'New thread', |
| 56 | + 'wikiforum-edit-thread' => 'Edit thread', |
| 57 | + 'wikiforum-delete-thread' => 'Delete thread', |
| 58 | + 'wikiforum-close-thread' => 'Close thread', |
| 59 | + 'wikiforum-reopen-thread' => 'Reopen thread', |
| 60 | + 'wikiforum-write-reply' => 'Write a reply', |
| 61 | + 'wikiforum-edit-reply' => 'Edit reply', |
| 62 | + 'wikiforum-delete-reply' => 'Delete reply', |
| 63 | + 'wikiforum-save-thread' => 'Save thread', |
| 64 | + 'wikiforum-save-reply' => 'Save reply', |
| 65 | + 'wikiforum-thread-title' => 'Title of your thread', |
| 66 | + 'wikiforum-no-threads' => 'No threads are available at the moment.', |
| 67 | + |
| 68 | + 'wikiforum-edit' => 'edit', |
| 69 | + 'wikiforum-close' => 'close', |
| 70 | + 'wikiforum-delete' => 'delete', |
| 71 | + 'wikiforum-reopen' => 'reopen', |
| 72 | + |
| 73 | + 'wikiforum-posted' => 'Posted at $1 by $2', |
| 74 | + 'wikiforum-edited' => 'Edited at $1 by $2', |
| 75 | + 'wikiforum-closed-text' => 'Thread was closed at $1 by $2', |
| 76 | + |
| 77 | + 'wikiforum-cat-not-found' => 'Category not found', |
| 78 | + 'wikiforum-cat-not-found-text' => 'Category does not exist - go back to $1', |
| 79 | + 'wikiforum-forum-not-found' => 'Forum not found', |
| 80 | + 'wikiforum-forum-not-found-text' => 'Forum does not exist - go back to $1', |
| 81 | + 'wikiforum-thread-not-found' => 'Thread not found', |
| 82 | + 'wikiforum-thread-not-found-text' => 'Thread does not exist or was already deleted - go back to $1.', |
| 83 | + |
| 84 | + 'wikiforum-error-thread-reopen' => 'Error while reopening thread', |
| 85 | + 'wikiforum-error-thread-close' => 'Error while closing thread', |
| 86 | + 'wikiforum-error-general' => 'Object not found or no rights to perform this action.', |
| 87 | + 'wikiforum-error-no-rights' => 'You don\'t have the rights to perform this action.', |
| 88 | + 'wikiforum-error-not-found' => 'Object not found.', |
| 89 | + 'wikiforum-error-no-text-or-title' => 'Title or text not correctly filled out.', |
| 90 | + 'wikiforum-error-no-reply' => 'Reply not correctly filled out.', |
| 91 | + 'wikiforum-error-double-post' => 'Double-click protection: thread already added.', // @todo FIXME: better wording |
| 92 | + 'wikiforum-error-thread-closed' => 'Thread is currently closed. It\'s not possible to add a new reply here.', |
| 93 | + |
| 94 | + 'wikiforum-error-delete' => 'Error while deleting', |
| 95 | + 'wikiforum-error-sticky' => 'Error while changing sticky attribute', |
| 96 | + 'wikiforum-error-move-thread' => 'Error while moving thread', |
| 97 | + 'wikiforum-error-add' => 'Error while adding', |
| 98 | + 'wikiforum-error-edit' => 'Error while editing', |
| 99 | + |
| 100 | + 'wikiforum-add-category' => 'Add category', |
| 101 | + 'wikiforum-edit-category' => 'Edit category', |
| 102 | + 'wikiforum-delete-category' => 'Delete category', |
| 103 | + 'wikiforum-add-forum' => 'Add forum', |
| 104 | + 'wikiforum-edit-forum' => 'Edit forum', |
| 105 | + 'wikiforum-delete-forum' => 'Delete forum', |
| 106 | + 'wikiforum-sort-up' => 'sort up', |
| 107 | + 'wikiforum-sort-down' => 'sort down', |
| 108 | + 'wikiforum-remove-sticky' => 'Remove sticky', |
| 109 | + 'wikiforum-make-sticky' => 'Make sticky', |
| 110 | + 'wikiforum-move-thread' => 'Move thread', |
| 111 | + 'wikiforum-paste-thread' => 'Paste thread', |
| 112 | + 'wikiforum-quote' => 'Quote', |
| 113 | + |
| 114 | + // For Special:ListGroupRights |
| 115 | + 'right-wikiforum-admin' => 'Add, edit and delete categories and forums on [[Special:WikiForum|the discusion board]]', |
| 116 | + 'right-wikiforum-moderator' => 'Edit and delete threads and replies on [[Special:WikiForum|the discusion board]]', |
| 117 | + |
| 118 | + // Forum admin group, as per discussion with Jedimca0 on 30 December 2010 |
| 119 | + 'group-forumadmin' => 'Forum administrators', |
| 120 | + 'group-forumadmin-member' => 'Forum administrator', |
| 121 | + 'grouppage-forumadmin' => 'Project:Forum administrators', |
| 122 | +); |
| 123 | + |
| 124 | +/** Finnish (Suomi) |
| 125 | + * @author Jack Phoenix <jack@countervandalism.net> |
| 126 | + */ |
| 127 | +$messages['fi'] = array( |
| 128 | + 'wikiforum-desc' => '[[Special:WikiForum|Foorumilisäosa]] MediaWikille', |
| 129 | + 'wikiforum' => 'Keskustelupalsta', |
| 130 | + 'wikiforum-anonymous' => 'Anonyymi', |
| 131 | + 'wikiforum-announcement-only-description' => 'Ilmoitusfoorumi (vain moderaattorit voivat lisätä aiheita)', |
| 132 | + 'wikiforum-by' => '$1;<br />kirjoittanut $2', |
| 133 | + 'wikiforum-description' => 'Kuvaus:', |
| 134 | + 'wikiforum-forum-is-empty' => 'Tämä foorumi on tällä hetkellä tyhjä. |
| 135 | +Otathan yhteyttä foorumin ylläpitäjään saadaksesi joitakin luokkia ja foorumeja lisätyksi.', |
| 136 | + 'wikiforum-forum-name' => 'Foorumi $1', |
| 137 | + 'wikiforum-name' => 'Nimi:', |
| 138 | + 'wikiforum-preview' => 'Esikatselu', |
| 139 | + 'wikiforum-preview-with-title' => 'Esikatselu: $1', |
| 140 | + 'wikiforum-save' => 'Tallenna', |
| 141 | + 'wikiforum-error-search' => 'Hakuvirhe', |
| 142 | + 'wikiforum-error-search-missing-query' => 'Sinun tulee antaa hakusana, jolla haetaan!', |
| 143 | + 'wikiforum-search-hits' => 'Löydettiin {{PLURAL:$1|yksi tulos|$1 tulosta}}', |
| 144 | + 'wikiforum-search-thread' => 'Aihe: $1', |
| 145 | + 'wikiforum-thread-deleted' => 'aihe on poistettu', |
| 146 | + 'wikiforum-topic-name' => 'Foorumi - $1', |
| 147 | + 'wikiforum-updates' => 'Äskettäin päivitetyt foorumit', |
| 148 | + 'wikiforum-write-thread' => 'Uusi aihe', |
| 149 | + 'wikiforum-replies' => 'Vastauksia', |
| 150 | + 'wikiforum-views' => 'Katselukertoja', |
| 151 | + 'wikiforum-thread' => 'Aihe', |
| 152 | + 'wikiforum-threads' => 'Aiheita', // @todo CHECKME |
| 153 | + 'wikiforum-latest-reply' => 'Viimeisin vastaus', |
| 154 | + 'wikiforum-latest-thread' => 'Viimeisin aihe', |
| 155 | + 'wikiforum-forum' => 'Foorumi: $1 > $2', |
| 156 | + 'wikiforum-overview' => 'Yleiskatsaus', |
| 157 | + 'wikiforum-pages' => 'Sivuja:', |
| 158 | + 'wikiforum-thread-closed' => 'Aihe suljettu', |
| 159 | + 'wikiforum-new-thread' => 'Uusi aihe', |
| 160 | + 'wikiforum-edit-thread' => 'Muokkaa aihetta', |
| 161 | + 'wikiforum-delete-thread' => 'Poista aihe', |
| 162 | + 'wikiforum-close-thread' => 'Sulje aihe', |
| 163 | + 'wikiforum-reopen-thread' => 'Avaa aihe', |
| 164 | + 'wikiforum-write-reply' => 'Kirjoita vastaus', |
| 165 | + 'wikiforum-edit-reply' => 'Muokkaa vastausta', |
| 166 | + 'wikiforum-delete-reply' => 'Poista vastaus', |
| 167 | + 'wikiforum-save-thread' => 'Tallenna aihe', |
| 168 | + 'wikiforum-save-reply' => 'Tallenna vastaus', |
| 169 | + 'wikiforum-thread-title' => 'Aiheesi otsikko', |
| 170 | + 'wikiforum-no-threads' => 'Tällä hetkellä aiheita ei ole saatavilla.', |
| 171 | + 'wikiforum-edit' => 'muokkaa', |
| 172 | + 'wikiforum-close' => 'sulje', |
| 173 | + 'wikiforum-delete' => 'poista', |
| 174 | + 'wikiforum-reopen' => 'avaa', |
| 175 | + 'wikiforum-posted' => 'Kirjoittanut $2 kello $1', |
| 176 | + 'wikiforum-edited' => 'Muokannut $2 kello $1', |
| 177 | + 'wikiforum-closed-text' => 'Aiheen sulki $2 kello $1', |
| 178 | + 'wikiforum-cat-not-found' => 'Luokkaa ei löydy', |
| 179 | + 'wikiforum-cat-not-found-text' => 'Luokkaa ei ole olemassa - mene takaisin sivulle $1', |
| 180 | + 'wikiforum-forum-not-found' => 'Foorumia ei löydy', |
| 181 | + 'wikiforum-forum-not-found-text' => 'Foorumia ei ole olemassa - mene takaisin sivulle $1', |
| 182 | + 'wikiforum-thread-not-found' => 'Aihetta ei löydy', |
| 183 | + 'wikiforum-thread-not-found-text' => 'Aihetta ei ole olemassa tai se on jo poistettu - mene takaisin sivulle $1', |
| 184 | + 'wikiforum-error-thread-reopen' => 'Virhe aihetta avatesssa', |
| 185 | + 'wikiforum-error-thread-close' => 'Virhe aihetta sulkiessa', |
| 186 | + //'wikiforum-error-general' => 'Object not found or no rights to perform this action.', |
| 187 | + 'wikiforum-error-no-rights' => 'Sinulla ei ole oikeuksia suorittaa tätä toimintoa.', |
| 188 | + /*'wikiforum-error-not-found' => 'Object not found.', |
| 189 | + 'wikiforum-error-no-text-or-title' => 'Title or text not correctly filled out.', |
| 190 | + 'wikiforum-error-no-reply' => 'Reply not correctly filled out.',*/ |
| 191 | + 'wikiforum-error-double-post' => 'Kaksoisnapsautuksen esto: aihe on jo lisätty.', |
| 192 | + 'wikiforum-error-thread-closed' => 'Aihe on tällä hetkellä lukittu. Ei ole mahdollista jättää tänne uutta vastausta.', |
| 193 | + 'wikiforum-error-delete' => 'Virhe poistaessa', |
| 194 | + 'wikiforum-error-sticky' => 'Virhe tiedote-ominaisuutta muutettaessa', // this could use a better wording... |
| 195 | + 'wikiforum-error-move-thread' => 'Virhe aihetta siirrettäessä', |
| 196 | + 'wikiforum-error-add' => 'Virhe lisätessä', |
| 197 | + 'wikiforum-error-edit' => 'Virhe muokatessa', |
| 198 | + 'wikiforum-add-category' => 'Lisää luokka', |
| 199 | + 'wikiforum-edit-category' => 'Muokkaa luokkaa', |
| 200 | + 'wikiforum-delete-category' => 'Poista luokka', |
| 201 | + 'wikiforum-add-forum' => 'Lisää foorumi', |
| 202 | + 'wikiforum-edit-forum' => 'Muokkaa foorumia', |
| 203 | + 'wikiforum-delete-forum' => 'Poista foorumi', |
| 204 | + /*'wikiforum-sort-up' => 'sort up', |
| 205 | + 'wikiforum-sort-down' => 'sort down',*/ |
| 206 | + 'wikiforum-remove-sticky' => 'Poista tiedote-status', |
| 207 | + 'wikiforum-make-sticky' => 'Tee tiedote', |
| 208 | + 'wikiforum-move-thread' => 'Siirrä aihe', |
| 209 | + 'wikiforum-paste-thread' => 'Liitä aihe', |
| 210 | + 'wikiforum-quote' => 'Siteeraa', |
| 211 | + 'right-wikiforum-admin' => 'Lisätä, muokata ja poistaa luokkia ja foorumeja [[Special:WikiForum|keskustelupalstalla]]', |
| 212 | + 'right-wikiforum-moderator' => 'Muokata ja poistaa aiheita ja vastauksia [[Special:WikiForum|keskustelupalstalla]]', |
| 213 | + 'group-forumadmin' => 'Foorumin ylläpitäjät', |
| 214 | + 'group-forumadmin-member' => 'Foorumin ylläpitäjä', |
| 215 | + 'grouppage-forumadmin' => 'Project:Foorumin ylläpitäjät', |
| 216 | +); |
| 217 | + |
| 218 | +/** French (Français) |
| 219 | + * @author Jack Phoenix <jack@countervandalism.net> |
| 220 | + */ |
| 221 | +$messages['fr'] = array( |
| 222 | + 'wikiforum' => 'Forum de discussion', |
| 223 | + 'wikiforum-anonymous' => 'Anonyme', |
| 224 | + 'group-forumadmin' => 'Administrateurs du forum', |
| 225 | + 'group-forumadmin-member' => 'Administrateur du forum', |
| 226 | + 'grouppage-forumadmin' => 'Project:Administrateurs du forum', |
| 227 | +); |
| 228 | + |
| 229 | +/** Dutch (Nederlands) |
| 230 | + * @author Jedimca0 |
| 231 | + */ |
| 232 | +$messages['nl'] = array( |
| 233 | + 'wikiforum-desc' => '[[Special:WikiForum|Forum]] extensie voor MediaWiki', |
| 234 | + 'wikiforum' => 'Discussie bord', |
| 235 | + 'wikiforum-anonymous' => 'Anonieme', |
| 236 | + 'wikiforum-announcement-only-description' => 'Aankondigingen forum (Alleen forum moderatoren kunnen nieuwe berichten plaatsen)', |
| 237 | + 'wikiforum-by' => '$1<br />door $2', |
| 238 | + 'wikiforum-description' => 'Omschrijving:', |
| 239 | + 'wikiforum-forum-is-empty' => 'Dit forum is op het moment leeg. |
| 240 | +Neem a.u.b. contact op met een forum administrator on categorieën en forums to te voegen.', |
| 241 | + 'wikiforum-forum-name' => 'Forum $1', |
| 242 | + 'wikiforum-name' => 'Naam:', |
| 243 | + 'wikiforum-preview' => 'Preview', |
| 244 | + 'wikiforum-preview-with-title' => 'Preview: $1', |
| 245 | + 'wikiforum-save' => 'opslaan', |
| 246 | + 'wikiforum-error-search' => 'Zoek error', |
| 247 | + 'wikiforum-error-search-missing-query' => 'U moet een term invoeren om naar te zoeken!', |
| 248 | + 'wikiforum-search-hits' => '{{PLURAL:$1|forum|$1 forums}} gevonden', |
| 249 | + 'wikiforum-search-thread' => 'Thread: $1', |
| 250 | + 'wikiforum-thread-deleted' => 'thread verwijderd', |
| 251 | + 'wikiforum-topic-name' => 'Forum - $1', |
| 252 | + 'wikiforum-updates' => 'ge-update forums', |
| 253 | + 'wikiforum-write-thread' => 'Nieuw onderwerp', |
| 254 | + 'wikiforum-replies' => 'Reacties', |
| 255 | + 'wikiforum-views' => 'Bekeken', |
| 256 | + 'wikiforum-thread' => 'Thread', |
| 257 | + 'wikiforum-threads' => 'Threads', |
| 258 | + 'wikiforum-latest-reply' => 'Laatste reactie', |
| 259 | + 'wikiforum-latest-thread' => 'Laatste thread', |
| 260 | + 'wikiforum-forum' => 'Forum: $1 > $2', |
| 261 | + 'wikiforum-overview' => 'Overzicht', |
| 262 | + 'wikiforum-pages' => "Pagina's:", |
| 263 | + 'wikiforum-thread-closed' => 'Thread gesloten', |
| 264 | + 'wikiforum-new-thread' => 'Nieuw thread', |
| 265 | + 'wikiforum-edit-thread' => 'bewerk thread', |
| 266 | + 'wikiforum-delete-thread' => 'verwijder thread', |
| 267 | + 'wikiforum-close-thread' => 'sluit thread', |
| 268 | + 'wikiforum-reopen-thread' => 'heropen thread', |
| 269 | + 'wikiforum-write-reply' => 'Schrijf een reactie', |
| 270 | + 'wikiforum-edit-reply' => 'Bewerk reactie', |
| 271 | + 'wikiforum-delete-reply' => 'verwijder reactie', |
| 272 | + 'wikiforum-save-thread' => 'thread opslaan', |
| 273 | + 'wikiforum-save-reply' => 'reactie opslaan', |
| 274 | + 'wikiforum-thread-title' => 'Titel van uw thread', |
| 275 | + 'wikiforum-no-threads' => 'Er zijn op het moment geen threads beschikbaar.', |
| 276 | + 'wikiforum-edit' => 'bewerk', |
| 277 | + 'wikiforum-close' => 'sluit', |
| 278 | + 'wikiforum-delete' => 'verwijder', |
| 279 | + 'wikiforum-reopen' => 'heropen', |
| 280 | + 'wikiforum-posted' => 'Geplaatst op $1 door $2', |
| 281 | + 'wikiforum-edited' => 'Bewerkt op $1 door $2', |
| 282 | + 'wikiforum-closed-text' => 'Thread was gesloten op $1 door $2', |
| 283 | + 'wikiforum-cat-not-found' => 'Categorie niet gevonden', |
| 284 | + 'wikiforum-cat-not-found-text' => 'Categorie bestaat niet - terug naar $1', |
| 285 | + 'wikiforum-forum-not-found' => 'Forum niet gevonden', |
| 286 | + 'wikiforum-forum-not-found-text' => 'Forum bestaat niet - terug naar $1', |
| 287 | + 'wikiforum-thread-not-found' => 'Thread niet gevonden', |
| 288 | + 'wikiforum-thread-not-found-text' => 'Thread bestaat niet of was verwijderd - terug naar $1.', |
| 289 | + 'wikiforum-error-thread-reopen' => 'Fout bij het heropenen van thread', |
| 290 | + 'wikiforum-error-thread-close' => 'Fout tijdens sluiten van thread', |
| 291 | + 'wikiforum-error-general' => 'Object niet gevonden, of u heeft geen rechten om deze actie uit te voeren.', |
| 292 | + 'wikiforum-error-no-rights' => 'U heeft het recht niet om deze actie uit te voeren.', |
| 293 | + 'wikiforum-error-not-found' => 'Object niet gevonden.', |
| 294 | + 'wikiforum-error-no-text-or-title' => 'Titel of text was niet correct ingevuld.', |
| 295 | + 'wikiforum-error-no-reply' => 'Reactie niet correct ingevuld.', |
| 296 | + 'wikiforum-error-double-post' => 'Dubbel click preventie, thread is al toegevoegd.', |
| 297 | + 'wikiforum-error-thread-closed' => 'Thread is op het moment gesloten, het is niet mogelijk om een reactie toe te voegen.', |
| 298 | + 'wikiforum-error-delete' => 'Fout tijdens verwijderen', |
| 299 | + 'wikiforum-error-sticky' => 'Fout tijdens veranderen van sticky aanmerking', |
| 300 | + 'wikiforum-error-move-thread' => 'Fout tijdens her verplaatsen van het thread', |
| 301 | + 'wikiforum-error-add' => 'Fout tijdens toevoegen', |
| 302 | + 'wikiforum-error-edit' => 'Fout tijdens bewerken', |
| 303 | + 'wikiforum-add-category' => 'Categorie toevoegen', |
| 304 | + 'wikiforum-edit-category' => 'Categorie bewerken', |
| 305 | + 'wikiforum-delete-category' => 'Categorie verwijderen', |
| 306 | + 'wikiforum-add-forum' => 'Forum toevoegen', |
| 307 | + 'wikiforum-edit-forum' => 'Forum bewerken', |
| 308 | + 'wikiforum-delete-forum' => 'Forum verwijderen', |
| 309 | + 'wikiforum-sort-up' => 'Naar boven sorteren', |
| 310 | + 'wikiforum-sort-down' => 'Naar beneden sorteren', |
| 311 | + 'wikiforum-remove-sticky' => 'Sticky verwijderen', |
| 312 | + 'wikiforum-make-sticky' => 'Sticky maken', |
| 313 | + 'wikiforum-move-thread' => 'Thread verplaatsen', |
| 314 | + 'wikiforum-paste-thread' => 'Thread plakken', |
| 315 | + 'wikiforum-quote' => 'Quote', |
| 316 | + 'right-wikiforum-admin' => 'Forums en categorieën toevoegen, bewerken en verwijderen op [[Special:WikiForum|het forum]]', |
| 317 | + 'right-wikiforum-moderator' => 'Threads en reacties bewerken en verwijderen op [[Special:WikiForum|het forum]]', |
| 318 | + 'group-forumadmin' => 'Forum administratoren', |
| 319 | + 'group-forumadmin-member' => 'Forum administrator', |
| 320 | + 'grouppage-forumadmin' => 'Project:Forum administratoren', |
| 321 | +); |
\ No newline at end of file |
Property changes on: trunk/extensions/WikiForum/WikiForum.i18n.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 322 | + native |
Index: trunk/extensions/WikiForum/WikiForum.php |
— | — | @@ -0,0 +1,369 @@ |
| 2 | +<?php |
| 3 | +/** |
| 4 | + * WikiForum -- forum extension for MediaWiki |
| 5 | + * |
| 6 | + * @file |
| 7 | + * @ingroup Extensions |
| 8 | + * @author Michael Chlebek |
| 9 | + * @author Jack Phoenix <jack@countervandalism.net> |
| 10 | + * @date 23 December 2010 (date of this build: 22 January 2011) |
| 11 | + * @version 1.2-SW |
| 12 | + * @copyright Copyright © 2010 Unidentify Studios |
| 13 | + * @copyright Copyright © 2010-2011 Jack Phoenix <jack@countervandalism.net> |
| 14 | + * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 3.0 or later |
| 15 | + * |
| 16 | + * This program is free software: you can redistribute it and/or modify |
| 17 | + * it under the terms of the GNU General Public License as published by |
| 18 | + * the Free Software Foundation, either version 3 of the License, or |
| 19 | + * (at your option) any later version. |
| 20 | + * |
| 21 | + * This program is distributed in the hope that it will be useful, |
| 22 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 23 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
| 24 | + * See the GNU General Public License for more details. |
| 25 | + * |
| 26 | + * You should have received a copy of the GNU General Public License |
| 27 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 28 | + */ |
| 29 | + |
| 30 | +if( !defined( 'MEDIAWIKI' ) ) { |
| 31 | + die( "This is an extension to the MediaWiki package and cannot be run standalone.\n" ); |
| 32 | +} |
| 33 | + |
| 34 | +// Extension credits that will show up on Special:Version |
| 35 | +$wgExtensionCredits['other'][] = array( |
| 36 | + 'path' => __FILE__, |
| 37 | + 'name' => 'WikiForum', |
| 38 | + 'author' => array( 'Michael Chlebek', 'Jack Phoenix' ), |
| 39 | + 'version' => '1.2-SW', |
| 40 | + 'url' => 'http://www.mediawiki.org/wiki/Extension:WikiForum', |
| 41 | + 'description' => '[[Special:WikiForum|Forum]] extension for MediaWiki', |
| 42 | + 'descriptionmsg' => 'wikiforum-desc' |
| 43 | +); |
| 44 | + |
| 45 | +// Set up i18n, the new special page etc. |
| 46 | +$dir = dirname( __FILE__ ) . '/'; |
| 47 | +$wgExtensionMessagesFiles['WikiForum'] = $dir . 'WikiForum.i18n.php'; |
| 48 | +$wgExtensionAliasesFiles['WikiForum'] = $dir . 'WikiForum.alias.php'; |
| 49 | +$wgAutoloadClasses['WikiForumGui'] = $dir . 'WikiForumGui.php'; |
| 50 | +$wgAutoloadClasses['WikiForumClass'] = $dir . 'WikiForumClass.php'; |
| 51 | +$wgAutoloadClasses['WikiForum'] = $dir . 'SpecialWikiForum.php'; |
| 52 | +$wgSpecialPages['WikiForum'] = 'WikiForum'; |
| 53 | + |
| 54 | +// New user rights for administrating and moderating the forum |
| 55 | +$wgAvailableRights[] = 'wikiforum-admin'; |
| 56 | +$wgAvailableRights[] = 'wikiforum-moderator'; |
| 57 | + |
| 58 | +// New forumadmin group |
| 59 | +$wgGroupPermissions['forumadmin']['wikiforum-admin'] = true; |
| 60 | +$wgGroupPermissions['forumadmin']['wikiforum-moderator'] = true; |
| 61 | + |
| 62 | +// Allow sysops to act as forum administrators, too |
| 63 | +$wgGroupPermissions['sysop']['wikiforum-admin'] = true; |
| 64 | +$wgGroupPermissions['sysop']['wikiforum-moderator'] = true; |
| 65 | + |
| 66 | +# Configuration parameters |
| 67 | +// Allow anonymous users to write threads and replies? |
| 68 | +$wgWikiForumAllowAnonymous = true; |
| 69 | + |
| 70 | +// Array of emoticon text forms => image file names |
| 71 | +// @todo FIXME: kill this variable WITH FIRE and make an admin-configurable |
| 72 | +// way to configure the emoticons (a MediaWiki message maybe?) |
| 73 | +$wgWikiForumSmilies = array( |
| 74 | + /* |
| 75 | + ':)' => 'icons/emoticon_grin.png', |
| 76 | + // yeah, apparently you have to use < and > instead of < and > |
| 77 | + '>D' => 'icons/emoticon_evilgrin.png', |
| 78 | + */ |
| 79 | +); |
| 80 | + |
| 81 | +// Hooked functions |
| 82 | +$wgHooks['ParserFirstCallInit'][] = 'wfWikiForumTags'; |
| 83 | +$wgHooks['SkinTemplateBuildNavUrlsNav_urlsAfterPermalink'][] = 'wfSpecialWikiForumNav'; |
| 84 | +$wgHooks['SkinTemplateToolboxEnd'][] = 'wfSpecialWikiForumToolbox'; |
| 85 | + |
| 86 | +/** |
| 87 | + * Set up the two new parser hooks: <WikiForumList> and <WikiForumThread> |
| 88 | + * |
| 89 | + * @param $parser Object: instance of Parser |
| 90 | + * @return Boolean: true |
| 91 | + */ |
| 92 | +function wfWikiForumTags( &$parser ) { |
| 93 | + $parser->setHook( 'WikiForumList', 'renderWikiForumList' ); |
| 94 | + $parser->setHook( 'WikiForumThread', 'renderWikiForumThread' ); |
| 95 | + return true; |
| 96 | +} |
| 97 | + |
| 98 | +/** |
| 99 | + * Adds a link to Special:WikiForum to the toolbox, after permalink. |
| 100 | + * Both this and the function below are required to render the link in the |
| 101 | + * toolbox. |
| 102 | + * |
| 103 | + * @param $skinTemplate Object: SkinTemplate instance |
| 104 | + * @param $nav_urls Array: existing navigation URLs |
| 105 | + * @param $oldid Integer |
| 106 | + * @param $revid Integer: revision ID number of the current revision |
| 107 | + * @return Boolean: true |
| 108 | + */ |
| 109 | +function wfSpecialWikiForumNav( &$skinTemplate, &$nav_urls, &$oldid, &$revid ) { |
| 110 | + $nav_urls['wikiforum'] = array( |
| 111 | + 'text' => wfMsg( 'wikiforum' ), |
| 112 | + 'href' => $skinTemplate->makeSpecialUrl( 'WikiForum' ) |
| 113 | + ); |
| 114 | + return true; |
| 115 | +} |
| 116 | + |
| 117 | +/** |
| 118 | + * Adds a link to Special:WikiForum to the toolbox, after permalink. |
| 119 | + * Both this and the function above are required to render the link in the |
| 120 | + * toolbox. |
| 121 | + * |
| 122 | + * @param $skinTemplate Object: instance of SkinTemplate class |
| 123 | + * @return Boolean: true |
| 124 | + */ |
| 125 | +function wfSpecialWikiForumToolbox( &$skinTemplate ) { |
| 126 | + if( isset( $skinTemplate->data['nav_urls']['wikiforum'] ) ) { |
| 127 | + if( $skinTemplate->data['nav_urls']['wikiforum']['href'] == '' ) { |
| 128 | + echo '<li id="t-iswikiforum">' . wfMsg( 'wikiforum' ) . '</li>'; |
| 129 | + } else { |
| 130 | + $url = $skinTemplate->data['nav_urls']['wikiforum']['href']; |
| 131 | + echo '<li id="t-wikiforum"><a href="' . htmlspecialchars( $url ) . '">'; |
| 132 | + echo wfMsg( 'wikiforum' ); |
| 133 | + echo '</a></li>'; |
| 134 | + } |
| 135 | + } |
| 136 | + return true; |
| 137 | +} |
| 138 | + |
| 139 | +/** |
| 140 | + * Callback for <WikiForumList> tag. |
| 141 | + * Takes only the following argument: num (used as the LIMIT for the SQL query) |
| 142 | + */ |
| 143 | +function renderWikiForumList( $input, $args, $parser, $frame ) { |
| 144 | + global $wgUser, $wgLang, $wgScriptPath; |
| 145 | + |
| 146 | + if( !isset( $args['num'] ) ) { |
| 147 | + $args['num'] = 5; |
| 148 | + } |
| 149 | + |
| 150 | + $dbr = wfGetDB( DB_SLAVE ); |
| 151 | + $sqlThreads = $dbr->select( |
| 152 | + array( |
| 153 | + 'wikiforum_forums', 'wikiforum_category', 'wikiforum_threads', |
| 154 | + 'user' |
| 155 | + ), |
| 156 | + array( |
| 157 | + '*', 'wff_forum', 'wff_forum_name', 'wfc_category', |
| 158 | + 'wfc_category_name', 'user_name' |
| 159 | + ), |
| 160 | + array( |
| 161 | + 'wff_deleted' => 0, |
| 162 | + 'wfc_deleted' => 0, |
| 163 | + 'wft_deleted' => 0, |
| 164 | + 'wff_category = wfc_category', |
| 165 | + 'wff_forum = wft_forum' |
| 166 | + ), |
| 167 | + __METHOD__, |
| 168 | + // it's either wff or wft, I'm not 100% sure which one so I just picked |
| 169 | + // one of them... |
| 170 | + array( |
| 171 | + 'ORDER BY' => 'wff_last_post_timestamp DESC', |
| 172 | + 'LIMIT' => intval( $args['num'] ) |
| 173 | + ), |
| 174 | + array( 'user' => array( 'LEFT JOIN', 'user_id = wft_user' ) ) |
| 175 | + ); |
| 176 | + |
| 177 | + $output = WikiForumGui::getMainPageHeader( |
| 178 | + wfMsg( 'wikiforum-updates' ), |
| 179 | + wfMsg( 'wikiforum-replies' ), |
| 180 | + wfMsg( 'wikiforum-views' ), |
| 181 | + wfMsg( 'wikiforum-latest-reply' ) |
| 182 | + ); |
| 183 | + |
| 184 | + foreach( $sqlThreads as $thread ) { |
| 185 | + $icon = WikiForumClass::getThreadIcon( |
| 186 | + $thread->wft_posted_timestamp, |
| 187 | + $thread->wft_closed, |
| 188 | + $thread->wft_sticky |
| 189 | + ); |
| 190 | + |
| 191 | + $lastpost = ''; |
| 192 | + // If there are some replies, then we can obviously figure out who was |
| 193 | + // the last user who posted something on the topic... |
| 194 | + if( $thread->wft_reply_count > 0 ) { |
| 195 | + $lastpost = wfMsg( |
| 196 | + 'wikiforum-by', |
| 197 | + $wgLang->timeanddate( $thread->wft_last_post_timestamp ), |
| 198 | + WikiForumClass::getUserLinkById( $thread->wft_last_post_user ) |
| 199 | + ); |
| 200 | + } |
| 201 | + |
| 202 | + $specialPageObj = SpecialPage::getTitleFor( 'WikiForum' ); |
| 203 | + $sk = $wgUser->getSkin(); |
| 204 | + // Build the links to the category and forum pages by using Linker |
| 205 | + $categoryLink = $sk->link( |
| 206 | + $specialPageObj, |
| 207 | + $thread->wfc_category_name, |
| 208 | + array(), |
| 209 | + array( 'category' => $thread->wfc_category ) |
| 210 | + ); |
| 211 | + $forumLink = $sk->link( |
| 212 | + $specialPageObj, |
| 213 | + $thread->wff_forum_name, |
| 214 | + array(), |
| 215 | + array( 'forum' => $thread->wff_forum ) |
| 216 | + ); |
| 217 | + $threadLink = $sk->link( |
| 218 | + $specialPageObj, |
| 219 | + $thread->wft_thread_name, |
| 220 | + array(), |
| 221 | + array( 'thread' => $thread->wft_thread ) |
| 222 | + ); |
| 223 | + |
| 224 | + $output .= WikiForumGui::getMainBody( |
| 225 | + '<p class="mw-wikiforum-thread">' . $icon . $threadLink . |
| 226 | + '<p class="mw-wikiforum-descr" style="border-top: 0;">' . |
| 227 | + wfMsg( |
| 228 | + 'wikiforum-posted', |
| 229 | + $wgLang->timeanddate( $thread->wft_posted_timestamp ), |
| 230 | + WikiForumClass::getUserLink( $thread->user_name ) |
| 231 | + ) . '<br />' . |
| 232 | + wfMsgHtml( 'wikiforum-forum', $categoryLink, $forumLink ) . |
| 233 | + '</p></p>', |
| 234 | + $thread->wft_reply_count, |
| 235 | + $thread->wft_view_count, |
| 236 | + $lastpost, |
| 237 | + false, |
| 238 | + false |
| 239 | + ); |
| 240 | + } |
| 241 | + $output .= WikiForumGui::getMainPageFooter(); |
| 242 | + |
| 243 | + return $output; |
| 244 | +} |
| 245 | + |
| 246 | +/** |
| 247 | + * Callback for the <WikiForumThread> hook. |
| 248 | + * Takes the following arguments: id (ID number of the thread, used in SQL |
| 249 | + * query), replies (whether to display replies) |
| 250 | + */ |
| 251 | +function renderWikiForumThread( $input, $args, $parser, $frame ) { |
| 252 | + global $wgOut, $wgLang, $wgScriptPath; |
| 253 | + |
| 254 | + if( isset( $args['id'] ) && $args['id'] > 0 ) { |
| 255 | + $dbr = wfGetDB( DB_SLAVE ); |
| 256 | + $sqlThreads = $dbr->select( |
| 257 | + array( 'wikiforum_forums', 'wikiforum_category', 'wikiforum_threads', 'user' ), |
| 258 | + array( |
| 259 | + 'wft_thread', 'wft_thread_name', 'wft_text', 'wff_forum', |
| 260 | + 'wff_forum_name', 'wfc_category', 'wfc_category_name', |
| 261 | + 'user_name', 'user_id', 'wft_edit_timestamp', 'wft_edit_user', |
| 262 | + 'wft_posted_timestamp', 'wft_user', 'wft_closed', |
| 263 | + 'wft_closed_user' |
| 264 | + ), |
| 265 | + array( |
| 266 | + 'wff_deleted' => 0, |
| 267 | + 'wfc_deleted' => 0, |
| 268 | + 'wft_deleted' => 0, |
| 269 | + 'wff_category = wfc_category', |
| 270 | + 'wff_forum = wft_forum', |
| 271 | + 'wft_thread' => intval( $args['id'] ) |
| 272 | + ), |
| 273 | + __METHOD__, |
| 274 | + array(), |
| 275 | + array( 'user' => array( 'LEFT JOIN', 'user_id = wft_user' ) ) |
| 276 | + ); |
| 277 | + $overview = $dbr->fetchObject( $sqlThreads ); |
| 278 | + |
| 279 | + if( $overview ) { |
| 280 | + $posted = wfMsg( |
| 281 | + 'wikiforum-posted', |
| 282 | + $wgLang->timeanddate( $overview->wft_posted_timestamp ), |
| 283 | + WikiForumClass::getUserLink( $overview->user_name ) |
| 284 | + ); |
| 285 | + if( $overview->wft_edit_timestamp > 0 ) { |
| 286 | + $posted .= '<br /><i>' . |
| 287 | + wfMsg( |
| 288 | + 'wikiforum-edited', |
| 289 | + $wgLang->timeanddate( $overview->wft_edit_timestamp ), |
| 290 | + WikiForumClass::getUserLinkById( $overview->wft_edit_user ) |
| 291 | + ) . '</i>'; |
| 292 | + } |
| 293 | + |
| 294 | + $output = WikiForumGui::getHeaderRow( |
| 295 | + $overview->wfc_category, |
| 296 | + $overview->wfc_category_name, |
| 297 | + $overview->wff_forum, |
| 298 | + $overview->wff_forum_name, |
| 299 | + false |
| 300 | + ); |
| 301 | + |
| 302 | + $specialPageObj = SpecialPage::getTitleFor( 'WikiForum' ); |
| 303 | + $link = $specialPageObj->escapeFullURL( 'thread=' . $overview->wft_thread ); |
| 304 | + |
| 305 | + $output .= WikiForumGui::getThreadHeader( |
| 306 | + '<a href="' . $link . '">' . $overview->wft_thread_name . '</a>', |
| 307 | + $parser->recursiveTagParse( $overview->wft_text, $frame ), |
| 308 | + $posted, |
| 309 | + '', |
| 310 | + $overview->wft_thread, |
| 311 | + $overview->user_id |
| 312 | + ); |
| 313 | + |
| 314 | + if ( isset( $args['replies'] ) && $args['replies'] ) { |
| 315 | + $replies = $dbr->select( |
| 316 | + array( 'wikiforum_replies', 'user' ), |
| 317 | + array( '*', 'user_name' ), |
| 318 | + array( 'wfr_deleted' => 0, 'wfr_thread' => $overview->pkThread ), |
| 319 | + __METHOD__, |
| 320 | + array( 'ORDER BY' => 'wfr_posted_timestamp ASC' ), |
| 321 | + array( 'user' => array( 'LEFT JOIN', 'user_id = wfr_user' ) ) |
| 322 | + ); |
| 323 | + |
| 324 | + foreach( $replies as $reply ) { |
| 325 | + $posted = wfMsg( |
| 326 | + 'wikiforum-posted', |
| 327 | + $wgLang->timeanddate( $reply->wfr_posted_timestamp ), |
| 328 | + WikiForumClass::getUserLink( $reply->user_name ) |
| 329 | + ); |
| 330 | + if( $reply->wfr_edit > 0 ) { |
| 331 | + $posted .= '<br /><i>' . |
| 332 | + wfMsg( |
| 333 | + 'wikiforum-edited', |
| 334 | + $wgLang->timeanddate( $reply->wfr_edit ), |
| 335 | + WikiForumClass::getUserLinkById( $reply->wfr_edit_user ) |
| 336 | + ) . '</i>'; |
| 337 | + } |
| 338 | + $output .= WikiForumGui::getReply( |
| 339 | + $wgOut->parse( WikiForum::deleteTags( $reply->wfr_reply_text ) ), |
| 340 | + $posted, |
| 341 | + '', |
| 342 | + $reply->wfr_reply_id |
| 343 | + ); |
| 344 | + } |
| 345 | + } |
| 346 | + |
| 347 | + $output .= WikiForumGui::getThreadFooter(); |
| 348 | + return $output; |
| 349 | + } |
| 350 | + } else { |
| 351 | + return ''; |
| 352 | + } |
| 353 | +} |
| 354 | + |
| 355 | +$wgHooks['BeforePageDisplay'][] = 'wfWikiForumAddStyles'; |
| 356 | +/** |
| 357 | + * Add the CSS file to the output, but only once. |
| 358 | + * |
| 359 | + * @param $out Object: OutputPage instance |
| 360 | + * @param $sk Object: Skin (or descendant class) instance |
| 361 | + */ |
| 362 | +function wfWikiForumAddStyles( &$out, &$sk ) { |
| 363 | + static $cssDone = false; |
| 364 | + if ( !$cssDone ) { |
| 365 | + global $wgScriptPath; |
| 366 | + $out->addExtensionStyle( $wgScriptPath . '/extensions/WikiForum/styles.css' ); |
| 367 | + $cssDone = true; |
| 368 | + } |
| 369 | + return true; |
| 370 | +} |
\ No newline at end of file |
Property changes on: trunk/extensions/WikiForum/WikiForum.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 371 | + native |
Index: trunk/extensions/WikiForum/SpecialWikiForum.php |
— | — | @@ -0,0 +1,327 @@ |
| 2 | +<?php |
| 3 | +/** |
| 4 | + * Special:WikiForum -- an overview of all available boards on the forum |
| 5 | + * |
| 6 | + * @file |
| 7 | + * @ingroup Extensions |
| 8 | + */ |
| 9 | + |
| 10 | +class WikiForum extends SpecialPage { |
| 11 | + |
| 12 | + /** |
| 13 | + * Constructor -- set up the new special page |
| 14 | + */ |
| 15 | + public function __construct() { |
| 16 | + parent::__construct( 'WikiForum' ); |
| 17 | + } |
| 18 | + |
| 19 | + /** |
| 20 | + * Show the special page |
| 21 | + * |
| 22 | + * @param $par Mixed: parameter passed to the page or null |
| 23 | + */ |
| 24 | + public function execute( $par ) { |
| 25 | + global $wgOut, $wgUser, $wgRequest, $wgScriptPath; |
| 26 | + |
| 27 | + // If user is blocked, s/he doesn't need to access this page |
| 28 | + if ( $wgUser->isBlocked() ) { |
| 29 | + $wgOut->blockedPage(); |
| 30 | + return; |
| 31 | + } |
| 32 | + |
| 33 | + // Checking for wfReadOnly() is done in the individual functions |
| 34 | + // in WikiForumClass.php; besides, we should be able to browse the |
| 35 | + // forum even when the DB is in read-only mode |
| 36 | + |
| 37 | + $this->setHeaders(); |
| 38 | + |
| 39 | + $forum = new WikiForumClass; |
| 40 | + $values = array(); |
| 41 | + |
| 42 | + // Add CSS |
| 43 | + $wgOut->addExtensionStyle( $wgScriptPath . '/extensions/WikiForum/styles.css' ); |
| 44 | + |
| 45 | + // If a parameter to the special page is specified, check its type |
| 46 | + // and either display a forum (if parameter is a number) or a thread |
| 47 | + // (if it's the title of a topic) |
| 48 | + if ( $par ) { |
| 49 | + // Let search spiders index our content |
| 50 | + $wgOut->setRobotPolicy( 'index,follow' ); |
| 51 | + if ( is_numeric( $par ) ) { |
| 52 | + $wgOut->addHTML( $forum->showForum( $par ) ); |
| 53 | + } else { |
| 54 | + $threadId = WikiForumClass::findThreadIDByTitle( $par ); |
| 55 | + $wgOut->addHTML( $forum->showThread( $threadId ) ); |
| 56 | + } |
| 57 | + } else { |
| 58 | + // That's...a lot of variables. No kidding. |
| 59 | + $mod_category = $wgRequest->getInt( 'category' ); |
| 60 | + $mod_forum = $wgRequest->getInt( 'forum' ); |
| 61 | + $mod_thread = $wgRequest->getInt( 'thread' ); |
| 62 | + $mod_writethread = $wgRequest->getInt( 'writethread' ); |
| 63 | + $mod_addcomment = $wgRequest->getInt( 'addcomment' ); |
| 64 | + $mod_addthread = $wgRequest->getInt( 'addthread' ); |
| 65 | + $mod_editcomment = $wgRequest->getInt( 'editcomment' ); |
| 66 | + $mod_editthread = $wgRequest->getInt( 'editthread' ); |
| 67 | + $mod_deletecomment = $wgRequest->getInt( 'deletecomment' ); |
| 68 | + $mod_deletethread = $wgRequest->getInt( 'deletethread' ); |
| 69 | + $mod_closethread = $wgRequest->getInt( 'closethread' ); |
| 70 | + $mod_reopenthread = $wgRequest->getInt( 'reopenthread' ); |
| 71 | + $mod_addcategory = $wgRequest->getBool( 'addcategory' ); |
| 72 | + $mod_addforum = $wgRequest->getInt( 'addforum' ); |
| 73 | + $mod_editcategory = $wgRequest->getInt( 'editcategory' ); |
| 74 | + $mod_editforum = $wgRequest->getInt( 'editforum' ); |
| 75 | + $mod_deletecategory = $wgRequest->getInt( 'deletecategory' ); |
| 76 | + $mod_deleteforum = $wgRequest->getInt( 'deleteforum' ); |
| 77 | + $mod_makesticky = $wgRequest->getInt( 'makesticky' ); |
| 78 | + $mod_removesticky = $wgRequest->getInt( 'removesticky' ); |
| 79 | + $mod_categoryup = $wgRequest->getInt( 'categoryup' ); |
| 80 | + $mod_categorydown = $wgRequest->getInt( 'categorydown' ); |
| 81 | + $mod_forumup = $wgRequest->getInt( 'forumup' ); |
| 82 | + $mod_forumdown = $wgRequest->getInt( 'forumdown' ); |
| 83 | + $mod_search = $wgRequest->getVal( 'txtSearch' ); |
| 84 | + $mod_submit = $wgRequest->getBool( 'butSubmit' ); |
| 85 | + $mod_pastethread = $wgRequest->getInt( 'pastethread' ); |
| 86 | + |
| 87 | + // Define this variable to prevent E_NOTICEs about undefined variable |
| 88 | + $mod_none = false; |
| 89 | + |
| 90 | + // Figure out what we're going to do here...post a reply, a new thread, |
| 91 | + // edit a reply, edit a thread...and so on. |
| 92 | + if( isset( $mod_addcomment ) && $mod_addcomment > 0 ) { |
| 93 | + $data_text = $wgRequest->getVal( 'frmText' ); |
| 94 | + $data_preview = $wgRequest->getBool( 'butPreview' ); |
| 95 | + $data_save = $wgRequest->getBool( 'butSave' ); |
| 96 | + if( $data_save == true ) { |
| 97 | + $result = $forum->addReply( $mod_addcomment, $data_text ); |
| 98 | + $mod_thread = $mod_addcomment; |
| 99 | + } elseif( $data_preview == true ) { |
| 100 | + $result = $wgOut->addHTML( |
| 101 | + $forum->previewIssue( |
| 102 | + 'addcomment', |
| 103 | + $mod_addcomment, |
| 104 | + false, |
| 105 | + $data_text |
| 106 | + ) |
| 107 | + ); |
| 108 | + $mod_none = true; |
| 109 | + } |
| 110 | + } elseif( isset( $mod_addthread ) && $mod_addthread > 0 ) { |
| 111 | + $data_title = $wgRequest->getVal( 'frmTitle' ); |
| 112 | + $data_text = $wgRequest->getVal( 'frmText' ); |
| 113 | + $data_preview = $wgRequest->getBool( 'butPreview' ); |
| 114 | + $data_save = $wgRequest->getBool( 'butSave' ); |
| 115 | + if( $data_save == true ) { |
| 116 | + $result = $forum->addThread( |
| 117 | + $mod_addthread, |
| 118 | + $data_title, |
| 119 | + $data_text |
| 120 | + ); |
| 121 | + $mod_forum = $mod_addthread; |
| 122 | + } elseif( $data_preview == true ) { |
| 123 | + $result = $wgOut->addHTML( |
| 124 | + $forum->previewIssue( |
| 125 | + 'addthread', |
| 126 | + $mod_addthread, |
| 127 | + $data_title, |
| 128 | + $data_text |
| 129 | + ) |
| 130 | + ); |
| 131 | + $mod_none = true; |
| 132 | + } else { |
| 133 | + $mod_writethread = $mod_addthread; |
| 134 | + } |
| 135 | + } elseif( isset( $mod_editcomment ) && $mod_editcomment > 0 ) { |
| 136 | + $data_text = $wgRequest->getVal( 'frmText' ); |
| 137 | + $data_preview = $wgRequest->getBool( 'butPreview' ); |
| 138 | + $data_save = $wgRequest->getBool( 'butSave' ); |
| 139 | + if( $data_save == true ) { |
| 140 | + $result = $forum->editReply( |
| 141 | + $mod_editcomment, |
| 142 | + $data_text |
| 143 | + ); |
| 144 | + $mod_thread = $mod_thread; |
| 145 | + } elseif( $data_preview == true ) { |
| 146 | + $result = $wgOut->addHTML( |
| 147 | + $forum->previewIssue( |
| 148 | + 'editcomment', |
| 149 | + $mod_editcomment, |
| 150 | + false, |
| 151 | + $data_text |
| 152 | + ) |
| 153 | + ); |
| 154 | + $mod_none = true; |
| 155 | + } |
| 156 | + } elseif( isset( $mod_editthread ) && $mod_editthread > 0 ) { |
| 157 | + $data_title = $wgRequest->getVal( 'frmTitle' ); |
| 158 | + $data_text = $wgRequest->getVal( 'frmText' ); |
| 159 | + $data_preview = $wgRequest->getBool( 'butPreview' ); |
| 160 | + $data_save = $wgRequest->getBool( 'butSave' ); |
| 161 | + if( $data_save == true ) { |
| 162 | + $result = $forum->editThread( |
| 163 | + $mod_editthread, |
| 164 | + $data_title, |
| 165 | + $data_text |
| 166 | + ); |
| 167 | + $mod_thread = $mod_editthread; |
| 168 | + } elseif( $data_preview == true ) { |
| 169 | + $result = $wgOut->addHTML( |
| 170 | + $forum->previewIssue( |
| 171 | + 'editthread', |
| 172 | + $mod_editthread, |
| 173 | + $data_title, |
| 174 | + $data_text |
| 175 | + ) |
| 176 | + ); |
| 177 | + $mod_none = true; |
| 178 | + } else { |
| 179 | + $mod_writethread = $mod_editthread; |
| 180 | + } |
| 181 | + } elseif( isset( $mod_deletecomment ) && $mod_deletecomment > 0 ) { |
| 182 | + $result = $forum->deleteReply( $mod_deletecomment ); |
| 183 | + } elseif( isset( $mod_deletethread ) && $mod_deletethread > 0 ) { |
| 184 | + $result = $forum->deleteThread( $mod_deletethread ); |
| 185 | + } elseif( isset( $mod_deletecategory ) && $mod_deletecategory > 0 ) { |
| 186 | + $result = $forum->deleteCategory( $mod_deletecategory ); |
| 187 | + } elseif( isset( $mod_deleteforum ) && $mod_deleteforum > 0 ) { |
| 188 | + $result = $forum->deleteForum( $mod_deleteforum ); |
| 189 | + } elseif( isset( $mod_categoryup ) && $mod_categoryup > 0 ) { |
| 190 | + $result = $forum->sortKeys( $mod_categoryup, 'category', true ); |
| 191 | + } elseif( isset( $mod_categorydown ) && $mod_categorydown > 0 ) { |
| 192 | + $result = $forum->sortKeys( $mod_categorydown, 'category', false ); |
| 193 | + } elseif( isset( $mod_forumup ) && $mod_forumup > 0 ) { |
| 194 | + $result = $forum->sortKeys( $mod_forumup, 'forum', true ); |
| 195 | + } elseif( isset( $mod_forumdown ) && $mod_forumdown > 0 ) { |
| 196 | + $result = $forum->sortKeys( $mod_forumdown, 'forum', false ); |
| 197 | + } elseif( isset( $mod_closethread ) && $mod_closethread > 0 ) { |
| 198 | + $result = $forum->closeThread( $mod_closethread ); |
| 199 | + $mod_thread = $mod_closethread; |
| 200 | + } elseif( isset( $mod_reopenthread ) && $mod_reopenthread > 0 ) { |
| 201 | + $result = $forum->reopenThread( $mod_reopenthread ); |
| 202 | + $mod_thread = $mod_reopenthread; |
| 203 | + } elseif( isset( $mod_makesticky ) && $mod_makesticky > 0 ) { |
| 204 | + $result = $forum->makeSticky( $mod_makesticky, true ); |
| 205 | + $mod_thread = $mod_makesticky; |
| 206 | + } elseif( isset( $mod_removesticky ) && $mod_removesticky > 0 ) { |
| 207 | + $result = $forum->makeSticky( $mod_removesticky, false ); |
| 208 | + $mod_thread = $mod_removesticky; |
| 209 | + } elseif( isset( $mod_pastethread ) && $mod_pastethread > 0 ) { |
| 210 | + $result = $forum->pasteThread( $mod_pastethread, $mod_forum ); |
| 211 | + } elseif( |
| 212 | + isset( $mod_addcategory ) && $mod_addcategory == true && |
| 213 | + $wgUser->isAllowed( 'wikiforum-admin' ) |
| 214 | + ) |
| 215 | + { |
| 216 | + if( $mod_submit == true ) { |
| 217 | + $values['title'] = $wgRequest->getVal( 'frmTitle' ); |
| 218 | + $mod_submit = $forum->addCategory( $values['title'] ); |
| 219 | + } |
| 220 | + if( $mod_submit == false ) { |
| 221 | + $mod_showform = true; |
| 222 | + $type = 'addcategory'; |
| 223 | + $id = $mod_addcategory; |
| 224 | + } |
| 225 | + } elseif( |
| 226 | + isset( $mod_addforum ) && $mod_addforum > 0 && |
| 227 | + $wgUser->isAllowed( 'wikiforum-admin' ) |
| 228 | + ) |
| 229 | + { |
| 230 | + if( $mod_submit == true ) { |
| 231 | + $values['title'] = $wgRequest->getVal( 'frmTitle' ); |
| 232 | + $values['text'] = $wgRequest->getVal( 'frmText' ); |
| 233 | + if( $wgRequest->getBool( 'chkAnnouncement' ) == true ) { |
| 234 | + $values['announce'] = '1'; |
| 235 | + } else { |
| 236 | + $values['announce'] = '0'; |
| 237 | + } |
| 238 | + $mod_submit = $forum->addForum( |
| 239 | + $mod_addforum, |
| 240 | + $values['title'], |
| 241 | + $values['text'], |
| 242 | + $values['announce'] |
| 243 | + ); |
| 244 | + } |
| 245 | + if( $mod_submit == false ) { |
| 246 | + $mod_showform = true; |
| 247 | + $type = 'addforum'; |
| 248 | + $id = $mod_addforum; |
| 249 | + } |
| 250 | + } elseif( |
| 251 | + isset( $mod_editcategory ) && $mod_editcategory > 0 && |
| 252 | + $wgUser->isAllowed( 'wikiforum-admin' ) |
| 253 | + ) |
| 254 | + { |
| 255 | + if( $mod_submit == true ) { |
| 256 | + $values['title'] = $wgRequest->getVal( 'frmTitle' ); |
| 257 | + $mod_submit = $forum->editCategory( |
| 258 | + $mod_editcategory, |
| 259 | + $values['title'] |
| 260 | + ); |
| 261 | + } |
| 262 | + if( $mod_submit == false ) { |
| 263 | + $mod_showform = true; |
| 264 | + $type = 'editcategory'; |
| 265 | + $id = $mod_editcategory; |
| 266 | + } |
| 267 | + } elseif( |
| 268 | + isset( $mod_editforum ) && $mod_editforum > 0 && |
| 269 | + $wgUser->isAllowed( 'wikiforum-admin' ) |
| 270 | + ) |
| 271 | + { |
| 272 | + if( $mod_submit == true ) { |
| 273 | + $values['title'] = $wgRequest->getVal( 'frmTitle' ); |
| 274 | + $values['text'] = $wgRequest->getVal( 'frmText' ); |
| 275 | + if( $wgRequest->getBool( 'chkAnnouncement' ) == true ) { |
| 276 | + $values['announce'] = '1'; |
| 277 | + } else { |
| 278 | + $values['announce'] = '0'; |
| 279 | + } |
| 280 | + $mod_submit = $forum->editForum( |
| 281 | + $mod_editforum, |
| 282 | + $values['title'], |
| 283 | + $values['text'], |
| 284 | + $values['announce'] |
| 285 | + ); |
| 286 | + } |
| 287 | + if( $mod_submit == false ) { |
| 288 | + $mod_showform = true; |
| 289 | + $type = 'editforum'; |
| 290 | + $id = $mod_editforum; |
| 291 | + } |
| 292 | + } |
| 293 | + |
| 294 | + // Only in certain cases we want search spiders to index our content |
| 295 | + // and follow links. These are overview (Special:WikiForum), individual |
| 296 | + // threads, forums and categories. |
| 297 | + if( isset( $mod_search ) && $mod_search == true ) { |
| 298 | + $wgOut->addHTML( $forum->showSearchResults( $mod_search ) ); |
| 299 | + } elseif( $mod_none == true ) { |
| 300 | + // no data |
| 301 | + } elseif( isset( $mod_category ) && $mod_category > 0 ) { |
| 302 | + // Let search spiders index our content |
| 303 | + $wgOut->setRobotPolicy( 'index,follow' ); |
| 304 | + $wgOut->addHTML( $forum->showCategory( $mod_category ) ); |
| 305 | + } elseif( isset( $mod_forum ) && $mod_forum > 0 ) { |
| 306 | + // Let search spiders index our content |
| 307 | + $wgOut->setRobotPolicy( 'index,follow' ); |
| 308 | + $wgOut->addHTML( $forum->showForum( $mod_forum ) ); |
| 309 | + } elseif( isset( $mod_thread ) && $mod_thread > 0 ) { |
| 310 | + // Let search spiders index our content |
| 311 | + $wgOut->setRobotPolicy( 'index,follow' ); |
| 312 | + $wgOut->addHTML( $forum->showThread( $mod_thread ) ); |
| 313 | + } elseif( isset( $mod_writethread ) && $mod_writethread > 0 ) { |
| 314 | + $wgOut->addHTML( $forum->writeThread( $mod_writethread ) ); |
| 315 | + } elseif( isset( $mod_showform ) && $mod_showform ) { |
| 316 | + $wgOut->addHTML( |
| 317 | + $forum->showEditorCatForum( $id, $type, $values ) |
| 318 | + ); |
| 319 | + } else { |
| 320 | + // Let search spiders index our content |
| 321 | + $wgOut->setRobotPolicy( 'index,follow' ); |
| 322 | + $wgOut->addHTML( $forum->showOverview() ); |
| 323 | + } |
| 324 | + } // else from line 55 (the if $par is not specified one) |
| 325 | + |
| 326 | + } // execute() |
| 327 | + |
| 328 | +} |
\ No newline at end of file |
Property changes on: trunk/extensions/WikiForum/SpecialWikiForum.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 329 | + native |
Index: trunk/extensions/WikiForum/WikiForumGui.php |
— | — | @@ -0,0 +1,354 @@ |
| 2 | +<?php |
| 3 | +/** |
| 4 | + * Graphical User Interface (GUI) methods used by WikiForum extension. |
| 5 | + * |
| 6 | + * All class methods are public and static. |
| 7 | + * |
| 8 | + * @file |
| 9 | + * @ingroup Extensions |
| 10 | + */ |
| 11 | +class WikiForumGui { |
| 12 | + |
| 13 | + public static function getFrameHeader() { |
| 14 | + return '<table class="mw-wikiforum-frame" cellspacing="10"><tr><td class="mw-wikiforum-innerframe">'; |
| 15 | + } |
| 16 | + |
| 17 | + public static function getFrameFooter() { |
| 18 | + return '</td></tr></table>'; |
| 19 | + } |
| 20 | + |
| 21 | + public static function getSearchbox() { |
| 22 | + global $wgScriptPath; |
| 23 | + |
| 24 | + $specialPageObj = SpecialPage::getTitleFor( 'WikiForum' ); |
| 25 | + |
| 26 | + $icon = '<img src="' . $wgScriptPath . '/extensions/WikiForum/icons/zoom.png" id="searchbox_picture" title="' . wfMsg( 'search' ) . '" />'; |
| 27 | + |
| 28 | + $output = '<div id="searchbox"><form method="post" action="' . $specialPageObj->escapeFullURL() . '">' . |
| 29 | + '<div id="searchbox_border">' . $icon . |
| 30 | + '<input type="text" value="" name="txtSearch" id="txtSearch" /></div> |
| 31 | + </form></div>'; |
| 32 | + |
| 33 | + return $output; |
| 34 | + } |
| 35 | + |
| 36 | + /** |
| 37 | + * Builds the header row -- the breadcrumb navigation |
| 38 | + * (Overview > Category name > Forum) |
| 39 | + * |
| 40 | + * @todo FIXME: would be nice to add > Topic name to the navigation, too |
| 41 | + */ |
| 42 | + public static function getHeaderRow( $catId, $catName, $forumId, $forumName, $additionalLinks ) { |
| 43 | + global $wgUser, $wgWikiForumAllowAnonymous; |
| 44 | + |
| 45 | + $output = '<table class="mw-wikiforum-headerrow"><tr><td class="mw-wikiforum-leftside">'; |
| 46 | + if( |
| 47 | + strlen( $additionalLinks ) == 0 || |
| 48 | + $catId > 0 && strlen( $catName ) > 0 |
| 49 | + ) |
| 50 | + { |
| 51 | + $specialPageObj = SpecialPage::getTitleFor( 'WikiForum' ); |
| 52 | + $output .= '<a href="' . $specialPageObj->escapeFullURL() . '">' . |
| 53 | + wfMsg( 'wikiforum-overview' ) . '</a>'; |
| 54 | + if( $catId > 0 && strlen( $catName ) > 0 ) { |
| 55 | + $output .= ' > <a href="' . |
| 56 | + $specialPageObj->escapeFullURL( 'category=' . $catId ) . '">' . |
| 57 | + $catName . '</a>'; |
| 58 | + } |
| 59 | + if( $forumId > 0 && strlen( $forumName ) > 0 ) { |
| 60 | + $output .= ' > <a href="' . $specialPageObj->escapeFullURL( 'forum=' . $forumId ) . '">' . $forumName . '</a>'; |
| 61 | + } |
| 62 | + } |
| 63 | + if( |
| 64 | + strlen( $additionalLinks ) > 0 && |
| 65 | + ( $wgWikiForumAllowAnonymous || $wgUser->getId() > 0 ) |
| 66 | + ) |
| 67 | + { |
| 68 | + $output .= '</td><td class="mw-wikiforum-rightside">' . $additionalLinks; |
| 69 | + } |
| 70 | + $output .= '</td></tr></table>'; |
| 71 | + return $output; |
| 72 | + } |
| 73 | + |
| 74 | + /** |
| 75 | + * Gets the footer row, in other words: pagination links. |
| 76 | + * |
| 77 | + * @param $page Integer: number of the current page |
| 78 | + * @param $maxissues Integer: amount of replies, fetched from the DB |
| 79 | + * @param $limit Integer: limit; this is also used for the SQL query |
| 80 | + * @param $forumId Integer: forum ID number, so that the pagination code |
| 81 | + * knows where it's going... |
| 82 | + * @return HTML |
| 83 | + */ |
| 84 | + public static function getFooterRow( $page, $maxissues, $limit, $forumId ) { |
| 85 | + $output = ''; |
| 86 | + $specialPage = SpecialPage::getTitleFor( 'WikiForum' ); |
| 87 | + |
| 88 | + if( $maxissues / $limit > 1 ) { |
| 89 | + $output = '<table class="mw-wikiforum-footerrow"><tr><td class="mw-wikiforum-leftside">' . |
| 90 | + wfMsg( 'wikiforum-pages' ) . wfMsg( 'word-separator' ); |
| 91 | + for( $i = 1; $i < ( $maxissues / $limit ) + 1; $i++ ) { |
| 92 | + if( $i != $page + 1 ) { |
| 93 | + $output .= '<a href="' . $specialPage->escapeFullURL( array( 'lp' => $i, 'forum' => $forumId ) ) . '">'; |
| 94 | + } else { |
| 95 | + $output .= '['; |
| 96 | + } |
| 97 | + |
| 98 | + if( $i <= 9 ) { |
| 99 | + $output .= '0' . $i; |
| 100 | + } else { |
| 101 | + $output .= $i; |
| 102 | + } |
| 103 | + |
| 104 | + if( $i != $page + 1 ) { |
| 105 | + $output .= '</a>'; |
| 106 | + } else { |
| 107 | + $output .= ']'; |
| 108 | + } |
| 109 | + |
| 110 | + $output .= wfMsg( 'word-separator' ); |
| 111 | + } |
| 112 | + $output .= '</td><td class="mw-wikiforum-rightside">'; |
| 113 | + $output .= '</td></tr></table>'; |
| 114 | + } |
| 115 | + return $output; |
| 116 | + } |
| 117 | + |
| 118 | + public static function getMainHeader( $title1, $title2, $title3, $title4, $title5 ) { |
| 119 | + return self::getFrameHeader() . '<table class="mw-wikiforum-title">' . |
| 120 | + self::getMainHeaderRow( |
| 121 | + $title1, $title2, $title3, |
| 122 | + $title4, $title5 |
| 123 | + ); |
| 124 | + } |
| 125 | + |
| 126 | + public static function getMainPageHeader( $title1, $title2, $title3, $title4 ) { |
| 127 | + return '<table class="mw-wikiforum-mainpage" cellspacing="0">' . |
| 128 | + self::getMainHeaderRow( |
| 129 | + $title1, $title2, |
| 130 | + $title3, $title4, false |
| 131 | + ); |
| 132 | + } |
| 133 | + |
| 134 | + public static function getMainHeaderRow( $title1, $title2, $title3, $title4, $title5 ) { |
| 135 | + $output = '<tr class="mw-wikiforum-title"> |
| 136 | + <th class="mw-wikiforum-title">' . $title1 . '</th>'; |
| 137 | + if( $title5 ) { |
| 138 | + $output .= '<th class="mw-wikiforum-admin"><p class="mw-wikiforum-valuetitle">' . |
| 139 | + $title5 . '</p></th>'; |
| 140 | + } |
| 141 | + $output .= ' |
| 142 | + <th class="mw-wikiforum-value"><p class="mw-wikiforum-valuetitle">' . $title2 . '</p></th> |
| 143 | + <th class="mw-wikiforum-value"><p class="mw-wikiforum-valuetitle">' . $title3 . '</p></th> |
| 144 | + <th class="mw-wikiforum-lastpost"><p class="mw-wikiforum-valuetitle">' . $title4 . '</p></th></tr>'; |
| 145 | + return $output; |
| 146 | + } |
| 147 | + |
| 148 | + public static function getMainBody( $col_value1, $col_value2, $col_value3, $col_value4, $col_title5, $marked ) { |
| 149 | + $output = '<tr class="mw-wikiforum-'; |
| 150 | + if( $marked ) { |
| 151 | + $output .= $marked; |
| 152 | + } else { |
| 153 | + $output .= 'normal'; |
| 154 | + } |
| 155 | + $output .= '"><td class="mw-wikiforum-title">' . $col_value1 . '</td>'; |
| 156 | + if( $col_title5 ) { |
| 157 | + $output .= '<td class="mw-wikiforum-admin">' . $col_title5 . '</td>'; |
| 158 | + } |
| 159 | + $output .= ' |
| 160 | + <td class="mw-wikiforum-value">' . $col_value2 . '</td> |
| 161 | + <td class="mw-wikiforum-value">' . $col_value3 . '</td> |
| 162 | + <td class="mw-wikiforum-value">' . $col_value4 . '</td></tr>'; |
| 163 | + return $output; |
| 164 | + } |
| 165 | + |
| 166 | + public static function getMainFooter() { |
| 167 | + return '</table>' . self::getFrameFooter(); |
| 168 | + } |
| 169 | + |
| 170 | + public static function getMainPageFooter() { |
| 171 | + return '</table>'; |
| 172 | + } |
| 173 | + |
| 174 | + /** |
| 175 | + * Get the thread header. This is used only for the starting post. |
| 176 | + * |
| 177 | + * @param $title |
| 178 | + * @param $text String: thread text |
| 179 | + * @param $posted |
| 180 | + * @param $buttons |
| 181 | + * @param $id Integer: internal post ID number |
| 182 | + * @param $userId Integer: if supplied, and if wAvatar class (social tools) |
| 183 | + * exists, this will be used to get the poster's |
| 184 | + * avatar image |
| 185 | + */ |
| 186 | + public static function getThreadHeader( $title, $text, $posted, $buttons, $id, $userId ) { |
| 187 | + $avatar = ''; |
| 188 | + if ( $userId && class_exists( 'wAvatar' ) ) { |
| 189 | + $avatarObj = new wAvatar( $userId, 'l' ); |
| 190 | + $avatar = '<div class="wikiforum-avatar-image">'; |
| 191 | + $avatar .= $avatarObj->getAvatarURL(); |
| 192 | + $avatar .= '</div>'; |
| 193 | + } |
| 194 | + return self::getFrameHeader() . ' |
| 195 | + <table style="width:100%"> |
| 196 | + <tr> |
| 197 | + <th class="mw-wikiforum-thread-top" style="text-align: right;">[#' . $id . ']</th> |
| 198 | + </tr> |
| 199 | + <tr> |
| 200 | + <td class="mw-wikiforum-thread-main" colspan="2">' . $avatar . |
| 201 | + $text . self::getBottomLine( $posted, $buttons ) . ' |
| 202 | + </td> |
| 203 | + </tr>'; |
| 204 | + } |
| 205 | + |
| 206 | + public static function getReplyHeader( $title ) { |
| 207 | + return self::getFrameHeader() . ' |
| 208 | + <table style="width:100%"> |
| 209 | + <tr> |
| 210 | + <th class="mw-wikiforum-thread-top" colspan="2">' . |
| 211 | + $title . |
| 212 | + '</th> |
| 213 | + </tr>'; |
| 214 | + } |
| 215 | + |
| 216 | + public static function getThreadFooter() { |
| 217 | + return '</table>' . self::getFrameFooter(); |
| 218 | + } |
| 219 | + |
| 220 | + public static function getReply( $reply, $posted, $buttons, $id, $userId ) { |
| 221 | + $avatar = ''; |
| 222 | + if ( $userId && class_exists( 'wAvatar' ) ) { |
| 223 | + $avatarObj = new wAvatar( $userId, 'l' ); |
| 224 | + $avatar = '<div class="wikiforum-avatar-image">'; |
| 225 | + $avatar .= $avatarObj->getAvatarURL(); |
| 226 | + $avatar .= '</div>'; |
| 227 | + } |
| 228 | + return '<tr><td class="mw-wikiforum-thread-sub" colspan="2" id="reply_' . intval( $id ) . '">' . $avatar . |
| 229 | + $reply . self::getBottomLine( $posted, $buttons ) . '</td></tr>'; |
| 230 | + } |
| 231 | + |
| 232 | + public static function getBottomLine( $posted, $buttons ) { |
| 233 | + global $wgUser; |
| 234 | + |
| 235 | + $output = '<table cellspacing="0" cellpadding="0" class="mw-wikiforum-posted">' . |
| 236 | + '<tr><td class="mw-wikiforum-leftside">' . $posted . '</td>'; |
| 237 | + |
| 238 | + if( $wgUser->isLoggedIn() ) { |
| 239 | + $output .= '<td class="mw-wikiforum-rightside">' . $buttons . '</td>'; |
| 240 | + } |
| 241 | + |
| 242 | + $output .= '</tr></table>'; |
| 243 | + |
| 244 | + return $output; |
| 245 | + } |
| 246 | + |
| 247 | + public static function getSingleLine( $message, $cols ) { |
| 248 | + return '<tr class="sub"><td class="mw-wikiforum-title" colspan="' . intval( $cols ) . '">' . |
| 249 | + $message . '</td></tr>'; |
| 250 | + } |
| 251 | + |
| 252 | + public static function getWriteForm( $type, $action, $input, $height, $text_prev, $saveButton ) { |
| 253 | + global $wgOut, $wgUser, $wgScriptPath, $wgWikiForumAllowAnonymous; |
| 254 | + |
| 255 | + $output = ''; |
| 256 | + |
| 257 | + if( $wgWikiForumAllowAnonymous || $wgUser->isLoggedIn() ) { |
| 258 | + // Required for the edit buttons to display |
| 259 | + $wgOut->addScriptFile( 'edit.js' ); |
| 260 | + $toolbar = EditPage::getEditToolbar(); |
| 261 | + $specialPage = SpecialPage::getTitleFor( 'WikiForum' ); |
| 262 | + |
| 263 | + $output = '<form name="frmMain" method="post" action="' . $specialPage->escapeFullURL( $action ) . '" id="writereply"> |
| 264 | + <table class="mw-wikiforum-frame" cellspacing="10">' . $input . ' |
| 265 | + <tr> |
| 266 | + <td>' . $toolbar . '</td> |
| 267 | + </tr> |
| 268 | + <tr> |
| 269 | + <td><textarea name="frmText" style="height: ' . $height . ';">' . $text_prev . '</textarea></td> |
| 270 | + </tr> |
| 271 | + <tr> |
| 272 | + <td> |
| 273 | + <input name="butSave" type="submit" value="' . $saveButton . '" accesskey="s" title="' . $saveButton . ' [s]" /> |
| 274 | + <input name="butPreview" type="submit" value="' . wfMsg( 'preview' ) . '" accesskey="p" title="' . wfMsg( 'preview' ) . ' [p]" />'; |
| 275 | + if( $type == 'addthread' ) { |
| 276 | + $output .= ' <input name="butCancel" type="button" value="' . wfMsg( 'cancel' ) . '" accesskey="c" onclick="javascript:history.back();" title="' . wfMsg( 'cancel' ) . ' [c]" />'; |
| 277 | + } |
| 278 | + $output .= '</td> |
| 279 | + </td> |
| 280 | + </tr> |
| 281 | + </table> |
| 282 | + </form>' . "\n"; |
| 283 | + } |
| 284 | + return $output; |
| 285 | + } |
| 286 | + |
| 287 | + /** |
| 288 | + * Get the form for adding/editing categories and forums. |
| 289 | + * |
| 290 | + * @param $type |
| 291 | + * @param $categoryName |
| 292 | + * @param $action Array: URL parameters (like array( 'foo' => 'bar' ) or so) |
| 293 | + * @param $title_prev |
| 294 | + * @param $text_prev |
| 295 | + * @param $saveButton |
| 296 | + */ |
| 297 | + public static function getFormCatForum( $type, $categoryName, $action, $title_prev, $text_prev, $saveButton, $overviewObj ) { |
| 298 | + global $wgUser; |
| 299 | + |
| 300 | + if( $wgUser->isAllowed( 'wikiforum-admin' ) ) { |
| 301 | + $title_prev = str_replace( '"', '"', $title_prev ); |
| 302 | + $specialPage = SpecialPage::getTitleFor( 'WikiForum' ); |
| 303 | + $output = ' |
| 304 | + <form name="frmMain" method="post" action="' . $specialPage->escapeFullURL( $action ) . '" id="form"> |
| 305 | + <table class="mw-wikiforum-frame" cellspacing="10"> |
| 306 | + <tr> |
| 307 | + <th class="mw-wikiforum-title">' . $categoryName . '</th> |
| 308 | + </tr> |
| 309 | + <tr> |
| 310 | + <td> |
| 311 | + <p>' . wfMsg( 'wikiforum-name' ) . '</p> |
| 312 | + <input type="text" name="frmTitle" style="width: 100%" value="' . $title_prev . '" /> |
| 313 | + </td> |
| 314 | + </tr>'; |
| 315 | + if( $type == 'addforum' || $type == 'editforum' ) { |
| 316 | + $check = ''; |
| 317 | + if ( is_object( $overviewObj ) && $overviewObj->wff_announcement == true ) { |
| 318 | + $check = 'checked="checked"'; |
| 319 | + } |
| 320 | + $output .= '<tr> |
| 321 | + <td> |
| 322 | + <p>' . wfMsg( 'wikiforum-description' ) . '</p> |
| 323 | + <textarea name="frmText" style="height: 40px;">' . $text_prev . '</textarea> |
| 324 | + </td> |
| 325 | + </tr> |
| 326 | + <tr> |
| 327 | + <td> |
| 328 | + <p><input type="checkbox" name="chkAnnouncement"' . $check . '/> ' . |
| 329 | + wfMsg( 'wikiforum-announcement-only-description' ) . |
| 330 | + '</p> |
| 331 | + </td> |
| 332 | + </tr>'; |
| 333 | + } |
| 334 | + $output .= ' |
| 335 | + <tr> |
| 336 | + <td> |
| 337 | + <input name="butSubmit" type="submit" value="' . $saveButton . '" accesskey="s" title="' . $saveButton . ' [s]" /> |
| 338 | + <input name="butCancel" type="button" value="' . wfMsg( 'cancel' ) . '" accesskey="c" onclick="javascript:history.back();" title="' . wfMsg( 'cancel' ) . ' [c]" /> |
| 339 | + </td> |
| 340 | + </tr> |
| 341 | + </table> |
| 342 | + </form> |
| 343 | + '; |
| 344 | + return $output; |
| 345 | + } else { |
| 346 | + return ''; |
| 347 | + } |
| 348 | + } |
| 349 | + |
| 350 | + public static function getInput( $title_prev ) { |
| 351 | + $title_prev = str_replace( '"', '"', $title_prev ); |
| 352 | + return '<tr><td><input type="text" name="frmTitle" style="width:100%" value="' . $title_prev . '" /></td></tr>'; |
| 353 | + } |
| 354 | + |
| 355 | +} |
\ No newline at end of file |
Property changes on: trunk/extensions/WikiForum/WikiForumGui.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 356 | + native |
Index: trunk/extensions/WikiForum/WikiForumClass.php |
— | — | @@ -0,0 +1,2514 @@ |
| 2 | +<?php |
| 3 | +/** |
| 4 | + * Main class for WikiForum extension, contains all the logic to manage forums, |
| 5 | + * categories, individual topics, etc. |
| 6 | + * |
| 7 | + * @file |
| 8 | + * @ingroup Extensions |
| 9 | + */ |
| 10 | +class WikiForumClass { |
| 11 | + private $result = true; // boolean; if true, everything went well |
| 12 | + |
| 13 | + private $errorTitle = ''; // error page title |
| 14 | + private $errorIcon = ''; // error icon name |
| 15 | + private $errorMessage = ''; // error message |
| 16 | + |
| 17 | + /** |
| 18 | + * Find a thread's ID number when you know the title. |
| 19 | + * |
| 20 | + * @param $titleText String: thread title |
| 21 | + * @return Integer: thread ID number |
| 22 | + */ |
| 23 | + public static function findThreadIDByTitle( $titleText ) { |
| 24 | + // Titles are stored with spaces in the DB but the query will otherwise |
| 25 | + // use friggin' underscores... |
| 26 | + $titleText = str_replace( '_', ' ', $titleText ); |
| 27 | + |
| 28 | + $dbr = wfGetDB( DB_SLAVE ); |
| 29 | + $res = $dbr->selectRow( |
| 30 | + 'wikiforum_threads', |
| 31 | + 'wft_thread', |
| 32 | + // Database::makeList calls Database::addQuotes so that we don't |
| 33 | + // need to do it here yet this still is safe |
| 34 | + array( 'wft_thread_name' => $titleText ), |
| 35 | + __METHOD__ |
| 36 | + ); |
| 37 | + |
| 38 | + if ( $res ) { |
| 39 | + $threadId = $res->wft_thread; |
| 40 | + } else { |
| 41 | + // Something went wrong... |
| 42 | + $threadId = 0; |
| 43 | + } |
| 44 | + return $threadId; |
| 45 | + } |
| 46 | + |
| 47 | + /** |
| 48 | + * Deletes the reply with ID = $replyId. |
| 49 | + * |
| 50 | + * @param $replyId Integer: ID number of the reply to delete |
| 51 | + * @return Boolean: was reply deletion successful or not? |
| 52 | + */ |
| 53 | + function deleteReply( $replyId ) { |
| 54 | + global $wgUser; |
| 55 | + |
| 56 | + $dbr = wfGetDB( DB_SLAVE ); |
| 57 | + |
| 58 | + $reply = $dbr->fetchObject( $dbr->select( |
| 59 | + 'wikiforum_replies', |
| 60 | + array( 'wfr_reply_id', 'wfr_user' ), |
| 61 | + array( 'wfr_deleted' => 0, 'wfr_reply_id' => intval( $replyId ) ), |
| 62 | + __METHOD__ |
| 63 | + )); |
| 64 | + |
| 65 | + if( |
| 66 | + $reply->wfr_reply_id > 0 && $wgUser->getId() > 0 && |
| 67 | + ( |
| 68 | + $wgUser->getId() == $reply->wfr_user || |
| 69 | + $wgUser->isAllowed( 'wikiforum-moderator' ) |
| 70 | + ) && |
| 71 | + !wfReadOnly() |
| 72 | + ) |
| 73 | + { |
| 74 | + $dbw = wfGetDB( DB_MASTER ); |
| 75 | + $result = $dbw->update( |
| 76 | + 'wikiforum_replies', |
| 77 | + array( |
| 78 | + 'wfr_deleted' => wfTimestampNow(), |
| 79 | + 'wfr_deleted_user' => $wgUser->getId(), |
| 80 | + ), |
| 81 | + array( |
| 82 | + 'wfr_reply_id' => $reply->wfr_reply_id |
| 83 | + ), |
| 84 | + __METHOD__ |
| 85 | + ); |
| 86 | + } else { |
| 87 | + $result = false; |
| 88 | + } |
| 89 | + |
| 90 | + if( $result == false ) { |
| 91 | + $this->errorTitle = wfMsg( 'wikiforum-error-delete' ); |
| 92 | + $this->errorMessage = wfMsg( 'wikiforum-error-general' ); |
| 93 | + } |
| 94 | + return $result; |
| 95 | + } |
| 96 | + |
| 97 | + /** |
| 98 | + * Deletes the thread with ID = $threadId. |
| 99 | + * |
| 100 | + * @param $threadId Integer: ID number of the thread to delete |
| 101 | + * @return Boolean: was thread deletion successful or not? |
| 102 | + */ |
| 103 | + function deleteThread( $threadId ) { |
| 104 | + global $wgUser; |
| 105 | + |
| 106 | + $dbr = wfGetDB( DB_SLAVE ); |
| 107 | + |
| 108 | + $thread = $dbr->fetchObject( $dbr->select( |
| 109 | + 'wikiforum_threads', |
| 110 | + array( 'wft_thread', 'wft_user' ), |
| 111 | + array( 'wft_deleted' => 0, 'wft_thread' => intval( $threadId ) ), |
| 112 | + __METHOD__ |
| 113 | + )); |
| 114 | + |
| 115 | + if( |
| 116 | + $thread->wft_thread > 0 && $wgUser->getId() > 0 && |
| 117 | + ( $wgUser->getId() == $thread->wft_user || $wgUser->isAllowed( 'wikiforum-moderator' ) ) && |
| 118 | + !wfReadOnly() |
| 119 | + ) |
| 120 | + { |
| 121 | + $dbw = wfGetDB( DB_MASTER ); |
| 122 | + $result = $dbw->update( |
| 123 | + 'wikiforum_threads', |
| 124 | + array( |
| 125 | + 'wft_deleted' => wfTimestampNow(), |
| 126 | + 'wft_deleted_user' => $wgUser->getId(), |
| 127 | + ), |
| 128 | + array( |
| 129 | + 'wft_thread' => $thread->wft_thread |
| 130 | + ), |
| 131 | + __METHOD__ |
| 132 | + ); |
| 133 | + } else { |
| 134 | + $result = false; |
| 135 | + } |
| 136 | + |
| 137 | + if( $result == false ) { |
| 138 | + $this->errorTitle = wfMsg( 'wikiforum-error-delete' ); |
| 139 | + $this->errorMessage = wfMsg( 'wikiforum-error-general' ); |
| 140 | + } |
| 141 | + return $result; |
| 142 | + } |
| 143 | + |
| 144 | + /** |
| 145 | + * Deletes the category with ID = $categoryId. |
| 146 | + * |
| 147 | + * @param $categoryId Integer: ID number of the category to delete |
| 148 | + * @return Boolean: was category deletion successful or not? |
| 149 | + */ |
| 150 | + function deleteCategory( $categoryId ) { |
| 151 | + global $wgUser; |
| 152 | + |
| 153 | + if( |
| 154 | + $wgUser->isAllowed( 'wikiforum-admin' ) && |
| 155 | + !wfReadOnly() |
| 156 | + ) |
| 157 | + { |
| 158 | + $dbw = wfGetDB( DB_MASTER ); |
| 159 | + $result = $dbw->update( |
| 160 | + 'wikiforum_category', |
| 161 | + array( |
| 162 | + 'wfc_deleted' => wfTimestampNow(), |
| 163 | + 'wfc_deleted_user' => $wgUser->getId(), |
| 164 | + ), |
| 165 | + array( |
| 166 | + 'wfc_category' => intval( $categoryId ) |
| 167 | + ), |
| 168 | + __METHOD__ |
| 169 | + ); |
| 170 | + } else { |
| 171 | + $result = false; |
| 172 | + } |
| 173 | + |
| 174 | + if( $result == false ) { |
| 175 | + $this->errorTitle = wfMsg( 'wikiforum-error-delete' ); |
| 176 | + $this->errorMessage = wfMsg( 'wikiforum-error-general' ); |
| 177 | + } |
| 178 | + return $result; |
| 179 | + } |
| 180 | + |
| 181 | + /** |
| 182 | + * Deletes the forum with ID = $forumId. |
| 183 | + * |
| 184 | + * @param $forumId Integer: ID number of the forum to delete |
| 185 | + * @return Boolean: was forum deletion successful or not? |
| 186 | + */ |
| 187 | + function deleteForum( $forumId ) { |
| 188 | + global $wgUser; |
| 189 | + |
| 190 | + if( |
| 191 | + $wgUser->isAllowed( 'wikiforum-admin' ) && |
| 192 | + !wfReadOnly() |
| 193 | + ) |
| 194 | + { |
| 195 | + $dbw = wfGetDB( DB_MASTER ); |
| 196 | + $result = $dbw->update( |
| 197 | + 'wikiforum_forums', |
| 198 | + array( |
| 199 | + 'wff_deleted' => wfTimestampNow(), |
| 200 | + 'wff_deleted_user' => $wgUser->getId(), |
| 201 | + ), |
| 202 | + array( |
| 203 | + 'wff_forum' => intval( $forumId ) |
| 204 | + ), |
| 205 | + __METHOD__ |
| 206 | + ); |
| 207 | + } else { |
| 208 | + $result = false; |
| 209 | + } |
| 210 | + |
| 211 | + if( $result == false ) { |
| 212 | + $this->errorTitle = wfMsg( 'wikiforum-error-delete' ); |
| 213 | + $this->errorMessage = wfMsg( 'wikiforum-error-general' ); |
| 214 | + } |
| 215 | + return $result; |
| 216 | + } |
| 217 | + |
| 218 | + /** |
| 219 | + * Reopens the thread with ID = $threadId. |
| 220 | + * |
| 221 | + * @param $threadId Integer: ID number of the thread to reopen |
| 222 | + * @return Boolean: was thread reopening successful or not? |
| 223 | + */ |
| 224 | + function reopenThread( $threadId ) { |
| 225 | + global $wgUser; |
| 226 | + |
| 227 | + $dbr = wfGetDB( DB_SLAVE ); |
| 228 | + |
| 229 | + $thread = $dbr->selectRow( |
| 230 | + 'wikiforum_threads', |
| 231 | + 'wft_thread', |
| 232 | + array( |
| 233 | + 'wft_closed > 0', |
| 234 | + 'wft_deleted' => 0, |
| 235 | + 'wft_thread' => intval( $threadId ) |
| 236 | + ), |
| 237 | + __METHOD__ |
| 238 | + ); |
| 239 | + |
| 240 | + if( |
| 241 | + $thread->wft_thread > 0 && |
| 242 | + $wgUser->isAllowed( 'wikiforum-moderator' ) && |
| 243 | + !wfReadOnly() |
| 244 | + ) |
| 245 | + { |
| 246 | + $dbw = wfGetDB( DB_MASTER ); |
| 247 | + $result = $dbw->update( |
| 248 | + 'wikiforum_threads', |
| 249 | + array( |
| 250 | + 'wft_closed' => 0, |
| 251 | + 'wft_closed_user' => 0 |
| 252 | + ), |
| 253 | + array( 'wft_thread' => $thread->wft_thread ), |
| 254 | + __METHOD__ |
| 255 | + ); |
| 256 | + } else { |
| 257 | + $result = false; |
| 258 | + } |
| 259 | + |
| 260 | + if( $result == false ) { |
| 261 | + $this->errorTitle = wfMsg( 'wikiforum-error-thread-reopen' ); |
| 262 | + $this->errorMessage = wfMsg( 'wikiforum-error-general' ); |
| 263 | + } |
| 264 | + return $result; |
| 265 | + } |
| 266 | + |
| 267 | + /** |
| 268 | + * Closes the thread with ID = $threadId. |
| 269 | + * |
| 270 | + * @param $threadId Integer: ID number of the thread to close |
| 271 | + * @return Boolean: was thread closed successfully or not? |
| 272 | + */ |
| 273 | + function closeThread( $threadId ) { |
| 274 | + global $wgUser; |
| 275 | + |
| 276 | + $dbr = wfGetDB( DB_SLAVE ); |
| 277 | + |
| 278 | + $thread = $dbr->selectRow( |
| 279 | + 'wikiforum_threads', |
| 280 | + 'wft_thread', |
| 281 | + array( |
| 282 | + 'wft_closed' => 0, |
| 283 | + 'wft_deleted' => 0, |
| 284 | + 'wft_thread' => intval( $threadId ) |
| 285 | + ), |
| 286 | + __METHOD__ |
| 287 | + ); |
| 288 | + |
| 289 | + if( |
| 290 | + $thread->wft_thread > 0 && |
| 291 | + $wgUser->isAllowed( 'wikiforum-moderator' ) && |
| 292 | + !wfReadOnly() |
| 293 | + ) |
| 294 | + { |
| 295 | + $dbw = wfGetDB( DB_MASTER ); |
| 296 | + $result = $dbw->update( |
| 297 | + 'wikiforum_threads', |
| 298 | + array( |
| 299 | + 'wft_closed' => wfTimestampNow(), |
| 300 | + 'wft_closed_user' => $wgUser->getId() |
| 301 | + ), |
| 302 | + array( 'wft_thread' => intval( $thread->wft_thread ) ), |
| 303 | + __METHOD__ |
| 304 | + ); |
| 305 | + } else { |
| 306 | + $result = false; |
| 307 | + } |
| 308 | + |
| 309 | + if( $result == false ) { |
| 310 | + $this->errorTitle = wfMsg( 'wikiforum-error-thread-close' ); |
| 311 | + $this->errorMessage = wfMsg( 'wikiforum-error-general' ); |
| 312 | + } |
| 313 | + return $result; |
| 314 | + } |
| 315 | + |
| 316 | + /** |
| 317 | + * Makes the thread with ID = $threadId sticky. |
| 318 | + * |
| 319 | + * @param $threadId Integer: ID number of the thread to mark as sticky |
| 320 | + * @param $value |
| 321 | + * @return Boolean: was thread deletion successful or not? |
| 322 | + */ |
| 323 | + function makeSticky( $threadId, $value ) { |
| 324 | + global $wgUser; |
| 325 | + |
| 326 | + $dbr = wfGetDB( DB_SLAVE ); |
| 327 | + |
| 328 | + $thread = $dbr->fetchObject( $dbr->select( |
| 329 | + 'wikiforum_threads', |
| 330 | + 'wft_thread', |
| 331 | + array( 'wft_deleted' => 0, 'wft_thread' => $threadId ), |
| 332 | + __METHOD__ |
| 333 | + )); |
| 334 | + |
| 335 | + if( |
| 336 | + $thread->wft_thread > 0 && |
| 337 | + $wgUser->isAllowed( 'wikiforum-admin' ) && |
| 338 | + !wfReadOnly() |
| 339 | + ) |
| 340 | + { |
| 341 | + if( $value == false ) { |
| 342 | + $value = 0; |
| 343 | + } |
| 344 | + $dbw = wfGetDB( DB_MASTER ); |
| 345 | + $result = $dbw->update( |
| 346 | + 'wikiforum_threads', |
| 347 | + array( 'wft_sticky' => $value ), |
| 348 | + array( 'wft_thread' => $thread->wft_thread ), |
| 349 | + __METHOD__ |
| 350 | + ); |
| 351 | + } else { |
| 352 | + $result = false; |
| 353 | + } |
| 354 | + |
| 355 | + if( $result == false ) { |
| 356 | + $this->errorTitle = wfMsg( 'wikiforum-error-sticky' ); |
| 357 | + $this->errorMessage = wfMsg( 'wikiforum-error-general' ); |
| 358 | + } |
| 359 | + return $result; |
| 360 | + } |
| 361 | + |
| 362 | + function pasteThread( $threadId, $forumId ) { |
| 363 | + global $wgUser; |
| 364 | + |
| 365 | + $dbr = wfGetDB( DB_SLAVE ); |
| 366 | + |
| 367 | + $thread = $dbr->select( |
| 368 | + 'wikiforum_threads', |
| 369 | + 'wft_thread', |
| 370 | + array( 'wft_deleted' => 0, 'wft_thread' => intval( $threadId ) ), |
| 371 | + __METHOD__ |
| 372 | + ); |
| 373 | + $forum = $dbr->select( |
| 374 | + 'wikiforum_forums', |
| 375 | + 'wff_forum', |
| 376 | + array( 'wff_deleted' => 0, 'wff_forum' => intval( $forumId ) ), |
| 377 | + __METHOD__ |
| 378 | + ); |
| 379 | + |
| 380 | + if( $thread->wft_thread > 0 && $forum->wff_forum > 0 && $wgUser->isAllowed( 'wikiforum-moderator' ) ) { |
| 381 | + if( $thread->wft_forum != $forum->wff_forum ) { |
| 382 | + $dbw = wfGetDB( DB_MASTER ); |
| 383 | + $result = $dbw->update( |
| 384 | + 'wikiforum_threads', |
| 385 | + array( 'wft_forum' => $forum->wff_forum ), |
| 386 | + array( 'wft_thread' => $thread->wft_thread ), |
| 387 | + __METHOD__ |
| 388 | + ); |
| 389 | + } else { |
| 390 | + $result = true; |
| 391 | + } |
| 392 | + } else { |
| 393 | + $result = false; |
| 394 | + } |
| 395 | + |
| 396 | + if( $result == false ) { |
| 397 | + $this->errorTitle = wfMsg( 'wikiforum-error-move-thread' ); |
| 398 | + $this->errorMessage = wfMsg( 'wikiforum-error-general' ); |
| 399 | + } |
| 400 | + return $result; |
| 401 | + } |
| 402 | + |
| 403 | + function editThread( $threadId, $title, $text ) { |
| 404 | + global $wgUser; |
| 405 | + |
| 406 | + if( |
| 407 | + $text && $title && strlen( $text ) > 1 && |
| 408 | + strlen( $title ) > 1 |
| 409 | + ) |
| 410 | + { |
| 411 | + $dbr = wfGetDB( DB_SLAVE ); |
| 412 | + |
| 413 | + $thread = $dbr->fetchObject( $dbr->select( |
| 414 | + 'wikiforum_threads', |
| 415 | + array( 'wft_thread', 'wft_thread_name', 'wft_text', 'wft_user' ), |
| 416 | + array( 'wft_deleted' => 0, 'wft_thread' => $threadId ), |
| 417 | + __METHOD__ |
| 418 | + )); |
| 419 | + |
| 420 | + if( $thread->wft_thread > 0 ) { |
| 421 | + if( |
| 422 | + $thread->wft_thread_name != $title || |
| 423 | + $thread->wft_text != $text |
| 424 | + ) |
| 425 | + { |
| 426 | + if( |
| 427 | + $wgUser->getId() > 0 && |
| 428 | + ( |
| 429 | + $wgUser->getId() == $thread->wft_user || |
| 430 | + $wgUser->isAllowed( 'wikiforum-moderator' ) |
| 431 | + ) && |
| 432 | + !wfReadOnly() |
| 433 | + ) |
| 434 | + { |
| 435 | + $dbw = wfGetDB( DB_MASTER ); |
| 436 | + $result = $dbw->update( |
| 437 | + 'wikiforum_threads', |
| 438 | + array( |
| 439 | + 'wft_thread_name' => $title, |
| 440 | + 'wft_text' => $text, |
| 441 | + 'wft_edit_timestamp' => wfTimestampNow(), |
| 442 | + 'wft_edit_user' => $wgUser->getId() |
| 443 | + ), |
| 444 | + array( 'wft_thread' => $thread->wft_thread ), |
| 445 | + __METHOD__ |
| 446 | + ); |
| 447 | + } else { |
| 448 | + $this->errorMessage = wfMsg( 'wikiforum-error-no-rights' ); |
| 449 | + $result = false; |
| 450 | + } |
| 451 | + } else { |
| 452 | + $result = true; // no changes |
| 453 | + } |
| 454 | + } else { |
| 455 | + $this->errorMessage = wfMsg( 'wikiforum-error-not-found' ); |
| 456 | + $result = false; |
| 457 | + } |
| 458 | + |
| 459 | + if( $result == false ) { |
| 460 | + $this->errorTitle = wfMsg( 'wikiforum-error-edit' ); |
| 461 | + if( $this->errorMessage == '' ) { |
| 462 | + $this->errorMessage = wfMsg( 'wikiforum-error-general' ); |
| 463 | + } |
| 464 | + } |
| 465 | + } else { |
| 466 | + if( |
| 467 | + !$text && !$title || |
| 468 | + strlen( $text ) == 0 && strlen( $title ) == 0 |
| 469 | + ) |
| 470 | + { |
| 471 | + $result = false; |
| 472 | + } else { |
| 473 | + $this->result = false; |
| 474 | + $result = false; |
| 475 | + } |
| 476 | + } |
| 477 | + return $result; |
| 478 | + } |
| 479 | + |
| 480 | + function addThread( $forumId, $title, $text ) { |
| 481 | + global $wgUser, $wgWikiForumAllowAnonymous; |
| 482 | + |
| 483 | + if( $wgWikiForumAllowAnonymous || $wgUser->isLoggedIn() ) { |
| 484 | + if( |
| 485 | + $forumId > 0 && strlen( $text ) > 1 && |
| 486 | + // @todo FIXME/CHECKME: use wfMsgForContent()? |
| 487 | + strlen( $title ) > 1 && $title != wfMsg( 'wikiforum-thread-title' ) |
| 488 | + ) |
| 489 | + { |
| 490 | + $dbr = wfGetDB( DB_SLAVE ); |
| 491 | + |
| 492 | + $overview = $dbr->fetchObject( $dbr->select( |
| 493 | + array( 'wikiforum_forums', 'wikiforum_category' ), |
| 494 | + array( 'wff_forum', 'wff_announcement' ), |
| 495 | + array( |
| 496 | + 'wfc_deleted' => 0, |
| 497 | + 'wff_deleted' => 0, |
| 498 | + 'wfc_category = wff_category', |
| 499 | + 'wff_forum' => intval( $forumId ) |
| 500 | + ), |
| 501 | + __METHOD__ |
| 502 | + )); |
| 503 | + |
| 504 | + if( $overview->wff_forum > 0 && !wfReadOnly() ) { |
| 505 | + $dbw = wfGetDB( DB_MASTER ); |
| 506 | + $timestamp = wfTimestampNow(); |
| 507 | + if( $overview->wff_announcement == false || $wgUser->isAllowed( 'wikiforum-moderator' ) ) { |
| 508 | + $doublepost = $dbr->selectRow( |
| 509 | + 'wikiforum_threads', |
| 510 | + 'wft_thread AS id', |
| 511 | + array( |
| 512 | + 'wft_deleted' => 0, |
| 513 | + 'wft_thread_name' => $title, |
| 514 | + 'wft_text' => $text, |
| 515 | + 'wft_user' => intval( $wgUser->getId() ), |
| 516 | + 'wft_forum' => $forumId, |
| 517 | + 'wft_posted_timestamp > ' . ( $timestamp - ( 24 * 3600 ) ) |
| 518 | + ), |
| 519 | + __METHOD__ |
| 520 | + ); |
| 521 | + |
| 522 | + if( $doublepost === false ) { |
| 523 | + $result = $dbw->insert( |
| 524 | + 'wikiforum_threads', |
| 525 | + array( |
| 526 | + 'wft_thread_name' => $title, |
| 527 | + 'wft_text' => $text, |
| 528 | + 'wft_posted_timestamp' => $timestamp, |
| 529 | + 'wft_user' => intval( $wgUser->getId() ), |
| 530 | + 'wft_forum' => $forumId, |
| 531 | + 'wft_last_post_timestamp' => $timestamp |
| 532 | + ), |
| 533 | + __METHOD__ |
| 534 | + ); |
| 535 | + if( $result == true ) { |
| 536 | + $dbw->update( |
| 537 | + 'wikiforum_forums', |
| 538 | + array( |
| 539 | + 'wff_thread_count = wff_thread_count + 1', |
| 540 | + 'wff_last_post_timestamp' => $timestamp, |
| 541 | + 'wff_last_post_user' => $wgUser->getId() |
| 542 | + ), |
| 543 | + array( 'wff_forum' => $forumId ), |
| 544 | + __METHOD__ |
| 545 | + ); |
| 546 | + $this->result = true; |
| 547 | + } else { |
| 548 | + $this->result = false; |
| 549 | + } |
| 550 | + } else { |
| 551 | + $this->errorMessage = wfMsg( 'wikiforum-error-double-post' ); |
| 552 | + $this->result = false; |
| 553 | + } |
| 554 | + } else { |
| 555 | + $this->errorMessage = wfMsg( 'wikiforum-error-no-rights' ); |
| 556 | + $this->result = false; |
| 557 | + } |
| 558 | + } else { |
| 559 | + $this->result = false; |
| 560 | + } |
| 561 | + } else { |
| 562 | + $this->errorMessage = wfMsg( 'wikiforum-error-no-text-or-title' ); |
| 563 | + $this->result = false; |
| 564 | + } |
| 565 | + } else { |
| 566 | + $this->errorMessage = wfMsg( 'wikiforum-error-no-rights' ); |
| 567 | + $this->result = false; |
| 568 | + } |
| 569 | + |
| 570 | + if( $this->result == false ) { |
| 571 | + $this->errorTitle = wfMsg( 'wikiforum-error-add' ); |
| 572 | + if( $this->errorMessage == '' ) { |
| 573 | + $this->errorMessage = wfMsg( 'wikiforum-error-general' ); |
| 574 | + } |
| 575 | + } |
| 576 | + return $this->result; |
| 577 | + } |
| 578 | + |
| 579 | + /** |
| 580 | + * Edit the reply with ID = $replyId. |
| 581 | + * |
| 582 | + * @param $replyId Integer: internal ID number of the reply |
| 583 | + * @param $text String: new reply text |
| 584 | + * @return Boolean: did everything go well (true) or not (false)? |
| 585 | + */ |
| 586 | + function editReply( $replyId, $text ) { |
| 587 | + global $wgUser, $wgRequest; |
| 588 | + |
| 589 | + if( $text && strlen( $text ) > 1 ) { |
| 590 | + $dbr = wfGetDB( DB_SLAVE ); |
| 591 | + |
| 592 | + $reply = $dbr->fetchObject( $dbr->select( |
| 593 | + 'wikiforum_replies', |
| 594 | + array( 'wfr_thread', 'wfr_reply_id', 'wfr_reply_text', 'wfr_user' ), |
| 595 | + array( 'wfr_reply_id' => intval( $replyId ) ), |
| 596 | + __METHOD__ |
| 597 | + )); |
| 598 | + $thread = $dbr->fetchObject( $dbr->select( |
| 599 | + 'wikiforum_threads', |
| 600 | + array( 'wft_thread', 'wft_closed' ), |
| 601 | + array( 'wft_deleted' => 0, 'wft_thread' => $reply->wfr_thread ), |
| 602 | + __METHOD__ |
| 603 | + )); |
| 604 | + |
| 605 | + if( $reply->wfr_reply_id > 0 && $thread->wft_thread > 0 ) { |
| 606 | + if( $reply->wfr_reply_text != $text ) { |
| 607 | + if( |
| 608 | + $wgUser->getId() > 0 && |
| 609 | + ( ( $wgUser->getId() == $reply->wfr_user && |
| 610 | + $thread->wft_closed == 0 ) || |
| 611 | + $wgUser->isAllowed( 'wikiforum-moderator' ) |
| 612 | + ) && !wfReadOnly() |
| 613 | + ) |
| 614 | + { |
| 615 | + $dbw = wfGetDB( DB_MASTER ); |
| 616 | + $result = $dbw->update( |
| 617 | + 'wikiforum_replies', |
| 618 | + array( |
| 619 | + 'wfr_reply_text' => $text, |
| 620 | + 'wfr_edit_timestamp' => wfTimestampNow(), |
| 621 | + 'wfr_edit_user' => $wgUser->getId() |
| 622 | + ), |
| 623 | + array( 'wfr_reply_id' => $reply->wfr_reply_id ), |
| 624 | + __METHOD__ |
| 625 | + ); |
| 626 | + } else { |
| 627 | + $this->errorMessage = wfMsg( 'wikiforum-error-no-rights' ); |
| 628 | + $result = false; |
| 629 | + } |
| 630 | + } else { |
| 631 | + $result = true; |
| 632 | + } |
| 633 | + } else { |
| 634 | + $this->errorMessage = wfMsg( 'wikiforum-error-not-found' ); |
| 635 | + $result = false; |
| 636 | + } |
| 637 | + } else { |
| 638 | + $form = $wgRequest->getBool( 'form' ); |
| 639 | + if( isset( $form ) && $form == true ) { |
| 640 | + $this->errorMessage = wfMsg( 'wikiforum-error-no-reply' ); |
| 641 | + $result = false; |
| 642 | + } else { |
| 643 | + $result = true; |
| 644 | + } |
| 645 | + } |
| 646 | + |
| 647 | + if( $result == false ) { |
| 648 | + $this->errorTitle = wfMsg( 'wikiforum-error-edit' ); |
| 649 | + if( $this->errorMessage == '' ) { |
| 650 | + $this->errorMessage = wfMsg( 'wikiforum-error-general' ); |
| 651 | + } |
| 652 | + } |
| 653 | + return $result; |
| 654 | + } |
| 655 | + |
| 656 | + /** |
| 657 | + * Add a reply with the text $text to the thread with ID = $threadId. |
| 658 | + * |
| 659 | + * @param $threadId Integer: internal ID number of the thread to reply to |
| 660 | + * @param $text String: reply text |
| 661 | + */ |
| 662 | + function addReply( $threadId, $text ) { |
| 663 | + global $wgUser, $wgWikiForumAllowAnonymous; |
| 664 | + |
| 665 | + $timestamp = wfTimestampNow(); |
| 666 | + |
| 667 | + if( $wgWikiForumAllowAnonymous || $wgUser->isLoggedIn() ) { |
| 668 | + if( $threadId > 0 ) { |
| 669 | + if( strlen( $text ) > 1 ) { |
| 670 | + $dbr = wfGetDB( DB_SLAVE ); |
| 671 | + |
| 672 | + $thread = $dbr->selectRow( |
| 673 | + 'wikiforum_threads', |
| 674 | + 'wft_thread', |
| 675 | + array( |
| 676 | + 'wft_deleted' => 0, |
| 677 | + 'wft_closed' => 0, |
| 678 | + 'wft_thread' => intval( $threadId ) |
| 679 | + ), |
| 680 | + __METHOD__ |
| 681 | + ); |
| 682 | + |
| 683 | + if( $thread->wft_thread > 0 && !wfReadOnly() ) { |
| 684 | + $dbw = wfGetDB( DB_MASTER ); |
| 685 | + $doublepost = $dbr->selectRow( |
| 686 | + 'wikiforum_replies', |
| 687 | + 'wfr_reply_id AS id', |
| 688 | + array( |
| 689 | + 'wfr_deleted' => 0, |
| 690 | + 'wfr_reply_text' => $text, |
| 691 | + 'wfr_user' => $wgUser->getId(), |
| 692 | + 'wfr_thread' => $thread->wft_thread, |
| 693 | + 'wfr_posted_timestamp > ' . ( $timestamp - ( 24 * 3600 ) ) |
| 694 | + ), |
| 695 | + __METHOD__ |
| 696 | + ); |
| 697 | + |
| 698 | + if( $doublepost === false ) { |
| 699 | + $result = $dbw->insert( |
| 700 | + 'wikiforum_replies', |
| 701 | + array( |
| 702 | + 'wfr_reply_text' => $text, |
| 703 | + 'wfr_posted_timestamp' => $timestamp, |
| 704 | + 'wfr_user' => $wgUser->getId(), |
| 705 | + 'wfr_thread' => $thread->wft_thread |
| 706 | + ), |
| 707 | + __METHOD__ |
| 708 | + ); |
| 709 | + |
| 710 | + if( $result == true ) { |
| 711 | + $dbw->update( |
| 712 | + 'wikiforum_threads', |
| 713 | + array( |
| 714 | + 'wft_reply_count = wft_reply_count + 1', |
| 715 | + 'wft_last_post_timestamp' => $timestamp, |
| 716 | + 'wft_last_post_user' => $wgUser->getId() |
| 717 | + ), |
| 718 | + array( 'wft_thread' => intval( $threadId ) ), |
| 719 | + __METHOD__ |
| 720 | + ); |
| 721 | + |
| 722 | + $pkForum = $dbr->selectRow( |
| 723 | + 'wikiforum_threads', |
| 724 | + 'wft_forum', |
| 725 | + array( 'wft_thread' => intval( $threadId ) ), |
| 726 | + __METHOD__ |
| 727 | + ); |
| 728 | + $dbw->update( |
| 729 | + 'wikiforum_forums', |
| 730 | + array( 'wff_reply_count = wff_reply_count + 1' ), |
| 731 | + array( 'wff_forum' => intval( $pkForum->wft_forum ) ), |
| 732 | + __METHOD__ |
| 733 | + ); |
| 734 | + |
| 735 | + $this->result = true; |
| 736 | + } else { |
| 737 | + $this->result = false; |
| 738 | + } |
| 739 | + } else { |
| 740 | + $this->errorMessage = wfMsg( 'wikiforum-error-double-post' ); |
| 741 | + $this->result = false; |
| 742 | + } |
| 743 | + } else { |
| 744 | + $this->errorMessage = wfMsg( 'wikiforum-error-thread-closed' ); |
| 745 | + $this->result = false; |
| 746 | + } |
| 747 | + } else { |
| 748 | + $this->errorMessage = wfMsg( 'wikiforum-error-no-reply' ); |
| 749 | + $this->result = false; |
| 750 | + } |
| 751 | + } else { |
| 752 | + $this->errorMessage = wfMsg( 'wikiforum-error-not-found' ); |
| 753 | + $this->result = false; |
| 754 | + } |
| 755 | + } else { |
| 756 | + $this->errorMessage = wfMsg( 'wikiforum-error-no-rights' ); |
| 757 | + $this->result = false; |
| 758 | + } |
| 759 | + |
| 760 | + if( $this->result == false ) { |
| 761 | + $this->errorTitle = wfMsg( 'wikiforum-error-add' ); |
| 762 | + if( $this->errorMessage == '' ) { |
| 763 | + $this->errorMessage = wfMsg( 'wikiforum-error-general' ); |
| 764 | + } |
| 765 | + } |
| 766 | + return $this->result; |
| 767 | + } |
| 768 | + |
| 769 | + function addCategory( $categoryName ) { |
| 770 | + global $wgUser; |
| 771 | + |
| 772 | + if( |
| 773 | + $wgUser->isAllowed( 'wikiforum-admin' ) && |
| 774 | + !wfReadOnly() |
| 775 | + ) |
| 776 | + { |
| 777 | + if( strlen( $categoryName ) > 0 ) { |
| 778 | + $dbr = wfGetDB( DB_SLAVE ); |
| 779 | + $sortkey = $dbr->selectRow( |
| 780 | + 'wikiforum_category', |
| 781 | + 'MAX(wfc_sortkey) AS the_key', |
| 782 | + array( 'wfc_deleted' => 0 ), |
| 783 | + __METHOD__ |
| 784 | + ); |
| 785 | + |
| 786 | + $dbw = wfGetDB( DB_MASTER ); |
| 787 | + $this->result = $dbw->insert( |
| 788 | + 'wikiforum_category', |
| 789 | + array( |
| 790 | + 'wfc_category_name' => $categoryName, |
| 791 | + 'wfc_sortkey' => ( $sortkey->the_key + 1 ), |
| 792 | + 'wfc_added_timestamp' => wfTimestampNow(), |
| 793 | + 'wfc_added_user' => $wgUser->getId() |
| 794 | + ), |
| 795 | + __METHOD__ |
| 796 | + ); |
| 797 | + } else { |
| 798 | + $this->errorMessage = wfMsg( 'wikiforum-no-text-or-title' ); |
| 799 | + $this->result = false; |
| 800 | + } |
| 801 | + } else { |
| 802 | + $this->errorMessage = wfMsg( 'wikiforum-error-no-rights' ); |
| 803 | + $this->result = false; |
| 804 | + } |
| 805 | + |
| 806 | + if( $this->result == false ) { |
| 807 | + $this->errorTitle = wfMsg( 'wikiforum-error-add' ); |
| 808 | + if( $this->errorMessage == '' ) { |
| 809 | + $this->errorMessage = wfMsg( 'wikiforum-error-general' ); |
| 810 | + } |
| 811 | + } |
| 812 | + return $this->result; |
| 813 | + } |
| 814 | + |
| 815 | + function editCategory( $id, $categoryName ) { |
| 816 | + global $wgUser; |
| 817 | + |
| 818 | + if( $wgUser->isAllowed( 'wikiforum-admin' ) ) { |
| 819 | + if( strlen( $categoryName ) > 0 ) { |
| 820 | + $dbr = wfGetDB( DB_SLAVE ); |
| 821 | + |
| 822 | + $category = $dbr->fetchObject( $dbr->select( |
| 823 | + 'wikiforum_category', |
| 824 | + array( 'wfc_category', 'wfc_category_name' ), |
| 825 | + array( 'wfc_deleted' => 0, 'wfc_category' => intval( $id ) ), |
| 826 | + __METHOD__ |
| 827 | + )); |
| 828 | + |
| 829 | + if( |
| 830 | + $category->wfc_category > 0 && |
| 831 | + $category->wfc_category_name != $categoryName && |
| 832 | + !wfReadOnly() |
| 833 | + ) |
| 834 | + { |
| 835 | + $dbw = wfGetDB( DB_MASTER ); |
| 836 | + $this->result = $dbw->update( |
| 837 | + 'wikiforum_category', |
| 838 | + array( |
| 839 | + 'wfc_category_name' => $categoryName, |
| 840 | + 'wfc_edited' => wfTimestampNow(), |
| 841 | + 'wfc_edited_user' => $wgUser->getId() |
| 842 | + ), |
| 843 | + array( 'wfc_category' => intval( $category->wfc_category ) ), |
| 844 | + __METHOD__ |
| 845 | + ); |
| 846 | + } |
| 847 | + } else { |
| 848 | + $this->errorMessage = wfMsg( 'wikiforum-no-text-or-title' ); |
| 849 | + $this->result = false; |
| 850 | + } |
| 851 | + } else { |
| 852 | + $this->errorMessage = wfMsg( 'wikiforum-error-no-rights' ); |
| 853 | + $this->result = false; |
| 854 | + } |
| 855 | + |
| 856 | + if( $this->result == false ) { |
| 857 | + $this->errorTitle = wfMsg( 'wikiforum-error-edit' ); |
| 858 | + if( $this->errorMessage == '' ) { |
| 859 | + $this->errorMessage = wfMsg( 'wikiforum-error-general' ); |
| 860 | + } |
| 861 | + } |
| 862 | + return $this->result; |
| 863 | + } |
| 864 | + |
| 865 | + function addForum( $categoryId, $forumName, $description, $announcement ) { |
| 866 | + global $wgUser; |
| 867 | + |
| 868 | + if( $wgUser->isAllowed( 'wikiforum-admin' ) ) { |
| 869 | + if( strlen( $forumName ) > 0 ) { |
| 870 | + $dbr = wfGetDB( DB_SLAVE ); |
| 871 | + |
| 872 | + $sortkey = $dbr->selectRow( |
| 873 | + 'wikiforum_forums', |
| 874 | + 'MAX(wff_sortkey) AS the_key', |
| 875 | + array( |
| 876 | + 'wff_deleted' => 0, |
| 877 | + 'wff_category' => intval( $categoryId ) |
| 878 | + ), |
| 879 | + __METHOD__ |
| 880 | + ); |
| 881 | + |
| 882 | + $category = $dbr->selectRow( |
| 883 | + 'wikiforum_category', |
| 884 | + 'wfc_category', |
| 885 | + array( |
| 886 | + 'wfc_deleted' => 0, |
| 887 | + 'wfc_category' => intval( $categoryId ) |
| 888 | + ), |
| 889 | + __METHOD__ |
| 890 | + ); |
| 891 | + |
| 892 | + if( $category->wfc_category > 0 && !wfReadOnly() ) { |
| 893 | + $dbw = wfGetDB( DB_MASTER ); |
| 894 | + $this->result = $dbw->insert( |
| 895 | + 'wikiforum_forums', |
| 896 | + array( |
| 897 | + 'wff_forum_name' => $forumName, |
| 898 | + 'wff_description' => $description, |
| 899 | + 'wff_category' => $category->wfc_category, |
| 900 | + 'wff_sortkey' => ( $sortkey->the_key + 1 ), |
| 901 | + 'wff_added_timestamp' => wfTimestampNow(), |
| 902 | + 'wff_added_user' => $wgUser->getId(), |
| 903 | + 'wff_announcement' => $announcement |
| 904 | + ), |
| 905 | + __METHOD__ |
| 906 | + ); |
| 907 | + } else { |
| 908 | + $this->errorMessage = wfMsg( 'wikiforum-error-not-found' ); |
| 909 | + $this->result = false; |
| 910 | + } |
| 911 | + } else { |
| 912 | + $this->errorMessage = wfMsg( 'wikiforum-no-text-or-title' ); |
| 913 | + $this->result = false; |
| 914 | + } |
| 915 | + } else { |
| 916 | + $this->errorMessage = wfMsg( 'wikiforum-error-no-rights' ); |
| 917 | + $this->result = false; |
| 918 | + } |
| 919 | + |
| 920 | + if( $this->result == false ) { |
| 921 | + $this->errorTitle = wfMsg( 'wikiforum-error-add' ); |
| 922 | + if( $this->errorMessage == '' ) { |
| 923 | + $this->errorMessage = wfMsg( 'wikiforum-error-general' ); |
| 924 | + } |
| 925 | + } |
| 926 | + return $this->result; |
| 927 | + } |
| 928 | + |
| 929 | + /** |
| 930 | + * Edit a forum. |
| 931 | + * |
| 932 | + * @param $id Integer: internal forum ID number |
| 933 | + * @param $forumName String: forum name as supplied by the user |
| 934 | + * @param $description String: forum description as supplied by the user |
| 935 | + * @param $announcement |
| 936 | + * @return Boolean: did everything go well (true) or not (false)? |
| 937 | + */ |
| 938 | + function editForum( $id, $forumName, $description, $announcement ) { |
| 939 | + global $wgUser; |
| 940 | + |
| 941 | + if( $wgUser->isAllowed( 'wikiforum-admin' ) ) { |
| 942 | + if( strlen( $forumName ) > 0 ) { |
| 943 | + $dbr = wfGetDB( DB_SLAVE ); |
| 944 | + $forum = $dbr->fetchObject( $dbr->select( |
| 945 | + 'wikiforum_forums', |
| 946 | + array( |
| 947 | + 'wff_forum', 'wff_forum_name', 'wff_description', |
| 948 | + 'wff_announcement' |
| 949 | + ), |
| 950 | + array( 'wff_deleted' => 0, 'wff_forum' => intval( $id ) ), |
| 951 | + __METHOD__ |
| 952 | + )); |
| 953 | + |
| 954 | + if( |
| 955 | + $forum->wff_forum > 0 && |
| 956 | + ( |
| 957 | + $forum->wff_forum_name != $forumName || |
| 958 | + $forum->wff_description != $description || |
| 959 | + $forum->wff_announcement != $announcement |
| 960 | + ) && !wfReadOnly() |
| 961 | + ) |
| 962 | + { |
| 963 | + $dbw = wfGetDB( DB_MASTER ); |
| 964 | + $this->result = $dbw->update( |
| 965 | + 'wikiforum_forums', |
| 966 | + array( |
| 967 | + 'wff_forum_name' => $forumName, |
| 968 | + 'wff_description' => $description, |
| 969 | + 'wff_edited_timestamp' => wfTimestampNow(), |
| 970 | + 'wff_edited_user' => $wgUser->getId(), |
| 971 | + 'wff_announcement' => $announcement |
| 972 | + ), |
| 973 | + array( 'wff_forum' => intval( $forum->wff_forum ) ), |
| 974 | + __METHOD__ |
| 975 | + ); |
| 976 | + } |
| 977 | + } else { |
| 978 | + $this->errorMessage = wfMsg( 'wikiforum-no-text-or-title' ); |
| 979 | + $this->result = false; |
| 980 | + } |
| 981 | + } else { |
| 982 | + $this->errorMessage = wfMsg( 'wikiforum-error-no-rights' ); |
| 983 | + $this->result = false; |
| 984 | + } |
| 985 | + |
| 986 | + if( $this->result == false ) { |
| 987 | + $this->errorTitle = wfMsg( 'wikiforum-error-add' ); |
| 988 | + if( $this->errorMessage == '' ) { |
| 989 | + $this->errorMessage = wfMsg( 'wikiforum-error-general' ); |
| 990 | + } |
| 991 | + } |
| 992 | + return $this->result; |
| 993 | + } |
| 994 | + |
| 995 | + function sortKeys( $id, $type, $direction_up ) { |
| 996 | + global $wgUser; |
| 997 | + |
| 998 | + if( $wgUser->isAllowed( 'wikiforum-admin' ) ) { |
| 999 | + $dbr = wfGetDB( DB_SLAVE ); |
| 1000 | + |
| 1001 | + if( $type == 'category' ) { |
| 1002 | + // in the past, both tables had a SortKey column |
| 1003 | + // nowadays the columns are prefixed with an abbreviation |
| 1004 | + // of the table name, which is the standard MW convention |
| 1005 | + // it also means that we need to figure out wtf the |
| 1006 | + // abbreviation is later on in the code...this will make it |
| 1007 | + // possible |
| 1008 | + $columnPrefix = 'wfc_'; |
| 1009 | + |
| 1010 | + $fieldname = 'wfc_category'; |
| 1011 | + $tablename = 'wikiforum_category'; |
| 1012 | + $sqlData = $dbr->select( |
| 1013 | + $tablename, |
| 1014 | + array( $fieldname, 'wfc_sortkey' ), |
| 1015 | + array( 'wfc_deleted' => 0 ), |
| 1016 | + __METHOD__, |
| 1017 | + array( 'ORDER BY' => 'wfc_sortkey ASC' ) |
| 1018 | + ); |
| 1019 | + } else { |
| 1020 | + $columnPrefix = 'wff_'; |
| 1021 | + |
| 1022 | + $fieldname = 'wff_forum'; |
| 1023 | + $tablename = 'wikiforum_forums'; |
| 1024 | + $forum = $dbr->selectRow( |
| 1025 | + $tablename, |
| 1026 | + 'wff_category', |
| 1027 | + array( 'wff_deleted' => 0, 'wff_forum' => intval( $id ) ), |
| 1028 | + __METHOD__ |
| 1029 | + ); |
| 1030 | + $sqlData = $dbr->select( |
| 1031 | + $tablename, |
| 1032 | + array( $fieldname, 'wff_sortkey' ), |
| 1033 | + array( |
| 1034 | + 'wff_deleted' => 0, |
| 1035 | + 'wff_category' => $forum->wff_category |
| 1036 | + ), |
| 1037 | + __METHOD__, |
| 1038 | + array( 'ORDER BY' => 'wff_sortkey ASC' ) |
| 1039 | + ); |
| 1040 | + } |
| 1041 | + |
| 1042 | + $i = 0; |
| 1043 | + $new_array = array(); |
| 1044 | + $name = $columnPrefix . 'sortkey'; |
| 1045 | + foreach ( $sqlData as $entry ) { |
| 1046 | + $entry->$name = $i; |
| 1047 | + array_push( $new_array, $entry ); |
| 1048 | + $i++; |
| 1049 | + } |
| 1050 | + for( $i = 0; $i < sizeof( $new_array ); $i++ ) { |
| 1051 | + if( $new_array[$i]->$fieldname == $id ) { |
| 1052 | + if( $direction_up == true && $i > 0 ) { |
| 1053 | + $new_array[$i]->$name--; |
| 1054 | + $new_array[$i - 1]->$name++; |
| 1055 | + } elseif( $direction_up == false && $i + 1 < sizeof( $new_array ) ) { |
| 1056 | + $new_array[$i]->$name++; |
| 1057 | + $new_array[$i + 1]->$name--; |
| 1058 | + } |
| 1059 | + $i = sizeof( $new_array ); |
| 1060 | + } |
| 1061 | + } |
| 1062 | + $dbw = wfGetDB( DB_MASTER ); |
| 1063 | + if ( !wfReadOnly() ) { |
| 1064 | + foreach ( $new_array as $entry ) { |
| 1065 | + $result = $dbw->update( |
| 1066 | + $tablename, |
| 1067 | + array( $columnPrefix . 'sortkey' => $entry->$name ), |
| 1068 | + array( $fieldname => $entry->$fieldname ), |
| 1069 | + __METHOD__ |
| 1070 | + ); |
| 1071 | + } |
| 1072 | + } |
| 1073 | + } |
| 1074 | + } |
| 1075 | + |
| 1076 | + /** |
| 1077 | + * Show an overview of all available categories and their forums. |
| 1078 | + * Used in the special page class. |
| 1079 | + * |
| 1080 | + * @return HTML |
| 1081 | + */ |
| 1082 | + function showOverview() { |
| 1083 | + global $wgOut, $wgUser, $wgLang, $wgScriptPath; |
| 1084 | + |
| 1085 | + $output = $this->showFailure(); |
| 1086 | + |
| 1087 | + $dbr = wfGetDB( DB_SLAVE ); |
| 1088 | + $sqlCategories = $dbr->select( |
| 1089 | + 'wikiforum_category', |
| 1090 | + '*', |
| 1091 | + array( 'wfc_deleted' => 0 ), |
| 1092 | + __METHOD__, |
| 1093 | + array( 'ORDER BY' => 'wfc_sortkey ASC, wfc_category ASC' ) |
| 1094 | + ); |
| 1095 | + |
| 1096 | + // If there is nothing (i.e. this is a brand new installation), |
| 1097 | + // display a message instead of an empty page to the users trying |
| 1098 | + // to access Special:WikiForum |
| 1099 | + // Otherwise give 'em a search box to search the forum because |
| 1100 | + // Special:Search doesn't work for WikiForum |
| 1101 | + if ( !$dbr->numRows( $sqlCategories ) ) { |
| 1102 | + $output .= wfMsgExt( 'wikiforum-forum-is-empty', 'parse' ); |
| 1103 | + } else { |
| 1104 | + $output .= WikiForumGui::getSearchbox(); |
| 1105 | + } |
| 1106 | + |
| 1107 | + $specialPage = SpecialPage::getTitleFor( 'WikiForum' ); |
| 1108 | + |
| 1109 | + foreach ( $sqlCategories as $cat ) { |
| 1110 | + $sqlForums = $dbr->select( |
| 1111 | + array( 'wikiforum_forums', 'user' ), |
| 1112 | + array( '*', 'user_name' ), |
| 1113 | + array( 'wff_deleted' => 0,' wff_category' => $cat->wfc_category ), |
| 1114 | + __METHOD__, |
| 1115 | + array( 'ORDER BY' => 'wff_sortkey ASC, wff_forum ASC' ), |
| 1116 | + array( 'user' => array( 'LEFT JOIN', 'user_id = wff_last_post_user' ) ) |
| 1117 | + ); |
| 1118 | + |
| 1119 | + $menuLink = ''; |
| 1120 | + $categoryLink = ''; |
| 1121 | + |
| 1122 | + if( $wgUser->isAllowed( 'wikiforum-admin' ) ) { |
| 1123 | + $icon = '<img src="' . $wgScriptPath . '/extensions/WikiForum/icons/folder_add.png" title="' . wfMsg( 'wikiforum-add-forum' ) . '" /> '; |
| 1124 | + $menuLink = $icon . '<a href="' . $specialPage->escapeFullURL( array( 'addforum' => $cat->wfc_category ) ) . '">' . |
| 1125 | + wfMsg( 'wikiforum-add-forum' ) . '</a>'; |
| 1126 | + |
| 1127 | + $categoryLink = $this->showAdminIcons( |
| 1128 | + 'category', $cat->wfc_category, true, true |
| 1129 | + ); |
| 1130 | + $output .= WikiForumGui::getHeaderRow( 0, '', 0, '', $menuLink ); |
| 1131 | + } |
| 1132 | + $output .= WikiForumGui::getMainHeader( |
| 1133 | + $cat->wfc_category_name, |
| 1134 | + wfMsg( 'wikiforum-threads' ), |
| 1135 | + wfMsg( 'wikiforum-replies' ), |
| 1136 | + wfMsg( 'wikiforum-latest-thread' ), |
| 1137 | + $categoryLink |
| 1138 | + ); |
| 1139 | + |
| 1140 | + foreach ( $sqlForums as $forum ) { |
| 1141 | + $forum_link = $this->showAdminIcons( |
| 1142 | + 'forum', $forum->wff_forum, true, true |
| 1143 | + ); |
| 1144 | + $icon = '<img src="' . $wgScriptPath . '/extensions/WikiForum/icons/folder.png" title="' . |
| 1145 | + wfMsg( 'wikiforum-forum-name', $forum->wff_forum_name ) . '" /> '; |
| 1146 | + |
| 1147 | + $last_post = ''; |
| 1148 | + if( $forum->wff_last_post_timestamp > 0 ) { |
| 1149 | + $last_post = wfMsg( |
| 1150 | + 'wikiforum-by', |
| 1151 | + $wgLang->timeanddate( $forum->wff_last_post_timestamp ), |
| 1152 | + WikiForumClass::getUserLink( $forum->user_name ) |
| 1153 | + ); |
| 1154 | + } |
| 1155 | + |
| 1156 | + $output .= WikiForumGui::getMainBody( |
| 1157 | + '<p class="mw-wikiforum-issue">' . $icon . |
| 1158 | + '<a href="' . $specialPage->escapeFullURL( array( 'forum' => $forum->wff_forum ) ) . '">' . |
| 1159 | + $forum->wff_forum_name . '</a></p>' . |
| 1160 | + '<p class="mw-wikiforum-descr">' . $forum->wff_description . '</p>', |
| 1161 | + $forum->wff_thread_count, |
| 1162 | + $forum->wff_reply_count, |
| 1163 | + $last_post, |
| 1164 | + $forum_link, |
| 1165 | + false |
| 1166 | + ); |
| 1167 | + } |
| 1168 | + $output .= WikiForumGui::getMainFooter(); |
| 1169 | + } |
| 1170 | + |
| 1171 | + // Forum admins are allowed to add new categories |
| 1172 | + if( $wgUser->isAllowed( 'wikiforum-admin' ) ) { |
| 1173 | + $icon = '<img src="' . $wgScriptPath . '/extensions/WikiForum/icons/database_add.png" title="' . wfMsg( 'wikiforum-add-category' ) . '" /> '; |
| 1174 | + $menuLink = $icon . '<a href="' . $specialPage->escapeFullURL( array( 'addcategory' => true ) ) . '">' . |
| 1175 | + wfMsg( 'wikiforum-add-category' ) . '</a>'; |
| 1176 | + $output .= WikiForumGui::getHeaderRow( 0, '', 0, '', $menuLink ); |
| 1177 | + } |
| 1178 | + |
| 1179 | + return $output; |
| 1180 | + } |
| 1181 | + |
| 1182 | + function showCategory( $categoryId ) { |
| 1183 | + global $wgOut, $wgLang, $wgUser, $wgScriptPath; |
| 1184 | + |
| 1185 | + $output = $this->showFailure(); |
| 1186 | + $dbr = wfGetDB( DB_SLAVE ); |
| 1187 | + |
| 1188 | + $sqlData = $dbr->select( |
| 1189 | + 'wikiforum_category', |
| 1190 | + array( 'wfc_category', 'wfc_category_name' ), |
| 1191 | + array( 'wfc_deleted' => 0, 'wfc_category' => intval( $categoryId ) ), |
| 1192 | + __METHOD__ |
| 1193 | + ); |
| 1194 | + $data_overview = $dbr->fetchObject( $sqlData ); |
| 1195 | + |
| 1196 | + if( $data_overview ) { |
| 1197 | + $sqlForums = $dbr->select( |
| 1198 | + array( 'wikiforum_forums', 'user' ), |
| 1199 | + array( '*', 'user_name' ), |
| 1200 | + array( |
| 1201 | + 'wff_deleted' => 0, |
| 1202 | + 'wff_category' => $data_overview->wfc_category |
| 1203 | + ), |
| 1204 | + __METHOD__, |
| 1205 | + array( 'ORDER BY' => 'wff_sortkey ASC, wff_forum ASC' ), |
| 1206 | + array( 'user' => array( 'LEFT JOIN', 'user_id = wff_last_post_user' ) ) |
| 1207 | + ); |
| 1208 | + |
| 1209 | + $menuLink = ''; |
| 1210 | + $categoryLink = ''; |
| 1211 | + $specialPage = SpecialPage::getTitleFor( 'WikiForum' ); |
| 1212 | + |
| 1213 | + // Forum admins are allowed to add new forums |
| 1214 | + if( $wgUser->isAllowed( 'wikiforum-admin' ) ) { |
| 1215 | + $icon = '<img src="' . $wgScriptPath . '/extensions/WikiForum/icons/folder_add.png" title="' . wfMsg( 'wikiforum-add-forum' ) . '" /> '; |
| 1216 | + $menuLink = $icon . '<a href="' . $specialPage->escapeFullURL( array( 'addforum' => $data_overview->wfc_category ) ) . '">' . |
| 1217 | + wfMsg( 'wikiforum-add-forum' ) . '</a>'; |
| 1218 | + $categoryLink = $this->showAdminIcons( |
| 1219 | + 'category', $data_overview->wfc_category, false, false |
| 1220 | + ); |
| 1221 | + } |
| 1222 | + |
| 1223 | + $output .= WikiForumGui::getSearchbox(); |
| 1224 | + $output .= WikiForumGui::getHeaderRow( |
| 1225 | + $data_overview->wfc_category, |
| 1226 | + $data_overview->wfc_category_name, |
| 1227 | + 0, |
| 1228 | + '', |
| 1229 | + $menuLink |
| 1230 | + ); |
| 1231 | + $output .= WikiForumGui::getMainHeader( |
| 1232 | + $data_overview->wfc_category_name, |
| 1233 | + wfMsg( 'wikiforum-threads' ), |
| 1234 | + wfMsg( 'wikiforum-replies' ), |
| 1235 | + wfMsg( 'wikiforum-latest-thread' ), |
| 1236 | + $categoryLink |
| 1237 | + ); |
| 1238 | + |
| 1239 | + foreach( $sqlForums as $forum ) { |
| 1240 | + $forum_link = $this->showAdminIcons( |
| 1241 | + 'forum', $forum->wff_forum, true, true |
| 1242 | + ); |
| 1243 | + |
| 1244 | + $icon = '<img src="' . $wgScriptPath . '/extensions/WikiForum/icons/folder.png" title="' . |
| 1245 | + wfMsg( 'wikiforum-forum-name', $forum->wff_forum_name ) . '" /> '; |
| 1246 | + |
| 1247 | + $last_post = ''; |
| 1248 | + // If there are replies, indicate that somehow... |
| 1249 | + // This message will be shown only when there is one reply or |
| 1250 | + // more |
| 1251 | + if( $forum->wff_last_post_timestamp > 0 ) { |
| 1252 | + $last_post = wfMsg( |
| 1253 | + 'wikiforum-by', |
| 1254 | + $wgLang->timeanddate( $forum->wff_last_post_timestamp ), |
| 1255 | + WikiForumClass::getUserLink( $forum->user_name ) |
| 1256 | + ); |
| 1257 | + } |
| 1258 | + |
| 1259 | + $output .= WikiForumGui::getMainBody( |
| 1260 | + '<p class="mw-wikiforum-issue">' . $icon . |
| 1261 | + '<a href="' . $specialPage->escapeFullURL( array( 'forum' => $forum->wff_forum ) ) . '">' . |
| 1262 | + $forum->wff_forum_name . '</a></p>' . |
| 1263 | + '<p class="mw-wikiforum-descr">' . $forum->wff_description . '</p>', |
| 1264 | + $forum->wff_thread_count, |
| 1265 | + $forum->wff_reply_count, |
| 1266 | + $last_post, |
| 1267 | + $forum_link, |
| 1268 | + false |
| 1269 | + ); |
| 1270 | + } |
| 1271 | + $output .= WikiForumGui::getMainFooter(); |
| 1272 | + } else { |
| 1273 | + $this->errorTitle = wfMsg( 'wikiforum-cat-not-found' ); |
| 1274 | + $this->errorMessage = wfMsg( |
| 1275 | + 'wikiforum-cat-not-found-text', |
| 1276 | + '<a href="' . $specialPage->escapeFullURL() . '">' . |
| 1277 | + wfMsg( 'wikiforum-overview' ) . '</a>' |
| 1278 | + ); |
| 1279 | + } |
| 1280 | + // Jack: unnecessary duplication of the "Overview" link on the bottom |
| 1281 | + // of the page, thus removed |
| 1282 | + //$output .= WikiForumGui::getHeaderRow( 0, '', 0, '', '' ); |
| 1283 | + $output .= $this->showFailure(); |
| 1284 | + return $output; |
| 1285 | + } |
| 1286 | + |
| 1287 | + function showForum( $forumId ) { |
| 1288 | + global $wgOut, $wgLang, $wgUser, $wgRequest, $wgScriptPath; |
| 1289 | + |
| 1290 | + $output = $this->showFailure(); |
| 1291 | + $dbr = wfGetDB( DB_SLAVE ); |
| 1292 | + |
| 1293 | + $f_movethread = $wgRequest->getInt( 'movethread' ); |
| 1294 | + |
| 1295 | + // sorting |
| 1296 | + if( $wgRequest->getVal( 'sd' ) == 'up' ) { |
| 1297 | + $sort_direction = 'ASC'; |
| 1298 | + } else { |
| 1299 | + $sort_direction = 'DESC'; |
| 1300 | + } |
| 1301 | + |
| 1302 | + if( $wgRequest->getVal( 'st' ) == 'answers' ) { |
| 1303 | + $sort_type = 'wft_reply_count'; |
| 1304 | + } elseif( $wgRequest->getVal( 'st' ) == 'calls' ) { |
| 1305 | + $sort_type = 'wft_view_count'; |
| 1306 | + } elseif( $wgRequest->getVal( 'st' ) == 'thread' ) { |
| 1307 | + $sort_type = 'wft_thread_name'; |
| 1308 | + } else { |
| 1309 | + $sort_type = 'wft_last_post_timestamp'; |
| 1310 | + } |
| 1311 | + // end sorting |
| 1312 | + |
| 1313 | + $maxThreadsPerPage = intval( wfMsgForContent( 'wikiforum-max-threads-per-page' ) ); |
| 1314 | + |
| 1315 | + // limiting |
| 1316 | + if( $maxThreadsPerPage && $wgRequest->getVal( 'lc' ) > 0 ) { |
| 1317 | + $limit_count = $wgRequest->getVal( 'lc' ); |
| 1318 | + } elseif( $maxThreadsPerPage > 0 ) { |
| 1319 | + $limit_count = $maxThreadsPerPage; |
| 1320 | + } |
| 1321 | + |
| 1322 | + if( is_numeric( $wgRequest->getVal( 'lp' ) ) ) { |
| 1323 | + $limit_page = $wgRequest->getVal( 'lp' ) - 1; |
| 1324 | + } else { |
| 1325 | + $limit_page = 0; |
| 1326 | + } |
| 1327 | + // end limiting |
| 1328 | + |
| 1329 | + $sqlData = $dbr->select( |
| 1330 | + array( 'wikiforum_forums', 'wikiforum_category' ), |
| 1331 | + array( |
| 1332 | + 'wff_forum', 'wff_forum_name', 'wfc_category', |
| 1333 | + 'wfc_category_name', 'wff_announcement' |
| 1334 | + ), |
| 1335 | + array( |
| 1336 | + 'wff_deleted' => 0, |
| 1337 | + 'wfc_deleted' => 0, |
| 1338 | + 'wff_category = wfc_category', |
| 1339 | + 'wff_forum' => intval( $forumId ) |
| 1340 | + ), |
| 1341 | + __METHOD__ |
| 1342 | + ); |
| 1343 | + $data_overview = $dbr->fetchObject( $sqlData ); |
| 1344 | + |
| 1345 | + $specialPage = SpecialPage::getTitleFor( 'WikiForum' ); |
| 1346 | + |
| 1347 | + if( $data_overview ) { |
| 1348 | + $options['ORDER BY'] = 'wft_sticky DESC, ' . $sort_type . ' ' . $sort_direction; |
| 1349 | + if( $limit_count > 0 ) { |
| 1350 | + $options['LIMIT'] = $limit_count; |
| 1351 | + $options['OFFSET'] = $limit_page * $limit_count; |
| 1352 | + } |
| 1353 | + $forumIdNumber = $data_overview->wff_forum; |
| 1354 | + $sqlThreads = $dbr->select( |
| 1355 | + array( 'wikiforum_threads', 'user' ), |
| 1356 | + array( '*', 'user_name' ), |
| 1357 | + array( 'wft_deleted' => 0, 'wft_forum' => $forumIdNumber ), |
| 1358 | + __METHOD__, |
| 1359 | + $options, |
| 1360 | + array( 'user' => array( 'LEFT JOIN', 'user_id = wft_user' ) ) |
| 1361 | + ); |
| 1362 | + |
| 1363 | + $button['up'] = '<img src="' . $wgScriptPath . '/extensions/WikiForum/icons/bullet_arrow_up.png" alt="" />'; |
| 1364 | + $button['down'] = '<img src="' . $wgScriptPath . '/extensions/WikiForum/icons/bullet_arrow_down.png" alt="" />'; |
| 1365 | + |
| 1366 | + // Non-moderators cannot post in an announcement-only forum |
| 1367 | + if( $data_overview->wff_announcement == true && !$wgUser->isAllowed( 'wikiforum-moderator' ) ) { |
| 1368 | + $write_thread = ''; |
| 1369 | + } else { |
| 1370 | + $icon = '<img src="' . $wgScriptPath . '/extensions/WikiForum/icons/note_add.png" title="' . wfMsg( 'wikiforum-write-thread' ) . '" /> '; |
| 1371 | + $write_thread = $icon . '<a href="' . $specialPage->escapeFullURL( array( 'writethread' => $forumIdNumber ) ) . '">' . |
| 1372 | + wfMsg( 'wikiforum-write-thread' ) . '</a>'; |
| 1373 | + } |
| 1374 | + |
| 1375 | + $output .= WikiForumGui::getSearchbox(); |
| 1376 | + $output .= WikiForumGui::getHeaderRow( |
| 1377 | + $data_overview->wfc_category, |
| 1378 | + $data_overview->wfc_category_name, |
| 1379 | + $forumIdNumber, |
| 1380 | + $data_overview->wff_forum_name, |
| 1381 | + $write_thread |
| 1382 | + ); |
| 1383 | + |
| 1384 | + // @todo FIXME: the logic here seems wonky from the end-users point |
| 1385 | + // of view and this code is horrible... |
| 1386 | + $output .= WikiForumGui::getMainHeader( |
| 1387 | + $data_overview->wff_forum_name . ' <a href="' . |
| 1388 | + $specialPage->escapeFullURL( array( 'st' => 'thread', 'sd' => 'up', 'forum' => $forumIdNumber ) ) . '">' . $button['up'] . |
| 1389 | + '</a><a href="' . |
| 1390 | + $specialPage->escapeFullURL( array( 'st' => 'thread', 'sd' => 'down', 'forum' => $forumIdNumber ) ) . '">' . $button['down'] . '</a>', |
| 1391 | + wfMsg( 'wikiforum-replies' ) . ' <a href="' . |
| 1392 | + $specialPage->escapeFullURL( array( 'st' => 'answers', 'sd' => 'up', 'forum' => $forumIdNumber ) ) . '">' . $button['up'] . |
| 1393 | + '</a><a href="' . $specialPage->escapeFullURL( array( 'st' => 'answers', 'sd' => 'down', 'forum' => $forumIdNumber ) ) . '">' . $button['down'] . '</a>', |
| 1394 | + wfMsg( 'wikiforum-views' ) . ' <a href="' . |
| 1395 | + $specialPage->escapeFullURL( array( 'st' => 'calls', 'sd' => 'up', 'forum' => $forumIdNumber ) ) . '">' . $button['up'] . '</a><a href="' . |
| 1396 | + $specialPage->escapeFullURL( array( 'st' => 'calls', 'sd' => 'down', 'forum' => $forumIdNumber ) ) . '">' . $button['down'] . '</a>', |
| 1397 | + wfMsg( 'wikiforum-latest-reply' ) . ' <a href="' . |
| 1398 | + $specialPage->escapeFullURL( array( 'st' => 'last', 'sd' => 'up', 'forum' => $forumIdNumber ) ) . '">' . $button['up'] . |
| 1399 | + '</a><a href="' . $specialPage->escapeFullURL( array( 'st' => 'last', 'sd' => 'up', 'forum' => $forumIdNumber ) ) . '">' . $button['down'] . '</a>', |
| 1400 | + false |
| 1401 | + ); |
| 1402 | + |
| 1403 | + $threads_exist = false; |
| 1404 | + foreach ( $sqlThreads as $thread ) { |
| 1405 | + $threads_exist = true; |
| 1406 | + $icon = $this->getThreadIcon( |
| 1407 | + $thread->wft_posted_timestamp, |
| 1408 | + $thread->wft_closed, |
| 1409 | + $thread->wft_sticky |
| 1410 | + ); |
| 1411 | + |
| 1412 | + $last_post = ''; |
| 1413 | + if( $thread->wft_reply_count > 0 ) { |
| 1414 | + $last_post = wfMsg( |
| 1415 | + 'wikiforum-by', |
| 1416 | + $wgLang->timeanddate( $thread->wft_last_post_timestamp ), |
| 1417 | + WikiForumClass::getUserLinkById( $thread->wft_last_post_user ) |
| 1418 | + ); |
| 1419 | + } |
| 1420 | + |
| 1421 | + if( $thread->wft_sticky == true ) { |
| 1422 | + $sticky = 'sticky'; |
| 1423 | + } else { |
| 1424 | + $sticky = false; |
| 1425 | + } |
| 1426 | + |
| 1427 | + $output .= WikiForumGui::getMainBody( |
| 1428 | + '<p class="mw-wikiforum-thread">' . $icon . |
| 1429 | + '<a href="' . $specialPage->escapeFullURL( array( 'thread' => $thread->wft_thread ) ) . '">' . |
| 1430 | + htmlspecialchars( $thread->wft_thread_name ) . '</a> |
| 1431 | + <p class="mw-wikiforum-descr">' . |
| 1432 | + wfMsg( |
| 1433 | + 'wikiforum-posted', |
| 1434 | + $wgLang->timeanddate( $thread->wft_posted_timestamp ), |
| 1435 | + WikiForumClass::getUserLink( $thread->user_name ) |
| 1436 | + ) . '</p></p>', |
| 1437 | + $thread->wft_reply_count, |
| 1438 | + $thread->wft_view_count, |
| 1439 | + $last_post, |
| 1440 | + false, |
| 1441 | + $sticky |
| 1442 | + ); |
| 1443 | + |
| 1444 | + } |
| 1445 | + if( $threads_exist == false ) { |
| 1446 | + $output .= WikiForumGui::getSingleLine( wfMsg( 'wikiforum-no-threads' ), 4 ); |
| 1447 | + } |
| 1448 | + $output .= WikiForumGui::getMainFooter(); |
| 1449 | + |
| 1450 | + $countReplies = ''; |
| 1451 | + |
| 1452 | + if( $limit_count > 0 ) { |
| 1453 | + $countReplies = $dbr->selectRow( |
| 1454 | + 'wikiforum_threads', |
| 1455 | + array( 'COUNT(*) AS count' ), |
| 1456 | + array( |
| 1457 | + 'wft_deleted' => 0, |
| 1458 | + 'wft_forum' => intval( $data_overview->wff_forum ) |
| 1459 | + ), |
| 1460 | + __METHOD__ |
| 1461 | + ); |
| 1462 | + $output .= WikiForumGui::getFooterRow( |
| 1463 | + $limit_page, |
| 1464 | + ( isset( $countReplies->count ) ? $countReplies->count : 0 ), |
| 1465 | + $limit_count, |
| 1466 | + $data_overview->wff_forum |
| 1467 | + ); |
| 1468 | + } |
| 1469 | + } else { |
| 1470 | + $this->errorTitle = wfMsg( 'wikiforum-forum-not-found' ); |
| 1471 | + $this->errorMessage = wfMsg( |
| 1472 | + 'wikiforum-forum-not-found-text', |
| 1473 | + '<a href="' . $specialPage->escapeFullURL() . '">' . |
| 1474 | + wfMsg( 'wikiforum-overview' ) . '</a>' |
| 1475 | + ); |
| 1476 | + } |
| 1477 | + |
| 1478 | + $pastethread_link = ''; |
| 1479 | + if( $f_movethread > 0 ) { |
| 1480 | + $icon = '<img src="' . $wgScriptPath . '/extensions/WikiForum/icons/paste_plain.png" title="' . wfMsg( 'wikiforum-paste-thread' ) .'" /> '; |
| 1481 | + $pastethread_link = $icon . '<a href="' . $specialPage->escapeFullURL( array( 'pastethread' => $f_movethread ) ) . '">' . wfMsg('wikiforum-paste-thread' ) . '</a> '; |
| 1482 | + $output .= WikiForumGui::getHeaderRow( 0, '', 0, '', $pastethread_link ); |
| 1483 | + } |
| 1484 | + |
| 1485 | + $output .= $this->showFailure(); |
| 1486 | + return $output; |
| 1487 | + } |
| 1488 | + |
| 1489 | + function showThread( $threadId ) { |
| 1490 | + global $wgOut, $wgRequest, $wgUser, $wgLang, $wgScriptPath; |
| 1491 | + |
| 1492 | + $output = $this->showFailure(); |
| 1493 | + $dbr = wfGetDB( DB_SLAVE ); |
| 1494 | + |
| 1495 | + $sqlData = $dbr->select( |
| 1496 | + array( 'wikiforum_forums', 'wikiforum_category', 'wikiforum_threads', 'user' ), |
| 1497 | + array( |
| 1498 | + 'wft_thread', 'wft_thread_name', 'wft_text', 'wff_forum', |
| 1499 | + 'wff_forum_name', 'wfc_category', 'wfc_category_name', |
| 1500 | + 'user_name', 'user_id', 'wft_sticky', 'wft_edit_timestamp', |
| 1501 | + 'wft_edit_user', 'wft_posted_timestamp', 'wft_user', |
| 1502 | + 'wft_closed', 'wft_closed_user', |
| 1503 | + ), |
| 1504 | + array( |
| 1505 | + 'wff_deleted' => 0, |
| 1506 | + 'wfc_deleted' => 0, |
| 1507 | + 'wft_deleted' => 0, |
| 1508 | + 'wff_category = wfc_category', |
| 1509 | + 'wff_forum = wft_forum', |
| 1510 | + 'wft_thread' => intval( $threadId ) |
| 1511 | + ), |
| 1512 | + __METHOD__, |
| 1513 | + array(), |
| 1514 | + array( 'user' => array( 'LEFT JOIN', 'user_id = wft_user' ) ) |
| 1515 | + ); |
| 1516 | + |
| 1517 | + $data_overview = $dbr->fetchObject( $sqlData ); |
| 1518 | + |
| 1519 | + $maxRepliesPerPage = intval( wfMsgForContent( 'wikiforum-max-replies-per-page' ) ); |
| 1520 | + |
| 1521 | + // limiting |
| 1522 | + if( $maxRepliesPerPage && $wgRequest->getVal( 'lc' ) > 0 ) { |
| 1523 | + $limit_count = $wgRequest->getVal( 'lc' ); |
| 1524 | + } elseif( $maxRepliesPerPage > 0 ) { |
| 1525 | + $limit_count = $maxRepliesPerPage; |
| 1526 | + } |
| 1527 | + |
| 1528 | + if( is_numeric( $wgRequest->getVal( 'lp' ) ) ) { |
| 1529 | + $limit_page = $wgRequest->getVal( 'lp' ) - 1; |
| 1530 | + } else { |
| 1531 | + $limit_page = 0; |
| 1532 | + } |
| 1533 | + // end limiting |
| 1534 | + |
| 1535 | + $specialPage = SpecialPage::getTitleFor( 'WikiForum' ); |
| 1536 | + |
| 1537 | + if( $data_overview ) { |
| 1538 | + $queryOptions['ORDER BY'] = 'wfr_posted_timestamp ASC'; |
| 1539 | + if ( $limit_count > 0 ) { |
| 1540 | + $queryOptions['LIMIT'] = $limit_count; |
| 1541 | + $queryOptions['OFFSET'] = $limit_page * $limit_count; |
| 1542 | + } |
| 1543 | + $replies = $dbr->select( |
| 1544 | + array( 'wikiforum_replies', 'user' ), |
| 1545 | + array( '*', 'user_name', 'user_id' ), |
| 1546 | + array( |
| 1547 | + 'wfr_deleted' => 0, |
| 1548 | + 'wfr_thread' => $data_overview->wft_thread |
| 1549 | + ), |
| 1550 | + __METHOD__, |
| 1551 | + $queryOptions, |
| 1552 | + array( 'user' => array( 'LEFT JOIN', 'user_id = wfr_user' ) ) |
| 1553 | + ); |
| 1554 | + |
| 1555 | + if ( !wfReadOnly() ) { |
| 1556 | + $dbw = wfGetDB( DB_MASTER ); |
| 1557 | + $dbw->update( |
| 1558 | + 'wikiforum_threads', |
| 1559 | + array( 'wft_view_count = wft_view_count + 1' ), |
| 1560 | + array( 'wft_thread' => intval( $data_overview->wft_thread ) ), |
| 1561 | + __METHOD__ |
| 1562 | + ); |
| 1563 | + } |
| 1564 | + |
| 1565 | + $editButtons = $this->showThreadButtons( |
| 1566 | + $data_overview->wft_user, |
| 1567 | + $data_overview->wft_closed, |
| 1568 | + $data_overview->wft_thread, |
| 1569 | + $data_overview->wff_forum |
| 1570 | + ); |
| 1571 | + |
| 1572 | + $menuLink = ''; |
| 1573 | + |
| 1574 | + if( $wgUser->isAllowed( 'wikiforum-admin' ) ) { |
| 1575 | + if( $data_overview->wft_sticky == 1 ) { |
| 1576 | + $icon = '<img src="' . $wgScriptPath . '/extensions/WikiForum/icons/tag_blue_delete.png" title="' . wfMsg( 'wikiforum-remove-sticky' ) . '" /> '; |
| 1577 | + $menuLink = $icon . '<a href="' . $specialPage->escapeFullURL( array( 'removesticky' => $data_overview->wft_thread ) ) . '">' . |
| 1578 | + wfMsg( 'wikiforum-remove-sticky' ) . '</a> '; |
| 1579 | + } else { |
| 1580 | + $icon = '<img src="' . $wgScriptPath . '/extensions/WikiForum/icons/tag_blue_add.png" title="' . wfMsg( 'wikiforum-make-sticky' ) . '" /> '; |
| 1581 | + $menuLink = $icon . '<a href="' . $specialPage->escapeFullURL( array( 'makesticky' => $data_overview->wft_thread ) ) . '">' . |
| 1582 | + wfMsg( 'wikiforum-make-sticky' ) . '</a> '; |
| 1583 | + } |
| 1584 | + } |
| 1585 | + |
| 1586 | + $icon = '<img src="' . $wgScriptPath . '/extensions/WikiForum/icons/comment_add.png" title="' . wfMsg( 'wikiforum-write-reply' ) . '" /> '; |
| 1587 | + // Replying is only possible to open threads |
| 1588 | + if( $data_overview->wft_closed == 0 ) { |
| 1589 | + $menuLink .= $icon . '<a href="#writereply">' . |
| 1590 | + wfMsg( 'wikiforum-write-reply' ) . '</a>'; |
| 1591 | + } |
| 1592 | + |
| 1593 | + $posted = wfMsg( |
| 1594 | + 'wikiforum-posted', |
| 1595 | + $wgLang->timeanddate( $data_overview->wft_posted_timestamp ), |
| 1596 | + WikiForumClass::getUserLink( $data_overview->user_name ) |
| 1597 | + ); |
| 1598 | + if( $data_overview->wft_edit_timestamp > 0 ) { |
| 1599 | + $posted .= '<br /><i>' . |
| 1600 | + wfMsg( |
| 1601 | + 'wikiforum-edited', |
| 1602 | + $wgLang->timeanddate( $data_overview->wft_edit_timestamp ), |
| 1603 | + WikiForumClass::getUserLinkById( $data_overview->wft_edit_user ) |
| 1604 | + ) . '</i>'; |
| 1605 | + } |
| 1606 | + |
| 1607 | + $output .= WikiForumGui::getSearchbox(); |
| 1608 | + $output .= WikiForumGui::getHeaderRow( |
| 1609 | + $data_overview->wfc_category, |
| 1610 | + $data_overview->wfc_category_name, |
| 1611 | + $data_overview->wff_forum, |
| 1612 | + $data_overview->wff_forum_name, |
| 1613 | + $menuLink |
| 1614 | + ); |
| 1615 | + |
| 1616 | + // Add topic name to the title |
| 1617 | + // @todo FIXME: this is lame and doesn't apply to the <title> attribute |
| 1618 | + $wgOut->setPageTitle( wfMsg( 'wikiforum-topic-name', $data_overview->wft_thread_name ) ); |
| 1619 | + |
| 1620 | + $output .= WikiForumGui::getThreadHeader( |
| 1621 | + htmlspecialchars( $data_overview->wft_thread_name ), |
| 1622 | + $this->parseIt( $data_overview->wft_text ),//$wgOut->parse( $data_overview->wft_text ), |
| 1623 | + $posted, |
| 1624 | + $editButtons, |
| 1625 | + $data_overview->wft_thread, |
| 1626 | + $data_overview->user_id |
| 1627 | + ); |
| 1628 | + |
| 1629 | + foreach ( $replies as $reply ) { |
| 1630 | + $editButtons = $this->showReplyButtons( |
| 1631 | + $reply->wfr_user, |
| 1632 | + $reply->wfr_reply_id, |
| 1633 | + $data_overview->wft_thread, |
| 1634 | + $data_overview->wft_closed |
| 1635 | + ); |
| 1636 | + |
| 1637 | + $posted = wfMsg( |
| 1638 | + 'wikiforum-posted', |
| 1639 | + $wgLang->timeanddate( $reply->wfr_posted_timestamp ), |
| 1640 | + WikiForumClass::getUserLink( $reply->user_name ) |
| 1641 | + ); |
| 1642 | + if( $reply->wfr_edit_timestamp > 0 ) { |
| 1643 | + $posted .= '<br /><i>' . |
| 1644 | + wfMsg( |
| 1645 | + 'wikiforum-edited', |
| 1646 | + $wgLang->timeanddate( $reply->wfr_edit_timestamp ), |
| 1647 | + WikiForumClass::getUserLinkById( $reply->wfr_edit_user ) |
| 1648 | + ) . '</i>'; |
| 1649 | + } |
| 1650 | + |
| 1651 | + $output .= WikiForumGui::getReply( |
| 1652 | + $this->parseIt( $reply->wfr_reply_text ),//$wgOut->parse( $reply->wfr_reply_text ), |
| 1653 | + $posted, |
| 1654 | + $editButtons, |
| 1655 | + $reply->wfr_reply_id, |
| 1656 | + $reply->user_id |
| 1657 | + ); |
| 1658 | + } |
| 1659 | + |
| 1660 | + $output .= WikiForumGui::getThreadFooter(); |
| 1661 | + |
| 1662 | + if( $limit_count > 0 ) { |
| 1663 | + $countReplies = $dbr->selectRow( |
| 1664 | + 'wikiforum_replies', |
| 1665 | + 'COUNT(*) AS count', |
| 1666 | + array( |
| 1667 | + 'wfr_deleted' => 0, |
| 1668 | + 'wfr_thread' => $data_overview->wft_thread |
| 1669 | + ), |
| 1670 | + __METHOD__ |
| 1671 | + ); |
| 1672 | + $output .= WikiForumGui::getFooterRow( |
| 1673 | + $limit_page, |
| 1674 | + $countReplies->count, |
| 1675 | + $limit_count, |
| 1676 | + $data_overview->wff_forum |
| 1677 | + ); |
| 1678 | + } |
| 1679 | + |
| 1680 | + $mod_editcomment = $wgRequest->getInt( 'editcomment' ); |
| 1681 | + $mod_form = $wgRequest->getBool( 'form' ); |
| 1682 | + if( |
| 1683 | + $data_overview->wft_closed == 0 || |
| 1684 | + ( isset( $mod_editcomment ) && $mod_editcomment > 0 && |
| 1685 | + $mod_form != true && |
| 1686 | + $wgUser->isAllowed( 'wikiforum-moderator' ) |
| 1687 | + ) |
| 1688 | + ) |
| 1689 | + { |
| 1690 | + $output .= $this->showEditor( $data_overview->wft_thread, 'addcomment' ); |
| 1691 | + } else { |
| 1692 | + $this->errorTitle = wfMsg( 'wikiforum-thread-closed' ); |
| 1693 | + $this->errorMessage = wfMsg( 'wikiforum-error-thread-closed' ); |
| 1694 | + $this->errorIcon = 'lock.png';//'icon_thread_closed'; |
| 1695 | + } |
| 1696 | + } else { |
| 1697 | + $this->errorTitle = wfMsg( 'wikiforum-thread-not-found' ); |
| 1698 | + $this->errorMessage = wfMsg( |
| 1699 | + 'wikiforum-thread-not-found-text', |
| 1700 | + '<a href="' . $specialPage->escapeFullURL() . '">' . |
| 1701 | + wfMsg( 'wikiforum-overview' ) . '</a>' |
| 1702 | + ); |
| 1703 | + } |
| 1704 | + |
| 1705 | + $movethread_link = ''; |
| 1706 | + if( $wgUser->isAllowed( 'wikiforum-moderator' ) ) { |
| 1707 | + $icon = '<img src="' . $wgScriptPath . '/extensions/WikiForum/icons/note_go.png" title="' . wfMsg( 'wikiforum-move-thread' ) . '" /> '; |
| 1708 | + $movethread_link = $icon . '<a href="' . $specialPage->escapeFullURL( array( 'movethread' => $data_overview->wft_thread ) ) . '">' . wfMsg( 'wikiforum-move-thread' ) . '</a> '; |
| 1709 | + $output .= WikiForumGui::getHeaderRow( 0, '', 0, '', $movethread_link ); |
| 1710 | + } |
| 1711 | + |
| 1712 | + $output .= $this->showFailure(); |
| 1713 | + |
| 1714 | + return $output; |
| 1715 | + } |
| 1716 | + |
| 1717 | + /** |
| 1718 | + * Show the search results page. |
| 1719 | + * |
| 1720 | + * @param $what String: ENGLISH MOTHERFUCKER! DO YOU SPEAK IT? |
| 1721 | + * I mean...the search query string. |
| 1722 | + * @return HTML output |
| 1723 | + */ |
| 1724 | + function showSearchResults( $what ) { |
| 1725 | + global $wgOut, $wgRequest, $wgUser, $wgLang; |
| 1726 | + |
| 1727 | + $output = $this->showFailure(); |
| 1728 | + $output .= WikiForumGui::getSearchbox(); |
| 1729 | + $output .= WikiForumGui::getHeaderRow( 0, '', 0, '', '' ); |
| 1730 | + |
| 1731 | + if( strlen( $what ) > 1 ) { |
| 1732 | + $i = 0; |
| 1733 | + |
| 1734 | + $dbr = wfGetDB( DB_SLAVE ); |
| 1735 | + // buildLike() will escape the query properly, add the word LIKE |
| 1736 | + // and the "double quotes" |
| 1737 | + $likeString = $dbr->buildLike( $dbr->anyString(), $what, $dbr->anyString() ); |
| 1738 | + |
| 1739 | + $threadsTable = $dbr->tableName( 'wikiforum_threads' ); |
| 1740 | + $repliesTable = $dbr->tableName( 'wikiforum_replies' ); |
| 1741 | + |
| 1742 | + $sqlData = $dbr->query( |
| 1743 | + "SELECT wfr_posted_timestamp, wfr_user, wft_thread_name, wft_thread, wfr_reply_text AS Search, wfr_reply_id |
| 1744 | + FROM $repliesTable, $threadsTable |
| 1745 | + LEFT JOIN " . $dbr->tableName( 'user' ) . ' ON user_id = wft_user |
| 1746 | + WHERE wfr_deleted = 0 AND wft_deleted = 0 AND wft_thread = wfr_thread AND wfr_reply_text ' . $likeString . " |
| 1747 | + UNION ALL |
| 1748 | + SELECT wft_posted_timestamp, wft_user, wft_thread_name, wft_thread, wft_text AS Search, 0 FROM $threadsTable |
| 1749 | + LEFT JOIN " . $dbr->tableName( 'user' ) . ' ON user_id = wft_user |
| 1750 | + WHERE wft_deleted = 0 AND (wft_text ' . $likeString . ' OR wft_thread_name ' . $likeString . ') |
| 1751 | + ORDER BY wfr_posted_timestamp DESC LIMIT 0, 30', |
| 1752 | + __METHOD__ |
| 1753 | + ); |
| 1754 | + |
| 1755 | + $specialPage = SpecialPage::getTitleFor( 'WikiForum' ); |
| 1756 | + $output_temp = ''; |
| 1757 | + |
| 1758 | + foreach( $sqlData as $result ) { |
| 1759 | + $anchor = ''; |
| 1760 | + if( $result->wfr_reply_id > 0 ) { |
| 1761 | + $anchor = '#reply_' . $result->wfr_reply_id; |
| 1762 | + } |
| 1763 | + |
| 1764 | + $url = $specialPage->escapeFullURL( array( 'thread' => $result->wft_thread ) ); |
| 1765 | + |
| 1766 | + $posted = wfMsg( |
| 1767 | + 'wikiforum-posted', |
| 1768 | + $wgLang->timeanddate( $result->wfr_posted_timestamp ), |
| 1769 | + $this->getUserLinkById( $result->wfr_user ) |
| 1770 | + ) . '<br />' . wfMsg( |
| 1771 | + 'wikiforum-search-thread', |
| 1772 | + '<a href="' . $url . $anchor . '">' . |
| 1773 | + $result->wft_thread_name . |
| 1774 | + '</a>' |
| 1775 | + ); |
| 1776 | + |
| 1777 | + $output_temp .= WikiForumGui::getReply( |
| 1778 | + $this->parseIt( $result->Search ), |
| 1779 | + $posted, |
| 1780 | + false, |
| 1781 | + $result->wfr_reply_id, |
| 1782 | + $result->wft_user |
| 1783 | + ); |
| 1784 | + $i++; |
| 1785 | + } |
| 1786 | + |
| 1787 | + $title = wfMsgExt( 'wikiforum-search-hits', 'parsemag', $i ); |
| 1788 | + $output .= WikiForumGui::getReplyHeader( $title ); |
| 1789 | + $output .= $output_temp; |
| 1790 | + $output .= WikiForumGui::getThreadFooter(); |
| 1791 | + } else { |
| 1792 | + $this->errorTitle = wfMsg( 'wikiforum-error-search' ); |
| 1793 | + $this->errorMessage = wfMsg( 'wikiforum-error-search-missing-query' ); |
| 1794 | + } |
| 1795 | + $output .= $this->showFailure(); |
| 1796 | + return $output; |
| 1797 | + } |
| 1798 | + |
| 1799 | + /** |
| 1800 | + * Preview a reply. |
| 1801 | + */ |
| 1802 | + function previewIssue( $type, $id, $previewTitle, $previewText ) { |
| 1803 | + global $wgUser, $wgLang; |
| 1804 | + |
| 1805 | + $output = $this->showFailure(); |
| 1806 | + |
| 1807 | + $title = wfMsg( 'wikiforum-preview' ); |
| 1808 | + if( $previewTitle ) { |
| 1809 | + $title = wfMsg( 'wikiforum-preview-with-title', $previewTitle ); |
| 1810 | + } |
| 1811 | + $posted = wfMsg( |
| 1812 | + 'wikiforum-posted', |
| 1813 | + $wgLang->timeanddate( wfTimestampNow() ), |
| 1814 | + $this->getUserLinkById( $wgUser->getId() ) |
| 1815 | + ); |
| 1816 | + if( $type == 'addcomment' || $type == 'editcomment' ) { |
| 1817 | + $output .= WikiForumGui::getReplyHeader( $title ); |
| 1818 | + $output .= WikiForumGui::getReply( |
| 1819 | + $this->parseIt( $previewText ), |
| 1820 | + $posted, |
| 1821 | + false, |
| 1822 | + 0, |
| 1823 | + $wgUser->getId() |
| 1824 | + ); |
| 1825 | + } else { |
| 1826 | + $output .= WikiForumGui::getThreadHeader( |
| 1827 | + $title, |
| 1828 | + $this->parseIt( $previewText ), |
| 1829 | + $posted, |
| 1830 | + false, |
| 1831 | + false, |
| 1832 | + $wgUser->getId() |
| 1833 | + ); |
| 1834 | + } |
| 1835 | + $output .= WikiForumGui::getThreadFooter(); |
| 1836 | + |
| 1837 | + $this->result = false; |
| 1838 | + |
| 1839 | + $output .= $this->showEditor( $id, $type ); |
| 1840 | + |
| 1841 | + // Jack this adds an useless "Overview" link to the bottom of the page |
| 1842 | + // (below the save reply/cancel buttons) so I took the liberty of |
| 1843 | + // removing it |
| 1844 | + #$output .= WikiForumGui::getHeaderRow( 0, '', 0, '', '' ); |
| 1845 | + $output .= $this->showFailure(); |
| 1846 | + return $output; |
| 1847 | + } |
| 1848 | + |
| 1849 | + function writeThread( $forumId ) { |
| 1850 | + global $wgRequest, $wgUser; |
| 1851 | + |
| 1852 | + $output = $this->showFailure(); |
| 1853 | + $dbr = wfGetDB( DB_SLAVE ); |
| 1854 | + |
| 1855 | + $mod_editthread = $wgRequest->getInt( 'editthread' ); |
| 1856 | + if( $mod_editthread ) { // are we editing an existing thread? |
| 1857 | + $sqlData = $dbr->select( |
| 1858 | + array( |
| 1859 | + 'wikiforum_forums', 'wikiforum_category', |
| 1860 | + 'wikiforum_threads' |
| 1861 | + ), |
| 1862 | + array( |
| 1863 | + 'wff_forum', 'wff_forum_name', 'wfc_category', |
| 1864 | + 'wfc_category_name', 'wff_announcement' |
| 1865 | + ), |
| 1866 | + array( |
| 1867 | + 'wff_deleted' => 0, |
| 1868 | + 'wfc_deleted' => 0, |
| 1869 | + 'wft_deleted' => 0, |
| 1870 | + 'wff_category = wfc_category', |
| 1871 | + 'wff_forum = wft_forum', |
| 1872 | + 'wft_thread' => intval( $forumId ) |
| 1873 | + ), |
| 1874 | + __METHOD__ |
| 1875 | + ); |
| 1876 | + } else { // no, we're not editing an existing thread, we're starting a new one |
| 1877 | + $sqlData = $dbr->select( |
| 1878 | + array( 'wikiforum_forums', 'wikiforum_category' ), |
| 1879 | + array( |
| 1880 | + 'wff_forum', 'wff_forum_name', 'wfc_category', |
| 1881 | + 'wfc_category_name', 'wff_announcement' |
| 1882 | + ), |
| 1883 | + array( |
| 1884 | + 'wff_deleted' => 0, |
| 1885 | + 'wfc_deleted' => 0, |
| 1886 | + 'wff_category = wfc_category', |
| 1887 | + 'wff_forum' => intval( $forumId ) |
| 1888 | + ), |
| 1889 | + __METHOD__ |
| 1890 | + ); |
| 1891 | + } |
| 1892 | + $overview = $dbr->fetchObject( $sqlData ); |
| 1893 | + |
| 1894 | + // Everyone (privileged) can post to non-announcement forums and mods |
| 1895 | + // can post even to announcement-only forums |
| 1896 | + if( |
| 1897 | + $overview->wff_announcement == false || |
| 1898 | + $wgUser->isAllowed( 'wikiforum-moderator' ) |
| 1899 | + ) |
| 1900 | + { |
| 1901 | + $output .= WikiForumGui::getHeaderRow( |
| 1902 | + $overview->wfc_category, |
| 1903 | + $overview->wfc_category_name, |
| 1904 | + $overview->wff_forum, |
| 1905 | + $overview->wff_forum_name, |
| 1906 | + '' |
| 1907 | + ); |
| 1908 | + $output .= $this->showEditor( $overview->wff_forum, 'addthread' ); |
| 1909 | + $output .= $this->showFailure(); |
| 1910 | + } |
| 1911 | + |
| 1912 | + return $output; |
| 1913 | + } |
| 1914 | + |
| 1915 | + function showEditorCatForum( $id, $type, $values ) { |
| 1916 | + $title_prev = ''; |
| 1917 | + $text_prev = ''; |
| 1918 | + |
| 1919 | + $dbr = wfGetDB( DB_SLAVE ); |
| 1920 | + $save_button = wfMsg( 'wikiforum-save' ); |
| 1921 | + |
| 1922 | + if( isset( $values['text'] ) && strlen( $values['text'] ) > 0 ) { |
| 1923 | + $text_prev = $values['text']; |
| 1924 | + } |
| 1925 | + |
| 1926 | + // define variable to prevent E_NOTICE; the type of the variable |
| 1927 | + // is checked in WikiForumGui::getFormCatForum() |
| 1928 | + $overview = ''; |
| 1929 | + |
| 1930 | + if( $type == 'addcategory' ) { |
| 1931 | + $categoryName = wfMsg( 'wikiforum-add-category' ); |
| 1932 | + } elseif( $type == 'editcategory' ) { |
| 1933 | + $overview = $dbr->fetchObject( $dbr->select( |
| 1934 | + 'wikiforum_category', |
| 1935 | + array( 'wfc_category', 'wfc_category_name' ), |
| 1936 | + array( 'wfc_deleted' => 0, 'wfc_category' => intval( $id ) ), |
| 1937 | + __METHOD__ |
| 1938 | + )); |
| 1939 | + $id = $overview->wfc_category; |
| 1940 | + $title_prev = $overview->wfc_category_name; |
| 1941 | + $categoryName = wfMsg( 'wikiforum-edit-category' ); |
| 1942 | + } elseif( $type == 'addforum' ) { |
| 1943 | + $categoryName = wfMsg( 'wikiforum-add-forum' ); |
| 1944 | + } elseif( $type == 'editforum' ) { |
| 1945 | + $overview = $dbr->fetchObject( $dbr->select( |
| 1946 | + 'wikiforum_forums', |
| 1947 | + array( |
| 1948 | + 'wff_forum', 'wff_forum_name', 'wff_description', |
| 1949 | + 'wff_announcement' |
| 1950 | + ), |
| 1951 | + array( 'wff_deleted' => 0, 'wff_forum' => intval( $id ) ), |
| 1952 | + __METHOD__ |
| 1953 | + )); |
| 1954 | + $id = $overview->wff_forum; |
| 1955 | + $title_prev = $overview->wff_forum_name; |
| 1956 | + if( strlen( $text_prev ) == 0 ) { |
| 1957 | + $text_prev = $overview->wff_description; |
| 1958 | + } |
| 1959 | + $categoryName = wfMsg( 'wikiforum-edit-forum' ); |
| 1960 | + } |
| 1961 | + $action = array( $type => $id ); |
| 1962 | + |
| 1963 | + $output = WikiForumGui::getFormCatForum( |
| 1964 | + $type, $categoryName, $action, |
| 1965 | + $title_prev, $text_prev, $save_button, $overview |
| 1966 | + ); |
| 1967 | + $output .= $this->showFailure(); |
| 1968 | + return $output; |
| 1969 | + } |
| 1970 | + |
| 1971 | + function showEditor( $id, $type ) { |
| 1972 | + global $wgRequest, $wgLang; |
| 1973 | + |
| 1974 | + $text_prev = ''; |
| 1975 | + |
| 1976 | + $dbr = wfGetDB( DB_SLAVE ); |
| 1977 | + |
| 1978 | + if( $this->result == false ) { |
| 1979 | + $text_prev = $wgRequest->getVal( 'frmText' ); |
| 1980 | + $title_prev = $wgRequest->getVal( 'frmTitle' ); |
| 1981 | + } else { |
| 1982 | + $title_prev = wfMsg( 'wikiforum-thread-title' ); |
| 1983 | + } |
| 1984 | + |
| 1985 | + if( $type == 'addthread' || $type == 'editthread' ) { |
| 1986 | + $mod_editthread = $wgRequest->getInt( 'editthread' ); |
| 1987 | + $mod_preview = $wgRequest->getBool( 'butPreview' ); |
| 1988 | + if( $mod_editthread && $mod_editthread > 0 ) { |
| 1989 | + if( !$text_prev || !$title_prev || $mod_preview == true ) { |
| 1990 | + $data_thread = $dbr->fetchObject( $dbr->select( |
| 1991 | + 'wikiforum_threads', |
| 1992 | + array( 'wft_thread', 'wft_thread_name', 'wft_text' ), |
| 1993 | + array( |
| 1994 | + 'wft_deleted' => 0, |
| 1995 | + 'wft_thread' => intval( $mod_editthread ) |
| 1996 | + ), |
| 1997 | + __METHOD__ |
| 1998 | + )); |
| 1999 | + $action = array( |
| 2000 | + 'editthread' => $data_thread->wft_thread |
| 2001 | + ); |
| 2002 | + if( !$text_prev ) { |
| 2003 | + $text_prev = $data_thread->wft_text; |
| 2004 | + } |
| 2005 | + if( $title_prev == wfMsg( 'wikiforum-thread-title' ) ) { |
| 2006 | + $title_prev = $data_thread->wft_thread_name; |
| 2007 | + } |
| 2008 | + } |
| 2009 | + } else { |
| 2010 | + $action = array( 'addthread' => $id ); |
| 2011 | + } |
| 2012 | + $height = '25em'; |
| 2013 | + $save_button = wfMsg( 'wikiforum-save-thread' ); |
| 2014 | + $input = WikiForumGui::getInput( $title_prev ); |
| 2015 | + } else { // add reply |
| 2016 | + $mod_comment = $wgRequest->getInt( 'editcomment' ); |
| 2017 | + $mod_form = $wgRequest->getBool( 'form' ); |
| 2018 | + $mod_preview = $wgRequest->getBool( 'butPreview' ); |
| 2019 | + $mod_quotec = $wgRequest->getInt( 'quotecomment' ); |
| 2020 | + $mod_quotet = $wgRequest->getInt( 'quotethread' ); |
| 2021 | + |
| 2022 | + // quote |
| 2023 | + if( isset( $mod_quotec ) && $mod_quotec > 0 ) { |
| 2024 | + $reply = $dbr->fetchObject( $dbr->select( |
| 2025 | + array( 'wikiforum_replies', 'user' ), |
| 2026 | + array( 'wfr_reply_text', 'wfr_posted_timestamp', 'user_name' ), |
| 2027 | + array( 'wfr_deleted' => 0, 'wfr_reply_id' => $mod_quotec ), |
| 2028 | + __METHOD__, |
| 2029 | + array(), |
| 2030 | + array( 'user' => array( 'LEFT JOIN', 'user_id = wfr_user' ) ) |
| 2031 | + )); |
| 2032 | + if( $reply ) { |
| 2033 | + $posted = wfMsg( |
| 2034 | + 'wikiforum-posted', |
| 2035 | + $wgLang->timeanddate( $reply->wfr_posted_timestamp ), |
| 2036 | + // Jack: removed this here to make quoting work |
| 2037 | + // if this is present, then pressing the quote button |
| 2038 | + // will generate shit like [quote=Posted on foo by Bar |
| 2039 | + // <a href="https://www.mediawiki.org/wiki/User:Bar" title="Bar">Bar</a> ( |
| 2040 | + // <a href="https://www.mediawiki.org/wiki/Project:Administrators">administrator</a>) |
| 2041 | + // which is *not* what we want |
| 2042 | + /*$this->getUserLink(*/ $reply->user_name /*)*/ |
| 2043 | + ); |
| 2044 | + $text_prev = '[quote=' . $posted . ']' . |
| 2045 | + $reply->wfr_reply_text . '[/quote]'; |
| 2046 | + } |
| 2047 | + } elseif( isset( $mod_quotet ) && $mod_quotet > 0 ) { |
| 2048 | + $thread = $dbr->selectRow( |
| 2049 | + array( 'wikiforum_threads', 'user' ), |
| 2050 | + array( 'wft_text', 'wft_posted_timestamp', 'user_name' ), |
| 2051 | + array( 'wft_deleted' => 0, 'wft_thread' => $mod_quotet ), |
| 2052 | + __METHOD__, |
| 2053 | + array(), |
| 2054 | + array( 'user' => array( 'LEFT JOIN', 'user_id = wft_user' ) ) |
| 2055 | + ); |
| 2056 | + if( $thread ) { |
| 2057 | + $posted = wfMsg( |
| 2058 | + 'wikiforum-posted', |
| 2059 | + $wgLang->timeanddate( $thread->wft_posted_timestamp ), |
| 2060 | + // see the explanation above |
| 2061 | + /*$this->getUserLink(*/ $thread->user_name /*)*/ |
| 2062 | + ); |
| 2063 | + $text_prev = '[quote=' . $posted . ']' . |
| 2064 | + $thread->wft_text . '[/quote]'; |
| 2065 | + } |
| 2066 | + } |
| 2067 | + // end quote |
| 2068 | + |
| 2069 | + if( |
| 2070 | + isset( $mod_comment ) && $mod_comment > 0 && |
| 2071 | + ( $mod_form != true || $mod_preview == true ) |
| 2072 | + ) |
| 2073 | + { |
| 2074 | + if( $mod_preview == true ) { |
| 2075 | + $id = $wgRequest->getInt( 'thread' ); |
| 2076 | + } |
| 2077 | + $dbr = wfGetDB( DB_SLAVE ); |
| 2078 | + $reply = $dbr->fetchObject( $dbr->select( |
| 2079 | + 'wikiforum_replies', |
| 2080 | + array( 'wfr_reply_id', 'wfr_reply_text' ), |
| 2081 | + array( 'wfr_deleted' => 0, 'wfr_reply_id' => $mod_comment ), |
| 2082 | + __METHOD__ |
| 2083 | + )); |
| 2084 | + $action = array( |
| 2085 | + 'thread' => $id, |
| 2086 | + 'form' => true, |
| 2087 | + 'editcomment' => $reply->wfr_reply_id |
| 2088 | + ); |
| 2089 | + if( $mod_preview != true ) { |
| 2090 | + $text_prev = $reply->wfr_reply_text; |
| 2091 | + } |
| 2092 | + } else { |
| 2093 | + $action = array( 'addcomment' => $id, 'thread' => $id ); |
| 2094 | + } |
| 2095 | + $height = '10em'; |
| 2096 | + $input = ''; |
| 2097 | + $save_button = wfMsg( 'wikiforum-save-reply' ); |
| 2098 | + } |
| 2099 | + return WikiForumGui::getWriteForm( |
| 2100 | + $type, $action, $input, $height, $text_prev, $save_button |
| 2101 | + ); |
| 2102 | + } |
| 2103 | + |
| 2104 | + /** |
| 2105 | + * Show the reply buttons: new, edit and delete. |
| 2106 | + * |
| 2107 | + * @param $postedBy Integer: user ID of the person who started the topic |
| 2108 | + * @param $replyID Integer: ID number of the reply |
| 2109 | + * @param $threadID Integer: thread ID number |
| 2110 | + * @param $closed |
| 2111 | + * @return HTML |
| 2112 | + */ |
| 2113 | + private function showReplyButtons( $postedBy, $replyID, $threadID, $closed ) { |
| 2114 | + global $wgUser, $wgScriptPath; |
| 2115 | + |
| 2116 | + $specialPage = SpecialPage::getTitleFor( 'WikiForum' ); |
| 2117 | + $editButtons = '<a href="' . $specialPage->escapeFullURL( array( |
| 2118 | + 'thread' => $threadID, |
| 2119 | + 'quotecomment' => $replyID |
| 2120 | + ) ) . '#writereply">'; |
| 2121 | + $editButtons .= '<img src="' . $wgScriptPath . '/extensions/WikiForum/icons/comments_add.png" title="' . wfMsg( 'wikiforum-quote' ) . '" />'; |
| 2122 | + |
| 2123 | + if( |
| 2124 | + ( $wgUser->getId() == $postedBy && $closed == 0 ) || |
| 2125 | + $wgUser->isAllowed( 'wikiforum-moderator' ) |
| 2126 | + ) |
| 2127 | + { |
| 2128 | + $editButtons .= ' <a href="' . $specialPage->escapeFullURL( array( 'thread' => $threadID, 'editcomment' => $replyID ) ) . '#writereply">'; |
| 2129 | + $editButtons .= '<img src="' . $wgScriptPath . '/extensions/WikiForum/icons/comment_edit.png" title="' . wfMsg( 'wikiforum-edit-reply' ) . '" />'; |
| 2130 | + $editButtons .= '</a> <a href="' . $specialPage->escapeFullURL( array( 'thread' => $threadID, 'deletecomment' => $replyID ) ) . '">'; |
| 2131 | + $editButtons .= '<img src="' . $wgScriptPath . '/extensions/WikiForum/icons/comment_delete.png" title="' . wfMsg( 'wikiforum-delete-reply' ) . '" />'; |
| 2132 | + } |
| 2133 | + |
| 2134 | + $editButtons .= '</a>'; |
| 2135 | + |
| 2136 | + return $editButtons; |
| 2137 | + } |
| 2138 | + |
| 2139 | + /** |
| 2140 | + * Shows the edit/delete buttons for the topic author, moderators and also |
| 2141 | + * close (lock) and reopen (unlock) buttons for moderators. |
| 2142 | + * |
| 2143 | + * @param $postedBy Integer: user ID of the person who posted the thread |
| 2144 | + * @param $closed |
| 2145 | + * @param $threadID Integer: thread ID number |
| 2146 | + * @param $forumID Integer: forum ID number |
| 2147 | + * @return HTML |
| 2148 | + */ |
| 2149 | + private function showThreadButtons( $postedBy, $closed, $threadID, $forumID ) { |
| 2150 | + global $wgUser, $wgScriptPath; |
| 2151 | + |
| 2152 | + $editButtons = ''; |
| 2153 | + |
| 2154 | + $specialPage = SpecialPage::getTitleFor( 'WikiForum' ); |
| 2155 | + |
| 2156 | + $editButtons .= '<a href="' . $specialPage->escapeFullURL( array( 'thread' => $threadID, 'quotethread' => $threadID ) ) . '#writereply">'; |
| 2157 | + $editButtons .= '<img src="' . $wgScriptPath . '/extensions/WikiForum/icons/comments_add.png" title="' . wfMsg( 'wikiforum-quote' ) . '" />'; |
| 2158 | + $editButtons .= '</a>'; |
| 2159 | + |
| 2160 | + if( |
| 2161 | + $wgUser->getId() == $postedBy || |
| 2162 | + $wgUser->isAllowed( 'wikiforum-moderator' ) |
| 2163 | + ) |
| 2164 | + { |
| 2165 | + $editButtons .= ' <a href="' . $specialPage->escapeFullURL( array( 'editthread' => $threadID ) ) . '">'; |
| 2166 | + $editButtons .= '<img src="' . $wgScriptPath . '/extensions/WikiForum/icons/note_edit.png" title="' . wfMsg( 'wikiforum-edit-thread' ) . '" />'; |
| 2167 | + $editButtons .= '</a> <a href="' . $specialPage->escapeFullURL( array( 'forum' => $forumID, 'deletethread' => $threadID ) ) . '">'; |
| 2168 | + $editButtons .= '<img src="' . $wgScriptPath . '/extensions/WikiForum/icons/note_delete.png" title="' . wfMsg( 'wikiforum-delete-thread' ) . '" />'; |
| 2169 | + $editButtons .= '</a> '; |
| 2170 | + |
| 2171 | + // Only moderators can lock and reopen threads |
| 2172 | + if( $wgUser->isAllowed( 'wikiforum-moderator' ) ) { |
| 2173 | + if( $closed == 0 ) { |
| 2174 | + $editButtons .= ' <a href="' . $specialPage->escapeFullURL( array( 'closethread' => $threadID ) ) . '">'; |
| 2175 | + $editButtons .= '<img src="' . $wgScriptPath . '/extensions/WikiForum/icons/lock_add.png" title="' . wfMsg( 'wikiforum-close-thread' ) . '" />'; |
| 2176 | + $editButtons .= '</a>'; |
| 2177 | + } else { |
| 2178 | + $editButtons .= ' <a href="' . $specialPage->escapeFullURL( array( 'reopenthread' => $threadID ) ) . '">'; |
| 2179 | + $editButtons .= '<img src="' . $wgScriptPath . '/extensions/WikiForum/icons/lock_open.png" title="' . wfMsg( 'wikiforum-reopen-thread' ) . '" />'; |
| 2180 | + $editButtons .= '</a>'; |
| 2181 | + } |
| 2182 | + } |
| 2183 | + } |
| 2184 | + |
| 2185 | + return $editButtons; |
| 2186 | + } |
| 2187 | + |
| 2188 | + /** |
| 2189 | + * Show icons for administrative functions (edit, delete, sort up/down). |
| 2190 | + * |
| 2191 | + * @param $type String: either category or forum |
| 2192 | + * @param $id Integer |
| 2193 | + * @param $sortup Boolean |
| 2194 | + * @param $sortdown Boolean |
| 2195 | + * @return HTML |
| 2196 | + */ |
| 2197 | + private function showAdminIcons( $type, $id, $sortup, $sortdown ) { |
| 2198 | + global $wgUser, $wgScriptPath; |
| 2199 | + |
| 2200 | + $link = ''; |
| 2201 | + |
| 2202 | + if( $wgUser->isAllowed( 'wikiforum-admin' ) ) { |
| 2203 | + // Quick hack for fetching the correct icon |
| 2204 | + if ( $type == 'category' ) { |
| 2205 | + $iconName = 'database'; |
| 2206 | + } elseif ( $type == 'forum' ) { |
| 2207 | + $iconName = 'folder'; |
| 2208 | + } |
| 2209 | + |
| 2210 | + $specialPage = SpecialPage::getTitleFor( 'WikiForum' ); |
| 2211 | + |
| 2212 | + // For grep: wikiforum-edit-forum, wikiforum-edit-category, |
| 2213 | + // wikiforum-delete-forum, wikiforum-delete-category |
| 2214 | + //if( $wikiconf['icon_' . $type . '_edit'] ) { |
| 2215 | + $icon = '<img src="' . $wgScriptPath . '/extensions/WikiForum/icons/' . $iconName . '_edit.png" title="' . wfMsg( 'wikiforum-edit-' . $type ) . '" />'; |
| 2216 | + //} else { |
| 2217 | + // $icon = '<span class="small">' . wfMsg( 'wikiforum-edit' ) . '</span>'; |
| 2218 | + //} |
| 2219 | + $link = ' <a href="' . $specialPage->escapeFullURL( array( 'edit' . $type => $id ) ) . '">' . $icon . '</a>'; |
| 2220 | + |
| 2221 | + //if( $wikiconf['icon_' . $type . '_delete'] ) { |
| 2222 | + $icon = '<img src="' . $wgScriptPath . '/extensions/WikiForum/icons/' . $iconName . '_delete.png" title="' . wfMsg( 'wikiforum-delete-' . $type ) . '" />'; |
| 2223 | + //} else { |
| 2224 | + // $icon = '<span class="small">' . wfMsg( 'wikiforum-delete' ) . '</span>'; |
| 2225 | + //} |
| 2226 | + $link .= ' <a href="' . $specialPage->escapeFullURL( array( 'delete' . $type => $id ) ) . '">' . $icon . '</a>'; |
| 2227 | + |
| 2228 | + if( $sortup == true ) { |
| 2229 | + $icon = '<img src="' . $wgScriptPath . '/extensions/WikiForum/icons/arrow_up.png" title="' . wfMsg( 'wikiforum-sort-up' ) . '" />'; |
| 2230 | + $link .= ' <a href="' . $specialPage->escapeFullURL( array( $type . 'up' => $id ) ) . '">' . $icon . '</a>'; |
| 2231 | + } |
| 2232 | + |
| 2233 | + if( $sortdown == true ) { |
| 2234 | + $icon = '<img src="' . $wgScriptPath . '/extensions/WikiForum/icons/arrow_down.png" title="' . wfMsg( 'wikiforum-sort-down' ) . '" />'; |
| 2235 | + $link .= ' <a href="' . $specialPage->escapeFullURL( array( $type . 'down' => $id ) ) . '">' . $icon . '</a>'; |
| 2236 | + } |
| 2237 | + } |
| 2238 | + |
| 2239 | + return $link; |
| 2240 | + } |
| 2241 | + |
| 2242 | + /** |
| 2243 | + * Get a descriptive icon for the current thread. |
| 2244 | + * "New" icon for new threads (threads that are not over $dayDefinitionNew |
| 2245 | + * days old), sticky icon for stickied threads, |
| 2246 | + * locked icon for locked threads and an ordinary thread icon for |
| 2247 | + * everything else. |
| 2248 | + * |
| 2249 | + * @param $posted Integer: timestamp; when this thread was posted |
| 2250 | + * @param $closed Integer: if greater than zero, the thread is closed |
| 2251 | + * @param $sticky Boolean: if true, the thread is stickied |
| 2252 | + * @return HTML: img tag |
| 2253 | + */ |
| 2254 | + public static function getThreadIcon( $posted, $closed, $sticky ) { |
| 2255 | + global $wgScriptPath; |
| 2256 | + |
| 2257 | + // Threads that are this many days old or newer are considered "new" |
| 2258 | + $dayDefinitionNew = intval( wfMsgForContent( 'wikiforum-day-definition-new' ) ); |
| 2259 | + |
| 2260 | + $olderTimestamp = wfTimestamp( TS_MW, strtotime( '-' . $dayDefinitionNew . ' days' ) ); |
| 2261 | + |
| 2262 | + $imagePath = $wgScriptPath . '/extensions/WikiForum/icons'; |
| 2263 | + if( $sticky == 1 ) { |
| 2264 | + return '<img src="' . $imagePath . '/tag_blue.png" title="' . wfMsg( 'wikiforum-sticky' ) . '" /> '; |
| 2265 | + } elseif( $closed > 0 ) { |
| 2266 | + return '<img src="' . $imagePath . '/lock.png" title="' . wfMsg( 'wikiforum-thread-closed' ) . '" /> '; |
| 2267 | + } elseif( $posted > $olderTimestamp ) { |
| 2268 | + return '<img src="' . $imagePath . '/new.png" title="' . wfMsg( 'wikiforum-new-thread' ) . '" /> '; |
| 2269 | + } else { |
| 2270 | + return '<img src="' . $imagePath . '/note.png" title="' . wfMsg( 'wikiforum-thread' ) . '" /> '; |
| 2271 | + } |
| 2272 | + } |
| 2273 | + |
| 2274 | + /** |
| 2275 | + * If errorTitle and errorIcon class member variables are set, show an |
| 2276 | + * error message. |
| 2277 | + * |
| 2278 | + * @return HTML |
| 2279 | + */ |
| 2280 | + private function showFailure() { |
| 2281 | + global $wgScriptPath; |
| 2282 | + |
| 2283 | + $output = ''; |
| 2284 | + |
| 2285 | + if( strlen( $this->errorTitle ) > 0 ) { |
| 2286 | + if( strlen( $this->errorIcon ) > 0 ) { |
| 2287 | + $icon = '<img src="' . $wgScriptPath . '/extensions/WikiForum/icons/' . $this->errorIcon . '" /> '; |
| 2288 | + } else { |
| 2289 | + $icon = '<img src="' . $wgScriptPath . '/extensions/WikiForum/icons/exclamation.png" title="' . wfMsg( 'wikiforum-thread-closed' ) . '" /> '; |
| 2290 | + } |
| 2291 | + $output = '<br /><table class="mw-wikiforum-frame"><tr><td>' . $icon . |
| 2292 | + $this->errorTitle . '<p class="mw-wikiforum-descr">' . $this->errorMessage . |
| 2293 | + '</p></td></tr></table>'; |
| 2294 | + } |
| 2295 | + $this->errorTitle = ''; |
| 2296 | + $this->errorMessage = ''; |
| 2297 | + return $output; |
| 2298 | + } |
| 2299 | + |
| 2300 | + // Helper functions, moved from WikiForumHelperClass.php |
| 2301 | + /** |
| 2302 | + * Get the link to the specified user's userpage and group membership |
| 2303 | + * for administrators and ShoutWiki staff. |
| 2304 | + * For anonymous users, no link is generated, only the system message |
| 2305 | + * is returned. |
| 2306 | + * |
| 2307 | + * @param $username String: username |
| 2308 | + * @return HTML |
| 2309 | + */ |
| 2310 | + public static function getUserLink( $username ) { |
| 2311 | + global $wgContLang, $wgUser; |
| 2312 | + |
| 2313 | + if( $username ) { |
| 2314 | + $sk = $wgUser->getSkin(); |
| 2315 | + $retVal = $sk->makeLink( |
| 2316 | + $wgContLang->getNsText( NS_USER ) . ':' . $username, |
| 2317 | + htmlspecialchars( $username ) |
| 2318 | + ); |
| 2319 | + |
| 2320 | + $groups = User::newFromName( $username )->getEffectiveGroups(); |
| 2321 | + // @todo FIXME: this code is horrible, it basically does |
| 2322 | + // special-casing for staff and sysop groups |
| 2323 | + // instead it should handle only staff as a special case |
| 2324 | + // and treat bureaucrat, sysop etc. normally |
| 2325 | + // |
| 2326 | + // Staff tag for staff members |
| 2327 | + // This is a horrible, ShoutWiki-specific hack |
| 2328 | + $isStaff = in_array( 'staff', $groups ); |
| 2329 | + if ( $isStaff && function_exists( 'wfStaffSig' ) ) { |
| 2330 | + global $wgOut; |
| 2331 | + $staffSig = $wgOut->parse( '<staff />' ); |
| 2332 | + // copied from extensions/Comments/CommentClass.php |
| 2333 | + // really bad hack because we want to parse=firstline, but |
| 2334 | + // don't want wrapping <p> tags |
| 2335 | + if( substr( $staffSig, 0 , 3 ) == '<p>' ) { |
| 2336 | + $staffSig = substr( $staffSig, 3 ); |
| 2337 | + } |
| 2338 | + |
| 2339 | + if( substr( $staffSig, strlen( $staffSig ) - 4, 4 ) == '</p>' ) { |
| 2340 | + $staffSig = substr( $staffSig, 0, strlen( $staffSig ) - 4 ); |
| 2341 | + } |
| 2342 | + // end copied bad hack |
| 2343 | + $retVal = $retVal . $staffSig; |
| 2344 | + } elseif ( in_array( 'sysop', $groups ) && !$isStaff ) { |
| 2345 | + // we <3 i18n |
| 2346 | + $retVal = $retVal . wfMsg( 'word-separator' ) . |
| 2347 | + wfMsg( |
| 2348 | + 'parentheses', |
| 2349 | + User::makeGroupLinkHTML( 'sysop', User::getGroupMember( 'sysop' ) ) |
| 2350 | + ); |
| 2351 | + } elseif ( in_array( 'forumadmin', $groups ) && !$isStaff ) { |
| 2352 | + // this madness has to stop...really... |
| 2353 | + $retVal = $retVal . wfMsg( 'word-separator' ) . |
| 2354 | + wfMsg( |
| 2355 | + 'parentheses', |
| 2356 | + User::makeGroupLinkHTML( 'forumadmin', User::getGroupMember( 'forumadmin' ) ) |
| 2357 | + ); |
| 2358 | + } |
| 2359 | + return $retVal; |
| 2360 | + } else { |
| 2361 | + return wfMsg( 'wikiforum-anonymous' ); |
| 2362 | + } |
| 2363 | + } |
| 2364 | + |
| 2365 | + /** |
| 2366 | + * Get a link to the user's userpage unless the user is an anon (or MW |
| 2367 | + * default or some other script with UID = 0). |
| 2368 | + * |
| 2369 | + * @param $userId Integer: user ID number |
| 2370 | + * @return Mixed: string (MediaWiki:Wikiforum-anonymous) for users with |
| 2371 | + * UID = 0, HTML (link) for others |
| 2372 | + */ |
| 2373 | + public static function getUserLinkById( $userId ) { |
| 2374 | + if( $userId == 0 ) { |
| 2375 | + return wfMsg( 'wikiforum-anonymous' ); |
| 2376 | + } else { |
| 2377 | + return self::getUserLink( User::whoIs( $userId ) ); |
| 2378 | + } |
| 2379 | + } |
| 2380 | + |
| 2381 | + /** |
| 2382 | + * "Prepare" smilies by wrapping them in <nowiki>. |
| 2383 | + * |
| 2384 | + * @param $text String: text to search for smilies |
| 2385 | + * @return $text String: input text with smilies wrapped inside <nowiki> |
| 2386 | + */ |
| 2387 | + function prepareSmilies( $text ) { |
| 2388 | + global $wgWikiForumSmilies; |
| 2389 | + |
| 2390 | + if( is_array( $wgWikiForumSmilies ) ) { |
| 2391 | + foreach( $wgWikiForumSmilies as $key => $icon ) { |
| 2392 | + $text = str_replace( |
| 2393 | + $key, |
| 2394 | + '<nowiki>' . $key . '</nowiki>', |
| 2395 | + $text |
| 2396 | + ); |
| 2397 | + } |
| 2398 | + } |
| 2399 | + return $text; |
| 2400 | + } |
| 2401 | + |
| 2402 | + function getSmilies( $text ) { |
| 2403 | + global $wgScriptPath; |
| 2404 | + global $wgWikiForumSmilies; |
| 2405 | + |
| 2406 | + // damn unclear code => need a better preg_replace patter to simplify |
| 2407 | + if( is_array( $wgWikiForumSmilies ) && !empty( $wgWikiForumSmilies ) ) { |
| 2408 | + $path = $wgScriptPath . '/extensions/WikiForum'; |
| 2409 | + foreach( $wgWikiForumSmilies as $key => $icon ) { |
| 2410 | + $text = str_replace( |
| 2411 | + $key, |
| 2412 | + '<img src="' . $path . '/' . $icon . '" title="' . $key . '"/>', |
| 2413 | + $text |
| 2414 | + ); |
| 2415 | + $text = str_replace( |
| 2416 | + '<nowiki><img src="' . $path . '/' . $icon . '" title="' . $key . '"/></nowiki>', |
| 2417 | + $key, |
| 2418 | + $text |
| 2419 | + ); |
| 2420 | + $text = preg_replace( |
| 2421 | + '/\<nowiki\>(.+)\<\/nowiki\>/iUs', |
| 2422 | + '\1', |
| 2423 | + $text |
| 2424 | + ); |
| 2425 | + } |
| 2426 | + } |
| 2427 | + return $text; |
| 2428 | + } |
| 2429 | + |
| 2430 | + function parseIt( $text ) { |
| 2431 | + global $wgOut; |
| 2432 | + |
| 2433 | + // add smilies for reply text |
| 2434 | + $text = $this->prepareSmilies( $text ); |
| 2435 | + $text = $wgOut->parse( $text ); |
| 2436 | + $text = $this->parseLinks( $text ); |
| 2437 | + $text = $this->parseQuotes( $text ); |
| 2438 | + $text = $this->getSmilies( $text ); |
| 2439 | + |
| 2440 | + return $text; |
| 2441 | + } |
| 2442 | + |
| 2443 | + function parseLinks( $text ) { |
| 2444 | + $text = preg_replace_callback( |
| 2445 | + '/\[thread#(.*?)\]/i', |
| 2446 | + array( $this, 'getThreadTitle' ), |
| 2447 | + $text |
| 2448 | + ); |
| 2449 | + return $text; |
| 2450 | + } |
| 2451 | + |
| 2452 | + function parseQuotes( $text ) { |
| 2453 | + $text = preg_replace( |
| 2454 | + '/\[quote=(.*?)\]/', |
| 2455 | + '<blockquote><p class="posted">\1</p><span>»</span>', |
| 2456 | + $text |
| 2457 | + ); |
| 2458 | + $text = str_replace( |
| 2459 | + '[quote]', |
| 2460 | + '<blockquote><span>»</span>', |
| 2461 | + $text |
| 2462 | + ); |
| 2463 | + $text = str_replace( |
| 2464 | + '[/quote]', |
| 2465 | + '<span>«</span></blockquote>', |
| 2466 | + $text |
| 2467 | + ); |
| 2468 | + return $text; |
| 2469 | + } |
| 2470 | + |
| 2471 | + public static function deleteTags( $text ) { |
| 2472 | + $text = preg_replace( |
| 2473 | + '/\<WikiForumThread id=(.*?)\/\>/', |
| 2474 | + '<WikiForumThread id=\1/>', |
| 2475 | + $text |
| 2476 | + ); |
| 2477 | + $text = preg_replace( |
| 2478 | + '/\<WikiForumList(.*)\/>/', |
| 2479 | + '<WikiForumList \1/>', |
| 2480 | + $text |
| 2481 | + ); |
| 2482 | + return $text; |
| 2483 | + } |
| 2484 | + |
| 2485 | + /** |
| 2486 | + * Get the title of a thread when we know its ID number. |
| 2487 | + * |
| 2488 | + * @param $id Integer: thread ID number |
| 2489 | + * @return String: thread title |
| 2490 | + */ |
| 2491 | + function getThreadTitle( $id ) { |
| 2492 | + if( is_numeric( $id[1] ) && $id[1] > 0 ) { |
| 2493 | + $dbr = wfGetDB( DB_SLAVE ); |
| 2494 | + $overview = $dbr->select( |
| 2495 | + 'wikiforum_threads', |
| 2496 | + 'wft_thread_name', |
| 2497 | + array( |
| 2498 | + 'wft_deleted' => 0, |
| 2499 | + 'wft_thread' => intval( $id[1] ) |
| 2500 | + ), |
| 2501 | + __METHOD__ |
| 2502 | + ); |
| 2503 | + |
| 2504 | + $specialPage = SpecialPage::getTitleFor( 'WikiForum' ); |
| 2505 | + if( $overview ) { |
| 2506 | + return '<i><a href="' . $specialPage->escapeFullURL( array( 'thread' => $id[1] ) ) . '">' . |
| 2507 | + $overview->wft_thread_name . '</a></i>'; |
| 2508 | + } else { |
| 2509 | + return '[' . wfMsg( 'wikiforum-thread-deleted' ) . ']'; |
| 2510 | + } |
| 2511 | + } |
| 2512 | + return $id[0]; |
| 2513 | + } |
| 2514 | + |
| 2515 | +} |
\ No newline at end of file |
Property changes on: trunk/extensions/WikiForum/WikiForumClass.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 2516 | + native |
Index: trunk/extensions/WikiForum/WikiForum.alias.php |
— | — | @@ -0,0 +1,19 @@ |
| 2 | +<?php |
| 3 | +/** |
| 4 | + * Aliases for WikiForum extension. |
| 5 | + * |
| 6 | + * @file |
| 7 | + * @ingroup Extensions |
| 8 | + */ |
| 9 | + |
| 10 | +$aliases = array(); |
| 11 | + |
| 12 | +/** English */ |
| 13 | +$aliases['en'] = array( |
| 14 | + 'WikiForum' => array( 'WikiForum', 'Forum' ), |
| 15 | +); |
| 16 | + |
| 17 | +/** Finnish (Suomi) */ |
| 18 | +$aliases['fi'] = array( |
| 19 | + 'WikiForum' => array( 'WikiFoorumi', 'Foorumi' ), |
| 20 | +); |
\ No newline at end of file |
Property changes on: trunk/extensions/WikiForum/WikiForum.alias.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 21 | + native |
Index: trunk/extensions/WikiForum/styles.css |
— | — | @@ -0,0 +1,218 @@ |
| 2 | +/* CSS styles for WikiForum extension */ |
| 3 | +table.mw-wikiforum-frame { |
| 4 | + width: 100%; |
| 5 | + background: #f6f6f6; |
| 6 | + border: 1px dotted #ccc; |
| 7 | + margin-bottom: 1.2em; |
| 8 | +} |
| 9 | +td.mw-wikiforum-innerframe { |
| 10 | + border: 1px solid #ddd; |
| 11 | +} |
| 12 | + |
| 13 | +table.mw-wikiforum-headerrow { |
| 14 | + width: 100%; |
| 15 | + font-size: 10px; |
| 16 | + font-family: Verdana, Arial, sans-serif; |
| 17 | + margin-top: 1.2em; |
| 18 | + background: transparent; |
| 19 | +} |
| 20 | + |
| 21 | +table.mw-wikiforum-footerrow { |
| 22 | + width: 100%; |
| 23 | + font-size: 10px; |
| 24 | + font-family: Verdana, Arial, sans-serif; |
| 25 | + margin-bottom: 1.2em; |
| 26 | + text-transform: uppercase; |
| 27 | +} |
| 28 | +td.mw-wikiforum-leftside { |
| 29 | + text-align: left; |
| 30 | +} |
| 31 | +td.mw-wikiforum-rightside { |
| 32 | + text-align: right; |
| 33 | +} |
| 34 | + |
| 35 | +table.mw-wikiforum-title { |
| 36 | + width: 100%; |
| 37 | + border-collapse: collapse; |
| 38 | + background: transparent; |
| 39 | +} |
| 40 | +table.mw-wikiforum-mainpage { |
| 41 | + width: 100%; |
| 42 | + border-collapse: collapse; |
| 43 | + background: transparent; |
| 44 | +} |
| 45 | +.mw-wikiforum-mainpage tr.mw-wikiforum-title { |
| 46 | + background: #f2ddce; |
| 47 | + height: 2.4em; |
| 48 | +} |
| 49 | +.mw-wikiforum-mainpage th.mw-wikiforum-lastpost { |
| 50 | + border-right: 1px solid #a3bfb1; |
| 51 | +} |
| 52 | +.mw-wikiforum-mainpage th.mw-wikiforum-title { |
| 53 | + border-left: 1px solid #a3bfb1; |
| 54 | +} |
| 55 | +.mw-wikiforum-mainpage td.mw-wikiforum-title { |
| 56 | + background: transparent; |
| 57 | + padding: 5px; |
| 58 | +} |
| 59 | +.mw-wikiforum-mainpage td.mw-wikiforum-value { |
| 60 | + background: transparent; |
| 61 | +} |
| 62 | + |
| 63 | +tr.mw-wikiforum-title { |
| 64 | + background: #cedff2; |
| 65 | + height: 3em; |
| 66 | +} |
| 67 | +th.mw-wikiforum-title { |
| 68 | + font-size: 120%; |
| 69 | + font-weight: bold; |
| 70 | + text-align: left; |
| 71 | + padding-left: 10px; |
| 72 | + border-bottom: 1px solid #a3bfb1; |
| 73 | + border-top: 1px solid #a3bfb1; |
| 74 | +} |
| 75 | +th.mw-wikiforum-value { |
| 76 | + width: 90px; |
| 77 | + border-bottom: 1px solid #a3bfb1; |
| 78 | + border-top: 1px solid #a3bfb1; |
| 79 | + text-align: center; |
| 80 | +} |
| 81 | +th.mw-wikiforum-admin { |
| 82 | + border-bottom: 1px solid #a3bfb1; |
| 83 | + border-top: 1px solid #a3bfb1; |
| 84 | + text-align: right; |
| 85 | +} |
| 86 | +th.mw-wikiforum-lastpost { |
| 87 | + width: 180px; |
| 88 | + border-bottom: 1px solid #a3bfb1; |
| 89 | + border-top: 1px solid #a3bfb1; |
| 90 | + text-align: center; |
| 91 | +} |
| 92 | +p.mw-wikiforum-valuetitle { |
| 93 | + font-family: Verdana, Arial, sans-serif; |
| 94 | + font-size: 10px; |
| 95 | +} |
| 96 | +tr.mw-wikiforum-normal { |
| 97 | + background: #f5faff; |
| 98 | +} |
| 99 | +tr.mw-wikiforum-sticky { |
| 100 | + background: #e5eaff; |
| 101 | +} |
| 102 | +td.mw-wikiforum-title { |
| 103 | + text-align: left; |
| 104 | + padding-left: 10px; |
| 105 | + border-bottom: 1px solid #a3bfb1; |
| 106 | +} |
| 107 | +td.mw-wikiforum-value { |
| 108 | + border-bottom: 1px solid #a3bfb1; |
| 109 | + text-align: center; |
| 110 | + font-family: Verdana, Arial, sans-serif; |
| 111 | + font-size: 10px; |
| 112 | +} |
| 113 | +td.mw-wikiforum-admin { |
| 114 | + border-bottom: 1px solid #a3bfb1; |
| 115 | + text-align: right; |
| 116 | + font-family: Verdana, Arial, sans-serif; |
| 117 | + font-size: 10px; |
| 118 | +} |
| 119 | +p.mw-wikiforum-issue { |
| 120 | + font-weight: bold; |
| 121 | +} |
| 122 | +p.mw-wikiforum-thread { |
| 123 | +} |
| 124 | +p.mw-wikiforum-descr { |
| 125 | + color: #999999; |
| 126 | + font-family: Verdana, Arial, sans-serif; |
| 127 | + font-size: 10px; |
| 128 | +} |
| 129 | + |
| 130 | +span.small { |
| 131 | + font-size: 10px; |
| 132 | + font-family: Verdana, Arial, sans-serif; |
| 133 | + font-weight: normal; |
| 134 | +} |
| 135 | + |
| 136 | +table.mw-wikiforum-posted { |
| 137 | + color: #999999; |
| 138 | + font-family: Verdana, Arial, sans-serif; |
| 139 | + font-size: 10px; |
| 140 | + border-top: 1px dashed #999999; |
| 141 | + width: 100%; |
| 142 | + background: transparent; |
| 143 | + margin-top: 16px; |
| 144 | + margin-bottom: 6px; |
| 145 | +} |
| 146 | + |
| 147 | +th.mw-wikiforum-thread-top { |
| 148 | + font-weight: bold; |
| 149 | + padding: 5px 10px; |
| 150 | + border: 1px solid #cef2e0; |
| 151 | + background: #e5eaff; |
| 152 | + text-align: left; |
| 153 | +} |
| 154 | +td.mw-wikiforum-thread-main { |
| 155 | + padding: 10px; |
| 156 | + border: 1px solid #cef2e0; |
| 157 | + background: #deeff3; |
| 158 | +} |
| 159 | +td.mw-wikiforum-thread-sub { |
| 160 | + padding: 0px 10px; |
| 161 | + border: 1px solid #cef2e0; |
| 162 | + background: #f0f0ea; |
| 163 | +} |
| 164 | + |
| 165 | +/* Search box */ |
| 166 | +#searchbox { |
| 167 | + float: right; |
| 168 | + margin-bottom: 8px; |
| 169 | +} |
| 170 | + |
| 171 | +#searchbox_border { |
| 172 | + border: 1px dotted #ccc; |
| 173 | + width: 200px; |
| 174 | + text-align: left; |
| 175 | + background: #f6f6f6; |
| 176 | +} |
| 177 | + |
| 178 | +#searchbox_picture { |
| 179 | + margin-left: 5px; |
| 180 | + margin-right: 5px; |
| 181 | +} |
| 182 | + |
| 183 | +#txtSearch { |
| 184 | + border: 0; |
| 185 | + background: transparent; |
| 186 | +} |
| 187 | + |
| 188 | +/* Quote styling */ |
| 189 | +blockquote { |
| 190 | + padding: 10px; |
| 191 | + border: 1px dotted #ccc; |
| 192 | + background: #f9f9f9; |
| 193 | +} |
| 194 | + |
| 195 | +blockquote p.posted { |
| 196 | + color: #bbb; |
| 197 | + font-family: Verdana, Arial, sans-serif; |
| 198 | + font-size: 10px; |
| 199 | + border-bottom: 1px dotted #999; |
| 200 | + background: transparent; |
| 201 | + margin-bottom: 6px; |
| 202 | + /*text-align: right;*/ |
| 203 | + /* Jack: removed on 2 Jan 2011 because it makes very little sense and also |
| 204 | + because we don't want to have the avatars overlapping the "Posted by" line */ |
| 205 | +} |
| 206 | + |
| 207 | +blockquote span { |
| 208 | + color: #bbb; |
| 209 | + font-family: Times New Roman; |
| 210 | + font-size: 30px; |
| 211 | + background: transparent; |
| 212 | + margin: 0 5px; |
| 213 | +} |
| 214 | + |
| 215 | +/* Align SocialProfile avatars to the right side and give it a bit of padding */ |
| 216 | +.wikiforum-avatar-image { |
| 217 | + float: right; |
| 218 | + padding-bottom: 5px; |
| 219 | +} |
Property changes on: trunk/extensions/WikiForum/styles.css |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 220 | + native |
Index: trunk/extensions/WikiForum/wikiforum.sql |
— | — | @@ -0,0 +1,75 @@ |
| 2 | +-- SQL schema for WikiForum extension |
| 3 | +-- Rewritten by Jack Phoenix <jack@countervandalism> in December 2010 |
| 4 | +-- the "formerly" comments refer to the names that Michael Chlebek, the |
| 5 | +-- original author of WikiForum, called those columns |
| 6 | +-- |
| 7 | +-- Most table names are quite self-explanatory, and the same goes for the |
| 8 | +-- fields. |
| 9 | +-- |
| 10 | +-- This schema should be SQLite-friendly, too. |
| 11 | +-- I followed this commit by Mark when making the changes: |
| 12 | +-- http://www.mediawiki.org/wiki/Special:Code/MediaWiki/77272 |
| 13 | + |
| 14 | +CREATE TABLE IF NOT EXISTS /*_*/wikiforum_category ( |
| 15 | + `wfc_category` int(10) NOT NULL PRIMARY KEY AUTO_INCREMENT, -- formerly: pkCategory |
| 16 | + `wfc_category_name` varchar(50) NOT NULL, -- formerly: Category_name |
| 17 | + `wfc_sortkey` mediumint(5) NOT NULL DEFAULT '9', -- formerly: SortKey |
| 18 | + `wfc_added_timestamp` binary(14) NOT NULL DEFAULT '', -- formerly: Added |
| 19 | + `wfc_added_user` int(10) NOT NULL DEFAULT '0', -- formerly: AddedBy |
| 20 | + `wfc_edited` int(10) NOT NULL DEFAULT '0', -- formerly: Edited |
| 21 | + `wfc_edited_user` int(10) NOT NULL DEFAULT '0', -- formerly: EditedBy |
| 22 | + `wfc_deleted` int(10) NOT NULL DEFAULT '0', -- formerly: Deleted |
| 23 | + `wfc_deleted_user` int(10) NOT NULL DEFAULT '0' -- formerly: DeletedBy |
| 24 | +); |
| 25 | + |
| 26 | +CREATE TABLE IF NOT EXISTS /*_*/wikiforum_forums ( |
| 27 | + `wff_forum` int(10) NOT NULL PRIMARY KEY AUTO_INCREMENT, -- formerly: pkForum |
| 28 | + `wff_forum_name` varchar(50) NOT NULL, -- formerly: Forum_name |
| 29 | + `wff_description` varchar(255) NOT NULL, -- formerly: Description |
| 30 | + `wff_category` int(10) NOT NULL, -- formerly: fkCategory |
| 31 | + `wff_sortkey` mediumint(5) NOT NULL DEFAULT '9', -- formerly: SortKey |
| 32 | + `wff_thread_count` int(10) NOT NULL DEFAULT '0', -- formerly: num_threads |
| 33 | + `wff_reply_count` int(10) NOT NULL DEFAULT '0', -- formerly: num_articles |
| 34 | + `wff_last_post_user` int(10) NOT NULL DEFAULT '0', -- formerly: lastpost_user |
| 35 | + `wff_last_post_timestamp` binary(14) NOT NULL DEFAULT '', -- formerly: lastpost_time |
| 36 | + `wff_added_timestamp` binary(14) NOT NULL DEFAULT '', -- formerly: Added |
| 37 | + `wff_added_user` int(10) NOT NULL DEFAULT '0', -- formerly: AddedBy |
| 38 | + `wff_edited_timestamp` binary(14) NOT NULL DEFAULT '', -- formerly: Edited |
| 39 | + `wff_edited_user` int(10) NOT NULL DEFAULT '0', -- formerly: EditedBy |
| 40 | + `wff_deleted` int(10) NOT NULL DEFAULT '0', -- formerly: Deleted |
| 41 | + `wff_deleted_user` int(10) NOT NULL DEFAULT '0', -- formerly: DeletedBy |
| 42 | + `wff_announcement` tinyint(2) NOT NULL DEFAULT '0' -- new in version 1.2; previously called "Announcement" |
| 43 | +); |
| 44 | + |
| 45 | +CREATE TABLE IF NOT EXISTS /*_*/wikiforum_threads ( |
| 46 | + `wft_thread` int(10) NOT NULL PRIMARY KEY AUTO_INCREMENT, -- formerly: pkThread |
| 47 | + `wft_thread_name` varchar(255) NOT NULL, -- formerly: Thread_name |
| 48 | + `wft_text` text NOT NULL, -- formerly: Text |
| 49 | + `wft_sticky` tinyint(1) NOT NULL DEFAULT '0', -- formerly: Sticky |
| 50 | + `wft_posted_timestamp` binary(14) NOT NULL DEFAULT '', -- formerly: Posted |
| 51 | + `wft_user` int(10) NOT NULL DEFAULT '0', -- formerly: PostedBy |
| 52 | + `wft_deleted` int(10) NOT NULL DEFAULT '0', -- formerly: Deleted |
| 53 | + `wft_deleted_user` int(10) NOT NULL DEFAULT '0', -- formerly: DeletedBy |
| 54 | + `wft_edit_timestamp` binary(14) NOT NULL DEFAULT '', -- formerly: Edit |
| 55 | + `wft_edit_user` int(10) NOT NULL DEFAULT '0', -- formerly: EditBy |
| 56 | + `wft_closed` int(10) NOT NULL DEFAULT '0', -- formerly: Closed |
| 57 | + `wft_closed_user` int(10) NOT NULL DEFAULT '0', -- formerly: ClosedBy |
| 58 | + `wft_forum` int(10) NOT NULL DEFAULT '0', -- formerly: fkForum |
| 59 | + `wft_reply_count` int(10) NOT NULL DEFAULT '0', -- formerly: num_answers |
| 60 | + `wft_view_count` int(10) NOT NULL DEFAULT '0', -- formerly: num_calls |
| 61 | + `wft_last_post_user` int(10) NOT NULL DEFAULT '0', -- formerly: lastpost_user |
| 62 | + `wft_last_post_timestamp` binary(14) NOT NULL DEFAULT '' -- formerly: lastpost_time |
| 63 | +); |
| 64 | + |
| 65 | +-- formerly: wikiforum_comments |
| 66 | +CREATE TABLE IF NOT EXISTS /*_*/wikiforum_replies ( |
| 67 | + `wfr_reply_id` int(10) NOT NULL PRIMARY KEY AUTO_INCREMENT, -- formerly: pkComment |
| 68 | + `wfr_reply_text` text NOT NULL, -- formerly: Comment |
| 69 | + `wfr_posted_timestamp` binary(14) NOT NULL DEFAULT '', -- formerly: Posted |
| 70 | + `wfr_user` int(10) NOT NULL DEFAULT '0', -- formerly: PostedBy |
| 71 | + `wfr_deleted` int(10) NOT NULL DEFAULT '0', -- formerly: Deleted |
| 72 | + `wfr_deleted_user` int(10) NOT NULL DEFAULT '0', -- formerly: DeletedBy |
| 73 | + `wfr_edit_timestamp` binary(14) NOT NULL DEFAULT '', -- formerly: Edit |
| 74 | + `wfr_edit_user` int(10) NOT NULL DEFAULT '0', -- formerly: EditBy |
| 75 | + `wfr_thread` int(10) NOT NULL -- formerly: fkThread |
| 76 | +); |
\ No newline at end of file |
Property changes on: trunk/extensions/WikiForum/wikiforum.sql |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 77 | + native |
Index: trunk/extensions/WikiForum/icons/comments_add.png |
Cannot display: file marked as a binary type. |
svn:mime-type = image/png |
Property changes on: trunk/extensions/WikiForum/icons/comments_add.png |
___________________________________________________________________ |
Added: svn:mime-type |
2 | 78 | + image/png |
Index: trunk/extensions/WikiForum/icons/folder_delete.png |
Cannot display: file marked as a binary type. |
svn:mime-type = image/png |
Property changes on: trunk/extensions/WikiForum/icons/folder_delete.png |
___________________________________________________________________ |
Added: svn:mime-type |
3 | 79 | + image/png |
Index: trunk/extensions/WikiForum/icons/arrow_up.png |
Cannot display: file marked as a binary type. |
svn:mime-type = image/png |
Property changes on: trunk/extensions/WikiForum/icons/arrow_up.png |
___________________________________________________________________ |
Added: svn:mime-type |
4 | 80 | + image/png |
Index: trunk/extensions/WikiForum/icons/paste_plain.png |
Cannot display: file marked as a binary type. |
svn:mime-type = image/png |
Property changes on: trunk/extensions/WikiForum/icons/paste_plain.png |
___________________________________________________________________ |
Added: svn:mime-type |
5 | 81 | + image/png |
Index: trunk/extensions/WikiForum/icons/lock_add.png |
Cannot display: file marked as a binary type. |
svn:mime-type = image/png |
Property changes on: trunk/extensions/WikiForum/icons/lock_add.png |
___________________________________________________________________ |
Added: svn:mime-type |
6 | 82 | + image/png |
Index: trunk/extensions/WikiForum/icons/tag_blue_delete.png |
Cannot display: file marked as a binary type. |
svn:mime-type = image/png |
Property changes on: trunk/extensions/WikiForum/icons/tag_blue_delete.png |
___________________________________________________________________ |
Added: svn:mime-type |
7 | 83 | + image/png |
Index: trunk/extensions/WikiForum/icons/exclamation.png |
Cannot display: file marked as a binary type. |
svn:mime-type = image/png |
Property changes on: trunk/extensions/WikiForum/icons/exclamation.png |
___________________________________________________________________ |
Added: svn:mime-type |
8 | 84 | + image/png |
Index: trunk/extensions/WikiForum/icons/note.png |
Cannot display: file marked as a binary type. |
svn:mime-type = image/png |
Property changes on: trunk/extensions/WikiForum/icons/note.png |
___________________________________________________________________ |
Added: svn:mime-type |
9 | 85 | + image/png |
Index: trunk/extensions/WikiForum/icons/bullet_arrow_up.png |
Cannot display: file marked as a binary type. |
svn:mime-type = image/png |
Property changes on: trunk/extensions/WikiForum/icons/bullet_arrow_up.png |
___________________________________________________________________ |
Added: svn:mime-type |
10 | 86 | + image/png |
Index: trunk/extensions/WikiForum/icons/comment_edit.png |
Cannot display: file marked as a binary type. |
svn:mime-type = image/png |
Property changes on: trunk/extensions/WikiForum/icons/comment_edit.png |
___________________________________________________________________ |
Added: svn:mime-type |
11 | 87 | + image/png |
Index: trunk/extensions/WikiForum/icons/lock_open.png |
Cannot display: file marked as a binary type. |
svn:mime-type = image/png |
Property changes on: trunk/extensions/WikiForum/icons/lock_open.png |
___________________________________________________________________ |
Added: svn:mime-type |
12 | 88 | + image/png |
Index: trunk/extensions/WikiForum/icons/database_edit.png |
Cannot display: file marked as a binary type. |
svn:mime-type = image/png |
Property changes on: trunk/extensions/WikiForum/icons/database_edit.png |
___________________________________________________________________ |
Added: svn:mime-type |
13 | 89 | + image/png |
Index: trunk/extensions/WikiForum/icons/note_edit.png |
Cannot display: file marked as a binary type. |
svn:mime-type = image/png |
Property changes on: trunk/extensions/WikiForum/icons/note_edit.png |
___________________________________________________________________ |
Added: svn:mime-type |
14 | 90 | + image/png |
Index: trunk/extensions/WikiForum/icons/comment_add.png |
Cannot display: file marked as a binary type. |
svn:mime-type = image/png |
Property changes on: trunk/extensions/WikiForum/icons/comment_add.png |
___________________________________________________________________ |
Added: svn:mime-type |
15 | 91 | + image/png |
Index: trunk/extensions/WikiForum/icons/folder.png |
Cannot display: file marked as a binary type. |
svn:mime-type = image/png |
Property changes on: trunk/extensions/WikiForum/icons/folder.png |
___________________________________________________________________ |
Added: svn:mime-type |
16 | 92 | + image/png |
Index: trunk/extensions/WikiForum/icons/database_add.png |
Cannot display: file marked as a binary type. |
svn:mime-type = image/png |
Property changes on: trunk/extensions/WikiForum/icons/database_add.png |
___________________________________________________________________ |
Added: svn:mime-type |
17 | 93 | + image/png |
Index: trunk/extensions/WikiForum/icons/note_add.png |
Cannot display: file marked as a binary type. |
svn:mime-type = image/png |
Property changes on: trunk/extensions/WikiForum/icons/note_add.png |
___________________________________________________________________ |
Added: svn:mime-type |
18 | 94 | + image/png |
Index: trunk/extensions/WikiForum/icons/folder_edit.png |
Cannot display: file marked as a binary type. |
svn:mime-type = image/png |
Property changes on: trunk/extensions/WikiForum/icons/folder_edit.png |
___________________________________________________________________ |
Added: svn:mime-type |
19 | 95 | + image/png |
Index: trunk/extensions/WikiForum/icons/arrow_down.png |
Cannot display: file marked as a binary type. |
svn:mime-type = image/png |
Property changes on: trunk/extensions/WikiForum/icons/arrow_down.png |
___________________________________________________________________ |
Added: svn:mime-type |
20 | 96 | + image/png |
Index: trunk/extensions/WikiForum/icons/tag_blue.png |
Cannot display: file marked as a binary type. |
svn:mime-type = image/png |
Property changes on: trunk/extensions/WikiForum/icons/tag_blue.png |
___________________________________________________________________ |
Added: svn:mime-type |
21 | 97 | + image/png |
Index: trunk/extensions/WikiForum/icons/folder_add.png |
Cannot display: file marked as a binary type. |
svn:mime-type = image/png |
Property changes on: trunk/extensions/WikiForum/icons/folder_add.png |
___________________________________________________________________ |
Added: svn:mime-type |
22 | 98 | + image/png |
Index: trunk/extensions/WikiForum/icons/comment_delete.png |
Cannot display: file marked as a binary type. |
svn:mime-type = image/png |
Property changes on: trunk/extensions/WikiForum/icons/comment_delete.png |
___________________________________________________________________ |
Added: svn:mime-type |
23 | 99 | + image/png |
Index: trunk/extensions/WikiForum/icons/zoom.png |
Cannot display: file marked as a binary type. |
svn:mime-type = image/png |
Property changes on: trunk/extensions/WikiForum/icons/zoom.png |
___________________________________________________________________ |
Added: svn:mime-type |
24 | 100 | + image/png |
Index: trunk/extensions/WikiForum/icons/database_delete.png |
Cannot display: file marked as a binary type. |
svn:mime-type = image/png |
Property changes on: trunk/extensions/WikiForum/icons/database_delete.png |
___________________________________________________________________ |
Added: svn:mime-type |
25 | 101 | + image/png |
Index: trunk/extensions/WikiForum/icons/note_delete.png |
Cannot display: file marked as a binary type. |
svn:mime-type = image/png |
Property changes on: trunk/extensions/WikiForum/icons/note_delete.png |
___________________________________________________________________ |
Added: svn:mime-type |
26 | 102 | + image/png |
Index: trunk/extensions/WikiForum/icons/bullet_arrow_down.png |
Cannot display: file marked as a binary type. |
svn:mime-type = image/png |
Property changes on: trunk/extensions/WikiForum/icons/bullet_arrow_down.png |
___________________________________________________________________ |
Added: svn:mime-type |
27 | 103 | + image/png |
Index: trunk/extensions/WikiForum/icons/lock.png |
Cannot display: file marked as a binary type. |
svn:mime-type = image/png |
Property changes on: trunk/extensions/WikiForum/icons/lock.png |
___________________________________________________________________ |
Added: svn:mime-type |
28 | 104 | + image/png |
Index: trunk/extensions/WikiForum/icons/new.png |
Cannot display: file marked as a binary type. |
svn:mime-type = image/png |
Property changes on: trunk/extensions/WikiForum/icons/new.png |
___________________________________________________________________ |
Added: svn:mime-type |
29 | 105 | + image/png |
Index: trunk/extensions/WikiForum/icons/note_go.png |
Cannot display: file marked as a binary type. |
svn:mime-type = image/png |
Property changes on: trunk/extensions/WikiForum/icons/note_go.png |
___________________________________________________________________ |
Added: svn:mime-type |
30 | 106 | + image/png |
Index: trunk/extensions/WikiForum/icons/tag_blue_add.png |
Cannot display: file marked as a binary type. |
svn:mime-type = image/png |
Property changes on: trunk/extensions/WikiForum/icons/tag_blue_add.png |
___________________________________________________________________ |
Added: svn:mime-type |
31 | 107 | + image/png |