本文整理汇总了PHP中addCsrfGetToken函数的典型用法代码示例。如果您正苦于以下问题:PHP addCsrfGetToken函数的具体用法?PHP addCsrfGetToken怎么用?PHP addCsrfGetToken使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了addCsrfGetToken函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: file_put_contents
if ($html) {
print "<blockquote>{$html}</blockquote>";
}
}
if ($i == 50) {
break;
}
++$i;
}
// Do import
} else {
file_put_contents($newfile . '.data', serialize($_POST));
print '<h3>' . s('Importing %d subscribers to %d lists, please wait', count($email_list), count($import_lists)) . '</h3>';
print $GLOBALS['img_busy'];
print '<div id="progresscount" style="width: 200; height: 50;">Progress</div>';
print '<br/> <iframe id="import1" src="./?page=pageaction&action=import1&ajaxed=true&file=' . urlencode(basename($newfile)) . addCsrfGetToken() . '" scrolling="no" height="50"></iframe>';
}
// end else
# print '<p class="button">'.PageLink2("import1",$GLOBALS['I18N']->get('Import some more emails')).'</p>';
} else {
echo FormStart(' enctype="multipart/form-data" name="import"');
if ($GLOBALS['require_login'] && !isSuperUser()) {
$access = accessLevel('import1');
switch ($access) {
case 'owner':
$subselect = ' where owner = ' . $_SESSION['logindetails']['id'];
break;
case 'all':
$subselect = '';
break;
case 'none':
示例2: sendEmail
} else {
$success = sendEmail($id, $address, $user['uniqid'], 1) && sendEmail($id, $address, $user['uniqid'], 0);
}
}
$sendtestresult .= $GLOBALS['I18N']->get('Sent test mail to') . ": {$address} ";
if (!$success) {
$sendtestresult .= $GLOBALS['I18N']->get('failed');
} else {
$sendtestresult .= $GLOBALS['I18N']->get('success');
$_SESSION['lasttestsent'] = time();
}
$sendtestresult .= '<br/>';
} else {
$address = htmlspecialchars(substr(strip_tags($address), 0, 255));
$sendtestresult .= $GLOBALS['I18N']->get('Email address not found to send test message.') . ": {$address}";
$sendtestresult .= sprintf(' <div class="inline"><a href="%s&action=addemail&email=%s%s" class="button ajaxable">%s</a></div>', $baseurl, urlencode($address), addCsrfGetToken(), $GLOBALS['I18N']->get('add'));
}
$messagedata['testtarget'] .= $address . ', ';
}
$messagedata['testtarget'] = substr($messagedata['testtarget'], 0, -2);
$sendtestresult .= '<hr/>';
$sendtestresult .= '<script type="text/javascript">this.location.hash="sendTest";</script>';
}
} elseif (isset($_POST['deleteattachments']) && is_array($_POST['deleteattachments']) && $id) {
if (ALLOW_ATTACHMENTS) {
// Delete Attachment button hit...
$deleteattachments = $_POST['deleteattachments'];
foreach ($deleteattachments as $attid) {
$attDetails = Sql_fetch_assoc_query(sprintf('select filename from %s where id = %d', $tables['attachment'], $attid));
$phys_file = $GLOBALS['attachment_repository'] . '/' . $attDetails['filename'];
$fileParts = pathinfo($phys_file);
示例3: s
';
}
if ($pqChoice == 'local') {
print '
<div class="panel">
<h2>' . s('Processing queued campaigns') . '</h2>
<div class="content">
<div class="wrapper">
<div id="spinner"></div>
<div id="processqueuecontrols">';
print '<a href="#" id="stopqueue" class="button">' . snbr('stop processing') . '</a>';
print '<a href="./?page=processqueue" id="resumequeue" class="button hidden">' . snbr('resume processing') . '</a>';
print '<div id="progressmeterold"><div id="progresscount"></div><div id="progress"> </div></div>';
print '</div>
</div>
<div id="processqueueoutput">
<div id="processqueuesummary"></div>
<div id="processqueueprogress"></div>
<iframe id="processqueueiframe" src="./?page=pageaction&action=processqueue&ajaxed=true' . addCsrfGetToken() . '" scrolling="no"></iframe>
</div>
</div>
</div>';
if (SHOW_PQCHOICE) {
print s('Using local processing') . ' <p><a href="./?page=processqueue&pqchoice=reset" class="button">' . s('Reset') . '</a></p>';
}
} elseif ($pqChoice == 'phplistdotcom') {
print '<h3>' . s('To send your queue, you use the service from phpList.com') . '</h3>';
print '<p><a href="./?page=messages&tab=active" class="button">' . s('View progress') . '</a></p>';
print '<p><a href="./?page=hostedprocessqueuesetup" class="button">' . s('Change settings') . '</a></p>';
print '<p><a href="./?page=processqueue&pqchoice=reset" class="button">' . s('Reset choice') . '</a></p>';
}
示例4: my_shutdown
function my_shutdown()
{
global $script_stage, $reload;
# processQueueOutput( "Script status: ".connection_status(),0); # with PHP 4.2.1 buggy. http://bugs.php.net/bug.php?id=17774
processQueueOutput(s('Script stage') . ': ' . $script_stage, 0, 'progress');
global $counters, $report, $send_process_id, $tables, $nothingtodo, $processed, $notsent, $unconfirmed, $batch_period;
$some = $processed;
$delaytime = 0;
if (!$some) {
processQueueOutput($GLOBALS['I18N']->get('Finished, Nothing to do'), 0, 'progress');
$nothingtodo = 1;
}
$totaltime = $GLOBALS['processqueue_timer']->elapsed(1);
if ($totaltime > 0) {
$msgperhour = 3600 / $totaltime * $counters['sent'];
} else {
$msgperhour = s('Calculating');
}
if ($counters['sent']) {
processQueueOutput(sprintf('%d %s %01.2f %s (%d %s)', $counters['sent'], $GLOBALS['I18N']->get('messages sent in'), $totaltime, $GLOBALS['I18N']->get('seconds'), $msgperhour, $GLOBALS['I18N']->get('msgs/hr')), $counters['sent'], 'progress');
}
if ($counters['invalid']) {
processQueueOutput(s('%d invalid email addresses', $counters['invalid']), 1, 'progress');
}
if ($counters['failed_sent']) {
processQueueOutput(s('%d failed (will retry later)', $counters['failed_sent']), 1, 'progress');
foreach ($counters as $label => $value) {
# processQueueOutput(sprintf('%d %s',$value,$GLOBALS['I18N']->get($label)),1,'progress');
cl_output(sprintf('%d %s', $value, $GLOBALS['I18N']->get($label)));
}
}
if ($unconfirmed) {
processQueueOutput(sprintf($GLOBALS['I18N']->get('%d emails unconfirmed (not sent)'), $unconfirmed), 1, 'progress');
}
foreach ($GLOBALS['plugins'] as $pluginname => $plugin) {
$plugin->processSendStats($counters['sent'], $counters['invalid'], $counters['failed_sent'], $unconfirmed, $counters);
}
flushClickTrackCache();
releaseLock($send_process_id);
finish('info', $report, $script_stage);
if ($script_stage < 5 && !$nothingtodo) {
processQueueOutput($GLOBALS['I18N']->get('Warning: script never reached stage 5') . "\n" . $GLOBALS['I18N']->get('This may be caused by a too slow or too busy server') . " \n");
} elseif ($script_stage == 5 && (!$nothingtodo || isset($GLOBALS['wait']))) {
# if the script timed out in stage 5, reload the page to continue with the rest
++$reload;
if (!$GLOBALS['commandline'] && $counters['num_per_batch'] && $batch_period) {
if ($counters['sent'] + 10 < $GLOBALS['original_num_per_batch']) {
processQueueOutput($GLOBALS['I18N']->get('Less than batch size were sent, so reloading imminently'), 1, 'progress');
$counters['delaysend'] = 10;
} else {
$counters['delaysend'] = (int) ($batch_period - $totaltime);
$delaytime = 30;
## actually with the iframe we can reload fairly quickly
processQueueOutput(s('Waiting for %d seconds before reloading', $delaytime), 1, 'progress');
}
}
$counters['delaysend'] = (int) ($batch_period - $totaltime);
if (empty($GLOBALS['inRemoteCall']) && empty($GLOBALS['commandline'])) {
sleep($delaytime);
printf('<script type="text/javascript">
document.location = "./?page=pageaction&action=processqueue&ajaxed=true&reload=%d&lastsent=%d&lastskipped=%d%s";
</script></body></html>', $reload, $counters['sent'], $notsent, addCsrfGetToken());
}
} elseif ($script_stage == 6 || $nothingtodo) {
foreach ($GLOBALS['plugins'] as $pluginname => $plugin) {
$plugin->messageQueueFinished();
}
processQueueOutput($GLOBALS['I18N']->get('Finished, All done'), 0);
print '<script type="text/javascript">
var parentJQuery = window.parent.jQuery;
window.parent.allDone("' . s('All done') . '");
</script>';
} else {
processQueueOutput(s('Script finished, but not all messages have been sent yet.'));
}
if (!empty($GLOBALS['inRemoteCall'])) {
ob_end_clean();
print outputCounters();
@ob_start();
}
if (empty($GLOBALS['inRemoteCall']) && empty($GLOBALS['commandline']) && empty($_GET['ajaxed'])) {
return;
} elseif (!empty($GLOBALS['inRemoteCall']) || !empty($GLOBALS['commandline'])) {
@ob_end_clean();
}
exit;
}
示例5: PageURL2
function PageURL2($name, $desc = '', $url = '', $no_plugin = false)
{
if (empty($name)) {
return '';
}
if ($url) {
$url = '&' . $url;
}
$access = accessLevel($name);
if ($access == 'owner' || $access == 'all' || $access == 'view') {
if (!$no_plugin && !preg_match('/&pi=/i', $name) && $_GET['pi'] && is_object($GLOBALS['plugins'][$_GET['pi']])) {
$pi = '&pi=' . $_GET['pi'];
} else {
$pi = '';
}
return sprintf('./?page=%s%s%s%s', $name, $url, $pi, addCsrfGetToken());
} else {
return '';
}
}
示例6: var_dump
}
print $ls->display();
#var_dump($_SESSION["import_attribute"]);
# print "SYSTEM INDEX";
# var_dump($_SESSION["systemindex"]);
print '<h3>';
printf($GLOBALS['I18N']->get('%d lines will be imported'), $total);
print '</h3>';
print '<p>' . PageLinkButton($_GET["page"] . '&confirm=yes', $GLOBALS['I18N']->get('Confirm Import')) . '</p>';
print '<h3>' . $GLOBALS['I18N']->get('Test Output') . '</h3>';
# dbg($_SESSION["import_attribute"]);
} elseif (sizeof($email_list)) {
print '<h3>' . s('Importing %d subscribers to %d lists, please wait', sizeof($email_list), sizeof($_SESSION['lists'])) . '</h3>';
print $GLOBALS['img_busy'];
print '<div id="progresscount" style="width: 200; height: 50;">Progress</div>';
print '<br/> <iframe id="import2" src="./?page=pageaction&action=import2&ajaxed=true' . addCsrfGetToken() . '" scrolling="no" height="5" width="100"></iframe>';
return;
}
#var_dump($system_attributes);
### show progress and adjust working space
if (sizeof($email_list)) {
$import_field_delimiter = $_SESSION["import_field_delimiter"];
if (sizeof($email_list) > 300 && !$_SESSION["test_import"]) {
# this is a possibly a time consuming process, so show a progress bar
print '<script language="Javascript" type="text/javascript"> document.write(progressmeter); start();</script>';
flush();
# increase the memory to make sure we are not running out
# $mem = sizeof($email_list);
ini_set("memory_limit", "32M");
}
### store the chosen mappings in the $system_attribute_mapping list
示例7: PageURL2
function PageURL2($name, $desc = "", $url = "", $no_plugin = false)
{
if (empty($name)) {
return '';
}
if ($url) {
$url = "&" . $url;
}
$access = accessLevel($name);
if ($access == "owner" || $access == "all" || $access == "view") {
if (!$no_plugin && !preg_match("/&pi=/i", $name) && $_GET["pi"] && is_object($GLOBALS["plugins"][$_GET["pi"]])) {
$pi = '&pi=' . $_GET["pi"];
} else {
$pi = "";
}
return sprintf('./?page=%s%s%s%s', $name, $url, $pi, addCsrfGetToken());
} else {
return '';
}
}
示例8: Error
if (!verifyToken()) {
## csrf check
print Error($GLOBALS['I18N']->get('Invalid security token. Please reload the page and try again.'));
return;
}
$_SESSION['export'] = array();
$_SESSION['export']['column'] = $_POST['column'];
$_SESSION['export']['cols'] = $_POST['cols'];
$_SESSION['export']['attrs'] = $_POST['attrs'];
$_SESSION['export']['fromdate'] = $from->getDate("from");
$_SESSION['export']['todate'] = $to->getDate("to");
$_SESSION['export']['list'] = $list;
print '<p>' . s('Processing export, this may take a while. Please wait') . '</p>';
print $GLOBALS['img_busy'];
print '<div id="progresscount" style="width: 200; height: 50;">Progress</div>';
print '<br/> <iframe id="export" src="./?page=pageaction&action=export&ajaxed=true' . addCsrfGetToken() . '" scrolling="no" height="50"></iframe>';
return;
}
if ($list) {
print sprintf($GLOBALS['I18N']->get('Export subscribers on %s'), ListName($list));
}
print formStart();
$checked = 'entered';
if (isset($_GET['list']) && $_GET['list'] == 'all') {
$checked = 'nodate';
}
?>
<?php
echo $GLOBALS['I18N']->get('What date needs to be used:');
?>
示例9: Redirect
Redirect('userhistory&id=' . $unblacklist);
}
$result = Sql_query("SELECT * FROM {$tables['user']} where id = {$id}");
if (!Sql_Affected_Rows()) {
Fatal_Error($GLOBALS['I18N']->get('no such User'));
return;
}
$user = sql_fetch_array($result);
print '<h3>' . $GLOBALS['I18N']->get('user') . ' ' . PageLink2('user&id=' . $user['id'], $user['email']) . '</h3>';
print '<div class="actions">';
//printf('<a href="%s" class="button">%s</a>',getConfig("preferencesurl").
//'&uid='.$user["uniqid"],$GLOBALS['I18N']->get('update page'));
//printf('<a href="%s" class="button">%s</a>',getConfig("unsubscribeurl").'&uid='.$user["uniqid"],$GLOBALS['I18N']->get('unsubscribe page'));
print PageLinkButton("user&id={$id}", $GLOBALS['I18N']->get('Details'));
if ($access == 'all') {
$delete = new ConfirmButton(htmlspecialchars(s('Are you sure you want to remove this subscriber from the system.')), PageURL2("user&delete={$id}&" . addCsrfGetToken(), 'button', s('remove subscriber')), s('remove subscriber'));
print $delete->show();
}
print '</div>';
$bouncels = new WebblerListing($GLOBALS['I18N']->get('Bounces'));
$bouncelist = '';
$bounces = array();
# check for bounces
$req = Sql_Query(sprintf('select *,date_format(time,"%%e %%b %%Y %%T") as ftime from %s where user = %d', $tables['user_message_bounce'], $user['id']));
if (Sql_Affected_Rows()) {
while ($row = Sql_Fetch_Array($req)) {
$bouncels->addElement($row['bounce'], PageURL2('bounce', $GLOBALS['I18N']->get('view'), 'id=' . $row['bounce']));
$bouncels->addColumn($row['bounce'], $GLOBALS['I18N']->get('msg'), $row['message']);
$bouncels->addColumn($row['bounce'], $GLOBALS['I18N']->get('time'), $row['ftime']);
$bounces[$row['message']] = $row['ftime'];
}
示例10: my_shutdown
function my_shutdown()
{
global $script_stage, $reload;
# output( "Script status: ".connection_status(),0); # with PHP 4.2.1 buggy. http://bugs.php.net/bug.php?id=17774
output($GLOBALS['I18N']->get('Script stage') . ': ' . $script_stage, 0, 'progress');
global $counters, $report, $send_process_id, $tables, $nothingtodo, $invalid, $processed, $failed_sent, $notsent, $sent, $unconfirmed, $num_per_batch, $batch_period, $counters;
$some = $processed;
#$sent;# || $invalid || $notsent;
if (!$some) {
output($GLOBALS['I18N']->get('Finished, Nothing to do'), 0, 'progress');
$nothingtodo = 1;
}
$totaltime = $GLOBALS['processqueue_timer']->elapsed(1);
if ($totaltime > 0) {
$msgperhour = 3600 / $totaltime * $sent;
} else {
$msgperhour = s('Calculating');
}
if ($sent) {
output(sprintf('%d %s %01.2f %s (%d %s)', $sent, $GLOBALS['I18N']->get('messages sent in'), $totaltime, $GLOBALS['I18N']->get('seconds'), $msgperhour, $GLOBALS['I18N']->get('msgs/hr')), $sent, 'progress');
}
if ($invalid) {
output(s('%d invalid email addresses', $invalid), 1, 'progress');
}
if ($failed_sent) {
output(s('%d failed (will retry later)', $failed_sent), 1, 'progress');
foreach ($counters as $label => $value) {
# output(sprintf('%d %s',$value,$GLOBALS['I18N']->get($label)),1,'progress');
cl_output(sprintf('%d %s', $value, $GLOBALS['I18N']->get($label)));
}
}
if ($unconfirmed) {
output(sprintf($GLOBALS['I18N']->get('%d emails unconfirmed (not sent)'), $unconfirmed), 1, 'progress');
}
foreach ($GLOBALS['plugins'] as $pluginname => $plugin) {
$plugin->processSendStats($sent, $invalid, $failed_sent, $unconfirmed, $counters);
}
flushClickTrackCache();
releaseLock($send_process_id);
finish("info", $report, $script_stage);
if ($script_stage < 5 && !$nothingtodo) {
output($GLOBALS['I18N']->get('Warning: script never reached stage 5') . "\n" . $GLOBALS['I18N']->get('This may be caused by a too slow or too busy server') . " \n");
} elseif ($script_stage == 5 && (!$nothingtodo || isset($GLOBALS["wait"]))) {
# if the script timed out in stage 5, reload the page to continue with the rest
$reload++;
if (!$GLOBALS["commandline"] && $num_per_batch && $batch_period) {
if ($sent + 10 < $GLOBALS["original_num_per_batch"]) {
output($GLOBALS['I18N']->get('Less than batch size were sent, so reloading imminently'), 1, 'progress');
$delaytime = 10;
} else {
// we should actually want batch perion minus time already spent.
// might be nice to calculate that at some point
output(sprintf($GLOBALS['I18N']->get('Waiting for %d seconds before reloading'), $batch_period), 1, 'progress');
$delaytime = $batch_period;
}
sleep($delaytime);
printf('<script type="text/javascript">
document.location = "./?page=pageaction&action=processqueue&ajaxed=true&reload=%d&lastsent=%d&lastskipped=%d%s";
</script></body></html>', $reload, $sent, $notsent, addCsrfGetToken());
} else {
printf('<script type="text/javascript">
document.location = "./?page=pageaction&action=processqueue&ajaxed=true&reload=%d&lastsent=%d&lastskipped=%d%s";
</script></body></html>', $reload, $sent, $notsent, addCsrfGetToken());
}
} elseif ($script_stage == 6 || $nothingtodo) {
foreach ($GLOBALS['plugins'] as $pluginname => $plugin) {
$plugin->messageQueueFinished();
}
output($GLOBALS['I18N']->get('Finished, All done'), 0);
print '<script type="text/javascript">
var parentJQuery = window.parent.jQuery;
window.parent.allDone("' . s('All done') . '");
</script>';
} else {
output(s('Script finished, but not all messages have been sent yet.'));
}
if (empty($GLOBALS['commandline']) && empty($_GET['ajaxed'])) {
include_once "footer.inc";
} elseif (!empty($GLOBALS['commandline'])) {
@ob_end_clean();
}
exit;
}