// // ------------------------------------------------------------------------- // // Original Author: Pascal Le Boustouller // Author Website : http://www.perso-search.com/e-xoopsien/ // Licence Type : GPL // ------------------------------------------------------------------------- // include("header.php"); include(XOOPS_ROOT_PATH."/modules/MyKanonces/cache/config.php"); include(XOOPS_ROOT_PATH."/modules/MyKanonces/include/functions.php"); include_once(XOOPS_ROOT_PATH."/modules/MyKanonces/class/arbre.php"); $mytree = new XoopsArbre($db->prefix("kan_categories"),"cid","pid"); if($xoopsConfig['startpage'] == "MyKanonces"){ $xoopsOption['show_rblock'] =1; include(XOOPS_ROOT_PATH."/header.php"); make_cblock(); echo "
"; }else{ $xoopsOption['show_rblock'] =0; include(XOOPS_ROOT_PATH."/header.php"); } echo ""; # function index ##################################################### function index() { global $db, $xoopsConfig, $xoopsUser, $moderated, $myts, $mytree, $souscat, $classm, $nbsouscat, $meta, $newann, $affichnbann; OpenTable(); echo ""._CLA_ADDFROM." ".$meta['title']."

"; if ($moderated == '1') { list($propo) = $db->fetch_row($db->query("SELECT COUNT(*) FROM ".$db->prefix("kan_annonces")." WHERE valid='No'")); if ( $xoopsUser ) { if ( $xoopsUser->isAdmin() ) { echo "

"; OpenTable(); echo ""._CLA_ADMINCADRE."
\n"; if($propo == 0) { echo "

"._CLA_NO_CLA."
"._CLA_ACCESADMIN."
"; } else { echo "

"._CLA_THEREIS." $propo "._CLA_WAIT."
"._CLA_SEEIT."
"; } CloseTable(); echo "

"; } } } $intro = join('', file("./cache/intro.php")); echo "".$myts->makeTareaData4Show($intro, 1, 1, 1)."

"; $result=$db->query("SELECT cid, title, img FROM ".$db->prefix("kan_categories")." WHERE pid = 0 ORDER BY $classm") or die("Error"); list($ncatp) = $db->fetch_row($db->query("SELECT COUNT(*) FROM ".$db->prefix("kan_categories")." WHERE pid=0")); echo "

"._CLA_SEARCHANN."

\n"; echo "
"; echo "\n"; $count = 1; while($myrow = $db->fetch_array($result)) { $cid = $myrow['cid']; $title = $myts->makeTboxData4Show($myrow['title']); echo "
  $title"; if ($affichnbann == "1") { $totallink = getTotalItems($myrow['cid'], Yes); echo " ($totallink)"; } echo "
"; if ($souscat == 1) { // get child category objects $arr=array(); $arr=$mytree->getFirstChild($myrow['cid'], "$classm"); $space = 0; $chcount = 1; foreach($arr as $ele){ $chtitle=$myts->makeTboxData4Show($ele['title']); if ($chcount>$nbsouscat){ echo ", ..."; break; } if ($space>0) { echo ", "; } echo "".$chtitle.""; $space++; $chcount++; } } $bis = ($ncatp+1)/2; $bis = (int)$bis; if ($count==$bis) { echo "
"; } $count++; } echo "
"; echo "
"; list($ann) = $db->fetch_row($db->query("SELECT COUNT(*) FROM ".$db->prefix("kan_annonces")." WHERE valid='Yes'")); list($catt) = $db->fetch_row($db->query("SELECT COUNT(*) FROM ".$db->prefix("kan_categories")."")); echo "
"._CLA_ACTUALY." $ann "._CLA_ANNONCES." "._CLA_INCAT." $catt "._CLA_CAT3.""; if ($moderated == '1') { echo "
"._CLA_AND." $propo "._CLA_WAIT3.""; } echo ".
"; echo "
"; CloseTable(); if ($newann == 1) { echo "

"; OpenTable(); showNew(); CloseTable(); } copyright(); SupprClaDay(); } # function view (categories) ##################################################### function view($cid, $debut, $ord, $class) { global $db, $xoopsConfig, $nb_affichage, $myts, $mytree, $imagecat, $classm, $meta; include_once(XOOPS_ROOT_PATH.'/class/xoopspagenav.php'); OpenTable(); $pathstring = ""._CLA_MAIN." "; $nicepath = $mytree->getNicePathFromId($cid, "title", "index.php?pa=view"); $pathstring .= $nicepath; list($nbe) = $db->fetch_row($db->query("SELECT COUNT(*) FROM ".$db->prefix("kan_annonces")." where valid='Yes' AND cid='$cid'")); echo $pathstring." ($nbe)

"; echo "

[ "._CLA_ADDANNONCE2." | "._CLA_SEARCHANN." ]

