Version 1.1.1

This commit is contained in:
Neo committed 2025-12-19 00:16:25 -08:00
1 parent aabfdc1f57
commit 7ef3d1712a
179 files changed
+57457 -44972

No files matched your search

+290
View File
@@ -0,0 +1,290 @@
<?php
/*
+--------------------------------------------------------------------------
| Invision Board v1.1
| ========================================
| by Matthew Mecham
| (c) 2001,2002 Invision Power Services
| http://www.ibforums.com
| ========================================
| Web: http://www.ibforums.com
| Email: phpboards@ibforums.com
| Licence Info: phpib-licence@ibforums.com
+---------------------------------------------------------------------------
|
| > Admin Logs Stuff
| > Module written by Matt Mecham
| > Date started: 11nd September 2002
|
| > Module Version Number: 1.0.0
+--------------------------------------------------------------------------
*/
// Ensure we've not accessed this script directly:
$idx = new ad_adlogs();
class ad_adlogs {
var $base_url;
var $colours = array();
function ad_adlogs() {
global $IN, $root_path, $INFO, $DB, $SKIN, $ADMIN, $std, $MEMBER, $GROUP;
// Make sure we're a root admin, or else!
if ($MEMBER['mgroup'] != $INFO['admin_group'])
{
$ADMIN->error("Sorry, these functions are for the root admin group only");
}
$this->colours = array(
"cat" => "green",
"forum" => "darkgreen",
"mem" => "red",
'group' => "purple",
'mod' => 'orange',
'op' => 'darkred',
'help' => 'darkorange',
'modlog' => 'steelblue',
);
switch($IN['code'])
{
case 'view':
$this->view();
break;
case 'remove':
$this->remove();
break;
//-------------------------
default:
$this->list_current();
break;
}
}
//---------------------------------------------
// Remove archived files
//---------------------------------------------
function view()
{
global $IN, $root_path, $INFO, $DB, $SKIN, $ADMIN, $std, $MEMBER, $GROUP;
$start = $IN['st'] ? $IN['st'] : 0;
$ADMIN->page_detail = "Viewing all actions by a administrator";
$ADMIN->page_title = "Administration Logs Manager";
if ($IN['search_string'] == "")
{
$DB->query("SELECT COUNT(id) as count FROM ibf_admin_logs WHERE member_id='".$IN['mid']."'");
$row = $DB->fetch_row();
$row_count = $row['count'];
$query = "&act=adminlog&mid={$IN['mid']}&code=view";
$DB->query("SELECT m.*, mem.id, mem.name FROM ibf_admin_logs m, ibf_members mem
WHERE m.member_id='".$IN['mid']."' AND m.member_id=mem.id ORDER BY m.ctime DESC LIMIT $start, 20");
}
else
{
$IN['search_string'] = urldecode($IN['search_string']);
$dbq = "m.".$IN['search_type']." LIKE '%".$IN['search_string']."%'";
$DB->query("SELECT COUNT(m.id) as count FROM ibf_admin_logs m WHERE $dbq");
$row = $DB->fetch_row();
$row_count = $row['count'];
$query = "&act=modlog&code=view&search_type={$IN['search_type']}&search_string=".urlencode($IN['search_string']);
$DB->query("SELECT m.*, mem.id, mem.name FROM ibf_admin_logs m, ibf_members mem
WHERE m.member_id='".$IN['mid']."' AND m.member_id=mem.id AND $dbq ORDER BY m.ctime DESC LIMIT $start, 20");
}
$links = $std->build_pagelinks( array( 'TOTAL_POSS' => $row_count,
'PER_PAGE' => 20,
'CUR_ST_VAL' => $start,
'L_SINGLE' => "Single Page",
'L_MULTI' => "Pages: ",
'BASE_URL' => $ADMIN->base_url.$query,
)
);
$ADMIN->page_detail = "You may view and remove actions performed by your administrators";
$ADMIN->page_title = "Administrator Logs Manager";
//+-------------------------------
$SKIN->td_header[] = array( "Member Name" , "20%" );
$SKIN->td_header[] = array( "Action Perfomed" , "40%" );
$SKIN->td_header[] = array( "Time of action" , "20%" );
$SKIN->td_header[] = array( "IP address" , "20%" );
$ADMIN->html .= $SKIN->start_table( "Saved Admin Logs" );
$ADMIN->html .= $SKIN->add_td_basic($links, 'center', 'catrow');
if ( $DB->get_num_rows() )
{
while ( $row = $DB->fetch_row() )
{
$row['ctime'] = $std->get_date( $row['ctime'], 'LONG' );
$ADMIN->html .= $SKIN->add_td_row( array( "<b>{$row['name']}</b>",
"<span style='color:{$this->colours[$row['act']]}'>{$row['note']}</span>",
"{$row['ctime']}",
"{$row['ip_address']}",
) );
}
}
else
{
$ADMIN->html .= $SKIN->add_td_basic("<center>No results</center>");
}
$ADMIN->html .= $SKIN->add_td_basic($links, 'center', 'tdtop');
$ADMIN->html .= $SKIN->end_table();
//+-------------------------------
//+-------------------------------
$ADMIN->output();
}
//---------------------------------------------
// Remove archived files
//---------------------------------------------
function remove()
{
global $IN, $root_path, $INFO, $DB, $SKIN, $ADMIN, $std, $MEMBER, $GROUP;
if ($IN['mid'] == "")
{
$ADMIN->error("You did not select a member ID to remove by!");
}
$DB->query("DELETE FROM ibf_admin_logs WHERE member_id='".$IN['mid']."'");
$std->boink_it($ADMIN->base_url."&act=adminlog");
exit();
}
//-------------------------------------------------------------
// SHOW ALL LANGUAGE PACKS
//-------------------------------------------------------------
function list_current()
{
global $IN, $root_path, $INFO, $DB, $SKIN, $ADMIN, $std, $MEMBER, $GROUP;
$form_array = array();
$ADMIN->page_detail = "You may view and remove actions performed by your administrators in mission critical areas of the administration CP (such as forum control, member control, group control, help files and moderator log management).";
$ADMIN->page_title = "Administration Logs Manager";
//+-------------------------------
$SKIN->td_header[] = array( "Member Name" , "30%" );
$SKIN->td_header[] = array( "Actions Perfomed" , "20%" );
$SKIN->td_header[] = array( "View all by member" , "20%" );
$SKIN->td_header[] = array( "Remove all by member" , "30%" );
$ADMIN->html .= $SKIN->start_table( "Saved Admininstration Logs" );
$DB->query("SELECT m.*, mem.name, count(m.id) as act_count FROM ibf_admin_logs m, ibf_members mem WHERE m.member_id=mem.id GROUP BY m.member_id ORDER BY act_count DESC");
while ( $r = $DB->fetch_row() )
{
$ADMIN->html .= $SKIN->add_td_row( array( "<b>{$r['name']}</b>",
"<center>{$r['act_count']}</center>",
"<center><a href='".$SKIN->base_url."&act=adminlog&code=view&mid={$r['member_id']}'>View</a></center>",
"<center><a href='".$SKIN->base_url."&act=adminlog&code=remove&mid={$r['member_id']}'>Remove</a></center>",
) );
}
$ADMIN->html .= $SKIN->end_table();
//+-------------------------------
//+-------------------------------
$ADMIN->html .= $SKIN->start_form( array( 1 => array( 'code' , 'view' ),
2 => array( 'act' , 'adminlog' ),
) );
$SKIN->td_header[] = array( "&nbsp;" , "40%" );
$SKIN->td_header[] = array( "&nbsp;" , "60%" );
$ADMIN->html .= $SKIN->start_table( "Search Admin Logs" );
$form_array = array(
0 => array( 'note' , 'Action Performed' ),
1 => array( 'ip_address', 'IP Address' ),
2 => array( 'member_id' , 'Member ID' ),
3 => array( 'act' , 'ACT Setting' ),
4 => array( 'code' , 'CODE Setting' ),
);
//+-------------------------------
$ADMIN->html .= $SKIN->add_td_row( array( "<b>Search for...</b>" ,
$SKIN->form_input( "search_string")
) );
$ADMIN->html .= $SKIN->add_td_row( array( "<b>Search in...</b>" ,
$SKIN->form_dropdown( "search_type", $form_array)
) );
$ADMIN->html .= $SKIN->end_form("Search");
$ADMIN->html .= $SKIN->end_table();
//+-------------------------------
//+-------------------------------
$ADMIN->output();
}
}
?>
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
+278 -272
View File
@@ -1,273 +1,279 @@
<?php
/*
+--------------------------------------------------------------------------
| IBFORUMS v1
| ========================================
| by Matthew Mecham and David Baxter
| (c) 2001,2002 IBForums
| http://www.ibforums.com
| ========================================
| Web: http://www.ibforums.com
| Email: phpboards@ibforums.com
| Licence Info: phpib-licence@ibforums.com
+---------------------------------------------------------------------------
|
| > Help Control functions
| > Module written by Matt Mecham
| > Date started: 2nd April 2002
|
| > Module Version Number: 1.0.0
+--------------------------------------------------------------------------
*/
$idx = new ad_settings();
class ad_settings {
var $base_url;
function ad_settings() {
global $IN, $root_path, $INFO, $DB, $SKIN, $ADMIN, $std, $MEMBER, $GROUP;
switch($IN['code'])
{
case 'edit':
$this->show_form('edit');
break;
case 'new':
$this->show_form('new');
break;
case 'doedit':
$this->doedit();
break;
case 'donew':
$this->doadd();
break;
case 'remove':
$this->remove();
break;
//-------------------------
default:
$this->list_files();
break;
}
}
//-------------------------------------------------------------
// HELP FILE FUNCTIONS
//-------------------------------------------------------------
function doedit()
{
global $IN, $root_path, $INFO, $DB, $SKIN, $ADMIN, $std, $MEMBER, $GROUP, $HTTP_POST_VARS;
if ($IN['id'] == "")
{
$ADMIN->error("You must pass a valid emoticon id, silly!");
}
$text = preg_replace( "/\n/", "<br>", stripslashes($HTTP_POST_VARS['text'] ) );
$title = preg_replace( "/\n/", "<br>", stripslashes($HTTP_POST_VARS['title'] ) );
$desc = preg_replace( "/\n/", "<br>", stripslashes($HTTP_POST_VARS['description'] ) );
$db_string = $DB->compile_db_update_string( array( 'title' => $title,
'text' => $text,
'description' => $desc,
) );
$DB->query("UPDATE ibf_faq SET $db_string WHERE id='".$IN['id']."'");
$std->boink_it($SKIN->base_url."&act=help");
exit();
}
//=====================================================
function show_form($type='new')
{
global $IN, $root_path, $INFO, $DB, $SKIN, $ADMIN, $std, $MEMBER, $GROUP;
$ADMIN->page_detail = "You may add/edit and remove help files below.";
$ADMIN->page_title = "Help File Management";
//+-------------------------------
if ($type != 'new')
{
if ($IN['id'] == "")
{
$ADMIN->error("You must pass a valid help file id, silly!");
}
//+-------------------------------
$DB->query("SELECT * FROM ibf_faq WHERE id='".$IN['id']."'");
if ( ! $r = $DB->fetch_row() )
{
$ADMIN->error("We could not find that help file in the database");
}
//+-------------------------------
$button = 'Edit this Help File';
$code = 'doedit';
}
else
{
$r = array();
$button = 'Add this Help File';
$code = 'donew';
}
$ADMIN->html .= $SKIN->start_form( array( 1 => array( 'code' , $code ),
2 => array( 'act' , 'help' ),
3 => array( 'id' , $IN['id'] ),
) );
$SKIN->td_header[] = array( "&nbsp;" , "20%" );
$SKIN->td_header[] = array( "&nbsp;" , "80%" );
$r['text'] = preg_replace( "/<br>/i", "\n", stripslashes($r['text']) );
//+-------------------------------
$ADMIN->html .= $SKIN->start_table( $button );
$ADMIN->html .= $SKIN->add_td_row( array( "Help File Title",
$SKIN->form_input('title' , stripslashes($r['title']) ),
) );
$ADMIN->html .= $SKIN->add_td_row( array( "Help File Description",
$SKIN->form_textarea('description', stripslashes($r['description']) ),
) );
$ADMIN->html .= $SKIN->add_td_row( array( "Help File Text",
$SKIN->form_textarea('text', $r['text'], "60", "10" ),
) );
$ADMIN->html .= $SKIN->end_form($button);
$ADMIN->html .= $SKIN->end_table();
$ADMIN->output();
}
//=====================================================
function remove()
{
global $IN, $root_path, $INFO, $DB, $SKIN, $ADMIN, $std, $MEMBER, $GROUP;
if ($IN['id'] == "")
{
$ADMIN->error("You must pass a valid help file id, silly!");
}
$DB->query("DELETE FROM ibf_faq WHERE id='".$IN['id']."'");
$std->boink_it($SKIN->base_url."&act=help");
exit();
}
//=====================================================
function doadd()
{
global $IN, $root_path, $INFO, $DB, $SKIN, $ADMIN, $std, $MEMBER, $GROUP, $HTTP_POST_VARS;
if ($IN['title'] == "")
{
$ADMIN->error("You must enter a title, silly!");
}
$text = preg_replace( "/\n/", "<br>", stripslashes($HTTP_POST_VARS['text'] ) );
$title = preg_replace( "/\n/", "<br>", stripslashes($HTTP_POST_VARS['title'] ) );
$desc = preg_replace( "/\n/", "<br>", stripslashes($HTTP_POST_VARS['description'] ) );
$db_string = $DB->compile_db_insert_string( array( 'title' => $title,
'text' => $text,
'description' => $desc,
) );
$DB->query("INSERT INTO ibf_faq (".$db_string['FIELD_NAMES'].") VALUES(".$db_string['FIELD_VALUES'].")");
$std->boink_it($SKIN->base_url."&act=help");
exit();
}
//=====================================================
function list_files()
{
global $IN, $root_path, $INFO, $DB, $SKIN, $ADMIN, $std, $MEMBER, $GROUP;
$ADMIN->page_detail = "You may add/edit and remove help files below.";
$ADMIN->page_title = "Help File Management";
//+-------------------------------
$SKIN->td_header[] = array( "Title" , "50%" );
$SKIN->td_header[] = array( "Edit" , "30%" );
$SKIN->td_header[] = array( "Remove" , "20%" );
//+-------------------------------
$ADMIN->html .= $SKIN->start_table( "Current Help Files" );
$DB->query("SELECT * from ibf_faq ORDER BY id ASC");
if ( $DB->get_num_rows() )
{
while ( $r = $DB->fetch_row() )
{
$ADMIN->html .= $SKIN->add_td_row( array( "<b>".stripslashes($r['title'])."</b><br>".stripslashes($r['description']),
"<center><a href='".$SKIN->base_url."&act=help&code=edit&id={$r['id']}'>Edit</a></center>",
"<center><a href='".$SKIN->base_url."&act=help&code=remove&id={$r['id']}'>Remove</a></center>",
) );
}
}
$ADMIN->html .= $SKIN->add_td_basic("<a href='".$SKIN->base_url."&act=help&code=new'>Add New Help File</a>", "center", "title" );
$ADMIN->html .= $SKIN->end_table();
//+-------------------------------
$ADMIN->output();
}
}
<?php
/*
+--------------------------------------------------------------------------
| Invision Board v1.1
| ========================================
| by Matthew Mecham
| (c) 2001,2002 Invision Power Services
| http://www.ibforums.com
| ========================================
| Web: http://www.ibforums.com
| Email: phpboards@ibforums.com
| Licence Info: phpib-licence@ibforums.com
+---------------------------------------------------------------------------
|
| > Help Control functions
| > Module written by Matt Mecham
| > Date started: 2nd April 2002
|
| > Module Version Number: 1.0.0
+--------------------------------------------------------------------------
*/
$idx = new ad_settings();
class ad_settings {
var $base_url;
function ad_settings() {
global $IN, $root_path, $INFO, $DB, $SKIN, $ADMIN, $std, $MEMBER, $GROUP;
switch($IN['code'])
{
case 'edit':
$this->show_form('edit');
break;
case 'new':
$this->show_form('new');
break;
case 'doedit':
$this->doedit();
break;
case 'donew':
$this->doadd();
break;
case 'remove':
$this->remove();
break;
//-------------------------
default:
$this->list_files();
break;
}
}
//-------------------------------------------------------------
// HELP FILE FUNCTIONS
//-------------------------------------------------------------
function doedit()
{
global $IN, $root_path, $INFO, $DB, $SKIN, $ADMIN, $std, $MEMBER, $GROUP, $HTTP_POST_VARS;
if ($IN['id'] == "")
{
$ADMIN->error("You must pass a valid emoticon id, silly!");
}
$text = preg_replace( "/\n/", "<br>", stripslashes($HTTP_POST_VARS['text'] ) );
$title = preg_replace( "/\n/", "<br>", stripslashes($HTTP_POST_VARS['title'] ) );
$desc = preg_replace( "/\n/", "<br>", stripslashes($HTTP_POST_VARS['description'] ) );
$db_string = $DB->compile_db_update_string( array( 'title' => $title,
'text' => $text,
'description' => $desc,
) );
$DB->query("UPDATE ibf_faq SET $db_string WHERE id='".$IN['id']."'");
$ADMIN->save_log("Edited help files");
$std->boink_it($SKIN->base_url."&act=help");
exit();
}
//=====================================================
function show_form($type='new')
{
global $IN, $root_path, $INFO, $DB, $SKIN, $ADMIN, $std, $MEMBER, $GROUP;
$ADMIN->page_detail = "You may add/edit and remove help files below.";
$ADMIN->page_title = "Help File Management";
//+-------------------------------
if ($type != 'new')
{
if ($IN['id'] == "")
{
$ADMIN->error("You must pass a valid help file id, silly!");
}
//+-------------------------------
$DB->query("SELECT * FROM ibf_faq WHERE id='".$IN['id']."'");
if ( ! $r = $DB->fetch_row() )
{
$ADMIN->error("We could not find that help file in the database");
}
//+-------------------------------
$button = 'Edit this Help File';
$code = 'doedit';
}
else
{
$r = array();
$button = 'Add this Help File';
$code = 'donew';
}
$ADMIN->html .= $SKIN->start_form( array( 1 => array( 'code' , $code ),
2 => array( 'act' , 'help' ),
3 => array( 'id' , $IN['id'] ),
) );
$SKIN->td_header[] = array( "&nbsp;" , "20%" );
$SKIN->td_header[] = array( "&nbsp;" , "80%" );
$r['text'] = preg_replace( "/<br>/i", "\n", stripslashes($r['text']) );
//+-------------------------------
$ADMIN->html .= $SKIN->start_table( $button );
$ADMIN->html .= $SKIN->add_td_row( array( "Help File Title",
$SKIN->form_input('title' , stripslashes($r['title']) ),
) );
$ADMIN->html .= $SKIN->add_td_row( array( "Help File Description",
$SKIN->form_textarea('description', stripslashes($r['description']) ),
) );
$ADMIN->html .= $SKIN->add_td_row( array( "Help File Text",
$SKIN->form_textarea('text', $r['text'], "60", "10" ),
) );
$ADMIN->html .= $SKIN->end_form($button);
$ADMIN->html .= $SKIN->end_table();
$ADMIN->output();
}
//=====================================================
function remove()
{
global $IN, $root_path, $INFO, $DB, $SKIN, $ADMIN, $std, $MEMBER, $GROUP;
if ($IN['id'] == "")
{
$ADMIN->error("You must pass a valid help file id, silly!");
}
$DB->query("DELETE FROM ibf_faq WHERE id='".$IN['id']."'");
$ADMIN->save_log("Removed a help file");
$std->boink_it($SKIN->base_url."&act=help");
exit();
}
//=====================================================
function doadd()
{
global $IN, $root_path, $INFO, $DB, $SKIN, $ADMIN, $std, $MEMBER, $GROUP, $HTTP_POST_VARS;
if ($IN['title'] == "")
{
$ADMIN->error("You must enter a title, silly!");
}
$text = preg_replace( "/\n/", "<br>", stripslashes($HTTP_POST_VARS['text'] ) );
$title = preg_replace( "/\n/", "<br>", stripslashes($HTTP_POST_VARS['title'] ) );
$desc = preg_replace( "/\n/", "<br>", stripslashes($HTTP_POST_VARS['description'] ) );
$db_string = $DB->compile_db_insert_string( array( 'title' => $title,
'text' => $text,
'description' => $desc,
) );
$DB->query("INSERT INTO ibf_faq (".$db_string['FIELD_NAMES'].") VALUES(".$db_string['FIELD_VALUES'].")");
$ADMIN->save_log("Added a help file");
$std->boink_it($SKIN->base_url."&act=help");
exit();
}
//=====================================================
function list_files()
{
global $IN, $root_path, $INFO, $DB, $SKIN, $ADMIN, $std, $MEMBER, $GROUP;
$ADMIN->page_detail = "You may add/edit and remove help files below.";
$ADMIN->page_title = "Help File Management";
//+-------------------------------
$SKIN->td_header[] = array( "Title" , "50%" );
$SKIN->td_header[] = array( "Edit" , "30%" );
$SKIN->td_header[] = array( "Remove" , "20%" );
//+-------------------------------
$ADMIN->html .= $SKIN->start_table( "Current Help Files" );
$DB->query("SELECT * from ibf_faq ORDER BY id ASC");
if ( $DB->get_num_rows() )
{
while ( $r = $DB->fetch_row() )
{
$ADMIN->html .= $SKIN->add_td_row( array( "<b>".stripslashes($r['title'])."</b><br>".stripslashes($r['description']),
"<center><a href='".$SKIN->base_url."&act=help&code=edit&id={$r['id']}'>Edit</a></center>",
"<center><a href='".$SKIN->base_url."&act=help&code=remove&id={$r['id']}'>Remove</a></center>",
) );
}
}
$ADMIN->html .= $SKIN->add_td_basic("<a href='".$SKIN->base_url."&act=help&code=new'>Add New Help File</a>", "center", "title" );
$ADMIN->html .= $SKIN->end_table();
//+-------------------------------
$ADMIN->output();
}
}
?>
File diff suppressed because it is too large. Load diff
+208 -203
View File
@@ -1,204 +1,209 @@
<?php
/*
+--------------------------------------------------------------------------
| IBFORUMS v1
| ========================================
| by Matthew Mecham and David Baxter
| (c) 2001,2002 IBForums
| http://www.ibforums.com
| ========================================
| Web: http://www.ibforums.com
| Email: phpboards@ibforums.com
| Licence Info: phpib-licence@ibforums.com
+---------------------------------------------------------------------------
|
| > Admin "welcome" screen functions
| > Module written by Matt Mecham
| > Date started: 1st march 2002
|
| > Module Version Number: 1.0.0
+--------------------------------------------------------------------------
*/
$idx = new index_page();
class index_page {
function index_page() {
global $DB, $IN, $INFO, $ADMIN, $SKIN, $std;
$DB->query("SELECT * FROM ibf_stats");
$row = $DB->fetch_row();
if ($row['TOTAL_REPLIES'] < 0) $row['TOTAL_REPLIES'] = 0;
if ($row['TOTAL_TOPICS'] < 0) $row['TOTAL_TOPICS'] = 0;
if ($row['MEM_COUNT'] < 0) $row['MEM_COUNT'] = 0;
$DB->query("SELECT COUNT(*) as reg FROM ibf_members WHERE mgroup='".$INFO['auth_group']."' AND (new_pass='' or new_pass IS NULL)");
$reg = $DB->fetch_row();
if ($reg['reg'] < 1 ) $reg['reg'] = 0;
//-------------------------------------------------
// Make sure the uploads path is correct
//-------------------------------------------------
$uploads_size = 0;
if ($dh = opendir( $INFO['upload_dir'] ))
{
while ( $file = readdir( $dh ) )
{
if ( !preg_match( "/^..?$|^index/i", $file ) )
{
$uploads_size += @filesize( $INFO['upload_dir'] . "/" . $file );
}
}
closedir( $dh );
}
// This piece of code from Jesse's (jesse@jess.on.ca) contribution
// to the PHP manual @ php.net
if ($uploads_size >= 1048576)
{
$uploads_size = round($uploads_size / 1048576 * 100 ) / 100 . " mb";
}
else if ($uploads_size >= 1024)
{
$uploads_size = round($uploads_size / 1024 * 100 ) / 100 . " k";
}
else
{
$uploads_size = $uploads_size . " bytes";
}
//+-----------------------------------------------------------
$ADMIN->html .= $SKIN->start_table( "Administrators using the CP" );
$t_time = time() - 60*10;
$DB->query("SELECT DISTINCT(MEMBER_NAME) FROM ibf_admin_sessions WHERE RUNNING_TIME > $t_time");
$mem_array = array();
while ( $r = $DB->fetch_row() )
{
$mem_array[] = $r['MEMBER_NAME'];
}
$ADMIN->html .= $SKIN->add_td_basic( implode(", ", $mem_array ) );
$ADMIN->html .= $SKIN->end_table();
//+-----------------------------------------------------------
$ADMIN->html .= $SKIN->add_td_spacer();
//+-----------------------------------------------------------
$SKIN->td_header[] = array( "Definition", "25%" );
$SKIN->td_header[] = array( "Value" , "25%" );
$SKIN->td_header[] = array( "Definition", "25%" );
$SKIN->td_header[] = array( "Value" , "25%" );
$ADMIN->html .= $SKIN->start_table( "System Overview" );
$ADMIN->html .= $SKIN->add_td_row( array( "Total Unique Topics" , $row['TOTAL_TOPICS'],
"Total Replies to topics" , $row['TOTAL_REPLIES']
) );
$ADMIN->html .= $SKIN->add_td_row( array( "Total Members" , $row['MEM_COUNT'], "Public Upload Folder Size", $uploads_size ) );
$ADMIN->html .= $SKIN->add_td_row( array( "<a href='{$SKIN->base_url}&act=mem&code=mod'>Users awaiting validation</a>" , $reg['reg'],
"&nbsp;", "&nbsp;",
) );
$ADMIN->html .= $SKIN->end_table();
//+-----------------------------------------------------------
$ADMIN->html .= $SKIN->add_td_spacer();
//+-----------------------------------------------------------
$ADMIN->html .= $SKIN->start_form();
$SKIN->td_header[] = array( "&nbsp;" , "40%" );
$SKIN->td_header[] = array( "&nbsp;" , "30%" );
$SKIN->td_header[] = array( "&nbsp;" , "30%" );
$ADMIN->html .= $SKIN->start_table( "Quick Clicks" );
$ADMIN->html .= "
<script language='javascript'>
<!--
function edit_member() {
if (document.forms[0].username.value == \"\") {
alert(\"You must enter a username!\");
} else {
window.parent.body.location = '{$SKIN->base_url}' + '&act=mem&code=stepone&USER_NAME=' + escape(document.forms[0].username.value);
}
}
function new_cat() {
if (document.forms[0].cat_name.value == \"\") {
alert(\"You must enter a category name!\");
} else {
window.parent.body.location = '{$SKIN->base_url}' + '&act=cat&code=new&name=' + escape(document.forms[0].cat_name.value);
}
}
function new_forum() {
if (document.forms[0].forum_name.value == \"\") {
alert(\"You must enter a forum name!\");
} else {
window.parent.body.location = '{$SKIN->base_url}' + '&act=forum&code=new&name=' + escape(document.forms[0].forum_name.value);
}
}
//-->
</script>
<form name='DOIT' action=''>
";
$ADMIN->html .= $SKIN->add_td_row( array( "Edit Member:",
"<input type='text' style='width:100%' id='textinput' name='username' value='Enter name here' onfocus='this.value=\"\"'>",
"<input type='button' value='Find Member' id='button' onClick='edit_member()'>"
) );
$ADMIN->html .= $SKIN->add_td_row( array( "Add New Category:",
"<input type='text' style='width:100%' name='cat_name' id='textinput' value='Category title here' onfocus='this.value=\"\"'>",
"<input type='button' value='Add Category' id='button' onClick='new_cat()'>"
) );
$ADMIN->html .= $SKIN->add_td_row( array( "Add New Forum:",
"<input type='text' style='width:100%' name='forum_name' id='textinput' value='Forum title here' onfocus='this.value=\"\"'>",
"<input type='button' value='Add Forum' id='button' onClick='new_forum()'>"
) );
$ADMIN->html .= "</form>";
$ADMIN->html .= $SKIN->end_table();
$ADMIN->output();
}
}
<?php
/*
+--------------------------------------------------------------------------
| Invision Board v1.1
| ========================================
| by Matthew Mecham
| (c) 2001,2002 Invision Power Services
| http://www.ibforums.com
| ========================================
| Web: http://www.ibforums.com
| Email: phpboards@ibforums.com
| Licence Info: phpib-licence@ibforums.com
+---------------------------------------------------------------------------
|
| > Admin "welcome" screen functions
| > Module written by Matt Mecham
| > Date started: 1st march 2002
|
| > Module Version Number: 1.0.0
+--------------------------------------------------------------------------
*/
$idx = new index_page();
class index_page {
function index_page() {
global $DB, $IN, $INFO, $ADMIN, $SKIN, $std;
$DB->query("SELECT * FROM ibf_stats");
$row = $DB->fetch_row();
if ($row['TOTAL_REPLIES'] < 0) $row['TOTAL_REPLIES'] = 0;
if ($row['TOTAL_TOPICS'] < 0) $row['TOTAL_TOPICS'] = 0;
if ($row['MEM_COUNT'] < 0) $row['MEM_COUNT'] = 0;
$DB->query("SELECT COUNT(*) as reg FROM ibf_members WHERE mgroup='".$INFO['auth_group']."' AND (new_pass='' or new_pass IS NULL)");
$reg = $DB->fetch_row();
if ($reg['reg'] < 1 ) $reg['reg'] = 0;
$DB->query("SELECT COUNT(*) as coppa FROM ibf_members WHERE mgroup='".$INFO['auth_group']."' AND coppa_user=1");
$coppa = $DB->fetch_row();
if ($coppa['coppa'] < 1 ) $coppa['coppa'] = 0;
//-------------------------------------------------
// Make sure the uploads path is correct
//-------------------------------------------------
$uploads_size = 0;
if ($dh = opendir( $INFO['upload_dir'] ))
{
while ( $file = readdir( $dh ) )
{
if ( !preg_match( "/^..?$|^index/i", $file ) )
{
$uploads_size += @filesize( $INFO['upload_dir'] . "/" . $file );
}
}
closedir( $dh );
}
// This piece of code from Jesse's (jesse@jess.on.ca) contribution
// to the PHP manual @ php.net
if ($uploads_size >= 1048576)
{
$uploads_size = round($uploads_size / 1048576 * 100 ) / 100 . " mb";
}
else if ($uploads_size >= 1024)
{
$uploads_size = round($uploads_size / 1024 * 100 ) / 100 . " k";
}
else
{
$uploads_size = $uploads_size . " bytes";
}
//+-----------------------------------------------------------
$ADMIN->html .= $SKIN->start_table( "Administrators using the CP" );
$t_time = time() - 60*10;
$DB->query("SELECT DISTINCT(MEMBER_NAME) FROM ibf_admin_sessions WHERE RUNNING_TIME > $t_time");
$mem_array = array();
while ( $r = $DB->fetch_row() )
{
$mem_array[] = $r['MEMBER_NAME'];
}
$ADMIN->html .= $SKIN->add_td_basic( implode(", ", $mem_array ) );
$ADMIN->html .= $SKIN->end_table();
//+-----------------------------------------------------------
$ADMIN->html .= $SKIN->add_td_spacer();
//+-----------------------------------------------------------
$SKIN->td_header[] = array( "Definition", "25%" );
$SKIN->td_header[] = array( "Value" , "25%" );
$SKIN->td_header[] = array( "Definition", "25%" );
$SKIN->td_header[] = array( "Value" , "25%" );
$ADMIN->html .= $SKIN->start_table( "System Overview" );
$ADMIN->html .= $SKIN->add_td_row( array( "Total Unique Topics" , $row['TOTAL_TOPICS'],
"Total Replies to topics" , $row['TOTAL_REPLIES']
) );
$ADMIN->html .= $SKIN->add_td_row( array( "Total Members" , $row['MEM_COUNT'], "Public Upload Folder Size", $uploads_size ) );
$ADMIN->html .= $SKIN->add_td_row( array( "<a href='{$SKIN->base_url}&act=mem&code=mod'>Users awaiting validation</a>" , $reg['reg'],
"<a href='{$SKIN->base_url}&act=mem&code=mod'>COPPA Requests</a> from 'Users awaiting validation' total", $coppa['coppa'],
) );
$ADMIN->html .= $SKIN->end_table();
//+-----------------------------------------------------------
$ADMIN->html .= $SKIN->add_td_spacer();
//+-----------------------------------------------------------
$ADMIN->html .= $SKIN->start_form();
$SKIN->td_header[] = array( "&nbsp;" , "40%" );
$SKIN->td_header[] = array( "&nbsp;" , "30%" );
$SKIN->td_header[] = array( "&nbsp;" , "30%" );
$ADMIN->html .= $SKIN->start_table( "Quick Clicks" );
$ADMIN->html .= "
<script language='javascript'>
<!--
function edit_member() {
if (document.forms[0].username.value == \"\") {
alert(\"You must enter a username!\");
} else {
window.parent.body.location = '{$SKIN->base_url}' + '&act=mem&code=stepone&USER_NAME=' + escape(document.forms[0].username.value);
}
}
function new_cat() {
if (document.forms[0].cat_name.value == \"\") {
alert(\"You must enter a category name!\");
} else {
window.parent.body.location = '{$SKIN->base_url}' + '&act=cat&code=new&name=' + escape(document.forms[0].cat_name.value);
}
}
function new_forum() {
if (document.forms[0].forum_name.value == \"\") {
alert(\"You must enter a forum name!\");
} else {
window.parent.body.location = '{$SKIN->base_url}' + '&act=forum&code=new&name=' + escape(document.forms[0].forum_name.value);
}
}
//-->
</script>
<form name='DOIT' action=''>
";
$ADMIN->html .= $SKIN->add_td_row( array( "Edit Member:",
"<input type='text' style='width:100%' id='textinput' name='username' value='Enter name here' onfocus='this.value=\"\"'>",
"<input type='button' value='Find Member' id='button' onClick='edit_member()'>"
) );
$ADMIN->html .= $SKIN->add_td_row( array( "Add New Category:",
"<input type='text' style='width:100%' name='cat_name' id='textinput' value='Category title here' onfocus='this.value=\"\"'>",
"<input type='button' value='Add Category' id='button' onClick='new_cat()'>"
) );
$ADMIN->html .= $SKIN->add_td_row( array( "Add New Forum:",
"<input type='text' style='width:100%' name='forum_name' id='textinput' value='Forum title here' onfocus='this.value=\"\"'>",
"<input type='button' value='Add Forum' id='button' onClick='new_forum()'>"
) );
$ADMIN->html .= "</form>";
$ADMIN->html .= $SKIN->end_table();
$ADMIN->output();
}
}
?>
+143
View File
@@ -0,0 +1,143 @@
<?php
/*
+--------------------------------------------------------------------------
| Invision Board v1.1
| ========================================
| by Matthew Mecham
| (c) 2001,2002 Invision Power Services
| http://www.ibforums.com
| ========================================
| Web: http://www.ibforums.com
| Email: phpboards@ibforums.com
| Licence Info: phpib-licence@ibforums.com
+---------------------------------------------------------------------------
|
| > IPS Remote Call thingy
| > Module written by Matt Mecham
| > Date started: 17th October 2002
|
| > Module Version Number: 1.0.0
+--------------------------------------------------------------------------
*/
// Ensure we've not accessed this script directly:
$idx = new ad_ips();
class ad_ips {
var $base_url;
var $colours = array();
var $url = "http://www.invisionboard.com/acp/";
var $version = "1.1";
function ad_ips() {
global $IN, $root_path, $INFO, $DB, $SKIN, $ADMIN, $std, $MEMBER, $GROUP;
switch($IN['code'])
{
case 'news':
$this->news();
break;
case 'updates':
$this->updates();
break;
case 'docs':
$this->docs();
break;
case 'support':
$this->support();
break;
case 'host':
$this->host();
break;
case 'purchase':
$this->purchase();
break;
//-------------------------
default:
exit();
break;
}
}
function news()
{
global $IN, $root_path, $INFO, $DB, $SKIN, $ADMIN, $std, $MEMBER, $GROUP;
@header("Location: ".$this->url."?news");
exit();
}
function updates()
{
global $IN, $root_path, $INFO, $DB, $SKIN, $ADMIN, $std, $MEMBER, $GROUP;
//@header("Location: ".$this->url."?updates&version=".$this->version);
@header("Location: ".$this->url."?updates");
exit();
}
function docs()
{
global $IN, $root_path, $INFO, $DB, $SKIN, $ADMIN, $std, $MEMBER, $GROUP;
@header("Location: ".$this->url."?docs");
exit();
}
function support()
{
global $IN, $root_path, $INFO, $DB, $SKIN, $ADMIN, $std, $MEMBER, $GROUP;
@header("Location: ".$this->url."?support");
exit();
}
function host()
{
global $IN, $root_path, $INFO, $DB, $SKIN, $ADMIN, $std, $MEMBER, $GROUP;
@header("Location: ".$this->url."?host");
exit();
}
function purchase()
{
global $IN, $root_path, $INFO, $DB, $SKIN, $ADMIN, $std, $MEMBER, $GROUP;
@header("Location: ".$this->url."?purchase");
exit();
}
}
?>
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
+283 -281
View File
@@ -1,282 +1,284 @@
<?php
/*
+--------------------------------------------------------------------------
| IBFORUMS v1
| ========================================
| by Matthew Mecham and David Baxter
| (c) 2001,2002 IBForums
| http://www.ibforums.com
| ========================================
| Web: http://www.ibforums.com
| Email: phpboards@ibforums.com
| Licence Info: phpib-licence@ibforums.com
+---------------------------------------------------------------------------
|
| > Import functions
| > Module written by Matt Mecham
| > Date started: 22nd April 2002
|
| > Module Version Number: 1.0.0
+--------------------------------------------------------------------------
*/
// Ensure we've not accessed this script directly:
$idx = new ad_modlogs();
class ad_modlogs {
var $base_url;
function ad_modlogs() {
global $IN, $root_path, $INFO, $DB, $SKIN, $ADMIN, $std, $MEMBER, $GROUP;
switch($IN['code'])
{
case 'view':
$this->view();
break;
case 'remove':
$this->remove();
break;
//-------------------------
default:
$this->list_current();
break;
}
}
//---------------------------------------------
// Remove archived files
//---------------------------------------------
function view()
{
global $IN, $root_path, $INFO, $DB, $SKIN, $ADMIN, $std, $MEMBER, $GROUP;
$start = $IN['st'] ? $IN['st'] : 0;
$ADMIN->page_detail = "Viewing all actions by a moderator";
$ADMIN->page_title = "Moderator Logs Manager";
if ($IN['search_string'] == "")
{
$DB->query("SELECT COUNT(id) as count FROM ibf_moderator_logs WHERE member_id='".$IN['mid']."'");
$row = $DB->fetch_row();
$row_count = $row['count'];
$query = "&act=modlog&mid={$IN['mid']}&code=view";
$DB->query("SELECT m.*, f.id as forum_id, f.name FROM ibf_moderator_logs m, ibf_forums f WHERE m.member_id='".$IN['mid']."' AND f.id=m.forum_id ORDER BY m.ctime DESC LIMIT $start, 20");
}
else
{
$IN['search_string'] = urldecode($IN['search_string']);
if ( ($IN['search_type'] == 'topic_id') or ($IN['search_type'] == 'forum_id') )
{
$dbq = "m.".$IN['search_type']."='".$IN['search_string']."'";
}
else
{
$dbq = "m.".$IN['search_type']." LIKE '%".$IN['search_string']."%'";
}
$DB->query("SELECT COUNT(m.id) as count FROM ibf_moderator_logs m WHERE $dbq");
$row = $DB->fetch_row();
$row_count = $row['count'];
$query = "&act=modlog&code=view&search_type={$IN['search_type']}&search_string=".urlencode($IN['search_string']);
$DB->query("SELECT m.*, f.id as forum_id, f.name FROM ibf_moderator_logs m, ibf_forums f WHERE $dbq AND f.id=m.forum_id ORDER BY m.ctime DESC LIMIT $start, 20");
}
$links = $std->build_pagelinks( array( 'TOTAL_POSS' => $row_count,
'PER_PAGE' => 20,
'CUR_ST_VAL' => $start,
'L_SINGLE' => "Single Page",
'L_MULTI' => "Pages: ",
'BASE_URL' => $ADMIN->base_url.$query,
)
);
$ADMIN->page_detail = "You may view and remove actions performed by your moderators";
$ADMIN->page_title = "Moderator Logs Manager";
//+-------------------------------
$SKIN->td_header[] = array( "Member Name" , "15%" );
$SKIN->td_header[] = array( "Action Perfomed" , "15%" );
$SKIN->td_header[] = array( "Forum" , "15%" );
$SKIN->td_header[] = array( "Topic Title" , "25%" );
$SKIN->td_header[] = array( "Time of action" , "20%" );
$SKIN->td_header[] = array( "IP address" , "10%" );
$ADMIN->html .= $SKIN->start_table( "Saved Moderator Logs" );
$ADMIN->html .= $SKIN->add_td_basic($links, 'center', 'catrow');
if ( $DB->get_num_rows() )
{
while ( $row = $DB->fetch_row() )
{
$row['ctime'] = $std->get_date( $row['ctime'], 'LONG' );
$sess_id = preg_replace( "/^.+?s=(\w{32}).+?$/" , "\\1", $row['http_referer'] );
$row['http_referer'] = preg_replace( "/s=(\w){32}/" , "" , $row['http_referer'] );
$ADMIN->html .= $SKIN->add_td_row( array( "<b>{$row['member_name']}</b>",
"<span style='font-weight:bold;color:red'><a href='#' onClick=\"alert('HTTP REFERRER OF ACTION:\\n{$row['http_referer']}\\nSESSION ID OF ACTION:\\n$sess_id')\">{$row['action']}</a></span>",
"<b>{$row['name']}</b>",
"{$row['topic_title']}",
"{$row['ctime']}",
"{$row['ip_address']}",
) );
}
}
else
{
$ADMIN->html .= $SKIN->add_td_basic("<center>No results</center>");
}
$ADMIN->html .= $SKIN->add_td_basic($links, 'center', 'tdtop');
$ADMIN->html .= $SKIN->end_table();
//+-------------------------------
//+-------------------------------
$ADMIN->output();
}
//---------------------------------------------
// Remove archived files
//---------------------------------------------
function remove()
{
global $IN, $root_path, $INFO, $DB, $SKIN, $ADMIN, $std, $MEMBER, $GROUP;
if ($IN['mid'] == "")
{
$ADMIN->error("You did not select a member ID to remove by!");
}
$DB->query("DELETE FROM ibf_moderator_logs WHERE member_id='".$IN['mid']."'");
$std->boink_it($ADMIN->base_url."&act=modlog");
exit();
}
//-------------------------------------------------------------
// SHOW ALL LANGUAGE PACKS
//-------------------------------------------------------------
function list_current()
{
global $IN, $root_path, $INFO, $DB, $SKIN, $ADMIN, $std, $MEMBER, $GROUP;
$form_array = array();
$ADMIN->page_detail = "You may view and remove actions performed by your moderators";
$ADMIN->page_title = "Moderator Logs Manager";
//+-------------------------------
$SKIN->td_header[] = array( "Member Name" , "30%" );
$SKIN->td_header[] = array( "Actions Perfomed" , "20%" );
$SKIN->td_header[] = array( "View all by member" , "20%" );
$SKIN->td_header[] = array( "Remove all by member" , "30%" );
$ADMIN->html .= $SKIN->start_table( "Saved Moderator Logs" );
$DB->query("SELECT m.*, count(m.id) as act_count from ibf_moderator_logs m GROUP BY m.member_id ORDER BY act_count DESC");
while ( $r = $DB->fetch_row() )
{
$ADMIN->html .= $SKIN->add_td_row( array( "<b>{$r['member_name']}</b>",
"<center>{$r['act_count']}</center>",
"<center><a href='".$SKIN->base_url."&act=modlog&code=view&mid={$r['member_id']}'>View</a></center>",
"<center><a href='".$SKIN->base_url."&act=modlog&code=remove&mid={$r['member_id']}'>Remove</a></center>",
) );
}
$ADMIN->html .= $SKIN->end_table();
//+-------------------------------
//+-------------------------------
$ADMIN->html .= $SKIN->start_form( array( 1 => array( 'code' , 'view' ),
2 => array( 'act' , 'modlog' ),
) );
$SKIN->td_header[] = array( "&nbsp;" , "40%" );
$SKIN->td_header[] = array( "&nbsp;" , "60%" );
$ADMIN->html .= $SKIN->start_table( "Search Moderator Logs" );
$form_array = array(
0 => array( 'topic_title', 'Topic Title' ),
1 => array( 'ip_address', 'IP Address' ),
2 => array( 'member_name', 'Member Name' ),
3 => array( 'topic_id' , 'Topic ID' ),
4 => array( 'forum_id' , 'Forum ID' )
);
//+-------------------------------
$ADMIN->html .= $SKIN->add_td_row( array( "<b>Search for...</b>" ,
$SKIN->form_input( "search_string")
) );
$ADMIN->html .= $SKIN->add_td_row( array( "<b>Search in...</b>" ,
$SKIN->form_dropdown( "search_type", $form_array)
) );
$ADMIN->html .= $SKIN->end_form("Search");
$ADMIN->html .= $SKIN->end_table();
//+-------------------------------
//+-------------------------------
$ADMIN->output();
}
}
<?php
/*
+--------------------------------------------------------------------------
| Invision Board v1.1
| ========================================
| by Matthew Mecham
| (c) 2001,2002 Invision Power Services
| http://www.ibforums.com
| ========================================
| Web: http://www.ibforums.com
| Email: phpboards@ibforums.com
| Licence Info: phpib-licence@ibforums.com
+---------------------------------------------------------------------------
|
| > Import functions
| > Module written by Matt Mecham
| > Date started: 22nd April 2002
|
| > Module Version Number: 1.0.0
+--------------------------------------------------------------------------
*/
// Ensure we've not accessed this script directly:
$idx = new ad_modlogs();
class ad_modlogs {
var $base_url;
function ad_modlogs() {
global $IN, $root_path, $INFO, $DB, $SKIN, $ADMIN, $std, $MEMBER, $GROUP;
switch($IN['code'])
{
case 'view':
$this->view();
break;
case 'remove':
$this->remove();
break;
//-------------------------
default:
$this->list_current();
break;
}
}
//---------------------------------------------
// Remove archived files
//---------------------------------------------
function view()
{
global $IN, $root_path, $INFO, $DB, $SKIN, $ADMIN, $std, $MEMBER, $GROUP;
$start = $IN['st'] ? $IN['st'] : 0;
$ADMIN->page_detail = "Viewing all actions by a moderator";
$ADMIN->page_title = "Moderator Logs Manager";
if ($IN['search_string'] == "")
{
$DB->query("SELECT COUNT(id) as count FROM ibf_moderator_logs WHERE member_id='".$IN['mid']."'");
$row = $DB->fetch_row();
$row_count = $row['count'];
$query = "&act=modlog&mid={$IN['mid']}&code=view";
$DB->query("SELECT m.*, f.id as forum_id, f.name FROM ibf_moderator_logs m, ibf_forums f WHERE m.member_id='".$IN['mid']."' AND f.id=m.forum_id ORDER BY m.ctime DESC LIMIT $start, 20");
}
else
{
$IN['search_string'] = urldecode($IN['search_string']);
if ( ($IN['search_type'] == 'topic_id') or ($IN['search_type'] == 'forum_id') )
{
$dbq = "m.".$IN['search_type']."='".$IN['search_string']."'";
}
else
{
$dbq = "m.".$IN['search_type']." LIKE '%".$IN['search_string']."%'";
}
$DB->query("SELECT COUNT(m.id) as count FROM ibf_moderator_logs m WHERE $dbq");
$row = $DB->fetch_row();
$row_count = $row['count'];
$query = "&act=modlog&code=view&search_type={$IN['search_type']}&search_string=".urlencode($IN['search_string']);
$DB->query("SELECT m.*, f.id as forum_id, f.name FROM ibf_moderator_logs m, ibf_forums f WHERE $dbq AND f.id=m.forum_id ORDER BY m.ctime DESC LIMIT $start, 20");
}
$links = $std->build_pagelinks( array( 'TOTAL_POSS' => $row_count,
'PER_PAGE' => 20,
'CUR_ST_VAL' => $start,
'L_SINGLE' => "Single Page",
'L_MULTI' => "Pages: ",
'BASE_URL' => $ADMIN->base_url.$query,
)
);
$ADMIN->page_detail = "You may view and remove actions performed by your moderators";
$ADMIN->page_title = "Moderator Logs Manager";
//+-------------------------------
$SKIN->td_header[] = array( "Member Name" , "15%" );
$SKIN->td_header[] = array( "Action Perfomed" , "15%" );
$SKIN->td_header[] = array( "Forum" , "15%" );
$SKIN->td_header[] = array( "Topic Title" , "25%" );
$SKIN->td_header[] = array( "Time of action" , "20%" );
$SKIN->td_header[] = array( "IP address" , "10%" );
$ADMIN->html .= $SKIN->start_table( "Saved Moderator Logs" );
$ADMIN->html .= $SKIN->add_td_basic($links, 'center', 'catrow');
if ( $DB->get_num_rows() )
{
while ( $row = $DB->fetch_row() )
{
$row['ctime'] = $std->get_date( $row['ctime'], 'LONG' );
$sess_id = preg_replace( "/^.+?s=(\w{32}).+?$/" , "\\1", $row['http_referer'] );
$row['http_referer'] = preg_replace( "/s=(\w){32}/" , "" , $row['http_referer'] );
$ADMIN->html .= $SKIN->add_td_row( array( "<b>{$row['member_name']}</b>",
"<span style='font-weight:bold;color:red'><a href='#' onClick=\"alert('HTTP REFERRER OF ACTION:\\n{$row['http_referer']}\\nSESSION ID OF ACTION:\\n$sess_id')\">{$row['action']}</a></span>",
"<b>{$row['name']}</b>",
"{$row['topic_title']}",
"{$row['ctime']}",
"{$row['ip_address']}",
) );
}
}
else
{
$ADMIN->html .= $SKIN->add_td_basic("<center>No results</center>");
}
$ADMIN->html .= $SKIN->add_td_basic($links, 'center', 'tdtop');
$ADMIN->html .= $SKIN->end_table();
//+-------------------------------
//+-------------------------------
$ADMIN->output();
}
//---------------------------------------------
// Remove archived files
//---------------------------------------------
function remove()
{
global $IN, $root_path, $INFO, $DB, $SKIN, $ADMIN, $std, $MEMBER, $GROUP;
if ($IN['mid'] == "")
{
$ADMIN->error("You did not select a member ID to remove by!");
}
$DB->query("DELETE FROM ibf_moderator_logs WHERE member_id='".$IN['mid']."'");
$ADMIN->save_log("Removed Moderator Logs");
$std->boink_it($ADMIN->base_url."&act=modlog");
exit();
}
//-------------------------------------------------------------
// SHOW ALL LANGUAGE PACKS
//-------------------------------------------------------------
function list_current()
{
global $IN, $root_path, $INFO, $DB, $SKIN, $ADMIN, $std, $MEMBER, $GROUP;
$form_array = array();
$ADMIN->page_detail = "You may view and remove actions performed by your moderators";
$ADMIN->page_title = "Moderator Logs Manager";
//+-------------------------------
$SKIN->td_header[] = array( "Member Name" , "30%" );
$SKIN->td_header[] = array( "Actions Perfomed" , "20%" );
$SKIN->td_header[] = array( "View all by member" , "20%" );
$SKIN->td_header[] = array( "Remove all by member" , "30%" );
$ADMIN->html .= $SKIN->start_table( "Saved Moderator Logs" );
$DB->query("SELECT m.*, count(m.id) as act_count from ibf_moderator_logs m GROUP BY m.member_id ORDER BY act_count DESC");
while ( $r = $DB->fetch_row() )
{
$ADMIN->html .= $SKIN->add_td_row( array( "<b>{$r['member_name']}</b>",
"<center>{$r['act_count']}</center>",
"<center><a href='".$SKIN->base_url."&act=modlog&code=view&mid={$r['member_id']}'>View</a></center>",
"<center><a href='".$SKIN->base_url."&act=modlog&code=remove&mid={$r['member_id']}'>Remove</a></center>",
) );
}
$ADMIN->html .= $SKIN->end_table();
//+-------------------------------
//+-------------------------------
$ADMIN->html .= $SKIN->start_form( array( 1 => array( 'code' , 'view' ),
2 => array( 'act' , 'modlog' ),
) );
$SKIN->td_header[] = array( "&nbsp;" , "40%" );
$SKIN->td_header[] = array( "&nbsp;" , "60%" );
$ADMIN->html .= $SKIN->start_table( "Search Moderator Logs" );
$form_array = array(
0 => array( 'topic_title', 'Topic Title' ),
1 => array( 'ip_address', 'IP Address' ),
2 => array( 'member_name', 'Member Name' ),
3 => array( 'topic_id' , 'Topic ID' ),
4 => array( 'forum_id' , 'Forum ID' )
);
//+-------------------------------
$ADMIN->html .= $SKIN->add_td_row( array( "<b>Search for...</b>" ,
$SKIN->form_input( "search_string")
) );
$ADMIN->html .= $SKIN->add_td_row( array( "<b>Search in...</b>" ,
$SKIN->form_dropdown( "search_type", $form_array)
) );
$ADMIN->html .= $SKIN->end_form("Search");
$ADMIN->html .= $SKIN->end_table();
//+-------------------------------
//+-------------------------------
$ADMIN->output();
}
}
?>
+985
View File
@@ -0,0 +1,985 @@
<?php
/*
+--------------------------------------------------------------------------
| Invision Board v1.1
| ========================================
| by Matthew Mecham
| (c) 2001,2002 Invision Power Services
| http://www.ibforums.com
| ========================================
| Web: http://www.ibforums.com
| Email: phpboards@ibforums.com
| Licence Info: phpib-licence@ibforums.com
+---------------------------------------------------------------------------
|
| > mySQL Admin Stuff
| > Module written by Matt Mecham
| > Date started: 21st October 2002
|
| > Module Version Number: 1.0.0
| > Music listen to when coding this: Martin Grech - Open Heart Zoo
| > Talk about useless information!
+--------------------------------------------------------------------------
*/
// Ensure we've not accessed this script directly:
@set_time_limit(1200);
$idx = new ad_mysql();
class ad_mysql {
var $base_url;
var $mysql_version = "";
var $true_version = "";
var $str_gzip_header = "\x1f\x8b\x08\x00\x00\x00\x00\x00";
function ad_mysql() {
global $IN, $root_path, $INFO, $DB, $SKIN, $ADMIN, $std, $MEMBER, $GROUP, $HTTP_POST_VARS, $HTTP_GET_VARS;
// Make sure we're a root admin, or else!
if ($MEMBER['mgroup'] != $INFO['admin_group'])
{
$ADMIN->error("Sorry, these functions are for the root admin group only");
}
//---------------------------------------
// Get the mySQL version.
// Adapted from phpMyAdmin
//---------------------------------------
$DB->query("SELECT VERSION() AS version");
if ( ! $row = $DB->fetch_row() )
{
$DB->query("SHOW VARIABLES LIKE 'version'");
$row = $DB->fetch_row();
}
$this->true_version = $row['version'];
$no_array = explode( '.', preg_replace( "/^(.+?)[-_]?/", "\\1", $row['version']) );
$one = (!isset($no_array) || !isset($no_array[0])) ? 3 : $no_array[0];
$two = (!isset($no_array[1])) ? 21 : $no_array[1];
$three = (!isset($no_array[2])) ? 0 : $no_array[2];
$this->mysql_version = (int)sprintf('%d%02d%02d', $one, $two, intval($three));
switch($IN['code'])
{
case 'dotool':
$this->run_tool();
break;
case 'runtime':
$this->view_sql("SHOW STATUS");
break;
case 'system':
$this->view_sql("SHOW VARIABLES");
break;
case 'processes':
$this->view_sql("SHOW PROCESSLIST");
break;
case 'runsql':
$q = $HTTP_POST_VARS['query'] == "" ? $HTTP_GET_VARS['query'] : $HTTP_POST_VARS['query'];
$this->view_sql(trim(urldecode(stripslashes($q))));
break;
case 'backup':
$this->show_backup_form();
break;
case 'safebackup':
$this->sbup_splash();
break;
case 'dosafebackup':
$this->do_safe_backup();
break;
case 'export_tbl':
$this->do_safe_backup(trim(urldecode(stripslashes($HTTP_GET_VARS['tbl']))));
break;
//-------------------------
default:
$this->list_index();
break;
}
}
//-----------------------------------------------
// Back up baby, back up
//-----------------------------------------------
function do_safe_backup($tbl_name="")
{
global $IN, $root_path, $INFO, $DB, $SKIN, $ADMIN, $std, $MEMBER, $GROUP;
if ($tbl_name == "")
{
// Auto all tables
$skip = intval($IN['skip']);
$create_tbl = intval($IN['create_tbl']);
$enable_gzip = intval($IN['enable_gzip']);
$filename = 'ibf_dbbackup';
}
else
{
// Man. click export
$skip = 0;
$create_tbl = 0;
$enable_gzip = 1;
$filename = $tbl_name;
}
$output = "";
@header("Pragma: no-cache");
$do_gzip = 0;
if( $enable_gzip )
{
$phpver = phpversion();
if($phpver >= "4.0")
{
if(extension_loaded("zlib"))
{
$do_gzip = 1;
}
}
}
if( $do_gzip != 0 )
{
@ob_start();
@ob_implicit_flush(0);
header("Content-Type: text/x-delimtext; name=\"$filename.sql.gz\"");
header("Content-disposition: attachment; filename=$filename.sql.gz");
}
else
{
header("Content-Type: text/x-delimtext; name=\"$filename.sql\"");
header("Content-disposition: attachment; filename=$filename.sql");
}
//-----------------------------
// Get tables to work on
//-----------------------------
if ($tbl_name == "")
{
$tmp_tbl = $DB->get_table_names();
foreach($tmp_tbl as $tbl)
{
// Ensure that we're only peeking at IBF tables
if ( preg_match( "/^".$INFO['sql_tbl_prefix']."/", $tbl ) )
{
// We've started our headers, so print as we go to stop
// poss memory problems
$this->get_table_sql($tbl, $create_tbl, $skip);
}
}
}
else
{
$this->get_table_sql($tbl_name, $create_tbl, $skip);
}
//-----------------------------
// GZIP?
//-----------------------------
if($do_gzip)
{
$size = ob_get_length();
$crc = crc32(ob_get_contents());
$contents = gzcompress(ob_get_contents());
ob_end_clean();
echo $this->str_gzip_header
.substr($contents, 0, strlen($contents) - 4)
.$this->gzip_four_chars($crc)
.$this->gzip_four_chars($size);
}
exit();
}
//-----------------------------------------------
// Internal handler to return content from table
//-----------------------------------------------
function get_table_sql($tbl, $create_tbl, $skip=0)
{
global $IN, $root_path, $INFO, $DB, $SKIN, $ADMIN, $std, $MEMBER, $GROUP;
if ($create_tbl)
{
// Generate table structure
$DB->query("SHOW CREATE TABLE ".$INFO['sql_database'].".".$tbl);
$ctable = $DB->fetch_row();
echo $this->sql_strip_ticks($ctable['Create Table']).";\n";
}
// Are we skipping? Woohoo, where's me rope?!
if ($skip == 1)
{
if ($tbl == $INFO['sql_database'].'admin_sessions'
OR $tbl == $INFO['sql_database'].'sessions'
OR $tbl == $INFO['sql_database'].'reg_anti_spam'
OR $tbl == $INFO['sql_database'].'search_results'
)
{
return $ret;
}
}
// Get the data
$DB->query("SELECT * FROM $tbl");
// Check to make sure rows are in this
// table, if not return.
$row_count = $DB->get_num_rows();
if ($row_count < 1)
{
return TRUE;
}
//---------------------------
// Get col names
//---------------------------
$f_list = "";
$fields = $DB->get_result_fields();
$cnt = count($fields);
for( $i = 0; $i < $cnt; $i++ )
{
$f_list .= $fields[$i]->name . ", ";
}
$f_list = preg_replace( "/, $/", "", $f_list );
while ( $row = $DB->fetch_row() )
{
//---------------------------
// Get col data
//---------------------------
$d_list = "";
for( $i = 0; $i < $cnt; $i++ )
{
if ( ! isset($row[ $fields[$i]->name ]) )
{
$d_list .= "NULL,";
}
elseif ( $row[ $fields[$i]->name ] != '' )
{
$d_list .= "'".$this->sql_add_slashes($row[ $fields[$i]->name ]). "',";
}
else
{
$d_list .= "'',";
}
}
$d_list = preg_replace( "/,$/", "", $d_list );
echo "INSERT INTO $tbl ($f_list) VALUES($d_list);\n";
}
return TRUE;
}
//-----------------------------------------------
// sql_strip_ticks from field names
//-----------------------------------------------
function sql_strip_ticks($data)
{
return str_replace( "`", "", $data );
}
//-----------------------------------------------
// Add slashes to single quotes to stop sql breaks
//-----------------------------------------------
function sql_add_slashes($data)
{
$data = str_replace('\\', '\\\\', $data);
$data = str_replace('\'', '\\\'', $data);
$data = str_replace("\r", '\r' , $data);
$data = str_replace("\n", '\n' , $data);
return $data;
}
//-----------------------------------------------
// Almost there!
//-----------------------------------------------
function sbup_splash()
{
global $IN, $root_path, $INFO, $DB, $SKIN, $ADMIN, $std, $MEMBER, $GROUP;
$ADMIN->page_detail = "This section allows you to backup your database.";
$ADMIN->page_title = "mySQL ".$this->true_version." Back Up";
// Check for mySQL version..
// Might change at some point..
if ( $this->mysql_version < 32321 )
{
$ADMIN->error("Sorry, mySQL version of less than 3.23.21 are not support by this backup utility");
}
$SKIN->td_header[] = array( "&nbsp;" , "100%" );
$ADMIN->html .= $SKIN->start_table( "Simple Back Up" );
$ADMIN->html .= $SKIN->add_td_row( array(
"<b>Back Up mySQL Database</b><br><br>Once you have clicked the link below, please wait
until your browser prompts you with a dialogue box. This may take some time depending on
the size of the database you are backing up.
<br><br>
<b><a href='{$ADMIN->base_url}&act=mysql&code=dosafebackup&create_tbl={$IN['create_tbl']}&skip={$IN['skip']}&enable_gzip={$IN['enable_gzip']}'>Click here to start the backup</a></b>"
) );
$ADMIN->html .= $SKIN->end_table();
$ADMIN->output();
}
function show_backup_form()
{
global $IN, $root_path, $INFO, $DB, $SKIN, $ADMIN, $std, $MEMBER, $GROUP;
$ADMIN->page_detail = "This section allows you to backup your database.
<br><br><b>Simple Backup</b>
<br>This function compiles a single back up file and prompts a browser dialogue box for you to save
the file. This is beneficial for PHP safe mode enabled hosts, but can only be used on small databases.
<!--<br><br>
<b>Advanced Backup</b>
<br>This function allows you to split the backup into smaller sections and saves the backup to disk.
<br>Note, this can only be used if you do not have PHP safe mode enabled.-->";
$ADMIN->page_title = "mySQL ".$this->true_version." Back Up";
// Check for mySQL version..
// Might change at some point..
if ( $this->mysql_version < 32321 )
{
$ADMIN->error("Sorry, mySQL version of less than 3.23.21 are not support by this backup utility");
}
$SKIN->td_header[] = array( "&nbsp;" , "60%" );
$SKIN->td_header[] = array( "&nbsp;" , "40%" );
$ADMIN->html .= $SKIN->start_form( array( 1 => array( 'act' , 'mysql' ),
2 => array( 'code' , 'safebackup'),
) );
$ADMIN->html .= $SKIN->start_table( "Simple Back Up" );
$ADMIN->html .= $SKIN->add_td_row( array(
"<b>Add 'CREATE TABLE' statements?</b>",
$SKIN->form_yes_no( 'create_tbl', 1),
) );
$ADMIN->html .= $SKIN->add_td_row( array(
"<b>Skip non essential data?</b><br>Will not produce insert rows for ibf_sessions, ibf_admin_sessions, ibf_search_results, ibf_reg_anti_spam.",
$SKIN->form_yes_no( 'skip', 1),
) );
$ADMIN->html .= $SKIN->add_td_row( array(
"<b>GZIP Content?</b><br>Will produce a smaller file if GZIP is enabled.",
$SKIN->form_yes_no( 'enable_gzip', 1),
) );
$ADMIN->html .= $SKIN->end_form("Start Back Up");
$ADMIN->html .= $SKIN->end_table();
$ADMIN->output();
}
//-------------------------
// Run mySQL queries
//-------------------------
function view_sql($sql)
{
global $IN, $root_path, $INFO, $DB, $SKIN, $ADMIN, $std, $MEMBER, $GROUP;
$limit = 50;
$start = intval($IN['st']) == "" ? 0 : intval($IN['st']);
$pages = "";
$ADMIN->page_detail = "This section allows you to administrate your mySQL database.$extra";
$ADMIN->page_title = "mySQL ".$this->true_version." Tool Box";
$map = array( 'processes' => "SQL Processes",
'runtime' => "SQL Runtime Information",
'system' => "SQL System Variables",
);
if ($map[ $IN['code'] ] != "")
{
$tbl_title = $map[ $IN['code'] ];
$man_query = 0;
}
else
{
$tbl_title = "Manual Query";
$man_query = 1;
}
//------------------------------------------------
if ($man_query == 1)
{
$SKIN->td_header[] = array( "&nbsp;" , "100%" );
$ADMIN->html .= $SKIN->start_form( array( 1 => array( 'act' , 'mysql' ),
2 => array( 'code' , 'runsql'),
) );
$ADMIN->html .= $SKIN->start_table( "Run Query" );
$ADMIN->html .= $SKIN->add_td_row( array( "<center>".$SKIN->form_textarea("query", $sql )."</center>" ) );
$ADMIN->html .= $SKIN->end_form("Run a New Query");
$ADMIN->html .= $SKIN->end_table();
// Check for drop, create and flush
if ( preg_match( "/^DROP|CREATE|FLUSH/i", trim($sql) ) )
{
$ADMIN->error = "Sorry, those queries are not allowed for your safety";
}
}
//------------------------------------------------
$DB->return_die = 1;
$DB->query($sql);
// Check for errors..
if ( $DB->error != "")
{
$SKIN->td_header[] = array( "&nbsp;" , "100%" );
$ADMIN->html .= $SKIN->start_table( "SQL Error" );
$ADMIN->html .= $SKIN->add_td_row( array($DB->error) );
$ADMIN->html .= $SKIN->end_table();
$ADMIN->output(); // End output and script
}
if ( preg_match( "/^INSERT|UPDATE|DELETE|ALTER/i", trim($sql) ) )
{
// We can't show any info, and if we're here, there isn't
// an error, so we're good to go.
$SKIN->td_header[] = array( "&nbsp;" , "100%" );
$ADMIN->html .= $SKIN->start_table( "SQL Query Completed" );
$ADMIN->html .= $SKIN->add_td_row( array("Query: $sql<br>Executed Successfully") );
$ADMIN->html .= $SKIN->end_table();
$ADMIN->output(); // End output and script
}
else if ( preg_match( "/^SELECT/i", $sql ) )
{
// Sort out the pages and stuff
// auto limit if need be
if ( ! preg_match( "/LIMIT[ 0-9,]+$/i", $sql ) )
{
$rows_returned = $DB->get_num_rows();
if ($rows_returned > $limit)
{
// Get tbl name
//$tbl_name = preg_replace( "/(".$INFO['sql_tbl_prefix']."\S+?)([\s\.,]|$)/i", "\\1", $sql );
// Set up pages.
$links = $std->build_pagelinks( array( 'TOTAL_POSS' => $rows_returned,
'PER_PAGE' => $limit,
'CUR_ST_VAL' => $start,
'L_SINGLE' => "Single Page",
'L_MULTI' => "Pages: ",
'BASE_URL' => $ADMIN->base_url."&act=mysql&code=runsql&query=".urlencode($sql),
)
);
$sql .= " LIMIT $start, $limit";
// Re-run with limit
$DB->query($sql);
}
}
}
$fields = $DB->get_result_fields();
$cnt = count($fields);
// Print the headers - we don't what or how many so...
for( $i = 0; $i < $cnt; $i++ )
{
$SKIN->td_header[] = array( $fields[$i]->name , "*" );
}
$ADMIN->html .= $SKIN->start_table( "Result: ".$tbl_title );
if ($links != "")
{
$pages = $SKIN->add_td_basic( $links, 'left', 'tdrow2' );
$ADMIN->html .= $pages;
}
while( $r = $DB->fetch_row() )
{
// Grab the rows - we don't what or how many so...
$rows = array();
for( $i = 0; $i < $cnt; $i++ )
{
if ($man_query == 1)
{
// Limit output
if ( strlen($r[ $fields[$i]->name ]) > 200 )
{
$r[ $fields[$i]->name ] = substr($r[ $fields[$i]->name ], 0, 200) .'...';
}
}
$rows[] = wordwrap( htmlspecialchars(nl2br($r[ $fields[$i]->name ])) , 50, "<br>", 1 );
}
$ADMIN->html .= $SKIN->add_td_row( $rows );
}
$ADMIN->html .= $SKIN->end_table();
//+-------------------------------
$ADMIN->output();
}
//-------------------------------------------------------------
// I'm A TOOL!
//-------------------------------------------------------------
function run_tool()
{
global $IN, $root_path, $INFO, $DB, $SKIN, $ADMIN, $std, $MEMBER, $GROUP;
$ADMIN->page_detail = "This section allows you to administrate your mySQL database.$extra";
$ADMIN->page_title = "mySQL ".$this->true_version." Tool Box";
//-------------------------------------------------------------
// have we got some there tables me laddo?
//-------------------------------------------------------------
$tables = array();
foreach ($IN as $key => $value)
{
if ( preg_match( "/^tbl_(\S+)$/", $key, $match ) )
{
if ($IN[$match[0]])
{
$tables[] = $match[1];
}
}
}
if ( count($tables) < 1 )
{
$ADMIN->error("You must choose some tables to run this tool on or it's just plain outright silly");
}
//-------------------------------------------------------------
// What tool is one running?
// optimize analyze check repair
//-------------------------------------------------------------
if (strtoupper($IN['tool']) == 'DROP' || strtoupper($IN['tool']) == 'CREATE' || strtoupper($IN['tool']) == 'FLUSH')
{
$ADMIN->error("You can't do that, sorry");
}
foreach($tables as $table)
{
$DB->query(strtoupper($IN['tool'])." TABLE $table");
$fields = $DB->get_result_fields();
$data = $DB->fetch_row();
$cnt = count($fields);
// Print the headers - we don't what or how many so...
for( $i = 0; $i < $cnt; $i++ )
{
$SKIN->td_header[] = array( $fields[$i]->name , "*" );
}
$ADMIN->html .= $SKIN->start_table( "Result: ".$IN['tool']." ".$table );
// Grab the rows - we don't what or how many so...
$rows = array();
for( $i = 0; $i < $cnt; $i++ )
{
$rows[] = $data[ $fields[$i]->name ];
}
$ADMIN->html .= $SKIN->add_td_row( $rows );
$ADMIN->html .= $SKIN->end_table();
}
//+-------------------------------
$ADMIN->output();
}
//-------------------------------------------------------------
// SHOW ALL TABLES AND STUFF!
// 5 hours ago this seemed like a damned good idea.
// Now it's late and I want to replace all of this code with
// header("Location: http://yoursite/phpmyadmin");
//-------------------------------------------------------------
function list_index()
{
global $IN, $root_path, $INFO, $DB, $SKIN, $ADMIN, $std, $MEMBER, $GROUP;
$form_array = array();
if ( $this->mysql_version < 32322 )
{
$extra = "<br><b>Note: your version of mySQL has a limited feature set and some tools have been removed</b>";
}
$ADMIN->page_detail = "This section allows you to administrate your mySQL database.$extra";
$ADMIN->page_title = "mySQL ".$this->true_version." Tool Box";
//+-------------------------------
// Show advanced stuff for mySQL > 3.23.03
//+-------------------------------
$idx_size = 0;
$tbl_size = 0;
$ADMIN->html .= "
<script language='Javascript'>
<!--
function CheckAll(cb) {
var fmobj = document.theForm;
for (var i=0;i<fmobj.elements.length;i++) {
var e = fmobj.elements[i];
if ((e.name != 'allbox') && (e.type=='checkbox') && (!e.disabled)) {
e.checked = fmobj.allbox.checked;
}
}
}
function CheckCheckAll(cb) {
var fmobj = document.theForm;
var TotalBoxes = 0;
var TotalOn = 0;
for (var i=0;i<fmobj.elements.length;i++) {
var e = fmobj.elements[i];
if ((e.name != 'allbox') && (e.type=='checkbox')) {
TotalBoxes++;
if (e.checked) {
TotalOn++;
}
}
}
if (TotalBoxes==TotalOn) {fmobj.allbox.checked=true;}
else {fmobj.allbox.checked=false;}
}
//-->
</script>
";
$ADMIN->html .= $SKIN->start_form( array( 1 => array( 'act' , 'mysql' ),
2 => array( 'code' , 'dotool'),
) , "theForm" );
if ( $this->mysql_version >= 32303 )
{
$SKIN->td_header[] = array( "Table" , "20%" );
$SKIN->td_header[] = array( "Rows" , "10%" );
$SKIN->td_header[] = array( "TBL Size" , "20%" );
$SKIN->td_header[] = array( "Index Size" , "20%" );
$SKIN->td_header[] = array( "Export" , "10%" );
$SKIN->td_header[] = array( '<input name="allbox" type="checkbox" value="Check All" onClick="CheckAll();">' , "10%" );
$ADMIN->html .= $SKIN->start_table( "Invision Board Tables" );
$DB->query("SHOW TABLE STATUS FROM ".$INFO['sql_database']);
while ( $r = $DB->fetch_row() )
{
// Check to ensure it's a table for this install...
if ( ! preg_match( "/^".$INFO['sql_tbl_prefix']."/", $r['Name'] ) )
{
continue;
}
$idx_size += $r['Index_length'];
$tbl_size += $r['Data_length'];
$iBit = ($r['Index_length'] > 0) ? 1 : 0;
$tBit = ($r['Data_length'] > 0) ? 1 : 0;
$idx = $this->gen_size( $r['Index_length'], 3, $iBit );
$tbl = $this->gen_size( $r['Data_length'] , 3, $tBit );
$ADMIN->html .= $SKIN->add_td_row( array( "<b><span style='font-size:12px'><a href='{$SKIN->base_url}&act=mysql&code=runsql&query=".urlencode("SELECT * FROM {$r['Name']}")."'>{$r['Name']}</a></span></b>",
"<center>{$r['Rows']}</center>",
"<div align='right'><span style='color:blue;font-size:12px'>{$tbl[0]} {$tbl[1]}</span></div>",
"<div align='right'>{$idx[0]} {$idx[1]}</div>",
"<center><a href='{$SKIN->base_url}&act=mysql&code=export_tbl&tbl={$r['Name']}'>Export</a></center></b>",
"<center><input name=\"tbl_{$r['Name']}\" value=1 type='checkbox' onClick=\"CheckCheckAll();\"></center>",
) );
}
$total = $idx_size + $tbl_size;
$iBit = ($idx_size > 0) ? 1 : 0;
$tBit = ($tbl_size > 0) ? 1 : 0;
$oBit = ($total > 0) ? 1 : 0;
$idx = $this->gen_size( $idx_size , 3, $iBit );
$tbl = $this->gen_size( $tbl_size , 3, $tBit );
$tot = $this->gen_size( $total , 3, $oBit );
$ADMIN->html .= $SKIN->add_td_row( array ("&nbsp;",
"<div align='right'>Totals (<b>{$tot[0]} {$tot[1]}</b>)</div>",
"<div align='right'><b>{$tbl[0]} {$tbl[1]}</b></div>",
"<div align='right'><b>{$idx[0]} {$idx[1]}</b></div>",
"&nbsp;",
) );
}
else
{
// display a basic information table
$SKIN->td_header[] = array( "Table" , "60%" );
$SKIN->td_header[] = array( "Rows" , "30%" );
$SKIN->td_header[] = array( '<input name="allbox" type="checkbox" value="Check All" onClick="CheckAll();">' , "10%" );
$ADMIN->html .= $SKIN->start_table( "Invision Board Tables" );
$tables = $DB->get_table_names();
foreach($tables as $tbl)
{
// Ensure that we're only peeking at IBF tables
if ( ! preg_match( "/^".$INFO['sql_tbl_prefix']."/", $tbl ) )
{
continue;
}
$DB->query("SELECT COUNT(*) AS Rows FROM $tbl");
$cnt = $DB->fetch_row();
$ADMIN->html .= $SKIN->add_td_row( array( "<b><span style='font-size:12px'>$tbl</span></b>",
"<center>{$cnt['Rows']}</center>",
"<center><input name='tbl_$tbl' type='checkbox' onClick=\"CheckCheckAll(this);\"></center>",
) );
}
}
//----------------------------
// Add in the bottom stuff
//----------------------------
if ( $this->mysql_version < 32322 )
{
$ADMIN->html .= $SKIN->add_td_basic( "<select id='button' name='tool'>
<option value='optimize'>Optimize Selected Tables</option>
</select>
<input type='submit' value='Go!' id='button'></form>", "center", "tdrow2" );
}
else
{
$ADMIN->html .= $SKIN->add_td_basic( "<select id='button' name='tool'>
<option value='optimize'>Optimize Selected Tables</option>
<option value='repair'>Repair Selected Tables</option>
<option value='check'>Check Selected Tables</option>
<option value='analyze'>Analyze Selected Tables</option>
</select>
<input type='submit' value='Go!' id='button'></form>", "center", "tdrow2" );
}
$ADMIN->html .= $SKIN->end_table();
//----------------------------
$ADMIN->html .= $SKIN->start_form( array( 1 => array( 'act' , 'mysql' ),
2 => array( 'code' , 'runsql'),
) );
$SKIN->td_header[] = array( "Table" , "30%" );
$SKIN->td_header[] = array( "Rows" , "70%" );
$ADMIN->html .= $SKIN->start_table( "Run a Query" );
$ADMIN->html .= $SKIN->add_td_row( array( "<b>Manual Query</b><br>Advanced Users Only",
$SKIN->form_textarea("query", "" ),
) );
$ADMIN->html .= $SKIN->end_form("Run Query");
$ADMIN->html .= $SKIN->end_table();
//+-------------------------------
$ADMIN->output();
}
//-------------------------------------------------------------
// Convert chars into byte sizes
// (Based on a similar function in phpmyadmin)
// "Based on?" my ass!
// Ok, so I pretty much cut n' pasted it - but it's late and I
// have to get this done.
// I did make it pretty though - does that count?
// Oh CMON! A zillion lines of new code and you can't get over
// a few lines "borrowed" from another script?
//-------------------------------------------------------------
function gen_size($val, $li, $sepa )
{
$sep = pow(10, $sepa);
$li = pow(10, $li);
$retval = $val;
$unit = 'Bytes';
if ($val >= $li * 1000000)
{
$val = round( $val / (1073741824/$sep) ) / $sep;
$unit = 'GB';
}
else if ($val >= $li*1000)
{
$val = round( $val / (1048576/$sep) ) / $sep;
$unit = 'MB';
}
else if ($val >= $li)
{
$val = round( $val / (1024/$sep) ) / $sep;
$unit = 'KB';
}
if ($unit != 'Bytes')
{
$retval = number_format($val, $sepa, '.', ',');
}
else
{
$retval = number_format($val, 0, '.', ',');
}
return array($retval, $unit);
}
function gzip_four_chars($val)
{
for ($i = 0; $i < 4; $i ++)
{
$return .= chr($val % 256);
$val = floor($val / 256);
}
return $return;
}
}
?>
+442
View File
@@ -0,0 +1,442 @@
<?php
/*
+--------------------------------------------------------------------------
| Invision Board v1.1
| ========================================
| by Matthew Mecham
| (c) 2001,2002 Invision Power Services
| http://www.ibforums.com
| ========================================
| Web: http://www.ibforums.com
| Email: phpboards@ibforums.com
| Licence Info: phpib-licence@ibforums.com
+---------------------------------------------------------------------------
|
| > Custom profile field functions
| > Module written by Matt Mecham
| > Date started: 24th June 2002
|
| > Module Version Number: 1.0.0
+--------------------------------------------------------------------------
*/
$idx = new ad_fields();
class ad_fields {
var $base_url;
function ad_fields() {
global $IN, $root_path, $INFO, $DB, $SKIN, $ADMIN, $std, $MEMBER, $GROUP;
switch($IN['code'])
{
case 'add':
$this->main_form('add');
break;
case 'doadd':
$this->main_save('add');
break;
case 'edit':
$this->main_form('edit');
break;
case 'doedit':
$this->main_save('edit');
break;
case 'delete':
$this->delete_form();
break;
case 'dodelete':
$this->do_delete();
break;
default:
$this->main_screen();
break;
}
}
//+---------------------------------------------------------------------------------
//
// Delete a group
//
//+---------------------------------------------------------------------------------
function delete_form()
{
global $IN, $root_path, $INFO, $DB, $SKIN, $ADMIN, $std, $MEMBER, $GROUP;
if ($IN['id'] == "")
{
$ADMIN->error("Could not resolve the group ID, please try again");
}
$ADMIN->page_title = "Deleting a Custom Profile Field";
$ADMIN->page_detail = "Please check to ensure that you are attempting to remove the correct custom profile field as <b>all data will be lost!</b>.";
//+-------------------------------
$DB->query("SELECT ftitle, fid FROM ibf_pfields_data WHERE fid='".$IN['id']."'");
if ( ! $field = $DB->fetch_row() )
{
$ADMIN->error("Could not fetch the row from the database");
}
$ADMIN->html .= $SKIN->start_form( array( 1 => array( 'code' , 'dodelete' ),
2 => array( 'act' , 'field' ),
3 => array( 'id' , $IN['id'] ),
) );
//+-------------------------------
$SKIN->td_header[] = array( "&nbsp;" , "40%" );
$SKIN->td_header[] = array( "&nbsp;" , "60%" );
//+-------------------------------
$ADMIN->html .= $SKIN->start_table( "Removal Confirmation" );
$ADMIN->html .= $SKIN->add_td_row( array( "<b>Custom Profile field to remove</b>" ,
"<b>".$field['ftitle']."</b>",
) );
$ADMIN->html .= $SKIN->end_form("Delete this custom field");
$ADMIN->html .= $SKIN->end_table();
$ADMIN->output();
}
function do_delete()
{
global $IN, $root_path, $INFO, $DB, $SKIN, $ADMIN, $std, $MEMBER, $GROUP;
if ($IN['id'] == "")
{
$ADMIN->error("Could not resolve the field ID, please try again");
}
// Check to make sure that the relevant groups exist.
$DB->query("SELECT ftitle, fid FROM ibf_pfields_data WHERE fid='".$IN['id']."'");
if ( ! $row = $DB->fetch_row() )
{
$ADMIN->error("Could not resolve the ID's passed to deletion");
}
$DB->query("ALTER TABLE ibf_pfields_content DROP field_{$row['fid']}");
$DB->query("DELETE FROM ibf_pfields_data WHERE fid='".$IN['id']."'");
$ADMIN->done_screen("Profile Field Removed", "Custom Profile Field Control", "act=field" );
}
//+---------------------------------------------------------------------------------
//
// Save changes to DB
//
//+---------------------------------------------------------------------------------
function main_save($type='edit')
{
global $IN, $root_path, $INFO, $DB, $SKIN, $ADMIN, $std, $MEMBER, $GROUP, $HTTP_POST_VARS;
if ($IN['ftitle'] == "")
{
$ADMIN->error("You must enter a field title.");
}
if ($type == 'edit')
{
if ($IN['id'] == "")
{
$ADMIN->error("Could not resolve the field id");
}
}
$content = "";
if ($HTTP_POST_VARS['fcontent'] != "")
{
$content = str_replace( "\n", '|', str_replace( "\n\n", "\n", trim($HTTP_POST_VARS['fcontent']) ) );
}
$db_string = array( 'ftitle' => $IN['ftitle'],
'fdesc' => $IN['fdesc'],
'fcontent' => stripslashes($content),
'ftype' => $IN['ftype'],
'freq' => $IN['freq'],
'fhide' => $IN['fhide'],
'fmaxinput' => $IN['fmaxinput'],
'fedit' => $IN['fedit'],
'forder' => $IN['forder'],
'fshowreg' => $IN['fshowreg'],
);
if ($type == 'edit')
{
$rstring = $DB->compile_db_update_string( $db_string );
$DB->query("UPDATE ibf_pfields_data SET $rstring WHERE fid='".$IN['id']."'");
$ADMIN->done_screen("Profile Field Edited", "Custom Profile Field Control", "act=field" );
}
else
{
$rstring = $DB->compile_db_insert_string( $db_string );
$DB->query("INSERT INTO ibf_pfields_data (" .$rstring['FIELD_NAMES']. ") VALUES (". $rstring['FIELD_VALUES'] .")");
$new_id = $DB->get_insert_id();
$DB->query("ALTER TABLE ibf_pfields_content ADD field_$new_id text default ''");
$DB->query("OPTIMIZE TABLE ibf_pfields_content");
$ADMIN->done_screen("Profile Field Added", "Custom Profile Field Control", "act=field" );
}
}
//+---------------------------------------------------------------------------------
//
// Add / edit group
//
//+---------------------------------------------------------------------------------
function main_form($type='edit')
{
global $IN, $root_path, $INFO, $DB, $SKIN, $ADMIN, $std, $MEMBER, $GROUP;
if ($type == 'edit')
{
if ($IN['id'] == "")
{
$ADMIN->error("No group id to select from the database, please try again.");
}
$form_code = 'doedit';
$button = 'Complete Edit';
}
else
{
$form_code = 'doadd';
$button = 'Add Field';
}
if ($IN['id'] != "")
{
$DB->query("SELECT * FROM ibf_pfields_data WHERE fid='".$IN['id']."'");
$fields = $DB->fetch_row();
}
else
{
$fields = array();
}
if ($type == 'edit')
{
$ADMIN->page_title = "Editing Profile Field ".$fields['ftitle'];
}
else
{
$ADMIN->page_title = 'Adding a new profile field';
$fields['ftitle'] = '';
}
$ADMIN->page_detail = "Please double check the information before submitting the form.";
$ADMIN->html .= $SKIN->start_form( array( 1 => array( 'code' , $form_code ),
2 => array( 'act' , 'field' ),
3 => array( 'id' , $IN['id'] ),
) );
$fields['fcontent'] = str_replace( '|', "\n", $fields['fcontent'] );
//+-------------------------------
$SKIN->td_header[] = array( "&nbsp;" , "40%" );
$SKIN->td_header[] = array( "&nbsp;" , "60%" );
//+-------------------------------
$ADMIN->html .= $SKIN->start_table( "Field Settings" );
$ADMIN->html .= $SKIN->add_td_row( array( "<b>Field Title</b><br>Max characters: 200" ,
$SKIN->form_input("ftitle", $fields['ftitle'] )
) );
$ADMIN->html .= $SKIN->add_td_row( array( "<b>Description</b><br>Max Characters: 250<br>Can be used to note hidden/required status" ,
$SKIN->form_input("fdesc", $fields['fdesc'] )
) );
$ADMIN->html .= $SKIN->add_td_row( array( "<b>Field Type</b>" ,
$SKIN->form_dropdown("ftype",
array(
0 => array( 'text' , 'Text Input' ),
1 => array( 'drop' , 'Drop Down Box' ),
2 => array( 'area' , 'Text Area' ),
),
$fields['ftype'] )
) );
$ADMIN->html .= $SKIN->add_td_row( array( "<b>Max Input (for text input and text areas) in characters</b>" ,
$SKIN->form_input("fmaxinput", $fields['fmaxinput'] )
) );
$ADMIN->html .= $SKIN->add_td_row( array( "<b>Display order (when editing and displaying) numeric 1 lowest." ,
$SKIN->form_input("forder", $fields['forder'] )
) );
$ADMIN->html .= $SKIN->add_td_row( array( "<b>Option Content (for drop downs)</b><br>In sets, one set per line<br>Example for 'Gender' field:<br>m=Male<br>f=Female<br>u=Not Telling<br>Will produce:<br><select name='pants'><option value='m'>Male</option><option value='f'>Female</option><option value='u'>Not Telling</option></select><br>m,f or u stored in database. When showing field in profile, will use value from pair (f=Female, shows 'Female')" ,
$SKIN->form_textarea("fcontent", $fields['fcontent'] )
) );
$ADMIN->html .= $SKIN->add_td_row( array( "<b>Show on registration page also?</b>" ,
$SKIN->form_yes_no("fshowreg", $fields["fshowreg"] )
) );
$ADMIN->html .= $SKIN->add_td_row( array( "<b>Field cannot be left blank?</b><br>(Will not apply if you choose to hide below)" ,
$SKIN->form_yes_no("freq", $fields['freq'] )
) );
$ADMIN->html .= $SKIN->add_td_row( array( "<b>Hidden to profile viewers?</b><br>If yes, only admins and super mods can see it, user can still edit." ,
$SKIN->form_yes_no("fhide", $fields['fhide'] )
) );
$ADMIN->html .= $SKIN->add_td_row( array( "<b>Editable by user?</b><br>If no, user cannot edit information, field can only be seen by admins and super mods. Admins can edit information via ACP" ,
$SKIN->form_yes_no("fedit", $fields['fedit'] )
) );
$ADMIN->html .= $SKIN->end_form($button);
$ADMIN->html .= $SKIN->end_table();
$ADMIN->output();
}
//+---------------------------------------------------------------------------------
//
// Show "Management Screen
//
//+---------------------------------------------------------------------------------
function main_screen()
{
global $IN, $root_path, $INFO, $DB, $SKIN, $ADMIN, $std, $MEMBER, $GROUP;
$ADMIN->page_title = "Custom Profile Fields";
$ADMIN->page_detail = "Custom Profile fields can be used to add optional or required fields to be completed when registering or editing a profile. This is useful if you wish to record data from your members that is not already present in the base board.";
$SKIN->td_header[] = array( "Field Title" , "30%" );
$SKIN->td_header[] = array( "Type" , "20%" );
$SKIN->td_header[] = array( "REQUIRED" , "10%" );
$SKIN->td_header[] = array( "HIDDEN" , "10%" );
$SKIN->td_header[] = array( "SHOW REG" , "10%" );
$SKIN->td_header[] = array( "Edit" , "10%" );
$SKIN->td_header[] = array( "Delete" , "10%" );
//+-------------------------------
$ADMIN->html .= $SKIN->start_table( "Custom Profile Field Management" );
$real_types = array( 'drop' => 'Drop Down Box',
'area' => 'Text Area',
'text' => 'Text Input',
);
$DB->query("SELECT * FROM ibf_pfields_data");
if ( $DB->get_num_rows() )
{
while ( $r = $DB->fetch_row() )
{
$hide = '&nbsp;';
$req = '&nbsp;';
$regi = '&nbsp;';
"<center><a href='{$ADMIN->base_url}&act=group&code=delete&id=".$r['g_id']."'>Delete</a></center>";
//-----------------------------------
if ($r['fhide'] == 1)
{
$hide = '<center><span style="color:red">Y</span></center>';
}
//-----------------------------------
if ($r['freq'] == 1)
{
$req = '<center><span style="color:red">Y</span></center>';
}
if ($r['fshowreg'] == 1)
{
$regi = '<center><span style="color:red">Y</span></center>';
}
$ADMIN->html .= $SKIN->add_td_row( array( "<b>{$r['ftitle']}</b>" ,
"<center>{$real_types[$r['ftype']]}</center>",
$req,
$hide,
$regi,
"<center><a href='{$ADMIN->base_url}&act=field&code=edit&id=".$r['fid']."'>Edit</a></center>",
"<center><a href='{$ADMIN->base_url}&act=field&code=delete&id=".$r['fid']."'>Delete</a></center>",
) );
}
}
else
{
$ADMIN->html .= $SKIN->add_td_basic("None found", "center", "tdrow2");
}
$ADMIN->html .= $SKIN->add_td_basic("<a href='{$ADMIN->base_url}&act=field&code=add'>ADD NEW FIELD</a></center>", "center", "title");
$ADMIN->html .= $SKIN->end_table();
$ADMIN->output();
}
}
?>
+110
View File
@@ -0,0 +1,110 @@
<?php
/*
+--------------------------------------------------------------------------
| Invision Board v1.1
| ========================================
| by Matthew Mecham
| (c) 2001,2002 Invision Power Services
| http://www.ibforums.com
| ========================================
| Web: http://www.ibforums.com
| Email: phpboards@ibforums.com
| Licence Info: phpib-licence@ibforums.com
+---------------------------------------------------------------------------
|
| > Admin Quick Help System
| > Module written by Matt Mecham
| > Date started: 1st march 2002
|
| > Module Version Number: 1.0.0
+--------------------------------------------------------------------------
*/
$idx = new quick_help();
class quick_help {
var $help_text = array();
function init_help_array()
{
return array(
'mg_promote' => array( 'title' => "Group Promotion",
'body' => "If enabled (by choosing a member group to promote your members to and by entering a number of posts to achieve this)
when your members meet or exceed the number of posts set they will be 'promoted' to the specified group.
<br><br>
Many administrators use this feature to set up a 'Senior Members' group with more functionality (such as a longer edit time, larger post uploads) and even
allow access to otherwise hidden forums - when your members have made enough posts, they are promoted to this group allowing you to intice more posting and
allow for a more restrictive set of permissions for newcomers.
<br><br><b>Warning!</b><br>Use this feature carefully and always check the information before proceeding.<br>It is possible to advance to an Admin group - you have been warned.
",
),
's_reg_antispam' => array ( 'title' => "Registration AntiSpam",
'body' => "To prevent robots from registering (such as a malicious denial of service attack registering thousands of new accounts and forcing thousands of emails to be sent from your server)
you can enable this option.
<br><br>When enabled, a random 6 digit numerical string is generated and shown in a graphical format (to prevent advanced bots from reading the source page). The user must enter
this string exactly when registering or the account will not be created.",
),
'm_bulkemail' => array ( 'title' => "Bulk Emailing",
'body' => "<b>Overview</b><br>Bulk emailing allows you to target a specific section of your community or email all your registered members.
<br><br><b>Settings</b><br>You can choose which user groups will receive the email and elect to override the user set 'Allow Admin Emails' function. It is NOT recommended that you do override this
however.<hr>
<b>Allowed Tags</b><br>Although the email system sends the mail via BCC to preserve system resources, you can add in dynamic content with the following tags.
<br>{board_name} will return the name of your board
<br>{reg_total} will return the total number of registered members
<br>{total_posts} will return the total number of posts
<br>{busy_count} will return the most number of online users
<br>{busy_time} will return the date of the most online users
<br>{board_url} will return the URL to the board
<br><br>As the email is sent via BCC, it is not possible to include the members username, password or other user profile data.",
),
);
}
function quick_help() {
global $DB, $IN, $INFO, $ADMIN, $SKIN, $std;
$id = $IN['id'];
$this->help_text = $this->init_help_array();
if ($this->help_text[$id]['title'] == "")
{
$ADMIN->error("No help information is available for this function at present");
}
print "<html>
<head>
<title>Quick Help</title>
</head>
<body leftmargin='0' topmargin='0' bgcolor='#F5F9FD'>
<table width='95%' align='center' border='0' cellpadding='6'>
<tr>
<td style='font-family:verdana, arial, tahoma;color:#4C77B6;font-size:16px;letter-spacing:-1px;font-weight:bold'>{$this->help_text[$id]['title']}</td>
</tr>
<tr>
<td style='font-family:verdana, arial, tahoma;color:black;font-size:9pt'>{$this->help_text[$id]['body']}</td>
</tr>
</table>
</body>
</html>";
exit();
}
}
?>
+853
View File
@@ -0,0 +1,853 @@
<?php
/*
+--------------------------------------------------------------------------
| Invision Board v1.1
| ========================================
| by Matthew Mecham
| (c) 2001,2002 Invision Power Services
| http://www.ibforums.com
| ========================================
| Web: http://www.ibforums.com
| Email: phpboards@ibforums.com
| Licence Info: phpib-licence@ibforums.com
+---------------------------------------------------------------------------
|
| > Skin -> Templates pop up functions
| > Module written by Matt Mecham
| > Date started: 9th July 2002
|
| > Module Version Number: 1.0.0
+--------------------------------------------------------------------------
*/
$idx = new ad_settings();
class ad_settings {
var $base_url;
function ad_settings() {
global $IN, $root_path, $INFO, $DB, $SKIN, $ADMIN, $std, $MEMBER, $GROUP;
switch($IN['code'])
{
case 'preview':
$this->do_preview();
break;
case 'edit_bit':
$this->edit_bit();
break;
case 'macro_one':
$this->macro_one();
break;
case 'macro_two':
$this->macro_two();
break;
case 'compare':
$this->compare_frames();
break;
case 'dotop':
$this->print_compare_top();
break;
case 'donew':
$this->print_compare_new();
break;
//-----------------------------
case 'search':
$this->search_frames();
break;
case 'searchbox':
$this->print_search_box();
break;
case 'searchlinks':
$this->print_searchlinks();
break;
//-----------------------------
case 'css_search':
$this->css_search_frames();
break;
case 'csssearchlinks':
$this->print_css_searchlinks();
break;
case 'previewstate':
$this->do_message("Preview Window");
break;
//-------------------------
case 'css_preview':
$this->css_preview();
break;
default:
exit();
break;
}
}
//+---------------------------------------
function css_search_frames()
{
global $IN, $root_path, $INFO, $DB, $SKIN, $ADMIN, $std, $MEMBER, $GROUP, $HTTP_GET_VARS;
print "<html>
<head><title>Search</title></head>
<frameset cols='200, *' frameborder='no' border='1' framespacing='0'>
<frame name='links' scrolling='auto' src='{$SKIN->base_url}&act=rtempl&code=csssearchlinks&id={$IN['id']}&element={$HTTP_GET_VARS['element']}'>
<frame name='preview' scrolling='auto' src='{$SKIN->base_url}&act=rtempl&code=previewstate'>
</frameset>
</html>";
exit();
}
//+---------------------------------------
function css_preview()
{
global $IN, $root_path, $INFO, $DB, $SKIN, $ADMIN, $std, $MEMBER, $GROUP, $HTTP_GET_VARS;
//+---------------------------------------
// GET THE TEMPLATES THAT THIS CSS USES
//+---------------------------------------
$DB->query("SELECT css_text, css_name FROM ibf_css WHERE cssid='".$IN['id']."'");
if ( ! $set = $DB->fetch_row() )
{
$ADMIN->error("Cannot query the database using that information");
}
$DB->query("SELECT img_dir FROM ibf_skins WHERE css_id='".$IN['id']."'");
$skin = $DB->fetch_row();
$element = trim(stripslashes($HTTP_GET_VARS['element']));
list($type, $name) = explode( "|", $element );
$like = "class='{$name}'";
$first = '.';
if ($type == 'id')
{
$like = "id='{$name}'";
$first = '#';
}
preg_match( "/($first"."$name)\s{0,}\{(.+?)\}/s", $set['css_text'], $match );
//$definition = nl2br( str_replace( "\n\n", "\n", str_replace( "\r\n", "\n", $match[2]) ) );
//preg_match_all( "/(\S+?):(.+?);?/s", trim($match[2]), $defs );
$defs = explode( ";", str_replace( "\n\n", "\n", str_replace( "\r\n", "\n", trim($match[2]) ) ) );
$def_output = "";
foreach($defs as $bit)
{
list($type, $value) = explode( ":", trim($bit) );
$type = trim($type);
$value = trim($value);
if ($type != "" and $value != "")
{
$extra = "";
if ($type == 'color' or $type == 'background-color')
{
$extra = "&nbsp;&nbsp;&nbsp;<input type='text' size='6' style='background-color:$value' readonly>";
}
$def_output .= "<tr><td width='40%'><b>$type</b></td><td width='60%'>$value $extra</td></tr>\n";
}
}
$css = "\n<style>\n<!--\n".str_replace( "<#IMG_DIR#>", $skin['img_dir'], $set['css_text'] )."\n//-->\n</style>";
$html = "<html>
<head>
<title>CSS Preview</title>
$css
</head>
<body topmargin='0' leftmargin='0' rightmargin='0' marginwidth='0' marginheight='0' alink='#000000' vlink='#000000'>
<table border='1' width='95%' cellspacing='0' cellpadding='4' align='center'>
<tr>
<td bgcolor='#EEEEEE' style='font-size:14px'><b>Preview CSS Element '$name'<br>From style sheet '{$set['css_name']}'</b></td>
</tr>
</table>
<br>
<table border='1' width='95%' cellspacing='0' cellpadding='4' align='center'>
<tr>
<td><b>Preview</b></td>
</tr>
<tr>
<td $like>Cozy Lummux Gives Smart Squid Who Asks For Job Pen ([Indeed!])</td>
</tr>
</table>
<br>
<table border='1' width='95%' cellspacing='0' cellpadding='4' align='center'>
<tr>
<td colspan='2'><b>Formatted CSS Definition</b></td>
</tr>
$def_output
</table>
</body>
</html>
";
print $html;
exit();
}
//+---------------------------------------
//+---------------------------------------
function print_css_searchlinks()
{
global $IN, $root_path, $INFO, $DB, $SKIN, $ADMIN, $std, $MEMBER, $GROUP, $HTTP_GET_VARS;
//+---------------------------------------
// GET THE TEMPLATES THAT THIS CSS USES
//+---------------------------------------
$DB->query("SELECT tmpl_id FROM ibf_skins WHERE css_id='".$IN['id']."'");
if ( ! $set = $DB->fetch_row() )
{
$ADMIN->error("Cannot query the database using that information");
}
$element = trim(stripslashes($HTTP_GET_VARS['element']));
list($type, $name) = explode( "|", $element );
$like = "class=_{$name}";
if ($type == 'id')
{
$like = "id=_{$name}";
}
require './sources/Admin/skin_info.php';
//die("SELECT suid, set_id, group_name, func_name FROM ibf_skin_templates WHERE set_id='".$set['tmpl_id']."' AND section_content LIKE '%".$like."%' ORDER BY group_name");
$DB->query("SELECT suid, set_id, group_name, func_name FROM ibf_skin_templates WHERE set_id='".$set['tmpl_id']."' AND section_content LIKE '%".$like."%' ORDER BY group_name");
if (! $DB->get_num_rows() )
{
$this->do_message("No matches for that string");
}
$results = array();
while ( $r = $DB->fetch_row() )
{
if ( ! isset($result[ $r['group_name'] ]) )
{
$result[ $r['group_name'] ] = array();
}
$result[ $r['group_name'] ][] = array( 'suid' => $r['suid'], 'func_name' => $r['func_name'] );
}
$ADMIN->html .= $SKIN->start_table();
$ADMIN->html .= $SKIN->add_td_row( array( "<b>Search Results</b>" ) , 'title' );
foreach( $result as $group_name => $sub_array )
{
if ( isset($skin_names[ $group_name ]) )
{
$group_name = $skin_names[ $group_name ][0];
}
$ADMIN->html .= $SKIN->add_td_row( array( "<b>$group_name</b>" ) , 'catrow' );
if (is_array($sub_array) and count($sub_array) > 0 )
{
foreach( $sub_array as $idx => $data )
{
$ADMIN->html .= $SKIN->add_td_row( array( "+ <a href='{$SKIN->base_url}&act=rtempl&code=preview&suid={$data['suid']}&type=text&hl=".urlencode($name)."' target='preview'>{$data['func_name']}</a>" ) );
}
}
}
$ADMIN->html .= $SKIN->end_table();
$ADMIN->print_popup();
}
//+---------------------------------------
//+---------------------------------------
function print_searchlinks()
{
global $IN, $root_path, $INFO, $DB, $SKIN, $ADMIN, $std, $MEMBER, $GROUP, $HTTP_POST_VARS;
if ($IN['bypass'] == 1)
{
$this->do_message("No Search Results");
}
$search_text = trim($this->unconvert_tags(stripslashes($HTTP_POST_VARS['search'])));
$search_text = str_replace( "\$", "\\$", $search_text);
$search_text = str_replace( "'" , "\\'", $search_text);
if ($search_text == "")
{
$this->do_message("Please enter a string to search");
}
require './sources/Admin/skin_info.php';
$DB->query("SELECT set_id FROM ibf_skin_templates WHERE suid='".$IN['suid']."'");
$set = $DB->fetch_row();
$DB->query("SELECT suid, set_id, group_name, func_name FROM ibf_skin_templates WHERE set_id='".$set['set_id']."' AND section_content LIKE '%$search_text%' ORDER BY group_name");
if (! $DB->get_num_rows() )
{
$this->do_message("No matches for that string");
}
$results = array();
while ( $r = $DB->fetch_row() )
{
if ( ! isset($result[ $r['group_name'] ]) )
{
$result[ $r['group_name'] ] = array();
}
$result[ $r['group_name'] ][] = array( 'suid' => $r['suid'], 'func_name' => $r['func_name'] );
}
$ADMIN->html .= $SKIN->start_table();
$ADMIN->html .= $SKIN->add_td_row( array( "<b>Search Results</b>" ) , 'title' );
foreach( $result as $group_name => $sub_array )
{
if ( isset($skin_names[ $group_name ]) )
{
$group_name = $skin_names[ $group_name ][0];
}
$ADMIN->html .= $SKIN->add_td_row( array( "<b>$group_name</b>" ) , 'catrow' );
if (is_array($sub_array) and count($sub_array) > 0 )
{
foreach( $sub_array as $idx => $data )
{
$ADMIN->html .= $SKIN->add_td_row( array( "+ <a href='{$SKIN->base_url}&act=rtempl&code=preview&suid={$data['suid']}&type=text&hl=".urlencode(stripslashes($HTTP_POST_VARS['search']))."' target='preview'>{$data['func_name']}</a>" ) );
}
}
}
$ADMIN->html .= $SKIN->end_table();
$ADMIN->print_popup();
}
//+---------------------------------------
function do_message($message="")
{
global $IN, $root_path, $INFO, $DB, $SKIN, $ADMIN, $std, $MEMBER, $GROUP;
$ADMIN->html = "<tr><td id='tdrow1' height='100%' align='center' valign='middle'><br><br><b>$message</b><br><br>&nbsp;</td></tr>";
$ADMIN->print_popup();
}
//+---------------------------------------
function print_search_box()
{
global $IN, $root_path, $INFO, $DB, $SKIN, $ADMIN, $std, $MEMBER, $GROUP;
$ADMIN->html .= $SKIN->start_form( array( 1 => array( 'code' , 'searchlinks' ),
2 => array( 'act' , 'rtempl' ),
3 => array( 'suid' , $IN['suid'] )
) ,'theform', 'target="links"' );
//+-------------------------------
//+-------------------------------
$ADMIN->html .= $SKIN->start_table( );
$ADMIN->html .= $SKIN->add_td_row( array( "<b>Enter text to search for</b><br>".
$SKIN->form_input( 'search' )
) );
$ADMIN->html .= $SKIN->end_form("Search!");
$ADMIN->html .= $SKIN->end_table();
$ADMIN->print_popup();
}
//+---------------------------------------
function search_frames()
{
global $IN, $root_path, $INFO, $DB, $SKIN, $ADMIN, $std, $MEMBER, $GROUP;
print "<html>
<head><title>Search</title></head>
<frameset cols='200, *' frameborder='no' border='1' framespacing='0'>
<frameset rows='*, 100' frameborder='no' border='1' framespacing='0'>
<frame name='links' scrolling='auto' src='{$SKIN->base_url}&act=rtempl&code=searchlinks&suid={$IN['suid']}&bypass=1'>
<frame name='searchbox' scrolling='no' src='{$SKIN->base_url}&act=rtempl&code=searchbox&suid={$IN['suid']}'>
</frameset>
<frame name='preview' scrolling='auto' src='{$SKIN->base_url}&act=rtempl&code=previewstate'>
</frameset>
</html>";
exit();
}
//+---------------------------------------
function compare_frames()
{
global $IN, $root_path, $INFO, $DB, $SKIN, $ADMIN, $std, $MEMBER, $GROUP;
print "<html>
<head>
<title>Compare</title>
</head>
<frameset cols='50%, 50%' frameborder='yes' border='1' framespacing='0'>
<frameset rows='30, *' frameborder='yes' border='1' framespacing='0'>
<frame name='origtop' scrolling='auto' src='{$SKIN->base_url}&act=rtempl&code=dotop&content=orig'>
<frame name='origbot' scrolling='auto' src='{$SKIN->base_url}&act=rtempl&code=preview&suid={$IN['suid']}&type=css'>
</frameset>
<frameset rows='30, *' frameborder='yes' border='1' framespacing='0'>
<frame name='newtop' scrolling='auto' src='{$SKIN->base_url}&act=rtempl&code=dotop&content=new'>
<frame name='newbot' scrolling='auto' src='{$SKIN->base_url}&act=rtempl&code=donew&suid={$IN['suid']}'>
</frameset>
</frameset>
</html>";
exit();
}
//+---------------------------------------
function print_compare_top()
{
global $IN, $root_path, $INFO, $DB, $SKIN, $ADMIN, $std, $MEMBER, $GROUP;
$content = $IN['content'] == 'orig' ? 'Original Template' : 'Current Template';
print "<html>
<body marginheight='0' marginwidth='0' leftmargin='0' topmargin='0' bgcolor='#000055'>
<center><font face='verdana' size='2' color='white'><b>$content</b></font></center>
</body></html>";
exit();
}
//+---------------------------------------
function print_compare_new()
{
global $IN, $root_path, $INFO, $DB, $SKIN, $ADMIN, $std, $MEMBER, $GROUP;
$DB->query("SELECT * FROM ibf_skin_templates WHERE suid='".$IN['suid']."'");
if ( ! $template = $DB->fetch_row() )
{
$ADMIN->error("You must specify an existing template set ID, go back and try again");
}
$DB->query("SELECT css_id, img_dir FROM ibf_skins WHERE set_id='".$template['set_id']."'");
$r = $DB->fetch_row();
$DB->query("SELECT css_text FROM ibf_css WHERE cssid='".$r['css_id']."'");
$css = $DB->fetch_row();
$css_text = "\n<style>\n<!--\n".str_replace( "<#IMG_DIR#>", "style_images/".$r['img_dir'], $css['css_text'] )."\n//-->\n</style>";
print "<html><head>
$css_text
</head>
<body>
<script language='Javascript'>
templatedata = window.parent.opener.document.theform.template.value;
document.write( templatedata);
document.close();
</script>
</body></html>
";
exit();
}
//+---------------------------------------
function macro_one()
{
global $IN, $root_path, $INFO, $DB, $SKIN, $ADMIN, $std, $MEMBER, $GROUP;
$ADMIN->html .= $SKIN->start_form( array( 1 => array( 'code' , 'macro_two' ),
2 => array( 'act' , 'rtempl' ),
3 => array( 'suid' , $IN['suid'] )
) );
//+-------------------------------
$SKIN->td_header[] = array( "&nbsp;" , "60%" );
$SKIN->td_header[] = array( "&nbsp;" , "40%" );
//+-------------------------------
$ADMIN->html .= $SKIN->start_table( "Macro Look-up" );
$ADMIN->html .= $SKIN->add_td_row( array( "<b>Enter the Macro to look up</b><br>(EG: {ibf.skin.tbl_width})",
$SKIN->form_input( 'lookup' )
) );
$ADMIN->html .= $SKIN->end_form("Look-up");
$ADMIN->html .= $SKIN->end_table();
$ADMIN->print_popup();
}
//+-------------------------------
function macro_two()
{
global $IN, $root_path, $INFO, $DB, $SKIN, $ADMIN, $std, $MEMBER, $GROUP;
if ($IN['lookup'] == "")
{
$ADMIN->error("You must enter a macro to look up", 1);
}
$is_valid = 0;
$macro = "";
$extra = "";
if ( preg_match( "/&lt;\{(\S+)\}&gt;/", $IN['lookup'], $match ) )
{
$is_valid = 1;
$macro = $match[1];
}
else if ( preg_match( "/{ibf\.(skin|lang|vars|member)\.(\w+)}$/", $IN['lookup'], $match ) )
{
$is_valid = 1;
$macro = $match[2];
$extra = $match[1];
}
else
{
$is_valid = 0;
}
if ($is_valid != 1)
{
$ADMIN->error("The entered macro was in the wrong format, please try again", 1);
}
if ($extra != "")
{
if ($extra == 'member')
{
if (isset($MEMBER[$macro]))
{
if ($MEMBER[$macro] == "")
{
$answer = "";
}
else
{
$answer = $MEMBER[$macro];
}
}
else if (isset($GROUP[$macro]))
{
if ($GROUP[$macro] == "")
{
$answer = "";
}
else
{
$answer = $GROUP[$macro]." (This is member group information)";
}
}
$result = "Loaded Member Information";
}
else if ($extra == 'vars')
{
// Filter out sensitive stuff
$safe_INFO['board_name'] = $INFO['board_name'];
$safe_INFO['board_url'] = $INFO['board_url'];
$answer = $safe_INFO[$macro];
$result = "Config Variable Information (May be protected)";
}
else if ($extra == 'lang')
{
$result = "Language Text";
$DB->query("SELECT group_name FROM ibf_skin_templates WHERE suid='{$IN['suid']}'");
if ( $r = $DB->fetch_row() )
{
$filename = preg_replace( "/^skin_/", "lang_", $r['group_name'] );
if ( @file_exists( "./lang/en/$filename".".php" ) )
{
require "./lang/en/$filename".".php";
$answer = $lang[$macro];
}
}
}
}
else
{
// Is macro
$DB->query("SELECT set_id FROM ibf_skin_templates WHERE suid='{$IN['suid']}'");
$template = $DB->fetch_row();
$DB->query("SELECT macro_id FROM ibf_skins WHERE set_id='".$template['set_id']."'");
$macrod = $DB->fetch_row();
$DB->query("SELECT macro_value, macro_replace FROM ibf_macro WHERE macro_set='".$macrod['macro_id']."' AND macro_value='$macro'");
if ($val = $DB->fetch_row())
{
$answer = $val['macro_replace'];
$result = "From Macro Set";
}
else
{
$answer = "Macro not found";
}
}
$SKIN->td_header[] = array( "&nbsp;" , "40%" );
$SKIN->td_header[] = array( "&nbsp;" , "60%" );
//+-------------------------------
$ADMIN->html .= $SKIN->start_table( "Macro Look-up Result <a href='{$SKIN->base_url}&act=rtempl&code=macro_one&suid={$IN['suid']}'>Go Again</a>" );
$ADMIN->html .= $SKIN->add_td_row( array( "<b>Entered Macro</b>", $IN['lookup'] ) );
$ADMIN->html .= $SKIN->add_td_row( array( "<b>Macro Type</b>", $result ) );
$ADMIN->html .= $SKIN->add_td_row( array( "<b>Result</b><br>May be blank if no info", $answer ) );
$ADMIN->html .= $SKIN->end_table();
$ADMIN->print_popup();
}
//+-------------------------------
//+-------------------------------
function do_preview()
{
global $IN, $root_path, $INFO, $DB, $SKIN, $ADMIN, $std, $MEMBER, $GROUP, $HTTP_GET_VARS;
if ($IN['suid'] == "")
{
$ADMIN->error("You must specify an existing template set ID, go back and try again");
}
$DB->query("SELECT * FROM ibf_skin_templates WHERE suid='".$IN['suid']."'");
if ( ! $template = $DB->fetch_row() )
{
$ADMIN->error("You must specify an existing template set ID, go back and try again");
}
$table = "<table width='100%' bgcolor='black' cellpadding='4' style='font-family:verdana, arial;font-size:11px;color:white'>
<tr>
<td align='center' style='font-family:verdana, arial;font-size:11px;color:white'>Template Group: {$template['group_name']} : Template bit: {$template['func_name']}</td>
</tr>
<tr>
<td align='center' style='font-family:verdana, arial;font-size:11px;color:white'>View as [ <a href='{$ADMIN->base_url}&act=rtempl&code=preview&suid={$IN['suid']}&type=text' style='font-family:verdana, arial;font-size:11px;color:white'>Text</a> | <a href='{$ADMIN->base_url}&act=rtempl&code=preview&suid={$IN['suid']}&type=html' style='font-family:verdana, arial;font-size:11px;color:white'>HTML</a> | <a href='{$ADMIN->base_url}&act=rtempl&code=preview&suid={$IN['suid']}&type=css' style='font-family:verdana, arial;font-size:11px;color:white'>HTML with CSS</a> ]</td>
</tr>
</table>
<br><br>
";
if ($IN['type'] == 'text')
{
@header("Content-type: text/html");
print $table;
$html = $this->convert_tags($template['section_content']);
$html = str_replace( "<" , "&lt;" , $html);
$html = str_replace( ">" , "&gt;" , $html);
$html = str_replace( "\"", "&quot;", $html);
if ($HTTP_GET_VARS['hl'] != "")
{
$hl = urldecode(stripslashes($HTTP_GET_VARS['hl']));
$hl = str_replace( "<" , "&lt;" , $hl);
$hl = str_replace( ">" , "&gt;" , $hl);
$hl = str_replace( "\"", "&quot;", $hl);
$html = str_replace( $hl, "<span style='color:red;font-weight:bold;background-color:yellow'>$hl</span>", $html );
}
$html = preg_replace( "!&lt;\!--(.+?)(//)?--&gt;!s" , "&#60;&#33;<span style='color:red'>--\\1--\\2</span>&#62;", $html );
$html = preg_replace( "#&lt;([^&<>]+)&gt;#s" , "&lt;<span style='color:blue'>\\1</span>&gt;" , $html ); //Matches <tag>
$html = preg_replace( "#&lt;([^&<>]+)=#s" , "&lt;<span style='color:blue'>\\1</span>=" , $html ); //Matches <tag
$html = preg_replace( "#&lt;/([^&]+)&gt;#s" , "&lt;/<span style='color:blue'>\\1</span>&gt;" , $html ); //Matches </tag>
$html = preg_replace( "!=(&quot;|')([^<>])(&quot;|')(\s|&gt;)!s" , "=\\1<span style='color:purple'>\\2</span>\\3\\4" , $html ); //Matches ='this'
$html = str_replace( "\n", "<br>", str_replace("\r\n", "\n", $html ) );
print "<pre>".$html."</pre>";
exit();
}
else if ($IN['type'] == 'html')
{
@header("Content-type: text/html");
print $table;
print $this->convert_tags($template['section_content']);
exit();
}
else if($IN['type'] == 'css')
{
$DB->query("SELECT css_id, img_dir FROM ibf_skins WHERE set_id='".$template['set_id']."'");
$r = $DB->fetch_row();
$DB->query("SELECT css_text FROM ibf_css WHERE cssid='".$r['css_id']."'");
$css = $DB->fetch_row();
$css_text = "\n<style>\n<!--\n".str_replace( "<#IMG_DIR#>", "style_images/".$r['img_dir'], $css['css_text'] )."\n//-->\n</style>";
@header("Content-type: text/html");
print "<html><head><title>Preview</title>$css_text</head><body>$table \n";
print $this->convert_tags($template['section_content']);
exit();
}
}
//------------------------------------------------------
function convert_tags($t="")
{
if ($t == "")
{
return "";
}
$t = preg_replace( "/{?\\\$ibforums->base_url}?/" , "{ibf.script_url}" , $t );
$t = preg_replace( "/{?\\\$ibforums->session_id}?/" , "{ibf.session_id}" , $t );
$t = preg_replace( "/{?\\\$ibforums->skin\['?(\w+)'?\]}?/" , "{ibf.skin.\\1}" , $t );
$t = preg_replace( "/{?\\\$ibforums->lang\['?(\w+)'?\]}?/" , "{ibf.lang.\\1}" , $t );
$t = preg_replace( "/{?\\\$ibforums->vars\['?(\w+)'?\]}?/" , "{ibf.vars.\\1}" , $t );
$t = preg_replace( "/{?\\\$ibforums->member\['?(\w+)'?\]}?/" , "{ibf.member.\\1}" , $t );
return $t;
}
function unconvert_tags($t="")
{
if ($t == "")
{
return "";
}
$t = preg_replace( "/{ibf\.script_url}/i" , '{$ibforums->base_url}' , $t);
$t = preg_replace( "/{ibf\.session_id}/i" , '{$ibforums->session_id}' , $t);
$t = preg_replace( "/{ibf\.skin\.(\w+)}/" , '{$ibforums->skin[\''."\\1".'\']}' , $t);
$t = preg_replace( "/{ibf\.lang\.(\w+)}/" , '{$ibforums->lang[\''."\\1".'\']}' , $t);
$t = preg_replace( "/{ibf\.vars\.(\w+)}/" , '{$ibforums->vars[\''."\\1".'\']}' , $t);
$t = preg_replace( "/{ibf\.member\.(\w+)}/" , '{$ibforums->member[\''."\\1".'\']}' , $t);
return $t;
}
}
?>
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
+533
View File
@@ -0,0 +1,533 @@
<?php
/*
+--------------------------------------------------------------------------
| Invision Board v1.1
| ========================================
| by Matthew Mecham
| (c) 2001,2002 Invision Power Services
| http://www.ibforums.com
| ========================================
| Web: http://www.ibforums.com
| Email: phpboards@ibforums.com
| Licence Info: phpib-licence@ibforums.com
+---------------------------------------------------------------------------
|
| > Statistical functions
| > Module written by Matt Mecham
| > Date started: 4th July 2002
|
| > Module Version Number: 1.0.0
+--------------------------------------------------------------------------
*/
$idx = new ad_stats();
class ad_stats {
var $base_url;
var $month_names = array();
function ad_stats()
{
global $IN, $root_path, $INFO, $DB, $SKIN, $ADMIN, $std, $MEMBER, $GROUP;
$this->month_names = array( 1 => 'January', 'February', 'March' , 'April' , 'May' , 'June',
'July' , 'August' , 'September' , 'October', 'November', 'December'
);
switch($IN['code'])
{
case 'show_reg':
$this->result_screen('reg');
break;
case 'show_topic':
$this->result_screen('topic');
break;
case 'topic':
$this->main_screen('topic');
break;
//-----------------------
case 'show_post':
$this->result_screen('post');
break;
case 'post':
$this->main_screen('post');
break;
//-----------------------
case 'show_msg':
$this->result_screen('msg');
break;
case 'msg':
$this->main_screen('msg');
break;
//-----------------------
case 'show_views':
$this->show_views();
break;
case 'views':
$this->main_screen('views');
break;
//-----------------------
default:
$this->main_screen('reg');
break;
}
}
//select forum_id, SUM(views)from ibf_topics group by forum_id order by forum_id
//+---------------------------------------------------------------------------------
//| Results screen
//+---------------------------------------------------------------------------------
function show_views()
{
global $IN, $root_path, $INFO, $DB, $SKIN, $ADMIN, $std, $MEMBER, $GROUP;
$ADMIN->page_title = "Statistic Center Results";
$ADMIN->page_detail = "Showing topic view statistics";
//+---------------------
if ( ! checkdate($IN['to_month'] ,$IN['to_day'] ,$IN['to_year']) )
{
$ADMIN->error("The 'Date To:' time is incorrect, please check the input and try again");
}
if ( ! checkdate($IN['from_month'] ,$IN['from_day'] ,$IN['from_year']) )
{
$ADMIN->error("The 'Date From:' time is incorrect, please check the input and try again");
}
//+---------------------
$to_time = mktime(12 ,0 ,0 ,$IN['to_month'] ,$IN['to_day'] ,$IN['to_year'] );
$from_time = mktime(12 ,0 ,0 ,$IN['from_month'] ,$IN['from_day'] ,$IN['from_year']);
$human_to_date = getdate($to_time);
$human_from_date = getdate($from_time);
$DB->query("SELECT SUM(t.views) as result_count, t.forum_id, f.name as result_name
FROM ibf_topics t, ibf_forums f
WHERE t.start_date > '$from_time'
AND t.start_date < '$to_time'
AND t.forum_id=f.id
GROUP BY t.forum_id
ORDER BY result_count {$IN['sortby']}");
$running_total = 0;
$max_result = 0;
$results = array();
$SKIN->td_header[] = array( "Forum" , "40%" );
$SKIN->td_header[] = array( "Result" , "50%" );
$SKIN->td_header[] = array( "Views" , "10%" );
//+-------------------------------
$ADMIN->html .= $SKIN->start_table( "Topic Views"
." ({$human_from_date['mday']} {$this->month_names[$human_from_date['mon']]} {$human_from_date['year']} to"
." {$human_to_date['mday']} {$this->month_names[$human_to_date['mon']]} {$human_to_date['year']})"
);
if ( $DB->get_num_rows() )
{
while ($row = $DB->fetch_row() )
{
if ( $row['result_count'] > $max_result )
{
$max_result = $row['result_count'];
}
$running_total += $row['result_count'];
$results[] = array(
'result_name' => $row['result_name'],
'result_count' => $row['result_count'],
);
}
foreach( $results as $pOOp => $data )
{
$img_width = intval( ($data['result_count'] / $max_result) * 100 - 8) . "%";
$ADMIN->html .= $SKIN->add_td_row( array( $data['result_name'],
"<img src='{$SKIN->img_url}/bar_left.gif' border='0' width='4' height='11' align='middle' alt=''><img src='{$SKIN->img_url}/bar.gif' border='0' width='$img_width' height='11' align='middle' alt=''><img src='{$SKIN->img_url}/bar_right.gif' border='0' width='4' height='11' align='middle' alt=''>",
"<center>".$data['result_count']."</center>",
) );
}
$ADMIN->html .= $SKIN->add_td_row( array( '&nbsp;',
"<div align='right'><b>Total</b></div>",
"<center><b>".$running_total."</b></center>",
) );
}
else
{
$ADMIN->html .= $SKIN->add_td_basic( "No results found", "center" );
}
$ADMIN->html .= $SKIN->end_table();
$ADMIN->output();
}
//+---------------------------------------------------------------------------------
//| Results screen
//+---------------------------------------------------------------------------------
function result_screen($mode='reg')
{
global $IN, $root_path, $INFO, $DB, $SKIN, $ADMIN, $std, $MEMBER, $GROUP;
$ADMIN->page_title = "Statistic Center Results";
$ADMIN->page_detail = "&nbsp;";
//+---------------------
if ( ! checkdate($IN['to_month'] ,$IN['to_day'] ,$IN['to_year']) )
{
$ADMIN->error("The 'Date To:' time is incorrect, please check the input and try again");
}
if ( ! checkdate($IN['from_month'] ,$IN['from_day'] ,$IN['from_year']) )
{
$ADMIN->error("The 'Date From:' time is incorrect, please check the input and try again");
}
//+---------------------
$to_time = mktime(12 ,0 ,0 ,$IN['to_month'] ,$IN['to_day'] ,$IN['to_year'] );
$from_time = mktime(12 ,0 ,0 ,$IN['from_month'] ,$IN['from_day'] ,$IN['from_year']);
$human_to_date = getdate($to_time);
$human_from_date = getdate($from_time);
//+---------------------
if ($mode == 'reg')
{
$table = 'Registration Statistics';
$sql_table = 'ibf_members';
$sql_field = 'joined';
$ADMIN->page_detail = "Showing the number of users registered. (Note: All times based on GMT)";
}
else if ($mode == 'topic')
{
$table = 'New Topic Statistics';
$sql_table = 'ibf_topics';
$sql_field = 'start_date';
$ADMIN->page_detail = "Showing the number of topics started. (Note: All times based on GMT)";
}
else if ($mode == 'post')
{
$table = 'Post Statistics';
$sql_table = 'ibf_posts';
$sql_field = 'post_date';
$ADMIN->page_detail = "Showing the number of posts. (Note: All times based on GMT)";
}
else if ($mode == 'msg')
{
$table = 'PM Sent Statistics';
$sql_table = 'ibf_messages';
$sql_field = 'msg_date';
$ADMIN->page_detail = "Showing the number of sent messages. (Note: All times based on GMT)";
}
switch ($IN['timescale'])
{
case 'daily':
$sql_date = "%w %U %m %Y";
$php_date = "F jS - Y";
break;
case 'monthly':
$sql_date = "%m %Y";
$php_date = "F Y";
break;
default:
// weekly
$sql_date = "%U %Y";
$php_date = " [F Y]";
break;
}
$DB->query("SELECT MAX($sql_field) as result_maxdate,
COUNT(*) as result_count,
DATE_FORMAT(from_unixtime($sql_field),'$sql_date') AS result_time
FROM $sql_table
WHERE $sql_field > '$from_time'
AND $sql_field < '$to_time'
GROUP BY result_time
ORDER BY $sql_field {$IN['sortby']}");
$running_total = 0;
$max_result = 0;
$results = array();
$SKIN->td_header[] = array( "Date" , "20%" );
$SKIN->td_header[] = array( "Result" , "70%" );
$SKIN->td_header[] = array( "Count" , "10%" );
//+-------------------------------
$ADMIN->html .= $SKIN->start_table( ucfirst($IN['timescale'])
." ".$table
." ({$human_from_date['mday']} {$this->month_names[$human_from_date['mon']]} {$human_from_date['year']} to"
." {$human_to_date['mday']} {$this->month_names[$human_to_date['mon']]} {$human_to_date['year']})"
);
if ( $DB->get_num_rows() )
{
while ($row = $DB->fetch_row() )
{
if ( $row['result_count'] > $max_result )
{
$max_result = $row['result_count'];
}
$running_total += $row['result_count'];
$results[] = array(
'result_maxdate' => $row['result_maxdate'],
'result_count' => $row['result_count'],
'result_time' => $row['result_time'],
);
}
foreach( $results as $pOOp => $data )
{
$img_width = intval( ($data['result_count'] / $max_result) * 100 - 8) . "%";
if ($IN['timescale'] == 'weekly')
{
$date = "Week #".strftime("%W", $data['result_maxdate']) . date( $php_date, $data['result_maxdate'] );
}
else
{
$date = date( $php_date, $data['result_maxdate'] );
}
$ADMIN->html .= $SKIN->add_td_row( array( $date,
"<img src='{$SKIN->img_url}/bar_left.gif' border='0' width='4' height='11' align='middle' alt=''><img src='{$SKIN->img_url}/bar.gif' border='0' width='$img_width' height='11' align='middle' alt=''><img src='{$SKIN->img_url}/bar_right.gif' border='0' width='4' height='11' align='middle' alt=''>",
"<center>".$data['result_count']."</center>",
) );
}
$ADMIN->html .= $SKIN->add_td_row( array( '&nbsp;',
"<div align='right'><b>Total</b></div>",
"<center><b>".$running_total."</b></center>",
) );
}
else
{
$ADMIN->html .= $SKIN->add_td_basic( "No results found", "center" );
}
$ADMIN->html .= $SKIN->end_table();
$ADMIN->output();
}
//+---------------------------------------------------------------------------------
//| Date selection screen
//+---------------------------------------------------------------------------------
function main_screen($mode='reg')
{
global $IN, $root_path, $INFO, $DB, $SKIN, $ADMIN, $std, $MEMBER, $GROUP;
$ADMIN->page_title = "Statistic Center";
$ADMIN->page_detail = "Please define the date ranges and other options below.<br>Note: The statistics generated are based on the information currently held in the database, they do not take into account pruned forums or delete posts, etc.";
if ($mode == 'reg')
{
$form_code = 'show_reg';
$table = 'Registration Statistics';
}
else if ($mode == 'topic')
{
$form_code = 'show_topic';
$table = 'New Topic Statistics';
}
else if ($mode == 'post')
{
$form_code = 'show_post';
$table = 'Post Statistics';
}
else if ($mode == 'msg')
{
$form_code = 'show_msg';
$table = 'PM Statistics';
}
else if ($mode == 'views')
{
$form_code = 'show_views';
$table = 'Topic View Statistics';
}
$old_date = getdate(time() - (3600 * 24 * 90));
$new_date = getdate(time() + (3600 * 24));
//+-------------------------------
$ADMIN->html .= $SKIN->start_form( array( 1 => array( 'code' , $form_code ),
2 => array( 'act' , 'stats' ),
) );
//+-------------------------------
$SKIN->td_header[] = array( "&nbsp;" , "40%" );
$SKIN->td_header[] = array( "&nbsp;" , "60%" );
//+-------------------------------
$ADMIN->html .= $SKIN->start_table( $table );
$ADMIN->html .= $SKIN->add_td_row( array( "<b>Date From</b>" ,
$SKIN->form_dropdown( "from_month" , $this->make_month(), $old_date['mon'] ).'&nbsp;&nbsp;'.
$SKIN->form_dropdown( "from_day" , $this->make_day() , $old_date['mday'] ).'&nbsp;&nbsp;'.
$SKIN->form_dropdown( "from_year" , $this->make_year() , $old_date['year'] )
) );
$ADMIN->html .= $SKIN->add_td_row( array( "<b>Date To</b>" ,
$SKIN->form_dropdown( "to_month" , $this->make_month(), $new_date['mon'] ).'&nbsp;&nbsp;'.
$SKIN->form_dropdown( "to_day" , $this->make_day() , $new_date['mday'] ).'&nbsp;&nbsp;'.
$SKIN->form_dropdown( "to_year" , $this->make_year() , $new_date['year'] )
) );
if ($mode != 'views')
{
$ADMIN->html .= $SKIN->add_td_row( array( "<b>Time scale</b>" ,
$SKIN->form_dropdown( "timescale" , array( 0 => array( 'daily', 'Daily'), 1 => array( 'weekly', 'Weekly' ), 2 => array( 'monthly', 'Monthly' ) ) )
) );
}
$ADMIN->html .= $SKIN->add_td_row( array( "<b>Result Sorting</b>" ,
$SKIN->form_dropdown( "sortby" , array( 0 => array( 'asc', 'Ascending - Oldest dates first'), 1 => array( 'desc', 'Descending - Newest dates first' ) ), 'desc' )
) );
$ADMIN->html .= $SKIN->end_form("Show");
$ADMIN->html .= $SKIN->end_table();
$ADMIN->output();
}
//+---------------------------------------------------------------------------------
function make_year()
{
$time_now = getdate();
$return = array();
$start_year = 2002;
$latest_year = intval($time_now['year']);
if ($latest_year == $start_year)
{
$start_year -= 1;
}
for ( $y = $start_year; $y <= $latest_year; $y++ )
{
$return[] = array( $y, $y);
}
return $return;
}
//+----------------------------------------
function make_month()
{
$return = array();
for ( $m = 1 ; $m <= 12; $m++ )
{
$return[] = array( $m, $this->month_names[$m] );
}
return $return;
}
//+----------------------------------------
function make_day()
{
$return = array();
for ( $d = 1 ; $d <= 31; $d++ )
{
$return[] = array( $d, $d );
}
return $return;
}
}
?>
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
+515 -435
View File
@@ -1,436 +1,516 @@
<?php
/*
+--------------------------------------------------------------------------
| IBFORUMS v1
| ========================================
| by Matthew Mecham and David Baxter
| (c) 2001,2002 IBForums
| http://www.ibforums.com
| ========================================
| Web: http://www.ibforums.com
| Email: phpboards@ibforums.com
| Licence Info: phpib-licence@ibforums.com
+---------------------------------------------------------------------------
|
| > Help Control functions
| > Module written by Matt Mecham
| > Date started: 2nd April 2002
|
| > Module Version Number: 1.0.0
+--------------------------------------------------------------------------
*/
$idx = new ad_settings();
class ad_settings {
var $base_url;
function ad_settings() {
global $IN, $root_path, $INFO, $DB, $SKIN, $ADMIN, $std, $MEMBER, $GROUP;
switch($IN['code'])
{
case 'wrapper':
$this->list_wrappers();
break;
case 'add':
$this->do_form('add');
break;
case 'edit':
$this->do_form('edit');
break;
case 'doadd':
$this->save_wrapper('add');
break;
case 'doedit':
$this->save_wrapper('edit');
break;
case 'remove':
$this->remove();
break;
case 'export':
$this->export();
//-------------------------
default:
$this->list_wrappers();
break;
}
}
function export()
{
global $IN, $root_path, $INFO, $DB, $SKIN, $ADMIN, $std, $MEMBER, $GROUP;
if ($IN['id'] == "")
{
$ADMIN->error("You must specify an existing wrapper ID, go back and try again");
}
//+-------------------------------
$DB->query("SELECT * from ibf_templates WHERE tmid='".$IN['id']."'");
if ( ! $row = $DB->fetch_row() )
{
$ADMIN->error("Could not query the information from the database");
}
//+-------------------------------
$archive_dir = $INFO['base_dir']."/archive_out";
require $root_dir."sources/lib/tar.php";
if (!is_dir($archive_dir))
{
$ADMIN->error("Could not locate $archive_dir, is the directory there?");
}
if (!is_writeable($archive_dir))
{
$ADMIN->error("Cannot write in $archive_dir, CHMOD via FTP to 0755 or 0777 to enable this script to write into it. IBF cannot do this for you");
}
//+-------------------------------
// Attempt to copy the files to the
// working directory...
//+-------------------------------
$l_name = preg_replace( "/\s{1,}/", "_", $row['name'] );
$file_name = "wrap-".$l_name.".html";
$row['template'] = preg_replace("/\r/", "\n", $row['template'] );
$FH = fopen($archive_dir."/".$file_name, 'w');
fwrite($FH, $row['template'], strlen($row['template']));
fclose($FH);
$ADMIN->done_screen("Wrapper Export Created<br><br>You can download the html resource <a href='archive_out/$file_name' target='_blank'>here</a>", "Manage Board Wrappers", "act=wrap" );
}
//-------------------------------------------------------------
// REMOVE WRAPPERS
//-------------------------------------------------------------
function remove()
{
global $IN, $root_path, $INFO, $DB, $SKIN, $ADMIN, $std, $MEMBER, $GROUP, $HTTP_POST_VARS;
//+-------------------------------
if ($IN['id'] == "")
{
$ADMIN->error("You must specify an existing wrapper ID, go back and try again");
}
$DB->query("DELETE FROM ibf_templates WHERE tmid='".$IN['id']."'");
$std->boink_it($SKIN->base_url."&act=wrap");
exit();
}
//-------------------------------------------------------------
// ADD / EDIT WRAPPERS
//-------------------------------------------------------------
function save_wrapper( $type='add' )
{
global $IN, $root_path, $INFO, $DB, $SKIN, $ADMIN, $std, $MEMBER, $GROUP, $HTTP_POST_VARS;
//+-------------------------------
if ($type == 'edit')
{
if ($IN['id'] == "")
{
$ADMIN->error("You must specify an existing wrapper ID, go back and try again");
}
}
if ($IN['name'] == "")
{
$ADMIN->error("You must specify a name for this wrapper");
}
if ($IN['template'] == "")
{
$ADMIN->error("You can't have an empty template, can you?");
}
$tmpl = preg_replace( "!&lt/textarea>!", "/textarea>", stripslashes($HTTP_POST_VARS['template']) );
if ( ! preg_match( "/<% BOARD %>/", $tmpl ) )
{
$ADMIN->error("You cannot remove the &lt% BOARD %> tag silly!");
}
if ( ! preg_match( "/<% COPYRIGHT %>/", $tmpl ) )
{
$ADMIN->error("You cannot remove the &lt% COPYRIGHT %> tag silly!");
}
$barney = array( 'name' => stripslashes($HTTP_POST_VARS['name']),
'template' => $tmpl
);
if ($type == 'add')
{
$db_string = $DB->compile_db_insert_string( $barney );
$DB->query("INSERT INTO ibf_templates (".$db_string['FIELD_NAMES'].") VALUES(".$db_string['FIELD_VALUES'].")");
$std->boink_it($SKIN->base_url."&act=wrap");
exit();
}
else
{
$db_string = $DB->compile_db_update_string( $barney );
$DB->query("UPDATE ibf_templates SET $db_string WHERE tmid='".$IN['id']."'");
$ADMIN->done_screen("Wrapper updated", "Manage Board Wrappers", "act=wrap" );
}
}
//-------------------------------------------------------------
// ADD / EDIT WRAPPERS
//-------------------------------------------------------------
function do_form( $type='add' )
{
global $IN, $root_path, $INFO, $DB, $SKIN, $ADMIN, $std, $MEMBER, $GROUP;
//+-------------------------------
if ($IN['id'] == "")
{
$ADMIN->error("You must specify an existing wrapper ID, go back and try again");
}
$DB->query("SELECT * from ibf_templates WHERE tmid='".$IN['id']."'");
if ( ! $row = $DB->fetch_row() )
{
$ADMIN->error("Could not query the information from the database");
}
if ($type == 'add')
{
$code = 'doadd';
$button = 'Create Wrapper';
$row['name'] = $row['name'].".2";
}
else
{
$code = 'doedit';
$button = 'Edit Wrapper';
}
//+-------------------------------
$ADMIN->page_detail = "You may use HTML fully when adding or editing wrappers.";
$ADMIN->page_title = "Manage Board Wrappers";
//+-------------------------------
$ADMIN->html .= $SKIN->js_no_specialchars();
$ADMIN->html .= $SKIN->start_form( array( 1 => array( 'code' , $code ),
2 => array( 'act' , 'wrap' ),
3 => array( 'id' , $IN['id'] ),
), "theAdminForm", "onSubmit=\"return no_specialchars('wrapper')\"" );
//+-------------------------------
$SKIN->td_header[] = array( "&nbsp;" , "20%" );
$SKIN->td_header[] = array( "&nbsp;" , "80%" );
//+-------------------------------
$row['template'] = preg_replace( "/\/textarea>/", "&lt/textarea>", $row['template'] ); // Stop html killing the text area
$ADMIN->html .= $SKIN->start_table( $button );
$ADMIN->html .= $SKIN->add_td_row( array(
"Wrapper Title",
$SKIN->form_input('name', $row['name']),
) );
$ADMIN->html .= $SKIN->add_td_row( array(
"Content",
$SKIN->form_textarea('template', $row['template'], "60", "15"),
) );
$ADMIN->html .= $SKIN->end_form($button);
$ADMIN->html .= $SKIN->end_table();
//+-------------------------------
//+-------------------------------
$ADMIN->output();
}
//-------------------------------------------------------------
// SHOW WRAPPERS
//-------------------------------------------------------------
function list_wrappers()
{
global $IN, $root_path, $INFO, $DB, $SKIN, $ADMIN, $std, $MEMBER, $GROUP;
$form_array = array();
$ADMIN->page_detail = "You may add/edit and remove the board wrapper templates.<br><br>Board wrapper refers to the main board template which allows additional HTML to be added to the header and footer of the board";
$ADMIN->page_title = "Manage Board Wrappers";
//+-------------------------------
$SKIN->td_header[] = array( "Title" , "40%" );
$SKIN->td_header[] = array( "Allocation" , "30%" );
$SKIN->td_header[] = array( "Export" , "10%" );
$SKIN->td_header[] = array( "Edit" , "10%" );
$SKIN->td_header[] = array( "Remove" , "10%" );
//+-------------------------------
$DB->query("SELECT DISTINCT(w.tmid), w.name, s.sname from ibf_templates w, ibf_skins s WHERE s.tmpl_id=w.tmid ORDER BY w.name ASC");
$used_ids = array();
$show_array = array();
if ( $DB->get_num_rows() )
{
$ADMIN->html .= $SKIN->start_table( "Current Wrappers In Use" );
while ( $r = $DB->fetch_row() )
{
$show_array[ $r['tmid'] ] .= stripslashes($r['sname'])."<br>";
if ( in_array( $r['tmid'], $used_ids ) )
{
continue;
}
$ADMIN->html .= $SKIN->add_td_row( array( "<b>".stripslashes($r['name'])."</b>",
"<#X-{$r['tmid']}#>",
"<center><a href='".$SKIN->base_url."&act=wrap&code=export&id={$r['tmid']}'>Export</a></center>",
"<center><a href='".$SKIN->base_url."&act=wrap&code=edit&id={$r['tmid']}'>Edit</a></center>",
"<i>Deallocate before removing</i>",
) );
$used_ids[] = $r['tmid'];
$form_array[] = array( $r['tmid'], $r['name'] );
}
foreach( $show_array as $idx => $string )
{
$string = preg_replace( "/<br>$/", "", $string );
$ADMIN->html = preg_replace( "/<#X-$idx#>/", "$string", $ADMIN->html );
}
$ADMIN->html .= $SKIN->end_table();
}
if ( count($used_ids) > 0 )
{
$DB->query("SELECT tmid, name FROM ibf_templates WHERE tmid NOT IN(".implode(",",$used_ids).")");
if ( $DB->get_num_rows() )
{
$SKIN->td_header[] = array( "Title" , "70%" );
$SKIN->td_header[] = array( "Export" , "10%" );
$SKIN->td_header[] = array( "Edit" , "10%" );
$SKIN->td_header[] = array( "Remove" , "10%" );
$ADMIN->html .= $SKIN->start_table( "Current Unallocated Wrappers" );
$ADMIN->html .= $SKIN->js_checkdelete();
while ( $r = $DB->fetch_row() )
{
$ADMIN->html .= $SKIN->add_td_row( array( "<b>".stripslashes($r['name'])."</b>",
"<center><a href='".$SKIN->base_url."&act=wrap&code=export&id={$r['tmid']}'>Export</a></center>",
"<center><a href='".$SKIN->base_url."&act=wrap&code=edit&id={$r['tmid']}'>Edit</a></center>",
"<center><a href='javascript:checkdelete(\"act=wrap&code=remove&id={$r['tmid']}\")'>Remove</a></center>",
) );
$form_array[] = array( $r['tmid'], $r['name'] );
}
$ADMIN->html .= $SKIN->end_table();
}
}
//+-------------------------------
//+-------------------------------
$ADMIN->html .= $SKIN->start_form( array( 1 => array( 'code' , 'add' ),
2 => array( 'act' , 'wrap' ),
) );
$SKIN->td_header[] = array( "&nbsp;" , "40%" );
$SKIN->td_header[] = array( "&nbsp;" , "60%" );
$ADMIN->html .= $SKIN->start_table( "Create New Wrapper" );
//+-------------------------------
$ADMIN->html .= $SKIN->add_td_row( array( "<b>Base new wrapper on...</b>" ,
$SKIN->form_dropdown( "id", $form_array)
) );
$ADMIN->html .= $SKIN->end_form("Create new wrapper");
$ADMIN->html .= $SKIN->end_table();
//+-------------------------------
//+-------------------------------
$ADMIN->output();
}
}
<?php
/*
+--------------------------------------------------------------------------
| Invision Board v1.1
| ========================================
| by Matthew Mecham
| (c) 2001,2002 Invision Power Services
| http://www.ibforums.com
| ========================================
| Web: http://www.ibforums.com
| Email: phpboards@ibforums.com
| Licence Info: phpib-licence@ibforums.com
+---------------------------------------------------------------------------
|
| > Help Control functions
| > Module written by Matt Mecham
| > Date started: 2nd April 2002
|
| > Module Version Number: 1.0.0
+--------------------------------------------------------------------------
*/
$idx = new ad_settings();
class ad_settings {
var $base_url;
function ad_settings() {
global $IN, $root_path, $INFO, $DB, $SKIN, $ADMIN, $std, $MEMBER, $GROUP;
switch($IN['code'])
{
case 'wrapper':
$this->list_wrappers();
break;
case 'add':
$this->add_splash();
break;
case 'edit':
$this->do_form('edit');
break;
case 'doadd':
$this->save_wrapper('add');
break;
case 'doedit':
$this->save_wrapper('edit');
break;
case 'remove':
$this->remove();
break;
case 'export':
$this->export();
//-------------------------
default:
$this->list_wrappers();
break;
}
}
//---------------------------------------------------------------------
function add_splash()
{
global $IN, $root_path, $INFO, $DB, $SKIN, $ADMIN, $std, $MEMBER, $GROUP, $HTTP_POST_FILES;
$FILE_NAME = $HTTP_POST_FILES['FILE_UPLOAD']['name'];
$FILE_SIZE = $HTTP_POST_FILES['FILE_UPLOAD']['size'];
$FILE_TYPE = $HTTP_POST_FILES['FILE_UPLOAD']['type'];
// Naughty Opera adds the filename on the end of the
// mime type - we don't want this.
$FILE_TYPE = preg_replace( "/^(.+?);.*$/", "\\1", $FILE_TYPE );
// Naughty Mozilla likes to use "none" to indicate an empty upload field.
// I love universal languages that aren't universal.
if ($HTTP_POST_FILES['FILE_UPLOAD']['name'] == "" or !$HTTP_POST_FILES['FILE_UPLOAD']['name'] or ($HTTP_POST_FILES['FILE_UPLOAD']['name'] == "none") )
{
// We're adding new templates based on another set
$this->do_form('add');
exit();
}
if (! is_dir($INFO['upload_dir']) )
{
$ADMIN->error("Could not locate the uploads directory - make sure the 'uploads' path is set correctly");
}
//-------------------------------------------------
// Copy the upload to the uploads directory
//-------------------------------------------------
if (! @move_uploaded_file( $HTTP_POST_FILES['FILE_UPLOAD']['tmp_name'], $INFO['upload_dir']."/".$FILE_NAME) )
{
$ADMIN->error("The upload failed");
}
else
{
@chmod( $INFO['upload_dir']."/".$FILE_NAME, 0777 );
}
//-------------------------------------------------
// Attempt to open the file..
//-------------------------------------------------
$filename = $INFO['upload_dir']."/".$FILE_NAME;
if ( $FH = @fopen( $filename, 'r' ) )
{
$data = @fread( $FH, filesize($filename) );
@fclose($FH);
@unlink($filename);
}
else
{
$ADMIN->error("Could not open the uploaded file for reading!");
}
//-------------------------------------------------
// If we're here, we'll assume that we've read the
// file and the contents are in $data
// So, lets make sure its the correct template file..
//-------------------------------------------------
if ( ! preg_match( "/<% COPYRIGHT %>/", $data ) )
{
$ADMIN->error("This file does not appear to be a valid Invision Board Wrapper file");
}
//----------------------------------
// Insert wrapper into DB
//----------------------------------
$wrap_name .= "New Wrapper (Upload ID: ".substr( time(), -6 ).")";
$str = $DB->compile_db_insert_string( array ( 'name' => $wrap_name,
'template' => $data,
) );
$DB->query("INSERT INTO ibf_templates ({$str['FIELD_NAMES']}) VALUES({$str['FIELD_VALUES']})");
$ADMIN->done_screen("Board Wrapper import complete", "Manage Board Wrappers", "act=wrap" );
}
//---------------------------------------------------------------------
function export()
{
global $IN, $root_path, $INFO, $DB, $SKIN, $ADMIN, $std, $MEMBER, $GROUP;
if ($IN['id'] == "")
{
$ADMIN->error("You must specify an existing wrapper ID, go back and try again");
}
//+-------------------------------
$DB->query("SELECT * from ibf_templates WHERE tmid='".$IN['id']."'");
if ( ! $row = $DB->fetch_row() )
{
$ADMIN->error("Could not query the information from the database");
}
//+-------------------------------
// Pass file as an attachment, yeah!
//+-------------------------------
$l_name = preg_replace( "/\s{1,}/", "_", $row['name'] );
$file_name = "wrap-".substr($l_name, 0, 8).".html";
$row['template'] = preg_replace("/\r\n/", "\n", $row['template'] );
@header("Content-type: unknown/unknown");
@header("Content-Disposition: attachment; filename=$file_name");
print $row['template']."\n";
exit();
}
//-------------------------------------------------------------
// REMOVE WRAPPERS
//-------------------------------------------------------------
function remove()
{
global $IN, $root_path, $INFO, $DB, $SKIN, $ADMIN, $std, $MEMBER, $GROUP, $HTTP_POST_VARS;
//+-------------------------------
if ($IN['id'] == "")
{
$ADMIN->error("You must specify an existing wrapper ID, go back and try again");
}
$DB->query("DELETE FROM ibf_templates WHERE tmid='".$IN['id']."'");
$std->boink_it($SKIN->base_url."&act=wrap");
exit();
}
//-------------------------------------------------------------
// ADD / EDIT WRAPPERS
//-------------------------------------------------------------
function save_wrapper( $type='add' )
{
global $IN, $root_path, $INFO, $DB, $SKIN, $ADMIN, $std, $MEMBER, $GROUP, $HTTP_POST_VARS;
//+-------------------------------
if ($type == 'edit')
{
if ($IN['id'] == "")
{
$ADMIN->error("You must specify an existing wrapper ID, go back and try again");
}
}
if ($IN['name'] == "")
{
$ADMIN->error("You must specify a name for this wrapper");
}
if ($IN['template'] == "")
{
$ADMIN->error("You can't have an empty template, can you?");
}
$tmpl = preg_replace( "!&lt/textarea>!", "/textarea>", stripslashes($HTTP_POST_VARS['template']) );
if ( ! preg_match( "/<% BOARD %>/", $tmpl ) )
{
$ADMIN->error("You cannot remove the &lt% BOARD %> tag silly!");
}
if ( ! preg_match( "/<% COPYRIGHT %>/", $tmpl ) )
{
$ADMIN->error("You cannot remove the &lt% COPYRIGHT %> tag silly!");
}
$barney = array( 'name' => stripslashes($HTTP_POST_VARS['name']),
'template' => $tmpl
);
if ($type == 'add')
{
$db_string = $DB->compile_db_insert_string( $barney );
$DB->query("INSERT INTO ibf_templates (".$db_string['FIELD_NAMES'].") VALUES(".$db_string['FIELD_VALUES'].")");
$std->boink_it($SKIN->base_url."&act=wrap");
exit();
}
else
{
$db_string = $DB->compile_db_update_string( $barney );
$DB->query("UPDATE ibf_templates SET $db_string WHERE tmid='".$IN['id']."'");
$ADMIN->done_screen("Wrapper updated", "Manage Board Wrappers", "act=wrap" );
}
}
//-------------------------------------------------------------
// ADD / EDIT WRAPPERS
//-------------------------------------------------------------
function do_form( $type='add' )
{
global $IN, $root_path, $INFO, $DB, $SKIN, $ADMIN, $std, $MEMBER, $GROUP;
//+-------------------------------
if ($IN['id'] == "")
{
$ADMIN->error("You must specify an existing wrapper ID, go back and try again");
}
$DB->query("SELECT * from ibf_templates WHERE tmid='".$IN['id']."'");
if ( ! $row = $DB->fetch_row() )
{
$ADMIN->error("Could not query the information from the database");
}
if ($type == 'add')
{
$code = 'doadd';
$button = 'Create Wrapper';
$row['name'] = $row['name'].".2";
}
else
{
$code = 'doedit';
$button = 'Edit Wrapper';
}
//+-------------------------------
$ADMIN->page_detail = "You may use HTML fully when adding or editing wrappers.";
$ADMIN->page_title = "Manage Board Wrappers";
//+-------------------------------
$ADMIN->html .= $SKIN->js_no_specialchars();
$ADMIN->html .= $SKIN->start_form( array( 1 => array( 'code' , $code ),
2 => array( 'act' , 'wrap' ),
3 => array( 'id' , $IN['id'] ),
), "theAdminForm", "onSubmit=\"return no_specialchars('wrapper')\"" );
//+-------------------------------
$SKIN->td_header[] = array( "&nbsp;" , "20%" );
$SKIN->td_header[] = array( "&nbsp;" , "80%" );
//+-------------------------------
$row['template'] = preg_replace( "/\/textarea>/", "&lt/textarea>", $row['template'] ); // Stop html killing the text area
$ADMIN->html .= $SKIN->start_table( $button );
$ADMIN->html .= $SKIN->add_td_row( array(
"Wrapper Title",
$SKIN->form_input('name', $row['name']),
) );
$ADMIN->html .= $SKIN->add_td_row( array(
"Content",
$SKIN->form_textarea('template', $row['template'], "60", "15"),
) );
$ADMIN->html .= $SKIN->end_form($button);
$ADMIN->html .= $SKIN->end_table();
//+-------------------------------
//+-------------------------------
$ADMIN->output();
}
//-------------------------------------------------------------
// SHOW WRAPPERS
//-------------------------------------------------------------
function list_wrappers()
{
global $IN, $root_path, $INFO, $DB, $SKIN, $ADMIN, $std, $MEMBER, $GROUP;
$form_array = array();
$ADMIN->page_detail = "You may add/edit and remove the board wrapper templates.<br><br>Board wrapper refers to the main board template which allows additional HTML to be added to the header and footer of the board";
$ADMIN->page_title = "Manage Board Wrappers";
//+-------------------------------
$SKIN->td_header[] = array( "Title" , "40%" );
$SKIN->td_header[] = array( "Allocation" , "30%" );
$SKIN->td_header[] = array( "Export" , "10%" );
$SKIN->td_header[] = array( "Edit" , "10%" );
$SKIN->td_header[] = array( "Remove" , "10%" );
//+-------------------------------
$DB->query("SELECT DISTINCT(w.tmid), w.name, s.sname from ibf_templates w, ibf_skins s WHERE s.tmpl_id=w.tmid ORDER BY w.name ASC");
$used_ids = array();
$show_array = array();
if ( $DB->get_num_rows() )
{
$ADMIN->html .= $SKIN->start_table( "Current Wrappers In Use" );
while ( $r = $DB->fetch_row() )
{
$show_array[ $r['tmid'] ] .= stripslashes($r['sname'])."<br>";
if ( in_array( $r['tmid'], $used_ids ) )
{
continue;
}
$ADMIN->html .= $SKIN->add_td_row( array( "<b>".stripslashes($r['name'])."</b>",
"<#X-{$r['tmid']}#>",
"<center><a href='".$SKIN->base_url."&act=wrap&code=export&id={$r['tmid']}'>Export</a></center>",
"<center><a href='".$SKIN->base_url."&act=wrap&code=edit&id={$r['tmid']}'>Edit</a></center>",
"<i>Deallocate before removing</i>",
) );
$used_ids[] = $r['tmid'];
$form_array[] = array( $r['tmid'], $r['name'] );
}
foreach( $show_array as $idx => $string )
{
$string = preg_replace( "/<br>$/", "", $string );
$ADMIN->html = preg_replace( "/<#X-$idx#>/", "$string", $ADMIN->html );
}
$ADMIN->html .= $SKIN->end_table();
}
if ( count($used_ids) > 0 )
{
$DB->query("SELECT tmid, name FROM ibf_templates WHERE tmid NOT IN(".implode(",",$used_ids).")");
if ( $DB->get_num_rows() )
{
$SKIN->td_header[] = array( "Title" , "70%" );
$SKIN->td_header[] = array( "Export" , "10%" );
$SKIN->td_header[] = array( "Edit" , "10%" );
$SKIN->td_header[] = array( "Remove" , "10%" );
$ADMIN->html .= $SKIN->start_table( "Current Unallocated Wrappers" );
$ADMIN->html .= $SKIN->js_checkdelete();
while ( $r = $DB->fetch_row() )
{
$ADMIN->html .= $SKIN->add_td_row( array( "<b>".stripslashes($r['name'])."</b>",
"<center><a href='".$SKIN->base_url."&act=wrap&code=export&id={$r['tmid']}'>Export</a></center>",
"<center><a href='".$SKIN->base_url."&act=wrap&code=edit&id={$r['tmid']}'>Edit</a></center>",
"<center><a href='javascript:checkdelete(\"act=wrap&code=remove&id={$r['tmid']}\")'>Remove</a></center>",
) );
$form_array[] = array( $r['tmid'], $r['name'] );
}
$ADMIN->html .= $SKIN->end_table();
}
}
//+-------------------------------
//+-------------------------------
$ADMIN->html .= $SKIN->start_form( array( 1 => array( 'code' , 'add' ),
2 => array( 'act' , 'wrap' ),
3 => array( 'MAX_FILE_SIZE', '10000000000' ),
) , "uploadform", " enctype='multipart/form-data'" );
$SKIN->td_header[] = array( "&nbsp;" , "40%" );
$SKIN->td_header[] = array( "&nbsp;" , "60%" );
$ADMIN->html .= $SKIN->start_table( "Create New Wrapper" );
//+-------------------------------
$ADMIN->html .= $SKIN->add_td_row( array( "<b>Base new wrapper on...</b>" ,
$SKIN->form_dropdown( "id", $form_array)
) );
$ADMIN->html .= $SKIN->add_td_row( array( "<b><u>OR</u> Choose a wrapper file from your computer to import</b><br>Note: This must be in the correct format.",
$SKIN->form_upload(),
) );
$ADMIN->html .= $SKIN->end_form("Create new wrapper");
$ADMIN->html .= $SKIN->end_table();
//+-------------------------------
//+-------------------------------
$ADMIN->output();
}
}
?>
File diff suppressed because it is too large. Load diff
+131 -94
View File
@@ -1,95 +1,132 @@
<?php
// Simple library that holds all the links for the admin cp
// CAT_ID => array( PAGE_ID => (PAGE_NAME, URL ) )
// $PAGES[ $cat_id ][$page_id][0] = Page name
// $PAGES[ $cat_id ][$page_id][1] = Url
$PAGES = array(
0 => array (
1 => array( 'Basic Config', 'act=op&code=url' ),
2 => array( 'Security & Privacy' , 'act=op&code=secure' ),
3 => array( 'Topics & Posts', 'act=op&code=post' ),
4 => array( 'User Profiles' , 'act=op&code=avatars' ),
5 => array( 'Date Formats' , 'act=op&code=dates' ),
6 => array( 'CPU Saving' , 'act=op&code=cpu' ),
7 => array( 'Cookies' , 'act=op&code=cookie' ),
8 => array( 'PM Set up' , 'act=op&code=pm' ),
9 => array( 'Board on/off' , 'act=op&code=board' ),
10 =>array( 'News Set-up' , 'act=op&code=news' ),
),
1 => array (
1 => array( 'New Category' , 'act=cat&code=new' ),
2 => array( 'New Forum' , 'act=forum&code=newsp' ),
3 => array( 'Manage' , 'act=cat&code=edit' ),
4 => array( 'Re-Order Categories' , 'act=cat&code=reorder'),
5 => array( 'Re-Order Forums', 'act=forum&code=reorder'),
6 => array( 'Moderators' , 'act=mod' ),
),
3 => array (
1 => array ( 'Pre-Register' , 'act=mem&code=add' ),
2 => array ( 'Edit User' , 'act=mem&code=edit' ),
3 => array ( 'Delete User(s)' , 'act=mem&code=del' ),
4 => array ( 'Ban Settings' , 'act=mem&code=ban' ),
5 => array ( 'User Title/Ranks' , 'act=mem&code=title'),
6 => array ( 'Manage User Groups' , 'act=group' ),
7 => array ( 'Manage Registrations', 'act=mem&code=mod' ),
),
4 => array (
1 => array( 'Manage Word Filters', 'act=op&code=bw' ),
2 => array( 'Manage Emoticons', 'act=op&code=emo' ),
3 => array( 'Manage Help Files', 'act=help' ),
4 => array( 'Recount Statistics', 'act=op&code=count' ),
5 => array( 'View Moderator Logs', 'act=modlog' ),
),
5 => array (
1 => array( 'Manage Board Wrappers' , 'act=wrap' ),
2 => array( 'Manage Skin Templates' , 'act=templ' ),
3 => array( 'Manage Style Sheets' , 'act=style' ),
4 => array( 'Manage Image&Macros' , 'act=image' ),
5 => array( '<b>Manage Skin Sets</b>' , 'act=sets' ),
6 => array( 'Import Skin files' , 'act=import' ),
),
6 => array (
1 => array( 'Manage Languages' , 'act=lang' ),
2 => array( 'Import a Language', 'act=lang&code=import' ),
),
);
$CATS = array (
0 => "Board Settings",
1 => 'Forum Control',
3 => 'Users and Groups',
4 => 'Administration',
5 => 'Skins & Templates',
6 => 'Languages',
);
$DESC = array (
0 => "Edit forum settings such as cookie paths, security features, posting abilities, etc",
1 => "Create, edit, remove and re-order categories, forums and moderators",
3 => "Edit, register, remove and ban members. Set up member titles and ranks. Manage User Groups and moderated registrations",
4 => "Manage Help Files, Bad Word Filters and Emoticons",
5 => "Manage templates, skins, colours and images.",
6 => "Manage language sets",
);
<?php
// Simple library that holds all the links for the admin cp
// CAT_ID => array( PAGE_ID => (PAGE_NAME, URL ) )
// $PAGES[ $cat_id ][$page_id][0] = Page name
// $PAGES[ $cat_id ][$page_id][1] = Url
$PAGES = array(
0 => array (
1 => array( 'IPS Latest News' , 'act=ips&code=news' ),
2 => array( 'Check for updates' , 'act=ips&code=updates' ),
3 => array( 'Documentation' , 'act=ips&code=docs' ),
4 => array( 'Get Support' , 'act=ips&code=support' ),
5 => array( 'IPS Hosting' , 'act=ips&code=host' ),
6 => array( 'Purchase Services' , 'act=ips&code=purchase' ),
),
1 => array (
1 => array( 'Basic Config', 'act=op&code=url' ),
2 => array( 'Security & Privacy' , 'act=op&code=secure' ),
3 => array( 'Topics, Posts & Polls', 'act=op&code=post' ),
4 => array( 'User Profiles' , 'act=op&code=avatars' ),
5 => array( 'Date Formats' , 'act=op&code=dates' ),
6 => array( 'CPU Saving' , 'act=op&code=cpu' ),
7 => array( 'Cookies' , 'act=op&code=cookie' ),
8 => array( 'PM Set up' , 'act=op&code=pm' ),
9 => array( 'Board on/off' , 'act=op&code=board' ),
10 =>array( 'News Set-up' , 'act=op&code=news' ),
11 =>array( 'Calendar Set-up' , 'act=op&code=calendar' ),
12 =>array( 'COPPA Set-up' , 'act=op&code=coppa' ),
),
2 => array (
1 => array( 'New Category' , 'act=cat&code=new' ),
2 => array( 'New Forum' , 'act=forum&code=newsp' ),
3 => array( 'Manage' , 'act=cat&code=edit' ),
4 => array( 'Re-Order Categories' , 'act=cat&code=reorder'),
5 => array( 'Re-Order Forums', 'act=forum&code=reorder'),
6 => array( 'Moderators' , 'act=mod' ),
),
3 => array (
1 => array ( 'Pre-Register' , 'act=mem&code=add' ),
2 => array ( 'Find/Edit User' , 'act=mem&code=edit' ),
3 => array ( 'Delete User(s)' , 'act=mem&code=del' ),
4 => array ( 'Ban Settings' , 'act=mem&code=ban' ),
5 => array ( 'User Title/Ranks' , 'act=mem&code=title'),
6 => array ( 'Manage User Groups' , 'act=group' ),
7 => array ( 'Manage Registrations', 'act=mem&code=mod' ),
8 => array ( 'Custom Profile Fields', 'act=field' ),
9 => array ( 'Bulk Email Members' , 'act=mem&code=mail' ),
),
4 => array (
1 => array( 'Manage Word Filters', 'act=op&code=bw' ),
2 => array( 'Manage Emoticons', 'act=op&code=emo' ),
3 => array( 'Manage Help Files', 'act=help' ),
4 => array( 'Recount Statistics', 'act=op&code=count' ),
5 => array( 'View Moderator Logs', 'act=modlog' ),
6 => array( 'View Admin Logs' , 'act=adminlog' ),
),
5 => array (
1 => array( 'Manage Board Wrappers' , 'act=wrap' ),
2 => array( 'Manage Skin Templates' , 'act=templ' ),
3 => array( 'Manage Style Sheets' , 'act=style' ),
4 => array( 'Manage Macros' , 'act=image' ),
5 => array( '<b>Manage Skin Sets</b>' , 'act=sets' ),
6 => array( 'Import Skin files' , 'act=import' ),
),
6 => array (
1 => array( 'Manage Languages' , 'act=lang' ),
2 => array( 'Import a Language', 'act=lang&code=import' ),
),
7 => array (
1 => array( 'Registration Stats' , 'act=stats&code=reg' ),
2 => array( 'New Topic Stats' , 'act=stats&code=topic' ),
3 => array( 'Post Stats' , 'act=stats&code=post' ),
4 => array( 'Private Message' , 'act=stats&code=msg' ),
5 => array( 'Topic Views' , 'act=stats&code=views' ),
),
8 => array (
1 => array( 'mySQL Toolbox' , 'act=mysql' ),
2 => array( 'mySQL Back Up' , 'act=mysql&code=backup' ),
3 => array( 'SQL Runtime Info', 'act=mysql&code=runtime' ),
4 => array( 'SQL System Vars' , 'act=mysql&code=system' ),
5 => array( 'SQL Processes' , 'act=mysql&code=processes' ),
),
);
$CATS = array (
0 => "IPS Services",
1 => "Board Settings",
2 => 'Forum Control',
3 => 'Users and Groups',
4 => 'Administration',
5 => 'Skins & Templates',
6 => 'Languages',
7 => 'Statistic Center',
8 => 'SQL Management',
);
$DESC = array (
0 => "Get IPS latest news, documentation, request support, purchase extra services and more...",
1 => "Edit forum settings such as cookie paths, security features, posting abilities, etc",
2 => "Create, edit, remove and re-order categories, forums and moderators",
3 => "Edit, register, remove and ban members. Set up member titles and ranks. Manage User Groups and moderated registrations",
4 => "Manage Help Files, Bad Word Filters and Emoticons",
5 => "Manage templates, skins, colours and images.",
6 => "Manage language sets",
7 => "Get registration and posting statistics",
8 => "Manage your SQL database; repair, optimize and export data",
);
?>
File diff suppressed because it is too large. Load diff
+109
View File
@@ -0,0 +1,109 @@
<?php
$skin_names = array(
'skin_boards' => array(
'Board Index Sections',
'Elements for the board index listing (shows you all the forums and is the first page you see when visiting the board) such as
forum link HTML, active user overview HTML, board statistics overview HTML, today\'s birthdays overview HTML',
),
'skin_buddy' => array(
'Browse Buddy Sections',
'Elements for the browse buddy feature, including links and search boxes',
),
'skin_calendar'=> array(
'Calendar Sections',
'Elements for the calendar, including calendar view, view events',
),
'skin_emails' => array(
'Member Contact Sections',
'Elements from various contact methods, such as ICQ, AIM pager, email form and report post to moderator form',
),
'skin_forum' => array(
'Forum Index Sections',
'Elements for forum view (list all topics in forum). Includes forum log in window, forum rules',
),
'skin_global' => array(
'Global HTML elements',
'Various HTML elements such as board header, redirect page, error page',
),
'skin_help' => array(
'Help Sections',
'Elements for the help screen, including search boxes and view help files',
),
'skin_legends' => array(
'Board Legends Sections',
'Elements for the "view all emoticons" windows, and the "Find User" sections',
),
'skin_login' => array(
'Log In Sections',
'Elements for the log in form',
),
'skin_mlist' => array(
'Member List Sections',
'Elements for the member list views',
),
'skin_mod' => array(
'Moderator Function Sections',
'Elements for the moderator tools such as delete topic, edit topic and the moderator CP sections',
),
'skin_msg' => array(
'Messenger Sections',
'Elements for the messenger, such as view inbox, view message, archive messages, etc',
),
'skin_online' => array (
'Online List Sections',
'Elements for the "Show all online users" link',
),
'skin_poll' => array (
'View Poll Sections',
'Elements for the poll view, includes vote form and vote results',
),
'skin_post' => array(
'Post Screen Sections',
'Elements for the post screens such as new topic, reply to topic, quote post, edit post, some messenger new PM sections, some calender new event sections',
),
'skin_printpage'=> array(
'Printable Topic Sections',
'Elements for displaying the "printable topic" page',
),
'skin_profile' => array(
'Profile View Sections',
'Elements for viewing a members profile',
),
'skin_register' => array(
'Register Sections',
'Elements for the register form, validate account form and COPPA forms',
),
'skin_search' => array(
'Search Sections',
'Elements for the search forum and the results view',
),
'skin_stats' => array(
'Statistics Section',
'Elements for various functions such as "View Moderating Team", "View todays top 10 posts", "View Active Topics"',
),
'skin_topic' => array(
'Topic View Section',
'Elements for the topic view screen, such as post view, inline attachment view, etc.',
),
'skin_modcp' => array(
'Mod CP Section',
'Elements for the moderators control panel sections.',
),
'skin_ucp' => array(
'User Control Panel Section',
'Elements for the user control panel, such as the menu (also used in Messenger Views), edit profile, edit signature, edit avatar, etc.',
)
);
?>
+775 -708
View File
File diff suppressed because it is too large. Load diff
+135 -6
View File
@@ -2,10 +2,10 @@
/*
+--------------------------------------------------------------------------
| IBFORUMS v1
| Invision Board v1.1
| ========================================
| by Matthew Mecham and David Baxter
| (c) 2001,2002 IBForums
| by Matthew Mecham
| (c) 2001,2002 Invision Power Services
| http://www.ibforums.com
| ========================================
| Web: http://www.ibforums.com
@@ -33,12 +33,15 @@ class db_driver {
"persistent" => "0" ,
"sql_tbl_prefix" => "ibf_" ,
"cached_queries" => array(),
'debug' => 0,
);
var $query_id = "";
var $connection_id = "";
var $query_count = 0;
var $record_row = array();
var $return_die = 0;
var $error = "";
/*========================================================================*/
// Connect to the database
@@ -74,7 +77,7 @@ class db_driver {
/*========================================================================*/
function query($the_query) {
//--------------------------------------
// Change the table prefix if needed
//--------------------------------------
@@ -84,6 +87,13 @@ class db_driver {
$the_query = preg_replace("/ibf_(\S+?)([\s\.,]|$)/", $this->obj['sql_tbl_prefix']."\\1\\2", $the_query);
}
if ($this->obj['debug'])
{
global $Debug, $ibforums;
$Debug->startTimer();
}
$this->query_id = mysql_query($the_query, $this->connection_id);
if (! $this->query_id )
@@ -91,7 +101,77 @@ class db_driver {
$this->fatal_error("mySQL query error: $the_query");
}
$this->query_count++;
if ($this->obj['debug'])
{
$endtime = $Debug->endTimer();
if ( preg_match( "/^select/i", $the_query ) )
{
$eid = mysql_query("EXPLAIN $the_query", $this->connection_id);
$ibforums->debug_html .= "<table width='95%' border='1' cellpadding='6' cellspacing='0' bgcolor='#FFE8F3' align='center'>
<tr>
<td colspan='8' style='font-size:14px' bgcolor='#FFC5Cb'><b>Select Query</b></td>
</tr>
<tr>
<td colspan='8' style='font-family:courier new, courier, monaco, arial;font-size:14px'>$the_query</td>
</tr>
<tr bgcolor='#FFC5Cb'>
<td><b>table</b></td><td><b>type</b></td><td><b>possible_keys</b></td>
<td><b>key</b></td><td><b>key_len</b></td><td><b>ref</b></td>
<td><b>rows</b></td><td><b>Extra</b></td>
</tr>\n";
while( $array = mysql_fetch_array($eid) )
{
$type_col = '#FFFFFF';
if ($array['type'] == 'ref' or $array['type'] == 'eq_ref' or $array['type'] == 'const')
{
$type_col = '#D8FFD4';
}
else if ($array['type'] == 'ALL')
{
$type_col = '#FFEEBA';
}
$ibforums->debug_html .= "<tr bgcolor='#FFFFFF'>
<td>$array[table]&nbsp;</td>
<td bgcolor='$type_col'>$array[type]&nbsp;</td>
<td>$array[possible_keys]&nbsp;</td>
<td>$array[key]&nbsp;</td>
<td>$array[key_len]&nbsp;</td>
<td>$array[ref]&nbsp;</td>
<td>$array[rows]&nbsp;</td>
<td>$array[Extra]&nbsp;</td>
</tr>\n";
}
if ($endtime > 0.1)
{
$endtime = "<span style='color:red'><b>$endtime</b></span>";
}
$ibforums->debug_html .= "<tr>
<td colspan='8' bgcolor='#FFD6DC' style='font-size:14px'><b>mySQL time</b>: $endtime</b></td>
</tr>
</table>\n<br />\n";
}
else
{
$ibforums->debug_html .= "<table width='95%' border='1' cellpadding='6' cellspacing='0' bgcolor='#FEFEFE' align='center'>
<tr>
<td style='font-size:14px' bgcolor='#EFEFEF'><b>Non Select Query</b></td>
</tr>
<tr>
<td style='font-family:courier new, courier, monaco, arial;font-size:14px'>$the_query</td>
</tr>
<tr>
<td style='font-size:14px' bgcolor='#EFEFEF'><b>mySQL time</b>: $endtime</span></td>
</tr>
</table><br />\n\n";
}
}
$this->query_count++;
$this->obj['cached_queries'][] = $the_query;
@@ -167,7 +247,46 @@ class db_driver {
function close_db() {
return mysql_close($this->connection_id);
}
}
/*========================================================================*/
// Return an array of tables
/*========================================================================*/
function get_table_names() {
$result = mysql_list_tables($this->obj['sql_database']);
$num_tables = @mysql_numrows($result);
for ($i = 0; $i < $num_tables; $i++)
{
$tables[] = mysql_tablename($result, $i);
}
mysql_free_result($result);
return $tables;
}
/*========================================================================*/
// Return an array of fields
/*========================================================================*/
function get_result_fields($query_id="") {
if ($query_id == "")
{
$query_id = $this->query_id;
}
while ($field = mysql_fetch_field($query_id))
{
$Fields[] = $field;
}
//mysql_free_result($query_id);
return $Fields;
}
/*========================================================================*/
// Basic error handler
@@ -176,6 +295,15 @@ class db_driver {
function fatal_error($the_error) {
global $INFO;
// Are we simply returning the error?
if ($this->return_die == 1)
{
$this->error = mysql_error();
return TRUE;
}
$the_error .= "\n\nmySQL error: ".mysql_error()."\n";
$the_error .= "mySQL error code: ".mysql_errno()."\n";
$the_error .= "Date: ".date("l dS of F Y h:i:s A");
@@ -206,6 +334,7 @@ class db_driver {
foreach ($data as $k => $v) {
$v = preg_replace( "/'/", "\\'", $v );
//$v = preg_replace( "/#/", "\\#", $v );
$field_names .= "$k,";
$field_values .= "'$v',";
}
+928 -653
View File
File diff suppressed because it is too large. Load diff
+181 -183
View File
@@ -1,183 +1,181 @@
<?php
/*
+--------------------------------------------------------------------------
| IBFORUMS v1
| ========================================
| by Matthew Mecham and David Baxter
| (c) 2001,2002 IBForums
| http://www.ibforums.com
| ========================================
| Web: http://www.ibforums.com
| Email: phpboards@ibforums.com
| Licence Info: phpib-licence@ibforums.com
+---------------------------------------------------------------------------
|
| > Access the help files
| > Module written by Matt Mecham
| > Date started: 24th February 2002
|
| > Module Version Number: 1.0.0
+--------------------------------------------------------------------------
*/
$idx = new Help;
class Help {
var $output = "";
var $page_title = "";
var $nav = array();
var $html = "";
function Help() {
global $ibforums, $DB, $std, $print;
if ($ibforums->input['CODE'] == "") $ibforums->input['CODE'] = '00';
//--------------------------------------------
// Require the HTML and language modules
//--------------------------------------------
$ibforums->lang = $std->load_words($ibforums->lang, 'lang_help', $ibforums->lang_id );
require "./Skin/".$ibforums->skin_id."/skin_help.php";
$this->html = new skin_help();
$this->base_url = "{$ibforums->vars['board_url']}/index.{$ibforums->vars['php_ext']}?s={$ibforums->session_id}";
//--------------------------------------------
// What to do?
//--------------------------------------------
switch($ibforums->input['CODE']) {
case '01':
$this->show_section();
break;
case '02':
$this->do_search();
break;
default:
$this->show_titles();
break;
}
// If we have any HTML to print, do so...
$print->add_output("$this->output");
$print->do_output( array( 'TITLE' => $this->page_title, 'JS' => 0, NAV => $this->nav ) );
}
function show_titles() {
global $ibforums, $DB, $std;
$seen = array();
$this->output = $this->html->start( $ibforums->lang['page_title'], $ibforums->lang['help_txt'], $ibforums->lang['choose_file'] );
$DB->query("SELECT id, title, description from ibf_faq ORDER BY title ASC");
$cnt = 0;
while ($row = $DB->fetch_row() ) {
if (isset($seen[ $row['title'] ]) ) {
continue;
} else {
$seen[ $row['title'] ] = 1;
}
$row['CELL_COLOUR'] = $cnt % 2 ? 'row1' : 'row2';
$cnt++;
$this->output .= $this->html->row($row);
}
$this->output .= $this->html->end();
$this->page_title = $ibforums->lang['page_title'];
$this->nav = array( $ibforums->lang['page_title'] );
}
function show_section() {
global $ibforums, $DB, $std;
$id = $ibforums->input['HID'];
if (! preg_match( "/^(\d+)$/" , $id ) ) {
$std->Error( array( LEVEL => 1, MSG => 'no_search_id') );
}
$DB->query("SELECT id, title, text from ibf_faq WHERE ID='$id'");
$topic = $DB->fetch_row();
$this->output = $this->html->start( $ibforums->lang['help_topic'], $ibforums->lang['topic_text'], $topic['title'] );
$this->output .= $this->html->display( $std->text_tidy( $topic['text'] ) );
$this->output .= $this->html->end();
$this->page_title = $ibforums->lang['help_topic'];
$this->nav = array( "<a href='{$this->base_url}&act=Help'>{$ibforums->lang['help_topics']}</a>", $ibforums->lang['help_topic'] );
}
function do_search() {
global $ibforums, $DB, $std;
if (empty( $ibforums->input['search_q'] ) ) {
$std->Error( array( LEVEL => 1, MSG => 'search_no_input') );
}
$search_string = strtolower( str_replace( "*" , "%", $ibforums->input['search_q'] ) );
$search_string = preg_replace( "/[<>\!\@£\$\^&\+\=\=\[\]\{\}\(\)\"':;\.,\/]/", "", $search_string );
$seen = array();
$this->output = $this->html->start( $ibforums->lang['search_results'], $ibforums->lang['results_txt'], $ibforums->lang['search_results'] );
$DB->query("SELECT id, title from ibf_faq WHERE LOWER(title) LIKE '%$search_string%' or LOWER(text) LIKE '%$search_string%' ORDER BY title ASC");
$cnt = 0;
while ($row = $DB->fetch_row() ) {
if (isset($seen[ $row['title'] ]) ) {
continue;
} else {
$seen[ $row['title'] ] = 1;
}
$row['CELL_COLOUR'] = $cnt % 2 ? 'row1' : 'row2';
$cnt++;
$this->output .= $this->html->row($row);
}
if ($cnt == 0) {
$this->output .= $this->html->no_results();
}
$this->output .= $this->html->end();
$this->page_title = $ibforums->lang['page_title'];
$this->nav = array( "<a href='{$this->base_url}&act=Help'>{$ibforums->lang['help_topics']}</a>", $ibforums->lang['results_title'] );
}
}
?>
<?php
/*
+--------------------------------------------------------------------------
| Invision Board v1.1
| ========================================
| by Matthew Mecham
| (c) 2001,2002 Invision Power Services
| http://www.ibforums.com
| ========================================
| Web: http://www.ibforums.com
| Email: phpboards@ibforums.com
| Licence Info: phpib-licence@ibforums.com
+---------------------------------------------------------------------------
|
| > Access the help files
| > Module written by Matt Mecham
| > Date started: 24th February 2002
|
| > Module Version Number: 1.0.0
+--------------------------------------------------------------------------
*/
$idx = new Help;
class Help {
var $output = "";
var $page_title = "";
var $nav = array();
var $html = "";
function Help() {
global $ibforums, $DB, $std, $print;
if ($ibforums->input['CODE'] == "") $ibforums->input['CODE'] = '00';
//--------------------------------------------
// Require the HTML and language modules
//--------------------------------------------
$ibforums->lang = $std->load_words($ibforums->lang, 'lang_help', $ibforums->lang_id );
$this->html = $std->load_template('skin_help');
$this->base_url = "{$ibforums->vars['board_url']}/index.{$ibforums->vars['php_ext']}?s={$ibforums->session_id}";
//--------------------------------------------
// What to do?
//--------------------------------------------
switch($ibforums->input['CODE']) {
case '01':
$this->show_section();
break;
case '02':
$this->do_search();
break;
default:
$this->show_titles();
break;
}
// If we have any HTML to print, do so...
$print->add_output("$this->output");
$print->do_output( array( 'TITLE' => $this->page_title, 'JS' => 0, NAV => $this->nav ) );
}
function show_titles() {
global $ibforums, $DB, $std;
$seen = array();
$this->output = $this->html->start( $ibforums->lang['page_title'], $ibforums->lang['help_txt'], $ibforums->lang['choose_file'] );
$DB->query("SELECT id, title, description from ibf_faq ORDER BY title ASC");
$cnt = 0;
while ($row = $DB->fetch_row() ) {
if (isset($seen[ $row['title'] ]) ) {
continue;
} else {
$seen[ $row['title'] ] = 1;
}
$row['CELL_COLOUR'] = $cnt % 2 ? 'row1' : 'row2';
$cnt++;
$this->output .= $this->html->row($row);
}
$this->output .= $this->html->end();
$this->page_title = $ibforums->lang['page_title'];
$this->nav = array( $ibforums->lang['page_title'] );
}
function show_section() {
global $ibforums, $DB, $std;
$id = $ibforums->input['HID'];
if (! preg_match( "/^(\d+)$/" , $id ) ) {
$std->Error( array( LEVEL => 1, MSG => 'no_search_id') );
}
$DB->query("SELECT id, title, text from ibf_faq WHERE ID='$id'");
$topic = $DB->fetch_row();
$this->output = $this->html->start( $ibforums->lang['help_topic'], $ibforums->lang['topic_text'], $topic['title'] );
$this->output .= $this->html->display( $std->text_tidy( $topic['text'] ) );
$this->output .= $this->html->end();
$this->page_title = $ibforums->lang['help_topic'];
$this->nav = array( "<a href='{$this->base_url}&act=Help'>{$ibforums->lang['help_topics']}</a>", $ibforums->lang['help_topic'] );
}
function do_search() {
global $ibforums, $DB, $std;
if (empty( $ibforums->input['search_q'] ) ) {
$std->Error( array( LEVEL => 1, MSG => 'search_no_input') );
}
$search_string = strtolower( str_replace( "*" , "%", $ibforums->input['search_q'] ) );
$search_string = preg_replace( "/[<>\!\@£\$\^&\+\=\=\[\]\{\}\(\)\"':;\.,\/]/", "", $search_string );
$seen = array();
$this->output = $this->html->start( $ibforums->lang['search_results'], $ibforums->lang['results_txt'], $ibforums->lang['search_results'] );
$DB->query("SELECT id, title from ibf_faq WHERE LOWER(title) LIKE '%$search_string%' or LOWER(text) LIKE '%$search_string%' ORDER BY title ASC");
$cnt = 0;
while ($row = $DB->fetch_row() ) {
if (isset($seen[ $row['title'] ]) ) {
continue;
} else {
$seen[ $row['title'] ] = 1;
}
$row['CELL_COLOUR'] = $cnt % 2 ? 'row1' : 'row2';
$cnt++;
$this->output .= $this->html->row($row);
}
if ($cnt == 0) {
$this->output .= $this->html->no_results();
}
$this->output .= $this->html->end();
$this->page_title = $ibforums->lang['page_title'];
$this->nav = array( "<a href='{$this->base_url}&act=Help'>{$ibforums->lang['help_topics']}</a>", $ibforums->lang['results_title'] );
}
}
?>
+468 -427
View File
@@ -1,427 +1,468 @@
<?php
/*
+--------------------------------------------------------------------------
| IBFORUMS v1
| ========================================
| by Matthew Mecham and David Baxter
| (c) 2001,2002 IBForums
| http://www.ibforums.com
| ========================================
| Web: http://www.ibforums.com
| Email: phpboards@ibforums.com
| Licence Info: phpib-licence@ibforums.com
+---------------------------------------------------------------------------
|
| > Log in / log out module
| > Module written by Matt Mecham
| > Date started: 14th February 2002
|
| > Module Version Number: 1.0.0
+--------------------------------------------------------------------------
*/
$idx = new Login;
class Login {
var $output = "";
var $page_title = "";
var $nav = array();
var $login_html = "";
function Login() {
global $ibforums, $DB, $std, $print;
// Make sure our code number is numerical only
//$ibforums->input['CODE'] = preg_replace("/^([0-9]+)$/", "$1", $ibforums->input[CODE]);
// Require the HTML and language modules
$ibforums->lang = $std->load_words($ibforums->lang, 'lang_login', $ibforums->lang_id);
require "./Skin/".$ibforums->skin_id."/skin_login.php";
$this->login_html = new skin_login();
// Are we enforcing log ins?
if ($ibforums->vars['force_login'] == 1)
{
$msg = 'admin_force_log_in';
}
else
{
$msg = "";
}
// What to do?
switch($ibforums->input['CODE']) {
case '01':
$this->do_log_in();
break;
case '02':
$this->log_in_form();
break;
case '03':
$this->do_log_out();
break;
case '04':
$this->markforum();
break;
case '05':
$this->markboard();
break;
case '06':
$this->delete_cookies();
break;
default:
$this->log_in_form($msg);
break;
}
// If we have any HTML to print, do so...
$print->add_output("$this->output");
$print->do_output( array( 'TITLE' => $this->page_title, 'JS' => 0, NAV => $this->nav ) );
}
function delete_cookies()
{
global $ibforums, $DB, $std, $HTTP_COOKIE_VARS;
if (is_array($HTTP_COOKIE_VARS))
{
foreach( $HTTP_COOKIE_VARS as $cookie => $value)
{
if (preg_match( "/^(".$ibforums->vars['cookie_id']."fread.*$)/", $cookie, $match))
{
$std->my_setcookie( str_replace( $ibforums->vars['cookie_id'], "", $match[0] ) , '-1', -1 );
}
if (preg_match( "/^(".$ibforums->vars['cookie_id']."ibforum.*$)/i", $cookie, $match))
{
$std->my_setcookie( str_replace( $ibforums->vars['cookie_id'], "", $match[0] ) , '-', -1 );
}
}
}
$std->my_setcookie('pass_hash' , '-1');
$std->my_setcookie('member_id' , '-1');
$std->my_setcookie('session_id', '-1');
$std->my_setcookie('topicsread', '-1');
$std->my_setcookie('anonlogin' , '-1');
$std->boink_it($ibforums->base_url);
exit();
}
function markboard()
{
global $ibforums, $DB, $std;
if(! $ibforums->member['id'])
{
$std->Error( array( LEVEL => 1, MSG => 'no_guests') );
}
$DB->query("UPDATE ibf_members SET last_visit='".time()."', last_activity='".time()."' WHERE id='".$ibforums->member['id']."'");
$std->boink_it($ibforums->base_url);
exit();
}
function markforum() {
global $ibforums, $DB, $std;
$ibforums->input['f'] = preg_replace( "/^(\d+)$/", "\\1", $ibforums->input['f'] );
if ($ibforums->input['f'] == "")
{
$std->Error( array( LEVEL => 1, MSG => 'missing_files' ) );
}
$std->my_setcookie( "fread_".$ibforums->input['f'], time() );
$std->boink_it($ibforums->base_url);
exit();
}
function log_in_form($message="") {
global $ibforums, $DB, $std, $print, $HTTP_REFERER;
//+--------------------------------------------
//| Are they banned?
//+--------------------------------------------
if ($ibforums->vars['ban_ip'])
{
$ips = explode( "|", $ibforums->vars['ban_ip'] );
foreach ($ips as $ip)
{
$ip = preg_replace( "/\*/", '.*' , $ip );
if (preg_match( "/$ip/", $ibforums->input['IP_ADDRESS'] ))
{
$std->Error( array( LEVEL => 1, MSG => 'you_are_banned' ) );
}
}
}
//+--------------------------------------------
if ($message != "")
{
$message = $ibforums->lang[ $message ];
$message = preg_replace( "/<#NAME#>/", "<b>{$ibforums->input[UserName]}</b>", $message );
$this->output .= $this->login_html->errors($message);
}
$this->login_html->IN[REFERER] = $HTTP_REFERER;
$this->output .= $this->login_html->ShowForm( $ibforums->lang['please_log_in'] );
$this->nav = array( $ibforums->lang['log_in'] );
$this->page_title = $ibforums->lang['log_in'];
$print->add_output("$this->output");
$print->do_output( array( 'TITLE' => $this->page_title, 'JS' => 0, NAV => $this->nav ) );
exit();
}
function do_log_in() {
global $DB, $ibforums, $std, $print, $sess, $HTTP_USER_AGENT, $HTTP_POST_VARS;
$url = "";
//-------------------------------------------------
// Make sure the username and password were entered
//-------------------------------------------------
if ($HTTP_POST_VARS['UserName'] == "")
{
$std->Error( array( 'LEVEL' => 1, 'MSG' => 'no_username' ) );
}
if ($HTTP_POST_VARS['PassWord'] == "")
{
$std->Error( array( 'LEVEL' => 1, 'MSG' => 'pass_blank' ) );
}
//-------------------------------------------------
// Check for input length
//-------------------------------------------------
if (strlen($ibforums->input['UserName']) > 32)
{
$std->Error( array( LEVEL => 1, MSG => 'username_long' ) );
}
if (strlen($ibforums->input['PassWord']) > 32)
{
$std->Error( array( LEVEL => 1, MSG => 'pass_too_long' ) );
}
$username = strtolower($ibforums->input['UserName']);
$password = md5( $ibforums->input['PassWord'] );
//-------------------------------------------------
// Attempt to get the user details
//-------------------------------------------------
$DB->query("SELECT id, name, mgroup, password, new_pass FROM ibf_members WHERE LOWER(name)='$username'");
if ($DB->get_num_rows())
{
$member = $DB->fetch_row();
if ( empty($member['id']) or ($member['id'] == "") )
{
$this->log_in_form( 'wrong_name' );
}
if ($member['password'] != $password)
{
$this->log_in_form( 'wrong_pass' );
}
//------------------------------
if ($ibforums->input['CookieDate'])
{
$std->my_setcookie("member_id" , $member['id'], 1);
$std->my_setcookie("pass_hash" , $password, 1);
}
//------------------------------
if ($ibforums->input['s'])
{
$session_id = $ibforums->input['s'];
// Delete any old sessions with this users IP addy that doesn't match our
// session ID.
$DB->query("DELETE FROM ibf_sessions WHERE ip_address='".$ibforums->input['IP_ADDRESS']."' AND id <> '$session_id'");
$db_string = $DB->compile_db_update_string( array (
'member_name' => $member['name'],
'member_pass' => "",
'member_id' => $member['id'],
'running_time' => time(),
'member_group' => $member['mgroup'],
'login_type' => $ibforums->input['Privacy'] ? 1 : 0
) );
$db_query = "UPDATE ibf_sessions SET $db_string WHERE id='".$ibforums->input['s']."'";
}
else
{
$session_id = md5( uniqid(microtime()) );
// Delete any old sessions with this users IP addy.
$DB->query("DELETE FROM ibf_sessions WHERE ip_address='".$ibforums->input['IP_ADDRESS']."'");
$db_string = $DB->compile_db_insert_string( array (
'id' => $session_id,
'member_name' => $member['name'],
'member_pass' => "",
'member_id' => $member['id'],
'running_time' => time(),
'member_group' => $member['mgroup'],
'ip_address' => substr($ibforums->input['IP_ADDRESS'], 0, 50),
'browser' => substr($HTTP_USER_AGENT, 0, 50),
'start_session'=> time(),
'login_type' => $ibforums->input['Privacy'] ? 1 : 0
) );
$db_query = "INSERT INTO ibf_sessions (" .$db_string['FIELD_NAMES']. ") VALUES (". $db_string['FIELD_VALUES'] .")";
}
$DB->query( $db_query );
//-----------------------------------
// If a bogus reset passy action occured,
// and we managed to log in, we'll assume
// that the user did nothing, so we remove
// this new pass setting.
//-----------------------------------
if ($member['new_pass'] != "")
{
$DB->query("UPDATE ibf_members SET new_pass='' WHERE id='".$member['id']."'");
}
$ibforums->member = $member;
$ibforums->session_id = $session_id;
if ($ibforums->input['referer'] && ($ibforums->input['act'] != 'Reg'))
{
$url = $ibforums->input['referer'];
$url = preg_replace( "!^\?!" , "" , $url );
$url = preg_replace( "!s=(\w){32}!", "" , $url );
$url = preg_replace( "!act=(login|reg|lostpass)!i", "", $url );
}
//-----------------------------------
// set our privacy cookie
//-----------------------------------
if ($ibforums->input['Privacy'] == 1)
{
$std->my_setcookie( "anonlogin", 1 );
}
//-----------------------------------
// Redirect them to either the board
// index, or where they came from
//-----------------------------------
$print->redirect_screen( "{$ibforums->lang[thanks_for_login]} {$ibforums->member['name']}", $url );
}
else
{
$this->log_in_form( 'wrong_name' );
}
}
function do_log_out() {
global $std, $ibforums, $DB, $print, $sess, $HTTP_COOKIE_VARS;
/*if(! $ibforums->member['id'])
{
$std->Error( array( LEVEL => 1, MSG => 'no_guests') );
}*/
// Update the DB
$DB->query("UPDATE ibf_sessions SET ".
"member_name='',".
"member_id='0',".
"member_pass='',".
"login_type='0' ".
"WHERE id='". $sess->session_id ."'");
$DB->query("UPDATE ibf_members SET last_visit='".time()."', last_activity='".time()."' WHERE id='".$ibforums->member['id']."'");
// Set some cookies
$std->my_setcookie( "member_id" , "0" );
$std->my_setcookie( "pass_hash" , "0" );
$std->my_setcookie( "anonlogin" , "-1" );
if (is_array($HTTP_COOKIE_VARS))
{
foreach( $HTTP_COOKIE_VARS as $cookie => $value )
{
if (preg_match( "/^(".$ibforums->vars['cookie_id']."fread.*$)/", $cookie, $match))
{
$std->my_setcookie( str_replace( $ibforums->vars['cookie_id'], "", $match[0] ) , '-1', -1 );
}
if (preg_match( "/^(".$ibforums->vars['cookie_id']."ibforum.*$)/i", $cookie, $match))
{
$std->my_setcookie( str_replace( $ibforums->vars['cookie_id'], "", $match[0] ) , '-', -1 );
}
}
}
// Redirect...
$print->redirect_screen( $ibforums->lang['thanks_for_logout'], "" );
}
}
?>
<?php
/*
+--------------------------------------------------------------------------
| Invision Board v1.1
| ========================================
| by Matthew Mecham
| (c) 2001,2002 Invision Power Services
| http://www.ibforums.com
| ========================================
| Web: http://www.ibforums.com
| Email: phpboards@ibforums.com
| Licence Info: phpib-licence@ibforums.com
+---------------------------------------------------------------------------
|
| > Log in / log out module
| > Module written by Matt Mecham
| > Date started: 14th February 2002
|
| > Module Version Number: 1.0.0
+--------------------------------------------------------------------------
*/
$idx = new Login;
class Login {
var $output = "";
var $page_title = "";
var $nav = array();
var $login_html = "";
function Login() {
global $ibforums, $DB, $std, $print;
$ibforums->lang = $std->load_words($ibforums->lang, 'lang_login', $ibforums->lang_id);
$this->login_html = $std->load_template('skin_login');
// Are we enforcing log ins?
if ($ibforums->vars['force_login'] == 1)
{
$msg = 'admin_force_log_in';
}
else
{
$msg = "";
}
// What to do?
switch($ibforums->input['CODE']) {
case '01':
$this->do_log_in();
break;
case '02':
$this->log_in_form();
break;
case '03':
$this->do_log_out();
break;
case '04':
$this->markforum();
break;
case '05':
$this->markboard();
break;
case '06':
$this->delete_cookies();
break;
case 'autologin':
$this->auto_login();
break;
default:
$this->log_in_form($msg);
break;
}
// If we have any HTML to print, do so...
$print->add_output("$this->output");
$print->do_output( array( 'TITLE' => $this->page_title, 'JS' => 0, NAV => $this->nav ) );
}
function auto_login()
{
global $ibforums, $DB, $std, $print;
// Universal routine.
// If we have cookies / session created, simply return to the index screen
// If not, return to the log in form
$true_words = $ibforums->lang['logged_in'];
$false_words = $ibforums->lang['not_logged_in'];
$method = 'no_show';
if ($ibforums->input['fromreg'] == 1)
{
$true_words = $ibforums->lang['reg_log_in'];
$false_words = $ibforums->lang['reg_not_log_in'];
$method = 'show';
}
if ($ibforums->member['id'])
{
if ($method == 'show')
{
$print->redirect_screen( $true_words, "" );
}
else
{
$std->boink_it($ibforums->base_url);
}
}
else
{
if ($method == 'show')
{
$print->redirect_screen( $false_words, 'act=Login&CODE=00' );
}
else
{
$std->boink_it($ibforums->base_url.'&act=Login&CODE=00');
}
}
}
function delete_cookies()
{
global $ibforums, $DB, $std, $HTTP_COOKIE_VARS;
if (is_array($HTTP_COOKIE_VARS))
{
foreach( $HTTP_COOKIE_VARS as $cookie => $value)
{
if (preg_match( "/^(".$ibforums->vars['cookie_id']."fread.*$)/", $cookie, $match))
{
$std->my_setcookie( str_replace( $ibforums->vars['cookie_id'], "", $match[0] ) , '-1', -1 );
}
if (preg_match( "/^(".$ibforums->vars['cookie_id']."ibforum.*$)/i", $cookie, $match))
{
$std->my_setcookie( str_replace( $ibforums->vars['cookie_id'], "", $match[0] ) , '-', -1 );
}
}
}
$std->my_setcookie('pass_hash' , '-1');
$std->my_setcookie('member_id' , '-1');
$std->my_setcookie('session_id', '-1');
$std->my_setcookie('topicsread', '-1');
$std->my_setcookie('anonlogin' , '-1');
$std->boink_it($ibforums->base_url);
exit();
}
function markboard()
{
global $ibforums, $DB, $std;
if(! $ibforums->member['id'])
{
$std->Error( array( LEVEL => 1, MSG => 'no_guests') );
}
$DB->query("UPDATE ibf_members SET last_visit='".time()."', last_activity='".time()."' WHERE id='".$ibforums->member['id']."'");
$std->boink_it($ibforums->base_url);
exit();
}
function markforum() {
global $ibforums, $DB, $std;
$ibforums->input['f'] = preg_replace( "/^(\d+)$/", "\\1", $ibforums->input['f'] );
if ($ibforums->input['f'] == "")
{
$std->Error( array( LEVEL => 1, MSG => 'missing_files' ) );
}
$std->my_setcookie( "fread_".$ibforums->input['f'], time() );
$std->boink_it($ibforums->base_url);
exit();
}
function log_in_form($message="") {
global $ibforums, $DB, $std, $print, $HTTP_REFERER;
//+--------------------------------------------
//| Are they banned?
//+--------------------------------------------
if ($ibforums->vars['ban_ip'])
{
$ips = explode( "|", $ibforums->vars['ban_ip'] );
foreach ($ips as $ip)
{
$ip = preg_replace( "/\*/", '.*' , $ip );
if (preg_match( "/$ip/", $ibforums->input['IP_ADDRESS'] ))
{
$std->Error( array( LEVEL => 1, MSG => 'you_are_banned' ) );
}
}
}
//+--------------------------------------------
if ($message != "")
{
$message = $ibforums->lang[ $message ];
$message = preg_replace( "/<#NAME#>/", "<b>{$ibforums->input[UserName]}</b>", $message );
$this->output .= $this->login_html->errors($message);
}
$this->output .= $this->login_html->ShowForm( $ibforums->lang['please_log_in'], $HTTP_REFERER );
$this->nav = array( $ibforums->lang['log_in'] );
$this->page_title = $ibforums->lang['log_in'];
$print->add_output("$this->output");
$print->do_output( array( 'TITLE' => $this->page_title, 'JS' => 0, NAV => $this->nav ) );
exit();
}
//+--------------------------------------------
function do_log_in() {
global $DB, $ibforums, $std, $print, $sess, $HTTP_USER_AGENT, $HTTP_POST_VARS;
$url = "";
//-------------------------------------------------
// Make sure the username and password were entered
//-------------------------------------------------
if ($HTTP_POST_VARS['UserName'] == "")
{
$std->Error( array( 'LEVEL' => 1, 'MSG' => 'no_username' ) );
}
if ($HTTP_POST_VARS['PassWord'] == "")
{
$std->Error( array( 'LEVEL' => 1, 'MSG' => 'pass_blank' ) );
}
//-------------------------------------------------
// Check for input length
//-------------------------------------------------
if (strlen($ibforums->input['UserName']) > 32)
{
$std->Error( array( LEVEL => 1, MSG => 'username_long' ) );
}
if (strlen($ibforums->input['PassWord']) > 32)
{
$std->Error( array( LEVEL => 1, MSG => 'pass_too_long' ) );
}
$username = strtolower($ibforums->input['UserName']);
$password = md5( $ibforums->input['PassWord'] );
//-------------------------------------------------
// Attempt to get the user details
//-------------------------------------------------
$DB->query("SELECT id, name, mgroup, password, new_pass FROM ibf_members WHERE LOWER(name)='$username'");
if ($DB->get_num_rows())
{
$member = $DB->fetch_row();
if ( empty($member['id']) or ($member['id'] == "") )
{
$this->log_in_form( 'wrong_name' );
}
if ($member['password'] != $password)
{
$this->log_in_form( 'wrong_pass' );
}
//------------------------------
if ($ibforums->input['CookieDate'])
{
$std->my_setcookie("member_id" , $member['id'], 1);
$std->my_setcookie("pass_hash" , $password, 1);
}
//------------------------------
if ($ibforums->input['s'])
{
$session_id = $ibforums->input['s'];
// Delete any old sessions with this users IP addy that doesn't match our
// session ID.
$DB->query("DELETE FROM ibf_sessions WHERE ip_address='".$ibforums->input['IP_ADDRESS']."' AND id <> '$session_id'");
$db_string = $DB->compile_db_update_string( array (
'member_name' => $member['name'],
'member_id' => $member['id'],
'running_time' => time(),
'member_group' => $member['mgroup'],
'login_type' => $ibforums->input['Privacy'] ? 1 : 0
) );
$db_query = "UPDATE ibf_sessions SET $db_string WHERE id='".$ibforums->input['s']."'";
}
else
{
$session_id = md5( uniqid(microtime()) );
// Delete any old sessions with this users IP addy.
$DB->query("DELETE FROM ibf_sessions WHERE ip_address='".$ibforums->input['IP_ADDRESS']."'");
$db_string = $DB->compile_db_insert_string( array (
'id' => $session_id,
'member_name' => $member['name'],
'member_id' => $member['id'],
'running_time' => time(),
'member_group' => $member['mgroup'],
'ip_address' => substr($ibforums->input['IP_ADDRESS'], 0, 50),
'browser' => substr($HTTP_USER_AGENT, 0, 50),
'login_type' => $ibforums->input['Privacy'] ? 1 : 0
) );
$db_query = "INSERT INTO ibf_sessions (" .$db_string['FIELD_NAMES']. ") VALUES (". $db_string['FIELD_VALUES'] .")";
}
$DB->query( $db_query );
//-----------------------------------
// If a bogus reset passy action occured,
// and we managed to log in, we'll assume
// that the user did nothing, so we remove
// this new pass setting.
//-----------------------------------
if ($member['new_pass'] != "")
{
$DB->query("UPDATE ibf_members SET new_pass='' WHERE id='".$member['id']."'");
}
$ibforums->member = $member;
$ibforums->session_id = $session_id;
if ($ibforums->input['referer'] && ($ibforums->input['act'] != 'Reg'))
{
$url = $ibforums->input['referer'];
$url = str_replace( "{$ibforums->vars['board_url']}/index.{$ibforums->vars['php_ext']}", "", $url );
$url = preg_replace( "!^\?!" , "" , $url );
$url = preg_replace( "!s=(\w){32}!", "" , $url );
$url = preg_replace( "!act=(login|reg|lostpass)!i", "", $url );
}
//-----------------------------------
// set our privacy cookie
//-----------------------------------
if ($ibforums->input['Privacy'] == 1)
{
$std->my_setcookie( "anonlogin", 1 );
}
//-----------------------------------
// Redirect them to either the board
// index, or where they came from
//-----------------------------------
$print->redirect_screen( "{$ibforums->lang[thanks_for_login]} {$ibforums->member['name']}", $url );
}
else
{
$this->log_in_form( 'wrong_name' );
}
}
function do_log_out() {
global $std, $ibforums, $DB, $print, $sess, $HTTP_COOKIE_VARS;
/*if(! $ibforums->member['id'])
{
$std->Error( array( LEVEL => 1, MSG => 'no_guests') );
}*/
// Update the DB
$DB->query("UPDATE ibf_sessions SET ".
"member_name='',".
"member_id='0',".
"login_type='0' ".
"WHERE id='". $sess->session_id ."'");
$DB->query("UPDATE ibf_members SET last_visit='".time()."', last_activity='".time()."' WHERE id='".$ibforums->member['id']."'");
// Set some cookies
$std->my_setcookie( "member_id" , "0" );
$std->my_setcookie( "pass_hash" , "0" );
$std->my_setcookie( "anonlogin" , "-1" );
if (is_array($HTTP_COOKIE_VARS))
{
foreach( $HTTP_COOKIE_VARS as $cookie => $value )
{
if (preg_match( "/^(".$ibforums->vars['cookie_id']."fread.*$)/", $cookie, $match))
{
$std->my_setcookie( str_replace( $ibforums->vars['cookie_id'], "", $match[0] ) , '-1', -1 );
}
if (preg_match( "/^(".$ibforums->vars['cookie_id']."ibforum.*$)/i", $cookie, $match))
{
$std->my_setcookie( str_replace( $ibforums->vars['cookie_id'], "", $match[0] ) , '-', -1 );
}
}
}
// Redirect...
$print->redirect_screen( $ibforums->lang['thanks_for_logout'], "" );
}
}
?>
+343 -290
View File
@@ -1,290 +1,343 @@
<?php
/*
+--------------------------------------------------------------------------
| IBFORUMS v1
| ========================================
| by Matthew Mecham and David Baxter
| (c) 2001,2002 IBForums
| http://www.ibforums.com
| ========================================
| Web: http://www.ibforums.com
| Email: phpboards@ibforums.com
| Licence Info: phpib-licence@ibforums.com
+---------------------------------------------------------------------------
|
| > Show all the members
| > Module written by Matt Mecham
| > Date started: 20th February 2002
|
| > Module Version Number: 1.0.0
+--------------------------------------------------------------------------
*/
$idx = new Memberlist;
class Memberlist {
var $output = "";
var $page_title = "";
var $nav = array();
var $html = "";
var $base_url = "";
var $first = 0;
var $max_results = 10;
var $sort_key = 'name';
var $sort_order = 'asc';
var $filter = 'ALL';
var $mem_titles = array();
var $mem_groups = array();
function Memberlist() {
global $ibforums, $DB, $std, $print;
if ($ibforums->input['CODE'] == "") $ibforums->input['CODE'] = 'listall';
//--------------------------------------------
// Require the HTML and language modules
//--------------------------------------------
$ibforums->lang = $std->load_words($ibforums->lang, 'lang_mlist', $ibforums->lang_id );
require "./Skin/".$ibforums->skin_id."/skin_mlist.php";
$this->html = new skin_mlist();
$this->base_url = "{$ibforums->vars['board_url']}/index.{$ibforums->vars['php_ext']}?s={$ibforums->session_id}";
if ($ibforums->member['g_mem_info'] != 1)
{
$std->Error( array( 'LEVEL' => 1, 'MSG' => 'no_permission' ) );
}
//--------------------------------------------
// Get the member groups, member titles stuff
//--------------------------------------------
$DB->query("SELECT g_title, g_id, g_icon from ibf_groups ORDER BY g_title");
while ($row = $DB->fetch_row() )
{
$this->mem_groups[ $row['g_id'] ] = array( 'TITLE' => $row['g_title'],
'ICON' => $row['g_icon'],
);
}
unset($row);
$DB->free_result();
$DB->query("SELECT title, id, posts, pips from ibf_titles ORDER BY posts DESC");
while ($row = $DB->fetch_row() )
{
$this->mem_titles[ $row['id'] ] = array( 'TITLE' => $row['title'],
'POSTS' => $row['posts'],
'PIPS' => $row['pips'],
);
}
unset($row);
$DB->free_result();
$the_filter = array( 'ALL' => $ibforums->lang['show_all'] );
foreach($this->mem_groups as $id => $data)
{
if ($id == $ibforums->vars['guest_group']) continue;
if ($id == $ibforums->vars['auth_group']) continue;
if ($id == $ibforums->vars['ban_group']) continue;
$the_filter[$id] = $data['TITLE'];
}
if (isset($ibforums->input['st'])) $this->first = $ibforums->input['st'];
if (isset($ibforums->input['max_results'])) $this->max_results = $ibforums->input['max_results'];
if (isset($ibforums->input['sort_key'])) $this->sort_key = $ibforums->input['sort_key'];
if (isset($ibforums->input['sort_order'])) $this->sort_order = $ibforums->input['sort_order'];
if (isset($ibforums->input['filter'])) $this->filter = $ibforums->input['filter'];
$the_sort_key = array( 'name' => 'sort_by_name',
'posts' => 'sort_by_posts',
'joined' => 'sort_by_joined',
);
$the_max_results = array( 10 => '10',
20 => '20',
30 => '30',
40 => '40',
50 => '50',
);
$the_sort_order = array( 'desc' => 'descending_order',
'asc' => 'ascending_order',
);
$filter_html = "<select name='filter' class='forminput'>\n";
$sort_key_html = "<select name='sort_key' class='forminput'>\n";
$max_results_html = "<select name='max_results' class='forminput'>\n";
$sort_order_html = "<select name='sort_order' class='forminput'>\n";
foreach ($the_sort_order as $k => $v) {
$sort_order_html .= $k == $this->sort_order ? "<option value='$k' selected>" . $ibforums->lang[ $the_sort_order[ $k ] ] . "\n"
: "<option value='$k'>" . $ibforums->lang[ $the_sort_order[ $k ] ] . "\n";
}
foreach ($the_filter as $k => $v) {
$filter_html .= $k == $this->filter ? "<option value='$k' selected>" . $the_filter[ $k ] . "\n"
: "<option value='$k'>" . $the_filter[ $k ] . "\n";
}
foreach ($the_sort_key as $k => $v) {
$sort_key_html .= $k == $this->sort_key ? "<option value='$k' selected>" . $ibforums->lang[ $the_sort_key[ $k ] ] . "\n"
: "<option value='$k'>" . $ibforums->lang[ $the_sort_key[ $k ] ] . "\n";
}
foreach ($the_max_results as $k => $v) {
$max_results_html .= $k == $this->max_results ? "<option value='$k' selected>". $the_max_results[ $k ] . "\n"
: "<option value='$k'>" . $the_max_results[ $k ] . "\n";
}
$ibforums->lang['sorting_text'] = preg_replace( "/<#FILTER#>/" , $filter_html."</select>" , $ibforums->lang['sorting_text'] );
$ibforums->lang['sorting_text'] = preg_replace( "/<#SORT_KEY#>/" , $sort_key_html."</select>" , $ibforums->lang['sorting_text'] );
$ibforums->lang['sorting_text'] = preg_replace( "/<#SORT_ORDER#>/" , $sort_order_html."</select>" , $ibforums->lang['sorting_text'] );
$ibforums->lang['sorting_text'] = preg_replace( "/<#MAX_RESULTS#>/" , $max_results_html."</select>", $ibforums->lang['sorting_text'] );
$error = 0;
if (! isset($the_sort_key[ $this->sort_key ]) ) $error = 1;
if (! isset($the_sort_order[ $this->sort_order ]) ) $error = 1;
if (! isset($the_filter[ $this->filter ]) ) $error = 1;
if (! isset($the_max_results[ $this->max_results ]) ) $error = 1;
if ($error == 1 )
{
$std->Error( array( LEVEL=> 5, MSG =>'incorrect_use') );
}
//---------------------------------------------
// Find out how many members match our criteria
//---------------------------------------------
$q_extra = $this->filter == 'ALL' ? '' : " and mgroup='".$this->filter."' ";
$DB->query("SELECT COUNT(id) as total_members FROM ibf_members WHERE id > 0".$q_extra);
$max = $DB->fetch_row();
$DB->free_result();
$links = $std->build_pagelinks( array( 'TOTAL_POSS' => $max['total_members'],
'PER_PAGE' => $this->max_results,
'CUR_ST_VAL' => $this->first,
'L_SINGLE' => "",
'L_MULTI' => $ibforums->lang['pages'],
'BASE_URL' => $this->base_url."&act=Members&max_results={$this->max_results}&filter={$this->filter}&sort_order={$this->sort_order}&sort_key={$this->sort_key}"
)
);
$this->output = $this->html->start();
$this->output .= $this->html->Page_header( array( 'SHOW_PAGES' => $links) );
//-----------------------------
// START THE LISTING
//-----------------------------
$DB->query("SELECT name, id, posts, joined, mgroup, email,title, hide_email, location, aim_name, icq_number "
."FROM ibf_members WHERE id > 0".$q_extra." ORDER BY ".$this->sort_key." ".$this->sort_order." LIMIT ".$this->first.",".$this->max_results);
while($member = $DB->fetch_row() )
{
$pips = 0;
foreach($this->mem_titles as $k => $v)
{
if ($member['posts'] >= $v['POSTS']) {
if (!$member['title'])
{
$member['title'] = $this->mem_titles[ $k ]['TITLE'];
}
$pips = $v['PIPS'];
break;
}
}
if ($this->mem_groups[ $member['mgroup'] ]['ICON'])
{
$member[MEMBER_PIPS_IMG] = "<img src='{$ibforums->vars[TEAM_ICON_URL]}/{$this->mem_groups[ $member['mgroup'] ][ICON]}' border='0'>";
}
else
{
if ($pips)
{
if (preg_match( "/^\d+$/", $pips ) )
{
for ($i = 1; $i <= $pips; ++$i)
{
$member['MEMBER_PIPS_IMG'] .= $ibforums->skin['A_STAR'];
}
}
else
{
$member['MEMBER_PIPS_IMG'] = "<img src='{$ibforums->vars[TEAM_ICON_URL]}/$pips' border='0'>";
}
}
}
$member['MEMBER_JOINED'] = $std->get_date( $member['joined'], 'JOINED' );
$member['MEMBER_GROUP'] = $this->mem_groups[ $member['mgroup'] ]['TITLE'];
if (!$member['hide_email']) {
$member['MEMBER_EMAIL'] = "<a href='{$this->base_url}&act=Mail&CODE=00&MID={$member['id']}'>{$ibforums->skin[P_EMAIL]}</a>&nbsp;";
} else {
$member['MEMBER_EMAIL'] = '&nbsp;';
}
if ($member['icq_number']) {
$member['ICQNUMBER'] = "<a href=\"javascript:PopUp('{$this->base_url}&act=ICQ&MID={$member['id']}','Pager','450','330','0','1','1','1')\">{$ibforums->skin[P_ICQ]}</a>&nbsp;";
} else {
$member['ICQNUMBER'] = '&nbsp;';
}
if ($member['aim_name']) {
$member[AOLNAME] = "<a href=\"javascript:PopUp('{$this->base_url}&act=AOL&MID={$member['id']}','Pager','450','330','0','1','1','1')\">{$ibforums->skin[P_AOL]}</a>&nbsp;";
} else {
$member['AOLNAME'] = '&nbsp;';
}
$member['password'] = "";
$member['MEMBER_NAME'] = $member['name'];
$member['MEMBER_POSTS'] = $member['posts'];
$member['MEMBER_ID'] = $member['id'];
$this->output .= $this->html->show_row($member);
}
$this->output .= $this->html->Page_end();
$this->output .= $this->html->end( array( 'SHOW_PAGES' => $links) );
$print->add_output("$this->output");
$print->do_output( array( 'TITLE' => $ibforums->lang['page_title'], 'JS' => 0, NAV => array( $ibforums->lang['page_title'] ) ) );
}
}
?>
<?php
/*
+--------------------------------------------------------------------------
| Invision Board v1.1
| ========================================
| by Matthew Mecham
| (c) 2001,2002 Invision Power Services
| http://www.ibforums.com
| ========================================
| Web: http://www.ibforums.com
| Email: phpboards@ibforums.com
| Licence Info: phpib-licence@ibforums.com
+---------------------------------------------------------------------------
|
| > Show all the members
| > Module written by Matt Mecham
| > Date started: 20th February 2002
|
| > Module Version Number: 1.0.0
+--------------------------------------------------------------------------
*/
$idx = new Memberlist;
class Memberlist {
var $output = "";
var $page_title = "";
var $nav = array();
var $html = "";
var $base_url = "";
var $first = 0;
var $max_results = 10;
var $sort_key = 'name';
var $sort_order = 'asc';
var $filter = 'ALL';
var $mem_titles = array();
var $mem_groups = array();
function Memberlist() {
global $ibforums, $DB, $std, $print;
if ($ibforums->input['CODE'] == "") $ibforums->input['CODE'] = 'listall';
//--------------------------------------------
// Require the HTML and language modules
//--------------------------------------------
$ibforums->lang = $std->load_words($ibforums->lang, 'lang_mlist', $ibforums->lang_id );
$this->html = $std->load_template('skin_mlist');
$this->base_url = "{$ibforums->vars['board_url']}/index.{$ibforums->vars['php_ext']}?s={$ibforums->session_id}";
if ($ibforums->member['g_mem_info'] != 1)
{
$std->Error( array( 'LEVEL' => 1, 'MSG' => 'no_permission' ) );
}
$see_groups = array();
//--------------------------------------------
// Get the member groups, member titles stuff
//--------------------------------------------
$DB->query("SELECT g_title, g_id, g_icon from ibf_groups WHERE g_hide_from_list <> 1 ORDER BY g_title");
while ($row = $DB->fetch_row() )
{
$see_groups[] = $row['g_id'];
$this->mem_groups[ $row['g_id'] ] = array( 'TITLE' => $row['g_title'],
'ICON' => $row['g_icon'],
);
}
unset($row);
$group_string = implode( ",", $see_groups );
$DB->free_result();
$DB->query("SELECT title, id, posts, pips from ibf_titles ORDER BY posts DESC");
while ($row = $DB->fetch_row() )
{
$this->mem_titles[ $row['id'] ] = array( 'TITLE' => $row['title'],
'POSTS' => $row['posts'],
'PIPS' => $row['pips'],
);
}
unset($row);
$DB->free_result();
$the_filter = array( 'ALL' => $ibforums->lang['show_all'] );
foreach($this->mem_groups as $id => $data)
{
if ($id == $ibforums->vars['guest_group'])
{
continue;
}
$the_filter[$id] = $data['TITLE'];
}
//------------------------------------------
// Test for input
//------------------------------------------
if (isset($ibforums->input['st'])) $this->first = $ibforums->input['st'];
if (isset($ibforums->input['max_results'])) $this->max_results = $ibforums->input['max_results'];
if (isset($ibforums->input['sort_key'])) $this->sort_key = $ibforums->input['sort_key'];
if (isset($ibforums->input['sort_order'])) $this->sort_order = $ibforums->input['sort_order'];
if (isset($ibforums->input['filter'])) $this->filter = $ibforums->input['filter'];
//------------------------------------------
// Fix up the search box
//------------------------------------------
$ibforums->input['name'] = trim(urldecode(stripslashes($ibforums->input['name'])));
if ($ibforums->input['name'] == "")
{
$ibforums->input['name_box'] = 'all';
}
//------------------------------------------
// Init some arrays
//------------------------------------------
$the_sort_key = array( 'name' => 'sort_by_name',
'posts' => 'sort_by_posts',
'joined' => 'sort_by_joined',
);
$the_max_results = array( 10 => '10',
20 => '20',
30 => '30',
40 => '40',
50 => '50',
);
$the_sort_order = array( 'desc' => 'descending_order',
'asc' => 'ascending_order',
);
//------------------------------------------
// Start the form stuff
//------------------------------------------
$filter_html = "<select name='filter' class='forminput'>\n";
$sort_key_html = "<select name='sort_key' class='forminput'>\n";
$max_results_html = "<select name='max_results' class='forminput'>\n";
$sort_order_html = "<select name='sort_order' class='forminput'>\n";
foreach ($the_sort_order as $k => $v) {
$sort_order_html .= $k == $this->sort_order ? "<option value='$k' selected>" . $ibforums->lang[ $the_sort_order[ $k ] ] . "\n"
: "<option value='$k'>" . $ibforums->lang[ $the_sort_order[ $k ] ] . "\n";
}
foreach ($the_filter as $k => $v) {
$filter_html .= $k == $this->filter ? "<option value='$k' selected>" . $the_filter[ $k ] . "\n"
: "<option value='$k'>" . $the_filter[ $k ] . "\n";
}
foreach ($the_sort_key as $k => $v) {
$sort_key_html .= $k == $this->sort_key ? "<option value='$k' selected>" . $ibforums->lang[ $the_sort_key[ $k ] ] . "\n"
: "<option value='$k'>" . $ibforums->lang[ $the_sort_key[ $k ] ] . "\n";
}
foreach ($the_max_results as $k => $v) {
$max_results_html .= $k == $this->max_results ? "<option value='$k' selected>". $the_max_results[ $k ] . "\n"
: "<option value='$k'>" . $the_max_results[ $k ] . "\n";
}
$ibforums->lang['sorting_text'] = preg_replace( "/<#FILTER#>/" , $filter_html."</select>" , $ibforums->lang['sorting_text'] );
$ibforums->lang['sorting_text'] = preg_replace( "/<#SORT_KEY#>/" , $sort_key_html."</select>" , $ibforums->lang['sorting_text'] );
$ibforums->lang['sorting_text'] = preg_replace( "/<#SORT_ORDER#>/" , $sort_order_html."</select>" , $ibforums->lang['sorting_text'] );
$ibforums->lang['sorting_text'] = preg_replace( "/<#MAX_RESULTS#>/" , $max_results_html."</select>", $ibforums->lang['sorting_text'] );
$error = 0;
if (! isset($the_sort_key[ $this->sort_key ]) ) $error = 1;
if (! isset($the_sort_order[ $this->sort_order ]) ) $error = 1;
if (! isset($the_filter[ $this->filter ]) ) $error = 1;
if (! isset($the_max_results[ $this->max_results ]) ) $error = 1;
if ($error == 1 )
{
$std->Error( array( LEVEL=> 5, MSG =>'incorrect_use') );
}
//---------------------------------------------
// Find out how many members match our criteria
//---------------------------------------------
$q_extra = "";
if ($this->filter != 'ALL')
{
// Are we allowed to see this group?
if ( ! preg_match( "/(^|,)".$this->filter."(,|$)/", $group_string ) )
{
$q_extra = " AND mgroup IN($group_string)";
}
else
{
$q_extra = " AND mgroup='".$this->filter."' ";
}
}
if ($ibforums->input['name_box'] != 'all')
{
if ( $ibforums->input['name_box'] == 'begins' )
{
$q_extra .= " AND name LIKE '".$ibforums->input['name']."%'";
}
else
{
$q_extra .= " AND name LIKE '%".$ibforums->input['name']."%'";
}
}
$DB->query("SELECT COUNT(id) as total_members FROM ibf_members WHERE id > 0".$q_extra);
$max = $DB->fetch_row();
$DB->free_result();
$links = $std->build_pagelinks( array( 'TOTAL_POSS' => $max['total_members'],
'PER_PAGE' => $this->max_results,
'CUR_ST_VAL' => $this->first,
'L_SINGLE' => "",
'L_MULTI' => $ibforums->lang['pages'],
'BASE_URL' => $this->base_url."&act=Members&name=".urlencode($ibforums->input['name'])."&name_box={$ibforums->input['name_box']}&max_results={$this->max_results}&filter={$this->filter}&sort_order={$this->sort_order}&sort_key={$this->sort_key}"
)
);
$this->output = $this->html->start();
$this->output .= $this->html->Page_header( array( 'SHOW_PAGES' => $links) );
//-----------------------------
// START THE LISTING
//-----------------------------
$DB->query("SELECT name, id, posts, joined, mgroup, email,title, hide_email, location, aim_name, icq_number "
."FROM ibf_members WHERE id > 0".$q_extra." ORDER BY ".$this->sort_key." ".$this->sort_order." LIMIT ".$this->first.",".$this->max_results);
while($member = $DB->fetch_row() )
{
$pips = 0;
foreach($this->mem_titles as $k => $v)
{
if ($member['posts'] >= $v['POSTS']) {
if (!$member['title'])
{
$member['title'] = $this->mem_titles[ $k ]['TITLE'];
}
$pips = $v['PIPS'];
break;
}
}
if ($this->mem_groups[ $member['mgroup'] ]['ICON'])
{
$member[MEMBER_PIPS_IMG] = "<img src='{$ibforums->vars[TEAM_ICON_URL]}/{$this->mem_groups[ $member['mgroup'] ][ICON]}' border='0'>";
}
else
{
if ($pips)
{
if (preg_match( "/^\d+$/", $pips ) )
{
for ($i = 1; $i <= $pips; ++$i)
{
$member['MEMBER_PIPS_IMG'] .= "<{A_STAR}>";
}
}
else
{
$member['MEMBER_PIPS_IMG'] = "<img src='{$ibforums->vars[TEAM_ICON_URL]}/$pips' border='0'>";
}
}
}
$member['MEMBER_JOINED'] = $std->get_date( $member['joined'], 'JOINED' );
$member['MEMBER_GROUP'] = $this->mem_groups[ $member['mgroup'] ]['TITLE'];
if (!$member['hide_email']) {
$member['MEMBER_EMAIL'] = "<a href='{$this->base_url}&act=Mail&CODE=00&MID={$member['id']}'><{P_EMAIL}></a>&nbsp;";
} else {
$member['MEMBER_EMAIL'] = '&nbsp;';
}
if ($member['icq_number']) {
$member['ICQNUMBER'] = "<a href=\"javascript:PopUp('{$this->base_url}&act=ICQ&MID={$member['id']}','Pager','450','330','0','1','1','1')\"><{P_ICQ}></a>&nbsp;";
} else {
$member['ICQNUMBER'] = '&nbsp;';
}
if ($member['aim_name']) {
$member[AOLNAME] = "<a href=\"javascript:PopUp('{$this->base_url}&act=AOL&MID={$member['id']}','Pager','450','330','0','1','1','1')\"><{P_AOL}></a>&nbsp;";
} else {
$member['AOLNAME'] = '&nbsp;';
}
$member['password'] = "";
$member['MEMBER_NAME'] = $member['name'];
$member['MEMBER_POSTS'] = $member['posts'];
$member['MEMBER_ID'] = $member['id'];
$this->output .= $this->html->show_row($member);
}
$this->output .= $this->html->Page_end();
$this->output .= $this->html->end( array( 'SHOW_PAGES' => $links) );
$print->add_output("$this->output");
$print->do_output( array( 'TITLE' => $ibforums->lang['page_title'], 'JS' => 0, NAV => array( $ibforums->lang['page_title'] ) ) );
}
}
?>
+2146 -1546
View File
File diff suppressed because it is too large. Load diff
+2093 -1332
View File
File diff suppressed because it is too large. Load diff
+71 -17
View File
@@ -2,10 +2,10 @@
/*
+--------------------------------------------------------------------------
| IBFORUMS v1
| Invision Board v1.1
| ========================================
| by Matthew Mecham and David Baxter
| (c) 2001,2002 IBForums
| by Matthew Mecham
| (c) 2001,2002 Invision Power Services
| http://www.ibforums.com
| ========================================
| Web: http://www.ibforums.com
@@ -54,9 +54,7 @@ class Online {
$ibforums->lang = $std->load_words($ibforums->lang, 'lang_online', $ibforums->lang_id);
require "./Skin/".$ibforums->skin_id."/skin_online.php";
$this->html = new skin_online();
$this->html = $std->load_template('skin_online');
$this->base_url = "{$ibforums->vars['board_url']}/index.{$ibforums->vars['php_ext']}?s={$ibforums->session_id}";
@@ -138,7 +136,9 @@ class Online {
$DB->free_result();
$t_time = time() - 900;
$cut_off = ($ibforums->vars['au_cutoff'] != "") ? $ibforums->vars['au_cutoff'] * 60 : 900;
$t_time = time() - $cut_off;
$DB->query("SELECT COUNT(id) as total_sessions FROM ibf_sessions WHERE login_type <> 1 AND running_time > $t_time");
$max = $DB->fetch_row();
@@ -158,9 +158,38 @@ class Online {
// Grab all the current sessions.
$DB->query("SELECT s.id, s.member_name, s.member_id, s.running_time, s.location, s.member_group, g.prefix, g.suffix FROM ibf_sessions s, ibf_groups g WHERE login_type <> 1 AND running_time > $t_time AND s.member_group=g.g_id ORDER BY running_time DESC LIMIT ".$this->first.",25");
$final = array();
$tid_array = array();
while( $sess = $DB->fetch_row() ) {
$topics = array();
$DB->query("SELECT s.id, s.in_forum, s.in_topic, s.member_name, s.member_id, s.ip_address, s.running_time, s.location, s.login_type, s.member_group, g.prefix, g.suffix FROM ibf_sessions s, ibf_groups g WHERE s.running_time > $t_time AND s.member_group=g.g_id ORDER BY running_time DESC LIMIT ".$this->first.",25");
while( $r = $DB->fetch_row() )
{
$final[] = $r;
if ($r['in_topic'] != "")
{
$tid_array[] = $r['in_topic'];
}
}
if ( count($tid_array) > 0 )
{
$tid_string = implode( ",", $tid_array );
$DB->query("SELECT tid, title FROM ibf_topics WHERE tid IN ($tid_string)");
while ( $t = $DB->fetch_row() )
{
$topics[ $t['tid'] ] = $t['title'];
}
}
foreach( $final as $idx => $sess )
{
//----------------------------------------------------
// Is this a member, and have we seen them before?
@@ -169,6 +198,20 @@ class Online {
// their IP address changes.
//----------------------------------------------------
$inv = '';
if ($sess['login_type'] == 1)
{
if ( ($ibforums->member['mgroup'] == $ibforums->vars['admin_group']) and ($ibforums->vars['disable_admin_anon'] != 1) )
{
$inv = '*';
}
else
{
continue;
}
}
if (! empty($sess['member_name']) )
{
if (isset($this->seen_name[ $sess['member_name'] ]) )
@@ -186,7 +229,9 @@ class Online {
$line = "";
list($act, $fid, $tid, $pid) = explode( ",", $sess['location'] );
list($act, $pid) = explode( ",", $sess['location'] );
$fid = $sess['in_forum'];
$tid = $sess['in_topic'];
if (isset($act))
{
@@ -195,7 +240,7 @@ class Online {
}
if ($fid != "")
if ($fid != "" and ($act == 'SF' or $act == 'ST' or $act == 'Post'))
{
$pass = 0;
@@ -210,9 +255,9 @@ class Online {
if ($pass == 1)
{
if ($tid != "")
if ($tid > 0)
{
$line .= " <a href='{$this->base_url}&act=ST&f=$fid&t=$tid'>{$this->forums[ $fid ]['name']}</a>";
$line .= " <a href='{$this->base_url}&act=ST&f=$fid&t=$tid'>{$topics[$tid]}</a>";
}
else
{
@@ -221,7 +266,7 @@ class Online {
}
else
{
$line .= " ".$ibforums->lang['n_a'];
$line = " <a href='{$this->base_url}'>{$ibforums->lang['board_index']}</a>";
}
}
@@ -234,9 +279,18 @@ class Online {
$sess['where_line'] = $line;
if ( ($ibforums->member['mgroup'] == $ibforums->vars['admin_group']) and ($ibforums->vars['disable_online_ip'] != 1) )
{
$sess['ip_address'] = " ( ".$sess['ip_address']." )";
}
else
{
$sess['ip_address'] = "";
}
if (isset($sess['member_id']))
{
$sess['member_name'] = "<a href='{$this->base_url}&act=Profile&CODE=03&MID={$sess['member_id']}'>{$sess['prefix']}{$sess['member_name']}{$sess['suffix']}</a>";
$sess['member_name'] = "<a href='{$this->base_url}&act=Profile&CODE=03&MID={$sess['member_id']}'>{$sess['prefix']}{$sess['member_name']}{$sess['suffix']}</a>$inv {$sess['ip_address']}";
}
$sess['running_time'] = $std->get_date( $sess['running_time'], 'LONG' );
@@ -257,11 +311,11 @@ class Online {
if ($sess['member_name'] and $sess['member_id'])
{
$sess['msg_icon'] = "<a href='{$this->base_url}&act=Msg&CODE=04&MID={$sess['member_id']}'>{$ibforums->skin['P_MSG']}</a>";
$sess['msg_icon'] = "<a href='{$this->base_url}&act=Msg&CODE=04&MID={$sess['member_id']}'><{P_MSG}></a>";
}
else
{
$sess['member_name'] = $sess['prefix'].$ibforums->lang['guest'].$sess['suffix'];
$sess['member_name'] = $sess['prefix'].$ibforums->lang['guest'].$sess['suffix']." ".$sess['ip_address'];
$sess['msg_icon'] = '&nbsp;';
}
+1031 -929
View File
File diff suppressed because it is too large. Load diff
+345 -300
View File
@@ -1,301 +1,346 @@
<?php
/*
+--------------------------------------------------------------------------
| IBFORUMS v1
| ========================================
| by Matthew Mecham and David Baxter
| (c) 2001,2002 IBForums
| http://www.ibforums.com
| ========================================
| Web: http://www.ibforums.com
| Email: phpboards@ibforums.com
| Licence Info: phpib-licence@ibforums.com
+---------------------------------------------------------------------------
|
| > User Profile functions
| > Module written by Matt Mecham
| > Date started: 28th February 2002
|
| > Module Version Number: 1.0.0
+--------------------------------------------------------------------------
*/
$idx = new Profile;
class Profile {
var $output = "";
var $page_title = "";
var $nav = array();
var $html = "";
var $parser;
var $member = array();
var $m_group = array();
var $jump_html = "";
var $parser = "";
var $links = array();
var $bio = "";
var $notes = "";
var $size = "m";
var $lib;
function Profile() {
global $ibforums, $DB, $std, $print;
require "./sources/lib/post_parser.php";
$this->parser = new post_parser();
//--------------------------------------------
// Make sure our code number is numerical only
//--------------------------------------------
//$ibforums->input['CODE'] = preg_replace("/^([0-9]+)$/", "$1", $ibforums->input['CODE']);
if ($ibforums->input['CODE'] == "") $ibforums->input['CODE'] = 00;
//--------------------------------------------
// Require the HTML and language modules
//--------------------------------------------
$ibforums->lang = $std->load_words($ibforums->lang, 'lang_profile' , $ibforums->lang_id );
require "./Skin/".$ibforums->skin_id."/skin_profile.php";
$this->html = new skin_profile;
$this->base_url = "{$ibforums->vars['board_url']}/index.{$ibforums->vars['php_ext']}?s={$ibforums->session_id}";
$this->base_url_nosess = "{$ibforums->vars['board_url']}/index.{$ibforums->vars['php_ext']}";
//--------------------------------------------
// Check viewing permissions, etc
//--------------------------------------------
$this->member = $ibforums->member;
$this->m_group = $ibforums->member;
//--------------------------------------------
// What to do?
//--------------------------------------------
switch($ibforums->input['CODE']) {
case '03':
$this->view_profile();
break;
//------------------------------
default:
$this->view_profile();
break;
}
// If we have any HTML to print, do so...
$print->add_output("$this->output");
$print->do_output( array( 'TITLE' => $this->page_title, 'JS' => 1, NAV => $this->nav ) );
}
function view_profile() {
global $ibforums, $DB, $std, $print;
$info = array();
if ($ibforums->member['g_mem_info'] != 1)
{
$std->Error( array( 'LEVEL' => 1, 'MSG' => 'no_permission' ) );
}
//--------------------------------------------
// Check input..
//--------------------------------------------
$id = preg_replace( "/^(\d+)$/", "\\1", $ibforums->input['MID'] );
if ( empty($id) )
{
$std->Error( array( 'LEVEL' => 1, 'MSG' => 'incorrect_use' ) );
}
//--------------------------------------------
// Prepare Query...
//--------------------------------------------
$DB->query("SELECT m.*, g.g_id, g.g_title as group_title FROM ibf_members m, ibf_groups g WHERE m.id='$id' and m.mgroup=g.g_id");
$member = $DB->fetch_row();
if (empty($member['id']))
{
$std->Error( array( 'LEVEL' => 1, 'MSG' => 'incorrect_use' ) );
}
// Play it safe
$member['password'] = "";
//--------------------------------------------
// Find the most posted in forum that the viewing
// member has access to by this members profile
//--------------------------------------------
$DB->query("SELECT id, read_perms FROM ibf_forums");
$forum_ids = array('0');
while ( $r = $DB->fetch_row() )
{
if ($r['read_perms'] == '*')
{
$forum_ids[] = $r['id'];
}
else if ( preg_match( "/(^|,)".$this->member['mgroup']."(,|$)/", $r['read_perms']) )
{
$forum_ids[] = $r['id'];
}
}
$forum_id_str = implode( ",", $forum_ids );
$percent = 0;
$DB->query("SELECT DISTINCT(p.forum_id), f.name, COUNT(p.author_id) as f_posts FROM ibf_posts p, ibf_forums f ".
"WHERE p.forum_id IN ($forum_id_str) AND p.author_id='".$member['id']."' AND p.forum_id=f.id GROUP BY p.forum_id ORDER BY f_posts DESC");
$favourite = $DB->fetch_row();
$DB->query("SELECT COUNT(pid) as total_posts FROM ibf_posts WHERE author_id='".$member['id']."'");
$total_posts = $DB->fetch_row();
$DB->query("SELECT TOTAL_TOPICS, TOTAL_REPLIES FROM ibf_stats");
$stats = $DB->fetch_row();
$board_posts = $stats['TOTAL_TOPICS'] + $stats['TOTAL_REPLIES'];
if ($total_posts['total_posts'] > 0)
{
$percent = round( $favourite['f_posts'] / $total_posts['total_posts'] * 100 );
}
if ($member['posts'])
{
$info['posts_day'] = round( $member['posts'] / (((time() - $member['joined']) / 86400)), 1);
$info['total_pct'] = sprintf( '%.2f', ( $member['posts'] / $board_posts * 100 ) );
}
if ($info['posts_day'] > $member['posts'])
{
$info['posts_day'] = $member['posts'];
}
$info['posts'] = $member['posts'] ? $member['posts'] : 0;
$info['name'] = $member['name'];
$info['mid'] = $member['id'];
$info['fav_forum'] = $favourite['name'];
$info['fav_id'] = $favourite['forum_id'];
$info['fav_posts'] = $favourite['f_posts'];
$info['percent'] = $percent;
$info['group_title'] = $member['group_title'];
$info['board_posts'] = $board_posts;
$info['joined'] = $std->get_date( $member['joined'], 'LONG' );
$info['member_title'] = $member['title'] ? $member['title'] : $ibforums->lang['no_info'];
$info['aim_name'] = $member['aim_name'] ? $member['aim_name'] : $ibforums->lang['no_info'];
$info['icq_number'] = $member['icq_number'] ? $member['icq_number'] : $ibforums->lang['no_info'];
$info['yahoo'] = $member['yahoo'] ? $member['yahoo'] : $ibforums->lang['no_info'];
$info['location'] = $member['location'] ? $member['location'] : $ibforums->lang['no_info'];
$info['interests'] = $member['interests'] ? $member['interests'] : $ibforums->lang['no_info'];
$info['msn_name'] = $member['msnname'] ? $member['msnname'] : $ibforums->lang['no_info'];
$ibforums->vars['time_adjust'] = $ibforums->vars['time_adjust'] == "" ? 0 : $ibforums->vars['time_adjust'];
if ($member['dst_in_use'] == 1)
{
$member['time_offset'] += 1;
}
$info['local_time'] = $member['time_offset'] != "" ? gmdate( "h:i A", time() + ($member['time_offset']*3600) + ($ibforums->vars['time_adjust'] * 60) ) : $ibforums->lang['no_info'];
$info['avatar'] = $std->get_avatar( $member['avatar'] , 1, $member['avatar_size'] );
$info['signature'] = $member['signature'];
if ( $member['website'] and preg_match( "/^http:\/\/\S+$/", $member['website'] ) ) {
$info['homepage'] = "<a href='{$member['website']}' target='_blank'>{$member['website']}</a>";
}
else
{
$info['homepage'] = $ibforums->lang['no_info'];
}
if ($member['bday_month'])
{
$info['birthday'] = $member['bday_day']." ".$ibforums->lang[ 'M_'.$member['bday_month'] ]." ".$member['bday_year'];
}
else
{
$info['birthday'] = $ibforums->lang['no_info'];
}
if (!$member['hide_email']) {
$info['email'] = "<a href='{$this->base_url}&act=Mail&CODE=00&MID={$member['id']}'>{$ibforums->lang['click_here']}</a>";
}
else
{
$info['email'] = $ibforums->lang['private'];
}
$info['base_url'] = $this->base_url;
$this->output .= $this->html->show_profile( $info );
// Is this our profile?
if ($member['id'] == $this->member['id'])
{
$this->output = preg_replace( "/<!--MEM OPTIONS-->/e", "\$this->html->user_edit(\$info)", $this->output );
}
// Can mods edit this profile?
if ($ibforums->member['id'])
{
if ($ibforums->member['g_is_supmod'] == 1)
{
$pass = 1;
}
else
{
$DB->query("SELECT * FROM ibf_moderators WHERE edit_user=1 AND member_id='".$ibforums->member['id']."'");
if ( $this->moderator = $DB->fetch_row() )
{
$pass = 1;
}
}
}
$this->page_title = $ibforums->lang['page_title'];
$this->nav = array( $ibforums->lang['page_title'] );
}
}
<?php
/*
+--------------------------------------------------------------------------
| Invision Board v1.1
| ========================================
| by Matthew Mecham
| (c) 2001,2002 Invision Power Services
| http://www.ibforums.com
| ========================================
| Web: http://www.ibforums.com
| Email: phpboards@ibforums.com
| Licence Info: phpib-licence@ibforums.com
+---------------------------------------------------------------------------
|
| > User Profile functions
| > Module written by Matt Mecham
| > Date started: 28th February 2002
|
| > Module Version Number: 1.0.0
+--------------------------------------------------------------------------
*/
$idx = new Profile;
class Profile {
var $output = "";
var $page_title = "";
var $nav = array();
var $html = "";
var $parser;
var $member = array();
var $m_group = array();
var $jump_html = "";
var $parser = "";
var $links = array();
var $bio = "";
var $notes = "";
var $size = "m";
var $lib;
function Profile() {
global $ibforums, $DB, $std, $print;
require "./sources/lib/post_parser.php";
$this->parser = new post_parser();
//--------------------------------------------
// Make sure our code number is numerical only
//--------------------------------------------
//$ibforums->input['CODE'] = preg_replace("/^([0-9]+)$/", "$1", $ibforums->input['CODE']);
if ($ibforums->input['CODE'] == "") $ibforums->input['CODE'] = 00;
//--------------------------------------------
// Require the HTML and language modules
//--------------------------------------------
$ibforums->lang = $std->load_words($ibforums->lang, 'lang_profile' , $ibforums->lang_id );
$this->html = $std->load_template('skin_profile');
$this->base_url = "{$ibforums->vars['board_url']}/index.{$ibforums->vars['php_ext']}?s={$ibforums->session_id}";
$this->base_url_nosess = "{$ibforums->vars['board_url']}/index.{$ibforums->vars['php_ext']}";
//--------------------------------------------
// Check viewing permissions, etc
//--------------------------------------------
$this->member = $ibforums->member;
$this->m_group = $ibforums->member;
//--------------------------------------------
// What to do?
//--------------------------------------------
switch($ibforums->input['CODE']) {
case '03':
$this->view_profile();
break;
//------------------------------
default:
$this->view_profile();
break;
}
// If we have any HTML to print, do so...
$print->add_output("$this->output");
$print->do_output( array( 'TITLE' => $this->page_title, 'JS' => 1, NAV => $this->nav ) );
}
function view_profile() {
global $ibforums, $DB, $std, $print;
$info = array();
if ($ibforums->member['g_mem_info'] != 1)
{
$std->Error( array( 'LEVEL' => 1, 'MSG' => 'no_permission' ) );
}
//--------------------------------------------
// Check input..
//--------------------------------------------
$id = preg_replace( "/^(\d+)$/", "\\1", $ibforums->input['MID'] );
if ( empty($id) )
{
$std->Error( array( 'LEVEL' => 1, 'MSG' => 'incorrect_use' ) );
}
//--------------------------------------------
// Prepare Query...
//--------------------------------------------
$DB->query("SELECT m.*, g.g_id, g.g_title as group_title FROM ibf_members m, ibf_groups g WHERE m.id='$id' and m.mgroup=g.g_id");
$member = $DB->fetch_row();
if (empty($member['id']))
{
$std->Error( array( 'LEVEL' => 1, 'MSG' => 'incorrect_use' ) );
}
// Play it safe
$member['password'] = "";
//--------------------------------------------
// Find the most posted in forum that the viewing
// member has access to by this members profile
//--------------------------------------------
$DB->query("SELECT id, read_perms FROM ibf_forums");
$forum_ids = array('0');
while ( $r = $DB->fetch_row() )
{
if ($r['read_perms'] == '*')
{
$forum_ids[] = $r['id'];
}
else if ( preg_match( "/(^|,)".$this->member['mgroup']."(,|$)/", $r['read_perms']) )
{
$forum_ids[] = $r['id'];
}
}
$forum_id_str = implode( ",", $forum_ids );
$percent = 0;
$DB->query("SELECT DISTINCT(p.forum_id), f.name, COUNT(p.author_id) as f_posts FROM ibf_posts p, ibf_forums f ".
"WHERE p.forum_id IN ($forum_id_str) AND p.author_id='".$member['id']."' AND p.forum_id=f.id GROUP BY p.forum_id ORDER BY f_posts DESC");
$favourite = $DB->fetch_row();
$DB->query("SELECT COUNT(pid) as total_posts FROM ibf_posts WHERE author_id='".$member['id']."'");
$total_posts = $DB->fetch_row();
$DB->query("SELECT TOTAL_TOPICS, TOTAL_REPLIES FROM ibf_stats");
$stats = $DB->fetch_row();
$board_posts = $stats['TOTAL_TOPICS'] + $stats['TOTAL_REPLIES'];
if ($total_posts['total_posts'] > 0)
{
$percent = round( $favourite['f_posts'] / $total_posts['total_posts'] * 100 );
}
if ($member['posts'])
{
$info['posts_day'] = round( $member['posts'] / (((time() - $member['joined']) / 86400)), 1);
$info['total_pct'] = sprintf( '%.2f', ( $member['posts'] / $board_posts * 100 ) );
}
if ($info['posts_day'] > $member['posts'])
{
$info['posts_day'] = $member['posts'];
}
$info['posts'] = $member['posts'] ? $member['posts'] : 0;
$info['name'] = $member['name'];
$info['mid'] = $member['id'];
$info['fav_forum'] = $favourite['name'];
$info['fav_id'] = $favourite['forum_id'];
$info['fav_posts'] = $favourite['f_posts'];
$info['percent'] = $percent;
$info['group_title'] = $member['group_title'];
$info['board_posts'] = $board_posts;
$info['joined'] = $std->get_date( $member['joined'], 'LONG' );
$info['member_title'] = $member['title'] ? $member['title'] : $ibforums->lang['no_info'];
$info['aim_name'] = $member['aim_name'] ? $member['aim_name'] : $ibforums->lang['no_info'];
$info['icq_number'] = $member['icq_number'] ? $member['icq_number'] : $ibforums->lang['no_info'];
$info['yahoo'] = $member['yahoo'] ? $member['yahoo'] : $ibforums->lang['no_info'];
$info['location'] = $member['location'] ? $member['location'] : $ibforums->lang['no_info'];
$info['interests'] = $member['interests'] ? $member['interests'] : $ibforums->lang['no_info'];
$info['msn_name'] = $member['msnname'] ? $member['msnname'] : $ibforums->lang['no_info'];
$ibforums->vars['time_adjust'] = $ibforums->vars['time_adjust'] == "" ? 0 : $ibforums->vars['time_adjust'];
if ($member['dst_in_use'] == 1)
{
$member['time_offset'] += 1;
}
$info['local_time'] = $member['time_offset'] != "" ? gmdate( "h:i A", time() + ($member['time_offset']*3600) + ($ibforums->vars['time_adjust'] * 60) ) : $ibforums->lang['no_info'];
$info['avatar'] = $std->get_avatar( $member['avatar'] , 1, $member['avatar_size'] );
$info['signature'] = $member['signature'];
if ( $member['website'] and preg_match( "/^http:\/\/\S+$/", $member['website'] ) ) {
$info['homepage'] = "<a href='{$member['website']}' target='_blank'>{$member['website']}</a>";
}
else
{
$info['homepage'] = $ibforums->lang['no_info'];
}
if ($member['bday_month'])
{
$info['birthday'] = $member['bday_day']." ".$ibforums->lang[ 'M_'.$member['bday_month'] ]." ".$member['bday_year'];
}
else
{
$info['birthday'] = $ibforums->lang['no_info'];
}
if (!$member['hide_email']) {
$info['email'] = "<a href='{$this->base_url}&act=Mail&CODE=00&MID={$member['id']}'>{$ibforums->lang['click_here']}</a>";
}
else
{
$info['email'] = $ibforums->lang['private'];
}
$info['base_url'] = $this->base_url;
$this->output .= $this->html->show_profile( $info );
// Is this our profile?
if ($member['id'] == $this->member['id'])
{
$this->output = preg_replace( "/<!--MEM OPTIONS-->/e", "\$this->html->user_edit(\$info)", $this->output );
}
// Can mods see the hidden parts of this profile?
$query_extra = 'WHERE fedit=1 AND fhide <> 1';
$custom_out = "";
$field_data = array();
if ($ibforums->member['id'])
{
if ($ibforums->member['g_is_supmod'] == 1)
{
$query_extra = "";
}
else if ($ibforums->member['mgroup'] == $ibforums->vars['admin_group'])
{
$query_extra = "";
}
}
$DB->query("SELECT * from ibf_pfields_content WHERE member_id='".$member['id']."'");
while ( $content = $DB->fetch_row() )
{
foreach($content as $k => $v)
{
if ( preg_match( "/^field_(\d+)$/", $k, $match) )
{
$field_data[ $match[1] ] = $v;
}
}
}
$DB->query("SELECT * from ibf_pfields_data $query_extra ORDER BY forder");
while( $row = $DB->fetch_row() )
{
if ($row['ftype'] == 'drop')
{
$carray = explode( '|', trim($row['fcontent']) );
foreach( $carray as $entry )
{
$value = explode( '=', $entry );
$ov = trim($value[0]);
$td = trim($value[1]);
if ($field_data[ $row['fid'] ] == $ov)
{
$field_data[ $row['fid'] ] = $td;
}
}
}
else
{
$field_data[ $row['fid'] ] = ($field_data[ $row['fid'] ] == "") ? $ibforums->lang['no_info'] : $field_data[ $row['fid'] ];
}
$custom_out .= $this->html->custom_field($row['ftitle'], $field_data[ $row['fid'] ] );
}
if ($custom_out != "")
{
$this->output = str_replace( "<!--{CUSTOM.FIELDS}-->", $custom_out, $this->output );
}
$this->page_title = $ibforums->lang['page_title'];
$this->nav = array( $ibforums->lang['page_title'] );
}
}
?>
+1062 -710
View File
File diff suppressed because it is too large. Load diff
+1614 -1049
View File
File diff suppressed because it is too large. Load diff
+1281 -1111
View File
File diff suppressed because it is too large. Load diff
+352 -45
View File
@@ -2,10 +2,10 @@
/*
+--------------------------------------------------------------------------
| IBFORUMS v1
| Invision Board v1.1
| ========================================
| by Matthew Mecham and David Baxter
| (c) 2001,2002 IBForums
| by Matthew Mecham
| (c) 2001,2002 Invision Power Services
| http://www.ibforums.com
| ========================================
| Web: http://www.ibforums.com
@@ -73,9 +73,7 @@ class UserCP {
require "./sources/lib/usercp_functions.php";
require "./Skin/".$ibforums->skin_id."/skin_ucp.php";
$this->html = new skin_ucp();
$this->html = $std->load_template('skin_ucp');
$this->base_url = "{$ibforums->vars['board_url']}/index.{$ibforums->vars['php_ext']}?s={$ibforums->session_id}";
$this->base_url_nosess = "{$ibforums->vars['board_url']}/index.{$ibforums->vars['php_ext']}";
@@ -93,19 +91,16 @@ class UserCP {
// Get more member info..
$DB->query("SELECT * from ibf_members WHERE id='".$this->member['id']."'");
$DB->query("SELECT m.*, me.links, me.notes, me.ta_size
FROM ibf_members m
LEFT JOIN ibf_member_extra me ON(me.id=m.id)
WHERE m.id='".$this->member['id']."'");
$this->member = $DB->fetch_row();
//-----------------------------------------------
// Format the links if we have any
//-----------------------------------------------
$DB->query("SELECT links, notes, ta_size from ibf_member_extra WHERE id='".$this->member['id']."'");
$row = $DB->fetch_row();
$this->links = $row['links'];
$this->notes = $row['notes'];
$this->size = $row['ta_size'] ? $row['ta_size'] : $this->size;
$this->links = $this->member['links'];
$this->notes = $this->member['notes'];
$this->size = $this->member['ta_size'] ? $this->member['ta_size'] : $this->size;
// We have a single pull down menu for our "Quick Click" stuff
// The JS uses a simple split command to determine if the link
@@ -228,6 +223,13 @@ class UserCP {
$this->do_pass_change();
break;
//------------------------------
case '50':
$this->forum_tracker();
break;
case '51':
$this->remove_forum_tracker();
break;
default:
$this->splash();
break;
@@ -248,6 +250,115 @@ class UserCP {
}
//*******************************************************************/
//| Forum tracker
//|
//| What, you need a definition with that title?
//| What are you doing poking around in the code for anyway?
//*******************************************************************/
function remove_forum_tracker() {
global $ibforums, $std, $DB;
if ($ibforums->input['f'] == 'all')
{
$DB->query("DELETE FROM ibf_forum_tracker WHERE member_id='".$this->member['id']."'");
}
else
{
$id = intval($ibforums->input['f']);
$DB->query("DELETE FROM ibf_forum_tracker WHERE member_id='".$this->member['id']."' AND forum_id='$id'");
}
$std->boink_it($this->base_url."&act=UserCP&CODE=50");
}
function forum_tracker() {
global $ibforums, $DB, $std, $print;
$this->output .= $this->html->forum_subs_header();
//----------------------------------------------------------
// Query the DB for the subby toppy-ics - at the same time
// we get the forum and topic info, 'cos we rule.
//----------------------------------------------------------
$DB->query("SELECT t.frid, t.start_date, f.*, c.id as cat_id, c.name as cat_name
FROM ibf_forum_tracker t
LEFT JOIN ibf_forums f ON (t.forum_id=f.id)
LEFT JOIN ibf_categories c ON (c.id=f.category)
WHERE t.member_id='".$this->member['id']."'
ORDER BY c.position, f.position");
if ( $DB->get_num_rows() )
{
$last_cat_id = -1;
while( $forum = $DB->fetch_row() )
{
if ($last_cat_id != $forum['cat_id'])
{
$last_cat_id = $forum['cat_id'];
$this->output .= $this->html->subs_forum_row($forum['cat_id'], $forum['cat_name']);
}
$forum['last_post'] = $std->get_date($forum['last_post'], 'LONG');
$forum['last_topic'] = $ibforums->lang['f_none'];
$forum['last_title'] = str_replace( "&#33;" , "!", $forum['last_title'] );
$forum['last_title'] = str_replace( "&quot;", "\"", $forum['last_title'] );
if (strlen($forum['last_title']) > 30)
{
$forum['last_title'] = substr($forum['last_title'],0,27) . "...";
$forum['last_title'] = preg_replace( '/&(#(\d+;?)?)?\.\.\.$/', '...', $forum['last_title'] );
}
if ($forum['password'] != "")
{
$forum['last_topic'] = $ibforums->lang['f_none'];
}
else
{
$forum['last_topic'] = "<a href='{$ibforums->base_url}&act=ST&f={$forum['id']}&t={$forum['last_id']}&view=getlastpost'>{$forum['last_title']}</a>";
}
if ( isset($forum['last_poster_name']))
{
$forum['last_poster'] = $forum['last_poster_id'] ? "<a href='{$ibforums->base_url}&act=Profile&CODE=03&MID={$forum['last_poster_id']}'>{$forum['last_poster_name']}</a>"
: $forum['last_poster_name'];
}
else
{
$forum['last_poster'] = $ibforums->lang['f_none'];
}
$forum['folder_icon'] = $std->forum_new_posts($forum);
$this->output .= $this->html->forum_subs_row($forum);
}
}
else
{
$this->output .= $this->html->forum_subs_none();
}
$this->output .= $this->html->forum_subs_end();
$this->page_title = $ibforums->lang['t_welcome'];
$this->nav = array( "<a href='".$this->base_url."&act=UserCP&CODE=00'>".$ibforums->lang['t_title']."</a>" );
}
//*******************************************************************/
//| pass change:
//|
@@ -310,7 +421,7 @@ class UserCP {
$DB->query("UPDATE ibf_members SET password='$md5_pass' WHERE id='".$this->member['id']."'");
$DB->query("UPDATE ibf_sessions SET member_pass='$md5_pass' WHERE id='".$this->session_id."' and member_id='".$this->member['id']."'");
//$DB->query("UPDATE ibf_sessions SET member_pass='$md5_pass' WHERE id='".$this->session_id."' and member_id='".$this->member['id']."'");
//--------------------------------------------
// Update the cookie..
@@ -409,7 +520,7 @@ class UserCP {
if ($ibforums->session_id)
{
$DB->query("UPDATE ibf_sessions SET member_name='', member_id='0', member_pass='', member_group='".$ibforums->vars['guest_group']."' WHERE member_id='".$this->member['id']."' and id='".$ibforums->session_id."'");
$DB->query("UPDATE ibf_sessions SET member_name='', member_id='0', member_group='".$ibforums->vars['guest_group']."' WHERE member_id='".$this->member['id']."' and id='".$ibforums->session_id."'");
}
// Kill the cookies to stop auto log in
@@ -459,6 +570,46 @@ class UserCP {
$this->output .= $this->html->subs_header();
//----------------------------------------------------------
// Are we checking for auto-prune?
//----------------------------------------------------------
$auto_explain = $ibforums->lang['no_auto_prune'];
if ($ibforums->vars['subs_autoprune'] > 0)
{
if ( time() % 2 )
{
// Every now and again..
$time_limit = time() - ($ibforums->vars['subs_autoprune'] * 86400);
$DB->query("SELECT tr.trid FROM ibf_tracker tr, ibf_topics t WHERE t.tid=tr.topic_id AND t.last_post < '$time_limit'");
$trids = array();
while ( $r = $DB->fetch_row() )
{
$trids[] = $r['trid'];
}
if (count($trids) > 0)
{
$DB->query("DELETE FROM ibf_tracker WHERE trid IN (".explode(",",$trids).")");
}
}
$auto_explain = sprintf( $ibforums->lang['auto_prune'], $ibforums->vars['subs_autoprune'] );
}
//----------------------------------------------------------
// Do we have an incoming date cut?
//----------------------------------------------------------
$date_cut = intval($ibforums->input['datecut']) != "" ? intval($ibforums->input['datecut']) : 30;
$date_query = $date_cut != 1000 ? " AND t.last_post > '".(time() - ($date_cut*86400))."' " : "";
//----------------------------------------------------------
// Query the DB for the subby toppy-ics - at the same time
// we get the forum and topic info, 'cos we rule.
@@ -466,15 +617,24 @@ class UserCP {
$DB->query("SELECT s.trid, s.member_id, s.topic_id, s.last_sent, s.start_date as track_started, t.*, f.id as forum_id, f.name as forum_name, f.read_perms "
."FROM ibf_tracker s, ibf_topics t, ibf_forums f "
."WHERE s.member_id='".$this->member['id']."' AND t.tid=s.topic_id AND f.id=t.forum_id "
."ORDER BY t.last_post DESC");
."WHERE s.member_id='".$this->member['id']."' AND t.tid=s.topic_id AND f.id=t.forum_id $date_query"
."ORDER BY f.id, t.last_post DESC");
if ( $DB->get_num_rows() )
{
$last_forum_id = -1;
while( $topic = $DB->fetch_row() )
{
if ($last_forum_id != $topic['forum_id'])
{
$last_forum_id = $topic['forum_id'];
$this->output .= $this->html->subs_forum_row($topic['forum_id'], $topic['forum_name']);
}
$topic['last_poster'] = ($topic['last_poster_id'] != 0)
? "<b><a href='{$this->base_url}&act=Profile&CODE=03&MID={$topic['last_poster_id']}'>{$topic['last_poster_name']}</a></b>"
: "-".$topic['last_poster_name']."-";
@@ -495,7 +655,7 @@ class UserCP {
if ($topic['pinned'])
{
$topic['topic_icon'] = $ibforums->skin['B_PIN'];
$topic['topic_icon'] = "<{B_PIN}>";
}
$topic['start_date'] = $std->get_date( $topic['track_started'], 'LONG' );
@@ -523,7 +683,7 @@ class UserCP {
}
if ($pages > 1) {
$topic['PAGES'] = "<span id='small'>({$ibforums->lang['topic_sp_pages']} ";
$topic['PAGES'] = "<span class='small'>({$ibforums->lang['topic_sp_pages']} ";
for ($i = 0 ; $i < $pages ; ++$i ) {
$real_no = $i * $ibforums->vars['display_max_posts'];
$page_no = $i + 1;
@@ -549,10 +709,23 @@ class UserCP {
}
else
{
// no results
$this->output .= $this->html->subs_none();
}
// Build date box
$date_box = "<option value='1'>".$ibforums->lang['subs_today']."</option>\n";
foreach( array( 1,7,14,21,30,60,90,365 ) as $day )
{
$selected = $day == $date_cut ? ' selected' : '';
$date_box .= "<option value='$day'$selected>".sprintf( $ibforums->lang['subs_day'], $day )."</option>\n";
}
$date_box .= "<option value='1000'>".$ibforums->lang['subs_all']."</option>\n";
$this->output .= $this->html->subs_end();
$this->output .= $this->html->subs_end($auto_explain, $date_box);
$this->page_title = $ibforums->lang['t_welcome'];
$this->nav = array( "<a href='".$this->base_url."&act=UserCP&CODE=00'>".$ibforums->lang['t_title']."</a>" );
@@ -701,6 +874,64 @@ class UserCP {
$dst_check = '';
}
//---------------------
if ($ibforums->vars['postpage_contents'] == "")
{
$ibforums->vars['postpage_contents'] = '5,10,15,20,25,30,35,40';
}
if ($ibforums->vars['topicpage_contents'] == "")
{
$ibforums->vars['topicpage_contents'] = '5,10,15,20,25,30,35,40';
}
list($post_page, $topic_page) = explode( "&", $ibforums->member['view_prefs'] );
if ($post_page == "")
{
$post_page = -1;
}
if ($topic_page == "")
{
$topic_page = -1;
}
$pp_a = array();
$tp_a = array();
$post_select = "";
$topic_select = "";
$pp_a[] = array( '-1', $ibforums->lang['pp_use_default'] );
$tp_a[] = array( '-1', $ibforums->lang['pp_use_default'] );
foreach( explode( ',', $ibforums->vars['postpage_contents'] ) as $n )
{
$n = intval(trim($n));
$pp_a[] = array( $n, $n );
}
foreach( explode( ',', $ibforums->vars['topicpage_contents'] ) as $n )
{
$n = intval(trim($n));
$tp_a[] = array( $n, $n );
}
//---------------------
foreach( $pp_a as $id => $data )
{
$post_select .= ($data[0] == $post_page) ? "<option value='{$data[0]}' selected>{$data[1]}\n" : "<option value='{$data[0]}'>{$data[1]}\n";
}
foreach( $tp_a as $id => $data )
{
$topic_select .= ($data[0] == $topic_page) ? "<option value='{$data[0]}' selected>{$data[1]}\n" : "<option value='{$data[0]}'>{$data[1]}\n";
}
//---------------------
$this->output .= $this->html->settings_header($this->member, $time_select, $time, $dst_check);
$hide_sess = $std->my_getcookie('hide_sess');
@@ -734,6 +965,8 @@ class UserCP {
'AVA' => $view_ava."</select>",
'POP' => $view_pop."</select>",
'SESS' => $html_sess."</select>",
'TPS' => $topic_select,
'PPS' => $post_select
) );
$this->page_title = $ibforums->lang['t_welcome'];
@@ -763,7 +996,7 @@ class UserCP {
$info = array();
foreach ( array(hide_email, allow_admin_mails, email_full, email_pm) as $k )
foreach ( array(hide_email, allow_admin_mails, email_full, email_pm, auto_track) as $k )
{
if (!empty($this->member[ $k ]))
{
@@ -991,6 +1224,80 @@ class UserCP {
$year .= $i == $this->member['bday_year'] ? "selected>$i</option>" : ">$i</option>";
}
//-----------------------------------------------
// Custom profile fields stuff
//-----------------------------------------------
$required_output = "";
$optional_output = "";
$field_data = array();
$DB->query("SELECT * from ibf_pfields_content WHERE member_id='".$ibforums->member['id']."'");
while ( $content = $DB->fetch_row() )
{
foreach($content as $k => $v)
{
if ( preg_match( "/^field_(\d+)$/", $k, $match) )
{
$field_data[ $match[1] ] = $v;
//break;
}
}
}
$DB->query("SELECT * from ibf_pfields_data WHERE fedit=1 ORDER BY forder");
while( $row = $DB->fetch_row() )
{
$form_element = "";
if ( $row['freq'] == 1 )
{
$ftype = 'required_output';
}
else
{
$ftype = 'optional_output';
}
if ( $row['ftype'] == 'drop' )
{
$carray = explode( '|', trim($row['fcontent']) );
$d_content = "";
foreach( $carray as $entry )
{
$value = explode( '=', $entry );
$ov = trim($value[0]);
$td = trim($value[1]);
if ($ov !="" and $td !="")
{
$d_content .= ($field_data[$row['fid']] == $ov) ? "<option value='$ov' selected>$td</option>\n"
: "<option value='$ov'>$td</option>\n";
}
}
if ($d_content != "")
{
$form_element = $this->html->field_dropdown( 'field_'.$row['fid'], $d_content );
}
}
else if ( $row['ftype'] == 'area' )
{
$form_element = $this->html->field_textarea( 'field_'.$row['fid'], $field_data[$row['fid']] );
}
else
{
$form_element = $this->html->field_textinput( 'field_'.$row['fid'], $field_data[$row['fid']] );
}
${$ftype} .= $this->html->field_entry( $row['ftitle'], $row['fdesc'], $form_element );
}
//-----------------------------------------------
// Format the interest / location boxes
//-----------------------------------------------
@@ -998,20 +1305,6 @@ class UserCP {
$this->member['location'] = $this->parser->unconvert( $this->member['location'] );
$this->member['interests'] = $this->parser->unconvert( $this->member['interests'] );
//-----------------------------------------------
// Format the siggie (no, not ciggie - smoking is
// bad boys and girls)
//-----------------------------------------------
if ($ibforums->vars['sig_allow_html'])
{
$this->member['signature'] = $std->text_tidy($this->member['signature']);
}
else
{
$this->member['signature'] = $this->parser->unconvert($this->member['signature']);
}
//-----------------------------------------------
// Suck up the HTML and swop some tags if need be
//-----------------------------------------------
@@ -1028,6 +1321,20 @@ class UserCP {
$this->output = preg_replace( "/<!--\{BIRTHDAY\}-->/", $t_html, $this->output );
//-----------------------------------------------
// Add in the custom fields if we need to.
//-----------------------------------------------
if ($required_output != "")
{
$this->output = str_replace( "<!--{REQUIRED.FIELDS}-->", $this->html->required_title()."\n".$required_output, $this->output );
}
if ($optional_output != "")
{
$this->output = str_replace( "<!--{OPTIONAL.FIELDS}-->", "\n".$optional_output, $this->output );
}
$this->page_title = $ibforums->lang['t_welcome'];
$this->nav = array( "<a href='".$this->base_url."&act=UserCP&CODE=00'>".$ibforums->lang['t_title']."</a>" );
@@ -1087,16 +1394,16 @@ class UserCP {
$info['space_free'] = "Unlimited";
$info['total_messages'] = $total['msg_total'];
if ($ibforums->vars['max_messages'] > 0)
if ($ibforums->member['g_max_messages'] > 0)
{
if ($total['msg_total'] >= $ibforums->vars['max_messages'])
if ($total['msg_total'] >= $ibforums->member['g_max_messages'])
{
$info['full_messenger'] = "<span id='highlight'>".$ibforums->lang['folders_full']."</span>";
$info['full_messenger'] = "<span class='highlight'>".$ibforums->lang['folders_full']."</span>";
}
$info['full_percent'] = $total['msg_total'] ? sprintf( "%.0f", ( ($total['msg_total'] / $ibforums->vars['max_messages']) * 100) ) : 0;
$info['full_percent'] = $total['msg_total'] ? sprintf( "%.0f", ( ($total['msg_total'] / $ibforums->member['g_max_messages']) * 100) ) : 0;
$info['full_percent'] = "(". $info['full_percent'] .'% '. $ibforums->lang['total_capacity'] . ")";
$info['space_free'] = $ibforums->vars['max_messages'] - $total['msg_total'];
$info['space_free'] = $ibforums->member['g_max_messages'] - $total['msg_total'];
}
+159
View File
@@ -0,0 +1,159 @@
<?php
/*
+--------------------------------------------------------------------------
| Invision Board v1.1
| ========================================
| by Matthew Mecham
| (c) 2001,2002 Invision Power Services
| http://www.ibforums.com
| ========================================
| Web: http://www.ibforums.com
| Email: phpboards@ibforums.com
| Licence Info: phpib-licence@ibforums.com
+---------------------------------------------------------------------------
|
| > Browse Buddy Module
| > Module written by Matt Mecham
| > Date started: 2nd July 2002
|
| > Module Version Number: 1.0.0
+--------------------------------------------------------------------------
*/
$idx = new buddy;
class buddy {
var $output = "";
var $page_title = "";
var $nav = array();
var $html = "";
function buddy() {
global $ibforums, $DB, $std, $print;
//--------------------------------------------
// Require the HTML and language modules
//--------------------------------------------
$ibforums->lang = $std->load_words($ibforums->lang, 'lang_buddy', $ibforums->lang_id );
$this->html = $std->load_template('skin_buddy');
//--------------------------------------------
// What to do?
//--------------------------------------------
switch($ibforums->input['code']) {
default:
$this->splash();
break;
}
// If we have any HTML to print, do so...
$this->output = str_replace( "<!--CLOSE.LINK-->", $this->html->closelink(), $this->output );
$print->pop_up_window($ibforums->lang['page_title'], $this->html->buddy_js().$this->output);
}
function splash() {
global $ibforums, $DB, $std;
//--------------------------------------------
// Is this a guest? If so, get 'em to log in.
//--------------------------------------------
if ( ! $ibforums->member['id'] )
{
$this->output = $this->html->login();
return;
}
else
{
//--------------------------------------------
// Get the forums we're allowed to search in
//--------------------------------------------
$allow_forums = array();
$allow_forums[] = '0';
$DB->query("SELECT id, read_perms FROM ibf_forums");
while( $forum = $DB->fetch_row() )
{
if ( $forum['read_perms'] == '*' )
{
$allow_forums[] = $forum['id'];
}
else if ( preg_match( "/(^|,)".$ibforums->member['mgroup']."(,|$)/", $forum['read_perms']) )
{
$allow_forums[] = $forum['id'];
}
}
$forum_string = implode( ",", $allow_forums );
//--------------------------------------------
// Get the number of posts since the last visit.
//--------------------------------------------
if (! $ibforums->member['last_visit'] )
{
$ibforums->member['last_visit'] = time() - 3600;
}
$DB->query("SELECT COUNT(pid) as posts FROM ibf_posts WHERE post_date > '".$ibforums->member['last_visit']."' AND queued <> 1 AND forum_id IN($forum_string)");
$posts = $DB->fetch_row();
$posts_total = ($posts['posts'] < 1) ? 0 : $posts['posts'];
//-----------------------------------------------------------------------
// Get the number of posts since the last visit to topics we've started.
//-----------------------------------------------------------------------
$DB->query("SELECT COUNT(tid) as replies FROM ibf_topics WHERE last_post > '".$ibforums->member['last_visit']."' AND approved=1 AND forum_id IN($forum_string) AND starter_id='".$ibforums->member['id']."'");
$topic = $DB->fetch_row();
$topics_total = ($topic['replies'] < 1) ? ucfirst($ibforums->lang['none']) : $topic['replies'];
$text = $ibforums->lang['no_new_posts'];
if ($posts_total > 0)
{
$ibforums->lang['new_posts'] = sprintf($ibforums->lang['new_posts'] , $posts_total );
$ibforums->lang['my_replies'] = sprintf($ibforums->lang['my_replies'], $topics_total );
$ibforums->lang['new_posts'] .= $this->html->append_view("&act=Search&CODE=getnew");
if ($topic['replies'] > 0)
{
$ibforums->lang['my_replies'] .= $this->html->append_view("&act=Search&CODE=getreplied");
}
$text = $this->html->build_away_msg();
}
$this->output = $this->html->main($text);
}
}
}
?>
File diff suppressed because it is too large. Load diff
+1997 -1768
View File
File diff suppressed because it is too large. Load diff
+173 -173
View File
@@ -1,174 +1,174 @@
<?php
/*
+--------------------------------------------------------------------------
| IBFORUMS v1
| ========================================
| by Matthew Mecham and David Baxter
| (c) 2001,2002 IBForums
| http://www.ibforums.com
| ========================================
| Web: http://www.ibforums.com
| Email: phpboards@ibforums.com
| Licence Info: phpib-licence@ibforums.com
+---------------------------------------------------------------------------
|
| > Add POLL module
| > Module written by Matt Mecham
|
+--------------------------------------------------------------------------
|
| QUOTE OF THE MODULE: (Taken from BtVS)
| --------------------
| Drusilla: I'm naming all the stars...
| Spike: You can't see the stars love, That's the ceiling. Also, it's day.
|
+--------------------------------------------------------------------------
*/
$idx = new Poll;
class Poll {
var $topic = array();
var $poll = array();
var $upload = array();
var $poll_count = 0;
var $poll_choices = "";
function Poll() {
global $ibforums, $std, $DB, $print;
$ibforums->lang = $std->load_words($ibforums->lang, 'lang_post', $ibforums->lang_id);
// Lets do some tests to make sure that we are allowed to start a new topic
if (! $ibforums->member['g_vote_polls'])
{
$std->Error( array( LEVEL => 1, MSG => 'no_reply_polls') );
}
// Did we choose a choice?
if (!$ibforums->input['nullvote'])
{
if (! isset($ibforums->input['poll_vote']) )
{
$std->Error( array( LEVEL => 1, MSG => 'no_vote') );
}
}
// Make sure we have a valid poll id
$ibforums->input[t] = $std->is_number($ibforums->input[t]);
if (! $ibforums->input[t] ) {
$std->Error( array( LEVEL => 1, MSG => 'missing_files') );
}
// Load the topic and poll
$DB->query("SELECT t.*, p.pid as poll_id,p.choices,p.starter_id,p.votes from ibf_polls p, ibf_topics t WHERE t.tid='".$ibforums->input['t']."' and p.tid=t.tid");
$this->topic = $DB->fetch_row();
if (! $this->topic['tid'] )
{
$std->Error( array( LEVEL => 1, MSG => 'poll_none_found') );
}
if ($this->topic['state'] != 'open')
{
$std->Error( array( LEVEL => 1, MSG => 'locked_topic') );
}
// Have we voted before?
$DB->query("SELECT member_id from ibf_voters WHERE tid='".$this->topic['tid']."' and member_id='".$ibforums->member['id']."'");
if ( $DB->get_num_rows() )
{
$std->Error( array( LEVEL => 1, MSG => 'poll_you_voted') );
}
// If we're here, lets add the vote
$db_string = $std->compile_db_string(
array (
'member_id' => $ibforums->member['id'],
'ip_address' => $ibforums->input['IP_ADDRESS'],
'tid' => $this->topic['tid'],
'forum_id' => $this->topic['forum_id'],
'vote_date' => time(),
)
);
$DB->query("INSERT INTO ibf_voters (" .$db_string['FIELD_NAMES']. ") VALUES (". $db_string['FIELD_VALUES'] .")");
// If this isn't a null vote...
if (!$ibforums->input['nullvote'])
{
$poll_answers = unserialize(stripslashes($this->topic['choices']));
reset($poll_answers);
$new_poll_array = array();
foreach ($poll_answers as $entry)
{
$id = $entry[0];
$choice = $entry[1];
$votes = $entry[2];
if ($id == $ibforums->input['poll_vote'])
{
$votes++;
}
$new_poll_array[] = array( $id, $choice, $votes);
}
$this->topic['choices'] = addslashes(serialize($new_poll_array));
$DB->query("UPDATE ibf_polls SET ".
"votes=votes+1, ".
"choices='" . $this->topic['choices'] . "' ".
"WHERE pid='" . $this->topic['poll_id'] . "'");
if ($ibforums->vars['allow_poll_bump'])
{
$this->topic['last_vote'] = time();
$this->topic['last_post'] = time();
$DB->query("UPDATE ibf_topics SET ".
"last_vote='" . $this->topic['last_vote'] . "', ".
"last_post='" . $this->topic['last_post'] . "' ".
"WHERE tid='" . $this->topic['tid'] . "'");
}
else
{
$this->topic['last_vote'] = time();
$DB->query("UPDATE ibf_topics SET ".
"last_vote='" . $this->topic['last_vote'] . "', ".
"last_post='" . $this->topic['last_post'] . "' ".
"WHERE tid='" . $this->topic['tid'] . "'");
}
}
$lang = $ibforums->input['nullvote'] ? $ibforums->lang['poll_viewing_results'] : $ibforums->lang['poll_vote_added'];
$print->redirect_screen( $lang , "act=ST&f={$this->topic['forum_id']}&t={$this->topic['tid']}" );
}
}
<?php
/*
+--------------------------------------------------------------------------
| Invision Board v1.1
| ========================================
| by Matthew Mecham
| (c) 2001,2002 Invision Power Services
| http://www.ibforums.com
| ========================================
| Web: http://www.ibforums.com
| Email: phpboards@ibforums.com
| Licence Info: phpib-licence@ibforums.com
+---------------------------------------------------------------------------
|
| > Add POLL module
| > Module written by Matt Mecham
|
+--------------------------------------------------------------------------
|
| QUOTE OF THE MODULE: (Taken from BtVS)
| --------------------
| Drusilla: I'm naming all the stars...
| Spike: You can't see the stars love, That's the ceiling. Also, it's day.
|
+--------------------------------------------------------------------------
*/
$idx = new Poll;
class Poll {
var $topic = array();
var $poll = array();
var $upload = array();
var $poll_count = 0;
var $poll_choices = "";
function Poll() {
global $ibforums, $std, $DB, $print;
$ibforums->lang = $std->load_words($ibforums->lang, 'lang_post', $ibforums->lang_id);
// Lets do some tests to make sure that we are allowed to start a new topic
if (! $ibforums->member['g_vote_polls'])
{
$std->Error( array( LEVEL => 1, MSG => 'no_reply_polls') );
}
// Did we choose a choice?
if (!$ibforums->input['nullvote'])
{
if (! isset($ibforums->input['poll_vote']) )
{
$std->Error( array( LEVEL => 1, MSG => 'no_vote') );
}
}
// Make sure we have a valid poll id
$ibforums->input[t] = $std->is_number($ibforums->input[t]);
if (! $ibforums->input[t] ) {
$std->Error( array( LEVEL => 1, MSG => 'missing_files') );
}
// Load the topic and poll
$DB->query("SELECT t.*, p.pid as poll_id,p.choices,p.starter_id,p.votes from ibf_polls p, ibf_topics t WHERE t.tid='".$ibforums->input['t']."' and p.tid=t.tid");
$this->topic = $DB->fetch_row();
if (! $this->topic['tid'] )
{
$std->Error( array( LEVEL => 1, MSG => 'poll_none_found') );
}
if ($this->topic['state'] != 'open')
{
$std->Error( array( LEVEL => 1, MSG => 'locked_topic') );
}
// Have we voted before?
$DB->query("SELECT member_id from ibf_voters WHERE tid='".$this->topic['tid']."' and member_id='".$ibforums->member['id']."'");
if ( $DB->get_num_rows() )
{
$std->Error( array( LEVEL => 1, MSG => 'poll_you_voted') );
}
// If we're here, lets add the vote
$db_string = $std->compile_db_string(
array (
'member_id' => $ibforums->member['id'],
'ip_address' => $ibforums->input['IP_ADDRESS'],
'tid' => $this->topic['tid'],
'forum_id' => $this->topic['forum_id'],
'vote_date' => time(),
)
);
$DB->query("INSERT INTO ibf_voters (" .$db_string['FIELD_NAMES']. ") VALUES (". $db_string['FIELD_VALUES'] .")");
// If this isn't a null vote...
if (!$ibforums->input['nullvote'])
{
$poll_answers = unserialize(stripslashes($this->topic['choices']));
reset($poll_answers);
$new_poll_array = array();
foreach ($poll_answers as $entry)
{
$id = $entry[0];
$choice = $entry[1];
$votes = $entry[2];
if ($id == $ibforums->input['poll_vote'])
{
$votes++;
}
$new_poll_array[] = array( $id, $choice, $votes);
}
$this->topic['choices'] = addslashes(serialize($new_poll_array));
$DB->query("UPDATE ibf_polls SET ".
"votes=votes+1, ".
"choices='" . $this->topic['choices'] . "' ".
"WHERE pid='" . $this->topic['poll_id'] . "'");
if ($ibforums->vars['allow_poll_bump'])
{
$this->topic['last_vote'] = time();
$this->topic['last_post'] = time();
$DB->query("UPDATE ibf_topics SET ".
"last_vote='" . $this->topic['last_vote'] . "', ".
"last_post='" . $this->topic['last_post'] . "' ".
"WHERE tid='" . $this->topic['tid'] . "'");
}
else
{
$this->topic['last_vote'] = time();
$DB->query("UPDATE ibf_topics SET ".
"last_vote='" . $this->topic['last_vote'] . "', ".
"last_post='" . $this->topic['last_post'] . "' ".
"WHERE tid='" . $this->topic['tid'] . "'");
}
}
$lang = $ibforums->input['nullvote'] ? $ibforums->lang['poll_viewing_results'] : $ibforums->lang['poll_vote_added'];
$print->redirect_screen( $lang , "act=ST&f={$this->topic['forum_id']}&t={$this->topic['tid']}" );
}
}
?>
+39 -22
View File
@@ -2,10 +2,10 @@
/*
+--------------------------------------------------------------------------
| IBFORUMS v1
| Invision Board v1.1
| ========================================
| by Matthew Mecham and David Baxter
| (c) 2001,2002 IBForums
| by Matthew Mecham
| (c) 2001,2002 Invision Power Services
| http://www.ibforums.com
| ========================================
| Web: http://www.ibforums.com
@@ -44,7 +44,7 @@ class emailer {
var $template = "";
var $error = "";
var $parts = array();
var $bcc = "";
var $bcc = array();
var $mail_headers = array();
var $multipart = "";
var $boundry = "";
@@ -59,6 +59,8 @@ class emailer {
$this->from = $ibforums->vars['email_out'];
$this->temp_dump = $ibforums->vars['fake_mail'];
// Temporarily assign $header and $footer, this can be over-riden
// also
@@ -68,27 +70,33 @@ class emailer {
}
function add_attachment($data = "", $name = "", $ctype='application/octet-stream') {
function add_attachment($data = "", $name = "", $ctype='application/octet-stream')
{
$this->parts[] = array( 'ctype' => $ctype,
'data' => $data,
'encode' => 'base64',
'name' => $name
);
}
function build_headers() {
$this->mail_headers = "From: ".$this->from. "\n";
function build_headers()
{
global $ibforums;
$this->mail_headers = "From: \"".$ibforums->vars['board_name']."\" <".$this->from.">\n";
if ( count( $this->bcc ) > 1 )
{
$this->mail_headers .= "Bcc: ".implode( "," , $this->bcc ) . "\n";
}
$this->mail_headers .= "Return-Path: ".$this->from."\n";
$this->mail_headers .= "X-Priority: 3\n";
$this->mail_headers .= "X-Mailer: IBForums PHP Mailer\n";
if (is_array( $this->bcc ) )
{
$this->mail_headers .= "BCC: ".implode( "," , $this->bcc ) . "\n";
}
if ( count ($this->parts) > 0 )
{
@@ -130,7 +138,9 @@ class emailer {
// Physically sends the email
//+--------------------------------------------------------------------------
function send_mail() {
function send_mail()
{
global $ibforums;
$this->to = preg_replace( "/[ \t]+/" , " " , $this->to );
$this->from = preg_replace( "/[ \t]+/" , " " , $this->from );
@@ -147,12 +157,13 @@ class emailer {
if ( ($this->from) and ($this->subject) )
{
$this->subject .= " ( From ".$ibforums->vars['board_name']." )";
if ($this->temp_dump == 1)
{
$blah = $this->to."\n".$this->from."\n".$this->subject."\n".$this->mail_headers."\n\n".$this->message;
$blah = $this->subject."\n------------\n".$this->mail_headers."\n\n".$this->message;
$pathy = '/Library/WebServer/Documents/mail/'.date("js.F.Y.h:i.A"); // OS X rules!
$pathy = '/Library/WebServer/Documents/mail/'.date("F.Y.h:i.A").".txt"; // OS X rules!
$fh = fopen ($pathy, 'w');
fputs ($fh, $blah, strlen($blah) );
fclose($fh);
@@ -178,7 +189,7 @@ class emailer {
//+--------------------------------------------------------------------------
function get_template($name="", $language="en") {
global $IB, $DB;
global $ibforums, $IB, $DB;
if ($name == "")
{
@@ -186,19 +197,21 @@ class emailer {
$this->fatal_error("A valid email template ID was not passed to the email library during template parsing", "");
}
if (! file_exists("./lang/$language/email_content.php") )
{
require "./lang/en/email_content.php";
require "./lang/".$ibforums->vars['default_language']."/email_content.php";
}
else
{
require "./lang/$language/email_content.php";
}
if (! isset($EMAIL[ $name ]) ) {
if (! isset($EMAIL[ $name ]) )
{
$this->fatal_error("Could not find an email template with an ID of '$name'", "");
}
$this->template = $EMAIL[ $name ];
$this->template = $EMAIL['header'] . $EMAIL[ $name ] . $EMAIL['footer'];
}
//+--------------------------------------------------------------------------
@@ -241,6 +254,8 @@ class emailer {
function clean_message($message = "" ) {
$message = preg_replace( "/^(\r|\n)+?(.*)$/", "\\2", $message );
$message = preg_replace( "#<b>(.+?)</b>#" , "\\1", $message );
$message = preg_replace( "#<i>(.+?)</i>#" , "\\1", $message );
$message = preg_replace( "#<s>(.+?)</s>#" , "--\\1--", $message );
@@ -266,8 +281,10 @@ class emailer {
$message = preg_replace( "#<!--EDIT\|.+?\|.+?-->#" , "" , $message );
$message = preg_replace( "#<.+?".">#" , "" , $message );
//$message = str_replace( "\r" , "" , $message );
//$message = str_replace( "\n\n", "\n" , $message );
$message = preg_replace( "/(<br>|\n)/" , "\r\n", $message );
$message = str_replace( "<br>" , "\n", $message );
$message = str_replace( "&quot;", "\"", $message );
$message = str_replace( "&#092;", "\\", $message );
+362 -279
View File
@@ -1,280 +1,363 @@
<?php
/*
+--------------------------------------------------------------------------
| IBFORUMS v1
| ========================================
| by Matthew Mecham and David Baxter
| (c) 2001,2002 IBForums
| http://www.ibforums.com
| ========================================
| Web: http://www.ibforums.com
| Email: phpboards@ibforums.com
| Licence Info: phpib-licence@ibforums.com
+---------------------------------------------------------------------------
|
| > Edit post library
| > Module written by Matt Mecham
| > Date started: 19th February 2002
|
| > Module Version Number: 1.0.0
+--------------------------------------------------------------------------
*/
class post_functions extends Post {
var $nav = array();
var $title = "";
var $post = array();
var $topic = array();
var $upload = array();
var $moderator = array( 'member_id' => 0, 'member_name' => "", 'edit_post' => 0 );
var $orig_post = array();
function post_functions($class) {
global $ibforums, $std, $DB;
// Lets load the topic from the database before we do anything else.
$DB->query("SELECT * FROM ibf_topics WHERE tid='".$ibforums->input['t']."'");
$this->topic = $DB->fetch_row();
// Is it legitimate?
if (! $this->topic['tid'])
{
$std->Error( array( LEVEL => 1, MSG => 'missing_files') );
}
// Load the old post
$DB->query("SELECT * FROM ibf_posts WHERE pid='".$ibforums->input['p']."'");
$this->orig_post = $DB->fetch_row();
if (! $this->orig_post['pid'])
{
$std->Error( array( LEVEL => 1, MSG => 'missing_files') );
}
// Load the moderator
if ($ibforums->member['id'])
{
$DB->query("SELECT member_id, member_name, mid, edit_post FROM ibf_moderators WHERE member_id='".$ibforums->member['id']."' and forum_id='".$class->forum['id']."'");
$this->moderator = $DB->fetch_row();
}
//-------------------------------------------------
// Lets do some tests to make sure that we are
// allowed to edit this topic
//-------------------------------------------------
$can_edit = 0;
if ($ibforums->member['g_is_supmod'])
{
$can_edit = 1;
}
if ($this->moderator['edit_post'])
{
$can_edit = 1;
}
if ( ($this->orig_post['author_id'] == $ibforums->member['id']) and ($ibforums->member['g_edit_posts']) )
{
$can_edit = 1;
}
if ($can_edit != 1)
{
$std->Error( array( LEVEL => 1, MSG => 'not_op') );
}
// Is the topic locked?
if (($this->topic['state'] != 'open') and (!$ibforums->member['g_is_supmod']))
{
$std->Error( array( LEVEL => 1, MSG => 'locked_topic') );
}
}
function process($class) {
global $ibforums, $std, $DB, $print;
//-------------------------------------------------
// Parse the post, and check for any errors.
// overwrites saved post intentionally
//-------------------------------------------------
$this->post = $class->compile_post();
if ($class->obj['post_errors'] == "")
{
$this->upload = $class->process_upload();
}
if ( ($class->obj['post_errors'] != "") or ($class->obj['preview_post'] != "") )
{
// Show the form again
$this->show_form($class);
}
else
{
$this->complete_edit($class);
}
}
function complete_edit($class) {
global $ibforums, $std, $DB, $print;
$time = $std->get_date( time(), 'LONG' );
//-------------------------------------------------
// Reset some data
//-------------------------------------------------
$this->post['attach_id'] = $this->orig_post['attach_id'];
$this->post['attach_type'] = $this->orig_post['attach_type'];
$this->post['attach_hits'] = $this->orig_post['attach_hits'];
$this->post['ip_address'] = $this->orig_post['ip_address'];
$this->post['topic_id'] = $this->orig_post['topic_id'];
$this->post['author_id'] = $this->orig_post['author_id'];
$this->post['pid'] = $this->orig_post['pid'];
$this->post['post_date'] = $this->orig_post['post_date'];
$this->post['author_name'] = $this->orig_post['author_name'];
// If the post icon has changed, update the topic post icon
if ($this->orig_post['new_topic'] == 1)
{
if ($this->post['icon_id'] != $this->orig_post['icon_id'])
{
$DB->query("UPDATE ibf_topics SET icon_id='".$this->post['icon_id']."' WHERE tid='".$this->topic['tid']."'");
}
}
//-------------------------------------------------
// Update the database (ib_forum_post)
//-------------------------------------------------
if ($ibforums->member['g_append_edit'])
{
$this->post['post'] .= "\n\n<br><br><!--EDIT|".$ibforums->member['name']."|".$time."-->";
}
$db_string = $DB->compile_db_update_string( $this->post );
$DB->query("UPDATE ibf_posts SET $db_string WHERE pid='".$this->post['pid']."'");
//-------------------------------------------------
// Redirect them back to the topic
//-------------------------------------------------
$print->redirect_screen( $ibforums->lang['post_edited'], "act=ST&f={$class->forum['id']}&t={$this->topic['tid']}&st={$ibforums->input['st']}#entry{$this->post['pid']}");
}
function show_form($class) {
global $ibforums, $std, $DB, $print, $HTTP_POST_VARS;
//-------------------------------------------------
// Sort out the "raw" textarea input and make it safe incase
// we have a <textarea> tag in the raw post var.
//-------------------------------------------------
$raw_post = isset($HTTP_POST_VARS['Post']) ? $HTTP_POST_VARS['Post'] : $class->parser->unconvert($this->orig_post['post'], $class->forum['use_ibc'], $class->forum['use_html']);
if (isset($raw_post)) {
$raw_post = preg_replace( "/<\/textarea>/", "&lt;/textarea>", $raw_post );
$raw_post = str_replace( '$', "&#036;", $raw_post );
$raw_post = str_replace( '<%', "&lt;%" , $raw_post );
$raw_post = stripslashes($raw_post);
}
//-------------------------------------------------
// Do we have any posting errors?
//-------------------------------------------------
if ($class->obj['post_errors'])
{
$class->output .= $class->html->errors( $ibforums->lang[ $class->obj['post_errors'] ]);
}
if ($class->obj['preview_post'])
{
$class->output .= $class->html->preview( $class->parser->convert( array( 'TEXT' => $this->post['post'], 'CODE' => $class->forum['use_ibc'], 'SMILIES' => $ibforums->input['enableemo'], 'HTML' => $class->forum['use_html']) ) );
}
$class->output .= $class->html_start_form( array( 1 => array( 'CODE', '09' ),
2 => array( 't' , $this->topic['tid']),
3 => array( 'p' , $ibforums->input['p'] ),
4 => array( 'st' , $ibforums->input['st'] ),
) );
//---------------------------------------
// START TABLE
//---------------------------------------
$class->output .= $class->html->table_structure();
//---------------------------------------
$start_table = $class->html->table_top( "{$ibforums->lang['top_txt_edit']} {$this->topic['title']}");
$name_fields = $class->html_name_field();
$post_box = $class->html_post_body( $raw_post );
$end_form = $class->html->EndForm( $ibforums->lang['submit_edit'] );
$post_icons = $class->html_post_icons($this->orig_post['icon_id']);
//---------------------------------------
$class->output = preg_replace( "/<!--START TABLE-->/" , "$start_table" , $class->output );
$class->output = preg_replace( "/<!--NAME FIELDS-->/" , "$name_fields" , $class->output );
$class->output = preg_replace( "/<!--POST BOX-->/" , "$post_box" , $class->output );
$class->output = preg_replace( "/<!--POST ICONS-->/" , "$post_icons" , $class->output );
$class->output = preg_replace( "/<!--END TABLE-->/" , "$end_form" , $class->output );
//---------------------------------------
$class->html_add_smilie_box();
$class->html_topic_summary($this->topic['tid']);
$this->nav = array( "<a href='{$class->base_url}&act=SC&c={$class->forum['cat_id']}'>{$class->forum['cat_name']}</a>",
"<a href='{$class->base_url}&act=SF&f={$class->forum['id']}'>{$class->forum['name']}</a>",
"<a href='{$class->base_url}&act=ST&f={$class->forum['id']}&t={$this->topic['tid']}'>{$this->topic['title']}</a>",
);
$this->title = $ibforums->lang['editing_post'].' '.$this->topic['title'];
$print->add_output("$class->output");
$print->do_output( array( 'TITLE' => $ibforums->vars['board_name']." -> ".$this->title,
'JS' => 1,
'NAV' => $this->nav,
) );
}
}
<?php
/*
+--------------------------------------------------------------------------
| Invision Board v1.1
| ========================================
| by Matthew Mecham
| (c) 2001,2002 Invision Power Services
| http://www.ibforums.com
| ========================================
| Web: http://www.ibforums.com
| Email: phpboards@ibforums.com
| Licence Info: phpib-licence@ibforums.com
+---------------------------------------------------------------------------
|
| > Edit post library
| > Module written by Matt Mecham
| > Date started: 19th February 2002
|
| > Module Version Number: 1.0.0
+--------------------------------------------------------------------------
*/
class post_functions extends Post {
var $nav = array();
var $title = "";
var $post = array();
var $topic = array();
var $upload = array();
var $moderator = array( 'member_id' => 0, 'member_name' => "", 'edit_post' => 0 );
var $orig_post = array();
function post_functions($class) {
global $ibforums, $std, $DB;
// Lets load the topic from the database before we do anything else.
$DB->query("SELECT * FROM ibf_topics WHERE tid='".$ibforums->input['t']."'");
$this->topic = $DB->fetch_row();
// Is it legitimate?
if (! $this->topic['tid'])
{
$std->Error( array( LEVEL => 1, MSG => 'missing_files') );
}
// Load the old post
$DB->query("SELECT * FROM ibf_posts WHERE pid='".$ibforums->input['p']."'");
$this->orig_post = $DB->fetch_row();
if (! $this->orig_post['pid'])
{
$std->Error( array( LEVEL => 1, MSG => 'missing_files') );
}
// Load the moderator
if ($ibforums->member['id'])
{
$DB->query("SELECT member_id, member_name, mid, edit_post FROM ibf_moderators WHERE forum_id='".$class->forum['id']."' AND (member_id='".$ibforums->member['id']."' OR (is_group=1 AND group_id='".$ibforums->member['mgroup']."'))");
$this->moderator = $DB->fetch_row();
}
//-------------------------------------------------
// Lets do some tests to make sure that we are
// allowed to edit this topic
//-------------------------------------------------
$can_edit = 0;
if ($ibforums->member['g_is_supmod'])
{
$can_edit = 1;
}
if ($this->moderator['edit_post'])
{
$can_edit = 1;
}
if ( ($this->orig_post['author_id'] == $ibforums->member['id']) and ($ibforums->member['g_edit_posts']) )
{
// Have we set a time limit?
if ($ibforums->member['g_edit_cutoff'] > 0)
{
if ( $this->orig_post['post_date'] > ( time() - ( intval($ibforums->member['g_edit_cutoff']) * 60 ) ) )
{
$can_edit = 1;
}
}
else
{
$can_edit = 1;
}
}
if ($can_edit != 1)
{
$std->Error( array( LEVEL => 1, MSG => 'not_op') );
}
// Is the topic locked?
if (($this->topic['state'] != 'open') and (!$ibforums->member['g_is_supmod']))
{
$std->Error( array( LEVEL => 1, MSG => 'locked_topic') );
}
}
function process($class) {
global $ibforums, $std, $DB, $print;
//-------------------------------------------------
// Parse the post, and check for any errors.
// overwrites saved post intentionally
//-------------------------------------------------
$this->post = $class->compile_post();
if ( ($class->obj['post_errors'] != "") or ($class->obj['preview_post'] != "") )
{
// Show the form again
$this->show_form($class);
}
else
{
$this->complete_edit($class);
}
}
function complete_edit($class) {
global $ibforums, $std, $DB, $print, $HTTP_POST_FILES;
$time = $std->get_date( time(), 'LONG' );
//-------------------------------------------------
// Reset some data
//-------------------------------------------------
// Do we have to adjust the attachments?
if ($this->orig_post['attach_id'])
{
if ($ibforums->input['editupload'] != 'keep')
{
// We're either uploading a new attachment, or deleting one, so lets
// remove the old attachment first eh?
if (is_file($ibforums->vars['upload_dir']."/".$this->orig_post['attach_id']))
{
@unlink($ibforums->vars['upload_dir']."/".$this->orig_post['attach_id']);
}
if ($ibforums->input['editupload'] == 'new')
{
// w00t, we're uploading a new ..um.. upload
$new_upload = $class->process_upload();
if ( $class->obj['post_errors'] != "") {
$this->show_form($class);
}
$this->post['attach_id'] = $new_upload['attach_id'];
$this->post['attach_type'] = $new_upload['attach_type'];
$this->post['attach_hits'] = $new_upload['attach_hits'];
$this->post['attach_file'] = $new_upload['attach_file'];
}
else if ($ibforums->input['editupload'] == 'delete')
{
// Simply remove the DB data as we've already removed the file
$this->post['attach_id'] = "";
$this->post['attach_type'] = "";
$this->post['attach_hits'] = "";
$this->post['attach_file'] = "";
}
}
else
{
// We are keeping the old attachment
$this->post['attach_id'] = $this->orig_post['attach_id'];
$this->post['attach_type'] = $this->orig_post['attach_type'];
$this->post['attach_hits'] = $this->orig_post['attach_hits'];
$this->post['attach_file'] = $this->orig_post['attach_file'];
}
}
$this->post['ip_address'] = $this->orig_post['ip_address'];
$this->post['topic_id'] = $this->orig_post['topic_id'];
$this->post['author_id'] = $this->orig_post['author_id'];
$this->post['pid'] = $this->orig_post['pid'];
$this->post['post_date'] = $this->orig_post['post_date'];
$this->post['author_name'] = $this->orig_post['author_name'];
$this->post['edit_time'] = time();
$this->post['edit_name'] = $ibforums->member['name'];
// If the post icon has changed, update the topic post icon
if ($this->orig_post['new_topic'] == 1)
{
if ($this->post['icon_id'] != $this->orig_post['icon_id'])
{
$DB->query("UPDATE ibf_topics SET icon_id='".$this->post['icon_id']."' WHERE tid='".$this->topic['tid']."'");
}
}
//-------------------------------------------------
// Update the database (ib_forum_post)
//-------------------------------------------------
$this->post['append_edit'] = 1;
if ($ibforums->member['g_append_edit'])
{
if ($ibforums->input['add_edit'] != 1)
{
$this->post['append_edit'] = 0;
}
}
$db_string = $DB->compile_db_update_string( $this->post );
$DB->query("UPDATE ibf_posts SET $db_string WHERE pid='".$this->post['pid']."'");
//-------------------------------------------------
// Redirect them back to the topic
//-------------------------------------------------
$print->redirect_screen( $ibforums->lang['post_edited'], "act=ST&f={$class->forum['id']}&t={$this->topic['tid']}&st={$ibforums->input['st']}#entry{$this->post['pid']}");
}
function show_form($class) {
global $ibforums, $std, $DB, $print, $HTTP_POST_VARS;
//-------------------------------------------------
// Sort out the "raw" textarea input and make it safe incase
// we have a <textarea> tag in the raw post var.
//-------------------------------------------------
$raw_post = isset($HTTP_POST_VARS['Post']) ? $HTTP_POST_VARS['Post'] : $class->parser->unconvert($this->orig_post['post'], $class->forum['use_ibc'], $class->forum['use_html']);
if (isset($raw_post)) {
$raw_post = str_replace( '$' , "&#036;" , $raw_post );
$raw_post = str_replace( '<' , "&lt;" , $raw_post );
$raw_post = stripslashes($raw_post);
}
//-------------------------------------------------
// Do we have any posting errors?
//-------------------------------------------------
if ($class->obj['post_errors'])
{
$class->output .= $class->html->errors( $ibforums->lang[ $class->obj['post_errors'] ]);
}
if ($class->obj['preview_post'])
{
$class->output .= $class->html->preview( $class->parser->convert( array( 'TEXT' => $this->post['post'], 'CODE' => $class->forum['use_ibc'], 'SMILIES' => $ibforums->input['enableemo'], 'HTML' => $class->forum['use_html']) ) );
}
$class->check_upload_ability();
$class->output .= $class->html_start_form( array( 1 => array( 'CODE', '09' ),
2 => array( 't' , $this->topic['tid']),
3 => array( 'p' , $ibforums->input['p'] ),
4 => array( 'st' , $ibforums->input['st'] ),
) );
//---------------------------------------
// START TABLE
//---------------------------------------
$class->output .= $class->html->table_structure();
//---------------------------------------
$start_table = $class->html->table_top( "{$ibforums->lang['top_txt_edit']} {$this->topic['title']}");
$name_fields = $class->html_name_field();
$post_box = $class->html_post_body( $raw_post );
$end_form = $class->html->EndForm( $ibforums->lang['submit_edit'] );
$post_icons = $class->html_post_icons($this->orig_post['icon_id']);
if (($class->obj['can_upload']) and ($this->orig_post['attach_id'] != ""))
{
$upload_field = $class->html->edit_upload_field( $ibforums->member['g_attach_max'] * 1024, $this->orig_post['attach_file'] );
}
if ($ibforums->member['g_append_edit'])
{
$checked = "";
if ($this->orig_post['append_edit'])
{
$checked = "checked";
}
$edit_option = $class->html->add_edit_box($checked);
}
//---------------------------------------
$class->output = str_replace( "<!--START TABLE-->" , $start_table , $class->output );
$class->output = str_replace( "<!--NAME FIELDS-->" , $name_fields , $class->output );
$class->output = str_replace( "<!--POST BOX-->" , $post_box , $class->output );
$class->output = str_replace( "<!--POST ICONS-->" , $post_icons , $class->output );
$class->output = str_replace( "<!--END TABLE-->" , $end_form , $class->output );
$class->output = str_replace( "<!--UPLOAD FIELD-->", $upload_field , $class->output );
$class->output = str_replace( "<!--MOD OPTIONS-->" , $edit_option , $class->output );
//---------------------------------------
$class->html_add_smilie_box();
$class->html_topic_summary($this->topic['tid']);
$this->nav = array( "<a href='{$class->base_url}&act=SC&c={$class->forum['cat_id']}'>{$class->forum['cat_name']}</a>",
"<a href='{$class->base_url}&act=SF&f={$class->forum['id']}'>{$class->forum['name']}</a>",
"<a href='{$class->base_url}&act=ST&f={$class->forum['id']}&t={$this->topic['tid']}'>{$this->topic['title']}</a>",
);
$this->title = $ibforums->lang['editing_post'].' '.$this->topic['title'];
$print->add_output("$class->output");
$print->do_output( array( 'TITLE' => $ibforums->vars['board_name']." -> ".$this->title,
'JS' => 1,
'NAV' => $this->nav,
) );
}
}
?>
+405 -371
View File
@@ -1,372 +1,406 @@
<?php
/*
+--------------------------------------------------------------------------
| IBFORUMS v1
| ========================================
| by Matthew Mecham and David Baxter
| (c) 2001,2002 IBForums
| http://www.ibforums.com
| ========================================
| Web: http://www.ibforums.com
| Email: phpboards@ibforums.com
| Licence Info: phpib-licence@ibforums.com
+---------------------------------------------------------------------------
|
| > New Post module
| > Module written by Matt Mecham
| > Date started: 17th February 2002
|
| > Module Version Number: 1.0.0
+--------------------------------------------------------------------------
*/
class post_functions extends Post {
var $nav = array();
var $title = "";
var $post = array();
var $topic = array();
var $upload = array();
var $mod_topic = array();
var $m_group = "";
function post_functions($class) {
global $ibforums, $std, $DB;
// Lets do some tests to make sure that we are allowed to start a new topic
$this->m_group = $ibforums->member['mgroup'];
if (! $ibforums->member['g_post_new_topics'])
{
$std->Error( array( LEVEL => 1, MSG => 'no_starting') );
}
if ($class->forum['start_perms'] != '*')
{
if (! preg_match( "/(^|,)$this->m_group(,|$)/", $class->forum['start_perms'] ) )
{
$std->Error( array( LEVEL => 1, MSG => 'no_starting') );
}
}
}
function process($class) {
global $ibforums, $std, $DB, $print, $HTTP_POST_VARS;
//-------------------------------------------------
// Parse the post, and check for any errors.
//-------------------------------------------------
$this->post = $class->compile_post();
//-------------------------------------------------
// check to make sure we have a valid topic title
//-------------------------------------------------
$ibforums->input['TopicTitle'] = str_replace( "<br>", "", $ibforums->input['TopicTitle'] );
$ibforums->input['TopicTitle'] = trim(stripslashes($ibforums->input['TopicTitle']));
if ( (strlen($ibforums->input['TopicTitle']) < 2) or (!$ibforums->input['TopicTitle']) )
{
$class->obj['post_errors'] = 'no_topic_title';
}
if ( strlen($HTTP_POST_VARS['TopicTitle']) > 64 )
{
$class->obj['post_errors'] = 'topic_title_long';
}
//-------------------------------------------------
// If we don't have any errors yet, parse the upload
//-------------------------------------------------
if ($class->obj['post_errors'] == "")
{
$this->upload = $class->process_upload();
}
if ( ($class->obj['post_errors'] != "") or ($class->obj['preview_post'] != "") ) {
// Show the form again
$this->show_form($class);
} else {
$this->add_new_topic($class);
}
}
function add_new_topic($class) {
global $ibforums, $std, $DB, $print;
//-------------------------------------------------
// Fix up the topic title
//-------------------------------------------------
if ($ibforums->vars['etfilter_punct'])
{
$ibforums->input['TopicTitle'] = preg_replace( "/\?{1,}/" , "?" , $ibforums->input['TopicTitle'] );
$ibforums->input['TopicTitle'] = preg_replace( "/(&#33;){1,}/" , "&#33;", $ibforums->input['TopicTitle'] );
}
if ($ibforums->vars['etfilter_shout'])
{
$ibforums->input['TopicTitle'] = ucwords(strtolower($ibforums->input['TopicTitle']));
}
$ibforums->input['TopicTitle'] = $class->parser->bad_words( $ibforums->input['TopicTitle'] );
$ibforums->input['TopicDesc'] = $class->parser->bad_words( $ibforums->input['TopicDesc'] );
$pinned = 0;
$state = 'open';
if ( ($ibforums->input['mod_options'] != "") or ($ibforums->input['mod_options'] != 'nowt') )
{
if ($ibforums->input['mod_options'] == 'pin')
{
if ($ibforums->member['g_is_supmod'] == 1 or $class->moderator['pin_topic'] == 1)
{
$pinned = 1;
$class->moderate_log('Pinned topic from post form', $ibforums->input['TopicTitle']);
}
}
else if ($ibforums->input['mod_options'] == 'close')
{
if ($ibforums->member['g_is_supmod'] == 1 or $class->moderator['close_topic'] == 1)
{
$state = 'closed';
$class->moderate_log('Closed topic from post form', $ibforums->input['TopicTitle']);
}
}
}
//-------------------------------------------------
// Build the master array
//-------------------------------------------------
$this->topic = array(
'title' => $ibforums->input['TopicTitle'],
'description' => $ibforums->input['TopicDesc'] ,
'state' => $state,
'posts' => 0,
'starter_id' => $ibforums->member['id'],
'starter_name' => $ibforums->member['id'] ? $ibforums->member['name'] : $ibforums->input['UserName'],
'start_date' => time(),
'last_poster_id' => $ibforums->member['id'],
'last_poster_name' => $ibforums->member['id'] ? $ibforums->member['name'] : $ibforums->input['UserName'],
'last_post' => time(),
'icon_id' => $ibforums->input['iconid'],
'author_mode' => $ibforums->member['id'] ? 1 : 0,
'poll_state' => 0,
'last_vote' => 0,
'views' => 0,
'forum_id' => $class->forum['id'],
'approved' => $class->obj['moderate'] ? 0 : 1,
'pinned' => $pinned,
);
//-------------------------------------------------
// Insert the topic into the database to get the
// last inserted value of the auto_increment field
// follow suit with the post
//-------------------------------------------------
$db_string = $DB->compile_db_insert_string( $this->topic );
$DB->query("INSERT INTO ibf_topics (" .$db_string['FIELD_NAMES']. ") VALUES (". $db_string['FIELD_VALUES'] .")");
$this->post['topic_id'] = $DB->get_insert_id();
$this->topic['tid'] = $this->post['topic_id'];
/*---------------------------------------------------*/
// Update the post info with the upload array info
$this->post['attach_id'] = $this->upload['attach_id'];
$this->post['attach_type'] = $this->upload['attach_type'];
$this->post['attach_hits'] = $this->upload['attach_hits'];
$this->post['attach_file'] = $this->upload['attach_file'];
$this->post['new_topic'] = 1;
$db_string = $DB->compile_db_insert_string( $this->post );
$DB->query("INSERT INTO ibf_posts (" .$db_string['FIELD_NAMES']. ") VALUES (". $db_string['FIELD_VALUES'] .")");
$this->post['pid'] = $DB->get_insert_id();
if ($class->obj['moderate'])
{
// Redirect them with a message telling them the post has to be previewed first
$print->redirect_screen( $ibforums->lang['moderate_topic'], "act=SF&f={$class->forum['id']}" );
}
//-------------------------------------------------
// If we are still here, lets update the
// board/forum stats
//-------------------------------------------------
$class->forum['last_title'] = $this->topic['title'];
$class->forum['last_id'] = $this->topic['tid'];
$class->forum['last_post'] = time();
$class->forum['last_poster_name'] = $ibforums->member['id'] ? $ibforums->member['name'] : $ibforums->input['UserName'];
$class->forum['last_poster_id'] = $ibforums->member['id'];
$class->forum['topics']++;
// Update the database
$DB->query("UPDATE ibf_forums SET last_title='" .$class->forum['last_title'] ."', ".
"last_id='" .$class->forum['last_id'] ."', ".
"last_post='" .$class->forum['last_post'] ."', ".
"last_poster_name='".$class->forum['last_poster_name'] ."', ".
"last_poster_id='" .$class->forum['last_poster_id'] ."', ".
"topics='" .$class->forum['topics'] ."' ".
"WHERE id='" .$class->forum['id'] ."'");
$DB->query("UPDATE ibf_stats SET TOTAL_TOPICS=TOTAL_TOPICS+1");
//-------------------------------------------------
// If we are a member, lets update thier last post
// date and increment their post count.
//-------------------------------------------------
$pcount = "";
if ($ibforums->member['id'])
{
if ($class->forum['inc_postcount'])
{
// Increment the users post count
$pcount = "posts=posts+1, ";
}
$ibforums->member['last_post'] = time();
$DB->query("UPDATE ibf_members SET ".$pcount.
"last_post='" .$ibforums->member['last_post'] ."'".
"WHERE id='" .$ibforums->member['id']."'");
}
//-------------------------------------------------
// Redirect them back to the topic
//-------------------------------------------------
$std->boink_it($class->base_url."&act=ST&f={$class->forum['id']}&t={$this->topic['tid']}");
}
function show_form(&$class) {
global $ibforums, $std, $DB, $print, $HTTP_POST_VARS;
// Sort out the "raw" textarea input and make it safe incase
// we have a <textarea> tag in the raw post var.
$raw_post = isset($HTTP_POST_VARS['Post']) ? $HTTP_POST_VARS['Post'] : "";
$topic_title = isset($HTTP_POST_VARS['TopicTitle']) ? $ibforums->input['TopicTitle'] : "";
$topic_desc = isset($HTTP_POST_VARS['TopicDesc']) ? $ibforums->input['TopicDesc'] : "";
if (isset($raw_post))
{
$raw_post = preg_replace( "/<textarea>/", "&lt;textarea>", $raw_post );
$raw_post = str_replace( '$' , "&#036;" , $raw_post );
$raw_post = str_replace( '<%', "&lt;%" , $raw_post );
$raw_post = stripslashes($raw_post);
}
// Do we have any posting errors?
if ($class->obj['post_errors'])
{
$class->output .= $class->html->errors( $ibforums->lang[ $class->obj['post_errors'] ]);
}
if ($class->obj['preview_post'])
{
$class->output .= $class->html->preview( $class->parser->convert( array( 'TEXT' => $this->post['post'], 'CODE' => $class->forum['use_ibc'], 'SMILIES' => $ibforums->input['enableemo'], 'HTML' => $class->forum['use_html']) ) );
}
$class->check_upload_ability();
$class->output .= $class->html_start_form( array( 1 => array( 'CODE', '01' ) ) );
//---------------------------------------
// START TABLE
//---------------------------------------
$class->output .= $class->html->table_structure();
//---------------------------------------
$topic_title = $class->html->topictitle_fields( array( TITLE => $topic_title, DESC => $topic_desc ) );
$start_table = $class->html->table_top( "{$ibforums->lang['top_txt_new']} {$class->forum['name']}");
$name_fields = $class->html_name_field();
$post_box = $class->html_post_body( $raw_post );
$mod_options = $class->mod_options();
$end_form = $class->html->EndForm( $ibforums->lang['submit_new'] );
$post_icons = $class->html_post_icons();
if ($class->obj['can_upload'])
{
$upload_field = $class->html->Upload_field( $ibforums->member['g_attach_max'] * 1024 );
}
//---------------------------------------
$class->output = preg_replace( "/<!--START TABLE-->/" , "$start_table" , $class->output );
$class->output = preg_replace( "/<!--NAME FIELDS-->/" , "$name_fields" , $class->output );
$class->output = preg_replace( "/<!--POST BOX-->/" , "$post_box" , $class->output );
$class->output = preg_replace( "/<!--POST ICONS-->/" , "$post_icons" , $class->output );
$class->output = preg_replace( "/<!--UPLOAD FIELD-->/", "$upload_field" , $class->output );
$class->output = preg_replace( "/<!--MOD OPTIONS-->/" , "$mod_options" , $class->output );
$class->output = preg_replace( "/<!--END TABLE-->/" , "$end_form" , $class->output );
$class->output = preg_replace( "/<!--TOPIC TITLE-->/" , "$topic_title" , $class->output );
//---------------------------------------
$class->html_add_smilie_box();
$this->nav = array( "<a href='{$class->base_url}&act=SC&c={$class->forum['cat_id']}'>{$class->forum['cat_name']}</a>",
"<a href='{$class->base_url}&act=SF&f={$class->forum['id']}'>{$class->forum['name']}</a>",
);
$this->title = $ibforums->lang['posting_new_topic'];
$print->add_output("$class->output");
$print->do_output( array( 'TITLE' => $ibforums->vars['board_name']." -> ".$this->title,
'JS' => 1,
'NAV' => $this->nav,
) );
}
}
<?php
/*
+--------------------------------------------------------------------------
| Invision Board v1.1
| ========================================
| by Matthew Mecham
| (c) 2001,2002 Invision Power Services
| http://www.ibforums.com
| ========================================
| Web: http://www.ibforums.com
| Email: phpboards@ibforums.com
| Licence Info: phpib-licence@ibforums.com
+---------------------------------------------------------------------------
|
| > New Post module
| > Module written by Matt Mecham
| > Date started: 17th February 2002
|
| > Module Version Number: 1.0.0
+--------------------------------------------------------------------------
*/
class post_functions extends Post {
var $nav = array();
var $title = "";
var $post = array();
var $topic = array();
var $upload = array();
var $mod_topic = array();
var $m_group = "";
function post_functions($class) {
global $ibforums, $std, $DB;
// Lets do some tests to make sure that we are allowed to start a new topic
$this->m_group = $ibforums->member['mgroup'];
if (! $ibforums->member['g_post_new_topics'])
{
$std->Error( array( LEVEL => 1, MSG => 'no_starting') );
}
if ($class->forum['start_perms'] != '*')
{
if (! preg_match( "/(^|,)$this->m_group(,|$)/", $class->forum['start_perms'] ) )
{
$std->Error( array( LEVEL => 1, MSG => 'no_starting') );
}
}
}
function process($class) {
global $ibforums, $std, $DB, $print, $HTTP_POST_VARS;
//-------------------------------------------------
// Parse the post, and check for any errors.
//-------------------------------------------------
$this->post = $class->compile_post();
//-------------------------------------------------
// check to make sure we have a valid topic title
//-------------------------------------------------
$ibforums->input['TopicTitle'] = str_replace( "<br>", "", $ibforums->input['TopicTitle'] );
$ibforums->input['TopicTitle'] = trim(stripslashes($ibforums->input['TopicTitle']));
if ( (strlen($ibforums->input['TopicTitle']) < 2) or (!$ibforums->input['TopicTitle']) )
{
$class->obj['post_errors'] = 'no_topic_title';
}
if ( strlen($HTTP_POST_VARS['TopicTitle']) > 64 )
{
$class->obj['post_errors'] = 'topic_title_long';
}
//-------------------------------------------------
// If we don't have any errors yet, parse the upload
//-------------------------------------------------
if ($class->obj['post_errors'] == "")
{
$this->upload = $class->process_upload();
}
if ( ($class->obj['post_errors'] != "") or ($class->obj['preview_post'] != "") ) {
// Show the form again
$this->show_form($class);
} else {
$this->add_new_topic($class);
}
}
function add_new_topic($class) {
global $ibforums, $std, $DB, $print;
//-------------------------------------------------
// Fix up the topic title
//-------------------------------------------------
if ($ibforums->vars['etfilter_punct'])
{
$ibforums->input['TopicTitle'] = preg_replace( "/\?{1,}/" , "?" , $ibforums->input['TopicTitle'] );
$ibforums->input['TopicTitle'] = preg_replace( "/(&#33;){1,}/" , "&#33;", $ibforums->input['TopicTitle'] );
}
if ($ibforums->vars['etfilter_shout'])
{
$ibforums->input['TopicTitle'] = ucwords(strtolower($ibforums->input['TopicTitle']));
}
$ibforums->input['TopicTitle'] = $class->parser->bad_words( $ibforums->input['TopicTitle'] );
$ibforums->input['TopicDesc'] = $class->parser->bad_words( $ibforums->input['TopicDesc'] );
$pinned = 0;
$state = 'open';
if ( ($ibforums->input['mod_options'] != "") or ($ibforums->input['mod_options'] != 'nowt') )
{
if ($ibforums->input['mod_options'] == 'pin')
{
if ($ibforums->member['g_is_supmod'] == 1 or $class->moderator['pin_topic'] == 1)
{
$pinned = 1;
$class->moderate_log('Pinned topic from post form', $ibforums->input['TopicTitle']);
}
}
else if ($ibforums->input['mod_options'] == 'close')
{
if ($ibforums->member['g_is_supmod'] == 1 or $class->moderator['close_topic'] == 1)
{
$state = 'closed';
$class->moderate_log('Closed topic from post form', $ibforums->input['TopicTitle']);
}
}
}
//-------------------------------------------------
// Build the master array
//-------------------------------------------------
$this->topic = array(
'title' => $ibforums->input['TopicTitle'],
'description' => $ibforums->input['TopicDesc'] ,
'state' => $state,
'posts' => 0,
'starter_id' => $ibforums->member['id'],
'starter_name' => $ibforums->member['id'] ? $ibforums->member['name'] : $ibforums->input['UserName'],
'start_date' => time(),
'last_poster_id' => $ibforums->member['id'],
'last_poster_name' => $ibforums->member['id'] ? $ibforums->member['name'] : $ibforums->input['UserName'],
'last_post' => time(),
'icon_id' => $ibforums->input['iconid'],
'author_mode' => $ibforums->member['id'] ? 1 : 0,
'poll_state' => 0,
'last_vote' => 0,
'views' => 0,
'forum_id' => $class->forum['id'],
'approved' => $class->obj['moderate'] ? 0 : 1,
'pinned' => $pinned,
);
//-------------------------------------------------
// Insert the topic into the database to get the
// last inserted value of the auto_increment field
// follow suit with the post
//-------------------------------------------------
$db_string = $DB->compile_db_insert_string( $this->topic );
$DB->query("INSERT INTO ibf_topics (" .$db_string['FIELD_NAMES']. ") VALUES (". $db_string['FIELD_VALUES'] .")");
$this->post['topic_id'] = $DB->get_insert_id();
$this->topic['tid'] = $this->post['topic_id'];
/*---------------------------------------------------*/
// Update the post info with the upload array info
$this->post['attach_id'] = $this->upload['attach_id'];
$this->post['attach_type'] = $this->upload['attach_type'];
$this->post['attach_hits'] = $this->upload['attach_hits'];
$this->post['attach_file'] = $this->upload['attach_file'];
$this->post['new_topic'] = 1;
$db_string = $DB->compile_db_insert_string( $this->post );
$DB->query("INSERT INTO ibf_posts (" .$db_string['FIELD_NAMES']. ") VALUES (". $db_string['FIELD_VALUES'] .")");
$this->post['pid'] = $DB->get_insert_id();
if ($class->obj['moderate'])
{
// Redirect them with a message telling them the post has to be previewed first
$print->redirect_screen( $ibforums->lang['moderate_topic'], "act=SF&f={$class->forum['id']}" );
}
//-------------------------------------------------
// If we are still here, lets update the
// board/forum stats
//-------------------------------------------------
$class->forum['last_title'] = $this->topic['title'];
$class->forum['last_id'] = $this->topic['tid'];
$class->forum['last_post'] = time();
$class->forum['last_poster_name'] = $ibforums->member['id'] ? $ibforums->member['name'] : $ibforums->input['UserName'];
$class->forum['last_poster_id'] = $ibforums->member['id'];
$class->forum['topics']++;
// Update the database
$DB->query("UPDATE ibf_forums SET last_title='" .$class->forum['last_title'] ."', ".
"last_id='" .$class->forum['last_id'] ."', ".
"last_post='" .$class->forum['last_post'] ."', ".
"last_poster_name='".$class->forum['last_poster_name'] ."', ".
"last_poster_id='" .$class->forum['last_poster_id'] ."', ".
"topics='" .$class->forum['topics'] ."' ".
"WHERE id='" .$class->forum['id'] ."'");
$DB->query("UPDATE ibf_stats SET TOTAL_TOPICS=TOTAL_TOPICS+1");
//-------------------------------------------------
// Are we tracking new topics we start 'auto_track'?
//-------------------------------------------------
if ($ibforums->member['auto_track'] == 1)
{
$db_string = $DB->compile_db_insert_string( array (
'member_id' => $ibforums->member['id'],
'topic_id' => $this->topic['tid'],
'start_date' => time(),
) );
$DB->query("INSERT INTO ibf_tracker ({$db_string['FIELD_NAMES']}) VALUES ({$db_string['FIELD_VALUES']})");
}
//---------------------------------------------------------------
// Are we tracking this forum? If so generate some mailies - yay!
//---------------------------------------------------------------
$class->forum_tracker($class->forum['id'], $this->topic['tid'], $this->topic['title'], $class->forum['name'] );
//-------------------------------------------------
// If we are a member, lets update thier last post
// date and increment their post count.
//-------------------------------------------------
$pcount = "";
if ($ibforums->member['id'])
{
if ($class->forum['inc_postcount'])
{
// Increment the users post count
$pcount = "posts=posts+1, ";
}
// Are we checking for auto promotion?
if ($ibforums->member['g_promotion'] != '-1&-1')
{
list($gid, $gposts) = explode( '&', $ibforums->member['g_promotion'] );
if ( $gid > 0 and $gposts > 0 )
{
if ( $ibforums->member['posts'] + 1 >= $gposts )
{
$mgroup = "mgroup='$gid', ";
}
}
}
$ibforums->member['last_post'] = time();
$DB->query("UPDATE ibf_members SET ".$pcount.$mgroup.
"last_post='" .$ibforums->member['last_post'] ."'".
"WHERE id='" .$ibforums->member['id']."'");
}
//-------------------------------------------------
// Redirect them back to the topic
//-------------------------------------------------
$std->boink_it($class->base_url."&act=ST&f={$class->forum['id']}&t={$this->topic['tid']}");
}
function show_form(&$class) {
global $ibforums, $std, $DB, $print, $HTTP_POST_VARS;
// Sort out the "raw" textarea input and make it safe incase
// we have a <textarea> tag in the raw post var.
$raw_post = isset($HTTP_POST_VARS['Post']) ? $HTTP_POST_VARS['Post'] : "";
$topic_title = isset($HTTP_POST_VARS['TopicTitle']) ? $ibforums->input['TopicTitle'] : "";
$topic_desc = isset($HTTP_POST_VARS['TopicDesc']) ? $ibforums->input['TopicDesc'] : "";
if (isset($raw_post))
{
$raw_post = str_replace( '$' , "&#036;" , htmlspecialchars($raw_post) );
$raw_post = stripslashes($raw_post);
}
// Do we have any posting errors?
if ($class->obj['post_errors'])
{
$class->output .= $class->html->errors( $ibforums->lang[ $class->obj['post_errors'] ]);
}
if ($class->obj['preview_post'])
{
$class->output .= $class->html->preview( $class->parser->convert( array( 'TEXT' => $this->post['post'], 'CODE' => $class->forum['use_ibc'], 'SMILIES' => $ibforums->input['enableemo'], 'HTML' => $class->forum['use_html']) ) );
}
$class->check_upload_ability();
$class->output .= $class->html_start_form( array( 1 => array( 'CODE', '01' ) ) );
//---------------------------------------
// START TABLE
//---------------------------------------
$class->output .= $class->html->table_structure();
//---------------------------------------
$topic_title = $class->html->topictitle_fields( array( TITLE => $topic_title, DESC => $topic_desc ) );
$start_table = $class->html->table_top( "{$ibforums->lang['top_txt_new']} {$class->forum['name']}");
$name_fields = $class->html_name_field();
$post_box = $class->html_post_body( $raw_post );
$mod_options = $class->mod_options();
$end_form = $class->html->EndForm( $ibforums->lang['submit_new'] );
$post_icons = $class->html_post_icons();
if ($class->obj['can_upload'])
{
$upload_field = $class->html->Upload_field( $ibforums->member['g_attach_max'] * 1024 );
}
//---------------------------------------
$class->output = preg_replace( "/<!--START TABLE-->/" , "$start_table" , $class->output );
$class->output = preg_replace( "/<!--NAME FIELDS-->/" , "$name_fields" , $class->output );
$class->output = preg_replace( "/<!--POST BOX-->/" , "$post_box" , $class->output );
$class->output = preg_replace( "/<!--POST ICONS-->/" , "$post_icons" , $class->output );
$class->output = preg_replace( "/<!--UPLOAD FIELD-->/", "$upload_field" , $class->output );
$class->output = preg_replace( "/<!--MOD OPTIONS-->/" , "$mod_options" , $class->output );
$class->output = preg_replace( "/<!--END TABLE-->/" , "$end_form" , $class->output );
$class->output = preg_replace( "/<!--TOPIC TITLE-->/" , "$topic_title" , $class->output );
//---------------------------------------
$class->html_add_smilie_box();
$this->nav = array( "<a href='{$class->base_url}&act=SC&c={$class->forum['cat_id']}'>{$class->forum['cat_name']}</a>",
"<a href='{$class->base_url}&act=SF&f={$class->forum['id']}'>{$class->forum['name']}</a>",
);
$this->title = $ibforums->lang['posting_new_topic'];
$print->add_output("$class->output");
$print->do_output( array( 'TITLE' => $ibforums->vars['board_name']." -> ".$this->title,
'JS' => 1,
'NAV' => $this->nav,
) );
}
}
?>
File diff suppressed because it is too large. Load diff
+34 -11
View File
@@ -2,10 +2,10 @@
/*
+--------------------------------------------------------------------------
| IBFORUMS v1
| Invision Board v1.1
| ========================================
| by Matthew Mecham and David Baxter
| (c) 2001,2002 IBForums
| by Matthew Mecham
| (c) 2001,2002 Invision Power Services
| http://www.ibforums.com
| ========================================
| Web: http://www.ibforums.com
@@ -226,12 +226,13 @@ class post_functions extends Post {
$db_string = $std->compile_db_string(
array (
'tid' => $this->topic['tid'],
'forum_id' => $class->forum['id'],
'start_date' => time(),
'choices' => addslashes(serialize($poll_array)),
'starter_id' => $ibforums->member['id'],
'votes' => 0,
'tid' => $this->topic['tid'],
'forum_id' => $class->forum['id'],
'start_date' => time(),
'choices' => addslashes(serialize($poll_array)),
'starter_id' => $ibforums->member['id'],
'votes' => 0,
'poll_question' => $class->parser->bad_words($ibforums->input['pollq']),
)
);
@@ -295,9 +296,24 @@ class post_functions extends Post {
}
// Are we checking for auto promotion?
if ($ibforums->member['g_promotion'] != '-1&-1')
{
list($gid, $gposts) = explode( '&', $ibforums->member['g_promotion'] );
if ( $gid > 0 and $gposts > 0 )
{
if ( $ibforums->member['posts'] + 1 >= $gposts )
{
$mgroup = "mgroup='$gid', ";
}
}
}
$ibforums->member['last_post'] = time();
$DB->query("UPDATE ibf_members SET ".$pcount.
$DB->query("UPDATE ibf_members SET ".$pcount.$mgroup.
"last_post='" .$ibforums->member['last_post'] ."'".
"WHERE id='" .$ibforums->member['id']."'");
}
@@ -350,6 +366,13 @@ class post_functions extends Post {
$class->output .= $class->html->preview( $class->parser->convert( array( 'TEXT' => $this->post['post'], 'CODE' => $class->forum['use_ibc'], 'SMILIES' => $ibforums->input['enableemo'], 'HTML' => $class->forum['use_html']) ) );
}
$extra = "";
if ($ibforums->vars['poll_tags'])
{
$extra = $ibforums->lang['poll_tag_allowed'];
}
$class->output .= $class->html_start_form( array( 1 => array( 'CODE', '11' ), 2 => array( 'f', $class->forum['id']) ) );
//---------------------------------------
@@ -370,7 +393,7 @@ class post_functions extends Post {
$mod_options = $class->mod_options();
$poll_box = $class->html->poll_box($poll);
$poll_box = $class->html->poll_box($poll, $extra);
$end_form = $class->html->EndForm( $ibforums->lang['submit_poll'] );
+488 -424
View File
@@ -1,425 +1,489 @@
<?php
/*
+--------------------------------------------------------------------------
| IBFORUMS v1
| ========================================
| by Matthew Mecham and David Baxter
| (c) 2001,2002 IBForums
| http://www.ibforums.com
| ========================================
| Web: http://www.ibforums.com
| Email: phpboards@ibforums.com
| Licence Info: phpib-licence@ibforums.com
+---------------------------------------------------------------------------
|
| > Reply with quote library
| > Module written by Matt Mecham
|
+--------------------------------------------------------------------------
*/
class post_functions extends Post {
var $nav = array();
var $title = "";
var $post = array();
var $topic = array();
var $upload = array();
var $mod_topic = array();
var $quoted_post = array();
var $quoted_post_author = array();
var $m_group = "";
function post_functions($class) {
global $ibforums, $std, $DB;
// Lets load the topic from the database before we do anything else.
$DB->query("SELECT * FROM ibf_topics WHERE forum_id='".$class->forum['id']."' AND tid='".$ibforums->input['t']."'");
$this->topic = $DB->fetch_row();
// Is it legitimate?
if (! $this->topic['tid'])
{
$std->Error( array( LEVEL => 1, MSG => 'missing_files') );
}
//-------------------------------------------------
// Lets do some tests to make sure that we are
// allowed to reply to this topic
//-------------------------------------------------
if ($this->topic['poll_state'] == 'closed' and $ibforums->member['g_is_supadmin'] != 1)
{
$std->Error( array( LEVEL => 1, MSG => 'no_replies') );
}
if ($this->topic['starter_id'] == $ibforums->member['id'])
{
if (! $ibforums->member['g_reply_own_topics'])
{
$std->Error( array( LEVEL => 1, MSG => 'no_replies') );
}
}
if ($this->topic['starter_id'] != $ibforums->member['id'])
{
if (! $ibforums->member['g_reply_own_topics'])
{
$std->Error( array( LEVEL => 1, MSG => 'no_replies') );
}
}
$this->m_group = $ibforums->member['mgroup'];
if ($class->forum['reply_perms'] != '*')
{
if (! preg_match( "/(^|,)$this->m_group(,|$)/", $class->forum['reply_perms'] ) )
{
$std->Error( array( LEVEL => 1, MSG => 'no_replies') );
}
}
// Is the topic locked?
if ($this->topic['state'] != 'open')
{
$std->Error( array( LEVEL => 1, MSG => 'locked_topic') );
}
}
function process($class) {
global $ibforums, $std, $DB, $print;
//-------------------------------------------------
// Parse the post, and check for any errors.
//-------------------------------------------------
$this->post = $class->compile_post();
//-------------------------------------------------
// If we have a post to quote, lets sort that now
//-------------------------------------------------
if ($ibforums->input['QPost']) {
$this->quoted_post['post'] = $class->parser->convert( array( 'TEXT' => $ibforums->input['QPost'],
'SMILIES' => 1,
'CODE' => 1,
'HTML' => 0,
) );
$this->quoted_post['AUTHOR']['name'] = $ibforums->input['QAuthorN'];
$this->quoted_post['DATE'] = $std->get_date( $ibforums->input['QDate'], 'LONG' );
// add it to the post
$html = $class->parser->wrap_style( array( 'STYLE' => 'QUOTE',
'EXTRA' => '(' . $this->quoted_post['AUTHOR']['name'] . ' @ ' . $this->quoted_post['DATE'] . ')'
) );
if ( $class->obj['preview_post'] == "" )
{
$this->post['post'] = "<!--QuoteBegin--{$this->quoted_post['AUTHOR']['name']}+{$this->quoted_post['DATE']}-->"
. "{$html['START']}<!--QuoteEBegin-->".trim($this->quoted_post['post'])."<!--QuoteEnd-->"
. "{$html['END']}<!--QuoteEEnd--><br>"
. $this->post['post'];
}
else
{
$class->dump_quote = '[QUOTE='.$this->quoted_post['AUTHOR']['name'].','.$this->quoted_post['DATE'].']'.$ibforums->input['QPost'].'[/QUOTE]'."\n";
}
}
if ($class->obj['post_errors'] == "") {
$this->upload = $class->process_upload();
}
if ( ($class->obj['post_errors'] != "") or ($class->obj['preview_post'] != "") ) {
// Show the form again
$this->show_form($class);
} else {
$this->add_reply($class);
}
}
function add_reply($class) {
global $ibforums, $std, $DB, $print;
//-------------------------------------------------
// Update the post info with the upload array info
//-------------------------------------------------
$this->post['attach_id'] = $this->upload['attach_id'];
$this->post['attach_type'] = $this->upload['attach_type'];
$this->post['attach_hits'] = $this->upload['attach_hits'];
$this->post['attach_file'] = $this->upload['attach_file'];
//-------------------------------------------------
// Insert the post into the database to get the
// last inserted value of the auto_increment field
//-------------------------------------------------
$this->post['topic_id'] = $this->topic['tid'];
if ( ($ibforums->input['mod_options'] != "") or ($ibforums->input['mod_options'] != 'nowt') )
{
if ($ibforums->input['mod_options'] == 'pin')
{
if ($ibforums->member['g_is_supmod'] == 1 or $class->moderator['pin_topic'] == 1)
{
$this->topic['pinned'] = 1;
$class->moderate_log('Pinned topic from post form', $this->topic['title']);
}
}
else if ($ibforums->input['mod_options'] == 'close')
{
if ($ibforums->member['g_is_supmod'] == 1 or $class->moderator['close_topic'] == 1)
{
$this->topic['state'] = 'closed';
$class->moderate_log('Closed topic from post form', $this->topic['title']);
}
}
}
$db_string = $std->compile_db_string( $this->post );
$DB->query("INSERT INTO ibf_posts (" .$db_string['FIELD_NAMES']. ") VALUES (". $db_string['FIELD_VALUES'] .")");
$this->post['pid'] = $DB->get_insert_id();
if ($class->obj['moderate']) {
$print->redirect_screen( $ibforums->lang['moderate_post'], "act=ST&f={$class->forum['id']}&t={$this->topic['tid']}" );
}
//-------------------------------------------------
// If we are still here, lets update the
// board/forum/topic stats
//-------------------------------------------------
$class->forum['last_title'] = $this->topic['title'];
$class->forum['last_id'] = $this->topic['tid'];
$class->forum['last_post'] = time();
$class->forum['last_poster_name'] = $ibforums->member['id'] ? $ibforums->member['name'] : $ibforums->input['UserName'];
$class->forum['last_poster_id'] = $ibforums->member['id'];
$class->forum['posts']++;
if (strlen($class->forum['last_title']) > 30)
{
$class->forum['last_title'] = substr($class->forum['last_title'],0,27) . "...";
}
// Update the database
$DB->query("UPDATE ibf_forums SET last_title='" .$class->forum['last_title'] ."', ".
"last_id='" .$class->forum['last_id'] ."', ".
"last_post='" .$class->forum['last_post'] ."', ".
"last_poster_name='".$class->forum['last_poster_name'] ."', ".
"last_poster_id='" .$class->forum['last_poster_id'] ."', ".
"posts='" .$class->forum['posts'] ."' ".
"WHERE id='" .$class->forum['id'] ."'");
// Update the database
//+------------------------------------------------------------------------------------------------------
$DB->query("UPDATE ibf_topics SET last_poster_id='" .$class->forum['last_poster_id'] ."', ".
"last_poster_name='" .$class->forum['last_poster_name'] ."', ".
"last_post='" .$class->forum['last_post'] ."', ".
"pinned='" .$this->topic['pinned'] ."', ".
"state='" .$this->topic['state'] ."', ".
"posts=posts+1 ".
"WHERE tid='" .$this->topic['tid'] ."'");
//+------------------------------------------------------------------------------------------------------
$DB->query("UPDATE ibf_stats SET TOTAL_REPLIES=TOTAL_REPLIES+1");
//-------------------------------------------------
// If we are a member, lets update thier last post
// date and increment their post count.
//-------------------------------------------------
$pcount = "";
if ($ibforums->member['id'])
{
if ($class->forum['inc_postcount'])
{
// Increment the users post count
$pcount = "posts=posts+1, ";
}
$ibforums->member['last_post'] = time();
$DB->query("UPDATE ibf_members SET ".$pcount.
"last_post='" .$ibforums->member['last_post'] ."'".
"WHERE id='" .$ibforums->member['id']."'");
}
//-------------------------------------------------
// Check for subscribed topics
//-------------------------------------------------
$class->topic_tracker( $this->topic['tid'], $this->post['post'], $class->forum['last_poster_name'] );
//-------------------------------------------------
// Redirect them back to the topic
//-------------------------------------------------
$page = floor( ($this->topic['posts'] + 1) / $ibforums->vars['display_max_posts']);
$page = $page * $ibforums->vars['display_max_posts'];
$std->boink_it($class->base_url."&act=ST&f={$class->forum['id']}&t={$this->topic['tid']}&st=$page#entry{$this->post['pid']}");
}
function show_form($class) {
global $ibforums, $std, $DB, $print, $HTTP_POST_VARS;
//-------------------------------------------------
// Sort out the "raw" textarea input and make it safe incase
// we have a <textarea> tag in the raw post var.
//-------------------------------------------------
$raw_post = isset($HTTP_POST_VARS['Post']) ? $HTTP_POST_VARS['Post'] : "";
if (isset($raw_post)) {
$raw_post = preg_replace( "/<textarea>/", "&lt;textarea>", $raw_post );
$raw_post = str_replace( '$', "&#036;", $raw_post );
$raw_post = str_replace( '<%', "&lt;%" , $raw_post );
$raw_post = stripslashes($raw_post);
if ($class->dump_quote != "")
{
$raw_post = str_replace( "<br>", "\n", $class->dump_quote ) . $raw_post;
}
}
//-------------------------------------------------
// Get the old post
//-------------------------------------------------
$DB->query("SELECT post, author_id, author_name, post_date, pid FROM ibf_posts WHERE pid='".$ibforums->input['p']."'");
$this->quoted_post = $DB->fetch_row();
//-------------------------------------------------
// Unconvert the smilies, HTML and iB_Code
//-------------------------------------------------
$this->quoted_post['post'] = trim($class->parser->unconvert( $this->quoted_post['post'] ));
//-------------------------------------------------
// Do we have any posting errors?
//-------------------------------------------------
if ($class->obj['post_errors'])
{
$class->output .= $class->html->errors( $ibforums->lang[ $class->obj['post_errors'] ]);
}
if ($class->obj['preview_post'])
{
$class->output .= $class->html->preview( $class->parser->convert( array( 'TEXT' => $class->dump_quote . $this->post['post'], 'CODE' => $class->forum['use_ibc'], 'SMILIES' => $ibforums->input['enableemo'], 'HTML' => $class->forum['use_html']) ) );
}
$class->check_upload_ability();
$class->output .= $class->html_start_form( array( 1 => array( 'CODE', '07' ),
2 => array( 't' , $this->topic['tid']),
3 => array( 'p' , $ibforums->input['p'] )
) );
//---------------------------------------
// START TABLE
//---------------------------------------
$class->output .= $class->html->table_structure();
//---------------------------------------
$start_table = $class->html->table_top( "{$ibforums->lang['top_txt_reply']} {$this->topic['title']}");
$name_fields = $class->html_name_field();
if (! $class->obj['preview_post'])
{
$quote_box = $class->html->quote_box( $this->quoted_post );
}
$post_box = $class->html_post_body( $raw_post );
$mod_options = $class->mod_options();
$end_form = $class->html->EndForm( $ibforums->lang['submit_reply'] );
$post_icons = $class->html_post_icons();
if ($class->obj['can_upload'])
{
$upload_field = $class->html->Upload_field( $ibforums->member['g_attach_max'] * 1024 );
}
//---------------------------------------
$class->output = preg_replace( "/<!--START TABLE-->/" , "$start_table" , $class->output );
$class->output = preg_replace( "/<!--NAME FIELDS-->/" , "$name_fields" , $class->output );
$class->output = preg_replace( "/<!--POST BOX-->/" , "$post_box" , $class->output );
$class->output = preg_replace( "/<!--POST ICONS-->/" , "$post_icons" , $class->output );
$class->output = preg_replace( "/<!--UPLOAD FIELD-->/", "$upload_field" , $class->output );
$class->output = preg_replace( "/<!--MOD OPTIONS-->/" , "$mod_options" , $class->output );
$class->output = preg_replace( "/<!--END TABLE-->/" , "$end_form" , $class->output );
$class->output = preg_replace( "/<!--QUOTE BOX-->/" , "$quote_box" , $class->output );
//---------------------------------------
$class->html_add_smilie_box();
$class->html_topic_summary($this->topic['tid']);
$this->nav = array( "<a href='{$class->base_url}&act=SC&c={$class->forum[cat_id]}'>{$class->forum['cat_name']}</a>",
"<a href='{$class->base_url}&act=SF&f={$class->forum['id']}'>{$class->forum['name']}</a>",
"<a href='{$class->base_url}&act=ST&f={$class->forum['id']}&t={$this->topic['tid']}'>{$this->topic['title']}</a>",
);
$this->title = $ibforums->lang['quoting_post'].' '.$this->topic['title'];
$print->add_output("$class->output");
$print->do_output( array( 'TITLE' => $ibforums->vars['board_name']." -> ".$this->title,
'JS' => 1,
'NAV' => $this->nav,
) );
}
}
<?php
/*
+--------------------------------------------------------------------------
| Invision Board v1.1
| ========================================
| by Matthew Mecham
| (c) 2001,2002 Invision Power Services
| http://www.ibforums.com
| ========================================
| Web: http://www.ibforums.com
| Email: phpboards@ibforums.com
| Licence Info: phpib-licence@ibforums.com
+---------------------------------------------------------------------------
|
| > Reply with quote library
| > Module written by Matt Mecham
|
+--------------------------------------------------------------------------
*/
class post_functions extends Post {
var $nav = array();
var $title = "";
var $post = array();
var $topic = array();
var $upload = array();
var $mod_topic = array();
var $quoted_post = array();
var $quoted_post_author = array();
var $m_group = "";
function post_functions($class) {
global $ibforums, $std, $DB;
// Lets load the topic from the database before we do anything else.
$DB->query("SELECT * FROM ibf_topics WHERE forum_id='".$class->forum['id']."' AND tid='".$ibforums->input['t']."'");
$this->topic = $DB->fetch_row();
// Is it legitimate?
if (! $this->topic['tid'])
{
$std->Error( array( LEVEL => 1, MSG => 'missing_files') );
}
//-------------------------------------------------
// Lets do some tests to make sure that we are
// allowed to reply to this topic
//-------------------------------------------------
if ($this->topic['poll_state'] == 'closed' and $ibforums->member['g_is_supadmin'] != 1)
{
$std->Error( array( LEVEL => 1, MSG => 'no_replies') );
}
if ($this->topic['starter_id'] == $ibforums->member['id'])
{
if (! $ibforums->member['g_reply_own_topics'])
{
$std->Error( array( LEVEL => 1, MSG => 'no_replies') );
}
}
if ($this->topic['starter_id'] != $ibforums->member['id'])
{
if (! $ibforums->member['g_reply_own_topics'])
{
$std->Error( array( LEVEL => 1, MSG => 'no_replies') );
}
}
$this->m_group = $ibforums->member['mgroup'];
if ($class->forum['reply_perms'] != '*')
{
if (! preg_match( "/(^|,)$this->m_group(,|$)/", $class->forum['reply_perms'] ) )
{
$std->Error( array( LEVEL => 1, MSG => 'no_replies') );
}
}
// Is the topic locked?
if ($this->topic['state'] != 'open')
{
if ($ibforums->member['g_post_closed'] != 1)
{
$std->Error( array( LEVEL => 1, MSG => 'locked_topic') );
}
}
}
function process($class) {
global $ibforums, $std, $DB, $print;
//-------------------------------------------------
// Parse the post, and check for any errors.
//-------------------------------------------------
$this->post = $class->compile_post();
//-------------------------------------------------
// If we have a post to quote, lets sort that now
//-------------------------------------------------
if ($ibforums->input['QPost'])
{
$this->quoted_post['post'] = $class->parser->convert( array( 'TEXT' => $ibforums->input['QPost'],
'SMILIES' => 1,
'CODE' => 1,
'HTML' => 0,
) );
$this->quoted_post['AUTHOR']['name'] = $ibforums->input['QAuthorN'];
$this->quoted_post['DATE'] = $std->get_date( $ibforums->input['QDate'], 'LONG' );
// add it to the post
$html = $class->parser->wrap_style( array( 'STYLE' => 'QUOTE',
'EXTRA' => '(' . $this->quoted_post['AUTHOR']['name'] . ' @ ' . $this->quoted_post['DATE'] . ')'
) );
if ( $class->obj['preview_post'] == "" )
{
$this->post['post'] = "<!--QuoteBegin--{$this->quoted_post['AUTHOR']['name']}+{$this->quoted_post['DATE']}-->"
. "{$html['START']}<!--QuoteEBegin-->".trim($this->quoted_post['post'])."<!--QuoteEnd-->"
. "{$html['END']}<!--QuoteEEnd--><br>"
. $this->post['post'];
}
else
{
$class->dump_quote = '[QUOTE='.$this->quoted_post['AUTHOR']['name'].','.$this->quoted_post['DATE'].']'.$ibforums->input['QPost'].'[/QUOTE]'."\n";
}
}
if ($class->obj['post_errors'] == "") {
$this->upload = $class->process_upload();
}
if ( ($class->obj['post_errors'] != "") or ($class->obj['preview_post'] != "") ) {
// Show the form again
$this->show_form($class);
} else {
$this->add_reply($class);
}
}
function add_reply($class) {
global $ibforums, $std, $DB, $print;
//-------------------------------------------------
// Update the post info with the upload array info
//-------------------------------------------------
$this->post['attach_id'] = $this->upload['attach_id'];
$this->post['attach_type'] = $this->upload['attach_type'];
$this->post['attach_hits'] = $this->upload['attach_hits'];
$this->post['attach_file'] = $this->upload['attach_file'];
//-------------------------------------------------
// Insert the post into the database to get the
// last inserted value of the auto_increment field
//-------------------------------------------------
$this->post['topic_id'] = $this->topic['tid'];
$return_to_move = 0;
if ( ($ibforums->input['mod_options'] != "") or ($ibforums->input['mod_options'] != 'nowt') )
{
if ($ibforums->input['mod_options'] == 'pin')
{
if ($ibforums->member['g_is_supmod'] == 1 or $class->moderator['pin_topic'] == 1)
{
$this->topic['pinned'] = 1;
$class->moderate_log('Pinned topic from post form', $this->topic['title']);
}
}
else if ($ibforums->input['mod_options'] == 'close')
{
if ($ibforums->member['g_is_supmod'] == 1 or $class->moderator['close_topic'] == 1)
{
$this->topic['state'] = 'closed';
$class->moderate_log('Closed topic from post form', $this->topic['title']);
}
}
else if ($ibforums->input['mod_options'] == 'move')
{
if ($ibforums->member['g_is_supmod'] == 1 or $class->moderator['move_topic'] == 1)
{
$return_to_move = 1;
}
}
}
$db_string = $std->compile_db_string( $this->post );
$DB->query("INSERT INTO ibf_posts (" .$db_string['FIELD_NAMES']. ") VALUES (". $db_string['FIELD_VALUES'] .")");
$this->post['pid'] = $DB->get_insert_id();
if ($class->obj['moderate']) {
$print->redirect_screen( $ibforums->lang['moderate_post'], "act=ST&f={$class->forum['id']}&t={$this->topic['tid']}" );
}
//-------------------------------------------------
// If we are still here, lets update the
// board/forum/topic stats
//-------------------------------------------------
$class->forum['last_title'] = $this->topic['title'];
$class->forum['last_id'] = $this->topic['tid'];
$class->forum['last_post'] = time();
$class->forum['last_poster_name'] = $ibforums->member['id'] ? $ibforums->member['name'] : $ibforums->input['UserName'];
$class->forum['last_poster_id'] = $ibforums->member['id'];
$class->forum['posts']++;
if (strlen($class->forum['last_title']) > 30)
{
$class->forum['last_title'] = substr($class->forum['last_title'],0,27) . "...";
}
// Update the database
$DB->query("UPDATE ibf_forums SET last_title='" .$class->forum['last_title'] ."', ".
"last_id='" .$class->forum['last_id'] ."', ".
"last_post='" .$class->forum['last_post'] ."', ".
"last_poster_name='".$class->forum['last_poster_name'] ."', ".
"last_poster_id='" .$class->forum['last_poster_id'] ."', ".
"posts='" .$class->forum['posts'] ."' ".
"WHERE id='" .$class->forum['id'] ."'");
// Update the database
//+------------------------------------------------------------------------------------------------------
$DB->query("UPDATE ibf_topics SET last_poster_id='" .$class->forum['last_poster_id'] ."', ".
"last_poster_name='" .$class->forum['last_poster_name'] ."', ".
"last_post='" .$class->forum['last_post'] ."', ".
"pinned='" .$this->topic['pinned'] ."', ".
"state='" .$this->topic['state'] ."', ".
"posts=posts+1 ".
"WHERE tid='" .$this->topic['tid'] ."'");
//+------------------------------------------------------------------------------------------------------
$DB->query("UPDATE ibf_stats SET TOTAL_REPLIES=TOTAL_REPLIES+1");
//-------------------------------------------------
// If we are a member, lets update thier last post
// date and increment their post count.
//-------------------------------------------------
$pcount = "";
if ($ibforums->member['id'])
{
if ($class->forum['inc_postcount'])
{
// Increment the users post count
$pcount = "posts=posts+1, ";
}
// Are we checking for auto promotion?
if ($ibforums->member['g_promotion'] != '-1&-1')
{
list($gid, $gposts) = explode( '&', $ibforums->member['g_promotion'] );
if ( $gid > 0 and $gposts > 0 )
{
if ( $ibforums->member['posts'] + 1 >= $gposts )
{
$mgroup = "mgroup='$gid', ";
}
}
}
$ibforums->member['last_post'] = time();
$DB->query("UPDATE ibf_members SET ".$pcount.$mgroup.
"last_post='" .$ibforums->member['last_post'] ."'".
"WHERE id='" .$ibforums->member['id']."'");
}
//-------------------------------------------------
// Are we tracking topics we reply in 'auto_track'?
//-------------------------------------------------
if ($ibforums->member['auto_track'] == 1)
{
$DB->query("SELECT trid FROM ibf_tracker WHERE topic_id='".$this->topic['tid']."' AND member_id='".$ibforums->member['id']."'");
if ( ! $DB->get_num_rows() )
{
$db_string = $DB->compile_db_insert_string( array (
'member_id' => $ibforums->member['id'],
'topic_id' => $this->topic['tid'],
'start_date' => time(),
) );
$DB->query("INSERT INTO ibf_tracker ({$db_string['FIELD_NAMES']}) VALUES ({$db_string['FIELD_VALUES']})");
}
}
//-------------------------------------------------
// Check for subscribed topics
// Pass on the previous last post time of the topic
// to see if we need to send emails out
//-------------------------------------------------
$class->topic_tracker( $this->topic['tid'], $this->post['post'], $class->forum['last_poster_name'], $this->topic['last_post'] );
//-------------------------------------------------
// Redirect them back to the topic
//-------------------------------------------------
if ($return_to_move == 1)
{
$std->boink_it($class->base_url."&act=Mod&CODE=02&f={$class->forum['id']}&t={$this->topic['tid']}");
}
else
{
$page = floor( ($this->topic['posts'] + 1) / $ibforums->vars['display_max_posts']);
$page = $page * $ibforums->vars['display_max_posts'];
$std->boink_it($class->base_url."&act=ST&f={$class->forum['id']}&t={$this->topic['tid']}&st=$page&#entry{$this->post['pid']}");
}
}
function show_form($class) {
global $ibforums, $std, $DB, $print, $HTTP_POST_VARS;
//-------------------------------------------------
// Sort out the "raw" textarea input and make it safe incase
// we have a <textarea> tag in the raw post var.
//-------------------------------------------------
$raw_post = isset($HTTP_POST_VARS['Post']) ? $HTTP_POST_VARS['Post'] : "";
if (isset($raw_post)) {
$raw_post = str_replace( '$' , "&#036;" , htmlspecialchars($raw_post) );
$raw_post = stripslashes($raw_post);
if ($class->dump_quote != "")
{
$raw_post = str_replace( "<br>", "\n", $class->dump_quote ) . $raw_post;
}
}
//-------------------------------------------------
// Get the old post
//-------------------------------------------------
$DB->query("SELECT post, author_id, author_name, post_date, pid FROM ibf_posts WHERE pid='".$ibforums->input['p']."'");
$this->quoted_post = $DB->fetch_row();
//-------------------------------------------------
// Unconvert the smilies, HTML and iB_Code
//-------------------------------------------------
$this->quoted_post['post'] = trim($class->parser->unconvert( $this->quoted_post['post'] ));
//-------------------------------------------------
// Are we stripping quotes?
//-------------------------------------------------
if ($ibforums->vars['strip_quotes'])
{
$this->quoted_post['post'] = preg_replace( "#\[QUOTE(=.+?,.+?)?\].+?\[/QUOTE\]#i", "", $this->quoted_post['post'] );
}
//-------------------------------------------------
// Do we have any posting errors?
//-------------------------------------------------
if ($class->obj['post_errors'])
{
$class->output .= $class->html->errors( $ibforums->lang[ $class->obj['post_errors'] ]);
}
if ($class->obj['preview_post'])
{
$class->output .= $class->html->preview( $class->parser->convert( array( 'TEXT' => $class->dump_quote . $this->post['post'], 'CODE' => $class->forum['use_ibc'], 'SMILIES' => $ibforums->input['enableemo'], 'HTML' => $class->forum['use_html']) ) );
}
$class->check_upload_ability();
$class->output .= $class->html_start_form( array( 1 => array( 'CODE', '07' ),
2 => array( 't' , $this->topic['tid']),
3 => array( 'p' , $ibforums->input['p'] )
) );
//---------------------------------------
// START TABLE
//---------------------------------------
$class->output .= $class->html->table_structure();
//---------------------------------------
$start_table = $class->html->table_top( "{$ibforums->lang['top_txt_reply']} {$this->topic['title']}");
$name_fields = $class->html_name_field();
if (! $class->obj['preview_post'])
{
$quote_box = $class->html->quote_box( $this->quoted_post );
}
$post_box = $class->html_post_body( $raw_post );
$mod_options = $class->mod_options(1);
$end_form = $class->html->EndForm( $ibforums->lang['submit_reply'] );
$post_icons = $class->html_post_icons();
if ($class->obj['can_upload'])
{
$upload_field = $class->html->Upload_field( $ibforums->member['g_attach_max'] * 1024 );
}
//---------------------------------------
$class->output = preg_replace( "/<!--START TABLE-->/" , "$start_table" , $class->output );
$class->output = preg_replace( "/<!--NAME FIELDS-->/" , "$name_fields" , $class->output );
$class->output = preg_replace( "/<!--POST BOX-->/" , "$post_box" , $class->output );
$class->output = preg_replace( "/<!--POST ICONS-->/" , "$post_icons" , $class->output );
$class->output = preg_replace( "/<!--UPLOAD FIELD-->/", "$upload_field" , $class->output );
$class->output = preg_replace( "/<!--MOD OPTIONS-->/" , "$mod_options" , $class->output );
$class->output = preg_replace( "/<!--END TABLE-->/" , "$end_form" , $class->output );
$class->output = preg_replace( "/<!--QUOTE BOX-->/" , "$quote_box" , $class->output );
//---------------------------------------
$class->html_add_smilie_box();
$class->html_topic_summary($this->topic['tid']);
$this->nav = array( "<a href='{$class->base_url}&act=SC&c={$class->forum[cat_id]}'>{$class->forum['cat_name']}</a>",
"<a href='{$class->base_url}&act=SF&f={$class->forum['id']}'>{$class->forum['name']}</a>",
"<a href='{$class->base_url}&act=ST&f={$class->forum['id']}&t={$this->topic['tid']}'>{$this->topic['title']}</a>",
);
$this->title = $ibforums->lang['quoting_post'].' '.$this->topic['title'];
$print->add_output("$class->output");
$print->do_output( array( 'TITLE' => $ibforums->vars['board_name']." -> ".$this->title,
'JS' => 1,
'NAV' => $this->nav,
) );
}
}
?>
+411 -359
View File
@@ -1,360 +1,412 @@
<?php
/*
+--------------------------------------------------------------------------
| IBFORUMS v1
| ========================================
| by Matthew Mecham and David Baxter
| (c) 2001,2002 IBForums
| http://www.ibforums.com
| ========================================
| Web: http://www.ibforums.com
| Email: phpboards@ibforums.com
| Licence Info: phpib-licence@ibforums.com
+---------------------------------------------------------------------------
|
| > Reply post module
| > Module written by Matt Mecham
|
+--------------------------------------------------------------------------
*/
class post_functions extends Post {
var $nav = array();
var $title = "";
var $post = array();
var $topic = array();
var $upload = array();
var $mod_topic = array();
var $m_group = "";
function post_functions($class) {
global $ibforums, $std, $DB;
// Lets load the topic from the database before we do anything else.
$DB->query("SELECT * FROM ibf_topics WHERE forum_id='".$class->forum['id']."' AND tid='".$ibforums->input['t']."'");
$this->topic = $DB->fetch_row();
// Is it legitimate?
if (! $this->topic['tid'])
{
$std->Error( array( LEVEL => 1, MSG => 'missing_files') );
}
//-------------------------------------------------
// Lets do some tests to make sure that we are
// allowed to reply to this topic
//-------------------------------------------------
if ($this->topic['poll_state'] == 'closed' and $ibforums->member['g_is_supadmin'] != 1)
{
$std->Error( array( LEVEL => 1, MSG => 'no_replies') );
}
if ($this->topic['starter_id'] == $ibforums->member['id'])
{
if (! $ibforums->member['g_reply_own_topics'])
{
$std->Error( array( LEVEL => 1, MSG => 'no_replies') );
}
}
if ($this->topic['starter_id'] != $ibforums->member['id'])
{
if (! $ibforums->member['g_reply_own_topics'])
{
$std->Error( array( LEVEL => 1, MSG => 'no_replies') );
}
}
$this->m_group = $ibforums->member['mgroup'];
if ($class->forum['reply_perms'] != '*')
{
if (! preg_match( "/(^|,)$this->m_group(,|$)/", $class->forum['reply_perms'] ) )
{
$std->Error( array( LEVEL => 1, MSG => 'no_replies') );
}
}
// Is the topic locked?
if ($this->topic['state'] != 'open')
{
$std->Error( array( LEVEL => 1, MSG => 'locked_topic') );
}
}
function process($class) {
global $ibforums, $std, $DB, $print;
//-------------------------------------------------
// Parse the post, and check for any errors.
//-------------------------------------------------
$this->post = $class->compile_post();
if ($class->obj['post_errors'] == "")
{
$this->upload = $class->process_upload();
}
if ( ($class->obj['post_errors'] != "") or ($class->obj['preview_post'] != "") )
{
// Show the form again
$this->show_form($class);
}
else
{
$this->add_reply($class);
}
}
function add_reply($class) {
global $ibforums, $std, $DB, $print;
//-------------------------------------------------
// Update the post info with the upload array info
//-------------------------------------------------
$this->post['attach_id'] = $this->upload['attach_id'];
$this->post['attach_type'] = $this->upload['attach_type'];
$this->post['attach_hits'] = $this->upload['attach_hits'];
$this->post['attach_file'] = $this->upload['attach_file'];
//-------------------------------------------------
// Insert the post into the database to get the
// last inserted value of the auto_increment field
//-------------------------------------------------
$this->post['topic_id'] = $this->topic['tid'];
//-------------------------------------------------
// Are we a mod, and can we change the topic state?
//-------------------------------------------------
if ( ($ibforums->input['mod_options'] != "") or ($ibforums->input['mod_options'] != 'nowt') )
{
if ($ibforums->input['mod_options'] == 'pin')
{
if ($ibforums->member['g_is_supmod'] == 1 or $class->moderator['pin_topic'] == 1)
{
$this->topic['pinned'] = 1;
$class->moderate_log('Pinned topic from post form', $this->topic['title']);
}
}
else if ($ibforums->input['mod_options'] == 'close')
{
if ($ibforums->member['g_is_supmod'] == 1 or $class->moderator['close_topic'] == 1)
{
$this->topic['state'] = 'closed';
$class->moderate_log('Closed topic from post form', $this->topic['title']);
}
}
}
$db_string = $std->compile_db_string( $this->post );
$DB->query("INSERT INTO ibf_posts (" .$db_string['FIELD_NAMES']. ") VALUES (". $db_string['FIELD_VALUES'] .")");
$this->post['pid'] = $DB->get_insert_id();
if ($class->obj['moderate']) {
$print->redirect_screen( $ibforums->lang['moderate_post'], "act=ST&f={$class->forum['id']}&t={$this->topic['tid']}" );
}
//-------------------------------------------------
// If we are still here, lets update the
// board/forum/topic stats
//-------------------------------------------------
$class->forum['last_title'] = $this->topic['title'];
$class->forum['last_id'] = $this->topic['tid'];
$class->forum['last_post'] = time();
$class->forum['last_poster_name'] = $ibforums->member['id'] ? $ibforums->member['name'] : $ibforums->input['UserName'];
$class->forum['last_poster_id'] = $ibforums->member['id'];
$class->forum['posts']++;
// Update the database
$DB->query("UPDATE ibf_forums SET last_title='" .$class->forum['last_title'] ."', ".
"last_id='" .$class->forum['last_id'] ."', ".
"last_post='" .$class->forum['last_post'] ."', ".
"last_poster_name='".$class->forum['last_poster_name'] ."', ".
"last_poster_id='" .$class->forum['last_poster_id'] ."', ".
"posts='" .$class->forum['posts'] ."' ".
"WHERE id='" .$class->forum['id'] ."'");
// Update the database
//+------------------------------------------------------------------------------------------------------
$DB->query("UPDATE ibf_topics SET last_poster_id='" .$class->forum['last_poster_id'] ."', ".
"last_poster_name='" .$class->forum['last_poster_name'] ."', ".
"last_post='" .$class->forum['last_post'] ."', ".
"pinned='" .$this->topic['pinned'] ."', ".
"state='" .$this->topic['state'] ."', ".
"posts=posts+1 ".
"WHERE tid='" .$this->topic['tid'] ."'");
//+------------------------------------------------------------------------------------------------------
$DB->query("UPDATE ibf_stats SET TOTAL_REPLIES=TOTAL_REPLIES+1");
//-------------------------------------------------
// If we are a member, lets update thier last post
// date and increment their post count.
//-------------------------------------------------
$pcount = "";
if ($ibforums->member['id'])
{
if ($class->forum['inc_postcount'])
{
// Increment the users post count
$pcount = "posts=posts+1, ";
}
$ibforums->member['last_post'] = time();
$DB->query("UPDATE ibf_members SET ".$pcount.
"last_post='" .$ibforums->member['last_post'] ."'".
"WHERE id='" .$ibforums->member['id']."'");
}
//-------------------------------------------------
// Check for subscribed topics
//-------------------------------------------------
$class->topic_tracker( $this->topic['tid'], $this->post['post'], $class->forum['last_poster_name'] );
//-------------------------------------------------
// Redirect them back to the topic
//-------------------------------------------------
$page = floor( ($this->topic['posts'] + 1) / $ibforums->vars['display_max_posts']);
$page = $page * $ibforums->vars['display_max_posts'];
$std->boink_it($class->base_url."&act=ST&f={$class->forum['id']}&t={$this->topic['tid']}&st=$page&#entry{$this->post['pid']}");
}
function show_form($class) {
global $ibforums, $std, $DB, $print, $HTTP_POST_VARS;
// Sort out the "raw" textarea input and make it safe incase
// we have a <textarea> tag in the raw post var.
$raw_post = isset($HTTP_POST_VARS['Post']) ? $HTTP_POST_VARS['Post'] : "";
if (isset($raw_post)) {
$raw_post = preg_replace( "/<textarea>/", "&lt;textarea>", $raw_post );
$raw_post = str_replace( '$', "&#036;", $raw_post );
$raw_post = str_replace( '<%', "&lt;%" , $raw_post );
$raw_post = stripslashes($raw_post);
}
// Do we have any posting errors?
if ($class->obj['post_errors']) {
$class->output .= $class->html->errors( $ibforums->lang[ $class->obj['post_errors'] ]);
}
if ($class->obj['preview_post']) {
$class->output .= $class->html->preview( $class->parser->convert( array( 'TEXT' => $this->post['post'], 'CODE' => $class->forum['use_ibc'], 'SMILIES' => $ibforums->input['enableemo'], 'HTML' => $class->forum['use_html']) ) );
}
$class->check_upload_ability();
$class->output .= $class->html_start_form( array( 1 => array( 'CODE', '03' ),
2 => array( 't' , $this->topic['tid'])
) );
//---------------------------------------
// START TABLE
//---------------------------------------
$class->output .= $class->html->table_structure();
//---------------------------------------
$start_table = $class->html->table_top( "{$ibforums->lang['top_txt_reply']} {$this->topic['title']}");
$name_fields = $class->html_name_field();
$post_box = $class->html_post_body( $raw_post );
$mod_options = $class->mod_options();
$end_form = $class->html->EndForm( $ibforums->lang['submit_reply'] );
$post_icons = $class->html_post_icons();
if ($class->obj['can_upload'])
{
$upload_field = $class->html->Upload_field( $ibforums->member['g_attach_max'] * 1024 );
}
//---------------------------------------
$class->output = preg_replace( "/<!--START TABLE-->/" , "$start_table" , $class->output );
$class->output = preg_replace( "/<!--NAME FIELDS-->/" , "$name_fields" , $class->output );
$class->output = preg_replace( "/<!--POST BOX-->/" , "$post_box" , $class->output );
$class->output = preg_replace( "/<!--POST ICONS-->/" , "$post_icons" , $class->output );
$class->output = preg_replace( "/<!--UPLOAD FIELD-->/", "$upload_field" , $class->output );
$class->output = preg_replace( "/<!--MOD OPTIONS-->/" , "$mod_options" , $class->output );
$class->output = preg_replace( "/<!--END TABLE-->/" , "$end_form" , $class->output );
//---------------------------------------
$class->html_add_smilie_box();
$class->html_topic_summary($this->topic['tid']);
$this->nav = array( "<a href='{$class->base_url}&act=SC&c={$class->forum[cat_id]}'>{$class->forum['cat_name']}</a>",
"<a href='{$class->base_url}&act=SF&f={$class->forum['id']}'>{$class->forum['name']}</a>",
"<a href='{$class->base_url}&act=ST&f={$class->forum['id']}&t={$this->topic['tid']}'>{$this->topic['title']}</a>",
);
$this->title = $ibforums->lang['replying_in'].' '.$this->topic['title'];
$print->add_output("$class->output");
$print->do_output( array( 'TITLE' => $ibforums->vars['board_name']." -> ".$this->title,
'JS' => 1,
'NAV' => $this->nav,
) );
}
}
<?php
/*
+--------------------------------------------------------------------------
| Invision Board v1.1
| ========================================
| by Matthew Mecham
| (c) 2001,2002 Invision Power Services
| http://www.ibforums.com
| ========================================
| Web: http://www.ibforums.com
| Email: phpboards@ibforums.com
| Licence Info: phpib-licence@ibforums.com
+---------------------------------------------------------------------------
|
| > Reply post module
| > Module written by Matt Mecham
|
+--------------------------------------------------------------------------
*/
class post_functions extends Post {
var $nav = array();
var $title = "";
var $post = array();
var $topic = array();
var $upload = array();
var $mod_topic = array();
var $m_group = "";
function post_functions($class) {
global $ibforums, $std, $DB;
// Lets load the topic from the database before we do anything else.
$DB->query("SELECT * FROM ibf_topics WHERE forum_id='".$class->forum['id']."' AND tid='".$ibforums->input['t']."'");
$this->topic = $DB->fetch_row();
// Is it legitimate?
if (! $this->topic['tid'])
{
$std->Error( array( LEVEL => 1, MSG => 'missing_files') );
}
//-------------------------------------------------
// Lets do some tests to make sure that we are
// allowed to reply to this topic
//-------------------------------------------------
if ($this->topic['poll_state'] == 'closed' and $ibforums->member['g_is_supadmin'] != 1)
{
$std->Error( array( LEVEL => 1, MSG => 'no_replies') );
}
if ($this->topic['starter_id'] == $ibforums->member['id'])
{
if (! $ibforums->member['g_reply_own_topics'])
{
$std->Error( array( LEVEL => 1, MSG => 'no_replies') );
}
}
if ($this->topic['starter_id'] != $ibforums->member['id'])
{
if (! $ibforums->member['g_reply_own_topics'])
{
$std->Error( array( LEVEL => 1, MSG => 'no_replies') );
}
}
$this->m_group = $ibforums->member['mgroup'];
if ($class->forum['reply_perms'] != '*')
{
if (! preg_match( "/(^|,)$this->m_group(,|$)/", $class->forum['reply_perms'] ) )
{
$std->Error( array( LEVEL => 1, MSG => 'no_replies') );
}
}
// Is the topic locked?
if ($this->topic['state'] != 'open')
{
if ($ibforums->member['g_post_closed'] != 1)
{
$std->Error( array( LEVEL => 1, MSG => 'locked_topic') );
}
}
}
function process($class) {
global $ibforums, $std, $DB, $print;
//-------------------------------------------------
// Parse the post, and check for any errors.
//-------------------------------------------------
$this->post = $class->compile_post();
if ($class->obj['post_errors'] == "")
{
$this->upload = $class->process_upload();
}
if ( ($class->obj['post_errors'] != "") or ($class->obj['preview_post'] != "") )
{
// Show the form again
$this->show_form($class);
}
else
{
$this->add_reply($class);
}
}
function add_reply($class) {
global $ibforums, $std, $DB, $print;
//-------------------------------------------------
// Update the post info with the upload array info
//-------------------------------------------------
$this->post['attach_id'] = $this->upload['attach_id'];
$this->post['attach_type'] = $this->upload['attach_type'];
$this->post['attach_hits'] = $this->upload['attach_hits'];
$this->post['attach_file'] = $this->upload['attach_file'];
//-------------------------------------------------
// Insert the post into the database to get the
// last inserted value of the auto_increment field
//-------------------------------------------------
$this->post['topic_id'] = $this->topic['tid'];
//-------------------------------------------------
// Are we a mod, and can we change the topic state?
//-------------------------------------------------
$return_to_move = 0;
if ( ($ibforums->input['mod_options'] != "") or ($ibforums->input['mod_options'] != 'nowt') )
{
if ($ibforums->input['mod_options'] == 'pin')
{
if ($ibforums->member['g_is_supmod'] == 1 or $class->moderator['pin_topic'] == 1)
{
$this->topic['pinned'] = 1;
$class->moderate_log('Pinned topic from post form', $this->topic['title']);
}
}
else if ($ibforums->input['mod_options'] == 'close')
{
if ($ibforums->member['g_is_supmod'] == 1 or $class->moderator['close_topic'] == 1)
{
$this->topic['state'] = 'closed';
$class->moderate_log('Closed topic from post form', $this->topic['title']);
}
}
else if ($ibforums->input['mod_options'] == 'move')
{
if ($ibforums->member['g_is_supmod'] == 1 or $class->moderator['move_topic'] == 1)
{
$return_to_move = 1;
}
}
}
$db_string = $std->compile_db_string( $this->post );
$DB->query("INSERT INTO ibf_posts (" .$db_string['FIELD_NAMES']. ") VALUES (". $db_string['FIELD_VALUES'] .")");
$this->post['pid'] = $DB->get_insert_id();
if ($class->obj['moderate']) {
$print->redirect_screen( $ibforums->lang['moderate_post'], "act=ST&f={$class->forum['id']}&t={$this->topic['tid']}" );
}
//-------------------------------------------------
// If we are still here, lets update the
// board/forum/topic stats
//-------------------------------------------------
$class->forum['last_title'] = $this->topic['title'];
$class->forum['last_id'] = $this->topic['tid'];
$class->forum['last_post'] = time();
$class->forum['last_poster_name'] = $ibforums->member['id'] ? $ibforums->member['name'] : $ibforums->input['UserName'];
$class->forum['last_poster_id'] = $ibforums->member['id'];
$class->forum['posts']++;
// Update the database
$DB->query("UPDATE ibf_forums SET last_title='" .$class->forum['last_title'] ."', ".
"last_id='" .$class->forum['last_id'] ."', ".
"last_post='" .$class->forum['last_post'] ."', ".
"last_poster_name='".$class->forum['last_poster_name'] ."', ".
"last_poster_id='" .$class->forum['last_poster_id'] ."', ".
"posts='" .$class->forum['posts'] ."' ".
"WHERE id='" .$class->forum['id'] ."'");
// Update the database
//+------------------------------------------------------------------------------------------------------
$DB->query("UPDATE ibf_topics SET last_poster_id='" .$class->forum['last_poster_id'] ."', ".
"last_poster_name='" .$class->forum['last_poster_name'] ."', ".
"last_post='" .$class->forum['last_post'] ."', ".
"pinned='" .$this->topic['pinned'] ."', ".
"state='" .$this->topic['state'] ."', ".
"posts=posts+1 ".
"WHERE tid='" .$this->topic['tid'] ."'");
//+------------------------------------------------------------------------------------------------------
$DB->query("UPDATE ibf_stats SET TOTAL_REPLIES=TOTAL_REPLIES+1");
//-------------------------------------------------
// If we are a member, lets update thier last post
// date and increment their post count.
//-------------------------------------------------
$pcount = "";
$mgroup = "";
if ($ibforums->member['id'])
{
if ($class->forum['inc_postcount'])
{
// Increment the users post count
$pcount = "posts=posts+1, ";
}
// Are we checking for auto promotion?
if ($ibforums->member['g_promotion'] != '-1&-1')
{
list($gid, $gposts) = explode( '&', $ibforums->member['g_promotion'] );
if ( $gid > 0 and $gposts > 0 )
{
if ( $ibforums->member['posts'] + 1 >= $gposts )
{
$mgroup = "mgroup='$gid', ";
}
}
}
$ibforums->member['last_post'] = time();
$DB->query("UPDATE ibf_members SET ".$pcount.$mgroup.
"last_post='" .$ibforums->member['last_post'] ."'".
"WHERE id='" .$ibforums->member['id']."'");
}
//-------------------------------------------------
// Are we tracking topics we reply in 'auto_track'?
//-------------------------------------------------
if ($ibforums->member['auto_track'] == 1)
{
$DB->query("SELECT trid FROM ibf_tracker WHERE topic_id='".$this->topic['tid']."' AND member_id='".$ibforums->member['id']."'");
if ( ! $DB->get_num_rows() )
{
$db_string = $DB->compile_db_insert_string( array (
'member_id' => $ibforums->member['id'],
'topic_id' => $this->topic['tid'],
'start_date' => time(),
) );
$DB->query("INSERT INTO ibf_tracker ({$db_string['FIELD_NAMES']}) VALUES ({$db_string['FIELD_VALUES']})");
}
}
//-------------------------------------------------
// Check for subscribed topics
// Pass on the previous last post time of the topic
// to see if we need to send emails out
//-------------------------------------------------
$class->topic_tracker( $this->topic['tid'], $this->post['post'], $class->forum['last_poster_name'], $this->topic['last_post'] );
//-------------------------------------------------
// Redirect them back to the topic
//-------------------------------------------------
if ($return_to_move == 1)
{
$std->boink_it($class->base_url."&act=Mod&CODE=02&f={$class->forum['id']}&t={$this->topic['tid']}");
}
else
{
$page = floor( ($this->topic['posts'] + 1) / $ibforums->vars['display_max_posts']);
$page = $page * $ibforums->vars['display_max_posts'];
$std->boink_it($class->base_url."&act=ST&f={$class->forum['id']}&t={$this->topic['tid']}&st=$page&#entry{$this->post['pid']}");
}
}
function show_form($class) {
global $ibforums, $std, $DB, $print, $HTTP_POST_VARS;
// Sort out the "raw" textarea input and make it safe incase
// we have a <textarea> tag in the raw post var.
$raw_post = isset($HTTP_POST_VARS['Post']) ? $HTTP_POST_VARS['Post'] : "";
if (isset($raw_post)) {
$raw_post = str_replace( '$' , "&#036;" , htmlspecialchars($raw_post) );
$raw_post = stripslashes($raw_post);
}
// Do we have any posting errors?
if ($class->obj['post_errors']) {
$class->output .= $class->html->errors( $ibforums->lang[ $class->obj['post_errors'] ]);
}
if ($class->obj['preview_post']) {
$class->output .= $class->html->preview( $class->parser->convert( array( 'TEXT' => $this->post['post'], 'CODE' => $class->forum['use_ibc'], 'SMILIES' => $ibforums->input['enableemo'], 'HTML' => $class->forum['use_html']) ) );
}
$class->check_upload_ability();
$class->output .= $class->html_start_form( array( 1 => array( 'CODE', '03' ),
2 => array( 't' , $this->topic['tid'])
) );
//---------------------------------------
// START TABLE
//---------------------------------------
$class->output .= $class->html->table_structure();
//---------------------------------------
$start_table = $class->html->table_top( "{$ibforums->lang['top_txt_reply']} {$this->topic['title']}");
$name_fields = $class->html_name_field();
$post_box = $class->html_post_body( $raw_post );
$mod_options = $class->mod_options(1);
$end_form = $class->html->EndForm( $ibforums->lang['submit_reply'] );
$post_icons = $class->html_post_icons();
if ($class->obj['can_upload'])
{
$upload_field = $class->html->Upload_field( $ibforums->member['g_attach_max'] * 1024 );
}
//---------------------------------------
$class->output = preg_replace( "/<!--START TABLE-->/" , "$start_table" , $class->output );
$class->output = preg_replace( "/<!--NAME FIELDS-->/" , "$name_fields" , $class->output );
$class->output = preg_replace( "/<!--POST BOX-->/" , "$post_box" , $class->output );
$class->output = preg_replace( "/<!--POST ICONS-->/" , "$post_icons" , $class->output );
$class->output = preg_replace( "/<!--UPLOAD FIELD-->/", "$upload_field" , $class->output );
$class->output = preg_replace( "/<!--MOD OPTIONS-->/" , "$mod_options" , $class->output );
$class->output = preg_replace( "/<!--END TABLE-->/" , "$end_form" , $class->output );
//---------------------------------------
$class->html_add_smilie_box();
$class->html_topic_summary($this->topic['tid']);
$this->nav = array( "<a href='{$class->base_url}&act=SC&c={$class->forum[cat_id]}'>{$class->forum['cat_name']}</a>",
"<a href='{$class->base_url}&act=SF&f={$class->forum['id']}'>{$class->forum['name']}</a>",
"<a href='{$class->base_url}&act=ST&f={$class->forum['id']}&t={$this->topic['tid']}'>{$this->topic['title']}</a>",
);
$this->title = $ibforums->lang['replying_in'].' '.$this->topic['title'];
$print->add_output("$class->output");
$print->do_output( array( 'TITLE' => $ibforums->vars['board_name']." -> ".$this->title,
'JS' => 1,
'NAV' => $this->nav,
) );
}
}
?>
+17 -3
View File
@@ -2,10 +2,10 @@
/*
+--------------------------------------------------------------------------
| IBFORUMS v1
| Invision Board v1.1
| ========================================
| by Matthew Mecham and David Baxter
| (c) 2001,2002 IBForums
| by Matthew Mecham
| (c) 2001,2002 Invision Power Services
| http://www.ibforums.com
| ========================================
| Web: http://www.ibforums.com
@@ -29,6 +29,20 @@
| own.
|
+--------------------------------------------------------------------------
|
| LICENCE OF USE (THIS MODULE ONLY)
|
| This module has been created and released under the GNU licence and may be
| freely used and distributed. If you find some space to credit us in your source
| code, it'll be appreciated.
|
| Report all bugs / improvements to matt@ibforums.com
|
| NOTE: This does not affect the current licence for the rest of the Invision
| board code. I just wanted to share this module as there is a lack of other
| decent tar proggies for PHP.
|
+--------------------------------------------------------------------------
*/
/*************************************************************
File diff suppressed because it is too large. Load diff
+3 -3
View File
@@ -2,10 +2,10 @@
/*
+--------------------------------------------------------------------------
| IBFORUMS v1
| Invision Board v1.1
| ========================================
| by Matthew Mecham and David Baxter
| (c) 2001,2002 IBForums
| by Matthew Mecham
| (c) 2001,2002 Invision Power Services
| http://www.ibforums.com
| ========================================
| Web: http://www.ibforums.com
File diff suppressed because it is too large. Load diff
+5 -8
View File
@@ -2,10 +2,10 @@
/*
+--------------------------------------------------------------------------
| IBFORUMS v1
| Invision Board v1.1
| ========================================
| by Matthew Mecham and David Baxter
| (c) 2001,2002 IBForums
| by Matthew Mecham
| (c) 2001,2002 Invision Power Services
| http://www.ibforums.com
| ========================================
| Web: http://www.ibforums.com
@@ -46,15 +46,13 @@ class Forward {
global $ibforums, $DB, $std, $print, $skin_universal;
require "./Skin/".$ibforums->skin_id."/skin_emails.php";
//-------------------------------------
// Compile the language file
//-------------------------------------
$ibforums->lang = $std->load_words($ibforums->lang, 'lang_emails', $ibforums->lang_id);
$this->html = new skin_emails();
$this->html = $std->load_template('skin_emails');
//-------------------------------------
// Check the input
@@ -72,7 +70,7 @@ class Forward {
// Get the forum info based on the forum ID, get the category name, ID, and get the topic details
//-------------------------------------
$DB->query("SELECT t.*, f.name as forum_name, f.id as forum_id, f.read_perms, f.reply_perms, f.start_perms, f.allow_poll, f.posts as forum_posts, f.topics as forum_topics, f.use_attach, c.name as cat_name, c.id as cat_id FROM ibf_topics t, ibf_forums f , ibf_categories c where t.tid='".$ibforums->input[t]."' and f.id = t.forum_id and f.category=c.id");
$DB->query("SELECT t.*, f.name as forum_name, f.id as forum_id, f.read_perms, f.reply_perms, f.start_perms, f.allow_poll, f.posts as forum_posts, f.topics as forum_topics, c.name as cat_name, c.id as cat_id FROM ibf_topics t, ibf_forums f , ibf_categories c where t.tid='".$ibforums->input[t]."' and f.id = t.forum_id and f.category=c.id");
$this->topic = $DB->fetch_row();
@@ -82,7 +80,6 @@ class Forward {
'topics' => $this->topic['forum_topics'] ,
'read_perms' => $this->topic['read_perms'] ,
'allow_poll' => $this->topic['allow_poll'] ,
'use_attach' => $this->topic['use_attach']
);
$this->category = array( 'name' => $this->topic['cat_name'],
+4 -6
View File
@@ -2,10 +2,10 @@
/*
+--------------------------------------------------------------------------
| IBFORUMS v1
| Invision Board v1.1
| ========================================
| by Matthew Mecham and David Baxter
| (c) 2001,2002 IBForums
| by Matthew Mecham
| (c) 2001,2002 Invision Power Services
| http://www.ibforums.com
| ========================================
| Web: http://www.ibforums.com
@@ -42,9 +42,7 @@ class Login {
$ibforums->lang = $std->load_words($ibforums->lang, 'lang_login', $ibforums->lang_id);
require "./Skin/".$ibforums->skin_id."/skin_login.php";
$this->login_html = new skin_login();
$this->login_html = $std->load_template('skin_login');
// What to do?
+209 -108
View File
@@ -1,108 +1,209 @@
<?php
/*
+--------------------------------------------------------------------------
| IBFORUMS v1
| ========================================
| by Matthew Mecham and David Baxter
| (c) 2001,2002 IBForums
| http://www.ibforums.com
| ========================================
| Web: http://www.ibforums.com
| Email: phpboards@ibforums.com
| Licence Info: phpib-licence@ibforums.com
+---------------------------------------------------------------------------
|
| > Show all emo's / BB Tags module
| > Module written by Matt Mecham
| > Date started: 18th April 2002
|
| > Module Version Number: 1.0.0
+--------------------------------------------------------------------------
*/
$idx = new legends;
class legends {
var $output = "";
var $base_url = "";
var $html = "";
function legends() {
//------------------------------------------------------
// $is_sub is a boolean operator.
// If set to 1, we don't show the "topic subscribed" page
// we simply end the subroutine and let the caller finish
// up for us.
//------------------------------------------------------
global $ibforums, $DB, $std, $print, $skin_universal;
$ibforums->lang = $std->load_words($ibforums->lang, 'lang_legends', $ibforums->lang_id );
require "./Skin/".$ibforums->skin_id."/skin_legends.php";
$this->html = new skin_legends();
$this->base_url = "{$ibforums->vars['board_url']}/index.{$ibforums->vars['php_ext']}?s={$ibforums->session_id}";
//--------------------------------------------
// What to do?
//--------------------------------------------
switch($ibforums->input['CODE'])
{
case 'emoticons':
$this->show_emoticons();
break;
default:
$this->show_emoticons();
break;
}
// If we have any HTML to print, do so...
$print->pop_up_window( $this->page_title, $this->output );
}
function show_emoticons()
{
global $ibforums, $DB, $std;
$this->page_title = $ibforums->lang['emo_title'];
$this->output .= $this->html->emoticon_javascript();
$this->output .= $this->html->page_header( $ibforums->lang['emo_title'], $ibforums->lang['emo_type'], $ibforums->lang['emo_img'] );
$DB->query("SELECT typed, image from ibf_emoticons");
if ( $DB->get_num_rows() )
{
while ( $r = $DB->fetch_row() )
{
$this->output .= $this->html->emoticons_row( stripslashes($r['typed']), stripslashes($r['image']) );
}
}
$this->output .= $this->html->page_footer();
}
}
?>
<?php
/*
+--------------------------------------------------------------------------
| Invision Board v1.1
| ========================================
| by Matthew Mecham
| (c) 2001,2002 Invision Power Services
| http://www.ibforums.com
| ========================================
| Web: http://www.ibforums.com
| Email: phpboards@ibforums.com
| Licence Info: phpib-licence@ibforums.com
+---------------------------------------------------------------------------
|
| > Show all emo's / BB Tags module
| > Module written by Matt Mecham
| > Date started: 18th April 2002
|
| > Module Version Number: 1.0.0
+--------------------------------------------------------------------------
*/
$idx = new legends;
class legends {
var $output = "";
var $base_url = "";
var $html = "";
function legends() {
//------------------------------------------------------
// $is_sub is a boolean operator.
// If set to 1, we don't show the "topic subscribed" page
// we simply end the subroutine and let the caller finish
// up for us.
//------------------------------------------------------
global $ibforums, $DB, $std, $print, $skin_universal;
$ibforums->lang = $std->load_words($ibforums->lang, 'lang_legends', $ibforums->lang_id );
$this->html = $std->load_template('skin_legends');
$this->base_url = "{$ibforums->vars['board_url']}/index.{$ibforums->vars['php_ext']}?s={$ibforums->session_id}";
//--------------------------------------------
// What to do?
//--------------------------------------------
switch($ibforums->input['CODE'])
{
case 'emoticons':
$this->show_emoticons();
break;
case 'finduser_one':
$this->find_user_one();
break;
case 'finduser_two':
$this->find_user_two();
break;
default:
$this->show_emoticons();
break;
}
// If we have any HTML to print, do so...
$print->pop_up_window( $this->page_title, $this->output );
}
//--------------------------------------------------------------
function find_user_one()
{
global $ibforums, $DB, $std;
// entry=textarea&name=carbon_copy&sep=comma
$entry = (isset($ibforums->input['entry'])) ? $ibforums->input['entry'] : 'textarea';
$name = (isset($ibforums->input['name'])) ? $ibforums->input['name'] : 'carbon_copy';
$sep = (isset($ibforums->input['sep'])) ? $ibforums->input['sep'] : 'line';
$this->output .= $this->html->find_user_one($entry, $name, $sep);
$this->page_title = $ibforums->lang['fu_title'];
}
//--------------------------------------------------------------
function find_user_two()
{
global $ibforums, $DB, $std;
$entry = (isset($ibforums->input['entry'])) ? $ibforums->input['entry'] : 'textarea';
$name = (isset($ibforums->input['name'])) ? $ibforums->input['name'] : 'carbon_copy';
$sep = (isset($ibforums->input['sep'])) ? $ibforums->input['sep'] : 'line';
//-----------------------------------------
// Check for input, etc
//-----------------------------------------
$ibforums->input['username'] = strtolower(trim($ibforums->input['username']));
if ($ibforums->input['username'] == "")
{
$this->find_user_error('fu_no_data');
return;
}
//-----------------------------------------
// Attempt a match
//-----------------------------------------
$DB->query("SELECT id, name FROM ibf_members WHERE LOWER(name) LIKE '".$ibforums->input['username']."%' LIMIT 0,101");
if ( ! $DB->get_num_rows() )
{
$this->find_user_error('fu_no_match');
return;
}
else if ( $DB->get_num_rows() > 99 )
{
$this->find_user_error('fu_kc_loads');
return;
}
else
{
$select_box = "";
while ( $row = $DB->fetch_row() )
{
if ($row['id'] > 0)
{
$select_box .= "<option value='{$row['name']}'>{$row['name']}</option>\n";
}
}
$this->output .= $this->html->find_user_final($select_box, $entry, $name, $sep);
$this->page_title = $ibforums->lang['fu_title'];
}
}
//--------------------------------------------------------------
function find_user_error($error)
{
global $ibforums, $DB, $std;
$this->page_title = $ibforums->lang['fu_title'];
$this->output = $this->html->find_user_error($ibforums->lang[$error]);
return;
}
//--------------------------------------------------------------
function show_emoticons()
{
global $ibforums, $DB, $std;
$this->page_title = $ibforums->lang['emo_title'];
$this->output .= $this->html->emoticon_javascript();
$this->output .= $this->html->page_header( $ibforums->lang['emo_title'], $ibforums->lang['emo_type'], $ibforums->lang['emo_img'] );
$DB->query("SELECT typed, image from ibf_emoticons");
if ( $DB->get_num_rows() )
{
while ( $r = $DB->fetch_row() )
{
$this->output .= $this->html->emoticons_row( stripslashes($r['typed']), stripslashes($r['image']) );
}
}
$this->output .= $this->html->page_footer();
}
}
?>
+93 -58
View File
@@ -2,10 +2,10 @@
/*
+--------------------------------------------------------------------------
| IBFORUMS v1
| Invision Board v1.1
| ========================================
| by Matthew Mecham and David Baxter
| (c) 2001,2002 IBForums
| by Matthew Mecham
| (c) 2001,2002 Invision Power Services
| http://www.ibforums.com
| ========================================
| Web: http://www.ibforums.com
@@ -49,22 +49,20 @@ class Printable {
global $ibforums, $DB, $std, $print, $skin_universal;
require "./Skin/".$ibforums->skin_id."/skin_printpage.php";
/***********************************/
// Compile the language file
/***********************************/
$ibforums->lang = $std->load_words($ibforums->lang, 'lang_printpage', $ibforums->lang_id);
$this->html = new skin_printpage();
$this->html = $std->load_template('skin_printpage');
/***********************************/
// Check the input
/***********************************/
$ibforums->input['t'] = $std->is_number($ibforums->input['t']);
$ibforums->input['f'] = $std->is_number($ibforums->input['f']);
$ibforums->input['t'] = intval($ibforums->input['t']);
$ibforums->input['f'] = intval($ibforums->input['f']);
if ($ibforums->input['t'] < 0 or $ibforums->input['f'] < 0)
{
@@ -75,7 +73,7 @@ class Printable {
// Get the forum info based on the forum ID, get the category name, ID, and get the topic details
//-------------------------------------
$DB->query("SELECT t.*, f.name as forum_name, f.id as forum_id, f.read_perms, f.password, f.reply_perms, f.start_perms, f.allow_poll, f.posts as forum_posts, f.topics as forum_topics, f.use_attach, c.name as cat_name, c.id as cat_id FROM ibf_topics t, ibf_forums f , ibf_categories c where t.tid='".$ibforums->input[t]."' and f.id = t.forum_id and f.category=c.id");
$DB->query("SELECT t.*, f.name as forum_name, f.id as forum_id, f.read_perms, f.password, f.reply_perms, f.start_perms, f.allow_poll, f.posts as forum_posts, f.topics as forum_topics, c.name as cat_name, c.id as cat_id FROM ibf_topics t, ibf_forums f , ibf_categories c where t.tid='".$ibforums->input[t]."' and f.id = t.forum_id and f.category=c.id");
$this->topic = $DB->fetch_row();
@@ -85,7 +83,6 @@ class Printable {
'topics' => $this->topic['forum_topics'] ,
'read_perms' => $this->topic['read_perms'] ,
'allow_poll' => $this->topic['allow_poll'] ,
'use_attach' => $this->topic['use_attach'] ,
'password' => $this->topic['password']
);
@@ -129,27 +126,85 @@ class Printable {
if ($bad_entry == 1) {
$std->Error( array( LEVEL => 1, MSG => 'no_view_topic') );
}
}
//------------------------------------------------------------
//
// Main logic engine
//
//------------------------------------------------------------
if ($ibforums->input['client'] == 'choose')
{
// Show the "choose page"
$this->page_title = $this->topic['title'];
$this->nav = array ( "<a href='{$this->base_url}&act=SF&f={$this->forum['id']}'>{$this->forum['name']}</a>",
"<a href='{$this->base_url}&act=ST&f={$this->forum['id']}&t={$this->topic['tid']}'>{$this->topic['title']}</a>"
);
$this->output = $this->html->choose_form($this->forum['id'], $this->topic['tid'], $this->topic['title']);
$print->add_output("$this->output");
$print->do_output( array( 'TITLE' => $this->page_title, 'JS' => 0, NAV => $this->nav ) );
exit(); // Incase we haven't already done so :p
}
else
{
$header = 'text/html';
$ext = '.html';
switch ($ibforums->input['client'])
{
case 'printer':
$header = 'text/html';
$ext = '.html';
break;
case 'html':
$header = 'unknown/unknown';
$ext = '.html';
break;
default:
$header = 'application/msword';
$ext = '.doc';
}
}
$title = substr( str_replace( " ", "_" , preg_replace( "/&(lt|gt|quot|#124|#036|#33|#39);/", "", $this->topic['title'] ) ), 0, 12);
//$this->output .= "<br><br><font size='1'><center>Powered by Invision Board<br>&copy; 2002 Invision PS</center></font></body></html>";
@flush();
@header("Content-type: $header");
if ($ibforums->input['client'] != 'printer')
{
@header("Content-Disposition: attachment; filename=$title".$ext);
}
print $this->get_posts();
exit;
}
function get_posts()
{
global $ibforums, $DB, $std;
/***********************************/
// Render the page top
/***********************************/
$this->output .= $this->html->pp_header( $this->forum['name'], $this->topic['title'], $this->topic['starter_name'] );
$posts_html = $this->html->pp_header( $this->forum['name'], $this->topic['title'], $this->topic['starter_name'] , $this->forum['id'], $this->topic['tid']);
/*******************************************************************************************/
// Grab the posts we'll need
/*******************************************************************************************/
// Set a prohibitive limit delibrately for long topics.
$max_posts = 300;
$DB->query( "SELECT * FROM ibf_posts WHERE topic_id='".$this->topic['tid']."'".
" and queued !='1' ORDER BY pid LIMIT 0, ".$max_posts);
@@ -262,19 +317,10 @@ class Printable {
//--------------------------------------------------------------
if (!$ibforums->skin[EDIT_FONT_SIZE]) $ibforums->skin[EDIT_FONT_SIZE] = 7;
$row['post'] = preg_replace( "/<!--EDIT\|(.+?)\|(.+?)-->/", "<span style='font-size:$ibforums->skin[EDIT_FONT_SIZE]pt'>Edited by \\1 on \\2</span>", $row['post'] );
$row['post'] = preg_replace( "/<!--EDIT\|(.+?)\|(.+?)-->/", "", $row['post'] );
//--------------------------------------------------------------
if (!$ibforums->member['view_img'])
{
$row['post'] = preg_replace( "/<img src[\"'](.+?)[\"'].+?".">/", "(IMG:<a href='\\1' target='_blank'>\\1</a>)", $row['post'] );
}
$row['post_date'] = $std->get_date( $row['post_date'], 'LONG' );
$row['post'] = $this->parse_message($row['post']);
@@ -290,12 +336,12 @@ class Printable {
{
if ($row['use_sig'] == 1)
{
$row['signature'] = "<!--Signature-->{$ibforums->vars[SIG_SEP]}<span id='signature'>{$poster['signature']}</span><!--E-Signature-->";
$row['signature'] = "<!--Signature-->{$ibforums->vars[SIG_SEP]}<span class='signature'>{$poster['signature']}</span><!--E-Signature-->";
}
}
$this->output .= $this->html->pp_postentry( $poster, $row );
$posts_html .= $this->html->pp_postentry( $poster, $row );
}
@@ -303,41 +349,30 @@ class Printable {
// Print the footer
/***********************************/
$this->output .= $this->html->pp_end();
$posts_html .= $this->html->pp_end();
/***********************************/
// Print all the output
/***********************************/
$this->output .= "<br><br><font size='1'><center>Powered by Invision Board<br>&copy; 2002 Invision PS</center></font></body></html>";
echo($this->output);
exit;
return $posts_html;
}
function parse_message($message="") {
$message = preg_replace( "#<!--emo&(.+?)-->.+?<!--endemo-->#", "\\1" , $message );
//$message = preg_replace( "#<!--emo&(.+?)-->.+?<!--endemo-->#", "\\1" , $message );
$message = preg_replace( "#<!--c1-->(.+?)<!--ec1-->#", "\n\n------------ CODE SAMPLE ----------\n" , $message );
$message = preg_replace( "#<!--c2-->(.+?)<!--ec2-->#", "\n-----------------------------------\n\n" , $message );
//$message = preg_replace( "#<!--c1-->(.+?)<!--ec1-->#", "\n\n------------ CODE SAMPLE ----------\n" , $message );
//$message = preg_replace( "#<!--c2-->(.+?)<!--ec2-->#", "\n-----------------------------------\n\n" , $message );
$message = preg_replace( "#<!--QuoteBegin-->(.+?)<!--QuoteEBegin-->#" , "\n\n------------ QUOTE ----------\n" , $message );
$message = preg_replace( "#<!--QuoteBegin--(.+?)\+(.+?)-->(.+?)<!--QuoteEBegin-->#" , "\n\n------------ QUOTE ----------\n" , $message );
$message = preg_replace( "#<!--QuoteEnd-->(.+?)<!--QuoteEEnd-->#" , "\n-----------------------------\n\n" , $message );
//$message = preg_replace( "#<!--QuoteBegin-->(.+?)<!--QuoteEBegin-->#" , "\n\n------------ QUOTE ----------\n" , $message );
//$message = preg_replace( "#<!--QuoteBegin--(.+?)\+(.+?)-->(.+?)<!--QuoteEBegin-->#" , "\n\n------------ QUOTE ----------\n" , $message );
//$message = preg_replace( "#<!--QuoteEnd-->(.+?)<!--QuoteEEnd-->#" , "\n-----------------------------\n\n" , $message );
$message = preg_replace( "#<!--Flash (.+?)-->.+?<!--End Flash-->#e" , "(FLASH MOVIE)" , $message );
$message = preg_replace( "#<img src=[\"'](\S+?)['\"].+"."?".">#" , "(IMAGE: \\1)" , $message );
$message = preg_replace( "#<a href=[\"'](http|https|ftp|news)://(\S+?)['\"].+?".">(.+?)</a>#" , "(URL: \\1://\\2)" , $message );
$message = preg_replace( "#<a href=[\"']mailto:(.+?)['\"]>(.+?)</a>#" , "(EMAIL: \\2)" , $message );
//$message = preg_replace( "#<img src=[\"'](\S+?)['\"].+"."?".">#" , "(IMAGE: \\1)" , $message );
//$message = preg_replace( "#<a href=[\"'](http|https|ftp|news)://(\S+?)['\"].+?".">(.+?)</a>#" , "(URL: \\1://\\2)" , $message );
//$message = preg_replace( "#<a href=[\"']mailto:(.+?)['\"]>(.+?)</a>#" , "(EMAIL: \\2)" , $message );
$message = preg_replace( "#<!--sql-->(.+?)<!--sql1-->(.+?)<!--sql2-->(.+?)<!--sql3-->#e" , "\n\n--------------- SQL -----------\n\\2\n----------------\n\n", $message);
$message = preg_replace( "#<!--html-->(.+?)<!--html1-->(.+?)<!--html2-->(.+?)<!--html3-->#e", "\n\n-------------- HTML -----------\n\\2\n----------------\n\n", $message);
//$message = preg_replace( "#<!--sql-->(.+?)<!--sql1-->(.+?)<!--sql2-->(.+?)<!--sql3-->#e" , "\n\n--------------- SQL -----------\n\\2\n----------------\n\n", $message);
//$message = preg_replace( "#<!--html-->(.+?)<!--html1-->(.+?)<!--html2-->(.+?)<!--html3-->#e", "\n\n-------------- HTML -----------\n\\2\n----------------\n\n", $message);
return $message;
+428 -336
View File
@@ -1,336 +1,428 @@
<?php
/*
+--------------------------------------------------------------------------
| IBFORUMS v1
| ========================================
| by Matthew Mecham and David Baxter
| (c) 2001,2002 IBForums
| http://www.ibforums.com
| ========================================
| Web: http://www.ibforums.com
| Email: phpboards@ibforums.com
| Licence Info: phpib-licence@ibforums.com
+---------------------------------------------------------------------------
|
| > Topic Tracker module
| > Module written by Matt Mecham
| > Date started: 6th March 2002
|
| > Module Version Number: 1.0.0
+--------------------------------------------------------------------------
*/
$idx = new stats;
class stats {
var $output = "";
var $base_url = "";
var $html = "";
function stats() {
//------------------------------------------------------
// $is_sub is a boolean operator.
// If set to 1, we don't show the "topic subscribed" page
// we simply end the subroutine and let the caller finish
// up for us.
//------------------------------------------------------
global $ibforums, $DB, $std, $print, $skin_universal;
$ibforums->lang = $std->load_words($ibforums->lang, 'lang_stats', $ibforums->lang_id );
require "./Skin/".$ibforums->skin_id."/skin_stats.php";
$this->html = new skin_stats();
$this->base_url = "{$ibforums->vars['board_url']}/index.{$ibforums->vars['php_ext']}?s={$ibforums->session_id}";
//--------------------------------------------
// What to do?
//--------------------------------------------
switch($ibforums->input['CODE'])
{
case 'leaders':
$this->show_leaders();
break;
case '02':
$this->do_search();
break;
case 'id':
$this->show_queries();
break;
default:
$this->show_today_posters();
break;
}
// If we have any HTML to print, do so...
$print->add_output("$this->output");
$print->do_output( array( 'TITLE' => $this->page_title, 'JS' => 0, NAV => $this->nav ) );
}
function show_leaders()
{
global $ibforums, $DB, $std;
$this->output .= $this->html->page_title( $ibforums->lang['forum_leaders'] );
//--------------------------------------------
// Work out where our super mods are at
//--------------------------------------------
$sup_ids = array();
$DB->query("SELECT g_id from ibf_groups WHERE g_is_supmod = 1");
if ( $DB->get_num_rows() )
{
while ( $i = $DB->fetch_row() )
{
$sup_ids[] = $i['g_id'];
}
}
//--------------------------------------------
// Get our admins
//--------------------------------------------
$admin_ids = array();
$DB->query("SELECT id, name, email, hide_email, location, aim_name, icq_number from ibf_members WHERE mgroup='".$ibforums->vars['admin_group']."'");
$this->output .= $this->html->group_strip( $ibforums->lang['leader_admins'] );
while ( $member = $DB->fetch_row() )
{
$this->output .= $this->html->leader_row( $this->parse_member( $member ), $ibforums->lang['leader_all_forums'] );
$admin_ids[] = $member['id'];
}
$this->output .= $this->html->close_strip();
//--------------------------------------------
// Do the bizz with the super men, er mods.
//--------------------------------------------
$admin_ids[] = '0';
if ( count($sup_ids) > 0 )
{
$DB->query("SELECT id, name, email, hide_email, location, aim_name, icq_number from ibf_members WHERE mgroup IN (".implode( ',', $sup_ids ).") and id NOT IN(".implode(',', $admin_ids).")");
if ( $DB->get_num_rows() )
{
$this->output .= $this->html->group_strip( $ibforums->lang['leader_global'] );
while ( $member = $DB->fetch_row() )
{
$this->output .= $this->html->leader_row( $this->parse_member( $member ), $ibforums->lang['leader_all_forums'] );
}
$this->output .= $this->html->close_strip();
}
}
//--------------------------------------------
// Do we have any moderators?.
//--------------------------------------------
$DB->query("SELECT m.id, m.name, m.email, m.hide_email, m.location, m.aim_name, m.icq_number, f.id as forum_id, f.read_perms, f.name as forum_name FROM ibf_members m, ibf_forums f, ibf_moderators mod "
."WHERE m.id=mod.member_id and f.id=mod.forum_id");
$data = array();
while ( $i = $DB->fetch_row() )
{
if ( preg_match( "/(^|,)".$ibforums->member['mgroup']."(,|$)/", $i['read_perms'] ) )
{
$data[] = $i;
}
else if ( $i['read_perms'] == '*' )
{
$data[] = $i;
}
}
//------------------------
if ( count($data) > 0 )
{
$mod_array = array();
$this->output .= $this->html->group_strip( $ibforums->lang['leader_mods'] );
foreach ( $data as $idx => $i )
{
if ( !isset( $mod_array['member'][ $i['id'] ][ 'name' ] ) )
{
// Member is not already set, lets add the member...
$mod_array['member'][ $i['id'] ] = array( 'name' => $i['name'],
'email' => $i['email'],
'hide_email' => $i['hide_email'],
'location' => $i['location'],
'aim_name' => $i['aim_name'],
'icq_number' => $i['icq_number'],
'id' => $i['id']
);
}
// Add forum..
$mod_array['forums'][ $i['id'] ][] = "<a href='".$ibforums->base_url."&act=SF&f=".$i['forum_id']."'>".$i['forum_name']."</a>";
}
foreach( $mod_array['member'] as $id => $data )
{
$this->output .= $this->html->leader_row(
$this->parse_member( $mod_array['member'][ $id ] ),
implode( "<br>", $mod_array['forums'][ $id ] )
);
}
$this->output .= $this->html->close_strip();
}
$this->page_title = $ibforums->lang['forum_leaders'];
$this->nav = array( $ibforums->lang['forum_leaders'] );
}
function show_queries()
{
global $ibforums, $DB, $std;
// show DB queries in graphic format(depreciated)
// left here to stop other functions breaking
flush();
header("Content-type: image/gif");
echo base64_decode("R0lGODlhhgAfAMQAAAAAAP///+/v79/f38/Pz7+/v6+vr5+fn4+Pj4CAgHBwcGBgYFBQUEBAQDAwMCAgIBAQEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACwAAAAAhgAfAAAF/2AgjmRpnmiqrmzrvnAsz3Rt33iu7/x8mL8AgcEgiBINg2i4EAiJxtEhmlKYrCpCY5uYYXurQ8GUGAQeB8NDYFgU1oFkwopWO4/jrImKKrgLDXkwDWAsCyICC0VCCARYCQUKRggGAgwiDY54I5ABBwpFBVEGAz+AWD+JiwUGDV0FXQGwAapGia4iBwwGWgeEhSq/CwgHDpgkCwO/sLNxyGabEAgJCwSHAcaEDn4/hMPFAUhvA80KP9/GCgoFDkYApA5tv8AnBLHGAUoBlyKAzrKQYs3zx2kMPm1CDhF6UECAE4QBqiVQAqkAgIsQnOCrpm8dtoQBlNHrI7DELwJwlv8FPCYETsF/hBQYmOjsAIAHRgj9CjimYqxP/yANAQBhDKFm80aSaIZPHyEB7UQk83RgwLWnUUl0+kXIgAIHD0MKQHAJ4rpOPkeYLbArnFFZVgQkVSpiAJYiKEVcWpRLgVwzDga02cdnE1dM/LQJGOKsCFS3bpsdOOQ4G4EBDP+BRTCX7r4lDyDoK3LxYsMGAFBBwEmgNABBW1kOO3Zgdc6WEH6gLWDxYgMzKHPnW72gWy4ICzrTbWLCQBDP0KP3eT7Cr/Tr2PuZEJS9u/fv4MOLH1/3DowBTgrLQK9CALQR7lewnxEfTKcRh8SoYAD4xpQs1AkRIBncwdBMDxXdQcj/fQIU6IxVO1yWQoPmLfFeg3g0NIKESwiyGC28xTKChiCS8OEA6pWQgAMNPBCHa4A04IAVnUA4WRde5YNLjq3gaMVMGcoIgTVRbJMAVDICFMBXosXBgAOXrJjkkg40qcADLIaTJYsOiIhNAxAMgJkD+GD5wFcPIKBCAl244cxWP4AlhZrVxHSJJHYuqcWSd0ZRESEHTPTjWbMgQM6RxjwWyBnhWCHTY4qKYEwCauaogIg5HvCJEjIFkJEAnyr3UmyxQSaCJI3t4xche636GQOuZvhKF8ZUA8sAyI3BTEmHdbIrSzNBAJmvIt73zyyH/YPCbm++ZepHcgWAAFuaXjIt6wPVSkutLgXNMksRxsxiTVG/OtOrriuZy8CKw6L7EkvIsiTqJqQaZQQDd0QLpBaGNqAmv8r862/A3c7qyQKH3FppQAPwk80xCfxATMOS/uNiJweoOc2cniBQjbTGwbRmT2PklgB/Wyhw1KGmDukpNC6HKULMYpLsbRegKjHLAyuGGAcoXfTKc0pAn6GysJ0IMHQXqfAcJjsJpCSvCgWYUXU+BwhQRiYIOFH11c8FEXYuUpBNjiw1h5RH1mqHVOMYY4lNtihlIEJMXZCQcrXbBIwRxAD33Uq2J4PPMC95iNdweOKMN+7445BfFwIAOw==");
exit();
}
function show_today_posters()
{
global $ibforums, $DB, $std;
$this->output .= $this->html->page_title( $ibforums->lang['todays_posters'] );
$this->output .= $this->html->top_poster_header();
$time_high = time();
$time_low = $time_high - (60*60*24);
//--------------------------------------------
// Query the DB
//--------------------------------------------
$DB->query("SELECT COUNT(pid) as count FROM ibf_posts WHERE post_date < $time_high and post_date > $time_low");
$todays_posts = $DB->fetch_row();
if ($todays_posts['count'] > 0)
{
$DB->query("SELECT COUNT(p.pid) as tpost, m.id, m.name, m.joined, m.posts FROM ibf_posts p, ibf_members m "
."WHERE m.id > 0 AND m.id=p.author_id and post_date < $time_high and post_date > $time_low GROUP BY p.author_id ORDER BY tpost DESC LIMIT 0,10");
if ( $DB->get_num_rows() )
{
while ($info = $DB->fetch_row())
{
$info['total_today_posts'] = $todays_posts['count'];
if ($todays_posts['count'] > 0 and $info['tpost'] > 0)
{
$info['today_pct'] = sprintf( '%.2f', ( $info['tpost'] / $todays_posts['count'] ) * 100 );
}
$info['joined'] = $std->get_date( $info['joined'], 'JOINED' );
$this->output .= $this->html->top_poster_row( $info );
}
}
else
{
$this->output .= $this->html->top_poster_no_info();
}
}
else
{
$this->output .= $this->html->top_poster_no_info();
}
$this->output .= $this->html->top_poster_footer( $todays_posts['count'] );
$this->page_title = $ibforums->lang['top_poster_title'];
$this->nav = array( $ibforums->lang['top_poster_title'] );
}
//------------------------------------------------------------------------------------------------
function parse_member( $member )
{
global $ibforums, $std;
$member['msg_icon'] = "<a href='{$this->base_url}&act=Msg&CODE=04&MID={$member['id']}'>{$ibforums->skin['P_MSG']}</a>";
if (!$member['hide_email'])
{
$member['email_icon'] = "<a href='{$this->base_url}&act=Mail&CODE=00&MID={$member['id']}'>{$ibforums->skin['P_EMAIL']}</a>";
}
else
{
$member['email_icon'] = '&nbsp;';
}
if ($member['icq_number'])
{
$member['icq_icon'] = "<a href=\"javascript:PopUp('{$this->base_url}&act=ICQ&MID={$member['id']}','Pager','450','330','0','1','1','1')\">{$ibforums->skin[P_ICQ]}</a>";
}
else
{
$member['icq_iconn'] = '&nbsp;';
}
if ($member['aim_name'])
{
$member['aol_icon'] = "<a href=\"javascript:PopUp('{$this->base_url}&act=AOL&MID={$member['id']}','Pager','450','330','0','1','1','1')\">{$ibforums->skin[P_AOL]}</a>";
}
else
{
$member['aol_icon'] = '&nbsp;';
}
return $member;
}
}
?>
<?php
/*
+--------------------------------------------------------------------------
| Invision Board v1.1
| ========================================
| by Matthew Mecham
| (c) 2001,2002 Invision Power Services
| http://www.ibforums.com
| ========================================
| Web: http://www.ibforums.com
| Email: phpboards@ibforums.com
| Licence Info: phpib-licence@ibforums.com
+---------------------------------------------------------------------------
|
| > Topic Tracker module
| > Module written by Matt Mecham
| > Date started: 6th March 2002
|
| > Module Version Number: 1.0.0
+--------------------------------------------------------------------------
*/
$idx = new stats;
class stats {
var $output = "";
var $base_url = "";
var $html = "";
var $forum = "";
function stats() {
//------------------------------------------------------
// $is_sub is a boolean operator.
// If set to 1, we don't show the "topic subscribed" page
// we simply end the subroutine and let the caller finish
// up for us.
//------------------------------------------------------
global $ibforums, $DB, $std, $print, $skin_universal;
$ibforums->lang = $std->load_words($ibforums->lang, 'lang_stats', $ibforums->lang_id );
$this->html = $std->load_template('skin_stats');
$this->base_url = "{$ibforums->vars['board_url']}/index.{$ibforums->vars['php_ext']}?s={$ibforums->session_id}";
//--------------------------------------------
// What to do?
//--------------------------------------------
switch($ibforums->input['CODE'])
{
case 'leaders':
$this->show_leaders();
break;
case '02':
$this->do_search();
break;
case 'id':
$this->show_queries();
break;
case 'who':
$this->who_posted();
break;
default:
$this->show_today_posters();
break;
}
// If we have any HTML to print, do so...
$print->add_output("$this->output");
$print->do_output( array( 'TITLE' => $this->page_title, 'JS' => 0, NAV => $this->nav ) );
}
function who_posted()
{
global $ibforums, $DB, $std, $print;
$tid = intval(trim($ibforums->input['t']));
$to_print = "";
$this->check_access($tid);
$DB->query("SELECT COUNT(p.pid) as pcount, p.author_id, p.author_name FROM ibf_posts p
WHERE p.topic_id=$tid AND queued <> 1 GROUP BY p.author_name ORDER BY pcount DESC");
if ( $DB->get_num_rows() )
{
$to_print = $this->html->who_header($this->forum['id'], $tid, $this->forum['topic_title']);
while( $r = $DB->fetch_row() )
{
if ($r['author_id'])
{
$r['author_name'] = $this->html->who_name_link($r['author_id'], $r['author_name']);
}
$to_print .= $this->html->who_row($r);
}
$to_print .= $this->html->who_end();
}
else
{
$std->Error( array( 'LEVEL' => 1, 'MSG' => 'missing_files') );
}
$print->pop_up_window("",$to_print);
exit();
}
//--------------------------------
function check_access($tid)
{
global $ibforums, $DB, $std, $HTTP_COOKIE_VARS;
if ( ! $ibforums->member['id'] )
{
$std->Error( array( 'LEVEL' => 1, 'MSG' => 'no_permission') );
}
//--------------------------------
$DB->query("SELECT t.title as topic_title, f.read_perms, f.password, f.id from ibf_forums f, ibf_topics t WHERE t.tid=$tid and f.id=t.forum_id");
$this->forum = $DB->fetch_row();
$return = 1;
if ($this->forum['read_perms'] == '*')
{
$return = 0;
}
else if (preg_match( "/(^|,)".$ibforums->member['mgroup']."(,|$)/", $this->forum['read_perms'] ) )
{
$return = 0;
}
if ($this->forum['password'])
{
if ($HTTP_COOKIE_VARS[ $ibforums->vars['cookie_id'].'iBForum'.$this->forum['id'] ] == $this->forum['password'])
{
$return = 0;
}
}
if ($return == 1)
{
$std->Error( array( 'LEVEL' => 1, 'MSG' => 'no_permission') );
}
}
//--------------------------------
function show_leaders()
{
global $ibforums, $DB, $std;
$this->output .= $this->html->page_title( $ibforums->lang['forum_leaders'] );
//--------------------------------------------
// Work out where our super mods are at
//--------------------------------------------
$sup_ids = array();
$DB->query("SELECT g_id from ibf_groups WHERE g_is_supmod = 1");
if ( $DB->get_num_rows() )
{
while ( $i = $DB->fetch_row() )
{
$sup_ids[] = $i['g_id'];
}
}
//--------------------------------------------
// Get our admins
//--------------------------------------------
$admin_ids = array();
$DB->query("SELECT m.id, m.name, m.email, m.hide_email, m.location, m.aim_name, m.icq_number, g.g_access_cp
FROM ibf_members m, ibf_groups g
WHERE g.g_access_cp=1 AND m.mgroup=g.g_id ORDER BY m.name");
$this->output .= $this->html->group_strip( $ibforums->lang['leader_admins'] );
while ( $member = $DB->fetch_row() )
{
$this->output .= $this->html->leader_row( $this->parse_member( $member ), $ibforums->lang['leader_all_forums'] );
$admin_ids[] = $member['id'];
}
$this->output .= $this->html->close_strip();
//--------------------------------------------
// Do the bizz with the super men, er mods.
//--------------------------------------------
$admin_ids[] = '0';
if ( count($sup_ids) > 0 )
{
$DB->query("SELECT id, name, email, hide_email, location, aim_name, icq_number from ibf_members WHERE mgroup IN (".implode( ',', $sup_ids ).") and id NOT IN(".implode(',', $admin_ids).")");
if ( $DB->get_num_rows() )
{
$this->output .= $this->html->group_strip( $ibforums->lang['leader_global'] );
while ( $member = $DB->fetch_row() )
{
$this->output .= $this->html->leader_row( $this->parse_member( $member ), $ibforums->lang['leader_all_forums'] );
}
$this->output .= $this->html->close_strip();
}
}
//--------------------------------------------
// Do we have any moderators?.
//--------------------------------------------
$DB->query("SELECT m.id, m.name, m.email, m.hide_email, m.location, m.aim_name, m.icq_number, f.id as forum_id, f.read_perms, f.name as forum_name FROM ibf_members m, ibf_forums f, ibf_moderators mod "
."WHERE m.id=mod.member_id and f.id=mod.forum_id");
$data = array();
while ( $i = $DB->fetch_row() )
{
if ( preg_match( "/(^|,)".$ibforums->member['mgroup']."(,|$)/", $i['read_perms'] ) )
{
$data[] = $i;
}
else if ( $i['read_perms'] == '*' )
{
$data[] = $i;
}
}
//------------------------
if ( count($data) > 0 )
{
$mod_array = array();
$this->output .= $this->html->group_strip( $ibforums->lang['leader_mods'] );
foreach ( $data as $idx => $i )
{
if ( !isset( $mod_array['member'][ $i['id'] ][ 'name' ] ) )
{
// Member is not already set, lets add the member...
$mod_array['member'][ $i['id'] ] = array( 'name' => $i['name'],
'email' => $i['email'],
'hide_email' => $i['hide_email'],
'location' => $i['location'],
'aim_name' => $i['aim_name'],
'icq_number' => $i['icq_number'],
'id' => $i['id']
);
}
// Add forum..
$mod_array['forums'][ $i['id'] ][] = "<a href='".$ibforums->base_url."&act=SF&f=".$i['forum_id']."'>".$i['forum_name']."</a>";
}
foreach( $mod_array['member'] as $id => $data )
{
$this->output .= $this->html->leader_row(
$this->parse_member( $mod_array['member'][ $id ] ),
implode( "<br>", $mod_array['forums'][ $id ] )
);
}
$this->output .= $this->html->close_strip();
}
$this->page_title = $ibforums->lang['forum_leaders'];
$this->nav = array( $ibforums->lang['forum_leaders'] );
}
function show_queries()
{
global $ibforums, $DB, $std;
// show DB queries in graphic format(depreciated)
// left here to stop other functions breaking
flush();
header("Content-type: image/gif");
echo base64_decode("R0lGODlhhgAfAMQAAAAAAP///+/v79/f38/Pz7+/v6+vr5+fn4+Pj4CAgHBwcGBgYFBQUEBAQDAwMCAgIBAQEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACwAAAAAhgAfAAAF/2AgjmRpnmiqrmzrvnAsz3Rt33iu7/x8mL8AgcEgiBINg2i4EAiJxtEhmlKYrCpCY5uYYXurQ8GUGAQeB8NDYFgU1oFkwopWO4/jrImKKrgLDXkwDWAsCyICC0VCCARYCQUKRggGAgwiDY54I5ABBwpFBVEGAz+AWD+JiwUGDV0FXQGwAapGia4iBwwGWgeEhSq/CwgHDpgkCwO/sLNxyGabEAgJCwSHAcaEDn4/hMPFAUhvA80KP9/GCgoFDkYApA5tv8AnBLHGAUoBlyKAzrKQYs3zx2kMPm1CDhF6UECAE4QBqiVQAqkAgIsQnOCrpm8dtoQBlNHrI7DELwJwlv8FPCYETsF/hBQYmOjsAIAHRgj9CjimYqxP/yANAQBhDKFm80aSaIZPHyEB7UQk83RgwLWnUUl0+kXIgAIHD0MKQHAJ4rpOPkeYLbArnFFZVgQkVSpiAJYiKEVcWpRLgVwzDga02cdnE1dM/LQJGOKsCFS3bpsdOOQ4G4EBDP+BRTCX7r4lDyDoK3LxYsMGAFBBwEmgNABBW1kOO3Zgdc6WEH6gLWDxYgMzKHPnW72gWy4ICzrTbWLCQBDP0KP3eT7Cr/Tr2PuZEJS9u/fv4MOLH1/3DowBTgrLQK9CALQR7lewnxEfTKcRh8SoYAD4xpQs1AkRIBncwdBMDxXdQcj/fQIU6IxVO1yWQoPmLfFeg3g0NIKESwiyGC28xTKChiCS8OEA6pWQgAMNPBCHa4A04IAVnUA4WRde5YNLjq3gaMVMGcoIgTVRbJMAVDICFMBXosXBgAOXrJjkkg40qcADLIaTJYsOiIhNAxAMgJkD+GD5wFcPIKBCAl244cxWP4AlhZrVxHSJJHYuqcWSd0ZRESEHTPTjWbMgQM6RxjwWyBnhWCHTY4qKYEwCauaogIg5HvCJEjIFkJEAnyr3UmyxQSaCJI3t4xche636GQOuZvhKF8ZUA8sAyI3BTEmHdbIrSzNBAJmvIt73zyyH/YPCbm++ZepHcgWAAFuaXjIt6wPVSkutLgXNMksRxsxiTVG/OtOrriuZy8CKw6L7EkvIsiTqJqQaZQQDd0QLpBaGNqAmv8r862/A3c7qyQKH3FppQAPwk80xCfxATMOS/uNiJweoOc2cniBQjbTGwbRmT2PklgB/Wyhw1KGmDukpNC6HKULMYpLsbRegKjHLAyuGGAcoXfTKc0pAn6GysJ0IMHQXqfAcJjsJpCSvCgWYUXU+BwhQRiYIOFH11c8FEXYuUpBNjiw1h5RH1mqHVOMYY4lNtihlIEJMXZCQcrXbBIwRxAD33Uq2J4PPMC95iNdweOKMN+7445BfFwIAOw==");
exit();
}
function show_today_posters()
{
global $ibforums, $DB, $std;
$this->output .= $this->html->page_title( $ibforums->lang['todays_posters'] );
$this->output .= $this->html->top_poster_header();
$time_high = time();
$time_low = $time_high - (60*60*24);
//--------------------------------------------
// Query the DB
//--------------------------------------------
$DB->query("SELECT COUNT(pid) as count FROM ibf_posts WHERE post_date < $time_high and post_date > $time_low");
$todays_posts = $DB->fetch_row();
if ($todays_posts['count'] > 0)
{
$DB->query("SELECT COUNT(p.pid) as tpost, m.id, m.name, m.joined, m.posts FROM ibf_posts p, ibf_members m "
."WHERE m.id > 0 AND m.id=p.author_id and post_date < $time_high and post_date > $time_low GROUP BY p.author_id ORDER BY tpost DESC LIMIT 0,10");
if ( $DB->get_num_rows() )
{
while ($info = $DB->fetch_row())
{
$info['total_today_posts'] = $todays_posts['count'];
if ($todays_posts['count'] > 0 and $info['tpost'] > 0)
{
$info['today_pct'] = sprintf( '%.2f', ( $info['tpost'] / $todays_posts['count'] ) * 100 );
}
$info['joined'] = $std->get_date( $info['joined'], 'JOINED' );
$this->output .= $this->html->top_poster_row( $info );
}
}
else
{
$this->output .= $this->html->top_poster_no_info();
}
}
else
{
$this->output .= $this->html->top_poster_no_info();
}
$this->output .= $this->html->top_poster_footer( $todays_posts['count'] );
$this->page_title = $ibforums->lang['top_poster_title'];
$this->nav = array( $ibforums->lang['top_poster_title'] );
}
//------------------------------------------------------------------------------------------------
function parse_member( $member )
{
global $ibforums, $std;
$member['msg_icon'] = "<a href='{$this->base_url}&act=Msg&CODE=04&MID={$member['id']}'><{P_MSG}></a>";
if (!$member['hide_email'])
{
$member['email_icon'] = "<a href='{$this->base_url}&act=Mail&CODE=00&MID={$member['id']}'><{P_EMAIL}></a>";
}
else
{
$member['email_icon'] = '&nbsp;';
}
if ($member['icq_number'])
{
$member['icq_icon'] = "<a href=\"javascript:PopUp('{$this->base_url}&act=ICQ&MID={$member['id']}','Pager','450','330','0','1','1','1')\"><{P_ICQ}></a>";
}
else
{
$member['icq_iconn'] = '&nbsp;';
}
if ($member['aim_name'])
{
$member['aol_icon'] = "<a href=\"javascript:PopUp('{$this->base_url}&act=AOL&MID={$member['id']}','Pager','450','330','0','1','1','1')\"><{P_AOL}></a>";
}
else
{
$member['aol_icon'] = '&nbsp;';
}
return $member;
}
}
?>
+68 -34
View File
@@ -2,10 +2,10 @@
/*
+--------------------------------------------------------------------------
| IBFORUMS v1
| Invision Board v1.1
| ========================================
| by Matthew Mecham and David Baxter
| (c) 2001,2002 IBForums
| by Matthew Mecham
| (c) 2001,2002 Invision Power Services
| http://www.ibforums.com
| ========================================
| Web: http://www.ibforums.com
@@ -33,6 +33,7 @@ class tracker {
var $forum = array();
var $topic = array();
var $category = array();
var $type = 'topic';
function tracker($is_sub=0) {
@@ -54,26 +55,26 @@ class tracker {
// Check the input
//------------------------------------------------------
$ibforums->input['t'] = $std->is_number($ibforums->input['t']);
$ibforums->input['f'] = $std->is_number($ibforums->input['f']);
if ($ibforums->input['t'] < 0 or $ibforums->input['f'] < 0)
if ($ibforums->input['type'] == 'forum')
{
if ($is_sub != 1)
{
$std->Error( array( LEVEL => 1, MSG => 'missing_files') );
}
else
{
return;
}
$this->type = 'forum';
}
$ibforums->input['t'] = intval($ibforums->input['t']);
$ibforums->input['f'] = intval($ibforums->input['f']);
//------------------------------------------------------
// Get the forum info based on the forum ID, get the category name, ID, and get the topic details
//------------------------------------------------------
$DB->query("SELECT t.tid, f.id as fid, f.read_perms, f.password FROM ibf_topics t, ibf_forums f WHERE t.tid='".$ibforums->input['t']."' AND t.forum_id=f.id");
if ($this->type == 'forum')
{
$DB->query("SELECT f.id as fid, f.read_perms, f.password FROM ibf_forums f WHERE f.id='".$ibforums->input['f']."'");
}
else
{
$DB->query("SELECT t.tid, f.id as fid, f.read_perms, f.password FROM ibf_topics t, ibf_forums f WHERE t.tid='".$ibforums->input['t']."' AND t.forum_id=f.id");
}
$this->topic = $DB->fetch_row();
@@ -99,16 +100,19 @@ class tracker {
// Error out if we can not find the topic
//------------------------------------------------------
if (!$this->topic['tid'])
if ($this->type != 'forum')
{
if ($is_sub != 1)
{
$std->Error( array( LEVEL => 1, MSG => 'missing_files') );
}
else
{
return;
}
if (!$this->topic['tid'])
{
if ($is_sub != 1)
{
$std->Error( array( LEVEL => 1, MSG => 'missing_files') );
}
else
{
return;
}
}
}
$this->base_url = "{$ibforums->vars['board_url']}/index.{$ibforums->vars['php_ext']}?s={$ibforums->session_id}";
@@ -165,7 +169,14 @@ class tracker {
// Have we already subscribed?
//------------------------------------------------------
$DB->query("SELECT trid from ibf_tracker WHERE topic_id='".$this->topic['tid']."' AND member_id='".$ibforums->member['id']."'");
if ($this->type == 'forum')
{
$DB->query("SELECT frid from ibf_forum_tracker WHERE forum_id='".$this->topic['fid']."' AND member_id='".$ibforums->member['id']."'");
}
else
{
$DB->query("SELECT trid from ibf_tracker WHERE topic_id='".$this->topic['tid']."' AND member_id='".$ibforums->member['id']."'");
}
if ( $DB->get_num_rows() )
{
@@ -183,17 +194,40 @@ class tracker {
// Add it to the DB
//------------------------------------------------------
$db_string = $DB->compile_db_insert_string( array (
'member_id' => $ibforums->member['id'],
'topic_id' => $this->topic['tid'],
'start_date' => time(),
) );
$DB->query("INSERT INTO ibf_tracker (" .$db_string['FIELD_NAMES']. ") VALUES (". $db_string['FIELD_VALUES'] .")");
if ($this->type == 'forum')
{
$db_string = $DB->compile_db_insert_string( array (
'member_id' => $ibforums->member['id'],
'forum_id' => $this->topic['fid'],
'start_date' => time(),
) );
$DB->query("INSERT INTO ibf_forum_tracker (" .$db_string['FIELD_NAMES']. ") VALUES (". $db_string['FIELD_VALUES'] .")");
}
else
{
$db_string = $DB->compile_db_insert_string( array (
'member_id' => $ibforums->member['id'],
'topic_id' => $this->topic['tid'],
'start_date' => time(),
) );
$DB->query("INSERT INTO ibf_tracker (" .$db_string['FIELD_NAMES']. ") VALUES (". $db_string['FIELD_VALUES'] .")");
}
if ($is_sub != 1)
{
$print->redirect_screen( $ibforums->lang['sub_added'], "act=ST&f={$this->topic['fid']}&t={$this->topic['tid']}&st={$ibforums->input['st']}" );
if ($this->type == 'forum')
{
$print->redirect_screen( $ibforums->lang['sub_added'], "act=SF&f={$this->topic['fid']}" );
}
else
{
$print->redirect_screen( $ibforums->lang['sub_added'], "act=ST&f={$this->topic['fid']}&t={$this->topic['tid']}&st={$ibforums->input['st']}" );
}
}
else
{
+2507 -1458
View File
File diff suppressed because it is too large. Load diff