Commit b3ed9549 authored by theo lem's avatar theo lem
Browse files

Merge branch 'various-fixes' into 'master'

Various fixes

See merge request framasoft/framaforms!68
parents 30b5d729 bd40a695
......@@ -53,7 +53,10 @@ function framaforms_menu () {
* @return void
*/
function framaforms_menu_alter (&$items) {
$items['node/add/form1']['access callback'] = 'framaforms_check_users_forms';
$items['node/add/form1'] = array(
'page callback' => 'framaforms_check_users_forms',
'type' => MENU_CALLBACK,
);
}
/**
......@@ -64,11 +67,11 @@ function framaforms_menu_alter (&$items) {
function framaforms_check_users_forms () {
global $user; // the current user
// if the user is not logged in, deny access
if($user->uid === '0'){
if($user->uid === 0){
return FALSE;
}
// If the user is admin, grant access (admin is master here)
if($user->uid === '1'){
if($user->uid === 1){
return TRUE;
}
// Get the user's total number of forms
......@@ -308,10 +311,6 @@ function framaforms_block_view ($delta) {
);
break;
case 'framaforms_header':
// if the current page is of node type form1, don't display
if(isset($nid) && node_is_form1($nid) && !strpos($current_url, '/edit')){
return;
}
$block['content']['#markup'] = '<h1 class="big-title"><a href="/"><b class="frama">Frama</b><b class="vert">forms</b></a></h1>';
$block['content']['#markup'] .= '<p class="lead">'. variable_get('site_slogan').'</p>';
break;
......@@ -462,6 +461,7 @@ function framaforms_block_view ($delta) {
Vous pouvez cliquer ou glisser-déplacer les éléments de formulaire situés à droite dans la zone de prévisualisation pour construire votre formulaire.<br/>
Par ailleurs, vous pouvez sélectionner les options avancées en utilisant les sous-onglets «Champs conditionnels», «Courriels», «Paramètres du formulaire», etc.</p>
<p>Attention toutefois : il est déconseillé de modifier un formulaire (modifier son titre ou supprimer des champs) une fois que vous aurez obtenu vos premières réponses. Vous risqueriez de perdre des données.</p>
<p>Vous devez insérer au minimum <strong>un champ de formulaire</strong> avant de le valider. Si votre formulaire reste vide, il sera considéré comme un spam potentiel, et vous risquez de perdre votre travail.</p>
");
break;
case 'help_form1_webform_components':
......@@ -504,7 +504,7 @@ function framaforms_preprocess_page(&$vars, $hook) {
'#tag' => 'meta', // The #tag is the html tag -
'#attributes' => array( // Set up an array of attributes inside the tag
'name' => 'viewport',
'content' => 'width=device-width, initial-scale=1.0"',
'content' => 'width=device-width, initial-scale=1.0',
),
);
drupal_add_html_head($meta_element, 'meta-responsive');
......
......@@ -44,9 +44,12 @@ function get_contact_form_content ($nid) {
* @return void
*/
function node_is_form1($nid){
if(!isset($nid)){
return FALSE;
}
$node = node_load($nid);
if(isset($node->type) && $node->type == 'form1'){
return true;
return TRUE;
}
return false;
return FALSE;
}
......@@ -65,8 +65,9 @@ function framaforms_spam_schema(){
}
function framaforms_spam_install () {
$now = new Datetime();
variable_set('framaforms_spam_quarantine_deletion', '1 week'); // default deletion period for possible spam
variable_set('framaforms_spam_cron_last', new DateTime()); // the last framforms cron run
variable_set('framaforms_spam_cron_last', $now->getTimestamp()); // the last framforms cron run
variable_set('framaforms_spam_cron_frequency', '1 hour');
variable_set('framaforms_spam_forbidden_words', 'free, watch, online, movie, pelicula, completa, streaming, 1080, fortnite, tiktok, mulan, poker');
......
......@@ -15,7 +15,7 @@ function framaforms_spam_menu () {
function framaforms_spam_config_form ($form, &$form_state) {
$form['framaforms_spam_forbidden_words'] = array(
'#type' => 'textfield',
'#type' => 'textarea',
'#title' => t('Forbidden words'),
'#default_value' => variable_get('framaforms_spam_forbidden_words'),
'#description' => t('Words that are considered suspicious when found in new form titles. You can separate forms with commas (,).'),
......@@ -121,7 +121,6 @@ function framaforms_spam_node_presave($node) {
*/
function framaforms_spam_form_contains_forbidden_word ($str) {
$forbidden_words = variable_get('framaforms_spam_forbidden_words');
watchdog('framaforms_spam', $forbidden_words);
$regex = '%('
. str_replace(', ', '|', $forbidden_words)
. ')%';
......
......@@ -191,13 +191,9 @@ border-radius: inherit;
}
/* for responsive inputs */
input{
input {
max-width: 100%;
}
img{
width: 100%;
max-width:100%;
}
/* Titres adaptables sur la barre de progression */
/*
......
......@@ -1640,42 +1640,4 @@ div.admin-panel .description {
}
#footer-wrapper .poll .bar .foreground {
background-color: #ddd;
}
/* --------- Modification : responsive table element */
/* ---- Taken from https://css-tricks.com/responsive-data-tables/ */
@media
only screen and (max-width: 1024px),
(min-device-width: 768px) and (max-device-width:1024px) {
/* Force table not to be tables anymore */
table, thread, tbody, th, td, tr {
display: block;
}
/* Hide table headers (but not display: none;, for accessibility) */
thead tr {
position: absolute;
top: -9999px;
left: -9999px;
}
tr { border: 1px solid #ccc; }
td {
/* Behave like a "row" */
border: none;
border-bottom: 1px solid #eee;
position: relative;
padding-left: 50%;
}
/* Make some options disappear in the admin menu of webforms*/
.vertical-tabs{
display: none;
}
.region-sidebar-first{
display: none;
}
}
}
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment