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


PHP getCurrentUser函数代码示例

本文整理汇总了PHP中getCurrentUser函数的典型用法代码示例。如果您正苦于以下问题:PHP getCurrentUser函数的具体用法?PHP getCurrentUser怎么用?PHP getCurrentUser使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: populate

 function populate()
 {
     $employee = DataObjectFactory::Factory('Employee');
     $user = getCurrentUser();
     if (!is_null($user->person_id)) {
         $employee->loadBy('person_id', $user->person_id);
     }
     if ($employee->isLoaded()) {
         $authorisor_model = $employee->holiday_model();
         $employee->authorisationPolicy($authorisor_model);
         $authorisees = $employee->getAuthorisees($authorisor_model);
     } else {
         $authorisees = array();
     }
     $holiday = DataObjectFactory::Factory('HolidayRequest');
     $holidays = new HolidayrequestCollection($holiday);
     if (count($authorisees) > 0) {
         $holidays->setParams();
         $sh = new SearchHandler($holidays, false);
         $sh->setFields(array('id', 'employee', 'employee_id', 'start_date', 'end_date', 'num_days'));
         $sh->addConstraint(new Constraint('status', '=', $holiday->newRequest()));
         $sh->addConstraint(new Constraint('employee_id', 'in', '(' . implode(',', $authorisees) . ')'));
         $this->setSearchLimit($sh);
         $sh->setOrderby(array('employee', 'start_date'));
         $holidays->load($sh);
         $holidays->clickcontroller = 'holidayrequests';
         $holidays->editclickaction = 'view';
     }
     $this->contents = $holidays;
 }
开发者ID:uzerpllp,项目名称:uzerp,代码行数:30,代码来源:HolidaysWaitingAuthUZlet.php

示例2: Execute

 public function Execute()
 {
     $viewData = array();
     $errors = array();
     if (Helper::IsLoggedInAdmin() && isset($_GET["loginAsUser"])) {
         // login as a certain user and redirect to his page
         if (Helper::LoginUserByUsername($_GET["loginAsUser"])) {
             Helper::Redirect("index.php?" . Helper::CreateQuerystring(getCurrentUser()));
         }
     }
     $viewData["Users"] = DataAccess::GetAllUsers(!Helper::IsLoggedInAdmin());
     $viewData["LastMapForEachUser"] = DataAccess::GetLastMapsForUsers("date");
     // last x maps
     $numberOfMaps = isset($_GET["lastMaps"]) && is_numeric($_GET["lastMaps"]) ? (int) $_GET["lastMaps"] : (isset($_GET["lastMaps"]) && $_GET["lastMaps"] == "all" ? 999999 : 10);
     $viewData["LastMaps"] = DataAccess::GetMaps(0, 0, 0, 0, null, $numberOfMaps, "createdTime", Helper::GetLoggedInUserID());
     // last x comments
     $numberOfComments = isset($_GET["lastComments"]) && is_numeric($_GET["lastComments"]) ? (int) $_GET["lastComments"] : (isset($_GET["lastComments"]) && $_GET["lastComments"] == "all" ? 999999 : 10);
     $viewData["LastComments"] = DataAccess::GetLastComments($numberOfComments, Helper::GetLoggedInUserID());
     $viewData["OverviewMapData"] = null;
     $categories = DataAccess::GetCategoriesByUserID();
     foreach ($viewData["LastMaps"] as $map) {
         $data = Helper::GetOverviewMapData($map, false, true, true, $categories);
         if ($data != null) {
             $viewData["OverviewMapData"][] = $data;
         }
     }
     if (isset($_GET["error"]) && $_GET["error"] == "email") {
         $errors[] = sprintf(__("ADMIN_EMAIL_ERROR"), ADMIN_EMAIL);
     }
     $viewData["Errors"] = $errors;
     return $viewData;
 }
开发者ID:andopor,项目名称:doma-project,代码行数:32,代码来源:users.controller.php

