summaryrefslogtreecommitdiff
path: root/extensions
diff options
context:
space:
mode:
authorPierre Schmitz <pierre@archlinux.de>2007-04-15 09:19:03 +0000
committerPierre Schmitz <pierre@archlinux.de>2007-04-15 09:19:03 +0000
commit0bac06c301f2a83edb0236e4c2434da16848d549 (patch)
tree82b14bc9e54289838dbd2d1d68cb3766e5d97411 /extensions
parent806f1940fb465e096bb320675c186cc83cc95c8d (diff)
NewPages-Extension hinzugefĆ¼gt
Diffstat (limited to 'extensions')
-rw-r--r--extensions/FunnyDot.php6
-rw-r--r--extensions/LLAuthPlugin.php7
-rw-r--r--extensions/NewPages.php107
3 files changed, 120 insertions, 0 deletions
diff --git a/extensions/FunnyDot.php b/extensions/FunnyDot.php
index 93a66f08..418575e2 100644
--- a/extensions/FunnyDot.php
+++ b/extensions/FunnyDot.php
@@ -5,6 +5,12 @@ if ( defined( 'MEDIAWIKI' ) ) {
global $wgHooks;
$wgHooks['ArticleSave'][] = 'checkAntiSpamHash';
+$wgExtensionCredits['other'][] = array(
+ 'name' => 'FunnyDot',
+ 'description' => 'Schutz vor Spam-Bots',
+ 'author' => 'Pierre Schmitz',
+ 'url' => 'http://www.laber-land.de',
+);
function hexVal($in)
{
diff --git a/extensions/LLAuthPlugin.php b/extensions/LLAuthPlugin.php
index 1d7097f3..2d903b28 100644
--- a/extensions/LLAuthPlugin.php
+++ b/extensions/LLAuthPlugin.php
@@ -36,6 +36,13 @@
* @package MediaWiki
*/
+$wgExtensionCredits['other'][] = array(
+ 'name' => 'LLAuthPlugin',
+ 'description' => 'Authentifizierung am Laber-Land-Forum',
+ 'author' => 'Pierre Schmitz',
+ 'url' => 'http://www.laber-land.de',
+);
+
require_once('includes/AuthPlugin.php');
class LLAuthPlugin extends AuthPlugin {
diff --git a/extensions/NewPages.php b/extensions/NewPages.php
new file mode 100644
index 00000000..f11fb19c
--- /dev/null
+++ b/extensions/NewPages.php
@@ -0,0 +1,107 @@
+<?php
+#
+# This Mediawiki extension creates a bullet list of the most
+# recent new pages. This can be useful for a small project's
+# main page to give visitors a quick view of the new pages
+# created since the last visit.
+#
+# The wiki syntax is,
+#
+# <newpages>
+# limit=10
+# </newpages>
+#
+# where limit is the maximum number of new pages to show.
+#
+# To activate the extension, include it from your LocalSettings.php
+# with: require_once("extensions/NewPages.php");
+#
+# Author: Michael Meffie
+# Date: Jan 17 2006
+# Credits: This extension was derived from SpecialNewpages.php.
+# License: GPL v2.0
+#
+
+$wgExtensionFunctions[] = "wfNewPagesExtension";
+
+$wgExtensionCredits['parserhook'][] = array(
+ 'name' => 'NewPages',
+ 'author' => 'Michael Meffie',
+ 'url' => 'http://meta.wikimedia.org/wiki/User:Meffiem',
+);
+
+function wfNewPagesExtension() {
+ global $wgParser;
+ $wgParser->setHook( "newpages", "renderNewPages" );
+}
+
+function renderNewPages( $input, $args=null, &$parser) {
+ $localParser = new Parser();
+
+ $output = "<br />Keine neuen Seiten<br />";
+ $limit = 5;
+ getBoxOption($limit,$input,'limit',true);
+
+ $dbr =& wfGetDB( DB_SLAVE );
+ extract( $dbr->tableNames( 'recentchanges', 'page' ) );
+
+ $query_limit = $limit + 1; # to determine if we should display (more...)
+ $sql = "SELECT rc_namespace AS namespace,
+ rc_title AS title,
+ rc_cur_id AS value,
+ rc_user AS user,
+ rc_user_text AS user_text,
+ rc_comment as comment,
+ rc_timestamp AS timestamp,
+ rc_id AS rcid,
+ page_len as length,
+ page_latest as rev_id
+ FROM $recentchanges,$page
+ WHERE rc_cur_id=page_id AND rc_new=1
+ AND rc_namespace=".NS_MAIN." AND page_is_redirect=0
+ ORDER BY value DESC
+ LIMIT $query_limit";
+
+ $result = $dbr->query( $sql );
+ $num = $dbr->numRows( $result );
+ if ($num > 0) {
+ $output = "<ul>\n";
+ for ($i=0; $i<$num && $i<$limit; $i++) {
+ $row = $dbr->fetchObject( $result );
+ $s = formatRow( $row );
+ $output .= "<li>$s</li>\n";
+ }
+ if ($num > $limit) {
+ $more = $localParser->parse("[[Special:Newpages|mehr...]]", $parser->mTitle, $parser->mOptions);
+ $output .= "<li>".$more->getText()."</li>\n";
+ }
+ $output .= "</ul>\n";
+ }
+
+ $dbr->freeResult( $result );
+
+return $output;
+}
+
+function formatRow( $row ) {
+ global $wgLang, $wgUser;
+
+ $skin = $wgUser->getSkin();
+ $link = $skin->makeKnownLink( $row->title, '' );
+ $d = $wgLang->date( $row->timestamp, true );
+
+ $s = "$link, $d";
+ return $s;
+}
+
+function getBoxOption(&$value,&$input,$name,$isNumber=false) {
+ if(preg_match("/^\s*$name\s*=\s*(.*)/mi",$input,$matches)) {
+ if($isNumber) {
+ $value=intval($matches[1]);
+ } else {
+ $value=htmlspecialchars($matches[1]);
+ }
+ }
+}
+
+?> \ No newline at end of file