// // ------------------------------------------------------------------------- // // Original Author: Pascal Le Boustouller // Author Website : pascal.e-xoops@perso-search.com // Licence Type : GPL // ------------------------------------------------------------------------- // include("header.php"); include_once (XOOPS_ROOT_PATH."/modules/myAds/include/config.php"); include_once (XOOPS_ROOT_PATH."/modules/myAds/include/functions.php"); include_once (XOOPS_ROOT_PATH."/modules/myAds/class/arbre.php"); $mytree = new XoopsArbre($xoopsDB->prefix("ann_categories"),"cid","pid"); function index() { global $xoopsDB, $xoopsConfig, $xoopsUser, $xoopsTpl, $moderated, $myts, $mytree, $souscat, $classm, $nbsouscat, $meta, $newann; $xoopsTpl->assign('add_from', _CLA_ADDFROM." ".$xoopsConfig['sitename']); $xoopsTpl->assign('add_from_title', _CLA_ADDFROM ); $xoopsTpl->assign('add_from_sitename', $xoopsConfig['sitename']); if ($moderated == '1') { $result = $xoopsDB->query("select COUNT(*) FROM ".$xoopsDB->prefix("ann_annonces")." WHERE valid='No'"); list($propo) = $xoopsDB->fetchRow($result); $xoopsTpl->assign('moderated', true); if ($xoopsUser) { if ($xoopsUser->isAdmin()) { $xoopsTpl->assign('admin_block', _CLA_ADMINCADRE); if($propo == 0) { $xoopsTpl->assign('confirm_ads', _CLA_NO_CLA); } else { $xoopsTpl->assign('confirm_ads', _CLA_THEREIS." $propo "._CLA_WAIT."
"._CLA_SEEIT.""); } } } } $result=$xoopsDB->query("select cid, title, img FROM ".$xoopsDB->prefix("ann_categories")." WHERE pid = 0 ORDER BY $classm") or die("Error"); list($ncatp) = $xoopsDB->fetchRow($xoopsDB->query("select COUNT(*) FROM ".$xoopsDB->prefix("ann_categories")." WHERE pid=0")); $count = 0; while($myrow = $xoopsDB->fetchArray($result)) { $a_cat = array(); $cid = $myrow['cid']; $title = $myts->makeTboxData4Show($myrow['title']); // $totallink = getTotalItems($myrow['cid'], _YES); $a_cat['image'] = ""; $a_cat['link'] = "$title"; $a_cat['cid'] = $myrow['cid']; $a_cat['title'] = $myts->makeTboxData4Show($myrow['title']); $a_cat['img'] = XOOPS_URL."/modules/myAds/images/cat/".$myrow['img']; $a_cat['count'] = getTotalItems($myrow['cid'], _YES); if ($souscat == '1') { // get child category objects $arr=array(); $arr=$mytree->getFirstChild($myrow['cid'], "$classm"); $space = 0; $chcount = 1; $subcat = ''; foreach($arr as $ele) { $chtitle=$myts->makeTboxData4Show($ele['title']); if ($chcount > $nbsouscat) { $subcat .= ", ..."; break; } if ($space > 0) { $subcat .= ", "; } $subcat .= "".$chtitle.""; $space++; $chcount++; $a_cat['subcat'] = $subcat; } } $bis = ($ncatp+1)/2; $bis = (int)$bis; $a_cat['i'] = $count; $xoopsTpl->append('categories', $a_cat); $count++; } $xoopsTpl->assign('cat_count', $count-1); list($ann) = $xoopsDB->fetchRow($xoopsDB->query("select COUNT(*) FROM ".$xoopsDB->prefix("ann_annonces")." WHERE valid='Yes'")); list($catt) = $xoopsDB->fetchRow($xoopsDB->query("select COUNT(*) FROM ".$xoopsDB->prefix("ann_categories")."")); $xoopsTpl->assign('total_annonces', _CLA_ACTUALY." $ann "._CLA_ANNONCES." "._CLA_INCAT." $catt "._CLA_CAT2); if ($moderated == '1') { $xoopsTpl->assign('total_confirm', _CLA_AND." $propo "._CLA_WAIT3); } if ($newann == '1') { showNew(); } copyright(); SupprClaDay(); } function view($cid, $debut) { global $xoopsDB, $xoopsTpl, $xoopsConfig, $nb_affichage, $myts, $mytree, $imagecat, $classm, $meta; include_once (XOOPS_ROOT_PATH."/modules/myAds/class/nav.php"); $xoopsTpl->assign('add_from', _CLA_ADDFROM." ".$xoopsConfig['sitename']); $xoopsTpl->assign('add_from_title', _CLA_ADDFROM ); $xoopsTpl->assign('add_from_sitename', $xoopsConfig['sitename']); $xoopsTpl->assign('add_annonce', ""._CLA_ADDANNONCE2.""); $count = 0; if (!$debut) { $debut = 0; } $x=0; $i=0; $requete = $xoopsDB->query("select cid, pid, title from ".$xoopsDB->prefix("ann_categories")." where cid=".$cid.""); list($ccid, $pid, $title) = $xoopsDB->fetchRow($requete); $title = $myts->makeTboxData4Show($title); $varid[$x] = $ccid; $varnom[$x] = $title; list($nbe) = $xoopsDB->fetchRow($xoopsDB->query("select COUNT(*) FROM ".$xoopsDB->prefix("ann_annonces")." where valid='Yes' AND cid='$cid'")); $pagenav = new PageNav($nbe, $nb_affichage, $debut, "pa=view&cid=$cid&debut", ""); if($pid!=0) { $x=1; while($pid!=0) { $requete2 = $xoopsDB->query("select cid, pid, title from ".$xoopsDB->prefix("ann_categories")." where cid=".$pid.""); list($ccid, $pid, $title) = $xoopsDB->fetchRow($requete2); $title = $myts->makeTboxData4Show($title); $varid[$x] = $ccid; $varnom[$x] = $title; $x++; } $x=$x-1; } $subcats = ''; while($x!=-1) { $subcats .= " » ".$varnom[$x].""; $x=$x-1; } $xoopsTpl->assign('nav_main', ""._CLA_MAIN.""); $xoopsTpl->assign('nav_sub', $subcats); $xoopsTpl->assign('nav_subcount', $nbe); $subresult=$xoopsDB->query("select cid, title, img from ".$xoopsDB->prefix("ann_categories")." where pid=$cid ORDER BY $classm"); $numrows = $xoopsDB->getRowsNum($subresult); if ($numrows != 0) { $scount = 0; $xoopsTpl->assign('availability', _CLA_AVAILAB); while(list($ccid, $title, $img) = $xoopsDB->fetchRow($subresult)) { $a_cat = array(); $title = $myts->makeTboxData4Show($title); $numrows = getTotalItems($ccid, _YES); $a_cat['image'] = ""; $a_cat['link'] = "$title"; $a_cat['adcount'] = $numrows; $a_cat['i'] = $scount; $a_cat['new'] = categorynewgraphic($ccid); $scount++; if ($scount==4) { $scount = 0; } $xoopsTpl->append('subcategories', $a_cat); } if ($count == 0) { $cols = 4-$scount; } $xoopsTpl->assign('subcat_count', $scount - 1); } showViewAnnonces($debut, $cid, $nb_affichage, $nbe); if(!isset($debut)) { $debut=0; } //show render nav $xoopsTpl->assign('nav_page', $pagenav->renderNav()); copyright(); } function viewannonces($lid) { global $xoopsDB, $xoopsConfig, $xoopsTpl, $xoopsUser, $monnaie, $claday, $ynprice, $myts, $meta, $nb_affichage; global $xoopsModule, $xoopsModuleConfig; include_once (XOOPS_ROOT_PATH."/modules/myAds/class/nav.php"); $result=$xoopsDB->query("select lid, cid, title, type, description, tel, price, typeprix, date, email, submitter, usid, town, country, valid, photo, view FROM ".$xoopsDB->prefix("ann_annonces")." WHERE lid = '$lid'"); $recordexist = $xoopsDB->getRowsNum($result); $xoopsTpl->assign('add_from', _CLA_ADDFROM." ".$xoopsConfig['sitename']); $xoopsTpl->assign('add_from_title', _CLA_ADDFROM ); $xoopsTpl->assign('add_from_sitename', $xoopsConfig['sitename']); $xoopsTpl->assign('ad_exists', $recordexist); $count = 0; $x=0; $i=0; $requete2 = $xoopsDB->query("select cid from ".$xoopsDB->prefix("ann_annonces")." where lid=".$lid.""); list($cid) = $xoopsDB->fetchRow($requete2); $requete = $xoopsDB->query("select cid, pid, title from ".$xoopsDB->prefix("ann_categories")." where cid=".$cid.""); list($ccid, $pid, $title) = $xoopsDB->fetchRow($requete); $title = $myts->makeTboxData4Show($title); $varid[$x] = $ccid; $varnom[$x] = $title; list($nbe) = $xoopsDB->fetchRow($xoopsDB->query("select COUNT(*) FROM ".$xoopsDB->prefix("ann_annonces")." where valid='Yes' AND cid='$cid'")); if($pid!=0) { $x=1; while($pid!=0) { $requete2 = $xoopsDB->query("select cid, pid, title from ".$xoopsDB->prefix("ann_categories")." where cid=".$pid.""); list($ccid, $pid, $title) = $xoopsDB->fetchRow($requete2); $title = $myts->makeTboxData4Show($title); $varid[$x]=$ccid; $varnom[$x]=$title; $x++; } $x=$x-1; } $subcats = ''; while($x!=-1) { $subcats .= " » ".$varnom[$x].""; $x=$x-1; } $xoopsTpl->assign('nav_main', ""._CLA_MAIN.""); $xoopsTpl->assign('nav_sub', $subcats); $xoopsTpl->assign('nav_subcount', $nbe); if ($recordexist) { list($lid, $cid, $title, $type, $description, $tel, $price, $typeprix, $date, $email, $submitter, $usid, $town, $country, $valid, $photo, $view)=$xoopsDB->fetchRow($result); // Specification for Japan: move after for view count up judge // $xoopsDB->queryf("UPDATE ".$xoopsDB->prefix("ann_annonces")." SET view=view+1 WHERE lid = '$lid'"); // $useroffset = ""; // if($xoopsUser) // { // $timezone = $xoopsUser->timezone(); // if(isset($timezone)) // $useroffset = $xoopsUser->timezone(); // else // $useroffset = $xoopsConfig['default_TZ']; // } // Specification for Japan: add $viewcount_judge for view count up judge $viewcount_judge = true ; $useroffset = ""; if($xoopsUser) { $timezone = $xoopsUser->timezone(); if(isset($timezone)) { $useroffset = $xoopsUser->timezone(); }else { $useroffset = $xoopsConfig['default_TZ']; } // Specification for Japan: view count up judge if (($xoopsUser->getVar("uid") == 1)||($xoopsUser->getVar("uid") ==$usid)) { $viewcount_judge = false ; } } // Specification for Japan: view count up judge if ($viewcount_judge == true ){ $xoopsDB->queryF("UPDATE ".$xoopsDB->prefix("ann_annonces")." SET view=view+1 WHERE lid = '$lid'"); } $date = ($useroffset*3600) + $date; $date2 = $date + ($claday*86400); $date = formatTimestamp($date,"s"); $date2 = formatTimestamp($date2,"s"); $title = $myts->makeTboxData4Show($title); $type = $myts->makeTboxData4Show($type); // $description = $myts->makeTboxData4Show($description); $description = $myts->makeTareaData4Show($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."\""; if ($usid > 0) { $xoopsTpl->assign('submitter', _CLA_ANNFROM . " $submitter"); } else { $xoopsTpl->assign('submitter', _CLA_ANNFROM . " $submitter"); } // Add PM by Tom //$contact_pm ="\"".sprintf(_SENDPMTO,$xoopsUser-getVar('uname'))."\" />"; //$xoopsTpl->assign('contact_pm', "$contact_pm"); $xoopsTpl->assign('read', "$view " . _CLA_VIEW2); if ($xoopsUser) { $calusern = $xoopsUser->getVar("uid", "E"); if ($usid == $calusern) { $xoopsTpl->assign('modify', "\""._CLA_MODIFANN."\" \""._CAL_SUPPRANN."\""); } if ($xoopsUser->isAdmin()) { $xoopsTpl->assign('admin', "\""._CLA_MODADMIN."\""); } } $xoopsTpl->assign('type', $type); $xoopsTpl->assign('title', $title); $xoopsTpl->assign('description', $description); if ($ynprice == 1 && $price > 0) { $xoopsTpl->assign('price', '' . _CLA_PRICE2 . " $price $monnaie - $typeprix"); $xoopsTpl->assign('price_head', _CLA_PRICE2 ); $xoopsTpl->assign('price_price', "$price $monnaie"); $xoopsTpl->assign('price_typeprix', "$typeprix"); }elseif ($ynprice == 1) { $xoopsTpl->assign('price_head', _CLA_PRICE2 ); $xoopsTpl->assign('price_price', ""); $xoopsTpl->assign('price_typeprix', "$typeprix"); } $contact = '' . _CLA_CONTACT." "._CLA_BYMAIL2.""; $xoopsTpl->assign('contact_head', _CLA_CONTACT); $xoopsTpl->assign('contact_email', ""._CLA_BYMAIL2.""); if ($tel) { $contact .= "
"._CLA_TEL." $tel"; $xoopsTpl->assign('contact_tel_head', _CLA_TEL); $xoopsTpl->assign('contact_tel', "$tel"); } $contact .= "
"; if ($town) { $contact .= "
"._CLA_TOWN." $town"; $xoopsTpl->assign('local_town', "$town"); } if ($country) { $contact .= "
"._CLA_COUNTRY." $country"; $xoopsTpl->assign('local_country', "$country"); } $xoopsTpl->assign('contact', $contact); $xoopsTpl->assign('local_head', _CLA_LOCAL); if ($photo) { $xoopsTpl->assign('photo', "\"$title\""); } $xoopsTpl->assign('date', _CLA_DATE2." $date "._CLA_DISPO." $date2    $imprD $envD"); }else { $xoopsTpl->assign('no_ad', _CLA_NOCLAS); } $result8 = $xoopsDB->query("select title from ".$xoopsDB->prefix("ann_categories")." where cid=$cid"); list($ctitle) = $xoopsDB->fetchRow($result8); $xoopsTpl->assign('link_main', ""._CLA_MAIN.""); $xoopsTpl->assign('link_cat', ""._CLA_GORUB." $ctitle"); copyright(); } function categorynewgraphic($cat) { global $xoopsDB; $newresult = $xoopsDB->query("select date from ".$xoopsDB->prefix("ann_annonces")." where cid=$cat and valid = 'Yes' order by date desc limit 1"); list($timeann)= $xoopsDB->fetchRow($newresult); $count = 1; $startdate = (time()-(86400 * $count)); if ($startdate < $timeann) { return ""; } } ###################################################### $pa = isset( $_GET['pa'] ) ? $_GET['pa'] : '' ; $lid = isset( $_GET['lid'] ) ? intval($_GET['lid']) : '' ; $cid = isset( $_GET['cid'] ) ? intval($_GET['cid']) : '' ; $debut = isset( $_GET['debut'] ) ? $_GET['debut'] : '' ; switch($pa){ case "viewannonces": $xoopsOption['template_main'] = 'myads_item.html'; include(XOOPS_ROOT_PATH."/header.php"); viewannonces($lid); include XOOPS_ROOT_PATH.'/include/comment_view.php'; break; case "view": $xoopsOption['template_main'] = 'myads_category.html'; include(XOOPS_ROOT_PATH."/header.php"); view($cid, $debut); break; default: $xoopsOption['template_main'] = 'myads_index.html'; include(XOOPS_ROOT_PATH."/header.php"); index(); break; } include(XOOPS_ROOT_PATH."/footer.php"); ?>