Skip to content
This repository has been archived by the owner on Jul 31, 2023. It is now read-only.

Commit

Permalink
Added additional guards for bad user data in cookies. Fixes #190
Browse files Browse the repository at this point in the history
  • Loading branch information
rvolz committed Nov 19, 2015
1 parent e3c663b commit d8a015d
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 147 deletions.
3 changes: 0 additions & 3 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,3 @@ DEPENDENCIES
less (~> 2.6.0)
rspec
therubyracer (~> 0.12.0)

BUNDLED WITH
1.10.6
2 changes: 1 addition & 1 deletion Rakefile.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
require 'logger'

APPNAME = 'BicBucStriim'
VERSION = '1.3.3'
VERSION = '1.3.4'

SOURCE = "."
LESS = File.join( SOURCE, "style")
Expand Down
18 changes: 11 additions & 7 deletions index.php
Original file line number Diff line number Diff line change
Expand Up @@ -2030,15 +2030,17 @@ function getFilter()
{
global $app;

$user = $app->auth->getUserData();
$app->getLog()->debug('getFilter: ' . var_export($user, true));
$lang = null;
$tag = null;
if (!empty($user['languages']))
$lang = $app->calibre->getLanguageId($user['languages']);
if (!empty($user['tags']))
$tag = $app->calibre->getTagId($user['tags']);
$app->getLog()->debug('getFilter: Using language ' . $lang . ', tag ' . $tag);
if ($app->auth->isValid()) {
$user = $app->auth->getUserData();
$app->getLog()->debug('getFilter: ' . var_export($user, true));
if (!empty($user['languages']))
$lang = $app->calibre->getLanguageId($user['languages']);
if (!empty($user['tags']))
$tag = $app->calibre->getTagId($user['tags']);
$app->getLog()->debug('getFilter: Using language ' . $lang . ', tag ' . $tag);
}
return new CalibreFilter($lang, $tag);
}

Expand Down Expand Up @@ -2100,6 +2102,8 @@ function title_forbidden($book_details)
{
global $app;

if (!$app->auth->isValid())
return false;
$user = $app->auth->getUserData();
if (empty($user['languages']) && empty($user['tags'])) {
return false;
Expand Down
36 changes: 18 additions & 18 deletions lib/BicBucStriim/langs.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,11 @@
'admin_smtpserver_expl' => 'Name oder Adresse des SMTP-Servers',
'admin_smtpusername_expl' => 'Der Benutzername für den SMTP-Server',
'admin_smtpuserpw_expl' => 'Das Passwort für den SMTP-Server ',
'admin_tts' => 'Titel-Sortierung nach Datum',
'admin_tts_expl' => 'Wenn Titel nach Zeit sortiert angezeigt werden sollen, bietet Calibre verschiedene Möglichkeiten. Standardmäßig werden sie nach dem Datum des Eingangs in die Calibre-Bibliothek sortiert.',
'admin_tts_by_lastmodified' => 'Änderungsdatum',
'admin_tts_by_pubdate' => 'Veröffentlichung',
'admin_tts_by_timestamp' => 'Eingangsdatum',
'admin_tts' => 'Titel-Sortierung nach Datum',
'admin_tts_expl' => 'Wenn Titel nach Zeit sortiert angezeigt werden sollen, bietet Calibre verschiedene Möglichkeiten. Standardmäßig werden sie nach dem Datum des Eingangs in die Calibre-Bibliothek sortiert.',
'admin_tts_by_lastmodified' => 'Änderungsdatum',
'admin_tts_by_pubdate' => 'Veröffentlichung',
'admin_tts_by_timestamp' => 'Eingangsdatum',
'admin_username' => 'Benutzername',
'admin_userpw' => 'Passwort',
'admin_userpw_expl' => 'Plichtfeld, darf nicht leer sein',
Expand Down Expand Up @@ -92,7 +92,7 @@
'check_installation' => 'Installation überprüfen?',
'comment' => 'Beschreibung',
'custom_columns' => 'Eigene Calibre-Daten',
'date' => 'Datum',
'date' => 'Datum',
'delete' => 'Löschen',
'display_app_name' => 'Alternativer Titel',
'display_app_name_expl' => 'Wenn die Anwendung einen aussagekräftigeren Namen anzeigen soll. Wird im Seitentitel angezeigt.',
Expand All @@ -111,7 +111,7 @@
'glob_dl_radio3' => 'Ja, anderes Passwort angeben (unten eingeben)',
'home' => 'Start',
'idlinks' => 'ID-Verweise',
'intro' => 'Ihre Bibliothek',
'intro' => 'Ihre Bibliothek',
'invalid_calibredir1' => 'Ungültiges Calibre-Verzeichnis',
'invalid_calibredir2' => 'Auf das angegebene Calibre-Verzeichnis kann nicht zugegriffen werden. Ist es ein Calibre-Verzeichnis? Passen die Zugriffsrechte? Existiert das angegebene Verzeichnis?',
'invalid_password' => 'Ungültiges Passwort',
Expand Down Expand Up @@ -194,9 +194,9 @@
'tag_protect_expl' => 'Mit dieser Option kann der Dwonload-Schutz auf Bücher mit dem angegebenen Schlagwort beschränkt werden. Alle anderen Titel können ohne Passwort heruntergeladen werden.',
'thumb_gen_clipped' => 'Vorschaubilder beschneiden?',
'thumb_gen_clipped_expl' => 'Wenn eingeschaltet, werden die Ränder von Vorschaubilder abgeschnitten, um mehr Details zu liefern.',
'title' => 'Titel',
'title' => 'Titel',
'titles' => 'Bücher',
'titles_sort' => 'Sortieren nach',
'titles_sort' => 'Sortieren nach',
'unknown_error1' => 'Unbekannter Fehler',
'unknown_error2' => 'Ein bisher unbekannter Fehler wurde gemeldet.',
'upload' => 'Hochladen',
Expand Down Expand Up @@ -250,11 +250,11 @@
'admin_smtpserver_expl' => 'Name or address of the SMTP server',
'admin_smtpusername_expl' => 'User name for the SMTP server',
'admin_smtpuserpw_expl' => 'Password for the SMTP server ',
'admin_tts' => 'Sort titles by date',
'admin_tts_expl' => 'Calibre offers various ways to sort books by date. By default books will be sorted by the date when they were added to the Calibre library.',
'admin_tts_by_lastmodified' => 'Date modified',
'admin_tts_by_pubdate' => 'Publication date',
'admin_tts_by_timestamp' => 'Date added',
'admin_tts' => 'Sort titles by date',
'admin_tts_expl' => 'Calibre offers various ways to sort books by date. By default books will be sorted by the date when they were added to the Calibre library.',
'admin_tts_by_lastmodified' => 'Date modified',
'admin_tts_by_pubdate' => 'Publication date',
'admin_tts_by_timestamp' => 'Date added',
'admin_username' => 'User name',
'admin_userpw' => 'Password',
'admin_userpw_expl' => 'Required, must not be empty',
Expand Down Expand Up @@ -292,7 +292,7 @@
'check_installation' => 'Check installation?',
'comment' => 'Description',
'custom_columns' => 'Custom Calibre Data',
'date' => 'Date',
'date' => 'Date',
'delete' => 'Delete',
'display_app_name' => 'Alternative page title',
'display_app_name_expl' => 'In case you would like to give your Calibre library a more descriptive name. Will be displayed in page titles.',
Expand All @@ -311,7 +311,7 @@
'glob_dl_radio3' => 'Yes, use a separate password (enter below)',
'home' => 'Home',
'idlinks' => 'ID links',
'intro' => 'Your library',
'intro' => 'Your library',
'invalid_calibredir1' => 'Invalid Calibre directory',
'invalid_calibredir2' => 'The configured Calibre directory cannot be used. Is it really a Calibre directory? Is it readable? Does it exist?',
'invalid_password' => 'Invalid Password',
Expand Down Expand Up @@ -394,9 +394,9 @@
'tag_protect_expl' => 'If this is activated, only books with the selected tag will be password-protected. All other books can be downloaded without password.',
'thumb_gen_clipped' => 'Clip thumbnails?',
'thumb_gen_clipped_expl' => 'If switched on, the edges of thumbnails will be clipped to show more details.',
'title' => 'Title',
'title' => 'Title',
'titles' => 'Books',
'titles_sort' => 'Sort by',
'titles_sort' => 'Sort by',
'unknown_error1' => 'Unknown Error',
'unknown_error2' => 'An unknown error occured.',
'upload' => 'Upload',
Expand Down
119 changes: 1 addition & 118 deletions style/style.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit d8a015d

Please sign in to comment.