Ejemplo n.º 1
0
function add_contrat($nextid, $titre, $fournisseur, $date, $montant_global, $article, $paragraphe, $chapitre, $pj)
{
    global $db;
    $usrid = $_SESSION['userid'];
    $date = date('Y-m-d-', strtotime($date));
    $values["titre"] = MySQL::SQLValue($titre);
    $values["date"] = MySQL::SQLValue($date);
    $values["id_fournisseur"] = MySQL::SQLValue($fournisseur);
    $values["id_chapitre"] = MySQL::SQLValue($chapitre);
    $values["id_article"] = MySQL::SQLValue($article);
    $values["id_paragraphe"] = MySQL::SQLValue($paragraphe);
    $values["montant_global"] = MySQL::SQLValue($montant_global);
    $values["montant_paye"] = MySQL::SQLValue(0);
    $values["pourcentage"] = MySQL::SQLValue(0);
    $values["montant_rest"] = MySQL::SQLValue($montant_global);
    $values["addby"] = MySQL::SQLValue($usrid);
    if (!$db->InsertRow("contrat", $values)) {
        $db->Kill($db->Error());
        return false;
    } else {
        logg('Enregistrement Contrat Fournisseur ', 254, $nextid, $_SESSION['userid']);
        // Save PJ to archive
        if ($pj != "") {
            $basedir = "upload/contrat";
            if (!file_exists($basedir)) {
                mkdir($basedir, 0, true);
            }
            $newdir = $basedir . "/";
            copyfile($pj, $nextid, $newdir, "Attachement_contrat_");
            autoarchive($newdir . changnom($pj, $nextid, 'Attachement_contrat_'), "Fichier joint contrat fournisseur {$nextid}", 254, $nextid, "contrat", "pj", $_SESSION['userid'], cryptage(session::get('service'), 0));
        }
    }
    return true;
}
Ejemplo n.º 2
0
function editreform($nextid, $titre, $desc, $montant, $pj, $date)
{
    global $db;
    $usrid = $_SESSION['userid'];
    $date_operation = date('Y-m-d-', strtotime($date));
    $values["titre"] = MySQL::SQLValue($titre);
    $values["description"] = MySQL::SQLValue($desc);
    $values["montant"] = MySQL::SQLValue($montant);
    $values["date_operation"] = MySQL::SQLValue($date_operation);
    $where["id"] = MySQL::SQLValue($nextid);
    if (!$db->UpdateRows("produit_reform", $values, $where)) {
        $db->Kill($db->Error());
        return false;
    } else {
        $sql = $db->BuildSQLInsert("produit_reform", $values);
        logg('Enregistrement Produit Reform ', 167, $nextid, $_SESSION['userid']);
        if ($pj != "") {
            $basedir = "upload/produit";
            if (!file_exists($basedir)) {
                mkdir($basedir, 0, true);
            }
            $newdir = $basedir . "/";
            copyfile($pj, $nextid, $newdir, "Attachement_produit_reform");
            autoarchive($newdir . changnom($pj, $nextid, 'Attachement_produit_reform'), "Fichier joint produit Reform  {$nextid}", 100, $nextid, "produit_reform", "pj", $_SESSION['userid'], cryptage(session::get('service'), 0));
        }
        return true;
    }
}
Ejemplo n.º 3
0
function addaemploi($id_aemploi, $montant, $date_paiement, $mode_paiement, $ref_pj, $pj)
{
    global $db;
    $nextid = getnextidtable('autorisation_emploi');
    $usrid = $_SESSION['userid'];
    $date = date('Y-m-d-', strtotime($date_paiement));
    $values["pj"] = MySQL::SQLValue($pj);
    $values["ref_pj"] = MySQL::SQLValue($ref_pj);
    $values["id_aemploi"] = MySQL::SQLValue($id_aemploi);
    $values["mode_paiement"] = MySQL::SQLValue($mode_paiement);
    $values["date_paiement"] = MySQL::SQLValue($date);
    $values["montant"] = MySQL::SQLValue($montant);
    $values["addby"] = MySQL::SQLValue($usrid);
    if (!$db->InsertRow("autorisation_emploi", $values)) {
        $db->Kill($db->Error());
        return false;
    } else {
        $sql = $db->BuildSQLInsert("autorisation_emploi", $values);
        logg('Enregistrement Autorisation Emploi ', 246, $nextid, $_SESSION['userid']);
        if ($pj != "") {
            $basedir = "upload/Autorisation";
            if (!file_exists($basedir)) {
                mkdir($basedir, 0, true);
            }
            $newdir = $basedir . "/";
            copyfile($pj, $nextid, $newdir, "Attachement_autorisation_");
            autoarchive($newdir . changnom($pj, $nextid, 'Attachement_autorisation_'), "Fichier joint autorisation emploi {$nextid}", 246, $nextid, "autorisation_emploi", "pj", $_SESSION['userid'], cryptage(session::get('service'), 0));
        }
    }
    return true;
}
Ejemplo n.º 4
0
function addnews($titrfr, $titren, $titrar, $img, $id, $art, $typ)
{
    global $db;
    $values["titrfr"] = MySQL::SQLValue($titrfr);
    $values["titren"] = MySQL::SQLValue($titren);
    $values["titrar"] = MySQL::SQLValue($titrar);
    $values["article"] = MySQL::SQLValue($art);
    $values["typ"] = MySQL::SQLValue($typ);
    // Execute the insert
    $result = $db->InsertRow("document", $values);
    // If we have an error
    if (!$result) {
        // Show the error and kill the script
        $db->Kill($result);
        return false;
    } else {
        if ($img != "") {
            $basedir = "upload/doc";
            if (!file_exists($basedir)) {
                mkdir($basedir, 0, true);
            }
            $newdir = "../upload/doc/";
            if (!file_exists($newdir)) {
                mkdir($newdir, 0, true);
            }
            $file = "./upload/doc/" . changnom($img, $id, 'doc_');
            copyfile($img, $id, $newdir, "doc_");
            autoarchive($file, "Document page {$id} ", 12, $id, "document", "img", $_SESSION['userid'], cryptage(session::get('service'), 0));
        }
        return true;
    }
}
Ejemplo n.º 5
0
function editdoc($titrfr, $titren, $titrar, $img, $id, $art, $typ)
{
    global $db;
    $values["titrfr"] = MySQL::SQLValue($titrfr);
    $values["titren"] = MySQL::SQLValue($titren);
    $values["titrar"] = MySQL::SQLValue($titrar);
    $values["article"] = MySQL::SQLValue($art);
    $values["typ"] = MySQL::SQLValue($typ);
    if ($img != "") {
        $values["img"] = MySQL::SQLValue(changnom($img, $id, 'doc_'));
    }
    $where["id"] = MySQL::SQLValue($id);
    // Execute the insert
    $result = $db->UpdateRows("document", $values, $where);
    // If we have an error
    if (!$result) {
        // Show the error and kill the script
        $db->Kill('Error Update');
        return false;
    } else {
        if ($img != "") {
            $olddir = "upload/doc/";
            $newdir = "../upload/doc/";
            copyfile($img, $id, $newdir, "doc_");
            autoarchive($newdir . changnom($img, $id, 'doc_'), "Document page {$id} ", 12, $id, "document", "img", $_SESSION['userid'], cryptage(session::get('service'), 0));
        }
        return true;
    }
}
Ejemplo n.º 6
0
function editlocation($nextid, $nom, $adresse, $pj, $tel, $mail, $villa, $date_debut, $date_fin, $type_paiement, $montant_location, $agarantie_location)
{
    global $db;
    $usrid = $_SESSION['userid'];
    $datedebut = date('Y-m-d-', strtotime($date_debut));
    $datefin = date('Y-m-d-', strtotime($date_fin));
    $values["nomlocataire"] = MySQL::SQLValue($nom);
    $values["adresse"] = MySQL::SQLValue($adresse);
    $values["tel"] = MySQL::SQLValue($tel);
    $values["mail"] = MySQL::SQLValue($mail);
    $values["idvilla"] = MySQL::SQLValue($villa);
    $values["date_debut"] = MySQL::SQLValue($datedebut);
    $values["date_fin"] = MySQL::SQLValue($datefin);
    $values["montant"] = MySQL::SQLValue($montant_location);
    $values["depot_garantie"] = MySQL::SQLValue($agarantie_location);
    $values["type_paiement"] = MySQL::SQLValue($type_paiement);
    $where["id"] = MySQL::SQLValue($nextid);
    if (!$db->UpdateRows("contrat_location_villa", $values, $where)) {
        $db->Kill($db->Error());
        return false;
    } else {
        $sql = $db->BuildSQLInsert("contrat_location_villa", $values);
        logg('Enregistrement Location Villa ', 100, $nextid, $_SESSION['userid']);
        if ($pj != "") {
            $basedir = "upload/location";
            if (!file_exists($basedir)) {
                mkdir($basedir, 0, true);
            }
            $newdir = $basedir . "/";
            copyfile($pj, $nextid, $newdir, "Attachement_location_");
            autoarchive($newdir . changnom($pj, $nextid, 'Attachement_location_'), "Fichier joint location ville {$nextid}", 100, $nextid, "location_villa", "pj", $_SESSION['userid'], cryptage(session::get('service'), 0));
        }
        return true;
    }
}
Ejemplo n.º 7
0
function editcollecte($idcontrat, $paiement, $date, $pj)
{
    global $db;
    $usrid = $_SESSION['userid'];
    $nextid = getnextidtable('collecte');
    //$date1=date_create($date);
    //$datep=date_format($date1,"Y-m-d");
    $date_paiement = date('Y-m-d-', strtotime($date));
    $values["mode_paiement"] = MySQL::SQLValue($paiement);
    $values["date_paiement"] = MySQL::SQLValue($date_paiement);
    $where["id"] = MySQL::SQLValue($idcontrat);
    if (!$db->UpdateRows("collecte", $values, $where)) {
        $db->Kill($db->Error());
        return false;
    } else {
        $sql = $db->BuildSQLInsert("collecte", $values);
        logg('Enregistrement collecte ', 201, $nextid, $_SESSION['userid']);
        if ($pj != "") {
            $basedir = "upload/collecte";
            if (!file_exists($basedir)) {
                mkdir($basedir, 0, true);
            }
            $newdir = $basedir . "/";
            copyfile($pj, $nextid, $newdir, "collecte");
            autoarchive($newdir . changnom($pj, $nextid, 'collecte'), "Fichier joint collecte {$nextid}", 201, $nextid, "collecte", "piece_jointe", $_SESSION['userid'], cryptage(session::get('service'), 0));
        }
        return true;
    }
}
Ejemplo n.º 8
0
function setcollecte($id, $mode_paiement, $pj, $date_paiement)
{
    global $db;
    //$nextid=getnextidtable('collecte');
    $date = date('Y-m-d-', strtotime($date_paiement));
    $values["mode_paiement"] = MySQL::SQLValue($mode_paiement);
    $values["date_paiement"] = MySQL::SQLValue($date);
    $values["etat_paiement"] = MySQL::SQLValue("Payé");
    $where["id"] = MySQL::SQLValue($id);
    if (!$db->UpdateRows("collecte", $values, $where)) {
        $db->Kill($db->Error());
        return false;
    } else {
        $sql = $db->BuildSQLInsert("collecte", $values);
        logg('Enregistrement collecte ', 195, $id, $_SESSION['userid']);
        if ($pj != "") {
            $basedir = "upload/collecte";
            if (!file_exists($basedir)) {
                mkdir($basedir, 0, true);
            }
            $newdir = $basedir . "/";
            copyfile($pj, $id, $newdir, "Attachement_collecte_");
            autoarchive($newdir . changnom($pj, $id, 'Attachement_collecte_'), "Fichier joint collecte  {$id}", 195, $id, "collecte", "piece_jointe", $_SESSION['userid'], cryptage(session::get('service'), 0));
        }
        return true;
    }
}
Ejemplo n.º 9
0
function setcontrat($id, $date, $pj)
{
    global $db;
    $etat = "Résilié";
    $nextid = getnextidtable('contrat_location_villa');
    $date = date('Y-m-d-', strtotime($date));
    $values["date_resiliation"] = MySQL::SQLValue($date);
    $values["etat"] = MySQL::SQLValue($etat);
    $where["id"] = MySQL::SQLValue($id);
    if (!$db->UpdateRows("contrat_location_villa", $values, $where)) {
        $db->Kill($db->Error());
        return false;
    } else {
        $sql = $db->BuildSQLInsert("contrat_location_villa", $values);
        logg('Enregistrement Location Villa ', 233, $id, $_SESSION['userid']);
        if ($pj != "") {
            $basedir = "upload/location";
            if (!file_exists($basedir)) {
                mkdir($basedir, 0, true);
            }
            $newdir = $basedir . "/";
            copyfile($pj, $id, $newdir, "Attachement_location_");
            autoarchive($newdir . changnom($pj, $id, 'Attachement_location_'), "Fichier joint location ville {$id}", 233, $id, "contrat_location_villa", "pj_resiliation", $_SESSION['userid'], cryptage(session::get('service'), 0));
        }
        return true;
    }
}
Ejemplo n.º 10
0
function edit_quote($id, $date, $montant, $pj)
{
    global $db;
    $date = date('Y-m-d-', strtotime($date));
    $values["datinsert"] = MySQL::SQLValue($date);
    $values["montant"] = MySQL::SQLValue($montant);
    $where["id"] = MySQL::SQLValue($id);
    if (!$db->UpdateRows("quotpatronal", $values, $where)) {
        $db->Kill($db->Error());
        return false;
    } else {
        $sql = $db->BuildSQLInsert("quotpatronal", $values);
        logg('Enregistrement Quote Part Patronal ', 175, $id, $_SESSION['userid']);
        if ($pj != "") {
            $basedir = "upload/quotpatronal";
            if (!file_exists($basedir)) {
                mkdir($basedir, 0, true);
            }
            $newdir = $basedir . "/";
            copyfile($pj, $id, $newdir, "Attachement_quotpatronal_");
            autoarchive($newdir . changnom($pj, $id, 'Attachement_quotpatronal_'), "Fichier joint Quote Part Patronal {$id}", 175, $id, "quotpatronal", "piece_jointe", $_SESSION['userid'], cryptage(session::get('service'), 0));
        }
        return true;
    }
}
Ejemplo n.º 11
0
function addevent($titrfr, $titren, $titrar, $contfr, $conten, $contar, $img, $id, $autfr, $auten, $autar, $dat)
{
    global $db;
    $date = date('Y-m-d-', strtotime($dat));
    $values["titrfr"] = MySQL::SQLValue($titrfr);
    $values["titren"] = MySQL::SQLValue($titren);
    $values["titrar"] = MySQL::SQLValue($titrar);
    $values["contfr"] = MySQL::SQLValue($contfr);
    $values["conten"] = MySQL::SQLValue($conten);
    $values["contar"] = MySQL::SQLValue($contar);
    $values["autfr"] = MySQL::SQLValue($autfr);
    $values["auten"] = MySQL::SQLValue($auten);
    $values["autar"] = MySQL::SQLValue($autar);
    $values["app"] = MySQL::SQLValue('?_tsk=event&id=' . $id);
    $values["dat"] = MySQL::SQLValue($date);
    // Execute the insert
    $result = $db->InsertRow("event", $values);
    // If we have an error
    if (!$result) {
        // Show the error and kill the script
        $db->Kill('Error Insert');
        return false;
    } else {
        if ($img != "") {
            $basedir = "upload/event";
            if (!file_exists($basedir)) {
                mkdir($basedir, 0, true);
            }
            $newdir = "../upload/event/";
            copyfile($img, $id, $newdir, "event_");
            autoarchive($newdir . changnom($img, $id, 'event_'), "Image Evénement {$id} ", 12, $id, "event", "img", $_SESSION['userid'], cryptage(session::get('service'), 0));
        }
        return true;
    }
}
Ejemplo n.º 12
0
function notif($modul)
{
    global $db;
    $service = cryptage($_SESSION['service'], 0);
    $querynotif = "SELECT count({$modul}.id) as nbr FROM {$modul}, rules WHERE {$modul}.etat = rules.etat and rules.notif = 1 AND rules.service = {$service} and rules.app='{$modul}'  and rules.active = 1";
    $nbr = $db->QuerySingleValue0($querynotif);
    //return $nbr;
    exit($nbr);
}
Ejemplo n.º 13
0
function addcontenu($titrfr, $titren, $titrar, $contfr, $conten, $contar, $module, $img, $id, $vod, $fileuploadid, $dat)
{
    $next_id_vod = getnextidtable('vod');
    global $db;
    $newdir = "../upload/contenu/image/";
    $date = date('Y-m-d-', strtotime($dat));
    $values["titrfr"] = MySQL::SQLValue($titrfr);
    $values["titren"] = MySQL::SQLValue($titren);
    $values["titrar"] = MySQL::SQLValue($titrar);
    $values["contfr"] = MySQL::SQLValue($contfr);
    $values["conten"] = MySQL::SQLValue($conten);
    $values["contar"] = MySQL::SQLValue($contar);
    $values["modul"] = MySQL::SQLValue($module);
    $values["app"] = MySQL::SQLValue('?_tsk=page&id=' . $id);
    if ($vod != "") {
        $values["video"] = MySQL::SQLValue($next_id_vod);
    }
    $values["dat"] = MySQL::SQLValue($date);
    $values["img"] = MySQL::SQLValue(changnom($newdir . $img, $id, 'contenu_'));
    // Execute the insert
    $result = $db->InsertRow("contenu", $values);
    // If we have an error
    if (!$result) {
        // Show the error and kill the script
        $db->Kill('error');
        return false;
    } else {
        if ($img != "") {
            $basedir = "upload/contenu/image";
            if (!file_exists($basedir)) {
                mkdir($basedir, 0, true);
            }
            if (!file_exists($newdir)) {
                mkdir($newdir, 0, true);
            }
            copyfile($img, $id, $newdir, "contenu_");
        }
        if ($fileuploadid != "") {
            $basedir = "upload/contenu/doc";
            if (!file_exists($basedir)) {
                mkdir($basedir, 0, true);
            }
            $newdir = "../upload/contenu/doc/";
            if (!file_exists($newdir)) {
                mkdir($newdir, 0, true);
            }
            copyfile($fileuploadid, $id, $newdir, "document_");
            $file = "./upload/contenu/doc/" . changnom($fileuploadid, $id, 'document_');
            autoarchive($file, "Document Contenu {$id} ", 12, $id, "contenu", "document", $_SESSION['userid'], cryptage(session::get('service'), 0));
        }
        if ($vod != "") {
            addvod($titrfr, $titren, $titrar, $vod);
        }
        return true;
    }
}
Ejemplo n.º 14
0
function validate_login($username, $password, $token_form)
{
    //vèrifier si le nom d'utilisateur exist
    global $db;
    if (!$db->Query("SELECT * FROM users_sys where nom='{$username}' and pass='******'")) {
        $db->Kill('Error1');
    }
    if ($db->RowCount() > 0) {
        // Si MDP correcte  set Session
        $array = $db->RowArray();
        $user_name = $array['nom'];
        $user_id = $array['id'];
        $token = $token_form;
        $ssid = $token;
        $service = $array['servic'];
        $imda = $array['signature'];
        $defalutapp = $array['defapp'];
        $session = new session();
        $session->set('username', $array['nom']);
        $session->set('userid', $array['id']);
        $session->set('time', time());
        $session->set('ssid', $ssid);
        $session->set('agence', $array['agence']);
        $session->set('service', cryptage($service, 1));
        $session->set('imda', cryptage($imda, 1));
        $session->set('defapp', cryptage($defalutapp, 1));
        //RAZ CTC
        if (!$db->Query("update users_sys set  ctc=0,lastactive=CURRENT_TIMESTAMP where id=" . $user_id)) {
            $db->Kill('RAZ CTC');
        }
        //Save session
        $savessid_sql = "insert into session (id,user,dat) value('" . $ssid . "','" . $user_name . "',CURRENT_TIMESTAMP)";
        if (!$db->Query($savessid_sql)) {
            $db->Kill($db->Error());
        }
        //set_session($user_name,$user_id,$token,$service,$imda,$defalutapp,$time);
        return true;
    }
    //else utilisateur
}
Ejemplo n.º 15
0
function addnote($objet, $note, $id, $dat)
{
    global $db;
    $date = date('Y-m-d', strtotime($dat));
    $getan = date('Y', strtotime($dat));
    $usrid = $_SESSION['userid'];
    $values["objet"] = MySQL::SQLValue($objet);
    $values["file"] = MySQL::SQLValue(changnom($note, $id, 'note_'));
    $values["dat"] = MySQL::SQLValue($date);
    $values["addby"] = MySQL::SQLValue($usrid);
    // Execute the insert
    $result = $db->InsertRow("noteservice", $values);
    $sql = $db->BuildSQLInsert("noteservice", $values);
    $valuesf["req"] = MySQL::SQLValue($sql);
    $r = $db->InsertRow("temprequet", $valuesf);
    // If we have an error
    if (!$result) {
        // Show the error and kill the script
        $db->Kill('Error insert');
        return false;
    } else {
        logg('Enregistrement Note de service', 12, $id, $_SESSION['userid']);
        $basedir = "upload/noteservice/{$getan}";
        // save file
        if (!file_exists($basedir)) {
            mkdir($basedir, 0, true);
        }
        $newdir = $basedir . "/";
        if ($note != "") {
            copyfile($note, $id, $newdir, "note_");
            autoarchive($newdir . changnom($note, $id, 'note_'), "Note de service N° {$id} ", 12, $id, "noteservice", "file", $_SESSION['userid'], cryptage(session::get('service'), 0));
        }
        return true;
    }
    /* if($lettre!=""){
    	  copyfile($lettre,$id,$newdir,"lettre_");
    autoarchive($newdir.changnom($lettre,$id,'lettre_'),"Lettre demande Autorisation d'Emploi $id ",44,$id,"aemploi", "lettre", $_SESSION['userid'],cryptage(session::get('service'),0));
    	  }	*/
}
Ejemplo n.º 16
0
function addlocation($nextid, $nomlocataire, $nomresponsable, $adresse, $tel, $mail, $villa, $date_debut, $date_fin, $montant, $depot_garantie, $pj, $cycle)
{
    global $db;
    $usrid = $_SESSION['userid'];
    $datedebut = date('Y-m-d-', strtotime($date_debut));
    $datefin = date('Y-m-d-', strtotime($date_fin));
    $values["nomlocataire"] = MySQL::SQLValue($nomlocataire);
    $values["nomresponsable"] = MySQL::SQLValue($nomresponsable);
    $values["adresse"] = MySQL::SQLValue($adresse);
    $values["tel"] = MySQL::SQLValue($tel);
    $values["mail"] = MySQL::SQLValue($mail);
    $values["date_debut"] = MySQL::SQLValue($datedebut);
    $values["date_fin"] = MySQL::SQLValue($datefin);
    $values["montant"] = MySQL::SQLValue($montant);
    $values["depot_garantie"] = MySQL::SQLValue($depot_garantie);
    //$values["type_paiement"] = MySQL::SQLValue($type_paiement);
    $values["addby"] = MySQL::SQLValue($usrid);
    $values["etat"] = MySQL::SQLValue('Attente Validation');
    $values["cycle_paiement"] = MySQL::SQLValue($cycle);
    $values["idvilla"] = MySQL::SQLValue($villa);
    //if(($db->QuerySingleValue0("SELECT id FROM contrat_location_villa where etat='en cours' and idvilla ='".tp('villa')."'")==0)
    if (!$db->InsertRow("contrat_location_villa", $values)) {
        $db->Kill($db->Error());
        return false;
    } else {
        $sql = $db->BuildSQLInsert("contrat_location_villa", $values);
        logg('Enregistrement Location Villa ', 196, $nextid, $_SESSION['userid']);
        if ($pj != "") {
            $basedir = "upload/location";
            if (!file_exists($basedir)) {
                mkdir($basedir, 0, true);
            }
            $newdir = $basedir . "/";
            copyfile($pj, $nextid, $newdir, "Attachement_location_");
            autoarchive($newdir . changnom($pj, $nextid, 'Attachement_location_'), "Fichier joint location villa {$nextid}", 196, $nextid, "contrat_location_villa", "pj", $_SESSION['userid'], cryptage(session::get('service'), 0));
        }
    }
    return true;
}
Ejemplo n.º 17
0
 public static function load()
 {
     if (isset($_SESSION['userid'])) {
         if (tg('ajax') == 1) {
             $template = (include_once AFFICH_REP . 'layout/ajax.php');
         } else {
             //Il faut voir si le service est outside of ONAPE utiliser mainoutside.php
             if (isset($_SESSION['service']) && cryptage(session::get('service'), 0) == 19) {
                 $template = (include_once AFFICH_REP . 'layout/main_outside.php');
             } else {
                 $template = (include_once AFFICH_REP . 'layout/main.php');
             }
         }
         // $this->template = include_once(AFFICH_REP.'layout/main.php');
     } else {
         if (tg('ajax') == 1) {
             $template = (include_once AFFICH_REP . 'layout/ajax.php');
         } else {
             $template = (include_once AFFICH_REP . 'layout/mainns.php');
         }
     }
     //end else
 }
Ejemplo n.º 18
0
function addcollecte($nextid, $id, $prix, $paiement, $pj)
{
    global $db;
    $values["id_location"] = MySQL::SQLValue($id);
    $values["prix_mensuel"] = MySQL::SQLValue($prix);
    $values["mode_paiement"] = MySQL::SQLValue($paiement);
    if (!$db->InsertRow("collecte", $values)) {
        $db->Kill($db->Error());
        return false;
    } else {
        $sql = $db->BuildSQLInsert("collecte", $values);
        logg('Enregistrement collecte ', 100, $nextid, $_SESSION['userid']);
        if ($pj != "") {
            $basedir = "upload/collecte";
            if (!file_exists($basedir)) {
                mkdir($basedir, 0, true);
            }
            $newdir = $basedir . "/";
            copyfile($pj, $nextid, $newdir, "Attachement_collecte_");
            autoarchive($newdir . changnom($pj, $nextid, 'Attachement_collecte_'), "Fichier joint collecte  {$nextid}", 100, $nextid, "collecte", "piece_jointe", $_SESSION['userid'], cryptage(session::get('service'), 0));
        }
        return true;
    }
}
Ejemplo n.º 19
0
function add_depense($id, $titre, $fourn, $date_demande, $nbr_depense, $chapitre, $article, $paragraphe, $montant, $pj)
{
    global $db;
    $usrid = $_SESSION['userid'];
    $date = date('Y-m-d-', strtotime($date_demande));
    $values["nature_dep"] = MySQL::SQLValue($titre);
    $values["dat_val"] = MySQL::SQLValue($date);
    $values["fournisseur"] = MySQL::SQLValue($fourn);
    $values["nbr_lignes"] = MySQL::SQLValue($nbr_depense);
    $values["chapitre"] = MySQL::SQLValue($chapitre);
    $values["article"] = MySQL::SQLValue($article);
    $values["paragraphe"] = MySQL::SQLValue($paragraphe);
    $values["montant"] = MySQL::SQLValue($montant);
    $values["etat"] = MySQL::SQLValue(0);
    $values["addby"] = MySQL::SQLValue($usrid);
    if (!$db->InsertRow("depense", $values)) {
        $db->Kill($db->Error());
        return false;
    } else {
        //Update Budget
        //model::load('budget','budget');
        //update_paragraphe($paragraphe,$montant);
        //update_budget($paragraphe,$chapitre,$article);
        logg('Enregistrement Fiche depense ', 100, $id, $_SESSION['userid']);
        // Save PJ to archive
        if ($pj != "") {
            $basedir = $db->QuerySingleValue0("select CONCAT('upload/depense/',YEAR(dat_val),'/',id,'/') from depense where id = {$id}");
            if (!file_exists($basedir)) {
                mkdir($basedir, 0, true);
            }
            $newdir = $basedir . "/";
            copyfile($pj, $id, $newdir, "Attachement_depense_");
            autoarchive($newdir . changnom($pj, $id, 'Attachement_depense_'), "Fichier joint dépense {$id} ", 100, $id, "depense", "pj", $_SESSION['userid'], cryptage(session::get('service'), 0));
        }
        return true;
    }
}
Ejemplo n.º 20
0
<?php

