From b0c7b640e58498b541c7729e19b21381b269d994 Mon Sep 17 00:00:00 2001
From: opensides htdocs/lib/CMailFile.class.php
htdocs/lib/CMailFile.class.php
Aller à la documentation de ce fichier.
Généré le Thu Jul 15 20:50:37 2004 pour dolibarr par
+00095 // print "<pre> on encode $sourcefile </pre>\n";
+00096 if (is_readable($sourcefile))
+00097 {
+00098 $fd = fopen($sourcefile, "r");
+00099 $contents = fread($fd, filesize($sourcefile));
+00100 $encoded = my_chunk_split(base64_encode($contents));
+00101 fclose($fd);
+00102 }
+00103 return $encoded;
+00104 }
+00105
+00106 function sendfile()
+00107 {
+00108 $headers .= $this->smtp_headers . $this->mime_headers;
+00109 $message = $this->text_body . $this->text_encoded;
+00110 return mail($this->addr_to,$this->subject,stripslashes($message),$headers);
+00111 }
+00112
+00113 function write_body($msgtext, $filename_list)
+00114 {
+00115 if (count($filename_list))
+00116 {
+00117 $out = "--" . $this->mime_boundary . "\n";
+00118 $out = $out . "Content-Type: text/plain; charset=\"iso8859-15\"\n\n";
+00119 // $out = $out . "Content-Type: text/plain; charset=\"us-ascii\"\n\n";
+00120 }
+00121 $out = $out . $msgtext . "\n";
+00122 return $out;
+00123 }
+00124
+00125 function write_mimeheaders($filename_list, $mimefilename_list) {
+00126 $out = "MIME-version: 1.0\n";
+00127 $out = $out . "Content-type: multipart/mixed; ";
+00128 $out = $out . "boundary=\"$this->mime_boundary\"\n";
+00129 $out = $out . "Content-transfer-encoding: 7BIT\n";
+00130 for($i = 0; $i < count($filename_list); $i++) {
+00131 if ($mimefilename_list[$i]) $filename_list[$i] = $mimefilename_list[$i];
+00132 $out = $out . "X-attachments: $filename_list[$i];\n\n";
+00133 }
+00134 return $out;
+00135 }
+00136
+00137 function write_smtpheaders($addr_from,$addr_cc)
+00138 {
+00139 $out = "From: $addr_from\n";
+00140 if($addr_cc != "")
+00141 $out = $out . "Cc: $addr_cc\n";
+00142 $out = $out . "Reply-To: $addr_from\n";
+00143 $out = $out . "X-Mailer: Dolibarr version " . DOL_VERSION ."\n";
+00144 $out = $out . "X-Sender: $addr_from\n";
+00145 return $out;
+00146 }
+00147 }
+00148
+00149 // usage - mimetype example "image/gif"
+00150 // $mailfile = new CMailFile($subject,$sendto,$replyto,$message,$filename,$mimetype);
+00151 // $mailfile->sendfile();
+00152
+00153 // Splits a string by RFC2045 semantics (76 chars per line, end with \r\n).
+00154 // This is not in all PHP versions so I define one here manuall.
+00155 function my_chunk_split($str)
+00156 {
+00157 $stmp = $str;
+00158 $len = strlen($stmp);
+00159 $out = "";
+00160 while ($len > 0) {
+00161 if ($len >= 76) {
+00162 $out = $out . substr($stmp, 0, 76) . "\r\n";
+00163 $stmp = substr($stmp, 76);
+00164 $len = $len - 76;
+00165 }
+00166 else {
+00167 $out = $out . $stmp . "\r\n";
+00168 $stmp = ""; $len = 0;
+00169 }
+00170 }
+00171 return $out;
+00172 }
+00173
+00174 // end script
+00175 ?>
+
Généré le Fri Jul 16 00:31:06 2004 pour dolibarr par
1.3.7
diff --git a/doc/dev/php/html/files.html b/doc/dev/php/html/files.html
index 8dcb03adef0..37126c8ec9a 100644
--- a/doc/dev/php/html/files.html
+++ b/doc/dev/php/html/files.html
@@ -6,15 +6,15 @@
dolibarr Liste des fichiers
Liste de tous les fichiers documentés avec une brève description:
-
-
- htdocs/lib/CMailFile.class.php [code]
+ htdocs/lib/functions.inc.php [code]
+ htdocs/lib/CMailFile.class.php [code] Classe permettant d'envoyer des attachements par mail htdocs/lib/functions.inc.php [code] Ensemble de fonctions de base de dolibarr sous forme d'include
- htdocs/lib/ldap.lib.php [code] Librairie contenant les fonctions pour accèder au serveur ldap
+ htdocs/lib/mysql.lib.php [code] Classes permettant de gérér la database de dolibarr htdocs/lib/mysql.lib.php [code] Classe permettant de gérér la database de dolibarr htdocs/lib/price.lib.php [code] Librairie contenant les fonctions pour calculer un prix htdocs/lib/thermometer.php [code] Classe permettant d'afficher un thermometre htdocs/lib/webcal.class.php [code] Classe permettant d'acceder a la database webcalendar
Généré le Thu Jul 15 20:50:37 2004 pour dolibarr par
+
Généré le Fri Jul 16 00:31:06 2004 pour dolibarr par
1.3.7
00001 <?PHP +htdocs/lib/functions.inc.php
Aller à la documentation de ce fichier.00001 <?PHP 00002 /* Copyright (C) 2000-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org> 00003 * Copyright (C) 2003 Jean-Louis Bergamo <jlb@j1b.org> 00004 * Copyright (C) 2004 Laurent Destailleur <eldy@users.sourceforge.net> @@ -30,1081 +30,1011 @@ 00023 * 00024 */ 00025 -00026 $yn[0] = "non"; -00027 $yn[1] = "oui"; -00028 -00029 Function dolibarr_syslog($message) -00030 { -00031 define_syslog_variables(); -00032 -00033 openlog("dolibarr", LOG_PID | LOG_PERROR, LOG_USER); # LOG_USER au lieu de LOG_LOCAL0 car non accepté par tous les PHP -00034 -00035 syslog(LOG_WARNING, $message); -00036 -00037 closelog(); -00038 } -00039 -00040 Function dolibarr_fiche_head($links, $active=0) -00041 { -00042 print "<!-- fiche --><div class=\"tabs\">\n"; -00043 -00044 for ($i = 0 ; $i < sizeof($links) ; $i++) -00045 { -00046 if ($links[$i][2] == 'image') -00047 { -00048 print '<a class="tabimage" href="'.$links[$i][0].'">'.$links[$i][1].'</a>'."\n"; -00049 } -00050 else -00051 { -00052 if ($i == $active) -00053 { -00054 print '<a id="active" class="tab" href="'.$links[$i][0].'">'.$links[$i][1].'</a>'."\n"; -00055 } -00056 else -00057 { -00058 print '<a class="tab" href="'.$links[$i][0].'">'.$links[$i][1].'</a>'."\n"; -00059 } -00060 } -00061 } -00062 -00063 print "</div>\n"; -00064 print "<div class=\"tabBar\">\n<br>\n"; -00065 } +00036 $yn[0] = "non"; +00037 $yn[1] = "oui"; +00038 +00044 function dolibarr_syslog($message) +00045 { +00046 define_syslog_variables(); +00047 +00048 openlog("dolibarr", LOG_PID | LOG_PERROR, LOG_USER); # LOG_USER au lieu de LOG_LOCAL0 car non accepté par tous les PHP +00049 +00050 syslog(LOG_WARNING, $message); +00051 +00052 closelog(); +00053 } +00054 +00063 function dolibarr_fiche_head($links, $active=0) +00064 { +00065 print "<!-- fiche --><div class=\"tabs\">\n"; 00066 -00067 -00068 Function dolibarr_set_const($db, $name, $value, $type='chaine', $visible=0, $note='') -00069 // Ajoute ou modifie un parametre dans la table llx_const -00070 // Retour: 0=KO, 1=OK -00071 { -00072 $sql = "REPLACE INTO llx_const SET name = '$name', value='$value', visible=$visible, type='$type', note='$note'"; -00073 -00074 if ($db->query($sql)) -00075 { -00076 return 1; -00077 } -00078 else -00079 { -00080 return 0; -00081 } -00082 } -00083 -00084 Function dolibarr_del_const($db, $name) -00085 // Supprime un parametre de la table llx_const -00086 // Retour: 0=KO, 1=OK -00087 { -00088 $sql = "DELETE FROM llx_const WHERE name='$name'"; -00089 -00090 if ($db->query($sql)) -00091 { -00092 return 1; -00093 } -00094 else -00095 { -00096 return 0; -00097 } -00098 } -00099 -00100 Function dolibarr_print_ca($ca) -00101 { -00102 // Permet d'avoir une fonction commune du formatage des nombres -00103 if ($ca > 1000) -00104 { -00105 $cat = round(($ca / 1000),2); -00106 $cat = "$cat Keuros"; -00107 } -00108 else -00109 { -00110 $cat = round($ca,2); -00111 $cat = "$cat euros"; -00112 } -00113 -00114 if ($ca > 1000000) -00115 { -00116 $cat = round(($ca / 1000000),2); -00117 $cat = "$cat Meuros"; -00118 } -00119 -00120 return $cat; -00121 } -00122 -00123 Function dolibarr_print_date($time,$format="%d %b %Y") -00124 { -00125 // Permet d'avoir une fonction commune du formatage d'affichage des date -00126 return strftime($format,$time); -00127 } -00128 -00129 Function dolibarr_print_object_info($object) -00130 { -00131 print "Créé par : " . $object->user_creation->fullname . '<br>'; -00132 print "Date de création : " . strftime("%A %d %B %Y %H:%M:%S",$object->date_creation) . '<br>'; -00133 print "Modifié par : " . $object->user_modification->fullname . '<br>'; -00134 print "Date de modification : " . strftime("%A %d %B %Y %H:%M:%S",$object->date_modification) . '<br>'; -00135 } -00136 -00137 Function dolibarr_print_phone($phone) -00138 { -00139 // Permet d'avoir une fonction commune du formatage d'affichage des tel/fax -00140 if (strlen(trim($phone)) == 10) -00141 { -00142 return substr($phone,0,2)." ".substr($phone,2,2)." ".substr($phone,4,2)." ".substr($phone,6,2)." ".substr($phone,8,2); -00143 } -00144 else -00145 { -00146 return $phone; -00147 } -00148 } -00149 -00150 Function img_file($alt = "Voir") -00151 { -00152 return '<img src="'.DOL_URL_ROOT.'/theme/'.MAIN_THEME.'/img/file.png" border="0" alt="'.$alt.'">'; -00153 } -00154 -00155 Function img_file_new($alt = "Voir") -00156 { -00157 return '<img src="'.DOL_URL_ROOT.'/theme/'.MAIN_THEME.'/img/filenew.png" border="0" alt="'.$alt.'">'; -00158 } -00159 -00160 -00161 Function img_pdf($alt = "Voir") -00162 { -00163 return '<img src="'.DOL_URL_ROOT.'/theme/'.MAIN_THEME.'/img/pdf.png" border="0" alt="'.$alt.'">'; +00067 for ($i = 0 ; $i < sizeof($links) ; $i++) +00068 { +00069 if ($links[$i][2] == 'image') +00070 { +00071 print '<a class="tabimage" href="'.$links[$i][0].'">'.$links[$i][1].'</a>'."\n"; +00072 } +00073 else +00074 { +00075 if ($i == $active) +00076 { +00077 print '<a id="active" class="tab" href="'.$links[$i][0].'">'.$links[$i][1].'</a>'."\n"; +00078 } +00079 else +00080 { +00081 print '<a class="tab" href="'.$links[$i][0].'">'.$links[$i][1].'</a>'."\n"; +00082 } +00083 } +00084 } +00085 +00086 print "</div>\n"; +00087 print "<div class=\"tabBar\">\n<br>\n"; +00088 } +00089 +00103 function dolibarr_set_const($db, $name, $value, $type='chaine', $visible=0, $note='') +00104 { +00105 $sql = "REPLACE INTO llx_const SET name = '$name', value='$value', visible=$visible, type='$type', note='$note'"; +00106 +00107 if ($db->query($sql)) +00108 { +00109 return 1; +00110 } +00111 else +00112 { +00113 return 0; +00114 } +00115 } +00116 +00124 function dolibarr_del_const($db, $name) +00125 { +00126 $sql = "DELETE FROM llx_const WHERE name='$name'"; +00127 +00128 if ($db->query($sql)) +00129 { +00130 return 1; +00131 } +00132 else +00133 { +00134 return 0; +00135 } +00136 } +00137 +00144 function dolibarr_print_ca($ca) +00145 { +00146 if ($ca > 1000) +00147 { +00148 $cat = round(($ca / 1000),2); +00149 $cat = "$cat Keuros"; +00150 } +00151 else +00152 { +00153 $cat = round($ca,2); +00154 $cat = "$cat euros"; +00155 } +00156 +00157 if ($ca > 1000000) +00158 { +00159 $cat = round(($ca / 1000000),2); +00160 $cat = "$cat Meuros"; +00161 } +00162 +00163 return $cat; 00164 } 00165 -00166 Function img_warning($alt = "Voir") -00167 { -00168 return '<img src="'.DOL_URL_ROOT.'/theme/'.MAIN_THEME.'/img/warning.png" border="0" alt="'.$alt.'">'; -00169 } -00170 -00171 Function img_delete($alt = "Supprimer") -00172 { -00173 return '<img src="'.DOL_URL_ROOT.'/theme/'.MAIN_THEME.'/img/delete.png" border="0" alt="'.$alt.'" title="Supprimer">'; -00174 } -00175 -00176 Function img_info($alt = "Informations") -00177 { -00178 return '<img src="'.DOL_URL_ROOT.'/theme/'.MAIN_THEME.'/img/info.png" border="0" alt="'.$alt.'" title="Informations">'; -00179 } -00180 -00181 -00182 Function img_edit($alt = "Modifier") -00183 { -00184 return '<img src="'.DOL_URL_ROOT.'/theme/'.MAIN_THEME.'/img/edit.png" border="0" alt="'.$alt.'" title="Modifier">'; -00185 } -00186 -00187 Function img_phone_in($alt = "Modifier") -00188 { -00189 return '<img src="'.DOL_URL_ROOT.'/theme/'.MAIN_THEME.'/img/call.png" border="0" alt="'.$alt.'" title="'.$alt.'">'; +00173 function dolibarr_print_date($time,$format="%d %b %Y") +00174 { +00175 return strftime($format,$time); +00176 } +00177 +00178 +00184 function dolibarr_print_object_info($object) +00185 { +00186 print "Créé par : " . $object->user_creation->fullname . '<br>'; +00187 print "Date de création : " . strftime("%A %d %B %Y %H:%M:%S",$object->date_creation) . '<br>'; +00188 print "Modifié par : " . $object->user_modification->fullname . '<br>'; +00189 print "Date de modification : " . strftime("%A %d %B %Y %H:%M:%S",$object->date_modification) . '<br>'; 00190 } 00191 -00192 Function img_phone_out($alt = "Modifier") -00193 { -00194 return '<img src="'.DOL_URL_ROOT.'/theme/'.MAIN_THEME.'/img/call_out.png" border="0" alt="'.$alt.'" title="'.$alt.'">'; -00195 } -00196 -00197 -00198 Function img_alerte($alt = "Alerte") -00199 { -00200 return '<img src="'.DOL_URL_ROOT.'/theme/'.MAIN_THEME.'/img/alerte.png" border="0" alt="'.$alt.'" title="'.$alt.'">'; -00201 } -00202 -00203 -00204 Function img_next($alt = "Suivant") -00205 { -00206 return '<img src="'.DOL_URL_ROOT.'/theme/'.MAIN_THEME.'/img/next.png" border="0" alt="'.$alt.'" title="'.$alt.'">'; -00207 } -00208 -00209 Function img_previous($alt = "Précédent") -00210 { -00211 return '<img src="'.DOL_URL_ROOT.'/theme/'.MAIN_THEME.'/img/previous.png" border="0" alt="'.$alt.'" title="'.$alt.'">'; -00212 } -00213 -00214 -00215 function loginFunction() -00216 { -00220 print '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">'; -00221 print "\n<html><head><title>Dolibarr Authentification</title>"; -00222 print '<style type="text/css"> -00223 body { -00224 font-size:14px; -00225 font-family: Verdana, Tahoma, Arial, Helvetica, sans-serif; -00226 background-color: #cac8c0; -00227 margin-left: 30%; -00228 margin-right: 30%; -00229 margin-top: 10%; -00230 margin-bottom: 1%; -00231 } -00232 div.main { -00233 background-color: white; -00234 text-align: left; -00235 border: solid black 1px; -00236 } -00237 div.main-inside { -00238 background-color: white; -00239 padding-left: 20px; -00240 padding-right: 50px; -00241 text-align: center; -00242 margin-bottom: 50px; -00243 margin-top: 30px; -00244 } -00245 div.footer { -00246 background-color: #dcdff4; -00247 font-size: 10px; -00248 border-top: solid black 1px; -00249 padding-left: 5px; -00250 text-align: center; -00251 } -00252 div.header { -00253 background-color: #dcdff4; -00254 border-bottom: solid black 1px; -00255 padding-left: 5px; -00256 text-align: center; -00257 } -00258 div.footer p { -00259 margin: 0px; -00260 } -00261 a:link,a:visited,a:active { -00262 text-decoration:none; -00263 color:blue; -00264 } -00265 a:hover { -00266 text-decoration:underline; -00267 color:blue; -00268 } -00269 </style> -00270 <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-15"> -00271 <script language="javascript"> -00272 function donnefocus(){ -00273 document.identification.username.focus(); -00274 } -00275 </script> -00276 </head> -00277 <body onload="donnefocus();"> -00278 <div class="main"> -00279 <div class="header">'; -00280 print 'Dolibarr '.DOL_VERSION; -00281 print ' -00282 </div> -00283 <div class="main-inside"> -00284 '; -00285 -00286 echo '<form method="post" action="' . $_SERVER['PHP_SELF'] . '" name="identification">'; -00287 print '<table><tr>'; -00288 print '<td>Login : </td><td><input type="text" name="username"></td></tr>';; -00289 print '<tr><td>Password : </td><td><input type="password" name="password"></td></tr>'; -00290 -00291 echo '</table> -00292 <p align="center"><input value="Login" type="submit"> -00293 </form>'; -00294 } -00295 /* -00296 * -00297 * -00298 */ -00299 function accessforbidden() -00300 { -00301 llxHeader(); -00302 print "Accés interdit"; -00303 llxFooter(); -00304 exit(0); -00305 } -00306 -00307 function doliMoveFileUpload($src_file, $dest_file) -00308 { -00309 $file_name = $dest_file; -00310 -00311 if (substr($file_name, strlen($file_name) -3 , 3) == 'php') -00312 { -00313 $file_name = $dest_file . ".txt"; -00314 } -00315 -00316 return move_uploaded_file($src_file, $file_name); -00317 } -00318 -00319 function dolibarr_user_page_param($db, &$user) -00320 { -00321 foreach ($GLOBALS["_GET"] as $key=>$value) -00322 { -00323 if ($key == "sortfield") -00324 { -00325 $sql = "REPLACE INTO ".MAIN_DB_PREFIX."user_param "; -00326 $sql .= " SET fk_user =".$user->id; -00327 $sql .= " ,page='".$GLOBALS["SCRIPT_URL"] . "'"; -00328 $sql .= " ,param='sortfield'"; -00329 $sql .= " ,value='".urlencode($value)."'"; -00330 -00331 $db->query($sql); -00332 $user->page_param["sortfield"] = $value; -00333 } -00334 -00335 // print $key . "=".$value . "<br>"; -00336 -00337 if ($key == "sortorder") -00338 { -00339 $sql = "REPLACE INTO ".MAIN_DB_PREFIX."user_param "; -00340 $sql .= " SET fk_user =".$user->id; -00341 $sql .= " ,page='".$GLOBALS["SCRIPT_URL"] . "'"; -00342 $sql .= " ,param='sortorder'"; -00343 $sql .= " ,value='".urlencode($value)."'"; -00344 -00345 $db->query($sql); -00346 $user->page_param["sortorder"] = $value; -00347 } -00348 if ($key == "begin") -00349 { -00350 $sql = "REPLACE INTO ".MAIN_DB_PREFIX."user_param "; -00351 $sql .= " SET fk_user =".$user->id; -00352 $sql .= " ,page='".$GLOBALS["SCRIPT_URL"] . "'"; -00353 $sql .= " ,param='begin'"; -00354 $sql .= " ,value='".$value."'"; -00355 -00356 $db->query($sql); -00357 $user->page_param["begin"] = $value; -00358 } -00359 if ($key == "page") -00360 { -00361 $sql = "REPLACE INTO ".MAIN_DB_PREFIX."user_param "; -00362 $sql .= " SET fk_user =".$user->id; -00363 $sql .= " ,page='".$GLOBALS["SCRIPT_URL"] . "'"; -00364 $sql .= " ,param='page'"; -00365 $sql .= " ,value='".$value."'"; -00366 -00367 $db->query($sql); -00368 $user->page_param["page"] = $value; -00369 } -00370 } -00371 } -00372 -00373 function transcoS2L($zonein,$devise) -00374 { -00375 // Open source offert par <A HREF="mailto:alainfloch@free.fr?subject=chif2let">alainfloch@free.fr</A> 28/10/2001, sans garantie. -00376 // début de la fonction de transcodification de somme en toutes lettres -00377 -00378 /* $zonein = "123,56"; -00379 * $devise = "E"; // préciser F si francs , sinon ce sera de l'euro -00380 * $r = transcoS2L($zonein,$devise); // appeler la fonction -00381 * echo "résultat vaut $r<br>"; -00382 * $zonelettresM = strtoupper($r); // si vous voulez la même zone mais tout en majuscules -00383 * echo "résultat en Majuscules vaut $zonelettresM<br>"; -00384 * $zonein = "1,01"; -00385 * $r = transcoS2L($zonein,$devise); -00386 * echo "résultat vaut $r<br>"; -00387 */ +00199 function dolibarr_print_phone($phone) +00200 { +00201 if (strlen(trim($phone)) == 10) +00202 { +00203 return substr($phone,0,2)." ".substr($phone,2,2)." ".substr($phone,4,2)." ".substr($phone,6,2)." ".substr($phone,8,2); +00204 } +00205 else +00206 { +00207 return $phone; +00208 } +00209 } +00210 +00211 function img_file($alt = "Voir") +00212 { +00213 return '<img src="'.DOL_URL_ROOT.'/theme/'.MAIN_THEME.'/img/file.png" border="0" alt="'.$alt.'">'; +00214 } +00215 +00216 function img_file_new($alt = "Voir") +00217 { +00218 return '<img src="'.DOL_URL_ROOT.'/theme/'.MAIN_THEME.'/img/filenew.png" border="0" alt="'.$alt.'">'; +00219 } +00220 +00221 +00222 function img_pdf($alt = "Voir") +00223 { +00224 return '<img src="'.DOL_URL_ROOT.'/theme/'.MAIN_THEME.'/img/pdf.png" border="0" alt="'.$alt.'">'; +00225 } +00226 +00227 function img_warning($alt = "Voir") +00228 { +00229 return '<img src="'.DOL_URL_ROOT.'/theme/'.MAIN_THEME.'/img/warning.png" border="0" alt="'.$alt.'">'; +00230 } +00231 +00232 function img_delete($alt = "Supprimer") +00233 { +00234 return '<img src="'.DOL_URL_ROOT.'/theme/'.MAIN_THEME.'/img/delete.png" border="0" alt="'.$alt.'" title="Supprimer">'; +00235 } +00236 +00237 function img_info($alt = "Informations") +00238 { +00239 return '<img src="'.DOL_URL_ROOT.'/theme/'.MAIN_THEME.'/img/info.png" border="0" alt="'.$alt.'" title="Informations">'; +00240 } +00241 +00242 +00243 function img_edit($alt = "Modifier") +00244 { +00245 return '<img src="'.DOL_URL_ROOT.'/theme/'.MAIN_THEME.'/img/edit.png" border="0" alt="'.$alt.'" title="Modifier">'; +00246 } +00247 +00248 function img_phone_in($alt = "Modifier") +00249 { +00250 return '<img src="'.DOL_URL_ROOT.'/theme/'.MAIN_THEME.'/img/call.png" border="0" alt="'.$alt.'" title="'.$alt.'">'; +00251 } +00252 +00253 function img_phone_out($alt = "Modifier") +00254 { +00255 return '<img src="'.DOL_URL_ROOT.'/theme/'.MAIN_THEME.'/img/call_out.png" border="0" alt="'.$alt.'" title="'.$alt.'">'; +00256 } +00257 +00258 +00259 function img_alerte($alt = "Alerte") +00260 { +00261 return '<img src="'.DOL_URL_ROOT.'/theme/'.MAIN_THEME.'/img/alerte.png" border="0" alt="'.$alt.'" title="'.$alt.'">'; +00262 } +00263 +00264 +00265 function img_next($alt = "Suivant") +00266 { +00267 return '<img src="'.DOL_URL_ROOT.'/theme/'.MAIN_THEME.'/img/next.png" border="0" alt="'.$alt.'" title="'.$alt.'">'; +00268 } +00269 +00270 function img_previous($alt = "Précédent") +00271 { +00272 return '<img src="'.DOL_URL_ROOT.'/theme/'.MAIN_THEME.'/img/previous.png" border="0" alt="'.$alt.'" title="'.$alt.'">'; +00273 } +00274 +00281 function loginfunction() +00282 { +00283 print '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">'; +00284 print "\n<html><head><title>Dolibarr Authentification</title>"; +00285 print '<style type="text/css"> +00286 body { +00287 font-size:14px; +00288 font-family: Verdana, Tahoma, Arial, Helvetica, sans-serif; +00289 background-color: #cac8c0; +00290 margin-left: 30%; +00291 margin-right: 30%; +00292 margin-top: 10%; +00293 margin-bottom: 1%; +00294 } +00295 div.main { +00296 background-color: white; +00297 text-align: left; +00298 border: solid black 1px; +00299 } +00300 div.main-inside { +00301 background-color: white; +00302 padding-left: 20px; +00303 padding-right: 50px; +00304 text-align: center; +00305 margin-bottom: 50px; +00306 margin-top: 30px; +00307 } +00308 div.footer { +00309 background-color: #dcdff4; +00310 font-size: 10px; +00311 border-top: solid black 1px; +00312 padding-left: 5px; +00313 text-align: center; +00314 } +00315 div.header { +00316 background-color: #dcdff4; +00317 border-bottom: solid black 1px; +00318 padding-left: 5px; +00319 text-align: center; +00320 } +00321 div.footer p { +00322 margin: 0px; +00323 } +00324 a:link,a:visited,a:active { +00325 text-decoration:none; +00326 color:blue; +00327 } +00328 a:hover { +00329 text-decoration:underline; +00330 color:blue; +00331 } +00332 </style> +00333 <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-15"> +00334 <script language="javascript"> +00335 function donnefocus(){ +00336 document.identification.username.focus(); +00337 } +00338 </script> +00339 </head> +00340 <body onload="donnefocus();"> +00341 <div class="main"> +00342 <div class="header">'; +00343 print 'Dolibarr '.DOL_VERSION; +00344 print ' +00345 </div> +00346 <div class="main-inside"> +00347 '; +00348 +00349 echo '<form method="post" action="' . $_SERVER['PHP_SELF'] . '" name="identification">'; +00350 print '<table><tr>'; +00351 print '<td>Login : </td><td><input type="text" name="username"></td></tr>';; +00352 print '<tr><td>Password : </td><td><input type="password" name="password"></td></tr>'; +00353 +00354 echo '</table> +00355 <p align="center"><input value="Login" type="submit"> +00356 </form>'; +00357 } +00358 +00363 function accessforbidden() +00364 { +00365 llxHeader(); +00366 print "Accés interdit"; +00367 llxFooter(); +00368 exit(0); +00369 } +00370 +00377 function doliMoveFileUpload($src_file, $dest_file) +00378 { +00379 $file_name = $dest_file; +00380 +00381 if (substr($file_name, strlen($file_name) -3 , 3) == 'php') +00382 { +00383 $file_name = $dest_file . ".txt"; +00384 } +00385 +00386 return move_uploaded_file($src_file, $file_name); +00387 } 00388 00389 -00390 if ($devise == "F") -00391 { -00392 $unite_singulier = " franc "; -00393 $unite_pluriel = " francs "; -00394 $cent_singulier = " centime"; -00395 } -00396 else -00397 { -00398 $unite_singulier = " euro "; -00399 $unite_pluriel = " euros "; -00400 $cent_singulier = " centime"; -00401 } -00402 -00403 $arr1_99 = array("zéro","un","deux","trois", -00404 "quatre","cinq","six","sept", -00405 "huit","neuf","dix","onze","douze", -00406 "treize","quatorze","quinze","seize", -00407 "dix-sept","dix-huit","dix-neuf","vingt "); -00408 -00409 $arr1_99[30] = "trente "; -00410 $arr1_99[40] = "quarante "; -00411 $arr1_99[50] = "cinquante "; -00412 $arr1_99[60] = "soixante "; -00413 $arr1_99[70] = "soixante-dix "; -00414 $arr1_99[71] = "soixante et onze"; -00415 $arr1_99[80] = "quatre-vingts "; -00416 $i = 22; -00417 while ($i < 63) {// initialise la table -00418 $arr1_99[$i - 1] = $arr1_99[$i - 2]." et un"; -00419 $j = 0; -00420 while ($j < 8) { -00421 $k = $i + $j; -00422 $arr1_99[$k] = $arr1_99[$i - 2].$arr1_99[$j + 2]; -00423 $j++; -00424 } -00425 $i = $i + 10; -00426 } // fin initialise la table -00427 -00428 $i = 12; -00429 while ($i < 20) {// initialise la table (suite) -00430 $j = 60 + $i; -00431 $arr1_99[$j] = "soixante-".$arr1_99[$i]; -00432 $i++; -00433 } // fin initialise la table (suite) -00434 -00435 $i = 1; -00436 while ($i < 20) {// initialise la table (fin) -00437 $j = 80 + $i; -00438 $arr1_99[$j] = "quatre-vingt-".$arr1_99[$i]; -00439 $i++; -00440 } // fin initialise la table (fin) -00441 // echo "Pour une valeur en entrée = $zonein<br>"; //pour ceux qui ne croient que ce qu'ils voient ! -00442 // quelques petits controles s'imposent !! -00443 $valid = "[a-zA-Z\&\é\"\'\(\-\è\_\ç\à\)\=\;\:\!\*\$\^<>]"; -00444 if (ereg($valid,$zonein)) -00445 { -00446 $r = "<b>la chaîne ".$zonein." n'est pas valide</b>"; -00447 return($r); -00448 } -00449 $zone = explode(" ",$zonein); // supprimer les blancs séparateurs -00450 $zonein = implode("",$zone); // reconcatène la zone input -00451 $zone = explode(".",$zonein); // supprimer les points séparateurs -00452 $zonein = implode("",$zone); // reconcatène la zone input, ça c'est fort ! merci PHP -00453 $virg = strpos($zonein,",",1); // à la poursuite de la virgule -00454 $i = strlen($zonein); // et de la longueur de la zone input -00455 if ($virg == 0) { // ya pas de virgule -00456 if ($i > 7) -00457 { -00458 $r = "<b>la chaîne ".$zonein." est trop longue (maxi = 9 millions)</b>"; -00459 return($r); -00460 } -00461 $deb = 7 - $i; -00462 $zoneanaly = substr($zonechiffres,0,$deb).$zonein.",00"; -00463 } -00464 else -00465 { //ya une virgule -00466 $ti = explode(",",$zonein); // mettre de côté ce qu'il y a devant la virgule -00467 $i = strlen($ti[0]); // en controler la longueur -00468 $zonechiffres = "0000000,00"; -00469 if ($i > 7) -00470 { -00471 $r = "<b>la chaîne ".$zonein." est trop longue (maxi = 9 millions,00)</b>"; -00472 return($r); -00473 } -00474 $deb = 7 - $i; -00475 $zoneanaly = substr($zonechiffres,0,$deb).$zonein; -00476 } -00477 $M= substr($zoneanaly,0,1); -00478 if ($M != 0) -00479 { // qui veut gagner des millions -00480 $r = $arr1_99[$M]." million"; -00481 if ($M ==1) $r = $r." "; -00482 else $r = $r."s "; -00483 if (substr($zoneanaly,1,6)==0) -00484 { -00485 if ($devise == 'F') $r = $r." de "; -00486 else $r = $r."d'"; -00487 } -00488 } -00489 $CM= substr($zoneanaly,1,1); -00490 if ($CM == 1) -00491 { // qui veut gagner des centaines de mille -00492 $r = $r." cent "; -00493 } -00494 else -00495 { // ya des centaines de mille -00496 if ($CM > 1) -00497 { -00498 $r = $r. $arr1_99[$CM]." cent "; -00499 } -00500 } // fin du else ya des centaines de mille -00501 $MM= substr($zoneanaly,2,2); -00502 if (substr($zoneanaly,2,1)==0){ $MM = substr($zoneanaly,3,1);} // enlever le zéro des milliers cause indexation -00503 if ($MM ==0 && $CM > 0) -00504 { -00505 $r = $r."mille "; -00506 } -00507 if ($MM != 0) -00508 { -00509 if ($MM == 80) -00510 { -00511 $r = $r."quatre-vingt mille "; -00512 } -00513 else -00514 { -00515 if ($MM > 1 ) -00516 { -00517 $r = $r.$arr1_99[$MM]." mille "; -00518 } -00519 else -00520 { -00521 if ($CM == 0) $r = $r." mille "; -00522 else +00390 function dolibarr_user_page_param($db, &$user) +00391 { +00392 foreach ($GLOBALS["_GET"] as $key=>$value) +00393 { +00394 if ($key == "sortfield") +00395 { +00396 $sql = "REPLACE INTO ".MAIN_DB_PREFIX."user_param "; +00397 $sql .= " SET fk_user =".$user->id; +00398 $sql .= " ,page='".$GLOBALS["SCRIPT_URL"] . "'"; +00399 $sql .= " ,param='sortfield'"; +00400 $sql .= " ,value='".urlencode($value)."'"; +00401 +00402 $db->query($sql); +00403 $user->page_param["sortfield"] = $value; +00404 } +00405 +00406 // print $key . "=".$value . "<br>"; +00407 +00408 if ($key == "sortorder") +00409 { +00410 $sql = "REPLACE INTO ".MAIN_DB_PREFIX."user_param "; +00411 $sql .= " SET fk_user =".$user->id; +00412 $sql .= " ,page='".$GLOBALS["SCRIPT_URL"] . "'"; +00413 $sql .= " ,param='sortorder'"; +00414 $sql .= " ,value='".urlencode($value)."'"; +00415 +00416 $db->query($sql); +00417 $user->page_param["sortorder"] = $value; +00418 } +00419 if ($key == "begin") +00420 { +00421 $sql = "REPLACE INTO ".MAIN_DB_PREFIX."user_param "; +00422 $sql .= " SET fk_user =".$user->id; +00423 $sql .= " ,page='".$GLOBALS["SCRIPT_URL"] . "'"; +00424 $sql .= " ,param='begin'"; +00425 $sql .= " ,value='".$value."'"; +00426 +00427 $db->query($sql); +00428 $user->page_param["begin"] = $value; +00429 } +00430 if ($key == "page") +00431 { +00432 $sql = "REPLACE INTO ".MAIN_DB_PREFIX."user_param "; +00433 $sql .= " SET fk_user =".$user->id; +00434 $sql .= " ,page='".$GLOBALS["SCRIPT_URL"] . "'"; +00435 $sql .= " ,param='page'"; +00436 $sql .= " ,value='".$value."'"; +00437 +00438 $db->query($sql); +00439 $user->page_param["page"] = $value; +00440 } +00441 } +00442 } +00443 +00451 function transcoS2L($zonein,$devise) +00452 { +00453 // Open source offert par <A HREF="mailto:alainfloch@free.fr?subject=chif2let">alainfloch@free.fr</A> 28/10/2001, sans garantie. +00454 // début de la fonction de transcodification de somme en toutes lettres +00455 +00456 /* $zonein = "123,56"; +00457 * $devise = "E"; // préciser F si francs , sinon ce sera de l'euro +00458 * $r = transcoS2L($zonein,$devise); // appeler la fonction +00459 * echo "résultat vaut $r<br>"; +00460 * $zonelettresM = strtoupper($r); // si vous voulez la même zone mais tout en majuscules +00461 * echo "résultat en Majuscules vaut $zonelettresM<br>"; +00462 * $zonein = "1,01"; +00463 * $r = transcoS2L($zonein,$devise); +00464 * echo "résultat vaut $r<br>"; +00465 */ +00466 +00467 +00468 if ($devise == "F") +00469 { +00470 $unite_singulier = " franc "; +00471 $unite_pluriel = " francs "; +00472 $cent_singulier = " centime"; +00473 } +00474 else +00475 { +00476 $unite_singulier = " euro "; +00477 $unite_pluriel = " euros "; +00478 $cent_singulier = " centime"; +00479 } +00480 +00481 $arr1_99 = array("zéro","un","deux","trois", +00482 "quatre","cinq","six","sept", +00483 "huit","neuf","dix","onze","douze", +00484 "treize","quatorze","quinze","seize", +00485 "dix-sept","dix-huit","dix-neuf","vingt "); +00486 +00487 $arr1_99[30] = "trente "; +00488 $arr1_99[40] = "quarante "; +00489 $arr1_99[50] = "cinquante "; +00490 $arr1_99[60] = "soixante "; +00491 $arr1_99[70] = "soixante-dix "; +00492 $arr1_99[71] = "soixante et onze"; +00493 $arr1_99[80] = "quatre-vingts "; +00494 $i = 22; +00495 while ($i < 63) {// initialise la table +00496 $arr1_99[$i - 1] = $arr1_99[$i - 2]." et un"; +00497 $j = 0; +00498 while ($j < 8) { +00499 $k = $i + $j; +00500 $arr1_99[$k] = $arr1_99[$i - 2].$arr1_99[$j + 2]; +00501 $j++; +00502 } +00503 $i = $i + 10; +00504 } // fin initialise la table +00505 +00506 $i = 12; +00507 while ($i < 20) {// initialise la table (suite) +00508 $j = 60 + $i; +00509 $arr1_99[$j] = "soixante-".$arr1_99[$i]; +00510 $i++; +00511 } // fin initialise la table (suite) +00512 +00513 $i = 1; +00514 while ($i < 20) {// initialise la table (fin) +00515 $j = 80 + $i; +00516 $arr1_99[$j] = "quatre-vingt-".$arr1_99[$i]; +00517 $i++; +00518 } // fin initialise la table (fin) +00519 // echo "Pour une valeur en entrée = $zonein<br>"; //pour ceux qui ne croient que ce qu'ils voient ! +00520 // quelques petits controles s'imposent !! +00521 $valid = "[a-zA-Z\&\é\"\'\(\-\è\_\ç\à\)\=\;\:\!\*\$\^<>]"; +00522 if (ereg($valid,$zonein)) 00523 { -00524 $r = $r.$arr1_99[$MM]." mille "; -00525 } -00526 } -00527 } -00528 } -00529 $C2= substr($zoneanaly,5,2); -00530 if (substr($zoneanaly,5,1)==0){ $C2 = substr($zoneanaly,6,1);} // enlever le zéro des centaines cause indexation -00531 $C1= substr($zoneanaly,4,1); -00532 if ($C2 ==0 && $C1 > 1) -00533 { -00534 $r = $r.$arr1_99[$C1]." cents "; -00535 } -00536 else -00537 { -00538 if ($C1 == 1) $r = $r." cent "; -00539 else -00540 { -00541 if ($C1 > 1) $r = $r.$arr1_99[$C1]." cent "; -00542 } -00543 } -00544 if ($C2 != 0) -00545 { -00546 $r = $r.$arr1_99[$C2]; -00547 } -00548 if ($virg !=0) -00549 { -00550 if ($ti[0] > 1) $r = $r. $unite_pluriel; else $r = "un ".$unite_singulier; -00551 } -00552 else -00553 { -00554 if ($zonein > 1) $r = $r.$unite_pluriel; else $r = "un ".$unite_singulier; -00555 } -00556 $UN= substr($zoneanaly,8,2); -00557 if ($UN != "00") -00558 { -00559 $cts = $UN; -00560 if (substr($UN,0,1)==0){ $cts = substr($UN,1,1);} // enlever le zéro des centimes cause indexation -00561 $r = $r." et ". $arr1_99[$cts].$cent_singulier; -00562 if ($UN > 1) $r =$r."s"; // accorde au pluriel -00563 } -00564 $r1 = ltrim($r); // enleve quelques blancs possibles en début de zone -00565 $r = ucfirst($r1); // met le 1er caractère en Majuscule, c'est + zoli -00566 return($r); // retourne le résultat -00567 } // fin fonction transcoS2L -00568 -00569 -00570 -00571 function print_liste_field_titre($name, $file, $field, $begin="", $options="") -00572 { -00573 global $conf; -00574 -00575 print $name." "; -00576 print '<a href="'.$file.'?sortfield='.$field.'&sortorder=asc&begin='.$begin.$options.'">'; -00577 print '<img src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/1downarrow.png" border="0" alt="A-Z"></a>'; -00578 print '<a href="'.$file.'?sortfield='.$field.'&sortorder=desc&begin='.$begin.$options.'">'; -00579 print '<img src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/1uparrow.png" border="0" alt="Z-A"></a>'; -00580 } -00581 -00582 function print_liste_field_titre_new($name, $file, $field, $begin="", $options="", $td="", $sortfield="") -00583 { -00584 /* -00585 * idem à la fonction ci dessus mais ajoute des fonctionnalités -00586 * -00587 * -00588 */ -00589 global $conf; -00590 if ($sortfield == $field) -00591 { -00592 print '<td class="menusel" '. $td.'>'; -00593 } -00594 else -00595 { -00596 print '<td '. $td.'>'; -00597 } -00598 print $name." "; -00599 print '<a href="'.$file.'?sortfield='.$field.'&sortorder=asc&begin='.$begin.$options.'">'; -00600 print '<img src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/1downarrow.png" border="0" alt="A-Z"></a>'; -00601 print '<a href="'.$file.'?sortfield='.$field.'&sortorder=desc&begin='.$begin.$options.'">'; -00602 print '<img src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/1uparrow.png" border="0" alt="Z-A"></a>'; -00603 print "</td>"; -00604 } -00605 -00606 /* -00607 * -00608 */ -00609 function print_titre($titre) -00610 { -00611 print '<div class="titre">'.$titre.'</div>'; -00612 } -00613 /* -00614 * Idem que print_titre mais offre en plus possibilité de mettre un text à droite -00615 */ -00616 function print_fiche_titre($titre, $mesg='') -00617 { -00618 print "\n".'<table width="100%" border="0" cellpadding="3" cellspacing="0">'; -00619 print '<tr><td><div class="titre" valign="middle">'.$titre.'</div></td>'; -00620 if (strlen($mesg)) -00621 { -00622 print '<td align="right" valign="middle"><b>'.$mesg.'</b></td>'; -00623 } -00624 print '</tr></table>'."\n"; -00625 } -00626 -00627 /* -00628 * -00629 * -00630 */ -00631 function dol_delete_file($file) -00632 { -00633 return unlink($file); -00634 } -00635 -00636 /* -00637 * -00638 * -00639 */ -00640 function block_access() -00641 { -00642 llxHeader(); -00643 print "Accés refusé"; -00644 llxFooter(); -00645 } +00524 $r = "<b>la chaîne ".$zonein." n'est pas valide</b>"; +00525 return($r); +00526 } +00527 $zone = explode(" ",$zonein); // supprimer les blancs séparateurs +00528 $zonein = implode("",$zone); // reconcatène la zone input +00529 $zone = explode(".",$zonein); // supprimer les points séparateurs +00530 $zonein = implode("",$zone); // reconcatène la zone input, ça c'est fort ! merci PHP +00531 $virg = strpos($zonein,",",1); // à la poursuite de la virgule +00532 $i = strlen($zonein); // et de la longueur de la zone input +00533 if ($virg == 0) { // ya pas de virgule +00534 if ($i > 7) +00535 { +00536 $r = "<b>la chaîne ".$zonein." est trop longue (maxi = 9 millions)</b>"; +00537 return($r); +00538 } +00539 $deb = 7 - $i; +00540 $zoneanaly = substr($zonechiffres,0,$deb).$zonein.",00"; +00541 } +00542 else +00543 { //ya une virgule +00544 $ti = explode(",",$zonein); // mettre de côté ce qu'il y a devant la virgule +00545 $i = strlen($ti[0]); // en controler la longueur +00546 $zonechiffres = "0000000,00"; +00547 if ($i > 7) +00548 { +00549 $r = "<b>la chaîne ".$zonein." est trop longue (maxi = 9 millions,00)</b>"; +00550 return($r); +00551 } +00552 $deb = 7 - $i; +00553 $zoneanaly = substr($zonechiffres,0,$deb).$zonein; +00554 } +00555 $M= substr($zoneanaly,0,1); +00556 if ($M != 0) +00557 { // qui veut gagner des millions +00558 $r = $arr1_99[$M]." million"; +00559 if ($M ==1) $r = $r." "; +00560 else $r = $r."s "; +00561 if (substr($zoneanaly,1,6)==0) +00562 { +00563 if ($devise == 'F') $r = $r." de "; +00564 else $r = $r."d'"; +00565 } +00566 } +00567 $CM= substr($zoneanaly,1,1); +00568 if ($CM == 1) +00569 { // qui veut gagner des centaines de mille +00570 $r = $r." cent "; +00571 } +00572 else +00573 { // ya des centaines de mille +00574 if ($CM > 1) +00575 { +00576 $r = $r. $arr1_99[$CM]." cent "; +00577 } +00578 } // fin du else ya des centaines de mille +00579 $MM= substr($zoneanaly,2,2); +00580 if (substr($zoneanaly,2,1)==0){ $MM = substr($zoneanaly,3,1);} // enlever le zéro des milliers cause indexation +00581 if ($MM ==0 && $CM > 0) +00582 { +00583 $r = $r."mille "; +00584 } +00585 if ($MM != 0) +00586 { +00587 if ($MM == 80) +00588 { +00589 $r = $r."quatre-vingt mille "; +00590 } +00591 else +00592 { +00593 if ($MM > 1 ) +00594 { +00595 $r = $r.$arr1_99[$MM]." mille "; +00596 } +00597 else +00598 { +00599 if ($CM == 0) $r = $r." mille "; +00600 else +00601 { +00602 $r = $r.$arr1_99[$MM]." mille "; +00603 } +00604 } +00605 } +00606 } +00607 $C2= substr($zoneanaly,5,2); +00608 if (substr($zoneanaly,5,1)==0){ $C2 = substr($zoneanaly,6,1);} // enlever le zéro des centaines cause indexation +00609 $C1= substr($zoneanaly,4,1); +00610 if ($C2 ==0 && $C1 > 1) +00611 { +00612 $r = $r.$arr1_99[$C1]." cents "; +00613 } +00614 else +00615 { +00616 if ($C1 == 1) $r = $r." cent "; +00617 else +00618 { +00619 if ($C1 > 1) $r = $r.$arr1_99[$C1]." cent "; +00620 } +00621 } +00622 if ($C2 != 0) +00623 { +00624 $r = $r.$arr1_99[$C2]; +00625 } +00626 if ($virg !=0) +00627 { +00628 if ($ti[0] > 1) $r = $r. $unite_pluriel; else $r = "un ".$unite_singulier; +00629 } +00630 else +00631 { +00632 if ($zonein > 1) $r = $r.$unite_pluriel; else $r = "un ".$unite_singulier; +00633 } +00634 $UN= substr($zoneanaly,8,2); +00635 if ($UN != "00") +00636 { +00637 $cts = $UN; +00638 if (substr($UN,0,1)==0){ $cts = substr($UN,1,1);} // enlever le zéro des centimes cause indexation +00639 $r = $r." et ". $arr1_99[$cts].$cent_singulier; +00640 if ($UN > 1) $r =$r."s"; // accorde au pluriel +00641 } +00642 $r1 = ltrim($r); // enleve quelques blancs possibles en début de zone +00643 $r = ucfirst($r1); // met le 1er caractère en Majuscule, c'est + zoli +00644 return($r); // retourne le résultat +00645 } // fin fonction transcoS2L 00646 -00647 /* -00648 * -00649 * -00650 */ -00651 -00652 function print_barre_liste($titre, $page, $file, $options='', $sortfield='', $sortorder='', $form='', $num=-1) -00653 { -00654 global $conf; -00655 -00656 if ($num > $conf->liste_limit or $num == -1) -00657 { -00658 $nextpage = 1; -00659 } -00660 else -00661 { -00662 $nextpage = 0; -00663 } -00664 -00665 print '<table width="100%" border="0" cellpadding="3" cellspacing="0">'; -00666 -00667 if ($page > 0) -00668 { -00669 print '<tr><td><div class="titre">'.$titre.' - page '.($page+1).'</div></td>'; -00670 } -00671 else -00672 { -00673 print '<tr><td><div class="titre">'.$titre.'</div></td>'; -00674 } -00675 -00676 if ($form) -00677 { -00678 print '<td align="left">'.$form.'</td>'; -00679 } -00680 -00681 print '<td align="right">'; -00682 -00683 if (strlen($sortfield)) -00684 { -00685 $options .= "&sortfield=$sortfield"; -00686 } -00687 -00688 if (strlen($sortorder)) -00689 { -00690 $options .= "&sortorder=$sortorder"; -00691 } -00692 -00693 // affichage des fleches de navigation -00694 -00695 print_fleche_navigation($page,$file,$options, $nextpage); -00696 -00697 print '</td></tr></table>'; -00698 } -00699 -00700 /* -00701 * fonction servant a afficher les fleches de navigation dans les -00702 * pages de liste -00703 */ -00704 function print_fleche_navigation($page,$file,$options='', $nextpage) -00705 { -00706 global $conf; -00707 if ($page > 0) -00708 { -00709 print '<a href="'.$file.'?page='.($page-1).$options.'"><img alt="Page précédente" src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/1leftarrow.png" border="0"></a>'; -00710 } -00711 -00712 if ($nextpage > 0) -00713 { -00714 print '<a href="'.$file.'?page='.($page+1).$options.'"><img alt="Page suivante" src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/1rightarrow.png" border="0"></a>'; -00715 } -00716 } -00717 /* -00718 * -00719 * -00720 */ -00721 function print_oui_non($value) -00722 { -00723 if ($value) +00658 function print_liste_field_titre($name, $file, $field, $begin="", $options="") +00659 { +00660 global $conf; +00661 +00662 print $name." "; +00663 print '<a href="'.$file.'?sortfield='.$field.'&sortorder=asc&begin='.$begin.$options.'">'; +00664 print '<img src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/1downarrow.png" border="0" alt="A-Z"></a>'; +00665 print '<a href="'.$file.'?sortfield='.$field.'&sortorder=desc&begin='.$begin.$options.'">'; +00666 print '<img src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/1uparrow.png" border="0" alt="Z-A"></a>'; +00667 } +00668 +00684 function print_liste_field_titre_new($name, $file, $field, $begin="", $options="", $td="", $sortfield="") +00685 { +00686 global $conf; +00687 if ($sortfield == $field) +00688 { +00689 print '<td class="menusel" '. $td.'>'; +00690 } +00691 else +00692 { +00693 print '<td '. $td.'>'; +00694 } +00695 print $name." "; +00696 print '<a href="'.$file.'?sortfield='.$field.'&sortorder=asc&begin='.$begin.$options.'">'; +00697 print '<img src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/1downarrow.png" border="0" alt="A-Z"></a>'; +00698 print '<a href="'.$file.'?sortfield='.$field.'&sortorder=desc&begin='.$begin.$options.'">'; +00699 print '<img src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/1uparrow.png" border="0" alt="Z-A"></a>'; +00700 print "</td>"; +00701 } +00702 +00708 function print_titre($titre) +00709 { +00710 print '<div class="titre">'.$titre.'</div>'; +00711 } +00712 +00719 function print_fiche_titre($titre, $mesg='') +00720 { +00721 print "\n".'<table width="100%" border="0" cellpadding="3" cellspacing="0">'; +00722 print '<tr><td><div class="titre" valign="middle">'.$titre.'</div></td>'; +00723 if (strlen($mesg)) 00724 { -00725 print '<option value="0">non'; -00726 print '<option value="1" selected>oui'; -00727 } -00728 else -00729 { -00730 print '<option value="0" selected>non'; -00731 print '<option value="1">oui'; -00732 } -00733 } -00734 /* -00735 * -00736 * -00737 */ -00738 function print_date_select($set_time='') -00739 { -00740 if (! $set_time) -00741 { -00742 $set_time = time(); -00743 } -00744 -00745 $strmonth[1] = "Janvier"; -00746 $strmonth[2] = "Février"; -00747 $strmonth[3] = "Mars"; -00748 $strmonth[4] = "Avril"; -00749 $strmonth[5] = "Mai"; -00750 $strmonth[6] = "Juin"; -00751 $strmonth[7] = "Juillet"; -00752 $strmonth[8] = "Août"; -00753 $strmonth[9] = "Septembre"; -00754 $strmonth[10] = "Octobre"; -00755 $strmonth[11] = "Novembre"; -00756 $strmonth[12] = "Décembre"; -00757 -00758 $smonth = 1; $endmonth = 12; -00759 $sday = 1; $endday = 31; -00760 -00761 $cday = date("d", $set_time); -00762 $cmonth = date("n", $set_time); -00763 $syear = date("Y", $set_time); -00764 -00765 print "<select name=\"reday\">"; -00766 -00767 for ($day = 1 ; $day <= $endday ; $day++) -00768 { -00769 if ($day == $cday) -00770 { -00771 print "<option value=\"$day\" selected>$day"; -00772 } -00773 else -00774 { -00775 print "<option value=\"$day\">$day"; -00776 } -00777 } -00778 -00779 print "</select>"; -00780 -00781 -00782 print "<select name=\"remonth\">"; -00783 for ($month = $smonth ; $month <= $endmonth ; $month++) -00784 { -00785 if ($month == $cmonth) -00786 { -00787 print "<option value=\"$month\" selected>" . $strmonth[$month]; -00788 } -00789 else -00790 { -00791 print "<option value=\"$month\">" . $strmonth[$month]; -00792 } -00793 } -00794 print "</select>"; -00795 -00796 print "<select name=\"reyear\">"; -00797 -00798 for ($year = $syear - 2; $year < $syear + 5 ; $year++) -00799 { -00800 if ($year == $syear) -00801 { -00802 print "<option value=\"$year\" SELECTED>$year"; -00803 } -00804 else -00805 { -00806 print "<option value=\"$year\">$year"; -00807 } -00808 } -00809 print "</select>\n"; -00810 -00811 } -00812 /* -00813 * -00814 * -00815 */ -00816 function print_heure_select($prefix,$begin=1,$end=23) { -00817 -00818 print '<select name="'.$prefix.'hour">'; -00819 for ($hour = $begin ; $hour <= $end ; $hour++) { -00820 print "<option value=\"$hour\">$hour"; -00821 } -00822 print "</select> H "; -00823 print '<select name="'.$prefix.'min">'; -00824 for ($min = 0 ; $min < 60 ; $min=$min+5) { -00825 if ($min < 10) { -00826 $min = "0" . $min; -00827 } -00828 print "<option value=\"$min\">$min"; -00829 } -00830 print "</select>\n"; -00831 } -00832 /* -00833 * -00834 * -00835 */ -00836 function print_duree_select($prefix) -00837 { -00838 print '<select name="'.$prefix.'hour">'; -00839 print "<option value=\"0\">0"; -00840 print "<option value=\"1\" SELECTED>1"; -00841 -00842 for ($hour = 2 ; $hour < 13 ; $hour++) -00843 { -00844 print "<option value=\"$hour\">$hour"; -00845 } -00846 print "</select> H "; -00847 print '<select name="'.$prefix.'min">'; -00848 for ($min = 0 ; $min < 55 ; $min=$min+5) -00849 { -00850 print "<option value=\"$min\">$min"; -00851 } -00852 print "</select>\n"; -00853 } -00854 -00855 /* -00856 * Return an amount with format "9 999.99" -00857 * Fonction utilisée dans les pdf et les pages -00858 * html -00859 */ -00860 function price($amount, $html=0) -00861 { -00862 if ($html) -00863 { -00864 -00865 $dec='.'; $thousand=' '; -00866 return ereg_replace(' ',' ',number_format($amount, 2, $dec, $thousand)); -00867 -00868 } -00869 else -00870 { -00871 return number_format($amount, 2, '.', ' '); -00872 } -00873 -00874 } -00875 -00876 function francs($euros) -00877 { -00878 return price($euros * 6.55957); -00879 } +00725 print '<td align="right" valign="middle"><b>'.$mesg.'</b></td>'; +00726 } +00727 print '</tr></table>'."\n"; +00728 } +00729 +00735 function dol_delete_file($file) +00736 { +00737 return unlink($file); +00738 } +00739 +00744 function block_access() +00745 { +00746 llxHeader(); +00747 print "Accés refusé"; +00748 llxFooter(); +00749 } +00750 +00751 /* +00752 * +00753 * +00754 */ +00755 +00756 function print_barre_liste($titre, $page, $file, $options='', $sortfield='', $sortorder='', $form='', $num=-1) +00757 { +00758 global $conf; +00759 +00760 if ($num > $conf->liste_limit or $num == -1) +00761 { +00762 $nextpage = 1; +00763 } +00764 else +00765 { +00766 $nextpage = 0; +00767 } +00768 +00769 print '<table width="100%" border="0" cellpadding="3" cellspacing="0">'; +00770 +00771 if ($page > 0) +00772 { +00773 print '<tr><td><div class="titre">'.$titre.' - page '.($page+1).'</div></td>'; +00774 } +00775 else +00776 { +00777 print '<tr><td><div class="titre">'.$titre.'</div></td>'; +00778 } +00779 +00780 if ($form) +00781 { +00782 print '<td align="left">'.$form.'</td>'; +00783 } +00784 +00785 print '<td align="right">'; +00786 +00787 if (strlen($sortfield)) +00788 { +00789 $options .= "&sortfield=$sortfield"; +00790 } +00791 +00792 if (strlen($sortorder)) +00793 { +00794 $options .= "&sortorder=$sortorder"; +00795 } +00796 +00797 // affichage des fleches de navigation +00798 +00799 print_fleche_navigation($page,$file,$options, $nextpage); +00800 +00801 print '</td></tr></table>'; +00802 } +00803 +00812 function print_fleche_navigation($page,$file,$options='', $nextpage) +00813 { +00814 global $conf; +00815 if ($page > 0) +00816 { +00817 print '<a href="'.$file.'?page='.($page-1).$options.'"><img alt="Page précédente" src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/1leftarrow.png" border="0"></a>'; +00818 } +00819 +00820 if ($nextpage > 0) +00821 { +00822 print '<a href="'.$file.'?page='.($page+1).$options.'"><img alt="Page suivante" src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/1rightarrow.png" border="0"></a>'; +00823 } +00824 } +00825 +00832 function print_oui_non($value) +00833 { +00834 if ($value) +00835 { +00836 print '<option value="0">non'; +00837 print '<option value="1" selected>oui'; +00838 } +00839 else +00840 { +00841 print '<option value="0" selected>non'; +00842 print '<option value="1">oui'; +00843 } +00844 } +00845 +00852 function print_date_select($set_time='') +00853 { +00854 if (! $set_time) +00855 { +00856 $set_time = time(); +00857 } +00858 +00859 $strmonth[1] = "Janvier"; +00860 $strmonth[2] = "Février"; +00861 $strmonth[3] = "Mars"; +00862 $strmonth[4] = "Avril"; +00863 $strmonth[5] = "Mai"; +00864 $strmonth[6] = "Juin"; +00865 $strmonth[7] = "Juillet"; +00866 $strmonth[8] = "Août"; +00867 $strmonth[9] = "Septembre"; +00868 $strmonth[10] = "Octobre"; +00869 $strmonth[11] = "Novembre"; +00870 $strmonth[12] = "Décembre"; +00871 +00872 $smonth = 1; $endmonth = 12; +00873 $sday = 1; $endday = 31; +00874 +00875 $cday = date("d", $set_time); +00876 $cmonth = date("n", $set_time); +00877 $syear = date("Y", $set_time); +00878 +00879 print "<select name=\"reday\">"; 00880 -00881 function tva($euros, $taux=19.6) -00882 { -00883 $taux = $taux / 100 ; -00884 -00885 return sprintf("%01.2f",($euros * $taux)); -00886 } -00887 function inctva($euros, $taux=1.196) -00888 { -00889 return sprintf("%01.2f",($euros * $taux)); -00890 } -00891 +00881 for ($day = 1 ; $day <= $endday ; $day++) +00882 { +00883 if ($day == $cday) +00884 { +00885 print "<option value=\"$day\" selected>$day"; +00886 } +00887 else +00888 { +00889 print "<option value=\"$day\">$day"; +00890 } +00891 } 00892 -00893 /* -00894 * -00895 * -00896 */ -00897 function stat_print($basename,$bc1,$bc2,$ftc, $jour) { -00898 -00899 $db = pg_Connect("","","","","$basename"); -00900 if (!$db) { -00901 echo "Pas de connexion a la base\n"; -00902 exit ; -00903 } -00904 -00905 $offset = $jour * 9; -00906 -00907 $sql="SELECT s.date, s.nb, l.libelle FROM stat_base as s, stat_cat as l WHERE s.cat = l.id ORDER by s.date DESC, s.cat ASC LIMIT 9 OFFSET $offset"; -00908 -00909 $result = $db->query($sql); -00910 if (!$result) { -00911 print "Erreur SELECT<br><h1>$sql</h1><br>"; -00912 return 1; -00913 } -00914 -00915 print "<table border=1 cellspacing=0 cellpadding=2>"; -00916 print "<tr><td><font color=\"white\">base <b>$basename</b></font></td>"; -00917 print "<td><font color=\"white\">libelle</font></td>"; -00918 print "</tr>"; -00919 -00920 $num = $db->num_rows(); -00921 $i = 0; -00922 -00923 $tag = 1; -00924 while ( $i < $num) { -00925 $obj = $db->fetch_object( $i); -00926 -00927 $tag = !$tag; -00928 -00929 print "<TR><TD>$obj->date</TD><TD>$obj->libelle</TD>\n"; -00930 print "<TD align=\"center\">$obj->nb</TD></TR>\n"; -00931 $i++; -00932 } -00933 print "</TABLE>"; -00934 $db->free(); -00935 -00936 $db->close(); -00937 -00938 } -00939 -00940 function tab_count($basename,$bc1,$bc2,$ftc) { -00941 -00942 $db = pg_Connect("","","","","$basename"); -00943 if (!$db) { -00944 echo "Pas de connexion a la base\n"; -00945 exit ; -00946 } -00947 -00948 $sql="SELECT count(*) AS nbcv from candidat WHERE active=1"; -00949 $result = $db->query($sql); -00950 if (!$result) { -00951 print "Erreur SELECT<br><h1>$sql</h1><br>"; -00952 return 1; -00953 } -00954 print "<table border=0 bgcolor=black cellspacing=0 cellpadding=0><tr><td>"; -00955 -00956 print "<table border=0 cellspacing=1 cellpadding=1>"; -00957 print "<tr><td><font color=\"white\">base <b>$basename</b></font></td>"; -00958 print "<td><font color=\"white\">libelle</font></td>"; -00959 print "</tr>"; -00960 $nbcv = $db->result( $i, "nbcv"); -00961 -00962 print "<tr $bc1><td><b>$ftc Nombre de CV</font></b></td>\n"; -00963 print "<td align=\"center\">$ftc $nbcv</td>\n"; -00964 print "</tr>\n"; -00965 $db->free(); -00966 -00967 $sql="SELECT count(*) AS nbcv from offre WHERE active=1"; -00968 -00969 $result = $db->query($sql); -00970 if (!$result) { -00971 print "Erreur SELECT<br><h1>$sql</h1><br>"; -00972 } -00973 $nbcv = $db->result( $i, "nbcv"); -00974 -00975 print "<tr $bc2><td><b>$ftc Nombre d'offre</font></b></td>"; -00976 print "<td align=\"center\">$ftc $nbcv</td>"; -00977 print "</tr>"; -00978 -00979 $db->free(); -00980 -00981 -00982 $sql="SELECT count(*) AS nbcv from candidat WHERE active=0"; -00983 -00984 $result = $db->query($sql); -00985 if (!$result) { -00986 print "Erreur SELECT<br><h1>$sql</h1><br>"; -00987 } -00988 -00989 $nbcv = $db->result( $i, "nbcv"); -00990 -00991 print "<tr $bc1><td><b>$ftc Nombre de CV inactifs</font></b></td>\n"; -00992 print "<td align=\"center\">$ftc $nbcv</td>"; -00993 print "</tr>"; -00994 -00995 $db->free(); -00996 -00997 -00998 $sql="SELECT count(*) AS nbcv from offre WHERE active=0"; -00999 -01000 $result = $db->query($sql); -01001 if (!$result) { -01002 print "Erreur SELECT<br><h1>$sql</h1><br>"; -01003 } -01004 -01005 $nbcv = $db->result( $i, "nbcv"); -01006 -01007 print "<tr $bc2><td><b>$ftc Nombre d'offres inactives</font></b></td>\n"; -01008 print "<td align=\"center\">$ftc $nbcv</td>\n"; -01009 print "</tr>\n"; -01010 -01011 $db->free(); -01012 -01013 $sql="SELECT count(*) AS nbsoc from logsoc"; -01014 -01015 $result = $db->query($sql); -01016 if (!$result) { -01017 print "Erreur SELECT<br><h1>$sql</h1><br>"; -01018 } -01019 -01020 $nbsoc = $db->result( $i, "nbsoc"); -01021 -01022 print "<tr $bc1><td><b>$ftc Nombre de logins societes</font></b></td>\n"; -01023 print "<td align=\"center\">$ftc $nbsoc</td>"; -01024 print "</tr>"; -01025 -01026 print "</td></tr></table></td></tr></table>"; -01027 -01028 $db->close(); -01029 -01030 } -01031 -01032 /* -01033 * logfile : permet de logguer dans un fichier -01034 * cette fonction ne fonctionenra que si et seulement si le fichier de -01035 * la constante globale MAIN_DEBUG existe et vaut 1 -01036 */ -01037 function logfile($str,$log="/var/log/dolibarr/dolibarr.log") -01038 { -01039 if (defined("MAIN_DEBUG") && MAIN_DEBUG ==1) -01040 { -01041 if (!file_exists($log)) -01042 { -01043 if (!$file=fopen($log,"w")) -01044 { -01045 return 0; -01046 } -01047 } -01048 else -01049 { -01050 if (!$file=fopen($log,"a+")) -01051 { -01052 return 0; -01053 } -01054 } -01055 $logentry=date("[d/M/Y:H:i:s] ").$str."\n"; -01056 if(!fwrite($file,$logentry)) { -01057 fclose($file); -01058 return 0; -01059 } -01060 fclose($file); -01061 return 1; -01062 } -01063 } -01064 -01065 /* -01066 * Fonctions reprise sur spip -01067 * http://www.uzine.net/spip/ -01068 */ -01069 function creer_pass_aleatoire($longueur = 8, $sel = "") { -01070 $seed = (double) (microtime() + 1) * time(); -01071 srand($seed); -01072 -01073 for ($i = 0; $i < $longueur; $i++) { -01074 if (!$s) { -01075 if (!$s) $s = rand(); -01076 $s = substr(md5(uniqid($s).$sel), 0, 16); -01077 } -01078 $r = unpack("Cr", pack("H2", $s.$s)); -01079 $x = $r['r'] & 63; -01080 if ($x < 10) $x = chr($x + 48); -01081 else if ($x < 36) $x = chr($x + 55); -01082 else if ($x < 62) $x = chr($x + 61); -01083 else if ($x == 63) $x = '/'; -01084 else $x = '.'; -01085 $pass .= $x; -01086 $s = substr($s, 2); -01087 } -01088 return $pass; -01089 } +00893 print "</select>"; +00894 +00895 +00896 print "<select name=\"remonth\">"; +00897 for ($month = $smonth ; $month <= $endmonth ; $month++) +00898 { +00899 if ($month == $cmonth) +00900 { +00901 print "<option value=\"$month\" selected>" . $strmonth[$month]; +00902 } +00903 else +00904 { +00905 print "<option value=\"$month\">" . $strmonth[$month]; +00906 } +00907 } +00908 print "</select>"; +00909 +00910 print "<select name=\"reyear\">"; +00911 +00912 for ($year = $syear - 2; $year < $syear + 5 ; $year++) +00913 { +00914 if ($year == $syear) +00915 { +00916 print "<option value=\"$year\" SELECTED>$year"; +00917 } +00918 else +00919 { +00920 print "<option value=\"$year\">$year"; +00921 } +00922 } +00923 print "</select>\n"; +00924 +00925 } +00935 function print_heure_select($prefix,$begin=1,$end=23) { +00936 +00937 print '<select name="'.$prefix.'hour">'; +00938 for ($hour = $begin ; $hour <= $end ; $hour++) { +00939 print "<option value=\"$hour\">$hour"; +00940 } +00941 print "</select> H "; +00942 print '<select name="'.$prefix.'min">'; +00943 for ($min = 0 ; $min < 60 ; $min=$min+5) { +00944 if ($min < 10) { +00945 $min = "0" . $min; +00946 } +00947 print "<option value=\"$min\">$min"; +00948 } +00949 print "</select>\n"; +00950 } +00951 +00957 function print_duree_select($prefix) +00958 { +00959 print '<select name="'.$prefix.'hour">'; +00960 print "<option value=\"0\">0"; +00961 print "<option value=\"1\" SELECTED>1"; +00962 +00963 for ($hour = 2 ; $hour < 13 ; $hour++) +00964 { +00965 print "<option value=\"$hour\">$hour"; +00966 } +00967 print "</select> H "; +00968 print '<select name="'.$prefix.'min">'; +00969 for ($min = 0 ; $min < 55 ; $min=$min+5) +00970 { +00971 print "<option value=\"$min\">$min"; +00972 } +00973 print "</select>\n"; +00974 } +00975 +00985 function price($amount, $html=0) +00986 { +00987 if ($html) +00988 { +00989 +00990 $dec='.'; $thousand=' '; +00991 return ereg_replace(' ',' ',number_format($amount, 2, $dec, $thousand)); +00992 +00993 } +00994 else +00995 { +00996 return number_format($amount, 2, '.', ' '); +00997 } +00998 +00999 } +01000 +01007 function francs($euros) +01008 { +01009 return price($euros * 6.55957); +01010 } +01011 +01018 function tva($euros, $taux=19.6) +01019 { +01020 $taux = $taux / 100 ; +01021 +01022 return sprintf("%01.2f",($euros * $taux)); +01023 } +01024 +01031 function inctva($euros, $taux=1.196) +01032 { +01033 return sprintf("%01.2f",($euros * $taux)); +01034 } +01035 +01046 function stat_print($basename,$bc1,$bc2,$ftc, $jour) { +01047 +01048 $db = pg_Connect("","","","","$basename"); +01049 if (!$db) { +01050 echo "Pas de connexion a la base\n"; +01051 exit ; +01052 } +01053 +01054 $offset = $jour * 9; +01055 +01056 $sql="SELECT s.date, s.nb, l.libelle FROM stat_base as s, stat_cat as l WHERE s.cat = l.id ORDER by s.date DESC, s.cat ASC LIMIT 9 OFFSET $offset"; +01057 +01058 $result = $db->query($sql); +01059 if (!$result) { +01060 print "Erreur SELECT<br><h1>$sql</h1><br>"; +01061 return 1; +01062 } +01063 +01064 print "<table border=1 cellspacing=0 cellpadding=2>"; +01065 print "<tr><td><font color=\"white\">base <b>$basename</b></font></td>"; +01066 print "<td><font color=\"white\">libelle</font></td>"; +01067 print "</tr>"; +01068 +01069 $num = $db->num_rows(); +01070 $i = 0; +01071 +01072 $tag = 1; +01073 while ( $i < $num) { +01074 $obj = $db->fetch_object( $i); +01075 +01076 $tag = !$tag; +01077 +01078 print "<TR><TD>$obj->date</TD><TD>$obj->libelle</TD>\n"; +01079 print "<TD align=\"center\">$obj->nb</TD></TR>\n"; +01080 $i++; +01081 } +01082 print "</TABLE>"; +01083 $db->free(); +01084 +01085 $db->close(); +01086 +01087 } +01088 +01089 function tab_count($basename,$bc1,$bc2,$ftc) { 01090 -01091 /* -01092 * Fonctions reprise sur spip -01093 * http://www.uzine.net/spip/ -01094 */ -01095 -01096 function initialiser_sel() { -01097 global $htsalt; -01098 -01099 $htsalt = '$1$'.creer_pass_aleatoire(); -01100 } -01101 -01102 ?> -
Généré le Thu Jul 15 20:50:38 2004 pour dolibarr par +01091 $db = pg_Connect("","","","","$basename"); +01092 if (!$db) { +01093 echo "Pas de connexion a la base\n"; +01094 exit ; +01095 } +01096 +01097 $sql="SELECT count(*) AS nbcv from candidat WHERE active=1"; +01098 $result = $db->query($sql); +01099 if (!$result) { +01100 print "Erreur SELECT<br><h1>$sql</h1><br>"; +01101 return 1; +01102 } +01103 print "<table border=0 bgcolor=black cellspacing=0 cellpadding=0><tr><td>"; +01104 +01105 print "<table border=0 cellspacing=1 cellpadding=1>"; +01106 print "<tr><td><font color=\"white\">base <b>$basename</b></font></td>"; +01107 print "<td><font color=\"white\">libelle</font></td>"; +01108 print "</tr>"; +01109 $nbcv = $db->result( $i, "nbcv"); +01110 +01111 print "<tr $bc1><td><b>$ftc Nombre de CV</font></b></td>\n"; +01112 print "<td align=\"center\">$ftc $nbcv</td>\n"; +01113 print "</tr>\n"; +01114 $db->free(); +01115 +01116 $sql="SELECT count(*) AS nbcv from offre WHERE active=1"; +01117 +01118 $result = $db->query($sql); +01119 if (!$result) { +01120 print "Erreur SELECT<br><h1>$sql</h1><br>"; +01121 } +01122 $nbcv = $db->result( $i, "nbcv"); +01123 +01124 print "<tr $bc2><td><b>$ftc Nombre d'offre</font></b></td>"; +01125 print "<td align=\"center\">$ftc $nbcv</td>"; +01126 print "</tr>"; +01127 +01128 $db->free(); +01129 +01130 +01131 $sql="SELECT count(*) AS nbcv from candidat WHERE active=0"; +01132 +01133 $result = $db->query($sql); +01134 if (!$result) { +01135 print "Erreur SELECT<br><h1>$sql</h1><br>"; +01136 } +01137 +01138 $nbcv = $db->result( $i, "nbcv"); +01139 +01140 print "<tr $bc1><td><b>$ftc Nombre de CV inactifs</font></b></td>\n"; +01141 print "<td align=\"center\">$ftc $nbcv</td>"; +01142 print "</tr>"; +01143 +01144 $db->free(); +01145 +01146 +01147 $sql="SELECT count(*) AS nbcv from offre WHERE active=0"; +01148 +01149 $result = $db->query($sql); +01150 if (!$result) { +01151 print "Erreur SELECT<br><h1>$sql</h1><br>"; +01152 } +01153 +01154 $nbcv = $db->result( $i, "nbcv"); +01155 +01156 print "<tr $bc2><td><b>$ftc Nombre d'offres inactives</font></b></td>\n"; +01157 print "<td align=\"center\">$ftc $nbcv</td>\n"; +01158 print "</tr>\n"; +01159 +01160 $db->free(); +01161 +01162 $sql="SELECT count(*) AS nbsoc from logsoc"; +01163 +01164 $result = $db->query($sql); +01165 if (!$result) { +01166 print "Erreur SELECT<br><h1>$sql</h1><br>"; +01167 } +01168 +01169 $nbsoc = $db->result( $i, "nbsoc"); +01170 +01171 print "<tr $bc1><td><b>$ftc Nombre de logins societes</font></b></td>\n"; +01172 print "<td align=\"center\">$ftc $nbsoc</td>"; +01173 print "</tr>"; +01174 +01175 print "</td></tr></table></td></tr></table>"; +01176 +01177 $db->close(); +01178 +01179 } +01180 +01188 function logfile($str,$log="/var/log/dolibarr/dolibarr.log") +01189 { +01190 if (defined("MAIN_DEBUG") && MAIN_DEBUG ==1) +01191 { +01192 if (!file_exists($log)) +01193 { +01194 if (!$file=fopen($log,"w")) +01195 { +01196 return 0; +01197 } +01198 } +01199 else +01200 { +01201 if (!$file=fopen($log,"a+")) +01202 { +01203 return 0; +01204 } +01205 } +01206 $logentry=date("[d/M/Y:H:i:s] ").$str."\n"; +01207 if(!fwrite($file,$logentry)) { +01208 fclose($file); +01209 return 0; +01210 } +01211 fclose($file); +01212 return 1; +01213 } +01214 } +01215 +01224 function creer_pass_aleatoire($longueur = 8, $sel = "") { +01225 $seed = (double) (microtime() + 1) * time(); +01226 srand($seed); +01227 +01228 for ($i = 0; $i < $longueur; $i++) { +01229 if (!$s) { +01230 if (!$s) $s = rand(); +01231 $s = substr(md5(uniqid($s).$sel), 0, 16); +01232 } +01233 $r = unpack("Cr", pack("H2", $s.$s)); +01234 $x = $r['r'] & 63; +01235 if ($x < 10) $x = chr($x + 48); +01236 else if ($x < 36) $x = chr($x + 55); +01237 else if ($x < 62) $x = chr($x + 61); +01238 else if ($x == 63) $x = '/'; +01239 else $x = '.'; +01240 $pass .= $x; +01241 $s = substr($s, 2); +01242 } +01243 return $pass; +01244 } +01245 +01251 function initialiser_sel() { +01252 global $htsalt; +01253 +01254 $htsalt = '$1$'.creer_pass_aleatoire(); +01255 } +01256 +01257 ?> +
1.3.7