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


PHP Auth::id方法代码示例

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


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

示例1: getMyPageMenu

 public static function getMyPageMenu()
 {
     global $PEDIGREE_FULL_DETAILS, $PEDIGREE_LAYOUT;
     $showFull = $PEDIGREE_FULL_DETAILS ? 1 : 0;
     $showLayout = $PEDIGREE_LAYOUT ? 1 : 0;
     if (!Auth::id()) {
         return null;
     }
     //-- main menu
     $menu = new WT_Menu(WT_I18N::translate('My page'), 'index.php?ctype=user&ged=' . WT_GEDURL, 'menu-mymenu');
     //-- mypage submenu
     $submenu = new WT_Menu(WT_I18N::translate('My page'), 'index.php?ctype=user&ged=' . WT_GEDURL, 'menu-mypage');
     $menu->addSubmenu($submenu);
     //-- editaccount submenu
     if (Auth::user()->getSetting('editaccount')) {
         $submenu = new WT_Menu(WT_I18N::translate('My account'), 'edituser.php', 'menu-myaccount');
         $menu->addSubmenu($submenu);
     }
     if (WT_USER_GEDCOM_ID) {
         //-- my_pedigree submenu
         $submenu = new WT_Menu(WT_I18N::translate('My pedigree'), 'pedigree.php?ged=' . WT_GEDURL . '&rootid=' . WT_USER_GEDCOM_ID . "&show_full={$showFull}&talloffset={$showLayout}", 'menu-mypedigree');
         $menu->addSubmenu($submenu);
         //-- my_indi submenu
         $submenu = new WT_Menu(WT_I18N::translate('My individual record'), 'individual.php?pid=' . WT_USER_GEDCOM_ID . '&ged=' . WT_GEDURL, 'menu-myrecord');
         $menu->addSubmenu($submenu);
     }
     if (WT_USER_GEDCOM_ADMIN) {
         //-- admin submenu
         $submenu = new WT_Menu(WT_I18N::translate('Administration'), 'admin.php', 'menu-admin');
         $menu->addSubmenu($submenu);
     }
     return $menu;
 }
开发者ID:brambravo,项目名称:webtrees,代码行数:33,代码来源:MenuBar.php

示例2: addLog

 /**
  * Store a new message (of the appropriate type) in the message log.
  *
  * @param string       $message
  * @param string       $log_type
  * @param WT_Tree|null $tree
  */
 private static function addLog($message, $log_type, WT_Tree $tree = null)
 {
     global $WT_REQUEST, $WT_TREE;
     if (!$tree) {
         $tree = $WT_TREE;
     }
     WT_DB::prepare("INSERT INTO `##log` (log_type, log_message, ip_address, user_id, gedcom_id) VALUES (?, ?, ?, ?, ?)")->execute(array($log_type, $message, $WT_REQUEST->getClientIp(), Auth::id(), $tree ? $tree->tree_id : null));
 }
开发者ID:sadr110,项目名称:webtrees,代码行数:15,代码来源:Log.php

示例3:

    case "place":
        $controller->setPageTitle(WT_I18N::translate('Find a place'));
        break;
    case "repo":
        $controller->setPageTitle(WT_I18N::translate('Find a repository'));
        break;
    case "note":
        $controller->setPageTitle(WT_I18N::translate('Find a shared note'));
        break;
    case "source":
        $controller->setPageTitle(WT_I18N::translate('Find a source'));
        break;
    case "specialchar":
        $controller->setPageTitle(WT_I18N::translate('Find a special character'));
        $language_filter = WT_Filter::get('language_filter');
        if (Auth::id()) {
            // Users will probably always want the same language, so remember their setting
            if (!$language_filter) {
                $language_filter = Auth::user()->getSetting('default_language_filter');
            } else {
                Auth::user()->setSetting('default_language_filter', $language_filter);
            }
        }
        require WT_ROOT . 'includes/specialchars.php';
        $action = "filter";
        break;
    case "facts":
        $controller->setPageTitle(WT_I18N::translate('Find a fact or event'))->addInlineJavascript('initPickFact();');
        break;
}
$controller->pageHeader();
开发者ID:sadr110,项目名称:webtrees,代码行数:31,代码来源:find.php

示例4: array

// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
use WT\Auth;
define('WT_SCRIPT_NAME', 'index_edit.php');
require './includes/session.php';
$controller = new WT_Controller_Ajax();
// Only one of $user_id and $gedcom_id should be set
$user_id = WT_Filter::get('user_id', WT_REGEX_INTEGER, WT_Filter::post('user_id', WT_REGEX_INTEGER));
if ($user_id) {
    $gedcom_id = null;
} else {
    $gedcom_id = WT_Filter::get('gedcom_id', WT_REGEX_INTEGER, WT_Filter::post('gedcom_id', WT_REGEX_INTEGER));
}
// Only an admin can edit the "default" page
// Only managers can edit the "home page"
// Only a user or an admin can edit a user’s "my page"
if ($gedcom_id < 0 && !Auth::isAdmin() || $gedcom_id > 0 && !Auth::isManager(WT_Tree::get($gedcom_id)) || $user_id && Auth::id() != $user_id && !Auth::isAdmin()) {
    $controller->pageHeader();
    $controller->addInlineJavascript('window.location.reload();');
    exit;
}
$action = WT_Filter::get('action');
if (isset($_REQUEST['main'])) {
    $main = $_REQUEST['main'];
} else {
    $main = array();
}
if (isset($_REQUEST['right'])) {
    $right = $_REQUEST['right'];
} else {
    $right = array();
}
开发者ID:brambravo,项目名称:webtrees,代码行数:31,代码来源:index_edit.php

