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


PHP FlashMessages::addMessage方法代码示例

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


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

示例3: __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

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

示例5: modAction

 /** {@inheritdoc} */
 public function modAction($mod_action)
 {
     switch ($mod_action) {
         case 'admin_config':
             if (Filter::postBool('save') && Filter::checkCsrf()) {
                 $this->setSetting('FTV_PDF_ACCESS_LEVEL', Filter::postInteger('NEW_FTV_PDF_ACCESS_LEVEL'));
                 Log::addConfigurationLog($this->getTitle() . ' config updated');
             }
             $template = new AdminTemplate();
             return $template->pageContent();
         case 'full_pdf':
             echo $this->module()->printPage(0);
             break;
         case 'write_pdf':
             $tmp_dir = WT_DATA_DIR . 'ftv_pdf_tmp/';
             if (file_exists($tmp_dir)) {
                 File::delete($tmp_dir);
             }
             File::mkdir($tmp_dir);
             $template = new PdfTemplate();
             return $template->pageBody();
         case 'output_pdf':
             $file = WT_DATA_DIR . 'ftv_pdf_tmp/' . Filter::get('title') . '.pdf';
             if (file_exists($file)) {
                 ob_start();
                 header('Content-Description: File Transfer');
                 header('Content-Type: application/pdf');
                 header('Content-Disposition: attachment; filename="' . basename($file) . '"');
                 header('Content-Transfer-Encoding: binary');
                 header('Expires: 0');
                 header('Cache-Control: must-revalidate');
                 header('Pragma: public');
                 ob_clean();
                 ob_end_flush();
                 readfile($file);
                 File::delete(dirname($file));
             } else {
                 FlashMessages::addMessage(I18N::translate('The file %s could not be created.', basename($file)), 'danger');
                 Header('Location:' . WT_BASE_URL . 'module.php?mod=fancy_treeview&mod_action=page&rootid=' . Filter::get('rootid') . '&ged=' . Filter::get('ged'));
             }
             break;
         default:
             http_response_code(404);
             break;
     }
 }
开发者ID:JustCarmen,项目名称:fancy_treeview_pdf,代码行数:47,代码来源:module.php

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

示例7: updateSchema

 /**
  * Run a series of scripts to bring the database schema up to date.
  *
  * @param string $namespace      Where to find our MigrationXXX classes
  * @param string $schema_name    Where to find our MigrationXXX classes
  * @param int    $target_version updade/downgrade to this version
  *
  * @throws PDOException
  *
  * @return bool  Were any updates applied
  */
 public static function updateSchema($namespace, $schema_name, $target_version)
 {
     try {
         $current_version = (int) Site::getPreference($schema_name);
     } catch (PDOException $e) {
         // During initial installation, the site_preference table won’t exist.
         $current_version = 0;
     }
     $updates_applied = false;
     try {
         // Update the schema, one version at a time.
         while ($current_version < $target_version) {
             $class = $namespace . '\\Migration' . $current_version;
             /** @var MigrationInterface $migration */
             $migration = new $class();
             $migration->upgrade();
             Site::setPreference($schema_name, ++$current_version);
             $updates_applied = true;
         }
     } catch (PDOException $ex) {
         // The schema update scripts should never fail. If they do, there is no clean recovery.
         FlashMessages::addMessage($ex->getMessage(), 'danger');
         header('Location: ' . WT_BASE_URL . 'site-unavailable.php');
         throw $ex;
     }
     return $updates_applied;
 }
开发者ID:tronsmit,项目名称:webtrees,代码行数:38,代码来源:Database.php

