Jump to content
TNG Community

Problems With Suggest Feature


redalice734

Recommended Posts

redalice734

We recently updated from TNG 10.1 to  13.02. Everything was working fine for a few weeks, but two days ago the Suggest feature returned the following error message: We're sorry, but your message could not be delivered. Please contact Kevin Howley directly at [redacted]. 

I hadn't had a chance to look into it yet and then this morning the Suggest feature suddenly started returning a blank page upon submission. The website is blackburn-tree.org and our TNG database is at blackburn-tree.org/genealogy. This is the tngsendmail.php file:

<?php
include("begin.php");
$tngconfig['maint'] = "";
include($cms['tngpath'] . "genlib.php");
$textpart = "gedcom";
include($cms['tngpath'] . "getlang.php");
include($cms['tngpath'] . "$mylanguage/text.php");

if($enttype)
    include($cms['tngpath'] . "checklogin.php");
include($subroot . "logconfig.php");
include($cms['tngpath'] . "tngmaillib.php");

$valid_user_agent = isset($_SERVER["HTTP_USER_AGENT"]) && $_SERVER["HTTP_USER_AGENT"] != "";

$emailfield = $_SESSION['tng_email'];
eval("\$youremail = \$$emailfield;");
$_SESSION['tng_email'] = "";

$commentsfield = $_SESSION['tng_comments'];
eval("\$comments = \$$commentsfield;");
$_SESSION['tng_comments'] = "";

$yournamefield = $_SESSION['tng_yourname'];
eval("\$yourname = \$$yournamefield;");
$_SESSION['tng_yourname'] = "";

$tngwebsite = $cms['support'] ? "http://". $_SERVER['HTTP_HOST'] : $tngdomain;

if(preg_match("/\n[[:space:]]*(to|bcc|cc|boundary)[[:space:]]*[:|=].*@/i", $youremail) || preg_match("/[\r|\n][[:space:]]*(to|bcc|cc|boundary)[[:space:]]*[:|=].*@/", $yourname) || !$valid_user_agent )
    die("sorry!");
if(preg_match("/\r/", $youremail) || preg_match("/\n/", $youremail) || preg_match("/\r/", $yourname) || preg_match("/\n/", $yourname) )
    die("sorry!");

$youremail = strtok( $youremail, ",; " );
if( !$youremail || !$comments || !$yourname ) die("sorry!");

if( $addr_exclude ) {
    $bad_addrs = explode(",", $addr_exclude);
    foreach( $bad_addrs as $bad_addr ) {
        if( $bad_addr ) {
            if( strstr( $youremail, trim($bad_addr) ) )
                die("sorry");
        }
    }
}

if( $msg_exclude ) {
    $bad_msgs = explode(",", $msg_exclude);
    foreach( $bad_msgs as $bad_msg ) {
        if( $bad_msg ) {
            if( stristr( $comments, trim($bad_msg) ) )
                die("sorry");
        }
    }
}

$suggest_url = getURL( "suggest", 1 );

