*
* $Id$
* $Source$
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
* or see http://www.gnu.org/
*/
/* \deprecated Ce fichier semble ne plus servir. A virer */
function gljDbConnect() {
return pg_Connect($GLOBALS["DB_HOST"],
$GLOBALS["DB_PORT"],
$GLOBALS["DB_OPTIONS"],
$GLOBALS["DB_TTY"],
$GLOBALS["DB_NAME"]);
}
function gljPrintSelect($db, $refid) {
$num = $db->num_rows();
$i = 0;
while ($i < $num) {
$obj = $db->fetch_object();
print "\n";
$i++;
}
}
/*
* Copy company def from one base to another
*/
function gljCopy_Soc($idsoc, $dbfrom, $dbto) {
global $dbhost, $dbport, $dboptions, $dbtty, $DB_LOGIN_NAME, $dbname, $DB_NAME;
// Add login info into login table
$connfrom = pg_Connect($dbhost, $dbport, $dboptions, $dbtty, $DB_NAME["$dbfrom"]);
$connto = pg_Connect($dbhost, $dbport, $dboptions, $dbtty, $DB_NAME["$dbto"]);
$connlogin = pg_Connect($DB_LOGIN_HOST, $DB_LOGIN_PORT , $dboptions, $dbtty ,$DB_LOGIN_NAME);
$madate = time();
if ($connfrom) {
if ($connto) {
if ($connlogin) {
$sql = "SELECT nom, fk_effectif FROM societe WHERE id = '$idsoc'";
$result = pg_Exec($connfrom, $sql);
if ( $result ) {
if (pg_NumRows($result) ) {
$obj = pg_Fetch_Object($result);
$sql = "INSERT INTO societe (id, nom, datec, fk_effectif) ";
$sql .= "VALUES ('$idsoc', '$obj->nom', $madate, $obj->fk_effectif)";
$result = pg_Exec($connto, $sql);
if ( $result ) {
$sql = "UPDATE login SET pays = pays || ':$dbto' WHERE id = '$idsoc'";
$result = pg_Exec($connlogin, $sql);
if ( $result ) {
// ALL success
return 0;
}
}
} else {
// this login exists
return 2;
}
}
pg_close($connlogin);
}
pg_close($connto);
}
pg_close($connfrom);
}
}
/*
* Envoie le login lors de la premiere connexion au compte
*/
function gljMailLogin ($db, $address, $id, $dbname) {
$sql = "SELECT login, clearpass FROM login where id='$id' ";
if ($db->query($sql)) {
if ($db->num_rows() > 0) {
$obj = $db->fetch_object();
$db->free();
$subject = "Confirmation";
$mess = "Vous venez de déposer votre CV sur http://".$GLOBALS["GLJ_NORMAL_HOST"]."\n";
$mess .= "\n\n";
$mess .= "login : $obj->login\n";
$mess .= "pass : $obj->clearpass\n";
$mess .= "\n-----------------------------\n";
$mess .= "contact : " . $GLOBALS["WEBMASTER"];
$mess .= "\n-----------------------------\n";
$return = mail("$address","$subject","$mess","From: " . $GLOBALS["WEBMASTER"]);
}
}
}
//
//
//
function gljFooter_Cursor ($file, $page, $limit, $i, $parm="") {
$page_prev = $page - 1;
$page_next = $page + 1;
print "