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


PHP WT_Filter::post方法代码示例

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


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

示例1: modAction

 public function modAction($modAction)
 {
     global $controller;
     switch ($modAction) {
         case 'menu-add-favorite':
             // Process the "add to user favorites" menu item on indi/fam/etc. pages
             $record = WT_GedcomRecord::getInstance(WT_Filter::post('xref', WT_REGEX_XREF));
             if (WT_USER_ID && $record->canShowName()) {
                 self::addFavorite(array('user_id' => WT_USER_ID, 'gedcom_id' => $record->getGedcomId(), 'gid' => $record->getXref(), 'type' => $record::RECORD_TYPE, 'url' => null, 'note' => null, 'title' => null));
                 WT_FlashMessages::addMessage(WT_I18N::translate('“%s” has been added to your favorites.', $record->getFullName()));
             }
             break;
     }
 }
开发者ID:brambravo,项目名称:webtrees,代码行数:14,代码来源:module.php

示例2: edit

 private function edit()
 {
     require_once WT_ROOT . 'includes/functions/functions_edit.php';
     if (WT_Filter::postBool('save') && WT_Filter::checkCsrf()) {
         $block_id = WT_Filter::postInteger('block_id');
         if ($block_id) {
             WT_DB::prepare("UPDATE `##block` SET gedcom_id=NULLIF(?, '0'), block_order=? WHERE block_id=?")->execute(array(WT_Filter::postInteger('gedcom_id'), WT_Filter::postInteger('block_order'), $block_id));
         } else {
             WT_DB::prepare("INSERT INTO `##block` (gedcom_id, module_name, block_order) VALUES (NULLIF(?, '0'), ?, ?)")->execute(array(WT_Filter::postInteger('gedcom_id'), $this->getName(), WT_Filter::postInteger('block_order')));
             $block_id = WT_DB::getInstance()->lastInsertId();
         }
         set_block_setting($block_id, 'header', WT_Filter::post('header'));
         set_block_setting($block_id, 'faqbody', WT_Filter::post('faqbody'));
         $languages = array();
         foreach (WT_I18N::installed_languages() as $code => $name) {
             if (WT_Filter::postBool('lang_' . $code)) {
                 $languages[] = $code;
             }
         }
         set_block_setting($block_id, 'languages', implode(',', $languages));
         $this->config();
     } else {
         $block_id = WT_Filter::getInteger('block_id');
         $controller = new WT_Controller_Page();
         if ($block_id) {
             $controller->setPageTitle(WT_I18N::translate('Edit FAQ item'));
             $header = get_block_setting($block_id, 'header');
             $faqbody = get_block_setting($block_id, 'faqbody');
             $block_order = WT_DB::prepare("SELECT block_order FROM `##block` WHERE block_id=?")->execute(array($block_id))->fetchOne();
             $gedcom_id = WT_DB::prepare("SELECT gedcom_id FROM `##block` WHERE block_id=?")->execute(array($block_id))->fetchOne();
         } else {
             $controller->setPageTitle(WT_I18N::translate('Add an FAQ item'));
             $header = '';
             $faqbody = '';
             $block_order = WT_DB::prepare("SELECT IFNULL(MAX(block_order)+1, 0) FROM `##block` WHERE module_name=?")->execute(array($this->getName()))->fetchOne();
             $gedcom_id = WT_GED_ID;
         }
         $controller->pageHeader();
         if (array_key_exists('ckeditor', WT_Module::getActiveModules())) {
             ckeditor_WT_Module::enableEditor($controller);
         }
         // "Help for this page" link
         echo '<div id="page_help">', help_link('add_faq_item', $this->getName()), '</div>';
         echo '<form name="faq" method="post" action="module.php?mod=', $this->getName(), '&amp;mod_action=admin_edit">';
         echo WT_Filter::getCsrf();
         echo '<input type="hidden" name="save" value="1">';
         echo '<input type="hidden" name="block_id" value="', $block_id, '">';
         echo '<table id="faq_module">';
         echo '<tr><th>';
         echo WT_I18N::translate('Question');
         echo '</th></tr><tr><td><input type="text" name="header" size="90" tabindex="1" value="' . WT_Filter::escapeHtml($header) . '"></td></tr>';
         echo '<tr><th>';
         echo WT_I18N::translate('Answer');
         echo '</th></tr><tr><td>';
         echo '<textarea name="faqbody" class="html-edit" rows="10" cols="90" tabindex="2">', WT_Filter::escapeHtml($faqbody), '</textarea>';
         echo '</td></tr>';
         echo '</table><table id="faq_module2">';
         echo '<tr>';
         echo '<th>', WT_I18N::translate('Show this block for which languages?'), '</th>';
         echo '<th>', WT_I18N::translate('FAQ position'), help_link('add_faq_order', $this->getName()), '</th>';
         echo '<th>', WT_I18N::translate('FAQ visibility'), help_link('add_faq_visibility', $this->getName()), '</th>';
         echo '</tr><tr>';
         echo '<td>';
         $languages = get_block_setting($block_id, 'languages');
         echo edit_language_checkboxes('lang_', $languages);
         echo '</td><td>';
         echo '<input type="text" name="block_order" size="3" tabindex="3" value="', $block_order, '"></td>';
         echo '</td><td>';
         echo select_edit_control('gedcom_id', WT_Tree::getIdList(), WT_I18N::translate('All'), $gedcom_id, 'tabindex="4"');
         echo '</td></tr>';
         echo '</table>';
         echo '<p><input type="submit" value="', WT_I18N::translate('save'), '" tabindex="5">';
         echo '</form>';
         exit;
     }
 }
开发者ID:jacoline,项目名称:webtrees,代码行数:76,代码来源:module.php

示例3: define

// 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', 'index_edit.php');
require './includes/session.php';
$controller = new WT_Controller_Ajax();
// Only one of $user_id and $gedcom_id should be set
$user_id = WT_Filter::get('user_id', WT_REGEX_INTEGER, WT_Filter::post('user_id', WT_REGEX_INTEGER));
if ($user_id) {
    $gedcom_id = null;
} else {
    $gedcom_id = WT_Filter::get('gedcom_id', WT_REGEX_INTEGER, WT_Filter::post('gedcom_id', WT_REGEX_INTEGER));
}
// Only an admin can edit the "default" page
// Only managers can edit the "home page"
// Only a user or an admin can edit a user’s "my page"
if ($gedcom_id < 0 && !Auth::isAdmin() || $gedcom_id > 0 && !Auth::isManager(WT_Tree::get($gedcom_id)) || $user_id && Auth::id() != $user_id && !Auth::isAdmin()) {
    $controller->pageHeader();
    $controller->addInlineJavascript('window.location.reload();');
    exit;
}
$action = WT_Filter::get('action');
if (isset($_REQUEST['main'])) {
    $main = $_REQUEST['main'];
} else {
    $main = array();
}
开发者ID:brambravo,项目名称:webtrees,代码行数:31,代码来源:index_edit.php

