
//Add in a new point
function pointAdd()
{
global $xoopsDB, $xoopsModule, $xoopsModuleConfig;
$result2 = $xoopsDB->query("select count(*) from ".$xoopsDB->prefix("gmap_category")."");
list($numrows2) = $xoopsDB->fetchRow($result2);
if ( $numrows2 > 0 ) {
$result1 = $xoopsDB->query("select map_id, name from ".$xoopsDB->prefix("gmap_category")."");
$i = 0;
while ($array = $xoopsDB->fetchArray($result1)) {
$entry[$i]['map_id'] = $array['map_id'];
$entry[$i]['name'] = $array['name'];
$i++;
}
xoops_cp_header();
echo"n";
echo"n";
echo""._MD_ADDNEWPOINT." ";
echo "
";
xoops_cp_footer();
}else{
redirect_header("index.php?op=catAdd",1,_MD_NOCATSADD);
}
}
//Insert the new point into the DB
function pointInsert()
{
global $xoopsConfig, $xoopsDB, $myts, $xoopsUser, $xoopsModule, $eh;
$title = $myts->makeTboxData4Save($_POST["title"]);
$lat = $myts->makeTboxData4Save($_POST["lat"]);
$lon = $myts->makeTboxData4Save($_POST["lon"]);
$zoom = $myts->makeTboxData4Save($_POST["zoom"]);
$category = $myts->makeTboxData4Save($_POST["category"]);
$description = $myts->makeTareaData4Save($_POST["description"]);
$lid = $myts->makeTboxData4Save($_POST["lid"]);
$submitter = $xoopsUser->uid();
$date = time();
$errormsg = '';
// Check if Title exist
if ( $title == "" ) {
$errormsg .= ""
;
$errormsg .= _MD_ERRORTITLE."";
$error =1;
}
// Check if Description exist
if ( $description == "" ) {
$errormsg .= ""
;
$errormsg .= _MD_ERRORDESC."";
$error =1;
}
if ( $error == 1 ) {
xoops_cp_header();
echo $errormsg;
xoops_cp_footer();
exit();
}
list($order) = $xoopsDB->fetchRow($xoopsDB->query("SELECT MAX(`order`) FROM ".$xoopsDB->prefix("gmap_points")." WHERE `map_id` = ".$category));
$order++;
$sql = "INSERT INTO ".$xoopsDB->prefix("gmap_points")." (`map_id` , `lat` , `lon` , `title` , `html` , `zoom` , `submitter` , `status` , `date`, `order`, `lid`) VALUES ('$category', '$lat', '$lon', '$title', '$description', '$zoom','$submitter', '1', '$date', '$order', '$lid')";
$xoopsDB->query($sql) or $eh->show("0013");
if ( $newid == 0 ) {
$newid = $xoopsDB->getInsertId();
}
redirect_header("index.php?op=linksConfigMenu",1,_MD_NEWPOINTADDED);
}
include "header.php";
include_once XOOPS_ROOT_PATH."/class/module.errorhandler.php";
$myts =& MyTextSanitizer::getInstance(); // MyTextSanitizer object
if (!empty($HTTP_POST_VARS['submit'])) {
$eh = new ErrorHandler; //ErrorHandler object
if(empty($xoopsUser)){
$ratinguser = 0;
}else{
$ratinguser = $xoopsUser->getVar('uid');
}
//Make sure only 1 anonymous from an IP in a single day.
$anonwaitdays = 1;
$ip = getenv("REMOTE_ADDR");
$lid = intval($HTTP_POST_VARS['lid']);
$cid = intval($HTTP_POST_VARS['cid']);
$rating = intval($HTTP_POST_VARS['rating']);
// Check if Rating is Null
if ($rating=="--") {
redirect_header("ratelink.php?cid=".$cid."&lid=".$lid."",4,_MD_NORATING);
exit();
}
// Check if Link POSTER is voting (UNLESS Anonymous users allowed to post)
if ($ratinguser != 0) {
$result=$xoopsDB->query("select submitter from ".$xoopsDB->prefix("xdir_links")." where lid=$lid");
while(list($ratinguserDB) = $xoopsDB->fetchRow($result)) {
if ($ratinguserDB == $ratinguser) {
redirect_header("index.php",4,_MD_CANTVOTEOWN);
exit();
}
}
// Check if REG user is trying to vote twice.
$result=$xoopsDB->query("select ratinguser from ".$xoopsDB->prefix("xdir_votedata")." where lid=$lid");
while(list($ratinguserDB) = $xoopsDB->fetchRow($result)) {
if ($ratinguserDB == $ratinguser) {
redirect_header("index.php",4,_MD_VOTEONCE2);
exit();
}
}
} else {
// Check if ANONYMOUS user is trying to vote more than once per day.
$yesterday = (time()-(86400 * $anonwaitdays));
$result=$xoopsDB->query("select count(*) FROM ".$xoopsDB->prefix("xdir_votedata")." WHERE lid=$lid AND ratinguser=0 AND ratinghostname = '$ip' AND ratingtimestamp > $yesterday");
list($anonvotecount) = $xoopsDB->fetchRow($result);
if ($anonvotecount > 0) {
redirect_header("index.php",4,_MD_VOTEONCE2);
exit();
}
}
if($rating > 10){
$rating = 10;
}
//All is well. Add to Line Item Rate to DB.
$newid = $xoopsDB->genId($xoopsDB->prefix("xdir_votedata")."_ratingid_seq");
$datetime = time();
$sql = sprintf("INSERT INTO %s (ratingid, lid, ratinguser, rating, ratinghostname, ratingtimestamp) VALUES (%u, %u, %u, %u, '%s', %u)", $xoopsDB->prefix("xdir_votedata"), $newid, $lid, $ratinguser, $rating, $ip, $datetime);
$xoopsDB->query($sql) or $eh->show("0013");
//All is well. Calculate Score & Add to Summary (for quick retrieval & sorting) to DB.
updaterating($lid);
$ratemessage = _MD_VOTEAPPRE."
".sprintf(_MD_THANKURATE,$xoopsConfig[sitename]);
redirect_header("index.php",2,$ratemessage);
exit();
} else {
$xoopsOption['template_main'] = 'xdir_ratelink.html';
include XOOPS_ROOT_PATH."/header.php";
$lid = intval($_GET['lid']);
$cid = intval($_GET['cid']);
$result=$xoopsDB->query("select title from ".$xoopsDB->prefix("xdir_links")." where lid=$lid");
list($title) = $xoopsDB->fetchRow($result);
$xoopsTpl->assign('link', array('id' => $lid, 'cid' => $cid, 'title' => $myts->htmlSpecialChars($title)));
$xoopsTpl->assign('lang_voteonce', _MD_VOTEONCE);
$xoopsTpl->assign('lang_ratingscale', _MD_RATINGSCALE);
$xoopsTpl->assign('lang_beobjective', _MD_BEOBJECTIVE);
$xoopsTpl->assign('lang_donotvote', _MD_DONOTVOTE);
$xoopsTpl->assign('lang_rateit', _MD_RATEIT);
$xoopsTpl->assign('lang_cancel', _CANCEL);
//Smarty directory autodetect
$smartydir = $xoopsModule->getVar('dirname');
$xoopsTpl->assign('smartydir', $smartydir);
include XOOPS_ROOT_PATH.'/footer.php';
}
?>
Warning: MyTextSanitizer::oopsStripSlashesGPC is deprecated in file /class/module.textsanitizer.php line 918
Warning: MyTextSanitizer::oopsStripSlashesGPC is deprecated in file /class/module.textsanitizer.php line 918
Notice: Function getMailer() is deprecated, use xoops_getMailer instead in file /include/functions.legacy.php line 78
include "header.php";
include_once XOOPS_ROOT_PATH.'/header.php';
global $xoopsDB, $eh, $xoopsConfig, $xoopsModuleConfig, $xoopsUser;
include XOOPS_ROOT_PATH."/class/xoopsformloader.php";
include_once XOOPS_ROOT_PATH."/class/xoopstree.php";
include_once XOOPS_ROOT_PATH."/class/module.errorhandler.php";
include_once XOOPS_ROOT_PATH."/class/xoopslists.php";
include_once XOOPS_ROOT_PATH."/include/xoopscodes.php";
include "include/securitycheck.php";
include 'class/formtime.php';
$myts =& MyTextSanitizer::getInstance(); // MyTextSanitizer object
$mytree = new XoopsTree($xoopsDB->prefix("xdir_cat"),"cid","pid");
$mydirname = basename ( dirname( __FILE__ ) ) ;
$uploadirectory="modules/" . $mydirname. "/images/shots";
$eh = new ErrorHandler; //ErrorHandler object
//$captcha_anon = $xoopsModuleConfig['captcha_anon']; //check captcha for annon users?
if (empty($xoopsUser) && !$xoopsModuleConfig['anonpost']) {
redirect_header(XOOPS_URL."/user.php",2,_MD_MUSTREGFIRST);
exit();
}
if (!empty($_POST['submit'])) {
// Form posted - evaluate the results & put into the dB for approval
//xoops security class before captcha eval.
if (!$GLOBALS['xoopsSecurity']->check()) {
print _MD_SUBMITTER.'
'._MD_SECURITY_CODE.' '._MD_UPGRADEFAILED;
return;
}
// next check captcha security
if (empty($_POST['captcha_stat'] ) ) {
redirect_header("./",5,_MD_FAIL_SECURITY);
}
switch ($_POST['captcha_stat'] ) {
case false:
case 0:
redirect_header(XOOPS_URL."./",5,_MD_FAIL_GD_LOAD);
break;
case 1:
case 2:
if (empty($_POST["security"]) || empty($_POST["sec_hidden"])) {
$eh->show("0008");
} else {
// values are set - now verify
$sec_post = $myts->addSlashes($_POST["security"]);
$sec_post_hidden = $myts->addSlashes($_POST["sec_hidden"]);
$spass = mx_security_check($sec_post,$sec_post_hidden);
if ($spass === false){
redirect_header("./",5,_MD_FAIL_SECURITY);
}
}
break;
default:
break;
}
// end of security graphic validation check
$submitter = !empty($xoopsUser) ? $xoopsUser->getVar('uid') : 0;
$notify = !empty($_POST['notify']) ? 1 : 0;
$cid = ( !empty($_POST['cid']) ) ? intval($_POST['cid']) : 0;
// Check if title is invalid - will only happen if someone tries to spoof the form
if ( !isset($_POST["title"]) || (trim($_POST["title"])=="") ) {
redirect_header("./",5,_MD_FIELDEMPTY);
} elseif ( !isset($_POST["submitter"] ) ) {
// $url = $myts->formatURL($_POST["url"]);
// $url = urlencode($url);
redirect_header("./",5,_MD_NOPERM);
}
$status = ( $xoopsModuleConfig['autoapprove'] == 1 ) ? 1 : 0 ;
if (!empty($_FILES["logoup"]["name"])){
$thislogo = $_FILES["logoup"]["name"];
$logourl = $myts->addSlashes($thislogo);
} elseif(!empty($POST["logourl"])) {
$logourl = $myts->addSlashes($_POST["logourl"]);
$logourl = ( basename($logourl) == "0") ? "" : $logourl ;
} else {
$logourl = '';
}
$title = trim($myts->addSlashes($_POST["title"]));
$address = trim($myts->addSlashes($_POST["address"]));
$address2 = trim($myts->addSlashes($_POST["address2"]));
$city = trim($myts->addSlashes($_POST["city"]));
$state = trim($myts->addSlashes($_POST["state"]));
$zip = trim($myts->addSlashes($_POST["zip"]));
$country = trim($myts->addSlashes($_POST["country"]));
$mfhrs = trim($myts->addSlashes($_POST["mfhrs"]));
$sathrs = trim($myts->addSlashes($_POST["sathrs"]));
$sunhrs = trim($myts->addSlashes($_POST["sunhrs"]));
$phone = trim($myts->addSlashes($_POST["phone"]));
$fax = trim($myts->addSlashes($_POST["fax"]));
$mobile = trim($myts->addSlashes($_POST["mobile"]));
$home = trim($myts->addSlashes($_POST["home"]));
$tollfree = trim($myts->addSlashes($_POST["tollfree"]));
$email = trim($myts->addSlashes($_POST["email"]));
$url = trim($myts->addSlashes($_POST["url"]));
$admcontname = trim($myts->addSlashes($_POST["admcontname"]));
$admcontnumb = trim($myts->addSlashes($_POST["admcontnumb"]));
$premium = trim($myts->addSlashes($_POST["premium"]));
$moddesc = trim($myts->addSlashes($_POST["moddesc"]));
$date = time();
// now check for a valid image
$domain = XOOPS_URL;
$path = './images/shots/'; //path to targetfolder
$path_after_domain = '/modules/' . $mydirname . '/images/shots/'; //path to targetfolder for use in url
$max_size = $xoopsModuleConfig['logo_maxfilesize']; //maximum filesize
$ferror = false;
if ((isset($_FILES['logoup'])) && (is_uploaded_file($_FILES['logoup']['tmp_name']))) {
if ($_FILES['logoup']['size']>$max_size) {
$ferror = _MD_ELOGOSIZE; // file too big
} else {
if (($_FILES['logoup']['type']=="image/gif") || ($_FILES['logoup']['type']=="image/png") || ($_FILES['logoup']['type']=="image/jpeg")) {
if (file_exists($path . $_FILES['logoup']['name'])) {
$ferror = _MD_ELOGOSAMENAME; // file exists
} else {
if (!copy($_FILES['logoup']['tmp_name'], $path .$_FILES['logoup']['name'])) {
$ferror = _MD_ELOGOTEMP;
}
}
} else {
$ferror = _MD_ELOGOTYPE; // wrong file type
}
}
// } elseif ((isset($_FILES['logoup'])) && ($_FILES['logoup']['error'] != 0)) {
// $ferror = sprintf(_MD_ELOGOUNK , $_FILES['logoup']['error']);
}
if ($ferror) { redirect_header("./",3,$ferror); exit(); } // exit if error
//
// everything's okay so put it in the dB
//
$newid = $xoopsDB->genId($xoopsDB->prefix("xdir_links")."_requestid_seq");
$sql = sprintf("INSERT INTO %s (lid, cid, title, address, address2, city, state, zip, country, mfhrs, sathrs, sunhrs, phone, fax, mobile, home, tollfree, email, url, admcontname, admcontnumb, logourl, submitter, status, date, hits, rating, votes, comments, premium) VALUES (%u, %u, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %u, %u, %u, %u, %u, %u, %u, %u)", $xoopsDB->prefix("xdir_links"), $newid, $cid, $title, $address, $address2, $city, $state, $zip, $country, $mfhrs, $sathrs, $sunhrs, $phone, $fax, $mobile, $home, $tollfree, $email, $url, $admcontname, $admcontnumb, $logourl, $submitter, $status, $date, 0, 0, 0, 0, $premium);
$xoopsDB->query($sql) or $eh->show("0013");
$newid = ($newid == 0) ? $newid = $xoopsDB->getInsertId() : $newid ;
$sql = sprintf("INSERT INTO %s (lid, description) VALUES (%u, '%s')", $xoopsDB->prefix("xdir_text"), $newid, $moddesc);
$xoopsDB->query($sql) or $eh->show("0013");
//
// and finally set the notification
//
$notification_handler =& xoops_gethandler('notification');
$tags = array();
$tags['LINK_NAME'] = $title;
$tags['LINK_URL'] = XOOPS_URL . '/modules/'. $xoopsModule->getVar('dirname') . '/singlelink.php?cid=' . $cid . '&lid=' . $newid;
$sql = "SELECT title FROM " . $xoopsDB->prefix("xdir_cat") . " WHERE cid=" . $cid;
$result = $xoopsDB->query($sql);
$row = $xoopsDB->fetchArray($result);
$tags['CATEGORY_NAME'] = $row['title'];
$tags['CATEGORY_URL'] = XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/viewcat.php?cid=' . $cid;
if ( $xoopsModuleConfig['autoapprove'] == 1 ) {
$notification_handler->triggerEvent('global', 0, 'new_link', $tags);
$notification_handler->triggerEvent('category', $cid, 'new_link', $tags);
redirect_header("index.php",2,_MD_RECEIVED."
"._MD_ISAPPROVED."");
}else{
$tags['WAITINGLINKS_URL'] = XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/admin/index.php?op=listNewLinks';
$notification_handler->triggerEvent('global', 0, 'link_submit', $tags);
$notification_handler->triggerEvent('category', $cid, 'link_submit', $tags);
if ($notify) {
include_once XOOPS_ROOT_PATH . '/include/notification_constants.php';
$notification_handler->subscribe('link', $newid, 'approve', XOOPS_NOTIFICATION_MODE_SENDONCETHENDELETE);
}
redirect_header("index.php",10,_MD_RECEIVED);
}
exit();
} else { // Display submit form
$submitter = !empty($xoopsUser) ? $xoopsUser->getVar('uid') : _MD_ANON;
$arry1 = array( 0 =>_MD_NONE);
$linkimg_array = XoopsLists::getImgListAsArray(XOOPS_ROOT_PATH."/modules/".$mydirname."/images/shots/");
$linkimg_array = array_merge($arry1 , $linkimg_array);
$logourl = ''; // clear logo
$sql = "SELECT cid, title FROM ".$xoopsDB->prefix("xdir_cat");
$result = $xoopsDB->query($sql);
$modlinkform = new XoopsThemeForm(_MD_ADDNEWLINK, 'submitform', $_SERVER['PHP_SELF'], 'POST',true);
$modlinkform->addElement(new XoopsFormText(_MD_SITETITLE , 'title', 50, 100, ''),true);
$addrtray = new XoopsFormElementTray(_MD_BUSADDRESS,'
');
$addrtray->addElement(new XoopsFormText(_MD_BUSADDRESS1 , 'address', 38, 200, ''));
$addrtray->addElement(new XoopsFormText(_MD_BUSADDRESS2 , 'address2', 38, 100, ''));
$modlinkform->addElement($addrtray);
$modlinkform->addElement(new XoopsFormText(_MD_BUSCITY , 'city', 50, 80, ''));
$modlinkform->addElement(new XoopsFormText(_MD_BUSSTATE , 'state', 50, 80, ''));// EVU CODE changed size and max size
$modlinkform->addElement(new XoopsFormText(_MD_BUSZIP , 'zip', 15, 15, ''));
$modlinkform->addElement(new XoopsFormSelectCountry(_MD_BUSCOUNTRY , 'country', ''));
$hrtray = new XoopsFormElementTray(_MD_BUSHRS ,'
');
$hrtray->addElement(new XoopsFormTime(_MD_BUSMFHRS , 'mfhrs', 15, ''));
$hrtray->addElement(new XoopsFormTime(_MD_BUSSATHRS , 'sathrs', 15, ''));
$hrtray->addElement(new XoopsFormTime(_MD_BUSSUNHRS , 'sunhrs', 15, ''));
$modlinkform->addElement($hrtray);
$modlinkform->addElement(new XoopsFormText(_MD_BUSPHONE , 'phone', 15, 35, ''));
$modlinkform->addElement(new XoopsFormText(_MD_BUSFAX , 'fax', 15, 35, ''));
$modlinkform->addElement(new XoopsFormText(_MD_BUSMOBILE , 'mobile', 15, 35, ''));
$modlinkform->addElement(new XoopsFormText(_MD_BUSHOME , 'home', 15, 35, ''));
$modlinkform->addElement(new XoopsFormText(_MD_BUSTOLLFREE , 'tollfree', 15, 35, ''));
$modlinkform->addElement(new XoopsFormText(_MD_BUSEMAIL , 'email', 50, 100, ''));
$modlinkform->addElement(new XoopsFormText(_MD_SITEURL , 'url', 50, 250, ''));
$contray = new XoopsFormElementTray(_MD_BUSADMCONT , '
');
$contray->addElement(new XoopsFormText(_MD_BUSADMCONTNAME , 'admcontname', 28, 35, ''),true);
$contray->addElement(new XoopsFormText(_MD_BUSADMCONTNUMB , 'admcontnumb', 28, 35, ''),true);
$modlinkform->addElement($contray);
$sel_cat = (new XoopsFormSelect(_MD_CATEGORYC , 'cid', '', 1, false));
$tree = $mytree->getChildTreeArray(0,"title ASC");
foreach ($tree as $branch ) {
$branch['prefix'] = substr($branch['prefix'], 0, -1);
$branch['prefix'] = str_replace(".","--",$branch['prefix']);
$sel_cat -> addOption($branch['cid'],$branch['prefix'].$branch['title']);
}
$modlinkform->addElement($sel_cat);
$modlinkform->addElement(new XoopsFormDhtmlTextArea(_MD_DESCRIPTIONC , 'moddesc' , null , 8, 50), false);
$modlinkform->addElement(new XoopsFormFile(_MD_LOGOUP , 'logoup', $xoopsModuleConfig['logo_maxfilesize']));
$premtray = new XoopsFormElementTray(_MD_PREMIUM ,'');
$premopts = getlvlselects();
$premmenu = new XoopsFormSelect(_MD_PREMIUM , 'premium', '', '', false);
$premmenu->addOptionArray($premopts);
//$modlinkform->addElement($premmenu);
$premtray->addElement($premmenu);
$whaturl = XOOPS_URL."/modules/".$mydirname."/matrix.php";
$premtray->addElement(new XoopsFormLabel("","$whaturl . "">" . _MD_WHATTHIS .""));
$modlinkform->addElement($premtray);
//
// zyspec - add code for security graphic
// modified from original code from XoopsContact v1.6 by IBDeeming
//
// captcha_stat =
// 0 or false, gd not loaded - validate captcha
// 1, gd loaded, - validate captcha
// 2, gd2 loaded - validate captcha
// else, - don't validate captcha
//
if ( empty($xoopsUser) && $xoopsModuleConfig['captcha_anon'] ) {
// if (($xoopsModuleConfig['captcha_anon'])) { //check captcha for annon users?
$gd = ( extension_loaded('gd') ) ? 1 : false ;
$gd = ( extension_loaded('gd2') ) ? 2 : $gd ;
$captcha_stat = $gd;
if ( $gd ){
mt_srand((double)microtime()*10000);
$random_num = mt_rand(0, 100000);
$security = "
$random_num&gd=$gd' border='1' alt='"._MD_SECURITY_CODE."' title='"._MD_SECURITY_CODE."' /> "
."
._MD_NO_SPAM."' title='"._MD_NO_SPAM."' />";
$captchatray = new XoopsFormElementTray('','
');
$captchatray->addElement(new XoopsFormLabel('' , $security));
$captchatray->addElement(new XoopsFormHidden('sec_hidden',$random_num));
$captchatray->addElement(new XoopsFormText('','security',15,10,''));
$modlinkform->addElement($captchatray);
}
} else {
$captcha_stat = 99;
}
$modlinkform->addElement(new XoopsFormHidden('captcha_stat', $captcha_stat));
// zyspec - end of security graphic code
$submittray = new XoopsFormElementTray('','');
$regtray = new XoopsFormElementTray('','');
$regtray->addElement(new XoopsFormButton('', '', _MD_SUBMIT, 'submit'));
$regtray->addElement(new XoopsFormHidden('submit',true));
$regtray->addElement(new XoopsFormButton('', 'cancel', _MD_CANCEL, 'reset'));
$submittray->addElement($regtray);
// $modlinkform->addElement(new XoopsFormHidden('description', $desc));
$modlinkform->addElement(new XoopsFormHidden('mfhrs', ''));
$modlinkform->addElement(new XoopsFormHidden('sathrs', ''));
$modlinkform->addElement(new XoopsFormHidden('sunhrs', ''));
$modlinkform->addElement(new XoopsFormHidden('submitter', $submitter));
$modlinkform->addElement($submittray);
$modlinkform->setExtra('enctype="multipart/form-data"');
$modlinkform->display();
include XOOPS_ROOT_PATH.'/footer.php';
}
?>