@@ -32,12 +32,12 @@ discard block |
||
| 32 | 32 | //if (! defined('NOREQUIREDB')) define('NOREQUIREDB','1'); |
| 33 | 33 | //if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1'); |
| 34 | 34 | //if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1'); |
| 35 | -if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL','1'); |
|
| 36 | -if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU','1'); // If there is no menu to show |
|
| 37 | -if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML','1'); // If we don't need to load the html.form.class.php |
|
| 38 | -if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1'); |
|
| 39 | -define("NOLOGIN",1); // This means this output page does not require to be logged. |
|
| 40 | -define("NOCSRFCHECK",1); // We accept to go on this page from external web site. |
|
| 35 | +if (!defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', '1'); |
|
| 36 | +if (!defined('NOREQUIREMENU')) define('NOREQUIREMENU', '1'); // If there is no menu to show |
|
| 37 | +if (!defined('NOREQUIREHTML')) define('NOREQUIREHTML', '1'); // If we don't need to load the html.form.class.php |
|
| 38 | +if (!defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1'); |
|
| 39 | +define("NOLOGIN", 1); // This means this output page does not require to be logged. |
|
| 40 | +define("NOCSRFCHECK", 1); // We accept to go on this page from external web site. |
|
| 41 | 41 | |
| 42 | 42 | // C'est un wrapper, donc header vierge |
| 43 | 43 | /** |
@@ -57,27 +57,27 @@ discard block |
||
| 57 | 57 | require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php'; |
| 58 | 58 | |
| 59 | 59 | // Security check |
| 60 | -if (empty($conf->agenda->enabled)) accessforbidden('',0,0,1); |
|
| 60 | +if (empty($conf->agenda->enabled)) accessforbidden('', 0, 0, 1); |
|
| 61 | 61 | |
| 62 | 62 | // Not older than |
| 63 | -if (! isset($conf->global->MAIN_AGENDA_EXPORT_PAST_DELAY)) $conf->global->MAIN_AGENDA_EXPORT_PAST_DELAY=100; // default limit |
|
| 63 | +if (!isset($conf->global->MAIN_AGENDA_EXPORT_PAST_DELAY)) $conf->global->MAIN_AGENDA_EXPORT_PAST_DELAY = 100; // default limit |
|
| 64 | 64 | |
| 65 | 65 | // Define format, type and filter |
| 66 | -$format='ical'; |
|
| 67 | -$type='event'; |
|
| 68 | -if (GETPOST("format",'alpha')) $format=GETPOST("format",'apha'); |
|
| 69 | -if (GETPOST("type",'apha')) $type=GETPOST("type",'alpha'); |
|
| 70 | - |
|
| 71 | -$filters=array(); |
|
| 72 | -if (GETPOST("year",'int')) $filters['year']=GETPOST("year",'int'); |
|
| 73 | -if (GETPOST("id",'int')) $filters['id']=GETPOST("id",'int'); |
|
| 74 | -if (GETPOST("idfrom",'int')) $filters['idfrom']=GETPOST("idfrom",'int'); |
|
| 75 | -if (GETPOST("idto",'int')) $filters['idto']=GETPOST("idto",'int'); |
|
| 76 | -if (GETPOST("project",'apha')) $filters['project']=GETPOST("project",'apha'); |
|
| 77 | -if (GETPOST("logina",'apha')) $filters['logina']=GETPOST("logina",'apha'); |
|
| 78 | -if (GETPOST("logint",'apha')) $filters['logint']=GETPOST("logint",'apha'); |
|
| 79 | -if (GETPOST("notolderthan",'int')) $filters['notolderthan']=GETPOST("notolderthan","int"); |
|
| 80 | -else $filters['notolderthan']=$conf->global->MAIN_AGENDA_EXPORT_PAST_DELAY; |
|
| 66 | +$format = 'ical'; |
|
| 67 | +$type = 'event'; |
|
| 68 | +if (GETPOST("format", 'alpha')) $format = GETPOST("format", 'apha'); |
|
| 69 | +if (GETPOST("type", 'apha')) $type = GETPOST("type", 'alpha'); |
|
| 70 | + |
|
| 71 | +$filters = array(); |
|
| 72 | +if (GETPOST("year", 'int')) $filters['year'] = GETPOST("year", 'int'); |
|
| 73 | +if (GETPOST("id", 'int')) $filters['id'] = GETPOST("id", 'int'); |
|
| 74 | +if (GETPOST("idfrom", 'int')) $filters['idfrom'] = GETPOST("idfrom", 'int'); |
|
| 75 | +if (GETPOST("idto", 'int')) $filters['idto'] = GETPOST("idto", 'int'); |
|
| 76 | +if (GETPOST("project", 'apha')) $filters['project'] = GETPOST("project", 'apha'); |
|
| 77 | +if (GETPOST("logina", 'apha')) $filters['logina'] = GETPOST("logina", 'apha'); |
|
| 78 | +if (GETPOST("logint", 'apha')) $filters['logint'] = GETPOST("logint", 'apha'); |
|
| 79 | +if (GETPOST("notolderthan", 'int')) $filters['notolderthan'] = GETPOST("notolderthan", "int"); |
|
| 80 | +else $filters['notolderthan'] = $conf->global->MAIN_AGENDA_EXPORT_PAST_DELAY; |
|
| 81 | 81 | |
| 82 | 82 | // Check config |
| 83 | 83 | if (empty($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY)) |
@@ -103,64 +103,64 @@ discard block |
||
| 103 | 103 | |
| 104 | 104 | |
| 105 | 105 | // Define filename with prefix on filters predica (each predica set must have on cache file) |
| 106 | -$shortfilename='dolibarrcalendar'; |
|
| 107 | -$filename=$shortfilename; |
|
| 106 | +$shortfilename = 'dolibarrcalendar'; |
|
| 107 | +$filename = $shortfilename; |
|
| 108 | 108 | // Complete long filename |
| 109 | 109 | foreach ($filters as $key => $value) |
| 110 | 110 | { |
| 111 | 111 | //if ($key == 'notolderthan') $filename.='-notolderthan'.$value; This filter key is already added before and does not need to be in filename |
| 112 | - if ($key == 'year') $filename.='-year'.$value; |
|
| 113 | - if ($key == 'id') $filename.='-id'.$value; |
|
| 114 | - if ($key == 'idfrom') $filename.='-idfrom'.$value; |
|
| 115 | - if ($key == 'idto') $filename.='-idto'.$value; |
|
| 116 | - if ($key == 'project') $filename.='-project'.$value; |
|
| 117 | - if ($key == 'logina') $filename.='-logina'.$value; // Author |
|
| 118 | - if ($key == 'logint') $filename.='-logint'.$value; // Assigned to |
|
| 112 | + if ($key == 'year') $filename .= '-year'.$value; |
|
| 113 | + if ($key == 'id') $filename .= '-id'.$value; |
|
| 114 | + if ($key == 'idfrom') $filename .= '-idfrom'.$value; |
|
| 115 | + if ($key == 'idto') $filename .= '-idto'.$value; |
|
| 116 | + if ($key == 'project') $filename .= '-project'.$value; |
|
| 117 | + if ($key == 'logina') $filename .= '-logina'.$value; // Author |
|
| 118 | + if ($key == 'logint') $filename .= '-logint'.$value; // Assigned to |
|
| 119 | 119 | } |
| 120 | 120 | // Add extension |
| 121 | -if ($format == 'vcal') { $shortfilename.='.vcs'; $filename.='.vcs'; } |
|
| 122 | -if ($format == 'ical') { $shortfilename.='.ics'; $filename.='.ics'; } |
|
| 123 | -if ($format == 'rss') { $shortfilename.='.rss'; $filename.='.rss'; } |
|
| 121 | +if ($format == 'vcal') { $shortfilename .= '.vcs'; $filename .= '.vcs'; } |
|
| 122 | +if ($format == 'ical') { $shortfilename .= '.ics'; $filename .= '.ics'; } |
|
| 123 | +if ($format == 'rss') { $shortfilename .= '.rss'; $filename .= '.rss'; } |
|
| 124 | 124 | |
| 125 | -if ($shortfilename=='dolibarrcalendar') |
|
| 125 | +if ($shortfilename == 'dolibarrcalendar') |
|
| 126 | 126 | { |
| 127 | 127 | $langs->load("main"); |
| 128 | 128 | $langs->load("errors"); |
| 129 | 129 | llxHeaderVierge(); |
| 130 | - print '<div class="error">'.$langs->trans("ErrorWrongValueForParameterX",'format').'</div>'; |
|
| 130 | + print '<div class="error">'.$langs->trans("ErrorWrongValueForParameterX", 'format').'</div>'; |
|
| 131 | 131 | llxFooterVierge(); |
| 132 | 132 | exit; |
| 133 | 133 | } |
| 134 | 134 | |
| 135 | -$agenda=new ActionComm($db); |
|
| 135 | +$agenda = new ActionComm($db); |
|
| 136 | 136 | |
| 137 | -$cachedelay=0; |
|
| 138 | -if (! empty($conf->global->MAIN_AGENDA_EXPORT_CACHE)) $cachedelay=$conf->global->MAIN_AGENDA_EXPORT_CACHE; |
|
| 137 | +$cachedelay = 0; |
|
| 138 | +if (!empty($conf->global->MAIN_AGENDA_EXPORT_CACHE)) $cachedelay = $conf->global->MAIN_AGENDA_EXPORT_CACHE; |
|
| 139 | 139 | |
| 140 | 140 | // Build file |
| 141 | 141 | if ($format == 'ical' || $format == 'vcal') |
| 142 | 142 | { |
| 143 | - $result=$agenda->build_exportfile($format,$type,$cachedelay,$filename,$filters); |
|
| 143 | + $result = $agenda->build_exportfile($format, $type, $cachedelay, $filename, $filters); |
|
| 144 | 144 | if ($result >= 0) |
| 145 | 145 | { |
| 146 | 146 | $attachment = true; |
| 147 | - if (isset($_GET["attachment"])) $attachment=$_GET["attachment"]; |
|
| 147 | + if (isset($_GET["attachment"])) $attachment = $_GET["attachment"]; |
|
| 148 | 148 | //$attachment = false; |
| 149 | - $contenttype='text/calendar'; |
|
| 150 | - if (isset($_GET["contenttype"])) $contenttype=$_GET["contenttype"]; |
|
| 149 | + $contenttype = 'text/calendar'; |
|
| 150 | + if (isset($_GET["contenttype"])) $contenttype = $_GET["contenttype"]; |
|
| 151 | 151 | //$contenttype='text/plain'; |
| 152 | - $outputencoding='UTF-8'; |
|
| 152 | + $outputencoding = 'UTF-8'; |
|
| 153 | 153 | |
| 154 | - if ($contenttype) header('Content-Type: '.$contenttype.($outputencoding?'; charset='.$outputencoding:'')); |
|
| 154 | + if ($contenttype) header('Content-Type: '.$contenttype.($outputencoding ? '; charset='.$outputencoding : '')); |
|
| 155 | 155 | if ($attachment) header('Content-Disposition: attachment; filename="'.$shortfilename.'"'); |
| 156 | 156 | |
| 157 | 157 | if ($cachedelay) header('Cache-Control: max-age='.$cachedelay.', private, must-revalidate'); |
| 158 | 158 | else header('Cache-Control: private, must-revalidate'); |
| 159 | 159 | |
| 160 | 160 | // Clean parameters |
| 161 | - $outputfile=$conf->agenda->dir_temp.'/'.$filename; |
|
| 162 | - $result=readfile($outputfile); |
|
| 163 | - if (! $result) print 'File '.$outputfile.' was empty.'; |
|
| 161 | + $outputfile = $conf->agenda->dir_temp.'/'.$filename; |
|
| 162 | + $result = readfile($outputfile); |
|
| 163 | + if (!$result) print 'File '.$outputfile.' was empty.'; |
|
| 164 | 164 | |
| 165 | 165 | //header("Location: ".DOL_URL_ROOT.'/document.php?modulepart=agenda&file='.urlencode($filename)); |
| 166 | 166 | exit; |
@@ -175,18 +175,18 @@ discard block |
||
| 175 | 175 | |
| 176 | 176 | if ($format == 'rss') |
| 177 | 177 | { |
| 178 | - $result=$agenda->build_exportfile($format,$type,$cachedelay,$filename,$filters); |
|
| 178 | + $result = $agenda->build_exportfile($format, $type, $cachedelay, $filename, $filters); |
|
| 179 | 179 | if ($result >= 0) |
| 180 | 180 | { |
| 181 | 181 | $attachment = false; |
| 182 | - if (isset($_GET["attachment"])) $attachment=$_GET["attachment"]; |
|
| 182 | + if (isset($_GET["attachment"])) $attachment = $_GET["attachment"]; |
|
| 183 | 183 | //$attachment = false; |
| 184 | - $contenttype='application/rss+xml'; |
|
| 185 | - if (isset($_GET["contenttype"])) $contenttype=$_GET["contenttype"]; |
|
| 184 | + $contenttype = 'application/rss+xml'; |
|
| 185 | + if (isset($_GET["contenttype"])) $contenttype = $_GET["contenttype"]; |
|
| 186 | 186 | //$contenttype='text/plain'; |
| 187 | - $outputencoding='UTF-8'; |
|
| 187 | + $outputencoding = 'UTF-8'; |
|
| 188 | 188 | |
| 189 | - if ($contenttype) header('Content-Type: '.$contenttype.($outputencoding?'; charset='.$outputencoding:'')); |
|
| 189 | + if ($contenttype) header('Content-Type: '.$contenttype.($outputencoding ? '; charset='.$outputencoding : '')); |
|
| 190 | 190 | if ($attachment) header('Content-Disposition: attachment; filename="'.$filename.'"'); |
| 191 | 191 | |
| 192 | 192 | // Ajout directives pour resoudre bug IE |
@@ -196,9 +196,9 @@ discard block |
||
| 196 | 196 | else header('Cache-Control: private, must-revalidate'); |
| 197 | 197 | |
| 198 | 198 | // Clean parameters |
| 199 | - $outputfile=$conf->agenda->dir_temp.'/'.$filename; |
|
| 200 | - $result=readfile($outputfile); |
|
| 201 | - if (! $result) print 'File '.$outputfile.' was empty.'; |
|
| 199 | + $outputfile = $conf->agenda->dir_temp.'/'.$filename; |
|
| 200 | + $result = readfile($outputfile); |
|
| 201 | + if (!$result) print 'File '.$outputfile.' was empty.'; |
|
| 202 | 202 | |
| 203 | 203 | // header("Location: ".DOL_URL_ROOT.'/document.php?modulepart=agenda&file='.urlencode($filename)); |
| 204 | 204 | exit; |
@@ -25,11 +25,11 @@ discard block |
||
| 25 | 25 | * \brief Script use to update mail status if destinaries read it (if images during mail read are display) |
| 26 | 26 | */ |
| 27 | 27 | |
| 28 | -if (! defined('NOLOGIN')) define("NOLOGIN",1); // This means this output page does not require to be logged. |
|
| 29 | -if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1'); |
|
| 30 | -if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK','1'); // Do not check anti CSRF attack test |
|
| 31 | -if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL','1'); // Do not check anti POST attack test |
|
| 32 | -if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU','1'); // If there is no need to load and show top and left menu |
|
| 28 | +if (!defined('NOLOGIN')) define("NOLOGIN", 1); // This means this output page does not require to be logged. |
|
| 29 | +if (!defined('NOREQUIRETRAN')) define('NOREQUIRETRAN', '1'); |
|
| 30 | +if (!defined('NOCSRFCHECK')) define('NOCSRFCHECK', '1'); // Do not check anti CSRF attack test |
|
| 31 | +if (!defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', '1'); // Do not check anti POST attack test |
|
| 32 | +if (!defined('NOREQUIREMENU')) define('NOREQUIREMENU', '1'); // If there is no need to load and show top and left menu |
|
| 33 | 33 | |
| 34 | 34 | /** |
| 35 | 35 | * Header empty |
@@ -47,8 +47,8 @@ discard block |
||
| 47 | 47 | |
| 48 | 48 | require '../../main.inc.php'; |
| 49 | 49 | |
| 50 | -$tag=GETPOST('tag'); |
|
| 51 | -$securitykey=GETPOST('securitykey'); |
|
| 50 | +$tag = GETPOST('tag'); |
|
| 51 | +$securitykey = GETPOST('securitykey'); |
|
| 52 | 52 | |
| 53 | 53 | |
| 54 | 54 | /* |
@@ -63,25 +63,25 @@ discard block |
||
| 63 | 63 | exit; |
| 64 | 64 | } |
| 65 | 65 | |
| 66 | -if (! empty($tag)) |
|
| 66 | +if (!empty($tag)) |
|
| 67 | 67 | { |
| 68 | - $statut='2'; |
|
| 68 | + $statut = '2'; |
|
| 69 | 69 | $sql = "UPDATE ".MAIN_DB_PREFIX."mailing_cibles SET statut=".$statut." WHERE tag='".$db->escape($tag)."'"; |
| 70 | 70 | dol_syslog("public/emailing/mailing-read.php : Mail read : ".$sql, LOG_DEBUG); |
| 71 | 71 | |
| 72 | - $resql=$db->query($sql); |
|
| 72 | + $resql = $db->query($sql); |
|
| 73 | 73 | |
| 74 | 74 | //Update status communication of thirdparty prospect |
| 75 | 75 | $sql = "UPDATE ".MAIN_DB_PREFIX."societe SET fk_stcomm=3 WHERE fk_stcomm != -1 AND rowid IN (SELECT source_id FROM ".MAIN_DB_PREFIX."mailing_cibles WHERE tag='".$db->escape($tag)."' AND source_type='thirdparty' AND source_id is not null)"; |
| 76 | 76 | dol_syslog("public/emailing/mailing-read.php : Mail read thirdparty : ".$sql, LOG_DEBUG); |
| 77 | 77 | |
| 78 | - $resql=$db->query($sql); |
|
| 78 | + $resql = $db->query($sql); |
|
| 79 | 79 | |
| 80 | 80 | //Update status communication of contact prospect |
| 81 | 81 | $sql = "UPDATE ".MAIN_DB_PREFIX."societe SET fk_stcomm=3 WHERE fk_stcomm != -1 AND rowid IN (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX."socpeople AS sc INNER JOIN ".MAIN_DB_PREFIX."mailing_cibles AS mc ON mc.tag = '".$db->escape($tag)."' AND mc.source_type = 'contact' AND mc.source_id = sc.rowid)"; |
| 82 | 82 | dol_syslog("public/emailing/mailing-read.php : Mail read contact : ".$sql, LOG_DEBUG); |
| 83 | 83 | |
| 84 | - $resql=$db->query($sql); |
|
| 84 | + $resql = $db->query($sql); |
|
| 85 | 85 | |
| 86 | 86 | } |
| 87 | 87 | |
@@ -26,9 +26,9 @@ discard block |
||
| 26 | 26 | * \brief Script use to update unsubcribe contact to prospect mailing list |
| 27 | 27 | */ |
| 28 | 28 | |
| 29 | -if (! defined('NOLOGIN')) define("NOLOGIN",1); // This means this output page does not require to be logged. |
|
| 30 | -if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK','1'); // Do not check anti CSRF attack test |
|
| 31 | -if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU','1'); // If there is no need to load and show top and left menu |
|
| 29 | +if (!defined('NOLOGIN')) define("NOLOGIN", 1); // This means this output page does not require to be logged. |
|
| 30 | +if (!defined('NOCSRFCHECK')) define('NOCSRFCHECK', '1'); // Do not check anti CSRF attack test |
|
| 31 | +if (!defined('NOREQUIREMENU')) define('NOREQUIREMENU', '1'); // If there is no need to load and show top and left menu |
|
| 32 | 32 | |
| 33 | 33 | /** |
| 34 | 34 | * Header empty |
@@ -52,9 +52,9 @@ discard block |
||
| 52 | 52 | $langs->load("main"); |
| 53 | 53 | $langs->load("mails"); |
| 54 | 54 | |
| 55 | -$tag=GETPOST('tag'); |
|
| 56 | -$unsuscrib=GETPOST('unsuscrib'); |
|
| 57 | -$securitykey=GETPOST('securitykey'); |
|
| 55 | +$tag = GETPOST('tag'); |
|
| 56 | +$unsuscrib = GETPOST('unsuscrib'); |
|
| 57 | +$securitykey = GETPOST('securitykey'); |
|
| 58 | 58 | |
| 59 | 59 | |
| 60 | 60 | /* |
@@ -70,37 +70,37 @@ discard block |
||
| 70 | 70 | } |
| 71 | 71 | |
| 72 | 72 | |
| 73 | -if (! empty($tag) && ($unsuscrib=='1')) |
|
| 73 | +if (!empty($tag) && ($unsuscrib == '1')) |
|
| 74 | 74 | { |
| 75 | 75 | // Update status of mail in recipient mailing list table |
| 76 | - $statut='3'; |
|
| 76 | + $statut = '3'; |
|
| 77 | 77 | $sql = "UPDATE ".MAIN_DB_PREFIX."mailing_cibles SET statut=".$statut." WHERE tag='".$db->escape($tag)."'"; |
| 78 | 78 | dol_syslog("public/emailing/mailing-unsubscribe.php : Mail unsubcribe : ".$sql, LOG_DEBUG); |
| 79 | 79 | |
| 80 | - $resql=$db->query($sql); |
|
| 81 | - if (! $resql) dol_print_error($db); |
|
| 80 | + $resql = $db->query($sql); |
|
| 81 | + if (!$resql) dol_print_error($db); |
|
| 82 | 82 | |
| 83 | 83 | // Update status communication of thirdparty prospect |
| 84 | 84 | $sql = "UPDATE ".MAIN_DB_PREFIX."societe SET fk_stcomm=-1 WHERE rowid IN (SELECT source_id FROM ".MAIN_DB_PREFIX."mailing_cibles WHERE tag='".$db->escape($tag)."' AND source_type='thirdparty' AND source_id is not null)"; |
| 85 | 85 | dol_syslog("public/emailing/mailing-unsubscribe.php : Mail unsubcribe thirdparty : ".$sql, LOG_DEBUG); |
| 86 | 86 | |
| 87 | - $resql=$db->query($sql); |
|
| 88 | - if (! $resql) dol_print_error($db); |
|
| 87 | + $resql = $db->query($sql); |
|
| 88 | + if (!$resql) dol_print_error($db); |
|
| 89 | 89 | |
| 90 | 90 | // Update status communication of contact prospect |
| 91 | 91 | $sql = "UPDATE ".MAIN_DB_PREFIX."socpeople SET no_email=1 WHERE rowid IN (SELECT source_id FROM ".MAIN_DB_PREFIX."mailing_cibles WHERE tag = '".$db->escape($tag)."' AND source_type='contact' AND source_id is not null)"; |
| 92 | 92 | dol_syslog("public/emailing/mailing-unsubscribe.php : Mail unsubcribe contact : ".$sql, LOG_DEBUG); |
| 93 | 93 | |
| 94 | - $resql=$db->query($sql); |
|
| 95 | - if (! $resql) dol_print_error($db); |
|
| 94 | + $resql = $db->query($sql); |
|
| 95 | + if (!$resql) dol_print_error($db); |
|
| 96 | 96 | |
| 97 | 97 | |
| 98 | 98 | $sql = "SELECT mc.email"; |
| 99 | 99 | $sql .= " FROM ".MAIN_DB_PREFIX."mailing_cibles as mc"; |
| 100 | 100 | $sql .= " WHERE mc.tag='".$db->escape($tag)."'"; |
| 101 | 101 | |
| 102 | - $resql=$db->query($sql); |
|
| 103 | - if (! $resql) dol_print_error($db); |
|
| 102 | + $resql = $db->query($sql); |
|
| 103 | + if (!$resql) dol_print_error($db); |
|
| 104 | 104 | |
| 105 | 105 | $obj = $db->fetch_object($resql); |
| 106 | 106 | |
@@ -123,7 +123,7 @@ discard block |
||
| 123 | 123 | print "</head>\n"; |
| 124 | 124 | print '<body style="margin: 20px;">'."\n"; |
| 125 | 125 | print '<table><tr><td style="text_align:center;">'; |
| 126 | - print $langs->trans("YourMailUnsubcribeOK",$obj->email)."<br>\n"; |
|
| 126 | + print $langs->trans("YourMailUnsubcribeOK", $obj->email)."<br>\n"; |
|
| 127 | 127 | print '</td></tr></table>'; |
| 128 | 128 | print "</body>\n"; |
| 129 | 129 | print "</html>\n"; |
@@ -21,7 +21,7 @@ |
||
| 21 | 21 | Sorry. You are not allowed to access this resource. |
| 22 | 22 | |
| 23 | 23 | <br> |
| 24 | - <?php print isset($_SERVER["HTTP_REFERER"])?'You come from '.$_SERVER["HTTP_REFERER"].'.':''; ?> |
|
| 24 | + <?php print isset($_SERVER["HTTP_REFERER"]) ? 'You come from '.$_SERVER["HTTP_REFERER"].'.' : ''; ?> |
|
| 25 | 25 | |
| 26 | 26 | <hr> |
| 27 | 27 | |
@@ -22,8 +22,8 @@ discard block |
||
| 22 | 22 | * \brief Page to list surveys |
| 23 | 23 | */ |
| 24 | 24 | |
| 25 | -define("NOLOGIN",1); // This means this output page does not require to be logged. |
|
| 26 | -define("NOCSRFCHECK",1); // We accept to go on this page from external web site. |
|
| 25 | +define("NOLOGIN", 1); // This means this output page does not require to be logged. |
|
| 26 | +define("NOCSRFCHECK", 1); // We accept to go on this page from external web site. |
|
| 27 | 27 | require_once('../../main.inc.php'); |
| 28 | 28 | require_once(DOL_DOCUMENT_ROOT."/core/lib/admin.lib.php"); |
| 29 | 29 | require_once(DOL_DOCUMENT_ROOT."/core/lib/files.lib.php"); |
@@ -32,23 +32,23 @@ discard block |
||
| 32 | 32 | |
| 33 | 33 | |
| 34 | 34 | // Init vars |
| 35 | -$action=GETPOST('action','aZ09'); |
|
| 35 | +$action = GETPOST('action', 'aZ09'); |
|
| 36 | 36 | $numsondage = ''; |
| 37 | 37 | if (GETPOST('sondage')) |
| 38 | 38 | { |
| 39 | 39 | $numsondage = GETPOST('sondage', 'alpha'); |
| 40 | 40 | } |
| 41 | 41 | |
| 42 | -$object=new Opensurveysondage($db); |
|
| 43 | -$result=$object->fetch(0,$numsondage); |
|
| 42 | +$object = new Opensurveysondage($db); |
|
| 43 | +$result = $object->fetch(0, $numsondage); |
|
| 44 | 44 | |
| 45 | -$nblignes=$object->fetch_lines(); |
|
| 45 | +$nblignes = $object->fetch_lines(); |
|
| 46 | 46 | |
| 47 | 47 | //If the survey has not yet finished, then it can be modified |
| 48 | 48 | $canbemodified = ((empty($object->date_fin) || $object->date_fin > dol_now()) && $object->status != Opensurveysondage::STATUS_CLOSED); |
| 49 | 49 | |
| 50 | 50 | // Security check |
| 51 | -if (empty($conf->opensurvey->enabled)) accessforbidden('',0,0,1); |
|
| 51 | +if (empty($conf->opensurvey->enabled)) accessforbidden('', 0, 0, 1); |
|
| 52 | 52 | |
| 53 | 53 | |
| 54 | 54 | /* |
@@ -57,34 +57,34 @@ discard block |
||
| 57 | 57 | |
| 58 | 58 | $nbcolonnes = substr_count($object->sujet, ',') + 1; |
| 59 | 59 | |
| 60 | -$listofvoters=explode(',',$_SESSION["savevoter"]); |
|
| 60 | +$listofvoters = explode(',', $_SESSION["savevoter"]); |
|
| 61 | 61 | |
| 62 | 62 | // Add comment |
| 63 | 63 | if (GETPOST('ajoutcomment')) |
| 64 | 64 | { |
| 65 | 65 | if (!$canbemodified) accessforbidden(); |
| 66 | 66 | |
| 67 | - $error=0; |
|
| 67 | + $error = 0; |
|
| 68 | 68 | |
| 69 | - if (! GETPOST('comment')) |
|
| 69 | + if (!GETPOST('comment')) |
|
| 70 | 70 | { |
| 71 | 71 | $error++; |
| 72 | 72 | setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Comment")), null, 'errors'); |
| 73 | 73 | } |
| 74 | - if (! GETPOST('commentuser')) |
|
| 74 | + if (!GETPOST('commentuser')) |
|
| 75 | 75 | { |
| 76 | 76 | $error++; |
| 77 | 77 | setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("User")), null, 'errors'); |
| 78 | 78 | } |
| 79 | 79 | |
| 80 | - if (! $error) |
|
| 80 | + if (!$error) |
|
| 81 | 81 | { |
| 82 | 82 | $comment = GETPOST("comment"); |
| 83 | 83 | $comment_user = GETPOST('commentuser'); |
| 84 | 84 | |
| 85 | 85 | $resql = $object->addComment($comment, $comment_user); |
| 86 | 86 | |
| 87 | - if (! $resql) dol_print_error($db); |
|
| 87 | + if (!$resql) dol_print_error($db); |
|
| 88 | 88 | } |
| 89 | 89 | } |
| 90 | 90 | |
@@ -97,29 +97,29 @@ discard block |
||
| 97 | 97 | if (GETPOST('nom')) |
| 98 | 98 | { |
| 99 | 99 | $nouveauchoix = ''; |
| 100 | - for ($i=0;$i<$nbcolonnes;$i++) |
|
| 100 | + for ($i = 0; $i < $nbcolonnes; $i++) |
|
| 101 | 101 | { |
| 102 | 102 | if (isset($_POST["choix$i"]) && $_POST["choix$i"] == '1') |
| 103 | 103 | { |
| 104 | - $nouveauchoix.="1"; |
|
| 104 | + $nouveauchoix .= "1"; |
|
| 105 | 105 | } |
| 106 | 106 | else if (isset($_POST["choix$i"]) && $_POST["choix$i"] == '2') |
| 107 | 107 | { |
| 108 | - $nouveauchoix.="2"; |
|
| 108 | + $nouveauchoix .= "2"; |
|
| 109 | 109 | } |
| 110 | 110 | else { // sinon c'est 0 |
| 111 | - $nouveauchoix.="0"; |
|
| 111 | + $nouveauchoix .= "0"; |
|
| 112 | 112 | } |
| 113 | 113 | } |
| 114 | 114 | |
| 115 | - $nom=substr(GETPOST("nom"),0,64); |
|
| 115 | + $nom = substr(GETPOST("nom"), 0, 64); |
|
| 116 | 116 | |
| 117 | 117 | // Check if vote already exists |
| 118 | 118 | $sql = 'SELECT id_users, nom as name'; |
| 119 | - $sql.= ' FROM '.MAIN_DB_PREFIX.'opensurvey_user_studs'; |
|
| 120 | - $sql.= " WHERE id_sondage='".$db->escape($numsondage)."' AND nom = '".$db->escape($nom)."' ORDER BY id_users"; |
|
| 119 | + $sql .= ' FROM '.MAIN_DB_PREFIX.'opensurvey_user_studs'; |
|
| 120 | + $sql .= " WHERE id_sondage='".$db->escape($numsondage)."' AND nom = '".$db->escape($nom)."' ORDER BY id_users"; |
|
| 121 | 121 | $resql = $db->query($sql); |
| 122 | - if (! $resql) dol_print_error($db); |
|
| 122 | + if (!$resql) dol_print_error($db); |
|
| 123 | 123 | |
| 124 | 124 | $num_rows = $db->num_rows($resql); |
| 125 | 125 | if ($num_rows > 0) |
@@ -130,14 +130,14 @@ discard block |
||
| 130 | 130 | else |
| 131 | 131 | { |
| 132 | 132 | $sql = 'INSERT INTO '.MAIN_DB_PREFIX.'opensurvey_user_studs (nom, id_sondage, reponses)'; |
| 133 | - $sql.= " VALUES ('".$db->escape($nom)."', '".$db->escape($numsondage)."','".$db->escape($nouveauchoix)."')"; |
|
| 134 | - $resql=$db->query($sql); |
|
| 133 | + $sql .= " VALUES ('".$db->escape($nom)."', '".$db->escape($numsondage)."','".$db->escape($nouveauchoix)."')"; |
|
| 134 | + $resql = $db->query($sql); |
|
| 135 | 135 | |
| 136 | 136 | if ($resql) |
| 137 | 137 | { |
| 138 | 138 | // Add voter to session |
| 139 | - $_SESSION["savevoter"]=$nom.','.(empty($_SESSION["savevoter"])?'':$_SESSION["savevoter"]); // Save voter |
|
| 140 | - $listofvoters=explode(',',$_SESSION["savevoter"]); |
|
| 139 | + $_SESSION["savevoter"] = $nom.','.(empty($_SESSION["savevoter"]) ? '' : $_SESSION["savevoter"]); // Save voter |
|
| 140 | + $listofvoters = explode(',', $_SESSION["savevoter"]); |
|
| 141 | 141 | |
| 142 | 142 | if ($object->mailsonde) |
| 143 | 143 | { |
@@ -156,8 +156,8 @@ discard block |
||
| 156 | 156 | |
| 157 | 157 | $body = $langs->trans('EmailSomeoneVoted', $nom, getUrlSondage($numsondage, true)); |
| 158 | 158 | |
| 159 | - $cmailfile=new CMailFile("[".MAIN_APPLICATION_TITLE."] ".$langs->trans("Poll").': '.$object->titre, $email, $conf->global->MAIN_MAIL_EMAIL_FROM, $body); |
|
| 160 | - $result=$cmailfile->sendfile(); |
|
| 159 | + $cmailfile = new CMailFile("[".MAIN_APPLICATION_TITLE."] ".$langs->trans("Poll").': '.$object->titre, $email, $conf->global->MAIN_MAIL_EMAIL_FROM, $body); |
|
| 160 | + $result = $cmailfile->sendfile(); |
|
| 161 | 161 | } |
| 162 | 162 | } |
| 163 | 163 | } |
@@ -175,19 +175,19 @@ discard block |
||
| 175 | 175 | $testmodifier = false; |
| 176 | 176 | $testligneamodifier = false; |
| 177 | 177 | $ligneamodifier = -1; |
| 178 | -for ($i=0; $i<$nblignes; $i++) |
|
| 178 | +for ($i = 0; $i < $nblignes; $i++) |
|
| 179 | 179 | { |
| 180 | 180 | if (isset($_POST['modifierligne'.$i])) |
| 181 | 181 | { |
| 182 | - $ligneamodifier=$i; |
|
| 183 | - $testligneamodifier=true; |
|
| 182 | + $ligneamodifier = $i; |
|
| 183 | + $testligneamodifier = true; |
|
| 184 | 184 | } |
| 185 | 185 | |
| 186 | 186 | //test to see if a line is to be modified |
| 187 | 187 | if (isset($_POST['validermodifier'.$i])) |
| 188 | 188 | { |
| 189 | - $modifier=$i; |
|
| 190 | - $testmodifier=true; |
|
| 189 | + $modifier = $i; |
|
| 190 | + $testmodifier = true; |
|
| 191 | 191 | } |
| 192 | 192 | } |
| 193 | 193 | |
@@ -195,35 +195,35 @@ discard block |
||
| 195 | 195 | { |
| 196 | 196 | //var_dump($_POST);exit; |
| 197 | 197 | $nouveauchoix = ''; |
| 198 | - for ($i=0;$i<$nbcolonnes;$i++) |
|
| 198 | + for ($i = 0; $i < $nbcolonnes; $i++) |
|
| 199 | 199 | { |
| 200 | 200 | //var_dump($_POST["choix$i"]); |
| 201 | 201 | if (isset($_POST["choix".$i]) && $_POST["choix".$i] == '1') |
| 202 | 202 | { |
| 203 | - $nouveauchoix.="1"; |
|
| 203 | + $nouveauchoix .= "1"; |
|
| 204 | 204 | } |
| 205 | 205 | else if (isset($_POST["choix".$i]) && $_POST["choix".$i] == '2') |
| 206 | 206 | { |
| 207 | - $nouveauchoix.="2"; |
|
| 207 | + $nouveauchoix .= "2"; |
|
| 208 | 208 | } |
| 209 | 209 | else { // sinon c'est 0 |
| 210 | - $nouveauchoix.="0"; |
|
| 210 | + $nouveauchoix .= "0"; |
|
| 211 | 211 | } |
| 212 | 212 | } |
| 213 | 213 | |
| 214 | 214 | if (!$canbemodified) accessforbidden(); |
| 215 | 215 | |
| 216 | - $idtomodify=$_POST["idtomodify".$modifier]; |
|
| 216 | + $idtomodify = $_POST["idtomodify".$modifier]; |
|
| 217 | 217 | $sql = 'UPDATE '.MAIN_DB_PREFIX."opensurvey_user_studs"; |
| 218 | - $sql.= " SET reponses = '".$db->escape($nouveauchoix)."'"; |
|
| 219 | - $sql.= " WHERE id_users = '".$db->escape($idtomodify)."'"; |
|
| 218 | + $sql .= " SET reponses = '".$db->escape($nouveauchoix)."'"; |
|
| 219 | + $sql .= " WHERE id_users = '".$db->escape($idtomodify)."'"; |
|
| 220 | 220 | |
| 221 | 221 | $resql = $db->query($sql); |
| 222 | - if (! $resql) dol_print_error($db); |
|
| 222 | + if (!$resql) dol_print_error($db); |
|
| 223 | 223 | } |
| 224 | 224 | |
| 225 | 225 | // Delete comment |
| 226 | -$idcomment=GETPOST('deletecomment','int'); |
|
| 226 | +$idcomment = GETPOST('deletecomment', 'int'); |
|
| 227 | 227 | if ($idcomment) |
| 228 | 228 | { |
| 229 | 229 | if (!$canbemodified) accessforbidden(); |
@@ -237,10 +237,10 @@ discard block |
||
| 237 | 237 | * View |
| 238 | 238 | */ |
| 239 | 239 | |
| 240 | -$form=new Form($db); |
|
| 240 | +$form = new Form($db); |
|
| 241 | 241 | |
| 242 | -$arrayofjs=array(); |
|
| 243 | -$arrayofcss=array('/opensurvey/css/style.css'); |
|
| 242 | +$arrayofjs = array(); |
|
| 243 | +$arrayofcss = array('/opensurvey/css/style.css'); |
|
| 244 | 244 | llxHeaderSurvey($object->titre, "", 0, 0, $arrayofjs, $arrayofcss); |
| 245 | 245 | |
| 246 | 246 | if (empty($object->ref)) // For survey, id is a hex string |
@@ -255,14 +255,14 @@ discard block |
||
| 255 | 255 | } |
| 256 | 256 | |
| 257 | 257 | // Define format of choices |
| 258 | -$toutsujet=explode(",",$object->sujet); |
|
| 259 | -$listofanswers=array(); |
|
| 258 | +$toutsujet = explode(",", $object->sujet); |
|
| 259 | +$listofanswers = array(); |
|
| 260 | 260 | foreach ($toutsujet as $value) |
| 261 | 261 | { |
| 262 | - $tmp=explode('@',$value); |
|
| 263 | - $listofanswers[]=array('label'=>$tmp[0],'format'=>($tmp[1]?$tmp[1]:'checkbox')); |
|
| 262 | + $tmp = explode('@', $value); |
|
| 263 | + $listofanswers[] = array('label'=>$tmp[0], 'format'=>($tmp[1] ? $tmp[1] : 'checkbox')); |
|
| 264 | 264 | } |
| 265 | -$toutsujet=str_replace("°","'",$toutsujet); |
|
| 265 | +$toutsujet = str_replace("°", "'", $toutsujet); |
|
| 266 | 266 | |
| 267 | 267 | |
| 268 | 268 | print '<div class="survey_invitation">'.$langs->trans("YouAreInivitedToVote").'</div>'; |
@@ -271,7 +271,7 @@ discard block |
||
| 271 | 271 | print '<div class="corps"> '."\n"; |
| 272 | 272 | |
| 273 | 273 | //affichage du titre du sondage |
| 274 | -$titre=str_replace("\\","",$object->titre); |
|
| 274 | +$titre = str_replace("\\", "", $object->titre); |
|
| 275 | 275 | print '<strong>'.dol_htmlentities($titre).'</strong><br><br>'."\n"; |
| 276 | 276 | |
| 277 | 277 | //affichage des commentaires du sondage |
@@ -294,7 +294,7 @@ discard block |
||
| 294 | 294 | } |
| 295 | 295 | |
| 296 | 296 | print '<form name="formulaire" action="studs.php?sondage='.$numsondage.'"'.'#bas" method="POST">'."\n"; |
| 297 | -print '<input type="hidden" name="sondage" value="' . $numsondage . '"/>'; |
|
| 297 | +print '<input type="hidden" name="sondage" value="'.$numsondage.'"/>'; |
|
| 298 | 298 | |
| 299 | 299 | print '<div class="cadre"> '."\n"; |
| 300 | 300 | print '<br><br>'."\n"; |
@@ -303,22 +303,22 @@ discard block |
||
| 303 | 303 | print '<table class="resultats">'."\n"; |
| 304 | 304 | |
| 305 | 305 | // Show choice titles |
| 306 | -if ($object->format=="D") |
|
| 306 | +if ($object->format == "D") |
|
| 307 | 307 | { |
| 308 | 308 | //display of survey topics |
| 309 | 309 | print '<tr>'."\n"; |
| 310 | 310 | print '<td></td>'."\n"; |
| 311 | 311 | |
| 312 | 312 | //display of years |
| 313 | - $colspan=1; |
|
| 314 | - $nbofsujet=count($toutsujet); |
|
| 315 | - for ($i=0;$i<$nbofsujet;$i++) |
|
| 313 | + $colspan = 1; |
|
| 314 | + $nbofsujet = count($toutsujet); |
|
| 315 | + for ($i = 0; $i < $nbofsujet; $i++) |
|
| 316 | 316 | { |
| 317 | - if (isset($toutsujet[$i+1]) && date('Y', intval($toutsujet[$i])) == date('Y', intval($toutsujet[$i+1]))) { |
|
| 317 | + if (isset($toutsujet[$i + 1]) && date('Y', intval($toutsujet[$i])) == date('Y', intval($toutsujet[$i + 1]))) { |
|
| 318 | 318 | $colspan++; |
| 319 | 319 | } else { |
| 320 | 320 | print '<td colspan='.$colspan.' class="annee">'.date('Y', intval($toutsujet[$i])).'</td>'."\n"; |
| 321 | - $colspan=1; |
|
| 321 | + $colspan = 1; |
|
| 322 | 322 | } |
| 323 | 323 | } |
| 324 | 324 | |
@@ -327,21 +327,21 @@ discard block |
||
| 327 | 327 | print '<td></td>'."\n"; |
| 328 | 328 | |
| 329 | 329 | //display of months |
| 330 | - $colspan=1; |
|
| 331 | - for ($i=0;$i<$nbofsujet;$i++) { |
|
| 332 | - $cur = intval($toutsujet[$i]); // intval() est utiliser pour supprimer le suffixe @* qui déplaît logiquement à strftime() |
|
| 330 | + $colspan = 1; |
|
| 331 | + for ($i = 0; $i < $nbofsujet; $i++) { |
|
| 332 | + $cur = intval($toutsujet[$i]); // intval() est utiliser pour supprimer le suffixe @* qui déplaît logiquement à strftime() |
|
| 333 | 333 | |
| 334 | - if (isset($toutsujet[$i+1]) === false) { |
|
| 334 | + if (isset($toutsujet[$i + 1]) === false) { |
|
| 335 | 335 | $next = false; |
| 336 | 336 | } else { |
| 337 | - $next = intval($toutsujet[$i+1]); |
|
| 337 | + $next = intval($toutsujet[$i + 1]); |
|
| 338 | 338 | } |
| 339 | 339 | |
| 340 | - if ($next && dol_print_date($cur, "%B") == dol_print_date($next, "%B") && dol_print_date($cur, "%Y") == dol_print_date($next, "%Y")){ |
|
| 340 | + if ($next && dol_print_date($cur, "%B") == dol_print_date($next, "%B") && dol_print_date($cur, "%Y") == dol_print_date($next, "%Y")) { |
|
| 341 | 341 | $colspan++; |
| 342 | 342 | } else { |
| 343 | 343 | print '<td colspan='.$colspan.' class="mois">'.dol_print_date($cur, "%B").'</td>'."\n"; |
| 344 | - $colspan=1; |
|
| 344 | + $colspan = 1; |
|
| 345 | 345 | } |
| 346 | 346 | } |
| 347 | 347 | |
@@ -350,19 +350,19 @@ discard block |
||
| 350 | 350 | print '<td></td>'."\n"; |
| 351 | 351 | |
| 352 | 352 | //display of days |
| 353 | - $colspan=1; |
|
| 354 | - for ($i=0;$i<$nbofsujet;$i++) { |
|
| 353 | + $colspan = 1; |
|
| 354 | + for ($i = 0; $i < $nbofsujet; $i++) { |
|
| 355 | 355 | $cur = intval($toutsujet[$i]); |
| 356 | - if (isset($toutsujet[$i+1]) === false) { |
|
| 356 | + if (isset($toutsujet[$i + 1]) === false) { |
|
| 357 | 357 | $next = false; |
| 358 | 358 | } else { |
| 359 | - $next = intval($toutsujet[$i+1]); |
|
| 359 | + $next = intval($toutsujet[$i + 1]); |
|
| 360 | 360 | } |
| 361 | - if ($next && dol_print_date($cur, "%a %e") == dol_print_date($next,"%a %e") && dol_print_date($cur, "%B") == dol_print_date($next, "%B")) { |
|
| 361 | + if ($next && dol_print_date($cur, "%a %e") == dol_print_date($next, "%a %e") && dol_print_date($cur, "%B") == dol_print_date($next, "%B")) { |
|
| 362 | 362 | $colspan++; |
| 363 | 363 | } else { |
| 364 | 364 | print '<td colspan="'.$colspan.'" class="jour">'.dol_print_date($cur, "%a %e").'</td>'."\n"; |
| 365 | - $colspan=1; |
|
| 365 | + $colspan = 1; |
|
| 366 | 366 | } |
| 367 | 367 | } |
| 368 | 368 | |
@@ -373,8 +373,8 @@ discard block |
||
| 373 | 373 | print '<tr>'."\n"; |
| 374 | 374 | print '<td></td>'."\n"; |
| 375 | 375 | |
| 376 | - for ($i=0; isset($toutsujet[$i]); $i++) { |
|
| 377 | - $heures=explode('@',$toutsujet[$i]); |
|
| 376 | + for ($i = 0; isset($toutsujet[$i]); $i++) { |
|
| 377 | + $heures = explode('@', $toutsujet[$i]); |
|
| 378 | 378 | if (isset($heures[1])) { |
| 379 | 379 | print '<td class="heure">'.dol_htmlentities($heures[1]).'</td>'."\n"; |
| 380 | 380 | } else { |
@@ -391,9 +391,9 @@ discard block |
||
| 391 | 391 | print '<tr>'."\n"; |
| 392 | 392 | print '<td></td>'."\n"; |
| 393 | 393 | |
| 394 | - for ($i=0; isset($toutsujet[$i]); $i++) |
|
| 394 | + for ($i = 0; isset($toutsujet[$i]); $i++) |
|
| 395 | 395 | { |
| 396 | - $tmp=explode('@',$toutsujet[$i]); |
|
| 396 | + $tmp = explode('@', $toutsujet[$i]); |
|
| 397 | 397 | print '<td class="sujet">'.$tmp[0].'</td>'."\n"; |
| 398 | 398 | } |
| 399 | 399 | |
@@ -405,19 +405,19 @@ discard block |
||
| 405 | 405 | $sumfor = array(); |
| 406 | 406 | $sumagainst = array(); |
| 407 | 407 | $compteur = 0; |
| 408 | -$sql ="SELECT id_users, nom as name, id_sondage, reponses"; |
|
| 409 | -$sql.=" FROM ".MAIN_DB_PREFIX."opensurvey_user_studs"; |
|
| 410 | -$sql.=" WHERE id_sondage = '".$db->escape($numsondage)."'"; |
|
| 411 | -$resql=$db->query($sql); |
|
| 412 | -if (! $resql) |
|
| 408 | +$sql = "SELECT id_users, nom as name, id_sondage, reponses"; |
|
| 409 | +$sql .= " FROM ".MAIN_DB_PREFIX."opensurvey_user_studs"; |
|
| 410 | +$sql .= " WHERE id_sondage = '".$db->escape($numsondage)."'"; |
|
| 411 | +$resql = $db->query($sql); |
|
| 412 | +if (!$resql) |
|
| 413 | 413 | { |
| 414 | 414 | dol_print_error($db); |
| 415 | 415 | exit; |
| 416 | 416 | } |
| 417 | -$num=$db->num_rows($resql); |
|
| 417 | +$num = $db->num_rows($resql); |
|
| 418 | 418 | while ($compteur < $num) |
| 419 | 419 | { |
| 420 | - $obj=$db->fetch_object($resql); |
|
| 420 | + $obj = $db->fetch_object($resql); |
|
| 421 | 421 | |
| 422 | 422 | $ensemblereponses = $obj->reponses; |
| 423 | 423 | |
@@ -435,40 +435,40 @@ discard block |
||
| 435 | 435 | print '<td class="nom">'.dol_htmlentities($obj->name).'</td>'."\n"; |
| 436 | 436 | |
| 437 | 437 | // si la ligne n'est pas a changer, on affiche les données |
| 438 | - if (! $testligneamodifier) |
|
| 438 | + if (!$testligneamodifier) |
|
| 439 | 439 | { |
| 440 | 440 | for ($i = 0; $i < $nbcolonnes; $i++) |
| 441 | 441 | { |
| 442 | 442 | $car = substr($ensemblereponses, $i, 1); |
| 443 | 443 | //print 'xx'.$i."-".$car.'-'.$listofanswers[$i]['format'].'zz'; |
| 444 | 444 | |
| 445 | - if (empty($listofanswers[$i]['format']) || ! in_array($listofanswers[$i]['format'],array('yesno','foragainst'))) |
|
| 445 | + if (empty($listofanswers[$i]['format']) || !in_array($listofanswers[$i]['format'], array('yesno', 'foragainst'))) |
|
| 446 | 446 | { |
| 447 | 447 | if (((string) $car) == "1") print '<td class="ok">OK</td>'."\n"; |
| 448 | 448 | else print '<td class="non">KO</td>'."\n"; |
| 449 | 449 | // Total |
| 450 | - if (! isset($sumfor[$i])) $sumfor[$i] = 0; |
|
| 450 | + if (!isset($sumfor[$i])) $sumfor[$i] = 0; |
|
| 451 | 451 | if (((string) $car) == "1") $sumfor[$i]++; |
| 452 | 452 | } |
| 453 | - if (! empty($listofanswers[$i]['format']) && $listofanswers[$i]['format'] == 'yesno') |
|
| 453 | + if (!empty($listofanswers[$i]['format']) && $listofanswers[$i]['format'] == 'yesno') |
|
| 454 | 454 | { |
| 455 | 455 | if (((string) $car) == "1") print '<td class="ok">'.$langs->trans("Yes").'</td>'."\n"; |
| 456 | 456 | else if (((string) $car) == "0") print '<td class="non">'.$langs->trans("No").'</td>'."\n"; |
| 457 | 457 | else print '<td class="vide"> </td>'."\n"; |
| 458 | 458 | // Total |
| 459 | - if (! isset($sumfor[$i])) $sumfor[$i] = 0; |
|
| 460 | - if (! isset($sumagainst[$i])) $sumagainst[$i] = 0; |
|
| 459 | + if (!isset($sumfor[$i])) $sumfor[$i] = 0; |
|
| 460 | + if (!isset($sumagainst[$i])) $sumagainst[$i] = 0; |
|
| 461 | 461 | if (((string) $car) == "1") $sumfor[$i]++; |
| 462 | 462 | if (((string) $car) == "0") $sumagainst[$i]++; |
| 463 | 463 | } |
| 464 | - if (! empty($listofanswers[$i]['format']) && $listofanswers[$i]['format'] == 'foragainst') |
|
| 464 | + if (!empty($listofanswers[$i]['format']) && $listofanswers[$i]['format'] == 'foragainst') |
|
| 465 | 465 | { |
| 466 | 466 | if (((string) $car) == "1") print '<td class="ok">'.$langs->trans("For").'</td>'."\n"; |
| 467 | 467 | else if (((string) $car) == "0") print '<td class="non">'.$langs->trans("Against").'</td>'."\n"; |
| 468 | 468 | else print '<td class="vide"> </td>'."\n"; |
| 469 | 469 | // Total |
| 470 | - if (! isset($sumfor[$i])) $sumfor[$i] = 0; |
|
| 471 | - if (! isset($sumagainst[$i])) $sumagainst[$i] = 0; |
|
| 470 | + if (!isset($sumfor[$i])) $sumfor[$i] = 0; |
|
| 471 | + if (!isset($sumagainst[$i])) $sumagainst[$i] = 0; |
|
| 472 | 472 | if (((string) $car) == "1") $sumfor[$i]++; |
| 473 | 473 | if (((string) $car) == "0") $sumagainst[$i]++; |
| 474 | 474 | } |
@@ -483,20 +483,20 @@ discard block |
||
| 483 | 483 | { |
| 484 | 484 | $car = substr($ensemblereponses, $i, 1); |
| 485 | 485 | print '<td class="vide">'; |
| 486 | - if (empty($listofanswers[$i]['format']) || ! in_array($listofanswers[$i]['format'],array('yesno','foragainst'))) |
|
| 486 | + if (empty($listofanswers[$i]['format']) || !in_array($listofanswers[$i]['format'], array('yesno', 'foragainst'))) |
|
| 487 | 487 | { |
| 488 | 488 | print '<input type="checkbox" name="choix'.$i.'" value="1" '; |
| 489 | 489 | if ($car == '1') print 'checked'; |
| 490 | 490 | print '>'; |
| 491 | 491 | } |
| 492 | - if (! empty($listofanswers[$i]['format']) && $listofanswers[$i]['format'] == 'yesno') |
|
| 492 | + if (!empty($listofanswers[$i]['format']) && $listofanswers[$i]['format'] == 'yesno') |
|
| 493 | 493 | { |
| 494 | - $arraychoice=array('2'=>' ','0'=>$langs->trans("No"),'1'=>$langs->trans("Yes")); |
|
| 494 | + $arraychoice = array('2'=>' ', '0'=>$langs->trans("No"), '1'=>$langs->trans("Yes")); |
|
| 495 | 495 | print $form->selectarray("choix".$i, $arraychoice, $car); |
| 496 | 496 | } |
| 497 | - if (! empty($listofanswers[$i]['format']) && $listofanswers[$i]['format'] == 'foragainst') |
|
| 497 | + if (!empty($listofanswers[$i]['format']) && $listofanswers[$i]['format'] == 'foragainst') |
|
| 498 | 498 | { |
| 499 | - $arraychoice=array('2'=>' ','0'=>$langs->trans("Against"),'1'=>$langs->trans("For")); |
|
| 499 | + $arraychoice = array('2'=>' ', '0'=>$langs->trans("Against"), '1'=>$langs->trans("For")); |
|
| 500 | 500 | print $form->selectarray("choix".$i, $arraychoice, $car); |
| 501 | 501 | } |
| 502 | 502 | print '</td>'."\n"; |
@@ -507,33 +507,33 @@ discard block |
||
| 507 | 507 | for ($i = 0; $i < $nbcolonnes; $i++) |
| 508 | 508 | { |
| 509 | 509 | $car = substr($ensemblereponses, $i, 1); |
| 510 | - if (empty($listofanswers[$i]['format']) || ! in_array($listofanswers[$i]['format'],array('yesno','foragainst'))) |
|
| 510 | + if (empty($listofanswers[$i]['format']) || !in_array($listofanswers[$i]['format'], array('yesno', 'foragainst'))) |
|
| 511 | 511 | { |
| 512 | 512 | if (((string) $car) == "1") print '<td class="ok">OK</td>'."\n"; |
| 513 | 513 | else print '<td class="non">KO</td>'."\n"; |
| 514 | 514 | // Total |
| 515 | - if (! isset($sumfor[$i])) $sumfor[$i] = 0; |
|
| 515 | + if (!isset($sumfor[$i])) $sumfor[$i] = 0; |
|
| 516 | 516 | if (((string) $car) == "1") $sumfor[$i]++; |
| 517 | 517 | } |
| 518 | - if (! empty($listofanswers[$i]['format']) && $listofanswers[$i]['format'] == 'yesno') |
|
| 518 | + if (!empty($listofanswers[$i]['format']) && $listofanswers[$i]['format'] == 'yesno') |
|
| 519 | 519 | { |
| 520 | 520 | if (((string) $car) == "1") print '<td class="ok">'.$langs->trans("For").'</td>'."\n"; |
| 521 | 521 | else if (((string) $car) == "0") print '<td class="non">'.$langs->trans("Against").'</td>'."\n"; |
| 522 | 522 | else print '<td class="vide"> </td>'."\n"; |
| 523 | 523 | // Total |
| 524 | - if (! isset($sumfor[$i])) $sumfor[$i] = 0; |
|
| 525 | - if (! isset($sumagainst[$i])) $sumagainst[$i] = 0; |
|
| 524 | + if (!isset($sumfor[$i])) $sumfor[$i] = 0; |
|
| 525 | + if (!isset($sumagainst[$i])) $sumagainst[$i] = 0; |
|
| 526 | 526 | if (((string) $car) == "1") $sumfor[$i]++; |
| 527 | 527 | if (((string) $car) == "0") $sumagainst[$i]++; |
| 528 | 528 | } |
| 529 | - if (! empty($listofanswers[$i]['format']) && $listofanswers[$i]['format'] == 'foragainst') |
|
| 529 | + if (!empty($listofanswers[$i]['format']) && $listofanswers[$i]['format'] == 'foragainst') |
|
| 530 | 530 | { |
| 531 | 531 | if (((string) $car) == "1") print '<td class="ok">'.$langs->trans("For").'</td>'."\n"; |
| 532 | 532 | else if (((string) $car) == "0") print '<td class="non">'.$langs->trans("Against").'</td>'."\n"; |
| 533 | 533 | else print '<td class="vide"> </td>'."\n"; |
| 534 | 534 | // Total |
| 535 | - if (! isset($sumfor[$i])) $sumfor[$i] = 0; |
|
| 536 | - if (! isset($sumagainst[$i])) $sumagainst[$i] = 0; |
|
| 535 | + if (!isset($sumfor[$i])) $sumfor[$i] = 0; |
|
| 536 | + if (!isset($sumagainst[$i])) $sumagainst[$i] = 0; |
|
| 537 | 537 | if (((string) $car) == "1") $sumfor[$i]++; |
| 538 | 538 | if (((string) $car) == "0") $sumagainst[$i]++; |
| 539 | 539 | } |
@@ -548,7 +548,7 @@ discard block |
||
| 548 | 548 | } |
| 549 | 549 | |
| 550 | 550 | //demande de confirmation pour modification de ligne |
| 551 | - for ($i=0; $i<$nblignes; $i++) |
|
| 551 | + for ($i = 0; $i < $nblignes; $i++) |
|
| 552 | 552 | { |
| 553 | 553 | if (isset($_POST["modifierligne".$i])) |
| 554 | 554 | { |
@@ -567,7 +567,7 @@ discard block |
||
| 567 | 567 | } |
| 568 | 568 | |
| 569 | 569 | // Add line to add new record |
| 570 | -if ($ligneamodifier < 0 && (! isset($_SESSION['nom']))) |
|
| 570 | +if ($ligneamodifier < 0 && (!isset($_SESSION['nom']))) |
|
| 571 | 571 | { |
| 572 | 572 | print '<tr>'."\n"; |
| 573 | 573 | print '<td class="nom">'."\n"; |
@@ -580,10 +580,10 @@ discard block |
||
| 580 | 580 | print '</td>'."\n"; |
| 581 | 581 | |
| 582 | 582 | // affichage des cases de formulaire checkbox pour un nouveau choix |
| 583 | - for ($i=0;$i<$nbcolonnes;$i++) |
|
| 583 | + for ($i = 0; $i < $nbcolonnes; $i++) |
|
| 584 | 584 | { |
| 585 | 585 | print '<td class="vide">'; |
| 586 | - if (empty($listofanswers[$i]['format']) || ! in_array($listofanswers[$i]['format'],array('yesno','foragainst'))) |
|
| 586 | + if (empty($listofanswers[$i]['format']) || !in_array($listofanswers[$i]['format'], array('yesno', 'foragainst'))) |
|
| 587 | 587 | { |
| 588 | 588 | print '<input type="checkbox" name="choix'.$i.'" value="1"'; |
| 589 | 589 | if (isset($_POST['choix'.$i]) && $_POST['choix'.$i] == '1') |
@@ -592,29 +592,29 @@ discard block |
||
| 592 | 592 | } |
| 593 | 593 | print '>'; |
| 594 | 594 | } |
| 595 | - if (! empty($listofanswers[$i]['format']) && $listofanswers[$i]['format'] == 'yesno') |
|
| 595 | + if (!empty($listofanswers[$i]['format']) && $listofanswers[$i]['format'] == 'yesno') |
|
| 596 | 596 | { |
| 597 | - $arraychoice=array('2'=>' ','0'=>$langs->trans("No"),'1'=>$langs->trans("Yes")); |
|
| 597 | + $arraychoice = array('2'=>' ', '0'=>$langs->trans("No"), '1'=>$langs->trans("Yes")); |
|
| 598 | 598 | print $form->selectarray("choix".$i, $arraychoice, GETPOST('choix'.$i)); |
| 599 | 599 | } |
| 600 | - if (! empty($listofanswers[$i]['format']) && $listofanswers[$i]['format'] == 'foragainst') |
|
| 600 | + if (!empty($listofanswers[$i]['format']) && $listofanswers[$i]['format'] == 'foragainst') |
|
| 601 | 601 | { |
| 602 | - $arraychoice=array('2'=>' ','0'=>$langs->trans("Against"),'1'=>$langs->trans("For")); |
|
| 602 | + $arraychoice = array('2'=>' ', '0'=>$langs->trans("Against"), '1'=>$langs->trans("For")); |
|
| 603 | 603 | print $form->selectarray("choix".$i, $arraychoice, GETPOST('choix'.$i)); |
| 604 | 604 | } |
| 605 | 605 | print '</td>'."\n"; |
| 606 | 606 | } |
| 607 | 607 | |
| 608 | 608 | // Affichage du bouton de formulaire pour inscrire un nouvel utilisateur dans la base |
| 609 | - print '<td><input type="image" name="boutonp" value="'.$langs->trans("Vote").'" src="'.dol_buildpath('/opensurvey/img/add-24.png',1).'"></td>'."\n"; |
|
| 609 | + print '<td><input type="image" name="boutonp" value="'.$langs->trans("Vote").'" src="'.dol_buildpath('/opensurvey/img/add-24.png', 1).'"></td>'."\n"; |
|
| 610 | 610 | print '</tr>'."\n"; |
| 611 | 611 | } |
| 612 | 612 | |
| 613 | 613 | // Select value of best choice (for checkbox columns only) |
| 614 | -$nbofcheckbox=0; |
|
| 615 | -for ($i=0; $i < $nbcolonnes; $i++) |
|
| 614 | +$nbofcheckbox = 0; |
|
| 615 | +for ($i = 0; $i < $nbcolonnes; $i++) |
|
| 616 | 616 | { |
| 617 | - if (empty($listofanswers[$i]['format']) || ! in_array($listofanswers[$i]['format'],array('yesno','foragainst'))) |
|
| 617 | + if (empty($listofanswers[$i]['format']) || !in_array($listofanswers[$i]['format'], array('yesno', 'foragainst'))) |
|
| 618 | 618 | $nbofcheckbox++; |
| 619 | 619 | if (isset($sumfor[$i])) |
| 620 | 620 | { |
@@ -622,7 +622,7 @@ discard block |
||
| 622 | 622 | { |
| 623 | 623 | $meilleurecolonne = $sumfor[$i]; |
| 624 | 624 | } |
| 625 | - if (! isset($meilleurecolonne) || $sumfor[$i] > $meilleurecolonne) |
|
| 625 | + if (!isset($meilleurecolonne) || $sumfor[$i] > $meilleurecolonne) |
|
| 626 | 626 | { |
| 627 | 627 | $meilleurecolonne = $sumfor[$i]; |
| 628 | 628 | } |
@@ -632,18 +632,18 @@ discard block |
||
| 632 | 632 | if ($object->allow_spy) { |
| 633 | 633 | // Show line total |
| 634 | 634 | print '<tr>'."\n"; |
| 635 | - print '<td align="center">'. $langs->trans("Total") .'</td>'."\n"; |
|
| 635 | + print '<td align="center">'.$langs->trans("Total").'</td>'."\n"; |
|
| 636 | 636 | for ($i = 0; $i < $nbcolonnes; $i++) |
| 637 | 637 | { |
| 638 | - $showsumfor = isset($sumfor[$i])?$sumfor[$i]:''; |
|
| 639 | - $showsumagainst = isset($sumagainst[$i])?$sumagainst[$i]:''; |
|
| 638 | + $showsumfor = isset($sumfor[$i]) ? $sumfor[$i] : ''; |
|
| 639 | + $showsumagainst = isset($sumagainst[$i]) ? $sumagainst[$i] : ''; |
|
| 640 | 640 | if (empty($showsumfor)) $showsumfor = 0; |
| 641 | 641 | if (empty($showsumagainst)) $showsumagainst = 0; |
| 642 | 642 | |
| 643 | 643 | print '<td>'; |
| 644 | - if (empty($listofanswers[$i]['format']) || ! in_array($listofanswers[$i]['format'],array('yesno','foragainst'))) print $showsumfor; |
|
| 645 | - if (! empty($listofanswers[$i]['format']) && $listofanswers[$i]['format'] == 'yesno') print $langs->trans("Yes").': '.$showsumfor.'<br>'.$langs->trans("No").': '.$showsumagainst; |
|
| 646 | - if (! empty($listofanswers[$i]['format']) && $listofanswers[$i]['format'] == 'foragainst') print $langs->trans("For").': '.$showsumfor.'<br>'.$langs->trans("Against").': '.$showsumagainst; |
|
| 644 | + if (empty($listofanswers[$i]['format']) || !in_array($listofanswers[$i]['format'], array('yesno', 'foragainst'))) print $showsumfor; |
|
| 645 | + if (!empty($listofanswers[$i]['format']) && $listofanswers[$i]['format'] == 'yesno') print $langs->trans("Yes").': '.$showsumfor.'<br>'.$langs->trans("No").': '.$showsumagainst; |
|
| 646 | + if (!empty($listofanswers[$i]['format']) && $listofanswers[$i]['format'] == 'foragainst') print $langs->trans("For").': '.$showsumfor.'<br>'.$langs->trans("Against").': '.$showsumagainst; |
|
| 647 | 647 | print '</td>'."\n"; |
| 648 | 648 | } |
| 649 | 649 | print '</tr>'; |
@@ -652,12 +652,12 @@ discard block |
||
| 652 | 652 | { |
| 653 | 653 | print '<tr>'."\n"; |
| 654 | 654 | print '<td class="somme"></td>'."\n"; |
| 655 | - for ($i=0; $i < $nbcolonnes; $i++) |
|
| 655 | + for ($i = 0; $i < $nbcolonnes; $i++) |
|
| 656 | 656 | { |
| 657 | 657 | //print 'xx'.(! empty($listofanswers[$i]['format'])).'-'.$sumfor[$i].'-'.$meilleurecolonne; |
| 658 | - if (empty($listofanswers[$i]['format']) || ! in_array($listofanswers[$i]['format'],array('yesno','foragainst')) && isset($sumfor[$i]) && isset($meilleurecolonne) && $sumfor[$i] == $meilleurecolonne) |
|
| 658 | + if (empty($listofanswers[$i]['format']) || !in_array($listofanswers[$i]['format'], array('yesno', 'foragainst')) && isset($sumfor[$i]) && isset($meilleurecolonne) && $sumfor[$i] == $meilleurecolonne) |
|
| 659 | 659 | { |
| 660 | - print '<td class="somme"><img src="'.dol_buildpath('/opensurvey/img/medaille.png',1).'"></td>'."\n"; |
|
| 660 | + print '<td class="somme"><img src="'.dol_buildpath('/opensurvey/img/medaille.png', 1).'"></td>'."\n"; |
|
| 661 | 661 | } else { |
| 662 | 662 | print '<td class="somme"></td>'."\n"; |
| 663 | 663 | } |
@@ -669,28 +669,28 @@ discard block |
||
| 669 | 669 | print '</div>'."\n"; |
| 670 | 670 | |
| 671 | 671 | if ($object->allow_spy) { |
| 672 | - $toutsujet=explode(",",$object->sujet); |
|
| 673 | - $toutsujet=str_replace("°","'",$toutsujet); |
|
| 672 | + $toutsujet = explode(",", $object->sujet); |
|
| 673 | + $toutsujet = str_replace("°", "'", $toutsujet); |
|
| 674 | 674 | |
| 675 | - $compteursujet=0; |
|
| 675 | + $compteursujet = 0; |
|
| 676 | 676 | $meilleursujet = ''; |
| 677 | 677 | |
| 678 | 678 | for ($i = 0; $i < $nbcolonnes; $i++) { |
| 679 | 679 | if (isset($sumfor[$i]) && isset($meilleurecolonne) && $sumfor[$i] == $meilleurecolonne) { |
| 680 | - $meilleursujet.=", "; |
|
| 681 | - if ($object->format=="D") { |
|
| 680 | + $meilleursujet .= ", "; |
|
| 681 | + if ($object->format == "D") { |
|
| 682 | 682 | $meilleursujetexport = $toutsujet[$i]; |
| 683 | 683 | |
| 684 | 684 | if (strpos($toutsujet[$i], '@') !== false) { |
| 685 | 685 | $toutsujetdate = explode("@", $toutsujet[$i]); |
| 686 | - $meilleursujet .= dol_print_date($toutsujetdate[0],'daytext'). ' ('.dol_print_date($toutsujetdate[0],'%A').')' . ' - ' . $toutsujetdate[1]; |
|
| 686 | + $meilleursujet .= dol_print_date($toutsujetdate[0], 'daytext').' ('.dol_print_date($toutsujetdate[0], '%A').')'.' - '.$toutsujetdate[1]; |
|
| 687 | 687 | } else { |
| 688 | - $meilleursujet .= dol_print_date($toutsujet[$i],'daytext'). ' ('.dol_print_date($toutsujet[$i],'%A').')'; |
|
| 688 | + $meilleursujet .= dol_print_date($toutsujet[$i], 'daytext').' ('.dol_print_date($toutsujet[$i], '%A').')'; |
|
| 689 | 689 | } |
| 690 | 690 | } |
| 691 | 691 | else |
| 692 | 692 | { |
| 693 | - $tmps=explode('@',$toutsujet[$i]); |
|
| 693 | + $tmps = explode('@', $toutsujet[$i]); |
|
| 694 | 694 | $meilleursujet .= dol_htmlentities($tmps[0]); |
| 695 | 695 | } |
| 696 | 696 | |
@@ -698,7 +698,7 @@ discard block |
||
| 698 | 698 | } |
| 699 | 699 | } |
| 700 | 700 | |
| 701 | - $meilleursujet=substr("$meilleursujet", 1); |
|
| 701 | + $meilleursujet = substr("$meilleursujet", 1); |
|
| 702 | 702 | $meilleursujet = str_replace("°", "'", $meilleursujet); |
| 703 | 703 | |
| 704 | 704 | |
@@ -709,9 +709,9 @@ discard block |
||
| 709 | 709 | print '<p class="affichageresultats">'."\n"; |
| 710 | 710 | |
| 711 | 711 | if (isset($meilleurecolonne) && $compteursujet == "1") { |
| 712 | - print '<img src="'.dol_buildpath('/opensurvey/img/medaille.png',1).'"> ' . $langs->trans('TheBestChoice') . ": <b>".$meilleursujet."</b> " . $langs->trans('with') . " <b>$meilleurecolonne </b>" . $vote_str . ".\n"; |
|
| 712 | + print '<img src="'.dol_buildpath('/opensurvey/img/medaille.png', 1).'"> '.$langs->trans('TheBestChoice').": <b>".$meilleursujet."</b> ".$langs->trans('with')." <b>$meilleurecolonne </b>".$vote_str.".\n"; |
|
| 713 | 713 | } elseif (isset($meilleurecolonne)) { |
| 714 | - print '<img src="'.dol_buildpath('/opensurvey/img/medaille.png',1).'"> ' . $langs->trans('TheBestChoices') . ": <b>".$meilleursujet."</b> " . $langs->trans('with') . " <b>$meilleurecolonne </b>" . $vote_str . ".\n"; |
|
| 714 | + print '<img src="'.dol_buildpath('/opensurvey/img/medaille.png', 1).'"> '.$langs->trans('TheBestChoices').": <b>".$meilleursujet."</b> ".$langs->trans('with')." <b>$meilleurecolonne </b>".$vote_str.".\n"; |
|
| 715 | 715 | } |
| 716 | 716 | |
| 717 | 717 | print '</p><br>'."\n"; |
@@ -726,7 +726,7 @@ discard block |
||
| 726 | 726 | |
| 727 | 727 | if ($comments) |
| 728 | 728 | { |
| 729 | - print "<br><b>" . $langs->trans("CommentsOfVoters") . ":</b><br>\n"; |
|
| 729 | + print "<br><b>".$langs->trans("CommentsOfVoters").":</b><br>\n"; |
|
| 730 | 730 | |
| 731 | 731 | foreach ($comments as $obj) { |
| 732 | 732 | print '<div class="comment"><span class="usercomment">'; |
@@ -737,15 +737,15 @@ discard block |
||
| 737 | 737 | |
| 738 | 738 | // Form to add comment |
| 739 | 739 | if ($object->allow_comments) { |
| 740 | - print '<div class="addcomment">' .$langs->trans("AddACommentForPoll") . "<br>\n"; |
|
| 740 | + print '<div class="addcomment">'.$langs->trans("AddACommentForPoll")."<br>\n"; |
|
| 741 | 741 | |
| 742 | 742 | print '<textarea name="comment" rows="'.ROWS_2.'" class="quatrevingtpercent"></textarea><br>'."\n"; |
| 743 | - print $langs->trans("Name") .': '; |
|
| 743 | + print $langs->trans("Name").': '; |
|
| 744 | 744 | print '<input type="text" name="commentuser" maxlength="64" /> '."\n"; |
| 745 | 745 | print '<input type="submit" class="button" name="ajoutcomment" value="'.dol_escape_htmltag($langs->trans("AddComment")).'"><br>'."\n"; |
| 746 | 746 | print '</form>'."\n"; |
| 747 | 747 | |
| 748 | - print '</div>'."\n"; // div add comment |
|
| 748 | + print '</div>'."\n"; // div add comment |
|
| 749 | 749 | } |
| 750 | 750 | |
| 751 | 751 | print '<br><br>'; |
@@ -21,7 +21,7 @@ |
||
| 21 | 21 | You requested a website or a page that does not exists. |
| 22 | 22 | |
| 23 | 23 | <br> |
| 24 | - <?php print isset($_SERVER["HTTP_REFERER"])?'You come from '.$_SERVER["HTTP_REFERER"].'.':''; ?> |
|
| 24 | + <?php print isset($_SERVER["HTTP_REFERER"]) ? 'You come from '.$_SERVER["HTTP_REFERER"].'.' : ''; ?> |
|
| 25 | 25 | |
| 26 | 26 | <hr> |
| 27 | 27 | |
@@ -1,7 +1,7 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | //define("NOLOGIN",1); // This means this output page does not require to be logged. |
| 3 | -define("NOCSRFCHECK",1); // We accept to go on this page from external web site. |
|
| 4 | -define('REQUIRE_JQUERY_MULTISELECT','select2'); |
|
| 3 | +define("NOCSRFCHECK", 1); // We accept to go on this page from external web site. |
|
| 4 | +define('REQUIRE_JQUERY_MULTISELECT', 'select2'); |
|
| 5 | 5 | |
| 6 | 6 | require '../../main.inc.php'; |
| 7 | 7 | include_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; |
@@ -25,12 +25,12 @@ discard block |
||
| 25 | 25 | |
| 26 | 26 | <!-- Output to test html.form.class.php --> |
| 27 | 27 | <?php |
| 28 | -$form=new Form($db); |
|
| 28 | +$form = new Form($db); |
|
| 29 | 29 | |
| 30 | 30 | // Test1: form->select_date using tzuser date |
| 31 | 31 | print "Test 1: We must have here current hour for user (must match hour on browser). Note: Check your are logged so user TZ and DST are known."; |
| 32 | -$offsettz=(empty($_SESSION['dol_tz'])?0:$_SESSION['dol_tz'])*60*60; |
|
| 33 | -$offsetdst=(empty($_SESSION['dol_dst'])?0:$_SESSION['dol_dst'])*60*60; |
|
| 32 | +$offsettz = (empty($_SESSION['dol_tz']) ? 0 : $_SESSION['dol_tz']) * 60 * 60; |
|
| 33 | +$offsetdst = (empty($_SESSION['dol_dst']) ? 0 : $_SESSION['dol_dst']) * 60 * 60; |
|
| 34 | 34 | print " (dol_tz=".$offsettz." dol_dst=".$dol_dst.")<br>\n"; |
| 35 | 35 | $form->select_date('', 'test1', 1, 1, 0); |
| 36 | 36 | |
@@ -38,55 +38,55 @@ discard block |
||
| 38 | 38 | |
| 39 | 39 | // Test2: form->select_date using tzuser date |
| 40 | 40 | print "Test 2: We must have here 1970-01-01 00:00:00 selected (fields can be empty)<br>\n"; |
| 41 | -$form->select_date(dol_get_first_day(1970,1,false), 'test2', 1, 1, 1); |
|
| 41 | +$form->select_date(dol_get_first_day(1970, 1, false), 'test2', 1, 1, 1); |
|
| 42 | 42 | |
| 43 | 43 | print '<br><br>'."\n"; |
| 44 | 44 | |
| 45 | 45 | // Test3: form->select_date for 1970-01-01 00:00:00 |
| 46 | 46 | print "Test 3: We must have here 1970-01-01 00:00:00 selected (fields are mandatory)<br>\n"; |
| 47 | -$form->select_date(dol_get_first_day(1970,1,false), 'test3', 1, 1, 0); |
|
| 47 | +$form->select_date(dol_get_first_day(1970, 1, false), 'test3', 1, 1, 0); |
|
| 48 | 48 | |
| 49 | 49 | print '<br><br>'."\n"; |
| 50 | 50 | |
| 51 | 51 | // Test4a: a select |
| 52 | 52 | print "Test 4a: a select<br>\n"; |
| 53 | -$array=array(1=>'Value 1',2=>'Value 2',3=>'Value 3 ith a very long text. aze eazeae e ae aeae a e a ea ea ea e a e aea e ae aeaeaeaze.'); |
|
| 54 | -$selected=3; |
|
| 53 | +$array = array(1=>'Value 1', 2=>'Value 2', 3=>'Value 3 ith a very long text. aze eazeae e ae aeae a e a ea ea ea e a e aea e ae aeaeaeaze.'); |
|
| 54 | +$selected = 3; |
|
| 55 | 55 | print $form->selectarray('testselecta', $array, $selected, 1, 0, 0, 'style="min-width: 250px;"', 0, 0, 0, '', '', 1); |
| 56 | 56 | print '<br><br>'; |
| 57 | 57 | print "Test 4b: a select<br>\n"; |
| 58 | -$array=array(1=>'Value 1',2=>'Value 2',3=>'Value 3'); |
|
| 59 | -$selected=3; |
|
| 58 | +$array = array(1=>'Value 1', 2=>'Value 2', 3=>'Value 3'); |
|
| 59 | +$selected = 3; |
|
| 60 | 60 | print $form->selectarray('testselectb', $array, $selected, 1, 0, 0, 'style="min-width: 250px;"', 0, 0, 0, '', '', 1); |
| 61 | 61 | print '<br><br>'."\n"; |
| 62 | 62 | print "Test 4c: Select array with no js forced<br>\n"; |
| 63 | -$array=array(1=>'Value 1',2=>'Value 2',3=>'Value 3'); |
|
| 64 | -print $form->selectarray('selectarray',$array); |
|
| 63 | +$array = array(1=>'Value 1', 2=>'Value 2', 3=>'Value 3'); |
|
| 64 | +print $form->selectarray('selectarray', $array); |
|
| 65 | 65 | |
| 66 | 66 | print '<br><br>'."\n"; |
| 67 | 67 | |
| 68 | 68 | print "Test 4d: a select with ajax refresh and with onchange call of url<br>\n"; |
| 69 | -$selected=-1; |
|
| 69 | +$selected = -1; |
|
| 70 | 70 | print $form->selectArrayAjax('testselectc', DOL_URL_ROOT.'/core/ajax/selectsearchbox.php', $selected, 'style="min-width: 250px;"', '', 0, 1, '', 1); |
| 71 | 71 | |
| 72 | 72 | print '<br><br>'."\n"; |
| 73 | 73 | |
| 74 | 74 | // Test5a: form->select_thirdparty |
| 75 | 75 | print "Test 5a: Select thirdparty<br>\n"; |
| 76 | -print $form->select_company(0,'thirdpartytest'); |
|
| 76 | +print $form->select_company(0, 'thirdpartytest'); |
|
| 77 | 77 | |
| 78 | 78 | print '<br><br>'."\n"; |
| 79 | 79 | |
| 80 | 80 | // Test5b: form->select_product |
| 81 | 81 | print "Test 5b: Select product (using ajax)<br>\n"; |
| 82 | -$form->select_produits(0,'producttest'); |
|
| 82 | +$form->select_produits(0, 'producttest'); |
|
| 83 | 83 | |
| 84 | 84 | print '<br><br>'."\n"; |
| 85 | 85 | |
| 86 | 86 | // Test5c: a multiselect |
| 87 | 87 | print "Test 5c: a multiselect<br>\n"; |
| 88 | -$array=array(1=>'Value 1',2=>'Value 2',3=>'Value 3'); |
|
| 89 | -$arrayselected=array(1,3); |
|
| 88 | +$array = array(1=>'Value 1', 2=>'Value 2', 3=>'Value 3'); |
|
| 89 | +$arrayselected = array(1, 3); |
|
| 90 | 90 | print $form->multiselectarray('testmulti', $array, $arrayselected, '', 0, '', 0, 250); |
| 91 | 91 | |
| 92 | 92 | |
@@ -1,24 +1,24 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER','1'); |
|
| 4 | -if (! defined('NOREQUIREDB')) define('NOREQUIREDB','1'); |
|
| 5 | -if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1'); |
|
| 6 | -if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1'); |
|
| 7 | -if (! defined('NOSTYLECHECK')) define('NOSTYLECHECK','1'); // Do not check style html tag into posted data |
|
| 8 | -if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK','1'); // Do not check anti CSRF attack test |
|
| 9 | -if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL','1'); // Do not check anti POST attack test |
|
| 10 | -if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU','1'); // If there is no need to load and show top and left menu |
|
| 11 | -if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML','1'); // If we don't need to load the html.form.class.php |
|
| 12 | -if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1'); // Do not load ajax.lib.php library |
|
| 13 | -if (! defined("NOLOGIN")) define("NOLOGIN",'1'); // If this page is public (can be called outside logged session) |
|
| 3 | +if (!defined('NOREQUIREUSER')) define('NOREQUIREUSER', '1'); |
|
| 4 | +if (!defined('NOREQUIREDB')) define('NOREQUIREDB', '1'); |
|
| 5 | +if (!defined('NOREQUIRESOC')) define('NOREQUIRESOC', '1'); |
|
| 6 | +if (!defined('NOREQUIRETRAN')) define('NOREQUIRETRAN', '1'); |
|
| 7 | +if (!defined('NOSTYLECHECK')) define('NOSTYLECHECK', '1'); // Do not check style html tag into posted data |
|
| 8 | +if (!defined('NOCSRFCHECK')) define('NOCSRFCHECK', '1'); // Do not check anti CSRF attack test |
|
| 9 | +if (!defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', '1'); // Do not check anti POST attack test |
|
| 10 | +if (!defined('NOREQUIREMENU')) define('NOREQUIREMENU', '1'); // If there is no need to load and show top and left menu |
|
| 11 | +if (!defined('NOREQUIREHTML')) define('NOREQUIREHTML', '1'); // If we don't need to load the html.form.class.php |
|
| 12 | +if (!defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1'); // Do not load ajax.lib.php library |
|
| 13 | +if (!defined("NOLOGIN")) define("NOLOGIN", '1'); // If this page is public (can be called outside logged session) |
|
| 14 | 14 | // If you don't need session management (can't be logged if no session used). You must also set |
| 15 | 15 | // NOCSRFCHECK, NOTOKENRENEWAL, NOLOGIN |
| 16 | 16 | // Disable module with GETPOST('disablemodules') won't work. Variable 'dol_...' will not be set. |
| 17 | 17 | // $_SESSION are then simple vars if sessions are not active. |
| 18 | 18 | // TODO We can close session with session_write_close() as soon as we just need read access. |
| 19 | -if (! defined("NOSESSION")) define("NOSESSION",'1'); |
|
| 19 | +if (!defined("NOSESSION")) define("NOSESSION", '1'); |
|
| 20 | 20 | |
| 21 | -define('REQUIRE_JQUERY_MULTISELECT','select2'); |
|
| 21 | +define('REQUIRE_JQUERY_MULTISELECT', 'select2'); |
|
| 22 | 22 | |
| 23 | 23 | print PHP_SESSION_DISABLED; |
| 24 | 24 | print PHP_SESSION_NONE; |
@@ -24,8 +24,8 @@ discard block |
||
| 24 | 24 | * /public/notice.php?transphrase=url_encoded_sentence_to_show |
| 25 | 25 | */ |
| 26 | 26 | |
| 27 | -define('NOCSRFCHECK',1); |
|
| 28 | -define('NOLOGIN',1); |
|
| 27 | +define('NOCSRFCHECK', 1); |
|
| 28 | +define('NOLOGIN', 1); |
|
| 29 | 29 | |
| 30 | 30 | require '../main.inc.php'; |
| 31 | 31 | |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | * View |
| 35 | 35 | */ |
| 36 | 36 | |
| 37 | -if (! GETPOST('transkey') && ! GETPOST('transphrase')) |
|
| 37 | +if (!GETPOST('transkey') && !GETPOST('transphrase')) |
|
| 38 | 38 | { |
| 39 | 39 | print 'Sorry, it seems your internet connexion is off.<br>'; |
| 40 | 40 | print 'You need to be connected to network to use this software.<br>'; |