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


PHP Auth::user方法代码示例

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


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

示例1: hookAfterInit

 /**
  * Create resources for the colors theme.
  */
 public function hookAfterInit()
 {
     $this->palettes = array('aquamarine' => I18N::translate('Aqua Marine'), 'ash' => I18N::translate('Ash'), 'belgianchocolate' => I18N::translate('Belgian Chocolate'), 'bluelagoon' => I18N::translate('Blue Lagoon'), 'bluemarine' => I18N::translate('Blue Marine'), 'coffeeandcream' => I18N::translate('Coffee and Cream'), 'coldday' => I18N::translate('Cold Day'), 'greenbeam' => I18N::translate('Green Beam'), 'mediterranio' => I18N::translate('Mediterranio'), 'mercury' => I18N::translate('Mercury'), 'nocturnal' => I18N::translate('Nocturnal'), 'olivia' => I18N::translate('Olivia'), 'pinkplastic' => I18N::translate('Pink Plastic'), 'sage' => I18N::translate('Sage'), 'shinytomato' => I18N::translate('Shiny Tomato'), 'tealtop' => I18N::translate('Teal Top'));
     uasort($this->palettes, '\\Fisharebest\\Webtrees\\I18N::strcasecmp');
     // If we've selected a new palette, and we are logged in, set this value as a default.
     if (isset($_GET['themecolor']) && array_key_exists($_GET['themecolor'], $this->palettes)) {
         // Request to change color
         $this->palette = $_GET['themecolor'];
         Auth::user()->setPreference('themecolor', $this->palette);
         if (Auth::isAdmin()) {
             Site::setPreference('DEFAULT_COLOR_PALETTE', $this->palette);
         }
         unset($_GET['themecolor']);
         // Rember that we have selected a value
         Session::put('subColor', $this->palette);
     }
     // If we are logged in, use our preference
     $this->palette = Auth::user()->getPreference('themecolor');
     // If not logged in or no preference, use one we selected earlier in the session?
     if (!$this->palette) {
         $this->palette = Session::get('subColor');
     }
     // We haven't selected one this session? Use the site default
     if (!$this->palette) {
         $this->palette = Site::getPreference('DEFAULT_COLOR_PALETTE');
     }
     // Make sure our selected palette actually exists
     if (!array_key_exists($this->palette, $this->palettes)) {
         $this->palette = 'ash';
     }
 }
开发者ID:tronsmit,项目名称:webtrees,代码行数:34,代码来源:ColorsTheme.php

示例2: getActionButtons

 /**
  * Default buttons are update and update_all
  *
  * @param string $xref
  *
  * @return string[]
  */
 public function getActionButtons($xref)
 {
     if (Auth::user()->getPreference('auto_accept')) {
         return array(BatchUpdateModule::createSubmitButton(I18N::translate('Update'), $xref, 'update'), BatchUpdateModule::createSubmitButton(I18N::translate('Update all'), $xref, 'update_all'));
     } else {
         return array(BatchUpdateModule::createSubmitButton(I18N::translate('Update'), $xref, 'update'));
     }
 }
开发者ID:jflash,项目名称:webtrees,代码行数:15,代码来源:BatchUpdateBasePlugin.php

示例3: getChartMenu

 /**
  * Return a menu item for this chart.
  *
  * @param Individual $individual
  *
  * @return Menu|null
  */
 public function getChartMenu(Individual $individual)
 {
     $tree = $individual->getTree();
     $gedcomid = $tree->getUserPreference(Auth::user(), 'gedcomid');
     if ($gedcomid) {
         return new Menu(I18N::translate('Relationship to me'), 'relationship.php?pid1=' . $gedcomid . '&pid2=' . $individual->getXref() . '&ged=' . $tree->getNameUrl(), 'menu-chart-relationship', array('rel' => 'nofollow'));
     } else {
         return new Menu(I18N::translate('Relationships'), 'relationship.php?pid1=' . $individual->getXref() . '&ged=' . $tree->getNameUrl(), 'menu-chart-relationship', array('rel' => 'nofollow'));
     }
 }
开发者ID:tronsmit,项目名称:webtrees,代码行数:17,代码来源:RelationshipsChartModule.php

示例4: __construct

 /**
  * {@inheritDoc}
  * @see \MyArtJaub\Webtrees\Mvc\Controller\MvcController::__construct(AbstractModule $module)
  */
 public function __construct(AbstractModule $module)
 {
     global $WT_TREE;
     parent::__construct($module);
     $this->sosa_provider = new SosaProvider($WT_TREE, Auth::user());
     $this->generation = Filter::getInteger('gen');
     $this->view_bag = new ViewBag();
     $this->view_bag->set('generation', $this->generation);
     $this->view_bag->set('max_gen', $this->sosa_provider->getLastGeneration());
     $this->view_bag->set('is_setup', $this->sosa_provider->isSetup() && $this->view_bag->get('max_gen', 0) > 0);
 }
开发者ID:jon48,项目名称:webtrees-lib,代码行数:15,代码来源:SosaListController.php

示例5: __construct

 /**
  * Create a branches list controller
  */
 public function __construct()
 {
     global $WT_TREE;
     parent::__construct();
     $this->surname = Filter::get('surname');
     $this->soundex_std = Filter::getBool('soundex_std');
     $this->soundex_dm = Filter::getBool('soundex_dm');
     if ($this->surname) {
         $this->setPageTitle(I18N::translate('Branches of the %s family', Filter::escapeHtml($this->surname)));
         $this->loadIndividuals();
         $self = Individual::getInstance($WT_TREE->getUserPreference(Auth::user(), 'gedcomid'), $WT_TREE);
         if ($self) {
             $this->loadAncestors($self, 1);
         }
     } else {
         $this->setPageTitle(I18N::translate('Branches'));
     }
 }
开发者ID:tronsmit,项目名称:webtrees,代码行数:21,代码来源:BranchesController.php

示例6: getBlock

 /**
  * Generate the HTML content of this block.
  *
  * @param int      $block_id
  * @param bool     $template
  * @param string[] $cfg
  *
  * @return string
  */
 public function getBlock($block_id, $template = true, $cfg = array())
 {
     global $WT_TREE;
     $id = $this->getName() . $block_id;
     $class = $this->getName() . '_block';
     $title = '<span dir="auto">' . I18N::translate('Welcome %s', Auth::user()->getRealNameHtml()) . '</span>';
     $content = '<table><tr>';
     $content .= '<td><a href="edituser.php"><i class="icon-mypage"></i><br>' . I18N::translate('My account') . '</a></td>';
     $gedcomid = $WT_TREE->getUserPreference(Auth::user(), 'gedcomid');
     if ($gedcomid) {
         $content .= '<td><a href="pedigree.php?rootid=' . $gedcomid . '&amp;ged=' . $WT_TREE->getNameUrl() . '"><i class="icon-pedigree"></i><br>' . I18N::translate('My pedigree') . '</a></td>';
         $content .= '<td><a href="individual.php?pid=' . $gedcomid . '&amp;ged=' . $WT_TREE->getNameUrl() . '"><i class="icon-indis"></i><br>' . I18N::translate('My individual record') . '</a></td>';
     }
     $content .= '</tr></table>';
     if ($template) {
         return Theme::theme()->formatBlock($id, $title, $class, $content);
     } else {
         return $content;
     }
 }
开发者ID:pal-saugstad,项目名称:webtrees,代码行数:29,代码来源:UserWelcomeModule.php

示例7: main


