1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Mini hack for URL submission

Discussion in 'Installation and General Troubleshooting' started by newbieone, Jan 7, 2010.

  1. newbieone

    newbieone New Member

    Hi all,

    Just wanted to offer a little hack to all.

    It's to do with the submit plugin, basically if you want it to be 'idiot proof' i.e. people will enter www.google.co.uk instead of http://www.google.co.uk we all know that the user will get an error message 'invalid url' because of no 'http://" at the beginning of the submission.

    A quick hack:

    The file in question we need to alter is submit1.php this can be found:

    content/plugins/submit/templates/submit1.php

    Open up submit1.php in your editor of choice I use notepad ++ (tis good)

    find the following line:

    <td><input type='text' id='submit_orig_url' name='submit_orig_url' value='<?php echo $submitted_url; ?>' /></td>

    and replace with:

    <td><input type='text' id='submit_orig_url' name='submit_orig_url' value='http://<?php echo $submitted_url; ?>' /></td>

    Save and then FTP back up and next time you submit a link it will prefilled with http:// thus making it muppet proof [​IMG] (to a certain degree)

    That is all, probably an obvious one but thought I would release it into the ether!
     
    Last edited: Jan 7, 2010
  2. Nick

    Nick Well-Known Member

    Good tip newbieone.

    For newcomers to Hotaru, make sure that you copy template files that you want to edit into your own theme folder and edit them there. Otherwise, you'll lose your edits when you upgrade the plugin. Hotaru always looks in your theme folder for templates and only looks in plugin folders if it can't find them.

    Technical note for developers: If you wanted to check for an "http://" after submitting the form instead of pre-filling the form with it, you would need to change how Hotaru gets the url in the Submit plugin. Hotaru uses Inspekt's testUri validator and will return "Invalid URL" if that fails. Therefore, you would need to use our own getMixedString2 filter instead of testUri so you can manipulate the url. Personally, I think this is a bit messy and less secure so would use newbieone's hack instead. :)
     
  3. baadier

    baadier New Member

    for some reason the line to be changed is now

    <input id='submit_orig_url'type='text' name='submit_orig_url' value='<?php echo $submitted_url; ?>' />


    to

    <input id='submit_orig_url'type='text' name='submit_orig_url' value='http://<?php echo $submitted_url; ?>' />

    cheers
     

Share This Page