@@ -32,9 +32,9 @@ |
||
32 | 32 | // Link invoice to order |
33 | 33 | if ($action == 'addlink' && ! empty($permissiondellink) && ! GETPOST('cancel','alpha') && $id > 0 && $addlinkid > 0) |
34 | 34 | { |
35 | - $object->fetch($id); |
|
36 | - $object->fetch_thirdparty(); |
|
37 | - $result = $object->add_object_linked(GETPOST('addlink','alpha'), $addlinkid); |
|
35 | + $object->fetch($id); |
|
36 | + $object->fetch_thirdparty(); |
|
37 | + $result = $object->add_object_linked(GETPOST('addlink','alpha'), $addlinkid); |
|
38 | 38 | } |
39 | 39 | |
40 | 40 | // Delete link |
@@ -26,21 +26,21 @@ |
||
26 | 26 | // $object must be defined |
27 | 27 | // $permissiondellink must be defined |
28 | 28 | |
29 | -$dellinkid = GETPOST('dellinkid','int'); |
|
30 | -$addlinkid = GETPOST('idtolinkto','int'); |
|
29 | +$dellinkid = GETPOST('dellinkid', 'int'); |
|
30 | +$addlinkid = GETPOST('idtolinkto', 'int'); |
|
31 | 31 | |
32 | 32 | // Link invoice to order |
33 | -if ($action == 'addlink' && ! empty($permissiondellink) && ! GETPOST('cancel','alpha') && $id > 0 && $addlinkid > 0) |
|
33 | +if ($action == 'addlink' && !empty($permissiondellink) && !GETPOST('cancel', 'alpha') && $id > 0 && $addlinkid > 0) |
|
34 | 34 | { |
35 | 35 | $object->fetch($id); |
36 | 36 | $object->fetch_thirdparty(); |
37 | - $result = $object->add_object_linked(GETPOST('addlink','alpha'), $addlinkid); |
|
37 | + $result = $object->add_object_linked(GETPOST('addlink', 'alpha'), $addlinkid); |
|
38 | 38 | } |
39 | 39 | |
40 | 40 | // Delete link |
41 | -if ($action == 'dellink' && ! empty($permissiondellink) && ! GETPOST('cancel','alpha') && $dellinkid > 0) |
|
41 | +if ($action == 'dellink' && !empty($permissiondellink) && !GETPOST('cancel', 'alpha') && $dellinkid > 0) |
|
42 | 42 | { |
43 | - $result=$object->deleteObjectLinked(0, '', 0, '', $dellinkid); |
|
44 | - if ($result < 0) setEventMessages($object->error,$object->errors,'errors'); |
|
43 | + $result = $object->deleteObjectLinked(0, '', 0, '', $dellinkid); |
|
44 | + if ($result < 0) setEventMessages($object->error, $object->errors, 'errors'); |
|
45 | 45 | } |
46 | 46 |
@@ -41,6 +41,8 @@ |
||
41 | 41 | if ($action == 'dellink' && ! empty($permissiondellink) && ! GETPOST('cancel','alpha') && $dellinkid > 0) |
42 | 42 | { |
43 | 43 | $result=$object->deleteObjectLinked(0, '', 0, '', $dellinkid); |
44 | - if ($result < 0) setEventMessages($object->error,$object->errors,'errors'); |
|
45 | -} |
|
44 | + if ($result < 0) { |
|
45 | + setEventMessages($object->error,$object->errors,'errors'); |
|
46 | + } |
|
47 | + } |
|
46 | 48 |
@@ -240,8 +240,8 @@ |
||
240 | 240 | |
241 | 241 | if ($langs->trans("FormatDateShortJavaInput")=="FormatDateShortJavaInput") |
242 | 242 | { |
243 | - print "ERROR FormatDateShortJavaInput not defined for language ".$langs->defaultlang; |
|
244 | - exit; |
|
243 | + print "ERROR FormatDateShortJavaInput not defined for language ".$langs->defaultlang; |
|
244 | + exit; |
|
245 | 245 | } |
246 | 246 | |
247 | 247 | // Sur click dans calendrier, appelle fonction dpClickDay |
@@ -26,26 +26,26 @@ discard block |
||
26 | 26 | * \brief File to manage popup date selector |
27 | 27 | */ |
28 | 28 | |
29 | -if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER','1'); // disabled |
|
29 | +if (!defined('NOREQUIREUSER')) define('NOREQUIREUSER', '1'); // disabled |
|
30 | 30 | //if (! defined('NOREQUIREDB')) define('NOREQUIREDB','1'); // Not disabled cause need to load personalized language |
31 | -if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1'); |
|
31 | +if (!defined('NOREQUIRESOC')) define('NOREQUIRESOC', '1'); |
|
32 | 32 | //if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1'); // Not disabled cause need to do translations |
33 | -if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK',1); |
|
34 | -if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL',1); |
|
35 | -if (! defined('NOLOGIN')) define('NOLOGIN',1); // disabled |
|
36 | -if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU',1); |
|
37 | -if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML',1); |
|
33 | +if (!defined('NOCSRFCHECK')) define('NOCSRFCHECK', 1); |
|
34 | +if (!defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', 1); |
|
35 | +if (!defined('NOLOGIN')) define('NOLOGIN', 1); // disabled |
|
36 | +if (!defined('NOREQUIREMENU')) define('NOREQUIREMENU', 1); |
|
37 | +if (!defined('NOREQUIREHTML')) define('NOREQUIREHTML', 1); |
|
38 | 38 | |
39 | 39 | require_once '../main.inc.php'; |
40 | 40 | require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; |
41 | 41 | |
42 | -if (GETPOST('lang', 'aZ09')) $langs->setDefaultLang(GETPOST('lang', 'aZ09')); // If language was forced on URL by the main.inc.php |
|
42 | +if (GETPOST('lang', 'aZ09')) $langs->setDefaultLang(GETPOST('lang', 'aZ09')); // If language was forced on URL by the main.inc.php |
|
43 | 43 | |
44 | 44 | $langs->load("main"); |
45 | 45 | $langs->load("agenda"); |
46 | 46 | |
47 | -$right=($langs->trans("DIRECTION")=='rtl'?'left':'right'); |
|
48 | -$left=($langs->trans("DIRECTION")=='rtl'?'right':'left'); |
|
47 | +$right = ($langs->trans("DIRECTION") == 'rtl' ? 'left' : 'right'); |
|
48 | +$left = ($langs->trans("DIRECTION") == 'rtl' ? 'right' : 'left'); |
|
49 | 49 | |
50 | 50 | //var_dump($langs->defaultlang); |
51 | 51 | //var_dump($conf->format_date_short_java); |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | } |
67 | 67 | |
68 | 68 | // Define tradMonths javascript array (we define this in datapicker AND in parent page to avoid errors with IE8) |
69 | -$tradTemp=array($langs->trans("January"), |
|
69 | +$tradTemp = array($langs->trans("January"), |
|
70 | 70 | $langs->trans("February"), |
71 | 71 | $langs->trans("March"), |
72 | 72 | $langs->trans("April"), |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | ); |
82 | 82 | print '<script type="text/javascript">'; |
83 | 83 | print 'var tradMonths = ['; |
84 | -foreach($tradTemp as $val) |
|
84 | +foreach ($tradTemp as $val) |
|
85 | 85 | { |
86 | 86 | print '"'.addslashes($val).'",'; |
87 | 87 | } |
@@ -92,29 +92,29 @@ discard block |
||
92 | 92 | print '<body>'."\n"; |
93 | 93 | |
94 | 94 | |
95 | -$qualified=true; |
|
95 | +$qualified = true; |
|
96 | 96 | |
97 | -if (! isset($_GET["sd"])) $_GET["sd"]="00000000"; |
|
97 | +if (!isset($_GET["sd"])) $_GET["sd"] = "00000000"; |
|
98 | 98 | |
99 | -if (! isset($_GET["m"])) $qualified=false; |
|
100 | -if (! isset($_GET["y"])) $qualified=false; |
|
99 | +if (!isset($_GET["m"])) $qualified = false; |
|
100 | +if (!isset($_GET["y"])) $qualified = false; |
|
101 | 101 | if (isset($_GET["m"]) && isset($_GET["y"])) |
102 | 102 | { |
103 | - if ($_GET["m"] < 1) $qualified=false; |
|
104 | - if ($_GET["m"] > 12) $qualified=false; |
|
105 | - if ($_GET["y"] < 0) $qualified=false; |
|
106 | - if ($_GET["y"] > 9999) $qualified=false; |
|
103 | + if ($_GET["m"] < 1) $qualified = false; |
|
104 | + if ($_GET["m"] > 12) $qualified = false; |
|
105 | + if ($_GET["y"] < 0) $qualified = false; |
|
106 | + if ($_GET["y"] > 9999) $qualified = false; |
|
107 | 107 | } |
108 | 108 | |
109 | 109 | // If parameters provided, we show calendar |
110 | 110 | if ($qualified) |
111 | 111 | { |
112 | 112 | //print $_GET["cm"].",".$_GET["sd"].",".$_GET["m"].",".$_GET["y"];exit; |
113 | - displayBox(GETPOST("sd",'alpha'),GETPOST("m",'int'),GETPOST("y",'int')); |
|
113 | + displayBox(GETPOST("sd", 'alpha'), GETPOST("m", 'int'), GETPOST("y", 'int')); |
|
114 | 114 | } |
115 | 115 | else |
116 | 116 | { |
117 | - dol_print_error('','ErrorBadParameters'); |
|
117 | + dol_print_error('', 'ErrorBadParameters'); |
|
118 | 118 | } |
119 | 119 | |
120 | 120 | |
@@ -128,10 +128,10 @@ discard block |
||
128 | 128 | */ |
129 | 129 | function xyzToUnixTimestamp($mysqldate) |
130 | 130 | { |
131 | - $year=substr($mysqldate,0,4); |
|
132 | - $month=substr($mysqldate,4,2); |
|
133 | - $day=substr($mysqldate,6,2); |
|
134 | - $unixtimestamp=dol_mktime(12,0,0,$month,$day,$year); |
|
131 | + $year = substr($mysqldate, 0, 4); |
|
132 | + $month = substr($mysqldate, 4, 2); |
|
133 | + $day = substr($mysqldate, 6, 2); |
|
134 | + $unixtimestamp = dol_mktime(12, 0, 0, $month, $day, $year); |
|
135 | 135 | return $unixtimestamp; |
136 | 136 | } |
137 | 137 | |
@@ -143,24 +143,24 @@ discard block |
||
143 | 143 | * @param int $year Year |
144 | 144 | * @return void |
145 | 145 | */ |
146 | -function displayBox($selectedDate,$month,$year) |
|
146 | +function displayBox($selectedDate, $month, $year) |
|
147 | 147 | { |
148 | - global $langs,$conf; |
|
148 | + global $langs, $conf; |
|
149 | 149 | |
150 | 150 | //print "$selectedDate,$month,$year"; |
151 | - $thedate=dol_mktime(12,0,0,$month,1,$year); |
|
151 | + $thedate = dol_mktime(12, 0, 0, $month, 1, $year); |
|
152 | 152 | //print "thedate=$thedate"; |
153 | - $today=dol_now(); |
|
154 | - $todayArray=dol_getdate($today); |
|
155 | - if($selectedDate != "00000000") |
|
153 | + $today = dol_now(); |
|
154 | + $todayArray = dol_getdate($today); |
|
155 | + if ($selectedDate != "00000000") |
|
156 | 156 | { |
157 | - $selDate=xyzToUnixTimestamp($selectedDate); |
|
158 | - $xyz=dol_print_date($selDate,"%Y%m%d"); |
|
157 | + $selDate = xyzToUnixTimestamp($selectedDate); |
|
158 | + $xyz = dol_print_date($selDate, "%Y%m%d"); |
|
159 | 159 | } |
160 | 160 | else |
161 | 161 | { |
162 | - $selDate=0; |
|
163 | - $xyz=0; |
|
162 | + $selDate = 0; |
|
163 | + $xyz = 0; |
|
164 | 164 | } |
165 | 165 | ?> |
166 | 166 | <table class="dp"> |
@@ -177,42 +177,42 @@ discard block |
||
177 | 177 | </tr> |
178 | 178 | <tr> |
179 | 179 | <td class="dpButtons" |
180 | - onClick="loadMonth('<?php echo DOL_URL_ROOT.'/core/' ?>','<?php echo $month?>','<?php echo $year-1?>','<?php echo $xyz ?>','<?php echo $langs->defaultlang ?>')"><<</td> |
|
180 | + onClick="loadMonth('<?php echo DOL_URL_ROOT.'/core/' ?>','<?php echo $month?>','<?php echo $year - 1?>','<?php echo $xyz ?>','<?php echo $langs->defaultlang ?>')"><<</td> |
|
181 | 181 | <td class="dpButtons" |
182 | - onClick="loadMonth('<?php echo DOL_URL_ROOT.'/core/' ?>','<?php if($month==1) echo "12"; else echo $month-1?>','<?php if($month==1) echo $year-1; else echo $year?>','<?php echo $xyz ?>','<?php echo $langs->defaultlang ?>')"><</td> |
|
182 | + onClick="loadMonth('<?php echo DOL_URL_ROOT.'/core/' ?>','<?php if ($month == 1) echo "12"; else echo $month - 1?>','<?php if ($month == 1) echo $year - 1; else echo $year?>','<?php echo $xyz ?>','<?php echo $langs->defaultlang ?>')"><</td> |
|
183 | 183 | <td colspan="3" class="dpButtons" |
184 | - onClick="loadMonth('<?php echo DOL_URL_ROOT.'/core/' ?>','<?php echo (int) dol_print_date($today,'%m')?>','<?php echo $todayArray["year"]?>','<?php echo $xyz ?>','<?php echo $langs->defaultlang ?>')"><?php echo '-' ?></td> |
|
184 | + onClick="loadMonth('<?php echo DOL_URL_ROOT.'/core/' ?>','<?php echo (int) dol_print_date($today, '%m')?>','<?php echo $todayArray["year"]?>','<?php echo $xyz ?>','<?php echo $langs->defaultlang ?>')"><?php echo '-' ?></td> |
|
185 | 185 | <td class="dpButtons" |
186 | - onClick="loadMonth('<?php echo DOL_URL_ROOT.'/core/' ?>','<?php if($month==12) echo "1"; else echo $month+1?>','<?php if($month==12) echo $year+1; else echo $year;?>','<?php echo $xyz ?>','<?php echo $langs->defaultlang ?>')">></td> |
|
186 | + onClick="loadMonth('<?php echo DOL_URL_ROOT.'/core/' ?>','<?php if ($month == 12) echo "1"; else echo $month + 1?>','<?php if ($month == 12) echo $year + 1; else echo $year; ?>','<?php echo $xyz ?>','<?php echo $langs->defaultlang ?>')">></td> |
|
187 | 187 | <td class="dpButtons" |
188 | - onClick="loadMonth('<?php echo DOL_URL_ROOT.'/core/' ?>','<?php echo $month?>','<?php echo $year+1?>','<?php echo $xyz ?>','<?php echo $langs->defaultlang ?>')">>></td> |
|
188 | + onClick="loadMonth('<?php echo DOL_URL_ROOT.'/core/' ?>','<?php echo $month?>','<?php echo $year + 1?>','<?php echo $xyz ?>','<?php echo $langs->defaultlang ?>')">>></td> |
|
189 | 189 | </tr> |
190 | 190 | <tr class="dpDayNames"> |
191 | 191 | <?php |
192 | - $startday=isset($conf->global->MAIN_START_WEEK)?$conf->global->MAIN_START_WEEK:1; |
|
192 | + $startday = isset($conf->global->MAIN_START_WEEK) ? $conf->global->MAIN_START_WEEK : 1; |
|
193 | 193 | $day_names = array('ShortSunday', 'ShortMonday', 'ShortTuesday', 'ShortWednesday', 'ShortThursday', 'ShortFriday', 'ShortSaturday'); |
194 | - for( $i=0; $i < 7; $i++ ) |
|
194 | + for ($i = 0; $i < 7; $i++) |
|
195 | 195 | { |
196 | - echo '<td width="', (int) (($i+1)*100/7) - (int) ($i*100/7), '%">', $langs->trans($day_names[($i + $startday) % 7]), '</td>', "\n"; |
|
196 | + echo '<td width="', (int) (($i + 1) * 100 / 7) - (int) ($i * 100 / 7), '%">', $langs->trans($day_names[($i + $startday) % 7]), '</td>', "\n"; |
|
197 | 197 | } |
198 | 198 | ?> |
199 | 199 | </tr> |
200 | 200 | <?php |
201 | 201 | //print "x ".$thedate." y"; // $thedate = first day of month |
202 | - $firstdate=dol_getdate($thedate); |
|
202 | + $firstdate = dol_getdate($thedate); |
|
203 | 203 | //var_dump($firstdateofweek); |
204 | - $mydate=dol_get_first_day_week(1, $month, $year, true); // mydate = cursor date |
|
204 | + $mydate = dol_get_first_day_week(1, $month, $year, true); // mydate = cursor date |
|
205 | 205 | |
206 | 206 | // Loop on each day of month |
207 | - $stoploop=0; $day=1; $cols=0; |
|
208 | - while (! $stoploop) |
|
207 | + $stoploop = 0; $day = 1; $cols = 0; |
|
208 | + while (!$stoploop) |
|
209 | 209 | { |
210 | 210 | //print_r($mydate); |
211 | 211 | if ($mydate < $firstdate) // At first run |
212 | 212 | { |
213 | 213 | echo "<TR class=\"dpWeek\">"; |
214 | 214 | //echo $conf->global->MAIN_START_WEEK.' '.$firstdate["wday"].' '.$startday; |
215 | - $cols=0; |
|
215 | + $cols = 0; |
|
216 | 216 | for ($i = 0; $i < 7; $i++) |
217 | 217 | { |
218 | 218 | $w = ($i + $startday) % 7; |
@@ -230,15 +230,15 @@ discard block |
||
230 | 230 | if ($mydate["wday"] == $startday) |
231 | 231 | { |
232 | 232 | echo "<TR class=\"dpWeek\">"; |
233 | - $cols=0; |
|
233 | + $cols = 0; |
|
234 | 234 | } |
235 | 235 | } |
236 | 236 | |
237 | - $dayclass="dpReg"; |
|
238 | - if($thedate==$selDate) $dayclass="dpSelected"; |
|
239 | - elseif($thedate==$today) $dayclass="dpToday"; |
|
237 | + $dayclass = "dpReg"; |
|
238 | + if ($thedate == $selDate) $dayclass = "dpSelected"; |
|
239 | + elseif ($thedate == $today) $dayclass = "dpToday"; |
|
240 | 240 | |
241 | - if ($langs->trans("FormatDateShortJavaInput")=="FormatDateShortJavaInput") |
|
241 | + if ($langs->trans("FormatDateShortJavaInput") == "FormatDateShortJavaInput") |
|
242 | 242 | { |
243 | 243 | print "ERROR FormatDateShortJavaInput not defined for language ".$langs->defaultlang; |
244 | 244 | exit; |
@@ -246,40 +246,40 @@ discard block |
||
246 | 246 | |
247 | 247 | // Sur click dans calendrier, appelle fonction dpClickDay |
248 | 248 | echo "<TD class=\"".$dayclass."\""; |
249 | - echo " onMouseOver=\"dpHighlightDay(".$mydate["year"].",parseInt('".dol_print_date($thedate,"%m")."',10),".$mydate["mday"].",tradMonths)\""; |
|
250 | - echo " onClick=\"dpClickDay(".$mydate["year"].",parseInt('".dol_print_date($thedate,"%m")."',10),".$mydate["mday"].",'".$langs->trans("FormatDateShortJavaInput")."')\""; |
|
251 | - echo ">".sprintf("%02s",$mydate["mday"])."</TD>"; |
|
249 | + echo " onMouseOver=\"dpHighlightDay(".$mydate["year"].",parseInt('".dol_print_date($thedate, "%m")."',10),".$mydate["mday"].",tradMonths)\""; |
|
250 | + echo " onClick=\"dpClickDay(".$mydate["year"].",parseInt('".dol_print_date($thedate, "%m")."',10),".$mydate["mday"].",'".$langs->trans("FormatDateShortJavaInput")."')\""; |
|
251 | + echo ">".sprintf("%02s", $mydate["mday"])."</TD>"; |
|
252 | 252 | $cols++; |
253 | 253 | |
254 | 254 | if (($mydate["wday"] + 1) % 7 == $startday) echo "</TR>\n"; |
255 | 255 | |
256 | 256 | //$thedate=strtotime("tomorrow",$thedate); |
257 | 257 | $day++; |
258 | - $thedate=dol_mktime(12,0,0,$month,$day,$year); |
|
258 | + $thedate = dol_mktime(12, 0, 0, $month, $day, $year); |
|
259 | 259 | if ($thedate == '') |
260 | 260 | { |
261 | - $stoploop=1; |
|
261 | + $stoploop = 1; |
|
262 | 262 | } |
263 | 263 | else |
264 | 264 | { |
265 | - $mydate=dol_getdate($thedate); |
|
266 | - if ($firstdate["month"] != $mydate["month"]) $stoploop=1; |
|
265 | + $mydate = dol_getdate($thedate); |
|
266 | + if ($firstdate["month"] != $mydate["month"]) $stoploop = 1; |
|
267 | 267 | } |
268 | 268 | } |
269 | 269 | |
270 | 270 | if ($cols < 7) |
271 | 271 | { |
272 | - for($i=6; $i>=$cols; $i--) echo "<TD> </TD>"; |
|
272 | + for ($i = 6; $i >= $cols; $i--) echo "<TD> </TD>"; |
|
273 | 273 | echo "</TR>\n"; |
274 | 274 | } |
275 | 275 | ?> |
276 | 276 | <tr> |
277 | 277 | <td id="dpExp" class="dpExplanation" colspan="7"><?php |
278 | - if($selDate) |
|
278 | + if ($selDate) |
|
279 | 279 | { |
280 | - $tempDate=dol_getdate($selDate); |
|
280 | + $tempDate = dol_getdate($selDate); |
|
281 | 281 | print $langs->trans("Month".$selectMonth)." "; |
282 | - print sprintf("%02s",$tempDate["mday"]); |
|
282 | + print sprintf("%02s", $tempDate["mday"]); |
|
283 | 283 | print ", ".$selectYear; |
284 | 284 | } |
285 | 285 | else |
@@ -26,20 +26,39 @@ discard block |
||
26 | 26 | * \brief File to manage popup date selector |
27 | 27 | */ |
28 | 28 | |
29 | -if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER','1'); // disabled |
|
29 | +if (! defined('NOREQUIREUSER')) { |
|
30 | + define('NOREQUIREUSER','1'); |
|
31 | +} |
|
32 | +// disabled |
|
30 | 33 | //if (! defined('NOREQUIREDB')) define('NOREQUIREDB','1'); // Not disabled cause need to load personalized language |
31 | -if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1'); |
|
34 | +if (! defined('NOREQUIRESOC')) { |
|
35 | + define('NOREQUIRESOC','1'); |
|
36 | +} |
|
32 | 37 | //if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1'); // Not disabled cause need to do translations |
33 | -if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK',1); |
|
34 | -if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL',1); |
|
35 | -if (! defined('NOLOGIN')) define('NOLOGIN',1); // disabled |
|
36 | -if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU',1); |
|
37 | -if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML',1); |
|
38 | +if (! defined('NOCSRFCHECK')) { |
|
39 | + define('NOCSRFCHECK',1); |
|
40 | +} |
|
41 | +if (! defined('NOTOKENRENEWAL')) { |
|
42 | + define('NOTOKENRENEWAL',1); |
|
43 | +} |
|
44 | +if (! defined('NOLOGIN')) { |
|
45 | + define('NOLOGIN',1); |
|
46 | +} |
|
47 | +// disabled |
|
48 | +if (! defined('NOREQUIREMENU')) { |
|
49 | + define('NOREQUIREMENU',1); |
|
50 | +} |
|
51 | +if (! defined('NOREQUIREHTML')) { |
|
52 | + define('NOREQUIREHTML',1); |
|
53 | +} |
|
38 | 54 | |
39 | 55 | require_once '../main.inc.php'; |
40 | 56 | require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; |
41 | 57 | |
42 | -if (GETPOST('lang', 'aZ09')) $langs->setDefaultLang(GETPOST('lang', 'aZ09')); // If language was forced on URL by the main.inc.php |
|
58 | +if (GETPOST('lang', 'aZ09')) { |
|
59 | + $langs->setDefaultLang(GETPOST('lang', 'aZ09')); |
|
60 | +} |
|
61 | +// If language was forced on URL by the main.inc.php |
|
43 | 62 | |
44 | 63 | $langs->load("main"); |
45 | 64 | $langs->load("agenda"); |
@@ -59,8 +78,7 @@ discard block |
||
59 | 78 | if (GETPOST('mode') && GETPOST('mode') == 'test') |
60 | 79 | { |
61 | 80 | print '<script type="text/javascript" src="'.DOL_URL_ROOT.'/core/js/lib_head.js.php"></script>'."\n"; |
62 | -} |
|
63 | -else |
|
81 | +} else |
|
64 | 82 | { |
65 | 83 | print '<title>'.$langs->trans("Calendar").'</title>'; |
66 | 84 | } |
@@ -94,25 +112,38 @@ discard block |
||
94 | 112 | |
95 | 113 | $qualified=true; |
96 | 114 | |
97 | -if (! isset($_GET["sd"])) $_GET["sd"]="00000000"; |
|
115 | +if (! isset($_GET["sd"])) { |
|
116 | + $_GET["sd"]="00000000"; |
|
117 | +} |
|
98 | 118 | |
99 | -if (! isset($_GET["m"])) $qualified=false; |
|
100 | -if (! isset($_GET["y"])) $qualified=false; |
|
119 | +if (! isset($_GET["m"])) { |
|
120 | + $qualified=false; |
|
121 | +} |
|
122 | +if (! isset($_GET["y"])) { |
|
123 | + $qualified=false; |
|
124 | +} |
|
101 | 125 | if (isset($_GET["m"]) && isset($_GET["y"])) |
102 | 126 | { |
103 | - if ($_GET["m"] < 1) $qualified=false; |
|
104 | - if ($_GET["m"] > 12) $qualified=false; |
|
105 | - if ($_GET["y"] < 0) $qualified=false; |
|
106 | - if ($_GET["y"] > 9999) $qualified=false; |
|
107 | -} |
|
127 | + if ($_GET["m"] < 1) { |
|
128 | + $qualified=false; |
|
129 | + } |
|
130 | + if ($_GET["m"] > 12) { |
|
131 | + $qualified=false; |
|
132 | + } |
|
133 | + if ($_GET["y"] < 0) { |
|
134 | + $qualified=false; |
|
135 | + } |
|
136 | + if ($_GET["y"] > 9999) { |
|
137 | + $qualified=false; |
|
138 | + } |
|
139 | + } |
|
108 | 140 | |
109 | 141 | // If parameters provided, we show calendar |
110 | 142 | if ($qualified) |
111 | 143 | { |
112 | 144 | //print $_GET["cm"].",".$_GET["sd"].",".$_GET["m"].",".$_GET["y"];exit; |
113 | 145 | displayBox(GETPOST("sd",'alpha'),GETPOST("m",'int'),GETPOST("y",'int')); |
114 | -} |
|
115 | -else |
|
146 | +} else |
|
116 | 147 | { |
117 | 148 | dol_print_error('','ErrorBadParameters'); |
118 | 149 | } |
@@ -156,8 +187,7 @@ discard block |
||
156 | 187 | { |
157 | 188 | $selDate=xyzToUnixTimestamp($selectedDate); |
158 | 189 | $xyz=dol_print_date($selDate,"%Y%m%d"); |
159 | - } |
|
160 | - else |
|
190 | + } else |
|
161 | 191 | { |
162 | 192 | $selDate=0; |
163 | 193 | $xyz=0; |
@@ -179,11 +209,25 @@ discard block |
||
179 | 209 | <td class="dpButtons" |
180 | 210 | onClick="loadMonth('<?php echo DOL_URL_ROOT.'/core/' ?>','<?php echo $month?>','<?php echo $year-1?>','<?php echo $xyz ?>','<?php echo $langs->defaultlang ?>')"><<</td> |
181 | 211 | <td class="dpButtons" |
182 | - onClick="loadMonth('<?php echo DOL_URL_ROOT.'/core/' ?>','<?php if($month==1) echo "12"; else echo $month-1?>','<?php if($month==1) echo $year-1; else echo $year?>','<?php echo $xyz ?>','<?php echo $langs->defaultlang ?>')"><</td> |
|
212 | + onClick="loadMonth('<?php echo DOL_URL_ROOT.'/core/' ?>','<?php if($month==1) { |
|
213 | + echo "12"; |
|
214 | +} else { |
|
215 | + echo $month-1?>','<?php if($month==1) echo $year-1; |
|
216 | +} |
|
217 | +else { |
|
218 | + echo $year?>','<?php echo $xyz ?>','<?php echo $langs->defaultlang ?>')"><</td> |
|
183 | 219 | <td colspan="3" class="dpButtons" |
184 | 220 | onClick="loadMonth('<?php echo DOL_URL_ROOT.'/core/' ?>','<?php echo (int) dol_print_date($today,'%m')?>','<?php echo $todayArray["year"]?>','<?php echo $xyz ?>','<?php echo $langs->defaultlang ?>')"><?php echo '-' ?></td> |
185 | 221 | <td class="dpButtons" |
186 | - onClick="loadMonth('<?php echo DOL_URL_ROOT.'/core/' ?>','<?php if($month==12) echo "1"; else echo $month+1?>','<?php if($month==12) echo $year+1; else echo $year;?>','<?php echo $xyz ?>','<?php echo $langs->defaultlang ?>')">></td> |
|
222 | + onClick="loadMonth('<?php echo DOL_URL_ROOT.'/core/' ?>','<?php if($month==12) echo "1"; |
|
223 | +} |
|
224 | +else { |
|
225 | + echo $month+1?>','<?php if($month==12) echo $year+1; |
|
226 | +} |
|
227 | +else { |
|
228 | + echo $year; |
|
229 | +} |
|
230 | +?>','<?php echo $xyz ?>','<?php echo $langs->defaultlang ?>')">></td> |
|
187 | 231 | <td class="dpButtons" |
188 | 232 | onClick="loadMonth('<?php echo DOL_URL_ROOT.'/core/' ?>','<?php echo $month?>','<?php echo $year+1?>','<?php echo $xyz ?>','<?php echo $langs->defaultlang ?>')">>></td> |
189 | 233 | </tr> |
@@ -208,9 +252,11 @@ discard block |
||
208 | 252 | while (! $stoploop) |
209 | 253 | { |
210 | 254 | //print_r($mydate); |
211 | - if ($mydate < $firstdate) // At first run |
|
255 | + if ($mydate < $firstdate) { |
|
256 | + // At first run |
|
212 | 257 | { |
213 | 258 | echo "<TR class=\"dpWeek\">"; |
259 | + } |
|
214 | 260 | //echo $conf->global->MAIN_START_WEEK.' '.$firstdate["wday"].' '.$startday; |
215 | 261 | $cols=0; |
216 | 262 | for ($i = 0; $i < 7; $i++) |
@@ -224,8 +270,7 @@ discard block |
||
224 | 270 | echo "<TD> </TD>"; |
225 | 271 | $cols++; |
226 | 272 | } |
227 | - } |
|
228 | - else |
|
273 | + } else |
|
229 | 274 | { |
230 | 275 | if ($mydate["wday"] == $startday) |
231 | 276 | { |
@@ -235,8 +280,11 @@ discard block |
||
235 | 280 | } |
236 | 281 | |
237 | 282 | $dayclass="dpReg"; |
238 | - if($thedate==$selDate) $dayclass="dpSelected"; |
|
239 | - elseif($thedate==$today) $dayclass="dpToday"; |
|
283 | + if($thedate==$selDate) { |
|
284 | + $dayclass="dpSelected"; |
|
285 | + } elseif($thedate==$today) { |
|
286 | + $dayclass="dpToday"; |
|
287 | + } |
|
240 | 288 | |
241 | 289 | if ($langs->trans("FormatDateShortJavaInput")=="FormatDateShortJavaInput") |
242 | 290 | { |
@@ -251,7 +299,9 @@ discard block |
||
251 | 299 | echo ">".sprintf("%02s",$mydate["mday"])."</TD>"; |
252 | 300 | $cols++; |
253 | 301 | |
254 | - if (($mydate["wday"] + 1) % 7 == $startday) echo "</TR>\n"; |
|
302 | + if (($mydate["wday"] + 1) % 7 == $startday) { |
|
303 | + echo "</TR>\n"; |
|
304 | + } |
|
255 | 305 | |
256 | 306 | //$thedate=strtotime("tomorrow",$thedate); |
257 | 307 | $day++; |
@@ -259,17 +309,20 @@ discard block |
||
259 | 309 | if ($thedate == '') |
260 | 310 | { |
261 | 311 | $stoploop=1; |
262 | - } |
|
263 | - else |
|
312 | + } else |
|
264 | 313 | { |
265 | 314 | $mydate=dol_getdate($thedate); |
266 | - if ($firstdate["month"] != $mydate["month"]) $stoploop=1; |
|
315 | + if ($firstdate["month"] != $mydate["month"]) { |
|
316 | + $stoploop=1; |
|
317 | + } |
|
267 | 318 | } |
268 | 319 | } |
269 | 320 | |
270 | 321 | if ($cols < 7) |
271 | 322 | { |
272 | - for($i=6; $i>=$cols; $i--) echo "<TD> </TD>"; |
|
323 | + for($i=6; $i>=$cols; $i--) { |
|
324 | + echo "<TD> </TD>"; |
|
325 | + } |
|
273 | 326 | echo "</TR>\n"; |
274 | 327 | } |
275 | 328 | ?> |
@@ -281,8 +334,7 @@ discard block |
||
281 | 334 | print $langs->trans("Month".$selectMonth)." "; |
282 | 335 | print sprintf("%02s",$tempDate["mday"]); |
283 | 336 | print ", ".$selectYear; |
284 | - } |
|
285 | - else |
|
337 | + } else |
|
286 | 338 | { |
287 | 339 | print "Click a Date"; |
288 | 340 | } |
@@ -126,19 +126,19 @@ |
||
126 | 126 | } |
127 | 127 | if (GETPOST('search_task') != '') |
128 | 128 | { |
129 | - header("Location: ".DOL_URL_ROOT.'/projet/tasks/list.php?mode=search&search_all='.urlencode(GETPOST('search_task'))); |
|
130 | - exit; |
|
129 | + header("Location: ".DOL_URL_ROOT.'/projet/tasks/list.php?mode=search&search_all='.urlencode(GETPOST('search_task'))); |
|
130 | + exit; |
|
131 | 131 | } |
132 | 132 | |
133 | 133 | if (GETPOST('search_user') != '') |
134 | 134 | { |
135 | - header("Location: ".DOL_URL_ROOT.'/user/index.php?mode=search&sall='.urlencode(GETPOST('search_user'))); |
|
136 | - exit; |
|
135 | + header("Location: ".DOL_URL_ROOT.'/user/index.php?mode=search&sall='.urlencode(GETPOST('search_user'))); |
|
136 | + exit; |
|
137 | 137 | } |
138 | 138 | if (GETPOST('search_group') != '') |
139 | 139 | { |
140 | - header("Location: ".DOL_URL_ROOT.'/user/group/index.php?mode=search&sall='.urlencode(GETPOST('search_group'))); |
|
141 | - exit; |
|
140 | + header("Location: ".DOL_URL_ROOT.'/user/group/index.php?mode=search&sall='.urlencode(GETPOST('search_group'))); |
|
141 | + exit; |
|
142 | 142 | } |
143 | 143 | |
144 | 144 |
@@ -23,14 +23,14 @@ discard block |
||
23 | 23 | * \brief Wrapper that receive any search. Depending on input field, make a redirect to correct URL. |
24 | 24 | */ |
25 | 25 | |
26 | -if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER','1'); // Not disabled cause need to load personalized language |
|
27 | -if (! defined('NOREQUIREDB')) define('NOREQUIREDB','1'); // Not disabled cause need to load personalized language |
|
28 | -if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1'); |
|
29 | -if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1'); // Not disabled cause need to do translations |
|
30 | -if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK',1); |
|
31 | -if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL',1); |
|
32 | -if (! defined('NOLOGIN')) define('NOLOGIN',1); // Not disabled cause need to load personalized language |
|
33 | -if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU',1); |
|
26 | +if (!defined('NOREQUIREUSER')) define('NOREQUIREUSER', '1'); // Not disabled cause need to load personalized language |
|
27 | +if (!defined('NOREQUIREDB')) define('NOREQUIREDB', '1'); // Not disabled cause need to load personalized language |
|
28 | +if (!defined('NOREQUIRESOC')) define('NOREQUIRESOC', '1'); |
|
29 | +if (!defined('NOREQUIRETRAN')) define('NOREQUIRETRAN', '1'); // Not disabled cause need to do translations |
|
30 | +if (!defined('NOCSRFCHECK')) define('NOCSRFCHECK', 1); |
|
31 | +if (!defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', 1); |
|
32 | +if (!defined('NOLOGIN')) define('NOLOGIN', 1); // Not disabled cause need to load personalized language |
|
33 | +if (!defined('NOREQUIREMENU')) define('NOREQUIREMENU', 1); |
|
34 | 34 | //if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML',1); |
35 | 35 | |
36 | 36 | require_once '../main.inc.php'; |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | |
145 | 145 | |
146 | 146 | // If we are here, search was called with no supported criteria |
147 | -if (! empty($_SERVER['HTTP_REFERER'])) |
|
147 | +if (!empty($_SERVER['HTTP_REFERER'])) |
|
148 | 148 | { |
149 | 149 | header("Location: ".$_SERVER['HTTP_REFERER']); |
150 | 150 | exit; |
@@ -23,14 +23,34 @@ discard block |
||
23 | 23 | * \brief Wrapper that receive any search. Depending on input field, make a redirect to correct URL. |
24 | 24 | */ |
25 | 25 | |
26 | -if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER','1'); // Not disabled cause need to load personalized language |
|
27 | -if (! defined('NOREQUIREDB')) define('NOREQUIREDB','1'); // Not disabled cause need to load personalized language |
|
28 | -if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1'); |
|
29 | -if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1'); // Not disabled cause need to do translations |
|
30 | -if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK',1); |
|
31 | -if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL',1); |
|
32 | -if (! defined('NOLOGIN')) define('NOLOGIN',1); // Not disabled cause need to load personalized language |
|
33 | -if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU',1); |
|
26 | +if (! defined('NOREQUIREUSER')) { |
|
27 | + define('NOREQUIREUSER','1'); |
|
28 | +} |
|
29 | +// Not disabled cause need to load personalized language |
|
30 | +if (! defined('NOREQUIREDB')) { |
|
31 | + define('NOREQUIREDB','1'); |
|
32 | +} |
|
33 | +// Not disabled cause need to load personalized language |
|
34 | +if (! defined('NOREQUIRESOC')) { |
|
35 | + define('NOREQUIRESOC','1'); |
|
36 | +} |
|
37 | +if (! defined('NOREQUIRETRAN')) { |
|
38 | + define('NOREQUIRETRAN','1'); |
|
39 | +} |
|
40 | +// Not disabled cause need to do translations |
|
41 | +if (! defined('NOCSRFCHECK')) { |
|
42 | + define('NOCSRFCHECK',1); |
|
43 | +} |
|
44 | +if (! defined('NOTOKENRENEWAL')) { |
|
45 | + define('NOTOKENRENEWAL',1); |
|
46 | +} |
|
47 | +if (! defined('NOLOGIN')) { |
|
48 | + define('NOLOGIN',1); |
|
49 | +} |
|
50 | +// Not disabled cause need to load personalized language |
|
51 | +if (! defined('NOREQUIREMENU')) { |
|
52 | + define('NOREQUIREMENU',1); |
|
53 | +} |
|
34 | 54 | //if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML',1); |
35 | 55 | |
36 | 56 | require_once '../main.inc.php'; |
@@ -148,8 +168,7 @@ discard block |
||
148 | 168 | { |
149 | 169 | header("Location: ".$_SERVER['HTTP_REFERER']); |
150 | 170 | exit; |
151 | -} |
|
152 | -else |
|
171 | +} else |
|
153 | 172 | { |
154 | 173 | print 'The wrapper search.php was called without any search criteria'; |
155 | 174 | } |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | $string = ''; |
44 | 44 | for($i = 0; $i < $length; $i++) |
45 | 45 | { |
46 | - $string .= $letters{mt_rand(0, $number - 1)}; |
|
46 | + $string .= $letters{mt_rand(0, $number - 1)}; |
|
47 | 47 | } |
48 | 48 | //print $string; |
49 | 49 | |
@@ -54,8 +54,8 @@ discard block |
||
54 | 54 | $img = imagecreate(80,32); |
55 | 55 | if (empty($img)) |
56 | 56 | { |
57 | - dol_print_error('',"Problem with GD creation"); |
|
58 | - exit; |
|
57 | + dol_print_error('',"Problem with GD creation"); |
|
58 | + exit; |
|
59 | 59 | } |
60 | 60 | |
61 | 61 | // Define mime type |
@@ -21,14 +21,14 @@ discard block |
||
21 | 21 | * \brief Return antispam image |
22 | 22 | */ |
23 | 23 | |
24 | -define('NOLOGIN',1); |
|
24 | +define('NOLOGIN', 1); |
|
25 | 25 | |
26 | -if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER',1); |
|
27 | -if (! defined('NOREQUIREDB')) define('NOREQUIREDB',1); |
|
28 | -if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN',1); |
|
29 | -if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU',1); |
|
30 | -if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC',1); |
|
31 | -if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL',1); |
|
26 | +if (!defined('NOREQUIREUSER')) define('NOREQUIREUSER', 1); |
|
27 | +if (!defined('NOREQUIREDB')) define('NOREQUIREDB', 1); |
|
28 | +if (!defined('NOREQUIRETRAN')) define('NOREQUIRETRAN', 1); |
|
29 | +if (!defined('NOREQUIREMENU')) define('NOREQUIREMENU', 1); |
|
30 | +if (!defined('NOREQUIRESOC')) define('NOREQUIRESOC', 1); |
|
31 | +if (!defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', 1); |
|
32 | 32 | |
33 | 33 | require_once '../main.inc.php'; |
34 | 34 | |
@@ -37,24 +37,24 @@ discard block |
||
37 | 37 | * View |
38 | 38 | */ |
39 | 39 | |
40 | -$length=5; |
|
40 | +$length = 5; |
|
41 | 41 | $letters = 'aAbBCDeEFgGhHJKLmMnNpPqQRsStTuVwWXYZz2345679'; |
42 | 42 | $number = strlen($letters); |
43 | 43 | $string = ''; |
44 | -for($i = 0; $i < $length; $i++) |
|
44 | +for ($i = 0; $i < $length; $i++) |
|
45 | 45 | { |
46 | 46 | $string .= $letters{mt_rand(0, $number - 1)}; |
47 | 47 | } |
48 | 48 | //print $string; |
49 | 49 | |
50 | 50 | |
51 | -$sessionkey='dol_antispam_value'; |
|
52 | -$_SESSION[$sessionkey]=$string; |
|
51 | +$sessionkey = 'dol_antispam_value'; |
|
52 | +$_SESSION[$sessionkey] = $string; |
|
53 | 53 | |
54 | -$img = imagecreate(80,32); |
|
54 | +$img = imagecreate(80, 32); |
|
55 | 55 | if (empty($img)) |
56 | 56 | { |
57 | - dol_print_error('',"Problem with GD creation"); |
|
57 | + dol_print_error('', "Problem with GD creation"); |
|
58 | 58 | exit; |
59 | 59 | } |
60 | 60 |
@@ -23,12 +23,24 @@ |
||
23 | 23 | |
24 | 24 | define('NOLOGIN',1); |
25 | 25 | |
26 | -if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER',1); |
|
27 | -if (! defined('NOREQUIREDB')) define('NOREQUIREDB',1); |
|
28 | -if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN',1); |
|
29 | -if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU',1); |
|
30 | -if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC',1); |
|
31 | -if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL',1); |
|
26 | +if (! defined('NOREQUIREUSER')) { |
|
27 | + define('NOREQUIREUSER',1); |
|
28 | +} |
|
29 | +if (! defined('NOREQUIREDB')) { |
|
30 | + define('NOREQUIREDB',1); |
|
31 | +} |
|
32 | +if (! defined('NOREQUIRETRAN')) { |
|
33 | + define('NOREQUIRETRAN',1); |
|
34 | +} |
|
35 | +if (! defined('NOREQUIREMENU')) { |
|
36 | + define('NOREQUIREMENU',1); |
|
37 | +} |
|
38 | +if (! defined('NOREQUIRESOC')) { |
|
39 | + define('NOREQUIRESOC',1); |
|
40 | +} |
|
41 | +if (! defined('NOTOKENRENEWAL')) { |
|
42 | + define('NOTOKENRENEWAL',1); |
|
43 | +} |
|
32 | 44 | |
33 | 45 | require_once '../main.inc.php'; |
34 | 46 |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | /** |
63 | 63 | * Return description of module |
64 | 64 | * |
65 | - * @return string Description of module |
|
65 | + * @return string Description of module |
|
66 | 66 | */ |
67 | 67 | function getDescription() |
68 | 68 | { |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | /** |
74 | 74 | * Return an example of password generated by this module |
75 | 75 | * |
76 | - * @return string Example of password |
|
76 | + * @return string Example of password |
|
77 | 77 | */ |
78 | 78 | function getExample() |
79 | 79 | { |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | /** |
84 | 84 | * Build new password |
85 | 85 | * |
86 | - * @return string Return a new generated password |
|
86 | + * @return string Return a new generated password |
|
87 | 87 | */ |
88 | 88 | function getNewGeneratedPassword() |
89 | 89 | { |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | * Validate a password |
121 | 121 | * |
122 | 122 | * @param string $password Password to check |
123 | - * @return int 0 if KO, >0 if OK |
|
123 | + * @return int 0 if KO, >0 if OK |
|
124 | 124 | */ |
125 | 125 | function validatePassword($password) |
126 | 126 | { |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | * \brief File to manage password generation according to standard rule |
23 | 23 | */ |
24 | 24 | |
25 | -require_once DOL_DOCUMENT_ROOT .'/core/modules/security/generate/modules_genpassword.php'; |
|
25 | +require_once DOL_DOCUMENT_ROOT.'/core/modules/security/generate/modules_genpassword.php'; |
|
26 | 26 | |
27 | 27 | |
28 | 28 | /** |
@@ -53,10 +53,10 @@ discard block |
||
53 | 53 | $this->id = "standard"; |
54 | 54 | $this->length = 8; |
55 | 55 | |
56 | - $this->db=$db; |
|
57 | - $this->conf=$conf; |
|
58 | - $this->langs=$langs; |
|
59 | - $this->user=$user; |
|
56 | + $this->db = $db; |
|
57 | + $this->conf = $conf; |
|
58 | + $this->langs = $langs; |
|
59 | + $this->user = $user; |
|
60 | 60 | } |
61 | 61 | |
62 | 62 | /** |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | { |
102 | 102 | |
103 | 103 | // pick a random character from the possible ones |
104 | - $char = substr($possible, mt_rand(0, dol_strlen($possible)-1), 1); |
|
104 | + $char = substr($possible, mt_rand(0, dol_strlen($possible) - 1), 1); |
|
105 | 105 | |
106 | 106 | // we don't want this character if it's already in the password |
107 | 107 | if (!strstr($password, $char)) |
@@ -124,7 +124,9 @@ |
||
124 | 124 | */ |
125 | 125 | function validatePassword($password) |
126 | 126 | { |
127 | - if (dol_strlen($password) < $this->length) return 0; |
|
127 | + if (dol_strlen($password) < $this->length) { |
|
128 | + return 0; |
|
129 | + } |
|
128 | 130 | return 1; |
129 | 131 | } |
130 | 132 | } |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | /** |
63 | 63 | * Return description of module |
64 | 64 | * |
65 | - * @return string Description of text |
|
65 | + * @return string Description of text |
|
66 | 66 | */ |
67 | 67 | function getDescription() |
68 | 68 | { |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | /** |
74 | 74 | * Return an example of password generated by this module |
75 | 75 | * |
76 | - * @return string Example of password |
|
76 | + * @return string Example of password |
|
77 | 77 | */ |
78 | 78 | function getExample() |
79 | 79 | { |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | /** |
84 | 84 | * Build new password |
85 | 85 | * |
86 | - * @return string Return a new generated password |
|
86 | + * @return string Return a new generated password |
|
87 | 87 | */ |
88 | 88 | function getNewGeneratedPassword() |
89 | 89 | { |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | * Validate a password |
95 | 95 | * |
96 | 96 | * @param string $password Password to check |
97 | - * @return int 0 if KO, >0 if OK |
|
97 | + * @return int 0 if KO, >0 if OK |
|
98 | 98 | */ |
99 | 99 | function validatePassword($password) |
100 | 100 | { |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | * \brief File to manage no password generation. |
23 | 23 | */ |
24 | 24 | |
25 | -require_once DOL_DOCUMENT_ROOT .'/core/modules/security/generate/modules_genpassword.php'; |
|
25 | +require_once DOL_DOCUMENT_ROOT.'/core/modules/security/generate/modules_genpassword.php'; |
|
26 | 26 | |
27 | 27 | |
28 | 28 | /** |
@@ -53,10 +53,10 @@ discard block |
||
53 | 53 | $this->id = "none"; |
54 | 54 | $this->length = 0; |
55 | 55 | |
56 | - $this->db=$db; |
|
57 | - $this->conf=$conf; |
|
58 | - $this->langs=$langs; |
|
59 | - $this->user=$user; |
|
56 | + $this->db = $db; |
|
57 | + $this->conf = $conf; |
|
58 | + $this->langs = $langs; |
|
59 | + $this->user = $user; |
|
60 | 60 | } |
61 | 61 | |
62 | 62 | /** |
@@ -30,62 +30,62 @@ |
||
30 | 30 | */ |
31 | 31 | abstract class ModeleGenPassword |
32 | 32 | { |
33 | - var $error=''; |
|
33 | + var $error=''; |
|
34 | 34 | |
35 | - /** |
|
36 | - * Return if a module can be used or not |
|
37 | - * |
|
38 | - * @return boolean true if module can be used |
|
39 | - */ |
|
40 | - function isEnabled() |
|
41 | - { |
|
42 | - return true; |
|
43 | - } |
|
35 | + /** |
|
36 | + * Return if a module can be used or not |
|
37 | + * |
|
38 | + * @return boolean true if module can be used |
|
39 | + */ |
|
40 | + function isEnabled() |
|
41 | + { |
|
42 | + return true; |
|
43 | + } |
|
44 | 44 | |
45 | - /** |
|
46 | - * Return description of module |
|
47 | - * |
|
48 | - * @return string Description of text |
|
49 | - */ |
|
50 | - function getDescription() |
|
51 | - { |
|
52 | - global $langs; |
|
53 | - return $langs->trans("NoDescription"); |
|
54 | - } |
|
45 | + /** |
|
46 | + * Return description of module |
|
47 | + * |
|
48 | + * @return string Description of text |
|
49 | + */ |
|
50 | + function getDescription() |
|
51 | + { |
|
52 | + global $langs; |
|
53 | + return $langs->trans("NoDescription"); |
|
54 | + } |
|
55 | 55 | |
56 | - /** |
|
57 | - * Return an example of password generated by this module |
|
58 | - * |
|
59 | - * @return string Example of password |
|
60 | - */ |
|
61 | - function getExample() |
|
62 | - { |
|
63 | - global $langs; |
|
64 | - $langs->load("bills"); |
|
65 | - return $langs->trans("NoExample"); |
|
66 | - } |
|
56 | + /** |
|
57 | + * Return an example of password generated by this module |
|
58 | + * |
|
59 | + * @return string Example of password |
|
60 | + */ |
|
61 | + function getExample() |
|
62 | + { |
|
63 | + global $langs; |
|
64 | + $langs->load("bills"); |
|
65 | + return $langs->trans("NoExample"); |
|
66 | + } |
|
67 | 67 | |
68 | 68 | /** |
69 | 69 | * Build new password |
70 | 70 | * |
71 | - * @return string Return a new generated password |
|
71 | + * @return string Return a new generated password |
|
72 | 72 | */ |
73 | - function getNewGeneratedPassword() |
|
74 | - { |
|
75 | - global $langs; |
|
76 | - return $langs->trans("NotAvailable"); |
|
77 | - } |
|
73 | + function getNewGeneratedPassword() |
|
74 | + { |
|
75 | + global $langs; |
|
76 | + return $langs->trans("NotAvailable"); |
|
77 | + } |
|
78 | 78 | |
79 | 79 | /** |
80 | 80 | * Validate a password |
81 | 81 | * |
82 | 82 | * @param string $password Password to check |
83 | - * @return int 0 if KO, >0 if OK |
|
83 | + * @return int 0 if KO, >0 if OK |
|
84 | 84 | */ |
85 | - function validatePassword($password) |
|
86 | - { |
|
87 | - return 1; |
|
88 | - } |
|
85 | + function validatePassword($password) |
|
86 | + { |
|
87 | + return 1; |
|
88 | + } |
|
89 | 89 | |
90 | 90 | } |
91 | 91 |
@@ -30,7 +30,7 @@ |
||
30 | 30 | */ |
31 | 31 | abstract class ModeleGenPassword |
32 | 32 | { |
33 | - var $error=''; |
|
33 | + var $error = ''; |
|
34 | 34 | |
35 | 35 | /** |
36 | 36 | * Return if a module can be used or not |
@@ -205,7 +205,7 @@ |
||
205 | 205 | if($c != $last){ |
206 | 206 | $last = $c; |
207 | 207 | $count = 0; |
208 | - }else{ |
|
208 | + } else{ |
|
209 | 209 | $count++; |
210 | 210 | } |
211 | 211 |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | * \brief File to manage no password generation. |
25 | 25 | */ |
26 | 26 | |
27 | -require_once DOL_DOCUMENT_ROOT .'/core/modules/security/generate/modules_genpassword.php'; |
|
27 | +require_once DOL_DOCUMENT_ROOT.'/core/modules/security/generate/modules_genpassword.php'; |
|
28 | 28 | |
29 | 29 | |
30 | 30 | /** |
@@ -67,23 +67,23 @@ discard block |
||
67 | 67 | $this->id = "Perso"; |
68 | 68 | $this->length = $langs->trans("SetupPerso"); |
69 | 69 | |
70 | - $this->db=$db; |
|
71 | - $this->conf=$conf; |
|
72 | - $this->langs=$langs; |
|
73 | - $this->user=$user; |
|
70 | + $this->db = $db; |
|
71 | + $this->conf = $conf; |
|
72 | + $this->langs = $langs; |
|
73 | + $this->user = $user; |
|
74 | 74 | |
75 | - if(empty($conf->global->USER_PASSWORD_PATTERN)){ |
|
75 | + if (empty($conf->global->USER_PASSWORD_PATTERN)) { |
|
76 | 76 | // default value (8carac, 1maj, 1digit, 1spe, 3 repeat, no ambi at auto generation. |
77 | - dolibarr_set_const($db, "USER_PASSWORD_PATTERN", '8;1;1;1;3;1','chaine',0,'',$conf->entity); |
|
77 | + dolibarr_set_const($db, "USER_PASSWORD_PATTERN", '8;1;1;1;3;1', 'chaine', 0, '', $conf->entity); |
|
78 | 78 | } |
79 | 79 | |
80 | 80 | $this->Maj = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; |
81 | 81 | $this->Min = strtolower($this->Maj); |
82 | 82 | $this->Nb = "0123456789"; |
83 | 83 | $this->Spe = "!@#$%&*()_-+={}[]\\|:;'/"; |
84 | - $this->Ambi = array("1","I","l","|","O","0"); |
|
84 | + $this->Ambi = array("1", "I", "l", "|", "O", "0"); |
|
85 | 85 | |
86 | - $tabConf = explode(";",$conf->global->USER_PASSWORD_PATTERN); |
|
86 | + $tabConf = explode(";", $conf->global->USER_PASSWORD_PATTERN); |
|
87 | 87 | $this->length2 = $tabConf[0]; |
88 | 88 | $this->NbMaj = $tabConf[1]; |
89 | 89 | $this->NbNum = $tabConf[2]; |
@@ -93,13 +93,13 @@ discard block |
||
93 | 93 | |
94 | 94 | if ($this->WithoutAmbi) |
95 | 95 | { |
96 | - $this->Maj = str_replace($this->Ambi,"",$this->Maj); |
|
97 | - $this->Min = str_replace($this->Ambi,"",$this->Min); |
|
98 | - $this->Nb = str_replace($this->Ambi,"",$this->Nb); |
|
99 | - $this->Spe = str_replace($this->Ambi,"",$this->Spe); |
|
96 | + $this->Maj = str_replace($this->Ambi, "", $this->Maj); |
|
97 | + $this->Min = str_replace($this->Ambi, "", $this->Min); |
|
98 | + $this->Nb = str_replace($this->Ambi, "", $this->Nb); |
|
99 | + $this->Spe = str_replace($this->Ambi, "", $this->Spe); |
|
100 | 100 | } |
101 | 101 | |
102 | - $pattern = $this->Min . (! empty($this->NbMaj)?$this->Maj:'') . (! empty($this->NbNum)?$this->Nb:'') . (! empty($this->NbSpe)?$this->Spe:''); |
|
102 | + $pattern = $this->Min.(!empty($this->NbMaj) ? $this->Maj : '').(!empty($this->NbNum) ? $this->Nb : '').(!empty($this->NbSpe) ? $this->Spe : ''); |
|
103 | 103 | $this->All = str_shuffle($pattern); |
104 | 104 | |
105 | 105 | //$this->All = str_shuffle($this->Maj. $this->Min. $this->Nb. $this->Spe); |
@@ -137,20 +137,20 @@ discard block |
||
137 | 137 | function getNewGeneratedPassword() |
138 | 138 | { |
139 | 139 | $pass = ""; |
140 | - for($i=0; $i<$this->NbMaj; $i++){ // Y |
|
141 | - $pass .= $this->Maj[mt_rand(0,strlen($this->Maj) - 1)]; |
|
140 | + for ($i = 0; $i < $this->NbMaj; $i++) { // Y |
|
141 | + $pass .= $this->Maj[mt_rand(0, strlen($this->Maj) - 1)]; |
|
142 | 142 | } |
143 | 143 | |
144 | - for($i=0; $i<$this->NbNum; $i++){ // X |
|
145 | - $pass .= $this->Nb[mt_rand(0,strlen($this->Nb) - 1)]; |
|
144 | + for ($i = 0; $i < $this->NbNum; $i++) { // X |
|
145 | + $pass .= $this->Nb[mt_rand(0, strlen($this->Nb) - 1)]; |
|
146 | 146 | } |
147 | 147 | |
148 | - for($i=0; $i<$this->NbSpe; $i++){ // @ |
|
149 | - $pass .= $this->Spe[mt_rand(0,strlen($this->Spe) - 1)]; |
|
148 | + for ($i = 0; $i < $this->NbSpe; $i++) { // @ |
|
149 | + $pass .= $this->Spe[mt_rand(0, strlen($this->Spe) - 1)]; |
|
150 | 150 | } |
151 | 151 | |
152 | - for($i=strlen($pass);$i<$this->length2; $i++){ // y |
|
153 | - $pass .= $this->All[mt_rand(0,strlen($this->All) -1)]; |
|
152 | + for ($i = strlen($pass); $i < $this->length2; $i++) { // y |
|
153 | + $pass .= $this->All[mt_rand(0, strlen($this->All) - 1)]; |
|
154 | 154 | } |
155 | 155 | |
156 | 156 | $pass = str_shuffle($pass); |
@@ -176,19 +176,19 @@ discard block |
||
176 | 176 | $num = str_split($this->Nb); |
177 | 177 | $spe = str_split($this->Spe); |
178 | 178 | |
179 | - if(count(array_intersect($password_a, $maj)) < $this->NbMaj){ |
|
179 | + if (count(array_intersect($password_a, $maj)) < $this->NbMaj) { |
|
180 | 180 | return 0; |
181 | 181 | } |
182 | 182 | |
183 | - if(count(array_intersect($password_a, $num)) < $this->NbNum){ |
|
183 | + if (count(array_intersect($password_a, $num)) < $this->NbNum) { |
|
184 | 184 | return 0; |
185 | 185 | } |
186 | 186 | |
187 | - if(count(array_intersect($password_a, $spe)) < $this->NbSpe){ |
|
187 | + if (count(array_intersect($password_a, $spe)) < $this->NbSpe) { |
|
188 | 188 | return 0; |
189 | 189 | } |
190 | 190 | |
191 | - if(!$this->consecutiveInterationSameCharacter($password)){ |
|
191 | + if (!$this->consecutiveInterationSameCharacter($password)) { |
|
192 | 192 | return 0; |
193 | 193 | } |
194 | 194 | |
@@ -201,19 +201,19 @@ discard block |
||
201 | 201 | * @param string $password Password to check |
202 | 202 | * @return int 0 if KO, >0 if OK |
203 | 203 | */ |
204 | - function consecutiveInterationSameCharacter($password){ |
|
204 | + function consecutiveInterationSameCharacter($password) { |
|
205 | 205 | $last = ""; |
206 | 206 | $count = 0; |
207 | 207 | $char = str_split($password); |
208 | - foreach($char as $c){ |
|
209 | - if($c != $last){ |
|
208 | + foreach ($char as $c) { |
|
209 | + if ($c != $last) { |
|
210 | 210 | $last = $c; |
211 | 211 | $count = 0; |
212 | - }else{ |
|
212 | + } else { |
|
213 | 213 | $count++; |
214 | 214 | } |
215 | 215 | |
216 | - if($count >= $this->NbRepeat) { |
|
216 | + if ($count >= $this->NbRepeat) { |
|
217 | 217 | return 0; |
218 | 218 | } |
219 | 219 | } |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | * \brief Fichier de description et activation du module de click to Dial |
25 | 25 | */ |
26 | 26 | |
27 | -include_once DOL_DOCUMENT_ROOT .'/core/modules/DolibarrModules.class.php'; |
|
27 | +include_once DOL_DOCUMENT_ROOT.'/core/modules/DolibarrModules.class.php'; |
|
28 | 28 | |
29 | 29 | |
30 | 30 | /** |
@@ -45,14 +45,14 @@ discard block |
||
45 | 45 | |
46 | 46 | $this->family = "technic"; |
47 | 47 | // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module) |
48 | - $this->name = preg_replace('/^mod/i','',get_class($this)); |
|
48 | + $this->name = preg_replace('/^mod/i', '', get_class($this)); |
|
49 | 49 | $this->description = "Gestion du Click To Dial"; |
50 | 50 | |
51 | - $this->version = 'dolibarr'; // 'development' or 'experimental' or 'dolibarr' or version |
|
51 | + $this->version = 'dolibarr'; // 'development' or 'experimental' or 'dolibarr' or version |
|
52 | 52 | |
53 | 53 | $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); |
54 | 54 | $this->special = 1; |
55 | - $this->picto='phoning'; |
|
55 | + $this->picto = 'phoning'; |
|
56 | 56 | |
57 | 57 | // Data directories to create when module is enabled |
58 | 58 | $this->dirs = array(); |