Version 1.0.1
This commit is contained in:
1 parent
227753f492
commit
aabfdc1f57
341 files changed
+55517
No files matched your search
@@ -0,0 +1,696 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
+--------------------------------------------------------------------------
|
||||
| IBFORUMS v1
|
||||
| ========================================
|
||||
| by Matthew Mecham and David Baxter
|
||||
| (c) 2001,2002 IBForums
|
||||
| http://www.ibforums.com
|
||||
| ========================================
|
||||
| Web: http://www.ibforums.com
|
||||
| Email: phpboards@ibforums.com
|
||||
| Licence Info: phpib-licence@ibforums.com
|
||||
+---------------------------------------------------------------------------
|
||||
|
|
||||
| > Admin Category functions
|
||||
| > Module written by Matt Mecham
|
||||
| > Date started: 1st march 2002
|
||||
|
|
||||
| > Module Version Number: 1.0.0
|
||||
+--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
|
||||
|
||||
$idx = new ad_cat();
|
||||
|
||||
|
||||
class ad_cat {
|
||||
|
||||
var $base_url;
|
||||
|
||||
function ad_cat() {
|
||||
global $IN, $root_path, $INFO, $DB, $SKIN, $ADMIN, $std, $MEMBER, $GROUP;
|
||||
|
||||
switch($IN['code'])
|
||||
{
|
||||
case 'new':
|
||||
$this->new_form();
|
||||
break;
|
||||
case 'donew':
|
||||
$this->do_new();
|
||||
break;
|
||||
//+-------------------------
|
||||
case 'edit':
|
||||
$this->show_cats();
|
||||
break;
|
||||
case 'doeditform':
|
||||
$this->edit_form();
|
||||
break;
|
||||
case 'doedit':
|
||||
$this->do_edit();
|
||||
break;
|
||||
//+-------------------------
|
||||
case 'remove':
|
||||
$this->remove_form();
|
||||
break;
|
||||
case 'doremove':
|
||||
$this->do_remove();
|
||||
break;
|
||||
//+-------------------------
|
||||
case 'reorder':
|
||||
$this->reorder_form(); //Get it? No... ok.
|
||||
break;
|
||||
case 'doreorder':
|
||||
$this->do_reorder();
|
||||
break;
|
||||
|
||||
default:
|
||||
$this->show_cats();
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
//+---------------------------------------------------------------------------------
|
||||
//
|
||||
// RE-ORDER CATEGORY
|
||||
//
|
||||
//+---------------------------------------------------------------------------------
|
||||
|
||||
function reorder_form() {
|
||||
global $IN, $root_path, $INFO, $DB, $SKIN, $ADMIN, $std, $MEMBER, $GROUP;
|
||||
|
||||
$ADMIN->page_title = "Category Re Order";
|
||||
$ADMIN->page_detail = "To re-order the categories, simply choose the position number from the drop down box next to each category title, when you are satisfied with the ordering, simply hit the submit button at the bottom of the form";
|
||||
|
||||
$ADMIN->html .= $SKIN->start_form( array( 1 => array( 'code' , 'doreorder'),
|
||||
2 => array( 'act' , 'cat' ),
|
||||
) );
|
||||
|
||||
|
||||
$SKIN->td_header[] = array( " " , "10%" );
|
||||
$SKIN->td_header[] = array( "Forum Name" , "60%" );
|
||||
$SKIN->td_header[] = array( "Posts" , "15%" );
|
||||
$SKIN->td_header[] = array( "Topics" , "15%" );
|
||||
|
||||
$ADMIN->html .= $SKIN->start_table( "Your Categories and Forums" );
|
||||
|
||||
$cats = array();
|
||||
$forums = array();
|
||||
|
||||
$DB->query("SELECT * from ibf_categories WHERE id > 0 ORDER BY position ASC");
|
||||
while ($r = $DB->fetch_row())
|
||||
{
|
||||
$cats[] = $r;
|
||||
}
|
||||
|
||||
$DB->query("SELECT * from ibf_forums ORDER BY position ASC");
|
||||
while ($r = $DB->fetch_row())
|
||||
{
|
||||
$forums[] = $r;
|
||||
}
|
||||
|
||||
|
||||
// Build up the drop down box
|
||||
|
||||
$form_array = array();
|
||||
|
||||
for ($i = 1 ; $i <= count($cats) ; $i++ )
|
||||
{
|
||||
$form_array[] = array( $i , $i );
|
||||
}
|
||||
|
||||
|
||||
$last_cat_id = -1;
|
||||
|
||||
foreach ($cats as $c)
|
||||
{
|
||||
|
||||
$ADMIN->html .= $SKIN->add_td_row( array( $SKIN->form_dropdown( 'POS_'.$c['id'], $form_array, $c['position'] ),
|
||||
$c['name'],
|
||||
' ',
|
||||
' ',
|
||||
), 'catrow' );
|
||||
$last_cat_id = $c['id'];
|
||||
|
||||
|
||||
foreach($forums as $r)
|
||||
{
|
||||
|
||||
if ($r['category'] == $last_cat_id)
|
||||
{
|
||||
$ADMIN->html .= $SKIN->add_td_row( array(
|
||||
' ',
|
||||
"<b>".$r['name']."</b><br>".$r['description'],
|
||||
$r['posts'],
|
||||
$r['topics'],
|
||||
) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$ADMIN->html .= $SKIN->end_form("Adjust Category Ordering");
|
||||
|
||||
$ADMIN->html .= $SKIN->end_table();
|
||||
|
||||
$ADMIN->output();
|
||||
|
||||
}
|
||||
|
||||
//+---------------------------------------------------------------------------------
|
||||
|
||||
function do_reorder() {
|
||||
global $IN, $root_path, $INFO, $DB, $SKIN, $ADMIN, $std, $MEMBER, $GROUP;
|
||||
|
||||
$cat_query = $DB->query("SELECT id from ibf_categories");
|
||||
|
||||
while ( $r = $DB->fetch_row($cat_query) )
|
||||
{
|
||||
$order_query = $DB->query("UPDATE ibf_categories SET position='".$IN[ 'POS_' . $r['id'] ]."' WHERE id='".$r['id']."'");
|
||||
}
|
||||
|
||||
$ADMIN->done_screen("Category Ordering Adjusted", "Category Control", "act=cat" );
|
||||
|
||||
}
|
||||
|
||||
|
||||
//+---------------------------------------------------------------------------------
|
||||
//
|
||||
// REMOVE CATEGORY
|
||||
//
|
||||
//+---------------------------------------------------------------------------------
|
||||
|
||||
function remove_form() {
|
||||
global $IN, $root_path, $INFO, $DB, $SKIN, $ADMIN, $std, $MEMBER, $GROUP;
|
||||
|
||||
$form_array = array();
|
||||
|
||||
if ($IN['c'] == "")
|
||||
{
|
||||
$ADMIN->error("Could not determine the category ID to update.");
|
||||
}
|
||||
|
||||
$DB->query("SELECT id, name FROM ibf_categories WHERE id > 0 ");
|
||||
|
||||
//+-------------------------------
|
||||
// Make sure we have more than 1
|
||||
// category..
|
||||
//+-------------------------------
|
||||
|
||||
if ($DB->get_num_rows() < 2)
|
||||
{
|
||||
$ADMIN->error("Can not remove this category, please create another before attempting to remove this one");
|
||||
}
|
||||
|
||||
while ( $r = $DB->fetch_row() )
|
||||
{
|
||||
if ($r['id'] == $IN['c'])
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
$form_array[] = array( $r['id'] , $r['name'] );
|
||||
}
|
||||
|
||||
//+-------------------------------
|
||||
// Get the details for this category...
|
||||
//+-------------------------------
|
||||
|
||||
$DB->query("SELECT * FROM ibf_categories WHERE id='".$IN['c']."'");
|
||||
$cat = $DB->fetch_row();
|
||||
|
||||
//+-------------------------------
|
||||
|
||||
$ADMIN->page_title = "Removing category '{$cat['name']}'";
|
||||
|
||||
$ADMIN->page_detail = "Before we remove this category, we need to determine what to do with any forums you may have left in this category.";
|
||||
|
||||
//+-------------------------------
|
||||
|
||||
$ADMIN->html .= $SKIN->start_form( array( 1 => array( 'code' , 'doremove'),
|
||||
2 => array( 'act' , 'cat' ),
|
||||
3 => array( 'c' , $IN['c'] ),
|
||||
) );
|
||||
|
||||
//+-------------------------------
|
||||
|
||||
$SKIN->td_header[] = array( " " , "40%" );
|
||||
$SKIN->td_header[] = array( " " , "60%" );
|
||||
|
||||
//+-------------------------------
|
||||
|
||||
$ADMIN->html .= $SKIN->start_table( "Required" );
|
||||
|
||||
$ADMIN->html .= $SKIN->add_td_row( array( "<b>Category to remove: </b>" , $cat['name'] ) );
|
||||
|
||||
$ADMIN->html .= $SKIN->add_td_row( array( "<b>Move all <i>existing forums in this category</i> to which category?</b>" ,
|
||||
$SKIN->form_dropdown( "MOVE_ID", $form_array )
|
||||
) );
|
||||
|
||||
$ADMIN->html .= $SKIN->end_form("Move forums and delete this category");
|
||||
|
||||
$ADMIN->html .= $SKIN->end_table();
|
||||
|
||||
$ADMIN->output();
|
||||
|
||||
|
||||
}
|
||||
|
||||
//+---------------------------------------------------------------------------------
|
||||
|
||||
function do_remove() {
|
||||
global $IN, $root_path, $INFO, $DB, $SKIN, $ADMIN, $std, $MEMBER, $GROUP;
|
||||
|
||||
if ($IN['c'] == "")
|
||||
{
|
||||
$ADMIN->error("Could not determine the source category ID.");
|
||||
}
|
||||
|
||||
if ($IN['MOVE_ID'] == "")
|
||||
{
|
||||
$ADMIN->error("Could not determine the destination category ID.");
|
||||
}
|
||||
|
||||
|
||||
$DB->query("UPDATE ibf_forums SET category='".$IN['MOVE_ID']."' WHERE category='".$IN['c']."'");
|
||||
|
||||
$DB->query("DELETE FROM ibf_categories WHERE id='".$IN['c']."'");
|
||||
|
||||
$ADMIN->done_screen("Category Removed", "Category Control", "act=cat" );
|
||||
|
||||
}
|
||||
|
||||
//+---------------------------------------------------------------------------------
|
||||
//
|
||||
// EDIT CATEGORY
|
||||
//
|
||||
//+---------------------------------------------------------------------------------
|
||||
|
||||
function edit_form() {
|
||||
global $IN, $root_path, $INFO, $DB, $SKIN, $ADMIN, $std, $MEMBER, $GROUP;
|
||||
|
||||
$subcats = array();
|
||||
|
||||
$DB->query("SELECT id, name FROM ibf_categories WHERE id > 0");
|
||||
|
||||
while ( $r = $DB->fetch_row() )
|
||||
{
|
||||
if ($r['id'] == $IN['c'])
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
$subcats[] = array( $r['id'] , $r['name'] );
|
||||
}
|
||||
|
||||
$DB->query("SELECT * FROM ibf_categories WHERE id='".$IN['c']."'");
|
||||
$cat = $DB->fetch_row();
|
||||
|
||||
$ADMIN->page_title = "Edit a category";
|
||||
|
||||
$ADMIN->page_detail = "This section will allow you to edit a new category. If you wish to add a category 'sponsor', simply enter the image URL and website URL
|
||||
in the appropriate section.";
|
||||
|
||||
//+-------------------------------
|
||||
|
||||
$ADMIN->html .= $SKIN->start_form( array( 1 => array( 'code' , 'doedit'),
|
||||
2 => array( 'VIEW' , '*' ),
|
||||
3 => array( 'act' , 'cat' ),
|
||||
4 => array( 'c' , $IN['c'] ),
|
||||
) );
|
||||
|
||||
//+-------------------------------
|
||||
|
||||
$SKIN->td_header[] = array( " " , "30%" );
|
||||
$SKIN->td_header[] = array( " " , "60%" );
|
||||
|
||||
//+-------------------------------
|
||||
|
||||
$ADMIN->html .= $SKIN->start_table( "Required" );
|
||||
|
||||
$ADMIN->html .= $SKIN->add_td_row( array( "<b>Category Name</b>" ,
|
||||
$SKIN->form_input("CAT_NAME", $cat['name'])
|
||||
) );
|
||||
|
||||
$ADMIN->html .= $SKIN->add_td_row( array( "<b>Category State</b>" ,
|
||||
$SKIN->form_dropdown( "CAT_STATE",
|
||||
array(
|
||||
0 => array( 1, 'Visible' ),
|
||||
1 => array( 0, 'Hidden' ),
|
||||
),
|
||||
$cat['state']
|
||||
)
|
||||
) );
|
||||
|
||||
$ADMIN->html .= $SKIN->end_table();
|
||||
|
||||
//+-------------------------------
|
||||
|
||||
$SKIN->td_header[] = array( " " , "30%" );
|
||||
$SKIN->td_header[] = array( " " , "60%" );
|
||||
|
||||
$ADMIN->html .= $SKIN->start_table( "Optional" );
|
||||
|
||||
$ADMIN->html .= $SKIN->add_td_row( array( "<b>Category Sponsor Image</b><br>(Example: http://www.domain.com/image.gif)" ,
|
||||
$SKIN->form_input("IMAGE", $cat['image'])
|
||||
) );
|
||||
|
||||
$ADMIN->html .= $SKIN->add_td_row( array( "<b>Category Sponsor Link</b><br>(Example: http://www.domain.com/)" ,
|
||||
$SKIN->form_input("URL", $cat['url'])
|
||||
) );
|
||||
|
||||
$ADMIN->html .= $SKIN->end_form("Amend this category");
|
||||
|
||||
$ADMIN->html .= $SKIN->end_table();
|
||||
|
||||
$ADMIN->output();
|
||||
|
||||
|
||||
}
|
||||
|
||||
//+---------------------------------------------------------------------------------
|
||||
|
||||
function do_edit() {
|
||||
global $IN, $root_path, $INFO, $DB, $SKIN, $ADMIN, $std, $MEMBER, $GROUP;
|
||||
|
||||
$IN['CAT_NAME'] = trim($IN['CAT_NAME']);
|
||||
|
||||
if ($IN['CAT_NAME'] == "")
|
||||
{
|
||||
$ADMIN->error("You must enter a category title");
|
||||
}
|
||||
|
||||
if ($IN['c'] == "")
|
||||
{
|
||||
$ADMIN->error("Could not determine the category ID to update.");
|
||||
}
|
||||
|
||||
$db_string = $DB->compile_db_update_string( array (
|
||||
'state' => $IN['CAT_STATE'],
|
||||
'name' => $IN['CAT_NAME'],
|
||||
'description' => $IN['CAT_DESC'],
|
||||
'image' => $IN['IMAGE'],
|
||||
'url' => $IN['URL'],
|
||||
) );
|
||||
|
||||
$DB->query("UPDATE ibf_categories SET $db_string WHERE id='".$IN['c']."'");
|
||||
|
||||
$ADMIN->done_screen("Category '{$IN['CAT_NAME']}' Edited", "Category Control", "act=cat" );
|
||||
|
||||
}
|
||||
|
||||
|
||||
//+---------------------------------------------------------------------------------
|
||||
//
|
||||
// SHOW CATS
|
||||
// Renders a complete listing of all the forums and categories.
|
||||
//
|
||||
//+---------------------------------------------------------------------------------
|
||||
|
||||
function show_cats() {
|
||||
global $IN, $root_path, $INFO, $DB, $SKIN, $ADMIN, $std, $MEMBER, $GROUP;
|
||||
|
||||
$ADMIN->page_title = "Category and Forums Overview";
|
||||
$ADMIN->page_detail = "This section will provide you with a category and forums overview allowing you to make fast changes to the category/forums set up and information.".
|
||||
"<br><table cellpadding='3' cellspacing='0' border='0' align='left' width='100%'>".
|
||||
"<tr><td><b>Edit Settings</b></td><td>This allows you to edit the forum settings</td></tr>".
|
||||
"<tr><td><b>Delete</b></td><td>This will remove the forum and move the posts and topics to a forum of your choice</td></tr>".
|
||||
"<tr><td><b>Empty</b></td><td>This will remove all topics and posts in this forum - a confirmation screen is displayed</td></tr>".
|
||||
"<tr><td><b>Edit Permissions</b></td><td>This allows you to edit the forum access abilities for all groups in this forum</td></tr>".
|
||||
"<tr><td><img src='{$SKIN->img_url}/acp_rules.gif' border='0' align='absmiddle'></td><td><b>Forum Rules</b> This allows you to add/edit or remove rules for this forum</td></tr>".
|
||||
"<tr><td><img src='{$SKIN->img_url}/acp_edit.gif' border='0' align='absmiddle'></td><td><b>Skin Options</b> This allows you to add/edit or remove a skin for this forum</td></tr>".
|
||||
"<tr><td><img src='{$SKIN->img_url}/acp_resync.gif' border='0' align='absmiddle'></td><td><b>Resynchronise</b> This allows you to recount the forum posts, topics and last post information</td></tr>".
|
||||
"</table>";
|
||||
|
||||
$cats = array();
|
||||
$forums = array();
|
||||
$children = array();
|
||||
$skins = array();
|
||||
|
||||
$DB->query("SELECT * from ibf_categories WHERE id > 0 ORDER BY position ASC");
|
||||
while ($r = $DB->fetch_row())
|
||||
{
|
||||
$cats[$r['id']] = $r;
|
||||
}
|
||||
|
||||
$DB->query("SELECT * from ibf_forums ORDER BY position ASC");
|
||||
while ($r = $DB->fetch_row())
|
||||
{
|
||||
|
||||
if ($r['parent_id'] > 0)
|
||||
{
|
||||
$children[ $r['parent_id'] ][] = $r;
|
||||
}
|
||||
else
|
||||
{
|
||||
$forums[] = $r;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$DB->query("SELECT uid, sname, sid FROM ibf_skins");
|
||||
while ($s = $DB->fetch_row())
|
||||
{
|
||||
$skins[$s['sid']] = $s['sname'];
|
||||
}
|
||||
|
||||
$SKIN->td_header[] = array( " " , "5%" );
|
||||
$SKIN->td_header[] = array( "Forum Name" , "30%" );
|
||||
$SKIN->td_header[] = array( "Posts" , "10%" );
|
||||
$SKIN->td_header[] = array( "Topics" , "10%" );
|
||||
$SKIN->td_header[] = array( " " , "15%" );
|
||||
$SKIN->td_header[] = array( " " , "15%" );
|
||||
$SKIN->td_header[] = array( " " , "15%" );
|
||||
|
||||
$ADMIN->html .= $SKIN->start_table("Your Categories and Forums");
|
||||
|
||||
$last_cat_id = -1;
|
||||
|
||||
foreach ($cats as $c)
|
||||
{
|
||||
|
||||
|
||||
$ADMIN->html .= $SKIN->add_td_row( array(
|
||||
array($c['name'], 2),
|
||||
' ',
|
||||
' ',
|
||||
"<a href='{$ADMIN->base_url}&act=cat&code=doeditform&c={$c['id']}'>Edit</a>",
|
||||
' ',
|
||||
"<a href='{$ADMIN->base_url}&act=cat&code=remove&c={$c['id']}'>Delete</a>",
|
||||
), 'catrow' );
|
||||
$last_cat_id = $c['id'];
|
||||
|
||||
|
||||
foreach($forums as $r)
|
||||
{
|
||||
|
||||
if ($r['category'] == $last_cat_id)
|
||||
{
|
||||
|
||||
if ( ($r['skin_id'] != "") and ($r['skin_id'] >= 0) )
|
||||
{
|
||||
$skin_stuff = "<br>[ "."Using Skin Set: ".$skins[$r['skin_id']]." ]";
|
||||
}
|
||||
else
|
||||
{
|
||||
$skin_stuff = "";
|
||||
}
|
||||
|
||||
if ($r['subwrap'] == 1)
|
||||
{
|
||||
|
||||
$ADMIN->html .= $SKIN->add_td_row( array(
|
||||
" >",
|
||||
"<b>".$r['name']."</b>$skin_stuff",
|
||||
"-",
|
||||
"-",
|
||||
"<a href='{$ADMIN->base_url}&act=forum&code=subedit&f={$r['id']}'>Edit</a>",
|
||||
"<a href='{$ADMIN->base_url}&act=forum&code=skinedit&f={$r['id']}'>Skin Options</a>",
|
||||
"<a href='{$ADMIN->base_url}&act=forum&code=subdelete&f={$r['id']}'>Delete</a>",
|
||||
) , 'catrow2' );
|
||||
}
|
||||
else
|
||||
{
|
||||
$ADMIN->html .= $SKIN->add_td_row( array(
|
||||
array("<b>".$r['name']."</b>$skin_stuff<br>".$r['description'], 2),
|
||||
$r['posts'],
|
||||
$r['topics'],
|
||||
"<a href='{$ADMIN->base_url}&act=forum&code=edit&f={$r['id']}'>Edit Settings</a><br><br>".
|
||||
"<a href='{$ADMIN->base_url}&act=forum&code=pedit&f={$r['id']}'>Edit Permissions</a>",
|
||||
|
||||
"<center><a href='{$ADMIN->base_url}&act=forum&code=frules&f={$r['id']}'><img src='{$SKIN->img_url}/acp_rules.gif' border='0' title='Forum Rules'></a> ".
|
||||
"<a href='{$ADMIN->base_url}&act=forum&code=skinedit&f={$r['id']}'><img src='{$SKIN->img_url}/acp_edit.gif' border='0' title='Skin Options'></a> ".
|
||||
"<a href='{$ADMIN->base_url}&act=forum&code=recount&f={$r['id']}'><img src='{$SKIN->img_url}/acp_resync.gif' border='0' title='Resynchronise'></a></center>",
|
||||
|
||||
"<a href='{$ADMIN->base_url}&act=forum&code=delete&f={$r['id']}'>Delete</a><br><br>".
|
||||
"<a href='{$ADMIN->base_url}&act=forum&code=empty&f={$r['id']}'>Empty Forum</a>",
|
||||
) );
|
||||
}
|
||||
|
||||
if ( ( isset($children[ $r['id'] ]) ) and ( count ($children[ $r['id'] ]) > 0 ) )
|
||||
{
|
||||
foreach($children[ $r['id'] ] as $idx => $rd)
|
||||
{
|
||||
|
||||
if ( ($rd['skin_id'] != "") and ($rd['skin_id'] >= 0) )
|
||||
{
|
||||
$skin_stuff = "<br>[ "."Using Skin Set: ".$skins[$rd['skin_id']]." ]";
|
||||
}
|
||||
else
|
||||
{
|
||||
$skin_stuff = "";
|
||||
}
|
||||
|
||||
$ADMIN->html .= $SKIN->add_td_row( array(
|
||||
" >",
|
||||
"<b>".$rd['name']."</b>$skin_stuff<br>".$rd['description'],
|
||||
$rd['posts'],
|
||||
$rd['topics'],
|
||||
"<a href='{$ADMIN->base_url}&act=forum&code=edit&f={$rd['id']}'>Edit Settings</a><br><br>".
|
||||
"<a href='{$ADMIN->base_url}&act=forum&code=pedit&f={$rd['id']}'>Edit Permissions</a>",
|
||||
"<center><a href='{$ADMIN->base_url}&act=forum&code=frules&f={$rd['id']}'><img src='{$SKIN->img_url}/acp_rules.gif' border='0' title='Forum Rules'></a> ".
|
||||
"<a href='{$ADMIN->base_url}&act=forum&code=skinedit&f={$rd['id']}'><img src='{$SKIN->img_url}/acp_edit.gif' border='0' title='Skin Options'></a> ".
|
||||
"<a href='{$ADMIN->base_url}&act=forum&code=recount&f={$rd['id']}'><img src='{$SKIN->img_url}/acp_resync.gif' border='0' title='Resynchronise'></a></center>",
|
||||
"<a href='{$ADMIN->base_url}&act=forum&code=delete&f={$rd['id']}'>Delete</a><br><br>".
|
||||
"<a href='{$ADMIN->base_url}&act=forum&code=empty&f={$rd['id']}'>Empty Forum</a>",
|
||||
) , 'subforum' );
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$ADMIN->html .= $SKIN->end_table();
|
||||
|
||||
$ADMIN->output();
|
||||
|
||||
}
|
||||
|
||||
//+---------------------------------------------------------------------------------
|
||||
//
|
||||
// NEW CATEGORY
|
||||
//
|
||||
//+---------------------------------------------------------------------------------
|
||||
|
||||
function new_form() {
|
||||
global $IN, $root_path, $INFO, $DB, $SKIN, $ADMIN, $std, $MEMBER, $GROUP, $HTTP_GET_VARS;
|
||||
|
||||
$cat_name = "";
|
||||
|
||||
if ($HTTP_GET_VARS['name'] != "")
|
||||
{
|
||||
$cat_name = stripslashes(urldecode($HTTP_GET_VARS['name']));
|
||||
}
|
||||
|
||||
$ADMIN->page_title = "Add a new category";
|
||||
|
||||
$ADMIN->page_detail = "This section will allow you to add a new category to your forums. If you wish to add a category 'sponsor', simply enter the image URL and website URL
|
||||
in the appropriate section.";
|
||||
|
||||
//+-------------------------------
|
||||
|
||||
$ADMIN->html .= $SKIN->start_form( array( 1 => array( 'code' , 'donew'),
|
||||
2 => array( 'act' , 'cat' ),
|
||||
) );
|
||||
|
||||
//+-------------------------------
|
||||
|
||||
$SKIN->td_header[] = array( " " , "30%" );
|
||||
$SKIN->td_header[] = array( " " , "60%" );
|
||||
|
||||
//+-------------------------------
|
||||
|
||||
$ADMIN->html .= $SKIN->start_table( "Required" );
|
||||
|
||||
$ADMIN->html .= $SKIN->add_td_row( array( "<b>Category Name</b>" ,
|
||||
$SKIN->form_input("CAT_NAME", $cat_name)
|
||||
) );
|
||||
|
||||
$ADMIN->html .= $SKIN->add_td_row( array( "<b>Category State</b>" ,
|
||||
$SKIN->form_dropdown( "CAT_STATE",
|
||||
array(
|
||||
0 => array( 1, 'Visible' ),
|
||||
1 => array( 0, 'Hidden' ),
|
||||
),
|
||||
"1"
|
||||
)
|
||||
) );
|
||||
|
||||
$ADMIN->html .= $SKIN->end_table();
|
||||
|
||||
//+-------------------------------
|
||||
|
||||
$SKIN->td_header[] = array( " " , "30%" );
|
||||
$SKIN->td_header[] = array( " " , "60%" );
|
||||
|
||||
$ADMIN->html .= $SKIN->start_table( "Optional" );
|
||||
|
||||
$ADMIN->html .= $SKIN->add_td_row( array( "<b>Category Sponsor Image</b><br>(Example: http://www.domain.com/image.gif)" ,
|
||||
$SKIN->form_input("IMAGE")
|
||||
) );
|
||||
|
||||
$ADMIN->html .= $SKIN->add_td_row( array( "<b>Category Sponsor Link</b><br>(Example: http://www.domain.com/)" ,
|
||||
$SKIN->form_input("URL")
|
||||
) );
|
||||
|
||||
$ADMIN->html .= $SKIN->end_form("Create this category");
|
||||
|
||||
$ADMIN->html .= $SKIN->end_table();
|
||||
|
||||
$ADMIN->output();
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
//+---------------------------------------------------------------------------------
|
||||
|
||||
function do_new() {
|
||||
global $IN, $root_path, $INFO, $DB, $SKIN, $ADMIN, $std, $MEMBER, $GROUP;
|
||||
|
||||
$IN['CAT_NAME'] = trim($IN['CAT_NAME']);
|
||||
|
||||
if ($IN['CAT_NAME'] == "")
|
||||
{
|
||||
$ADMIN->error("You must enter a category title");
|
||||
}
|
||||
|
||||
// Get the new cat id. We could use auto_incrememnt, but we need the ID to use as the default
|
||||
// category position...
|
||||
|
||||
$DB->query("SELECT MAX(id) as top_cat FROM ibf_categories"); //ooh, top cat - he's the leader of our gang..
|
||||
$row = $DB->fetch_row();
|
||||
|
||||
if ($row['top_cat'] < 1) $row['top_cat'] = 0;
|
||||
|
||||
$row['top_cat']++;
|
||||
|
||||
$db_string = $DB->compile_db_insert_string( array (
|
||||
'id' => $row['top_cat'],
|
||||
'position' => $row['top_cat'],
|
||||
'state' => $IN['CAT_STATE'],
|
||||
'name' => $IN['CAT_NAME'],
|
||||
'description' => $IN['CAT_DESC'],
|
||||
'image' => $IN['IMAGE'],
|
||||
'url' => $IN['URL'],
|
||||
) );
|
||||
|
||||
$DB->query("INSERT INTO ibf_categories (".$db_string['FIELD_NAMES'].") VALUES (".$db_string['FIELD_VALUES'].")");
|
||||
|
||||
$ADMIN->done_screen("Category {$IN['CAT_NAME']} created", "Category Control", "act=cat" );
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,273 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
+--------------------------------------------------------------------------
|
||||
| IBFORUMS v1
|
||||
| ========================================
|
||||
| by Matthew Mecham and David Baxter
|
||||
| (c) 2001,2002 IBForums
|
||||
| http://www.ibforums.com
|
||||
| ========================================
|
||||
| Web: http://www.ibforums.com
|
||||
| Email: phpboards@ibforums.com
|
||||
| Licence Info: phpib-licence@ibforums.com
|
||||
+---------------------------------------------------------------------------
|
||||
|
|
||||
| > Help Control functions
|
||||
| > Module written by Matt Mecham
|
||||
| > Date started: 2nd April 2002
|
||||
|
|
||||
| > Module Version Number: 1.0.0
|
||||
+--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
$idx = new ad_settings();
|
||||
|
||||
|
||||
class ad_settings {
|
||||
|
||||
var $base_url;
|
||||
|
||||
function ad_settings() {
|
||||
global $IN, $root_path, $INFO, $DB, $SKIN, $ADMIN, $std, $MEMBER, $GROUP;
|
||||
|
||||
switch($IN['code'])
|
||||
{
|
||||
case 'edit':
|
||||
$this->show_form('edit');
|
||||
break;
|
||||
case 'new':
|
||||
$this->show_form('new');
|
||||
break;
|
||||
|
||||
case 'doedit':
|
||||
$this->doedit();
|
||||
break;
|
||||
|
||||
case 'donew':
|
||||
$this->doadd();
|
||||
break;
|
||||
|
||||
case 'remove':
|
||||
$this->remove();
|
||||
break;
|
||||
|
||||
//-------------------------
|
||||
default:
|
||||
$this->list_files();
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------
|
||||
// HELP FILE FUNCTIONS
|
||||
//-------------------------------------------------------------
|
||||
|
||||
function doedit()
|
||||
{
|
||||
global $IN, $root_path, $INFO, $DB, $SKIN, $ADMIN, $std, $MEMBER, $GROUP, $HTTP_POST_VARS;
|
||||
|
||||
if ($IN['id'] == "")
|
||||
{
|
||||
$ADMIN->error("You must pass a valid emoticon id, silly!");
|
||||
}
|
||||
|
||||
$text = preg_replace( "/\n/", "<br>", stripslashes($HTTP_POST_VARS['text'] ) );
|
||||
$title = preg_replace( "/\n/", "<br>", stripslashes($HTTP_POST_VARS['title'] ) );
|
||||
$desc = preg_replace( "/\n/", "<br>", stripslashes($HTTP_POST_VARS['description'] ) );
|
||||
|
||||
$db_string = $DB->compile_db_update_string( array( 'title' => $title,
|
||||
'text' => $text,
|
||||
'description' => $desc,
|
||||
) );
|
||||
|
||||
$DB->query("UPDATE ibf_faq SET $db_string WHERE id='".$IN['id']."'");
|
||||
|
||||
$std->boink_it($SKIN->base_url."&act=help");
|
||||
exit();
|
||||
|
||||
|
||||
}
|
||||
|
||||
//=====================================================
|
||||
|
||||
|
||||
function show_form($type='new')
|
||||
{
|
||||
global $IN, $root_path, $INFO, $DB, $SKIN, $ADMIN, $std, $MEMBER, $GROUP;
|
||||
|
||||
$ADMIN->page_detail = "You may add/edit and remove help files below.";
|
||||
$ADMIN->page_title = "Help File Management";
|
||||
|
||||
//+-------------------------------
|
||||
|
||||
if ($type != 'new')
|
||||
{
|
||||
|
||||
if ($IN['id'] == "")
|
||||
{
|
||||
$ADMIN->error("You must pass a valid help file id, silly!");
|
||||
}
|
||||
|
||||
//+-------------------------------
|
||||
|
||||
$DB->query("SELECT * FROM ibf_faq WHERE id='".$IN['id']."'");
|
||||
|
||||
if ( ! $r = $DB->fetch_row() )
|
||||
{
|
||||
$ADMIN->error("We could not find that help file in the database");
|
||||
}
|
||||
|
||||
//+-------------------------------
|
||||
|
||||
$button = 'Edit this Help File';
|
||||
$code = 'doedit';
|
||||
}
|
||||
else
|
||||
{
|
||||
$r = array();
|
||||
$button = 'Add this Help File';
|
||||
$code = 'donew';
|
||||
}
|
||||
|
||||
$ADMIN->html .= $SKIN->start_form( array( 1 => array( 'code' , $code ),
|
||||
2 => array( 'act' , 'help' ),
|
||||
3 => array( 'id' , $IN['id'] ),
|
||||
) );
|
||||
|
||||
|
||||
|
||||
$SKIN->td_header[] = array( " " , "20%" );
|
||||
$SKIN->td_header[] = array( " " , "80%" );
|
||||
|
||||
$r['text'] = preg_replace( "/<br>/i", "\n", stripslashes($r['text']) );
|
||||
|
||||
//+-------------------------------
|
||||
|
||||
$ADMIN->html .= $SKIN->start_table( $button );
|
||||
|
||||
|
||||
$ADMIN->html .= $SKIN->add_td_row( array( "Help File Title",
|
||||
$SKIN->form_input('title' , stripslashes($r['title']) ),
|
||||
) );
|
||||
|
||||
$ADMIN->html .= $SKIN->add_td_row( array( "Help File Description",
|
||||
$SKIN->form_textarea('description', stripslashes($r['description']) ),
|
||||
) );
|
||||
|
||||
$ADMIN->html .= $SKIN->add_td_row( array( "Help File Text",
|
||||
$SKIN->form_textarea('text', $r['text'], "60", "10" ),
|
||||
) );
|
||||
|
||||
$ADMIN->html .= $SKIN->end_form($button);
|
||||
|
||||
$ADMIN->html .= $SKIN->end_table();
|
||||
|
||||
$ADMIN->output();
|
||||
|
||||
}
|
||||
|
||||
//=====================================================
|
||||
|
||||
function remove()
|
||||
{
|
||||
global $IN, $root_path, $INFO, $DB, $SKIN, $ADMIN, $std, $MEMBER, $GROUP;
|
||||
|
||||
if ($IN['id'] == "")
|
||||
{
|
||||
$ADMIN->error("You must pass a valid help file id, silly!");
|
||||
}
|
||||
|
||||
$DB->query("DELETE FROM ibf_faq WHERE id='".$IN['id']."'");
|
||||
|
||||
$std->boink_it($SKIN->base_url."&act=help");
|
||||
exit();
|
||||
|
||||
|
||||
}
|
||||
|
||||
//=====================================================
|
||||
|
||||
function doadd()
|
||||
{
|
||||
global $IN, $root_path, $INFO, $DB, $SKIN, $ADMIN, $std, $MEMBER, $GROUP, $HTTP_POST_VARS;
|
||||
|
||||
if ($IN['title'] == "")
|
||||
{
|
||||
$ADMIN->error("You must enter a title, silly!");
|
||||
}
|
||||
|
||||
|
||||
|
||||
$text = preg_replace( "/\n/", "<br>", stripslashes($HTTP_POST_VARS['text'] ) );
|
||||
$title = preg_replace( "/\n/", "<br>", stripslashes($HTTP_POST_VARS['title'] ) );
|
||||
$desc = preg_replace( "/\n/", "<br>", stripslashes($HTTP_POST_VARS['description'] ) );
|
||||
|
||||
$db_string = $DB->compile_db_insert_string( array( 'title' => $title,
|
||||
'text' => $text,
|
||||
'description' => $desc,
|
||||
) );
|
||||
|
||||
$DB->query("INSERT INTO ibf_faq (".$db_string['FIELD_NAMES'].") VALUES(".$db_string['FIELD_VALUES'].")");
|
||||
|
||||
$std->boink_it($SKIN->base_url."&act=help");
|
||||
exit();
|
||||
|
||||
|
||||
}
|
||||
|
||||
//=====================================================
|
||||
|
||||
function list_files()
|
||||
{
|
||||
global $IN, $root_path, $INFO, $DB, $SKIN, $ADMIN, $std, $MEMBER, $GROUP;
|
||||
|
||||
$ADMIN->page_detail = "You may add/edit and remove help files below.";
|
||||
$ADMIN->page_title = "Help File Management";
|
||||
|
||||
//+-------------------------------
|
||||
|
||||
$SKIN->td_header[] = array( "Title" , "50%" );
|
||||
$SKIN->td_header[] = array( "Edit" , "30%" );
|
||||
$SKIN->td_header[] = array( "Remove" , "20%" );
|
||||
|
||||
//+-------------------------------
|
||||
|
||||
$ADMIN->html .= $SKIN->start_table( "Current Help Files" );
|
||||
|
||||
$DB->query("SELECT * from ibf_faq ORDER BY id ASC");
|
||||
|
||||
if ( $DB->get_num_rows() )
|
||||
{
|
||||
while ( $r = $DB->fetch_row() )
|
||||
{
|
||||
|
||||
$ADMIN->html .= $SKIN->add_td_row( array( "<b>".stripslashes($r['title'])."</b><br>".stripslashes($r['description']),
|
||||
"<center><a href='".$SKIN->base_url."&act=help&code=edit&id={$r['id']}'>Edit</a></center>",
|
||||
"<center><a href='".$SKIN->base_url."&act=help&code=remove&id={$r['id']}'>Remove</a></center>",
|
||||
) );
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
$ADMIN->html .= $SKIN->add_td_basic("<a href='".$SKIN->base_url."&act=help&code=new'>Add New Help File</a>", "center", "title" );
|
||||
|
||||
$ADMIN->html .= $SKIN->end_table();
|
||||
|
||||
//+-------------------------------
|
||||
|
||||
$ADMIN->output();
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,605 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
+--------------------------------------------------------------------------
|
||||
| IBFORUMS v1
|
||||
| ========================================
|
||||
| by Matthew Mecham and David Baxter
|
||||
| (c) 2001,2002 IBForums
|
||||
| http://www.ibforums.com
|
||||
| ========================================
|
||||
| Web: http://www.ibforums.com
|
||||
| Email: phpboards@ibforums.com
|
||||
| Licence Info: phpib-licence@ibforums.com
|
||||
+---------------------------------------------------------------------------
|
||||
|
|
||||
| > Skin -> Image Macro functions
|
||||
| > Module written by Matt Mecham
|
||||
| > Date started: 4th April 2002
|
||||
|
|
||||
| > Module Version Number: 1.0.0
|
||||
+--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
$idx = new ad_settings();
|
||||
|
||||
|
||||
class ad_settings {
|
||||
|
||||
var $base_url;
|
||||
|
||||
function ad_settings() {
|
||||
global $IN, $root_path, $INFO, $DB, $SKIN, $ADMIN, $std, $MEMBER, $GROUP;
|
||||
|
||||
switch($IN['code'])
|
||||
{
|
||||
case 'wrapper':
|
||||
$this->list_current();
|
||||
break;
|
||||
|
||||
case 'add':
|
||||
$this->add_images();
|
||||
break;
|
||||
|
||||
case 'edit':
|
||||
$this->do_form('edit');
|
||||
break;
|
||||
|
||||
case 'doadd':
|
||||
$this->save_wrapper('add');
|
||||
break;
|
||||
|
||||
case 'doedit':
|
||||
$this->save_wrapper('edit');
|
||||
break;
|
||||
|
||||
case 'remove':
|
||||
$this->remove();
|
||||
break;
|
||||
|
||||
case 'export':
|
||||
$this->export();
|
||||
|
||||
//-------------------------
|
||||
default:
|
||||
$this->list_current();
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
function export()
|
||||
{
|
||||
global $IN, $root_path, $INFO, $DB, $SKIN, $ADMIN, $std, $MEMBER, $GROUP;
|
||||
|
||||
if ($IN['id'] == "")
|
||||
{
|
||||
$ADMIN->error("You must specify an existing image set ID, go back and try again");
|
||||
}
|
||||
|
||||
//+-------------------------------
|
||||
|
||||
$DB->query("SELECT * from ibf_images WHERE imid='".$IN['id']."'");
|
||||
|
||||
if ( ! $row = $DB->fetch_row() )
|
||||
{
|
||||
$ADMIN->error("Could not query the information from the database");
|
||||
}
|
||||
|
||||
//+-------------------------------
|
||||
|
||||
$archive_dir = $INFO['base_dir']."/archive_out";
|
||||
$images_dir = $INFO['base_dir']."/style_images/".$row['imid'];
|
||||
|
||||
require $root_dir."sources/lib/tar.php";
|
||||
|
||||
if (!is_dir($archive_dir))
|
||||
{
|
||||
$ADMIN->error("Could not locate $archive_dir, is the directory there?");
|
||||
}
|
||||
|
||||
if (!is_writeable($archive_dir))
|
||||
{
|
||||
$ADMIN->error("Cannot write in $archive_dir, CHMOD via FTP to 0755 or 0777 to enable this script to write into it. IBF cannot do this for you");
|
||||
}
|
||||
|
||||
if (!is_dir($images_dir))
|
||||
{
|
||||
$ADMIN->error("Could not locate $images_dir, is the directory there?");
|
||||
}
|
||||
|
||||
//+-------------------------------
|
||||
// Attempt to copy the files to the
|
||||
// working directory...
|
||||
//+-------------------------------
|
||||
|
||||
$l_name = preg_replace( "/\s{1,}/", "_", $row['setname'] );
|
||||
|
||||
$new_dir = "image-".$l_name;
|
||||
|
||||
if ( ! $ADMIN->copy_dir($images_dir, $archive_dir."/".$new_dir) )
|
||||
{
|
||||
$ADMIN->error( $ADMIN->errors );
|
||||
}
|
||||
|
||||
// Generate the config file..
|
||||
|
||||
$file_content = "<?php\n\n";
|
||||
|
||||
foreach($row as $k => $v)
|
||||
{
|
||||
|
||||
$v = preg_replace( "#style_images/".$row['imid']."/#", "style_images/%img_dir%/", $v );
|
||||
|
||||
$file_content .= "\n\$config['$k'] = \"".addslashes($v)."\";";
|
||||
}
|
||||
|
||||
$file_content .= "\n\n?".">";
|
||||
|
||||
$FH = fopen($archive_dir."/".$new_dir."/"."conf.inc", 'w');
|
||||
fwrite($FH, $file_content, strlen($file_content));
|
||||
fclose($FH);
|
||||
|
||||
// Add files and write tarball
|
||||
|
||||
$tar = new tar();
|
||||
|
||||
$tar->new_tar( $archive_dir, $new_dir.".tar" );
|
||||
$tar->add_directory( $archive_dir."/".$new_dir );
|
||||
$tar->write_tar();
|
||||
|
||||
// Check for errors.
|
||||
|
||||
if ($tar->error != "")
|
||||
{
|
||||
$ADMIN->error($tar->error);
|
||||
}
|
||||
|
||||
// remove original unarchived directory
|
||||
|
||||
$ADMIN->rm_dir($archive_dir."/".$new_dir);
|
||||
|
||||
$ADMIN->done_screen("Template Pack Export Created<br><br>You can download the tar-chive <a href='archive_out/{$new_dir}.tar' target='_blank'>here</a>", "Manage Template Sets", "act=templ" );
|
||||
|
||||
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------
|
||||
// Add images..
|
||||
//-------------------------------------------------------------
|
||||
|
||||
|
||||
function add_images()
|
||||
{
|
||||
global $IN, $root_path, $INFO, $DB, $SKIN, $ADMIN, $std, $MEMBER, $GROUP, $HTTP_POST_VARS;
|
||||
|
||||
if ($IN['id'] == "")
|
||||
{
|
||||
$ADMIN->error("You must specify an existing image set ID, go back and try again");
|
||||
}
|
||||
|
||||
//-------------------------------------
|
||||
|
||||
if ( ! is_writeable($root_path.'style_images') )
|
||||
{
|
||||
$ADMIN->error("The directory 'style_images' is not writeable by this script. Please check the permissions on that directory. CHMOD to 0777 if in doubt and try again");
|
||||
}
|
||||
|
||||
//-------------------------------------
|
||||
|
||||
if ( ! is_dir($root_path.'style_images/'.$IN['id']) )
|
||||
{
|
||||
$ADMIN->error("Could not locate the original image set to copy, please check and try again");
|
||||
}
|
||||
|
||||
//-------------------------------------
|
||||
|
||||
$DB->query("SELECT * FROM ibf_images WHERE imid='".$IN['id']."'");
|
||||
|
||||
//-------------------------------------
|
||||
|
||||
if ( ! $row = $DB->fetch_row() )
|
||||
{
|
||||
$ADMIN->error("Could not query that image set from the DB, so there");
|
||||
}
|
||||
|
||||
//-------------------------------------
|
||||
|
||||
$row['setname'] = $row['setname'].".2";
|
||||
|
||||
// Insert a new row into the DB...
|
||||
|
||||
$final = array();
|
||||
|
||||
foreach($row as $k => $v)
|
||||
{
|
||||
if ($k == 'imid')
|
||||
{
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
$final[ $k ] = $v;
|
||||
}
|
||||
}
|
||||
|
||||
$db_string = $DB->compile_db_insert_string( $final );
|
||||
|
||||
$DB->query("INSERT INTO ibf_images (".$db_string['FIELD_NAMES'].") VALUES(".$db_string['FIELD_VALUES'].")");
|
||||
|
||||
$new_id = $DB->get_insert_id();
|
||||
|
||||
//-------------------------------------
|
||||
|
||||
if ( ! $ADMIN->copy_dir( $INFO['base_dir'].'style_images/'.$IN['id'] , $INFO['base_dir'].'style_images/'.$new_id ) )
|
||||
{
|
||||
$DB->query("DELETE FROM ibf_images WHERE imid='$new_id'");
|
||||
|
||||
$ADMIN->error( $ADMIN->errors );
|
||||
}
|
||||
|
||||
//-------------------------------------
|
||||
// Pass to edit / add form...
|
||||
//-------------------------------------
|
||||
|
||||
$this->do_form('add', $new_id);
|
||||
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------
|
||||
// REMOVE WRAPPERS
|
||||
//-------------------------------------------------------------
|
||||
|
||||
function remove()
|
||||
{
|
||||
global $IN, $root_path, $INFO, $DB, $SKIN, $ADMIN, $std, $MEMBER, $GROUP, $HTTP_POST_VARS;
|
||||
|
||||
//+-------------------------------
|
||||
|
||||
|
||||
if ($IN['id'] == "")
|
||||
{
|
||||
$ADMIN->error("You must specify an existing image set ID, go back and try again");
|
||||
}
|
||||
|
||||
$dir_to_remove = $INFO['base_dir']."style_images/".$IN['id'];
|
||||
|
||||
if ( SAFE_MODE_ON == 0 )
|
||||
{
|
||||
if ( $ADMIN->rm_dir( $dir_to_remove ) )
|
||||
{
|
||||
|
||||
$DB->query("DELETE FROM ibf_images WHERE imid='".$IN['id']."'");
|
||||
|
||||
$std->boink_it($SKIN->base_url."&act=image");
|
||||
exit();
|
||||
}
|
||||
else
|
||||
{
|
||||
$ADMIN->error("Could not remove the image pack files, please check the CHMOD permissions to ensure that this script has the correct permissions to allow this");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$DB->query("DELETE FROM ibf_images WHERE imid='".$IN['id']."'");
|
||||
$ADMIN->info_screen("Safe mode has been detected and this script cannot remove the images and directories for you, please remove the directory '$dir_to_remove' via FTP. The data has been removed from the database successfully");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//-------------------------------------------------------------
|
||||
// ADD / EDIT IMAGE SETS
|
||||
//-------------------------------------------------------------
|
||||
|
||||
function save_wrapper()
|
||||
{
|
||||
global $IN, $root_path, $INFO, $DB, $SKIN, $ADMIN, $std, $MEMBER, $GROUP, $HTTP_POST_VARS;
|
||||
|
||||
//+-------------------------------
|
||||
|
||||
if ($IN['id'] == "")
|
||||
{
|
||||
$ADMIN->error("You must specify an existing image set ID, go back and try again");
|
||||
}
|
||||
|
||||
|
||||
if ($IN['setname'] == "")
|
||||
{
|
||||
$ADMIN->error("You must specify a name for this image and macro set");
|
||||
}
|
||||
|
||||
$barney = array();
|
||||
|
||||
foreach ($IN as $k => $v)
|
||||
{
|
||||
if ( preg_match( "/^XX_(\S+)$/", $k, $match ) )
|
||||
{
|
||||
if ( isset($IN[ $match[0] ]) )
|
||||
{
|
||||
$v = preg_replace( "/'/", "'", stripslashes($HTTP_POST_VARS[ $match[0] ]) );
|
||||
|
||||
$barney[ $match[1] ] = $v;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( count($barney) < 10 )
|
||||
{
|
||||
$ADMIN->error("Oopsie, something has gone wrong - did you leave all the fields blank?");
|
||||
}
|
||||
|
||||
$barney['setname'] = $IN['setname'];
|
||||
|
||||
$db_string = $DB->compile_db_update_string( $barney );
|
||||
|
||||
$DB->query("UPDATE ibf_images SET $db_string WHERE imid='".$IN['id']."'");
|
||||
|
||||
$ADMIN->done_screen("Set updated", "Manage Image and Macro Sets", "act=image" );
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------
|
||||
// ADD / EDIT MACRO SETS
|
||||
//-------------------------------------------------------------
|
||||
|
||||
function do_form( $type='add', $id="" )
|
||||
{
|
||||
global $IN, $root_path, $INFO, $DB, $SKIN, $ADMIN, $std, $MEMBER, $GROUP;
|
||||
|
||||
//+-------------------------------
|
||||
|
||||
if ($id != "")
|
||||
{
|
||||
$IN['id'] = $id;
|
||||
}
|
||||
|
||||
//+-------------------------------
|
||||
|
||||
if ($IN['id'] == "")
|
||||
{
|
||||
$ADMIN->error("You must specify an existing image set ID, go back and try again");
|
||||
}
|
||||
|
||||
//+-------------------------------
|
||||
|
||||
$DB->query("SELECT * from ibf_images WHERE imid='".$IN['id']."'");
|
||||
|
||||
if ( ! $row = $DB->fetch_row() )
|
||||
{
|
||||
$ADMIN->error("Could not query the information from the database");
|
||||
}
|
||||
|
||||
if ($type == 'add')
|
||||
{
|
||||
$button = 'Update Image & Macro set';
|
||||
|
||||
foreach( $row as $k => $v )
|
||||
{
|
||||
$v = preg_replace( "#style_images/(\d+)/#", "style_images/".$IN['id']."/", $v );
|
||||
|
||||
$row[$k] = $v;
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
$button = 'Edit Image & Macro set';
|
||||
}
|
||||
|
||||
//+-------------------------------
|
||||
|
||||
$ADMIN->page_detail = "You may use edit the macros that power the images. You do not have to use an image, you may use text, flash or other objects.";
|
||||
$ADMIN->page_title = "Manage Image & Macro sets";
|
||||
|
||||
//+-------------------------------
|
||||
|
||||
|
||||
$ADMIN->html .= $SKIN->js_no_specialchars();
|
||||
|
||||
|
||||
$ADMIN->html .= $SKIN->start_form( array( 1 => array( 'code' , 'doedit' ),
|
||||
2 => array( 'act' , 'image' ),
|
||||
3 => array( 'id' , $IN['id'] ),
|
||||
), "theAdminForm", "onSubmit=\"return no_specialchars('images')\"" );
|
||||
|
||||
//+-------------------------------
|
||||
|
||||
$SKIN->td_header[] = array( " " , "20%" );
|
||||
$SKIN->td_header[] = array( " " , "80%" );
|
||||
|
||||
//+-------------------------------
|
||||
|
||||
$ADMIN->html .= $SKIN->start_table( "Image & Macro set title" );
|
||||
|
||||
$ADMIN->html .= $SKIN->add_td_row( array(
|
||||
"Image & Macro Set Title",
|
||||
$SKIN->form_input('setname', $row['setname']),
|
||||
) );
|
||||
|
||||
$ADMIN->html .= $SKIN->end_table();
|
||||
|
||||
//+-------------------------------
|
||||
|
||||
$SKIN->td_header[] = array( "Macro" , "20%" );
|
||||
$SKIN->td_header[] = array( "Source" , "60%" );
|
||||
$SKIN->td_header[] = array( "Current" , "20%" );
|
||||
|
||||
//+-------------------------------
|
||||
|
||||
$ADMIN->html .= $SKIN->start_table( "Current Macros" );
|
||||
|
||||
foreach($row as $k => $v)
|
||||
{
|
||||
if ($k != 'imid' && $k != 'setname')
|
||||
{
|
||||
if ( ! preg_match( "/^\d+$/", $k ) )
|
||||
{
|
||||
|
||||
$real = preg_replace( "/'/", "'", $v );
|
||||
|
||||
$ADMIN->html .= $SKIN->add_td_row( array(
|
||||
"$k",
|
||||
$SKIN->form_input('XX_'.$k, $real),
|
||||
"$v",
|
||||
) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
$ADMIN->html .= $SKIN->end_form($button);
|
||||
|
||||
$ADMIN->html .= $SKIN->end_table();
|
||||
|
||||
//+-------------------------------
|
||||
//+-------------------------------
|
||||
|
||||
$ADMIN->output();
|
||||
|
||||
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------
|
||||
// SHOW WRAPPERS
|
||||
//-------------------------------------------------------------
|
||||
|
||||
function list_current()
|
||||
{
|
||||
global $IN, $root_path, $INFO, $DB, $SKIN, $ADMIN, $std, $MEMBER, $GROUP;
|
||||
|
||||
$form_array = array();
|
||||
|
||||
$ADMIN->page_detail = "Images and Macros are used in the skin templates as shorthand for an image or other style information. This enables you to use text links instead of buttons or flash movies for certain images. An image and macro set contains the actual images and the macros to power them.";
|
||||
$ADMIN->page_title = "Manage Image and Macros";
|
||||
|
||||
//+-------------------------------
|
||||
|
||||
$SKIN->td_header[] = array( "Title" , "40%" );
|
||||
$SKIN->td_header[] = array( "Allocation" , "30%" );
|
||||
$SKIN->td_header[] = array( "Export" , "10%" );
|
||||
$SKIN->td_header[] = array( "Edit" , "10%" );
|
||||
$SKIN->td_header[] = array( "Remove" , "10%" );
|
||||
|
||||
//+-------------------------------
|
||||
|
||||
$DB->query("SELECT DISTINCT(s.img_id), i.imid, i.setname, s.sname from ibf_images i, ibf_skins s WHERE s.img_id=i.imid ORDER BY i.setname ASC");
|
||||
|
||||
$used_ids = array();
|
||||
$show_array = array();
|
||||
|
||||
if ( $DB->get_num_rows() )
|
||||
{
|
||||
|
||||
$ADMIN->html .= $SKIN->start_table( "Current Image & Macro sets In Use" );
|
||||
|
||||
while ( $r = $DB->fetch_row() )
|
||||
{
|
||||
|
||||
$show_array[ $r['imid'] ] .= stripslashes($r['sname'])."<br>";
|
||||
|
||||
if ( in_array( $r['imid'], $used_ids ) )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
$ADMIN->html .= $SKIN->add_td_row( array( "<b>".stripslashes($r['setname'])."</b>",
|
||||
"<#X-{$r['imid']}#>",
|
||||
"<center><a href='".$SKIN->base_url."&act=image&code=export&id={$r['imid']}'>Export</a></center>",
|
||||
"<center><a href='".$SKIN->base_url."&act=image&code=edit&id={$r['imid']}'>Edit</a></center>",
|
||||
"<i>Deallocate before removing</i>",
|
||||
) );
|
||||
|
||||
$used_ids[] = $r['imid'];
|
||||
|
||||
$form_array[] = array( $r['imid'], $r['setname'] );
|
||||
|
||||
}
|
||||
|
||||
foreach( $show_array as $idx => $string )
|
||||
{
|
||||
$string = preg_replace( "/<br>$/", "", $string );
|
||||
|
||||
$ADMIN->html = preg_replace( "/<#X-$idx#>/", "$string", $ADMIN->html );
|
||||
}
|
||||
|
||||
$ADMIN->html .= $SKIN->end_table();
|
||||
}
|
||||
|
||||
if ( count($used_ids) > 0 )
|
||||
{
|
||||
|
||||
$DB->query("SELECT imid, setname FROM ibf_images WHERE imid NOT IN(".implode(",",$used_ids).")");
|
||||
|
||||
if ( $DB->get_num_rows() )
|
||||
{
|
||||
|
||||
$SKIN->td_header[] = array( "Title" , "70%" );
|
||||
$SKIN->td_header[] = array( "Export" , "10%" );
|
||||
$SKIN->td_header[] = array( "Edit" , "10%" );
|
||||
$SKIN->td_header[] = array( "Remove" , "10%" );
|
||||
|
||||
$ADMIN->html .= $SKIN->start_table( "Current Unallocated Image & Macro sets" );
|
||||
|
||||
$ADMIN->html .= $SKIN->js_checkdelete();
|
||||
|
||||
while ( $r = $DB->fetch_row() )
|
||||
{
|
||||
|
||||
$ADMIN->html .= $SKIN->add_td_row( array( "<b>".stripslashes($r['setname'])."</b>",
|
||||
"<center><a href='".$SKIN->base_url."&act=image&code=export&id={$r['imid']}'>Export</a></center>",
|
||||
"<center><a href='".$SKIN->base_url."&act=image&code=edit&id={$r['imid']}'>Edit</a></center>",
|
||||
"<center><a href='javascript:checkdelete(\"act=image&code=remove&id={$r['imid']}\")'>Remove</a></center>",
|
||||
) );
|
||||
|
||||
$form_array[] = array( $r['imid'], $r['setname'] );
|
||||
|
||||
}
|
||||
|
||||
$ADMIN->html .= $SKIN->end_table();
|
||||
}
|
||||
}
|
||||
|
||||
//+-------------------------------
|
||||
//+-------------------------------
|
||||
|
||||
$ADMIN->html .= $SKIN->start_form( array( 1 => array( 'code' , 'add' ),
|
||||
2 => array( 'act' , 'image' ),
|
||||
) );
|
||||
|
||||
$SKIN->td_header[] = array( " " , "40%" );
|
||||
$SKIN->td_header[] = array( " " , "60%" );
|
||||
|
||||
$ADMIN->html .= $SKIN->start_table( "Create New Image & Macro Set" );
|
||||
|
||||
//+-------------------------------
|
||||
|
||||
$ADMIN->html .= $SKIN->add_td_row( array( "<b>Base new Image & Macro set on...</b><br>(Note: This will also copy the images)" ,
|
||||
$SKIN->form_dropdown( "id", $form_array)
|
||||
) );
|
||||
|
||||
$ADMIN->html .= $SKIN->end_form("Create new Image & Macro set");
|
||||
|
||||
$ADMIN->html .= $SKIN->end_table();
|
||||
|
||||
//+-------------------------------
|
||||
//+-------------------------------
|
||||
|
||||
$ADMIN->output();
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,204 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
+--------------------------------------------------------------------------
|
||||
| IBFORUMS v1
|
||||
| ========================================
|
||||
| by Matthew Mecham and David Baxter
|
||||
| (c) 2001,2002 IBForums
|
||||
| http://www.ibforums.com
|
||||
| ========================================
|
||||
| Web: http://www.ibforums.com
|
||||
| Email: phpboards@ibforums.com
|
||||
| Licence Info: phpib-licence@ibforums.com
|
||||
+---------------------------------------------------------------------------
|
||||
|
|
||||
| > Admin "welcome" screen functions
|
||||
| > Module written by Matt Mecham
|
||||
| > Date started: 1st march 2002
|
||||
|
|
||||
| > Module Version Number: 1.0.0
|
||||
+--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
$idx = new index_page();
|
||||
|
||||
|
||||
class index_page {
|
||||
|
||||
|
||||
function index_page() {
|
||||
global $DB, $IN, $INFO, $ADMIN, $SKIN, $std;
|
||||
|
||||
$DB->query("SELECT * FROM ibf_stats");
|
||||
|
||||
$row = $DB->fetch_row();
|
||||
|
||||
if ($row['TOTAL_REPLIES'] < 0) $row['TOTAL_REPLIES'] = 0;
|
||||
if ($row['TOTAL_TOPICS'] < 0) $row['TOTAL_TOPICS'] = 0;
|
||||
if ($row['MEM_COUNT'] < 0) $row['MEM_COUNT'] = 0;
|
||||
|
||||
$DB->query("SELECT COUNT(*) as reg FROM ibf_members WHERE mgroup='".$INFO['auth_group']."' AND (new_pass='' or new_pass IS NULL)");
|
||||
$reg = $DB->fetch_row();
|
||||
|
||||
if ($reg['reg'] < 1 ) $reg['reg'] = 0;
|
||||
|
||||
//-------------------------------------------------
|
||||
// Make sure the uploads path is correct
|
||||
//-------------------------------------------------
|
||||
|
||||
$uploads_size = 0;
|
||||
|
||||
if ($dh = opendir( $INFO['upload_dir'] ))
|
||||
{
|
||||
while ( $file = readdir( $dh ) )
|
||||
{
|
||||
if ( !preg_match( "/^..?$|^index/i", $file ) )
|
||||
{
|
||||
$uploads_size += @filesize( $INFO['upload_dir'] . "/" . $file );
|
||||
}
|
||||
}
|
||||
closedir( $dh );
|
||||
}
|
||||
|
||||
// This piece of code from Jesse's (jesse@jess.on.ca) contribution
|
||||
// to the PHP manual @ php.net
|
||||
|
||||
if ($uploads_size >= 1048576)
|
||||
{
|
||||
$uploads_size = round($uploads_size / 1048576 * 100 ) / 100 . " mb";
|
||||
}
|
||||
else if ($uploads_size >= 1024)
|
||||
{
|
||||
$uploads_size = round($uploads_size / 1024 * 100 ) / 100 . " k";
|
||||
}
|
||||
else
|
||||
{
|
||||
$uploads_size = $uploads_size . " bytes";
|
||||
}
|
||||
|
||||
//+-----------------------------------------------------------
|
||||
|
||||
$ADMIN->html .= $SKIN->start_table( "Administrators using the CP" );
|
||||
|
||||
$t_time = time() - 60*10;
|
||||
|
||||
$DB->query("SELECT DISTINCT(MEMBER_NAME) FROM ibf_admin_sessions WHERE RUNNING_TIME > $t_time");
|
||||
|
||||
$mem_array = array();
|
||||
|
||||
while ( $r = $DB->fetch_row() )
|
||||
{
|
||||
$mem_array[] = $r['MEMBER_NAME'];
|
||||
}
|
||||
|
||||
$ADMIN->html .= $SKIN->add_td_basic( implode(", ", $mem_array ) );
|
||||
|
||||
$ADMIN->html .= $SKIN->end_table();
|
||||
|
||||
//+-----------------------------------------------------------
|
||||
|
||||
$ADMIN->html .= $SKIN->add_td_spacer();
|
||||
|
||||
//+-----------------------------------------------------------
|
||||
|
||||
$SKIN->td_header[] = array( "Definition", "25%" );
|
||||
$SKIN->td_header[] = array( "Value" , "25%" );
|
||||
$SKIN->td_header[] = array( "Definition", "25%" );
|
||||
$SKIN->td_header[] = array( "Value" , "25%" );
|
||||
|
||||
$ADMIN->html .= $SKIN->start_table( "System Overview" );
|
||||
|
||||
$ADMIN->html .= $SKIN->add_td_row( array( "Total Unique Topics" , $row['TOTAL_TOPICS'],
|
||||
"Total Replies to topics" , $row['TOTAL_REPLIES']
|
||||
) );
|
||||
|
||||
$ADMIN->html .= $SKIN->add_td_row( array( "Total Members" , $row['MEM_COUNT'], "Public Upload Folder Size", $uploads_size ) );
|
||||
|
||||
$ADMIN->html .= $SKIN->add_td_row( array( "<a href='{$SKIN->base_url}&act=mem&code=mod'>Users awaiting validation</a>" , $reg['reg'],
|
||||
" ", " ",
|
||||
) );
|
||||
|
||||
$ADMIN->html .= $SKIN->end_table();
|
||||
|
||||
//+-----------------------------------------------------------
|
||||
|
||||
$ADMIN->html .= $SKIN->add_td_spacer();
|
||||
|
||||
//+-----------------------------------------------------------
|
||||
|
||||
$ADMIN->html .= $SKIN->start_form();
|
||||
|
||||
$SKIN->td_header[] = array( " " , "40%" );
|
||||
$SKIN->td_header[] = array( " " , "30%" );
|
||||
$SKIN->td_header[] = array( " " , "30%" );
|
||||
|
||||
$ADMIN->html .= $SKIN->start_table( "Quick Clicks" );
|
||||
|
||||
$ADMIN->html .= "
|
||||
|
||||
<script language='javascript'>
|
||||
<!--
|
||||
function edit_member() {
|
||||
|
||||
if (document.forms[0].username.value == \"\") {
|
||||
alert(\"You must enter a username!\");
|
||||
} else {
|
||||
window.parent.body.location = '{$SKIN->base_url}' + '&act=mem&code=stepone&USER_NAME=' + escape(document.forms[0].username.value);
|
||||
}
|
||||
}
|
||||
|
||||
function new_cat() {
|
||||
|
||||
if (document.forms[0].cat_name.value == \"\") {
|
||||
alert(\"You must enter a category name!\");
|
||||
} else {
|
||||
window.parent.body.location = '{$SKIN->base_url}' + '&act=cat&code=new&name=' + escape(document.forms[0].cat_name.value);
|
||||
}
|
||||
}
|
||||
|
||||
function new_forum() {
|
||||
|
||||
if (document.forms[0].forum_name.value == \"\") {
|
||||
alert(\"You must enter a forum name!\");
|
||||
} else {
|
||||
window.parent.body.location = '{$SKIN->base_url}' + '&act=forum&code=new&name=' + escape(document.forms[0].forum_name.value);
|
||||
}
|
||||
}
|
||||
//-->
|
||||
|
||||
</script>
|
||||
<form name='DOIT' action=''>
|
||||
|
||||
";
|
||||
|
||||
$ADMIN->html .= $SKIN->add_td_row( array( "Edit Member:",
|
||||
"<input type='text' style='width:100%' id='textinput' name='username' value='Enter name here' onfocus='this.value=\"\"'>",
|
||||
"<input type='button' value='Find Member' id='button' onClick='edit_member()'>"
|
||||
) );
|
||||
|
||||
$ADMIN->html .= $SKIN->add_td_row( array( "Add New Category:",
|
||||
"<input type='text' style='width:100%' name='cat_name' id='textinput' value='Category title here' onfocus='this.value=\"\"'>",
|
||||
"<input type='button' value='Add Category' id='button' onClick='new_cat()'>"
|
||||
) );
|
||||
|
||||
$ADMIN->html .= $SKIN->add_td_row( array( "Add New Forum:",
|
||||
"<input type='text' style='width:100%' name='forum_name' id='textinput' value='Forum title here' onfocus='this.value=\"\"'>",
|
||||
"<input type='button' value='Add Forum' id='button' onClick='new_forum()'>"
|
||||
) );
|
||||
|
||||
$ADMIN->html .= "</form>";
|
||||
|
||||
$ADMIN->html .= $SKIN->end_table();
|
||||
|
||||
$ADMIN->output();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,766 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
+--------------------------------------------------------------------------
|
||||
| IBFORUMS v1
|
||||
| ========================================
|
||||
| by Matthew Mecham and David Baxter
|
||||
| (c) 2001,2002 IBForums
|
||||
| http://www.ibforums.com
|
||||
| ========================================
|
||||
| Web: http://www.ibforums.com
|
||||
| Email: phpboards@ibforums.com
|
||||
| Licence Info: phpib-licence@ibforums.com
|
||||
+---------------------------------------------------------------------------
|
||||
|
|
||||
| > Admin Category functions
|
||||
| > Module written by Matt Mecham
|
||||
| > Date started: 1st march 2002
|
||||
|
|
||||
| > Module Version Number: 1.0.0
|
||||
+--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
|
||||
|
||||
$idx = new ad_mod();
|
||||
|
||||
|
||||
class ad_mod {
|
||||
|
||||
var $base_url;
|
||||
|
||||
function ad_mod() {
|
||||
global $IN, $root_path, $INFO, $DB, $SKIN, $ADMIN, $std, $MEMBER, $GROUP;
|
||||
|
||||
switch($IN['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 $IN, $root_path, $INFO, $DB, $SKIN, $ADMIN, $std, $MEMBER, $GROUP;
|
||||
|
||||
if ($IN['mid'] == "")
|
||||
{
|
||||
$ADMIN->error("You did not choose a valid moderator ID");
|
||||
}
|
||||
|
||||
$DB->query("DELETE FROM ibf_moderators WHERE mid='".$IN['mid']."'");
|
||||
|
||||
$ADMIN->done_screen("Moderator Removed", "Moderator Control", "act=mod" );
|
||||
|
||||
}
|
||||
|
||||
|
||||
//+---------------------------------------------------------------------------------
|
||||
//
|
||||
// EDIT MODERATOR
|
||||
//
|
||||
//+---------------------------------------------------------------------------------
|
||||
|
||||
function do_edit()
|
||||
{
|
||||
global $IN, $root_path, $INFO, $DB, $SKIN, $ADMIN, $std, $MEMBER, $GROUP;
|
||||
|
||||
if ($IN['mid'] == "")
|
||||
{
|
||||
$ADMIN->error("You did not choose a valid moderator ID");
|
||||
}
|
||||
|
||||
//--------------------------------------
|
||||
// Build Mr Hash
|
||||
//--------------------------------------
|
||||
|
||||
$mr_hash = array(
|
||||
'forum_id' => $IN['forum_id'],
|
||||
'edit_post' => $IN['edit_post'],
|
||||
'edit_topic' => $IN['edit_topic'],
|
||||
'delete_post' => $IN['delete_post'],
|
||||
'delete_topic' => $IN['delete_topic'],
|
||||
'view_ip' => $IN['view_ip'],
|
||||
'open_topic' => $IN['open_topic'],
|
||||
'close_topic' => $IN['close_topic'],
|
||||
'mass_move' => $IN['mass_move'],
|
||||
'mass_prune' => $IN['mass_prune'],
|
||||
'move_topic' => $IN['move_topic'],
|
||||
'pin_topic' => $IN['pin_topic'],
|
||||
'unpin_topic' => $IN['unpin_topic'],
|
||||
'post_q' => $IN['post_q'],
|
||||
'topic_q' => $IN['topic_q'],
|
||||
'allow_warn' => $IN['allow_warn'],
|
||||
'edit_user' => $IN['edit_user']
|
||||
);
|
||||
|
||||
|
||||
|
||||
$db_string = $DB->compile_db_update_string( $mr_hash );
|
||||
|
||||
$DB->query("UPDATE ibf_moderators SET $db_string WHERE mid='".$IN['mid']."'");
|
||||
|
||||
$ADMIN->done_screen("Moderator Edited", "Moderator Control", "act=mod" );
|
||||
|
||||
}
|
||||
|
||||
//+---------------------------------------------------------------------------------
|
||||
//
|
||||
// ADD MODERATOR
|
||||
//
|
||||
//+---------------------------------------------------------------------------------
|
||||
|
||||
function add_mod()
|
||||
{
|
||||
global $IN, $root_path, $INFO, $DB, $SKIN, $ADMIN, $std, $MEMBER, $GROUP;
|
||||
|
||||
if ($IN['fid'] == "")
|
||||
{
|
||||
$ADMIN->error("You did not choose any forums to add this member to");
|
||||
}
|
||||
|
||||
if ($IN['mem'] == "")
|
||||
{
|
||||
$ADMIN->error("You did not choose a member to add as a moderator");
|
||||
}
|
||||
|
||||
$DB->query("SELECT id, name from ibf_members WHERE id='".$IN['mem']."'");
|
||||
|
||||
if ( ! $mem = $DB->fetch_row() )
|
||||
{
|
||||
$ADMIN->error("Could not match that member name so there.");
|
||||
}
|
||||
|
||||
//--------------------------------------
|
||||
// Check for legal forums
|
||||
//--------------------------------------
|
||||
|
||||
$forum_ids = array();
|
||||
|
||||
$DB->query("SELECT id FROM ibf_forums WHERE id IN(".$IN['fid'].")");
|
||||
|
||||
while( $i = $DB->fetch_row() )
|
||||
{
|
||||
$forum_ids[] = $i['id'];
|
||||
}
|
||||
|
||||
if ( count($forum_ids) == 0)
|
||||
{
|
||||
$ADMIN->error("We could not match any forums with those IDS");
|
||||
}
|
||||
|
||||
//--------------------------------------
|
||||
// Build Mr Hash
|
||||
//--------------------------------------
|
||||
|
||||
$mr_hash = array(
|
||||
'member_name' => $mem['name'],
|
||||
'member_id' => $mem['id'],
|
||||
'edit_post' => $IN['edit_post'],
|
||||
'edit_topic' => $IN['edit_topic'],
|
||||
'delete_post' => $IN['delete_post'],
|
||||
'delete_topic' => $IN['delete_topic'],
|
||||
'view_ip' => $IN['view_ip'],
|
||||
'open_topic' => $IN['open_topic'],
|
||||
'close_topic' => $IN['close_topic'],
|
||||
'mass_move' => $IN['mass_move'],
|
||||
'mass_prune' => $IN['mass_prune'],
|
||||
'move_topic' => $IN['move_topic'],
|
||||
'pin_topic' => $IN['pin_topic'],
|
||||
'unpin_topic' => $IN['unpin_topic'],
|
||||
'post_q' => $IN['post_q'],
|
||||
'topic_q' => $IN['topic_q'],
|
||||
'allow_warn' => $IN['allow_warn'],
|
||||
'edit_user' => $IN['edit_user']
|
||||
);
|
||||
|
||||
//--------------------------------------
|
||||
// Loopy loopy
|
||||
//--------------------------------------
|
||||
|
||||
foreach ($forum_ids as $cartman)
|
||||
{
|
||||
$mr_hash['forum_id'] = $cartman;
|
||||
|
||||
$kenny = $DB->compile_db_insert_string( $mr_hash );
|
||||
|
||||
$DB->query("INSERT INTO ibf_moderators (" .$kenny['FIELD_NAMES']. ") VALUES (". $kenny['FIELD_VALUES'] .")");
|
||||
}
|
||||
|
||||
$ADMIN->done_screen("Moderator Added", "Moderator Control", "act=mod" );
|
||||
|
||||
}
|
||||
|
||||
//+---------------------------------------------------------------------------------
|
||||
//
|
||||
// ADD FINAL, display the add / edit form
|
||||
//
|
||||
//+---------------------------------------------------------------------------------
|
||||
|
||||
function mod_form( $type='add' ) {
|
||||
global $IN, $root_path, $INFO, $DB, $SKIN, $ADMIN, $std, $MEMBER, $GROUP;
|
||||
|
||||
if ($type == 'add')
|
||||
{
|
||||
if ($IN['fid'] == "")
|
||||
{
|
||||
$ADMIN->error("You did not choose any forums to add this member to");
|
||||
}
|
||||
|
||||
$mod = array();
|
||||
$names = array();
|
||||
|
||||
//--------------------------------------
|
||||
|
||||
$DB->query("SELECT name FROM ibf_forums WHERE id IN(".$IN['fid'].")");
|
||||
|
||||
while ( $r = $DB->fetch_row() )
|
||||
{
|
||||
$names[] = $r['name'];
|
||||
}
|
||||
|
||||
$thenames = implode( ", ", $names );
|
||||
|
||||
//--------------------------------------
|
||||
|
||||
$button = "Add this moderator";
|
||||
|
||||
$form_code = 'doadd';
|
||||
|
||||
if ($IN['MEMBER_ID'] == "")
|
||||
{
|
||||
$ADMIN->error("Could not resolve the member id bucko");
|
||||
}
|
||||
else
|
||||
{
|
||||
$DB->query("SELECT name, id FROM ibf_members WHERE id='".$IN['MEMBER_ID']."'");
|
||||
|
||||
if ( ! $mem = $DB->fetch_row() )
|
||||
{
|
||||
$ADMIN->error("That member ID does not resolve");
|
||||
}
|
||||
|
||||
$member_id = $mem['id'];
|
||||
$member_name = $mem['name'];
|
||||
}
|
||||
|
||||
$ADMIN->page_detail = "Adding a $member_name as a moderator to: $thenames";
|
||||
$ADMIN->page_title = "Add a moderator";
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($IN['mid'] == "")
|
||||
{
|
||||
$ADMIN->error("You must choose a valid moderator to edit.");
|
||||
}
|
||||
|
||||
$button = "Edit this moderator";
|
||||
|
||||
$form_code = "doedit";
|
||||
|
||||
$ADMIN->page_title = "Editing a moderator";
|
||||
$ADMIN->page_detail = "Please check the information carefully before submitting the form";
|
||||
|
||||
$DB->query("SELECT * from ibf_moderators WHERE mid='".$IN['mid']."'");
|
||||
|
||||
if ( ! $mod = $DB->fetch_row() )
|
||||
{
|
||||
$ADMIN->error("Could not retrieve that moderators record");
|
||||
}
|
||||
|
||||
$member_id = $mod['member_id'];
|
||||
$member_name = $mod['member_name'];
|
||||
}
|
||||
|
||||
|
||||
//+-------------------------------
|
||||
|
||||
$ADMIN->html .= $SKIN->start_form( array( 1 => array( 'code' , $form_code ),
|
||||
2 => array( 'act' , 'mod' ),
|
||||
3 => array( 'mid' , $mod['mid']),
|
||||
4 => array( 'fid' , $IN['fid'] ),
|
||||
5 => array( 'mem' , $member_id ),
|
||||
) );
|
||||
|
||||
//+-------------------------------
|
||||
|
||||
$SKIN->td_header[] = array( " " , "40%" );
|
||||
$SKIN->td_header[] = array( " " , "60%" );
|
||||
|
||||
//+-------------------------------
|
||||
|
||||
$ADMIN->html .= $SKIN->start_table( "General Settings" );
|
||||
|
||||
//+-------------------------------
|
||||
|
||||
if ($type == 'edit')
|
||||
{
|
||||
$forums = array();
|
||||
|
||||
$DB->query("SELECT id, name FROM ibf_forums ORDER BY position");
|
||||
|
||||
while ( $r = $DB->fetch_row() )
|
||||
{
|
||||
$forums[] = array( $r['id'], $r['name'] );
|
||||
}
|
||||
|
||||
$ADMIN->html .= $SKIN->add_td_row( array( "<b>Moderates forum...</b>" ,
|
||||
$SKIN->form_dropdown( "forum_id", $forums, $mod['forum_id'] )
|
||||
) );
|
||||
}
|
||||
|
||||
//+-------------------------------
|
||||
|
||||
$ADMIN->html .= $SKIN->add_td_row( array( "<b>Can edit others posts/polls?</b>" ,
|
||||
$SKIN->form_yes_no("edit_post", $mod['edit_post'] )
|
||||
) );
|
||||
|
||||
$ADMIN->html .= $SKIN->add_td_row( array( "<b>Can edit others topic titles?</b>" ,
|
||||
$SKIN->form_yes_no("edit_topic", $mod['edit_topic'] )
|
||||
) );
|
||||
|
||||
$ADMIN->html .= $SKIN->add_td_row( array( "<b>Can delete others posts?</b>" ,
|
||||
$SKIN->form_yes_no("delete_post", $mod['delete_post'] )
|
||||
) );
|
||||
|
||||
$ADMIN->html .= $SKIN->add_td_row( array( "<b>Can delete others topics/polls?</b>" ,
|
||||
$SKIN->form_yes_no("delete_topic", $mod['delete_topic'] )
|
||||
) );
|
||||
|
||||
$ADMIN->html .= $SKIN->add_td_row( array( "<b>Can view posters IP addresses?</b>" ,
|
||||
$SKIN->form_yes_no("view_ip", $mod['view_ip'] )
|
||||
) );
|
||||
|
||||
$ADMIN->html .= $SKIN->add_td_row( array( "<b>Can open locked topics?</b>" ,
|
||||
$SKIN->form_yes_no("open_topic", $mod['open_topic'] )
|
||||
) );
|
||||
|
||||
$ADMIN->html .= $SKIN->add_td_row( array( "<b>Can close open topics?</b>" ,
|
||||
$SKIN->form_yes_no("close_topic", $mod['close_topic'] )
|
||||
) );
|
||||
|
||||
$ADMIN->html .= $SKIN->add_td_row( array( "<b>Can move topics?</b>" ,
|
||||
$SKIN->form_yes_no("move_topic", $mod['move_topic'] )
|
||||
) );
|
||||
|
||||
$ADMIN->html .= $SKIN->add_td_row( array( "<b>Can pin topics?</b>" ,
|
||||
$SKIN->form_yes_no("pin_topic", $mod['pin_topic'] )
|
||||
) );
|
||||
|
||||
$ADMIN->html .= $SKIN->add_td_row( array( "<b>Can unpin topics?</b>" ,
|
||||
$SKIN->form_yes_no("unpin_topic", $mod['unpin_topic'] )
|
||||
) );
|
||||
|
||||
$ADMIN->html .= $SKIN->end_table();
|
||||
|
||||
//+-------------------------------
|
||||
|
||||
$SKIN->td_header[] = array( " " , "40%" );
|
||||
$SKIN->td_header[] = array( " " , "60%" );
|
||||
|
||||
//+-------------------------------
|
||||
|
||||
$ADMIN->html .= $SKIN->start_table( "Moderator Control Panel Settings" );
|
||||
|
||||
//+-------------------------------
|
||||
|
||||
$ADMIN->html .= $SKIN->add_td_row( array( "<b>Can mass move topics?</b>" ,
|
||||
$SKIN->form_yes_no("mass_move", $mod['mass_move'] )
|
||||
) );
|
||||
|
||||
$ADMIN->html .= $SKIN->add_td_row( array( "<b>Can mass prune topics?</b>" ,
|
||||
$SKIN->form_yes_no("mass_prune", $mod['mass_prune'] )
|
||||
) );
|
||||
|
||||
$ADMIN->html .= $SKIN->add_td_row( array( "<b>Can manage queued topics?</b>" ,
|
||||
$SKIN->form_yes_no("topic_q", $mod['topic_q'] )
|
||||
) );
|
||||
|
||||
$ADMIN->html .= $SKIN->add_td_row( array( "<b>Can manage queued posts?</b>" ,
|
||||
$SKIN->form_yes_no("post_q", $mod['post_q'] )
|
||||
) );
|
||||
|
||||
$ADMIN->html .= $SKIN->end_table();
|
||||
|
||||
//+-------------------------------
|
||||
|
||||
$SKIN->td_header[] = array( " " , "40%" );
|
||||
$SKIN->td_header[] = array( " " , "60%" );
|
||||
|
||||
//+-------------------------------
|
||||
|
||||
$ADMIN->html .= $SKIN->start_table( "Advanced Settings" );
|
||||
|
||||
//+-------------------------------
|
||||
|
||||
$ADMIN->html .= $SKIN->add_td_row( array( "<b>Can warn other users?</b>" ,
|
||||
$SKIN->form_yes_no("allow_warn", $mod['allow_warn'] )
|
||||
) );
|
||||
|
||||
$ADMIN->html .= $SKIN->add_td_row( array( "<b>Can edit user avatars and signatures?</b>" ,
|
||||
$SKIN->form_yes_no("edit_user", $mod['edit_user'] )
|
||||
) );
|
||||
|
||||
//+-------------------------------
|
||||
|
||||
$ADMIN->html .= $SKIN->end_form($button);
|
||||
|
||||
$ADMIN->html .= $SKIN->end_table();
|
||||
|
||||
$ADMIN->output();
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
//+---------------------------------------------------------------------------------
|
||||
//
|
||||
// ADD step one: Look up a member
|
||||
//
|
||||
//+---------------------------------------------------------------------------------
|
||||
|
||||
function add_one() {
|
||||
global $IN, $root_path, $INFO, $DB, $SKIN, $ADMIN, $std, $MEMBER, $GROUP;
|
||||
|
||||
//-----------------------------
|
||||
// Grab and serialize the input
|
||||
//-----------------------------
|
||||
|
||||
$fid = "";
|
||||
$fidarray = array();
|
||||
|
||||
foreach ($IN as $k => $v)
|
||||
{
|
||||
if ( preg_match( "/^add_(\d+)$/", $k, $match ) )
|
||||
{
|
||||
if ($IN[ $match[0] ])
|
||||
{
|
||||
$fidarray[] = $match[1];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( count($fidarray) < 1 )
|
||||
{
|
||||
$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 );
|
||||
|
||||
$ADMIN->page_title = "Add a moderator";
|
||||
|
||||
$ADMIN->page_detail = "Please find a member to moderate the forums you previously selected.";
|
||||
|
||||
//+-------------------------------
|
||||
|
||||
$ADMIN->html .= $SKIN->start_form( array( 1 => array( 'code' , 'add_two' ),
|
||||
2 => array( 'act' , 'mod' ),
|
||||
3 => array( 'fid' , $fid ),
|
||||
) );
|
||||
|
||||
//+-------------------------------
|
||||
|
||||
$SKIN->td_header[] = array( " " , "40%" );
|
||||
$SKIN->td_header[] = array( " " , "60%" );
|
||||
|
||||
//+-------------------------------
|
||||
|
||||
$ADMIN->html .= $SKIN->start_table( "Search for a member" );
|
||||
|
||||
|
||||
$ADMIN->html .= $SKIN->add_td_row( array( "<b>Enter part or all of the usersname</b>" ,
|
||||
$SKIN->form_input( "USER_NAME" )
|
||||
) );
|
||||
|
||||
$ADMIN->html .= $SKIN->end_form("Find Member");
|
||||
|
||||
$ADMIN->html .= $SKIN->end_table();
|
||||
|
||||
$ADMIN->output();
|
||||
|
||||
|
||||
}
|
||||
|
||||
//+---------------------------------------------------------------------------------
|
||||
//
|
||||
// REFINE MEMBER SEARCH
|
||||
//
|
||||
//+---------------------------------------------------------------------------------
|
||||
|
||||
function add_two() {
|
||||
global $IN, $root_path, $INFO, $DB, $SKIN, $ADMIN, $std, $MEMBER, $GROUP;
|
||||
|
||||
if ($IN['USER_NAME'] == "")
|
||||
{
|
||||
$ADMIN->error("You didn't choose a member name to look for!");
|
||||
}
|
||||
|
||||
$DB->query("SELECT id, name FROM ibf_members WHERE name LIKE '".$IN['USER_NAME']."%'");
|
||||
|
||||
if (! $DB->get_num_rows() )
|
||||
{
|
||||
$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'] );
|
||||
}
|
||||
|
||||
|
||||
|
||||
$ADMIN->page_title = "Add a moderator";
|
||||
|
||||
$ADMIN->page_detail = "Please select the correct member name from the selection below to add as a moderator to the previously selected forums.";
|
||||
|
||||
//+-------------------------------
|
||||
|
||||
$ADMIN->html .= $SKIN->start_form( array( 1 => array( 'code' , 'add_final' ),
|
||||
2 => array( 'act' , 'mod' ),
|
||||
3 => array( 'fid' , $IN['fid']),
|
||||
) );
|
||||
|
||||
//+-------------------------------
|
||||
|
||||
$SKIN->td_header[] = array( " " , "40%" );
|
||||
$SKIN->td_header[] = array( " " , "60%" );
|
||||
|
||||
//+-------------------------------
|
||||
|
||||
$ADMIN->html .= $SKIN->start_table( "Search for a member" );
|
||||
|
||||
|
||||
$ADMIN->html .= $SKIN->add_td_row( array( "<b>Choose from the matches...</b>" ,
|
||||
$SKIN->form_dropdown( "MEMBER_ID", $form_array )
|
||||
) );
|
||||
|
||||
$ADMIN->html .= $SKIN->end_form("Choose Member");
|
||||
|
||||
$ADMIN->html .= $SKIN->end_table();
|
||||
|
||||
$ADMIN->output();
|
||||
|
||||
}
|
||||
|
||||
|
||||
//+---------------------------------------------------------------------------------
|
||||
//
|
||||
// SHOW LIST
|
||||
// Renders a complete listing of all the forums and categories w/mods.
|
||||
//
|
||||
//+---------------------------------------------------------------------------------
|
||||
|
||||
function show_list() {
|
||||
global $IN, $root_path, $INFO, $DB, $SKIN, $ADMIN, $std, $MEMBER, $GROUP;
|
||||
|
||||
$ADMIN->page_title = "Moderator Control Overview";
|
||||
$ADMIN->page_detail = "This section allows you to edit, remove and add new moderators to your forums";
|
||||
|
||||
$ADMIN->html .= $SKIN->start_form( array( 1 => array( 'code' , 'add' ),
|
||||
2 => array( 'act' , 'mod' ),
|
||||
) );
|
||||
|
||||
$SKIN->td_header[] = array( "Add" , "5%" );
|
||||
$SKIN->td_header[] = array( "Forum Name" , "30%" );
|
||||
$SKIN->td_header[] = array( "Posts" , "10%" );
|
||||
$SKIN->td_header[] = array( "Topics" , "10%" );
|
||||
$SKIN->td_header[] = array( "Current Moderators" , "45%" );
|
||||
|
||||
$ADMIN->html .= $SKIN->start_table( "Your Categories and Forums" );
|
||||
|
||||
//------------------------------------
|
||||
|
||||
$cats = array();
|
||||
$forums = array();
|
||||
$mods = array();
|
||||
$children = array();
|
||||
|
||||
$DB->query("SELECT * from ibf_categories where id > 0 ORDER BY position ASC");
|
||||
while ($r = $DB->fetch_row())
|
||||
{
|
||||
$cats[$r['id']] = $r;
|
||||
}
|
||||
|
||||
$DB->query("SELECT * from ibf_forums ORDER BY position ASC");
|
||||
while ($r = $DB->fetch_row())
|
||||
{
|
||||
|
||||
if ($r['parent_id'] > 0)
|
||||
{
|
||||
$children[ $r['parent_id'] ][] = $r;
|
||||
}
|
||||
else
|
||||
{
|
||||
$forums[] = $r;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$DB->query("SELECT * from ibf_moderators");
|
||||
while ($r = $DB->fetch_row())
|
||||
{
|
||||
$mods[] = $r;
|
||||
}
|
||||
|
||||
//------------------------------------
|
||||
|
||||
$last_cat_id = -1;
|
||||
|
||||
foreach ($cats as $c)
|
||||
{
|
||||
|
||||
$ADMIN->html .= $SKIN->add_td_row( array(
|
||||
' ',
|
||||
"<a href='{$ADMIN->base_url}&act=cat&code=doeditform&c={$c['id']}'>".$c['name']."</a>",
|
||||
' ',
|
||||
' ',
|
||||
' ',
|
||||
), 'catrow' );
|
||||
$last_cat_id = $c['id'];
|
||||
|
||||
|
||||
foreach($forums as $r)
|
||||
{
|
||||
|
||||
if ($r['category'] == $last_cat_id)
|
||||
{
|
||||
|
||||
$mod_string = "";
|
||||
|
||||
foreach( $mods as $phpid => $data )
|
||||
{
|
||||
if ($data['forum_id'] == $r['id'])
|
||||
{
|
||||
$mod_string .= "<tr>
|
||||
<td width='60%'>{$data['member_name']}</td>
|
||||
<td width='20%'><a href='{$ADMIN->base_url}&act=mod&code=remove&mid={$data['mid']}'>Remove</a></td>
|
||||
<td width='20%'><a href='{$ADMIN->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>";
|
||||
}
|
||||
|
||||
if ($r['subwrap'] == 1)
|
||||
{
|
||||
|
||||
$ADMIN->html .= $SKIN->add_td_row( array(
|
||||
' ',
|
||||
$c['name'],
|
||||
' ',
|
||||
' ',
|
||||
' ',
|
||||
), 'catrow2' );
|
||||
}
|
||||
else
|
||||
{
|
||||
$ADMIN->html .= $SKIN->add_td_row( array(
|
||||
"<center><input type='checkbox' name='add_{$r['id']}' value='1'></center>",
|
||||
"<b>".$r['name']."</b><br>".$r['description'],
|
||||
$r['posts'],
|
||||
$r['topics'],
|
||||
$these_mods
|
||||
) );
|
||||
}
|
||||
|
||||
if ( ( isset($children[ $r['id'] ]) ) and ( count ($children[ $r['id'] ]) > 0 ) )
|
||||
{
|
||||
foreach($children[ $r['id'] ] as $idx => $rd)
|
||||
{
|
||||
|
||||
$mod_string = "";
|
||||
|
||||
foreach( $mods as $phpid => $data )
|
||||
{
|
||||
if ($data['forum_id'] == $rd['id'])
|
||||
{
|
||||
$mod_string .= "<tr>
|
||||
<td width='60%'>{$data['member_name']}</td>
|
||||
<td width='20%'><a href='{$ADMIN->base_url}&act=mod&code=remove&mid={$data['mid']}'>Remove</a></td>
|
||||
<td width='20%'><a href='{$ADMIN->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>";
|
||||
}
|
||||
|
||||
$ADMIN->html .= $SKIN->add_td_row( array(
|
||||
"<center><input type='checkbox' name='add_{$rd['id']}' value='1'></center>",
|
||||
"<b>".$rd['name']."</b><br>".$rd['description'],
|
||||
$rd['posts'],
|
||||
$rd['topics'],
|
||||
$these_mods
|
||||
) ,'subforum' );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$ADMIN->html .= $SKIN->end_form("Add a moderator to the selected forums");
|
||||
|
||||
$ADMIN->html .= $SKIN->end_table();
|
||||
|
||||
$ADMIN->output();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,282 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
+--------------------------------------------------------------------------
|
||||
| IBFORUMS v1
|
||||
| ========================================
|
||||
| by Matthew Mecham and David Baxter
|
||||
| (c) 2001,2002 IBForums
|
||||
| http://www.ibforums.com
|
||||
| ========================================
|
||||
| Web: http://www.ibforums.com
|
||||
| Email: phpboards@ibforums.com
|
||||
| Licence Info: phpib-licence@ibforums.com
|
||||
+---------------------------------------------------------------------------
|
||||
|
|
||||
| > Import functions
|
||||
| > Module written by Matt Mecham
|
||||
| > Date started: 22nd April 2002
|
||||
|
|
||||
| > Module Version Number: 1.0.0
|
||||
+--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
|
||||
// Ensure we've not accessed this script directly:
|
||||
|
||||
|
||||
|
||||
$idx = new ad_modlogs();
|
||||
|
||||
|
||||
class ad_modlogs {
|
||||
|
||||
var $base_url;
|
||||
|
||||
function ad_modlogs() {
|
||||
global $IN, $root_path, $INFO, $DB, $SKIN, $ADMIN, $std, $MEMBER, $GROUP;
|
||||
|
||||
switch($IN['code'])
|
||||
{
|
||||
|
||||
case 'view':
|
||||
$this->view();
|
||||
break;
|
||||
|
||||
case 'remove':
|
||||
$this->remove();
|
||||
break;
|
||||
|
||||
|
||||
//-------------------------
|
||||
default:
|
||||
$this->list_current();
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//---------------------------------------------
|
||||
// Remove archived files
|
||||
//---------------------------------------------
|
||||
|
||||
function view()
|
||||
{
|
||||
global $IN, $root_path, $INFO, $DB, $SKIN, $ADMIN, $std, $MEMBER, $GROUP;
|
||||
|
||||
$start = $IN['st'] ? $IN['st'] : 0;
|
||||
|
||||
$ADMIN->page_detail = "Viewing all actions by a moderator";
|
||||
$ADMIN->page_title = "Moderator Logs Manager";
|
||||
|
||||
if ($IN['search_string'] == "")
|
||||
{
|
||||
$DB->query("SELECT COUNT(id) as count FROM ibf_moderator_logs WHERE member_id='".$IN['mid']."'");
|
||||
$row = $DB->fetch_row();
|
||||
|
||||
$row_count = $row['count'];
|
||||
|
||||
$query = "&act=modlog&mid={$IN['mid']}&code=view";
|
||||
|
||||
$DB->query("SELECT m.*, f.id as forum_id, f.name FROM ibf_moderator_logs m, ibf_forums f WHERE m.member_id='".$IN['mid']."' AND f.id=m.forum_id ORDER BY m.ctime DESC LIMIT $start, 20");
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
$IN['search_string'] = urldecode($IN['search_string']);
|
||||
|
||||
if ( ($IN['search_type'] == 'topic_id') or ($IN['search_type'] == 'forum_id') )
|
||||
{
|
||||
$dbq = "m.".$IN['search_type']."='".$IN['search_string']."'";
|
||||
}
|
||||
else
|
||||
{
|
||||
$dbq = "m.".$IN['search_type']." LIKE '%".$IN['search_string']."%'";
|
||||
}
|
||||
|
||||
$DB->query("SELECT COUNT(m.id) as count FROM ibf_moderator_logs m WHERE $dbq");
|
||||
$row = $DB->fetch_row();
|
||||
|
||||
$row_count = $row['count'];
|
||||
|
||||
$query = "&act=modlog&code=view&search_type={$IN['search_type']}&search_string=".urlencode($IN['search_string']);
|
||||
|
||||
$DB->query("SELECT m.*, f.id as forum_id, f.name FROM ibf_moderator_logs m, ibf_forums f WHERE $dbq AND f.id=m.forum_id ORDER BY m.ctime DESC LIMIT $start, 20");
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
$links = $std->build_pagelinks( array( 'TOTAL_POSS' => $row_count,
|
||||
'PER_PAGE' => 20,
|
||||
'CUR_ST_VAL' => $start,
|
||||
'L_SINGLE' => "Single Page",
|
||||
'L_MULTI' => "Pages: ",
|
||||
'BASE_URL' => $ADMIN->base_url.$query,
|
||||
)
|
||||
);
|
||||
|
||||
$ADMIN->page_detail = "You may view and remove actions performed by your moderators";
|
||||
$ADMIN->page_title = "Moderator Logs Manager";
|
||||
|
||||
//+-------------------------------
|
||||
|
||||
$SKIN->td_header[] = array( "Member Name" , "15%" );
|
||||
$SKIN->td_header[] = array( "Action Perfomed" , "15%" );
|
||||
$SKIN->td_header[] = array( "Forum" , "15%" );
|
||||
$SKIN->td_header[] = array( "Topic Title" , "25%" );
|
||||
$SKIN->td_header[] = array( "Time of action" , "20%" );
|
||||
$SKIN->td_header[] = array( "IP address" , "10%" );
|
||||
|
||||
$ADMIN->html .= $SKIN->start_table( "Saved Moderator Logs" );
|
||||
$ADMIN->html .= $SKIN->add_td_basic($links, 'center', 'catrow');
|
||||
|
||||
if ( $DB->get_num_rows() )
|
||||
{
|
||||
while ( $row = $DB->fetch_row() )
|
||||
{
|
||||
|
||||
$row['ctime'] = $std->get_date( $row['ctime'], 'LONG' );
|
||||
|
||||
$sess_id = preg_replace( "/^.+?s=(\w{32}).+?$/" , "\\1", $row['http_referer'] );
|
||||
$row['http_referer'] = preg_replace( "/s=(\w){32}/" , "" , $row['http_referer'] );
|
||||
|
||||
$ADMIN->html .= $SKIN->add_td_row( array( "<b>{$row['member_name']}</b>",
|
||||
"<span style='font-weight:bold;color:red'><a href='#' onClick=\"alert('HTTP REFERRER OF ACTION:\\n{$row['http_referer']}\\nSESSION ID OF ACTION:\\n$sess_id')\">{$row['action']}</a></span>",
|
||||
"<b>{$row['name']}</b>",
|
||||
"{$row['topic_title']}",
|
||||
"{$row['ctime']}",
|
||||
"{$row['ip_address']}",
|
||||
) );
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$ADMIN->html .= $SKIN->add_td_basic("<center>No results</center>");
|
||||
}
|
||||
|
||||
$ADMIN->html .= $SKIN->add_td_basic($links, 'center', 'tdtop');
|
||||
|
||||
$ADMIN->html .= $SKIN->end_table();
|
||||
|
||||
|
||||
//+-------------------------------
|
||||
//+-------------------------------
|
||||
|
||||
$ADMIN->output();
|
||||
|
||||
}
|
||||
|
||||
//---------------------------------------------
|
||||
// Remove archived files
|
||||
//---------------------------------------------
|
||||
|
||||
function remove()
|
||||
{
|
||||
global $IN, $root_path, $INFO, $DB, $SKIN, $ADMIN, $std, $MEMBER, $GROUP;
|
||||
|
||||
if ($IN['mid'] == "")
|
||||
{
|
||||
$ADMIN->error("You did not select a member ID to remove by!");
|
||||
}
|
||||
|
||||
$DB->query("DELETE FROM ibf_moderator_logs WHERE member_id='".$IN['mid']."'");
|
||||
|
||||
$std->boink_it($ADMIN->base_url."&act=modlog");
|
||||
exit();
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//-------------------------------------------------------------
|
||||
// SHOW ALL LANGUAGE PACKS
|
||||
//-------------------------------------------------------------
|
||||
|
||||
function list_current()
|
||||
{
|
||||
global $IN, $root_path, $INFO, $DB, $SKIN, $ADMIN, $std, $MEMBER, $GROUP;
|
||||
|
||||
$form_array = array();
|
||||
|
||||
$ADMIN->page_detail = "You may view and remove actions performed by your moderators";
|
||||
$ADMIN->page_title = "Moderator Logs Manager";
|
||||
|
||||
//+-------------------------------
|
||||
|
||||
$SKIN->td_header[] = array( "Member Name" , "30%" );
|
||||
$SKIN->td_header[] = array( "Actions Perfomed" , "20%" );
|
||||
$SKIN->td_header[] = array( "View all by member" , "20%" );
|
||||
$SKIN->td_header[] = array( "Remove all by member" , "30%" );
|
||||
|
||||
$ADMIN->html .= $SKIN->start_table( "Saved Moderator Logs" );
|
||||
|
||||
$DB->query("SELECT m.*, count(m.id) as act_count from ibf_moderator_logs m GROUP BY m.member_id ORDER BY act_count DESC");
|
||||
|
||||
while ( $r = $DB->fetch_row() )
|
||||
{
|
||||
|
||||
$ADMIN->html .= $SKIN->add_td_row( array( "<b>{$r['member_name']}</b>",
|
||||
"<center>{$r['act_count']}</center>",
|
||||
"<center><a href='".$SKIN->base_url."&act=modlog&code=view&mid={$r['member_id']}'>View</a></center>",
|
||||
"<center><a href='".$SKIN->base_url."&act=modlog&code=remove&mid={$r['member_id']}'>Remove</a></center>",
|
||||
) );
|
||||
}
|
||||
|
||||
|
||||
|
||||
$ADMIN->html .= $SKIN->end_table();
|
||||
|
||||
|
||||
//+-------------------------------
|
||||
//+-------------------------------
|
||||
|
||||
$ADMIN->html .= $SKIN->start_form( array( 1 => array( 'code' , 'view' ),
|
||||
2 => array( 'act' , 'modlog' ),
|
||||
) );
|
||||
|
||||
$SKIN->td_header[] = array( " " , "40%" );
|
||||
$SKIN->td_header[] = array( " " , "60%" );
|
||||
|
||||
$ADMIN->html .= $SKIN->start_table( "Search Moderator Logs" );
|
||||
|
||||
$form_array = array(
|
||||
0 => array( 'topic_title', 'Topic Title' ),
|
||||
1 => array( 'ip_address', 'IP Address' ),
|
||||
2 => array( 'member_name', 'Member Name' ),
|
||||
3 => array( 'topic_id' , 'Topic ID' ),
|
||||
4 => array( 'forum_id' , 'Forum ID' )
|
||||
);
|
||||
|
||||
//+-------------------------------
|
||||
|
||||
$ADMIN->html .= $SKIN->add_td_row( array( "<b>Search for...</b>" ,
|
||||
$SKIN->form_input( "search_string")
|
||||
) );
|
||||
|
||||
$ADMIN->html .= $SKIN->add_td_row( array( "<b>Search in...</b>" ,
|
||||
$SKIN->form_dropdown( "search_type", $form_array)
|
||||
) );
|
||||
|
||||
$ADMIN->html .= $SKIN->end_form("Search");
|
||||
|
||||
$ADMIN->html .= $SKIN->end_table();
|
||||
|
||||
//+-------------------------------
|
||||
//+-------------------------------
|
||||
|
||||
$ADMIN->output();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,862 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
+--------------------------------------------------------------------------
|
||||
| IBFORUMS v1
|
||||
| ========================================
|
||||
| by Matthew Mecham and David Baxter
|
||||
| (c) 2001,2002 IBForums
|
||||
| http://www.ibforums.com
|
||||
| ========================================
|
||||
| Web: http://www.ibforums.com
|
||||
| Email: phpboards@ibforums.com
|
||||
| Licence Info: phpib-licence@ibforums.com
|
||||
+---------------------------------------------------------------------------
|
||||
|
|
||||
| > Help Control functions
|
||||
| > Module written by Matt Mecham
|
||||
| > Date started: 2nd April 2002
|
||||
|
|
||||
| > Module Version Number: 1.0.0
|
||||
+--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
|
||||
|
||||
$idx = new ad_settings();
|
||||
|
||||
|
||||
class ad_settings {
|
||||
|
||||
var $base_url;
|
||||
|
||||
function ad_settings() {
|
||||
global $IN, $root_path, $INFO, $DB, $SKIN, $ADMIN, $std, $MEMBER, $GROUP;
|
||||
|
||||
switch($IN['code'])
|
||||
{
|
||||
case 'wrapper':
|
||||
$this->list_wrappers();
|
||||
break;
|
||||
|
||||
case 'add':
|
||||
$this->do_form('add');
|
||||
break;
|
||||
|
||||
case 'edit':
|
||||
$this->do_form('edit');
|
||||
break;
|
||||
|
||||
case 'doadd':
|
||||
$this->save_skin('add');
|
||||
break;
|
||||
|
||||
case 'doedit':
|
||||
$this->save_skin('edit');
|
||||
break;
|
||||
|
||||
case 'remove':
|
||||
$this->remove();
|
||||
break;
|
||||
|
||||
//-------------------------
|
||||
case 'memskins':
|
||||
$this->mem_skins();
|
||||
break;
|
||||
|
||||
case 'export':
|
||||
$this->export();
|
||||
break;
|
||||
|
||||
default:
|
||||
$this->list_sets();
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//----------------------------------------------------
|
||||
|
||||
function export()
|
||||
{
|
||||
global $IN, $root_path, $INFO, $DB, $SKIN, $ADMIN, $std, $MEMBER, $GROUP;
|
||||
|
||||
if ($IN['id'] == "")
|
||||
{
|
||||
$ADMIN->error("You must specify an existing skin set ID, go back and try again");
|
||||
}
|
||||
|
||||
//+-------------------------------
|
||||
|
||||
$DB->query("SELECT * from ibf_skins WHERE uid='".$IN['id']."'");
|
||||
|
||||
if ( ! $row = $DB->fetch_row() )
|
||||
{
|
||||
$ADMIN->error("Could not query the information from the database");
|
||||
}
|
||||
|
||||
//+-------------------------------
|
||||
|
||||
$DB->query("SELECT * from ibf_images WHERE imid='".$row['img_id']."'");
|
||||
|
||||
if ( ! $img = $DB->fetch_row() )
|
||||
{
|
||||
$ADMIN->error("Could not query the information from the database");
|
||||
}
|
||||
|
||||
//+-------------------------------
|
||||
|
||||
$DB->query("SELECT * from ibf_css WHERE cssid='".$row['css_id']."'");
|
||||
|
||||
if ( ! $css = $DB->fetch_row() )
|
||||
{
|
||||
$ADMIN->error("Could not query the information from the database");
|
||||
}
|
||||
|
||||
|
||||
//+-------------------------------
|
||||
|
||||
$DB->query("SELECT * from ibf_tmpl_names WHERE skid='".$row['set_id']."'");
|
||||
|
||||
if ( ! $tmpl = $DB->fetch_row() )
|
||||
{
|
||||
$ADMIN->error("Could not query the information from the database");
|
||||
}
|
||||
|
||||
//+-------------------------------
|
||||
|
||||
$DB->query("SELECT * from ibf_templates WHERE tmid='".$row['tmpl_id']."'");
|
||||
|
||||
if ( ! $wrap = $DB->fetch_row() )
|
||||
{
|
||||
$ADMIN->error("Could not query the information from the database");
|
||||
}
|
||||
|
||||
|
||||
//+-------------------------------
|
||||
|
||||
if ($INFO['base_dir'] == './')
|
||||
{
|
||||
$INFO['base_dir'] = str_replace( '\\', '/', getcwd() ) . '/';
|
||||
}
|
||||
|
||||
$archive_dir = $INFO['base_dir']."archive_out";
|
||||
$images_dir = $INFO['base_dir']."style_images/".$img['imid'];
|
||||
$css_file = $INFO['base_dir']."style_sheets/stylesheet_{$css['cssid']}.css";
|
||||
$templates_dir = $INFO['base_dir']."style_templates/".$tmpl['skid'];
|
||||
|
||||
require $root_dir."sources/lib/tar.php";
|
||||
|
||||
if (!is_dir($archive_dir))
|
||||
{
|
||||
$ADMIN->error("Could not locate $archive_dir, is the directory there?");
|
||||
}
|
||||
|
||||
if (!is_writeable($archive_dir))
|
||||
{
|
||||
$ADMIN->error("Cannot write in $archive_dir, CHMOD via FTP to 0755 or 0777 to enable this script to write into it. IBF cannot do this for you");
|
||||
}
|
||||
|
||||
if (!file_exists($css_file))
|
||||
{
|
||||
$ADMIN->error("Could not locate $css_file, is the directory there?");
|
||||
}
|
||||
|
||||
if (!is_dir($templates_dir))
|
||||
{
|
||||
$ADMIN->error("Could not locate $templates_dir, is the directory there?");
|
||||
}
|
||||
|
||||
if (!is_dir($images_dir))
|
||||
{
|
||||
$ADMIN->error("Could not locate $images_dir, is the directory there?");
|
||||
}
|
||||
|
||||
//+-------------------------------
|
||||
// Set up the dir structure
|
||||
//+-------------------------------
|
||||
|
||||
$css_name = "stylesheet.css";
|
||||
$wrap_name = "wrapper.html";
|
||||
|
||||
$img_dir = 'images';
|
||||
$templ_dir = 'templates';
|
||||
|
||||
$pack_name = preg_replace( "/\s{1,}/", "_", $row['sname'] );
|
||||
|
||||
$new_dir = "set-".$pack_name;
|
||||
|
||||
//+-------------------------------
|
||||
|
||||
if ( ! mkdir($archive_dir."/".$new_dir, 0777) )
|
||||
{
|
||||
$ADMIN->error("Directory creation failed, cannot export skin set. Please check the permission in 'archive_out'");
|
||||
}
|
||||
|
||||
//+-------------------------------
|
||||
|
||||
if ( ! mkdir($archive_dir."/".$new_dir."/".$img_dir, 0777) )
|
||||
{
|
||||
$ADMIN->error("Directory creation failed, cannot export skin set. Please check the permission in 'archive_out'");
|
||||
}
|
||||
|
||||
//+-------------------------------
|
||||
|
||||
if ( ! mkdir($archive_dir."/".$new_dir."/".$templ_dir, 0777) )
|
||||
{
|
||||
$ADMIN->error("Directory creation failed, cannot export skin set. Please check the permission in 'archive_out'");
|
||||
}
|
||||
|
||||
//+-------------------------------
|
||||
// Make the wrapper file...
|
||||
//+-------------------------------
|
||||
|
||||
$wrap['template'] = preg_replace("/\r/", "\n", $wrap['template'] );
|
||||
|
||||
$FH = fopen($archive_dir."/".$new_dir."/".$wrap_name, 'w');
|
||||
fwrite($FH, $wrap['template'], strlen($wrap['template']));
|
||||
fclose($FH);
|
||||
|
||||
@chmod($archive_dir."/".$new_dir."/".$wrap_name, 0777);
|
||||
|
||||
//+-------------------------------
|
||||
// Make the css file...
|
||||
//+-------------------------------
|
||||
|
||||
if ( ! copy($css_file, $archive_dir."/".$new_dir."/".$css_name) )
|
||||
{
|
||||
$ADMIN->error("COPY FAILED ON STYLE SHEET $css_name, maybe the script has insufficient permissions?");
|
||||
}
|
||||
|
||||
@chmod($archive_dir."/".$new_dir."/".$css_name, 0777);
|
||||
|
||||
//+-------------------------------
|
||||
// Copy over the images...
|
||||
//+-------------------------------
|
||||
|
||||
if ( ! $ADMIN->copy_dir($images_dir, $archive_dir."/".$new_dir."/".$img_dir) )
|
||||
{
|
||||
$ADMIN->error( $ADMIN->errors );
|
||||
}
|
||||
|
||||
// Generate the config file..
|
||||
|
||||
$file_content = "<?php\n\n";
|
||||
|
||||
foreach($img as $k => $v)
|
||||
{
|
||||
|
||||
$v = preg_replace( "#style_images/".$img['imid']."/#", "style_images/%img_dir%/", $v );
|
||||
|
||||
$file_content .= "\n\$config['$k'] = \"".addslashes($v)."\";";
|
||||
}
|
||||
|
||||
$file_content .= "\n\n?".">";
|
||||
|
||||
$FH = fopen($archive_dir."/".$new_dir."/"."img_conf.inc", 'w');
|
||||
fwrite($FH, $file_content, strlen($file_content));
|
||||
fclose($FH);
|
||||
|
||||
//+-------------------------------
|
||||
// Copy over the skin templates...
|
||||
//+-------------------------------
|
||||
|
||||
if ( ! $ADMIN->copy_dir($templates_dir, $archive_dir."/".$new_dir."/".$templ_dir) )
|
||||
{
|
||||
$ADMIN->error( $ADMIN->errors );
|
||||
}
|
||||
|
||||
// Generate the config file..
|
||||
|
||||
$file_content = "<?php\n\n".
|
||||
"\$config=array('author' => \"".addslashes($tmpl['author'])."\", ".
|
||||
"'email'=>\"".addslashes($tmpl['email'])."\", ".
|
||||
"'tbl_border'=>\"".addslashes($row['tbl_border'])."\", ".
|
||||
"'tbl_width'=>\"".addslashes($row['tbl_width'])."\", ".
|
||||
"'url'=>\"".addslashes($tmpl['url'])."\")\n\n?".">";
|
||||
|
||||
$FH = fopen($archive_dir."/".$new_dir."/"."templates_conf.inc", 'w');
|
||||
fwrite($FH, $file_content, strlen($file_content));
|
||||
fclose($FH);
|
||||
|
||||
//+-------------------------------
|
||||
// Add files and write tarball
|
||||
//+-------------------------------
|
||||
|
||||
$tar = new tar();
|
||||
|
||||
$tar->new_tar( $archive_dir, $new_dir.".tar" );
|
||||
$tar->add_directory( $archive_dir."/".$new_dir );
|
||||
$tar->write_tar();
|
||||
|
||||
// Check for errors.
|
||||
|
||||
if ($tar->error != "")
|
||||
{
|
||||
$ADMIN->error($tar->error);
|
||||
}
|
||||
|
||||
// remove original unarchived directory
|
||||
|
||||
$ADMIN->rm_dir($archive_dir."/".$new_dir);
|
||||
|
||||
$ADMIN->done_screen("Skin Pack Export Created<br><br>You can download the tar-chive <a href='archive_out/{$new_dir}.tar' target='_blank'>here</a>", "Manage Skin Sets", "act=sets" );
|
||||
|
||||
|
||||
}
|
||||
|
||||
//----------------------------------------------
|
||||
|
||||
function mem_skins()
|
||||
{
|
||||
global $IN, $root_path, $INFO, $DB, $SKIN, $ADMIN, $std, $MEMBER, $GROUP, $HTTP_POST_VARS;
|
||||
|
||||
$DB->query("SELECT sid FROM ibf_skins WHERE uid='".$IN['oid']."'");
|
||||
$old = $DB->fetch_row();
|
||||
|
||||
if ($IN['nid'] == 'n')
|
||||
{
|
||||
$DB->query("UPDATE ibf_members SET skin=NULL WHERE skin='".$old['sid']."'");
|
||||
}
|
||||
else
|
||||
{
|
||||
$DB->query("SELECT sid FROM ibf_skins WHERE uid='".$IN['nid']."'");
|
||||
$new = $DB->fetch_row();
|
||||
$DB->query("UPDATE ibf_members SET skin='".$new['sid']."' WHERE skin='".$old['sid']."'");
|
||||
}
|
||||
|
||||
$ADMIN->done_screen("Member Skin Choices Updated", "Manage Skin Sets", "act=sets" );
|
||||
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------
|
||||
// REMOVE WRAPPERS
|
||||
//-------------------------------------------------------------
|
||||
|
||||
function remove()
|
||||
{
|
||||
global $IN, $root_path, $INFO, $DB, $SKIN, $ADMIN, $std, $MEMBER, $GROUP, $HTTP_POST_VARS;
|
||||
|
||||
//+-------------------------------
|
||||
|
||||
if ($IN['id'] == "")
|
||||
{
|
||||
$ADMIN->error("You must specify an existing skin set ID, go back and try again");
|
||||
}
|
||||
|
||||
//+-------------------------------
|
||||
|
||||
$DB->query("SELECT * FROM ibf_skins WHERE uid='".$IN['id']."'");
|
||||
|
||||
if (! $skin = $DB->fetch_row() )
|
||||
{
|
||||
$ADMIN->error("Could not query that skin set information from the DB");
|
||||
}
|
||||
|
||||
//+-------------------------------
|
||||
|
||||
if ($skin['default_set'] == 1)
|
||||
{
|
||||
$ADMIN->error("You can not remove this skin set as it is set as the default. Set another skin as default and try again");
|
||||
}
|
||||
|
||||
//+-------------------------------
|
||||
|
||||
// Update the members skins..
|
||||
|
||||
$DB->query("UPDATE ibf_members SET skin='' WHERE skin='".$skin['sid']."'");
|
||||
|
||||
// Update the forums DB
|
||||
|
||||
$DB->query("SELECT id FROM ibf_forums WHERE skin_id='".$skin['sid']."'");
|
||||
|
||||
if ( $DB->get_num_rows() )
|
||||
{
|
||||
$arr = array();
|
||||
|
||||
while ( $i = $DB->fetch_row() )
|
||||
{
|
||||
$arr['forum_skin_'.$i['id']] = '';
|
||||
}
|
||||
|
||||
$DB->query("UPDATE ibf_forums SET skin_id='' WHERE skin_id='".$skin['sid']."'");
|
||||
|
||||
// Remove it from the config file..
|
||||
|
||||
$ADMIN->rebuild_config($arr);
|
||||
|
||||
}
|
||||
|
||||
// Remove skin from the DB
|
||||
|
||||
$DB->query("DELETE FROM ibf_skins WHERE uid='".$IN['id']."'");
|
||||
|
||||
$std->boink_it($SKIN->base_url."&act=sets");
|
||||
|
||||
exit();
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
//-------------------------------------------------------------
|
||||
// ADD / EDIT SKIN SETS
|
||||
//-------------------------------------------------------------
|
||||
|
||||
function save_skin( $type='add' )
|
||||
{
|
||||
global $IN, $root_path, $INFO, $DB, $SKIN, $ADMIN, $std, $MEMBER, $GROUP, $HTTP_POST_VARS;
|
||||
|
||||
//+-------------------------------
|
||||
|
||||
if ($type == 'edit')
|
||||
{
|
||||
if ($IN['id'] == "")
|
||||
{
|
||||
$ADMIN->error("You must specify an existing skin set ID, go back and try again");
|
||||
}
|
||||
}
|
||||
|
||||
if ($IN['sname'] == "")
|
||||
{
|
||||
$ADMIN->error("You must specify a name for this skin pack ID");
|
||||
}
|
||||
|
||||
if ($IN['tbl_width'] == "")
|
||||
{
|
||||
$ADMIN->error("You must specify a table width");
|
||||
}
|
||||
|
||||
$barney = array( 'sname' => stripslashes($HTTP_POST_VARS['sname']),
|
||||
'set_id' => $IN['template'],
|
||||
'tmpl_id' => $IN['wrapper'],
|
||||
'img_id' => $IN['image'],
|
||||
'css_id' => $IN['css'],
|
||||
'tbl_border' => $IN['tbl_border'],
|
||||
'tbl_width' => $IN['tbl_width'],
|
||||
'hidden' => $IN['hidden'],
|
||||
'default_set'=> $IN['default_set'],
|
||||
);
|
||||
|
||||
if ($type == 'add')
|
||||
{
|
||||
|
||||
$DB->query("SELECT MAX(sid) as new_id FROM ibf_skins");
|
||||
|
||||
$row = $DB->fetch_row();
|
||||
|
||||
$barney['sid'] = $row['new_id'] + 1;
|
||||
|
||||
$db_string = $DB->compile_db_insert_string( $barney );
|
||||
|
||||
$DB->query("INSERT INTO ibf_skins (".$db_string['FIELD_NAMES'].") VALUES(".$db_string['FIELD_VALUES'].")");
|
||||
|
||||
if ($IN['default_set'] == 1)
|
||||
{
|
||||
$DB->query("UPDATE ibf_skins SET default_set=0 WHERE sid <> '".$barney['sid']."'");
|
||||
}
|
||||
|
||||
$std->boink_it($SKIN->base_url."&act=sets");
|
||||
|
||||
exit();
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
$db_string = $DB->compile_db_update_string( $barney );
|
||||
|
||||
$DB->query("UPDATE ibf_skins SET $db_string WHERE uid='".$IN['id']."'");
|
||||
|
||||
if ($IN['default_set'] == 1)
|
||||
{
|
||||
$DB->query("UPDATE ibf_skins SET default_set=0 WHERE uid <> '".$IN['id']."'");
|
||||
}
|
||||
|
||||
$ADMIN->done_screen("Skin Set Updated", "Manage Skin Sets", "act=sets" );
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------
|
||||
// ADD / EDIT SETS
|
||||
//-------------------------------------------------------------
|
||||
|
||||
function do_form( $type='add' )
|
||||
{
|
||||
global $IN, $root_path, $INFO, $DB, $SKIN, $ADMIN, $std, $MEMBER, $GROUP;
|
||||
|
||||
//+-------------------------------
|
||||
|
||||
$css = array();
|
||||
$wrappers = array();
|
||||
$templates = array();
|
||||
$images = array();
|
||||
|
||||
//+-------------------------------
|
||||
|
||||
if ($IN['id'] == "")
|
||||
{
|
||||
$ADMIN->error("You must specify an existing wrapper ID, go back and try again");
|
||||
}
|
||||
|
||||
//+-------------------------------
|
||||
|
||||
$DB->query("SELECT * from ibf_skins WHERE uid='".$IN['id']."'");
|
||||
|
||||
if ( ! $row = $DB->fetch_row() )
|
||||
{
|
||||
$ADMIN->error("Could not query the information from the database");
|
||||
}
|
||||
|
||||
//+-------------------------------
|
||||
|
||||
$DB->query("SELECT imid, setname FROM ibf_images");
|
||||
|
||||
while( $img = $DB->fetch_row() )
|
||||
{
|
||||
$images[] = array( $img['imid'], $img['setname'] );
|
||||
}
|
||||
|
||||
//+-------------------------------
|
||||
|
||||
$DB->query("SELECT cssid, css_name FROM ibf_css");
|
||||
|
||||
while ( $c = $DB->fetch_row() )
|
||||
{
|
||||
$css[] = array( $c['cssid'], $c['css_name'] );
|
||||
}
|
||||
|
||||
//+-------------------------------
|
||||
|
||||
$DB->query("SELECT tmid, name FROM ibf_templates");
|
||||
|
||||
while ( $t = $DB->fetch_row() )
|
||||
{
|
||||
$wrappers[] = array( $t['tmid'], $t['name'] );
|
||||
}
|
||||
|
||||
//+-------------------------------
|
||||
|
||||
$DB->query("SELECT skid, skname FROM ibf_tmpl_names");
|
||||
|
||||
while ( $s = $DB->fetch_row() )
|
||||
{
|
||||
$templates[] = array( $s['skid'], $s['skname'] );
|
||||
}
|
||||
|
||||
|
||||
//+-------------------------------
|
||||
|
||||
if ($type == 'add')
|
||||
{
|
||||
$code = 'doadd';
|
||||
$button = 'Create Skin Set';
|
||||
$row['sname'] = $row['sname'].".2";
|
||||
$row['default_set'] = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
$code = 'doedit';
|
||||
$button = 'Edit Skin Set';
|
||||
}
|
||||
|
||||
//+-------------------------------
|
||||
|
||||
$ADMIN->page_detail = "You may mix n' match which skin resources you wish to apply to this skin set.";
|
||||
$ADMIN->page_title = "Manage Skin Sets";
|
||||
|
||||
//+-------------------------------
|
||||
|
||||
$ADMIN->html .= $SKIN->start_form( array( 1 => array( 'code' , $code ),
|
||||
2 => array( 'act' , 'sets' ),
|
||||
3 => array( 'id' , $IN['id'] ),
|
||||
), "theAdminForm", "onSubmit=\"return no_specialchars('sets')\"" );
|
||||
|
||||
//+-------------------------------
|
||||
|
||||
$SKIN->td_header[] = array( " " , "40%" );
|
||||
$SKIN->td_header[] = array( " " , "60%" );
|
||||
|
||||
//+-------------------------------
|
||||
|
||||
$ADMIN->html .= $SKIN->start_table( $button );
|
||||
|
||||
$ADMIN->html .= $SKIN->js_no_specialchars();
|
||||
|
||||
$ADMIN->html .= $SKIN->add_td_row( array(
|
||||
"<b>Skin Set Title</b>",
|
||||
$SKIN->form_input('sname', $row['sname']),
|
||||
) );
|
||||
|
||||
$ADMIN->html .= $SKIN->add_td_row( array(
|
||||
"<b>Use Templates:</b>",
|
||||
$SKIN->form_dropdown('template', $templates, $row['set_id']),
|
||||
) );
|
||||
|
||||
$ADMIN->html .= $SKIN->add_td_row( array(
|
||||
"<b>Use Image & Macro Set:</b>",
|
||||
$SKIN->form_dropdown('image', $images, $row['img_id']),
|
||||
) );
|
||||
|
||||
$ADMIN->html .= $SKIN->add_td_row( array(
|
||||
"<b>Use Stylesheet:</b>",
|
||||
$SKIN->form_dropdown('css', $css, $row['css_id']),
|
||||
) );
|
||||
|
||||
$ADMIN->html .= $SKIN->add_td_row( array(
|
||||
"<b>Use Wrapper:</b>",
|
||||
$SKIN->form_dropdown('wrapper', $wrappers, $row['tmpl_id']),
|
||||
) );
|
||||
|
||||
$ADMIN->html .= $SKIN->add_td_row( array(
|
||||
"<b>Basic Table Width:</b>",
|
||||
$SKIN->form_input('tbl_width', $row['tbl_width']),
|
||||
) );
|
||||
|
||||
$ADMIN->html .= $SKIN->add_td_row( array(
|
||||
"<b>Basic Table Border Colour:</b>",
|
||||
$SKIN->form_input('tbl_border', $row['tbl_border']),
|
||||
) );
|
||||
|
||||
$ADMIN->html .= $SKIN->add_td_row( array(
|
||||
"<b>Hide from Members?</b><br>Useful if you want to make a forum only skin",
|
||||
$SKIN->form_yes_no('hidden', $row['hidden']),
|
||||
) );
|
||||
|
||||
$ADMIN->html .= $SKIN->add_td_row( array(
|
||||
"<b>Set as default skin set?</b><br>Used for unallocted forum and member skins",
|
||||
$SKIN->form_yes_no('default_set', $row['default_set']),
|
||||
) );
|
||||
|
||||
$ADMIN->html .= $SKIN->end_form($button);
|
||||
|
||||
$ADMIN->html .= $SKIN->end_table();
|
||||
|
||||
//+-------------------------------
|
||||
//+-------------------------------
|
||||
|
||||
$ADMIN->output();
|
||||
|
||||
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------
|
||||
// SHOW WRAPPERS
|
||||
//-------------------------------------------------------------
|
||||
|
||||
function list_sets()
|
||||
{
|
||||
global $IN, $root_path, $INFO, $DB, $SKIN, $ADMIN, $std, $MEMBER, $GROUP;
|
||||
|
||||
$form_array = array();
|
||||
|
||||
$forums = array();
|
||||
$forum_skins = array();
|
||||
|
||||
$ADMIN->page_detail = "You may add/edit and remove skin sets.<br><br>Skin sets are groups of style resources. You can mix n' match board wrappers, image and macro sets, stylesheets and skin templates. If you wish to edit any of the resources, please choose the resource you wish to manage from the menu bar on the left.";
|
||||
$ADMIN->page_title = "Manage Skin Sets";
|
||||
|
||||
//+-------------------------------
|
||||
|
||||
$DB->query("SELECT id, name FROM ibf_forums");
|
||||
|
||||
while ( $f = $DB->fetch_row() )
|
||||
{
|
||||
$forums[ $f['id'] ] = $f['name'];
|
||||
|
||||
if ($INFO['forum_skin_'.$f['id']] != "")
|
||||
{
|
||||
$forum_skins[ $INFO['forum_skin_'.$f['id']] ][] = $f['name'];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$SKIN->td_header[] = array( "Title" , "40%" );
|
||||
$SKIN->td_header[] = array( "No. Members" , "20%" );
|
||||
$SKIN->td_header[] = array( "Export" , "10%" );
|
||||
$SKIN->td_header[] = array( "Edit" , "10%" );
|
||||
$SKIN->td_header[] = array( "Remove" , "10%" );
|
||||
$SKIN->td_header[] = array( "Hidden" , "5%" );
|
||||
$SKIN->td_header[] = array( "Default" , "5%" );
|
||||
|
||||
//+-------------------------------
|
||||
|
||||
$DB->query("select ibf_skins.*, count(ibf_members.id) as mcount from ibf_skins left join ibf_members on(ibf_members.skin=ibf_skins.sid) where (ibf_members.skin is not null or ibf_skins.default_set = 1) group by ibf_skins.sid order by ibf_skins.sname");
|
||||
|
||||
$used_ids = array();
|
||||
|
||||
if ( $DB->get_num_rows() )
|
||||
{
|
||||
|
||||
$ADMIN->html .= $SKIN->start_table( "Current Skins Used by Members" );
|
||||
|
||||
while ( $r = $DB->fetch_row() )
|
||||
{
|
||||
$extra = "";
|
||||
|
||||
if ( is_array($forum_skins[ $r['sid'] ]) )
|
||||
{
|
||||
if ( count($forum_skins[ $r['sid'] ]) > 0 )
|
||||
{
|
||||
$extra = "<br>(Used in forums: ".implode( ",", $forum_skins[ $r['sid'] ] )." )";
|
||||
}
|
||||
}
|
||||
|
||||
$default = ' ';
|
||||
$hidden = ' ';
|
||||
|
||||
if ($r['hidden'] == 1)
|
||||
{
|
||||
$hidden = "<span style='color:red;font-weight:bold'>X</span>";
|
||||
}
|
||||
|
||||
if ($r['default_set'] == 1)
|
||||
{
|
||||
$default = "<span style='color:red;font-weight:bold'>X</span>";
|
||||
}
|
||||
|
||||
$ADMIN->html .= $SKIN->add_td_row( array( "<b>".stripslashes($r['sname'])."</b>$extra",
|
||||
"<center>".$r['mcount']."</center>",
|
||||
"<center><a href='".$SKIN->base_url."&act=sets&code=export&id={$r['uid']}'>Export</a></center>",
|
||||
"<center><a href='".$SKIN->base_url."&act=sets&code=edit&id={$r['uid']}'>Edit</a></center>",
|
||||
"<center><a href='".$SKIN->base_url."&act=sets&code=remove&id={$r['uid']}'>Remove</a></center>",
|
||||
"<center>$hidden</center>",
|
||||
"<center>$default</center>",
|
||||
) );
|
||||
|
||||
$used_ids[] = $r['uid'];
|
||||
|
||||
$form_array[] = array( $r['uid'], $r['sname'] );
|
||||
|
||||
}
|
||||
|
||||
$ADMIN->html .= $SKIN->end_table();
|
||||
}
|
||||
|
||||
if ( count($used_ids) > 0 )
|
||||
{
|
||||
|
||||
$DB->query("SELECT * FROM ibf_skins WHERE uid NOT IN(".implode(",",$used_ids).")");
|
||||
|
||||
if ( $DB->get_num_rows() )
|
||||
{
|
||||
|
||||
$SKIN->td_header[] = array( "Title" , "60%" );
|
||||
$SKIN->td_header[] = array( "Export" , "10%" );
|
||||
$SKIN->td_header[] = array( "Edit" , "10%" );
|
||||
$SKIN->td_header[] = array( "Remove" , "10%" );
|
||||
$SKIN->td_header[] = array( "Hidden" , "5%" );
|
||||
$SKIN->td_header[] = array( "Default", "5%" );
|
||||
|
||||
$ADMIN->html .= $SKIN->start_table( "Skin Sets not used by Members" );
|
||||
|
||||
while ( $r = $DB->fetch_row() )
|
||||
{
|
||||
|
||||
$extra = "";
|
||||
|
||||
if ( is_array($forum_skins[ $r['sid'] ]) )
|
||||
{
|
||||
if ( count($forum_skins[ $r['sid'] ]) > 0 )
|
||||
{
|
||||
$extra = "<br>(Used in forums: ".implode( ",", $forum_skins[ $r['sid'] ] )." )";
|
||||
}
|
||||
}
|
||||
|
||||
$default = ' ';
|
||||
$hidden = ' ';
|
||||
|
||||
if ($r['hidden'] == 1)
|
||||
{
|
||||
$hidden = "<span style='color:red;font-weight:bold'>X</span>";
|
||||
}
|
||||
|
||||
if ($r['default_set'] == 1)
|
||||
{
|
||||
$default = "<span style='color:red;font-weight:bold'>X</span>";
|
||||
}
|
||||
|
||||
$ADMIN->html .= $SKIN->js_checkdelete();
|
||||
|
||||
|
||||
$ADMIN->html .= $SKIN->add_td_row( array( "<b>".stripslashes($r['sname'])."</b>$extra",
|
||||
"<center><a href='".$SKIN->base_url."&act=sets&code=export&id={$r['uid']}'>Export</a></center>",
|
||||
"<center><a href='".$SKIN->base_url."&act=sets&code=edit&id={$r['uid']}'>Edit</a></center>",
|
||||
"<center><a href='javascript:checkdelete(\"act=sets&code=remove&id={$r['uid']}\")'>Remove</a></center>",
|
||||
"<center>$hidden</center>",
|
||||
"<center>$default</center>",
|
||||
) );
|
||||
|
||||
$form_array[] = array( $r['uid'], $r['sname'] );
|
||||
|
||||
}
|
||||
|
||||
$ADMIN->html .= $SKIN->end_table();
|
||||
}
|
||||
}
|
||||
|
||||
//+-------------------------------
|
||||
//+-------------------------------
|
||||
|
||||
$ADMIN->html .= $SKIN->start_form( array( 1 => array( 'code' , 'add' ),
|
||||
2 => array( 'act' , 'sets' ),
|
||||
) );
|
||||
|
||||
$SKIN->td_header[] = array( " " , "40%" );
|
||||
$SKIN->td_header[] = array( " " , "60%" );
|
||||
|
||||
$ADMIN->html .= $SKIN->start_table( "Create New Skin Set" );
|
||||
|
||||
//+-------------------------------
|
||||
|
||||
$ADMIN->html .= $SKIN->add_td_row( array( "<b>Base new skin set on...</b>" ,
|
||||
$SKIN->form_dropdown( "id", $form_array)
|
||||
) );
|
||||
|
||||
$ADMIN->html .= $SKIN->end_form("Create new Skin Set");
|
||||
|
||||
$ADMIN->html .= $SKIN->end_table();
|
||||
|
||||
//+-------------------------------
|
||||
//+-------------------------------
|
||||
|
||||
$ADMIN->html .= $SKIN->start_form( array( 1 => array( 'code' , 'memskins' ),
|
||||
2 => array( 'act' , 'sets' ),
|
||||
) );
|
||||
|
||||
$SKIN->td_header[] = array( " " , "40%" );
|
||||
$SKIN->td_header[] = array( " " , "60%" );
|
||||
|
||||
$ADMIN->html .= $SKIN->start_table( "Swop members skin choice" );
|
||||
|
||||
//+-------------------------------
|
||||
|
||||
$ADMIN->html .= $SKIN->add_td_row( array( "<b>Where members use skin...</b>",
|
||||
$SKIN->form_dropdown( "oid", $form_array)
|
||||
) );
|
||||
|
||||
$form_array[] = array( 'n', 'None (Will use whatever is set as default)' );
|
||||
|
||||
$ADMIN->html .= $SKIN->add_td_row( array( "<b>update to use skin...</b>",
|
||||
$SKIN->form_dropdown( "nid", $form_array)
|
||||
) );
|
||||
|
||||
$ADMIN->html .= $SKIN->end_form("Update members skin choice");
|
||||
|
||||
$ADMIN->html .= $SKIN->end_table();
|
||||
|
||||
//+-------------------------------
|
||||
//+-------------------------------
|
||||
|
||||
$ADMIN->output();
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,502 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
+--------------------------------------------------------------------------
|
||||
| IBFORUMS v1
|
||||
| ========================================
|
||||
| by Matthew Mecham and David Baxter
|
||||
| (c) 2001,2002 IBForums
|
||||
| http://www.ibforums.com
|
||||
| ========================================
|
||||
| Web: http://www.ibforums.com
|
||||
| Email: phpboards@ibforums.com
|
||||
| Licence Info: phpib-licence@ibforums.com
|
||||
+---------------------------------------------------------------------------
|
||||
|
|
||||
| > CSS management functions
|
||||
| > Module written by Matt Mecham
|
||||
| > Date started: 4th April 2002
|
||||
|
|
||||
| > Module Version Number: 1.0.0
|
||||
+--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
|
||||
$idx = new ad_settings();
|
||||
|
||||
|
||||
class ad_settings {
|
||||
|
||||
var $base_url;
|
||||
|
||||
function ad_settings() {
|
||||
global $IN, $root_path, $INFO, $DB, $SKIN, $ADMIN, $std, $MEMBER, $GROUP;
|
||||
|
||||
switch($IN['code'])
|
||||
{
|
||||
case 'wrapper':
|
||||
$this->list_sheets();
|
||||
break;
|
||||
|
||||
case 'add':
|
||||
$this->do_form('add');
|
||||
break;
|
||||
|
||||
case 'edit':
|
||||
$this->do_form('edit');
|
||||
break;
|
||||
|
||||
case 'doadd':
|
||||
$this->save_wrapper('add');
|
||||
break;
|
||||
|
||||
case 'doedit':
|
||||
$this->save_wrapper('edit');
|
||||
break;
|
||||
|
||||
case 'remove':
|
||||
$this->remove();
|
||||
break;
|
||||
|
||||
case 'export':
|
||||
$this->export();
|
||||
break;
|
||||
|
||||
//-------------------------
|
||||
default:
|
||||
$this->list_sheets();
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function export()
|
||||
{
|
||||
global $IN, $root_path, $INFO, $DB, $SKIN, $ADMIN, $std, $MEMBER, $GROUP;
|
||||
|
||||
if ($IN['id'] == "")
|
||||
{
|
||||
$ADMIN->error("You must specify an existing CSS ID, go back and try again");
|
||||
}
|
||||
|
||||
//+-------------------------------
|
||||
|
||||
$DB->query("SELECT * from ibf_css WHERE cssid='".$IN['id']."'");
|
||||
|
||||
if ( ! $row = $DB->fetch_row() )
|
||||
{
|
||||
$ADMIN->error("Could not query the information from the database");
|
||||
}
|
||||
|
||||
//+-------------------------------
|
||||
|
||||
$archive_dir = $INFO['base_dir']."/archive_out";
|
||||
|
||||
$css_file = $INFO['base_dir']."/style_sheets/stylesheet_{$row['cssid']}.css";
|
||||
|
||||
if (!is_dir($archive_dir))
|
||||
{
|
||||
$ADMIN->error("Could not locate $archive_dir, is the directory there?");
|
||||
}
|
||||
|
||||
if (!is_writeable($archive_dir))
|
||||
{
|
||||
$ADMIN->error("Cannot write in $archive_dir, CHMOD via FTP to 0755 or 0777 to enable this script to write into it. IBF cannot do this for you");
|
||||
}
|
||||
|
||||
if (!file_exists($css_file))
|
||||
{
|
||||
$ADMIN->error("Cannot locate $css_file, please ensure that the file is in the proper directory");
|
||||
}
|
||||
|
||||
//+-------------------------------
|
||||
// Attempt to copy the files to the
|
||||
// working directory...
|
||||
//+-------------------------------
|
||||
|
||||
$l_name = preg_replace( "/\s{1,}/", "_", $row['css_name'] );
|
||||
|
||||
$file_name = "css-".$l_name.".css";
|
||||
|
||||
if ( ! copy($css_file, $archive_dir."/".$file_name) )
|
||||
{
|
||||
$ADMIN->error("COPY FAILED ON STYLE SHEET $file_name, maybe the script has insufficient permissions?");
|
||||
}
|
||||
|
||||
@chmod($archive_dir."/".$file_name, 0777);
|
||||
|
||||
$ADMIN->done_screen("Style Sheet Export Created<br><br>You can download the CSS resource <a href='archive_out/$file_name' target='_blank'>here</a>", "Manage Style Sheets", "act=style" );
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------
|
||||
// REMOVE WRAPPERS
|
||||
//-------------------------------------------------------------
|
||||
|
||||
function remove()
|
||||
{
|
||||
global $IN, $root_path, $INFO, $DB, $SKIN, $ADMIN, $std, $MEMBER, $GROUP, $HTTP_POST_VARS;
|
||||
|
||||
//+-------------------------------
|
||||
|
||||
|
||||
if ($IN['id'] == "")
|
||||
{
|
||||
$ADMIN->error("You must specify an existing stylesheet ID, go back and try again");
|
||||
}
|
||||
|
||||
$DB->query("DELETE FROM ibf_css WHERE cssid='".$IN['id']."'");
|
||||
|
||||
@unlink( $root_path."style_sheets/stylesheet_{$IN['id']}.css" );
|
||||
|
||||
$std->boink_it($SKIN->base_url."&act=style");
|
||||
|
||||
exit();
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
//-------------------------------------------------------------
|
||||
// ADD / EDIT WRAPPERS
|
||||
//-------------------------------------------------------------
|
||||
|
||||
function save_wrapper( $type='add' )
|
||||
{
|
||||
global $IN, $root_path, $INFO, $DB, $SKIN, $ADMIN, $std, $MEMBER, $GROUP, $HTTP_POST_VARS;
|
||||
|
||||
//+-------------------------------
|
||||
|
||||
if ($type == 'edit')
|
||||
{
|
||||
if ($IN['id'] == "")
|
||||
{
|
||||
$ADMIN->error("You must specify an existing CSS ID, go back and try again");
|
||||
}
|
||||
|
||||
$file = $root_path."style_sheets/stylesheet_".$IN['id'].".css";
|
||||
|
||||
if ( ! is_writeable($file) )
|
||||
{
|
||||
$ADMIN->error("IBF does not have permission to write to that file. Try setting the CHMOD on $file to 0777 and try again. You can do this via FTP");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if ($IN['name'] == "")
|
||||
{
|
||||
$ADMIN->error("You must specify a name for this stylesheet");
|
||||
}
|
||||
|
||||
if ($IN['css'] == "")
|
||||
{
|
||||
$ADMIN->error("You can't have an empty stylesheet, can you?");
|
||||
}
|
||||
|
||||
$css = stripslashes($HTTP_POST_VARS['css']);
|
||||
|
||||
$barney = array( 'css_name' => stripslashes($HTTP_POST_VARS['name']),
|
||||
'css_text' => $css,
|
||||
);
|
||||
|
||||
if ($type == 'add')
|
||||
{
|
||||
$db_string = $DB->compile_db_insert_string( $barney );
|
||||
|
||||
$DB->query("INSERT INTO ibf_css (".$db_string['FIELD_NAMES'].") VALUES(".$db_string['FIELD_VALUES'].")");
|
||||
|
||||
$new_id = $DB->get_insert_id();
|
||||
|
||||
$nfile = $root_path."style_sheets/stylesheet_".$new_id.".css";
|
||||
|
||||
if ($fh = fopen( $nfile, 'w' ) )
|
||||
{
|
||||
fwrite( $fh, $css, strlen($css) );
|
||||
fclose( $fh );
|
||||
|
||||
@chmod( $nfile, 0777 );
|
||||
}
|
||||
else
|
||||
{
|
||||
$DB->query("DELETE FROM ibf_css WHERE cssid='$new_id'");
|
||||
|
||||
$ADMIN->error("Could not prepare $file for creation - please check the CHMOD value of the 'style_sheets' directory and where possible CHMOD to 0777 via FTP");
|
||||
}
|
||||
|
||||
$std->boink_it($SKIN->base_url."&act=style");
|
||||
|
||||
exit();
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
$db_string = $DB->compile_db_update_string( $barney );
|
||||
|
||||
if ($fh = fopen( $file, 'w' ) )
|
||||
{
|
||||
fwrite( $fh, $css, strlen($css) );
|
||||
fclose( $fh );
|
||||
|
||||
@chmod( $file, 0777 );
|
||||
|
||||
$DB->query("UPDATE ibf_css SET $db_string WHERE cssid='".$IN['id']."'");
|
||||
|
||||
$ADMIN->done_screen("Stylesheet updated", "Manage Style Sheets", "act=style" );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
$ADMIN->error("Could not prepare $file for writing - please check the CHMOD value of the 'style_sheets' directory");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------
|
||||
// ADD / EDIT WRAPPERS
|
||||
//-------------------------------------------------------------
|
||||
|
||||
function do_form( $type='add' )
|
||||
{
|
||||
global $IN, $root_path, $INFO, $DB, $SKIN, $ADMIN, $std, $MEMBER, $GROUP;
|
||||
|
||||
//+-------------------------------
|
||||
|
||||
if ($IN['id'] == "")
|
||||
{
|
||||
$ADMIN->error("You must specify an existing wrapper ID, go back and try again");
|
||||
}
|
||||
|
||||
//+-------------------------------
|
||||
|
||||
$DB->query("SELECT cssid, css_name FROM ibf_css WHERE cssid='".$IN['id']."'");
|
||||
|
||||
if ( ! $cssinfo = $DB->fetch_row() )
|
||||
{
|
||||
$ADMIN->error("Could not query the CSS details from the database");
|
||||
}
|
||||
|
||||
//+-------------------------------
|
||||
|
||||
$file = $root_path."style_sheets/stylesheet_".$IN['id'].".css";
|
||||
|
||||
if ( ! file_exists($file) )
|
||||
{
|
||||
$ADMIN->error("Could not load the stylesheet. No file found at $file");
|
||||
}
|
||||
|
||||
if ( ! is_readable($file) )
|
||||
{
|
||||
$ADMIN->error("IBF does not have permission to read from that file. Try setting the CHMOD on $file to 0777 and try again. You can do this via FTP");
|
||||
}
|
||||
|
||||
//+-------------------------------
|
||||
|
||||
$fh = fopen( $file, 'r' );
|
||||
$css = fread( $fh, filesize($file) );
|
||||
fclose($fh);
|
||||
|
||||
if ($type == 'add')
|
||||
{
|
||||
$code = 'doadd';
|
||||
$button = 'Create StyleSheet';
|
||||
$cssinfo['css_name'] = $cssinfo['css_name'].".2";
|
||||
}
|
||||
else
|
||||
{
|
||||
// Availability test
|
||||
|
||||
if ( ! is_writeable($file) )
|
||||
{
|
||||
$ADMIN->error("IBF does not have permission to write to that file. Try setting the CHMOD on $file to 0777 and try again. You can do this via FTP");
|
||||
}
|
||||
|
||||
$code = 'doedit';
|
||||
$button = 'Edit Stylesheet';
|
||||
}
|
||||
|
||||
//+-------------------------------
|
||||
|
||||
$ADMIN->page_detail = "You may use CSS fully when adding or editing stylesheets.";
|
||||
$ADMIN->page_title = "Manage Style Sheets";
|
||||
|
||||
//+-------------------------------
|
||||
|
||||
$ADMIN->html .= $SKIN->js_no_specialchars();
|
||||
|
||||
$ADMIN->html .= $SKIN->start_form( array( 1 => array( 'code' , $code ),
|
||||
2 => array( 'act' , 'style' ),
|
||||
3 => array( 'id' , $IN['id'] ),
|
||||
), "theAdminForm", "onSubmit=\"return no_specialchars('csssheet')\"" );
|
||||
|
||||
//+-------------------------------
|
||||
|
||||
$SKIN->td_header[] = array( " " , "20%" );
|
||||
$SKIN->td_header[] = array( " " , "80%" );
|
||||
|
||||
//+-------------------------------
|
||||
|
||||
$ADMIN->html .= $SKIN->start_table( $button );
|
||||
|
||||
$ADMIN->html .= $SKIN->add_td_row( array(
|
||||
"Stylesheet Title",
|
||||
$SKIN->form_input('name', $cssinfo['css_name']),
|
||||
) );
|
||||
|
||||
$ADMIN->html .= $SKIN->add_td_row( array(
|
||||
"Content",
|
||||
$SKIN->form_textarea('css', $css, "70", "30"),
|
||||
) );
|
||||
|
||||
$ADMIN->html .= $SKIN->end_form($button);
|
||||
|
||||
$ADMIN->html .= $SKIN->end_table();
|
||||
|
||||
//+-------------------------------
|
||||
//+-------------------------------
|
||||
|
||||
$ADMIN->output();
|
||||
|
||||
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------
|
||||
// SHOW STYLE SHEETS
|
||||
//-------------------------------------------------------------
|
||||
|
||||
function list_sheets()
|
||||
{
|
||||
global $IN, $root_path, $INFO, $DB, $SKIN, $ADMIN, $std, $MEMBER, $GROUP;
|
||||
|
||||
$form_array = array();
|
||||
$show_array = array();
|
||||
|
||||
$ADMIN->page_detail = "You may add/edit and remove stylesheets.<br><br>Style Sheets are CSS files. This is where you can change the colours, fonts and font sizes throughout the board.";
|
||||
$ADMIN->page_title = "Manage Stylesheets";
|
||||
|
||||
//+-------------------------------
|
||||
|
||||
$SKIN->td_header[] = array( "Title" , "40%" );
|
||||
$SKIN->td_header[] = array( "Allocation" , "30%" );
|
||||
$SKIN->td_header[] = array( "Export" , "10%" );
|
||||
$SKIN->td_header[] = array( "Edit" , "10%" );
|
||||
$SKIN->td_header[] = array( "Remove" , "10%" );
|
||||
|
||||
//+-------------------------------
|
||||
|
||||
$DB->query("SELECT DISTINCT(c.cssid), c.css_name, s.sname from ibf_css c, ibf_skins s WHERE s.css_id=c.cssid ORDER BY c.css_name ASC");
|
||||
|
||||
$used_ids = array();
|
||||
|
||||
if ( $DB->get_num_rows() )
|
||||
{
|
||||
|
||||
$ADMIN->html .= $SKIN->start_table( "Current Stylesheets In Use" );
|
||||
|
||||
while ( $r = $DB->fetch_row() )
|
||||
{
|
||||
|
||||
$show_array[ $r['cssid'] ] .= stripslashes($r['sname'])."<br>";
|
||||
|
||||
if ( in_array( $r['cssid'], $used_ids ) )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
$ADMIN->html .= $SKIN->add_td_row( array( "<b>".stripslashes($r['css_name'])."</b>",
|
||||
"<#X-{$r['cssid']}#>",
|
||||
"<center><a href='".$SKIN->base_url."&act=style&code=export&id={$r['cssid']}'>Export</a></center>",
|
||||
"<center><a href='".$SKIN->base_url."&act=style&code=edit&id={$r['cssid']}'>Edit</a></center>",
|
||||
"<i>Deallocate before removing</i>",
|
||||
) );
|
||||
|
||||
$used_ids[] = $r['cssid'];
|
||||
|
||||
$form_array[] = array( $r['cssid'], $r['css_name'] );
|
||||
|
||||
}
|
||||
|
||||
foreach( $show_array as $idx => $string )
|
||||
{
|
||||
$string = preg_replace( "/<br>$/", "", $string );
|
||||
|
||||
$ADMIN->html = preg_replace( "/<#X-$idx#>/", "$string", $ADMIN->html );
|
||||
}
|
||||
|
||||
$ADMIN->html .= $SKIN->end_table();
|
||||
}
|
||||
|
||||
if ( count($used_ids) > 0 )
|
||||
{
|
||||
|
||||
$DB->query("SELECT cssid, css_name FROM ibf_css WHERE cssid NOT IN(".implode(",",$used_ids).")");
|
||||
|
||||
if ( $DB->get_num_rows() )
|
||||
{
|
||||
|
||||
$SKIN->td_header[] = array( "Title" , "70%" );
|
||||
$SKIN->td_header[] = array( "Export" , "10%" );
|
||||
$SKIN->td_header[] = array( "Edit" , "10%" );
|
||||
$SKIN->td_header[] = array( "Remove" , "10%" );
|
||||
|
||||
$ADMIN->html .= $SKIN->start_table( "Current Unallocated Stylesheets" );
|
||||
|
||||
$ADMIN->html .= $SKIN->js_checkdelete();
|
||||
|
||||
|
||||
while ( $r = $DB->fetch_row() )
|
||||
{
|
||||
|
||||
$ADMIN->html .= $SKIN->add_td_row( array( "<b>".stripslashes($r['css_name'])."</b>",
|
||||
"<center><a href='".$SKIN->base_url."&act=style&code=export&id={$r['cssid']}'>Export</a></center>",
|
||||
"<center><a href='".$SKIN->base_url."&act=style&code=edit&id={$r['cssid']}'>Edit</a></center>",
|
||||
"<center><a href='javascript:checkdelete(\"act=style&code=remove&id={$r['cssid']}\")'>Remove</a></center>",
|
||||
) );
|
||||
|
||||
$form_array[] = array( $r['cssid'], $r['css_name'] );
|
||||
|
||||
}
|
||||
|
||||
$ADMIN->html .= $SKIN->end_table();
|
||||
}
|
||||
}
|
||||
|
||||
//+-------------------------------
|
||||
//+-------------------------------
|
||||
|
||||
$ADMIN->html .= $SKIN->start_form( array( 1 => array( 'code' , 'add' ),
|
||||
2 => array( 'act' , 'style' ),
|
||||
) );
|
||||
|
||||
$SKIN->td_header[] = array( " " , "40%" );
|
||||
$SKIN->td_header[] = array( " " , "60%" );
|
||||
|
||||
$ADMIN->html .= $SKIN->start_table( "Create New Stylesheet" );
|
||||
|
||||
//+-------------------------------
|
||||
|
||||
$ADMIN->html .= $SKIN->add_td_row( array( "<b>Base new stylesheet on...</b>" ,
|
||||
$SKIN->form_dropdown( "id", $form_array)
|
||||
) );
|
||||
|
||||
$ADMIN->html .= $SKIN->end_form("Create new stylesheet");
|
||||
|
||||
$ADMIN->html .= $SKIN->end_table();
|
||||
|
||||
//+-------------------------------
|
||||
//+-------------------------------
|
||||
|
||||
$ADMIN->output();
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,436 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
+--------------------------------------------------------------------------
|
||||
| IBFORUMS v1
|
||||
| ========================================
|
||||
| by Matthew Mecham and David Baxter
|
||||
| (c) 2001,2002 IBForums
|
||||
| http://www.ibforums.com
|
||||
| ========================================
|
||||
| Web: http://www.ibforums.com
|
||||
| Email: phpboards@ibforums.com
|
||||
| Licence Info: phpib-licence@ibforums.com
|
||||
+---------------------------------------------------------------------------
|
||||
|
|
||||
| > Help Control functions
|
||||
| > Module written by Matt Mecham
|
||||
| > Date started: 2nd April 2002
|
||||
|
|
||||
| > Module Version Number: 1.0.0
|
||||
+--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
|
||||
$idx = new ad_settings();
|
||||
|
||||
|
||||
class ad_settings {
|
||||
|
||||
var $base_url;
|
||||
|
||||
function ad_settings() {
|
||||
global $IN, $root_path, $INFO, $DB, $SKIN, $ADMIN, $std, $MEMBER, $GROUP;
|
||||
|
||||
switch($IN['code'])
|
||||
{
|
||||
case 'wrapper':
|
||||
$this->list_wrappers();
|
||||
break;
|
||||
|
||||
case 'add':
|
||||
$this->do_form('add');
|
||||
break;
|
||||
|
||||
case 'edit':
|
||||
$this->do_form('edit');
|
||||
break;
|
||||
|
||||
case 'doadd':
|
||||
$this->save_wrapper('add');
|
||||
break;
|
||||
|
||||
case 'doedit':
|
||||
$this->save_wrapper('edit');
|
||||
break;
|
||||
|
||||
case 'remove':
|
||||
$this->remove();
|
||||
break;
|
||||
|
||||
case 'export':
|
||||
$this->export();
|
||||
|
||||
//-------------------------
|
||||
default:
|
||||
$this->list_wrappers();
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function export()
|
||||
{
|
||||
global $IN, $root_path, $INFO, $DB, $SKIN, $ADMIN, $std, $MEMBER, $GROUP;
|
||||
|
||||
if ($IN['id'] == "")
|
||||
{
|
||||
$ADMIN->error("You must specify an existing wrapper ID, go back and try again");
|
||||
}
|
||||
|
||||
//+-------------------------------
|
||||
|
||||
$DB->query("SELECT * from ibf_templates WHERE tmid='".$IN['id']."'");
|
||||
|
||||
if ( ! $row = $DB->fetch_row() )
|
||||
{
|
||||
$ADMIN->error("Could not query the information from the database");
|
||||
}
|
||||
|
||||
//+-------------------------------
|
||||
|
||||
$archive_dir = $INFO['base_dir']."/archive_out";
|
||||
|
||||
require $root_dir."sources/lib/tar.php";
|
||||
|
||||
if (!is_dir($archive_dir))
|
||||
{
|
||||
$ADMIN->error("Could not locate $archive_dir, is the directory there?");
|
||||
}
|
||||
|
||||
if (!is_writeable($archive_dir))
|
||||
{
|
||||
$ADMIN->error("Cannot write in $archive_dir, CHMOD via FTP to 0755 or 0777 to enable this script to write into it. IBF cannot do this for you");
|
||||
}
|
||||
|
||||
//+-------------------------------
|
||||
// Attempt to copy the files to the
|
||||
// working directory...
|
||||
//+-------------------------------
|
||||
|
||||
$l_name = preg_replace( "/\s{1,}/", "_", $row['name'] );
|
||||
|
||||
$file_name = "wrap-".$l_name.".html";
|
||||
|
||||
$row['template'] = preg_replace("/\r/", "\n", $row['template'] );
|
||||
|
||||
$FH = fopen($archive_dir."/".$file_name, 'w');
|
||||
fwrite($FH, $row['template'], strlen($row['template']));
|
||||
fclose($FH);
|
||||
|
||||
$ADMIN->done_screen("Wrapper Export Created<br><br>You can download the html resource <a href='archive_out/$file_name' target='_blank'>here</a>", "Manage Board Wrappers", "act=wrap" );
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------
|
||||
// REMOVE WRAPPERS
|
||||
//-------------------------------------------------------------
|
||||
|
||||
function remove()
|
||||
{
|
||||
global $IN, $root_path, $INFO, $DB, $SKIN, $ADMIN, $std, $MEMBER, $GROUP, $HTTP_POST_VARS;
|
||||
|
||||
//+-------------------------------
|
||||
|
||||
|
||||
if ($IN['id'] == "")
|
||||
{
|
||||
$ADMIN->error("You must specify an existing wrapper ID, go back and try again");
|
||||
}
|
||||
|
||||
$DB->query("DELETE FROM ibf_templates WHERE tmid='".$IN['id']."'");
|
||||
|
||||
$std->boink_it($SKIN->base_url."&act=wrap");
|
||||
|
||||
exit();
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
//-------------------------------------------------------------
|
||||
// ADD / EDIT WRAPPERS
|
||||
//-------------------------------------------------------------
|
||||
|
||||
function save_wrapper( $type='add' )
|
||||
{
|
||||
global $IN, $root_path, $INFO, $DB, $SKIN, $ADMIN, $std, $MEMBER, $GROUP, $HTTP_POST_VARS;
|
||||
|
||||
//+-------------------------------
|
||||
|
||||
if ($type == 'edit')
|
||||
{
|
||||
if ($IN['id'] == "")
|
||||
{
|
||||
$ADMIN->error("You must specify an existing wrapper ID, go back and try again");
|
||||
}
|
||||
}
|
||||
|
||||
if ($IN['name'] == "")
|
||||
{
|
||||
$ADMIN->error("You must specify a name for this wrapper");
|
||||
}
|
||||
|
||||
if ($IN['template'] == "")
|
||||
{
|
||||
$ADMIN->error("You can't have an empty template, can you?");
|
||||
}
|
||||
|
||||
$tmpl = preg_replace( "!</textarea>!", "/textarea>", stripslashes($HTTP_POST_VARS['template']) );
|
||||
|
||||
if ( ! preg_match( "/<% BOARD %>/", $tmpl ) )
|
||||
{
|
||||
$ADMIN->error("You cannot remove the <% BOARD %> tag silly!");
|
||||
}
|
||||
|
||||
if ( ! preg_match( "/<% COPYRIGHT %>/", $tmpl ) )
|
||||
{
|
||||
$ADMIN->error("You cannot remove the <% COPYRIGHT %> tag silly!");
|
||||
}
|
||||
|
||||
$barney = array( 'name' => stripslashes($HTTP_POST_VARS['name']),
|
||||
'template' => $tmpl
|
||||
);
|
||||
|
||||
if ($type == 'add')
|
||||
{
|
||||
$db_string = $DB->compile_db_insert_string( $barney );
|
||||
|
||||
$DB->query("INSERT INTO ibf_templates (".$db_string['FIELD_NAMES'].") VALUES(".$db_string['FIELD_VALUES'].")");
|
||||
|
||||
$std->boink_it($SKIN->base_url."&act=wrap");
|
||||
|
||||
exit();
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
$db_string = $DB->compile_db_update_string( $barney );
|
||||
|
||||
$DB->query("UPDATE ibf_templates SET $db_string WHERE tmid='".$IN['id']."'");
|
||||
|
||||
$ADMIN->done_screen("Wrapper updated", "Manage Board Wrappers", "act=wrap" );
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------
|
||||
// ADD / EDIT WRAPPERS
|
||||
//-------------------------------------------------------------
|
||||
|
||||
function do_form( $type='add' )
|
||||
{
|
||||
global $IN, $root_path, $INFO, $DB, $SKIN, $ADMIN, $std, $MEMBER, $GROUP;
|
||||
|
||||
//+-------------------------------
|
||||
|
||||
if ($IN['id'] == "")
|
||||
{
|
||||
$ADMIN->error("You must specify an existing wrapper ID, go back and try again");
|
||||
}
|
||||
|
||||
$DB->query("SELECT * from ibf_templates WHERE tmid='".$IN['id']."'");
|
||||
|
||||
if ( ! $row = $DB->fetch_row() )
|
||||
{
|
||||
$ADMIN->error("Could not query the information from the database");
|
||||
}
|
||||
|
||||
if ($type == 'add')
|
||||
{
|
||||
$code = 'doadd';
|
||||
$button = 'Create Wrapper';
|
||||
$row['name'] = $row['name'].".2";
|
||||
}
|
||||
else
|
||||
{
|
||||
$code = 'doedit';
|
||||
$button = 'Edit Wrapper';
|
||||
}
|
||||
|
||||
//+-------------------------------
|
||||
|
||||
$ADMIN->page_detail = "You may use HTML fully when adding or editing wrappers.";
|
||||
$ADMIN->page_title = "Manage Board Wrappers";
|
||||
|
||||
//+-------------------------------
|
||||
|
||||
$ADMIN->html .= $SKIN->js_no_specialchars();
|
||||
|
||||
$ADMIN->html .= $SKIN->start_form( array( 1 => array( 'code' , $code ),
|
||||
2 => array( 'act' , 'wrap' ),
|
||||
3 => array( 'id' , $IN['id'] ),
|
||||
), "theAdminForm", "onSubmit=\"return no_specialchars('wrapper')\"" );
|
||||
|
||||
//+-------------------------------
|
||||
|
||||
$SKIN->td_header[] = array( " " , "20%" );
|
||||
$SKIN->td_header[] = array( " " , "80%" );
|
||||
|
||||
//+-------------------------------
|
||||
|
||||
$row['template'] = preg_replace( "/\/textarea>/", "</textarea>", $row['template'] ); // Stop html killing the text area
|
||||
|
||||
$ADMIN->html .= $SKIN->start_table( $button );
|
||||
|
||||
$ADMIN->html .= $SKIN->add_td_row( array(
|
||||
"Wrapper Title",
|
||||
$SKIN->form_input('name', $row['name']),
|
||||
) );
|
||||
|
||||
$ADMIN->html .= $SKIN->add_td_row( array(
|
||||
"Content",
|
||||
$SKIN->form_textarea('template', $row['template'], "60", "15"),
|
||||
) );
|
||||
|
||||
$ADMIN->html .= $SKIN->end_form($button);
|
||||
|
||||
$ADMIN->html .= $SKIN->end_table();
|
||||
|
||||
//+-------------------------------
|
||||
//+-------------------------------
|
||||
|
||||
$ADMIN->output();
|
||||
|
||||
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------
|
||||
// SHOW WRAPPERS
|
||||
//-------------------------------------------------------------
|
||||
|
||||
function list_wrappers()
|
||||
{
|
||||
global $IN, $root_path, $INFO, $DB, $SKIN, $ADMIN, $std, $MEMBER, $GROUP;
|
||||
|
||||
$form_array = array();
|
||||
|
||||
$ADMIN->page_detail = "You may add/edit and remove the board wrapper templates.<br><br>Board wrapper refers to the main board template which allows additional HTML to be added to the header and footer of the board";
|
||||
$ADMIN->page_title = "Manage Board Wrappers";
|
||||
|
||||
//+-------------------------------
|
||||
|
||||
$SKIN->td_header[] = array( "Title" , "40%" );
|
||||
$SKIN->td_header[] = array( "Allocation" , "30%" );
|
||||
$SKIN->td_header[] = array( "Export" , "10%" );
|
||||
$SKIN->td_header[] = array( "Edit" , "10%" );
|
||||
$SKIN->td_header[] = array( "Remove" , "10%" );
|
||||
|
||||
//+-------------------------------
|
||||
|
||||
$DB->query("SELECT DISTINCT(w.tmid), w.name, s.sname from ibf_templates w, ibf_skins s WHERE s.tmpl_id=w.tmid ORDER BY w.name ASC");
|
||||
|
||||
$used_ids = array();
|
||||
$show_array = array();
|
||||
|
||||
if ( $DB->get_num_rows() )
|
||||
{
|
||||
|
||||
$ADMIN->html .= $SKIN->start_table( "Current Wrappers In Use" );
|
||||
|
||||
while ( $r = $DB->fetch_row() )
|
||||
{
|
||||
|
||||
$show_array[ $r['tmid'] ] .= stripslashes($r['sname'])."<br>";
|
||||
|
||||
if ( in_array( $r['tmid'], $used_ids ) )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
$ADMIN->html .= $SKIN->add_td_row( array( "<b>".stripslashes($r['name'])."</b>",
|
||||
"<#X-{$r['tmid']}#>",
|
||||
"<center><a href='".$SKIN->base_url."&act=wrap&code=export&id={$r['tmid']}'>Export</a></center>",
|
||||
"<center><a href='".$SKIN->base_url."&act=wrap&code=edit&id={$r['tmid']}'>Edit</a></center>",
|
||||
"<i>Deallocate before removing</i>",
|
||||
) );
|
||||
|
||||
$used_ids[] = $r['tmid'];
|
||||
|
||||
$form_array[] = array( $r['tmid'], $r['name'] );
|
||||
|
||||
}
|
||||
|
||||
foreach( $show_array as $idx => $string )
|
||||
{
|
||||
$string = preg_replace( "/<br>$/", "", $string );
|
||||
|
||||
$ADMIN->html = preg_replace( "/<#X-$idx#>/", "$string", $ADMIN->html );
|
||||
}
|
||||
|
||||
$ADMIN->html .= $SKIN->end_table();
|
||||
}
|
||||
|
||||
if ( count($used_ids) > 0 )
|
||||
{
|
||||
|
||||
$DB->query("SELECT tmid, name FROM ibf_templates WHERE tmid NOT IN(".implode(",",$used_ids).")");
|
||||
|
||||
if ( $DB->get_num_rows() )
|
||||
{
|
||||
|
||||
$SKIN->td_header[] = array( "Title" , "70%" );
|
||||
$SKIN->td_header[] = array( "Export" , "10%" );
|
||||
$SKIN->td_header[] = array( "Edit" , "10%" );
|
||||
$SKIN->td_header[] = array( "Remove" , "10%" );
|
||||
|
||||
$ADMIN->html .= $SKIN->start_table( "Current Unallocated Wrappers" );
|
||||
|
||||
$ADMIN->html .= $SKIN->js_checkdelete();
|
||||
|
||||
|
||||
while ( $r = $DB->fetch_row() )
|
||||
{
|
||||
|
||||
$ADMIN->html .= $SKIN->add_td_row( array( "<b>".stripslashes($r['name'])."</b>",
|
||||
"<center><a href='".$SKIN->base_url."&act=wrap&code=export&id={$r['tmid']}'>Export</a></center>",
|
||||
"<center><a href='".$SKIN->base_url."&act=wrap&code=edit&id={$r['tmid']}'>Edit</a></center>",
|
||||
"<center><a href='javascript:checkdelete(\"act=wrap&code=remove&id={$r['tmid']}\")'>Remove</a></center>",
|
||||
) );
|
||||
|
||||
$form_array[] = array( $r['tmid'], $r['name'] );
|
||||
|
||||
}
|
||||
|
||||
$ADMIN->html .= $SKIN->end_table();
|
||||
}
|
||||
}
|
||||
|
||||
//+-------------------------------
|
||||
//+-------------------------------
|
||||
|
||||
$ADMIN->html .= $SKIN->start_form( array( 1 => array( 'code' , 'add' ),
|
||||
2 => array( 'act' , 'wrap' ),
|
||||
) );
|
||||
|
||||
$SKIN->td_header[] = array( " " , "40%" );
|
||||
$SKIN->td_header[] = array( " " , "60%" );
|
||||
|
||||
$ADMIN->html .= $SKIN->start_table( "Create New Wrapper" );
|
||||
|
||||
//+-------------------------------
|
||||
|
||||
$ADMIN->html .= $SKIN->add_td_row( array( "<b>Base new wrapper on...</b>" ,
|
||||
$SKIN->form_dropdown( "id", $form_array)
|
||||
) );
|
||||
|
||||
$ADMIN->html .= $SKIN->end_form("Create new wrapper");
|
||||
|
||||
$ADMIN->html .= $SKIN->end_table();
|
||||
|
||||
//+-------------------------------
|
||||
//+-------------------------------
|
||||
|
||||
$ADMIN->output();
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,532 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
+--------------------------------------------------------------------------
|
||||
| IBFORUMS v1
|
||||
| ========================================
|
||||
| by Matthew Mecham and David Baxter
|
||||
| (c) 2001,2002 IBForums
|
||||
| http://www.ibforums.com
|
||||
| ========================================
|
||||
| Web: http://www.ibforums.com
|
||||
| Email: phpboards@ibforums.com
|
||||
| Licence Info: phpib-licence@ibforums.com
|
||||
+---------------------------------------------------------------------------
|
||||
|
|
||||
| > Admin functions library
|
||||
| > Script written by Matt Mecham
|
||||
| > Date started: 1st march 2002
|
||||
|
|
||||
+--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
|
||||
class admin_functions {
|
||||
|
||||
var $img_url;
|
||||
var $page_title = "Welcome to the Invision 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 = "";
|
||||
|
||||
function admin_functions() {
|
||||
global $INFO, $IN;
|
||||
|
||||
$this->img_url = $INFO['html_url'].'/sys-img';
|
||||
$this->base_url = $INFO['board_url']."/admin.".$INFO['php_ext']."?adsess=".$IN['AD_SESS'];
|
||||
|
||||
}
|
||||
|
||||
//**********************************************/
|
||||
// get_tar_names
|
||||
//
|
||||
// Simply returns a list of tarballs that start
|
||||
// with the given filename
|
||||
//**********************************************/
|
||||
|
||||
function get_tar_names($start='lang-')
|
||||
{
|
||||
global $INFO;
|
||||
|
||||
// Remove trailing slashes..
|
||||
|
||||
$files = array();
|
||||
|
||||
$dir = $INFO['base_dir']."archive_in";
|
||||
|
||||
if ( is_dir($dir) )
|
||||
{
|
||||
$handle = opendir($dir);
|
||||
|
||||
while (($filename = readdir($handle)) !== false)
|
||||
{
|
||||
if (($filename != ".") && ($filename != ".."))
|
||||
{
|
||||
if (preg_match("/^$start.+?\.tar$/", $filename))
|
||||
{
|
||||
$files[] = $filename;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
closedir($handle);
|
||||
|
||||
}
|
||||
|
||||
return $files;
|
||||
|
||||
}
|
||||
|
||||
//**********************************************/
|
||||
// copy_dir
|
||||
//
|
||||
// Copies to contents of a dir to a new dir, creating
|
||||
// destination dir if needed.
|
||||
//
|
||||
//**********************************************/
|
||||
|
||||
function copy_dir($from_path, $to_path, $mode = 0777)
|
||||
{
|
||||
|
||||
global $INFO;
|
||||
|
||||
// Strip off trailing slashes...
|
||||
|
||||
$from_path = preg_replace( "#/$#", "", $from_path);
|
||||
$to_path = preg_replace( "#/$#", "", $to_path);
|
||||
|
||||
if ( ! is_dir($from_path) )
|
||||
{
|
||||
$this->errors = "Could not locate directory '$from_path'";
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if ( ! is_dir($to_path) )
|
||||
{
|
||||
if ( ! @mkdir($to_path, $mode) )
|
||||
{
|
||||
$this->errors = "Could not create directory '$to_path' please check the CHMOD permissions and re-try";
|
||||
return FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
@chmod($to_path, $mode);
|
||||
}
|
||||
}
|
||||
|
||||
$this_path = getcwd();
|
||||
|
||||
if (is_dir($from_path))
|
||||
{
|
||||
chdir($from_path);
|
||||
$handle=opendir('.');
|
||||
while (($file = readdir($handle)) !== false)
|
||||
{
|
||||
if (($file != ".") && ($file != ".."))
|
||||
{
|
||||
if (is_dir($file))
|
||||
{
|
||||
|
||||
$this->copy_dir($from_path."/".$file, $to_path."/".$file);
|
||||
|
||||
chdir($from_path);
|
||||
}
|
||||
|
||||
if ( is_file($file) )
|
||||
{
|
||||
copy($from_path."/".$file, $to_path."/".$file);
|
||||
@chmod($to_path."/".$file, 0777);
|
||||
}
|
||||
}
|
||||
}
|
||||
closedir($handle);
|
||||
}
|
||||
|
||||
if ($this->errors == "")
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
//**********************************************/
|
||||
// rm_dir
|
||||
//
|
||||
// Removes directories, if non empty, removes
|
||||
// content and directories
|
||||
// (Code based on annotations from the php.net
|
||||
// manual by pal@degerstrom.com)
|
||||
//**********************************************/
|
||||
|
||||
function rm_dir($file)
|
||||
{
|
||||
global $INFO;
|
||||
|
||||
$errors = 0;
|
||||
|
||||
// Remove trailing slashes..
|
||||
|
||||
$file = preg_replace( "#/$#", "", $file );
|
||||
|
||||
if ( file_exists($file) )
|
||||
{
|
||||
// Attempt CHMOD
|
||||
|
||||
@chmod($file, 0777);
|
||||
|
||||
if ( is_dir($file) )
|
||||
{
|
||||
$handle = opendir($file);
|
||||
|
||||
while (($filename = readdir($handle)) !== false)
|
||||
{
|
||||
if (($filename != ".") && ($filename != ".."))
|
||||
{
|
||||
$this->rm_dir($file."/".$filename);
|
||||
}
|
||||
}
|
||||
|
||||
closedir($handle);
|
||||
|
||||
if ( ! @rmdir($file) )
|
||||
{
|
||||
$errors++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( ! @unlink($file) )
|
||||
{
|
||||
$errors++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($errors == 0)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
//**********************************************/
|
||||
// rebuild_config:
|
||||
//
|
||||
// Er, rebuilds the config file
|
||||
//
|
||||
//**********************************************/
|
||||
|
||||
function rebuild_config( $new = "" )
|
||||
{
|
||||
global $IN, $std, $root_path;
|
||||
|
||||
//-----------------------------------------
|
||||
// Check to make sure this is a valid array
|
||||
//-----------------------------------------
|
||||
|
||||
if (! is_array($new) )
|
||||
{
|
||||
$ADMIN->error("Error whilst attempting to rebuild the board config file, attempt aborted");
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Do we have anything to save out?
|
||||
//-----------------------------------------
|
||||
|
||||
if ( count($new) < 1 )
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Get an up to date copy of the config file
|
||||
// (Imports $INFO)
|
||||
//-----------------------------------------
|
||||
|
||||
require $root_path.'conf_global.php';
|
||||
|
||||
//-----------------------------------------
|
||||
// Rebuild the $INFO hash
|
||||
//-----------------------------------------
|
||||
|
||||
foreach( $new as $k => $v )
|
||||
{
|
||||
// Update the old...
|
||||
|
||||
$v = preg_replace( "/'/", "\\'" , $v );
|
||||
$v = preg_replace( "/\r/", "" , $v );
|
||||
|
||||
$INFO[ $k ] = $v;
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// 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);
|
||||
|
||||
//-----------------------------------------
|
||||
// Rebuild the old file
|
||||
//-----------------------------------------
|
||||
|
||||
$file_string = "<?php\n";
|
||||
|
||||
foreach( $INFO as $k => $v )
|
||||
{
|
||||
if ($k == 'skin' or $k == 'languages')
|
||||
{
|
||||
// Protect serailized arrays..
|
||||
$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' ) )
|
||||
{
|
||||
fputs ($fh, $file_string, strlen($file_string) );
|
||||
fclose($fh);
|
||||
}
|
||||
else
|
||||
{
|
||||
$ADMIN->error("Fatal Error: Could not open conf_global for writing - no changes applied. Try changing the CHMOD to 0777");
|
||||
}
|
||||
|
||||
// Pass back the new $INFO array to anyone who cares...
|
||||
|
||||
return $INFO;
|
||||
|
||||
}
|
||||
|
||||
//**********************************************/
|
||||
// compile_forum_perms:
|
||||
//
|
||||
// Returns the READ/REPLY/START DB strings
|
||||
//
|
||||
//**********************************************/
|
||||
|
||||
|
||||
function compile_forum_perms() {
|
||||
global $DB, $IN;
|
||||
|
||||
$r_array = array( 'READ' => '', 'REPLY' => '', 'START' => '' );
|
||||
|
||||
if ($IN['READ_ALL'] == 1)
|
||||
{
|
||||
$r_array['READ'] = '*';
|
||||
}
|
||||
|
||||
if ($IN['REPLY_ALL'] == 1)
|
||||
{
|
||||
$r_array['REPLY'] = '*';
|
||||
}
|
||||
|
||||
if ($IN['START_ALL'] == 1)
|
||||
{
|
||||
$r_array['START'] = '*';
|
||||
}
|
||||
|
||||
|
||||
|
||||
$DB->query("SELECT g_id, g_title FROM ibf_groups ORDER BY g_id");
|
||||
|
||||
while ( $data = $DB->fetch_row() )
|
||||
{
|
||||
if ($r_array['READ'] != '*')
|
||||
{
|
||||
if ($IN[ 'READ_'.$data['g_id'] ] == 1)
|
||||
{
|
||||
$r_array['READ'] .= $data['g_id'].",";
|
||||
}
|
||||
}
|
||||
//+----------------------------
|
||||
if ($r_array['REPLY'] != '*')
|
||||
{
|
||||
if ($IN[ 'REPLY_'.$data['g_id'] ] == 1)
|
||||
{
|
||||
$r_array['REPLY'] .= $data['g_id'].",";
|
||||
}
|
||||
}
|
||||
//+----------------------------
|
||||
if ($r_array['START'] != '*')
|
||||
{
|
||||
if ($IN[ 'START_'.$data['g_id'] ] == 1)
|
||||
{
|
||||
$r_array['START'] .= $data['g_id'].",";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$r_array['START'] = preg_replace( "/,$/", "", $r_array['START'] );
|
||||
$r_array['REPLY'] = preg_replace( "/,$/", "", $r_array['REPLY'] );
|
||||
$r_array['READ'] = preg_replace( "/,$/", "", $r_array['READ'] );
|
||||
|
||||
return $r_array;
|
||||
|
||||
}
|
||||
|
||||
|
||||
//+------------------------------------------------
|
||||
//+------------------------------------------------
|
||||
// OUTPUT FUNCTIONS
|
||||
//+------------------------------------------------
|
||||
//+------------------------------------------------
|
||||
|
||||
|
||||
function output() {
|
||||
global $IN, $INFO, $DB, $std, $SKIN, $use_gzip;
|
||||
|
||||
$html = $SKIN->print_top($this->page_title, $this->page_detail);
|
||||
$html .= $this->html;
|
||||
$html .= $SKIN->print_foot();
|
||||
|
||||
$DB->close_db();
|
||||
|
||||
if ($use_gzip == 1)
|
||||
{
|
||||
ob_start ('ob_gzhandler');
|
||||
}
|
||||
|
||||
//@header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
|
||||
//@header("Cache-Control: no-cache, must-revalidate");
|
||||
//@header("Pragma: no-cache");
|
||||
|
||||
print $html;
|
||||
|
||||
exit();
|
||||
|
||||
}
|
||||
|
||||
//**********************************************/
|
||||
// Error:
|
||||
//
|
||||
// Displays an error
|
||||
//
|
||||
//**********************************************/
|
||||
|
||||
function error($error="") {
|
||||
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->html .= "<tr><td><span style='font-size:14px'>$error</span><br><br><center><a href='$HTTP_REFERER'>Go Back</a></center></td></tr>";
|
||||
|
||||
$this->output();
|
||||
|
||||
}
|
||||
|
||||
//**********************************************/
|
||||
// Done Screen:
|
||||
//
|
||||
// Displays the "done" screen. Really? Yes.
|
||||
//
|
||||
//**********************************************/
|
||||
|
||||
function done_screen($title, $link_text="", $link_url="") {
|
||||
global $IN, $INFO, $DB, $std, $SKIN;
|
||||
|
||||
$this->page_title = $title;
|
||||
$this->page_detail = "The action was executed successfully";
|
||||
|
||||
$SKIN->td_header[] = array( " " , "100%" );
|
||||
|
||||
$this->html .= $SKIN->start_table("Result");
|
||||
|
||||
$this->html .= $SKIN->add_td_basic( "<a href='{$this->base_url}&{$link_url}' target='body'>Go to: $link_text</a>", "center" );
|
||||
|
||||
$this->html .= $SKIN->add_td_basic( "<a href='{$this->base_url}&act=index' target='body'>Go to: Administration Home</a>", "center" );
|
||||
|
||||
$this->html .= $SKIN->end_table();
|
||||
|
||||
$this->output();
|
||||
|
||||
}
|
||||
|
||||
function info_screen($text="", $title='Safe Mode Restriction Warning') {
|
||||
global $IN, $INFO, $DB, $std, $SKIN;
|
||||
|
||||
$this->page_title = $title;
|
||||
$this->page_detail = "Please note the following:";
|
||||
|
||||
$SKIN->td_header[] = array( " " , "100%" );
|
||||
|
||||
$this->html .= $SKIN->start_table("Result");
|
||||
|
||||
$this->html .= $SKIN->add_td_basic( $text );
|
||||
|
||||
$this->html .= $SKIN->add_td_basic( "<a href='{$this->base_url}&act=index' target='body'>Go to: Administration Home</a>", "center" );
|
||||
|
||||
$this->html .= $SKIN->end_table();
|
||||
|
||||
$this->output();
|
||||
|
||||
}
|
||||
|
||||
|
||||
//**********************************************/
|
||||
// MENU:
|
||||
//
|
||||
// Build the collapsable menu trees
|
||||
//
|
||||
//**********************************************/
|
||||
|
||||
function menu() {
|
||||
global $IN, $std, $PAGES, $CATS, $SKIN;
|
||||
|
||||
$links = $this->build_tree();
|
||||
|
||||
$html = $SKIN->menu_top() . $links . $SKIN->menu_foot();
|
||||
|
||||
print $html;
|
||||
exit();
|
||||
|
||||
|
||||
}
|
||||
|
||||
//+------------------------------------------------
|
||||
|
||||
function build_tree() {
|
||||
global $IN, $std, $PAGES, $CATS, $SKIN, $DESC;
|
||||
|
||||
$html = "";
|
||||
$links = "";
|
||||
|
||||
foreach($CATS as $cid => $name)
|
||||
{
|
||||
|
||||
if ( preg_match( "/(?:^|,)$cid(?:,|$)/", $IN['show'] ) )
|
||||
{
|
||||
|
||||
foreach($PAGES[ $cid ] as $pid => $pdata)
|
||||
{
|
||||
$links .= $SKIN->menu_cat_link($pdata[1], $pdata[0]);
|
||||
}
|
||||
|
||||
$html .= $SKIN->menu_cat_expanded( $name, $links, $cid );
|
||||
unset($links);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
$html .= $SKIN->menu_cat_collapsed( $name, $cid, $DESC[ $cid ] );
|
||||
}
|
||||
}
|
||||
|
||||
return $html;
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,95 @@
|
||||
<?php
|
||||
|
||||
// Simple library that holds all the links for the admin cp
|
||||
|
||||
// CAT_ID => array( PAGE_ID => (PAGE_NAME, URL ) )
|
||||
|
||||
// $PAGES[ $cat_id ][$page_id][0] = Page name
|
||||
// $PAGES[ $cat_id ][$page_id][1] = Url
|
||||
|
||||
|
||||
$PAGES = array(
|
||||
|
||||
0 => array (
|
||||
1 => array( 'Basic Config', 'act=op&code=url' ),
|
||||
2 => array( 'Security & Privacy' , 'act=op&code=secure' ),
|
||||
3 => array( 'Topics & Posts', 'act=op&code=post' ),
|
||||
4 => array( 'User Profiles' , 'act=op&code=avatars' ),
|
||||
5 => array( 'Date Formats' , 'act=op&code=dates' ),
|
||||
6 => array( 'CPU Saving' , 'act=op&code=cpu' ),
|
||||
7 => array( 'Cookies' , 'act=op&code=cookie' ),
|
||||
8 => array( 'PM Set up' , 'act=op&code=pm' ),
|
||||
9 => array( 'Board on/off' , 'act=op&code=board' ),
|
||||
10 =>array( 'News Set-up' , 'act=op&code=news' ),
|
||||
|
||||
|
||||
),
|
||||
|
||||
1 => array (
|
||||
1 => array( 'New Category' , 'act=cat&code=new' ),
|
||||
2 => array( 'New Forum' , 'act=forum&code=newsp' ),
|
||||
3 => array( 'Manage' , 'act=cat&code=edit' ),
|
||||
4 => array( 'Re-Order Categories' , 'act=cat&code=reorder'),
|
||||
5 => array( 'Re-Order Forums', 'act=forum&code=reorder'),
|
||||
6 => array( 'Moderators' , 'act=mod' ),
|
||||
),
|
||||
|
||||
|
||||
3 => array (
|
||||
1 => array ( 'Pre-Register' , 'act=mem&code=add' ),
|
||||
2 => array ( 'Edit User' , 'act=mem&code=edit' ),
|
||||
3 => array ( 'Delete User(s)' , 'act=mem&code=del' ),
|
||||
4 => array ( 'Ban Settings' , 'act=mem&code=ban' ),
|
||||
5 => array ( 'User Title/Ranks' , 'act=mem&code=title'),
|
||||
6 => array ( 'Manage User Groups' , 'act=group' ),
|
||||
7 => array ( 'Manage Registrations', 'act=mem&code=mod' ),
|
||||
),
|
||||
|
||||
4 => array (
|
||||
1 => array( 'Manage Word Filters', 'act=op&code=bw' ),
|
||||
2 => array( 'Manage Emoticons', 'act=op&code=emo' ),
|
||||
3 => array( 'Manage Help Files', 'act=help' ),
|
||||
4 => array( 'Recount Statistics', 'act=op&code=count' ),
|
||||
5 => array( 'View Moderator Logs', 'act=modlog' ),
|
||||
),
|
||||
|
||||
5 => array (
|
||||
1 => array( 'Manage Board Wrappers' , 'act=wrap' ),
|
||||
2 => array( 'Manage Skin Templates' , 'act=templ' ),
|
||||
3 => array( 'Manage Style Sheets' , 'act=style' ),
|
||||
4 => array( 'Manage Image&Macros' , 'act=image' ),
|
||||
5 => array( '<b>Manage Skin Sets</b>' , 'act=sets' ),
|
||||
6 => array( 'Import Skin files' , 'act=import' ),
|
||||
|
||||
),
|
||||
|
||||
6 => array (
|
||||
1 => array( 'Manage Languages' , 'act=lang' ),
|
||||
2 => array( 'Import a Language', 'act=lang&code=import' ),
|
||||
),
|
||||
|
||||
|
||||
|
||||
);
|
||||
|
||||
|
||||
$CATS = array (
|
||||
0 => "Board Settings",
|
||||
1 => 'Forum Control',
|
||||
3 => 'Users and Groups',
|
||||
4 => 'Administration',
|
||||
5 => 'Skins & Templates',
|
||||
6 => 'Languages',
|
||||
);
|
||||
|
||||
$DESC = array (
|
||||
0 => "Edit forum settings such as cookie paths, security features, posting abilities, etc",
|
||||
1 => "Create, edit, remove and re-order categories, forums and moderators",
|
||||
3 => "Edit, register, remove and ban members. Set up member titles and ranks. Manage User Groups and moderated registrations",
|
||||
4 => "Manage Help Files, Bad Word Filters and Emoticons",
|
||||
5 => "Manage templates, skins, colours and images.",
|
||||
6 => "Manage language sets",
|
||||
);
|
||||
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,920 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
+--------------------------------------------------------------------------
|
||||
| IBFORUMS v1
|
||||
| ========================================
|
||||
| by Matthew Mecham and David Baxter
|
||||
| (c) 2001,2002 IBForums
|
||||
| http://www.ibforums.com
|
||||
| ========================================
|
||||
| Web: http://www.ibforums.com
|
||||
| Email: phpboards@ibforums.com
|
||||
| Licence Info: phpib-licence@ibforums.com
|
||||
+---------------------------------------------------------------------------
|
||||
|
|
||||
| > Admin HTML stuff library
|
||||
| > Script written by Matt Mecham
|
||||
| > Date started: 1st march 2002
|
||||
|
|
||||
+--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
|
||||
class admin_skin {
|
||||
|
||||
var $base_url;
|
||||
var $img_url;
|
||||
var $has_title;
|
||||
var $td_widths = array();
|
||||
var $td_header = array();
|
||||
var $td_colspan;
|
||||
|
||||
function admin_skin() {
|
||||
global $INFO, $IN;
|
||||
|
||||
$this->base_url = $INFO['board_url']."/admin.".$INFO['php_ext']."?adsess=".$IN['AD_SESS'];
|
||||
$this->img_url = $INFO['html_url'].'/sys-img';
|
||||
|
||||
}
|
||||
|
||||
//+--------------------------------------------------------------------
|
||||
//+--------------------------------------------------------------------
|
||||
// Javascript elements
|
||||
//+--------------------------------------------------------------------
|
||||
//+--------------------------------------------------------------------
|
||||
|
||||
function js_checkdelete()
|
||||
{
|
||||
|
||||
return "
|
||||
<script language='javascript'>
|
||||
<!--
|
||||
function checkdelete(theURL) {
|
||||
|
||||
final_url = \"{$this->base_url}&\" + theURL;
|
||||
|
||||
if ( confirm('Are you sure you wish to remove this?\\nIt cannot be undone!') )
|
||||
{
|
||||
document.location.href=final_url;
|
||||
}
|
||||
else
|
||||
{
|
||||
alert('Ok, remove cancelled!');
|
||||
}
|
||||
}
|
||||
//-->
|
||||
</script>
|
||||
";
|
||||
}
|
||||
|
||||
|
||||
|
||||
function js_no_specialchars()
|
||||
{
|
||||
return "
|
||||
<script language='javascript'>
|
||||
<!--
|
||||
function no_specialchars(type) {
|
||||
|
||||
var name;
|
||||
|
||||
if (type == 'sets')
|
||||
{
|
||||
var field = document.theAdminForm.sname;
|
||||
name = 'Skin Set Title';
|
||||
}
|
||||
|
||||
if (type == 'wrapper')
|
||||
{
|
||||
var field = document.theAdminForm.name;
|
||||
name = 'Wrapper Title';
|
||||
}
|
||||
|
||||
if (type == 'csssheet')
|
||||
{
|
||||
var field = document.theAdminForm.name;
|
||||
name = 'StyleSheet Title';
|
||||
}
|
||||
|
||||
if (type == 'templates')
|
||||
{
|
||||
var field = document.theAdminForm.skname;
|
||||
name = 'Template Set Name';
|
||||
}
|
||||
|
||||
if (type == 'images')
|
||||
{
|
||||
var field = document.theAdminForm.setname;
|
||||
name = 'Image & Macro Set Title';
|
||||
}
|
||||
|
||||
var valid = 'abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890.():;~+-_';
|
||||
var ok = 1;
|
||||
var temp;
|
||||
|
||||
for (var i=0; i < field.value.length; i++) {
|
||||
temp = \"\" + field.value.substring(i,i+1);
|
||||
if (valid.indexOf(temp) == \"-1\")
|
||||
{
|
||||
ok = 0;
|
||||
}
|
||||
}
|
||||
if (ok == 0)
|
||||
{
|
||||
alert('Invalid entry for: ' + name + ', you can only use alphanumerics and the following special characters.\\n. ( ) : ; ~ + - _');
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
//-->
|
||||
</script>
|
||||
";
|
||||
}
|
||||
|
||||
|
||||
//+--------------------------------------------------------------------
|
||||
//+--------------------------------------------------------------------
|
||||
// FORM ELEMENTS
|
||||
//+--------------------------------------------------------------------
|
||||
//+--------------------------------------------------------------------
|
||||
|
||||
function start_form($hiddens="", $name='theAdminForm', $js="") {
|
||||
global $IN, $INFO;
|
||||
|
||||
$form = "<form action='{$this->base_url}' method='post' name='$name' $js>
|
||||
<input type='hidden' name='adsess' value='{$IN['AD_SESS']}'>";
|
||||
|
||||
if (is_array($hiddens))
|
||||
{
|
||||
foreach ($hiddens as $k => $v) {
|
||||
$form .= "\n<input type='hidden' name='{$v[0]}' value='{$v[1]}'>";
|
||||
}
|
||||
}
|
||||
|
||||
return $form;
|
||||
|
||||
}
|
||||
|
||||
//+--------------------------------------------------------------------
|
||||
|
||||
function form_hidden($hiddens="") {
|
||||
|
||||
if (is_array($hiddens))
|
||||
{
|
||||
foreach ($hiddens as $k => $v) {
|
||||
$form .= "\n<input type='hidden' name='{$v[0]}' value='{$v[1]}'>";
|
||||
}
|
||||
}
|
||||
|
||||
return $form;
|
||||
}
|
||||
|
||||
|
||||
//+--------------------------------------------------------------------
|
||||
|
||||
function end_form($text = "", $js = "")
|
||||
{
|
||||
// If we have text, we print another row of TD elements with a submit button
|
||||
|
||||
$html = "";
|
||||
$colspan = "";
|
||||
|
||||
if ($text != "")
|
||||
{
|
||||
if ($this->td_colspan > 0)
|
||||
{
|
||||
$colspan = " colspan='".$this->td_colspan."' ";
|
||||
}
|
||||
|
||||
$html .= "<tr><td align='center' id='tdrow2'".$colspan."><input type='submit' value='$text'".$js." id='button' accesskey='s'></td></tr>\n";
|
||||
}
|
||||
|
||||
$html .= "</form>";
|
||||
|
||||
return $html;
|
||||
|
||||
}
|
||||
|
||||
//+--------------------------------------------------------------------
|
||||
|
||||
function form_input($name, $value="", $type='text', $js="") {
|
||||
|
||||
if ($js != "")
|
||||
{
|
||||
$js = ' '.$js.' ';
|
||||
}
|
||||
|
||||
return "<input type='$type' name='$name' value='$value' style='width:95%'".$js." id='textinput'>";
|
||||
|
||||
}
|
||||
|
||||
//+--------------------------------------------------------------------
|
||||
|
||||
function form_textarea($name, $value="", $cols='60', $rows='5', $wrap='soft') {
|
||||
|
||||
return "<textarea name='$name' cols='$cols' rows='$rows' wrap='$wrap' id='multitext'>$value</textarea>";
|
||||
|
||||
}
|
||||
|
||||
//+--------------------------------------------------------------------
|
||||
|
||||
function form_dropdown($name, $list=array(), $default_val="", $js="") {
|
||||
|
||||
if ($js != "")
|
||||
{
|
||||
$js = ' '.$js.' ';
|
||||
}
|
||||
|
||||
$html = "<select name='$name'".$js." id='dropdown'>\n";
|
||||
|
||||
foreach ($list as $k => $v)
|
||||
{
|
||||
|
||||
$selected = "";
|
||||
|
||||
if ( ($default_val != "") and ($v[0] == $default_val) )
|
||||
{
|
||||
$selected = ' selected';
|
||||
}
|
||||
|
||||
$html .= "<option value='".$v[0]."'".$selected.">".$v[1]."</option>\n";
|
||||
}
|
||||
|
||||
$html .= "</select>\n\n";
|
||||
|
||||
return $html;
|
||||
|
||||
|
||||
}
|
||||
|
||||
//+--------------------------------------------------------------------
|
||||
|
||||
function form_yes_no( $name, $default_val="" ) {
|
||||
|
||||
$yes = "Yes <input type='radio' name='$name' value='1' id='green'>";
|
||||
$no = "<input type='radio' name='$name' value='0' id='red'> No";
|
||||
|
||||
|
||||
if ($default_val == 1)
|
||||
{
|
||||
$yes = "Yes <input type='radio' name='$name' value='1' checked id='green'>";
|
||||
}
|
||||
else
|
||||
{
|
||||
$no = "<input type='radio' name='$name' value='0' checked id='red'> No";
|
||||
}
|
||||
|
||||
|
||||
return $yes.' '.$no;
|
||||
|
||||
}
|
||||
|
||||
//+--------------------------------------------------------------------
|
||||
|
||||
function build_group_perms( $read='*', $write='*', $reply='*' ) {
|
||||
global $DB;
|
||||
|
||||
|
||||
$html = "
|
||||
|
||||
<script language='Javascript1.1'>
|
||||
<!--
|
||||
|
||||
function check_all(str_part) {
|
||||
|
||||
var f = document.theAdminForm;
|
||||
|
||||
for (var i = 0 ; i < f.elements.length; i++)
|
||||
{
|
||||
var e = f.elements[i];
|
||||
|
||||
if ( (e.name != 'READ_ALL') && (e.name != 'REPLY_ALL') && (e.name != 'START_ALL') && (e.type == 'checkbox') && (! e.disabled) )
|
||||
{
|
||||
s = e.name;
|
||||
a = s.substring(0, 4);
|
||||
|
||||
if (a == str_part)
|
||||
{
|
||||
e.checked = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function obj_checked(IDnumber) {
|
||||
|
||||
var f = document.theAdminForm;
|
||||
|
||||
str_part = '';
|
||||
|
||||
if (IDnumber == 1) { str_part = 'READ' }
|
||||
if (IDnumber == 2) { str_part = 'REPL' }
|
||||
if (IDnumber == 3) { str_part = 'STAR' }
|
||||
|
||||
totalboxes = 0;
|
||||
total_on = 0;
|
||||
|
||||
for (var i = 0 ; i < f.elements.length; i++)
|
||||
{
|
||||
var e = f.elements[i];
|
||||
|
||||
if ( (e.name != 'READ_ALL') && (e.name != 'REPLY_ALL') && (e.name != 'START_ALL') && (e.type == 'checkbox') )
|
||||
{
|
||||
s = e.name;
|
||||
a = s.substring(0, 4);
|
||||
|
||||
if (a == str_part)
|
||||
{
|
||||
totalboxes++;
|
||||
|
||||
if (e.checked)
|
||||
{
|
||||
total_on++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (totalboxes == total_on)
|
||||
{
|
||||
if (IDnumber == 1) { f.READ_ALL.checked = true; }
|
||||
if (IDnumber == 2) { f.REPLY_ALL.checked = true; }
|
||||
if (IDnumber == 3) { f.START_ALL.checked = true; }
|
||||
}
|
||||
else
|
||||
{
|
||||
if (IDnumber == 1) { f.READ_ALL.checked = false; }
|
||||
if (IDnumber == 2) { f.REPLY_ALL.checked = false; }
|
||||
if (IDnumber == 3) { f.START_ALL.checked = false; }
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//-->
|
||||
|
||||
</script>
|
||||
|
||||
";
|
||||
|
||||
|
||||
|
||||
$html .= "<table cellspacing='0' cellpadding='2' width='100%' border='0' align='center' border='0'>
|
||||
<tr>
|
||||
<td width='40%'><b><i>Member Group</i></b></td>
|
||||
<td width='30%'><b>Read Topics</b></td>
|
||||
<td width='30%'><b>Reply to Topics</b></td>
|
||||
<td width='30%'><b>Start Topics</b></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align='left'><span style='color:red'>ALL MEMBER GROUPS</span><br>(current and future)</td>\n";
|
||||
|
||||
//+-------------------------------------------------------------------------
|
||||
|
||||
if ($read == '*')
|
||||
{
|
||||
$html .= "<td align='center' id='memgroup'><input type='checkbox' onClick='check_all(\"READ\")' name='READ_ALL' value='1' checked></td>\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
$html .= "<td align='center' id='memgroup'><input type='checkbox' onClick='check_all(\"READ\")' name='READ_ALL' value='1'></td>\n";
|
||||
}
|
||||
|
||||
//+-------------------------------------------------------------------------
|
||||
|
||||
if ($reply == '*')
|
||||
{
|
||||
$html .= "<td align='center' id='mggreen'><input type='checkbox' onClick='check_all(\"REPL\")' name='REPLY_ALL' value='1' checked></td>\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
$html .= "<td align='center' id='mggreen'><input type='checkbox' onClick='check_all(\"REPL\")' name='REPLY_ALL' value='1'></td>\n";
|
||||
}
|
||||
|
||||
//+-------------------------------------------------------------------------
|
||||
|
||||
if ($write == '*')
|
||||
{
|
||||
$html .= "<td align='center' id='mgred'><input type='checkbox' onClick='check_all(\"STAR\")' name='START_ALL' value='1' checked></td>\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
$html .= "<td align='center' id='mgred'><input type='checkbox' onClick='check_all(\"STAR\")' name='START_ALL' value='1'></td>\n";
|
||||
}
|
||||
|
||||
//+-------------------------------------------------------------------------
|
||||
|
||||
|
||||
$html .= "</tr>
|
||||
<tr>
|
||||
<td colspan='4'><br><b><i>OR</i> adjust the member groups individually below</b><br> </td>
|
||||
</tr>
|
||||
<tr>\n";
|
||||
|
||||
$DB->query("SELECT g_id, g_title FROM ibf_groups ORDER BY g_title ASC");
|
||||
|
||||
|
||||
while ( $data = $DB->fetch_row() )
|
||||
{
|
||||
|
||||
$html .= "<tr>
|
||||
<td align='right'><b>{$data['g_title']}</b></td>\n";
|
||||
|
||||
if ($read == '*')
|
||||
{
|
||||
$html .= "<td align='center' id='memgroup'>Read <input type='checkbox' name='READ_{$data['g_id']}' value='1' checked onclick=\"obj_checked(1)\"></td>";
|
||||
}
|
||||
else if ( preg_match( "/(^|,)".$data['g_id']."(,|$)/", $read ) )
|
||||
{
|
||||
$html .= "<td align='center' id='memgroup'>Read <input type='checkbox' name='READ_{$data['g_id']}' value='1' checked onclick=\"obj_checked(1)\"></td>";
|
||||
}
|
||||
else
|
||||
{
|
||||
$html .= "<td align='center' id='memgroup'>Read <input type='checkbox' name='READ_{$data['g_id']}' value='1' onclick=\"obj_checked(1)\"></td>";
|
||||
}
|
||||
|
||||
//+----------------------------------------------------------------------------------------
|
||||
|
||||
if ($reply == '*')
|
||||
{
|
||||
$html .= "<td align='center' id='mggreen'>Reply <input type='checkbox' name='REPLY_{$data['g_id']}' value='1' checked onclick=\"obj_checked(2)\"></td>";
|
||||
}
|
||||
else if ( preg_match( "/(?:^|,)".$data['g_id']."(?:,|$)/", $reply ) )
|
||||
{
|
||||
$html .= "<td align='center' id='mggreen'>Reply <input type='checkbox' name='REPLY_{$data['g_id']}' value='1' onclick=\"obj_checked(2)\" checked></td>";
|
||||
}
|
||||
else
|
||||
{
|
||||
$html .= "<td align='center' id='mggreen'>Reply <input type='checkbox' name='REPLY_{$data['g_id']}' value='1' onclick=\"obj_checked(2)\"></td>";
|
||||
}
|
||||
|
||||
//+----------------------------------------------------------------------------------------
|
||||
|
||||
if ($write == '*')
|
||||
{
|
||||
$html .= "<td align='center' id='mgred'>Start <input type='checkbox' name='START_{$data['g_id']}' value='1' checked onclick=\"obj_checked(3)\"></td>";
|
||||
}
|
||||
else if ( preg_match( "/(?:^|,)".$data['g_id']."(?:,|$)/", $write ) )
|
||||
{
|
||||
$html .= "<td align='center' id='mgred'>Start <input type='checkbox' name='START_{$data['g_id']}' value='1' checked onclick=\"obj_checked(3)\"></td>";
|
||||
}
|
||||
else
|
||||
{
|
||||
$html .= "<td align='center' id='mgred'>Start <input type='checkbox' name='START_{$data['g_id']}' value='1' onclick=\"obj_checked(3)\"></td>";
|
||||
}
|
||||
|
||||
$html .= "</tr><tr><td colspan='4' style='height:3px'> </td></tr>\n\n";
|
||||
}
|
||||
|
||||
$html .= "</table>\n\n";
|
||||
|
||||
return $html;
|
||||
|
||||
}
|
||||
|
||||
|
||||
//+--------------------------------------------------------------------
|
||||
//+--------------------------------------------------------------------
|
||||
// SCREEN ELEMENTS
|
||||
//+--------------------------------------------------------------------
|
||||
//+--------------------------------------------------------------------
|
||||
|
||||
function add_subtitle($title="",$id="subtitle", $colspan="") {
|
||||
|
||||
if ($colspan != "")
|
||||
{
|
||||
$colspan = " colspan='$colspan' ";
|
||||
}
|
||||
|
||||
return "\n<tr><td id='$id'".$colspan.">$title</td><tr>\n";
|
||||
|
||||
}
|
||||
|
||||
//+--------------------------------------------------------------------
|
||||
|
||||
function start_table( $title="") {
|
||||
|
||||
|
||||
if ($title != "")
|
||||
{
|
||||
$this->has_title = 1;
|
||||
$html .= "<tr>
|
||||
<td id='subtitle'>• $title</td>
|
||||
<tr>
|
||||
<td>
|
||||
<table cellpadding='8' cellspacing='0' width='100%' align='center' border='0' id='tablewrap'>
|
||||
";
|
||||
}
|
||||
|
||||
|
||||
|
||||
$html .= "<tr>
|
||||
<td>
|
||||
<table width='100%' cellspacing='1' cellpadding='0' align='center' border='0' id='table1'>
|
||||
<tr>
|
||||
<td>
|
||||
<table width='100%' cellspacing='2' cellpadding='3' align='center' border='0'>";
|
||||
|
||||
|
||||
if (isset($this->td_header[0]))
|
||||
{
|
||||
$html .= "<tr>\n";
|
||||
|
||||
foreach ($this->td_header as $td)
|
||||
{
|
||||
if ($td[1] != "")
|
||||
{
|
||||
$width = " width='{$td[1]}' ";
|
||||
}
|
||||
else
|
||||
{
|
||||
$width = "";
|
||||
}
|
||||
|
||||
$html .= "<td id='tdtop'".$width."align='center'>{$td[0]}</td>\n";
|
||||
|
||||
$this->td_colspan++;
|
||||
}
|
||||
|
||||
$html.= "</tr>\n";
|
||||
}
|
||||
|
||||
return $html;
|
||||
|
||||
}
|
||||
|
||||
//+--------------------------------------------------------------------
|
||||
|
||||
|
||||
function add_td_row( $array, $css="" ) {
|
||||
|
||||
if (is_array($array))
|
||||
{
|
||||
$html = "<tr>\n";
|
||||
|
||||
$count = count($array);
|
||||
|
||||
$this->td_colspan = $count;
|
||||
|
||||
for ($i = 0; $i < $count ; $i++ )
|
||||
{
|
||||
|
||||
$td_col = $i % 2 ? 'tdrow2' : 'tdrow1';
|
||||
|
||||
if ($css != "")
|
||||
{
|
||||
$td_col = $css;
|
||||
}
|
||||
|
||||
if (is_array($array[$i]))
|
||||
{
|
||||
$text = $array[$i][0];
|
||||
$colspan = $array[$i][1];
|
||||
|
||||
$html .= "<td id='$td_col' colspan='$colspan' id='$css'>".$text."</td>\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
$html .= "<td id='$td_col'>".$array[$i]."</td>\n";
|
||||
}
|
||||
}
|
||||
|
||||
$html .= "</tr>\n";
|
||||
|
||||
return $html;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//+--------------------------------------------------------------------
|
||||
|
||||
function add_td_basic($text="",$align="left",$id="tdrow1") {
|
||||
|
||||
$html = "";
|
||||
$colspan = "";
|
||||
|
||||
if ($text != "")
|
||||
{
|
||||
if ($this->td_colspan > 0)
|
||||
{
|
||||
$colspan = " colspan='".$this->td_colspan."' ";
|
||||
}
|
||||
|
||||
|
||||
$html .= "<tr><td align='$align' id='$id'".$colspan.">$text</td></tr>\n";
|
||||
}
|
||||
|
||||
return $html;
|
||||
|
||||
}
|
||||
|
||||
//+--------------------------------------------------------------------
|
||||
|
||||
function add_td_spacer() {
|
||||
|
||||
if ($this->td_colspan > 0)
|
||||
{
|
||||
$colspan = " colspan='".$this->td_colspan."' ";
|
||||
}
|
||||
|
||||
return "<tr><td".$colspan."><img src='html/sys-img/blank.gif' height='7' width='1'></td></tr>";
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
//+--------------------------------------------------------------------
|
||||
|
||||
function end_table() {
|
||||
|
||||
$this->td_header = array(); // Reset TD headers
|
||||
|
||||
if ($this->has_title == 1)
|
||||
{
|
||||
$this->has_title = 0;
|
||||
|
||||
return "</table></td></tr></table></td></tr></table></td></tr>";
|
||||
}
|
||||
else
|
||||
{
|
||||
return "</table></td></tr></table></td></tr>";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
//+--------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//+--------------------------------------------------------------------
|
||||
//+--------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
function print_top($title="",$desc="") {
|
||||
|
||||
return "<html>
|
||||
<head><title>Menu</title>
|
||||
<meta http-equiv=\"Cache-Control\" content=\"no-cache, must-revalidate\">
|
||||
<meta http-equiv=\"Pragma\" content=\"no-cache\">
|
||||
<meta http-equiv=\"Expires\" content=\"Mon, 26 Jul 1997 05:00:00 GMT\">
|
||||
<style type='text/css'>
|
||||
TABLE, TR, TD { font-family:Verdana, Arial;font-size: 10px; color:#333333 }
|
||||
BODY { font: 10px Verdana; color:#333333 }
|
||||
a:link, a:visited, a:active { color:#000055 }
|
||||
a:hover { color:#333377;text-decoration:underline }
|
||||
|
||||
#title { font-size:10px; font-weight:bold; line-height:150%; color:#FFFFFF; height: 26px; background-image: url({$this->img_url}/tile_back.gif); }
|
||||
#title a:link, #title a:visited, #title a:active { text-decoration: underline; color : #FFFFFF; font-size:11px }
|
||||
|
||||
#detail { font-family: Arial; font-size:11px; color: #333333 }
|
||||
|
||||
#large { font-family: verdana, arial; font-size:20px; color:#4C77B6; font-weight:bold; letter-spacing:-1px }
|
||||
|
||||
#subtitle { font-family: Arial,Verdana; font-size:18px; color:#FF9900; font-weight:bold }
|
||||
|
||||
#table1 { background-color:#FFFFFF; width:100%; align:center; border:1px solid black }
|
||||
|
||||
#tdrow1 { background-color:#EEF2F7 }
|
||||
|
||||
#subforum { background-color:#DFE6EF }
|
||||
|
||||
#tdrow2 { background-color:#F5F9FD }
|
||||
|
||||
#catrow { font-weight:bold; height:24px; line-height:150%; color:#4C77B6; background-image: url({$this->img_url}/tile_sub.gif); }
|
||||
#catrow2 { font-size:10px; font-weight:bold; line-height:150%; color:#4C77B6; background-color:#D3DFEF; }
|
||||
|
||||
#tablewrap { border:1px dashed #777777; background-color:#F5F9FD }
|
||||
|
||||
#copy { color:#555555; font-size:9px }
|
||||
|
||||
#tdtop { font-weight:bold; height:24px; line-height:150%; color:#FFFFFF; background-image: url({$this->img_url}/tile_back.gif); }
|
||||
|
||||
#memgroup { border:1px solid #777777 }
|
||||
|
||||
#mgred { border:1px solid #777777; background-color: #f5cdcd }
|
||||
#mggreen { border:1px solid #777777; background-color: #caf2d9 }
|
||||
|
||||
#green { background-color: #caf2d9 }
|
||||
#red { background-color: #f5cdcd }
|
||||
|
||||
#button { background-color: #4C77B6; color: #FFFFFF; font-family:Verdana, Arial; font-size:11px }
|
||||
|
||||
#textinput { background-color: #FFFFFF; color:Ê#000000; font-family:Verdana, Arial; font-size:10px }
|
||||
|
||||
#dropdown { background-color: #F5F9FD; color:Ê#000000; font-family:Verdana, Arial; font-size:10px }
|
||||
|
||||
#multitext { background-color: #F5F9FD; color:Ê#000000; font-family:Verdana, Arial; font-size:10px }
|
||||
|
||||
</style>
|
||||
</head>
|
||||
<body marginheight='0' marginwidth='0' leftmargin='0' topmargin='0' bgcolor='#E7E7E7'>
|
||||
<table cellspacing='3' cellpadding='2' width='100%' align='center' border='0' bgcolor='#E7E7E7'>
|
||||
<tr>
|
||||
<td>
|
||||
<table cellspacing='3' cellpadding='2' width='100%' align='center' border='0' bgcolor='#FFFFFF' style='border:thin solid black'>
|
||||
<tr>
|
||||
<td align='center' id='title'>Invision Board Administration</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign='top' bgcolor='#FFFFFF'>
|
||||
<table cellspacing='0' cellpadding='2' border='0' align='center' width='100%' height='100%' bgcolor='#FFFFFF'>
|
||||
<tr>
|
||||
<td id='large'>$title</td>
|
||||
</tr>
|
||||
<td>$desc<br> </td>
|
||||
</tr>";
|
||||
|
||||
}
|
||||
|
||||
//+--------------------------------------------------------------------
|
||||
|
||||
function print_foot() {
|
||||
|
||||
return " </td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
<tr><td align='center' id='copy'>© 2002 Invision Board (www.invisionboard.com)</td></tr>
|
||||
</table>
|
||||
</body>
|
||||
</html>";
|
||||
}
|
||||
|
||||
|
||||
//+--------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
|
||||
//{ background-color:#C2CFDF; font-weight:bold; font-size:12px; color:#000055 }
|
||||
|
||||
|
||||
function menu_top() {
|
||||
global $INFO;
|
||||
|
||||
return "<html>
|
||||
<head><title>Menu</title>
|
||||
<style type='text/css'>
|
||||
TABLE, TR, TD { font-family:Verdana, Arial;font-size: 9px; color:#333333 }
|
||||
BODY { font: 9px Verdana; color:#333333 }
|
||||
a:link, a:visited, a:active { color:#333355 }
|
||||
a:hover { color:#333355;text-decoration:underline }
|
||||
|
||||
#title { font-size:10px; font-weight:bold; line-height:150%; color:#FFFFFF; height: 24px; background-image: url({$this->img_url}/tile_back.gif); }
|
||||
#title a:link, #title a:visited, #title a:active { text-decoration: none; color : #555555 }
|
||||
|
||||
#detail { font-family: Arial; font-size:7.5pt; color: #333333; background-color:#EEF2F7 }
|
||||
|
||||
#cattitle { font-size:10px; font-weight:bold; line-height:150%; color:#4C77B6; background-color:#C4DCF7; height: 24px; background-image: url({$this->img_url}/tile_sub.gif); }
|
||||
#cattitle a:link, #cattitle a:visited, #cattitle a:active { text-decoration: underline; color : #4C77B6; }
|
||||
|
||||
</style>
|
||||
</head>
|
||||
<body marginheight='0' marginwidth='0' leftmargin='0' topmargin='0' bgcolor='#E7E7E7'>
|
||||
<table cellspacing='3' cellpadding='2' width='100%' align='center' border='0' bgcolor='#E7E7E7'>
|
||||
<tr>
|
||||
<td>
|
||||
<table cellspacing='1' cellpadding='2' width='100%' align='center' border='0' bgcolor='#FFFFFF' style='border:thin solid black'>
|
||||
<tr>
|
||||
<td align='center'>
|
||||
<table cellspacing='0' cellpadding='0' width='100%' align='center' border='0' bgcolor='#FFFFFF'>
|
||||
<tr>
|
||||
<td align='center' id='title'><img src='{$this->img_url}/ad-logo.jpg' border='0'></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align='center' id='cattitle'>Administration Menu</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign='top' bgcolor='#FFFFFF' align='center'>
|
||||
|
||||
<a href='{$this->base_url}&act=menu&show=all' target='menu'>Expand All</a> | <a href='{$this->base_url}&act=menu&show=none' target='menu'>Reduce All</a>
|
||||
<br>
|
||||
<a href='{$this->base_url}&act=index' target='body'>ACP Home</a> | <a href='{$INFO['board_url']}/index.{$INFO['php_ext']}' target='_blank'>Board Home</a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign='top' bgcolor='#FFFFFF'>
|
||||
<table cellspacing='0' cellpadding='2' border='0' align='center' width='100%' height='100%' bgcolor='#FFFFFF'>
|
||||
<tr>
|
||||
<td>";
|
||||
|
||||
}
|
||||
|
||||
//+--------------------------------------------------------------------
|
||||
|
||||
function menu_foot() {
|
||||
|
||||
return " </td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</tr>
|
||||
</td>
|
||||
</table>
|
||||
</body>
|
||||
</html>";
|
||||
}
|
||||
|
||||
|
||||
//+--------------------------------------------------------------------
|
||||
|
||||
|
||||
function menu_cat_expanded($name="", $links="", $id = "") {
|
||||
global $IN;
|
||||
|
||||
return "<a name='cat$id'></a>
|
||||
<table cellpadding='0 cellspacing='0' width='100%' border='0' align='center' style='border:1px solid #333333'>
|
||||
<tr>
|
||||
<td id='cattitle'>
|
||||
<table cellspacing='1' cellpadding='3' border='0' width='100%'>
|
||||
<tr>
|
||||
<td align='left' valign='middle' id='cattitle'> <a href='{$this->base_url}&act=menu&show={$IN['show']}&out=$id' target='menu'><img src='{$this->img_url}/minus.gif' border='0' alt='Collapse Category' title='Collapse Category'></a></td>
|
||||
<td align='left' valign='middle' id='cattitle'> <a href='{$this->base_url}&act=menu&show={$IN['show']}&out=$id' target='menu'><span style='color:#000000'>$name</span></a></td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
$links
|
||||
</table>
|
||||
<br>";
|
||||
|
||||
|
||||
}
|
||||
|
||||
//+--------------------------------------------------------------------
|
||||
|
||||
|
||||
function menu_cat_collapsed($name="", $id = "", $desc="") {
|
||||
global $IN;
|
||||
|
||||
return "<table cellpadding='0 cellspacing='2' width='100%' border='0' align='center' style='border:1px solid #777777'>
|
||||
<tr>
|
||||
<td id='cattitle'>
|
||||
<table cellspacing='0' cellpadding='3' border='0' width='100%'>
|
||||
<tr>
|
||||
<td align='left' valign='middle' id='cattitle'> <a href='{$this->base_url}&act=menu&show=,{$IN['show']},$id' target='menu'><img src='{$this->img_url}/plus.gif' border='0' alt='Expand Category' title='Expand Category'></a></td>
|
||||
<td align='left' valign='middle' id='cattitle'> <a href='{$this->base_url}&act=menu&show=,{$IN['show']},$id#cat$id' target='menu'>$name</a></td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td id='detail'>$desc</td>
|
||||
</tr>
|
||||
</table>
|
||||
<br>";
|
||||
|
||||
}
|
||||
|
||||
//+--------------------------------------------------------------------
|
||||
|
||||
function menu_cat_link($url="", $name="") {
|
||||
|
||||
return "<tr><td bgcolor='#EEF2F7' valign='middle' style='height:16px'> <img src='{$this->img_url}/item.gif' border='0' alt='' valign='absmiddle'> <a href='{$this->base_url}&$url' target='body' style='text-decoration:none'>$name</a></td></tr>";
|
||||
|
||||
}
|
||||
|
||||
|
||||
//+--------------------------------------------------------------------
|
||||
|
||||
function frame_set() {
|
||||
global $IN, $ibforums;
|
||||
|
||||
$frames = "<html>
|
||||
<head><title>Invision Board Administration Center</title></head>
|
||||
<frameset cols='185, *' frameborder='no' border='0' framespacing='0'>
|
||||
<frameset rows='*, 80' frameborder='no' border='0' framespacing='0'>
|
||||
<frame name='menu' noresize scrolling='auto' src='{$this->base_url}&act=menu'>
|
||||
<frame name='acp' noresize scrolling='no' src='http://www.invisionboard.com/offsite/?version={$ibforums->version}'>
|
||||
</frameset>
|
||||
<frame name='body' noresize scrolling='auto' src='{$this->base_url}&act=index'>
|
||||
</frameset>
|
||||
</html>";
|
||||
|
||||
return $frames;
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
?>
|
||||
Reference in new issue
Block a user