[ Index ]

PHP Cross Reference of phpwcms V1.4.3 _r380 (23.11.09)

title

Body

[close]

/include/inc_tmpl/ -> forum.list.tmpl.php (source)

   1  <?php
   2  /*************************************************************************************
   3     Copyright notice
   4     
   5     (c) 2002-2009 Oliver Georgi (oliver@phpwcms.de) // All rights reserved.
   6   
   7     This script is part of PHPWCMS. The PHPWCMS web content management system is
   8     free software; you can redistribute it and/or modify it under the terms of
   9     the GNU General Public License as published by the Free Software Foundation;
  10     either version 2 of the License, or (at your option) any later version.
  11    
  12     The GNU General Public License can be found at http://www.gnu.org/copyleft/gpl.html
  13     A copy is found in the textfile GPL.txt and important notices to the license 
  14     from the author is found in LICENSE.txt distributed with these scripts.
  15    
  16     This script is distributed in the hope that it will be useful, but WITHOUT ANY 
  17     WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
  18     PARTICULAR PURPOSE.  See the GNU General Public License for more details.
  19   
  20     This copyright notice MUST APPEAR in all copies of the script!
  21  *************************************************************************************/
  22  
  23  // ----------------------------------------------------------------
  24  // obligate check for phpwcms constants
  25  if (!defined('PHPWCMS_ROOT')) {
  26     die("You Cannot Access This Script Directly, Have a Nice Day.");
  27  }
  28  // ----------------------------------------------------------------
  29  
  30  
  31  
  32  $forum["text"] = '';
  33  $forum["title"] = '';
  34  $forum['id'] = 0;
  35  $row_count = 0;
  36  
  37  
  38  if(!isset($_GET["s"])) { 
  39  // check if subscription should be edited
  40  ?><table width="538" border="0" cellpadding="0" cellspacing="0" summary="">
  41      <tr><td colspan="3" class="title"><?php echo $BL['be_subnav_msg_forum'] ?></td></tr>
  42      <tr><td colspan="3"><img src="img/leer.gif" alt="" width="1" height="4"></td></tr>
  43      <tr><td colspan="3" bgcolor="#92A1AF"><img src="img/leer.gif" alt="" width="1" height="1"></td></tr>
  44  <?php
  45  // loop listing available subscriptions                                           
  46  $sql = "SELECT * FROM ".DB_PREPEND."phpwcms_forum WHERE forum_entry=0 AND forum_deleted=0 ORDER BY forum_changed DESC;";
  47  if($result = mysql_query($sql, $db) or die("error while listing forums")) {
  48      while($row = mysql_fetch_assoc($result)) {
  49      
  50          echo "<tr".( ($row_count % 2) ? " bgcolor=\"#F3F5F8\"" : "" ).">\n<td width=\"25\">";
  51          echo '<img src="img/symbols/icon_minicategory1.gif" width="14" height="14" alt="" style="margin:4px;margin-left:5px;"></td>'."\n";
  52          echo '<td width="473" class="dir"><a href="phpwcms.php?';
  53          $tempQuery = build_QueryString('&amp;', 'do=messages', 'p=6', 's='.$row["forum_id"]);
  54          echo $tempQuery;
  55          echo '"><strong>'.html_specialchars($row["forum_title"])."</strong></a></td>\n".'<td width="40" align="right">';
  56          echo '<a href="phpwcms.php?';
  57          echo $tempQuery;
  58          echo '"><img src="img/button/edit_22x11.gif" width="22" height="11" border="0"></a>';
  59          echo '<img src="img/leer.gif" width="2" height="1">';
  60          echo '<img src="img/button/del_11x11.gif" width="11" height="11">';
  61          echo '<img src="img/leer.gif" width="2" height="1">'."</td>\n</tr>\n";
  62          $row_count++;
  63      }
  64      mysql_free_result($result);
  65  } // end listing
  66          
  67  ?>
  68      <tr><td colspan="3" bgcolor="#92A1AF"><img src="img/leer.gif" alt="" width="1" height="1"></td></tr>
  69      <tr><td colspan="3"><img src="img/leer.gif" alt="" width="1" height="8"></td>
  70      </tr>
  71      <tr><td colspan="3"><form action="phpwcms.php?do=messages&amp;p=6&amp;s=0" method="post"><input name="addforum" type="submit" class="button10" value="<?php echo $BL['be_forum_add'] ?>"></form></td>
  72      </tr>
  73  </table>
  74  <?php
  75  
  76  } else {
  77  
  78  // should the edit forum dialog
  79      $forum["id"] = (!empty($_GET["s"])) ? intval($_GET["s"]) : 0;
  80      
  81      if(isset($_POST["forum_id"])) {
  82      // read the create or edit forum form data
  83          $forum["id"]            = intval($_POST["forum_id"]);
  84          $forum["title"]            = clean_slweg($_POST["forum_title"]);
  85          if(!$forum["title"]) {
  86              $forum["title"]     = "Forum ".date('Y/m/d H:i');
  87          }
  88          $forum["text"]            = clean_slweg($_POST["forum_text"]);
  89          
  90          $sqla  = "forum_title = '" . aporeplace($forum["title"]) ."', ";
  91          $sqla .= "forum_text  = '" . aporeplace($forum["text"])  ."'";
  92          
  93          if($forum["id"]) {
  94  
  95              $sql  = "UPDATE ".DB_PREPEND."phpwcms_forum SET " . $sqla;
  96              $sql .= " WHERE forum_entry=0 AND forum_id=".$forum["id"];
  97              $sql .= " LIMIT 1";
  98  
  99          } else {
 100  
 101              $sql  = "INSERT INTO ".DB_PREPEND."phpwcms_forum SET ";
 102              $sql .= "forum_entry='0', ";
 103              $sql .= "forum_uid='" . $_SESSION["wcs_user_id"] . "', ";
 104              $sql .= "forum_created = '".time()."', ";
 105              $sql .= $sqla;
 106  
 107          }
 108          // update or insert data entry
 109          mysql_query($sql, $db) or die("error while updating or inserting forum data");
 110          if(!$forum["id"]) $forum["id"] = mysql_insert_id($db);
 111          headerRedirect(PHPWCMS_URL.'phpwcms.php?'.build_QueryString('&', 'do=messages', 'p=6', 's='.$forum["id"]));
 112      }
 113  
 114      if($forum["id"]) {
 115      // read the given subscription datas from db
 116          $sql = "SELECT * FROM ".DB_PREPEND."phpwcms_forum WHERE forum_id=".$forum["id"]." LIMIT 1;";
 117          if($result = mysql_query($sql, $db)) {
 118              if($row = mysql_fetch_assoc($result)) {
 119                  $forum["id"] = $row["forum_id"];
 120                  $forum["title"] = html_specialchars($row["forum_title"]);
 121                  $forum["text"] = html_specialchars($row["forum_text"]);
 122              }
 123              mysql_free_result($result);
 124          }
 125      }
 126  
 127      
 128      // show form
 129  ?>
 130  <form action="phpwcms.php?<?php echo  build_QueryString('&amp;', 'do=messages', 'p=6', 's='.$forum["id"]) ?>" method="post" name="forums" target="_self">
 131  <table width="538" border="0" cellpadding="0" cellspacing="0" summary="">
 132      <tr>
 133        <td colspan="2" class="title"><?php echo  $BL['be_forum_titleedit'].": ".( $forum["id"] ? $forum["title"] : $BL['be_newsletter_new']); ?></td>
 134      </tr>
 135      <tr>
 136          <td width="73"><img src="img/leer.gif" alt="" width="73" height="6"></td>
 137          <td width="465"><img src="img/leer.gif" alt="" width="1" height="1"></td>
 138      </tr>
 139      <tr><td colspan="2"><img src="img/lines/l538_70.gif" alt="" width="538" height="1"></td></tr>
 140      <tr bgcolor="#E6EAED"><td colspan="2"><img src="img/leer.gif" alt="" width="1" height="12"></td></tr>
 141      <tr bgcolor="#E6EAED">
 142          <td align="right" class="chatlist">&nbsp;<?php echo  $BL['be_forum_title'] ?>:&nbsp;</td>
 143          <td><input name="forum_title" type="text" class="f11b" id="forum_title" style="width:440px" value="<?php echo $forum["title"] ?>" size="50" maxlength="250"></td>
 144      </tr>
 145      <tr bgcolor="#E6EAED"><td colspan="2"><img src="img/leer.gif" alt="" width="1" height="5"></td></tr>
 146      <tr bgcolor="#E6EAED">
 147          <td align="right" valign="top" bgcolor="#E6EAED" class="chatlist"><img src="img/leer.gif" alt="" width="5" height="16"><?php echo  $BL['be_cnt_description'] ?>:&nbsp;</td>
 148          <td><textarea name="forum_text" cols="35" rows="6" class="f11" id="forum_text" style="width:440px"><?php echo $forum["text"]; ?></textarea></td>
 149      </tr>
 150      <tr bgcolor="#E6EAED"><td colspan="2"><img src="img/leer.gif" alt="" width="1" height="8"></td></tr>
 151      <tr><td colspan="2"><img src="img/lines/l538_70.gif" alt="" width="538" height="1"></td></tr>
 152      <tr><td colspan="2"><img src="img/leer.gif" alt="" width="1" height="15"></td></tr>
 153      <tr>
 154          <td>&nbsp;<input name="forum_id" type="hidden" value="<?php echo $forum["id"] ?>"></td>
 155          <td><input name="Submit" type="submit" class="button10" value="<?php echo $BL['be_save_btn'] ?>">&nbsp;&nbsp;<input type="button" class="button10" value="<?php echo $BL['be_newsletter_button_cancel'] ?>" onclick="location.href='phpwcms.php?do=messages&p=6';"></td>
 156      </tr>
 157      <tr><td colspan="2"><img src="img/leer.gif" alt="" width="1" height="15"></td></tr>
 158  </table>
 159  </form>
 160  <?php    
 161  }
 162  
 163  ?>


Generated: Wed Dec 30 05:55:15 2009 Cross-referenced by PHPXref 0.7