Skip to content
This repository has been archived by the owner on Dec 18, 2020. It is now read-only.

Commit

Permalink
Zeichensatz bei der Wahl von Kürzeln (#2) sowie dynamische(re)
Browse files Browse the repository at this point in the history
Anzeige des aktuellen Hosts, in dem nicht der SERVER_NAME verwendet wird, sondern
der HTTP_HOST. Eine gute Übersicht, wo der Unterschied zwischen diesen
beiden Variablen besteht, liefert http://stackoverflow.com/a/2297421
  • Loading branch information
svenk committed Aug 19, 2015
1 parent 04d2d1b commit a5b9895
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 6 deletions.
2 changes: 1 addition & 1 deletion includes/functions-html.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ function yourls_html_logo() {

<h1 class="department">
<span class="departmentTitle"><a href="/infos" title="Infos">Kurzlink-Service</a></span><br>
<span class="departmentName"><a href="/"><?php echo $_SERVER['SERVER_NAME']; ?></a></span>
<span class="departmentName"><a href="/"><?php echo $_SERVER['HTTP_HOST']; ?></a></span>
</h1>

</div>
Expand Down
19 changes: 16 additions & 3 deletions user/plugins/random-keywords/plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,14 @@
* Fixed: plugin now complies to character set defined in config.php
*/

/*
* Known BUGS (by Sven):
* The random keywords are not checked for collision in this plugin.
* There should be a good collision avoidance algorithm by just incrementing
* $osz_random_keyword['length'] by one when a collision takes place.
*/


global $ozh_random_keyword;

/*
Expand All @@ -25,14 +33,19 @@
$ozh_random_keyword['length'] = 4; # was 5

/*
* DO NOT EDIT FARTHER
*/
* yourls_rnd_string $types:
* '0' = yourls_get_shorturl_charset(), derzeit Base62 = Lower+Uppercase
* '1' = only lowercase, no vowels, no confusion with 0/o, 1/l
* etc.
* I think we stick to '1' which gives friendly random keys.
*/
$ozh_random_keyword['type'] = '1';

// Generate a random keyword
yourls_add_filter( 'random_keyword', 'ozh_random_keyword' );
function ozh_random_keyword() {
global $ozh_random_keyword;
return yourls_rnd_string( $ozh_random_keyword['length'] );
return yourls_rnd_string( $ozh_random_keyword['length'], $osz_random_keyword['type'] );
}

// Don't increment sequential keyword tracker
Expand Down
10 changes: 8 additions & 2 deletions user/public.config.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
** If you define it to "http://site.com", don't use "http://www.site.com" in your browser (and vice-versa) */

// TODO: Possibly install the allow-aliases plugin: https://code.google.com/p/yourls-allow-aliases/source/browse/trunk/allow-aliases/plugin.php
define( 'YOURLS_SITE', 'http://shorten.physikelearning.de' );
define( 'YOURLS_SITE', 'http://'.$_SERVER['HTTP_HOST'] );

/** Timezone GMT offset */
define( 'YOURLS_HOURS_OFFSET', +1 );
Expand Down Expand Up @@ -95,7 +95,13 @@
*/

/** URL shortening method: 36 or 62 */
define( 'YOURLS_URL_CONVERT', 36 );
define( 'YOURLS_URL_CONVERT', 62 );

// Base36: 0123456789abcdefghijklmnopqrstuvwxyz
// Base62: 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
// that is, Base 62 allows upper case letters


/*
* 36: generates all lowercase keywords (ie: 13jkm)
* 62: generates mixed case keywords (ie: 13jKm or 13JKm)
Expand Down

1 comment on commit a5b9895

@svenk
Copy link
Member Author

@svenk svenk commented on a5b9895 Aug 19, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dieser Commit hat ein Problem verursacht, und zwar geht das dynamische Erzeugen von Kürzeln jetzt nicht mehr richtig. Es passiert einfach nichts, das PHP Script timet aus, keine Fehlermeldung, gar nichts. Sehr seltsam, sollte mal unter Apache statt nginx/FPM versucht werden zu reproduzieren.

Please sign in to comment.