示例3: makeHeader

 public static function makeHeader($data, $do, &$errors)
 {
     if (strtotime(fix_date($data['order_date'])) > strtotime(fix_date(date(DATE_FORMAT)))) {
         $errors[] = 'Order Date cannot be in the future';
         return false;
     }
     if (!isset($data['id']) || $data['id'] == '') {
         //			$generator = new OrderNumberHandler();
         $generator = new UniqueNumberHandler(false, $data['type'] != 'T');
         $data['order_number'] = $generator->handle(DataObjectFactory::Factory($do));
         $data['status'] = 'N';
         $user = getCurrentUser();
         $data['raised_by'] = $user->username;
     }
     //determine the base currency
     $currency = DataObjectFactory::Factory('Currency');
     $currency->load($data['currency_id']);
     $data['rate'] = $currency->rate;
     //determine the twin currency
     $glparams = DataObjectFactory::Factory('GLParams');
     $twin_currency = DataObjectFactory::Factory('Currency');
     $twin_currency->load($glparams->base_currency());
     $data['twin_rate'] = $twin_currency->rate;
     $data['twin_currency_id'] = $twin_currency->id;
     return DataObject::Factory($data, $errors, $do);
 }
开发者ID:uzerpllp,项目名称:uzerp,代码行数:26,代码来源:SPOrder.php

示例4: Execute

 public function Execute()
 {
     $viewData = array();
     $errors = array();
     // no user specified - redirect to user list page
     if (!getCurrentUser()) {
         Helper::Redirect("users.php");
     }
     // user is hidden - redirect to user list page
     if (!getCurrentUser()->Visible) {
         Helper::Redirect("users.php");
     }
     if (isset($_POST["cancel"])) {
         Helper::Redirect("index.php?" . Helper::CreateQuerystring(getCurrentUser()));
     }
     if (isset($_GET["action"]) && $_GET["action"] == "logout") {
         $location = "index.php?" . Helper::CreateQuerystring(getCurrentUser());
         Helper::LogoutUser();
         Helper::Redirect($location);
     }
     if (isset($_POST["login"])) {
         $currentUserID = getCurrentUser()->ID;
         if (Helper::LoginUser(stripslashes($_POST["username"]), stripslashes($_POST["password"]))) {
             if (getCurrentUser()->ID == $currentUserID) {
                 Helper::Redirect("index.php?" . Helper::CreateQuerystring(getCurrentUser()));
             }
         }
         $errors[] = __("INVALID_USERNAME_OR_PASSWORD");
     }
     if (isset($_POST["forgotPassword"])) {
         Helper::Redirect("send_new_password.php?" . Helper::CreateQuerystring(getCurrentUser()));
     }
     $viewData["Errors"] = $errors;
     return $viewData;
 }
开发者ID:andopor,项目名称:doma-project,代码行数:35,代码来源:login.controller.php

示例5: systemCompany

 public function systemCompany(&$do, &$errors)
 {
     $user = getCurrentUser();
     $person = new Person();
     $person->load($user->person_id);
     $format = new xmlrpcmsg('elgg.user.newCommunity', array(new xmlrpcval($person->firstname . ' ' . $person->surname, "string"), new xmlrpcval($person->email, "string"), new xmlrpcval($do->company, "string")));
     $client = new xmlrpc_client("_rpc/RPC2.php", "tech2.severndelta.co.uk", 8091);
     $request = $client->send($format);
     if (!$request->faultCode()) {
         $response = $request->value();
         if ($response->structmemexists('owner') && $response->structmemexists('community')) {
             $person->published_username = $response->structmem('owner')->scalarval();
             $person->save();
             $do->published = true;
             $do->published_username = $response->structmem('community')->scalarval();
             $do->published_owner_id = $person->id;
             $do->save();
         } else {
             $errors[] = 'Failed to publish company';
         }
     } else {
         $errors[] = "Code: " . $request->faultCode() . " Reason '" . $request->faultString();
         return false;
     }
     return true;
 }
