Pridany fortunky
authorThomas Mudrunka <tomas@mudrunka.cz>
Wed, 14 Mar 2012 15:04:09 +0000 (16:04 +0100)
committerThomas Mudrunka <tomas@mudrunka.cz>
Wed, 14 Mar 2012 15:04:09 +0000 (16:04 +0100)
index.php
lib/Fortune.php [new file with mode: 0755]
locale/cs/fortunes.txt [new file with mode: 0644]

index 6b5df8b9d7f95f640af0e9cd059afae5ad33a1aa..dcdb56d07e4b57602271e9c31ce8433447d2d154 100755 (executable)
--- a/index.php
+++ b/index.php
@@ -24,6 +24,7 @@ require_once('Sklad_Auth.class/common.php');
 require_once('HTTP_Auth.class.php');
 require_once('Locale.class.php');
 require_once('Barcode.class.php');
+require_once('Fortune.php');
 
 /**
 * Trida poskytuje vseobecne funkce pro generovani HTML kodu
@@ -180,7 +181,7 @@ class Sklad_HTML extends HTML { //TODO: Split into few more methods
                $script = $_SERVER['SCRIPT_NAME'];
                $search = htmlspecialchars(@trim($_GET['q']));
                $message = strip_tags(@trim($_GET['message']),'<a><b><u><i><br>');
-               $fortune = 'test';
+               $fortune = fortune();
                $instance = INSTANCE_ID != '' ? '/'.INSTANCE_ID : '';
                $user_id = htmlspecialchars($user['id']);
                $user_gid = htmlspecialchars($user['gid']);
@@ -288,7 +289,7 @@ EOF;
 <div style="background-color:#FFDDDD;">
        <font color="red">$message</font>
 </div>
-<div style="text-align:right;">
+<div style="text-align:right; color:darkgreen;">
 $fortune
 </div>
 EOF;
diff --git a/lib/Fortune.php b/lib/Fortune.php
new file mode 100755 (executable)
index 0000000..1b4683e
--- /dev/null
@@ -0,0 +1,26 @@
+<?php
+/*
+ * Harvie's PHP Fortunes
+ * Copyright (C) 2o11  Thomas Mudrunka
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+
+function fortune() {
+       $file = DIR_LOCALE.'/'.LOCALE_LANG.'/'.'fortunes.txt';
+       if(!is_file($file)) return false;
+       $fortunes = file($file, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
+       return $fortunes[rand(0,sizeof($fortunes)-1)];
+}
diff --git a/locale/cs/fortunes.txt b/locale/cs/fortunes.txt
new file mode 100644 (file)
index 0000000..ce23d5f
--- /dev/null
@@ -0,0 +1,26 @@
+Forkni si <a href="http://github.com/harvie/sokoman">mě</a> na GIThubu :-)<a href="http://github.com/harvie/sokoman"><img style="position: absolute; top: 0; left: 0; border: 0; height:120px; background-color:transparent;" src="http://s3.amazonaws.com/github/ribbons/forkme_left_red_aa0000.png" alt="Fork me on GitHub" /></a>
+<font color="pink">Tenhle <a href="http://www.cornify.com" onclick="cornify_add();return false;">jednorožec</a><script type="text/javascript" src="http://www.cornify.com/js/cornify.js"></script> je jenom pro tebe a je z lásky :-*</font>
+<small><small><small>Toto není podprahová reklama.</small></small></small>
+
+Lotek tě vidí 8-)
+Vitex je bůh :-D
+Založ odborové hnutí!
+Máš nárok na placený volno!
+Aštar Šeran tě miluje :-*
+Ser na halomrdy - následuj svuj spirit!
+ČTŮ varuje: WIFI způsobuje rakovinu plic.
+Při práci s klávesnicí používejte ochranné a bezpečnostní pomůcky dle normy ISO:2323
+Sex a prachy lžou
+Středověk neskončil
+Středověk trvá
+
+Čárové kódy i sériová čísla musí být jedinečná!
+Položky jsou skutečné věci skladem.
+Modely jsou "typ" věcí (jen virtuální) a skladem nemusí být.
+Při naskladňování nezapomeň vyplnit dodavatele a sklad na který zboží půjde.
+Pokud si něco bereš ze skladu, tak to vyskladni.
+Nevyskladňuj něco, co nemáš v ruce.
+Před naskladněním úplně nové věci, která ještě nebyla naskladněna, je většinou potřeba přidat model.
+Před přidáním nového modelu se UJISTI, že ve skladu už není od minule!
+Před vyskladněním nebo prodejem se ujisti, že máš správný sériový číslo.
+Krabice kabelů a podobné se naskladňují po metrech.
This page took 0.167275 seconds and 4 git commands to generate.