Heyuri / kokonotsuba

Heyuri's BBS software
Other
19 stars 12 forks source link

Getting rid of ref_url #1

Closed kaguy4 closed 1 year ago

kaguy4 commented 1 year ago

Currently, links on heyuri have prefix https://jump.heyuri.net/? It's defined at _define("REFURL", 'https://jump.heyuri.net/%27); and setting it to blank breaks all links.

Therefore, I want to completely remove ref_url

notACXYZ commented 1 year ago

What if we just change it so it works with a blank input like this?

(Line 173 at /lib/lib_common.php):

/* 網址自動連結 */
function auto_link_callback2($matches) {
    $URL = $matches[1].$matches[2]; // https://example.com

    // Redirect URL!
    if (REF_URL) {
        $URL_Encode = urlencode($URL);  // https%3A%2F%2Fexample.com (For the address bar)
        return '<a href="'.REF_URL.'?'.$URL_Encode.'" target="_blank" rel="nofollow noreferrer">'.$URL.'</a>';
    }
    // Also works if its blank!
    return '<a href="'.$URL.'" target="_blank" rel="nofollow noreferrer">'.$URL.'</a>';
}
kaguy4 commented 1 year ago

What if we just change it so it works with a blank input like this?

(Line 173 at /lib/lib_common.php):

/* 網址自動連結 */
function auto_link_callback2($matches) {
  $URL = $matches[1].$matches[2]; // https://example.com

  // Redirect URL!
  if (REF_URL) {
      $URL_Encode = urlencode($URL);  // https%3A%2F%2Fexample.com (For the address bar)
      return '<a href="'.REF_URL.'?'.$URL_Encode.'" target="_blank" rel="nofollow noreferrer">'.$URL.'</a>';
  }
  // Also works if its blank!
  return '<a href="'.$URL.'" target="_blank" rel="nofollow noreferrer">'.$URL.'</a>';
}

That works perfectly, thanks!