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. robin007

    robin007 Well-Known Member

    nothing submitted... error

    some url getting this error

    I am using
    submit 3.6
    submit light 0.5
     
  2. valMETNG

    valMETNG Administrator Staff Member Admin

    Try this solution.
     
    robin007 likes this.
  3. robin007

    robin007 Well-Known Member

    WoW its working Thanks.
     
  4. robin007

    robin007 Well-Known Member

    oops sorry
    i am getting function after the title.
    this is my title (????????????? : ???? ???????????????? ?????? - 36 ) function a(){var b=window.location.href,c=b.split("?");switch(c.length){case 1:return b+"?m=1";case 2:return 0
     
  5. valMETNG

    valMETNG Administrator Staff Member Admin

    That's because their HTML is bad. Hotaru picks up what they have and then gives the user the option to change it.
     
  6. robin007

    robin007 Well-Known Member

    User submit a post through external vote button. (without login)

    they got this error Sorry, you don't have permission to post links

    how to redirect to login page
     
  7. valMETNG

    valMETNG Administrator Staff Member Admin

    Not sure if this will work but I'm guessing the easiest way would be to use a modified version of the /content/plugins/submit/libs/SubmitFunctions.php function checkErrors1 and add the following after line 129 in /content/plugins/submit/submit.php:

    Code:
    // check user is logged in
            if (!$h->currentUser->loggedIn) {
                // Redirect to login page
                    $url = (isset($h->vars['submitted_data']['submit_orig_url'])) ? $h->vars['submitted_data']['submit_orig_url'] : false;
                    if ($url) {
                            $return = urlencode(BASEURL . 'index.php?page=submit&url=' . urlencode($url));
                            header("Location: " . BASEURL . 'index.php?page=login&return=' . $return);
                    } else {
                            $return = urlencode($h->url(array('page'=>'submit')));
                            header("Location: " . $h->url(array('page'=>'login', 'return'=>$return)));
                    }
                die(); exit;
            }
     
  8. robin007

    robin007 Well-Known Member

    Thanks.

    It redirect to login page after login, It redirect to home page.
    I am from external vote button So need to redirect to submit2 page. with grabbing url and title.
     
  9. valMETNG

    valMETNG Administrator Staff Member Admin

    Then, instead of the code I posted, you could probably force the $url by just doing something like:
    Code:
    if (!$h->currentUser->loggedIn) {
    $url = $h->url(array('page'=>'submit2'));
    $return = urlencode(BASEURL . 'index.php?page=submit&url=' . urlencode($url));
    header("Location: " . BASEURL . 'index.php?page=login&return=' . $return);
    }
    
     
  10. robin007

    robin007 Well-Known Member

    This code grabbing my site login page url and title. Not grabbing from source.
     
  11. valMETNG

    valMETNG Administrator Staff Member Admin

    I don't know how EVB works. When you click on the EVB button, what is the full URL it wants to send you to?
     
  12. robin007

    robin007 Well-Known Member

    My site users using EVB. This is nothing like facebook share button. it grab user blog or site post url.

    Thanks.
     
  13. valMETNG

    valMETNG Administrator Staff Member Admin

    Alright, let's go back to this post. Add the following after line 129 in /content/plugins/submit/submit.php:

    Code:
    if (!$h->currentUser->loggedIn) {
            $url = (isset($h->vars['submitted_data']['submit_orig_url'])) ? $h->vars['submitted_data']['submit_orig_url'] : "empty";
            print "<br>submit_orig_url = " . $url;
            print "<br>uri = " . $h->cage->server->sanitizeTags('REQUEST_URI');
            exit;
        }
    Then paste the output here so I can see what's coming in.
     
  14. robin007

    robin007 Well-Known Member

    Result
    submit_orig_url = empty
    uri = /index.php?page=submit&url=https://myblogname.blogspot.com/
     
    Last edited: Oct 23, 2018
  15. robin007

    robin007 Well-Known Member

  16. valMETNG

    valMETNG Administrator Staff Member Admin

  17. valMETNG

    valMETNG Administrator Staff Member Admin

    When you say it is "stored like this," are you saying that's the way it is stored in the hotaru_posts table, specifically the post_orig_url column, after you submit it?
     
  18. valMETNG

    valMETNG Administrator Staff Member Admin

    Please add the following after line 129 in /content/plugins/submit/submit.php and post the output:

    Code:
    // check user is logged in
        if (!$h->currentUser->loggedIn) {
            $request_uri = $h->cage->server->sanitizeTags('REQUEST_URI');
            $search_for = "&url=";
            $search_for_length = strlen($search_for);
            $url_position_start = strpos($request_uri, $search_for) + $search_for_length;
    
            $url = ($url_position_start > $search_for_length) ? substr($request_uri, $url_position_start) : "no URL";
    
            print "<br>request_uri = " . $request_uri;
            print "<br>search_for_length = " . $search_for_length;
            print "<br>url_position_start = " . $url_position_start;
            print "<br>url = " . $url;
            exit;
    
            if ($url) {
                $return = urlencode(BASEURL . 'index.php?page=submit&url=' . urlencode($url));
                header("Location: " . BASEURL . 'index.php?page=login&return=' . $return);
            } else {
                $return = urlencode($h->url(array('page'=>'submit')));
                header("Location: " . $h->url(array('page'=>'login', 'return'=>$return)));
            }
            exit;
        }
     
    robin007 likes this.
  19. robin007

    robin007 Well-Known Member

    The result is

    request_uri = /index.php?page=submit&url=https://myblog.blogspot.com/2018/06/share-button.html
    search_for_length = 5
    url_position_start = 27
    url = https://myblog.blogspot.com/2018/06/share-button.html
     
  20. robin007

    robin007 Well-Known Member

    I removed this lines
    print "<br>request_uri = " . $request_uri;
    print "<br>search_for_length = " . $search_for_length;
    print "<br>url_position_start = " . $url_position_start;
    print "<br>url = " . $url;
    exit;

    Now it is working fine thank you very much.
     
    valMETNG likes this.

Share This Page