Page Index Toggle Pages: 1
Topic Tools
Normal Topic Send Topic can be accessed when disabled (Read 1,060 times)
Dandello
YaBB Administrator
YaBB Next Team
Operations Team
Beta Testers
Support Team
*****
Offline



Posts: 2,244
Location: Earth

YaBB 2.6.0
Re: Send Topic can be accessed when disabled
Reply #1 - Nov 6th, 2012 at 9:31pm
Post Tools
This Topic was moved here from YaBB 2 - Bugs [Need Verification] [move by] Dandello.
  

If you only have one solution to a problem you're not trying hard enough!
Back to top
WWW  
IP Logged
 
Derek Barnstorm
Support Team
YaBB Next Team
Development Team
Beta Testers
****
Offline



Posts: 1,269
Location: United Kingdom

None
Send Topic can be accessed when disabled
Aug 26th, 2012 at 2:46pm
Post Tools
The Send Topic feature can still be accessed if it is totally disabled or if you only allow topics to be sent via the user's own email program.

In Sources/SendTopic.pl find:

Code (Perl)
Select All
if ($action eq 'detailedversion') { return 1; } 


And add after:

Code (Perl)
Select All
if (!$sendtopicmail || $sendtopicmail == 2) { &fatal_error("not_allowed"); } 


I guess JS alerts may as well be added to the Send Topic page too.

Find:

Code (Perl)
Select All
    &fatal_error("no_topic_send") unless ($topic ne '' && $topic ne '_' && $topic ne ' '); 


And after:

Code (Perl)
Select All
    if ($iamguest) { $focus_y_name = qq~document.sendtopic.y_name.focus();~; } 


Find:

Code (HTML)
Select All
<form action="$scripturl?action=sendtopic2" method="post"> 


And replace with:

Code (HTML)
Select All
<form action="$scripturl?action=sendtopic2" method="post" name="sendtopic" onsubmit="return CheckSendTopicFields();"> 



Find:

Code (HTML)
Select All
</form> 


And add after:

Code
Select All
<script type="text/javascript" language="JavaScript">
<!--
    $focus_y_name
   
    function CheckSendTopicFields() {
        if (document.sendtopic.y_name.value == '') {
            alert("$sendtopic_txt{'error_sender_name'}");
            document.sendtopic.y_name.focus();
        return false;
        }
        if (document.sendtopic.y_email.value == '') {
            alert("$sendtopic_txt{'error_sender_email'}");
            document.sendtopic.y_email.focus();
        return false;
        }
        if (document.sendtopic.r_name.value == '') {
            alert("$sendtopic_txt{'error_recipient_name'}");
            document.sendtopic.r_name.focus();
        return false;
        }
        if (document.sendtopic.r_email.value == '') {
            alert("$sendtopic_txt{'error_recipient_email'}");
            document.sendtopic.r_email.focus();
        return false;
        }
        ~ . ($regcheck ? qq~
        if (document.sendtopic.verification.value == '') {
            alert("$sendtopic_txt{'error_verification'}");
            document.sendtopic.verification.focus();
            return false;
        }~ : '') . qq~
        return true;
    }
//-->
</script> 


Then in Languages/English/SendTopic.lng find:

Code (Perl)
Select All
'718' => 'Recipient\'s email address', 


And add after:

Code (Perl)
Select All
'error_sender_name' => 'You must insert your name.',
'error_sender_email' => 'You must insert your email.',
'error_recipient_name' => 'You must insert the recipient\'s name.',
'error_recipient_email' => 'You must insert the recipient\'s email.',
'error_verification' => 'The verification code is missing.', 


I'm also a believer that form errors should be checked and thrown in the same order as the actual form is laid out - it can seem confusing otherwise- if you agree, the remove this from SendTopic.pl:

Code (Perl)
Select All
    if ($regcheck) {
        &validation_check($FORM{'verification'});
    } 


And add it back after:

Code (Perl)
Select All
    &fatal_error("invalid_email","$sendtopic_txt{'718'}")                                            if (($remail =~ /(@.*@)|(\.\.)|(@\.)|(\.@)|(^\.)|(\.$)/) || ($remail !~ /^.+@\[?(\w|[-.])+\.[a-zA-Z]{2,4}|[0-9]{1,4}\]?$/)); 

  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Topic Tools
 
  « Board Index ‹ Board  ^Top