• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

PHP getCurrentUser函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: getCurrentUser

    echo getCurrentUser('username');
    ?>
</a></li><?php 
}
?>
        </ul>
    </div>
    <div class="row visible-xs visible-sm" style="text-align: center">
        <ul class="mobile_nav">
            <li id="first_menu"><a class="btn btn-default" href="/"><i class="mdi mdi-home"></i>&nbsp;Home</a></li>
            <li id="first_menu"><a class="btn btn-default" href="#info"><i class="mdi mdi-file"></i>&nbsp;Docs</a></li>
            <li><a class="btn btn-default" href="#new_user"><i class="mdi mdi-puzzle"></i>&nbsp;Contents</a></li>
            <?php 
if (getCurrentUser() != '') {
    ?>
<li><a rel="nofollow" class="btn btn-warning" href="c_admin"><i class="mdi mdi-account"></i>&nbsp;<?php 
    echo getCurrentUser('username');
    ?>
</a></li><?php 
}
?>
        </ul>
    </div>
	    <!-- TOP RIGHT RIBBON: START COPYING HERE -->
    <div class="github-fork-ribbon-wrapper left">
        <div class="github-fork-ribbon">
            <a href="https://github.com/vsg24/ccms" target="_blank">Fork me on GitHub</a>
        </div>
    </div>
    <!-- TOP RIGHT RIBBON: END COPYING HERE -->
    <br>
开发者ID:VSG24,项目名称:ccms,代码行数:31,代码来源:header2.php


示例17: _errorlog_logErrorRecord

function _errorlog_logErrorRecord($logType, $logData)
{
    // limit errors logged per session (to prevent infinite loops from logging infinite errors)
    $maxErrorsPerPage = 25;
    $maxErrorsReached = false;
    static $totalErrorsLogged = 0;
    $totalErrorsLogged++;
    if ($totalErrorsLogged > $maxErrorsPerPage + 1) {
        return;
    }
    // ignore any errors after max error limit
    if ($totalErrorsLogged > $maxErrorsPerPage) {
        $maxErrorsReached = true;
    }
    // get summary of CMS user data
    $CMS_USER = getCurrentUserFromCMS();
    $subsetFields = array();
    foreach (array('num', 'username') as $field) {
        if (isset($CMS_USER[$field])) {
            $subsetFields[$field] = $CMS_USER[$field];
        }
    }
    $subsetFields['_tableName'] = 'accounts';
    $cms_user_summary = print_r($subsetFields, true);
    // get summary of WEB user data
    $WEB_USER = getCurrentUser();
    $subsetFields = array();
    foreach (array('num', 'username') as $field) {
        if (isset($WEB_USER[$field])) {
            $subsetFields[$field] = $WEB_USER[$field];
        }
    }
    $subsetFields['_tableName'] = accountsTable();
    $web_user_summary = print_r($subsetFields, true);
    // create error message
    if ($maxErrorsReached) {
        $errorMessage = t(sprintf("Max error limit reached! Only the first %s errors per page will be logged.", $maxErrorsPerPage));
    } else {
        if (isset($logData['errno'])) {
            $errorName = _errorLog_erronoToConstantName($logData['errno']);
        } else {
            $errorName = 'UNKNOWN_ERROR';
        }
        $errorMessage = "{$errorName}: " . (isset($logData['errstr']) ? $logData['errstr'] : '');
    }
    // create $logDataSummary without
    $logDataSummary = $logData;
    if (array_key_exists('errcontext', $logData)) {
        $logDataSummary['errcontext'] = "*** in symbol table field above ***";
    }
    //  create log record data
    $colsToValues = array('dateLogged=' => 'NOW()', 'updatedDate=' => 'NOW()', 'updatedByuserNum' => '0', 'error' => $errorMessage, 'url' => thisPageUrl(), 'filepath' => isset($logData['errfile']) ? $logData['errfile'] : '', 'line_num' => isset($logData['errline']) ? $logData['errline'] : '', 'user_cms' => isset($CMS_USER['num']) ? $cms_user_summary : '', 'user_web' => isset($WEB_USER['num']) ? $web_user_summary : '', 'http_user_agent' => isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : '', 'remote_addr' => isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : '', 'request_vars' => print_r($_REQUEST, true), 'get_vars' => print_r($_GET, true), 'post_vars' => print_r($_POST, true), 'cookie_vars' => print_r($_COOKIE, true), 'session_vars' => isset($_SESSION) ? print_r($_SESSION, true) : '', 'server_vars' => print_r($_SERVER, true), 'symbol_table' => isset($logData['errcontext']) ? print_r($logData['errcontext'], true) : '', 'raw_log_data' => print_r($logDataSummary, true), 'email_sent' => 0);
    // insert record
    $newRecordNum = mysql_insert('_error_log', utf8_force($colsToValues, true));
    // remove old log records
    $maxRecords = 900;
    $buffer = 100;
    // only erase records when we're this many over (to avoid erasing records every time)
    if (mysql_count('_error_log') > $maxRecords + $buffer) {
        $oldestRecordToSave_query = "SELECT * FROM `{$GLOBALS['TABLE_PREFIX']}_error_log` ORDER BY `num` DESC LIMIT 1 OFFSET " . ($maxRecords - 1);
        $oldestRecordToSave = mysql_get_query($oldestRecordToSave_query);
        if (!empty($oldestRecordToSave['num'])) {
            mysql_delete('_error_log', null, "num < {$oldestRecordToSave['num']}");
        }
    }
    // send email update
    if ($GLOBALS['SETTINGS']['advanced']['phpEmailErrors']) {
        register_shutdown_function('_errorlog_sendEmailAlert');
    }
}
开发者ID:afineedge,项目名称:thinkbeforeyoulaunch,代码行数:70,代码来源:errorlog_functions.php


