/**
  * Ejemplo de evento
  *
  * @param $params
  * @return string
  */
 public function onClikSavePasswd($datForm)
 {
     if ($this->MYFORM_validate($datForm, array('user_name', 'passwd1', 'passwd2'))) {
         $OPF_passwd = new OPF_passwd();
         if ($OPF_passwd->validateUser($datForm['user_name'])) {
             if ($OPF_passwd->validatePasswd($datForm['user_name'], $datForm['passwd'])) {
                 if (!strcmp($datForm['passwd1'], $datForm['passwd2'])) {
                     $ess_system_users = new ess_system_users();
                     $ess_system_users->find($_SESSION['user_id']);
                     $ess_system_users->passwd = md5($datForm['user_name'] . $datForm['passwd']);
                     if ($OPF_passwd->setNewPasswd($datForm['user_name'], $datForm['passwd1'])) {
                         $this->notificationWindow(OPF_myLang::getPhrase('MSG_CAMBIOS_GUARDADOS'), 3, 'ok');
                         $this->clear('user_name', 'value');
                         $this->clear('passwd', 'value');
                         $this->clear('passwd1', 'value');
                         $this->clear('passwd2', 'value');
                     } else {
                         $this->messageBox($ess_system_users->getErrorLog() . $ess_system_users->getSqlLog(), 'error');
                     }
                 } else {
                     $this->notificationWindow(OPF_myLang::getPhrase('OPF_PASSWD_1'), 3, 'error');
                 }
             } else {
                 $this->notificationWindow(OPF_myLang::getPhrase('OPF_PASSWD_2'), 3, 'error');
             }
         } else {
             $this->notificationWindow(OPF_myLang::getPhrase('OPF_PASSWD_3'), 3, 'error');
             $this->redirect('../OPF_logout/');
         }
     } else {
         $this->notificationWindow(OPF_myLang::getPhrase('MSG_CAMPOS_REQUERIDOS'), 3, 'error');
     }
     return $this->response;
 }
Ejemplo n.º 2
0
 public function getFormAgrUsr($user_id = '')
 {
     $ess_profiles = new ess_profiles();
     $profilesArray = array();
     foreach ($ess_profiles->find() as $profile) {
         $profilesArray[$profile->id] = $profile->name;
     }
     $ess_system_users = new ess_system_users();
     $myForm = new OPF_myForm('getFormAgrUsr');
     if ($user_id) {
         $ess_system_users->find($user_id);
         $myForm->addDisabled('user_name');
     }
     $myForm->styleClassForm = '';
     $myForm->addText(OPF_myLang::getPhrase('OPF_ADMUSR_1'), 'user_name', $ess_system_users->user_name, 15);
     $myForm->addText(OPF_myLang::getPhrase('OPF_ADMUSR_2'), 'name', $ess_system_users->name, 15);
     $myForm->addText(OPF_myLang::getPhrase('OPF_ADMUSR_3'), 'lastname', $ess_system_users->lastname, 15);
     $myForm->addPassword(OPF_myLang::getPhrase('OPF_ADMUSR_4'), 'passwd1', $ess_system_users->passwd, 15);
     $myForm->addPassword(OPF_myLang::getPhrase('OPF_ADMUSR_5'), 'passwd', $ess_system_users->passwd, 15);
     $myForm->addSelect(OPF_myLang::getPhrase('OPF_ADMUSR_6'), 'profile_id', $profilesArray, $ess_system_users->profile_id);
     $status = false;
     if ($ess_system_users->status == 1) {
         $status = true;
     }
     $myForm->addCheckBox(OPF_myLang::getPhrase('OPF_ADMUSR_7'), 'status', $status);
     $myForm->addButton('btnsave', OPF_myLang::getPhrase('LABEL_BTN_SAVE'), 'save.gif');
     $myForm->addEvent('btnsave', 'onclick', 'onClickSaveRecord', $user_id);
     return $myForm->getForm(1);
 }
Ejemplo n.º 3
0
 public function autenticate($datForm)
 {
     $return = false;
     $ess_system_users = new ess_system_users();
     if ($ess_system_users->find('user_name = ' . $datForm['user_opf_ess'] . ' & passwd = ' . md5($datForm['user_opf_ess'] . $datForm['passwd_opf_ess']) . ' & status = 1')) {
         $return = true;
         $_SESSION['user_id'] = $ess_system_users->id;
         $_SESSION['ip'] = $_SERVER['REMOTE_ADDR'];
         $_SESSION['datetime'] = date("Y-m-d H:i:s");
         $_SESSION['profile_id'] = $ess_system_users->profile_id;
         if ($datForm['rem_usr']) {
             setcookie("user_opf_ess", $datForm['user_opf_ess']);
         } else {
             setcookie("user_opf_ess", "");
         }
     } else {
         $this->errorLogIn = OPF_myLang::getPhrase('OPF_LOGIN_1');
     }
     return $return;
 }
Ejemplo n.º 4
0
<?php

/**
 * Vista inicial.
 *
 * @author José Ignacio Gutiérrez Guzmán <*****@*****.**>
 * @link http://www.osezno-framework.org/
 * @copyright Copyright &copy; 2007-2012 Osezno PHP Framework
 * @license http://www.osezno-framework.org/license.txt
 */
/**
 * Asignar contenidos a areas de la plantilla
 */
OPF_osezno::assign('path_js_tree', BASE_URL_PATH);
if (isset($_SESSION['profile_id'])) {
    $struct_menu = new struct_menu();
    OPF_osezno::assign('menu_struct', $struct_menu->getJsMenu());
}
$ess_system_users = new ess_system_users();
$ess_system_users->find($_SESSION['user_id']);
OPF_osezno::assign('user_login', OPF_myLang::getPhrase('OPF_LOGIN_31') . '&nbsp;' . $ess_system_users->name);
OPF_osezno::assign('open_all', OPF_myLang::getPhrase('OPF_OPTIONS_1'));
OPF_osezno::assign('close_all', OPF_myLang::getPhrase('OPF_OPTIONS_2'));
OPF_osezno::assign('home_etq', '&nbsp;<b>' . OPF_myLang::getPhrase('APP_DESC') . '</b>');
if (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') === FALSE) {
    OPF_osezno::assign('essentials', 'OseznoPHP');
}
/**
 * Mostrar la plantilla
 */
OPF_osezno::call_template('options' . DS . 'options.tpl');