- Timestamp:
- 2006/12/13 00:46:45 (20 years ago)
- Location:
- temp/test-xoops.ec-cube.net/html/modules/xoopspoll
- Files:
-
- 3 edited
-
class/xoopspoll.php (modified) (1 diff)
-
pollnew.php (modified) (3 diffs)
-
templates/xoopspoll_new.html (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
temp/test-xoops.ec-cube.net/html/modules/xoopspoll/class/xoopspoll.php
r770 r777 200 200 $this->db->query($sql); 201 201 } 202 203 // public 204 function insertOption($arrData) 205 { 206 $option_text = str_replace("'", "''", $arrData['title']); 207 $body = str_replace("'", "''", $arrData['body']); 208 $sql ="INSERT INTO ".$this->db->prefix("xoopspoll_option")." (poll_id, option_text, body, status, category_id, update_date) ". 209 "VALUES (".$arrData['poll_id'].", ".$option_text.", ".$body.", 1, ".$arrData['category_id'].", now())"; 210 211 $this->db->query($sql); 212 } 202 213 } 203 214 ?> -
temp/test-xoops.ec-cube.net/html/modules/xoopspoll/pollnew.php
r774 r777 33 33 include_once XOOPS_ROOT_PATH."/modules/xoopspoll/class/xoopspollrenderer.php"; 34 34 35 $arrForm = $_POST; 36 35 37 $poll_id = $_GET['poll_id']; 36 if(empty($poll_id)) $poll_id = $ _POST['poll_id'];38 if(empty($poll_id)) $poll_id = $arrForm['poll_id']; 37 39 38 40 switch($_POST['mode']) { 39 41 case 'regist': 40 $poll_id = $_POST['poll_id']; 41 $poll = new XoopsPoll($poll_id); 42 if ( $xoopsUser ) { 43 $uid = $xoopsUser->getVar("uid"); 44 } else { 45 $uid = 0; 42 // Error Check 43 $arrErr = lfErrCheck(); 44 if(count($arrErr) <= 0) { 45 $poll = new XoopsPoll($poll_id); 46 $poll->insertOption($arrForm); 47 redirect_header(XOOPS_URL."/modules/xoopspoll/pollresults.php?poll_id=".$poll_id, 1, "ÅÐÏ¿¤¬´°Î»Ãפ·¤Þ¤·¤¿¡£"); 48 exit(); 46 49 } 47 $poll->vote($option_id, xoops_getenv('REMOTE_ADDR'), $uid, $_POST['rating_id'], $_POST['comment']);48 $poll->updateCount();49 redirect_header(XOOPS_URL."/modules/xoopspoll/pollresults.php?poll_id=".$poll_id, 1, $msg);50 exit();51 50 break; 52 51 default: … … 57 56 include XOOPS_ROOT_PATH."/header.php"; 58 57 58 $xoopsTpl->assign('arrForm', $arrForm); 59 $xoopsTpl->assign('arrErr', $arrErr); 59 60 $xoopsTpl->assign('arrStatus', $arrStatus); 60 61 $xoopsTpl->assign('arrCat', $arrCategory); … … 62 63 63 64 include XOOPS_ROOT_PATH."/footer.php"; 65 66 //--------------------------------------------------------------------------------------------------- 67 68 function lfErrCheck($arrForm) { 69 70 $title_len = 50; 71 $body_len = 500; 72 73 $arrErr = array(); 74 75 if(empty($arrForm['title'])) { 76 $arrErr['title'] = " ¢¨ ¥¿¥¤¥È¥ë¤òÆþÎϤ·¤Æ²¼¤µ¤¤¡£"; 77 } else { 78 if(mb_strlen($arrForm['title']) > $title_len) $arrErr['title'] = " ¢¨ ¥¿¥¤¥È¥ë¤Ï$title_lenʸ»ú°ÊÆâ¤ÇÆþÎϤ·¤Æ²¼¤µ¤¤¡£"; 79 } 80 81 if(empty($arrForm['body'])) { 82 $arrErr['body'] = " ¢¨ ÆâÍÆ¤òÆþÎϤ·¤Æ²¼¤µ¤¤¡£"; 83 } else { 84 if(mb_strlen($arrForm['body']) > $title_len) $arrErr['title'] = " ¢¨ ÆâÍÆ¤Ï$body_lenʸ»ú°ÊÆâ¤ÇÆþÎϤ·¤Æ²¼¤µ¤¤¡£"; 85 } 86 87 return $arrErr; 88 } 89 64 90 ?> -
temp/test-xoops.ec-cube.net/html/modules/xoopspoll/templates/xoopspoll_new.html
r776 r777 23 23 24 24 <table> 25 <{ }>25 <{section name=cnt loop=$arrErr}> 26 26 <tr> 27 <td>< /td>27 <td><{$arrErr[cnt]}></td> 28 28 </tr> 29 <{/section}> 29 30 </table> 30 31
Note: See TracChangeset
for help on using the changeset viewer.
