use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Render\Element;
// Create a form element callback function to build the select element.
function custom_select_element_callback(array &$form, FormStateInterface $form_state) {
// Define the select options.
$options = [
'option1' => 'Option 1',
'option2' => 'Option 2',
'option3' => 'Option 3',
];
// Build the select element.
$element = [
'#type' => 'select',
'#title' => t('Select an option'),
'#options' => $options,
'
Drupal
本站已从Drupal 9升级到Drupal 10
https://drupal.stackexchange.com/questions/27965/ajax-callback-change-checked-radio-button
For Drupal 8+:
$inputs = $form_state->getUserInput(); unset($inputs[$item]); $form_state->setUserInput($inputs);
For Drupal 7:
unset($form['input'][$item]);
参考:https://www.drupal.org/node/30334
在Drupal的.htaccess似乎禁用了子目录,在.htaccess里增加以下几行可以允许指定目录被访问:
RewriteEngine on # # stuff to let through (ignore) RewriteCond %{REQUEST_URI} "/folder1/" [OR] RewriteCond %{REQUEST_URI} "/folder2/" RewriteRule (.*) $1 [L]
1. DroopeScan
扫描Drupal版本、安装模块,可找出潜在有漏洞的地方。
git clone https://github.com/droope/droopescan.git cd droopescan pip3 install -r requirements.txt ./droopescan scan zhiwei-tech.com/test/drupal9/
2. Nikto
寻找服务器漏洞。
nikto -h zhiwei-tech.com
3. Sqlmap
检测一个具体的URL有没有SQL注入漏洞,需要结合脚本收集URL集合来测试。
sqlmap -u https://zhiwei-tech.com/?q=search/content/test
4. Commix
后台命令执行漏洞测试。
一家广州做Drupal开发的公司。
1. 管理匿名用户Form页面缓存
use Drupal\Core\Cache\Cache;
// 在匿名用户可以访问的表单里加入下面逻辑,包括列表页面和具体的查看页面
$form['#cache']['tags'] = ['your_custom_tag_name'];
// 在写入逻辑里让缓存失效
Cache::invalidateTags(['your_custom_tag_name']);
2. 禁用匿名用户Form页面缓存
在<module>.routing.yml文件路由定义里增加no_cache: 'TRUE'可禁用缓存
参考school_users_import
- 先安装一个RESTUI模块
- 启用配置好之后可以访问GET接口,例如:http://cto.eguidedog.net/node/241?_format=json
-
POST接口,例如:curl -H "Content-Type: application/json" -X POST -d '{"type":[{"target_id":"braille_printing_application"}],"title":[{"value":"test2"}],"field_address":[{"value":"addr2"}],"field_name":[{"value":"name2"}],"field_phone":[{"value":"phone2"}],"field_zipcode":[{"value":"zipcode2"}]}' http://cto.eguidedog.net/entity/node
热门内容
最新内容
- 10 hours 37 minutes ago
- 2 days 12 hours ago
- 5 days 12 hours ago
- 1 week 1 day ago
- 2 weeks 2 days ago
- 2 weeks 5 days ago
- 2 weeks 5 days ago
- 2 weeks 5 days ago
- 2 weeks 5 days ago
- 2 weeks 6 days ago
最新评论