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

Source for file tpl_contribute.php

Documentation is available at tpl_contribute.php

  1. <?php
  2. /**
  3.  * @package linea21.core
  4.  * @subpackage public
  5.  * @author Simon Georget <simon@linea21.com>
  6.  * @version $id SVN
  7.  * @access public
  8.  * @license http://opensource.org/licenses/gpl-3.0.html
  9.  */
  10. ?>
  11.  
  12. <?php
  13.  
  14. if(defined('MOD_COMMENT'&& MOD_COMMENT == && commentEnabled('contribute')) {
  15.  
  16.   $id 1;
  17.   
  18.   SetHTMLTitle(_t('comment','contribute_title'));
  19.   setBreadcrumb(array(_t('comment','contribute_title'=> false));
  20.   
  21.   postCommentAction(array('module'=> ActiveItemKey($GLOBALS['activeitem'])'module_id'=> $id));
  22.   
  23.   echo '<div>'.END_LINE;
  24.   echo '<h1>'._t('comment','contribute_title').'</h1>'.END_LINE;
  25.   echo '<div class="sub-title">'.END_LINE;
  26.   echo sprintf(_t('comment','contribute_chapo')getNbComments(array('module'=> ActiveItemKey($GLOBALS['activeitem'])'module_id'=> $id)));
  27.   echo '</div>'.END_LINE;
  28.   
  29.   displayCommentForm(array('module'=> ActiveItemKey($GLOBALS['activeitem'])'id'=> $id));
  30.   echo '</div>'.END_LINE;
  31.   
  32.  
  33. else {
  34. }
  35.  
  36.  
  37. ifActiveItemKey($GLOBALS['activeitem']=='contact'{
  38.   // set HTML Title
  39.   SetHTMLTitle(_t('contact','contact_us'));
  40.   setBreadcrumb(array(_t('contact','contact_us'=> false));
  41.   include_once('../class/system/class.form.php');
  42.  
  43.   $name='';
  44.   $email='';
  45.   $subject='';
  46.   $body='';
  47.  
  48.   if(isset($_POST['name'])) {
  49.     $passed true;
  50.     $name=$_POST['name'];
  51.     $email=$_POST['email'];
  52.     $subject=$_POST['subject'];
  53.     $body=$_POST['body'];
  54.  
  55.     if(strlen($body)8{
  56.       $msg=sprintf(_t('contact','str_error')_t('contact''body'));
  57.       $class='error';
  58.       $passed false;
  59.     }
  60.     if(strlen($subject)3{
  61.       $msg=sprintf(_t('contact','str_error')_t('contact''subject'));
  62.       $class='error';
  63.       $passed false;
  64.     }
  65.     if(!validEmail($email)) {
  66.       $msg=sprintf(_t('contact','email_error')$email);
  67.       $class='error';
  68.       $passed false;
  69.     }
  70.     if(strlen($email)3{
  71.       $msg=sprintf(_t('contact','str_error')_t('contact''email'));
  72.       $class='error';
  73.       $passed false;
  74.     }
  75.     if(strlen($name)3{
  76.       $msg=sprintf(_t('contact','str_error')_t('contact''name'));
  77.       $class='error';
  78.       $passed false;
  79.     }
  80.     if($passed == true{
  81.       $class 'info';
  82.       $msg _t('contact''message_sent');
  83.       $email_dest SITE_MAIL;
  84.       $email_fromname $name;
  85.       $email_from $email;
  86.       $email_subject formatText($subject'2HTML'' - 'SITE_NAME;
  87.       $email_html_body formatText($body'2HTML');
  88.       $email_text_body strip_tags($email_html_body);
  89.       include_once(themePath('../mail/template.php'));
  90.     }
  91.   }
  92.   echo '<div>'.END_LINE;
  93.   echo '<h1>'._t('contact','contact_us').'</h1>'.END_LINE;
  94.   if(isset($passed)) echo '<div class="'.$class.'">'.$msg.'</div>'.END_LINE;
  95.  
  96.   if(!isset($passed|| $passed == false{
  97.     $form new genForm;
  98.     $form->startForm('index.php''#contactform');
  99.     $form->textInput('name'_t('contact''name')' : ''shorttextfield''labelised''title'10030false$namefalse);
  100.     $form->insertBR();
  101.     $form->textInput('email'_t('contact''email')' : ''shorttextfield''labelised''title'15030false$emailfalse);
  102.     $form->insertBR();
  103.     $form->textInput('subject'_t('contact''subject')' : ''shorttextfield''labelised''title'15030false$subjectfalse);
  104.     $form->insertBR();
  105.     $form->textareaInput('body',ucfirst(_t('contact''body')) .' : ',false,'labelised'false$body6010);
  106.     $form->insertBR();
  107.     $form->submitButton(false_t('btn''valid')true'submitbut');
  108.     $form->hiddenInput('rub'$_REQUEST['rub']);
  109.     $form->closeForm();
  110.     if(!$output $form->getForm()) die("error: " $form->error)}
  111.     else echo $output}
  112.   }
  113.   echo '</div>'.END_LINE;
  114. }
  115.  
  116. ?>

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