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


PHP WT_DB::exec方法代码示例

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


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

示例1: import_gedcom_file

function import_gedcom_file($gedcom_id, $path, $filename)
{
    // Read the file in blocks of roughly 64K.  Ensure that each block
    // contains complete gedcom records.  This will ensure we don’t split
    // multi-byte characters, as well as simplifying the code to import
    // each block.
    $file_data = '';
    $fp = fopen($path, 'rb');
    WT_DB::exec("START TRANSACTION");
    WT_DB::prepare("DELETE FROM `##gedcom_chunk` WHERE gedcom_id=?")->execute(array($gedcom_id));
    while (!feof($fp)) {
        $file_data .= fread($fp, 65536);
        // There is no strrpos() function that searches for substrings :-(
        for ($pos = strlen($file_data) - 1; $pos > 0; --$pos) {
            if ($file_data[$pos] == '0' && ($file_data[$pos - 1] == "\n" || $file_data[$pos - 1] == "\r")) {
                // We’ve found the last record boundary in this chunk of data
                break;
            }
        }
        if ($pos) {
            WT_DB::prepare("INSERT INTO `##gedcom_chunk` (gedcom_id, chunk_data) VALUES (?, ?)")->execute(array($gedcom_id, substr($file_data, 0, $pos)));
            $file_data = substr($file_data, $pos);
        }
    }
    WT_DB::prepare("INSERT INTO `##gedcom_chunk` (gedcom_id, chunk_data) VALUES (?, ?)")->execute(array($gedcom_id, $file_data));
    set_gedcom_setting($gedcom_id, 'gedcom_filename', $filename);
    WT_DB::exec("COMMIT");
    fclose($fp);
}
开发者ID:brambravo,项目名称:webtrees,代码行数:29,代码来源:admin_trees_manage.php

示例2: header

//
// The script should assume that it can be interrupted at
// any point, and be able to continue by re-running the script.
// Fatal errors, however, should be allowed to throw exceptions,
// which will be caught by the framework.
// It shouldn't do anything that might take more than a few
// seconds, for systems with low timeout values.
//
// 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
if (!defined('WT_WEBTREES')) {
    header('HTTP/1.0 403 Forbidden');
    exit;
}
WT_DB::exec("CREATE TABLE IF NOT EXISTS `##news` (" . " n_id       INTEGER AUTO_INCREMENT NOT NULL," . " n_username VARCHAR(100)           NOT NULL," . " n_date     INTEGER                NOT NULL," . " n_title    VARCHAR(255)           NOT NULL," . " n_text     TEXT                   NOT NULL," . " PRIMARY KEY     (n_id)," . "         KEY ix1 (n_username)" . ") COLLATE utf8_unicode_ci ENGINE=InnoDB");
// Update the version to indicate success
WT_Site::setPreference($schema_name, $next_version);
开发者ID:jacoline,项目名称:webtrees,代码行数:31,代码来源:db_schema_0_1.php

示例3: header

// It shouldn't do anything that might take more than a few
// 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;
}
// Create all of the tables needed for this module
try {
    WT_DB::exec("ALTER TABLE `##placelocation` ADD (" . " pl_media      VARCHAR(60)     NULL," . " sv_long       FLOAT           NOT NULL DEFAULT 0," . " sv_lati       FLOAT           NOT NULL DEFAULT 0," . " sv_bearing    FLOAT           NOT NULL DEFAULT 0," . " sv_elevation  FLOAT           NOT NULL DEFAULT 0," . " sv_zoom       FLOAT           NOT NULL DEFAULT 1" . ")");
} catch (PDOException $ex) {
    // Already done this?
}
// Update the version to indicate success
WT_Site::preference($schema_name, $next_version);
开发者ID:brambravo,项目名称:webtrees,代码行数:31,代码来源:db_schema_1_2.php

示例4: header

