• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP Webtrees\FlashMessages类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: update

 /**
  * Manage updates sent from the AdminConfig@index form.
  */
 protected function update()
 {
     if (Auth::isAdmin()) {
         $this->module->setSetting('MAJ_SHOW_CERT', Filter::post('MAJ_SHOW_CERT'));
         $this->module->setSetting('MAJ_SHOW_NO_WATERMARK', Filter::post('MAJ_SHOW_NO_WATERMARK'));
         if ($MAJ_WM_DEFAULT = Filter::post('MAJ_WM_DEFAULT')) {
             $this->module->setSetting('MAJ_WM_DEFAULT', $MAJ_WM_DEFAULT);
         }
         if ($MAJ_WM_FONT_MAXSIZE = Filter::postInteger('MAJ_WM_FONT_MAXSIZE')) {
             $this->module->setSetting('MAJ_WM_FONT_MAXSIZE', $MAJ_WM_FONT_MAXSIZE);
         }
         // Only accept valid color for MAJ_WM_FONT_COLOR
         $MAJ_WM_FONT_COLOR = Filter::post('MAJ_WM_FONT_COLOR', '#([a-fA-F0-9]{3}){1,2}');
         if ($MAJ_WM_FONT_COLOR) {
             $this->module->setSetting('MAJ_WM_FONT_COLOR', $MAJ_WM_FONT_COLOR);
         }
         // Only accept valid folders for MAJ_CERT_ROOTDIR
         $MAJ_CERT_ROOTDIR = preg_replace('/[\\/\\\\]+/', '/', Filter::post('MAJ_CERT_ROOTDIR') . '/');
         if (substr($MAJ_CERT_ROOTDIR, 0, 1) === '/') {
             $MAJ_CERT_ROOTDIR = substr($MAJ_CERT_ROOTDIR, 1);
         }
         if ($MAJ_CERT_ROOTDIR) {
             if (is_dir(WT_DATA_DIR . $MAJ_CERT_ROOTDIR)) {
                 $this->module->setSetting('MAJ_CERT_ROOTDIR', $MAJ_CERT_ROOTDIR);
             } elseif (File::mkdir(WT_DATA_DIR . $MAJ_CERT_ROOTDIR)) {
                 $this->module->setSetting('MAJ_CERT_ROOTDIR', $MAJ_CERT_ROOTDIR);
                 FlashMessages::addMessage(I18N::translate('The folder %s has been created.', Html::filename(WT_DATA_DIR . $MAJ_CERT_ROOTDIR)), 'info');
             } else {
                 FlashMessages::addMessage(I18N::translate('The folder %s does not exist, and it could not be created.', Html::filename(WT_DATA_DIR . $MAJ_CERT_ROOTDIR)), 'danger');
             }
         }
         FlashMessages::addMessage(I18N::translate('The preferences for the module “%s” have been updated.', $this->module->getTitle()), 'success');
         return;
     }
 }
开发者ID:jon48,项目名称:webtrees-lib,代码行数:38,代码来源:AdminConfigController.php


示例2: bodyHeaderPopupWindow

 /** {@inheritdoc} */
 public function bodyHeaderPopupWindow()
 {
     if (Filter::get('action') === 'addnewnote_assisted') {
         $class = 'class="census-assistant"';
     } else {
         $class = '';
     }
     return '<body class="container container-popup">' . '<main id="content"' . $class . '">' . $this->flashMessagesContainer(FlashMessages::getMessages());
 }
开发者ID:bxbroze,项目名称:justlight,代码行数:10,代码来源:theme.php


示例3: modAction

 /**
  * This is a general purpose hook, allowing modules to respond to routes
  * of the form module.php?mod=FOO&mod_action=BAR
  *
  * @param string $mod_action
  */
 public function modAction($mod_action)
 {
     global $WT_TREE;
     switch ($mod_action) {
         case 'menu-add-favorite':
             // Process the "add to user favorites" menu item on indi/fam/etc. pages
             $record = GedcomRecord::getInstance(Filter::post('xref', WT_REGEX_XREF), $WT_TREE);
             if (Auth::check() && $record->canShowName()) {
                 self::addFavorite(array('user_id' => Auth::id(), 'gedcom_id' => $record->getTree()->getTreeId(), 'gid' => $record->getXref(), 'type' => $record::RECORD_TYPE, 'url' => null, 'note' => null, 'title' => null));
                 FlashMessages::addMessage(I18N::translate('“%s” has been added to your favorites.', $record->getFullName()));
             }
             break;
     }
 }
开发者ID:tronsmit,项目名称:webtrees,代码行数:20,代码来源:UserFavoritesModule.php


示例4: __construct

 /**
  * Startup activity
  *
  * @param GedcomRecord|null $record
  */
 public function __construct(GedcomRecord $record = null)
 {
     $this->record = $record;
     // Automatically fix broken links
     if ($this->record && $this->record->canEdit()) {
         $broken_links = 0;
         foreach ($this->record->getFacts('HUSB|WIFE|CHIL|FAMS|FAMC|REPO') as $fact) {
             if (!$fact->isPendingDeletion() && $fact->getTarget() === null) {
                 $this->record->deleteFact($fact->getFactId(), false);
                 FlashMessages::addMessage(I18N::translate('The link from “%1$s” to “%2$s” has been deleted.', $this->record->getFullName(), $fact->getValue()));
                 $broken_links = true;
             }
         }
         foreach ($this->record->getFacts('NOTE|SOUR|OBJE') as $fact) {
             // These can be links or inline. Only delete links.
             if (!$fact->isPendingDeletion() && $fact->getTarget() === null && preg_match('/^@.*@$/', $fact->getValue())) {
                 $this->record->deleteFact($fact->getFactId(), false);
                 FlashMessages::addMessage(I18N::translate('The link from “%1$s” to “%2$s” has been deleted.', $this->record->getFullName(), $fact->getValue()));
                 $broken_links = true;
             }
         }
         if ($broken_links) {
             // Reload the updated family
             $this->record = GedcomRecord::getInstance($this->record->getXref(), $this->record->getTree());
         }
     }
     parent::__construct();
     // We want robots to index this page
     $this->setMetaRobots('index,follow');
     // Set a page title
     if ($this->record) {
         if ($this->record->canShowName()) {
             // e.g. "John Doe" or "1881 Census of Wales"
             $this->setPageTitle($this->record->getFullName());
         } else {
             // e.g. "Individual" or "Source"
             $record = $this->record;
             $this->setPageTitle(GedcomTag::getLabel($record::RECORD_TYPE));
         }
     } else {
         // No such record
         $this->setPageTitle(I18N::translate('Private'));
     }
 }
开发者ID:tronsmit,项目名称:webtrees,代码行数:49,代码来源:GedcomRecordController.php