开发者ID:uzerpllp,项目名称:uzerp,代码行数:26,代码来源:Publish.php

示例6: populate

 function populate()
 {
     $employee = DataObjectFactory::Factory('Employee');
     $user = getCurrentUser();
     if (!is_null($user->person_id)) {
         $employee->loadBy('person_id', $user->person_id);
     }
     if ($employee->isLoaded()) {
         $authorisor_model = $employee->expense_model();
         $employee->authorisationPolicy($authorisor_model);
         $authorisees = $employee->getAuthorisees($authorisor_model);
     } else {
         $authorisees = array();
     }
     $expense = DataObjectFactory::Factory('Expense');
     $expenses = new ExpenseCollection($expense);
     if (count($authorisees) > 0) {
         $expenses->setParams();
         $sh = new SearchHandler($expenses, false);
         $sh->setFields(array('id', 'expense_number', 'employee', 'employee_id', 'description', 'gross_value'));
         $sh->addConstraint(new Constraint('status', '=', $expense->statusAwaitingAuthorisation()));
         $sh->addConstraint(new Constraint('employee_id', 'in', '(' . implode(',', $authorisees) . ')'));
         $this->setSearchLimit($sh);
         $sh->setOrderby(array('expense_number'));
         $expenses->load($sh);
         $expenses->clickcontroller = 'expenses';
         $expenses->editclickaction = 'view';
     }
     $this->contents = $expenses;
     $this->vars['module'] = 'hr';
     $this->vars['controller'] = 'expenses';
 }
开发者ID:uzerpllp,项目名称:uzerp,代码行数:32,代码来源:ExpensesWaitingAuthUZlet.php

示例7: Execute

 public function Execute()
 {
     $viewData = array();
     // no user specified - redirect to user list page
     if (!getCurrentUser()) {
         Helper::Redirect("users.php");
     }
     // user is hidden - redirect to user list page
     if (!getCurrentUser()->Visible) {
         Helper::Redirect("users.php");
     }
     // the requested map
     $map = new Map();
     $map->Load($_GET["map"]);
     if (!$map->ID) {
         die("The map has been removed.");
     }
     DataAccess::UnprotectMapIfNeeded($map);
     if (Helper::MapIsProtected($map)) {
         die("The map is protected until " . date("Y-m-d H:i:s", Helper::StringToTime($map->ProtectedUntil, true)) . ".");
     }
     if ($map->UserID != getCurrentUser()->ID) {
         die;
     }
     $viewData["Comments"] = DataAccess::GetCommentsByMapId($map->ID);
     $viewData["Name"] = $map->Name . ' (' . date(__("DATE_FORMAT"), Helper::StringToTime($map->Date, true)) . ')';
     // previous map in archive
     $previous = DataAccess::GetPreviousMap(getCurrentUser()->ID, $map->ID, Helper::GetLoggedInUserID());
     $viewData["PreviousName"] = $previous == null ? null : $previous->Name . ' (' . date(__("DATE_FORMAT"), Helper::StringToTime($previous->Date, true)) . ')';
     // next map in archive
     $next = DataAccess::GetNextMap(getCurrentUser()->ID, $map->ID, Helper::GetLoggedInUserID());
     $viewData["NextName"] = $next == null ? null : $next->Name . ' (' . date(__("DATE_FORMAT"), Helper::StringToTime($next->Date, true)) . ')';
     $size = $map->GetMapImageSize();
     $viewData["ImageWidth"] = $size["Width"];
     $viewData["ImageHeight"] = $size["Height"];
     DataAccess::IncreaseMapViews($map);
     $viewData["Map"] = $map;
     $viewData["BackUrl"] = isset($_SERVER["HTTP_REFERER"]) && basename($_SERVER["HTTP_REFERER"]) == "users.php" ? "users.php" : "index.php?" . Helper::CreateQuerystring(getCurrentUser());
     $viewData["Previous"] = $previous;
     $viewData["Next"] = $next;
     $viewData["ShowComments"] = isset($_GET["showComments"]) && ($_GET["showComments"] = true) || !__("COLLAPSE_VISITOR_COMMENTS");
     $viewData["FirstMapImageName"] = Helper::GetMapImage($map);
     if ($map->BlankMapImage) {
         $viewData["SecondMapImageName"] = Helper::GetBlankMapImage($map);
     }
     $viewData["QuickRouteJpegExtensionData"] = $map->GetQuickRouteJpegExtensionData();
     if (isset($viewData["QuickRouteJpegExtensionData"]) && $viewData["QuickRouteJpegExtensionData"]->IsValid) {
         $categories = DataAccess::GetCategoriesByUserID(getCurrentUser()->ID);
         $viewData["OverviewMapData"][] = Helper::GetOverviewMapData($map, true, false, false, $categories);
         $viewData["GoogleMapsUrl"] = "http://maps.google.com/maps" . "?q=" . urlencode(Helper::GlobalPath("export_kml.php?id=" . $map->ID . "&format=kml")) . "&language=" . Session::GetLanguageCode();
     }
     if (USE_3DRERUN == '1' && DataAccess::GetSetting("LAST_WORLDOFO_CHECK_DOMA_TIME", "0") + RERUN_FREQUENCY * 3600 < time()) {
         $viewData["RerunMaps"] = Helper::GetMapsForRerunRequest();
         $viewData["TotalRerunMaps"] = count(explode(",", $viewData["RerunMaps"]));
         $viewData["ProcessRerun"] = true;
     }
     return $viewData;
 }