示例4: configureBlock

    public function configureBlock($block_id)
    {
        global $ctype, $controller;
        $PEDIGREE_ROOT_ID = get_gedcom_setting(WT_GED_ID, 'PEDIGREE_ROOT_ID');
        if (WT_Filter::postBool('save') && WT_Filter::checkCsrf()) {
            set_block_setting($block_id, 'details', WT_Filter::postBool('details'));
            set_block_setting($block_id, 'type', WT_Filter::post('type', 'pedigree|descendants|hourglass|treenav', 'pedigree'));
            set_block_setting($block_id, 'pid', WT_Filter::post('pid', WT_REGEX_XREF));
            exit;
        }
        $details = get_block_setting($block_id, 'details', false);
        $type = get_block_setting($block_id, 'type', 'pedigree');
        $pid = get_block_setting($block_id, 'pid', WT_USER_ID ? WT_USER_GEDCOM_ID ? WT_USER_GEDCOM_ID : $PEDIGREE_ROOT_ID : $PEDIGREE_ROOT_ID);
        $controller->addExternalJavascript(WT_STATIC_URL . 'js/autocomplete.js')->addInlineJavascript('autocomplete();');
        ?>
		<tr><td class="descriptionbox wrap width33"><?php 
        echo WT_I18N::translate('Chart type');
        ?>
</td>
		<td class="optionbox">
			<select name="type">
				<option value="pedigree"<?php 
        if ($type == "pedigree") {
            echo " selected=\"selected\"";
        }
        ?>
><?php 
        echo WT_I18N::translate('Pedigree');
        ?>
</option>
				<option value="descendants"<?php 
        if ($type == "descendants") {
            echo " selected=\"selected\"";
        }
        ?>
><?php 
        echo WT_I18N::translate('Descendants');
        ?>
</option>
				<option value="hourglass"<?php 
        if ($type == "hourglass") {
            echo " selected=\"selected\"";
        }
        ?>
><?php 
        echo WT_I18N::translate('Hourglass chart');
        ?>
</option>
				<option value="treenav"<?php 
        if ($type == "treenav") {
            echo " selected=\"selected\"";
        }
        ?>
><?php 
        echo WT_I18N::translate('Interactive tree');
        ?>
</option>
			</select>
		</td></tr>
		<tr>
			<td class="descriptionbox wrap width33"><?php 
        echo WT_I18N::translate('Show details');
        ?>
</td>
		<td class="optionbox">
			<select name="details">
					<option value="no" <?php 
        if (!$details) {
            echo " selected=\"selected\"";
        }
        ?>
><?php 
        echo WT_I18N::translate('no');
        ?>
</option>
					<option value="yes" <?php 
        if ($details) {
            echo " selected=\"selected\"";
        }
        ?>
><?php 
        echo WT_I18N::translate('yes');
        ?>
</option>
			</select>
			</td>
		</tr>
		<tr>
			<td class="descriptionbox wrap width33"><?php 
        echo WT_I18N::translate('Individual');
        ?>
</td>
			<td class="optionbox">
				<input data-autocomplete-type="INDI" type="text" name="pid" id="pid" value="<?php 
        echo $pid;
        ?>
" size="5">
				<?php 
        echo print_findindi_link('pid');
        $root = WT_Individual::getInstance($pid);
//.........这里部分代码省略.........
开发者ID:jacoline,项目名称:webtrees,代码行数:101,代码来源:module.php

示例5: configureBlock

 public function configureBlock($block_id)
 {
     if (WT_Filter::postBool('save') && WT_Filter::checkCsrf()) {
         set_block_setting($block_id, 'days', WT_Filter::postInteger('days', 1, self::MAX_DAYS, self::DEFAULT_DAYS));
         set_block_setting($block_id, 'infoStyle', WT_Filter::post('infoStyle', 'list|table', 'table'));
         set_block_setting($block_id, 'sortStyle', WT_Filter::post('sortStyle', 'name|date_asc|date_desc', 'date_desc'));
         set_block_setting($block_id, 'hide_empty', WT_Filter::postBool('hide_empty'));
         set_block_setting($block_id, 'block', WT_Filter::postBool('block'));
         exit;
     }
     require_once WT_ROOT . 'includes/functions/functions_edit.php';
     $days = get_block_setting($block_id, 'days', self::DEFAULT_DAYS);
     echo '<tr><td class="descriptionbox wrap width33">';
     echo WT_I18N::translate('Number of days to show');
     echo '</td><td class="optionbox">';
     echo '<input type="text" name="days" size="2" value="', $days, '">';
     echo ' <em>', WT_I18N::plural('maximum %d day', 'maximum %d days', self::MAX_DAYS, self::MAX_DAYS), '</em>';
     echo '</td></tr>';
     $infoStyle = get_block_setting($block_id, 'infoStyle', 'table');
     echo '<tr><td class="descriptionbox wrap width33">';
     echo WT_I18N::translate('Presentation style');
     echo '</td><td class="optionbox">';
     echo select_edit_control('infoStyle', array('list' => WT_I18N::translate('list'), 'table' => WT_I18N::translate('table')), null, $infoStyle, '');
     echo '</td></tr>';
     $sortStyle = get_block_setting($block_id, 'sortStyle', 'date');
     echo '<tr><td class="descriptionbox wrap width33">';
     echo WT_I18N::translate('Sort order');
     echo '</td><td class="optionbox">';
     echo select_edit_control('sortStyle', array('name' => WT_I18N::translate('sort by name'), 'date_asc' => WT_I18N::translate('sort by date, oldest first'), 'date_desc' => WT_I18N::translate('sort by date, newest first')), null, $sortStyle, '');
     echo '</td></tr>';
     $block = get_block_setting($block_id, 'block', true);
     echo '<tr><td class="descriptionbox wrap width33">';
     echo WT_I18N::translate('Add a scrollbar when block contents grow');
     echo '</td><td class="optionbox">';
     echo edit_field_yes_no('block', $block);
     echo '</td></tr>';
     $hide_empty = get_block_setting($block_id, 'hide_empty', true);
     echo '<tr><td class="descriptionbox wrap width33">';
     echo WT_I18N::translate('Should this block be hidden when it is empty?');
     echo '</td><td class="optionbox">';
     echo edit_field_yes_no('hide_empty', $hide_empty);
     echo '</td></tr>';
     echo '<tr><td colspan="2" class="optionbox wrap">';
     echo '<span class="error">', WT_I18N::translate('If you hide an empty block, you will not be able to change its configuration until it becomes visible by no longer being empty.'), '</span>';
     echo '</td></tr>';
 }
开发者ID:brambravo,项目名称:webtrees,代码行数:46,代码来源:module.php

示例6: strlen

		<input type="hidden" name="action" value="requestpw">
		<h4>', WT_I18N::translate('Lost password request'), '</h4>
		<div>
			<label for="new_passwd_username">', WT_I18N::translate('Username or email address'), '<input type="text" id="new_passwd_username" name="new_passwd_username" value="">
			</label>
		</div>
		<div><input type="submit" value="', WT_I18N::translate('continue'), '"></div>
		</form>
	</div>';
        echo '</div>';
        echo '</div>';
        break;
    case 'requestpw':
        $controller->setPageTitle(WT_I18N::translate('Lost password request'))->pageHeader();
        echo '<div id="login-page">';
        $user_name = WT_Filter::post('new_passwd_username', WT_REGEX_USERNAME);
        $user = User::findByIdentifier($user_name);
        if ($user) {
            $passchars = 'abcdefghijklmnopqrstuvqxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789';
            $user_new_pw = '';
            $max = strlen($passchars) - 1;
            for ($i = 0; $i < 8; $i++) {
                $index = rand(0, $max);
                $user_new_pw .= $passchars[$index];
            }
            $user->setPassword($user_new_pw);
            Log::addAuthenticationLog('Password request was sent to user: ' . $user->getUserName());
            WT_Mail::system_message($WT_TREE, $user, WT_I18N::translate('Lost password request'), WT_I18N::translate('Hello %s…', $user->getRealName()) . WT_Mail::EOL . WT_Mail::EOL . WT_I18N::translate('A new password was requested for your user name.') . WT_Mail::EOL . WT_Mail::EOL . WT_I18N::translate('Username') . ": " . $user->getUserName() . WT_Mail::EOL . WT_I18N::translate('Password') . ": " . $user_new_pw . WT_Mail::EOL . WT_Mail::EOL . WT_I18N::translate('After you have logged in, select the “My account” link under the “My page” menu and fill in the password fields to change your password.') . WT_Mail::EOL . WT_Mail::EOL . '<a href="' . WT_SERVER_NAME . WT_SCRIPT_PATH . 'login.php?ged=' . WT_GEDURL . '">' . WT_SERVER_NAME . WT_SCRIPT_PATH . 'login.php?ged=' . WT_GEDURL . '</a>');
        }
        // Show a success message, even if the user account does not exist.
        // Otherwise this page can be used to guess/test usernames.
开发者ID:sadr110,项目名称:webtrees,代码行数:31,代码来源:login.php

示例7: foreach

			jQuery("#"+jQuery(this).attr("id")+" input").each(
				function (index, value) {
					value.value = index+1;
				}
			);
		});
	');