示例18:

<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>Kids</title>
  <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.97.5/css/materialize.min.css">
</head>
<body>
  <nav class="pink">
    <div class="nav-wrapper">
      <div class="row">
        <div class="col s12">
          <a href="#" class="brand-logo center">I got kids</a>
          <?php 
if ($row = getCurrentUser()) {
    ?>
            <ul id="nav-mobile" class="left hide-on-med-and-down">
              <li><a href="../kids/index.php">Home</a></li>
              <li><a href="../kids/new.php">New</a></li>
            </ul>
            <ul class="right">
              <li><i class="material-icons">perm_identity</i></li>
              <li><?php 
    echo $row['email'];
    ?>
&nbsp;&nbsp;</li>
              <li>
                <form action="../session/destroy.php" method="POST">
                  <button class="waves-effect waves-light btn" type="submit">Log out</button>
                </form>
开发者ID:tgfbikes,项目名称:php,代码行数:31,代码来源:header.php


示例19: error_reporting

<?php

error_reporting(E_ERROR);
//Сценарий для обработки запросов к БД из форм поисков
require_once 'functions/database.php';
require_once 'functions/functions.php';
require_once 'functions/access.php';
// подключение к БД
$link = startup();
//Определение текущего пользователя
$user = getCurrentUser($link);
//Определяем, может ли пользователь редактировать, добавлять, удалять записи и видеть панель администратора
$canDoEdit = canDo($link, $user, 'EDIT_ENTRY');
$canDoAdd = canDo($link, $user, 'ADD_ENTRY');
$canDoDelete = canDo($link, $user, 'DELETE_ENTRY');
$canDoViewAdminPanel = canDo($link, $user, 'ADMIN_PANEL');
//вытаскиваем полное число записей из БД
//$numEntriesAll = getEntriesAll($link);
if (!empty($_POST['numOrder'])) {
    //Поиск записей по номеру договора
    $entries = get_entry_by_order($link, $_POST['numOrder']);
    $searchStringNumOrder = $_POST['numOrder'];
} else {
    if (!empty($_POST['customer'])) {
        //Поиск записей по название клиента
        $entries = get_entries_by_customer($link, $_POST['customer']);
        $searchStringCustomer = $_POST['customer'];
    } else {
        if (!empty($_POST['ip_address'])) {
            //Поиск записей по IP-адресу
            $entries = get_entries_by_ip($link, $_POST['ip_address']);
开发者ID:Abilis,项目名称:SPD,代码行数:31,代码来源:search.php


示例20: isAuthorised

 function isAuthorised($authoriser)
 {
     // Identifies if the current user is authorised to act
     // for another employee - e.g. to input their holidays
     $user = getCurrentUser();
     if ($user && !is_null($user->person_id)) {
         if ($this->person_id == $user->person_id) {
             // The user is the employee
             return true;
         }
         if ($this->person->reports_to == $user->person_id) {
             // The user is the employees manager
             return true;
         }
         $employee = DataObjectFactory::Factory('Employee');
         $employee->loadBy('person_id', $user->person_id);
         // The user is an authoriser for the employee
         return $authoriser->isAuthorised($this->id, $employee->id);
     }
     return false;
 }
开发者ID:uzerpllp,项目名称:uzerp,代码行数:21,代码来源:Employee.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP getCurrentUserGroupList函数代码示例发布时间:2022-05-15
下一篇:
PHP getCurrentUrl函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap