// // ------------------------------------------------------------------------- // // Original Author: Pascal Le Boustouller // Author Website : pascal.e-xoops@perso-search.com // Licence Type : GPL // ------------------------------------------------------------------------- // function showNew() { global $myts, $xoopsDB, $xoopsTpl, $mf, $xoopsUser, $newclassifieds, $monnaie, $ynprice; include_once (XOOPS_ROOT_PATH."/modules/myAds/class/arbre.php"); $mytree = new XoopsArbre($xoopsDB->prefix("ann_categories"),"cid","pid"); // Add 'typeprix' by Tom $result=$xoopsDB->query("select lid, title, type, price, typeprix, date, town, country, valid, photo, view FROM ".$xoopsDB->prefix("ann_annonces")." WHERE valid='Yes' ORDER BY date DESC LIMIT $newclassifieds"); if ($result){ $xoopsTpl->assign('last_head', _CLA_THE." $newclassifieds "._CLA_LASTADD); $xoopsTpl->assign('last_head_title', _CLA_TITLE); $xoopsTpl->assign('last_head_price', _CLA_PRICE); $xoopsTpl->assign('last_head_date', _CLA_DATE); $xoopsTpl->assign('last_head_local', _CLA_LOCAL2); $xoopsTpl->assign('last_head_views', _CLA_VIEW); $xoopsTpl->assign('last_head_photo', _CLA_PHOTO); $rank = 1; // Add $typeprix by Tom while(list($lid, $title, $type, $price, $typeprix, $date, $town, $country, $valid, $photo, $vu)=$xoopsDB->fetchRow($result)) { $title = $myts->makeTboxData4Show($title); $type = $myts->makeTboxData4Show($type); $price = $myts->makeTboxData4Show($price); $town = $myts->makeTboxData4Show($town); $country = $myts->makeTboxData4Show($country); $a_item = array(); $useroffset = ""; if($xoopsUser) { $timezone = $xoopsUser->timezone(); if(isset($timezone)) { $useroffset = $xoopsUser->timezone(); } else { $useroffset = $xoopsConfig['default_TZ']; } } $date = ($useroffset*3600) + $date; $date = formatTimestamp($date,"s"); if ($xoopsUser) { if ($xoopsUser->isAdmin()) { $a_item['admin'] = "\""._CLA_MODADMIN."\""; } } $a_item['type'] = $type; $a_item['title'] = "$title"; if ($ynprice == 1) { if ($price > 0) { $a_item['price'] = "$price $monnaie"; // Add $price_typeprix by Tom $a_item['price_typeprix'] = "$typeprix"; }else { $a_item['price'] = ""; $a_item['price_typeprix'] = "$typeprix"; } } $a_item['date'] = $date; $a_item['local'] = ''; if ($town) { $a_item['local'] .= $town; } if ($country) { $a_item['local'] .= $country; } if ($photo) { // $a_item['photo_img'] = XOOPS_URL."/modules/myAds/images_ann/".$photo; $a_item['photo'] = ""._CLA_IMGPISP.""; } $a_item['views'] = $vu; $rank++; $xoopsTpl->append('items', $a_item); } } } function showViewAnnonces($debut, $cid, $nb_affichage, $nbe) { global $xoopsDB, $xoopsConfig, $xoopsTpl, $monnaie, $newclassifieds, $xoopsUser, $ynprice, $myts; // Add 'typeprix' by Tom //$result3=$xoopsDB->query("select lid, cid, title, type, price, date, town, country, valid, photo, view from ".$xoopsDB->prefix("ann_annonces")." where valid='yes' AND cid=$cid order by date DESC LIMIT $debut,$nb_affichage"); $result3=$xoopsDB->query("select lid, cid, title, type, price, typeprix, date, town, country, valid, photo, view from ".$xoopsDB->prefix("ann_annonces")." where valid='yes' AND cid=$cid order by date DESC LIMIT $debut,$nb_affichage"); $xoopsTpl->assign('data_rows', $nbe); if ($nbe =="0") { $xoopsTpl->assign('no_data', _CLA_NOANNINCAT); } else { $xoopsTpl->assign('last_head', _CLA_THE." $newclassifieds "._CLA_LASTADD); $xoopsTpl->assign('last_head_title', _CLA_TITLE); $xoopsTpl->assign('last_head_price', _CLA_PRICE); $xoopsTpl->assign('last_head_date', _CLA_DATE); $xoopsTpl->assign('last_head_local', _CLA_LOCAL2); $xoopsTpl->assign('last_head_views', _CLA_VIEW); $xoopsTpl->assign('last_head_photo', _CLA_PHOTO); $rank = 1; // Add 'typeprix' by Tom //while(list($lid, $cid, $title, $type, $price, $date, $town, $country, $valid, $photo, $vu)=$xoopsDB->fetchRow($result3)) while(list($lid, $cid, $title, $type, $price, $typeprix, $date, $town, $country, $valid, $photo, $vu)=$xoopsDB->fetchRow($result3)) { $a_item = array(); $title = $myts->makeTboxData4Show($title); $type = $myts->makeTboxData4Show($type); $price = $myts->makeTboxData4Show($price); $town = $myts->makeTboxData4Show($town); $country = $myts->makeTboxData4Show($country); $useroffset = ""; if($xoopsUser) { $timezone = $xoopsUser->timezone(); if(isset($timezone)) { $useroffset = $xoopsUser->timezone(); } else { $useroffset = $xoopsConfig['default_TZ']; } } $date = ($useroffset*3600) + $date; $date = formatTimestamp($date,"s"); if ($xoopsUser) { if ($xoopsUser->isAdmin()){ $a_item['admin'] = "\""._CLA_MODADMIN."\""; } } $a_item['type'] = $type; $a_item['title'] = "$title"; if ($ynprice == 1) { if ($price > 0) { $a_item['price'] = "$price $monnaie"; // Add $price_typeprix by Tom $a_item['price_typeprix'] = "$typeprix"; }else { $a_item['price'] = ""; $a_item['price_typeprix'] = "$typeprix"; } } $a_item['date'] = $date; $a_item['local'] = ''; if ($town) { $a_item['local'] .= $town; } if ($country) { $a_item['local'] .= $country; } if ($photo) { $a_item['photo'] = ""._CLA_IMGPISP.""; } $a_item['views'] = $vu; $rank++; $xoopsTpl->append('items', $a_item); } } } function SupprClaDay() { //for xoops2// global $xoopsDB, $claday, $xoopsConfig, $myts, $meta; global $xoopsModule; include_once (XOOPS_ROOT_PATH."/modules/myAds/include/config.php"); if ($claday == 0) return; $datenow = time(); $result5 = $xoopsDB->query("select lid, title, type, description, date, email, submitter, usid, photo, view FROM ".$xoopsDB->prefix("ann_annonces")." WHERE valid='Yes'"); while(list($lids, $title, $type, $description, $dateann, $email, $submitter, $usid, $photo, $lu) = $xoopsDB->fetchRow($result5)) { $title = $myts->makeTboxData4Show($title); $type = $myts->makeTboxData4Show($type); $description = $myts->makeTboxData4Show($description); $submitter = $myts->makeTboxData4Show($submitter); $supprdate = $dateann + ($claday*86400); if ($supprdate < $datenow) { //for xoops2// $xoopsDB->query("delete from ".$xoopsDB->prefix("ann_annonces")." where lid='$lids'"); $xoopsDB->queryF("delete from ".$xoopsDB->prefix("ann_annonces")." where lid='$lids'"); // for xoopsComment function ちょっとお行儀が悪いかも // xoops_comment_delete( $xoopsModule->getVar('mid') , $lids ); <= NG $module_id = $xoopsModule->getVar('mid'); if (intval($module_id) > 0 && intval($lids) > 0) { $comment_handler =& xoops_gethandler('comment'); $comments =& $comment_handler->getByItemId($module_id, $lids); if (is_array($comments)) { $count = count($comments); $deleted_num = array(); for ($i = 0; $i < $count; $i++) { $comment = $comments[$i]; if (get_class($comment) != 'xoopscomment') { return false; } $sql = sprintf("DELETE FROM %s WHERE com_id = %u", $xoopsDB->prefix('xoopscomments'), $comment->getVar('com_id')); if (false != $xoopsDB->queryF($sql)) { // store poster ID and deleted post number into array for later use $poster_id = $comments[$i]->getVar('com_uid'); if ($poster_id != 0) { $deleted_num[$poster_id] = !isset($deleted_num[$poster_id]) ? 1 : ($deleted_num[$poster_id] + 1); } } } $member_handler =& xoops_gethandler('member'); foreach ($deleted_num as $user_id => $post_num) { // update user posts $com_poster = $member_handler->getUser($user_id); if (is_object($com_poster)) { $member_handler->updateUserByField($com_poster, 'posts', $com_poster->getVar('posts') - $post_num); } } } } // end of xoopsComment 無作法はここまで $destination = XOOPS_ROOT_PATH."/modules/myAds/images_ann"; if($photo) { if (file_exists("$destination/$photo")) { unlink("$destination/$photo"); } } // Specification for Japan: // $message = ""._CLA_HELLO." $submitter,\n\n"._CLA_STOP2."\n $type : $title\n $description\n"._CLA_STOP3."\n\n"._CLA_VU." $lu "._CLA_VU2."\n\n"._CLA_OTHER." ".XOOPS_URL."/modules/myAds\n\n"._CLA_THANK."\n\n"._CLA_TEAM." ".$meta['title']."\n".XOOPS_URL.""; if ($email) { $message = "$submitter "._CLA_HELLO." \n\n"._CLA_STOP2."\n $type : $title\n $description\n"._CLA_STOP3."\n\n"._CLA_VU." $lu "._CLA_VU2."\n\n"._CLA_OTHER." ".XOOPS_URL."/modules/myAds\n\n"._CLA_THANK."\n\n"._CLA_TEAM." ".$meta['title']."\n".XOOPS_URL.""; $subject = ""._CLA_STOP.""; $mail =& getMailer(); $mail->useMail(); $mail->setFromName($meta['title']); $mail->setFromEmail($xoopsConfig['adminmail']); $mail->setToEmails($email); $mail->setSubject($subject); $mail->setBody($message); $mail->send(); echo $mail->getErrors(); } } } } function copyright() { global $xoopsTpl; include(XOOPS_ROOT_PATH."/modules/myAds/xoops_version.php"); $cr_developed = "MyAds ".$modversion['version']." "._CLA_FOR." E-Xoops "._CLA_CREATBY." Pascal Le Boustouller"; $cr_redesigned = "redesigned for XOOPS 2 by glassJAw and jojup from myxoops.de team / bugfix and Japanese Version by Tom from japan."; if (isset($GLOBALS['xoopsOption']['template_main'])) { $xoopsTpl->assign('cr_developed', $cr_developed); $xoopsTpl->assign('cr_redesigned', $cr_redesigned); } } function getTotalItems($sel_id, $status="") { global $xoopsDB, $mytree; $pfx = $xoopsDB->prefix("ann_annonces"); $count = 1; $arr = array(); $status_q = ''; if ($status) { if ($status == _YES){ $status_q = " and valid='Yes'"; } else { $status_q = " and valid='No'"; } } $query = "select lid from $pfx where cid=".$sel_id."$status_q"; $result = $xoopsDB->query($query); $count = $xoopsDB->getRowsNum($result); $arr = $mytree->getAllChildId($sel_id); $size = sizeof($arr); for($i=0;$i<$size;$i++) { $query2 = "select lid from $pfx where cid=".$arr[$i]."$status_q"; $result2 = $xoopsDB->query($query2); $count += $xoopsDB->getRowsNum($result2); } return $count; } function ShowImg() { echo "\n"; } ?>