示例8: 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('Message successfully sent to %s', Filter::escapeHtml($to)));
            } else {
                FlashMessages::addMessage(I18N::translate('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:josefpavlik,项目名称:webtrees,代码行数:31,代码来源:message.php

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

示例10: elseif

                } elseif ($site_access_rule_id === null) {
                    Database::prepare("INSERT INTO `##site_access_rule` (ip_address_start, ip_address_end, user_agent_pattern, rule, comment) VALUES (INET_ATON(:ip_address_start), INET_ATON(:ip_address_end), :user_agent_pattern, :rule, :comment)")->execute(array('ip_address_start' => $ip_address_start, 'ip_address_end' => $ip_address_end, 'user_agent_pattern' => $user_agent_pattern, 'rule' => $rule, 'comment' => $comment));
                    FlashMessages::addMessage(I18N::translate('The website access rule has been created.'), 'success');
                } else {
                    Database::prepare("UPDATE `##site_access_rule` SET ip_address_start = INET_ATON(:ip_address_start), ip_address_end = INET_ATON(:ip_address_end), user_agent_pattern = :user_agent_pattern, rule = :rule, comment = :comment WHERE site_access_rule_id = :site_access_rule_id")->execute(array('ip_address_start' => $ip_address_start, 'ip_address_end' => $ip_address_end, 'user_agent_pattern' => $user_agent_pattern, 'rule' => $rule, 'comment' => $comment, 'site_access_rule_id' => $site_access_rule_id));
                    FlashMessages::addMessage(I18N::translate('The website access rule has been updated.'), 'success');
                }
            }
        }
        header('Location: ' . WT_BASE_URL . WT_SCRIPT_NAME);
        return;
    case 'delete':
        if (Filter::checkCsrf()) {
            $site_access_rule_id = Filter::postInteger('site_access_rule_id');
            Database::prepare("DELETE FROM `##site_access_rule` WHERE site_access_rule_id = :site_access_rule_id")->execute(array('site_access_rule_id' => $site_access_rule_id));
            FlashMessages::addMessage(I18N::translate('The website access rule has been deleted.'), 'success');
        }
        header('Location: ' . WT_BASE_URL . WT_SCRIPT_NAME);
        return;
}
// Delete any "unknown" visitors that are now "known".
// This could happen every time we create/update a rule.
Database::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");
$controller = new PageController();
$controller->restrictAccess(Auth::isAdmin())->addExternalJavascript(WT_JQUERY_DATATABLES_JS_URL)->addExternalJavascript(WT_DATATABLES_BOOTSTRAP_JS_URL)->setPageTitle(I18N::translate('Website access rules'));
$action = Filter::get('action');
switch ($action) {
    case 'load':
        // AJAX callback for datatables
        $search = Filter::get('search');
        $search = $search['value'];
开发者ID:tunandras,项目名称:webtrees,代码行数:31,代码来源:admin_site_access.php

示例11: elseif

                     } elseif (strpos($fact->getGedcom(), ' @' . $target . '@')) {
                         // Level 2-3 links
                         $source->updateFact($fact->getFactId(), preg_replace(array('/\\n2 OBJE @' . $target . '@(\\n[3-9].*)*/', '/\\n3 OBJE @' . $target . '@(\\n[4-9].*)*/'), '', $fact->getGedcom()), true);
                     }
                 }
             }
         }
     } else {
         http_response_code(406);
     }
     break;
 case 'reject-changes':
     // Reject all the pending changes for a record
     $record = GedcomRecord::getInstance(Filter::post('xref', WT_REGEX_XREF), $WT_TREE);
     if ($record && $record->canEdit() && Auth::isModerator($record->getTree())) {
         FlashMessages::addMessage(I18N::translate('The changes to “%s” have been rejected.', $record->getFullName()));
         FunctionsImport::rejectAllChanges($record);
     } else {
         http_response_code(406);
     }
     break;
 case 'theme':
     // Change the current theme
     $theme = Filter::post('theme');
     if (Site::getPreference('ALLOW_USER_THEMES') && array_key_exists($theme, Theme::themeNames())) {
         Session::put('theme_id', $theme);
         // Remember our selection
         Auth::user()->setPreference('theme', $theme);
     } else {
         // Request for a non-existant theme.
         http_response_code(406);
开发者ID:josefpavlik,项目名称:webtrees,代码行数:31,代码来源:action.php

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

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

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

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


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