[ Index ]

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

title

Body

[close]

/include/inc_tmpl/ -> subscription.form.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  $subscription["id"] = intval($_GET["s"]);
  32  
  33  if(isset($_POST["subscription_id"])) {
  34  
  35      // read the create or edit subscription form data
  36      $subscription["id"]            = intval($_POST["subscription_id"]);
  37      $subscription["name"]        = clean_slweg($_POST["subscription_name"]);
  38      if(!$subscription["name"]) $subscription["name"] = "subscription_".randpassword(3);
  39      $subscription["info"]        = clean_slweg($_POST["subscription_info"]);
  40      
  41      if($subscription["id"]) {
  42          $sql =  "UPDATE ".DB_PREPEND."phpwcms_subscription SET ".
  43                  "subscription_name='".aporeplace($subscription["name"])."', ".
  44                  "subscription_info='".aporeplace($subscription["info"])."' ".
  45                  "WHERE subscription_id=".$subscription["id"];    
  46      } else {
  47          $sql =  "INSERT INTO ".DB_PREPEND."phpwcms_subscription (".
  48                  "subscription_name, subscription_info) VALUES ('".
  49                  aporeplace($subscription["name"])."', '".
  50                  aporeplace($subscription["info"])."')";
  51      }
  52      // update or insert data entry
  53      mysql_query($sql, $db) or die("error while updating or inserting subscription datas");
  54      if(!$subscription["id"]) $subscription["id"] = mysql_insert_id($db);
  55      headerRedirect(PHPWCMS_URL."phpwcms.php?do=messages&p=2&s=".$subscription["id"]);
  56  }
  57  
  58  if($subscription["id"]) {
  59  // read the given subscription datas from db
  60      $sql = "SELECT * FROM ".DB_PREPEND."phpwcms_subscription WHERE subscription_id=".$subscription["id"]." LIMIT 1;";
  61      if($result = mysql_query($sql, $db)) {
  62          if($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
  63              $subscription["id"] = $row["subscription_id"];
  64              $subscription["name"] = html_specialchars($row["subscription_name"]);
  65              $subscription["info"] = html_specialchars($row["subscription_info"]);
  66          }
  67          mysql_free_result($result);
  68      }
  69  }
  70  
  71      
  72      // show form
  73  ?>
  74  <form action="phpwcms.php?do=messages&amp;p=2&amp;s=<?php echo $subscription["id"] ?>&amp;edit=1" method="post" name="subscriptions" id="subscriptions" style="background:#F3F5F8;border-top:1px solid #92A1AF;border-bottom:1px solid #92A1AF;margin:0 0 5px 0;padding:10px 10px 15px 10px">
  75  <table border="0" cellpadding="0" cellspacing="0" summary="newsletter subscription form">
  76  
  77      <tr>
  78          <td align="right" class="chatlist"><?php echo $BL['be_newsletter_name'] ?>:&nbsp;</td>
  79          <td><input name="subscription_name" type="text" class="f11b" id="subscription_name" style="width:440px" value="<?php echo  empty($subscription["name"]) ? '' : html_specialchars($subscription["name"]) ?>" size="50" maxlength="250" /></td>
  80      </tr>
  81      
  82      <tr><td colspan="2"><img src="img/leer.gif" alt="" width="1" height="5" /></td></tr>
  83      <tr>
  84          <td align="right" valign="top" class="chatlist" style="padding-top:3px;"><?php echo $BL['be_newsletter_info'] ?>:&nbsp;</td>
  85          <td><textarea name="subscription_info" cols="35" rows="6" class="f11" id="subscription_info" style="width:440px"><?php echo  empty($subscription["info"]) ? '' : html_specialchars($subscription["info"]); ?></textarea></td>
  86      </tr>
  87  
  88      <tr><td colspan="2"><img src="img/leer.gif" alt="" width="1" height="15" /></td></tr>
  89      
  90      <tr>
  91          <td>&nbsp;<input name="subscription_id" type="hidden" value="<?php echo $subscription["id"] ?>" /></td>
  92          <td>
  93          <input name="Submit" type="submit" class="button10" value="<?php echo $BL['be_newsletter_button_save'] ?>" />
  94          &nbsp;&nbsp;
  95          <input type="button" class="button10" value="<?php echo $BL['be_newsletter_button_cancel'] ?>" onclick="location.href='phpwcms.php?do=messages&amp;p=2';" /></td>
  96      </tr>
  97      
  98  </table>
  99  </form>


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