//
// 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
if (!defined('WT_WEBTREES')) {
    header('HTTP/1.0 403 Forbidden');
    exit;
}
// Delete any data that might violate the new constraints
WT_DB::exec("DELETE FROM `##news`" . " WHERE user_id   NOT IN (SELECT user_id   FROM `##user`  )" . " OR    gedcom_id NOT IN (SELECT gedcom_id FROM `##gedcom`)");
// Add the new constraints
try {
    WT_DB::exec("ALTER TABLE `##news`" . " ADD FOREIGN KEY news_fk1 (user_id  ) REFERENCES `##user`   (user_id)   ON DELETE CASCADE," . " ADD FOREIGN KEY news_fk2 (gedcom_id) REFERENCES `##gedcom` (gedcom_id) ON DELETE CASCADE");
} catch (PDOException $ex) {
    // Already updated?
}
// Update the version to indicate success
WT_Site::setPreference($schema_name, $next_version);
开发者ID:jacoline,项目名称:webtrees,代码行数:31,代码来源:db_schema_2_3.php

示例5: header

        exit;
    }
} else {
    // No config file. Set one up.
    header('Location: ' . WT_SERVER_NAME . WT_SCRIPT_PATH . 'setup.php');
    exit;
}
$WT_REQUEST = new Zend_Controller_Request_Http();
require WT_ROOT . 'includes/authentication.php';
// Connect to the database
try {
    WT_DB::createInstance($dbconfig['dbhost'], $dbconfig['dbport'], $dbconfig['dbname'], $dbconfig['dbuser'], $dbconfig['dbpass']);
    define('WT_TBLPREFIX', $dbconfig['tblpfx']);
    unset($dbconfig);
    // Some of the FAMILY JOIN HUSBAND JOIN WIFE queries can excede the MAX_JOIN_SIZE setting
    WT_DB::exec("SET NAMES 'utf8' COLLATE 'utf8_unicode_ci', SQL_BIG_SELECTS=1");
    try {
        WT_DB::updateSchema(WT_ROOT . 'includes/db_schema/', 'WT_SCHEMA_VERSION', WT_SCHEMA_VERSION);
    } catch (PDOException $ex) {
        // The schema update scripts should never fail.  If they do, there is no clean recovery.
        die($ex);
    }
} catch (PDOException $ex) {
    header('Location: ' . WT_SERVER_NAME . WT_SCRIPT_PATH . 'site-unavailable.php');
    exit;
}
// The config.ini.php file must always be in a fixed location.
// Other user files can be stored elsewhere...
define('WT_DATA_DIR', realpath(WT_Site::preference('INDEX_DIRECTORY') ? WT_Site::preference('INDEX_DIRECTORY') : 'data') . DIRECTORY_SEPARATOR);
// If we have a preferred URL (e.g. www.example.com instead of www.isp.com/~example), then redirect to it.
$SERVER_URL = WT_Site::preference('SERVER_URL');
开发者ID:brambravo,项目名称:webtrees,代码行数:31,代码来源:session.php

示例6: header

// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
if (!defined('WT_WEBTREES')) {
    header('HTTP/1.0 403 Forbidden');
    exit;
}
// Add new columns
try {
    WT_DB::exec("ALTER TABLE `##news`" . " ADD user_id INTEGER NULL AFTER n_id," . " ADD gedcom_id INTEGER NULL AFTER user_id," . " ADD updated TIMESTAMP ON UPDATE CURRENT_TIMESTAMP DEFAULT CURRENT_TIMESTAMP," . " ADD KEY news_ix1 (user_id, updated)," . " ADD KEY news_ix2 (gedcom_id, updated)");
} catch (PDOException $ex) {
    // Already updated?
}
// Migrate data from the old columns to the new ones
try {
    WT_DB::exec("UPDATE `##news` n" . " LEFT JOIN `##gedcom` g ON (n.n_username=g.gedcom_name)" . " LEFT JOIN `##user` u ON (n.n_username=u.user_name)" . " SET n.gedcom_id=g.gedcom_id, n.user_id=u.user_id, updated=FROM_UNIXTIME(n_date)");
} catch (PDOException $ex) {
    // Already updated?
}
// Delete orphaned rows
try {
    WT_DB::exec("DELETE FROM `##news` WHERE user_id IS NULL AND gedcom_id IS NULL");
} catch (PDOException $ex) {
    // Already updated?
}
// Delete/rename old columns
try {
    WT_DB::exec("ALTER TABLE `##news`" . " DROP n_username, DROP n_date," . " CHANGE n_id news_id INTEGER NOT NULL AUTO_INCREMENT," . " CHANGE n_title subject VARCHAR(255) COLLATE utf8_unicode_ci," . " CHANGE n_text body TEXT COLLATE utf8_unicode_ci");
} catch (PDOException $ex) {
    // Already updated?
}
// Update the version to indicate success
WT_Site::preference($schema_name, $next_version);
开发者ID:brambravo,项目名称:webtrees,代码行数:31,代码来源:db_schema_1_2.php