$service = cryptage($_SESSION['service'], 0);
$usrid = $_SESSION['userid'];
global $db;
global $db;
if (!$db->Query("SELECT * FROM users_sys where id= " . tg('iduser'))) {
    $db->Kill("error");
}
if ($db->RowCount() > 0) {
    $array = $db->RowArray();
}
?>
 
<script>
$(function () {
    // validate signup form on keyup and submit
    var validator1 = $("#edit_compteuser").validate({
        rules: {
            firstname: "required",
            lastname: "required",
      
            username: {
                required: true,
                minlength: 2,
                remote: "./?_tsk=check&ajax=1&id=<?php 
echo tg('iduser');
?>
&tb=1&f=pseudo"
            
            },
Ejemplo n.º 21
0
 /**
  * Regenère un mot de passe pour $_POST["uti_email"] puis lui envoie par email
  * Succès : redirige vers la page de connexion avec un message
  * Echec : redirige vers la page "mot de passe oublié" avec un message
  */
 function resetmdp()
 {
     extract($_POST);
     $query = "select * from utilisateur where uti_email='{$uti_email}'";
     $result = Table::$con->query(Table::$con->real_escape_string($query));
     if ($row = $result->fetch_assoc()) {
         $newMdp = substr(uniqid(), 0, 10);
         $uti_mdp = cryptage($newMdp);
         $query = "update utilisateur set uti_mdp='{$uti_mdp}' where uti_id=" . $row["uti_id"];
         Table::$con->query($query);
         $chaine = file_get_contents(BASE_REP . "_mail/tpl_mdpoublie.txt");
         $chaine = str_ireplace("[prenom]", $row["uti_prenom"], $chaine);
         $chaine = str_ireplace("[login]", $row["uti_email_perso"] . "/" . $row["uti_email_pro"], $chaine);
         $chaine = str_ireplace("[mdp]", $newMdp, $chaine);
         $chaine = str_ireplace("[lien]", BASE_URL . "authentification/connexion", $chaine);
         $chaine = str_ireplace("[titreSite]", TITRE_SITE, $chaine);
         require BASE_REP . '_mail/mail_function.php';
         if (!is_null($row["uti_email"]) or !empty($row["uti_email"])) {
             envoyerUnMail(array($row["uti_email_perso"]), "Mot de passe oublié", $chaine, "*****@*****.**");
         }
         self::flashMessage()->success('Un email contenant votre nouveau mot de passe vous a été envoyé');
         header("location:" . BASE_URL . "authentification/connexion/");
     } else {
         self::flashMessage()->error('Identifiant incorrect');
         header("location:" . BASE_URL . "authentification/mdpoublie/message/nouser");
     }
 }
 /**
  * Regenère un mot de passe pour $_POST["uti_email"] puis lui envoie par email
  * Succès : redirige vers la page de connexion avec un message
  * Echec : redirige vers la page "mot de passe oublié" avec un message
  */
 function resetmdp()
 {
     extract($_POST);
     $query = "select * from utilisateur where uti_email='{$uti_email}'";
     $result = Table::$con->query($query);
     if ($row = $result->fetch_assoc()) {
         $newMdp = substr(uniqid(), 0, 10);
         $uti_mdp = cryptage($newMdp);
         $query = "update utilisateur set uti_mdp='{$uti_mdp}' where uti_id=" . $row["uti_id"];
         Table::$con->query($query);
         $chaine = file_get_contents(BASE_REP . "_mail/tpl_mdpoublie.txt");
         $chaine = str_ireplace("[prenom]", $row["uti_prenom"], $chaine);
         $chaine = str_ireplace("[login]", $row["uti_login"], $chaine);
         $chaine = str_ireplace("[mdp]", $newMdp, $chaine);
         $chaine = str_ireplace("[lien]", BASE_URL . "authentification/connexion", $chaine);
         $chaine = str_ireplace("[titreSite]", TITRE_SITE, $chaine);
         envoyerUnMail($row["uti_email"], "Mot de passe oublié", $chaine);
         header("location:" . BASE_URL . "authentification/connexion/message/emailsend");
     } else {
         header("location:" . BASE_URL . "authentification/mdpoublie/message/nouser");
     }
 }
Ejemplo n.º 23
0
 /**
  * Affiche la version crypée de la chaine de caractère contenu dans $_GET["chaine"]
  */
 public function crypte()
 {
     echo cryptage($_GET["chaine"]);
 }