
Not sure how to identify paths for each of these modules ...
Did research the forum for information .. Could not find anything that was applicable to my question ..
Thanks
Doug
// $Id: modify.php,v 2.1 02/08/2010 12:51:25 jlm69 Exp $ //
// //
// Classified Ads Module for Xoops //
// Redesigned by John Mordo user jlm69 at www.xoops.org //
// Find it or report problems at www.jlmzone.com //
// //
// Started with the MyAds module and made MANY, MANY changes //
// //
// ------------------------------------------------------------------------- //
// Original credits below //
// ------------------------------------------------------------------------- //
// Original Author: Pascal Le Boustouller //
// Author Website : pascal.e-xoops@perso-search.com //
// Licence Type : GPL //
// ------------------------------------------------------------------------- //
include("header.php");
$mydirname = basename( dirname( __FILE__ ) ) ;
$main_lang = '_' . strtoupper( $mydirname ) ;
require_once( XOOPS_ROOT_PATH."/modules/$mydirname/include/gtickets.php" ) ;
$myts =& MyTextSanitizer::getInstance();
$module_id = $xoopsModule->getVar('mid');
if (is_object($xoopsUser)) {
$groups = $xoopsUser->getGroups();
} else {
$groups = XOOPS_GROUP_ANONYMOUS;
}
$gperm_handler =& xoops_gethandler('groupperm');
if (isset($_POST['item_id'])) {
$perm_itemid = intval($_POST['item_id']);
} else {
$perm_itemid = 0;
}
//If no access
if (!$gperm_handler->checkRight("".$mydirname."_submit", $perm_itemid, $groups, $module_id)) {
redirect_header(XOOPS_URL."/modules/$mydirname/index.php", 3, _NOPERM);
exit();
}
if (!$gperm_handler->checkRight("jobs_premium", $perm_itemid, $groups, $module_id)) {
$premium = 0;
} else {
$premium = 1;
}
function ListingDel($lid, $ok)
{
global $xoopsDB, $xoopsUser, $xoopsConfig, $xoopsTheme, $xoopsLogger, $mydirname, $main_lang;
$result = $xoopsDB->query("select usid, p.lid, p.url FROM ".$xoopsDB->prefix("".$mydirname."_listing")." l LEFT JOIN ".$xoopsDB->prefix("".$mydirname."_pictures")." p ON l.lid=p.lid where l.lid=".mysql_real_escape_string($lid)."");
list($usid, $plid, $purl) = $xoopsDB->fetchRow($result);
if ($xoopsUser) {
$currentid = $xoopsUser->getVar("uid", "E");
if ($usid == $currentid) {
if($ok==1) {
$xoopsDB->queryf("delete from ".$xoopsDB->prefix("".$mydirname."_listing")." where lid=".mysql_real_escape_string($lid)."");
if ($purl) {
$destination = XOOPS_ROOT_PATH."/modules/$mydirname/photo";
if (file_exists("$destination/$purl")) {
unlink("$destination/$purl");
}
$destination2 = XOOPS_ROOT_PATH."/modules/$mydirname/photo/thumbs";
if (file_exists("$destination2/thumb_$purl")) {
unlink("$destination2/thumb_$purl");
}
$destination3 = XOOPS_ROOT_PATH."/modules/$mydirname/photo/resized";
if (file_exists("$destination3/resized_$purl")) {
unlink("$destination3/resized_$purl");
}
}
redirect_header("index.php",3,constant($main_lang."_ANNDEL"));
exit();
} else {
echo "n";
echo "
" ;
echo "".constant($main_lang."_SURDELANN")."
";
}
echo "[ modify.php?op=ListingDel&lid=".addslashes($lid)."&ok=1">".constant($main_lang."_OUI")." | viewad.php?lid=".addslashes($lid)."">".constant($main_lang."_NON")." ]
";
echo "
";
}
}
}
function DelReply($r_lid, $ok)
{
global $xoopsDB, $xoopsUser, $xoopsConfig, $xoopsTheme, $xoopsLogger, $mydirname, $main_lang;
$result = $xoopsDB->query("select l.usid, r.r_lid, r.lid, r.title, r.date, r.submitter, r.message, r.tele, r.email, r.r_usid FROM ".$xoopsDB->prefix("".$mydirname."_listing")." l LEFT JOIN ".$xoopsDB->prefix("".$mydirname."_replies")." r ON l.lid=r.lid where r.r_lid=".mysql_real_escape_string($r_lid)."");
list($usid, $r_lid, $rlid, $title, $date, $submitter, $message, $tele, $email, $r_usid) = $xoopsDB->fetchRow($result);
if ($xoopsUser) {
$currentid = $xoopsUser->getVar("uid", "E");
if ($usid == $currentid) {
if($ok==1) {
$xoopsDB->queryf("delete from ".$xoopsDB->prefix("".$mydirname."_replies")." where r_lid=".mysql_real_escape_string($r_lid)."");
redirect_header("members.php?usid=".addslashes($usid)."",3,constant($main_lang."_REPLYDEL"));
exit();
} else {
echo "n";
echo "
" ;
echo "".constant($main_lang."_SURDELANN")."
";
}
echo "[ modify.php?op=DelReply&r_lid=".addslashes($r_lid)."&ok=1">".constant($main_lang."_OUI")." | members.php?usid=".addslashes($usid)."">".constant($main_lang."_NON")." ]
";
echo "
";
}
}
}
function ModAd($lid)
{
global $xoopsDB, $xoopsModule, $xoopsConfig, $xoopsModuleConfig, $xoopsUser, $xoopsTheme, $myts, $xoopsLogger, $mydirname, $main_lang;
include_once XOOPS_ROOT_PATH."/class/xoopsformloader.php";
include_once XOOPS_ROOT_PATH."/modules/$mydirname/include/functions.php";
echo "";
include_once(XOOPS_ROOT_PATH."/modules/$mydirname/class/classifiedstree.php");
$mytree = new ClassifiedsTree($xoopsDB->prefix("".$mydirname."_categories"),"cid","pid");
$result = $xoopsDB->query("select lid, cid, title, status, expire, type, desctext, tel, price, typeprice, date, email, submitter, usid, town, country, contactby, premium, valid from ".$xoopsDB->prefix("".$mydirname."_listing")." where lid=".mysql_real_escape_string($lid)."");
list($lid, $cide, $title, $status, $expire, $type, $desctext, $tel, $price, $typeprice, $date, $email, $submitter, $usid, $town, $country, $contactby, $premium, $valid) = $xoopsDB->fetchRow($result);
$categories = classifieds_MygetItemIds("".$mydirname."_submit");
if(is_array($categories) && count($categories) > 0) {
if(!in_array($cide, $categories)) {
redirect_header(XOOPS_URL."/modules/$mydirname/index.php", 3, _NOPERM);
exit();
}
} else { // User can't see any category
redirect_header(XOOPS_URL.'/index.php', 3, _NOPERM);
exit();
}
if ($xoopsUser) {
$calusern = $xoopsUser->uid();
if ($usid == $calusern) {
echo ".constant($main_lang."_MODIFANN")."
";
$title = $myts->htmlSpecialChars($title);
$status = $myts->htmlSpecialChars($status);
$expire = $myts->htmlSpecialChars($expire);
$type = $myts->htmlSpecialChars($type);
if ($xoopsModuleConfig["".$mydirname."_form_options"] == 'dhtmltextarea') {
$desctext = $myts->displayTarea($desctext,0,0,0,0,0);
} else {
$desctext = $myts->displayTarea($desctext, 1,0,1,1,1);
}
$tel = $myts->htmlSpecialChars($tel);
$price = number_format($price, 2, ".", ",");
$typeprice = $myts->htmlSpecialChars($typeprice);
$submitter = $myts->htmlSpecialChars($submitter);
$town = $myts->htmlSpecialChars($town);
$country = $myts->htmlSpecialChars($country);
$contactby = $myts->htmlSpecialChars($contactby);
$premium = $myts->htmlSpecialChars($premium);
$useroffset = "";
if($xoopsUser) {
$timezone = $xoopsUser->timezone();
if(isset($timezone)){
$useroffset = $xoopsUser->timezone();
}else{
$useroffset = $xoopsConfig['default_TZ'];
}
}
$dates = ($useroffset*3600) + $date;
$dates = formatTimestamp($date,"s");
echo "
";
}
}
}
function ModAdS($lid, $cat, $title, $status, $expire, $type, $desctext, $tel, $price, $typeprice, $date, $email, $submitter, $town, $country, $contactby, $premium, $valid)
{
global $xoopsDB, $xoopsConfig, $xoopsModuleConfig, $myts, $xoopsLogger, $mydirname, $main_lang, $xoopsGTicket;
if ( ! $xoopsGTicket->check( true , 'token' ) ) {
redirect_header(XOOPS_URL."/modules/$mydirname/index.php", 3,$xoopsGTicket->getErrors());
}
$title = $myts->addSlashes($title);
$status = $myts->addSlashes($status);
$expire = $myts->addSlashes($expire);
$type = $myts->addSlashes($type);
if ($xoopsModuleConfig["".$mydirname."_form_options"] == 'dhtmltextarea') {
$desctext = $myts->displayTarea($desctext,0,0,0,0,0);
} else {
$desctext = $myts->displayTarea($desctext, 1,0,1,1,1);
}
$tel = $myts->addSlashes($tel);
$price = str_replace(array(','), '', $price);
$typeprice = $myts->addSlashes($typeprice);
$submitter = $myts->addSlashes($submitter);
$town = $myts->addSlashes($town);
$country = $myts->addSlashes($country);
$contactby = $myts->addSlashes($contactby);
$premium = $myts->addSlashes($premium);
$xoopsDB->query("update ".$xoopsDB->prefix("".$mydirname."_listing")." set cid='$cat', title='$title', status='$status', expire='$expire', type='$type', desctext='$desctext', tel='$tel', price='$price', typeprice='$typeprice', email='$email', submitter='$submitter', town='$town', country='$country', contactby='$contactby', premium='$premium', valid='$valid' where lid=$lid");
redirect_header("index.php",3,constant($main_lang."_ANNMOD2"));
exit();
}
####################################################
foreach ($_POST as $k => $v) {
${$k} = $v;
}
$ok = isset( $_GET['ok'] ) ? $_GET['ok'] : '' ;
if(!isset($_POST['lid']) && isset($_GET['lid']) ) {
$lid = $_GET['lid'] ;
}
if(!isset($_POST['r_lid']) && isset($_GET['r_lid']) ) {
$r_lid = $_GET['r_lid'] ;
}
if(!isset($_POST['op']) && isset($_GET['op']) ) {
$op = $_GET['op'] ;
}
switch ($op) {
case "ModAd":
include(XOOPS_ROOT_PATH."/header.php");
ModAd($lid);
include(XOOPS_ROOT_PATH."/footer.php");
break;
case "ModAdS":
ModAdS($lid, $cid, $title, $status, $expire, $type, $desctext, $tel, $price, $typeprice, $date, $email, $submitter, $town, $country, $contactby, $premium, $valid);
break;
case "ListingDel":
include(XOOPS_ROOT_PATH."/header.php");
ListingDel($lid, $ok);
include(XOOPS_ROOT_PATH."/footer.php");
break;
case "DelReply":
include(XOOPS_ROOT_PATH."/header.php");
DelReply($r_lid, $ok);
include(XOOPS_ROOT_PATH."/footer.php");
break;
default:
redirect_header("index.php",3,""._RETURNANN."");
break;
}
?>
td>";
}else{
[265] echo "<td class="head">".constant($main_lang."_SENDBY")." td><td class="head"><input type="hidden" name="submitter" value="$submitter">$submittertd>";