Version 1.1.1
This commit is contained in:
1 parent
aabfdc1f57
commit
7ef3d1712a
179 files changed
+57457
-44972
No files matched your search
@@ -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( " " , "40%" );
|
||||
$SKIN->td_header[] = array( " " , "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
+2324
-1959
File diff suppressed because it is too large.
Load diff
+1269
-1081
File diff suppressed because it is too large.
Load diff
+278
-272
@@ -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( " " , "20%" );
|
||||
$SKIN->td_header[] = array( " " , "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( " " , "20%" );
|
||||
$SKIN->td_header[] = array( " " , "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
@@ -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'],
|
||||
" ", " ",
|
||||
) );
|
||||
|
||||
$ADMIN->html .= $SKIN->end_table();
|
||||
|
||||
//+-----------------------------------------------------------
|
||||
|
||||
$ADMIN->html .= $SKIN->add_td_spacer();
|
||||
|
||||
//+-----------------------------------------------------------
|
||||
|
||||
$ADMIN->html .= $SKIN->start_form();
|
||||
|
||||
$SKIN->td_header[] = array( " " , "40%" );
|
||||
$SKIN->td_header[] = array( " " , "30%" );
|
||||
$SKIN->td_header[] = array( " " , "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( " " , "40%" );
|
||||
$SKIN->td_header[] = array( " " , "30%" );
|
||||
$SKIN->td_header[] = array( " " , "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();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
+1071
-1002
File diff suppressed because it is too large.
Load diff
+2422
-1582
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
+283
-281
@@ -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( " " , "40%" );
|
||||
$SKIN->td_header[] = array( " " , "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( " " , "40%" );
|
||||
$SKIN->td_header[] = array( " " , "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();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
@@ -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( " " , "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( " " , "60%" );
|
||||
$SKIN->td_header[] = array( " " , "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( " " , "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( " " , "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( " " , "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 (" ",
|
||||
"<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>",
|
||||
" ",
|
||||
) );
|
||||
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
@@ -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( " " , "40%" );
|
||||
$SKIN->td_header[] = array( " " , "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( " " , "40%" );
|
||||
$SKIN->td_header[] = array( " " , "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 = ' ';
|
||||
$req = ' ';
|
||||
$regi = ' ';
|
||||
|
||||
"<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();
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
@@ -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();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
@@ -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 = " <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> </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( " " , "60%" );
|
||||
$SKIN->td_header[] = array( " " , "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( "/<\{(\S+)\}>/", $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( " " , "40%" );
|
||||
$SKIN->td_header[] = array( " " , "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( "<" , "<" , $html);
|
||||
$html = str_replace( ">" , ">" , $html);
|
||||
$html = str_replace( "\"", """, $html);
|
||||
|
||||
if ($HTTP_GET_VARS['hl'] != "")
|
||||
{
|
||||
$hl = urldecode(stripslashes($HTTP_GET_VARS['hl']));
|
||||
|
||||
$hl = str_replace( "<" , "<" , $hl);
|
||||
$hl = str_replace( ">" , ">" , $hl);
|
||||
$hl = str_replace( "\"", """, $hl);
|
||||
|
||||
$html = str_replace( $hl, "<span style='color:red;font-weight:bold;background-color:yellow'>$hl</span>", $html );
|
||||
}
|
||||
|
||||
$html = preg_replace( "!<\!--(.+?)(//)?-->!s" , "<!<span style='color:red'>--\\1--\\2</span>>", $html );
|
||||
$html = preg_replace( "#<([^&<>]+)>#s" , "<<span style='color:blue'>\\1</span>>" , $html ); //Matches <tag>
|
||||
$html = preg_replace( "#<([^&<>]+)=#s" , "<<span style='color:blue'>\\1</span>=" , $html ); //Matches <tag
|
||||
$html = preg_replace( "#</([^&]+)>#s" , "</<span style='color:blue'>\\1</span>>" , $html ); //Matches </tag>
|
||||
$html = preg_replace( "!=("|')([^<>])("|')(\s|>)!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;
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
+1678
-1439
File diff suppressed because it is too large.
Load diff
+1042
-1160
File diff suppressed because it is too large.
Load diff
@@ -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( ' ',
|
||||
"<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 = " ";
|
||||
|
||||
//+---------------------
|
||||
|
||||
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( ' ',
|
||||
"<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( " " , "40%" );
|
||||
$SKIN->td_header[] = array( " " , "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'] ).' '.
|
||||
$SKIN->form_dropdown( "from_day" , $this->make_day() , $old_date['mday'] ).' '.
|
||||
$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'] ).' '.
|
||||
$SKIN->form_dropdown( "to_day" , $this->make_day() , $new_date['mday'] ).' '.
|
||||
$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
+1923
-1557
File diff suppressed because it is too large.
Load diff
@@ -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( "!</textarea>!", "/textarea>", stripslashes($HTTP_POST_VARS['template']) );
|
||||
|
||||
if ( ! preg_match( "/<% BOARD %>/", $tmpl ) )
|
||||
{
|
||||
$ADMIN->error("You cannot remove the <% BOARD %> tag silly!");
|
||||
}
|
||||
|
||||
if ( ! preg_match( "/<% COPYRIGHT %>/", $tmpl ) )
|
||||
{
|
||||
$ADMIN->error("You cannot remove the <% 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( " " , "20%" );
|
||||
$SKIN->td_header[] = array( " " , "80%" );
|
||||
|
||||
//+-------------------------------
|
||||
|
||||
$row['template'] = preg_replace( "/\/textarea>/", "</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( " " , "40%" );
|
||||
$SKIN->td_header[] = array( " " , "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( "!</textarea>!", "/textarea>", stripslashes($HTTP_POST_VARS['template']) );
|
||||
|
||||
if ( ! preg_match( "/<% BOARD %>/", $tmpl ) )
|
||||
{
|
||||
$ADMIN->error("You cannot remove the <% BOARD %> tag silly!");
|
||||
}
|
||||
|
||||
if ( ! preg_match( "/<% COPYRIGHT %>/", $tmpl ) )
|
||||
{
|
||||
$ADMIN->error("You cannot remove the <% 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( " " , "20%" );
|
||||
$SKIN->td_header[] = array( " " , "80%" );
|
||||
|
||||
//+-------------------------------
|
||||
|
||||
$row['template'] = preg_replace( "/\/textarea>/", "</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( " " , "40%" );
|
||||
$SKIN->td_header[] = array( " " , "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
@@ -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",
|
||||
);
|
||||
|
||||
|
||||
?>
|
||||
+1073
-919
File diff suppressed because it is too large.
Load diff
@@ -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.',
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
?>
|
||||
Reference in new issue
Block a user