Results 1 to 3 of 3

Thread: Mini hack for URL submission

  1. #1
    Member newbieone's Avatar
    Join Date
    Sep 2009
    Location
    Swindon
    Posts
    42
    Blog Entries
    2
    Thanks
    6
    Thanked 9 Times in 5 Posts

    Smile Mini hack for URL submission

    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 (to a certain degree)

    That is all, probably an obvious one but thought I would release it into the ether!
    Last edited by newbieone; 01-07-2010 at 03:56 PM.

  2. Thanked by:


  3. #2
    Former lead dev Nick's Avatar
    Join Date
    Jun 2009
    Location
    Kakamigahara, Japan
    Posts
    2,914
    Blog Entries
    88
    Thanks
    519
    Thanked 845 Times in 550 Posts

    Default

    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.

  4. #3
    Senior Member baadier's Avatar
    Join Date
    Jan 2010
    Location
    Cape Town, South Africa
    Posts
    263
    Thanks
    80
    Thanked 14 Times in 10 Posts

    Default

    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

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Registration and Post Submission Problems
    By runnertalk in forum How-To and Troubleshooting
    Replies: 4
    Last Post: 09-30-2009, 12:00 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •