Пример #1
0
 /**
  * ฟังก์ชั่นตรวจสอบการ Login
  */
 public function chklogin()
 {
     if (self::$request->initSession() && self::$request->isSafe()) {
         // กำหนด skin ให้กับ template
         Template::init(self::$cfg->skin);
         // ตรวจสอบการ login
         Login::create();
         // ตรวจสอบสมาชิก
         $login = Login::isMember();
         if ($login) {
             $name = trim($login['fname'] . ' ' . $login['lname']);
             $ret = array('alert' => str_replace('%s', empty($name) ? $login['email'] : $name, Language::get('Welcome %s, login complete')), 'content' => rawurlencode(\Index\Login\Controller::init($login)), 'action' => self::$request->post('login_action', self::$cfg->login_action)->toString());
             // clear
             self::$request->removeToken();
         } else {
             $ret = array('alert' => Login::$login_message, 'input' => Login::$login_input);
         }
         // คืนค่า JSON
         echo json_encode($ret);
     }
 }
Пример #2
0
 /**
  * ouput เป็น HTML.
  *
  * @param string|null $template HTML Template ถ้าไม่กำหนด (null) จะใช้ index.html
  * @return string
  */
 public function renderHTML($template = null)
 {
     // เนื้อหา
     parent::setContents(array('/{LOGIN}/' => method_exists('Index\\Login\\Controller', 'init') ? \Index\Login\Controller::init(Login::isMember()) : '', '/{WIDGET_([A-Z]+)(([_\\s]+)([^}]+))?}/e' => '\\Gcms\\View::getWidgets(array(1=>"$1",3=>"$3",4=>"$4"))', '/{BREADCRUMBS}/' => implode('', $this->breadcrumbs), '/{FONTSIZE}/' => '<a class="font_size small" title="{LNG_change font small}">A<sup>-</sup></a><a class="font_size normal" title="{LNG_change font normal}">A</a><a class="font_size large" title="{LNG_change font large}">A<sup>+</sup></a>', '/{VERSION}/' => self::$cfg->version, '/{ELAPSED}/' => round(microtime(true) - REQUEST_TIME, 4), '/{QURIES}/' => \Kotchasan\Database\Driver::queryCount()));
     return parent::renderHTML($template);
 }