[ Index ] |
|
Code source de e107 0.7.8 |
1 <?php 2 require_once ("../../../class2.php"); 3 require_once(e_HANDLER."form_handler.php"); 4 $rs = new form; 5 6 $lan_file = e_PLUGIN."content/languages/".e_LANGUAGE."/lan_content.php"; 7 include_once(file_exists($lan_file) ? $lan_file : e_PLUGIN."content/languages/English/lan_content.php"); 8 $lan_file = e_PLUGIN."content/languages/".e_LANGUAGE."/lan_content_admin.php"; 9 include_once(file_exists($lan_file) ? $lan_file : e_PLUGIN."content/languages/English/lan_content_admin.php"); 10 $months = array(CONTENT_ADMIN_DATE_LAN_0, CONTENT_ADMIN_DATE_LAN_1, CONTENT_ADMIN_DATE_LAN_2, CONTENT_ADMIN_DATE_LAN_3, CONTENT_ADMIN_DATE_LAN_4, CONTENT_ADMIN_DATE_LAN_5, CONTENT_ADMIN_DATE_LAN_6, CONTENT_ADMIN_DATE_LAN_7, CONTENT_ADMIN_DATE_LAN_8, CONTENT_ADMIN_DATE_LAN_9, CONTENT_ADMIN_DATE_LAN_10, CONTENT_ADMIN_DATE_LAN_11); 11 12 if(isset($_POST['addpreset'])){ 13 if(!$_POST['field']){ 14 $err = "<br /><b>".CONTENT_PRESET_LAN_0."</b><br /><br />"; 15 }else{ 16 $err = ""; 17 if($_POST['type'] == "text"){ 18 if(!($_POST['text_size'] && $_POST['text_maxsize'] && is_numeric($_POST['text_size']) && is_numeric($_POST['text_maxsize'])) ){ 19 $err .= "<br /><b>".CONTENT_PRESET_LAN_1."<br />".CONTENT_PRESET_LAN_3."</b><br />"; 20 }else{ 21 $value = $_POST['field']."^".$_POST['type']."^".$_POST['text_size']."^".$_POST['text_maxsize']; 22 } 23 } 24 if($_POST['type'] == "area"){ 25 if(!($_POST['area_cols'] && $_POST['area_rows'] && is_numeric($_POST['area_cols']) && is_numeric($_POST['area_rows'])) ){ 26 $err .= "<br /><b>".CONTENT_PRESET_LAN_1."<br />".CONTENT_PRESET_LAN_4."</b><br />"; 27 }else{ 28 $value = $_POST['field']."^".$_POST['type']."^".$_POST['area_cols']."^".$_POST['area_rows']; 29 } 30 } 31 if($_POST['type'] == "select"){ 32 $options = implode("^", $_POST['options']); 33 if(!$_POST['options'][0] && !$_POST['options'][1]){ 34 $err .= "<br /><b>".CONTENT_PRESET_LAN_1."<br />".CONTENT_PRESET_LAN_5."</b><br />"; 35 }else{ 36 $value = $_POST['field']."^".$_POST['type']."^".$options; 37 } 38 } 39 if($_POST['type'] == "date"){ 40 if(!($_POST['date_year_from'] && $_POST['date_year_to'] && is_numeric($_POST['date_year_from']) && is_numeric($_POST['date_year_to'])) ){ 41 $err .= "<br /><b>".CONTENT_PRESET_LAN_1."<br />".CONTENT_PRESET_LAN_6."</b><br />"; 42 }else{ 43 $value = $_POST['field']."^".$_POST['type']."^".$_POST['date_year_from']."^".$_POST['date_year_to']; 44 } 45 } 46 if($_POST['type'] == "checkbox"){ 47 if(!$_POST['checkbox_value']){ 48 $err .= "<br /><b>".CONTENT_PRESET_LAN_1."<br />".CONTENT_PRESET_LAN_20."</b><br />"; 49 }else{ 50 $value = $_POST['field']."^".$_POST['type']."^".$_POST['checkbox_value']; 51 } 52 } 53 if($_POST['type'] == "radio"){ 54 if(!($_POST['radio_value'] && $_POST['radio_text'] && $_POST['radio_value']!="" && $_POST['radio_text']!="")){ 55 $err .= "<br /><b>".CONTENT_PRESET_LAN_1."<br />".CONTENT_PRESET_LAN_19."</b><br />"; 56 }else{ 57 if(count($_POST['radio_value']) != count($_POST['radio_text'])){ 58 $err .= CONTENT_PRESET_LAN_19; 59 }else{ 60 for($i=0;$i<count($_POST['radio_text']);$i++){ 61 $radio .= $_POST['radio_text'][$i]."^".$_POST['radio_value'][$i]."^"; 62 } 63 $radio = substr($radio,0,-1); 64 $value = $_POST['field']."^".$_POST['type']."^".$radio; 65 } 66 } 67 } 68 } 69 if(!$err){ 70 $value = $tp->post_toForm($value); 71 72 $js = " 73 <script type='text/javascript'> 74 75 var ecopy = 'upline_new'; 76 var epaste = 'div_content_custom_preset'; 77 var type = window.opener.document.getElementById(ecopy).nodeName; // get the tag name of the source copy. 78 var br = window.opener.document.createElement('br'); 79 80 var field = window.opener.document.createElement('input'); 81 field.type = 'text'; 82 field.size = '50'; 83 field.name = 'content_custom_preset_key[]'; 84 field.value = '".$value."'; 85 field.className = 'tbox'; 86 87 var but = window.opener.document.createElement('input'); 88 but.type = 'button'; 89 but.value = 'x'; 90 but.className = 'button'; 91 but.onclick = function(){ this.parentNode.parentNode.removeChild(this.parentNode); }; 92 93 var destination = window.opener.document.getElementById(epaste); 94 var source = window.opener.document.getElementById(ecopy).cloneNode(true); 95 var newentry = window.opener.document.createElement(type); 96 97 newentry.appendChild(source); 98 newentry.value=''; 99 newentry.appendChild(br); 100 newentry.appendChild(field); 101 newentry.appendChild(but); 102 newentry.appendChild(br); 103 104 destination.appendChild(newentry); 105 106 window.close(); 107 </script>\n 108 "; 109 } 110 } 111 112 113 $text .= " 114 <!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.1//EN\" \"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd'>\n 115 <html>\n 116 <head>\n 117 <title>".CONTENT_PRESET_LAN_7."</title>\n 118 <script type='text/javascript' src='../../../e107_files/e107.js'></script> 119 ".$js." 120 <style type='text/css'>\n 121 html,body{ 122 text-align:center; 123 font-family: verdana, arial, helvetica, tahoma, sans-serif; 124 font-size: 11px; 125 color: #444; 126 margin-left: auto; 127 margin-right: auto; 128 margin-top:0px; 129 margin-bottom:0px; 130 padding: 0px; 131 background-color:#FFF; 132 height:100%; 133 cursor:default; 134 } 135 td{ 136 padding:5px; 137 font-size:11px; 138 text-align:left; 139 } 140 .fborder{ 141 width:80%; 142 margin:0; 143 padding:0; 144 } 145 .fcaption{ 146 font-size:12px; 147 font-weight:bold; 148 white-space:nowrap; 149 } 150 .err{ 151 font-size:11px; 152 font-weight:bold; 153 color: #FF0000; 154 } 155 .leftcell{ 156 width:10%; 157 white-space:nowrap; 158 } 159 .button{ 160 padding:2px; 161 cursor:pointer; 162 } 163 .example { 164 border: #999 1px dashed; 165 padding: 5px; 166 margin: 5px; 167 background-color: #f7f7f9; 168 } 169 </style> 170 </head> 171 <body onload=self.focus()>"; 172 173 $qs = explode(".", e_QUERY); 174 175 $text .= " 176 <form method='post' action='".e_SELF."?".e_QUERY."'>\n 177 <table class='fborder' style='width:350px;'> 178 ".($err ? "<tr><td colspan='2' class='err' style='padding-bottom:10px;'>".$err."</td></tr>" : "")." 179 <tr><td colspan='2' class='fcaption' style='padding-bottom:10px;'>".CONTENT_PRESET_LAN_8." : ".$qs[0]."</td></tr> 180 <tr><td class='leftcell'>".CONTENT_PRESET_LAN_9."</td><td>".$rs -> form_text("field", 40, $_POST['field'], 50)."</td></tr>"; 181 182 if($qs[0] == "text"){ 183 $text .= " 184 <tr><td class='leftcell'>".CONTENT_PRESET_LAN_10."</td><td>".$rs -> form_text("text_size", 3, $_POST['text_size'], 3)."</td></tr> 185 <tr><td class='leftcell'>".CONTENT_PRESET_LAN_11."</td><td>".$rs -> form_text("text_maxsize", 3, $_POST['text_maxsize'], 3)."</td></tr> 186 "; 187 $example = CONTENT_PRESET_LAN_32."<br /><br />".$rs -> form_text("extext", 40, CONTENT_PRESET_LAN_9."=".CONTENT_PRESET_LAN_32.", ".CONTENT_PRESET_LAN_10."=40, ".CONTENT_PRESET_LAN_11."=10", 100); 188 } 189 190 if($qs[0] == "area"){ 191 $text .= " 192 <tr><td class='leftcell'>".CONTENT_PRESET_LAN_12."</td><td>".$rs -> form_text("area_cols", 3, $_POST['area_cols'], 3)."</td></tr> 193 <tr><td class='leftcell'>".CONTENT_PRESET_LAN_13."</td><td>".$rs -> form_text("area_rows", 3, $_POST['area_rows'], 3)."</td></tr> 194 "; 195 $example = CONTENT_PRESET_LAN_32."<br /><br />".$rs -> form_textarea("exarea", 30, 4, "".CONTENT_PRESET_LAN_9."=".CONTENT_PRESET_LAN_32."\n".CONTENT_PRESET_LAN_12."=30\n".CONTENT_PRESET_LAN_13."=4", $form_js = "", $form_style = "", $form_wrap = "", $form_readonly = "", $form_tooltip = ""); 196 } 197 198 if($qs[0] == "date"){ 199 $text .= " 200 <tr><td class='leftcell'>".CONTENT_PRESET_LAN_14."</td><td>".$rs -> form_text("date_year_from", 3, $_POST['date_year_from'], 4)."</td></tr> 201 <tr><td class='leftcell'>".CONTENT_PRESET_LAN_15."</td><td>".$rs -> form_text("date_year_to", 3, $_POST['date_year_to'], 4)."</td></tr> 202 "; 203 $example = CONTENT_PRESET_LAN_32." ".CONTENT_PRESET_LAN_14." 1990, ".CONTENT_PRESET_LAN_15." 2000<br /><br /> 204 ".$rs -> form_select_open("exday", "")." 205 ".$rs -> form_option(CONTENT_ADMIN_DATE_LAN_12, "0", ""); 206 for($i=1;$i<=31;$i++){ 207 $example .= $rs -> form_option($i, ($values[$tmp[0]]['day'] == $i ? "1" : "0"), $i, ""); 208 } 209 $example .= $rs -> form_select_close(); 210 211 $example .= $rs -> form_select_open("exmonth", "")." 212 ".$rs -> form_option(CONTENT_ADMIN_DATE_LAN_13, "0", ""); 213 for($i=1;$i<=12;$i++){ 214 $example .= $rs -> form_option($months[($i-1)], ($values[$tmp[0]]['month'] == $i ? "1" : "0"), $i, ""); 215 } 216 $example .= $rs -> form_select_close(); 217 218 $example .= $rs -> form_select_open("exyear", "")." 219 ".$rs -> form_option(CONTENT_ADMIN_DATE_LAN_14, "0", ""); 220 for($i=1990;$i<=2000;$i++){ 221 $example .= $rs -> form_option($i, "0", $i, ""); 222 } 223 $example .= $rs -> form_select_close(); 224 } 225 226 if($qs[0] == "select"){ 227 $text .= " 228 <tr><td class='leftcell' style='vertical-align:top;'>".CONTENT_PRESET_LAN_23."</td> 229 <td><input class='tbox' type='text' name='options[0]' size='10' maxlength='100' /> (".CONTENT_PRESET_LAN_24.")</td> 230 </tr> 231 <tr><td class='leftcell' style='vertical-align:top;'>".CONTENT_PRESET_LAN_16."</td> 232 <td> 233 <div id='select_container' style='width:40%;white-space:nowrap;'> 234 <span id='selectline' style='white-space:nowrap;'> 235 <input class='tbox' type='text' name='options[]' size='10' maxlength='100' /> 236 <input type='button' class='button' value='".CONTENT_PRESET_LAN_17."' onclick=\"duplicateHTML('selectline','select_container');\" /> 237 </span><br /> 238 </div> 239 </td></tr> 240 "; 241 $example = CONTENT_PRESET_LAN_32." ".CONTENT_PRESET_LAN_23." = ".CONTENT_PRESET_LAN_32.", options=a,b,c<br /><br /> 242 ".$rs -> form_select_open("exselect", ""); 243 $example .= $rs -> form_option(CONTENT_PRESET_LAN_32, "0", "", ""); 244 $example .= $rs -> form_option("a", "0", "a", ""); 245 $example .= $rs -> form_option("b", "0", "b", ""); 246 $example .= $rs -> form_option("c", "0", "c", ""); 247 $example .= $rs -> form_select_close(); 248 } 249 if($qs[0] == "checkbox"){ 250 $text .= "<tr><td class='leftcell'>".CONTENT_PRESET_LAN_22."</td><td>".$rs -> form_text("checkbox_value", 3, $_POST['checkbox_value'], 50)."</td></tr>"; 251 $example = CONTENT_PRESET_LAN_32." ".CONTENT_PRESET_LAN_9." = ".CONTENT_PRESET_LAN_32.", ".CONTENT_PRESET_LAN_22." = 1<br /><br />".CONTENT_PRESET_LAN_32." ".$rs -> form_checkbox("excheckbox", "ex1", $form_checked = 0, $form_tooltip = "", $form_js = ""); 252 } 253 if($qs[0] == "radio"){ 254 $text .= " 255 <tr><td class='leftcell'></td> 256 <td> 257 <div id='radio_container' style='width:40%;white-space:nowrap;'> 258 <span id='radioline' style='white-space:nowrap;'> 259 ".CONTENT_PRESET_LAN_21." <input class='tbox' type='text' name='radio_text[]' value='".$_POST['radio_text[]']."' size='8' maxlength='100' /> 260 ".CONTENT_PRESET_LAN_22." <input class='tbox' type='text' name='radio_value[]' value='".$_POST['radio_value[]']."' size='2' maxlength='100' /> 261 <input type='button' class='button' value='".CONTENT_PRESET_LAN_17."' onclick=\"duplicateHTML('radioline','radio_container');\" /> 262 </span><br /> 263 </div> 264 </td></tr> 265 "; 266 $example = CONTENT_PRESET_LAN_32."<br /><br />".$rs -> form_radio("exradio", CONTENT_PRESET_LAN_32." 1", "0", "", "")." ".CONTENT_PRESET_LAN_32." 1 ".$rs -> form_radio("exradio", CONTENT_PRESET_LAN_32." 2", "0", "", "")." ".CONTENT_PRESET_LAN_32." 2"; 267 } 268 269 //process button 270 $text .= " 271 <tr><td class='leftcell'> </td><td style='text-align:right;'><input type='hidden' name='type' value='".$qs[0]."' /><input type='submit' class='button' name='addpreset' value='".CONTENT_PRESET_LAN_18."' /><br /><br /></td></tr>\n 272 <tr><td colspan='2' class='example'>".$example."</td></tr> 273 </table>\n 274 </form>\n 275 </body>\n 276 </html>\n"; 277 278 echo $text; 279 280 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Sun Apr 1 01:23:32 2007 | par Balluche grâce à PHPXref 0.7 |