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


PHP GWF_Time::getAge方法代码示例

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


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

示例1: validate_birthdate

 public function validate_birthdate(Module_Register $module, $arg)
 {
     if (!GWF_Time::isValidDate($arg, true, 8)) {
         return $this->module->lang('err_birthdate');
     }
     if (0 < ($minage = $this->module->getMinAge())) {
         if ($minage > ($age = GWF_Time::getAge($arg))) {
             return $this->module->lang('err_minage', array($minage));
         }
     }
     return false;
 }
开发者ID:sinfocol,项目名称:gwf3,代码行数:12,代码来源:Form.php

示例2: onChange

 private function onChange()
 {
     $back = '';
     $user = GWF_Session::getUser();
     $form = $this->getForm();
     if (false !== ($errors = $form->validate($this->module))) {
         return $errors;
     }
     # Upload Avatar
     if (false !== ($file = $form->getVar('avatar'))) {
         $back .= $this->saveAvatar($file);
         Common::unlink($file['tmp_name']);
     }
     # Flags
     if ($this->module->cfgShowAdult() && GWF_Time::getAge($user->getVar('user_birthdate')) > $this->module->cfgAdultAge()) {
         $back .= $this->changeFlag($user, 'adult', GWF_USER::WANTS_ADULT);
     }
     $back .= $this->changeFlag($user, 'online', GWF_USER::HIDE_ONLINE);
     $back .= $this->changeFlag($user, 'show_bday', GWF_USER::SHOW_BIRTHDAY);
     $back .= $this->changeFlag($user, 'show_obday', GWF_USER::SHOW_OTHER_BIRTHDAYS);
     $back .= $this->changeFlag($user, 'show_email', GWF_USER::SHOW_EMAIL);
     $back .= $this->changeFlag($user, 'allow_email', GWF_USER::ALLOW_EMAIL);
     # Flags IP recording
     $msg_record_disabled = $this->changeFlag($user, 'record_ips', GWF_USER::RECORD_IPS);
     if ($msg_record_disabled !== '') {
         $back .= $msg_record_disabled;
         if (!$user->isOptionEnabled(GWF_User::RECORD_IPS)) {
             GWF_AccountAccess::sendAlertMail($this->module, $user, 'record_disabled');
             unset($_POST['alert_uas'], $_POST['alert_ips'], $_POST['alert_isps']);
         }
     }
     $back .= $this->changeFlag($user, 'alert_uas', GWF_USER::ALERT_UAS);
     $back .= $this->changeFlag($user, 'alert_ips', GWF_USER::ALERT_IPS);
     $back .= $this->changeFlag($user, 'alert_isps', GWF_USER::ALERT_ISPS);
     # Email Format
     $newfmt = (int) $_POST['email_fmt'];
     $oldfmt = $user->isOptionEnabled(GWF_User::EMAIL_TEXT) ? GWF_User::EMAIL_TEXT : 0;
     if ($newfmt !== $oldfmt) {
         $user->saveOption(GWF_User::EMAIL_TEXT, $newfmt > 0);
         $back .= $this->module->message('msg_email_fmt_' . $newfmt);
     }
     # Change EMAIL
     $newmail = $form->getVar('email');
     $oldmail = $user->getVar('user_email');
     if ($newmail !== $oldmail) {
         require_once 'ChangeEmail.php';
         $back .= Account_ChangeEmail::changeEmail($this->module, $user, $newmail);
     }
     # Change Demo
     $demo_changed = false;
     $oldcid = (int) $user->getVar('user_countryid');
     $newcid = (int) $form->getVar('countryid');
     if ($oldcid !== $newcid) {
         $demo_changed = true;
     }
     $oldlid = (int) $user->getVar('user_langid');
     $newlid = (int) $form->getVar('langid');
     if ($oldlid !== $newlid) {
         $demo_changed = true;
     }
     $oldlid2 = (int) $user->getVar('user_langid2');
     $newlid2 = (int) $form->getVar('langid2');
     if ($oldlid2 !== $newlid2) {
         $demo_changed = true;
     }
     $oldgender = $user->getVar('user_gender');
     $newgender = $form->getVar('gender', GWF_User::NO_GENDER);
     if ($oldgender !== $newgender) {
         $demo_changed = true;
     }
     $oldbirthdate = $user->getVar('user_birthdate');
     $newbirthdate = $form->getVar('birthdate');
     if ($newbirthdate === '') {
         $newbirthdate = '00000000';
     }
     if ($oldbirthdate != $newbirthdate) {
         $demo_changed = true;
     }
     if ($demo_changed) {
         $data = array('user_countryid' => $newcid, 'user_langid' => $newlid, 'user_langid2' => $newlid2, 'user_gender' => $newgender, 'user_birthdate' => $newbirthdate);
         require_once 'ChangeDemo.php';
         $back .= Account_ChangeDemo::requestChange($this->module, $user, $data);
     }
     return $back;
 }
开发者ID:sinfocol,项目名称:gwf3,代码行数:85,代码来源:Form.php


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