$modules = WT_Module::getActiveMenus(WT_GED_ID, WT_PRIV_HIDE);
$action = WT_Filter::post('action');
if ($action == 'update_mods' && WT_Filter::checkCsrf()) {
    foreach ($modules as $module_name => $module) {
        foreach (WT_Tree::getAll() as $tree) {
            $access_level = WT_Filter::post("menuaccess-{$module_name}-{$tree->tree_id}", WT_REGEX_INTEGER, $module->defaultAccessLevel());
            WT_DB::prepare("REPLACE INTO `##module_privacy` (module_name, gedcom_id, component, access_level) VALUES (?, ?, 'menu', ?)")->execute(array($module_name, $tree->tree_id, $access_level));
        }
        $order = WT_Filter::post('menuorder-' . $module_name);
        WT_DB::prepare("UPDATE `##module` SET menu_order=? WHERE module_name=?")->execute(array($order, $module_name));
        $module->order = $order;
        // Make the new order take effect immediately
    }
    uasort($modules, function ($x, $y) {
        return $x->order - $y->order;
    });
}
?>
<div id="menus" align="center">
	<form method="post" action="<?php 
echo WT_SCRIPT_NAME;
?>
">
		<input type="hidden" name="action" value="update_mods">
开发者ID:brambravo,项目名称:webtrees,代码行数:31,代码来源:admin_module_menus.php

