external link icons removed, personal toolbar cleanup, relative paths
[lhc/web/wiklou.git] / includes / LogPage.php
index 0faeab6..6be15fe 100644 (file)
@@ -1,4 +1,4 @@
-<?
+<?php
 # Class to simplify the use of log pages
 
 class LogPage {
@@ -81,13 +81,9 @@ class LogPage {
                
                # And update recentchanges
                if ( $this->mUpdateRecentChanges ) {
-                       $sql = "INSERT INTO recentchanges (rc_timestamp,rc_cur_time,
-                       rc_user,rc_user_text,rc_namespace,rc_title,rc_comment,
-                       rc_cur_id) VALUES ('{$now}','{$now}',{$uid},'{$ut}',4,'" .
-                               wfStrencode( $this->mTitle ) . "','" .
-                               wfStrencode( $this->mComment ) . "',{$this->mId})";
-                       wfQuery( $sql, DB_WRITE, $fname );
-                       }
+                       $titleObj = Title::makeTitle( Namespace::getWikipedia(), $this->mTitle );
+                       RecentChange::notifyLog( $now, $titleObj, $wgUser, $this->mComment );
+               }
                return true;
        }
 
@@ -110,8 +106,14 @@ class LogPage {
                }
                $d = $wgLang->timeanddate( wfTimestampNow(), false );
 
-               preg_match( "/^(.*?)<ul>(.*)$/sD", $this->mContent, $m );
-
+               if( preg_match( "/^(.*?)<ul>(.*)$/sD", $this->mContent, $m ) ) {
+                       $before = $m[1];
+                       $after = $m[2];
+               } else {
+                       $before = "";
+                       $after = "";
+               }
+               
                if($textaction)
                        $this->mComment = $textaction;
                else
@@ -124,7 +126,7 @@ class LogPage {
                        # comment gets escaped again, so we use the unescaped version
                        $this->mComment .= ": {$comment}";
                }
-               $this->mContent = "{$m[1]}<ul><li>{$d} {$ul} {$action}{$inline}</li>\n{$m[2]}";
+               $this->mContent = "{$before}<ul><li>{$d} {$ul} {$action}{$inline}</li>\n{$after}";
                
                # TODO: automatic log rotation...