"; $count = 0; if ($debut=="") { $debut=0; } $pagenav = new XoopsPageNav($nbe, $nb_affichage, $debut, "pa=view&cid=$cid&class=$class&ord=$ord&debut", ""); $subresult=$db->query("select cid, title, img from ".$db->prefix("kan_categories")." where pid=$cid ORDER BY $classm"); $numrows = $db->num_rows($subresult); if ($numrows != 0) { $scount = 0; echo "

"._CLA_AVAILAB."

" .""; while(list($ccid, $title, $img) = $db->fetch_row($subresult)) { $title = $myts->makeTboxData4Show($title); $numrows = getTotalItems($ccid, Yes); echo ""; $scount++; if ($scount==4) { echo ""; $scount = 0; } } if ($count != 0) { echo "
  $title ($numrows)"; categorynewgraphic($ccid); echo "  
"; } else { $cols = 4-$scount; echo " "; } } showViewAnnonces($debut, $cid, $nb_affichage, $nbe, $ord, $class); echo "
"; if(!isset($debut)) $debut=0; // Show navigation bar echo "
".$pagenav->renderNav(3, 3)."
"; CloseTable(); copyright(); } # function viewannonces ##################################################### function viewannonces($lid) { global $db, $xoopsConfig, $xoopsUser, $monnaie, $claday, $ynprice, $myts, $meta; $result=$db->query("SELECT lid, cid, title, type, description, tel, price, typeprix, date, email, submitter, usid, town, country, valid, photo, view FROM ".$db->prefix("kan_annonces")." WHERE lid = '$lid'"); $recordexist = $db->num_rows($result); OpenTable(); echo ""._CLA_MAIN." » "._CLA_DETAIL."

"; if ($recordexist) { list($lid, $cid, $title, $type, $description, $tel, $price, $typeprix, $date, $email, $submitter, $usid, $town, $country, $valid, $photo, $view)= $db->fetch_row($result); $db->query("UPDATE ".$db->prefix("kan_annonces")." SET view=view+1 WHERE lid = '$lid'"); $date2 = $date + ($claday*86400); $date = formatTimestamp($date,"s"); $date2 = formatTimestamp($date2,"s"); $title = $myts->makeTboxData4Show($title); $type = $myts->makeTboxData4Show($type); $description = $myts->makeTboxData4Show($description); $tel = $myts->makeTboxData4Show($tel); $price = $myts->makeTboxData4Show($price); $typeprix = $myts->makeTboxData4Show($typeprix); $submitter = $myts->makeTboxData4Show($submitter); $town = $myts->makeTboxData4Show($town); $country = $myts->makeTboxData4Show($country); $imprD = "\""._CLA_PRINT."\" "; $envD = "\""._CLA_FRIENDSEND."\""; echo "
"._CLA_ANNFROM." "; if ($usid > 0) { echo "$submitter"; } else { echo "$submitter"; } echo " n $lid ("._CLA_VIEW2." $view)"; if ($xoopsUser) { $calusern = $xoopsUser->getVar("uid", "E"); if ($usid == $calusern) { echo "    \""._CLA_MODIFANN."\" \""._CAL_SUPPRANN."\""; } } echo"

"; if ( $xoopsUser ) { if ( $xoopsUser->isAdmin() ) { echo "\""._CLA_MODADMIN."\""; } } echo " $type : $title
$description

"; if ($ynprice == 1) { if ($price > 0) { echo""._CLA_PRICE2." $price $monnaie - $typeprix
"; } } echo ""._CLA_CONTACT." "._CLA_BYMAIL2.""; if ($tel) { echo "
"._CLA_TEL." $tel"; } if ($town) { echo "
"._CLA_TOWN." $town"; } if ($country) { echo "
"._CLA_COUNTRY." $country"; } if ($photo) { echo "

"; } else { echo "

"; } $result8 = $db->query("select title from ".$db->prefix("kan_categories")." where cid='$cid'"); list($ctitle) = $db->fetch_row($result8); echo ""._CLA_CAT2." $ctitle"; echo "
"._CLA_DATE2." $date "._CLA_DISPO." $date2    $imprD $envD"; echo "

"; } else { echo "

"._CLA_NOCLAS."
"; } CloseTable(); copyright(); } # function categorynewgraphic ##################################################### function categorynewgraphic($cat) { global $db; $newresult = $db->query("select date from ".$db->prefix("kan_annonces")." where cid=$cat and valid = 'Yes' order by date desc limit 1"); list($timeann)= $db->fetch_row($newresult); echo " "; $count = 1; $startdate = (time()-(86400 * $count)); if ($startdate < $timeann) { echo ""; } } switch($pa) { case "viewannonces": viewannonces($lid); break; case "view": view($cid, $debut, $ord, $class); break; case "views": views($sid, $debut); break; default: index(); break; } include(XOOPS_ROOT_PATH."/footer.php"); ?>