|
From: Ray N. <ray...@he...> - 2012-02-06 22:33:38
|
You'd need to edit the requesthandler.php code. It's not a terribly
difficult edit, but there are a few changes that should be made to
incorporate reCAPTCHA the "PROPS way."
I'll try to give it a look when I'm done with work tonight, it might
be of use to others as well.
On Mon, Feb 6, 2012 at 4:59 PM, Aaron Thomas <wo...@ho...> wrote:
>
> Hi Ray,
>
> Thanks for your help, that's great, the url should be easy enough now that I know where to look.
>
> As for the reCAPTCHA, as I said I'm not a coder, so I'm just fumbling my way through with this but at least now I have an idea of where I should be looking. Would I need to put the reCAPTCHA code in the 'requesthandler.php' or would I just need to call the 'requesthandler.php' somehow in the reCAPTCHA script if the challenge was validated correctly?
>
> Thanks again.
>
> ________________________________
> Date: Mon, 6 Feb 2012 15:24:54 -0500
> Subject: Re: [Props-general] Couple of (hopefully) quick questions
> From: ray...@he...
> To: wo...@ho...
> CC: pro...@li...; pro...@li...
>
>
> Check out the {gen_url} tag, for example:
>
> <li><a href="{gen_url cmd="displaysection" section_id='14'}">Community News</a></li>
>
> I don't have time to test this out myself, but that should add the correct format parameter to the URL depending on the format of the initial request. If not, try reading /props-root-dir/modules/globaltags/tags/gen_url.php and /props-root-dir/lib/url.php to discern the correct tag syntax.
>
> For reCAPTCHA, you'd need to handle the form submission in the requesthandler.php file for the displaystory module (/props-root-dir/modules/displaystory/requesthandler.php)
>
> It should be handled in the 'displaystory-email' case of the switch statement (after the comment "Trap 'command' request parameter").
>
> Sorry I can't really go deeper at the moment, hope that helps!
>
> Cheers,
> Ray
>
> On Mon, Feb 6, 2012 at 12:13 PM, Aaron Thomas <wo...@ho...> wrote:
>
> Hi all,
>
> I just have to quick questions.
>
> Firstly, how to create url links to sections. I have created a menu and I need to set up the links to the various sections. What I am currently using is:
>
> <li><a href="?cmd=displaysection§ion_id=14&format=html">Community News</a></li>
>
> Problem is, if trying to link to a rss feed or using the 'preview' clicking the links returns to the current published edition. I know you can use the {sectionlist} to build a menu but I don't want all the sections listed and I've also got different hiarachy structures between the Props and the menu I've created.
>
> Is there a way to ask Props to generate the url for section_id 14 and still allow for the format=rss or preview generated tags in the url?
>
> Secondly, wondering if anyone had intergrated Google's reCAPTCHA into their script??
>
> For example I am trying to add it for either 'add comments' and more importantly, the 'email story'.
>
> current code is
>
> {if var='cmd' comparison='eq' value='displaystory-error'}
> <p style="text-align: center;"><a href="javascript:history.go(-1)">« Go back »</a></p>
> {elseif var='cmd' comparison='eq' value='displaystory-email'}
>
> <h1>{headline}</h1>
> {abstract prepend='<p>' append='</p>'}
> <br />
> <form method="post" action="./">
> <input name="cmd" type="hidden" value="displaystory-email" />
> <input name="pageID" type="hidden" value="{page_id}" />
> <input name="story_id" type="hidden" value="{story_id}" />
> <fieldset style="border: 0;">
> <legend>Email story</legend>
> <dl>
> <dt><label>To email address</label></dt>
> <dd><input class="large" type="text" id="to_email" name="to_email" value="{request var='to_email'}" /></dd>
> {error_message var='to_email' prepend='<dd>' append='</dd>'}
> </dl>
> <dl>
> <dt><label>Your email address</label></dt>
> <dd><input class="large" type="text" id="from_email" name="from_email" value="{request var='from_email'}" /></dd>
> {error_message var='from_email' prepend='<dd>' append='</dd>'}
> </dl>
> <dl>
> <dt><label>Your name</label></dt>
> <dd><input class="large" type="text" id="from_name" name="from_name" value="{request var='from_name'}" /></dd>
> {error_message var='from_name' prepend='<dd>' append='</dd>'}
> </dl>
> <dl>
> <dt><label>Your comments</label></dt>
> <dd><textarea class="large" id="comments" name="comments" rows="5" cols="25">{request var='comments'}</textarea></dd>
> {error_message var='comments' prepend='<dd>' append='</dd>'}
> </dl>
> <dl>
> <!--{recapcha}-->
> </dl>
> <p>
> <input class="button" type="submit" id="op" name="op" value="Send" />
> </p>
> </fieldset>
> </form>
>
> I've got it all working up until the point of processing the form. The form and the users captcha answer are passed through to the validation script below:
>
> <?php
> require_once('{scripturl}recaptchalib.php');
> $privatekey = "your_private_key";
>
> $resp = recaptcha_check_answer ($privatekey,
> $_SERVER["REMOTE_ADDR"],
>
> $_POST["recaptcha_challenge_field"],
> $_POST["recaptcha_response_field"]);
>
>
> if (!$resp->is_valid) {
> // What happens when the CAPTCHA was entered incorrectly
>
> die ("The reCAPTCHA wasn't entered correctly. Go back and try it again." .
> "(reCAPTCHA said: " . $resp->error . ")");
>
> } else {
> // Your code here to handle a successful verification
> }
> ?>
>
> I just don't know what code to put in process the form following a successful verification... I have tried $_POST ["./"] but no success.
>
> Sorry I am not a scripter so this is all trial and error (mostly error) for me.
>
> Appreciate any help.
>
> Thanks
>
> ------------------------------------------------------------------------------
> Try before you buy = See our experts in action!
> The most comprehensive online learning library for Microsoft developers
> is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
> Metro Style Apps, more. Free future releases when you subscribe now!
> http://p.sf.net/sfu/learndevnow-dev2
> _______________________________________________
> Props-general mailing list
> Pro...@li...
> https://lists.sourceforge.net/lists/listinfo/props-general
>
>
|