@@ -140,12 +140,12 @@ discard block |
||
140 | 140 | $appli=constant('DOL_APPLICATION_TITLE'); |
141 | 141 | if (! empty($conf->global->MAIN_APPLICATION_TITLE)) |
142 | 142 | { |
143 | - $appli=$conf->global->MAIN_APPLICATION_TITLE; |
|
144 | - if (preg_match('/\d\.\d/', $appli)) |
|
145 | - { |
|
146 | - if (! preg_match('/'.preg_quote(DOL_VERSION).'/', $appli)) $appli.=" (".DOL_VERSION.")"; // If new title contains a version that is different than core |
|
147 | - } |
|
148 | - else $appli.=" ".DOL_VERSION; |
|
143 | + $appli=$conf->global->MAIN_APPLICATION_TITLE; |
|
144 | + if (preg_match('/\d\.\d/', $appli)) |
|
145 | + { |
|
146 | + if (! preg_match('/'.preg_quote(DOL_VERSION).'/', $appli)) $appli.=" (".DOL_VERSION.")"; // If new title contains a version that is different than core |
|
147 | + } |
|
148 | + else $appli.=" ".DOL_VERSION; |
|
149 | 149 | } |
150 | 150 | else $appli.=" ".DOL_VERSION; |
151 | 151 | |
@@ -167,7 +167,7 @@ discard block |
||
167 | 167 | } |
168 | 168 | $content.="<br>\n"; |
169 | 169 | $content.=$langs->transnoentitiesnoconv("TechnicalInformation").":<br>\n"; |
170 | - $content.=$langs->transnoentitiesnoconv("OnlinePaymentSystem").': '.$paymentmethod."<br>\n"; |
|
170 | + $content.=$langs->transnoentitiesnoconv("OnlinePaymentSystem").': '.$paymentmethod."<br>\n"; |
|
171 | 171 | $content.=$langs->transnoentitiesnoconv("ReturnURLAfterPayment").': '.$urlback."<br>\n"; |
172 | 172 | $content.="tag=".$fulltag."<br>\n"; |
173 | 173 |
@@ -22,13 +22,13 @@ discard block |
||
22 | 22 | * \brief File to show page after a successful payment |
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 | |
28 | 28 | // For MultiCompany module. |
29 | 29 | // Do not use GETPOST here, function is not defined and define must be done before including main.inc.php |
30 | 30 | // TODO This should be useless. Because entity must be retreive from object ref and not from url. |
31 | -$entity=(! empty($_GET['entity']) ? (int) $_GET['entity'] : (! empty($_POST['entity']) ? (int) $_POST['entity'] : 1)); |
|
31 | +$entity = (!empty($_GET['entity']) ? (int) $_GET['entity'] : (!empty($_POST['entity']) ? (int) $_POST['entity'] : 1)); |
|
32 | 32 | if (is_numeric($entity)) define("DOLENTITY", $entity); |
33 | 33 | |
34 | 34 | require '../../main.inc.php'; |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php'; |
38 | 38 | |
39 | 39 | // Security check |
40 | -if (empty($conf->paybox->enabled)) accessforbidden('',0,0,1); |
|
40 | +if (empty($conf->paybox->enabled)) accessforbidden('', 0, 0, 1); |
|
41 | 41 | |
42 | 42 | $langs->load("main"); |
43 | 43 | $langs->load("other"); |
@@ -55,13 +55,13 @@ discard block |
||
55 | 55 | $PAYBOXPAYERID=GETPOST('PAYERID'); |
56 | 56 | if (empty($PAYBOXPAYERID)) $PAYBOXPAYERID=GETPOST('PayerID'); |
57 | 57 | */ |
58 | -$FULLTAG=GETPOST('FULLTAG'); |
|
59 | -if (empty($FULLTAG)) $FULLTAG=GETPOST('fulltag'); |
|
58 | +$FULLTAG = GETPOST('FULLTAG'); |
|
59 | +if (empty($FULLTAG)) $FULLTAG = GETPOST('fulltag'); |
|
60 | 60 | |
61 | 61 | |
62 | -$object = new stdClass(); // For triggers |
|
62 | +$object = new stdClass(); // For triggers |
|
63 | 63 | |
64 | -$paymentmethod='paybox'; |
|
64 | +$paymentmethod = 'paybox'; |
|
65 | 65 | |
66 | 66 | |
67 | 67 | /* |
@@ -76,18 +76,18 @@ discard block |
||
76 | 76 | * View |
77 | 77 | */ |
78 | 78 | |
79 | -dol_syslog("Callback url when a PayBox payment was done. query_string=".(dol_escape_htmltag($_SERVER["QUERY_STRING"])?dol_escape_htmltag($_SERVER["QUERY_STRING"]):'')." script_uri=".(dol_escape_htmltag($_SERVER["SCRIPT_URI"])?dol_escape_htmltag($_SERVER["SCRIPT_URI"]):''), LOG_DEBUG, 0, '_paybox'); |
|
79 | +dol_syslog("Callback url when a PayBox payment was done. query_string=".(dol_escape_htmltag($_SERVER["QUERY_STRING"]) ?dol_escape_htmltag($_SERVER["QUERY_STRING"]) : '')." script_uri=".(dol_escape_htmltag($_SERVER["SCRIPT_URI"]) ?dol_escape_htmltag($_SERVER["SCRIPT_URI"]) : ''), LOG_DEBUG, 0, '_paybox'); |
|
80 | 80 | |
81 | 81 | $tracepost = ""; |
82 | -foreach($_POST as $k => $v) $tracepost .= "{$k} - {$v}\n"; |
|
82 | +foreach ($_POST as $k => $v) $tracepost .= "{$k} - {$v}\n"; |
|
83 | 83 | dol_syslog("POST=".$tracepost, LOG_DEBUG, 0, '_paybox'); |
84 | 84 | |
85 | 85 | |
86 | -$head=''; |
|
87 | -if (! empty($conf->global->ONLINE_PAYMENT_CSS_URL)) $head='<link rel="stylesheet" type="text/css" href="'.$conf->global->ONLINE_PAYMENT_CSS_URL.'?lang='.$langs->defaultlang.'">'."\n"; |
|
86 | +$head = ''; |
|
87 | +if (!empty($conf->global->ONLINE_PAYMENT_CSS_URL)) $head = '<link rel="stylesheet" type="text/css" href="'.$conf->global->ONLINE_PAYMENT_CSS_URL.'?lang='.$langs->defaultlang.'">'."\n"; |
|
88 | 88 | |
89 | -$conf->dol_hide_topmenu=1; |
|
90 | -$conf->dol_hide_leftmenu=1; |
|
89 | +$conf->dol_hide_topmenu = 1; |
|
90 | +$conf->dol_hide_leftmenu = 1; |
|
91 | 91 | |
92 | 92 | llxHeader($head, $langs->trans("PaymentForm"), '', '', 0, 0, '', '', '', 'onlinepaymentbody'); |
93 | 93 | |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | /* |
101 | 101 | $onlinetoken = $PAYBOXTOKEN; |
102 | 102 | */ |
103 | -$fulltag = $FULLTAG; |
|
103 | +$fulltag = $FULLTAG; |
|
104 | 104 | /*$payerID = $PAYBOXPAYERID; |
105 | 105 | // Set by newpayment.php |
106 | 106 | $paymentType = $_SESSION['PaymentType']; |
@@ -115,70 +115,70 @@ discard block |
||
115 | 115 | |
116 | 116 | print $langs->trans("YourPaymentHasBeenRecorded")."<br><br>\n"; |
117 | 117 | |
118 | -$key='ONLINE_PAYMENT_MESSAGE_OK'; |
|
119 | -if (! empty($conf->global->$key)) print $conf->global->$key; |
|
118 | +$key = 'ONLINE_PAYMENT_MESSAGE_OK'; |
|
119 | +if (!empty($conf->global->$key)) print $conf->global->$key; |
|
120 | 120 | |
121 | 121 | |
122 | 122 | // Appel des triggers |
123 | -include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; |
|
124 | -$interface=new Interfaces($db); |
|
125 | -$result=$interface->run_triggers('PAYBOX_PAYMENT_OK',$object,$user,$langs,$conf); |
|
126 | -if ($result < 0) { $error++; $errors=$interface->errors; } |
|
123 | +include_once DOL_DOCUMENT_ROOT.'/core/class/interfaces.class.php'; |
|
124 | +$interface = new Interfaces($db); |
|
125 | +$result = $interface->run_triggers('PAYBOX_PAYMENT_OK', $object, $user, $langs, $conf); |
|
126 | +if ($result < 0) { $error++; $errors = $interface->errors; } |
|
127 | 127 | // Fin appel triggers |
128 | 128 | |
129 | 129 | |
130 | 130 | // Send an email |
131 | -if (! empty($conf->global->ONLINE_PAYMENT_SENDEMAIL)) |
|
131 | +if (!empty($conf->global->ONLINE_PAYMENT_SENDEMAIL)) |
|
132 | 132 | { |
133 | - $sendto=$conf->global->ONLINE_PAYMENT_SENDEMAIL; |
|
134 | - $from=$conf->global->MAILING_EMAIL_FROM; |
|
133 | + $sendto = $conf->global->ONLINE_PAYMENT_SENDEMAIL; |
|
134 | + $from = $conf->global->MAILING_EMAIL_FROM; |
|
135 | 135 | // Define $urlwithroot |
136 | - $urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT,'/').'$/i','',trim($dolibarr_main_url_root)); |
|
137 | - $urlwithroot=$urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file |
|
136 | + $urlwithouturlroot = preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root)); |
|
137 | + $urlwithroot = $urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file |
|
138 | 138 | //$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current |
139 | 139 | |
140 | 140 | // Define link to login card |
141 | - $appli=constant('DOL_APPLICATION_TITLE'); |
|
142 | - if (! empty($conf->global->MAIN_APPLICATION_TITLE)) |
|
141 | + $appli = constant('DOL_APPLICATION_TITLE'); |
|
142 | + if (!empty($conf->global->MAIN_APPLICATION_TITLE)) |
|
143 | 143 | { |
144 | - $appli=$conf->global->MAIN_APPLICATION_TITLE; |
|
144 | + $appli = $conf->global->MAIN_APPLICATION_TITLE; |
|
145 | 145 | if (preg_match('/\d\.\d/', $appli)) |
146 | 146 | { |
147 | - if (! preg_match('/'.preg_quote(DOL_VERSION).'/', $appli)) $appli.=" (".DOL_VERSION.")"; // If new title contains a version that is different than core |
|
147 | + if (!preg_match('/'.preg_quote(DOL_VERSION).'/', $appli)) $appli .= " (".DOL_VERSION.")"; // If new title contains a version that is different than core |
|
148 | 148 | } |
149 | - else $appli.=" ".DOL_VERSION; |
|
149 | + else $appli .= " ".DOL_VERSION; |
|
150 | 150 | } |
151 | - else $appli.=" ".DOL_VERSION; |
|
151 | + else $appli .= " ".DOL_VERSION; |
|
152 | 152 | |
153 | - $urlback=$_SERVER["REQUEST_URI"]; |
|
154 | - $topic='['.$appli.'] '.$langs->transnoentitiesnoconv("NewOnlinePaymentReceived"); |
|
155 | - $tmptag=dolExplodeIntoArray($fulltag,'.','='); |
|
156 | - $content=""; |
|
157 | - if (! empty($tmptag['MEM'])) |
|
153 | + $urlback = $_SERVER["REQUEST_URI"]; |
|
154 | + $topic = '['.$appli.'] '.$langs->transnoentitiesnoconv("NewOnlinePaymentReceived"); |
|
155 | + $tmptag = dolExplodeIntoArray($fulltag, '.', '='); |
|
156 | + $content = ""; |
|
157 | + if (!empty($tmptag['MEM'])) |
|
158 | 158 | { |
159 | 159 | $langs->load("members"); |
160 | - $url=$urlwithroot."/adherents/card_subscriptions.php?rowid=".$tmptag['MEM']; |
|
161 | - $content.=$langs->trans("PaymentSubscription")."<br>\n"; |
|
162 | - $content.=$langs->trans("MemberId").': '.$tmptag['MEM']."<br>\n"; |
|
163 | - $content.=$langs->trans("Link").': <a href="'.$url.'">'.$url.'</a>'."<br>\n"; |
|
160 | + $url = $urlwithroot."/adherents/card_subscriptions.php?rowid=".$tmptag['MEM']; |
|
161 | + $content .= $langs->trans("PaymentSubscription")."<br>\n"; |
|
162 | + $content .= $langs->trans("MemberId").': '.$tmptag['MEM']."<br>\n"; |
|
163 | + $content .= $langs->trans("Link").': <a href="'.$url.'">'.$url.'</a>'."<br>\n"; |
|
164 | 164 | } |
165 | 165 | else |
166 | 166 | { |
167 | - $content.=$langs->transnoentitiesnoconv("NewOnlinePaymentReceived")."<br>\n"; |
|
167 | + $content .= $langs->transnoentitiesnoconv("NewOnlinePaymentReceived")."<br>\n"; |
|
168 | 168 | } |
169 | - $content.="<br>\n"; |
|
170 | - $content.=$langs->transnoentitiesnoconv("TechnicalInformation").":<br>\n"; |
|
171 | - $content.=$langs->transnoentitiesnoconv("OnlinePaymentSystem").': '.$paymentmethod."<br>\n"; |
|
172 | - $content.=$langs->transnoentitiesnoconv("ReturnURLAfterPayment").': '.$urlback."<br>\n"; |
|
173 | - $content.="tag=".$fulltag."<br>\n"; |
|
169 | + $content .= "<br>\n"; |
|
170 | + $content .= $langs->transnoentitiesnoconv("TechnicalInformation").":<br>\n"; |
|
171 | + $content .= $langs->transnoentitiesnoconv("OnlinePaymentSystem").': '.$paymentmethod."<br>\n"; |
|
172 | + $content .= $langs->transnoentitiesnoconv("ReturnURLAfterPayment").': '.$urlback."<br>\n"; |
|
173 | + $content .= "tag=".$fulltag."<br>\n"; |
|
174 | 174 | |
175 | - $ishtml=dol_textishtml($content); // May contain urls |
|
175 | + $ishtml = dol_textishtml($content); // May contain urls |
|
176 | 176 | |
177 | 177 | require_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php'; |
178 | 178 | $mailfile = new CMailFile($topic, $sendto, $from, $content, array(), array(), array(), '', '', 0, $ishtml); |
179 | 179 | |
180 | 180 | // Send an email |
181 | - $result=$mailfile->sendfile(); |
|
181 | + $result = $mailfile->sendfile(); |
|
182 | 182 | if ($result) |
183 | 183 | { |
184 | 184 | dol_syslog("EMail sent to ".$sendto, LOG_DEBUG, 0, '_paybox'); |
@@ -193,7 +193,7 @@ discard block |
||
193 | 193 | |
194 | 194 | print "\n</div>\n"; |
195 | 195 | |
196 | -htmlPrintOnlinePaymentFooter($mysoc,$langs,0,$suffix); |
|
196 | +htmlPrintOnlinePaymentFooter($mysoc, $langs, 0, $suffix); |
|
197 | 197 | |
198 | 198 | |
199 | 199 | llxFooter('', 'public'); |
@@ -29,7 +29,9 @@ discard block |
||
29 | 29 | // Do not use GETPOST here, function is not defined and define must be done before including main.inc.php |
30 | 30 | // TODO This should be useless. Because entity must be retreive from object ref and not from url. |
31 | 31 | $entity=(! empty($_GET['entity']) ? (int) $_GET['entity'] : (! empty($_POST['entity']) ? (int) $_POST['entity'] : 1)); |
32 | -if (is_numeric($entity)) define("DOLENTITY", $entity); |
|
32 | +if (is_numeric($entity)) { |
|
33 | + define("DOLENTITY", $entity); |
|
34 | +} |
|
33 | 35 | |
34 | 36 | require '../../main.inc.php'; |
35 | 37 | require_once DOL_DOCUMENT_ROOT.'/paybox/lib/paybox.lib.php'; |
@@ -37,7 +39,9 @@ discard block |
||
37 | 39 | require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php'; |
38 | 40 | |
39 | 41 | // Security check |
40 | -if (empty($conf->paybox->enabled)) accessforbidden('',0,0,1); |
|
42 | +if (empty($conf->paybox->enabled)) { |
|
43 | + accessforbidden('',0,0,1); |
|
44 | +} |
|
41 | 45 | |
42 | 46 | $langs->load("main"); |
43 | 47 | $langs->load("other"); |
@@ -56,7 +60,9 @@ discard block |
||
56 | 60 | if (empty($PAYBOXPAYERID)) $PAYBOXPAYERID=GETPOST('PayerID'); |
57 | 61 | */ |
58 | 62 | $FULLTAG=GETPOST('FULLTAG'); |
59 | -if (empty($FULLTAG)) $FULLTAG=GETPOST('fulltag'); |
|
63 | +if (empty($FULLTAG)) { |
|
64 | + $FULLTAG=GETPOST('fulltag'); |
|
65 | +} |
|
60 | 66 | |
61 | 67 | |
62 | 68 | $object = new stdClass(); // For triggers |
@@ -79,12 +85,16 @@ discard block |
||
79 | 85 | dol_syslog("Callback url when a PayBox payment was done. query_string=".(dol_escape_htmltag($_SERVER["QUERY_STRING"])?dol_escape_htmltag($_SERVER["QUERY_STRING"]):'')." script_uri=".(dol_escape_htmltag($_SERVER["SCRIPT_URI"])?dol_escape_htmltag($_SERVER["SCRIPT_URI"]):''), LOG_DEBUG, 0, '_paybox'); |
80 | 86 | |
81 | 87 | $tracepost = ""; |
82 | -foreach($_POST as $k => $v) $tracepost .= "{$k} - {$v}\n"; |
|
88 | +foreach($_POST as $k => $v) { |
|
89 | + $tracepost .= "{$k} - {$v}\n"; |
|
90 | +} |
|
83 | 91 | dol_syslog("POST=".$tracepost, LOG_DEBUG, 0, '_paybox'); |
84 | 92 | |
85 | 93 | |
86 | 94 | $head=''; |
87 | -if (! empty($conf->global->ONLINE_PAYMENT_CSS_URL)) $head='<link rel="stylesheet" type="text/css" href="'.$conf->global->ONLINE_PAYMENT_CSS_URL.'?lang='.$langs->defaultlang.'">'."\n"; |
|
95 | +if (! empty($conf->global->ONLINE_PAYMENT_CSS_URL)) { |
|
96 | + $head='<link rel="stylesheet" type="text/css" href="'.$conf->global->ONLINE_PAYMENT_CSS_URL.'?lang='.$langs->defaultlang.'">'."\n"; |
|
97 | +} |
|
88 | 98 | |
89 | 99 | $conf->dol_hide_topmenu=1; |
90 | 100 | $conf->dol_hide_leftmenu=1; |
@@ -116,7 +126,9 @@ discard block |
||
116 | 126 | print $langs->trans("YourPaymentHasBeenRecorded")."<br><br>\n"; |
117 | 127 | |
118 | 128 | $key='ONLINE_PAYMENT_MESSAGE_OK'; |
119 | -if (! empty($conf->global->$key)) print $conf->global->$key; |
|
129 | +if (! empty($conf->global->$key)) { |
|
130 | + print $conf->global->$key; |
|
131 | +} |
|
120 | 132 | |
121 | 133 | |
122 | 134 | // Appel des triggers |
@@ -144,11 +156,16 @@ discard block |
||
144 | 156 | $appli=$conf->global->MAIN_APPLICATION_TITLE; |
145 | 157 | if (preg_match('/\d\.\d/', $appli)) |
146 | 158 | { |
147 | - if (! preg_match('/'.preg_quote(DOL_VERSION).'/', $appli)) $appli.=" (".DOL_VERSION.")"; // If new title contains a version that is different than core |
|
159 | + if (! preg_match('/'.preg_quote(DOL_VERSION).'/', $appli)) { |
|
160 | + $appli.=" (".DOL_VERSION.")"; |
|
161 | + } |
|
162 | + // If new title contains a version that is different than core |
|
163 | + } else { |
|
164 | + $appli.=" ".DOL_VERSION; |
|
148 | 165 | } |
149 | - else $appli.=" ".DOL_VERSION; |
|
166 | + } else { |
|
167 | + $appli.=" ".DOL_VERSION; |
|
150 | 168 | } |
151 | - else $appli.=" ".DOL_VERSION; |
|
152 | 169 | |
153 | 170 | $urlback=$_SERVER["REQUEST_URI"]; |
154 | 171 | $topic='['.$appli.'] '.$langs->transnoentitiesnoconv("NewOnlinePaymentReceived"); |
@@ -161,8 +178,7 @@ discard block |
||
161 | 178 | $content.=$langs->trans("PaymentSubscription")."<br>\n"; |
162 | 179 | $content.=$langs->trans("MemberId").': '.$tmptag['MEM']."<br>\n"; |
163 | 180 | $content.=$langs->trans("Link").': <a href="'.$url.'">'.$url.'</a>'."<br>\n"; |
164 | - } |
|
165 | - else |
|
181 | + } else |
|
166 | 182 | { |
167 | 183 | $content.=$langs->transnoentitiesnoconv("NewOnlinePaymentReceived")."<br>\n"; |
168 | 184 | } |
@@ -182,8 +198,7 @@ discard block |
||
182 | 198 | if ($result) |
183 | 199 | { |
184 | 200 | dol_syslog("EMail sent to ".$sendto, LOG_DEBUG, 0, '_paybox'); |
185 | - } |
|
186 | - else |
|
201 | + } else |
|
187 | 202 | { |
188 | 203 | dol_syslog("Failed to send EMail to ".$sendto, LOG_ERR, 0, '_paybox'); |
189 | 204 | } |
@@ -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 |
@@ -98,12 +98,12 @@ discard block |
||
98 | 98 | 'icon'=>DOL_URL_ROOT.'/public/demo/demo-profile-foundation.jpg', |
99 | 99 | 'url'=>$url |
100 | 100 | ), |
101 | - // All demo profile |
|
102 | - array('default'=>'0', 'key'=>'profdemoall','label'=>'ChooseYourDemoProfilMore', |
|
101 | + // All demo profile |
|
102 | + array('default'=>'0', 'key'=>'profdemoall','label'=>'ChooseYourDemoProfilMore', |
|
103 | 103 | 'disablemodules'=>'adherent,don,externalsite,mailmanspip', |
104 | - //'icon'=>DOL_URL_ROOT.'/public/demo/dolibarr_screenshot9.png' |
|
104 | + //'icon'=>DOL_URL_ROOT.'/public/demo/dolibarr_screenshot9.png' |
|
105 | 105 | 'icon'=>DOL_URL_ROOT.'/public/demo/demo-profile-all.jpg' |
106 | - ) |
|
106 | + ) |
|
107 | 107 | ); |
108 | 108 | |
109 | 109 | |
@@ -113,12 +113,12 @@ discard block |
||
113 | 113 | // Not visible |
114 | 114 | $alwayshiddencheckedmodules=array('accounting','api','barcode','bookmark','clicktodial','comptabilite','cron','document','domain','externalrss','externalsite','fckeditor','geoipmaxmind','gravatar','label','ldap', |
115 | 115 | 'mailmanspip','notification','oauth','syslog','user','webservices', |
116 | - // Extended modules |
|
117 | - 'memcached','numberwords','zipautofillfr'); |
|
116 | + // Extended modules |
|
117 | + 'memcached','numberwords','zipautofillfr'); |
|
118 | 118 | $alwayshiddenuncheckedmodules=array('ftp','hrm','webservicesclient','websites', |
119 | - // Extended modules |
|
120 | - 'awstats','bittorrent','bootstrap','cabinetmed','cmcic','concatpdf','customfield','deplacement','dolicloud','filemanager','lightbox','mantis','monitoring','moretemplates','multicompany','nltechno','numberingpack','openstreetmap', |
|
121 | - 'ovh','phenix','phpsysinfo','pibarcode','postnuke','selectbank','skincoloreditor','submiteverywhere','survey','thomsonphonebook','topten','tvacerfa','voyage','webcalendar','webmail'); |
|
119 | + // Extended modules |
|
120 | + 'awstats','bittorrent','bootstrap','cabinetmed','cmcic','concatpdf','customfield','deplacement','dolicloud','filemanager','lightbox','mantis','monitoring','moretemplates','multicompany','nltechno','numberingpack','openstreetmap', |
|
121 | + 'ovh','phenix','phpsysinfo','pibarcode','postnuke','selectbank','skincoloreditor','submiteverywhere','survey','thomsonphonebook','topten','tvacerfa','voyage','webcalendar','webmail'); |
|
122 | 122 | } |
123 | 123 | |
124 | 124 | // Search modules |
@@ -139,61 +139,61 @@ discard block |
||
139 | 139 | |
140 | 140 | foreach ($modulesdir as $dir) |
141 | 141 | { |
142 | - // Charge tableaux modules, nom, numero, orders depuis repertoire dir |
|
143 | - $handle=@opendir($dir); |
|
144 | - if (is_resource($handle)) |
|
145 | - { |
|
146 | - while (($file = readdir($handle))!==false) |
|
147 | - { |
|
148 | - //print "$i ".$file."\n<br>"; |
|
149 | - if (is_readable($dir.$file) && substr($file, 0, 3) == 'mod' && substr($file, dol_strlen($file) - 10) == '.class.php') |
|
150 | - { |
|
151 | - $modName = substr($file, 0, dol_strlen($file) - 10); |
|
152 | - |
|
153 | - if ($modName) |
|
154 | - { |
|
155 | - try |
|
156 | - { |
|
157 | - include_once $dir.$file; |
|
158 | - $objMod = new $modName($db); |
|
159 | - |
|
160 | - if ($objMod->numero > 0) |
|
161 | - { |
|
162 | - $j = $objMod->numero; |
|
163 | - } |
|
164 | - else |
|
165 | - { |
|
166 | - $j = 1000 + $i; |
|
167 | - } |
|
168 | - |
|
169 | - $modulequalified=1; |
|
170 | - |
|
171 | - // We discard modules according to features level (PS: if module is activated we always show it) |
|
172 | - $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; |
|
175 | - |
|
176 | - if ($modulequalified) |
|
177 | - { |
|
178 | - $modules[$i] = $objMod; |
|
179 | - $filename[$i]= $modName; |
|
180 | - $orders[$i] = $objMod->family."_".$j; // Tri par famille puis numero module |
|
181 | - //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; |
|
184 | - $dirmod[$i] = $dirroot; |
|
185 | - $j++; |
|
186 | - $i++; |
|
187 | - } |
|
188 | - } |
|
189 | - catch(Exception $e) |
|
190 | - { |
|
191 | - dol_syslog("Failed to load ".$dir.$file." ".$e->getMessage(), LOG_ERR); |
|
192 | - } |
|
193 | - } |
|
194 | - } |
|
195 | - } |
|
196 | - } |
|
142 | + // Charge tableaux modules, nom, numero, orders depuis repertoire dir |
|
143 | + $handle=@opendir($dir); |
|
144 | + if (is_resource($handle)) |
|
145 | + { |
|
146 | + while (($file = readdir($handle))!==false) |
|
147 | + { |
|
148 | + //print "$i ".$file."\n<br>"; |
|
149 | + if (is_readable($dir.$file) && substr($file, 0, 3) == 'mod' && substr($file, dol_strlen($file) - 10) == '.class.php') |
|
150 | + { |
|
151 | + $modName = substr($file, 0, dol_strlen($file) - 10); |
|
152 | + |
|
153 | + if ($modName) |
|
154 | + { |
|
155 | + try |
|
156 | + { |
|
157 | + include_once $dir.$file; |
|
158 | + $objMod = new $modName($db); |
|
159 | + |
|
160 | + if ($objMod->numero > 0) |
|
161 | + { |
|
162 | + $j = $objMod->numero; |
|
163 | + } |
|
164 | + else |
|
165 | + { |
|
166 | + $j = 1000 + $i; |
|
167 | + } |
|
168 | + |
|
169 | + $modulequalified=1; |
|
170 | + |
|
171 | + // We discard modules according to features level (PS: if module is activated we always show it) |
|
172 | + $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; |
|
175 | + |
|
176 | + if ($modulequalified) |
|
177 | + { |
|
178 | + $modules[$i] = $objMod; |
|
179 | + $filename[$i]= $modName; |
|
180 | + $orders[$i] = $objMod->family."_".$j; // Tri par famille puis numero module |
|
181 | + //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; |
|
184 | + $dirmod[$i] = $dirroot; |
|
185 | + $j++; |
|
186 | + $i++; |
|
187 | + } |
|
188 | + } |
|
189 | + catch(Exception $e) |
|
190 | + { |
|
191 | + dol_syslog("Failed to load ".$dir.$file." ".$e->getMessage(), LOG_ERR); |
|
192 | + } |
|
193 | + } |
|
194 | + } |
|
195 | + } |
|
196 | + } |
|
197 | 197 | } |
198 | 198 | |
199 | 199 | asort($orders); |
@@ -211,32 +211,32 @@ discard block |
||
211 | 211 | // If we disable modules using a profile choice |
212 | 212 | if (GETPOST("demochoice")) |
213 | 213 | { |
214 | - foreach ($demoprofiles as $profilearray) |
|
215 | - { |
|
216 | - if ($profilearray['key'] == GETPOST("demochoice")) |
|
217 | - { |
|
218 | - $disablestring=$profilearray['disablemodules']; |
|
219 | - break; |
|
220 | - } |
|
221 | - } |
|
214 | + foreach ($demoprofiles as $profilearray) |
|
215 | + { |
|
216 | + if ($profilearray['key'] == GETPOST("demochoice")) |
|
217 | + { |
|
218 | + $disablestring=$profilearray['disablemodules']; |
|
219 | + break; |
|
220 | + } |
|
221 | + } |
|
222 | 222 | } |
223 | 223 | // If we disable modules using personalized list |
224 | 224 | foreach($modules as $val) |
225 | 225 | { |
226 | - $modulekeyname=strtolower($val->name); |
|
227 | - if (empty($_POST[$modulekeyname]) && empty($val->always_enabled) && ! in_array($modulekeyname,$alwayscheckedmodules)) |
|
228 | - { |
|
229 | - $disablestring.=$modulekeyname.','; |
|
230 | - if ($modulekeyname=='propale') $disablestring.='propal,'; |
|
231 | - } |
|
226 | + $modulekeyname=strtolower($val->name); |
|
227 | + if (empty($_POST[$modulekeyname]) && empty($val->always_enabled) && ! in_array($modulekeyname,$alwayscheckedmodules)) |
|
228 | + { |
|
229 | + $disablestring.=$modulekeyname.','; |
|
230 | + if ($modulekeyname=='propale') $disablestring.='propal,'; |
|
231 | + } |
|
232 | 232 | } |
233 | 233 | |
234 | - // Do redirect to login page |
|
234 | + // Do redirect to login page |
|
235 | 235 | if ($disablestring) |
236 | 236 | { |
237 | 237 | if (GETPOST('urlfrom')) $url.=(preg_match('/\?/',$url)?'&':'?').'urlfrom='.urlencode(GETPOST('urlfrom','alpha')); |
238 | 238 | $url.=(preg_match('/\?/',$url)?'&':'?').'disablemodules='.$disablestring; |
239 | - //var_dump($url);exit; |
|
239 | + //var_dump($url);exit; |
|
240 | 240 | header("Location: ".$url); |
241 | 241 | exit; |
242 | 242 | } |
@@ -304,49 +304,49 @@ discard block |
||
304 | 304 | { |
305 | 305 | if ($profilearray['default'] >= 0) |
306 | 306 | { |
307 | - //print $profilearray['lang']; |
|
308 | - if (! empty($profilearray['lang'])) $langs->load($profilearray['lang']); |
|
307 | + //print $profilearray['lang']; |
|
308 | + if (! empty($profilearray['lang'])) $langs->load($profilearray['lang']); |
|
309 | 309 | |
310 | 310 | $url=$_SERVER["PHP_SELF"].'?action=gotodemo'; |
311 | 311 | $urlwithmod=$url.'&demochoice='.$profilearray['key']; |
312 | 312 | // Should work with DOL_URL_ROOT='' or DOL_URL_ROOT='/dolibarr' |
313 | 313 | //print "xx".$_SERVER["PHP_SELF"].' '.DOL_URL_ROOT.'<br>'; |
314 | 314 | |
315 | - $urlfrom=preg_replace('/^'.preg_quote(DOL_URL_ROOT,'/').'/i','',$_SERVER["PHP_SELF"]); |
|
315 | + $urlfrom=preg_replace('/^'.preg_quote(DOL_URL_ROOT,'/').'/i','',$_SERVER["PHP_SELF"]); |
|
316 | 316 | //print $urlfrom; |
317 | 317 | |
318 | 318 | if (! empty($profilearray['url'])) |
319 | 319 | { |
320 | - $urlwithmod=$profilearray['url']; |
|
321 | - $urlwithmod=$urlwithmod.(preg_match('/\?/',$urlwithmod)?'&':'?').'urlfrom='.urlencode($urlfrom); |
|
322 | - if (! empty($profilearray['disablemodules'])) |
|
323 | - { |
|
324 | - $urlwithmod=$urlwithmod.(preg_match('/\?/',$urlwithmod)?'&':'?').'disablemodules='.$profilearray['disablemodules']; |
|
325 | - } |
|
320 | + $urlwithmod=$profilearray['url']; |
|
321 | + $urlwithmod=$urlwithmod.(preg_match('/\?/',$urlwithmod)?'&':'?').'urlfrom='.urlencode($urlfrom); |
|
322 | + if (! empty($profilearray['disablemodules'])) |
|
323 | + { |
|
324 | + $urlwithmod=$urlwithmod.(preg_match('/\?/',$urlwithmod)?'&':'?').'disablemodules='.$profilearray['disablemodules']; |
|
325 | + } |
|
326 | 326 | } |
327 | 327 | |
328 | 328 | if (empty($profilearray['url'])) |
329 | 329 | { |
330 | - print '<div class="clearboth"></div>'; |
|
330 | + print '<div class="clearboth"></div>'; |
|
331 | 331 | } |
332 | 332 | |
333 | 333 | print '<form method="POST" class="valigntop inline-block" name="form'.$profilearray['key'].'" action="'.$_SERVER["PHP_SELF"].'#a1'.$profilearray['key'].'">'."\n"; |
334 | 334 | print '<input type="hidden" name="action" value="gotodemo">'."\n"; |
335 | - print '<input type="hidden" name="urlfrom" value="'.dol_escape_htmltag($urlfrom).'">'."\n"; |
|
336 | - print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'."\n"; |
|
337 | - print '<input type="hidden" name="username" value="demo">'."\n"; |
|
338 | - print '<input type="hidden" name="dol_hide_topmenu" value="'.$conf->dol_hide_topmenu.'">'."\n"; |
|
339 | - print '<input type="hidden" name="dol_hide_leftmenu" value="'.$conf->dol_hide_leftmenu.'">'."\n"; |
|
340 | - print '<input type="hidden" name="dol_optimize_smallscreen" value="'.$conf->dol_optimize_smallscreen.'">'."\n"; |
|
341 | - print '<input type="hidden" name="dol_no_mouse_hover" value="'.$conf->dol_no_mouse_hover.'">'."\n"; |
|
342 | - print '<input type="hidden" name="dol_use_jmobile" value="'.$conf->dol_use_jmobile.'">'."\n"; |
|
335 | + print '<input type="hidden" name="urlfrom" value="'.dol_escape_htmltag($urlfrom).'">'."\n"; |
|
336 | + print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'."\n"; |
|
337 | + print '<input type="hidden" name="username" value="demo">'."\n"; |
|
338 | + print '<input type="hidden" name="dol_hide_topmenu" value="'.$conf->dol_hide_topmenu.'">'."\n"; |
|
339 | + print '<input type="hidden" name="dol_hide_leftmenu" value="'.$conf->dol_hide_leftmenu.'">'."\n"; |
|
340 | + print '<input type="hidden" name="dol_optimize_smallscreen" value="'.$conf->dol_optimize_smallscreen.'">'."\n"; |
|
341 | + print '<input type="hidden" name="dol_no_mouse_hover" value="'.$conf->dol_no_mouse_hover.'">'."\n"; |
|
342 | + print '<input type="hidden" name="dol_use_jmobile" value="'.$conf->dol_use_jmobile.'">'."\n"; |
|
343 | 343 | |
344 | - print '<div summary="Dolibarr online demonstration for profile '.$profilearray['label'].'" class="center inline-block CTable CTableRow'.($i%2==0?'1':'0').'" style="width: 346px;">'."\n"; |
|
344 | + print '<div summary="Dolibarr online demonstration for profile '.$profilearray['label'].'" class="center inline-block CTable CTableRow'.($i%2==0?'1':'0').'" style="width: 346px;">'."\n"; |
|
345 | 345 | |
346 | 346 | |
347 | - print '<div id="a1'.$profilearray['key'].'" class="demobox '.(empty($profilearray['url'])?'modulelineshow cursorpointer':'nomodulelines').'">'; |
|
347 | + print '<div id="a1'.$profilearray['key'].'" class="demobox '.(empty($profilearray['url'])?'modulelineshow cursorpointer':'nomodulelines').'">'; |
|
348 | 348 | |
349 | - print '<a href="'.$urlwithmod.'" class="'.(empty($profilearray['url'])?'modulelineshow':'nomodulelines').'">'; |
|
349 | + print '<a href="'.$urlwithmod.'" class="'.(empty($profilearray['url'])?'modulelineshow':'nomodulelines').'">'; |
|
350 | 350 | print '<div style="padding: 10px;">'; |
351 | 351 | |
352 | 352 | print '<img class="demothumb" src="'.$profilearray['icon'].'" alt="Demo '.$profilearray['label'].'">'; |
@@ -354,69 +354,69 @@ discard block |
||
354 | 354 | print '<div class="clearboth"></div>'; |
355 | 355 | |
356 | 356 | print '<div class="demothumbtext">'; |
357 | - print $langs->trans($profilearray['label']); |
|
358 | - print '</div>'; |
|
357 | + print $langs->trans($profilearray['label']); |
|
358 | + print '</div>'; |
|
359 | 359 | |
360 | - print '</div>'; |
|
361 | - print '</a>'; |
|
360 | + print '</div>'; |
|
361 | + print '</a>'; |
|
362 | 362 | |
363 | 363 | |
364 | - // Modules (a profile you must choose modules) |
|
365 | - if (empty($profilearray['url'])) |
|
366 | - { |
|
367 | - print '<div id="tr1'.$profilearray['key'].'" class="moduleline hidden" style="margin-left: 8px; margin-right: 8px; text-align: justify; font-size:14px; line-height: 130%; padding-bottom: 8px">'; |
|
368 | - |
|
369 | - print $langs->trans("ThisIsListOfModules").'<br><br>'; |
|
370 | - |
|
371 | - print '<div class="csscolumns">'; |
|
372 | - |
|
373 | - $listofdisabledmodules=explode(',',$profilearray['disablemodules']); |
|
374 | - $j=0; |
|
375 | - $nbcolsmod=empty($conf->dol_optimize_smallscreen)?4:3; |
|
376 | - //var_dump($modules); |
|
377 | - foreach($orders as $index => $key) // Loop on qualified (enabled) modules |
|
378 | - { |
|
379 | - //print $index.' '.$key; |
|
380 | - $val = $modules[$index]; |
|
381 | - $modulekeyname=strtolower($val->name); |
|
382 | - |
|
383 | - $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; |
|
388 | - |
|
389 | - if (in_array($modulekeyname,$alwayshiddencheckedmodules)) |
|
390 | - { |
|
391 | - print "\n".'<!-- Module '.$modulekeyname.' hidden and always checked -->'; |
|
392 | - print '<input type="hidden" name="'.$modulekeyname.'" value="1">'; |
|
393 | - } |
|
394 | - else |
|
395 | - { |
|
396 | - $modulo=($j % $nbcolsmod); |
|
397 | - //if ($modulo == 0) print '<tr>'; |
|
398 | - print '<!-- id='.$val->numero.' -->'; |
|
399 | - print '<div class="nowrap">'; |
|
400 | - 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'; |
|
403 | - print '> <div class="inline-block demomaxoveflow">'.$val->getName().'</div><br>'; |
|
404 | - print '</div>'; |
|
405 | - //if ($modulo == ($nbcolsmod - 1)) print '</tr>'; |
|
406 | - $j++; |
|
407 | - } |
|
408 | - } |
|
409 | - |
|
410 | - print '</div>'; |
|
411 | - |
|
412 | - print '<br><div class="center">'; |
|
413 | - print '<input type="submit" value=" '.$langs->trans("Start").' " class="button">'; |
|
414 | - print '</div>'; |
|
415 | - |
|
416 | - print '</div>'; |
|
417 | - } |
|
364 | + // Modules (a profile you must choose modules) |
|
365 | + if (empty($profilearray['url'])) |
|
366 | + { |
|
367 | + print '<div id="tr1'.$profilearray['key'].'" class="moduleline hidden" style="margin-left: 8px; margin-right: 8px; text-align: justify; font-size:14px; line-height: 130%; padding-bottom: 8px">'; |
|
368 | + |
|
369 | + print $langs->trans("ThisIsListOfModules").'<br><br>'; |
|
370 | + |
|
371 | + print '<div class="csscolumns">'; |
|
372 | + |
|
373 | + $listofdisabledmodules=explode(',',$profilearray['disablemodules']); |
|
374 | + $j=0; |
|
375 | + $nbcolsmod=empty($conf->dol_optimize_smallscreen)?4:3; |
|
376 | + //var_dump($modules); |
|
377 | + foreach($orders as $index => $key) // Loop on qualified (enabled) modules |
|
378 | + { |
|
379 | + //print $index.' '.$key; |
|
380 | + $val = $modules[$index]; |
|
381 | + $modulekeyname=strtolower($val->name); |
|
382 | + |
|
383 | + $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; |
|
388 | + |
|
389 | + if (in_array($modulekeyname,$alwayshiddencheckedmodules)) |
|
390 | + { |
|
391 | + print "\n".'<!-- Module '.$modulekeyname.' hidden and always checked -->'; |
|
392 | + print '<input type="hidden" name="'.$modulekeyname.'" value="1">'; |
|
393 | + } |
|
394 | + else |
|
395 | + { |
|
396 | + $modulo=($j % $nbcolsmod); |
|
397 | + //if ($modulo == 0) print '<tr>'; |
|
398 | + print '<!-- id='.$val->numero.' -->'; |
|
399 | + print '<div class="nowrap">'; |
|
400 | + 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'; |
|
403 | + print '> <div class="inline-block demomaxoveflow">'.$val->getName().'</div><br>'; |
|
404 | + print '</div>'; |
|
405 | + //if ($modulo == ($nbcolsmod - 1)) print '</tr>'; |
|
406 | + $j++; |
|
407 | + } |
|
408 | + } |
|
409 | + |
|
410 | + print '</div>'; |
|
411 | + |
|
412 | + print '<br><div class="center">'; |
|
413 | + print '<input type="submit" value=" '.$langs->trans("Start").' " class="button">'; |
|
414 | + print '</div>'; |
|
415 | + |
|
416 | + print '</div>'; |
|
417 | + } |
|
418 | 418 | |
419 | - print '</div></div>'; |
|
419 | + print '</div></div>'; |
|
420 | 420 | print '</form>'."\n"; |
421 | 421 | |
422 | 422 | $i++; |
@@ -465,13 +465,13 @@ discard block |
||
465 | 465 | */ |
466 | 466 | function llxHeaderVierge($title, $head = "") |
467 | 467 | { |
468 | - global $user, $conf, $langs; |
|
468 | + global $user, $conf, $langs; |
|
469 | 469 | |
470 | - top_httphead(); |
|
470 | + top_httphead(); |
|
471 | 471 | |
472 | - top_htmlhead($head,$title,0,0,array(),array('public/demo/demo.css')); |
|
472 | + top_htmlhead($head,$title,0,0,array(),array('public/demo/demo.css')); |
|
473 | 473 | |
474 | - print '<body class="demobody"><div class="demobackgrounddiv">'."\n"; |
|
474 | + print '<body class="demobody"><div class="demobackgrounddiv">'."\n"; |
|
475 | 475 | } |
476 | 476 | |
477 | 477 | /** |
@@ -481,10 +481,10 @@ discard block |
||
481 | 481 | */ |
482 | 482 | function llxFooterVierge() |
483 | 483 | { |
484 | - printCommonFooter('public'); |
|
484 | + printCommonFooter('public'); |
|
485 | 485 | |
486 | - print "\n"; |
|
487 | - print "</div></body>\n"; |
|
488 | - print "</html>\n"; |
|
486 | + print "\n"; |
|
487 | + print "</div></body>\n"; |
|
488 | + print "</html>\n"; |
|
489 | 489 | } |
490 | 490 |
@@ -25,8 +25,8 @@ discard block |
||
25 | 25 | * \author Laurent Destailleur |
26 | 26 | */ |
27 | 27 | |
28 | -define("NOLOGIN",1); // This means this output page does not require to be logged. |
|
29 | -define("NOCSRFCHECK",1); // We accept to go on this page from external web site. |
|
28 | +define("NOLOGIN", 1); // This means this output page does not require to be logged. |
|
29 | +define("NOCSRFCHECK", 1); // We accept to go on this page from external web site. |
|
30 | 30 | |
31 | 31 | require '../../main.inc.php'; |
32 | 32 | require_once '../../core/lib/functions2.lib.php'; |
@@ -35,71 +35,71 @@ discard block |
||
35 | 35 | $langs->load("install"); |
36 | 36 | $langs->load("other"); |
37 | 37 | |
38 | -$conf->dol_hide_topmenu=GETPOST('dol_hide_topmenu','int'); |
|
39 | -$conf->dol_hide_leftmenu=GETPOST('dol_hide_leftmenu','int'); |
|
40 | -$conf->dol_optimize_smallscreen=GETPOST('dol_optimize_smallscreen','int'); |
|
41 | -$conf->dol_no_mouse_hover=GETPOST('dol_no_mouse_hover','int'); |
|
42 | -$conf->dol_use_jmobile=GETPOST('dol_use_jmobile','int'); |
|
38 | +$conf->dol_hide_topmenu = GETPOST('dol_hide_topmenu', 'int'); |
|
39 | +$conf->dol_hide_leftmenu = GETPOST('dol_hide_leftmenu', 'int'); |
|
40 | +$conf->dol_optimize_smallscreen = GETPOST('dol_optimize_smallscreen', 'int'); |
|
41 | +$conf->dol_no_mouse_hover = GETPOST('dol_no_mouse_hover', 'int'); |
|
42 | +$conf->dol_use_jmobile = GETPOST('dol_use_jmobile', 'int'); |
|
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)) 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); |
|
47 | 47 | |
48 | 48 | // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context |
49 | -$res=$hookmanager->initHooks(array('demo')); |
|
50 | - |
|
51 | -$demoprofiles=array(); |
|
52 | -$alwayscheckedmodules=array(); |
|
53 | -$alwaysuncheckedmodules=array(); |
|
54 | -$alwayshiddencheckedmodules=array(); |
|
55 | -$alwayshiddenuncheckedmodules=array(); |
|
56 | - |
|
57 | -$url=''; |
|
58 | -$url.=($url?'&':'').($conf->dol_hide_topmenu?'dol_hide_topmenu='.$conf->dol_hide_topmenu:''); |
|
59 | -$url.=($url?'&':'').($conf->dol_hide_leftmenu?'dol_hide_leftmenu='.$conf->dol_hide_leftmenu:''); |
|
60 | -$url.=($url?'&':'').($conf->dol_optimize_smallscreen?'dol_optimize_smallscreen='.$conf->dol_optimize_smallscreen:''); |
|
61 | -$url.=($url?'&':'').($conf->dol_no_mouse_hover?'dol_no_mouse_hover='.$conf->dol_no_mouse_hover:''); |
|
62 | -$url.=($url?'&':'').($conf->dol_use_jmobile?'dol_use_jmobile='.$conf->dol_use_jmobile:''); |
|
63 | -$url=DOL_URL_ROOT.'/index.php'.($url?'?'.$url:''); |
|
49 | +$res = $hookmanager->initHooks(array('demo')); |
|
50 | + |
|
51 | +$demoprofiles = array(); |
|
52 | +$alwayscheckedmodules = array(); |
|
53 | +$alwaysuncheckedmodules = array(); |
|
54 | +$alwayshiddencheckedmodules = array(); |
|
55 | +$alwayshiddenuncheckedmodules = array(); |
|
56 | + |
|
57 | +$url = ''; |
|
58 | +$url .= ($url ? '&' : '').($conf->dol_hide_topmenu ? 'dol_hide_topmenu='.$conf->dol_hide_topmenu : ''); |
|
59 | +$url .= ($url ? '&' : '').($conf->dol_hide_leftmenu ? 'dol_hide_leftmenu='.$conf->dol_hide_leftmenu : ''); |
|
60 | +$url .= ($url ? '&' : '').($conf->dol_optimize_smallscreen ? 'dol_optimize_smallscreen='.$conf->dol_optimize_smallscreen : ''); |
|
61 | +$url .= ($url ? '&' : '').($conf->dol_no_mouse_hover ? 'dol_no_mouse_hover='.$conf->dol_no_mouse_hover : ''); |
|
62 | +$url .= ($url ? '&' : '').($conf->dol_use_jmobile ? 'dol_use_jmobile='.$conf->dol_use_jmobile : ''); |
|
63 | +$url = DOL_URL_ROOT.'/index.php'.($url ? '?'.$url : ''); |
|
64 | 64 | |
65 | 65 | $tmpaction = 'view'; |
66 | -$parameters=array(); |
|
67 | -$object=new stdClass(); |
|
68 | -$reshook=$hookmanager->executeHooks('addDemoProfile', $parameters, $object, $tmpaction); // Note that $action and $object may have been modified by some hooks |
|
69 | -$error=$hookmanager->error; $errors=$hookmanager->errors; |
|
66 | +$parameters = array(); |
|
67 | +$object = new stdClass(); |
|
68 | +$reshook = $hookmanager->executeHooks('addDemoProfile', $parameters, $object, $tmpaction); // Note that $action and $object may have been modified by some hooks |
|
69 | +$error = $hookmanager->error; $errors = $hookmanager->errors; |
|
70 | 70 | if (empty($reshook)) |
71 | 71 | { |
72 | - $demoprofiles=array( |
|
73 | - array('default'=>'1', 'key'=>'profdemoservonly','label'=>'DemoCompanyServiceOnly', |
|
72 | + $demoprofiles = array( |
|
73 | + array('default'=>'1', 'key'=>'profdemoservonly', 'label'=>'DemoCompanyServiceOnly', |
|
74 | 74 | 'disablemodules'=>'adherent,barcode,cashdesk,don,expedition,externalsite,incoterm,mailmanspip,margin,prelevement,product,productbatch,stock', |
75 | 75 | //'icon'=>DOL_URL_ROOT.'/public/demo/dolibarr_screenshot8.png', |
76 | 76 | 'icon'=>DOL_URL_ROOT.'/public/demo/demo-profile-service.jpg', |
77 | 77 | 'url'=>$url |
78 | 78 | ), |
79 | - array('default'=>'-1','key'=>'profdemoshopwithdesk','label'=>'DemoCompanyShopWithCashDesk', |
|
79 | + array('default'=>'-1', 'key'=>'profdemoshopwithdesk', 'label'=>'DemoCompanyShopWithCashDesk', |
|
80 | 80 | 'disablemodules'=>'adherent,don,externalsite,ficheinter,incoterm,mailmanspip,prelevement,product,productbatch,stock', |
81 | 81 | 'icon'=>DOL_URL_ROOT.'/public/demo/dolibarr_screenshot2.png', |
82 | 82 | 'url'=>$url |
83 | 83 | ), |
84 | - array('default'=>'0', 'key'=>'profdemoprodstock','label'=>'DemoCompanyProductAndStocks', |
|
84 | + array('default'=>'0', 'key'=>'profdemoprodstock', 'label'=>'DemoCompanyProductAndStocks', |
|
85 | 85 | 'disablemodules'=>'adherent,contrat,don,externalsite,ficheinter,mailmanspip,prelevement,service', |
86 | 86 | //'icon'=>DOL_URL_ROOT.'/public/demo/dolibarr_screenshot2.png', |
87 | 87 | 'icon'=>DOL_URL_ROOT.'/public/demo/demo-profile-product.jpg', |
88 | 88 | 'url'=>$url |
89 | 89 | ), |
90 | - array('default'=>'-1', 'key'=>'profdemofun','label'=>'DemoFundation', |
|
90 | + array('default'=>'-1', 'key'=>'profdemofun', 'label'=>'DemoFundation', |
|
91 | 91 | 'disablemodules'=>'banque,barcode,cashdesk,commande,commercial,compta,comptabilite,contrat,expedition,externalsite,ficheinter,incoterm,mailmanspip,margin,prelevement,product,productbatch,projet,propal,propale,service,societe,stock,tax', |
92 | 92 | 'icon'=>DOL_URL_ROOT.'/public/demo/dolibarr_screenshot6.png', |
93 | 93 | 'url'=>$url |
94 | 94 | ), |
95 | - array('default'=>'0', 'key'=>'profdemofun2','label'=>'DemoFundation2', |
|
95 | + array('default'=>'0', 'key'=>'profdemofun2', 'label'=>'DemoFundation2', |
|
96 | 96 | 'disablemodules'=>'barcode,cashdesk,commande,commercial,compta,comptabilite,contrat,expedition,externalsite,ficheinter,incoterm,mailmanspip,margin,prelevement,product,productbatch,projet,propal,propale,service,societe,stock,tax', |
97 | 97 | //'icon'=>DOL_URL_ROOT.'/public/demo/dolibarr_screenshot6.png', |
98 | 98 | 'icon'=>DOL_URL_ROOT.'/public/demo/demo-profile-foundation.jpg', |
99 | 99 | 'url'=>$url |
100 | 100 | ), |
101 | 101 | // All demo profile |
102 | - array('default'=>'0', 'key'=>'profdemoall','label'=>'ChooseYourDemoProfilMore', |
|
102 | + array('default'=>'0', 'key'=>'profdemoall', 'label'=>'ChooseYourDemoProfilMore', |
|
103 | 103 | 'disablemodules'=>'adherent,don,externalsite,mailmanspip', |
104 | 104 | //'icon'=>DOL_URL_ROOT.'/public/demo/dolibarr_screenshot9.png' |
105 | 105 | 'icon'=>DOL_URL_ROOT.'/public/demo/demo-profile-all.jpg' |
@@ -108,21 +108,21 @@ discard block |
||
108 | 108 | |
109 | 109 | |
110 | 110 | // Visible |
111 | - $alwayscheckedmodules=array('barcode','bookmark','categorie','externalrss','fckeditor','geoipmaxmind','gravatar','memcached','syslog','user','webservices'); // Technical module we always want |
|
112 | - $alwaysuncheckedmodules=array('dynamicprices','loan','multicurrency','paybox','paypal','stripe','google','printing','scanner','workflow'); // Module we never want |
|
111 | + $alwayscheckedmodules = array('barcode', 'bookmark', 'categorie', 'externalrss', 'fckeditor', 'geoipmaxmind', 'gravatar', 'memcached', 'syslog', 'user', 'webservices'); // Technical module we always want |
|
112 | + $alwaysuncheckedmodules = array('dynamicprices', 'loan', 'multicurrency', 'paybox', 'paypal', 'stripe', 'google', 'printing', 'scanner', 'workflow'); // Module we never want |
|
113 | 113 | // Not visible |
114 | - $alwayshiddencheckedmodules=array('accounting','api','barcode','bookmark','clicktodial','comptabilite','cron','document','domain','externalrss','externalsite','fckeditor','geoipmaxmind','gravatar','label','ldap', |
|
115 | - 'mailmanspip','notification','oauth','syslog','user','webservices', |
|
114 | + $alwayshiddencheckedmodules = array('accounting', 'api', 'barcode', 'bookmark', 'clicktodial', 'comptabilite', 'cron', 'document', 'domain', 'externalrss', 'externalsite', 'fckeditor', 'geoipmaxmind', 'gravatar', 'label', 'ldap', |
|
115 | + 'mailmanspip', 'notification', 'oauth', 'syslog', 'user', 'webservices', |
|
116 | 116 | // Extended modules |
117 | - 'memcached','numberwords','zipautofillfr'); |
|
118 | - $alwayshiddenuncheckedmodules=array('ftp','hrm','webservicesclient','websites', |
|
117 | + 'memcached', 'numberwords', 'zipautofillfr'); |
|
118 | + $alwayshiddenuncheckedmodules = array('ftp', 'hrm', 'webservicesclient', 'websites', |
|
119 | 119 | // Extended modules |
120 | - 'awstats','bittorrent','bootstrap','cabinetmed','cmcic','concatpdf','customfield','deplacement','dolicloud','filemanager','lightbox','mantis','monitoring','moretemplates','multicompany','nltechno','numberingpack','openstreetmap', |
|
121 | - 'ovh','phenix','phpsysinfo','pibarcode','postnuke','selectbank','skincoloreditor','submiteverywhere','survey','thomsonphonebook','topten','tvacerfa','voyage','webcalendar','webmail'); |
|
120 | + 'awstats', 'bittorrent', 'bootstrap', 'cabinetmed', 'cmcic', 'concatpdf', 'customfield', 'deplacement', 'dolicloud', 'filemanager', 'lightbox', 'mantis', 'monitoring', 'moretemplates', 'multicompany', 'nltechno', 'numberingpack', 'openstreetmap', |
|
121 | + 'ovh', 'phenix', 'phpsysinfo', 'pibarcode', 'postnuke', 'selectbank', 'skincoloreditor', 'submiteverywhere', 'survey', 'thomsonphonebook', 'topten', 'tvacerfa', 'voyage', 'webcalendar', 'webmail'); |
|
122 | 122 | } |
123 | 123 | |
124 | 124 | // Search modules |
125 | -$dirlist=$conf->file->dol_document_root; |
|
125 | +$dirlist = $conf->file->dol_document_root; |
|
126 | 126 | |
127 | 127 | |
128 | 128 | // Search modules dirs |
@@ -140,13 +140,13 @@ discard block |
||
140 | 140 | foreach ($modulesdir as $dir) |
141 | 141 | { |
142 | 142 | // Charge tableaux modules, nom, numero, orders depuis repertoire dir |
143 | - $handle=@opendir($dir); |
|
143 | + $handle = @opendir($dir); |
|
144 | 144 | if (is_resource($handle)) |
145 | 145 | { |
146 | - while (($file = readdir($handle))!==false) |
|
146 | + while (($file = readdir($handle)) !== false) |
|
147 | 147 | { |
148 | 148 | //print "$i ".$file."\n<br>"; |
149 | - if (is_readable($dir.$file) && substr($file, 0, 3) == 'mod' && substr($file, dol_strlen($file) - 10) == '.class.php') |
|
149 | + if (is_readable($dir.$file) && substr($file, 0, 3) == 'mod' && substr($file, dol_strlen($file) - 10) == '.class.php') |
|
150 | 150 | { |
151 | 151 | $modName = substr($file, 0, dol_strlen($file) - 10); |
152 | 152 | |
@@ -166,27 +166,27 @@ discard block |
||
166 | 166 | $j = 1000 + $i; |
167 | 167 | } |
168 | 168 | |
169 | - $modulequalified=1; |
|
169 | + $modulequalified = 1; |
|
170 | 170 | |
171 | 171 | // We discard modules according to features level (PS: if module is activated we always show it) |
172 | - $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; |
|
172 | + $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; |
|
175 | 175 | |
176 | 176 | if ($modulequalified) |
177 | 177 | { |
178 | 178 | $modules[$i] = $objMod; |
179 | - $filename[$i]= $modName; |
|
180 | - $orders[$i] = $objMod->family."_".$j; // Tri par famille puis numero module |
|
179 | + $filename[$i] = $modName; |
|
180 | + $orders[$i] = $objMod->family."_".$j; // Tri par famille puis numero module |
|
181 | 181 | //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; |
|
182 | + if (isset($categ[$objMod->special])) $categ[$objMod->special]++; // Array of all different modules categories |
|
183 | + else $categ[$objMod->special] = 1; |
|
184 | 184 | $dirmod[$i] = $dirroot; |
185 | 185 | $j++; |
186 | 186 | $i++; |
187 | 187 | } |
188 | 188 | } |
189 | - catch(Exception $e) |
|
189 | + catch (Exception $e) |
|
190 | 190 | { |
191 | 191 | dol_syslog("Failed to load ".$dir.$file." ".$e->getMessage(), LOG_ERR); |
192 | 192 | } |
@@ -204,10 +204,10 @@ discard block |
||
204 | 204 | * Actions |
205 | 205 | */ |
206 | 206 | |
207 | -if (GETPOST('action','aZ09') == 'gotodemo') // Action run when we click on "Start" after selection modules |
|
207 | +if (GETPOST('action', 'aZ09') == 'gotodemo') // Action run when we click on "Start" after selection modules |
|
208 | 208 | { |
209 | 209 | //print 'ee'.GETPOST("demochoice"); |
210 | - $disablestring=''; |
|
210 | + $disablestring = ''; |
|
211 | 211 | // If we disable modules using a profile choice |
212 | 212 | if (GETPOST("demochoice")) |
213 | 213 | { |
@@ -215,27 +215,27 @@ discard block |
||
215 | 215 | { |
216 | 216 | if ($profilearray['key'] == GETPOST("demochoice")) |
217 | 217 | { |
218 | - $disablestring=$profilearray['disablemodules']; |
|
218 | + $disablestring = $profilearray['disablemodules']; |
|
219 | 219 | break; |
220 | 220 | } |
221 | 221 | } |
222 | 222 | } |
223 | 223 | // If we disable modules using personalized list |
224 | - foreach($modules as $val) |
|
224 | + foreach ($modules as $val) |
|
225 | 225 | { |
226 | - $modulekeyname=strtolower($val->name); |
|
227 | - if (empty($_POST[$modulekeyname]) && empty($val->always_enabled) && ! in_array($modulekeyname,$alwayscheckedmodules)) |
|
226 | + $modulekeyname = strtolower($val->name); |
|
227 | + if (empty($_POST[$modulekeyname]) && empty($val->always_enabled) && !in_array($modulekeyname, $alwayscheckedmodules)) |
|
228 | 228 | { |
229 | - $disablestring.=$modulekeyname.','; |
|
230 | - if ($modulekeyname=='propale') $disablestring.='propal,'; |
|
229 | + $disablestring .= $modulekeyname.','; |
|
230 | + if ($modulekeyname == 'propale') $disablestring .= 'propal,'; |
|
231 | 231 | } |
232 | 232 | } |
233 | 233 | |
234 | 234 | // Do redirect to login page |
235 | 235 | if ($disablestring) |
236 | 236 | { |
237 | - if (GETPOST('urlfrom')) $url.=(preg_match('/\?/',$url)?'&':'?').'urlfrom='.urlencode(GETPOST('urlfrom','alpha')); |
|
238 | - $url.=(preg_match('/\?/',$url)?'&':'?').'disablemodules='.$disablestring; |
|
237 | + if (GETPOST('urlfrom')) $url .= (preg_match('/\?/', $url) ? '&' : '?').'urlfrom='.urlencode(GETPOST('urlfrom', 'alpha')); |
|
238 | + $url .= (preg_match('/\?/', $url) ? '&' : '?').'disablemodules='.$disablestring; |
|
239 | 239 | //var_dump($url);exit; |
240 | 240 | header("Location: ".$url); |
241 | 241 | exit; |
@@ -247,11 +247,11 @@ discard block |
||
247 | 247 | * View |
248 | 248 | */ |
249 | 249 | |
250 | -$head=''; |
|
251 | -$head.='<meta name="keywords" content="demo,online,demonstration,example,test,erp,crm,demos,web">'."\n"; |
|
252 | -$head.='<meta name="description" content="Dolibarr ERP and CRM demo. You can test here several profiles for Dolibarr ERP and CRM demonstration.">'."\n"; |
|
250 | +$head = ''; |
|
251 | +$head .= '<meta name="keywords" content="demo,online,demonstration,example,test,erp,crm,demos,web">'."\n"; |
|
252 | +$head .= '<meta name="description" content="Dolibarr ERP and CRM demo. You can test here several profiles for Dolibarr ERP and CRM demonstration.">'."\n"; |
|
253 | 253 | |
254 | -$head.=' |
|
254 | +$head .= ' |
|
255 | 255 | <script type="text/javascript"> |
256 | 256 | var openedId=""; |
257 | 257 | jQuery(document).ready(function () { |
@@ -299,29 +299,29 @@ discard block |
||
299 | 299 | print '<div class="clearboth"></div>'; |
300 | 300 | print '<div class="demobanbox">'; |
301 | 301 | |
302 | -$i=0; |
|
302 | +$i = 0; |
|
303 | 303 | foreach ($demoprofiles as $profilearray) |
304 | 304 | { |
305 | 305 | if ($profilearray['default'] >= 0) |
306 | 306 | { |
307 | 307 | //print $profilearray['lang']; |
308 | - if (! empty($profilearray['lang'])) $langs->load($profilearray['lang']); |
|
308 | + if (!empty($profilearray['lang'])) $langs->load($profilearray['lang']); |
|
309 | 309 | |
310 | - $url=$_SERVER["PHP_SELF"].'?action=gotodemo'; |
|
311 | - $urlwithmod=$url.'&demochoice='.$profilearray['key']; |
|
310 | + $url = $_SERVER["PHP_SELF"].'?action=gotodemo'; |
|
311 | + $urlwithmod = $url.'&demochoice='.$profilearray['key']; |
|
312 | 312 | // Should work with DOL_URL_ROOT='' or DOL_URL_ROOT='/dolibarr' |
313 | 313 | //print "xx".$_SERVER["PHP_SELF"].' '.DOL_URL_ROOT.'<br>'; |
314 | 314 | |
315 | - $urlfrom=preg_replace('/^'.preg_quote(DOL_URL_ROOT,'/').'/i','',$_SERVER["PHP_SELF"]); |
|
315 | + $urlfrom = preg_replace('/^'.preg_quote(DOL_URL_ROOT, '/').'/i', '', $_SERVER["PHP_SELF"]); |
|
316 | 316 | //print $urlfrom; |
317 | 317 | |
318 | - if (! empty($profilearray['url'])) |
|
318 | + if (!empty($profilearray['url'])) |
|
319 | 319 | { |
320 | - $urlwithmod=$profilearray['url']; |
|
321 | - $urlwithmod=$urlwithmod.(preg_match('/\?/',$urlwithmod)?'&':'?').'urlfrom='.urlencode($urlfrom); |
|
322 | - if (! empty($profilearray['disablemodules'])) |
|
320 | + $urlwithmod = $profilearray['url']; |
|
321 | + $urlwithmod = $urlwithmod.(preg_match('/\?/', $urlwithmod) ? '&' : '?').'urlfrom='.urlencode($urlfrom); |
|
322 | + if (!empty($profilearray['disablemodules'])) |
|
323 | 323 | { |
324 | - $urlwithmod=$urlwithmod.(preg_match('/\?/',$urlwithmod)?'&':'?').'disablemodules='.$profilearray['disablemodules']; |
|
324 | + $urlwithmod = $urlwithmod.(preg_match('/\?/', $urlwithmod) ? '&' : '?').'disablemodules='.$profilearray['disablemodules']; |
|
325 | 325 | } |
326 | 326 | } |
327 | 327 | |
@@ -341,12 +341,12 @@ discard block |
||
341 | 341 | print '<input type="hidden" name="dol_no_mouse_hover" value="'.$conf->dol_no_mouse_hover.'">'."\n"; |
342 | 342 | print '<input type="hidden" name="dol_use_jmobile" value="'.$conf->dol_use_jmobile.'">'."\n"; |
343 | 343 | |
344 | - print '<div summary="Dolibarr online demonstration for profile '.$profilearray['label'].'" class="center inline-block CTable CTableRow'.($i%2==0?'1':'0').'" style="width: 346px;">'."\n"; |
|
344 | + print '<div summary="Dolibarr online demonstration for profile '.$profilearray['label'].'" class="center inline-block CTable CTableRow'.($i % 2 == 0 ? '1' : '0').'" style="width: 346px;">'."\n"; |
|
345 | 345 | |
346 | 346 | |
347 | - print '<div id="a1'.$profilearray['key'].'" class="demobox '.(empty($profilearray['url'])?'modulelineshow cursorpointer':'nomodulelines').'">'; |
|
347 | + print '<div id="a1'.$profilearray['key'].'" class="demobox '.(empty($profilearray['url']) ? 'modulelineshow cursorpointer' : 'nomodulelines').'">'; |
|
348 | 348 | |
349 | - print '<a href="'.$urlwithmod.'" class="'.(empty($profilearray['url'])?'modulelineshow':'nomodulelines').'">'; |
|
349 | + print '<a href="'.$urlwithmod.'" class="'.(empty($profilearray['url']) ? 'modulelineshow' : 'nomodulelines').'">'; |
|
350 | 350 | print '<div style="padding: 10px;">'; |
351 | 351 | |
352 | 352 | print '<img class="demothumb" src="'.$profilearray['icon'].'" alt="Demo '.$profilearray['label'].'">'; |
@@ -370,36 +370,36 @@ discard block |
||
370 | 370 | |
371 | 371 | print '<div class="csscolumns">'; |
372 | 372 | |
373 | - $listofdisabledmodules=explode(',',$profilearray['disablemodules']); |
|
374 | - $j=0; |
|
375 | - $nbcolsmod=empty($conf->dol_optimize_smallscreen)?4:3; |
|
373 | + $listofdisabledmodules = explode(',', $profilearray['disablemodules']); |
|
374 | + $j = 0; |
|
375 | + $nbcolsmod = empty($conf->dol_optimize_smallscreen) ? 4 : 3; |
|
376 | 376 | //var_dump($modules); |
377 | - foreach($orders as $index => $key) // Loop on qualified (enabled) modules |
|
377 | + foreach ($orders as $index => $key) // Loop on qualified (enabled) modules |
|
378 | 378 | { |
379 | 379 | //print $index.' '.$key; |
380 | 380 | $val = $modules[$index]; |
381 | - $modulekeyname=strtolower($val->name); |
|
381 | + $modulekeyname = strtolower($val->name); |
|
382 | 382 | |
383 | - $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; |
|
383 | + $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; |
|
388 | 388 | |
389 | - if (in_array($modulekeyname,$alwayshiddencheckedmodules)) |
|
389 | + if (in_array($modulekeyname, $alwayshiddencheckedmodules)) |
|
390 | 390 | { |
391 | 391 | print "\n".'<!-- Module '.$modulekeyname.' hidden and always checked -->'; |
392 | 392 | print '<input type="hidden" name="'.$modulekeyname.'" value="1">'; |
393 | 393 | } |
394 | 394 | else |
395 | 395 | { |
396 | - $modulo=($j % $nbcolsmod); |
|
396 | + $modulo = ($j % $nbcolsmod); |
|
397 | 397 | //if ($modulo == 0) print '<tr>'; |
398 | 398 | print '<!-- id='.$val->numero.' -->'; |
399 | 399 | print '<div class="nowrap">'; |
400 | 400 | 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'; |
|
401 | + if (in_array($modulekeyname, $alwaysuncheckedmodules)) print ' disabled'; |
|
402 | + if (!in_array($modulekeyname, $alwaysuncheckedmodules) && (!in_array($modulekeyname, $listofdisabledmodules) || in_array($modulekeyname, $alwayscheckedmodules))) print ' checked'; |
|
403 | 403 | print '> <div class="inline-block demomaxoveflow">'.$val->getName().'</div><br>'; |
404 | 404 | print '</div>'; |
405 | 405 | //if ($modulo == ($nbcolsmod - 1)) print '</tr>'; |
@@ -428,7 +428,7 @@ discard block |
||
428 | 428 | |
429 | 429 | // TODO Replace this with a hook |
430 | 430 | // Google Adsense (need Google module) |
431 | -if (! empty($conf->google->enabled) && ! empty($conf->global->MAIN_GOOGLE_AD_CLIENT) && ! empty($conf->global->MAIN_GOOGLE_AD_SLOT)) |
|
431 | +if (!empty($conf->google->enabled) && !empty($conf->global->MAIN_GOOGLE_AD_CLIENT) && !empty($conf->global->MAIN_GOOGLE_AD_SLOT)) |
|
432 | 432 | { |
433 | 433 | if (empty($conf->dol_use_jmobile)) |
434 | 434 | { |
@@ -469,7 +469,7 @@ discard block |
||
469 | 469 | |
470 | 470 | top_httphead(); |
471 | 471 | |
472 | - top_htmlhead($head,$title,0,0,array(),array('public/demo/demo.css')); |
|
472 | + top_htmlhead($head, $title, 0, 0, array(), array('public/demo/demo.css')); |
|
473 | 473 | |
474 | 474 | print '<body class="demobody"><div class="demobackgrounddiv">'."\n"; |
475 | 475 | } |
@@ -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 | } |
@@ -245,13 +245,13 @@ |
||
245 | 245 | |
246 | 246 | if (empty($object->ref)) // For survey, id is a hex string |
247 | 247 | { |
248 | - $langs->load("errors"); |
|
249 | - print $langs->trans("ErrorRecordNotFound"); |
|
248 | + $langs->load("errors"); |
|
249 | + print $langs->trans("ErrorRecordNotFound"); |
|
250 | 250 | |
251 | - llxFooterSurvey(); |
|
251 | + llxFooterSurvey(); |
|
252 | 252 | |
253 | - $db->close(); |
|
254 | - exit(); |
|
253 | + $db->close(); |
|
254 | + exit(); |
|
255 | 255 | } |
256 | 256 | |
257 | 257 | // Define format of choices |
@@ -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>'; |
@@ -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 | } |
@@ -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 |
@@ -55,9 +55,9 @@ discard block |
||
55 | 55 | } |
56 | 56 | else |
57 | 57 | { |
58 | - $arraycss=array(); |
|
59 | - $arrayjs=array(); |
|
60 | - /* |
|
58 | + $arraycss=array(); |
|
59 | + $arrayjs=array(); |
|
60 | + /* |
|
61 | 61 | $arraycss=array('/includes/jquery/plugins/datatables/media/css/jquery.dataTables.css', |
62 | 62 | '/includes/jquery/plugins/datatables/extensions/Buttons/css/buttons.dataTables.min.css', |
63 | 63 | '/includes/jquery/plugins/datatables/extensions/ColReorder/css/colReorder.dataTables.min.css' |
@@ -214,12 +214,12 @@ discard block |
||
214 | 214 | |
215 | 215 | if (! empty($moreforfilter)) |
216 | 216 | { |
217 | - print '<div class="liste_titre liste_titre_bydiv centpercent">'; |
|
218 | - print $moreforfilter; |
|
219 | - $parameters=array(); |
|
220 | - $reshook=$hookmanager->executeHooks('printFieldPreListTitle',$parameters); // Note that $action and $object may have been modified by hook |
|
221 | - print $hookmanager->resPrint; |
|
222 | - print '</div>'; |
|
217 | + print '<div class="liste_titre liste_titre_bydiv centpercent">'; |
|
218 | + print $moreforfilter; |
|
219 | + $parameters=array(); |
|
220 | + $reshook=$hookmanager->executeHooks('printFieldPreListTitle',$parameters); // Note that $action and $object may have been modified by hook |
|
221 | + print $hookmanager->resPrint; |
|
222 | + print '</div>'; |
|
223 | 223 | } |
224 | 224 | |
225 | 225 | ?> |
@@ -252,12 +252,12 @@ discard block |
||
252 | 252 | $(document).ready(function(){ |
253 | 253 | $('#idtableexample2').dataTable( { |
254 | 254 | <?php |
255 | - if ($optioncss=='print') { |
|
256 | - print '\'dom\': \'lfrtip\','; |
|
257 | - } else { |
|
258 | - print '\'dom\': \'Blfrtip\','; |
|
259 | - } |
|
260 | - ?> |
|
255 | + if ($optioncss=='print') { |
|
256 | + print '\'dom\': \'lfrtip\','; |
|
257 | + } else { |
|
258 | + print '\'dom\': \'Blfrtip\','; |
|
259 | + } |
|
260 | + ?> |
|
261 | 261 | "colReorder": true, |
262 | 262 | 'buttons': [ |
263 | 263 | 'colvis','copy', 'csv', 'excel', 'pdf', 'print' |
@@ -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,6 +1,6 @@ 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. |
|
3 | +define("NOCSRFCHECK", 1); // We accept to go on this page from external web site. |
|
4 | 4 | |
5 | 5 | require '../../main.inc.php'; |
6 | 6 | |
@@ -8,9 +8,9 @@ discard block |
||
8 | 8 | accessforbidden(); |
9 | 9 | } |
10 | 10 | |
11 | -$usedolheader=1; // 1 = Test inside a dolibarr page, 0 = Use hard coded header |
|
11 | +$usedolheader = 1; // 1 = Test inside a dolibarr page, 0 = Use hard coded header |
|
12 | 12 | |
13 | -$form=new Form($db); |
|
13 | +$form = new Form($db); |
|
14 | 14 | |
15 | 15 | |
16 | 16 | |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | <!-- Includes for JQuery (Ajax library) --> |
33 | 33 | <link rel="stylesheet" type="text/css" href="<?php echo DOL_URL_ROOT ?>/includes/jquery/css/smoothness/jquery-ui.css" /> |
34 | 34 | <!-- <link rel="stylesheet" type="text/css" href="<?php echo DOL_URL_ROOT ?>/includes/jquery/plugins/datatables/media/css/jquery.dataTables.css" /> --> |
35 | - <link rel="stylesheet" type="text/css" title="default" href="<?php echo DOL_URL_ROOT ?>/theme/eldy/style.css.php<?php echo ($_GET["dol_use_jmobile"] == 1)?'?dol_use_jmobile=1&dol_optimize_smallscreen=1':''; ?>" /> |
|
35 | + <link rel="stylesheet" type="text/css" title="default" href="<?php echo DOL_URL_ROOT ?>/theme/eldy/style.css.php<?php echo ($_GET["dol_use_jmobile"] == 1) ? '?dol_use_jmobile=1&dol_optimize_smallscreen=1' : ''; ?>" /> |
|
36 | 36 | <!-- Includes JS for JQuery --> |
37 | 37 | <script type="text/javascript" src="<?php echo DOL_URL_ROOT ?>/includes/jquery/js/jquery.min.js"></script> |
38 | 38 | <!-- migration fixes for removed Jquery functions --> |
@@ -49,8 +49,8 @@ discard block |
||
49 | 49 | } |
50 | 50 | else |
51 | 51 | { |
52 | - $arraycss=array(); |
|
53 | - $arrayjs=array(); |
|
52 | + $arraycss = array(); |
|
53 | + $arrayjs = array(); |
|
54 | 54 | /* |
55 | 55 | $arraycss=array('/includes/jquery/plugins/datatables/media/css/jquery.dataTables.css', |
56 | 56 | '/includes/jquery/plugins/datatables/extensions/Buttons/css/buttons.dataTables.min.css', |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | ); |
70 | 70 | */ |
71 | 71 | |
72 | - llxHeader('','','','',0,0,$arrayjs,$arraycss); |
|
72 | + llxHeader('', '', '', '', 0, 0, $arrayjs, $arraycss); |
|
73 | 73 | } |
74 | 74 | |
75 | 75 | |
@@ -154,76 +154,76 @@ discard block |
||
154 | 154 | |
155 | 155 | <?php |
156 | 156 | include_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; |
157 | -$productspecimen=new Product($db); |
|
157 | +$productspecimen = new Product($db); |
|
158 | 158 | $productspecimen->initAsSpecimen(); |
159 | 159 | |
160 | -$sortfield='aaa'; |
|
161 | -$sortorder='ASC'; |
|
162 | -$tasksarray=array(1,2,3); // To force having several lines |
|
163 | -$tagidfortablednd='tablelines3'; |
|
164 | -if (! empty($conf->use_javascript_ajax)) include DOL_DOCUMENT_ROOT.'/core/tpl/ajaxrow.tpl.php'; |
|
165 | - |
|
166 | -$nav=''; |
|
167 | -$nav.='<form name="dateselect" action="'.$_SERVER["PHP_SELF"].'?action=show_peruser'.$param.'">'; |
|
168 | -if ($actioncode || isset($_GET['actioncode']) || isset($_POST['actioncode'])) $nav.='<input type="hidden" name="actioncode" value="'.$actioncode.'">'; |
|
169 | -if ($status || isset($_GET['status']) || isset($_POST['status'])) $nav.='<input type="hidden" name="status" value="'.$status.'">'; |
|
170 | -if ($filter) $nav.='<input type="hidden" name="filter" value="'.$filter.'">'; |
|
171 | -if ($filtert) $nav.='<input type="hidden" name="filtert" value="'.$filtert.'">'; |
|
172 | -if ($socid) $nav.='<input type="hidden" name="socid" value="'.$socid.'">'; |
|
173 | -if ($showbirthday) $nav.='<input type="hidden" name="showbirthday" value="1">'; |
|
174 | -if ($pid) $nav.='<input type="hidden" name="projectid" value="'.$pid.'">'; |
|
175 | -if ($type) $nav.='<input type="hidden" name="type" value="'.$type.'">'; |
|
176 | -if ($usergroup) $nav.='<input type="hidden" name="usergroup" value="'.$usergroup.'">'; |
|
177 | -$nav.=$form->select_date($dateselect, 'dateselect', 0, 0, 1, '', 1, 0, 1); |
|
178 | -$nav.=' <input type="submit" name="submitdateselect" class="button" value="'.$langs->trans("Refresh").'">'; |
|
179 | -$nav.='</form>'; |
|
180 | - |
|
181 | -$limit=10; |
|
160 | +$sortfield = 'aaa'; |
|
161 | +$sortorder = 'ASC'; |
|
162 | +$tasksarray = array(1, 2, 3); // To force having several lines |
|
163 | +$tagidfortablednd = 'tablelines3'; |
|
164 | +if (!empty($conf->use_javascript_ajax)) include DOL_DOCUMENT_ROOT.'/core/tpl/ajaxrow.tpl.php'; |
|
165 | + |
|
166 | +$nav = ''; |
|
167 | +$nav .= '<form name="dateselect" action="'.$_SERVER["PHP_SELF"].'?action=show_peruser'.$param.'">'; |
|
168 | +if ($actioncode || isset($_GET['actioncode']) || isset($_POST['actioncode'])) $nav .= '<input type="hidden" name="actioncode" value="'.$actioncode.'">'; |
|
169 | +if ($status || isset($_GET['status']) || isset($_POST['status'])) $nav .= '<input type="hidden" name="status" value="'.$status.'">'; |
|
170 | +if ($filter) $nav .= '<input type="hidden" name="filter" value="'.$filter.'">'; |
|
171 | +if ($filtert) $nav .= '<input type="hidden" name="filtert" value="'.$filtert.'">'; |
|
172 | +if ($socid) $nav .= '<input type="hidden" name="socid" value="'.$socid.'">'; |
|
173 | +if ($showbirthday) $nav .= '<input type="hidden" name="showbirthday" value="1">'; |
|
174 | +if ($pid) $nav .= '<input type="hidden" name="projectid" value="'.$pid.'">'; |
|
175 | +if ($type) $nav .= '<input type="hidden" name="type" value="'.$type.'">'; |
|
176 | +if ($usergroup) $nav .= '<input type="hidden" name="usergroup" value="'.$usergroup.'">'; |
|
177 | +$nav .= $form->select_date($dateselect, 'dateselect', 0, 0, 1, '', 1, 0, 1); |
|
178 | +$nav .= ' <input type="submit" name="submitdateselect" class="button" value="'.$langs->trans("Refresh").'">'; |
|
179 | +$nav .= '</form>'; |
|
180 | + |
|
181 | +$limit = 10; |
|
182 | 182 | print_barre_liste('Title of my list', 12, $_SERVER["PHP_SELF"], '', '', '', 'Text in middle', 20, 500, '', 0, $nav, '', $limit); |
183 | 183 | |
184 | 184 | |
185 | -$moreforfilter.='<div class="divsearchfield">'; |
|
186 | -$moreforfilter.=$langs->trans('This is a select list for a filter A'). ': '; |
|
187 | -$cate_arbo = array('field1'=>'value1a into the select list A','field2'=>'value2a'); |
|
188 | -$moreforfilter.=$form->selectarray('search_aaa', $cate_arbo, '', 1); // List without js combo |
|
189 | -$moreforfilter.='</div>'; |
|
185 | +$moreforfilter .= '<div class="divsearchfield">'; |
|
186 | +$moreforfilter .= $langs->trans('This is a select list for a filter A').': '; |
|
187 | +$cate_arbo = array('field1'=>'value1a into the select list A', 'field2'=>'value2a'); |
|
188 | +$moreforfilter .= $form->selectarray('search_aaa', $cate_arbo, '', 1); // List without js combo |
|
189 | +$moreforfilter .= '</div>'; |
|
190 | 190 | |
191 | -$moreforfilter.='<div class="divsearchfield">'; |
|
192 | -$moreforfilter.=$langs->trans('This is a select list for a filter B'). ': '; |
|
193 | -$cate_arbo = array('field1'=>'value1b into the select list B','field2'=>'value2b'); |
|
194 | -$moreforfilter.=$form->selectarray('search_bbb', $cate_arbo, '', 1, 0, 0, '', 0, 0, 0, 0, '', 1); // List with js combo |
|
195 | -$moreforfilter.='</div>'; |
|
191 | +$moreforfilter .= '<div class="divsearchfield">'; |
|
192 | +$moreforfilter .= $langs->trans('This is a select list for a filter B').': '; |
|
193 | +$cate_arbo = array('field1'=>'value1b into the select list B', 'field2'=>'value2b'); |
|
194 | +$moreforfilter .= $form->selectarray('search_bbb', $cate_arbo, '', 1, 0, 0, '', 0, 0, 0, 0, '', 1); // List with js combo |
|
195 | +$moreforfilter .= '</div>'; |
|
196 | 196 | |
197 | -$moreforfilter.='<div class="divsearchfield">'; |
|
198 | -$moreforfilter.=$langs->trans('This is a select list for a filter C'). ': '; |
|
199 | -$cate_arbo = array('field1'=>'value1c into the select list C','field2'=>'value2c'); |
|
200 | -$moreforfilter.=$form->selectarray('search_ccc', $cate_arbo, '', 1, 0, 0, '', 0, 0, 0, 0, '', 1); // List with js combo |
|
201 | -$moreforfilter.='</div>'; |
|
197 | +$moreforfilter .= '<div class="divsearchfield">'; |
|
198 | +$moreforfilter .= $langs->trans('This is a select list for a filter C').': '; |
|
199 | +$cate_arbo = array('field1'=>'value1c into the select list C', 'field2'=>'value2c'); |
|
200 | +$moreforfilter .= $form->selectarray('search_ccc', $cate_arbo, '', 1, 0, 0, '', 0, 0, 0, 0, '', 1); // List with js combo |
|
201 | +$moreforfilter .= '</div>'; |
|
202 | 202 | |
203 | -$moreforfilter.='<div class="divsearchfield">'; |
|
204 | -$moreforfilter.=$langs->trans('This is a select list for a filter D'). ': '; |
|
205 | -$cate_arbo = array('field1'=>'value1d into the select list D','field2'=>'value2d'); |
|
206 | -$moreforfilter.=$form->selectarray('search_ddd', $cate_arbo, '', 1, 0, 0, '', 0, 0, 0, 0, '', 1); // List with js combo |
|
207 | -$moreforfilter.='</div>'; |
|
203 | +$moreforfilter .= '<div class="divsearchfield">'; |
|
204 | +$moreforfilter .= $langs->trans('This is a select list for a filter D').': '; |
|
205 | +$cate_arbo = array('field1'=>'value1d into the select list D', 'field2'=>'value2d'); |
|
206 | +$moreforfilter .= $form->selectarray('search_ddd', $cate_arbo, '', 1, 0, 0, '', 0, 0, 0, 0, '', 1); // List with js combo |
|
207 | +$moreforfilter .= '</div>'; |
|
208 | 208 | |
209 | -if (! empty($moreforfilter)) |
|
209 | +if (!empty($moreforfilter)) |
|
210 | 210 | { |
211 | 211 | print '<div class="liste_titre liste_titre_bydiv centpercent">'; |
212 | 212 | print $moreforfilter; |
213 | - $parameters=array(); |
|
214 | - $reshook=$hookmanager->executeHooks('printFieldPreListTitle',$parameters); // Note that $action and $object may have been modified by hook |
|
213 | + $parameters = array(); |
|
214 | + $reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters); // Note that $action and $object may have been modified by hook |
|
215 | 215 | print $hookmanager->resPrint; |
216 | 216 | print '</div>'; |
217 | 217 | } |
218 | 218 | |
219 | 219 | ?> |
220 | 220 | |
221 | -<table class="stripe row-border order-column centpercent tagtable liste<?php echo $moreforfilter?" listwithfilterbefore":""; ?>" id="tablelines3"> |
|
221 | +<table class="stripe row-border order-column centpercent tagtable liste<?php echo $moreforfilter ? " listwithfilterbefore" : ""; ?>" id="tablelines3"> |
|
222 | 222 | <thead> |
223 | 223 | <tr class="liste_titre"> |
224 | -<?php print getTitleFieldOfList($langs->trans('title1'),0,$_SERVER["PHP_SELF"],'aaa','','','align="left"',$sortfield,$sortorder); ?> |
|
225 | -<?php print getTitleFieldOfList($langs->trans('title2'),0,$_SERVER["PHP_SELF"],'bbb','','','align="right"',$sortfield,$sortorder); ?> |
|
226 | -<?php print getTitleFieldOfList($langs->trans('title3'),0,$_SERVER["PHP_SELF"],'ccc','','','align="center"',$sortfield,$sortorder); ?> |
|
224 | +<?php print getTitleFieldOfList($langs->trans('title1'), 0, $_SERVER["PHP_SELF"], 'aaa', '', '', 'align="left"', $sortfield, $sortorder); ?> |
|
225 | +<?php print getTitleFieldOfList($langs->trans('title2'), 0, $_SERVER["PHP_SELF"], 'bbb', '', '', 'align="right"', $sortfield, $sortorder); ?> |
|
226 | +<?php print getTitleFieldOfList($langs->trans('title3'), 0, $_SERVER["PHP_SELF"], 'ccc', '', '', 'align="center"', $sortfield, $sortorder); ?> |
|
227 | 227 | </tr> |
228 | 228 | </thead> |
229 | 229 | <tbody> |
@@ -246,7 +246,7 @@ discard block |
||
246 | 246 | $(document).ready(function(){ |
247 | 247 | $('#idtableexample2').dataTable( { |
248 | 248 | <?php |
249 | - if ($optioncss=='print') { |
|
249 | + if ($optioncss == 'print') { |
|
250 | 250 | print '\'dom\': \'lfrtip\','; |
251 | 251 | } else { |
252 | 252 | print '\'dom\': \'Blfrtip\','; |
@@ -293,9 +293,9 @@ discard block |
||
293 | 293 | |
294 | 294 | |
295 | 295 | <?php |
296 | - $tasksarray=array(1,2,3); // To force having several lines |
|
297 | - $tagidfortablednd='tablelines'; |
|
298 | - if (! empty($conf->use_javascript_ajax)) include DOL_DOCUMENT_ROOT.'/core/tpl/ajaxrow.tpl.php'; |
|
296 | + $tasksarray = array(1, 2, 3); // To force having several lines |
|
297 | + $tagidfortablednd = 'tablelines'; |
|
298 | + if (!empty($conf->use_javascript_ajax)) include DOL_DOCUMENT_ROOT.'/core/tpl/ajaxrow.tpl.php'; |
|
299 | 299 | ?> |
300 | 300 | <div class="tagtable centpercent liste_titre_bydiv" id="tablelines"> |
301 | 301 | <div class="tagtr liste_titre"> |
@@ -341,7 +341,7 @@ discard block |
||
341 | 341 | |
342 | 342 | |
343 | 343 | <?php |
344 | -if (! empty($usedolheader)) |
|
344 | +if (!empty($usedolheader)) |
|
345 | 345 | { |
346 | 346 | llxFooter(); |
347 | 347 | } else { ?> |
@@ -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; |
@@ -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 |
@@ -36,15 +36,15 @@ |
||
36 | 36 | |
37 | 37 | if (! GETPOST('transkey') && ! GETPOST('transphrase')) |
38 | 38 | { |
39 | - print 'Sorry, it seems your internet connexion is off.<br>'; |
|
40 | - print 'You need to be connected to network to use this software.<br>'; |
|
39 | + print 'Sorry, it seems your internet connexion is off.<br>'; |
|
40 | + print 'You need to be connected to network to use this software.<br>'; |
|
41 | 41 | } |
42 | 42 | else |
43 | 43 | { |
44 | - $langs->load("error"); |
|
45 | - $langs->load("other"); |
|
44 | + $langs->load("error"); |
|
45 | + $langs->load("other"); |
|
46 | 46 | |
47 | - if (GETPOST('transphrase')) print GETPOST('transphrase'); |
|
48 | - if (GETPOST('transkey')) print $langs->trans(GETPOST('transkey')); |
|
47 | + if (GETPOST('transphrase')) print GETPOST('transphrase'); |
|
48 | + if (GETPOST('transkey')) print $langs->trans(GETPOST('transkey')); |
|
49 | 49 | } |
50 | 50 |
@@ -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>'; |
@@ -38,13 +38,16 @@ |
||
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>'; |
41 | -} |
|
42 | -else |
|
41 | +} else |
|
43 | 42 | { |
44 | 43 | $langs->load("error"); |
45 | 44 | $langs->load("other"); |
46 | 45 | |
47 | - if (GETPOST('transphrase')) print GETPOST('transphrase'); |
|
48 | - if (GETPOST('transkey')) print $langs->trans(GETPOST('transkey')); |
|
49 | -} |
|
46 | + if (GETPOST('transphrase')) { |
|
47 | + print GETPOST('transphrase'); |
|
48 | + } |
|
49 | + if (GETPOST('transkey')) { |
|
50 | + print $langs->trans(GETPOST('transkey')); |
|
51 | + } |
|
52 | + } |
|
50 | 53 |