2008-11-26 19:59:06 +00:00
< ? php
/*
* e107 website system
*
2013-02-10 15:38:37 +01:00
* Copyright ( C ) 2008 - 2013 e107 Inc ( e107 . org )
2008-11-26 19:59:06 +00:00
* Released under the terms and conditions of the
* GNU General Public License ( http :// www . gnu . org / licenses / gpl . txt )
*
* Forum admin functions
*
*/
2013-02-06 17:09:22 +01:00
/* TODO
- Needs rewriting to V2 style including $msg ->
- LAN
*/
2008-11-26 19:59:06 +00:00
class forumAdmin
{
function show_options ( $action )
{
2012-12-01 13:31:54 +01:00
$sql = e107 :: getDb ();
2008-12-18 18:32:54 +00:00
if ( $action == '' ) { $action = 'main' ; }
2008-11-26 19:59:06 +00:00
// ##### Display options ---------------------------------------------------------------------------------------------------------
$var [ 'main' ][ 'text' ] = FORLAN_76 ;
$var [ 'main' ][ 'link' ] = e_SELF ;
$var [ 'cat' ][ 'text' ] = FORLAN_83 ;
2008-12-18 18:32:54 +00:00
$var [ 'cat' ][ 'link' ] = e_SELF . '?cat' ;
2008-11-26 19:59:06 +00:00
if ( $sql -> db_Select ( 'forum' , 'forum_id' , " forum_parent='0' LIMIT 1 " ))
{
$var [ 'create' ][ 'text' ] = FORLAN_77 ;
2008-12-18 18:32:54 +00:00
$var [ 'create' ][ 'link' ] = e_SELF . '?create' ;
2008-11-26 19:59:06 +00:00
}
$var [ 'order' ][ 'text' ] = FORLAN_78 ;
2008-12-18 18:32:54 +00:00
$var [ 'order' ][ 'link' ] = e_SELF . '?order' ;
2008-11-26 19:59:06 +00:00
$var [ 'opt' ][ 'text' ] = FORLAN_79 ;
2008-12-18 18:32:54 +00:00
$var [ 'opt' ][ 'link' ] = e_SELF . '?opt' ;
2012-11-30 18:04:59 +01:00
$var [ 'prune' ][ 'text' ] = LAN_PRUNE ;
2008-12-18 18:32:54 +00:00
$var [ 'prune' ][ 'link' ] = e_SELF . '?prune' ;
2008-11-26 19:59:06 +00:00
$var [ 'rules' ][ 'text' ] = FORLAN_123 ;
2008-12-18 18:32:54 +00:00
$var [ 'rules' ][ 'link' ] = e_SELF . '?rules' ;
2008-11-26 19:59:06 +00:00
$var [ 'sr' ][ 'text' ] = FORLAN_116 ;
2008-12-18 18:32:54 +00:00
$var [ 'sr' ][ 'link' ] = e_SELF . '?sr' ;
2008-11-26 19:59:06 +00:00
$var [ 'mods' ][ 'text' ] = FORLAN_33 ;
2008-12-18 18:32:54 +00:00
$var [ 'mods' ][ 'link' ] = e_SELF . '?mods' ;
2008-11-26 19:59:06 +00:00
$var [ 'tools' ][ 'text' ] = FORLAN_153 ;
2008-12-18 18:32:54 +00:00
$var [ 'tools' ][ 'link' ] = e_SELF . '?tools' ;
2008-11-26 19:59:06 +00:00
show_admin_menu ( FORLAN_7 , $action , $var );
}
function delete_item ( $id )
{
2012-12-01 13:31:54 +01:00
$sql = e107 :: getDb ();
2008-11-26 19:59:06 +00:00
$id = ( int ) $id ;
$confirm = isset ( $_POST [ 'confirm' ]) ? true : false ;
if ( $sql -> db_Select ( 'forum' , '*' , " forum_id = { $id } " ))
{
$txt = " " ;
$row = $sql -> db_Fetch ();
if ( $row [ 'forum_parent' ] == 0 )
{
$txt .= $this -> delete_parent ( $id , $confirm );
}
elseif ( $row [ 'forum_sub' ] > 0 )
{
$txt .= $this -> delete_sub ( $id , $confirm );
}
else
{
$txt .= $this -> delete_forum ( $id , $confirm );
}
if ( $confirm )
{
$this -> show_message ( $txt );
}
else
{
$this -> delete_show_confirm ( $txt );
}
}
}
function delete_parent ( $id , $confirm = false )
{
2012-12-01 13:31:54 +01:00
$sql = e107 :: getDb ();
2013-02-10 15:38:37 +01:00
$mes = e107 :: getMessage ();
$ns = e107 :: getRender ();
//$ret = '';
2008-11-26 19:59:06 +00:00
if ( $sql -> db_Select ( 'forum' , 'forum_id' , " forum_parent = { $id } AND forum_sub = 0 " ))
{
$fList = $sql -> db_getList ();
foreach ( $fList as $f )
{
$ret .= $this -> delete_forum ( $f [ 'forum_id' ], $confirm );
}
}
if ( $confirm )
{
if ( $sql -> db_Delete ( 'forum' , " forum_id = { $id } " ))
{
2013-02-10 15:38:37 +01:00
//$ret .= 'Forum parent successfully deleted';
2013-02-11 16:28:16 +01:00
$mes -> addSuccess ( LAN_DELETED );
2008-11-26 19:59:06 +00:00
}
else
{
2013-02-10 15:38:37 +01:00
//$ret .= 'Forum parent could not be deleted'; // TODO LAN
2013-02-11 16:28:16 +01:00
$mes -> addError ( LAN_DELETED_FAILED );
2008-11-26 19:59:06 +00:00
}
2013-02-11 16:28:16 +01:00
//return $ret;
$ns -> tablerender ( $caption , $mes -> render () . $text );
2008-11-26 19:59:06 +00:00
}
2013-02-10 15:38:37 +01:00
//return 'The forum parent has the following info: <br />'.$ret; // TODO LAN
2008-11-26 19:59:06 +00:00
}
2013-02-10 15:38:37 +01:00
2013-02-11 16:28:16 +01:00
2008-12-18 18:32:54 +00:00
function deleteForum ( $forumId )
{
2012-12-01 13:31:54 +01:00
$sql = e107 :: getDb ();
2008-12-18 18:32:54 +00:00
$forumId = ( int ) $forumId ;
// echo "id = $forumId <br />";
// Check for any sub forums
2012-12-01 13:31:54 +01:00
if ( $sql -> db_Select ( 'forum' , 'forum_id' , " forum_sub = { $forumId } " ))
2008-12-18 18:32:54 +00:00
{
2012-12-01 13:31:54 +01:00
$list = $sql -> db_getList ();
2008-12-18 18:32:54 +00:00
foreach ( $list as $f )
{
$ret .= $this -> deleteForum ( $f [ 'forum_id' ]);
}
}
require_once ( e_PLUGIN . 'forum/forum_class.php' );
$f = new e107Forum ;
2012-12-01 13:31:54 +01:00
if ( $sql -> db_Select ( 'forum_thread' , 'thread_id' , 'thread_forum_id=' . $forumId ))
2008-12-18 18:32:54 +00:00
{
2013-02-10 15:38:37 +01:00
$list = $sql -> db_getList ();
2008-12-18 18:32:54 +00:00
foreach ( $list as $t )
{
$f -> threadDelete ( $t [ 'thread_id' ], false );
}
}
2012-12-01 13:31:54 +01:00
return $sql -> db_Delete ( 'forum' , 'forum_id = ' . $forumId );
2008-12-18 18:32:54 +00:00
}
2008-11-26 19:59:06 +00:00
function delete_forum ( $id , $confirm = false )
{
2012-12-01 13:31:54 +01:00
$sql = e107 :: getDb ();
$tp = e107 :: getParser ();
2013-02-10 15:38:37 +01:00
$ns = e107 :: getRender ();
$mes = e107 :: getMessage ();
//$ret = '';
2012-12-01 13:31:54 +01:00
if ( $sql -> db_Select ( 'forum' , 'forum_id' , 'forum_sub = ' . $id ))
2008-11-26 19:59:06 +00:00
{
$fList = $sql -> db_getList ();
foreach ( $fList as $f )
{
$ret .= $this -> delete_sub ( $f [ 'forum_id' ], $confirm );
}
}
if ( $confirm )
{
2008-12-18 18:32:54 +00:00
if ( $this -> deleteForum ( $id ))
2008-11-26 19:59:06 +00:00
{
2013-02-10 15:38:37 +01:00
//$ret .= "Forum {$id} successfully deleted"; // TODO LAN
$mes -> addSuccess ( LAN_DELETED );
2008-11-26 19:59:06 +00:00
}
else
{
2013-02-10 15:38:37 +01:00
//$ret .= "Forum {$id} could not be deleted"; // TODO LAN
$mes -> addError ( LAN_DELETED_FAILED );
}
2008-11-26 19:59:06 +00:00
}
2012-12-01 13:31:54 +01:00
$sql -> db_Select ( 'forum' , 'forum_name, forum_threads, forum_replies' , 'forum_id = ' . $id );
$row = $sql -> db_Fetch ();
2013-02-10 15:38:37 +01:00
//return "Forum {$id} [".$tp->toHTML($row['forum_name'])."] has {$row['forum_threads']} threads, {$row['forum_replies']} replies. <br />".$ret;
$mes -> addInfo ( " Forum { $id } [ " . $tp -> toHTML ( $row [ 'forum_name' ]) . " ] has { $row [ 'forum_threads' ] } threads and { $row [ 'forum_replies' ] } replies. " ); //FIXME combine multiple info's into one message
$ns -> tablerender ( $caption , $mes -> render () . $text );
2008-11-26 19:59:06 +00:00
}
function delete_sub ( $id , $confirm = FALSE )
{
2012-12-01 13:31:54 +01:00
$sql = e107 :: getDb ();
$tp = e107 :: getParser ();
2013-02-11 16:28:16 +01:00
$mes = e107 :: getMessage ();
$ns = e107 :: getRender ();
2008-11-26 19:59:06 +00:00
if ( $confirm )
{
2008-12-18 18:32:54 +00:00
if ( $this -> deleteForum ( $id ))
2008-11-26 19:59:06 +00:00
{
2013-02-11 16:28:16 +01:00
//$ret .= "Sub-forum {$id} successfully deleted"; // TODO LAN
$mes -> addSuccess ( LAN_DELETED );
2008-11-26 19:59:06 +00:00
}
else
{
2013-02-11 16:28:16 +01:00
//$ret .= "Sub-forum {$id} could not be deleted"; // TODO LAN
$mes -> addError ( LAN_DELETED );
2008-11-26 19:59:06 +00:00
}
2013-02-11 16:28:16 +01:00
//return $ret;
2008-11-26 19:59:06 +00:00
}
2012-12-01 13:31:54 +01:00
$sql -> db_Select ( 'forum' , '*' , 'forum_id = ' . $id );
$row = $sql -> db_Fetch ();
2013-02-11 16:28:16 +01:00
//return "Sub-forum {$id} [".$tp->toHTML($row['forum_name'])."] has {$row['forum_threads']} threads, {$row['forum_replies']} replies. <br />".$ret;
$mes -> addInfo ( " Sub-forum { $id } [ " . $tp -> toHTML ( $row [ 'forum_name' ]) . " ] has { $row [ 'forum_threads' ] } threads, { $row [ 'forum_replies' ] } replies. " ); // FIXME show just once on confirm and not LAN_DELETED
$ns -> tablerender ( $caption , $mes -> render () . $text );
2008-11-26 19:59:06 +00:00
}
function delete_show_confirm ( $txt )
{
2012-12-01 13:31:54 +01:00
$ns = e107 :: getRender ();
2008-11-26 19:59:06 +00:00
$this -> show_message ( $txt );
2013-02-06 17:09:22 +01:00
$frm = e107 :: getForm ();
2008-11-26 19:59:06 +00:00
$txt = "
2008-12-18 18:32:54 +00:00
< form method = 'post' action = '".e_SELF.' ? '.e_QUERY."' >
2013-02-06 17:09:22 +01:00
< div style = 'text-align:center' > " .LAN_CONFDELETE. " < br />< br />
" . $frm->admin_button ('confirm', LAN_UI_DELETE_LABEL, 'submit'). "
2012-11-30 18:04:59 +01:00
< input type = 'submit' class = 'button' name = 'confirm' value = '".LAN_DELETE."' />
2008-11-26 19:59:06 +00:00
</ div >
</ form >
" ;
2012-11-30 18:04:59 +01:00
$ns -> tablerender ( LAN_UI_DELETE_LABEL , $txt );
2008-11-26 19:59:06 +00:00
}
function show_subs ( $id )
{
2012-12-01 13:31:54 +01:00
$sql = e107 :: getDb ();
$tp = e107 :: getParser ();
$ns = e107 :: getRender ();
2012-12-02 11:02:03 +01:00
$frm = e107 :: getForm ();
2008-11-26 19:59:06 +00:00
$txt = "
2008-12-18 18:32:54 +00:00
< form method = 'post' action = '".e_SELF.' ? '.e_QUERY."' >
2012-12-01 23:33:24 +01:00
< table class = 'table adminlist' >
2008-11-26 19:59:06 +00:00
< tr >
2013-02-06 17:09:22 +01:00
< td > " .LAN_ID. " </ td >
< td > " .LAN_NAME. " </ td >
< td > " .LAN_DESCRIPTION. " </ td >
2012-11-30 18:04:59 +01:00
< td > " .FORLAN_37. " </ td >
< td > " .FORLAN_20. " </ td >
2008-11-26 19:59:06 +00:00
</ tr >
" ;
if ( $sql -> db_Select ( 'forum' , 'forum_id, forum_name, forum_description, forum_order' , " forum_sub = { $id } ORDER by forum_order ASC " ))
{
$subList = $sql -> db_getList ();
foreach ( $subList as $sub )
{
$txt .= "
< tr >
2012-11-30 18:04:59 +01:00
< td style = 'vertical-align:top' > { $sub [ 'forum_id' ]} </ td >
< td style = 'vertical-align:top' >< input class = 'tbox' type = 'text' name = 'subname[{$sub[' forum_id ']}]' value = '{$sub[' forum_name ']}' size = '30' maxlength = '255' /></ td >
< td style = 'vertical-align:top' >< textarea cols = '60' rows = '2' class = 'tbox' name = 'subdesc[{$sub[' forum_id ']}]' > { $sub [ 'forum_description' ]} </ textarea ></ td >
< td style = 'vertical-align:top' >< input class = 'tbox' type = 'text' name = 'suborder[{$sub[' forum_id ']}]' value = '{$sub[' forum_order ']}' size = '3' maxlength = '4' /></ td >
< td style = 'vertical-align:top; text-align:center' >
2008-11-26 19:59:06 +00:00
< a href = '".e_SELF."?delete.{$sub[' forum_id ']}' > " .ADMIN_DELETE_ICON. " </ a >
</ td >
</ tr >
" ;
}
$txt .= "
< tr >
2012-11-30 18:04:59 +01:00
< td colspan = '5' style = 'text-align:center' > " . $frm->admin_button ('update_subs', LAN_UPDATE, 'update'). " </ td >
2008-11-26 19:59:06 +00:00
</ tr >
< tr >
< td colspan = '5' style = 'text-align:center' >& nbsp ; </ td >
</ tr >
" ;
}
else
{
2012-11-30 18:04:59 +01:00
$txt .= " <tr><td colspan='5' style='text-align:center'> " . FORLAN_146 . " </td> " ;
2008-11-26 19:59:06 +00:00
}
$txt .= "
< tr >
2013-02-06 17:09:22 +01:00
< td > " .LAN_ID. " </ td >
< td > " .LAN_NAME. " </ td >
< td > " .LAN_DESCRIPTION. " </ td >
< td > " .FORLAN_37. " </ td >
< td >& nbsp ; </ td >
2008-11-26 19:59:06 +00:00
</ tr >
< tr >
2013-02-06 17:09:22 +01:00
< td style = 'vertical-align:top' >& nbsp ; </ td >
< td >< input class = 'tbox' type = 'text' name = 'subname_new' value = '' size = '30' maxlength = '255' /></ td >
< td >< textarea cols = '60' rows = '2' class = 'tbox' name = 'subdesc_new' ></ textarea ></ td >
< td >< input class = 'tbox' type = 'text' name = 'suborder_new' value = '' size = '3' maxlength = '4' /></ td >
< td >& nbsp ; </ td >
2008-11-26 19:59:06 +00:00
</ tr >
< tr >
2013-02-06 17:09:22 +01:00
< td colspan = '5' style = 'text-align:center' > " . $frm->admin_button ('create_sub', LAN_CREATE, 'submit'). " </ td >
2008-11-26 19:59:06 +00:00
</ tr >
</ table >
</ form >
" ;
2013-02-06 17:09:22 +01:00
$ns -> tablerender ( FORLAN_149 , $txt ); // TODO LAN
2008-11-26 19:59:06 +00:00
}
function show_existing_forums ( $sub_action , $id , $mode = false )
{
global $e107 , $for ;
2012-11-30 18:04:59 +01:00
$frm = e107 :: getForm ();
2012-12-01 13:31:54 +01:00
$sql = e107 :: getDb ();
$tp = e107 :: getParser ();
2013-02-10 15:38:37 +01:00
$mes = e107 :: getMessage ();
$ns = e107 :: getRender ();
2008-11-26 19:59:06 +00:00
2008-12-15 00:29:20 +00:00
$subList = $for -> forumGetSubs ();
2008-11-26 19:59:06 +00:00
if ( ! $mode )
{
2012-12-01 13:31:54 +01:00
$text = " <div style='padding : 1px; margin-left: auto; margin-right: auto; text-align: center;'> " ;
2008-11-26 19:59:06 +00:00
}
else
{
$text = " <form method='post' action=' " . e_SELF . " ? " . e_QUERY . " '> " ;
}
2012-12-01 13:31:54 +01:00
if ( ! $parent_amount = $sql -> db_Select ( 'forum' , '*' , " forum_parent='0' ORDER BY forum_order ASC " ))
2008-11-26 19:59:06 +00:00
{
2013-02-10 15:38:37 +01:00
//$text .= "<tr><td style='text-align:center' colspan='3'>".FORLAN_29."</td></tr>";
$mes -> addInfo ( FORLAN_29 );
2008-11-26 19:59:06 +00:00
}
else
{
2013-02-10 15:38:37 +01:00
$text .= "
< table class = 'table adminlist' >
< tr >
2013-03-15 19:23:43 -07:00
< th colspan = '2' > " .FORLAN_28. " </ th >
< th > " .LAN_OPTIONS. " </ th >
2013-02-10 15:38:37 +01:00
</ tr > " ;
2012-12-01 13:31:54 +01:00
while ( $row = $sql -> db_Fetch ( MYSQL_ASSOC ))
2008-11-26 19:59:06 +00:00
{
$parentList [] = $row ;
}
foreach ( $parentList as $parent )
{
$text .= "
< tr >
2012-11-30 18:04:59 +01:00
< td colspan = '2' > " . $parent['forum_name'] . "
2008-12-04 21:36:09 +00:00
< br />< b > " .FORLAN_140. " :</ b > " . $e107->user_class ->uc_get_classname( $parent['forum_class'] ). " & nbsp ; & nbsp ; < b > " .FORLAN_141. " :</ b > " . $e107->user_class ->uc_get_classname( $parent['forum_postclass'] ). "
2008-11-26 19:59:06 +00:00
</ td > " ;
2012-11-30 18:04:59 +01:00
$text .= " <td style='text-align:center'> " ;
2008-11-26 19:59:06 +00:00
if ( $mode )
{
$text .= " <select name='forum_order[]' class='tbox'> \n " ;
for ( $a = 1 ; $a <= $parent_amount ; $a ++ )
{
$text .= ( $parent [ 'forum_order' ] == $a ? " <option value=' { $parent [ 'forum_id' ] } . { $a } ' selected='selected'> $a </option> \n " : " <option value=' { $parent [ 'forum_id' ] } . { $a } '> $a </option> \n " );
}
$text .= " </select> " ;
}
else
{
$text .= "
< div style = 'text-align:left; padding-left: 30px' >
2013-03-15 19:23:43 -07:00
< a class = 'btn btn-large' href = '".e_SELF."?cat.edit.{$parent[' forum_id ']}' > " .ADMIN_EDIT_ICON. " </ a >
< a class = 'btn btn-large' href = '".e_SELF."?delete.{$parent[' forum_id ']}' > " .ADMIN_DELETE_ICON. " </ a >
2008-11-26 19:59:06 +00:00
</ div >
" ;
}
$text .= " </td></tr> " ;
2012-12-01 13:31:54 +01:00
$forumCount = $sql -> db_Select ( 'forum' , '*' , " forum_parent=' " . $parent [ 'forum_id' ] . " ' AND forum_sub = 0 ORDER BY forum_order ASC " );
2008-11-26 19:59:06 +00:00
if ( ! $forumCount )
{
2012-11-30 18:04:59 +01:00
$text .= " <td colspan='4' style='text-align:center'> " . FORLAN_29 . " </td> " ;
2008-11-26 19:59:06 +00:00
}
else
{
$forumList = array ();
2012-12-01 13:31:54 +01:00
while ( $row = $sql -> db_Fetch ( MYSQL_ASSOC ))
2008-11-26 19:59:06 +00:00
{
$forumList [] = $row ;
}
foreach ( $forumList as $forum )
{
$text .= "
< tr >
2012-12-01 13:31:54 +01:00
< td style = 'width:5%; text-align:center' > " .IMAGE_new. " </ td > \n < td style = 'width:55%' >< a href = '".$e107->url->create(' forum / forum / view ', $forum)."' > " . $tp->toHTML ( $forum['forum_name'] ). " </ a > " ;
2012-11-30 18:04:59 +01:00
// <td style='width:5%; text-align:center'>".IMAGE_new."</td>\n<td style='width:55%'><a href='".e_PLUGIN."forum/forum_viewforum.php?{$forum['forum_id']}'>".$e107->tp->toHTML($forum['forum_name'])."</a>";
2008-11-26 19:59:06 +00:00
$text .= "
< br />< span class = 'smallblacktext' > " . $e107->tp ->toHTML( $forum['forum_description'] ). " & nbsp ; </ span >
2008-12-04 21:36:09 +00:00
< br />< b > " .FORLAN_140. " :</ b > " . $e107->user_class ->uc_get_classname( $forum['forum_class'] ). " & nbsp ; & nbsp ; < b > " .FORLAN_141. " :</ b > " . $e107->user_class ->uc_get_classname( $forum['forum_postclass'] ). "
2008-11-26 19:59:06 +00:00
</ td >
2012-11-30 18:04:59 +01:00
< td colspan = '2' style = 'text-align:center' > " ;
2008-11-26 19:59:06 +00:00
if ( $mode )
{
$text .= " <select name='forum_order[]' class='tbox'> \n " ;
for ( $a = 1 ; $a <= $forumCount ; $a ++ )
{
$sel = ( $forum [ 'forum_order' ] == $a ? " selected='selected' " : '' );
$text .= " <option value=' { $forum [ 'forum_id' ] } . { $a } ' { $sel } > { $a } </option> \n " ;
}
$text .= " </select> " ;
}
else
{
$sub_img = count ( $subList [ $forum [ 'forum_parent' ]][ $forum [ 'forum_id' ]]) ? IMAGE_sub : IMAGE_nosub ;
$text .= "
< div style = 'text-align:left; padding-left: 30px' >
2013-03-15 19:23:43 -07:00
< a class = 'btn btn-large' href = '".e_SELF."?create.edit.{$forum[' forum_id ']}' > " .ADMIN_EDIT_ICON. " </ a >
< a class = 'btn btn-large' href = '".e_SELF."?delete.{$forum[' forum_id ']}' > " .ADMIN_DELETE_ICON. " </ a >
& nbsp ; & nbsp ; < a class = 'btn btn-large' href = '".e_SELF."?subs.{$forum[' forum_id ']}' > " . $sub_img . " </ a > ( " .count( $subList[$forum['forum_parent'] ][ $forum['forum_id'] ]). " )
2008-11-26 19:59:06 +00:00
</ div >
" ;
}
$text .= " </td> \n </tr> " ;
}
}
}
}
if ( ! $mode )
{
$text .= " </table></div> " ;
2013-02-10 15:38:37 +01:00
$ns -> tablerender ( FORLAN_30 , $mes -> render () . $text );
2008-11-26 19:59:06 +00:00
}
else
{
2013-02-11 16:28:16 +01:00
$text .= " </table><div class='buttons-bar center'> " . $frm -> admin_button ( 'update_order' , LAN_UPDATE , 'update' ) . " </div></form> " ;
2013-02-10 15:38:37 +01:00
$ns -> tablerender ( FORLAN_37 , $mes -> render () . $text );
2008-11-26 19:59:06 +00:00
}
}
2013-02-10 15:38:37 +01:00
2008-11-26 19:59:06 +00:00
function create_parents ( $sub_action , $id )
{
global $e107 ;
2012-11-30 18:04:59 +01:00
$frm = e107 :: getForm ();
2012-12-01 13:31:54 +01:00
$sql = e107 :: getDb ();
$tp = e107 :: getParser ();
$ns = e107 :: getRender ();
2008-11-26 19:59:06 +00:00
$id = ( int ) $id ;
if ( $sub_action == 'edit' && ! $_POST [ 'update_parent' ])
{
2012-12-01 13:31:54 +01:00
if ( $sql -> db_Select ( 'forum' , '*' , " forum_id= $id " ))
2008-11-26 19:59:06 +00:00
{
2012-12-01 13:31:54 +01:00
$row = $sql -> db_Fetch ( MYSQL_ASSOC );
2008-11-26 19:59:06 +00:00
}
}
2008-11-29 01:24:27 +00:00
else
{
$row = array ();
$row [ 'forum_name' ] = '' ;
$row [ 'forum_class' ] = e_UC_PUBLIC ;
$row [ 'forum_postclass' ] = e_UC_MEMBER ;
2008-12-05 01:30:56 +00:00
$row [ 'forum_threadclass' ] = e_UC_MEMBER ;
2008-11-29 01:24:27 +00:00
}
2008-11-26 19:59:06 +00:00
2012-12-01 23:33:24 +01:00
$text = "
2008-11-26 19:59:06 +00:00
< form method = 'post' action = '".e_SELF.' ? '.e_QUERY."' >
2012-11-30 20:47:26 -08:00
< table class = 'table adminform' >
2013-02-10 15:38:37 +01:00
< colgroup span = '2' >
< col class = 'col-label' />
< col class = 'col-control' />
</ colgroup >
2008-11-26 19:59:06 +00:00
< tr >
2013-02-10 15:38:37 +01:00
< td > " .LAN_NAME. " :</ td >
< td >< input class = 'tbox' type = 'text' name = 'forum_name' size = '60' value = '".$tp->toForm($row[' forum_name '])."' maxlength = '250' /></ td >
2008-11-26 19:59:06 +00:00
</ tr >
< tr >
2013-02-10 15:38:37 +01:00
< td > " .FORLAN_23. " :</ td >
< td > " . $e107->user_class ->uc_dropdown('forum_class', $row['forum_class'] , 'nobody,public,member,admin,classes'). " < span class = 'field-help' > " .FORLAN_24. " </ span ></ td >
2008-11-26 19:59:06 +00:00
</ tr >
< tr >
2013-02-10 15:38:37 +01:00
< td > " .FORLAN_142. " :</ td >
< td > " . $e107->user_class ->uc_dropdown( " forum_postclass " , $row['forum_postclass'] , 'nobody,public,member,admin,classes'). " < span class = 'field-help' > " .FORLAN_143. " </ span ></ td >
2008-12-05 01:30:56 +00:00
</ tr >
< tr >
2013-02-10 15:38:37 +01:00
< td > " .FORLAN_184. " :</ td >
< td > " . $e107->user_class ->uc_dropdown('forum_threadclass', $row['forum_threadclass'] , 'nobody,public,member,admin,classes'). " < span class = 'field-help' > " .FORLAN_185. " </ span ></ td >
2008-11-26 19:59:06 +00:00
</ tr >
2013-02-10 15:38:37 +01:00
</ table >
< div class = 'buttons-bar center' > " ;
2008-11-26 19:59:06 +00:00
if ( $sub_action == 'edit' )
{
2012-11-30 18:04:59 +01:00
$text .= $frm -> admin_button ( 'update_parent' , LAN_UPDATE , 'update' );
2008-11-26 19:59:06 +00:00
}
else
{
2012-11-30 18:04:59 +01:00
$text .= $frm -> admin_button ( 'submit_parent' , LAN_CREATE , 'submit' );
2008-11-26 19:59:06 +00:00
}
2013-02-10 15:38:37 +01:00
$text .= "
</ div >
2012-12-01 23:33:24 +01:00
</ form > " ;
2008-11-26 19:59:06 +00:00
2012-12-01 13:31:54 +01:00
$ns -> tablerender ( FORLAN_75 , $text );
2008-11-26 19:59:06 +00:00
}
function create_forums ( $sub_action , $id )
{
global $e107 ;
2012-11-30 18:04:59 +01:00
$frm = e107 :: getForm ();
2012-12-01 13:31:54 +01:00
$sql = e107 :: getDb ();
$tp = e107 :: getParser ();
$ns = e107 :: getRender ();
2008-11-26 19:59:06 +00:00
$id = ( int ) $id ;
if ( $sub_action == 'edit' && ! $_POST [ 'update_forum' ])
{
2012-12-01 13:31:54 +01:00
if ( $sql -> db_Select ( 'forum' , '*' , " forum_id= $id " ))
2008-11-26 19:59:06 +00:00
{
2013-02-10 15:38:37 +01:00
$fInfo = $sql -> db_Fetch ( MYSQL_ASSOC );
2008-11-26 19:59:06 +00:00
}
}
2008-11-29 01:24:27 +00:00
else
{
$fInfo = array (
'forum_parent' => 0 ,
'forum_moderators' => e_UC_ADMIN ,
'forum_class' => e_UC_PUBLIC ,
2008-12-05 01:30:56 +00:00
'forum_postclass' => e_UC_MEMBER ,
'forum_threadclass' => e_UC_MEMBER
2008-11-29 01:24:27 +00:00
);
}
2008-11-26 19:59:06 +00:00
2012-12-01 23:33:24 +01:00
$text = "
2008-11-26 19:59:06 +00:00
< form method = 'post' action = '".e_SELF.' ? '.e_QUERY."' > \n
2012-12-01 13:31:54 +01:00
< table class = 'table adminform' >
2008-11-26 19:59:06 +00:00
< tr >
2012-12-02 11:02:03 +01:00
< td > " .FORLAN_22. " :</ td >
< td > " ;
2008-11-26 19:59:06 +00:00
2012-12-01 13:31:54 +01:00
$sql -> db_Select ( 'forum' , '*' , 'forum_parent=0' );
2008-11-26 19:59:06 +00:00
$text .= " <select name='forum_parent' class='tbox'> \n " ;
2012-12-01 13:31:54 +01:00
while ( list ( $fid , $fname ) = $sql -> db_Fetch ( MYSQL_NUM ))
2008-11-26 19:59:06 +00:00
{
2012-12-08 13:52:05 +01:00
$sel = ( $fid == vartrue ( $fInfor [ 'forum_parent' ]) ? " selected='selected' " : '' );
2008-11-26 19:59:06 +00:00
$text .= " <option value=' { $fid } ' { $sel } > { $fname } </option> \n " ;
}
$text .= " </select>
</ td >
</ tr >
< tr >
2013-02-06 17:09:22 +01:00
< td > " .LAN_NAME. " :</ td >
< td >< input class = 'tbox' type = 'text' name = 'forum_name' size = '60' value = '".$tp->toForm(vartrue($fInfo[' forum_name ']))."' maxlength = '250' />< span class = 'field-help' > " .FORLAN_179. " </ span ></ td >
2008-11-26 19:59:06 +00:00
</ tr >
< tr >
2013-02-06 17:09:22 +01:00
< td > " .LAN_DESCRIPTION. " :</ td >
< td >< textarea class = 'tbox' name = 'forum_description' cols = '50' rows = '5' > " . $tp->toForm (vartrue( $fInfo['forum_description'] )). " </ textarea ></ td >
2008-11-26 19:59:06 +00:00
</ tr >
< tr >
2013-02-06 17:09:22 +01:00
< td > " .FORLAN_33. " :</ td >
< td > " ;
$text .= $e107 -> user_class -> uc_dropdown ( 'forum_moderators' , $fInfo [ 'forum_moderators' ], 'admin,classes' ) . " <span class='field-help'> " . FORLAN_34 . " </span> " ;
$text .= " </td>
2008-11-26 19:59:06 +00:00
</ tr >
2013-02-06 17:09:22 +01:00
2008-11-26 19:59:06 +00:00
< tr >
2013-02-06 17:09:22 +01:00
< td > " .FORLAN_23. " :</ td >
< td > " . $e107->user_class ->uc_dropdown('forum_class', $fInfo['forum_class'] , 'nobody,public,member,admin,classes'). " < span class = 'field-help' > " .FORLAN_24. " </ span ></ td >
2008-11-26 19:59:06 +00:00
</ tr >
< tr >
2013-02-06 17:09:22 +01:00
< td > " .FORLAN_142. " :</ td >
< td > " . $e107->user_class ->uc_dropdown('forum_postclass', $fInfo['forum_postclass'] , 'nobody,public,member,admin,classes'). " < span class = 'field-help' > " .FORLAN_143. " </ span ></ td >
2008-11-26 19:59:06 +00:00
</ tr >
2008-12-05 01:30:56 +00:00
< tr >
2013-02-06 17:09:22 +01:00
< td > " .FORLAN_184. " :</ td >
< td > " . $e107->user_class ->uc_dropdown('forum_threadclass', $fInfo['forum_threadclass'] , 'nobody,public,member,admin,classes'). " < span class = 'field-help' > " .FORLAN_185. " </ span ></ td >
2008-12-05 01:30:56 +00:00
</ tr >
2013-02-06 17:09:22 +01:00
</ table >
< div class = 'buttons-bar center' > " ;
2008-11-26 19:59:06 +00:00
if ( $sub_action == " edit " )
{
2012-11-30 18:04:59 +01:00
$text .= $frm -> admin_button ( 'update_forum' , LAN_UPDATE , 'update' );
2008-11-26 19:59:06 +00:00
}
else
{
2012-11-30 18:04:59 +01:00
$text .= $frm -> admin_button ( 'submit_forum' , LAN_CREATE , 'submit' );
2008-11-26 19:59:06 +00:00
}
2013-02-06 17:09:22 +01:00
$text .= "
</ div >
</ form >
" ;
2012-12-01 13:31:54 +01:00
$ns -> tablerender ( FORLAN_28 , $text );
2008-11-26 19:59:06 +00:00
}
2013-02-10 15:38:37 +01:00
function show_message ( $message ) // FIX
2008-11-26 19:59:06 +00:00
{
2012-12-01 13:31:54 +01:00
$ns = e107 :: getRender ();
$ns -> tablerender ( '' , " <div style='text-align:center'><b> " . $message . " </b></div> " ); //FIX: v2 style = render?
2008-11-26 19:59:06 +00:00
}
2013-02-10 15:38:37 +01:00
2008-11-26 19:59:06 +00:00
function show_tools ()
{
2012-12-01 13:31:54 +01:00
$sql = e107 :: getDb ();
$ns = e107 :: getRender ();
$tp = e107 :: getParser ();
2012-11-30 18:04:59 +01:00
$frm = e107 :: getForm ();
2008-11-26 19:59:06 +00:00
$txt = "
< form method = 'post' action = '".e_SELF."?".e_QUERY."' >
2012-12-01 13:31:54 +01:00
< table class = 'table adminlist' >
2013-02-10 15:38:37 +01:00
< colgroup span = '2' >
< col class = 'col-label' />
< col class = 'col-control' />
</ colgroup >
< tr >
< td > " .FORLAN_156. " </ td >
2008-11-26 19:59:06 +00:00
</ tr >
< tr >
2013-02-10 15:38:37 +01:00
< td >
" ;
if ( $sql -> db_Select ( " forum " , " * " , " 1 ORDER BY forum_order " ))
2008-11-26 19:59:06 +00:00
{
2013-02-10 15:38:37 +01:00
$fList = $sql -> db_getList ();
foreach ( $fList as $f )
{
$txt .= " <input type='checkbox' name='forumlist[ { $f [ 'forum_id' ] } ]' value='1' /> " . $tp -> toHTML ( $f [ 'forum_name' ]) . " <br /> " ;
}
$txt .= " <input type='checkbox' name='forum_all' value='1' /> <strong> " . FORLAN_157 . " </strong> " ;
2008-11-26 19:59:06 +00:00
}
2013-02-10 15:38:37 +01:00
$txt .= "
</ td >
2008-11-26 19:59:06 +00:00
</ tr >
< tr >
2013-02-10 15:38:37 +01:00
< td > " .FORLAN_158. " </ td >
2008-11-26 19:59:06 +00:00
</ tr >
< tr >
2013-02-10 15:38:37 +01:00
< td >
< input type = 'checkbox' name = 'lastpost' value = '1' /> " .FORLAN_159. " < br />& nbsp ; & nbsp ; & nbsp ; & nbsp ;
< input type = 'checkbox' name = 'lastpost_nothread' value = '1' checked = 'checked' /> " .FORLAN_160. "
</ td >
2008-11-26 19:59:06 +00:00
</ tr >
< tr >
2013-02-10 15:38:37 +01:00
< td > " .FORLAN_161. " </ td >
2008-11-26 19:59:06 +00:00
</ tr >
< tr >
2012-11-30 18:04:59 +01:00
< td >
2013-02-10 15:38:37 +01:00
< input type = 'checkbox' name = 'counts' value = '1' /> " .FORLAN_162. " < br />
& nbsp ; & nbsp ; & nbsp ; & nbsp ; < input type = 'checkbox' name = 'counts_threads' value = '1' />< span style = 'text-align: center' > " .FORLAN_182. " < br /> " .FORLAN_183. " </ span >< br />
</ td >
2008-11-26 19:59:06 +00:00
</ tr >
< tr >
2013-02-10 15:38:37 +01:00
< td > " .FORLAN_163. " </ td >
2008-11-26 19:59:06 +00:00
</ tr >
< tr >
2013-02-10 15:38:37 +01:00
< td >< input type = 'checkbox' name = 'userpostcounts' value = '1' /> " .FORLAN_164. " < br /></ td >
2008-11-26 19:59:06 +00:00
</ tr >
</ table >
2013-02-10 15:38:37 +01:00
< div class = 'buttons-bar center' >
" . $frm->admin_button ('tools', LAN_EXECUTE, 'submit'). "
</ div >
2008-11-26 19:59:06 +00:00
</ form >
" ;
$ns -> tablerender ( FORLAN_166 , $txt );
}
function show_prefs ()
{
2012-12-01 13:31:54 +01:00
global $fPref ;
$ns = e107 :: getRender ();
$sql = e107 :: getDb ();
2008-12-10 15:29:31 +00:00
$e107 = e107 :: getInstance ();
2013-02-10 15:38:37 +01:00
//$emessage = eMessage::getInstance();
2012-11-30 18:04:59 +01:00
$frm = e107 :: getForm ();
2013-02-10 15:38:37 +01:00
$mes = e107 :: getMessage ();
2008-11-26 19:59:06 +00:00
2008-12-10 15:29:31 +00:00
$poll_installed = plugInstalled ( 'poll' );
if ( ! $poll_installed )
2008-11-26 19:59:06 +00:00
{
2010-03-22 01:50:04 +00:00
if ( $fPref -> get ( 'poll' ) == 1 )
2008-11-26 19:59:06 +00:00
{
2010-03-14 14:14:44 +00:00
$fPref [ 'forum_poll' ] = e_UC_NOBODY ;
$fPref -> save ( false , true );
2008-11-26 19:59:06 +00:00
}
}
2012-12-01 23:33:24 +01:00
$text = "
2008-11-26 19:59:06 +00:00
< form method = 'post' action = '".e_SELF."?".e_QUERY."' > \n
2012-12-01 13:31:54 +01:00
< table class = 'table adminform' >
2013-02-10 15:38:37 +01:00
< colgroup span = '2' >
< col class = 'col-label' />
< col class = 'col-control' />
</ colgroup >
2008-11-26 19:59:06 +00:00
< tr >
2013-02-10 15:38:37 +01:00
< td > " .FORLAN_44. " :</ td >
< td > " .( $fPref->get ('enclose') ? " < input type = 'checkbox' name = 'forum_enclose' value = '1' checked = 'checked' /> " : " < input type = 'checkbox' name = 'forum_enclose' value = '1' /> " ). " < span class = 'field-help' > " .FORLAN_45. " </ div ></ td >
2008-11-26 19:59:06 +00:00
</ tr >
< tr >
2013-02-10 15:38:37 +01:00
< td > " .FORLAN_65. " :</ td >
< td >< input class = 'tbox' type = 'text' name = 'forum_title' size = '15' value = '".$fPref->get(' title ')."' maxlength = '100' /></ td >
2008-11-26 19:59:06 +00:00
</ tr >
< tr >
2013-02-10 15:38:37 +01:00
< td > " .FORLAN_47. " :</ td >
< td > " .( $fPref->get ('notify') ? " < input type = 'checkbox' name = 'email_notify' value = '1' checked = 'checked' /> " : " < input type = 'checkbox' name = 'email_notify' value = '1' /> " ). " < span class = 'field-help' > " .FORLAN_48. " </ span ></ td >
2008-11-26 19:59:06 +00:00
</ tr >
< tr >
2013-02-10 15:38:37 +01:00
< td > " .FORLAN_177. " :</ td >
< td > " .( $fPref->get ('notify_on') ? " < input type = 'checkbox' name = 'email_notify_on' value = '1' checked = 'checked' /> " : " < input type = 'checkbox' name = 'email_notify_on' value = '1' /> " ). " < span class = 'field-help' > " .FORLAN_178. " </ span ></ td >
2008-11-26 19:59:06 +00:00
</ tr >
< tr >
2013-02-10 15:38:37 +01:00
< td > " .FORLAN_49. " :</ td > " ;
if ( $poll_installed )
{
//<td>".$e107->user_class->uc_dropdown("mods[{$f['forum_id']}]", $f['forum_moderators'], 'admin,classes')."</td>
$text .= " <td> " . $e107 -> user_class -> uc_dropdown ( 'forum_poll' , $fPref -> get ( 'poll' ), 'admin,classes' ) . '<span class="field-help">' . FORLAN_50 . '</span></td>' ;
}
else
{
$text .= " <td> " . FORLAN_66 . " </td> " ;
}
$text .= "
2008-11-26 19:59:06 +00:00
</ tr >
< tr >
2013-02-10 15:38:37 +01:00
< td > " .FORLAN_70. " : " ;
2008-11-26 19:59:06 +00:00
2013-02-10 15:38:37 +01:00
if ( ! $pref [ 'image_post' ])
{
$text .= " <br /><b> " . FORLAN_139 . " </b> " ; // TODO LAN
}
if ( ! is_writable ( e_PLUGIN . 'forum/attachments' ))
{
$text .= " <br /><b>Attachment dir ( " . e_PLUGIN_ABS . 'forum/attachments' . " ) is not writable!</b> " ; // TODO LAN
}
2008-11-26 19:59:06 +00:00
2013-02-10 15:38:37 +01:00
$text .= " </td>
< td > " .( $fPref->get ('attach') ? " < input type = 'checkbox' name = 'forum_attach' value = '1' checked = 'checked' /> " : " < input type = 'checkbox' name = 'forum_attach' value = '1' /> " ). " < span class = 'field-help' > " .FORLAN_71. " < a href = '".e_ADMIN."upload.php' > " .FORLAN_130. " </ a > " . FORLAN_131. " </ span ></ td >
2008-11-26 19:59:06 +00:00
</ tr >
< tr >
2013-02-10 15:38:37 +01:00
< td > " .FORLAN_134. " :</ td >
< td >< input class = 'tbox' type = 'text' size = '3' maxlength = '5' name = 'forum_maxwidth' value = '".$fPref->get(' maxwidth ')."' />< span class = 'field-help' > " .FORLAN_135. " </ span ></ td >
2008-11-26 19:59:06 +00:00
</ tr >
< tr >
2013-02-10 15:38:37 +01:00
< td > " .FORLAN_136. " :</ td >
< td > " .( $fPref->get ('linkimg') ? " < input type = 'checkbox' name = 'forum_linkimg' value = '1' checked = 'checked' /> " : " < input type = 'checkbox' name = 'forum_linkimg' value = '1' /> " ). " < span class = 'field-help' > " .FORLAN_137. " </ span ></ td >
2008-11-26 19:59:06 +00:00
</ tr >
< tr >
2013-02-10 15:38:37 +01:00
< td > " .FORLAN_51. " :</ td >
< td > " .( $fPref->get ('track') ? " < input type = 'checkbox' name = 'forum_track' value = '1' checked = 'checked' /> " : " < input type = 'checkbox' name = 'forum_track' value = '1' /> " ). " < span class = 'field-help' > " .FORLAN_52. " </ span ></ td >
2008-11-26 19:59:06 +00:00
</ tr >
< tr >
2013-02-10 15:38:37 +01:00
< td > " .FORLAN_112. " :</ td >
< td > " .( $fPref->get ('redirect') ? " < input type = 'checkbox' name = 'forum_redirect' value = '1' checked = 'checked' /> " : " < input type = 'checkbox' name = 'forum_redirect' value = '1' /> " ). " < span class = 'field-help' > " .FORLAN_113. " </ span ></ td >
2008-11-26 19:59:06 +00:00
</ tr >
< tr >
2013-02-10 15:38:37 +01:00
< td > " .FORLAN_116. " :</ td >
< td > " .( $fPref->get ('reported_post_email') ? " < input type = 'checkbox' name = 'reported_post_email' value = '1' checked = 'checked' /> " : " < input type = 'checkbox' name = 'reported_post_email' value = '1' /> " ). " < span class = 'field-help' > " .FORLAN_122. " </ span ></ td >
2008-11-26 19:59:06 +00:00
</ tr >
< tr >
2013-02-10 15:38:37 +01:00
< td > " .FORLAN_126. " :</ td >
< td > " .( $fPref->get ('forum_tooltip') ? " < input type = 'checkbox' name = 'forum_tooltip' value = '1' checked = 'checked' /> " : " < input type = 'checkbox' name = 'forum_tooltip' value = '1' /> " ). " < span class = 'field-help' > " .FORLAN_127. " </ span ></ td >
2008-11-26 19:59:06 +00:00
</ tr >
< tr >
2013-02-10 15:38:37 +01:00
< td > " .FORLAN_128. " :</ td >
< td >< input class = 'tbox' type = 'text' name = 'forum_tiplength' size = '15' value = '".$fPref->get(' tiplength ')."' maxlength = '20' />< span class = 'field-help' > " .FORLAN_129. " </ span ></ td >
2008-11-26 19:59:06 +00:00
</ tr >
< tr >
2013-02-10 15:38:37 +01:00
< td > " .FORLAN_53. " :</ td >
< td >< input class = 'tbox' type = 'text' name = 'forum_eprefix' size = '15' value = '".$fPref->get(' eprefix ')."' maxlength = '20' />< span class = 'field-help' > " .FORLAN_54. " </ span ></ td >
2008-11-26 19:59:06 +00:00
</ tr >
< tr >
2013-02-10 15:38:37 +01:00
< td > " .FORLAN_55. " :</ td >
< td >< input class = 'tbox' type = 'text' name = 'forum_popular' size = '3' value = '".$fPref->get(' popular ')."' maxlength = '3' />< span class = 'field-help' > " .FORLAN_56. " </ span ></ td >
2008-11-26 19:59:06 +00:00
</ tr >
< tr >
2013-02-10 15:38:37 +01:00
< td > " .FORLAN_57. " :</ td >
< td >< input class = 'tbox' type = 'text' name = 'forum_postspage' size = '3' value = '".$fPref->get(' postspage ')."' maxlength = '3' />< span class = 'field-help' > " .FORLAN_58. " </ span ></ td >
2008-11-26 19:59:06 +00:00
</ tr >
2008-12-15 00:29:20 +00:00
< tr >
2013-02-10 15:38:37 +01:00
< td > " .FORLAN_186. " :</ td >
< td >< input class = 'tbox' type = 'text' name = 'forum_threadspage' size = '3' value = '".$fPref->get(' threadspage ')."' maxlength = '3' />< span class = 'field-help' > " .FORLAN_187. " </ span ></ td >
2008-12-15 00:29:20 +00:00
</ tr >
2008-11-26 19:59:06 +00:00
< tr >
2013-02-10 15:38:37 +01:00
< td > " .FORLAN_132. " :</ td >
< td > " .( $fPref->get ('hilightsticky') ? " < input type = 'checkbox' name = 'forum_hilightsticky' value = '1' checked = 'checked' /> " : " < input type = 'checkbox' name = 'forum_hilightsticky' value = '1' /> " ). " < span class = 'field-help' > " .FORLAN_133. " </ span ></ td >
2008-11-26 19:59:06 +00:00
</ tr >
</ table >
2013-02-06 17:09:22 +01:00
< div class = 'buttons-bar center' >
" . $frm->admin_button ('updateoptions', LAN_UPDATE, 'update'). "
</ div >
</ form >
" ;
2013-02-10 15:38:37 +01:00
$ns -> tablerender ( FORLAN_62 , $mes -> render () . $text );
2008-11-26 19:59:06 +00:00
}
function show_reported ( $sub_action , $id )
{
2013-02-10 15:38:37 +01:00
global $rs ; // FIX replace by $frm
2012-12-01 13:31:54 +01:00
$sql = e107 :: getDb ();
$ns = e107 :: getRender ();
$tp = e107 :: getParser ();
2013-02-10 15:38:37 +01:00
$mes = e107 :: getMessage ();
2012-12-01 13:31:54 +01:00
2008-11-26 19:59:06 +00:00
if ( $sub_action ) {
$sql -> db_Select ( " generic " , " * " , " gen_id=' " . $sub_action . " ' " );
$row = $sql -> db_Fetch ();
$sql -> db_Select ( " user " , " * " , " user_id=' " . $row [ 'gen_user_id' ] . " ' " );
$user = $sql -> db_Fetch ();
$con = new convert ;
2012-12-01 23:33:24 +01:00
$text = "
< table class = 'table adminlist' >
2013-02-10 15:38:37 +01:00
< colgroup span = '2' >
< col class = 'col-label' />
< col class = 'col-control' />
</ colgroup >
2012-12-01 23:33:24 +01:00
< tr >
2013-02-10 15:38:37 +01:00
< td > " .FORLAN_171. " :</ td >
< td >< a href = '".e_PLUGIN."forum/forum_viewtopic.php?".$row[' gen_intdata '].".post' rel = 'external' > #".$row['gen_intdata']."</a></td>
2008-11-26 19:59:06 +00:00
</ tr >
< tr >
2013-02-10 15:38:37 +01:00
< td > " .FORLAN_173. " :</ td >
< td > " . $row['gen_ip'] . " </ td >
2008-11-26 19:59:06 +00:00
</ tr >
< tr >
2013-02-10 15:38:37 +01:00
< td > " .FORLAN_174. " :</ td >
< td >< a href = '".e_BASE."user.php?id.".$user[' user_id ']."' > " . $user['user_name'] . " </ a >
2008-11-26 19:59:06 +00:00
</ td >
</ tr >
< tr >
2013-02-10 15:38:37 +01:00
< td > " .FORLAN_175. " :</ td >
< td > " . $con -> convert_date( $row['gen_datestamp'] , " long " ). " </ td >
2008-11-26 19:59:06 +00:00
</ tr >
< tr >
2013-02-10 15:38:37 +01:00
< td > " .FORLAN_176. " :</ td >
< td > " . $row['gen_chardata'] . " </ td >
2008-11-26 19:59:06 +00:00
</ tr >
< tr >
2013-02-10 15:38:37 +01:00
< td style = 'text-align:center' colspan = '2' >
" . $rs->form_open ( " post " , e_SELF. " ? sr " , " " , " " , " " , " onsubmit = \ " return confirm_('sr', " . $row [ 'gen_datestamp' ] . " ) \" " ) . "
" . $rs->form_button ( " submit " , " delete [ reported_ { $row [ 'gen_id' ]}] " , FORLAN_172). "
" . $rs->form_close (). "
2008-11-26 19:59:06 +00:00
</ td >
2013-02-10 15:38:37 +01:00
</ tr >
</ table > " ;
2008-11-26 19:59:06 +00:00
$ns -> tablerender ( FORLAN_116 , $text );
2013-02-10 15:38:37 +01:00
}
else
2008-11-26 19:59:06 +00:00
{
2013-02-10 15:38:37 +01:00
if ( $reported_total = $sql -> db_Select ( " generic " , " * " , " gen_type='reported_post' OR gen_type='Reported Forum Post' " ))
2008-11-26 19:59:06 +00:00
{
2013-02-10 15:38:37 +01:00
$text .= "
< table class = 'table adminlist' >
< tr >
< td > " .FORLAN_170. " </ td >
< td > " .LAN_OPTIONS. " </ td >
</ tr > " ;
while ( $row = $sql -> db_Fetch ())
{
$text .= " <tr>
< td < a href = '".e_SELF."?sr.".$row[' gen_id ']."' > " .FORLAN_171. " #".$row['gen_intdata']."</a></td>
< td text - align : center ; vertical - align : top ; white - space : nowrap ' >
" . $rs->form_open ( " post " , e_SELF. " ? sr " , " " , " " , " " , " onsubmit = \ " return confirm_('sr', " . $row [ 'gen_datestamp' ] . " ) \" " ) . "
" . $rs->form_button ( " submit " , " delete [ reported_ { $row [ 'gen_id' ]}] " , FORLAN_172). "
" . $rs->form_close (). "
</ td >
</ tr > \n " ;
}
$text .= " </table> " ;
2008-11-26 19:59:06 +00:00
}
2013-02-10 15:38:37 +01:00
else
{
//$text = "<div style='text-align:center'>".FORLAN_121."</div>";
$mes -> addInfo ( FORLAN_121 );
}
$ns -> tablerender ( FORLAN_116 , $mes -> render () . $text );
2008-11-26 19:59:06 +00:00
}
}
function show_prune ()
{
2012-12-01 13:31:54 +01:00
$ns = e107 :: getRender ();
$sql = e107 :: getDB ();
2012-11-30 18:04:59 +01:00
$frm = e107 :: getForm ();
2008-11-26 19:59:06 +00:00
// $sql -> db_Select("forum", "forum_id, forum_name", "forum_parent!=0 ORDER BY forum_order ASC");
$qry = "
SELECT f . forum_id , f . forum_name , sp . forum_name AS sub_parent , fp . forum_name AS forum_parent
FROM #forum AS f
LEFT JOIN #forum AS sp ON sp.forum_id = f.forum_sub
LEFT JOIN #forum AS fp ON fp.forum_id = f.forum_parent
WHERE f . forum_parent != 0
ORDER BY f . forum_parent ASC , f . forum_sub , f . forum_order ASC
" ;
$sql -> db_Select_gen ( $qry );
$forums = $sql -> db_getList ();
2012-11-30 18:04:59 +01:00
$text = "
2008-11-26 19:59:06 +00:00
< form method = 'post' action = '".e_SELF."?".e_QUERY."' > \n
2012-12-01 13:31:54 +01:00
< table class = 'table adminlist' >
2008-11-26 19:59:06 +00:00
< tr >
2013-02-10 15:38:37 +01:00
< td > " .FORLAN_60. " </ td >
2008-11-26 19:59:06 +00:00
</ tr >
2013-02-10 15:38:37 +01:00
< tr >
< td > " .FORLAN_87. " < input class = 'tbox' type = 'text' name = 'prune_days' size = '6' value = '' maxlength = '3' /></ td >
2008-11-26 19:59:06 +00:00
</ tr >
< tr >
2013-02-10 15:38:37 +01:00
< td > " .FORLAN_2. " < br />
" .FORLAN_89. " < input type = 'radio' name = 'prune_type' value = 'delete' />& nbsp ; & nbsp ; & nbsp ;
" .FORLAN_90. " < input type = 'radio' name = 'prune_type' value = 'make_inactive' checked = 'checked' />
2008-11-26 19:59:06 +00:00
</ td >
</ tr >
< tr >
2012-11-30 18:04:59 +01:00
< td > " .FORLAN_138. " : < br /> " ;
2008-11-26 19:59:06 +00:00
foreach ( $forums as $forum )
{
$for_name = $forum [ 'forum_parent' ] . " -> " ;
$for_name .= ( $forum [ 'sub_parent' ] ? $forum [ 'sub_parent' ] . " -> " : " " );
$for_name .= $forum [ 'forum_name' ];
$text .= " <input type='checkbox' name='pruneForum[]' value=' " . $forum [ 'forum_id' ] . " ' /> " . $for_name . " <br /> " ;
}
2013-02-10 15:38:37 +01:00
$text .= "
2008-11-26 19:59:06 +00:00
</ table >
2013-02-10 15:38:37 +01:00
< div class = 'buttons-bar center' >
" . $frm->admin_button ('do_prune', LAN_PRUNE, 'submit'). "
</ div >
2012-11-30 18:04:59 +01:00
</ form > " ;
$ns -> tablerender ( LAN_PRUNE , $text );
2008-11-26 19:59:06 +00:00
}
function show_mods ()
{
2012-12-01 13:31:54 +01:00
global $for ;
$ns = e107 :: getRender ();
$sql = e107 :: getDB ();
2013-02-10 15:38:37 +01:00
$e107 = e107 :: getInstance (); // FIX needed?
2008-11-26 19:59:06 +00:00
$forumList = $for -> forum_getforums ( 'all' );
$parentList = $for -> forum_getparents ( 'list' );
2008-12-18 15:28:59 +00:00
$subList = $for -> forumGetSubs ( 'bysub' );
2012-11-30 18:04:59 +01:00
$frm = e107 :: getForm ();
2012-12-01 13:31:54 +01:00
$tp = e107 :: getParser ();
2008-11-26 19:59:06 +00:00
2013-02-10 15:38:37 +01:00
$txt = " <form method='post' action=' " . e_SELF . " ? " . e_QUERY . " '>
< table class = 'table adminlist' >
< colgroup span = '2' >
< col class = 'col-label' />
< col class = 'col-control' />
</ colgroup > " ;
2008-11-26 19:59:06 +00:00
foreach ( $parentList as $p )
{
$txt .= "
< tr >
2013-02-10 15:38:37 +01:00
< td colspan = '2' >< strong > " . $tp->toHTML ( $p['forum_name'] ). " </ strong ></ td >
2008-11-26 19:59:06 +00:00
</ tr >
" ;
foreach ( $forumList [ $p [ 'forum_id' ]] as $f )
{
$txt .= "
< tr >
2013-02-10 15:38:37 +01:00
< td > { $f [ 'forum_name' ]} </ td >
< td > " . $e107->user_class ->uc_dropdown( " mods [{ $f [ 'forum_id' ]}] " , $f['forum_moderators'] , 'admin,classes'). " </ td >
2008-11-26 19:59:06 +00:00
</ tr >
" ;
foreach ( $subList [ $f [ 'forum_id' ]] as $s )
{
$txt .= "
< tr >
2013-02-10 15:38:37 +01:00
< td >& nbsp ; & nbsp ; & nbsp ; & nbsp ;{ $s [ 'forum_name' ]} </ td >
< td > " . $e107->user_class ->uc_dropdown( " mods [{ $s [ 'forum_id' ]}] " , $s['forum_moderators'] , 'admin,classes'). " </ td >
2008-11-26 19:59:06 +00:00
</ tr >
" ;
}
}
}
$txt .= "
2013-02-10 15:38:37 +01:00
</ table >
< div class = 'buttons-bar center' >
" . $frm->admin_button ('setMods', LAN_UPDATE, 'update'). "
</ div >
</ form > " ;
2012-11-30 18:04:59 +01:00
$ns -> tablerender ( FORLAN_33 , $txt ); // FIX: LAN button update was WMGLAN_4." ".FORLAN_33)
2008-11-26 19:59:06 +00:00
}
function show_rules ()
{
2012-12-01 13:31:54 +01:00
$pref = e107 :: getPref ();
$ns = e107 :: getRender ();
$sql = e107 :: getDB ();
$tp = e107 :: getParser ();
2012-11-30 18:04:59 +01:00
$frm = e107 :: getForm ();
2008-11-26 19:59:06 +00:00
$sql -> db_Select ( " wmessage " );
list ( $null ) = $sql -> db_Fetch ();
list ( $null ) = $sql -> db_Fetch ();
list ( $null ) = $sql -> db_Fetch ();
list ( $id , $guestrules , $wm_active4 ) = $sql -> db_Fetch ();
list ( $id , $memberrules , $wm_active5 ) = $sql -> db_Fetch ();
list ( $id , $adminrules , $wm_active6 ) = $sql -> db_Fetch ();
if ( $sql -> db_Select ( 'generic' , '*' , " gen_type='forum_rules_guest' " ))
{
$guest_rules = $sql -> db_Fetch ();
}
if ( $sql -> db_Select ( 'generic' , '*' , " gen_type='forum_rules_member' " ))
{
$member_rules = $sql -> db_Fetch ();
}
if ( $sql -> db_Select ( 'generic' , '*' , " gen_type='forum_rules_admin' " ))
{
$admin_rules = $sql -> db_Fetch ();
}
2012-12-08 13:52:05 +01:00
$guesttext = $tp -> toFORM ( vartrue ( $guest_rules [ 'gen_chardata' ]));
$membertext = $tp -> toFORM ( vartrue ( $member_rules [ 'gen_chardata' ]));
$admintext = $tp -> toFORM ( vartrue ( $admin_rules [ 'gen_chardata' ]));
2008-11-26 19:59:06 +00:00
$text = "
< form method = 'post' action = '".e_SELF."?rules' id = 'wmform' >
2012-12-01 13:31:54 +01:00
< table class = 'table adminform' >
2013-02-10 15:38:37 +01:00
< colgroup span = '2' >
< col class = 'col-label' />
< col class = 'col-control' />
</ colgroup >
< tr >
< td > " .WMGLAN_1. " : < br />
" .WMGLAN_6. " : " ;
if ( vartrue ( $guest_rules [ 'gen_intdata' ]))
{
$text .= " <input type='checkbox' name='guest_active' value='1' checked='checked' /> " ;
}
else
{
$text .= " <input type='checkbox' name='guest_active' value='1' /> " ;
}
$text .= " </td>
< td >
< textarea class = 'tbox' name = 'guestrules' cols = '70' rows = '10' > $guesttext </ textarea >
< br />
< input class = 'helpbox' type = 'text' name = 'helpguest' size = '100' />
< br />
" .display_help('helpb', 1, 'addtext1', 'help1'). "
</ td >
2008-11-26 19:59:06 +00:00
</ tr >
< tr >
2013-02-10 15:38:37 +01:00
< td > " .WMGLAN_2. " : < br />
" .WMGLAN_6. " : " ;
if ( vartrue ( $member_rules [ 'gen_intdata' ]))
{
$text .= " <input type='checkbox' name='member_active' value='1' checked='checked' /> " ;
}
else
{
$text .= " <input type='checkbox' name='member_active' value='1' /> " ;
}
$text .= " </td>
< td >
< textarea class = 'tbox' name = 'memberrules' cols = '70' rows = '10' > $membertext </ textarea >
< br />
< input class = 'helpbox' type = 'text' name = 'helpmember' size = '100' />
< br />
" .display_help('helpb', 1, 'addtext2', 'help2'). "
</ td >
2008-11-26 19:59:06 +00:00
</ tr >
< tr >
2013-02-10 15:38:37 +01:00
< td > " .WMGLAN_3. " : < br />
" .WMGLAN_6. " : " ;
2008-11-26 19:59:06 +00:00
2013-02-10 15:38:37 +01:00
if ( vartrue ( $admin_rules [ 'gen_intdata' ]))
{
$text .= " <input type='checkbox' name='admin_active' value='1' checked='checked' /> " ;
}
else
{
$text .= " <input type='checkbox' name='admin_active' value='1' /> " ;
}
2008-11-26 19:59:06 +00:00
2013-02-10 15:38:37 +01:00
$text .= " </td>
< td >
< textarea class = 'tbox' name = 'adminrules' cols = '70' rows = '10' > $admintext </ textarea >
< br />
< input class = 'helpbox' type = 'text' name = 'helpadmin' size = '100' />
< br />
" .display_help('helpb', 1, 'addtext3', 'help3'). "
</ td >
2008-11-26 19:59:06 +00:00
</ tr >
</ table >
2013-02-10 15:38:37 +01:00
< div class = 'buttons-bar center' >
" . $frm->admin_button ('frsubmit', LAN_UPDATE, 'submit'). "
</ div >
2012-12-01 23:33:24 +01:00
</ form > " ;
2008-11-26 19:59:06 +00:00
$ns -> tablerender ( WMGLAN_5 , $text );
echo "
< script type = \ " text/javascript \" >
function addtext1 ( sc ){
document . getElementById ( 'wmform' ) . guestrules . value += sc ;
}
function addtext2 ( sc ){
document . getElementById ( 'wmform' ) . memberrules . value += sc ;
}
function addtext3 ( sc ){
document . getElementById ( 'wmform' ) . adminrules . value += sc ;
}
function help1 ( help ){
document . getElementById ( 'wmform' ) . helpguest . value = help ;
}
function help2 ( help ){
document . getElementById ( 'wmform' ) . helpmember . value = help ;
}
function help3 ( help ){
document . getElementById ( 'wmform' ) . helpadmin . value = help ;
}
</ script >
" ;
}
2012-12-01 13:31:54 +01:00
}