// // ------------------------------------------------------------------------- // // Original Author: Pascal Le Boustouller // Author Website : http://www.perso-search.com/e-xoopsien/ // Licence Type : GPL // ------------------------------------------------------------------------- // include("header.php"); function index($cid) { global $myts, $xoopsUser, $annoadd, $xoopsModule; include(XOOPS_ROOT_PATH."/modules/MyAnnonces/cache/config.php"); include(XOOPS_ROOT_PATH."/modules/MyAnnonces/include/functions.php"); if (!$xoopsUser && $annoadd == 0) { redirect_header(XOOPS_URL."/user.php",3,_CLA_FORMEMBERS2); exit(); } else { include(XOOPS_ROOT_PATH."/header.php"); OpenTable(); echo ""._CLA_MAIN." » "._CLA_ADDANNONCE3."

\n"; $condition = join('', file("./cache/condition.txt")); echo "".$myts->makeTareaData4Show($condition, 1, 1, 1)."

"; echo "

[ "._CLA_CONDITIONOK." | "._CLA_CONDITIONNO." ]
"; CloseTable(); copyright(); include(XOOPS_ROOT_PATH."/footer.php"); } } function addindex($cid) { global $db, $bcoosConfig, $xoopsUser, $xoopsTheme, $photomax, $xoopsModule, $ynprice; include(XOOPS_ROOT_PATH."/modules/MyAnnonces/cache/config.php"); include(XOOPS_ROOT_PATH."/modules/MyAnnonces/include/functions.php"); include_once(XOOPS_ROOT_PATH."/modules/MyAnnonces/class/arbre.php"); $mytree = new XoopsArbre($db->prefix("ann_categories"),"cid","pid"); if ($cid =="") { redirect_header("index.php",1,_CLA_ADDANNONCE); exit(); } if (!$xoopsUser && $annoadd == 0) { redirect_header(XOOPS_URL."/user.php",3,_CLA_FORMEMBERS2); exit(); } else { $photomax1=$photomax/1024; include(XOOPS_ROOT_PATH."/header.php"); echo ""; list($numrows) = $db->fetchRow($db->query("select cid, title from ".$db->prefix("ann_categories")."")); if ($numrows>0) { OpenTable(); echo ""._CLA_MAIN." » "._CLA_ADDANNONCE3."

"; if ($moderated == '1') { echo ""._CLA_ANNMODERATE." $claday "._CLA_DAY."

"; } else { echo ""._CLA_ANNNOMODERATE." $claday "._CLA_DAY."

"; } echo "
"; echo ""; $result2 = $db->query("select nom_type from ".$db->prefix("ann_type")." order by nom_type"); echo ""; echo ""; if ($ynprice == 1) { if ($affprix == 1) { echo ""; } } if($xoopsUser) { $iddd =$xoopsUser->getVar("uid", "E"); $idd =$xoopsUser->getVar("name", "E"); $idde =$xoopsUser->getVar("email", "E"); } $time = time(); echo "
"._CLA_TYPE."
"._CLA_CAT2." "; $requete = $db->query("select title, affprix from ".$db->prefix("ann_categories")." where cid=".$cid.""); list($title, $affprix) = $db->fetchRow($requete); echo "» $title
"._CLA_TITLE2."
"._CLA_ANNONCE."
"._CLA_CHARMAX."
"._CLA_IMG.""; include_once(XOOPS_ROOT_PATH."/class/upload.class.php"); $upload = new Upload(); $upload->printFormField("photo"); echo " (< "; printf ("%.2f ko",$photomax1); echo ")
"._CLA_PRICE2." $monnaie"; $result3 = $db->query("select nom_prix from ".$db->prefix("ann_prix")." order by id_prix"); echo "
"._CLA_SURNAME."
"._CLA_EMAIL."
"._CLA_TEL."
"._CLA_TOWN."
"._CLA_COUNTRY."
"; if ($moderated == '1') { if ($xoopsUser && $xoopsUser->isAdmin($xoopsModule->mid())) { echo ""; } else { echo ""; } } else { echo ""; } echo "
"; CloseTable(); copyright(); include(XOOPS_ROOT_PATH."/footer.php"); } } } function AddAnnoncesOk($lid, $cat, $titre, $type, $description, $tel, $price, $typeprix, $date, $email, $submitter, $usid, $town, $country, $valid, $photo, $photo_size, $photo_name, $_FILES) { global $db, $bcoosConfig, $photomax, $destination, $myts; include(XOOPS_ROOT_PATH."/modules/MyAnnonces/cache/config.php"); include(XOOPS_ROOT_PATH."/modules/MyAnnonces/include/functions.php"); $title = $myts->makeTboxData4Save($title); $type = $myts->makeTboxData4Save($type); $description = $myts->makeTboxData4Save($description); $tel = $myts->makeTboxData4Save($tel); $price = $myts->makeTboxData4Save($price); $typeprix = $myts->makeTboxData4Save($typeprix); $submitter = $myts->makeTboxData4Save($submitter); $town = $myts->makeTboxData4Save($town); $country = $myts->makeTboxData4Save($country); if ( !empty($_FILES['photo']['name']) ) { include_once(XOOPS_ROOT_PATH."/class/upload.class.php"); $upload = new Upload(); $upload->setAllowedMimeTypes(".gif|.jpeg|.jpg|.png"); $upload->setUploadPath(XOOPS_ROOT_PATH."/modules/MyAnnonces/images_ann"); $upload->setDestinationFileName('photo'); $upload->setFileName($lid); $result = $upload->doUpload(); if ($result == false) { $errors = $upload->getUploadErrors(); $errorstring = ""; $errorstring .= "::Errors occured::
\n"; while(list($filename,$values) = each($errors)) { $errorstring .= "File: " . $filename . "
"; $count = count($values); for($i=0; $i<$count; $i++) { $errorstring .= "==>" . $values[$i] . "
"; } } redirect_header("addannonces.php?cid=$cat", 3, $errorstring); exit(); } } $db->query("INSERT INTO ".$db->prefix("ann_annonces")." values ('', '$cat', '$titre', '$type', '$description', '$tel', '$price', '$typeprix', '$date', '$email', '$submitter', '$usid', '$town', '$country', '$valid', '".$upload->FileName.".".$upload->getFileExtension()."', '0')"); redirect_header("index.php",1,_CLA_ANNADDED); exit(); } switch($op) { case "AddAnnoncesOk": AddAnnoncesOk($lid, $cid, $titre, $type, $description, $tel, $price, $typeprix, $date, $email, $submitter, $usid, $town, $country, $valid, $photo, $photo_size, $photo_name, $_FILES); break; case "addindex": addindex($cid); break; default: index($cid); break; } ?>