示例5: update

 /**
  * Saves Sosa's user preferences (root individual for the user).
  * 
  * @param BaseController $controller
  * @return bool True is saving successfull
  */
 protected function update(BaseController $controller)
 {
     global $WT_TREE;
     if ($this->canUpdate() && Filter::checkCsrf()) {
         $indi = Individual::getInstance(Filter::post('rootid'), $WT_TREE);
         $user = User::find(Filter::postInteger('userid', -1));
         if ($user && $indi) {
             $WT_TREE->setUserPreference($user, 'MAJ_SOSA_ROOT_ID', $indi->getXref());
             $controller->addInlineJavascript('
                 $( document ).ready(function() {
                     majComputeSosa(' . $user->getUserId() . ');
                 });');
             FlashMessages::addMessage(I18N::translate('The preferences have been updated.'));
             return true;
         }
     }
     FlashMessages::addMessage(I18N::translate('An error occurred while saving data...'), 'danger');
     return false;
 }
开发者ID:jon48,项目名称:webtrees-lib,代码行数:25,代码来源:SosaConfigController.php


示例6: elseif

 $timezone = Filter::post('timezone');
 $contact_method = Filter::post('contact_method');
 $comment = Filter::post('comment');
 $auto_accept = Filter::postBool('auto_accept');
 $canadmin = Filter::postBool('canadmin');
 $visible_online = Filter::postBool('visible_online');
 $verified = Filter::postBool('verified');
 $approved = Filter::postBool('approved');
 if ($user_id === 0) {
     // Create a new user
     if (User::findByUserName($username)) {
         FlashMessages::addMessage(I18N::translate('Duplicate username. A user with that username already exists. Please choose another username.'));
     } elseif (User::findByEmail($email)) {
         FlashMessages::addMessage(I18N::translate('Duplicate email address. A user with that email already exists.'));
     } elseif ($pass1 !== $pass2) {
         FlashMessages::addMessage(I18N::translate('The passwords do not match.'));
     } else {
         $user = User::create($username, $real_name, $email, $pass1);
         $user->setPreference('reg_timestamp', date('U'))->setPreference('sessiontime', '0');
         Log::addAuthenticationLog('User ->' . $username . '<- created');
     }
 } else {
     $user = User::find($user_id);
     if ($user && $username && $real_name) {
         $user->setEmail($email);
         $user->setUserName($username);
         $user->setRealName($real_name);
         if ($pass1 !== null && $pass1 === $pass2) {
             $user->setPassword($pass1);
         }
     }
开发者ID:tronsmit,项目名称:webtrees,代码行数:31,代码来源:admin_users.php


示例7: config

    /**
     * A form to edit the module configuration.
     */
    private function config()
    {
        $controller = new PageController();
        $controller->restrictAccess(Auth::isAdmin())->setPageTitle(I18N::translate('Google Maps™'));
        if (Filter::post('action') === 'update') {
            $this->setSetting('GM_MAP_TYPE', Filter::post('GM_MAP_TYPE'));
            $this->setSetting('GM_USE_STREETVIEW', Filter::post('GM_USE_STREETVIEW'));
            $this->setSetting('GM_MIN_ZOOM', Filter::post('GM_MIN_ZOOM'));
            $this->setSetting('GM_MAX_ZOOM', Filter::post('GM_MAX_ZOOM'));
            $this->setSetting('GM_XSIZE', Filter::post('GM_XSIZE'));
            $this->setSetting('GM_YSIZE', Filter::post('GM_YSIZE'));
            $this->setSetting('GM_PRECISION_0', Filter::post('GM_PRECISION_0'));
            $this->setSetting('GM_PRECISION_1', Filter::post('GM_PRECISION_1'));
            $this->setSetting('GM_PRECISION_2', Filter::post('GM_PRECISION_2'));
            $this->setSetting('GM_PRECISION_3', Filter::post('GM_PRECISION_3'));
            $this->setSetting('GM_PRECISION_4', Filter::post('GM_PRECISION_4'));
            $this->setSetting('GM_PRECISION_5', Filter::post('GM_PRECISION_5'));
            $this->setSetting('GM_COORD', Filter::post('GM_COORD'));
            $this->setSetting('GM_PLACE_HIERARCHY', Filter::post('GM_PLACE_HIERARCHY'));
            $this->setSetting('GM_PH_XSIZE', Filter::post('GM_PH_XSIZE'));
            $this->setSetting('GM_PH_YSIZE', Filter::post('GM_PH_YSIZE'));
            $this->setSetting('GM_PH_MARKER', Filter::post('GM_PH_MARKER'));
            $this->setSetting('GM_PREFIX_1', Filter::post('GM_PREFIX_1'));
            $this->setSetting('GM_PREFIX_2', Filter::post('GM_PREFIX_2'));
            $this->setSetting('GM_PREFIX_3', Filter::post('GM_PREFIX_3'));
            $this->setSetting('GM_PREFIX_4', Filter::post('GM_PREFIX_4'));
            $this->setSetting('GM_PREFIX_5', Filter::post('GM_PREFIX_5'));
            $this->setSetting('GM_PREFIX_6', Filter::post('GM_PREFIX_6'));
            $this->setSetting('GM_PREFIX_7', Filter::post('GM_PREFIX_7'));
            $this->setSetting('GM_PREFIX_8', Filter::post('GM_PREFIX_8'));
            $this->setSetting('GM_PREFIX_9', Filter::post('GM_PREFIX_9'));
            $this->setSetting('GM_POSTFIX_1', Filter::post('GM_POSTFIX_1'));
            $this->setSetting('GM_POSTFIX_2', Filter::post('GM_POSTFIX_2'));
            $this->setSetting('GM_POSTFIX_3', Filter::post('GM_POSTFIX_3'));
            $this->setSetting('GM_POSTFIX_4', Filter::post('GM_POSTFIX_4'));
            $this->setSetting('GM_POSTFIX_5', Filter::post('GM_POSTFIX_5'));
            $this->setSetting('GM_POSTFIX_6', Filter::post('GM_POSTFIX_6'));
            $this->setSetting('GM_POSTFIX_7', Filter::post('GM_POSTFIX_7'));
            $this->setSetting('GM_POSTFIX_8', Filter::post('GM_POSTFIX_8'));
            $this->setSetting('GM_POSTFIX_9', Filter::post('GM_POSTFIX_9'));
            FlashMessages::addMessage(I18N::translate('The preferences for the module “%s” have been updated.', $this->getName()), 'success');
            header('Location: ' . WT_BASE_URL . 'module.php?mod=googlemap&mod_action=admin_config');
            return;
        }
        $controller->pageHeader();
        ?>
		<ol class="breadcrumb small">
			<li><a href="admin.php"><?php 
        echo I18N::translate('Control panel');
        ?>
</a></li>
			<li><a href="admin_modules.php"><?php 
        echo I18N::translate('Module administration');
        ?>
</a></li>
			<li class="active"><?php 
        echo $controller->getPageTitle();
        ?>
</li>
		</ol>

		<ul class="nav nav-tabs nav-justified" role="tablist">
			<li role="presentation" class="active">
				<a href="#" role="tab">
					<?php 
        echo I18N::translate('Google Maps™ preferences');
        ?>
				</a>
			</li>
			<li role="presentation">
				<a href="?mod=googlemap&amp;mod_action=admin_places">
					<?php 
        echo I18N::translate('Geographic data');
        ?>
				</a>
			</li>
			<li role="presentation">
				<a href="?mod=googlemap&amp;mod_action=admin_placecheck">
					<?php 
        echo I18N::translate('Place check');
        ?>
				</a>
			</li>
		</ul>

		<h2><?php 
        echo I18N::translate('Google Maps™ preferences');
        ?>
</h2>

		<form class="form-horizontal" method="post" name="configform" action="module.php?mod=googlemap&mod_action=admin_config">
			<input type="hidden" name="action" value="update">
			<h3><?php 
        echo I18N::translate('Basic');
        ?>
</h3>

//.........这里部分代码省略.........
开发者ID:bxbroze,项目名称:webtrees,代码行数:101,代码来源:GoogleMapsModule.php


示例8: header

        if (Filter::checkCsrf()) {
            Site::setPreference('BING_WEBMASTER_ID', Filter::post('BING_WEBMASTER_ID'));
            Site::setPreference('GOOGLE_WEBMASTER_ID', Filter::post('GOOGLE_WEBMASTER_ID'));
            Site::setPreference('GOOGLE_ANALYTICS_ID', Filter::post('GOOGLE_ANALYTICS_ID'));
            Site::setPreference('PIWIK_URL', Filter::post('PIWIK_URL'));
            Site::setPreference('PIWIK_SITE_ID', Filter::post('PIWIK_SITE_ID'));
            Site::setPreference('STATCOUNTER_PROJECT_ID', Filter::post('STATCOUNTER_PROJECT_ID'));
            Site::setPreference('STATCOUNTER_SECURITY_ID', Filter::post('STATCOUNTER_SECURITY_ID'));
            FlashMessages::addMessage(I18N::translate('The website preferences have been updated.'), 'success');
        }
        header('Location: ' . WT_BASE_URL . 'admin.php');
        return;
    case 'languages':
        if (Filter::checkCsrf()) {
            Site::setPreference('LANGUAGES', implode(',', Filter::postArray('LANGUAGES')));
            FlashMessages::addMessage(I18N::translate('The website preferences have been updated.'), 'success');
        }
        header('Location: ' . WT_BASE_URL . 'admin.php');
        return;
}
// Lists of options for <select> controls.
$SMTP_SSL_OPTIONS = array('none' => I18N::translate('none'), 'ssl' => I18N::translate('ssl'), 'tls' => I18N::translate('tls'));
$SMTP_ACTIVE_OPTIONS = array('internal' => I18N::translate('Use PHP mail to send messages'), 'external' => I18N::translate('Use SMTP to send messages'));
$WELCOME_TEXT_AUTH_MODE_OPTIONS = array(0 => I18N::translate('No predefined text'), 1 => I18N::translate('Predefined text that states all users can request a user account'), 2 => I18N::translate('Predefined text that states admin will decide on each request for a user account'), 3 => I18N::translate('Predefined text that states only family members can request a user account'), 4 => I18N::translate('Choose user defined welcome text typed below'));
$language_tags = array();
foreach (I18N::activeLocales() as $active_locale) {
    $language_tags[] = $active_locale->languageTag();
}
switch (Filter::get('action')) {
    case 'site':
        $controller->setPageTitle(I18N::translate('Website preferences'));
开发者ID:AlexSnet,项目名称:webtrees,代码行数:31,代码来源:admin_site_config.php


示例9: function

		<div class="form-group">
			<div class="col-sm-offset-3 col-sm-9">
				<button type="submit" class="btn btn-primary">
					<?php 
        echo I18N::translate('continue');
        ?>
				</button>
			</div>
		</div>
	</form>
	<?php 
        return;
}
if (!Tree::getAll()) {
    FlashMessages::addMessage(I18N::translate('You need to create a family tree.'), 'info');
}
$controller->pageHeader();
$all_trees = Tree::getAll();
// On sites with hundreds or thousands of trees, this page becomes very large.
// Just show the current tree, the default tree, and unimported trees
if (count($all_trees) >= $multiple_tree_threshold) {
    $all_trees = array_filter($all_trees, function (Tree $x) use($WT_TREE) {
        return $x->getPreference('imported') === '0' || $WT_TREE->getTreeId() === $x->getTreeId() || $x->getName() === Site::getPreference('DEFAULT_GEDCOM');
    });
}
// List the gedcoms available to this user
?>
<ol class="breadcrumb small">
	<li><a href="admin.php"><?php 
echo I18N::translate('Control panel');
开发者ID:AlexSnet,项目名称:webtrees,代码行数:30,代码来源:admin_trees_manage.php


示例10: catch

                $WT_TREE->setPreference('MEDIA_DIRECTORY', $MEDIA_DIRECTORY);
                FlashMessages::addMessage(I18N::translate('The folder %s has been created.', Html::filename(WT_DATA_DIR . $MEDIA_DIRECTORY)), 'info');
            } else {
                FlashMessages::addMessage(I18N::translate('The folder %s does not exist, and it could not be created.', Html::filename(WT_DATA_DIR . $MEDIA_DIRECTORY)), 'danger');
            }
        }
        $gedcom = Filter::post('gedcom');
        if ($gedcom && $gedcom !== $WT_TREE->getName()) {
            try {
                Database::prepare("UPDATE `##gedcom` SET gedcom_name = ? WHERE gedcom_id = ?")->execute(array($gedcom, $WT_TREE->getTreeId()));
                Database::prepare("UPDATE `##site_setting` SET setting_value = ? WHERE setting_name='DEFAULT_GEDCOM' AND setting_value = ?")->execute(array($gedcom, $WT_TREE->getName()));
            } catch (\Exception $ex) {
                // Probably a duplicate name.
            }
        }
        FlashMessages::addMessage(I18N::translate('The preferences for the family tree “%s” have been updated.', $WT_TREE->getTitleHtml()), 'success');
        header('Location: ' . WT_BASE_URL . 'admin_trees_manage.php');
        return;
}
switch (Filter::get('action')) {
    case 'privacy':
        $controller->setPageTitle($WT_TREE->getTitleHtml() . ' — ' . I18N::translate('Privacy'))->addInlineJavascript('
			jQuery("#default-resn input[type=checkbox]").on("click", function() {
				if ($(this).prop("checked")) {
					jQuery($(this).closest("tr").addClass("text-muted"));
				} else {
					jQuery($(this).closest("tr").removeClass("text-muted"));
				}
			});
			jQuery("#add-resn").on("click", function() {
				jQuery("#default-resn tbody").prepend(jQuery("#new-resn-template").html()); autocomplete();
开发者ID:tronsmit,项目名称:webtrees,代码行数:31,代码来源:admin_trees_config.php


示例11: headerSimple

 /**
  * Create the <header> tag for a popup window.
  *
  * @return string
  */
 protected function headerSimple()
 {
     return $this->flashMessagesContainer(FlashMessages::getMessages()) . '<div id="content">';
 }
开发者ID:tronsmit,项目名称:webtrees,代码行数:9,代码来源:AbstractTheme.php


示例12: checkCsrf

 /**
  * Check that the POST request contains the CSRF token generated above.
  *
  * @return bool
  */
 public static function checkCsrf()
 {
     if (self::post('csrf') !== self::getCsrfToken()) {
         // Oops.  Something is not quite right
         Log::addAuthenticationLog('CSRF mismatch - session expired or malicious attack');
         FlashMessages::addMessage(I18N::translate('This form has expired.  Try again.'), 'error');
         return false;
     }
     return true;
 }
开发者ID:tunandras,项目名称:webtrees,代码行数:15,代码来源:Filter.php


示例13: define

// The login URL must be an absolute URL, and can be user-defined
if (Site::getPreference('LOGIN_URL')) {
    define('WT_LOGIN_URL', Site::getPreference('LOGIN_URL'));
} else {
    define('WT_LOGIN_URL', WT_BASE_URL . 'login.php');
}
// If there is no current tree and we need one, then redirect somewhere
if (WT_SCRIPT_NAME != 'admin_trees_manage.php' && WT_SCRIPT_NAME != 'admin_pgv_to_wt.php' && WT_SCRIPT_NAME != 'login.php' && WT_SCRIPT_NAME != 'logout.php' && WT_SCRIPT_NAME != 'import.php' && WT_SCRIPT_NAME != 'help_text.php' && WT_SCRIPT_NAME != 'message.php' && WT_SCRIPT_NAME != 'action.php') {
    if (!$WT_TREE || !$WT_TREE->getPreference('imported')) {
        if (Auth::isAdmin()) {
            header('Location: ' . WT_BASE_URL . 'admin_trees_manage.php');
        } else {
            // We're not an administrator, so we can only log in if there is a tree.
            if (Auth::id()) {
                Auth::logout();
                FlashMessages::addMessage(I18N::translate('This user account does not have access to any tree.'));
            }
            header('Location: ' . WT_LOGIN_URL . '?url=' . rawurlencode(WT_SCRIPT_NAME . (isset($_SERVER['QUERY_STRING']) ? '?' . $_SERVER['QUERY_STRING'] : '')), true, 301);
        }
        exit;
    }
}
// Update the last-login time no more than once a minute
if (WT_TIMESTAMP - Session::get('activity_time') >= 60) {
    Auth::user()->setPreference('sessiontime', WT_TIMESTAMP);
    Session::put('activity_time', WT_TIMESTAMP);
}
// Set the theme
if (substr(WT_SCRIPT_NAME, 0, 5) === 'admin' || WT_SCRIPT_NAME === 'module.php' && substr(Filter::get('mod_action'), 0, 5) === 'admin') {
    // Administration scripts begin with “admin” and use a special administration theme
    Theme::theme(new AdministrationTheme())->init($WT_TREE);
开发者ID:josefpavlik,项目名称:webtrees,代码行数:31,代码来源:session.php


示例14: addMessage

            if (!empty($from_name)) {
                $message['from_name'] = $from_name;
                $message['from_email'] = $from_email;
            }
            $message['subject'] = $subject;
            $message['body'] = nl2br($body, false);
            $message['created'] = WT_TIMESTAMP;
            $message['method'] = $method;
            $message['url'] = $url;
            if ($i > 0) {
                $message['no_from'] = true;
            }
            if (addMessage($message)) {
                FlashMessages::addMessage(I18N::translate('The message was successfully sent to %s.', Filter::escapeHtml($to)));
            } else {
                FlashMessages::addMessage(I18N::translate('The message was not sent.'));
                Log::addErrorLog('Unable to send a message. FROM:' . $from . ' TO:' . $to . ' (failed to send)');
            }
            $i++;
        }
        $controller->pageHeader()->addInlineJavascript('window.opener.location.reload(); window.close();');
        break;
}
/**
 * Add a message to a user's inbox
 *
 * @param string[] $message
 *
 * @return bool
 */
function addMessage($message)
开发者ID:tronsmit,项目名称:webtrees,代码行数:31,代码来源:message.php


示例15: foreach

require './includes/session.php';
$to_delete = Filter::postArray('to_delete');
if ($to_delete && Filter::checkCsrf()) {
    foreach ($to_delete as $path) {
        $is_dir = is_dir(WT_DATA_DIR . $path);
        if (File::delete(WT_DATA_DIR . $path)) {
            if ($is_dir) {
                FlashMessages::addMessage(I18N::translate('The folder %s has been deleted.', Filter::escapeHtml($path)), 'success');
            } else {
                FlashMessages::addMessage(I18N::translate('The file %s has been deleted.', Filter::escapeHtml($path)), 'success');
            }
        } else {
            if ($is_dir) {
                FlashMessages::addMessage(I18N::translate('The folder %s could not be deleted.', Filter::escapeHtml($path)), 'danger');
            } else {
                FlashMessages::addMessage(I18N::translate('The file %s could not be deleted.', Filter::escapeHtml($path)), 'danger');
            }
        }
    }
    header('Location: ' . WT_BASE_URL . WT_SCRIPT_NAME);
    return;
}
$controller = new PageController();
$controller->restrictAccess(Auth::isAdmin())->setPageTitle(I18N::translate('Clean up data folder'))->pageHeader();
$do_not_delete = array('index.php', 'config.ini.php');
// If we are storing the media in the data folder (this is the default), then don’t delete it.
foreach (Tree::getAll() as $tree) {
    $MEDIA_DIRECTORY = $tree->getPreference('MEDIA_DIRECTORY');
    if (substr($MEDIA_DIRECTORY, 0, 3) != '../') {
        // Just need to add the first part of the path
        $tmp = explode('/', $MEDIA_DIRECTORY);
开发者ID:pal-saugstad,项目名称:webtrees,代码行数:31,代码来源:admin_site_clean.php


示例16: foreach

        $gedcom .= "\n" . $fact->getGedcom();
    }
    foreach ($facts1 as $fact_id => $fact) {
        if (in_array($fact_id, $keep1)) {
            $gedcom .= "\n" . $fact->getGedcom();
        }
    }
    foreach ($facts2 as $fact_id => $fact) {
        if (in_array($fact_id, $keep2)) {
            $gedcom .= "\n" . $fact->getGedcom();
        }
    }
    $rec1->updateRecord($gedcom, true);
    $rec2->deleteRecord();
    FunctionsDb::updateFavorites($gid2, $gid1, $WT_TREE);
    FlashMessages::addMessage(I18N::translate('The records “%1$s” and “%2$s” have been merged.', '<a class="alert-link" href="' . $rec1->getHtmlUrl() . '">' . $rec1->getFullName() . '</a>', $record2_name), 'success');
    header('Location: ' . WT_BASE_URL . Filter::post('url', 'admin_trees_duplicates\\.php', WT_SCRIPT_NAME));
    return;
}
$controller->pageHeader();
?>
<ol class="breadcrumb small">
	<li><a href="admin.php"><?php 
echo I18N::translate('Control panel');
?>
</a></li>
	<li><a href="admin_trees_manage.php"><?php 
echo I18N::translate('Manage family trees');
?>
</a></li>
	<li class="active"><?php 
开发者ID:tronsmit,项目名称:webtrees,代码行数:31,代码来源:admin_site_merge.php


示例17: elseif

} elseif (Filter::server('HTTP_X_FORWARDED_FOR') !== null) {
    define('WT_CLIENT_IP', Filter::server('HTTP_X_FORWARDED_FOR'));
} else {
    define('WT_CLIENT_IP', Filter::server('REMOTE_ADDR', WT_REGEX_IPV4, '127.0.0.1'));
}
// Connect to the database
try {
    Database::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
    Database::exec("SET NAMES 'utf8' COLLATE 'utf8_unicode_ci', SQL_BIG_SELECTS=1");
    // Update the database schema
    Database::updateSchema('\\Fisharebest\\Webtrees\\Schema', 'WT_SCHEMA_VERSION', WT_SCHEMA_VERSION);
} catch (PDOException $ex) {
    FlashMessages::addMessage($ex->getMessage(), 'danger');
    header('Location: ' . WT_BASE_URL . 'site-unavailable.php');
    throw $ex;
}
// The config.ini.php file must always be in a fixed location.
// Other user files can be stored elsewhere...
define('WT_DATA_DIR', realpath(Site::getPreference('INDEX_DIRECTORY') ? Site::getPreference('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 = Site::getPreference('SERVER_URL');
if ($SERVER_URL && $SERVER_URL != WT_BASE_URL) {
    header('Location: ' . $SERVER_URL . WT_SCRIPT_NAME . (isset($_SERVER['QUERY_STRING']) ? '?' . $_SERVER['QUERY_STRING'] : ''), true, 301);
    exit;
}
// Request more resources - if we can/want to
if (!ini_get('safe_mode')) {
    $memory_limit = Site::getPreference('MEMORY_LIMIT');
开发者ID:tunandras,项目名称:webtrees,代码行数:31,代码来源:session.php


示例18: header

     break;
 case 'register':
     if (!Site::getPreference('USE_REGISTRATION_MODULE')) {
         header('Location: ' . WT_BASE_URL);
         return;
     }
     $controller->setPageTitle(I18N::translate('Request new user account'));
     // The form parameters are mandatory, and the validation errors are shown in the client.
     if (Session::get('good_to_send') && $user_name && $user_password01 && $user_password01 == $user_password02 && $user_realname && $user_email && $user_comments) {
         // These validation errors cannot be shown in the client.
         if (User::findByUserName($user_name)) {
             FlashMessages::addMessage(I18N::translate('Duplicate user name. A user with that user name already exists. Please choose another user name.'));
         } elseif (User::findByEmail($user_email)) {
             FlashMessages::addMessage(I18N::translate('Duplicate email address. A user with that email already exists.'));
         } elseif (preg_match('/(?!' . preg_quote(WT_BASE_URL, '/') . ')(((?:ftp|http|https):\\/\\/)[a-zA-Z0-9.-]+)/', $user_comments, $match)) {
             FlashMessages::addMessage(I18N::translate('You are not allowed to send messages that contain external links.') . ' ' . I18N::translate('You should delete the “%1$s” from “%2$s” and try again.', $match[2], $match[1]));
             Log::addAuthenticationLog('Possible spam registration from "' . $user_name . '"/"' . $user_email . '" comments="' . $user_comments . '"');
         } else {
             // Everything looks good - create the user
             $controller->pageHeader();
             Log::addAuthenticationLog('User registration requested for: ' . $user_name);
             $user = User::create($user_name, $user_realname, $user_email, $user_password01);
             $user->setPreference('language', WT_LOCALE)->setPreference('verified', '0')->setPreference('verified_by_admin', 0)->setPreference('reg_timestamp', date('U'))->setPreference('reg_hashcode', md5(Uuid::uuid4()))->setPreference('contactmethod', 'messaging2')->setPreference('comment', $user_comments)->setPreference('visibleonline', '1')->setPreference('auto_accept', '0')->setPreference('canadmin', '0')->setPreference('sessiontime', '0');
             // Generate an email in the admin’s language
             $webmaster = User::find($WT_TREE->getPreference('WEBMASTER_USER_ID'));
             I18N::init($webmaster->getPreference('language'));
             $mail1_body = I18N::translate('Hello administrator…') . Mail::EOL . Mail::EOL . I18N::translate('A prospective user has registered with webtrees at %s.', WT_BASE_URL . ' ' . $WT_TREE->getTitleHtml()) . Mail::EOL . Mail::EOL . I18N::translate('Username') . ' ' . Filter::escapeHtml($user->getUserName()) . Mail::EOL . I18N::translate('Real name') . ' ' . $user->getRealNameHtml() . Mail::EOL . I18N::translate('Email address') . ' ' . Filter::escapeHtml($user->getEmail()) . Mail::EOL . I18N::translate('Comments') . ' ' . Filter::escapeHtml($user_comments) . Mail::EOL . Mail::EOL . I18N::translate('The user has been sent an e-mail with the information necessary to confirm the access request.') . Mail::EOL . Mail::EOL . I18N::translate('You will be informed by e-mail when this prospective user has confirmed the request. You can then complete the process by activating the user name. The new user will not be able to login until you activate the account.');
             $mail1_subject = I18N::translate('New registration at %s', WT_BASE_URL . ' ' . $WT_TREE->getTitle());
             I18N::init(WT_LOCALE);
             echo '<div id="login-register-page">';
             // Generate an email in the user’s language
开发者ID:pal-saugstad,项目名称:webtrees,代码行数:31,代码来源:login.php


示例19: USING

    $module_name = Filter::post('module_name');
    Database::prepare("DELETE `##block_setting`" . " FROM `##block_setting`" . " JOIN `##block` USING (block_id)" . " JOIN `##module` USING (module_name)" . " WHERE module_name=?")->execute(array($module_name));
    Database::prepare("DELETE `##block`" . " FROM `##block`" . " JOIN `##module` USING (module_name)" . " WHERE module_name=?")->execute(array($module_name));
    Database::prepare("DELETE FROM `##module_setting` WHERE module_name=?")->execute(array($module_name));
    Database::prepare("DELETE FROM `##module_privacy` WHERE module_name=?")->execute(array($module_name));
    Database::prepare("DELETE FROM `##module` WHERE module_name=?")->execute(array($module_name));
    FlashMessages::addMessage(I18N::translate('The preferences for the module “%s” have been deleted.', $module_name), 'success');
    header('Location: ' . WT_BASE_URL . 'admin_modules.php');
    return;
}
// The module can’t be found on disk?
// Don't delete it automatically. It may be temporarily missing, after a re-installation, etc.
foreach ($module_status as $module_name => $status) {
    if (!array_key_exists($module_name, $modules)) {
        $html = I18N::translate('Preferences exist for the module “%s”, but this module no longer exists.', '<span dir="ltr">' . $module_name . '</span>') . '<form method="post" class="form-inline">' . Filter::getCsrf() . '<input type="hidden" name="action" value="delete">' . '<input type="hidden" name="module_name" value="' . $module_name . '">' . '<button type="submit" class="btn btn-link">' . I18N::translate('Delete the preferences for this module.') . '</button>' . '</form>';
        FlashMessages::addMessage($html, 'warning');
    }
}
$controller->pageHeader()->addExternalJavascript(WT_JQUERY_DATATABLES_JS_URL)->addExternalJavascript(WT_DATATABLES_BOOTSTRAP_JS_URL)->addInlineJavascript('
		function reindexMods(id) {
			jQuery("#" + id + " input").each(
				function (index, value) {
					value.value = index+1;
				});
		}
		jQuery("#installed_table").dataTable( {
			paging: false,
			' . I18N::datatablesI18N() . ',
			sorting: [[ 1, "asc" ]],
			columns : [
				{ sortable: false, class: "center" },
开发者ID:tronsmit,项目名称:webtrees,代码行数:31,代码来源:admin_modules.php


示例20: rename

             $messages = true;
         }
     }
     if ($oldServerThumb != $newServerThumb) {
         $move_file = true;
         if (!file_exists($newServerThumb) || md5_file($oldServerFile) == md5_file($newServerThumb)) {
             try {
                 rename($oldServerThumb, $newServerThumb);
                 FlashMessages::addMessage(I18N::translate('The thumbnail file %1$s has been renamed to %2$s.', Html::filename($oldFilename), Html::filename($newFilename)));
             } catch (\ErrorException $ex) {
                 FlashMessages::addMessage(I18N::translate('The thumbnail file %1$s could not be renamed to %2$s.', Html::filename($oldFilename), Html::filename($newFilename)));
             }
             $messages = true;
         }
         if (!file_exists($newServerThumb)) {
             FlashMessages::addMessage(I18N::translate('The thumbnail file %s does not exist.', Html::filename($newFilename)));
             $messages = true;
         }
     }
 }
 // Insert the 1 FILE xxx record into the arrays used by function FunctionsEdit::handle_updatesges()
 $glevels = array_merge(array('1'), $glevels);
 $tag = array_merge(array('FILE'), $tag);
 $islink = array_merge(array(0), $islink);
 $text = array_merge(array($newFilename), $text);
 $record = GedcomRecord::getInstance($pid, $WT_TREE);
 $newrec = "0 @{$pid}@ OBJE\n";
 $newrec = FunctionsEdit::handleUpdates($newrec);
 $record->updateRecord($newrec, $update_CHAN);
 if ($move_file) {
     // We've moved a file. Therefore we must approve the change, as rejecting
开发者ID:pal-saugstad,项目名称:webtrees,代码行数:31,代码来源:addmedia.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP Webtrees\GedcomRecord类代码示例发布时间:2022-05-23
下一篇:
PHP Webtrees\Filter类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap