本文整理汇总了PHP中Fisharebest\Webtrees\Auth::isMember方法的典型用法代码示例。如果您正苦于以下问题:PHP Auth::isMember方法的具体用法?PHP Auth::isMember怎么用?PHP Auth::isMember使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Fisharebest\Webtrees\Auth
的用法示例。
在下文中一共展示了Auth::isMember方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: topTenOldestAliveQuery
/**
* Find the oldest living individuals.
*
* @param string $type
* @param string $sex
* @param string[] $params
*
* @return string
*/
private function topTenOldestAliveQuery($type = 'list', $sex = 'BOTH', $params = array())
{
if (!Auth::isMember($this->tree)) {
return I18N::translate('This information is private and cannot be shown.');
}
if ($sex == 'F') {
$sex_search = " AND i_sex='F'";
} elseif ($sex == 'M') {
$sex_search = " AND i_sex='M'";
} else {
$sex_search = '';
}
if (isset($params[0])) {
$total = (int) $params[0];
} else {
$total = 10;
}
$rows = $this->runSql("SELECT SQL_CACHE" . " birth.d_gid AS id," . " MIN(birth.d_julianday1) AS age" . " FROM" . " `##dates` AS birth," . " `##individuals` AS indi" . " WHERE" . " indi.i_id=birth.d_gid AND" . " indi.i_gedcom NOT REGEXP '\\n1 (" . WT_EVENTS_DEAT . ")' AND" . " birth.d_file={$this->tree->getTreeId()} AND" . " birth.d_fact='BIRT' AND" . " birth.d_file=indi.i_file AND" . " birth.d_julianday1<>0" . $sex_search . " GROUP BY id" . " ORDER BY age" . " ASC LIMIT " . $total);
$top10 = array();
foreach ($rows as $row) {
$person = Individual::getInstance($row['id'], $this->tree);
$age = WT_CLIENT_JD - $row['age'];
if ((int) ($age / 365.25) > 0) {
$age = (int) ($age / 365.25) . 'y';
} elseif ((int) ($age / 30.4375) > 0) {
$age = (int) ($age / 30.4375) . 'm';
} else {
$age = $age . 'd';
}
$age = FunctionsDate::getAgeAtEvent($age, true);
if ($type === 'list') {
$top10[] = "<li><a href=\"" . $person->getHtmlUrl() . "\">" . $person->getFullName() . "</a> (" . $age . ")" . "</li>";
} else {
$top10[] = "<a href=\"" . $person->getHtmlUrl() . "\">" . $person->getFullName() . "</a> (" . $age . ")";
}
}
if ($type === 'list') {
$top10 = implode('', $top10);
} else {
$top10 = implode('; ', $top10);
}
if (I18N::direction() === 'rtl') {
$top10 = str_replace(array('[', ']', '(', ')', '+'), array('‏[', '‏]', '‏(', '‏)', '‏+'), $top10);
}
if ($type === 'list') {
return '<ul>' . $top10 . '</ul>';
}
return $top10;
}
示例2: SimpleController
$NO_UPDATE_CHAN = $WT_TREE->getPreference('NO_UPDATE_CHAN');
$MEDIA_DIRECTORY = $WT_TREE->getPreference('MEDIA_DIRECTORY');
$pid = Filter::get('pid', WT_REGEX_XREF, Filter::post('pid', WT_REGEX_XREF));
// edit this media object
$linktoid = Filter::get('linktoid', WT_REGEX_XREF, Filter::post('linktoid', WT_REGEX_XREF));
// create a new media object, linked to this record
$action = Filter::get('action', null, Filter::post('action'));
$filename = Filter::get('filename', null, Filter::post('filename'));
$text = Filter::postArray('text');
$tag = Filter::postArray('tag', WT_REGEX_TAG);
$islink = Filter::postArray('islink');
$glevels = Filter::postArray('glevels', '[0-9]');
$folder = Filter::post('folder');
$update_CHAN = !Filter::postBool('preserve_last_changed');
$controller = new SimpleController();
$controller->addExternalJavascript(WT_AUTOCOMPLETE_JS_URL)->addInlineJavascript('autocomplete();')->restrictAccess(Auth::isMember($WT_TREE));
$disp = true;
$media = Media::getInstance($pid, $WT_TREE);
if ($media) {
$disp = $media->canShow();
}
if ($action == 'update' || $action == 'create') {
if ($linktoid) {
$disp = GedcomRecord::getInstance($linktoid, $WT_TREE)->canShow();
}
}
if (!Auth::isEditor($WT_TREE) || !$disp) {
$controller->pageHeader()->addInlineJavascript('closePopupAndReloadParent();');
return;
}
// There is a lot of common code in the create and update cases…
示例3: downloadForm
/**
* A form to choose the download options.
*
* @param ClippingsCartController $clip_ctrl
*
* @return string
*/
public function downloadForm(ClippingsCartController $clip_ctrl)
{
global $WT_TREE;
$pid = Filter::get('pid', WT_REGEX_XREF);
$out = '<script>';
$out .= 'function cancelDownload() {
var link = "module.php?mod=' . $this->getName() . '&mod_action=ajax&sb_action=clippings&pid=' . $pid . '";
jQuery("#sb_clippings_content").load(link);
}';
$out .= '</script>';
$out .= '<form method="get" action="module.php">
<input type="hidden" name="mod" value="clippings">
<input type="hidden" name="mod_action" value="index">
<input type="hidden" name="pid" value="' . $pid . '">
<input type="hidden" name="action" value="download">
<table>
<tr><td colspan="2" class="topbottombar"><h2>' . I18N::translate('Download') . '</h2></td></tr>
<tr><td class="descriptionbox width50 wrap">' . I18N::translate('Zip file(s)') . '</td>
<td class="optionbox"><input type="checkbox" name="Zip" value="yes" checked></td></tr>
<tr><td class="descriptionbox width50 wrap">' . I18N::translate('Include media (automatically zips files)') . '</td>
<td class="optionbox"><input type="checkbox" name="IncludeMedia" value="yes" checked></td></tr>
';
if (Auth::isManager($WT_TREE)) {
$out .= '<tr><td class="descriptionbox width50 wrap">' . I18N::translate('Apply privacy settings') . '</td>' . '<td class="optionbox">' . '<input type="radio" name="privatize_export" value="none" checked> ' . I18N::translate('None') . '<br>' . '<input type="radio" name="privatize_export" value="gedadmin"> ' . I18N::translate('Manager') . '<br>' . '<input type="radio" name="privatize_export" value="user"> ' . I18N::translate('Member') . '<br>' . '<input type="radio" name="privatize_export" value="visitor"> ' . I18N::translate('Visitor') . '</td></tr>';
} elseif (Auth::isMember($WT_TREE)) {
$out .= '<tr><td class="descriptionbox width50 wrap">' . I18N::translate('Apply privacy settings') . '</td>' . '<td class="list_value">' . '<input type="radio" name="privatize_export" value="user" checked> ' . I18N::translate('Member') . '<br>' . '<input type="radio" name="privatize_export" value="visitor"> ' . I18N::translate('Visitor') . '</td></tr>';
}
$out .= '
<tr><td class="descriptionbox width50 wrap">' . I18N::translate('Convert from UTF-8 to ISO-8859-1') . '</td>
<td class="optionbox"><input type="checkbox" name="convert" value="yes"></td></tr>
<tr>
<td class="descriptionbox width50 wrap">' . I18N::translate('Add the GEDCOM media path to filenames') . '</td>
<td class="optionbox">
<input type="checkbox" name="conv_path" value="' . Filter::escapeHtml($WT_TREE->getPreference('GEDCOM_MEDIA_PATH')) . '">
<span dir="auto">' . Filter::escapeHtml($WT_TREE->getPreference('GEDCOM_MEDIA_PATH')) . '</span></td>
</tr>
<input type="hidden" name="conv_path" value="' . $clip_ctrl->conv_path . '">
</td></tr>
<tr><td class="topbottombar" colspan="2">
<input type="button" value="' . I18N::translate('Cancel') . '" onclick="cancelDownload();">
<input type="submit" value="' . I18N::translate('Download') . '">
</form>';
return $out;
}
示例4: foreach
<!-- WEBMASTER_USER_ID -->
<div class="form-group">
<label class="control-label col-sm-3" for="WEBMASTER_USER_ID">
<?php
echo I18N::translate('Technical help contact');
?>
</label>
<div class="col-sm-9">
<select id="WEBMASTER_USER_ID" name="WEBMASTER_USER_ID" class="form-control">
<option value=""></option>
<?php
foreach (User::all() as $user) {
?>
<?php
if (Auth::isMember($WT_TREE, $user)) {
?>
<option value="<?php
echo $user->getUserId();
?>
" <?php
echo $WT_TREE->getPreference('WEBMASTER_USER_ID') === $user->getUserId() ? 'selected' : '';
?>
>
<?php
echo $user->getRealNameHtml() . ' - ' . Filter::escapeHtml($user->getUserName());
?>
</option>
<?php
}
?>
示例5: __construct
/**
* Create the clippings controller
*/
public function __construct()
{
global $WT_TREE;
// Our cart is an array of items in the session
$this->cart = Session::get('cart', array());
if (!array_key_exists($WT_TREE->getTreeId(), $this->cart)) {
$this->cart[$WT_TREE->getTreeId()] = array();
}
$this->action = Filter::get('action');
$this->id = Filter::get('id');
$convert = Filter::get('convert', 'yes|no', 'no');
$this->Zip = Filter::get('Zip');
$this->IncludeMedia = Filter::get('IncludeMedia');
$this->conv_path = Filter::get('conv_path');
$this->privatize_export = Filter::get('privatize_export', 'none|visitor|user|gedadmin', 'visitor');
$this->level1 = Filter::getInteger('level1');
$this->level2 = Filter::getInteger('level2');
$this->level3 = Filter::getInteger('level3');
$others = Filter::get('others');
$this->type = Filter::get('type');
if (($this->privatize_export === 'none' || $this->privatize_export === 'none') && !Auth::isManager($WT_TREE)) {
$this->privatize_export = 'visitor';
}
if ($this->privatize_export === 'user' && !Auth::isMember($WT_TREE)) {
$this->privatize_export = 'visitor';
}
if ($this->action === 'add') {
if (empty($this->type) && !empty($this->id)) {
$obj = GedcomRecord::getInstance($this->id, $WT_TREE);
if ($obj) {
$this->type = $obj::RECORD_TYPE;
} else {
$this->type = '';
$this->id = '';
$this->action = '';
}
} elseif (empty($this->id)) {
$this->action = '';
}
if (!empty($this->id) && $this->type !== 'FAM' && $this->type !== 'INDI' && $this->type !== 'SOUR') {
$this->action = 'add1';
}
}
if ($this->action === 'add1') {
$obj = GedcomRecord::getInstance($this->id, $WT_TREE);
$this->addClipping($obj);
if ($this->type === 'SOUR') {
if ($others === 'linked') {
foreach ($obj->linkedIndividuals('SOUR') as $indi) {
$this->addClipping($indi);
}
foreach ($obj->linkedFamilies('SOUR') as $fam) {
$this->addClipping($fam);
}
}
}
if ($this->type === 'FAM') {
if ($others === 'parents') {
$this->addClipping($obj->getHusband());
$this->addClipping($obj->getWife());
} elseif ($others === "members") {
$this->addFamilyMembers(Family::getInstance($this->id, $WT_TREE));
} elseif ($others === "descendants") {
$this->addFamilyDescendancy(Family::getInstance($this->id, $WT_TREE));
}
} elseif ($this->type === 'INDI') {
if ($others === 'parents') {
foreach (Individual::getInstance($this->id, $WT_TREE)->getChildFamilies() as $family) {
$this->addFamilyMembers($family);
}
} elseif ($others === 'ancestors') {
$this->addAncestorsToCart(Individual::getInstance($this->id, $WT_TREE), $this->level1);
} elseif ($others === 'ancestorsfamilies') {
$this->addAncestorsToCartFamilies(Individual::getInstance($this->id, $WT_TREE), $this->level2);
} elseif ($others === 'members') {
foreach (Individual::getInstance($this->id, $WT_TREE)->getSpouseFamilies() as $family) {
$this->addFamilyMembers($family);
}
} elseif ($others === 'descendants') {
foreach (Individual::getInstance($this->id, $WT_TREE)->getSpouseFamilies() as $family) {
$this->addClipping($family);
$this->addFamilyDescendancy($family, $this->level3);
}
}
uksort($this->cart[$WT_TREE->getTreeId()], array($this, 'compareClippings'));
}
} elseif ($this->action === 'remove') {
unset($this->cart[$WT_TREE->getTreeId()][$this->id]);
} elseif ($this->action === 'empty') {
$this->cart[$WT_TREE->getTreeId()] = array();
} elseif ($this->action === 'download') {
$media = array();
$mediacount = 0;
$filetext = FunctionsExport::gedcomHeader($WT_TREE);
// Include SUBM/SUBN records, if they exist
$subn = Database::prepare("SELECT o_gedcom FROM `##other` WHERE o_type=? AND o_file=?")->execute(array('SUBN', $WT_TREE->getTreeId()))->fetchOne();
if ($subn) {
//.........这里部分代码省略.........
示例6: SimpleController
*/
namespace Fisharebest\Webtrees;
use Fisharebest\Webtrees\Controller\SimpleController;
use Fisharebest\Webtrees\Module\CkeditorModule;
use PDO;
/**
* Defined in session.php
*
* @global Tree $WT_TREE
*/
global $WT_TREE;
define('WT_SCRIPT_NAME', 'editnews.php');
require './includes/session.php';
$controller = new SimpleController();
$controller->setPageTitle(I18N::translate('Add/edit a journal/news entry'))->restrictAccess(Auth::isMember($WT_TREE))->pageHeader();
$action = Filter::get('action', 'compose|save', 'compose');
$news_id = Filter::getInteger('news_id');
$user_id = Filter::get('user_id', WT_REGEX_INTEGER, Filter::post('user_id', WT_REGEX_INTEGER));
$gedcom_id = Filter::get('gedcom_id', WT_REGEX_INTEGER, Filter::post('gedcom_id', WT_REGEX_INTEGER));
$date = Filter::postInteger('date', 0, PHP_INT_MAX, WT_TIMESTAMP);
$title = Filter::post('title');
$text = Filter::post('text');
switch ($action) {
case 'compose':
if (Module::getModuleByName('ckeditor')) {
CkeditorModule::enableEditor($controller);
}
echo '<h3>' . I18N::translate('Add/edit a journal/news entry') . '</h3>';
echo '<form style="overflow: hidden;" name="messageform" method="post" action="editnews.php?action=save&news_id=' . $news_id . '">';
if ($news_id) {