示例5:

}
switch (WT_Filter::get('show_marnm', 'no|yes')) {
    case 'no':
        $show_marnm = false;
        if (Auth::id()) {
            Auth::user()->setSetting(WT_SCRIPT_NAME . '_show_marnm', $show_marnm);
        }
        break;
    case 'yes':
        $show_marnm = true;
        if (Auth::id()) {
            Auth::user()->setSetting(WT_SCRIPT_NAME . '_show_marnm', $show_marnm);
        }
        break;
    default:
        $show_marnm = Auth::id() && Auth::user()->getSetting(WT_SCRIPT_NAME . '_show_marnm');
}
// Make sure selections are consistent.
// i.e. can’t specify show_all and surname at the same time.
if ($show_all == 'yes') {
    if ($show_all_firstnames == 'yes') {
        $alpha = '';
        $surname = '';
        $legend = WT_I18N::translate('All');
        $url = WT_SCRIPT_NAME . '?show_all=yes&amp;ged=' . WT_GEDURL;
        $show = 'indi';
    } else {
        if ($falpha) {
            $alpha = '';
            $surname = '';
            $legend = WT_I18N::translate('All') . ', ' . WT_Filter::escapeHtml($falpha) . '…';
开发者ID:jacoline,项目名称:webtrees,代码行数:31,代码来源:famlist.php

示例6: user

 /**
  * The authenticated user, from the current session.
  *
  * @return User|null
  */
 public static function user()
 {
     return User::find(Auth::id());
 }
开发者ID:brambravo,项目名称:webtrees,代码行数:9,代码来源:Auth.php

示例7: header

// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
use WT\Auth;
use WT\Log;
use WT\User;
define('WT_SCRIPT_NAME', 'edituser.php');
require './includes/session.php';
require_once WT_ROOT . 'includes/functions/functions_print_lists.php';
require WT_ROOT . 'includes/functions/functions_edit.php';
// prevent users with editing account disabled from being able to edit their account
if (!Auth::id() || !Auth::user()->getSetting('editaccount')) {
    header('Location: ' . WT_SERVER_NAME . WT_SCRIPT_PATH);
    exit;
}
// Valid values for form variables
$ALL_THEMES_DIRS = array();
foreach (get_theme_names() as $themename => $themedir) {
    $ALL_THEME_DIRS[] = $themedir;
}
// Extract form variables
$form_action = WT_Filter::post('form_action');
$form_username = WT_Filter::post('form_username');
$form_realname = WT_Filter::post('form_realname');
$form_pass1 = WT_Filter::post('form_pass1', WT_REGEX_PASSWORD);
$form_pass2 = WT_Filter::post('form_pass2', WT_REGEX_PASSWORD);
$form_email = WT_Filter::postEmail('form_email');
开发者ID:brambravo,项目名称:webtrees,代码行数:31,代码来源:edituser.php

示例8: deleteRecord

 public function deleteRecord()
 {
     // Create a pending change
     WT_DB::prepare("INSERT INTO `##change` (gedcom_id, xref, old_gedcom, new_gedcom, user_id) VALUES (?, ?, ?, '', ?)")->execute(array($this->gedcom_id, $this->xref, $this->getGedcom(), Auth::id()));
     // Accept this pending change
     if (Auth::user()->getSetting('auto_accept')) {
         accept_all_changes($this->xref, $this->gedcom_id);
     }
     // Clear the cache
     self::$gedcom_record_cache = null;
     self::$pending_record_cache = null;
     Log::addEditLog('Delete: ' . static::RECORD_TYPE . ' ' . $this->xref);
 }
开发者ID:sadr110,项目名称:webtrees,代码行数:13,代码来源:GedcomRecord.php

示例9: init

 /**
  * Initialise the translation adapter with a locale setting.
  *
  * @param string|null $locale If no locale specified, choose one automatically
  *
  * @return string $string
  */
 public static function init($locale = null)
 {
     global $WT_SESSION;
     // The translation libraries only work with a cache.
     $cache_options = array('automatic_serialization' => true, 'cache_id_prefix' => md5(WT_SERVER_NAME . WT_SCRIPT_PATH));
     if (ini_get('apc.enabled')) {
         self::$cache = Zend_Cache::factory('Core', 'Apc', $cache_options, array());
     } elseif (WT_File::mkdir(WT_DATA_DIR . 'cache')) {
         self::$cache = Zend_Cache::factory('Core', 'File', $cache_options, array('cache_dir' => WT_DATA_DIR . 'cache'));
     } else {
         self::$cache = Zend_Cache::factory('Core', 'Zend_Cache_Backend_BlackHole', $cache_options, array(), false, true);
     }
     Zend_Locale::setCache(self::$cache);
     Zend_Translate::setCache(self::$cache);
     $installed_languages = self::installed_languages();
     if (is_null($locale) || !array_key_exists($locale, $installed_languages)) {
         // Automatic locale selection.
         $locale = WT_Filter::get('lang');
         if ($locale && array_key_exists($locale, $installed_languages)) {
             // Requested in the URL?
             if (Auth::id()) {
                 Auth::user()->setSetting('language', $locale);
             }
         } elseif (array_key_exists($WT_SESSION->locale, $installed_languages)) {
             // Rembered from a previous visit?
             $locale = $WT_SESSION->locale;
         } else {
             // Browser preference takes priority over gedcom default
             if (!empty($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
                 $prefs = explode(',', str_replace(' ', '', $_SERVER['HTTP_ACCEPT_LANGUAGE']));
             } else {
                 $prefs = array();
             }
             if (WT_GED_ID) {
                 // Add the tree’s default language as a low-priority
                 $locale = get_gedcom_setting(WT_GED_ID, 'LANGUAGE');
                 $prefs[] = $locale . ';q=0.2';
             }
             $prefs2 = array();
             foreach ($prefs as $pref) {
                 list($l, $q) = explode(';q=', $pref . ';q=1.0');
                 $l = preg_replace_callback('/_[a-z][a-z]$/', function ($x) {
                     return strtoupper($x[0]);
                 }, str_replace('-', '_', $l));
                 // en-gb => en_GB
                 if (array_key_exists($l, $prefs2)) {
                     $prefs2[$l] = max((double) $q, $prefs2[$l]);
                 } else {
                     $prefs2[$l] = (double) $q;
                 }
             }
             // Ensure there is a fallback.
             if (!array_key_exists('en_US', $prefs2)) {
                 $prefs2['en_US'] = 0.01;
             }
             arsort($prefs2);
             foreach (array_keys($prefs2) as $pref) {
                 if (array_key_exists($pref, $installed_languages)) {
                     $locale = $pref;
                     break;
                 }
             }
         }
     }
     // Load the translation file
     self::$translation_adapter = new Zend_Translate('gettext', WT_ROOT . 'language/' . $locale . '.mo', $locale);
     // Deprecated - some custom modules use this to add translations
     Zend_Registry::set('Zend_Translate', self::$translation_adapter);
     // Load any local user translations
     if (is_dir(WT_DATA_DIR . 'language')) {
         if (file_exists(WT_DATA_DIR . 'language/' . $locale . '.mo')) {
             self::addTranslation(new Zend_Translate('gettext', WT_DATA_DIR . 'language/' . $locale . '.mo', $locale));
         }
         if (file_exists(WT_DATA_DIR . 'language/' . $locale . '.php')) {
             self::addTranslation(new Zend_Translate('array', WT_DATA_DIR . 'language/' . $locale . '.php', $locale));
         }
         if (file_exists(WT_DATA_DIR . 'language/' . $locale . '.csv')) {
             self::addTranslation(new Zend_Translate('csv', WT_DATA_DIR . 'language/' . $locale . '.csv', $locale));
         }
     }
     // Extract language settings from the translation file
     global $DATE_FORMAT;
     // I18N: This is the format string for full dates.  See http://php.net/date for codes
     $DATE_FORMAT = self::noop('%j %F %Y');
     global $TIME_FORMAT;
     // I18N: This is the format string for the time-of-day.  See http://php.net/date for codes
     $TIME_FORMAT = self::noop('%H:%i:%s');
     // Alphabetic sorting sequence (upper-case letters), used by webtrees to sort strings
     list(, self::$alphabet_upper) = explode('=', self::noop('ALPHABET_upper=ABCDEFGHIJKLMNOPQRSTUVWXYZ'));
     // Alphabetic sorting sequence (lower-case letters), used by webtrees to sort strings
     list(, self::$alphabet_lower) = explode('=', self::noop('ALPHABET_lower=abcdefghijklmnopqrstuvwxyz'));
     global $WEEK_START;
     // I18N: This is the first day of the week on calendars. 0=Sunday, 1=Monday...
//.........这里部分代码省略.........
开发者ID:sadr110,项目名称:webtrees,代码行数:101,代码来源:I18N.php

示例10: _getHitCount

 private static function _getHitCount($page_name, $params)
 {
     if (is_array($params) && isset($params[0]) && $params[0] != '') {
         $page_parameter = $params[0];
     } else {
         $page_parameter = '';
     }
     if ($page_name === null) {
         // index.php?ctype=gedcom
         $page_name = 'index.php';
         $page_parameter = 'gedcom:' . get_id_from_gedcom($page_parameter ? $page_parameter : WT_GEDCOM);
     } elseif ($page_name == 'index.php') {
         // index.php?ctype=user
         $user = User::findByIdentifier($page_parameter);
         $page_parameter = 'user:' . ($user ? $user->getUserId() : Auth::id());
     } else {
         // indi/fam/sour/etc.
     }
     $count = WT_DB::prepare("SELECT SQL_NO_CACHE page_count FROM `##hit_counter`" . " WHERE gedcom_id=? AND page_name=? AND page_parameter=?")->execute(array(WT_GED_ID, $page_name, $page_parameter))->fetchOne();
     return '<span class="hit-counter">' . WT_I18N::number($count) . '</span>';
 }
开发者ID:sadr110,项目名称:webtrees,代码行数:21,代码来源:Stats.php

示例11: modalDialogSubmitAjax

// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
use WT\Auth;
define('WT_SCRIPT_NAME', 'block_edit.php');
require './includes/session.php';
$block_id = WT_Filter::getInteger('block_id');
$block = WT_DB::prepare("SELECT SQL_CACHE * FROM `##block` WHERE block_id=?")->execute(array($block_id))->fetchOneRow();
// Check access.  (1) the block must exist, (2) gedcom blocks require
// managers, (3) user blocks require the user or an admin
if (!$block || $block->gedcom_id && !Auth::isManager(WT_Tree::get($block->gedcom_id)) || $block->user_id && $block->user_id != Auth::id() && !Auth::isAdmin()) {
    exit;
}
$class_name = $block->module_name . '_WT_Module';
$block = new $class_name();
$controller = new WT_Controller_Ajax();
$controller->pageHeader();
if (array_key_exists('ckeditor', WT_Module::getActiveModules())) {
    ckeditor_WT_Module::enableEditor($controller);
}
?>
<form name="block" method="post" action="block_edit.php?block_id=<?php 
echo $block_id;
?>
" onsubmit="return modalDialogSubmitAjax(this);" >
	<input type="hidden" name="save" value="1">
开发者ID:brambravo,项目名称:webtrees,代码行数:31,代码来源:block_edit.php


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