Пример #1
0
 /**
  * @covers Xmlnuke\Util\DateUtil::Today
  * @todo   Implement testToday().
  */
 public function testToday()
 {
     $date1 = date('d/m/Y');
     $date2 = DateUtil::Today(DATEFORMAT::DMY);
     $this->assertEquals($date1, $date2);
     $date1 = date('m/d/Y');
     $date2 = DateUtil::Today(DATEFORMAT::MDY);
     $this->assertEquals($date1, $date2);
     $date1 = date('Y/m/d');
     $date2 = DateUtil::Today(DATEFORMAT::YMD);
     $this->assertEquals($date1, $date2);
     $date1 = date('Y-m-d');
     $date2 = DateUtil::Today(DATEFORMAT::YMD, '-');
     $this->assertEquals($date1, $date2);
     $date1 = date('Y/m/d H:i:s');
     $date2 = DateUtil::Today(DATEFORMAT::YMD, '/', true);
     $this->assertEquals($date1, $date2);
 }
Пример #2
0
 /**
  * Enter description here...
  *
  * @param string $caption
  * @param string $name
  * @param DATEFORMAT $dateformat
  * @param bool $showhour
  * @param string $date
  * @param string $time
  * @return XmlInputDateTime
  */
 public function __construct($caption, $name, $dateformat, $showhour = true, $date = "", $time = "")
 {
     $this->_caption = $caption;
     $this->_name = $name;
     $this->_dateformat = $dateformat;
     if ($date != "") {
         $this->_date = $date;
     } else {
         $this->_date = DateUtil::Today($dateformat);
     }
     if ($time != "") {
         $this->_time = $time;
     } else {
         $this->_time = date("H:i");
     }
     $this->_showHour = $showhour;
     $this->_yearmin = "c-5";
     $this->_yearmax = "c+5";
 }
Пример #3
0
 /**
  * Forgot Password Confirm
  *
  */
 protected function ResetPasswordConfirm()
 {
     $myWords = $this->WordCollection();
     if (!$this->_login->getCanRetrievePassword()) {
         $this->FormLogin();
         return;
     } elseif ($this->_login->getPassword() == "" || $this->_context->get('password2') == "") {
         $container = new XmlnukeUIAlert($this->_context, UIAlert::BoxAlert);
         $container->setAutoHide(5000);
         $container->addXmlnukeObject(new XmlnukeText($myWords->Value("PASSWORDISREQUIRED"), true));
         $this->_blockCenter->addXmlnukeObject($container);
         $this->ResetPassword();
         return;
     } elseif ($this->_login->getPassword() != $this->_context->get('password2')) {
         $container = new XmlnukeUIAlert($this->_context, UIAlert::BoxAlert);
         $container->setAutoHide(5000);
         $container->addXmlnukeObject(new XmlnukeText($myWords->Value("PASSWORDNOTMATCH"), true));
         $this->_blockCenter->addXmlnukeObject($container);
         $this->ResetPassword();
         return;
     }
     $user = $this->_users->getUserName($this->_login->getUsername());
     $tokenValid = $user->getField("TOKEN_PWD_RESET") == $this->_login->getResetToken() && $user->getField("TOKEN_PWD_RESET_VALID") >= DateUtil::Today(DATEFORMAT::YMD);
     if (is_null($user) || !$tokenValid) {
         $this->FormLogin();
     } elseif ($user->getField("TOKEN_PWD_RESET") != $this->_login->getResetToken()) {
         $container = new XmlnukeUIAlert($this->_context, UIAlert::BoxAlert);
         $container->setAutoHide(5000);
         $container->addXmlnukeObject(new XmlnukeText($myWords->Value("RESETINVALIDTOKEN"), true));
         $this->_blockCenter->addXmlnukeObject($container);
         $this->FormLogin();
         return;
     } else {
         $newpassword = $this->_users->getSHAPassword($this->_login->getPassword());
         $user->setField('TOKEN_PWD_RESET', '');
         $user->setField('TOKEN_PWD_RESET_VALID', '');
         $user->setField($this->_users->getUserTable()->password, $newpassword);
         $this->_users->Save();
         $container = new XmlnukeUIAlert($this->_context, UIAlert::ModalDialog, "");
         $container->addRedirectButton($myWords->Value("TXT_BACK"), $this->_login->getReturnUrl());
         $container->addXmlnukeObject(new XmlnukeText($myWords->Value("RESETPASSWORDOK"), true));
         $this->_blockCenter->addXmlnukeObject($container);
         $this->FormLogin();
     }
 }