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


PHP WT_Site::setPreference方法代码示例

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


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

示例1: fetch_latest_version

function fetch_latest_version()
{
    $last_update_timestamp = WT_Site::getPreference('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::setPreference('LATEST_WT_VERSION', $latest_version_txt);
            WT_Site::setPreference('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::getPreference('LATEST_WT_VERSION');
        }
    } else {
        return WT_Site::getPreference('LATEST_WT_VERSION');
    }
}
开发者ID:jacoline,项目名称:webtrees,代码行数:19,代码来源:functions.php

示例2: 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;
}
// Remove the i_isdead column
try {
    self::exec("ALTER TABLE `##individuals` DROP i_isdead");
} catch (PDOException $ex) {
    // Already done this?
}
// Update the version to indicate success
WT_Site::setPreference($schema_name, $next_version);
开发者ID:jacoline,项目名称:webtrees,代码行数:30,代码来源:db_schema_13_14.php

示例3: array

    return $menu->getMenuAsList();
}
/**
 *  Define the default palette to be used.  Set $subColor
 *  to one of the collowing values to determine the default:
 *
 */
$COLOR_THEME_LIST = array('aquamarine' => WT_I18N::translate('Aqua Marine'), 'ash' => WT_I18N::translate('Ash'), 'belgianchocolate' => WT_I18N::translate('Belgian Chocolate'), 'bluelagoon' => WT_I18N::translate('Blue Lagoon'), 'bluemarine' => WT_I18N::translate('Blue Marine'), 'coffeeandcream' => WT_I18N::translate('Coffee and Cream'), 'coldday' => WT_I18N::translate('Cold Day'), 'greenbeam' => WT_I18N::translate('Green Beam'), 'mediterranio' => WT_I18N::translate('Mediterranio'), 'mercury' => WT_I18N::translate('Mercury'), 'nocturnal' => WT_I18N::translate('Nocturnal'), 'olivia' => WT_I18N::translate('Olivia'), 'pinkplastic' => WT_I18N::translate('Pink Plastic'), 'sage' => WT_I18N::translate('Sage'), 'shinytomato' => WT_I18N::translate('Shiny Tomato'), 'tealtop' => WT_I18N::translate('Teal Top'));
// If we've selected a new palette, and we are logged in, set this value as a default.
if (isset($_GET['themecolor']) && array_key_exists($_GET['themecolor'], $COLOR_THEME_LIST)) {
    // Request to change color
    $subColor = $_GET['themecolor'];
    if (Auth::id()) {
        Auth::user()->setSetting('themecolor', $subColor);
        if (Auth::isAdmin()) {
            WT_Site::setPreference('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;
}
开发者ID:jacoline,项目名称:webtrees,代码行数:31,代码来源:theme.php

示例4: getBlock

 public function getBlock($block_id, $template = true, $cfg = null)
 {
     global $ctype, $WEBTREES_EMAIL;
     $changes = WT_DB::prepare("SELECT 1" . " FROM `##change`" . " WHERE status='pending'" . " LIMIT 1")->fetchOne();
     $days = get_block_setting($block_id, 'days', 1);
     $sendmail = get_block_setting($block_id, 'sendmail', true);
     $block = get_block_setting($block_id, 'block', true);
     if ($cfg) {
         foreach (array('days', 'sendmail', 'block') as $name) {
             if (array_key_exists($name, $cfg)) {
                 ${$name} = $cfg[$name];
             }
         }
     }
     if ($changes && $sendmail == 'yes') {
         // There are pending changes - tell moderators/managers/administrators about them.
         if (WT_TIMESTAMP - WT_Site::getPreference('LAST_CHANGE_EMAIL') > 60 * 60 * 24 * $days) {
             // Which users have pending changes?
             foreach (User::all() as $user) {
                 if ($user->getSetting('contactmethod') !== 'none') {
                     foreach (WT_Tree::getAll() as $tree) {
                         if (exists_pending_change($user, $tree)) {
                             WT_I18N::init($user->getSetting('language'));
                             WT_Mail::systemMessage($tree, $user, WT_I18N::translate('Pending changes'), WT_I18N::translate('There are pending changes for you to moderate.') . WT_Mail::EOL . WT_MAIL::EOL . '<a href="' . WT_SERVER_NAME . WT_SCRIPT_PATH . 'index.php?ged=' . WT_GEDURL . '">' . WT_SERVER_NAME . WT_SCRIPT_PATH . 'index.php?ged=' . WT_GEDURL . '</a>');
                             WT_I18N::init(WT_LOCALE);
                         }
                     }
                 }
             }
             WT_Site::setPreference('LAST_CHANGE_EMAIL', WT_TIMESTAMP);
         }
         if (WT_USER_CAN_EDIT) {
             $id = $this->getName() . $block_id;
             $class = $this->getName() . '_block';
             if ($ctype == 'gedcom' && WT_USER_GEDCOM_ADMIN || $ctype == 'user' && WT_USER_ID) {
                 $title = '<i class="icon-admin" title="' . WT_I18N::translate('Configure') . '" onclick="modalDialog(\'block_edit.php?block_id=' . $block_id . '\', \'' . $this->getTitle() . '\');"></i>';
             } else {
                 $title = '';
             }
             $title .= $this->getTitle() . help_link('review_changes', $this->getName());
             $content = '';
             if (WT_USER_CAN_ACCEPT) {
                 $content .= "<a href=\"#\" onclick=\"window.open('edit_changes.php','_blank', chan_window_specs); return false;\">" . WT_I18N::translate('There are pending changes for you to moderate.') . "</a><br>";
             }
             if ($sendmail == "yes") {
                 $content .= WT_I18N::translate('Last email reminder was sent ') . format_timestamp(WT_Site::getPreference('LAST_CHANGE_EMAIL')) . "<br>";
                 $content .= WT_I18N::translate('Next email reminder will be sent after ') . format_timestamp(WT_Site::getPreference('LAST_CHANGE_EMAIL') + 60 * 60 * 24 * $days) . "<br><br>";
             }
             $changes = WT_DB::prepare("SELECT xref" . " FROM  `##change`" . " WHERE status='pending'" . " AND   gedcom_id=?" . " GROUP BY xref")->execute(array(WT_GED_ID))->fetchAll();
             foreach ($changes as $change) {
                 $record = WT_GedcomRecord::getInstance($change->xref);
                 if ($record->canShow()) {
                     $content .= '<b>' . $record->getFullName() . '</b>';
                     $content .= $block ? '<br>' : ' ';
                     $content .= '<a href="' . $record->getHtmlUrl() . '">' . WT_I18N::translate('View the changes') . '</a>';
                     $content .= '<br>';
                 }
             }
             if ($template) {
                 if ($block) {
                     require WT_THEME_DIR . 'templates/block_small_temp.php';
                 } else {
                     require WT_THEME_DIR . 'templates/block_main_temp.php';
                 }
             } else {
                 return $content;
             }
         }
     }
 }
开发者ID:jacoline,项目名称:webtrees,代码行数:70,代码来源:module.php

示例5: delete

 public static function delete($tree_id)
 {
     // If this is the default tree, then unset
     if (WT_Site::getPreference('DEFAULT_GEDCOM') == self::getNameFromId($tree_id)) {
         WT_Site::setPreference('DEFAULT_GEDCOM', '');
     }
     // Don't delete the logs.
     WT_DB::prepare("UPDATE `##log` SET gedcom_id=NULL   WHERE gedcom_id =?")->execute(array($tree_id));
     WT_DB::prepare("DELETE `##block_setting` FROM `##block_setting` JOIN `##block` USING (block_id) WHERE gedcom_id=?")->execute(array($tree_id));
     WT_DB::prepare("DELETE FROM `##block`               WHERE gedcom_id =?")->execute(array($tree_id));
     WT_DB::prepare("DELETE FROM `##dates`               WHERE d_file    =?")->execute(array($tree_id));
     WT_DB::prepare("DELETE FROM `##families`            WHERE f_file    =?")->execute(array($tree_id));
     WT_DB::prepare("DELETE FROM `##user_gedcom_setting` WHERE gedcom_id =?")->execute(array($tree_id));
     WT_DB::prepare("DELETE FROM `##gedcom_setting`      WHERE gedcom_id =?")->execute(array($tree_id));
     WT_DB::prepare("DELETE FROM `##individuals`         WHERE i_file    =?")->execute(array($tree_id));
     WT_DB::prepare("DELETE FROM `##link`                WHERE l_file    =?")->execute(array($tree_id));
     WT_DB::prepare("DELETE FROM `##media`               WHERE m_file    =?")->execute(array($tree_id));
     WT_DB::prepare("DELETE FROM `##module_privacy`      WHERE gedcom_id =?")->execute(array($tree_id));
     WT_DB::prepare("DELETE FROM `##name`                WHERE n_file    =?")->execute(array($tree_id));
     WT_DB::prepare("DELETE FROM `##next_id`             WHERE gedcom_id =?")->execute(array($tree_id));
     WT_DB::prepare("DELETE FROM `##other`               WHERE o_file    =?")->execute(array($tree_id));
     WT_DB::prepare("DELETE FROM `##placelinks`          WHERE pl_file   =?")->execute(array($tree_id));
     WT_DB::prepare("DELETE FROM `##places`              WHERE p_file    =?")->execute(array($tree_id));
     WT_DB::prepare("DELETE FROM `##sources`             WHERE s_file    =?")->execute(array($tree_id));
     WT_DB::prepare("DELETE FROM `##hit_counter`         WHERE gedcom_id =?")->execute(array($tree_id));
     WT_DB::prepare("DELETE FROM `##change`              WHERE gedcom_id =?")->execute(array($tree_id));
     WT_DB::prepare("DELETE FROM `##default_resn`        WHERE gedcom_id =?")->execute(array($tree_id));
     WT_DB::prepare("DELETE FROM `##gedcom_chunk`        WHERE gedcom_id =?")->execute(array($tree_id));
     WT_DB::prepare("DELETE FROM `##log`                 WHERE gedcom_id =?")->execute(array($tree_id));
     WT_DB::prepare("DELETE FROM `##gedcom`              WHERE gedcom_id =?")->execute(array($tree_id));
     // After updating the database, we need to fetch a new (sorted) copy
     self::$trees = null;
 }
开发者ID:jacoline,项目名称:webtrees,代码行数:33,代码来源:Tree.php

示例6: updateSchema

 /**
  * Run a series of scripts to bring the database schema up to date.
  *
  * @param $schema_dir
  * @param $schema_name
  * @param $target_version
  *
  * @return void
  * @throws Exception
  */
 public static function updateSchema($schema_dir, $schema_name, $target_version)
 {
     try {
         $current_version = (int) WT_Site::getPreference($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;
     }
     // 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, and we are already at the latest version.
     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::setPreference($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::setPreference($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::getPreference($schema_name);
         if ($current_version != $next_version) {
             throw new Exception("Internal error while updating {$schema_name} to {$next_version}");
         }
     }
 }
开发者ID:jacoline,项目名称:webtrees,代码行数:46,代码来源:DB.php

示例7: IN

}
// TODO May need to set 'DATA_DIRECTORY' to $INDEX_DIRECTORY when dealing with media??
@WT_Site::setPreference('USE_REGISTRATION_MODULE', $USE_REGISTRATION_MODULE);
@WT_Site::setPreference('REQUIRE_ADMIN_AUTH_REGISTRATION', $REQUIRE_ADMIN_AUTH_REGISTRATION);
@WT_Site::setPreference('ALLOW_USER_THEMES', $ALLOW_USER_THEMES);
@WT_Site::setPreference('ALLOW_CHANGE_GEDCOM', $ALLOW_CHANGE_GEDCOM);
@WT_Site::setPreference('SESSION_TIME', $PGV_SESSION_TIME);
@WT_Site::setPreference('SMTP_ACTIVE', $PGV_SMTP_ACTIVE ? 'external' : 'internal');
@WT_Site::setPreference('SMTP_HOST', $PGV_SMTP_HOST);
@WT_Site::setPreference('SMTP_HELO', $PGV_SMTP_HELO);
@WT_Site::setPreference('SMTP_PORT', $PGV_SMTP_PORT);
@WT_Site::setPreference('SMTP_AUTH', $PGV_SMTP_AUTH);
@WT_Site::setPreference('SMTP_AUTH_USER', $PGV_SMTP_AUTH_USER);
@WT_Site::setPreference('SMTP_AUTH_PASS', $PGV_SMTP_AUTH_PASS);
@WT_Site::setPreference('SMTP_SSL', $PGV_SMTP_SSL);
@WT_Site::setPreference('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();
开发者ID:jacoline,项目名称:webtrees,代码行数:31,代码来源:admin_pgv_to_wt.php

示例8: 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::setPreference($id1, $value);
             }
             fail();
         default:
             // An unrecognized setting
             fail();
     }
     // Authorised and valid - make update
     WT_Site::setPreference($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();
开发者ID:jacoline,项目名称:webtrees,代码行数:31,代码来源:save.php

示例9: set_gedcom_setting

    set_gedcom_setting($gedcom_id, 'gedcom_filename', $filename);
    WT_DB::exec("COMMIT");
    fclose($fp);
}
// Process POST actions
switch (WT_Filter::post('action')) {
    case 'delete':
        $gedcom_id = WT_Filter::postInteger('gedcom_id');
        if (WT_Filter::checkCsrf() && $gedcom_id) {
            WT_Tree::delete($gedcom_id);
        }
        header('Location: ' . WT_SERVER_NAME . WT_SCRIPT_PATH . WT_SCRIPT_NAME);
        break;
    case 'setdefault':
        if (WT_Filter::checkCsrf()) {
            WT_Site::setPreference('DEFAULT_GEDCOM', WT_Filter::post('default_ged'));
        }
        break;
    case 'new_tree':
        $ged_name = basename(WT_Filter::post('ged_name'));
        if (WT_Filter::checkCsrf() && $ged_name) {
            WT_Tree::create($ged_name);
        }
        break;
    case 'replace_upload':
        $gedcom_id = WT_Filter::postInteger('gedcom_id');
        // Make sure the gedcom still exists
        if (WT_Filter::checkCsrf() && get_gedcom_from_id($gedcom_id)) {
            foreach ($_FILES as $FILE) {
                if ($FILE['error'] == 0 && is_readable($FILE['tmp_name'])) {
                    import_gedcom_file($gedcom_id, $FILE['tmp_name'], $FILE['name']);
开发者ID:jacoline,项目名称:webtrees,代码行数:31,代码来源:admin_trees_manage.php


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