@@ -106,6 +106,7 @@ |
||
| 106 | 106 | /** |
| 107 | 107 | * Get variables passed by GET or POST method |
| 108 | 108 | * |
| 109 | + * @param string $key |
|
| 109 | 110 | */ |
| 110 | 111 | public function Contact_CleanVars(&$global, $key, $default = '', $type = 'int') |
| 111 | 112 | { |
@@ -60,20 +60,20 @@ discard block |
||
| 60 | 60 | global $xoopsConfig; |
| 61 | 61 | $form = new XoopsThemeForm(_AM_CONTACT_REPLY, 'doreply', 'contact.php', 'post', true); |
| 62 | 62 | $form->setExtra('enctype="multipart/form-data"'); |
| 63 | - $form->addElement(new XoopsFormHidden ('op', 'doreply')); |
|
| 64 | - $form->addElement(new XoopsFormHidden ('contact_id', $this->getVar('contact_id', 'e'))); |
|
| 65 | - $form->addElement(new XoopsFormHidden ('contact_uid', $this->getVar('contact_uid', 'e'))); |
|
| 63 | + $form->addElement(new XoopsFormHidden('op', 'doreply')); |
|
| 64 | + $form->addElement(new XoopsFormHidden('contact_id', $this->getVar('contact_id', 'e'))); |
|
| 65 | + $form->addElement(new XoopsFormHidden('contact_uid', $this->getVar('contact_uid', 'e'))); |
|
| 66 | 66 | $form->addElement(new XoopsFormLabel(_AM_CONTACT_FROM, '', '')); |
| 67 | 67 | $form->addElement( |
| 68 | - new XoopsFormText (_AM_CONTACT_NAMEFROM, 'contact_name', 50, 255, XoopsUser::getUnameFromId($GLOBALS['xoopsUser']->uid())), |
|
| 68 | + new XoopsFormText(_AM_CONTACT_NAMEFROM, 'contact_name', 50, 255, XoopsUser::getUnameFromId($GLOBALS['xoopsUser']->uid())), |
|
| 69 | 69 | true |
| 70 | 70 | ); |
| 71 | - $form->addElement(new XoopsFormText (_AM_CONTACT_MAILFROM, 'contact_mail', 50, 255, $GLOBALS['xoopsUser']->getVar('email')), true); |
|
| 71 | + $form->addElement(new XoopsFormText(_AM_CONTACT_MAILFROM, 'contact_mail', 50, 255, $GLOBALS['xoopsUser']->getVar('email')), true); |
|
| 72 | 72 | $form->addElement(new XoopsFormLabel(_AM_CONTACT_TO, '', '')); |
| 73 | - $form->addElement(new XoopsFormText (_AM_CONTACT_NAMETO, 'contact_nameto', 50, 255, $this->getVar('contact_name')), true); |
|
| 74 | - $form->addElement(new XoopsFormText (_AM_CONTACT_MAILTO, 'contact_mailto', 50, 255, $this->getVar('contact_mail')), true); |
|
| 75 | - $form->addElement(new XoopsFormText (_AM_CONTACT_SUBJECT, 'contact_subject', 50, 255, _RE . $this->getVar('contact_subject')), true); |
|
| 76 | - $form->addElement(new XoopsFormTextArea (_AM_CONTACT_MESSAGE, 'contact_message', '', 5, 60), true); |
|
| 73 | + $form->addElement(new XoopsFormText(_AM_CONTACT_NAMETO, 'contact_nameto', 50, 255, $this->getVar('contact_name')), true); |
|
| 74 | + $form->addElement(new XoopsFormText(_AM_CONTACT_MAILTO, 'contact_mailto', 50, 255, $this->getVar('contact_mail')), true); |
|
| 75 | + $form->addElement(new XoopsFormText(_AM_CONTACT_SUBJECT, 'contact_subject', 50, 255, _RE . $this->getVar('contact_subject')), true); |
|
| 76 | + $form->addElement(new XoopsFormTextArea(_AM_CONTACT_MESSAGE, 'contact_message', '', 5, 60), true); |
|
| 77 | 77 | $form->addElement(new XoopsFormButton('', 'submit', _SUBMIT, 'submit')); |
| 78 | 78 | |
| 79 | 79 | return $form; |
@@ -254,9 +254,9 @@ discard block |
||
| 254 | 254 | public function Contact_GetReply($contact_id) |
| 255 | 255 | { |
| 256 | 256 | |
| 257 | - $criteria = new CriteriaCompo (); |
|
| 258 | - $criteria->add(new Criteria ('contact_cid', $contact_id)); |
|
| 259 | - $criteria->add(new Criteria ('contact_type', 'Contact')); |
|
| 257 | + $criteria = new CriteriaCompo(); |
|
| 258 | + $criteria->add(new Criteria('contact_cid', $contact_id)); |
|
| 259 | + $criteria->add(new Criteria('contact_type', 'Contact')); |
|
| 260 | 260 | $contacts = $this->getObjects($criteria, false); |
| 261 | 261 | if ($contacts) { |
| 262 | 262 | $ret = array(); |
@@ -277,9 +277,9 @@ discard block |
||
| 277 | 277 | public function Contact_GetAdminList($contact, $id) |
| 278 | 278 | { |
| 279 | 279 | $ret = array(); |
| 280 | - $criteria = new CriteriaCompo (); |
|
| 281 | - $criteria->add(new Criteria ($id, '0')); |
|
| 282 | - $criteria->add(new Criteria ('contact_type', 'Contact')); |
|
| 280 | + $criteria = new CriteriaCompo(); |
|
| 281 | + $criteria->add(new Criteria($id, '0')); |
|
| 282 | + $criteria->add(new Criteria('contact_type', 'Contact')); |
|
| 283 | 283 | $criteria->setSort($contact['sort']); |
| 284 | 284 | $criteria->setOrder($contact['order']); |
| 285 | 285 | $criteria->setStart($contact['start']); |
@@ -303,9 +303,9 @@ discard block |
||
| 303 | 303 | */ |
| 304 | 304 | public function Contact_GetCount($id) |
| 305 | 305 | { |
| 306 | - $criteria = new CriteriaCompo (); |
|
| 307 | - $criteria->add(new Criteria ($id, '0')); |
|
| 308 | - $criteria->add(new Criteria ('contact_type', 'Contact')); |
|
| 306 | + $criteria = new CriteriaCompo(); |
|
| 307 | + $criteria->add(new Criteria($id, '0')); |
|
| 308 | + $criteria->add(new Criteria('contact_type', 'Contact')); |
|
| 309 | 309 | |
| 310 | 310 | return $this->getCount($criteria); |
| 311 | 311 | } |
@@ -323,10 +323,10 @@ discard block |
||
| 323 | 323 | */ |
| 324 | 324 | public function Contact_PruneCount($timestamp, $onlyreply) |
| 325 | 325 | { |
| 326 | - $criteria = new CriteriaCompo (); |
|
| 327 | - $criteria->add(new Criteria ('contact_create', $timestamp, '<=')); |
|
| 326 | + $criteria = new CriteriaCompo(); |
|
| 327 | + $criteria->add(new Criteria('contact_create', $timestamp, '<=')); |
|
| 328 | 328 | if ($onlyreply) { |
| 329 | - $criteria->add(new Criteria ('contact_reply', 1)); |
|
| 329 | + $criteria->add(new Criteria('contact_reply', 1)); |
|
| 330 | 330 | } |
| 331 | 331 | |
| 332 | 332 | return $this->getCount($criteria); |
@@ -337,10 +337,10 @@ discard block |
||
| 337 | 337 | */ |
| 338 | 338 | public function Contact_DeleteBeforeDate($timestamp, $onlyreply) |
| 339 | 339 | { |
| 340 | - $criteria = new CriteriaCompo (); |
|
| 341 | - $criteria->add(new Criteria ('contact_create', $timestamp, '<=')); |
|
| 340 | + $criteria = new CriteriaCompo(); |
|
| 341 | + $criteria->add(new Criteria('contact_create', $timestamp, '<=')); |
|
| 342 | 342 | if ($onlyreply) { |
| 343 | - $criteria->add(new Criteria ('contact_reply', 1)); |
|
| 343 | + $criteria->add(new Criteria('contact_reply', 1)); |
|
| 344 | 344 | } |
| 345 | 345 | $this->deleteAll($criteria); |
| 346 | 346 | } |
@@ -67,7 +67,7 @@ |
||
| 67 | 67 | if (!$contact_handler->insert($obj)) { |
| 68 | 68 | redirect_header("index.php", 3, _MD_CONTACT_MES_NOTSAVE); |
| 69 | 69 | exit(); |
| 70 | - } |
|
| 70 | + } |
|
| 71 | 71 | } |
| 72 | 72 | |
| 73 | 73 | // send mail can send message |
@@ -28,25 +28,25 @@ |
||
| 28 | 28 | /** reCaptcha by google **/ |
| 29 | 29 | global $xoopsConfig; |
| 30 | 30 | |
| 31 | -if(isset($_POST['g-recaptcha-response'])){ |
|
| 32 | - $captcha=$_POST['g-recaptcha-response']; |
|
| 31 | +if (isset($_POST['g-recaptcha-response'])) { |
|
| 32 | + $captcha = $_POST['g-recaptcha-response']; |
|
| 33 | 33 | } |
| 34 | 34 | |
| 35 | -if(!$captcha && $xoopsModuleConfig['useCaptcha']){ |
|
| 35 | +if (!$captcha && $xoopsModuleConfig['useCaptcha']) { |
|
| 36 | 36 | redirect_header("index.php", 2, _MD_CONTACT_MES_NOCAPTCHA); |
| 37 | 37 | } |
| 38 | 38 | else { |
| 39 | - $response=file_get_contents("https://www.google.com/recaptcha/api/siteverify?secret=".$xoopsModuleConfig['captchaSecretKey']."&response=".$captcha."&remoteip=".$_SERVER['REMOTE_ADDR']); |
|
| 40 | - if($response.success==false && $xoopsModuleConfig['useCaptcha']) |
|
| 39 | + $response = file_get_contents("https://www.google.com/recaptcha/api/siteverify?secret=" . $xoopsModuleConfig['captchaSecretKey'] . "&response=" . $captcha . "&remoteip=" . $_SERVER['REMOTE_ADDR']); |
|
| 40 | + if ($response . success == false && $xoopsModuleConfig['useCaptcha']) |
|
| 41 | 41 | { |
| 42 | 42 | redirect_header("index.php", 2, _MD_CONTACT_MES_CAPTCHAINCORRECT); |
| 43 | - }else{ |
|
| 43 | + } else { |
|
| 44 | 44 | |
| 45 | 45 | global $xoopsConfig, $xoopsOption, $xoopsTpl, $xoopsUser, $xoopsUserIsAdmin, $xoopsLogger; |
| 46 | 46 | $op = $contact_handler->Contact_CleanVars($_POST, 'op', 'form', 'string'); |
| 47 | 47 | $department = $contact_handler->Contact_CleanVars($_GET, 'department', '', 'string'); |
| 48 | - if($op == "save") { |
|
| 49 | - if (empty($_POST['submit']) ) { |
|
| 48 | + if ($op == "save") { |
|
| 49 | + if (empty($_POST['submit'])) { |
|
| 50 | 50 | redirect_header(XOOPS_URL, 3, _MD_CONTACT_MES_ERROR); |
| 51 | 51 | exit(); |
| 52 | 52 | } else { |
@@ -34,13 +34,12 @@ |
||
| 34 | 34 | |
| 35 | 35 | if(!$captcha && $xoopsModuleConfig['useCaptcha']){ |
| 36 | 36 | redirect_header("index.php", 2, _MD_CONTACT_MES_NOCAPTCHA); |
| 37 | -} |
|
| 38 | -else { |
|
| 37 | +} else { |
|
| 39 | 38 | $response=file_get_contents("https://www.google.com/recaptcha/api/siteverify?secret=".$xoopsModuleConfig['captchaSecretKey']."&response=".$captcha."&remoteip=".$_SERVER['REMOTE_ADDR']); |
| 40 | 39 | if($response.success==false && $xoopsModuleConfig['useCaptcha']) |
| 41 | 40 | { |
| 42 | 41 | redirect_header("index.php", 2, _MD_CONTACT_MES_CAPTCHAINCORRECT); |
| 43 | - }else{ |
|
| 42 | + } else{ |
|
| 44 | 43 | |
| 45 | 44 | global $xoopsConfig, $xoopsOption, $xoopsTpl, $xoopsUser, $xoopsUserIsAdmin, $xoopsLogger; |
| 46 | 45 | $op = $contact_handler->Contact_CleanVars($_POST, 'op', 'form', 'string'); |
@@ -181,9 +181,9 @@ |
||
| 181 | 181 | exit (); |
| 182 | 182 | } |
| 183 | 183 | |
| 184 | - $criteria = new CriteriaCompo (); |
|
| 185 | - $criteria->add(new Criteria ('contact_id', $contact_id)); |
|
| 186 | - $criteria->add(new Criteria ('contact_cid', $contact_id), 'OR'); |
|
| 184 | + $criteria = new CriteriaCompo(); |
|
| 185 | + $criteria->add(new Criteria('contact_id', $contact_id)); |
|
| 186 | + $criteria->add(new Criteria('contact_cid', $contact_id), 'OR'); |
|
| 187 | 187 | |
| 188 | 188 | if (!$contact_handler->deleteAll($criteria)) { |
| 189 | 189 | redirect_header('contact.php', 1, _AM_CONTACT_MSG_DELETEERROR); |
@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | global $xoopsConfig, $xoopsOption, $xoopsTpl, $xoopsUser, $xoopsUserIsAdmin, $xoopsLogger; |
| 29 | 29 | |
| 30 | 30 | $department = $contact_handler->Contact_CleanVars($_GET, 'department', '', 'string'); |
| 31 | - $obj = $contact_handler->create(); |
|
| 31 | + $obj = $contact_handler->create(); |
|
| 32 | 32 | |
| 33 | 33 | /*Modules Options*/ |
| 34 | 34 | if ($xoopsModuleConfig['form_dept'] == 1) { |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | |
| 57 | 57 | $xoopsTpl->assign('map', $xoopsModuleConfig['embed_maps']); |
| 58 | 58 | /*end Modules options*/ |
| 59 | - $xoopsTpl->assign('breadcrumb', '<li><a href="' . XOOPS_URL . '">' . _YOURHOME . '</a></li> <li class="active">' . $xoopsModule->name().'</li>'); |
|
| 59 | + $xoopsTpl->assign('breadcrumb', '<li><a href="' . XOOPS_URL . '">' . _YOURHOME . '</a></li> <li class="active">' . $xoopsModule->name() . '</li>'); |
|
| 60 | 60 | $xoopsTpl->assign('info', xoops_getModuleOption('contact_info', 'contact')); |
| 61 | 61 | |
| 62 | 62 | /* added by goffy */ |