also you have to change the following files:
ipbwiki_interace_setup.php:
[code]<?php
/*
+--------------------------------------------------------
| Package: IpbWiki Interface
| Copyright (c) 2006-2011 Peter De Decker
| http://www.ipbwiki.com
+--------------------------------------------------------
*/
if (!defined(\'WRK_DIR\')) {
define (\'WRK_DIR\', getcwd());
}
if(!function_exists(\'str_ireplace\')) {
function str_ireplace($search,$replace,$subject) {
$search = preg_quote($search, \"/\");
return preg_replace(\"/\".$search.\"/i\", $replace, $subject);
}
}
define( \'IN_IPB\', 0);
class ipbwiki_setup {
// remember our settings...
var $ipb_root_path;
var $ipb_forum_url;
var $forum_charset;
var $wiki_charset;
var $is_ipb;
var $is_vb;
// wiki DB
var $wgDBServer;
var $wgDBname;
var $wgDBuser;
var $wgDBpassword;
var $wgDBprefix;
var $wgServer;
var $wgScriptPath;
var $wgStylePath;
var $wgDefaultSkin;
// charsets...
var $decode_charsets = array( \'iso-8859-1\' => \'ISO-8859-1\',
\'iso8859-1\' => \'ISO-8859-1\',
\'iso-8859-15\' => \'ISO-8859-15\',
\'iso8859-15\' => \'ISO-8859-15\',
\'utf-8\' => \'UTF-8\',
\'cp866\' => \'cp866\',
\'ibm866\' => \'cp866\',
\'cp1251\' => \'windows-1251\',
\'windows-1251\' => \'windows-1251\',
\'win-1251\' => \'windows-1251\',
\'cp1252\' => \'windows-1252\',
\'windows-1252\' => \'windows-1252\',
\'koi8-r\' => \'KOI8-R\',
\'koi8-ru\' => \'KOI8-R\',
\'koi8r\' => \'KOI8-R\',
\'big5\' => \'BIG5\',
\'gb2312\' => \'GB2312\',
\'big5-hkscs\' => \'BIG5-HKSCS\',
\'shift_jis\' => \'Shift_JIS\',
\'sjis\' => \'Shift_JIS\',
\'euc-jp\' => \'EUC-JP\',
\'eucjp\' => \'EUC-JP\',
\'iso-8859-2\' => \'ISO-8859-2\',
\'iso8859-2\' => \'ISO-8859-2\');
// constructor, will take care of the program flow...
function ipbwiki_setup () {
switch (isset($_GET[\'act\']) && ($_GET[\'act\']))
{
case \'check_entries\':
$this->check_entries();
break;
default:
$this->entry();
break;
}
}
function print_top($title=\"\")
{
echo \"<html>
<head><title>IpbWiki Interface Set Up : $title </title>
<style type=\'text/css\'>
body {
font: x-small sans-serif;
background: #f9f9f9 url(skins/monobook/headbg.jpg) 0 0 no-repeat;
color: black;
margin: 0;
padding: 0;
}
table {
font-size: 100%;
background: transparent;
color: black;
}
td {
text-align: left;
}
a {
text-decoration: none;
color: #002bb8;
background: none;
}
a:visited {
color: #5a3696;
}
a:active {
color: #faa700;
}
a:hover {
text-decoration: underline;
}
</style>
</head>
<body marginheight=\'0\' marginwidth=\'0\' leftmargin=\'30\' topmargin=\'30\' bgcolor=\'#FFFFFF\'><center><table width=\'80%\'>
<H1>IpbWiki Set Up : $title</H1>
<br />
\";
}
function print_footer () {
echo \"</table></center></body></html>\";
}
function add_row ($text) {
echo \"<tr><td>$text</td></tr>\";
}
function entry() {
if ( ! file_exists (\'LocalSettings.php\')) {
$this->print_top (\'Checking file access permissions.\');
$this->add_row (\'the file LocalSettings.php not found in this directory. You have to install MediaWiki before installing the IpbWiki plugin.\');
$this->print_footer();
return;
}
$files = array(\'LocalSettings.php\', \'ipbwiki_config.php\', \'includes/Skin.php\', \'includes/User.php\', \'includes/SkinTemplate.php\', \'includes/EditPage.php\', \'includes/Parser.php\', \'includes/parser/Parser.php\');
$unwriteable = array();
ob_start(); // try to chmod the files so that the files become writable, but catch the annoying messages if we don\'t have rights to chmod...
foreach ($files as $file) {
if (file_exists($file)) {
chmod($file, 0777);
if ( ! is_writable($file)) {
array_push($unwriteable, $file);
}
}
}
ob_end_clean();
if (count($unwriteable) > 0) {
$this->print_top (\'Checking file access permissions.\');
foreach ($unwriteable as $file) {
$this->add_row (\"The file $file is not writable, please chmod it to 777.\");
}
$this->print_footer();
return;
}
if ($this->ipb_root_path != \"\") {
$ipb_root_path = $this->ipb_root_path;
} else {
if ( file_exists (\'ipbwiki_config.php\') ) {
require_once (\'ipbwiki_config.php\');
}
if ($ipb_root_path == \"\") {
$ipb_root_path=$_SERVER[\'DOCUMENT_ROOT\'] . \"/forums/\";
}
}
if ($this->ipb_forum_url != \"\") {
$ipb_forum_url = $this->ipb_forum_url;
}
$this->print_top (\'Configuration.\');
echo \"<td><p><form method=\'post\' action=\'?act=check_entries\'><input type="hidden" name="_visit_cookie" value="4e2483ded01750791eae72f157cc9455" /><B><H3>Forum Root Directory</H3></B><P>Please specify the complete path to the root of your forum directory (this typically looks something like: /home/public_html/community/forums/)<P><input type=\'input\' name=\'ipb_path\' value=\'$ipb_root_path\' size=\'100\'><p><B><H3>Forum Url</H3></B><P>Please specify the url of your forum (this typically looks something like: http://www.yoursite.com/forums/\)<P><input type=\'input\' name=\'ipb_forum_url\' value=\'$ipb_forum_url\' size=\'100\'><p><B><H3>Character Sets</H3></B><P>Please specify the characters sets you use for your forum and your wiki. (the default charset for the forum is ISO-8859-1 and the default characterset for the wiki is UTF-8, so if you don\'t know what charactersets are, just leave it at those values and it will probably work ;)<p>Wiki Character Set:<p><input type=\'input\' name=\'wiki_charset\' value=\'UTF-8\' size=\'100\'><p>Forum Character Set:<p><input type=\'input\' name=\'forum_charset\' value=\'ISO-8859-1\' size=\'100\'><p><input type=\'submit\' value=\'Start Install\'></form></td>\";
$this->print_footer();
}
function txt_stripslashes($t)
{
if ( get_magic_quotes_gpc() ) {
$t = stripslashes($t);
}
return $t;
}
function clean_value($val) {
$val = str_replace( \" \", \" \", $val );
$val = str_replace( \"&\" , \"&\" , $val );
$val = str_replace( \"<!--\" , \"<!--\" , $val );
$val = str_replace( \"-->\" , \"-->\" , $val );
$val = preg_replace( \"/<script/i\" , \"<script\" , $val );
$val = str_replace( \">\" , \">\" , $val );
$val = str_replace( \"<\" , \"<\" , $val );
$val = str_replace( \"\\\"\" , \""\" , $val );
$val = preg_replace( \"/\\n/\" , \"<br />\" , $val ); // Convert literal newlines
$val = preg_replace( \"/\\\\\\$/\" , \"$\" , $val );
$val = preg_replace( \"/\\r/\" , \"\" , $val ); // Remove literal carriage returns
$val = str_replace( \"!\" , \"!\" , $val );
$val = str_replace( \"\'\" , \"'\" , $val ); // IMPORTANT: It helps to increase sql query safety.
$val = $this->txt_stripslashes ($val);
$val = preg_replace( \"/\\\\\\(?!&#|\\?#)/\", \"\\", $val );
return $val;
}
function check_entries() {
$this->ipb_root_path = $_POST[\'ipb_path\'];
$this->ipb_forum_url = $_POST[\'ipb_forum_url\'];
$this->wiki_charset = $_POST[\'wiki_charset\'];
$this->forum_charset = $_POST[\'forum_charset\'];
if ( !is_dir ($this->ipb_root_path) ) {
$this->print_top (\'Configuration Error.\');
echo \"<td><p><form method=\'post\' action=\'?act=re-entry\'><input type="hidden" name="_visit_cookie" value="4e2483ded01750791eae72f157cc9455" /><B>The directory \" . $this->ipb_root_path . \" does not exist.<BR>Click the below button to go back to the entry screen where you can correct the path.<p><input type=\'submit\' value=\'Try Again\'></form></td>\";
$this->print_footer();
return;
}
// check if it is the invision power board directory they passed us on...
if ( !file_exists ($this->ipb_root_path . \"conf_global.php\")) {
// check if it is the vbulletin directory they passed us on...
if ( !file_exists ($this->ipb_root_path . \"includes/config.php\")) {
// check if simple machine forums...
if ( !file_exists ($this->ipb_root_path . \"Settings.php\")) {
$this->print_top (\'Configuration Error.\');
echo \"<td><p><form method=\'post\' action=\'?act=re-entry\'><input type="hidden" name="_visit_cookie" value="4e2483ded01750791eae72f157cc9455" /><B>The file \" . $this->ipb_root_path . \"conf_global.php or includes/config.php or Settings.php does not exist.<BR>Click the below button to go back to the entry screen where you can correct the path.<p><input type=\'submit\' value=\'Try Again\'></form></td>\";
$this->print_footer();
return;
} else {
$this->is_smf = 1;
$this->is_ipb = 0;
$this->is_vb = 0;
}
} else {
$this->is_ipb = 0;
$this->is_vb = 1;
$this->is_smf = 0;
}
} else {
$this->is_ipb = 1;
$this->is_vb = 0;
$this->is_smf = 0;
}
// check if the charactersets are known charactersets...
if ( !array_key_exists( strtolower($this->wiki_charset), $this->decode_charsets ) ) {
$this->print_top (\'Configuration Error.\');
echo \"<td><p><form method=\'post\' action=\'?act=re-entry\'><input type="hidden" name="_visit_cookie" value="4e2483ded01750791eae72f157cc9455" /><B>The wiki characterset \" . $this->wiki_charset . \" does not exist or is unsupported.<BR>Click the below button to go back to the entry screen where you can correct the characterset.<p><input type=\'submit\' value=\'Try Again\'></form></td>\";
$this->print_footer();
return;
}
if ( !array_key_exists( strtolower($this->forum_charset), $this->decode_charsets ) ) {
$this->print_top (\'Configuration Error.\');
echo \"<td><p><form method=\'post\' action=\'?act=re-entry\'><input type="hidden" name="_visit_cookie" value="4e2483ded01750791eae72f157cc9455" /><B>The forum characterset \" . $this->forum_charset . \" does not exist or is unsupported.<BR>Click the below button to go back to the entry screen where you can correct the characterset.<p><input type=\'submit\' value=\'Try Again\'></form></td>\";
$this->print_footer();
return;
}
$this->print_top (\"Installing...\");
// determine Server
// URL of the Wiki server. It will be automatically built including https mode
$this->wgServer = \'\';
if( isset( $_SERVER[\'SERVER_NAME\'] ) ) {
$wgServerName = $_SERVER[\'SERVER_NAME\'];
} elseif( isset( $_SERVER[\'HOSTNAME\'] ) ) {
$wgServerName = $_SERVER[\'HOSTNAME\'];
} elseif( isset( $_SERVER[\'HTTP_HOST\'] ) ) {
$wgServerName = $_SERVER[\'HTTP_HOST\'];
} elseif( isset( $_SERVER[\'SERVER_ADDR\'] ) ) {
$wgServerName = $_SERVER[\'SERVER_ADDR\'];
} else {
$wgServerName = \'localhost\';
}
# check if server use https:
$wgProto = (isset($_SERVER[\'HTTPS\']) && $_SERVER[\'HTTPS\'] == \'on\') ? \'https\' : \'http\';
$this->wgServer = $wgProto.\'://\' . $wgServerName;
# If the port is a non-standard one, add it to the URL
if( isset( $_SERVER[\'SERVER_PORT\'] )
&& !strpos( $wgServerName, \':\' )
&& ( ( $wgProto == \'http\' && $_SERVER[\'SERVER_PORT\'] != 80 )
|| ( $wgProto == \'https\' && $_SERVER[\'SERVER_PORT\'] != 443 ) ) ) {
$this->wgServer .= \":\" . $_SERVER[\'SERVER_PORT\'];
}
// Invision Power Board?
if ($this->is_ipb == 1) {
// add IpbWiki Plugin...
require_once($this->ipb_root_path . \"conf_global.php\");
}
// reset flag & counters...
$settings_found = false;
$settings_added = false;
$i = 0;
$j = 0;
$this->add_row (\"Appending IpbWiki processing to LocalSettings.php...\");
$fp = fopen(\"LocalSettings.php\", \'r\');
while( !feof($fp) )
{
$str = fgets($fp);
$temppie = preg_replace( \"#wgDBServer\\s*=\\s*\\\"(.*?)\\\";#ie\", \"\\$this->wgDBServer=\'\\\\1\'\", $str );
$temppie = preg_replace( \"#wgDBname\\s*=\\s*\\\"(.*?)\\\";#ie\", \"\\$this->wgDBname=\'\\\\1\'\", $str );
$temppie = preg_replace( \"#wgDBuser\\s*=\\s*\\\"(.*?)\\\";#ie\", \"\\$this->wgDBuser=\'\\\\1\'\", $str );
$temppie = preg_replace( \"#wgDBpassword\\s*=\\s*\\\"(.*?)\\\";#ie\", \"\\$this->wgDBpassword=\'\\\\1\'\", $str );
$temppie = preg_replace( \"#wgDBprefix\\s*=\\s*\\\"(.*?)\\\";#ie\", \"\\$this->wgDBprefix=\'\\\\1\'\", $str );
$temppie = preg_replace( \"#wgStylePath\\s*=\\s*\\\"(.*?)\\\";#ie\", \"\\$this->wgStylePath=\'\\\\1\'\", $str );
$temppie = preg_replace( \"#wgScriptPath\\s*=\\s*\\\"(.*?)\\\";#ie\", \"\\$this->wgScriptPath=\'\\\\1\'\", $str );
$temppie = preg_replace( \"#wgDefaultSkin\\s*=\\s*\\\"(.*?)\\\";#ie\", \"\\$this->wgDefaultSkin=\'\\\\1\'\", $str );
if (trim($str) === \"# Use IPBWiki Authentication\") {
$settings_found = true;
}
if (trim($str) === \"require_once(\'extensions/ipbwiki/IpbWiki_AuthPlugin.php\');\") {
$str = \"require_once(\'extensions/ipbwiki/ipbwiki_authplugin.php\');\\n\";
}
if (trim($str) === \'?>\') {
// end of php found, let\'s add the IPBWIKI Settings...
if (!$settings_found) {
$settings_added = 1;
$arr[$i++] = \"# The settings below were automatically added by the IpbWiki installer.\\n\";
$arr[$i++] = \"# If you make manual changes, please keep track in case you need to\\n\";
$arr[$i++] = \"# recreate them later.\\n\";
$arr[$i++] = \"\\n\";
$arr[$i++] = \"# Use IPBWiki Authentication\\n\";
$arr[$i++] = \"require_once(\'ipbwiki_interface.php\');\\n\";
$arr[$i++] = \"require_once(\'extensions/ipbwiki/ipbwiki_authplugin.php\');\\n\";
$arr[$i++] = \"\\$wgAuth = new AuthPlugin_ipbwiki(\\$wgGroupPermissions);\\n\";
$arr[$i++] = \"\\$wgWhitelistRead = array (\\\"Special:Userlogin\\\", \\\"Special:Userlogout\\\");\\n\";
$arr[$i++] = \"\\n\";
}
}
$arr[$i++] = $str;
}
if (!$settings_found and !$settings_added) { // MediaWiki 1.10 fix (localsettings isn\'t closed nicely with end php tag)
$arr[$i++] = \"# The settings below were automatically added by the IpbWiki installer.\\n\";
$arr[$i++] = \"# If you make manual changes, please keep track in case you need to\\n\";
$arr[$i++] = \"# recreate them later.\\n\";
$arr[$i++] = \"\\n\";
$arr[$i++] = \"# Use IPBWiki Authentication\\n\";
$arr[$i++] = \"require_once(\'ipbwiki_interface.php\');\\n\";
$arr[$i++] = \"require_once(\'extensions/ipbwiki/ipbwiki_authplugin.php\');\\n\";
$arr[$i++] = \"\\$wgAuth = new AuthPlugin_ipbwiki(\\$wgGroupPermissions);\\n\";
$arr[$i++] = \"\\$wgWhitelistRead = array (\\\"Special:Userlogin\\\", \\\"Special:Userlogout\\\");\\n\";
$arr[$i++] = \"\\n\";
}
fclose($fp);
$this->wgStylePath = str_replace (\'$wgScriptPath\', $this->wgScriptPath, $this->wgStylePath);
if (!$this->wgDefaultSkin or $this->wgDefaultSkin === \'\') {
$this->wgDefaultSkin = \'monobook\';
}
// Invision Power Board?
if ($this->is_ipb == 1) {
$this->ipb30 = 0;
$this->ipb_forum_url = $INFO[\'board_url\'];
// connect to the ipb db
if (file_exists($this->ipb_root_path.\'ipbwiki_db.php\')) {
chdir ($this->ipb_root_path);
define (\'IPBWIKI\',1);
require_once($this->ipb_root_path.\'ipbwiki_db.php\');
$DB = new ipbwiki_db;
chdir(WRK_DIR);
$this->ipb30 = 1;
} else if (file_exists($this->ipb_root_path.\'ips_kernel/\'.\'class_db_\'.strtolower($INFO[\'sql_driver\']).\".php\")) { // IPB 2.x
$INFO[\'sql_driver\'] = !$INFO[\'sql_driver\'] ? \'mysql\' : $INFO[\'sql_driver\'];
require ($this->ipb_root_path.\'ips_kernel/\'.\'class_db_\'.strtolower($INFO[\'sql_driver\']).\".php\" );
if (file_exists($this->ipb_root_path.\'converge_local/converge.php\')) { // IPB 2.2+
$classname = \"db_driver_\".$INFO[\'sql_driver\'];
$DB = new $classname;
} else {
$DB = new db_driver;
}
$DB->obj[\'sql_database\'] = $INFO[\'sql_database\'];
$DB->obj[\'sql_user\'] = $INFO[\'sql_user\'];
$DB->obj[\'sql_pass\'] = $INFO[\'sql_pass\'];
$DB->obj[\'sql_host\'] = $INFO[\'sql_host\'];
$DB->obj[\'sql_tbl_prefix\'] = $INFO[\'sql_tbl_prefix\'];
$DB->obj[\'use_shutdown\'] = 0;
$DB->obj[\'query_cache_file\'] = $this->ipb_root_path.\'sources/sql/\'.strtolower($INFO[\'sql_driver\']).\'_queries.php\';
$DB->obj[\'debug\'] = 0;
$DB->connect();
} else {
$INFO[\'sql_driver\'] = !$INFO[\'sql_driver\'] ? \'mysql\' : $INFO[\'sql_driver\'];
require ( $this->ipb_root_path.\'sources/Drivers/\'.$INFO[\'sql_driver\']).\".php\";
$DB = new db_driver;
$DB->obj[\'sql_database\'] = $INFO[\'sql_database\'];
$DB->obj[\'sql_user\'] = $INFO[\'sql_user\'];
$DB->obj[\'sql_pass\'] = $INFO[\'sql_pass\'];
$DB->obj[\'sql_host\'] = $INFO[\'sql_host\'];
$DB->obj[\'sql_tbl_prefix\'] = $INFO[\'sql_tbl_prefix\'];
$DB->connect();
}
$ibf_prefix = $INFO[\'sql_tbl_prefix\'];
// connect to the wiki database...
if( version_compare( PHP_VERSION, \'4.2.0\', \'ge\' ) ) {
$wikiDB = mysql_connect( $this->wgDBServer, $this->wgDBuser, $this->wgDBpassword, true );
} else {
# On PHP 4.1 the new_link parameter is not available. We cannot
# guarantee that we\'ll actually get a new connection, and this
# may cause some operations to fail possibly.
$wikiDB = mysql_connect( $this->wgDBServer, $this->wgDBuser, $this->wgDBpassword );
}
if ( $wikiDB == false ) {
echo \"<td><p><form method=\'post\' action=\'?act=re-entry\'><input type="hidden" name="_visit_cookie" value="4e2483ded01750791eae72f157cc9455" /><B>Cannot connect to mysql server \" . $this->wgDBServer . \" with user \".$this->wgDBuser.\"<BR>Check your LocalSettings.php file and then try again.<p><input type=\'submit\' value=\'Try Again\'></form></td>\";
$this->print_footer();
return;
} else {
$success = mysql_select_db( $this->wgDBname, $wikiDB );
if ( !$success ) {
echo \"<td><p><form method=\'post\' action=\'?act=re-entry\'><input type="hidden" name="_visit_cookie" value="4e2483ded01750791eae72f157cc9455" /><B>Cannot connect to database \" . $this->wgDBname . \"<BR>Check your LocalSettings.php file and then try again.<p><input type=\'submit\' value=\'Try Again\'></form></td>\";
$this->print_footer();
return;
}
}
// Enlarge the ug_group column to allow bigger member group titles
$this->add_row (\"Enlarge member group storage...\");
$sql = \"ALTER TABLE \". $this->wgDBprefix .\"user_groups MODIFY ug_group VARCHAR(100)\";
$query_id = mysql_query ($sql , $wikiDB) or die(\"Unable to alter user_groups table... - MySQL Error: \" . mysql_error());
// determine the invision power board groups
$cond = \'\';
$DB->query (\"SELECT g_title FROM \".$ibf_prefix.\"groups\");
while ($group = $DB->fetch_row()) {
$cond .= \" AND ug_group <> \'\".$group[\'g_title\'].\"\'\";
}
// clear the user groups in the wiki if they use the old permission system
$query_id = mysql_query (\"DELETE FROM \" . $this->wgDBprefix . \"user_groups WHERE 1=1\".$cond, $wikiDB) or die(\"Unable to delete old usergroups... - MySQL Error: \" . mysql_error());
// let\'s fix the user groups to the new permission system
$query_id = mysql_query (\"SELECT u.user_id, u.user_name FROM \" . $this->wgDBprefix . \"user u LEFT JOIN \" . $this->wgDBprefix . \"user_groups ug ON u.user_id=ug.ug_user WHERE ug_user IS NULL\", $wikiDB) or die(\"Unable to query for the users without user_groups - MySQL Error: \" . mysql_error());
$row = mysql_fetch_array($query_id);
while ($row) {
$user_name = utf8_decode($row [\'user_name\']);
$user_name = $this->clean_value($user_name);
if ($this->ipb30 == 1)
{
$DB->query (\"SELECT member_group_id as mgroup,posts FROM \".$ibf_prefix.\"members WHERE name=\'\".$user_name.\"\'\");
} else {
$DB->query (\"SELECT mgroup,posts FROM \".$ibf_prefix.\"members WHERE name=\'\".$user_name.\"\'\");
}
if ($group = $DB->fetch_row()) {
$DB->query (\"SELECT ig.*,g.g_title FROM \".$ibf_prefix.\"ipbwiki_group ig JOIN \".$ibf_prefix.\"groups g ON g.g_id = ig.g_id WHERE ig.g_id=\".$group[\'mgroup\'].\" AND ig.posts <= \".$group[\'posts\'].\" ORDER BY posts DESC\");
if ($group = $DB->fetch_row()) {
if ($group[\'posts\'] > 0) {
$groupname = $group[\'g_title\'] . \" (\".$group[\'posts\'].\"+ posts)\";
} else {
$groupname = $group[\'g_title\'];
}
mysql_query (\"INSERT INTO \" . $this->wgDBprefix . \"user_groups (ug_user,ug_group) VALUES (\" . $row[\'user_id\'] . \",\'\" . $groupname . \"\')\", $wikiDB) or die(\"Unable to insert user_group - MySQL Error: \" . mysql_error());
}
}
$row = mysql_fetch_array($query_id);
}
// let\'s set up the fix for monobook...
$query_id = mysql_query (\"SELECT * FROM \" . $this->wgDBprefix . \"page WHERE page_title=\'Monobook.css\'\", $wikiDB) or die(\"Unable to query for the page id for monobook.css - MySQL Error: \" . mysql_error());
$row = mysql_fetch_array($query_id);
if ($row) {
$query_id = mysql_query (\"SELECT * FROM \" . $this->wgDBprefix . \"searchindex WHERE si_page=\".$row[\'page_id\'], $wikiDB) or die(\"Unable to query for the searchindex for monobook.css - MySQL Error: \" . mysql_error());
$row2 = mysql_fetch_array($query_id);
if ($row2) {
$query_id = mysql_query (\"UPDATE \".$this->wgDBprefix .\"searchindex SET si_title = \'monobook css\', si_text = \' spoilertop background #e4eaf2 url no-repeat right; border 1px dotted #000; color #000; width 90 ; font-weight bold; font-size 10px; margin 8px auto 0 auto; padding 4px; spoilermain background #fafcfe; border 1px dotted #000; border-top 0; color #465584; width 90 ; padding 4px; margin 0 auto 8px auto; quotetop background #e4eaf2 url no-repeat right; border 1px dotted #000; border-bottom 0; border-left 4px solid #8394b2; color #000; font-weight bold; font-size 10px; margin 8px auto 0 auto; padding 3px; quotemain background #fafcfe; border 1px dotted #000; border-left 4px solid #8394b2; border-top 0; color #465584; padding 4px; margin 0 auto 8px auto; codetop sqltop htmltop background #fddbcc url no-repeat right; color #000; font-weight bold; margin 0 auto 0 auto; padding 3px; width 98 ; codemain sqlmain htmlmain background #fafcfe; border 1px dotted #000; color #465584; font-family courier courier new verdana arial; margin 0 auto 0 auto; padding 2px; width 98 ; textmain font-family courier courier new verdana arial;\' WHERE si_page = \".$row[\'page_id\'], $wikiDB) or die(\"Unable to update the searchindex for monobook.css - MySQL Error: \" . mysql_error());
} else {
$query_id = mysql_query (\"INSERT INTO \".$this->wgDBprefix .\"searchindex (si_page, si_title, si_text) VALUES (\".$row[\'page_id\'].\",\'monobook css\',\' spoilertop background #e4eaf2 url no-repeat right; border 1px dotted #000; color #000; width 90 ; font-weight bold; font-size 10px; margin 8px auto 0 auto; padding 4px; spoilermain background #fafcfe; border 1px dotted #000; border-top 0; color #465584; width 90 ; padding 4px; margin 0 auto 8px auto; quotetop background #e4eaf2 url no-repeat right; border 1px dotted #000; border-bottom 0; border-left 4px solid #8394b2; color #000; font-weight bold; font-size 10px; margin 8px auto 0 auto; padding 3px; quotemain background #fafcfe; border 1px dotted #000; border-left 4px solid #8394b2; border-top 0; color #465584; padding 4px; margin 0 auto 8px auto; codetop sqltop htmltop background #fddbcc url no-repeat right; color #000; font-weight bold; margin 0 auto 0 auto; padding 3px; width 98 ; codemain sqlmain htmlmain background #fafcfe; border 1px dotted #000; color #465584; font-family courier courier new verdana arial; margin 0 auto 0 auto; padding 2px; width 98 ; textmain font-family courier courier new verdana arial; \');\", $wikiDB) or die(\"Unable to query for the searchindex for monobook.css - MySQL Error: \" . mysql_error());
}
// don\'t bother about history, just update the last instance of the page in the text table...
$query_id = mysql_query (\"SELECT * FROM \" . $this->wgDBprefix . \"revision WHERE rev_id=\".$row[\'page_latest\'], $wikiDB) or die(\"Unable to query for the searchindex for monobook.css - MySQL Error: \" . mysql_error());
$row3 = mysql_fetch_array($query_id);
if ($row3) {
$query_id = mysql_query (\"UPDATE \".$this->wgDBprefix .\"text SET old_text=\'.spoilertop{\\n background: #E4EAF2 url(\".$INFO[\'board_url\'].\"/style_images/1/css_img_spoiler.gif) no-repeat right;\\n border: 1px dotted #000;\\n color: #000;\\n width: 90%;\\n font-weight: bold;\\n font-size: 10px;\\n margin: 8px auto 0 auto;\\n padding: 4px;\\n}\\n\\n.spoilermain{\\n background: #FAFCFE;\\n border: 1px dotted #000;\\n border-top: 0;\\n color: #465584;\\n width: 90%;\\n padding: 4px;\\n margin: 0 auto 8px auto;\\n}\\n\\n.quotetop{\\n background: #E4EAF2 url(\".$INFO[\'board_url\'].\"/style_images/1/css_img_quote.gif) no-repeat right;\\n border: 1px dotted #000;\\n border-bottom: 0;\\n border-left: 4px solid #8394B2;\\n color: #000;\\n font-weight: bold;\\n font-size: 10px;\\n margin: 8px auto 0 auto;\\n padding: 3px;\\n}\\n\\n.quotemain{\\n background: #FAFCFE;\\n border: 1px dotted #000;\\n border-left: 4px solid #8394B2;\\n border-top: 0;\\n color: #465584;\\n padding: 4px;\\n margin: 0 auto 8px auto;\\n}\\n\\n.codetop,\\n.sqltop,\\n.htmltop{\\n background: #FDDBCC url(\".$INFO[\'board_url\'].\"/style_images/1/css_img_code.gif) no-repeat right;\\n color: #000;\\n font-weight: bold;\\n margin: 0 auto 0 auto;\\n padding: 3px;\\n width: 98%;\\n}\\n\\n.codemain,\\n.sqlmain,\\n.htmlmain{\\n background: #FAFCFE;\\n border: 1px dotted #000;\\n color: #465584;\\n font-family: Courier, Courier New, Verdana, Arial;\\n margin: 0 auto 0 auto;\\n padding: 2px;\\n width: 98%;\\n}\\n\\n.textmain{\\n font-family: Courier, Courier New, Verdana, Arial;\\n}\' WHERE old_id=\".$row3[\'rev_text_id\'], $wikiDB) or die(\"Unable to set up the text table for monobook.css - MySQL Error: \" . mysql_error());
}
}
// clear the cache...
$query_id = mysql_query (\"DELETE FROM \" . $this->wgDBprefix . \"objectcache\", $wikiDB) or die(\"Unable to clear the object cache - MySQL Error: \" . mysql_error());
}
if (! $settings_found or $settings_added) {
$fp = fopen(\"LocalSettings.php\", \'w\');
while ($j <= $i) {
fwrite ($fp, $arr[$j++]);
}
fclose ($fp);
} else {
$this->add_row (\'Info: LocalSettings.php was already modified for IpbWiki. Settings not reapplied.\');
}
// Add the rating table
$this->add_row (\"Create rating table...\");
$sql = \"CREATE TABLE IF NOT EXISTS \". $this->wgDBprefix .\"rating (
id int(11) unsigned NOT NULL auto_increment,
page_id int(8) NOT NULL default 0,
user_id int(5) NULL,
ip varchar(20) NULL,
rating tinyint(1) NOT NULL default 0,
PRIMARY KEY (id) )
ENGINE=InnoDB;\";
$query_id = mysql_query ($sql , $wikiDB) or die(\"Unable to create rating table... - MySQL Error: \" . mysql_error());
// reset flag & counters...
$settings_found = false;
$fixed_skincode = false;
$abstract_skin = false;
$i = 0;
$j = 0;
$this->add_row (\"Appending IpbWiki processing to includes/Skin.php...\");
$fp = fopen(\"includes/Skin.php\", \'r\');
while( !feof($fp) )
{
$str = fgets($fp);
if (trim($str) === \"// IpbWiki Low Level Skin Interface\") {
$settings_found = true;
}
if (trim($str) === \"abstract class Skin extends ContextSource {\") {
//MW 1.18+
$str = \"abstract class Skin_Orig extends ContextSource {\\n\";
$abstract_skin = true;
}
if (trim($str) === \"class Skin extends Linker {\") {
$str = \"class Skin_Orig extends Linker {\\n\";
}
if (trim($str) === \"function Skin() { parent::Linker(); }\") {
$str = \"function Skin_Orig() { parent::Linker(); }\\n\";
}
if (trim($str) === \'$s .= $wgAuth->get_extra_css_styles();\') {
$fixed_skincode = true;
$str = \" \\$s .= \\$wgAuth->ipbwiki->get_extra_css_styles();\\n\";
}
if (trim($str) === \'?>\') {
$str = \'\'; // MediaWiki 1.11 fix
}
$arr[$i++] = $str;
}
fclose($fp);
// let\'s add the IPBWIKI Settings...
if (!$settings_found) {
$arr[$i++] = \"\\n\";
$arr[$i++] = \"// IpbWiki Low Level Skin Interface\\n\";
$arr[$i++] = \"\\n\";
if ($abstract_skin) {
//MW 1.18+
$arr[$i++] = \" abstract class Skin extends Skin_Orig {\\n\";
} else {
$arr[$i++] = \" class Skin extends Skin_Orig {\\n\";
}
$arr[$i++] = \"\\n\";
$arr[$i++] = \" /** Constructor, call parent constructor */\\n\";
$arr[$i++] = \" function Skin_Orig() {\\n\";
$arr[$i++] = \" parent::Skin(); \\n\";
$arr[$i++] = \" }\\n\";
$arr[$i++] = \"\\n\";
$arr[$i++] = \" function getPoweredBy() {\\n\";
$arr[$i++] = \" global \\$wgScriptPath;\\n\";
$arr[$i++] = \" global \\$wgAuth;\\n\";
$arr[$i++] = \" \\$img = parent::getPoweredBy();\\n\";
$arr[$i++] = \" \\$url = htmlspecialchars( \\\"\\$wgScriptPath/extensions/ipbwiki/linkedby_ipbwiki.png\\\" );\\n\";
$arr[$i++] = \" \\$img2 = \'<a href=\\\"http://www.ipbwiki.com/\\\"><img src=\\\"\'.\\$url.\'\\\" alt=\\\"IpbWiki\\\" /></a>\';\\n\";
$arr[$i++] = \"\\n\";
$arr[$i++] = \" if (class_exists (\'ipbwiki\')) {\\n\";
$arr[$i++] = \" \\$show = true;\\n\";
$arr[$i++] = \" \\$copyrr = \\$wgAuth->ipbwiki->ipbwiki->copyrr;\\n\";
$arr[$i++] = \" if ((strlen (\\$copyrr) == 9) and\\n\";
$arr[$i++] = \" (is_numeric (\\$copyrr))) {\\n\";
$arr[$i++] = \" \\$license_part1 = substr (\\$copyrr,0,7);\\n\";
$arr[$i++] = \" \\$license_part2 = substr (\\$copyrr,7,2);\\n\";
$arr[$i++] = \" \\$remainder = strval(intval(\\$license_part1) % 88);\\n\";
$arr[$i++] = \" if (\\$remainder == \\$license_part2) {\\n\";
$arr[$i++] = \" \\$show = false;\\n\";
$arr[$i++] = \" } \\n\";
$arr[$i++] = \" }\\n\";
$arr[$i++] = \" if (\\$show) {\\n\";
$arr[$i++] = \" return \\$img2 . \\$img;\\n\";
$arr[$i++] = \" } else {\\n\";
$arr[$i++] = \" return \\$img;\\n\";
$arr[$i++] = \" }\\n\";
$arr[$i++] = \" } else {\\n\";
$arr[$i++] = \" return \\$img;\\n\";
$arr[$i++] = \" }\\n\";
$arr[$i++] = \" } \\n\";
$arr[$i++] = \"\\n\";
$arr[$i++] = \" function reallyDoGetUserStyles() {\\n\";
$arr[$i++] = \" global \\$wgAuth;\\n\";
$arr[$i++] = \" \\$s = parent::reallyDoGetUserStyles();\\n\";
$arr[$i++] = \" \\$s .= \\$wgAuth->ipbwiki->get_extra_css_styles();\\n\";
$arr[$i++] = \" return \\$s;\\n\";
$arr[$i++] = \" }\\n\";
$arr[$i++] = \"\\n\";
$arr[$i++] = \" }\\n\";
$arr[$i++] = \"?>\"; // nice close
} else {
if (!$fixed_skincode) {
$this->add_row (\'Info: Skin.php was already modified for IpbWiki. Settings not reapplied.\');
} else {
$this->add_row (\'Applied bugfix to Skin.php\');
}
}
// write the skin file...
$fp = fopen(\"includes/Skin.php\", \'w\');
while ($j <= $i) {
fwrite ($fp, $arr[$j++]);
}
fclose ($fp);
// reset flag & counters...
$settings_found = false;
$fix_to_be_applied_for_railroad_sign = true;
$fixed_usercode = false;
$fixed_user_mwbug = false;
$fix_applied_for_railroad_sign = false;
$fix153 = 0;
$i = 0;
$j = 0;
$k = 0;
$this->add_row (\"Appending IpbWiki processing to includes/User.php...\");
$fp = fopen(\"includes/User.php\", \'r\');
while( !feof($fp) )
{
$str = fgets($fp);
if (trim($str) === \"// IpbWiki Low Level User Interface\") {
$settings_found = true;
}
if (trim($str) === \"class User {\") {
$str = \"class User_Orig {\\n\";
}
if ((trim($str) === \"function User() {\") or (trim($str) === \"function User() {\")) {
$str = \" function User_Orig() {\\n\";
}
if (trim($str) === \'if ($name === $wgAuth->ipbwiki->ipbwiki->clean_username($this->mName)) {\') {
$str = \" if (\\$this->mName === \\$wgAuth->ipbwiki->ipbwiki->clean_username(\\$this->mName)) {\\n\";
$fixed_usercode = true;
}
if (substr(trim($str),0,95) === \'$query_id = mysql_query (\"SELECT * FROM \" . $wgDBprefix . \"user WHERE LOWER(user_name) = LOWER(\') {
$str = \" \\$query_id = mysql_query (\\\"SELECT * FROM \\\" . \\$wgDBprefix . \\\"user WHERE LOWER(user_name) = LOWER(\'\\\" . \\$this->mName . \\\"\')\\\", \\$dbr->mConn) or die(\\\"IpbWiki - addToDatabase - MySQL Error: \\\" . mysql_error());\\n\";
}
if (trim($str) === \"// it\'s either this hack or modifying a lot of files... :(\") {
$k = $k + 1;
}
if ((trim($str) === \'global $wgAuth;\') and ($k == 1)) {
$k = $k + 1;
}
if ((trim($str) === \'global $wgDBprefix;\') and ($k == 2)) {
$k = 0;
}
if ((trim($str) !== \'global $wgAuth;\') and ($k == 2)) {
$arr[$i++] = \" global \\$wgDBprefix;\\n\";
$k = 0;
}
if (trim($str) === \'$row = mysql_fetch_array(1);\') {
$str = \" \\$row = mysql_fetch_array(\\$query_id);\\n\";
}
/* fix is deprecated now, was only needed for 1.6.1 till 1.6.3 or sth like that...
if (trim($str) === \'if ( $val != $sessionToken ) {\') {
$str = \" if ( \\$val != \\$sessionToken and \\$wgSessionsInMemcached ) { // IpbWiki Installer: Mediawiki Bugfix\\n\";
$fixed_user_mwbug = true;
} */
if (trim($str) === \'$wgAuth->ipbwiki->ipbwiki->username_replace_special_characters_for_wiki($name);\') {
$fix_to_be_applied_for_railroad_sign = false;
}
if (trim($str) === \'$name = ucfirst($name);\') {
if ($fix_to_be_applied_for_railroad_sign) {
$fix_applied_for_railroad_sign = true;
$arr[$i++] = \" \\$wgAuth->ipbwiki->ipbwiki->username_replace_special_characters_for_wiki(\\$name);\\n\";
$arr[$i++] = \" if (strpos(\\$name, Sanitizer::decodeChar(65283)) <> 0) {\\n\";
$arr[$i++] = \" \\$name = ucfirst(\\$name);\\n\";
$str = \" }\";
}
}
if (trim($str) === \'$query_id = $dbr->select (\\\'user\\\', array (\\\'user_id\\\'));\') {
$str = \" \\$query_id = \\$dbr->select (\'user\', array (\'user_id\'), array (\'user_name\' => \\$this->mName));\\n\";
$fixed_usercode = true;
}
if (substr(trim($str),0,6) === \'self::\') {
$str = str_ireplace(\"self::\", \"User::\", $str);
}
if (trim($str) === \'if (strpos($name, Sanitizer::decodeChar(65283)) <> 0) {\') {
$str = \" if (! strpos(\\$name, Sanitizer::decodeChar(65283))) {\\n\";
}
if (trim($str) === \'$name = ucfirst($name);\') {
$str = \" \\$name = \\$wgAuth->ipbwiki->ucfirst (\\$name);\\n\";
}
if (trim($str) === \'if ($this->mName === User::clean_username($this->mName)) {\') {
$str = \" if (\\$this->mName === \\$this->clean_username(\\$this->mName)) {\\n\";
$fixed_usercode = true;
}
// fixes - IpbWiki 1.5.1
if (trim($str) === \'$name = $wgAuth->ipbwiki->ucfirst ($name);\') {
$str = \" \\$name = \\$wgAuth->ipbwiki->ucfirst (\\$name, \\$wgAuth->ipbwiki->wiki_charset);\\n\";
}
// fixes - IpbWiki 1.5.2
//$str = str_replace(\"static function\", \"function\", $str);
//Deprecate, let\'s try and fix the code rather than working around it
// fixes - IpbWiki 1.5.3
if (trim($str) === \'$u = parent::newFromName ($name, \\\'usable\\\');\') {
$fix153 = 1;
}
if ($fix153 == 1 and substr(trim($str),0,23) === \'if (is_object( $u )) {\') {
$fix153 = 999;
}
if ($fix153 == 1 and trim($str) == \'$u->mName = $name;\') {
$fix153 = 998;
$fixed_usercode = true;
$str = \" if (is_object( \\$u )) { \\$u->mName = \\$name; return \\$u; } else { return null; }\";
}
if ($fix153 == 998 and trim($str) == \'return $u;\') {
$str = \'\';
$fix153 = 999;
}
// fixes - IpbWiki 1.7
if (trim($str) === \'$name = $wgAuth->ipbwiki->ucfirst ($name, $wgAuth->ipbwiki->wiki_charset);\') {
$str = \" \\$name = \\$wgAuth->ipbwiki->ucfirst (\\$name, \\$wgAuth->ipbwiki->ipbwiki->wiki_charset);\\n\";
}
// normal processing
if (trim($str) === \'?>\') {
// Mediawiki 1.11 fix, no longer closes the file nicely...
$str = \'\';
}
$arr[$i++] = $str;
}
fclose($fp);
// let\'s add the IPBWIKI Settings to user.php...
if (!$settings_found) {
$arr[$i++] = \"\\n\";
$arr[$i++] = \"// IpbWiki Low Level User Interface\\n\";
$arr[$i++] = \"class User extends User_Orig {\\n\";
$arr[$i++] = \" // constructor\\n\";
$arr[$i++] = \" function User () {\\n\";
$arr[$i++] = \" global \\$wgVersion;\\n\";
$arr[$i++] = \" // call the parent constructor\\n\";
$arr[$i++] = \" if (version_compare(\\$wgVersion, \'1.17.0\', \'>=\')) {\\n\";
$arr[$i++] = \" return parent::__construct();\\n\";
$arr[$i++] = \" } else {\\n\";
$arr[$i++] = \" return parent::User_Orig();\\n\";
$arr[$i++] = \" }\\n\";
$arr[$i++] = \" }\\n\";
$arr[$i++] = \"\\n\";
$arr[$i++] = \" static function isValidUserName( \\$name ) {\\n\";
$arr[$i++] = \" // ipbwiki core class available...? (woot!)\\n\";
$arr[$i++] = \" if (class_exists (\'ipbwiki\')) {\\n\";
$arr[$i++] = \" return (\\$name === User::clean_username(\\$name));\\n\";
$arr[$i++] = \" } else {\\n\";
$arr[$i++] = \" return parent::isValidUserName (\\$name);\\n\";
$arr[$i++] = \" }\\n\";
$arr[$i++] = \" }\\n\";
$arr[$i++] = \" \\n\";
$arr[$i++] = \" static function newFromName( \\$name, \\$validate = \'valid\' ) {\\n\";
$arr[$i++] = \" global \\$wgAuth;\\n\";
$arr[$i++] = \" global \\$wgVersion;\\n\";
$arr[$i++] = \" \\n\";
$arr[$i++] = \" // ipbwiki core class available...? (woot!)\\n\";
$arr[$i++] = \" if (class_exists (\'ipbwiki\')) {\\n\";
$arr[$i++] = \" \\$fname = \'User::newFromName\'; \\n\";
$arr[$i++] = \" \\$wgAuth->ipbwiki->login_name = \\$name; \\n\";
$arr[$i++] = \" \\$name = \\$wgAuth->ipbwiki->ipbwiki->get_display_name (\\$name);\\n\";
$arr[$i++] = \" \\$name = \\$wgAuth->ipbwiki->ipbwiki->unclean_value(\\$name);\\n\";
$arr[$i++] = \" \\$wgAuth->ipbwiki->ipbwiki->username_replace_special_characters_for_wiki(\\$name);\\n\";
$arr[$i++] = \" if (! strpos(\\$name, Sanitizer::decodeChar(65283))) {\\n\";
$arr[$i++] = \" \\$name = \\$wgAuth->ipbwiki->ucfirst (\\$name, \\$wgAuth->ipbwiki->ipbwiki->wiki_charset);\\n\";
$arr[$i++] = \" }\\n\";
$arr[$i++] = \" \\$wgAuth->ipbwiki->display_name = \\$name; \\n\";
$arr[$i++] = \" if (version_compare(\\$wgVersion, \'1.9.0rc1\', \'>=\')) {\\n\";
$arr[$i++] = \" \\$u = parent::newFromName (\\$name, \'usable\');\\n\";
$arr[$i++] = \" if (is_object( \\$u )) {\\n\";
$arr[$i++] = \" \\$u->mName = \\$name;\\n\";
$arr[$i++] = \" return \\$u;\\n\";
$arr[$i++] = \" } else {\\n\";
$arr[$i++] = \" return null;\\n\";
$arr[$i++] = \" }\\n\";
$arr[$i++] = \" } else {\\n\";
$arr[$i++] = \" \\$u = new User();\\n\";
$arr[$i++] = \" \\$u->setName( \\$name );\\n\";
$arr[$i++] = \" \\$dbr =& wfGetDB( DB_SLAVE );\\n\";
$arr[$i++] = \" \\$s = \\$dbr->selectRow( \'user\', array( \'user_id\' ), array( \'user_name\' => \\$name ), \\$fname );\\n\";
$arr[$i++] = \" \\$u->setId (\\$s->user_id);\\n\";
$arr[$i++] = \" return \\$u;\\n\";
$arr[$i++] = \" }\\n\";
$arr[$i++] = \" } else {\\n\";
$arr[$i++] = \" \\$u = parent::newFromName (\\$name, \\$validate);\\n\";
$arr[$i++] = \" }\\n\";
$arr[$i++] = \" return \\$u;\\n\";
$arr[$i++] = \" }\\n\";
$arr[$i++] = \"\\n\";
$arr[$i++] = \" function addToDatabase() {\\n\";
$arr[$i++] = \" // this isn\'t the nicest way to solve the username problem, but there are several direct calls not passing through the user object. \\n\";
$arr[$i++] = \" // it\'s either this hack or modifying a lot of files... :(\\n\";
$arr[$i++] = \" global \\$wgAuth;\\n\";
$arr[$i++] = \" global \\$wgDBprefix;\\n\";
$arr[$i++] = \"\\n\";
$arr[$i++] = \" if (class_exists (\'ipbwiki\')) {\\n\";
$arr[$i++] = \" \\$dbr =& wfGetDB( DB_SLAVE );\\n\";
$arr[$i++] = \" if (\\$this->mName === \\$this->clean_username(\\$this->mName)) {\\n\";
$arr[$i++] = \" \\$query_id = \\$dbr->select (\'user\', array (\'user_id\'), array (\'user_name\' => \\$this->mName));\\n\";
$arr[$i++] = \" \\$row = \\$dbr->fetchObject( \\$query_id ) ;\\n\";
$arr[$i++] = \"\\n\";
$arr[$i++] = \" if (! \\$row) {\\n\";
$arr[$i++] = \" return parent::addToDatabase();\\n\";
$arr[$i++] = \" } else {\\n\";
$arr[$i++] = \" \\$this->mId = \\$row->user_id; \\n\";
$arr[$i++] = \" }\\n\";
$arr[$i++] = \" } else {\\n\";
$arr[$i++] = \" \\$this->mId = 0;\\n\";
$arr[$i++] = \" }\\n\";
$arr[$i++] = \" } else {\\n\";
$arr[$i++] = \" return parent::addToDatabase();\\n\";
$arr[$i++] = \" }\\n\";
$arr[$i++] = \" }\\n\";
$arr[$i++] = \" \\n\";
$arr[$i++] = \" static function clean_username (\\$val) {\\n\";
$arr[$i++] = \" \\$val = str_replace( \\\">\\\" , \\\" \\\" , \\$val );\\n\";
$arr[$i++] = \" \\$val = str_replace( \\\">\\\" , \\\" \\\" , \\$val );\\n\";
$arr[$i++] = \" \\$val = str_replace( \\\">\\\" , \\\" \\\" , \\$val );\\n\";
$arr[$i++] = \" \\$val = str_replace( \\\"<\\\" , \\\" \\\" , \\$val );\\n\";
$arr[$i++] = \" \\$val = str_replace( \\\"<\\\" , \\\" \\\" , \\$val );\\n\";
$arr[$i++] = \" \\$val = str_replace( \\\"<\\\" , \\\" \\\" , \\$val );\\n\";
$arr[$i++] = \" \\$val = str_replace( \\\"\'\\\" , \\\" \\\" , \\$val ); // IMPORTANT: It helps to increase sql query safety.\\n\";
$arr[$i++] = \" \\$val = str_replace( \\\"'\\\" , \\\" \\\" , \\$val ); \\n\";
$arr[$i++] = \" return \\$val;\\n\";
$arr[$i++] = \" }\\n\";
$arr[$i++] = \" \\n\";
$arr[$i++] = \" static function isUsableName (\\$name) {\\n\";
$arr[$i++] = \" if (class_exists (\'ipbwiki\')) {\\n\";
$arr[$i++] = \" return User::isValidUserName (\\$name);\\n\";
$arr[$i++] = \" } else {\\n\";
$arr[$i++] = \" return parent::isUsableName (\\$name);\\n\";
$arr[$i++] = \" }\\n\";
$arr[$i++] = \" } \\n\";
$arr[$i++] = \"}\\n\";
$arr[$i++] = \"?>\"; // nice close of php file...
} else {
if ($fixed_usercode) {
$this->add_row (\'User.php: bugfix applied.\');
} else {
$this->add_row (\'Info: User.php was already modified for IpbWiki. Settings not reapplied.\');
}
}
if ($fixed_user_mwbug) {
$this->add_row (\'User.php: fixed Mediawiki 1.6.x bug.\');
}
if ($fix_applied_for_railroad_sign) {
$this->add_row (\'User.php: applied fix for #.\');
}
// write the user file...
$fp = fopen(\"includes/User.php\", \'w\');
while ($j <= $i) {
fwrite ($fp, $arr[$j++]);
}
fclose ($fp);
// reset flag & counters...
$settings_found = false;
$i = 0;
$j = 0;
$function_found = false;
$fix_applied = false;
$this->add_row (\"Appending IpbWiki processing to includes/SkinTemplate.php...\");
$fp2 = fopen(\"includes/SkinTemplate.php\", \'r\');
while( !feof($fp2) )
{
$str = fgets($fp2);
if (trim($str) === \"// IpbWiki Low Level SkinTemplate Interface\") {
$settings_found = true;
} else if (trim($str) === \"class SkinTemplate extends Skin {\") {
$str = \"class SkinTemplate_Orig extends Skin {\\n\";
} else if (trim($str) === \'function html( $str ) {\') {
$function_found = true;
} else if ($function_found and !$fix_applied and (trim($str) === \"wfRunHooks( \'BeforeDisplayArticle\');\")) {
$this->add_row (\"hook fix already applied\");
$fix_applied = true;
} else if ($function_found and !$fix_applied and (trim($str) === \'echo $this->data[$str];\')) {
$arr[$i++] = \" if (\\$str == \'subtitle\') {\\n\";
$arr[$i++] = \" wfRunHooks( \'BeforeDisplayArticle\');\\n\";
$arr[$i++] = \" }\\n\";
$arr[$i++] = \" echo \\$this->data[\\$str];\\n\";
$arr[$i++] = \" if (\\$str == \'bodytext\') {\\n\";
$arr[$i++] = \" wfRunHooks( \'AfterDisplayArticle\');\\n\";
$str = \" }\\n\";
} else if (trim($str) === \'?>\') {
$str = \'\'; // MediaWiki 1.11+ fix
}
$arr[$i++] = $str;
}
$arr[$i] = \"\";
fclose($fp2);
// let\'s add the IPBWIKI Settings...
if (!$settings_found) {
$arr[$i++] = \"\\n\";
$arr[$i++] = \"// IpbWiki Low Level SkinTemplate Interface\\n\";
$arr[$i++] = \"\\n\";
$arr[$i++] = \" class SkinTemplate extends SkinTemplate_Orig {\\n\";
$arr[$i++] = \"\\n\";
$arr[$i++] = \" function makeTalkUrlDetails( \\$name, \\$urlaction=\'\' ) {\\n\";
$arr[$i++] = \" global \\$wgTitleCache;\\n\";
$arr[$i++] = \" global \\$wgAuth;\\n\";
$arr[$i++] = \" \\$title = Title::newFromText( \\$name );\\n\";
$arr[$i++] = \" if (\\$title) {\\n\";
$arr[$i++] = \" return parent::makeTalkUrlDetails (\\$name, \\$urlaction);\\n\";
$arr[$i++] = \" }\\n\";
$arr[$i++] = \" }\\n\";
$arr[$i++] = \"}\\n\";
$arr[$i++] = \"?>\"; // nice close...
} else {
$this->add_row (\'Info: SkinTemplate.php was already modified for IpbWiki. Settings not reapplied.\');
}
// write the SkinTemplate file...
$fp2 = fopen(\"includes/SkinTemplate.php\", \'w\');
while ($j < $i) {
fwrite ($fp2, $arr[$j++]);
}
fclose ($fp2);
// reset flag & counters...
$settings_found = false;
$settings_added = false;
$prev_str = \'\';
$i = 0;
$j = 0;
$this->add_row (\"Appending IpbWiki processing to includes/EditPage.php...\");
$fp2 = fopen(\"includes/EditPage.php\", \'r\');
while( !feof($fp2) )
{
$str = fgets($fp2);
if (trim($str) === \"// IpbWiki Low Level EditPage Interface\") {
$settings_found = true;
}
if (trim($str) === \"class EditPage {\") {
$str = \"class EditPage_Orig {\\n\";
}
if (trim($str) === \"private function getContent() {\") {
$str = \" protected function getContent() {\\n\";
}
if (trim($str) === \'function EditPage( $article ) {\') {
$str = \" function EditPage_Orig ( \\$article ) {\\n\";
}
if (trim($str) === \"private function getContent( \\$def_text = \'\' ) {\") {
$str = \" function getContent( \\$def_text = \'\' ) {\\n\";
$settings_added = true;
}
if ((trim($str) === \'$text = parent::getContent();\') and (trim($prev_str) === \'global $wgRequest;\')) {
$settings_added = true;
$arr[$i++] = \" global \\$wgServer;\\n\";
$arr[$i++] = \" global \\$wgArticlePath;\\n\";
}
if ((trim($str) === \'$cat = explode(\";\",$categories);\') and (trim($prev_str) === \"\\$categories = \\$wgRequest->getVal (\'categories\');\")) {
$settings_added = true;
$arr[$i++] = \" \\$namespace = \\$wgRequest->getVal (\'namespace\');\\n\";
$arr[$i++] = \" \\$title = \\$wgRequest->getval(\'title\');\\n\";
$arr[$i++] = \" if (\\$namespace <> \'\') {\\n\";
$arr[$i++] = \" \\$article_url = \\$wgServer . str_replace( \'\\$1\', \\$namespace.\':\'.\\$title.\'&action=edit&categories=\'.\\$categories, \\$wgArticlePath );\\n\";
$arr[$i++] = \" \\$article_url = str_replace (\'/index.php/\',\'/index.php?title=\',\\$article_url);\\n\";
$arr[$i++] = \" @header( \\\"Location: \\\".\\$article_url );\\n\";
$arr[$i++] = \" return;\\n\";
$arr[$i++] = \" }\\n\";
}
if (trim($str) === \'?>\') {
$str = \'\'; // MediaWiki 1.11+ fix
}
$arr[$i++] = $str;
$prev_str = $str;
}
$arr[$i] = \"\";
fclose($fp2);
// let\'s add the IPBWIKI Settings...
if (!$settings_found) {
$arr[$i++] = \"\\n\";
$arr[$i++] = \"// IpbWiki Low Level EditPage Interface\\n\";
$arr[$i++] = \"\\n\";
$arr[$i++] = \"class EditPage extends EditPage_Orig {\\n\";
$arr[$i++] = \" function getContent (\\$def_text = \'\') {\\n\";
$arr[$i++] = \" global \\$wgRequest;\\n\";
$arr[$i++] = \" global \\$wgServer;\\n\";
$arr[$i++] = \" global \\$wgArticlePath;\\n\";
$arr[$i++] = \" \\$text = parent::getContent(\\$def_text);\\n\";
$arr[$i++] = \" \\$categories = \\$wgRequest->getVal (\'categories\'); \\n\";
$arr[$i++] = \" \\$namespace = \\$wgRequest->getVal (\'namespace\');\\n\";
$arr[$i++] = \" \\$title = \\$wgRequest->getval(\'title\');\\n\";
$arr[$i++] = \" if (\\$namespace <> \'\') {\\n\";
$arr[$i++] = \" \\$article_url = \\$wgServer . str_replace( \'\\$1\', \\$namespace.\':\'.\\$title.\'&action=edit&categories=\'.\\$categories, \\$wgArticlePath );\\n\";
$arr[$i++] = \" \\$article_url = str_replace (\'/index.php/\',\'/index.php?title=\',\\$article_url);\\n\";
$arr[$i++] = \" @header( \\\"Location: \\\".\\$article_url );\\n\";
$arr[$i++] = \" return;\\n\";
$arr[$i++] = \" }\\n\";
$arr[$i++] = \" \\$cat = explode(\\\";\\\",\\$categories);\\n\";
$arr[$i++] = \" foreach (\\$cat as \\$c) {\\n\";
$arr[$i++] = \" if (\\$c) {\\n\";
$arr[$i++] = \" \\$text .= \'[[Category:\'.\\$c.\']]\\n\';\\n\";
$arr[$i++] = \" }\\n\";
$arr[$i++] = \" }\\n\";
$arr[$i++] = \" return \\$text;\\n\";
$arr[$i++] = \" }\\n\";
$arr[$i++] = \"}\\n\";
$arr[$i++] = \"?>\"; // nice close
} else {
if ($settings_added) {
$this->add_row (\'Applied patch to EditPage.php.\');
} else {
$this->add_row (\'Info: EditPage.php was already modified for IpbWiki. Settings not reapplied.\');
}
}
// write the EditPage file...
if ((!$settings_found) or ($settings_added)) {
$fp2 = fopen(\"includes/EditPage.php\", \'w\');
while ($j < $i) {
fwrite ($fp2, $arr[$j++]);
}
fclose ($fp2);
}
// reset flag & counters...
$settings_found = false;
$settings_added = false;
$prev_str = \'\';
$i = 0;
$j = 0;
$function_found = false;
$profile_out_found = false;
if (file_exists(\'includes/parser/Parser.php\'))
{
$file_name = \'includes/parser/Parser.php\';
}
else
{
$file_name = \'includes/Parser.php\';
}
$this->add_row (\"Appending IpbWiki processing to \".$file_name.\"...\");
$fp2 = fopen($file_name, \'r\');
while( !feof($fp2) )
{
$str = fgets($fp2);
if ((trim($str) === \'function replaceVariables( $text, $args = array(), $argsOnly = false ) {\') or (trim($str) === \'function replaceVariables( $text, $frame = false, $argsOnly = false ) {\' )) {
$function_found = true;
}
if ($function_found and $profile_out_found and (trim($str) === \"wfRunHooks( \'ParserBeforeStrip\', array( &\\$this, &\\$text, &\\$this->mStripState ) );\")) {
$str = \" if ( \\$this->mOutputType == OT_HTML ) { wfRunHooks( \'ParserBeforeStrip\', array( &\\$this, &\\$text, &\\$this->mStripState ) ); }\\r\\n\";
$this->add_row (\'Corrected hook fix.\');
$function_found = false;
$settings_found = true;
}
if ($function_found and (trim($str) === \"wfRunHooks( \'ParserBeforeStrip\', array( &\\$this, &\\$text, &\\$this->mStripState ) );\")) {
$function_found = false;
}
if ($function_found and (trim($str) === \"if ( \\$this->mOutputType == OT_HTML ) { wfRunHooks( \'ParserBeforeStrip\', array( &\\$this, &\\$text, &\\$this->mStripState ) ); }\")) {
$function_found = false;
}
if ($function_found and (trim($str) === \'wfProfileOut( $fname );\') || (trim($str) === \'wfProfileOut( __METHOD__ );\')) {
$profile_out_found = true;
}
if ($function_found and $profile_out_found and (trim($str) === \'return $text;\')) {
// add the extra hook call so templates get bbcode parsing and emoticon replacements...
$arr[$i++] = \" if ( \\$this->mOutputType == OT_HTML ) { wfRunHooks( \'ParserBeforeStrip\', array( &\\$this, &\\$text, &\\$this->mStripState ) ); }\\r\\n\";
$this->add_row (\'Applied hook fix.\');
$function_found = false;
$settings_found = true;
}
$arr[$i++] = $str;
}
// write the Parser.php file...
if (($settings_found) or ($settings_added)) {
$fp2 = fopen($file_name, \'w\');
while ($j <= $i) {
fwrite ($fp2, $arr[$j++]);
}
fclose ($fp2);
} else {
$this->add_row (\'Info: Parser.php was already modified for IpbWiki. Settings not reapplied.\');
}
// write ipbwiki_config.php file
$this->add_row (\"Writing ipbwiki_config.php configuration file...\");
$conf_string =
\"<?php\\n\" .
\"// IPB Wiki configuration settings\\n\" .
\"// http://www.ipbwiki.com\\n\" .
\"\\n\" .
\"/**\\n\" .
\" * The full qualified filesystem path to the folder of your IPB installation.\\n\" .
\" * You must add a trailing slash.\\n\" .
\" *\\n\" .
\" * Example path: /home/public_html/community/forums/\\n\" .
\" *\\n\" .
\" */\\n\" .
\" \\$ipb_root_path = \'\". $this->ipb_root_path . \"\';\\n\" .
\"\\n\" .
\"/**\\n\" .
\" * The url of your forum.\\n\" .
\" * You must add a trailing slash.\\n\" .
\" *\\n\" .
\" * Example path: http://www.yoursite.com/forums/\\n\" .
\" *\\n\" .
\" */\\n\" .
\" \\$ipb_forum_url = \'\". $this->ipb_forum_url . \"\';\\n\" .
\"\\n\" .
\" /* TIP: if you have your wiki and invision power board running on two different \\n\" .
\" * servers, you could try the following: \\n\" .
\" * (Note that I didn\'t test this, but in principle it should work, as long as you\'re able to authenticate to your database server from an external server that is...)\\n\" .
\" *\\n\" .
\" * on your Invision Power Board server:\\n\" .
\" * - download the file conf_global.php (located in the root of your forum directory)\\n\" .
\" * - download the file ips_kernel/class_db_mysql.php \\n\".
\" * (or if you use another database driver for your forum download the appropriate file ie ips_kernel/class_db_<your_db_driver>.php)\\n\" .
\" * - download the file sources/sql/mysql_queries.php \\n\" .
\" * (again if you use another database driver for your forum download the appropriate file) \\n\" .
\" * \\n\" .
\" * on your MediaWiki server:\\n\" .
\" * - create a directory forum\\n\".
\" * - create a directory forum/ips_kernel\\n\".
\" * - create a directory forum/sources/sql\\n\".
\" * - upload conf_global.php to the forum directory \\n\".
\" * - upload class_db_mysql.php to the forum/ips_kernel directory\\n\".
\" * - upload mysql_queries.php to the forum/sources/sql directory\\n\".
\" * - set the above setting (\\$ipb_root_path) to the forum directory you just created.\\n\".
\" * \\n\" .
\" * cross your fingers and run the wiki.\\n\".
\" *\\n\" .
\" */\\n\" .
\"\\n\" .
\"/**\\n\" .
\" * Character sets for forum and wiki\\n\".
\" */\\n\".
\" \\$wiki_charset = \'\". $this->wiki_charset . \"\';\\n\" .
\" \\$forum_charset = \'\". $this->forum_charset . \"\';\\n\" .
\"\\n\" .
\"?>\\n\";
if ( $fhandle = fopen( \'ipbwiki_config.php\', \'w\' ) )
{
fwrite($fhandle, $conf_string, strlen($conf_string) );
fclose($fhandle);
}
else
{
$this->print_top (\'Configuration Error.\');
$this->add_row (\'Fatal error, cannot write configuration file, try to chmod ipbwiki_config.php to 777!\');
$this->print_footer();
return;
}
if ($this->is_ipb == 1) {
// store wiki connection settings in forum db
$DB->query (\"DELETE FROM \".$ibf_prefix.\"ipbwiki_conf WHERE conf_id=\'wikiserver\' or conf_id=\'wikidb\' or conf_id=\'wikiuser\' or conf_id=\'wikipwd\' or conf_id=\'wikipf\' or conf_id=\'wikics\' or conf_id=\'forumcs\'\");
$wiki_server = $this->clean_value ($this->wgDBServer);
$wiki_user = $this->clean_value ($this->wgDBuser);
$wiki_pwd = $this->clean_value ($this->wgDBpassword);
$wiki_db = $this->clean_value ($this->wgDBname);
$wiki_prefix = $this->clean_value ($this->wgDBprefix);
$wiki_charset = $this->clean_value ($this->wiki_charset);
$forum_charset = $this->clean_value ($this->forum_charset);
$DB->query (\"INSERT INTO \".$ibf_prefix.\"ipbwiki_conf (conf_id,conf_value) VALUES (\'wikiserver\',\'\".$wiki_server.\"\')\");
$DB->query (\"INSERT INTO \".$ibf_prefix.\"ipbwiki_conf (conf_id,conf_value) VALUES (\'wikiuser\',\'\".$wiki_user.\"\')\");
$DB->query (\"INSERT INTO \".$ibf_prefix.\"ipbwiki_conf (conf_id,conf_value) VALUES (\'wikipwd\',\'\".$wiki_pwd.\"\')\");
$DB->query (\"INSERT INTO \".$ibf_prefix.\"ipbwiki_conf (conf_id,conf_value) VALUES (\'wikidb\',\'\".$wiki_db.\"\')\");
$DB->query (\"INSERT INTO \".$ibf_prefix.\"ipbwiki_conf (conf_id,conf_value) VALUES (\'wikipf\',\'\".$wiki_prefix.\"\')\");
$DB->query (\"INSERT INTO \".$ibf_prefix.\"ipbwiki_conf (conf_id,conf_value) VALUES (\'wikics\',\'\".$wiki_charset.\"\')\");
$DB->query (\"INSERT INTO \".$ibf_prefix.\"ipbwiki_conf (conf_id,conf_value) VALUES (\'forumcs\',\'\".$forum_charset.\"\')\");
// storing wiki path in invision power board configuration.
$this->add_row(\'store wiki path in invision power board database.\');
$DB->query (\"DELETE FROM \".$ibf_prefix.\"ipbwiki_conf WHERE conf_id=\'WikiPath\'\");
$wiki_path = $this->clean_value ($this->wgServer . $this->wgScriptPath);
$DB->query (\"INSERT INTO \".$ibf_prefix.\"ipbwiki_conf (conf_id,conf_value) VALUES (\'WikiPath\',\'\".$wiki_path.\"\')\");
if ($this->ipb30 == 0)
{
if (file_exists ($this->ipb_root_path . \'converge_local/converge.php\')) {
// set the wiki link in the board header correctly
$DB->query (\"UPDATE \".$ibf_prefix.\"components SET com_url_uri = \'\".$wiki_path.\"\' WHERE com_title=\'IpbWiki\'\");
// update the components cache
$components = array();
$DB->query ( \'select com_id,com_enabled,com_section,com_filename,com_url_uri,com_url_title,com_position from \'.$ibf_prefix.\'components where com_enabled=1 order by com_position ASC\');
while ( $r = $DB->fetch_row() )
{
$components[] = $r;
}
$value = serialize($components);
$value = str_replace (\"\'\",\"\'\'\",$value);
$DB->query (\'DELETE FROM \'.$ibf_prefix.\"cache_store WHERE cs_key=\'components\'\");
$DB->query (\'INSERT INTO \'.$ibf_prefix.\"cache_store (cs_key,cs_value,cs_extra,cs_array) VALUES (\'components\',\'\".$value.\"\',\'\',\'1\')\");
}
/* } else { */
}
$external_link = $this->clean_value ($this->wgServer . $this->wgStylePath . \'/\'. $this->wgDefaultSkin . \'/external.png\');
$DB->query (\"DELETE FROM \".$ibf_prefix.\"ipbwiki_conf WHERE conf_id=\'LinkImg\'\");
$DB->query (\"INSERT INTO \".$ibf_prefix.\"ipbwiki_conf (conf_id,conf_value) VALUES (\'LinkImg\',\'\".$external_link.\"\')\");
// IPB 2.1?
/* todo custom bbcode check */
/* if (($DB->field_exists( \'bbcode_id\', $ibf_prefix.\'custom_bbcode\') == 1) or ($DB->field_exists( \'bbcode_id\', \'custom_bbcode\') == 1)) {
// clear bbcode cache
$DB->query (\"DELETE FROM \".$ibf_prefix.\"cache_store WHERE cs_key=\'bbcode\'\");
// clear wiki tag
$DB->query (\"DELETE FROM \".$ibf_prefix.\"custom_bbcode WHERE bbcode_tag=\'wiki\'\");
$DB->query (\"SELECT MAX(bbcode_id) + 1 as bbcode_id FROM \" . $ibf_prefix . \"custom_bbcode\");
$row = $DB->fetch_row();
if (strtolower($INFO[\'sql_driver\']) === \'mssql\') {
$DB->query (\"SET IDENTITY_INSERT \". $ibf_prefix . \"custom_bbcode ON\");
}
$DB->query (\"INSERT INTO \". $ibf_prefix . \"custom_bbcode (bbcode_id,bbcode_title,bbcode_desc,bbcode_tag,bbcode_replace,bbcode_useoption, bbcode_example) VALUES (\" . $row[\'bbcode_id\'] . \", \'Wiki tag\', \'This tag links to the wiki.\', \'wiki\', \'<a href=\\\"\". $wiki_path . \"/index.php?title={content}\\\" style=\\\"background: url(\". $external_link . \") center right no-repeat; padding-right: 13px; border-bottom: 1px dotted #3366BB; color: #3366BB; cursor:pointer; text-decoration:none;\\\" class=\\\"wiki\\\">{content}</a>\', 0, \'[wiki]Main Page[/wiki]\')\");
if (strtolower($INFO[\'sql_driver\']) === \'mssql\') {
$DB->query (\"SET IDENTITY_INSERT \". $ibf_prefix . \"custom_bbcode OFF\");
}
} */
}
$this->add_row(\'\');
$this->add_row(\'\');
$this->add_row(\'<H3>Securing installation...</H3>\');
$this->add_row(\'\');
$this->add_row(\'Please chmod the following files to 644:\');
$print=\'\';
ob_start(); // catch the annoying chmod warnings...
if (!chmod (\"LocalSettings.php\", 0644)) {
$print=$print.\'<tr><td> - wiki/LocalSettings.php</td></tr>\';
}
if (!chmod (\"ipbwiki_config.php\", 0644)) {
$print=$print.\'<tr><td> - wiki/ipbwiki_config.php</td></tr>\';
}
if (!chmod (\"includes/Skin.php\", 0644)) {
$print=$print.\'<tr><td> - wiki/includes/skin.php</td></tr>\';
}
if (!chmod (\"includes/User.php\", 0644)) {
$print=$print.\'<tr><td> - wiki/includes/user.php</td></tr>\';
}
if (!chmod (\"includes/SkinTemplate.php\", 0644)) {
$print=$print.\'<tr><td> - wiki/includes/skintemplate.php</td></tr>\';
}
if (!chmod (\"includes/EditPage.php\", 0644)) {
$print=$print.\'<tr><td> - wiki/includes/EditPage.php</td></tr>\';
}
if (!chmod ($file_name, 0644)) {
$print=$print.\'<tr><td> - wiki/\'.$file_name.\'</td></tr>\';
}
ob_end_clean();
echo $print;
$this->add_row(\'Please <b>delete</b> the <b>ipbwiki_interface_setup.php</b> file in your wiki folder. (If you need to reinstall you can always upload it again later.)\');
$this->add_row(\'\');
$this->add_row(\'\');
$this->print_footer();
}
}
new ipbwiki_setup();
?>
[/code]
ipbwiki20.php:
[code]<?php
/*
+--------------------------------------------------------
| Package: IpbWiki Core
| Module: IpbWiki 2.0 Abstraction Layer
| Copyright (c) 2006-2011 Peter De Decker
| http://www.ipbwiki.com
+--------------------------------------------------------
*/
// this file shouldn\'t be called directly!
if( ! defined( \"IPBWIKI\" ) ) {
print \"<h1>Incorrect access</h1>You cannot access this file directly.\";
exit();
}
// Kernel Path, used to call the database abstraction layers...
if (!defined(\'KERNEL_PATH\')) {
define (\'KERNEL_PATH\', \'ips_kernel/\');
}
require_once (\'ipbwiki_commons_ipb.php\');
class ipbwiki20 extends ipbwiki_commons_ipb {
// Invision Power Board Variables
var $converge;
var $sql_driver;
var $sql_user;
var $sql_pass;
// Class Constructor
// initialisations, set up the db connection, etc...
function ipbwiki20() {
// read the database settings
require (\'conf_global.php\');
$this->connect_to_database($INFO);
// call the parent constructor
parent::ipbwiki_commons_ipb();
// variables for the post parser
// retrieve default skin set...
$sql = $this->retrieve_default_skin_sql();
$this->DB->query ($sql);
if ($row = $this->DB->fetch_row()) {
$this->img_url = $this->get_img_url($INFO,$row[\'set_image_dir\']);
$this->css_skin_filename = $INFO[\'board_url\'].\'/style_images/css_\'.$row[\'set_skin_set_id\'].\'.css\';
$this->skin_id = $row[\'set_skin_set_id\'];
$this->ipbwiki_monobook_skin_extra_css = \'\';>ipbwiki_monobook_skin_extra_css = $row[\'prerendered_css\'];>topmenu_left = $this->unclean_value($row[\'topmenulc\']);>topmenu_right = $this->unclean_value($row[\'topmenurc\']);>leftmenu = $this->unclean_value($row[\'leftmenuc\']);($this->enable_skin_integration) {($row[\'skin_type\']) {\'1\': // IpbWiki MediaWiki Style>default_skin_name = \'ipbwiki_skin_monobook\';\'2\': // IpbWiki MediaWiki Style Colored>default_skin_name = \'ipbwiki_skin_monobook\';>skin_colored = \'_colored\';\'3\': // IpbWiki Ipb Style>default_skin_name = \'ipbwiki_skin\';\'4\': // Custom Skin>default_skin_name = $row[\'custom_skin_name\'];>default_skin_name = \'\';
}>skin_logo = $this->get_logo($row[\'logo_picture\']);
} else {>default_skin_name = \'\';} (($this->topmenu_left == \'\') || ($this->topmenu_left === \"<div class=\'ipb-top-left-link\'></div>\")) { >DB->query (\"SELECT conf_value FROM \" . $this->ibf_prefix . \"ipbwiki_conf c WHERE conf_id =\'topmenulc\'\");>DB->fetch_row();>topmenu_left = $this->unclean_value($row[\'conf_value\']);}(($this->topmenu_right == \'\') || ($this->topmenu_right === \"<div class=\'ipb-top-right-link\'></div>\")) { >DB->query (\"SELECT conf_value FROM \" . $this->ibf_prefix . \"ipbwiki_conf c WHERE conf_id =\'topmenurc\'\");>DB->fetch_row();>topmenu_right = $this->unclean_value($row[\'conf_value\']);}(($this->leftmenu === \'\') || ($this->leftmenu === \'<ul><li></li></ul>\')) {>leftmenu = \'\';}(($this->ipbwiki_monobook_skin_extra_css) == \'\') { // in case we haven\'t prerendered it...>skin_retrieve_extra_css(); }}
// read some settings from the database...klzzwxh:10045// cookiesklzzwxh:10040klzzwxh:10046$this-klzzwxh:10044retrieveklzzwxh:10041cookiesklzzwxh:10042klzzwxh:10043;
// default languageklzzwxh:10052$this-klzzwxh:10051retrieveklzzwxh:10047defaultklzzwxh:10048languageklzzwxh:10049klzzwxh:10050;
// variables for the post parser...klzzwxh:10059$this-klzzwxh:10058retrieveklzzwxh:10053postklzzwxh:10054parserklzzwxh:10055variablesklzzwxh:10056klzzwxh:10057;
// converge...klzzwxh:10065$this-klzzwxh:10064setklzzwxh:10060upklzzwxh:10061convergeklzzwxh:10062klzzwxh:10063;
// finally some info from confklzzwxh:10066global.phpklzzwxh:10083$this-klzzwxh:10081sqlklzzwxh:10067user = $INFOklzzwxh:10068klzzwxh:10069sqlklzzwxh:10070userklzzwxh:10071klzzwxh:10072;klzzwxh:10084$this-klzzwxh:10082sqlklzzwxh:10073pass = $INFOklzzwxh:10074klzzwxh:10075sqlklzzwxh:10076passklzzwxh:10077klzzwxh:10078; klzzwxh:10080klzzwxh:10079
function getklzzwxh:10085imgklzzwxh:10086urlklzzwxh:10087$INFO,$imageklzzwxh:10088dirklzzwxh:10089klzzwxh:10102klzzwxh:10090klzzwxh:10103return $INFOklzzwxh:10091klzzwxh:10092boardklzzwxh:10093urlklzzwxh:10094klzzwxh:10095.klzzwxh:10096/styleklzzwxh:10097images/klzzwxh:10098.$imageklzzwxh:10099dir; klzzwxh:10101klzzwxh:10100
function getklzzwxh:10104logoklzzwxh:10105$logoklzzwxh:10106pictureklzzwxh:10107 klzzwxh:10120klzzwxh:10108klzzwxh:10121return klzzwxh:10109$logoklzzwxh:10110picture == klzzwxh:10111klzzwxh:10112 ? $this-klzzwxh:10119imgklzzwxh:10113url . klzzwxh:10114/logo4.gifklzzwxh:10115 : $logoklzzwxh:10116pictureklzzwxh:10117;klzzwxh:10122klzzwxh:10118
function connectklzzwxh:10123toklzzwxh:10124databaseklzzwxh:10125$INFOklzzwxh:10126klzzwxh:10289klzzwxh:10127klzzwxh:10290// instead of reinventing the wheel, letklzzwxh:10128s make use of the database-abstraction layer present in the Invision Power Board Classes...klzzwxh:10291$INFOklzzwxh:10129klzzwxh:10130sqlklzzwxh:10131driverklzzwxh:10132klzzwxh:10133 = klzzwxh:10134$INFOklzzwxh:10135klzzwxh:10136sqlklzzwxh:10137driverklzzwxh:10138klzzwxh:10139 ? klzzwxh:10140mysqlklzzwxh:10141 : $INFOklzzwxh:10142klzzwxh:10143sqlklzzwxh:10144driverklzzwxh:10145klzzwxh:10146;klzzwxh:10292require klzzwxh:10147 KERNELklzzwxh:10148PATH.klzzwxh:10149classklzzwxh:10150dbklzzwxh:10151klzzwxh:10152.strtolowerklzzwxh:10153$INFOklzzwxh:10154klzzwxh:10155sqlklzzwxh:10156driverklzzwxh:10157klzzwxh:10158klzzwxh:10159.klzzwxh:10160.phpklzzwxh:10161 klzzwxh:10162;klzzwxh:10293if klzzwxh:10163fileklzzwxh:10164existsklzzwxh:10165klzzwxh:10166convergeklzzwxh:10167local/converge.phpklzzwxh:10168klzzwxh:10169klzzwxh:10170 klzzwxh:10171 // IPB 2.2+klzzwxh:10294$classname = klzzwxh:10172dbklzzwxh:10173driverklzzwxh:10174klzzwxh:10175.$INFOklzzwxh:10176klzzwxh:10177sqlklzzwxh:10178driverklzzwxh:10179klzzwxh:10180;klzzwxh:10295$this-klzzwxh:10268DB = new $classname;klzzwxh:10296klzzwxh:10181 else klzzwxh:10182klzzwxh:10297$this-klzzwxh:10269DB = new dbklzzwxh:10183driver;klzzwxh:10298klzzwxh:10184klzzwxh:10299$this-klzzwxh:10270DB-klzzwxh:10271objklzzwxh:10185klzzwxh:10186sqlklzzwxh:10187databaseklzzwxh:10188klzzwxh:10189 = $INFOklzzwxh:10190klzzwxh:10191sqlklzzwxh:10192databaseklzzwxh:10193klzzwxh:10194;klzzwxh:10300$this-klzzwxh:10272DB-klzzwxh:10273objklzzwxh:10195klzzwxh:10196sqlklzzwxh:10197userklzzwxh:10198klzzwxh:10199 = $INFOklzzwxh:10200klzzwxh:10201sqlklzzwxh:10202userklzzwxh:10203klzzwxh:10204;klzzwxh:10301$this-klzzwxh:10274DB-klzzwxh:10275objklzzwxh:10205klzzwxh:10206sqlklzzwxh:10207passklzzwxh:10208klzzwxh:10209 = $INFOklzzwxh:10210klzzwxh:10211sqlklzzwxh:10212passklzzwxh:10213klzzwxh:10214;klzzwxh:10302$this-klzzwxh:10276DB-klzzwxh:10277objklzzwxh:10215klzzwxh:10216sqlklzzwxh:10217hostklzzwxh:10218klzzwxh:10219 = $INFOklzzwxh:10220klzzwxh:10221sqlklzzwxh:10222hostklzzwxh:10223klzzwxh:10224;klzzwxh:10303$this-klzzwxh:10278DB-klzzwxh:10279objklzzwxh:10225klzzwxh:10226sqlklzzwxh:10227tblklzzwxh:10228prefixklzzwxh:10229klzzwxh:10230 = $INFOklzzwxh:10231klzzwxh:10232sqlklzzwxh:10233tblklzzwxh:10234prefixklzzwxh:10235klzzwxh:10236;klzzwxh:10304$this-klzzwxh:10280DB-klzzwxh:10281objklzzwxh:10237klzzwxh:10238useklzzwxh:10239shutdownklzzwxh:10240klzzwxh:10241 = 0;klzzwxh:10305$this-klzzwxh:10282DB-klzzwxh:10283objklzzwxh:10242klzzwxh:10243queryklzzwxh:10244cacheklzzwxh:10245fileklzzwxh:10246klzzwxh:10247 = $this-klzzwxh:10284ipbklzzwxh:10248rootklzzwxh:10249path.klzzwxh:10250sources/sql/klzzwxh:10251.strtolowerklzzwxh:10252$INFOklzzwxh:10253klzzwxh:10254sqlklzzwxh:10255driverklzzwxh:10256klzzwxh:10257klzzwxh:10258.klzzwxh:10259klzzwxh:10260queries.phpklzzwxh:10261;klzzwxh:10306$this-klzzwxh:10285DB-klzzwxh:10286objklzzwxh:10262klzzwxh:10263debugklzzwxh:10264klzzwxh:10265 = 0;klzzwxh:10307$this-klzzwxh:10287DB-klzzwxh:10288connectklzzwxh:10266klzzwxh:10267;
// store the sql driver...klzzwxh:10318$this-klzzwxh:10317sqlklzzwxh:10308driver = strtolower klzzwxh:10309$INFOklzzwxh:10310klzzwxh:10311sqlklzzwxh:10312driverklzzwxh:10313klzzwxh:10314klzzwxh:10315;klzzwxh:10319klzzwxh:10316
function retrieveklzzwxh:10320defaultklzzwxh:10321skinklzzwxh:10322sqlklzzwxh:10323klzzwxh:10324klzzwxh:10353klzzwxh:10325klzzwxh:10354$sql = klzzwxh:10326SELECT ss.setklzzwxh:10327imageklzzwxh:10328dir, ss.setklzzwxh:10329skinklzzwxh:10330setklzzwxh:10331id, iws.skinklzzwxh:10332type, iws.customklzzwxh:10333skinklzzwxh:10334name, iws.logoklzzwxh:10335picture, iws.prerenderedklzzwxh:10336css, iws.topmenulc, iws.topmenurc, iws.leftmenucklzzwxh:10355FROM klzzwxh:10337.$this-klzzwxh:10351ibfklzzwxh:10338prefix.klzzwxh:10339skinklzzwxh:10340sets ssklzzwxh:10356LEFT JOIN klzzwxh:10341.$this-klzzwxh:10352ibfklzzwxh:10342prefix.klzzwxh:10343ipbwikiklzzwxh:10344skin iws klzzwxh:10357ON ss.setklzzwxh:10345skinklzzwxh:10346setklzzwxh:10347id = iws.skinklzzwxh:10348idklzzwxh:10358WHERE setklzzwxh:10349default = 1klzzwxh:10350;
return $sql; klzzwxh:10360klzzwxh:10359
function retrieveklzzwxh:10361cookiesklzzwxh:10362klzzwxh:10363klzzwxh:10486klzzwxh:10364klzzwxh:10487$this-klzzwxh:10460DB-klzzwxh:10461query klzzwxh:10365klzzwxh:10366SELECT confklzzwxh:10367value FROM klzzwxh:10368 . $this-klzzwxh:10462ibfklzzwxh:10369prefix . klzzwxh:10370confklzzwxh:10371settings c WHERE confklzzwxh:10372key =klzzwxh:10373cookieklzzwxh:10374domainklzzwxh:10375klzzwxh:10376klzzwxh:10377;klzzwxh:10488$row = $this-klzzwxh:10463DB-klzzwxh:10464fetchklzzwxh:10378rowklzzwxh:10379klzzwxh:10380;klzzwxh:10489$this-klzzwxh:10465cookieklzzwxh:10381domain = $rowklzzwxh:10382klzzwxh:10383confklzzwxh:10384valueklzzwxh:10385klzzwxh:10386;klzzwxh:10490$this-klzzwxh:10466DB-klzzwxh:10467query klzzwxh:10387klzzwxh:10388SELECT confklzzwxh:10389value FROM klzzwxh:10390 . $this-klzzwxh:10468ibfklzzwxh:10391prefix . klzzwxh:10392confklzzwxh:10393settings c WHERE confklzzwxh:10394key =klzzwxh:10395cookieklzzwxh:10396idklzzwxh:10397klzzwxh:10398klzzwxh:10399;klzzwxh:10491$row = $this-klzzwxh:10469DB-klzzwxh:10470fetchklzzwxh:10400rowklzzwxh:10401klzzwxh:10402;klzzwxh:10492$this-klzzwxh:10471cookieklzzwxh:10403id = $rowklzzwxh:10404klzzwxh:10405confklzzwxh:10406valueklzzwxh:10407klzzwxh:10408;klzzwxh:10493$this-klzzwxh:10472DB-klzzwxh:10473query klzzwxh:10409klzzwxh:10410SELECT confklzzwxh:10411value FROM klzzwxh:10412 . $this-klzzwxh:10474ibfklzzwxh:10413prefix . klzzwxh:10414confklzzwxh:10415settings c WHERE confklzzwxh:10416key =klzzwxh:10417cookieklzzwxh:10418pathklzzwxh:10419klzzwxh:10420klzzwxh:10421;klzzwxh:10494$row = $this-klzzwxh:10475DB-klzzwxh:10476fetchklzzwxh:10422rowklzzwxh:10423klzzwxh:10424;klzzwxh:10495$this-klzzwxh:10477cookieklzzwxh:10425path = $rowklzzwxh:10426klzzwxh:10427confklzzwxh:10428valueklzzwxh:10429klzzwxh:10430;klzzwxh:10496$this-klzzwxh:10478cookieklzzwxh:10431path == klzzwxh:10432klzzwxh:10433 ? klzzwxh:10434/klzzwxh:10435 : $this-klzzwxh:10479cookieklzzwxh:10436path;klzzwxh:10497$this-klzzwxh:10480DB-klzzwxh:10481query klzzwxh:10437klzzwxh:10438SELECT confklzzwxh:10439value FROM klzzwxh:10440 . $this-klzzwxh:10482ibfklzzwxh:10441prefix . klzzwxh:10442confklzzwxh:10443settings c WHERE confklzzwxh:10444key =klzzwxh:10445matchklzzwxh:10446browserklzzwxh:10447klzzwxh:10448klzzwxh:10449;klzzwxh:10498$row = $this-klzzwxh:10483DB-klzzwxh:10484fetchklzzwxh:10450rowklzzwxh:10451klzzwxh:10452;klzzwxh:10499$this-klzzwxh:10485matchklzzwxh:10453browser = $rowklzzwxh:10454klzzwxh:10455confklzzwxh:10456valueklzzwxh:10457klzzwxh:10458;klzzwxh:10500klzzwxh:10459
function retrieveklzzwxh:10501defaultklzzwxh:10502languageklzzwxh:10503klzzwxh:10504klzzwxh:10567klzzwxh:10505klzzwxh:10568// brrr... the default ipb query is a bit cumbersome, rewrite...klzzwxh:10506klzzwxh:10507klzzwxh:10508klzzwxh:10569$this-klzzwxh:10554DB-klzzwxh:10555query klzzwxh:10509klzzwxh:10510select klzzwxh:10511.$this-klzzwxh:10556ibfklzzwxh:10512prefix.klzzwxh:10513languages.ldir, countklzzwxh:10514klzzwxh:10515.$this-klzzwxh:10557ibfklzzwxh:10516prefix.klzzwxh:10517members.idklzzwxh:10518 as mcount from klzzwxh:10519.$this-klzzwxh:10558ibfklzzwxh:10520prefix.klzzwxh:10570klzzwxh:10521languages left join klzzwxh:10522.$this-klzzwxh:10559ibfklzzwxh:10523prefix.klzzwxh:10524members onklzzwxh:10525klzzwxh:10526.$this-klzzwxh:10560ibfklzzwxh:10527prefix.klzzwxh:10528members.language=klzzwxh:10529.$this-klzzwxh:10561ibfklzzwxh:10530prefix.klzzwxh:10531languages.ldirklzzwxh:10532 where klzzwxh:10533klzzwxh:10534.klzzwxh:10571$this-klzzwxh:10562ibfklzzwxh:10535prefix.klzzwxh:10536members.language is not null or klzzwxh:10537.$this-klzzwxh:10563ibfklzzwxh:10538prefix.klzzwxh:10539members.language = klzzwxh:10540enklzzwxh:10541klzzwxh:10542 group by klzzwxh:10543.klzzwxh:10572$this-klzzwxh:10564ibfklzzwxh:10544prefix.klzzwxh:10545languages.ldir,klzzwxh:10546.$this-klzzwxh:10565ibfklzzwxh:10547prefix.klzzwxh:10548languages.lname order by klzzwxh:10549.$this-klzzwxh:10566ibfklzzwxh:10550prefix.klzzwxh:10551languages.lnameklzzwxh:10552klzzwxh:10553;
$row = $this-klzzwxh:10590DB-klzzwxh:10591fetchklzzwxh:10573rowklzzwxh:10574klzzwxh:10575;klzzwxh:10594if klzzwxh:10576klzzwxh:10577 $this-klzzwxh:10592defaultklzzwxh:10578language = $rowklzzwxh:10579klzzwxh:10580ldirklzzwxh:10581klzzwxh:10582klzzwxh:10583 klzzwxh:10584klzzwxh:10595$this-klzzwxh:10593defaultklzzwxh:10585language = klzzwxh:10586enklzzwxh:10587;klzzwxh:10596klzzwxh:10588klzzwxh:10597klzzwxh:10589
function retrieveklzzwxh:10598postklzzwxh:10599parserklzzwxh:10600variablesklzzwxh:10601klzzwxh:10602klzzwxh:10791klzzwxh:10603klzzwxh:10792$this-klzzwxh:10760DB-klzzwxh:10761query klzzwxh:10604klzzwxh:10605SELECT confklzzwxh:10606value FROM klzzwxh:10607 . $this-klzzwxh:10762ibfklzzwxh:10608prefix . klzzwxh:10609confklzzwxh:10610settings c WHERE confklzzwxh:10611key =klzzwxh:10612allowklzzwxh:10613dynamicklzzwxh:10614imgklzzwxh:10615klzzwxh:10616klzzwxh:10617;klzzwxh:10793$row = $this-klzzwxh:10763DB-klzzwxh:10764fetchklzzwxh:10618rowklzzwxh:10619klzzwxh:10620;klzzwxh:10794$this-klzzwxh:10765allowklzzwxh:10621dynamicklzzwxh:10622img = $rowklzzwxh:10623klzzwxh:10624confklzzwxh:10625valueklzzwxh:10626klzzwxh:10627;klzzwxh:10795$this-klzzwxh:10766DB-klzzwxh:10767query klzzwxh:10628klzzwxh:10629SELECT confklzzwxh:10630value FROM klzzwxh:10631 . $this-klzzwxh:10768ibfklzzwxh:10632prefix . klzzwxh:10633confklzzwxh:10634settings c WHERE confklzzwxh:10635key =klzzwxh:10636allowklzzwxh:10637flashklzzwxh:10638klzzwxh:10639klzzwxh:10640;klzzwxh:10796$row = $this-klzzwxh:10769DB-klzzwxh:10770fetchklzzwxh:10641rowklzzwxh:10642klzzwxh:10643;klzzwxh:10797$this-klzzwxh:10771allowklzzwxh:10644flash = $rowklzzwxh:10645klzzwxh:10646confklzzwxh:10647valueklzzwxh:10648klzzwxh:10649;klzzwxh:10798$this-klzzwxh:10772DB-klzzwxh:10773query klzzwxh:10650klzzwxh:10651SELECT confklzzwxh:10652value,confklzzwxh:10653default FROM klzzwxh:10654 . $this-klzzwxh:10774ibfklzzwxh:10655prefix . klzzwxh:10656confklzzwxh:10657settings c WHERE confklzzwxh:10658key =klzzwxh:10659maxklzzwxh:10660wklzzwxh:10661flashklzzwxh:10662klzzwxh:10663klzzwxh:10664;klzzwxh:10799$row = $this-klzzwxh:10775DB-klzzwxh:10776fetchklzzwxh:10665rowklzzwxh:10666klzzwxh:10667;klzzwxh:10800$this-klzzwxh:10777maxklzzwxh:10668wklzzwxh:10669flash = klzzwxh:10670$rowklzzwxh:10671klzzwxh:10672confklzzwxh:10673valueklzzwxh:10674klzzwxh:10675 == klzzwxh:10676klzzwxh:10677? $rowklzzwxh:10678klzzwxh:10679confklzzwxh:10680defaultklzzwxh:10681klzzwxh:10682 : $rowklzzwxh:10683klzzwxh:10684confklzzwxh:10685valueklzzwxh:10686klzzwxh:10687klzzwxh:10688;klzzwxh:10801$this-klzzwxh:10778DB-klzzwxh:10779query klzzwxh:10689klzzwxh:10690SELECT confklzzwxh:10691value,confklzzwxh:10692default FROM klzzwxh:10693 . $this-klzzwxh:10780ibfklzzwxh:10694prefix . klzzwxh:10695confklzzwxh:10696settings c WHERE confklzzwxh:10697key =klzzwxh:10698maxklzzwxh:10699hklzzwxh:10700flashklzzwxh:10701klzzwxh:10702klzzwxh:10703;klzzwxh:10802$row = $this-klzzwxh:10781DB-klzzwxh:10782fetchklzzwxh:10704rowklzzwxh:10705klzzwxh:10706;klzzwxh:10803$this-klzzwxh:10783maxklzzwxh:10707hklzzwxh:10708flash = klzzwxh:10709$rowklzzwxh:10710klzzwxh:10711confklzzwxh:10712valueklzzwxh:10713klzzwxh:10714 == klzzwxh:10715klzzwxh:10716? $rowklzzwxh:10717klzzwxh:10718confklzzwxh:10719defaultklzzwxh:10720klzzwxh:10721 : $rowklzzwxh:10722klzzwxh:10723confklzzwxh:10724valueklzzwxh:10725klzzwxh:10726klzzwxh:10727;klzzwxh:10804$this-klzzwxh:10784DB-klzzwxh:10785query klzzwxh:10728klzzwxh:10729SELECT confklzzwxh:10730value FROM klzzwxh:10731 . $this-klzzwxh:10786ibfklzzwxh:10732prefix . klzzwxh:10733confklzzwxh:10734settings c WHERE confklzzwxh:10735key =klzzwxh:10736imgklzzwxh:10737extklzzwxh:10738klzzwxh:10739klzzwxh:10740;klzzwxh:10805$row = $this-klzzwxh:10787DB-klzzwxh:10788fetchklzzwxh:10741rowklzzwxh:10742klzzwxh:10743;klzzwxh:10806$this-klzzwxh:10789imgklzzwxh:10744ext = $rowklzzwxh:10745klzzwxh:10746confklzzwxh:10747valueklzzwxh:10748klzzwxh:10749;klzzwxh:10807$this-klzzwxh:10790emoticonsklzzwxh:10750url = $INFOklzzwxh:10751klzzwxh:10752boardklzzwxh:10753urlklzzwxh:10754klzzwxh:10755.klzzwxh:10756/styleklzzwxh:10757emoticons/defaultklzzwxh:10758;klzzwxh:10808klzzwxh:10759
function setklzzwxh:10809upklzzwxh:10810convergeklzzwxh:10811klzzwxh:10812klzzwxh:10827klzzwxh:10813klzzwxh:10828requireklzzwxh:10814onceklzzwxh:10815KERNELklzzwxh:10816PATH.klzzwxh:10817/classklzzwxh:10818converge.phpklzzwxh:10819klzzwxh:10820;klzzwxh:10829$this-klzzwxh:10825converge = new classklzzwxh:10821convergeklzzwxh:10822 $this-klzzwxh:10826DB klzzwxh:10823;klzzwxh:10830klzzwxh:10824
// ------------------------------------------------------------------------------klzzwxh:10831// following functions override the placeholder functions with actualklzzwxh:10832// implementationsklzzwxh:10833// ------------------------------------------------------------------------------
// retrieveklzzwxh:10834memberklzzwxh:10835recordklzzwxh:10861// expects a member record returned with at least the following fields:klzzwxh:10862// - nameklzzwxh:10863// - emailklzzwxh:10864// - convergeklzzwxh:10836passklzzwxh:10837hashklzzwxh:10865function retrieveklzzwxh:10838memberklzzwxh:10839record klzzwxh:10840$memberklzzwxh:10841nameklzzwxh:10842 klzzwxh:10843klzzwxh:10866$this-klzzwxh:10859applyklzzwxh:10844forumklzzwxh:10845charset klzzwxh:10846$memberklzzwxh:10847nameklzzwxh:10848;klzzwxh:10867return $this-klzzwxh:10860retrieveklzzwxh:10849memberklzzwxh:10850recordklzzwxh:10851forklzzwxh:10852authenticationklzzwxh:10853fromklzzwxh:10854nameklzzwxh:10855$memberklzzwxh:10856nameklzzwxh:10857;klzzwxh:10868klzzwxh:10858
function retrieveklzzwxh:10869memberklzzwxh:10870recordklzzwxh:10871forklzzwxh:10872authentication klzzwxh:10873$memberklzzwxh:10874idklzzwxh:10875 klzzwxh:10876klzzwxh:10917$this-klzzwxh:10910DB-klzzwxh:10911query klzzwxh:10877klzzwxh:10878SELECT m.id, m.name, m.mgroup, g.gklzzwxh:10879accessklzzwxh:10880cp, m.posts, m.email, m.memberklzzwxh:10881loginklzzwxh:10882key, mc.convergeklzzwxh:10883passklzzwxh:10884hash, mc.convergeklzzwxh:10885passklzzwxh:10886salt FROM klzzwxh:10887 . $this-klzzwxh:10912ibfklzzwxh:10888prefix . klzzwxh:10889members m JOIN klzzwxh:10890 . $this-klzzwxh:10913ibfklzzwxh:10891prefix . klzzwxh:10892membersklzzwxh:10893converge mc ON m.email = mc.convergeklzzwxh:10894email JOIN klzzwxh:10895 . $this-klzzwxh:10914ibfklzzwxh:10896prefix . klzzwxh:10897groups g ON g.gklzzwxh:10898id=m.mgroup WHERE m.id=klzzwxh:10899klzzwxh:10900 . $memberklzzwxh:10901id . klzzwxh:10902klzzwxh:10903klzzwxh:10904klzzwxh:10905;klzzwxh:10918return $this-klzzwxh:10915DB-klzzwxh:10916fetchklzzwxh:10906rowklzzwxh:10907klzzwxh:10908;klzzwxh:10919klzzwxh:10909
function retrieveklzzwxh:10920memberklzzwxh:10921recordklzzwxh:10922forklzzwxh:10923authenticationklzzwxh:10924fromklzzwxh:10925name klzzwxh:10926$memberklzzwxh:10927nameklzzwxh:10928 klzzwxh:10929klzzwxh:11008// ipbwiki orig $this-klzzwxh:10996DB-klzzwxh:10997query klzzwxh:10930klzzwxh:10931SELECT m.id, m.name, m.mgroup, g.gklzzwxh:10932accessklzzwxh:10933cp, m.posts, m.email, m.memberklzzwxh:10934loginklzzwxh:10935key, mc.convergeklzzwxh:10936passklzzwxh:10937hash, mc.convergeklzzwxh:10938passklzzwxh:10939salt FROM klzzwxh:10940 . $this-klzzwxh:10998ibfklzzwxh:10941prefix . klzzwxh:10942members m JOIN klzzwxh:10943 . $this-klzzwxh:10999ibfklzzwxh:10944prefix . klzzwxh:10945membersklzzwxh:10946converge mc ON m.email = mc.convergeklzzwxh:10947email JOIN klzzwxh:10948 . $this-klzzwxh:11000ibfklzzwxh:10949prefix . klzzwxh:10950groups g ON g.gklzzwxh:10951id=m.mgroup WHERE LOWERklzzwxh:10952m.nameklzzwxh:10953=LOWERklzzwxh:10954klzzwxh:10955klzzwxh:10956 . $memberklzzwxh:10957name . klzzwxh:10958klzzwxh:10959klzzwxh:10960klzzwxh:10961klzzwxh:10962;klzzwxh:11009$this-klzzwxh:11001DB-klzzwxh:11002query klzzwxh:10963klzzwxh:10964SELECT m.id, m.name, m.mgroup, g.gklzzwxh:10965accessklzzwxh:10966cp, m.posts, m.email, m.memberklzzwxh:10967loginklzzwxh:10968key, mc.convergeklzzwxh:10969passklzzwxh:10970hash, mc.convergeklzzwxh:10971passklzzwxh:10972salt FROM klzzwxh:10973 . $this-klzzwxh:11003ibfklzzwxh:10974prefix . klzzwxh:10975members m JOIN klzzwxh:10976 . $this-klzzwxh:11004ibfklzzwxh:10977prefix . klzzwxh:10978membersklzzwxh:10979converge mc ON m.email = mc.convergeklzzwxh:10980email JOIN klzzwxh:10981 . $this-klzzwxh:11005ibfklzzwxh:10982prefix . klzzwxh:10983groups g ON g.gklzzwxh:10984id=m.mgroup WHERE m.name=klzzwxh:10985klzzwxh:10986 . $memberklzzwxh:10987name . klzzwxh:10988klzzwxh:10989klzzwxh:10990klzzwxh:10991;klzzwxh:11010return $this-klzzwxh:11006DB-klzzwxh:11007fetchklzzwxh:10992rowklzzwxh:10993klzzwxh:10994;klzzwxh:11011klzzwxh:10995
function validateklzzwxh:11012password klzzwxh:11013$member, $passwordklzzwxh:11014 klzzwxh:11015klzzwxh:11037return klzzwxh:11016 $memberklzzwxh:11017klzzwxh:11018convergeklzzwxh:11019passklzzwxh:11020hashklzzwxh:11021klzzwxh:11022 == md5 klzzwxh:11023 md5klzzwxh:11024$memberklzzwxh:11025klzzwxh:11026convergeklzzwxh:11027passklzzwxh:11028saltklzzwxh:11029klzzwxh:11030klzzwxh:11031 . md5klzzwxh:11032$passwordklzzwxh:11033klzzwxh:11034 klzzwxh:11035;klzzwxh:11038klzzwxh:11036
function retrieveklzzwxh:11039emoticons klzzwxh:11040klzzwxh:11041 klzzwxh:11042klzzwxh:11089// only process the default emoticon set, when we ever get to implementing the skins, then change thisklzzwxh:11043klzzwxh:11090if klzzwxh:11044strcasecmpklzzwxh:11045$this-klzzwxh:11082sqlklzzwxh:11046driver,klzzwxh:11047mssqlklzzwxh:11048klzzwxh:11049 == 0klzzwxh:11050 klzzwxh:11051klzzwxh:11091$this-klzzwxh:11083DB-klzzwxh:11084query klzzwxh:11052klzzwxh:11053SELECT typed,image,emoklzzwxh:11054set FROM klzzwxh:11055.$this-klzzwxh:11085ibfklzzwxh:11056prefix.klzzwxh:11057emoticons WHERE emoklzzwxh:11058set=klzzwxh:11059defaultklzzwxh:11060 ORDER BY LENklzzwxh:11061typedklzzwxh:11062 DESCklzzwxh:11063klzzwxh:11064;klzzwxh:11092klzzwxh:11065 else klzzwxh:11066klzzwxh:11093$this-klzzwxh:11086DB-klzzwxh:11087query klzzwxh:11067klzzwxh:11068SELECT typed,image,emoklzzwxh:11069set FROM klzzwxh:11070.$this-klzzwxh:11088ibfklzzwxh:11071prefix.klzzwxh:11072emoticons WHERE emoklzzwxh:11073set=klzzwxh:11074defaultklzzwxh:11075 ORDER BY LENGTHklzzwxh:11076typedklzzwxh:11077 DESCklzzwxh:11078klzzwxh:11079;klzzwxh:11094klzzwxh:11080klzzwxh:11095klzzwxh:11081
function updateklzzwxh:11096emailklzzwxh:11097linkedklzzwxh:11098tables klzzwxh:11099$member, $emailklzzwxh:11100 klzzwxh:11101klzzwxh:11128$this-klzzwxh:11125DB-klzzwxh:11126queryklzzwxh:11102klzzwxh:11103UPDATE klzzwxh:11104.$this-klzzwxh:11127ibfklzzwxh:11105prefix.klzzwxh:11106membersklzzwxh:11107converge SET convergeklzzwxh:11108email=klzzwxh:11109klzzwxh:11110.$email.klzzwxh:11111klzzwxh:11112 WHERE convergeklzzwxh:11113email=klzzwxh:11114klzzwxh:11115.$memberklzzwxh:11116klzzwxh:11117emailklzzwxh:11118klzzwxh:11119.klzzwxh:11120klzzwxh:11121klzzwxh:11122klzzwxh:11123;klzzwxh:11129klzzwxh:11124
function getklzzwxh:11130sessionklzzwxh:11131id klzzwxh:11132$memberklzzwxh:11133id, $passklzzwxh:11134hashklzzwxh:11135 klzzwxh:11136klzzwxh:11182// Weklzzwxh:11137re not requiring to have the same ip-address as we must allow people who are on a non-static ip-address to log in on a next occasion.klzzwxh:11183$this-klzzwxh:11175DB-klzzwxh:11176query klzzwxh:11138klzzwxh:11139SELECT s.id FROM klzzwxh:11140.$this-klzzwxh:11177ibfklzzwxh:11141prefix.klzzwxh:11142members m JOIN klzzwxh:11143.$this-klzzwxh:11178ibfklzzwxh:11144prefix.klzzwxh:11145sessions s ON s.memberklzzwxh:11146id=m.id WHERE m.memberklzzwxh:11147loginklzzwxh:11148key=klzzwxh:11149klzzwxh:11150.$passklzzwxh:11151hash.klzzwxh:11152klzzwxh:11153 AND m.id=klzzwxh:11154.$memberklzzwxh:11155id /klzzwxh:11156.klzzwxh:11157 AND s.ipklzzwxh:11158address=klzzwxh:11159klzzwxh:11160.$this-klzzwxh:11179ipklzzwxh:11161address.klzzwxh:11162klzzwxh:11163klzzwxh:11164klzzwxh:11165/ klzzwxh:11166;klzzwxh:11184$row = $this-klzzwxh:11180DB-klzzwxh:11181fetchklzzwxh:11167rowklzzwxh:11168klzzwxh:11169;klzzwxh:11185return $rowklzzwxh:11170klzzwxh:11171idklzzwxh:11172klzzwxh:11173;klzzwxh:11186klzzwxh:11174
// ------------------------------------------------------------------------------klzzwxh:11188// following functions are the core of IpbWiki, here we have interaction withklzzwxh:11189// Invision Power Boardklzzwxh:11187klzzwxh:11190// ------------------------------------------------------------------------------
// canAddUserklzzwxh:11196// checks if the username-password combo is allowable...klzzwxh:11197function canAddUser klzzwxh:11191$username, $passwordklzzwxh:11192 klzzwxh:11193klzzwxh:11198$ok = parent::canAddUser klzzwxh:11194$username, $passwordklzzwxh:11195;
if klzzwxh:11199$ok == TRUEklzzwxh:11200 klzzwxh:11201klzzwxh:11264// Non Registerable name?klzzwxh:11265$username = $this-klzzwxh:11255cleanklzzwxh:11202valueklzzwxh:11203$usernameklzzwxh:11204;klzzwxh:11266// ipbwiki orig $this-klzzwxh:11256DB-klzzwxh:11257query klzzwxh:11205klzzwxh:11206SELECT klzzwxh:11207 FROM klzzwxh:11208.$this-klzzwxh:11258ibfklzzwxh:11209prefix.klzzwxh:11210banfilters WHERE banklzzwxh:11211type=klzzwxh:11212nameklzzwxh:11213 AND LOWERklzzwxh:11214banklzzwxh:11215contentklzzwxh:11216=LOWERklzzwxh:11217klzzwxh:11218klzzwxh:11219. $username . klzzwxh:11220klzzwxh:11221klzzwxh:11222klzzwxh:11223klzzwxh:11224;klzzwxh:11267$this-klzzwxh:11259DB-klzzwxh:11260query klzzwxh:11225klzzwxh:11226SELECT klzzwxh:11227 FROM klzzwxh:11228.$this-klzzwxh:11261ibfklzzwxh:11229prefix.klzzwxh:11230banfilters WHERE banklzzwxh:11231type=klzzwxh:11232nameklzzwxh:11233 AND banklzzwxh:11234content=klzzwxh:11235klzzwxh:11236. $username . klzzwxh:11237klzzwxh:11238klzzwxh:11239klzzwxh:11240;klzzwxh:11268if klzzwxh:11241$this-klzzwxh:11262DB-klzzwxh:11263getklzzwxh:11242numklzzwxh:11243rowsklzzwxh:11244klzzwxh:11245klzzwxh:11246 klzzwxh:11247klzzwxh:11269printklzzwxh:11248r klzzwxh:11249klzzwxh:11250username already taken, please choose another name...klzzwxh:11251klzzwxh:11252;klzzwxh:11270return FALSE;klzzwxh:11271klzzwxh:11253klzzwxh:11272klzzwxh:11254
return $ok;klzzwxh:11274klzzwxh:11273
function checkklzzwxh:11275ifklzzwxh:11276emailklzzwxh:11277addressklzzwxh:11278existsklzzwxh:11279sql klzzwxh:11280$emailklzzwxh:11281klzzwxh:11297klzzwxh:11282klzzwxh:11298return klzzwxh:11283SELECT klzzwxh:11284 FROM klzzwxh:11285. $this-klzzwxh:11296ibfklzzwxh:11286prefix . klzzwxh:11287membersklzzwxh:11288converge WHERE convergeklzzwxh:11289email = klzzwxh:11290klzzwxh:11291 . $email . klzzwxh:11292klzzwxh:11293klzzwxh:11294;klzzwxh:11299klzzwxh:11295
function generateklzzwxh:11300fakeklzzwxh:11301email klzzwxh:11302klzzwxh:11303klzzwxh:11336klzzwxh:11304klzzwxh:11337$this-klzzwxh:11331DB-klzzwxh:11332query klzzwxh:11305klzzwxh:11306SELECT MAXklzzwxh:11307convergeklzzwxh:11308idklzzwxh:11309 as maxklzzwxh:11310id FROM klzzwxh:11311. $this-klzzwxh:11333ibfklzzwxh:11312prefix . klzzwxh:11313membersklzzwxh:11314convergeklzzwxh:11315klzzwxh:11316;klzzwxh:11338$row = $this-klzzwxh:11334DB-klzzwxh:11335fetchklzzwxh:11317rowklzzwxh:11318klzzwxh:11319;klzzwxh:11339$id = $rowklzzwxh:11320klzzwxh:11321maxklzzwxh:11322idklzzwxh:11323klzzwxh:11324;klzzwxh:11340$id++;klzzwxh:11341$email = $id . klzzwxh:11325@fakeklzzwxh:11326ipbwikiklzzwxh:11327email.comklzzwxh:11328;klzzwxh:11342return $email; klzzwxh:11330klzzwxh:11329
function generateklzzwxh:11343autoklzzwxh:11344loginklzzwxh:11345keyklzzwxh:11346klzzwxh:11347klzzwxh:11358klzzwxh:11348klzzwxh:11359return $this-klzzwxh:11356converge-klzzwxh:11357generateklzzwxh:11349autoklzzwxh:11350logklzzwxh:11351inklzzwxh:11352keyklzzwxh:11353klzzwxh:11354;klzzwxh:11360klzzwxh:11355
function generateklzzwxh:11361passwordklzzwxh:11362saltklzzwxh:11363$len=60klzzwxh:11364klzzwxh:11374klzzwxh:11365klzzwxh:11375return $this-klzzwxh:11372converge-klzzwxh:11373generateklzzwxh:11366passwordklzzwxh:11367saltklzzwxh:11368$lenklzzwxh:11369; klzzwxh:11371klzzwxh:11370
function generateklzzwxh:11376compiledklzzwxh:11377passhashklzzwxh:11378$convergeklzzwxh:11379passklzzwxh:11380salt,$passwordklzzwxh:11381klzzwxh:11394klzzwxh:11382klzzwxh:11395return $this-klzzwxh:11392converge-klzzwxh:11393generateklzzwxh:11383compiledklzzwxh:11384passhashklzzwxh:11385 $convergeklzzwxh:11386passklzzwxh:11387salt, md5klzzwxh:11388$passwordklzzwxh:11389 klzzwxh:11390;klzzwxh:11396klzzwxh:11391
function createklzzwxh:11397userklzzwxh:11398insertklzzwxh:11399intoklzzwxh:11400db klzzwxh:11401$username,$password,$emailklzzwxh:11402klzzwxh:11506klzzwxh:11403klzzwxh:11507$member = arrayklzzwxh:11404klzzwxh:11508klzzwxh:11405nameklzzwxh:11406 =klzzwxh:11480 $username,klzzwxh:11509klzzwxh:11407memberklzzwxh:11408loginklzzwxh:11409keyklzzwxh:11410 =klzzwxh:11481 $this-klzzwxh:11482generateklzzwxh:11411autoklzzwxh:11412loginklzzwxh:11413keyklzzwxh:11414klzzwxh:11415,klzzwxh:11510klzzwxh:11416emailklzzwxh:11417 =klzzwxh:11483 $email,klzzwxh:11511klzzwxh:11418mgroupklzzwxh:11419 =klzzwxh:11484 $this-klzzwxh:11485memberklzzwxh:11420group,klzzwxh:11512klzzwxh:11421postsklzzwxh:11422 =klzzwxh:11486 0,klzzwxh:11513klzzwxh:11423joinedklzzwxh:11424 =klzzwxh:11487 timeklzzwxh:11425klzzwxh:11426,klzzwxh:11514klzzwxh:11427ipklzzwxh:11428addressklzzwxh:11429 =klzzwxh:11488 $this-klzzwxh:11489ipklzzwxh:11430address,klzzwxh:11515klzzwxh:11431timeklzzwxh:11432offsetklzzwxh:11433 =klzzwxh:11490 0,klzzwxh:11516klzzwxh:11434viewklzzwxh:11435sigsklzzwxh:11436 =klzzwxh:11491 1,klzzwxh:11517klzzwxh:11437emailklzzwxh:11438pmklzzwxh:11439 =klzzwxh:11492 1,klzzwxh:11518klzzwxh:11440viewklzzwxh:11441imgklzzwxh:11442 =klzzwxh:11493 1,klzzwxh:11519klzzwxh:11443viewklzzwxh:11444avsklzzwxh:11445 =klzzwxh:11494 1,klzzwxh:11520klzzwxh:11446restrictklzzwxh:11447postklzzwxh:11448 =klzzwxh:11495 0,klzzwxh:11521klzzwxh:11449viewklzzwxh:11450popklzzwxh:11451 =klzzwxh:11496 1,klzzwxh:11522klzzwxh:11452msgklzzwxh:11453totalklzzwxh:11454 =klzzwxh:11497 0,klzzwxh:11523klzzwxh:11455newklzzwxh:11456msgklzzwxh:11457 =klzzwxh:11498 0,klzzwxh:11524klzzwxh:11458coppaklzzwxh:11459userklzzwxh:11460 =klzzwxh:11499 0,klzzwxh:11525klzzwxh:11461languageklzzwxh:11462 =klzzwxh:11500 $this-klzzwxh:11501defaultklzzwxh:11463language,klzzwxh:11526klzzwxh:11464dstklzzwxh:11465inklzzwxh:11466useklzzwxh:11467 =klzzwxh:11502 0,klzzwxh:11527klzzwxh:11468allowklzzwxh:11469adminklzzwxh:11470mailsklzzwxh:11471=klzzwxh:11503 1,klzzwxh:11528klzzwxh:11472hideklzzwxh:11473emailklzzwxh:11474 =klzzwxh:11504 0,klzzwxh:11529klzzwxh:11475subsklzzwxh:11476pkgklzzwxh:11477chosenklzzwxh:11478 =klzzwxh:11505 0klzzwxh:11530klzzwxh:11479;
$convergeklzzwxh:11531passklzzwxh:11532salt = $this-klzzwxh:11545generateklzzwxh:11533passwordklzzwxh:11534saltklzzwxh:115355klzzwxh:11536;klzzwxh:11547$convergeklzzwxh:11537passklzzwxh:11538hash = $this-klzzwxh:11546generateklzzwxh:11539compiledklzzwxh:11540passhashklzzwxh:11541 $convergeklzzwxh:11542passklzzwxh:11543salt, $password klzzwxh:11544;
$converge = arrayklzzwxh:11548 klzzwxh:11549convergeklzzwxh:11550emailklzzwxh:11551 =klzzwxh:11589 $email,klzzwxh:11593klzzwxh:11552convergeklzzwxh:11553joinedklzzwxh:11554 =klzzwxh:11590 timeklzzwxh:11555klzzwxh:11556,klzzwxh:11594klzzwxh:11557convergeklzzwxh:11558passklzzwxh:11559hashklzzwxh:11560 =klzzwxh:11591 $convergeklzzwxh:11561passklzzwxh:11562hash,klzzwxh:11595klzzwxh:11563convergeklzzwxh:11564passklzzwxh:11565saltklzzwxh:11566 =klzzwxh:11592 strklzzwxh:11567replaceklzzwxh:11568 klzzwxh:11569klzzwxh:11570klzzwxh:11571klzzwxh:11572klzzwxh:11573klzzwxh:11574, klzzwxh:11575klzzwxh:11576klzzwxh:11577klzzwxh:11578klzzwxh:11579klzzwxh:11580klzzwxh:11581klzzwxh:11582klzzwxh:11583klzzwxh:11584, $convergeklzzwxh:11585passklzzwxh:11586salt klzzwxh:11587klzzwxh:11596klzzwxh:11588;
// Insert: CONVERGEklzzwxh:11605$this-klzzwxh:11603DB-klzzwxh:11604doklzzwxh:11597insertklzzwxh:11598 klzzwxh:11599membersklzzwxh:11600convergeklzzwxh:11601, $converge klzzwxh:11602;
// Get converges autoklzzwxh:11606increment userklzzwxh:11607idklzzwxh:11620$memberklzzwxh:11608id = $this-klzzwxh:11618DB-klzzwxh:11619getklzzwxh:11609insertklzzwxh:11610idklzzwxh:11611klzzwxh:11612;klzzwxh:11621$memberklzzwxh:11613klzzwxh:11614idklzzwxh:11615klzzwxh:11616 = $memberklzzwxh:11617id;
// Insert: MEMBERklzzwxh:11629$this-klzzwxh:11627DB-klzzwxh:11628doklzzwxh:11622insertklzzwxh:11623 klzzwxh:11624membersklzzwxh:11625, $member klzzwxh:11626;
// Insert: MEMBER EXTRAklzzwxh:11650$this-klzzwxh:11646DB-klzzwxh:11647doklzzwxh:11630insertklzzwxh:11631 klzzwxh:11632memberklzzwxh:11633extraklzzwxh:11634, arrayklzzwxh:11635 klzzwxh:11636idklzzwxh:11637 =klzzwxh:11648 $memberklzzwxh:11638id, klzzwxh:11639vdirsklzzwxh:11640 =klzzwxh:11649 klzzwxh:11641in:Inbox|sent:Sent Itemsklzzwxh:11642 klzzwxh:11643 klzzwxh:11644;klzzwxh:11651klzzwxh:11645
// createklzzwxh:11652userklzzwxh:11659// creates a new user in the IPB databaseklzzwxh:11660function createklzzwxh:11653user klzzwxh:11654$username, $password, $emailklzzwxh:11655 klzzwxh:11656klzzwxh:11661// store unclean values, so that we can reuse the regular authenticationklzzwxh:11662$origklzzwxh:11657username = $username;klzzwxh:11663$origklzzwxh:11658password = $password;
// Clean Usernameklzzwxh:11781$this-klzzwxh:11763usernameklzzwxh:11664replaceklzzwxh:11665specialklzzwxh:11666charactersklzzwxh:11667forklzzwxh:11668forumklzzwxh:11669$usernameklzzwxh:11670;klzzwxh:11782$username = $this-klzzwxh:11764txtklzzwxh:11671stripslashesklzzwxh:11672$usernameklzzwxh:11673;klzzwxh:11783$username = pregklzzwxh:11674replaceklzzwxh:11675klzzwxh:11676/&klzzwxh:11677klzzwxh:11678klzzwxh:116790-9klzzwxh:11680+klzzwxh:11681;/klzzwxh:11682, klzzwxh:11683-klzzwxh:11684, $usernameklzzwxh:11685;klzzwxh:11784$username = $this-klzzwxh:11765cleanklzzwxh:11686valueklzzwxh:11687$usernameklzzwxh:11688;klzzwxh:11785$this-klzzwxh:11766applyklzzwxh:11689forumklzzwxh:11690charset klzzwxh:11691$usernameklzzwxh:11692;klzzwxh:11786$username = $this-klzzwxh:11767ucfirstklzzwxh:11693$username, $this-klzzwxh:11768forumklzzwxh:11694charsetklzzwxh:11695;klzzwxh:11787// Clean Passwordklzzwxh:11788$password = $this-klzzwxh:11769txtklzzwxh:11696stripslashesklzzwxh:11697$passwordklzzwxh:11698;klzzwxh:11789$password = pregklzzwxh:11699replaceklzzwxh:11700klzzwxh:11701/&klzzwxh:11702klzzwxh:11703klzzwxh:117040-9klzzwxh:11705+klzzwxh:11706;/klzzwxh:11707, klzzwxh:11708-klzzwxh:11709, $passwordklzzwxh:11710;klzzwxh:11790$password = $this-klzzwxh:11770cleanklzzwxh:11711valueklzzwxh:11712$passwordklzzwxh:11713;klzzwxh:11791$this-klzzwxh:11771applyklzzwxh:11714forumklzzwxh:11715charset klzzwxh:11716$passwordklzzwxh:11717;klzzwxh:11792// Clean emailklzzwxh:11793$this-klzzwxh:11772applyklzzwxh:11718forumklzzwxh:11719charset klzzwxh:11720$emailklzzwxh:11721;klzzwxh:11794$email = $this-klzzwxh:11773cleanklzzwxh:11722emailklzzwxh:11723$emailklzzwxh:11724;klzzwxh:11795if klzzwxh:11725$email == klzzwxh:11726klzzwxh:11727klzzwxh:11728 klzzwxh:11729klzzwxh:11796$email = $this-klzzwxh:11774generateklzzwxh:11730fakeklzzwxh:11731emailklzzwxh:11732klzzwxh:11733;klzzwxh:11797klzzwxh:11734klzzwxh:11798$sql = $this-klzzwxh:11775checkklzzwxh:11735ifklzzwxh:11736emailklzzwxh:11737addressklzzwxh:11738existsklzzwxh:11739sqlklzzwxh:11740$emailklzzwxh:11741;klzzwxh:11799$this-klzzwxh:11776DB-klzzwxh:11777query klzzwxh:11742$sqlklzzwxh:11743; // check if the email address is already used...klzzwxh:11800if klzzwxh:11744$this-klzzwxh:11778DB-klzzwxh:11779getklzzwxh:11745numklzzwxh:11746rowsklzzwxh:11747klzzwxh:11748klzzwxh:11749 klzzwxh:11750klzzwxh:11801printklzzwxh:11751r klzzwxh:11752klzzwxh:11753email address already connected to another email address, wiki user not synchronized to forum database.klzzwxh:11754klzzwxh:11755;klzzwxh:11802return FALSE;klzzwxh:11803klzzwxh:11756klzzwxh:11804$this-klzzwxh:11780createklzzwxh:11757userklzzwxh:11758insertklzzwxh:11759intoklzzwxh:11760dbklzzwxh:11761$username,$password,$emailklzzwxh:11762;
// letklzzwxh:11805s immediately log in this user as well on the forumklzzwxh:11806klzzwxh:11814return $this-klzzwxh:11813authenticateklzzwxh:11807user klzzwxh:11808$origklzzwxh:11809username, $origklzzwxh:11810passwordklzzwxh:11811;klzzwxh:11815klzzwxh:11812
function getklzzwxh:11816displayklzzwxh:11817nameklzzwxh:11818sql klzzwxh:11819$nameklzzwxh:11820 klzzwxh:11846klzzwxh:11821klzzwxh:11847$this-klzzwxh:11841DB-klzzwxh:11842query klzzwxh:11822klzzwxh:11823SELECT m.id, m.name, m.membersklzzwxh:11824displayklzzwxh:11825name as displayklzzwxh:11826name FROM klzzwxh:11827 . $this-klzzwxh:11843ibfklzzwxh:11828prefix . klzzwxh:11829members m WHERE m.name=klzzwxh:11830klzzwxh:11831 . $name . klzzwxh:11832klzzwxh:11833klzzwxh:11834klzzwxh:11835;klzzwxh:11848$member = $this-klzzwxh:11844DB-klzzwxh:11845fetchklzzwxh:11836rowklzzwxh:11837klzzwxh:11838;klzzwxh:11849return $member; klzzwxh:11840klzzwxh:11839
function getklzzwxh:11850displayklzzwxh:11851name klzzwxh:11852$nameklzzwxh:11853 klzzwxh:11854klzzwxh:11894$saveklzzwxh:11855name = $name;klzzwxh:11895$this-klzzwxh:11888usernameklzzwxh:11856replaceklzzwxh:11857specialklzzwxh:11858charactersklzzwxh:11859forklzzwxh:11860forumklzzwxh:11861$nameklzzwxh:11862;klzzwxh:11896$name = $this-klzzwxh:11889txtklzzwxh:11863stripslashesklzzwxh:11864$nameklzzwxh:11865;klzzwxh:11897$name = pregklzzwxh:11866replaceklzzwxh:11867klzzwxh:11868/&klzzwxh:11869klzzwxh:11870klzzwxh:118710-9klzzwxh:11872+klzzwxh:11873;/klzzwxh:11874, klzzwxh:11875-klzzwxh:11876, $nameklzzwxh:11877;klzzwxh:11898$name = $this-klzzwxh:11890cleanklzzwxh:11878valueklzzwxh:11879$nameklzzwxh:11880;klzzwxh:11899$this-klzzwxh:11891applyklzzwxh:11881forumklzzwxh:11882charset klzzwxh:11883$nameklzzwxh:11884;klzzwxh:11900$name = $this-klzzwxh:11892ucfirstklzzwxh:11885$name, $this-klzzwxh:11893forumklzzwxh:11886charsetklzzwxh:11887;
$member = $this-klzzwxh:11922getklzzwxh:11901displayklzzwxh:11902nameklzzwxh:11903sql klzzwxh:11904$nameklzzwxh:11905;klzzwxh:11924if klzzwxh:11906$memberklzzwxh:11907 klzzwxh:11908klzzwxh:11925$name = $memberklzzwxh:11909klzzwxh:11910nameklzzwxh:11911klzzwxh:11912;klzzwxh:11926$this-klzzwxh:11923applyklzzwxh:11913wikiklzzwxh:11914charset klzzwxh:11915$nameklzzwxh:11916;klzzwxh:11927return $name;klzzwxh:11928klzzwxh:11917 else klzzwxh:11918klzzwxh:11929return $saveklzzwxh:11919name;klzzwxh:11930klzzwxh:11920klzzwxh:11931klzzwxh:11921
// retrieveklzzwxh:11932md5klzzwxh:11933passwordklzzwxh:11968// retrieves important member info in an array...klzzwxh:11969// not used anymore???klzzwxh:11970function retrieveklzzwxh:11934md5klzzwxh:11935password klzzwxh:11936$usernameklzzwxh:11937 klzzwxh:11938klzzwxh:11971$this-klzzwxh:11962DB-klzzwxh:11963query klzzwxh:11939klzzwxh:11940SELECT m.id, m.name, m.mgroup, m.posts, m.email, mc.convergeklzzwxh:11941passklzzwxh:11942hash as md5klzzwxh:11943password FROM klzzwxh:11944 . $this-klzzwxh:11964ibfklzzwxh:11945prefix . klzzwxh:11946members m JOIN klzzwxh:11947 . $this-klzzwxh:11965ibfklzzwxh:11948prefix . klzzwxh:11949membersklzzwxh:11950converge mc ON m.email = mc.convergeklzzwxh:11951email WHERE m.name=klzzwxh:11952klzzwxh:11953 . $username . klzzwxh:11954klzzwxh:11955klzzwxh:11956klzzwxh:11957;klzzwxh:11972$member = $this-klzzwxh:11966DB-klzzwxh:11967fetchklzzwxh:11958rowklzzwxh:11959klzzwxh:11960;klzzwxh:11973return $member;klzzwxh:11974klzzwxh:11961
function setPasswordklzzwxh:11975getklzzwxh:11976userklzzwxh:11977sql klzzwxh:11978$usernameklzzwxh:11979 klzzwxh:12005klzzwxh:11980klzzwxh:12006return klzzwxh:11981SELECT m.id, m.name, m.mgroup, m.memberklzzwxh:11982loginklzzwxh:11983key, mc.convergeklzzwxh:11984passklzzwxh:11985hash, mc.convergeklzzwxh:11986passklzzwxh:11987salt FROM klzzwxh:11988 . $this-klzzwxh:12003ibfklzzwxh:11989prefix . klzzwxh:11990members m JOIN klzzwxh:11991 . $this-klzzwxh:12004ibfklzzwxh:11992prefix . klzzwxh:11993membersklzzwxh:11994converge mc ON m.email = mc.convergeklzzwxh:11995email WHERE m.name=klzzwxh:11996klzzwxh:11997 . $username . klzzwxh:11998klzzwxh:11999klzzwxh:12000; klzzwxh:12002klzzwxh:12001
function updateklzzwxh:12007hashklzzwxh:12008andklzzwxh:12009key klzzwxh:12010$convergeklzzwxh:12011passklzzwxh:12012hash,$convergeklzzwxh:12013passklzzwxh:12014salt,$memberklzzwxh:12015loginklzzwxh:12016key,$memberklzzwxh:12017idklzzwxh:12018klzzwxh:12077klzzwxh:12019klzzwxh:12078$this-klzzwxh:12071DB-klzzwxh:12072queryklzzwxh:12020klzzwxh:12021UPDATE klzzwxh:12022.$this-klzzwxh:12073ibfklzzwxh:12023prefix.klzzwxh:12024membersklzzwxh:12025converge SET convergeklzzwxh:12026passklzzwxh:12027hash=klzzwxh:12028klzzwxh:12029.$convergeklzzwxh:12030passklzzwxh:12031hash.klzzwxh:12032klzzwxh:12033,convergeklzzwxh:12034passklzzwxh:12035salt=klzzwxh:12036klzzwxh:12037.$convergeklzzwxh:12038passklzzwxh:12039salt.klzzwxh:12040klzzwxh:12041 WHERE convergeklzzwxh:12042id=klzzwxh:12043klzzwxh:12044.$memberklzzwxh:12045id.klzzwxh:12046klzzwxh:12047klzzwxh:12048klzzwxh:12049;klzzwxh:12079$this-klzzwxh:12074DB-klzzwxh:12075queryklzzwxh:12050klzzwxh:12051UPDATE klzzwxh:12052.$this-klzzwxh:12076ibfklzzwxh:12053prefix.klzzwxh:12054members SET memberklzzwxh:12055loginklzzwxh:12056key=klzzwxh:12057klzzwxh:12058.$memberklzzwxh:12059loginklzzwxh:12060key.klzzwxh:12061klzzwxh:12062 WHERE id=klzzwxh:12063klzzwxh:12064.$memberklzzwxh:12065id.klzzwxh:12066klzzwxh:12067klzzwxh:12068klzzwxh:12069;klzzwxh:12080klzzwxh:12070
// setPasswordklzzwxh:12177// updates the password for the specified usernameklzzwxh:12178function setPassword klzzwxh:12081$username, $passwordklzzwxh:12082 klzzwxh:12083klzzwxh:12179// clean the user nameklzzwxh:12180$this-klzzwxh:12161usernameklzzwxh:12084replaceklzzwxh:12085specialklzzwxh:12086charactersklzzwxh:12087forklzzwxh:12088forumklzzwxh:12089$usernameklzzwxh:12090;klzzwxh:12181$username = $this-klzzwxh:12162txtklzzwxh:12091stripslashesklzzwxh:12092$usernameklzzwxh:12093;klzzwxh:12182$username = pregklzzwxh:12094replaceklzzwxh:12095klzzwxh:12096/&klzzwxh:12097klzzwxh:12098klzzwxh:120990-9klzzwxh:12100+klzzwxh:12101;/klzzwxh:12102, klzzwxh:12103-klzzwxh:12104, $usernameklzzwxh:12105;klzzwxh:12183$username = $this-klzzwxh:12163cleanklzzwxh:12106valueklzzwxh:12107$usernameklzzwxh:12108;klzzwxh:12184$this-klzzwxh:12164applyklzzwxh:12109forumklzzwxh:12110charset klzzwxh:12111$usernameklzzwxh:12112;klzzwxh:12185$username = $this-klzzwxh:12165ucfirstklzzwxh:12113$username, $this-klzzwxh:12166forumklzzwxh:12114charsetklzzwxh:12115;klzzwxh:12186// does the user exist?klzzwxh:12187$sql = $this-klzzwxh:12167setPasswordklzzwxh:12116getklzzwxh:12117userklzzwxh:12118sql klzzwxh:12119$usernameklzzwxh:12120;klzzwxh:12188$this-klzzwxh:12168DB-klzzwxh:12169query klzzwxh:12121$sqlklzzwxh:12122;klzzwxh:12189if klzzwxh:12123$member = $this-klzzwxh:12170DB-klzzwxh:12171fetchklzzwxh:12124rowklzzwxh:12125klzzwxh:12126klzzwxh:12127 klzzwxh:12128klzzwxh:12190// do some sanity checks on the new password...klzzwxh:12191if klzzwxh:12129emptyklzzwxh:12130$passwordklzzwxh:12131 OR strlenklzzwxh:12132$passwordklzzwxh:12133 klzzwxh:12172 3 OR strlenklzzwxh:12134$passwordklzzwxh:12135 klzzwxh:12173 32klzzwxh:12136 klzzwxh:12137klzzwxh:12192return FALSE;klzzwxh:12193klzzwxh:12138klzzwxh:12194// ...and clean the password...klzzwxh:12195$password = $this-klzzwxh:12174txtklzzwxh:12139stripslashesklzzwxh:12140$passwordklzzwxh:12141;klzzwxh:12196$password = pregklzzwxh:12142replaceklzzwxh:12143klzzwxh:12144/&klzzwxh:12145klzzwxh:12146klzzwxh:121470-9klzzwxh:12148+klzzwxh:12149;/klzzwxh:12150, klzzwxh:12151-klzzwxh:12152, $passwordklzzwxh:12153;klzzwxh:12197$password = $this-klzzwxh:12175cleanklzzwxh:12154valueklzzwxh:12155$passwordklzzwxh:12156;klzzwxh:12198$this-klzzwxh:12176applyklzzwxh:12157forumklzzwxh:12158charset klzzwxh:12159$passwordklzzwxh:12160;
$memberklzzwxh:12199loginklzzwxh:12200key = $this-klzzwxh:12220generateklzzwxh:12201autoklzzwxh:12202loginklzzwxh:12203keyklzzwxh:12204klzzwxh:12205;klzzwxh:12223$convergeklzzwxh:12206passklzzwxh:12207salt = $this-klzzwxh:12221generateklzzwxh:12208passwordklzzwxh:12209saltklzzwxh:122105klzzwxh:12211;klzzwxh:12224$convergeklzzwxh:12212passklzzwxh:12213hash = $this-klzzwxh:12222generateklzzwxh:12214compiledklzzwxh:12215passhashklzzwxh:12216 $convergeklzzwxh:12217passklzzwxh:12218salt, $password klzzwxh:12219;
$this-klzzwxh:12240updateklzzwxh:12225hashklzzwxh:12226andklzzwxh:12227key klzzwxh:12228$convergeklzzwxh:12229passklzzwxh:12230hash,$convergeklzzwxh:12231passklzzwxh:12232salt,$memberklzzwxh:12233loginklzzwxh:12234key,$memberklzzwxh:12235klzzwxh:12236idklzzwxh:12237klzzwxh:12238klzzwxh:12239;
return true;klzzwxh:12245klzzwxh:12241 else klzzwxh:12242 // member not found in forum database...klzzwxh:12246// return true as password is also set for non existing users in MW1.9+...klzzwxh:12247return true;klzzwxh:12248klzzwxh:12243klzzwxh:12249klzzwxh:12244
function retrieveklzzwxh:12250secondaryklzzwxh:12251ipbwikigroupklzzwxh:12252forklzzwxh:12253member klzzwxh:12254$usernameklzzwxh:12255 klzzwxh:12256klzzwxh:12295// clean the user nameklzzwxh:12296$this-klzzwxh:12289usernameklzzwxh:12257replaceklzzwxh:12258specialklzzwxh:12259charactersklzzwxh:12260forklzzwxh:12261forumklzzwxh:12262$usernameklzzwxh:12263;klzzwxh:12297$username = $this-klzzwxh:12290txtklzzwxh:12264stripslashesklzzwxh:12265$usernameklzzwxh:12266;klzzwxh:12298$username = pregklzzwxh:12267replaceklzzwxh:12268klzzwxh:12269/&klzzwxh:12270klzzwxh:12271klzzwxh:122720-9klzzwxh:12273+klzzwxh:12274;/klzzwxh:12275, klzzwxh:12276-klzzwxh:12277, $usernameklzzwxh:12278;klzzwxh:12299$username = $this-klzzwxh:12291cleanklzzwxh:12279valueklzzwxh:12280$usernameklzzwxh:12281;klzzwxh:12300$this-klzzwxh:12292applyklzzwxh:12282forumklzzwxh:12283charset klzzwxh:12284$usernameklzzwxh:12285;klzzwxh:12301$username = $this-klzzwxh:12293ucfirstklzzwxh:12286$username, $this-klzzwxh:12294forumklzzwxh:12287charsetklzzwxh:12288;
// ipbwiki orig $this-klzzwxh:12434DB-klzzwxh:12435query klzzwxh:12302klzzwxh:12303SELECT m.mgroupklzzwxh:12304others, m.posts FROM klzzwxh:12305 . $this-klzzwxh:12436ibfklzzwxh:12306prefix . klzzwxh:12307members m WHERE LOWERklzzwxh:12308m.nameklzzwxh:12309 = LOWERklzzwxh:12310klzzwxh:12311klzzwxh:12312 . $username . klzzwxh:12313klzzwxh:12314klzzwxh:12315klzzwxh:12316klzzwxh:12317;klzzwxh:12452$this-klzzwxh:12437DB-klzzwxh:12438query klzzwxh:12318klzzwxh:12319SELECT m.mgroupklzzwxh:12320others, m.posts FROM klzzwxh:12321 . $this-klzzwxh:12439ibfklzzwxh:12322prefix . klzzwxh:12323members m WHERE m.name = klzzwxh:12324klzzwxh:12325 . $username . klzzwxh:12326klzzwxh:12327klzzwxh:12328klzzwxh:12329;klzzwxh:12453$member = $this-klzzwxh:12440DB-klzzwxh:12441fetchklzzwxh:12330rowklzzwxh:12331klzzwxh:12332;klzzwxh:12454$groups = explode klzzwxh:12333klzzwxh:12334,klzzwxh:12335,$memberklzzwxh:12336klzzwxh:12337mgroupklzzwxh:12338othersklzzwxh:12339klzzwxh:12340klzzwxh:12341;klzzwxh:12455$secklzzwxh:12342group = arrayklzzwxh:12343klzzwxh:12344;klzzwxh:12456foreach klzzwxh:12345$groups as $valueklzzwxh:12346 klzzwxh:12347klzzwxh:12457if klzzwxh:12348$valueklzzwxh:12349 klzzwxh:12350klzzwxh:12458$this-klzzwxh:12442DB-klzzwxh:12443query klzzwxh:12351klzzwxh:12352SELECT g.gklzzwxh:12353title, ig.posts as igklzzwxh:12354posts FROM klzzwxh:12355 . $this-klzzwxh:12444ibfklzzwxh:12356prefix . klzzwxh:12357groups g JOIN klzzwxh:12358.$this-klzzwxh:12445ibfklzzwxh:12359prefix.klzzwxh:12360ipbwikiklzzwxh:12361group ig ON ig.gklzzwxh:12362id = g.gklzzwxh:12363id AND $memberklzzwxh:12364postsklzzwxh:12365 klzzwxh:12446= ig.posts WHERE g.gklzzwxh:12366id = $value ORDER BY ig.posts DESCklzzwxh:12367klzzwxh:12368;klzzwxh:12459if klzzwxh:12369$group = $this-klzzwxh:12447DB-klzzwxh:12448fetchklzzwxh:12370rowklzzwxh:12371klzzwxh:12372klzzwxh:12373 klzzwxh:12374klzzwxh:12460$this-klzzwxh:12449applyklzzwxh:12375wikiklzzwxh:12376charset klzzwxh:12377$groupklzzwxh:12378klzzwxh:12379gklzzwxh:12380titleklzzwxh:12381klzzwxh:12382klzzwxh:12383;klzzwxh:12461if klzzwxh:12384$groupklzzwxh:12385klzzwxh:12386igklzzwxh:12387postsklzzwxh:12388klzzwxh:12389 klzzwxh:12450 0klzzwxh:12390 klzzwxh:12391klzzwxh:12462$secklzzwxh:12392groupklzzwxh:12393klzzwxh:12394 = $groupklzzwxh:12395klzzwxh:12396gklzzwxh:12397titleklzzwxh:12398klzzwxh:12399.klzzwxh:12400 klzzwxh:12401klzzwxh:12402.$groupklzzwxh:12403klzzwxh:12404igklzzwxh:12405postsklzzwxh:12406klzzwxh:12407.klzzwxh:12408+ klzzwxh:12409.$this-klzzwxh:12451ipbwikiklzzwxh:12410langklzzwxh:12411klzzwxh:12412postsklzzwxh:12413klzzwxh:12414.klzzwxh:12415klzzwxh:12416klzzwxh:12417;klzzwxh:12463klzzwxh:12418 else klzzwxh:12419klzzwxh:12464$secklzzwxh:12420groupklzzwxh:12421klzzwxh:12422 = $groupklzzwxh:12423klzzwxh:12424gklzzwxh:12425titleklzzwxh:12426klzzwxh:12427;klzzwxh:12465klzzwxh:12428klzzwxh:12466klzzwxh:12429klzzwxh:12467klzzwxh:12430klzzwxh:12468klzzwxh:12431klzzwxh:12469return $secklzzwxh:12432group;klzzwxh:12470klzzwxh:12433
function getklzzwxh:12471permissionklzzwxh:12472joinklzzwxh:12473memberklzzwxh:12474sql klzzwxh:12475$cookieklzzwxh:12476klzzwxh:12498klzzwxh:12477klzzwxh:12499return klzzwxh:12478SELECT gklzzwxh:12479permklzzwxh:12480id FROM klzzwxh:12481.$this-klzzwxh:12496ibfklzzwxh:12482prefix.klzzwxh:12483groups g JOIN klzzwxh:12484.$this-klzzwxh:12497ibfklzzwxh:12485prefix.klzzwxh:12486members m ON m.mgroup = g.gklzzwxh:12487id WHERE m.id = klzzwxh:12488.$cookieklzzwxh:12489klzzwxh:12490memberklzzwxh:12491idklzzwxh:12492klzzwxh:12493; klzzwxh:12495klzzwxh:12494
function getklzzwxh:12500permissionklzzwxh:12501join klzzwxh:12502klzzwxh:12503 klzzwxh:12504klzzwxh:12676// determine permission masks of the user group, if the ParseCache is disabled fetch the permissions of the guest groupklzzwxh:12677$cookie = $this-klzzwxh:12660retrieveklzzwxh:12505forumklzzwxh:12506sessionklzzwxh:12507klzzwxh:12508;klzzwxh:12678if klzzwxh:12509klzzwxh:12510$this-klzzwxh:12661parsercache === klzzwxh:125110klzzwxh:12512klzzwxh:12513 and klzzwxh:12514$cookieklzzwxh:12515klzzwxh:12516memberklzzwxh:12517idklzzwxh:12518klzzwxh:12519 klzzwxh:12662 0klzzwxh:12520klzzwxh:12521 klzzwxh:12522klzzwxh:12679$sql = $this-klzzwxh:12663getklzzwxh:12523permissionklzzwxh:12524joinklzzwxh:12525memberklzzwxh:12526sql klzzwxh:12527$cookieklzzwxh:12528;klzzwxh:12680klzzwxh:12529 else klzzwxh:12530klzzwxh:12681$sql = klzzwxh:12531SELECT gklzzwxh:12532permklzzwxh:12533id FROM klzzwxh:12534.$this-klzzwxh:12664ibfklzzwxh:12535prefix.klzzwxh:12536groups WHERE gklzzwxh:12537id = klzzwxh:12538.$this-klzzwxh:12665guestklzzwxh:12539group;klzzwxh:12682klzzwxh:12540klzzwxh:12683$this-klzzwxh:12666DB-klzzwxh:12667query klzzwxh:12541$sqlklzzwxh:12542;klzzwxh:12684$permission = $this-klzzwxh:12668DB-klzzwxh:12669fetchklzzwxh:12543rowklzzwxh:12544klzzwxh:12545;klzzwxh:12685// retrieve the permission masks we have in an array...klzzwxh:12686$permission = explode klzzwxh:12546klzzwxh:12547,klzzwxh:12548,$permissionklzzwxh:12549klzzwxh:12550gklzzwxh:12551permklzzwxh:12552idklzzwxh:12553klzzwxh:12554klzzwxh:12555;klzzwxh:12687// retrieve the forums we have access to...klzzwxh:12688$sql = klzzwxh:12556SELECT id, permissionklzzwxh:12557array FROM klzzwxh:12558.$this-klzzwxh:12670ibfklzzwxh:12559prefix.klzzwxh:12560forumsklzzwxh:12561;klzzwxh:12689if klzzwxh:12562$forumklzzwxh:12563id klzzwxh:12671 0klzzwxh:12564 klzzwxh:12565klzzwxh:12690$sql .= klzzwxh:12566 WHERE id = klzzwxh:12567 . $forumklzzwxh:12568id;klzzwxh:12691klzzwxh:12569klzzwxh:12692$this-klzzwxh:12672DB-klzzwxh:12673query klzzwxh:12570$sqlklzzwxh:12571;klzzwxh:12693$extraklzzwxh:12572sql = klzzwxh:12573klzzwxh:12574;klzzwxh:12694$first = true;klzzwxh:12695while klzzwxh:12575$row = $this-klzzwxh:12674DB-klzzwxh:12675fetchklzzwxh:12576rowklzzwxh:12577klzzwxh:12578klzzwxh:12579 klzzwxh:12580klzzwxh:12696$ok = false;klzzwxh:12697$perms = unserializeklzzwxh:12581stripslashesklzzwxh:12582$rowklzzwxh:12583klzzwxh:12584permissionklzzwxh:12585arrayklzzwxh:12586klzzwxh:12587klzzwxh:12588klzzwxh:12589;klzzwxh:12698$readklzzwxh:12590perms = $permsklzzwxh:12591klzzwxh:12592readklzzwxh:12593permsklzzwxh:12594klzzwxh:12595;klzzwxh:12699foreach klzzwxh:12596$permission as $valueklzzwxh:12597 klzzwxh:12598klzzwxh:12700if klzzwxh:12599$readklzzwxh:12600perms == klzzwxh:12601klzzwxh:12602klzzwxh:12603 OR $readklzzwxh:12604perms == klzzwxh:12605klzzwxh:12606klzzwxh:12607 klzzwxh:12608 $ok = true; break; klzzwxh:12609klzzwxh:12701if klzzwxh:12610strstrklzzwxh:12611$readklzzwxh:12612perms, $valueklzzwxh:12613 klzzwxh:12614== false klzzwxh:12615 klzzwxh:12616 $ok = true; break; klzzwxh:12617klzzwxh:12702klzzwxh:12618klzzwxh:12703if klzzwxh:12619$okklzzwxh:12620 klzzwxh:12621klzzwxh:12704if klzzwxh:12622$firstklzzwxh:12623 klzzwxh:12624klzzwxh:12705$extraklzzwxh:12625sql .= $rowklzzwxh:12626klzzwxh:12627idklzzwxh:12628klzzwxh:12629;klzzwxh:12706$first = false;klzzwxh:12707klzzwxh:12630 else klzzwxh:12631klzzwxh:12708$extraklzzwxh:12632sql .= klzzwxh:12633,klzzwxh:12634 . $rowklzzwxh:12635klzzwxh:12636idklzzwxh:12637klzzwxh:12638;klzzwxh:12709klzzwxh:12639klzzwxh:12710klzzwxh:12640klzzwxh:12711klzzwxh:12641klzzwxh:12712if klzzwxh:12642$first == trueklzzwxh:12643 klzzwxh:12644 // no matches found?klzzwxh:12713$extraklzzwxh:12645sql = klzzwxh:12646 AND 1 = 2 klzzwxh:12647;klzzwxh:12714klzzwxh:12648 else klzzwxh:12649klzzwxh:12715$extraklzzwxh:12650sql = klzzwxh:12651 AND t.forumklzzwxh:12652id IN klzzwxh:12653klzzwxh:12654.$extraklzzwxh:12655sql.klzzwxh:12656klzzwxh:12657klzzwxh:12658;klzzwxh:12716klzzwxh:12659
return $extraklzzwxh:12717sql;klzzwxh:12719klzzwxh:12718
// topic - post interactionklzzwxh:12734// getklzzwxh:12720topicklzzwxh:12721listklzzwxh:12735// gets a topic list from the forumklzzwxh:12736function getklzzwxh:12722topicklzzwxh:12723list klzzwxh:12724$forumklzzwxh:12725id, $topicsklzzwxh:12726 klzzwxh:12727klzzwxh:12737$extraklzzwxh:12728sql = $this-klzzwxh:12733getklzzwxh:12729permissionklzzwxh:12730joinklzzwxh:12731klzzwxh:12732;
$sql = klzzwxh:12738SELECT t.tid, t.state, t.iconklzzwxh:12739id, t.title, t.description, t.posts, t.starterklzzwxh:12740id, sm.membersklzzwxh:12741displayklzzwxh:12742name AS smklzzwxh:12743name, t.views, t.lastklzzwxh:12744post, t.lastklzzwxh:12745posterklzzwxh:12746id, lm.membersklzzwxh:12747displayklzzwxh:12748name AS lmklzzwxh:12749name, t.forumklzzwxh:12750id, f.name as forumdescklzzwxh:12811FROM klzzwxh:12751.$this-klzzwxh:12806ibfklzzwxh:12752prefix.klzzwxh:12753topics tklzzwxh:12812LEFT JOIN klzzwxh:12754.$this-klzzwxh:12807ibfklzzwxh:12755prefix.klzzwxh:12756members sm ON sm.id = t.starterklzzwxh:12757idklzzwxh:12813LEFT JOIN klzzwxh:12758.$this-klzzwxh:12808ibfklzzwxh:12759prefix.klzzwxh:12760members lm ON lm.id = t.lastklzzwxh:12761posterklzzwxh:12762idklzzwxh:12814JOIN klzzwxh:12763.$this-klzzwxh:12809ibfklzzwxh:12764prefix.klzzwxh:12765forums f ON f.id = t.forumklzzwxh:12766idklzzwxh:12767 . $extraklzzwxh:12768sql . klzzwxh:12769klzzwxh:12815WHERE t.approved = 1 klzzwxh:12770;klzzwxh:12816if klzzwxh:12771$forumklzzwxh:12772id klzzwxh:12810 0klzzwxh:12773 klzzwxh:12774klzzwxh:12817$sql .= klzzwxh:12775 AND t.forumklzzwxh:12776id = klzzwxh:12777 . $forumklzzwxh:12778id;klzzwxh:12818if klzzwxh:12779$topics klzzwxh:12780== klzzwxh:12781klzzwxh:12782klzzwxh:12783 klzzwxh:12784klzzwxh:12819$sql .= klzzwxh:12785 AND t.tid IN klzzwxh:12786klzzwxh:12787. $topics . klzzwxh:12788klzzwxh:12789klzzwxh:12790;klzzwxh:12820klzzwxh:12791klzzwxh:12821klzzwxh:12792 else if klzzwxh:12793$topics klzzwxh:12794== klzzwxh:12795klzzwxh:12796klzzwxh:12797 klzzwxh:12798klzzwxh:12822$sql .= klzzwxh:12799 AND t.tid IN klzzwxh:12800klzzwxh:12801. $topics . klzzwxh:12802klzzwxh:12803klzzwxh:12804;klzzwxh:12823klzzwxh:12805
$sql .= klzzwxh:12824 ORDER BY lastklzzwxh:12825post DESCklzzwxh:12826;
$this-klzzwxh:12830DB-klzzwxh:12831query klzzwxh:12827$sqlklzzwxh:12828;klzzwxh:12832klzzwxh:12829
// ------------------------------------------------------------------------------------------klzzwxh:12833// retrieve post info...klzzwxh:12834// ------------------------------------------------------------------------------------------
function getklzzwxh:12835postklzzwxh:12836sql klzzwxh:12837$extraklzzwxh:12838sql, $postklzzwxh:12839idklzzwxh:12840klzzwxh:12884klzzwxh:12841klzzwxh:12885$sql = klzzwxh:12842SELECT p.pid, p.authorklzzwxh:12843id, p.authorklzzwxh:12844name, p.postklzzwxh:12845date, p.iconklzzwxh:12846id, p.post, p.topicklzzwxh:12847id, t.forumklzzwxh:12848id, m.title, m.mgroup, m.posts, m.joined, m.id, g.gklzzwxh:12849title, me.avatarklzzwxh:12850location, me.avatarklzzwxh:12851typeklzzwxh:12886FROM klzzwxh:12852.$this-klzzwxh:12879ibfklzzwxh:12853prefix.klzzwxh:12854posts pklzzwxh:12887JOIN klzzwxh:12855.$this-klzzwxh:12880ibfklzzwxh:12856prefix.klzzwxh:12857topics tklzzwxh:12888ON t.tid = p.topicklzzwxh:12858idklzzwxh:12889AND t.approved = 1 klzzwxh:12859.$extraklzzwxh:12860sql.klzzwxh:12861klzzwxh:12890LEFT JOIN klzzwxh:12862.$this-klzzwxh:12881ibfklzzwxh:12863prefix.klzzwxh:12864members m klzzwxh:12891ON m.id = p.authorklzzwxh:12865idklzzwxh:12892LEFT JOIN klzzwxh:12866.$this-klzzwxh:12882ibfklzzwxh:12867prefix.klzzwxh:12868memberklzzwxh:12869extra meklzzwxh:12893ON m.id = me.id klzzwxh:12877LEFT JOIN klzzwxh:12870.$this-klzzwxh:12883ibfklzzwxh:12871prefix.klzzwxh:12872groups gklzzwxh:12894ON g.gklzzwxh:12873id = m.mgroupklzzwxh:12895WHERE queued = 0klzzwxh:12896AND p.pid = klzzwxh:12874 . $postklzzwxh:12875id;klzzwxh:12897return $sql; klzzwxh:12878klzzwxh:12876
function getklzzwxh:12898post klzzwxh:12899$postklzzwxh:12900id, $checkklzzwxh:12901permissionklzzwxh:12902 klzzwxh:12903klzzwxh:12920if klzzwxh:12904$checkklzzwxh:12905permission == 1klzzwxh:12906 klzzwxh:12907klzzwxh:12921$extraklzzwxh:12908sql = $this-klzzwxh:12919getklzzwxh:12909permissionklzzwxh:12910joinklzzwxh:12911klzzwxh:12912;klzzwxh:12922klzzwxh:12913 else klzzwxh:12914klzzwxh:12923$extraklzzwxh:12915sql = klzzwxh:12916klzzwxh:12917;klzzwxh:12924klzzwxh:12918
$sql = $this-klzzwxh:12931getklzzwxh:12925postklzzwxh:12926sql klzzwxh:12927$extraklzzwxh:12928sql, $postklzzwxh:12929idklzzwxh:12930;
$this-klzzwxh:12935DB-klzzwxh:12936query klzzwxh:12932$sqlklzzwxh:12933;klzzwxh:12937klzzwxh:12934
function getklzzwxh:12938postklzzwxh:12939icon klzzwxh:12940$iconklzzwxh:12941 klzzwxh:12942klzzwxh:12984if klzzwxh:12943$icon klzzwxh:12977 0klzzwxh:12944 klzzwxh:12945klzzwxh:12985return klzzwxh:12946klzzwxh:12978img src=klzzwxh:12947klzzwxh:12948.$this-klzzwxh:12979imgklzzwxh:12949url.klzzwxh:12950/iconklzzwxh:12951.$icon.klzzwxh:12952.gifklzzwxh:12953 border=klzzwxh:129540klzzwxh:12955 style=klzzwxh:12956padding-bottom:2pxklzzwxh:12957klzzwxh:12980klzzwxh:12958;klzzwxh:12986klzzwxh:12959 else klzzwxh:12960klzzwxh:12987return klzzwxh:12961klzzwxh:12981img src=klzzwxh:12962klzzwxh:12963.$this-klzzwxh:12982imgklzzwxh:12964url.klzzwxh:12965/toklzzwxh:12966postklzzwxh:12967off.gifklzzwxh:12968 border=klzzwxh:129690klzzwxh:12970 style=klzzwxh:12971padding-bottom:2pxklzzwxh:12972klzzwxh:12983klzzwxh:12973;klzzwxh:12988klzzwxh:12974klzzwxh:12989klzzwxh:12975klzzwxh:12990klzzwxh:12976
?klzzwxh:12993klzzwxh:12994klzzwxh:12991/codeklzzwxh:12992
that shou'd make the setup work