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


PHP Auth::isAdmin方法代码示例

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


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

示例1: getEditMenu

 /**
  * get edit menu
  */
 function getEditMenu()
 {
     $SHOW_GEDCOM_RECORD = get_gedcom_setting(WT_GED_ID, 'SHOW_GEDCOM_RECORD');
     if (!$this->record || $this->record->isOld()) {
         return null;
     }
     // edit menu
     $menu = new WT_Menu(WT_I18N::translate('Edit'), '#', 'menu-obje');
     if (WT_USER_CAN_EDIT) {
         $submenu = new WT_Menu(WT_I18N::translate('Edit media object'), '#', 'menu-obje-edit');
         $submenu->addOnclick("window.open('addmedia.php?action=editmedia&pid={$this->record->getXref()}', '_blank', edit_window_specs)");
         $menu->addSubmenu($submenu);
         // main link displayed on page
         if (array_key_exists('GEDFact_assistant', WT_Module::getActiveModules())) {
             $submenu = new WT_Menu(WT_I18N::translate('Manage links'), '#', 'menu-obje-link');
             $submenu->addOnclick("return ilinkitem('" . $this->record->getXref() . "','manage');");
         } else {
             $submenu = new WT_Menu(WT_I18N::translate('Set link'), '#', 'menu-obje-link');
             $ssubmenu = new WT_Menu(WT_I18N::translate('To individual'), '#', 'menu-obje-link-indi');
             $ssubmenu->addOnclick("return ilinkitem('" . $this->record->getXref() . "','person');");
             $submenu->addSubMenu($ssubmenu);
             $ssubmenu = new WT_Menu(WT_I18N::translate('To family'), '#', 'menu-obje-link-fam');
             $ssubmenu->addOnclick("return ilinkitem('" . $this->record->getXref() . "','family');");
             $submenu->addSubMenu($ssubmenu);
             $ssubmenu = new WT_Menu(WT_I18N::translate('To source'), '#', 'menu-obje-link-sour');
             $ssubmenu->addOnclick("return ilinkitem('" . $this->record->getXref() . "','source');");
             $submenu->addSubMenu($ssubmenu);
         }
         $menu->addSubmenu($submenu);
     }
     // delete
     if (WT_USER_CAN_EDIT) {
         $submenu = new WT_Menu(WT_I18N::translate('Delete'), '#', 'menu-obje-del');
         $submenu->addOnclick("return delete_media('" . WT_I18N::translate('Are you sure you want to delete “%s”?', strip_tags($this->record->getFullName())) . "', '" . $this->record->getXref() . "');");
         $menu->addSubmenu($submenu);
     }
     // edit raw
     if (Auth::isAdmin() || WT_USER_CAN_EDIT && $SHOW_GEDCOM_RECORD) {
         $submenu = new WT_Menu(WT_I18N::translate('Edit raw GEDCOM'), '#', 'menu-obje-editraw');
         $submenu->addOnclick("return edit_raw('" . $this->record->getXref() . "');");
         $menu->addSubmenu($submenu);
     }
     // add to favorites
     if (array_key_exists('user_favorites', WT_Module::getActiveModules())) {
         $submenu = new WT_Menu(WT_I18N::translate('Add to favorites'), '#', 'menu-obje-addfav');
         $submenu->addOnclick("jQuery.post('module.php?mod=user_favorites&mod_action=menu-add-favorite',{xref:'" . $this->record->getXref() . "'},function(){location.reload();})");
         $menu->addSubmenu($submenu);
     }
     //-- get the link for the first submenu and set it as the link for the main menu
     if (isset($menu->submenus[0])) {
         $link = $menu->submenus[0]->onclick;
         $menu->addOnclick($link);
     }
     return $menu;
 }
开发者ID:brambravo,项目名称:webtrees,代码行数:58,代码来源:Media.php

示例2: modAction

 public function modAction($mod_action)
 {
     switch ($mod_action) {
         case 'admin_batch_update':
             $controller = new WT_Controller_Page();
             $controller->setPageTitle(WT_I18N::translate('Batch update'))->restrictAccess(Auth::isAdmin())->pageHeader();
             // TODO: these files should be methods in this class
             require WT_ROOT . WT_MODULES_DIR . $this->getName() . '/' . $mod_action . '.php';
             $mod = new batch_update();
             echo $mod->main();
             break;
         default:
             header('HTTP/1.0 404 Not Found');
     }
 }
开发者ID:brambravo,项目名称:webtrees,代码行数:15,代码来源:module.php

示例3: getEditMenu

 /**
  * get edit menu
  */
 function getEditMenu()
 {
     $SHOW_GEDCOM_RECORD = get_gedcom_setting(WT_GED_ID, 'SHOW_GEDCOM_RECORD');
     if (!$this->record || $this->record->isOld()) {
         return null;
     }
     // edit menu
     $menu = new WT_Menu(WT_I18N::translate('Edit'), '#', 'menu-repo');
     if (WT_USER_CAN_EDIT) {
         $fact = $this->record->getFirstFact('NAME');
         $submenu = new WT_Menu(WT_I18N::translate('Edit repository'), '#', 'menu-repo-edit');
         if ($fact) {
             // Edit existing name
             $submenu->addOnclick('return edit_record(\'' . $this->record->getXref() . '\', \'' . $fact->getFactId() . '\');');
         } else {
             // Add new name
             $submenu->addOnclick('return add_fact(\'' . $this->record->getXref() . '\', \'NAME\');');
         }
         $menu->addSubmenu($submenu);
     }
     // delete
     if (WT_USER_CAN_EDIT) {
         $submenu = new WT_Menu(WT_I18N::translate('Delete'), '#', 'menu-repo-del');
         $submenu->addOnclick("return delete_repository('" . WT_I18N::translate('Are you sure you want to delete “%s”?', strip_tags($this->record->getFullName())) . "', '" . $this->record->getXref() . "');");
         $menu->addSubmenu($submenu);
     }
     // edit raw
     if (Auth::isAdmin() || WT_USER_CAN_EDIT && $SHOW_GEDCOM_RECORD) {
         $submenu = new WT_Menu(WT_I18N::translate('Edit raw GEDCOM'), '#', 'menu-repo-editraw');
         $submenu->addOnclick("return edit_raw('" . $this->record->getXref() . "');");
         $menu->addSubmenu($submenu);
     }
     // add to favorites
     if (array_key_exists('user_favorites', WT_Module::getActiveModules())) {
         $submenu = new WT_Menu(WT_I18N::translate('Add to favorites'), '#', 'menu-repo-addfav');
         $submenu->addOnclick("jQuery.post('module.php?mod=user_favorites&mod_action=menu-add-favorite',{xref:'" . $this->record->getXref() . "'},function(){location.reload();})");
         $menu->addSubmenu($submenu);
     }
     //-- get the link for the first submenu and set it as the link for the main menu
     if (isset($menu->submenus[0])) {
         $link = $menu->submenus[0]->onclick;
         $menu->addOnclick($link);
     }
     return $menu;
 }
开发者ID:jacoline,项目名称:webtrees,代码行数:48,代码来源:Repository.php

示例4: setup

 /**
  * PDF Setup - WT_Report_PDF
  */
 function setup()
 {
     parent::setup();
     // Setup the PDF class with custom size pages because WT supports more page sizes. If WT sends an unknown size name then the default would be A4
     $this->pdf = new PDF($this->orientation, parent::unit, array($this->pagew, $this->pageh), self::unicode, "UTF-8", self::diskcache);
     // Setup the PDF margins
     $this->pdf->setMargins($this->leftmargin, $this->topmargin, $this->rightmargin);
     $this->pdf->SetHeaderMargin($this->headermargin);
     $this->pdf->SetFooterMargin($this->footermargin);
     //Set auto page breaks
     $this->pdf->SetAutoPageBreak(true, $this->bottommargin);
     // Set font subsetting
     $this->pdf->setFontSubsetting(self::subsetting);
     // Setup PDF compression
     $this->pdf->SetCompression(self::compression);
     // Setup RTL support
     $this->pdf->setRTL($this->rtl);
     // Set the document information
     // Only admin should see the version number
     $appversion = WT_WEBTREES;
     if (Auth::isAdmin()) {
         $appversion .= " " . WT_VERSION;
     }
     $this->pdf->SetCreator($appversion . " (" . parent::wt_url . ")");
     // Not implemented yet - WT_Report_Base::setup()
     $this->pdf->SetAuthor($this->rauthor);
     $this->pdf->SetTitle($this->title);
     $this->pdf->SetSubject($this->rsubject);
     $this->pdf->SetKeywords($this->rkeywords);
     $this->pdf->setReport($this);
     if ($this->showGenText) {
         // The default style name for Generated by.... is 'genby'
         $element = new CellPDF(0, 10, 0, "C", "", "genby", 1, ".", ".", 0, 0, "", "", true);
         $element->addText($this->generatedby);
         $element->setUrl(parent::wt_url);
         $this->pdf->addFooter($element);
     }
 }
开发者ID:sadr110,项目名称:webtrees,代码行数:41,代码来源:PDF.php

示例5:

// UI for online updating of the config file.
//
// webtrees: Web based Family History software
// Copyright (C) 2014 webtrees development team.
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// 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 Michelf\MarkdownExtra;
use WT\Auth;
define('WT_SCRIPT_NAME', 'admin_site_readme.php');
require './includes/session.php';
$controller = new WT_Controller_Page();
$controller->restrictAccess(Auth::isAdmin())->setPageTitle(WT_I18N::translate('README documentation'))->pageHeader();
?>
<div class="markdown" dir="ltr" lang="en">
	<?php 
