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; } }
/** * 复制文件夹 * @param string $oldDir 原文件夹 * @param string $targetDir 复制后的文件夹名 * @param boolean $overWrite 是否覆盖原文件夹(true:覆盖原文件夹,false:不覆盖原文件夹)默认覆盖 * @return boolean 复制成功返回true,否则返回false */ function copydir($oldDir, $targetDir, $overWrite = true) { $oldDir = path_absolute($oldDir); $targetDir = path_absolute($targetDir); @clearstatcache(); $targetDir = substr($targetDir, -1) == '/' ? $targetDir : $targetDir . '/'; $oldDir = substr($oldDir, -1) == '/' ? $oldDir : $oldDir . '/'; if (!is_dir($oldDir)) { return false; } if (!file_exists($targetDir)) { makedir($targetDir); } $resource = opendir($oldDir); while (($file = readdir($resource)) !== false) { if ($file == '.' || $file == '..') { continue; } if (!is_dir($oldDir . $file)) { copyfile($oldDir . $file, $targetDir . $file, $overWrite); } else { copydir($oldDir . $file, $targetDir . $file, $overWrite); } } @clearstatcache(); if (is_dir($targetDir)) { return true; } else { return false; } }
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; } }
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; } }
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; } }
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; }
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; } }
function adduser($nom, $fnom, $lnom, $pass, $mail, $service, $signe, $id, $agence, $tel, $img) { // $arrayVariable["column name"] = formatted SQL value global $db; $values["nom"] = MySQL::SQLValue($nom); $values["mail"] = MySQL::SQLValue($mail); $values["pass"] = MySQL::SQLValue(md5($pass)); $values["servic"] = MySQL::SQLValue($service); $values["fnom"] = MySQL::SQLValue($fnom); $values["lnom"] = MySQL::SQLValue($lnom); $values["tel"] = MySQL::SQLValue($tel); $values["active"] = MySQL::SQLValue(1); $values["defapp"] = MySQL::SQLValue(3); $values["agence"] = MySQL::SQLValue($agence); $values["signature"] = MySQL::SQLValue(changnom($signe, $id, 'signature_')); $values["photo"] = MySQL::SQLValue(changnom($img, $id, 'photo_')); // Execute the insert $result = $db->InsertRow("users_sys", $values); // If we have an error if (!$result) { // Show the error and kill the script $db->Kill($db->Error()); return false; } else { addrules($id, $service); $newdir = "upload/signature/"; if ($signe != "") { copyfile($signe, $id, $newdir, "signature_"); } if ($img != "") { copyfile($img, $id, $newdir, "signature_"); } return true; } }
function edituser($fnom, $lnom, $service, $tel, $id, $signe, $agence) { global $db; if ($service != NULL) { $values["servic"] = MySQL::SQLValue($service); } $values["fnom"] = MySQL::SQLValue($fnom); $values["lnom"] = MySQL::SQLValue($lnom); $values["active"] = MySQL::SQLValue(1); $values["tel"] = MySQL::SQLValue($tel); $values["agence"] = MySQL::SQLValue($agence); $where["id"] = MySQL::SQLValue($id); if ($signe != NULL) { $values["signature"] = MySQL::SQLValue(changnom($signe, $id, 'signature_')); } // Execute the insert $result = $db->UpdateRows("users_sys", $values, $where); // ajout champs table synchrone $sql = $db->BuildSQLUpdate("users_sys", $values, $where); $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($result); return false; } else { $newdir = "upload/signature/"; if ($signe != NULL) { copyfile($signe, $id, $newdir, "signature_"); } return true; } }
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; } }
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; }
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; } }
function editsalarie($id, $nom, $prenom, $fonction, $salarie, $date, $agence, $service, $matricule, $nom_banque, $num_compte, $taux_anc, $status, $photo, $etatf, $nbrf) { global $db; global $db2; $date_embauche = date('Y-m-d-', strtotime($date)); $values["nom"] = MySQL::SQLValue($nom); $values["prenom"] = MySQL::SQLValue($prenom); $values["fonction"] = MySQL::SQLValue($fonction); $values["date_embauche"] = MySQL::SQLValue($date_embauche); $values["agence"] = MySQL::SQLValue($agence); $values["service"] = MySQL::SQLValue($service); $values["matricule"] = MySQL::SQLValue($matricule); $values["situation_familiale"] = MySQL::SQLValue($etatf); $values["nbr_enfant"] = MySQL::SQLValue($nbrf); $values["status"] = MySQL::SQLValue($status); if ($photo != null) { $values["photo"] = MySQL::SQLValue(changnom($photo, $id, 'photo_')); } $where["id"] = MySQL::SQLValue($id); if (!$db->UpdateRows("info_personnel", $values, $where)) { $db->Kill($db->Error()); return false; } else { $sql = $db->BuildSQLInsert("info_personnel", $values); if ($photo != "") { $basedir = "upload/salarie/"; if (!file_exists($basedir)) { mkdir($basedir, 0, true); } $newdir = $basedir . "/"; copyfile($photo, $id, $newdir, "photo_"); } return true; } }
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; } }
function editnote($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["dat"] = MySQL::SQLValue($date); $where["id"] = MySQL::SQLValue($id); // Execute the insert $result = $db->UpdateRows("noteservice", $values, $where); // ajout champs table synchrone $sql = $db->BuildSQLUpdate("noteservice", $values, $where); $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 Update'); return false; } else { logg('Modification 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; } }
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; } }
function editalbum($titrfr, $titren, $titrar, $img, $id) { global $db; $values["titrfr"] = MySQL::SQLValue($titrfr); $values["titren"] = MySQL::SQLValue($titren); $values["titrar"] = MySQL::SQLValue($titrar); if ($img != "") { $values["album"] = MySQL::SQLValue(changnom($img, $id, "album_")); } $where["id"] = MySQL::SQLValue($id); // Execute the insert $result = $db->UpdateRows("album", $values, $where); // If we have an error if (!$result) { // Show the error and kill the script $db->Kill($result); return false; } else { if ($img != "") { $olddir = "upload/album/"; $newdir = "../upload/album/" . $id . "/"; copyfile($img, $id, $olddir, "album_"); clearDir($newdir); extractzip($olddir, "album_" . $id . ".zip", $id, $newdir); } return true; } }
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; } }
function addnews($titrfr, $titren, $titrar, $contfr, $conten, $contar, $img, $id, $autfr, $auten, $autar, $slider, $dat, $flash, $lien, $photot) { global $db; $basedir = UPLD_REP . "news"; if (!file_exists($basedir)) { mkdir($basedir, 0, true); } $newdir = $basedir . "/"; $next_id_vod = getnextidtable('vod'); $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["modul"] = MySQL::SQLValue("9"); $values["slider"] = MySQL::SQLValue($slider); $values["flash"] = MySQL::SQLValue($flash); $values["arch"] = MySQL::SQLValue("0"); if ($lien != "") { $values["video"] = MySQL::SQLValue($next_id_vod); } $values["img"] = MySQL::SQLValue(changnom($newdir . $img, $id, 'nws_')); $values["img_d"] = MySQL::SQLValue(changnom($newdir . $photot, $id, 'nwst_')); $values["app"] = MySQL::SQLValue('?_tsk=news&id=' . $id); $values["dat"] = MySQL::SQLValue($date); // Execute the insert $result = $db->InsertRow("contenu", $values); // If we have an error if (!$result) { // Show the error and kill the script $db->Kill($db->Error()); return false; } else { if ($img != "") { copyfile($img, $id, $newdir, "nws_"); } if ($photot != "") { copyfile($photot, $id, $newdir, "nwst_"); } if ($lien != "") { addvod($titrfr, $titren, $titrar, $lien); } return true; } }
function addpage($titrfr, $titren, $titrar, $contfr, $conten, $contar, $parent, $img, $id, $titrimgfr, $titrimgar, $ximg, $yimg) { $basedir = UPLD_REP . "page"; if (!file_exists($basedir)) { mkdir($basedir, 0, true); } $newdir = $basedir . "/"; global $db; $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["parent"] = MySQL::SQLValue($parent); $values["app"] = MySQL::SQLValue('?_tsk=page&id=' . $id); if ($titrimgfr != NULL) { $values["titrimgfr"] = MySQL::SQLValue($titrimgfr); } if ($titrimgar != NULL) { $values["titrimgar"] = MySQL::SQLValue($titrimgar); } if ($ximg != NULL) { $values["ximg"] = MySQL::SQLValue($ximg); } if ($yimg != NULL) { $values["yimg"] = MySQL::SQLValue($yimg); } $values["img"] = MySQL::SQLValue(changnom($newdir . $img, $id, 'page_')); // Execute the insert $result = $db->InsertRow("page", $values); //updat link parent $valuesu["app"] = MySQL::SQLValue('#'); $whereu["id"] = MySQL::SQLValue($parent); // Execute the Update $resultu = $db->UpdateRows("page", $valuesu, $whereu); // If we have an error if (!$result && !$resultu) { // Show the error and kill the script $db->Kill('error'); return false; } else { if ($img != "") { copyfile($img, $id, $newdir, "page_"); } return true; } }
function editpage($titrfr, $titren, $titrar, $contfr, $conten, $contar, $parent, $img, $id, $titrimgfr, $titrimgar, $ximg, $yimg) { global $db; $newdir = "../upload/page/"; $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["parent"] = MySQL::SQLValue($parent); if ($titrimgfr != NULL) { $values["titrimgfr"] = MySQL::SQLValue($titrimgfr); } if ($titrimgar != NULL) { $values["titrimgar"] = MySQL::SQLValue($titrimgar); } if ($ximg != NULL) { $values["ximg"] = MySQL::SQLValue($ximg); } if ($yimg != NULL) { $values["yimg"] = MySQL::SQLValue($yimg); } if ($img != "") { $values["img"] = MySQL::SQLValue(changnom($newdir . $img, $id, 'page_')); } $where["id"] = MySQL::SQLValue($id); // Execute the Update $result = $db->UpdateRows("page", $values, $where); // If we have an error if (!$result) { // Show the error and kill the script $db->Kill('Error'); return false; } else { if ($img != "") { $basedir = "upload/page"; if (!file_exists($basedir)) { mkdir($basedir, 0, true); } if (!file_exists($newdir)) { mkdir($newdir, 0, true); } copyfile($img, $id, $newdir, "page_"); } return true; } }
function editnews($titrfr, $titren, $titrar, $contfr, $conten, $contar, $img, $id, $autfr, $auten, $autar, $slider, $dat, $lien, $idvd) { global $db; $newdir = "../upload/news/"; $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["slider"] = MySQL::SQLValue($slider); if ($img != "") { $values["img"] = MySQL::SQLValue(changnom($newdir . $img, $id, 'nws_')); } $values["dat"] = MySQL::SQLValue($date); $where["id"] = MySQL::SQLValue($id); // Execute the insert $result = $db->UpdateRows("contenu", $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 != "") { $basedir = "upload/news"; if (!file_exists($basedir)) { mkdir($basedir, 0, true); } if (!file_exists($newdir)) { mkdir($newdir, 0, true); } copyfile($img, $id, $newdir, "nws_"); } if ($lien != "") { editvod($titrfr, $titren, $titrar, $lien, $idvd); } return true; } }
function addalbum($titrfr, $titren, $titrar, $img, $id) { global $db; $values["titrfr"] = MySQL::SQLValue($titrfr); $values["titren"] = MySQL::SQLValue($titren); $values["titrar"] = MySQL::SQLValue($titrar); $values["album"] = MySQL::SQLValue(changnom($img, $id, 'Album_')); // Execute the insert $result = $db->InsertRow("album", $values); // If we have an error if (!$result) { // Show the error and kill the script $db->Kill($result); return false; } else { copyfile($img, $id); return true; } }
function makeprodir() { $app_path = $this->getapppath(); //获取生成程序的根目录 $tpl_path = $this->gettplpath(); //获取程序模板的根目录 deldir($app_path); ////common.php文件 tpmk_dir($app_path . '/Lib/Model/'); tpmk_dir($app_path . '/Lib/Action/'); tpmk_dir($app_path . '/Cache/'); //生成Cache目录 tpmk_dir($app_path . '/Common/'); //生成Common目录 tpmk_dir($app_path . '/Conf/'); //生成Conf目录 tpmk_dir($app_path . '/Data/'); //生成Data目录 tpmk_dir($app_path . '/Lang/'); //生成Lang目录 tpmk_dir($app_path . '/Logs/'); //生成Logs目录 tpmk_dir($app_path . '/Temp/'); //生成Temp目录 tpmk_dir($app_path . '/Lib/Com/'); //生成Com目录 tpmk_dir($app_path . '/Tpl/default/Public/'); //生成Tpl目录 copyfile($tpl_path . '/common.php', $app_path . '/Common/common.php'); ////common.php文件 copyfile($tpl_path . '/Action_tpl/PublicAction.class.php', $app_path . '/Lib/Action/PublicAction.class.php'); copyfile($tpl_path . '/Action_tpl/PublicAction.class.php', $app_path . '/Lib/Action/PublicAction.class.php'); ////PublicAction.class.php文件 copydir($tpl_path . '/Static_tpl', $app_path . '/Tpl/default'); ////common.php文件 copydir($tpl_path . '/Com_tpl', $app_path . '/Lib/Com'); ////common.php文件 $this->installtags(); //安装标签 }
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; }
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)); } */ }
function editalbum($titrfr, $titren, $titrar, $img, $id) { global $db; $values["titrfr"] = MySQL::SQLValue($titrfr); $values["titren"] = MySQL::SQLValue($titren); $values["titrar"] = MySQL::SQLValue($titrar); $values["album"] = MySQL::SQLValue(changnom($img, $id)); $where["id"] = MySQL::SQLValue($id); // Execute the insert $result = $db->UpdateRows("album", $values, $where); // If we have an error if (!$result) { // Show the error and kill the script $db->Kill($result); return false; } else { $a_del = "upload/album/album_" . $id . ".zip"; clearDir($a_del); //unlink("upload/album/album_".$id.".zip"); copyfile($img, $id); return true; } }
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; } }
<?php ///////////////////////////////////////////////////////////////////////////////////// // getdailycache.php - retrieves dailycache.txt, comingevents.txt, tidedata.txt // concolidates daily feeds in one big pull, rather than 3 small ones. // rfb. 6/6/16. copyfile("dailycache.txt", ""); copyfile("comingevents.txt", "COMINGEVENTS"); copyfile("tidedata.txt", "TIDES"); // log it date_default_timezone_set("America/Los_Angeles"); // write the time in PDT/PST $log = 'dailycachelog.txt'; $tlh = fopen($log, 'a'); fwrite($tlh, date('c') . ',V=' . $_GET['VER'] . ",K=" . $_GET['KIND'] . ',N=' . $_GET['N'] . ',P=' . $_GET['P'] . ',I=' . $_SERVER['REMOTE_ADDR'] . "\n"); return; // copyfile from file to stdout // diskfile = file name // label = label that surrounds the content function copyfile($diskfile, $label) { $theData = file_get_contents($diskfile); if ($theData != "") { if ($label != "") { echo $label . "\n"; } echo $theData; if ($label != "") { echo $label . "END\n"; } }
public function install() { global $_M; require_once $this->savedir . 'install.class.php'; $install = new install(); @($install->step = $this->info['step']); if (method_exists($install, 'getfile')) { $copydir = $install->getfile(); } $copydir = $copydir ? $copydir : 'file/'; //安装文件 if ($copydir != 'notcopy') { $copyfile = $this->savedir . $copydir; $resource = opendir($copyfile); while (($file = readdir($resource)) !== false) { if ($file == '.' || $file == '..') { continue; } if (is_dir($copyfile . $file)) { if ($file == 'admin') { copydir($copyfile . "admin", PATH_WEB . $_M['config']['met_adminfile']); } else { copydir($copyfile . $file, PATH_WEB . $file); } } else { copyfile($copyfile . $file, PATH_WEB . $file); } } } //安装数据 $re = $install->dosql(); if ($re == 'complete' || !$re) { return $this->suc_data('complete', 0, $_M['word']['installation_complete']); } else { if ($re == 'next') { if (method_exists($install, 'html')) { $html_re = $install->html(); } if ($html_re) { $html = $html_re; } else { $html = "{$_M['word']['installation']}..."; } return $this->suc_data('install', $this->info['step'] + 1, $html); } else { if ($re == 'recheck') { return $this->suc_data('check', 1, $_M['word']['detection'] . '...'); } else { return $this->fail_data($re); } } } }