芝麻web文件管理V1.00
编辑当前文件:/home/p/r/i/prismawe/clients/canaldegap.fr/modules/FormBuilder/classes/DispositionEmail.class.php
More info at http://dev.cmsmadesimple.org/projects/formbuilder A Module for CMS Made Simple, Copyright (c) 2006 by Ted Kulp (wishy@cmsmadesimple.org) This project's homepage is: http://www.cmsmadesimple.org */ require_once(dirname(__FILE__).'/DispositionEmailBase.class.php'); class fbDispositionEmail extends fbDispositionEmailBase { var $addressCount; var $addressAdd; function fbDispositionEmail(&$form_ptr, &$params) { $this->fbDispositionEmailBase($form_ptr, $params); $mod = $form_ptr->module_ptr; $this->Type = 'DispositionEmail'; $this->DisplayInForm = false; $this->NonRequirableField = true; $this->IsDisposition = true; $this->HasAddOp = true; $this->HasDeleteOp = true; $this->ValidationTypes = array( ); } function GetOptionAddButton() { $mod = $this->form_ptr->module_ptr; return $mod->Lang('add_address'); } function GetOptionDeleteButton() { $mod = $this->form_ptr->module_ptr; return $mod->Lang('delete_address'); } function DoOptionAdd(&$params) { $this->addressAdd = 1; } function DoOptionDelete(&$params) { $delcount = 0; foreach ($params as $thisKey=>$thisVal) { if (substr($thisKey,0,9) == 'fbrp_del_') { $this->RemoveOptionElement('destination_address', $thisVal - $delcount); $delcount++; } } } function StatusInfo() { $mod = $this->form_ptr->module_ptr; $opt = $this->GetOption('destination_address',''); $ret= $mod->Lang('to').": "; if (is_array($opt)) { if (count($opt)>1) { $ret.= count($opt); $ret.= " ".$mod->Lang('recipients'); } else { $ret.= $opt[0]; } } elseif ($opt != '') { $ret .= $opt; } else { $ret.= $mod->Lang('unspecified'); } $ret.= $this->TemplateStatus(); return $ret; } function countAddresses() { $tmp = $this->GetOptionRef('destination_address'); if (is_array($tmp)) { $this->addressCount = count($tmp); } elseif ($tmp !== false) { $this->addressCount = 1; } else { $this->addressCount = 0; } } // Send off those emails function DisposeForm() { $tmp = $this->GetOptionRef('destination_address'); return $this->SendForm($tmp,$this->GetOption('email_subject')); } function PrePopulateAdminForm($formDescriptor) { $mod = $this->form_ptr->module_ptr; $this->countAddresses(); if ($this->addressAdd > 0) { $this->addressCount += $this->addressAdd; $this->addressAdd = 0; } $dests = '
'.$mod->Lang('title_destination_address').'
'. $mod->Lang('title_delete').'
'; for ($i=0;$i<($this->addressCount>1?$this->addressCount:1);$i++) { $dests .= '
'. $mod->CreateInputText($formDescriptor, 'fbrp_opt_destination_address[]',$this->GetOptionElement('destination_address',$i),25,128). '
'. $mod->CreateInputCheckbox($formDescriptor, 'fbrp_del_'.$i, $i,-1). '
'; } $dests .= '
'; list($main,$adv) = $this->PrePopulateAdminFormBase($formDescriptor); array_push($main,array($mod->Lang('title_destination_address'),$dests)); return array('main'=>$main,'adv'=>$adv); } function PostPopulateAdminForm(&$mainArray, &$advArray) { $this->HiddenDispositionFields($mainArray, $advArray); } function AdminValidate() { $mod = $this->form_ptr->module_ptr; $opt = $this->GetOptionRef('destination_address'); list($ret, $message) = $this->DoesFieldHaveName(); if ($ret) { list($ret, $message) = $this->DoesFieldNameExist(); } if ($opt === false || count($opt) == 0) { $ret = false; $message .= $mod->Lang('must_specify_one_destination').''; } list($rv,$mess) = $this->validateEmailAddr($this->GetOption('email_from_address')); if (!$rv) { $ret = false; $message .= $mess; } for($i=0;$i
validateEmailAddr($opt[$i]); if (!$rv) { $ret = false; $message .= $mess; } } return array($ret,$message); } } ?>