if( $enttype == "I" ) {
    $typestr = "person";
    $query = "SELECT firstname, lnprefix, lastname, prefix, suffix, sex, nameorder, living, private, branch, disallowgedcreate, IF(birthdatetr !='0000-00-00',YEAR(birthdatetr),YEAR(altbirthdatetr)) as birth, IF(deathdatetr !='0000-00-00',YEAR(deathdatetr),YEAR(burialdatetr)) as death
        FROM $people_table, $trees_table WHERE personID = \"$ID\" AND $people_table.gedcom = \"$tree\" AND $people_table.gedcom = $trees_table.gedcom";
    $result = tng_query($query);
    $row = tng_fetch_assoc($result);

    $righttree = checktree($tree);
    $rights = determineLivingPrivateRights($row, $righttree);
    $row['allow_living'] = $rights['living'];
    $row['allow_private'] = $rights['private'];

    $name = getName( $row ) . " ($ID)";
    $pagelink = "$tngwebsite/" . getURL("getperson", 1) . "personID=$ID&tree=$tree";
    tng_free_result($result);
}
elseif( $enttype == "F" ) {
    $typestr = "family";
    $query = "SELECT familyID, husband, wife, living, private, marrdate, gedcom, branch FROM $families_table WHERE familyID = \"$ID\" AND gedcom = \"$tree\"";
    $result = tng_query($query);
    $row = tng_fetch_assoc($result);

    $righttree = checktree($tree);
    $rights = determineLivingPrivateRights($row, $righttree);
    $row['allow_living'] = $rights['living'];
    $row['allow_private'] = $rights['private'];

    $name = $text['family'] . ": " . getFamilyName( $row );
    $pagelink = "$tngwebsite/" . getURL("familygroup", 1) . "familyID=$ID&tree=$tree";
    tng_free_result($result);
}
elseif( $enttype == "S" ) {
    $query = "SELECT title FROM $sources_table WHERE sourceID = \"$ID\" AND gedcom = \"$tree\"";
    $result = tng_query($query);
    $row = tng_fetch_assoc($result);
    $name = $text['source'] . ": {$row['title']} ($ID)";
    $pagelink = "$tngwebsite/" . getURL("showsource", 1) . "sourceID=$ID&tree=$tree";
    tng_free_result($result);
}
elseif( $enttype == "R" ) {
    $query = "SELECT reponame FROM $repositories_table WHERE repoID = \"$ID\" AND gedcom = \"$tree\"";
    $result = tng_query($query);
    $row = tng_fetch_assoc($result);
    $name = $text['repository'] . ": {$row['reponame']} ($ID)";
    $pagelink = "$tngwebsite/" . getURL("showrepo", 1) . "repoID=$ID&tree=$tree";
    tng_free_result($result);
}
elseif($enttype == "L") {
    $name = $ID;
    if($tree && !$tngconfig['places1tree'])
        $treestr = "tree=$tree&amp;";
    else
        $treestr = "";
    $pagelink = "$tngwebsite/" . getURL( "placesearch", 1 ) . "{$treestr}psearch=" . urlencode($name);
}
if( $enttype ) {
    $subject = $text['proposed'] . ": $name";
    $query = "SELECT treename, email, owner FROM $trees_table WHERE gedcom=\"$tree\"";
    $treeresult = tng_query($query);
    $treerow = tng_fetch_assoc( $treeresult );
    tng_free_result($treeresult);

    $body = $text['proposed'] . ": $name\n{$text['tree']}: {$treerow['treename']}\n{$text['link']}: $pagelink\n\n{$text['description']}: " . stripslashes($comments) . "\n\n$yourname\n$youremail";

    $sendemail = $treerow['email'] ? $treerow['email'] : $emailaddr;
    $owner = $treerow['owner'] ? $treerow['owner'] : ($sitename ? $sitename : $dbowner);
}
else {
    $page = $page ? " ($page)" : "";
    $subject = $text['comments2'] . $page;
    $body = $text['comments2'] . $page . ": " . stripslashes($comments) . "\n\n$yourname\n$youremail";

    $sendemail = $emailaddr;
    $owner = $sitename ? $sitename : $dbowner;
}
if(!empty($currentuser))
  $body .= "\n{$text['user']}: $currentuserdesc ($currentuser)";
$emailtouse = $tngconfig['fromadmin'] == 1 ? $emailaddr : $youremail;

$success = tng_sendmail($yourname, $emailtouse, $owner, $sendemail, $subject, $body, $emailaddr, $youremail);
$message = $success ? "mailsent" : $message = "mailnotsent&sowner=" . urlencode($owner) . "&ssendemail=" . urlencode($sendemail);

header( "Location: $suggest_url" . "enttype=$enttype&ID=$ID&tree=$tree&message=$message" );
?>

As far as I can tell, no edits have been made to it since the update (when it was working fine). And no one has logged into the admin panel since the update, either. Any ideas about what could be going on?

 

Link to comment
Share on other sites

redalice734

Ok, it turns out the blank page issue was a problem with disk space. I cleared the caches and cleaned up a bunch of unnecessary files and now we're back to the "we're sorry..." message as shown above. I can't work out why this is displaying...does anyone have any suggestions?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...