Serendipity blog software import
Modified: trunk/web/reactos.org/htdocs/roscms/inc/admin_subsys_check.php
Modified: trunk/web/reactos.org/htdocs/roscms/inc/admin_subsys_fix.php
Added: trunk/web/reactos.org/htdocs/roscms/inc/subsys_blogs.php
Modified: trunk/web/reactos.org/htdocs/roscms/inc/subsys_login.php
Added: trunk/web/reactos.org/htdocs/serendipity/
Added: trunk/web/reactos.org/htdocs/serendipity/.htaccess
Modified: trunk/web/reactos.org/htdocs/serendipity/include/functions_comments.inc.php
Modified: trunk/web/reactos.org/htdocs/serendipity/include/functions_config.inc.php
Added: trunk/web/reactos.org/htdocs/serendipity/plugins/serendipity_plugin_activeauthors/
Added: trunk/web/reactos.org/htdocs/serendipity/plugins/serendipity_plugin_activeauthors/lang_de.inc.php
Added: trunk/web/reactos.org/htdocs/serendipity/plugins/serendipity_plugin_activeauthors/lang_pt.inc.php
Added: trunk/web/reactos.org/htdocs/serendipity/plugins/serendipity_plugin_activeauthors/serendipity_plugin_activeauthors.php
Added: trunk/web/reactos.org/htdocs/serendipity/plugins/serendipity_plugin_roscmsaccount/
Added: trunk/web/reactos.org/htdocs/serendipity/plugins/serendipity_plugin_roscmsaccount/serendipity_plugin_roscmsaccount.php
Added: trunk/web/reactos.org/htdocs/serendipity/serendipity_config_local.inc.php
Added: trunk/web/reactos.org/htdocs/serendipity/templates/roscms/
Added: trunk/web/reactos.org/htdocs/serendipity/templates/roscms/commentform.tpl
Added: trunk/web/reactos.org/htdocs/serendipity/templates/roscms/comments.tpl
Added: trunk/web/reactos.org/htdocs/serendipity/templates/roscms/config.inc.php
Added: trunk/web/reactos.org/htdocs/serendipity/templates/roscms/entries.tpl
Added: trunk/web/reactos.org/htdocs/serendipity/templates/roscms/images/
Added: trunk/web/reactos.org/htdocs/serendipity/templates/roscms/images/kubrickbg.jpg
Added: trunk/web/reactos.org/htdocs/serendipity/templates/roscms/images/kubrickbgcolor.jpg
Added: trunk/web/reactos.org/htdocs/serendipity/templates/roscms/images/kubrickbgwide.jpg
Added: trunk/web/reactos.org/htdocs/serendipity/templates/roscms/images/kubrickfooter.jpg
Added: trunk/web/reactos.org/htdocs/serendipity/templates/roscms/images/kubrickheader.jpg
Added: trunk/web/reactos.org/htdocs/serendipity/templates/roscms/images/kubricklogo.jpg
Added: trunk/web/reactos.org/htdocs/serendipity/templates/roscms/images/kubrickportrait.png
Added: trunk/web/reactos.org/htdocs/serendipity/templates/roscms/img/
Added: trunk/web/reactos.org/htdocs/serendipity/templates/roscms/img/back.png
Added: trunk/web/reactos.org/htdocs/serendipity/templates/roscms/img/down.png
Added: trunk/web/reactos.org/htdocs/serendipity/templates/roscms/img/forward.png
Added: trunk/web/reactos.org/htdocs/serendipity/templates/roscms/img/up.png
Added: trunk/web/reactos.org/htdocs/serendipity/templates/roscms/index.tpl
Added: trunk/web/reactos.org/htdocs/serendipity/templates/roscms/info.txt
Added: trunk/web/reactos.org/htdocs/serendipity/templates/roscms/lang_de.inc.php
Added: trunk/web/reactos.org/htdocs/serendipity/templates/roscms/lang_en.inc.php
Added: trunk/web/reactos.org/htdocs/serendipity/templates/roscms/lang_ko.inc.php
Added: trunk/web/reactos.org/htdocs/serendipity/templates/roscms/preview.png
Added: trunk/web/reactos.org/htdocs/serendipity/templates/roscms/sidebar.tpl
Added: trunk/web/reactos.org/htdocs/serendipity/templates/roscms/style.css
Added: trunk/web/reactos.org/htdocs/serendipity/templates/roscms/style.css.orig
Added: trunk/web/reactos.org/htdocs/serendipity/templates/roscms/trackbacks.tpl

Modified: trunk/web/reactos.org/htdocs/roscms/inc/admin_subsys_check.php
--- trunk/web/reactos.org/htdocs/roscms/inc/admin_subsys_check.php	2006-01-22 23:07:46 UTC (rev 20990)
+++ trunk/web/reactos.org/htdocs/roscms/inc/admin_subsys_check.php	2006-01-22 23:16:30 UTC (rev 20991)
@@ -35,15 +35,19 @@
 require_once("subsys_bugzilla.php");
 require_once("subsys_phpbb.php");
 require_once("subsys_wiki.php");
+require_once("subsys_blogs.php");
 
 ?>
 
 <div class="contentSmall"> <span class="contentSmallTitle">Admin Interface - Check Subsystem Consistency</span> 
 <?php
 $inconsistency_count = 0;
+/*
 $inconsistency_count += subsys_bugzilla_check();
 $inconsistency_count += subsys_phpbb_check();
 $inconsistency_count += subsys_wiki_check();
+*/
+$inconsistency_count += subsys_blogs_check();
 ?>
 <h2>Total</h2>
 <?php

Modified: trunk/web/reactos.org/htdocs/roscms/inc/admin_subsys_fix.php
--- trunk/web/reactos.org/htdocs/roscms/inc/admin_subsys_fix.php	2006-01-22 23:07:46 UTC (rev 20990)
+++ trunk/web/reactos.org/htdocs/roscms/inc/admin_subsys_fix.php	2006-01-22 23:16:30 UTC (rev 20991)
@@ -1,23 +1,5 @@
 <?php
