Example #1
0
File: User.php Project: etienne/jam
 function Connect()
 {
     global $_JAM;
     // Check whether user has submitted the login form
     if ($_POST['connect']) {
         // Validate login
         $where = array("login = '******'login'] . "'", "password = '******'password'] . "'");
         if ($userInfo = Query::SingleRow('users', $where)) {
             // Login succeeded; create cookie and reload this page
             $this->Login($userInfo['id']);
             HTTP::ReloadCurrentURL();
             return true;
         } else {
             print e('p', array('class' => 'error'), $_JAM->strings['admin']['incorrectLogin']);
         }
     }
     // Display form if login was incorrect or user has not yet submitted the form
     $form = new Form();
     $form->Open();
     print $form->Field('login', 40, $_JAM->strings['admin']['login']);
     print $form->Password('password', 40, $_JAM->strings['admin']['password']);
     print $form->Submit('connect', $_JAM->strings['admin']['connect']);
     $form->Close();
 }
Example #2
0
 function Submit($label = '')
 {
     global $_JAM;
     $hidden = $this->Hidden('module', $this->module->name);
     $id = $this->module->item['master'] ? $this->module->item['master'] : $this->module->itemID;
     if ($id) {
         $hidden .= $this->Hidden('master', $id);
         $action = 'edit';
     } else {
         $action = 'add';
     }
     // Determine submit button string
     $customString = $label ? $label : $this->module->strings['fields'][$this->module->parentModule->name . '.' . $action];
     if (!($submitString = $customString)) {
         $submitString = $_JAM->strings['admin'][$action];
     }
     return $hidden . parent::Submit('update', $submitString);
 }