开发者ID:andopor,项目名称:doma-project,代码行数:58,代码来源:show_map.controller.php

示例8: refreshConfig

function refreshConfig($auto_redirect = true)
{
    global $_SITE_CONFIG;
    $db_prefix = getDbPrefix();
    $_SITE_CONFIG['uid'] = getCurrentUser();
    $_SITE_CONFIG['charset'] = 'utf-8';
    $_SITE_CONFIG['lang'] = 'zh_CN';
    $_SITE_CONFIG['timeoffset'] = 8;
    // 系统信息
    $sql = "SELECT `key`,`value` FROM {$db_prefix}system_data WHERE `list` = 'myop' OR `list` = 'siteopt'";
    $res = doQuery($sql);
    foreach ($res as $v) {
        $_SITE_CONFIG[$v['key']] = unserialize($v['value']);
    }
    // 用户信息
    $sql = "SELECT * FROM {$db_prefix}user WHERE `uid` = {$_SITE_CONFIG['uid']}";
    $res = doQuery($sql);
    $_SITE_CONFIG['userInfo'] = $res[0];
    // 消息统计
    $sql = "SELECT COUNT(*) AS count FROM {$db_prefix}message WHERE `to_uid` = {$_SITE_CONFIG['uid']} AND `is_read` = 0 AND `deleted_by` <> {$_SITE_CONFIG['uid']}";
    $res = doQuery($sql);
    $_SITE_CONFIG['userCount']['message'] = $res[0]['count'];
    $sql = "SELECT COUNT(*) AS count FROM {$db_prefix}notify WHERE `receive` = {$_SITE_CONFIG['uid']} AND `is_read` = 0";
    $res = doQuery($sql);
    $_SITE_CONFIG['userCount']['notify'] = $res[0]['count'];
    $sql = "SELECT COUNT(*) AS count FROM {$db_prefix}myop_myinvite WHERE `touid` = {$_SITE_CONFIG['uid']} AND `is_read` = 0";
    $res = doQuery($sql);
    $_SITE_CONFIG['userCount']['appmessage'] = $res[0]['count'];
    $sql = "SELECT * FROM {$db_prefix}user_count WHERE `uid` = {$_SITE_CONFIG['uid']}";
    $res = doQuery($sql);
    $res = $res[0];
    $_SITE_CONFIG['userCount']['comment'] = $res['comment'];
    $_SITE_CONFIG['userCount']['atme'] = $res['atme'];
    $_SITE_CONFIG['userCount']['total'] = array_sum($_SITE_CONFIG['userCount']);
    // 广告
    $place_array = array('middle', 'header', 'left', 'right', 'footer');
    $sql = 'SELECT `content`,`place` FROM ' . $db_prefix . 'ad WHERE `is_active` = "1" AND `content` <> "" ORDER BY `display_order` ASC,`ad_id` ASC';
    $ads = doQuery($sql);
    foreach ($ads as $v) {
        $v['content'] = htmlspecialchars_decode($v['content']);
        $_SITE_CONFIG['ad'][$place_array[$v['place']]][] = $v;
    }
    // 底部文章
    $sql = 'SELECT `document_id`,`title`,`content` FROM ' . $db_prefix . 'document WHERE `is_active` = "1" AND `is_on_footer` = "1" ORDER BY `display_order` ASC,`document_id` ASC';
    $docs = doQuery($sql);
    foreach ($docs as $k => $v) {
        if (mb_substr($v['content'], 0, 6, 'UTF8') == 'ftp://' || mb_substr($v['content'], 0, 7, 'UTF8') == 'http://' || mb_substr($v['content'], 0, 8, 'UTF8') == 'https://' || mb_substr($v['content'], 0, 9, 'UTF8') == 'mailto://') {
            $docs[$k]['url'] = $v['content'];
        }
        unset($docs[$k]['content']);
    }
    $_SITE_CONFIG['footer_document'] = $docs;
}
开发者ID:armebayelm,项目名称:thinksns-vietnam,代码行数:53,代码来源:function.php

