Changeset 2108
- Timestamp:
- 03/08/10 22:10:58 (14 years ago)
- Location:
- plugins/myForms/trunk
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
plugins/myForms/trunk/Email.php
r962 r2108 34 34 $this->bodyformat = 35 35 '--'.$this->altboundary."\n". 36 'Content-Type: text/%s; charset=" iso-8859-1"'."\n".36 'Content-Type: text/%s; charset="utf-8"'."\n". 37 37 'Content-Transfer-Encoding: 7bit'."\n\n%s\n"; 38 38 … … 78 78 sprintf($this->bodyformat, 'plain', self::html2text(nl2br($text))). 79 79 sprintf($this->bodyformat, 'html', $text). 80 '--'.$this->altboundary ."\n";80 '--'.$this->altboundary; 81 81 } 82 82 … … 105 105 '--'.$this->mixedboundary."\n". 106 106 $alt."\n\n". 107 $this->body."\n ".107 $this->body."\n\n". 108 108 $this->attachments. 109 '--'.$this->mixedboundary." \n";109 '--'.$this->mixedboundary."--\n"; 110 110 } else { 111 111 array_unshift($this->headers, $alt); 112 $message = $this->body ;112 $message = $this->body."--\n"; 113 113 } 114 114 try -
plugins/myForms/trunk/TplCore.php
r728 r2108 20 20 21 21 $core->tpl->addValue('myformsContext',array('MyFormsTplCore','Context')); 22 $core->tpl->addBlock('myformsPassword',array('MyFormsTplCore','Password')); 22 23 $core->tpl->addBlock('myformsInfo',array('MyFormsTplCore','Info')); 23 24 $core->tpl->addValue('myformsInfo',array('MyFormsTplCore','DisplayInfo')); … … 57 58 $checks .= ' ?>'; 58 59 return $checks; 60 } 61 62 // Define the form password 63 public static function Password($attr,$content) 64 { 65 return '<?php MyForms::password("'.$content.'"); ?>'; 59 66 } 60 67 -
plugins/myForms/trunk/TplDatabase.php
r728 r2108 25 25 $core->tpl->addBlock('myformsRecordField',array('MyFormsTplDatabase','RecordField')); 26 26 27 $core->tpl->addBlock('myformsDbSelect',array('MyFormsTplDatabase','DbSelect')); 28 $core->tpl->addBlock('myformsDbRecord',array('MyFormsTplDatabase','DbRecord')); 29 $core->tpl->addValue('myformsDbField',array('MyFormsTplDatabase','DbField')); 30 27 31 class MyFormsTplDatabase 28 32 { … … 42 46 } 43 47 48 public static function DbSelect($attr,$content) 49 { 50 $where = ""; 51 if(isset($attr['where'])) 52 $where = ' WHERE '.$attr['where']; 53 return '<?php $record = $core->con->select("SELECT * FROM ".$core->prefix."'.$attr['table'].$where.'"); ?>'.$content; 54 } 55 56 public static function DbRecord($attr,$content) 57 { 58 return '<?php while ($record->fetch()) { ?>'. 59 $content. 60 '<?php } ?>'; 61 } 62 63 public static function DbField($attr) 64 { 65 return '<?php print $record->field("'.$attr['name'].'"); ?>'; 66 } 67 44 68 } 45 69 ?> -
plugins/myForms/trunk/_define.php
r1730 r2108 23 23 /* Description*/ "Create a custom form page with custom action (save in db, send email…)", 24 24 /* Author */ "Olivier Azeau", 25 /* Version */ '0. 3a',25 /* Version */ '0.4', 26 26 /* Permissions */ null 27 27 ); -
plugins/myForms/trunk/_public.php
r1048 r2108 29 29 $core->url->register('formPost','form','^form$',array('MyForms','formPost')); 30 30 31 class PostSimu 32 { 33 public function getURL() 34 { 35 return $_SERVER['REQUEST_URI']; 36 } 37 } 38 31 39 class MyForms extends dcUrlHandlers 32 40 { … … 39 47 private static $allFieldsAreValidated; 40 48 private static $captchaIsValidated; 49 private static $passwordProtected; 41 50 42 51 public static function formGet($args) … … 55 64 public static function form() 56 65 { 57 global $core, $_REQUEST ;66 global $core, $_REQUEST, $_ctx; 58 67 59 68 // add all 'default-templates' folders to form search path … … 63 72 array_push($tplPath, $plugin['root'].'/default-templates'); 64 73 $core->tpl->setPath($tplPath); 74 75 self::$passwordProtected = false; 65 76 66 77 self::loadForm(); 78 79 if(self::$passwordProtected) { 80 $_ctx->posts = new PostSimu(); 81 self::serveDocument('password-form.html','text/html',false); 82 return; 83 } 67 84 68 85 // process form post … … 99 116 $core->tpl->getData($formTpl); 100 117 118 // form is password protected 119 if(self::$passwordProtected) { 120 // Get passwords cookie 121 if (isset($_COOKIE['dc_form_passwd'])) { 122 $pwd_cookie = unserialize($_COOKIE['dc_form_passwd']); 123 } else { 124 $pwd_cookie = array(); 125 } 126 127 // Check for match 128 if ((!empty($_POST['password']) && $_POST['password'] == self::$passwordProtected) 129 || (isset($pwd_cookie[self::$formID]) && $pwd_cookie[self::$formID] == self::$passwordProtected)) { 130 // store password in cookie and clear password protection 131 $pwd_cookie[self::$formID] = self::$passwordProtected; 132 setcookie('dc_form_passwd',serialize($pwd_cookie),0,'/'); 133 self::$passwordProtected = false; 134 } else { 135 // incorrect password : no need to go further 136 return; 137 } 138 } 139 101 140 // field display and validation 102 141 self::$allFieldsAreValidated = true; … … 143 182 { 144 183 print self::$htmlOut; 184 } 185 186 public static function password($pw) 187 { 188 self::$passwordProtected = $pw; 145 189 } 146 190 -
plugins/myForms/trunk/demo/email.myforms.html
r979 r2108 1 1 <tpl:myformsInfo name="title">{{tpl:BlogName encode_html="1"}} - Send email</tpl:myformsInfo> 2 <tpl:myformsPassword>secret</tpl:myformsPassword> 2 3 3 4 <tpl:myformsOnInit> -
plugins/myForms/trunk/index.php
r798 r2108 25 25 $core->themes = new dcThemes($core); 26 26 $core->themes->loadModules($core->blog->themes_path,null); 27 $themeEditor Class = path::real(dirname(__FILE__).'/../themeEditor/class.themeEditor.php');28 if($themeEditor Class) {29 require_once($themeEditor Class);27 $themeEditorRootPath = $core->plugins->moduleRoot("themeEditor"); 28 if($themeEditorRootPath) { 29 require_once($themeEditorRootPath."/class.themeEditor.php"); 30 30 class myFormsTplFileFinder extends dcThemeEditor 31 31 { … … 77 77 } 78 78 79 if($themeEditor Class) {79 if($themeEditorRootPath) { 80 80 print '<h2>'.__('Click on a form to modify it.').'</h2>'; 81 81 $fileFinder = new myFormsTplFileFinder($core);
Note: See TracChangeset
for help on using the changeset viewer.