示例7: header

//
// The script should assume that it can be interrupted at
// any point, and be able to continue by re-running the script.
// Fatal errors, however, should be allowed to throw exceptions,
// which will be caught by the framework.
// It shouldn't do anything that might take more than a few
// seconds, for systems with low timeout values.
//
// 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
if (!defined('WT_WEBTREES')) {
    header('HTTP/1.0 403 Forbidden');
    exit;
}
WT_DB::exec("UPDATE `##placelocation` SET pl_icon=REPLACE(pl_icon, '.gif', '.png')");
// Update the version to indicate success
WT_Site::setPreference($schema_name, $next_version);
开发者ID:jacoline,项目名称:webtrees,代码行数:31,代码来源:db_schema_2_3.php

示例8: REPLACE

        $data = WT_DB::prepare("SELECT gedcom_chunk_id, REPLACE(chunk_data, '\r', '\n') AS chunk_data" . " FROM `##gedcom_chunk`" . " WHERE gedcom_chunk_id=?")->execute(array($data->gedcom_chunk_id))->fetchOneRow();
    }
    if (!$data) {
        break;
    }
    try {
        // Import all the records in this chunk of data
        foreach (preg_split('/\\n+(?=0)/', $data->chunk_data) as $rec) {
            import_record($rec, $gedcom_id, false);
        }
        // Mark the chunk as imported
        WT_DB::prepare("UPDATE `##gedcom_chunk` SET imported=TRUE WHERE gedcom_chunk_id=?")->execute(array($data->gedcom_chunk_id));
    } catch (PDOException $ex) {
        WT_DB::exec("ROLLBACK");
        if ($ex->getCode() == '40001') {
            // "SQLSTATE[40001]: Serialization failure: 1213 Deadlock found when trying to get lock; try restarting transaction"
            // The documentation says that if you get this error, wait and try again.....
            sleep(1);
            $controller->addInlineJavascript('jQuery("#import' . $gedcom_id . '").load("import.php?gedcom_id=' . $gedcom_id . '&u=' . uniqid() . '");');
        } else {
            // A fatal error.  Nothing we can do?
            echo '<span class="error">', $ex->getMessage(), '</span>';
            $controller->addInlineJavascript('jQuery("#actions' . $gedcom_id . '").toggle();');
        }
        exit;
    }
}
WT_DB::exec("COMMIT");
// Reload.....
// Use uniqid() to prevent jQuery caching the previous response.
$controller->addInlineJavascript('jQuery("#import' . $gedcom_id . '").load("import.php?gedcom_id=' . $gedcom_id . '&u=' . uniqid() . '");');
开发者ID:brambravo,项目名称:webtrees,代码行数:31,代码来源:import.php

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

示例10: header

// The script should assume that it can be interrupted at
// any point, and be able to continue by re-running the script.
// Fatal errors, however, should be allowed to throw exceptions,
// which will be caught by the framework.
// It shouldn't do anything that might take more than a few
// 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;
}
// Create all of the tables needed for this module
WT_DB::exec("CREATE TABLE IF NOT EXISTS `##placelocation` (" . " pl_id        INTEGER      NOT NULL," . " pl_parent_id INTEGER          NULL," . " pl_level     INTEGER          NULL," . " pl_place     VARCHAR(255)     NULL," . " pl_long      VARCHAR(30)      NULL," . " pl_lati      VARCHAR(30)      NULL," . " pl_zoom      INTEGER          NULL," . " pl_icon      VARCHAR(255)     NULL," . " PRIMARY KEY     (pl_id)," . "         KEY ix1 (pl_level)," . "         KEY ix2 (pl_long)," . "         KEY ix3 (pl_lati)," . "         KEY ix4 (pl_place)," . "         KEY ix5 (pl_parent_id)" . ") COLLATE utf8_unicode_ci ENGINE=InnoDB");
// Update the version to indicate success
WT_Site::setPreference($schema_name, $next_version);
开发者ID:jacoline,项目名称:webtrees,代码行数:31,代码来源:db_schema_0_1.php

示例11: VARCHAR

