@@ -19,7 +19,6 @@ |
||
| 19 | 19 | use Luracast\Restler\Restler; |
| 20 | 20 | use Luracast\Restler\RestException; |
| 21 | 21 | use Luracast\Restler\Defaults; |
| 22 | -use Luracast\Restler\Format\UploadFormat; |
|
| 23 | 22 | |
| 24 | 23 | require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php'; |
| 25 | 24 | |
@@ -50,7 +50,9 @@ discard block |
||
| 50 | 50 | { |
| 51 | 51 | global $conf, $dolibarr_main_url_root; |
| 52 | 52 | |
| 53 | - if (empty($cachedir)) $cachedir = $conf->api->dir_temp; |
|
| 53 | + if (empty($cachedir)) { |
|
| 54 | + $cachedir = $conf->api->dir_temp; |
|
| 55 | + } |
|
| 54 | 56 | Defaults::$cacheDirectory = $cachedir; |
| 55 | 57 | |
| 56 | 58 | $this->db = $db; |
@@ -183,8 +185,7 @@ discard block |
||
| 183 | 185 | $featuresarray = array($resource); |
| 184 | 186 | if (preg_match('/&/', $resource)) { |
| 185 | 187 | $featuresarray = explode("&", $resource); |
| 186 | - } |
|
| 187 | - else if (preg_match('/\|/', $resource)) { |
|
| 188 | + } else if (preg_match('/\|/', $resource)) { |
|
| 188 | 189 | $featuresarray = explode("|", $resource); |
| 189 | 190 | } |
| 190 | 191 | |
@@ -212,8 +213,12 @@ discard block |
||
| 212 | 213 | $counter=0; |
| 213 | 214 | while ($i < $nb) |
| 214 | 215 | { |
| 215 | - if ($tmp[$i]=='(') $counter++; |
|
| 216 | - if ($tmp[$i]==')') $counter--; |
|
| 216 | + if ($tmp[$i]=='(') { |
|
| 217 | + $counter++; |
|
| 218 | + } |
|
| 219 | + if ($tmp[$i]==')') { |
|
| 220 | + $counter--; |
|
| 221 | + } |
|
| 217 | 222 | if ($counter < 0) |
| 218 | 223 | { |
| 219 | 224 | $error="Bad sqlfilters=".$sqlfilters; |
@@ -236,16 +241,19 @@ discard block |
||
| 236 | 241 | global $db; |
| 237 | 242 | |
| 238 | 243 | //dol_syslog("Convert matches ".$matches[1]); |
| 239 | - if (empty($matches[1])) return ''; |
|
| 244 | + if (empty($matches[1])) { |
|
| 245 | + return ''; |
|
| 246 | + } |
|
| 240 | 247 | $tmp=explode(':',$matches[1]); |
| 241 | - if (count($tmp) < 3) return ''; |
|
| 248 | + if (count($tmp) < 3) { |
|
| 249 | + return ''; |
|
| 250 | + } |
|
| 242 | 251 | |
| 243 | 252 | $tmpescaped=$tmp[2]; |
| 244 | 253 | if (preg_match('/^\'(.*)\'$/', $tmpescaped, $regbis)) |
| 245 | 254 | { |
| 246 | 255 | $tmpescaped = "'".$db->escape($regbis[1])."'"; |
| 247 | - } |
|
| 248 | - else |
|
| 256 | + } else |
|
| 249 | 257 | { |
| 250 | 258 | $tmpescaped = $db->escape($tmpescaped); |
| 251 | 259 | } |
@@ -18,7 +18,6 @@ |
||
| 18 | 18 | */ |
| 19 | 19 | |
| 20 | 20 | use Luracast\Restler\RestException; |
| 21 | -use Luracast\Restler\Format\UploadFormat; |
|
| 22 | 21 | |
| 23 | 22 | |
| 24 | 23 | require_once DOL_DOCUMENT_ROOT.'/main.inc.php'; |
@@ -109,8 +109,12 @@ discard block |
||
| 109 | 109 | } |
| 110 | 110 | |
| 111 | 111 | $newfilecontent = ''; |
| 112 | - if (empty($fileencoding)) $newfilecontent = $filecontent; |
|
| 113 | - if ($fileencoding == 'base64') $newfilecontent = base64_decode($filecontent); |
|
| 112 | + if (empty($fileencoding)) { |
|
| 113 | + $newfilecontent = $filecontent; |
|
| 114 | + } |
|
| 115 | + if ($fileencoding == 'base64') { |
|
| 116 | + $newfilecontent = base64_decode($filecontent); |
|
| 117 | + } |
|
| 114 | 118 | |
| 115 | 119 | $original_file = dol_sanitizeFileName($filename); |
| 116 | 120 | |
@@ -138,10 +142,11 @@ discard block |
||
| 138 | 142 | { |
| 139 | 143 | throw new RestException(500, 'This value of modulepart does not support yet usage of ref. Check modulepart parameter or try to use subdir parameter instead of ref.'); |
| 140 | 144 | } |
| 141 | - } |
|
| 142 | - else |
|
| 145 | + } else |
|
| 143 | 146 | { |
| 144 | - if ($modulepart == 'invoice') $modulepart ='facture'; |
|
| 147 | + if ($modulepart == 'invoice') { |
|
| 148 | + $modulepart ='facture'; |
|
| 149 | + } |
|
| 145 | 150 | |
| 146 | 151 | $tmp = dol_check_secure_access_document($modulepart, $subdir, $entity, DolibarrApiAccess::$user, '', 'write'); |
| 147 | 152 | $upload_dir = $tmp['original_file']; |
@@ -174,8 +179,7 @@ discard block |
||
| 174 | 179 | $nbofbyteswrote = fwrite($fhandle, $newfilecontent); |
| 175 | 180 | fclose($fhandle); |
| 176 | 181 | @chmod($destfiletmp, octdec($conf->global->MAIN_UMASK)); |
| 177 | - } |
|
| 178 | - else |
|
| 182 | + } else |
|
| 179 | 183 | { |
| 180 | 184 | throw new RestException(500, "Failed to open file '".$destfiletmp."' for write"); |
| 181 | 185 | } |
@@ -195,8 +199,9 @@ discard block |
||
| 195 | 199 | function _validate_file($data) { |
| 196 | 200 | $result = array(); |
| 197 | 201 | foreach (Documents::$DOCUMENT_FIELDS as $field) { |
| 198 | - if (!isset($data[$field])) |
|
| 199 | - throw new RestException(400, "$field field missing"); |
|
| 202 | + if (!isset($data[$field])) { |
|
| 203 | + throw new RestException(400, "$field field missing"); |
|
| 204 | + } |
|
| 200 | 205 | $result[$field] = $data[$field]; |
| 201 | 206 | } |
| 202 | 207 | return $result; |
@@ -32,10 +32,20 @@ discard block |
||
| 32 | 32 | //if (! defined('NOREQUIREDB')) define('NOREQUIREDB','1'); |
| 33 | 33 | //if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1'); |
| 34 | 34 | //if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1'); |
| 35 | -if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL','1'); |
|
| 36 | -if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU','1'); // If there is no menu to show |
|
| 37 | -if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML','1'); // If we don't need to load the html.form.class.php |
|
| 38 | -if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1'); |
|
| 35 | +if (! defined('NOTOKENRENEWAL')) { |
|
| 36 | + define('NOTOKENRENEWAL','1'); |
|
| 37 | +} |
|
| 38 | +if (! defined('NOREQUIREMENU')) { |
|
| 39 | + define('NOREQUIREMENU','1'); |
|
| 40 | +} |
|
| 41 | +// If there is no menu to show |
|
| 42 | +if (! defined('NOREQUIREHTML')) { |
|
| 43 | + define('NOREQUIREHTML','1'); |
|
| 44 | +} |
|
| 45 | +// If we don't need to load the html.form.class.php |
|
| 46 | +if (! defined('NOREQUIREAJAX')) { |
|
| 47 | + define('NOREQUIREAJAX','1'); |
|
| 48 | +} |
|
| 39 | 49 | define("NOLOGIN",1); // This means this output page does not require to be logged. |
| 40 | 50 | define("NOCSRFCHECK",1); // We accept to go on this page from external web site. |
| 41 | 51 | |
@@ -57,27 +67,53 @@ discard block |
||
| 57 | 67 | require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php'; |
| 58 | 68 | |
| 59 | 69 | // Security check |
| 60 | -if (empty($conf->agenda->enabled)) accessforbidden('',0,0,1); |
|
| 70 | +if (empty($conf->agenda->enabled)) { |
|
| 71 | + accessforbidden('',0,0,1); |
|
| 72 | +} |
|
| 61 | 73 | |
| 62 | 74 | // Not older than |
| 63 | -if (! isset($conf->global->MAIN_AGENDA_EXPORT_PAST_DELAY)) $conf->global->MAIN_AGENDA_EXPORT_PAST_DELAY=100; // default limit |
|
| 75 | +if (! isset($conf->global->MAIN_AGENDA_EXPORT_PAST_DELAY)) { |
|
| 76 | + $conf->global->MAIN_AGENDA_EXPORT_PAST_DELAY=100; |
|
| 77 | +} |
|
| 78 | +// default limit |
|
| 64 | 79 | |
| 65 | 80 | // Define format, type and filter |
| 66 | 81 | $format='ical'; |
| 67 | 82 | $type='event'; |
| 68 | -if (GETPOST("format",'alpha')) $format=GETPOST("format",'apha'); |
|
| 69 | -if (GETPOST("type",'apha')) $type=GETPOST("type",'alpha'); |
|
| 83 | +if (GETPOST("format",'alpha')) { |
|
| 84 | + $format=GETPOST("format",'apha'); |
|
| 85 | +} |
|
| 86 | +if (GETPOST("type",'apha')) { |
|
| 87 | + $type=GETPOST("type",'alpha'); |
|
| 88 | +} |
|
| 70 | 89 | |
| 71 | 90 | $filters=array(); |
| 72 | -if (GETPOST("year",'int')) $filters['year']=GETPOST("year",'int'); |
|
| 73 | -if (GETPOST("id",'int')) $filters['id']=GETPOST("id",'int'); |
|
| 74 | -if (GETPOST("idfrom",'int')) $filters['idfrom']=GETPOST("idfrom",'int'); |
|
| 75 | -if (GETPOST("idto",'int')) $filters['idto']=GETPOST("idto",'int'); |
|
| 76 | -if (GETPOST("project",'apha')) $filters['project']=GETPOST("project",'apha'); |
|
| 77 | -if (GETPOST("logina",'apha')) $filters['logina']=GETPOST("logina",'apha'); |
|
| 78 | -if (GETPOST("logint",'apha')) $filters['logint']=GETPOST("logint",'apha'); |
|
| 79 | -if (GETPOST("notolderthan",'int')) $filters['notolderthan']=GETPOST("notolderthan","int"); |
|
| 80 | -else $filters['notolderthan']=$conf->global->MAIN_AGENDA_EXPORT_PAST_DELAY; |
|
| 91 | +if (GETPOST("year",'int')) { |
|
| 92 | + $filters['year']=GETPOST("year",'int'); |
|
| 93 | +} |
|
| 94 | +if (GETPOST("id",'int')) { |
|
| 95 | + $filters['id']=GETPOST("id",'int'); |
|
| 96 | +} |
|
| 97 | +if (GETPOST("idfrom",'int')) { |
|
| 98 | + $filters['idfrom']=GETPOST("idfrom",'int'); |
|
| 99 | +} |
|
| 100 | +if (GETPOST("idto",'int')) { |
|
| 101 | + $filters['idto']=GETPOST("idto",'int'); |
|
| 102 | +} |
|
| 103 | +if (GETPOST("project",'apha')) { |
|
| 104 | + $filters['project']=GETPOST("project",'apha'); |
|
| 105 | +} |
|
| 106 | +if (GETPOST("logina",'apha')) { |
|
| 107 | + $filters['logina']=GETPOST("logina",'apha'); |
|
| 108 | +} |
|
| 109 | +if (GETPOST("logint",'apha')) { |
|
| 110 | + $filters['logint']=GETPOST("logint",'apha'); |
|
| 111 | +} |
|
| 112 | +if (GETPOST("notolderthan",'int')) { |
|
| 113 | + $filters['notolderthan']=GETPOST("notolderthan","int"); |
|
| 114 | +} else { |
|
| 115 | + $filters['notolderthan']=$conf->global->MAIN_AGENDA_EXPORT_PAST_DELAY; |
|
| 116 | +} |
|
| 81 | 117 | |
| 82 | 118 | // Check config |
| 83 | 119 | if (empty($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY)) |
@@ -109,13 +145,29 @@ discard block |
||
| 109 | 145 | foreach ($filters as $key => $value) |
| 110 | 146 | { |
| 111 | 147 | //if ($key == 'notolderthan') $filename.='-notolderthan'.$value; This filter key is already added before and does not need to be in filename |
| 112 | - if ($key == 'year') $filename.='-year'.$value; |
|
| 113 | - if ($key == 'id') $filename.='-id'.$value; |
|
| 114 | - if ($key == 'idfrom') $filename.='-idfrom'.$value; |
|
| 115 | - if ($key == 'idto') $filename.='-idto'.$value; |
|
| 116 | - if ($key == 'project') $filename.='-project'.$value; |
|
| 117 | - if ($key == 'logina') $filename.='-logina'.$value; // Author |
|
| 118 | - if ($key == 'logint') $filename.='-logint'.$value; // Assigned to |
|
| 148 | + if ($key == 'year') { |
|
| 149 | + $filename.='-year'.$value; |
|
| 150 | + } |
|
| 151 | + if ($key == 'id') { |
|
| 152 | + $filename.='-id'.$value; |
|
| 153 | + } |
|
| 154 | + if ($key == 'idfrom') { |
|
| 155 | + $filename.='-idfrom'.$value; |
|
| 156 | + } |
|
| 157 | + if ($key == 'idto') { |
|
| 158 | + $filename.='-idto'.$value; |
|
| 159 | + } |
|
| 160 | + if ($key == 'project') { |
|
| 161 | + $filename.='-project'.$value; |
|
| 162 | + } |
|
| 163 | + if ($key == 'logina') { |
|
| 164 | + $filename.='-logina'.$value; |
|
| 165 | + } |
|
| 166 | + // Author |
|
| 167 | + if ($key == 'logint') { |
|
| 168 | + $filename.='-logint'.$value; |
|
| 169 | + } |
|
| 170 | + // Assigned to |
|
| 119 | 171 | } |
| 120 | 172 | // Add extension |
| 121 | 173 | if ($format == 'vcal') { $shortfilename.='.vcs'; $filename.='.vcs'; } |
@@ -135,7 +187,9 @@ discard block |
||
| 135 | 187 | $agenda=new ActionComm($db); |
| 136 | 188 | |
| 137 | 189 | $cachedelay=0; |
| 138 | -if (! empty($conf->global->MAIN_AGENDA_EXPORT_CACHE)) $cachedelay=$conf->global->MAIN_AGENDA_EXPORT_CACHE; |
|
| 190 | +if (! empty($conf->global->MAIN_AGENDA_EXPORT_CACHE)) { |
|
| 191 | + $cachedelay=$conf->global->MAIN_AGENDA_EXPORT_CACHE; |
|
| 192 | +} |
|
| 139 | 193 | |
| 140 | 194 | // Build file |
| 141 | 195 | if ($format == 'ical' || $format == 'vcal') |
@@ -144,28 +198,40 @@ discard block |
||
| 144 | 198 | if ($result >= 0) |
| 145 | 199 | { |
| 146 | 200 | $attachment = true; |
| 147 | - if (isset($_GET["attachment"])) $attachment=$_GET["attachment"]; |
|
| 201 | + if (isset($_GET["attachment"])) { |
|
| 202 | + $attachment=$_GET["attachment"]; |
|
| 203 | + } |
|
| 148 | 204 | //$attachment = false; |
| 149 | 205 | $contenttype='text/calendar'; |
| 150 | - if (isset($_GET["contenttype"])) $contenttype=$_GET["contenttype"]; |
|
| 206 | + if (isset($_GET["contenttype"])) { |
|
| 207 | + $contenttype=$_GET["contenttype"]; |
|
| 208 | + } |
|
| 151 | 209 | //$contenttype='text/plain'; |
| 152 | 210 | $outputencoding='UTF-8'; |
| 153 | 211 | |
| 154 | - if ($contenttype) header('Content-Type: '.$contenttype.($outputencoding?'; charset='.$outputencoding:'')); |
|
| 155 | - if ($attachment) header('Content-Disposition: attachment; filename="'.$shortfilename.'"'); |
|
| 212 | + if ($contenttype) { |
|
| 213 | + header('Content-Type: '.$contenttype.($outputencoding?'; charset='.$outputencoding:'')); |
|
| 214 | + } |
|
| 215 | + if ($attachment) { |
|
| 216 | + header('Content-Disposition: attachment; filename="'.$shortfilename.'"'); |
|
| 217 | + } |
|
| 156 | 218 | |
| 157 | - if ($cachedelay) header('Cache-Control: max-age='.$cachedelay.', private, must-revalidate'); |
|
| 158 | - else header('Cache-Control: private, must-revalidate'); |
|
| 219 | + if ($cachedelay) { |
|
| 220 | + header('Cache-Control: max-age='.$cachedelay.', private, must-revalidate'); |
|
| 221 | + } else { |
|
| 222 | + header('Cache-Control: private, must-revalidate'); |
|
| 223 | + } |
|
| 159 | 224 | |
| 160 | 225 | // Clean parameters |
| 161 | 226 | $outputfile=$conf->agenda->dir_temp.'/'.$filename; |
| 162 | 227 | $result=readfile($outputfile); |
| 163 | - if (! $result) print 'File '.$outputfile.' was empty.'; |
|
| 228 | + if (! $result) { |
|
| 229 | + print 'File '.$outputfile.' was empty.'; |
|
| 230 | + } |
|
| 164 | 231 | |
| 165 | 232 | //header("Location: ".DOL_URL_ROOT.'/document.php?modulepart=agenda&file='.urlencode($filename)); |
| 166 | 233 | exit; |
| 167 | - } |
|
| 168 | - else |
|
| 234 | + } else |
|
| 169 | 235 | { |
| 170 | 236 | print 'Error '.$agenda->error; |
| 171 | 237 | |
@@ -179,31 +245,43 @@ discard block |
||
| 179 | 245 | if ($result >= 0) |
| 180 | 246 | { |
| 181 | 247 | $attachment = false; |
| 182 | - if (isset($_GET["attachment"])) $attachment=$_GET["attachment"]; |
|
| 248 | + if (isset($_GET["attachment"])) { |
|
| 249 | + $attachment=$_GET["attachment"]; |
|
| 250 | + } |
|
| 183 | 251 | //$attachment = false; |
| 184 | 252 | $contenttype='application/rss+xml'; |
| 185 | - if (isset($_GET["contenttype"])) $contenttype=$_GET["contenttype"]; |
|
| 253 | + if (isset($_GET["contenttype"])) { |
|
| 254 | + $contenttype=$_GET["contenttype"]; |
|
| 255 | + } |
|
| 186 | 256 | //$contenttype='text/plain'; |
| 187 | 257 | $outputencoding='UTF-8'; |
| 188 | 258 | |
| 189 | - if ($contenttype) header('Content-Type: '.$contenttype.($outputencoding?'; charset='.$outputencoding:'')); |
|
| 190 | - if ($attachment) header('Content-Disposition: attachment; filename="'.$filename.'"'); |
|
| 259 | + if ($contenttype) { |
|
| 260 | + header('Content-Type: '.$contenttype.($outputencoding?'; charset='.$outputencoding:'')); |
|
| 261 | + } |
|
| 262 | + if ($attachment) { |
|
| 263 | + header('Content-Disposition: attachment; filename="'.$filename.'"'); |
|
| 264 | + } |
|
| 191 | 265 | |
| 192 | 266 | // Ajout directives pour resoudre bug IE |
| 193 | 267 | //header('Cache-Control: Public, must-revalidate'); |
| 194 | 268 | //header('Pragma: public'); |
| 195 | - if ($cachedelay) header('Cache-Control: max-age='.$cachedelay.', private, must-revalidate'); |
|
| 196 | - else header('Cache-Control: private, must-revalidate'); |
|
| 269 | + if ($cachedelay) { |
|
| 270 | + header('Cache-Control: max-age='.$cachedelay.', private, must-revalidate'); |
|
| 271 | + } else { |
|
| 272 | + header('Cache-Control: private, must-revalidate'); |
|
| 273 | + } |
|
| 197 | 274 | |
| 198 | 275 | // Clean parameters |
| 199 | 276 | $outputfile=$conf->agenda->dir_temp.'/'.$filename; |
| 200 | 277 | $result=readfile($outputfile); |
| 201 | - if (! $result) print 'File '.$outputfile.' was empty.'; |
|
| 278 | + if (! $result) { |
|
| 279 | + print 'File '.$outputfile.' was empty.'; |
|
| 280 | + } |
|
| 202 | 281 | |
| 203 | 282 | // header("Location: ".DOL_URL_ROOT.'/document.php?modulepart=agenda&file='.urlencode($filename)); |
| 204 | 283 | exit; |
| 205 | - } |
|
| 206 | - else |
|
| 284 | + } else |
|
| 207 | 285 | { |
| 208 | 286 | print 'Error '.$agenda->error; |
| 209 | 287 | |
@@ -33,7 +33,9 @@ discard block |
||
| 33 | 33 | // Do not use GETPOST here, function is not defined and define must be done before including main.inc.php |
| 34 | 34 | // TODO This should be useless. Because entity must be retreive from object ref and not from url. |
| 35 | 35 | $entity=(! empty($_GET['entity']) ? (int) $_GET['entity'] : (! empty($_POST['entity']) ? (int) $_POST['entity'] : 1)); |
| 36 | -if (is_numeric($entity)) define("DOLENTITY", $entity); |
|
| 36 | +if (is_numeric($entity)) { |
|
| 37 | + define("DOLENTITY", $entity); |
|
| 38 | +} |
|
| 37 | 39 | |
| 38 | 40 | require '../../main.inc.php'; |
| 39 | 41 | require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; |
@@ -133,7 +135,9 @@ discard block |
||
| 133 | 135 | */ |
| 134 | 136 | |
| 135 | 137 | $head=''; |
| 136 | -if (! empty($conf->global->MAIN_SIGN_CSS_URL)) $head='<link rel="stylesheet" type="text/css" href="'.$conf->global->MAIN_SIGN_CSS_URL.'?lang='.$langs->defaultlang.'">'."\n"; |
|
| 138 | +if (! empty($conf->global->MAIN_SIGN_CSS_URL)) { |
|
| 139 | + $head='<link rel="stylesheet" type="text/css" href="'.$conf->global->MAIN_SIGN_CSS_URL.'?lang='.$langs->defaultlang.'">'."\n"; |
|
| 140 | +} |
|
| 137 | 141 | |
| 138 | 142 | $conf->dol_hide_topmenu=1; |
| 139 | 143 | $conf->dol_hide_leftmenu=1; |
@@ -170,16 +174,18 @@ discard block |
||
| 170 | 174 | $logosmall=$mysoc->logo_small; |
| 171 | 175 | $logo=$mysoc->logo; |
| 172 | 176 | $paramlogo='ONLINE_SIGN_LOGO_'.$suffix; |
| 173 | -if (! empty($conf->global->$paramlogo)) $logosmall=$conf->global->$paramlogo; |
|
| 174 | -else if (! empty($conf->global->ONLINE_SIGN_LOGO)) $logosmall=$conf->global->ONLINE_SIGN_LOGO; |
|
| 177 | +if (! empty($conf->global->$paramlogo)) { |
|
| 178 | + $logosmall=$conf->global->$paramlogo; |
|
| 179 | +} else if (! empty($conf->global->ONLINE_SIGN_LOGO)) { |
|
| 180 | + $logosmall=$conf->global->ONLINE_SIGN_LOGO; |
|
| 181 | +} |
|
| 175 | 182 | //print '<!-- Show logo (logosmall='.$logosmall.' logo='.$logo.') -->'."\n"; |
| 176 | 183 | // Define urllogo |
| 177 | 184 | $urllogo=''; |
| 178 | 185 | if (! empty($logosmall) && is_readable($conf->mycompany->dir_output.'/logos/thumbs/'.$logosmall)) |
| 179 | 186 | { |
| 180 | 187 | $urllogo=DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&file='.urlencode('thumbs/'.$logosmall); |
| 181 | -} |
|
| 182 | -elseif (! empty($logo) && is_readable($conf->mycompany->dir_output.'/logos/'.$logo)) |
|
| 188 | +} elseif (! empty($logo) && is_readable($conf->mycompany->dir_output.'/logos/'.$logo)) |
|
| 183 | 189 | { |
| 184 | 190 | $urllogo=DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&file='.urlencode($logo); |
| 185 | 191 | $width=96; |
@@ -189,7 +195,9 @@ discard block |
||
| 189 | 195 | { |
| 190 | 196 | print '<tr>'; |
| 191 | 197 | print '<td align="center"><img id="dolpaymentlogo" title="'.$title.'" src="'.$urllogo.'"'; |
| 192 | - if ($width) print ' width="'.$width.'"'; |
|
| 198 | + if ($width) { |
|
| 199 | + print ' width="'.$width.'"'; |
|
| 200 | + } |
|
| 193 | 201 | print '></td>'; |
| 194 | 202 | print '</tr>'."\n"; |
| 195 | 203 | } |
@@ -199,8 +207,11 @@ discard block |
||
| 199 | 207 | if (! empty($conf->global->ONLINE_SIGN_NEWFORM_TEXT)) |
| 200 | 208 | { |
| 201 | 209 | $langs->load("members"); |
| 202 | - if (preg_match('/^\((.*)\)$/',$conf->global->ONLINE_SIGN_NEWFORM_TEXT,$reg)) $text.=$langs->trans($reg[1])."<br>\n"; |
|
| 203 | - else $text.=$conf->global->ONLINE_SIGN_NEWFORM_TEXT."<br>\n"; |
|
| 210 | + if (preg_match('/^\((.*)\)$/',$conf->global->ONLINE_SIGN_NEWFORM_TEXT,$reg)) { |
|
| 211 | + $text.=$langs->trans($reg[1])."<br>\n"; |
|
| 212 | + } else { |
|
| 213 | + $text.=$conf->global->ONLINE_SIGN_NEWFORM_TEXT."<br>\n"; |
|
| 214 | + } |
|
| 204 | 215 | $text='<tr><td align="center"><br>'.$text.'<br></td></tr>'."\n"; |
| 205 | 216 | } |
| 206 | 217 | if (empty($text)) |
@@ -254,8 +265,7 @@ discard block |
||
| 254 | 265 | { |
| 255 | 266 | $mesg=$order->error; |
| 256 | 267 | $error++; |
| 257 | - } |
|
| 258 | - else |
|
| 268 | + } else |
|
| 259 | 269 | { |
| 260 | 270 | $result=$order->fetch_thirdparty($order->socid); |
| 261 | 271 | } |
@@ -299,16 +309,19 @@ discard block |
||
| 299 | 309 | { |
| 300 | 310 | $mesg=$invoice->error; |
| 301 | 311 | $error++; |
| 302 | - } |
|
| 303 | - else |
|
| 312 | + } else |
|
| 304 | 313 | { |
| 305 | 314 | $result=$invoice->fetch_thirdparty($invoice->socid); |
| 306 | 315 | } |
| 307 | 316 | |
| 308 | - if ($action != 'dosign') // Do not change amount if we just click on first dosign |
|
| 317 | + if ($action != 'dosign') { |
|
| 318 | + // Do not change amount if we just click on first dosign |
|
| 309 | 319 | { |
| 310 | 320 | $amount=price2num($invoice->total_ttc - $invoice->getSommePaiement()); |
| 311 | - if (GETPOST("amount",'int')) $amount=GETPOST("amount",'int'); |
|
| 321 | + } |
|
| 322 | + if (GETPOST("amount",'int')) { |
|
| 323 | + $amount=GETPOST("amount",'int'); |
|
| 324 | + } |
|
| 312 | 325 | $amount=price2num($amount); |
| 313 | 326 | } |
| 314 | 327 | |
@@ -349,8 +362,7 @@ discard block |
||
| 349 | 362 | { |
| 350 | 363 | $mesg=$contractline->error; |
| 351 | 364 | $error++; |
| 352 | - } |
|
| 353 | - else |
|
| 365 | + } else |
|
| 354 | 366 | { |
| 355 | 367 | if ($contractline->fk_contrat > 0) |
| 356 | 368 | { |
@@ -359,23 +371,23 @@ discard block |
||
| 359 | 371 | if ($result > 0) |
| 360 | 372 | { |
| 361 | 373 | $result=$contract->fetch_thirdparty($contract->socid); |
| 362 | - } |
|
| 363 | - else |
|
| 374 | + } else |
|
| 364 | 375 | { |
| 365 | 376 | $mesg=$contract->error; |
| 366 | 377 | $error++; |
| 367 | 378 | } |
| 368 | - } |
|
| 369 | - else |
|
| 379 | + } else |
|
| 370 | 380 | { |
| 371 | 381 | $mesg='ErrorRecordNotFound'; |
| 372 | 382 | $error++; |
| 373 | 383 | } |
| 374 | 384 | } |
| 375 | 385 | |
| 376 | - if ($action != 'dosign') // Do not change amount if we just click on first dosign |
|
| 386 | + if ($action != 'dosign') { |
|
| 387 | + // Do not change amount if we just click on first dosign |
|
| 377 | 388 | { |
| 378 | 389 | $amount=$contractline->total_ttc; |
| 390 | + } |
|
| 379 | 391 | if ($contractline->fk_product) |
| 380 | 392 | { |
| 381 | 393 | $product=new Product($db); |
@@ -387,8 +399,7 @@ discard block |
||
| 387 | 399 | $pu_ht = $product->multiprices[$contract->thirdparty->price_level]; |
| 388 | 400 | $pu_ttc = $product->multiprices_ttc[$contract->thirdparty->price_level]; |
| 389 | 401 | $price_base_type = $product->multiprices_base_type[$contract->thirdparty->price_level]; |
| 390 | - } |
|
| 391 | - else |
|
| 402 | + } else |
|
| 392 | 403 | { |
| 393 | 404 | $pu_ht = $product->price; |
| 394 | 405 | $pu_ttc = $product->price_ttc; |
@@ -402,12 +413,16 @@ discard block |
||
| 402 | 413 | exit; |
| 403 | 414 | } |
| 404 | 415 | } |
| 405 | - if (GETPOST("amount",'int')) $amount=GETPOST("amount",'int'); |
|
| 416 | + if (GETPOST("amount",'int')) { |
|
| 417 | + $amount=GETPOST("amount",'int'); |
|
| 418 | + } |
|
| 406 | 419 | $amount=price2num($amount); |
| 407 | 420 | } |
| 408 | 421 | |
| 409 | 422 | $qty=1; |
| 410 | - if (GETPOST('qty')) $qty=GETPOST('qty'); |
|
| 423 | + if (GETPOST('qty')) { |
|
| 424 | + $qty=GETPOST('qty'); |
|
| 425 | + } |
|
| 411 | 426 | |
| 412 | 427 | // Creditor |
| 413 | 428 | |
@@ -428,7 +443,9 @@ discard block |
||
| 428 | 443 | { |
| 429 | 444 | $text.='<br>'.$product->ref.($product->label?' - '.$product->label:''); |
| 430 | 445 | } |
| 431 | - if ($contractline->description) $text.='<br>'.dol_htmlentitiesbr($contractline->description); |
|
| 446 | + if ($contractline->description) { |
|
| 447 | + $text.='<br>'.dol_htmlentitiesbr($contractline->description); |
|
| 448 | + } |
|
| 432 | 449 | //if ($contractline->date_fin_validite) { |
| 433 | 450 | // $text.='<br>'.$langs->trans("DateEndPlanned").': '; |
| 434 | 451 | // $text.=dol_print_date($contractline->date_fin_validite); |
@@ -459,8 +476,7 @@ discard block |
||
| 459 | 476 | if ($product->duration_value > 1) |
| 460 | 477 | { |
| 461 | 478 | $dur=array("h"=>$langs->trans("Hours"),"d"=>$langs->trans("DurationDays"),"w"=>$langs->trans("DurationWeeks"),"m"=>$langs->trans("DurationMonths"),"y"=>$langs->trans("DurationYears")); |
| 462 | - } |
|
| 463 | - else |
|
| 479 | + } else |
|
| 464 | 480 | { |
| 465 | 481 | $dur=array("h"=>$langs->trans("Hour"),"d"=>$langs->trans("DurationDay"),"w"=>$langs->trans("DurationWeek"),"m"=>$langs->trans("DurationMonth"),"y"=>$langs->trans("DurationYear")); |
| 466 | 482 | } |
@@ -475,14 +491,15 @@ discard block |
||
| 475 | 491 | // Amount |
| 476 | 492 | |
| 477 | 493 | print '<tr class="CTableRow'.($var?'1':'2').'"><td class="CTableRow'.($var?'1':'2').'">'.$langs->trans("Amount"); |
| 478 | - if (empty($amount)) print ' ('.$langs->trans("ToComplete").')'; |
|
| 494 | + if (empty($amount)) { |
|
| 495 | + print ' ('.$langs->trans("ToComplete").')'; |
|
| 496 | + } |
|
| 479 | 497 | print '</td><td class="CTableRow'.($var?'1':'2').'">'; |
| 480 | 498 | if (empty($amount) || ! is_numeric($amount)) |
| 481 | 499 | { |
| 482 | 500 | print '<input type="hidden" name="amount" value="'.GETPOST("amount",'int').'">'; |
| 483 | 501 | print '<input class="flat" size=8 type="text" name="newamount" value="'.GETPOST("newamount","int").'">'; |
| 484 | - } |
|
| 485 | - else { |
|
| 502 | + } else { |
|
| 486 | 503 | print '<b>'.price($amount).'</b>'; |
| 487 | 504 | print '<input type="hidden" name="amount" value="'.$amount.'">'; |
| 488 | 505 | print '<input type="hidden" name="newamount" value="'.$amount.'">'; |
@@ -509,16 +526,19 @@ discard block |
||
| 509 | 526 | { |
| 510 | 527 | $mesg=$member->error; |
| 511 | 528 | $error++; |
| 512 | - } |
|
| 513 | - else |
|
| 529 | + } else |
|
| 514 | 530 | { |
| 515 | 531 | $subscription=new Subscription($db); |
| 516 | 532 | } |
| 517 | 533 | |
| 518 | - if ($action != 'dosign') // Do not change amount if we just click on first dosign |
|
| 534 | + if ($action != 'dosign') { |
|
| 535 | + // Do not change amount if we just click on first dosign |
|
| 519 | 536 | { |
| 520 | 537 | $amount=$subscription->total_ttc; |
| 521 | - if (GETPOST("amount",'int')) $amount=GETPOST("amount",'int'); |
|
| 538 | + } |
|
| 539 | + if (GETPOST("amount",'int')) { |
|
| 540 | + $amount=GETPOST("amount",'int'); |
|
| 541 | + } |
|
| 522 | 542 | $amount=price2num($amount); |
| 523 | 543 | } |
| 524 | 544 | |
@@ -537,8 +557,11 @@ discard block |
||
| 537 | 557 | |
| 538 | 558 | print '<tr class="CTableRow'.($var?'1':'2').'"><td class="CTableRow'.($var?'1':'2').'">'.$langs->trans("Member"); |
| 539 | 559 | print '</td><td class="CTableRow'.($var?'1':'2').'"><b>'; |
| 540 | - if ($member->morphy == 'mor' && ! empty($member->societe)) print $member->societe; |
|
| 541 | - else print $member->getFullName($langs); |
|
| 560 | + if ($member->morphy == 'mor' && ! empty($member->societe)) { |
|
| 561 | + print $member->societe; |
|
| 562 | + } else { |
|
| 563 | + print $member->getFullName($langs); |
|
| 564 | + } |
|
| 542 | 565 | print '</b>'; |
| 543 | 566 | |
| 544 | 567 | // Object |
@@ -564,7 +587,9 @@ discard block |
||
| 564 | 587 | print '</td><td class="CTableRow'.($var?'1':'2').'">'.price($member->last_subscription_amount); |
| 565 | 588 | print '</td></tr>'."\n"; |
| 566 | 589 | |
| 567 | - if (empty($amount) && ! GETPOST('newamount')) $_GET['newamount']=$member->last_subscription_amount; |
|
| 590 | + if (empty($amount) && ! GETPOST('newamount')) { |
|
| 591 | + $_GET['newamount']=$member->last_subscription_amount; |
|
| 592 | + } |
|
| 568 | 593 | } |
| 569 | 594 | |
| 570 | 595 | // Amount |
@@ -573,20 +598,25 @@ discard block |
||
| 573 | 598 | if (empty($amount)) |
| 574 | 599 | { |
| 575 | 600 | print ' ('.$langs->trans("ToComplete"); |
| 576 | - if (! empty($conf->global->MEMBER_EXT_URL_SUBSCRIPTION_INFO)) print ' - <a href="'.$conf->global->MEMBER_EXT_URL_SUBSCRIPTION_INFO.'" rel="external" target="_blank">'.$langs->trans("SeeHere").'</a>'; |
|
| 601 | + if (! empty($conf->global->MEMBER_EXT_URL_SUBSCRIPTION_INFO)) { |
|
| 602 | + print ' - <a href="'.$conf->global->MEMBER_EXT_URL_SUBSCRIPTION_INFO.'" rel="external" target="_blank">'.$langs->trans("SeeHere").'</a>'; |
|
| 603 | + } |
|
| 577 | 604 | print ')'; |
| 578 | 605 | } |
| 579 | 606 | print '</td><td class="CTableRow'.($var?'1':'2').'">'; |
| 580 | 607 | if (empty($amount) || ! is_numeric($amount)) |
| 581 | 608 | { |
| 582 | 609 | $valtoshow=GETPOST("newamount",'int'); |
| 583 | - if (! empty($conf->global->MEMBER_MIN_AMOUNT) && $valtoshow) $valtoshow=max($conf->global->MEMBER_MIN_AMOUNT,$valtoshow); |
|
| 610 | + if (! empty($conf->global->MEMBER_MIN_AMOUNT) && $valtoshow) { |
|
| 611 | + $valtoshow=max($conf->global->MEMBER_MIN_AMOUNT,$valtoshow); |
|
| 612 | + } |
|
| 584 | 613 | print '<input type="hidden" name="amount" value="'.GETPOST("amount",'int').'">'; |
| 585 | 614 | print '<input class="flat" size="8" type="text" name="newamount" value="'.$valtoshow.'">'; |
| 586 | - } |
|
| 587 | - else { |
|
| 615 | + } else { |
|
| 588 | 616 | $valtoshow=$amount; |
| 589 | - if (! empty($conf->global->MEMBER_MIN_AMOUNT) && $valtoshow) $valtoshow=max($conf->global->MEMBER_MIN_AMOUNT,$valtoshow); |
|
| 617 | + if (! empty($conf->global->MEMBER_MIN_AMOUNT) && $valtoshow) { |
|
| 618 | + $valtoshow=max($conf->global->MEMBER_MIN_AMOUNT,$valtoshow); |
|
| 619 | + } |
|
| 590 | 620 | print '<b>'.price($valtoshow).'</b>'; |
| 591 | 621 | print '<input type="hidden" name="amount" value="'.$valtoshow.'">'; |
| 592 | 622 | print '<input type="hidden" name="newamount" value="'.$valtoshow.'">'; |
@@ -601,16 +631,21 @@ discard block |
||
| 601 | 631 | |
| 602 | 632 | |
| 603 | 633 | |
| 604 | -if (! $found && ! $mesg) $mesg=$langs->trans("ErrorBadParameters"); |
|
| 634 | +if (! $found && ! $mesg) { |
|
| 635 | + $mesg=$langs->trans("ErrorBadParameters"); |
|
| 636 | +} |
|
| 605 | 637 | |
| 606 | -if ($mesg) print '<tr><td align="center" colspan="2"><br><div class="warning">'.$mesg.'</div></td></tr>'."\n"; |
|
| 638 | +if ($mesg) { |
|
| 639 | + print '<tr><td align="center" colspan="2"><br><div class="warning">'.$mesg.'</div></td></tr>'."\n"; |
|
| 640 | +} |
|
| 607 | 641 | |
| 608 | 642 | print '</table>'."\n"; |
| 609 | 643 | print "\n"; |
| 610 | 644 | |
| 611 | 645 | if ($action != 'dosign') |
| 612 | 646 | { |
| 613 | - if ($found && ! $error) // We are in a management option and no error |
|
| 647 | + if ($found && ! $error) { |
|
| 648 | + // We are in a management option and no error |
|
| 614 | 649 | { |
| 615 | 650 | |
| 616 | 651 | |
@@ -619,8 +654,8 @@ discard block |
||
| 619 | 654 | { |
| 620 | 655 | dol_print_error_email('ERRORNEWONLINESIGNPAYPAL'); |
| 621 | 656 | } |
| 622 | -} |
|
| 623 | -else |
|
| 657 | + } |
|
| 658 | +} else |
|
| 624 | 659 | { |
| 625 | 660 | |
| 626 | 661 | } |
@@ -31,7 +31,9 @@ discard block |
||
| 31 | 31 | // Do not use GETPOST here, function is not defined and define must be done before including main.inc.php |
| 32 | 32 | // TODO This should be useless. Because entity must be retreive from object ref and not from url. |
| 33 | 33 | $entity=(! empty($_GET['entity']) ? (int) $_GET['entity'] : (! empty($_POST['entity']) ? (int) $_POST['entity'] : 1)); |
| 34 | -if (is_numeric($entity)) define("DOLENTITY", $entity); |
|
| 34 | +if (is_numeric($entity)) { |
|
| 35 | + define("DOLENTITY", $entity); |
|
| 36 | +} |
|
| 35 | 37 | |
| 36 | 38 | require '../../main.inc.php'; |
| 37 | 39 | require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; |
@@ -39,7 +41,9 @@ discard block |
||
| 39 | 41 | require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; |
| 40 | 42 | |
| 41 | 43 | // Security check |
| 42 | -if (empty($conf->adherent->enabled)) accessforbidden('',0,0,1); |
|
| 44 | +if (empty($conf->adherent->enabled)) { |
|
| 45 | + accessforbidden('',0,0,1); |
|
| 46 | +} |
|
| 43 | 47 | |
| 44 | 48 | |
| 45 | 49 | $langs->load("main"); |
@@ -66,8 +70,11 @@ discard block |
||
| 66 | 70 | */ |
| 67 | 71 | |
| 68 | 72 | $morehead=''; |
| 69 | -if (! empty($conf->global->MEMBER_PUBLIC_CSS)) $morehead='<link rel="stylesheet" type="text/css" href="'.$conf->global->MEMBER_PUBLIC_CSS.'">'; |
|
| 70 | -else $morehead='<link rel="stylesheet" type="text/css" href="'.DOL_URL_ROOT.'/theme/eldy/style.css.php'.'">'; |
|
| 73 | +if (! empty($conf->global->MEMBER_PUBLIC_CSS)) { |
|
| 74 | + $morehead='<link rel="stylesheet" type="text/css" href="'.$conf->global->MEMBER_PUBLIC_CSS.'">'; |
|
| 75 | +} else { |
|
| 76 | + $morehead='<link rel="stylesheet" type="text/css" href="'.DOL_URL_ROOT.'/theme/eldy/style.css.php'.'">'; |
|
| 77 | +} |
|
| 71 | 78 | |
| 72 | 79 | llxHeaderVierge($langs->trans("MemberCard"), $morehead); |
| 73 | 80 | |
@@ -84,8 +91,7 @@ discard block |
||
| 84 | 91 | if (empty($object->public)) |
| 85 | 92 | { |
| 86 | 93 | print $langs->trans("ErrorThisMemberIsNotPublic"); |
| 87 | - } |
|
| 88 | - else |
|
| 94 | + } else |
|
| 89 | 95 | { |
| 90 | 96 | print '<table class="public_border" cellspacing="0" width="100%" cellpadding="3">'; |
| 91 | 97 | |
@@ -140,7 +146,9 @@ discard block |
||
| 140 | 146 | print "<html>\n"; |
| 141 | 147 | print "<head>\n"; |
| 142 | 148 | print "<title>".$title."</title>\n"; |
| 143 | - if ($head) print $head."\n"; |
|
| 149 | + if ($head) { |
|
| 150 | + print $head."\n"; |
|
| 151 | + } |
|
| 144 | 152 | print "</head>\n"; |
| 145 | 153 | print '<body class="public_body">'."\n"; |
| 146 | 154 | } |
@@ -31,12 +31,16 @@ discard block |
||
| 31 | 31 | // Do not use GETPOST here, function is not defined and define must be done before including main.inc.php |
| 32 | 32 | // TODO This should be useless. Because entity must be retreive from object ref and not from url. |
| 33 | 33 | $entity=(! empty($_GET['entity']) ? (int) $_GET['entity'] : (! empty($_POST['entity']) ? (int) $_POST['entity'] : 1)); |
| 34 | -if (is_numeric($entity)) define("DOLENTITY", $entity); |
|
| 34 | +if (is_numeric($entity)) { |
|
| 35 | + define("DOLENTITY", $entity); |
|
| 36 | +} |
|
| 35 | 37 | |
| 36 | 38 | require '../../main.inc.php'; |
| 37 | 39 | |
| 38 | 40 | // Security check |
| 39 | -if (empty($conf->adherent->enabled)) accessforbidden('',0,0,1); |
|
| 41 | +if (empty($conf->adherent->enabled)) { |
|
| 42 | + accessforbidden('',0,0,1); |
|
| 43 | +} |
|
| 40 | 44 | |
| 41 | 45 | |
| 42 | 46 | $langs->load("main"); |
@@ -60,7 +64,9 @@ discard block |
||
| 60 | 64 | print "<html>\n"; |
| 61 | 65 | print "<head>\n"; |
| 62 | 66 | print "<title>".$title."</title>\n"; |
| 63 | - if ($head) print $head."\n"; |
|
| 67 | + if ($head) { |
|
| 68 | + print $head."\n"; |
|
| 69 | + } |
|
| 64 | 70 | print "</head>\n"; |
| 65 | 71 | print '<body class="public_body">'."\n"; |
| 66 | 72 | } |
@@ -102,8 +108,11 @@ discard block |
||
| 102 | 108 | $form = new Form($db); |
| 103 | 109 | |
| 104 | 110 | $morehead=''; |
| 105 | -if (! empty($conf->global->MEMBER_PUBLIC_CSS)) $morehead='<link rel="stylesheet" type="text/css" href="'.$conf->global->MEMBER_PUBLIC_CSS.'">'; |
|
| 106 | -else $morehead='<link rel="stylesheet" type="text/css" href="'.DOL_URL_ROOT.'/theme/eldy/style.css.php'.'">'; |
|
| 111 | +if (! empty($conf->global->MEMBER_PUBLIC_CSS)) { |
|
| 112 | + $morehead='<link rel="stylesheet" type="text/css" href="'.$conf->global->MEMBER_PUBLIC_CSS.'">'; |
|
| 113 | +} else { |
|
| 114 | + $morehead='<link rel="stylesheet" type="text/css" href="'.DOL_URL_ROOT.'/theme/eldy/style.css.php'.'">'; |
|
| 115 | +} |
|
| 107 | 116 | |
| 108 | 117 | llxHeaderVierge($langs->trans("ListOfValidatedPublicMembers"), $morehead); |
| 109 | 118 | |
@@ -155,8 +164,7 @@ discard block |
||
| 155 | 164 | print '<td>'; |
| 156 | 165 | print $form->showphoto('memberphoto', $objp, 64); |
| 157 | 166 | print '</td>'."\n"; |
| 158 | - } |
|
| 159 | - else |
|
| 167 | + } else |
|
| 160 | 168 | { |
| 161 | 169 | print "<td> </td>\n"; |
| 162 | 170 | } |
@@ -164,8 +172,7 @@ discard block |
||
| 164 | 172 | $i++; |
| 165 | 173 | } |
| 166 | 174 | print "</table>"; |
| 167 | -} |
|
| 168 | -else |
|
| 175 | +} else |
|
| 169 | 176 | { |
| 170 | 177 | dol_print_error($db); |
| 171 | 178 | } |
@@ -25,11 +25,25 @@ |
||
| 25 | 25 | * \brief Script use to update mail status if destinaries read it (if images during mail read are display) |
| 26 | 26 | */ |
| 27 | 27 | |
| 28 | -if (! defined('NOLOGIN')) define("NOLOGIN",1); // This means this output page does not require to be logged. |
|
| 29 | -if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1'); |
|
| 30 | -if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK','1'); // Do not check anti CSRF attack test |
|
| 31 | -if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL','1'); // Do not check anti POST attack test |
|
| 32 | -if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU','1'); // If there is no need to load and show top and left menu |
|
| 28 | +if (! defined('NOLOGIN')) { |
|
| 29 | + define("NOLOGIN",1); |
|
| 30 | +} |
|
| 31 | +// This means this output page does not require to be logged. |
|
| 32 | +if (! defined('NOREQUIRETRAN')) { |
|
| 33 | + define('NOREQUIRETRAN','1'); |
|
| 34 | +} |
|
| 35 | +if (! defined('NOCSRFCHECK')) { |
|
| 36 | + define('NOCSRFCHECK','1'); |
|
| 37 | +} |
|
| 38 | +// Do not check anti CSRF attack test |
|
| 39 | +if (! defined('NOTOKENRENEWAL')) { |
|
| 40 | + define('NOTOKENRENEWAL','1'); |
|
| 41 | +} |
|
| 42 | +// Do not check anti POST attack test |
|
| 43 | +if (! defined('NOREQUIREMENU')) { |
|
| 44 | + define('NOREQUIREMENU','1'); |
|
| 45 | +} |
|
| 46 | +// If there is no need to load and show top and left menu |
|
| 33 | 47 | |
| 34 | 48 | /** |
| 35 | 49 | * Header empty |
@@ -26,9 +26,18 @@ discard block |
||
| 26 | 26 | * \brief Script use to update unsubcribe contact to prospect mailing list |
| 27 | 27 | */ |
| 28 | 28 | |
| 29 | -if (! defined('NOLOGIN')) define("NOLOGIN",1); // This means this output page does not require to be logged. |
|
| 30 | -if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK','1'); // Do not check anti CSRF attack test |
|
| 31 | -if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU','1'); // If there is no need to load and show top and left menu |
|
| 29 | +if (! defined('NOLOGIN')) { |
|
| 30 | + define("NOLOGIN",1); |
|
| 31 | +} |
|
| 32 | +// This means this output page does not require to be logged. |
|
| 33 | +if (! defined('NOCSRFCHECK')) { |
|
| 34 | + define('NOCSRFCHECK','1'); |
|
| 35 | +} |
|
| 36 | +// Do not check anti CSRF attack test |
|
| 37 | +if (! defined('NOREQUIREMENU')) { |
|
| 38 | + define('NOREQUIREMENU','1'); |
|
| 39 | +} |
|
| 40 | +// If there is no need to load and show top and left menu |
|
| 32 | 41 | |
| 33 | 42 | /** |
| 34 | 43 | * Header empty |
@@ -78,21 +87,27 @@ discard block |
||
| 78 | 87 | dol_syslog("public/emailing/mailing-unsubscribe.php : Mail unsubcribe : ".$sql, LOG_DEBUG); |
| 79 | 88 | |
| 80 | 89 | $resql=$db->query($sql); |
| 81 | - if (! $resql) dol_print_error($db); |
|
| 90 | + if (! $resql) { |
|
| 91 | + dol_print_error($db); |
|
| 92 | + } |
|
| 82 | 93 | |
| 83 | 94 | // Update status communication of thirdparty prospect |
| 84 | 95 | $sql = "UPDATE ".MAIN_DB_PREFIX."societe SET fk_stcomm=-1 WHERE rowid IN (SELECT source_id FROM ".MAIN_DB_PREFIX."mailing_cibles WHERE tag='".$db->escape($tag)."' AND source_type='thirdparty' AND source_id is not null)"; |
| 85 | 96 | dol_syslog("public/emailing/mailing-unsubscribe.php : Mail unsubcribe thirdparty : ".$sql, LOG_DEBUG); |
| 86 | 97 | |
| 87 | 98 | $resql=$db->query($sql); |
| 88 | - if (! $resql) dol_print_error($db); |
|
| 99 | + if (! $resql) { |
|
| 100 | + dol_print_error($db); |
|
| 101 | + } |
|
| 89 | 102 | |
| 90 | 103 | // Update status communication of contact prospect |
| 91 | 104 | $sql = "UPDATE ".MAIN_DB_PREFIX."socpeople SET no_email=1 WHERE rowid IN (SELECT source_id FROM ".MAIN_DB_PREFIX."mailing_cibles WHERE tag = '".$db->escape($tag)."' AND source_type='contact' AND source_id is not null)"; |
| 92 | 105 | dol_syslog("public/emailing/mailing-unsubscribe.php : Mail unsubcribe contact : ".$sql, LOG_DEBUG); |
| 93 | 106 | |
| 94 | 107 | $resql=$db->query($sql); |
| 95 | - if (! $resql) dol_print_error($db); |
|
| 108 | + if (! $resql) { |
|
| 109 | + dol_print_error($db); |
|
| 110 | + } |
|
| 96 | 111 | |
| 97 | 112 | |
| 98 | 113 | $sql = "SELECT mc.email"; |
@@ -100,7 +115,9 @@ discard block |
||
| 100 | 115 | $sql .= " WHERE mc.tag='".$db->escape($tag)."'"; |
| 101 | 116 | |
| 102 | 117 | $resql=$db->query($sql); |
| 103 | - if (! $resql) dol_print_error($db); |
|
| 118 | + if (! $resql) { |
|
| 119 | + dol_print_error($db); |
|
| 120 | + } |
|
| 104 | 121 | |
| 105 | 122 | $obj = $db->fetch_object($resql); |
| 106 | 123 | |
@@ -43,7 +43,9 @@ discard block |
||
| 43 | 43 | |
| 44 | 44 | // Security check |
| 45 | 45 | global $dolibarr_main_demo; |
| 46 | -if (empty($dolibarr_main_demo)) accessforbidden('Parameter dolibarr_main_demo must be defined in conf file with value "default login,default pass" to enable the demo entry page',0,0,1); |
|
| 46 | +if (empty($dolibarr_main_demo)) { |
|
| 47 | + accessforbidden('Parameter dolibarr_main_demo must be defined in conf file with value "default login,default pass" to enable the demo entry page',0,0,1); |
|
| 48 | +} |
|
| 47 | 49 | |
| 48 | 50 | // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context |
| 49 | 51 | $res=$hookmanager->initHooks(array('demo')); |
@@ -160,8 +162,7 @@ discard block |
||
| 160 | 162 | if ($objMod->numero > 0) |
| 161 | 163 | { |
| 162 | 164 | $j = $objMod->numero; |
| 163 | - } |
|
| 164 | - else |
|
| 165 | + } else |
|
| 165 | 166 | { |
| 166 | 167 | $j = 1000 + $i; |
| 167 | 168 | } |
@@ -170,8 +171,12 @@ discard block |
||
| 170 | 171 | |
| 171 | 172 | // We discard modules according to features level (PS: if module is activated we always show it) |
| 172 | 173 | $const_name = 'MAIN_MODULE_'.strtoupper(preg_replace('/^mod/i','',get_class($objMod))); |
| 173 | - if ($objMod->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2 && empty($conf->global->$const_name)) $modulequalified=0; |
|
| 174 | - if ($objMod->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1 && empty($conf->global->$const_name)) $modulequalified=0; |
|
| 174 | + if ($objMod->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2 && empty($conf->global->$const_name)) { |
|
| 175 | + $modulequalified=0; |
|
| 176 | + } |
|
| 177 | + if ($objMod->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1 && empty($conf->global->$const_name)) { |
|
| 178 | + $modulequalified=0; |
|
| 179 | + } |
|
| 175 | 180 | |
| 176 | 181 | if ($modulequalified) |
| 177 | 182 | { |
@@ -179,14 +184,18 @@ discard block |
||
| 179 | 184 | $filename[$i]= $modName; |
| 180 | 185 | $orders[$i] = $objMod->family."_".$j; // Tri par famille puis numero module |
| 181 | 186 | //print "x".$modName." ".$orders[$i]."\n<br>"; |
| 182 | - if (isset($categ[$objMod->special])) $categ[$objMod->special]++; // Array of all different modules categories |
|
| 183 | - else $categ[$objMod->special]=1; |
|
| 187 | + if (isset($categ[$objMod->special])) { |
|
| 188 | + $categ[$objMod->special]++; |
|
| 189 | + } |
|
| 190 | + // Array of all different modules categories |
|
| 191 | + else { |
|
| 192 | + $categ[$objMod->special]=1; |
|
| 193 | + } |
|
| 184 | 194 | $dirmod[$i] = $dirroot; |
| 185 | 195 | $j++; |
| 186 | 196 | $i++; |
| 187 | 197 | } |
| 188 | - } |
|
| 189 | - catch(Exception $e) |
|
| 198 | + } catch(Exception $e) |
|
| 190 | 199 | { |
| 191 | 200 | dol_syslog("Failed to load ".$dir.$file." ".$e->getMessage(), LOG_ERR); |
| 192 | 201 | } |
@@ -204,10 +213,12 @@ discard block |
||
| 204 | 213 | * Actions |
| 205 | 214 | */ |
| 206 | 215 | |
| 207 | -if (GETPOST('action','aZ09') == 'gotodemo') // Action run when we click on "Start" after selection modules |
|
| 216 | +if (GETPOST('action','aZ09') == 'gotodemo') { |
|
| 217 | + // Action run when we click on "Start" after selection modules |
|
| 208 | 218 | { |
| 209 | 219 | //print 'ee'.GETPOST("demochoice"); |
| 210 | 220 | $disablestring=''; |
| 221 | +} |
|
| 211 | 222 | // If we disable modules using a profile choice |
| 212 | 223 | if (GETPOST("demochoice")) |
| 213 | 224 | { |
@@ -227,14 +238,18 @@ discard block |
||
| 227 | 238 | if (empty($_POST[$modulekeyname]) && empty($val->always_enabled) && ! in_array($modulekeyname,$alwayscheckedmodules)) |
| 228 | 239 | { |
| 229 | 240 | $disablestring.=$modulekeyname.','; |
| 230 | - if ($modulekeyname=='propale') $disablestring.='propal,'; |
|
| 241 | + if ($modulekeyname=='propale') { |
|
| 242 | + $disablestring.='propal,'; |
|
| 243 | + } |
|
| 231 | 244 | } |
| 232 | 245 | } |
| 233 | 246 | |
| 234 | 247 | // Do redirect to login page |
| 235 | 248 | if ($disablestring) |
| 236 | 249 | { |
| 237 | - if (GETPOST('urlfrom')) $url.=(preg_match('/\?/',$url)?'&':'?').'urlfrom='.urlencode(GETPOST('urlfrom','alpha')); |
|
| 250 | + if (GETPOST('urlfrom')) { |
|
| 251 | + $url.=(preg_match('/\?/',$url)?'&':'?').'urlfrom='.urlencode(GETPOST('urlfrom','alpha')); |
|
| 252 | + } |
|
| 238 | 253 | $url.=(preg_match('/\?/',$url)?'&':'?').'disablemodules='.$disablestring; |
| 239 | 254 | //var_dump($url);exit; |
| 240 | 255 | header("Location: ".$url); |
@@ -305,7 +320,9 @@ discard block |
||
| 305 | 320 | if ($profilearray['default'] >= 0) |
| 306 | 321 | { |
| 307 | 322 | //print $profilearray['lang']; |
| 308 | - if (! empty($profilearray['lang'])) $langs->load($profilearray['lang']); |
|
| 323 | + if (! empty($profilearray['lang'])) { |
|
| 324 | + $langs->load($profilearray['lang']); |
|
| 325 | + } |
|
| 309 | 326 | |
| 310 | 327 | $url=$_SERVER["PHP_SELF"].'?action=gotodemo'; |
| 311 | 328 | $urlwithmod=$url.'&demochoice='.$profilearray['key']; |
@@ -374,32 +391,45 @@ discard block |
||
| 374 | 391 | $j=0; |
| 375 | 392 | $nbcolsmod=empty($conf->dol_optimize_smallscreen)?4:3; |
| 376 | 393 | //var_dump($modules); |
| 377 | - foreach($orders as $index => $key) // Loop on qualified (enabled) modules |
|
| 394 | + foreach($orders as $index => $key) { |
|
| 395 | + // Loop on qualified (enabled) modules |
|
| 378 | 396 | { |
| 379 | 397 | //print $index.' '.$key; |
| 380 | 398 | $val = $modules[$index]; |
| 399 | + } |
|
| 381 | 400 | $modulekeyname=strtolower($val->name); |
| 382 | 401 | |
| 383 | 402 | $modulequalified=1; |
| 384 | - if (! empty($val->always_enabled) || in_array($modulekeyname,$alwayshiddenuncheckedmodules)) $modulequalified=0; |
|
| 385 | - if ($val->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2 && ! $conf->global->$const_name) $modulequalified=0; |
|
| 386 | - if ($val->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1 && ! $conf->global->$const_name) $modulequalified=0; |
|
| 387 | - if (! $modulequalified) continue; |
|
| 403 | + if (! empty($val->always_enabled) || in_array($modulekeyname,$alwayshiddenuncheckedmodules)) { |
|
| 404 | + $modulequalified=0; |
|
| 405 | + } |
|
| 406 | + if ($val->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2 && ! $conf->global->$const_name) { |
|
| 407 | + $modulequalified=0; |
|
| 408 | + } |
|
| 409 | + if ($val->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1 && ! $conf->global->$const_name) { |
|
| 410 | + $modulequalified=0; |
|
| 411 | + } |
|
| 412 | + if (! $modulequalified) { |
|
| 413 | + continue; |
|
| 414 | + } |
|
| 388 | 415 | |
| 389 | 416 | if (in_array($modulekeyname,$alwayshiddencheckedmodules)) |
| 390 | 417 | { |
| 391 | 418 | print "\n".'<!-- Module '.$modulekeyname.' hidden and always checked -->'; |
| 392 | 419 | print '<input type="hidden" name="'.$modulekeyname.'" value="1">'; |
| 393 | - } |
|
| 394 | - else |
|
| 420 | + } else |
|
| 395 | 421 | { |
| 396 | 422 | $modulo=($j % $nbcolsmod); |
| 397 | 423 | //if ($modulo == 0) print '<tr>'; |
| 398 | 424 | print '<!-- id='.$val->numero.' -->'; |
| 399 | 425 | print '<div class="nowrap">'; |
| 400 | 426 | print '<input type="checkbox" class="checkbox" name="'.$modulekeyname.'" value="1"'; |
| 401 | - if (in_array($modulekeyname,$alwaysuncheckedmodules)) print ' disabled'; |
|
| 402 | - if (! in_array($modulekeyname,$alwaysuncheckedmodules) && (! in_array($modulekeyname,$listofdisabledmodules) || in_array($modulekeyname,$alwayscheckedmodules))) print ' checked'; |
|
| 427 | + if (in_array($modulekeyname,$alwaysuncheckedmodules)) { |
|
| 428 | + print ' disabled'; |
|
| 429 | + } |
|
| 430 | + if (! in_array($modulekeyname,$alwaysuncheckedmodules) && (! in_array($modulekeyname,$listofdisabledmodules) || in_array($modulekeyname,$alwayscheckedmodules))) { |
|
| 431 | + print ' checked'; |
|
| 432 | + } |
|
| 403 | 433 | print '> <div class="inline-block demomaxoveflow">'.$val->getName().'</div><br>'; |
| 404 | 434 | print '</div>'; |
| 405 | 435 | //if ($modulo == ($nbcolsmod - 1)) print '</tr>'; |
@@ -444,8 +474,7 @@ discard block |
||
| 444 | 474 | print 'src="http://pagead2.googlesyndication.com/pagead/show_ads.js">'."\n"; |
| 445 | 475 | print '</script>'."\n"; |
| 446 | 476 | print '</div>'."\n"; |
| 447 | - } |
|
| 448 | - else |
|
| 477 | + } else |
|
| 449 | 478 | { |
| 450 | 479 | print '<!-- google js advert tag disabled with jmobile -->'."\n"; |
| 451 | 480 | } |