[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Phpgroupware-cvs] forum preference_index.php, 1.4.4.1 preference_forum.
From: |
skwashd |
Subject: |
[Phpgroupware-cvs] forum preference_index.php, 1.4.4.1 preference_forum.php, 1.4.4.1 preference_category.php, 1.4.4.1 preference_deletecategory.php, 1.4.4.1 preference_deleteforum.php, 1.4.4.1 index.php, 1.25.2.1.2.1 |
Date: |
Thu, 2 Jun 2005 14:51:00 +0200 |
Update of forum
Modified Files:
Branch: Version-0_9_16-branch
preference_index.php lines: +106 -87
preference_forum.php lines: +175 -139
preference_category.php lines: +140 -120
preference_deletecategory.php lines: +59 -53
preference_deleteforum.php lines: +58 -50
index.php lines: +3 -3
Log Message:
major clean up and buf fixing
====================================================
Index: forum/preference_index.php
diff -u forum/preference_index.php:1.4 forum/preference_index.php:1.4.4.1
--- forum/preference_index.php:1.4 Sat Jul 14 01:44:06 2001
+++ forum/preference_index.php Thu Jun 2 12:51:27 2005
@@ -12,99 +12,118 @@
/* $Id$ */
- $phpgw_info["flags"] = array("currentapp" => "forum",
"enable_nextmatchs_class" => True);
- include("../header.inc.php");
+ $GLOBALS['phpgw_info']['flags'] = array(
+ 'currentapp' =>
'forum',
+ 'enable_nextmatchs_class' =>
True
+ );
+ include_once('../header.inc.php');
?>
-<p>
-<table border="0" width=100%>
-<tr>
-<?php echo "<td bgcolor=\"" . $phpgw_info["theme"]["th_bg"] . "\"
align=\"left\"><b>" . lang("Forums") . " " . lang("Admin") . "</b></td>" .
"</tr>"; ?>
-
-<tr>
- <td>
- <font size=-1>
-<?php
-echo "<a href=\"" . $phpgw->link("/forum/preference_category.php") . "\">" .
lang("New Category") ."</a>";
-echo " | ";
-echo "<a href=\"" . $phpgw->link("/forum/preference_forum.php") . "\">" .
lang("New Forum") ."</a>";
-echo " | ";
-echo "<a href=\"" . $phpgw->link("/forum") . "\">" . lang("Return to Forums")
."</a>";
-
+ <p>
+ <table border="0" width=100%>
+ <tr>
+<?php
+ echo "<td bgcolor=\"" . $phpgw_info["theme"]["th_bg"] . "\"
align=\"left\"><b>" . lang("Forums") . " " . lang("Admin") . "</b></td>" .
"</tr>";
?>
- </font>
- <br><br>
- <center>
- <table border="0" width=80% bgcolor="<?php echo
$phpgw_info["theme"]["table_bg"]?>">
- <tr>
- <td colspan=3 bgcolor="<?php echo $phpgw_info["theme"]["th_bg"]?>">
- <center><?php echo lang("Current Categories and Sub Forums")?></center>
- </td>
- </tr>
- <tr>
- <td>
- </td>
- </tr>
+
+ <tr>
+ <td>
+ <font size=-1>
<?php
- $f_tree = array();
- $phpgw->db->query("select * from f_categories");
- while($phpgw->db->next_record()) {
- $f_tree[$phpgw->db->f("id")] = array("name"=>$phpgw->db->f("name"),
"descr"=>$phpgw->db->f("descr"), "forums"=>array());
- }
- $phpgw->db->query("select * from f_forums");
- while($phpgw->db->next_record()) {
- $f_tree[$phpgw->db->f("cat_id")]["forums"][$phpgw->db->f("id")] =
array("name"=>$phpgw->db->f("name"), "descr"=>$phpgw->db->f("descr"));
- }
- ksort($f_tree);
- for(reset($f_tree);$id=key($f_tree);next($f_tree)) {
- if($id > 0) {
- echo "<tr><td></td></tr>";
- echo "<tr bgcolor=\"" . $phpgw_info["theme"]["bg06"] . "\">\n";
- echo " <td valign=top align=left width=20%>" . $f_tree[$id]["name"] .
"</td>\n";
- echo " <td valign=top align=left width=70%>" . $f_tree[$id]["descr"] .
"</td>\n";
- echo " <td nowrap><a href=\"" .
$phpgw->link("/forum/preference_category.php","act=edit&cat_id=$id") ."\">" .
lang("Edit") . "</A> | ";
- echo "<A href=\"" . $phpgw->link("/forum/preference_deletecategory.php",
"cat_id=$id") . "\">" . lang("Delete") . "</A></td>\n";
- echo "</tr>\n";
- echo "<tr>\n";
- echo " <td colspan=3 align=right valign=top>\n";
- echo "<table border=0 width=95%>\n";
- } else {
- echo "<tr>\n";
- echo " <td colspan=3 align=right valign=top>\n";
- echo "<table border=0 width=100%>\n";
- }
-
- $tr_color = $phpgw_info["theme"]["row_off"];
-
- for(reset($f_tree[$id]["forums"]); $fid=key($f_tree[$id]["forums"]);
next($f_tree[$id]["forums"])) {
- $tr_color = $phpgw->nextmatchs->alternate_row_color($tr_color);
- echo " <tr bgcolor=\"$tr_color\">\n";
- echo " <td width=20%>" . $f_tree[$id]["forums"][$fid]["name"] .
"</td>\n";
- echo " <td valign=top align=left width=70%>".
$f_tree[$id]["forums"][$fid]["descr"] . "</td>\n";
- echo " <td nowrap><a href=\"" .
$phpgw->link("/forum/preference_forum.php","act=edit&for_id=$fid") ."\">" .
lang("Edit") . "</A> | ";
- echo "<A href=\"" . $phpgw->link("/forum/preference_deleteforum.php",
"for_id=$fid") . "\">" . lang("Delete") . "</A></td>\n";
- echo " </tr>\n";
- }
- echo " </table>\n";
- echo " </td>\n";
- echo "</tr>\n";
- }
+ echo "<a href=\"" .
$GLOBALS['phpgw']->link("/forum/preference_category.php") . "\">" . lang("New
Category") ."</a>";
+ echo " | ";
+ echo "<a href=\"" .
$GLOBALS['phpgw']->link("/forum/preference_forum.php") . "\">" . lang("New
Forum") ."</a>";
+ echo " | ";
+ echo "<a href=\"" . $GLOBALS['phpgw']->link('/forum/index.php') . "\">"
. lang("Return to Forums") ."</a>";
?>
- </td>
- </tr>
- </table>
- <br>
-
-
- <br><br>
- </center>
- </td>
-</tr>
-</table>
+ </font>
+ <br><br>
+ <center>
+ <table border="0" width=80% bgcolor="<?php echo
$phpgw_info["theme"]["table_bg"]?>">
+ <tr>
+ <td colspan=3 bgcolor="<?php echo $phpgw_info["theme"]["th_bg"]?>">
+ <center><?php echo lang("Current Categories and Sub Forums")?></center>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ </td>
+ </tr>
+<?php
+ $f_tree = array();
+ $GLOBALS['phpgw']->db->query('SELECT * FROM f_categories', __LINE__,
__FILE__);
+ while($GLOBALS['phpgw']->db->next_record())
+ {
+ $f_tree[$GLOBALS['phpgw']->db->f('id')] = array(
+ 'name' =>
$GLOBALS['phpgw']->db->f('name'),
+ 'descr' =>
$GLOBALS['phpgw']->db->f('descr'),
+ 'forums'=>
array()
+ );
+ }
+ $GLOBALS['phpgw']->db->query('SELECT * FROM f_forums', __LINE__,
__FILE__);
+ while($GLOBALS['phpgw']->db->next_record())
+ {
+
$f_tree[$GLOBALS['phpgw']->db->f('cat_id')]['forums'][$GLOBALS['phpgw']->db->f('id')]
= array(
+
'name' => $GLOBALS['phpgw']->db->f('name'),
+
'descr' => $GLOBALS['phpgw']->db->f('descr')
+
);
+ }
+ $id = intval($_REQUEST['id']);
+ ksort($f_tree);
+ foreach ( $f_tree as $ft )
+ {
+ if($id > 0)
+ {
+ echo "<tr><td></td></tr>";
+ echo "<tr bgcolor=\"" . $phpgw_info["theme"]["bg06"] .
"\">\n";
+ echo " <td valign=top align=left width=20%>" .
$ft['name'] . "</td>\n";
+ echo " <td valign=top align=left width=70%>" .
$ft['descr'] . "</td>\n";
+ echo " <td nowrap><a href=\"" .
$GLOBALS['phpgw']->link('/forum/preference_category.php', array('act' =>
'edit', 'cat_id' => $id)) ."\">" . lang("Edit") . "</a> | ";
+ echo "<a href=\"" .
$GLOBALS['phpgw']->link('/forum/preference_deletecategory.php', array('cat_id'
=> $id)) . "\">" . lang("Delete") . "</a></td>\n";
+ echo "</tr>\n";
+ echo "<tr>\n";
+ echo " <td colspan=3 align=right valign=top>\n";
+ echo "<table border=0 width=95%>\n";
+ }
+ else
+ {
+ echo "<tr>\n";
+ echo " <td colspan=3 align=right valign=top>\n";
+ echo "<table border=0 width=100%>\n";
+ }
+
+ $tr_color = $phpgw_info["theme"]["row_off"];
+
+ foreach ( $f_tree[$id]["forums"] as $fid => $forum )
+ {
+ $tr_color =
$GLOBALS['phpgw']->nextmatchs->alternate_row_color($tr_color);
+ echo " <tr bgcolor=\"$tr_color\">\n";
+ echo " <td width=20%>" . $forum['name'] . "</td>\n";
+ echo " <td valign=top align=left width=70%>".
$forum['descr'] . "</td>\n";
+ echo " <td nowrap><a href=\"" .
$GLOBALS['phpgw']->link("/forum/preference_forum.php","act=edit&for_id=$fid")
."\">" . lang("Edit") . "</A> | ";
+ echo "<A href=\"" .
$GLOBALS['phpgw']->link('/forum/preference_deleteforum.php', array('for_id' =>
$fid) ) . "\">" . lang("Delete") . "</A></td>\n";
+ echo " </tr>\n";
+ }
+ echo " </table>\n";
+ echo " </td>\n";
+ echo "</tr>\n";
+ }
+ ?>
+ </td>
+ </tr>
+ </table>
+ <br>
+
+
+ <br><br>
+ </center>
+ </td>
+ </tr>
+ </table>
<?php
-echo "</center>";
- $phpgw->common->phpgw_footer();
+ echo "</center>";
+ $GLOBALS['phpgw']->common->phpgw_footer();
?>
====================================================
Index: forum/preference_forum.php
diff -u forum/preference_forum.php:1.4 forum/preference_forum.php:1.4.4.1
--- forum/preference_forum.php:1.4 Sat Jul 14 01:44:06 2001
+++ forum/preference_forum.php Thu Jun 2 12:51:27 2005
@@ -12,145 +12,181 @@
/* $Id$ */
- $phpgw_info["flags"] = array("currentapp" => "forum",
"enable_nextmatchs_class" => True);
- if($action) {
- $phpgw_info["flags"]["noheader"] = True;
- $phpgw_info["flags"]["nonavbar"] = True;
- }
- include("../header.inc.php");
-
- $actiontype = "addforum";
- $buttontext = lang("Add Forum");
-
- if($act == "edit") {
- if(!$phpgw->db->query("select * from f_forums where id=$for_id")) {
- print "Error in reading database<br>\n";
- $phpgw->common->phpgw_exit();
- } else {
- $phpgw->db->next_record();
- $forname = $phpgw->db->f("name");
- $fordescr = $phpgw->db->f("descr");
- $cat_id = $phpgw->db->f("cat_id");
- if ($cat_id > 0) {
- if(!$phpgw->db->query("select * from f_categories where id=$cat_id")) {
- print "Error in readindg database<br>\n";
- $phpgw->common->phpgw_exit();
- } else $phpgw->db->next_record();
- $catname = $phpgw->db->f("name");
- } else $catname = lang("No Category");
- $extrahidden = "<input type=\"hidden\" name=\"for_id\"
value=\"$for_id\">";
- $buttontext = lang("Update Forum");
- $actiontype = "updforum";
- }
- }
-
-
- if($action) {
- if($action == "addforum") {
- if(!$phpgw->db->query("insert into f_forums (name,descr,cat_id) values
('$forname','$fordescr',$goestocat)")) {
- print "Error in adding forum to database<br>\n";
- $phpgw->common->phpgw_exit();
- } else {
- Header("Location: " . $phpgw->link("/forum/preference_index.php"));
- $phpgw->common->phpgw_exit();
- }
- } elseif ($action == "updforum" && $for_id) {
- if(!$phpgw->db->query("update f_forums set
name='$forname',descr='$fordescr',cat_id=$goestocat where id=$for_id ")) {
- print "Error in updating forum on database<br>\n";
- $phpgw->common->phpgw_exit();
- } else {
- Header("Location: " . $phpgw->link("/forum/preference_index.php"));
- $phpgw->common->phpgw_exit();
- }
- }
- }
-
-
-
-?>
-
-<p>
-<table border="0" width=100%>
-<tr>
-<?php echo "<td bgcolor=\"" . $phpgw_info["theme"]["th_bg"] . "\"
align=\"left\"><b>" . lang("Forums") . " " . lang("Admin") . "</b></td>" .
"</tr>"; ?>
-
-<tr>
- <td>
- <font size=-1>
-<?php
-echo "<a href=\"" . $phpgw->link("/forum/preference_category.php") . "\">" .
lang("New Category") ."</a>";
-echo " | ";
-echo "<a href=\"" . $phpgw->link("/forum/preference_forum.php") . "\">" .
lang("New Forum") ."</a>";
-echo " | ";
-echo "<a href=\"" . $phpgw->link("/forum/preference_index.php") . "\">" .
lang("Return to Admin") ."</a>";
-echo " | ";
-echo "<a href=\"" . $phpgw->link("/forum") . "\">" . lang("Return to Forums")
."</a>";
-
-?>
- </font>
- <br><br>
- <center>
- <table border="0" width=80% bgcolor="<?php echo
$phpgw_info["theme"]["table_bg"]?>">
- <tr>
- <td colspan=2 bgcolor="<?php echo $phpgw_info["theme"]["th_bg"]?>">
- <center><?php echo $buttontext ?></center>
- </td>
- </tr>
- <tr>
- <form method="POST" action="<?php echo
$phpgw->link("/forum/preference_forum.php"); ?>">
- <?php echo $extrahidden ?>
- <input type="hidden" name="action" value="<?php echo $actiontype?>">
-
- <td><?php echo lang("Belongs to Category") ?>:</td>
- <td>
- <select name="goestocat">
-<?php
- $q = $phpgw->db->query("select * from f_categories");
-
- while($phpgw->db->next_record($q)) {
- $cat_id = $phpgw->db->f("id");
- $cat_name = $phpgw->db->f("name");
- if ($catname==$cat_name) { echo "<option value=\"$cat_id\"
selected>$cat_name</option>\n"; }
- else { echo "<option value=\"$cat_id\">$cat_name</option>\n"; }
- }
-?>
- <option value=-1><?php echo lang("No Category") ?></option>
- </select>
- </td>
- <tr>
- <td><?php echo lang("Forum Name") ?>:</td>
- <td><input type="text" name="forname" size=40 maxlength=49 value="<?php
echo $forname ?>"></td>
- </tr>
- <tr>
- <td><?php echo lang("Forum Description") ?>:</td>
- <td><textarea rows="3" cols="40" name="fordescr" virtual-wrap
maxlength=240><?php echo $fordescr ?></textarea></td>
- </tr>
- <tr>
- <td colspan=2 align=right>
-
- <input type="submit" value="<?php echo $buttontext?>">
- </td>
- </tr>
-
- </table>
- </center>
- <br>
- </td>
-</tr>
-
- </tr>
- </table>
- </center>
- <br>
-
-
-
-
- </td>
-</tr>
-</table>
+ $GLOBALS['phpgw_info']['flags'] = array(
+ 'currentapp' =>
'forum',
+ 'enable_nextmatchs_class' =>
True
+ );
+ if($action) {
+ $phpgw_info["flags"]["noheader"] = True;
+ $phpgw_info["flags"]["nonavbar"] = True;
+ }
+ include_once('../header.inc.php');
+
+ $actiontype = 'addforum';
+ $buttontext = lang('Add Forum');
+ $for_id = intval($_REQUEST['for_id']);
+ $cat_id = intval($_REQUEST['cat_id']);
+
+ if($_REQUEST['act'] == "edit")
+ {
+ $GLOBALS['phpgw']->db->query('SELECT * FROM f_forums WHERE id =
' . intval($for_id), __LINE__, __FILE__ );
+ if( !$GLOBALS['phpgw']->db->next_record() )
+ {
+ print "Error in reading database<br>\n";
+ $GLOBALS['phpgw']->common->phpgw_exit();
+ }
+ else
+ {
+ $forname = $GLOBALS['phpgw']->db->f("name");
+ $fordescr = $GLOBALS['phpgw']->db->f("descr");
+ $cat_id = $GLOBALS['phpgw']->db->f("cat_id");
+ if ($cat_id > 0)
+ {
+ $GLOBALS['phpgw']->db->query("SELECT * FROM
f_categories WHERE id = $cat_id", __LINE__, __FILE__);
+ if( !$GLOBALS['phpgw']->db->next_record() )
+ {
+ print "Error in readindg
database<br>\n";
+ $GLOBALS['phpgw']->common->phpgw_exit();
+ }
+
+ $catname = $GLOBALS['phpgw']->db->f('name');
+ }
+ else
+ {
+ $catname = lang('No Category');
+ }
+ $extrahidden = "<input type=\"hidden\" name=\"for_id\"
value=\"$for_id\">";
+ $buttontext = lang("Update Forum");
+ $actiontype = "updforum";
+ }
+ }
+
+
+ if($action)
+ {
+ if ( $_REQUEST['action'] == "addforum")
+ {
+ $db_resp = $GLOBALS['phpgw']->db->query("INSERT INTO
f_forums(name,descr,cat_id) VALUES ('"
+ .
$GLOBALS['phpgw']->db->db_addslashes($_REQUEST['forname']) . "','"
+ .
$GLOBALS['phpgw']->db->db_addslashes($_REQUEST['$fordescr']) . "',"
+ . intval($_REQUEST['goestocat']),
__LINE__, __FILE__);
+ if ( !$db_resp )
+ {
+ echo "Error in adding forum to database<br>\n";
+ $GLOBALS['phpgw']->common->phpgw_exit();
+ }
+ else
+ {
+
$GLOBALS['phpgw']->redirect_link('/forum/preference_index.php');
+ $GLOBALS['phpgw']->common->phpgw_exit();
+ }
+ }
+ elseif ( $_REQUEST['action'] == "updforum" && $for_id)
+ {
+ $db_resp = $GLOBALS['phpgw']->db->query('UPDATE
f_forums'
+ . " SET name = '" .
$GLOBALS['phpgw']->db->db_addslashes($_REQUEST['forname']) . "',"
+ . " descr = '" .
$GLOBALS['phpgw']->db->db_addslashes($_REQUEST['fordescr']) . "',"
+ . ' cat_id = ' .
intval($_REQUEST['goestocat'])
+ . ' WHERE id=$for_id', __LINE__,
__FILE__);
+ if ( !$db_resp )
+ {
+ print "Error in updating forum on
database<br>\n";
+ $GLOBALS['phpgw']->common->phpgw_exit();
+ }
+ else
+ {
+
$GLOBALS['phpgw']->redirect_link('/forum/preference_index.php');
+ $GLOBALS['phpgw']->common->phpgw_exit();
+ }
+ }
+ }
+
+
+
+ ?>
+
+ <p>
+ <table border="0" width=100%>
+ <tr>
+ <?php echo "<td bgcolor=\"" . $phpgw_info["theme"]["th_bg"] . "\"
align=\"left\"><b>" . lang("Forums") . " " . lang("Admin") . "</b></td>" .
"</tr>"; ?>
+
+ <tr>
+ <td>
+ <font size=-1>
+ <?php
+ echo "<a href=\"" .
$GLOBALS['phpgw']->link("/forum/preference_category.php") . "\">" . lang("New
Category") ."</a>";
+ echo " | ";
+ echo "<a href=\"" .
$GLOBALS['phpgw']->link("/forum/preference_forum.php") . "\">" . lang("New
Forum") ."</a>";
+ echo " | ";
+ echo "<a href=\"" .
$GLOBALS['phpgw']->link("/forum/preference_index.php") . "\">" . lang("Return
to Admin") ."</a>";
+ echo " | ";
+ echo "<a href=\"" . $GLOBALS['phpgw']->link("/forum") . "\">" .
lang("Return to Forums") ."</a>";
+
+ ?>
+ </font>
+ <br><br>
+ <center>
+ <table border="0" width=80% bgcolor="<?php echo
$phpgw_info["theme"]["table_bg"]?>">
+ <tr>
+ <td colspan=2 bgcolor="<?php echo $phpgw_info["theme"]["th_bg"]?>">
+ <center><?php echo $buttontext ?></center>
+ </td>
+ </tr>
+ <tr>
+ <form method="POST" action="<?php echo
$GLOBALS['phpgw']->link("/forum/preference_forum.php"); ?>">
+ <?php echo $extrahidden ?>
+ <input type="hidden" name="action" value="<?php echo $actiontype?>">
+
+ <td><?php echo lang("Belongs to Category") ?>:</td>
+ <td>
+ <select name="goestocat">
+ <?php
+ $q = $GLOBALS['phpgw']->db->query("select * from f_categories");
+
+ while($GLOBALS['phpgw']->db->next_record($q)) {
+ $cat_id = $GLOBALS['phpgw']->db->f("id");
+ $cat_name = $GLOBALS['phpgw']->db->f("name");
+ if ($catname==$cat_name) { echo "<option value=\"$cat_id\"
selected>$cat_name</option>\n"; }
+ else { echo "<option value=\"$cat_id\">$cat_name</option>\n"; }
+ }
+ ?>
+ <option value=-1><?php echo lang("No Category") ?></option>
+ </select>
+ </td>
+ <tr>
+ <td><?php echo lang("Forum Name") ?>:</td>
+ <td><input type="text" name="forname" size=40 maxlength=49
value="<?php echo $forname ?>"></td>
+ </tr>
+ <tr>
+ <td><?php echo lang("Forum Description") ?>:</td>
+ <td><textarea rows="3" cols="40" name="fordescr" virtual-wrap
maxlength=240><?php echo $fordescr ?></textarea></td>
+ </tr>
+ <tr>
+ <td colspan=2 align=right>
+
+ <input type="submit" value="<?php echo $buttontext?>">
+ </td>
+ </tr>
+
+ </table>
+ </center>
+ <br>
+ </td>
+ </tr>
+
+ </tr>
+ </table>
+ </center>
+ <br>
+
+
+
+
+ </td>
+ </tr>
+ </table>
<?php
- $phpgw->common->phpgw_footer();
+ $GLOBALS['phpgw']->common->phpgw_footer();
?>
====================================================
Index: forum/preference_category.php
diff -u forum/preference_category.php:1.4 forum/preference_category.php:1.4.4.1
--- forum/preference_category.php:1.4 Sat Jul 14 01:44:06 2001
+++ forum/preference_category.php Thu Jun 2 12:51:27 2005
@@ -1,130 +1,150 @@
<?php
-
/*****************************************************************************\
- * phpGroupWare - Forums
*
- * http://www.phpgroupware.org
*
- * Written by Jani Hirvinen <address@hidden>
*
- * -------------------------------------------
*
- * This program is free software; you can redistribute it and/or
modify it *
- * under the terms of the GNU General Public License as published by
the *
- * Free Software Foundation; either version 2 of the License, or (at
your *
- * option) any later version.
*
-
\*****************************************************************************/
-
- /* $Id$ */
-
- $phpgw_info["flags"]["currentapp"] = "forum";
- if($action) {
- $phpgw_info["flags"]["noheader"] = True;
- $phpgw_info["flags"]["nonavbar"] = True;
- }
- include("../header.inc.php");
-
- $actiontype = "addcat";
- $buttontext = lang("Add Category");
- $extrahidden = "";
-
- if($act == "edit") {
- $newold = lang("Update Category");
- if(!$phpgw->db->query("select * from f_categories where id=$cat_id")) {
- print "Error in reading database<br>\n";
- $phpgw->common->phpgw_exit();
- } else {
- $phpgw->db->next_record();
- $catname = $phpgw->db->f("name");
- $catdescr = $phpgw->db->f("descr");
- $cat_id = $phpgw->db->f("id");
-
- $extrahidden = "<input type=\"hidden\" name=\"cat_id\"
value=\"$cat_id\">";
- $buttontext = lang("Update Category");
- $actiontype = "updcat";
- }
- } else {
- $newold = lang("Create New Category");
- }
-
- if($action) {
- if($action == "addcat") {
- if(!$phpgw->db->query("insert into f_categories (name,descr) values
('$catname','$catdescr')")) {
- print "Error in adding forum to database<br>\n";
- $phpgw->common->phpgw_exit();
- } else {
- Header("Location: " . $phpgw->link("/forum"));
- $phpgw->common->phpgw_exit();
- }
- } elseif ($action == "updcat" && $cat_id) {
- if(!$phpgw->db->query("update f_categories set
name='$catname',descr='$catdescr' where id = $cat_id")) {
- print "Error in adding forum to database<br>\n";
- $phpgw->common->phpgw_exit();
- } else {
- Header("Location: " . $phpgw->link("/forum"));
- $phpgw->common->phpgw_exit();
- }
-
- }
- }
-
+/*****************************************************************************\
+ * phpGroupWare - Forums
*
+ * http://www.phpgroupware.org
*
+ * Written by Jani Hirvinen <address@hidden> *
+ * -------------------------------------------
*
+ * This program is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU General Public License as published by the *
+ * Free Software Foundation; either version 2 of the License, or (at your *
+ * option) any later version.
*
+
\*****************************************************************************/
+
+/* $Id$ */
+
+ $GLOBALS['phpgw_info'] = array();
+ $GLOBALS['phpgw_info']['flags'] = array();
+ $GLOBALS['phpgw_info']['flags']['currentapp'] = 'forum';
+ if($_REQUEST['action'])
+ {
+ $GLOBALS['phpgw_info']['flags']['noheader'] = True;
+ $GLOBALS['phpgw_info']['flags']['nonavbar'] = True;
+ }
+ include_once('../header.inc.php');
+
+ $actiontype = 'addcat';
+ $buttontext = lang('Add Category');
+ $extrahidden = '';
+ $db =& $GLOBALS['phpgw']->db;
+ $cat_id = intval($_REQUEST['cat_id']);
+
+ if($_REQUEST['act'] == 'edit')
+ {
+ $newold = lang('Update Category');
+ $db->query("SELECT * FROM f_categories WHERE id = $cat_id",
__LINE__, __FILE__);
+ if( !$db->next_record() )
+ {
+ print "Error in reading database<br>\n";
+ $GLOBALS['phpgw']->common->phpgw_exit();
+ }
+ else
+ {
+ $catname = $db->f('name');
+ $catdescr = $db->f('descr');
+ $cat_id = $db->f('id');
+
+ $extrahidden = "<input type=\"hidden\" name=\"cat_id\"
value=\"$cat_id\">";
+ $buttontext = lang("Update Category");
+ $actiontype = "updcat";
+ }
+ }
+ else
+ {
+ $newold = lang('Create New Category');
+ }
+
+ if($_REQUEST['action'])
+ {
+ if($_REQUEST['action'] == 'addcat')
+ {
+ if(!$db->query("INSERT INTO f_categories(name, descr)
VALUES('"
+ . $db->db_addslashes($catname) . "', '"
. $db->db_addslashes($catdescr) . "')")) {
+ print "Error in adding forum to database<br>\n";
+ $GLOBALS['phpgw']->common->phpgw_exit();
+ }
+ else
+ {
+
$GLOBALS['phpgw']->redirect_link('/forum/index.php');
+ $GLOBALS['phpgw']->common->phpgw_exit();
+ }
+ }
+ elseif ($_REQUEST['action'] == 'updcat' && $cat_id)
+ {
+ if(!$db->query("UPDATE f_categories SET name = '" .
$db->db_addslashes($_REQUEST['catname'])
+ . "', descr = '" .
$db->db_addslashes($_REQUEST['catdescr']) . "' WHERE id = $cat_id"))
+ {
+ echo "Error in adding forum to database<br>\n";
+ $GLOBALS['phpgw']->common->phpgw_exit();
+ }
+ else
+ {
+
$GLOBALS['phpgw']->redirect_link('/forum/index.php');
+ $GLOBALS['phpgw']->common->phpgw_exit();
+ }
+ }
+ }
?>
-<p>
-<table border="0" width=100%>
-<tr>
-<?php echo "<td bgcolor=\"" . $phpgw_info["theme"]["th_bg"] . "\"
align=\"left\"><b>" . lang("Forums") . " " . lang("Admin") . "</b></td>" .
"</tr>"; ?>
-
-<tr>
- <td>
- <font size=-1>
+ <p>
+ <table border="0" width=100%>
+ <tr>
+ <?php echo "<td bgcolor=\"" . $phpgw_info["theme"]["th_bg"] . "\"
align=\"left\"><b>" . lang("Forums") . " " . lang("Admin") . "</b></td>" .
"</tr>"; ?>
+
+ <tr>
+ <td>
+ <font size=-1>
<?php
-echo "<a href=\"" . $phpgw->link("/forum/preference_category.php") . "\">" .
lang("New Category") ."</a>";
-echo " | ";
-echo "<a href=\"" . $phpgw->link("/forum/preference_forum.php") . "\">" .
lang("New Forum") ."</a>";
-echo " | ";
-echo "<a href=\"" . $phpgw->link("/forum/preference_index.php") . "\">" .
lang("Return to Admin") ."</a>";
-echo " | ";
-echo "<a href=\"" . $phpgw->link("/forum") . "\">" . lang("Return to Forums")
."</a>";
-
-?>
- </font>
- <br><br>
- <center>
- <table border="0" width=80% bgcolor="<?php echo
$phpgw_info["theme"]["table_bg"]?>">
- <tr>
- <td colspan=2 bgcolor="<?php echo $phpgw_info["theme"]["th_bg"]?>">
- <center><?php echo $newold?></center>
- </td>
- </tr>
- <tr>
- <form method="POST" action="<?php echo
$phpgw->link("/forum/preference_category.php"); ?>">
- <?php echo $extrahidden; ?>
- <input type="hidden" name="action" value="<?php echo $actiontype?>">
- <td><?php echo lang("Category Name") ?>:</td>
- <td><input type="text" name="catname" size=40 maxlength=49 value="<?php
echo $catname ?>"></td>
- </tr>
- <tr>
- <td><?php echo lang("Category Description") ?>:</td>
- <td><textarea rows="3" cols="40" name="catdescr" virtual-wrap
maxlength=240><?php echo $catdescr ?></textarea></td>
- </tr>
- <tr><td colspan=2 align=right><input type="submit" value="<?php echo
$buttontext ?>"></td></tr>
-
- </table>
- </center>
- <br>
- </td>
-</tr>
-
- </tr>
- </table>
- </center>
- <br>
-
+ echo "<a href=\"" .
$GLOBALS['phpgw']->link("/forum/preference_category.php") . "\">" . lang("New
Category") ."</a>";
+ echo " | ";
+ echo "<a href=\"" .
$GLOBALS['phpgw']->link("/forum/preference_forum.php") . "\">" . lang("New
Forum") ."</a>";
+ echo " | ";
+ echo "<a href=\"" .
$GLOBALS['phpgw']->link("/forum/preference_index.php") . "\">" . lang("Return
to Admin") ."</a>";
+ echo " | ";
+ echo "<a href=\"" . $GLOBALS['phpgw']->link("/forum/index.php") . "\">"
. lang("Return to Forums") ."</a>";
+?>
+ </font>
+ <br><br>
+ <center>
+ <table border="0" width=80% bgcolor="<?php echo
$phpgw_info["theme"]["table_bg"]?>">
+ <tr>
+ <td colspan=2 bgcolor="<?php echo $phpgw_info["theme"]["th_bg"]?>">
+ <center><?php echo $newold?></center>
+ </td>
+ </tr>
+ <tr>
+ <form method="POST" action="<?php echo
$GLOBALS['phpgw']->link("/forum/preference_category.php"); ?>">
+ <?php echo $extrahidden; ?>
+ <input type="hidden" name="action" value="<?php echo $actiontype?>">
+ <td><?php echo lang("Category Name") ?>:</td>
+ <td><input type="text" name="catname" size=40 maxlength=49 value="<?php
echo $catname ?>"></td>
+ </tr>
+ <tr>
+ <td><?php echo lang("Category Description") ?>:</td>
+ <td><textarea rows="3" cols="40" name="catdescr" virtual-wrap
maxlength=240><?php echo $catdescr ?></textarea></td>
+ </tr>
+ <tr><td colspan=2 align=right><input type="submit" value="<?php echo
$buttontext ?>"></td></tr>
+
+ </table>
+ </center>
+ <br>
+ </td>
+ </tr>
+
+ </tr>
+ </table>
+ </center>
+ <br>
- </td>
-</tr>
-</table>
-<?php
- $phpgw->common->phpgw_footer();
-?>
+ </td>
+ </tr>
+ </table>
+
+
+ <?php
+ $GLOBALS['phpgw']->common->phpgw_footer();
+ ?>
====================================================
Index: forum/preference_deletecategory.php
diff -u forum/preference_deletecategory.php:1.4
forum/preference_deletecategory.php:1.4.4.1
--- forum/preference_deletecategory.php:1.4 Sat Jul 14 01:44:06 2001
+++ forum/preference_deletecategory.php Thu Jun 2 12:51:27 2005
@@ -1,58 +1,64 @@
<?php
-
/*****************************************************************************\
- * phpGroupWare - Forums
*
- * http://www.phpgroupware.org
*
- * Written by Jani Hirvinen <address@hidden>
*
- * -------------------------------------------
*
- * This program is free software; you can redistribute it and/or
modify it *
- * under the terms of the GNU General Public License as published by
the *
- * Free Software Foundation; either version 2 of the License, or (at
your *
- * option) any later version.
*
-
\*****************************************************************************/
+/*****************************************************************************\
+ * phpGroupWare - Forums
*
+ * http://www.phpgroupware.org
*
+ * Written by Jani Hirvinen <address@hidden> *
+ * -------------------------------------------
*
+ * This program is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU General Public License as published by the *
+ * Free Software Foundation; either version 2 of the License, or (at your *
+ * option) any later version.
*
+
\*****************************************************************************/
- /* $Id$ */
+/* $Id$ */
- $phpgw_info["flags"] = array("currentapp" => "forum",
"enable_nextmatchs_class" => True);
- if($confirm || ! $cat_id) {
- $phpgw_info["flags"]["noheader"] = True;
- $phpgw_info["flags"]["nonavbar"] = True;
- }
- include("../header.inc.php");
+ $GLOBALS['phpgw_info']['flags'] = array(
+ 'currentapp' =>
'forum',
+ 'enable_nextmatchs_class' =>
True
+ );
+ if( $_REQUEST['confirm'] || ! $_REQUEST['cat_id'] )
+ {
+ $phpgw_info["flags"]["noheader"] = True;
+ $phpgw_info["flags"]["nonavbar"] = True;
+ }
+ include_once('../header.inc.php');
- if (($cat_id) && (! $confirm)) {
- ?>
- <center>
- <table border=0 width=65%>
- <tr colspan=2>
- <td align=center>
- <?php echo lang("Are you sure you want to delete this category?"); ?>
- <td>
- </tr>
- <tr colspan=2>
- <td align=center>
- <?php echo "<font color=\"red\"><blink>".lang("All forums, user
posts, and topics in this category will be lost!")."</blink></font>"; ?>
- </td>
- </tr>
- <tr>
- <td>
- <a href="<?php echo $phpgw->link("/forum") . "\">" . lang("No");
?></a>
- </td>
- <td>
- <a href="<?php echo
$phpgw->link("/forum/preference_deletecategory.php","cat_id=$cat_id&confirm=true")
. "\">" . lang("Yes"); ?></a>
- </td>
- </tr>
- </table>
- </center>
- <?php
- $phpgw->common->phpgw_footer();
- }
+ if ( $_REQUEST['cat_id'] && !$_REQUEST['confirm'] )
+ {
+ ?>
+ <center>
+ <table border=0 width=65%>
+ <tr colspan=2>
+ <td align=center>
+ <?php echo lang("Are you sure you want to delete this
category?"); ?>
+ <td>
+ </tr>
+ <tr colspan=2>
+ <td align=center>
+ <?php echo "<font color=\"red\"><blink>".lang("All
forums, user posts, and topics in this category will be
lost!")."</blink></font>"; ?>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <a href="<?php echo $GLOBALS['phpgw']->link("/forum") .
"\">" . lang("No"); ?></a>
+ </td>
+ <td>
+ <a href="<?php echo
$GLOBALS['phpgw']->link("/forum/preference_deletecategory.php","cat_id=$cat_id&confirm=true")
. "\">" . lang("Yes"); ?></a>
+ </td>
+ </tr>
+ </table>
+ </center>
+ <?php
+ $GLOBALS['phpgw']->common->phpgw_footer();
+ }
- if (($cat_id) && ($confirm)) {
- $phpgw->db->query("delete from f_threads where cat_id=$cat_id");
- $phpgw->db->query("delete from f_body where cat_id=$cat_id");
- $phpgw->db->query("delete from f_forums where cat_id=$cat_id");
- $phpgw->db->query("delete from f_categories where id=$cat_id");
-
- Header("Location: " . $phpgw->link("/forum"));
- }
-?>
+ if ( $_REQUEST['cat_id'] && $_REQUEST['confirm'])
+ {
+ $cat_id = intval($_REQUEST['cat_id']);
+ $GLOBALS['phpgw']->db->query("DELETE FROM f_threads WHERE
cat_id=$cat_id", __LINE__, __FILE__);
+ $GLOBALS['phpgw']->db->query("DELETE FROM f_body WHERE
cat_id=$cat_id", __LINE__, __FILE__);
+ $GLOBALS['phpgw']->db->query("DELETE FROM f_forums WHERE
cat_id=$cat_id", __LINE__, __FILE__);
+ $GLOBALS['phpgw']->db->query("DELETE FROM f_categories WHERE
id=$cat_id", __LINE__, __FILE__);
+ $GLOBALS['phpgw']->redirect_link('/forum');
+ }
+ ?>
====================================================
Index: forum/preference_deleteforum.php
diff -u forum/preference_deleteforum.php:1.4
forum/preference_deleteforum.php:1.4.4.1
--- forum/preference_deleteforum.php:1.4 Sat Jul 14 01:44:06 2001
+++ forum/preference_deleteforum.php Thu Jun 2 12:51:27 2005
@@ -1,57 +1,65 @@
<?php
-
/*****************************************************************************\
- * phpGroupWare - Forums
*
- * http://www.phpgroupware.org
*
- * Written by Jani Hirvinen <address@hidden>
*
- * -------------------------------------------
*
- * This program is free software; you can redistribute it and/or
modify it *
- * under the terms of the GNU General Public License as published by
the *
- * Free Software Foundation; either version 2 of the License, or (at
your *
- * option) any later version.
*
-
\*****************************************************************************/
+/*****************************************************************************\
+ * phpGroupWare - Forums
*
+ * http://www.phpgroupware.org
*
+ * Written by Jani Hirvinen <address@hidden> *
+ * -------------------------------------------
*
+ * This program is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU General Public License as published by the *
+ * Free Software Foundation; either version 2 of the License, or (at your *
+ * option) any later version.
*
+
\*****************************************************************************/
- /* $Id$ */
+/* $Id$ */
- $phpgw_info["flags"] = array("currentapp" => "forum",
"enable_nextmatchs_class" => True);
- if($confirm || ! $for_id) {
- $phpgw_info["flags"]["noheader"] = True;
- $phpgw_info["flags"]["nonavbar"] = True;
- }
- include("../header.inc.php");
+ $GLOBALS['phpgw_info']['flags'] = array(
+ 'currentapp' =>
'forum',
+ 'enable_nextmatchs_class' =>
True
+ );
+ if( $_REQUEST['confirm'] || !$_REQUEST['for_id'] )
+ {
+ $GLOBALS['phpgw_info']['flags']['noheader'] = True;
+ $GLOBALS['phpgw_info']['flags']['nonavbar'] = True;
+ }
+ include_once('../header.inc.php');
- if (($for_id) && (! $confirm)) {
- ?>
- <center>
- <table border=0 width=65%>
- <tr colspan=2>
- <td align=center>
- <?php echo lang("Are you sure you want to delete this forum?"); ?>
- <td>
- </tr>
- <tr colspan=2>
- <td align=center>
- <?php echo "<font color=\"red\"><blink>".lang("All user posts and
topics will be lost!")."</blink></font>"; ?>
- </td>
- </tr>
- <tr>
- <td>
- <a href="<?php echo $phpgw->link("/forum") . "\">" . lang("No");
?></a>
- </td>
- <td>
- <a href="<?php echo
$phpgw->link("/forum/preference_deleteforum.php","for_id=$for_id&confirm=true")
. "\">" . lang("Yes"); ?></a>
- </td>
- </tr>
- </table>
- </center>
- <?php
- $phpgw->common->phpgw_footer();
- }
+ if ( $_REQUEST['for_id'] && !$_REQUEST['confirm'] )
+ {
+?>
+ <center>
+ <table border=0 width=65%>
+ <tr colspan=2>
+ <td align=center>
+ <?php echo lang("Are you sure you want to delete this
forum?"); ?>
+ <td>
+ </tr>
+ <tr colspan=2>
+ <td align=center>
+ <?php echo "<font color=\"red\"><blink>".lang("All user
posts and topics will be lost!")."</blink></font>"; ?>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <a href="<?php echo
$GLOBALS['phpgw']->link('/forum/index.php') . "\">" . lang("No"); ?></a>
+ </td>
+ <td>
+ <a href="<?php echo
$GLOBALS['phpgw']->link('/forum/preference_deleteforum.php',
+ array('for_id' =>
intval($_REQUEST['for_id']), 'confirm' => 'true') ) . "\">" . lang("Yes");
?></a>
+ </td>
+ </tr>
+ </table>
+ </center>
+ <?php
+ $phpgw->common->phpgw_footer();
+ }
- if (($for_id) && ($confirm)) {
- $phpgw->db->query("delete from f_threads where for_id=$for_id");
- $phpgw->db->query("delete from f_body where for_id=$for_id");
- $phpgw->db->query("delete from f_forums where id=$for_id");
+ if ( $_REQUEST['for_id'] && $_REQUEST['confirm'] )
+ {
+ $for_id = intval($_REQUEST['for_id']);
+ $GLOBALS['phpgw']->db->query("DELETE FROM f_threads WHERE
for_id = $for_id", __LINE__, __FILE__);
+ $GLOBALS['phpgw']->db->query("DELETE FROM f_body WHERE for_id =
$for_id", __LINE__, __FILE__);
+ $GLOBALS['phpgw']->db->query("DELETE FROM f_forums WHERE id =
$for_id", __LINE__, __FILE__);
- Header("Location: " . $phpgw->link("/forum"));
- }
+ $GLOBALS['phpgw']->redirect_link('/forum/index.php');
+ }
?>
====================================================
Index: forum/index.php
diff -u forum/index.php:1.25 forum/index.php:1.25.2.1.2.1
--- forum/index.php:1.25 Sun Nov 18 08:16:25 2001
+++ forum/index.php Thu Jun 2 12:51:27 2005
@@ -12,56 +12,19 @@
/* $Id$ */
- $GLOBALS['phpgw_info']['flags'] = array(
- 'currentapp' => 'forum',
- 'enable_nextmatchs_class' => True
+ $phpgw_flags = Array(
+ 'currentapp' => 'forum',
+ 'noheader' => True,
+ 'nonavbar' => True,
+ 'noappheader' => True,
+ 'noappfooter' => True,
+ 'nofooter' => True
);
- include('../header.inc.php');
- $GLOBALS['phpgw']->template->set_file('INDEX' , 'index.body.tpl');
- $GLOBALS['phpgw']->template->set_block('INDEX','CategoryForum','CatF');
+ $GLOBALS['phpgw_info']['flags'] = $phpgw_flags;
+
+ include_once('../header.inc.php');
- $db2 = $GLOBALS['phpgw']->db;
- $GLOBALS['phpgw']->db->query("select * from
phpgw_forum_categories",__LINE__,__FILE__);
- $GLOBALS['phpgw']->template->set_var(array(
- 'IMG_URL_PREFIX' => PHPGW_IMAGES . '/',
- 'BGROUND' => $GLOBALS['phpgw_info']['theme']['th_bg'],
- 'FORUM' => lang('Forum')
- ));
-
- while ($GLOBALS['phpgw']->db->next_record())
- {
- $db2->query("select max(postdate) from phpgw_forum_threads
where cat_id='" . $GLOBALS['phpgw']->db->f('id')
- . "'",__LINE__,__FILE__);
- $db2->next_record();
- if ($db2->f(0))
- {
- $last_post_date =
$GLOBALS['phpgw']->common->show_date($GLOBALS['phpgw']->db->from_timestamp($db2->f(0)));
- }
- else
- {
- $last_post_date = ' ';
- }
-
- $db2->query("select count(*) from phpgw_forum_threads where
cat_id='" . $GLOBALS['phpgw']->db->f('id')
- . "'",__LINE__,__FILE__);
- $db2->next_record();
- $total = $db2->f(0);
-
- $tr_color =
$GLOBALS['phpgw']->nextmatchs->alternate_row_color($tr_color);
- $GLOBALS['phpgw']->template->set_var(array(
- 'COLOR' => $tr_color,
- 'CAT' => $GLOBALS['phpgw']->db->f('name'),
- 'DESC' =>
($GLOBALS['phpgw']->db->f('descr')?$GLOBALS['phpgw']->db->f('descr'):' '),
- 'CAT_LINK' =>
$GLOBALS['phpgw']->link('/forum/forums.php','cat_id=' .
$GLOBALS['phpgw']->db->f('id')),
- 'value_last_post' => $last_post_date,
- 'value_total' => $total
- ));
- $GLOBALS['phpgw']->template->parse('CatF','CategoryForum',true);
- }
-
- $GLOBALS['phpgw']->template->parse('Out','INDEX');
- $GLOBALS['phpgw']->template->p('Out');
-
- $GLOBALS['phpgw']->common->phpgw_footer();
+ $GLOBALS['phpgw']->redirect_link('/index.php', array('menuaction' =>
'forum.uiforum.index') );
+ $GLOBALS['phpgw']->common->phpgw_exit();
?>
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Phpgroupware-cvs] forum preference_index.php, 1.4.4.1 preference_forum.php, 1.4.4.1 preference_category.php, 1.4.4.1 preference_deletecategory.php, 1.4.4.1 preference_deleteforum.php, 1.4.4.1 index.php, 1.25.2.1.2.1,
skwashd <=