示例8: define

//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
use WT\Auth;
define('WT_SCRIPT_NAME', 'admin_site_merge.php');
require './includes/session.php';
$controller = new WT_Controller_Page();
$controller->restrictAccess(Auth::isManager())->setPageTitle(WT_I18N::translate('Merge records'))->addExternalJavascript(WT_STATIC_URL . 'js/autocomplete.js')->addInlineJavascript('autocomplete();')->pageHeader();
require_once WT_ROOT . 'includes/functions/functions_edit.php';
$ged = $GEDCOM;
$gid1 = WT_Filter::post('gid1', WT_REGEX_XREF);
$gid2 = WT_Filter::post('gid2', WT_REGEX_XREF);
$action = WT_Filter::post('action', 'choose|select|merge', 'choose');
$ged1 = WT_Filter::post('ged1', null, $ged);
$ged2 = WT_Filter::post('ged2', null, $ged);
$keep1 = WT_Filter::postArray('keep1');
$keep2 = WT_Filter::postArray('keep2');
if ($action != 'choose') {
    if ($gid1 == $gid2 && $ged1 == $ged2) {
        $action = 'choose';
        echo '<span class="error">', WT_I18N::translate('You entered the same IDs.  You cannot merge the same records.'), '</span>';
    } else {
        $rec1 = WT_GedcomRecord::getInstance($gid1, WT_Tree::getIdFromName($ged1));
        $rec2 = WT_GedcomRecord::getInstance($gid2, WT_Tree::getIdFromName($ged2));
        if (!$rec1) {
            echo '<span class="error">', WT_I18N::translate('Unable to find record with ID'), ':</span> ', $gid1, ', ', $ged;
            $action = 'choose';
        } elseif (!$rec2) {
            echo '<span class="error">', WT_I18N::translate('Unable to find record with ID'), ':</span> ', $gid2, ', ', $ged2;
            $action = 'choose';
开发者ID:jacoline,项目名称:webtrees,代码行数:31,代码来源:admin_site_merge.php

示例9: Zend_Controller_Request_Http

    exit;
}
if (version_compare(PHP_VERSION, WT_REQUIRED_PHP_VERSION) < 0) {
    // We cannot translate these messages without a modern PHP
    echo '<h1>Sorry, the setup wizard cannot start.</h1>', '<p>This server is running PHP version ', PHP_VERSION, '</p>', '<p>PHP ', WT_REQUIRED_PHP_VERSION, ' (or any later version) is required</p>';
    exit;
}
require 'includes/functions/functions.php';
require 'includes/functions/functions_edit.php';
$WT_REQUEST = new Zend_Controller_Request_Http();
$WT_SESSION = new stdClass();
$WT_SESSION->locale = null;
// Needed for WT_I18N
$WT_SESSION->wt_user = null;
// Needed for WT_Auth
define('WT_LOCALE', WT_I18N::init(WT_Filter::post('lang', '[@a-zA-Z_]+')));
header('Content-Type: text/html; charset=UTF-8');
?>
<!DOCTYPE html>
<html <?php 
echo WT_I18N::html_markup();
?>
>
<head>
	<meta charset="UTF-8">
	<title>
		webtrees setup wizard
	</title>
	<style type="text/css">
		body {color: black; background-color: white; font: 14px tahoma, arial, helvetica, sans-serif; padding:10px; }
		a {color: black; font-weight: normal; text-decoration: none;}
开发者ID:jacoline,项目名称:webtrees,代码行数:31,代码来源:setup.php

示例10: array

// Valid values for form variables
$ALL_THEMES_DIRS = array();
foreach (get_theme_names() as $themename => $themedir) {
    $ALL_THEME_DIRS[] = $themedir;
}
// Extract form variables
$form_action = WT_Filter::post('form_action');
$form_username = WT_Filter::post('form_username');
$form_realname = WT_Filter::post('form_realname');
$form_pass1 = WT_Filter::post('form_pass1', WT_REGEX_PASSWORD);
$form_pass2 = WT_Filter::post('form_pass2', WT_REGEX_PASSWORD);
$form_email = WT_Filter::postEmail('form_email');
$form_rootid = WT_Filter::post('form_rootid', WT_REGEX_XREF);
$form_theme = WT_Filter::post('form_theme', implode('|', $ALL_THEME_DIRS));
$form_language = WT_Filter::post('form_language', implode('|', array_keys(WT_I18N::installed_languages())), WT_LOCALE);
$form_contact_method = WT_Filter::post('form_contact_method');
$form_visible_online = WT_Filter::postBool('form_visible_online');
// Respond to form action
if ($form_action == 'update' && WT_Filter::checkCsrf()) {
    if ($form_username != Auth::user()->getUserName() && User::findByIdentifier($form_username)) {
        WT_FlashMessages::addMessage(WT_I18N::translate('Duplicate user name.  A user with that user name already exists.  Please choose another user name.'));
    } elseif ($form_email != Auth::user()->getEmail() && User::findByIdentifier($form_email)) {
        WT_FlashMessages::addMessage(WT_I18N::translate('Duplicate email address.  A user with that email already exists.'));
    } else {
        // Change username
        if ($form_username != WT_USER_NAME) {
            Log::addAuthenticationLog('User ' . Auth::user()->getUserName() . ' renamed to ' . $form_username);
            Auth::user()->setUserName($form_username);
        }
        // Change password
        if ($form_pass1 && $form_pass1 == $form_pass2) {
开发者ID:brambravo,项目名称:webtrees,代码行数:31,代码来源:edituser.php

示例11: connect

 private function connect()
 {
     global $WT_SESSION;
     $url = WT_Filter::post('url', NULL, WT_Filter::get('url', NULL, ''));
     // If we’ve clicked login from the login page, we don’t want to go back there.
     if (strpos($url, 'login.php') === 0 || strpos($url, 'mod=facebook') !== false && strpos($url, 'mod_action=connect') !== false) {
         $url = '';
     }
     // Redirect to the homepage/$url if the user is already logged-in.
     if ($WT_SESSION->wt_user) {
         header('Location: ' . WT_SCRIPT_PATH . $url);
         exit;
     }
     $app_id = $this->getSetting('app_id');
     $app_secret = $this->getSetting('app_secret');
     $connect_url = $this->getConnectURL($url);
     if (!$app_id || !$app_secret) {
         $this->error_page(WT_I18N::translate('Facebook logins have not been setup by the administrator.'));
         return;
     }
     $code = @$_REQUEST["code"];
     if (!empty($_REQUEST['error'])) {
         Log::addErrorLog('Facebook Error: ' . WT_Filter::get('error') . '. Reason: ' . WT_Filter::get('error_reason'));
         if ($_REQUEST['error_reason'] == 'user_denied') {
             $this->error_page(WT_I18N::translate('You must allow access to your Facebook account in order to login with Facebook.'));
         } else {
             $this->error_page(WT_I18N::translate('An error occurred trying to log you in with Facebook.'));
         }
     } else {
         if (empty($code) && empty($WT_SESSION->facebook_access_token)) {
             if (!WT_Filter::checkCsrf()) {
                 echo WT_I18N::translate('This form has expired.  Try again.');
                 return;
             }
             $WT_SESSION->timediff = WT_Filter::postInteger('timediff', -43200, 50400, 0);
             // Same range as date('Z')
             // FB Login flow has not begun so redirect to login dialog.
             $WT_SESSION->facebook_state = md5(uniqid(rand(), TRUE));
             // CSRF protection
             $dialog_url = "https://www.facebook.com/dialog/oauth?client_id=" . $app_id . "&redirect_uri=" . urlencode($connect_url) . "&state=" . $WT_SESSION->facebook_state . "&scope=" . self::scope;
             Zend_Session::writeClose();
             echo "<script> window.location.href='" . $dialog_url . "'</script>";
         } else {
             if (!empty($WT_SESSION->facebook_access_token)) {
                 // User has already authorized the app and we have a token so get their info.
                 $graph_url = "https://graph.facebook.com/" . self::api_dir . "me?access_token=" . $WT_SESSION->facebook_access_token;
                 $response = $this->fetch_url($graph_url);
                 if ($response === FALSE) {
                     Log::addErrorLog("Facebook: Access token is no longer valid");
                     // Clear the state and try again with a new token.
                     try {
                         unset($WT_SESSION->facebook_access_token);
                         unset($WT_SESSION->facebook_state);
                         Zend_Session::writeClose();
                     } catch (Exception $e) {
                     }
                     header("Location: " . $this->getConnectURL($url));
                     exit;
                 }
                 $user = json_decode($response);
                 $this->login_or_register($user, $url);
             } else {
                 if (!empty($WT_SESSION->facebook_state) && $WT_SESSION->facebook_state === $_REQUEST['state']) {
                     // User has already been redirected to login dialog.
                     // Exchange the code for an access token.
                     $token_url = "https://graph.facebook.com/" . self::api_dir . "oauth/access_token?" . "client_id=" . $app_id . "&redirect_uri=" . urlencode($connect_url) . "&client_secret=" . $app_secret . "&code=" . $code;
                     $response = $this->fetch_url($token_url);
                     if ($response === FALSE) {
                         Log::addErrorLog("Facebook: Couldn't exchange the code for an access token");
                         $this->error_page(WT_I18N::translate("Your Facebook code is invalid. This can happen if you hit back in your browser after login or if Facebook logins have been setup incorrectly by the administrator."));
                     }
                     $params = null;
                     parse_str($response, $params);
                     if (empty($params['access_token'])) {
                         Log::addErrorLog("Facebook: The access token was empty");
                         $this->error_page(WT_I18N::translate("Your Facebook code is invalid. This can happen if you hit back in your browser after login or if Facebook logins have been setup incorrectly by the administrator."));
                     }
                     $WT_SESSION->facebook_access_token = $params['access_token'];
                     $graph_url = "https://graph.facebook.com/" . self::api_dir . "me?access_token=" . $WT_SESSION->facebook_access_token;
                     $meResponse = $this->fetch_url($graph_url);
                     if ($meResponse === FALSE) {
                         $this->error_page(WT_I18N::translate("Could not fetch your information from Facebook. Please try again."));
                     }
                     $user = json_decode($meResponse);
                     $this->login_or_register($user, $url);
                 } else {
                     $this->error_page(WT_I18N::translate("The state does not match. You may been tricked to load this page."));
                 }
             }
         }
     }
 }
开发者ID:elRadix,项目名称:webtrees-facebook,代码行数:92,代码来源:module.php

示例12: header

			<input type="submit" class="save" onclick="document.reorder_form.action.value='reorder_fams'; document.reorder_form.submit();" value="<?php 
        echo WT_I18N::translate('sort by date of marriage');
        ?>
">
			<input type="button" class="cancel" value="<?php 
        echo WT_I18N::translate('close');
        ?>
" onclick="window.close();">
		</p>
	</form>
	</div>
	<?php 
        break;
    case 'reorder_fams_update':
        $xref = WT_Filter::post('xref', WT_REGEX_XREF);
        $order = WT_Filter::post('order');
        $keep_chan = WT_Filter::postBool('keep_chan');
        if (!WT_Filter::checkCsrf()) {
            Zend_Session::writeClose();
            header('Location: ' . WT_SERVER_NAME . WT_SCRIPT_PATH . WT_SCRIPT_NAME . '?action=reorder_fams&xref=' . $xref);
            exit;
        }
        $person = WT_Individual::getInstance($xref);
        check_record_access($person);
        $controller->setPageTitle(WT_I18N::translate('Re-order families'))->pageHeader();
        if (is_array($order)) {
            $gedcom = array('0 @' . $person->getXref() . '@ INDI');
            $facts = $person->getFacts();
            // Move families to the end of the record
            foreach ($order as $family => $num) {
                foreach ($facts as $n => $fact) {
开发者ID:brambravo,项目名称:webtrees,代码行数:31,代码来源:edit_interface.php

示例13: define

// 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);
        } else {
            $INDEX_DIRECTORY = realpath($PGV_PATH . '/' . $INDEX_DIRECTORY);
        }
开发者ID:brambravo,项目名称:webtrees,代码行数:31,代码来源:admin_pgv_to_wt.php

示例14: myplot

        }
        $myfunc();
        if ($indfam == 'IND') {
            $hstr = $title . '|' . WT_I18N::translate('Counts ') . ' ' . WT_I18N::number($n1) . ' ' . WT_I18N::translate('of') . ' ' . $stats->totalIndividuals();
        } else {
            if ($x_as == 21) {
                $hstr = $title . '|' . WT_I18N::translate('Counts ') . ' ' . WT_I18N::number($n1) . ' ' . WT_I18N::translate('of') . ' ' . $stats->totalChildren();
            } else {
                $hstr = $title . '|' . WT_I18N::translate('Counts ') . ' ' . WT_I18N::number($n1) . ' ' . WT_I18N::translate('of') . ' ' . $stats->totalFamilies();
            }
        }
        myplot($hstr, $zmax, $xdata, $xtitle, $ydata, $ytitle, $legend);
    }
}
//-- ========= start of main program =========
$action = WT_Filter::post('action');
if ($action == 'update') {
    $x_as = $_POST['x-as'];
    $y_as = $_POST['y-as'];
    if (isset($_POST['z-as'])) {
        $z_as = $_POST['z-as'];
    } else {
        $z_as = 300;
    }
    $xgl = $_POST['xas-grenzen-leeftijden'];
    $xglm = $_POST['xas-grenzen-leeftijden_m'];
    $xgm = $_POST['xas-grenzen-maanden'];
    $xga = $_POST['xas-grenzen-aantallen'];
    if (isset($_POST['zas-grenzen-periode'])) {
        $zgp = $_POST['zas-grenzen-periode'];
    } else {
开发者ID:brambravo,项目名称:webtrees,代码行数:31,代码来源:statisticsplot.php

示例15: foreach

        $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']);
                }
            }
        }
        header('Location: ' . WT_SERVER_NAME . WT_SCRIPT_PATH . WT_SCRIPT_NAME . '?keep_media' . $gedcom_id . '=' . WT_Filter::postBool('keep_media' . $gedcom_id));
        exit;
    case 'replace_import':
        $gedcom_id = WT_Filter::postInteger('gedcom_id');
        // Make sure the gedcom still exists
        if (WT_Filter::checkCsrf() && get_gedcom_from_id($gedcom_id)) {
            $ged_name = basename(WT_Filter::post('ged_name'));
            import_gedcom_file($gedcom_id, WT_DATA_DIR . $ged_name, $ged_name);
        }
        header('Location: ' . WT_SERVER_NAME . WT_SCRIPT_PATH . WT_SCRIPT_NAME . '?keep_media' . $gedcom_id . '=' . WT_Filter::postBool('keep_media' . $gedcom_id));
        exit;
}
$controller->pageHeader();
// Process GET actions
switch (WT_Filter::get('action')) {
    case 'uploadform':
    case 'importform':
        $gedcom_id = WT_Filter::getInteger('gedcom_id');
        $gedcom_name = get_gedcom_from_id($gedcom_id);
        // Check it exists
        if (!$gedcom_name) {
            break;
开发者ID:brambravo,项目名称:webtrees,代码行数:31,代码来源:admin_trees_manage.php


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