@@ -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 | } |
@@ -4,8 +4,8 @@ discard block |
||
4 | 4 | */ |
5 | 5 | class Comment extends CommonObject |
6 | 6 | { |
7 | - public $element='comment'; //!< Id that identify managed objects |
|
8 | - public $table_element='comment'; //!< Name of table without prefix where object is stored |
|
7 | + public $element = 'comment'; //!< Id that identify managed objects |
|
8 | + public $table_element = 'comment'; //!< Name of table without prefix where object is stored |
|
9 | 9 | |
10 | 10 | var $fk_element; |
11 | 11 | var $element_type; |
@@ -43,30 +43,30 @@ discard block |
||
43 | 43 | * @param int $notrigger 0=launch triggers after, 1=disable triggers |
44 | 44 | * @return int <0 if KO, Id of created object if OK |
45 | 45 | */ |
46 | - function create($user, $notrigger=0) |
|
46 | + function create($user, $notrigger = 0) |
|
47 | 47 | { |
48 | 48 | global $conf, $langs; |
49 | 49 | |
50 | - $error=0; |
|
50 | + $error = 0; |
|
51 | 51 | |
52 | 52 | // Insert request |
53 | 53 | $sql = "INSERT INTO ".MAIN_DB_PREFIX."comment ("; |
54 | - $sql.= "description"; |
|
55 | - $sql.= ", datec"; |
|
56 | - $sql.= ", fk_element"; |
|
57 | - $sql.= ", element_type"; |
|
58 | - $sql.= ", fk_user_author"; |
|
59 | - $sql.= ", entity"; |
|
60 | - $sql.= ", import_key"; |
|
61 | - $sql.= ") VALUES ("; |
|
62 | - $sql.= "'".$this->db->escape($this->description)."'"; |
|
63 | - $sql.= ", ".($this->datec!=''?"'".$this->db->idate($this->datec)."'":'null'); |
|
64 | - $sql.= ", '".(isset($this->fk_element)?$this->fk_element:"null")."'"; |
|
65 | - $sql.= ", '".$this->db->escape($this->element_type)."'"; |
|
66 | - $sql.= ", '".(isset($this->fk_user_author)?$this->fk_user_author:"null")."'"; |
|
67 | - $sql.= ", ".(!empty($this->entity)?$this->entity:'1'); |
|
68 | - $sql.= ", ".(!empty($this->import_key)?"'".$this->db->escape($this->import_key)."'":"null"); |
|
69 | - $sql.= ")"; |
|
54 | + $sql .= "description"; |
|
55 | + $sql .= ", datec"; |
|
56 | + $sql .= ", fk_element"; |
|
57 | + $sql .= ", element_type"; |
|
58 | + $sql .= ", fk_user_author"; |
|
59 | + $sql .= ", entity"; |
|
60 | + $sql .= ", import_key"; |
|
61 | + $sql .= ") VALUES ("; |
|
62 | + $sql .= "'".$this->db->escape($this->description)."'"; |
|
63 | + $sql .= ", ".($this->datec != '' ? "'".$this->db->idate($this->datec)."'" : 'null'); |
|
64 | + $sql .= ", '".(isset($this->fk_element) ? $this->fk_element : "null")."'"; |
|
65 | + $sql .= ", '".$this->db->escape($this->element_type)."'"; |
|
66 | + $sql .= ", '".(isset($this->fk_user_author) ? $this->fk_user_author : "null")."'"; |
|
67 | + $sql .= ", ".(!empty($this->entity) ? $this->entity : '1'); |
|
68 | + $sql .= ", ".(!empty($this->import_key) ? "'".$this->db->escape($this->import_key)."'" : "null"); |
|
69 | + $sql .= ")"; |
|
70 | 70 | |
71 | 71 | //var_dump($this->db); |
72 | 72 | //echo $sql; |
@@ -74,17 +74,17 @@ discard block |
||
74 | 74 | $this->db->begin(); |
75 | 75 | |
76 | 76 | dol_syslog(get_class($this)."::create", LOG_DEBUG); |
77 | - $resql=$this->db->query($sql); |
|
78 | - if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); } |
|
77 | + $resql = $this->db->query($sql); |
|
78 | + if (!$resql) { $error++; $this->errors[] = "Error ".$this->db->lasterror(); } |
|
79 | 79 | |
80 | - if (! $error) |
|
80 | + if (!$error) |
|
81 | 81 | { |
82 | 82 | $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."projet_task_comment"); |
83 | 83 | |
84 | - if (! $notrigger) |
|
84 | + if (!$notrigger) |
|
85 | 85 | { |
86 | 86 | // Call trigger |
87 | - $result=$this->call_trigger('TASK_COMMENT_CREATE',$user); |
|
87 | + $result = $this->call_trigger('TASK_COMMENT_CREATE', $user); |
|
88 | 88 | if ($result < 0) { $error++; } |
89 | 89 | // End call triggers |
90 | 90 | } |
@@ -93,13 +93,13 @@ discard block |
||
93 | 93 | // Commit or rollback |
94 | 94 | if ($error) |
95 | 95 | { |
96 | - foreach($this->errors as $errmsg) |
|
96 | + foreach ($this->errors as $errmsg) |
|
97 | 97 | { |
98 | 98 | dol_syslog(get_class($this)."::create ".$errmsg, LOG_ERR); |
99 | - $this->error.=($this->error?', '.$errmsg:$errmsg); |
|
99 | + $this->error .= ($this->error ? ', '.$errmsg : $errmsg); |
|
100 | 100 | } |
101 | 101 | $this->db->rollback(); |
102 | - return -1*$error; |
|
102 | + return -1 * $error; |
|
103 | 103 | } |
104 | 104 | else |
105 | 105 | { |
@@ -116,25 +116,25 @@ discard block |
||
116 | 116 | * @param int $ref ref object |
117 | 117 | * @return int <0 if KO, 0 if not found, >0 if OK |
118 | 118 | */ |
119 | - function fetch($id, $ref='') |
|
119 | + function fetch($id, $ref = '') |
|
120 | 120 | { |
121 | 121 | global $langs; |
122 | 122 | |
123 | 123 | $sql = "SELECT"; |
124 | - $sql.= " c.rowid,"; |
|
125 | - $sql.= " c.description,"; |
|
126 | - $sql.= " c.datec,"; |
|
127 | - $sql.= " c.tms,"; |
|
128 | - $sql.= " c.fk_element,"; |
|
129 | - $sql.= " c.element_type,"; |
|
130 | - $sql.= " c.fk_user_author,"; |
|
131 | - $sql.= " c.entity,"; |
|
132 | - $sql.= " c.import_key"; |
|
133 | - $sql.= " FROM ".MAIN_DB_PREFIX."comment as c"; |
|
134 | - $sql.= " WHERE c.rowid = ".$id; |
|
124 | + $sql .= " c.rowid,"; |
|
125 | + $sql .= " c.description,"; |
|
126 | + $sql .= " c.datec,"; |
|
127 | + $sql .= " c.tms,"; |
|
128 | + $sql .= " c.fk_element,"; |
|
129 | + $sql .= " c.element_type,"; |
|
130 | + $sql .= " c.fk_user_author,"; |
|
131 | + $sql .= " c.entity,"; |
|
132 | + $sql .= " c.import_key"; |
|
133 | + $sql .= " FROM ".MAIN_DB_PREFIX."comment as c"; |
|
134 | + $sql .= " WHERE c.rowid = ".$id; |
|
135 | 135 | |
136 | 136 | dol_syslog(get_class($this)."::fetch", LOG_DEBUG); |
137 | - $resql=$this->db->query($sql); |
|
137 | + $resql = $this->db->query($sql); |
|
138 | 138 | if ($resql) |
139 | 139 | { |
140 | 140 | $num_rows = $this->db->num_rows($resql); |
@@ -143,14 +143,14 @@ discard block |
||
143 | 143 | { |
144 | 144 | $obj = $this->db->fetch_object($resql); |
145 | 145 | |
146 | - $this->id = $obj->rowid; |
|
147 | - $this->description = $obj->description; |
|
148 | - $this->element_type = $obj->element_type; |
|
149 | - $this->datec = $this->db->jdate($obj->datec); |
|
150 | - $this->tms = $obj->tms; |
|
151 | - $this->fk_user_author = $obj->fk_user_author; |
|
146 | + $this->id = $obj->rowid; |
|
147 | + $this->description = $obj->description; |
|
148 | + $this->element_type = $obj->element_type; |
|
149 | + $this->datec = $this->db->jdate($obj->datec); |
|
150 | + $this->tms = $obj->tms; |
|
151 | + $this->fk_user_author = $obj->fk_user_author; |
|
152 | 152 | $this->fk_element = $obj->fk_element; |
153 | - $this->entity = $obj->entity; |
|
153 | + $this->entity = $obj->entity; |
|
154 | 154 | $this->import_key = $obj->import_key; |
155 | 155 | } |
156 | 156 | |
@@ -161,7 +161,7 @@ discard block |
||
161 | 161 | } |
162 | 162 | else |
163 | 163 | { |
164 | - $this->error="Error ".$this->db->lasterror(); |
|
164 | + $this->error = "Error ".$this->db->lasterror(); |
|
165 | 165 | return -1; |
166 | 166 | } |
167 | 167 | } |
@@ -174,40 +174,40 @@ discard block |
||
174 | 174 | * @param int $notrigger 0=launch triggers after, 1=disable triggers |
175 | 175 | * @return int <=0 if KO, >0 if OK |
176 | 176 | */ |
177 | - function update(User $user, $notrigger=0) |
|
177 | + function update(User $user, $notrigger = 0) |
|
178 | 178 | { |
179 | 179 | global $conf, $langs; |
180 | - $error=0; |
|
180 | + $error = 0; |
|
181 | 181 | |
182 | 182 | // Clean parameters |
183 | - if (isset($this->fk_element)) $this->fk_project=(int) trim($this->fk_element); |
|
184 | - if (isset($this->fk_user_author)) $this->fk_user_author=(int) trim($this->fk_user_author); |
|
185 | - if (isset($this->description)) $this->description=trim($this->description); |
|
183 | + if (isset($this->fk_element)) $this->fk_project = (int) trim($this->fk_element); |
|
184 | + if (isset($this->fk_user_author)) $this->fk_user_author = (int) trim($this->fk_user_author); |
|
185 | + if (isset($this->description)) $this->description = trim($this->description); |
|
186 | 186 | |
187 | 187 | |
188 | 188 | // Update request |
189 | 189 | $sql = "UPDATE ".MAIN_DB_PREFIX."projet_task_comment SET"; |
190 | - $sql.= " description=".(isset($this->description)?"'".$this->db->escape($this->description)."'":"null").","; |
|
191 | - $sql.= " datec=".($this->datec!=''?"'".$this->db->idate($this->datec)."'":'null').","; |
|
192 | - $sql.= " fk_element=".(isset($this->fk_element)?$this->fk_element:"null").","; |
|
193 | - $sql.= " element_type='".$this->db->escape($this->element_type)."',"; |
|
194 | - $sql.= " fk_user_author=".(isset($this->fk_user_author)?$this->fk_user_author:"null").","; |
|
195 | - $sql.= " entity=".(!empty($this->entity)?$this->entity:'1').","; |
|
196 | - $sql.= " import_key=".(!empty($this->import_key)?"'".$this->db->escape($this->import_key)."'":"null"); |
|
197 | - $sql.= " WHERE rowid=".$this->id; |
|
190 | + $sql .= " description=".(isset($this->description) ? "'".$this->db->escape($this->description)."'" : "null").","; |
|
191 | + $sql .= " datec=".($this->datec != '' ? "'".$this->db->idate($this->datec)."'" : 'null').","; |
|
192 | + $sql .= " fk_element=".(isset($this->fk_element) ? $this->fk_element : "null").","; |
|
193 | + $sql .= " element_type='".$this->db->escape($this->element_type)."',"; |
|
194 | + $sql .= " fk_user_author=".(isset($this->fk_user_author) ? $this->fk_user_author : "null").","; |
|
195 | + $sql .= " entity=".(!empty($this->entity) ? $this->entity : '1').","; |
|
196 | + $sql .= " import_key=".(!empty($this->import_key) ? "'".$this->db->escape($this->import_key)."'" : "null"); |
|
197 | + $sql .= " WHERE rowid=".$this->id; |
|
198 | 198 | |
199 | 199 | $this->db->begin(); |
200 | 200 | |
201 | 201 | dol_syslog(get_class($this)."::update", LOG_DEBUG); |
202 | 202 | $resql = $this->db->query($sql); |
203 | - if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); } |
|
203 | + if (!$resql) { $error++; $this->errors[] = "Error ".$this->db->lasterror(); } |
|
204 | 204 | |
205 | - if (! $error) |
|
205 | + if (!$error) |
|
206 | 206 | { |
207 | - if (! $notrigger) |
|
207 | + if (!$notrigger) |
|
208 | 208 | { |
209 | 209 | // Call trigger |
210 | - $result=$this->call_trigger('TASK_COMMENT_MODIFY',$user); |
|
210 | + $result = $this->call_trigger('TASK_COMMENT_MODIFY', $user); |
|
211 | 211 | if ($result < 0) { $error++; } |
212 | 212 | // End call triggers |
213 | 213 | } |
@@ -216,13 +216,13 @@ discard block |
||
216 | 216 | // Commit or rollback |
217 | 217 | if ($error) |
218 | 218 | { |
219 | - foreach($this->errors as $errmsg) |
|
219 | + foreach ($this->errors as $errmsg) |
|
220 | 220 | { |
221 | 221 | dol_syslog(get_class($this)."::update ".$errmsg, LOG_ERR); |
222 | - $this->error.=($this->error?', '.$errmsg:$errmsg); |
|
222 | + $this->error .= ($this->error ? ', '.$errmsg : $errmsg); |
|
223 | 223 | } |
224 | 224 | $this->db->rollback(); |
225 | - return -1*$error; |
|
225 | + return -1 * $error; |
|
226 | 226 | } |
227 | 227 | else |
228 | 228 | { |
@@ -239,27 +239,27 @@ discard block |
||
239 | 239 | * @param int $notrigger 0=launch triggers after, 1=disable triggers |
240 | 240 | * @return int <0 if KO, >0 if OK |
241 | 241 | */ |
242 | - function delete($user, $notrigger=0) |
|
242 | + function delete($user, $notrigger = 0) |
|
243 | 243 | { |
244 | 244 | global $conf, $langs; |
245 | - require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php'; |
|
245 | + require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; |
|
246 | 246 | |
247 | - $error=0; |
|
247 | + $error = 0; |
|
248 | 248 | |
249 | 249 | $this->db->begin(); |
250 | 250 | |
251 | 251 | $sql = "DELETE FROM ".MAIN_DB_PREFIX."comment"; |
252 | - $sql.= " WHERE rowid=".$this->id; |
|
252 | + $sql .= " WHERE rowid=".$this->id; |
|
253 | 253 | |
254 | 254 | $resql = $this->db->query($sql); |
255 | - if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); } |
|
255 | + if (!$resql) { $error++; $this->errors[] = "Error ".$this->db->lasterror(); } |
|
256 | 256 | |
257 | - if (! $error) |
|
257 | + if (!$error) |
|
258 | 258 | { |
259 | - if (! $notrigger) |
|
259 | + if (!$notrigger) |
|
260 | 260 | { |
261 | 261 | // Call trigger |
262 | - $result=$this->call_trigger('TASK_COMMENT_DELETE',$user); |
|
262 | + $result = $this->call_trigger('TASK_COMMENT_DELETE', $user); |
|
263 | 263 | if ($result < 0) { $error++; } |
264 | 264 | // End call triggers |
265 | 265 | } |
@@ -268,14 +268,14 @@ discard block |
||
268 | 268 | // Commit or rollback |
269 | 269 | if ($error) |
270 | 270 | { |
271 | - foreach($this->errors as $errmsg) |
|
271 | + foreach ($this->errors as $errmsg) |
|
272 | 272 | { |
273 | 273 | dol_syslog(get_class($this)."::delete ".$errmsg, LOG_ERR); |
274 | - $this->error.=($this->error?', '.$errmsg:$errmsg); |
|
274 | + $this->error .= ($this->error ? ', '.$errmsg : $errmsg); |
|
275 | 275 | } |
276 | 276 | $this->db->rollback(); |
277 | - return -1*$error; |
|
278 | - }else{ |
|
277 | + return -1 * $error; |
|
278 | + } else { |
|
279 | 279 | $this->db->commit(); |
280 | 280 | return 1; |
281 | 281 | } |
@@ -291,25 +291,25 @@ discard block |
||
291 | 291 | */ |
292 | 292 | public static function fetchAllFor($element_type, $fk_element) |
293 | 293 | { |
294 | - global $db,$conf; |
|
294 | + global $db, $conf; |
|
295 | 295 | $TComments = array(); |
296 | - if(!empty($element_type) && !empty($fk_element)) { |
|
296 | + if (!empty($element_type) && !empty($fk_element)) { |
|
297 | 297 | $sql = "SELECT"; |
298 | - $sql.= " c.rowid"; |
|
299 | - $sql.= " FROM ".MAIN_DB_PREFIX."comment as c"; |
|
300 | - $sql.= " WHERE c.fk_element = ".$fk_element; |
|
301 | - $sql.= " AND c.element_type = '".$element_type."'"; |
|
302 | - $sql.= " AND c.entity = ".$conf->entity; |
|
303 | - $sql.= " ORDER BY c.tms DESC"; |
|
298 | + $sql .= " c.rowid"; |
|
299 | + $sql .= " FROM ".MAIN_DB_PREFIX."comment as c"; |
|
300 | + $sql .= " WHERE c.fk_element = ".$fk_element; |
|
301 | + $sql .= " AND c.element_type = '".$element_type."'"; |
|
302 | + $sql .= " AND c.entity = ".$conf->entity; |
|
303 | + $sql .= " ORDER BY c.tms DESC"; |
|
304 | 304 | |
305 | 305 | dol_syslog("Comment::fetchAllFor", LOG_DEBUG); |
306 | - $resql=$db->query($sql); |
|
306 | + $resql = $db->query($sql); |
|
307 | 307 | if ($resql) |
308 | 308 | { |
309 | 309 | $num_rows = $db->num_rows($resql); |
310 | 310 | if ($num_rows > 0) |
311 | 311 | { |
312 | - while($obj = $db->fetch_object($resql)) |
|
312 | + while ($obj = $db->fetch_object($resql)) |
|
313 | 313 | { |
314 | 314 | $comment = new self($db); |
315 | 315 | $comment->fetch($obj->rowid); |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | * \brief Home page for module builder module |
24 | 24 | */ |
25 | 25 | |
26 | -if (! defined('NOSCANPOSTFORINJECTION')) define('NOSCANPOSTFORINJECTION','1'); // Do not check anti SQL+XSS injection attack test |
|
26 | +if (!defined('NOSCANPOSTFORINJECTION')) define('NOSCANPOSTFORINJECTION', '1'); // Do not check anti SQL+XSS injection attack test |
|
27 | 27 | |
28 | 28 | require '../main.inc.php'; |
29 | 29 | require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; |
@@ -34,49 +34,49 @@ discard block |
||
34 | 34 | |
35 | 35 | $langs->loadLangs(array("admin", "modulebuilder", "other", "cron")); |
36 | 36 | |
37 | -$action=GETPOST('action','aZ09'); |
|
38 | -$confirm=GETPOST('confirm','alpha'); |
|
39 | -$cancel=GETPOST('cancel','alpha'); |
|
37 | +$action = GETPOST('action', 'aZ09'); |
|
38 | +$confirm = GETPOST('confirm', 'alpha'); |
|
39 | +$cancel = GETPOST('cancel', 'alpha'); |
|
40 | 40 | |
41 | -$module=GETPOST('module','alpha'); |
|
42 | -$tab=GETPOST('tab','aZ09'); |
|
43 | -$tabobj=GETPOST('tabobj','alpha'); |
|
44 | -$propertykey=GETPOST('propertykey','alpha'); |
|
45 | -if (empty($module)) $module='initmodule'; |
|
46 | -if (empty($tab)) $tab='description'; |
|
47 | -if (empty($tabobj)) $tabobj='newobjectifnoobj'; |
|
48 | -$file=GETPOST('file','alpha'); |
|
41 | +$module = GETPOST('module', 'alpha'); |
|
42 | +$tab = GETPOST('tab', 'aZ09'); |
|
43 | +$tabobj = GETPOST('tabobj', 'alpha'); |
|
44 | +$propertykey = GETPOST('propertykey', 'alpha'); |
|
45 | +if (empty($module)) $module = 'initmodule'; |
|
46 | +if (empty($tab)) $tab = 'description'; |
|
47 | +if (empty($tabobj)) $tabobj = 'newobjectifnoobj'; |
|
48 | +$file = GETPOST('file', 'alpha'); |
|
49 | 49 | |
50 | -$modulename=dol_sanitizeFileName(GETPOST('modulename','alpha')); |
|
51 | -$objectname=dol_sanitizeFileName(GETPOST('objectname','alpha')); |
|
50 | +$modulename = dol_sanitizeFileName(GETPOST('modulename', 'alpha')); |
|
51 | +$objectname = dol_sanitizeFileName(GETPOST('objectname', 'alpha')); |
|
52 | 52 | |
53 | 53 | // Security check |
54 | 54 | if (empty($conf->modulebuilder->enabled)) accessforbidden('ModuleBuilderNotAllowed'); |
55 | -if (! $user->admin && empty($conf->global->MODULEBUILDER_FOREVERYONE)) accessforbidden('ModuleBuilderNotAllowed'); |
|
55 | +if (!$user->admin && empty($conf->global->MODULEBUILDER_FOREVERYONE)) accessforbidden('ModuleBuilderNotAllowed'); |
|
56 | 56 | |
57 | 57 | |
58 | 58 | // Dir for custom dirs |
59 | -$tmp=explode(',', $dolibarr_main_document_root_alt); |
|
59 | +$tmp = explode(',', $dolibarr_main_document_root_alt); |
|
60 | 60 | $dirins = $tmp[0]; |
61 | 61 | $dirread = $dirins; |
62 | 62 | $forceddirread = 0; |
63 | 63 | |
64 | 64 | $tmpdir = explode('@', $module); |
65 | -if (! empty($tmpdir[1])) |
|
65 | +if (!empty($tmpdir[1])) |
|
66 | 66 | { |
67 | - $module=$tmpdir[0]; |
|
68 | - $dirread=$tmpdir[1]; |
|
69 | - $forceddirread=1; |
|
67 | + $module = $tmpdir[0]; |
|
68 | + $dirread = $tmpdir[1]; |
|
69 | + $forceddirread = 1; |
|
70 | 70 | } |
71 | 71 | |
72 | -$FILEFLAG='modulebuilder.txt'; |
|
72 | +$FILEFLAG = 'modulebuilder.txt'; |
|
73 | 73 | |
74 | -$now=dol_now(); |
|
74 | +$now = dol_now(); |
|
75 | 75 | $newmask = 0; |
76 | -if (empty($newmask) && ! empty($conf->global->MAIN_UMASK)) $newmask=$conf->global->MAIN_UMASK; |
|
76 | +if (empty($newmask) && !empty($conf->global->MAIN_UMASK)) $newmask = $conf->global->MAIN_UMASK; |
|
77 | 77 | if (empty($newmask)) // This should no happen |
78 | 78 | { |
79 | - $newmask='0664'; |
|
79 | + $newmask = '0664'; |
|
80 | 80 | } |
81 | 81 | |
82 | 82 | |
@@ -92,12 +92,12 @@ discard block |
||
92 | 92 | setEventMessages($langs->trans("SpaceOrSpecialCharAreNotAllowed"), null, 'errors'); |
93 | 93 | } |
94 | 94 | |
95 | - if (! $error) |
|
95 | + if (!$error) |
|
96 | 96 | { |
97 | 97 | $srcdir = DOL_DOCUMENT_ROOT.'/modulebuilder/template'; |
98 | 98 | $destdir = $dirins.'/'.strtolower($modulename); |
99 | 99 | |
100 | - $arrayreplacement=array( |
|
100 | + $arrayreplacement = array( |
|
101 | 101 | 'mymodule'=>strtolower($modulename), |
102 | 102 | 'MyModule'=>$modulename |
103 | 103 | ); |
@@ -136,13 +136,13 @@ discard block |
||
136 | 136 | } |
137 | 137 | |
138 | 138 | // Edit PHP files |
139 | - if (! $error) |
|
139 | + if (!$error) |
|
140 | 140 | { |
141 | 141 | $listofphpfilestoedit = dol_dir_list($destdir, 'files', 1, '\.(php|MD|js|sql|txt|xml|lang)$', '', 'fullname', SORT_ASC, 0, 1); |
142 | - foreach($listofphpfilestoedit as $phpfileval) |
|
142 | + foreach ($listofphpfilestoedit as $phpfileval) |
|
143 | 143 | { |
144 | 144 | //var_dump($phpfileval['fullname']); |
145 | - $arrayreplacement=array( |
|
145 | + $arrayreplacement = array( |
|
146 | 146 | 'mymodule'=>strtolower($modulename), |
147 | 147 | 'MyModule'=>$modulename, |
148 | 148 | 'MYMODULE'=>strtoupper($modulename), |
@@ -151,11 +151,11 @@ discard block |
||
151 | 151 | 'Mon module'=>$modulename, |
152 | 152 | 'mon module'=>$modulename, |
153 | 153 | 'htdocs/modulebuilder/template'=>strtolower($modulename), |
154 | - '---Put here your own copyright and developer email---'=>dol_print_date($now,'%Y').' '.$user->getFullName($langs).($user->email?' <'.$user->email.'>':'') |
|
154 | + '---Put here your own copyright and developer email---'=>dol_print_date($now, '%Y').' '.$user->getFullName($langs).($user->email ? ' <'.$user->email.'>' : '') |
|
155 | 155 | ); |
156 | 156 | |
157 | 157 | |
158 | - $result=dolReplaceInFile($phpfileval['fullname'], $arrayreplacement); |
|
158 | + $result = dolReplaceInFile($phpfileval['fullname'], $arrayreplacement); |
|
159 | 159 | //var_dump($result); |
160 | 160 | if ($result < 0) |
161 | 161 | { |
@@ -164,10 +164,10 @@ discard block |
||
164 | 164 | } |
165 | 165 | } |
166 | 166 | |
167 | - if (! $error) |
|
167 | + if (!$error) |
|
168 | 168 | { |
169 | 169 | setEventMessages('ModuleInitialized', null); |
170 | - $module=$modulename; |
|
170 | + $module = $modulename; |
|
171 | 171 | $modulename = ''; |
172 | 172 | } |
173 | 173 | } |
@@ -184,16 +184,16 @@ discard block |
||
184 | 184 | $destdir = $dirins.'/'.strtolower($module); |
185 | 185 | |
186 | 186 | // Scan dir class to find if an object with same name already exists. |
187 | - if (! $error) |
|
187 | + if (!$error) |
|
188 | 188 | { |
189 | - $dirlist=dol_dir_list($destdir.'/class','files',0,'\.txt$'); |
|
190 | - $alreadyfound=false; |
|
191 | - foreach($dirlist as $key => $val) |
|
189 | + $dirlist = dol_dir_list($destdir.'/class', 'files', 0, '\.txt$'); |
|
190 | + $alreadyfound = false; |
|
191 | + foreach ($dirlist as $key => $val) |
|
192 | 192 | { |
193 | - $filefound=preg_replace('/\.txt$/','',$val['name']); |
|
193 | + $filefound = preg_replace('/\.txt$/', '', $val['name']); |
|
194 | 194 | if (strtolower($objectname) == strtolower($filefound) && $objectname != $filefound) |
195 | 195 | { |
196 | - $alreadyfound=true; |
|
196 | + $alreadyfound = true; |
|
197 | 197 | $error++; |
198 | 198 | setEventMessages($langs->trans("AnObjectAlreadyExistWithThisNameAndDiffCase"), null, 'errors'); |
199 | 199 | break; |
@@ -201,7 +201,7 @@ discard block |
||
201 | 201 | } |
202 | 202 | } |
203 | 203 | |
204 | - if (! $error) |
|
204 | + if (!$error) |
|
205 | 205 | { |
206 | 206 | // Delete some files |
207 | 207 | $filetogenerate = array( |
@@ -221,7 +221,7 @@ discard block |
||
221 | 221 | 'class/api_myobject.class.php'=>'class/api_'.strtolower($objectname).'.class.php' |
222 | 222 | ); |
223 | 223 | |
224 | - foreach($filetogenerate as $srcfile => $destfile) |
|
224 | + foreach ($filetogenerate as $srcfile => $destfile) |
|
225 | 225 | { |
226 | 226 | $result = dol_copy($srcdir.'/'.$srcfile, $destdir.'/'.$destfile, $newmask, 0); |
227 | 227 | if ($result <= 0) |
@@ -239,26 +239,26 @@ discard block |
||
239 | 239 | } |
240 | 240 | } |
241 | 241 | |
242 | - if (! $error) |
|
242 | + if (!$error) |
|
243 | 243 | { |
244 | 244 | // Scan for object class files |
245 | 245 | $listofobject = dol_dir_list($destdir.'/class', 'files', 0, '\.class\.php$'); |
246 | 246 | |
247 | - $firstobjectname=''; |
|
248 | - foreach($listofobject as $fileobj) |
|
247 | + $firstobjectname = ''; |
|
248 | + foreach ($listofobject as $fileobj) |
|
249 | 249 | { |
250 | - if (preg_match('/^api_/',$fileobj['name'])) continue; |
|
251 | - if (preg_match('/^actions_/',$fileobj['name'])) continue; |
|
250 | + if (preg_match('/^api_/', $fileobj['name'])) continue; |
|
251 | + if (preg_match('/^actions_/', $fileobj['name'])) continue; |
|
252 | 252 | |
253 | - $tmpcontent=file_get_contents($fileobj['fullname']); |
|
254 | - if (preg_match('/class\s+([^\s]*)\s+extends\s+CommonObject/ims',$tmpcontent,$reg)) |
|
253 | + $tmpcontent = file_get_contents($fileobj['fullname']); |
|
254 | + if (preg_match('/class\s+([^\s]*)\s+extends\s+CommonObject/ims', $tmpcontent, $reg)) |
|
255 | 255 | { |
256 | 256 | $objectnameloop = $reg[1]; |
257 | 257 | if (empty($firstobjectname)) $firstobjectname = $objectnameloop; |
258 | 258 | } |
259 | 259 | |
260 | 260 | // Regenerate left menu entry in descriptor for $objectname |
261 | - $stringtoadd=" |
|
261 | + $stringtoadd = " |
|
262 | 262 | \t\t\$this->menu[\$r++]=array( |
263 | 263 | 'fk_menu'=>'fk_mainmenu=mymodule', // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode |
264 | 264 | 'type'=>'left', // This is a Left menu entry |
@@ -290,7 +290,7 @@ discard block |
||
290 | 290 | $stringtoadd = preg_replace('/mymodule/', strtolower($module), $stringtoadd); |
291 | 291 | $stringtoadd = preg_replace('/myobject/', strtolower($objectnameloop), $stringtoadd); |
292 | 292 | |
293 | - $moduledescriptorfile=$destdir.'/core/modules/mod'.$module.'.class.php'; |
|
293 | + $moduledescriptorfile = $destdir.'/core/modules/mod'.$module.'.class.php'; |
|
294 | 294 | |
295 | 295 | // TODO Allow a replace with regex using dolReplaceRegexInFile |
296 | 296 | // TODO Avoid duplicate addition |
@@ -298,22 +298,22 @@ discard block |
||
298 | 298 | dolReplaceInFile($moduledescriptorfile, array('END MODULEBUILDER LEFTMENU MYOBJECT */' => '*/'."\n".$stringtoadd."\n\t\t/* END MODULEBUILDER LEFTMENU MYOBJECT */")); |
299 | 299 | |
300 | 300 | // Add module descriptor to list of files to replace "MyObject' string with real name of object. |
301 | - $filetogenerate[]='core/modules/mod'.$module.'.class.php'; |
|
301 | + $filetogenerate[] = 'core/modules/mod'.$module.'.class.php'; |
|
302 | 302 | |
303 | 303 | // TODO |
304 | 304 | } |
305 | 305 | } |
306 | 306 | } |
307 | 307 | |
308 | - if (! $error) |
|
308 | + if (!$error) |
|
309 | 309 | { |
310 | 310 | // Edit PHP files |
311 | - foreach($filetogenerate as $destfile) |
|
311 | + foreach ($filetogenerate as $destfile) |
|
312 | 312 | { |
313 | 313 | $phpfileval['fullname'] = $destdir.'/'.$destfile; |
314 | 314 | |
315 | 315 | //var_dump($phpfileval['fullname']); |
316 | - $arrayreplacement=array( |
|
316 | + $arrayreplacement = array( |
|
317 | 317 | 'mymodule'=>strtolower($module), |
318 | 318 | 'MyModule'=>$module, |
319 | 319 | 'MYMODULE'=>strtoupper($module), |
@@ -326,7 +326,7 @@ discard block |
||
326 | 326 | 'MyObject'=>$objectname |
327 | 327 | ); |
328 | 328 | |
329 | - $result=dolReplaceInFile($phpfileval['fullname'], $arrayreplacement); |
|
329 | + $result = dolReplaceInFile($phpfileval['fullname'], $arrayreplacement); |
|
330 | 330 | //var_dump($result); |
331 | 331 | if ($result < 0) |
332 | 332 | { |
@@ -335,26 +335,26 @@ discard block |
||
335 | 335 | } |
336 | 336 | } |
337 | 337 | |
338 | - if (! $error) |
|
338 | + if (!$error) |
|
339 | 339 | { |
340 | 340 | // Edit the class file to write properties |
341 | - $object=rebuildObjectClass($destdir, $module, $objectname, $newmask); |
|
341 | + $object = rebuildObjectClass($destdir, $module, $objectname, $newmask); |
|
342 | 342 | if (is_numeric($object) && $object < 0) $error++; |
343 | 343 | } |
344 | - if (! $error) |
|
344 | + if (!$error) |
|
345 | 345 | { |
346 | 346 | // Edit sql with new properties |
347 | - $result=rebuildObjectSql($destdir, $module, $objectname, $newmask, '', $object); |
|
347 | + $result = rebuildObjectSql($destdir, $module, $objectname, $newmask, '', $object); |
|
348 | 348 | if ($result < 0) $error++; |
349 | 349 | } |
350 | 350 | |
351 | - if (! $error) |
|
351 | + if (!$error) |
|
352 | 352 | { |
353 | 353 | setEventMessages($langs->trans('FilesForObjectInitialized', $objectname), null); |
354 | 354 | } |
355 | 355 | } |
356 | 356 | |
357 | -if ($dirins && $action == 'addproperty' && !empty($module) && ! empty($tabobj)) |
|
357 | +if ($dirins && $action == 'addproperty' && !empty($module) && !empty($tabobj)) |
|
358 | 358 | { |
359 | 359 | $objectname = $tabobj; |
360 | 360 | |
@@ -363,35 +363,35 @@ discard block |
||
363 | 363 | dol_mkdir($destdir); |
364 | 364 | |
365 | 365 | $addfieldentry = array( |
366 | - 'name'=>GETPOST('propname','aZ09'),'label'=>GETPOST('proplabel','alpha'),'type'=>GETPOST('proptype','alpha'), |
|
367 | - 'arrayofkeyval'=>GETPOST('proparrayofkeyval','none'), // Example json string '{"0":"Draft","1":"Active","-1":"Cancel"}' |
|
368 | - 'visible'=>GETPOST('propvisible','int'),'enabled'=>GETPOST('propenabled','int'), |
|
369 | - 'position'=>GETPOST('propposition','int'),'notnull'=>GETPOST('propnotnull','int'),'index'=>GETPOST('propindex','int'),'searchall'=>GETPOST('propsearchall','int'), |
|
370 | - 'isameasure'=>GETPOST('propisameasure','int'), 'comment'=>GETPOST('propcomment','alpha'),'help'=>GETPOST('prophelp')); |
|
366 | + 'name'=>GETPOST('propname', 'aZ09'), 'label'=>GETPOST('proplabel', 'alpha'), 'type'=>GETPOST('proptype', 'alpha'), |
|
367 | + 'arrayofkeyval'=>GETPOST('proparrayofkeyval', 'none'), // Example json string '{"0":"Draft","1":"Active","-1":"Cancel"}' |
|
368 | + 'visible'=>GETPOST('propvisible', 'int'), 'enabled'=>GETPOST('propenabled', 'int'), |
|
369 | + 'position'=>GETPOST('propposition', 'int'), 'notnull'=>GETPOST('propnotnull', 'int'), 'index'=>GETPOST('propindex', 'int'), 'searchall'=>GETPOST('propsearchall', 'int'), |
|
370 | + 'isameasure'=>GETPOST('propisameasure', 'int'), 'comment'=>GETPOST('propcomment', 'alpha'), 'help'=>GETPOST('prophelp')); |
|
371 | 371 | |
372 | - if (! empty($addfieldentry['arrayofkeyval']) && ! is_array($addfieldentry['arrayofkeyval'])) |
|
372 | + if (!empty($addfieldentry['arrayofkeyval']) && !is_array($addfieldentry['arrayofkeyval'])) |
|
373 | 373 | { |
374 | 374 | $addfieldentry['arrayofkeyval'] = dol_json_decode($addfieldentry['arrayofkeyval'], true); |
375 | 375 | } |
376 | 376 | |
377 | 377 | // Edit the class file to write properties |
378 | - if (! $error) |
|
378 | + if (!$error) |
|
379 | 379 | { |
380 | - $object=rebuildObjectClass($destdir, $module, $objectname, $newmask, $srcdir, $addfieldentry); |
|
380 | + $object = rebuildObjectClass($destdir, $module, $objectname, $newmask, $srcdir, $addfieldentry); |
|
381 | 381 | if (is_numeric($result) && $result <= 0) $error++; |
382 | 382 | } |
383 | 383 | |
384 | 384 | // Edit sql with new properties |
385 | - if (! $error) |
|
385 | + if (!$error) |
|
386 | 386 | { |
387 | - $result=rebuildObjectSql($destdir, $module, $objectname, $newmask, $srcdir, $object); |
|
387 | + $result = rebuildObjectSql($destdir, $module, $objectname, $newmask, $srcdir, $object); |
|
388 | 388 | if ($result <= 0) |
389 | 389 | { |
390 | 390 | $error++; |
391 | 391 | } |
392 | 392 | } |
393 | 393 | |
394 | - if (! $error) |
|
394 | + if (!$error) |
|
395 | 395 | { |
396 | 396 | clearstatcache(); |
397 | 397 | |
@@ -414,20 +414,20 @@ discard block |
||
414 | 414 | dol_mkdir($destdir); |
415 | 415 | |
416 | 416 | // Edit the class file to write properties |
417 | - if (! $error) |
|
417 | + if (!$error) |
|
418 | 418 | { |
419 | - $object=rebuildObjectClass($destdir, $module, $objectname, $newmask, $srcdir, array(), $propertykey); |
|
419 | + $object = rebuildObjectClass($destdir, $module, $objectname, $newmask, $srcdir, array(), $propertykey); |
|
420 | 420 | if (is_numeric($object) && $object <= 0) $error++; |
421 | 421 | } |
422 | 422 | |
423 | 423 | // Edit sql with new properties |
424 | - if (! $error) |
|
424 | + if (!$error) |
|
425 | 425 | { |
426 | - $result=rebuildObjectSql($destdir, $module, $objectname, $newmask, $srcdir, $object); |
|
426 | + $result = rebuildObjectSql($destdir, $module, $objectname, $newmask, $srcdir, $object); |
|
427 | 427 | if ($result <= 0) $error++; |
428 | 428 | } |
429 | 429 | |
430 | - if (! $error) |
|
430 | + if (!$error) |
|
431 | 431 | { |
432 | 432 | clearstatcache(); |
433 | 433 | |
@@ -449,9 +449,9 @@ discard block |
||
449 | 449 | setEventMessages($langs->trans("SpaceOrSpecialCharAreNotAllowed"), null, 'errors'); |
450 | 450 | } |
451 | 451 | |
452 | - if (! $error) |
|
452 | + if (!$error) |
|
453 | 453 | { |
454 | - $modulelowercase=strtolower($module); |
|
454 | + $modulelowercase = strtolower($module); |
|
455 | 455 | |
456 | 456 | // Dir for module |
457 | 457 | $dir = $dirins.'/'.$modulelowercase; |
@@ -482,10 +482,10 @@ discard block |
||
482 | 482 | setEventMessages($langs->trans("SpaceOrSpecialCharAreNotAllowed"), null, 'errors'); |
483 | 483 | } |
484 | 484 | |
485 | - if (! $error) |
|
485 | + if (!$error) |
|
486 | 486 | { |
487 | - $modulelowercase=strtolower($module); |
|
488 | - $objectlowercase=strtolower($objectname); |
|
487 | + $modulelowercase = strtolower($module); |
|
488 | + $objectlowercase = strtolower($objectname); |
|
489 | 489 | |
490 | 490 | // Dir for module |
491 | 491 | $dir = $dirins.'/'.$modulelowercase; |
@@ -509,10 +509,10 @@ discard block |
||
509 | 509 | ); |
510 | 510 | |
511 | 511 | $resultko = 0; |
512 | - foreach($filetogenerate as $filetodelete) |
|
512 | + foreach ($filetogenerate as $filetodelete) |
|
513 | 513 | { |
514 | 514 | $resulttmp = dol_delete_file($dir.'/'.$filetodelete, 0, 0, 1); |
515 | - if (! $resulttmp) $resultko++; |
|
515 | + if (!$resulttmp) $resultko++; |
|
516 | 516 | } |
517 | 517 | |
518 | 518 | if ($resultko == 0) |
@@ -534,23 +534,23 @@ discard block |
||
534 | 534 | |
535 | 535 | if ($dirins && $action == 'generatepackage') |
536 | 536 | { |
537 | - $modulelowercase=strtolower($module); |
|
537 | + $modulelowercase = strtolower($module); |
|
538 | 538 | |
539 | 539 | // Dir for module |
540 | 540 | $dir = $dirins.'/'.$modulelowercase; |
541 | 541 | // Zip file to build |
542 | - $FILENAMEZIP=''; |
|
542 | + $FILENAMEZIP = ''; |
|
543 | 543 | |
544 | 544 | // Load module |
545 | 545 | dol_include_once($modulelowercase.'/core/modules/mod'.$module.'.class.php'); |
546 | - $class='mod'.$module; |
|
546 | + $class = 'mod'.$module; |
|
547 | 547 | |
548 | 548 | if (class_exists($class)) |
549 | 549 | { |
550 | 550 | try { |
551 | 551 | $moduleobj = new $class($db); |
552 | 552 | } |
553 | - catch(Exception $e) |
|
553 | + catch (Exception $e) |
|
554 | 554 | { |
555 | 555 | $error++; |
556 | 556 | dol_print_error($e->getMessage()); |
@@ -564,16 +564,16 @@ discard block |
||
564 | 564 | exit; |
565 | 565 | } |
566 | 566 | |
567 | - $arrayversion=explode('.',$moduleobj->version,3); |
|
567 | + $arrayversion = explode('.', $moduleobj->version, 3); |
|
568 | 568 | if (count($arrayversion)) |
569 | 569 | { |
570 | - $FILENAMEZIP="module_".$modulelowercase.'-'.$arrayversion[0].'.'.$arrayversion[1].($arrayversion[2]?".".$arrayversion[2]:"").".zip"; |
|
570 | + $FILENAMEZIP = "module_".$modulelowercase.'-'.$arrayversion[0].'.'.$arrayversion[1].($arrayversion[2] ? ".".$arrayversion[2] : "").".zip"; |
|
571 | 571 | |
572 | 572 | $dirofmodule = dol_buildpath($modulelowercase, 0).'/bin'; |
573 | 573 | $outputfilezip = $dirofmodule.'/'.$FILENAMEZIP; |
574 | 574 | if ($dirofmodule) |
575 | 575 | { |
576 | - if (! dol_is_dir($dirofmodule)) dol_mkdir($dirofmodule); |
|
576 | + if (!dol_is_dir($dirofmodule)) dol_mkdir($dirofmodule); |
|
577 | 577 | $result = dol_compress_dir($dir, $outputfilezip, 'zip'); |
578 | 578 | } |
579 | 579 | else |
@@ -602,23 +602,23 @@ discard block |
||
602 | 602 | |
603 | 603 | if ($dirins && $action == 'generatedoc') |
604 | 604 | { |
605 | - $modulelowercase=strtolower($module); |
|
605 | + $modulelowercase = strtolower($module); |
|
606 | 606 | |
607 | 607 | // Dir for module |
608 | 608 | $dir = $dirins.'/'.$modulelowercase; |
609 | 609 | // Zip file to build |
610 | - $FILENAMEDOC=''; |
|
610 | + $FILENAMEDOC = ''; |
|
611 | 611 | |
612 | 612 | // Load module |
613 | 613 | dol_include_once($modulelowercase.'/core/modules/mod'.$module.'.class.php'); |
614 | - $class='mod'.$module; |
|
614 | + $class = 'mod'.$module; |
|
615 | 615 | |
616 | 616 | if (class_exists($class)) |
617 | 617 | { |
618 | 618 | try { |
619 | 619 | $moduleobj = new $class($db); |
620 | 620 | } |
621 | - catch(Exception $e) |
|
621 | + catch (Exception $e) |
|
622 | 622 | { |
623 | 623 | $error++; |
624 | 624 | dol_print_error($e->getMessage()); |
@@ -632,16 +632,16 @@ discard block |
||
632 | 632 | exit; |
633 | 633 | } |
634 | 634 | |
635 | - $arrayversion=explode('.',$moduleobj->version,3); |
|
635 | + $arrayversion = explode('.', $moduleobj->version, 3); |
|
636 | 636 | if (count($arrayversion)) |
637 | 637 | { |
638 | - $FILENAMEDOC=$modulelowercase.'.html'; |
|
638 | + $FILENAMEDOC = $modulelowercase.'.html'; |
|
639 | 639 | |
640 | 640 | $dirofmodule = dol_buildpath($modulelowercase, 0).'/doc'; |
641 | 641 | $outputfiledoc = $dirofmodule.'/'.$FILENAMEDOC; |
642 | 642 | if ($dirofmodule) |
643 | 643 | { |
644 | - if (! dol_is_dir($dirofmodule)) dol_mkdir($dirofmodule); |
|
644 | + if (!dol_is_dir($dirofmodule)) dol_mkdir($dirofmodule); |
|
645 | 645 | //... |
646 | 646 | |
647 | 647 | $result = 0; |
@@ -678,10 +678,10 @@ discard block |
||
678 | 678 | if ($relofcustom) |
679 | 679 | { |
680 | 680 | // Check that relative path ($file) start with name 'custom' |
681 | - if (! preg_match('/^'.$relofcustom.'/', $file)) $file=$relofcustom.'/'.$file; |
|
681 | + if (!preg_match('/^'.$relofcustom.'/', $file)) $file = $relofcustom.'/'.$file; |
|
682 | 682 | |
683 | - $pathoffile=dol_buildpath($file, 0); |
|
684 | - $pathoffilebackup=dol_buildpath($file.'.back', 0); |
|
683 | + $pathoffile = dol_buildpath($file, 0); |
|
684 | + $pathoffilebackup = dol_buildpath($file.'.back', 0); |
|
685 | 685 | |
686 | 686 | // Save old version |
687 | 687 | if (dol_is_file($pathoffile)) |
@@ -689,7 +689,7 @@ discard block |
||
689 | 689 | dol_copy($pathoffile, $pathoffilebackup, 0, 1); |
690 | 690 | } |
691 | 691 | |
692 | - $content = GETPOST('editfilecontent','none'); |
|
692 | + $content = GETPOST('editfilecontent', 'none'); |
|
693 | 693 | |
694 | 694 | // Save file on disk |
695 | 695 | if ($content) |
@@ -712,24 +712,24 @@ discard block |
||
712 | 712 | // Enable module |
713 | 713 | if ($action == 'set' && $user->admin) |
714 | 714 | { |
715 | - $param=''; |
|
716 | - if ($module) $param.='&module='.$module; |
|
717 | - if ($tab) $param.='&tab='.$tab; |
|
718 | - if ($tabobj) $param.='&tabobj='.$tabobj; |
|
715 | + $param = ''; |
|
716 | + if ($module) $param .= '&module='.$module; |
|
717 | + if ($tab) $param .= '&tab='.$tab; |
|
718 | + if ($tabobj) $param .= '&tabobj='.$tabobj; |
|
719 | 719 | |
720 | - $value = GETPOST('value','alpha'); |
|
720 | + $value = GETPOST('value', 'alpha'); |
|
721 | 721 | $resarray = activateModule($value); |
722 | - if (! empty($resarray['errors'])) setEventMessages('', $resarray['errors'], 'errors'); |
|
722 | + if (!empty($resarray['errors'])) setEventMessages('', $resarray['errors'], 'errors'); |
|
723 | 723 | else |
724 | 724 | { |
725 | 725 | //var_dump($resarray);exit; |
726 | 726 | if ($resarray['nbperms'] > 0) |
727 | 727 | { |
728 | - $tmpsql="SELECT COUNT(rowid) as nb FROM ".MAIN_DB_PREFIX."user WHERE admin <> 1"; |
|
729 | - $resqltmp=$db->query($tmpsql); |
|
728 | + $tmpsql = "SELECT COUNT(rowid) as nb FROM ".MAIN_DB_PREFIX."user WHERE admin <> 1"; |
|
729 | + $resqltmp = $db->query($tmpsql); |
|
730 | 730 | if ($resqltmp) |
731 | 731 | { |
732 | - $obj=$db->fetch_object($resqltmp); |
|
732 | + $obj = $db->fetch_object($resqltmp); |
|
733 | 733 | //var_dump($obj->nb);exit; |
734 | 734 | if ($obj && $obj->nb > 1) |
735 | 735 | { |
@@ -747,13 +747,13 @@ discard block |
||
747 | 747 | // Disable module |
748 | 748 | if ($action == 'reset' && $user->admin) |
749 | 749 | { |
750 | - $param=''; |
|
751 | - if ($module) $param.='&module='.$module; |
|
752 | - if ($tab) $param.='&tab='.$tab; |
|
753 | - if ($tabobj) $param.='&tabobj='.$tabobj; |
|
750 | + $param = ''; |
|
751 | + if ($module) $param .= '&module='.$module; |
|
752 | + if ($tab) $param .= '&tab='.$tab; |
|
753 | + if ($tabobj) $param .= '&tabobj='.$tabobj; |
|
754 | 754 | |
755 | - $value = GETPOST('value','alpha'); |
|
756 | - $result=unActivateModule($value); |
|
755 | + $value = GETPOST('value', 'alpha'); |
|
756 | + $result = unActivateModule($value); |
|
757 | 757 | if ($result) setEventMessages($result, null, 'errors'); |
758 | 758 | header("Location: ".$_SERVER["PHP_SELF"]."?".$param); |
759 | 759 | exit; |
@@ -768,11 +768,11 @@ discard block |
||
768 | 768 | $formadmin = new FormAdmin($db); |
769 | 769 | |
770 | 770 | // Set dir where external modules are installed |
771 | -if (! dol_is_dir($dirins)) |
|
771 | +if (!dol_is_dir($dirins)) |
|
772 | 772 | { |
773 | 773 | dol_mkdir($dirins); |
774 | 774 | } |
775 | -$dirins_ok=(dol_is_dir($dirins)); |
|
775 | +$dirins_ok = (dol_is_dir($dirins)); |
|
776 | 776 | |
777 | 777 | llxHeader('', $langs->trans("ModuleBuilder"), '', '', 0, 0, |
778 | 778 | array( |
@@ -783,20 +783,20 @@ discard block |
||
783 | 783 | ), array()); |
784 | 784 | |
785 | 785 | |
786 | -$text=$langs->trans("ModuleBuilder"); |
|
786 | +$text = $langs->trans("ModuleBuilder"); |
|
787 | 787 | |
788 | 788 | print load_fiche_titre($text, '', 'title_setup'); |
789 | 789 | |
790 | 790 | // Search modules to edit |
791 | -$listofmodules=array(); |
|
791 | +$listofmodules = array(); |
|
792 | 792 | |
793 | -$dirsincustom=dol_dir_list($dirread, 'directories'); |
|
793 | +$dirsincustom = dol_dir_list($dirread, 'directories'); |
|
794 | 794 | if (is_array($dirsincustom) && count($dirsincustom) > 0) { |
795 | 795 | foreach ($dirsincustom as $dircustomcursor) { |
796 | 796 | $fullname = $dircustomcursor['fullname']; |
797 | - if (dol_is_file($fullname . '/' . $FILEFLAG)) { |
|
797 | + if (dol_is_file($fullname.'/'.$FILEFLAG)) { |
|
798 | 798 | // Get real name of module (MyModule instead of mymodule) |
799 | - $descriptorfiles = dol_dir_list($fullname . '/core/modules/', 'files', 0, 'mod.*\.class\.php$'); |
|
799 | + $descriptorfiles = dol_dir_list($fullname.'/core/modules/', 'files', 0, 'mod.*\.class\.php$'); |
|
800 | 800 | $modulenamewithcase = ''; |
801 | 801 | foreach ($descriptorfiles as $descriptorcursor) { |
802 | 802 | $modulenamewithcase = preg_replace('/^mod/', '', $descriptorcursor['name']); |
@@ -816,36 +816,36 @@ discard block |
||
816 | 816 | } |
817 | 817 | |
818 | 818 | // Show description of content |
819 | -$newdircustom=$dirins; |
|
820 | -if (empty($newdircustom)) $newdircustom=img_warning(); |
|
819 | +$newdircustom = $dirins; |
|
820 | +if (empty($newdircustom)) $newdircustom = img_warning(); |
|
821 | 821 | print $langs->trans("ModuleBuilderDesc", 'https://wiki.dolibarr.org/index.php/Module_development#Create_your_module').'<br>'; |
822 | 822 | print $langs->trans("ModuleBuilderDesc2", 'conf/conf.php', $newdircustom).'<br>'; |
823 | 823 | // If dirread was forced to somewhere else, by using URL |
824 | 824 | // htdocs/modulebuilder/index.php?module=Inventory@/home/ldestailleur/git/dolibarr/htdocs/product |
825 | 825 | if ($forceddirread) print $langs->trans("DirScanned").' : <strong>'.$dirread.'</strong><br>'; |
826 | 826 | |
827 | -$message=''; |
|
828 | -if (! $dirins) |
|
827 | +$message = ''; |
|
828 | +if (!$dirins) |
|
829 | 829 | { |
830 | - $message=info_admin($langs->trans("ConfFileMustContainCustom", DOL_DOCUMENT_ROOT.'/custom', DOL_DOCUMENT_ROOT)); |
|
831 | - $allowfromweb=-1; |
|
830 | + $message = info_admin($langs->trans("ConfFileMustContainCustom", DOL_DOCUMENT_ROOT.'/custom', DOL_DOCUMENT_ROOT)); |
|
831 | + $allowfromweb = -1; |
|
832 | 832 | } |
833 | 833 | else |
834 | 834 | { |
835 | 835 | if ($dirins_ok) |
836 | 836 | { |
837 | - if (! is_writable(dol_osencode($dirins))) |
|
837 | + if (!is_writable(dol_osencode($dirins))) |
|
838 | 838 | { |
839 | 839 | $langs->load("errors"); |
840 | - $message=info_admin($langs->trans("ErrorFailedToWriteInDir",$dirins)); |
|
841 | - $allowfromweb=0; |
|
840 | + $message = info_admin($langs->trans("ErrorFailedToWriteInDir", $dirins)); |
|
841 | + $allowfromweb = 0; |
|
842 | 842 | } |
843 | 843 | } |
844 | 844 | else |
845 | 845 | { |
846 | 846 | |
847 | - $message=info_admin($langs->trans("NotExistsDirect",$dirins).$langs->trans("InfDirAlt").$langs->trans("InfDirExample")); |
|
848 | - $allowfromweb=0; |
|
847 | + $message = info_admin($langs->trans("NotExistsDirect", $dirins).$langs->trans("InfDirAlt").$langs->trans("InfDirExample")); |
|
848 | + $allowfromweb = 0; |
|
849 | 849 | } |
850 | 850 | } |
851 | 851 | if ($message) |
@@ -858,23 +858,23 @@ discard block |
||
858 | 858 | |
859 | 859 | |
860 | 860 | // Load module descriptor |
861 | -$error=0; |
|
861 | +$error = 0; |
|
862 | 862 | $moduleobj = null; |
863 | 863 | |
864 | -if (! empty($module) && $module != 'initmodule' && $module != 'deletemodule') |
|
864 | +if (!empty($module) && $module != 'initmodule' && $module != 'deletemodule') |
|
865 | 865 | { |
866 | - $modulelowercase=strtolower($module); |
|
866 | + $modulelowercase = strtolower($module); |
|
867 | 867 | |
868 | 868 | // Load module |
869 | 869 | dol_include_once($modulelowercase.'/core/modules/mod'.$module.'.class.php'); |
870 | - $class='mod'.$module; |
|
870 | + $class = 'mod'.$module; |
|
871 | 871 | |
872 | 872 | if (class_exists($class)) |
873 | 873 | { |
874 | 874 | try { |
875 | 875 | $moduleobj = new $class($db); |
876 | 876 | } |
877 | - catch(Exception $e) |
|
877 | + catch (Exception $e) |
|
878 | 878 | { |
879 | 879 | $error++; |
880 | 880 | print $e->getMessage(); |
@@ -893,16 +893,16 @@ discard block |
||
893 | 893 | |
894 | 894 | // Tabs for all modules |
895 | 895 | $head = array(); |
896 | -$h=0; |
|
896 | +$h = 0; |
|
897 | 897 | |
898 | 898 | $head[$h][0] = $_SERVER["PHP_SELF"].'?module=initmodule'; |
899 | 899 | $head[$h][1] = $langs->trans("NewModule"); |
900 | 900 | $head[$h][2] = 'initmodule'; |
901 | 901 | $h++; |
902 | 902 | |
903 | -foreach($listofmodules as $tmpmodule => $tmpmodulewithcase) |
|
903 | +foreach ($listofmodules as $tmpmodule => $tmpmodulewithcase) |
|
904 | 904 | { |
905 | - $head[$h][0] = $_SERVER["PHP_SELF"].'?module='.$tmpmodulewithcase.($forceddirread?'@'.$dirread:''); |
|
905 | + $head[$h][0] = $_SERVER["PHP_SELF"].'?module='.$tmpmodulewithcase.($forceddirread ? '@'.$dirread : ''); |
|
906 | 906 | $head[$h][1] = $tmpmodulewithcase; |
907 | 907 | $head[$h][2] = $tmpmodulewithcase; |
908 | 908 | $h++; |
@@ -914,7 +914,7 @@ discard block |
||
914 | 914 | $h++; |
915 | 915 | |
916 | 916 | |
917 | -dol_fiche_head($head, $module, $langs->trans("Modules"), -1, 'generic', 0, $infomodulesfound); // Modules |
|
917 | +dol_fiche_head($head, $module, $langs->trans("Modules"), -1, 'generic', 0, $infomodulesfound); // Modules |
|
918 | 918 | |
919 | 919 | if ($module == 'initmodule') |
920 | 920 | { |
@@ -927,7 +927,7 @@ discard block |
||
927 | 927 | print $langs->trans("EnterNameOfModuleDesc").'<br><br>'; |
928 | 928 | |
929 | 929 | print '<input type="text" name="modulename" value="'.dol_escape_htmltag($modulename).'" placeholder="'.dol_escape_htmltag($langs->trans("ModuleKey")).'">'; |
930 | - print '<input type="submit" class="button" name="create" value="'.dol_escape_htmltag($langs->trans("Create")).'"'.($dirins?'':' disabled="disabled"').'>'; |
|
930 | + print '<input type="submit" class="button" name="create" value="'.dol_escape_htmltag($langs->trans("Create")).'"'.($dirins ? '' : ' disabled="disabled"').'>'; |
|
931 | 931 | print '</form>'; |
932 | 932 | } |
933 | 933 | elseif ($module == 'deletemodule') |
@@ -940,99 +940,99 @@ discard block |
||
940 | 940 | print $langs->trans("EnterNameOfModuleToDeleteDesc").'<br><br>'; |
941 | 941 | |
942 | 942 | print '<input type="text" name="module" placeholder="'.dol_escape_htmltag($langs->trans("ModuleKey")).'" value="">'; |
943 | - print '<input type="submit" class="buttonDelete" value="'.$langs->trans("Delete").'"'.($dirins?'':' disabled="disabled"').'>'; |
|
943 | + print '<input type="submit" class="buttonDelete" value="'.$langs->trans("Delete").'"'.($dirins ? '' : ' disabled="disabled"').'>'; |
|
944 | 944 | print '</form>'; |
945 | 945 | } |
946 | -elseif (! empty($module)) |
|
946 | +elseif (!empty($module)) |
|
947 | 947 | { |
948 | 948 | // Tabs for module |
949 | - if (! $error) |
|
949 | + if (!$error) |
|
950 | 950 | { |
951 | 951 | $head2 = array(); |
952 | - $h=0; |
|
952 | + $h = 0; |
|
953 | 953 | |
954 | - $modulelowercase=strtolower($module); |
|
954 | + $modulelowercase = strtolower($module); |
|
955 | 955 | $const_name = 'MAIN_MODULE_'.strtoupper($module); |
956 | 956 | |
957 | - $param=''; |
|
958 | - if ($tab) $param.= '&tab='.$tab; |
|
959 | - if ($module) $param.='&module='.$module; |
|
960 | - if ($tabobj) $param.='&tabobj='.$tabobj; |
|
957 | + $param = ''; |
|
958 | + if ($tab) $param .= '&tab='.$tab; |
|
959 | + if ($module) $param .= '&module='.$module; |
|
960 | + if ($tabobj) $param .= '&tabobj='.$tabobj; |
|
961 | 961 | |
962 | - $urltomodulesetup='<a href="'.DOL_URL_ROOT.'/admin/modules.php?search_keyword='.urlencode($module).'">'.$langs->trans('Home').'-'.$langs->trans("Setup").'-'.$langs->trans("Modules").'</a>'; |
|
963 | - $linktoenabledisable=''; |
|
964 | - if (! empty($conf->global->$const_name)) // If module is already activated |
|
962 | + $urltomodulesetup = '<a href="'.DOL_URL_ROOT.'/admin/modules.php?search_keyword='.urlencode($module).'">'.$langs->trans('Home').'-'.$langs->trans("Setup").'-'.$langs->trans("Modules").'</a>'; |
|
963 | + $linktoenabledisable = ''; |
|
964 | + if (!empty($conf->global->$const_name)) // If module is already activated |
|
965 | 965 | { |
966 | - $linktoenabledisable.='<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?id='.$moduleobj->numero.'&action=reset&value=mod' . $module . $param . '">'; |
|
967 | - $linktoenabledisable.=img_picto($langs->trans("Activated"),'switch_on'); |
|
968 | - $linktoenabledisable.='</a>'; |
|
966 | + $linktoenabledisable .= '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?id='.$moduleobj->numero.'&action=reset&value=mod'.$module.$param.'">'; |
|
967 | + $linktoenabledisable .= img_picto($langs->trans("Activated"), 'switch_on'); |
|
968 | + $linktoenabledisable .= '</a>'; |
|
969 | 969 | } |
970 | 970 | else |
971 | 971 | { |
972 | - $linktoenabledisable.='<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?id='.$moduleobj->numero.'&action=set&value=mod' . $module . $param . '">'; |
|
973 | - $linktoenabledisable.=img_picto($langs->trans("Disabled"),'switch_off'); |
|
974 | - $linktoenabledisable.="</a>\n"; |
|
972 | + $linktoenabledisable .= '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?id='.$moduleobj->numero.'&action=set&value=mod'.$module.$param.'">'; |
|
973 | + $linktoenabledisable .= img_picto($langs->trans("Disabled"), 'switch_off'); |
|
974 | + $linktoenabledisable .= "</a>\n"; |
|
975 | 975 | } |
976 | - if (! empty($conf->$modulelowercase->enabled)) |
|
976 | + if (!empty($conf->$modulelowercase->enabled)) |
|
977 | 977 | { |
978 | - $modulestatusinfo=img_warning().' '.$langs->trans("ModuleIsLive"); |
|
978 | + $modulestatusinfo = img_warning().' '.$langs->trans("ModuleIsLive"); |
|
979 | 979 | } |
980 | 980 | else |
981 | 981 | { |
982 | - $modulestatusinfo=img_info('').' '.$langs->trans("ModuleIsNotActive", $urltomodulesetup); |
|
982 | + $modulestatusinfo = img_info('').' '.$langs->trans("ModuleIsNotActive", $urltomodulesetup); |
|
983 | 983 | } |
984 | 984 | |
985 | - $head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=description&module='.$module.($forceddirread?'@'.$dirread:''); |
|
985 | + $head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=description&module='.$module.($forceddirread ? '@'.$dirread : ''); |
|
986 | 986 | $head2[$h][1] = $langs->trans("Description"); |
987 | 987 | $head2[$h][2] = 'description'; |
988 | 988 | $h++; |
989 | 989 | |
990 | - $head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=specifications&module='.$module.($forceddirread?'@'.$dirread:''); |
|
990 | + $head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=specifications&module='.$module.($forceddirread ? '@'.$dirread : ''); |
|
991 | 991 | $head2[$h][1] = $langs->trans("Specifications"); |
992 | 992 | $head2[$h][2] = 'specifications'; |
993 | 993 | $h++; |
994 | 994 | |
995 | - $head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=languages&module='.$module.($forceddirread?'@'.$dirread:''); |
|
995 | + $head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=languages&module='.$module.($forceddirread ? '@'.$dirread : ''); |
|
996 | 996 | $head2[$h][1] = $langs->trans("Languages"); |
997 | 997 | $head2[$h][2] = 'languages'; |
998 | 998 | $h++; |
999 | 999 | |
1000 | - $head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=objects&module='.$module.($forceddirread?'@'.$dirread:''); |
|
1000 | + $head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=objects&module='.$module.($forceddirread ? '@'.$dirread : ''); |
|
1001 | 1001 | $head2[$h][1] = $langs->trans("Objects"); |
1002 | 1002 | $head2[$h][2] = 'objects'; |
1003 | 1003 | $h++; |
1004 | 1004 | |
1005 | - $head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=menus&module='.$module.($forceddirread?'@'.$dirread:''); |
|
1005 | + $head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=menus&module='.$module.($forceddirread ? '@'.$dirread : ''); |
|
1006 | 1006 | $head2[$h][1] = $langs->trans("Menus"); |
1007 | 1007 | $head2[$h][2] = 'menus'; |
1008 | 1008 | $h++; |
1009 | 1009 | |
1010 | - $head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=permissions&module='.$module.($forceddirread?'@'.$dirread:''); |
|
1010 | + $head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=permissions&module='.$module.($forceddirread ? '@'.$dirread : ''); |
|
1011 | 1011 | $head2[$h][1] = $langs->trans("Permissions"); |
1012 | 1012 | $head2[$h][2] = 'permissions'; |
1013 | 1013 | $h++; |
1014 | 1014 | |
1015 | - $head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=hooks&module='.$module.($forceddirread?'@'.$dirread:''); |
|
1015 | + $head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=hooks&module='.$module.($forceddirread ? '@'.$dirread : ''); |
|
1016 | 1016 | $head2[$h][1] = $langs->trans("Hooks"); |
1017 | 1017 | $head2[$h][2] = 'hooks'; |
1018 | 1018 | $h++; |
1019 | 1019 | |
1020 | - $head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=triggers&module='.$module.($forceddirread?'@'.$dirread:''); |
|
1020 | + $head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=triggers&module='.$module.($forceddirread ? '@'.$dirread : ''); |
|
1021 | 1021 | $head2[$h][1] = $langs->trans("Triggers"); |
1022 | 1022 | $head2[$h][2] = 'triggers'; |
1023 | 1023 | $h++; |
1024 | 1024 | |
1025 | - $head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=widgets&module='.$module.($forceddirread?'@'.$dirread:''); |
|
1025 | + $head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=widgets&module='.$module.($forceddirread ? '@'.$dirread : ''); |
|
1026 | 1026 | $head2[$h][1] = $langs->trans("Widgets"); |
1027 | 1027 | $head2[$h][2] = 'widgets'; |
1028 | 1028 | $h++; |
1029 | 1029 | |
1030 | - $head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=cron&module='.$module.($forceddirread?'@'.$dirread:''); |
|
1030 | + $head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=cron&module='.$module.($forceddirread ? '@'.$dirread : ''); |
|
1031 | 1031 | $head2[$h][1] = $langs->trans("CronList"); |
1032 | 1032 | $head2[$h][2] = 'cron'; |
1033 | 1033 | $h++; |
1034 | 1034 | |
1035 | - $head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=buildpackage&module='.$module.($forceddirread?'@'.$dirread:''); |
|
1035 | + $head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=buildpackage&module='.$module.($forceddirread ? '@'.$dirread : ''); |
|
1036 | 1036 | $head2[$h][1] = $langs->trans("BuildPackage"); |
1037 | 1037 | $head2[$h][2] = 'buildpackage'; |
1038 | 1038 | $h++; |
@@ -1049,20 +1049,20 @@ discard block |
||
1049 | 1049 | |
1050 | 1050 | if ($action != 'editfile' || empty($file)) |
1051 | 1051 | { |
1052 | - dol_fiche_head($head2, $tab, '', -1, ''); // Description - level 2 |
|
1052 | + dol_fiche_head($head2, $tab, '', -1, ''); // Description - level 2 |
|
1053 | 1053 | |
1054 | 1054 | print $langs->trans("ModuleBuilderDesc".$tab).'<br><br>'; |
1055 | 1055 | |
1056 | 1056 | print '<span class="fa fa-file"></span> '.$langs->trans("DescriptorFile").' : <strong>'.$pathtofile.'</strong>'; |
1057 | - print ' <a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&module='.$module.($forceddirread?'@'.$dirread:'').'&action=editfile&format=php&file='.urlencode($pathtofile).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>'; |
|
1057 | + print ' <a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&module='.$module.($forceddirread ? '@'.$dirread : '').'&action=editfile&format=php&file='.urlencode($pathtofile).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>'; |
|
1058 | 1058 | print '<br>'; |
1059 | 1059 | |
1060 | 1060 | print '<span class="fa fa-file"></span> '.$langs->trans("ReadmeFile").' : <strong>'.$pathtofilereadme.'</strong>'; |
1061 | - print ' <a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&module='.$module.($forceddirread?'@'.$dirread:'').'&action=editfile&format=markdown&file='.urlencode($pathtofilereadme).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>'; |
|
1061 | + print ' <a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&module='.$module.($forceddirread ? '@'.$dirread : '').'&action=editfile&format=markdown&file='.urlencode($pathtofilereadme).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>'; |
|
1062 | 1062 | print '<br>'; |
1063 | 1063 | |
1064 | 1064 | print '<span class="fa fa-file"></span> '.$langs->trans("ChangeLog").' : <strong>'.$pathtochangelog.'</strong>'; |
1065 | - print ' <a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&module='.$module.($forceddirread?'@'.$dirread:'').'&action=editfile&format=markdown&file='.urlencode($pathtochangelog).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>'; |
|
1065 | + print ' <a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&module='.$module.($forceddirread ? '@'.$dirread : '').'&action=editfile&format=markdown&file='.urlencode($pathtochangelog).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>'; |
|
1066 | 1066 | print '<br>'; |
1067 | 1067 | |
1068 | 1068 | print '<br>'; |
@@ -1070,7 +1070,7 @@ discard block |
||
1070 | 1070 | |
1071 | 1071 | print_fiche_titre($langs->trans("DescriptorFile")); |
1072 | 1072 | |
1073 | - if (! empty($moduleobj)) |
|
1073 | + if (!empty($moduleobj)) |
|
1074 | 1074 | { |
1075 | 1075 | print '<div class="underbanner clearboth"></div>'; |
1076 | 1076 | print '<div class="fichecenter">'; |
@@ -1160,7 +1160,7 @@ discard block |
||
1160 | 1160 | } |
1161 | 1161 | else |
1162 | 1162 | { |
1163 | - $fullpathoffile=dol_buildpath($file, 0, 1); // Description - level 2 |
|
1163 | + $fullpathoffile = dol_buildpath($file, 0, 1); // Description - level 2 |
|
1164 | 1164 | |
1165 | 1165 | if ($fullpathoffile) |
1166 | 1166 | { |
@@ -1177,8 +1177,8 @@ discard block |
||
1177 | 1177 | |
1178 | 1178 | dol_fiche_head($head2, $tab, '', -1, ''); |
1179 | 1179 | |
1180 | - $doleditor=new DolEditor('editfilecontent', $content, '', '300', 'Full', 'In', true, false, 'ace', 0, '99%', ''); |
|
1181 | - print $doleditor->Create(1, '', false, $langs->trans("File").' : '.$file, (GETPOST('format','aZ09')?GETPOST('format','aZ09'):'html')); |
|
1180 | + $doleditor = new DolEditor('editfilecontent', $content, '', '300', 'Full', 'In', true, false, 'ace', 0, '99%', ''); |
|
1181 | + print $doleditor->Create(1, '', false, $langs->trans("File").' : '.$file, (GETPOST('format', 'aZ09') ?GETPOST('format', 'aZ09') : 'html')); |
|
1182 | 1182 | |
1183 | 1183 | dol_fiche_end(); |
1184 | 1184 | |
@@ -1193,7 +1193,7 @@ discard block |
||
1193 | 1193 | } |
1194 | 1194 | else |
1195 | 1195 | { |
1196 | - dol_fiche_head($head2, $tab, '', -1, ''); // Level 2 |
|
1196 | + dol_fiche_head($head2, $tab, '', -1, ''); // Level 2 |
|
1197 | 1197 | } |
1198 | 1198 | |
1199 | 1199 | |
@@ -1204,13 +1204,13 @@ discard block |
||
1204 | 1204 | print $langs->trans("SpecDefDesc").'<br>'; |
1205 | 1205 | print '<br>'; |
1206 | 1206 | |
1207 | - $specs=dol_dir_list(dol_buildpath($modulelowercase.'/doc', 0), 'files', 1, '(\.md|\.asciidoc)$'); |
|
1207 | + $specs = dol_dir_list(dol_buildpath($modulelowercase.'/doc', 0), 'files', 1, '(\.md|\.asciidoc)$'); |
|
1208 | 1208 | |
1209 | 1209 | foreach ($specs as $spec) |
1210 | 1210 | { |
1211 | 1211 | $pathtofile = $modulelowercase.'/doc/'.$spec['relativename']; |
1212 | - $format='asciidoc'; |
|
1213 | - if (preg_match('/\.md$/i', $spec['name'])) $format='markdown'; |
|
1212 | + $format = 'asciidoc'; |
|
1213 | + if (preg_match('/\.md$/i', $spec['name'])) $format = 'markdown'; |
|
1214 | 1214 | print '<span class="fa fa-file"></span> '.$langs->trans("SpecificationFile").' : <strong>'.$pathtofile.'</strong>'; |
1215 | 1215 | print ' <a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&module='.$module.'&action=editfile&format='.$format.'&file='.urlencode($pathtofile).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>'; |
1216 | 1216 | print '<br>'; |
@@ -1222,7 +1222,7 @@ discard block |
||
1222 | 1222 | |
1223 | 1223 | //print $langs->trans("UseAsciiDocFormat").'<br>'; |
1224 | 1224 | |
1225 | - $fullpathoffile=dol_buildpath($file, 0); |
|
1225 | + $fullpathoffile = dol_buildpath($file, 0); |
|
1226 | 1226 | |
1227 | 1227 | $content = file_get_contents($fullpathoffile); |
1228 | 1228 | |
@@ -1234,8 +1234,8 @@ discard block |
||
1234 | 1234 | print '<input type="hidden" name="tab" value="'.$tab.'">'; |
1235 | 1235 | print '<input type="hidden" name="module" value="'.$module.'">'; |
1236 | 1236 | |
1237 | - $doleditor=new DolEditor('editfilecontent', $content, '', '300', 'Full', 'In', true, false, 'ace', 0, '99%'); |
|
1238 | - print $doleditor->Create(1, '', false, $langs->trans("File").' : '.$file, (GETPOST('format','aZ09')?GETPOST('format','aZ09'):'html')); |
|
1237 | + $doleditor = new DolEditor('editfilecontent', $content, '', '300', 'Full', 'In', true, false, 'ace', 0, '99%'); |
|
1238 | + print $doleditor->Create(1, '', false, $langs->trans("File").' : '.$file, (GETPOST('format', 'aZ09') ?GETPOST('format', 'aZ09') : 'html')); |
|
1239 | 1239 | print '<br>'; |
1240 | 1240 | print '<center>'; |
1241 | 1241 | print '<input type="submit" class="button buttonforacesave" id="savefile" name="savefile" value="'.dol_escape_htmltag($langs->trans("Save")).'">'; |
@@ -1268,7 +1268,7 @@ discard block |
||
1268 | 1268 | print '<br>'; |
1269 | 1269 | print '<br>'; |
1270 | 1270 | |
1271 | - $langfiles=dol_dir_list(dol_buildpath($modulelowercase.'/langs', 0), 'files', 1, '\.lang$'); |
|
1271 | + $langfiles = dol_dir_list(dol_buildpath($modulelowercase.'/langs', 0), 'files', 1, '\.lang$'); |
|
1272 | 1272 | |
1273 | 1273 | foreach ($langfiles as $langfile) |
1274 | 1274 | { |
@@ -1284,7 +1284,7 @@ discard block |
||
1284 | 1284 | |
1285 | 1285 | //print $langs->trans("UseAsciiDocFormat").'<br>'; |
1286 | 1286 | |
1287 | - $fullpathoffile=dol_buildpath($file, 0); |
|
1287 | + $fullpathoffile = dol_buildpath($file, 0); |
|
1288 | 1288 | |
1289 | 1289 | $content = file_get_contents($fullpathoffile); |
1290 | 1290 | |
@@ -1296,8 +1296,8 @@ discard block |
||
1296 | 1296 | print '<input type="hidden" name="tab" value="'.$tab.'">'; |
1297 | 1297 | print '<input type="hidden" name="module" value="'.$module.'">'; |
1298 | 1298 | |
1299 | - $doleditor=new DolEditor('editfilecontent', $content, '', '300', 'Full', 'In', true, false, 'ace', 0, '99%'); |
|
1300 | - print $doleditor->Create(1, '', false, $langs->trans("File").' : '.$file, (GETPOST('format','aZ09')?GETPOST('format','aZ09'):'text')); |
|
1299 | + $doleditor = new DolEditor('editfilecontent', $content, '', '300', 'Full', 'In', true, false, 'ace', 0, '99%'); |
|
1300 | + print $doleditor->Create(1, '', false, $langs->trans("File").' : '.$file, (GETPOST('format', 'aZ09') ?GETPOST('format', 'aZ09') : 'text')); |
|
1301 | 1301 | print '<br>'; |
1302 | 1302 | print '<center>'; |
1303 | 1303 | print '<input type="submit" class="button buttonforacesave" id="savefile" name="savefile" value="'.dol_escape_htmltag($langs->trans("Save")).'">'; |
@@ -1312,12 +1312,12 @@ discard block |
||
1312 | 1312 | if ($tab == 'objects') |
1313 | 1313 | { |
1314 | 1314 | $head3 = array(); |
1315 | - $h=0; |
|
1315 | + $h = 0; |
|
1316 | 1316 | |
1317 | 1317 | // Dir for module |
1318 | 1318 | $dir = $dirread.'/'.$modulelowercase.'/class'; |
1319 | 1319 | |
1320 | - $head3[$h][0] = $_SERVER["PHP_SELF"].'?tab=objects&module='.$module.($forceddirread?'@'.$dirread:'').'&tabobj=newobject'; |
|
1320 | + $head3[$h][0] = $_SERVER["PHP_SELF"].'?tab=objects&module='.$module.($forceddirread ? '@'.$dirread : '').'&tabobj=newobject'; |
|
1321 | 1321 | $head3[$h][1] = $langs->trans("NewObject"); |
1322 | 1322 | $head3[$h][2] = 'newobject'; |
1323 | 1323 | $h++; |
@@ -1325,27 +1325,27 @@ discard block |
||
1325 | 1325 | // Scan for object class files |
1326 | 1326 | $listofobject = dol_dir_list($dir, 'files', 0, '\.class\.php$'); |
1327 | 1327 | |
1328 | - $firstobjectname=''; |
|
1329 | - foreach($listofobject as $fileobj) |
|
1328 | + $firstobjectname = ''; |
|
1329 | + foreach ($listofobject as $fileobj) |
|
1330 | 1330 | { |
1331 | - if (preg_match('/^api_/',$fileobj['name'])) continue; |
|
1332 | - if (preg_match('/^actions_/',$fileobj['name'])) continue; |
|
1331 | + if (preg_match('/^api_/', $fileobj['name'])) continue; |
|
1332 | + if (preg_match('/^actions_/', $fileobj['name'])) continue; |
|
1333 | 1333 | |
1334 | - $tmpcontent=file_get_contents($fileobj['fullname']); |
|
1335 | - if (preg_match('/class\s+([^\s]*)\s+extends\s+CommonObject/ims',$tmpcontent,$reg)) |
|
1334 | + $tmpcontent = file_get_contents($fileobj['fullname']); |
|
1335 | + if (preg_match('/class\s+([^\s]*)\s+extends\s+CommonObject/ims', $tmpcontent, $reg)) |
|
1336 | 1336 | { |
1337 | 1337 | //$objectname = preg_replace('/\.txt$/', '', $fileobj['name']); |
1338 | 1338 | $objectname = $reg[1]; |
1339 | 1339 | if (empty($firstobjectname)) $firstobjectname = $objectname; |
1340 | 1340 | |
1341 | - $head3[$h][0] = $_SERVER["PHP_SELF"].'?tab=objects&module='.$module.($forceddirread?'@'.$dirread:'').'&tabobj='.$objectname; |
|
1341 | + $head3[$h][0] = $_SERVER["PHP_SELF"].'?tab=objects&module='.$module.($forceddirread ? '@'.$dirread : '').'&tabobj='.$objectname; |
|
1342 | 1342 | $head3[$h][1] = $objectname; |
1343 | 1343 | $head3[$h][2] = $objectname; |
1344 | 1344 | $h++; |
1345 | 1345 | } |
1346 | 1346 | } |
1347 | 1347 | |
1348 | - $head3[$h][0] = $_SERVER["PHP_SELF"].'?tab=objects&module='.$module.($forceddirread?'@'.$dirread:'').'&tabobj=deleteobject'; |
|
1348 | + $head3[$h][0] = $_SERVER["PHP_SELF"].'?tab=objects&module='.$module.($forceddirread ? '@'.$dirread : '').'&tabobj=deleteobject'; |
|
1349 | 1349 | $head3[$h][1] = $langs->trans("DangerZone"); |
1350 | 1350 | $head3[$h][2] = 'deleteobject'; |
1351 | 1351 | $h++; |
@@ -1353,11 +1353,11 @@ discard block |
||
1353 | 1353 | // If tabobj was not defined, then we check if there is one obj. If yes, we force on it, if no, we will show tab to create new objects. |
1354 | 1354 | if ($tabobj == 'newobjectifnoobj') |
1355 | 1355 | { |
1356 | - if ($firstobjectname) $tabobj=$firstobjectname; |
|
1356 | + if ($firstobjectname) $tabobj = $firstobjectname; |
|
1357 | 1357 | else $tabobj = 'newobject'; |
1358 | 1358 | } |
1359 | 1359 | |
1360 | - dol_fiche_head($head3, $tabobj, '', -1, ''); // Level 3 |
|
1360 | + dol_fiche_head($head3, $tabobj, '', -1, ''); // Level 3 |
|
1361 | 1361 | |
1362 | 1362 | if ($tabobj == 'newobject') |
1363 | 1363 | { |
@@ -1371,7 +1371,7 @@ discard block |
||
1371 | 1371 | print $langs->trans("EnterNameOfObjectDesc").'<br><br>'; |
1372 | 1372 | |
1373 | 1373 | print '<input type="text" name="objectname" value="'.dol_escape_htmltag($modulename).'" placeholder="'.dol_escape_htmltag($langs->trans("ObjectKey")).'">'; |
1374 | - print '<input type="submit" class="button" name="create" value="'.dol_escape_htmltag($langs->trans("Create")).'"'.($dirins?'':' disabled="disabled"').'>'; |
|
1374 | + print '<input type="submit" class="button" name="create" value="'.dol_escape_htmltag($langs->trans("Create")).'"'.($dirins ? '' : ' disabled="disabled"').'>'; |
|
1375 | 1375 | print '</form>'; |
1376 | 1376 | } |
1377 | 1377 | elseif ($tabobj == 'deleteobject') |
@@ -1386,7 +1386,7 @@ discard block |
||
1386 | 1386 | print $langs->trans("EnterNameOfObjectToDeleteDesc").'<br><br>'; |
1387 | 1387 | |
1388 | 1388 | print '<input type="text" name="objectname" value="'.dol_escape_htmltag($modulename).'" placeholder="'.dol_escape_htmltag($langs->trans("ObjectKey")).'">'; |
1389 | - print '<input type="submit" class="buttonDelete" name="delete" value="'.dol_escape_htmltag($langs->trans("Delete")).'"'.($dirins?'':' disabled="disabled"').'>'; |
|
1389 | + print '<input type="submit" class="buttonDelete" name="delete" value="'.dol_escape_htmltag($langs->trans("Delete")).'"'.($dirins ? '' : ' disabled="disabled"').'>'; |
|
1390 | 1390 | print '</form>'; |
1391 | 1391 | } |
1392 | 1392 | else |
@@ -1394,8 +1394,8 @@ discard block |
||
1394 | 1394 | if ($action == 'deleteproperty') |
1395 | 1395 | { |
1396 | 1396 | $formconfirm = $form->formconfirm( |
1397 | - $_SERVER["PHP_SELF"].'?propertykey='.urlencode(GETPOST('propertykey','alpha')).'&objectname='.urlencode($objectname).'&tab='.urlencode($tab).'&module='.urlencode($module).'&tabobj='.urlencode($tabobj), |
|
1398 | - $langs->trans('Delete'), $langs->trans('ConfirmDeleteProperty', GETPOST('propertykey','alpha')), 'confirm_deleteproperty', '', 0, 1 |
|
1397 | + $_SERVER["PHP_SELF"].'?propertykey='.urlencode(GETPOST('propertykey', 'alpha')).'&objectname='.urlencode($objectname).'&tab='.urlencode($tab).'&module='.urlencode($module).'&tabobj='.urlencode($tabobj), |
|
1398 | + $langs->trans('Delete'), $langs->trans('ConfirmDeleteProperty', GETPOST('propertykey', 'alpha')), 'confirm_deleteproperty', '', 0, 1 |
|
1399 | 1399 | ); |
1400 | 1400 | |
1401 | 1401 | // Print form confirm |
@@ -1434,38 +1434,38 @@ discard block |
||
1434 | 1434 | $realpathtopicto = dol_buildpath($pathtopicto, 0, 1); |
1435 | 1435 | |
1436 | 1436 | print '<div class="fichehalfleft">'; |
1437 | - print '<span class="fa fa-file"></span> '.$langs->trans("ClassFile").' : <strong>'.($realpathtoclass?'':'<strike>').$pathtoclass.($realpathtoclass?'':'</strike>').'</strong>'; |
|
1438 | - print ' <a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&tabobj='.$tabobj.'&module='.$module.($forceddirread?'@'.$dirread:'').'&action=editfile&format=php&file='.urlencode($pathtoclass).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>'; |
|
1437 | + print '<span class="fa fa-file"></span> '.$langs->trans("ClassFile").' : <strong>'.($realpathtoclass ? '' : '<strike>').$pathtoclass.($realpathtoclass ? '' : '</strike>').'</strong>'; |
|
1438 | + print ' <a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&tabobj='.$tabobj.'&module='.$module.($forceddirread ? '@'.$dirread : '').'&action=editfile&format=php&file='.urlencode($pathtoclass).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>'; |
|
1439 | 1439 | print '<br>'; |
1440 | - print '<span class="fa fa-file"></span> '.$langs->trans("ApiClassFile").' : <strong>'.($realpathtoapi?'':'<strike>').$pathtoapi.($realpathtoapi?'':'</strike>').'</strong>'; |
|
1441 | - print ' <a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&tabobj='.$tabobj.'&module='.$module.($forceddirread?'@'.$dirread:'').'&action=editfile&format=php&file='.urlencode($pathtoapi).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>'; |
|
1440 | + print '<span class="fa fa-file"></span> '.$langs->trans("ApiClassFile").' : <strong>'.($realpathtoapi ? '' : '<strike>').$pathtoapi.($realpathtoapi ? '' : '</strike>').'</strong>'; |
|
1441 | + print ' <a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&tabobj='.$tabobj.'&module='.$module.($forceddirread ? '@'.$dirread : '').'&action=editfile&format=php&file='.urlencode($pathtoapi).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>'; |
|
1442 | 1442 | print ' <a href="'.DOL_URL_ROOT.'/api/index.php/explorer/" target="apiexplorer">'.$langs->trans("GoToApiExplorer").'</a>'; |
1443 | 1443 | print '<br>'; |
1444 | - print '<span class="fa fa-file"></span> '.$langs->trans("TestClassFile").' : <strong>'.($realpathtophpunit?'':'<strike>').$pathtophpunit.($realpathtophpunit?'':'</strike>').'</strong>'; |
|
1445 | - print ' <a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&tabobj='.$tabobj.'&module='.$module.($forceddirread?'@'.$dirread:'').'&action=editfile&format=php&file='.urlencode($pathtophpunit).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>'; |
|
1444 | + print '<span class="fa fa-file"></span> '.$langs->trans("TestClassFile").' : <strong>'.($realpathtophpunit ? '' : '<strike>').$pathtophpunit.($realpathtophpunit ? '' : '</strike>').'</strong>'; |
|
1445 | + print ' <a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&tabobj='.$tabobj.'&module='.$module.($forceddirread ? '@'.$dirread : '').'&action=editfile&format=php&file='.urlencode($pathtophpunit).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>'; |
|
1446 | 1446 | print '<br>'; |
1447 | 1447 | |
1448 | 1448 | print '<br>'; |
1449 | 1449 | |
1450 | - print '<span class="fa fa-file"></span> '.$langs->trans("PageForLib").' : <strong>'.($realpathtolib?'':'<strike>').$pathtolib.($realpathtodocument?'':'</strike>').'</strong>'; |
|
1451 | - print ' <a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&tabobj='.$tabobj.'&module='.$module.($forceddirread?'@'.$dirread:'').'&action=editfile&format=php&file='.urlencode($pathtolib).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>'; |
|
1450 | + print '<span class="fa fa-file"></span> '.$langs->trans("PageForLib").' : <strong>'.($realpathtolib ? '' : '<strike>').$pathtolib.($realpathtodocument ? '' : '</strike>').'</strong>'; |
|
1451 | + print ' <a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&tabobj='.$tabobj.'&module='.$module.($forceddirread ? '@'.$dirread : '').'&action=editfile&format=php&file='.urlencode($pathtolib).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>'; |
|
1452 | 1452 | print '<br>'; |
1453 | - print '<span class="fa fa-file"></span> '.$langs->trans("PageForPicto").' : <strong>'.($realpathtopicto?'':'<strike>').$pathtopicto.($realpathtopicto?'':'</strike>').'</strong>'; |
|
1453 | + print '<span class="fa fa-file"></span> '.$langs->trans("PageForPicto").' : <strong>'.($realpathtopicto ? '' : '<strike>').$pathtopicto.($realpathtopicto ? '' : '</strike>').'</strong>'; |
|
1454 | 1454 | //print ' <a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&tabobj='.$tabobj.'&module='.$module.($forceddirread?'@'.$dirread:'').'&action=editfile&format=php&file='.urlencode($pathtopicto).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>'; |
1455 | 1455 | print '<br>'; |
1456 | 1456 | |
1457 | 1457 | print '<br>'; |
1458 | - print '<span class="fa fa-file"></span> '.$langs->trans("SqlFile").' : <strong>'.($realpathtosql?'':'<strike>').$pathtosql.($realpathtosql?'':'</strike>').'</strong>'; |
|
1459 | - print ' <a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&tabobj='.$tabobj.'&module='.$module.($forceddirread?'@'.$dirread:'').'&action=editfile&format=sql&file='.urlencode($pathtosql).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>'; |
|
1458 | + print '<span class="fa fa-file"></span> '.$langs->trans("SqlFile").' : <strong>'.($realpathtosql ? '' : '<strike>').$pathtosql.($realpathtosql ? '' : '</strike>').'</strong>'; |
|
1459 | + print ' <a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&tabobj='.$tabobj.'&module='.$module.($forceddirread ? '@'.$dirread : '').'&action=editfile&format=sql&file='.urlencode($pathtosql).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>'; |
|
1460 | 1460 | print ' <a href="'.$_SERVER["PHP_SELF"].'">'.$langs->trans("DropTableIfEmpty").'</a>'; |
1461 | 1461 | //print ' <a href="'.$_SERVER["PHP_SELF"].'">'.$langs->trans("RunSql").'</a>'; |
1462 | 1462 | print '<br>'; |
1463 | - print '<span class="fa fa-file"></span> '.$langs->trans("SqlFileExtraFields").' : <strong>'.($realpathtosqlextra?'':'<strike>').$pathtosqlextra.($realpathtosqlextra?'':'</strike>').'</strong>'; |
|
1464 | - print ' <a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&tabobj='.$tabobj.'&module='.$module.($forceddirread?'@'.$dirread:'').'&action=editfile&file='.urlencode($pathtosqlextra).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>'; |
|
1463 | + print '<span class="fa fa-file"></span> '.$langs->trans("SqlFileExtraFields").' : <strong>'.($realpathtosqlextra ? '' : '<strike>').$pathtosqlextra.($realpathtosqlextra ? '' : '</strike>').'</strong>'; |
|
1464 | + print ' <a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&tabobj='.$tabobj.'&module='.$module.($forceddirread ? '@'.$dirread : '').'&action=editfile&file='.urlencode($pathtosqlextra).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>'; |
|
1465 | 1465 | //print ' <a href="'.$_SERVER["PHP_SELF"].'">'.$langs->trans("RunSql").'</a>'; |
1466 | 1466 | print '<br>'; |
1467 | - print '<span class="fa fa-file"></span> '.$langs->trans("SqlFileKey").' : <strong>'.($realpathtosqlkey?'':'<strike>').$pathtosqlkey.($realpathtosqlkey?'':'</strike>').'</strong>'; |
|
1468 | - print ' <a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&tabobj='.$tabobj.'&module='.$module.($forceddirread?'@'.$dirread:'').'&action=editfile&format=sql&file='.urlencode($pathtosqlkey).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>'; |
|
1467 | + print '<span class="fa fa-file"></span> '.$langs->trans("SqlFileKey").' : <strong>'.($realpathtosqlkey ? '' : '<strike>').$pathtosqlkey.($realpathtosqlkey ? '' : '</strike>').'</strong>'; |
|
1468 | + print ' <a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&tabobj='.$tabobj.'&module='.$module.($forceddirread ? '@'.$dirread : '').'&action=editfile&format=sql&file='.urlencode($pathtosqlkey).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>'; |
|
1469 | 1469 | //print ' <a href="'.$_SERVER["PHP_SELF"].'">'.$langs->trans("RunSql").'</a>'; |
1470 | 1470 | print '<br>'; |
1471 | 1471 | |
@@ -1476,20 +1476,20 @@ discard block |
||
1476 | 1476 | $urlofcard = dol_buildpath($pathtocard, 1); |
1477 | 1477 | |
1478 | 1478 | print '<div class="fichehalfleft">'; |
1479 | - print '<span class="fa fa-file"></span> '.$langs->trans("PageForList").' : <strong><a href="'.$urloflist.'" target="_test">'.($realpathtosql?'':'<strike>').$pathtolist.($realpathtosql?'':'</strike>').'</a></strong>'; |
|
1480 | - print ' <a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&tabobj='.$tabobj.'&module='.$module.($forceddirread?'@'.$dirread:'').'&action=editfile&format=php&file='.urlencode($pathtolist).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>'; |
|
1479 | + print '<span class="fa fa-file"></span> '.$langs->trans("PageForList").' : <strong><a href="'.$urloflist.'" target="_test">'.($realpathtosql ? '' : '<strike>').$pathtolist.($realpathtosql ? '' : '</strike>').'</a></strong>'; |
|
1480 | + print ' <a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&tabobj='.$tabobj.'&module='.$module.($forceddirread ? '@'.$dirread : '').'&action=editfile&format=php&file='.urlencode($pathtolist).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>'; |
|
1481 | 1481 | print '<br>'; |
1482 | - print '<span class="fa fa-file"></span> '.$langs->trans("PageForCreateEditView").' : <strong><a href="'.$urlofcard.'?action=create" target="_test">'.($realpathtocard?'':'<strike>').$pathtocard.($realpathtocard?'':'</strike>').'?action=create</a></strong>'; |
|
1483 | - print ' <a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&tabobj='.$tabobj.'&module='.$module.($forceddirread?'@'.$dirread:'').'&action=editfile&format=php&file='.urlencode($pathtocard).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>'; |
|
1482 | + print '<span class="fa fa-file"></span> '.$langs->trans("PageForCreateEditView").' : <strong><a href="'.$urlofcard.'?action=create" target="_test">'.($realpathtocard ? '' : '<strike>').$pathtocard.($realpathtocard ? '' : '</strike>').'?action=create</a></strong>'; |
|
1483 | + print ' <a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&tabobj='.$tabobj.'&module='.$module.($forceddirread ? '@'.$dirread : '').'&action=editfile&format=php&file='.urlencode($pathtocard).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>'; |
|
1484 | 1484 | print '<br>'; |
1485 | - print '<span class="fa fa-file"></span> '.$langs->trans("PageForAgendaTab").' : <strong>'.($realpathtoagenda?'':'<strike>').$pathtoagenda.($realpathtoagenda?'':'</strike>').'</strong>'; |
|
1486 | - print ' <a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&tabobj='.$tabobj.'&module='.$module.($forceddirread?'@'.$dirread:'').'&action=editfile&format=php&file='.urlencode($pathtoagenda).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>'; |
|
1485 | + print '<span class="fa fa-file"></span> '.$langs->trans("PageForAgendaTab").' : <strong>'.($realpathtoagenda ? '' : '<strike>').$pathtoagenda.($realpathtoagenda ? '' : '</strike>').'</strong>'; |
|
1486 | + print ' <a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&tabobj='.$tabobj.'&module='.$module.($forceddirread ? '@'.$dirread : '').'&action=editfile&format=php&file='.urlencode($pathtoagenda).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>'; |
|
1487 | 1487 | print '<br>'; |
1488 | - print '<span class="fa fa-file"></span> '.$langs->trans("PageForDocumentTab").' : <strong>'.($realpathtodocument?'':'<strike>').$pathtodocument.($realpathtodocument?'':'</strike>').'</strong>'; |
|
1489 | - print ' <a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&tabobj='.$tabobj.'&module='.$module.($forceddirread?'@'.$dirread:'').'&action=editfile&format=php&file='.urlencode($pathtodocument).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>'; |
|
1488 | + print '<span class="fa fa-file"></span> '.$langs->trans("PageForDocumentTab").' : <strong>'.($realpathtodocument ? '' : '<strike>').$pathtodocument.($realpathtodocument ? '' : '</strike>').'</strong>'; |
|
1489 | + print ' <a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&tabobj='.$tabobj.'&module='.$module.($forceddirread ? '@'.$dirread : '').'&action=editfile&format=php&file='.urlencode($pathtodocument).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>'; |
|
1490 | 1490 | print '<br>'; |
1491 | - print '<span class="fa fa-file"></span> '.$langs->trans("PageForNoteTab").' : <strong>'.($realpathtonote?'':'<strike>').$pathtonote.($realpathtonote?'':'</strike>').'</strong>'; |
|
1492 | - print ' <a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&tabobj='.$tabobj.'&module='.$module.($forceddirread?'@'.$dirread:'').'&action=editfile&format=php&file='.urlencode($pathtonote).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>'; |
|
1491 | + print '<span class="fa fa-file"></span> '.$langs->trans("PageForNoteTab").' : <strong>'.($realpathtonote ? '' : '<strike>').$pathtonote.($realpathtonote ? '' : '</strike>').'</strong>'; |
|
1492 | + print ' <a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&tabobj='.$tabobj.'&module='.$module.($forceddirread ? '@'.$dirread : '').'&action=editfile&format=php&file='.urlencode($pathtonote).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>'; |
|
1493 | 1493 | print '<br>'; |
1494 | 1494 | |
1495 | 1495 | print '<br>'; |
@@ -1511,17 +1511,17 @@ discard block |
||
1511 | 1511 | try { |
1512 | 1512 | $tmpobjet = @new $tabobj($db); |
1513 | 1513 | } |
1514 | - catch(Exception $e) |
|
1514 | + catch (Exception $e) |
|
1515 | 1515 | { |
1516 | 1516 | dol_syslog('Failed to load Constructor of class: '.$e->getMessage(), LOG_WARNING); |
1517 | 1517 | } |
1518 | 1518 | } |
1519 | 1519 | |
1520 | - if (! empty($tmpobjet)) |
|
1520 | + if (!empty($tmpobjet)) |
|
1521 | 1521 | { |
1522 | 1522 | $reflector = new ReflectionClass($tabobj); |
1523 | - $properties = $reflector->getProperties(); // Can also use get_object_vars |
|
1524 | - $propdefault = $reflector->getDefaultProperties(); // Can also use get_object_vars |
|
1523 | + $properties = $reflector->getProperties(); // Can also use get_object_vars |
|
1524 | + $propdefault = $reflector->getDefaultProperties(); // Can also use get_object_vars |
|
1525 | 1525 | //$propstat = $reflector->getStaticProperties(); |
1526 | 1526 | |
1527 | 1527 | print load_fiche_titre($langs->trans("Properties"), '', ''); |
@@ -1531,7 +1531,7 @@ discard block |
||
1531 | 1531 | print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; |
1532 | 1532 | print '<input type="hidden" name="action" value="addproperty">'; |
1533 | 1533 | print '<input type="hidden" name="tab" value="objects">'; |
1534 | - print '<input type="hidden" name="module" value="'.dol_escape_htmltag($module.($forceddirread?'@'.$dirread:'')).'">'; |
|
1534 | + print '<input type="hidden" name="module" value="'.dol_escape_htmltag($module.($forceddirread ? '@'.$dirread : '')).'">'; |
|
1535 | 1535 | print '<input type="hidden" name="tabobj" value="'.dol_escape_htmltag($tabobj).'">'; |
1536 | 1536 | |
1537 | 1537 | print '<div class="div-table-responsive">'; |
@@ -1559,28 +1559,28 @@ discard block |
||
1559 | 1559 | |
1560 | 1560 | $properties = dol_sort_array($tmpobjet->fields, 'position'); |
1561 | 1561 | |
1562 | - if (! empty($properties)) |
|
1562 | + if (!empty($properties)) |
|
1563 | 1563 | { |
1564 | 1564 | // Line to add a property |
1565 | 1565 | print '<tr>'; |
1566 | - print '<td><input class="text" name="propname" value="'.dol_escape_htmltag(GETPOST('propname','alpha')).'"></td>'; |
|
1567 | - print '<td><input class="text" name="proplabel" value="'.dol_escape_htmltag(GETPOST('proplabel','alpha')).'"></td>'; |
|
1568 | - print '<td><input class="text" name="proptype" value="'.dol_escape_htmltag(GETPOST('proptype','alpha')).'"></td>'; |
|
1569 | - print '<td><input class="text" name="proparrayofkeyval" value="'.dol_escape_htmltag(GETPOST('proparrayofkeyval','none')).'"></td>'; |
|
1570 | - print '<td class="center"><input class="text" size="2" name="propnotnull" value="'.dol_escape_htmltag(GETPOST('propnotnull','alpha')).'"></td>'; |
|
1566 | + print '<td><input class="text" name="propname" value="'.dol_escape_htmltag(GETPOST('propname', 'alpha')).'"></td>'; |
|
1567 | + print '<td><input class="text" name="proplabel" value="'.dol_escape_htmltag(GETPOST('proplabel', 'alpha')).'"></td>'; |
|
1568 | + print '<td><input class="text" name="proptype" value="'.dol_escape_htmltag(GETPOST('proptype', 'alpha')).'"></td>'; |
|
1569 | + print '<td><input class="text" name="proparrayofkeyval" value="'.dol_escape_htmltag(GETPOST('proparrayofkeyval', 'none')).'"></td>'; |
|
1570 | + print '<td class="center"><input class="text" size="2" name="propnotnull" value="'.dol_escape_htmltag(GETPOST('propnotnull', 'alpha')).'"></td>'; |
|
1571 | 1571 | //print '<td><input class="text" name="propdefault" value=""></td>'; |
1572 | - print '<td class="center"><input class="text" size="2" name="propindex" value="'.dol_escape_htmltag(GETPOST('propindex','alpha')).'"></td>'; |
|
1573 | - print '<td class="right"><input class="text right" size="2" name="propposition" value="'.dol_escape_htmltag(GETPOST('propposition','alpha')).'"></td>'; |
|
1574 | - print '<td class="center"><input class="text" size="2" name="propenabled" value="'.dol_escape_htmltag(GETPOST('propenabled','alpha')).'"></td>'; |
|
1575 | - print '<td class="center"><input class="text" size="2" name="propvisible" value="'.dol_escape_htmltag(GETPOST('propvisible','alpha')).'"></td>'; |
|
1576 | - print '<td class="center"><input class="text" size="2" name="propisameasure" value="'.dol_escape_htmltag(GETPOST('propisameasure','alpha')).'"></td>'; |
|
1577 | - print '<td class="center"><input class="text" size="2" name="propsearchall" value="'.dol_escape_htmltag(GETPOST('propsearchall','alpha')).'"></td>'; |
|
1578 | - print '<td><input class="text" name="propcomment" value="'.dol_escape_htmltag(GETPOST('propcomment','alpha')).'"></td>'; |
|
1572 | + print '<td class="center"><input class="text" size="2" name="propindex" value="'.dol_escape_htmltag(GETPOST('propindex', 'alpha')).'"></td>'; |
|
1573 | + print '<td class="right"><input class="text right" size="2" name="propposition" value="'.dol_escape_htmltag(GETPOST('propposition', 'alpha')).'"></td>'; |
|
1574 | + print '<td class="center"><input class="text" size="2" name="propenabled" value="'.dol_escape_htmltag(GETPOST('propenabled', 'alpha')).'"></td>'; |
|
1575 | + print '<td class="center"><input class="text" size="2" name="propvisible" value="'.dol_escape_htmltag(GETPOST('propvisible', 'alpha')).'"></td>'; |
|
1576 | + print '<td class="center"><input class="text" size="2" name="propisameasure" value="'.dol_escape_htmltag(GETPOST('propisameasure', 'alpha')).'"></td>'; |
|
1577 | + print '<td class="center"><input class="text" size="2" name="propsearchall" value="'.dol_escape_htmltag(GETPOST('propsearchall', 'alpha')).'"></td>'; |
|
1578 | + print '<td><input class="text" name="propcomment" value="'.dol_escape_htmltag(GETPOST('propcomment', 'alpha')).'"></td>'; |
|
1579 | 1579 | print '<td align="center">'; |
1580 | 1580 | print '<input class="button" type="submit" name="add" value="'.$langs->trans("Add").'">'; |
1581 | 1581 | print '</td></tr>'; |
1582 | 1582 | |
1583 | - foreach($properties as $propkey => $propval) |
|
1583 | + foreach ($properties as $propkey => $propval) |
|
1584 | 1584 | { |
1585 | 1585 | /* If from Reflection |
1586 | 1586 | if ($propval->class == $tabobj) |
@@ -1596,19 +1596,19 @@ discard block |
||
1596 | 1596 | if (in_array($propname, array('fk_element', 'lines'))) continue; |
1597 | 1597 | }*/ |
1598 | 1598 | |
1599 | - $propname=$propkey; |
|
1600 | - $proplabel=$propval['label']; |
|
1601 | - $proptype=$propval['type']; |
|
1602 | - $proparrayofkeyval=$propval['arrayofkeyval']; |
|
1603 | - $propnotnull=$propval['notnull']; |
|
1604 | - $propsearchall=$propval['searchall']; |
|
1599 | + $propname = $propkey; |
|
1600 | + $proplabel = $propval['label']; |
|
1601 | + $proptype = $propval['type']; |
|
1602 | + $proparrayofkeyval = $propval['arrayofkeyval']; |
|
1603 | + $propnotnull = $propval['notnull']; |
|
1604 | + $propsearchall = $propval['searchall']; |
|
1605 | 1605 | //$propdefault=$propval['default']; |
1606 | - $propindex=$propval['index']; |
|
1607 | - $propposition=$propval['position']; |
|
1608 | - $propenabled=$propval['enabled']; |
|
1609 | - $propvisible=$propval['visible']; |
|
1610 | - $propisameasure=$propval['isameasure']; |
|
1611 | - $propcomment=$propval['comment']; |
|
1606 | + $propindex = $propval['index']; |
|
1607 | + $propposition = $propval['position']; |
|
1608 | + $propenabled = $propval['enabled']; |
|
1609 | + $propvisible = $propval['visible']; |
|
1610 | + $propisameasure = $propval['isameasure']; |
|
1611 | + $propcomment = $propval['comment']; |
|
1612 | 1612 | |
1613 | 1613 | print '<tr class="oddeven">'; |
1614 | 1614 | |
@@ -1634,22 +1634,22 @@ discard block |
||
1634 | 1634 | print $propdefault; |
1635 | 1635 | print '</td>';*/ |
1636 | 1636 | print '<td class="center">'; |
1637 | - print $propindex?'X':''; |
|
1637 | + print $propindex ? 'X' : ''; |
|
1638 | 1638 | print '</td>'; |
1639 | 1639 | print '<td align="right">'; |
1640 | 1640 | print $propposition; |
1641 | 1641 | print '</td>'; |
1642 | 1642 | print '<td class="center">'; |
1643 | - print $propenabled?$propenabled:''; |
|
1643 | + print $propenabled ? $propenabled : ''; |
|
1644 | 1644 | print '</td>'; |
1645 | 1645 | print '<td class="center">'; |
1646 | - print $propvisible?$propvisible:''; |
|
1646 | + print $propvisible ? $propvisible : ''; |
|
1647 | 1647 | print '</td>'; |
1648 | 1648 | print '<td class="center">'; |
1649 | - print $propisameasure?$propisameasure:''; |
|
1649 | + print $propisameasure ? $propisameasure : ''; |
|
1650 | 1650 | print '</td>'; |
1651 | 1651 | print '<td class="center">'; |
1652 | - print $propsearchall?'X':''; |
|
1652 | + print $propsearchall ? 'X' : ''; |
|
1653 | 1653 | print '</td>'; |
1654 | 1654 | print '<td>'; |
1655 | 1655 | print $propcomment; |
@@ -1675,7 +1675,7 @@ discard block |
||
1675 | 1675 | print '<tr><td><span class="warning">'.$langs->trans('Failed to init the object with the new.').'</warning></td></tr>'; |
1676 | 1676 | } |
1677 | 1677 | } |
1678 | - catch(Exception $e) |
|
1678 | + catch (Exception $e) |
|
1679 | 1679 | { |
1680 | 1680 | print $e->getMessage(); |
1681 | 1681 | } |
@@ -1684,11 +1684,11 @@ discard block |
||
1684 | 1684 | { |
1685 | 1685 | if (empty($forceddirread)) |
1686 | 1686 | { |
1687 | - $fullpathoffile=dol_buildpath($file, 0); |
|
1687 | + $fullpathoffile = dol_buildpath($file, 0); |
|
1688 | 1688 | } |
1689 | 1689 | else |
1690 | 1690 | { |
1691 | - $fullpathoffile=$dirread.'/'.$file; |
|
1691 | + $fullpathoffile = $dirread.'/'.$file; |
|
1692 | 1692 | } |
1693 | 1693 | |
1694 | 1694 | $content = file_get_contents($fullpathoffile); |
@@ -1700,10 +1700,10 @@ discard block |
||
1700 | 1700 | print '<input type="hidden" name="file" value="'.dol_escape_htmltag($file).'">'; |
1701 | 1701 | print '<input type="hidden" name="tab" value="'.$tab.'">'; |
1702 | 1702 | print '<input type="hidden" name="tabobj" value="'.dol_escape_htmltag($tabobj).'">'; |
1703 | - print '<input type="hidden" name="module" value="'.$module.($forceddirread?'@'.$dirread:'').'">'; |
|
1703 | + print '<input type="hidden" name="module" value="'.$module.($forceddirread ? '@'.$dirread : '').'">'; |
|
1704 | 1704 | |
1705 | - $doleditor=new DolEditor('editfilecontent', $content, '', '300', 'Full', 'In', true, false, 'ace', 0, '99%'); |
|
1706 | - print $doleditor->Create(1, '', false, $langs->trans("File").' : '.$file, (GETPOST('format','aZ09')?GETPOST('format','aZ09'):'html')); |
|
1705 | + $doleditor = new DolEditor('editfilecontent', $content, '', '300', 'Full', 'In', true, false, 'ace', 0, '99%'); |
|
1706 | + print $doleditor->Create(1, '', false, $langs->trans("File").' : '.$file, (GETPOST('format', 'aZ09') ?GETPOST('format', 'aZ09') : 'html')); |
|
1707 | 1707 | print '<br>'; |
1708 | 1708 | print '<center>'; |
1709 | 1709 | print '<input type="submit" class="button buttonforacesave" id="savefile" name="savefile" value="'.dol_escape_htmltag($langs->trans("Save")).'">'; |
@@ -1715,7 +1715,7 @@ discard block |
||
1715 | 1715 | } |
1716 | 1716 | } |
1717 | 1717 | |
1718 | - dol_fiche_end(); // Level 3 |
|
1718 | + dol_fiche_end(); // Level 3 |
|
1719 | 1719 | } |
1720 | 1720 | |
1721 | 1721 | if ($tab == 'menus') |
@@ -1817,7 +1817,7 @@ discard block |
||
1817 | 1817 | } |
1818 | 1818 | else |
1819 | 1819 | { |
1820 | - $fullpathoffile=dol_buildpath($file, 0); |
|
1820 | + $fullpathoffile = dol_buildpath($file, 0); |
|
1821 | 1821 | |
1822 | 1822 | $content = file_get_contents($fullpathoffile); |
1823 | 1823 | |
@@ -1829,8 +1829,8 @@ discard block |
||
1829 | 1829 | print '<input type="hidden" name="tab" value="'.$tab.'">'; |
1830 | 1830 | print '<input type="hidden" name="module" value="'.$module.'">'; |
1831 | 1831 | |
1832 | - $doleditor=new DolEditor('editfilecontent', $content, '', '300', 'Full', 'In', true, false, 'ace', 0, '99%'); |
|
1833 | - print $doleditor->Create(1, '', false, $langs->trans("File").' : '.$file, (GETPOST('format','aZ09')?GETPOST('format','aZ09'):'html')); |
|
1832 | + $doleditor = new DolEditor('editfilecontent', $content, '', '300', 'Full', 'In', true, false, 'ace', 0, '99%'); |
|
1833 | + print $doleditor->Create(1, '', false, $langs->trans("File").' : '.$file, (GETPOST('format', 'aZ09') ?GETPOST('format', 'aZ09') : 'html')); |
|
1834 | 1834 | print '<br>'; |
1835 | 1835 | print '<center>'; |
1836 | 1836 | print '<input type="submit" class="button buttonforacesave" id="savefile" name="savefile" value="'.dol_escape_htmltag($langs->trans("Save")).'">'; |
@@ -1942,7 +1942,7 @@ discard block |
||
1942 | 1942 | } |
1943 | 1943 | else |
1944 | 1944 | { |
1945 | - $fullpathoffile=dol_buildpath($file, 0); |
|
1945 | + $fullpathoffile = dol_buildpath($file, 0); |
|
1946 | 1946 | |
1947 | 1947 | $content = file_get_contents($fullpathoffile); |
1948 | 1948 | |
@@ -1954,8 +1954,8 @@ discard block |
||
1954 | 1954 | print '<input type="hidden" name="tab" value="'.$tab.'">'; |
1955 | 1955 | print '<input type="hidden" name="module" value="'.$module.'">'; |
1956 | 1956 | |
1957 | - $doleditor=new DolEditor('editfilecontent', $content, '', '300', 'Full', 'In', true, false, 'ace', 0, '99%'); |
|
1958 | - print $doleditor->Create(1, '', false, $langs->trans("File").' : '.$file, (GETPOST('format','aZ09')?GETPOST('format','aZ09'):'html')); |
|
1957 | + $doleditor = new DolEditor('editfilecontent', $content, '', '300', 'Full', 'In', true, false, 'ace', 0, '99%'); |
|
1958 | + print $doleditor->Create(1, '', false, $langs->trans("File").' : '.$file, (GETPOST('format', 'aZ09') ?GETPOST('format', 'aZ09') : 'html')); |
|
1959 | 1959 | print '<br>'; |
1960 | 1960 | print '<center>'; |
1961 | 1961 | print '<input type="submit" class="button buttonforacesave" id="savefile" name="savefile" value="'.dol_escape_htmltag($langs->trans("Save")).'">'; |
@@ -1986,7 +1986,7 @@ discard block |
||
1986 | 1986 | } |
1987 | 1987 | else |
1988 | 1988 | { |
1989 | - $fullpathoffile=dol_buildpath($file, 0); |
|
1989 | + $fullpathoffile = dol_buildpath($file, 0); |
|
1990 | 1990 | |
1991 | 1991 | $content = file_get_contents($fullpathoffile); |
1992 | 1992 | |
@@ -1998,8 +1998,8 @@ discard block |
||
1998 | 1998 | print '<input type="hidden" name="tab" value="'.$tab.'">'; |
1999 | 1999 | print '<input type="hidden" name="module" value="'.$module.'">'; |
2000 | 2000 | |
2001 | - $doleditor=new DolEditor('editfilecontent', $content, '', '300', 'Full', 'In', true, false, 'ace', 0, '99%'); |
|
2002 | - print $doleditor->Create(1, '', false, $langs->trans("File").' : '.$file, (GETPOST('format','aZ09')?GETPOST('format','aZ09'):'html')); |
|
2001 | + $doleditor = new DolEditor('editfilecontent', $content, '', '300', 'Full', 'In', true, false, 'ace', 0, '99%'); |
|
2002 | + print $doleditor->Create(1, '', false, $langs->trans("File").' : '.$file, (GETPOST('format', 'aZ09') ?GETPOST('format', 'aZ09') : 'html')); |
|
2003 | 2003 | print '<br>'; |
2004 | 2004 | print '<center>'; |
2005 | 2005 | print '<input type="submit" class="button buttonforacesave" id="savefile" name="savefile" value="'.dol_escape_htmltag($langs->trans("Save")).'">'; |
@@ -2023,7 +2023,7 @@ discard block |
||
2023 | 2023 | print $langs->trans("TriggerDefDesc").'<br>'; |
2024 | 2024 | print '<br>'; |
2025 | 2025 | |
2026 | - if (! empty($triggers)) |
|
2026 | + if (!empty($triggers)) |
|
2027 | 2027 | { |
2028 | 2028 | foreach ($triggers as $trigger) |
2029 | 2029 | { |
@@ -2041,7 +2041,7 @@ discard block |
||
2041 | 2041 | } |
2042 | 2042 | else |
2043 | 2043 | { |
2044 | - $fullpathoffile=dol_buildpath($file, 0); |
|
2044 | + $fullpathoffile = dol_buildpath($file, 0); |
|
2045 | 2045 | |
2046 | 2046 | $content = file_get_contents($fullpathoffile); |
2047 | 2047 | |
@@ -2053,8 +2053,8 @@ discard block |
||
2053 | 2053 | print '<input type="hidden" name="tab" value="'.$tab.'">'; |
2054 | 2054 | print '<input type="hidden" name="module" value="'.$module.'">'; |
2055 | 2055 | |
2056 | - $doleditor=new DolEditor('editfilecontent', $content, '', '300', 'Full', 'In', true, false, 'ace', 0, '99%'); |
|
2057 | - print $doleditor->Create(1, '', false, $langs->trans("File").' : '.$file, (GETPOST('format','aZ09')?GETPOST('format','aZ09'):'html')); |
|
2056 | + $doleditor = new DolEditor('editfilecontent', $content, '', '300', 'Full', 'In', true, false, 'ace', 0, '99%'); |
|
2057 | + print $doleditor->Create(1, '', false, $langs->trans("File").' : '.$file, (GETPOST('format', 'aZ09') ?GETPOST('format', 'aZ09') : 'html')); |
|
2058 | 2058 | print '<br>'; |
2059 | 2059 | print '<center>'; |
2060 | 2060 | print '<input type="submit" class="button buttonforacesave" id="savefile" name="savefile" value="'.dol_escape_htmltag($langs->trans("Save")).'">'; |
@@ -2074,7 +2074,7 @@ discard block |
||
2074 | 2074 | |
2075 | 2075 | if ($action != 'editfile' || empty($file)) |
2076 | 2076 | { |
2077 | - if (! empty($widget)) |
|
2077 | + if (!empty($widget)) |
|
2078 | 2078 | { |
2079 | 2079 | foreach ($widgets as $widget) |
2080 | 2080 | { |
@@ -2092,7 +2092,7 @@ discard block |
||
2092 | 2092 | } |
2093 | 2093 | else |
2094 | 2094 | { |
2095 | - $fullpathoffile=dol_buildpath($file, 0); |
|
2095 | + $fullpathoffile = dol_buildpath($file, 0); |
|
2096 | 2096 | |
2097 | 2097 | $content = file_get_contents($fullpathoffile); |
2098 | 2098 | |
@@ -2104,8 +2104,8 @@ discard block |
||
2104 | 2104 | print '<input type="hidden" name="tab" value="'.$tab.'">'; |
2105 | 2105 | print '<input type="hidden" name="module" value="'.$module.'">'; |
2106 | 2106 | |
2107 | - $doleditor=new DolEditor('editfilecontent', $content, '', '300', 'Full', 'In', true, false, 'ace', 0, '99%'); |
|
2108 | - print $doleditor->Create(1, '', false, $langs->trans("File").' : '.$file, (GETPOST('format','aZ09')?GETPOST('format','aZ09'):'html')); |
|
2107 | + $doleditor = new DolEditor('editfilecontent', $content, '', '300', 'Full', 'In', true, false, 'ace', 0, '99%'); |
|
2108 | + print $doleditor->Create(1, '', false, $langs->trans("File").' : '.$file, (GETPOST('format', 'aZ09') ?GETPOST('format', 'aZ09') : 'html')); |
|
2109 | 2109 | print '<br>'; |
2110 | 2110 | print '<center>'; |
2111 | 2111 | print '<input type="submit" class="button buttonforacesave" id="savefile" name="savefile" value="'.dol_escape_htmltag($langs->trans("Save")).'">'; |
@@ -2146,11 +2146,11 @@ discard block |
||
2146 | 2146 | print '<table class="noborder">'; |
2147 | 2147 | |
2148 | 2148 | print '<tr class="liste_titre">'; |
2149 | - print_liste_field_titre("CronLabel",$_SERVER["PHP_SELF"],"","",$param,'',$sortfield,$sortorder); |
|
2150 | - print_liste_field_titre("CronTask",'','',"",$param,'',$sortfield,$sortorder); |
|
2151 | - print_liste_field_titre("CronFrequency",'',"","",$param,'',$sortfield,$sortorder); |
|
2152 | - print_liste_field_titre("StatusAtInstall",$_SERVER["PHP_SELF"],"","",$param,'',$sortfield,$sortorder); |
|
2153 | - print_liste_field_titre("Comment",$_SERVER["PHP_SELF"],"","",$param,'',$sortfield,$sortorder); |
|
2149 | + print_liste_field_titre("CronLabel", $_SERVER["PHP_SELF"], "", "", $param, '', $sortfield, $sortorder); |
|
2150 | + print_liste_field_titre("CronTask", '', '', "", $param, '', $sortfield, $sortorder); |
|
2151 | + print_liste_field_titre("CronFrequency", '', "", "", $param, '', $sortfield, $sortorder); |
|
2152 | + print_liste_field_titre("StatusAtInstall", $_SERVER["PHP_SELF"], "", "", $param, '', $sortfield, $sortorder); |
|
2153 | + print_liste_field_titre("Comment", $_SERVER["PHP_SELF"], "", "", $param, '', $sortfield, $sortorder); |
|
2154 | 2154 | print "</tr>\n"; |
2155 | 2155 | |
2156 | 2156 | if (count($cronjobs)) |
@@ -2164,31 +2164,31 @@ discard block |
||
2164 | 2164 | print '</td>'; |
2165 | 2165 | |
2166 | 2166 | print '<td>'; |
2167 | - if ($cron['jobtype']=='method') |
|
2167 | + if ($cron['jobtype'] == 'method') |
|
2168 | 2168 | { |
2169 | - $text=$langs->trans("CronClass"); |
|
2170 | - $texttoshow=$langs->trans('CronModule').': '.$module.'<br>'; |
|
2171 | - $texttoshow.=$langs->trans('CronClass').': '. $cron['class'].'<br>'; |
|
2172 | - $texttoshow.=$langs->trans('CronObject').': '. $cron['objectname'].'<br>'; |
|
2173 | - $texttoshow.=$langs->trans('CronMethod').': '. $cron['method']; |
|
2174 | - $texttoshow.='<br>'.$langs->trans('CronArgs').': '. $cron['parameters']; |
|
2175 | - $texttoshow.='<br>'.$langs->trans('Comment').': '. $langs->trans($cron['comment']); |
|
2169 | + $text = $langs->trans("CronClass"); |
|
2170 | + $texttoshow = $langs->trans('CronModule').': '.$module.'<br>'; |
|
2171 | + $texttoshow .= $langs->trans('CronClass').': '.$cron['class'].'<br>'; |
|
2172 | + $texttoshow .= $langs->trans('CronObject').': '.$cron['objectname'].'<br>'; |
|
2173 | + $texttoshow .= $langs->trans('CronMethod').': '.$cron['method']; |
|
2174 | + $texttoshow .= '<br>'.$langs->trans('CronArgs').': '.$cron['parameters']; |
|
2175 | + $texttoshow .= '<br>'.$langs->trans('Comment').': '.$langs->trans($cron['comment']); |
|
2176 | 2176 | } |
2177 | - elseif ($cron['jobtype']=='command') |
|
2177 | + elseif ($cron['jobtype'] == 'command') |
|
2178 | 2178 | { |
2179 | - $text=$langs->trans('CronCommand'); |
|
2180 | - $texttoshow=$langs->trans('CronCommand').': '.dol_trunc($cron['command']); |
|
2181 | - $texttoshow.='<br>'.$langs->trans('CronArgs').': '. $cron['parameters']; |
|
2182 | - $texttoshow.='<br>'.$langs->trans('Comment').': '. $langs->trans($cron['comment']); |
|
2179 | + $text = $langs->trans('CronCommand'); |
|
2180 | + $texttoshow = $langs->trans('CronCommand').': '.dol_trunc($cron['command']); |
|
2181 | + $texttoshow .= '<br>'.$langs->trans('CronArgs').': '.$cron['parameters']; |
|
2182 | + $texttoshow .= '<br>'.$langs->trans('Comment').': '.$langs->trans($cron['comment']); |
|
2183 | 2183 | } |
2184 | 2184 | print $form->textwithpicto($text, $texttoshow, 1); |
2185 | 2185 | print '</td>'; |
2186 | 2186 | |
2187 | 2187 | print '<td>'; |
2188 | - if($cron['unitfrequency'] == "60") print $langs->trans('CronEach')." ".($cron['frequency'])." ".$langs->trans('Minutes'); |
|
2189 | - if($cron['unitfrequency'] == "3600") print $langs->trans('CronEach')." ".($cron['frequency'])." ".$langs->trans('Hours'); |
|
2190 | - if($cron['unitfrequency'] == "86400") print $langs->trans('CronEach')." ".($cron['frequency'])." ".$langs->trans('Days'); |
|
2191 | - if($cron['unitfrequency'] == "604800") print $langs->trans('CronEach')." ".($cron['frequency'])." ".$langs->trans('Weeks'); |
|
2188 | + if ($cron['unitfrequency'] == "60") print $langs->trans('CronEach')." ".($cron['frequency'])." ".$langs->trans('Minutes'); |
|
2189 | + if ($cron['unitfrequency'] == "3600") print $langs->trans('CronEach')." ".($cron['frequency'])." ".$langs->trans('Hours'); |
|
2190 | + if ($cron['unitfrequency'] == "86400") print $langs->trans('CronEach')." ".($cron['frequency'])." ".$langs->trans('Days'); |
|
2191 | + if ($cron['unitfrequency'] == "604800") print $langs->trans('CronEach')." ".($cron['frequency'])." ".$langs->trans('Weeks'); |
|
2192 | 2192 | print '</td>'; |
2193 | 2193 | |
2194 | 2194 | print '<td>'; |
@@ -2196,7 +2196,7 @@ discard block |
||
2196 | 2196 | print '</td>'; |
2197 | 2197 | |
2198 | 2198 | print '<td>'; |
2199 | - if (!empty($cron['comment'])) {print $cron['comment'];} |
|
2199 | + if (!empty($cron['comment'])) {print $cron['comment']; } |
|
2200 | 2200 | print '</td>'; |
2201 | 2201 | |
2202 | 2202 | print '</tr>'; |
@@ -2214,7 +2214,7 @@ discard block |
||
2214 | 2214 | } |
2215 | 2215 | else |
2216 | 2216 | { |
2217 | - $fullpathoffile=dol_buildpath($file, 0); |
|
2217 | + $fullpathoffile = dol_buildpath($file, 0); |
|
2218 | 2218 | |
2219 | 2219 | $content = file_get_contents($fullpathoffile); |
2220 | 2220 | |
@@ -2226,8 +2226,8 @@ discard block |
||
2226 | 2226 | print '<input type="hidden" name="tab" value="'.$tab.'">'; |
2227 | 2227 | print '<input type="hidden" name="module" value="'.$module.'">'; |
2228 | 2228 | |
2229 | - $doleditor=new DolEditor('editfilecontent', $content, '', '300', 'Full', 'In', true, false, 'ace', 0, '99%'); |
|
2230 | - print $doleditor->Create(1, '', false, $langs->trans("File").' : '.$file, (GETPOST('format','aZ09')?GETPOST('format','aZ09'):'html')); |
|
2229 | + $doleditor = new DolEditor('editfilecontent', $content, '', '300', 'Full', 'In', true, false, 'ace', 0, '99%'); |
|
2230 | + print $doleditor->Create(1, '', false, $langs->trans("File").' : '.$file, (GETPOST('format', 'aZ09') ?GETPOST('format', 'aZ09') : 'html')); |
|
2231 | 2231 | print '<br>'; |
2232 | 2232 | print '<center>'; |
2233 | 2233 | print '<input type="submit" class="button buttonforacesave" id="savefile" name="savefile" value="'.dol_escape_htmltag($langs->trans("Save")).'">'; |
@@ -2241,27 +2241,27 @@ discard block |
||
2241 | 2241 | |
2242 | 2242 | if ($tab == 'buildpackage') |
2243 | 2243 | { |
2244 | - if (! class_exists('ZipArchive') && ! defined('ODTPHP_PATHTOPCLZIP')) |
|
2244 | + if (!class_exists('ZipArchive') && !defined('ODTPHP_PATHTOPCLZIP')) |
|
2245 | 2245 | { |
2246 | 2246 | print img_warning().' '.$langs->trans("ErrNoZipEngine"); |
2247 | 2247 | print '<br>'; |
2248 | 2248 | } |
2249 | 2249 | |
2250 | - $modulelowercase=strtolower($module); |
|
2250 | + $modulelowercase = strtolower($module); |
|
2251 | 2251 | |
2252 | 2252 | // Zip file to build |
2253 | - $FILENAMEZIP=''; |
|
2253 | + $FILENAMEZIP = ''; |
|
2254 | 2254 | |
2255 | 2255 | // Load module |
2256 | 2256 | dol_include_once($modulelowercase.'/core/modules/mod'.$module.'.class.php'); |
2257 | - $class='mod'.$module; |
|
2257 | + $class = 'mod'.$module; |
|
2258 | 2258 | |
2259 | 2259 | if (class_exists($class)) |
2260 | 2260 | { |
2261 | 2261 | try { |
2262 | 2262 | $moduleobj = new $class($db); |
2263 | 2263 | } |
2264 | - catch(Exception $e) |
|
2264 | + catch (Exception $e) |
|
2265 | 2265 | { |
2266 | 2266 | $error++; |
2267 | 2267 | dol_print_error($e->getMessage()); |
@@ -2275,20 +2275,20 @@ discard block |
||
2275 | 2275 | exit; |
2276 | 2276 | } |
2277 | 2277 | |
2278 | - $arrayversion=explode('.',$moduleobj->version,3); |
|
2278 | + $arrayversion = explode('.', $moduleobj->version, 3); |
|
2279 | 2279 | if (count($arrayversion)) |
2280 | 2280 | { |
2281 | - $FILENAMEZIP="module_".$modulelowercase.'-'.$arrayversion[0].'.'.$arrayversion[1].($arrayversion[2]?".".$arrayversion[2]:"").".zip"; |
|
2281 | + $FILENAMEZIP = "module_".$modulelowercase.'-'.$arrayversion[0].'.'.$arrayversion[1].($arrayversion[2] ? ".".$arrayversion[2] : "").".zip"; |
|
2282 | 2282 | $outputfilezip = dol_buildpath($modulelowercase, 0).'/bin/'.$FILENAMEZIP; |
2283 | 2283 | |
2284 | - $FILENAMEDOC=$modulelowercase.'.html'; |
|
2284 | + $FILENAMEDOC = $modulelowercase.'.html'; |
|
2285 | 2285 | $outputfiledoc = dol_buildpath($modulelowercase, 0).'/doc/'.$FILENAMEDOC; |
2286 | 2286 | } |
2287 | 2287 | |
2288 | 2288 | print '<br>'; |
2289 | 2289 | |
2290 | - print '<span class="fa fa-file"></span> '. $langs->trans("PathToModulePackage") . ' : '; |
|
2291 | - if (! dol_is_file($outputfilezip)) print '<strong>'.$langs->trans("FileNotYetGenerated").'</strong>'; |
|
2290 | + print '<span class="fa fa-file"></span> '.$langs->trans("PathToModulePackage").' : '; |
|
2291 | + if (!dol_is_file($outputfilezip)) print '<strong>'.$langs->trans("FileNotYetGenerated").'</strong>'; |
|
2292 | 2292 | else { |
2293 | 2293 | $relativepath = $modulelowercase.'/bin/'.$FILENAMEZIP; |
2294 | 2294 | print '<strong><a href="'.DOL_URL_ROOT.'/document.php?modulepart=packages&file='.urlencode($relativepath).'">'.$outputfilezip.'</a></strong>'; |
@@ -2307,8 +2307,8 @@ discard block |
||
2307 | 2307 | |
2308 | 2308 | print '<br><br><br>'; |
2309 | 2309 | |
2310 | - print '<span class="fa fa-file"></span> '. $langs->trans("PathToModuleDocumentation") . ' : '; |
|
2311 | - if (! dol_is_file($outputfiledoc)) print '<strong>'.$langs->trans("FileNotYetGenerated").'</strong>'; |
|
2310 | + print '<span class="fa fa-file"></span> '.$langs->trans("PathToModuleDocumentation").' : '; |
|
2311 | + if (!dol_is_file($outputfiledoc)) print '<strong>'.$langs->trans("FileNotYetGenerated").'</strong>'; |
|
2312 | 2312 | else { |
2313 | 2313 | print '<strong>'.$outputfiledoc.'</strong>'; |
2314 | 2314 | print ' ('.$langs->trans("GeneratedOn").' '.dol_print_date(dol_filemtime($outputfiledoc), 'dayhour').')'; |