@@ -32,10 +32,20 @@ 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'); |
|
| 35 | +if (! defined('NOTOKENRENEWAL')) { |
|
| 36 | + define('NOTOKENRENEWAL','1'); |
|
| 37 | +} |
|
| 38 | +if (! defined('NOREQUIREMENU')) { |
|
| 39 | + define('NOREQUIREMENU','1'); |
|
| 40 | +} |
|
| 41 | +// If there is no menu to show |
|
| 42 | +if (! defined('NOREQUIREHTML')) { |
|
| 43 | + define('NOREQUIREHTML','1'); |
|
| 44 | +} |
|
| 45 | +// If we don't need to load the html.form.class.php |
|
| 46 | +if (! defined('NOREQUIREAJAX')) { |
|
| 47 | + define('NOREQUIREAJAX','1'); |
|
| 48 | +} |
|
| 39 | 49 | define("NOLOGIN",1); // This means this output page does not require to be logged. |
| 40 | 50 | define("NOCSRFCHECK",1); // We accept to go on this page from external web site. |
| 41 | 51 | |
@@ -57,27 +67,53 @@ discard block |
||
| 57 | 67 | require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php'; |
| 58 | 68 | |
| 59 | 69 | // Security check |
| 60 | -if (empty($conf->agenda->enabled)) accessforbidden('',0,0,1); |
|
| 70 | +if (empty($conf->agenda->enabled)) { |
|
| 71 | + accessforbidden('',0,0,1); |
|
| 72 | +} |
|
| 61 | 73 | |
| 62 | 74 | // Not older than |
| 63 | -if (! isset($conf->global->MAIN_AGENDA_EXPORT_PAST_DELAY)) $conf->global->MAIN_AGENDA_EXPORT_PAST_DELAY=100; // default limit |
|
| 75 | +if (! isset($conf->global->MAIN_AGENDA_EXPORT_PAST_DELAY)) { |
|
| 76 | + $conf->global->MAIN_AGENDA_EXPORT_PAST_DELAY=100; |
|
| 77 | +} |
|
| 78 | +// default limit |
|
| 64 | 79 | |
| 65 | 80 | // Define format, type and filter |
| 66 | 81 | $format='ical'; |
| 67 | 82 | $type='event'; |
| 68 | -if (GETPOST("format",'alpha')) $format=GETPOST("format",'apha'); |
|
| 69 | -if (GETPOST("type",'apha')) $type=GETPOST("type",'alpha'); |
|
| 83 | +if (GETPOST("format",'alpha')) { |
|
| 84 | + $format=GETPOST("format",'apha'); |
|
| 85 | +} |
|
| 86 | +if (GETPOST("type",'apha')) { |
|
| 87 | + $type=GETPOST("type",'alpha'); |
|
| 88 | +} |
|
| 70 | 89 | |
| 71 | 90 | $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; |
|
| 91 | +if (GETPOST("year",'int')) { |
|
| 92 | + $filters['year']=GETPOST("year",'int'); |
|
| 93 | +} |
|
| 94 | +if (GETPOST("id",'int')) { |
|
| 95 | + $filters['id']=GETPOST("id",'int'); |
|
| 96 | +} |
|
| 97 | +if (GETPOST("idfrom",'int')) { |
|
| 98 | + $filters['idfrom']=GETPOST("idfrom",'int'); |
|
| 99 | +} |
|
| 100 | +if (GETPOST("idto",'int')) { |
|
| 101 | + $filters['idto']=GETPOST("idto",'int'); |
|
| 102 | +} |
|
| 103 | +if (GETPOST("project",'apha')) { |
|
| 104 | + $filters['project']=GETPOST("project",'apha'); |
|
| 105 | +} |
|
| 106 | +if (GETPOST("logina",'apha')) { |
|
| 107 | + $filters['logina']=GETPOST("logina",'apha'); |
|
| 108 | +} |
|
| 109 | +if (GETPOST("logint",'apha')) { |
|
| 110 | + $filters['logint']=GETPOST("logint",'apha'); |
|
| 111 | +} |
|
| 112 | +if (GETPOST("notolderthan",'int')) { |
|
| 113 | + $filters['notolderthan']=GETPOST("notolderthan","int"); |
|
| 114 | +} else { |
|
| 115 | + $filters['notolderthan']=$conf->global->MAIN_AGENDA_EXPORT_PAST_DELAY; |
|
| 116 | +} |
|
| 81 | 117 | |
| 82 | 118 | // Check config |
| 83 | 119 | if (empty($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY)) |
@@ -109,13 +145,29 @@ discard block |
||
| 109 | 145 | foreach ($filters as $key => $value) |
| 110 | 146 | { |
| 111 | 147 | //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 |
|
| 148 | + if ($key == 'year') { |
|
| 149 | + $filename.='-year'.$value; |
|
| 150 | + } |
|
| 151 | + if ($key == 'id') { |
|
| 152 | + $filename.='-id'.$value; |
|
| 153 | + } |
|
| 154 | + if ($key == 'idfrom') { |
|
| 155 | + $filename.='-idfrom'.$value; |
|
| 156 | + } |
|
| 157 | + if ($key == 'idto') { |
|
| 158 | + $filename.='-idto'.$value; |
|
| 159 | + } |
|
| 160 | + if ($key == 'project') { |
|
| 161 | + $filename.='-project'.$value; |
|
| 162 | + } |
|
| 163 | + if ($key == 'logina') { |
|
| 164 | + $filename.='-logina'.$value; |
|
| 165 | + } |
|
| 166 | + // Author |
|
| 167 | + if ($key == 'logint') { |
|
| 168 | + $filename.='-logint'.$value; |
|
| 169 | + } |
|
| 170 | + // Assigned to |
|
| 119 | 171 | } |
| 120 | 172 | // Add extension |
| 121 | 173 | if ($format == 'vcal') { $shortfilename.='.vcs'; $filename.='.vcs'; } |
@@ -135,7 +187,9 @@ discard block |
||
| 135 | 187 | $agenda=new ActionComm($db); |
| 136 | 188 | |
| 137 | 189 | $cachedelay=0; |
| 138 | -if (! empty($conf->global->MAIN_AGENDA_EXPORT_CACHE)) $cachedelay=$conf->global->MAIN_AGENDA_EXPORT_CACHE; |
|
| 190 | +if (! empty($conf->global->MAIN_AGENDA_EXPORT_CACHE)) { |
|
| 191 | + $cachedelay=$conf->global->MAIN_AGENDA_EXPORT_CACHE; |
|
| 192 | +} |
|
| 139 | 193 | |
| 140 | 194 | // Build file |
| 141 | 195 | if ($format == 'ical' || $format == 'vcal') |
@@ -144,28 +198,40 @@ discard block |
||
| 144 | 198 | if ($result >= 0) |
| 145 | 199 | { |
| 146 | 200 | $attachment = true; |
| 147 | - if (isset($_GET["attachment"])) $attachment=$_GET["attachment"]; |
|
| 201 | + if (isset($_GET["attachment"])) { |
|
| 202 | + $attachment=$_GET["attachment"]; |
|
| 203 | + } |
|
| 148 | 204 | //$attachment = false; |
| 149 | 205 | $contenttype='text/calendar'; |
| 150 | - if (isset($_GET["contenttype"])) $contenttype=$_GET["contenttype"]; |
|
| 206 | + if (isset($_GET["contenttype"])) { |
|
| 207 | + $contenttype=$_GET["contenttype"]; |
|
| 208 | + } |
|
| 151 | 209 | //$contenttype='text/plain'; |
| 152 | 210 | $outputencoding='UTF-8'; |
| 153 | 211 | |
| 154 | - if ($contenttype) header('Content-Type: '.$contenttype.($outputencoding?'; charset='.$outputencoding:'')); |
|
| 155 | - if ($attachment) header('Content-Disposition: attachment; filename="'.$shortfilename.'"'); |
|
| 212 | + if ($contenttype) { |
|
| 213 | + header('Content-Type: '.$contenttype.($outputencoding?'; charset='.$outputencoding:'')); |
|
| 214 | + } |
|
| 215 | + if ($attachment) { |
|
| 216 | + header('Content-Disposition: attachment; filename="'.$shortfilename.'"'); |
|
| 217 | + } |
|
| 156 | 218 | |
| 157 | - if ($cachedelay) header('Cache-Control: max-age='.$cachedelay.', private, must-revalidate'); |
|
| 158 | - else header('Cache-Control: private, must-revalidate'); |
|
| 219 | + if ($cachedelay) { |
|
| 220 | + header('Cache-Control: max-age='.$cachedelay.', private, must-revalidate'); |
|
| 221 | + } else { |
|
| 222 | + header('Cache-Control: private, must-revalidate'); |
|
| 223 | + } |
|
| 159 | 224 | |
| 160 | 225 | // Clean parameters |
| 161 | 226 | $outputfile=$conf->agenda->dir_temp.'/'.$filename; |
| 162 | 227 | $result=readfile($outputfile); |
| 163 | - if (! $result) print 'File '.$outputfile.' was empty.'; |
|
| 228 | + if (! $result) { |
|
| 229 | + print 'File '.$outputfile.' was empty.'; |
|
| 230 | + } |
|
| 164 | 231 | |
| 165 | 232 | //header("Location: ".DOL_URL_ROOT.'/document.php?modulepart=agenda&file='.urlencode($filename)); |
| 166 | 233 | exit; |
| 167 | - } |
|
| 168 | - else |
|
| 234 | + } else |
|
| 169 | 235 | { |
| 170 | 236 | print 'Error '.$agenda->error; |
| 171 | 237 | |
@@ -179,31 +245,43 @@ discard block |
||
| 179 | 245 | if ($result >= 0) |
| 180 | 246 | { |
| 181 | 247 | $attachment = false; |
| 182 | - if (isset($_GET["attachment"])) $attachment=$_GET["attachment"]; |
|
| 248 | + if (isset($_GET["attachment"])) { |
|
| 249 | + $attachment=$_GET["attachment"]; |
|
| 250 | + } |
|
| 183 | 251 | //$attachment = false; |
| 184 | 252 | $contenttype='application/rss+xml'; |
| 185 | - if (isset($_GET["contenttype"])) $contenttype=$_GET["contenttype"]; |
|
| 253 | + if (isset($_GET["contenttype"])) { |
|
| 254 | + $contenttype=$_GET["contenttype"]; |
|
| 255 | + } |
|
| 186 | 256 | //$contenttype='text/plain'; |
| 187 | 257 | $outputencoding='UTF-8'; |
| 188 | 258 | |
| 189 | - if ($contenttype) header('Content-Type: '.$contenttype.($outputencoding?'; charset='.$outputencoding:'')); |
|
| 190 | - if ($attachment) header('Content-Disposition: attachment; filename="'.$filename.'"'); |
|
| 259 | + if ($contenttype) { |
|
| 260 | + header('Content-Type: '.$contenttype.($outputencoding?'; charset='.$outputencoding:'')); |
|
| 261 | + } |
|
| 262 | + if ($attachment) { |
|
| 263 | + header('Content-Disposition: attachment; filename="'.$filename.'"'); |
|
| 264 | + } |
|
| 191 | 265 | |
| 192 | 266 | // Ajout directives pour resoudre bug IE |
| 193 | 267 | //header('Cache-Control: Public, must-revalidate'); |
| 194 | 268 | //header('Pragma: public'); |
| 195 | - if ($cachedelay) header('Cache-Control: max-age='.$cachedelay.', private, must-revalidate'); |
|
| 196 | - else header('Cache-Control: private, must-revalidate'); |
|
| 269 | + if ($cachedelay) { |
|
| 270 | + header('Cache-Control: max-age='.$cachedelay.', private, must-revalidate'); |
|
| 271 | + } else { |
|
| 272 | + header('Cache-Control: private, must-revalidate'); |
|
| 273 | + } |
|
| 197 | 274 | |
| 198 | 275 | // Clean parameters |
| 199 | 276 | $outputfile=$conf->agenda->dir_temp.'/'.$filename; |
| 200 | 277 | $result=readfile($outputfile); |
| 201 | - if (! $result) print 'File '.$outputfile.' was empty.'; |
|
| 278 | + if (! $result) { |
|
| 279 | + print 'File '.$outputfile.' was empty.'; |
|
| 280 | + } |
|
| 202 | 281 | |
| 203 | 282 | // header("Location: ".DOL_URL_ROOT.'/document.php?modulepart=agenda&file='.urlencode($filename)); |
| 204 | 283 | exit; |
| 205 | - } |
|
| 206 | - else |
|
| 284 | + } else |
|
| 207 | 285 | { |
| 208 | 286 | print 'Error '.$agenda->error; |
| 209 | 287 | |
@@ -31,7 +31,9 @@ discard block |
||
| 31 | 31 | // Do not use GETPOST here, function is not defined and define must be done before including main.inc.php |
| 32 | 32 | // TODO This should be useless. Because entity must be retreive from object ref and not from url. |
| 33 | 33 | $entity=(! empty($_GET['entity']) ? (int) $_GET['entity'] : (! empty($_POST['entity']) ? (int) $_POST['entity'] : 1)); |
| 34 | -if (is_numeric($entity)) define("DOLENTITY", $entity); |
|
| 34 | +if (is_numeric($entity)) { |
|
| 35 | + define("DOLENTITY", $entity); |
|
| 36 | +} |
|
| 35 | 37 | |
| 36 | 38 | require '../../main.inc.php'; |
| 37 | 39 | require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; |
@@ -39,7 +41,9 @@ discard block |
||
| 39 | 41 | require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; |
| 40 | 42 | |
| 41 | 43 | // Security check |
| 42 | -if (empty($conf->adherent->enabled)) accessforbidden('',0,0,1); |
|
| 44 | +if (empty($conf->adherent->enabled)) { |
|
| 45 | + accessforbidden('',0,0,1); |
|
| 46 | +} |
|
| 43 | 47 | |
| 44 | 48 | |
| 45 | 49 | $langs->load("main"); |
@@ -66,8 +70,11 @@ discard block |
||
| 66 | 70 | */ |
| 67 | 71 | |
| 68 | 72 | $morehead=''; |
| 69 | -if (! empty($conf->global->MEMBER_PUBLIC_CSS)) $morehead='<link rel="stylesheet" type="text/css" href="'.$conf->global->MEMBER_PUBLIC_CSS.'">'; |
|
| 70 | -else $morehead='<link rel="stylesheet" type="text/css" href="'.DOL_URL_ROOT.'/theme/eldy/style.css.php'.'">'; |
|
| 73 | +if (! empty($conf->global->MEMBER_PUBLIC_CSS)) { |
|
| 74 | + $morehead='<link rel="stylesheet" type="text/css" href="'.$conf->global->MEMBER_PUBLIC_CSS.'">'; |
|
| 75 | +} else { |
|
| 76 | + $morehead='<link rel="stylesheet" type="text/css" href="'.DOL_URL_ROOT.'/theme/eldy/style.css.php'.'">'; |
|
| 77 | +} |
|
| 71 | 78 | |
| 72 | 79 | llxHeaderVierge($langs->trans("MemberCard"), $morehead); |
| 73 | 80 | |
@@ -84,8 +91,7 @@ discard block |
||
| 84 | 91 | if (empty($object->public)) |
| 85 | 92 | { |
| 86 | 93 | print $langs->trans("ErrorThisMemberIsNotPublic"); |
| 87 | - } |
|
| 88 | - else |
|
| 94 | + } else |
|
| 89 | 95 | { |
| 90 | 96 | print '<table class="public_border" cellspacing="0" width="100%" cellpadding="3">'; |
| 91 | 97 | |
@@ -140,7 +146,9 @@ discard block |
||
| 140 | 146 | print "<html>\n"; |
| 141 | 147 | print "<head>\n"; |
| 142 | 148 | print "<title>".$title."</title>\n"; |
| 143 | - if ($head) print $head."\n"; |
|
| 149 | + if ($head) { |
|
| 150 | + print $head."\n"; |
|
| 151 | + } |
|
| 144 | 152 | print "</head>\n"; |
| 145 | 153 | print '<body class="public_body">'."\n"; |
| 146 | 154 | } |
@@ -31,12 +31,16 @@ discard block |
||
| 31 | 31 | // Do not use GETPOST here, function is not defined and define must be done before including main.inc.php |
| 32 | 32 | // TODO This should be useless. Because entity must be retreive from object ref and not from url. |
| 33 | 33 | $entity=(! empty($_GET['entity']) ? (int) $_GET['entity'] : (! empty($_POST['entity']) ? (int) $_POST['entity'] : 1)); |
| 34 | -if (is_numeric($entity)) define("DOLENTITY", $entity); |
|
| 34 | +if (is_numeric($entity)) { |
|
| 35 | + define("DOLENTITY", $entity); |
|
| 36 | +} |
|
| 35 | 37 | |
| 36 | 38 | require '../../main.inc.php'; |
| 37 | 39 | |
| 38 | 40 | // Security check |
| 39 | -if (empty($conf->adherent->enabled)) accessforbidden('',0,0,1); |
|
| 41 | +if (empty($conf->adherent->enabled)) { |
|
| 42 | + accessforbidden('',0,0,1); |
|
| 43 | +} |
|
| 40 | 44 | |
| 41 | 45 | |
| 42 | 46 | $langs->load("main"); |
@@ -60,7 +64,9 @@ discard block |
||
| 60 | 64 | print "<html>\n"; |
| 61 | 65 | print "<head>\n"; |
| 62 | 66 | print "<title>".$title."</title>\n"; |
| 63 | - if ($head) print $head."\n"; |
|
| 67 | + if ($head) { |
|
| 68 | + print $head."\n"; |
|
| 69 | + } |
|
| 64 | 70 | print "</head>\n"; |
| 65 | 71 | print '<body class="public_body">'."\n"; |
| 66 | 72 | } |
@@ -102,8 +108,11 @@ discard block |
||
| 102 | 108 | $form = new Form($db); |
| 103 | 109 | |
| 104 | 110 | $morehead=''; |
| 105 | -if (! empty($conf->global->MEMBER_PUBLIC_CSS)) $morehead='<link rel="stylesheet" type="text/css" href="'.$conf->global->MEMBER_PUBLIC_CSS.'">'; |
|
| 106 | -else $morehead='<link rel="stylesheet" type="text/css" href="'.DOL_URL_ROOT.'/theme/eldy/style.css.php'.'">'; |
|
| 111 | +if (! empty($conf->global->MEMBER_PUBLIC_CSS)) { |
|
| 112 | + $morehead='<link rel="stylesheet" type="text/css" href="'.$conf->global->MEMBER_PUBLIC_CSS.'">'; |
|
| 113 | +} else { |
|
| 114 | + $morehead='<link rel="stylesheet" type="text/css" href="'.DOL_URL_ROOT.'/theme/eldy/style.css.php'.'">'; |
|
| 115 | +} |
|
| 107 | 116 | |
| 108 | 117 | llxHeaderVierge($langs->trans("ListOfValidatedPublicMembers"), $morehead); |
| 109 | 118 | |
@@ -155,8 +164,7 @@ discard block |
||
| 155 | 164 | print '<td>'; |
| 156 | 165 | print $form->showphoto('memberphoto', $objp, 64); |
| 157 | 166 | print '</td>'."\n"; |
| 158 | - } |
|
| 159 | - else |
|
| 167 | + } else |
|
| 160 | 168 | { |
| 161 | 169 | print "<td> </td>\n"; |
| 162 | 170 | } |
@@ -164,8 +172,7 @@ discard block |
||
| 164 | 172 | $i++; |
| 165 | 173 | } |
| 166 | 174 | print "</table>"; |
| 167 | -} |
|
| 168 | -else |
|
| 175 | +} else |
|
| 169 | 176 | { |
| 170 | 177 | dol_print_error($db); |
| 171 | 178 | } |
@@ -25,11 +25,25 @@ |
||
| 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')) { |
|
| 29 | + define("NOLOGIN",1); |
|
| 30 | +} |
|
| 31 | +// This means this output page does not require to be logged. |
|
| 32 | +if (! defined('NOREQUIRETRAN')) { |
|
| 33 | + define('NOREQUIRETRAN','1'); |
|
| 34 | +} |
|
| 35 | +if (! defined('NOCSRFCHECK')) { |
|
| 36 | + define('NOCSRFCHECK','1'); |
|
| 37 | +} |
|
| 38 | +// Do not check anti CSRF attack test |
|
| 39 | +if (! defined('NOTOKENRENEWAL')) { |
|
| 40 | + define('NOTOKENRENEWAL','1'); |
|
| 41 | +} |
|
| 42 | +// Do not check anti POST attack test |
|
| 43 | +if (! defined('NOREQUIREMENU')) { |
|
| 44 | + define('NOREQUIREMENU','1'); |
|
| 45 | +} |
|
| 46 | +// If there is no need to load and show top and left menu |
|
| 33 | 47 | |
| 34 | 48 | /** |
| 35 | 49 | * Header empty |
@@ -26,9 +26,18 @@ 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')) { |
|
| 30 | + define("NOLOGIN",1); |
|
| 31 | +} |
|
| 32 | +// This means this output page does not require to be logged. |
|
| 33 | +if (! defined('NOCSRFCHECK')) { |
|
| 34 | + define('NOCSRFCHECK','1'); |
|
| 35 | +} |
|
| 36 | +// Do not check anti CSRF attack test |
|
| 37 | +if (! defined('NOREQUIREMENU')) { |
|
| 38 | + define('NOREQUIREMENU','1'); |
|
| 39 | +} |
|
| 40 | +// If there is no need to load and show top and left menu |
|
| 32 | 41 | |
| 33 | 42 | /** |
| 34 | 43 | * Header empty |
@@ -78,21 +87,27 @@ discard block |
||
| 78 | 87 | dol_syslog("public/emailing/mailing-unsubscribe.php : Mail unsubcribe : ".$sql, LOG_DEBUG); |
| 79 | 88 | |
| 80 | 89 | $resql=$db->query($sql); |
| 81 | - if (! $resql) dol_print_error($db); |
|
| 90 | + if (! $resql) { |
|
| 91 | + dol_print_error($db); |
|
| 92 | + } |
|
| 82 | 93 | |
| 83 | 94 | // Update status communication of thirdparty prospect |
| 84 | 95 | $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 | 96 | dol_syslog("public/emailing/mailing-unsubscribe.php : Mail unsubcribe thirdparty : ".$sql, LOG_DEBUG); |
| 86 | 97 | |
| 87 | 98 | $resql=$db->query($sql); |
| 88 | - if (! $resql) dol_print_error($db); |
|
| 99 | + if (! $resql) { |
|
| 100 | + dol_print_error($db); |
|
| 101 | + } |
|
| 89 | 102 | |
| 90 | 103 | // Update status communication of contact prospect |
| 91 | 104 | $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 | 105 | dol_syslog("public/emailing/mailing-unsubscribe.php : Mail unsubcribe contact : ".$sql, LOG_DEBUG); |
| 93 | 106 | |
| 94 | 107 | $resql=$db->query($sql); |
| 95 | - if (! $resql) dol_print_error($db); |
|
| 108 | + if (! $resql) { |
|
| 109 | + dol_print_error($db); |
|
| 110 | + } |
|
| 96 | 111 | |
| 97 | 112 | |
| 98 | 113 | $sql = "SELECT mc.email"; |
@@ -100,7 +115,9 @@ discard block |
||
| 100 | 115 | $sql .= " WHERE mc.tag='".$db->escape($tag)."'"; |
| 101 | 116 | |
| 102 | 117 | $resql=$db->query($sql); |
| 103 | - if (! $resql) dol_print_error($db); |
|
| 118 | + if (! $resql) { |
|
| 119 | + dol_print_error($db); |
|
| 120 | + } |
|
| 104 | 121 | |
| 105 | 122 | $obj = $db->fetch_object($resql); |
| 106 | 123 | |
@@ -43,7 +43,9 @@ discard block |
||
| 43 | 43 | |
| 44 | 44 | // Security check |
| 45 | 45 | global $dolibarr_main_demo; |
| 46 | -if (empty($dolibarr_main_demo)) accessforbidden('Parameter dolibarr_main_demo must be defined in conf file with value "default login,default pass" to enable the demo entry page',0,0,1); |
|
| 46 | +if (empty($dolibarr_main_demo)) { |
|
| 47 | + accessforbidden('Parameter dolibarr_main_demo must be defined in conf file with value "default login,default pass" to enable the demo entry page',0,0,1); |
|
| 48 | +} |
|
| 47 | 49 | |
| 48 | 50 | // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context |
| 49 | 51 | $res=$hookmanager->initHooks(array('demo')); |
@@ -160,8 +162,7 @@ discard block |
||
| 160 | 162 | if ($objMod->numero > 0) |
| 161 | 163 | { |
| 162 | 164 | $j = $objMod->numero; |
| 163 | - } |
|
| 164 | - else |
|
| 165 | + } else |
|
| 165 | 166 | { |
| 166 | 167 | $j = 1000 + $i; |
| 167 | 168 | } |
@@ -170,8 +171,12 @@ discard block |
||
| 170 | 171 | |
| 171 | 172 | // We discard modules according to features level (PS: if module is activated we always show it) |
| 172 | 173 | $const_name = 'MAIN_MODULE_'.strtoupper(preg_replace('/^mod/i','',get_class($objMod))); |
| 173 | - if ($objMod->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2 && empty($conf->global->$const_name)) $modulequalified=0; |
|
| 174 | - if ($objMod->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1 && empty($conf->global->$const_name)) $modulequalified=0; |
|
| 174 | + if ($objMod->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2 && empty($conf->global->$const_name)) { |
|
| 175 | + $modulequalified=0; |
|
| 176 | + } |
|
| 177 | + if ($objMod->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1 && empty($conf->global->$const_name)) { |
|
| 178 | + $modulequalified=0; |
|
| 179 | + } |
|
| 175 | 180 | |
| 176 | 181 | if ($modulequalified) |
| 177 | 182 | { |
@@ -179,14 +184,18 @@ discard block |
||
| 179 | 184 | $filename[$i]= $modName; |
| 180 | 185 | $orders[$i] = $objMod->family."_".$j; // Tri par famille puis numero module |
| 181 | 186 | //print "x".$modName." ".$orders[$i]."\n<br>"; |
| 182 | - if (isset($categ[$objMod->special])) $categ[$objMod->special]++; // Array of all different modules categories |
|
| 183 | - else $categ[$objMod->special]=1; |
|
| 187 | + if (isset($categ[$objMod->special])) { |
|
| 188 | + $categ[$objMod->special]++; |
|
| 189 | + } |
|
| 190 | + // Array of all different modules categories |
|
| 191 | + else { |
|
| 192 | + $categ[$objMod->special]=1; |
|
| 193 | + } |
|
| 184 | 194 | $dirmod[$i] = $dirroot; |
| 185 | 195 | $j++; |
| 186 | 196 | $i++; |
| 187 | 197 | } |
| 188 | - } |
|
| 189 | - catch(Exception $e) |
|
| 198 | + } catch(Exception $e) |
|
| 190 | 199 | { |
| 191 | 200 | dol_syslog("Failed to load ".$dir.$file." ".$e->getMessage(), LOG_ERR); |
| 192 | 201 | } |
@@ -204,10 +213,12 @@ discard block |
||
| 204 | 213 | * Actions |
| 205 | 214 | */ |
| 206 | 215 | |
| 207 | -if (GETPOST('action','aZ09') == 'gotodemo') // Action run when we click on "Start" after selection modules |
|
| 216 | +if (GETPOST('action','aZ09') == 'gotodemo') { |
|
| 217 | + // Action run when we click on "Start" after selection modules |
|
| 208 | 218 | { |
| 209 | 219 | //print 'ee'.GETPOST("demochoice"); |
| 210 | 220 | $disablestring=''; |
| 221 | +} |
|
| 211 | 222 | // If we disable modules using a profile choice |
| 212 | 223 | if (GETPOST("demochoice")) |
| 213 | 224 | { |
@@ -227,14 +238,18 @@ discard block |
||
| 227 | 238 | if (empty($_POST[$modulekeyname]) && empty($val->always_enabled) && ! in_array($modulekeyname,$alwayscheckedmodules)) |
| 228 | 239 | { |
| 229 | 240 | $disablestring.=$modulekeyname.','; |
| 230 | - if ($modulekeyname=='propale') $disablestring.='propal,'; |
|
| 241 | + if ($modulekeyname=='propale') { |
|
| 242 | + $disablestring.='propal,'; |
|
| 243 | + } |
|
| 231 | 244 | } |
| 232 | 245 | } |
| 233 | 246 | |
| 234 | 247 | // Do redirect to login page |
| 235 | 248 | if ($disablestring) |
| 236 | 249 | { |
| 237 | - if (GETPOST('urlfrom')) $url.=(preg_match('/\?/',$url)?'&':'?').'urlfrom='.urlencode(GETPOST('urlfrom','alpha')); |
|
| 250 | + if (GETPOST('urlfrom')) { |
|
| 251 | + $url.=(preg_match('/\?/',$url)?'&':'?').'urlfrom='.urlencode(GETPOST('urlfrom','alpha')); |
|
| 252 | + } |
|
| 238 | 253 | $url.=(preg_match('/\?/',$url)?'&':'?').'disablemodules='.$disablestring; |
| 239 | 254 | //var_dump($url);exit; |
| 240 | 255 | header("Location: ".$url); |
@@ -305,7 +320,9 @@ discard block |
||
| 305 | 320 | if ($profilearray['default'] >= 0) |
| 306 | 321 | { |
| 307 | 322 | //print $profilearray['lang']; |
| 308 | - if (! empty($profilearray['lang'])) $langs->load($profilearray['lang']); |
|
| 323 | + if (! empty($profilearray['lang'])) { |
|
| 324 | + $langs->load($profilearray['lang']); |
|
| 325 | + } |
|
| 309 | 326 | |
| 310 | 327 | $url=$_SERVER["PHP_SELF"].'?action=gotodemo'; |
| 311 | 328 | $urlwithmod=$url.'&demochoice='.$profilearray['key']; |
@@ -374,32 +391,45 @@ discard block |
||
| 374 | 391 | $j=0; |
| 375 | 392 | $nbcolsmod=empty($conf->dol_optimize_smallscreen)?4:3; |
| 376 | 393 | //var_dump($modules); |
| 377 | - foreach($orders as $index => $key) // Loop on qualified (enabled) modules |
|
| 394 | + foreach($orders as $index => $key) { |
|
| 395 | + // Loop on qualified (enabled) modules |
|
| 378 | 396 | { |
| 379 | 397 | //print $index.' '.$key; |
| 380 | 398 | $val = $modules[$index]; |
| 399 | + } |
|
| 381 | 400 | $modulekeyname=strtolower($val->name); |
| 382 | 401 | |
| 383 | 402 | $modulequalified=1; |
| 384 | - if (! empty($val->always_enabled) || in_array($modulekeyname,$alwayshiddenuncheckedmodules)) $modulequalified=0; |
|
| 385 | - if ($val->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2 && ! $conf->global->$const_name) $modulequalified=0; |
|
| 386 | - if ($val->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1 && ! $conf->global->$const_name) $modulequalified=0; |
|
| 387 | - if (! $modulequalified) continue; |
|
| 403 | + if (! empty($val->always_enabled) || in_array($modulekeyname,$alwayshiddenuncheckedmodules)) { |
|
| 404 | + $modulequalified=0; |
|
| 405 | + } |
|
| 406 | + if ($val->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2 && ! $conf->global->$const_name) { |
|
| 407 | + $modulequalified=0; |
|
| 408 | + } |
|
| 409 | + if ($val->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1 && ! $conf->global->$const_name) { |
|
| 410 | + $modulequalified=0; |
|
| 411 | + } |
|
| 412 | + if (! $modulequalified) { |
|
| 413 | + continue; |
|
| 414 | + } |
|
| 388 | 415 | |
| 389 | 416 | if (in_array($modulekeyname,$alwayshiddencheckedmodules)) |
| 390 | 417 | { |
| 391 | 418 | print "\n".'<!-- Module '.$modulekeyname.' hidden and always checked -->'; |
| 392 | 419 | print '<input type="hidden" name="'.$modulekeyname.'" value="1">'; |
| 393 | - } |
|
| 394 | - else |
|
| 420 | + } else |
|
| 395 | 421 | { |
| 396 | 422 | $modulo=($j % $nbcolsmod); |
| 397 | 423 | //if ($modulo == 0) print '<tr>'; |
| 398 | 424 | print '<!-- id='.$val->numero.' -->'; |
| 399 | 425 | print '<div class="nowrap">'; |
| 400 | 426 | print '<input type="checkbox" class="checkbox" name="'.$modulekeyname.'" value="1"'; |
| 401 | - if (in_array($modulekeyname,$alwaysuncheckedmodules)) print ' disabled'; |
|
| 402 | - if (! in_array($modulekeyname,$alwaysuncheckedmodules) && (! in_array($modulekeyname,$listofdisabledmodules) || in_array($modulekeyname,$alwayscheckedmodules))) print ' checked'; |
|
| 427 | + if (in_array($modulekeyname,$alwaysuncheckedmodules)) { |
|
| 428 | + print ' disabled'; |
|
| 429 | + } |
|
| 430 | + if (! in_array($modulekeyname,$alwaysuncheckedmodules) && (! in_array($modulekeyname,$listofdisabledmodules) || in_array($modulekeyname,$alwayscheckedmodules))) { |
|
| 431 | + print ' checked'; |
|
| 432 | + } |
|
| 403 | 433 | print '> <div class="inline-block demomaxoveflow">'.$val->getName().'</div><br>'; |
| 404 | 434 | print '</div>'; |
| 405 | 435 | //if ($modulo == ($nbcolsmod - 1)) print '</tr>'; |
@@ -444,8 +474,7 @@ discard block |
||
| 444 | 474 | print 'src="http://pagead2.googlesyndication.com/pagead/show_ads.js">'."\n"; |
| 445 | 475 | print '</script>'."\n"; |
| 446 | 476 | print '</div>'."\n"; |
| 447 | - } |
|
| 448 | - else |
|
| 477 | + } else |
|
| 449 | 478 | { |
| 450 | 479 | print '<!-- google js advert tag disabled with jmobile -->'."\n"; |
| 451 | 480 | } |
@@ -48,7 +48,9 @@ discard block |
||
| 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)) { |
|
| 52 | + accessforbidden('',0,0,1); |
|
| 53 | +} |
|
| 52 | 54 | |
| 53 | 55 | |
| 54 | 56 | /* |
@@ -62,7 +64,9 @@ discard block |
||
| 62 | 64 | // Add comment |
| 63 | 65 | if (GETPOST('ajoutcomment')) |
| 64 | 66 | { |
| 65 | - if (!$canbemodified) accessforbidden(); |
|
| 67 | + if (!$canbemodified) { |
|
| 68 | + accessforbidden(); |
|
| 69 | + } |
|
| 66 | 70 | |
| 67 | 71 | $error=0; |
| 68 | 72 | |
@@ -84,14 +88,18 @@ discard block |
||
| 84 | 88 | |
| 85 | 89 | $resql = $object->addComment($comment, $comment_user); |
| 86 | 90 | |
| 87 | - if (! $resql) dol_print_error($db); |
|
| 91 | + if (! $resql) { |
|
| 92 | + dol_print_error($db); |
|
| 93 | + } |
|
| 88 | 94 | } |
| 89 | 95 | } |
| 90 | 96 | |
| 91 | 97 | // Add vote |
| 92 | -if (GETPOST("boutonp") || GETPOST("boutonp.x") || GETPOST("boutonp_x")) // boutonp for chrom, boutonp_x for firefox |
|
| 98 | +if (GETPOST("boutonp") || GETPOST("boutonp.x") || GETPOST("boutonp_x")) { |
|
| 99 | + // boutonp for chrom, boutonp_x for firefox |
|
| 93 | 100 | { |
| 94 | 101 | if (!$canbemodified) accessforbidden(); |
| 102 | +} |
|
| 95 | 103 | |
| 96 | 104 | //Si le nom est bien entré |
| 97 | 105 | if (GETPOST('nom')) |
@@ -102,12 +110,10 @@ discard block |
||
| 102 | 110 | if (isset($_POST["choix$i"]) && $_POST["choix$i"] == '1') |
| 103 | 111 | { |
| 104 | 112 | $nouveauchoix.="1"; |
| 105 | - } |
|
| 106 | - else if (isset($_POST["choix$i"]) && $_POST["choix$i"] == '2') |
|
| 113 | + } else if (isset($_POST["choix$i"]) && $_POST["choix$i"] == '2') |
|
| 107 | 114 | { |
| 108 | 115 | $nouveauchoix.="2"; |
| 109 | - } |
|
| 110 | - else { // sinon c'est 0 |
|
| 116 | + } else { // sinon c'est 0 |
|
| 111 | 117 | $nouveauchoix.="0"; |
| 112 | 118 | } |
| 113 | 119 | } |
@@ -119,15 +125,16 @@ discard block |
||
| 119 | 125 | $sql.= ' FROM '.MAIN_DB_PREFIX.'opensurvey_user_studs'; |
| 120 | 126 | $sql.= " WHERE id_sondage='".$db->escape($numsondage)."' AND nom = '".$db->escape($nom)."' ORDER BY id_users"; |
| 121 | 127 | $resql = $db->query($sql); |
| 122 | - if (! $resql) dol_print_error($db); |
|
| 128 | + if (! $resql) { |
|
| 129 | + dol_print_error($db); |
|
| 130 | + } |
|
| 123 | 131 | |
| 124 | 132 | $num_rows = $db->num_rows($resql); |
| 125 | 133 | if ($num_rows > 0) |
| 126 | 134 | { |
| 127 | 135 | setEventMessages($langs->trans("VoteNameAlreadyExists"), null, 'errors'); |
| 128 | 136 | $error++; |
| 129 | - } |
|
| 130 | - else |
|
| 137 | + } else |
|
| 131 | 138 | { |
| 132 | 139 | $sql = 'INSERT INTO '.MAIN_DB_PREFIX.'opensurvey_user_studs (nom, id_sondage, reponses)'; |
| 133 | 140 | $sql.= " VALUES ('".$db->escape($nom)."', '".$db->escape($numsondage)."','".$db->escape($nouveauchoix)."')"; |
@@ -160,11 +167,11 @@ discard block |
||
| 160 | 167 | $result=$cmailfile->sendfile(); |
| 161 | 168 | } |
| 162 | 169 | } |
| 170 | + } else { |
|
| 171 | + dol_print_error($db); |
|
| 163 | 172 | } |
| 164 | - else dol_print_error($db); |
|
| 165 | 173 | } |
| 166 | - } |
|
| 167 | - else |
|
| 174 | + } else |
|
| 168 | 175 | { |
| 169 | 176 | setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Name")), null, 'errors'); |
| 170 | 177 | } |
@@ -201,17 +208,17 @@ discard block |
||
| 201 | 208 | if (isset($_POST["choix".$i]) && $_POST["choix".$i] == '1') |
| 202 | 209 | { |
| 203 | 210 | $nouveauchoix.="1"; |
| 204 | - } |
|
| 205 | - else if (isset($_POST["choix".$i]) && $_POST["choix".$i] == '2') |
|
| 211 | + } else if (isset($_POST["choix".$i]) && $_POST["choix".$i] == '2') |
|
| 206 | 212 | { |
| 207 | 213 | $nouveauchoix.="2"; |
| 208 | - } |
|
| 209 | - else { // sinon c'est 0 |
|
| 214 | + } else { // sinon c'est 0 |
|
| 210 | 215 | $nouveauchoix.="0"; |
| 211 | 216 | } |
| 212 | 217 | } |
| 213 | 218 | |
| 214 | - if (!$canbemodified) accessforbidden(); |
|
| 219 | + if (!$canbemodified) { |
|
| 220 | + accessforbidden(); |
|
| 221 | + } |
|
| 215 | 222 | |
| 216 | 223 | $idtomodify=$_POST["idtomodify".$modifier]; |
| 217 | 224 | $sql = 'UPDATE '.MAIN_DB_PREFIX."opensurvey_user_studs"; |
@@ -219,14 +226,18 @@ discard block |
||
| 219 | 226 | $sql.= " WHERE id_users = '".$db->escape($idtomodify)."'"; |
| 220 | 227 | |
| 221 | 228 | $resql = $db->query($sql); |
| 222 | - if (! $resql) dol_print_error($db); |
|
| 223 | -} |
|
| 229 | + if (! $resql) { |
|
| 230 | + dol_print_error($db); |
|
| 231 | + } |
|
| 232 | + } |
|
| 224 | 233 | |
| 225 | 234 | // Delete comment |
| 226 | 235 | $idcomment=GETPOST('deletecomment','int'); |
| 227 | 236 | if ($idcomment) |
| 228 | 237 | { |
| 229 | - if (!$canbemodified) accessforbidden(); |
|
| 238 | + if (!$canbemodified) { |
|
| 239 | + accessforbidden(); |
|
| 240 | + } |
|
| 230 | 241 | |
| 231 | 242 | $resql = $object->deleteComment($idcomment); |
| 232 | 243 | } |
@@ -243,9 +254,11 @@ discard block |
||
| 243 | 254 | $arrayofcss=array('/opensurvey/css/style.css'); |
| 244 | 255 | llxHeaderSurvey($object->titre, "", 0, 0, $arrayofjs, $arrayofcss); |
| 245 | 256 | |
| 246 | -if (empty($object->ref)) // For survey, id is a hex string |
|
| 257 | +if (empty($object->ref)) { |
|
| 258 | + // For survey, id is a hex string |
|
| 247 | 259 | { |
| 248 | 260 | $langs->load("errors"); |
| 261 | +} |
|
| 249 | 262 | print $langs->trans("ErrorRecordNotFound"); |
| 250 | 263 | |
| 251 | 264 | llxFooterSurvey(); |
@@ -384,8 +397,7 @@ discard block |
||
| 384 | 397 | |
| 385 | 398 | print '</tr>'."\n"; |
| 386 | 399 | } |
| 387 | -} |
|
| 388 | -else |
|
| 400 | +} else |
|
| 389 | 401 | { |
| 390 | 402 | //display of survey topics |
| 391 | 403 | print '<tr>'."\n"; |
@@ -444,37 +456,67 @@ discard block |
||
| 444 | 456 | |
| 445 | 457 | if (empty($listofanswers[$i]['format']) || ! in_array($listofanswers[$i]['format'],array('yesno','foragainst'))) |
| 446 | 458 | { |
| 447 | - if (((string) $car) == "1") print '<td class="ok">OK</td>'."\n"; |
|
| 448 | - else print '<td class="non">KO</td>'."\n"; |
|
| 459 | + if (((string) $car) == "1") { |
|
| 460 | + print '<td class="ok">OK</td>'."\n"; |
|
| 461 | + } else { |
|
| 462 | + print '<td class="non">KO</td>'."\n"; |
|
| 463 | + } |
|
| 449 | 464 | // Total |
| 450 | - if (! isset($sumfor[$i])) $sumfor[$i] = 0; |
|
| 451 | - if (((string) $car) == "1") $sumfor[$i]++; |
|
| 465 | + if (! isset($sumfor[$i])) { |
|
| 466 | + $sumfor[$i] = 0; |
|
| 467 | + } |
|
| 468 | + if (((string) $car) == "1") { |
|
| 469 | + $sumfor[$i]++; |
|
| 470 | + } |
|
| 452 | 471 | } |
| 453 | 472 | if (! empty($listofanswers[$i]['format']) && $listofanswers[$i]['format'] == 'yesno') |
| 454 | 473 | { |
| 455 | - if (((string) $car) == "1") print '<td class="ok">'.$langs->trans("Yes").'</td>'."\n"; |
|
| 456 | - else if (((string) $car) == "0") print '<td class="non">'.$langs->trans("No").'</td>'."\n"; |
|
| 457 | - else print '<td class="vide"> </td>'."\n"; |
|
| 474 | + if (((string) $car) == "1") { |
|
| 475 | + print '<td class="ok">'.$langs->trans("Yes").'</td>'."\n"; |
|
| 476 | + } else if (((string) $car) == "0") { |
|
| 477 | + print '<td class="non">'.$langs->trans("No").'</td>'."\n"; |
|
| 478 | + } else { |
|
| 479 | + print '<td class="vide"> </td>'."\n"; |
|
| 480 | + } |
|
| 458 | 481 | // Total |
| 459 | - if (! isset($sumfor[$i])) $sumfor[$i] = 0; |
|
| 460 | - if (! isset($sumagainst[$i])) $sumagainst[$i] = 0; |
|
| 461 | - if (((string) $car) == "1") $sumfor[$i]++; |
|
| 462 | - if (((string) $car) == "0") $sumagainst[$i]++; |
|
| 482 | + if (! isset($sumfor[$i])) { |
|
| 483 | + $sumfor[$i] = 0; |
|
| 484 | + } |
|
| 485 | + if (! isset($sumagainst[$i])) { |
|
| 486 | + $sumagainst[$i] = 0; |
|
| 487 | + } |
|
| 488 | + if (((string) $car) == "1") { |
|
| 489 | + $sumfor[$i]++; |
|
| 490 | + } |
|
| 491 | + if (((string) $car) == "0") { |
|
| 492 | + $sumagainst[$i]++; |
|
| 493 | + } |
|
| 463 | 494 | } |
| 464 | 495 | if (! empty($listofanswers[$i]['format']) && $listofanswers[$i]['format'] == 'foragainst') |
| 465 | 496 | { |
| 466 | - if (((string) $car) == "1") print '<td class="ok">'.$langs->trans("For").'</td>'."\n"; |
|
| 467 | - else if (((string) $car) == "0") print '<td class="non">'.$langs->trans("Against").'</td>'."\n"; |
|
| 468 | - else print '<td class="vide"> </td>'."\n"; |
|
| 497 | + if (((string) $car) == "1") { |
|
| 498 | + print '<td class="ok">'.$langs->trans("For").'</td>'."\n"; |
|
| 499 | + } else if (((string) $car) == "0") { |
|
| 500 | + print '<td class="non">'.$langs->trans("Against").'</td>'."\n"; |
|
| 501 | + } else { |
|
| 502 | + print '<td class="vide"> </td>'."\n"; |
|
| 503 | + } |
|
| 469 | 504 | // Total |
| 470 | - if (! isset($sumfor[$i])) $sumfor[$i] = 0; |
|
| 471 | - if (! isset($sumagainst[$i])) $sumagainst[$i] = 0; |
|
| 472 | - if (((string) $car) == "1") $sumfor[$i]++; |
|
| 473 | - if (((string) $car) == "0") $sumagainst[$i]++; |
|
| 505 | + if (! isset($sumfor[$i])) { |
|
| 506 | + $sumfor[$i] = 0; |
|
| 507 | + } |
|
| 508 | + if (! isset($sumagainst[$i])) { |
|
| 509 | + $sumagainst[$i] = 0; |
|
| 510 | + } |
|
| 511 | + if (((string) $car) == "1") { |
|
| 512 | + $sumfor[$i]++; |
|
| 513 | + } |
|
| 514 | + if (((string) $car) == "0") { |
|
| 515 | + $sumagainst[$i]++; |
|
| 516 | + } |
|
| 474 | 517 | } |
| 475 | 518 | } |
| 476 | - } |
|
| 477 | - else |
|
| 519 | + } else |
|
| 478 | 520 | { |
| 479 | 521 | //sinon on remplace les choix de l'utilisateur par une ligne de checkbox pour recuperer de nouvelles valeurs |
| 480 | 522 | if ($compteur == $ligneamodifier) |
@@ -486,7 +528,9 @@ discard block |
||
| 486 | 528 | if (empty($listofanswers[$i]['format']) || ! in_array($listofanswers[$i]['format'],array('yesno','foragainst'))) |
| 487 | 529 | { |
| 488 | 530 | print '<input type="checkbox" name="choix'.$i.'" value="1" '; |
| 489 | - if ($car == '1') print 'checked'; |
|
| 531 | + if ($car == '1') { |
|
| 532 | + print 'checked'; |
|
| 533 | + } |
|
| 490 | 534 | print '>'; |
| 491 | 535 | } |
| 492 | 536 | if (! empty($listofanswers[$i]['format']) && $listofanswers[$i]['format'] == 'yesno') |
@@ -501,41 +545,71 @@ discard block |
||
| 501 | 545 | } |
| 502 | 546 | print '</td>'."\n"; |
| 503 | 547 | } |
| 504 | - } |
|
| 505 | - else |
|
| 548 | + } else |
|
| 506 | 549 | { |
| 507 | 550 | for ($i = 0; $i < $nbcolonnes; $i++) |
| 508 | 551 | { |
| 509 | 552 | $car = substr($ensemblereponses, $i, 1); |
| 510 | 553 | if (empty($listofanswers[$i]['format']) || ! in_array($listofanswers[$i]['format'],array('yesno','foragainst'))) |
| 511 | 554 | { |
| 512 | - if (((string) $car) == "1") print '<td class="ok">OK</td>'."\n"; |
|
| 513 | - else print '<td class="non">KO</td>'."\n"; |
|
| 555 | + if (((string) $car) == "1") { |
|
| 556 | + print '<td class="ok">OK</td>'."\n"; |
|
| 557 | + } else { |
|
| 558 | + print '<td class="non">KO</td>'."\n"; |
|
| 559 | + } |
|
| 514 | 560 | // Total |
| 515 | - if (! isset($sumfor[$i])) $sumfor[$i] = 0; |
|
| 516 | - if (((string) $car) == "1") $sumfor[$i]++; |
|
| 561 | + if (! isset($sumfor[$i])) { |
|
| 562 | + $sumfor[$i] = 0; |
|
| 563 | + } |
|
| 564 | + if (((string) $car) == "1") { |
|
| 565 | + $sumfor[$i]++; |
|
| 566 | + } |
|
| 517 | 567 | } |
| 518 | 568 | if (! empty($listofanswers[$i]['format']) && $listofanswers[$i]['format'] == 'yesno') |
| 519 | 569 | { |
| 520 | - if (((string) $car) == "1") print '<td class="ok">'.$langs->trans("For").'</td>'."\n"; |
|
| 521 | - else if (((string) $car) == "0") print '<td class="non">'.$langs->trans("Against").'</td>'."\n"; |
|
| 522 | - else print '<td class="vide"> </td>'."\n"; |
|
| 570 | + if (((string) $car) == "1") { |
|
| 571 | + print '<td class="ok">'.$langs->trans("For").'</td>'."\n"; |
|
| 572 | + } else if (((string) $car) == "0") { |
|
| 573 | + print '<td class="non">'.$langs->trans("Against").'</td>'."\n"; |
|
| 574 | + } else { |
|
| 575 | + print '<td class="vide"> </td>'."\n"; |
|
| 576 | + } |
|
| 523 | 577 | // Total |
| 524 | - if (! isset($sumfor[$i])) $sumfor[$i] = 0; |
|
| 525 | - if (! isset($sumagainst[$i])) $sumagainst[$i] = 0; |
|
| 526 | - if (((string) $car) == "1") $sumfor[$i]++; |
|
| 527 | - if (((string) $car) == "0") $sumagainst[$i]++; |
|
| 578 | + if (! isset($sumfor[$i])) { |
|
| 579 | + $sumfor[$i] = 0; |
|
| 580 | + } |
|
| 581 | + if (! isset($sumagainst[$i])) { |
|
| 582 | + $sumagainst[$i] = 0; |
|
| 583 | + } |
|
| 584 | + if (((string) $car) == "1") { |
|
| 585 | + $sumfor[$i]++; |
|
| 586 | + } |
|
| 587 | + if (((string) $car) == "0") { |
|
| 588 | + $sumagainst[$i]++; |
|
| 589 | + } |
|
| 528 | 590 | } |
| 529 | 591 | if (! empty($listofanswers[$i]['format']) && $listofanswers[$i]['format'] == 'foragainst') |
| 530 | 592 | { |
| 531 | - if (((string) $car) == "1") print '<td class="ok">'.$langs->trans("For").'</td>'."\n"; |
|
| 532 | - else if (((string) $car) == "0") print '<td class="non">'.$langs->trans("Against").'</td>'."\n"; |
|
| 533 | - else print '<td class="vide"> </td>'."\n"; |
|
| 593 | + if (((string) $car) == "1") { |
|
| 594 | + print '<td class="ok">'.$langs->trans("For").'</td>'."\n"; |
|
| 595 | + } else if (((string) $car) == "0") { |
|
| 596 | + print '<td class="non">'.$langs->trans("Against").'</td>'."\n"; |
|
| 597 | + } else { |
|
| 598 | + print '<td class="vide"> </td>'."\n"; |
|
| 599 | + } |
|
| 534 | 600 | // Total |
| 535 | - if (! isset($sumfor[$i])) $sumfor[$i] = 0; |
|
| 536 | - if (! isset($sumagainst[$i])) $sumagainst[$i] = 0; |
|
| 537 | - if (((string) $car) == "1") $sumfor[$i]++; |
|
| 538 | - if (((string) $car) == "0") $sumagainst[$i]++; |
|
| 601 | + if (! isset($sumfor[$i])) { |
|
| 602 | + $sumfor[$i] = 0; |
|
| 603 | + } |
|
| 604 | + if (! isset($sumagainst[$i])) { |
|
| 605 | + $sumagainst[$i] = 0; |
|
| 606 | + } |
|
| 607 | + if (((string) $car) == "1") { |
|
| 608 | + $sumfor[$i]++; |
|
| 609 | + } |
|
| 610 | + if (((string) $car) == "0") { |
|
| 611 | + $sumagainst[$i]++; |
|
| 612 | + } |
|
| 539 | 613 | } |
| 540 | 614 | } |
| 541 | 615 | } |
@@ -614,8 +688,9 @@ discard block |
||
| 614 | 688 | $nbofcheckbox=0; |
| 615 | 689 | for ($i=0; $i < $nbcolonnes; $i++) |
| 616 | 690 | { |
| 617 | - if (empty($listofanswers[$i]['format']) || ! in_array($listofanswers[$i]['format'],array('yesno','foragainst'))) |
|
| 618 | - $nbofcheckbox++; |
|
| 691 | + if (empty($listofanswers[$i]['format']) || ! in_array($listofanswers[$i]['format'],array('yesno','foragainst'))) { |
|
| 692 | + $nbofcheckbox++; |
|
| 693 | + } |
|
| 619 | 694 | if (isset($sumfor[$i])) |
| 620 | 695 | { |
| 621 | 696 | if ($i == 0) |
@@ -637,13 +712,23 @@ discard block |
||
| 637 | 712 | { |
| 638 | 713 | $showsumfor = isset($sumfor[$i])?$sumfor[$i]:''; |
| 639 | 714 | $showsumagainst = isset($sumagainst[$i])?$sumagainst[$i]:''; |
| 640 | - if (empty($showsumfor)) $showsumfor = 0; |
|
| 641 | - if (empty($showsumagainst)) $showsumagainst = 0; |
|
| 715 | + if (empty($showsumfor)) { |
|
| 716 | + $showsumfor = 0; |
|
| 717 | + } |
|
| 718 | + if (empty($showsumagainst)) { |
|
| 719 | + $showsumagainst = 0; |
|
| 720 | + } |
|
| 642 | 721 | |
| 643 | 722 | 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; |
|
| 723 | + if (empty($listofanswers[$i]['format']) || ! in_array($listofanswers[$i]['format'],array('yesno','foragainst'))) { |
|
| 724 | + print $showsumfor; |
|
| 725 | + } |
|
| 726 | + if (! empty($listofanswers[$i]['format']) && $listofanswers[$i]['format'] == 'yesno') { |
|
| 727 | + print $langs->trans("Yes").': '.$showsumfor.'<br>'.$langs->trans("No").': '.$showsumagainst; |
|
| 728 | + } |
|
| 729 | + if (! empty($listofanswers[$i]['format']) && $listofanswers[$i]['format'] == 'foragainst') { |
|
| 730 | + print $langs->trans("For").': '.$showsumfor.'<br>'.$langs->trans("Against").': '.$showsumagainst; |
|
| 731 | + } |
|
| 647 | 732 | print '</td>'."\n"; |
| 648 | 733 | } |
| 649 | 734 | print '</tr>'; |
@@ -687,8 +772,7 @@ discard block |
||
| 687 | 772 | } else { |
| 688 | 773 | $meilleursujet .= dol_print_date($toutsujet[$i],'daytext'). ' ('.dol_print_date($toutsujet[$i],'%A').')'; |
| 689 | 774 | } |
| 690 | - } |
|
| 691 | - else |
|
| 775 | + } else |
|
| 692 | 776 | { |
| 693 | 777 | $tmps=explode('@',$toutsujet[$i]); |
| 694 | 778 | $meilleursujet .= dol_htmlentities($tmps[0]); |
@@ -730,7 +814,9 @@ discard block |
||
| 730 | 814 | |
| 731 | 815 | foreach ($comments as $obj) { |
| 732 | 816 | print '<div class="comment"><span class="usercomment">'; |
| 733 | - if (in_array($obj->usercomment, $listofvoters)) print '<a href="'.$_SERVER["PHP_SELF"].'?deletecomment='.$obj->id_comment.'&sondage='.$numsondage.'"> '.img_picto('', 'delete.png').'</a> '; |
|
| 817 | + if (in_array($obj->usercomment, $listofvoters)) { |
|
| 818 | + print '<a href="'.$_SERVER["PHP_SELF"].'?deletecomment='.$obj->id_comment.'&sondage='.$numsondage.'"> '.img_picto('', 'delete.png').'</a> '; |
|
| 819 | + } |
|
| 734 | 820 | print dol_htmlentities($obj->usercomment).':</span> <span class="comment">'.dol_nl2br(dol_htmlentities($obj->comment))."</span></div>"; |
| 735 | 821 | } |
| 736 | 822 | } |
@@ -52,8 +52,7 @@ discard block |
||
| 52 | 52 | |
| 53 | 53 | |
| 54 | 54 | <?php |
| 55 | -} |
|
| 56 | -else |
|
| 55 | +} else |
|
| 57 | 56 | { |
| 58 | 57 | $arraycss=array(); |
| 59 | 58 | $arrayjs=array(); |
@@ -167,19 +166,39 @@ discard block |
||
| 167 | 166 | $sortorder='ASC'; |
| 168 | 167 | $tasksarray=array(1,2,3); // To force having several lines |
| 169 | 168 | $tagidfortablednd='tablelines3'; |
| 170 | -if (! empty($conf->use_javascript_ajax)) include DOL_DOCUMENT_ROOT.'/core/tpl/ajaxrow.tpl.php'; |
|
| 169 | +if (! empty($conf->use_javascript_ajax)) { |
|
| 170 | + include DOL_DOCUMENT_ROOT.'/core/tpl/ajaxrow.tpl.php'; |
|
| 171 | +} |
|
| 171 | 172 | |
| 172 | 173 | $nav=''; |
| 173 | 174 | $nav.='<form name="dateselect" action="'.$_SERVER["PHP_SELF"].'?action=show_peruser'.$param.'">'; |
| 174 | -if ($actioncode || isset($_GET['actioncode']) || isset($_POST['actioncode'])) $nav.='<input type="hidden" name="actioncode" value="'.$actioncode.'">'; |
|
| 175 | -if ($status || isset($_GET['status']) || isset($_POST['status'])) $nav.='<input type="hidden" name="status" value="'.$status.'">'; |
|
| 176 | -if ($filter) $nav.='<input type="hidden" name="filter" value="'.$filter.'">'; |
|
| 177 | -if ($filtert) $nav.='<input type="hidden" name="filtert" value="'.$filtert.'">'; |
|
| 178 | -if ($socid) $nav.='<input type="hidden" name="socid" value="'.$socid.'">'; |
|
| 179 | -if ($showbirthday) $nav.='<input type="hidden" name="showbirthday" value="1">'; |
|
| 180 | -if ($pid) $nav.='<input type="hidden" name="projectid" value="'.$pid.'">'; |
|
| 181 | -if ($type) $nav.='<input type="hidden" name="type" value="'.$type.'">'; |
|
| 182 | -if ($usergroup) $nav.='<input type="hidden" name="usergroup" value="'.$usergroup.'">'; |
|
| 175 | +if ($actioncode || isset($_GET['actioncode']) || isset($_POST['actioncode'])) { |
|
| 176 | + $nav.='<input type="hidden" name="actioncode" value="'.$actioncode.'">'; |
|
| 177 | +} |
|
| 178 | +if ($status || isset($_GET['status']) || isset($_POST['status'])) { |
|
| 179 | + $nav.='<input type="hidden" name="status" value="'.$status.'">'; |
|
| 180 | +} |
|
| 181 | +if ($filter) { |
|
| 182 | + $nav.='<input type="hidden" name="filter" value="'.$filter.'">'; |
|
| 183 | +} |
|
| 184 | +if ($filtert) { |
|
| 185 | + $nav.='<input type="hidden" name="filtert" value="'.$filtert.'">'; |
|
| 186 | +} |
|
| 187 | +if ($socid) { |
|
| 188 | + $nav.='<input type="hidden" name="socid" value="'.$socid.'">'; |
|
| 189 | +} |
|
| 190 | +if ($showbirthday) { |
|
| 191 | + $nav.='<input type="hidden" name="showbirthday" value="1">'; |
|
| 192 | +} |
|
| 193 | +if ($pid) { |
|
| 194 | + $nav.='<input type="hidden" name="projectid" value="'.$pid.'">'; |
|
| 195 | +} |
|
| 196 | +if ($type) { |
|
| 197 | + $nav.='<input type="hidden" name="type" value="'.$type.'">'; |
|
| 198 | +} |
|
| 199 | +if ($usergroup) { |
|
| 200 | + $nav.='<input type="hidden" name="usergroup" value="'.$usergroup.'">'; |
|
| 201 | +} |
|
| 183 | 202 | $nav.=$form->select_date($dateselect, 'dateselect', 0, 0, 1, '', 1, 0, 1); |
| 184 | 203 | $nav.=' <input type="submit" name="submitdateselect" class="button" value="'.$langs->trans("Refresh").'">'; |
| 185 | 204 | $nav.='</form>'; |
@@ -301,8 +320,10 @@ discard block |
||
| 301 | 320 | <?php |
| 302 | 321 | $tasksarray=array(1,2,3); // To force having several lines |
| 303 | 322 | $tagidfortablednd='tablelines'; |
| 304 | - if (! empty($conf->use_javascript_ajax)) include DOL_DOCUMENT_ROOT.'/core/tpl/ajaxrow.tpl.php'; |
|
| 305 | -?> |
|
| 323 | + if (! empty($conf->use_javascript_ajax)) { |
|
| 324 | + include DOL_DOCUMENT_ROOT.'/core/tpl/ajaxrow.tpl.php'; |
|
| 325 | + } |
|
| 326 | + ?> |
|
| 306 | 327 | <div class="tagtable centpercent liste_titre_bydiv" id="tablelines"> |
| 307 | 328 | <div class="tagtr liste_titre"> |
| 308 | 329 | <div class="tagtd">Title A<input type="hidden" name="cartitem" value="3"></div> |
@@ -1,22 +1,53 @@ |
||
| 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')) { |
|
| 4 | + define('NOREQUIREUSER','1'); |
|
| 5 | +} |
|
| 6 | +if (! defined('NOREQUIREDB')) { |
|
| 7 | + define('NOREQUIREDB','1'); |
|
| 8 | +} |
|
| 9 | +if (! defined('NOREQUIRESOC')) { |
|
| 10 | + define('NOREQUIRESOC','1'); |
|
| 11 | +} |
|
| 12 | +if (! defined('NOREQUIRETRAN')) { |
|
| 13 | + define('NOREQUIRETRAN','1'); |
|
| 14 | +} |
|
| 15 | +if (! defined('NOSTYLECHECK')) { |
|
| 16 | + define('NOSTYLECHECK','1'); |
|
| 17 | +} |
|
| 18 | +// Do not check style html tag into posted data |
|
| 19 | +if (! defined('NOCSRFCHECK')) { |
|
| 20 | + define('NOCSRFCHECK','1'); |
|
| 21 | +} |
|
| 22 | +// Do not check anti CSRF attack test |
|
| 23 | +if (! defined('NOTOKENRENEWAL')) { |
|
| 24 | + define('NOTOKENRENEWAL','1'); |
|
| 25 | +} |
|
| 26 | +// Do not check anti POST attack test |
|
| 27 | +if (! defined('NOREQUIREMENU')) { |
|
| 28 | + define('NOREQUIREMENU','1'); |
|
| 29 | +} |
|
| 30 | +// If there is no need to load and show top and left menu |
|
| 31 | +if (! defined('NOREQUIREHTML')) { |
|
| 32 | + define('NOREQUIREHTML','1'); |
|
| 33 | +} |
|
| 34 | +// If we don't need to load the html.form.class.php |
|
| 35 | +if (! defined('NOREQUIREAJAX')) { |
|
| 36 | + define('NOREQUIREAJAX','1'); |
|
| 37 | +} |
|
| 38 | +// Do not load ajax.lib.php library |
|
| 39 | +if (! defined("NOLOGIN")) { |
|
| 40 | + define("NOLOGIN",'1'); |
|
| 41 | +} |
|
| 42 | +// If this page is public (can be called outside logged session) |
|
| 14 | 43 | // If you don't need session management (can't be logged if no session used). You must also set |
| 15 | 44 | // NOCSRFCHECK, NOTOKENRENEWAL, NOLOGIN |
| 16 | 45 | // Disable module with GETPOST('disablemodules') won't work. Variable 'dol_...' will not be set. |
| 17 | 46 | // $_SESSION are then simple vars if sessions are not active. |
| 18 | 47 | // TODO We can close session with session_write_close() as soon as we just need read access. |
| 19 | -if (! defined("NOSESSION")) define("NOSESSION",'1'); |
|
| 48 | +if (! defined("NOSESSION")) { |
|
| 49 | + define("NOSESSION",'1'); |
|
| 50 | +} |
|
| 20 | 51 | |
| 21 | 52 | define('REQUIRE_JQUERY_MULTISELECT','select2'); |
| 22 | 53 | |