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

Submit 3.5

Discussion in 'Plugins' started by Nick, Aug 1, 2009.

  1. angolanmade

    angolanmade Well-Known Member

    Hi Nick,

    Thanks for the reply, The url structure with .htaccess on:



  2. Nick

    Nick Well-Known Member

    You would have to go through the plugin and rename all references to the page name. Also, other plugins that depend on this one might be affected. It's just not worth it in my opinion. I'm not going to make those changes to this plugin. Sorry.
  3. shibuya246

    shibuya246 Hotaru Developer Staff Member Admin

    When I see the word "Share" on blogs I normally think they mean I can take that content and share it somewhere else.
    When I see the word "Submit", I normally think I am putting something onto the site before me.

    So for a Hotaru CMS site, submit seems more logical than share, but an alternative to submit is still worth thinking about if you feel the word submit is not relevant. I think "Share" is already linked in many peoples mind to sending content away from a site rather than into it, like the sharethis button

  4. angolanmade

    angolanmade Well-Known Member

    I figured this would be extremely labor intensive and that's why I said "thinking out loud"
    Would love to see the share/submit experience for this plugin to improve as we move forward.

    Thanks for your efforts.
    Nick and shibuya246 like this.
  5. shibuya246

    shibuya246 Hotaru Developer Staff Member Admin


    updated to add an id tag on the submit forms and to catch up with other 3 versions that didnt get posted here
  6. Graeme

    Graeme Member

    Submit 3.6

    Hey all, I've made what I think is a really good addition to the submit plugin.

    I thought it was a bit of a pain when there was a huge amount of categories to submit into, and users may not choose the correct one...so check out what I've done:


    I've added it as an option in the admin settings, so you can disable/enable this addition.

    Here's the code, I will upload to my github too for easier access..
    nothingman and valMETNG like this.
  7. Graeme

    Graeme Member

    Extra admin setting:
  8. valMETNG

    valMETNG Administrator Staff Member Admin

    Oh, that's very nice. Very nice indeed. Thanx for sharing.
    Graeme likes this.
  9. Graeme

    Graeme Member

    Hey I left a line with localhost url in categorySubmitButtonScriot(), I need to correct it, and then reupload...one sec
  10. Graeme

    Graeme Member

    Here, please let me know if any errors:

    Attached Files:

    nothingman, ilovehotaru and valMETNG like this.
  11. soufron

    soufron New Member

    is it possible to let the "description" be optional to the choice of the submitter?

    I want my submitters to put or to edit a description when they want it. I want to allow them to write nothing if they are in a hurry. But everytime I put "0" in the minimum number of characters for description, it keeps putting back the former number that were in that field ("50" by default).

    Is there a solution?
  12. angolanmade

    angolanmade Well-Known Member

    How can we add the ability to put a post in draft mode (pending) prior to submitting it.

    Also once a user submits a post and it goes into moderation, they don't have the ability to make changes to their post

    How about an auto save feature?

    Just some thoughts?
  13. valMETNG

    valMETNG Administrator Staff Member Admin

    Regarding draft mode, there is a setting in plugin management to "Put all new posts in the moderation queue." I've never used that option, but I assume that's what it does. As to the auto save feature, if you incorporate ckeditor, ckeditor does have a plugin that has an auto save feature. It can be a bit annoying sometimes, but it does work.
  14. valMETNG

    valMETNG Administrator Staff Member Admin

    Came across an interesting issue today with submitting a URL from a page like http://www.tagesanzeiger.ch/ausland/europa/More-punk-less-hell/story/10069405. The site's HTML is a bit messed up and the submitted_date['submit_title'] variable brought in the corrupted data, which then prevented submitting the URL. To catch this, I added the following at line 169 (after $h->vars['submitted_data']['submit_title'] = $title) in SubmitFunctions.php:
    $title = substr($title, 0, stripos($title, '</title>') + 8);
    This cuts off anything that comes after the title (</title>), including the tag, just in case there's a problem with the page.

    Edit: I actually just realized this might be just specific to my implementation (read: massive amounts of customization), so this might not be an issue for a base build. You can use that link to determine if it's an issue.
    Last edited: Jun 19, 2014
  15. sereban

    sereban Active Member

    What files need to be edited to change the text editor to submit Step2 and how can I change this text editor for ordinary text field?
  16. valMETNG

    valMETNG Administrator Staff Member Admin

    I'm not 100% certain, but I believe if you remove the following code from plugins/submit/javascript/submit.js (or delete the file entirely), the field will default to a plain textarea and not use summernote:
      height: 300
    shibuya246 and sereban like this.
  17. sereban

    sereban Active Member

    Thanks! It worked.
    valMETNG likes this.
  18. valMETNG

    valMETNG Administrator Staff Member Admin

    @Sv9t just found a somewhat complicated bug that occurs when the submit title has a backslash in it. In further testing, I found I can create this same error when submit content also has a backslash. For example, the text:
    ...will generate the error.

    When either is saved via function saveSubmitData and then loaded via loadSubmitData, you receive an error similar to:
    I'm quite embarrassed to admit how long it took to find an acceptable resolution, but it's not really a complete solution because Hotaru uses stripslashes in many places for post title and post content (which automatically removes any backslashes).

    Out of all the alternatives I evaluated, this is probably the simplest. To prevent the unserialize/offset error, in /content/plugins/submit/libs/SubmitFunctions.php, replace line 273 with:
    foreach ($h->vars['submitted_data'] as $key => $data) { $h->vars['submitted_data'][$key] = urlencode($data); }
    ...and replace line 301 with:
      if ($submitted_data)
             $data_array = array();
             $encoded_data = unserialize($submitted_data);
             foreach ($encoded_data as $key => $data)
             { $data_array[$key] = urldecode($data); }
             return $data_array;
           } else { return array(); }
    However, Hotaru will still strip the backslashes when displaying the content (even though it will be saved correctly) and we'd need to make many more modifications to correct that behavior (e.g., instead of using stripslashes in /libs/Post.php, we'd probably want to use something like this). A quick search of Hotaru base indicated 66 uses of stripslashes, but I don't think all of them would need to change.

    @Sv9t (or @sereban), is it common in Cyrillic to use \ in text?
    Sv9t likes this.
  19. valMETNG

    valMETNG Administrator Staff Member Admin

    Actually, this might not work either because, after I submit the post (which it takes), I can't click on the URL because it seems $h->post->url is being encoded twice before being saved to the database (although I'm not sure why yet or where this is happening). @Sv9t, can you please test and confirm?
  20. sereban

    sereban Active Member

    Maybe my code is slightly different on a line 273 and 301 /content/plugins/submit/libs/SubmitFunctions.php, and I did not get the right to replace the line ..
    line 262  /**
         * Save submission step data
         * @return bool
        public function saveSubmitData($h)
            // delete everything in this table older than 30 minutes:
            $sid = preg_replace('/[^a-z0-9]+/i', '', session_id());
            $key = md5(microtime() . $sid . rand());
            $sql = "INSERT INTO " . TABLE_TEMPDATA . " (tempdata_key, tempdata_value, tempdata_updateby) VALUES (%s,%s, %d)";
            $h->db->query($h->db->prepare($sql, $key, serialize($h->vars['submitted_data']), $h->currentUser->id));
            return $key;
        } line 277
        line 280  /**
         * Retrieve submission step data
         * @param $key - empty when setting
         * @return bool
        public function loadSubmitData($h, $key = '')
            // delete everything in this table older than 30 minutes:
            if (!$key) { return array(); }
            $cleanKey = preg_replace('/[^a-z0-9]+/','',$key);
            if (strcmp($key,$cleanKey) != 0) {
                return array();
            } else {
                $sql = "SELECT tempdata_value FROM " . TABLE_TEMPDATA . " WHERE tempdata_key = %s ORDER BY tempdata_updatedts DESC LIMIT 1";
                $submitted_data = $h->db->get_var($h->db->prepare($sql, $key));
                if ($submitted_data) { return unserialize($submitted_data); } else { return array(); }
        } line 301

Share This Page