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


PHP WT\Auth类代码示例

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


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

示例4: exists_pending_change

function exists_pending_change(User $user = null, WT_Tree $tree = null)
{
    global $WT_TREE;
    if ($user === null) {
        $user = Auth::user();
    }
    if ($tree === null) {
        $tree = $WT_TREE;
    }
    if ($user === null || $tree === null) {
        return false;
    }
    return $tree->canAcceptChanges($user) && WT_DB::prepare("SELECT 1" . " FROM `##change`" . " WHERE status='pending' AND gedcom_id=?")->execute(array($tree->tree_id))->fetchOne();
}
开发者ID:jacoline,项目名称:webtrees,代码行数:14,代码来源:functions_db.php

示例5: 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

示例6: 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

示例7: getBlock

 public function getBlock($block_id, $template = true, $cfg = null)
 {
     $id = $this->getName() . $block_id;
     $class = $this->getName() . '_block';
     $title = '<span dir="auto">' . WT_I18N::translate('Welcome %s', Auth::user()->getRealName()) . '</span>';
     $content = '<table><tr>';
     if (Auth::user()->getSetting('editaccount')) {
         $content .= '<td><a href="edituser.php"><i class="icon-mypage"></i><br>' . WT_I18N::translate('My account') . '</a></td>';
     }
     if (WT_USER_GEDCOM_ID) {
         $content .= '<td><a href="pedigree.php?rootid=' . WT_USER_GEDCOM_ID . '&amp;ged=' . WT_GEDURL . '"><i class="icon-pedigree"></i><br>' . WT_I18N::translate('My pedigree') . '</a></td>';
         $content .= '<td><a href="individual.php?pid=' . WT_USER_GEDCOM_ID . '&amp;ged=' . WT_GEDURL . '"><i class="icon-indis"></i><br>' . WT_I18N::translate('My individual record') . '</a></td>';
     }
     $content .= '</tr></table>';
     if ($template) {
         require WT_THEME_DIR . 'templates/block_main_temp.php';
     } else {
         return $content;
     }
 }
开发者ID:brambravo,项目名称:webtrees,代码行数:20,代码来源:module.php

示例8: 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

示例9: jQuery

// (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_module_sidebar.php');
require 'includes/session.php';
require WT_ROOT . 'includes/functions/functions_edit.php';
$controller = new WT_Controller_Page();
$controller->restrictAccess(Auth::isAdmin())->setPageTitle(WT_I18N::translate('Module administration'))->pageHeader()->addInlineJavascript('
    jQuery("#sidebars_table").sortable({items: ".sortme", forceHelperSize: true, forcePlaceholderSize: true, opacity: 0.7, cursor: "move", axis: "y"});

    //-- update the order numbers after drag-n-drop sorting is complete
    jQuery("#sidebars_table").bind("sortupdate", function(event, ui) {
			jQuery("#"+jQuery(this).attr("id")+" input").each(
				function (index, value) {
					value.value = index+1;
				}
			);
		});
	');
$modules = WT_Module::getActiveSidebars(WT_GED_ID, WT_PRIV_HIDE);
$action = WT_Filter::post('action');
if ($action == 'update_mods' && WT_Filter::checkCsrf()) {
    foreach ($modules as $module_name => $module) {
开发者ID:brambravo,项目名称:webtrees,代码行数:31,代码来源:admin_module_sidebar.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: header

}
// 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') {
    if (!$WT_TREE || !WT_IMPORTED) {
        if (Auth::isAdmin()) {
            header('Location: ' . WT_SERVER_NAME . WT_SCRIPT_PATH . '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;
    }
}
if (Auth::id()) {
    // Update the login time every 5 minutes
    if (WT_TIMESTAMP - $WT_SESSION->activity_time > 300) {
        Auth::user()->setSetting('sessiontime', WT_TIMESTAMP);
        $WT_SESSION->activity_time = WT_TIMESTAMP;
    }
}
// Set the theme
if (substr(WT_SCRIPT_NAME, 0, 5) == 'admin' || WT_SCRIPT_NAME == 'module.php' && substr(WT_Filter::get('mod_action'), 0, 5) == 'admin') {
    // Administration scripts begin with “admin” and use a special administration theme
    define('WT_THEME_DIR', WT_THEMES_DIR . '_administration/');
} else {
    if (WT_Site::preference('ALLOW_USER_THEMES')) {
        // Requested change of theme?
        $THEME_DIR = WT_Filter::get('theme');
        if (!in_array($THEME_DIR, get_theme_names())) {
            $THEME_DIR = '';
        }
        // Last theme used?
开发者ID:brambravo,项目名称:webtrees,代码行数:31,代码来源:session.php

示例12: 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-indi');
     $menu->addLabel($menu->label, 'down');
     // What behaviour shall we give the main menu?  If we leave it blank, the framework
     // will copy the first submenu - which may be edit-raw or delete.
     // As a temporary solution, make it edit the name
     $menu->addOnclick("return false;");
     if (WT_USER_CAN_EDIT) {
         foreach ($this->record->getFacts() as $fact) {
             if ($fact->getTag() == 'NAME' && $fact->canEdit()) {
                 $menu->addOnclick("return edit_name('" . $this->record->getXref() . "', '" . $fact->getFactId() . "');");
             }
             break;
         }
         $submenu = new WT_Menu(WT_I18N::translate('Add a new name'), '#', 'menu-indi-addname');
         $submenu->addOnclick("return add_name('" . $this->record->getXref() . "');");
         $menu->addSubmenu($submenu);
         $has_sex_record = false;
         $submenu = new WT_Menu(WT_I18N::translate('Edit gender'), '#', 'menu-indi-editsex');
         foreach ($this->record->getFacts() as $fact) {
             if ($fact->getTag() == 'SEX' && $fact->canEdit()) {
                 $submenu->addOnclick("return edit_record('" . $this->record->getXref() . "', '" . $fact->getFactId() . "');");
                 $has_sex_record = true;
                 break;
             }
         }
         if (!$has_sex_record) {
             $submenu->addOnclick("return add_new_record('" . $this->record->getXref() . "', 'SEX');");
         }
         $menu->addSubmenu($submenu);
         if (count($this->record->getSpouseFamilies()) > 1) {
             $submenu = new WT_Menu(WT_I18N::translate('Re-order families'), '#', 'menu-indi-orderfam');
             $submenu->addOnclick("return reorder_families('" . $this->record->getXref() . "');");
             $menu->addSubmenu($submenu);
         }
     }
     // delete
     if (WT_USER_CAN_EDIT) {
         $submenu = new WT_Menu(WT_I18N::translate('Delete'), '#', 'menu-indi-del');
         $submenu->addOnclick("return delete_individual('" . WT_I18N::translate('Are you sure you want to delete “%s”?', WT_Filter::escapeJs(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-indi-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-indi-addfav');
         $submenu->addOnclick("jQuery.post('module.php?mod=user_favorites&amp;mod_action=menu-add-favorite',{xref:'" . $this->record->getXref() . "'},function(){location.reload();})");
         $menu->addSubmenu($submenu);
     }
     return $menu;
 }
开发者ID:jacoline,项目名称:webtrees,代码行数:65,代码来源:Individual.php

示例13: 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

示例14: unset

    // Request to change color
    $subColor = $_GET['themecolor'];
    if (Auth::id()) {
        Auth::user()->setSetting('themecolor', $subColor);
        if (Auth::isAdmin()) {
            WT_Site::preference('DEFAULT_COLOR_PALETTE', $subColor);
        }
    }
    unset($_GET['themecolor']);
    // Rember that we have selected a value
    $WT_SESSION->subColor = $subColor;
}
// If we are logged in, use our preference
$subColor = null;
if (Auth::id()) {
    $subColor = Auth::user()->getSetting('themecolor');
}
// If not logged in or no preference, use one we selected earlier in the session?
if (!$subColor) {
    $subColor = $WT_SESSION->subColor;
}
// We haven't selected one this session?  Use the site default
if (!$subColor) {
    $subColor = WT_Site::preference('DEFAULT_COLOR_PALETTE');
}
// Make sure our selected palette actually exists
if (!array_key_exists($subColor, $COLOR_THEME_LIST)) {
    $subColor = 'ash';
}
// Theme name - this needs double quotes, as file is scanned/parsed by script
$theme_name = "colors";
开发者ID:brambravo,项目名称:webtrees,代码行数:31,代码来源:theme.php

示例15: adminPlaces

    private function adminPlaces()
    {
        require WT_ROOT . 'includes/functions/functions_edit.php';
        $action = WT_Filter::get('action');
        $parent = WT_Filter::get('parent');
        $inactive = WT_Filter::getBool('inactive');
        $deleteRecord = WT_Filter::get('deleteRecord');
        if (!isset($parent)) {
            $parent = 0;
        }
        $controller = new WT_Controller_Page();
        $controller->restrictAccess(Auth::isAdmin());
        if ($action == 'ExportFile' && Auth::isAdmin()) {
            Zend_Session::writeClose();
            $tmp = $this->placeIdToHierarchy($parent);
            $maxLevel = $this->getHighestLevel();
            if ($maxLevel > 8) {
                $maxLevel = 8;
            }
            $tmp[0] = 'places';
            $outputFileName = preg_replace('/[:;\\/\\\\(\\)\\{\\}\\[\\] $]/', '_', implode('-', $tmp)) . '.csv';
            header('Content-Type: application/octet-stream');
            header('Content-Disposition: attachment; filename="' . $outputFileName . '"');
            echo '"', WT_I18N::translate('Level'), '";"', WT_I18N::translate('Country'), '";';
            if ($maxLevel > 0) {
                echo '"', WT_I18N::translate('State'), '";';
            }
            if ($maxLevel > 1) {
                echo '"', WT_I18N::translate('County'), '";';
            }
            if ($maxLevel > 2) {
                echo '"', WT_I18N::translate('City'), '";';
            }
            if ($maxLevel > 3) {
                echo '"', WT_I18N::translate('Place'), '";';
            }
            if ($maxLevel > 4) {
                echo '"', WT_I18N::translate('Place'), '";';
            }
            if ($maxLevel > 5) {
                echo '"', WT_I18N::translate('Place'), '";';
            }
            if ($maxLevel > 6) {
                echo '"', WT_I18N::translate('Place'), '";';
            }
            if ($maxLevel > 7) {
                echo '"', WT_I18N::translate('Place'), '";';
            }
            echo '"', WT_I18N::translate('Longitude'), '";"', WT_I18N::translate('Latitude'), '";';
            echo '"', WT_I18N::translate('Zoom level'), '";"', WT_I18N::translate('Icon'), '";', WT_EOL;
            $this->outputLevel($parent);
            exit;
        }
        $controller->setPageTitle(WT_I18N::translate('Google Maps™'))->pageHeader();
        ?>
		<table id="gm_config">
			<tr>
				<th>
					<a href="module.php?mod=googlemap&amp;mod_action=admin_config">
						<?php 
        echo WT_I18N::translate('Google Maps™ preferences');
        ?>
					</a>
				</th>
				<th>
					<a class="current" href="module.php?mod=googlemap&amp;mod_action=admin_places">
						<?php 
        echo WT_I18N::translate('Geographic data');
        ?>
					</a>
				</th>
				<th>
					<a href="module.php?mod=googlemap&amp;mod_action=admin_placecheck">
						<?php 
        echo WT_I18N::translate('Place check');
        ?>
					</a>
				</th>
			</tr>
		</table>
		<?php 
        if ($action == 'ImportGedcom') {
            $placelist = array();
            $j = 0;
            $gedcom_records = WT_DB::prepare("SELECT i_gedcom FROM `##individuals` WHERE i_file=? UNION ALL SELECT f_gedcom FROM `##families` WHERE f_file=?")->execute(array(WT_GED_ID, WT_GED_ID))->fetchOneColumn();
            foreach ($gedcom_records as $gedrec) {
                $i = 1;
                $placerec = get_sub_record(2, '2 PLAC', $gedrec, $i);
                while (!empty($placerec)) {
                    if (preg_match("/2 PLAC (.+)/", $placerec, $match)) {
                        $placelist[$j] = array();
                        $placelist[$j]['place'] = trim($match[1]);
                        if (preg_match("/4 LATI (.*)/", $placerec, $match)) {
                            $placelist[$j]['lati'] = trim($match[1]);
                            if ($placelist[$j]['lati'][0] != 'N' && $placelist[$j]['lati'][0] != 'S') {
                                if ($placelist[$j]['lati'] < 0) {
                                    $placelist[$j]['lati'][0] = 'S';
                                } else {
                                    $placelist[$j]['lati'] = 'N' . $placelist[$j]['lati'];
                                }
//.........这里部分代码省略.........
开发者ID:jacoline,项目名称:webtrees,代码行数:101,代码来源:module.php


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