public static function add(Response $response) { $keyList = []; $valList = []; foreach ($response as $key => $val) { if (is_array($val)) { foreach ($val as $key1 => $val1) { if (is_array($val1)) { continue; } $keyList[] = '[' . $key . '][' . $key1 . ']'; $valList[] = $val1; } } else { if (($loc = strpos($key, '[')) !== false) { $keyList[] = '[' . substr($key, 0, $loc) . ']' . substr($key, $loc); } else { $keyList[] = '[' . $key . ']'; } $valList[] = $val; } } $flatKeyList = join(',', $keyList); $hash = md5($flatKeyList . join('', $valList)); $response->set(self::CHECKSUM, [$flatKeyList, $hash]); }
private function loginForm() { $jsUrl = Cfg::get('js_url'); $jQuery = <<<JS \$().ready(function() { \$('#hoverimage').hover ( function () { \$('#extralinks').fadeIn('fast'); }, function () { setTimeout("\$('#extralinks').fadeOut();", 3000 ); }); \$('a.facebox').facebox({closeImage: '{$jsUrl}/images/closelabel.png', loadingImage: '{$jsUrl}/images/loading.gif' }); }); JS; $formName = 'FancyLogin_loginForm'; $valid = Validator::factory($formName, 'LF')->addExists(self::LOGIN_FNAME, 'Email field must not be empty')->addExists(self::PASSW_FNAME, 'Password field must not be empty'); $resp = new Response(); $html = JS::library(JS::JQUERY) . JS::libraryWithDependancies(JS::FACEBOX) . JS::javaScript($jQuery) . Tag::table() . Tag::tr() . Tag::td(['id' => 'hoverimage', 'class' => 'login', 'nowrap' => 'nowrap']) . $valid->toHtml() . Tag::form(['id' => $formName, 'name' => $formName, 'onSubmit' => $valid->onSubmit()]) . $resp->set(self::ACTION, __CLASS__ . '->checkLogin()')->toHidden() . Tag::table() . Tag::tr() . Tag::td() . 'Email' . Tag::_td() . Tag::td() . Tag::text(self::LOGIN_FNAME, ['size' => 10, 'style' => 'opacity:0.5;filter:alpha(opacity=50)']) . Tag::_td() . Tag::td() . 'Password:'******'size' => 10, 'style' => 'opacity:0.5;filter:alpha(opacity=50)']) . Tag::_td() . Tag::td() . Tag::submit('Go') . Tag::_td() . Tag::_tr() . Tag::_table() . Tag::_form() . Tag::_td() . Tag::_tr() . Tag::tr() . Tag::td(['id' => 'extralinks', 'style' => 'display: none;']) . Tag::ul(['id' => 'vertMenu']); if (Cfg::get('jb_self_register', false)) { $html .= Tag::li() . Tag::hRef('ajax.php?' . $resp->action(__CLASS__ . '->newRegistration()')->toUrl(), 'Register New Account', ['class' => 'facebox']) . Tag::_li(); } $html .= Tag::li() . Tag::hRef('ajax.php?' . $resp->action(__CLASS__ . '->forgotPassword()')->toUrl(), 'Forgot My Password', ['class' => 'facebox']) . Tag::_li() . Tag::_ul() . Tag::_td() . Tag::_tr() . Tag::_table(); return $html; }