本文整理汇总了PHP中WT_Site::preference方法的典型用法代码示例。如果您正苦于以下问题:PHP WT_Site::preference方法的具体用法?PHP WT_Site::preference怎么用?PHP WT_Site::preference使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WT_Site
的用法示例。
在下文中一共展示了WT_Site::preference方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: fetch_latest_version
function fetch_latest_version()
{
$last_update_timestamp = WT_Site::preference('LATEST_WT_VERSION_TIMESTAMP');
if ($last_update_timestamp < WT_TIMESTAMP - 24 * 60 * 60) {
$row = WT_DB::prepare("SHOW VARIABLES LIKE 'version'")->fetchOneRow();
$params = '?w=' . WT_VERSION . '&p=' . PHP_VERSION . '&m=' . $row->value . '&o=' . (DIRECTORY_SEPARATOR == '/' ? 'u' : 'w');
$latest_version_txt = WT_File::fetchUrl('http://svn.webtrees.net/build/latest-version.txt' . $params);
if ($latest_version_txt) {
WT_Site::preference('LATEST_WT_VERSION', $latest_version_txt);
WT_Site::preference('LATEST_WT_VERSION_TIMESTAMP', WT_TIMESTAMP);
return $latest_version_txt;
} else {
// Cannot connect to server - use cached version (if we have one)
return WT_Site::preference('LATEST_WT_VERSION');
}
} else {
return WT_Site::preference('LATEST_WT_VERSION');
}
}
示例2: getBlock
public function getBlock($block_id, $template = true, $cfg = null)
{
global $controller;
$indi_xref = $controller->getSignificantIndividual()->getXref();
$id = $this->getName() . $block_id;
$class = $this->getName() . '_block';
$title = '<span dir="auto">' . WT_TREE_TITLE . '</span>';
$content = '<table><tr>';
$content .= '<td><a href="pedigree.php?rootid=' . $indi_xref . '&ged=' . WT_GEDURL . '"><i class="icon-pedigree"></i><br>' . WT_I18N::translate('Default chart') . '</a></td>';
$content .= '<td><a href="individual.php?pid=' . $indi_xref . '&ged=' . WT_GEDURL . '"><i class="icon-indis"></i><br>' . WT_I18N::translate('Default individual') . '</a></td>';
if (WT_Site::preference('USE_REGISTRATION_MODULE') && WT_USER_ID == false) {
$content .= '<td><a href="' . WT_LOGIN_URL . '?action=register"><i class="icon-user_add"></i><br>' . WT_I18N::translate('Request new user account') . '</a></td>';
}
$content .= "</tr>";
$content .= "</table>";
if ($template) {
require WT_THEME_DIR . 'templates/block_main_temp.php';
} else {
return $content;
}
}
示例3: transport
public static function transport()
{
switch (WT_Site::preference('SMTP_ACTIVE')) {
case 'internal':
return new Zend_Mail_Transport_Sendmail();
case 'external':
$config = array('name' => WT_Site::preference('SMTP_HELO'), 'port' => WT_Site::preference('SMTP_PORT'));
if (WT_Site::preference('SMTP_AUTH')) {
$config['auth'] = 'login';
$config['username'] = WT_Site::preference('SMTP_AUTH_USER');
$config['password'] = WT_Site::preference('SMTP_AUTH_PASS');
}
if (WT_Site::preference('SMTP_SSL') !== 'none') {
$config['ssl'] = WT_Site::preference('SMTP_SSL');
}
return new Zend_Mail_Transport_Smtp(WT_Site::preference('SMTP_HOST'), $config);
default:
// For testing
return new Zend_Mail_Transport_File();
}
}
示例4: color_theme_dropdown
function color_theme_dropdown()
{
global $COLOR_THEME_LIST, $WT_SESSION, $subColor;
$menu = new WT_Menu(WT_I18N::translate('Palette'), '#', 'menu-color');
uasort($COLOR_THEME_LIST, array('WT_I18N', 'strcasecmp'));
foreach ($COLOR_THEME_LIST as $colorChoice => $colorName) {
$submenu = new WT_Menu($colorName, get_query_url(array('themecolor' => $colorChoice), '&'), 'menu-color-' . $colorChoice);
if (isset($WT_SESSION->subColor)) {
if ($WT_SESSION->subColor == $colorChoice) {
$submenu->addClass('', '', 'theme-active');
}
} elseif (WT_Site::preference('DEFAULT_COLOR_PALETTE') == $colorChoice) {
/* here when visitor changes palette from default */
$submenu->addClass('', '', 'theme-active');
} elseif ($subColor == 'ash') {
/* here when site has different theme as default and user switches to colors */
if ($subColor == $colorChoice) {
$submenu->addClass('', '', 'theme-active');
}
}
$menu->addSubMenu($submenu);
}
return $menu->getMenuAsList();
}
示例5: 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;
}
示例6: header
<div>
<label for="user_password">', WT_I18N::translate('Password'), '</label>
<input type="password" id="user_password" name="user_password" value="" autofocus>
</div>
<div>
<label for="user_hashcode">', WT_I18N::translate('Verification code:'), '</label>
<input type="text" id="user_hashcode" name="user_hashcode" value="', $user_hashcode, '">
</div>
<div>
<input type="submit" value="', WT_I18N::translate('Send'), '">
</div>
</form>
</div>';
break;
case 'verify_hash':
if (!WT_Site::preference('USE_REGISTRATION_MODULE')) {
header('Location: ' . WT_SERVER_NAME . WT_SCRIPT_PATH);
exit;
}
// switch language to webmaster settings
$webmaster = User::find(get_gedcom_setting(WT_GED_ID, 'WEBMASTER_USER_ID'));
WT_I18N::init($webmaster->getSetting('language'));
$user = User::findByIdentifier($user_name);
$mail1_body = WT_I18N::translate('Hello administrator…') . WT_Mail::EOL . WT_Mail::EOL . WT_I18N::translate('A new user (%1$s) has requested an account (%2$s) and verified an email address (%3$s).', $user->getRealName(), $user->getUserName(), $user->getEmail()) . WT_Mail::EOL . WT_Mail::EOL;
if ($REQUIRE_ADMIN_AUTH_REGISTRATION && !$user->getSetting('verified_by_admin')) {
$mail1_body .= WT_I18N::translate('You now need to review the account details, and set the “approved” status to “yes”.');
} else {
$mail1_body .= WT_I18N::translate('You do not have to take any action; the user can now login.');
}
$mail1_body .= WT_Mail::EOL . '<a href="' . WT_SERVER_NAME . WT_SCRIPT_PATH . "admin_users.php?filter=" . rawurlencode($user->getUserName()) . '">' . WT_SERVER_NAME . WT_SCRIPT_PATH . "admin_users.php?filter=" . rawurlencode($user->getUserName()) . '</a>' . WT_Mail::auditFooter();
$mail1_subject = WT_I18N::translate('New user at %s', WT_SERVER_NAME . WT_SCRIPT_PATH . ' ' . $WT_TREE->tree_title);
示例7: historical_facts
private static function historical_facts(WT_Individual $person)
{
global $SHOW_RELATIVES_EVENTS;
$facts = array();
if ($SHOW_RELATIVES_EVENTS) {
// Only include events between birth and death
$birt_date = $person->getEstimatedBirthDate();
$deat_date = $person->getEstimatedDeathDate();
if (file_exists(WT_Site::preference('INDEX_DIRECTORY') . 'histo.' . WT_LOCALE . '.php')) {
require WT_Site::preference('INDEX_DIRECTORY') . 'histo.' . WT_LOCALE . '.php';
foreach ($histo as $hist) {
// Earlier versions of the WIKI encouraged people to use HTML entities,
// rather than UTF8 encoding.
$hist = html_entity_decode($hist, ENT_QUOTES, 'UTF-8');
$fact = new WT_Fact($hist, $person, 'histo');
$sdate = $fact->getDate();
if ($sdate->isOK() && WT_Date::Compare($birt_date, $sdate) <= 0 && WT_Date::Compare($sdate, $deat_date) <= 0) {
$facts[] = $fact;
}
}
}
}
return $facts;
}
示例8: IN
}
// TODO May need to set 'DATA_DIRECTORY' to $INDEX_DIRECTORY when dealing with media??
@WT_Site::preference('USE_REGISTRATION_MODULE', $USE_REGISTRATION_MODULE);
@WT_Site::preference('REQUIRE_ADMIN_AUTH_REGISTRATION', $REQUIRE_ADMIN_AUTH_REGISTRATION);
@WT_Site::preference('ALLOW_USER_THEMES', $ALLOW_USER_THEMES);
@WT_Site::preference('ALLOW_CHANGE_GEDCOM', $ALLOW_CHANGE_GEDCOM);
@WT_Site::preference('SESSION_TIME', $PGV_SESSION_TIME);
@WT_Site::preference('SMTP_ACTIVE', $PGV_SMTP_ACTIVE ? 'external' : 'internal');
@WT_Site::preference('SMTP_HOST', $PGV_SMTP_HOST);
@WT_Site::preference('SMTP_HELO', $PGV_SMTP_HELO);
@WT_Site::preference('SMTP_PORT', $PGV_SMTP_PORT);
@WT_Site::preference('SMTP_AUTH', $PGV_SMTP_AUTH);
@WT_Site::preference('SMTP_AUTH_USER', $PGV_SMTP_AUTH_USER);
@WT_Site::preference('SMTP_AUTH_PASS', $PGV_SMTP_AUTH_PASS);
@WT_Site::preference('SMTP_SSL', $PGV_SMTP_SSL);
@WT_Site::preference('SMTP_FROM_NAME', $PGV_SMTP_FROM_NAME);
////////////////////////////////////////////////////////////////////////////////
echo '<p>pgv_site_setting => wt_site_setting ...</p>';
flush();
if (ini_get('output_buffering')) {
ob_flush();
}
WT_DB::prepare("REPLACE INTO `##site_setting` (setting_name, setting_value)" . " SELECT site_setting_name, site_setting_value FROM `{$DBNAME}`.`{$TBLPREFIX}site_setting`" . " WHERE site_setting_name IN ('DEFAULT_GEDCOM', 'LAST_CHANGE_EMAIL')")->execute();
////////////////////////////////////////////////////////////////////////////////
if ($PGV_SCHEMA_VERSION >= 12) {
echo '<p>pgv_gedcom => wt_gedcom ...</p>';
flush();
if (ini_get('output_buffering')) {
ob_flush();
}
WT_DB::prepare("INSERT INTO `##gedcom` (gedcom_id, gedcom_name)" . " SELECT gedcom_id, gedcom_name FROM `{$DBNAME}`.`{$TBLPREFIX}gedcom`")->execute();
示例9: getThemeMenu
public static function getThemeMenu()
{
global $SEARCH_SPIDER;
if (WT_GED_ID && !$SEARCH_SPIDER && WT_Site::preference('ALLOW_USER_THEMES') && get_gedcom_setting(WT_GED_ID, 'ALLOW_THEME_DROPDOWN')) {
$menu = new WT_Menu(WT_I18N::translate('Theme'), '#', 'menu-theme');
foreach (get_theme_names() as $themename => $themedir) {
$submenu = new WT_Menu($themename, get_query_url(array('theme' => $themedir), '&'), 'menu-theme-' . $themedir);
if (WT_THEME_DIR == 'themes/' . $themedir . '/') {
$submenu->addClass('', '', 'theme-active');
}
$menu->addSubMenu($submenu);
}
return $menu;
} else {
return null;
}
}
示例10: header
// seconds, for systems with low timeout values.
//
// webtrees: Web based Family History software
// Copyright (C) 2014 Greg Roach
//
// 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
if (!defined('WT_WEBTREES')) {
header('HTTP/1.0 403 Forbidden');
exit;
}
self::exec("CREATE TABLE IF NOT EXISTS `##gedcom_chunk` (" . " gedcom_chunk_id INTEGER AUTO_INCREMENT NOT NULL," . " gedcom_id INTEGER NOT NULL," . " chunk_data MEDIUMBLOB NOT NULL," . " imported BOOLEAN NOT NULL DEFAULT FALSE," . " PRIMARY KEY (gedcom_chunk_id)," . " KEY ix1 (gedcom_id, imported)," . " FOREIGN KEY fk1 (gedcom_id) REFERENCES `##gedcom` (gedcom_id)" . ") COLLATE utf8_unicode_ci ENGINE=InnoDB");
try {
self::exec("ALTER TABLE `##gedcom` DROP import_gedcom, DROP import_offset");
} catch (PDOException $ex) {
// Perhaps we have already deleted these columns?
}
// Update the version to indicate success
WT_Site::preference($schema_name, $next_version);
示例11: fail
case 'SMTP_SSL':
case 'WELCOME_TEXT_AUTH_MODE':
break;
case 'SMTP_AUTH_PASS':
// The password will be displayed as "click to edit" on screen.
// Accept the update, but pretend to fail. This will leave the "click to edit" on screen
if ($value) {
WT_Site::preference($id1, $value);
}
fail();
default:
// An unrecognized setting
fail();
}
// Authorised and valid - make update
WT_Site::preference($id1, $value);
ok();
case 'site_access_rule':
//////////////////////////////////////////////////////////////////////////////
// Table name: WT_SITE_ACCESS_RULE
// ID format: site_access_rule-{column_name}-{user_id}
//////////////////////////////////////////////////////////////////////////////
if (!Auth::isAdmin()) {
fail();
}
switch ($id1) {
case 'ip_address_start':
case 'ip_address_end':
WT_DB::prepare("UPDATE `##site_access_rule` SET {$id1}=INET_ATON(?) WHERE site_access_rule_id=?")->execute(array($value, $id2));
$value = WT_DB::prepare("SELECT INET_NTOA({$id1}) FROM `##site_access_rule` WHERE site_access_rule_id=?")->execute(array($id2))->fetchOne();
ok();
示例12: updateSchema
public static function updateSchema($schema_dir, $schema_name, $target_version)
{
try {
$current_version = (int) WT_Site::preference($schema_name);
} catch (PDOException $e) {
// During initial installation, this table won’t exist.
// It will only be a problem if we can’t subsequently create it.
$current_version = 0;
}
// The update scripts can set these to indicate that we need to run a
// "post update" script. It saves from having to store/maintain lots
// of separate versions at each schema version.
$need_to_delete_old_files = false;
$need_to_update_config_data = false;
$need_to_update_stored_procedures = false;
// During installation, the current version is set to a special value of
// -1 (v1.2.5 to v1.2.7) or -2 (v1.3.0 onwards). This indicates that the tables have
// been created, but that we still need to install/update configuration data
// and/or stored procedures.
switch ($current_version) {
case -1:
// Due to a bug in webtrees 1.2.5 - 1.2.7, the setup value of "-1"
// wasn't being updated.
$current_version = 12;
WT_Site::preference($schema_name, $current_version);
break;
case -2:
// Because of the above bug, we now set the version to -2 during setup.
$current_version = $target_version;
WT_Site::preference($schema_name, $current_version);
break;
}
// Update the schema, one version at a time.
while ($current_version < $target_version) {
$next_version = $current_version + 1;
require $schema_dir . 'db_schema_' . $current_version . '_' . $next_version . '.php';
// The updatescript should update the version or throw an exception
$current_version = (int) WT_Site::preference($schema_name);
if ($current_version != $next_version) {
die("Internal error while updating {$schema_name} to {$next_version}");
}
}
if ($need_to_delete_old_files) {
require $schema_dir . 'delete_old_files.php';
}
if ($need_to_update_config_data) {
require $schema_dir . 'config_data.php';
}
if ($need_to_update_stored_procedures) {
require $schema_dir . 'stored_procedures.php';
}
}
示例13: array
$convert = WT_Filter::get('convert', 'yes|no', 'no');
$zip = WT_Filter::get('zip', 'yes|no', 'no');
$conv_path = WT_Filter::get('conv_path');
$privatize_export = WT_Filter::get('privatize_export', 'none|visitor|user|gedadmin');
if ($action == 'download') {
$exportOptions = array();
$exportOptions['privatize'] = $privatize_export;
$exportOptions['toANSI'] = $convert;
$exportOptions['path'] = $conv_path;
}
$fileName = WT_GEDCOM;
if ($action == "download" && $zip == "yes") {
require WT_ROOT . 'library/pclzip.lib.php';
$temppath = WT_Site::preference('INDEX_DIRECTORY') . "tmp/";
$zipname = "dl" . date("YmdHis") . $fileName . ".zip";
$zipfile = WT_Site::preference('INDEX_DIRECTORY') . $zipname;
$gedname = $temppath . $fileName;
$removeTempDir = false;
if (!is_dir($temppath)) {
$res = mkdir($temppath);
if ($res !== true) {
echo "Error : Could not create temporary path!";
exit;
}
$removeTempDir = true;
}
$gedout = fopen($gedname, "w");
export_gedcom($GEDCOM, $gedout, $exportOptions);
fclose($gedout);
$comment = "Created by " . WT_WEBTREES . " " . WT_VERSION . " on " . date("r") . ".";
$archive = new PclZip($zipfile);
示例14: edit_field_yes_no_inline
</dt>
<dd><?php
echo edit_field_yes_no_inline('site_setting-USE_REGISTRATION_MODULE', WT_Site::preference('USE_REGISTRATION_MODULE'), $controller);
?>
</dd>
<dt><?php
echo WT_I18N::translate('Require an administrator to approve new user registrations'), help_link('REQUIRE_ADMIN_AUTH_REGISTRATION');
?>
</dt>
<dd><?php
echo edit_field_yes_no_inline('site_setting-REQUIRE_ADMIN_AUTH_REGISTRATION', WT_Site::preference('REQUIRE_ADMIN_AUTH_REGISTRATION'), $controller);
?>
</dd>
<dt><?php
echo WT_I18N::translate('Show acceptable use agreement on “Request new user account” page'), help_link('SHOW_REGISTER_CAUTION');
?>
</dt>
<dd><?php
echo edit_field_yes_no_inline('site_setting-SHOW_REGISTER_CAUTION', WT_Site::preference('SHOW_REGISTER_CAUTION'), $controller);
?>
</dd>
</dl>
</td>
</tr>
</table>
</div>
</div>
</div>
示例15:
echo ' checked="checked" ';
}
echo '>', WT_I18N::translate('Daitch-Mokotoff');
echo '</p></div>';
// Associates Section
echo '<div class="label">', WT_I18N::translate('Associates'), '</div>
<div class="value"><input type="checkbox" name="showasso" value="on"';
if ($controller->showasso == "on") {
echo ' checked="checked" ';
}
echo '>', WT_I18N::translate('Show related individuals/families'), '</div>';
}
// If the search is a general or soundex search then possibly display checkboxes for the gedcoms
if ($controller->action == "general" || $controller->action == "soundex") {
// If more than one GEDCOM, switching is allowed AND DB mode is set, let the user select
if (count(WT_Tree::getAll()) > 1 && WT_Site::preference('ALLOW_CHANGE_GEDCOM')) {
// More Than 3 Gedcom Filess enable elect all & select none buttons
if (count(WT_Tree::getAll()) > 3) {
echo '<div class="label"> </div>
<div class="value">
<input type="button" value="', WT_I18N::translate('select all'), '" onclick="jQuery(\'#search_trees :checkbox\').each(function(){jQuery(this).attr(\'checked\', true);});return false;">
<input type="button" value="', WT_I18N::translate('select none'), '" onclick="jQuery(\'#search_trees :checkbox\').each(function(){jQuery(this).attr(\'checked\', false);});return false;">';
// More Than 10 Gedcom Files enable invert selection button
if (count(WT_Tree::getAll()) > 10) {
echo '<input type="button" value="', WT_I18N::translate('invert selection'), '" onclick="jQuery(\'#search_trees :checkbox\').each(function(){jQuery(this).attr(\'checked\', !jQuery(this).attr(\'checked\'));});return false;">';
}
echo '</div>';
}
echo '<div class="label">', WT_I18N::translate('Family trees'), '</div>
<div id="search_trees" class="value">';
//-- sorting menu by gedcom filename