本文整理汇总了PHP中CSRFProtection类的典型用法代码示例。如果您正苦于以下问题:PHP CSRFProtection类的具体用法?PHP CSRFProtection怎么用?PHP CSRFProtection使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CSRFProtection类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: before_filter
public function before_filter(&$action, &$args)
{
parent::before_filter($action, $args);
// Lock context to user id
$this->owner = $GLOBALS['user'];
$this->context_id = $this->owner->id;
$this->full_access = true;
if (Config::get()->PERSONALDOCUMENT_OPEN_ACCESS) {
$username = Request::username('username', $GLOBALS['user']->username);
$user = User::findByUsername($username);
if ($user && $user->id !== $GLOBALS['user']->id) {
$this->owner = $user;
$this->context_id = $user->id;
$this->full_access = Config::get()->PERSONALDOCUMENT_OPEN_ACCESS_ROOT_PRIVILEDGED && $GLOBALS['user']->perms === 'root';
URLHelper::bindLinkParam('username', $username);
}
}
$this->limit = $GLOBALS['user']->cfg->PERSONAL_FILES_ENTRIES_PER_PAGE ?: Config::get()->ENTRIES_PER_PAGE;
$this->userConfig = DocUsergroupConfig::getUserConfig($GLOBALS['user']->id);
if ($this->userConfig['area_close'] == 1) {
$this->redirect('document/closed/index');
}
if (Request::isPost()) {
CSRFProtection::verifySecurityToken();
}
if (($ticket = Request::get('studip-ticket')) && !check_ticket($ticket)) {
$message = _('Bei der Verarbeitung Ihrer Anfrage ist ein Fehler aufgetreten.') . "\n" . _('Bitte versuchen Sie es erneut.');
PageLayout::postMessage(MessageBox::error($message));
$this->redirect('document/files/index');
}
}
示例2: getAdminModuleLinks
/**
* get admin module links
*
* returns links add or remove a module from course
* @access public
* @return string returns html-code
*/
function getAdminModuleLinks()
{
global $connected_cms, $view, $search_key, $cms_select, $current_module;
$output .= "<form method=\"POST\" action=\"" . URLHelper::getLink() . "\">\n";
$output .= CSRFProtection::tokenTag();
$output .= "<input type=\"HIDDEN\" name=\"view\" value=\"" . htmlReady($view) . "\">\n";
$output .= "<input type=\"HIDDEN\" name=\"search_key\" value=\"" . htmlReady($search_key) . "\">\n";
$output .= "<input type=\"HIDDEN\" name=\"cms_select\" value=\"" . htmlReady($cms_select) . "\">\n";
$output .= "<input type=\"HIDDEN\" name=\"module_type\" value=\"" . htmlReady($connected_cms[$this->cms_type]->content_module[$current_module]->getModuleType()) . "\">\n";
$output .= "<input type=\"HIDDEN\" name=\"module_id\" value=\"" . htmlReady($connected_cms[$this->cms_type]->content_module[$current_module]->getId()) . "\">\n";
$output .= "<input type=\"HIDDEN\" name=\"module_system_type\" value=\"" . htmlReady($this->cms_type) . "\">\n";
if ($connected_cms[$this->cms_type]->content_module[$current_module]->isConnected()) {
$output .= " " . Button::create(_('Entfernen'), 'remove');
} elseif ($connected_cms[$this->cms_type]->content_module[$current_module]->isAllowed(OPERATION_WRITE)) {
$output .= "<div align=\"left\"><input type=\"CHECKBOX\" value=\"1\" name=\"write_permission\" style=\"vertical-align:middle\">";
$output .= _("Mit Schreibrechten für alle Dozenten/Tutoren dieser Veranstaltung") . "<br>";
$output .= "<input type=\"CHECKBOX\" value=\"1\" style=\"vertical-align:middle\" name=\"write_permission_autor\">";
$output .= _("Mit Schreibrechten für alle Teilnehmer dieser Veranstaltung") . "</div>";
$output .= Button::create(_('Hinzufügen'), 'add') . "<br>";
} else {
$output .= " " . Button::create(_('Hinzufügen'), 'add');
}
$output .= "</form>";
return $output;
// $output .= parent::getAdminModuleLinks();
}
示例3: add_member_action
public function add_member_action()
{
CSRFProtection::verifyRequest();
$mp = MultiPersonSearch::load('settings_add_deputy');
$msg = array('error' => array(), 'success' => array());
foreach ($mp->getAddedUsers() as $_user_id) {
if (isDeputy($_user_id, $this->user->user_id)) {
$msg['error'][] = sprintf(_('%s ist bereits als Vertretung eingetragen.'), get_fullname($_user_id, 'full'));
} else {
if ($_user_id == $this->user->user_id) {
$msg['error'][] = _('Sie können sich nicht als Ihre eigene Vertretung eintragen!');
} else {
if (!addDeputy($_user_id, $this->user->user_id)) {
$msg['error'][] = _('Fehler beim Eintragen der Vertretung!');
} else {
$msg['success'][] = sprintf(_('%s wurde als Vertretung eingetragen.'), get_fullname($_user_id, 'full'));
}
}
}
}
// only show an error messagebox once.
if (!empty($msg['error'])) {
PageLayout::postMessage(MessageBox::error(_('Die gewünschte Operation konnte nicht ausgeführt werden.'), $msg['error']));
}
if (!empty($msg['success'])) {
PageLayout::postMessage(MessageBox::success(_('Die gewünschten Personen wurden als Ihre Vertretung eingetragen!'), $msg['success']));
}
$this->redirect('settings/deputies/index');
}
示例4: edit_action
/**
* This method edits existing holidays or creates new holidays
*
* @param mixed $id Id of the holiday or null to create one
*/
public function edit_action($id = null)
{
$this->holiday = new SemesterHoliday($id);
PageLayout::setTitle($this->holiday->isNew() ? _('Ferien anlegen') : _('Ferien bearbeiten'));
if (Request::isPost()) {
CSRFProtection::verifyUnsafeRequest();
$this->holiday->name = Request::get('name');
$this->holiday->description = Request::get('description');
$this->holiday->beginn = $this->getTimeStamp('beginn');
$this->holiday->ende = $this->getTimeStamp('ende', '23:59:59');
$errors = array();
if (!$this->holiday->name) {
$errors[] = _('Bitte geben Sie einen Namen ein.');
}
if (!$this->holiday->beginn) {
$errors[] = _('Bitte geben Sie einen Ferienbeginn ein.');
}
if (!$this->holiday->ende) {
$errors[] = _('Bitte geben Sie ein Ferienende ein.');
}
if ($this->holiday->beginn > $this->holiday->ende) {
$errors[] = _('Das Ferienende liegt vor dem Beginn.');
}
if (!empty($errors)) {
PageLayout::postMessage(MessageBox::error(_('Ihre eingegebenen Daten sind ungültig.'), $errors));
} elseif ($this->holiday->isDirty() && !$this->holiday->store()) {
PageLayout::postMessage(MessageBox::error(_('Die Ferien konnten nicht gespeichert werden.')));
} else {
PageLayout::postMessage(MessageBox::success(_('Die Ferien wurden erfolgreich gespeichert.')));
$this->relocate('admin/holidays');
}
}
}
示例5: edit_action
/**
* This method edits an existing semester or creates a new semester.
*
* @param mixed $id Id of the semester or null to create a semester.
*/
public function edit_action($id = null)
{
$this->semester = new Semester($id);
PageLayout::setTitle($this->semester->isNew() ? _('Semester anlegen') : _('Semester bearbeiten'));
if (Request::isPost()) {
CSRFProtection::verifyUnsafeRequest();
// Extract values
$this->semester->name = Request::get('name');
$this->semester->description = Request::get('description');
$this->semester->semester_token = Request::get('token');
$this->semester->beginn = $this->getTimeStamp('beginn');
$this->semester->ende = $this->getTimeStamp('ende', '23:59:59');
$this->semester->vorles_beginn = $this->getTimeStamp('vorles_beginn');
$this->semester->vorles_ende = $this->getTimeStamp('vorles_ende', '23:59:59');
// Validate
$errors = $this->validateSemester($this->semester);
// If valid, try to store the semester
if (empty($errors) && $this->semester->isDirty() && !$this->semester->store()) {
$errors[] = _('Fehler bei der Speicherung Ihrer Daten. Bitte überprüfen Sie Ihre Angaben.');
}
// Output potential errors or show success message and relocate
if (count($errors) === 1) {
$error = reset($errors);
PageLayout::postMessage(MessageBox::error($error));
} elseif (!empty($errors)) {
$message = _('Ihre eingegebenen Daten sind ungültig.');
PageLayout::postMessage(MessageBox::error($message, $errors));
} else {
$message = _('Das Semester wurde erfolgreich gespeichert.');
PageLayout::postMessage(MessageBox::success($message));
$this->relocate('admin/semester');
}
$this->errors = $errors;
}
}
示例6: navigator
function navigator ($print_view = false) {
global $cssSw, $view_mode;
$semester = SemesterData::GetSemesterArray();
unset($semester[0]);
if (!$print_view){
?>
<table border="0" celpadding="2" cellspacing="0" width="99%" align="center">
<form method="POST" name="schedule_form" action="<?echo URLHelper::getLink('?navigate=TRUE&quick_view=view_sem_schedule&quick_view_mode='.$view_mode) ?>">
<?= CSRFProtection::tokenTag() ?>
<tr>
<td class="<? $cssSw->switchClass(); echo $cssSw->getClass() ?>" width="4%">
</td>
<td class="<? echo $cssSw->getClass() ?>" width="96%" colspan="3"><font size=-1><b><?=_("Semester:")?></b></font>
</td>
</tr>
<tr>
<td class="<? echo $cssSw->getClass() ?>" width="4%" rowspan="2">
</td>
<td class="<? echo $cssSw->getClass() ?>" width="40%" valign="bottom">
<font size="-1">
<?=SemesterData::GetSemesterSelector(array('name' => 'sem_schedule_choose', 'onChange' => 'document.schedule_form.submit()'), $this->semester['semester_id'],'semester_id',false)?>
<?= Button::create(_('Auswählen'), 'jump') ?><br>
</font>
</td>
<td class="<? echo $cssSw->getClass() ?>" width="30%" valign="middle">
<font size="-1">
<?=_("Ein Semester als Liste ausgeben")?>
</font>
</td>
<td class="<? echo $cssSw->getClass() ?>">
<?= Button::create(_('Ausgeben'), 'sem_schedule_start_list') ?><br>
</td>
</tr>
<tr>
<td class="<? echo $cssSw->getClass() ?>" width="40%" valign="middle">
<label>
<input type="radio" onChange="document.schedule_form.submit()" style="vertical-align:bottom" <?=($this->timespan == 'course_time' ? 'checked' : '')?> name="sem_time_choose" value="course_time">
<?=_("Vorlesungszeit")?>
</label>
<label>
<input type="radio" onChange="document.schedule_form.submit()" style="vertical-align:bottom" <?=($this->timespan == 'sem_time' ? 'checked' : '')?> name="sem_time_choose" value="sem_time">
<?=_("vorlesungsfreie Zeit")?>
</label>
</td>
<td class="<? echo $cssSw->getClass() ?>" width="30%" valign="middle"><font size="-1">
<?=_("<i>oder</i> ein Semester grafisch ausgeben")?>
</font>
</td>
<td class="<? echo $cssSw->getClass() ?>">
<?= Button::create(_('Ausgeben'), 'sem_schedule_start_graphical') ?><br>
</td>
</tr>
<tr>
<td class="<? echo $cssSw->getClass() ?>" colspan="4"><font size="-1"> </font>
</td>
</tr>
</table>
<?
}
}
示例7: navigator
function navigator ($print_view = false) {
global $cssSw, $view_mode;
if (!$print_view){
?>
<table border="0" celpadding="2" cellspacing="0" width="99%" align="center">
<form method="POST" name="schedule_form" action="<?= URLHelper::getLink('?navigate=TRUE&quick_view=view_group_schedule&quick_view_mode='.$view_mode) ?>">
<?= CSRFProtection::tokenTag() ?>
<tr>
<td class="<? $cssSw->switchClass(); echo $cssSw->getClass() ?>" width="4%">
</td>
<td class="<? echo $cssSw->getClass() ?>" width="96%" colspan="3"><font size=-1><b><?=_("Semester:")?></b></font>
</td>
</tr>
<tr>
<td class="<? echo $cssSw->getClass() ?>" width="4%" rowspan="2">
</td>
<td class="<? echo $cssSw->getClass() ?>" width="40%" valign="top">
<?= SemesterData::GetSemesterSelector(array('name' => 'sem_schedule_choose', 'onChange' => 'document.schedule_form.submit()'), $this->semester['semester_id'],'semester_id',false)?>
<?= Button::create(_('Auswählen'), 'jump') ?><br>
<label>
<input type="radio" onChange="document.schedule_form.submit()" style="vertical-align:bottom" <?=($this->timespan == 'course_time' ? 'checked' : '')?> name="sem_time_choose" value="course_time">
<?=_("Vorlesungszeit")?>
</label>
<label>
<input type="radio" onChange="document.schedule_form.submit()" style="vertical-align:bottom" <?=($this->timespan == 'sem_time' ? 'checked' : '')?> name="sem_time_choose" value="sem_time">
<?=_("vorlesungsfreie Zeit")?>
</label>
</td>
<td class="<? echo $cssSw->getClass() ?>" width="60%" valign="top">
<?=_("Eine Raumgruppe auswählen")?>:<br>
<select name="group_schedule_choose_group" onChange="document.schedule_form.submit()">
<?
$room_group = RoomGroups::GetInstance();
foreach($room_group->getAvailableGroups() as $gid){
echo '<option value="'.$gid.'" '
. ($this->group_id == $gid ? 'selected' : '') . '>'
.htmlReady(my_substr($room_group->getGroupName($gid),0,85))
.' ('.$room_group->getGroupCount($gid).')</option>';
}
?>
</select>
<?= Button::create(_('Auswählen')) ?>
</font>
</td>
<td class="<? echo $cssSw->getClass() ?>" valign="middle">
</td>
</tr>
<tr>
<td class="<? echo $cssSw->getClass() ?>" colspan="4"><font size="-1"> </font>
</td>
</tr>
</table>
<?
}
}
示例8: navigator
function navigator ($print_view = false) {
global $cssSw, $view_mode,$view;
$start_time = $this->start_time;
if (!$print_view){
?>
<table border="0" celpadding="2" cellspacing="0" width="99%" align="center">
<form method="POST" name="schedule_form" action="<?echo URLHelper::getLink('?navigate=TRUE&quick_view='.$view.'&quick_view_mode='.$view_mode) ?>">
<?= CSRFProtection::tokenTag() ?>
<tr>
<td class="<? $cssSw->switchClass(); echo $cssSw->getClass() ?>" width="4%">
</td>
<td class="<? echo $cssSw->getClass() ?>" width="96%" colspan="3"><font size=-1><b><?=_("Datum:")?></b></font>
</td>
</tr>
<tr>
<td class="<? echo $cssSw->getClass() ?>" width="4%" rowspan="2">
</td>
<td class="<? echo $cssSw->getClass() ?>" width="40%" valign="middle">
<!--CHANGE for Datepicker-->
<input type="text" id="schedule_begin_date" name="schedule_begin_date" size="10" value="<?echo date("d",$start_time).'.'.date("m",$start_time).'.'.date("Y",$start_time);; ?>">
<script>
jQuery('#schedule_begin_date').datepicker();
</script>
<!--
<input type="text" name="schedule_begin_day" size=2 maxlength=2 value="<?echo date("d",$start_time); ?>">.
<input type="text" name="schedule_begin_month" size=2 maxlength=2 value="<?echo date("m",$start_time); ?>">.
<input type="text" name="schedule_begin_year" size=4 maxlength=4 value="<?echo date("Y",$start_time); ?>">
-->
<?= Button::create(_('Auswählen'), 'jump') ?><br>
</td>
<td class="<? echo $cssSw->getClass() ?>" width="60%" valign="bottom">
<?= ($view_mode == 'oobj' ? _("Eine Ressourcengruppe auswählen") : _("Eine Raumgruppe auswählen")) ?>:<br>
<select name="group_schedule_choose_group" onChange="document.schedule_form.submit()">
<? foreach($this->resources_groups->getAvailableGroups() as $gid) :
echo '<option value="'.$gid.'" '
. ($this->group_id == $gid ? 'selected' : '') . '>'
.htmlReady(my_substr($this->resources_groups->getGroupName($gid),0,80))
.' ('.$this->resources_groups->getGroupCount($gid).')</option>';
endforeach ?>
</select>
<?= Button::create(_('Auswählen')) ?>
</td>
<td class="<? echo $cssSw->getClass() ?>" valign="middle">
</td>
</tr>
<tr>
<td class="<? echo $cssSw->getClass() ?>" colspan="4"><font size="-1"> </font>
</td>
</tr>
</table>
<?
}
}
示例9: getAdminModuleLinks
/**
* get admin module links
*
* returns links add or remove a module from course
* @access public
* @return string returns html-code
*/
function getAdminModuleLinks()
{
global $connected_cms, $view, $search_key, $cms_select, $current_module;
if (!$connected_cms[$this->cms_type]->content_module[$current_module]->isDummy()) {
$result = $connected_cms[$this->cms_type]->soap_client->getPath($connected_cms[$this->cms_type]->content_module[$current_module]->getId());
}
if ($result) {
$output .= "<i>Pfad: " . htmlReady($result) . "</i><br><br>";
}
$output .= "<form method=\"POST\" action=\"" . URLHelper::getLink() . "\">\n";
$output .= CSRFProtection::tokenTag();
$output .= "<input type=\"HIDDEN\" name=\"view\" value=\"" . htmlReady($view) . "\">\n";
$output .= "<input type=\"HIDDEN\" name=\"search_key\" value=\"" . htmlReady($search_key) . "\">\n";
$output .= "<input type=\"HIDDEN\" name=\"cms_select\" value=\"" . htmlReady($cms_select) . "\">\n";
$output .= "<input type=\"HIDDEN\" name=\"module_type\" value=\"" . htmlReady($connected_cms[$this->cms_type]->content_module[$current_module]->getModuleType()) . "\">\n";
$output .= "<input type=\"HIDDEN\" name=\"module_id\" value=\"" . htmlReady($connected_cms[$this->cms_type]->content_module[$current_module]->getId()) . "\">\n";
$output .= "<input type=\"HIDDEN\" name=\"module_system_type\" value=\"" . htmlReady($this->cms_type) . "\">\n";
if ($connected_cms[$this->cms_type]->content_module[$current_module]->isConnected()) {
$output .= " " . Button::create(_('Entfernen'), 'remove');
} elseif ($connected_cms[$this->cms_type]->content_module[$current_module]->isAllowed(OPERATION_WRITE)) {
$output .= "<div align=\"left\">";
if ($connected_cms[$this->cms_type]->content_module[$current_module]->isAllowed(OPERATION_COPY) and !in_array($connected_cms[$this->cms_type]->content_module[$current_module]->module_type, array("lm", "htlm", "sahs", "cat", "crs", "dbk"))) {
$output .= "<input type=\"CHECKBOX\" name=\"copy_object\" value=\"1\">";
$output .= _("Als Kopie anlegen") . " ";
$output .= Icon::create('info-circle', 'inactive', ['title' => _('Wenn Sie diese Option wählen, wird eine identische Kopie als eigenständige Instanz des Lernmoduls erstellt. Anderenfalls wird ein Link zum Lernmodul gesetzt.')])->asImg();
$output .= "<br>";
}
$output .= "<input type=\"RADIO\" name=\"write_permission\" value=\"none\" checked>";
$output .= _("Keine Schreibrechte") . " ";
$output .= Icon::create('info-circle', 'inactive', ['title' => _('Nur der/die BesitzerIn des Lernmoduls hat Schreibzugriff für Inhalte und Struktur des Lernmoduls. Tutor/-innen und Lehrende können die Verknüpfung zur Veranstaltung wieder löschen.')])->asImg();
$output .= "<br>";
$output .= "<input type=\"RADIO\" name=\"write_permission\" value=\"dozent\">";
$output .= _("Mit Schreibrechten für alle Lehrenden dieser Veranstaltung") . " ";
$output .= Icon::create('info-circle', 'inactive', ['title' => _('Lehrende haben Schreibzugriff für Inhalte und Struktur des Lernmoduls. Tutor/-innen und Lehrende können die Verknüpfung zur Veranstaltung wieder löschen.')])->asImg();
$output .= "<br>";
$output .= "<input type=\"RADIO\" name=\"write_permission\" value=\"tutor\">";
$output .= _("Mit Schreibrechten für alle Lehrenden und Tutor/-innen dieser Veranstaltung") . " ";
$output .= Icon::create('info-circle', 'inactive', ['title' => _('Lehrende und Tutor/-innen haben Schreibzugriff für Inhalte und Struktur des Lernmoduls. Tutor/-innen und Lehrende können die Verknüpfung zur Veranstaltung wieder löschen.')])->asImg();
$output .= "<br>";
$output .= "<input type=\"RADIO\" name=\"write_permission\" value=\"autor\">";
$output .= _("Mit Schreibrechten für alle Personen dieser Veranstaltung") . " ";
$output .= Icon::create('info-circle', 'inactive', ['title' => _('Lehrende, Tutor/-innen und Teilnehmer/-innen haben Schreibzugriff für Inhalte und Struktur des Lernmoduls. Tutor/-innen und Lehrende können die Verknüpfung zur Veranstaltung wieder löschen.')])->asImg();
$output .= "</div>";
$output .= "</div><br>" . Button::create(_('Hinzufügen'), 'add') . "<br>";
} else {
$output .= " " . Button::create(_('Hinzufügen'), 'add');
}
$output .= "</form>";
return $output;
}
示例10: getAdminModuleLinks
/**
* get module-links for admin
*
* returns links to remove or add module to object
* @access public
* @return string html-code
*/
function getAdminModuleLinks()
{
global $connected_cms, $view, $search_key, $cms_select, $current_module;
$output .= "<form method=\"POST\" action=\"" . URLHelper::getLink() . "\">\n";
$output .= CSRFProtection::tokenTag();
$output .= "<input type=\"HIDDEN\" name=\"view\" value=\"" . htmlReady($view) . "\">\n";
$output .= "<input type=\"HIDDEN\" name=\"search_key\" value=\"" . htmlReady($search_key) . "\">\n";
$output .= "<input type=\"HIDDEN\" name=\"cms_select\" value=\"" . htmlReady($cms_select) . "\">\n";
$output .= "<input type=\"HIDDEN\" name=\"module_type\" value=\"" . htmlReady($connected_cms[$this->cms_type]->content_module[$current_module]->getModuleType()) . "\">\n";
$output .= "<input type=\"HIDDEN\" name=\"module_id\" value=\"" . htmlReady($connected_cms[$this->cms_type]->content_module[$current_module]->getId()) . "\">\n";
$output .= "<input type=\"HIDDEN\" name=\"module_system_type\" value=\"" . htmlReady($this->cms_type) . "\">\n";
if ($connected_cms[$this->cms_type]->content_module[$current_module]->isConnected()) {
$output .= " " . Button::create(_('Entfernen'), 'remove');
} else {
$output .= " " . Button::create(_('Hinzufügen'), 'add');
}
$output .= "</form>";
return $output;
}
示例11: array
<form action="<?php
echo URLHelper::getLink($url, array(), true);
?>
" method="<?php
echo $method;
?>
">
<?php
echo $method == 'post' ? CSRFProtection::tokenTag() : '';
?>
<select class="sidebar-selectlist" size="<?php
echo (int) $size ?: 8;
?>
" name="<?php
echo htmlReady($name);
?>
" onKeyDown="if (event.keyCode === 13) { jQuery(this).closest('form')[0].submit(); }" <?php
echo $size == 1 ? 'onchange' : 'onClick';
?>
="jQuery(this).closest('form')[0].submit();" size="10" style="max-width: 200px;cursor:pointer" class="text-top" aria-label="<?php
echo _("Wählen Sie ein Objekt aus. Sie gelangen dann zur neuen Seite.");
?>
">
<? foreach ($elements as $element): ?>
<option <?php
echo $value == $element->getid() ? 'selected' : '';
?>
value="<?php
echo htmlReady($element->getid());
?>
"><?php
示例12: homePage
protected static function homePage()
{
?>
<html>
<head>
<?php
if (file_exists("jquery-2.2.0.min.js")) {
$jquery = "jquery-2.2.0.min.js";
} else {
$jquery = "https://ajax.googleapis.com/ajax/libs/jquery/2.2.0/jquery.min.js";
}
?>
<script type="text/javascript" src="<?php
echo $jquery;
?>
"></script>
<script type="text/javascript">
var csrf_token = "<?php
echo CSRFProtection::getCSRFToken();
?>
";
$(document).ready(function ($) {
var rules_table = {
add_rows: function (data) {
for (alias in data) {
this.add_row(alias, data[alias]);
}
},
add_row: function (alias, data) {
var table = $('#real_rules');
var rule = $('#sample_rule').clone();
rule.attr('id', false);
rule.find('.rule_serial_number').text(table.find('tr').length + 1);
rule.find('.rule_enabled').prop('checked', "true" == data.enabled);
rule.find('.rule_http_status_code').find(':contains(' + data.http_status_code + ')').prop('selected', true);
rule.find('.rule_alias').val(alias);
rule.find('.rule_url').val(data.url);
table.append(rule);
},
createRows: function (number) {
var table = $('#real_rules');
for (var i = 1; i <= number; i++) {
var rule = $('#sample_rule').clone();
rule.attr('id', false);
rule.find('.rule_serial_number').text(table.find('tr').length + 1);
rule.find('.rule_enabled').prop('checked', true);
table.append(rule);
}
},
reloadIndex: function () {
var table = $('#real_rules');
var a = 1;
table.find('.rule_serial_number').each(function () {
$(this).text(a++);
});
},
empty: function () {
var table = $('#real_rules');
table.children('tr').remove();
}
}
var redirect_rules = {
load: function () {
return $.ajax({
url: '',
method: 'POST',
data: {action: 'get_redirect_rules'},
async: false,
}).responseText;
},
update: function (data) {
return $.ajax({
url: '',
method: 'POST',
data: {action: 'update_redirect_rules', data: data, csrf_token: csrf_token},
async: false,
}).responseText;
}
}
jQuery('#op_mom').click(function () {
if (!(confirm("Press F5, You Idiot!\n\nCan you do this?"))) {
location.reload();
}
});
jQuery('#rows_add').click(function () {
rules_table.createRows(5);
});
jQuery(document).on('click', '.rule_delete', function () {
$(this).closest('tr').remove();
rules_table.reloadIndex();
});
jQuery('#update_rules').click(function () {
$('#loader').css('display', 'block');
jQuery('#update_rules').val('Updating..');
//.........这里部分代码省略.........
示例13: getItemContent
/**
* creates the content for all item-types
*
* @access private
* @param string $itemID the item-heas id
* @return string the item content (html)
*/
function getItemContent($itemID)
{
$content = "";
if ($this->getItemMessage($itemID)) {
$table = new HTML("table");
$table->addAttr("width", "99%");
$table->addAttr("cellpadding", "2");
$table->addAttr("cellspacing", "2");
$table->addAttr("style", "font-size:10pt;");
$tr = new HTML("tr");
$td = new HTML("td");
$td->addHTMLContent($this->getItemMessage($itemID));
$tr->addContent($td);
$table->addContent($tr);
$content .= "<br>" . $table->createContent();
}
$content .= "<form action=\"" . URLHelper::getLink($this->getSelf("item_id={$itemID}", 1)) . "\" method=\"POST\" style=\"display:inline;\">\n";
$content .= CSRFProtection::tokenTag();
$content .= "<br>";
$mode = $this->getInstance($itemID);
switch ($mode) {
case ROOT_BLOCK:
$content .= $this->createTitleInput(ROOT_BLOCK) . $this->createGlobalFeatures() . $this->createButtonbar(ROOT_BLOCK);
break;
case ARRANGMENT_BLOCK:
$content .= $this->createTitleInput(ARRANGMENT_BLOCK);
$group =& $this->tree->getGroupObject($itemID);
if ($children = $group->getChildren()) {
if ($this->getInstance($children[0]->getObjectID()) == ARRANGMENT_BLOCK) {
$show = ARRANGMENT_BLOCK;
} else {
$show = QUESTION_BLOCK;
}
} else {
$show = "both";
}
$content .= $this->createButtonbar($show);
break;
case QUESTION_BLOCK:
$content .= $this->createTitleInput(QUESTION_BLOCK) . $this->createQuestionFeatures() . $this->createQuestionForm() . $this->createButtonbar(NULL);
break;
}
$content .= "</form>\n";
return $content;
}
示例14: deleteGroup_action
function deleteGroup_action()
{
if (Request::submitted('delete')) {
CSRFProtection::verifyRequest();
$this->group->delete();
$this->redirect('contact/index');
}
}
示例15: mail_explain
function mail_explain()
{
echo _('Sie haben Ihre E-Mail-Adresse geändert. Um diese frei zu schalten müssen Sie den Ihnen an Ihre neue Adresse zugeschickten Aktivierungs Schlüssel im unten stehenden Eingabefeld eintragen.');
echo '<br><form action="' . URLHelper::getLink() . '" method="post">' . CSRFProtection::tokenTag() . '<input type="text" name="key"><input name="uid" type="hidden" value="' . htmlReady(Request::option('uid')) . '"><br>' . Button::createAccept() . '</form><br><br>';
}