Version 2.0.0

This commit is contained in:
Neo committed 2025-12-19 00:19:56 -08:00
1 parent 5699abfc0e
commit 0eecc172d9
696 files changed
+120723 -77160

No files matched your search

File diff suppressed because it is too large. Load diff
+336
View File
@@ -0,0 +1,336 @@
<?php
/*
+--------------------------------------------------------------------------
| Invision Power Board v2.0.0
| =============================================
| by Matthew Mecham
| (c) 2001 - 2004 Invision Power Services, Inc.
| http://www.invisionpower.com
| =============================================
| Web: http://www.invisionboard.com
| Time: Tue, 21 Sep 2004 16:34:28 GMT
| Release: 150aa7a702c3c8b6f6eb90ad49305d2f
| Licence Info: http://www.invisionboard.com/?license
+---------------------------------------------------------------------------
|
| > Admin Logs Stuff
| > Module written by Matt Mecham
| > Date started: 11nd September 2002
|
| > Module Version Number: 1.0.0
| > DBA Checked: Mon 24th May 2004
+--------------------------------------------------------------------------
*/
if ( ! defined( 'IN_ACP' ) )
{
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded 'admin.php'.";
exit();
}
class ad_adminlogs
{
var $base_url;
var $colours = array();
function auto_run()
{
global $ibforums, $DB, $std;
//-----------------------------------------
// Kill globals - globals bad, Homer good.
//-----------------------------------------
$tmp_in = array_merge( $_GET, $_POST, $_COOKIE );
foreach ( $tmp_in as $k => $v )
{
unset($$k);
}
//-----------------------------------------
// Make sure we're a root admin, or else!
//-----------------------------------------
if ($ibforums->member['mgroup'] != $ibforums->vars['admin_group'])
{
$ibforums->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($ibforums->input['code'])
{
case 'view':
$this->view();
break;
case 'remove':
$this->remove();
break;
//-----------------------------------------
default:
$this->list_current();
break;
}
}
//-----------------------------------------
// Remove archived files
//-----------------------------------------
function view()
{
global $ibforums, $DB, $std;
$start = $ibforums->input['st'] ? $ibforums->input['st'] : 0;
$ibforums->admin->page_detail = "Viewing all actions by a administrator";
$ibforums->admin->page_title = "Administration Logs Manager";
if ($ibforums->input['search_string'] == "")
{
$DB->simple_construct( array( 'select' => 'COUNT(id) as count', 'from' => 'admin_logs', 'where' => "member_id=".intval($ibforums->input['mid']) ) );
$DB->simple_exec();
$row = $DB->fetch_row();
$row_count = $row['count'];
$query = "&act=adminlog&mid={$ibforums->input['mid']}&code=view";
$DB->cache_add_query( 'adminlogs_view_one', array( 'mid' => $ibforums->input['mid'], 'limit_a' => $start ) );
$DB->cache_exec_query();
}
else
{
$ibforums->input['search_string'] = urldecode($ibforums->input['search_string']);
$dbq = "m.".$ibforums->input['search_type']." LIKE '%".$ibforums->input['search_string']."%'";
$DB->simple_construct( array( 'select' => 'COUNT(m.id) as count', 'from' => 'admin_logs m', 'where' => $dbq ) );
$DB->simple_exec();
$row_count = $row['count'];
$query = "&act=adminlog&code=view&search_type={$ibforums->input['search_type']}&search_string=".urlencode($ibforums->input['search_string']);
$DB->cache_add_query( 'adminlogs_view_two', array( 'dbq' => $dbq, 'limit_a' => $start ) );
$DB->cache_exec_query();
}
$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' => $ibforums->base_url.$query,
)
);
$ibforums->admin->page_detail = "You may view and remove actions performed by your administrators";
$ibforums->admin->page_title = "Administrator Logs Manager";
//-----------------------------------------
$ibforums->adskin->td_header[] = array( "Member Name" , "20%" );
$ibforums->adskin->td_header[] = array( "Action Perfomed" , "40%" );
$ibforums->adskin->td_header[] = array( "Time of action" , "20%" );
$ibforums->adskin->td_header[] = array( "IP address" , "20%" );
$ibforums->html .= $ibforums->adskin->start_table( "Saved Admin Logs" );
$ibforums->html .= $ibforums->adskin->add_td_basic($links, 'center', 'pformstrip');
if ( $DB->get_num_rows() )
{
while ( $row = $DB->fetch_row() )
{
$row['ctime'] = $ibforums->admin->get_date( $row['ctime'], 'LONG' );
$ibforums->html .= $ibforums->adskin->add_td_row( array( "<b>{$row['name']}</b>",
"<span style='color:{$this->colours[$row['act']]}'>{$row['note']}</span>",
"{$row['ctime']}",
"{$row['ip_address']}",
) );
}
}
else
{
$ibforums->html .= $ibforums->adskin->add_td_basic("<center>No results</center>");
}
$ibforums->html .= $ibforums->adskin->add_td_basic($links, 'center', 'pformstrip');
$ibforums->html .= $ibforums->adskin->end_table();
//-----------------------------------------
//-------------------------------
$ibforums->admin->output();
}
//-----------------------------------------
// Remove archived files
//-----------------------------------------
function remove()
{
global $ibforums, $DB, $std;
if ($ibforums->input['mid'] == "")
{
$ibforums->admin->error("You did not select a member ID to remove by!");
}
$DB->simple_exec_query( array( 'delete' => 'admin_logs', 'where' => "member_id=".$ibforums->input['mid'] ) );
$std->boink_it($ibforums->base_url."&act=adminlog");
}
//-----------------------------------------
// SHOW ALL LANGUAGE PACKS
//-----------------------------------------
function list_current()
{
global $ibforums, $DB, $std;
$form_array = array();
$ibforums->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).";
$ibforums->admin->page_title = "Administration Logs Manager";
//-----------------------------------------
// LAST FIVE ACTIONS
//-----------------------------------------
$DB->cache_add_query( 'adminlogs_view_list_current', array() );
$DB->cache_exec_query();
$ibforums->adskin->td_header[] = array( "Member Name" , "20%" );
$ibforums->adskin->td_header[] = array( "Action Perfomed" , "40%" );
$ibforums->adskin->td_header[] = array( "Time of action" , "20%" );
$ibforums->adskin->td_header[] = array( "IP address" , "20%" );
$ibforums->html .= $ibforums->adskin->start_table( "Last 5 Admin Actions" );
if ( $DB->get_num_rows() )
{
while ( $row = $DB->fetch_row() )
{
$row['ctime'] = $ibforums->admin->get_date( $row['ctime'], 'LONG' );
$ibforums->html .= $ibforums->adskin->add_td_row( array( "<b>{$row['name']}</b>",
"<span style='color:{$this->colours[$row['act']]}'>{$row['note']}</span>",
"{$row['ctime']}",
"{$row['ip_address']}",
) );
}
}
else
{
$ibforums->html .= $ibforums->adskin->add_td_basic("<center>No results</center>");
}
$ibforums->html .= $ibforums->adskin->end_table();
//-----------------------------------------
$ibforums->adskin->td_header[] = array( "Member Name" , "30%" );
$ibforums->adskin->td_header[] = array( "Actions Perfomed" , "20%" );
$ibforums->adskin->td_header[] = array( "View all by member" , "20%" );
$ibforums->adskin->td_header[] = array( "Remove all by member" , "30%" );
$ibforums->html .= $ibforums->adskin->start_table( "Saved Admininstration Logs" );
$DB->cache_add_query( 'adminlogs_view_list_current_two', array() );
$DB->cache_exec_query();
while ( $r = $DB->fetch_row() )
{
$ibforums->html .= $ibforums->adskin->add_td_row( array( "<b>{$r['name']}</b>",
"<center>{$r['act_count']}</center>",
"<center><a href='".$ibforums->adskin->base_url."&act=adminlog&code=view&mid={$r['member_id']}'>View</a></center>",
"<center><a href='".$ibforums->adskin->base_url."&act=adminlog&code=remove&mid={$r['member_id']}'>Remove</a></center>",
) );
}
$ibforums->html .= $ibforums->adskin->end_table();
//-----------------------------------------
//-------------------------------
$ibforums->html .= $ibforums->adskin->start_form( array( 1 => array( 'code' , 'view' ),
2 => array( 'act' , 'adminlog' ),
) );
$ibforums->adskin->td_header[] = array( "&nbsp;" , "40%" );
$ibforums->adskin->td_header[] = array( "&nbsp;" , "60%" );
$ibforums->html .= $ibforums->adskin->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' ),
);
//-----------------------------------------
$ibforums->html .= $ibforums->adskin->add_td_row( array( "<b>Search for...</b>" ,
$ibforums->adskin->form_input( "search_string")
) );
$ibforums->html .= $ibforums->adskin->add_td_row( array( "<b>Search in...</b>" ,
$ibforums->adskin->form_dropdown( "search_type", $form_array)
) );
$ibforums->html .= $ibforums->adskin->end_form("Search");
$ibforums->html .= $ibforums->adskin->end_table();
//-----------------------------------------
//-------------------------------
$ibforums->admin->output();
}
}
?>
File diff suppressed because it is too large. Load diff
+382
View File
@@ -0,0 +1,382 @@
<?php
/*
+--------------------------------------------------------------------------
| Invision Power Board v2.0.0
| =============================================
| by Matthew Mecham
| (c) 2001 - 2004 Invision Power Services, Inc.
| http://www.invisionpower.com
| =============================================
| Web: http://www.invisionboard.com
| Time: Tue, 21 Sep 2004 16:34:28 GMT
| Release: 150aa7a702c3c8b6f6eb90ad49305d2f
| Licence Info: http://www.invisionboard.com/?license
+---------------------------------------------------------------------------
|
| > Email Error Logs Stuff
| > Module written by Matt Mecham
| > Date started: 7th April 2004
|
| > Module Version Number: 1.0.0
| > DBA Checked: Mon 24th May 2004
+--------------------------------------------------------------------------
*/
if ( ! defined( 'IN_ACP' ) )
{
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded 'admin.php'.";
exit();
}
class ad_emailerror
{
function auto_run()
{
global $ibforums, $DB, $std;
//-----------------------------------------
// Kill globals - globals bad, Homer good.
//-----------------------------------------
$tmp_in = array_merge( $_GET, $_POST, $_COOKIE );
foreach ( $tmp_in as $k => $v )
{
unset($$k);
}
//-----------------------------------------
// Make sure we're a root admin, or else!
//-----------------------------------------
if ($ibforums->member['mgroup'] != $ibforums->vars['admin_group'])
{
$ibforums->admin->error("Sorry, these functions are for the root admin group only");
}
switch($ibforums->input['code'])
{
case 'list':
$this->list_current();
break;
case 'remove':
$this->remove_entries();
break;
case 'viewemail':
$this->view_email();
break;
//-----------------------------------------
default:
$this->list_current();
break;
}
}
//-----------------------------------------
// View a single email.
//-----------------------------------------
function view_email()
{
global $ibforums, $DB, $std;
if ($ibforums->input['id'] == "")
{
$ibforums->admin->error("Could not resolve the email ID, please try again");
}
$id = intval($ibforums->input['id']);
$DB->simple_construct( array( 'select' => '*', 'from' => 'mail_error_logs', 'where' => "mlog_id=$id" ) );
$DB->simple_exec();
if ( ! $row = $DB->fetch_row() )
{
$ibforums->admin->error("Could not resolve the email ID, please try again ($id)");
}
$ibforums->adskin->td_header[] = array( "&nbsp;" , "100%" );
$ibforums->html .= $ibforums->adskin->start_table( $row['mlog_subject'] );
$row['mlog_date'] = $ibforums->admin->get_date( $row['mlog_date'], 'LONG' );
$row['mlog_content'] = nl2br($row['mlog_content']);
$row['mlog_msg'] = $row['mlog_msg'] ? $row['mlog_msg'] : '<em>No Info</em>';
$row['mlog_code'] = $row['mlog_code'] ? $row['mlog_code'] : '<em>No Info</em>';
$row['mlog_smtp_error'] = $row['mlog_smtp_error'] ? $row['mlog_smtp_error'] : '<em>No Info</em>';
$ibforums->html .= $ibforums->adskin->add_td_row( array(
"<strong>From:</strong> &lt;{$row['mlog_from']}&gt;
<br /><strong>To:</strong> &lt;{$row['mlog_to']}&gt;
<br /><strong>Sent:</strong> {$row['mlog_date']}
<br /><strong>Subject:</strong> {$row['mlog_subject']}
<hr />
<br />{$row['mlog_content']}....
<hr />
<br />IPB ERROR: {$row['mlog_msg']}
<br />SMTP CODE: {$row['mlog_code']}
<br />SMTP ERROR: {$row['mlog_smtp_error']}
"
) );
$ibforums->html .= $ibforums->adskin->end_table();
$ibforums->admin->print_popup();
}
//-----------------------------------------
// Remove row(s)
//-----------------------------------------
function remove_entries()
{
global $ibforums, $DB, $std;
if ( $ibforums->input['type'] == 'all' )
{
$DB->simple_exec_query( array( 'delete' => 'mail_error_logs' ) );
}
else
{
$ids = array();
foreach ($ibforums->input as $k => $v)
{
if ( preg_match( "/^id_(\d+)$/", $k, $match ) )
{
if ($ibforums->input[ $match[0] ])
{
$ids[] = $match[1];
}
}
}
//-----------------------------------------
if ( count($ids) < 1 )
{
$ibforums->admin->error("You did not select any email log entries to approve or delete");
}
$DB->simple_exec_query( array( 'delete' => 'mail_error_logs', 'where' => "mlog_id IN (".implode(',', $ids ).")" ) );
}
$ibforums->admin->save_log("Removed email error log entries");
$std->boink_it($ibforums->base_url."&act=emailerror");
}
//-----------------------------------------
// SHOW EMAIL ERROR LOGS
//-----------------------------------------
function list_current()
{
global $ibforums, $DB, $std;
$ibforums->html .= $ibforums->adskin->js_pop_win();
$form_array = array();
$start = intval($ibforums->input['st']);
$ibforums->admin->page_detail = "Stored email error logs";
$ibforums->admin->page_title = "Email Error Logs Manager";
//-----------------------------------------
// Check URL parameters
//-----------------------------------------
$url_query = array();
$db_query = array();
if ( $ibforums->input['type'] != "" )
{
$ibforums->admin->page_title .= " (Search Results)";
switch( $ibforums->input['type'] )
{
case 'subject':
$string = urldecode($ibforums->input['string']);
if ( $string == "" )
{
$ibforums->admin->error("You must enter something to search by");
}
$url_query[] = 'type='.$ibforums->input['type'];
$url_query[] = 'string='.urlencode($string);
$db_query[] = $ibforums->input['match'] == 'loose' ? "mlog_subject LIKE '%{$string}%'" : "mlog_subject='{$string}'";
break;
case 'email_from':
$string = urldecode($ibforums->input['string']);
if ( $string == "" )
{
$ibforums->admin->error("You must enter something to search by");
}
$url_query[] = 'type='.$ibforums->input['type'];
$url_query[] = 'string='.urlencode($string);
$db_query[] = $ibforums->input['match'] == 'loose' ? "mlog_from LIKE '%{$string}%'" : "mlog_from='{$string}'";
break;
case 'email_to':
$string = urldecode($ibforums->input['string']);
if ( $string == "" )
{
$ibforums->admin->error("You must enter something to search by");
}
$url_query[] = 'type='.$ibforums->input['type'];
$url_query[] = 'string='.urlencode($string);
$db_query[] = $ibforums->input['match'] == 'loose' ? "mlog_to LIKE '%{$string}%'" : "mlog_to='{$string}'";
break;
case 'error':
$string = urldecode($ibforums->input['string']);
if ( $string == "" )
{
$ibforums->admin->error("You must enter something to search by");
}
$url_query[] = 'type='.$ibforums->input['type'];
$url_query[] = 'string='.urlencode($string);
$db_query[] = $ibforums->input['match'] == 'loose' ? "mlog_msg LIKE '%{$string}%' or mlog_smtp_msg LIKE '%{$string}%'" : "mlog_msg='{$string} or mlog_smtp_msg='{$string}'";
break;
default:
//
break;
}
}
//-----------------------------------------
// LIST 'EM
//-----------------------------------------
$dbe = "";
$url = "";
if ( count($db_query) > 0 )
{
$dbe = implode(' AND ', $db_query );
}
if ( count($url_query) > 0 )
{
$url = '&'.implode( '&', $url_query);
}
$DB->simple_construct( array( 'select' => 'count(*) as cnt', 'from' => 'mail_error_logs', 'where' => $dbe ) );
$DB->simple_exec();
$count = $DB->fetch_row();
$links = $std->build_pagelinks( array( 'TOTAL_POSS' => $count['cnt'],
'PER_PAGE' => 25,
'CUR_ST_VAL' => $start,
'L_SINGLE' => "Single Page",
'L_MULTI' => "Pages: ",
'BASE_URL' => $ibforums->base_url.'&act=emailerror'.$url,
)
);
$DB->simple_construct( array( 'select' => '*', 'from' => 'mail_error_logs', 'where' => $dbe, 'order' => 'mlog_date DESC', 'limit' => array( $start, 25 ) ) );
$DB->simple_exec();
$ibforums->html .= $ibforums->adskin->start_form( array( 1 => array( 'code' , 'remove' ),
2 => array( 'act' , 'emailerror' ),
) );
$ibforums->adskin->td_header[] = array( "&nbsp;" , "1%" );
$ibforums->adskin->td_header[] = array( "To" , "20%" );
$ibforums->adskin->td_header[] = array( "Subject" , "20%" );
$ibforums->adskin->td_header[] = array( "Error MSG" , "30%" );
$ibforums->adskin->td_header[] = array( "Date" , "20%" );
$ibforums->html .= $ibforums->adskin->start_table( "Logged Emails Errors" );
if ( $DB->get_num_rows() )
{
while ( $row = $DB->fetch_row() )
{
$row['mlog_date'] = $ibforums->admin->get_date( $row['mlog_date'], 'SHORT' );
$ibforums->html .= $ibforums->adskin->add_td_row( array(
"<center><input type='checkbox' class='checkbox' name='id_{$row['mlog_id']}' value='1' /></center>",
'<b>'.$row['mlog_to'].'</b>',
"<a href='javascript:pop_win(\"&act=emailerror&code=viewemail&id={$row['mlog_id']}\", \"{$row['mlog_id']}\",400,350)' title='Read email'>".$row['mlog_subject']."</a>",
$row['mlog_msg'].'<br />'.$row['mlog_code']. '&nbsp;'.$row['mlog_smtp_msg'],
$row['mlog_date'],
) );
}
}
else
{
$ibforums->html .= $ibforums->adskin->add_td_basic("<center>No results</center>");
}
$ibforums->html .= $ibforums->adskin->add_td_basic('<div style="float:left;width:auto"><input type="submit" value="Remove Checked" id="button" />&nbsp;<input type="checkbox" id="checkbox" name="type" value="all" />&nbsp;Remove all?</div><div align="right">'.$links.'</div></form>', 'left', 'pformstrip');
$ibforums->html .= $ibforums->adskin->end_table();
//-----------------------------------------
//-------------------------------
$ibforums->html .= $ibforums->adskin->start_form( array( 1 => array( 'code' , 'list' ),
2 => array( 'act' , 'emailerror' ),
) );
$ibforums->adskin->td_header[] = array( "&nbsp;" , "100%" );
$ibforums->html .= $ibforums->adskin->start_table( "Search Email Error Logs" );
$form_array = array(
0 => array( 'subject' , 'Email Subject' ),
2 => array( 'email_from' , 'From Email Address' ),
3 => array( 'email_to' , 'To Email Address' ),
4 => array( 'error' , 'Error Message' ),
);
$type_array = array(
0 => array( 'exact' , 'is exactly' ),
1 => array( 'loose' , 'contains' ),
);
//-----------------------------------------
$ibforums->html .= $ibforums->adskin->add_td_row( array( "<b>Search where</b> &nbsp;"
. $ibforums->adskin->form_dropdown( "type" , $form_array, $_POST['type']) ." "
. $ibforums->adskin->form_dropdown( "match", $type_array, $_POST['match']) ." "
. $ibforums->adskin->form_input( "string", $_POST['string']),
) );
$ibforums->html .= $ibforums->adskin->end_form("Search");
$ibforums->html .= $ibforums->adskin->end_table();
//-----------------------------------------
//-------------------------------
$ibforums->admin->nav[] = array( 'act=emailerror', 'Email Error Logs (Show all)' );
$ibforums->admin->output();
}
}
?>
+494
View File
@@ -0,0 +1,494 @@
<?php
/*
+--------------------------------------------------------------------------
| Invision Power Board v2.0.0
| =============================================
| by Matthew Mecham
| (c) 2001 - 2004 Invision Power Services, Inc.
| http://www.invisionpower.com
| =============================================
| Web: http://www.invisionboard.com
| Time: Tue, 21 Sep 2004 16:34:28 GMT
| Release: 150aa7a702c3c8b6f6eb90ad49305d2f
| Licence Info: http://www.invisionboard.com/?license
+---------------------------------------------------------------------------
|
| > Email Logs Stuff
| > Module written by Matt Mecham
| > Date started: 11nd September 2002
|
| > Module Version Number: 1.0.0
| > DBA Checked: Mon 24th May 2004
+--------------------------------------------------------------------------
*/
if ( ! defined( 'IN_ACP' ) )
{
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded 'admin.php'.";
exit();
}
class ad_emaillogs
{
var $base_url;
var $colours = array();
function auto_run()
{
global $ibforums, $DB, $std;
//-----------------------------------------
// Kill globals - globals bad, Homer good.
//-----------------------------------------
$tmp_in = array_merge( $_GET, $_POST, $_COOKIE );
foreach ( $tmp_in as $k => $v )
{
unset($$k);
}
//-----------------------------------------
// Make sure we're a root admin, or else!
if ($ibforums->member['mgroup'] != $ibforums->vars['admin_group'])
{
$ibforums->admin->error("Sorry, these functions are for the root admin group only");
}
switch($ibforums->input['code'])
{
case 'list':
$this->list_current();
break;
case 'remove':
$this->remove_entries();
break;
case 'viewemail':
$this->view_email();
break;
//-----------------------------------------
default:
$this->list_current();
break;
}
}
//-----------------------------------------
// View a single email.
//-----------------------------------------
function view_email()
{
global $ibforums, $DB, $std;
if ($ibforums->input['id'] == "")
{
$ibforums->admin->error("Could not resolve the email ID, please try again");
}
$id = intval($ibforums->input['id']);
$DB->cache_add_query( 'emaillogs_view_email', array( 'id' => $id ) );
$DB->cache_exec_query();
if ( ! $row = $DB->fetch_row() )
{
$ibforums->admin->error("Could not resolve the email ID, please try again ($id)");
}
$ibforums->adskin->td_header[] = array( "&nbsp;" , "100%" );
$ibforums->html .= $ibforums->adskin->start_table( $row['email_subject'] );
$row['email_date'] = $ibforums->admin->get_date( $row['email_date'], 'LONG' );
$ibforums->html .= $ibforums->adskin->add_td_row( array(
"<strong>From:</strong> {$row['name']} &lt;{$row['from_email_address']}&gt;
<br /><strong>To:</strong> {$row['to_name']} &lt;{$row['to_email_address']}&gt;
<br /><strong>Sent:</strong> {$row['email_date']}
<br /><strong>From IP:</strong> {$row['from_ip_address']}
<br /><strong>Subject:</strong> {$row['email_subject']}
<hr>
<br />{$row['email_content']}
"
) );
$ibforums->html .= $ibforums->adskin->end_table();
$ibforums->admin->print_popup();
}
//-----------------------------------------
// Remove row(s)
//-----------------------------------------
function remove_entries()
{
global $ibforums, $DB, $std;
if ( $ibforums->input['type'] == 'all' )
{
$DB->simple_exec_query( array( 'delete' => 'email_logs' ) );
}
else
{
$ids = array();
foreach ($ibforums->input as $k => $v)
{
if ( preg_match( "/^id_(\d+)$/", $k, $match ) )
{
if ($ibforums->input[ $match[0] ])
{
$ids[] = $match[1];
}
}
}
//-----------------------------------------
if ( count($ids) < 1 )
{
$ibforums->admin->error("You did not select any email log entries to approve or delete");
}
$DB->simple_exec_query( array( 'delete' => 'email_logs', 'where' => " email_id IN (".implode(',', $ids ).")" ) );
}
$ibforums->admin->save_log("Removed email log entries");
$std->boink_it($ibforums->base_url."&act=emaillog");
exit();
}
//-----------------------------------------
// SHOW ALL LANGUAGE PACKS
//-----------------------------------------
function list_current()
{
global $ibforums, $DB, $std;
$ibforums->html .= $ibforums->adskin->js_pop_win();
$form_array = array();
$start = intval($ibforums->input['st']);
$ibforums->admin->page_detail = "Stored email logs";
$ibforums->admin->page_title = "Email Logs Manager";
//-----------------------------------------
// Check URL parameters
//-----------------------------------------
$url_query = array();
$db_query = array();
if ( $ibforums->input['type'] != "" )
{
$ibforums->admin->page_title .= " (Search Results)";
switch( $ibforums->input['type'] )
{
case 'fromid':
$url_query[] = 'type=fromid';
$url_query[] = 'id='.intval($ibforums->input['id']);
$db_query[] = 'email.from_member_id='.intval($ibforums->input['id']);
break;
case 'toid':
$url_query[] = 'type=toid';
$url_query[] = 'id='.intval($ibforums->input['id']);
$db_query[] = 'email.to_member_id='.intval($ibforums->input['id']);
break;
case 'subject':
$string = urldecode($ibforums->input['string']);
if ( $string == "" )
{
$ibforums->admin->error("You must enter something to search by");
}
$url_query[] = 'type='.$ibforums->input['type'];
$url_query[] = 'string='.urlencode($string);
$db_query[] = $ibforums->input['match'] == 'loose' ? "email.email_subject LIKE '%{$string}%'" : "email.email_subject='{$string}'";
break;
case 'content':
$string = urldecode($ibforums->input['string']);
if ( $string == "" )
{
$ibforums->admin->error("You must enter something to search by");
}
$url_query[] = 'type='.$ibforums->input['type'];
$url_query[] = 'string='.urlencode($string);
$db_query[] = $ibforums->input['match'] == 'loose' ? "email.email_content LIKE '%{$string}%'" : "email.email_content='{$string}'";
break;
case 'email_from':
$string = urldecode($ibforums->input['string']);
if ( $string == "" )
{
$ibforums->admin->error("You must enter something to search by");
}
$url_query[] = 'type='.$ibforums->input['type'];
$url_query[] = 'string='.urlencode($string);
$db_query[] = $ibforums->input['match'] == 'loose' ? "email.from_email_address LIKE '%{$string}%'" : "email.from_email_address='{$string}'";
break;
case 'email_to':
$string = urldecode($ibforums->input['string']);
if ( $string == "" )
{
$ibforums->admin->error("You must enter something to search by");
}
$url_query[] = 'type='.$ibforums->input['type'];
$url_query[] = 'string='.urlencode($string);
$db_query[] = $ibforums->input['match'] == 'loose' ? "email.to_email_address LIKE '%{$string}%'" : "email.to_email_address='{$string}'";
break;
case 'name_from':
$string = urldecode($ibforums->input['string']);
if ( $string == "" )
{
$ibforums->admin->error("You must enter something to search by");
}
if ( $ibforums->input['match'] == 'loose' )
{
$DB->simple_construct( array( 'select' => 'id,name', 'from' => 'members', 'where' => "name LIKE '%{$string}%'" ) );
$DB->simple_exec();
if ( ! $DB->get_num_rows() )
{
$ibforums->admin->error("No matches found in the email logs");
}
$ids = array();
while ( $r = $DB->fetch_row() )
{
$ids[] = $r['id'];
}
$db_query[] = 'email.from_member_id IN('.implode( ',', $ids ).')';
}
else
{
$DB->simple_construct( array( 'select' => 'id,name', 'from' => 'members', 'where' => "name='{$string}'" ) );
$DB->simple_exec();
if ( ! $DB->get_num_rows() )
{
$ibforums->admin->error("No matches found in the email logs");
}
$r = $DB->fetch_row();
$db_query[] = 'email.from_member_id IN('.$r['id'].')';
}
$url_query[] = 'type='.$ibforums->input['type'];
$url_query[] = 'string='.urlencode($string);
break;
case 'name_to':
$string = urldecode($ibforums->input['string']);
if ( $string == "" )
{
$ibforums->admin->error("You must enter something to search by");
}
if ( $ibforums->input['match'] == 'loose' )
{
$DB->simple_construct( array( 'select' => 'id,name', 'from' => 'members', 'where' => "name LIKE '%{$string}%'" ) );
$DB->simple_exec();
if ( ! $DB->get_num_rows() )
{
$ibforums->admin->error("No matches found in the email logs");
}
$ids = array();
while ( $r = $DB->fetch_row() )
{
$ids[] = $r['id'];
}
$db_query[] = 'email.to_member_id IN('.implode( ',', $ids ).')';
}
else
{
$DB->simple_construct( array( 'select' => 'id,name', 'from' => 'members', 'where' => "name='{$string}'" ) );
$DB->simple_exec();
if ( ! $DB->get_num_rows() )
{
$ibforums->admin->error("No matches found in the email logs");
}
$r = $DB->fetch_row();
$db_query[] = 'email.to_member_id IN('.$r['id'].')';
}
$url_query[] = 'type='.$ibforums->input['type'];
$url_query[] = 'string='.urlencode($string);
break;
default:
//
break;
}
}
$url_query[] = 'match='.$ibforums->input['match'];
//-----------------------------------------
// LIST 'EM
//-----------------------------------------
$dbe = "";
$url = "";
if ( count($db_query) > 0 )
{
$dbe = implode(' AND ', $db_query );
}
if ( count($url_query) > 0 )
{
$url = '&'.implode( '&', $url_query);
}
$DB->simple_construct( array( 'select' => 'count(email.email_id) as cnt',
'from' => 'email_logs email',
'where' => $dbe ) );
$DB->simple_exec();
$count = $DB->fetch_row();
$links = $std->build_pagelinks( array( 'TOTAL_POSS' => $count['cnt'],
'PER_PAGE' => 25,
'CUR_ST_VAL' => $start,
'L_SINGLE' => "Single Page",
'L_MULTI' => "Pages: ",
'BASE_URL' => $ibforums->base_url.'&act=emaillog'.$url,
)
);
if ( $dbe )
{
$dbe = 'WHERE '.$dbe;
}
$DB->cache_add_query( 'emaillogs_list_current', array( 'dbe' => $dbe, 'limit_a' => $start ) );
$DB->cache_exec_query();
$ibforums->html .= $ibforums->adskin->start_form( array( 1 => array( 'code' , 'remove' ),
2 => array( 'act' , 'emaillog' ),
) );
$ibforums->adskin->td_header[] = array( "&nbsp;" , "5%" );
$ibforums->adskin->td_header[] = array( "From Member" , "20%" );
$ibforums->adskin->td_header[] = array( "Subject" , "30%" );
$ibforums->adskin->td_header[] = array( "To Member" , "20%" );
$ibforums->adskin->td_header[] = array( "Sent Time" , "25%" );
$ibforums->html .= $ibforums->adskin->start_table( "Logged Emails" );
if ( $DB->get_num_rows() )
{
while ( $row = $DB->fetch_row() )
{
$row['email_date'] = $ibforums->admin->get_date( $row['email_date'], 'SHORT' );
$ibforums->html .= $ibforums->adskin->add_td_row( array(
"<center><input type='checkbox' class='checkbox' name='id_{$row['email_id']}' value='1' /></center>",
"<a href='{$ibforums->base_url}&act=emaillog&code=list&type=fromid&id={$row['id']}' title='Show all from this member'><img src='{$ibforums->adskin->img_url}/acp_search.gif' border='0' alt='..by id'></a>&nbsp;<b><a href='{$ibforums->vars['board_url']}/index.{$ibforums->vars['php_ext']}?act=Profile&MID={$row['id']}' title='Members profile (new window)' target='blank'>{$row['name']}</a></b>",
"<a href='javascript:pop_win(\"&act=emaillog&code=viewemail&id={$row['email_id']}\",400,400)' title='Read email'>{$row['email_subject']}</a>",
"<a href='{$ibforums->base_url}&act=emaillog&code=list&type=toid&id={$row['to_id']}' title='Show all sent to this member'><img src='{$ibforums->adskin->img_url}/acp_search.gif' border='0' alt='..by id'></a>&nbsp;<a href='{$ibforums->vars['board_url']}/index.{$ibforums->vars['php_ext']}?act=Profile&MID={$row['to_id']}' title='Members profile (new window)' target='blank'>{$row['to_name']}</a>",
"{$row['email_date']}",
) );
}
}
else
{
$ibforums->html .= $ibforums->adskin->add_td_basic("<center>No results</center>");
}
$ibforums->html .= $ibforums->adskin->add_td_basic('<div style="float:left;width:auto"><input type="submit" value="Remove Checked" id="button" />&nbsp;<input type="checkbox" id="checkbox" name="type" value="all" />&nbsp;Remove all?</div><div align="right">'.$links.'</div></form>', 'left', 'pformstrip');
$ibforums->html .= $ibforums->adskin->end_table();
//-----------------------------------------
//-------------------------------
$ibforums->html .= $ibforums->adskin->start_form( array( 1 => array( 'code' , 'list' ),
2 => array( 'act' , 'emaillog' ),
) );
$ibforums->adskin->td_header[] = array( "&nbsp;" , "100%" );
$ibforums->html .= $ibforums->adskin->start_table( "Search Email Logs" );
$form_array = array(
0 => array( 'subject' , 'Email Subject' ),
1 => array( 'content' , 'Email Body' ),
2 => array( 'email_from' , 'From Email Address' ),
3 => array( 'email_to' , 'To Email Address' ),
4 => array( 'name_from' , 'From Member Name'),
5 => array( 'name_to' , 'To Member Name' ),
);
$type_array = array(
0 => array( 'exact' , 'is exactly' ),
1 => array( 'loose' , 'contains' ),
);
//-----------------------------------------
$ibforums->html .= $ibforums->adskin->add_td_row( array( "<b>Search where</b> &nbsp;"
. $ibforums->adskin->form_dropdown( "type", $form_array) ." "
. $ibforums->adskin->form_dropdown( "match", $type_array) ." "
. $ibforums->adskin->form_input( "string"),
) );
$ibforums->html .= $ibforums->adskin->end_form("Search");
$ibforums->html .= $ibforums->adskin->end_table();
//-----------------------------------------
//-------------------------------
$ibforums->admin->nav[] = array( 'act=emaillog', 'Email Logs (Show all)' );
$ibforums->admin->output();
}
}
?>
File diff suppressed because it is too large. Load diff
+73
View File
@@ -0,0 +1,73 @@
<?php
/*
+--------------------------------------------------------------------------
| Invision Gallery Module
| ========================================
| by Joshua Williams
| (c) 2001 - 2003 Invision Power Services
| http://www.invisionpower.com
| ========================================
| Web: http://www.invisiongallery.com
| Email: josh@invisiongallery.com
+---------------------------------------------------------------------------
|
| > Main Admin Module
| > Script written by Joshua Williams
|
+--------------------------------------------------------------------------
*/
$idx = new ad_gallery();
class ad_gallery {
var $base_url;
function auto_run()
{
global $ibforums, $DB, $std;
//-----------------------------------------
// Kill globals - globals bad, Homer good.
//-----------------------------------------
$tmp_in = array_merge( $_GET, $_POST, $_COOKIE );
foreach ( $tmp_in as $k => $v )
{
unset($$k);
}
$ibforums->admin->page_title = "Invision Gallery Manager";
$ibforums->admin->page_detail = "You can set up and manage your gallery in this section.";
$ibforums->admin->nav[] = array( 'act=gallery' , 'Invision Gallery Manager Home' );
//-----------------------------------------
// Do some set up
//-----------------------------------------
if ( ! @is_dir( ROOT_PATH.'/modules/gallery' ) )
{
$std->boink_it("http://www.invisiongallery.com/?why");
}
else
{
define( 'IPB_CALLED', 1 );
$DB->load_cache_file( ROOT_PATH . 'sources/sql/'.SQL_DRIVER.'_gallery_queries.php', 'gallery_sql_queries' );
$DB->load_cache_file( ROOT_PATH . 'sources/sql/'.SQL_DRIVER.'_gallery_admin_queries.php', 'gallery_admin_sql_queries' );
$section = ( $ibforums->input['code'] ) ? "ad_{$ibforums->input['code']}" : "ad_cats";
require ROOT_PATH.'modules/gallery/lib/gallery_library.php';
require ROOT_PATH.'modules/gallery/admin/'.$section.'.php';
$PLUGIN = new ad_plugin_gallery_sub();
$PLUGIN->auto_run();
}
}
}
?>
File diff suppressed because it is too large. Load diff
+298
View File
@@ -0,0 +1,298 @@
<?php
/*
+--------------------------------------------------------------------------
| Invision Power Board v2.0.0
| =============================================
| by Matthew Mecham
| (c) 2001 - 2004 Invision Power Services, Inc.
| http://www.invisionpower.com
| =============================================
| Web: http://www.invisionboard.com
| Time: Tue, 21 Sep 2004 16:34:28 GMT
| Release: 150aa7a702c3c8b6f6eb90ad49305d2f
| Licence Info: http://www.invisionboard.com/?license
+---------------------------------------------------------------------------
|
| > Help Control functions
| > Module written by Matt Mecham
| > Date started: 2nd April 2002
|
| > Module Version Number: 1.0.0
| > DBA Checked: Mon 24th May 2004
+--------------------------------------------------------------------------
*/
if ( ! defined( 'IN_ACP' ) )
{
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded 'admin.php'.";
exit();
}
class ad_help
{
var $base_url;
function auto_run()
{
global $ibforums, $DB, $std;
//-----------------------------------------
// Kill globals - globals bad, Homer good.
//-----------------------------------------
$tmp_in = array_merge( $_GET, $_POST, $_COOKIE );
foreach ( $tmp_in as $k => $v )
{
unset($$k);
}
//-----------------------------------------
switch($ibforums->input['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 $ibforums, $DB, $std, $HTTP_POST_VARS;
if ($ibforums->input['id'] == "")
{
$ibforums->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'] ) );
$text = preg_replace( "/\\\/", "&#092;", $text );
$DB->do_update( 'faq', array( 'title' => $ibforums->input['title'],
'text' => $text,
'description' => $desc,
) , "id=".intval($ibforums->input['id']) );
$ibforums->admin->save_log("Edited help files");
$std->boink_it($ibforums->adskin->base_url."&act=help");
exit();
}
//=====================================================
function show_form($type='new')
{
global $ibforums, $DB, $std;
$ibforums->admin->page_detail = "You may add/edit and remove help files below.";
$ibforums->admin->page_title = "Help File Management";
//-----------------------------------------
if ($type != 'new')
{
if ($ibforums->input['id'] == "")
{
$ibforums->admin->error("You must pass a valid help file id, silly!");
}
//-----------------------------------------
$DB->simple_construct( array( 'select' => '*', 'from' => 'faq', 'where' => "id=".intval($ibforums->input['id']) ) );
$DB->simple_exec();
if ( ! $r = $DB->fetch_row() )
{
$ibforums->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';
}
$ibforums->html .= $ibforums->adskin->start_form( array( 1 => array( 'code' , $code ),
2 => array( 'act' , 'help' ),
3 => array( 'id' , $ibforums->input['id'] ),
) );
$ibforums->adskin->td_header[] = array( "&nbsp;" , "20%" );
$ibforums->adskin->td_header[] = array( "&nbsp;" , "80%" );
$r['text'] = preg_replace( "/<br>/i", "\n", stripslashes($r['text']) );
//-----------------------------------------
$ibforums->html .= $ibforums->adskin->start_table( $button );
$ibforums->html .= $ibforums->adskin->add_td_row( array( "Help File Title",
$ibforums->adskin->form_input('title' , stripslashes($r['title']) ),
) );
$ibforums->html .= $ibforums->adskin->add_td_row( array( "Help File Description",
$ibforums->adskin->form_textarea('description', stripslashes($r['description']) ),
) );
$ibforums->html .= $ibforums->adskin->add_td_row( array( "Help File Text",
$ibforums->adskin->form_textarea('text', $r['text'], "60", "10" ),
) );
$ibforums->html .= $ibforums->adskin->end_form($button);
$ibforums->html .= $ibforums->adskin->end_table();
$ibforums->admin->output();
}
//=====================================================
function remove()
{
global $ibforums, $DB, $std;
if ($ibforums->input['id'] == "")
{
$ibforums->admin->error("You must pass a valid help file id, silly!");
}
$DB->simple_exec_query( array( 'delete' => 'faq', 'where' => "id=".$ibforums->input['id'] ) );
$ibforums->admin->save_log("Removed a help file");
$std->boink_it($ibforums->adskin->base_url."&act=help");
exit();
}
//=====================================================
function doadd()
{
global $ibforums, $DB, $std, $HTTP_POST_VARS;
if ($ibforums->input['title'] == "")
{
$ibforums->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'] ) );
$text = preg_replace( "/\\\/", "&#092;", $text );
$DB->do_insert( 'faq', array( 'title' => $title,
'text' => $text,
'description' => $desc,
) );
$ibforums->admin->save_log("Added a help file");
$std->boink_it($ibforums->adskin->base_url."&act=help");
exit();
}
//=====================================================
function list_files()
{
global $ibforums, $DB, $std;
$ibforums->admin->page_detail = "You may add/edit and remove help files below.";
$ibforums->admin->page_title = "Help File Management";
//-----------------------------------------
$ibforums->adskin->td_header[] = array( "Title" , "50%" );
$ibforums->adskin->td_header[] = array( "Edit" , "30%" );
$ibforums->adskin->td_header[] = array( "Remove" , "20%" );
//-----------------------------------------
$ibforums->html .= $ibforums->adskin->start_table( "Current Help Files" );
$DB->simple_construct( array( 'select' => '*', 'from' => 'faq', 'order' => "id" ) );
$DB->simple_exec();
if ( $DB->get_num_rows() )
{
while ( $r = $DB->fetch_row() )
{
$ibforums->html .= $ibforums->adskin->add_td_row( array( "<b>".stripslashes($r['title'])."</b><br>".stripslashes($r['description']),
"<center><a href='".$ibforums->adskin->base_url."&act=help&code=edit&id={$r['id']}'>Edit</a></center>",
"<center><a href='".$ibforums->adskin->base_url."&act=help&code=remove&id={$r['id']}'>Remove</a></center>",
) );
}
}
$ibforums->html .= $ibforums->adskin->add_td_basic("<a href='".$ibforums->adskin->base_url."&act=help&code=new'>Add New Help File</a>", "center", "title" );
$ibforums->html .= $ibforums->adskin->end_table();
//-----------------------------------------
$ibforums->admin->output();
}
}
?>
+470
View File
@@ -0,0 +1,470 @@
<?php
/*
+--------------------------------------------------------------------------
| Invision Power Board v2.0.0
| =============================================
| by Matthew Mecham
| (c) 2001 - 2004 Invision Power Services, Inc.
| http://www.invisionpower.com
| =============================================
| Web: http://www.invisionboard.com
| Time: Tue, 21 Sep 2004 16:34:28 GMT
| Release: 150aa7a702c3c8b6f6eb90ad49305d2f
| Licence Info: http://www.invisionboard.com/?license
+---------------------------------------------------------------------------
|
| > Skin -> Image Macro functions
| > Module written by Matt Mecham
| > Date started: 4th April 2002
|
| > Module Version Number: 1.0.0
| > DBA Checked: Tue 25th May 2004
+--------------------------------------------------------------------------
*/
if ( ! defined( 'IN_ACP' ) )
{
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded 'admin.php'.";
exit();
}
class ad_imagemacros {
var $base_url;
function auto_run()
{
global $ibforums, $DB, $std;
//-----------------------------------------
// Kill globals - globals bad, Homer good.
//-----------------------------------------
$tmp_in = array_merge( $_GET, $_POST, $_COOKIE );
foreach ( $tmp_in as $k => $v )
{
unset($$k);
}
//-----------------------------------------
switch($ibforums->input['code'])
{
case 'edit':
$this->show_macros();
break;
case 'doedit':
$this->edit_set_name();
break;
case 'macroremove':
$this->macro_remove();
break;
case 'doeditmacro':
$this->macro_edit();
break;
case 'doaddmacro':
$this->macro_add();
break;
default:
print "No action"; exit();
break;
}
}
//-----------------------------------------
// Remove macro
//-----------------------------------------
function macro_remove()
{
global $ibforums, $DB, $std, $HTTP_POST_VARS;
if ($ibforums->input['mid'] == "")
{
$ibforums->admin->error("You must specify an existing macro ID, go back and try again");
}
$id = intval($ibforums->input['id']);
$p = intval($ibforums->input['p']);
$DB->simple_exec_query( array( 'delete' => 'skin_macro', 'where' => "macro_id='".$ibforums->input['mid']."'" ) );
//-----------------------------------------
// Recache macros
//-----------------------------------------
$ibforums->cache_func->_recache_macros($id, $p);
//-----------------------------------------
// Bounce back
//-----------------------------------------
$ibforums->input['id'] = $id;
$ibforums->main_msg = "Macro removed!";
$this->show_macros();
}
//-----------------------------------------
// Apply the edit to the DB
//-----------------------------------------
function macro_edit()
{
global $ibforums, $DB, $std;
if ($ibforums->input['mid'] == "")
{
$ibforums->admin->error("You must specify an existing image set ID, go back and try again");
}
$id = intval($ibforums->input['id']);
$p = intval($ibforums->input['p']);
$key = $DB->add_slashes( $std->txt_safeslashes($_POST['variable']) );
$val = $DB->add_slashes( $std->txt_UNhtmlspecialchars($std->txt_safeslashes($_POST['replacement']) ) );
//-----------------------------------------
// Get macro for examination..
//-----------------------------------------
$DB->simple_construct( array( 'select' => '*', 'from' => 'skin_macro', 'where' => "macro_id='".$ibforums->input['mid']."'" ) );
$DB->simple_exec();
if ( ! $row = $DB->fetch_row() )
{
$ibforums->admin->error("Could not retrieve the record from the DB");
}
//-----------------------------------------
// Is this our macro set?
//-----------------------------------------
if ( $row['macro_set'] == $id )
{
//-----------------------------------------
// Okay, update...
//-----------------------------------------
$DB->simple_construct( array( 'update' => 'skin_macro', 'set' => "macro_value='$key', macro_replace='$val'", 'where' => "macro_id=".$ibforums->input['mid'] ) );
$DB->simple_exec();
}
else
{
//-----------------------------------------
// No? OK - best add it as a 'new' macro
//-----------------------------------------
$DB->manual_addslashes = 1;
$DB->do_insert( 'skin_macro', array (
'macro_value' => $key,
'macro_replace' => $val,
'macro_can_remove' => 1,
'macro_set' => $id
) );
$DB->manual_addslashes = 0;
}
//-----------------------------------------
// Recache macros
//-----------------------------------------
$ibforums->cache_func->_recache_macros($id, $p);
//-----------------------------------------
// Bounce back
//-----------------------------------------
$ibforums->input['id'] = $id;
$this->show_macros();
}
//-----------------------------------------
// ADD MACRO
//-----------------------------------------
function macro_add()
{
global $ibforums, $DB, $std;
if ($ibforums->input['mid'] == "")
{
$ibforums->admin->error("You must specify an existing macro set ID, go back and try again");
}
$id = intval($ibforums->input['id']);
$p = intval($ibforums->input['p']);
$DB->do_insert( 'skin_macro', array (
'macro_value' => $std->txt_safeslashes($_POST['variable']),
'macro_replace' => $std->txt_UNhtmlspecialchars($std->txt_safeslashes($_POST['replacement'])),
'macro_can_remove' => 1,
'macro_set' => $id
) );
//-----------------------------------------
// Recache macros
//-----------------------------------------
$ibforums->cache_func->_recache_macros($id, $p);
//-----------------------------------------
// Bounce back
//-----------------------------------------
$ibforums->input['id'] = $id;
$this->show_macros();
}
//-----------------------------------------
// Show macros
//-----------------------------------------
function show_macros()
{
global $ibforums, $DB, $std;
//-----------------------------------------
if ($ibforums->input['id'] == "")
{
$ibforums->admin->error("You must specify an existing macro set ID, go back and try again");
}
//-----------------------------------------
// check tree...
//-----------------------------------------
$this_set = "";
if ( $ibforums->input['p'] > 0 )
{
$in = ','.$ibforums->input['p'];
}
//-----------------------------------------
// Get macros
//-----------------------------------------
$macros = $ibforums->cache_func->_get_macros($ibforums->input['id'], $ibforums->input['p']);
//-----------------------------------------
// Get img_dir this set is using...
//-----------------------------------------
$DB->simple_construct( array( 'select' => '*', 'from' => 'skin_sets', 'where' => "set_skin_set_id='".$ibforums->input['id']."'" ) );
$DB->simple_exec();
$skin = $DB->fetch_row();
$ibforums->admin->page_detail = "To edit a macro, simply click on the 'edit' link of the appropriate macro.";
$ibforums->admin->page_title = "Manage Replacement Macros in Set: {$skin['set_name']}";
//-----------------------------------------
// Start output
//-----------------------------------------
$ibforums->html .= $ibforums->adskin->js_no_specialchars();
$ibforums->html .= $ibforums->adskin->js_checkdelete();
$ibforums->html .= "<script type='text/javascript'>
function editmacro(id, variable, replace)
{
document.macroform.code.value = 'doeditmacro';
document.macroform.submitbutton.value = 'Edit This Macro';
document.macroform.mid.value = id;
document.macroform.variable.value = variable;
document.macroform.replacement.value = replace;
scroll(0,0);
togglediv( 'popbox', 1 );
return false;
}
function addmacro(id)
{
document.macroform.code.value = 'doaddmacro';
document.macroform.submitbutton.value = 'Add This Macro';
document.macroform.mid.value = id;
document.macroform.variable.value = '';
document.macroform.replacement.value = '';
scroll(0,0);
togglediv( 'popbox', 1 );
return false;
}
function removemacro(url)
{
checkdelete(url);
}
</script>
<div class='tableborder'>
<div class='maintitle'>
<div align='center' style='position:absolute;width:99%;display:none;text-align:center' id='popbox'>
<form name='macroform' action='{$ibforums->adskin->base_url}' method='post'>
<input type='hidden' name='act' value='image' />
<input type='hidden' name='code' value='' />
<input type='hidden' name='mid' value='' />
<input type='hidden' name='id' value='{$ibforums->input['id']}' />
<input type='hidden' name='p' value='{$ibforums->input['p']}' />
<table cellspacing='0' width='500' align='center' cellpadding='6' style='background:#EEE;border:2px outset #555;'>
<tr>
<td width='1%' nowrap='nowrap' valign='top'>
<b>Variable</b><br><input class='textinput' name='variable' type='text' size='20' />
<br /><br />
<center><input type='submit' class='realbutton' value='Edit Macro' name='submitbutton' /> <input type='button' class='realdarkbutton' value='Close' onclick=\"togglediv('popbox');\" /></center>
</td>
<td width='99%'><b>Replacement</b><br /><textarea class='textinput' name='replacement' style='width:100%;height:50px'></textarea></td>
</tr>
</table>
</form>
</div>
<table cellpadding='0' cellspacing='0' border='0' width='100%'>
<tr>
<td align='left' width='100%' style='font-weight:bold;font-size:11px;color:#FFF'>Manage Replacement Macros</td>
<td align='right' nowrap='nowrap' style='padding-right:2px'><input type='button' class='realdarkbutton' value='Add Macro' onclick=\"addmacro('{$ibforums->input['id']}');\" /></td>
</tr>
</table>
</div>
</div>
";
$ibforums->html .= "<div class='tableborder'>\n<div class='tablepad'>\n<table width='100%' cellspacing='0' cellpadding='0' border='0'>";
$this->unaltered = "<img src='{$ibforums->skin_url}/skin_item_unaltered.gif' border='0' alt='-' title='Unaltered from parent skin set' />&nbsp;";
$this->altered = "<img src='{$ibforums->skin_url}/skin_item_altered.gif' border='0' alt='+' title='Altered from parent skin set' />&nbsp;";
$this->inherited = "<img src='{$ibforums->skin_url}/skin_item_inherited.gif' border='0' alt='|' title='Inherited from parent skin set' />&nbsp;";
//-----------------------------------------
// Loop and print
//-----------------------------------------
foreach( $macros as $name => $row )
{
$real = $std->txt_htmlspecialchars( $row['macro_replace'] );
//-----------------------------------------
// Altered?
//-----------------------------------------
if ( $row['macro_set'] == $ibforums->input['id'] )
{
$altered_image = $this->altered;
$css_info = '#FFDCD8';
}
else if ( $row['macro_set'] == 1 )
{
$altered_image = $this->unaltered;
$css_info = '#EEE';
}
else
{
$altered_image = $this->inherited;
$css_info = '#FFF2D3';
}
//-----------------------------------------
// Figure out quotes
//-----------------------------------------
$out_quote = '"';
$in_quote = "'";
if ( preg_match( "/&#039;/", $real ) )
{
$out_quote = "'";
$in_quote = '"';
}
$preview = str_replace( "<#IMG_DIR#>", $skin['set_image_dir'], $row['macro_replace'] );
if ( $row['macro_set'] > 1 and $row['macro_set'] == $ibforums->input['id'] )
{
$remove_button = "<input type='button' class='realbutton' name='remove' value='Revert' onclick=\"removemacro('act=image&code=macroremove&mid={$row['macro_id']}&id={$ibforums->input['id']}&p={$ibforums->input['p']}');\" />";
}
else
{
$remove_button = "";
}
//-----------------------------------------
// Not an image?
//-----------------------------------------
if ( ! preg_match( "#img\s{1,}src=#i", $row['macro_replace'] ) )
{
$preview = substr( $real, 0, 200 );
}
$edit_button = "<input type='button' class='realbutton' value='Change' onclick={$out_quote}editmacro( {$in_quote}{$row['macro_id']}{$in_quote}, {$in_quote}{$row['macro_value']}{$in_quote}, {$in_quote}$real{$in_quote});{$out_quote} />";
//-----------------------------------------
// Render row
//-----------------------------------------
$style = "padding:4px;border-bottom:1px solid #DDD;background:{$css_info}";
$ibforums->html .= "<tr>
<!--<td style='$style' align='center' width='1%'><img src='{$ibforums->skin_url}/skin_macro.gif' alt='Macro' title='ID: {$row['macro_id']}' style='vertical-align:middle' /></td>-->
<td style='$style' align='left' width='1%' nowrap='nowrap'>$altered_image
&nbsp;&lt;{<span style='font-size:11px;font-weight:bold' title='ID: {$row['macro_id']}. SET: {$row['macro_set']}' href='#' >{$row['macro_value']}</span>}&gt;
</td>
<td style='$style;padding-right:3px;text-align:center;' align='center' width='99%' align='center'>$preview</td>
<td style='$style' align='right' width='40%' nowrap='nowrap'>$remove_button $edit_button</td>
</tr>
";
}
$ibforums->html .= "</table>
</div>
<div class='pformstrip' align='center'>
<input type='button' class='realdarkbutton' value='Add Macro' onclick=\"addmacro('{$ibforums->input['id']}');\" />
</div>
</div>";
$ibforums->html .= $ibforums->adskin->skin_jump_menu_wrap();
//-----------------------------------------
// Show altered / unaltered
// legend
//-----------------------------------------
$ibforums->html .= "<br />
<div><strong>Replace Macro Example</strong><br />
If you added a key of 'green_font' and a replacement of '&lt;font color='green'>', each instance of <span style='color:red'><b>&lt;{green_font}&gt;</b></span> would be converted to &lt;font color='green'>
<br /><b>&lt;#IMG_DIR#></b> is available to any macro, this is automatically replaced with the name of the image directory you choose when using this macro set in a skin
</div><br />
<div><strong>Replacement Macro Legend:</strong><br />
{$this->altered} This item has been customized for this skin set.
<br />{$this->unaltered} This item has not been customized from the master skin set.
<br />{$this->inherited} This item has inherited customizations from the parent skin set.
</div>";
$ibforums->admin->nav[] = array( 'act=sets' ,'Skin Manager Home' );
$ibforums->admin->nav[] = array( '' ,'Editing Replacement Macros in Set '.$skin['set_name'] );
$ibforums->admin->output();
}
}
?>
+604
View File
@@ -0,0 +1,604 @@
<?php
/*
+--------------------------------------------------------------------------
| Invision Power Board v2.0.0
| =============================================
| by Matthew Mecham
| (c) 2001 - 2004 Invision Power Services, Inc.
| http://www.invisionpower.com
| =============================================
| Web: http://www.invisionboard.com
| Time: Tue, 21 Sep 2004 16:34:28 GMT
| Release: 150aa7a702c3c8b6f6eb90ad49305d2f
| Licence Info: http://www.invisionboard.com/?license
+---------------------------------------------------------------------------
|
| > Admin "welcome" screen functions
| > Module written by Matt Mecham
| > Date started: 1st march 2002
|
| > Module Version Number: 1.0.0
| > DBA Checked: Tue 25th May 2004
+--------------------------------------------------------------------------
*/
if ( ! defined( 'IN_ACP' ) )
{
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded 'admin.php'.";
exit();
}
class ad_index {
var $mysql_version = "";
function auto_run()
{
global $DB, $std, $ibforums;
//-----------------------------------------
// Kill globals - globals bad, Homer good.
//-----------------------------------------
$tmp_in = array_merge( $_GET, $_POST, $_COOKIE );
foreach ( $tmp_in as $k => $v )
{
unset($$k);
}
//-----------------------------------------
$ibforums->admin->page_title = "Welcome to the Invision Power Board Administration CP";
$ibforums->admin->page_detail = "Clicking on one of the links in the left menu pane will show you the relevant options for that administration category.<br />Each option will contain further information on configuration, etc.";
//-----------------------------------------
// Get MySQL & PHP Version
//-----------------------------------------
$DB->sql_get_version();
$phpv = phpversion();
$phpmethod = @php_sapi_name();
//-----------------------------------------
// Upgrade history?
//-----------------------------------------
$upgrade_history = array();
$latest_version = array();
$DB->simple_construct( array( 'select' => '*', 'from' => 'upgrade_history', 'order' => 'upgrade_version_id DESC' ) );
$DB->simple_exec();
while( $r = $DB->fetch_row() )
{
if ( $r['upgrade_version_id'] > $latest_version['upgrade_version_id'] )
{
$latest_version = $r;
}
$upgrade_history[] = $r;
}
//-----------------------------------------
// Got reg code?
//-----------------------------------------
$reg_html = "";
$reg_end = "";
//-----------------------------------------
// Got real version number?
//-----------------------------------------
if ( $ibforums->version == 'v2.0.0 ' )
{
$ibforums->version = 'v'.$latest_version['upgrade_version_human'];
}
if ( $ibforums->acpversion == '20010' )
{
$ibforums->acpversion = $latest_version['upgrade_version_id'];
}
$version_info = "<a href='http://www.invisionboard.com/download.cgi' target='_blank'><img border='0' src='http://www.invisionboard.com/acp/versioncheck/?v={$ibforums->acpversion}' vspace='10'></a>
<br /><b><a href='http://www.php.net' target='_blank'>PHP</a> VERSION:</b> $phpv ($phpmethod), <b>SQL:</b> (".strtoupper(SQL_DRIVER).") ".$DB->true_version."
<br />IPB Version {$ibforums->version} (ID: {$ibforums->acpversion})";
if ( $ibforums->vars['ipb_reg_number'] )
{
list( $a, $b, $c, $d, $e ) = explode( '-', $ibforums->vars['ipb_reg_number'] );
if ( strlen($e) > 9 )
{
$reg_end = "Registered until: <span style='color:green'>". $ibforums->admin->get_date( $e, 'SHORT' )."</span>";
}
else
{
$reg_end = "Registered for life";
}
$reg_html = "<div style='border:1px dotted #555;padding:6px;background-color:#EEF2F7;'>
<b style='font-size:12px;color:#336699'>Registered Invision Power Board</b>
<br />Thank you for registering your Invision Power Board!
<br /><br />Please visit your <a href='http://customer.invisionpower.com' target='_blank'>client area</a> for news, updates and support.
<br />$reg_end
</div>";
}
else
{
$reg_html = "<div style='border:1px dotted #555;padding:6px;background-color:#EEF2F7;'>
<b style='font-size:12px;color:#AA0000'>Unregistered Invision Power Board</b>
<br />This copy of Invision Power Board is unregistered.
<br /><br />Why register? <a href='http://www.invisionboard.com/?whyregister' target='_blank'>click here</a> to find out!
<br />Go on, <a href='http://www.invisionboard.com/download.cgi?subc=register' target='_blank'> register today!</a> you know it makes sense!
</div>";
}
//-----------------------------------------
// Notepad
//-----------------------------------------
if ( $ibforums->input['save'] == 1 )
{
$DB->do_update( 'cache_store', array( 'cs_value' => $std->txt_stripslashes($_POST['notes']) ), "cs_key='adminnotes'" );
}
$text = "You can use this section to keep notes for yourself and other admins, etc.";
$DB->simple_construct( array( 'select' => '*', 'from' => 'cache_store', 'where' => "cs_key='adminnotes'" ) );
$DB->simple_exec();
if ( ! $notes = $DB->fetch_row() )
{
$DB->do_insert( 'cache_store', array( 'cs_key' => 'adminnotes', 'cs_value' => $text ) );
$notes = array( 'cs_key' => 'adminnotes', 'cs_value' => $text );
}
$ad_notes = "<form action='{$ibforums->base_url}&act=index&save=1' method='post'>
<textarea name='notes' style='background-color:#F9FFA2;border:1px solid #CCC;width:95%;font-family:verdana;font-size:10px' rows='7' cols='25'>".stripslashes($notes['cs_value'])."</textarea>
<div align='center'><input type='submit' value='Save Admin Notes' style='background-color:#F9FFA2;border:1px solid #999;;font-family:verdana;font-size:10px' /></div>
</form>";
//-----------------------------------------
// Printy-poos
//-----------------------------------------
$ibforums->html .= "<table width='100%' border='0' cellpadding='0' cellspacing='0'>
<tr>
<td width='49%' valign='middle' align='center' style='padding:6px;background-color:#FAFFAF;'>{$ad_notes}</td>
<td style='width:10px'>&nbsp;</td>
<td width='49%' valign='top' align='left'>{$version_info}<br /><br />{$reg_html}</td>
</tr>
</table><br />\n";
//-----------------------------------------
// Make sure the uploads path is correct
//-----------------------------------------
$uploads_size = 0;
if ($dh = opendir( $ibforums->vars['upload_dir'] ))
{
while ( $file = readdir( $dh ) )
{
if ( !preg_match( "/^..?$|^index/i", $file ) )
{
$uploads_size += @filesize( $ibforums->vars['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";
}
//-----------------------------------------
// Trashed skin?
//-----------------------------------------
$skinmsg = $DB->simple_exec_query( array( "select" => '*', 'from' => "cache_store", "where" => "cs_key='skinpanic'" ) );
if ( $skinmsg['cs_value'] == 'rebuildemergency' )
{
$ibforums->html .= "<div style='color:red;border:1px solid red;background:#FFC0C3;padding:10px'>
<span style='font-size:20px;font-weight:bold'>Warning: A Skin error occured</span>
<br /><br />
Either you or one of your members encountered a skin error. The following took place
automatically:
<ul>
<li>They were asked to clear their skin settings</li>
<li>They were asked to click a link to attempt access in the ACP</li>
<li>The ACP picked up the skin error and rebuilt the skin ID cache, the default skin and it may have turned on safe mode skins</li>
</ul>
<b>What to do now</b>
<ul>
<li>Firstly, if you don't wish to use safe mode skins, check the CHMOD value of the 'skin_cache' directory to make sure IPB can write into that directory</li>
<li>If the permissions are correct, check your 'System Settings -&gt; General Configuration' settings to check the value of 'Safe Mode Skins' - disable if not required</li>
<li>As a precaution, rebuild all your skins by following the link below</li>
</ul>
<b>&gt;&gt; <a href='{$ibforums->base_url}&act=sets&code=rebuildalltemplates&removewarning=1'>REBUILD ALL SKIN CACHES & REMOVE THIS WARNING</a> &lt;&lt;</b>
</div><br /><br />";
}
if ( $skinmsg['cs_value'] == 'rebuildupgrade' )
{
$ibforums->html .= "<div style='color:red;border:1px solid red;background:#FFC0C3;padding:10px'>
<span style='font-size:20px;font-weight:bold'>An upgrade has been performed</span>
<br /><br />
You'll need to update all your skin caches to ensure the new template bits have been added correctly.
<br /><br /><b>&gt;&gt; <a href='{$ibforums->base_url}&act=sets&code=rebuildalltemplates&removewarning=1'>REBUILD ALL SKIN CACHES & REMOVE THIS WARNING</a> &lt;&lt;</b>
</div><br /><br />";
}
//-----------------------------------------
// INSTALLER PRESENT?
//-----------------------------------------
$sm_install = 0;
$lock_file = 0;
if ( @file_exists( ROOT_PATH . 'sm_install.php' ) )
{
$sm_install = 1;
}
if ( @file_exists( ROOT_PATH . 'install.lock' ) )
{
$lock_file = 1;
}
if ( $sm_install == 1 )
{
if ( $lock_file != 1 )
{
$ibforums->html .= "<div style='color:red;border:1px solid red;background:#FFC0C3;padding:10px'>
<span style='font-size:20px;font-weight:bold'>Warning: Unlocked Installer Still Present</span>
<br /><br /><span style='font-size:14px;'>Remove <b>sm_install.php</b> from your server at once!
<br />Leaving it on your server WILL compromise the security of your system.</span></div><br /><br />";
}
else
{
$ibforums->html .= "<div style='color:red;border:1px solid red;background:#FFE1E2;padding:10px'>
<span style='font-size:14px;font-weight:bold'>Warning: Installer Still Present</span>
<br /><br /><span style='font-size:10px;'>Although the installer appears to be locked, we recommend you remove it
from your server for security.
<br />Simply remove <b>sm_install.php</b> from your installation to remove this message.</span></div><br /><br />";
}
}
//-----------------------------------------
// BOARD OFFLINE?
//-----------------------------------------
if ($ibforums->vars['board_offline'])
{
$ibforums->adskin->td_header[] = array( "&nbsp;", "100%" );
$ibforums->html .= $ibforums->adskin->start_table( "Offline Notice" );
$ibforums->html .= $ibforums->adskin->add_td_row( array( "Your board is currently offline<br><br>&raquo; <a href='{$ibforums->base_url}&act=op&code=findsetting&key=boardoffline%2Fonline'>Turn Board Online</a>"
) );
$ibforums->html .= $ibforums->adskin->end_table();
$ibforums->html .= $ibforums->adskin->add_td_spacer();
}
//-----------------------------------------
// Quick clicks + Upgrade History
//-----------------------------------------
$ibforums->html .= "<table cellpadding='0' cellspacing='0' border='0' width='100%'>
<tr>
<td width='49%' valign='top'>";
$ibforums->html .= $ibforums->adskin->start_form();
$ibforums->adskin->td_header[] = array( "{none}" , "30%" );
$ibforums->adskin->td_header[] = array( "{none}" , "40%" );
$ibforums->adskin->td_header[] = array( "{none}" , "30%" );
$ibforums->html .= $ibforums->adskin->start_table( "Quick Clicks" );
$ibforums->html .= "
<script language='javascript'>
<!--
function edit_member() {
if (document.forms[1].username.value == \"\") {
alert(\"You must enter a username!\");
} else {
window.parent.body.location = '{$ibforums->adskin->base_url}' + '&act=mem&code=searchresults&searchtype=normal&name=' + escape(document.forms[1].username.value);
}
}
function new_forum() {
if (document.forms[1].forum_name.value == \"\") {
alert(\"You must enter a forum name!\");
} else {
window.parent.body.location = '{$ibforums->adskin->base_url}' + '&act=forum&code=new&name=' + escape(document.forms[1].forum_name.value);
}
}
function phplookup() {
if (document.forms[1].phpfunc.value == \"\") {
alert(\"You must enter a PHP function!\");
} else {
window.parent.body.location = 'http://www.php.net/' + escape(document.forms[1].phpfunc.value);
}
}
//-->
</script>
<form name='DOIT' action=''>
";
$ibforums->html .= $ibforums->adskin->add_td_row( array( "Edit Member:",
"<input type='text' style='width:100%' class='textinput' name='username' value='Enter name here' onfocus='this.value=\"\"'>",
"<input type='button' value='Find Member' id='button' onClick='edit_member()'>"
) );
$ibforums->html .= $ibforums->adskin->add_td_row( array( "Add New Forum:",
"<input type='text' style='width:100%' name='forum_name' class='textinput' value='Forum title here' onfocus='this.value=\"\"'>",
"<input type='button' value='Add Forum' id='button' onClick='new_forum()'>"
) );
$ibforums->html .= $ibforums->adskin->add_td_row( array( "PHP Function:",
"<input type='text' style='width:100%' name='phpfunc' class='textinput' value='PHP function here' onfocus='this.value=\"\"'>",
"<input type='button' value='Look-up' id='button' onClick='phplookup()'>"
) );
$ibforums->html .= "</form>";
$ibforums->html .= $ibforums->adskin->end_table();
$ibforums->html .= "</td>
<td style='width:10px'>&nbsp;</td>
<td width='49%' valign='top'>";
$ibforums->adskin->td_header[] = array( "{none}" , "40%" );
$ibforums->adskin->td_header[] = array( "{none}" , "60%" );
$ibforums->html .= $ibforums->adskin->start_table( "Upgrade History" );
foreach( $upgrade_history as $r )
{
$ibforums->html .= $ibforums->adskin->add_td_row( array( $r['upgrade_version_human'] .' ('.$r['upgrade_version_id'].')',
$std->get_date( $r['upgrade_date'], 'SHORT' )
) );
}
$ibforums->html .= $ibforums->adskin->end_table();
$ibforums->html .= "</td>
</tr>
</table>";
//-----------------------------------------
// ADMINS USING CP
//-----------------------------------------
$ibforums->adskin->td_header[] = array( "Name" , "20%" );
$ibforums->adskin->td_header[] = array( "IP Address" , "20%" );
$ibforums->adskin->td_header[] = array( "Log In" , "20%" );
$ibforums->adskin->td_header[] = array( "Last Click" , "20%" );
$ibforums->adskin->td_header[] = array( "Location" , "20%" );
$ibforums->html .= $ibforums->adskin->start_table( "Administrators using the CP" );
$t_time = time() - 60*10;
$DB->simple_construct( array( 'select' => 'session_member_name, session_location, session_log_in_time, session_running_time, session_ip_address',
'from' => 'admin_sessions',
'where' => "session_running_time > $t_time" ) );
$DB->simple_exec();
$time_now = time();
$seen_name = array();
while ( $r = $DB->fetch_row() )
{
if ( $seen_name[ $r['session_member_name'] ] == 1 )
{
continue;
}
else
{
$seen_name[ $r['session_member_name'] ] = 1;
}
$log_in = $time_now - $r['session_log_in_time'];
$click = $time_now - $r['session_running_time'];
if ( ($log_in / 60) < 1 )
{
$log_in = sprintf("%0d", $log_in) . " seconds ago";
}
else
{
$log_in = sprintf("%0d", ($log_in / 60) ) . " minutes ago";
}
if ( ($click / 60) < 1 )
{
$click = sprintf("%0d", $click) . " seconds ago";
}
else
{
$click = sprintf("%0d", ($click / 60) ) . " minutes ago";
}
$ibforums->html .= $ibforums->adskin->add_td_row( array (
$r['session_member_name'],
"<center><a href='javascript:alert(\"Host Name: ".@gethostbyaddr($r['session_ip_address'])."\")' title='Get host name'>".$r['session_ip_address']."</a></center>",
"<center>".$log_in."</center>",
"<center>".$click."</center>",
"<center>".$r['session_location']."</center>",
) );
}
$ibforums->html .= $ibforums->adskin->end_table();
//-----------------------------------------
$ibforums->html .= $ibforums->adskin->add_td_spacer();
//-----------------------------------------
if ($ibforums->member['mgroup'] == $ibforums->vars['admin_group'])
{
//-----------------------------------------
// LAST 5 Admin Actions
//-----------------------------------------
$ibforums->adskin->td_header[] = array( "Member Name" , "20%" );
$ibforums->adskin->td_header[] = array( "Action Performed" , "40%" );
$ibforums->adskin->td_header[] = array( "Time of action" , "20%" );
$ibforums->adskin->td_header[] = array( "IP address" , "20%" );
$ibforums->html .= $ibforums->adskin->start_table( "Last 5 Admin Actions" );
$DB->cache_add_query( 'index_admin_logs', array() );
$DB->cache_exec_query();
if ( $DB->get_num_rows() )
{
while ( $rowb = $DB->fetch_row() )
{
$rowb['ctime'] = $ibforums->admin->get_date( $rowb['ctime'] );
$ibforums->html .= $ibforums->adskin->add_td_row( array( "<b>{$rowb['name']}</b>",
"{$rowb['note']}",
"{$rowb['ctime']}",
"{$rowb['ip_address']}",
) );
}
}
else
{
$ibforums->html .= $ibforums->adskin->add_td_basic("<center>No results</center>");
}
$ibforums->html .= $ibforums->adskin->end_table();
//-----------------------------------------
$ibforums->html .= $ibforums->adskin->add_td_spacer();
}
//-----------------------------------------
// Bots stuff
//-----------------------------------------
if ( $ibforums->vars['spider_sense'] )
{
//-----------------------------------------
// Get bot names
//-----------------------------------------
foreach( explode( "\n", $ibforums->vars['search_engine_bots'] ) as $bot )
{
list($ua, $n) = explode( "=", $bot );
$this->bot_map[ strtolower($ua) ] = $n;
}
$ibforums->adskin->td_header[] = array( "Search Bot" , "20%" );
$ibforums->adskin->td_header[] = array( "Date" , "25%" );
$ibforums->adskin->td_header[] = array( "Query" , "20%" );
$ibforums->adskin->td_header[] = array( "Query" , "35%" );
$ibforums->html .= $ibforums->adskin->start_table( "Last 10 Search Engine Spiders Hits" );
$DB->simple_construct( array( 'select' => '*', 'from' => 'spider_logs', 'order' => 'entry_date DESC', 'limit' => array( 0,10) ) );
$DB->simple_exec();
while ( $r = $DB->fetch_row() )
{
$ibforums->html .= $ibforums->adskin->add_td_row( array( "<strong>".$this->bot_map[ strtolower($r['bot']) ]."&nbsp;</strong>",
$ibforums->admin->get_date( $r['entry_date'], 'SHORT' ),
$r['ip_address'].'&nbsp;',
$r['query_string'].'&nbsp;'
) );
}
$ibforums->html .= $ibforums->adskin->end_table();
$ibforums->html .= $ibforums->adskin->add_td_spacer();
}
//-----------------------------------------
// Stats
//-----------------------------------------
$reg = $DB->simple_exec_query( array( 'select' => 'COUNT(*) as reg', 'from' => 'validating', 'where' => 'lost_pass <> 1' ) );
$reg['reg'] = intval( $reg['reg'] );
$coppa = $DB->simple_exec_query( array( 'select' => 'COUNT(*) as coppa', 'from' => 'validating', 'where' => 'coppa_user=1' ) );
$coppa['coppa'] = intval( $coppa['coppa'] );
$ibforums->adskin->td_header[] = array( "Definition", "25%" );
$ibforums->adskin->td_header[] = array( "Value" , "25%" );
$ibforums->adskin->td_header[] = array( "Definition", "25%" );
$ibforums->adskin->td_header[] = array( "Value" , "25%" );
$ibforums->html .= $ibforums->adskin->start_table( "System Overview" );
$ibforums->html .= $ibforums->adskin->add_td_row( array( "Total Unique Topics" , intval($ibforums->cache['stats']['total_topics']),
"Total Replies to topics", intval($ibforums->cache['stats']['total_replies']),
) );
$ibforums->html .= $ibforums->adskin->add_td_row( array( "Total Members", intval($ibforums->cache['stats']['mem_count']), "Public Upload Folder Size", $uploads_size ) );
$ibforums->html .= $ibforums->adskin->add_td_row( array( "<a href='{$ibforums->adskin->base_url}&act=mem&code=mod'>Users awaiting validation</a>" , $reg['reg'],
"<a href='{$ibforums->adskin->base_url}&act=mem&code=mod'>COPPA Requests</a> from 'Users awaiting validation' total", $coppa['coppa'],
) );
$ibforums->html .= $ibforums->adskin->end_table();
$ibforums->admin->output();
}
}
?>
+159
View File
@@ -0,0 +1,159 @@
<?php
/*
+--------------------------------------------------------------------------
| Invision Power Board v2.0.0
| =============================================
| by Matthew Mecham
| (c) 2001 - 2004 Invision Power Services, Inc.
| http://www.invisionpower.com
| =============================================
| Web: http://www.invisionboard.com
| Time: Tue, 21 Sep 2004 16:34:28 GMT
| Release: 150aa7a702c3c8b6f6eb90ad49305d2f
| Licence Info: http://www.invisionboard.com/?license
+---------------------------------------------------------------------------
|
| > IPS Remote Call thingy
| > Module written by Matt Mecham
| > Date started: 17th October 2002
|
| > Module Version Number: 1.0.0
| > DBA Checked: Tue 25th May 2004
+--------------------------------------------------------------------------
*/
if ( ! defined( 'IN_ACP' ) )
{
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded 'admin.php'.";
exit();
}
class ad_ips {
var $base_url;
var $colours = array();
var $url = "http://www.invisionboard.com/acp/";
var $version = "1.1";
function auto_run()
{
global $ibforums, $DB, $std;
//-----------------------------------------
// Kill globals - globals bad, Homer good.
//-----------------------------------------
$tmp_in = array_merge( $_GET, $_POST, $_COOKIE );
foreach ( $tmp_in as $k => $v )
{
unset($$k);
}
//-----------------------------------------
switch($ibforums->input['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 $ibforums, $DB, $std;
@header("Location: ".$this->url."?news");
exit();
}
function updates()
{
global $ibforums, $DB, $std;
//@header("Location: ".$this->url."?updates&version=".$this->version);
@header("Location: ".$this->url."?updates");
exit();
}
function docs()
{
global $ibforums, $DB, $std;
@header("Location: http://www.invisionpower.com/documentation/showdoc.php");
exit();
}
function support()
{
global $ibforums, $DB, $std;
@header("Location: ".$this->url."?support");
exit();
}
function host()
{
global $ibforums, $DB, $std;
@header("Location: ".$this->url."?host");
exit();
}
function purchase()
{
global $ibforums, $DB, $std;
@header("Location: ".$this->url."?purchase");
exit();
}
}
?>
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
+526
View File
@@ -0,0 +1,526 @@
<?php
/*
+--------------------------------------------------------------------------
| Invision Power Board v2.0.0
| =============================================
| by Matthew Mecham
| (c) 2001 - 2004 Invision Power Services, Inc.
| http://www.invisionpower.com
| =============================================
| Web: http://www.invisionboard.com
| Time: Tue, 21 Sep 2004 16:34:28 GMT
| Release: 150aa7a702c3c8b6f6eb90ad49305d2f
| Licence Info: http://www.invisionboard.com/?license
+---------------------------------------------------------------------------
|
| > Admin Member Tool functions
| > Module written by Matt Mecham
| > Date started: 17th September 2003
|
| > Module Version Number: 1.0.0
| > DBA Checked: Tue 25th May 2004
+--------------------------------------------------------------------------
*/
if ( ! defined( 'IN_ACP' ) )
{
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded 'admin.php'.";
exit();
}
$root_path = "";
class ad_member_tools
{
var $base_url;
var $modules = "";
function auto_run()
{
global $ibforums, $DB, $std, $ibforums;
//-----------------------------------------
// Kill globals - globals bad, Homer good.
//-----------------------------------------
$tmp_in = array_merge( $_GET, $_POST, $_COOKIE );
foreach ( $tmp_in as $k => $v )
{
unset($$k);
}
$ibforums->admin->nav[] = array( 'act=mtools', 'Member Tools Home' );
//-----------------------------------------
$ibforums->admin->page_title = "Member Tool Box";
$ibforums->admin->page_detail = 'You can use the tools below to search for IP address.';
switch($ibforums->input['code'])
{
case 'showallips':
$this->show_ips();
break;
case 'learnip':
$this->learn_ip();
break;
//-----------------------------------------
default:
$this->show_index();
break;
}
}
//-----------------------------------------
//
// LEARN ABOUT THE IP. It's very good.
//
//-----------------------------------------
function learn_ip()
{
global $ibforums, $DB, $std, $HTTP_POST_VARS;
if ( $ibforums->input['ip'] == "" )
{
$this->show_index("You did not enter an IP address to search by");
}
$ip = trim($ibforums->input['ip']);
$resolved = 'N/A - Partial IP Address';
$exact = 0;
if ( substr_count( $ip, '.' ) == 3 )
{
$exact = 1;
}
if ( strstr( $ip, '*' ) )
{
$exact = 0;
$ip = str_replace( "*", "", $ip );
}
if ( $exact != 0 )
{
$resolved = gethostbyaddr($ip);
$query = "='".$ip."'";
}
else
{
$query = " LIKE '".$ip."%'";
}
//-----------------------------------------
$ibforums->adskin->td_header[] = array( "&nbsp;" , "40%" );
$ibforums->adskin->td_header[] = array( "&nbsp;" , "60%" );
//-----------------------------------------
$ibforums->html .= $ibforums->adskin->start_table( "Host Address for {$ibforums->input['ip']}" );
$ibforums->html .= $ibforums->adskin->add_td_row( array( "<b>IP address resolves to</b>" ,
$resolved
) );
$ibforums->html .= $ibforums->adskin->end_table();
//-----------------------------------------
// Find registered members
//-----------------------------------------
$ibforums->adskin->td_header[] = array( "Name" , "30%" );
$ibforums->adskin->td_header[] = array( "Email" , "20%" );
$ibforums->adskin->td_header[] = array( "Posts" , "10%" );
$ibforums->adskin->td_header[] = array( "IP" , "20%" );
$ibforums->adskin->td_header[] = array( "Registered" , "20%" );
$ibforums->html .= $ibforums->adskin->start_table( "Members using that IP when REGISTERING" );
$DB->simple_construct( array( 'select' => 'id, name, email, posts, ip_address, joined',
'from' => 'members',
'where' => "ip_address{$query}",
'order' => 'joined DESC',
'limit' => array( 0,250) ) );
$DB->simple_exec();
if ( ! $DB->get_num_rows() )
{
$ibforums->html .= $ibforums->adskin->add_td_basic( "No Matches Found", "center");
}
else
{
while ( $m = $DB->fetch_row() )
{
$ibforums->html .= $ibforums->adskin->add_td_row( array( $m['name'] ,
$m['email'],
$m['posts'],
$m['ip_address'],
$std->get_date( $m['joined'], 'SHORT' )
) );
}
}
$ibforums->html .= $ibforums->adskin->end_table();
//-----------------------------------------
// Find Names posted under
//-----------------------------------------
$ibforums->adskin->td_header[] = array( "Name" , "20%" );
$ibforums->adskin->td_header[] = array( "Email" , "20%" );
$ibforums->adskin->td_header[] = array( "IP" , "15%" );
$ibforums->adskin->td_header[] = array( "First Used" , "20%" );
$ibforums->adskin->td_header[] = array( "View Post" , "15%" );
$ibforums->html .= $ibforums->adskin->start_table( "Members using that IP when POSTING" );
$DB->cache_add_query( 'member_tools_learn_ip_one', array( 'query' => $query) );
$DB->cache_exec_query();
if ( ! $DB->get_num_rows() )
{
$ibforums->html .= $ibforums->adskin->add_td_basic( "No Matches Found", "center");
}
else
{
while ( $m = $DB->fetch_row() )
{
$ibforums->html .= $ibforums->adskin->add_td_row( array( $m['name'] ,
$m['email'],
$m['ip_address'],
$std->get_date( $m['post_date'], 'SHORT' ),
"<center><a href='index.php?showtopic={$m['topic_id']}&view=findpost&p={$m['pid']}' target='_blank'>View Post</a></center>",
) );
}
}
$ibforums->html .= $ibforums->adskin->end_table();
//-----------------------------------------
// Find Names VOTED under
//-----------------------------------------
$ibforums->adskin->td_header[] = array( "Name" , "20%" );
$ibforums->adskin->td_header[] = array( "Email" , "20%" );
$ibforums->adskin->td_header[] = array( "IP" , "15%" );
$ibforums->adskin->td_header[] = array( "First Used" , "20%" );
$ibforums->adskin->td_header[] = array( "View Poll" , "15%" );
$ibforums->html .= $ibforums->adskin->start_table( "Members using that IP when VOTING" );
$DB->cache_add_query( 'member_tools_learn_ip_two', array( 'query' => $query) );
$DB->cache_exec_query();
if ( ! $DB->get_num_rows() )
{
$ibforums->html .= $ibforums->adskin->add_td_basic( "No Matches Found", "center");
}
else
{
while ( $m = $DB->fetch_row() )
{
$ibforums->html .= $ibforums->adskin->add_td_row( array( $m['name'] ,
$m['email'],
$m['ip_address'],
$std->get_date( $m['vote_date'], 'SHORT' ),
"<center><a href='index.php?showtopic={$m['tid']}' target='_blank'>View Poll</a></center>",
) );
}
}
$ibforums->html .= $ibforums->adskin->end_table();
//-----------------------------------------
// Find Names EMAILING under
//-----------------------------------------
$ibforums->adskin->td_header[] = array( "Name" , "20%" );
$ibforums->adskin->td_header[] = array( "Email" , "20%" );
$ibforums->adskin->td_header[] = array( "IP" , "15%" );
$ibforums->adskin->td_header[] = array( "First Used" , "20%" );
$ibforums->html .= $ibforums->adskin->start_table( "Members using that IP when EMAILING other members" );
$DB->cache_add_query( 'member_tools_learn_ip_three', array( 'query' => $query) );
$DB->cache_exec_query();
if ( ! $DB->get_num_rows() )
{
$ibforums->html .= $ibforums->adskin->add_td_basic( "No Matches Found", "center");
}
else
{
while ( $m = $DB->fetch_row() )
{
$ibforums->html .= $ibforums->adskin->add_td_row( array( $m['name'] ,
$m['email'],
$m['from_ip_address'],
$std->get_date( $m['email_date'], 'SHORT' ),
) );
}
}
$ibforums->html .= $ibforums->adskin->end_table();
//-----------------------------------------
// Find Names VALIDATING under
//-----------------------------------------
$ibforums->adskin->td_header[] = array( "Name" , "20%" );
$ibforums->adskin->td_header[] = array( "Email" , "20%" );
$ibforums->adskin->td_header[] = array( "IP" , "15%" );
$ibforums->adskin->td_header[] = array( "First Used" , "20%" );
$ibforums->html .= $ibforums->adskin->start_table( "Members using that IP while VALIDATING their accounts" );
$DB->cache_add_query( 'member_tools_learn_ip_four', array( 'query' => $query) );
$DB->cache_exec_query();
if ( ! $DB->get_num_rows() )
{
$ibforums->html .= $ibforums->adskin->add_td_basic( "No Matches Found", "center");
}
else
{
while ( $m = $DB->fetch_row() )
{
$ibforums->html .= $ibforums->adskin->add_td_row( array( $m['name'] ,
$m['email'],
$m['ip_address'],
$std->get_date( $m['entry_date'], 'SHORT' ),
) );
}
}
$ibforums->html .= $ibforums->adskin->end_table();
$ibforums->admin->output();
}
//-----------------------------------------
//
// SHOW ALL IPs
//
//-----------------------------------------
function show_ips()
{
global $ibforums, $DB, $std;
if ( $ibforums->input['name'] == "" and $ibforums->input['member_id'] == "" )
{
$this->show_index("You did not enter a name to search by");
}
if ( $ibforums->input['member_id'] )
{
$id = intval($ibforums->input['member_id']);
$DB->simple_construct( array( 'select' => 'id, name, email, ip_address', 'from' => 'members', 'where' => "id=$id" ) );
$DB->simple_exec();
if ( ! $member = $DB->fetch_row() )
{
$this->show_index("Could not locate a member with the id of '$id'");
}
}
else
{
$name = addslashes($ibforums->input['name']);
$DB->simple_construct( array( 'select' => 'id, name, email, ip_address', 'from' => 'members', 'where' => "name='$name'" ) );
$DB->simple_exec();
if ( ! $member = $DB->fetch_row() )
{
$this->show_index( "We could not find an exact match for that member name, some choices will be shown below", $name );
}
}
$DB->simple_construct( array( 'select' => 'count(distinct(ip_address)) as cnt', 'from' => 'posts', 'where' => "author_id={$ibforums->member['id']}" ) );
$DB->simple_exec();
$count = $DB->fetch_row();
$st = intval($ibforums->input['st']);
$end = 50;
$links = $std->build_pagelinks( array( 'TOTAL_POSS' => $count['cnt'],
'PER_PAGE' => $end,
'CUR_ST_VAL' => $st,
'L_SINGLE' => "Single Page",
'L_MULTI' => "Multiple Pages",
'BASE_URL' => $ibforums->adskin->base_url."&act=mtools&code=showallips&member_id={$member['id']}",
) );
$master = array();
$ips = array();
$DB->cache_add_query( 'member_tools_show_ips', array( 'mid' => $member['id'], 'st' => $st, 'end' => $end ) );
$DB->cache_exec_query();
while ( $r = $DB->fetch_row() )
{
$master[] = $r;
$ips[] = "'".$r['ip_address']."'";
}
$reg = array();
if ( count($ips) > 0 )
{
$DB->simple_construct( array( 'select' => 'id, name, ip_address', 'from' => 'members', 'where' => "ip_address IN (".implode(",",$ips).") AND id != {$member['id']}" ) );
$DB->simple_exec();
while ( $i = $DB->fetch_row() )
{
$reg[ $i['ip_address'] ][] = $i;
}
}
//-----------------------------------------
$ibforums->adskin->td_header[] = array( "IP Address" , "20%" );
$ibforums->adskin->td_header[] = array( "Times Used" , "10%" );
$ibforums->adskin->td_header[] = array( "Date Used" , "25%" );
$ibforums->adskin->td_header[] = array( "Used for other Reg." , "20%" );
$ibforums->adskin->td_header[] = array( "IP Tool" , "25%" );
//-----------------------------------------
$ibforums->html .= $ibforums->adskin->start_table( "{$member['name']}'s IP addresses ({$count['cnt']}) matches" );
foreach( $master as $idx => $r )
{
$ibforums->html .= $ibforums->adskin->add_td_row( array( $r['ip_address'] ,
$r['ip'] ,
$std->get_date( $r['post_date'], 'SHORT' ),
"<center>". intval( count($reg[ $r['ip_address'] ]) ). "</center>",
"<center><a href='{$ibforums->base_url}&act=mtools&code=learnip&ip={$r['ip_address']}'>Learn about this IP</a></center>"
) );
}
$ibforums->html .= $ibforums->adskin->add_td_basic( "$links", "center", "catrow2");
$ibforums->html .= $ibforums->adskin->end_table();
$ibforums->admin->output();
}
//-----------------------------------------
//
// Default Screen
//
//-----------------------------------------
function show_index($msg="", $membername="")
{
global $ibforums, $DB, $std, $HTTP_POST_VARS;
if ($msg != "")
{
$ibforums->adskin->td_header[] = array( "&nbsp;" , "100%" );
$ibforums->html .= $ibforums->adskin->start_table( "Message" );
$ibforums->html .= $ibforums->adskin->add_td_row( array( $msg ) );
$ibforums->html .= $ibforums->adskin->end_table();
}
$ibforums->html .= $ibforums->adskin->start_form( array( 1 => array( 'code' , 'showallips' ),
2 => array( 'act' , 'mtools' ),
) );
//-----------------------------------------
$ibforums->adskin->td_header[] = array( "&nbsp;" , "40%" );
$ibforums->adskin->td_header[] = array( "&nbsp;" , "60%" );
//-----------------------------------------
$ibforums->html .= $ibforums->adskin->start_table( "Show all IP Addresses a member has posted with" );
if ( $membername == "" )
{
$ibforums->html .= $ibforums->adskin->add_td_row( array( "<b>Enter the member's name</b>" ,
$ibforums->adskin->form_input( "name", $std->txt_stripslashes($HTTP_POST_VARS['name']) )
) );
}
else
{
$DB->simple_construct( array( 'select' => 'id, name', 'from' => 'members', 'where' => "lower(name) LIKE '{$membername}%'" ) );
$DB->simple_exec();
if ( ! $DB->get_num_rows() )
{
$this->show_index("There are no members with names that start with '$membername'");
}
$mem_array = array();
while ( $m = $DB->fetch_row() )
{
$mem_array[] = array( $m['id'], $m['name'] );
}
$ibforums->html .= $ibforums->adskin->add_td_row( array( "<b>Choose the member from the selection</b>" ,
$ibforums->adskin->form_dropdown( "member_id", $mem_array )
) );
}
$ibforums->html .= $ibforums->adskin->end_form("Get IP Addresses");
$ibforums->html .= $ibforums->adskin->end_table();
//-----------------------------------------
$ibforums->html .= $ibforums->adskin->start_form( array( 1 => array( 'code' , 'learnip' ),
2 => array( 'act' , 'mtools' ),
) );
$ibforums->adskin->td_header[] = array( "&nbsp;" , "40%" );
$ibforums->adskin->td_header[] = array( "&nbsp;" , "60%" );
//-----------------------------------------
$ibforums->html .= $ibforums->adskin->start_table( "IP Multi-Tool" );
$ibforums->html .= $ibforums->adskin->add_td_row( array( "<b>Show me everything you know about this IP...</b>" ,
$ibforums->adskin->form_input( "ip", $std->txt_stripslashes($HTTP_POST_VARS['ip']) )
) );
$ibforums->html .= $ibforums->adskin->end_form("Show me!");
$ibforums->html .= $ibforums->adskin->end_table();
$ibforums->admin->output();
}
}
?>
+861
View File
@@ -0,0 +1,861 @@
<?php
/*
+--------------------------------------------------------------------------
| Invision Power Board v2.0.0
| =============================================
| by Matthew Mecham
| (c) 2001 - 2004 Invision Power Services, Inc.
| http://www.invisionpower.com
| =============================================
| Web: http://www.invisionboard.com
| Time: Tue, 21 Sep 2004 16:34:28 GMT
| Release: 150aa7a702c3c8b6f6eb90ad49305d2f
| Licence Info: http://www.invisionboard.com/?license
+---------------------------------------------------------------------------
|
| > Admin Category functions
| > Module written by Matt Mecham
| > Date started: 1st march 2002
|
| > Module Version Number: 1.0.0
| > DBA Checked: Tue 25th May 2004
+--------------------------------------------------------------------------
*/
if ( ! defined( 'IN_ACP' ) )
{
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded 'admin.php'.";
exit();
}
class ad_moderator {
var $base_url;
function auto_run()
{
global $ibforums, $DB, $std, $forums;
$forums->forums_init();
require ROOT_PATH.'sources/admin/admin_forum_functions.php';
$this->forumfunc = new admin_forum_functions();
//-----------------------------------------
// Kill globals - globals bad, Homer good.
//-----------------------------------------
$tmp_in = array_merge( $_GET, $_POST, $_COOKIE );
foreach ( $tmp_in as $k => $v )
{
unset($$k);
}
//-----------------------------------------
switch($ibforums->input['code'])
{
case 'add':
$this->add_one();
break;
case 'add_two':
$this->add_two();
break;
case 'add_final':
$this->mod_form('add');
break;
case 'doadd':
$this->add_mod();
break;
case 'edit':
$this->mod_form('edit');
break;
case 'doedit':
$this->do_edit();
break;
case 'remove':
$this->do_delete();
break;
default:
$this->show_list();
break;
}
}
//-----------------------------------------
//
// DELETE MODERATOR
//
//-----------------------------------------
function do_delete()
{
global $ibforums, $DB, $std;
if ($ibforums->input['mid'] == "")
{
$ibforums->admin->error("You did not choose a valid moderator ID");
}
$DB->simple_construct( array( 'select' => '*', 'from' => 'moderators', 'where' => "mid=".intval($ibforums->input['mid']) ) );
$DB->simple_exec();
$mod = $DB->fetch_row();
if ( $mod['is_group'] )
{
$name = 'Group: '.$mod['group_name'];
}
else
{
$name = $mod['member_name'];
}
$DB->simple_exec_query( array( 'delete' => 'moderators', 'where' => "mid=".intval($ibforums->input['mid']) ) );
$this->rebuild_moderator_cache();
$ibforums->admin->save_log("Removed Moderator '{$name}'");
$ibforums->admin->done_screen("Moderator Removed", "Moderator Control", "act=mod", 'redirect' );
}
//-----------------------------------------
//
// EDIT MODERATOR
//
//-----------------------------------------
function do_edit()
{
global $ibforums, $DB, $std;
if ($ibforums->input['mid'] == "")
{
$ibforums->admin->error("You did not choose a valid moderator ID");
}
$DB->simple_construct( array( 'select' => '*', 'from' => 'moderators', 'where' => "mid=".intval($ibforums->input['mid']) ) );
$DB->simple_exec();
$mod = $DB->fetch_row();
//-----------------------------------------
// Build Mr Hash
//-----------------------------------------
$DB->do_update( 'moderators', array(
'forum_id' => $ibforums->input['forum_id'],
'edit_post' => $ibforums->input['edit_post'],
'edit_topic' => $ibforums->input['edit_topic'],
'delete_post' => $ibforums->input['delete_post'],
'delete_topic' => $ibforums->input['delete_topic'],
'view_ip' => $ibforums->input['view_ip'],
'open_topic' => $ibforums->input['open_topic'],
'close_topic' => $ibforums->input['close_topic'],
'mass_move' => $ibforums->input['mass_move'],
'mass_prune' => $ibforums->input['mass_prune'],
'move_topic' => $ibforums->input['move_topic'],
'pin_topic' => $ibforums->input['pin_topic'],
'unpin_topic' => $ibforums->input['unpin_topic'],
'post_q' => $ibforums->input['post_q'],
'topic_q' => $ibforums->input['topic_q'],
'allow_warn' => $ibforums->input['allow_warn'],
'split_merge' => $ibforums->input['split_merge'],
'edit_user' => $ibforums->input['edit_user'],
'can_mm' => $ibforums->input['can_mm'],
) , 'mid='.intval($ibforums->input['mid']) );
$this->rebuild_moderator_cache();
$ibforums->admin->save_log("Edited Moderator '{$mod['member_name']}'");
$ibforums->admin->done_screen("Moderator Edited", "Moderator Control", "act=mod", 'redirect' );
}
//-----------------------------------------
//
// ADD MODERATOR
//
//-----------------------------------------
function add_mod()
{
global $ibforums, $DB, $std;
if ($ibforums->input['fid'] == "")
{
$ibforums->admin->error("You did not choose any forums to add this member to");
}
//-----------------------------------------
// Build Mr Hash
//-----------------------------------------
$mr_hash = array(
'edit_post' => $ibforums->input['edit_post'],
'edit_topic' => $ibforums->input['edit_topic'],
'delete_post' => $ibforums->input['delete_post'],
'delete_topic' => $ibforums->input['delete_topic'],
'view_ip' => $ibforums->input['view_ip'],
'open_topic' => $ibforums->input['open_topic'],
'close_topic' => $ibforums->input['close_topic'],
'mass_move' => $ibforums->input['mass_move'],
'mass_prune' => $ibforums->input['mass_prune'],
'move_topic' => $ibforums->input['move_topic'],
'pin_topic' => $ibforums->input['pin_topic'],
'unpin_topic' => $ibforums->input['unpin_topic'],
'post_q' => $ibforums->input['post_q'],
'topic_q' => $ibforums->input['topic_q'],
'allow_warn' => $ibforums->input['allow_warn'],
'split_merge' => $ibforums->input['split_merge'],
'edit_user' => $ibforums->input['edit_user'],
'can_mm' => $ibforums->input['can_mm'],
);
$forum_ids = array();
$DB->simple_construct( array( 'select' => 'id', 'from' => 'forums', 'where' => "id IN(".$ibforums->input['fid'].")" ) );
$DB->simple_exec();
while( $i = $DB->fetch_row() )
{
$forum_ids[ $i['id'] ] = $i['id'];
}
//-----------------------------------------
if ($ibforums->input['mod_type'] == 'group')
{
if ($ibforums->input['gid'] == "")
{
$ibforums->admin->error("We could not match that group ID");
}
$DB->simple_construct( array( 'select' => 'g_id, g_title', 'from' => 'groups', 'where' => "g_id='".$ibforums->input['gid']."'" ) );
$DB->simple_exec();
if ( ! $group = $DB->fetch_row() )
{
$ibforums->admin->error("We could not match that group ID");
}
//-----------------------------------------
// Already using this group on this forum?
//-----------------------------------------
$DB->simple_construct( array( 'select' => '*', 'from' => 'moderators', 'where' => "forum_id IN(".$ibforums->input['fid'].") and group_id={$ibforums->input['gid']}" ) );
$DB->simple_exec();
while( $f = $DB->fetch_row() )
{
unset($forum_ids[ $f['forum_id'] ]);
}
$mr_hash['member_name'] = '-1';
$mr_hash['member_id'] = '-1';
$mr_hash['group_id'] = $group['g_id'];
$mr_hash['group_name'] = $group['g_title'];
$mr_hash['is_group'] = 1;
$ad_log = "Added Group '{$group['g_title']}' as a moderator";
}
else
{
if ($ibforums->input['mem'] == "")
{
$ibforums->admin->error("You did not choose a member to add as a moderator");
}
$DB->simple_construct( array( 'select' => 'id, name', 'from' => 'members', 'where' => "id=".intval($ibforums->input['mem']) ) );
$DB->simple_exec();
if ( ! $mem = $DB->fetch_row() )
{
$ibforums->admin->error("Could not match that member name so there.");
}
//-----------------------------------------
// Already using this member on this forum?
//-----------------------------------------
$DB->simple_construct( array( 'select' => '*', 'from' => 'moderators', 'where' => "forum_id IN(".$ibforums->input['fid'].") and member_id={$ibforums->input['mem']}" ) );
$DB->simple_exec();
while( $f = $DB->fetch_row() )
{
unset($forum_ids[ $f['forum_id'] ]);
}
$mr_hash['member_name'] = $mem['name'];
$mr_hash['member_id'] = $mem['id'];
$mr_hash['is_group'] = 0;
$ad_log = "Added Member '{$mem['name']}' as a moderator";
}
//-----------------------------------------
// Check for legal forums
//-----------------------------------------
if ( count($forum_ids) == 0)
{
$ibforums->admin->error("You did not select any forums that do not have this group or member already moderating.");
}
//-----------------------------------------
// Loopy loopy
//-----------------------------------------
foreach ($forum_ids as $cartman)
{
$mr_hash['forum_id'] = $cartman;
$DB->do_insert( 'moderators', $mr_hash );
}
$ibforums->admin->save_log($ad_log);
$this->rebuild_moderator_cache();
$ibforums->admin->done_screen("Moderator Added", "Moderator Control", "act=mod", 'redirect' );
}
//-----------------------------------------
//
// Rebuild moderator cache
//
//-----------------------------------------
function rebuild_moderator_cache()
{
global $ibforums, $std, $DB;
$ibforums->cache['moderators'] = array();
$DB->simple_construct( array( 'select' => "*",
'from' => 'moderators'
) );
$DB->simple_exec();
while ( $i = $DB->fetch_row() )
{
$ibforums->cache['moderators'][ $i['mid'] ] = $i;
}
$std->update_cache( array( 'name' => 'moderators', 'array' => 1, 'deletefirst' => 1 ) );
}
//-----------------------------------------
//
// ADD FINAL, display the add / edit form
//
//-----------------------------------------
function mod_form( $type='add' )
{
global $ibforums, $DB, $std;
$group = array();
if ($type == 'add')
{
if ($ibforums->input['fid'] == "")
{
$ibforums->admin->error("You did not choose any forums to add this member to");
}
$mod = array();
$names = array();
//-----------------------------------------
$DB->simple_construct( array( 'select' => 'name', 'from' => 'forums', 'where' => "id IN(".$ibforums->input['fid'].")" ) );
$DB->simple_exec();
while ( $r = $DB->fetch_row() )
{
$names[] = $r['name'];
}
$thenames = implode( ", ", $names );
//-----------------------------------------
$button = "Add this moderator";
$form_code = 'doadd';
if ($ibforums->input['mod_type'] == 'group')
{
$DB->simple_construct( array( 'select' => 'g_id, g_title', 'from' => 'groups', 'where' => "g_id='".$ibforums->input['mod_group']."'" ) );
$DB->simple_exec();
if (! $group = $DB->fetch_row() )
{
$ibforums->admin->error("Could not find that group to add as a moderator");
}
$ibforums->admin->page_detail = "Adding <b>group: {$group['g_title']}</b> as a moderator to: $thenames";
$ibforums->admin->page_title = "Add a moderator group";
}
else
{
if ($ibforums->input['MEMBER_ID'] == "")
{
$ibforums->admin->error("Could not resolve the member id bucko");
}
else
{
$DB->simple_construct( array( 'select' => 'name, id', 'from' => 'members', 'where' => "id=".intval($ibforums->input['MEMBER_ID']) ) );
$DB->simple_exec();
if ( ! $mem = $DB->fetch_row() )
{
$ibforums->admin->error("That member ID does not resolve");
}
$member_id = $mem['id'];
$member_name = $mem['name'];
}
$ibforums->admin->page_detail = "Adding a $member_name as a moderator to: $thenames";
$ibforums->admin->page_title = "Add a moderator";
}
}
else
{
if ($ibforums->input['mid'] == "")
{
$ibforums->admin->error("You must choose a valid moderator to edit.");
}
$button = "Edit this moderator";
$form_code = "doedit";
$ibforums->admin->page_title = "Editing a moderator";
$ibforums->admin->page_detail = "Please check the information carefully before submitting the form";
$DB->simple_construct( array( 'select' => '*', 'from' => 'moderators', 'where' => "mid=".intval($ibforums->input['mid']) ) );
$DB->simple_exec();
if ( ! $mod = $DB->fetch_row() )
{
$ibforums->admin->error("Could not retrieve that moderators record");
}
$member_id = $mod['member_id'];
$member_name = $mod['member_name'];
}
//-----------------------------------------
$ibforums->html .= $ibforums->adskin->start_form( array( 1 => array( 'code' , $form_code ),
2 => array( 'act' , 'mod' ),
3 => array( 'mid' , $mod['mid']),
4 => array( 'fid' , $ibforums->input['fid'] ),
5 => array( 'mem' , $member_id ),
6 => array( 'mod_type' , $ibforums->input['mod_type'] ),
7 => array( 'gid' , $group['g_id'] ),
8 => array( 'gname' , $group['g_name'] ),
) );
//-----------------------------------------
$ibforums->adskin->td_header[] = array( "&nbsp;" , "40%" );
$ibforums->adskin->td_header[] = array( "&nbsp;" , "60%" );
//-----------------------------------------
$ibforums->html .= $ibforums->adskin->start_table( "General Settings" );
//-----------------------------------------
if ($type == 'edit')
{
$forums = array();
$DB->simple_construct( array( 'select' => 'id, name', 'from' => 'forums', 'order' => "position" ) );
$DB->simple_exec();
while ( $r = $DB->fetch_row() )
{
$forums[] = array( $r['id'], $r['name'] );
}
$ibforums->html .= $ibforums->adskin->add_td_row( array( "<b>Moderates forum...</b>" ,
$ibforums->adskin->form_dropdown( "forum_id", $forums, $mod['forum_id'] )
) );
}
//-----------------------------------------
$ibforums->html .= $ibforums->adskin->add_td_row( array( "<b>Can edit others posts/polls?</b>" ,
$ibforums->adskin->form_yes_no("edit_post", $mod['edit_post'] )
) );
$ibforums->html .= $ibforums->adskin->add_td_row( array( "<b>Can edit others topic titles?</b>" ,
$ibforums->adskin->form_yes_no("edit_topic", $mod['edit_topic'] )
) );
$ibforums->html .= $ibforums->adskin->add_td_row( array( "<b>Can delete others posts?</b>" ,
$ibforums->adskin->form_yes_no("delete_post", $mod['delete_post'] )
) );
$ibforums->html .= $ibforums->adskin->add_td_row( array( "<b>Can delete others topics/polls?</b>" ,
$ibforums->adskin->form_yes_no("delete_topic", $mod['delete_topic'] )
) );
$ibforums->html .= $ibforums->adskin->add_td_row( array( "<b>Can view posters IP addresses?</b>" ,
$ibforums->adskin->form_yes_no("view_ip", $mod['view_ip'] )
) );
$ibforums->html .= $ibforums->adskin->add_td_row( array( "<b>Can open locked topics?</b>" ,
$ibforums->adskin->form_yes_no("open_topic", $mod['open_topic'] )
) );
$ibforums->html .= $ibforums->adskin->add_td_row( array( "<b>Can close open topics?</b>" ,
$ibforums->adskin->form_yes_no("close_topic", $mod['close_topic'] )
) );
$ibforums->html .= $ibforums->adskin->add_td_row( array( "<b>Can move topics?</b>" ,
$ibforums->adskin->form_yes_no("move_topic", $mod['move_topic'] )
) );
$ibforums->html .= $ibforums->adskin->add_td_row( array( "<b>Can pin topics?</b>" ,
$ibforums->adskin->form_yes_no("pin_topic", $mod['pin_topic'] )
) );
$ibforums->html .= $ibforums->adskin->add_td_row( array( "<b>Can unpin topics?</b>" ,
$ibforums->adskin->form_yes_no("unpin_topic", $mod['unpin_topic'] )
) );
$ibforums->html .= $ibforums->adskin->add_td_row( array( "<b>Can split / merge topics?</b>" ,
$ibforums->adskin->form_yes_no("split_merge", $mod['split_merge'] )
) );
$ibforums->html .= $ibforums->adskin->end_table();
//-----------------------------------------
$ibforums->adskin->td_header[] = array( "&nbsp;" , "40%" );
$ibforums->adskin->td_header[] = array( "&nbsp;" , "60%" );
//-----------------------------------------
$ibforums->html .= $ibforums->adskin->start_table( "Moderator Control Panel Settings" );
//-----------------------------------------
$ibforums->html .= $ibforums->adskin->add_td_row( array( "<b>Can mass move topics?</b>" ,
$ibforums->adskin->form_yes_no("mass_move", $mod['mass_move'] )
) );
$ibforums->html .= $ibforums->adskin->add_td_row( array( "<b>Can mass prune topics?</b>" ,
$ibforums->adskin->form_yes_no("mass_prune", $mod['mass_prune'] )
) );
$ibforums->html .= $ibforums->adskin->add_td_row( array( "<b>Can set topics as visible and invisible?</b>" ,
$ibforums->adskin->form_yes_no("topic_q", $mod['topic_q'] )
) );
$ibforums->html .= $ibforums->adskin->add_td_row( array( "<b>Can set posts as visible and invisible?</b>" ,
$ibforums->adskin->form_yes_no("post_q", $mod['post_q'] )
) );
$ibforums->html .= $ibforums->adskin->end_table();
//-----------------------------------------
$ibforums->adskin->td_header[] = array( "&nbsp;" , "40%" );
$ibforums->adskin->td_header[] = array( "&nbsp;" , "60%" );
//-----------------------------------------
$ibforums->html .= $ibforums->adskin->start_table( "Advanced Settings" );
//-----------------------------------------
$ibforums->html .= $ibforums->adskin->add_td_row( array( "<b>Can warn other users?</b>" ,
$ibforums->adskin->form_yes_no("allow_warn", $mod['allow_warn'] )
) );
//$ibforums->html .= $ibforums->adskin->add_td_row( array( "<b>Can edit user avatars and signatures?</b>" ,
// $ibforums->adskin->form_yes_no("edit_user", $mod['edit_user'] )
// ) );
$ibforums->html .= $ibforums->adskin->add_td_row( array( "<b>Can use topic multi-moderation?</b><br>".$ibforums->adskin->js_help_link('mod_mmod', 'Important Information' ) ,
$ibforums->adskin->form_yes_no("can_mm", $mod['can_mm'] )
) );
//-----------------------------------------
$ibforums->html .= $ibforums->adskin->end_form($button);
$ibforums->html .= $ibforums->adskin->end_table();
$ibforums->admin->output();
}
//-----------------------------------------
//
// ADD step one: Look up a member
//
//-----------------------------------------
function add_one()
{
global $ibforums, $DB, $std;
//-----------------------------------------
// Grab and serialize the input
//-----------------------------------------
$fid = "";
$fidarray = array();
foreach ($ibforums->input as $k => $v)
{
if ( preg_match( "/^add_(\d+)$/", $k, $match ) )
{
if ($ibforums->input[ $match[0] ])
{
$fidarray[] = $match[1];
}
}
}
if ( count($fidarray) < 1 )
{
$ibforums->admin->error("You must select a forum, or forums to add a moderator to. You can do this by checking the checkboxes to the left of the forum name");
}
$fid = implode( "," ,$fidarray );
$ibforums->admin->page_title = "Add a moderator";
$ibforums->admin->page_detail = "Please find a member or group to moderate the forums you previously selected.";
//-----------------------------------------
$ibforums->html .= $ibforums->adskin->start_form( array( 1 => array( 'code' , 'add_two' ),
2 => array( 'act' , 'mod' ),
3 => array( 'fid' , $fid ),
4 => array( 'mod_type' , $ibforums->input['mod_type'] ),
) );
//-----------------------------------------
$ibforums->adskin->td_header[] = array( "&nbsp;" , "40%" );
$ibforums->adskin->td_header[] = array( "&nbsp;" , "60%" );
//-----------------------------------------
if ($ibforums->input['mod_type'] == 'member')
{
$ibforums->html .= $ibforums->adskin->start_table( "Search for a member" );
$ibforums->html .= $ibforums->adskin->add_td_row( array( "<b>Enter part or all of the usersname</b>" ,
$ibforums->adskin->form_input( "USER_NAME" )
) );
$ibforums->html .= $ibforums->adskin->end_form("Find Member");
$ibforums->html .= $ibforums->adskin->end_table();
}
else
{
// Get the group ID's and names
$mem_group = array();
$DB->simple_construct( array( 'select' => 'g_id, g_title', 'from' => 'groups', 'order' => "g_title" ) );
$DB->simple_exec();
while ( $r = $DB->fetch_row() )
{
$mem_group[] = array( $r['g_id'] , $r['g_title'] );
}
$ibforums->html .= $ibforums->adskin->start_table( "Choose a group as a moderator" );
$ibforums->html .= $ibforums->adskin->add_td_row( array( "<b>Select a group</b>" ,
$ibforums->adskin->form_dropdown( "mod_group", $mem_group )
) );
$ibforums->html .= $ibforums->adskin->end_form("Add this group");
$ibforums->html .= $ibforums->adskin->end_table();
}
$ibforums->admin->output();
}
//-----------------------------------------
//
// REFINE MEMBER SEARCH
//
//-----------------------------------------
function add_two()
{
global $ibforums, $DB, $std;
// Are we adding a group as a mod? If so, bounce straight to the mod perms form
if ($ibforums->input['mod_type'] == 'group')
{
$this->mod_form();
exit();
}
// Else continue as normal.
if ($ibforums->input['USER_NAME'] == "")
{
$ibforums->admin->error("You didn't choose a member name to look for!");
}
$DB->simple_construct( array( 'select' => 'id, name', 'from' => 'members', 'where' => "name LIKE '".$ibforums->input['USER_NAME']."%'" ) );
$DB->simple_exec();
if (! $DB->get_num_rows() )
{
$ibforums->admin->error("Sorry, we could not find any members that matched the search string you entered");
}
$form_array = array();
while ( $r = $DB->fetch_row() )
{
$form_array[] = array( $r['id'] , $r['name'] );
}
$ibforums->admin->page_title = "Add a moderator";
$ibforums->admin->page_detail = "Please select the correct member name from the selection below to add as a moderator to the previously selected forums.";
//-----------------------------------------
$ibforums->html .= $ibforums->adskin->start_form( array( 1 => array( 'code' , 'add_final' ),
2 => array( 'act' , 'mod' ),
3 => array( 'fid' , $ibforums->input['fid']),
) );
//-----------------------------------------
$ibforums->adskin->td_header[] = array( "&nbsp;" , "40%" );
$ibforums->adskin->td_header[] = array( "&nbsp;" , "60%" );
//-----------------------------------------
$ibforums->html .= $ibforums->adskin->start_table( "Search for a member" );
$ibforums->html .= $ibforums->adskin->add_td_row( array( "<b>Choose from the matches...</b>" ,
$ibforums->adskin->form_dropdown( "MEMBER_ID", $form_array )
) );
$ibforums->html .= $ibforums->adskin->end_form("Choose Member");
$ibforums->html .= $ibforums->adskin->end_table();
$ibforums->admin->output();
}
//-----------------------------------------
//
// SHOW LIST
// Renders a complete listing of all the forums and categories w/mods.
//
//-----------------------------------------
function show_list()
{
global $ibforums, $DB, $std;
$ibforums->admin->page_title = "Moderator Control Overview";
$ibforums->admin->page_detail = "This section allows you to edit, remove and add new moderators to your forums";
$ibforums->html .= $ibforums->adskin->start_form( array( 1 => array( 'code' , 'add' ),
2 => array( 'act' , 'mod' ),
) );
//-----------------------------------------
// Grab the moderators
//-----------------------------------------
$this->forumfunc->moderators = array();
$DB->simple_construct( array( 'select' => '*', 'from' => 'moderators' ) );
$DB->simple_exec();
while ($r = $DB->fetch_row())
{
$this->forumfunc->moderators[] = $r;
}
//-----------------------------------------
// Loop and print
//-----------------------------------------
$this->forumfunc->type = 'moderator';
$this->forumfunc->show_all = 1;
$this->forumfunc->forums_list_forums();
$ibforums->adskin->td_header[] = array( "&nbsp;" , "40%" );
$ibforums->adskin->td_header[] = array( "&nbsp;" , "60%" );
$ibforums->html .= $ibforums->adskin->start_table("Add Moderator");
$ibforums->html .= $ibforums->adskin->add_td_basic( "<b>Type of moderator to add:</b> &nbsp;" . $ibforums->adskin->form_dropdown( "mod_type",
array(
0 => array( 'member', 'Single Member' ),
1 => array( 'group', 'Member Group' )
)
) , "center" );
$ibforums->html .= $ibforums->adskin->end_form("Add a moderator to the selected forums");
$ibforums->html .= $ibforums->adskin->end_table();
$ibforums->admin->output();
}
}
?>
+357
View File
@@ -0,0 +1,357 @@
<?php
/*
+--------------------------------------------------------------------------
| Invision Power Board v2.0.0
| =============================================
| by Matthew Mecham
| (c) 2001 - 2004 Invision Power Services, Inc.
| http://www.invisionpower.com
| =============================================
| Web: http://www.invisionboard.com
| Time: Tue, 21 Sep 2004 16:34:28 GMT
| Release: 150aa7a702c3c8b6f6eb90ad49305d2f
| Licence Info: http://www.invisionboard.com/?license
+---------------------------------------------------------------------------
|
| > Import functions
| > Module written by Matt Mecham
| > Date started: 22nd April 2002
|
| > Module Version Number: 1.0.0
| > DBA Checked: Tue 25th May 2004
+--------------------------------------------------------------------------
*/
if ( ! defined( 'IN_ACP' ) )
{
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded 'admin.php'.";
exit();
}
class ad_modlogs {
var $base_url;
function auto_run()
{
global $ibforums, $DB, $std;
//-----------------------------------------
// Kill globals - globals bad, Homer good.
//-----------------------------------------
$tmp_in = array_merge( $_GET, $_POST, $_COOKIE );
foreach ( $tmp_in as $k => $v )
{
unset($$k);
}
//-----------------------------------------
switch($ibforums->input['code'])
{
case 'view':
$this->view();
break;
case 'remove':
$this->remove();
break;
//-----------------------------------------
default:
$this->list_current();
break;
}
}
//-----------------------------------------
// Remove archived files
//-----------------------------------------
function view()
{
global $ibforums, $DB, $std;
$start = $ibforums->input['st'] ? $ibforums->input['st'] : 0;
$ibforums->admin->page_detail = "Viewing all actions by a moderator";
$ibforums->admin->page_title = "Moderator Logs Manager";
if ($ibforums->input['search_string'] == "")
{
$DB->simple_construct( array( 'select' => 'COUNT(id) as count', 'from' => 'moderator_logs', 'where' => "member_id=".intval($ibforums->input['mid']) ) );
$DB->simple_exec();
$row = $DB->fetch_row();
$row_count = $row['count'];
$query = "&act=modlog&mid={$ibforums->input['mid']}&code=view";
$DB->cache_add_query( 'modlogs_view_one', array( 'mid' => $ibforums->input['mid'], 'start' => $start ) );
$DB->cache_exec_query();
}
else
{
$ibforums->input['search_string'] = urldecode($ibforums->input['search_string']);
if ( ($ibforums->input['search_type'] == 'topic_id') or ($ibforums->input['search_type'] == 'forum_id') )
{
$dbq = "m.".$ibforums->input['search_type']."='".$ibforums->input['search_string']."'";
}
else
{
$dbq = "m.".$ibforums->input['search_type']." LIKE '%".$ibforums->input['search_string']."%'";
}
$DB->simple_construct( array( 'select' => 'COUNT(m.id) as count', 'from' => 'moderator_logs m', 'where' => $dbq ) );
$DB->simple_exec();
$row = $DB->fetch_row();
$row_count = $row['count'];
$query = "&act=modlog&code=view&search_type={$ibforums->input['search_type']}&search_string=".urlencode($ibforums->input['search_string']);
$DB->cache_add_query( 'modlogs_view_two', array( 'dbq' => $dbq, 'start' => $start ) );
$DB->cache_exec_query();
}
$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' => $ibforums->base_url.$query,
)
);
$ibforums->admin->page_detail = "You may view and remove actions performed by your moderators";
$ibforums->admin->page_title = "Moderator Logs Manager";
//-----------------------------------------
$ibforums->adskin->td_header[] = array( "Member Name" , "15%" );
$ibforums->adskin->td_header[] = array( "Action Perfomed" , "15%" );
$ibforums->adskin->td_header[] = array( "Forum" , "15%" );
$ibforums->adskin->td_header[] = array( "Topic Title" , "25%" );
$ibforums->adskin->td_header[] = array( "Time of action" , "20%" );
$ibforums->adskin->td_header[] = array( "IP address" , "10%" );
$ibforums->html .= $ibforums->adskin->start_table( "Saved Moderator Logs" );
$ibforums->html .= $ibforums->adskin->add_td_basic($links, 'center', 'catrow');
if ( $DB->get_num_rows() )
{
while ( $row = $DB->fetch_row() )
{
$row['ctime'] = $ibforums->admin->get_date( $row['ctime'], 'LONG' );
if ( $row['topic_id'] )
{
$topicid = "<br />Topic ID: ".$row['topic_id'];
}
else
{
$topicid = "&nbsp;";
}
$sess_id = preg_replace( "/^.+?s=(\w{32}).+?$/" , "\\1", $row['http_referer'] );
$row['http_referer'] = preg_replace( "/s=(\w){32}/" , "" , $row['http_referer'] );
$ibforums->html .= $ibforums->adskin->add_td_row( array( "<b>{$row['member_name']}</b>",
"<span style='font-weight:bold;color:red'>{$row['action']}</span>",
"<b>{$row['name']}</b>",
"{$row['topic_title']}".$topicid,
"{$row['ctime']}",
"{$row['ip_address']}",
) );
}
}
else
{
$ibforums->html .= $ibforums->adskin->add_td_basic("<center>No results</center>");
}
$ibforums->html .= $ibforums->adskin->add_td_basic($links, 'center', 'tdtop');
$ibforums->html .= $ibforums->adskin->end_table();
//-----------------------------------------
//-------------------------------
$ibforums->admin->output();
}
//-----------------------------------------
// Remove archived files
//-----------------------------------------
function remove()
{
global $ibforums, $DB, $std;
if ($ibforums->input['mid'] == "")
{
$ibforums->admin->error("You did not select a member ID to remove by!");
}
$DB->simple_exec_query( array( 'delete' => 'moderator_logs', 'where' => "member_id=".intval($ibforums->input['mid']) ) );
$ibforums->admin->save_log("Removed Moderator Logs");
$std->boink_it($ibforums->base_url."&act=modlog");
exit();
}
//-----------------------------------------
// SHOW ALL LANGUAGE PACKS
//-----------------------------------------
function list_current()
{
global $ibforums, $DB, $std;
$form_array = array();
$ibforums->admin->page_detail = "You may view and remove actions performed by your moderators";
$ibforums->admin->page_title = "Moderator Logs Manager";
//-----------------------------------------
// VIEW LAST 5
//-----------------------------------------
$DB->cache_add_query( 'modlogs_list_current_last_five', array() );
$DB->cache_exec_query();
$ibforums->adskin->td_header[] = array( "Member Name" , "15%" );
$ibforums->adskin->td_header[] = array( "Action Perfomed" , "15%" );
$ibforums->adskin->td_header[] = array( "Forum" , "15%" );
$ibforums->adskin->td_header[] = array( "Topic Title" , "25%" );
$ibforums->adskin->td_header[] = array( "Time of action" , "20%" );
$ibforums->adskin->td_header[] = array( "IP address" , "10%" );
$ibforums->html .= $ibforums->adskin->start_table( "Last 5 Moderation Actions" );
if ( $DB->get_num_rows() )
{
while ( $row = $DB->fetch_row() )
{
$row['ctime'] = $ibforums->admin->get_date( $row['ctime'], 'LONG' );
$topicid = "";
if ( $row['topic_id'] )
{
$topicid = "<br />Topic ID: ".$row['topic_id'];
}
$sess_id = preg_replace( "/^.+?s=(\w{32}).+?$/" , "\\1", $row['http_referer'] );
$row['http_referer'] = preg_replace( "/s=(\w){32}/" , "" , $row['http_referer'] );
$ibforums->html .= $ibforums->adskin->add_td_row( array( "<b>{$row['member_name']}</b>",
"<span style='font-weight:bold;color:red'>{$row['action']}</span>",
"<b>{$row['name']}</b>",
"{$row['topic_title']}".$topicid,
"{$row['ctime']}",
"{$row['ip_address']}",
) );
}
}
else
{
$ibforums->html .= $ibforums->adskin->add_td_basic("<center>No results</center>");
}
$ibforums->html .= $ibforums->adskin->end_table();
//-----------------------------------------
$ibforums->adskin->td_header[] = array( "Member Name" , "30%" );
$ibforums->adskin->td_header[] = array( "Actions Perfomed" , "20%" );
$ibforums->adskin->td_header[] = array( "View all by member" , "20%" );
$ibforums->adskin->td_header[] = array( "Remove all by member" , "30%" );
$ibforums->html .= $ibforums->adskin->start_table( "Saved Moderator Logs" );
$DB->cache_add_query( 'modlogs_list_current_show_all', array() );
$DB->cache_exec_query();
while ( $r = $DB->fetch_row() )
{
$ibforums->html .= $ibforums->adskin->add_td_row( array( "<b>{$r['member_name']}</b>",
"<center>{$r['act_count']}</center>",
"<center><a href='".$ibforums->adskin->base_url."&act=modlog&code=view&mid={$r['member_id']}'>View</a></center>",
"<center><a href='".$ibforums->adskin->base_url."&act=modlog&code=remove&mid={$r['member_id']}'>Remove</a></center>",
) );
}
$ibforums->html .= $ibforums->adskin->end_table();
//-----------------------------------------
//-------------------------------
$ibforums->html .= $ibforums->adskin->start_form( array( 1 => array( 'code' , 'view' ),
2 => array( 'act' , 'modlog' ),
) );
$ibforums->adskin->td_header[] = array( "&nbsp;" , "40%" );
$ibforums->adskin->td_header[] = array( "&nbsp;" , "60%" );
$ibforums->html .= $ibforums->adskin->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' )
);
//-----------------------------------------
$ibforums->html .= $ibforums->adskin->add_td_row( array( "<b>Search for...</b>" ,
$ibforums->adskin->form_input( "search_string")
) );
$ibforums->html .= $ibforums->adskin->add_td_row( array( "<b>Search in...</b>" ,
$ibforums->adskin->form_dropdown( "search_type", $form_array)
) );
$ibforums->html .= $ibforums->adskin->end_form("Search");
$ibforums->html .= $ibforums->adskin->end_table();
//-----------------------------------------
//-------------------------------
$ibforums->admin->output();
}
}
?>
+542
View File
@@ -0,0 +1,542 @@
<?php
/*
+--------------------------------------------------------------------------
| Invision Power Board v2.0.0
| =============================================
| by Matthew Mecham
| (c) 2001 - 2004 Invision Power Services, Inc.
| http://www.invisionpower.com
| =============================================
| Web: http://www.invisionboard.com
| Time: Tue, 21 Sep 2004 16:34:28 GMT
| Release: 150aa7a702c3c8b6f6eb90ad49305d2f
| Licence Info: http://www.invisionboard.com/?license
+---------------------------------------------------------------------------
|
| > Topic Multi-Moderation
| > Module written by Matt Mecham
| > Date started: 14th May 2003
|
| > Module Version Number: 1.0.0
| > DBA Checked: Tue 25th May 2004
+--------------------------------------------------------------------------
*/
if ( ! defined( 'IN_ACP' ) )
{
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded 'admin.php'.";
exit();
}
class ad_multi_moderate
{
var $base_url;
var $forumfunc = "";
function auto_run()
{
global $ibforums, $DB, $std, $forums;
$forums->forums_init();
require ROOT_PATH.'sources/admin/admin_forum_functions.php';
$this->forumfunc = new admin_forum_functions();
//-----------------------------------------
// Kill globals - globals bad, Homer good.
//-----------------------------------------
$tmp_in = array_merge( $_GET, $_POST, $_COOKIE );
foreach ( $tmp_in as $k => $v )
{
unset($$k);
}
$ibforums->admin->nav[] = array( 'act=multimod', 'Topic multi-moderation home' );
switch($ibforums->input['code'])
{
case 'list':
$this->list_current();
break;
case 'new':
$this->do_form('new');
break;
case 'edit':
$this->do_form('edit');
break;
case 'donew':
$this->do_save('new');
break;
case 'doedit':
$this->do_save('edit');
break;
case 'delete':
$this->do_delete();
break;
//-----------------------------------------
default:
$this->list_current();
break;
}
}
//-----------------------------------------
// Rebuild Cache
//-----------------------------------------
function rebuild_cache()
{
global $ibforums, $DB, $std;
$ibforums->cache['multimod'] = array();
$DB->simple_construct( array(
'select' => '*',
'from' => 'topic_mmod',
'order' => 'mm_title'
) );
$DB->simple_exec();
while ($i = $DB->fetch_row())
{
$ibforums->cache['multimod'][ $i['mm_id'] ] = $i;
}
$std->update_cache( array( 'name' => 'multimod', 'array' => 1, 'deletefirst' => 1 ) );
}
//-----------------------------------------
// DELETE!
//-----------------------------------------
function do_delete()
{
global $ibforums, $DB, $std;
if ($ibforums->input['id'] == "")
{
$ibforums->admin->error("Could not resolve the MMOD ID, please try again");
}
$DB->simple_exec_query( array( 'delete' => 'topic_mmod', 'where' => "mm_id=".intval($ibforums->input['id']) ) );
$this->rebuild_cache();
$ibforums->admin->save_log("Topic Multi-Mod removed");
$std->boink_it($ibforums->adskin->base_url."&act=multimod");
}
//-----------------------------------------
// SAVE!
//-----------------------------------------
function do_save($type='new')
{
global $ibforums, $DB, $std, $HTTP_POST_VARS;
$forums = array();
$ibforums->input['id'] = intval($ibforums->input['id']);
if ( $type == 'edit' )
{
if ( $ibforums->input['id'] < 1 )
{
$ibforums->admin->error("You must use a valid id");
}
}
if ( $ibforums->input['mm_title'] == "" )
{
$ibforums->admin->error("You must enter a valid title");
}
//-----------------------------------------
// Check for forums...
//-----------------------------------------
$forums = $this->get_activein_forums();
if ( ! $forums )
{
$ibforums->admin->error("You must select some forums to activate with this multi-moderation suite");
}
if ( $ibforums->input['topic_move'] == 'n' )
{
$ibforums->admin->error("Incorrect forum chosen in the 'move to' section of the topic multi-moderation. Please note that you cannot choose to move the topic to a category");
}
$save = array(
'mm_title' => $ibforums->input['mm_title'],
'mm_enabled' => 1,
'topic_state' => $ibforums->input['topic_state'],
'topic_pin' => $ibforums->input['topic_pin'],
'topic_move' => $ibforums->input['topic_move'],
'topic_move_link' => $ibforums->input['topic_move_link'],
'topic_title_st' => $ibforums->admin->make_safe($HTTP_POST_VARS['topic_title_st']),
'topic_title_end' => $ibforums->admin->make_safe($HTTP_POST_VARS['topic_title_end']),
'topic_reply' => $ibforums->input['topic_reply'],
'topic_reply_content' => $ibforums->admin->make_safe($HTTP_POST_VARS['topic_reply_content']),
'topic_reply_postcount' => $ibforums->input['topic_reply_postcount'],
'mm_forums' => $forums,
'topic_approve' => $ibforums->input['topic_approve'],
);
if ( $type == 'edit' )
{
$mm_id = $ibforums->input['id'];
$DB->do_update( 'topic_mmod', $save, 'mm_id='.$mm_id );
}
else
{
$DB->do_insert( 'topic_mmod', $save );
$mm_id = $DB->get_insert_id();
}
$ibforums->admin->save_log("Update topic multi-moderation entries ($type)");
$this->rebuild_cache();
$std->boink_it($ibforums->base_url."&act=multimod");
}
//-----------------------------------------
// SHOW MM FORM
//-----------------------------------------
function do_form($type='new')
{
global $ibforums, $DB, $std, $forums;
$ibforums->admin->page_detail = "Multi moderation allows you to combine moderation actions to create easy to use shortcuts to several moderation options.";
$ibforums->admin->page_title = "Topic Multi-Moderation";
$form_code = 'donew';
$description = 'Add a new topic multi-moderation';
$button = "Add New Multi-Moderation";
if ( $type == 'edit' )
{
$id = intval($ibforums->input['id']);
$DB->simple_construct( array( 'select' => '*', 'from' => 'topic_mmod', 'where' => "mm_id=$id" ) );
$DB->simple_exec();
if ( ! $topic_mm = $DB->fetch_row() )
{
$ibforums->admin->error("Could not retrieve the information ($id)");
}
$form_code = 'doedit';
$description = 'Edit the topic multi-moderation';
$button = "Edit Multi-Moderation";
}
//-----------------------------------------
$ibforums->html .= $ibforums->adskin->start_form( array( 1 => array( 'code' , $form_code ),
2 => array( 'act' , 'multimod' ),
3 => array( 'id' , $id ),
) );
//-----------------------------------------
$state_dd = array(
0 => array( 'leave', 'Leave' ),
1 => array( 'close', 'Close' ),
2 => array( 'open' , 'Open' ),
);
$pin_dd = array(
0 => array( 'leave', 'Leave' ),
1 => array( 'pin' , 'Pin' ),
2 => array( 'unpin', 'Unpin' ),
);
$app_dd = array(
0 => array( '0', 'Leave' ),
1 => array( '1', 'Approve (Set Visible)' ),
2 => array( '2', 'Unapprove (Set Invisibe)' ),
);
//-----------------------------------------
$forum_html = "<select name='forums[]' class='textinput' size='15' multiple='multiple'>\n";
$forum_html .= $topic_mm['mm_forums'] == '*'
? "<option value='all' selected='selected'>-- ALL FORUMS --</option>\n"
: "<option value='all'>-- ALL FORUMS --</option>\n";
$forum_jump = $this->forumfunc->ad_forums_forum_data();
foreach ( $forum_jump as $idx => $i )
{
if ( strstr( ",".$topic_mm['mm_forums'].",", ",".$i['id']."," ) and $topic_mm['mm_forums'] != '*' )
{
$selected = ' selected="selected"';
}
else
{
$selected = "";
}
if ( $i['redirect_on'] == 1 )
{
continue;
}
$fporum_jump[] = array( $i['id'], $i['depthed_name'] );
$forum_html .= "<option value=\"{$i['id']}\" $selected>{$i['depthed_name']}</option>\n";
}
$forum_html .= "</select>";
//-----------------------------------------
$ibforums->adskin->td_header[] = array( "&nbsp;" , "40%" );
$ibforums->adskin->td_header[] = array( "&nbsp;" , "60%" );
$ibforums->html .= $ibforums->adskin->start_table( "Topic Multi-Moderation", $description );
$ibforums->html .= $ibforums->adskin->add_td_row( array( "<b>Title for this Multi-Moderation Suite?</b>" ,
$ibforums->adskin->form_input("mm_title", $topic_mm['mm_title'] )
) );
$ibforums->html .= $ibforums->adskin->add_td_row( array( "<b>Active in Forums...</b><br>You may choose more than one" ,
$forum_html
) );
$ibforums->html .= $ibforums->adskin->add_td_basic( 'Moderation Options', 'left', 'pformstrip' );
$ibforums->html .= $ibforums->adskin->add_td_row( array( "<b>Add to <i>START</i> of topic title?</b>" ,
$ibforums->adskin->form_input("topic_title_st", $topic_mm['topic_title_st'] )
) );
$ibforums->html .= $ibforums->adskin->add_td_row( array( "<b>Add to <i>END</i> of topic title?</b>" ,
$ibforums->adskin->form_input("topic_title_end", $topic_mm['topic_title_end'] )
) );
$ibforums->html .= $ibforums->adskin->add_td_row( array( "<b>Alter topic state?</b>" ,
$ibforums->adskin->form_dropdown("topic_state", $state_dd, $topic_mm['topic_state'] )
) );
$ibforums->html .= $ibforums->adskin->add_td_row( array( "<b>Alter pinned state?</b>" ,
$ibforums->adskin->form_dropdown("topic_pin", $pin_dd, $topic_mm['topic_pin'] )
) );
$ibforums->html .= $ibforums->adskin->add_td_row( array( "<b>Alter approved state?</b>" ,
$ibforums->adskin->form_dropdown("topic_approve", $app_dd, $topic_mm['topic_approve'] )
) );
$ibforums->html .= $ibforums->adskin->add_td_row( array( "<b>Move topic?</b>" ,
$ibforums->adskin->form_dropdown("topic_move", array_merge( array( 0 => array('-1', 'Don\'t Move' ) ), $fporum_jump ), $topic_mm['topic_move'] )
."<br />".$ibforums->adskin->form_checkbox('topic_move_link', $topic_mm['topic_move_link'] )."<strong>Leave a link to the source topic?</strong>"
) );
$ibforums->html .= $ibforums->adskin->add_td_basic( 'Post Options', 'left', 'pformstrip' );
$ibforums->html .= $ibforums->adskin->add_td_row( array( "<b>Add a reply to the topic?</b><br>HTML enabled" ,
"Enable this reply? &nbsp;".$ibforums->adskin->form_yes_no('topic_reply', $topic_mm['topic_reply'] )
."<br />"
. $ibforums->adskin->form_textarea("topic_reply_content", $topic_mm['topic_reply_content'] )
."<br />".$ibforums->adskin->form_checkbox('topic_reply_postcount', $topic_mm['topic_reply_postcount'] )."<strong>Increment poster's post count?</strong>"
) );
$ibforums->html .= $ibforums->adskin->end_form($button);
$ibforums->html .= $ibforums->adskin->end_table();
$ibforums->admin->output();
}
//-----------------------------------------
// SHOW ALL AVAILABLE MM's
//-----------------------------------------
function list_current()
{
global $ibforums, $DB, $std;
$ibforums->admin->page_detail = "Multi moderation allows you to combine moderation actions to create easy to use shortcuts to several moderation options.";
$ibforums->admin->page_title = "Topic Multi-Moderation";
$ibforums->adskin->td_header[] = array( "Title" , "50%" );
$ibforums->adskin->td_header[] = array( "Edit" , "25%" );
$ibforums->adskin->td_header[] = array( "Remove" , "25%" );
$ibforums->html .= $ibforums->adskin->start_table( "Current Topic Multi-Moderation" );
$DB->simple_construct( array( 'select' => '*', 'from' => 'topic_mmod', 'order' => "mm_title" ) );
$DB->simple_exec();
if ( $DB->get_num_rows() )
{
while ( $row = $DB->fetch_row() )
{
$ibforums->html .= $ibforums->adskin->add_td_row( array(
"<strong>{$row['mm_title']}</strong>",
"<center><a href='{$ibforums->base_url}&amp;act=multimod&amp;code=edit&amp;id={$row['mm_id']}'>Edit</a></center>",
"<center><a href='{$ibforums->base_url}&amp;act=multimod&amp;code=delete&amp;id={$row['mm_id']}'>Remove</a></center>",
) );
}
}
else
{
$ibforums->html .= $ibforums->adskin->add_td_basic("<center>None set up</center>");
}
$ibforums->html .= $ibforums->adskin->add_td_basic("<a href='{$ibforums->base_url}&amp;act=multimod&amp;code=new' class='fauxbutton'>Add New</a>", 'center', 'pformstrip');
$ibforums->html .= $ibforums->adskin->end_table();
$ibforums->admin->output();
}
//-----------------------------------------
// Get the active in forums
//-----------------------------------------
function get_activein_forums()
{
global $ibforums, $DB, $std, $forums, $HTTP_POST_VARS;
$forumids = array();
//-----------------------------------------
// Check for an array
//-----------------------------------------
if ( is_array( $HTTP_POST_VARS['forums'] ) )
{
if ( in_array( 'all', $HTTP_POST_VARS['forums'] ) )
{
//-----------------------------------------
// Searching all forums..
//-----------------------------------------
return '*';
}
else
{
//-----------------------------------------
// Go loopy loo
//-----------------------------------------
foreach( $HTTP_POST_VARS['forums'] as $l )
{
if ( $forums->forum_by_id[ $l ] )
{
$forumids[] = intval($l);
}
}
//-----------------------------------------
// Do we have cats? Give 'em to Charles!
//-----------------------------------------
if ( count( $forumids ) )
{
foreach( $forumids as $f )
{
$children = $forums->forums_get_children( $f );
if ( is_array($children) and count($children) )
{
$forumids = array_merge( $forumids , $children );
}
}
}
else
{
//-----------------------------------------
// No forums selected / we have available
//-----------------------------------------
return;
}
}
}
else
{
//-----------------------------------------
// Not an array...
//-----------------------------------------
if ( $ibforums->input['forums'] == 'all' )
{
return '*';
}
else
{
if ( $ibforums->input['forums'] != "" )
{
$l = intval($ibforums->input['forums']);
//-----------------------------------------
// Single forum
//-----------------------------------------
if ( $forums->forum_by_id[ $l ] )
{
$forumids[] = intval($l);
}
if ( $ibforums->input['searchsubs'] == 1 )
{
$children = $forums->forums_get_children( $f );
if ( is_array($children) and count($children) )
{
$forumids = array_merge( $forumids , $children );
}
}
}
}
}
return implode( ",", $forumids );
}
}
?>
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
+997
View File
@@ -0,0 +1,997 @@
<?php
/*
+--------------------------------------------------------------------------
| Invision Power Board v2.0.0
| =============================================
| by Matthew Mecham
| (c) 2001 - 2004 Invision Power Services, Inc.
| http://www.invisionpower.com
| =============================================
| Web: http://www.invisionboard.com
| Time: Tue, 21 Sep 2004 16:34:28 GMT
| Release: 150aa7a702c3c8b6f6eb90ad49305d2f
| Licence Info: http://www.invisionboard.com/?license
+---------------------------------------------------------------------------
|
| > POST OFFICE Stuff
| > Module written by Matt Mecham
| > Date started: 1st April 2004 (April Fools!)
|
| > Module Version Number: 1.0.0
| > DBA Checked: Tue 25th May 2004
+--------------------------------------------------------------------------
*/
if ( ! defined( 'IN_ACP' ) )
{
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded 'admin.php'.";
exit();
}
class ad_postoffice
{
var $base_url;
var $colours = array();
var $root_path = './';
function auto_run()
{
global $ibforums, $DB, $std;
$ibforums->admin->nav[] = array( 'act=postoffice', 'IPB Post Office' );
$ibforums->admin->page_detail = "You may manage previous bulk emails and create new bulk emails in this section.";
$ibforums->admin->page_title = "IPB Post Office";
//-----------------------------------------
// Kill globals - globals bad, Homer good.
//-----------------------------------------
$tmp_in = array_merge( $_GET, $_POST, $_COOKIE );
foreach ( $tmp_in as $k => $v )
{
unset($$k);
}
switch($ibforums->input['code'])
{
case 'mail_new':
$this->mail_form('add');
break;
case 'mail_edit':
$this->mail_form('edit');
break;
case 'mail_save':
$this->mail_save();
break;
case 'mail_preview':
$this->mail_preview_start();
break;
case 'mail_preview_do':
$this->mail_preview_complete();
break;
case 'mail_send_start':
$this->mail_send_start();
break;
case 'mail_send_complete':
$this->mail_send_complete();
break;
case 'mail_send_cancel':
$this->mail_send_cancel();
break;
case 'mail_delete':
$this->mail_delete();
break;
//-----------------------------------------
// Default
//-----------------------------------------
default:
$this->mail_start();
break;
}
}
//-----------------------------------------
// DELETE MAIL - WOT IS SAYZ ON TEH TIN
//-----------------------------------------
function mail_delete()
{
global $ibforums, $DB, $std;
$id = intval( $ibforums->input['id'] );
$DB->do_update( 'bulk_mail', array( 'mail_active' => 0,
'mail_updated' => time(),
), "mail_active=1" );
$DB->do_update( 'task_manager', array( 'task_enabled' => 0 ), "task_key='bulkmail'" );
$DB->simple_exec_query( array( 'delete' => 'bulk_mail', 'where' => 'mail_id='.$id ) );
$ibforums->main_msg = "Bulk email deleted";
$this->mail_start();
}
//-----------------------------------------
// SEND MAIL: Cancel sending in progress
//-----------------------------------------
function mail_send_cancel()
{
global $ibforums, $DB, $std;
$DB->do_update( 'bulk_mail', array( 'mail_active' => 0,
'mail_updated' => time(),
), "mail_active=1" );
$DB->do_update( 'task_manager', array( 'task_enabled' => 0 ), "task_key='bulkmail'" );
$ibforums->main_msg = "Bulk email cancelled";
$this->mail_start();
}
//-----------------------------------------
// SEND MAIL: Send the mail mah-boy
//-----------------------------------------
function mail_send_process( $root_path="" )
{
global $ibforums, $DB, $std;
//-----------------------------------------
// Set up
//-----------------------------------------
if ( $root_path )
{
$this->root_path = $root_path;
}
else if ( ROOT_PATH )
{
$this->root_path = ROOT_PATH;
}
require_once( $this->root_path."sources/classes/class_email.php");
$this->email = new emailer( $this->root_path );
$done = 0;
$sent = 0;
//-----------------------------------------
// Get it from the db
//-----------------------------------------
$mail = $DB->simple_exec_query( array( 'select' => '*', 'from' => 'bulk_mail', 'where' => 'mail_active=1' ) );
if ( ! $mail['mail_subject'] and ! $mail['mail_content'] )
{
$done = 1;
}
//-----------------------------------------
// Per go...
//-----------------------------------------
$pergo = intval($mail['mail_pergo']);
if ( ! $pergo or $pergo > 1000 )
{
$pergo = 50;
}
//-----------------------------------------
// So far...
//-----------------------------------------
$sofar = intval($mail['mail_sentto']);
$mail['mail_content'] = $std->txt_stripslashes( $mail['mail_content'] );
$mail['mail_subject'] = $std->txt_stripslashes( $mail['mail_subject'] );
//-----------------------------------------
// Unconvert options
//-----------------------------------------
$opts = unserialize(stripslashes( $mail['mail_opts'] ) );
foreach( $opts as $k => $v )
{
$mail[ $k ] = $v;
}
//-----------------------------------------
// Format the query
//-----------------------------------------
$query = $this->_build_members_query( $mail );
//-----------------------------------------
// Get members....
//-----------------------------------------
$DB->simple_construct( array( 'select' => '*',
'from' => 'members',
'where' => $query,
'order' => 'id',
'limit' => array( $sofar, $pergo ) ) );
$o = $DB->simple_exec();
if ( $mail['mail_html_on'] )
{
$this->email->html_email = 1;
}
while ( $r = $DB->fetch_row( $o ) )
{
$sent++;
$contents = $this->_convert_quick_tags( $mail['mail_content'], $r );
$this->email->from = $ibforums->vars['email_in'];
$this->email->to = $r['email'];
$this->email->message = str_replace( "\r\n", "\n", $contents);
$this->email->subject = $mail['mail_subject'];
$this->email->send_mail();
}
//-----------------------------------------
// Did we send any?
//-----------------------------------------
if ( ! $sent )
{
$done = 1;
}
//-----------------------------------------
// Save out..
//-----------------------------------------
if ( $done )
{
$DB->do_update( 'bulk_mail', array( 'mail_active' => 0,
'mail_updated' => time(),
'mail_sentto' => $sofar + $sent ), 'mail_id='.$mail['mail_id'] );
$DB->do_update( 'task_manager', array( 'task_enabled' => 0 ), "task_key='bulkmail'" );
}
else
{
$DB->do_update( 'bulk_mail', array( 'mail_updated' => time(),
'mail_sentto' => $sofar + $sent ), 'mail_id='.$mail['mail_id'] );
}
}
//-----------------------------------------
// SEND MAIL: Complete
//-----------------------------------------
function mail_send_complete()
{
global $ibforums, $DB, $std;
$pergo = intval($ibforums->input['pergo']);
$id = intval($ibforums->input['id']);
if ( ! $id )
{
$ibforums->main_msg = "There was no ID passed to this function";
$this->mail_start();
}
//-----------------------------------------
// Get it from the db
//-----------------------------------------
$mail = $DB->simple_exec_query( array( 'select' => '*', 'from' => 'bulk_mail', 'where' => 'mail_id='.$id ) );
if ( ! $mail['mail_subject'] and ! $mail['mail_content'] )
{
$ibforums->main_msg = "Cannot send - the email doesn't have a subject and content";
$this->mail_start();
}
//-----------------------------------------
// Update mail
//-----------------------------------------
if ( ! $pergo or $pergo > 1000 )
{
$pergo = 50;
}
$DB->do_update( 'bulk_mail', array( 'mail_active' => 1, 'mail_pergo' => $pergo, 'mail_sentto' => 0, 'mail_start' => time() ), 'mail_id='.$id );
$DB->do_update( 'bulk_mail', array( 'mail_active' => 0 ) , 'mail_id != '.$id );
//-----------------------------------------
// Wake up task manager
//-----------------------------------------
require_once( ROOT_PATH.'sources/lib/task_functions.php' );
$task = new task_functions();
$DB->do_update( 'task_manager', array( 'task_enabled' => 1 ), "task_key='bulkmail'" );
$this_task = $DB->simple_exec_query( array( 'select' => '*', 'from' => 'task_manager', 'where' => "task_key='bulkmail'" ) );
$newdate = $task->generate_next_run($this_task);
$DB->do_update( 'task_manager', array( 'task_next_run' => $newdate ), "task_id=".$this_task['task_id'] );
$task->save_next_run_stamp();
//-----------------------------------------
// Sit back and watch the show
//-----------------------------------------
$ibforums->main_msg = "Bulk Mail Initiated";
$this->mail_start();
}
//-----------------------------------------
// SEND MAIL: Start
//-----------------------------------------
function mail_send_start()
{
global $ibforums, $DB, $std;
$id = intval($ibforums->input['id']);
if ( ! $id )
{
$ibforums->main_msg = "There was no ID passed to this function";
$this->mail_start();
}
//-----------------------------------------
// Get it from the db
//-----------------------------------------
$mail = $DB->simple_exec_query( array( 'select' => '*', 'from' => 'bulk_mail', 'where' => 'mail_id='.$id ) );
if ( ! $mail['mail_subject'] and ! $mail['mail_content'] )
{
$ibforums->main_msg = "Cannot send - the email doesn't have a subject and content";
$this->mail_start();
}
//-----------------------------------------
// Unconvert options
//-----------------------------------------
$opts = unserialize(stripslashes( $mail['mail_opts'] ) );
foreach( $opts as $k => $v )
{
$mail[ $k ] = $v;
}
//-----------------------------------------
// Format the query
//-----------------------------------------
$query = $this->_build_members_query( $mail );
//-----------------------------------------
// Count how many matches
//-----------------------------------------
$count = $DB->simple_exec_query( array( 'select' => 'count(*) as cnt', 'from' => 'members', 'where' => $query ) );
$the_count = intval( $count['cnt'] );
//-----------------------------------------
// Print 'continue' screen
//-----------------------------------------
$ibforums->html .= $ibforums->adskin->start_form( array( 1 => array( 'code' , 'mail_send_complete' ),
2 => array( 'act' , 'postoffice' ),
4 => array( 'id' , $ibforums->input['id'] ),
) );
$ibforums->html .= "<div class='tableborder'><div class='maintitle'>Sending the bulk mail to {$the_count} members</div>";
$ibforums->html .= "<div class='tdrow2' style='padding:4px'>
<fieldset>
<legend><strong>Email Details</strong></legend>
<strong>Subject: {$mail['mail_subject']}</strong>
<br />
<br />
<div style='height:200px;overflow:auto;white-space:pre'>{$mail['mail_content']}</div>
<br />
<div align='center'><span class='fauxbutton'><a href='{$ibforums->base_url}&act=postoffice&code=mail_edit&id={$id}'>Edit This Email</a></span></div>
<br />
Sending to <b>{$the_count}</b> &nbsp;members.
</fieldset>
<br />
<fieldset>
<legend><strong>Sending the Email</strong></legend>
Clicking the 'Start Sending The Emails' button below will activate the task manager's send bulk email function which will send the email in batches until the all the mail
has been sent. You can watch the progress from the main Post Office screen and cancel the email from being sent.
<br />
We strongly recommend that you opt to send 50 emails per cycle as a maximum. Any more per cycle could severly affect performance of your server while the mail is being sent out.
<br />
<br />
As the mail is sent out in cycles of <em><b>n</b></em> &nbsp;per minute, it can take a while to process all the mail.
<br />
<br />
<div align='center'><b>Emails sent per cycle</b> <input type='text' class='realbutton' size='5' name='pergo' value='50' /> &nbsp; <input type='submit' value='Start Sending The Emails' class='realbutton' /></form></div>
</fieldset>
</div>
</div>";
$ibforums->admin->output();
}
//-----------------------------------------
// PREVIEW MAIL: Show it - yo!
//-----------------------------------------
function mail_preview_complete()
{
global $ibforums, $DB, $std;
$content = nl2br($this->_convert_quick_tags( $std->txt_stripslashes($_POST['text']), $ibforums->member ));
print "<html>
<body>
<div style='padding:6px;text-align:left;font-family:courier, monospace;font-size:12px'>
{$content}
</body></html>
";
exit();
}
//-----------------------------------------
// PREVIEW MAIL: JS BOUNCE
//-----------------------------------------
function mail_preview_start()
{
global $ibforums, $DB, $std;
print "<html><body onload='doitdude()'><script type='text/javascript'>
posty = opener.thisval;
function doitdude()
{
document.peekaboo.method = 'post';
document.peekaboo.action = '{$ibforums->base_url}&act=postoffice&code=mail_preview_do';
document.peekaboo.text.value = posty;
document.peekaboo.submit();
}
</script>
<form name='peekaboo' >
<input type='hidden' name='text' />
</form>
</body></html>
";
}
//-----------------------------------------
// SAVE MAIL
//-----------------------------------------
function mail_save()
{
global $ibforums, $DB, $std;
//-----------------------------------------
// Set up
//-----------------------------------------
$ids = array();
$ibforums->input['id'] = intval($ibforums->input['id']);
//-----------------------------------------
// Start
//-----------------------------------------
$type = $ibforums->input['type'];
if ( ! $ibforums->input['mail_subject'] or ! $ibforums->input['mail_content'] )
{
$ibforums->main_msg = "You must enter an email subject and email content before submitting.";
$this->mail_form( $type );
}
//-----------------------------------------
// Groups...
//-----------------------------------------
foreach ($ibforums->input as $key => $value)
{
if ( preg_match( "/^sg_(\d+)$/", $key, $match ) )
{
if ($ibforums->input[ $match[0] ])
{
$ids[] = $match[1];
}
}
}
if ( ! count( $ids ) )
{
$ibforums->main_msg = "You must select at least one group to send this email message to.";
$this->mail_form( $type );
}
$ibforums->input['mail_groups'] = implode( ",", $ids );
//-----------------------------------------
// Format the query
//-----------------------------------------
$query = $this->_build_members_query( array( 'mail_post_ltmt' => $_POST['mail_post_ltmt'],
'mail_filter_post' => $_POST['mail_filter_post'],
'mail_visit_ltmt' => $_POST['mail_visit_ltmt'],
'mail_filter_visit' => $_POST['mail_filter_visit'],
'mail_joined_ltmt' => $_POST['mail_joined_ltmt'],
'mail_filter_joined' => $_POST['mail_filter_joined'],
'mail_honor' => $_POST['mail_honor'],
'group_id_string' => implode( ",", $ids )
) );
//-----------------------------------------
// Count how many matches
//-----------------------------------------
$count = $DB->simple_exec_query( array( 'select' => 'count(*) as cnt', 'from' => 'members', 'where' => $query ) );
if ( ! $count['cnt'] )
{
$ibforums->main_msg = "Your criteria didn't match any members - please adjust your current criteria";
$this->mail_form( $type );
}
//-----------------------------------------
// Save
//-----------------------------------------
$save_array = array(
'mail_subject' => str_replace( "&#039;", "'", $std->txt_stripslashes( $_POST['mail_subject'] ) ),
'mail_content' => $std->txt_stripslashes( $_POST['mail_content'] ),
'mail_groups' => implode( ",", $ids ),
'mail_honor' => $ibforums->input['mail_honor'],
'mail_start' => time(),
'mail_updated' => time(),
'mail_sentto' => 0,
'mail_opts' => serialize( array( 'mail_post_ltmt' => $_POST['mail_post_ltmt'],
'mail_filter_post' => $_POST['mail_filter_post'],
'mail_visit_ltmt' => $_POST['mail_visit_ltmt'],
'mail_filter_visit' => $_POST['mail_filter_visit'],
'mail_joined_ltmt' => $_POST['mail_joined_ltmt'],
'mail_filter_joined' => $_POST['mail_filter_joined'],
'mail_html_on' => $_POST['mail_html_on'],
) )
);
if ( $type == 'add' )
{
//-----------------------------------------
// Save to DB
//-----------------------------------------
$DB->do_insert( 'bulk_mail', $save_array );
$ibforums->input['id'] = $DB->get_insert_id();
$ibforums->admin->save_log("Bulk mail ({$ibforums->input['mail_subject']}) added");
$this->mail_send_start();
}
else
{
if ( ! $ibforums->input['id'] )
{
$ibforums->main_msg = "Cannot save, no ID returned";
$this->mail_form($type);
}
$DB->do_update( 'bulk_mail', $save_array, 'mail_id='.$ibforums->input['id'] );
$ibforums->admin->save_log("Bulk mail ({$ibforums->input['mail_subject']}) edited");
$ibforums->main_msg = "Bulk mail edited";
$this->mail_start();
}
}
//-----------------------------------------
// SHOW MAIN MAIL SCREENIE-POOS
//-----------------------------------------
function mail_form($type='add')
{
global $ibforums, $DB, $std;
$ibforums->input['id'] = intval($ibforums->input['id']);
$dd_ltmt = array(
0 => array( 'lt' , "less than" ),
1 => array( 'mt' , "more than" )
);
if ( $type == 'add' )
{
$mail = array();
$title = "Step 1: Start New Bulk Email";
$button = "Proceed...";
$honour_checked = 'checked="checked"';
$html_checked = '';
}
else
{
$mail = $DB->simple_exec_query( array( 'select' => '*', 'from' => 'bulk_mail', 'where' => 'mail_id='.$ibforums->input['id'] ) );
$title = "Editing Stored Mail";
$button = "Edit Mail";
//-----------------------------------------
// Unpack more..
//-----------------------------------------
$tmp = unserialize( stripslashes( $mail['mail_opts'] ) );
if ( is_array( $tmp ) and count ( $tmp ) )
{
foreach( $tmp as $k => $v )
{
if ( ! $mail[ $k ] )
{
$mail[ $k ] = $v;
}
}
}
$honour_checked = $mail['mail_honor'] == 1 ? 'checked="checked"' : '';
$html_checked = $mail['mail_html_on'] == 1 ? 'checked="checked"' : '';
}
$ibforums->html .= $ibforums->adskin->start_form( array( 1 => array( 'code' , 'mail_save' ),
2 => array( 'act' , 'postoffice' ),
3 => array( 'type' , $type ),
4 => array( 'id' , $ibforums->input['id'] ),
) );
$mail_subject = $_POST['mail_subject'] ? $std->txt_stripslashes($_POST['mail_subject']) : $mail['mail_subject'];
$mail_content = $_POST['mail_content'] ? $std->txt_stripslashes($_POST['mail_content']) : $mail['mail_content'];
$mail_subject = str_replace( "'", "&#039;", $mail_subject );
$mail_content = preg_replace( "[^\r]\n", "\r\n", $mail_content );
if ( ! $mail_content and $type == 'add' )
{
$mail_content = $this->_get_default_mail_contents();
}
if ( $ibforums->input['mail_groups'] )
{
$mail['mail_groups'] = $ibforums->input['mail_groups'];
}
$ibforums->html .= "<script type='text/javascript'>
function runpreview()
{
thisval = document.theAdminForm.mail_content.value
myWin = window.open('{$ibforums->base_url}&act=postoffice&code=mail_preview','newWin','width=500,height=500,resizable=yes,scrollbars=yes');
}
</script>
";
$ibforums->html .= "<div class='tableborder'><div class='maintitle'>{$title}</div>";
$ibforums->html .= "<div class='tdrow2' style='padding:4px'>
<fieldset>
<legend><strong>Email Subject</strong></legend>
<input type='text' size='60' maxsize='250' class='textinput' style='width:100%' name='mail_subject' value='{$mail_subject}' />
</fieldset>
<br />
<fieldset>
<legend><strong>Email Content</strong></legend>
<textarea cols='60' rows='20' class='textinput' style='width:100%' name='mail_content'>{$mail_content}</textarea>
<br />
<fieldset>
<legend><strong>Mail Sending Options</strong></legend>
<input type='checkbox' name='mail_honor' value='1' {$honour_checked} />&nbsp; Honor 'Allow admin to email me' member setting to only email those who have opted in?
<br/ >
<input type='checkbox' name='mail_html_on' value='1' {$html_checked} />&nbsp; Send email in HTML format (full HTML formatting & tags allowed)
</fieldset>
</fieldset>";
$ibforums->html .= "</div></div><br />";
$ibforums->html .= "<div class='tableborder'><div class='maintitle'>Filters</div>";
$ibforums->html .= "<div class='tdrow2' style='padding:4px'>
<table width='100%' cellpadding='2' cellspacing='0' border='0'>
<tr>
<td width='30%'>
<fieldset>
<legend><strong>Send to Groups:</strong></legend>";
foreach( $ibforums->cache['group_cache'] as $bleh => $g )
{
if ( $g['g_id'] == $ibforums->vars['guest_group'] )
{
continue;
}
$checked = "";
if ( $mail['mail_groups'] )
{
if ( strstr( ','.$mail['mail_groups'].',', ','.$g['g_id'].',' ) )
{
$checked = 'checked="checked"';
}
}
$ibforums->html .= "<input type='checkbox' name='sg_{$g['g_id']}' value='1' $checked />&nbsp;&nbsp;<b>{$g['g_title']}</b><br />";
}
$ibforums->html .= " </fieldset>
</td>
<td width='70%' valign='top'>
<fieldset>
<legend><strong>Additional Filters</strong></legend>
<table width='100%' cellpadding='4' cellspacing='0' border='0'>
<tr>
<td width='60%'>Send to members with <em><b>n</b></em> posts<div class='graytext'>Leave blank to not filter</div></td>
<td width='40%'>". $ibforums->adskin->form_dropdown('mail_post_ltmt', $dd_ltmt, $_POST['mail_post_ltml'] ? $_POST['mail_post_ltml'] : $mail['mail_post_ltmt'] ).' '.
$ibforums->adskin->form_simple_input( "mail_filter_post", $_POST['mail_filter_post'] ? $_POST['mail_filter_post'] : $mail['mail_filter_post'], 7 )."</td>
</tr>
<tr>
<td width='60%'>Send to members who's last visit was <em><b>n</b></em> days ago<div class='graytext'>Leave blank to not filter</div></td>
<td width='40%'>". $ibforums->adskin->form_dropdown('mail_visit_ltmt', $dd_ltmt, $_POST['mail_visit_ltml'] ? $_POST['mail_visit_ltml'] : $mail['mail_visit_ltmt'] ).' '.
$ibforums->adskin->form_simple_input( "mail_filter_visit", $_POST['mail_filter_visit'] ? $_POST['mail_filter_visit'] : $mail['mail_filter_visit'], 7 )."</td>
</tr>
<tr>
<td width='60%'>Send to members who joined <em><b>n</b></em> days ago<div class='graytext'>Leave blank to not filter</div></td>
<td width='40%'>". $ibforums->adskin->form_dropdown('mail_joined_ltmt', $dd_ltmt, $_POST['mail_joined_ltml'] ? $_POST['mail_joined_ltml'] : $mail['mail_joined_ltmt'] ).' '.
$ibforums->adskin->form_simple_input( "mail_filter_joined", $_POST['mail_filter_joined'] ? $_POST['mail_filter_joined'] : $mail['mail_filter_joined'], 7 )."</td>
</tr>
</table>
</fieldset>
</td>
</tr>
</table>
</div>
<div align='center' class='pformstrip'><input class='realbutton' onclick='runpreview()' type='button' value='Preview' /> &nbsp; &nbsp; <input class='realdarkbutton' type='submit' value='$button' /></form></div>
</div>";
$ibforums->html .= "<br />
<div class='tableborder'>
<div class='pformstrip'>Quick Tags</div>
<div class='tdrow1' style='padding:4px'>You may use the following 'quick tags' in your email and they will be converted when the email is sent.</div>
<table cellpadding='2' class='tdrow1' width='100%' cellspacing='0' border='0'>
<tr>
<td><strong>{board_name}</strong></td>
<td><em>The name of your board</em></td>
<td><strong>{board_url}</strong></td>
<td><em>The URL to your board</em></td>
</tr>
<tr>
<td><strong>{reg_total}</strong></td>
<td><em>The total number of registered members</em></td>
<td><strong>{total_posts}</strong></td>
<td><em>The total number of posts</em></td>
</tr>
<tr>
<td><strong>{busy_count}</strong></td>
<td><em>The most number of users online</em></td>
<td><strong>{busy_time}</strong></td>
<td><em>The time that the most number of members were online</em></td>
</tr>
<tr>
<td><strong>{member_id}</strong></td>
<td><em>The member ID of the email recipient</em></td>
<td><strong>{member_name}</strong></td>
<td><em>The member name of the email recipient</em></td>
</tr>
<tr>
<td><strong>{member_joined}</strong></td>
<td><em>The member join date of the email recipient</em></td>
<td><strong>{member_posts}</strong></td>
<td><em>The number of posts for the email recipient</em></td>
</tr>
</table>
</div>";
$ibforums->admin->output();
}
//-----------------------------------------
// SHOW MAIN MAIL SCREENIE-POOS
//-----------------------------------------
function mail_start()
{
global $ibforums, $DB, $std;
$ibforums->adskin->td_header[] = array( "&nbsp;" , "1%" );
$ibforums->adskin->td_header[] = array( "Subject" , "30%" );
$ibforums->adskin->td_header[] = array( "Sent On" , "15%" );
$ibforums->adskin->td_header[] = array( "Sent To" , "15%" );
$ibforums->adskin->td_header[] = array( "Time Taken" , "15%" );
$ibforums->adskin->td_header[] = array( "Options" , "25%" );
$ibforums->html .= $ibforums->adskin->start_table( "Your stored bulk email" );
//-----------------------------------------
// Get mail from DB
//-----------------------------------------
$DB->simple_construct( array( 'select' => '*', 'from' => 'bulk_mail', 'order' => 'mail_start DESC' ) );
$DB->simple_exec();
while( $r = $DB->fetch_row() )
{
$inprogress = "";
if ( $r['mail_updated'] == $r['mail_start'] )
{
$time_taken = 'Not yet sent';
}
else
{
$time_taken = intval($r['mail_updated'] - $r['mail_start']);
if ( $time_taken < 0 )
{
$time_taken = 0;
}
if ( $time_taken )
{
$time_taken = ceil( $time_taken / 60 );
}
$time_taken .= ' minutes';
}
if ( $r['mail_active'] )
{
$inprogress = " <em>( Sending in progress - <a href='#' onclick=\"maincheckdelete('{$ibforums->base_url}&act=postoffice&code=mail_send_cancel', 'OK to cancel bulk mail?'); return false;\">Cancel</a> )</em>";
}
$ibforums->html .= $ibforums->adskin->add_td_row( array(
"<img src='{$ibforums->adskin->img_url}/skin_icon_email.gif' border='0' />",
"<b>{$r['mail_subject']}</b> $inprogress",
$std->get_date( $r['mail_start'], 'SHORT' ),
$std->do_number_format( $r['mail_sentto'] ).' members',
$time_taken,
"<div align='center'><span class='fauxbutton'><a href='{$ibforums->base_url}&act=postoffice&code=mail_send_start&id={$r['mail_id']}'>Re-send</a></span>
<span class='fauxbutton'><a href='{$ibforums->base_url}&act=postoffice&code=mail_edit&id={$r['mail_id']}'>Edit</a></span>
<span class='fauxbutton'><a href='#' onclick=\"maincheckdelete('{$ibforums->base_url}&act=postoffice&code=mail_delete&id={$r['mail_id']}');return false;\">Delete</a></span>
</center>"
) );
}
$ibforums->html .= $ibforums->adskin->end_table();
$ibforums->admin->output();
}
//-----------------------------------------
// INTERNAL: build members query
//-----------------------------------------
function _build_members_query( $args = array() )
{
global $ibforums, $DB, $std;
$DB->load_cache_file( $this->root_path.'sources/sql/'.SQL_DRIVER.'_extra_queries.php', 'sql_extra_queries' );
$query = array();
if ( $args['mail_filter_post'] )
{
$ltmt = $args['mail_post_ltmt'] == 'lt' ? '<' : '>';
$query[] = "posts ".$ltmt." ".$args['mail_filter_post'];
}
if ( $args['mail_filter_visit'] )
{
$ltmt = $args['mail_visit_ltmt'] == 'lt' ? '<' : '>';
$time = time() - ( $args['mail_filter_visit'] * 86400 );
$query[] = "last_visit ".$ltmt." ". $time;
}
if ( $args['mail_filter_visit'] )
{
$ltmt = $args['mail_joined_ltmt'] == 'lt' ? '<' : '>';
$time = time() - ( $args['mail_filter_joined'] * 86400 );
$query[] = "joined ".$ltmt." ". $time;
}
if ( $args['mail_honor'] )
{
$query[] = "allow_admin_mails=1";
}
if ( $args['mail_groups'] )
{
$tmp_q = 'mgroup IN ('. $args['mail_groups'] .')';
$temp = explode( ',', $args['mail_groups'] );
if ( is_array( $temp ) and count( $temp ) )
{
$tmp = array();
foreach( $temp as $id )
{
$DB->cache_add_query( 'acp_postoffice_concat_bit', array( 'gid' => $id ), 'sql_extra_queries' );
$tmp[] = $DB->cur_query;
$DB->cur_query = "";
}
$tmp_q .= " OR ( ".implode( ' OR ', $tmp ). " )";
}
$query[] = $tmp_q;
}
return implode( ' AND ', $query );
}
//-----------------------------------------
// INTERNAL: convert quick tags
//-----------------------------------------
function _convert_quick_tags( $contents="", $member=array() )
{
global $ibforums, $DB, $std;
$contents = str_replace( "{board_name}" , str_replace( "&#39;", "'", $ibforums->vars['board_name'] ) , $contents );
$contents = str_replace( "{board_url}" , $ibforums->vars['board_url']."/index.".$ibforums->vars['php_ext'] , $contents );
$contents = str_replace( "{reg_total}" , $ibforums->cache['stats']['mem_count'] , $contents );
$contents = str_replace( "{total_posts}" , $ibforums->cache['stats']['total_topics'] + $ibforums->cache['stats']['total_replies'] , $contents );
$contents = str_replace( "{busy_count}" , $ibforums->cache['stats']['most_count'] , $contents );
$contents = str_replace( "{busy_time}" , $std->get_date( $ibforums->cache['stats']['most_date'], 'SHORT' ), $contents );
$contents = str_replace( "{member_id}" , $member['id'], $contents );
$contents = str_replace( "{member_name}" , $member['name'], $contents );
$contents = str_replace( "{member_joined}", date( 'j-F y', $member['joined'] ), $contents );
$contents = str_replace( "{member_posts}" , $member['posts'], $contents );
return $contents;
}
//-----------------------------------------
// INTERNAL: get default mail
//-----------------------------------------
function _get_default_mail_contents()
{
global $ibforums, $DB, $std;
$mail = "{member_name},\n\n\n\n-------------------------------------\n{board_name} Statistics:\n"
."-------------------------------------\nRegistered Users: {reg_total}\nTotal Posts: {total_posts}\n"
."Busiest Time: {busy_count} users were online on {busy_time}\n\n"
."-------------------------------------\nHandy Links\n"
."-------------------------------------\nBoard Address: {board_url}\nLog In: {board_url}?act=Login&CODE=00\n"
."Lost Password Recovery: {board_url}?act=Reg&CODE=10\n\n"
."-------------------------------------\nHow to unsubscribe\n"
."-------------------------------------\nVisit your email preferences ({board_url}?act=UserCP&CODE=02) and ensure "
."that the box for 'Send me any updates sent by the board administrator' is unchecked and submit the form";
return $mail;
}
}
?>
+207
View File
@@ -0,0 +1,207 @@
<?php
/*
+--------------------------------------------------------------------------
| Invision Power Board v2.0.0
| =============================================
| by Matthew Mecham
| (c) 2001 - 2004 Invision Power Services, Inc.
| http://www.invisionpower.com
| =============================================
| Web: http://www.invisionboard.com
| Time: Tue, 21 Sep 2004 16:34:28 GMT
| Release: 150aa7a702c3c8b6f6eb90ad49305d2f
| Licence Info: http://www.invisionboard.com/?license
+---------------------------------------------------------------------------
|
| > ACP Prefs functions
| > Module written by Matt Mecham
| > Date started: 22nd May 2003
|
| > Module Version Number: 1.0.0
+--------------------------------------------------------------------------
*/
if ( ! defined( 'IN_ACP' ) )
{
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded 'admin.php'.";
exit();
}
class ad_prefs {
var $base_url;
function auto_run()
{
global $ibforums, $DB, $std;
//-----------------------------------------
// Kill globals - globals bad, Homer good.
//-----------------------------------------
$tmp_in = array_merge( $_GET, $_POST, $_COOKIE );
foreach ( $tmp_in as $k => $v )
{
unset($$k);
}
//-----------------------------------------
// Show the wee form
//-----------------------------------------
if ( $ibforums->input['set'] == 1 )
{
$this->msg = 'Savings set';
if ( $ibforums->input['tx'] == "" or $ibforums->input['ty'] == "" )
{
$this->msg = 'Please complete the form';
print $this->get_html();
}
else
{
$std->my_setcookie( 'acpprefs', $ibforums->input['menu'] .','. $ibforums->input['tx'] .','. $ibforums->input['ty'] .','. $ibforums->input['preview']);
$this->msg = 'Settings saved';
$this->tx = $ibforums->input['tx'];
$this->ty = $ibforums->input['ty'];
if ( $ibforums->input['menu'] )
{
$this->s_yes = 'selected';
$this->s_no = '';
}
else
{
$this->s_yes = '';
$this->s_no = 'selected';
}
if ( $ibforums->input['preview'] )
{
$this->p_yes = 'selected';
$this->p_no = '';
}
else
{
$this->p_yes = '';
$this->p_no = 'selected';
}
print $this->get_html();
}
}
else
{
$state = 0;
$tx = 80;
$ty = 40;
if ( $cookie = $std->my_getcookie('acpprefs') )
{
list( $state, $tx, $ty, $prev_show ) = explode( ",", $cookie );
}
$this->tx = $tx;
$this->ty = $ty;
if ( $state )
{
$this->s_yes = 'selected';
$this->s_no = '';
}
else
{
$this->s_yes = '';
$this->s_no = 'selected';
}
if ( $prev_show )
{
$this->p_yes = 'selected';
$this->p_no = '';
}
else
{
$this->p_yes = '';
$this->p_no = 'selected';
}
print $this->get_html();
}
}
function get_html()
{
global $SKIN;
$hit_muhl = <<<EOF
<html>
<head>
<title>IPB-ACP Prefs</title>
<style type='text/css'>
BODY {
font-size: 10px;
font-family: Verdana, Arial, Sans-Serif;
color:#000;
padding:0px;
margin:5px 5px 5px 5px;
background-color: #F5F9FD
}
TABLE, TD, TR {
font-family: Verdana,Arial, Sans-Serif;
color:#000;
font-size: 10px;
}
a:link, a:visited, a:active { color:#000055 }
a:hover { color:#333377;text-decoration:underline }
input {vertical-align:middle}
.textinput { background-color: #DFE6EF;; color:Ê#000; font-size:10px; font-family: Verdana,Arial, Sans-Serif; padding:2px; }
</style>
<script type='text/javascript'>
var msg = "{$this->msg}";
if ( msg != "" )
{
alert( msg );
}
</script>
</head>
<body>
<form action="{$ibforums->adskin->base_url}&act=prefs&set=1" method="post">
<fieldset style='padding:10px'>
<legend>Your ACP Prefs</legend>
<strong>Save ACP Menu State</strong>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<select class='textinput' name='menu'><option value='1' {$this->s_yes}>Yes</option><option value='0' {$this->s_no}>No</option></select>
<br /><br />
<strong>Template's Textbox Size</strong>&nbsp;<input class='textinput' type='text' size='3' name='tx' value='{$this->tx}' /> <strong>X</strong> <input class='textinput' type='text' size='3' name='ty' value='{$this->ty}' />
<br /><br />
<strong>Show Macro Preview?</strong>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<select class='textinput' name='preview'><option value='1' {$this->p_yes}>Yes</option><option value='0' {$this->p_no}>No</option></select>
<br /><br />
<center><input type='submit' class='textinput' value='Save' /></center>
</fieldset>
</form>
</body>
</html>
EOF;
return $hit_muhl;
}
}
?>
+559
View File
@@ -0,0 +1,559 @@
<?php
/*
+--------------------------------------------------------------------------
| Invision Power Board v2.0.0
| =============================================
| by Matthew Mecham
| (c) 2001 - 2004 Invision Power Services, Inc.
| http://www.invisionpower.com
| =============================================
| Web: http://www.invisionboard.com
| Time: Tue, 21 Sep 2004 16:34:28 GMT
| Release: 150aa7a702c3c8b6f6eb90ad49305d2f
| Licence Info: http://www.invisionboard.com/?license
+---------------------------------------------------------------------------
|
| > Custom profile field functions
| > Module written by Matt Mecham
| > Date started: 24th June 2002
|
| > Module Version Number: 1.0.0
| > DBA Checked: Tue 25th May 2004
+--------------------------------------------------------------------------
*/
if ( ! defined( 'IN_ACP' ) )
{
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded 'admin.php'.";
exit();
}
class ad_profilefields {
var $base_url;
var $func;
function auto_run()
{
global $ibforums, $DB, $std;
//-----------------------------------------
// Kill globals - globals bad, Homer good.
//-----------------------------------------
$tmp_in = array_merge( $_GET, $_POST, $_COOKIE );
foreach ( $tmp_in as $k => $v )
{
unset($$k);
}
//-----------------------------------------
// get class
//-----------------------------------------
require_once( ROOT_PATH.'sources/classes/class_custom_fields.php' );
$this->func = new custom_fields( $DB );
//-----------------------------------------
// switch-a-magoo
//-----------------------------------------
switch($ibforums->input['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;
}
}
//-----------------------------------------
//
// Rebuild cache
//
//-----------------------------------------
function rebuild_cache()
{
global $ibforums, $DB, $std;
$ibforums->cache['profilefields'] = array();
$DB->simple_construct( array( 'select' => '*', 'from' => 'pfields_data', 'order' => 'pf_position' ) );
$DB->simple_exec();
while ( $r = $DB->fetch_row() )
{
$ibforums->cache['profilefields'][ $r['pf_id'] ] = $r;
}
$std->update_cache( array( 'name' => 'profilefields', 'array' => 1, 'deletefirst' => 1 ) );
}
//-----------------------------------------
//
// Delete a group
//
//-----------------------------------------
function delete_form()
{
global $ibforums, $DB, $std;
if ($ibforums->input['id'] == "")
{
$ibforums->admin->error("Could not resolve the group ID, please try again");
}
$ibforums->admin->page_title = "Deleting a Custom Profile Field";
$ibforums->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->simple_construct( array( 'select' => '*', 'from' => 'pfields_data', 'where' => "pf_id=".intval($ibforums->input['id']) ) );
$DB->simple_exec();
if ( ! $field = $DB->fetch_row() )
{
$ibforums->admin->error("Could not fetch the row from the database");
}
$ibforums->html .= $ibforums->adskin->start_form( array( 1 => array( 'code' , 'dodelete' ),
2 => array( 'act' , 'field' ),
3 => array( 'id' , $ibforums->input['id'] ),
) );
//-----------------------------------------
$ibforums->adskin->td_header[] = array( "&nbsp;" , "40%" );
$ibforums->adskin->td_header[] = array( "&nbsp;" , "60%" );
//-----------------------------------------
$ibforums->html .= $ibforums->adskin->start_table( "Removal Confirmation" );
$ibforums->html .= $ibforums->adskin->add_td_row( array( "<b>Custom Profile field to remove</b>" ,
"<b>".$field['pf_title']."</b>",
) );
$ibforums->html .= $ibforums->adskin->end_form("Delete this custom field");
$ibforums->html .= $ibforums->adskin->end_table();
$ibforums->admin->output();
}
function do_delete()
{
global $ibforums, $DB, $std;
if ($ibforums->input['id'] == "")
{
$ibforums->admin->error("Could not resolve the field ID, please try again");
}
//-----------------------------------------
// Check to make sure that the relevant groups exist.
//-----------------------------------------
$DB->simple_construct( array( 'select' => '*', 'from' => 'pfields_data', 'where' => "pf_id=".intval($ibforums->input['id']) ) );
$DB->simple_exec();
if ( ! $row = $DB->fetch_row() )
{
$ibforums->admin->error("Could not resolve the ID's passed to deletion");
}
$DB->sql_drop_field( 'pfields_content', "field_{$row['pf_id']}" );
$DB->simple_exec_query( array( 'delete' => 'pfields_data', 'where' => "pf_id=".intval($ibforums->input['id']) ) );
$this->rebuild_cache();
$ibforums->admin->done_screen("Profile Field Removed", "Custom Profile Field Control", "act=field", 'redirect' );
}
//-----------------------------------------
//
// Save changes to DB
//
//-----------------------------------------
function main_save($type='edit')
{
global $ibforums, $DB, $std;
$ibforums->input['id'] = intval($ibforums->input['id']);
if ($ibforums->input['pf_title'] == "")
{
$ibforums->admin->error("You must enter a field title.");
}
//-----------------------------------------
// check-da-motcha
//-----------------------------------------
if ($type == 'edit')
{
if ($ibforums->input['id'] == "")
{
$ibforums->admin->error("Could not resolve the field id");
}
}
$content = "";
if ( $_POST['pf_content'] != "")
{
$content = $this->func->method_format_content_for_save( $_POST['pf_content'] );
}
$db_string = array( 'pf_title' => $ibforums->input['pf_title'],
'pf_desc' => $ibforums->input['pf_desc'],
'pf_content' => $std->txt_stripslashes($content),
'pf_type' => $ibforums->input['pf_type'],
'pf_not_null' => $ibforums->input['pf_not_null'],
'pf_member_hide' => $ibforums->input['pf_member_hide'],
'pf_max_input' => $ibforums->input['pf_max_input'],
'pf_member_edit' => $ibforums->input['pf_member_edit'],
'pf_position' => $ibforums->input['pf_position'],
'pf_show_on_reg' => $ibforums->input['pf_show_on_reg'],
'pf_input_format' => $ibforums->input['pf_input_format'],
'pf_admin_only' => $ibforums->input['pf_admin_only'],
'pf_topic_format' => $std->txt_stripslashes( $_POST['pf_topic_format']),
);
if ($type == 'edit')
{
$DB->do_update( 'pfields_data', $db_string, 'pf_id='.$ibforums->input['id'] );
$this->rebuild_cache();
$ibforums->main_msg = "Profile Field Edited";
$this->main_screen();
}
else
{
$DB->do_insert( 'pfields_data', $db_string );
$new_id = $DB->get_insert_id();
$DB->sql_add_field( 'pfields_content', "field_$new_id", 'text' );
$DB->sql_optimize_table( 'pfields_content' );
$this->rebuild_cache();
$ibforums->main_msg = "Profile Field Added";
$this->main_screen();
}
}
//-----------------------------------------
//
// Add / edit group
//
//-----------------------------------------
function main_form($type='edit')
{
global $ibforums, $DB, $std;
$ibforums->input['id'] = intval($ibforums->input['id']);
if ($type == 'edit')
{
if ( ! $ibforums->input['id'] )
{
$ibforums->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';
}
//-----------------------------------------
// get field from db
//-----------------------------------------
if ( $ibforums->input['id'] )
{
$DB->simple_construct( array( 'select' => '*', 'from' => 'pfields_data', 'where' => "pf_id=".intval($ibforums->input['id']) ) );
$DB->simple_exec();
$fields = $DB->fetch_row();
}
else
{
$fields = array( 'pf_topic_format' => '{title}: {content}<br />' );
}
//-----------------------------------------
// Top 'o 'the mornin'
//-----------------------------------------
if ($type == 'edit')
{
$ibforums->admin->page_title = "Editing Profile Field ".$fields['ftitle'];
}
else
{
$ibforums->admin->page_title = 'Adding a new profile field';
$fields['pf_title'] = '';
}
//-----------------------------------------
// Wise words
//-----------------------------------------
$ibforums->admin->page_detail = "Please double check the information before submitting the form.";
//-----------------------------------------
// Start form
//-----------------------------------------
$ibforums->html .= $ibforums->adskin->start_form( array( 1 => array( 'code' , $form_code ),
2 => array( 'act' , 'field' ),
3 => array( 'id' , $ibforums->input['id'] ),
) );
//-----------------------------------------
// Format...
//-----------------------------------------
$fields['pf_content'] = $this->func->method_format_content_for_edit($fields['pf_content'] );
//-----------------------------------------
// Tbl (no ae?)
//-----------------------------------------
$ibforums->adskin->td_header[] = array( "&nbsp;" , "40%" );
$ibforums->adskin->td_header[] = array( "&nbsp;" , "60%" );
$ibforums->html .= $ibforums->adskin->start_table( "Field Settings" );
$ibforums->html .= $ibforums->adskin->add_td_row( array( "<b>Field Title</b><div class='graytext'>Max characters: 200</div>" ,
$ibforums->adskin->form_input("pf_title", $fields['pf_title'] )
) );
$ibforums->html .= $ibforums->adskin->add_td_row( array( "<b>Description</b><div class='graytext'>Max Characters: 250<br />Can be used to note hidden/required status</div>" ,
$ibforums->adskin->form_input("pf_desc", $fields['pf_desc'] )
) );
$ibforums->html .= $ibforums->adskin->add_td_row( array( "<b>Field Type</b>" ,
$ibforums->adskin->form_dropdown("pf_type",
array(
0 => array( 'text' , 'Text Input' ),
1 => array( 'drop' , 'Drop Down Box' ),
2 => array( 'area' , 'Text Area' ),
),
$fields['pf_type'] )
) );
$ibforums->html .= $ibforums->adskin->add_td_row( array( "<b>Maximum Input</b><div class='graytext'>For text input and text areas (in characters)</div>" ,
$ibforums->adskin->form_input("pf_max_input", $fields['pf_max_input'] )
) );
$ibforums->html .= $ibforums->adskin->add_td_row( array( "<b>Display order</b><div class='graytext'>When editing and displaying (numeric 1 lowest)</div>" ,
$ibforums->adskin->form_input("pf_position", $fields['pf_position'] )
) );
$ibforums->html .= $ibforums->adskin->add_td_row( array( "<b>Expected Input Format</b><div class='graytext'>Use: <b>a</b> for alpha characters<br />Use: <b>n</b> for numerics.<br />Example, for credit card numbers: nnnn-nnnn-nnnn-nnnn<br />Example, Date of Birth: nn-nn-nnnn<br />Leave blank to accept any input</div>" ,
$ibforums->adskin->form_input("pf_input_format", $fields['pf_input_format'] )
) );
$ibforums->html .= $ibforums->adskin->add_td_row( array( "<b>Option Content (for drop downs)</b><div class='graytext'>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')</div>" ,
$ibforums->adskin->form_textarea("pf_content", $fields['pf_content'] )
) );
$ibforums->html .= $ibforums->adskin->add_td_row( array( "<b>Include on registration page?</b><div class='graytext'>If 'yes', the field will be shown upon registration.</div>" ,
$ibforums->adskin->form_yes_no("pf_show_on_reg", $fields["pf_show_on_reg"] )
) );
$ibforums->html .= $ibforums->adskin->add_td_row( array( "<b>Field MUST be completed and not left empty?</b><div class='graytext'>If 'yes', an error will be shown if this field is not completed.</div>" ,
$ibforums->adskin->form_yes_no("pf_not_null", $fields['pf_not_null'] )
) );
$ibforums->html .= $ibforums->adskin->add_td_row( array( "<b>Field can be edited by the member?</b><div class='graytext'>If 'no', the member cannot edit the field but Super Moderators and Admins will be able to.</div>" ,
$ibforums->adskin->form_yes_no("pf_member_edit", $fields['pf_member_edit'] )
) );
$ibforums->html .= $ibforums->adskin->add_td_row( array( "<b>Make this a private profile field?</b><div class='graytext'>If yes, field only visible to profile owner, super moderators and admins. If 'no', members can search within this field.</div>" ,
$ibforums->adskin->form_yes_no("pf_member_hide", $fields['pf_member_hide'] )
) );
$ibforums->html .= $ibforums->adskin->add_td_row( array( "<b>Make Admin and Super Moderator Editable/Viewable Only?</b><div class='graytext'>If yes, will override the above options so only admins and super moderators can see and edit this field.</div>" ,
$ibforums->adskin->form_yes_no("pf_admin_only", $fields['pf_admin_only'] )
) );
$ibforums->html .= $ibforums->adskin->add_td_row( array( "<b>Topic View Format?</b><div class='graytext'>Leave blank if you do not wish to add this field in the author details when viewing a topic.<br />{title} is the title of the custom field, {content} is the user added content. {key} is the form select value of the selected item in a dropdown box.<br />Example: {title}:{content}&lt;br /&gt;<br />Example: {title}:&lt;img src='imgs/{key}'&gt;</div>" ,
$ibforums->adskin->form_textarea("pf_topic_format", $fields['pf_topic_format'] )
) );
$ibforums->html .= $ibforums->adskin->end_form($button);
$ibforums->html .= $ibforums->adskin->end_table();
$ibforums->admin->output();
}
//-----------------------------------------
//
// Show "Management Screen
//
//-----------------------------------------
function main_screen()
{
global $ibforums, $DB, $std;
$ibforums->admin->page_title = "Custom Profile Fields";
$ibforums->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.";
$ibforums->adskin->td_header[] = array( "Field Title" , "20%" );
$ibforums->adskin->td_header[] = array( "Type" , "10%" );
$ibforums->adskin->td_header[] = array( "REQUIRED" , "10%" );
$ibforums->adskin->td_header[] = array( "NOT PUBLIC" , "10%" );
$ibforums->adskin->td_header[] = array( "SHOW REG" , "10%" );
$ibforums->adskin->td_header[] = array( "ADMIN ONLY" , "10%" );
$ibforums->adskin->td_header[] = array( "Edit" , "10%" );
$ibforums->adskin->td_header[] = array( "Delete" , "10%" );
//-----------------------------------------
$ibforums->html .= $ibforums->adskin->start_table( "Custom Profile Field Management" );
$real_types = array( 'drop' => 'Drop Down Box',
'area' => 'Text Area',
'text' => 'Text Input',
);
$DB->simple_construct( array( 'select' => '*', 'from' => 'pfields_data', 'order' => 'pf_position' ) );
$DB->simple_exec();
if ( $DB->get_num_rows() )
{
while ( $r = $DB->fetch_row() )
{
$hide = '&nbsp;';
$req = '&nbsp;';
$regi = '&nbsp;';
$admin = '&nbsp;';
//-----------------------------------------
// Hidden?
//-----------------------------------------
if ($r['pf_member_hide'] == 1)
{
$hide = '<center><span style="color:red">Y</span></center>';
}
//-----------------------------------------
// Required?
//-----------------------------------------
if ($r['pf_not_null'] == 1)
{
$req = '<center><span style="color:red">Y</span></center>';
}
//-----------------------------------------
// Show on reg?
//-----------------------------------------
if ($r['pf_show_on_reg'] == 1)
{
$regi = '<center><span style="color:red">Y</span></center>';
}
//-----------------------------------------
// Admin only...
//-----------------------------------------
if ($r['pf_admin_only'] == 1)
{
$admin = '<center><span style="color:red">Y</span></center>';
}
$ibforums->html .= $ibforums->adskin->add_td_row( array( "<b>{$r['pf_title']}</b><div class='graytext'>{$r['pf_desc']}</div>" ,
"<center>{$real_types[$r['pf_type']]}</center>",
$req,
$hide,
$regi,
$admin,
"<center><a href='{$ibforums->base_url}&act=field&code=edit&id=".$r['pf_id']."'>Edit</a></center>",
"<center><a href='{$ibforums->base_url}&act=field&code=delete&id=".$r['pf_id']."'>Delete</a></center>",
) );
}
}
else
{
$ibforums->html .= $ibforums->adskin->add_td_basic("None found", "center", "tdrow1");
}
$ibforums->html .= $ibforums->adskin->add_td_basic( $ibforums->adskin->js_make_button( 'ADD NEW FIELD', "{$ibforums->base_url}&act=field&code=add" ), "center", "pformstrip");
$ibforums->html .= $ibforums->adskin->end_table();
$ibforums->admin->output();
}
}
?>
+163
View File
@@ -0,0 +1,163 @@
<?php
/*
+--------------------------------------------------------------------------
| Invision Power Board v2.0.0
| =============================================
| by Matthew Mecham
| (c) 2001 - 2004 Invision Power Services, Inc.
| http://www.invisionpower.com
| =============================================
| Web: http://www.invisionboard.com
| Time: Tue, 21 Sep 2004 16:34:28 GMT
| Release: 150aa7a702c3c8b6f6eb90ad49305d2f
| Licence Info: http://www.invisionboard.com/?license
+---------------------------------------------------------------------------
|
| > Admin Quick Help System
| > Module written by Matt Mecham
| > Date started: 1st march 2002
|
| > Module Version Number: 1.0.0
| > DBA Checked: Tue 25th May 2004
+--------------------------------------------------------------------------
*/
if ( ! defined( 'IN_ACP' ) )
{
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded 'admin.php'.";
exit();
}
class ad_quickhelp {
var $help_text = array();
function init_help_array()
{
return array( 'mg_dohtml' => array( 'title' => "Posting HTML",
'body' => "This will allow all members of the group to post pure HTML in forums that have the ability to accept raw HTML. You can turn this on and off
for each forum via the edit forum settings function. Note: When HTML in posts in quoted by a member who does not have the permission to post HTML, the
post will be shown in unparsed HTML format with most of the formatting removed.<br />
<br /><b>Warning!</b><br />
Allowing a member to post HTML is a very dangerous thing, you should not enable this functionality on any group that will use it maliciously. Although IPB tries
to filter some of the more harmful content, it is NOT foolproof and this tag CAN be used to steal session cookies, redirect members and destroy the topic view layout.
<br />Invision Power Board and Invision Power Services will not be held responsible for any misfortune that occurs from the usage of this tag.
<br /><br /><b>Use it wisely!</b>
",
),
'mod_mmod' => array( 'title' => "Moderations and Topic Multi-Moderation",
'body' => "If you allow your moderators access to the forums' multi-moderation then you must be aware that they have full use.
<br />For example, if one of your multi-moderation actions allowed the topic to be moved and you do not allow move permissions the
moderator will still be able to use the topic multi-moderation and move the topic.
",
),
'set_spider' => array( 'title' => "What are Search Engine Spiders?",
'body' => "Search engines such as Google 'spider' the web by using special programs to find and add links to the search engine
database.<br />Invision Power can take advantage of separating the bots from the real users and you can then
ensure that they are getting adequate information to help with search engine ranking.
<br />
<br />
<b>Warning!</b>
<br />
Invision Power Board recognises the search engine spiders and crawlers by their user_agent. Please keep in mind
that it's not impossible to fake this and a malicious user could pose as a harmless search engine spider.
<br />This is not a problem as by default the spider will have guest permissions, but it's something that
you should keep in mind when allowing permissions.
<br /><br />Also keep in mind that most search engines do NOT search dynamically generated website for fear
of crashing the server with the constant reading of topics.
",
),
'mg_upload' => array( 'title' => "Upload Permissions",
'body' => "If you wish to allow this group to attach files (upload) when posting, you will have to ensure you have completed the following:
<ul>
<li>You have entered a reasonable numerical figure in the groups 'Max upload file size' field.
<li>You have edited the forum permissions for this group and checked the 'Upload' checkbox.
</ul>
This allows you to control in which forums this group can upload to.
<br><br><b>Warning!</b><br>If, when posting, no post is made and you are returned back to the board index, disable this groups upload by entering 0 into this field. This will turn off the mutli-part form the uploads use.
",
),
'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 auto_run()
{
global $DB, $ibforums, $std;
$id = $ibforums->input['id'];
$this->help_text = $this->init_help_array();
if ($this->help_text[$id]['title'] == "")
{
$ibforums->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();
}
}
?>
File diff suppressed because it is too large. Load diff
+885
View File
@@ -0,0 +1,885 @@
<?php
/*
+--------------------------------------------------------------------------
| Invision Power Board v2.0.0
| =============================================
| by Matthew Mecham
| (c) 2001 - 2004 Invision Power Services, Inc.
| http://www.invisionpower.com
| =============================================
| Web: http://www.invisionboard.com
| Time: Tue, 21 Sep 2004 16:34:28 GMT
| Release: 150aa7a702c3c8b6f6eb90ad49305d2f
| Licence Info: http://www.invisionboard.com/?license
+---------------------------------------------------------------------------
|
| > Skin -> Templates pop up functions
| > Module written by Matt Mecham
| > Date started: 9th July 2002
|
| > Module Version Number: 1.0.0
+--------------------------------------------------------------------------
*/
if ( ! defined( 'IN_ACP' ) )
{
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded 'admin.php'.";
exit();
}
class ad_remote_template {
var $base_url;
function auto_run()
{
global $ibforums, $DB, $std;
//-----------------------------------------
// Kill globals - globals bad, Homer good.
//-----------------------------------------
$tmp_in = array_merge( $_GET, $_POST, $_COOKIE );
foreach ( $tmp_in as $k => $v )
{
unset($$k);
}
//-----------------------------------------
switch($ibforums->input['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 $ibforums, $DB, $std, $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='{$ibforums->adskin->base_url}&act=rtempl&code=csssearchlinks&id={$ibforums->input['id']}&element={$HTTP_GET_VARS['element']}'>
<frame name='preview' scrolling='auto' src='{$ibforums->adskin->base_url}&act=rtempl&code=previewstate'>
</frameset>
</html>";
exit();
}
//-----------------------------------------
function css_preview()
{
global $ibforums, $DB, $std, $HTTP_GET_VARS;
//-----------------------------------------
// GET THE TEMPLATES THAT THIS CSS USES
//-----------------------------------------
$this_set = $DB->simple_exec_query( array( 'select' => '*', 'from' => 'skin_sets', 'where' => 'set_skin_set_id='.intval( $ibforums->input['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", $this_set['set_cache_css'], $match );
$defs = explode( ";", str_replace( "\n\n", "\n", str_replace( "\r\n", "\n", trim($match[2]) ) ) );
$def_output = "";
foreach($defs as $bit)
{
list($type, $value) = explode( ":", trim($bit) );
$type = trim($type);
$value = trim($value);
if ($type != "" and $value != "")
{
$extra = "";
if ($type == 'color' or $type == 'background-color')
{
$extra = "&nbsp;&nbsp;&nbsp;<input type='text' size='6' style='background-color:$value' readonly>";
}
$def_output .= "<tr><td width='40%'><b>$type</b></td><td width='60%'>$value $extra</td></tr>\n";
}
}
$css = "\n<style>\n<!--\n".preg_replace( "#url\(([\"'])?#i", "url(\\1style_images/", $this_set['set_cache_css'] )."\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 '{$this_set['set_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 $ibforums, $DB, $std, $HTTP_GET_VARS;
//-----------------------------------------
// GET THE TEMPLATES THAT THIS CSS USES
//-----------------------------------------
$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='".$ibforums->input['id']."' AND section_content LIKE '%".$like."%' ORDER BY group_name");
if (! $DB->get_num_rows() )
{
$this->do_message("No matches for that string in template set ID {$set['set_id']}");
}
$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'] );
}
$ibforums->html .= $ibforums->adskin->start_table();
$ibforums->html .= $ibforums->adskin->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];
}
$ibforums->html .= $ibforums->adskin->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 )
{
$ibforums->html .= $ibforums->adskin->add_td_row( array( "+ <a href='{$ibforums->adskin->base_url}&act=rtempl&code=preview&suid={$data['suid']}&type=text&hl=".urlencode($name)."' target='preview'>{$data['func_name']}</a>" ) );
}
}
}
$ibforums->html .= $ibforums->adskin->end_table();
$ibforums->admin->print_popup();
}
/*-------------------------------------------------------------------------*/
// PRINT THE SEARCH RESULT LINKS
/*-------------------------------------------------------------------------*/
function print_searchlinks()
{
global $ibforums, $DB, $std;
//-----------------------------------------
// Printing no results?
//-----------------------------------------
if ($ibforums->input['bypass'] == 1)
{
$this->do_message("No Search Results");
}
//-----------------------------------------
// Clean up search post
//-----------------------------------------
$search_text = trim($this->unconvert_tags(stripslashes($_POST['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';
//-----------------------------------------
// Get template bits
//-----------------------------------------
$DB->query("SELECT suid, set_id, group_name, func_name FROM ibf_skin_templates WHERE set_id=".$ibforums->input['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();
//-----------------------------------------
// Loop..
//-----------------------------------------
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'] );
}
//-----------------------------------------
// Print..
//-----------------------------------------
$ibforums->html .= $ibforums->adskin->start_table();
$ibforums->html .= $ibforums->adskin->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];
}
$ibforums->html .= $ibforums->adskin->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 )
{
$ibforums->html .= $ibforums->adskin->add_td_row( array( "+ <a href='{$ibforums->adskin->base_url}&act=rtempl&code=preview&suid={$data['suid']}&set_id={$ibforums->input['set_id']}&type=text&hl=".urlencode(stripslashes($_POST['search']))."' target='preview'>{$data['func_name']}</a>" ) );
}
}
}
//-----------------------------------------
// Done..
//-----------------------------------------
$ibforums->html .= $ibforums->adskin->end_table();
$ibforums->admin->print_popup();
}
//-----------------------------------------
function do_message($message="")
{
global $ibforums, $DB, $std;
$ibforums->html = "<tr><td id='tdrow1' height='100%' align='center' valign='middle'><br><br><b>$message</b><br><br>&nbsp;</td></tr>";
$ibforums->admin->print_popup();
}
//-----------------------------------------
function print_search_box()
{
global $ibforums, $DB, $std;
$ibforums->html .= $ibforums->adskin->start_form( array( 1 => array( 'code' , 'searchlinks' ),
2 => array( 'act' , 'rtempl' ),
3 => array( 'set_id', $ibforums->input['set_id'] )
) ,'theform', 'target="links"' );
//-----------------------------------------
//-----------------------------------------
$ibforums->html .= $ibforums->adskin->start_table( );
$ibforums->html .= $ibforums->adskin->add_td_row( array( "<b>Enter text to search for</b><br>".
$ibforums->adskin->form_input( 'search' )
) );
$ibforums->html .= $ibforums->adskin->end_form("Search!");
$ibforums->html .= $ibforums->adskin->end_table();
$ibforums->admin->print_popup();
}
//-----------------------------------------
function search_frames()
{
global $ibforums, $DB, $std;
$std->boink_it( $ibforums->base_url.'&act=skintools&code=searchsplash' );
exit();
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='{$ibforums->adskin->base_url}&act=rtempl&code=searchlinks&set_id={$ibforums->input['set_id']}&bypass=1'>
<frame name='searchbox' scrolling='no' src='{$ibforums->adskin->base_url}&act=rtempl&code=searchbox&set_id={$ibforums->input['set_id']}'>
</frameset>
<frame name='preview' scrolling='auto' src='{$ibforums->adskin->base_url}&act=rtempl&code=previewstate'>
</frameset>
</html>";
exit();
}
//-----------------------------------------
function compare_frames()
{
global $ibforums, $DB, $std;
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='{$ibforums->adskin->base_url}&act=rtempl&code=dotop&content=orig'>
<frame name='origbot' scrolling='auto' src='{$ibforums->adskin->base_url}&act=rtempl&code=preview&suid={$ibforums->input['suid']}&type=css'>
</frameset>
<frameset rows='30, *' frameborder='yes' border='1' framespacing='0'>
<frame name='newtop' scrolling='auto' src='{$ibforums->adskin->base_url}&act=rtempl&code=dotop&content=new'>
<frame name='newbot' scrolling='auto' src='{$ibforums->adskin->base_url}&act=rtempl&code=donew&suid={$ibforums->input['suid']}'>
</frameset>
</frameset>
</html>";
exit();
}
//-----------------------------------------
function print_compare_top()
{
global $ibforums, $DB, $std;
$content = $ibforums->input['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 $ibforums, $DB, $std;
$template = $DB->simple_exec_query( array( 'select' => '*', 'from' => 'skin_templates', 'where' => "suid=".intval($ibforums->input['suid']) ) );
if ( ! $template['suid'] )
{
$ibforums->admin->error("You must specify an existing template set ID, go back and try again");
}
$skin = $DB->simple_exec_query( array( 'select' => '*', 'from' => 'skin_sets', 'where' => 'set_skin_set_id='.$template['set_id'] ) );
$css = $skin['set_cache_css'];
$css_text = "\n<style>\n<!--\n".str_replace( "<#IMG_DIR#>", "style_images/".$r['set_image_dir'], $css )."\n//-->\n</style>";
print "<html><head>
$css_text
</head>
<body>
<script language='Javascript'>
templatedata = window.parent.opener.document.theform.txt{$ibforums->input['suid']}.value;
document.write( templatedata);
document.close();
</script>
</body></html>
";
exit();
}
//-----------------------------------------
function macro_one($msg="")
{
global $ibforums, $DB, $std;
$ibforums->html .= $ibforums->adskin->start_form( array( 1 => array( 'code' , 'macro_two' ),
2 => array( 'act' , 'rtempl' ),
3 => array( 'suid' , $ibforums->input['suid'] )
) );
//-----------------------------------------
$ibforums->adskin->td_header[] = array( "&nbsp;" , "60%" );
$ibforums->adskin->td_header[] = array( "&nbsp;" , "40%" );
//-----------------------------------------
$ibforums->html .= $ibforums->adskin->start_table( "Macro Look-up" );
$ibforums->html .= $ibforums->adskin->add_td_row( array( "<b>Enter the Macro to look up</b><br>(EG: {ibf.skin.set_image_dir})",
$ibforums->adskin->form_input( 'lookup', $ibforums->input['lookup'] )
) );
$ibforums->html .= $ibforums->adskin->end_form("Look-up");
$ibforums->html .= $ibforums->adskin->end_table();
$ibforums->admin->print_popup();
}
//-----------------------------------------
function macro_two()
{
global $ibforums, $DB, $std;
if ($ibforums->input['lookup'] == "")
{
$ibforums->admin->error("You must enter a macro to look up", 1);
}
$is_valid = 0;
$macro = "";
$extra = "";
if ( preg_match( "/&lt;\{(\S+)\}&gt;/", $ibforums->input['lookup'], $match ) )
{
$is_valid = 1;
$macro = $match[1];
}
else if ( preg_match( "/{?(?:ibf|ipb)\.(skin|lang|vars|member)(.+?)}?$/", $ibforums->input['lookup'], $match ) )
{
$is_valid = 1;
$macro = $match[2];
$extra = $match[1];
$macro = str_replace( "&#39;", "'", $macro );
$macro = preg_replace( "#[\[\]\"'\.]#", "", $macro );
}
else
{
$is_valid = 0;
}
if ($is_valid != 1)
{
$this->macro_one("Wrong format");
}
if ($extra != "")
{
if ($extra == 'member')
{
if (isset($ibforums->member[$macro]))
{
if ($ibforums->member[$macro] == "")
{
$answer = "";
}
else
{
$answer = $ibforums->member[$macro];
}
}
$result = "Loaded Member Information";
}
else if ($extra == 'vars')
{
//-----------------------------------------
// Filter out sensitive stuff
//-----------------------------------------
$safe_INFO['board_name'] = $ibforums->vars['board_name'];
$safe_INFO['board_url'] = $ibforums->vars['board_url'];
$answer = $safe_INFO[$macro];
$result = "Config Variable Information (May be protected)";
}
else if ($extra == 'lang')
{
$result = "Language Text";
$DB->simple_construct( array( 'select' => 'group_name', 'from' => 'skin_templates', 'where' => "suid='{$ibforums->input['suid']}'" ) );
$DB->simple_exec();
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->simple_construct( array( 'select' => 'set_id', 'from' => 'skin_templates', 'where' => "suid='{$ibforums->input['suid']}'" ) );
$DB->simple_exec();
$template = $DB->fetch_row();
$DB->simple_construct( array( 'select' => 'macro_value, macro_replace',
'from' => 'skin_macro',
'where' => "macro_set IN( 1,{$template['set_id']}) AND macro_value='$macro'",
'order' => "macro_set DESC" ) );
$DB->simple_exec();
if ($val = $DB->fetch_row())
{
$answer = htmlentities($val['macro_replace']);
$result = "From Macro Set";
}
else
{
$answer = "Macro not found";
}
}
$ibforums->adskin->td_header[] = array( "&nbsp;" , "40%" );
$ibforums->adskin->td_header[] = array( "&nbsp;" , "60%" );
//-----------------------------------------
$ibforums->html .= $ibforums->adskin->start_table( "Macro Look-up Result <a href='{$ibforums->adskin->base_url}&act=rtempl&code=macro_one&suid={$ibforums->input['suid']}'>Go Again</a>" );
$ibforums->html .= $ibforums->adskin->add_td_row( array( "<b>Entered Macro</b>", $ibforums->input['lookup'] ) );
$ibforums->html .= $ibforums->adskin->add_td_row( array( "<b>Macro Type</b>", $result ) );
$ibforums->html .= $ibforums->adskin->add_td_row( array( "<b>Result</b><br>May be blank if no info", $answer ) );
$ibforums->html .= $ibforums->adskin->end_table();
$ibforums->admin->print_popup();
}
/*-------------------------------------------------------------------------*/
// SHOW PREVIEW
/*-------------------------------------------------------------------------*/
function do_preview()
{
global $ibforums, $DB, $std;
//-----------------------------------------
// Check...
//-----------------------------------------
if ($ibforums->input['suid'] == "")
{
$ibforums->admin->error("You must specify an existing template set ID, go back and try again");
}
//-----------------------------------------
// Get from DB
//-----------------------------------------
$DB->simple_construct( array( 'select' => '*', 'from' => 'skin_templates', 'where' => "suid='".$ibforums->input['suid']."'" ) );
$DB->simple_exec();
if ( ! $template = $DB->fetch_row() )
{
$ibforums->admin->error("You must specify an existing template set ID, go back and try again");
}
//-----------------------------------------
// Get skin set details
//-----------------------------------------
$this_set = $DB->simple_exec_query( array( 'select' => '*', 'from' => 'skin_sets', 'where' => 'set_skin_set_id='.$template['set_id'] ) );
$macros = unserialize(stripslashes($this_set['set_cache_macro']));
if ( is_array($macros) and count($macros) )
{
foreach( $macros as $id => $data )
{
$macro_orig[] = "<{".$mc['macro_value']."}>";
$macro_repl[] = $mc['macro_replace'];
}
}
$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='{$ibforums->base_url}&act=rtempl&code=preview&suid={$ibforums->input['suid']}&type=text' style='font-family:verdana, arial;font-size:11px;color:white'>Text</a> | <a href='{$ibforums->base_url}&act=rtempl&code=preview&suid={$ibforums->input['suid']}&type=html' style='font-family:verdana, arial;font-size:11px;color:white'>HTML</a> | <a href='{$ibforums->base_url}&act=rtempl&code=preview&suid={$ibforums->input['suid']}&type=css' style='font-family:verdana, arial;font-size:11px;color:white'>HTML with CSS</a> ]</td>
</tr>
</table>
<br><br>
";
if ($ibforums->input['type'] == 'text')
{
@header("Content-type: text/html");
print $table;
$html = $this->convert_tags($template['section_content']);
$html = str_replace( "<" , "&lt;" , $html);
$html = str_replace( ">" , "&gt;" , $html);
$html = str_replace( "\"", "&quot;", $html);
if ($_GET['hl'] != "")
{
$hl = str_replace( '{-22-}', '"', urldecode(stripslashes($_GET['hl'])) );
$hl = str_replace( "<" , "&lt;" , $hl);
$hl = str_replace( ">" , "&gt;" , $hl);
$hl = str_replace( "\"", "&quot;", $hl);
$html = str_replace( $hl, "<span style='color:red;font-weight:bold;background-color:yellow'>$hl</span>", $html );
}
$html = preg_replace( "!&lt;\!--(.+?)(//)?--&gt;!s" , "&#60;&#33;<span style='color:red'>--\\1--\\2</span>&#62;", $html );
$html = preg_replace( "#&lt;([^&<>]+)&gt;#s" , "&lt;<span style='color:blue'>\\1</span>&gt;" , $html ); //Matches <tag>
$html = preg_replace( "#&lt;([^&<>]+)=#s" , "&lt;<span style='color:blue'>\\1</span>=" , $html ); //Matches <tag
$html = preg_replace( "#&lt;/([^&]+)&gt;#s" , "&lt;/<span style='color:blue'>\\1</span>&gt;" , $html ); //Matches </tag>
$html = preg_replace( "!=(&quot;|')([^<>])(&quot;|')(\s|&gt;)!s" , "=\\1<span style='color:purple'>\\2</span>\\3\\4" , $html ); //Matches ='this'
$html = str_replace( "\n", "<br>", str_replace("\r\n", "\n", $html ) );
print "<pre>".$html."</pre>";
exit();
}
else if ($ibforums->input['type'] == 'html')
{
@header("Content-type: text/html");
print $table;
print $this->convert_tags($template['section_content']);
exit();
}
else if($ibforums->input['type'] == 'css')
{
$css = $this_set['set_cache_css'];
$css_text = "\n<style>\n<!--\n".str_replace( "<#IMG_DIR#>", "style_images/".$r['img_dir'], $css)."\n//-->\n</style>";
@header("Content-type: text/html");
print "<html><head><title>Preview</title>$css_text</head><body>$table \n";
print str_replace( $macro_orig, $macro_repl, $this->convert_tags($template['section_content']) );
exit();
}
}
//-----------------------------------------
function convert_tags($t="")
{
if ($t == "")
{
return "";
}
$t = preg_replace( "/{?\\\$ibforums->base_url}?/" , "{ibf.script_url}" , $t );
$t = preg_replace( "/{?\\\$ibforums->session_id}?/" , "{ibf.session_id}" , $t );
$t = preg_replace( "/{?\\\$ibforums->skin\['?(\w+)'?\]}?/" , "{ibf.skin.\\1}" , $t );
$t = preg_replace( "/{?\\\$ibforums->lang\['?(\w+)'?\]}?/" , "{ibf.lang.\\1}" , $t );
$t = preg_replace( "/{?\\\$ibforums->vars\['?(\w+)'?\]}?/" , "{ibf.vars.\\1}" , $t );
$t = preg_replace( "/{?\\\$ibforums->member\['?(\w+)'?\]}?/" , "{ibf.member.\\1}" , $t );
return $t;
}
function unconvert_tags($t="")
{
if ($t == "")
{
return "";
}
$t = preg_replace( "/{ibf\.script_url}/i" , '{$ibforums->base_url}' , $t);
$t = preg_replace( "/{ibf\.session_id}/i" , '{$ibforums->session_id}' , $t);
$t = preg_replace( "/{ibf\.skin\.(\w+)}/" , '{$ibforums->skin[\''."\\1".'\']}' , $t);
$t = preg_replace( "/{ibf\.lang\.(\w+)}/" , '{$ibforums->lang[\''."\\1".'\']}' , $t);
$t = preg_replace( "/{ibf\.vars\.(\w+)}/" , '{$ibforums->vars[\''."\\1".'\']}' , $t);
$t = preg_replace( "/{ibf\.member\.(\w+)}/" , '{$ibforums->member[\''."\\1".'\']}' , $t);
return $t;
}
}
?>
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
+305
View File
@@ -0,0 +1,305 @@
<?php
/*
+--------------------------------------------------------------------------
| Invision Power Board v2.0.0
| =============================================
| by Matthew Mecham
| (c) 2001 - 2004 Invision Power Services, Inc.
| http://www.invisionpower.com
| =============================================
| Web: http://www.invisionboard.com
| Time: Tue, 21 Sep 2004 16:34:28 GMT
| Release: 150aa7a702c3c8b6f6eb90ad49305d2f
| Licence Info: http://www.invisionboard.com/?license
+---------------------------------------------------------------------------
|
| > Spider (MAN) Logs
| > Module written by Matt Mecham
| > Date started: 28th May 2003
|
| > Module Version Number: 1.0.0
| > DBA Checked: Tue 25th May 2004
+--------------------------------------------------------------------------
*/
if ( ! defined( 'IN_ACP' ) )
{
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded 'admin.php'.";
exit();
}
class ad_spiderlogs {
var $base_url;
function auto_run()
{
global $ibforums, $DB, $std;
//-----------------------------------------
// Kill globals - globals bad, Homer good.
//-----------------------------------------
$tmp_in = array_merge( $_GET, $_POST, $_COOKIE );
foreach ( $tmp_in as $k => $v )
{
unset($$k);
}
$ibforums->admin->nav[] = array( 'act=spiderlog', 'Search Engine Spider Logs' );
//-----------------------------------------
// Get bot names
//-----------------------------------------
foreach( explode( "\n", $ibforums->vars['search_engine_bots'] ) as $bot )
{
list($ua, $n) = explode( "=", $bot );
$this->bot_map[ strtolower($ua) ] = $n;
}
switch($ibforums->input['code'])
{
case 'view':
$this->view();
break;
case 'remove':
$this->remove();
break;
//-----------------------------------------
default:
$this->list_current();
break;
}
}
//-----------------------------------------
// Remove archived files
//-----------------------------------------
function view()
{
global $ibforums, $DB, $std;
$start = $ibforums->input['st'] ? $ibforums->input['st'] : 0;
$ibforums->admin->page_detail = "Viewing all actions by a search engine spider";
$ibforums->admin->page_title = "Search Engine Logs Manager";
$botty = urldecode($ibforums->input['bid']);
if ($ibforums->input['search_string'] == "")
{
$DB->simple_construct( array( 'select' => 'COUNT(sid) as count', 'from' => 'spider_logs', 'where' => "bot='$botty'" ) );
$DB->simple_exec();
$row = $DB->fetch_row();
$row_count = $row['count'];
$query = "&act=spiderlog&bid={$ibforums->input['bid']}&code=view";
$DB->simple_construct( array( 'select' => '*',
'from' => 'spider_logs',
'where' => "bot='$botty'",
'order' => 'entry_date DESC',
'limit' => array( $start, 20 ) ) );
$DB->simple_exec();
}
else
{
$ibforums->input['search_string'] = urldecode($ibforums->input['search_string']);
$DB->simple_construct( array( 'select' => 'COUNT(sid) as count', 'from' => 'spider_logs', 'where' => "query_string LIKE '%{$ibforums->input['search_string']}%'" ) );
$DB->simple_exec();
$row = $DB->fetch_row();
$row_count = $row['count'];
$query = "&act=spiderlog&code=view&search_string=".urlencode($ibforums->input['search_string']);
$DB->simple_construct( array( 'select' => '*',
'from' => 'spider_logs',
'where' => "query_string LIKE '%{$ibforums->input['search_string']}%'",
'order' => 'entry_date DESC',
'limit' => array( $start, 20 ) ) );
$DB->simple_exec();
}
$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' => $ibforums->base_url.$query,
)
);
$ibforums->admin->page_detail = "You may view and remove actions performed by a search engine bot";
$ibforums->admin->page_title = "Search Engine Logs Manager";
//-----------------------------------------
// Show form!
//-----------------------------------------
$ibforums->adskin->td_header[] = array( "Bot Name" , "15%" );
$ibforums->adskin->td_header[] = array( "Query String" , "15%" );
$ibforums->adskin->td_header[] = array( "Time of action" , "20%" );
$ibforums->adskin->td_header[] = array( "IP address" , "10%" );
$ibforums->html .= $ibforums->adskin->start_table( "Saved Search Engine Logs" );
$ibforums->html .= $ibforums->adskin->add_td_basic($links, 'right', 'pformstrip');
if ( $DB->get_num_rows() )
{
while ( $row = $DB->fetch_row() )
{
$extra = "";
if ( preg_match( '#lo-fi#i', $row['query_string'] ) )
{
$extra = '(Lo-Fi)';
$row['query_string'] = 'showtopic='.preg_replace( "#Lo-Fi\: t(.+?)\.html#", "\\1", $row['query_string'] );
}
$ibforums->html .= $ibforums->adskin->add_td_row( array( "<b>".$this->bot_map[ strtolower($row['bot']) ]."</b>",
"<a href='{$ibforums->vars['board_url']}/index.{$ibforums->vars['php_ext']}?{$row['query_string']}' target='_blank'>$extra {$row['query_string']}</a>",
$ibforums->admin->get_date( $row['entry_date'], 'LONG' ),
"{$row['ip_address']}",
) );
}
}
else
{
$ibforums->html .= $ibforums->adskin->add_td_basic("<center>No results</center>");
}
$ibforums->html .= $ibforums->adskin->add_td_basic($links, 'right', 'pformstrip');
$ibforums->html .= $ibforums->adskin->end_table();
//-----------------------------------------
//-------------------------------
$ibforums->admin->output();
}
//-----------------------------------------
// Remove archived files
//-----------------------------------------
function remove()
{
global $ibforums, $DB, $std;
if ($ibforums->input['bid'] == "")
{
$ibforums->admin->error("You did not select a bot to remove by!");
}
$botty = urldecode($ibforums->input['bid']);
$DB->simple_exec_query( array( 'delete' => 'spider_logs', 'where' => "bot='$botty'" ) );
$ibforums->admin->save_log("Removed Search Engine Logs");
$std->boink_it($ibforums->base_url."&act=spiderlog");
exit();
}
//-----------------------------------------
// SHOW ALL LANGUAGE PACKS
//-----------------------------------------
function list_current()
{
global $ibforums, $DB, $std;
$form_array = array();
$ibforums->admin->page_detail = "You may view and remove entries in your spider engine logs";
$ibforums->admin->page_title = "Search Engine Logs Manager";
//-----------------------------------------
$ibforums->adskin->td_header[] = array( "Bot Name" , "20%" );
$ibforums->adskin->td_header[] = array( "Hits" , "20%" );
$ibforums->adskin->td_header[] = array( "Started" , "20%" );
$ibforums->adskin->td_header[] = array( "View all by bot" , "20%" );
$ibforums->adskin->td_header[] = array( "Remove all by bot" , "20%" );
$ibforums->html .= $ibforums->adskin->start_table( "Saved Search Engine Spider Logs" );
$DB->cache_add_query( 'spiderlogs_list_current', array() );
$DB->cache_exec_query();
while ( $r = $DB->fetch_row() )
{
$url_butt = urlencode($r['bot']);
$ibforums->html .= $ibforums->adskin->add_td_row( array( $this->bot_map[ strtolower($r['bot']) ],
"<center>{$r['cnt']}</center>",
$ibforums->admin->get_date( $r['entry_date'], 'SHORT' ),
"<center><a href='".$ibforums->adskin->base_url."&act=spiderlog&code=view&bid={$url_butt}'>View</a></center>",
"<center><a href='".$ibforums->adskin->base_url."&act=spiderlog&code=remove&bid={$url_butt}'>Remove</a></center>",
) );
}
$ibforums->html .= $ibforums->adskin->end_table();
//-----------------------------------------
//-------------------------------
$ibforums->html .= $ibforums->adskin->start_form( array( 1 => array( 'code' , 'view' ),
2 => array( 'act' , 'spiderlog' ),
) );
$ibforums->adskin->td_header[] = array( "&nbsp;" , "40%" );
$ibforums->adskin->td_header[] = array( "&nbsp;" , "60%" );
$ibforums->html .= $ibforums->adskin->start_table( "Search Search Engine Logs" );
//-----------------------------------------
$ibforums->html .= $ibforums->adskin->add_td_row( array( "<b>Search for...</b>" ,
$ibforums->adskin->form_input( "search_string").'... in the query string'
) );
$ibforums->html .= $ibforums->adskin->end_form("Search");
$ibforums->html .= $ibforums->adskin->end_table();
//-----------------------------------------
//-------------------------------
$ibforums->admin->output();
}
}
?>
+557
View File
@@ -0,0 +1,557 @@
<?php
/*
+--------------------------------------------------------------------------
| Invision Power Board v2.0.0
| =============================================
| by Matthew Mecham
| (c) 2001 - 2004 Invision Power Services, Inc.
| http://www.invisionpower.com
| =============================================
| Web: http://www.invisionboard.com
| Time: Tue, 21 Sep 2004 16:34:28 GMT
| Release: 150aa7a702c3c8b6f6eb90ad49305d2f
| Licence Info: http://www.invisionboard.com/?license
+---------------------------------------------------------------------------
|
| > Statistical functions
| > Module written by Matt Mecham
| > Date started: 4th July 2002
|
| > Module Version Number: 1.0.0
| > DBA Checked: Tue 25th May 2004
+--------------------------------------------------------------------------
*/
if ( ! defined( 'IN_ACP' ) )
{
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded 'admin.php'.";
exit();
}
class ad_statistics {
var $base_url;
var $month_names = array();
function auto_run()
{
global $ibforums, $DB, $std;
//-----------------------------------------
// Kill globals - globals bad, Homer good.
//-----------------------------------------
$tmp_in = array_merge( $_GET, $_POST, $_COOKIE );
foreach ( $tmp_in as $k => $v )
{
unset($$k);
}
//-----------------------------------------
$this->month_names = array( 1 => 'January', 'February', 'March' , 'April' , 'May' , 'June',
'July' , 'August' , 'September' , 'October', 'November', 'December'
);
switch($ibforums->input['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 $ibforums, $DB, $std;
$ibforums->admin->page_title = "Statistic Center Results";
$ibforums->admin->page_detail = "Showing topic view statistics";
//-----------------------------------------
if ( ! checkdate($ibforums->input['to_month'] ,$ibforums->input['to_day'] ,$ibforums->input['to_year']) )
{
$ibforums->admin->error("The 'Date To:' time is incorrect, please check the input and try again");
}
if ( ! checkdate($ibforums->input['from_month'] ,$ibforums->input['from_day'] ,$ibforums->input['from_year']) )
{
$ibforums->admin->error("The 'Date From:' time is incorrect, please check the input and try again");
}
//-----------------------------------------
$to_time = mktime(12 ,0 ,0 ,$ibforums->input['to_month'] ,$ibforums->input['to_day'] ,$ibforums->input['to_year'] );
$from_time = mktime(12 ,0 ,0 ,$ibforums->input['from_month'] ,$ibforums->input['from_day'] ,$ibforums->input['from_year']);
$human_to_date = getdate($to_time);
$human_from_date = getdate($from_time);
$DB->cache_add_query( 'statistics_show_views', array( 'from_time' => $from_time, 'to_time' => $to_time, 'sortby' => $ibforums->input['sortby'] ) );
$DB->cache_exec_query();
$running_total = 0;
$max_result = 0;
$results = array();
$ibforums->adskin->td_header[] = array( "Forum" , "40%" );
$ibforums->adskin->td_header[] = array( "Result" , "50%" );
$ibforums->adskin->td_header[] = array( "Views" , "10%" );
//-----------------------------------------
$ibforums->html .= $ibforums->adskin->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);
if ($img_width < 1)
{
$img_width = 1;
}
$img_width .= '%';
$ibforums->html .= $ibforums->adskin->add_td_row( array( $data['result_name'],
"<img src='{$ibforums->adskin->img_url}/bar_left.gif' border='0' width='4' height='11' align='middle' alt=''><img src='{$ibforums->adskin->img_url}/bar.gif' border='0' width='$img_width' height='11' align='middle' alt=''><img src='{$ibforums->adskin->img_url}/bar_right.gif' border='0' width='4' height='11' align='middle' alt=''>",
"<center>".$data['result_count']."</center>",
) );
}
$ibforums->html .= $ibforums->adskin->add_td_row( array( '&nbsp;',
"<div align='right'><b>Total</b></div>",
"<center><b>".$running_total."</b></center>",
) );
}
else
{
$ibforums->html .= $ibforums->adskin->add_td_basic( "No results found", "center" );
}
$ibforums->html .= $ibforums->adskin->end_table();
$ibforums->admin->output();
}
//-----------------------------------------
//| Results screen
//-----------------------------------------
function result_screen($mode='reg')
{
global $ibforums, $DB, $std;
$ibforums->admin->page_title = "Statistic Center Results";
$ibforums->admin->page_detail = "&nbsp;";
//-----------------------------------------
if ( ! checkdate($ibforums->input['to_month'] ,$ibforums->input['to_day'] ,$ibforums->input['to_year']) )
{
$ibforums->admin->error("The 'Date To:' time is incorrect, please check the input and try again");
}
if ( ! checkdate($ibforums->input['from_month'] ,$ibforums->input['from_day'] ,$ibforums->input['from_year']) )
{
$ibforums->admin->error("The 'Date From:' time is incorrect, please check the input and try again");
}
//-----------------------------------------
$to_time = mktime(12 ,0 ,0 ,$ibforums->input['to_month'] ,$ibforums->input['to_day'] ,$ibforums->input['to_year'] );
$from_time = mktime(12 ,0 ,0 ,$ibforums->input['from_month'] ,$ibforums->input['from_day'] ,$ibforums->input['from_year']);
$human_to_date = getdate($to_time);
$human_from_date = getdate($from_time);
//-----------------------------------------
if ($mode == 'reg')
{
$table = 'Registration Statistics';
$sql_table = 'members';
$sql_field = 'joined';
$ibforums->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 = 'topics';
$sql_field = 'start_date';
$ibforums->admin->page_detail = "Showing the number of topics started. (Note: All times based on GMT)";
}
else if ($mode == 'post')
{
$table = 'Post Statistics';
$sql_table = 'posts';
$sql_field = 'post_date';
$ibforums->admin->page_detail = "Showing the number of posts. (Note: All times based on GMT)";
}
else if ($mode == 'msg')
{
$table = 'PM Sent Statistics';
$sql_table = 'message_topics';
$sql_field = 'mt_date';
$ibforums->admin->page_detail = "Showing the number of sent messages. (Note: All times based on GMT)";
}
switch ($ibforums->input['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->cache_add_query( 'statistics_result_screen', array( 'from_time' => $from_time,
'to_time' => $to_time,
'sortby' => $ibforums->input['sortby'],
'sql_field' => $sql_field,
'sql_table' => $sql_table,
'sql_date' => $sql_date ) );
$DB->cache_exec_query();
$running_total = 0;
$max_result = 0;
$results = array();
$ibforums->adskin->td_header[] = array( "Date" , "20%" );
$ibforums->adskin->td_header[] = array( "Result" , "70%" );
$ibforums->adskin->td_header[] = array( "Count" , "10%" );
//-----------------------------------------
$ibforums->html .= $ibforums->adskin->start_table( ucfirst($ibforums->input['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 ($img_width < 1)
{
$img_width = 1;
}
$img_width .= '%';
if ($ibforums->input['timescale'] == 'weekly')
{
$date = "Week #".strftime("%W", $data['result_maxdate']) . date( $php_date, $data['result_maxdate'] );
}
else
{
$date = date( $php_date, $data['result_maxdate'] );
}
$ibforums->html .= $ibforums->adskin->add_td_row( array( $date,
"<img src='{$ibforums->adskin->img_url}/bar_left.gif' border='0' width='4' height='11' align='middle' alt=''><img src='{$ibforums->adskin->img_url}/bar.gif' border='0' width='$img_width' height='11' align='middle' alt=''><img src='{$ibforums->adskin->img_url}/bar_right.gif' border='0' width='4' height='11' align='middle' alt=''>",
"<center>".$data['result_count']."</center>",
) );
}
$ibforums->html .= $ibforums->adskin->add_td_row( array( '&nbsp;',
"<div align='right'><b>Total</b></div>",
"<center><b>".$running_total."</b></center>",
) );
}
else
{
$ibforums->html .= $ibforums->adskin->add_td_basic( "No results found", "center" );
}
$ibforums->html .= $ibforums->adskin->end_table();
$ibforums->admin->output();
}
//-----------------------------------------
//| Date selection screen
//-----------------------------------------
function main_screen($mode='reg')
{
global $ibforums, $DB, $std;
$ibforums->admin->page_title = "Statistic Center";
$ibforums->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));
//-----------------------------------------
$ibforums->html .= $ibforums->adskin->start_form( array( 1 => array( 'code' , $form_code ),
2 => array( 'act' , 'stats' ),
) );
//-----------------------------------------
$ibforums->adskin->td_header[] = array( "&nbsp;" , "40%" );
$ibforums->adskin->td_header[] = array( "&nbsp;" , "60%" );
//-----------------------------------------
$ibforums->html .= $ibforums->adskin->start_table( $table );
$ibforums->html .= $ibforums->adskin->add_td_row( array( "<b>Date From</b>" ,
$ibforums->adskin->form_dropdown( "from_month" , $this->make_month(), $old_date['mon'] ).'&nbsp;&nbsp;'.
$ibforums->adskin->form_dropdown( "from_day" , $this->make_day() , $old_date['mday'] ).'&nbsp;&nbsp;'.
$ibforums->adskin->form_dropdown( "from_year" , $this->make_year() , $old_date['year'] )
) );
$ibforums->html .= $ibforums->adskin->add_td_row( array( "<b>Date To</b>" ,
$ibforums->adskin->form_dropdown( "to_month" , $this->make_month(), $new_date['mon'] ).'&nbsp;&nbsp;'.
$ibforums->adskin->form_dropdown( "to_day" , $this->make_day() , $new_date['mday'] ).'&nbsp;&nbsp;'.
$ibforums->adskin->form_dropdown( "to_year" , $this->make_year() , $new_date['year'] )
) );
if ($mode != 'views')
{
$ibforums->html .= $ibforums->adskin->add_td_row( array( "<b>Time scale</b>" ,
$ibforums->adskin->form_dropdown( "timescale" , array( 0 => array( 'daily', 'Daily'), 1 => array( 'weekly', 'Weekly' ), 2 => array( 'monthly', 'Monthly' ) ) )
) );
}
$ibforums->html .= $ibforums->adskin->add_td_row( array( "<b>Result Sorting</b>" ,
$ibforums->adskin->form_dropdown( "sortby" , array( 0 => array( 'asc', 'Ascending - Oldest dates first'), 1 => array( 'desc', 'Descending - Newest dates first' ) ), 'desc' )
) );
$ibforums->html .= $ibforums->adskin->end_form("Show");
$ibforums->html .= $ibforums->adskin->end_table();
$ibforums->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
+185
View File
@@ -0,0 +1,185 @@
<?php
/*
+--------------------------------------------------------------------------
| Invision Power Board v2.0.0
| =============================================
| by Matthew Mecham
| (c) 2001 - 2004 Invision Power Services, Inc.
| http://www.invisionpower.com
| =============================================
| Web: http://www.invisionboard.com
| Time: Tue, 21 Sep 2004 16:34:28 GMT
| Release: 150aa7a702c3c8b6f6eb90ad49305d2f
| Licence Info: http://www.invisionboard.com/?license
+---------------------------------------------------------------------------
|
| > Subscription Manager For IPB
| > Module written by Matt Mecham
| > Date started: 19th August 2003
|
| > Module Version Number: 1.0.0
| > DBA Checked: Tue 25th May 2004
+--------------------------------------------------------------------------
*/
if ( ! defined( 'IN_ACP' ) )
{
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded 'admin.php'.";
exit();
}
class ad_subsmanager {
var $base_url;
function auto_run()
{
global $ibforums, $DB, $std;
//-----------------------------------------
// Kill globals - globals bad, Homer good.
//-----------------------------------------
$tmp_in = array_merge( $_GET, $_POST, $_COOKIE );
foreach ( $tmp_in as $k => $v )
{
unset($$k);
}
$ibforums->admin->page_title = "IPB Subscriptions Manager";
$ibforums->admin->page_detail = "You can set up and manage your member's paid subscriptions in this section.";
$ibforums->admin->nav[] = array( 'act=msubs' , 'IPB Subscription Manager Home' );
$ibforums->admin->nav[] = array( 'act=msubs&code=dosearch', 'Show all subscribed members' );
//-----------------------------------------
// Do some set up
//-----------------------------------------
if ( ! @is_dir( ROOT_PATH.'/modules/subsmanager' ) )
{
$std->boink_it("http://customer.invisionpower.com/ipb/subs/redirect_acp.php");
}
else
{
define( 'IPB_CALLED', 1 );
require ROOT_PATH.'/modules/subsmanager/ad_plugin_subsm.php';
$PLUGIN = new ad_plugin_subsm();
}
//-----------------------------------------
switch($ibforums->input['code'])
{
case 'editpkginfo':
$PLUGIN->edit_pkg_gateway_info();
break;
case 'doeditpkg':
$PLUGIN->doedit_pkg_gateway_info();
break;
//-----------------------------------------
case 'removepackage':
$PLUGIN->remove_package();
break;
case 'doremovepackage':
$PLUGIN->do_remove_package();
break;
//-----------------------------------------
case 'removemembers':
$PLUGIN->remove_members();
break;
case 'doremovemembers':
$PLUGIN->do_remove_members();
break;
//-----------------------------------------
case 'addpackage':
$PLUGIN->alter_package_form('add');
break;
case 'doaddpackage':
$PLUGIN->do_add_package();
break;
//-----------------------------------------
case 'editpackage':
$PLUGIN->alter_package_form('edit');
break;
case 'doeditpackage':
$PLUGIN->do_edit_package();
break;
//-----------------------------------------
case 'editmethod':
$PLUGIN->edit_method();
break;
case 'doeditmethod':
$PLUGIN->do_edit_method();
break;
//-----------------------------------------
case 'dosearch':
$PLUGIN->do_search();
break;
case 'searchlog':
$PLUGIN->do_search_log();
break;
case 'searchlogview':
$PLUGIN->do_search_log_view();
break;
//-----------------------------------------
case 'domodifytrans':
$PLUGIN->do_modify_trans();
break;
case 'dotransdelete':
$PLUGIN->do_delete_trans();
break;
//-----------------------------------------
case 'edittransaction':
$PLUGIN->edit_transaction('edit');
break;
case 'addtransaction':
$PLUGIN->edit_transaction('add');
break;
case 'doedittransaction':
$PLUGIN->save_transaction('edit');
break;
case 'doaddtransaction':
$PLUGIN->save_transaction('add');
break;
case 'overview':
$PLUGIN->do_overview();
break;
//-----------------------------------------
case 'currency':
$PLUGIN->currency_index();
break;
case 'editcurrency':
$PLUGIN->currency_edit();
break;
case 'deletecurrency':
$PLUGIN->currency_delete();
break;
default:
$PLUGIN->index_screen();
break;
}
}
}
?>
+843
View File
@@ -0,0 +1,843 @@
<?php
/*
+--------------------------------------------------------------------------
| Invision Power Board v2.0.0
| =============================================
| by Matthew Mecham
| (c) 2001 - 2004 Invision Power Services, Inc.
| http://www.invisionpower.com
| =============================================
| Web: http://www.invisionboard.com
| Time: Tue, 21 Sep 2004 16:34:28 GMT
| Release: 150aa7a702c3c8b6f6eb90ad49305d2f
| Licence Info: http://www.invisionboard.com/?license
+---------------------------------------------------------------------------
|
| > Task Manager
| > Module written by Matt Mecham
| > Date started: 27th January 2004
|
| > Module Version Number: 1.0.0
| > DBA Checked: Tue 25th May 2004
+--------------------------------------------------------------------------
*/
if ( ! defined( 'IN_ACP' ) )
{
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded 'admin.php'.";
exit();
}
class ad_task_manager {
var $functions = "";
function auto_run()
{
global $ibforums, $DB, $std;
//-----------------------------------------
// Require and RUN !! THERES A BOMB
//-----------------------------------------
require_once( ROOT_PATH.'sources/lib/task_functions.php' );
$this->functions = new task_functions();
$ibforums->admin->page_detail = "The task manager contains all your scheduled tasks.<br />Please note that as these tasks are run when the board is accessed, the next run time is to be used as a guide only and depends on the traffic your board gets.";
$ibforums->admin->page_title = "Task Manager";
//-----------------------------------------
// Kill globals - globals bad, Homer good.
//-----------------------------------------
$tmp_in = array_merge( $_GET, $_POST, $_COOKIE );
foreach ( $tmp_in as $k => $v )
{
unset($$k);
}
$ibforums->admin->nav[] = array( 'act=task', 'Task Manager Home' );
//-----------------------------------------
// What to do...
//-----------------------------------------
switch($ibforums->input['code'])
{
case 'edit':
$this->task_form('edit');
break;
case 'doedittask':
$this->do_save('edit');
break;
case 'addtask':
$this->task_form('add');
break;
case 'doaddtask':
$this->do_save('add');
break;
case 'delete':
$this->delete_task();
break;
case 'run':
$this->run_task();
break;
case 'log':
$this->task_log_setup();
break;
case 'showlog':
$this->task_log_show();
break;
case 'deletelog':
$this->task_log_delete();
break;
default:
$this->show_tasks();
break;
}
}
//-----------------------------------------
// TASK LOG DELETE
//-----------------------------------------
function task_log_delete()
{
global $ibforums, $DB, $std;
//-----------------------------------------
// SHOW 'EM
//-----------------------------------------
$prune = $ibforums->input['task_prune'] ? $ibforums->input['task_prune'] : 30;
$prune = time() - ( $prune * 86400 );
if ( $ibforums->input['task_id'] != -1 )
{
$where = "task_title='".$ibforums->input['task_id']."' AND log_date < $prune";
}
else
{
$where = "log_date < $prune";
}
$DB->simple_exec_query( array( 'delete' => 'task_logs', 'where' => $where ) );
$ibforums->main_msg = 'Selected Task Logs Removed';
$this->task_log_setup();
}
//-----------------------------------------
// TASK LOG SHOW
//-----------------------------------------
function task_log_show()
{
global $ibforums, $DB, $std;
//-----------------------------------------
// SHOW 'EM
//-----------------------------------------
$limit = $ibforums->input['task_count'] ? $ibforums->input['task_count'] : 30;
$limit = $limit > 150 ? 150 : $limit;
if ( $ibforums->input['task_id'] != -1 )
{
$DB->simple_construct( array( 'select' => '*', 'from' => 'task_logs', 'where' => "log_title='".$ibforums->input['task_id']."'", 'order' => 'log_date DESC', 'limit' => '0,'.$limit ) );
}
else
{
$DB->simple_construct( array( 'select' => '*', 'from' => 'task_logs', 'order' => 'log_date DESC', 'limit' => '0,'.$limit ) );
}
$DB->simple_exec();
$ibforums->adskin->td_header[] = array( "Task Run" , "20%" );
$ibforums->adskin->td_header[] = array( "Date Run" , "35%" );
$ibforums->adskin->td_header[] = array( "Log Info" , "45%" );
$ibforums->html .= $ibforums->adskin->start_table( "Selected Task Logs" );
if ( $DB->get_num_rows() )
{
while ( $row = $DB->fetch_row() )
{
$ibforums->html .= $ibforums->adskin->add_td_row( array( "<b>{$row['log_title']}</b>",
$ibforums->admin->get_date( $row['log_date'], 'SHORT' ),
"{$row['log_desc']}",
) );
}
}
else
{
$ibforums->html .= $ibforums->adskin->add_td_basic("<center>No results</center>");
}
$ibforums->html .= $ibforums->adskin->end_table();
$ibforums->admin->output();
}
//-----------------------------------------
// TASK LOG START
//-----------------------------------------
function task_log_setup()
{
global $ibforums, $DB, $std;
//-----------------------------------------
// Some set up
//-----------------------------------------
$tasks = array( 0 => array( -1, 'All tasks' ) );
$DB->simple_construct( array( 'select' => '*', 'from' => 'task_manager', 'order' => 'task_title' ) );
$DB->simple_exec();
while ( $pee = $DB->fetch_row() )
{
$tasks[] = array( $pee['task_title'], $pee['task_title'] );
}
//-----------------------------------------
// LAST FIVE ACTIONS
//-----------------------------------------
$DB->simple_construct( array( 'select' => '*', 'from' => 'task_logs', 'order' => 'log_date DESC', 'limit' => array(0,5) ) );
$DB->simple_exec();
$ibforums->adskin->td_header[] = array( "Task Run" , "20%" );
$ibforums->adskin->td_header[] = array( "Date Run" , "35%" );
$ibforums->adskin->td_header[] = array( "Log Info" , "45%" );
$ibforums->html .= $ibforums->adskin->start_table( "Last 5 Tasks Run" );
if ( $DB->get_num_rows() )
{
while ( $row = $DB->fetch_row() )
{
$ibforums->html .= $ibforums->adskin->add_td_row( array( "<b>{$row['log_title']}</b>",
$ibforums->admin->get_date( $row['log_date'], 'SHORT' ),
"{$row['log_desc']}",
) );
}
}
else
{
$ibforums->html .= $ibforums->adskin->add_td_basic("<center>No results</center>");
}
$ibforums->html .= $ibforums->adskin->end_table();
//-----------------------------------------
// Show more...
//-----------------------------------------
$ibforums->html .= $ibforums->adskin->start_form( array( 1 => array( 'act' , 'task' ),
2 => array( 'code' , 'showlog' ),
) );
$ibforums->adskin->td_header[] = array( "&nbsp;" , "60%" );
$ibforums->adskin->td_header[] = array( "&nbsp;" , "40%" );
$ibforums->html .= $ibforums->adskin->start_table( "View Task Logs" );
$ibforums->html .= $ibforums->adskin->add_td_row( array( "<b>View logs for task:</b>",
$ibforums->adskin->form_dropdown( 'task_id', $tasks )
) );
$ibforums->html .= $ibforums->adskin->add_td_row( array( "<b>Show how many log entries?</b>",
$ibforums->adskin->form_input( 'task_count', '30' )
) );
$ibforums->html .= $ibforums->adskin->end_form('View Logs');
$ibforums->html .= $ibforums->adskin->end_table();
//-----------------------------------------
// Delete...
//-----------------------------------------
$ibforums->html .= $ibforums->adskin->start_form( array( 1 => array( 'act' , 'task' ),
2 => array( 'code' , 'deletelog' ),
) );
$ibforums->adskin->td_header[] = array( "&nbsp;" , "60%" );
$ibforums->adskin->td_header[] = array( "&nbsp;" , "40%" );
$ibforums->html .= $ibforums->adskin->start_table( "DELETE Task Logs" );
$ibforums->html .= $ibforums->adskin->add_td_row( array( "<b>Delete logs for task:</b>",
$ibforums->adskin->form_dropdown( 'task_id', $tasks )
) );
$ibforums->html .= $ibforums->adskin->add_td_row( array( "<b>Delete logs older than (in days)?</b>",
$ibforums->adskin->form_input( 'task_prune', '30' )
) );
$ibforums->html .= $ibforums->adskin->end_form('DELETE Logs');
$ibforums->html .= $ibforums->adskin->end_table();
$ibforums->admin->output();
}
//-----------------------------------------
// RUN TASK
//-----------------------------------------
function run_task()
{
global $ibforums, $DB, $std;
if ( ! $ibforums->input['id'] )
{
$ibforums->main_msg = 'No ID was passed, cannot save';
$this->show_tasks();
}
$this_task = $DB->simple_exec_query( array( 'select' => '*', 'from' => 'task_manager', 'where' => 'task_id='.$ibforums->input['id'] ) );
if ( ! $this_task['task_id'] )
{
$ibforums->main_msg = 'No task to run.';
$this->show_tasks();
}
if ( ! $this_task['task_enabled'] )
{
$ibforums->main_msg = "This task has been disabled. Please enable the task before running it.";
$this->show_tasks();
}
//-----------------------------------------
// Get new instance of functions
//-----------------------------------------
$func = new task_functions();
$newdate = $func->generate_next_run($this_task);
$DB->do_update( 'task_manager', array( 'task_next_run' => $newdate ), "task_id=".$this_task['task_id'] );
$func->save_next_run_stamp();
$func->root_path = ROOT_PATH;
if ( file_exists( $func->root_path.'sources/tasks/'.$this_task['task_file'] ) )
{
require_once( $func->root_path.'sources/tasks/'.$this_task['task_file'] );
$myobj = new task_item();
$myobj->register_class( $func );
$myobj->pass_task( $this_task );
$myobj->run_task();
$ibforums->main_msg = 'Task run successfully';
$this->show_tasks();
}
else
{
$ibforums->main_msg = 'Cannot locate: '.$func->root_path.'sources/tasks/'.$this_task['task_file'];
$this->show_tasks();
}
}
//-----------------------------------------
// DELETE TASK
//-----------------------------------------
function delete_task()
{
global $ibforums, $DB, $std;
if ( ! $ibforums->input['id'] )
{
$ibforums->main_msg = 'No ID was passed, cannot save';
$this->show_tasks();
}
$DB->simple_exec_query( array( 'delete' => 'task_manager', 'where' => 'task_id='.$ibforums->input['id'] ) );
$this->functions->save_next_run_stamp();
$ibforums->main_msg = 'Task deleted';
$this->show_tasks();
}
//-----------------------------------------
// DO SAVE
//-----------------------------------------
function do_save($type='edit')
{
global $ibforums, $DB, $std;
if ( $type == 'edit' )
{
if ( ! $ibforums->input['id'] )
{
$ibforums->main_msg = 'No ID was passed, cannot save';
$this->task_form();
}
}
if ( ! $ibforums->input['task_title'] )
{
$ibforums->main_msg = 'You must enter a task title.';
$this->task_form();
}
if ( ! $ibforums->input['task_file'] )
{
$ibforums->main_msg = 'You must enter a filename for this task to run';
$this->task_form();
}
//-----------------------------------------
// Compile task
//-----------------------------------------
$save = array( 'task_title' => $ibforums->input['task_title'],
'task_description' => $ibforums->input['task_description'],
'task_file' => $ibforums->input['task_file'],
'task_week_day' => $ibforums->input['task_week_day'],
'task_month_day' => $ibforums->input['task_month_day'],
'task_hour' => $ibforums->input['task_hour'],
'task_minute' => $ibforums->input['task_minute'],
'task_log' => $ibforums->input['task_log'],
'task_cronkey' => $ibforums->input['task_cronkey'] ? $ibforums->input['task_cronkey'] : md5(microtime()),
'task_enabled' => $ibforums->input['task_enabled'],
'task_key' => $ibforums->input['task_key'],
'task_safemode' => $ibforums->input['task_safemode'],
);
//-----------------------------------------
// Get next run date...
//-----------------------------------------
$save['task_next_run'] = $this->functions->generate_next_run( $save );
if ( $type == 'edit' )
{
$DB->do_update( 'task_manager', $save, 'task_id='.$ibforums->input['id'] );
$ibforums->main_msg = 'Task Edited Successfully';
}
else
{
$DB->do_insert( 'task_manager', $save );
$ibforums->main_msg = 'Task Saved Successfully';
}
$this->functions->save_next_run_stamp();
$this->show_tasks();
}
//-----------------------------------------
// EDIT TASK
//-----------------------------------------
function task_form($type='edit')
{
global $ibforums, $DB, $std;
if ( $type == 'edit' )
{
//-----------------------------------------
// Get task
//-----------------------------------------
$id = intval($ibforums->input['id']);
$this_task = $DB->simple_exec_query( array( 'select' => '*', 'from' => 'task_manager', 'where' => 'task_id='.$id ) );
$button = 'Edit this task';
$code = 'doedittask';
$title = 'Editing task: '.$this_task['task_title'];
}
else
{
$this_task = array();
$button = 'Add this task';
$code = 'doaddtask';
$title = 'Adding a new task';
}
//-----------------------------------------
// Create drop downs
//-----------------------------------------
$dd_minute = array( 0 => array( '-1', 'Every Minute' ) );
$dd_hour = array( 0 => array( '-1', 'Every Hour' ), 1 => array( '0', '0 - Midnight' ) );
$dd_wday = array( 0 => array( '-1', 'Every Week Day' ) );
$dd_mday = array( 0 => array( '-1', 'Every Day of the Month' ) );
$dd_month = array( 0 => array( '-1', 'Every Month' ) );
for( $i = 0 ; $i < 60; $i++ )
{
$dd_minute[] = array( $i, $i );
}
for( $i = 1 ; $i < 24; $i++ )
{
if ( $i < 12 )
{
$ampm = $i.' am';
}
else if ( $i == 12 )
{
$ampm = 'Midday';
}
else
{
$ampm = $i - 12 . ' pm';
}
$dd_hour[] = array( $i, $i. ' - ('.$ampm.')' );
}
for( $i = 1 ; $i < 32; $i++ )
{
$dd_mday[] = array( $i, $i );
}
$dd_wday[] = array( '0', 'Sunday' );
$dd_wday[] = array( '1', 'Monday' );
$dd_wday[] = array( '2', 'Tuesday' );
$dd_wday[] = array( '3', 'Wednesday' );
$dd_wday[] = array( '4', 'Thursday' );
$dd_wday[] = array( '5', 'Friday' );
$dd_wday[] = array( '6', 'Saturday' );
//-----------------------------------------
// START FORM
//-----------------------------------------
$ibforums->html .= $ibforums->adskin->start_form( array( 1 => array( 'act' , 'task' ),
2 => array( 'code' , $code ),
3 => array( 'id' , $id ),
4 => array( 'task_cronkey', $this_task['task_cronkey'] ),
) );
$ibforums->html .= "<script type='text/javascript' language='javascript'>
function updatepreview()
{
var formobj = document.theAdminForm;
var dd_wday = new Array();
dd_wday[0] = 'Sunday';
dd_wday[1] = 'Monday';
dd_wday[2] = 'Tuesday';
dd_wday[3] = 'Wednesday';
dd_wday[4] = 'Thursday';
dd_wday[5] = 'Friday';
dd_wday[6] = 'Saturday';
var output = '';
chosen_min = formobj.task_minute.options[formobj.task_minute.selectedIndex].value;
chosen_hour = formobj.task_hour.options[formobj.task_hour.selectedIndex].value;
chosen_wday = formobj.task_week_day.options[formobj.task_week_day.selectedIndex].value;
chosen_mday = formobj.task_month_day.options[formobj.task_month_day.selectedIndex].value;
var output_min = '';
var output_hour = '';
var output_day = '';
var timeset = 0;
if ( chosen_mday == -1 && chosen_wday == -1 )
{
output_day = '';
}
if ( chosen_mday != -1 )
{
output_day = 'On day '+chosen_mday+'.';
}
if ( chosen_mday == -1 && chosen_wday != -1 )
{
output_day = 'On ' + dd_wday[ chosen_wday ]+'.';
}
if ( chosen_hour != -1 && chosen_min != -1 )
{
output_hour = 'At '+chosen_hour+':'+formatnumber(chosen_min)+'.';
}
else
{
if ( chosen_hour == -1 )
{
if ( chosen_min == 0 )
{
output_hour = 'On every hour';
}
else
{
if ( output_day == '' )
{
if ( chosen_min == -1 )
{
output_min = 'Every minute';
}
else
{
output_min = 'Every '+chosen_min+' minutes.';
}
}
else
{
output_min = 'At '+formatnumber(chosen_min)+' minutes past the first available hour';
}
}
}
else
{
if ( output_day != '' )
{
output_hour = 'At ' + chosen_hour + ':00';
}
else
{
output_hour = 'Every ' + chosen_hour + ' hours';
}
}
}
output = output_day + ' ' + output_hour + ' ' + output_min;
formobj.showtask.value = output;
}
function formatnumber(num)
{
if ( num == -1 )
{
return '00';
}
if ( num < 10 )
{
return '0'+num;
}
else
{
return num;
}
}
</script>";
$input = "<input type='text' name='showtask' class='realbutton' size='50' style='font-size:10px;width:auto;font-weight:normal'/>";
$ibforums->adskin->td_header[] = array( "&nbsp;" , "60%" );
$ibforums->adskin->td_header[] = array( "&nbsp;" , "40%" );
$ibforums->html .= $ibforums->adskin->start_table( "<table width='100%' border='0'><tr><td width='100%' style='color:white;font-size:11px'><b>$title</b></td><td width='1%' nowrap='nowrap'>$input</td></tr></table>" );
$ibforums->html .= $ibforums->adskin->add_td_row( array( "<strong>Task Title</strong>",
$ibforums->adskin->form_input( 'task_title', $_POST['task_title'] ? $_POST['task_title'] : $this_task['task_title'] )
) );
$ibforums->html .= $ibforums->adskin->add_td_row( array( "<strong>Task Short Description</strong>",
$ibforums->adskin->form_input( 'task_description', $_POST['task_description'] ? $_POST['task_description'] : $this_task['task_description'] )
) );
$ibforums->html .= $ibforums->adskin->add_td_row( array( "<strong>Task PHP File To Run</strong><div style='color:gray'>This is the PHP file that is run when the task is run.</div>",
"./sources/tasks/ ".$ibforums->adskin->form_simple_input( 'task_file', $_POST['task_file'] ? $_POST['task_file'] : $this_task['task_file'], '20' )
) );
$ibforums->html .= $ibforums->adskin->add_td_row( array( "<strong>Task Time: Minutes</strong><div style='color:gray'>Choose 'Every Minute' to run each minute or a number for a specific minute of an hour</div>",
$ibforums->adskin->form_dropdown( 'task_minute', $dd_minute, $_POST['task_minute'] ? $_POST['task_minute'] : $this_task['task_minute'], 'onchange="updatepreview()"' )
) );
$ibforums->html .= $ibforums->adskin->add_td_row( array( "<strong>Task Time: Hours</strong><div style='color:gray'>Choose 'Every Hour' to run each hour or a number for a specific hour of a day</div>",
$ibforums->adskin->form_dropdown( 'task_hour', $dd_hour, $_POST['task_hour'] ? $_POST['task_hour'] : $this_task['task_hour'], 'onchange="updatepreview()"' )
) );
$ibforums->html .= $ibforums->adskin->add_td_row( array( "<strong>Task Time: Week Day</strong><div style='color:gray'>Choose 'Every Day' to run each day or a week day for a specific week day of a month</div>",
$ibforums->adskin->form_dropdown( 'task_week_day', $dd_wday, $_POST['task_week_day'] ? $_POST['task_week_day'] : $this_task['task_week_day'], 'onchange="updatepreview()"' )
) );
$ibforums->html .= $ibforums->adskin->add_td_row( array( "<strong>Task Time: Month Day</strong><div style='color:gray'>Choose 'Every Day' to run each day or a month day for a specific month day of a month</div>",
$ibforums->adskin->form_dropdown( 'task_month_day', $dd_mday, $_POST['task_month_day'] ? $_POST['task_month_day'] : $this_task['task_month_day'], 'onchange="updatepreview()"' )
) );
$ibforums->html .= $ibforums->adskin->add_td_row( array( "<strong>Enable Task Logging</strong><div style='color:gray'>Will write to the task log each time the task is run, not recommended for regular tasks run every few minutes.</div>",
$ibforums->adskin->form_yes_no( 'task_log', $_POST['task_log'] ? $_POST['task_log'] : $this_task['task_log'] )
) );
$ibforums->html .= $ibforums->adskin->add_td_row( array( "<strong>Enable Task?</strong><div style='color:gray'>If you are using CRON, you might wish to disable this task from the internal manager.</div>",
$ibforums->adskin->form_yes_no( 'task_enabled', $_POST['task_enabled'] ? $_POST['task_enabled'] : $this_task['task_enabled'] )
) );
if ( IN_DEV )
{
$ibforums->html .= $ibforums->adskin->add_td_row( array( "<strong>Task Key</strong><div style='color:gray'>This is used to call a task where the ID of the task might change</div>",
$ibforums->adskin->form_input( 'task_key', $_POST['task_key'] ? $_POST['task_key'] : $this_task['task_key'] )
) );
$ibforums->html .= $ibforums->adskin->add_td_row( array( "<strong>Task Safe Mode</strong><div style='color:gray'>If set to 'yes', this will not be editable by admins</div>",
$ibforums->adskin->form_yes_no( 'task_safemode', $_POST['task_safemode'] ? $_POST['task_safemode'] : $this_task['task_safemode'] )
) );
}
$ibforums->html .= $ibforums->adskin->end_table();
$ibforums->html .= "<div style='tableborder'><div align='center' class='pformstrip'><input type='submit' value='$button' class='realdarkbutton' /></div>
</form>";
//-----------------------------------------
$ibforums->admin->output();
}
//-----------------------------------------
// SHOW TASKS
//-----------------------------------------
function show_tasks()
{
global $ibforums, $DB, $std;
//-----------------------------------------
// REBUILD CACHES
//-----------------------------------------
$ibforums->html .= $ibforums->adskin->js_checkdelete("Are you sure you wish to remove this task?");
$ibforums->html .= $ibforums->adskin->start_form( array( 1 => array( 'act' , 'task' ),
2 => array( 'code' , 'addtask' ),
) );
$ibforums->adskin->td_header[] = array( "Title" , "40%" );
$ibforums->adskin->td_header[] = array( "Next Run" , "25%" );
$ibforums->adskin->td_header[] = array( "Min" , "5%" );
$ibforums->adskin->td_header[] = array( "Hour" , "5%" );
$ibforums->adskin->td_header[] = array( "MDay" , "5%" );
$ibforums->adskin->td_header[] = array( "WDay" , "5%" );
$ibforums->adskin->td_header[] = array( "Options" , "25%" );
$ibforums->html .= $ibforums->adskin->start_table( "Your scheduled tasks" );
$DB->simple_construct( array( 'select' => '*', 'from' => 'task_manager', 'order' => 'task_safemode, task_next_run' ) );
$DB->simple_exec();
while ( $row = $DB->fetch_row() )
{
$row['task_minute'] = $row['task_minute'] != '-1' ? $row['task_minute'] : '-';
$row['task_hour'] = $row['task_hour'] != '-1' ? $row['task_hour'] : '-';
$row['task_month_day'] = $row['task_month_day'] != '-1' ? $row['task_month_day'] : '-';
$row['task_week_day'] = $row['task_week_day'] != '-1' ? $row['task_week_day'] : '-';
if ( time() > $row['task_next_run'] )
{
$image = 'task_run_now.gif';
}
else
{
$image= 'task_run.gif';
}
$class = "";
$title = "";
$next_run = gmdate( 'jS F Y - h:i A', $row['task_next_run'] );
if ( $row['task_enabled'] != 1 )
{
$class = " style='color:gray'";
$title = " (Disabled)";
$next_run = "<span style='color:gray'><s>$next_run</s></span>";
}
if ( $row['task_safemode'] and ! IN_DEV )
{
$deletebutton = '--';
$editbutton = '--';
}
else
{
$deletebutton = "<input type='button' class='realdarkbutton' value='Delete' onclick='checkdelete(\"act=task&code=delete&id={$row['task_id']}\")' />";
$editbutton = $ibforums->adskin->js_make_button( 'Edit' , $ibforums->base_url.'&act=task&code=edit&id='.$row['task_id'], 'realbutton' );
}
$ibforums->html .= $ibforums->adskin->add_td_row( array( "<table cellpadding='0' cellspacing='0' border='0' width='100%'>
<tr>
<td width='99%'>
<strong{$class}>{$row['task_title']}{$title}</strong><div style='color:gray'><em>{$row['task_description']}</em></div>
<div align='center' style='position:absolute;width:auto;display:none;text-align:center;background:#EEE;border:2px outset #555;padding:4px' id='pop{$row['task_id']}'>
curl -s -o /dev/null {$ibforums->vars['board_url']}/index.{$ibforums->vars['php_ext']}?act=task&amp;ck={$row['task_cronkey']}
</div>
</td>
<td width='1%' nowrap='nowrap'>
<a href='#' onclick=\"toggleview('pop{$row['task_id']}')\" title='Show CURL to use in a cron'><img src='{$ibforums->skin_url}/task_cron.gif' border='0' alt='Cron' /></a>
<a href='{$ibforums->base_url}&act=task&code=run&id={$row['task_id']}' title='Run task now (id: {$row['task_id']})'><img src='{$ibforums->skin_url}/$image' border='0' alt='Run' /></a>
</td>
</tr>
</table>",
"<center>". $next_run ."</center>",
"<center>".$row['task_minute'] ."</center>",
"<center>".$row['task_hour'] ."</center>",
"<center>".$row['task_month_day']."</center>",
"<center>".$row['task_week_day'] ."</center>",
"<center>{$editbutton} {$deletebutton}</center>"
) );
}
$ibforums->html .= $ibforums->adskin->end_form("Add a new task");
$ibforums->html .= $ibforums->adskin->end_table();
$std->offset_set = 0;
$ibforums->html .= "<div align='center'><em>All times GMT. GMT time now is: ".gmdate( 'jS F Y - h:i A' )."</em></div>";
//-----------------------------------------
//-------------------------------
$ibforums->admin->output();
}
}
?>
File diff suppressed because it is too large. Load diff
+212
View File
@@ -0,0 +1,212 @@
<?php
/*
+--------------------------------------------------------------------------
| Invision Power Board v2.0.0
| ========================================
| 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: Warning Functions
| > Module written by Matt Mecham
| > Date started: 23rd April 2003
|
| > Module Version Number: 1.0.0
+--------------------------------------------------------------------------
*/
if ( ! defined( 'IN_ACP' ) )
{
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded 'admin.php'.";
exit();
}
class ad_warn {
var $base_url;
function auto_run()
{
global $ibforums, $DB, $std, $ibforums;
//-----------------------------------------
// Kill globals - globals bad, Homer good.
//-----------------------------------------
$tmp_in = array_merge( $_GET, $_POST, $_COOKIE );
foreach ( $tmp_in as $k => $v )
{
unset($$k);
}
$ibforums->admin->nav[] = array( 'act=warn', 'Warning Set-up' );
$ibforums->admin->page_detail = "This section will allow you to modify your warning parameters";
$ibforums->admin->page_title = "Member Warning Set-up";
//-----------------------------------------
switch($ibforums->input['code'])
{
//-----------------------------------------
default:
$this->overview();
break;
}
}
//-----------------------------------------
//
// Overview: show um.. overview.
//
//-----------------------------------------
function overview()
{
global $ibforums, $DB, $std, $ibforums;
$unit_map = array(
'd' => 'Day(s)' ,
'h' => 'Hour(s)',
);
$ibforums->adskin->td_header[] = array( "Warn Level" , "20%" );
$ibforums->adskin->td_header[] = array( "Details" , "80%" );
$ibforums->html .= $ibforums->adskin->start_table( "Currently active Auto tasks" );
$warns = array();
$DB->query("SELECT * from ibf_warn_settings ORDER BY warn_level");
while ( $r = $DB->fetch_row() )
{
$warns[ $r['warn_level'] ][] = $r;
}
if ( count($warns) > 0 )
{
foreach( $warns as $id => $data )
{
$tmp = "";
$ban = "";
$mod = "";
$nop = "";
if ( $data['warn_ban'] != "" )
{
if ( $data['warn_ban'] == 'p' )
{
$ban = "Permanent Ban";
}
else
{
list ($val, $unit) = explode( ',', $data['warn_ban'] );
$ban = "Temporary suspension for ".$val." ".$unit_map[$unit];
}
}
if ( $data['warn_modq'] != "" )
{
if ( $data['warn_modq'] == 'p' )
{
$mod = "Permanent post moderation";
}
else
{
list ($val, $unit) = explode( ',', $data['warn_modq'] );
$mod = "Require post moderation for ".$val." ".$unit_map[$unit];
}
}
if ( $data['warn_nopost'] != "" )
{
if ( $data['warn_nopost'] == 'p' )
{
$nop = "Permanent post banning";
}
else
{
list ($val, $unit) = explode( ',', $data['warn_nopost'] );
$nop = "Post ban for ".$val." ".$unit_map[$unit];
}
}
$html = "<table width='100%' cellpadding='4'>";
if ( $ban != "" )
{
$html .= "<tr>
<td width='20%'><strong>Ban</strong></td>
<td width='30%'>$ban</td>
<td width='25%'>Edit</td>
<td width='25%'>Remove</td>
</tr>";
}
if ( $mod != "" )
{
$html .= "<tr>
<td width='20%'><strong>Post Moderation</strong></td>
<td width='30%'>$mod</td>
<td width='25%'>Edit</td>
<td width='25%'>Remove</td>
</tr>";
}
if ( $nop != "" )
{
$html .= "<tr>
<td width='20%'><strong>Post Ban</strong></td>
<td width='30%'>$nop</td>
<td width='25%'>Edit</td>
<td width='25%'>Remove</td>
</tr>";
}
$html .= "</table>";
$ibforums->html .= $ibforums->adskin->add_td_row( array( "<b>{$warns['warn_level']}</b>",
$html
) );
}
}
$ibforums->html .= $ibforums->adskin->add_td_basic( 'Add new auto task', 'center', 'pformstrip' );
$ibforums->html .= $ibforums->adskin->end_table();
//-----------------------------------------
//-------------------------------
$ibforums->admin->output();
}
}
?>
+527
View File
@@ -0,0 +1,527 @@
<?php
/*
+--------------------------------------------------------------------------
| Invision Power Board v2.0.0
| =============================================
| by Matthew Mecham
| (c) 2001 - 2004 Invision Power Services, Inc.
| http://www.invisionpower.com
| =============================================
| Web: http://www.invisionboard.com
| Time: Tue, 21 Sep 2004 16:34:28 GMT
| Release: 150aa7a702c3c8b6f6eb90ad49305d2f
| Licence Info: http://www.invisionboard.com/?license
+---------------------------------------------------------------------------
|
| > Warn Log functions
| > Module written by Matt Mecham
| > Date started: 4th June 2003
|
| > Module Version Number: 1.0.0
| > DBA Checked: Tue 25th May 2004
+--------------------------------------------------------------------------
*/
if ( ! defined( 'IN_ACP' ) )
{
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded 'admin.php'.";
exit();
}
class ad_warnlogs {
var $base_url;
function auto_run()
{
global $ibforums, $DB, $std;
//-----------------------------------------
// Kill globals - globals bad, Homer good.
//-----------------------------------------
$tmp_in = array_merge( $_GET, $_POST, $_COOKIE );
foreach ( $tmp_in as $k => $v )
{
unset($$k);
}
//-----------------------------------------
switch($ibforums->input['code'])
{
case 'view':
$this->view();
break;
case 'viewcontact':
$this->view_contact();
break;
case 'viewnote':
$this->view_note();
break;
case 'remove':
$this->remove();
break;
//-----------------------------------------
default:
$this->list_current();
break;
}
}
//-----------------------------------------
// View NOTE in da pop up innit
//-----------------------------------------
function view_note()
{
global $ibforums, $DB, $std;
if ($ibforums->input['id'] == "")
{
$ibforums->admin->error("Could not resolve the email ID, please try again");
}
require( ROOT_PATH.'sources/lib/post_parser.php');
$this->parser = new post_parser(1);
$id = intval($ibforums->input['id']);
$DB->cache_add_query( 'warnlogs_view_note', array( 'id' => $id ) );
$DB->cache_exec_query();
if ( ! $row = $DB->fetch_row() )
{
$ibforums->admin->error("Could not resolve the email ID, please try again ($id)");
}
$ibforums->adskin->td_header[] = array( "&nbsp;" , "100%" );
$content = preg_match( "#<content>(.+?)</content>#is", $row['wlog_notes'], $cont );
$ibforums->html .= $ibforums->adskin->start_table( "Warn Notes" );
$row['date'] = $ibforums->admin->get_date( $row['wlog_date'], 'LONG' );
$text = $this->parser->convert( array(
'TEXT' => $cont[1],
'SMILIES' => 1,
'CODE' => 1,
'HTML' => 0
) );
$ibforums->html .= $ibforums->adskin->add_td_row( array(
"<strong>From:</strong> {$row['p_name']}
<br /><strong>To:</strong> {$row['a_name']}
<br /><strong>Sent:</strong> {$row['date']}
<hr>
<br />$text
"
) );
$ibforums->html .= $ibforums->adskin->end_table();
$ibforums->admin->print_popup();
}
//-----------------------------------------
// View contact in da pop up innit
//-----------------------------------------
function view_contact()
{
global $ibforums, $DB, $std;
if ($ibforums->input['id'] == "")
{
$ibforums->admin->error("Could not resolve the email ID, please try again");
}
$id = intval($ibforums->input['id']);
$DB->cache_add_query( 'warnlogs_view_note', array( 'id' => $id ) );
$DB->cache_exec_query();
if ( ! $row = $DB->fetch_row() )
{
$ibforums->admin->error("Could not resolve the email ID, please try again ($id)");
}
$type = $row['wlog_contact'] == 'pm' ? "PM" : "EMAIL";
$ibforums->adskin->td_header[] = array( "&nbsp;" , "100%" );
$subject = preg_match( "#<subject>(.+?)</subject>#is", $row['wlog_contact_content'], $subj );
$content = preg_match( "#<content>(.+?)</content>#is", $row['wlog_contact_content'], $cont );
$ibforums->html .= $ibforums->adskin->start_table( $type.": ".$subj[1] );
$row['date'] = $ibforums->admin->get_date( $row['wlog_date'], 'LONG' );
$ibforums->html .= $ibforums->adskin->add_td_row( array(
"<strong>From:</strong> {$row['p_name']}
<br /><strong>To:</strong> {$row['a_name']}
<br /><strong>Sent:</strong> {$row['date']}
<br /><strong>Subject:</strong> $subj[1]
<hr>
<br />$cont[1]
"
) );
$ibforums->html .= $ibforums->adskin->end_table();
$ibforums->admin->print_popup();
}
//-----------------------------------------
// Remove archived files
//-----------------------------------------
function view()
{
global $ibforums, $DB, $std;
$start = $ibforums->input['st'] ? $ibforums->input['st'] : 0;
$ibforums->html .= $ibforums->adskin->js_pop_win();
$ibforums->admin->page_detail = "Viewing all warn entries on a member";
$ibforums->admin->page_title = "Warn Logs Manager";
if ($ibforums->input['search_string'] == "" and $ibforums->input['mid'])
{
$DB->simple_construct( array( 'select' => 'COUNT(wlog_id) as count', 'from' => 'warn_logs', 'where' => "wlog_mid='".$ibforums->input['mid']."'" ) );
$DB->simple_exec();
$row = $DB->fetch_row();
$row_count = $row['count'];
$query = "&act=warnlog&mid={$ibforums->input['mid']}&code=view";
$DB->cache_add_query( 'warnlogs_view', array( 'mid' => $ibforums->input['mid'], 'start' => $start ) );
$DB->cache_exec_query();
}
else
{
$ibforums->input['search_string'] = urldecode($ibforums->input['search_string']);
if ( ($ibforums->input['search_type'] == 'notes') )
{
$dbq = "l.wlog_notes LIKE '%".$ibforums->input['search_string']."%'";
}
else
{
$dbq = "l.wlog_contact_content LIKE '%".$ibforums->input['search_string']."%'";
}
$DB->simple_construct( array( 'select' => 'COUNT(l.wlog_id) as count', 'from' => 'warn_logs l', 'where' => $dbq ) );
$DB->simple_exec();
$row = $DB->fetch_row();
$row_count = $row['count'];
$query = "&act=warnlog&code=view&search_type={$ibforums->input['search_type']}&search_string=".urlencode($ibforums->input['search_string']);
$DB->cache_add_query( 'warnlogs_view_two', array( 'dbq' => $dbq, 'start' => $start ) );
$DB->cache_exec_query();
}
$links = $std->build_pagelinks( array( 'TOTAL_POSS' => $row_count,
'PER_PAGE' => 30,
'CUR_ST_VAL' => $start,
'L_SINGLE' => "Single Page",
'L_MULTI' => "Pages: ",
'BASE_URL' => $ibforums->base_url.$query,
)
);
$ibforums->admin->page_detail = "You may view warn entries added by your moderators";
$ibforums->admin->page_title = "Warn Logs Manager";
//-----------------------------------------
$ibforums->adskin->td_header[] = array( "Type" , "5%" );
$ibforums->adskin->td_header[] = array( "Member Name" , "15%" );
$ibforums->adskin->td_header[] = array( "Contacted" , "5%" );
$ibforums->adskin->td_header[] = array( "MOD Q" , "10%" );
$ibforums->adskin->td_header[] = array( "SUSP" , "10%" );
$ibforums->adskin->td_header[] = array( "NO POST" , "10%" );
$ibforums->adskin->td_header[] = array( "Date" , "15%" );
$ibforums->adskin->td_header[] = array( "Warned By" , "15%" );
$ibforums->adskin->td_header[] = array( "View Note" , "10%" );
$ibforums->html .= $ibforums->adskin->start_table( "Saved Warn Logs" );
$ibforums->html .= $ibforums->adskin->add_td_basic($links, 'right', 'pformstrip');
$days = array( 'd' => "Days", 'h' => "Hours" );
if ( $DB->get_num_rows() )
{
while ( $row = $DB->fetch_row() )
{
$row['wlog_date'] = $ibforums->admin->get_date( $row['wlog_date'], 'LONG' );
$type = ( $row['wlog_type'] == 'pos' ) ? '<span style="color:green;font-weight:bold">-</span>' : '<span style="color:red;font-weight:bold">+</span>';
$cont = ( $row['wlog_contact'] != 'none' ) ? "<center><a href='javascript:pop_win(\"&act=warnlog&code=viewcontact&id={$row['wlog_id']}\",400,400)'>View</a></center>" : '&nbsp;';
$mod = preg_match( "#<mod>(.+?)</mod>#is" , $row['wlog_notes'], $mm );
$post = preg_match( "#<post>(.+?)</post>#is" , $row['wlog_notes'], $pm );
$susp = preg_match( "#<susp>(.+?)</susp>#is" , $row['wlog_notes'], $sm );
$content = preg_match( "#<content>(.+?)</content>#is", $row['wlog_notes'], $cm );
$content = $cm[1];
$mod = trim($mm[1]);
$post = trim($pm[1]);
$susp = trim($sm[1]);
list($v, $u, $i) = explode(',', $mod);
if ( $i == 1 )
{
$mod = 'INDEF';
}
else if ( $v == "" )
{
$mod = 'None';
}
else
{
$mod = $v.' '.$days[$u];
}
//-----------------------------------------
list($v, $u, $i) = explode(',', $post);
if ( $i == 1 )
{
$post = 'INDEF';
}
else if ( $v == "" )
{
$post = 'None';
}
else
{
$post = $v.' '.$days[$u];
}
list($v, $u) = explode(',', $susp);
if ( $v == "" )
{
$susp = 'None';
}
else
{
$susp = $v.' '.$days[$u];
}
//-----------------------------------------
$ibforums->html .= $ibforums->adskin->add_td_row( array(
"<center>$type</center>",
"<b>{$row['a_name']}</b>",
$cont,
$mod,
$susp,
$post,
"{$row['wlog_date']}",
"<b>{$row['p_name']}</b>",
"<center><a href='javascript:pop_win(\"&act=warnlog&code=viewnote&id={$row['wlog_id']}\",400,400)'>View</a></center>"
) );
}
}
else
{
$ibforums->html .= $ibforums->adskin->add_td_basic("<center>No results</center>");
}
$ibforums->html .= $ibforums->adskin->add_td_basic($links, 'right', 'pformstrip');
$ibforums->html .= $ibforums->adskin->end_table();
//-----------------------------------------
//-------------------------------
$ibforums->admin->output();
}
//-----------------------------------------
// Remove archived files
//-----------------------------------------
function remove()
{
global $ibforums, $DB, $std;
if ($ibforums->input['mid'] == "")
{
$ibforums->admin->error("You did not select a member ID to remove by!");
}
$DB->simple_exec_query( array( 'delete' => 'warn_logs', 'where' => "wlog_mid={$ibforums->input['mid']}" ) );
$ibforums->admin->save_log("Removed Warn Logs");
$std->boink_it($ibforums->base_url."&act=warnlog");
}
//-----------------------------------------
// SHOW LOGS
//-----------------------------------------
function list_current()
{
global $ibforums, $DB, $std;
$form_array = array();
$ibforums->admin->page_detail = "You may view and remove warn actions performed by your staff.<br />Note: Removing the logs does not decrease the member's warn level";
$ibforums->admin->page_title = "Warn Logs Manager";
$ibforums->html .= $ibforums->adskin->js_pop_win();
//-----------------------------------------
// VIEW LAST 5
//-----------------------------------------
$DB->cache_add_query( 'warnlogs_list_current', array() );
$DB->cache_exec_query();
$ibforums->adskin->td_header[] = array( "Type" , "5%" );
$ibforums->adskin->td_header[] = array( "Warned Member" , "25%" );
$ibforums->adskin->td_header[] = array( "Contacted?" , "5%" );
$ibforums->adskin->td_header[] = array( "Date" , "25%" );
$ibforums->adskin->td_header[] = array( "Warned By" , "25%" );
$ibforums->html .= $ibforums->adskin->start_table( "Last 10 Warn Entries" );
if ( $DB->get_num_rows() )
{
while ( $row = $DB->fetch_row() )
{
$row['wlog_date'] = $ibforums->admin->get_date( $row['wlog_date'], 'LONG' );
$type = ( $row['wlog_type'] == 'pos' ) ? '<span style="color:green;font-weight:bold">-</span>' : '<span style="color:red;font-weight:bold">+</span>';
$cont = ( $row['wlog_contact'] != 'none' ) ? "<center><a title='Show message' href='javascript:pop_win(\"&act=warnlog&code=viewcontact&id={$row['wlog_id']}\",400,400)'><img src='{$ibforums->adskin->img_url}/acp_check.gif' border='0' alt='X'></a></center>" : '&nbsp;';
$ibforums->html .= $ibforums->adskin->add_td_row( array(
"<center>$type</center>",
"<b>{$row['a_name']}</b>",
$cont,
"{$row['wlog_date']}",
"<b>{$row['p_name']}</b>",
) );
}
}
else
{
$ibforums->html .= $ibforums->adskin->add_td_basic("<center>No results</center>");
}
$ibforums->html .= $ibforums->adskin->end_table();
//-----------------------------------------
$ibforums->adskin->td_header[] = array( "Member Name" , "30%" );
$ibforums->adskin->td_header[] = array( "Times Warned" , "20%" );
$ibforums->adskin->td_header[] = array( "View all by member" , "20%" );
$ibforums->adskin->td_header[] = array( "Remove all by member" , "30%" );
$ibforums->html .= $ibforums->adskin->start_table( "Saved Warn Logs" );
$DB->cache_add_query( 'warnlogs_list_current_two', array() );
$DB->cache_exec_query();
while ( $r = $DB->fetch_row() )
{
$ibforums->html .= $ibforums->adskin->add_td_row( array( "<b>{$r['name']}</b>",
"<center>{$r['act_count']}</center>",
"<center><a href='".$ibforums->adskin->base_url."&act=warnlog&code=view&mid={$r['wlog_mid']}'>View</a></center>",
"<center><a href='".$ibforums->adskin->base_url."&act=warnlog&code=remove&mid={$r['wlog_mid']}'>Remove</a></center>",
) );
}
$ibforums->html .= $ibforums->adskin->end_table();
//-----------------------------------------
//-------------------------------
$ibforums->html .= $ibforums->adskin->start_form( array( 1 => array( 'code' , 'view' ),
2 => array( 'act' , 'warnlog' ),
) );
$ibforums->adskin->td_header[] = array( "&nbsp;" , "40%" );
$ibforums->adskin->td_header[] = array( "&nbsp;" , "60%" );
$ibforums->html .= $ibforums->adskin->start_table( "Search Warn Logs" );
$form_array = array(
0 => array( 'notes' , 'Entry Notes' ),
1 => array( 'contact', 'Email/PM Sent' ),
);
//-----------------------------------------
$ibforums->html .= $ibforums->adskin->add_td_row( array( "<b>Search for...</b>" ,
$ibforums->adskin->form_input( "search_string")
) );
$ibforums->html .= $ibforums->adskin->add_td_row( array( "<b>Search in...</b>" ,
$ibforums->adskin->form_dropdown( "search_type", $form_array)
) );
$ibforums->html .= $ibforums->adskin->end_form("Search");
$ibforums->html .= $ibforums->adskin->end_table();
//-----------------------------------------
//-------------------------------
$ibforums->admin->output();
}
}
?>
+288
View File
@@ -0,0 +1,288 @@
<?php
/*
+--------------------------------------------------------------------------
| Invision Power Board v2.0.0
| =============================================
| by Matthew Mecham
| (c) 2001 - 2004 Invision Power Services, Inc.
| http://www.invisionpower.com
| =============================================
| Web: http://www.invisionboard.com
| Time: Tue, 21 Sep 2004 16:34:28 GMT
| Release: 150aa7a702c3c8b6f6eb90ad49305d2f
| Licence Info: http://www.invisionboard.com/?license
+---------------------------------------------------------------------------
|
| > Help Control functions
| > Module written by Matt Mecham
| > Date started: 2nd April 2002
|
| > Module Version Number: 1.0.0
| > DBA Checked: Tue 25th May 2004
+--------------------------------------------------------------------------
*/
if ( ! defined( 'IN_ACP' ) )
{
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded 'admin.php'.";
exit();
}
class ad_wrappers {
var $base_url;
var $template = "";
var $functions = "";
function auto_run()
{
global $ibforums, $DB, $std;
//-----------------------------------------
// Get the libraries
//-----------------------------------------
require_once( ROOT_PATH.'sources/admin/admin_template_functions.php' );
$this->functions = new admin_template_functions();
//-----------------------------------------
// Kill globals - globals bad, Homer good.
//-----------------------------------------
$tmp_in = array_merge( $_GET, $_POST, $_COOKIE );
foreach ( $tmp_in as $k => $v )
{
unset($$k);
}
//-----------------------------------------
switch($ibforums->input['code'])
{
case 'floateditor':
$this->functions->build_editor_area_floated(1);
break;
case 'edit':
$this->do_form('edit');
break;
case 'doedit':
$this->save_wrapper('edit');
break;
case 'export':
$this->export();
default:
print "No action chosen"; exit();
break;
//case 'wrapper':
// $this->list_wrappers();
// break;
//case 'add':
// $this->add_splash();
// break;
//case 'doadd':
// $this->save_wrapper('add');
// break;
//case 'remove':
// $this->remove();
// break;
}
}
//-----------------------------------------
// ADD / EDIT WRAPPERS
//-----------------------------------------
function save_wrapper( $type='add' )
{
global $ibforums, $DB, $std;
if ($type == 'edit')
{
if ($ibforums->input['id'] == "")
{
$ibforums->admin->error("You must specify an existing wrapper ID, go back and try again");
}
}
if ($ibforums->input['txtwrapper'] == "")
{
$ibforums->admin->error("You can't have an empty template, can you?");
}
$tmpl = $ibforums->admin->form_to_text( $std->txt_stripslashes($_POST['txtwrapper']) );
if ( ! preg_match( "/<% BOARD %>/", $tmpl ) )
{
$ibforums->admin->error("You cannot remove the &lt% BOARD %> tag silly!");
}
if ( ! preg_match( "/<% COPYRIGHT %>/", $tmpl ) )
{
$ibforums->admin->error("You cannot remove the &lt% COPYRIGHT %> tag silly!");
}
$DB->do_update( 'skin_sets', array( 'set_wrapper' => $tmpl ), 'set_skin_set_id='.$ibforums->input['id'] );
$ibforums->cache_func->_recache_wrapper( $ibforums->input['id'] );
//-----------------------------------------
// Done
//-----------------------------------------
if ( ! $ibforums->input['savereload'] )
{
$ibforums->admin->nav[] = array( 'act=sets' ,'Skin Manager Home' );
$ibforums->main_msg = "Board Header and Footer Wrapper Updated";
$ibforums->admin->done_screen("Board Header and Footer Wrapper Updated", "Skin Manager Home", "act=sets", "redirect" );
}
else
{
//-----------------------------------------
// Reload edit window
//-----------------------------------------
$ibforums->main_msg = "Board Header and Footer Wrapper updated";
$this->do_form('edit');
}
}
//-----------------------------------------
// FORM
//-----------------------------------------
function do_form( $type='add' )
{
global $ibforums, $DB, $std;
//-----------------------------------------
// Check input
//-----------------------------------------
if ($ibforums->input['id'] == "")
{
$ibforums->admin->error("You must specify an existing skin set ID, go back and try again");
}
//-----------------------------------------
// check tree...
//-----------------------------------------
$found_id = "";
$found_content = "";
$this_set = "";
if ( $ibforums->input['p'] > 0 )
{
$in = ','.$ibforums->input['p'];
}
//-----------------------------------------
// Query
//-----------------------------------------
$DB->cache_add_query( 'stylesheets_do_form_concat', array( 'id' => $ibforums->input['id'], 'parent' => $in ) );
$DB->cache_exec_query();
//-----------------------------------------
// check tree...
//-----------------------------------------
while( $row = $DB->fetch_row() )
{
if ( $row['set_wrapper'] and ! $found_id )
{
$found_id = $row['set_skin_set_id'];
$found_content = $row['set_wrapper'];
}
if ( $ibforums->input['id'] == $row['set_skin_set_id'] )
{
$this_set = $row;
}
}
if ($type == 'add')
{
$code = 'doadd';
$button = 'Create Wrapper';
}
else
{
$code = 'doedit';
$button = 'Save Wrapper';
}
//-----------------------------------------
// Header
//-----------------------------------------
$ibforums->admin->page_detail = "You may use HTML fully when adding or editing wrappers.";
$ibforums->admin->page_title = "Editing Board Header and Footer Wrapper";
if ( $found_id == 1 )
{
$ibforums->admin->page_detail .= "<br /><strong>This is a copy of the master wrapper, editing it below will copy the changes to a new wrapper unique to this skin set and any children of this set
will inherit this wrapper</strong>";
}
//-----------------------------------------
// Start form
//-----------------------------------------
$ibforums->html .= $ibforums->adskin->js_no_specialchars();
$ibforums->html .= $ibforums->adskin->start_form( array( 1 => array( 'code' , $code ),
2 => array( 'act' , 'wrap' ),
3 => array( 'id' , $ibforums->input['id'] ),
4 => array( 'fid' , $found_id ),
), "theform" );
//-----------------------------------------
// Stop /textarea murdering layout
//-----------------------------------------
$found_content = $ibforums->admin->text_to_form( $found_content );
//-----------------------------------------
// Editor section
//-----------------------------------------
$ibforums->html .= $this->functions->build_generic_editor_area( array( 'act' => 'wrap', 'title' => '', 'textareaname' => 'wrapper', 'textareainput' => $found_content ) );
$formbuttons = "<div align='center' class='pformstrip'>
<input type='submit' name='submit' value='$button' class='realdarkbutton'>
<input type='submit' name='savereload' value='Save and Reload Wrapper' class='realdarkbutton'>
</div></form>\n";
$ibforums->html = str_replace( '<!--IPB.EDITORBOTTOM-->', $formbuttons, $ibforums->html );
$ibforums->html .= $ibforums->adskin->skin_jump_menu_wrap();
//-----------------------------------------
// Output
//-----------------------------------------
$ibforums->admin->nav[] = array( 'act=sets' ,'Skin Manager Home' );
$ibforums->admin->nav[] = array( '' ,'Editing Board Wrapper in set '.$this_set['set_name'] );
$ibforums->admin->output();
}
}
?>
@@ -0,0 +1,939 @@
<?php
/*
+--------------------------------------------------------------------------
| Invision Power Board v2.0.0
| =============================================
| by Matthew Mecham
| (c) 2001 - 2004 Invision Power Services, Inc.
| http://www.invisionpower.com
| =============================================
| Web: http://www.invisionboard.com
| Time: Tue, 21 Sep 2004 16:34:28 GMT
| Release: 150aa7a702c3c8b6f6eb90ad49305d2f
| Licence Info: http://www.invisionboard.com/?license
+---------------------------------------------------------------------------
|
| > Admin Cache functions library
| > Script written by Matt Mecham
| > Date started: 20th January 2004
|
| > DBA Checked: Tue 25th May 2004
+--------------------------------------------------------------------------
*/
class admin_cache_functions
{
var $master_set = 1;
var $messages = array();
var $no_rebuild = 0;
var $template = "";
//-----------------------------------------
// Constructor
//-----------------------------------------
function admin_cache_functions()
{
//-----------------------------------------
// Get the libraries
//-----------------------------------------
require_once( KERNEL_PATH.'class_template.php' );
$this->template = new class_template();
$this->template->root_path = CACHE_PATH;
}
//============================================================================================================
// WRAPPER FUNCTIONS
//============================================================================================================
//-----------------------------------------
// WRAPPER: Update internal cache
//-----------------------------------------
function _recache_wrapper($id, $parent="", $root='1')
{
global $ibforums, $std, $DB;
//-----------------------------------------
// Get wrapper from tree
//-----------------------------------------
$parent_in = $parent ? ','.$parent : '';
$DB->cache_add_query( 'cache_wrapper', array( 'id' => $id, 'parent_in' => $parent_in, 'root' => $root ) );
$DB->cache_exec_query();
$this_set = $DB->fetch_row();
$wrapper = $this_set['set_wrapper'];
//-----------------------------------------
// Get children details
//-----------------------------------------
$ids = array( 0 => array( 'set_skin_set_id' => $id ) );
if ( $id == 1 and IN_DEV )
{
$id = -1;
}
$DB->cache_add_query( 'cache_empty_wrapper', array( 'parent_id' => $id ) );
$DB->cache_exec_query();
while ( $r = $DB->fetch_row() )
{
$ids[] = $r;
}
if ( $id == -1 and IN_DEV )
{
$id = 1;
}
//-----------------------------------------
// Update this and child db
// caches
//-----------------------------------------
$theids = array();
foreach( $ids as $i => $d )
{
$theids[] = $d['set_skin_set_id'];
}
$DB->do_update( 'skin_sets', array( 'set_cache_wrapper' => $wrapper ), 'set_skin_set_id IN ('.implode(',',$theids).') AND set_skin_set_id != 1' );
$this->messages[] = "Done wrapper rebuild... (id: ".implode(',',$theids).")";
}
//============================================================================================================
// TEMPLATE FUNCTIONS
//============================================================================================================
//-----------------------------------------
// TEMPLATE: Recache and splash
//-----------------------------------------
function _recache_templates( $id, $parent="", $group_only="", $root=1 )
{
global $std, $DB, $ibforums;
$ids = array( 0 => array( 'id' => $id, 'parent' => $parent ) );
//-----------------------------------------
// Get any children
//-----------------------------------------
if ( $id == 1 and IN_DEV )
{
$id = -1;
}
$DB->simple_construct( array( 'select' => 'set_skin_set_id, set_skin_set_parent', 'from' => 'skin_sets', 'where' => "set_skin_set_parent=$id" ) );
$DB->simple_exec();
while ( $r = $DB->fetch_row() )
{
$ids[] = array( 'id' => $r['set_skin_set_id'], 'parent' => $r['set_skin_set_parent'] );
}
if ( $id == -1 and IN_DEV )
{
$id = 1;
}
//-----------------------------------------
// SPIN TO WIN!
//-----------------------------------------
foreach ( $ids as $i => $tid )
{
$id = $tid['id'];
$parent = $tid['parent'];
//-----------------------------------------
// Get template set titles
//-----------------------------------------
$group_titles = $this->_get_templates( $id, $parent, 'groups' );
foreach ( $group_titles as $name => $group )
{
//-----------------------------------------
// Skip if we're only updating
// one group..
//-----------------------------------------
if ( $group_only != '' )
{
if ( $group_only != $group['group_name'] )
{
continue;
}
}
$this_set_list = array();
$out = "class {$group['group_name']} {\n\n";
$templates = $this->_get_templates( $id, $parent, 'groups', $group['group_name'] );
foreach ($templates as $func_name => $data )
{
$out .= $this->template->convert_html_to_php( $data['func_name'], $data['func_data'], $data['section_content'] ) ."\n";
if ( $data['set_id'] == $id )
{
$this_set_list[] = $data['func_name'];
}
}
$out .= "\n\n}";
//-----------------------------------------
// Write to the DB...
//-----------------------------------------
$DB->simple_exec_query( array( 'delete' => 'skin_templates_cache', 'where' => "template_group_name='{$group['group_name']}' and template_set_id={$id}" ) );
$DB->do_insert( 'skin_templates_cache', array(
'template_id' => md5(microtime()),
'template_group_name' => $group['group_name'],
'template_group_content' => $out,
'template_set_id' => $id,
) );
//-----------------------------------------
// Write to the flatfile
//-----------------------------------------
$start = '<'.'?'."php\n";
$start .= "/*--------------------------------------------------*/\n";
$start .= "/* FILE GENERATED BY INVISION POWER BOARD */\n";
$start .= "/* CACHE FILE: Skin set id: {$id} */\n";
$start .= "/* CACHE FILE: Generated: ".gmdate( "D, d M Y H:i:s \G\M\T" )." */\n";
$start .= "/* DO NOT EDIT DIRECTLY - THE CHANGES WILL NOT BE */\n";
$start .= "/* WRITTEN TO THE DATABASE AUTOMATICALLY */\n";
$start .= "/*--------------------------------------------------*/\n\n";
$end = "\n\n/*--------------------------------------------------*/\n";
$end .= "/*<changed bits>\n".implode(',',$this_set_list)."\n</changed bits>*/\n";
$end .= "/* END OF FILE */\n";
$end .= "/*--------------------------------------------------*/\n";
$end .= "\n?".">";
$this->_write_template_to_file( $id, $group['group_name'], $start.$out.$end );
}
$this->messages[] = "Done HTML templates rebuild... (id: $id)";
}
}
//-----------------------------------------
// TEMPLATE: write flat-file
//-----------------------------------------
function _write_template_to_file($id, $group_name, $content)
{
global $DB, $ibforums;
//-----------------------------------------
// Check..
//-----------------------------------------
if ( $id == 1 AND ! IN_DEV)
{
return 0;
}
$return = 0;
$good_to_go = 0;
if ( ! SAFE_MODE_ON )
{
$good_to_go = 1;
if ( is_writeable( CACHE_PATH.'skin_cache' ) )
{
$good_to_go = 1;
if ( ! is_dir( CACHE_PATH.'skin_cache/cacheid_'.$id ) )
{
if ( ! @ mkdir( CACHE_PATH.'skin_cache/cacheid_'.$id, 0777 ) )
{
$good_to_go = 0;
}
else
{
@chmod( CACHE_PATH.'skin_cache/cacheid_'.$id, 0777 );
$good_to_go = 1;
}
}
else
{
if ( file_exists( CACHE_PATH.'skin_cache/cacheid_'.$id.'/'.$group_name.'.php' ) )
{
if ( ! is_writeable( CACHE_PATH.'skin_cache/cacheid_'.$id.'/'.$group_name.'.php' ) )
{
$this->messages[] = "::cache_id_{$id}/{$group_name}.php not writeable - cannot cache to PHP files";
$good_to_go = 0;
}
else
{
$good_to_go = 1;
}
}
else
{
$good_to_go = 1;
}
}
}
else
{
$this->messages[] = "::cache_id_{$id} not writeable - cannot cache to PHP files";
}
}
//-----------------------------------------
// Write...
//-----------------------------------------
if ( $good_to_go )
{
if ( $FH = @fopen( CACHE_PATH.'skin_cache/cacheid_'.$id.'/'.$group_name.'.php', 'w' ) )
{
fwrite( $FH, $content, strlen($content) );
fclose( $FH );
@chmod( CACHE_PATH.'skin_cache/cacheid_'.$id.'/'.$group_name.'.php', 0777 );
$return = 1;
$this->messages[] = "Wrote skin_cache/cacheid_{$id}/{$group_name}.php";
}
}
return $return;
}
//-----------------------------------------
// TEMPLATE: Return templates from tree
//-----------------------------------------
function _get_templates($id, $parent, $type='all', $group='', $root=1)
{
global $ibforums, $DB;
$templates = array();
$parent_in = $parent > 0 ? ','.$parent : '';
$return = 'all';
if ( $type == 'groups' and $group == '' )
{
//-----------------------------------------
// Just return group titles
//-----------------------------------------
$DB->cache_add_query( 'cache_templates_titles', array( 'id' => $id, 'parent_in' => $parent_in, 'root' => $root ) );
$newq = $DB->cache_exec_query();
$return = 'titles';
}
else if ( $type == 'groups' and $group != '' )
{
//-----------------------------------------
// Return group template bits
//-----------------------------------------
$DB->cache_add_query( 'cache_templates_bits', array( 'id' => $id, 'parent_in' => $parent_in, 'root' => $root, 'group' => $group ) );
$newq = $DB->cache_exec_query();
$return = 'group';
}
else
{
//-----------------------------------------
// Return all...
//-----------------------------------------
$DB->cache_add_query( 'cache_templates_all', array( 'id' => $id, 'parent_in' => $parent_in, 'root' => $root ) );
$newq = $DB->cache_exec_query();
}
//-----------------------------------------
// Get all results
//-----------------------------------------
while ( $r = $DB->fetch_row($newq) )
{
if ( $return == 'titles' )
{
$templates[ $r['group_name'] ] = $r;
$this->template_count[ $r['set_id'] ][ $r['group_name'] ]['count']++;
}
else if ( $return == 'group' )
{
$templates[ strtolower($r['func_name']) ] = $r;
}
else
{
$templates[ $r['group_name'] ][ strtolower($r['func_name']) ] = $r;
}
}
ksort($templates);
return $templates;
}
//-----------------------------------------
// TEMPLATE: Rebuild templates from PHP files
//-----------------------------------------
function _rebuild_templates_from_php($id)
{
global $ibforums, $DB, $std;
$insert = 1;
//-----------------------------------------
// Rebuilds the data editable files from the PHP source files
//-----------------------------------------
$this->template->cache_id = $id;
$skin_dir = CACHE_PATH."skin_cache/cacheid_".$id;
$errors = array();
$flag = 0;
//-----------------------------------------
// Is this a safe mode only skinny poos?
//-----------------------------------------
if ( ! file_exists( $skin_dir ) )
{
$this->messages[] = "This template set is a safe mode only skin and no PHP skin files exist, there is no need to run this tool on this template set.";
return 0;
}
if ( ! is_readable($skin_dir) )
{
$this->messages[] = "FAILD: Cannot write into '$skin_dir', please check the CHMOD value, and if needed, CHMOD to 0777 via FTP. IBF cannot do this for you.";
return 0;
}
if ( is_dir($skin_dir) )
{
if ( $handle = opendir($skin_dir) )
{
while (($filename = readdir($handle)) !== false)
{
if (($filename != ".") && ($filename != ".."))
{
if ( preg_match( "/\.php$/", $filename ) )
{
$name = preg_replace( "/^(\S+)\.(\S+)$/", "\\1", $filename );
if ($FH = fopen($skin_dir."/".$filename, 'r') )
{
$fdata = fread( $FH, filesize($skin_dir."/".$filename) );
fclose($FH);
}
else
{
$this->messages[] = "Could not open $filename for reading, skipping file...";
continue;
}
$fdata = str_replace( "\r", "\n", $fdata );
$fdata = str_replace( "\n\n", "\n", $fdata );
if ( ! preg_match( "/\n/", $fdata ) )
{
$this->messages[] = "Could not find any line endings in $filename, skipping file...";
continue;
}
$farray = explode( "\n", $fdata );
//-----------------------------------------
$functions = array();
foreach($farray as $f)
{
// Skip javascript functions...
if ( preg_match( "/<script/i", $f ) )
{
$script_token = 1;
}
if ( preg_match( "/<\/script>/i", $f ) )
{
$script_token = 0;
}
//-----------------------------------------
// NOT IN JS
//-----------------------------------------
if ($script_token == 0)
{
if ( preg_match( "/^function\s*([\w\_]+)\s*\((.*)\)/i", $f, $matches ) )
{
$functions[$matches[1]] = '';
$config[$matches[1]] = $matches[2];
$flag = $matches[1];
continue;
}
}
//-----------------------------------------
// ARE IN JS
//-----------------------------------------
else
{
// Make JS safe (UBE - Ugly, but effective)
$f = preg_replace( "#if\s+?\(#is" , "i~f~(~" , $f );
$f = preg_replace( "#else#is" , "e~lse~" , $f );
$f = preg_replace( "#else\s+?if#is", "e~lse~i~f", $f );
}
if ($flag)
{
$functions[$flag] .= $f."\n";
continue;
}
}
//-----------------------------------------
// Remove current templates for this set...
//-----------------------------------------
$DB->simple_exec_query( array( 'delete' => 'skin_templates', 'where' => "set_id='".$id."' AND group_name='$name'" ) );
$final = "";
$flag = 0;
foreach($functions as $fname => $ftext)
{
preg_match( "#//--starthtml--//(.+?)//--endhtml--//#s", $ftext, $matches );
$content = str_replace( '\\n' , '\\\\\\n', $this->template->convert_php_to_html($matches[1]) );
//-----------------------------------------
// Unconvert JS
//-----------------------------------------
$content = str_replace( "i~f~(~" , "if (" , $content );
$content = str_replace( "e~lse~" , "else" , $content );
$content = str_replace( "e~lse~i~f", "else if", $content );
$DB->do_insert( 'skin_templates', array (
'set_id' => $id,
'group_name' => $name,
'section_content' => $content,
'func_name' => $fname,
'func_data' => trim($config[$fname]),
'updated' => time(),
) );
}
$functions = array();
//-----------------------------------------
} // if *.php
} // if not dir
} // while loop
closedir($handle);
}
else
{
$this->messages[] = "Could not open directory $skin_dir for reading!.";
return 0;
}
}
else
{
$this->messages[] = "$skin_dir is not a directory, please check the \$root_path variable in admin.php.";
return 0;
}
$this->messages[] = "Completed database rebuild from PHP cache files.";
return 1;
}
//============================================================================================================
// CSS FUNCTIONS
//============================================================================================================
//-----------------------------------------
// CSS: Write file to cache
//-----------------------------------------
function _write_css_to_cache($id, $parent="", $root='1')
{
global $ibforums, $std, $DB;
//-----------------------------------------
// Get css from tree
//-----------------------------------------
$parent_in = $parent ? ','.$parent : '';
$DB->cache_add_query( 'cache_templates_css', array( 'id' => $id, 'parent_in' => $parent_in, 'root' => $root ) );
$DB->cache_exec_query();
$this_set = $DB->fetch_row();
$css = $this_set['set_css'];
$DB->simple_construct( array( 'select' => 'set_image_dir', 'from' => 'skin_sets', 'where' => "set_skin_set_id=$id" ) );
$DB->simple_exec();
$real_set = $DB->fetch_row();
//-----------------------------------------
// Get children details
//-----------------------------------------
$ids = array( $id => array( 'set_skin_set_id' => $id, 'set_image_dir' => $this_set['set_image_dir'] ) );
$set_ids = array( 0 => $id );
if ( $id == 1 and IN_DEV )
{
$id = -1;
}
$DB->cache_add_query( 'cache_empty_css', array ( 'parent_id' => $id ) );
$DB->cache_exec_query();
if ( $id == -1 and IN_DEV )
{
$id = 1;
}
while ( $r = $DB->fetch_row() )
{
$ids[ $r['set_skin_set_id'] ] = $r;
$set_ids[] = $r['set_skin_set_id'];
}
//-----------------------------------------
// Update this and child db
// caches
//-----------------------------------------
if ( count($set_ids) )
{
$DB->simple_construct( array( 'select' => 'set_image_dir, set_skin_set_id', 'from' => 'skin_sets', 'where' => 'set_skin_set_id IN('. implode(",",$set_ids) .')' ) );
$DB->simple_exec();
while ( $newid = $DB->fetch_row() )
{
$ids[ $newid['set_skin_set_id'] ]['set_image_dir'] = $newid['set_image_dir'];
}
}
//-----------------------------------------
// Make sure inline sheets
// have the proper style_images folder
//-----------------------------------------
$css = str_replace( "url({$real_set['set_image_dir']}/", "url(style_images/<#IMG_DIR#>/", $css );
$css = str_replace( "url(<#IMG_DIR#>/", "url(style_images/<#IMG_DIR#>/", $css );
$css = preg_replace( "#url\((style_images/)?\d+?/#i", "url(style_images/<#IMG_DIR#>/", $css );
if ( $ibforums->vars['ipb_img_url'] )
{
$css = str_replace( "url(style_images/", "url({$ibforums->vars['ipb_img_url']}style_images/", $css );
}
$DB->do_update( 'skin_sets', array( 'set_cache_css' => $css ), 'set_skin_set_id IN ('.implode(',',$set_ids).') AND set_skin_set_id != 1' );
//-----------------------------------------
// Update flat-file caches
//-----------------------------------------
$start = "/*------------------------------------------------------------------*/\n";
$start .= "/* FILE GENERATED BY INVISION POWER BOARD */\n";
$start .= "/* DO NOT EDIT BY HAND WITHOUT RESYNCHRONISING BACK TO THE DATABASE */\n";
$start .= "/* OR CHANGES TO THIS FILE WILL BE LOST WHEN NEXT EDITED FROM THE */\n";
$start .= "/* ADMIN CONTROL PANEL */\n";
$start .= "/* STYLE DIRECTORY: <#IMG_DIR#> */\n";
$start .= "/* CACHE FILE: Generated: ".gmdate( "D, d M Y H:i:s \G\M\T" )." */\n";
$start .= "/*------------------------------------------------------------------*/\n\n";
$start .= "/*~START CSS~*/\n\n";
$css = $std->txt_windowstounix($start.$css);
if ( file_exists( CACHE_PATH."style_images" ) )
{
if ( is_writeable( CACHE_PATH."style_images" ) )
{
foreach( $ids as $id )
{
@unlink( CACHE_PATH."style_images/css_".$id['set_skin_set_id'].".css" );
//-----------------------------------------
// Fix up relative stuff
//-----------------------------------------
$thiscss = str_replace( '<#IMG_DIR#>', $id['set_image_dir'], $css );
if ( ! $ibforums->vars['ipb_img_url'] )
{
$thiscss = str_replace( 'style_images/', '', $thiscss );
}
//-----------------------------------------
// Write..
//-----------------------------------------
if ( $FH = @fopen( CACHE_PATH."style_images/css_".$id['set_skin_set_id'].".css", 'w' ) )
{
@fputs( $FH, $thiscss, strlen($thiscss) );
@fclose($FH);
@chmod( CACHE_PATH."style_images/css_".$id['set_skin_set_id'].".css", 0777 );
$this->messages[] = "Rebuilding css file for css_{$id['set_skin_set_id']}...";
}
else
{
$this->messages[] = "<br /><b>Cache file css_{$id['set_skin_set_id']} not updated. Check CHMOD permissions on ./style_images and ./style_images/css_{$id['set_skin_set_id']}.css</b>";
}
}
}
else
{
$this->messages[] = "<b>Cache file(s) not updated. Check CHMOD permissions on ./style_images and ./style_images/css_{$id['set_skin_set_id']}.css</b>";
}
}
else
{
$this->messages[] = "<b>Cache file(s) not updated. style_images folder not present</b>";
}
}
//============================================================================================================
// MACRO FUNCTIONS
//============================================================================================================
//-----------------------------------------
// MACRO: Recache macros
//-----------------------------------------
function _recache_macros($id, $parent="", $root=1)
{
global $DB, $ibforums;
$ids = array( 0 => array( 'id' => $id, 'parent' => $parent ) );
//-----------------------------------------
// Get any children
//-----------------------------------------
$DB->simple_construct( array( 'select' => 'set_skin_set_id, set_skin_set_parent', 'from' => 'skin_sets', 'where' => "set_skin_set_parent=$id" ) );
$DB->simple_exec();
while ( $r = $DB->fetch_row() )
{
$ids[] = array( 'id' => $r['set_skin_set_id'], 'parent' => $r['set_skin_set_parent'] );
}
$DB->manual_addslashes = 1;
foreach( $ids as $i )
{
$macros = $this->_get_macros($i['id'], $i['parent'], $root);
$this->messages[] = "Done.... (Macro ID: {$i['id']})...";
$DB->do_update( 'skin_sets', array( 'set_cache_macro' => $DB->add_slashes(serialize($macros)) ), 'set_skin_set_id='.$i['id'] );
}
$DB->manual_addslashes = 0;
}
//-----------------------------------------
// MACRO: Return macros from tree
//-----------------------------------------
function _get_macros($id, $parent, $root=1)
{
global $ibforums, $DB;
$macros = array();
$parent_in = $parent ? ','.$parent : '';
//-----------------------------------------
// Get macros from db, we want to return macros in order
// so that skin specific macros are returned over root
// macros. We use instr( concat() ) to search the parent
// list for the macro set and return the position. The lower
// the pos, the higher up the tree. Use DESC on this 'theorder'
// to return specific macros last so that they overwrite root
// macros.... (thats the theory)
//-----------------------------------------
$DB->cache_add_query( 'cache_templates_macros', array( 'id' => $id, 'parent_in' => $parent_in, 'root' => $root ) );
$DB->cache_exec_query();
while ( $r = $DB->fetch_row() )
{
$macros[ strtolower( $r['macro_value'] ) ] = $r;
}
ksort($macros);
return $macros;
}
//============================================================================================================
// MAIN FUNCTIONS
//============================================================================================================
//-----------------------------------------
// MAIN: Rebuild all caches
//-----------------------------------------
function _rebuild_all_caches( $affected )
{
global $ibforums, $DB;
$this->no_rebuild = 1;
$DB->simple_construct( array( 'select' => '*', 'from' => 'skin_sets', 'order' => 'set_skin_set_parent, set_skin_set_id ASC' ) );
$DB->simple_exec();
while ( $r = $DB->fetch_row() )
{
$skins[ $r['set_skin_set_id'] ] = $r;
}
//-----------------------------------------
// check all affected ids
//-----------------------------------------
foreach( $affected as $aid )
{
if ( $aid == 1 and ! IN_DEV )
{
continue;
}
//-----------------------------------------
// Custom Macros
//-----------------------------------------
$this->messages[] = "Rebuilding Macros for set {$skins[$aid]['set_name']}...";
$this->_recache_macros($aid, $skins[ $aid ]['set_skin_set_parent']);
//-----------------------------------------
// Custom CSS
//-----------------------------------------
$this->messages[] = "Rebuilding CSS for set {$skins[$aid]['set_name']}...";
$this->_write_css_to_cache( $aid, $skins[ $aid ]['set_skin_set_parent'] );
//-----------------------------------------
// Custom HTML
//-----------------------------------------
$this->messages[] = "Rebuilding HTML templates cache for set {$skins[$aid]['set_name']}...";
$this->_recache_templates( $aid, $skins[ $aid ]['set_skin_set_parent'] );
//-----------------------------------------
// Custom Wrappers
//-----------------------------------------
$this->messages[] = "Rebuilding wrappers cache for set {$skins[$aid]['set_name']}...";
$this->_recache_wrapper( $aid, $skins[ $aid ]['set_skin_set_parent'] );
}
$this->messages[] = "Rebuilding the skin set ID relationship cache...";
$this->_rebuild_skin_id_cache($skins);
return $message;
}
//-----------------------------------------
// MAIN: Rebuild cache entry
//-----------------------------------------
function _rebuild_skin_id_cache($skins=array())
{
global $ibforums, $DB, $std;
$ibforums->cache['skin_id_cache'] = array();
if ( ! count( $skins ) )
{
$DB->simple_construct( array( 'select' => '*', 'from' => 'skin_sets', 'order' => 'set_skin_set_parent, set_skin_set_id ASC' ) );
$DB->simple_exec();
while ( $r = $DB->fetch_row() )
{
$skins[ $r['set_skin_set_id'] ] = $r;
}
}
foreach( $skins as $row )
{
if ( $row['set_skin_set_parent'] > 1 )
{
$parent = ','.$row['set_skin_set_parent'];
}
$ibforums->cache['skin_id_cache'][ $row['set_skin_set_id'] ] = array( 'set_skin_set_id' => $row['set_skin_set_id'],
'set_tree_list' => $row['set_skin_set_id'].$parent.',1',
'set_hidden' => $row['set_hidden'],
'set_default' => $row['set_default'],
'set_parent' => $row['set_skin_set_parent'],
'set_name' => $row['set_name'],
);
}
$std->update_cache( array( 'name' => 'skin_id_cache', 'array' => 1, 'deletefirst' => 1 ) );
return $ibforums->cache['skin_id_cache'];
}
}
?>
@@ -0,0 +1,659 @@
<?php
/*
+--------------------------------------------------------------------------
| Invision Power Board v2.0.0
| =============================================
| by Matthew Mecham
| (c) 2001 - 2004 Invision Power Services, Inc.
| http://www.invisionpower.com
| =============================================
| Web: http://www.invisionboard.com
| Time: Tue, 21 Sep 2004 16:34:28 GMT
| Release: 150aa7a702c3c8b6f6eb90ad49305d2f
| Licence Info: http://www.invisionboard.com/?license
+---------------------------------------------------------------------------
|
| > Admin forum functions library
| > Script written by Matt Mecham
| > Date started: 19th November 2003
|
| > DBA Checked: Tue 25th May 2004
+--------------------------------------------------------------------------
*/
class admin_forum_functions
{
var $type = "";
var $printed = 0;
var $show_all = 0;
var $skins = array();
var $need_desc = array();
//-----------------------------------------
// Forum - Build Children (of the CORN!!!)
//-----------------------------------------
function forum_build_children($root_id, $temp_html="", $depth_guide="")
{
global $ibforums, $forums;
if ( is_array( $forums->forum_cache[ $root_id ] ) )
{
foreach( $forums->forum_cache[ $root_id ] as $id => $forum_data )
{
if ( $ibforums->vars['forum_cache_minimum'] )
{
$forum_data['description'] = "<!--DESCRIPTION:{$forum_data['id']}-->";
$this->need_desc[] = $forum_data['id'];
}
$temp_html .= $this->render_forum($forum_data, $depth_guide);
$temp_html = $this->forum_build_children( $forum_data['id'], $temp_html, $depth_guide . $forums->depth_guide );
}
}
return $temp_html;
}
//-----------------------------------------
// Forum - Render forum entry (NOT of the CORN!!!)
//-----------------------------------------
function render_forum($r, $depth_guide="")
{
global $ibforums, $std, $forums;
if ( $this->type == 'manage' )
{
if ( ! is_array($ibforums->adskin->td_header[0]) )
{
$ibforums->adskin->td_header[0] = array( "{none}", "35%" );
$ibforums->adskin->td_header[1] = array( "{none}", "25%" );
$ibforums->adskin->td_header[2] = array( "{none}", "15%" );
$ibforums->adskin->td_header[3] = array( "{none}", "25%" );
}
$skin_stuff = "";
$trash_can = "";
if ( ($r['skin_id'] != "") and ($r['skin_id'] >= 0) )
{
$skin_stuff = "<br>[ "."Using Skin Set: ".$this->skins[$r['skin_id']]." ]";
}
$redirect = ($r['redirect_on'] == 1) ? ' (Redirect Forum)' : '';
if ( $r['id'] == $ibforums->vars['forum_trash_can_id'] )
{
$trash_can = "&nbsp;<img src='{$ibforums->adskin->img_url}/acp_trashcan.gif' border='0' title='This is the trashcan forum' />&nbsp;";
}
if ( ! $this->show_all )
{
$children = $forums->forums_get_children( $r['id'] );
$sub = array();
$subforums = "";
$count = 0;
if ( count($children) )
{
$r['name'] = "<a href='{$ibforums->base_url}&act=forum&f={$r['id']}'>".$r['name']."</a>";
foreach ( $children as $cid )
{
$count++;
$cfid = $cid;
if ( $count == count($children) )
{
//-----------------------------------------
// Last subforum, link to parent
// forum...
//-----------------------------------------
if ( ! $cfid = $children[ $count - 2 ] )
{
$cfid = $r['id'];
}
}
$sub[] = "<a href='{$ibforums->base_url}&act=forum&f={$forums->forum_by_id[$cid]['parent_id']}'>".$forums->forum_by_id[$cid]['name']."</a>";
}
}
if ( count( $sub ) )
{
$subforums = '<br /><br />Sub-forums: '.implode( ", ", $sub );
}
$desc = "<div class='graytext'>{$r['description']}{$subforums}</div>";
}
else
{
$desc = "";
}
return $ibforums->adskin->add_td_row( array(
"<b>{$depth_guide}{$trash_can}{$r['name']}</b>$redirect $skin_stuff{$desc}",
"<center><b><a href='{$ibforums->base_url}&act=forum&code=edit&f={$r['id']}'>Settings</a></b>".
" | <a href='{$ibforums->base_url}&act=forum&code=pedit&f={$r['id']}'>Permissions</a></center>",
array("<div align='center'><a href='{$ibforums->base_url}&act=forum&code=frules&f={$r['id']}'><img src='{$ibforums->adskin->img_url}/acp_rules.gif' border='0' title='Forum Rules'></a>&nbsp;&nbsp;".
"<a href='{$ibforums->base_url}&act=forum&code=skinedit&f={$r['id']}'><img src='{$ibforums->adskin->img_url}/acp_edit.gif' border='0' title='Skin Options'></a>&nbsp;&nbsp;".
"<a href='{$ibforums->base_url}&act=forum&code=recount&f={$r['id']}'><img src='{$ibforums->adskin->img_url}/acp_resync.gif' border='0' title='Resynchronise'></a></div>", 1, 'tdrow3' ),
"<center><a href='{$ibforums->base_url}&act=forum&code=delete&f={$r['id']}'>Delete</a>".
" | <b><a href='{$ibforums->base_url}&act=forum&code=empty&f={$r['id']}'>Empty Forum</a></b></center>",
) );
}
//-----------------------------------------
// REORDER
//-----------------------------------------
else if ( $this->type == 'reorder' )
{
if ( ! is_array($ibforums->adskin->td_header[0]) )
{
$ibforums->adskin->td_header[0] = array( "{none}", "10%" );
$ibforums->adskin->td_header[1] = array( "{none}", "90%" );
}
$this->printed++;
$no_root = count( $forums->forums_get_children($ibforums->input['f']) );
$reorder = "<select id='realbutton' name='f_{$r['id']}'>";
for( $i = 1 ; $i <= $no_root ; $i++ )
{
$sel = "";
if ( $this->printed == $i )
{
$sel = 'selected="selected" ';
}
$reorder .= "\n<option value='$i'{$sel}>$i</option>";
}
$reorder .= "</select>\n";
return $ibforums->adskin->add_td_row( array(
$reorder,
"<b>{$depth_guide}".$r['name']."</b>",
) );
}
//-----------------------------------------
// MODERATOR
//-----------------------------------------
else if ( $this->type == 'moderator' )
{
if ( ! is_array($ibforums->adskin->td_header[0]) )
{
$ibforums->adskin->td_header[] = array( "Add" , "5%" );
$ibforums->adskin->td_header[] = array( "Forum Name" , "40%" );
$ibforums->adskin->td_header[] = array( "Current Moderators" , "55%" );
}
$mod_string = "";
foreach( $this->moderators as $phpid => $data )
{
if ($data['forum_id'] == $r['id'])
{
if ($data['is_group'] == 1)
{
$mod_string .= "<tr>
<td width='60%'>Group: {$data['group_name']}</td>
<td width='20%'><a href='{$ibforums->base_url}&act=mod&code=remove&mid={$data['mid']}'>Remove</a></td>
<td width='20%'><a href='{$ibforums->base_url}&act=mod&code=edit&mid={$data['mid']}'>Edit</a></td>
</tr>";
}
else
{
$mod_string .= "<tr>
<td width='60%'>{$data['member_name']}</td>
<td width='20%'><a href='{$ibforums->base_url}&act=mod&code=remove&mid={$data['mid']}'>Remove</a></td>
<td width='20%'><a href='{$ibforums->base_url}&act=mod&code=edit&mid={$data['mid']}'>Edit</a></td>
</tr>";
}
}
}
if ($mod_string != "")
{
$these_mods = "<table cellpadding='3' cellspacing='0' width='100%' align='center'>".$mod_string."</table>";
}
else
{
$these_mods = "<center><i>Unmoderated</i></center>";
}
//-----------------------------------------
// Subforums..
//-----------------------------------------
if ( ! $this->show_all )
{
$children = $forums->forums_get_children( $r['id'] );
$sub = array();
$subforums = "";
$count = 0;
if ( count($children) )
{
$r['name'] = "<a href='{$ibforums->base_url}&act=forum&f={$r['id']}'>".$r['name']."</a>";
foreach ( $children as $cid )
{
$count++;
$cfid = $cid;
if ( $count == count($children) )
{
//-----------------------------------------
// Last subforum, link to parent
// forum...
//-----------------------------------------
if ( ! $cfid = $children[ $count - 2 ] )
{
$cfid = $r['id'];
}
}
$sub[] = "<a href='{$ibforums->base_url}&act=forum&f={$forums->forum_by_id[$cid]['parent_id']}'>".$forums->forum_by_id[$cid]['name']."</a>";
}
}
if ( count( $sub ) )
{
$subforums = '<br /><br />Sub-forums: '.implode( ", ", $sub );
}
$desc = "<div class='graytext'>{$r['description']}{$subforums}</div>";
}
else
{
$desc = "";
}
return $ibforums->adskin->add_td_row( array(
"<center><input type='checkbox' name='add_{$r['id']}' value='1' /></center>",
"<b>{$depth_guide}".$r['name']."</b>{$desc}",
$these_mods
) );
}
}
//-----------------------------------------
// Forum - SHOW CAT(MEOW) (MEOW _ WOOF :&)
//-----------------------------------------
function forum_show_cat($r, $show_buttons=1, $show_reorder=0)
{
global $ibforums, $std, $forums;
if ( $this->type == 'manage' )
{
$this->printed++;
$no_root = count( $forums->forum_cache['root'] );
$reorder = "<select id='editbutton' name='f_{$r['id']}'>";
for( $i = 1 ; $i <= $no_root ; $i++ )
{
$sel = "";
if ( $this->printed == $i )
{
$sel = 'selected="selected" ';
}
$reorder .= "\n<option value='$i'{$sel}>$i</option>";
}
$reorder .= "</select>\n";
if ( $show_buttons )
{
$html = "<table cellpadding='0' cellspacing='0' border='0' width='100%'>
<tr>
<td align='left' width='40%' style='font-size:12px; vertical-align:middle;font-weight:bold; color:#FFF;' title='ID: {$r['id']}'>{$r['name']}</td>
<td align='right' width='60%'>".
$ibforums->adskin->js_make_button("New Forum" , $ibforums->base_url."&act=forum&code=new&p={$r['id']}", 'realdarkbutton')."&nbsp;".
$ibforums->adskin->js_make_button("Permissions", $ibforums->base_url."&act=forum&code=pedit&f={$r['id']}", 'realdarkbutton')."&nbsp;".
$ibforums->adskin->js_make_button("Edit" , $ibforums->base_url."&act=forum&code=edit&f={$r['id']}")."&nbsp;".
$ibforums->adskin->js_make_button("Skin" , $ibforums->base_url."&act=forum&code=skinedit&f={$r['id']}")."&nbsp;".
$ibforums->adskin->js_make_button("Delete" , $ibforums->base_url."&act=forum&code=delete&f={$r['id']}")."&nbsp;".
$reorder .
"&nbsp;&nbsp;</td>
</tr>
</table>";
}
else if ( $show_reorder )
{
$html = "<table cellpadding='0' cellspacing='0' border='0' width='100%'>
<tr>
<td align='left' width='40%' style='font-size:12px; vertical-align:middle;font-weight:bold; color:#FFF;' title='ID: {$r['id']}'>{$r['name']}</td>
<td align='right' width='60%'>".
$ibforums->adskin->js_make_button("Re-order Children", $ibforums->base_url."&act=forum&code=reorder&f={$r['id']}&sub=1", 'realdarkbutton')."&nbsp;".
"&nbsp;&nbsp;</td>
</tr>
</table>";
}
else
{
$html = $r['name'];
}
$ibforums->html .= $ibforums->adskin->start_table($html);
}
else if ( $this->type == 'reorder' )
{
$ibforums->html .= $ibforums->adskin->start_table($r['name']);
}
else if ( $this->type == 'moderator' )
{
$ibforums->html .= $ibforums->adskin->start_table($r['name']);
}
}
//-----------------------------------------
// Forum - END CAT(MEOW) (MEOW _ WOOF MOO :&)
//-----------------------------------------
function forum_end_cat($r=array())
{
global $ibforums, $std, $forums;
if ( $this->type == 'manage' )
{
$ibforums->html .= $ibforums->adskin->end_table();
}
else if ( $this->type == 'reorder' )
{
$ibforums->html .= $ibforums->adskin->end_table();
}
else if ( $this->type == 'moderator' )
{
$ibforums->html .= $ibforums->adskin->end_table();
}
}
//-----------------------------------------
// LSIT PIST FORUMZ!!!!@@@!1!!1!
//-----------------------------------------
function forums_list_forums()
{
global $ibforums, $DB, $std, $forums;
if ( $this->type == 'manage' )
{
foreach( $ibforums->cache['skin_id_cache'] as $id => $data )
{
$this->skins[ $id ] = $data['set_name'];
}
}
$temp_html = "";
$fid = intval( $ibforums->input['f'] );
if ( $this->show_all )
{
foreach( $forums->forum_cache['root'] as $id => $forum_data )
{
$cat_data = $forum_data;
$depth_guide = "";
if ( is_array( $forums->forum_cache[ $forum_data['id'] ] ) )
{
foreach( $forums->forum_cache[ $forum_data['id'] ] as $id => $forum_data )
{
if ( $ibforums->vars['forum_cache_minimum'] )
{
$forum_data['description'] = "<!--DESCRIPTION:{$forum_data['id']}-->";
$this->need_desc[] = $forum_data['id'];
}
$temp_html .= $this->render_forum($forum_data, $depth_guide);
$temp_html = $this->forum_build_children( $forum_data['id'], $temp_html, '<span style="color:gray">&#0124;</span>'.$depth_guide . $forums->depth_guide );
}
}
$this->forum_show_cat($cat_data);
$ibforums->html .= $temp_html;
$this->forum_end_cat($cat_data);
unset($temp_html);
}
}
else if ( ! $fid )
{
foreach( $forums->forum_cache[ 'root' ] as $id => $forum_data )
{
$cat_data = $forum_data;
$depth_guide = "";
if ( is_array( $forums->forum_cache[ $forum_data['id'] ] ) )
{
foreach( $forums->forum_cache[ $forum_data['id'] ] as $id => $forum_data )
{
if ( $ibforums->vars['forum_cache_minimum'] )
{
$forum_data['description'] = "<!--DESCRIPTION:{$forum_data['id']}-->";
$this->need_desc[] = $forum_data['id'];
}
$temp_html .= $this->render_forum($forum_data, $depth_guide);
//$temp_html = $this->forum_build_children( $forum_data['id'], $temp_html, '<span style="color:gray">&#0124;</span>'.$depth_guide . $forums->depth_guide );
}
}
$this->forum_show_cat($cat_data);
$ibforums->html .= $temp_html;
$this->forum_end_cat($cat_data);
unset($temp_html);
}
}
else
{
//foreach( $forums->forum_cache[ $fid ] as $id => $forum_data )
//{
$cat_data = $forum_data;
$depth_guide = "";
if ( is_array( $forums->forum_cache[ $fid ] ) )
{
$cat_data = $forums->forum_by_id[ $fid ];
$depth_guide = "";
foreach( $forums->forum_cache[ $fid ] as $id => $forum_data )
{
if ( $ibforums->vars['forum_cache_minimum'] )
{
$forum_data['description'] = "<!--DESCRIPTION:{$forum_data['id']}-->";
$this->need_desc[] = $forum_data['id'];
}
$temp_html .= $this->render_forum($forum_data, $depth_guide);
//$temp_html = $this->forum_build_children( $forum_data['id'], $temp_html, '<span style="color:gray">&#0124;</span>'.$depth_guide . $forums->depth_guide );
}
}
$this->forum_show_cat($forums->forum_by_id[ $fid ], 0, 1 );
$ibforums->html .= $temp_html;
$this->forum_end_cat($forums->forum_by_id[ $fid ]);
unset($temp_html);
//}
}
//-----------------------------------------
// Get descriptions?
//-----------------------------------------
if ( $ibforums->vars['forum_cache_minimum'] and count($this->need_desc) )
{
$DB->simple_construct( array( 'select' => 'id,description', 'from' => 'forums', 'where' => 'id IN('.implode( ',', $this->need_desc ) .')' ) );
$DB->simple_exec();
while( $r = $DB->fetch_row() )
{
$ibforums->html = str_replace( "<!--DESCRIPTION:{$r['id']}-->", $r['description'], $ibforums->html );
}
}
}
/*-------------------------------------------------------------------------*/
// forum jumpee
// ------------------
// Builds the forum jumpee dunnit
/*-------------------------------------------------------------------------*/
function ad_forums_forum_list($restrict=0)
{
global $ibforums, $forums;
if ( $restrict != 1 )
{
$jump_array[] = array( '-1', 'Make Root (Category)' );
}
else
{
$jump_array = array();
}
foreach( $forums->forum_cache['root'] as $id => $forum_data )
{
$jump_array[] = array( $forum_data['id'], $forum_data['name'] );
$depth_guide = $forums->depth_guide;
if ( is_array( $forums->forum_cache[ $forum_data['id'] ] ) )
{
foreach( $forums->forum_cache[ $forum_data['id'] ] as $id => $forum_data )
{
$jump_array[] = array( $forum_data['id'], $depth_guide.$forum_data['name'] );
$jump_array = $this->forums_forum_list_internal( $forum_data['id'], $jump_array, $depth_guide . $forums->depth_guide );
}
}
}
return $jump_array;
}
function forums_forum_list_internal($root_id, $jump_array=array(), $depth_guide="")
{
global $ibforums, $forums;
if ( is_array( $forums->forum_cache[ $root_id ] ) )
{
foreach( $forums->forum_cache[ $root_id ] as $id => $forum_data )
{
$jump_array[] = array( $forum_data['id'], $depth_guide.$forum_data['name'] );
$jump_array = $this->forums_forum_list_internal( $forum_data['id'], $jump_array, $depth_guide . $forums->depth_guide );
}
}
return $jump_array;
}
/*-------------------------------------------------------------------------*/
// forum return data
// ------------------
// Returns forum data
/*-------------------------------------------------------------------------*/
function ad_forums_forum_data()
{
global $ibforums, $forums;
foreach( $forums->forum_cache['root'] as $id => $forum_data )
{
$forum_data['depthed_name'] = $forum_data['name'];
$forum_data['root_forum'] = 1;
$jump_array[ $forum_data['id'] ] = $forum_data;
$depth_guide = $forums->depth_guide;
if ( is_array( $forums->forum_cache[ $forum_data['id'] ] ) )
{
foreach( $forums->forum_cache[ $forum_data['id'] ] as $id => $forum_data )
{
$forum_data['depthed_name'] = $depth_guide.$forum_data['name'];
$jump_array[ $forum_data['id'] ] = $forum_data;
$jump_array = $this->forums_forum_data_internal( $forum_data['id'], $jump_array, $depth_guide . $forums->depth_guide );
}
}
}
return $jump_array;
}
function forums_forum_data_internal($root_id, $jump_array=array(), $depth_guide="")
{
global $ibforums, $forums;
if ( is_array( $forums->forum_cache[ $root_id ] ) )
{
foreach( $forums->forum_cache[ $root_id ] as $id => $forum_data )
{
$forum_data['depthed_name'] = $depth_guide.$forum_data['name'];
$jump_array[ $forum_data['id'] ] = $forum_data;
$jump_array = $this->forums_forum_data_internal( $forum_data['id'], $jump_array, $depth_guide . $forums->depth_guide );
}
}
return $jump_array;
}
}
?>
File diff suppressed because it is too large. Load diff
+213
View File
@@ -0,0 +1,213 @@
<?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[ $cat_id ][$page_id][2] = Look for folder before showing
// $PAGES[ $cat_id ][$page_id][3] = URL type: 1 = Board URL 0 = ACP URL
// $PAGES[ $cat_id ][$page_id][4] = Item icon: 1= redirect 0 = Normal
$PAGES = array(
# SETTINGS
100 => array (
1 => array( 'View All General Settings', 'act=op' ),
2 => array( 'Add New General Setting' , 'act=op&code=settingnew' ),
7 => array( 'Turn Board On / Off' , 'act=op&code=findsetting&key='.urlencode('boardoffline/online'), '', 0, 1 ),
8 => array( 'Board Guidelines' , 'act=op&code=findsetting&key='.urlencode('boardguidelines'), '', 0, 1 ),
9 => array( 'General Configuration' , 'act=op&code=findsetting&key='.urlencode('generalconfiguration'), '', 0, 1 ),
10 => array( 'CPU Saving' , 'act=op&code=findsetting&key='.urlencode('cpusaving&optimization'), '', 0, 1 ),
11 => array( 'IP Chat' , 'act=pin&code=ipchat' ),
12 => array( 'IPB Registration' , 'act=pin&code=reg' ),
14 => array( 'IPB Copyright Removal' , 'act=pin&code=copy' ),
),
# MEMBER MANAGEMENT
200 => array (
1 => array( 'New Forum' , 'act=forum&code=new' ),
2 => array( 'Manage Forums' , 'act=forum' ),
3 => array( 'Permission Masks' , 'act=group&code=permsplash'),
6 => array( 'Moderators' , 'act=mod' ),
7 => array( 'Topic Multi-Moderation', 'act=multimod' ),
8 => array( 'Trash Can Set-Up' , 'act=op&code=findsetting&key=trashcanset-up', '', 0, 1 ),
),
300 => array (
1 => array ( 'Manage Members' , 'act=mem&code=search' ),
2 => array ( 'Add New Member' , 'act=mem&code=add' ),
6 => array ( 'Manage Ranks' , 'act=mem&code=title'),
7 => array ( 'Manage User Groups' , 'act=group' ),
8 => array ( 'Manage Validating' , 'act=mem&code=mod' ),
9 => array ( 'Custom Profile Fields' , 'act=field' ),
11 => array ( 'IP Member Tools' , 'act=mtools' ),
12 => array ( 'Member Settings' , 'act=op&code=findsetting&key=userprofiles', '', 0, 1 ),
),
400 => array(
5 => array( 'Subscription Manager' , 'act=msubs' ),
6 => array( '&#0124;-- Logs' , 'act=msubs&code=searchlog', 'modules/subsmanager' ),
7 => array( '&#0124;-- Currency Set-up' , 'act=msubs&code=currency' , 'modules/subsmanager' ),
8 => array( '&#039;-- Transactions' , 'act=msubs&code=dosearch' , 'modules/subsmanager' ),
9 => array( 'Subs-Manager Settings' , 'act=op&code=findsetting&key='.urlencode('subscriptionsmanager'), '', 0, 1 ),
),
# POST MANAGEMENT
500 => array (
1 => array( 'Attachment Types' , 'act=attach&code=types' ),
2 => array( 'Attachment Stats' , 'act=attach&code=stats' ),
3 => array( 'Attachment Search' , 'act=attach&code=search' ),
),
600 => array(
1 => array( 'Custom BBCode Manager' , 'act=admin&code=bbcode' ),
2 => array( 'Add New BBCode' , 'act=admin&code=bbcode_add' ),
),
700 => array(
1 => array( 'Emoticon Manager' , 'act=admin&code=emo' ),
2 => array( 'Import/Export Packs' , 'act=admin&code=emo_packsplash' ),
),
800 => array (
1 => array( 'Manage Badword Filters', 'act=admin&code=badword' ),
6 => array( 'Manage Ban Filters' , 'act=admin&code=ban' ),
),
# SKINS & LANGS
900 => array (
1 => array( 'Skin Manager' , 'act=sets' ),
2 => array( 'Skin Tools' , 'act=skintools' ),
3 => array( 'Skin Search & Replace' , 'act=skintools&code=searchsplash' ),
4 => array( 'Skin Import/Export' , 'act=import' ),
5 => array( 'Easy Logo Changer' , 'act=skintools&code=easylogo' ),
),
1000 => array (
1 => array( 'Manage Languages' , 'act=lang' ),
2 => array( 'Import a Language' , 'act=lang&code=import' ),
),
# ADMIN
1100 => array (
1 => array( 'Manage Help Files' , 'act=help' ),
2 => array( 'Cache Control' , 'act=admin&code=cache' ),
3 => array( 'Recount & Rebuild' , 'act=rebuild' ),
4 => array( 'Clean-up Tools' , 'act=rebuild&code=tools' ),
),
1200 => array(
1 => array( 'Manage Bulk Mail' , 'act=postoffice' ),
2 => array( 'Create New Email' , 'act=postoffice&code=mail_new' ),
3 => array( 'View Email Logs' , 'act=emaillog', '', 0, 1 ),
4 => array( 'View Email Error Logs' , 'act=emailerror', '', 0, 1 ),
5 => array( 'Email Settings' , 'act=op&code=findsetting&key=emailset-up', '', 0, 1 ),
),
1300 => array (
1 => array( 'Task Manager' , 'act=task' ),
2 => array( 'View Task Logs' , 'act=task&code=log' ),
),
1400 => array(
1 => array( 'Invision Gallery' , 'act=gallery' ),
2 => array( '|-- Settings' , 'act=op&code=findsetting&key='.urlencode('invisiongallerysettings'), '', 0, 0 ),
3 => array( '|-- Album Manager' , 'act=gallery&code=albums' , 'modules/gallery' ),
4 => array( '|-- Multimedia Manager' , 'act=gallery&code=media' , 'modules/gallery' ),
5 => array( '|-- Groups' , 'act=gallery&code=groups' , 'modules/gallery' ),
6 => array( '|-- Stats' , 'act=gallery&code=stats' , 'modules/gallery' ),
7 => array( '|-- Tools' , 'act=gallery&code=tools' , 'modules/gallery' ),
8 => array( '&#039;-- Post Form' , 'act=gallery&code=postform', 'modules/gallery' ),
),
1500 => 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( 'Personal Message' , 'act=stats&code=msg' ),
5 => array( 'Topic Views' , 'act=stats&code=views' ),
),
1600 => array (
1 => array( 'SQL Toolbox' , 'act=mysql' ),
2 => array( 'SQL 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' ),
),
1700 => array(
1 => array( 'View Moderator Logs' , 'act=modlog' ),
2 => array( 'View Admin Logs' , 'act=adminlog' ),
3 => array( 'View Email Logs' , 'act=emaillog' ),
4 => array( 'View Email Error Logs', 'act=emailerror' ),
5 => array( 'View Bot Logs' , 'act=spiderlog' ),
6 => array( 'View Warn Logs' , 'act=warnlog' ),
),
);
$CATS = array (
100 => array( "System Settings" , '#caf2d9;margin-bottom:12px;' ),
200 => array( 'Forum Control' , '#F9FFA2' ),
300 => array( 'Users and Groups' , '#F9FFA2' ),
400 => array( "Subscriptions" , '#F9FFA2;margin-bottom:12px;' ),
500 => array( "Attachments" , '#f5cdcd' ),
600 => array( "Custom BBCode" , '#f5cdcd' ),
700 => array( "Emoticons" , '#f5cdcd' ),
800 => array( "Word & Ban Filters", '#f5cdcd;margin-bottom:12px;' ),
900 => array( 'Skins & Templates' , '#DFE6EF' ),
1000 => array( 'Languages' , '#DFE6EF;margin-bottom:12px;' ),
1100 => array( 'Maintenance' , '#caf2d9' ),
1200 => array( 'Post Office' , '#caf2d9' ),
1300 => array( 'Task Manager' , '#caf2d9;margin-bottom:12px;' ),
1400 => array( "Invision Gallery" , '#F9FFA2;margin-bottom:12px;' ),
1500 => array( 'Statistic Center' , '#f5cdcd' ),
1600 => array( 'SQL Management' , '#f5cdcd' ),
1700 => array( 'Board Logs' , '#f5cdcd' ),
);
$DESC = array (
100 => "Edit forum settings such as cookie paths, security features, posting abilities, etc",
200 => "Create, edit, remove and re-order categories, forums and moderators",
300 => "Manage members, groups and ranks",
400 => "Manage your members' subscriptions and more",
500 => "Manage your attachments",
600 => "Manage your custom BBCode",
700 => "Manage your emoticons and upload/download emoticon packs",
800 => "Manage your badword and ban filters",
900 => "Manage templates, skins, colours and images.",
1000 => "Manage language sets",
1100 => "Manage Help Files, Bad Word Filters and Emoticons",
1200 => "Manage your email and bulk mail members",
1300 => "Manage your scheduled tasks.",
1400 => "Manage your gallery",
1500 => "Get registration and posting statistics",
1600 => "Manage your SQL database; repair, optimize and export data",
1700 => "View admin, moderator and email logs (Root admin only)",
);
?>
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,356 @@
<?php
/*
+--------------------------------------------------------------------------
| Invision Power Board v2.0.0
| =============================================
| by Matthew Mecham
| (c) 2001 - 2004 Invision Power Services, Inc.
| http://www.invisionpower.com
| =============================================
| Web: http://www.invisionboard.com
| Time: Tue, 21 Sep 2004 16:34:28 GMT
| Release: 150aa7a702c3c8b6f6eb90ad49305d2f
| Licence Info: http://www.invisionboard.com/?license
+---------------------------------------------------------------------------
|
| > Admin Template functions library
| > Script written by Matt Mecham
| > Date started: 19th November 2003
|
| > DBA Checked: Tue 25th May 2004
+--------------------------------------------------------------------------
*/
class admin_template_functions
{
var $menu_fontchange = "";
var $menu_sizechange = "";
var $menu_backchange = "";
var $menu_fontcolor = "";
var $menu_widthchange = "";
var $menu_highchange = "";
var $default_css = "";
//-----------------------------------------
// Constructor
//-----------------------------------------
function admin_template_functions()
{
$this->default_css = "font-family:Verdana;font-size:11pt;color:black;background-color:white;border:3px outset #555";
}
//-----------------------------------------
// Build generic editor
//-----------------------------------------
function build_generic_editor_area( $data )
{
global $ibforums, $std, $DB;
$return = "";
$return .= $this->html_build_editor_top();
$return .= "
<script language='javascript'>
<!--
var template_bit_ids = 'txt{$data['textareaname']}';
//-->
</script>
<div class='tableborder'>
<div class='titlemedium'>
<table width='100%' cellpadding='0' cellspacing='0' border='0'>
<tr>
<td width='1%' align='left' valign='middle'>
<input type='button' value='Float' class='realdarkbutton' title='Open this template editor in a large window' onclick=\"pop_win('act={$data['act']}&code=floateditor&id={$data['textareaname']}', 'Float', 800, 400)\">&nbsp;
</td>
<td width='95%' align='left' valign='middle'>&nbsp;<b>{$data['title']}</b></td>
<td width='5% align='right' valign='middle' nowrap='nowrap' ><!--TOP.RIGHT--></td>
</tr>
<!--TR.ROW-->
</table>
</div>";
$return .= "<div align='center' style='padding:2px;'>".$ibforums->adskin->form_textarea("txt{$data['textareaname']}", $data['textareainput'], $ibforums->vars['tx'], $ibforums->vars['ty'], 'none', "txt{$data['textareaname']}", $this->default_css )."</div>\n";
$return .= $this->html_build_editor_bottom();
return $return;
}
//-----------------------------------------
// Build editor text area table
//-----------------------------------------
function build_editor_area( $html, $template=array(), $img="" )
{
global $ibforums, $std, $DB;
$return = "";
$template['func_data'] = str_replace( "'", '&#039;', $template['func_data'] );
$spiffy_diffy = "<div align='center' style='position:absolute;width:99%;display:none;text-align:center' id='dv_{$template['suid']}'>
<table cellspacing='0' width='500' align='center' cellpadding='6' style='background:#EEE;border:2px outset #555;'>
<tr>
<td align='center' valign='top'>
<b>Advanced: Template Bit Incoming Variables</b><br />Leave alone if unsure. Separate many with a comma.
<br /><input class='textinput' name='funcdata_{$template['suid']}' value='{$template['func_data']}' type='text' size='50' />
<br /><br />
<input type='button' class='realdarkbutton' value='Save and Close' onclick=\"togglediv('dv_{$template['suid']}');\" />
</td>
</tr>
</table>
</div>";
$return .= "<div class='tableborder'>
<div class='titlemedium'>
<table width='100%' cellpadding='0' cellspacing='0' border='0'>
<tr>
<td width='1%' align='left' valign='middle'>
<input type='button' value='Float' class='realdarkbutton' title='Open this template editor in a large window' onclick=\"pop_win('act=templ&code=floateditor&id={$template['suid']}', 'Float{$template['suid']}', 800, 400)\">&nbsp;
</td>
<td width='95%' align='left' valign='middle'>&nbsp;{$img}<b>{$template['easy_name']}</b></td>
<td width='5% align='right' nowrap='nowrap' >
<input type='button' value='Macro Look-up' class='realbutton' title='View a macro definition' onClick='pop_win(\"act=rtempl&code=macro_one&suid={$template['suid']}\", \"MacroWindow\", 400, 200)'>
<input type='button' value='Compare' class='realbutton' title='Compare the edited version to the original' onClick='pop_win(\"act=rtempl&code=compare&suid={$template['suid']}\", \"CompareWindow\", 500,400)'>
<input type='button' value='Restore' class='realbutton' title='Restore the original, unedited template bit' onClick='restore(\"{$template['suid']}\",\"{$ibforums->input['expand']}\")'>
<input type='button' value='View Original' class='realbutton' title='View the HTML for the unedited template bit' onClick='pop_win(\"act=rtempl&code=preview&suid={$template['suid']}&type=html\", \"OriginalPreview\", 400,400)'>
<input type='button' value='Show Data Variables...' class='realdarkbutton' title='View and edit the incoming data variables for this template bit' onclick=\"toggleview('dv_{$template['suid']}')\"/>
&nbsp;
</td>
</tr>
</table>
$spiffy_diffy
</div>";
$return .= "<div align='center' style='padding:2px;'>".$ibforums->adskin->form_textarea("txt{$template['suid']}", $html, $ibforums->vars['tx'], $ibforums->vars['ty'], 'none', "t{$template['suid']}", $this->default_css )."</div>\n";
$return .= "</div>";
return $return;
}
//-----------------------------------------
// Build JS for floated window
//-----------------------------------------
function build_editor_area_floated($no_buttons=0)
{
global $ibforums, $std, $DB;
$return = "<form name='theform'>";
$return .= $this->html_build_editor_top();
$return .= "<div class='tableborder'>
<div class='titlemedium' align='right'>";
if ( $no_buttons == 0 )
{
$return .= "
<input type='button' value='Search' class='realbutton' title='Search the templates for a string' onClick='pop_win(\"act=rtempl&code=search&suid={$template['suid']}&type=html\", \"Search\", 500,400)'>
<input type='button' value='Macro Look-up' class='realbutton' title='View a macro definition' onClick='pop_win(\"code=macro_one&suid={$template['suid']}\", \"MacroWindow\", 400, 200)'>
<input type='button' value='Compare' class='realbutton' title='Compare the edited version to the original' onClick='pop_win(\"act=rtempl&code=compare&suid={$template['suid']}\", \"CompareWindow\", 500,400)'>
<input type='button' value='Restore' class='realbutton' title='Restore the original, unedited template bit' onClick='restore(\"{$template['suid']}\",\"{$ibforums->input['expand']}\")'>
<input type='button' value='View Original' class='realbutton' title='View the HTML for the unedited template bit' onClick='pop_win(\"act=rtempl&code=preview&suid={$template['suid']}&type=html\", \"OriginalPreview\", 400,400)'>
";
}
$return .= "</div>";
$return .= "<div align='center' style='padding:2px;'>".$ibforums->adskin->form_textarea("templatebit", $html, $ibforums->vars['tx'], $ibforums->vars['ty'], 'none', "templatebit", $this->default_css )."</div>\n";
$return .= "</div>";
$return .= "<script type='text/javascript'>
var template_id = '{$ibforums->input['id']}';
var template_bit = eval(\"opener.document.theform.txt\"+template_id+\".value\");
document.theform.templatebit.value = template_bit;
var template_bit_ids = 'templatebit';
function saveandclose()
{
eval(\"opener.document.theform.txt\"+template_id+\".value = document.theform.templatebit.value\");
window.close();
}
</script>
";
$return .= $this->html_build_editor_bottom();
$return .= "<br /><div class='tableborder'><div class='catrow2' align='center' style='padding:4px;'><input type='button' onclick='saveandclose()' value='Copy back to original textarea and close window' class='realdarkbutton' /></div></div></form>";
$ibforums->html = $return;
$ibforums->admin->print_popup();
}
//-----------------------------------------
// Build editor preferences menus
//-----------------------------------------
function build_editor_pref_menus()
{
global $ibforums, $std, $DB;
$this->menu_fontchange = "<select name='fontchange' class='smalldropdown'>
<option value='monaco'>Monaco</option>
<option value='courier'>Courier</option>
<option value='verdana'>Verdana</option>
<option value='arial'>Arial</option>
</select>";
$this->menu_sizechange = "<select name='sizechange' class='smalldropdown'>
<option value='8pt'>8pt</option>
<option value='9pt'>9pt</option>
<option value='10pt'>10pt</option>
<option value='11pt'>11pt</option>
<option value='12pt'>12pt</option>
</select>";
$this->menu_backchange = "<select name='backchange' class='smalldropdown'>
<option value='black'>Black</option>
<option value='white'>White</option>
<option value='#EEEEEE'>Light Gray</option>
<option value='gray'>Gray</option>
</select>";
$this->menu_fontcolor = "<select name='fontcolor' class='smalldropdown'>
<option value='black'>Black</option>
<option value='white'>White</option>
<option value='blue'>Blue</option>
<option value='lightgreen'>Light Green</option>
<option value='green'>Green</option>
<option value='darkgreen'>Dark Green</option>
<option value='gray'>Gray</option>
</select>";
$this->menu_widthchange = "<select name='widthchange' class='smalldropdown'>
<option value='100%'>100%</option>
<option value='90%'>90%</option>
<option value='80%'>80%</option>
<option value='70%'>70%</option>
<option value='60%'>60%</option>
<option value='50%'>50%</option>
</select>";
$this->menu_highchange = "<select name='highchange' class='smalldropdown'>
<option value='50px'>50px</option>
<option value='100px'>100px</option>
<option value='200px'>200px</option>
<option value='300px'>300px</option>
<option value='400px'>400px</option>
<option value='500px'>500px</option>
<option value='600px'>600px</option>
<option value='700px'>700px</option>
<option value='800px'>800px</option>
<option value='900px'>900px</option>
<option value='1000px'>1000px</option>
</select>";
if ( $cookie = $std->my_getcookie( 'acpeditorprefs' ) )
{
list( $font, $size, $bg, $fc, $width, $height ) = explode( "," ,$cookie );
$this->default_css = "font-family:$font;font-size:$size;color:$fc;background-color:$bg;width:$width;height:$height;border:3px outset #555";
$this->menu_fontchange = preg_replace( "/(option value='".preg_quote($font)."')/" , "\\1 selected='selected'", $this->menu_fontchange );
$this->menu_sizechange = preg_replace( "/(option value='".preg_quote($size)."')/" , "\\1 selected='selected'", $this->menu_sizechange );
$this->menu_backchange = preg_replace( "/(option value='".preg_quote($bg)."')/" , "\\1 selected='selected'", $this->menu_backchange );
$this->menu_fontcolor = preg_replace( "/(option value='".preg_quote($fc)."')/" , "\\1 selected='selected'", $this->menu_fontcolor );
$this->menu_widthchange = preg_replace( "/(option value='".preg_quote($width)."')/" , "\\1 selected='selected'", $this->menu_widthchange );
$this->menu_highchange = preg_replace( "/(option value='".preg_quote($height)."')/" , "\\1 selected='selected'", $this->menu_highchange );
}
}
function html_build_editor_top()
{
global $ibforums;
$this->build_editor_pref_menus();
return "
<script type='text/javascript'>
function toggleprefsmenu()
{
closedimage = '{$ibforums->skin_url}/editor_closed.gif';
openimage = '{$ibforums->skin_url}/editor_open.gif';
id = 'prefsbox';
if ( itm = my_getbyid(id) )
{
if (itm.style.display == \"none\")
{
my_show_div(itm);
document.images.edimage.src = openimage;
}
else
{
my_hide_div(itm);
document.images.edimage.src = closedimage;
}
}
}
</script>
<div class='tableborder'>
<div class='maintitle' align='left'><a href='#' onclick=\"toggleprefsmenu()\"><img id='edimage' src='{$ibforums->skin_url}/editor_closed.gif' border='0' alt='Editor Preferences' /></a>
<div style='border-left:1px solid #B1B1B1;border-right:1px solid #B1B1B1;border-bottom:1px solid #B1B1B1;width:181px;background:#FFF;display:none;position:absolute;' id='prefsbox'>
<table cellpadding='4' cellspacing='0' width='100%' border='0'>
<tr>
<td nowrap='nowrap'>Font Family</td>
<td width='100%'>{$this->menu_fontchange}</td>
</tr>
<tr>
<td nowrap='nowrap'>Font Size</td>
<td width='100%'>{$this->menu_sizechange}</td>
</tr>
<tr>
<td nowrap='nowrap'>Font Color</td>
<td width='100%'>{$this->menu_fontcolor}</td>
</tr>
<tr>
<td nowrap='nowrap'>Background</td>
<td width='100%'>{$this->menu_backchange}</td>
</tr>
<tr>
<td nowrap='nowrap'>Area Width</td>
<td width='100%'>{$this->menu_widthchange}</td>
</tr>
<tr>
<td nowrap='nowrap'>Area Height</td>
<td width='100%'>{$this->menu_highchange}</td>
</tr>
<tr>
<td colspan='2' align='center'>
<input type='button' value='Change' class='realbutton' onclick=\"toggleprefsmenu(); changefont();\" />
<input type='button' value=' X ' class='realdarkbutton' onclick=\"toggleprefsmenu();\" />
</td>
</tr>
</table>
</div>
</div>
<div class='tablepad'><!--BEFORETEXTAREA-->";
}
function html_build_editor_bottom()
{
return "<!--IPB.EDITORBOTTOM--></div>\n</div></div>";
}
}
?>
+1
View File
@@ -0,0 +1 @@
<html>␍<head><title>Invision Power Board - Bulletin Board System</title></head>␍<body>␍<h1>403: Invision Power Board -> Forbidden</h1>␍<hr>␍You have reached this Page in error, please use␍your back button to return to Invision Board.␍<hr>␍<a href="http://www.invisionboard.com/">Invision Power Board</a>␍</body>␍</html>␍
+190
View File
@@ -0,0 +1,190 @@
<?php
$css_names = array(
'BODY' => "Web Page Body",
'TABLE, TR, TD' => "Default table",
'a:link, a:visited, a:active' => "Default link",
'a:hover' => "Default link hover",
'.googlebottom, .googlebottom a:link, .googlebottom a:visited, .googlebottom a:active' => "Simple Search Results: Dark",
'.googlish, .googlish a:link, .googlish a:visited, .googlish a:active' => "Simple Search Results: Topic Link",
'.googlesmall, .googlesmall a:link, .googlesmall a:active, .googlesmall a:visited' => "Simple Search Results: Small Text",
'option.sub' => "Search Form: Select forums box: subcat colour",
'.caldate' => "Calendar: Date",
'#ucpmenu' => "User CP: Menu colour",
'#ucpcontent' => "User CP: Content colour",
'#logostrip' => "Board Header: Logo Strip",
'#submenu' => "Board Header: Icon Strip",
'#submenu a:link, #submenu a:visited, #submenu a:active' => "Board Header: Icon Strip link colours",
'#userlinks' => "Board Header: Member Bar",
'.activeuserstrip' => 'Forums & Topics: Active users bar',
'.pformstrip' => 'Global: Sub heading',
'.pformleft' => 'Global: left side table cell',
'.pformleftw' => 'Global: left side table cell wide',
'.pformright' => 'Global: right side table cell',
'.post1' => 'Post View: Alt colour #1',
'.post2' => 'Post View: Alt colour #2',
'.postlinksbar' => 'Post View: Track topic, etc links',
'.row1' => 'Global: Alt row #1',
'.row2' => 'Global: Alt row #2',
'.row3' => 'Global: Alt row #3',
'.row4' => 'Global: Alt row #4',
'.darkrow1' => 'Global: Alt dark row #1',
'.darkrow2' => 'Global: Alt dark row #2',
'.darkrow3' => 'Global: Alt dark row #3',
'.hlight' => 'Msgr: Inbox row selected',
'.dlight' => 'Msgr: Inbox row not selected',
'.titlemedium' => 'Global: Sub heading (minor)',
'.titlemedium a:link, .titlemedium a:visited, .titlemedium a:active' =>'Global: Sub heading (minor) Links',
'.maintitle' => 'Global: Main table heading',
'.maintitle a:link, .maintitle a:visited, .maintitle a:active' => 'Global: Main table heading Links',
'.plainborder' => 'Global: Table alt #1',
'.tableborder' => 'Global: Table cellspacing colour',
'.tablefill' => 'Global: Table alt #2',
'.tablepad' => 'Global: Table alt #3',
'.desc' => 'Forum View: Last post info',
'.signature' => 'Post View: Signature',
'.normalname' => 'Post View: Member name (reg)',
'.unreg' => 'Post View: Unreg name',
'.searchlite' => 'Global: Search highlighting',
'#QUOTE' => 'Quote Box',
'#CODE' => 'Code Box',
);
$skin_names = array(
'skin_boards' => array(
'Board Index',
'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',
'act=idx'
),
'skin_buddy' => array(
'MyAssistant',
'Elements for the myAssistant feature, including links and search boxes',
'act=buddy',
),
'skin_calendar'=> array(
'Calendar',
'Elements for the calendar, including calendar view, view events',
'act=calendar'
),
'skin_emails' => array(
'Member Contact',
'Elements from various contact methods, such as ICQ, AIM pager, email form and report post to moderator form',
'act=ICQ',
),
'skin_forum' => array(
'Forum Index',
'Elements for forum view (list all topics in forum). Includes forum log in window, forum rules',
'act=SF&f=1',
),
'skin_global' => array(
'All Global HTML',
'Various HTML elements such as board header, redirect page, error page',
),
'skin_help' => array(
'Help',
'Elements for the help screen, including search boxes and view help files',
'act=help'
),
'skin_legends' => array(
'Board Legends',
'Elements for the "view all emoticons" windows, and the "Find User"',
'act=legends'
),
'skin_login' => array(
'Log In',
'Elements for the log in form',
'act=Login'
),
'skin_mlist' => array(
'Member List',
'Elements for the member list views',
'act=Members'
),
'skin_mod' => array(
'Moderator Function',
'Elements for the moderator tools such as delete topic, edit topic and the moderator CP',
),
'skin_msg' => array(
'Messenger',
'Elements for the messenger, such as view inbox, view message, archive messages, etc',
'act=Msg',
),
'skin_online' => array (
'Online List',
'Elements for the "Show all online users" link',
'act=Online',
),
'skin_poll' => array (
'View Poll',
'Elements for the poll view, includes vote form and vote results',
),
'skin_post' => array(
'Post Screen',
'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',
),
'skin_printpage'=> array(
'Printable Topic',
'Elements for displaying the "printable topic" page',
),
'skin_profile' => array(
'Profile View',
'Elements for viewing a members profile',
'showuser=1',
),
'skin_register' => array(
'Register',
'Elements for the register form, validate account form and COPPA forms',
'act=Reg',
),
'skin_search' => array(
'Search',
'Elements for the search forum and the results view',
'act=Search',
),
'skin_stats' => array(
'Statistics',
'Elements for various functions such as "View Moderating Team", "View todays top 10 posts", "View Active Topics"',
'act=Stats',
),
'skin_topic' => array(
'Topic View',
'Elements for the topic view screen, such as post view, inline attachment view, etc.',
'showtopic=1'
),
'skin_modcp' => array(
'Mod CP',
'Elements for the moderators control panel sections.',
'act=ModCP',
),
'skin_portal' => array(
'IPB Portal',
'Elements for IPB Portal.',
),
'skin_ucp' => array(
'User Control Panel',
'Elements for the user control panel, such as the menu (also used in Messenger Views), edit profile, edit signature, edit avatar, etc.',
'act=UserCP',
),
'skin_subscriptions' => array(
'Subscriptions Manager (Retail Only)',
'Elements for the subscription manager.',
)
);
$bit_names = array();
?>