-    /*
-    RosCMS - ReactOS Content Management System
-    Copyright (C) 2005  Ge van Geldorp <gvg@reactos.org>
 
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-    */
-
 // To prevent hacking activity:
 if ( !defined('ROSCMS_SYSTEM') OR !defined('ROSCMS_SYSTEM_ADMIN') )
 {
@@ -35,6 +17,7 @@
 require_once("subsys_bugzilla.php");
 require_once("subsys_phpbb.php");
 require_once("subsys_wiki.php");
+require_once("subsys_blogs.php");
 
 ?>
 
@@ -61,6 +44,10 @@
   {
     $fix_count += subsys_wiki_fix_all();
   }
+if ($subsys == 'blogs' || $subsys == 'all')
+  {
+    $fix_count += subsys_blogs_fix_all();
+  }
 ?>
 <h2>Total</h2>
 <?php

Added: trunk/web/reactos.org/htdocs/roscms/inc/subsys_blogs.php
--- trunk/web/reactos.org/htdocs/roscms/inc/subsys_blogs.php	2006-01-22 23:07:46 UTC (rev 20990)
+++ trunk/web/reactos.org/htdocs/roscms/inc/subsys_blogs.php	2006-01-22 23:16:30 UTC (rev 20991)
@@ -0,0 +1,402 @@
+<?php
+
+// To prevent hacking activity:
+if ( !defined('ROSCMS_SYSTEM'))
+{
+  if ( !defined('ROSCMS_SYSTEM_LOG') ) {
+    define ("ROSCMS_SYSTEM_LOG", "Hacking attempt");
+  }
+  $seclog_section="subsys_blogs";
+  $seclog_level="50";
+  $seclog_reason="Hacking attempt: subsys_blogs.php";
+  define ("ROSCMS_SYSTEM", "Hacking attempt");
+  include('securitylog.php'); // open security log
+  die("Hacking attempt");
+}
+
+require_once("subsys_utils.php");
+
+define('SUBSYS_BLOGS_DBNAME', "blogs");
+
+function subsys_blogs_info_check()
+{
+  $inconsistency_count = 0;
+  $query = "SELECT u.user_id, u.user_name, u.user_fullname, u.user_email, " .
+           "       b.username, b.realname, b.email " .
+           "  FROM users u, " .
+           "       subsys_mappings m, " .
+                   SUBSYS_BLOGS_DBNAME . ".ser_authors b " .
+           " WHERE m.map_roscms_userid = u.user_id " .
+           "   AND m.map_subsys_name = 'blogs' " .
+           "   AND b.authorid = m.map_subsys_userid " .
+           "   AND (u.user_name != b.username OR " .
+           "        u.user_fullname != b.realname OR " .
+           "        u.user_email != b.email) ";
+  $query_set = mysql_query($query) or die("DB error (subsys_blogs #1)");
+  while ($result_row = mysql_fetch_array($query_set))
+    {
+    echo "Info mismatch for RosCMS userid " . $result_row['user_id'] . ": ";
+    if ($result_row['user_name'] <> $result_row['username'])
+    {
+      echo "user_login " . $result_row['user_name'] . "/" .
+           $result_row['username'] . " ";
+    }
+    if ($result_row['user_email'] <> $result_row['email'])
+    {
+      echo "user_email " . $result_row['user_email'] . "/" .
+           $result_row['email'];
+    }
+    if ($result_row['user_fullname'] <> $result_row['realname'])
+    {
+      echo "user_fullname " . $result_row['user_fullname'] . "/" .
+           $result_row['realname'];
+    }
+    echo "<br>\n";
+    $inconsistency_count++;
+    }
+
+  return $inconsistency_count;
+}
+
+function subsys_blogs_mapping_check()
+{
+  $inconsistency_count = 0;
+  $query = "SELECT u.user_id " .
+           "  FROM users u, " .
+           "       usergroup_members ug " .
+           " WHERE ug.usergroupmember_usergroupid = 'developer' " .
+           "   AND ug.usergroupmember_userid = u.user_id " .
+           "   AND u.user_id NOT IN " .
+           "       (SELECT m.map_roscms_userid " .
+           "          FROM subsys_mappings m " .
+           "         WHERE m.map_roscms_userid = u.user_id " .
+           "           AND m.map_subsys_name = 'blogs') ";
+  $query_set = mysql_query($query) or die("DB error (subsys_blogs #4)");
+  while ($result_row = mysql_fetch_array($query_set))
+    {
+    echo "No mapping of RosCMS userid " . $result_row['user_id'] .
+         "<br>\n";
+    $inconsistency_count++;
+    }
+
+  return $inconsistency_count;
+}
+
+
+function subsys_blogs_check()
+{
+?>
+<h2>Blogs</h2>
+<?php
+  $inconsistency_count = 0;
+  $inconsistency_count += subsys_blogs_mapping_check();
+  $inconsistency_count += subsys_userids_exist('blogs',
+                                               SUBSYS_BLOGS_DBNAME .
+                                               '.ser_authors',
+                                               'authorid');
+  $inconsistency_count += subsys_blogs_info_check();
+
+  $fix_url = htmlentities('?page=admin&sec=subsys&sec2=fix&subsys=blogs');
+  if (0 == $inconsistency_count)
+    {
+      echo "No problems found.<br/>\n";
+    }
+  else if (1 == $inconsistency_count)
+    {
+      echo '<br />1 problem found. <a href="' . $fix_url .
+           '">Fix this</a><br/>' . "\n";
+    }
+  else
+    {
+      echo "<br />$inconsistency_count problems found." .
+           ' <a href="' . $fix_url . '">Fix these</a><br/>' . "\n";
+    }
+
+  return $inconsistency_count;
+}
+
+function subsys_blogs_update_blogs($roscms_user_id,
+                                   $roscms_user_name,
+                                   $roscms_user_fullname,
+                                   $roscms_user_email,
+                                   $blogs_user_id)
+{
+  /* Make sure that the email address and/or user name are not already in
+     use in blogs */
+  $query = "SELECT COUNT(*) AS inuse " .
+           "  FROM " . SUBSYS_BLOGS_DBNAME .  ".ser_authors " .
+           " WHERE (LOWER(username) = LOWER('" .
+           mysql_real_escape_string($roscms_user_name) . "') OR " .
+           "        LOWER(email) = LOWER('" .
+           mysql_real_escape_string($roscms_user_email) . "')) " .
+           "   AND authorid <> $blogs_user_id ";
+  $blogs_check_set = mysql_query($query)
+                  or die("DB error (subsys_blogs #7)");
+  $blogs_check_row = mysql_fetch_array($blogs_check_set);
+  if (0 != $blogs_check_row['inuse'])
+    {
+      echo "User name ($roscms_user_name) and/or email address " .
+           "($roscms_user_email) collision<br>\n";
+      return FALSE;
+    }
+
+  /* Now, make sure that info in blogs matches info in roscms */
+  $query = "UPDATE " . SUBSYS_BLOGS_DBNAME .  ".ser_authors " .
+           "   SET realname = '" .
+                   mysql_real_escape_string($roscms_user_fullname) . "', " .
+           "       username = '" .
+                   mysql_real_escape_string($roscms_user_name) . "', " .
+           "       email = '" .
+                   mysql_real_escape_string($roscms_user_email) . "' " .
+           " WHERE authorid = $blogs_user_id";
+  mysql_query($query) or die("DB error (subsys_blogs #8)");
+
+  return TRUE;
+}
+
+function subsys_blogs_add_blogs_user($roscms_user_id,
+                                     $roscms_user_name,
+                                     $roscms_user_fullname,
+                                     $roscms_user_email)
+{
+  $query = "INSERT INTO " . SUBSYS_BLOGS_DBNAME . ".ser_authors " .
+           "       (realname, username, email) " .
+           "VALUES (" .
+           "        '" . mysql_real_escape_string($roscms_user_fullname) .  "', " .
+           "        '" . mysql_real_escape_string($roscms_user_name) . "', " .
+           "        '" . mysql_real_escape_string($roscms_user_email) . "') ";
+  mysql_query($query) or die("DB error (subsys_phpbb #17)");
+
+  /* Add user to Developers group */
+  $query = "INSERT INTO " . SUBSYS_BLOGS_DBNAME . ".ser_authorgroups " .
+           "       (groupid, authorid) " .
+           "SELECT id, LAST_INSERT_ID() " .
+           "  FROM " . SUBSYS_BLOGS_DBNAME . ".ser_groups " .
+           " WHERE LOWER(name) = 'developer' ";
+  mysql_query($query) or die("DB error (subsys_phpbb #18)");
+
+  /* Finally, insert a row in the mapping table */
+  $query = "INSERT INTO subsys_mappings " .
+           "       (map_roscms_userid, map_subsys_name, map_subsys_userid) " .
+           "       VALUES($roscms_user_id, 'blogs', LAST_INSERT_ID())";
+  mysql_query($query) or die("DB error (subsys_phpbb #11)");
+
+  return TRUE;
+}
+
+function subsys_blogs_add_mapping($roscms_user_id)
+{
+  if (! subsys_get_roscms_info($roscms_user_id,
+                               $roscms_user_name,
+                               $roscms_user_email,
+                               $roscms_user_fullname,
+                               $roscms_user_password,
+                               $roscms_user_register))
+    {
+      return FALSE;
+    }
+
+  /* First, try to match on email address */
+  $query = "SELECT authorid " .
+           "  FROM " . SUBSYS_BLOGS_DBNAME .  ".ser_authors " .
+           " WHERE LOWER(email) = LOWER('" .
+           mysql_real_escape_string($roscms_user_email) . "')";
+  $blogs_email_set = mysql_query($query)
+                     or die("DB error (subsys_blogs #5)");
+  if ($blogs_email_row = mysql_fetch_array($blogs_email_set))
+    {
+      $blogs_user_id = $blogs_email_row['authorid'];
+    }
+  else
+    {
+      /* That failed. Let's try to match on user name then */
+      $query = "SELECT authorid " .
+               "  FROM " . SUBSYS_BLOGS_DBNAME .  ".ser_authors " .
+               " WHERE LOWER(username) = LOWER('" .
+               mysql_real_escape_string($roscms_user_name) . "')";
+      $blogs_name_set = mysql_query($query)
+                     or die("DB error (subsys_blogs #6)");
+      if ($blogs_name_row = mysql_fetch_array($blogs_name_set))
+        {
+          $blogs_user_id = $blogs_name_row['authorid'];
+        }
+    }
+
+  if (! isset($blogs_user_id))
+    {
+      /* We haven't found a match, so we need to add a new blogs user */
+      $fixed = subsys_blogs_add_blogs_user($roscms_user_id,
+                                           $roscms_user_name,
+                                           $roscms_user_fullname,
+                                           $roscms_user_email);
+    }
+  else
+    {
+      /* Synchronize the info in blogs */
+      if (! subsys_blogs_update_blogs($roscms_user_id,
+                                      $roscms_user_name,
+                                      $roscms_user_fullname,
+                                      $roscms_user_email,
+                                      $blogs_user_id))
+        {
+          return FALSE;
+        }
+
+      /* Insert a row in the mapping table */
+      $query = "INSERT INTO subsys_mappings " .
+               "       (map_roscms_userid, map_subsys_name, map_subsys_userid) " .
+               "       VALUES($roscms_user_id, 'blogs', $blogs_user_id)";
+      mysql_query($query) or die("DB error (subsys_blogs #9)");
+
+      $fixed = TRUE;
+    }
+
+  return $fixed;
+}
+
+function subsys_blogs_update_existing($roscms_user_id, $blogs_user_id)
+{
+  if (! subsys_get_roscms_info($roscms_user_id,
+                               $roscms_user_name,
+                               $roscms_user_email,
+                               $roscms_user_fullname,
+                               $roscms_user_password,
+                               $roscms_user_register))
+    {
+      return FALSE;
+    }
+
+  if (! subsys_blogs_update_blogs($roscms_user_id,
+                                  $roscms_user_name,
+                                  $roscms_user_fullname,
+                                  $roscms_user_email,
+                                  $blogs_user_id))
+    {
+      return FALSE;
+    }
+
+  return TRUE;
+}
+
+function subsys_blogs_update_user($roscms_user_id)
+{
+  $query = "SELECT map_subsys_userid " .
+           "  FROM subsys_mappings " .
+           " WHERE map_roscms_userid = $roscms_user_id " .
+           "   AND map_subsys_name = 'blogs'";
+  $query_set = mysql_query($query) or die("DB error (subsys_blogs #2)");
+  if ($result_row = mysql_fetch_array($query_set))
+    {
+      $fixed = subsys_blogs_update_existing($roscms_user_id,
+                                            $result_row['map_subsys_userid']);
+    }
+  else
+    {
+      $query = "SELECT COUNT(*) AS count " .
+               "  FROM usergroup_members ug " .
+               " WHERE ug.usergroupmember_usergroupid = 'developer' " .
+               "   AND ug.usergroupmember_userid = $roscms_user_id ";
+      $query_set = mysql_query($query) or die("DB error (subsys_blogs #14)");
+      if (($result_row = mysql_fetch_array($query_set)) &&
+          0 != $result_row['count'])
+        {
+          $fixed = subsys_blogs_add_mapping($roscms_user_id);
+        }
+      else
+        {
+          $fixed = 0;
+        }
+    }
+
+  return $fixed;
+}
+
+function subsys_blogs_fix_mappings()
+{
+  $fix_count = 0;
+  $query = "SELECT u.user_id " .
+           "  FROM users u, " .
+           "       usergroup_members ug " .
+           " WHERE ug.usergroupmember_usergroupid = 'developer' " .
+           "   AND ug.usergroupmember_userid = u.user_id " .
+           "   AND u.user_id NOT IN " .
+           "       (SELECT m.map_roscms_userid " .
+           "          FROM subsys_mappings m " .
+           "         WHERE m.map_roscms_userid = u.user_id " .
+           "           AND m.map_subsys_name = 'blogs') ";
+  $query_set = mysql_query($query) or die("DB error (subsys_blogs #3)");
+  while ($result_row = mysql_fetch_array($query_set))
+    {
+      if (subsys_blogs_update_user($result_row['user_id']))
+        {
+          echo "Fixed mapping of RosCMS userid " . $result_row['user_id'] .
+               "<br>\n";
+          $fix_count++;
+        }
+      else
+        {
+          echo "Unable to fix mapping of RosCMS userid " .
+               $result_row['user_id'] .  "<br>\n";
+        }
+    }
+
+  return $fix_count;
+}
+
+function subsys_blogs_fix_info()
+{
+  $fix_count = 0;
+  $query = "SELECT u.user_id " .
+           "  FROM users u, " .
+           "       subsys_mappings m, " .
+                   SUBSYS_BLOGS_DBNAME . ".ser_authors b " .
+           " WHERE m.map_roscms_userid = u.user_id " .
+           "   AND m.map_subsys_name = 'blogs' " .
+           "   AND b.authorid = m.map_subsys_userid " .
+           "   AND (u.user_name != b.username OR " .
+           "        u.user_fullname != b.realname OR " .
+           "        u.user_email != b.email) ";
+  $query_set = mysql_query($query) or die("DB error (subsys_blogs #12)".$query);
+  while ($result_row = mysql_fetch_array($query_set))
+    {
+      if (subsys_blogs_update_user($result_row['user_id']))
+        {
+          echo "Fixed info for RosCMS userid " . $result_row['user_id'] .
+               "<br>\n";
+          $fix_count++;
+        }
+      else
+        {
+          echo "Unable to fix info for RosCMS userid " .
+               $result_row['user_id'] .  "<br>\n";
+        }
+    }
+
+  return $fix_count;
+}
+
+function subsys_blogs_fix_all()
+{
+?>
+<h2>Blogs</h2>
+<?php
+  $fix_count = 0;
+  $fix_count += subsys_blogs_fix_mappings();
+  $fix_count += subsys_blogs_fix_info();
+  if (0 == $fix_count)
+    {
+      echo "No problems fixed.<br/>\n";
+    }
+  else if (1 == $fix_count)
+    {
+      echo "<br>1 problem fixed.<br/>\n";
+    }
+  else
+    {
+      echo "<br>$fix_count problems fixed.<br/>\n";
+    }
+
+  return $fix_count;
+}
+
+?>

Modified: trunk/web/reactos.org/htdocs/roscms/inc/subsys_login.php
--- trunk/web/reactos.org/htdocs/roscms/inc/subsys_login.php	2006-01-22 23:07:46 UTC (rev 20990)
+++ trunk/web/reactos.org/htdocs/roscms/inc/subsys_login.php	2006-01-22 23:16:30 UTC (rev 20991)
@@ -76,23 +76,23 @@
       if ($subsys == "roscms" || $subsys == "")
         {
           $query = "SELECT u.user_id, s.usersession_expires " .
-                   "  FROM user_sessions s, " .
-                   "       users u " .
+                   "  FROM roscms.user_sessions s, " .
+                   "       roscms.users u " .
                    $bulk_of_where;
         }
       else
         {
           $query = "SELECT m.map_subsys_userid, s.usersession_expires " .
-                   "  FROM user_sessions s, " .
-                   "       users u, " .
-                   "       subsys_mappings m " .
+                   "  FROM roscms.user_sessions s, " .
+                   "       roscms.users u, " .
+                   "       roscms.subsys_mappings m " .
                    $bulk_of_where .
                    "   AND m.map_roscms_userid = s.usersession_user_id " .
                    "   AND m.map_subsys_name = '" .
                            mysql_escape_string($subsys) . "'";
         }
       $statement = mysql_query($query, $connect)
-                   or die('DB error (user login)');
+                   or die('DB error (user login) ' . $query);
 
       if ($row = mysql_fetch_array($statement))
         {
@@ -103,7 +103,7 @@
           {
             /* Session with timeout. Update the expiry time in the table and 
                the expiry time of the cookie */
-            $query = "UPDATE user_sessions " .
+            $query = "UPDATE roscms.user_sessions " .
                      "   SET usersession_expires = DATE_ADD(NOW(), INTERVAL 30 MINUTE) " .
                      " WHERE usersession_id = '" .
                              mysql_escape_string($session_id_clean) . "'";

Copied: trunk/web/reactos.org/htdocs/serendipity (from rev 20990, vendor/serendipity/current)

Added: trunk/web/reactos.org/htdocs/serendipity/.htaccess
--- vendor/serendipity/current/.htaccess	2006-01-22 23:07:46 UTC (rev 20990)
+++ trunk/web/reactos.org/htdocs/serendipity/.htaccess	2006-01-22 23:16:30 UTC (rev 20991)
@@ -0,0 +1,26 @@
+# BEGIN s9y
+DirectoryIndex /serendipity/index.php
+php_value session.use_trans_sid 0
+php_value register_globals off
+
+<Files *.tpl.php>
+    deny from all
+</Files>
+
+<Files *.tpl>
+    deny from all
+</Files>
+
+<Files *.sql>
+    deny from all
+</Files>
+
+<Files *.inc.php>
+    deny from all
+</Files>
+
+<Files *.db>
+    deny from all
+</Files>
+
+# END s9y

Modified: trunk/web/reactos.org/htdocs/serendipity/include/functions_comments.inc.php
--- vendor/serendipity/current/include/functions_comments.inc.php	2006-01-22 23:07:46 UTC (rev 20990)
+++ trunk/web/reactos.org/htdocs/serendipity/include/functions_comments.inc.php	2006-01-22 23:16:30 UTC (rev 20991)
@@ -309,9 +309,28 @@
     return true;
 }
 
+require_once(ROSCMS_INC_PATH . "/subsys_login.php");
+@define('ROSCMSLOGIN_NOT_LOGGEDIN', 'You need to be logged in to leave a comment');
+
+
 function serendipity_saveComment($id, $commentInfo, $type = 'NORMAL', $source = 'internal') {
     global $serendipity;
 
+    $roscmsid = roscms_subsys_login('roscms', ROSCMS_LOGIN_OPTIONAL, '');
+    if (0 == $roscmsid) {
+        $eventData = array('allow_comments' => false);
+        $serendipity['messagestack']['comments'][] = ROSCMSLOGIN_NOT_LOGGEDIN;
+        return false;
+    }
+    $query = "SELECT user_fullname, user_email " .
+             "  FROM roscms.users " .
+             " WHERE user_id = " . (int) $roscmsid;
+    $userinfo = serendipity_db_query($query, true);
+    if (is_array($userinfo)) {
+        $commentInfo['name'] = $userinfo['user_fullname'];
+        $commentInfo['email'] = $userinfo['user_email'];
+    }
+
     $query = "SELECT id, allow_comments, moderate_comments, last_modified, timestamp, title FROM {$serendipity['dbPrefix']}entries WHERE id = '". (int)$id ."'";
     $ca    = serendipity_db_query($query, true);
 

Modified: trunk/web/reactos.org/htdocs/serendipity/include/functions_config.inc.php
--- vendor/serendipity/current/include/functions_config.inc.php	2006-01-22 23:07:46 UTC (rev 20990)
+++ trunk/web/reactos.org/htdocs/serendipity/include/functions_config.inc.php	2006-01-22 23:16:30 UTC (rev 20991)
@@ -273,49 +273,44 @@
     unset($serendipity['COOKIE'][$name]);
 }
 
+require_once(ROSCMS_INC_PATH . "/subsys_login.php");
+
 function serendipity_authenticate_author($username = '', $password = '', $is_md5 = false, $use_external = true) {
     global $serendipity;
 
-    if (isset($_SESSION['serendipityUser']) && isset($_SESSION['serendipityPassword']) && isset($_SESSION['serendipityAuthedUser']) && $_SESSION['serendipityAuthedUser'] == true) {
-        $username = $_SESSION['serendipityUser'];
-        $password = $_SESSION['serendipityPassword'];
-        // For safety reasons when multiple blogs are installed on the same host, we need to check the current author each time to not let him log into a different blog with the same sessiondata
-        $is_md5 = true;
+    $authorid = roscms_subsys_login('blogs',
+                                    $use_external ? ROSCMS_LOGIN_REQUIRED :
+                                                    ROSCMS_LOGIN_OPTIONAL,
+                                    $serendipity['serendipityHTTPPath'] .
+                                    ($serendipity['rewrite'] == 'none' ?
+                                     $serendipity['indexFile'] .'?/' : '') .
+                                    PATH_ADMIN);
+    if (0 == $authorid) {
+        $_SESSION['serendipityAuthedUser'] = false;
+        return false;
     }
+    $query = "SELECT DISTINCT
+                email, authorid, userlevel, right_publish
+              FROM
+                {$serendipity['dbPrefix']}authors
+              WHERE
+                authorid = $authorid";
+    $row = serendipity_db_query($query, true, 'assoc');
 
-    if ($username != '') {
-        if ($use_external) {
-            serendipity_plugin_api::hook_event('backend_auth', $is_md5, array('username' => $username, 'password' => $password));
-        }
-
-        if ($is_md5 === false && !empty($password)) {
-            $password = md5($password);
-        }
-
-        $query = "SELECT DISTINCT
-                    email, authorid, userlevel, right_publish
-                  FROM
-                    {$serendipity['dbPrefix']}authors
-                  WHERE
-                    username   = '" . serendipity_db_escape_string($username) . "'
-                  AND password = '" . serendipity_db_escape_string($password) . "'";
-        $row = serendipity_db_query($query, true, 'assoc');
-
-        if (is_array($row)) {
-            serendipity_setCookie('old_session', session_id());
-            $_SESSION['serendipityUser']        = $serendipity['serendipityUser']         = $username;
-            $_SESSION['serendipityPassword']    = $serendipity['serendipityPassword']     = $password;
-            $_SESSION['serendipityEmail']       = $serendipity['serendipityEmail']        = $row['email'];
-            $_SESSION['serendipityAuthorid']    = $serendipity['authorid']                = $row['authorid'];
-            $_SESSION['serendipityUserlevel']   = $serendipity['serendipityUserlevel']    = $row['userlevel'];
-            $_SESSION['serendipityAuthedUser']  = $serendipity['serendipityAuthedUser']   = true;
-            $_SESSION['serendipityRightPublish']= $serendipity['serendipityRightPublish'] = $row['right_publish'];
-            serendipity_load_configuration($serendipity['authorid']);
-            return true;
-        } else {
-            $_SESSION['serendipityAuthedUser'] = false;
-            @session_destroy();
-        }
+    if (is_array($row)) {
+        serendipity_setCookie('old_session', session_id());
+        $_SESSION['serendipityUser']        = $serendipity['serendipityUser']         = $row['username'];
+        $_SESSION['serendipityPassword']    = $serendipity['serendipityPassword']     = '';
+        $_SESSION['serendipityEmail']       = $serendipity['serendipityEmail']        = $row['email'];
+        $_SESSION['serendipityAuthorid']    = $serendipity['authorid']                = $row['authorid'];
+        $_SESSION['serendipityUserlevel']   = $serendipity['serendipityUserlevel']    = $row['userlevel'];
+        $_SESSION['serendipityAuthedUser']  = $serendipity['serendipityAuthedUser']   = true;
+        $_SESSION['serendipityRightPublish']= $serendipity['serendipityRightPublish'] = $row['right_publish'];
+        serendipity_load_configuration($serendipity['authorid']);
+        return true;
+    } else {
+        $_SESSION['serendipityAuthedUser'] = false;
+        @session_destroy();
     }
 
     return false;

Added: trunk/web/reactos.org/htdocs/serendipity/plugins/serendipity_plugin_activeauthors/lang_de.inc.php
--- vendor/serendipity/current/plugins/serendipity_plugin_activeauthors/lang_de.inc.php	2006-01-22 23:07:46 UTC (rev 20990)
+++ trunk/web/reactos.org/htdocs/serendipity/plugins/serendipity_plugin_activeauthors/lang_de.inc.php	2006-01-22 23:16:30 UTC (rev 20991)
@@ -0,0 +1,4 @@
+<?php # $Id: lang_de.inc.php,v 1.1 2005/08/01 15:45:48 garvinhicking Exp $
+ 
+        @define('PLUGIN_AUTHORS_NAME', 'Liste der Autoren');
+        @define('PLUGIN_AUTHORS_DESC', 'Zeigt Eintrõge nach Autor.');

Added: trunk/web/reactos.org/htdocs/serendipity/plugins/serendipity_plugin_activeauthors/lang_pt.inc.php
--- vendor/serendipity/current/plugins/serendipity_plugin_activeauthors/lang_pt.inc.php	2006-01-22 23:07:46 UTC (rev 20990)
+++ trunk/web/reactos.org/htdocs/serendipity/plugins/serendipity_plugin_activeauthors/lang_pt.inc.php	2006-01-22 23:16:30 UTC (rev 20991)
@@ -0,0 +1,4 @@
+<?php
+
+        @define('PLUGIN_AUTHORS_NAME', 'Autores');
+        @define('PLUGIN_AUTHORS_DESC', 'Mostra entradas por autor.');

Added: trunk/web/reactos.org/htdocs/serendipity/plugins/serendipity_plugin_activeauthors/serendipity_plugin_activeauthors.php
--- vendor/serendipity/current/plugins/serendipity_plugin_activeauthors/serendipity_plugin_activeauthors.php	2006-01-22 23:07:46 UTC (rev 20990)
+++ trunk/web/reactos.org/htdocs/serendipity/plugins/serendipity_plugin_activeauthors/serendipity_plugin_activeauthors.php	2006-01-22 23:16:30 UTC (rev 20991)
@@ -0,0 +1,89 @@
+<?php # Based on serendipity_plugin_authors.php
+ 
+// Probe for a language include with constants. Still include defines later on, if some constants were missing
+$probelang = dirname(__FILE__) . '/' . $serendipity['charset'] . 'lang_' . $serendipity['lang'] . '.inc.php';
+if (file_exists($probelang)) {
+    include $probelang;
+}
+
+@define('PLUGIN_ACTIVEAUTHORS_NAME', 'Active Authors');
+@define('PLUGIN_ACTIVEAUTHORS_DESC', 'Displays active authors.');
+@define('PLUGIN_ACTIVEAUTHORS_TITLE', 'Authors');
+@define('PLUGIN_ACTIVEAUTHORS_ALL', 'All');
+
+class serendipity_plugin_activeauthors extends serendipity_plugin 
+{
+    var $title = PLUGIN_ACTIVEAUTHORS_TITLE;
+
+    function introspect(&$propbag) 
+    {
+        $propbag->add('name',          PLUGIN_ACTIVEAUTHORS_NAME);
+        $propbag->add('description',   PLUGIN_ACTIVEAUTHORS_DESC);
+        $propbag->add('stackable',     true);
+        $propbag->add('author',        'Ge van Geldorp/Victor Fusco');
+        $propbag->add('version',       '1.0');
+        $propbag->add('requirements',  array(
+            'serendipity' => '0.8',
+            'smarty'      => '2.6.7',
+            'php'         => '4.1.0'
+        ));
+        $propbag->add('groups', array('FRONTEND_VIEWS'));
+        $propbag->add('configuration', array('title'));
+    }
+
+    function introspect_config_item($name, &$propbag)
+    {
+        switch($name) {
+            case 'title':
+                $propbag->add('type',          'string');
+                $propbag->add('name',          TITLE);
+                $propbag->add('description',   TITLE);
+                $propbag->add('default', PLUGIN_ACTIVEAUTHORS_TITLE);
+                break;
+        }
+        return true;
+    }
+
+    function generate_content(&$title) {
+        global $serendipity;
+
+    	$title = $this->get_config('title', $this->title);
+
+        $alllink = $serendipity['serendipityHTTPPath'];
+        echo '<a href="' . $alllink . '">' . PLUGIN_ACTIVEAUTHORS_ALL . "</a><br />\n";
+
+
+        $authors_query = "SELECT DISTINCT a.realname, a.username, a.authorid " .
+                         "  FROM {$serendipity['dbPrefix']}authors a, " .
+                         "       {$serendipity['dbPrefix']}entries e " .
+                         " WHERE e.authorid = a.authorid " .
+                         "   AND e.isdraft = 'false' " .
+                         " ORDER BY a.realname ";
+        $row_authors = serendipity_db_query($authors_query);
+
+        if (isset($row_authors) && is_array($row_authors)) {
+            foreach ($row_authors as $entry) {
+                if (function_exists('serendipity_authorURL')) {
+                    $entryLink = serendipity_authorURL($entry);
+                } else {
+                	$entryLink = serendipity_rewriteURL(
+                                   PATH_AUTHORS . '/' . 
+                                   serendipity_makePermalink(
+                                     PERM_AUTHORS, 
+                                     array(
+                                       'id'    => $entry['authorid'], 
+                                       'title' => $entry['realname']
+                                     )
+                                   )
+                                 );
+                }        
+
+                echo '<a href="' . $entryLink . '">' . $entry['realname'] .
+                     "</a><br />\n";
+            }
+        }
+    }
+}
+
+/* vim: set sts=4 ts=4 expandtab : */
+?>

Added: trunk/web/reactos.org/htdocs/serendipity/plugins/serendipity_plugin_roscmsaccount/serendipity_plugin_roscmsaccount.php
--- vendor/serendipity/current/plugins/serendipity_plugin_roscmsaccount/serendipity_plugin_roscmsaccount.php	2006-01-22 23:07:46 UTC (rev 20990)
+++ trunk/web/reactos.org/htdocs/serendipity/plugins/serendipity_plugin_roscmsaccount/serendipity_plugin_roscmsaccount.php	2006-01-22 23:16:30 UTC (rev 20991)
@@ -0,0 +1,73 @@
+<?php
+ 
+// Probe for a language include with constants. Still include defines later on, if some constants were missing
+$probelang = dirname(__FILE__) . '/' . $serendipity['charset'] . 'lang_' . $serendipity['lang'] . '.inc.php';
+if (file_exists($probelang)) {
+    include $probelang;
+}
+
+@define('PLUGIN_ROSCMSACCOUNT_TITLE', 'Account');
+@define('PLUGIN_ROSCMSACCOUNT_NAME', 'Roscms-account');
+@define('PLUGIN_ROSCMSACCOUNT_DESC', 'Roscms global login system account management');
+@define('PLUGIN_ROSCMSACCOUNT_LOGIN', 'Login');
+@define('PLUGIN_ROSCMSACCOUNT_LOGOUT', 'Logout');
+@define('PLUGIN_ROSCMSACCOUNT_REGISTER', 'Register');
+@define('PLUGIN_ROSCMSACCOUNT_MANAGE', 'Manage blog entries');
+
+require_once(ROSCMS_INC_PATH . "/subsys_login.php");
+
+class serendipity_plugin_roscmsaccount extends serendipity_plugin 
+{
+    function introspect(&$propbag) 
+    {
+        $propbag->add('name',          PLUGIN_ROSCMSACCOUNT_NAME);
+        $propbag->add('description',   PLUGIN_ROSCMSACCOUNT_DESC);
+        $propbag->add('stackable',     true);
+        $propbag->add('author',        'Ge van Geldorp');
+        $propbag->add('version',       '1.0');
+        $propbag->add('groups', array('FRONTEND_FEATURES'));
+    }
+
+    function generate_content(&$title)
+    {
+        global $serendipity;
+
+        $title = PLUGIN_ROSCMSACCOUNT_TITLE;
+        $roscmsid = roscms_subsys_login('roscms', ROSCMS_LOGIN_OPTIONAL, '');
+        if (0 == $roscmsid) {
+            echo '<a href="/roscms/?page=login&target=' .
+                 $serendipity['serendipityHTTPPath'] . '">' .
+                 PLUGIN_ROSCMSACCOUNT_LOGIN . "</a><br />\n";
+        } else {
+            echo '<a href="/roscms/?page=logout&target=' .
+                 $serendipity['serendipityHTTPPath'] . '">' .
+                 PLUGIN_ROSCMSACCOUNT_LOGOUT;
+            $who_query = "SELECT user_name " .
+                         "  FROM roscms.users " .
+                         " WHERE user_id = $roscmsid ";
+            $row_who = serendipity_db_query($who_query, true);
+
+            if (is_array($row_who)) {
+                echo ' [' . $row_who['user_name'] . ']';
+            }
+            echo "</a><br />\n";
+        }
+        echo '<a href="/roscms/?page=register&target=' .
+             $serendipity['serendipityHTTPPath'] . '">' .
+             PLUGIN_ROSCMSACCOUNT_REGISTER . "</a><br />\n";
+        $authorid = roscms_subsys_login('blogs', ROSCMS_LOGIN_OPTIONAL, '');
+        if (0 != $authorid) {
+            $base = $serendipity['serendipityHTTPPath'];
+
+            $link = $serendipity['serendipityHTTPPath'] .
+                    ($serendipity['rewrite'] == 'none' ?
+                     $serendipity['indexFile'] .'?/' : '') . PATH_ADMIN;
+            $text = PLUGIN_ROSCMSACCOUNT_MANAGE;
+            echo '<a href="' . $link . '" title="'. $text .'">'. $text .
+                 "</a><br />\n";
+        }
+    }
+}
+
+/* vim: set sts=4 ts=4 expandtab : */
+?>

Added: trunk/web/reactos.org/htdocs/serendipity/serendipity_config_local.inc.php
--- vendor/serendipity/current/serendipity_config_local.inc.php	2006-01-22 23:07:46 UTC (rev 20990)
+++ trunk/web/reactos.org/htdocs/serendipity/serendipity_config_local.inc.php	2006-01-22 23:16:30 UTC (rev 20991)
@@ -0,0 +1,17 @@
+<?php
+	/*
+	  Serendipity configuration file
+	  Written on Tue, 17 Jan 2006 22:13:03 +0100
+	*/
+
+	$serendipity['versionInstalled']  = '0.9.1';
+	$serendipity['dbPrefix']          = 'ser_';
+	$serendipity['dbType']            = 'mysql';
+	$serendipity['dbPersistent']      = true;
+
+	// End of Serendipity configuration file
+	// You can place your own special variables after here:
+
+	require_once("blogs-connect.php");
+	@define('ROSCMS_INC_PATH', '/web/reactos.org/htdocs/roscms/inc');
+?>

Added: trunk/web/reactos.org/htdocs/serendipity/templates/roscms/commentform.tpl
--- vendor/serendipity/current/templates/roscms/commentform.tpl	2006-01-22 23:07:46 UTC (rev 20990)
+++ trunk/web/reactos.org/htdocs/serendipity/templates/roscms/commentform.tpl	2006-01-22 23:16:30 UTC (rev 20991)
@@ -0,0 +1,43 @@
+<div class="serendipityCommentForm">
+    <a id="serendipity_CommentForm"></a>
+    <form id="serendipity_comment" action="{$commentform_action}#feedback" method="post">
+    <div><input type="hidden" name="serendipity[entry_id]" value="{$commentform_id}" /></div>
+    <table border="0" width="100%" cellpadding="3">
+        <tr>
+            <td class="serendipity_commentsLabel"><label for="serendipity_replyTo">{$CONST.IN_REPLY_TO}</label></td>
+            <td class="serendipity_commentsValue">{$commentform_replyTo}</td>
+        </tr>
+
+        <tr>
+            <td class="serendipity_commentsLabel"><label for="serendipity_commentform_comment">{$CONST.COMMENT}</label></td>
+            <td class="serendipity_commentsValue">
+                <textarea rows="10" cols="40" id="serendipity_commentform_comment" name="serendipity[comment]">{$commentform_data}</textarea><br />
+                {serendipity_hookPlugin hook="frontend_comment" data=$commentform_entry}
+            </td>
+        </tr>
+
+{if $is_commentform_showToolbar}
+        <tr>
+            <td>&#160;</td>
+            <td class="serendipity_commentsLabel">
+    {if $is_allowSubscriptions}
+                <br />
+                <input id="checkbox_subscribe" type="checkbox" name="serendipity[subscribe]" {$commentform_subscribe} /><label for="checkbox_subscribe">{$CONST.SUBSCRIBE_TO_THIS_ENTRY}</label>
+    {/if}
+            </td>
+       </tr>
+{/if}
+
+{if $is_moderate_comments}
+       <tr>
+            <td class="serendipity_commentsValue serendipity_msg_important" colspan="2">{$CONST.COMMENTS_WILL_BE_MODERATED}</td>
+       </tr>
+{/if}
+
+       <tr>
+            <td>&#160;</td>
+            <td><input type="submit" name="serendipity[submit]" value="{$CONST.SUBMIT_COMMENT}" /> <input type="submit" name="serendipity[preview]" value="{$CONST.PREVIEW}" /></td>
+        </tr>
+    </table>
+    </form>
+</div>

Added: trunk/web/reactos.org/htdocs/serendipity/templates/roscms/comments.tpl
--- vendor/serendipity/current/templates/roscms/comments.tpl	2006-01-22 23:07:46 UTC (rev 20990)
+++ trunk/web/reactos.org/htdocs/serendipity/templates/roscms/comments.tpl	2006-01-22 23:16:30 UTC (rev 20991)
@@ -0,0 +1,24 @@
+{foreach from=$comments item=comment name="comments"}
+    <a id="c{$comment.id}"></a>
+    <li class="{if $smarty.foreach.comments.iteration is odd}graybox{/if}" style="margin-left: {$comment.depth*20}px">
+        <cite>{if $comment.url}
+                <a href="{$comment.url}" target="_blank">{$comment.author|@default:$CONST.ANONYMOUS}</a>
+            {else}
+                {$comment.author|@default:$CONST.ANONYMOUS}
+            {/if}</cite> {$CONST.SAYS}:<br />
+        <small class="commentmetadata">
+            <a href="#c{$comment.id}" title="{$CONST.LINK_TO_COMMENT|sprintf:$comment.trace}">#{$comment.trace}</a>
+            {$comment.timestamp|@formatTime:$CONST.DATE_FORMAT_SHORT}
+            {if $entry.is_entry_owner}
+                (<a href="{$comment.link_delete}" onclick="return confirm('{$CONST.COMMENT_DELETE_CONFIRM|@sprintf:$comment.id:$comment.author}');">{$CONST.DELETE}</a>)
+            {/if}
+            {roscms_can_add_comment}
+            {if $entry.allow_comments && $can_add_comment eq 'true'}
+                (<a href="#serendipity_CommentForm" onclick="document.getElementById('serendipity_replyTo').value='{$comment.id}';">{$CONST.REPLY}</a>)
+            {/if}
+        </small>
+        <p>{$comment.body}</p>
+    </li>
+{foreachelse}
+    <p class="nocomments">{$CONST.NO_COMMENTS}</p>
+{/foreach}

Added: trunk/web/reactos.org/htdocs/serendipity/templates/roscms/config.inc.php
--- vendor/serendipity/current/templates/roscms/config.inc.php	2006-01-22 23:07:46 UTC (rev 20990)
+++ trunk/web/reactos.org/htdocs/serendipity/templates/roscms/config.inc.php	2006-01-22 23:16:30 UTC (rev 20991)
@@ -0,0 +1,42 @@
+<?php # $Id: config.inc.php 108 2005-05-19 08:40:00Z garvinhicking $
+
+$probelang = dirname(__FILE__) . '/lang_' . $serendipity['lang'] . '.inc.php';
+if (file_exists($probelang)) {
+    include $probelang;
+} else {
+    include dirname(__FILE__) . '/lang_en.inc.php';
+}
+
+@define('LOGIN_TO_LEAVE_COMMENT', 'Please <a href="/roscms/?page=login&target=%s#comments">login</a> to leave a comment');
+
+$serendipity['smarty']->register_function('roscms_sidebar_transform',
+                                          'roscms_smarty_sidebar_transform');
+$serendipity['smarty']->register_function('roscms_can_add_comment',
+                                          'roscms_smarty_can_add_comment');
+
+function roscms_smarty_sidebar_transform($params, &$smarty)
+{
+    $old_content = $params['content'];
+
+    if (empty($old_content)) {
+        $new_content = '';
+    } else {
+        $new_content = '<li>';
+        $new_content .= preg_replace('=<br />\n?=i', "</li>\n<li>", $old_content);
+        $new_content .= "</li>\n";
+        $new_content = preg_replace('=<li></li>=i', '', $new_content);
+    }
+
+    return $new_content;
+}
+
+function roscms_smarty_can_add_comment($params, &$smarty)
[truncated at 1000 lines; 1170 more skipped]