echo MarkdownExtra::defaultTransform(file_get_contents('README.md'));
?>
</div>
开发者ID:sadr110,项目名称:webtrees,代码行数:30,代码来源:admin_site_readme.php

示例6: header

//
// 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\User;
define('WT_SCRIPT_NAME', 'admin_pgv_to_wt.php');
require './includes/session.php';
//require WT_ROOT.'includes/functions/functions_edit.php';
// We can only import into an empty system, so deny access if we have already created a gedcom or added users.
if (WT_GED_ID || count(User::all()) > 1) {
    header('Location: ' . WT_SERVER_NAME . WT_SCRIPT_PATH);
    exit;
}
$controller = new WT_Controller_Page();
$controller->restrictAccess(Auth::isAdmin())->setPageTitle(WT_I18N::translate('PhpGedView to webtrees transfer wizard'));
$error = '';
$warning = '';
$PGV_PATH = WT_Filter::post('PGV_PATH');
if ($PGV_PATH) {
    if (!is_dir($PGV_PATH) || !is_readable($PGV_PATH . '/config.php')) {
        $error = WT_I18N::translate('The specified directory does not contain an installation of PhpGedView');
    } else {
        // Load the configuration settings
        $config_php = file_get_contents($PGV_PATH . '/config.php');
        // The easiest way to do this is to exec() the file - but not lines containing require or PHP tags
        $config_php = preg_replace(array('/^\\s*(include|require).*/m', '/.*<\\?php.*/', '/.*\\?>.*/'), '', $config_php);
        eval($config_php);
        // $INDEX_DIRECTORY can be either absolute or relative to the PhpGedView root.
        if (preg_match('/^(\\/|\\|[A-Z]:)/', $INDEX_DIRECTORY)) {
            $INDEX_DIRECTORY = realpath($INDEX_DIRECTORY);
开发者ID:brambravo,项目名称:webtrees,代码行数:31,代码来源:admin_pgv_to_wt.php

示例7: getTabContent

 public function getTabContent()
 {
     global $controller;
     $html = '<div id="' . $this->getName() . '_content">';
     //Show Lightbox-Album header Links
     if (WT_USER_CAN_EDIT) {
         $html .= '<table class="facts_table"><tr><td class="descriptionbox rela">';
         // Add a new media object
         if (get_gedcom_setting(WT_GED_ID, 'MEDIA_UPLOAD') >= WT_USER_ACCESS_LEVEL) {
             $html .= '<span><a href="#" onclick="window.open(\'addmedia.php?action=showmediaform&linktoid=' . $controller->record->getXref() . '\', \'_blank\', \'resizable=1,scrollbars=1,top=50,height=780,width=600\');return false;">';
             $html .= '<img src="' . WT_CSS_URL . 'images/image_add.png" id="head_icon" class="icon" title="' . WT_I18N::translate('Add a new media object') . '" alt="' . WT_I18N::translate('Add a new media object') . '">';
             $html .= WT_I18N::translate('Add a new media object');
             $html .= '</a></span>';
             // Link to an existing item
             $html .= '<span><a href="#" onclick="window.open(\'inverselink.php?linktoid=' . $controller->record->getXref() . '&linkto=person\', \'_blank\', \'resizable=1,scrollbars=1,top=50,height=300,width=450\');">';
             $html .= '<img src="' . WT_CSS_URL . 'images/image_link.png" id="head_icon" class="icon" title="' . WT_I18N::translate('Link to an existing media object') . '" alt="' . WT_I18N::translate('Link to an existing media object') . '">';
             $html .= WT_I18N::translate('Link to an existing media object');
             $html .= '</a></span>';
         }
         if (WT_USER_GEDCOM_ADMIN && $this->get_media()) {
             // Popup Reorder Media
             $html .= '<span><a href="#" onclick="reorder_media(\'' . $controller->record->getXref() . '\')">';
             $html .= '<img src="' . WT_CSS_URL . 'images/images.png" id="head_icon" class="icon" title="' . WT_I18N::translate('Re-order media') . '" alt="' . WT_I18N::translate('Re-order media') . '">';
             $html .= WT_I18N::translate('Re-order media');
             $html .= '</a></span>';
         }
         $html .= '</td></tr></table>';
     }
     // Used when sorting media on album tab page
     $html .= '<table class="facts_table"><tr><td class="facts_value">';
     // one-cell table - for presentation only
     $html .= '<ul class="album-list">';
     foreach ($this->get_media() as $media) {
         //View Edit Menu ----------------------------------
         //Get media item Notes
         $haystack = $media->getGedcom();
         $needle = '1 NOTE';
         $before = substr($haystack, 0, strpos($haystack, $needle));
         $after = substr(strstr($haystack, $needle), strlen($needle));
         $notes = print_fact_notes($before . $needle . $after, 1, true);
         // Prepare Below Thumbnail  menu ----------------------------------------------------
         $menu = new WT_Menu('<div style="overflow: hidden; text-overflow: ellipsis; white-space: nowrap">' . $media->getFullName() . '</div>');
         $menu->addClass('', 'submenu');
         // View Notes
         if (strpos($media->getGedcom(), "\n1 NOTE")) {
             $submenu = new WT_Menu(WT_I18N::translate('View notes'));
             // Notes Tooltip ----------------------------------------------------
             $submenu->addOnclick("modalNotes('" . WT_Filter::escapeJs($notes) . "','" . WT_I18N::translate('View notes') . "'); return false;");
             $submenu->addClass("submenuitem");
             $menu->addSubMenu($submenu);
         }
         //View Details
         $submenu = new WT_Menu(WT_I18N::translate('View details'), $media->getHtmlUrl());
         $submenu->addClass("submenuitem");
         $menu->addSubMenu($submenu);
         //View Sources
         $source_menu = null;
         foreach ($media->getFacts('SOUR') as $source_fact) {
             $source = $source_fact->getTarget();
             if ($source && $source->canShow()) {
                 if (!$source_menu) {
                     // Group sources under a top level menu
                     $source_menu = new WT_Menu(WT_I18N::translate('Sources'), '#', null, 'right', 'right');
                     $source_menu->addClass('submenuitem', 'submenu');
                 }
                 //now add a link to the actual source as a submenu
                 $submenu = new WT_Menu($source->getFullName(), $source->getHtmlUrl());
                 $submenu->addClass('submenuitem', 'submenu');
                 $source_menu->addSubMenu($submenu);
             }
         }
         if ($source_menu) {
             $menu->addSubMenu($source_menu);
         }
         if (WT_USER_CAN_EDIT) {
             // Edit Media
             $submenu = new WT_Menu(WT_I18N::translate('Edit media'));
             $submenu->addOnclick("return window.open('addmedia.php?action=editmedia&amp;pid=" . $media->getXref() . "', '_blank', edit_window_specs);");
             $submenu->addClass("submenuitem");
             $menu->addSubMenu($submenu);
             if (Auth::isAdmin()) {
                 // Manage Links
                 if (array_key_exists('GEDFact_assistant', WT_Module::getActiveModules())) {
                     $submenu = new WT_Menu(WT_I18N::translate('Manage links'));
                     $submenu->addOnclick("return window.open('inverselink.php?mediaid=" . $media->getXref() . "&amp;linkto=manage', '_blank', find_window_specs);");
                     $submenu->addClass("submenuitem");
                     $menu->addSubMenu($submenu);
                 } else {
                     $submenu = new WT_Menu(WT_I18N::translate('Set link'), '#', null, 'right', 'right');
                     $submenu->addClass('submenuitem', 'submenu');
                     $ssubmenu = new WT_Menu(WT_I18N::translate('To individual'));
                     $ssubmenu->addOnclick("return window.open('inverselink.php?mediaid=" . $media->getXref() . "&amp;linkto=person', '_blank', find_window_specs);");
                     $ssubmenu->addClass('submenuitem', 'submenu');
                     $submenu->addSubMenu($ssubmenu);
                     $ssubmenu = new WT_Menu(WT_I18N::translate('To family'));
                     $ssubmenu->addOnclick("return window.open('inverselink.php?mediaid=" . $media->getXref() . "&amp;linkto=family', '_blank', find_window_specs);");
                     $ssubmenu->addClass('submenuitem', 'submenu');
                     $submenu->addSubMenu($ssubmenu);
                     $ssubmenu = new WT_Menu(WT_I18N::translate('To source'));
                     $ssubmenu->addOnclick("return window.open('inverselink.php?mediaid=" . $media->getXref() . "&amp;linkto=source', '_blank', find_window_specs);");
//.........这里部分代码省略.........
开发者ID:jacoline,项目名称:webtrees,代码行数:101,代码来源:module.php

示例8:

require './includes/session.php';
// Some variables are initialised from GET (so we can set initial values in URLs),
// but are submitted in POST so we can have long body text.
$subject = WT_Filter::post('subject', null, WT_Filter::get('subject'));
$body = WT_Filter::post('body');
$from_name = WT_Filter::post('from_name');
$from_email = WT_Filter::post('from_email');
$action = WT_Filter::post('action', 'compose|send', 'compose');
$to = WT_Filter::post('to', null, WT_Filter::get('to'));
$method = WT_Filter::post('method', 'messaging|messaging2|messaging3|mailto|none', WT_Filter::get('method', 'messaging|messaging2|messaging3|mailto|none', 'messaging2'));
$url = WT_Filter::postUrl('url', WT_Filter::getUrl('url'));
$controller = new WT_Controller_Simple();
$controller->setPageTitle(WT_I18N::translate('webtrees message'));
$to_user = User::findByIdentifier($to);
// Only admins can send broadcast messages
if ((!$to_user || $to == 'all' || $to == 'last_6mo' || $to == 'never_logged') && !Auth::isAdmin()) {
    // TODO, what if we have a user called "all" or "last_6mo" or "never_logged" ???
    WT_FlashMessages::addMessage(WT_I18N::translate('Message was not sent'));
    $controller->pageHeader();
    $controller->addInlineJavascript('window.opener.location.reload(); window.close();');
    exit;
}
$errors = '';
// Is this message from a member or a visitor?
if (WT_USER_ID) {
    $from = WT_USER_NAME;
} else {
    // Visitors must provide a valid email address
    if ($from_email && (!preg_match("/(.+)@(.+)/", $from_email, $match) || function_exists('checkdnsrr') && checkdnsrr($match[2]) === false)) {
        $errors .= '<p class="ui-state-error">' . WT_I18N::translate('Please enter a valid email address.') . '</p>';
        $action = 'compose';
开发者ID:brambravo,项目名称:webtrees,代码行数:31,代码来源:message.php

示例9: full_rmdir

// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// 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', 'admin_site_clean.php');
require './includes/session.php';
$controller = new WT_Controller_Page();
$controller->restrictAccess(Auth::isAdmin())->setPageTitle(WT_I18N::translate('Clean up data folder'))->pageHeader();
require WT_ROOT . 'includes/functions/functions_edit.php';
function full_rmdir($dir)
{
    if (!is_writable($dir)) {
        if (!@chmod($dir, WT_PERM_EXE)) {
            return false;
        }
    }
    $d = dir($dir);
    while (false !== ($entry = $d->read())) {
        if ($entry == '.' || $entry == '..') {
            continue;
        }
        $entry = $dir . '/' . $entry;
        if (is_dir($entry)) {
开发者ID:brambravo,项目名称:webtrees,代码行数:31,代码来源:admin_site_clean.php

示例10:

// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// 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', 'admin_users_bulk.php');
require './includes/session.php';
$controller = new WT_Controller_Page();
$controller->restrictAccess(Auth::isAdmin())->setPageTitle(WT_I18N::translate('Send broadcast messages'))->pageHeader();
?>
<div id="users_bulk">
	<p>
		<a href="#" onclick="message('all', 'messaging2', ''); return false;">
			<?php 
echo WT_I18N::translate('Send message to all users');
?>
		</a>
	</p>
	<p>
		<a href="#" onclick="message('never_logged', 'messaging2', ''); return false;">
			<?php 
echo WT_I18N::translate('Send message to users who have never logged in');
?>
		</a>
开发者ID:brambravo,项目名称:webtrees,代码行数:31,代码来源:admin_users_bulk.php

示例11: addMessage

function addMessage($message)
{
    global $WT_TREE, $WT_REQUEST;
    $success = true;
    $sender = User::findByIdentifier($message['from']);
    $recipient = User::findByIdentifier($message['to']);
    // Sender may not be a webtrees user
    if ($sender) {
        $sender_email = $sender->getEmail();
        $sender_real_name = $sender->getRealName();
    } else {
        $sender_email = $message['from'];
        $sender_real_name = $message['from_name'];
    }
    // Send a copy of the copy message back to the sender.
    if ($message['method'] != 'messaging') {
        // Switch to the sender’s language.
        if ($sender) {
            WT_I18N::init($sender->getSetting('language'));
        }
        $copy_email = $message['body'];
        if (!empty($message['url'])) {
            $copy_email .= WT_Mail::EOL . WT_Mail::EOL . '--------------------------------------' . WT_Mail::EOL . WT_I18N::translate('This message was sent while viewing the following URL: ') . $message['url'] . WT_Mail::EOL;
        }
        $copy_email .= WT_Mail::auditFooter();
        if ($sender) {
            // Message from a logged-in user
            $copy_email = WT_I18N::translate('You sent the following message to a webtrees user:') . ' ' . $recipient->getRealName() . WT_Mail::EOL . WT_Mail::EOL . $copy_email;
        } else {
            // Message from a visitor
            $copy_email = WT_I18N::translate('You sent the following message to a webtrees administrator:') . WT_Mail::EOL . WT_Mail::EOL . WT_Mail::EOL . $copy_email;
        }
        $success = $success && WT_Mail::send($WT_TREE, $sender_email, $sender_real_name, WT_Site::preference('SMTP_FROM_NAME'), $WT_TREE->preference('title'), WT_I18N::translate('webtrees message') . ' - ' . $message['subject'], $copy_email);
    }
    // Switch to the recipient’s language.
    WT_I18N::init($recipient->getSetting('language'));
    if (isset($message['from_name'])) {
        $message['body'] = WT_I18N::translate('Your name:') . ' ' . $message['from_name'] . WT_Mail::EOL . WT_I18N::translate('Email address:') . ' ' . $message['from_email'] . WT_Mail::EOL . WT_Mail::EOL . $message['body'];
    }
    // Add another footer - unless we are an admin
    if (!Auth::isAdmin()) {
        if (!empty($message['url'])) {
            $message['body'] .= WT_Mail::EOL . WT_Mail::EOL . '--------------------------------------' . WT_Mail::EOL . WT_I18N::translate('This message was sent while viewing the following URL: ') . $message['url'] . WT_Mail::EOL;
        }
        $message['body'] .= WT_Mail::auditFooter();
    }
    if (empty($message['created'])) {
        $message['created'] = gmdate("D, d M Y H:i:s T");
    }
    if ($message['method'] != 'messaging3' && $message['method'] != 'mailto' && $message['method'] != 'none') {
        WT_DB::prepare("INSERT INTO `##message` (sender, ip_address, user_id, subject, body) VALUES (? ,? ,? ,? ,?)")->execute(array($message['from'], $WT_REQUEST->getClientIp(), $recipient->getUserId(), $message['subject'], str_replace('<br>', '', $message['body'])));
    }
    if ($message['method'] != 'messaging') {
        if ($sender) {
            $original_email = WT_I18N::translate('The following message has been sent to your webtrees user account from ');
            $original_email .= $sender->getRealName();
        } else {
            $original_email = WT_I18N::translate('The following message has been sent to your webtrees user account from ');
            if (!empty($message['from_name'])) {
                $original_email .= $message['from_name'];
            } else {
                $original_email .= $message['from'];
            }
        }
        $original_email .= WT_Mail::EOL . WT_Mail::EOL . $message['body'];
        $success = $success && WT_Mail::send($WT_TREE, $recipient->getEmail(), $recipient->getRealName(), $sender_email, $sender_real_name, WT_I18N::translate('webtrees message') . ' - ' . $message['subject'], $original_email);
    }
    WT_I18N::init(WT_LOCALE);
    // restore language settings if needed
    return $success;
}
开发者ID:brambravo,项目名称:webtrees,代码行数:71,代码来源:authentication.php

示例12: foreach

				<?php 
    echo WT_I18N::translate('A new version of webtrees is available.');
    ?>
				<a href="admin_site_upgrade.php" class="error">
					<?php 
    echo WT_I18N::translate('Upgrade to webtrees %s', WT_Filter::escapeHtml($latest_version));
    ?>
				</a>
			</p>
			<?php 
}
?>
		</div>

		<?php 
if (Auth::isAdmin() && $old_files) {
    ?>
		<h2><span class="warning"><?php 
    echo WT_I18N::translate('Old files found');
    ?>
</span></h2>
		<div>
			<p>
				<?php 
    echo WT_I18N::translate('Files have been found from a previous version of webtrees.  Old files can sometimes be a security risk.  You should delete them.');
    ?>
			</p>
			<ul>
				<?php 
    foreach ($old_files as $old_file) {
        ?>
开发者ID:sadr110,项目名称:webtrees,代码行数:31,代码来源:admin.php

示例13: fetchFriendList

 private function fetchFriendList()
 {
     global $WT_SESSION, $controller;
     $controller = new WT_Controller_Page();
     $controller->addInlineJavaScript("\n            \$('head').append('<link rel=\"stylesheet\" href=\"" . WT_MODULES_DIR . $this->getName() . "/facebook.css?v=" . WT_FACEBOOK_VERSION . "\" />');", WT_Controller_Page::JS_PRIORITY_LOW);
     $preApproved = unserialize($this->getSetting('preapproved'));
     if (WT_Filter::postArray('preApproved') && WT_Filter::checkCsrf()) {
         $roleRows = WT_Filter::postArray('preApproved');
         $fbUsernames = WT_Filter::postArray('facebook_username', WT_REGEX_USERNAME);
         foreach ($fbUsernames as $facebook_username) {
             $facebook_username = $this->cleanseFacebookUsername($facebook_username);
             $this->appendPreapproved($preApproved, $facebook_username, $roleRows);
         }
         $this->setSetting('preapproved', serialize($preApproved));
         WT_FlashMessages::addMessage(WT_I18N::translate('Users successfully imported from Facebook'));
         header("Location: module.php?mod=" . $this->getName() . "&mod_action=admin");
         exit;
     }
     if (empty($WT_SESSION->facebook_access_token)) {
         $this->error_page(WT_I18N::translate("You must <a href='%s'>login to the site via Facebook</a> in order to import friends from Facebook", "index.php?logout=1"));
     }
     $graph_url = "https://graph.facebook.com/" . self::api_dir . "me/friends?fields=first_name,last_name,name,username&access_token=" . $WT_SESSION->facebook_access_token;
     $friendsResponse = $this->fetch_url($graph_url);
     if ($friendsResponse === FALSE) {
         $this->error_page(WT_I18N::translate("Could not fetch your friends from Facebook. Note that this feature won't work for Facebook Apps created after 2014-04-30 due to a Facebook policy change."));
     }
     $controller->restrictAccess(\WT\Auth::isAdmin())->setPageTitle($this->getTitle())->pageHeader();
     $friends = json_decode($friendsResponse);
     if (empty($friends->data)) {
         $this->error_page(WT_I18N::translate("No friend data"));
         return;
     }
     function nameSort($a, $b)
     {
         return strcmp($a->last_name . " " . $a->first_name, $b->last_name . " " . $b->first_name);
     }
     usort($friends->data, "nameSort");
     echo "<form id='facebook_friend_list' method='post' action=''>";
     require_once WT_ROOT . 'includes/functions/functions_edit.php';
     // for select_edit_control
     $index = 0;
     foreach (WT_Tree::getAll() as $tree) {
         $class = $index++ % 2 ? 'odd' : 'even';
         echo "<label>" . $tree->tree_name_html . " - " . WT_I18N::translate('Role') . help_link('role') . ": " . select_edit_control('preApproved[' . $tree->tree_id . '][canedit]', $this->get_edit_options(), NULL, NULL) . "</label>";
     }
     foreach ($friends->data as $friend) {
         $facebook_username = $this->cleanseFacebookUsername(isset($friend->username) ? $friend->username : $friend->id);
         // Exclude friends who are already pre-approved or are current users
         if (isset($preApproved[$facebook_username]) || $this->get_user_id_from_facebook_username($facebook_username)) {
             continue;
         }
         echo "<label><input name='facebook_username[]' type='checkbox' value='" . $facebook_username . "'/>" . $friend->name . "</label>";
     }
     echo WT_Filter::getCsrf();
     echo "<button>Select Friends</button></form>";
 }
开发者ID:elRadix,项目名称:webtrees-facebook,代码行数:56,代码来源:module.php

示例14: print_indi_form


//.........这里部分代码省略.........
            }
        }
        //-- if adding a spouse add the option to add a marriage fact to the new family
        if ($nextaction == 'add_spouse_to_individual_action' || $nextaction == 'add_spouse_to_family_action') {
            $bdm .= "M";
            if (preg_match_all('/(' . WT_REGEX_TAG . ')/', $QUICK_REQUIRED_FAMFACTS, $matches)) {
                foreach ($matches[1] as $match) {
                    addSimpleTags($match);
                }
            }
        }
        if (preg_match_all('/(' . WT_REGEX_TAG . ')/', $QUICK_REQUIRED_FACTS, $matches)) {
            foreach ($matches[1] as $match) {
                if (in_array($match, explode('|', WT_EVENTS_DEAT))) {
                    addSimpleTags($match);
                }
            }
        }
    }
    echo keep_chan($person);
    echo "</table>";
    if ($nextaction == 'update') {
        // GEDCOM 5.5.1 spec says NAME doesn’t get a OBJE
        print_add_layer('SOUR');
        print_add_layer('NOTE');
        print_add_layer('SHARED_NOTE');
    } else {
        print_add_layer('SOUR', 1);
        print_add_layer('OBJE', 1);
        print_add_layer('NOTE', 1);
        print_add_layer('SHARED_NOTE', 1);
    }
    // If we are editing an existing name, allow raw GEDCOM editing
    if ($name_fact && (Auth::isAdmin() || $SHOW_GEDCOM_RECORD)) {
        echo '<br><br><a href="edit_interface.php?action=editrawfact&amp;xref=', $xref, '&amp;fact_id=', $name_fact->getFactId(), '&amp;ged=', WT_GEDURL, '">', WT_I18N::translate('Edit raw GEDCOM'), '</a>';
    }
    echo '<p id="save-cancel">';
    echo '<input type="submit" class="save" value="', WT_I18N::translate('save'), '">';
    if (preg_match('/^add_(child|spouse|parent|unlinked_indi)/', $nextaction)) {
        echo '<input type="submit" class="save" value="', WT_I18N::translate('go to new individual'), '" onclick="document.addchildform.goto.value=\'new\';">';
    }
    echo '<input type="button" class="cancel" value="', WT_I18N::translate('close'), '" onclick="window.close();">';
    echo '</p>';
    echo '</form>';
    $controller->addInlineJavascript('
	SURNAME_TRADITION="' . $SURNAME_TRADITION . '";
	gender="' . $gender . '";
	famtag="' . $famtag . '";
	function trim(str) {
		str=str.replace(/\\s\\s+/g, " ");
		return str.replace(/(^\\s+)|(\\s+$)/g, "");
	}

	function lang_class(str) {
		if (str.match(/[\\u0370-\\u03FF]/)) return "greek";
		if (str.match(/[\\u0400-\\u04FF]/)) return "cyrillic";
		if (str.match(/[\\u0590-\\u05FF]/)) return "hebrew";
		if (str.match(/[\\u0600-\\u06FF]/)) return "arabic";
		return "latin"; // No matched text implies latin :-)
	}

	// Generate a full name from the name components
	function generate_name() {
		var frm =document.forms[0];
		var npfx=frm.NPFX.value;
		var givn=frm.GIVN.value;
开发者ID:brambravo,项目名称:webtrees,代码行数:67,代码来源:edit_interface.php

示例15: rawurlencode

		jQuery("#log_list").dataTable( {
			"dom": \'<"H"pf<"dt-clear">irl>t<"F"pl>\',
			"processing": true,
			"serverSide": true,
			"ajax": "' . WT_SERVER_NAME . WT_SCRIPT_PATH . WT_SCRIPT_NAME . '?action=load_json&from=' . $from . '&to=' . $to . '&type=' . $type . '&oldged=' . rawurlencode($oldged) . '&newged=' . rawurlencode($newged) . '&xref=' . rawurlencode($xref) . '&user=' . rawurlencode($user) . '&gedc=' . rawurlencode($gedc) . '",
			' . WT_I18N::datatablesI18N(array(10, 20, 50, 100, 500, 1000, -1)) . ',
			jQueryUI: true,
			autoWidth: false,
			sorting: [[ 0, "desc" ]],
			pageLength: ' . Auth::user()->getSetting('admin_site_change_page_size', 10) . ',
			pagingType: "full_numbers",
			columns: [
			/* Timestamp   */ { },
			/* Status      */ { },
			/* Record      */ { },
			/* Old data    */ { class: "raw_gedcom", sortable: false },
			/* New data    */ { class: "raw_gedcom", sortable: false },
			/* User        */ { },
			/* Family tree */ { }
			]
		});
	');
$url = WT_SCRIPT_NAME . '?from=' . rawurlencode($from) . '&amp;to=' . rawurlencode($to) . '&amp;type=' . rawurlencode($type) . '&amp;oldged=' . rawurlencode($oldged) . '&amp;newged=' . rawurlencode($newged) . '&amp;xref=' . rawurlencode($xref) . '&amp;user=' . rawurlencode($user) . '&amp;gedc=' . rawurlencode($gedc);
$users_array = array();
foreach (User::all() as $tmp_user) {
    $users_array[$tmp_user->getUserName()] = $tmp_user->getUserName();
}
echo '<form name="changes" method="get" action="' . WT_SCRIPT_NAME . '">', '<input type="hidden" name="action", value="show">', '<table class="site_change">', '<tr>', '<td colspan="6">', WT_I18N::translate('From %s to %s', '<input class="log-date" name="from" value="' . WT_Filter::escapeHtml($from) . '">', '<input class="log-date" name="to" value="' . WT_Filter::escapeHtml($to) . '">'), '</td>', '</tr><tr>', '<td>', WT_I18N::translate('Status'), '<br>', select_edit_control('type', $statuses, null, $type, ''), '</td>', '<td>', WT_I18N::translate('Record'), '<br><input class="log-filter" name="xref" value="', WT_Filter::escapeHtml($xref), '"> ', '</td>', '<td>', WT_I18N::translate('Old data'), '<br><input class="log-filter" name="oldged" value="', WT_Filter::escapeHtml($oldged), '"> ', '</td>', '<td>', WT_I18N::translate('New data'), '<br><input class="log-filter" name="newged" value="', WT_Filter::escapeHtml($newged), '"> ', '</td>', '<td>', WT_I18N::translate('User'), '<br>', select_edit_control('user', $users_array, '', $user, ''), '</td>', '<td>', WT_I18N::translate('Family tree'), '<br>', select_edit_control('gedc', WT_Tree::getNameList(), '', $gedc, Auth::isAdmin() ? '' : 'disabled'), '</td>', '</tr><tr>', '<td colspan="6">', '<input type="submit" value="', WT_I18N::translate('Filter'), '">', '<input type="submit" value="', WT_I18N::translate('Export'), '" onclick="document.changes.action.value=\'export\';return true;" ', $action == 'show' ? '' : 'disabled="disabled"', '>', '<input type="submit" value="', WT_I18N::translate('Delete'), '" onclick="if (confirm(\'', WT_Filter::escapeHtml(WT_I18N::translate('Permanently delete these records?')), '\')) {document.changes.action.value=\'delete\';return true;} else {return false;}" ', $action == 'show' ? '' : 'disabled="disabled"', '>', '</td>', '</tr>', '</table>', '</form>';
if ($action) {
    echo '<br>', '<table id="log_list">', '<thead>', '<tr>', '<th>', WT_I18N::translate('Timestamp'), '</th>', '<th>', WT_I18N::translate('Status'), '</th>', '<th>', WT_I18N::translate('Record'), '</th>', '<th>', WT_I18N::translate('Old data'), '</th>', '<th>', WT_I18N::translate('New data'), '</th>', '<th>', WT_I18N::translate('User'), '</th>', '<th>', WT_I18N::translate('Family tree'), '</th>', '</tr>', '</thead>', '<tbody>', '</tbody>', '</table>';
}
开发者ID:jacoline,项目名称:webtrees,代码行数:31,代码来源:admin_site_change.php


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