linea21-modules
[ class tree: linea21-modules ] [ index: linea21-modules ] [ all elements ]

Source for file add.php

Documentation is available at add.php

  1. <?php
  2. /**
  3.  * @package linea21.modules
  4.  * @subpackage newsletter
  5.  * @author linea21 <info@linea21.com>
  6.  * @version $id SVN
  7.  * @access public
  8.  * @license http://opensource.org/licenses/gpl-3.0.html
  9.  */
  10.  
  11. //////////// Check Inclusion de pages ////////////
  12. if (!function_exists('AuthenthificationProcess')) {
  13.   include_once("../lib/lib_common.php");
  14.   ReloadIndex('admin');
  15. }
  16. ////////////
  17. ?>
  18.  
  19. <div id="chemin">
  20. <ul>
  21.     <li><a href="index.php" class="chemin_home"><?php echo _t('way','home')?></a></li>
  22.     <li><a href="<?php echo $rub_link?>" id="chemin_<?php echo $rub?>" class="chemin_rub"><?php echo _t('menu','newsletter')?></a></li>
  23.     <li><span><?php echo formatNavTitle(_t('newsletter','add'))?></span></li>
  24. </ul>
  25. </div>
  26. <!--end barre haute -->
  27. <?php
  28. $form_title='';
  29. $form_body='';
  30. $mask_statut_D='checked="checked"';
  31. $mask_statut_W='';
  32.  
  33. $xml simplexml_load_file(themePath("../newsletter/input/template.html"THEME_PUBLIC_PATH));
  34. $form_body str_replace('##CONTENTS##''<p>'._t('newsletter''content').'</p>'$xml->body->asXML());
  35.  
  36.  
  37.  
  38. $newsletter_object new newsletter;
  39.  
  40. if(isset($_POST['enregistrer'])) {
  41.   $data_table=unserialize(urldecode($_POST['data_table']));
  42.   $result=$newsletter_object->AddNewsletter($data_table$sql_object);
  43.   $link_confirm="confirm.php?rub=".$rub."&todo=".$todo;
  44.   if(is_numeric($result)) header("Location: ".$link_confirm);
  45.   else  system_error();
  46. }
  47.  
  48. if(isset($_POST['valider'])) {
  49.   $table[0]=$_POST['newsletter_title'];
  50.   
  51.   $html $_POST['newsletter_body'];
  52.   if (get_magic_quotes_gpc()) $html=stripslashes($html);
  53.   $html removeEmptyP($html);
  54.   
  55.   // we get only the text contained into #main div
  56.   include_once('../lib/vendor/simpleDOM/SimpleDOM.php');
  57.   $xml simpledom_load_string($html);
  58.  
  59.   $att 'id';
  60.   $body_content '';
  61.  
  62.   foreach ($xml->children(as $el{
  63.     if($el->attributes()->$att == 'main'{
  64.       $body_content $el->innerHTML();
  65.     }
  66.   }
  67.  
  68.   $table[1]=$body_content;
  69.   $table[2]=GetSessionElement('id')// ID posteur
  70.   $table[3]=$_POST['newsletter_statut'];
  71.  
  72.   $newsletter_objectnew newsletter;
  73.   $integrity=$newsletter_object->CheckDataIntegrity($table);
  74.  
  75.   if(is_string($integrity)) {
  76.     $text_format='2FIELD';
  77.     $body_content=$_POST['newsletter_body'];
  78.   else {
  79.     $text_format='2HTML';
  80.   }
  81.   $form_title=formatText($_POST['newsletter_title']$text_format);
  82.   $form_body=formatText($body_content$text_format);
  83.  
  84.  
  85.   if($_POST['newsletter_statut']=='D'$mask_statut_D="checked=\"checked\""else $mask_statut_D='';
  86.   if($_POST['newsletter_statut']=='W'$mask_statut_W="checked=\"checked\""else $mask_statut_P='';
  87.   $table=urlencode(serialize($table));
  88. }
  89.  
  90. include_once(THEME_ADMIN_PATH."quickicons.php");
  91.  
  92. ?>
  93.  
  94. <?php
  95. if(!isset($integrity|| is_string($integrity)) {
  96.   ?>
  97. <div class="contentcontainer"><?php
  98. include_once($dir."/menurub.php");
  99. ?>
  100. <div id="content"><?php
  101. if(isset($integrity&& is_string($integrity)) display_errors($integrity);
  102. ?>
  103. <h2><?php echo formatTitleh2(_t('newsletter','add_title'))?></h2>
  104. <form id="addnews" action="<?php echo $_SERVER['SCRIPT_NAME']?>" method="post">
  105. <p>
  106.   <label for="newsletter_title"><?php echo _t('newsletter','title')?> : *</label>
  107.   <input name="newsletter_title" type="text" class="textfield" id="newsletter_title" maxlength="200" value="<?php echo $form_title?>" />
  108. </p>
  109. <p>
  110.   <label for="newsletter_body"><?php echo _t('newsletter','body')?> : *</label>
  111.   <textarea id="newsletter_body" name="newsletter_body" class="largetextfield" <?php echo AREA_SETTINGS?>><?php echo $form_body?></textarea>
  112. </p>
  113. <div class="label"><?php echo _t('newsletter','statut')?> : </div>
  114. <div class="rightpanel">
  115.   <input name="newsletter_statut" type="radio" id="statut_D" value="D" <?php echo $mask_statut_D?> />
  116.   <label for="statut_D"><?php echo _t('statut','draft')?></label>
  117.   <input name="newsletter_statut" type="radio" id="statut_W" value="W" <?php echo $mask_statut_W?> />
  118.   <label for="statut_W"><?php echo _t('newsletter','nightsend')?></label>
  119. </div>
  120. <div>
  121.   <input name="rub" type="hidden" value="<?php echo $rub?>" id="rub" />
  122.   <input name="todo" type="hidden" value="<?php echo $todo?>" id="todo" />
  123.   <?php echo cancel_button('javascript:history.go(-1);')?>
  124.   <input name="valider" type="submit" value="<?php echo _t('btn','valid'?>" class="button" id="valider" />
  125. </div>
  126. </form>
  127. </div>
  128. <?php include_once($dir."/help.php")?></div>
  129. <?php
  130. // Récapitulatif
  131. else    {
  132.  
  133.   ?>
  134. <div class="contentcontainer"><?php
  135. include_once($dir."/menurub.php");
  136. ?>
  137. <div id="content">
  138. <h2><?php echo formatTitleh2(_t('recap','title'))?></h2>
  139. <?php
  140. echo "<dl class=\"dl3\">\n";
  141. echo "<dt>"._t('newsletter','title')."</dt>\n";
  142. echo "<dd>"$form_title."</dd>\n";
  143. echo "<dt>"._t('newsletter','body')." :</dt>\n";
  144. echo "<dd>".linkin_content($form_body)."</dd>\n";
  145. echo "<dt>"._t('divers','statut')."</dt>\n";
  146. echo "<dd>"display_statut($_POST['newsletter_statut'])"</dd>\n";
  147. echo "</dl>\n";
  148. ?>
  149. <form id="addscale" action="<?php echo $_SERVER['SCRIPT_NAME']?>" method="post">
  150. <div>
  151.   <input name="rub" type="hidden" value="<?php echo $rub?>" id="rub" />
  152.   <input name="todo" type="hidden" value="<?php echo $todo?>" id="todo" />
  153.   <input name="data_table" type="hidden" value="<?php echo $table?>" id="data_table" />
  154.   <?php echo cancel_button('?rub=newsletter&amp;todo=list')?>
  155.   <input name="retour" type="button" value="<?php echo _t('btn','preview')?>" class="button" id="retour" onclick="history.go(-1);" />
  156.   <input name="enregistrer" type="submit" value="<?php echo _t('btn','save')?>" class="button" id="valider" />
  157. </div>
  158. </form>
  159. </div>
  160. <?php include_once($dir."/help.php")?></div>
  161. <?php
  162. }
  163. ?>

Documentation generated on Thu, 03 May 2012 15:01:54 +0200 by phpDocumentor 1.4.1