Version 1.3.0
This commit is contained in:
1 parent
7ef3d1712a
commit
f87d29ba65
290 files changed
+50206
-17930
No files matched your search
@@ -2,15 +2,17 @@
|
||||
|
||||
/*
|
||||
+--------------------------------------------------------------------------
|
||||
| Invision Board v1.1
|
||||
| Invision Power Board v1.3 Final
|
||||
| ========================================
|
||||
| by Matthew Mecham
|
||||
| (c) 2001,2002 Invision Power Services
|
||||
| http://www.ibforums.com
|
||||
| (c) 2001 - 2003 Invision Power Services
|
||||
| http://www.invisionpower.com
|
||||
| ========================================
|
||||
| Web: http://www.ibforums.com
|
||||
| Email: phpboards@ibforums.com
|
||||
| Licence Info: phpib-licence@ibforums.com
|
||||
| Web: http://www.invisionboard.com
|
||||
| Time: Sun, 04 Jan 2004 00:30:16 GMT
|
||||
| Release: 28e7bfb25f08ac72a789cb1b172fa185
|
||||
| Email: matt@invisionpower.com
|
||||
| Licence Info: http://www.invisionboard.com/?license
|
||||
+---------------------------------------------------------------------------
|
||||
|
|
||||
| > Admin functions library
|
||||
@@ -24,11 +26,14 @@
|
||||
class admin_functions {
|
||||
|
||||
var $img_url;
|
||||
var $page_title = "Welcome to the Invision Board Administration CP";
|
||||
var $page_title = "Welcome to the Invision Power Board Administration CP";
|
||||
var $page_detail = "You can set up and customize your board from within this control panel.<br><br>Clicking on one of the links in the left menu pane will show you the relevant options for that administration category. Each option will contain further information on configuration, etc.";
|
||||
var $html;
|
||||
var $errors = "";
|
||||
var $nav = array();
|
||||
var $time_offset = 0;
|
||||
var $jump_menu = "";
|
||||
var $no_jump = 0;
|
||||
|
||||
function admin_functions() {
|
||||
global $INFO, $IN;
|
||||
@@ -36,6 +41,61 @@ class admin_functions {
|
||||
$this->img_url = $INFO['html_url'].'/sys-img';
|
||||
$this->base_url = $INFO['board_url']."/admin.".$INFO['php_ext']."?adsess=".$IN['AD_SESS'];
|
||||
|
||||
}
|
||||
|
||||
//---------------------------
|
||||
// Makes good raw form text
|
||||
//----------------------------
|
||||
|
||||
function make_safe($t)
|
||||
{
|
||||
$t = stripslashes($t);
|
||||
|
||||
$t = preg_replace( "/\\\/", "\", $t );
|
||||
|
||||
return $t;
|
||||
}
|
||||
|
||||
//---------------------------
|
||||
// Sets up time offset for ACP use
|
||||
//----------------------------
|
||||
|
||||
|
||||
function get_date($date="", $method="")
|
||||
{
|
||||
global $INFO, $IN, $MEMBER;
|
||||
|
||||
$this->time_options = array( 'JOINED' => $INFO['clock_joined'],
|
||||
'SHORT' => $INFO['clock_short'],
|
||||
'LONG' => $INFO['clock_long']
|
||||
);
|
||||
|
||||
if (!$date)
|
||||
{
|
||||
return '--';
|
||||
}
|
||||
|
||||
if (empty($method))
|
||||
{
|
||||
$method = 'LONG';
|
||||
}
|
||||
|
||||
$this->time_offset = (($MEMBER['time_offset'] != "") ? $MEMBER['time_offset'] : $INFO['time_offset']) * 3600;
|
||||
|
||||
if ($INFO['time_adjust'] != "" and $INFO['time_adjust'] != 0)
|
||||
{
|
||||
$this->time_offset += ($INFO['time_adjust'] * 60);
|
||||
}
|
||||
|
||||
if ($MEMBER['dst_in_use'])
|
||||
{
|
||||
$this->time_offset += 3600;
|
||||
}
|
||||
|
||||
return gmdate($this->time_options[$method], ($date + $this->time_offset) );
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
//**********************************************/
|
||||
@@ -247,7 +307,7 @@ class admin_functions {
|
||||
|
||||
function rebuild_config( $new = "" )
|
||||
{
|
||||
global $IN, $std, $root_path;
|
||||
global $IN, $std, $ADMIN, $root_path;
|
||||
|
||||
//-----------------------------------------
|
||||
// Check to make sure this is a valid array
|
||||
@@ -272,7 +332,7 @@ class admin_functions {
|
||||
// (Imports $INFO)
|
||||
//-----------------------------------------
|
||||
|
||||
require $root_path.'conf_global.php';
|
||||
require ROOT_PATH.'conf_global.php';
|
||||
|
||||
//-----------------------------------------
|
||||
// Rebuild the $INFO hash
|
||||
@@ -292,13 +352,15 @@ class admin_functions {
|
||||
// Rename the old config file
|
||||
//-----------------------------------------
|
||||
|
||||
@rename( $root_path.'conf_global.php', $root_path.'conf_global-bak.php' );
|
||||
@chmod( $root_path.'conf_global-bak.php', 0777);
|
||||
@rename( ROOT_PATH.'conf_global.php', ROOT_PATH.'conf_global-bak.php' );
|
||||
@chmod( ROOT_PATH.'conf_global-bak.php', 0777);
|
||||
|
||||
//-----------------------------------------
|
||||
// Rebuild the old file
|
||||
//-----------------------------------------
|
||||
|
||||
ksort($INFO);
|
||||
|
||||
$file_string = "<?php\n";
|
||||
|
||||
foreach( $INFO as $k => $v )
|
||||
@@ -309,14 +371,15 @@ class admin_functions {
|
||||
$v = stripslashes($v);
|
||||
$v = addslashes($v);
|
||||
}
|
||||
|
||||
$file_string .= '$INFO['."'".$k."'".']'."\t\t\t=\t'".$v."';\n";
|
||||
}
|
||||
|
||||
$file_string .= "\n".'?'.'>'; // Question mark + greater than together break syntax hi-lighting in BBEdit 6 :p
|
||||
|
||||
if ( $fh = fopen( $root_path.'conf_global.php', 'w' ) )
|
||||
if ( $fh = fopen( ROOT_PATH.'conf_global.php', 'w' ) )
|
||||
{
|
||||
fputs ($fh, $file_string, strlen($file_string) );
|
||||
fwrite($fh, $file_string, strlen($file_string) );
|
||||
fclose($fh);
|
||||
}
|
||||
else
|
||||
@@ -364,39 +427,39 @@ class admin_functions {
|
||||
}
|
||||
|
||||
|
||||
$DB->query("SELECT g_id, g_title FROM ibf_groups ORDER BY g_id");
|
||||
$DB->query("SELECT perm_id, perm_name FROM ibf_forum_perms ORDER BY perm_id");
|
||||
|
||||
while ( $data = $DB->fetch_row() )
|
||||
{
|
||||
if ($r_array['READ'] != '*')
|
||||
{
|
||||
if ($IN[ 'READ_'.$data['g_id'] ] == 1)
|
||||
if ($IN[ 'READ_'.$data['perm_id'] ] == 1)
|
||||
{
|
||||
$r_array['READ'] .= $data['g_id'].",";
|
||||
$r_array['READ'] .= $data['perm_id'].",";
|
||||
}
|
||||
}
|
||||
//+----------------------------
|
||||
if ($r_array['REPLY'] != '*')
|
||||
{
|
||||
if ($IN[ 'REPLY_'.$data['g_id'] ] == 1)
|
||||
if ($IN[ 'REPLY_'.$data['perm_id'] ] == 1)
|
||||
{
|
||||
$r_array['REPLY'] .= $data['g_id'].",";
|
||||
$r_array['REPLY'] .= $data['perm_id'].",";
|
||||
}
|
||||
}
|
||||
//+----------------------------
|
||||
if ($r_array['START'] != '*')
|
||||
{
|
||||
if ($IN[ 'START_'.$data['g_id'] ] == 1)
|
||||
if ($IN[ 'START_'.$data['perm_id'] ] == 1)
|
||||
{
|
||||
$r_array['START'] .= $data['g_id'].",";
|
||||
$r_array['START'] .= $data['perm_id'].",";
|
||||
}
|
||||
}
|
||||
//+----------------------------
|
||||
if ($r_array['UPLOAD'] != '*')
|
||||
{
|
||||
if ($IN[ 'UPLOAD_'.$data['g_id'] ] == 1)
|
||||
if ($IN[ 'UPLOAD_'.$data['perm_id'] ] == 1)
|
||||
{
|
||||
$r_array['UPLOAD'] .= $data['g_id'].",";
|
||||
$r_array['UPLOAD'] .= $data['perm_id'].",";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -431,18 +494,12 @@ class admin_functions {
|
||||
$html .= "</head>\n";
|
||||
|
||||
$html .= "</head>
|
||||
<body marginheight='0' marginwidth='0' leftmargin='0' topmargin='0' bgcolor='#E7E7E7'>
|
||||
<table cellspacing='0' cellpadding='2' width='100%' align='center' border='0' bgcolor='#E7E7E7'>
|
||||
<tr>
|
||||
<td>
|
||||
<table cellspacing='3' cellpadding='2' width='100%' align='center' height='100%' border='0' bgcolor='#FFFFFF' style='border:thin solid black'>
|
||||
<tr>
|
||||
<td valign='top' bgcolor='#FFFFFF'>
|
||||
<table cellspacing='0' cellpadding='2' border='0' align='center' width='100%' height='100%' bgcolor='#FFFFFF'>";
|
||||
<body marginheight='0' marginwidth='0' leftmargin='0' topmargin='0' bgcolor='#FFFFFF'>
|
||||
";
|
||||
|
||||
$html .= $this->html;
|
||||
|
||||
$html .= "</table></td></tr></table></td></tr></table></body></html>";
|
||||
$html .= "</body></html>";
|
||||
|
||||
print $html;
|
||||
|
||||
@@ -461,10 +518,10 @@ class admin_functions {
|
||||
|
||||
$DB->close_db();
|
||||
|
||||
$navigation = array( "<a href='{$this->base_url}&act=index' target='body'>ACP Home</a>" );
|
||||
|
||||
if ( count($this->nav) > 0 )
|
||||
{
|
||||
$navigation = array( "<a href='{$this->base_url}&act=index' target='body'>ACP Home</a>" );
|
||||
|
||||
foreach ( $this->nav as $idx => $links )
|
||||
{
|
||||
if ($links[0] != "")
|
||||
@@ -476,16 +533,24 @@ class admin_functions {
|
||||
$navigation[] = $links[1];
|
||||
}
|
||||
}
|
||||
|
||||
if ( count($navigation) > 0 )
|
||||
{
|
||||
$html = str_replace( "<!--NAV-->", $SKIN->wrap_nav( implode( " -> ", $navigation ) ), $html );
|
||||
}
|
||||
}
|
||||
|
||||
if ( count($navigation) > 0 )
|
||||
{
|
||||
$html = str_replace( "<!--NAV-->", $SKIN->wrap_nav( implode( " -> ", $navigation ) ), $html );
|
||||
}
|
||||
|
||||
if ( $this->no_jump != 1 )
|
||||
{
|
||||
$html = str_replace( "<!--JUMP-->", $this->build_jump_menu(), $html );
|
||||
}
|
||||
|
||||
if ($use_gzip == 1)
|
||||
{
|
||||
ob_start ('ob_gzhandler');
|
||||
$buffer = ob_get_contents();
|
||||
ob_end_clean();
|
||||
ob_start('ob_gzhandler');
|
||||
print $buffer;
|
||||
}
|
||||
|
||||
//@header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
|
||||
@@ -508,10 +573,15 @@ class admin_functions {
|
||||
function error($error="", $is_popup=0) {
|
||||
global $IN, $INFO, $DB, $std, $SKIN, $HTTP_REFERER;
|
||||
|
||||
$this->page_title = "An Error Occured...";
|
||||
$this->page_detail = "The error message returned is displayed below.";
|
||||
$this->page_title = "Admin CP Message";
|
||||
$this->page_detail = " ";
|
||||
|
||||
$this->html .= "<tr><td><span style='font-size:14px'>$error</span><br><br><center><a href='$HTTP_REFERER'>Go Back</a></center></td></tr>";
|
||||
$this->html .= "<div class='tableborder'>
|
||||
<div class='maintitle'>Admin CP Message</div>
|
||||
<div class='tdrow1' style='padding:8px'>
|
||||
<span style='font-size:12px'>$error</span>
|
||||
</div>
|
||||
</div>";
|
||||
|
||||
if ($is_popup == 0)
|
||||
{
|
||||
@@ -580,12 +650,19 @@ class admin_functions {
|
||||
//**********************************************/
|
||||
|
||||
function menu() {
|
||||
global $IN, $std, $PAGES, $CATS, $SKIN;
|
||||
global $IN, $std, $INFO, $PAGES, $CATS, $SKIN;
|
||||
|
||||
$links = $this->build_tree();
|
||||
|
||||
$html = $SKIN->menu_top() . $links . $SKIN->menu_foot();
|
||||
|
||||
|
||||
// Saving cookie?
|
||||
|
||||
if ( $INFO['menu'] )
|
||||
{
|
||||
$std->my_setcookie( 'acpmenu', $IN['show'] );
|
||||
}
|
||||
|
||||
print $html;
|
||||
exit();
|
||||
|
||||
@@ -595,36 +672,86 @@ class admin_functions {
|
||||
//+------------------------------------------------
|
||||
|
||||
function build_tree() {
|
||||
global $IN, $std, $PAGES, $CATS, $SKIN, $DESC;
|
||||
global $IN, $std, $INFO, $PAGES, $CATS, $SKIN, $DESC;
|
||||
|
||||
$html = "";
|
||||
$links = "";
|
||||
|
||||
|
||||
foreach($CATS as $cid => $name)
|
||||
{
|
||||
|
||||
$ADMIN->jump_menu .= "<optgroup label='$name'>\n";
|
||||
|
||||
if ( preg_match( "/(?:^|,)$cid(?:,|$)/", $IN['show'] ) )
|
||||
{
|
||||
|
||||
foreach($PAGES[ $cid ] as $pid => $pdata)
|
||||
{
|
||||
$links .= $SKIN->menu_cat_link($pdata[1], $pdata[0]);
|
||||
}
|
||||
foreach($PAGES[ $cid ] as $pid => $pdata)
|
||||
{
|
||||
if ( $pdata[2] != "" )
|
||||
{
|
||||
if ( ! @is_dir( ROOT_PATH.$pdata[2] ) )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
$links .= $SKIN->menu_cat_link($pdata[1], $pdata[0], $pdata[3]);
|
||||
}
|
||||
|
||||
$html .= $SKIN->menu_cat_expanded( $name, $links, $cid );
|
||||
unset($links);
|
||||
|
||||
$html .= $SKIN->menu_cat_expanded( $name, $links, $cid );
|
||||
unset($links);
|
||||
}
|
||||
else
|
||||
{
|
||||
$html .= $SKIN->menu_cat_collapsed( $name, $cid, $DESC[ $cid ] );
|
||||
}
|
||||
|
||||
$ADMIN->jump_menu .= "</optgroup>\n";
|
||||
}
|
||||
|
||||
return $html;
|
||||
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------
|
||||
// BUILDS JUMP MENU, yay!
|
||||
//-------------------------------------------------------------
|
||||
|
||||
function build_jump_menu()
|
||||
{
|
||||
global $IN, $std, $PAGES, $CATS, $SKIN, $DESC;
|
||||
|
||||
$html = "<script type='text/javascript'>
|
||||
function dojump()
|
||||
{
|
||||
if ( document.jumpmenu.val.options[document.jumpmenu.val.selectedIndex].value != '' )
|
||||
{
|
||||
window.location.href = '{$this->base_url}' + '&' + document.jumpmenu.val.options[document.jumpmenu.val.selectedIndex].value;
|
||||
}
|
||||
}
|
||||
</script>
|
||||
";
|
||||
|
||||
$html .= "<form name='jumpmenu'>\n<select class='jmenu' name='val'>";
|
||||
|
||||
foreach($CATS as $cid => $name)
|
||||
{
|
||||
$html .= "<optgroup label='$name'>\n";
|
||||
|
||||
foreach($PAGES[ $cid ] as $pid => $pdata)
|
||||
{
|
||||
$html .= "<option value='$pdata[1]'>$pdata[0]</option>\n";
|
||||
}
|
||||
|
||||
$html .= "</optgroup>\n";
|
||||
}
|
||||
|
||||
$html .= "</select> <input type='button' class='jmenubutton' value='Go!' onclick='dojump();' />\n</form>";
|
||||
|
||||
return $html;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user