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 editnews($titrfr, $titren, $titrar, $contfr, $conten, $contar, $img, $id, $autfr, $auten, $autar, $slider, $dat, $flash, $lien, $idvd, $photot) { global $db; $next_id_vod = getnextidtable('vod'); 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); $values["flash"] = MySQL::SQLValue($flash); if ($idvd == null && $lien != null) { $values["video"] = MySQL::SQLValue($next_id_vod); } if ($img != "") { $values["img"] = MySQL::SQLValue(changnom($newdir . $img, $id, 'nws_')); } if ($photot != "") { $values["img_d"] = MySQL::SQLValue(changnom($newdir . $photot, $id, 'nwst_')); } $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 ($photot != "") { $basedir = "upload/news"; if (!file_exists($basedir)) { mkdir($basedir, 0, true); } if (!file_exists($newdir)) { mkdir($newdir, 0, true); } copyfile($photot, $id, $newdir, "nwst_"); } if ($idvd == null && $lien != null) { addvod($titrfr, $titren, $titrar, $lien); } else { if ($lien != "") { editvod($titrfr, $titren, $titrar, $lien, $idvd); } } return true; } }
<?php //addnews($titrfr,$titren,$titrar,$contfr,$conten,$contar,$img,$id,$autfr,$auten,$autar,$slider) if (tp('verif') == 1) { $nextid = getnextidtable('vod'); model::load('vod', 'addvod'); if (!addvod(tp('titrfr'), tp('titren'), tp('titrar'), tp('vodfr'), tp('voden'), tp('vodar'), $nextid, tp('sindx'))) { exit("0"); } else { exit("1"); } } else { view::load('vod', 'addvod'); }