From: vladimir c. <ch...@us...> - 2002-01-23 13:24:08
|
Update of /cvsroot/pn-modules/PN_phpBB_14/html/modules/phpBB_14/admin/modules In directory usw-pr-cvs1:/tmp/cvs-serv11902 Modified Files: forums.php Added Files: phpBB_14_AddForum.php phpBB_14_AddForumSave.php phpBB_14_EditForum.php phpBB_14_EditForumForm.php phpBB_14_EditForumSave.php Log Message: Edit Delete forum moved to separate files --- NEW FILE: phpBB_14_AddForum.php --- <?php // $Id: phpBB_14_AddForum.php,v 1.1 2002/01/23 13:24:04 chv Exp $ if (!eregi("admin.php", $PHP_SELF)) { die ("Access Denied"); } if (!authorised(0, 'phpBB_14::', '::', ACCESS_ADMIN)) { die ("Access Denied"); } // $index=True; // $hlpfile = "manual/phpBB_14.html"; modules_get_language(); include("modules/$ModName/phpBB_14tables.php"); include("modules/$ModName/functions.php"); function phpBB_14_AddForum() { global $pntable, $bbtable, $bgcolor1,$bgcolor2,$bgcolor3; include("header.php"); GraphicAdmin($hlpfile); opentable(); echo "<center><a class=\"pn-pagetitle\" href=\"admin.php?op=phpBB_14\">"._PHPBB_ADMINFORUMSPANEL."</a></center>"; closetable(); echo "<br>"; $sql = "SELECT count(*) AS total FROM $bbtable[categories]"; if(!$r = mysql_query($sql)) { error_die(_PHPBB_ERROR_CONNECT,$sql,mysql_errno(),mysql_error()); } list($total) = mysql_fetch_array($r); if($total < 1 || !isset($total)) error_die(_PHPBB_CAT_NOEXIST); ?> <TABLE BORDER="0" CELLPADDING="1" CELLSPACING="0" ALIGN="CENTER" VALIGN="TOP" WIDTH="100%"> <TR> <TD BGCOLOR="<?php echo $bgcolor2?>"> <TABLE BORDER="0" CELLPADDING="3" CELLSPACING="1" WIDTH="100%"> <form name="createforumform" action="admin.php?op=phpBB_14_AddForumSave" method="post"> <TR BGCOLOR="<?php echo $bgcolor2?>" ALIGN="LEFT"> <TD ALIGN="CENTER" COLSPAN="2"><font class="pn-pagetitle"><?php echo _PHPBB_ADMINFORUMADD; ?></FONT></TD> </TR> <TR BGCOLOR="<?php echo $bgcolor3?>" ALIGN="LEFT"> <TD><font class="pn-title">Forum Name:</FONT></TD> <TD bgcolor="<?php echo $bgcolor1?>"><INPUT TYPE="TEXT" NAME="forum_name" SIZE="110" MAXLENGTH="150"></TD> </TR> <TR BGCOLOR="<?php echo $bgcolor3?>" ALIGN="LEFT"> <TD><font class="pn-title">Forum Description:</FONT></TD> <TD bgcolor="<?php echo $bgcolor1?>"><TEXTAREA NAME="desc" ROWS="5" COLS="90" WRAP="VIRTUAL"></TEXTAREA></TD> </TR> <TR BGCOLOR="<?php echo $bgcolor3?>" ALIGN="LEFT"> <TD><font class="pn-title">Moderator:</FONT></TD> <TD bgcolor="<?php echo $bgcolor1?>"><SELECT NAME="mods[]" size="5" multiple> <?php $sql = "SELECT n.uid, n.uname FROM $pntable[users] AS n LEFT JOIN $bbtable[users] AS u ON u.user_id=n.uid WHERE n.uid != 1 AND u.user_level != -1 ORDER BY n.uname"; if(!$result = mysql_query($sql)) error_die(_PHPBB_ERROR_CONNECT,$sql,mysql_errno(),mysql_error()); if($myrow = mysql_fetch_array($result)) { do { echo "<OPTION VALUE=\"".$myrow['uid']."\">".$myrow['uname']."</OPTION>\n"; } while($myrow = mysql_fetch_array($result)); } else { echo "<OPTION VALUE=\"0\">None</OPTION>\n"; } ?> </SELECT></TD> </TR> <TR BGCOLOR="<?php echo $bgcolor3?>" ALIGN="LEFT"> <TD><font class="pn-title">Category:</FONT></TD> <TD bgcolor="<?php echo $bgcolor1?>"><SELECT NAME="cat"> <?php $sql = "SELECT * FROM $bbtable[categories] "; if(!$result = mysql_query($sql)) error_die(_PHPBB_ERROR_CONNECT,$sql,mysql_errno(),mysql_error()); if($myrow = mysql_fetch_array($result)) { do { echo "<OPTION VALUE=\"$myrow[cat_id]\">$myrow[cat_title]</OPTION>\n"; } while($myrow = mysql_fetch_array($result)); } else { echo "<OPTION VALUE=\"0\">None</OPTION>\n"; } ?> </SELECT></TD> </TR> <TR BGCOLOR="<?php echo $bgcolor3?>" ALIGN="LEFT"> <TD><font class="pn-title">Access Level:</font></TD> <TD bgcolor="<?php echo $bgcolor1?>"><SELECT NAME="forum_access"> <OPTION VALUE="2">Anonymous Posting</OPTION> <OPTION VALUE="1">Registered users only</OPTION> <OPTION VALUE="3">Moderators/Administrators only</OPTION> </SELECT> </TD> </TR> <TR BGCOLOR="<?php echo $bgcolor3?>" ALIGN="LEFT"> <TD><font class="pn-title">Type:</FONT></TD> <TD bgcolor="<?php echo $bgcolor1?>"><SELECT NAME="type"> <OPTION VALUE="0">Public</OPTION> <OPTION VALUE="1">Private</OPTION> </SELECT> </TD> </TR> <TR BGCOLOR="<?php echo $bgcolor3?>" ALIGN="LEFT"> <TD ALIGN="CENTER" COLSPAN="2"> <INPUT TYPE="SUBMIT" NAME="submit" VALUE="Submit"> <INPUT TYPE="SUBMIT" NAME="submit" VALUE="Submit"> </TD> </TR> </table> </TD> </TR> </table> <?php include("footer.php"); } ?> --- NEW FILE: phpBB_14_AddForumSave.php --- <?php // $Id: phpBB_14_AddForumSave.php,v 1.1 2002/01/23 13:24:04 chv Exp $ if (!eregi("admin.php", $PHP_SELF)) { die ("Access Denied"); } if (!authorised(0, 'phpBB_14::', '::', ACCESS_ADMIN)) { die ("Access Denied"); } modules_get_language(); include("modules/$ModName/phpBB_14tables.php"); include("modules/$ModName/functions.php"); function phpBB_14_AddForumSave($forum_id, $forum_name, $desc, $cat, $mods, $forum_access,$type) { global $bbtable, $pntable, $hlpfile; if($forum_name == '' || !is_array($mods)) error_die(_PHPBB_CREATEFORUM_INCOMPLETE); if (!$desc) { $desc = ''; } $desc = str_replace("\n", "<BR>", $desc); $desc = addslashes($desc); $forum_name = addslashes($forum_name); // $forum_desc = StripSlashes(FixQuotes($forum_desc)); // $forum_name = StripSlashes(FixQuotes($forum_name)); $sql = "SELECT max(forum_order) AS highest FROM $bbtable[forums] WHERE cat_id=$cat"; if(!$r = mysql_query($sql)) { error_die(_PHPBB_ERROR_CONNECT,$sql,mysql_errno(),mysql_error()); } list($highest) = mysql_fetch_array($r); $highest++; $sql = "INSERT INTO $bbtable[forums] (forum_name, forum_desc, forum_access, cat_id, forum_type, forum_order) VALUES ('".$forum_name."', '".$desc."', '".$forum_access."', '".$cat."', '".$type."', '".$highest."')"; if(!$result = mysql_query($sql)) { error_die(_PHPBB_ERROR_CONNECT,$sql,mysql_errno(),mysql_error()); } $forum = mysql_insert_id(); $count = 0; while(list($mod_number, $mod) = each($mods)) { $mod_data = phpbb14_get_userdata_from_id($mod); if($mod_data['user_level'] < 2) { if(!isset($user_query)) $user_query = "UPDATE $bbtable[users] SET user_level = 2 WHERE "; if($count > 0) $user_query .= "OR "; $user_query .= "user_id = '$mod' "; $count++; } $mod_query = "INSERT INTO $bbtable[forum_mods] (forum_id, user_id) VALUES ('$forum', '$mod')"; if(!mysql_query($mod_query)) error_die(_PHPBB_ERROR_CONNECT,$mod_query,mysql_errno(),mysql_error()); } if(isset($user_query)) { if(!mysql_query($user_query)) error_die(_PHPBB_ERROR_CONNECT,$user_query,mysql_errno(),mysql_error()); } header("Location: admin.php?op=phpBB_14"); } ?> --- NEW FILE: phpBB_14_EditForum.php --- <?php // $Id: phpBB_14_EditForum.php,v 1.1 2002/01/23 13:24:04 chv Exp $ if (!eregi("admin.php", $PHP_SELF)) { die ("Access Denied"); } if (!authorised(0, 'phpBB_14::', '::', ACCESS_ADMIN)) { die ("Access Denied"); } // $index=True; // $hlpfile = "manual/phpBB_14.html"; modules_get_language(); include("modules/$ModName/phpBB_14tables.php"); include("modules/$ModName/functions.php"); function phpBB_14_EditForum() { global $bbtable, $hlpfile; include("header.php"); GraphicAdmin($hlpfile); opentable(); echo "<center><a class=\"pn-pagetitle\" href=\"admin.php?op=phpBB_14\">"._PHPBB_ADMINFORUMSPANEL."</a></center>"; closetable(); echo "<br>"; OpenTable(); echo "<center><font class=\"pn-title\">"._PBEDITFORUM."</font></center><br><br>\n"; echo "<font class=\"pn-title\">"._PBCHOOSEFORUMEDIT."</font><br>\n"; echo "<form name=\"editforum\" action=\"admin.php?op=phpBB_14_EditForumForm\" method=\"post\">\n"; echo "<select name=\"forum_id\">"; $sql = "SELECT f.forum_name, f.forum_id, c.cat_title FROM $bbtable[forums] AS f LEFT JOIN $bbtable[categories] AS c ON c.cat_id=f.cat_id ORDER BY c.cat_order, f.forum_order"; if(!$result = mysql_query($sql)) { error_die(_PHPBB_ERROR_CONNECT,$sql,mysql_errno(),mysql_error()); } if($myrow = mysql_fetch_array($result)) { do { $forum_name = stripslashes($myrow[cat_title]).""._PHPBB_SEPARATOR."".stripslashes($myrow[forum_name]); echo "<OPTION VALUE=\"$myrow[forum_id]\">$forum_name</OPTION>\n"; } while($myrow = mysql_fetch_array($result)); } else { echo "<OPTION VALUE=\"-1\">No Forums in Database</OPTION>\n"; } echo "</select>\n"; echo "<input type=\"submit\" name=\"submit\" value=\""._PBEDITFORUM."\"></form> \n"; CloseTable(); include("footer.php"); } ?> --- NEW FILE: phpBB_14_EditForumForm.php --- <?php // $Id: phpBB_14_EditForumForm.php,v 1.1 2002/01/23 13:24:04 chv Exp $ if (!eregi("admin.php", $PHP_SELF)) { die ("Access Denied"); } if (!authorised(0, 'phpBB_14::', '::', ACCESS_ADMIN)) { die ("Access Denied"); } // $index=True; // $hlpfile = "manual/phpBB_14.html"; modules_get_language(); include("modules/$ModName/phpBB_14tables.php"); include("modules/$ModName/functions.php"); function phpBB_14_EditForumForm($forum_id) { global $bbtable, $hlpfile, $pntable; include("header.php"); GraphicAdmin($hlpfile); opentable(); echo "<center><a class=\"pn-pagetitle\" href=\"admin.php?op=phpBB_14\">"._PHPBB_ADMINFORUMSPANEL."</a></center>"; closetable(); echo "<br>"; OpenTable(); echo "<center><font class=\"pn-title\">"._PHPBB_EDITFORUM."</font></center>"; //get the forum info from the id // $forumresult = mysql_query("SELECT forum_name, forum_desc, forum_readaccess, forum_cat_id, forum_writeaccess FROM $pntablemod[forums] WHERE forum_id = $forum_id"); // list($forum_name, $forum_desc, $forum_readaccess, $forum_cat_id, $forum_writeaccess) = mysql_fetch_row($forumresult); //form for adding forum information echo "<form name=\"editforumform\" action=\"admin.php?op=phpBB_14_EditForumSave\" method=\"post\">"; $sql = "SELECT * FROM $bbtable[forums] WHERE forum_id = '$forum_id'"; if(!$result = mysql_query($sql)) error_die(_PHPBB_ERROR_CONNECT,$sql,mysql_errno(),mysql_error()); if(!$myrow = mysql_fetch_array($result)) { error_die( "No such forum"); } $forum_name = stripslashes($myrow['forum_name']); $desc = stripslashes($myrow['forum_desc']); ?> <TABLE BORDER="0" CELLPADDING="3" CELLSPACING="1" WIDTH="100%"> <TR BGCOLOR="<?php echo $bgcolor2?>" ALIGN="LEFT"> <TD ALIGN="left" COLSPAN="2"> <font class="pn-normal"><B> <a href="admin.php?op=phpBB_14_DeleteForum&forum_id=<?php echo $forum_id;?>&ok=0"><?php echo _PBDELETEFORUM."(This will also remove all posts in this forum!)"; ?></a> </FONT></TD> </TR> <TR BGCOLOR="<?php echo $bgcolor3?>" ALIGN="LEFT"> <TD><font class="pn-title">Forum Name:</FONT></TD> <TD BGCOLOR="<?php echo $bgcolor1?>"><INPUT TYPE="TEXT" NAME="forum_name" SIZE="100" MAXLENGTH="150" VALUE="<?php echo $forum_name?>"></TD> </TR> <TR BGCOLOR="<?php echo $bgcolor3?>" ALIGN="LEFT"> <TD><font class="pn-title">Forum Description:</FONT></TD> <TD BGCOLOR="<?php echo $bgcolor1?>"><TEXTAREA NAME="desc" ROWS="5" COLS="85" WRAP="soft"><?php echo $desc?></TEXTAREA></TD> </TR> <TR BGCOLOR="<?php echo $bgcolor3?>" ALIGN="LEFT"> <TD valign="top"><font class="pn-title">Moderator(s):</FONT></TD> <TD BGCOLOR="<?php echo $bgcolor1?>"><b>Current:</b><BR> <?php $sql = "SELECT u.uname, u.uid FROM $pntable[users] u, $bbtable[forum_mods] f WHERE f.forum_id = '$forum' AND u.uid = f.user_id"; if(!$r = mysql_query($sql)) error_die(_PHPBB_ERROR_CONNECT,$sql,mysql_errno(),mysql_error()); if($row = mysql_fetch_array($r)) { do { echo $row['uname']." (<input type=\"checkbox\" name=\"rem_mods[]\" value=\"$row[uid]\"> Remove)<BR>"; $current_mods[] = $row['uid']; } while($row = mysql_fetch_array($r)); echo "<BR>"; } else { echo "No Moderators Assigned<BR><BR>\n"; } ?> <b>Add:</b><BR> <SELECT NAME="mods[]" size="5" multiple> <?php $sql = "SELECT n.uid, n.uname FROM $pntable[users] AS n LEFT JOIN $bbtable[users] AS u ON u.user_id=n.uid WHERE n.uid != 1 AND u.user_level != -1 "; while(list($null, $currMod) = each($current_mods)) { $sql .= "AND n.uid != $currMod "; } $sql .= "ORDER BY uname"; if(!$r = mysql_query($sql)) error_die(_PHPBB_ERROR_CONNECT,$sql,mysql_errno(),mysql_error()); if($row = mysql_fetch_array($r)) { do { $s = ""; if($row[uid] == $myrow[forum_moderator]) $s = "SELECTED"; echo "<OPTION VALUE=\"$row[uid]\" $s>$row[uname]</OPTION>\n"; } while($row = mysql_fetch_array($r)); } else { echo "<OPTION VALUE=\"0\">None</OPTION>\n"; } ?> </SELECT></TD> </TR> <TR BGCOLOR="<?php echo $bgcolor3?>" ALIGN="LEFT"> <TD><font class="pn-title">Category:</FONT></TD> <TD BGCOLOR="<?php echo $bgcolor1?>"><SELECT NAME="cat"> <?php $sql = "SELECT * FROM $bbtable[categories] "; if(!$r = mysql_query($sql)) error_die(_PHPBB_ERROR_CONNECT,$sql,mysql_errno(),mysql_error()); if($row = mysql_fetch_array($r)) { do { $s = ""; if($row[cat_id] == $myrow[cat_id]) $s = "SELECTED"; echo "<OPTION VALUE=\"$row[cat_id]\" $s>$row[cat_title]</OPTION>\n"; } while($row = mysql_fetch_array($r)); } else { echo "<OPTION VALUE=\"0\">None</OPTION>\n"; } ?> </SELECT></TD> <?php if($myrow['forum_access'] == 1) $access1 = "SELECTED"; if($myrow['forum_access'] == 2) $access2 = "SELECTED"; if($myrow['forum_access'] == 3) $access3 = "SELECTED"; ?> </TR> <TR BGCOLOR="<?php echo $bgcolor3?>" ALIGN="LEFT"> <TD><font class="pn-title">Access Level:</font></TD> <TD BGCOLOR="<?php echo $bgcolor1?>"><SELECT NAME="forum_access"> <OPTION VALUE="2" <?php echo $access2?>>Anonymous Posting</OPTION> <OPTION VALUE="1" <?php echo $access1?>>Registered users only</OPTION> <OPTION VALUE="3" <?php echo $access3?>>Moderators/Administrators only</OPTION> </SELECT> </TD> </TR> <TR BGCOLOR="<?php echo $bgcolor3?>" ALIGN="LEFT"> <TD><font class="pn-title">Type:</FONT></TD> <TD BGCOLOR="<?php echo $bgcolor1?>"><SELECT NAME="type"> <?php if($myrow[forum_type] == 1) $priv = "SELECTED"; else $pub = "SELECTED"; ?> <OPTION VALUE="0" <?php echo $pub?>>Public</OPTION> <OPTION VALUE="1" <?php echo $priv?>>Private</OPTION> </SELECT> </TD> </TR> <?php ?> <TR BGCOLOR="<?php echo $bgcolor3?>" ALIGN="LEFT"> <TD ALIGN="CENTER" COLSPAN="2"> <INPUT TYPE="HIDDEN" NAME="forum_id" VALUE="<?php echo $forum_id?>"> <INPUT TYPE="SUBMIT" NAME="save" VALUE="Save Changes"> </TD> </TR> </TR> </form> </TABLE> <?php CloseTable(); include("footer.php"); } ?> --- NEW FILE: phpBB_14_EditForumSave.php --- <?php // $Id: phpBB_14_EditForumSave.php,v 1.1 2002/01/23 13:24:04 chv Exp $ if (!eregi("admin.php", $PHP_SELF)) { die ("Access Denied"); } if (!authorised(0, 'phpBB_14::', '::', ACCESS_ADMIN)) { die ("Access Denied"); } // $index=True; // $hlpfile = "manual/phpBB_14.html"; global $ModName; modules_get_language(); include("modules/$ModName/phpBB_14tables.php"); include("modules/$ModName/functions.php"); function phpBB_14_EditForumSave($forum_id, $forum_name, $desc, $cat, $mods, $forum_access, $type) { global $bbtable, $pntable; $forum_desc = StripSlashes(FixQuotes($desc)); $forum_name = StripSlashes(FixQuotes($forum_name)); // $forums = mysql_query("SELECT forum_id FROM $bbtable[forums] WHERE forum_cat_id = $category"); $sql = "UPDATE $bbtable[forums] SET forum_name='".$forum_name."', forum_desc='".$desc."', forum_access='".$forum_access."', cat_id='".$cat."', forum_type='".$type."' WHERE forum_id=".$forum_id.""; if(!$result = mysql_query($sql)){ error_die(_PHPBB_ERROR_CONNECT,$sql,mysql_errno(),mysql_error()); } header("Location: admin.php?op=phpBB_14"); } ?> Index: forums.php =================================================================== RCS file: /cvsroot/pn-modules/PN_phpBB_14/html/modules/phpBB_14/admin/modules/forums.php,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** forums.php 2002/01/23 09:57:49 1.5 --- forums.php 2002/01/23 13:24:04 1.6 *************** *** 11,418 **** include("modules/$ModName/functions.php"); - function AddForum() { - global $pntable, $bbtable, $bgcolor1,$bgcolor2,$bgcolor3; - include("header.php"); - GraphicAdmin($hlpfile); - opentable(); - echo "<center><a class=\"pn-pagetitle\" href=\"admin.php?op=phpBB_14\">"._PHPBB_ADMINFORUMSPANEL."</a></center>"; - closetable(); - echo "<br>"; - - $sql = "SELECT count(*) AS total FROM $bbtable[categories]"; - if(!$r = mysql_query($sql)) - { - error_die(_PHPBB_ERROR_CONNECT,$sql,mysql_errno(),mysql_error()); - } - list($total) = mysql_fetch_array($r); - if($total < 1 || !isset($total)) - error_die(_PHPBB_CAT_NOEXIST); - - ?> - <TABLE BORDER="0" CELLPADDING="1" CELLSPACING="0" ALIGN="CENTER" VALIGN="TOP" WIDTH="100%"> - <TR> - <TD BGCOLOR="<?php echo $bgcolor2?>"> - <TABLE BORDER="0" CELLPADDING="3" CELLSPACING="1" WIDTH="100%"> - <form name="createforumform" action="admin.php?op=phpBB_14_AddForumSubmit" method="post"> - <TR BGCOLOR="<?php echo $bgcolor2?>" ALIGN="LEFT"> - <TD ALIGN="CENTER" COLSPAN="2"><font class="pn-pagetitle"><?php echo _PHPBB_ADMINFORUMADD; ?></FONT></TD> - </TR> - <TR BGCOLOR="<?php echo $bgcolor3?>" ALIGN="LEFT"> - <TD><font class="pn-title">Forum Name:</FONT></TD> - <TD bgcolor="<?php echo $bgcolor1?>"><INPUT TYPE="TEXT" NAME="forum_name" SIZE="110" MAXLENGTH="150"></TD> - </TR> - <TR BGCOLOR="<?php echo $bgcolor3?>" ALIGN="LEFT"> - <TD><font class="pn-title">Forum Description:</FONT></TD> - <TD bgcolor="<?php echo $bgcolor1?>"><TEXTAREA NAME="desc" ROWS="5" COLS="90" WRAP="VIRTUAL"></TEXTAREA></TD> - </TR> - <TR BGCOLOR="<?php echo $bgcolor3?>" ALIGN="LEFT"> - <TD><font class="pn-title">Moderator:</FONT></TD> - <TD bgcolor="<?php echo $bgcolor1?>"><SELECT NAME="mods[]" size="5" multiple> - <?php - $sql = "SELECT n.uid, n.uname - FROM $pntable[users] AS n LEFT JOIN $bbtable[users] AS u ON u.user_id=n.uid - WHERE n.uid != 1 AND u.user_level != -1 - ORDER BY n.uname"; - if(!$result = mysql_query($sql)) - error_die(_PHPBB_ERROR_CONNECT,$sql,mysql_errno(),mysql_error()); - if($myrow = mysql_fetch_array($result)) { - do { - echo "<OPTION VALUE=\"".$myrow['uid']."\">".$myrow['uname']."</OPTION>\n"; - } while($myrow = mysql_fetch_array($result)); - } - else { - echo "<OPTION VALUE=\"0\">None</OPTION>\n"; - } - ?> - </SELECT></TD> - </TR> - <TR BGCOLOR="<?php echo $bgcolor3?>" ALIGN="LEFT"> - <TD><font class="pn-title">Category:</FONT></TD> - <TD bgcolor="<?php echo $bgcolor1?>"><SELECT NAME="cat"> - <?php - $sql = "SELECT * FROM $bbtable[categories] "; - if(!$result = mysql_query($sql)) - error_die(_PHPBB_ERROR_CONNECT,$sql,mysql_errno(),mysql_error()); - if($myrow = mysql_fetch_array($result)) { - do { - echo "<OPTION VALUE=\"$myrow[cat_id]\">$myrow[cat_title]</OPTION>\n"; - } while($myrow = mysql_fetch_array($result)); - } - else { - echo "<OPTION VALUE=\"0\">None</OPTION>\n"; - } - ?> - </SELECT></TD> - </TR> - <TR BGCOLOR="<?php echo $bgcolor3?>" ALIGN="LEFT"> - <TD><font class="pn-title">Access Level:</font></TD> - <TD bgcolor="<?php echo $bgcolor1?>"><SELECT NAME="forum_access"> - <OPTION VALUE="2">Anonymous Posting</OPTION> - <OPTION VALUE="1">Registered users only</OPTION> - <OPTION VALUE="3">Moderators/Administrators only</OPTION> - </SELECT> - </TD> - </TR> - <TR BGCOLOR="<?php echo $bgcolor3?>" ALIGN="LEFT"> - <TD><font class="pn-title">Type:</FONT></TD> - <TD bgcolor="<?php echo $bgcolor1?>"><SELECT NAME="type"> - <OPTION VALUE="0">Public</OPTION> - <OPTION VALUE="1">Private</OPTION> - </SELECT> - </TD> - </TR> - <TR BGCOLOR="<?php echo $bgcolor3?>" ALIGN="LEFT"> - <TD ALIGN="CENTER" COLSPAN="2"> - <INPUT TYPE="SUBMIT" NAME="submit" VALUE="Submit"> - <INPUT TYPE="SUBMIT" NAME="submit" VALUE="Submit"> - </TD> - </TR> - </table> - </TD> - </TR> - </table> - <?php - - include("footer.php"); - } - function AddForumSubmit($forum_id, $forum_name, $desc, $cat, $mods, $forum_access,$type) { - global $bbtable, $pntable, $hlpfile; - if($forum_name == '' || !is_array($mods)) - error_die(_PHPBB_CREATEFORUM_INCOMPLETE); - if (!$desc) - { - $desc = ''; - } - $desc = str_replace("\n", "<BR>", $desc); - $desc = addslashes($desc); - $forum_name = addslashes($forum_name); - // $forum_desc = StripSlashes(FixQuotes($forum_desc)); - // $forum_name = StripSlashes(FixQuotes($forum_name)); - $sql = "SELECT max(forum_order) AS highest FROM $bbtable[forums] WHERE cat_id=$cat"; - if(!$r = mysql_query($sql)) { - error_die(_PHPBB_ERROR_CONNECT,$sql,mysql_errno(),mysql_error()); - } - list($highest) = mysql_fetch_array($r); - $highest++; - $sql = "INSERT INTO $bbtable[forums] (forum_name, - forum_desc, - forum_access, - cat_id, - forum_type, - forum_order) - VALUES ('".$forum_name."', - '".$desc."', - '".$forum_access."', - '".$cat."', - '".$type."', - '".$highest."')"; - - if(!$result = mysql_query($sql)) - { - error_die(_PHPBB_ERROR_CONNECT,$sql,mysql_errno(),mysql_error()); - } - $forum = mysql_insert_id(); - $count = 0; - - while(list($mod_number, $mod) = each($mods)) { - $mod_data = phpbb14_get_userdata_from_id($mod); - - if($mod_data['user_level'] < 2) { - if(!isset($user_query)) - $user_query = "UPDATE $bbtable[users] SET user_level = 2 WHERE "; - if($count > 0) - $user_query .= "OR "; - $user_query .= "user_id = '$mod' "; - $count++; - } - $mod_query = "INSERT INTO $bbtable[forum_mods] (forum_id, user_id) VALUES ('$forum', '$mod')"; - if(!mysql_query($mod_query)) - error_die(_PHPBB_ERROR_CONNECT,$mod_query,mysql_errno(),mysql_error()); - } - if(isset($user_query)) { - if(!mysql_query($user_query)) - error_die(_PHPBB_ERROR_CONNECT,$user_query,mysql_errno(),mysql_error()); - } - - header("Location: admin.php?op=phpBB_14"); - } - - function EditForum() { - global $bbtable, $hlpfile; - include("header.php"); - GraphicAdmin($hlpfile); - opentable(); - echo "<center><a class=\"pn-pagetitle\" href=\"admin.php?op=phpBB_14\">"._PHPBB_ADMINFORUMSPANEL."</a></center>"; - closetable(); - echo "<br>"; - - OpenTable(); - echo "<center><font class=\"pn-title\">"._PBEDITFORUM."</font></center><br><br>\n"; - echo "<font class=\"pn-title\">"._PBCHOOSEFORUMEDIT."</font><br>\n"; - echo "<form name=\"editforum\" action=\"admin.php?op=phpBB_14_EditForum2\" method=\"post\">\n"; - echo "<select name=\"forum_id\">"; - $sql = "SELECT f.forum_name, f.forum_id, c.cat_title - FROM $bbtable[forums] AS f - LEFT JOIN $bbtable[categories] AS c - ON c.cat_id=f.cat_id - ORDER BY c.cat_order, - f.forum_order"; - if(!$result = mysql_query($sql)) - { - error_die(_PHPBB_ERROR_CONNECT,$sql,mysql_errno(),mysql_error()); - } - if($myrow = mysql_fetch_array($result)) { - do { - $forum_name = stripslashes($myrow[cat_title]).""._PHPBB_SEPARATOR."".stripslashes($myrow[forum_name]); - echo "<OPTION VALUE=\"$myrow[forum_id]\">$forum_name</OPTION>\n"; - } while($myrow = mysql_fetch_array($result)); - } else { - echo "<OPTION VALUE=\"-1\">No Forums in Database</OPTION>\n"; - } - echo "</select>\n"; - echo "<input type=\"submit\" name=\"submit\" value=\""._PBEDITFORUM."\"></form> \n"; - - CloseTable(); - include("footer.php"); - } - - function EditForum2($forum_id) { - global $bbtable, $hlpfile, $pntable; - include("header.php"); - GraphicAdmin($hlpfile); - opentable(); - echo "<center><a class=\"pn-pagetitle\" href=\"admin.php?op=phpBB_14\">"._PHPBB_ADMINFORUMSPANEL."</a></center>"; - closetable(); - echo "<br>"; - OpenTable(); - echo "<center><font class=\"pn-title\">"._PHPBB_EDITFORUM."</font></center>"; - - //get the forum info from the id - // $forumresult = mysql_query("SELECT forum_name, forum_desc, forum_readaccess, forum_cat_id, forum_writeaccess FROM $pntablemod[forums] WHERE forum_id = $forum_id"); - // list($forum_name, $forum_desc, $forum_readaccess, $forum_cat_id, $forum_writeaccess) = mysql_fetch_row($forumresult); - - //form for adding forum information - echo "<form name=\"editforumform\" action=\"admin.php?op=phpBB_14_EditForumSubmit\" method=\"post\">"; - - $sql = "SELECT * FROM $bbtable[forums] WHERE forum_id = '$forum_id'"; - if(!$result = mysql_query($sql)) - error_die(_PHPBB_ERROR_CONNECT,$sql,mysql_errno(),mysql_error()); - if(!$myrow = mysql_fetch_array($result)) { - error_die( "No such forum"); - } - $forum_name = stripslashes($myrow['forum_name']); - $desc = stripslashes($myrow['forum_desc']); - - ?> - <TABLE BORDER="0" CELLPADDING="3" CELLSPACING="1" WIDTH="100%"> - <TR BGCOLOR="<?php echo $bgcolor2?>" ALIGN="LEFT"> - <TD ALIGN="left" COLSPAN="2"> - <font class="pn-normal"><B> - <a href="admin.php?op=phpBB_14_DeleteForum&forum_id=<?php echo $forum_id;?>&ok=0"><?php echo _PBDELETEFORUM."(This will also remove all posts in this forum!)"; ?></a> - </FONT></TD> - </TR> - <TR BGCOLOR="<?php echo $bgcolor3?>" ALIGN="LEFT"> - <TD><font class="pn-title">Forum Name:</FONT></TD> - <TD BGCOLOR="<?php echo $bgcolor1?>"><INPUT TYPE="TEXT" NAME="forum_name" SIZE="100" MAXLENGTH="150" VALUE="<?php echo $forum_name?>"></TD> - </TR> - <TR BGCOLOR="<?php echo $bgcolor3?>" ALIGN="LEFT"> - <TD><font class="pn-title">Forum Description:</FONT></TD> - <TD BGCOLOR="<?php echo $bgcolor1?>"><TEXTAREA NAME="desc" ROWS="5" COLS="85" WRAP="soft"><?php echo $desc?></TEXTAREA></TD> - </TR> - <TR BGCOLOR="<?php echo $bgcolor3?>" ALIGN="LEFT"> - <TD valign="top"><font class="pn-title">Moderator(s):</FONT></TD> - <TD BGCOLOR="<?php echo $bgcolor1?>"><b>Current:</b><BR> - <?php - $sql = "SELECT u.uname, u.uid FROM $pntable[users] u, $bbtable[forum_mods] f WHERE f.forum_id = '$forum' AND u.uid = f.user_id"; - if(!$r = mysql_query($sql)) - error_die(_PHPBB_ERROR_CONNECT,$sql,mysql_errno(),mysql_error()); - if($row = mysql_fetch_array($r)) { - do { - echo $row['uname']." (<input type=\"checkbox\" name=\"rem_mods[]\" value=\"$row[uid]\"> Remove)<BR>"; - $current_mods[] = $row['uid']; - } while($row = mysql_fetch_array($r)); - echo "<BR>"; - } - else { - echo "No Moderators Assigned<BR><BR>\n"; - } - ?> - <b>Add:</b><BR> - <SELECT NAME="mods[]" size="5" multiple> - <?php - $sql = "SELECT n.uid, n.uname FROM $pntable[users] AS n LEFT JOIN $bbtable[users] AS u ON u.user_id=n.uid WHERE n.uid != 1 AND u.user_level != -1 "; - while(list($null, $currMod) = each($current_mods)) { - $sql .= "AND n.uid != $currMod "; - } - $sql .= "ORDER BY uname"; - if(!$r = mysql_query($sql)) - error_die(_PHPBB_ERROR_CONNECT,$sql,mysql_errno(),mysql_error()); - if($row = mysql_fetch_array($r)) { - do { - $s = ""; - if($row[uid] == $myrow[forum_moderator]) - $s = "SELECTED"; - echo "<OPTION VALUE=\"$row[uid]\" $s>$row[uname]</OPTION>\n"; - } while($row = mysql_fetch_array($r)); - } - else { - echo "<OPTION VALUE=\"0\">None</OPTION>\n"; - } - ?> - </SELECT></TD> - </TR> - <TR BGCOLOR="<?php echo $bgcolor3?>" ALIGN="LEFT"> - <TD><font class="pn-title">Category:</FONT></TD> - <TD BGCOLOR="<?php echo $bgcolor1?>"><SELECT NAME="cat"> - <?php - $sql = "SELECT * FROM $bbtable[categories] "; - if(!$r = mysql_query($sql)) - error_die(_PHPBB_ERROR_CONNECT,$sql,mysql_errno(),mysql_error()); - if($row = mysql_fetch_array($r)) { - do { - $s = ""; - if($row[cat_id] == $myrow[cat_id]) - $s = "SELECTED"; - echo "<OPTION VALUE=\"$row[cat_id]\" $s>$row[cat_title]</OPTION>\n"; - } while($row = mysql_fetch_array($r)); - } - else { - echo "<OPTION VALUE=\"0\">None</OPTION>\n"; - } - ?> - </SELECT></TD> - <?php - if($myrow['forum_access'] == 1) - $access1 = "SELECTED"; - if($myrow['forum_access'] == 2) - $access2 = "SELECTED"; - if($myrow['forum_access'] == 3) - $access3 = "SELECTED"; - ?> - </TR> - <TR BGCOLOR="<?php echo $bgcolor3?>" ALIGN="LEFT"> - <TD><font class="pn-title">Access Level:</font></TD> - <TD BGCOLOR="<?php echo $bgcolor1?>"><SELECT NAME="forum_access"> - <OPTION VALUE="2" <?php echo $access2?>>Anonymous Posting</OPTION> - <OPTION VALUE="1" <?php echo $access1?>>Registered users only</OPTION> - <OPTION VALUE="3" <?php echo $access3?>>Moderators/Administrators only</OPTION> - </SELECT> - </TD> - </TR> - - - <TR BGCOLOR="<?php echo $bgcolor3?>" ALIGN="LEFT"> - <TD><font class="pn-title">Type:</FONT></TD> - <TD BGCOLOR="<?php echo $bgcolor1?>"><SELECT NAME="type"> - <?php - if($myrow[forum_type] == 1) - $priv = "SELECTED"; - else - $pub = "SELECTED"; - ?> - <OPTION VALUE="0" <?php echo $pub?>>Public</OPTION> - <OPTION VALUE="1" <?php echo $priv?>>Private</OPTION> - </SELECT> - </TD> - </TR> - <?php - - ?> - <TR BGCOLOR="<?php echo $bgcolor3?>" ALIGN="LEFT"> - <TD ALIGN="CENTER" COLSPAN="2"> - <INPUT TYPE="HIDDEN" NAME="forum_id" VALUE="<?php echo $forum_id?>"> - <INPUT TYPE="SUBMIT" NAME="save" VALUE="Save Changes"> - </TD> - </TR> - </TR> - </form> - - </TABLE> - <?php - - CloseTable(); - include("footer.php"); - } - - function DeleteForum($forum_id, $ok) { - global $bbtable, $pntable, $hlpfile; - if($ok=="1") { - mysql_query("DELETE FROM $bbtable[forums] WHERE forum_id = $forum_id"); - $result = mysql_query("SELECT post_id FROM $bbtable[posts] WHERE forum_id = $forum_id"); - while(list($post_id) = mysql_fetch_row($result)) { - mysql_query("DELETE FROM $bbtable[posts_text] WHERE post_id = $post_id"); - mysql_query("DELETE FROM $bbtable[posts] WHERE post_id = $post_id"); - } - header("Location: admin.php?op=phpBB_14_SyncForums"); - } else { - include("header.php"); - GraphicAdmin($hlpfile); - opentable(); - echo "<center><a class=\"pn-pagetitle\" href=\"admin.php?op=phpBB_14\">"._PHPBB_ADMINFORUMSPANEL."</a></center>"; - closetable(); - echo "<br>"; - OpenTable(); - echo ""._PBOKTODELETE."<br>\n"; - echo "<a class=\"pn-normal\" href=\"admin.php?op=phpBB_14_DeleteForum&forum_id=$forum_id&ok=1\">"._YES."</a> <a class=\"pn-normal\" href=\"admin.php?op=pncontent\">"._NO."</a>\n"; - CloseTable(); - include("footer.php"); - } - } - - function EditForumSubmit($forum_id, $forum_name, $desc, $cat, $forum_access, $type) { - global $bbtable, $pntable; - $forum_desc = StripSlashes(FixQuotes($desc)); - $forum_name = StripSlashes(FixQuotes($name)); - $forums = mysql_query("SELECT forum_id FROM $bbtable[forums] WHERE forum_cat_id = $category"); - mysql_query("UPDATE $bbtable[forums] - SET forum_name='$forum_name', - forum_desc='$desc', - forum_readaccess='$forum_access', - forum_cat_id='$cat', - forum_type='$type' - WHERE forum_id=$forum_id"); - header("Location: admin.php?op=phpBB_14"); - } function PBAddMods() { --- 11,15 ---- |