//.........这里部分代码省略.........
        }
        ?>
						<?php 
        foreach ($this->plugins as $class => $plugin) {
            ?>
							<option value="<?php 
            echo $class;
            ?>
" <?php 
            echo $this->plugin == $class ? 'selected' : '';
            ?>
><?php 
            echo $plugin->getName();
            ?>
</option>
					<?php 
        }
        ?>
					</select>
					<?php 
        if ($this->PLUGIN) {
            ?>
						<p class="small text-muted"><?php 
            echo $this->PLUGIN->getDescription();
            ?>
</p>
		<?php 
        }
        ?>
				</div>
			</div>

				<?php 
        if (!Auth::user()->getPreference('auto_accept')) {
            ?>
				<div class="alert alert-danger">
				<?php 
            echo I18N::translate('Your user account does not have “automatically approve changes” enabled.  You will only be able to change one record at a time.');
            ?>
				</div>
			<?php 
        }
        ?>

			<?php 
        // If a plugin is selected, display the details
        ?>
			<?php 
        if ($this->PLUGIN) {
            ?>
				<?php 
            echo $this->PLUGIN->getOptionsForm();
            ?>
				<?php 
            if (substr($this->action, -4) == '_all') {
                ?>
					<?php 
                // Reset - otherwise we might "undo all changes", which refreshes the
                ?>
					<?php 
                // page, which makes them all again!
                ?>
					<script>reset_reload();</script>
			<?php 
            } else {
                ?>
开发者ID:tunandras,项目名称:webtrees,代码行数:67,代码来源:BatchUpdateModule.php

示例8: __construct

 /**
  * Constructor for SosaStatsController
  * @param AbstractModule $module
  */
 public function __construct(AbstractModule $module)
 {
     global $WT_TREE;
     parent::__construct($module);
     $this->sosa_provider = new SosaProvider($WT_TREE, Auth::user());
 }
开发者ID:jon48,项目名称:webtrees-lib,代码行数:10,代码来源:SosaStatsController.php

示例9: isRelated

 /**
  * For relationship privacy calculations - is this individual a close relative?
  *
  * @param Individual $target
  * @param int        $distance
  *
  * @return bool
  */
 private static function isRelated(Individual $target, $distance)
 {
     static $cache = null;
     $user_individual = self::getInstance($target->tree->getUserPreference(Auth::user(), 'gedcomid'), $target->tree);
     if ($user_individual) {
         if (!$cache) {
             $cache = array(0 => array($user_individual), 1 => array());
             foreach ($user_individual->getFacts('FAM[CS]', false, Auth::PRIV_HIDE) as $fact) {
                 $family = $fact->getTarget();
                 if ($family) {
                     $cache[1][] = $family;
                 }
             }
         }
     } else {
         // No individual linked to this account?  Cannot use relationship privacy.
         return true;
     }
     // Double the distance, as we count the INDI-FAM and FAM-INDI links separately
     $distance *= 2;
     // Consider each path length in turn
     for ($n = 0; $n <= $distance; ++$n) {
         if (array_key_exists($n, $cache)) {
             // We have already calculated all records with this length
             if ($n % 2 == 0 && in_array($target, $cache[$n], true)) {
                 return true;
             }
         } else {
             // Need to calculate these paths
             $cache[$n] = array();
             if ($n % 2 == 0) {
                 // Add FAM->INDI links
                 foreach ($cache[$n - 1] as $family) {
                     foreach ($family->getFacts('HUSB|WIFE|CHIL', false, Auth::PRIV_HIDE) as $fact) {
                         $individual = $fact->getTarget();
                         // Don’t backtrack
                         if ($individual && !in_array($individual, $cache[$n - 2], true)) {
                             $cache[$n][] = $individual;
                         }
                     }
                 }
                 if (in_array($target, $cache[$n], true)) {
                     return true;
                 }
             } else {
                 // Add INDI->FAM links
                 foreach ($cache[$n - 1] as $individual) {
                     foreach ($individual->getFacts('FAM[CS]', false, Auth::PRIV_HIDE) as $fact) {
                         $family = $fact->getTarget();
                         // Don’t backtrack
                         if ($family && !in_array($family, $cache[$n - 2], true)) {
                             $cache[$n][] = $family;
                         }
                     }
                 }
             }
         }
     }
     return false;
 }
开发者ID:bmhm,项目名称:webtrees,代码行数:68,代码来源:Individual.php

示例10: elseif

// Long lists can be broken down by given name
$show_all_firstnames = Filter::get('show_all_firstnames', 'no|yes', 'no');
if ($show_all_firstnames === 'yes') {
    $falpha = '';
} else {
    $falpha = Filter::get('falpha');
    // All first names beginning with this letter
}
$show_marnm = Filter::get('show_marnm', 'no|yes');
switch ($show_marnm) {
    case 'no':
    case 'yes':
        Auth::user()->setPreference(WT_SCRIPT_NAME . '_show_marnm', $show_marnm);
        break;
    default:
        $show_marnm = Auth::user()->getPreference(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 = I18N::translate('All');
        $url = WT_SCRIPT_NAME . '?show_all=yes&amp;ged=' . $WT_TREE->getNameUrl();
        $show = 'indi';
    } elseif ($falpha) {
        $alpha = '';
        $surname = '';
        $legend = I18N::translate('All') . ', ' . Filter::escapeHtml($falpha) . '…';
        $url = WT_SCRIPT_NAME . '?show_all=yes&amp;ged=' . $WT_TREE->getNameUrl();
开发者ID:tunandras,项目名称:webtrees,代码行数:31,代码来源:indilist.php

示例11: define

    define('WT_LOGIN_URL', WT_BASE_URL . 'login.php');
}
// If there is no current tree and we need one, then redirect somewhere
if (WT_SCRIPT_NAME != 'admin_trees_manage.php' && WT_SCRIPT_NAME != 'admin_pgv_to_wt.php' && WT_SCRIPT_NAME != 'login.php' && WT_SCRIPT_NAME != 'logout.php' && WT_SCRIPT_NAME != 'import.php' && WT_SCRIPT_NAME != 'help_text.php' && WT_SCRIPT_NAME != 'message.php' && WT_SCRIPT_NAME != 'action.php') {
    if (!$WT_TREE || !$WT_TREE->getPreference('imported')) {
        if (Auth::isAdmin()) {
            header('Location: ' . WT_BASE_URL . 'admin_trees_manage.php');
        } else {
            header('Location: ' . WT_LOGIN_URL . '?url=' . rawurlencode(WT_SCRIPT_NAME . (isset($_SERVER['QUERY_STRING']) ? '?' . $_SERVER['QUERY_STRING'] : '')), true, 301);
        }
        exit;
    }
}
// Update the last-login time no more than once a minute
if (WT_TIMESTAMP - Session::get('activity_time') >= 60) {
    Auth::user()->setPreference('sessiontime', WT_TIMESTAMP);
    Session::put('activity_time', WT_TIMESTAMP);
}
// Set the theme
if (substr(WT_SCRIPT_NAME, 0, 5) === 'admin' || WT_SCRIPT_NAME === 'module.php' && substr(Filter::get('mod_action'), 0, 5) === 'admin') {
    // Administration scripts begin with “admin” and use a special administration theme
    Theme::theme(new AdministrationTheme())->init($WT_TREE);
} else {
    // Last theme used?
    $theme_id = Session::get('theme_id');
    // Default for tree
    if (!array_key_exists($theme_id, Theme::themeNames()) && $WT_TREE) {
        $theme_id = $WT_TREE->getPreference('THEME_DIR');
    }
    // Default for site
    if (!array_key_exists($theme_id, Theme::themeNames())) {
开发者ID:tunandras,项目名称:webtrees,代码行数:31,代码来源:session.php

示例12: foreach

    if ($filter) {
        echo $filter;
    }
    echo '" autofocus>
	<p><input type="submit" name="search" value="', I18N::translate('Filter'), '" onclick="this.form.subclick.value=this.name">
	<input type="submit" name="all" value="', I18N::translate('Display all'), '" onclick="this.form.subclick.value=this.name">
	</p></form></div>';
}
// Show specialchar and hide the rest
if ($type == 'specialchar') {
    $language_filter = Filter::get('language_filter', null, Auth::user()->getPreference('default_language_filter'));
    $specialchar_languages = SpecialChars::allLanguages();
    if (!array_key_exists($language_filter, $specialchar_languages)) {
        $language_filter = 'en';
    }
    Auth::user()->setPreference('default_language_filter', $language_filter);
    $action = 'filter';
    echo '<div id="find-header">
	<form name="filterspecialchar" method="get" action="find.php">
	<input type="hidden" name="action" value="filter">
	<input type="hidden" name="type" value="specialchar">
	<input type="hidden" name="callback" value="' . $callback . '">
	<p><select id="language_filter" name="language_filter" onchange="submit();">';
    foreach (SpecialChars::allLanguages() as $lanuguage_tag => $language_name) {
        echo '<option value="' . $lanuguage_tag . '" ';
        if ($lanuguage_tag === $language_filter) {
            echo 'selected';
        }
        echo '>', $language_name, '</option>';
    }
    echo '</select>
开发者ID:pal-saugstad,项目名称:webtrees,代码行数:31,代码来源:find.php

示例13: userFullName

 /**
  * Get the current user's full name.
  *
  * @return string
  */
 public function userFullName()
 {
     return Auth::check() ? Auth::user()->getRealNameHtml() : '';
 }
开发者ID:AlexSnet,项目名称:webtrees,代码行数:9,代码来源:Stats.php

示例14: AjaxController

 * 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, see <http://www.gnu.org/licenses/>.
 */
namespace Fisharebest\Webtrees;

use Fisharebest\Webtrees\Controller\AjaxController;
use Fisharebest\Webtrees\Functions\FunctionsImport;
use PDOException;
define('WT_SCRIPT_NAME', 'import.php');
require './includes/session.php';
// Don't use ged=XX as we want to be able to run without changing the current gedcom.
// This will let us load several gedcoms together, or to edit one while loading another.
$gedcom_id = Filter::getInteger('gedcom_id');
$tree = Tree::findById($gedcom_id);
if (!$tree || !Auth::isManager($tree, Auth::user())) {
    http_response_code(403);
    return;
}
$controller = new AjaxController();
$controller->pageHeader();
// Don't allow the user to cancel the request.  We do not want to be left
// with an incomplete transaction.
ignore_user_abort(true);
// Run in a transaction
Database::beginTransaction();
// Only allow one process to import each gedcom at a time
Database::prepare("SELECT * FROM `##gedcom_chunk` WHERE gedcom_id=? FOR UPDATE")->execute(array($gedcom_id));
// What is the current import status?
$row = Database::prepare("SELECT" . " SUM(IF(imported, LENGTH(chunk_data), 0)) AS import_offset," . " SUM(LENGTH(chunk_data))                  AS import_total" . " FROM `##gedcom_chunk` WHERE gedcom_id=?")->execute(array($gedcom_id))->fetchOneRow();
if ($row->import_offset == $row->import_total) {
开发者ID:tunandras,项目名称:webtrees,代码行数:31,代码来源:import.php

示例15:

                        }
                    }
                }
            }
        } else {
            http_response_code(406);
        }
        break;
    case 'reject-changes':
        // Reject all the pending changes for a record
        $record = GedcomRecord::getInstance(Filter::post('xref', WT_REGEX_XREF), $WT_TREE);
        if ($record && $record->canEdit() && Auth::isModerator($record->getTree())) {
            FlashMessages::addMessage(I18N::translate('The changes to “%s” have been rejected.', $record->getFullName()));
            FunctionsImport::rejectAllChanges($record);
        } else {
            http_response_code(406);
        }
        break;
    case 'theme':
        // Change the current theme
        $theme = Filter::post('theme');
        if (Site::getPreference('ALLOW_USER_THEMES') && array_key_exists($theme, Theme::themeNames())) {
            Session::put('theme_id', $theme);
            // Remember our selection
            Auth::user()->setPreference('theme', $theme);
        } else {
            // Request for a non-existant theme.
            http_response_code(406);
        }
        break;
}
开发者ID:josefpavlik,项目名称:webtrees,代码行数:31,代码来源:action.php


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