try {
    WT_DB::exec("ALTER TABLE `##favorites`" . " CHANGE fv_id    favorite_id   INTEGER AUTO_INCREMENT NOT NULL," . " CHANGE fv_gid   xref          VARCHAR(20) NULL," . " CHANGE fv_type  favorite_type ENUM('INDI', 'FAM', 'SOUR', 'REPO', 'OBJE', 'NOTE', 'URL') NOT NULL," . " CHANGE fv_url   url           VARCHAR(255) NULL," . " CHANGE fv_title title         VARCHAR(255) NULL," . " CHANGE fv_note  note          VARCHAR(1000) NULL," . " ADD user_id   INTEGER     NULL AFTER favorite_id," . " ADD gedcom_id INTEGER NOT NULL AFTER user_id," . " DROP KEY ix1," . " ADD KEY news_ix1 (gedcom_id, user_id)");
} catch (PDOException $ex) {
    // Already updated?
}
// Migrate data from the old columns to the new ones
try {
    WT_DB::exec("UPDATE `##favorites` f" . " LEFT JOIN `##gedcom` g ON (f.fv_file    =g.gedcom_name)" . " LEFT JOIN `##user`   u ON (f.fv_username=u.user_name)" . " SET f.gedcom_id=g.gedcom_id, f.user_id=u.user_id");
} catch (PDOException $ex) {
    // Already updated?
}
// Delete orphaned rows
try {
    WT_DB::exec("DELETE FROM `##favorites` WHERE user_id IS NULL AND gedcom_id IS NULL");
} catch (PDOException $ex) {
    // Already updated?
}
// Delete the old column
try {
    WT_DB::exec("ALTER TABLE `##favorites` DROP fv_username, DROP fv_file");
} catch (PDOException $ex) {
    // Already updated?
}
// Rename the table
try {
    WT_DB::exec("RENAME TABLE `##favorites` TO `##favorite`");
} catch (PDOException $ex) {
    // Already updated?
}
// Update the version to indicate success
WT_Site::setPreference($schema_name, $next_version);
开发者ID:jacoline,项目名称:webtrees,代码行数:31,代码来源:db_schema_1_2.php

示例12: header

// Fatal errors, however, should be allowed to throw exceptions,
// which will be caught by the framework.
// It shouldn't do anything that might take more than a few
// seconds, for systems with low timeout values.
//
// webtrees: Web based Family History software
// Copyright (C) 2014 webtrees development team.
//
// Derived from PhpGedView
// Copyright (C) 2009 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;
}
WT_DB::exec("CREATE TABLE IF NOT EXISTS `##favorites` (" . " fv_id       INTEGER AUTO_INCREMENT NOT NULL," . " fv_username VARCHAR(32)            NOT NULL," . " fv_gid      VARCHAR(20)                NULL," . " fv_type     VARCHAR(15)                NULL," . " fv_file     VARCHAR(100)               NULL," . " fv_url      VARCHAR(255)               NULL," . " fv_title    VARCHAR(255)               NULL," . " fv_note     TEXT                       NULL," . " PRIMARY KEY (fv_id)," . "         KEY ix1 (fv_username)" . ") COLLATE utf8_unicode_ci ENGINE=InnoDB");
// Update the version to indicate success
WT_Site::preference($schema_name, $next_version);
开发者ID:brambravo,项目名称:webtrees,代码行数:31,代码来源:db_schema_0_1.php

示例13: ON

			stateDuration: 180,
			pagingType: "full_numbers",
			columns: [
				/* 0 ip_address         */ { dataSort: 1, class: "ip_address" },
				/* 0 ip_address (sort)  */ { type: "num", visible: false },
				/* 1 user_agent_pattern */ { class: "ua_string" },
				/* 2 updated            */ { class: "ua_string" },
				/* 3 <allowed>          */ { sortable: false, class: "center" },
				/* 4 <banned>           */ { sortable: false, class: "center" },
				/* 5 <search-engine>    */ { sortable: false, class: "center" }
			]
		});
	');
// Delete any "unknown" visitors that are now "known".
// This could happen every time we create/update a rule.
WT_DB::exec("DELETE unknown" . " FROM `##site_access_rule` AS unknown" . " JOIN `##site_access_rule` AS known ON (unknown.user_agent_pattern LIKE known.user_agent_pattern)" . " WHERE unknown.rule='unknown' AND known.rule<>'unknown'" . " AND unknown.ip_address_start BETWEEN known.ip_address_start AND known.ip_address_end");
?>

