当前位置: 首页>>代码示例>>PHP>>正文


PHP Tools::makeHiddenPostvars方法代码示例

本文整理汇总了PHP中Sintattica\Atk\Core\Tools::makeHiddenPostvars方法的典型用法代码示例。如果您正苦于以下问题:PHP Tools::makeHiddenPostvars方法的具体用法?PHP Tools::makeHiddenPostvars怎么用?PHP Tools::makeHiddenPostvars使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Sintattica\Atk\Core\Tools的用法示例。


在下文中一共展示了Tools::makeHiddenPostvars方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: loginForm

 /**
  * Display a login form.
  *
  * @param string $defaultname The username that might already be known
  * @param int $lastresponse The lastresponse when trying to login
  *                             possible values:
  *                             SecurityManager::AUTH_MISMATCH,
  *                             SecurityManager::AUTH_LOCKED,
  *                             SecurityManager::AUTH_MISSINGUSERNAME,
  *                             SecurityManager::AUTH_PASSWORDSENT
  */
 public function loginForm($defaultname, $lastresponse)
 {
     $page = Page::getInstance();
     $ui = Ui::getInstance();
     $page->register_script(Config::getGlobal('assets_url') . 'javascript/tools.js');
     $tplvars = [];
     $output = '<form action="' . Config::getGlobal('dispatcher') . '" method="post">';
     $output .= Tools::makeHiddenPostvars(array('atklogout'));
     $output .= '<br><br><table border="0" cellspacing="2" cellpadding="0" align="center">';
     $tplvars['atksessionformvars'] = Tools::makeHiddenPostvars(['atklogout', 'auth_rememberme']);
     $tplvars['formurl'] = Config::getGlobal('dispatcher');
     $tplvars['username'] = Tools::atktext('username');
     $tplvars['password'] = Tools::atktext('password');
     $tplvars['userfield'] = '<input class="form-control loginform" type="text" size="20" id="auth_user" name="auth_user" value="' . htmlentities($defaultname) . '" />';
     $tplvars['passwordfield'] = '<input class="loginform" type="password" size="20" name="auth_pw" value="" />';
     $tplvars['submitbutton'] = '<input name="login" class="button" type="submit" value="' . Tools::atktext('login') . '" />';
     $tplvars['title'] = Tools::atktext('login_form');
     if ($lastresponse == self::AUTH_LOCKED) {
         $output .= '<tr><td colspan=3 class=error>' . Tools::atktext('auth_account_locked') . '<br><br></td></tr>';
         $tplvars['auth_account_locked'] = Tools::atktext('auth_account_locked');
         $tplvars['error'] = Tools::atktext('auth_account_locked');
     } elseif ($lastresponse == self::AUTH_MISMATCH) {
         $output .= '<tr><td colspan=3 class=error>' . Tools::atktext('auth_mismatch') . '<br><br></td></tr>';
         $tplvars['auth_mismatch'] = Tools::atktext('auth_mismatch');
         $tplvars['error'] = Tools::atktext('auth_mismatch');
     } elseif ($lastresponse == self::AUTH_MISSINGUSERNAME) {
         $output .= '<tr><td colspan="3" class=error>' . Tools::atktext('auth_missingusername') . '<br /><br /></td></tr>';
         $tplvars['auth_mismatch'] = Tools::atktext('auth_missingusername');
         $tplvars['error'] = Tools::atktext('auth_missingusername');
     } elseif ($lastresponse == self::AUTH_PASSWORDSENT) {
         $output .= '<tr><td colspan="3">' . Tools::atktext('auth_passwordmail_sent') . '<br /><br /></td></tr>';
         $tplvars['auth_mismatch'] = Tools::atktext('auth_passwordmail_sent');
     }
     if (Config::getGlobal('auth_enable_rememberme')) {
         $tplvars['auth_enable_rememberme'] = true;
         if (isset($_POST['auth_rememberme']) && $_POST['auth_rememberme'] == '1') {
             $tplvars['auth_rememberme'] = true;
         }
     }
     // generate the form
     $output .= '<tr><td valign=top>' . Tools::atktext('username') . '</td><td>:</td><td>' . $tplvars['userfield'] . '</td></tr>';
     $output .= '<tr><td colspan=3 height=6></td></tr>';
     $output .= '<tr><td valign=top>' . Tools::atktext('password') . "</td><td>:</td><td><input type=password size=15 name=auth_pw value='' /></td></tr>";
     $output .= '<tr><td colspan="3" align="center" height="50" valign="middle">';
     $output .= '<input name="login" class="button" type="submit" value="' . Tools::atktext('login') . '">';
     $tplvars['auth_enablepasswordmailer'] = $this->get_enablepasswordmailer();
     if ($this->get_enablepasswordmailer()) {
         $output .= '&nbsp;&nbsp;<input name="login" class="button" type="submit" value="' . Tools::atktext('password_forgotten') . '">';
         $tplvars['forgotpasswordbutton'] = '<input name="login" class="button" type="submit" value="' . Tools::atktext('password_forgotten') . '">';
     }
     $output .= '</td></tr>';
     $output .= '</table></form>';
     $tplvars['content'] = $output;
     $page->addContent($ui->render('login.tpl', $tplvars));
     $o = Output::getInstance();
     $o->output($page->render(Tools::atktext('app_title'), Page::HTML_STRICT, '', $ui->render('login_meta.tpl')));
 }
开发者ID:sintattica,项目名称:atk,代码行数:68,代码来源:SecurityManager.php


注:本文中的Sintattica\Atk\Core\Tools::makeHiddenPostvars方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。