本文整理汇总了PHP中checkSecurityToken函数的典型用法代码示例。如果您正苦于以下问题:PHP checkSecurityToken函数的具体用法?PHP checkSecurityToken怎么用?PHP checkSecurityToken使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了checkSecurityToken函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: handle
/**
* handle user request
*/
function handle()
{
if (!isset($_REQUEST['cmd'])) {
return;
}
// first time - nothing to do
$msg = "";
if (!checkSecurityToken()) {
return;
}
if (!is_array($_REQUEST['cmd'])) {
return;
}
$epub_deletions = array();
$which = key($_REQUEST['cmd']);
foreach ($_REQUEST['book_id'] as $md5 => $id) {
if ($which == 'media') {
$epub_deletions[] = $this->helper->delete_media($md5);
}
$this->helper->delete_page($md5);
}
if (is_array($_REQUEST['book_id'])) {
$this->cache = $this->helper->getCache();
}
if (count($epub_deletions)) {
$this->results = "<b>Results</b><br />";
$this->results .= implode('<br />', $epub_deletions);
}
/* if debugging */
if ($this->dbg) {
$this->req = print_r($_REQUEST, true) . $msg . "which={$which}\n";
$this->req .= print_r($epub_deletions, true);
$this->req = str_replace("\n", "<br />", $this->req);
}
}
示例2: handle
/**
* handle user request
*/
function handle()
{
if (!isset($_REQUEST['cmd'])) {
return;
// first time - nothing to do
}
if (!checkSecurityToken()) {
return;
}
if (!is_array($_REQUEST['cmd'])) {
return;
}
$crud = plugin_load('helper', 'judge_crud', true);
// verify valid values
switch (key($_REQUEST['cmd'])) {
case 'get':
$this->output = '<div class="table sectionedit1">
<table class="inline">';
$table = $crud->tableRender(array('problem_name' => $_REQUEST['problem_name'], 'type' => $_REQUEST['type'], 'user' => $_REQUEST['user']), "html", 1, "timestamp");
if ($table["count"] == 0) {
$this->output .= '<p>' . $this->getLang("empty_result") . '</p>';
break;
} else {
$this->output .= $table["submissions_table"];
}
$this->output .= "</table></div>";
break;
case 'delete':
$this->output = $crud->delSubmissions(array('problem_name' => $_REQUEST['problem_name'], 'type' => $_REQUEST['type'], 'user' => $_REQUEST['user']));
break;
}
}
示例3: _ajax_call
/**
* Register the events
*
* @param $event DOKU event on ajax call
* @param $param parameters, ignored
*/
function _ajax_call(&$event, $param)
{
if ($event->data !== 'plugin_explorertree') {
return;
}
//no other ajax call handlers needed
$event->stopPropagation();
$event->preventDefault();
//e.g. access additional request variables
global $INPUT;
//available since release 2012-10-13 "Adora Belle"
if (!checkSecurityToken()) {
$data = array('error' => true, 'msg' => 'invalid security token!');
} else {
switch ($INPUT->str('operation')) {
case 'explorertree_branch':
if (!($helper = plugin_load('helper', 'explorertree'))) {
$data = array('error' => true, 'msg' => "Can't load tree helper.");
break;
}
if (!($route = $helper->loadRoute($INPUT->str('route'), $INPUT->arr('loader')))) {
$data = array('error' => true, 'msg' => "Can't load route '" . $INPUT->str('route') . "'!");
}
$data = array('html' => $helper->htmlExplorer($INPUT->str('route'), ltrim(':' . $INPUT->str('itemid')), ':'));
if (!$data['html']) {
$data['error'] = true;
$data['msg'] = "Can't load tree html.";
}
break;
case 'callback':
if (!($helper = plugin_load('helper', 'explorertree'))) {
$data = array('error' => true, 'msg' => "Can't load tree helper.");
break;
}
$route = $helper->loadRoute($INPUT->str('route'), $INPUT->arr('loader'));
if (!$route || !is_callable(@$route['callbacks'][$INPUT->str(event)])) {
$data = array('error' => true, 'msg' => "Can't load callback '" . $INPUT->str('event') . "'for '" . $INPUT->str('route') . "'!");
}
$data = @call_user_func_array($route['callbacks'][$INPUT->str(event)], array($INPUT->str('itemid')));
if (!is_array($data)) {
$data = array('error' => true, 'msg' => "Callback for '" . $INPUT->str('event') . "' does not exists!");
}
break;
default:
$data = array('error' => true, 'msg' => 'Unknown operation: ' . $INPUT->str('operation'));
break;
}
//data
//json library of DokuWiki
}
if (is_array($data)) {
$data['token'] = getSecurityToken();
}
require_once DOKU_INC . 'inc/JSON.php';
$json = new JSON();
//set content type
header('Content-Type: application/json');
echo $json->encode($data);
// $this->get_helper()->check_meta_changes();
}
示例4: handle
function handle()
{
if (!is_array($_REQUEST['d']) || !checkSecurityToken()) {
return;
}
$sqlite = $this->dthlp->_getDB();
if (!$sqlite) {
return false;
}
$sqlite->query("BEGIN TRANSACTION");
if (!$sqlite->query("DELETE FROM aliases")) {
$sqlite->query('ROLLBACK TRANSACTION');
return;
}
foreach ($_REQUEST['d'] as $row) {
$row = array_map('trim', $row);
$row['name'] = utf8_strtolower($row['name']);
$row['name'] = rtrim($row['name'], 's');
if (!$row['name']) {
continue;
}
// Clean enum
$arr = preg_split('/\\s*,\\s*/', $row['enum']);
$arr = array_unique($arr);
asort($arr);
$row['enum'] = implode(', ', $arr);
if (!$sqlite->query("INSERT INTO aliases (name, type, prefix, postfix, enum)\n VALUES (?,?,?,?,?)", $row)) {
$sqlite->query('ROLLBACK TRANSACTION');
return;
}
}
$sqlite->query("COMMIT TRANSACTION");
}
示例5: handle
public function handle()
{
if (isset($_REQUEST['add'])) {
if (!checkSecurityToken()) {
return;
}
$conf = $this->loadCBData();
if (!$conf) {
$conf = array();
}
$type = 0;
if ($_REQUEST["pretag"] != "" && $_REQUEST["posttag"] != "") {
$type = 1;
}
array_push($conf, array("label" => $_REQUEST["label"], "code" => $_REQUEST["code"], "type" => $type, "pretag" => $_REQUEST["pretag"], "posttag" => $_REQUEST["posttag"], "icon" => $_REQUEST["icon"]));
$this->saveCBData($conf);
$this->reloadBar();
} elseif (isset($_REQUEST['delete'])) {
if (!checkSecurityToken()) {
return;
}
$conf = $this->loadCBData();
unset($conf[$_REQUEST["delete"]]);
$this->saveCBData($conf);
$this->reloadBar();
}
}
示例6: handle
/**
* handle user request
*
* Initializes internal vars and handles modifications
*
* @author Andreas Gohr <andi@splitbrain.org>
*/
function handle()
{
global $AUTH_ACL;
global $ID;
global $auth;
// fresh 1:1 copy without replacements
$AUTH_ACL = loadModlist();
// namespace given?
if (empty($_REQUEST['ns']) || $_REQUEST['ns'] == '*') {
$this->ns = '*';
} else {
$this->ns = cleanID($_REQUEST['ns']);
}
// handle modifications
if (isset($_REQUEST['cmd']) && checkSecurityToken()) {
// scope for modifications
if ($this->ns == '*') {
$scope = '*';
} else {
$scope = $this->ns . ':*';
}
if (isset($_REQUEST['cmd']['save']) && $scope && isset($_REQUEST['modgroup'])) {
// handle additions or single modifications
$this->_acl_del($scope);
$this->_acl_add($scope, trim($_REQUEST['modgroup']));
} elseif (isset($_REQUEST['cmd']['del']) && $scope) {
// handle single deletions
$this->_acl_del($scope);
} elseif (isset($_REQUEST['cmd']['update'])) {
// handle update of the whole file
foreach ((array) $_REQUEST['del'] as $where) {
// remove all rules marked for deletion
unset($_REQUEST['acl'][$where]);
}
// prepare lines
$lines = array();
// keep header
foreach ($AUTH_ACL as $line) {
if ($line[0] == '#') {
$lines[] = $line;
} else {
break;
}
}
foreach ((array) $_REQUEST['acl'] as $where => $who) {
$who = $auth->cleanGroup($who);
$who = auth_nameencode($who, true);
$lines[] = "{$where}\t{$who}\n";
}
// save it
io_saveFile(DOKUTRANSLATE_MODLIST, join('', $lines));
}
// reload ACL config
$AUTH_ACL = loadModlist();
}
// initialize ACL array
$this->_init_acl_config();
}
示例7: render
function render($mode, &$renderer, $data)
{
if ($mode != 'xhtml') {
return false;
}
if (isset($_POST['vote']) && checkSecurityToken()) {
$this->_handlepost($data);
}
$this->_html($renderer, $data);
}
示例8: doAction
/**
*
* @param array $form
* @throws Exception
* @return unknown
*/
public function doAction($form)
{
if (!checkSecurityToken($form['sectok'])) {
throw new Exception('bad security token. Refresh your page');
}
if (!auth_isadmin()) {
throw new Exception('you must have AUTH_ADMIN permissions to perform backups');
}
return Backup::createBackupFile($form['dirs'], isset($form['verbose']) ? true : false, $form['archive_format']);
}
示例9: html
/**
* output appropriate html
*/
function html()
{
echo $this->plugin_locale_xhtml('intro');
$this->_searchform();
if (is_array($_REQUEST['revert']) && checkSecurityToken()) {
$this->_revert($_REQUEST['revert'], $_REQUEST['filter']);
} elseif (isset($_REQUEST['filter'])) {
$this->_list($_REQUEST['filter']);
}
}
示例10: handle
/**
* Should carry out any processing required by the plugin.
*/
public function handle()
{
global $INPUT;
global $ID;
global $config_cascade;
$config_file_path = end($config_cascade['main']['local']);
// form submit
$table = Schema::cleanTableName($INPUT->str('table'));
if ($table && $INPUT->bool('save') && checkSecurityToken()) {
$builder = new SchemaBuilder($table, $INPUT->arr('schema'));
if (!$builder->build()) {
msg('something went wrong while saving', -1);
}
touch($config_file_path);
}
// export
if ($table && $INPUT->bool('export')) {
$builder = new Schema($table);
header('Content-Type: application/json');
header("Content-Disposition: attachment; filename={$table}.struct.json");
echo $builder->toJSON();
exit;
}
// import
if ($table && $INPUT->bool('import')) {
if (isset($_FILES['schemafile']['tmp_name'])) {
$json = io_readFile($_FILES['schemafile']['tmp_name'], false);
if (!$json) {
msg('Something went wrong with the upload', -1);
} else {
$builder = new SchemaImporter($table, $json, $INPUT->bool('lookup'));
if (!$builder->build()) {
msg('something went wrong while saving', -1);
}
touch($config_file_path);
}
}
}
// delete
if ($table && $INPUT->bool('delete')) {
if ($table != $INPUT->str('confirm')) {
msg($this->getLang('del_fail'), -1);
} else {
try {
$schema = new Schema($table);
$schema->delete();
msg($this->getLang('del_ok'), 1);
touch($config_file_path);
send_redirect(wl($ID, array('do' => 'admin', 'page' => 'struct_schemas'), true, '&'));
} catch (StructException $e) {
msg(hsc($e->getMessage()), -1);
}
}
}
}
示例11: handle
/**
* handle user request
*/
function handle()
{
if (!isset($_REQUEST['cmd'])) {
return;
}
// first time - nothing to do
$this->output = '';
if (!checkSecurityToken()) {
return;
}
if (!is_array($_REQUEST['cmd'])) {
return;
}
// verify valid values
switch (key($_REQUEST['cmd'])) {
case 'prune':
$this->prune();
break;
case 'confirm':
$this->confirm();
break;
case 'restore':
$this->is_prev_deleted = array();
$this->prev_deleted = "";
if (isset($_REQUEST[subfeed_dir])) {
$this->helper->setSubFeed($_REQUEST['subfeed_dir']);
$this->pagedata = $this->helper->_readFile($this->helper->getMetaFN('pagedata', '.ser'), true);
}
// $this->output=$_REQUEST;
return;
case 'generate':
$this->output = $this->generate($_REQUEST['subfeeds']);
return;
case 'subfeed':
$this->subfeed_selected = $_REQUEST['subfeed_inx'];
if ($this->subfeed_selected > 0) {
$this->subfeed_name = $_REQUEST['subfeeds'];
}
break;
}
$deleted = array();
if (isset($_REQUEST['delete']) && $_REQUEST['delete']) {
$deletes = $_REQUEST['delete'];
$deleted = array_keys($deletes);
}
if ($_REQUEST['prev_del']) {
$prev_deleted = $_REQUEST['prev_del'];
$prev_deleted = explode(',', $prev_deleted);
$prev_deleted = array_merge($prev_deleted, $deleted);
$prev_deleted = array_unique($prev_deleted);
$this->prev_deleted = implode(",", $prev_deleted);
$this->is_prev_deleted = $prev_deleted;
}
// $this->output=$_REQUEST;
}
示例12: handle
/** handle user request */
function handle()
{
$this->formAction = '';
if (!is_array($_REQUEST['formAction'])) {
return;
}
if (!checkSecurityToken()) {
return;
}
$this->formAction = key($_REQUEST['formAction']);
}
示例13: html
/**
* output appropriate html
*/
function html()
{
global $INPUT;
echo $this->locale_xhtml('intro');
$this->_searchform();
if (is_array($INPUT->param('revert')) && checkSecurityToken()) {
$this->_revert($INPUT->arr('revert'), $INPUT->str('filter'));
} elseif ($INPUT->has('filter')) {
$this->_list($INPUT->str('filter'));
}
}
示例14: handle
/**
* Carry out required processing
*/
public function handle()
{
if (!is_array($_REQUEST['up']) || !checkSecurityToken()) {
return;
}
$userdata = $_REQUEST['up']['user'];
// First save the user so it can be created if it doesn't already exist (bullshit, user has to be existing)
//if(!$this->hlp->saveUser($userdata['user'], $userdata['name'], $userdata['email'])) return;
// Then save the profile fields
foreach ($_REQUEST['up']['data'] as $field => $value) {
$this->hlp->saveField($userdata['user'], $field, $value);
}
}
示例15: handle
/**
* Carry out required processing
*/
public function handle()
{
if (!is_array($_REQUEST['up']) || !checkSecurityToken()) {
return;
}
$sqlite = $this->hlp->_getDB();
if (!$sqlite) {
return;
}
$sqlite->query("BEGIN TRANSACTION");
foreach ($_REQUEST['up'] as $row) {
$row = array_map('trim', $row);
$row['name'] = utf8_strtolower($row['name']);
$row['name'] = rtrim($row['name'], 's');
if (!$row['name']) {
continue;
}
// Clean default
$arr = preg_split('/\\s*\\|\\s*/', $row['defaultval']);
$arr = array_unique($arr);
$row['defaultval'] = implode(' | ', $arr);
if ($row['fid']) {
// Check if field should be deleted
if (empty($row['name'])) {
// delete all fieldvals for the current field
if (!$sqlite->query("DELETE FROM fieldvals WHERE [fid] = ?", $row['fid'])) {
$sqlite->query("ROLLBACK TRANSACTION");
return false;
}
// delete the field
$res = $sqlite->query("DELETE FROM fields WHERE [fid] = ?", $row['fid']);
} else {
$res = $sqlite->query("UPDATE fields SET [name] = ?, [title] = ?, [defaultval] = ? WHERE [fid] = ?", array($row['name'], $row['title'], $row['defaultval'], $row['fid']));
}
} else {
$res = $sqlite->query("INSERT INTO fields ([name], [title], [defaultval]) VALUES (?,?,?)", array($row['name'], $row['title'], $row['defaultval']));
}
if (!$res) {
$sqlite->query('ROLLBACK TRANSACTION');
return;
}
}
$sqlite->query("COMMIT TRANSACTION");
}