示例9: useMySearch

 public static function useMySearch($search_data = null, &$errors, $defaults = null, $params)
 {
     $search = new HoursSearch($defaults);
     $search->addSearchField('start_time', 'start_date', 'between');
     $user = getCurrentUser();
     $search->addSearchField('person_id', 'name', 'hidden', $user->person_id, 'hidden');
     foreach ($params as $option) {
         $option = 'add' . $option;
         $search->{$option}($search);
     }
     $search->setSearchData($search_data, $errors);
     return $search;
 }
开发者ID:uzerpllp,项目名称:uzerp,代码行数:13,代码来源:HoursSearch.php

示例10: get_employee_id

 protected function get_employee_id()
 {
     $user = getCurrentUser();
     if ($user && !is_null($user->person_id)) {
         $employee = DataObjectFactory::Factory('Employee');
         $employee->loadBy('person_id', $user->person_id);
         if ($employee->isLoaded()) {
             return $employee->id;
         }
     }
     // User is not an employee
     return '';
 }
开发者ID:uzerpllp,项目名称:uzerp,代码行数:13,代码来源:HrController.php

示例11: __construct

 function __construct($tablename = 'tickets')
 {
     parent::__construct($tablename);
     $this->idField = 'id';
     $this->orderby = 'lastupdated';
     $this->orderdir = 'desc';
     $this->identifier = 'summary';
     $this->identifierField = 'summary';
     $this->setAdditional('number');
     $this->hasMany('TicketResponse', 'ticket_id');
     $cc = new ConstraintChain();
     $cc->add(new Constraint('type', '=', 'site'));
     $this->setAlias('response', 'TicketResponse', $cc, 'body');
     $this->belongsTo('TicketQueue', 'ticket_queue_id', 'ticket_queue');
     $this->belongsTo('TicketPriority', 'client_ticket_priority_id', 'client_ticket_priority');
     $this->belongsTo('TicketSeverity', 'client_ticket_severity_id', 'client_ticket_severity');
     $this->belongsTo('TicketStatus', 'client_ticket_status_id', 'client_ticket_status');
     $this->belongsTo('TicketPriority', 'internal_ticket_priority_id', 'internal_ticket_priority');
     $this->belongsTo('TicketSeverity', 'internal_ticket_severity_id', 'internal_ticket_severity');
     $this->belongsTo('TicketStatus', 'internal_ticket_status_id', 'internal_ticket_status');
     $this->belongsTo('TicketCategory', 'ticket_category_id', 'ticket_category');
     $this->belongsTo('TicketReleaseVersion', 'ticket_release_version_id', 'release_version');
     $this->belongsTo('Person', 'originator_person_id', 'originator_person');
     $this->belongsTo('Company', 'originator_company_id', 'originator_company');
     $this->hasOne('Company', 'originator_company_id', 'company');
     $this->belongsTo('User', 'assigned_to', 'person_assigned_to');
     $this->_fields['originator_company_id']->has_default = true;
     $company = new SystemCompany();
     $company->load(EGS_COMPANY_ID);
     $this->_fields['originator_company_id']->default_value = $company->company_id;
     $user = getCurrentUser();
     if ($user) {
         if (isset($user->email)) {
             $this->_fields['originator_email_address']->has_default = true;
             $this->_fields['originator_email_address']->default_value = $user->email;
         }
         if (!is_null($user->person_id)) {
             $this->_fields['originator_person_id']->has_default = true;
             $this->_fields['originator_person_id']->default_value = $user->person_id;
             if (!is_null($user->persondetail->email->contactmethod)) {
                 $this->_fields['originator_email_address']->has_default = true;
                 $this->_fields['originator_email_address']->default_value = $user->persondetail->email->contactmethod;
             }
         }
     }
     $this->_fields['raised_by']->has_default = true;
     $this->_fields['raised_by']->default_value = EGS_USERNAME;
 }
开发者ID:uzerpllp,项目名称:uzerp,代码行数:48,代码来源:Ticket.php

示例12: toConstraint

 /**
  * @param void
  * @return ConstraintChain
  *
  * Returns a constraintchain containing OR'd constraints for each status checked on the form
  */
 public function toConstraint()
 {
     $cc = false;
     if (!is_array($this->value)) {
         $this->value = array($this->value);
     }
     $cc = new ConstraintChain();
     $codes = $this->value_set ? $this->value : array_flip($this->default);
     $db = DB::Instance();
     $date = fix_date(date(DATE_FORMAT));
     foreach ($codes as $code => $on) {
         if ($code != '') {
             switch ($code) {
                 case 'Raised by me':
                     $cc->add(new Constraint('raised_by', '=', getCurrentUser()->username));
                     break;
                 case 'Other Orders':
                     $cc->add(new Constraint('raised_by', '!=', getCurrentUser()->username), 'OR');
                     break;
                 case 'Authorised by me':
                     $c = new ConstraintChain();
                     $c->add(new Constraint('authorised_by', '=', getCurrentUser()->username));
                     $c->add(new Constraint('date_authorised', 'is not', 'NULL'));
                     $cc->add($c, 'OR');
                     break;
                 case 'Awaiting Authorisation':
                     $awaitingauth = new POAwaitingAuthCollection(new POAwaitingAuth());
                     $authlist = $awaitingauth->getOrderList(getCurrentUser()->username);
                     if (empty($authlist)) {
                         $authlist = '-1';
                     }
                     $c = new ConstraintChain();
                     $c->add(new Constraint('type', '=', 'R'));
                     $c->add(new Constraint('authorised_by', 'is', 'NULL'));
                     $c->add(new Constraint('raised_by', '!=', getCurrentUser()->username));
                     $c->add(new Constraint('id', 'in', '(' . $authlist . ')'));
                     $cc->add($c, 'OR');
                     break;
             }
         }
     }
     return $cc;
 }
开发者ID:uzerpllp,项目名称:uzerp,代码行数:49,代码来源:POrderSearchField.php

示例13: filter

 public function filter(&$res)
 {
     foreach ($this->_unsetFields as $key) {
         unset($res[$key]);
     }
     $res['about'] = $res['profile']['about'];
     $currentUser = getCurrentUser();
     $returnRes = array();
     if ($currentUser->isAdmin() || $currentUser['id'] == $res['id']) {
         foreach ($this->_privateFields as $key) {
             $returnRes[$key] = $res[$key];
         }
         foreach ($this->_profileFields as $key) {
             $returnRes[$key] = $res['profile'][$key];
         }
     } else {
         foreach ($this->_publicFields as $key) {
             $returnRes[$key] = $res[$key];
         }
         if (in_array('ROLE_TEACHER', $returnRes['roles'])) {
             $returnRes['roles'] = array('ROLE_TEACHER');
         } else {
             $returnRes['roles'] = array('ROLE_USER');
         }
     }
     $res = $returnRes;
     foreach (array('smallAvatar', 'mediumAvatar', 'largeAvatar') as $key) {
         $res[$key] = $this->getFileUrl($res[$key]);
     }
     foreach (array('promotedTime', 'loginTime', 'approvalTime', 'createdTime') as $key) {
         if (!isset($res[$key])) {
             continue;
         }
         $res[$key] = date('c', $res[$key]);
     }
     $res['updatedTime'] = date('c', $res['updatedTime']);
     return $res;
 }
开发者ID:fujianguo,项目名称:EduSoho,代码行数:38,代码来源:User.php

示例14: Execute

 public function Execute()
 {
     $viewData = array();
     $errors = array();
     // no user specified - redirect to user list page
     if (!getCurrentUser()) {
         Helper::Redirect("users.php");
     }
     // user is hidden - redirect to user list page
     if (!getCurrentUser()->Visible) {
         Helper::Redirect("users.php");
     }
     // no email address for user is not specified
     if (!getCurrentUser()->Email) {
         Helper::Redirect("users.php");
     }
     if ($_POST["cancel"]) {
         Helper::Redirect("login.php?" . Helper::CreateQuerystring(getCurrentUser()));
     }
     if ($_POST["send"]) {
         $password = Helper::CreatePassword(6);
         $user = getCurrentUser();
         $user->Password = md5($password);
         $user->Save();
         $fromName = __("DOMA_ADMIN_EMAIL_NAME");
         $subject = __("NEW_PASSWORD_EMAIL_SUBJECT");
         $baseAddress = Helper::GlobalPath("");
         $userAddress = Helper::GlobalPath("index.php?user=" . $user->Username);
         $body = sprintf(__("NEW_PASSWORD_EMAIL_BODY"), $user->FirstName, $baseAddress, $userAddress, $user->Username, $password);
         $emailSentSuccessfully = Helper::SendEmail($fromName, $user->Email, $subject, $body);
         if ($emailSentSuccessfully) {
             Helper::Redirect("login.php?" . Helper::CreateQuerystring(getCurrentUser()) . "&action=newPasswordSent");
         }
         $errors[] = __("EMAIL_ERROR");
     }
     $viewData["Errors"] = $errors;
     return $viewData;
 }
开发者ID:andopor,项目名称:doma-project,代码行数:38,代码来源:send_new_password.controller.php

示例15: header

<?php 
require_once '../includes/header.php';
if (!getCurrentUser()) {
    header('Location: ../user/login.php');
}
?>

<?php 
$id = $_GET['id'];
$sql = "SELECT * FROM kids WHERE id = '{$id}'";
$result = mysqli_query($mysql_connection, $sql);
$row = mysqli_fetch_array($result);
?>

<?php 
if ($row) {
    ?>
  <div class="row">
    <div class="card col s6 push-s3">
      <div class="card-content">
        <span class="card-title">Edit <?php 
    echo $row['first_name'];
    ?>
</span>
        <form method="post" action="update.php">
          <div class="input-field">
            First name:
            <input type="text" name="first_name" value="<?php 
    echo $row['first_name'];
    ?>
开发者ID:tgfbikes,项目名称:php,代码行数:30,代码来源:edit.php


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