<h2><?php 
echo WT_I18N::translate('Restrict access to the site, using IP addresses and user-agent strings');
?>
</h2>

<p><?php 
echo WT_I18N::translate('The following rules are used to decide whether a visitor is a human being (allow full access), a search-engine robot (allow restricted access) or an unwanted crawler (deny all access).');
?>
</p>

<table id="site_access_rules" style="width:100%;">
	<thead>
		<tr>
开发者ID:jacoline,项目名称:webtrees,代码行数:31,代码来源:admin_site_access.php

示例14: VARCHAR

 //WT_DB::exec(
 //	"CREATE TABLE IF NOT EXISTS `##language` (".
 //	" language_tag       VARCHAR(16)                      NOT NULL,".
 //	" iso15924_code      CHAR(4)                          NOT NULL,".
 //	" cldr_code          VARCHAR(16)                      NOT NULL,".
 //	" launchpad_code     VARCHAR(16)                      NOT NULL,".
 //	" collation          VARCHAR(16)                      NOT NULL,".
 //	" language_name      VARCHAR(64)                      NOT NULL,".
 //	" language_name_base VARCHAR(64)                      NOT NULL,".
 //	" enabled            ENUM ('yes', 'no') DEFAULT 'yes' NOT NULL,".
 //	" PRIMARY KEY        (language_tag),".
 //	" INDEX              (language_name_base, language_name)".
 //	") COLLATE utf8_unicode_ci ENGINE=InnoDB"
 //);
 WT_DB::exec("CREATE TABLE IF NOT EXISTS `##site_access_rule` (" . " site_access_rule_id INTEGER          NOT NULL AUTO_INCREMENT," . " ip_address_start     INTEGER UNSIGNED NOT NULL DEFAULT 0," . " ip_address_end       INTEGER UNSIGNED NOT NULL DEFAULT 4294967295," . " user_agent_pattern   VARCHAR(255)     NOT NULL," . " rule                 ENUM('allow', 'deny', 'robot', 'unknown') NOT NULL DEFAULT 'unknown'," . " comment              VARCHAR(255)     NOT NULL," . " updated              TIMESTAMP        NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP," . " PRIMARY KEY                          (site_access_rule_id)," . " UNIQUE  KEY `##site_access_rule_ix1` (ip_address_end, ip_address_start, user_agent_pattern, rule)," . "         KEY `##site_access_rule_ix2` (rule)" . ") ENGINE=InnoDB COLLATE=utf8_unicode_ci");
 WT_DB::exec("INSERT IGNORE INTO `##site_access_rule` (user_agent_pattern, rule, comment) VALUES" . " ('Mozilla/5.0 (%) Gecko/% %/%', 'allow', 'Gecko-based browsers')," . " ('Mozilla/5.0 (%) AppleWebKit/% (KHTML, like Gecko)%', 'allow', 'WebKit-based browsers')," . " ('Opera/% (%) Presto/% Version/%', 'allow', 'Presto-based browsers')," . " ('Mozilla/% (compatible; MSIE %', 'allow', 'Trident-based browsers')," . " ('Mozilla/% (Windows%; Trident%; rv:%) like Gecko', 'allow', 'Modern Internet Explorer')," . " ('Mozilla/5.0 (compatible; Konqueror/%', 'allow', 'Konqueror browser')");
 WT_DB::prepare("INSERT IGNORE INTO `##gedcom` (gedcom_id, gedcom_name) VALUES " . " (-1, 'DEFAULT_TREE')")->execute();
 WT_DB::prepare("INSERT IGNORE INTO `##user` (user_id, user_name, real_name, email, password) VALUES " . " (-1, 'DEFAULT_USER', 'DEFAULT_USER', 'DEFAULT_USER', 'DEFAULT_USER'), (1, ?, ?, ?, ?)")->execute(array($_POST['wtuser'], $_POST['wtname'], $_POST['wtemail'], password_hash($_POST['wtpass'], PASSWORD_DEFAULT)));
 WT_DB::prepare("INSERT IGNORE INTO `##user_setting` (user_id, setting_name, setting_value) VALUES " . " (1, 'canadmin',          ?)," . " (1, 'language',          ?)," . " (1, 'verified',          ?)," . " (1, 'verified_by_admin', ?)," . " (1, 'editaccount',       ?)," . " (1, 'auto_accept',       ?)," . " (1, 'visibleonline',     ?)")->execute(array(1, WT_LOCALE, 1, 1, 1, 0, 1));
 WT_DB::prepare("INSERT IGNORE INTO `##site_setting` (setting_name, setting_value) VALUES " . "('WT_SCHEMA_VERSION',               '-2')," . "('INDEX_DIRECTORY',                 'data/')," . "('USE_REGISTRATION_MODULE',         '1')," . "('REQUIRE_ADMIN_AUTH_REGISTRATION', '1')," . "('ALLOW_USER_THEMES',               '1')," . "('ALLOW_CHANGE_GEDCOM',             '1')," . "('SESSION_TIME',                    '7200')," . "('SMTP_ACTIVE',                     'internal')," . "('SMTP_HOST',                       'localhost')," . "('SMTP_PORT',                       '25')," . "('SMTP_AUTH',                       '1')," . "('SMTP_AUTH_USER',                  '')," . "('SMTP_AUTH_PASS',                  '')," . "('SMTP_SSL',                        'none')," . "('SMTP_HELO',                       ?)," . "('SMTP_FROM_NAME',                  ?)")->execute(array($_SERVER['SERVER_NAME'], $_SERVER['SERVER_NAME']));
 // Search for all installed modules, and enable them.
 WT_Module::getInstalledModules('enabled');
 // Create the default settings for new users/family trees
 WT_DB::prepare("INSERT INTO `##block` (user_id, location, block_order, module_name) VALUES (-1, 'main', 1, 'todays_events'), (-1, 'main', 2, 'user_messages'), (-1, 'main', 3, 'user_favorites'), (-1, 'side', 1, 'user_welcome'), (-1, 'side', 2, 'random_media'), (-1, 'side', 3, 'upcoming_events'), (-1, 'side', 4, 'logged_in')")->execute();
 WT_DB::prepare("INSERT INTO `##block` (gedcom_id, location, block_order, module_name) VALUES (-1, 'main', 1, 'gedcom_stats'), (-1, 'main', 2, 'gedcom_news'), (-1, 'main', 3, 'gedcom_favorites'), (-1, 'main', 4, 'review_changes'), (-1, 'side', 1, 'gedcom_block'), (-1, 'side', 2, 'random_media'), (-1, 'side', 3, 'todays_events'), (-1, 'side', 4, 'logged_in')")->execute();
 // Create the blocks for the admin user
 WT_DB::prepare("INSERT INTO `##block` (user_id, location, block_order, module_name)" . " SELECT 1, location, block_order, module_name" . " FROM `##block`" . " WHERE user_id=-1")->execute();
 // Write the config file.  We already checked that this would work.
 $config_ini_php = '; <' . '?php exit; ?' . '> DO NOT DELETE THIS LINE' . PHP_EOL . 'dbhost="' . addcslashes($_POST['dbhost'], '"') . '"' . PHP_EOL . 'dbport="' . addcslashes($_POST['dbport'], '"') . '"' . PHP_EOL . 'dbuser="' . addcslashes($_POST['dbuser'], '"') . '"' . PHP_EOL . 'dbpass="' . addcslashes($_POST['dbpass'], '"') . '"' . PHP_EOL . 'dbname="' . addcslashes($_POST['dbname'], '"') . '"' . PHP_EOL . 'tblpfx="' . addcslashes($_POST['tblpfx'], '"') . '"' . PHP_EOL;
 file_put_contents(WT_DATA_DIR . 'config.ini.php', $config_ini_php);
 // Done - start using webtrees
开发者ID:jacoline,项目名称:webtrees,代码行数:31,代码来源:setup.php

示例15: header

// It shouldn't do anything that might take more than a few
// seconds, for systems with low timeout values.
//
// 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
if (!defined('WT_WEBTREES')) {
    header('HTTP/1.0 403 Forbidden');
    exit;
}
// Add the new constraints
try {
    WT_DB::exec("ALTER TABLE `##favorite` CHANGE note note VARCHAR(1000) NULL");
} catch (PDOException $ex) {
    // Already updated?
}
// Update the version to indicate success
WT_Site::preference($schema_name, $next_version);
开发者ID:brambravo,项目名称:webtrees,代码行数:31,代码来源:db_schema_3_4.php


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