Changeset 2335
- Timestamp:
- 11/16/05 23:06:18 (3 years ago)
- Files:
-
- trunk/jaws/html/gadgets/Chatbox/ChatboxHTML.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/jaws/html/gadgets/Chatbox/ChatboxHTML.php
r2295 r2335 103 103 require_once JAWS_PATH . 'include/JawsCaptcha.php'; 104 104 $jawsCaptchas =& new JawsCaptcha(); 105 $md5 = $jawsCaptchas->Random(); 106 $tpl->SetBlock('display/captcha'); 107 $tpl->SetVariable('captchacode', _t('GLOBAL_CAPTCHA_CODE')); 108 $tpl->SetVariable('captcha', _t('GLOBAL_CAPTCHA')); 109 $tpl->SetVariable('captchakey', $md5); 110 $tpl->SetVariable('captchaurl', 'index.php?gadget=Chatbox&action=Captcha&key='.$md5); 111 $tpl->ParseBlock('display/captcha'); 105 if ($jawsCaptchas->CanBeUsed()) { 106 $md5 = $jawsCaptchas->Random(); 107 $tpl->SetBlock('display/captcha'); 108 $tpl->SetVariable('captchacode', _t('GLOBAL_CAPTCHA_CODE')); 109 $tpl->SetVariable('captcha', _t('GLOBAL_CAPTCHA')); 110 $tpl->SetVariable('captchakey', $md5); 111 $tpl->SetVariable('captchaurl', 'index.php?gadget=Chatbox&action=Captcha&key='.$md5); 112 $tpl->ParseBlock('display/captcha'); 113 } 112 114 } 113 115 … … 146 148 require_once JAWS_PATH . 'include/JawsTypes/JawsHeader.php'; 147 149 148 $urlRedirect = (empty($_SERVER['QUERY_STRING'])) ? 'index.php?' . $_SERVER['QUERY_STRING'] : 'index.php'; 150 $urlRedirect = 'index.php'; 151 if (isset($_SERVER['HTTP_REFERER'])) { 152 if (!empty($_SERVER['HTTP_REFERER'])) { 153 $urlRedirect = $_SERVER['HTTP_REFERER']; 154 } 155 } 149 156 if ($GLOBALS['app']->Registry->Get('/gadgets/AntiSpam/allow_captchas') == 'yes' && 150 157 $GLOBALS['app']->Registry->Get('/gadgets/Chatbox/use_antispam') == 'true') { 151 if (isset($_POST['captcha']) && isset($_POST['captchaKey'])) { 152 require_once JAWS_PATH . 'include/JawsCaptcha.php'; 153 $jawsCaptchas =& new JawsCaptcha(); 154 if (!$jawsCaptchas->IsValid($_POST['captchaKey'], $_POST['captcha'])) { 158 159 require_once JAWS_PATH . 'include/JawsCaptcha.php'; 160 $jawsCaptchas =& new JawsCaptcha(); 161 162 if ($jawsCaptchas->CanBeUsed()) { 163 if (isset($_POST['captcha']) && isset($_POST['captchaKey'])) { 164 if (!$jawsCaptchas->IsValid($_POST['captchaKey'], $_POST['captcha'])) { 165 JawsHeader::Location($urlRedirect); 166 } 167 } else { 155 168 JawsHeader::Location($urlRedirect); 156 169 } 157 } else {158 JawsHeader::Location($urlRedirect);159 170 } 160 171 } … … 169 180 } 170 181 JawsHeader::Location($urlRedirect); 182 } 183 184 /** 185 * Format a date using Jaws 186 * 187 * @param string $value The data to format. 188 * @return string The formatted date. 189 */ 190 function FormatDate($value) 191 { 192 return $GLOBALS['app']->Date->Format($value); 171 193 } 172 194 … … 204 226 $datagrid->AddColumn(Piwi::CreateWidget('Column', _t('GLOBAL_NAME'), 'name')); 205 227 $datagrid->AddColumn(Piwi::CreateWidget('Column', _t('GLOBAL_IP'), 'ip_address')); 206 $datagrid->AddColumn(Piwi::CreateWidget('Column', _t('GLOBAL_DATE'), 'updatetime')); 228 $datagrid->AddColumn(Piwi::CreateWidget('Column', _t('GLOBAL_DATE'), 'updatetime', 229 true, 'Custom', true, '', array($this, 'FormatDate'))); 207 230 $datagrid->AddColumn(Piwi::CreateWidget('Column', _t('CHATBOX_MESSAGE'), 'message')); 208 231
